Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
655 lines (623 sloc) 275 KB
<!DOCTYPE html>
<html class="init-no-js">
<head>
<meta charset="UTF-8" />
<title>sqTwineSound_demo</title>
<meta name="viewport" content="width=device-width,initial-scale=1" />
<!--
SugarCube (v1.0.3): A free (gratis and libre) header for Twine/Twee, based on TiddlyWiki.
Copyright © 2013–2014 Thomas Michael Edwards.
-->
<!--
Build Info:
* Built on 23 Jan 2015 at 15:28:20, -0800
* Made in Twine 1.4.2 (running on Darwin 14.0.0)
-->
<script type="text/javascript">
/* init wapper start */
if(!document.head||!document.querySelector||!document.addEventListener||!window.JSON||!Object.getPrototypeOf||!Object.freeze){document.documentElement.className="init-lacking";}else{document.documentElement.className="init-loading";
/*! jQuery v2.1.0 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k="".trim,l={},m=a.document,n="2.1.0",o=function(a,b){return new o.fn.init(a,b)},p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};o.fn=o.prototype={jquery:n,constructor:o,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=o.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return o.each(this,a,b)},map:function(a){return this.pushStack(o.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},o.extend=o.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||o.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(o.isPlainObject(d)||(e=o.isArray(d)))?(e?(e=!1,f=c&&o.isArray(c)?c:[]):f=c&&o.isPlainObject(c)?c:{},g[b]=o.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},o.extend({expando:"jQuery"+(n+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===o.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return a-parseFloat(a)>=0},isPlainObject:function(a){if("object"!==o.type(a)||a.nodeType||o.isWindow(a))return!1;try{if(a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(b){return!1}return!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=o.trim(a),a&&(1===a.indexOf("use strict")?(b=m.createElement("script"),b.text=a,m.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":k.call(a)},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?o.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),o.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||o.guid++,f):void 0},now:Date.now,support:l}),o.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=o.type(a);return"function"===c||o.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s="sizzle"+-new Date,t=a.document,u=0,v=0,w=eb(),x=eb(),y=eb(),z=function(a,b){return a===b&&(j=!0),0},A="undefined",B=1<<31,C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=D.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",M=L.replace("w","w#"),N="\\["+K+"*("+L+")"+K+"*(?:([*^$|!~]?=)"+K+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+M+")|)|)"+K+"*\\]",O=":("+L+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+N.replace(3,8)+")*)|.*)\\)|)",P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(O),U=new RegExp("^"+M+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L.replace("w","w*")+")"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=/'|\\/g,ab=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),bb=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{G.apply(D=H.call(t.childNodes),t.childNodes),D[t.childNodes.length].nodeType}catch(cb){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function db(a,b,d,e){var f,g,h,i,j,m,p,q,u,v;if((b?b.ownerDocument||b:t)!==l&&k(b),b=b||l,d=d||[],!a||"string"!=typeof a)return d;if(1!==(i=b.nodeType)&&9!==i)return[];if(n&&!e){if(f=Z.exec(a))if(h=f[1]){if(9===i){if(g=b.getElementById(h),!g||!g.parentNode)return d;if(g.id===h)return d.push(g),d}else if(b.ownerDocument&&(g=b.ownerDocument.getElementById(h))&&r(b,g)&&g.id===h)return d.push(g),d}else{if(f[2])return G.apply(d,b.getElementsByTagName(a)),d;if((h=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(h)),d}if(c.qsa&&(!o||!o.test(a))){if(q=p=s,u=b,v=9===i&&a,1===i&&"object"!==b.nodeName.toLowerCase()){m=ob(a),(p=b.getAttribute("id"))?q=p.replace(_,"\\$&"):b.setAttribute("id",q),q="[id='"+q+"'] ",j=m.length;while(j--)m[j]=q+pb(m[j]);u=$.test(a)&&mb(b.parentNode)||b,v=m.join(",")}if(v)try{return G.apply(d,u.querySelectorAll(v)),d}catch(w){}finally{p||b.removeAttribute("id")}}}return xb(a.replace(P,"$1"),b,d,e)}function eb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function fb(a){return a[s]=!0,a}function gb(a){var b=l.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function hb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function ib(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||B)-(~a.sourceIndex||B);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function jb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function kb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function lb(a){return fb(function(b){return b=+b,fb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function mb(a){return a&&typeof a.getElementsByTagName!==A&&a}c=db.support={},f=db.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},k=db.setDocument=function(a){var b,e=a?a.ownerDocument||a:t,g=e.defaultView;return e!==l&&9===e.nodeType&&e.documentElement?(l=e,m=e.documentElement,n=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){k()},!1):g.attachEvent&&g.attachEvent("onunload",function(){k()})),c.attributes=gb(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=gb(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(e.getElementsByClassName)&&gb(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=gb(function(a){return m.appendChild(a).id=s,!e.getElementsByName||!e.getElementsByName(s).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==A&&n){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){var c=typeof a.getAttributeNode!==A&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==A?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==A&&n?b.getElementsByClassName(a):void 0},p=[],o=[],(c.qsa=Y.test(e.querySelectorAll))&&(gb(function(a){a.innerHTML="<select t=''><option selected=''></option></select>",a.querySelectorAll("[t^='']").length&&o.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||o.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll(":checked").length||o.push(":checked")}),gb(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&o.push("name"+K+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||o.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),o.push(",.*:")})),(c.matchesSelector=Y.test(q=m.webkitMatchesSelector||m.mozMatchesSelector||m.oMatchesSelector||m.msMatchesSelector))&&gb(function(a){c.disconnectedMatch=q.call(a,"div"),q.call(a,"[s!='']:x"),p.push("!=",O)}),o=o.length&&new RegExp(o.join("|")),p=p.length&&new RegExp(p.join("|")),b=Y.test(m.compareDocumentPosition),r=b||Y.test(m.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},z=b?function(a,b){if(a===b)return j=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===t&&r(t,a)?-1:b===e||b.ownerDocument===t&&r(t,b)?1:i?I.call(i,a)-I.call(i,b):0:4&d?-1:1)}:function(a,b){if(a===b)return j=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],k=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:i?I.call(i,a)-I.call(i,b):0;if(f===g)return ib(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)k.unshift(c);while(h[d]===k[d])d++;return d?ib(h[d],k[d]):h[d]===t?-1:k[d]===t?1:0},e):l},db.matches=function(a,b){return db(a,null,null,b)},db.matchesSelector=function(a,b){if((a.ownerDocument||a)!==l&&k(a),b=b.replace(S,"='$1']"),!(!c.matchesSelector||!n||p&&p.test(b)||o&&o.test(b)))try{var d=q.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return db(b,l,null,[a]).length>0},db.contains=function(a,b){return(a.ownerDocument||a)!==l&&k(a),r(a,b)},db.attr=function(a,b){(a.ownerDocument||a)!==l&&k(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!n):void 0;return void 0!==f?f:c.attributes||!n?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},db.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},db.uniqueSort=function(a){var b,d=[],e=0,f=0;if(j=!c.detectDuplicates,i=!c.sortStable&&a.slice(0),a.sort(z),j){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return i=null,a},e=db.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=db.selectors={cacheLength:50,createPseudo:fb,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ab,bb),a[3]=(a[4]||a[5]||"").replace(ab,bb),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||db.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&db.error(a[0]),a},PSEUDO:function(a){var b,c=!a[5]&&a[2];return V.CHILD.test(a[0])?null:(a[3]&&void 0!==a[4]?a[2]=a[4]:c&&T.test(c)&&(b=ob(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ab,bb).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=w[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&w(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==A&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=db.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),t=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&t){k=q[s]||(q[s]={}),j=k[a]||[],n=j[0]===u&&j[1],m=j[0]===u&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[u,n,m];break}}else if(t&&(j=(b[s]||(b[s]={}))[a])&&j[0]===u)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(t&&((l[s]||(l[s]={}))[a]=[u,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||db.error("unsupported pseudo: "+a);return e[s]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?fb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:fb(function(a){var b=[],c=[],d=g(a.replace(P,"$1"));return d[s]?fb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:fb(function(a){return function(b){return db(a,b).length>0}}),contains:fb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:fb(function(a){return U.test(a||"")||db.error("unsupported lang: "+a),a=a.replace(ab,bb).toLowerCase(),function(b){var c;do if(c=n?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===m},focus:function(a){return a===l.activeElement&&(!l.hasFocus||l.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:lb(function(){return[0]}),last:lb(function(a,b){return[b-1]}),eq:lb(function(a,b,c){return[0>c?c+b:c]}),even:lb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:lb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:lb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:lb(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=jb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=kb(b);function nb(){}nb.prototype=d.filters=d.pseudos,d.setFilters=new nb;function ob(a,b){var c,e,f,g,h,i,j,k=x[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=Q.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=R.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(P," ")}),h=h.slice(c.length));for(g in d.filter)!(e=V[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?db.error(a):x(a,i).slice(0)}function pb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function qb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=v++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[u,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[s]||(b[s]={}),(h=i[d])&&h[0]===u&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function rb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function sb(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function tb(a,b,c,d,e,f){return d&&!d[s]&&(d=tb(d)),e&&!e[s]&&(e=tb(e,f)),fb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||wb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:sb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=sb(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=sb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ub(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],i=g||d.relative[" "],j=g?1:0,k=qb(function(a){return a===b},i,!0),l=qb(function(a){return I.call(b,a)>-1},i,!0),m=[function(a,c,d){return!g&&(d||c!==h)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>j;j++)if(c=d.relative[a[j].type])m=[qb(rb(m),c)];else{if(c=d.filter[a[j].type].apply(null,a[j].matches),c[s]){for(e=++j;f>e;e++)if(d.relative[a[e].type])break;return tb(j>1&&rb(m),j>1&&pb(a.slice(0,j-1).concat({value:" "===a[j-2].type?"*":""})).replace(P,"$1"),c,e>j&&ub(a.slice(j,e)),f>e&&ub(a=a.slice(e)),f>e&&pb(a))}m.push(c)}return rb(m)}function vb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,i,j,k){var m,n,o,p=0,q="0",r=f&&[],s=[],t=h,v=f||e&&d.find.TAG("*",k),w=u+=null==t?1:Math.random()||.1,x=v.length;for(k&&(h=g!==l&&g);q!==x&&null!=(m=v[q]);q++){if(e&&m){n=0;while(o=a[n++])if(o(m,g,i)){j.push(m);break}k&&(u=w)}c&&((m=!o&&m)&&p--,f&&r.push(m))}if(p+=q,c&&q!==p){n=0;while(o=b[n++])o(r,s,g,i);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=E.call(j));s=sb(s)}G.apply(j,s),k&&!f&&s.length>0&&p+b.length>1&&db.uniqueSort(j)}return k&&(u=w,h=t),r};return c?fb(f):f}g=db.compile=function(a,b){var c,d=[],e=[],f=y[a+" "];if(!f){b||(b=ob(a)),c=b.length;while(c--)f=ub(b[c]),f[s]?d.push(f):e.push(f);f=y(a,vb(e,d))}return f};function wb(a,b,c){for(var d=0,e=b.length;e>d;d++)db(a,b[d],c);return c}function xb(a,b,e,f){var h,i,j,k,l,m=ob(a);if(!f&&1===m.length){if(i=m[0]=m[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&c.getById&&9===b.nodeType&&n&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(ab,bb),b)||[])[0],!b)return e;a=a.slice(i.shift().value.length)}h=V.needsContext.test(a)?0:i.length;while(h--){if(j=i[h],d.relative[k=j.type])break;if((l=d.find[k])&&(f=l(j.matches[0].replace(ab,bb),$.test(i[0].type)&&mb(b.parentNode)||b))){if(i.splice(h,1),a=f.length&&pb(i),!a)return G.apply(e,f),e;break}}}return g(a,m)(f,b,!n,e,$.test(a)&&mb(b.parentNode)||b),e}return c.sortStable=s.split("").sort(z).join("")===s,c.detectDuplicates=!!j,k(),c.sortDetached=gb(function(a){return 1&a.compareDocumentPosition(l.createElement("div"))}),gb(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||hb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&gb(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||hb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),gb(function(a){return null==a.getAttribute("disabled")})||hb(J,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),db}(a);o.find=t,o.expr=t.selectors,o.expr[":"]=o.expr.pseudos,o.unique=t.uniqueSort,o.text=t.getText,o.isXMLDoc=t.isXML,o.contains=t.contains;var u=o.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(o.isFunction(b))return o.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return o.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return o.filter(b,a,c);b=o.filter(b,a)}return o.grep(a,function(a){return g.call(b,a)>=0!==c})}o.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?o.find.matchesSelector(d,a)?[d]:[]:o.find.matches(a,o.grep(b,function(a){return 1===a.nodeType}))},o.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(o(a).filter(function(){for(b=0;c>b;b++)if(o.contains(e[b],this))return!0}));for(b=0;c>b;b++)o.find(a,e[b],d);return d=this.pushStack(c>1?o.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?o(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=o.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof o?b[0]:b,o.merge(this,o.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:m,!0)),v.test(c[1])&&o.isPlainObject(b))for(c in b)o.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=m.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=m,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):o.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(o):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),o.makeArray(a,this))};A.prototype=o.fn,y=o(m);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};o.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&o(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),o.fn.extend({has:function(a){var b=o(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(o.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?o(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&o.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?o.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(o(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(o.unique(o.merge(this.get(),o(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}o.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return o.dir(a,"parentNode")},parentsUntil:function(a,b,c){return o.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return o.dir(a,"nextSibling")},prevAll:function(a){return o.dir(a,"previousSibling")},nextUntil:function(a,b,c){return o.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return o.dir(a,"previousSibling",c)},siblings:function(a){return o.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return o.sibling(a.firstChild)},contents:function(a){return a.contentDocument||o.merge([],a.childNodes)}},function(a,b){o.fn[a]=function(c,d){var e=o.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=o.filter(d,e)),this.length>1&&(C[a]||o.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return o.each(a.match(E)||[],function(a,c){b[c]=!0}),b}o.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):o.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){o.each(b,function(b,c){var d=o.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&o.each(arguments,function(a,b){var c;while((c=o.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?o.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},o.extend({Deferred:function(a){var b=[["resolve","done",o.Callbacks("once memory"),"resolved"],["reject","fail",o.Callbacks("once memory"),"rejected"],["notify","progress",o.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return o.Deferred(function(c){o.each(b,function(b,f){var g=o.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&o.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?o.extend(a,d):d}},e={};return d.pipe=d.then,o.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&o.isFunction(a.promise)?e:0,g=1===f?a:o.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&o.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;o.fn.ready=function(a){return o.ready.promise().done(a),this},o.extend({isReady:!1,readyWait:1,holdReady:function(a){a?o.readyWait++:o.ready(!0)},ready:function(a){(a===!0?--o.readyWait:o.isReady)||(o.isReady=!0,a!==!0&&--o.readyWait>0||(H.resolveWith(m,[o]),o.fn.trigger&&o(m).trigger("ready").off("ready")))}});function I(){m.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),o.ready()}o.ready.promise=function(b){return H||(H=o.Deferred(),"complete"===m.readyState?setTimeout(o.ready):(m.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},o.ready.promise();var J=o.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===o.type(c)){e=!0;for(h in c)o.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,o.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(o(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};o.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=o.expando+Math.random()}K.uid=1,K.accepts=o.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,o.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(o.isEmptyObject(f))o.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,o.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{o.isArray(b)?d=b.concat(b.map(o.camelCase)):(e=o.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!o.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?o.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}o.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b)},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),o.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;
while(c--)d=g[c].name,0===d.indexOf("data-")&&(d=o.camelCase(d.slice(5)),P(f,d,e[d]));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=o.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),o.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||o.isArray(c)?d=L.access(a,b,o.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=o.queue(a,b),d=c.length,e=c.shift(),f=o._queueHooks(a,b),g=function(){o.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:o.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),o.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?o.queue(this[0],a):void 0===b?this:this.each(function(){var c=o.queue(this,a,b);o._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&o.dequeue(this,a)})},dequeue:function(a){return this.each(function(){o.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=o.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=L.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var Q=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,R=["Top","Right","Bottom","Left"],S=function(a,b){return a=b||a,"none"===o.css(a,"display")||!o.contains(a.ownerDocument,a)},T=/^(?:checkbox|radio)$/i;!function(){var a=m.createDocumentFragment(),b=a.appendChild(m.createElement("div"));b.innerHTML="<input type='radio' checked='checked' name='t'/>",l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";l.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return m.activeElement}catch(a){}}o.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=o.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof o!==U&&o.event.triggered!==b.type?o.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],n=q=h[1],p=(h[2]||"").split(".").sort(),n&&(l=o.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=o.event.special[n]||{},k=o.extend({type:n,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&o.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(n,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),o.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],n=q=h[1],p=(h[2]||"").split(".").sort(),n){l=o.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||o.removeEvent(a,n,r.handle),delete i[n])}else for(n in i)o.event.remove(a,n+b[j],c,d,!0);o.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,p=[d||m],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||m,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+o.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[o.expando]?b:new o.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:o.makeArray(c,[b]),n=o.event.special[q]||{},e||!n.trigger||n.trigger.apply(d,c)!==!1)){if(!e&&!n.noBubble&&!o.isWindow(d)){for(i=n.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||m)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:n.bindType||q,l=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),l&&l.apply(g,c),l=k&&g[k],l&&l.apply&&o.acceptData(g)&&(b.result=l.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||n._default&&n._default.apply(p.pop(),c)!==!1||!o.acceptData(d)||k&&o.isFunction(d[q])&&!o.isWindow(d)&&(h=d[k],h&&(d[k]=null),o.event.triggered=q,d[q](),o.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=o.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=o.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=o.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((o.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?o(e,this).index(i)>=0:o.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||m,d=c.documentElement,e=c.body,a.pageX=b.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0),a.pageY=b.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},fix:function(a){if(a[o.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=W.test(e)?this.mouseHooks:V.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new o.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=m),3===a.target.nodeType&&(a.target=a.target.parentNode),g.filter?g.filter(a,f):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==_()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===_()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&o.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return o.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=o.extend(new o.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?o.event.trigger(e,null,b):o.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},o.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)},o.Event=function(a,b){return this instanceof o.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.getPreventDefault&&a.getPreventDefault()?Z:$):this.type=a,b&&o.extend(this,b),this.timeStamp=a&&a.timeStamp||o.now(),void(this[o.expando]=!0)):new o.Event(a,b)},o.Event.prototype={isDefaultPrevented:$,isPropagationStopped:$,isImmediatePropagationStopped:$,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=Z,a&&a.preventDefault&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=Z,a&&a.stopPropagation&&a.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z,this.stopPropagation()}},o.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){o.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!o.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),l.focusinBubbles||o.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){o.event.simulate(b,a.target,o.event.fix(a),!0)};o.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=L.access(d,b);e||d.addEventListener(a,c,!0),L.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=L.access(d,b)-1;e?L.access(d,b,e):(d.removeEventListener(a,c,!0),L.remove(d,b))}}}),o.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(g in a)this.on(g,b,c,a[g],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=$;else if(!d)return this;return 1===e&&(f=d,d=function(a){return o().off(a),f.apply(this,arguments)},d.guid=f.guid||(f.guid=o.guid++)),this.each(function(){o.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,o(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=$),this.each(function(){o.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){o.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?o.event.trigger(a,b,c,!0):void 0}});var ab=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ib={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return o.nodeName(a,"table")&&o.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)o.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=o.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&o.nodeName(a,b)?o.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}o.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=o.contains(a.ownerDocument,a);if(!(l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||o.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,n=a.length;n>m;m++)if(e=a[m],e||0===e)if("object"===o.type(e))o.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1></$2>")+h[2],j=h[0];while(j--)f=f.lastChild;o.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===o.inArray(e,d))&&(i=o.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f,g,h=o.event.special,i=0;void 0!==(c=a[i]);i++){if(o.acceptData(c)&&(f=c[L.expando],f&&(b=L.cache[f]))){if(d=Object.keys(b.events||{}),d.length)for(g=0;void 0!==(e=d[g]);g++)h[e]?o.event.remove(c,e):o.removeEvent(c,e,b.handle);L.cache[f]&&delete L.cache[f]}delete M.cache[c[M.expando]]}}}),o.fn.extend({text:function(a){return J(this,function(a){return void 0===a?o.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?o.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||o.cleanData(ob(c)),c.parentNode&&(b&&o.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(o.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return o.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(o.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,o.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,k=this.length,m=this,n=k-1,p=a[0],q=o.isFunction(p);if(q||k>1&&"string"==typeof p&&!l.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(k&&(c=o.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=o.map(ob(c,"script"),kb),g=f.length;k>j;j++)h=c,j!==n&&(h=o.clone(h,!0,!0),g&&o.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,o.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&o.contains(i,h)&&(h.src?o._evalUrl&&o._evalUrl(h.src):o.globalEval(h.textContent.replace(hb,"")))}return this}}),o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){o.fn[a]=function(a){for(var c,d=[],e=o(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),o(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d=o(c.createElement(b)).appendTo(c.body),e=a.getDefaultComputedStyle?a.getDefaultComputedStyle(d[0]).display:o.css(d[0],"display");return d.detach(),e}function tb(a){var b=m,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||o("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=qb[0].contentDocument,b.write(),b.close(),c=sb(a,b),qb.detach()),rb[a]=c),c}var ub=/^margin/,vb=new RegExp("^("+Q+")(?!px)[a-z%]+$","i"),wb=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)};function xb(a,b,c){var d,e,f,g,h=a.style;return c=c||wb(a),c&&(g=c.getPropertyValue(b)||c[b]),c&&(""!==g||o.contains(a.ownerDocument,a)||(g=o.style(a,b)),vb.test(g)&&ub.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function yb(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d="padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box",e=m.documentElement,f=m.createElement("div"),g=m.createElement("div");g.style.backgroundClip="content-box",g.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===g.style.backgroundClip,f.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",f.appendChild(g);function h(){g.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%",e.appendChild(f);var d=a.getComputedStyle(g,null);b="1%"!==d.top,c="4px"===d.width,e.removeChild(f)}a.getComputedStyle&&o.extend(l,{pixelPosition:function(){return h(),b},boxSizingReliable:function(){return null==c&&h(),c},reliableMarginRight:function(){var b,c=g.appendChild(m.createElement("div"));return c.style.cssText=g.style.cssText=d,c.style.marginRight=c.style.width="0",g.style.width="1px",e.appendChild(f),b=!parseFloat(a.getComputedStyle(c,null).marginRight),e.removeChild(f),g.innerHTML="",b}})}(),o.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var zb=/^(none|table(?!-c[ea]).+)/,Ab=new RegExp("^("+Q+")(.*)$","i"),Bb=new RegExp("^([+-])=("+Q+")","i"),Cb={position:"absolute",visibility:"hidden",display:"block"},Db={letterSpacing:0,fontWeight:400},Eb=["Webkit","O","Moz","ms"];function Fb(a,b){if(b in a)return b;var c=b[0].toUpperCase()+b.slice(1),d=b,e=Eb.length;while(e--)if(b=Eb[e]+c,b in a)return b;return d}function Gb(a,b,c){var d=Ab.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Hb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=o.css(a,c+R[f],!0,e)),d?("content"===c&&(g-=o.css(a,"padding"+R[f],!0,e)),"margin"!==c&&(g-=o.css(a,"border"+R[f]+"Width",!0,e))):(g+=o.css(a,"padding"+R[f],!0,e),"padding"!==c&&(g+=o.css(a,"border"+R[f]+"Width",!0,e)));return g}function Ib(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=wb(a),g="border-box"===o.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=xb(a,b,f),(0>e||null==e)&&(e=a.style[b]),vb.test(e))return e;d=g&&(l.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Hb(a,b,c||(g?"border":"content"),d,f)+"px"}function Jb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=L.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&S(d)&&(f[g]=L.access(d,"olddisplay",tb(d.nodeName)))):f[g]||(e=S(d),(c&&"none"!==c||!e)&&L.set(d,"olddisplay",e?c:o.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}o.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=xb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=o.camelCase(b),i=a.style;return b=o.cssProps[h]||(o.cssProps[h]=Fb(i,h)),g=o.cssHooks[b]||o.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=Bb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(o.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||o.cssNumber[h]||(c+="px"),l.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]="",i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=o.camelCase(b);return b=o.cssProps[h]||(o.cssProps[h]=Fb(a.style,h)),g=o.cssHooks[b]||o.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=xb(a,b,d)),"normal"===e&&b in Db&&(e=Db[b]),""===c||c?(f=parseFloat(e),c===!0||o.isNumeric(f)?f||0:e):e}}),o.each(["height","width"],function(a,b){o.cssHooks[b]={get:function(a,c,d){return c?0===a.offsetWidth&&zb.test(o.css(a,"display"))?o.swap(a,Cb,function(){return Ib(a,b,d)}):Ib(a,b,d):void 0},set:function(a,c,d){var e=d&&wb(a);return Gb(a,c,d?Hb(a,b,d,"border-box"===o.css(a,"boxSizing",!1,e),e):0)}}}),o.cssHooks.marginRight=yb(l.reliableMarginRight,function(a,b){return b?o.swap(a,{display:"inline-block"},xb,[a,"marginRight"]):void 0}),o.each({margin:"",padding:"",border:"Width"},function(a,b){o.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+R[d]+b]=f[d]||f[d-2]||f[0];return e}},ub.test(a)||(o.cssHooks[a+b].set=Gb)}),o.fn.extend({css:function(a,b){return J(this,function(a,b,c){var d,e,f={},g=0;if(o.isArray(b)){for(d=wb(a),e=b.length;e>g;g++)f[b[g]]=o.css(a,b[g],!1,d);return f}return void 0!==c?o.style(a,b,c):o.css(a,b)},a,b,arguments.length>1)},show:function(){return Jb(this,!0)},hide:function(){return Jb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){S(this)?o(this).show():o(this).hide()})}});function Kb(a,b,c,d,e){return new Kb.prototype.init(a,b,c,d,e)}o.Tween=Kb,Kb.prototype={constructor:Kb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(o.cssNumber[c]?"":"px")},cur:function(){var a=Kb.propHooks[this.prop];return a&&a.get?a.get(this):Kb.propHooks._default.get(this)},run:function(a){var b,c=Kb.propHooks[this.prop];return this.pos=b=this.options.duration?o.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Kb.propHooks._default.set(this),this}},Kb.prototype.init.prototype=Kb.prototype,Kb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=o.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){o.fx.step[a.prop]?o.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[o.cssProps[a.prop]]||o.cssHooks[a.prop])?o.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Kb.propHooks.scrollTop=Kb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},o.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},o.fx=Kb.prototype.init,o.fx.step={};var Lb,Mb,Nb=/^(?:toggle|show|hide)$/,Ob=new RegExp("^(?:([+-])=|)("+Q+")([a-z%]*)$","i"),Pb=/queueHooks$/,Qb=[Vb],Rb={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=Ob.exec(b),f=e&&e[3]||(o.cssNumber[a]?"":"px"),g=(o.cssNumber[a]||"px"!==f&&+d)&&Ob.exec(o.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,o.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function Sb(){return setTimeout(function(){Lb=void 0}),Lb=o.now()}function Tb(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=R[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function Ub(a,b,c){for(var d,e=(Rb[b]||[]).concat(Rb["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function Vb(a,b,c){var d,e,f,g,h,i,j,k=this,l={},m=a.style,n=a.nodeType&&S(a),p=L.get(a,"fxshow");c.queue||(h=o._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,k.always(function(){k.always(function(){h.unqueued--,o.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[m.overflow,m.overflowX,m.overflowY],j=o.css(a,"display"),"none"===j&&(j=tb(a.nodeName)),"inline"===j&&"none"===o.css(a,"float")&&(m.display="inline-block")),c.overflow&&(m.overflow="hidden",k.always(function(){m.overflow=c.overflow[0],m.overflowX=c.overflow[1],m.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],Nb.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(n?"hide":"show")){if("show"!==e||!p||void 0===p[d])continue;n=!0}l[d]=p&&p[d]||o.style(a,d)}if(!o.isEmptyObject(l)){p?"hidden"in p&&(n=p.hidden):p=L.access(a,"fxshow",{}),f&&(p.hidden=!n),n?o(a).show():k.done(function(){o(a).hide()}),k.done(function(){var b;L.remove(a,"fxshow");for(b in l)o.style(a,b,l[b])});for(d in l)g=Ub(n?p[d]:0,d,k),d in p||(p[d]=g.start,n&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function Wb(a,b){var c,d,e,f,g;for(c in a)if(d=o.camelCase(c),e=b[d],f=a[c],o.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=o.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function Xb(a,b,c){var d,e,f=0,g=Qb.length,h=o.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Lb||Sb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:o.extend({},b),opts:o.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:Lb||Sb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=o.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(Wb(k,j.opts.specialEasing);g>f;f++)if(d=Qb[f].call(j,a,k,j.opts))return d;return o.map(k,Ub,j),o.isFunction(j.opts.start)&&j.opts.start.call(a,j),o.fx.timer(o.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}o.Animation=o.extend(Xb,{tweener:function(a,b){o.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],Rb[c]=Rb[c]||[],Rb[c].unshift(b)},prefilter:function(a,b){b?Qb.unshift(a):Qb.push(a)}}),o.speed=function(a,b,c){var d=a&&"object"==typeof a?o.extend({},a):{complete:c||!c&&b||o.isFunction(a)&&a,duration:a,easing:c&&b||b&&!o.isFunction(b)&&b};return d.duration=o.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in o.fx.speeds?o.fx.speeds[d.duration]:o.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){o.isFunction(d.old)&&d.old.call(this),d.queue&&o.dequeue(this,d.queue)},d},o.fn.extend({fadeTo:function(a,b,c,d){return this.filter(S).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=o.isEmptyObject(a),f=o.speed(b,c,d),g=function(){var b=Xb(this,o.extend({},a),f);(e||L.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=o.timers,g=L.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&Pb.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&o.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=L.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=o.timers,g=d?d.length:0;for(c.finish=!0,o.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),o.each(["toggle","show","hide"],function(a,b){var c=o.fn[b];o.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(Tb(b,!0),a,d,e)}}),o.each({slideDown:Tb("show"),slideUp:Tb("hide"),slideToggle:Tb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){o.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),o.timers=[],o.fx.tick=function(){var a,b=0,c=o.timers;for(Lb=o.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||o.fx.stop(),Lb=void 0},o.fx.timer=function(a){o.timers.push(a),a()?o.fx.start():o.timers.pop()},o.fx.interval=13,o.fx.start=function(){Mb||(Mb=setInterval(o.fx.tick,o.fx.interval))},o.fx.stop=function(){clearInterval(Mb),Mb=null},o.fx.speeds={slow:600,fast:200,_default:400},o.fn.delay=function(a,b){return a=o.fx?o.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a=m.createElement("input"),b=m.createElement("select"),c=b.appendChild(m.createElement("option"));a.type="checkbox",l.checkOn=""!==a.value,l.optSelected=c.selected,b.disabled=!0,l.optDisabled=!c.disabled,a=m.createElement("input"),a.value="t",a.type="radio",l.radioValue="t"===a.value}();var Yb,Zb,$b=o.expr.attrHandle;o.fn.extend({attr:function(a,b){return J(this,o.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){o.removeAttr(this,a)})}}),o.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===U?o.prop(a,b,c):(1===f&&o.isXMLDoc(a)||(b=b.toLowerCase(),d=o.attrHooks[b]||(o.expr.match.bool.test(b)?Zb:Yb)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=o.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void o.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=o.propFix[c]||c,o.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)},attrHooks:{type:{set:function(a,b){if(!l.radioValue&&"radio"===b&&o.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),Zb={set:function(a,b,c){return b===!1?o.removeAttr(a,c):a.setAttribute(c,c),c}},o.each(o.expr.match.bool.source.match(/\w+/g),function(a,b){var c=$b[b]||o.find.attr;$b[b]=function(a,b,d){var e,f;
return d||(f=$b[b],$b[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,$b[b]=f),e}});var _b=/^(?:input|select|textarea|button)$/i;o.fn.extend({prop:function(a,b){return J(this,o.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[o.propFix[a]||a]})}}),o.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!o.isXMLDoc(a),f&&(b=o.propFix[b]||b,e=o.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){return a.hasAttribute("tabindex")||_b.test(a.nodeName)||a.href?a.tabIndex:-1}}}}),l.optSelected||(o.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),o.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){o.propFix[this.toLowerCase()]=this});var ac=/[\t\r\n\f]/g;o.fn.extend({addClass:function(a){var b,c,d,e,f,g,h="string"==typeof a&&a,i=0,j=this.length;if(o.isFunction(a))return this.each(function(b){o(this).addClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ac," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=o.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0===arguments.length||"string"==typeof a&&a,i=0,j=this.length;if(o.isFunction(a))return this.each(function(b){o(this).removeClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ac," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?o.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(o.isFunction(a)?function(c){o(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=o(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===U||"boolean"===c)&&(this.className&&L.set(this,"__className__",this.className),this.className=this.className||a===!1?"":L.get(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ac," ").indexOf(b)>=0)return!0;return!1}});var bc=/\r/g;o.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=o.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,o(this).val()):a,null==e?e="":"number"==typeof e?e+="":o.isArray(e)&&(e=o.map(e,function(a){return null==a?"":a+""})),b=o.valHooks[this.type]||o.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=o.valHooks[e.type]||o.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(bc,""):null==c?"":c)}}}),o.extend({valHooks:{select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(l.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&o.nodeName(c.parentNode,"optgroup"))){if(b=o(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=o.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=o.inArray(o(d).val(),f)>=0)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),o.each(["radio","checkbox"],function(){o.valHooks[this]={set:function(a,b){return o.isArray(b)?a.checked=o.inArray(o(a).val(),b)>=0:void 0}},l.checkOn||(o.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})}),o.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){o.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),o.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var cc=o.now(),dc=/\?/;o.parseJSON=function(a){return JSON.parse(a+"")},o.parseXML=function(a){var b,c;if(!a||"string"!=typeof a)return null;try{c=new DOMParser,b=c.parseFromString(a,"text/xml")}catch(d){b=void 0}return(!b||b.getElementsByTagName("parsererror").length)&&o.error("Invalid XML: "+a),b};var ec,fc,gc=/#.*$/,hc=/([?&])_=[^&]*/,ic=/^(.*?):[ \t]*([^\r\n]*)$/gm,jc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,kc=/^(?:GET|HEAD)$/,lc=/^\/\//,mc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,nc={},oc={},pc="*/".concat("*");try{fc=location.href}catch(qc){fc=m.createElement("a"),fc.href="",fc=fc.href}ec=mc.exec(fc.toLowerCase())||[];function rc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(o.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function sc(a,b,c,d){var e={},f=a===oc;function g(h){var i;return e[h]=!0,o.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function tc(a,b){var c,d,e=o.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&o.extend(!0,a,d),a}function uc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function vc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}o.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:fc,type:"GET",isLocal:jc.test(ec[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":pc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":o.parseJSON,"text xml":o.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?tc(tc(a,o.ajaxSettings),b):tc(o.ajaxSettings,a)},ajaxPrefilter:rc(nc),ajaxTransport:rc(oc),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=o.ajaxSetup({},b),l=k.context||k,m=k.context&&(l.nodeType||l.jquery)?o(l):o.event,n=o.Deferred(),p=o.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!f){f={};while(b=ic.exec(e))f[b[1].toLowerCase()]=b[2]}b=f[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?e:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return c&&c.abort(b),x(0,b),this}};if(n.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||fc)+"").replace(gc,"").replace(lc,ec[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=o.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(h=mc.exec(k.url.toLowerCase()),k.crossDomain=!(!h||h[1]===ec[1]&&h[2]===ec[2]&&(h[3]||("http:"===h[1]?"80":"443"))===(ec[3]||("http:"===ec[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=o.param(k.data,k.traditional)),sc(nc,k,b,v),2===t)return v;i=k.global,i&&0===o.active++&&o.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!kc.test(k.type),d=k.url,k.hasContent||(k.data&&(d=k.url+=(dc.test(d)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=hc.test(d)?d.replace(hc,"$1_="+cc++):d+(dc.test(d)?"&":"?")+"_="+cc++)),k.ifModified&&(o.lastModified[d]&&v.setRequestHeader("If-Modified-Since",o.lastModified[d]),o.etag[d]&&v.setRequestHeader("If-None-Match",o.etag[d])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+pc+"; q=0.01":""):k.accepts["*"]);for(j in k.headers)v.setRequestHeader(j,k.headers[j]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(j in{success:1,error:1,complete:1})v[j](k[j]);if(c=sc(oc,k,b,v)){v.readyState=1,i&&m.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,c.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,f,h){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),c=void 0,e=h||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,f&&(u=uc(k,v,f)),u=vc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(o.lastModified[d]=w),w=v.getResponseHeader("etag"),w&&(o.etag[d]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?n.resolveWith(l,[r,x,v]):n.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,i&&m.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),i&&(m.trigger("ajaxComplete",[v,k]),--o.active||o.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return o.get(a,b,c,"json")},getScript:function(a,b){return o.get(a,void 0,b,"script")}}),o.each(["get","post"],function(a,b){o[b]=function(a,c,d,e){return o.isFunction(c)&&(e=e||d,d=c,c=void 0),o.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),o.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){o.fn[b]=function(a){return this.on(b,a)}}),o._evalUrl=function(a){return o.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},o.fn.extend({wrapAll:function(a){var b;return o.isFunction(a)?this.each(function(b){o(this).wrapAll(a.call(this,b))}):(this[0]&&(b=o(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return this.each(o.isFunction(a)?function(b){o(this).wrapInner(a.call(this,b))}:function(){var b=o(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=o.isFunction(a);return this.each(function(c){o(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){o.nodeName(this,"body")||o(this).replaceWith(this.childNodes)}).end()}}),o.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0},o.expr.filters.visible=function(a){return!o.expr.filters.hidden(a)};var wc=/%20/g,xc=/\[\]$/,yc=/\r?\n/g,zc=/^(?:submit|button|image|reset|file)$/i,Ac=/^(?:input|select|textarea|keygen)/i;function Bc(a,b,c,d){var e;if(o.isArray(b))o.each(b,function(b,e){c||xc.test(a)?d(a,e):Bc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==o.type(b))d(a,b);else for(e in b)Bc(a+"["+e+"]",b[e],c,d)}o.param=function(a,b){var c,d=[],e=function(a,b){b=o.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=o.ajaxSettings&&o.ajaxSettings.traditional),o.isArray(a)||a.jquery&&!o.isPlainObject(a))o.each(a,function(){e(this.name,this.value)});else for(c in a)Bc(c,a[c],b,e);return d.join("&").replace(wc,"+")},o.fn.extend({serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=o.prop(this,"elements");return a?o.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!o(this).is(":disabled")&&Ac.test(this.nodeName)&&!zc.test(a)&&(this.checked||!T.test(a))}).map(function(a,b){var c=o(this).val();return null==c?null:o.isArray(c)?o.map(c,function(a){return{name:b.name,value:a.replace(yc,"\r\n")}}):{name:b.name,value:c.replace(yc,"\r\n")}}).get()}}),o.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(a){}};var Cc=0,Dc={},Ec={0:200,1223:204},Fc=o.ajaxSettings.xhr();a.ActiveXObject&&o(a).on("unload",function(){for(var a in Dc)Dc[a]()}),l.cors=!!Fc&&"withCredentials"in Fc,l.ajax=Fc=!!Fc,o.ajaxTransport(function(a){var b;return l.cors||Fc&&!a.crossDomain?{send:function(c,d){var e,f=a.xhr(),g=++Cc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)f.setRequestHeader(e,c[e]);b=function(a){return function(){b&&(delete Dc[g],b=f.onload=f.onerror=null,"abort"===a?f.abort():"error"===a?d(f.status,f.statusText):d(Ec[f.status]||f.status,f.statusText,"string"==typeof f.responseText?{text:f.responseText}:void 0,f.getAllResponseHeaders()))}},f.onload=b(),f.onerror=b("error"),b=Dc[g]=b("abort"),f.send(a.hasContent&&a.data||null)},abort:function(){b&&b()}}:void 0}),o.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return o.globalEval(a),a}}}),o.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),o.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(d,e){b=o("<script>").prop({async:!0,charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&e("error"===a.type?404:200,a.type)}),m.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Gc=[],Hc=/(=)\?(?=&|$)|\?\?/;o.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Gc.pop()||o.expando+"_"+cc++;return this[a]=!0,a}}),o.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Hc.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Hc.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=o.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Hc,"$1"+e):b.jsonp!==!1&&(b.url+=(dc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||o.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Gc.push(e)),g&&o.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),o.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||m;var d=v.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=o.buildFragment([a],b,e),e&&e.length&&o(e).remove(),o.merge([],d.childNodes))};var Ic=o.fn.load;o.fn.load=function(a,b,c){if("string"!=typeof a&&Ic)return Ic.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=a.slice(h),a=a.slice(0,h)),o.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&o.ajax({url:a,type:e,dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?o("<div>").append(o.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,f||[a.responseText,b,a])}),this},o.expr.filters.animated=function(a){return o.grep(o.timers,function(b){return a===b.elem}).length};var Jc=a.document.documentElement;function Kc(a){return o.isWindow(a)?a:9===a.nodeType&&a.defaultView}o.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=o.css(a,"position"),l=o(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=o.css(a,"top"),i=o.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),o.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},o.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){o.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f)return b=f.documentElement,o.contains(b,d)?(typeof d.getBoundingClientRect!==U&&(e=d.getBoundingClientRect()),c=Kc(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===o.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),o.nodeName(a[0],"html")||(d=a.offset()),d.top+=o.css(a[0],"borderTopWidth",!0),d.left+=o.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-o.css(c,"marginTop",!0),left:b.left-d.left-o.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||Jc;while(a&&!o.nodeName(a,"html")&&"static"===o.css(a,"position"))a=a.offsetParent;return a||Jc})}}),o.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(b,c){var d="pageYOffset"===c;o.fn[b]=function(e){return J(this,function(b,e,f){var g=Kc(b);return void 0===f?g?g[c]:b[e]:void(g?g.scrollTo(d?a.pageXOffset:f,d?f:a.pageYOffset):b[e]=f)},b,e,arguments.length,null)}}),o.each(["top","left"],function(a,b){o.cssHooks[b]=yb(l.pixelPosition,function(a,c){return c?(c=xb(a,b),vb.test(c)?o(a).position()[b]+"px":c):void 0})}),o.each({Height:"height",Width:"width"},function(a,b){o.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){o.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return J(this,function(b,c,d){var e;return o.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?o.css(b,c,g):o.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),o.fn.size=function(){return this.length},o.fn.andSelf=o.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return o});var Lc=a.jQuery,Mc=a.$;return o.noConflict=function(b){return a.$===o&&(a.$=Mc),b&&a.jQuery===o&&(a.jQuery=Lc),o},typeof b===U&&(a.jQuery=a.$=o),o});
/*! jQuery throttle / debounce - v1.1 - 3/7/2010 [http://benalman.com/projects/jquery-throttle-debounce-plugin/] | (c) 2010 "Cowboy" Ben Alman | Dual licensed under the MIT and GPL licenses. [http://benalman.com/about/license/] */
(function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this);
/*! seedrandom.js v2.3.3 | (c) 2013 David Bau | Licensed under a BSD-style license */
!function(a,b,c,d,e,f,g,h,i){function j(a){var b,c=a.length,e=this,f=0,g=e.i=e.j=0,h=e.S=[];for(c||(a=[c++]);d>f;)h[f]=f++;for(f=0;d>f;f++)h[f]=h[g=r&g+a[f%c]+(b=h[f])],h[g]=b;(e.g=function(a){for(var b,c=0,f=e.i,g=e.j,h=e.S;a--;)b=h[f=r&f+1],c=c*d+h[r&(h[f]=h[g=r&g+b])+(h[g]=b)];return e.i=f,e.j=g,c})(d)}function k(a,b){var c,d=[],e=typeof a;if(b&&"object"==e)for(c in a)try{d.push(k(a[c],b-1))}catch(f){}return d.length?d:"string"==e?a:a+"\0"}function l(a,b){for(var c,d=a+"",e=0;e<d.length;)b[r&e]=r&(c^=19*b[r&e])+d.charCodeAt(e++);return n(b)}function m(c){try{return a.crypto.getRandomValues(c=new Uint8Array(d)),n(c)}catch(e){return[+new Date,a,(c=a.navigator)&&c.plugins,a.screen,n(b)]}}function n(a){return String.fromCharCode.apply(0,a)}var o=c.pow(d,e),p=c.pow(2,f),q=2*p,r=d-1,s=c["seed"+i]=function(a,f,g){var h=[],r=l(k(f?[a,n(b)]:null==a?m():a,3),h),s=new j(h);return l(n(s.S),b),(g||function(a,b,d){return d?(c[i]=a,b):a})(function(){for(var a=s.g(e),b=o,c=0;p>a;)a=(a+c)*d,b*=d,c=s.g(1);for(;a>=q;)a/=2,b/=2,c>>>=1;return(a+c)/b},r,this==c)};l(c[i](),b),g&&g.exports?g.exports=s:h&&h.amd&&h(function(){return s})}(this,[],Math,256,6,52,"object"==typeof module&&module,"function"==typeof define&&define,"random");
/*! lz-string-1.3.3-min.js | (c) 2013 Pieroxy | Licensed under a WTFPL license */
var LZString={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_f:String.fromCharCode,compressToBase64:function(e){if(e==null)return"";var t="";var n,r,i,s,o,u,a;var f=0;e=LZString.compress(e);while(f<e.length*2){if(f%2==0){n=e.charCodeAt(f/2)>>8;r=e.charCodeAt(f/2)&255;if(f/2+1<e.length)i=e.charCodeAt(f/2+1)>>8;else i=NaN}else{n=e.charCodeAt((f-1)/2)&255;if((f+1)/2<e.length){r=e.charCodeAt((f+1)/2)>>8;i=e.charCodeAt((f+1)/2)&255}else r=i=NaN}f+=3;s=n>>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+LZString._keyStr.charAt(s)+LZString._keyStr.charAt(o)+LZString._keyStr.charAt(u)+LZString._keyStr.charAt(a)}return t},decompressFromBase64:function(e){if(e==null)return"";var t="",n=0,r,i,s,o,u,a,f,l,c=0,h=LZString._f;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(c<e.length){u=LZString._keyStr.indexOf(e.charAt(c++));a=LZString._keyStr.indexOf(e.charAt(c++));f=LZString._keyStr.indexOf(e.charAt(c++));l=LZString._keyStr.indexOf(e.charAt(c++));i=u<<2|a>>4;s=(a&15)<<4|f>>2;o=(f&3)<<6|l;if(n%2==0){r=i<<8;if(f!=64){t+=h(r|s)}if(l!=64){r=o<<8}}else{t=t+h(r|i);if(f!=64){r=s<<8}if(l!=64){t+=h(r|o)}}n+=3}return LZString.decompress(t)},compressToUTF16:function(e){if(e==null)return"";var t="",n,r,i,s=0,o=LZString._f;e=LZString.compress(e);for(n=0;n<e.length;n++){r=e.charCodeAt(n);switch(s++){case 0:t+=o((r>>1)+32);i=(r&1)<<14;break;case 1:t+=o(i+(r>>2)+32);i=(r&3)<<13;break;case 2:t+=o(i+(r>>3)+32);i=(r&7)<<12;break;case 3:t+=o(i+(r>>4)+32);i=(r&15)<<11;break;case 4:t+=o(i+(r>>5)+32);i=(r&31)<<10;break;case 5:t+=o(i+(r>>6)+32);i=(r&63)<<9;break;case 6:t+=o(i+(r>>7)+32);i=(r&127)<<8;break;case 7:t+=o(i+(r>>8)+32);i=(r&255)<<7;break;case 8:t+=o(i+(r>>9)+32);i=(r&511)<<6;break;case 9:t+=o(i+(r>>10)+32);i=(r&1023)<<5;break;case 10:t+=o(i+(r>>11)+32);i=(r&2047)<<4;break;case 11:t+=o(i+(r>>12)+32);i=(r&4095)<<3;break;case 12:t+=o(i+(r>>13)+32);i=(r&8191)<<2;break;case 13:t+=o(i+(r>>14)+32);i=(r&16383)<<1;break;case 14:t+=o(i+(r>>15)+32,(r&32767)+32);s=0;break}}return t+o(i+32)},decompressFromUTF16:function(e){if(e==null)return"";var t="",n,r,i=0,s=0,o=LZString._f;while(s<e.length){r=e.charCodeAt(s)-32;switch(i++){case 0:n=r<<1;break;case 1:t+=o(n|r>>14);n=(r&16383)<<2;break;case 2:t+=o(n|r>>13);n=(r&8191)<<3;break;case 3:t+=o(n|r>>12);n=(r&4095)<<4;break;case 4:t+=o(n|r>>11);n=(r&2047)<<5;break;case 5:t+=o(n|r>>10);n=(r&1023)<<6;break;case 6:t+=o(n|r>>9);n=(r&511)<<7;break;case 7:t+=o(n|r>>8);n=(r&255)<<8;break;case 8:t+=o(n|r>>7);n=(r&127)<<9;break;case 9:t+=o(n|r>>6);n=(r&63)<<10;break;case 10:t+=o(n|r>>5);n=(r&31)<<11;break;case 11:t+=o(n|r>>4);n=(r&15)<<12;break;case 12:t+=o(n|r>>3);n=(r&7)<<13;break;case 13:t+=o(n|r>>2);n=(r&3)<<14;break;case 14:t+=o(n|r>>1);n=(r&1)<<15;break;case 15:t+=o(n|r);i=0;break}s++}return LZString.decompress(t)},compress:function(e){if(e==null)return"";var t,n,r={},i={},s="",o="",u="",a=2,f=3,l=2,c="",h=0,p=0,d,v=LZString._f;for(d=0;d<e.length;d+=1){s=e.charAt(d);if(!Object.prototype.hasOwnProperty.call(r,s)){r[s]=f++;i[s]=true}o=u+s;if(Object.prototype.hasOwnProperty.call(r,o)){u=o}else{if(Object.prototype.hasOwnProperty.call(i,u)){if(u.charCodeAt(0)<256){for(t=0;t<l;t++){h=h<<1;if(p==15){p=0;c+=v(h);h=0}else{p++}}n=u.charCodeAt(0);for(t=0;t<8;t++){h=h<<1|n&1;if(p==15){p=0;c+=v(h);h=0}else{p++}n=n>>1}}else{n=1;for(t=0;t<l;t++){h=h<<1|n;if(p==15){p=0;c+=v(h);h=0}else{p++}n=0}n=u.charCodeAt(0);for(t=0;t<16;t++){h=h<<1|n&1;if(p==15){p=0;c+=v(h);h=0}else{p++}n=n>>1}}a--;if(a==0){a=Math.pow(2,l);l++}delete i[u]}else{n=r[u];for(t=0;t<l;t++){h=h<<1|n&1;if(p==15){p=0;c+=v(h);h=0}else{p++}n=n>>1}}a--;if(a==0){a=Math.pow(2,l);l++}r[o]=f++;u=String(s)}}if(u!==""){if(Object.prototype.hasOwnProperty.call(i,u)){if(u.charCodeAt(0)<256){for(t=0;t<l;t++){h=h<<1;if(p==15){p=0;c+=v(h);h=0}else{p++}}n=u.charCodeAt(0);for(t=0;t<8;t++){h=h<<1|n&1;if(p==15){p=0;c+=v(h);h=0}else{p++}n=n>>1}}else{n=1;for(t=0;t<l;t++){h=h<<1|n;if(p==15){p=0;c+=v(h);h=0}else{p++}n=0}n=u.charCodeAt(0);for(t=0;t<16;t++){h=h<<1|n&1;if(p==15){p=0;c+=v(h);h=0}else{p++}n=n>>1}}a--;if(a==0){a=Math.pow(2,l);l++}delete i[u]}else{n=r[u];for(t=0;t<l;t++){h=h<<1|n&1;if(p==15){p=0;c+=v(h);h=0}else{p++}n=n>>1}}a--;if(a==0){a=Math.pow(2,l);l++}}n=2;for(t=0;t<l;t++){h=h<<1|n&1;if(p==15){p=0;c+=v(h);h=0}else{p++}n=n>>1}while(true){h=h<<1;if(p==15){c+=v(h);break}else p++}return c},decompress:function(e){if(e==null)return"";if(e=="")return null;var t=[],n,r=4,i=4,s=3,o="",u="",a,f,l,c,h,p,d,v=LZString._f,m={string:e,val:e.charCodeAt(0),position:32768,index:1};for(a=0;a<3;a+=1){t[a]=a}l=0;h=Math.pow(2,2);p=1;while(p!=h){c=m.val&m.position;m.position>>=1;if(m.position==0){m.position=32768;m.val=m.string.charCodeAt(m.index++)}l|=(c>0?1:0)*p;p<<=1}switch(n=l){case 0:l=0;h=Math.pow(2,8);p=1;while(p!=h){c=m.val&m.position;m.position>>=1;if(m.position==0){m.position=32768;m.val=m.string.charCodeAt(m.index++)}l|=(c>0?1:0)*p;p<<=1}d=v(l);break;case 1:l=0;h=Math.pow(2,16);p=1;while(p!=h){c=m.val&m.position;m.position>>=1;if(m.position==0){m.position=32768;m.val=m.string.charCodeAt(m.index++)}l|=(c>0?1:0)*p;p<<=1}d=v(l);break;case 2:return""}t[3]=d;f=u=d;while(true){if(m.index>m.string.length){return""}l=0;h=Math.pow(2,s);p=1;while(p!=h){c=m.val&m.position;m.position>>=1;if(m.position==0){m.position=32768;m.val=m.string.charCodeAt(m.index++)}l|=(c>0?1:0)*p;p<<=1}switch(d=l){case 0:l=0;h=Math.pow(2,8);p=1;while(p!=h){c=m.val&m.position;m.position>>=1;if(m.position==0){m.position=32768;m.val=m.string.charCodeAt(m.index++)}l|=(c>0?1:0)*p;p<<=1}t[i++]=v(l);d=i-1;r--;break;case 1:l=0;h=Math.pow(2,16);p=1;while(p!=h){c=m.val&m.position;m.position>>=1;if(m.position==0){m.position=32768;m.val=m.string.charCodeAt(m.index++)}l|=(c>0?1:0)*p;p<<=1}t[i++]=v(l);d=i-1;r--;break;case 2:return u}if(r==0){r=Math.pow(2,s);s++}if(t[d]){o=t[d]}else{if(d===i){o=f+f.charAt(0)}else{return null}}u+=o;t[i++]=f+o.charAt(0);r--;f=o;if(r==0){r=Math.pow(2,s);s++}}}};if(typeof module!=="undefined"&&module!=null){module.exports=LZString}
/*! UUID.js - Version: core-1.0 | (c) 2012 LiosK | Licensed under the MIT License */
function UUID(){}UUID.generate=function(){var a=UUID._gri,b=UUID._ha;return b(a(32),8)+"-"+b(a(16),4)+"-"+b(16384|a(12),4)+"-"+b(32768|a(14),4)+"-"+b(a(48),12)};UUID._gri=function(a){return 0>a?NaN:30>=a?0|Math.random()*(1<<a):53>=a?(0|1073741824*Math.random())+1073741824*(0|Math.random()*(1<<a-30)):NaN};UUID._ha=function(a,b){for(var c=a.toString(16),d=b-c.length,e="0";0<d;d>>>=1,e+=e)d&1&&(c=e+c);return c};
/*! SugarCube JS
Portions of this code are based on:
____
TiddlyWiki 1.2.39 by Jeremy Ruston, (jeremy [at] osmosoft [dot] com)
Published under a BSD open source license
Copyright (c) Osmosoft Limited 2005
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
Neither the name of the Osmosoft Limited nor the names of its contributors may
be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
!function(window,document,undefined){"use strict";function clone(e){if("object"!=typeof e||null==e)return e;if("function"==typeof e.clone)return e.clone(!0);if(e.nodeType&&"function"==typeof e.cloneNode)return e.cloneNode(!0);var t,r=Object.prototype.toString.call(e);if("[object Date]"===r)t=new Date(e.getTime());else if("[object RegExp]"===r)t=new RegExp(e);else if(Array.isArray(e))t=[];else{var i=Object.getPrototypeOf(e);t=i?Object.create(i):e.constructor.prototype}return Object.keys(e).forEach(function(r){t[r]=clone(e[r])}),t}function insertElement(e,t,r,i,s,a){var n=document.createElement(t);return r&&(n.id=r),i&&(n.className=i),a&&(n.title=a),s&&insertText(n,s),e&&e.appendChild(n),n}function insertText(e,t){return e.appendChild(document.createTextNode(t))}function removeChildren(e){if(e)for(;e.hasChildNodes();)e.removeChild(e.firstChild)}function removeElement(e){"function"==typeof e.remove?e.remove():el.parentNode&&e.parentNode.removeChild(e)}function setPageElement(e,t,r){var i="object"==typeof e?e:document.getElementById(e);if(null==i)return null;removeChildren(i),Array.isArray(t)||(t=[t]);for(var s=0,a=t.length;a>s;s++)if(tale.has(t[s]))return new Wikifier(i,tale.get(t[s]).processText().trim()),i;return null!=r&&(r=r.trim(),""!==r&&new Wikifier(i,r)),i}function addStyle(e){var t=document.getElementById("style-story");null===t&&(t=document.createElement("style"),t.id="style-story",t.type="text/css",document.head.appendChild(t));var r=new RegExp(Wikifier.imageFormatter.lookaheadRegExp.source,"gm"),i=new RegExp(Wikifier.textPrimitives.image);r.test(e)&&(e=e.replace(r,function(e){var t=i.exec(e);if(null!==t){var r=t[4];if("data:"!==r.slice(0,5)&&tale.has(r)){var s=tale.get(r);s.tags.contains("Twine.image")&&(r=s.text)}return"url("+r+")"}return e})),t.styleSheet?t.styleSheet.cssText+=e:t.appendChild(document.createTextNode(e))}function throwError(e,t,r){return insertElement(e,"span",null,"error","Error: "+t,r),!1}function fade(e,t){function r(){s+=.05*o,i(n,Math.easeInOut(s)),(1==o&&s>=1||-1==o&&0>=s)&&(e.style.visibility="in"==t.fade?"visible":"hidden",n.parentNode.replaceChild(e,n),n=null,window.clearInterval(a),t.onComplete&&t.onComplete())}function i(e,t){var r=Math.floor(100*t);e.style.zoom=1,e.style.filter="alpha(opacity="+r+")",e.style.opacity=t}var s,a,n=e.cloneNode(!0),o="in"==t.fade?1:-1;e.parentNode.replaceChild(n,e),"in"==t.fade?(s=0,n.style.visibility="visible"):s=1,i(n,s),a=window.setInterval(r,25)}function scrollWindowTo(e,t){function r(){l+=t,window.scroll(0,a+c*o*Math.easeInOut(l)),l>=1&&window.clearInterval(u)}function i(e){for(var t=0;e.offsetParent;)t+=e.offsetTop,e=e.offsetParent;return t}function s(e){var t=i(e),r=t+e.offsetHeight,s=window.scrollY?window.scrollY:document.body.scrollTop,a=window.innerHeight?window.innerHeight:document.body.clientHeight,n=s+a;return s>t?t:r>n&&e.offsetHeight<a?t-(a-e.offsetHeight)+20:t}null==t?t=.1:("number"!=typeof t&&(t=Number(t)),isNaN(t)||0>t?t=.1:t>1&&(t=1));var a=window.scrollY?window.scrollY:document.body.scrollTop,n=s(e),o=Math.abs(a-n),l=0,c=a>n?-1:1,u=window.setInterval(r,25)}function SeedablePRNG(e,t){Object.defineProperties(this,new Math.seedrandom(e,t,function(e,t){return{_prng:{value:e},seed:{value:t},count:{writable:!0,value:0},random:{value:function(){return this.count++,this._prng()}}}}))}function KeyValueStore(e,t){var r=null;switch(e){case"cookie":break;case"localStorage":has.localStorage&&(r=window.localStorage);break;case"sessionStorage":has.sessionStorage&&(r=window.sessionStorage);break;default:throw new Error("unknown storage type")}Object.defineProperties(this,{_store:{value:r},name:{value:e},prefix:{value:t+"."}})}function History(e){this.active={init:!0,variables:{}},config.historyMode===History.Modes.Hash&&(this.hash=""),this.history=[],window.SugarCube[e||"state"]=this}function Passage(e,t,r){if(this.title=e,t)if(this.id=r,this.domId="passage-"+Util.slugify(this.title),this.text=Passage.unescapeLineBreaks(t.firstChild?t.firstChild.nodeValue:""),this.textExcerpt=Passage.getExcerptFromText(this.text),this.tags=t.hasAttribute("tags")?t.getAttribute("tags").trim():"",this.tags){if(this.tags=this.tags.split(/\s+/),this.classes=[],this.className="",this.tags.length>0){for(var i=/^(?:debug|nobr|passage|script|stylesheet|widget|twine\.\w*)$/i,s=[],a=0;a<this.tags.length;a++){var n=this.tags[a].toLowerCase();i.test(n)||s.push(Util.slugify(n))}s.length>0&&(t.className&&(s=s.concat(t.className.split(/\s+/))),s=s.sort().filter(function(e,t,r){return 0===t||r[t-1]!==e}),this.classes=s,this.className=s.join(" "))}}else this.tags=[],this.classes=[],this.className="";else this.text=String.format('<<display "SaveLoaded">>',this.title.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")),this.tags=[],this.classes=[],this.className=""}function Tale(e){document.normalize&&document.normalize(),this.passages={};for(var t=document.getElementById("store-area").childNodes,r=0,i=t.length;i>r;r++){var s,a=t[r];a.getAttribute&&(s=a.getAttribute("tiddler"))&&(this.passages[s]=new Passage(s,a,r))}if(this.passages.hasOwnProperty("StoryTitle")){var n=document.createElement("div");new Wikifier(n,this.passages.StoryTitle.processText().trim()),this.setTitle(n.textContent)}else this.setTitle("sqTwineSound_demo");window.SugarCube[e||"tale"]=this}function Wikifier(e,t){this.formatter=_wikifierFormatterCache||Wikifier.compileFormatters(),this.output=null!=e?e:document.createElement("div"),this.source=t,this.nextMatch=0,this._rawArgs="",this._nobr=[],this.subWikify(this.output),null==e&&("function"==typeof this.output.remove?this.output.remove():this.output.parentNode&&this.output.parentNode.removeChild(this.output),this.output=null)}function Macros(){Object.defineProperties(this,{definitions:{value:{}},tags:{value:{}}})}function MacrosContext(e,t,r,i,s,a,n,o){Object.defineProperties(this,{context:{value:e},parent:{value:e},self:{value:t},name:{value:r},args:{value:s},payload:{value:a},parser:{value:n},output:{value:n.output},source:{value:o}}),Object.defineProperties(this.args,{raw:{value:i},full:{value:Wikifier.parse(i)}})}function addStandardMacros(){macros.add("actions",{version:{major:2,minor:2,patch:0},handler:function(){var e=insertElement(this.output,"ul");e.classList.add(this.name),state.active.variables["#actions"]||(state.active.variables["#actions"]={});for(var t=0;t<this.args.length;t++){var r,i,s,a;"object"==typeof this.args[t]?(r=this.args[t].text,i=this.args[t].link,s=this.args[t].setFn):r=i=this.args[t],state.active.variables["#actions"][i]||(a=Wikifier.createInternalLink(insertElement(e,"li"),i,r,function(e,t){return function(){state.active.variables["#actions"][e]=!0,"function"==typeof t&&t()}}(i,s)),a.classList.add("link-"+this.name))}}}),macros.add(["back","return"],{version:{major:4,minor:2,patch:0},handler:function(){var e,t,r,i=1,s=this.name[0].toUpperCase()+this.name.slice(1);if(1===this.args.length&&"object"==typeof this.args[0]&&(1===this.args[0].count?(this.args.push(this.args[0].link),this.args[0]="to"):(this.args.push("to"),this.args.push(this.args[0].link),this.args[0]=this.args[0].text)),1===this.args.length)t=this.args[0];else if(0!==this.args.length)if(3===this.args.length&&(t=this.args.shift()),"go"===this.args[0]){if(isNaN(this.args[1])||this.args[1]<1)return this.error('the argument after "go" must be a whole number greater than zero');i=this.args[1]<state.length?this.args[1]:state.length-1,e=state.peek(i).title,s+=" (go "+i+")"}else{if("to"!==this.args[0])return this.error('"'+this.args[0]+'" is not a valid action (go|to)');if("object"==typeof this.args[1]&&(this.args[1]=this.args[1].link),!tale.has(this.args[1]))return this.error('the "'+this.args[1]+'" passage does not exist');if("return"===this.name)e=this.args[1],s+=' (to "'+e+'")';else for(var a=state.length-1;a>=0;a--)if(state.history[a].title===this.args[1]){i=state.length-1-a,e=this.args[1],s+=' (to "'+e+'")';break}if(e===undefined)return this.error('cannot find passage "'+this.args[1]+'" in the current story history')}return e===undefined&&state.length>1&&(e=state.peek(i).title),e===undefined?this.error("cannot find passage"):0===i?this.error("already at the first passage in the current story history"):(r=document.createElement("a"),r.classList.add("link-internal"),r.classList.add("link-"+this.name),i>0&&$(r).click(function(){return"back"===this.name?config.historyMode===History.Modes.Hash||config.disableHistoryControls?function(){for(;i>0;)state.isEmpty||state.pop(),i--;state.activate(state.top),state.display(e,r,"replace")}:function(){state.length>1&&window.history.go(-i)}:function(){state.display(e,r)}}.call(this)),insertText(r,t||this.self.dtext||s),void this.output.appendChild(r))},linktext:function(){0===this.args.length?delete this.self.dtext:this.self.dtext=this.args[0]}},!0),macros.add("choice",{version:{major:4,minor:0,patch:0},handler:function(){if(0===this.args.length)return this.error("no passage specified");var e,t,r,i,s=state.active.title;if(1===this.args.length?"object"==typeof this.args[0]?(e=this.args[0].text,t=this.args[0].link,r=this.args[0].setFn):e=t=this.args[0]:(t=this.args[0],e=this.args[1]),state.active.variables.hasOwnProperty("#choice")){if(state.active.variables["#choice"][s])return void insertElement(this.output,"span",null,"link-disabled link-"+this.name,e)}else state.active.variables["#choice"]={};i=Wikifier.createInternalLink(this.output,t,e,function(){state.active.variables["#choice"][s]=!0,"function"==typeof r&&r()}),i.classList.add("link-"+this.name)}}),macros.add("link",{version:{major:3,minor:4,patch:0},handler:function(){if(0===this.args.length)return this.error("no link location specified");var e,t,r,i,s,a;if(3===this.args.length?s=this.args.pop():2!==this.args.length||"keep"!==this.args[1]&&"remove"!==this.args[1]&&"once"!==this.args[1]||(s=this.args.pop()),s&&"keep"!==s&&"remove"!==s&&"once"!==s)return this.error('"'+s+'" is not a valid action (keep|remove)');if(2===this.args.length?(e=this.args[0],t=this.args[1]):"object"==typeof this.args[0]?(e=this.args[0].text,t=this.args[0].link,r=this.args[0].isExternal,i=this.args[0].setFn):e=t=this.args[0],r===undefined&&(r=Wikifier.formatterHelpers.isExternalLink(t)),s)if(state.active.variables.hasOwnProperty("#link")){if(state.active.variables["#link"][t])return void("keep"===s&&insertElement(this.output,"span",null,"link-disabled link-"+this.name,e))}else state.active.variables["#link"]={};a=r?Wikifier.createExternalLink(this.output,t,e):Wikifier.createInternalLink(this.output,t,e,function(){s&&(state.active.variables["#link"][t]=!0),"function"==typeof i&&i()}),a.classList.add("link-"+this.name)}}),macros.add("display",{version:{major:3,minor:1,patch:0},handler:function(){if(0===this.args.length)return this.error("no passage specified");var e;if(e="object"==typeof this.args[0]?this.args[0].link:this.args[0],!tale.has(e))return this.error('passage "'+e+'" does not exist');var t=this.output;e=tale.get(e),this.args[1]&&(t=insertElement(t,this.args[1],null,e.domId),t.setAttribute("data-passage",e.title)),new Wikifier(t,e.processText())}}),macros.add("nobr",{version:{major:1,minor:1,patch:0},skipArgs:!0,tags:null,handler:function(){new Wikifier(this.output,this.payload[0].contents.replace(/\n/g," "))}}),macros.add("print",{version:{major:2,minor:1,patch:0},skipArgs:!0,handler:function(){if(0===this.args.full.length)return this.error("no expression specified");try{var e=Util.evalExpression(this.args.full);null==e||"number"==typeof e&&isNaN(e)||new Wikifier(this.output,e.toString())}catch(t){return this.error("bad expression: "+t.message)}}}),macros.add("silently",{version:{major:4,minor:0,patch:0},skipArgs:!0,tags:null,handler:function(){var e=document.createDocumentFragment(),t=[];for(new Wikifier(e,this.payload[0].contents.trim());e.hasChildNodes();){var r=e.firstChild;r.classList&&r.classList.contains("error")&&t.push(r.textContent),e.removeChild(r)}return t.length>0?this.error("error"+(1===t.length?"":"s")+" within contents ("+t.join("; ")+")"):void 0}}),macros.add("if",{version:{major:3,minor:1,patch:1},skipArgs:!0,tags:["elseif","else"],handler:function(){try{for(var e=0,t=this.payload.length;t>e;e++){if("else"!==this.payload[e].name&&0===this.payload[e].arguments.length)return this.error("no conditional expression specified for <<"+this.payload[e].name+">> clause"+(e>0?" (#"+e+")":""));if("else"===this.payload[e].name&&0!==this.payload[e].arguments.length)return this.error(/^\s*if\b/i.test(this.payload[e].arguments)?'whitespace is not allowed between the "else" and "if" in <<elseif>> clause'+(e>0?" (#"+e+")":""):"<<else>> does not accept a conditional expression (perhaps you meant to use <<elseif>> instead), invalid: "+this.payload[e].arguments);if("else"===this.payload[e].name||Wikifier.evalExpression(this.payload[e].arguments)){new Wikifier(this.output,this.payload[e].contents);break}}}catch(r){return this.error("bad conditional expression: "+r.message)}}}),macros.add("for",{version:{major:1,minor:0,patch:0},skipArgs:!0,tags:null,handler:function(){var e,t,r,i=this.args.full.trim(),s=this.payload[0].contents.replace(/\n$/,""),a=!0,n=config.macros.maxLoopIterations;if(0===i.length)i=!0;else if(-1!==i.indexOf(";")){if(null===(r=i.match(/^([^;]*?)\s*;\s*([^;]*?)\s*;\s*([^;]*?)$/)))return this.error("invalid 3-part syntax, format: init ; condition ; post");e=r[1],i=r[2],t=r[3]}try{runtime.temp.break=null;try{e&&Util.evalExpression(e)}catch(o){return this.error("bad init expression: "+o.message)}for(;Util.evalExpression(i);){if(--n<0)return this.error("exceeded configured maximum loop iterations ("+config.macros.maxLoopIterations+")");if(new Wikifier(this.output,a?s.replace(/^\n/,""):s),a&&(a=!1),null!=runtime.temp.break)if(1===runtime.temp.break)runtime.temp.break=null;else if(2===runtime.temp.break){runtime.temp.break=null;break}try{t&&Util.evalExpression(t)}catch(o){return this.error("bad post expression: "+o.message)}}}catch(o){return this.error("bad conditional expression: "+o.message)}finally{runtime.temp.break=null}}}),macros.add(["break","continue"],{version:{major:1,minor:0,patch:0},skipArgs:!0,handler:function(){return this.contextHas(function(e){return"for"===e.name})?void(runtime.temp.break="continue"===this.name?1:2):this.error("must only be used in conjunction with its parent macro <<for>>")}}),macros.add("set",{version:{major:3,minor:1,patch:0},skipArgs:!0,handler:function(){return 0===this.args.full.length?this.error("no expression specified"):void macros.evalStatements(this.args.full,this)}}),macros.add("unset",{version:{major:2,minor:1,patch:0},skipArgs:!0,handler:function(){if(0===this.args.full.length)return this.error("no $variable list specified");for(var e,t=this.args.full,r=/state\.active\.variables\.(\w+)/g;null!==(e=r.exec(t));){var i=e[1];state.active.variables.hasOwnProperty(i)&&delete state.active.variables[i]}}}),macros.add("remember",{version:{major:3,minor:1,patch:0},skipArgs:!0,handler:function(){if(0===this.args.full.length)return this.error("no expression specified");var e=this.args.full;if(macros.evalStatements(e,this)){for(var t,r=storage.getItem("remember")||{},i=/state\.active\.variables\.(\w+)/g;null!==(t=i.exec(e));){var s=t[1];r[s]=state.active.variables[s]}if(!storage.setItem("remember",r))return this.error("unknown error, cannot remember: "+this.args.raw)}},init:function(){var e=storage.getItem("remember");e&&Object.keys(e).forEach(function(t){state.active.variables[t]=e[t]})}}),macros.add("forget",{version:{major:1,minor:1,patch:0},skipArgs:!0,handler:function(){if(0===this.args.full.length)return this.error("no $variable list specified");for(var e,t=this.args.full,r=/state\.active\.variables\.(\w+)/g,i=storage.getItem("remember"),s=!1;null!==(e=r.exec(t));){var a=e[1];state.active.variables.hasOwnProperty(a)&&delete state.active.variables[a],i&&i.hasOwnProperty(a)&&(s=!0,delete i[a])}return s&&!storage.setItem("remember",i)?this.error("unknown error, cannot update remember store"):void 0}}),macros.add("run","set"),macros.add("script",{version:{major:1,minor:0,patch:0},skipArgs:!0,tags:null,handler:function(){macros.evalStatements(this.payload[0].contents,this)}}),macros.add(["click","button"],{version:{major:4,minor:1,patch:1},tags:null,handler:function(){function e(){var e;return state.active.variables.hasOwnProperty("args")&&this.contextHas(function(e){return e.self.isWidget})&&(e=state.active.variables.args),e}if(0===this.args.length)return this.error("no "+("click"===this.name?"link":"button")+" text specified");var t,r,i=e.call(this),s=document.createElement("click"===this.name?"a":"button");"object"==typeof this.args[0]?(t=this.args[0].text,r=this.args[0].link):(t=this.args[0],r=this.args.length>1?this.args[1]:undefined),s.classList.add("link-"+(r?tale.has(r)?"internal":"broken":"internal")),s.classList.add("link-"+this.name),insertText(s,t),$(s).click(function(e,t,i){return function(){""!==t&&(i!==undefined&&(state.active.variables.hasOwnProperty("args")&&(e.hasOwnProperty("_argsStack")||(e._argsStack=[]),e._argsStack.push(state.active.variables.args)),state.active.variables.args=i),Wikifier.wikifyEval(t),i!==undefined&&(delete state.active.variables.args,e.hasOwnProperty("_argsStack")&&(state.active.variables.args=e._argsStack.pop(),0===e._argsStack.length&&delete e._argsStack))),r!==undefined&&state.display(r,s)}}(this.self,this.payload[0].contents.trim(),i)),this.output.appendChild(s)}}),macros.add("textbox",{version:{major:4,minor:0,patch:0},handler:function(){if(this.args.length<2){var e=[];return this.args.length<1&&e.push("$variable name"),this.args.length<2&&e.push("default value"),this.error("no "+e.join(" or ")+" specified")}var t=this.args[0].trim(),r=Util.slugify(t),i=this.args[1],s=this.args.length>2?this.args[2]:undefined,a=document.createElement("input"),n=!1;return"$"!==t[0]?this.error('$variable name "'+t+'" is missing its sigil ($)'):(a.type="text",a.id="textbox-"+r,a.name="textbox-"+r,a.value=i,Wikifier.setValue(t,i),$(a).change(function(){n||Wikifier.setValue(t,this.value)}).keypress(function(e){13===e.which&&(e.preventDefault(),n=!0,Wikifier.setValue(t,this.value),"undefined"!=typeof s&&state.display(s,this))}),void this.output.appendChild(a))}}),macros.add("checkbox",{version:{major:5,minor:0,patch:0},handler:function(){if(this.args.length<3){var e=[];return this.args.length<1&&e.push("$variable name"),this.args.length<2&&e.push("unchecked value"),this.args.length<3&&e.push("checked value"),this.error("no "+e.join(" or ")+" specified")}var t=this.args[0].trim(),r=Util.slugify(t),i=this.args[1],s=this.args[2],a=document.createElement("input");return"$"!==t[0]?this.error('$variable name "'+t+'" is missing its sigil ($)'):(a.type="checkbox",a.id=this.name+"-"+r,a.name=this.name+"-"+r,this.args.length>3&&"checked"===this.args[3]?(a.checked=!0,Wikifier.setValue(t,s)):Wikifier.setValue(t,i),$(a).change(function(){Wikifier.setValue(t,this.checked?s:i)}),void this.output.appendChild(a))}}),macros.add("radiobutton",{version:{major:5,minor:0,patch:0},handler:function(){if(this.args.length<2){var e=[];return this.args.length<1&&e.push("$variable name"),this.args.length<2&&e.push("checked value"),this.error("no "+e.join(" or ")+" specified")}var t=this.args[0].trim(),r=Util.slugify(t),i=this.args[1],s=document.createElement("input");return"$"!==t[0]?this.error('$variable name "'+t+'" is missing its sigil ($)'):(runtime.temp.hasOwnProperty("radiobutton")||(runtime.temp.radiobutton={}),runtime.temp.radiobutton.hasOwnProperty(r)||(runtime.temp.radiobutton[r]=0),s.type="radio",s.id=this.name+"-"+r+"-"+runtime.temp.radiobutton[r]++,s.name=this.name+"-"+r,this.args.length>2&&"checked"===this.args[2]&&(s.checked=!0,Wikifier.setValue(t,i)),$(s).change(function(){this.checked&&Wikifier.setValue(t,i)}),void this.output.appendChild(s))}}),macros.add(["addclass","toggleclass"],{version:{major:2,minor:0,patch:0},handler:function(){if(this.args.length<2){var e=[];return this.args.length<1&&e.push("selector"),this.args.length<2&&e.push("class names"),this.error("no "+e.join(" or ")+" specified")}var t=$(this.args[0]);if(0===t.length)return this.error('no elements matched the selector "'+this.args[0]+'"');switch(this.name){case"addclass":t.addClass(this.args[1].trim());break;case"toggleclass":t.toggleClass(this.args[1].trim())}}}),macros.add("removeclass",{version:{major:1,minor:0,patch:0},handler:function(){if(0===this.args.length)return this.error("no selector specified");var e=$(this.args[0]);return 0===e.length?this.error('no elements matched the selector "'+this.args[0]+'"'):void(this.args.length>1?e.removeClass(this.args[1].trim()):e.removeClass())}}),macros.add(["append","prepend","replace"],{version:{major:2,minor:0,patch:1},tags:null,handler:function(){if(0===this.args.length)return this.error("no selector specified");var e=$(this.args[0]);if(0===e.length)return this.error('no elements matched the selector "'+this.args[0]+'"');if(""!==this.payload[0].contents){var t=document.createDocumentFragment();switch(new Wikifier(t,this.payload[0].contents),this.name){case"replace":e.empty();case"append":e.append(t);break;case"prepend":e.prepend(t)}}}}),macros.add("remove",{version:{major:1,minor:0,patch:0},handler:function(){if(0===this.args.length)return this.error("no selector specified");var e=$(this.args[0]);return 0===e.length?this.error('no elements matched the selector "'+this.args[0]+'"'):void e.remove()}}),macros.add("widget",{version:{major:2,minor:0,patch:0},tags:null,handler:function(){if(0===this.args.length)return this.error("no widget name specified");var e=this.args[0];if(macros.has(e)){if(!macros.get(e).isWidget)return this.error('cannot clobber existing macro "'+e+'"');macros.remove(e)}try{macros.add(e,{version:{major:1,minor:0,patch:0},isWidget:!0,handler:function(e){return function(){try{state.active.variables.hasOwnProperty("args")&&(this.self.hasOwnProperty("_argsStack")||(this.self._argsStack=[]),this.self._argsStack.push(state.active.variables.args)),state.active.variables.args=[];for(var t=0,r=this.args.length;r>t;t++)state.active.variables.args[t]=this.args[t];state.active.variables.args.raw=this.args.raw,state.active.variables.args.full=this.args.full;var i=document.createDocumentFragment(),s=document.createDocumentFragment(),a=[];for(new Wikifier(s,e);s.hasChildNodes();){var n=s.firstChild;n.classList&&n.classList.contains("error")&&a.push(n.textContent),i.appendChild(n)}if(0!==a.length)return this.error("error"+(1===a.length?"":"s")+" within widget contents ("+a.join("; ")+")");this.output.appendChild(i)}catch(o){return this.error("cannot execute widget: "+o.message)}finally{delete state.active.variables.args,this.self.hasOwnProperty("_argsStack")&&(state.active.variables.args=this.self._argsStack.pop(),0===this.self._argsStack.length&&delete this.self._argsStack)}}}(this.payload[0].contents)})}catch(t){return this.error('cannot create widget macro "'+e+'": '+t.message)}}}),macros.add(["optiontoggle","optionlist"],{version:{major:2,minor:0,patch:0},tags:["onchange"],handler:function(){if(0===this.args.length)return this.error("no option property specified");if("optionlist"===this.name&&this.args.length<2)return this.error("no list specified");var e=this.args[0],t=Util.slugify(e),r=document.createElement("div"),i=document.createElement("div"),s=document.createElement("div");r.appendChild(i),r.appendChild(s),r.id="option-body-"+t,i.id="option-label-"+t,s.id="option-control-"+t,new Wikifier(i,this.payload[0].contents.trim());var a=2===this.payload.length?this.payload[1].contents.trim():"";switch(options.hasOwnProperty(e)||(options[e]=undefined),this.name){case"optiontoggle":var n=this.args.length>1?this.args[1]:undefined,o=document.createElement("a");options[e]===undefined&&(options[e]=!1),options[e]?(insertText(o,n||"On"),o.classList.add("enabled")):insertText(o,n||"Off"),$(o).click(function(){return function(){removeChildren(o),options[e]?(insertText(o,n||"Off"),o.classList.remove("enabled"),options[e]=!1):(insertText(o,n||"On"),o.classList.add("enabled"),options[e]=!0),macros.get("saveoptions").handler(),""!==a&&new Wikifier(document.createElement("div"),a)}}());break;case"optionlist":var l=this.args[1],o=document.createElement("select");Array.isArray(l)||(l=options.hasOwnProperty(l)?options[l]:l.trim().split(/\s*,\s*/)),options[e]===undefined&&(options[e]=l[0]);for(var c=0;c<l.length;c++){var u=document.createElement("option");insertText(u,l[c]),o.appendChild(u)}o.value=options[e],$(o).change(function(){return function(t){options[e]=t.target.value,macros.get("saveoptions").handler(),""!==a&&new Wikifier(document.createElement("div"),a)}}())}o.id="option-input-"+t,s.appendChild(o),this.output.appendChild(r)}}),macros.add("optionbar",{version:{major:3,minor:0,patch:0},handler:function(){var e=document.createElement("ul"),t=document.createElement("li"),r=document.createElement("li");e.appendChild(t),e.appendChild(r),t.appendChild(insertElement(null,"button","options-ok","ui-close","OK")),r.appendChild(insertElement(null,"button","options-reset","ui-close","Reset to Defaults")),$("button",r).click(function(){macros.get("deleteoptions").handler(),window.location.reload()}),this.output.appendChild(e)}}),macros.add("saveoptions",{version:{major:2,minor:0,patch:0},handler:function(){return storage.setItem("options",options)},init:function(){var e=storage.getItem("options");null!==e&&Object.keys(e).forEach(function(t){options[t]=e[t]})}}),macros.add("deleteoptions",{version:{major:2,minor:0,patch:0},handler:function(){return options={},storage.removeItem("options")?void 0:this.error("unknown error, cannot update options store")}})}function lastVisited(){if(state.isEmpty||0===arguments.length)return-1;var e,t=Array.prototype.concat.apply([],arguments);if(t.length>1){e=state.length;for(var r=0,i=t.length;i>r;r++)e=Math.min(e,lastVisited(t[r]))}else{var s=state.history,a=t[0];for(e=state.length-1;e>=0&&s[e].title!==a;e--);-1!==e&&(e=state.length-1-e)}return e}function previous(e){if(0===arguments.length)e=1;else if(1>e)throw new Error("previous offset parameter must be a positive integer greater than zero");return state.length>e?state.peek(e).title:""}function random(e,t){if(0===arguments.length)throw new Error("random called with insufficient arguments");if(1===arguments.length&&(t=e,e=0),e>t){var r=t;t=e,e=r}return Math.floor(Math.random()*(t-e+1))+e}function randomFloat(e,t){if(0===arguments.length)throw new Error("randomFloat called with insufficient arguments");if(1===arguments.length&&(t=e,e=0),e>t){var r=t;t=e,e=r}return Math.random()*(t-e)+e}function tags(){if(0===arguments.length)return tale.get(state.active.title).tags.slice(0);for(var e=Array.prototype.concat.apply([],arguments),t=[],r=0,i=e.length;i>r;r++)t=t.concat(tale.get(e[r]).tags);return t}function visited(){if(state.isEmpty)return 0;var e,t=Array.prototype.concat.apply([],0===arguments.length?[state.active.title]:arguments);if(t.length>1){e=state.length;for(var r=0,i=t.length;i>r;r++)e=Math.min(e,visited(t[r]))}else{var s=state.history,a=t[0];e=0;for(var r=0,i=state.length;i>r;r++)s[r].title===a&&e++}return e}function visitedTags(){if(0===arguments.length)return 0;for(var e=Array.prototype.concat.apply([],arguments),t=e.length,r=0,i=0,s=state.length;s>i;i++){var a=tale.get(state.history[i].title).tags;if(0!==a.length){for(var n=0,o=0;t>o;o++)a.contains(e[o])&&n++;n===t&&r++}}return r}function either(){return 0!==arguments.length?Array.prototype.concat.apply([],arguments).random():void 0}function visitedTag(){return visitedTags.apply(null,arguments)}function turns(){return state.length}function passage(){return state.active.title}function technicalAlert(e,t,r){var i="Apologies! A technical problem has occurred. You may be able to continue, but some parts may not work properly.";(null!=e||null!=t)&&(i+="\n\nError",null!=e&&(i+=" ["+e+"]"),i+=": "+(null!=t?t.replace(/^Error:\s+/,""):"unknown error")+".",r&&r.stack&&(i+="\n\nStack Trace:\n"+r.stack)),window.alert(i)}"document"in self&&!("classList"in document.createElement("_"))&&!function(e){if("Element"in e){var t="classList",r="prototype",i=e.Element[r],s=Object,a=String[r].trim||function(){return this.replace(/^\s+|\s+$/g,"")},n=Array[r].indexOf||function(e){for(var t=0,r=this.length;r>t;t++)if(t in this&&this[t]===e)return t;return-1},o=function(e,t){this.name=e,this.code=DOMException[e],this.message=t},l=function(e,t){if(""===t)throw new o("SYNTAX_ERR","an invalid or illegal string was specified");if(/\s/.test(t))throw new o("INVALID_CHARACTER_ERR","string contains an invalid character");return n.call(e,t)},c=function(e){for(var t=a.call(e.getAttribute("class")||""),r=t?t.split(/\s+/):[],i=0,s=r.length;s>i;i++)this.push(r[i]);this._updateClassName=function(){e.setAttribute("class",this.toString())}},u=c[r]=[],h=function(){return new c(this)};if(o[r]=Error[r],u.item=function(e){return this[e]||null},u.contains=function(e){return e+="",-1!==l(this,e)},u.add=function(){var e,t=arguments,r=0,i=t.length,s=!1;do e=t[r]+"",-1===l(this,e)&&(this.push(e),s=!0);while(++r<i);s&&this._updateClassName()},u.remove=function(){var e,t=arguments,r=0,i=t.length,s=!1;do{e=t[r]+"";var a=l(this,e);-1!==a&&(this.splice(a,1),s=!0)}while(++r<i);s&&this._updateClassName()},u.toggle=function(e,t){e+="";var r=this.contains(e),i=r?t!==!0&&"remove":t!==!1&&"add";return i&&this[i](e),!r},u.toString=function(){return this.join(" ")},s.defineProperty){var d={get:h,enumerable:!0,configurable:!0};try{s.defineProperty(i,t,d)}catch(p){-2146823252===p.number&&(d.enumerable=!1,s.defineProperty(i,t,d))}}else s[r].__defineGetter__&&i.__defineGetter__(t,h)}}(self),Array.isArray||Object.defineProperty(Array,"isArray",{configurable:!0,writable:!0,value:function(e){return"[object Array]"===Object.prototype.toString.call(e)}}),Array.prototype.indexOf||Object.defineProperty(Array.prototype,"indexOf",{configurable:!0,writable:!0,value:function(e,t){if(null==this)throw new TypeError("Array.prototype.indexOf called on null or undefined");var r=Object(this),i=r.length>>>0;for(t=+t||0,isFinite(t)||(t=0),0>t&&(t+=i,0>t&&(t=0));i>t;t++)if(r[t]===e)return t;return-1}}),Array.prototype.filter||Object.defineProperty(Array.prototype,"filter",{configurable:!0,writable:!0,value:function(e){if(null==this)throw new TypeError("Array.prototype.filter called on null or undefined");if("function"!=typeof e)throw new TypeError("Array.prototype.filter callback parameter must be a function");for(var t=Object(this),r=t.length>>>0,i=[],thisp=arguments[1],s=0;r>s;s++)if(s in t){var a=t[s];e.call(thisp,a,s,t)&&i.push(a)}return i}}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{configurable:!0,writable:!0,value:function(e){if(null==this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof e)throw new TypeError("Array.prototype.find callback parameter must be a function");for(var t=Object(this),r=t.length>>>0,thisp=arguments[1],i=0;r>i;i++)if(i in t){var s=t[i];if(e.call(thisp,s,i,t))return s}return undefined}}),Array.prototype.forEach||Object.defineProperty(Array.prototype,"forEach",{configurable:!0,writable:!0,value:function(e){if(null==this)throw new TypeError("Array.prototype.forEach called on null or undefined");if("function"!=typeof e)throw new TypeError("Array.prototype.forEach callback parameter must be a function");for(var t=Object(this),r=t.length>>>0,thisp=arguments[1],i=0;r>i;i++)if(i in t){var s=t[i];e.call(thisp,s,i,t)}return undefined}}),Array.prototype.map||Object.defineProperty(Array.prototype,"map",{configurable:!0,writable:!0,value:function(e){if(null==this)throw new TypeError("Array.prototype.map called on null or undefined");if("function"!=typeof e)throw new TypeError("Array.prototype.map callback parameter must be a function");for(var t=Object(this),r=t.length>>>0,i=new Array(r),thisp=arguments[1],s=0;r>s;s++)if(s in t){var a=t[s];i[s]=e.call(thisp,a,s,t)}return i}}),Array.prototype.some||Object.defineProperty(Array.prototype,"some",{configurable:!0,writable:!0,value:function(e){if(null==this)throw new TypeError("Array.prototype.some called on null or undefined");
if("function"!=typeof e)throw new TypeError("Array.prototype.some callback parameter must be a function");for(var t=Object(this),r=t.length>>>0,thisp=arguments[1],i=0;r>i;i++)if(i in t){var s=t[i];if(e.call(thisp,s,i,t))return!0}return!1}}),Date.now||Object.defineProperty(Date,"now",{configurable:!0,writable:!0,value:function(){return(new Date).getTime()}}),Math.trunc||Object.defineProperty(Math,"trunc",{configurable:!0,writable:!0,value:function(e){return 0>e?Math.ceil(e):Math.floor(e)}}),String.prototype.contains||Object.defineProperty(String.prototype,"contains",{configurable:!0,writable:!0,value:function(){if(null==this)throw new TypeError("String.prototype.contains called on null or undefined");return-1!==String.prototype.indexOf.apply(this,arguments)}}),String.prototype.splice||Object.defineProperty(String.prototype,"splice",{configurable:!0,writable:!0,value:function(e,t,r){if(null==this)throw new TypeError("String.prototype.splice called on null or undefined");var i=this.length>>>0;if(0===i)return"";e=+e||0,isFinite(e)?0>e&&(e+=i,0>e&&(e=0)):e=0,e>i&&(e=i),t=+t||0,(!isFinite(t)||0>t)&&(t=0);var s=this.slice(0,e);return"undefined"!=typeof r&&(s+=r),i>e+t&&(s+=this.slice(e+t)),s}}),String.prototype.trim||Object.defineProperty(String.prototype,"trim",{configurable:!0,writable:!0,value:function(){if(null==this)throw new TypeError("String.prototype.trim called on null or undefined");return this.replace(/^\s+|\s+$/g,"")}}),String.prototype.trimLeft||Object.defineProperty(String.prototype,"trimLeft",{configurable:!0,writable:!0,value:function(){if(null==this)throw new TypeError("String.prototype.trimLeft called on null or undefined");return this.replace(/^\s+/,"")}}),String.prototype.trimRight||Object.defineProperty(String.prototype,"trimRight",{configurable:!0,writable:!0,value:function(){if(null==this)throw new TypeError("String.prototype.trimRight called on null or undefined");return this.replace(/\s+$/,"")}}),Object.create&&"function"==typeof Object.create||Object.defineProperty(Object,"create",{configurable:!0,writable:!0,value:function(){function e(){}return function(t){if(1!==arguments.length)throw new Error("polyfill Object.create implementation only accepts one parameter");if(null==t)throw new TypeError("Object.create proto parameter is null or undefined");if("object"!=typeof t)throw new TypeError("Object.create proto parameter must be an object");return e.prototype=t,new e}}()}),Object.defineProperty(Array,"random",{configurable:!0,writable:!0,value:function(e,t,r){return 2===arguments.length&&(r=t,t=0),Array.isArray(e)?e.random(t,r):e.hasOwnProperty("length")?Array.prototype.slice.call(e,0).random(t,r):undefined}}),Object.defineProperty(Array.prototype,"contains",{configurable:!0,writable:!0,value:function(){if(null==this)throw new TypeError("Array.prototype.contains called on null or undefined");return-1!==Array.prototype.indexOf.apply(this,arguments)}}),Object.defineProperty(Array.prototype,"containsAll",{configurable:!0,writable:!0,value:function(){if(null==this)throw new TypeError("Array.prototype.containsAll called on null or undefined");if(1===arguments.length)return Array.isArray(arguments[0])?Array.prototype.containsAll.apply(this,arguments[0]):-1!==Array.prototype.indexOf.apply(this,arguments);for(var e=0,t=arguments.length;t>e;e++)if(!Array.prototype.some.call(this,function(e){return e===this.val},{val:arguments[e]}))return!1;return!0}}),Object.defineProperty(Array.prototype,"containsAny",{configurable:!0,writable:!0,value:function(){if(null==this)throw new TypeError("Array.prototype.containsAny called on null or undefined");if(1===arguments.length)return Array.isArray(arguments[0])?Array.prototype.containsAny.apply(this,arguments[0]):-1!==Array.prototype.indexOf.apply(this,arguments);for(var e=0,t=arguments.length;t>e;e++)if(Array.prototype.some.call(this,function(e){return e===this.val},{val:arguments[e]}))return!0;return!1}}),Object.defineProperty(Array.prototype,"random",{configurable:!0,writable:!0,value:function(e,t){if(null==this)throw new TypeError("Array.prototype.random called on null or undefined");return 1===arguments.length&&(t=e,e=0),null==e?e=0:0>e?e=0:e>=this.length&&(e=this.length-1),null==t?t=this.length-1:0>t?t=0:t>=this.length&&(t=this.length-1),this[random(e,t)]}}),Object.defineProperty(Math,"clamp",{configurable:!0,writable:!0,value:function(e,t,r){return e=Number(e),isNaN(e)?0/0:e.clamp(t,r)}}),Object.defineProperty(Math,"easeInOut",{configurable:!0,writable:!0,value:function(e){return 1-(Math.cos(e*Math.PI)+1)/2}}),Object.defineProperty(Number.prototype,"clamp",{configurable:!0,writable:!0,value:function(e,t){var r=Number(this);return e>r&&(r=e),r>t&&(r=t),r}}),Object.defineProperty(String,"format",{configurable:!0,writable:!0,value:function(e){function t(e,t,r){if(!t)return e;var i=Math.abs(t)-e.length;if(1>i)return e;var s=Array(i+1).join(r);return 0>t?e+s:s+e}if(arguments.length<2)return 0===arguments.length?"":e;var r=2===arguments.length&&Array.isArray(arguments[1])?arguments[1].slice(0):Array.prototype.slice.call(arguments,1);return 0===r.length?e:e.replace(/{(\d+)(?:,([+-]?\d+))?}/g,function(e,i,s){var a=r[i];if(null==a)return"";for(;"function"==typeof a;)a=a();return"object"==typeof a&&(a=JSON.stringify(a)),t(a,s?parseInt(s):0," ")})}}),Object.defineProperty(String.prototype,"ltrim",{configurable:!0,writable:!0,value:String.prototype.trimLeft}),Object.defineProperty(String.prototype,"rtrim",{configurable:!0,writable:!0,value:String.prototype.trimRight}),Object.defineProperty(String.prototype,"readBracketedList",{configurable:!0,writable:!0,value:function(){if(null==this)throw new TypeError("String.prototype.readBracketedList called on null or undefined");var e,t=new RegExp("(?:\\[\\[((?:\\s|\\S)*?)\\]\\])|([^\"'\\s]\\S*)","gm");for(names=[];null!==(e=t.exec(this));)e[1]?names.push(e[1]):e[2]&&names.push(e[2]);return names}}),Object.defineProperty(Function.prototype,"toJSON",{configurable:!0,writable:!0,value:function(){return JSON.reviveWrapper(this.toString())}}),Object.defineProperty(RegExp.prototype,"toJSON",{configurable:!0,writable:!0,value:function(){return JSON.reviveWrapper(this.toString())}}),Object.defineProperty(Date.prototype,"toJSON",{configurable:!0,writable:!0,value:function(){return JSON.reviveWrapper('new Date("'+this.toISOString()+'")')}}),Object.defineProperty(JSON,"reviveWrapper",{configurable:!0,writable:!0,value:function(e){if("string"!=typeof e)throw new TypeError("JSON.reviveWrapper code parameter must be a string");return"@@revive@@("+e+")"}}),Object.defineProperty(JSON,"_real_parse",{configurable:!0,writable:!0,value:JSON.parse}),Object.defineProperty(JSON,"parse",{configurable:!0,writable:!0,value:function(text,reviver){return JSON._real_parse(text,function(key,value){if("string"==typeof value&&"@@revive@@"===value.slice(0,10))try{value=eval(value.slice(10))}catch(e){}if("function"==typeof reviver)try{value=reviver(key,value)}catch(e){}return value})}});var saveAs=saveAs||navigator.msSaveBlob&&navigator.msSaveBlob.bind(navigator)||function(e){var t=e.document,r=function(){return e.URL||e.webkitURL||e},i=e.URL||e.webkitURL||e,s=t.createElementNS("http://www.w3.org/1999/xhtml","a"),a="download"in s,n=function(r){var i=t.createEvent("MouseEvents");i.initMouseEvent("click",!0,!1,e,0,0,0,0,0,!1,!1,!1,!1,0,null),r.dispatchEvent(i)},o=e.webkitRequestFileSystem,l=e.requestFileSystem||o||e.mozRequestFileSystem,c=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},u="application/octet-stream",h=0,d=[],p=function(){for(var e=d.length;e--;){var t=d[e];"string"==typeof t?i.revokeObjectURL(t):t.remove()}d.length=0},f=function(e,t,r){t=[].concat(t);for(var i=t.length;i--;){var s=e["on"+t[i]];if("function"==typeof s)try{s.call(e,r||e)}catch(a){c(a)}}},g=function(t,i){var c,p,g,m=this,y=t.type,v=!1,w=function(){var e=r().createObjectURL(t);return d.push(e),e},b=function(){f(m,"writestart progress write writeend".split(" "))},k=function(){(v||!c)&&(c=w(t)),p?p.location.href=c:window.open(c,"_blank"),m.readyState=m.DONE,b()},S=function(e){return function(){return m.readyState!==m.DONE?e.apply(this,arguments):void 0}},x={create:!0,exclusive:!1};return m.readyState=m.INIT,i||(i="download"),a?(c=w(t),s.href=c,s.download=i,n(s),m.readyState=m.DONE,void b()):(e.chrome&&y&&y!==u&&(g=t.slice||t.webkitSlice,t=g.call(t,0,t.size,u),v=!0),o&&"download"!==i&&(i+=".download"),(y===u||o)&&(p=e),l?(h+=t.size,void l(e.TEMPORARY,h,S(function(e){e.root.getDirectory("saved",x,S(function(e){var r=function(){e.getFile(i,x,S(function(e){e.createWriter(S(function(r){r.onwriteend=function(t){p.location.href=e.toURL(),d.push(e),m.readyState=m.DONE,f(m,"writeend",t)},r.onerror=function(){var e=r.error;e.code!==e.ABORT_ERR&&k()},"writestart progress write abort".split(" ").forEach(function(e){r["on"+e]=m["on"+e]}),r.write(t),m.abort=function(){r.abort(),m.readyState=m.DONE},m.readyState=m.WRITING}),k)}),k)};e.getFile(i,{create:!1},S(function(e){e.remove(),r()}),S(function(e){e.code===e.NOT_FOUND_ERR?r():k()}))}),k)}),k)):void k())},m=g.prototype,y=function(e,t){return new g(e,t)};return m.abort=function(){var e=this;e.readyState=e.DONE,f(e,"abort")},m.readyState=m.INIT=0,m.WRITING=1,m.DONE=2,m.error=m.onwritestart=m.onprogress=m.onwrite=m.onabort=m.onerror=m.onwriteend=null,e.addEventListener("unload",p,!1),y}(self),Util=Object.defineProperties({},{random:{value:Math.random},isNumeric:{value:function(e){switch(typeof e){case"number":break;case"string":e=Number(e);break;default:return!1}return isFinite(e)&&!isNaN(e)}},isBoolean:{value:function(e){return"boolean"==typeof e||"string"==typeof e&&("true"===e||"false"===e)}},slugify:{value:function(e){return e.trim().replace(/[^\w\s\u2013\u2014-]+/g,"").replace(/[_\s\u2013\u2014-]+/g,"-").toLocaleLowerCase()}},evalExpression:{value:function(expression){return eval("("+expression+")")}},evalStatements:{value:function(statements){return eval("(function(){"+statements+"\n}());"),!0}},DiffOp:{value:Object.freeze({Delete:0,SpliceArray:1,Copy:2,CopyDate:3})},diff:{value:function(e,t){for(var r,i=[].concat(Object.keys(e),Object.keys(t)).sort().filter(function(e,t,r){return 0===t||r[t-1]!=e}),s={},a=Array.isArray(e),n=0,o=i.length;o>n;n++){var l=i[n],c=e[l],u=t[l];if(e.hasOwnProperty(l))if(t.hasOwnProperty(l)){if(c===u)continue;if(typeof c==typeof u)if("function"==typeof c)c.toString()!==u.toString()&&(s[l]=[Util.DiffOp.Copy,u]);else if("object"!=typeof c||null===c)s[l]=[Util.DiffOp.Copy,u];else{var h=Object.prototype.toString.call(c),d=Object.prototype.toString.call(u);if(h===d)if("[object Date]"===h)+c!==+u&&(s[l]=[Util.DiffOp.CopyDate,+u]);else if("[object RegExp]"===h)c.toString()!==u.toString()&&(s[l]=[Util.DiffOp.Copy,clone(u)]);else{var p=Util.diff(c,u);null!==p&&(s[l]=p)}else s[l]=[Util.DiffOp.Copy,clone(u)]}else s[l]=[Util.DiffOp.Copy,"object"!=typeof u||null===u?u:clone(u)]}else if(a&&Util.isNumeric(l)){var f=+l;if(!r){r="";do r+="~";while(i.some(function(e){return e===this.val},{val:r}));s[r]=[Util.DiffOp.SpliceArray,f,f]}f<s[r][1]&&(s[r][1]=f),f>s[r][2]&&(s[r][2]=f)}else s[l]=Util.DiffOp.Delete;else s[l]=[Util.DiffOp.Copy,"object"!=typeof u||null===u?u:clone(u)]}return 0!==Object.keys(s).length?s:null}},patch:{value:function(e,t){for(var r=Object.keys(t||{}),i=clone(e),s=0,a=r.length;a>s;s++){var n=r[s],o=t[n];if(o===Util.DiffOp.Delete)delete i[n];else if(Array.isArray(o))switch(o[0]){case Util.DiffOp.SpliceArray:i.splice(o[1],1+(o[2]-o[1]));break;case Util.DiffOp.Copy:i[n]=clone(o[1]);break;case Util.DiffOp.CopyDate:i[n]=new Date(o[1])}else i[n]=Util.patch(i[n],o)}return i}},serialize:{value:JSON.stringify},deserialize:{value:JSON.parse},generateUuid:{value:UUID.generate}});Object.defineProperties(SeedablePRNG,{marshal:{value:function(e){if(!e||!e.hasOwnProperty("seed")||!e.hasOwnProperty("count"))throw new Error("PRNG is missing required data");return{seed:e.seed,count:e.count}}},unmarshal:{value:function(e){if(!e||!e.hasOwnProperty("seed")||!e.hasOwnProperty("count"))throw new Error("PRNG object is missing required data");for(var t=new SeedablePRNG(e.seed,!1),r=0,i=e.count;i>r;r++)t.random();return t}}}),Object.defineProperties(KeyValueStore.prototype,{setItem:{value:function(e,t,r){if(!e)return!1;var i=e;if(e=this.prefix+e,t=JSON.stringify(t),this._store)try{t=LZString.compressToUTF16(t),this._store.setItem(e,t)}catch(s){return r||technicalAlert(null,'unable to store key "'+i+'"; '+(/quota_?(?:exceeded|reached)/i.test(s.name)?this.name+" quota exceeded":"unknown error"),s),!1}else{try{t=LZString.compressToBase64(t);var a=[escape(e)+"="+escape(t)];switch(this.name){case"localStorage":case"cookie":a.push("expires=Tue, 19 Jan 2038 03:14:07 GMT")}a.push("path=/"),document.cookie=a.join("; ")}catch(s){return r||technicalAlert(null,'unable to store key "'+i+'"; cookie error: '+s.message,s),!1}if(!this.hasItem(i))return r||technicalAlert(null,'unable to store key "'+i+'"; unknown cookie error'),!1}return!0}},getItem:{value:function(e){if(!e)return null;var t=e,r=!1;if(e=this.prefix+e,this._store){var i=this._store.getItem(e);if(null!=i){if("#~"===i.slice(0,2))i=JSON.parse(LZString.decompressFromUTF16(i.slice(2))),r=!0;else try{i=JSON.parse(LZString.decompressFromUTF16(i))}catch(s){i=JSON.parse(i),r=!0}if(r&&!this.setItem(t,i,!0))throw new Error('unable to upgrade legacy value for key "'+t+'" to new format');return i}}else{e=escape(e);for(var a=document.cookie.split(";"),n=0;n<a.length;n++){var o=a[n].split("=");if(o[0].trim()===e){var i=unescape(o[1]);if("#~"===i.slice(0,2))i=JSON.parse(LZString.decompressFromBase64(i.slice(2))),r=!0;else try{i=JSON.parse(LZString.decompressFromBase64(i))}catch(s){i=JSON.parse(i),r=!0}if(r&&!this.setItem(t,i,!0))throw new Error('unable to upgrade legacy value for key "'+t+'" to new format');return i}}}return null}},removeItem:{value:function(e){return e?(e=this.prefix+e,this._store?this._store.removeItem(e):document.cookie=escape(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/",!0):!1}},removeMatchingItems:{value:function(e){if(!e)return!1;var t=[],r=new RegExp(("^"+this.prefix+e).replace(/\./g,"\\.")+".*");if(this._store)for(var i=0;i<this._store.length;i++){var s=this._store.key(i);r.test(s)&&t.push(s)}else{e=escape(e);for(var a=document.cookie.split(";"),i=0;i<a.length;i++){var n=a[i].split("="),s=n[0].trim();r.test(s)&&t.push(s)}}for(var i=0;i<t.length;i++)this.removeItem(t[i]);return!0}},hasItem:{value:function(e){if(!e)return!1;if(e=this.prefix+e,this._store){if(this._store.getItem(e))return!0}else{e=escape(e);for(var t=document.cookie.split(";"),r=0;r<t.length;r++){var i=t[r].split("=");if(i[0].trim()===e)return!0}}return!1}}});var SaveSystem=Object.defineProperties({},{_bad:{writable:!0,value:!1},_max:{writable:!0,value:-1},init:{value:function(){function e(e,t){for(var r=0;t>r;r++)e.push(null);return e}function t(e){e.hasOwnProperty("data")&&!e.hasOwnProperty("state")?(e.state={mode:e.mode,delta:History.deltaEncodeHistory(e.data)},delete e.mode,delete e.data):e.hasOwnProperty("state")&&!e.state.hasOwnProperty("delta")&&(e.state.delta=History.deltaEncodeHistory(e.state.history),delete e.state.history)}if(config.saves.slots<0&&(config.saves.slots=0),null===storage.store)return!1;storage.hasItem("saves")||storage.setItem("saves",{autosave:null,slots:e([],config.saves.slots)});var r=storage.getItem("saves");if(null===r)return SaveSystem._bad=!0,!1;Array.isArray(r)&&(r={autosave:null,slots:r},storage.setItem("saves",r)),config.saves.slots!==r.slots.length&&(config.saves.slots<r.slots.length?(r.slots.reverse(),r.slots=r.slots.filter(function(e){return null===e&&this.count>0?(this.count--,!1):!0},{count:r.slots.length-config.saves.slots}),r.slots.reverse()):config.saves.slots>r.slots.length&&e(r.slots,config.saves.slots-r.slots.length),storage.setItem("saves",r));var i=!1;null!==r.autosave&&(r.autosave.hasOwnProperty("state")&&r.autosave.state.hasOwnProperty("delta")||(t(r.autosave),i=!0));for(var s=0;s<r.slots.length;s++)null!==r.slots[s]&&(r.slots[s].hasOwnProperty("state")&&r.slots[s].state.hasOwnProperty("delta")||(t(r.slots[s]),i=!0));return i&&storage.setItem("saves",r),SaveSystem._max=r.slots.length-1,!0}},length:{value:function(){return SaveSystem._max+1}},OK:{value:function(){return SaveSystem.autosaveOK()||SaveSystem.slotsOK()}},autosaveOK:{value:function(){return!SaveSystem._bad&&"undefined"!=typeof config.saves.autosave}},slotsOK:{value:function(){return!SaveSystem._bad&&-1!==SaveSystem._max}},hasAuto:{value:function(){var e=storage.getItem("saves");return null===e||null===e.autosave?!1:!0}},getAuto:{value:function(){var e=storage.getItem("saves");return null===e?null:e.autosave}},loadAuto:{value:function(){var e=storage.getItem("saves");return null===e||null===e.autosave?!1:SaveSystem.unmarshal(e.autosave)}},saveAuto:{value:function(e,t){if("function"==typeof config.saves.isAllowed&&!config.saves.isAllowed())return!1;var r=storage.getItem("saves");return null===r?!1:(r.autosave=SaveSystem.marshal(),r.autosave.title=e||tale.get(state.active.title).excerpt(),r.autosave.date=Date.now(),null!=t&&(r.autosave.metadata=t),storage.setItem("saves",r))}},deleteAuto:{value:function(){var e=storage.getItem("saves");return null===e?!1:(e.autosave=null,storage.setItem("saves",e))}},isEmpty:{value:function(){return 0===SaveSystem.count()}},count:{value:function(){if(!SaveSystem.slotsOK())return 0;var e=storage.getItem("saves");if(null===e)return 0;for(var t=0,r=0;r<e.slots.length;r++)null!==e.slots[r]&&t++;return t}},has:{value:function(e){if(0>e||e>SaveSystem._max)return!1;var t=storage.getItem("saves");return null===t||e>t.slots.length||null===t.slots[e]?!1:!0}},get:{value:function(e){if(0>e||e>SaveSystem._max)return null;var t=storage.getItem("saves");return null===t||e>t.slots.length?null:t.slots[e]}},load:{value:function(e){if(0>e||e>SaveSystem._max)return!1;var t=storage.getItem("saves");return null===t||e>t.slots.length||null===t.slots[e]?!1:SaveSystem.unmarshal(t.slots[e])}},save:{value:function(e,t,r){if("function"==typeof config.saves.isAllowed&&!config.saves.isAllowed())return UISystem.alert(config.errors.savesNotAllowed),!1;if(0>e||e>SaveSystem._max)return!1;var i=storage.getItem("saves");return null===i||e>i.slots.length?!1:(i.slots[e]=SaveSystem.marshal(),i.slots[e].title=t||tale.get(state.active.title).excerpt(),i.slots[e].date=Date.now(),null!=r&&(i.slots[e].metadata=r),storage.setItem("saves",i))}},delete:{value:function(e){if(0>e||e>SaveSystem._max)return!1;var t=storage.getItem("saves");return null===t||e>t.slots.length?!1:(t.slots[e]=null,storage.setItem("saves",t))}},purge:{value:function(){return storage.removeItem("saves"),SaveSystem.init()}},exportSave:{value:function(){if("function"==typeof config.saves.isAllowed&&!config.saves.isAllowed())return void UISystem.alert(config.errors.savesNotAllowed);var e=tale.domId+".save",t=LZString.compressToBase64(JSON.stringify(SaveSystem.marshal()));saveAs(new Blob([t],{type:"text/plain;charset=UTF-8"}),e)}},importSave:{value:function(e){var t=e.target.files[0],r=new FileReader;$(r).load(function(e){return function(t){if(t.target.result){var r;try{r=JSON.parse(/\.json$/i.test(e.name)||/^\{/.test(t.target.result)?t.target.result:LZString.decompressFromBase64(t.target.result))}catch(i){}SaveSystem.unmarshal(r)}}}(t)),r.readAsText(t)}},marshal:{value:function(){var e={id:config.saves.id,state:History.marshal()};return config.saves.version&&(e.version=config.saves.version),"function"==typeof config.saves.onSave&&config.saves.onSave(e),e.state.delta=History.deltaEncodeHistory(e.state.history),delete e.state.history,e}},unmarshal:{value:function(e){try{if(!e||!e.hasOwnProperty("id")||!e.hasOwnProperty("state"))throw new Error(e&&e.hasOwnProperty("mode")&&e.hasOwnProperty("id")&&e.hasOwnProperty("data")?"old-style saves seen in SaveSystem.unmarshal()":"save is missing required data. Either you've loaded a file which isn't a save, or the save has become corrupted");if(e.state.history=History.deltaDecodeHistory(e.state.delta),delete e.state.delta,"function"==typeof config.saves.onLoad&&config.saves.onLoad(e),e.id!==config.saves.id)throw new Error("save is from the wrong "+config.errorName);History.unmarshal(e.state)}catch(t){return UISystem.alert(t.message[0].toUpperCase()+t.message.slice(1)+".\n\nAborting load."),!1}return!0}}}),UISystem=Object.defineProperties({},{_overlay:{writable:!0,value:null},_body:{writable:!0,value:null},_closer:{writable:!0,value:null},init:{value:function(){$("#init-no-js, #init-lacking").remove();var e=document.getElementById("store-area"),t=document.createDocumentFragment(),r=document.createElement("div");for(r.innerHTML=tale.has("StoryFormatMarkup")?tale.get("StoryFormatMarkup").text.trim():'<div id="ui-bar"><header id="title"><div id="story-banner"></div><h1 id="story-title"></h1><div id="story-subtitle"></div><div id="story-title-separator"></div><p id="story-author"></p></header><div id="story-caption"></div><nav id="menu"><ul id="menu-story-transitional"></ul><ul id="menu-core"><li id="menu-story"></li><li id="menu-saves"><a>Saves</a></li><li id="menu-rewind"><a>Rewind</a></li><li id="menu-restart"><a>Restart</a></li><li id="menu-options"><a>Options</a></li><li id="menu-share"><a>Share</a></li></ul></nav><footer><p id="credits">Made with <a href="http://twinery.org/" target="_blank">Twine</a> &amp; <a href="http://www.motoslave.net/sugarcube/" target="_blank">SugarCube</a></p><p id="version">SugarCube (v1.0.3)</p></footer></div><div id="passages" role="main"></div>';r.hasChildNodes();)t.appendChild(r.firstChild);UISystem._overlay=insertElement(t,"div","ui-overlay","ui-close"),UISystem._body=insertElement(t,"div","ui-body"),UISystem._closer=insertElement(t,"a","ui-body-close","ui-close",""),e.parentNode.insertBefore(t,e)}},start:{value:function(){var e=$(document.documentElement);setPageElement("story-title","StoryTitle",tale.title),tale.has("StoryCaption")||$("#story-caption").remove(),tale.has("StoryMenu")||$("#menu-story").remove(),tale.has("MenuStory")||$("#menu-story-transitional").remove(),UISystem.setPageElements(),UISystem.addClickHandler("#menu-saves",null,function(){UISystem.buildDialogSaves()}),!config.disableHistoryTracking&&tale.lookup("tags","bookmark").length>0?UISystem.addClickHandler($("#menu-rewind a"),null,function(){UISystem.buildDialogRewind()}):$("#menu-rewind").remove(),UISystem.addClickHandler("#menu-restart",null,function(){UISystem.buildDialogRestart()}),tale.has("MenuOptions")?UISystem.addClickHandler($("#menu-options a"),null,function(){UISystem.buildDialogOptions()}):$("#menu-options").remove(),tale.has("MenuShare")?UISystem.addClickHandler($("#menu-share a"),null,function(){UISystem.buildDialogShare()}):$("#menu-share").remove(),"complete"===document.readyState&&e.removeClass("init-loading"),document.addEventListener("readystatechange",function(){"complete"===document.readyState?config.loadDelay>0?setTimeout(function(){e.removeClass("init-loading")},config.loadDelay):e.removeClass("init-loading"):e.addClass("init-loading")},!1)}},setPageElements:{value:function(){if(setPageElement("story-banner","StoryBanner"),setPageElement("story-subtitle","StorySubtitle"),setPageElement("story-author","StoryAuthor"),setPageElement("story-caption","StoryCaption"),setPageElement("menu-story","StoryMenu"),tale.has("MenuStory")){var e=document.getElementById("menu-story-transitional");removeChildren(e),UISystem.populateListFromPassage("MenuStory",e)}}},buildDialogSaves:{value:function(){function e(e,t,r,i){var s=document.createElement("li"),a=document.createElement("button");return a.id="saves-"+e,t&&(a.className=t),a.innerHTML=r,$(a).click(i),s.appendChild(a),s}function t(){function e(e,t,r,i,s){var a=document.createElement("button");return a.id="saves-"+e+"-"+i,t&&(a.className=t),a.classList.add(e),a.innerHTML=r,$(a).click(function(e){return function(){s(e)}}(i)),a}var t=storage.getItem("saves");if(null===t)return!1;var r,i,s,a,n,o,l,c,u=document.createElement("tbody");SaveSystem.autosaveOK()&&(r=document.createElement("tr"),i=document.createElement("td"),s=document.createElement("td"),a=document.createElement("td"),n=document.createElement("td"),l=document.createElement("b"),l.innerHTML="A",i.appendChild(l),t.autosave&&t.autosave.state.mode===config.historyMode?(o=document.createElement("button"),o.id="saves-load-autosave",o.classList.add("load"),o.classList.add("ui-close"),o.innerHTML="Load",$(o).click(SaveSystem.loadAuto),s.appendChild(o),l=document.createTextNode(t.autosave.title),a.appendChild(l),a.appendChild(document.createElement("br")),l=document.createElement("small"),l.innerHTML="Autosaved ("+new Date(t.autosave.date).toLocaleString()+")",a.appendChild(l),c=document.createElement("button"),c.id="saves-delete-autosave",c.classList.add("delete"),c.innerHTML="Delete",$(c).click(function(){SaveSystem.deleteAuto(),UISystem.buildDialogSaves()}),n.appendChild(c)):(l=document.createElement("i"),l.innerHTML="(autosave slot empty)",a.appendChild(l),a.classList.add("empty")),r.appendChild(i),r.appendChild(s),r.appendChild(a),r.appendChild(n),u.appendChild(r));for(var h=0;h<t.slots.length;h++)r=document.createElement("tr"),i=document.createElement("td"),s=document.createElement("td"),a=document.createElement("td"),n=document.createElement("td"),i.appendChild(document.createTextNode(h+1)),t.slots[h]&&t.slots[h].state.mode===config.historyMode?(o=e("load","ui-close","Load",h,SaveSystem.load),s.appendChild(o),l=document.createTextNode(t.slots[h].title),a.appendChild(l),a.appendChild(document.createElement("br")),l=document.createElement("small"),l.innerHTML=t.slots[h].date?"Saved ("+new Date(t.slots[h].date).toLocaleString()+")":"Saved (<i>unknown</i>)",a.appendChild(l),c=e("delete",null,"Delete",h,function(e){SaveSystem.delete(e),UISystem.buildDialogSaves()}),n.appendChild(c)):(o=e("save","ui-close","Save",h,SaveSystem.save),s.appendChild(o),l=document.createElement("i"),l.innerHTML="(save slot empty)",a.appendChild(l),a.classList.add("empty")),r.appendChild(i),r.appendChild(s),r.appendChild(a),r.appendChild(n),u.appendChild(r);var d=document.createElement("table");return d.id="saves-list",d.appendChild(u),d}function r(){var e=document.createElement("div"),t=document.createElement("div"),r=document.createElement("input");return t.id="saves-import-label",t.appendChild(document.createTextNode("Select a save file to load:")),e.appendChild(t),r.type="file",r.id="saves-import-file",r.name="saves-import-file",$(r).change(function(e){SaveSystem.importSave(e),UISystem.close()}),e.appendChild(r),e}var i,s,a=UISystem._body,n=SaveSystem.OK();return $(a).empty().addClass("saves"),n&&(i=t(),i||(i=document.createElement("div"),i.id="saves-list",i.innerHTML="<i>No save slots found</i>"),a.appendChild(i)),n||has.fileAPI?(s=document.createElement("div"),i=document.createElement("ul"),has.fileAPI&&(i.appendChild(e("export","ui-close","Save to Disk…",SaveSystem.exportSave)),i.appendChild(e("import",null,"Load from Disk…",function(){document.getElementById("saves-import-file")||a.appendChild(r())}))),n&&i.appendChild(e("purge",null,"Purge Slots",function(){SaveSystem.purge(),UISystem.buildDialogSaves()})),s.appendChild(i),a.appendChild(s),!0):(UISystem.alert("Apologies! Your browser either lacks some of the capabilities required to support saves or has disabled them.\n\nThe former may be solved by updating it to a newer version or by switching to a more modern browser.\n\nThe latter may be solved by loosening its security restrictions or, perhaps, by viewing the "+config.errorName+" via the HTTP protocol."),!1)}},buildDialogRewind:{value:function(){var e=UISystem._body,t=document.createElement("ul");$(e).empty().addClass("dialog-list rewind").append(t);for(var r=0,i=state.length-1;i>r;r++){var s=tale.get(state.history[r].title);if(s&&s.tags.contains("bookmark")){var a=document.createElement("li"),n=document.createElement("a");n.classList.add("ui-close"),$(n).click(function(){var e=r;return config.historyMode===History.Modes.Session?function(){if(document.title=tale.title,state.regenerateSuid(),config.disableHistoryControls)History.replaceWindowState({suid:state.suid,sidx:state.history[e].sidx},config.displayPassageTitles&&state.history[e].title!==config.startPassage?tale.title+": "+state.history[e].title:tale.title);else for(var t=0,r=e;r>=t;t++)History.addWindowState({suid:state.suid,sidx:state.history[t].sidx},config.displayPassageTitles&&state.history[t].title!==config.startPassage?tale.title+": "+state.history[t].title:tale.title);var i=History.getWindowState();i.sidx<state.top.sidx&&state.pop(state.top.sidx-i.sidx),state.activate(state.top),state.display(state.active.title,null,"replace")}:config.historyMode===History.Modes.Window?function(){if(document.title=tale.title,!config.disableHistoryControls)for(var t=0,r=e;r>=t;t++){var i={history:state.history.slice(0,t+1)};state.hasOwnProperty("prng")&&(i.rseed=state.prng.seed),History.addWindowState(i,config.displayPassageTitles&&state.history[t].title!==config.startPassage?tale.title+": "+state.history[t].title:tale.title)}state.pop(state.length-(e+1)),state.activate(state.top),state.display(state.active.title,null,"replace")}:function(){config.disableHistoryControls?(session.setItem("activeHash",state.history[e].hash),window.location.reload()):window.location.hash=state.history[e].hash}}()),n.appendChild(document.createTextNode("Turn "+(r+1)+": "+s.excerpt())),a.appendChild(n),t.appendChild(a)}}if(!t.hasChildNodes()){var a=document.createElement("li"),n=document.createElement("a");n.innerHTML="<i>No rewind points available…</i>",a.appendChild(n),t.appendChild(a)}}},buildDialogRestart:{value:function(){var e=UISystem._body;return $(e).empty().addClass("dialog restart").append('<p>Are you sure that you want to restart? Unsaved progress will be lost.</p><ul><li><button id="restart-ok" class="ui-close">OK</button></li><li><button id="restart-cancel" class="ui-close">Cancel</button></li></ul>'),$("#ui-body #restart-ok").click(function(){state.restart()}),!0}},buildDialogOptions:{value:function(){var e=UISystem._body;return $(e).empty().addClass("dialog options"),new Wikifier(e,tale.get("MenuOptions").processText().trim()),!0}},buildDialogShare:{value:function(){var e=UISystem._body;return $(e).empty().addClass("dialog-list share").append(UISystem.populateListFromPassage("MenuShare")),!0}},populateListFromPassage:{value:function(e,t){null==t&&(t=document.createElement("ul"));var r=document.createDocumentFragment();if(new Wikifier(r,tale.get(e).processText().trim()),r.hasChildNodes())for(var i=null;r.hasChildNodes();){var s=r.firstChild;3===s.nodeType||1===s.nodeType&&"BR"!==s.nodeName.toUpperCase()?(null===i&&(i=document.createElement("li"),t.appendChild(i)),i.appendChild(s)):(r.removeChild(s),null!==i&&(i=null))}return t}},alert:{value:function(e,t,r){var i=UISystem._body;$(i).empty().addClass("dialog alert").append("<p>"+e+'</p><ul><li><button id="alert-ok" class="ui-close">OK</button></li></ul>'),UISystem.show(t,r)}},restart:{value:function(e){UISystem.buildDialogRestart(),UISystem.show(e)}},body:{value:function(){return UISystem._body}},setup:{value:function(e){return $(UISystem._body).empty().removeClass().addClass("dialog"),null!=e&&$(UISystem._body).addClass(e),UISystem._body}},isOpen:{value:function(){return document.body.classList.contains("ui-open")}},addClickHandler:{value:function(e,t,r,i,s){$(e).click(function(e){e.preventDefault(),"function"==typeof r&&r(e),UISystem.show(t,s),"function"==typeof i&&i(e)})}},show:{value:function(e,t){e=$.extend({top:50,opacity:.8},e),$(document.body).addClass("ui-open").on("click.uisystem-close",".ui-close",t,UISystem.close),$(UISystem._overlay).css({display:"block",opacity:0}).fadeTo(200,e.opacity);var r=UISystem.calcPositionalProperties(e.top);$(UISystem._body).css($.extend({display:"block",opacity:0},r.dialog)).fadeTo(200,1),$(UISystem._closer).css($.extend({display:"block",opacity:0},r.closer)).fadeTo(50,1),$(window).on("resize.uisystem",null,e.top,$.debounce(40,UISystem.resizeHandler))
}},close:{value:function(e){$(window).off("resize.uisystem"),$(UISystem._body).css({display:"none",opacity:0,left:"",right:"",top:"",bottom:""}).removeClass().empty(),$(UISystem._closer).css({display:"none",opacity:0,right:"",top:""}),$(UISystem._overlay).fadeOut(200),$(document.body).off("click.uisystem-close").removeClass("ui-open"),e&&"function"==typeof e.data&&e.data(e)}},resizeHandler:{value:function(e){var t=$(UISystem._body),r=$(UISystem._closer),i=e&&"undefined"!=typeof e.data?e.data:50;if("block"===t.css("display")){t.css({display:"none",left:"",right:"",top:"",bottom:""}),r.css({display:"none",right:"",top:""});var s=UISystem.calcPositionalProperties(i);t.css($.extend({display:"block"},s.dialog)),r.css($.extend({display:"block"},s.closer))}}},calcPositionalProperties:{value:function(e){"undefined"==typeof e&&(e=50);var t=$(window),r=$(UISystem._body),i={left:"",right:"",top:"",bottom:""},s=$(UISystem._closer),a={right:"",top:""},n=t.width()-r.outerWidth(!0),o=t.height()-r.outerHeight(!0);return i.left=i.right=32>=n?16:~~(n/2),i.top=32>=o?i.bottom=16:o/2>e?e:i.bottom=~~(o/2),a.right=i.right-s.outerWidth(!0)+6+"px",a.top=i.top-s.outerHeight(!0)+6+"px",Object.keys(i).forEach(function(e){""!==i[e]&&(i[e]+="px")}),{dialog:i,closer:a}}}});History.Modes=Object.freeze({Hash:1,Window:2,Session:3}),Object.defineProperties(History.prototype,{top:{enumerable:!0,get:function(){return 0!==this.history.length?this.history[this.history.length-1]:null}},bottom:{enumerable:!0,get:function(){return 0!==this.history.length?this.history[0]:null}},isEmpty:{enumerable:!0,get:function(){return 0===this.history.length}},length:{enumerable:!0,get:function(){return config.historyMode===History.Modes.Session?this.active.sidx+1:this.history.length}}}),History.prototype.getDeltaFromHistory=function(e){return History.deltaEncodeHistory(null!=e?this.history.slice(0,e):this.history)},History.prototype.setHistoryFromDelta=function(e){this.history=History.deltaDecodeHistory(e)},History.prototype.has=function(e){return this.isEmpty?!1:0===arguments.length||null==e||""===e?!1:this.history.slice(0,this.length).some(function(t){return t.title===e})},History.prototype.index=function(e){return this.isEmpty?null:0>e||e>=this.length?null:this.history[e]},History.prototype.peek=function(e){return this.isEmpty?null:(e=1+(e?Math.abs(e):0),e>this.length?null:this.history[this.length-e])},History.prototype.push=function(){if(0!==arguments.length){for(var e=0;e<arguments.length;e++){var t=arguments[e];config.historyMode===History.Modes.Session&&(t.sidx=this.history.length),this.history.push(t)}return this.history.length}},History.prototype.pop=function(e){return this.isEmpty?[]:(e=e?Math.abs(e):1,1===e?this.history.pop():this.history.splice(this.history.length-e,e))},History.prototype.activate=function(e){if(0!==arguments.length){if(null==e)throw new Error("state activation attempted with null/undefined");if("object"==typeof e)this.active=clone(e);else{if(this.isEmpty)return null;if(0>e||e>=this.history.length)return null;this.active=clone(this.history[e])}return this.prng&&(this.prng=SeedablePRNG.unmarshal({seed:this.prng.seed,count:this.active.rcount})),this.active}},History.prototype.init=function(){if(tale.has("StoryInit"))try{Wikifier.wikifyEval(tale.get("StoryInit").text)}catch(e){technicalAlert("StoryInit",e.message)}config.disableHistoryTracking&&(config.disableHistoryControls=!0),"undefined"!=typeof testPlay&&""!==testPlay?this.display(testPlay):this.restore()||this.display(config.startPassage),config.historyMode===History.Modes.Session?window.addEventListener("popstate",History.popStateHandler_Session,!1):config.historyMode===History.Modes.Window?window.addEventListener("popstate",History.popStateHandler_Window,!1):window.addEventListener("hashchange",History.hashChangeHandler,!1)},History.prototype.display=function(e,t,r){var i="hidden"===r||"offscreen"===r||"quietly"===r||r===!1?!1:!0,s="replace"===r||"back"===r?!1:!0;runtime.temp={};var a=tale.get(e),n=config.displayPassageTitles&&a.title!==config.startPassage?tale.title+": "+a.title:tale.title;if(this.active.init&&!this.isEmpty&&this.activate(config.historyMode===History.Modes.Session?History.hasWindowState()?History.getWindowState().sidx:this.top:this.top),s&&(this.isEmpty||(config.disableHistoryTracking?this.pop():config.historyMode===History.Modes.Session&&History.getWindowState().sidx<this.top.sidx&&this.pop(this.top.sidx-History.getWindowState().sidx)),this.push({title:a.title,variables:clone(this.active.variables)}),this.prng&&(this.top.rcount=this.prng.count),this.activate(this.top)),(s||config.disableHistoryControls)&&config.historyMode!==History.Modes.Hash){var o;config.historyMode===History.Modes.Session?o={suid:this.suid,sidx:this.active.sidx}:(o={delta:this.getDeltaFromHistory()},this.hasOwnProperty("prng")&&(o.rseed=this.prng.seed)),History[!History.hasWindowState()||config.disableHistoryControls?"replaceWindowState":"addWindowState"](o,n)}if(config.historyMode!==History.Modes.Window&&this.save(),i&&(document.body.className&&(document.body.className=""),tale.has("PassageReady")))try{Wikifier.wikifyEval(tale.get("PassageReady").text)}catch(l){technicalAlert("PassageReady",l.message)}var c=a.render();if(c.style.visibility="visible",i){var u=document.getElementById("passages"),h=u.querySelector(".passage");null!==h&&("number"==typeof config.passageTransitionOut||"boolean"==typeof config.passageTransitionOut&&config.passageTransitionOut&&""!==config.transitionEndEventName)?(h.id="out-"+h.id,h.classList.add("transition-out"),"boolean"==typeof config.passageTransitionOut?$(h).on(config.transitionEndEventName,function(){this.parentNode&&this.parentNode.removeChild(this)}):setTimeout(function(){h.parentNode&&h.parentNode.removeChild(h)},config.passageTransitionOut)):removeChildren(u),c.classList.add("transition-in"),u.appendChild(c),setTimeout(function(){c.classList.remove("transition-in")},1),config.displayPassageTitles&&a.title!==config.startPassage&&(document.title=n),config.historyMode===History.Modes.Hash&&(window.location.hash=this.hash),window.scroll(0,0)}if(i){if(tale.has("PassageDone"))try{Wikifier.wikifyEval(tale.get("PassageDone").text)}catch(l){technicalAlert("PassageDone",l.message)}config.updatePageElements&&UISystem.setPageElements()}if("undefined"!=typeof config.saves.autosave)switch(typeof config.saves.autosave){case"boolean":config.saves.autosave&&SaveSystem.saveAuto();break;case"string":a.tags.contains(config.saves.autosave)&&SaveSystem.saveAuto();break;case"object":Array.isArray(config.saves.autosave)&&a.tags.some(function(e){return config.saves.autosave.contains(e)})&&SaveSystem.saveAuto()}return c},History.prototype.regenerateSuid=function(){this.suid=UUID.generate(),this.save()},History.prototype.restart=function(){config.historyMode!==History.Modes.Hash?(History.addWindowState(null,tale.title),window.location.reload()):window.location.hash=""},History.prototype.save=function(){var e={delta:this.getDeltaFromHistory()};this.hasOwnProperty("prng")&&(e.rseed=this.prng.seed),config.historyMode===History.Modes.Session?session.setItem("history."+this.suid,e):config.historyMode===History.Modes.Hash&&(this.hash=History.serializeWindowHashState(e))},History.prototype.restore=function(e){if(config.historyMode===History.Modes.Session){if(this.suid=e?e:History.hasWindowState()?History.getWindowState().suid:UUID.generate(),this.suid&&session.hasItem("history."+this.suid)){var t=session.getItem("history."+this.suid),r=History.getWindowState().sidx;if(this.setHistoryFromDelta(t.delta),this.hasOwnProperty("prng")&&t.hasOwnProperty("rseed")&&(this.prng.seed=t.rseed),tale.has(this.history[r].title))return this.display(this.history[r].title,null,"replace"),!0}}else if(config.historyMode===History.Modes.Window){if(History.hasWindowState()){var i=History.getWindowState();this.setHistoryFromDelta(i.delta),this.hasOwnProperty("prng")&&i.hasOwnProperty("rseed")&&(this.prng.seed=i.rseed)}if(!this.isEmpty&&tale.has(this.top.title))return this.display(this.top.title,null,"replace"),!0}else if(History.hasWindowHashState())return this.hash||History.hashChangeHandler(),!0;return!1},History.serializeWindowState=function(e){return LZString.compressToUTF16(JSON.stringify(e))},History.deserializeWindowState=function(e){return JSON.parse(LZString.decompressFromUTF16(e))},History.addWindowState=function(e,t,r){null!=r?window.history.pushState(null!=e?History.serializeWindowState(e):null,t,r):window.history.pushState(null!=e?History.serializeWindowState(e):null,t)},History.replaceWindowState=function(e,t,r){null!=r?window.history.replaceState(null!=e?History.serializeWindowState(e):null,t,r):window.history.replaceState(null!=e?History.serializeWindowState(e):null,t)},History.hasWindowState=function(e){return 0===arguments.length&&(e=window.history),null!=e.state},History.getWindowState=function(e){return 0===arguments.length&&(e=window.history),null!=e.state?History.deserializeWindowState(e.state):null},History.serializeWindowHashState=function(e){return"#"+LZString.compressToBase64(JSON.stringify(e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,".")},History.deserializeWindowHashState=function(e){return JSON.parse(LZString.decompressFromBase64(e.slice(1).replace(/\-/g,"+").replace(/_/g,"/").replace(/\./g,"=")))},History.hasWindowHashState=function(e){return 0===arguments.length&&(e=window.location.hash),""!==e&&"#"!==e},History.getWindowHashState=function(e){return 0===arguments.length&&(e=window.location.hash),""!==e&&"#"!==e?History.deserializeWindowHashState(e):null},History.popStateHandler_Session=function(e){if(History.hasWindowState(e)){UISystem.isOpen()&&UISystem.close();var t=History.getWindowState(e);t.suid!==state.suid&&(state.save(),state.restore(t.suid)),state.display(state.activate(t.sidx).title,null,"replace")}},History.popStateHandler_Window=function(e){if(History.hasWindowState(e)){UISystem.isOpen()&&UISystem.close();var t=History.getWindowState(e);if(!t.hasOwnProperty("delta")||0===t.delta.length)throw new Error("window state has no history or history is empty");state.setHistoryFromDelta(t.delta),state.hasOwnProperty("prng")&&t.hasOwnProperty("rseed")&&(state.prng.seed=t.rseed),state.display(state.activate(state.top).title,null,"replace")}},History.hashChangeHandler=function(){if(window.location.hash!==state.hash){if(History.hasWindowHashState()){UISystem.isOpen()&&UISystem.close();var e=History.getWindowHashState();if(!e.hasOwnProperty("delta")||0===e.delta.length)throw new Error("hash state has no history or history is empty");state.setHistoryFromDelta(e.delta),state.hasOwnProperty("prng")&&e.hasOwnProperty("rseed")&&(state.prng.seed=e.rseed),state.display(state.activate(state.top).title,null,"replace")}else window.location.reload();window.location.hash!==state.hash&&(state.hash=window.location.hash)}},History.initPRNG=function(e,t){runtime.flags.HistoryPRNG.isEnabled=!0,state.prng=new SeedablePRNG(e,t),state.active.rcount=state.prng.count,runtime.flags.HistoryPRNG.isMathPRNG||(runtime.flags.HistoryPRNG.isMathPRNG=!0,Math.random=function(){return state.prng.random()})},History.deltaEncodeHistory=function(e){if(!Array.isArray(e))return null;if(0===e.length)return[];for(var t=[clone(e[0])],r=1,i=e.length;i>r;r++)t.push(Util.diff(e[r-1],e[r]));return t},History.deltaDecodeHistory=function(e){if(!Array.isArray(e))return null;if(0===e.length)return[];for(var t=[clone(e[0])],r=1,i=e.length;i>r;r++)t.push(Util.patch(t[r-1],e[r]));return t},History.marshal=function(){var e={mode:config.historyMode};return state.hasOwnProperty("prng")&&(e.rseed=state.prng.seed),e.history=clone(config.historyMode===History.Modes.Session?state.history.slice(0,state.active.sidx+1):state.history),e},History.unmarshal=function(e){if(!e||!e.hasOwnProperty("mode")||!e.hasOwnProperty("history")&&!e.hasOwnProperty("delta"))throw new Error("state object is missing required data");if(e.mode!==config.historyMode)throw new Error("state object is from an incompatible history mode");if(document.title=tale.title,state=new History,runtime.flags.HistoryPRNG.isEnabled&&History.initPRNG(e.hasOwnProperty("rseed")?e.rseed:null),config.historyMode===History.Modes.Session&&state.regenerateSuid(),state.history=clone(e.history),config.historyMode!==History.Modes.Hash&&!config.disableHistoryControls)for(var t=0,r=state.history.length;r>t;t++){var i,s=config.displayPassageTitles&&state.history[t].title!==config.startPassage?tale.title+": "+state.history[t].title:tale.title;switch(config.historyMode){case History.Modes.Session:i={suid:state.suid,sidx:state.history[t].sidx};break;case History.Modes.Window:i={delta:state.getDeltaFromHistory(t+1)},state.hasOwnProperty("prng")&&(i.rseed=state.prng.seed)}History.addWindowState(i,s)}state.activate(state.top),state.display(state.active.title,null,"replace")},Passage.prototype.processText=function(){var e=this.text;return this.tags.contains("nobr")&&(e=e.replace(/\n/g," ")),this.tags.contains("Twine.image")&&(e="[img["+e+"]]"),e},Passage.prototype.render=function(){var e=insertElement(null,"section",this.domId,"passage");e.setAttribute("data-passage",this.title),e.style.visibility="hidden";for(var t=0,r=this.classes.length;r>t;t++)document.body.classList.add(this.classes[t]),e.classList.add(this.classes[t]);insertElement(e,"header",null,"header");var i=insertElement(e,"div",null,"body content");return insertElement(e,"footer",null,"footer"),Object.keys(prerender).forEach(function(e){"function"==typeof prerender[e]&&prerender[e].call(this,i,e)},this),new Wikifier(i,this.processText()),Object.keys(postrender).forEach(function(e){"function"==typeof postrender[e]&&postrender[e].call(this,i,e)},this),this.textExcerpt=Passage.getExcerptFromNode(i),e},Passage.prototype.reset=function(){for(var e=document.getElementById("store-area").childNodes,t=0,r=e.length;r>t;t++){var i,s=e[t];if(s.getAttribute&&(i=s.getAttribute("tiddler"))&&this.title===i)return void(this.text=Passage.unescapeLineBreaks(s.firstChild?s.firstChild.nodeValue:""))}this.text='<html><span class="error">Error: this passage does not exist</span></html>'},Passage.prototype.excerpt=function(){return this.textExcerpt},Passage.getExcerptFromText=function(e,t){var r=new RegExp("(\\S+(?:\\s+\\S+){0,"+("undefined"!=typeof t?t-1:7)+"})"),i=e.replace(/<<.*?>>/g," ").replace(/<.*?>/g," ").trim().replace(/^\s*\|.*\|.*?$/gm,"").replace(/\[[<>]?img\[[^\]]*\]\]/g,"").replace(/\[\[([^|\]]*)(?:|[^\]]*)?\]\]/g,"$1").replace(/^\s*!+(.*?)$/gm,"$1").replace(/\'{2}|\/{2}|_{2}|@{2}/g,"").replace(/\s+/g," ").trim().match(r);return i?i[1]+"…":"…"},Passage.getExcerptFromNode=function(e,t){function r(e){if(!e.hasChildNodes())return"";for(var t=e.childNodes,i="",s=0,a=t.length;a>s;s++)switch(t[s].nodeType){case 1:"none"!==t[s].style.display&&(i+=" ",t[s].hasChildNodes()&&(i+=r(t[s])));break;case 3:i+=t[s].textContent}return i}if(!e.hasChildNodes())return"";var i=new RegExp("(\\S+(?:\\s+\\S+){0,"+("undefined"!=typeof t?t-1:7)+"})"),s=r(e).trim();return s&&(s=s.replace(/\s+/g," ").match(i)),s?s[1]+"…":"…"},Passage.unescapeLineBreaks=function(e){return e&&""!==e?e.replace(/\\n/gm,"\n").replace(/\\t/gm," ").replace(/\\s|\\/gm,"\\").replace(/\r/gm,""):""},Passage.mergeClassNames=function(){if(0==arguments.length)return"";for(var e=[],t=0;t<arguments.length;t++)"object"==typeof arguments[t]&&Array.isArray(arguments[t])?e=e.concat(arguments[t]):"string"==typeof arguments[t]&&(e=e.concat(arguments[t].split(/\s+/)));return e.length>0?e.sort().filter(function(e,t,r){return 0===t||r[t-1]!==e}).join(" "):""},Tale.prototype.setTitle=function(e){this.title=document.title=e,this.domId=Util.slugify(e)},Tale.prototype.has=function(e){if("string"==typeof e)return null!=this.passages[e];if("number"==typeof e)for(var t=Object.keys(this.passages),r=0,i=t.length;i>r;r++)if(this.passages[t[r]].id===e)return!0;return!1},Tale.prototype.get=function(e){if("string"==typeof e)return this.passages[e]||new Passage(e);if("number"==typeof e)for(var t=Object.keys(this.passages),r=0,i=t.length;i>r;r++)if(this.passages[t[r]].id===e)return this.passages[t[r]]},Tale.prototype.lookup=function(e,t,r){r||(r="title");for(var i=Object.keys(this.passages),s=[],a=0,n=i.length;n>a;a++){var o=this.passages[i[a]];switch(typeof o[e]){case"undefined":break;case"object":for(var l=0,c=o[e].length;c>l;l++)if(o[e][l]==t){s.push(o);break}break;default:o[e]==t&&s.push(o)}}return s.sort(function(e,t){return e[r]==t[r]?0:e[r]<t[r]?-1:1}),s},Tale.prototype.reset=function(){Object.keys(this.passages).forEach(function(e){this.passages[e].reset()},this)};var _wikifierFormatterCache;Wikifier.prototype.subWikify=function(e,t,r){var i=this.output;this.output=e;var s,a,n=t?new RegExp("("+t+")",r?"gim":"gm"):null;do{if(this.formatter.formatterRegExp.lastIndex=this.nextMatch,n&&(n.lastIndex=this.nextMatch),s=this.formatter.formatterRegExp.exec(this.source),a=n?n.exec(this.source):null,a&&(!s||a.index<=s.index))return a.index>this.nextMatch&&this.outputText(this.output,this.nextMatch,a.index),this.matchStart=a.index,this.matchLength=a[1].length,this.matchText=a[1],this.nextMatch=a.index+a[1].length,void(this.output=i);if(s){s.index>this.nextMatch&&this.outputText(this.output,this.nextMatch,s.index),this.matchStart=s.index,this.matchLength=s[0].length,this.matchText=s[0],this.nextMatch=this.formatter.formatterRegExp.lastIndex;for(var o=-1,l=1;l<s.length;l++)if(s[l]){o=l-1;break}if(-1!==o&&(this.formatter.formatters[o].handler(this),null!=runtime.temp.break))break}}while(a||s);null==runtime.temp.break?this.nextMatch<this.source.length&&(this.outputText(this.output,this.nextMatch,this.source.length),this.nextMatch=this.source.length):this.output.lastChild&&1===this.output.lastChild.nodeType&&"BR"===this.output.lastChild.nodeName.toUpperCase()&&removeElement(this.output.lastChild),this.output=i},Wikifier.prototype.outputText=function(e,t,r){insertText(e,this.source.substring(t,r))},Wikifier.prototype.rawArgs=function(){return this._rawArgs},Wikifier.prototype.fullArgs=function(){return Wikifier.parse(this.rawArgs())},Wikifier.compileFormatters=function(){for(var e=Wikifier.formatters,t=[],r=0,i=e.length;i>r;r++)t.push("("+e[r].match+")");return _wikifierFormatterCache={formatters:e,formatterRegExp:new RegExp(t.join("|"),"gm")}},Wikifier.parse=function(e){for(var t,r=new RegExp("(?:(?:\"((?:(?:\\\\\")|[^\"])+)\")|(?:'((?:(?:\\\\')|[^'])+)')|((?:\"\")|(?:''))|([=+\\-*\\/%<>&\\|\\^~!?:,;\\(\\)\\[\\]{}]+)|([^\"'=+\\-*\\/%<>&\\|\\^~!?:,;\\(\\)\\[\\]{}\\s]+))","g"),i={$:"state.active.variables.",eq:"==",neq:"!=",gt:">",gte:">=",lt:"<",lte:"<=",and:"&&",or:"||",not:"!",is:"===",isnot:"!==","is not":"!==",to:"=",def:'"undefined" !== typeof',ndef:'"undefined" === typeof'};null!==(t=r.exec(e));)if(t[5]){var s=t[5];if("$"===s)continue;if("$"===s[0])s="$";else if("is"===s){var a=t.index+s.length,n=e.slice(a);/^\s+not\b/.test(n)&&(e=e.splice(a,n.search(/\S/)," "),s="is not")}i.hasOwnProperty(s)&&(e=e.splice(t.index,s.length,i[s]),r.lastIndex+=i[s].length-s.length)}return e},Wikifier.getValue=function(e){var t=Wikifier.parseStoryVariable(e),r=undefined;if(0!==t.length){r=state.active.variables;for(var i=0,s=t.length;s>i;i++){if("undefined"==typeof r[t[i]]){r=undefined;break}r=r[t[i]]}}return r},Wikifier.setValue=function(e,t){var r=Wikifier.parseStoryVariable(e);if(0!==r.length){for(var i=state.active.variables,s=r.pop(),a=0,n=r.length;n>a;a++){if("undefined"==typeof i[r[a]]){i=undefined;break}i=i[r[a]]}if(i!==undefined)return i[s]=t,!0}return!1},Wikifier.parseStoryVariable=function(e){for(var t,r=/^(?:\$(\w+)|\.(\w+)|\[(?:(?:\"((?:\\.|[^\"\\])+)\")|(?:\'((?:\\.|[^\'\\])+)\')|(\$\w.*)|(\d+))\])/,i=[];null!==(t=r.exec(e));)e=e.slice(t[0].length),t[1]?i.push(t[1]):t[2]?i.push(t[2]):t[3]?i.push(t[3]):t[4]?i.push(t[4]):t[5]?i.push(Wikifier.getValue(t[5])):t[6]&&i.push(Number(t[6]));return""===e?i:[]},Wikifier.evalExpression=function(e){return Util.evalExpression(Wikifier.parse(e))},Wikifier.evalStatements=function(e){return Util.evalStatements(Wikifier.parse(e))},Wikifier.wikifyEval=function(e){var t=document.createDocumentFragment();try{for(new Wikifier(t,e);t.hasChildNodes();){var r=t.firstChild;if(r.classList&&r.classList.contains("error"))throw new Error(r.textContent);t.removeChild(r)}}catch(i){throw new Error(i.message.replace(/^Error:\s+/,""))}finally{removeChildren(t)}},Wikifier.createInternalLink=function(e,t,r,i){var s=document.createElement("a");return null!=t&&(s.setAttribute("data-passage",t),tale.has(t)?(s.classList.add("link-internal"),config.addVisitedLinkClass&&state.has(t)&&s.classList.add("link-visited")):s.classList.add("link-broken"),$(s).click(function(){"function"==typeof i&&i(),state.display(t,s)})),r&&insertText(s,r),e&&e.appendChild(s),s},Wikifier.createExternalLink=function(e,t,r){var i=insertElement(e,"a",null,"link-external",r);return i.target="_blank",null!=t&&(i.href=t),i},Wikifier.textPrimitives=new RegExp("[ŐŰ]","g").test("Ő")?{anyLetter:"[A-Za-z0-9_\\-À-Þß-ÿŐŰőű]"}:{anyLetter:"[A-Za-z0-9_\\-À-Þß-ÿ]"},Wikifier.textPrimitives.emptyQuotes="((?:\"\")|(?:''))",Wikifier.textPrimitives.doubleQuoted='("(?:(?:\\\\")|[^"])+")',Wikifier.textPrimitives.singleQuoted="('(?:(?:\\\\')|[^'])+')",Wikifier.textPrimitives.doubleBracketed="(?:(\\[\\[(?:\\s|\\S)*?\\]\\]))",Wikifier.textPrimitives.barewords="([^\"'`\\s]\\S*)",Wikifier.textPrimitives.url="(?:file|https?|mailto|ftp|javascript|irc|news|data):[^\\s'\"]+(?:/|\\b)",Wikifier.textPrimitives.link="\\[\\[\\s*(?:(.+?)\\s*\\|\\s*)?(~)?(.+?)\\s*\\](?:\\[\\s*(.+?)\\s*\\])?\\]",Wikifier.textPrimitives.image="\\[([<]?)([>]?)[Ii][Mm][Gg]\\[\\s*(?:(.+?)\\s*\\|\\s*)?([^\\|]+?)\\s*\\](?:\\[\\s*(~)?(.+?)\\s*\\])?(?:\\[\\s*(.+?)\\s*\\])?\\]",Wikifier.textPrimitives.macroArg="(?:"+[Wikifier.textPrimitives.doubleQuoted,Wikifier.textPrimitives.singleQuoted,Wikifier.textPrimitives.emptyQuotes,Wikifier.textPrimitives.doubleBracketed,Wikifier.textPrimitives.barewords].join("|")+")",Wikifier.formatterHelpers={charFormatHelper:function(e){var t=insertElement(e.output,this.element);e.subWikify(t,this.terminator)},inlineCssHelper:function(e){var t=[],r="(?:("+Wikifier.textPrimitives.anyLetter+"+)\\(([^\\)\\|\\n]+)(?:\\):))|(?:("+Wikifier.textPrimitives.anyLetter+"+):([^;\\|\\n]+);)",i=new RegExp(r,"gm");do{i.lastIndex=e.nextMatch;var s=i.exec(e.source),a=s&&s.index==e.nextMatch;if(a){var n,o;switch(s[1]?(n=this.cssToDOMPropertyName(s[1]),o=s[2]):(n=this.cssToDOMPropertyName(s[3]),o=s[4]),n){case"bgcolor":n="backgroundColor";break;case"float":n="cssFloat"}t.push({style:n,value:o}),e.nextMatch=s.index+s[0].length}}while(a);return t},monospacedByLineHelper:function(e){var t=new RegExp(this.lookahead,"gm");t.lastIndex=e.matchStart;var r=t.exec(e.source);r&&r.index===e.matchStart&&(insertElement(e.output,"pre",null,null,r[1]),e.nextMatch=r.index+r[0].length)},cssToDOMPropertyName:function(e){var t=e.split("-");if(t.length>1)for(var r=1;r<t.length;r++)t[r]=t[r].substr(0,1).toUpperCase()+t[r].substr(1);return t.join("")},isExternalLink:function(e){if(tale.has(e))return!1;var t=new RegExp("^"+Wikifier.textPrimitives.url,"gim");return t.test(e)||/[\.\/\\#]/.test(e)?!0:!1},evalExpressionBadResultRegExp:/\[(?:object(?:\s+[^\]]+)?|native\s+code)\]/,evalExpression:function(e){var t;try{t=Wikifier.evalExpression(e),this.evalExpressionBadResultRegExp.test(t)&&(t=e)}catch(r){t=e}return t},evalPassageId:function(e){return null==e||tale.has(e)||(e=this.evalExpression(e)),e}},Wikifier.formatters=[{name:"table",match:"^\\|(?:[^\\n]*)\\|(?:[fhck]?)$",lookahead:"^\\|([^\\n]*)\\|([fhck]?)$",rowTerminator:"\\|(?:[fhck]?)$\\n?",cellPattern:"(?:\\|([^\\n\\|]*)\\|)|(\\|[fhck]?$\\n?)",cellTerminator:"(?:\\x20*)\\|",rowTypes:{c:"caption",h:"thead","":"tbody",f:"tfoot"},handler:function(e){var t,r,i,s=insertElement(e.output,"table"),a=new RegExp(this.lookahead,"gm"),n=null,o=[],l=0;e.nextMatch=e.matchStart;do{a.lastIndex=e.nextMatch;var c=a.exec(e.source),u=c&&c.index===e.nextMatch;u&&(t=c[2],"k"===t?(s.className=c[1],e.nextMatch+=c[0].length+1):(t!==n&&(r=insertElement(s,this.rowTypes[t])),n=t,"c"===n?(0===l?r.setAttribute("align","top"):r.setAttribute("align","bottom"),e.nextMatch=e.nextMatch+1,e.subWikify(r,this.rowTerminator)):(i=insertElement(r,"tr"),this.rowHandler(e,i,o)),l++))}while(u)},rowHandler:function(e,t,r){var i=0,s=1,a=new RegExp(this.cellPattern,"gm");do{a.lastIndex=e.nextMatch;var n=a.exec(e.source),o=n&&n.index===e.nextMatch;if(o){if("~"===n[1]){var l=r[i];l&&(l.rowCount++,l.element.setAttribute("rowSpan",l.rowCount),l.element.setAttribute("rowspan",l.rowCount),l.element.valign="center"),e.nextMatch=n.index+n[0].length-1}else if(">"===n[1])s++,e.nextMatch=n.index+n[0].length-1;else{if(n[2]){e.nextMatch=n.index+n[0].length;break}var c,u=!1,h=!1;e.nextMatch++;for(var d=Wikifier.formatterHelpers.inlineCssHelper(e);" "===e.source.substr(e.nextMatch,1);)u=!0,e.nextMatch++;"!"===e.source.substr(e.nextMatch,1)?(c=insertElement(t,"th"),e.nextMatch++):c=insertElement(t,"td"),r[i]={rowCount:1,element:c};s>1&&(c.setAttribute("colSpan",s),c.setAttribute("colspan",s),s=1);for(var p=0;p<d.length;p++)c.style[d[p].style]=d[p].value;e.subWikify(c,this.cellTerminator)," "===e.matchText.substr(e.matchText.length-2,1)&&(h=!0),u&&h?c.align="center":u?c.align="right":h&&(c.align="left"),e.nextMatch=e.nextMatch-1}i++}}while(o)}},{name:"heading",match:"^!{1,6}",terminator:"\\n",handler:function(e){e.subWikify(insertElement(e.output,"h"+e.matchLength),this.terminator)}},{name:"list",match:"^(?:(?:\\*+)|(?:#+))",lookahead:"^(?:(\\*+)|(#+))",terminator:"\\n",outerElement:"ul",itemElement:"li",handler:function(e){var t=new RegExp(this.lookahead,"gm");e.nextMatch=e.matchStart;var r,i,s,a=[e.output],n=null,o=0;do{t.lastIndex=e.nextMatch;var l=t.exec(e.source),c=l&&l.index==e.nextMatch;if(c){if(r=l[2]?"ol":"ul",i=l[0].length,e.nextMatch+=l[0].length,i>o)for(s=o;i>s;s++)a.push(insertElement(a[a.length-1],r));else if(o>i)for(s=o;s>i;s--)a.pop();else i==o&&r!=n&&(a.pop(),a.push(insertElement(a[a.length-1],r)));o=i,n=r;var u=insertElement(a[a.length-1],"li");e.subWikify(u,this.terminator)}}while(c)}},{name:"quoteByBlock",match:"^<<<\\n",terminator:"^<<<\\n",handler:function(e){var t=insertElement(e.output,"blockquote");e.subWikify(t,this.terminator)}},{name:"quoteByLine",match:"^>+",terminator:"\\n",element:"blockquote",handler:function(e){var t,r=new RegExp(this.match,"gm"),i=[e.output],s=0,a=e.matchLength;do{if(a>s)for(t=s;a>t;t++)i.push(insertElement(i[i.length-1],this.element));else if(s>a)for(t=s;t>a;t--)i.pop();s=a,e.subWikify(i[i.length-1],this.terminator),insertElement(i[i.length-1],"br"),r.lastIndex=e.nextMatch;var n=r.exec(e.source),o=n&&n.index==e.nextMatch;o&&(a=n[0].length,e.nextMatch+=n[0].length)}while(o)}},{name:"rule",match:"^----+$\\n?|<hr ?/?>\\n?",handler:function(e){insertElement(e.output,"hr")}},{name:"monospacedByLine",match:"^\\{\\{\\{\\n",lookahead:"^\\{\\{\\{\\n((?:^[^\\n]*\\n)+?)(^\\}\\}\\}$\\n?)",handler:Wikifier.formatterHelpers.monospacedByLineHelper},{name:"prettyLink",match:"\\[\\[",lookaheadRegExp:/(\[\[(?:\s|\S)*?\]\])/gm,handler:function(e){this.lookaheadRegExp.lastIndex=e.matchStart;var t=this.lookaheadRegExp.exec(e.source);if(t&&t.index===e.matchStart){var r=new RegExp("^"+Wikifier.textPrimitives.link+"$"),i=r.exec(t[0]);if(null!==i){e.nextMatch=t.index+t[0].length;var s=Wikifier.formatterHelpers.evalPassageId(i[3]),a=i[1]?Wikifier.formatterHelpers.evalExpression(i[1]):s,n=i[4]?function(e){return function(){Wikifier.evalStatements(e)}}(Wikifier.parse(i[4])):null;!i[2]&&Wikifier.formatterHelpers.isExternalLink(s)?Wikifier.createExternalLink(e.output,s,a):Wikifier.createInternalLink(e.output,s,a,n)}}}},{name:"urlLink",match:Wikifier.textPrimitives.url,handler:function(e){var t=Wikifier.createExternalLink(e.output,e.matchText);e.outputText(t,e.matchStart,e.nextMatch)}},Wikifier.imageFormatter={name:"image",match:"\\[[<>]?[Ii][Mm][Gg]\\[",lookaheadRegExp:/(\[[<>]?[Ii][Mm][Gg]\[(?:\s|\S)*?\]\])/gm,handler:function(e){this.lookaheadRegExp.lastIndex=e.matchStart;var t=this.lookaheadRegExp.exec(e.source);if(t&&t.index===e.matchStart){var r=new RegExp("^"+Wikifier.textPrimitives.image+"$"),i=r.exec(t[0]);if(null!==i){e.nextMatch=t.index+t[0].length;var s,a=e.output,n=i[7]?function(e){return function(){Wikifier.evalStatements(e)}}(Wikifier.parse(i[7])):null;if(i[6]){var o=Wikifier.formatterHelpers.evalPassageId(i[6]);a=!i[5]&&Wikifier.formatterHelpers.isExternalLink(o)?Wikifier.createExternalLink(a,o):Wikifier.createInternalLink(a,o,null,n),a.classList.add("link-image")}if(a=insertElement(a,"img"),s=Wikifier.formatterHelpers.evalPassageId(i[4]),"data:"!==s.slice(0,5)&&tale.has(s)){var l=tale.get(s);l.tags.contains("Twine.image")&&(a.setAttribute("data-passage",l.title),s=l.text)}a.src=s,i[3]&&(a.title=Wikifier.formatterHelpers.evalExpression(i[3])),i[1]?a.align="left":i[2]&&(a.align="right")}}}},{name:"macro",match:"<<",lookaheadRegExp:/<<([^>\s]+)(?:\s*)((?:(?:\"(?:\\.|[^\"\\])*\")|(?:\'(?:\\.|[^\'\\])*\')|[^>]|(?:>(?!>)))*)>>/gm,working:{name:"",handler:"",arguments:"",index:0},context:null,handler:function(e){var t=this.lookaheadRegExp.lastIndex=e.matchStart;if(this.parseTag(e)){var r=e.nextMatch,i=this.working.name,s=this.working.handler,a=this.working.arguments;try{var n=macros.get(i);if(!n)return macros.tags.hasOwnProperty(i)?throwError(e.output,"child tag <<"+i+">> was found outside of a call to its parent macro"+(1===macros.tags[i].length?"":"s")+" <<"+macros.tags[i].join(">>, <<")+">>",e.source.slice(t,e.nextMatch)):throwError(e.output,"macro <<"+i+">> does not exist",e.source.slice(t,e.nextMatch));var o=null;if(n.hasOwnProperty("tags")&&(o=this.parseBody(e,n.tags),!o))return e.nextMatch=r,throwError(e.output,"cannot find a closing tag for macro <<"+i+">>",e.source.slice(t,e.nextMatch)+"…");if("function"!=typeof n[s])return throwError(e.output,"macro <<"+i+'>> handler function "'+s+'" '+(n.hasOwnProperty(s)?"is not a function":"does not exist"),e.source.slice(t,e.nextMatch));var l=n.hasOwnProperty("skipArgs")&&n.skipArgs?[]:this.parseArgs(a);if(n.hasOwnProperty("_USE_MACROS_API"))try{this.context=new MacrosContext(this.context,n,i,a,l,o,e,e.source.slice(t,e.nextMatch)),n[s].call(this.context)}finally{this.context=this.context.parent}else{var c=e._rawArgs;e._rawArgs=a,n[s](e.output,i,l,e,o),e._rawArgs=c}}catch(u){return throwError(e.output,"cannot execute "+(n&&n.isWidget?"widget":"macro")+" <<"+i+">>: "+u.message,e.source.slice(t,e.nextMatch))}finally{this.working.name="",this.working.handler="",this.working.arguments="",this.working.index=0}}},parseTag:function(e){var t=this.lookaheadRegExp.exec(e.source);if(t&&t.index===e.matchStart&&t[1]){e.nextMatch=t.index+t[0].length,this.lookaheadRegExp.lastIndex=e.nextMatch;var r=t[1].indexOf("::");return-1!==r?(this.working.name=t[1].slice(0,r),this.working.handler=t[1].slice(r+2)):(this.working.name=t[1],this.working.handler="handler"),this.working.arguments=t[2],this.working.index=t.index,!0}return!1},parseBody:function(e,t){for(var r=this.working.name,i="/"+r,s="end"+r,a=Array.isArray(t)?t:!1,n=-1,o=1,l=this.working.name,c=this.working.arguments,u=e.nextMatch,h=[];-1!==(e.matchStart=e.source.indexOf("<<",e.nextMatch))&&this.parseTag(e);){var d=this.working.name,p=this.working.arguments,f=this.working.index,g=e.nextMatch;switch(d){case r:o++;break;case s:case i:o--;break;default:if(1===o&&a)for(var m=0,y=a.length;y>m;m++)d===a[m]&&(h.push({name:l,arguments:c,contents:e.source.slice(u,f)}),l=d,c=p,u=g)}if(0===o){h.push({name:l,arguments:c,contents:e.source.slice(u,f)}),n=g;break}}return-1!==n?(e.nextMatch=n,h):null},parseArgs:function(e){for(var t,r=new RegExp(Wikifier.textPrimitives.macroArg,"gm"),i=[];null!==(t=r.exec(e));){var s;if(t[1]){s=t[1];try{s=Util.evalExpression(s)}catch(a){throw new Error("unable to parse macro argument '"+s+"': "+a.message)}}else if(t[2]){s=t[2];try{s=Util.evalExpression(s)}catch(a){throw new Error('unable to parse macro argument "'+s+'": '+a.message)}}else if(t[3])s="";else if(t[4]){s=t[4];var n=new RegExp(Wikifier.textPrimitives.link),o=n.exec(s),l={};
null!==o&&(l.count=o[1]?2:1,l.link=Wikifier.formatterHelpers.evalPassageId(o[3]),l.text=o[1]?Wikifier.formatterHelpers.evalExpression(o[1]):l.link,l.isExternal=!o[2]&&Wikifier.formatterHelpers.isExternalLink(l.link),l.setFn=o[4]?function(e){return function(){Wikifier.evalStatements(e)}}(Wikifier.parse(o[4])):null,s=l)}else if(t[5])if(s=t[5],/^\$\w+/.test(s))s=Wikifier.getValue(s);else if(/^(?:options|setup)[\.\[]/.test(s))try{s=Wikifier.evalExpression(s)}catch(a){throw new Error('unable to parse macro argument "'+s+'": '+a.message)}else if(/^(?:\{.*\}|\[.*\])$/.test(s))try{s=Wikifier.evalExpression(s)}catch(a){throw new Error('unable to parse macro argument "'+s+'": '+a.message)}else"null"===s?s=null:"undefined"===s?s=undefined:"true"===s?s=!0:"false"===s?s=!1:!isNaN(parseFloat(s))&&isFinite(s)&&(s=Number(s));i.push(s)}return i}},{name:"html",match:"<[Hh][Tt][Mm][Ll]>",lookaheadRegExp:/<[Hh][Tt][Mm][Ll]>((?:.|\n)*?)<\/[Hh][Tt][Mm][Ll]>/gm,handler:function(e){this.lookaheadRegExp.lastIndex=e.matchStart;var t=this.lookaheadRegExp.exec(e.source);if(t&&t.index===e.matchStart){e.nextMatch=t.index+t[0].length;var r=document.createDocumentFragment(),i=document.createElement("div");for(i.innerHTML=t[1];i.firstChild;)r.appendChild(i.firstChild);e.output.appendChild(r)}}},{name:"commentByBlock",match:"/(?:%|\\*)",lookaheadRegExp:/\/(%|\*)((?:.|\n)*?)\1\//gm,handler:function(e){this.lookaheadRegExp.lastIndex=e.matchStart;var t=this.lookaheadRegExp.exec(e.source);t&&t.index===e.matchStart&&(e.nextMatch=t.index+t[0].length)}},{name:"htmlCommentByBlock",match:"<!--",lookaheadRegExp:/<!--((?:.|\\n)*?)-->/gm,handler:function(e){this.lookaheadRegExp.lastIndex=e.matchStart;var t=this.lookaheadRegExp.exec(e.source);t&&t.index===e.matchStart&&(e.output.appendChild(document.createComment(t[1])),e.nextMatch=t.index+t[0].length)}},{name:"boldByChar",match:"''",terminator:"''",element:"strong",handler:Wikifier.formatterHelpers.charFormatHelper},{name:"strikeByChar",match:"==",terminator:"==",element:"strike",handler:Wikifier.formatterHelpers.charFormatHelper},{name:"underlineByChar",match:"__",terminator:"__",element:"u",handler:Wikifier.formatterHelpers.charFormatHelper},{name:"italicByChar",match:"//",terminator:"//",element:"em",handler:Wikifier.formatterHelpers.charFormatHelper},{name:"subscriptByChar",match:"~~",terminator:"~~",element:"sub",handler:Wikifier.formatterHelpers.charFormatHelper},{name:"superscriptByChar",match:"\\^\\^",terminator:"\\^\\^",element:"sup",handler:Wikifier.formatterHelpers.charFormatHelper},{name:"monospacedByChar",match:"\\{\\{\\{",lookahead:"\\{\\{\\{((?:.|\\n)*?)\\}\\}\\}",handler:function(e){var t=new RegExp(this.lookahead,"gm");t.lastIndex=e.matchStart;var r=t.exec(e.source);r&&r.index===e.matchStart&&(insertElement(e.output,"code",null,null,r[1]),e.nextMatch=r.index+r[0].length)}},{name:"styleByChar",match:"@@",terminator:"@@",lookahead:"(?:([^\\(@]+)\\(([^\\)]+)(?:\\):))|(?:([^:@]+):([^;]+);)",handler:function(e){var t=insertElement(e.output,"span",null,null,null),r=Wikifier.formatterHelpers.inlineCssHelper(e);if(0==r.length)t.className="marked";else for(var i=0;i<r.length;i++)t.style[r[i].style]=r[i].value;e.subWikify(t,this.terminator)}},{name:"emdash",match:"--",handler:function(e){insertText(e.output,"—")}},{name:"lineContinuation",match:"\\\\[\\s\\u00a0\\u2028\\u2029]*?(?:\\n|$)",handler:function(e){e.nextMatch=e.matchStart+e.matchLength}},{name:"lineBreak",match:"\\n|<br ?/?>",handler:function(e){0!==e._nobr.length&&e._nobr[0]||insertElement(e.output,"br")}},{name:"rawText",match:'"{3}|<nowiki>',lookaheadRegExp:/(?:\"{3}|<nowiki>)((?:.|\n)*?)(?:\"{3}|<\/nowiki>)/gm,handler:function(e){this.lookaheadRegExp.lastIndex=e.matchStart;var t=this.lookaheadRegExp.exec(e.source);t&&t.index===e.matchStart&&(insertElement(e.output,"span",null,null,t[1]),e.nextMatch=this.lookaheadRegExp.lastIndex)}},{name:"htmlCharacterReference",match:"(?:(?:&#?[a-zA-Z0-9]{2,8};|.)(?:&#?(?:x0*(?:3[0-6][0-9a-fA-F]|1D[c-fC-F][0-9a-fA-F]|20[d-fD-F][0-9a-fA-F]|FE2[0-9a-fA-F])|0*(?:76[89]|7[7-9][0-9]|8[0-7][0-9]|761[6-9]|76[2-7][0-9]|84[0-3][0-9]|844[0-7]|6505[6-9]|6506[0-9]|6507[0-1]));)+|&#?[a-zA-Z0-9]{2,8};)",handler:function(e){var t=document.createElement("div");t.innerHTML=e.matchText,insertText(e.output,t.textContent)}},{name:"htmlTag",match:"<\\w+(?:\\s+[^\\u0000-\\u001F\\u007F-\\u009F\\s\"'>\\/=]+(?:\\s*=\\s*(?:\"[^\"]*?\"|'[^']*?'|[^\\s\"'=<>`]+))?)*\\s*\\/?>",tagPattern:"<(\\w+)",voidElements:["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"],nobrElements:["colgroup","datalist","dl","figure","ol","optgroup","select","table","tbody","tfoot","thead","tr","ul"],handler:function(e){var t=new RegExp(this.tagPattern).exec(e.matchText),r=t&&t[1],i=r&&r.toLowerCase();if(i){var s,a,n,o=this.voidElements.contains(i),l=this.nobrElements.contains(i);if(o||(s="<\\/"+i+"\\s*>",a=new RegExp(s,"gim"),a.lastIndex=e.matchStart,n=a.exec(e.source)),o||n){var c=document.createElement(e.output.tagName);for(c.innerHTML=e.matchText;c.firstChild;)c=c.firstChild;if(c.hasAttribute("data-passage")&&this.processDataAttributes(c),n){l?e._nobr.unshift(!0):0!==e._nobr.length&&e._nobr.unshift(!1);try{e.subWikify(c,s,!0)}finally{0!==e._nobr.length&&e._nobr.shift()}}e.output.appendChild(c)}else throwError(e.output,'HTML tag "'+r+'" is not closed',e.matchText+"…")}},processDataAttributes:function(e){var t=e.getAttribute("data-passage");if(null!=t&&(t=("string"!=typeof t?String(t):t).trim(),/^\$\w+/.test(t)&&(t=Wikifier.getValue(t),e.setAttribute("data-passage",t)),""!==t))if("IMG"===e.tagName.toUpperCase()){var r;tale.has(t)&&(t=tale.get(t),t.tags.contains("Twine.image")&&(r=t.text)),e.src=r}else{var i,s=e.getAttribute("data-setter");null!=s&&(s=("string"!=typeof s?String(s):s).trim(),""!==s&&(i=function(e){return function(){Wikifier.evalStatements(e)}}(Wikifier.parse(s)))),tale.has(t)?(e.classList.add("link-internal"),config.addVisitedLinkClass&&state.has(t)&&e.classList.add("link-visited")):e.classList.add("link-broken"),$(e).click(function(){"function"==typeof i&&i(),state.display(t,e)})}}}],Object.defineProperties(Macros.prototype,{add:{value:function(e,t,r){if(Array.isArray(e))return void e.forEach(function(e){this.add(e,t,r)},this);if(this.has(e))throw new Error("cannot clobber existing macro <<"+e+">>");if(this.tags.hasOwnProperty(e))throw new Error("cannot clobber child tag <<"+e+">> of parent macro"+(1===this.tags[e].length?"":"s")+" <<"+this.tags[e].join(">>, <<")+">>");try{if("object"==typeof t)this.definitions[e]=r?clone(t):t;else{if(!this.has(t))throw new Error("cannot create alias of nonexistent macro <<"+t+">>");this.definitions[e]=r?clone(this.definitions[t]):this.definitions[t]}Object.defineProperty(this.definitions,e,{writable:!1}),this.definitions[e]._USE_MACROS_API=!0}catch(i){throw new Error("TypeError"===i.name?"cannot clobber protected macro <<"+e+">>":"unknown error when attempting to add macro <<"+e+">>: ["+i.name+"] "+i.message)}if(this.definitions[e].hasOwnProperty("tags"))if(null==this.definitions[e].tags)this.registerTags(e);else{if(!Array.isArray(this.definitions[e].tags))throw new Error('bad value for "tags" property of macro <<'+e+">>");this.registerTags(e,this.definitions[e].tags)}}},remove:{value:function(e){if(Array.isArray(e))return void e.forEach(function(e){this.remove(e)},this);if(this.definitions.hasOwnProperty(e)){this.definitions[e].hasOwnProperty("tags")&&this.unregisterTags(e);try{Object.defineProperty(this.definitions,e,{writable:!0}),delete this.definitions[e]}catch(t){throw new Error("unknown error removing macro <<"+e+">>: "+t.message)}}else if(this.tags.hasOwnProperty(e))throw new Error("cannot remove child tag <<"+e+">> of parent macro <<"+this.tags[e]+">>")}},has:{value:function(e,t){return this.definitions.hasOwnProperty(e)||(t?this.tags.hasOwnProperty(e):!1)}},get:{value:function(e){var t=null;return this.definitions.hasOwnProperty(e)&&"function"==typeof this.definitions[e].handler?t=this.definitions[e]:this.hasOwnProperty(e)&&"function"==typeof this[e].handler&&(t=this[e]),t}},getHandler:{value:function(e,t){var r=this.get(e);return t||(t="handler"),r&&r.hasOwnProperty(t)&&"function"==typeof r[t]?r[t]:null}},evalStatements:{value:function(statements,thisp){try{return eval(null==thisp?'var output = document.createElement("div");(function(){'+statements+"\n}());":"var output = thisp.output;(function(){"+statements+"\n}.call(thisp));"),!0}catch(e){if(null==thisp)throw e;return thisp.error("bad evaluation: "+e.message)}}},registerTags:{value:function(e,t){if(!e)throw new Error("no parent specified");Array.isArray(t)||(t=[]);for(var r=["/"+e,"end"+e],i=[].concat(r,t),s=0;s<i.length;s++){var a=i[s];if(this.definitions.hasOwnProperty(a))throw new Error("cannot register tag for an existing macro");this.tags.hasOwnProperty(a)?this.tags[a].contains(e)||(this.tags[a].push(e),this.tags[a].sort()):this.tags[a]=[e]}}},unregisterTags:{value:function(e){if(!e)throw new Error("no parent specified");Object.keys(this.tags).forEach(function(t){var r=this.tags[t].indexOf(e);-1!==r&&(1===this.tags[t].length?delete this.tags[t]:this.tags[t].splice(r,1))},this)}},init:{value:function(){Object.keys(this.definitions).forEach(function(e){var t=this.getHandler(e,"init");t&&t.call(this.definitions[e],e)},this),Object.keys(this).forEach(function(e){var t=this.getHandler(e,"init");t&&t.call(this[e],e)},this)}},lateInit:{value:function(){Object.keys(this.definitions).forEach(function(e){var t=this.getHandler(e,"lateInit");t&&t.call(this.definitions[e],e)},this),Object.keys(this).forEach(function(e){var t=this.getHandler(e,"lateInit");t&&t.call(this[e],e)},this)}}}),Object.defineProperties(MacrosContext.prototype,{contextHas:{value:function(e){for(var t=this;null!==(t=t.parent);)if(e(t))return!0;return!1}},contextSelect:{value:function(e){for(var t=this,r=[];null!==(t=t.parent);)e(t)&&r.push(t);return r}},error:{value:function(e){return throwError(this.output,"<<"+this.name+">>: "+e,this.source)}}}),window.onerror=function(e,t,r,i,s){technicalAlert(null,e,s)},window.SugarCube={};var version=Object.freeze({title:"SugarCube",major:1,minor:0,patch:3,prerelease:null,build:3868,date:new Date("2014-09-29T23:42:39.054Z"),extensions:{},toString:function(){return this.major+"."+this.minor+"."+this.patch+(this.prerelease?"-"+this.prerelease:"")+"+"+this.build},short:function(){return this.title+" (v"+this.major+"."+this.minor+"."+this.patch+(this.prerelease?"-"+this.prerelease:"")+")"},long:function(){return this.title+" v"+this.toString()+" ("+this.date.toUTCString()+")"}}),HistoryMode=Object.freeze({Hash:History.Modes.Hash,Window:History.Modes.Window,Session:History.Modes.Session}),modes=Object.freeze({hashTag:History.Modes.Hash,windowHistory:History.Modes.Window,sessionHistory:History.Modes.Session}),runtime=Object.defineProperties({},{flags:{value:{HistoryPRNG:{isEnabled:!1,isMathPRNG:!1}}},temp:{writable:!0,value:{}}}),has={defineProperty:"function"==typeof Object.defineProperty,getOwnPropertyDescriptor:"function"==typeof Object.getOwnPropertyDescriptor,pushState:"history"in window&&"pushState"in window.history&&"state"in window.history,localStorage:"localStorage"in window&&function(e){try{if(null!=e&&e.length>=0){var t="SugarCube/WLS/Test";return e.setItem(t,"42"),"42"!==e.getItem(t)?!1:(e.removeItem(t),!0)}return!1}catch(r){return!1}}(window.localStorage),sessionStorage:"sessionStorage"in window&&function(e){try{if(null!=e&&e.length>=0){var t="SugarCube/WSS/Test";return e.setItem(t,"42"),"42"!==e.getItem(t)?!1:(e.removeItem(t),!0)}return!1}catch(r){return!1}}(window.sessionStorage),fileAPI:"File"in window&&"FileList"in window&&"FileReader"in window},browser={userAgent:navigator.userAgent.toLowerCase()};browser.isGecko=navigator&&"Gecko"===navigator.product&&!/webkit|trident/.test(browser.userAgent),browser.isIE=/msie|trident/.test(browser.userAgent)&&!browser.userAgent.contains("opera"),browser.ieVersion=function(){var e=/(?:msie\s+|rv:)(\d{1,2}\.\d)/.exec(browser.userAgent);return e?+e[1]:0}(),browser.isOpera=browser.userAgent.contains("opera")||browser.userAgent.contains(" opr/"),browser.operaVersion=function(){var e=new RegExp((/applewebkit|chrome/.test(browser.userAgent)?"opr":"version")+"\\/(\\d{1,2}\\.\\d+)"),t=e.exec(browser.userAgent);return t?+t[1]:0}(),browser.isMobile={any:function(){return browser.isMobile.Android||browser.isMobile.BlackBerry||browser.isMobile.iOS||browser.isMobile.Windows},Android:/android/.test(browser.userAgent),BlackBerry:/blackberry/.test(browser.userAgent),iOS:/ip(?:hone|ad|od)/.test(browser.userAgent),Windows:/iemobile/.test(browser.userAgent)};var config={hasPushState:has.pushState,hasLocalStorage:has.localStorage,hasSessionStorage:has.sessionStorage,hasFileAPI:has.fileAPI,userAgent:browser.userAgent,browser:browser,addVisitedLinkClass:!1,displayPassageTitles:!1,loadDelay:0,startPassage:"Start",updatePageElements:!0,disableHistoryControls:!1,disableHistoryTracking:!1,historyMode:has.pushState?has.sessionStorage?History.Modes.Session:History.Modes.Window:History.Modes.Hash,passageTransitionOut:null,transitionEndEventName:function(){for(var e={transition:"transitionend",MSTransition:"msTransitionEnd",WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend"},t=Object.keys(e),r=document.createElement("div"),i=0,s=t.length;s>i;i++)if(r.style[t[i]]!==undefined)return e[t[i]];return""}(),macros:{maxLoopIterations:1e3},saves:{autosave:undefined,id:"untitled-story",isAllowed:undefined,onLoad:undefined,onSave:undefined,slots:8},errorName:"game",errors:{}};config.errors={savesNotAllowed:"Saving has been disallowed on this passage.",upgradeBrowser:"Apologies! Your web browser lacks capabilities that this "+config.errorName+" requires. Please consider upgrading it or switching to a more modern web browser."},config.hasFileAPI=has.fileAPI=has.fileAPI&&!browser.isMobile.any()&&(!browser.isOpera||browser.operaVersion>=15);var macros={},tale={},state={},storage={},session={},options={},setup={},testPlay="",prerender={},postrender={};$(document).ready(function(){macros=new Macros,addStandardMacros(),tale=new Tale,state=new History,storage=new KeyValueStore("localStorage",tale.domId),session=new KeyValueStore("sessionStorage",tale.domId),config.saves.id=tale.domId,UISystem.init();for(var styles=tale.lookup("tags","stylesheet"),i=0;i<styles.length;i++)addStyle(styles[i].text);for(var scripts=tale.lookup("tags","script"),i=0;i<scripts.length;i++)try{eval(scripts[i].text)}catch(e){var errMesg=e.message;if("TypeError"===e.name&&/read[\s-]only/.test(e.message)){var errMatch=/([\"\'])([^\1]+)\1/.exec(e.message);errMatch&&errMatch[2]&&(macros.has(errMatch[2])?errMesg="cannot clobber protected macro <<"+errMatch[2]+">>":"undefined"!=typeof macros[errMatch[2]]&&(errMesg='cannot clobber macros API property "'+errMatch[2]+'"'))}technicalAlert(scripts[i].title,errMesg)}for(var widgets=tale.lookup("tags","widget"),i=0;i<widgets.length;i++)try{Wikifier.wikifyEval(widgets[i].processText())}catch(e){technicalAlert(widgets[i].title,e.message)}SaveSystem.init(),macros.init(),state.init(),macros.lateInit(),UISystem.start(),window.SugarCube={version:version,runtime:runtime,has:has,browser:browser,config:config,setup:setup,storage:storage,session:session,macros:macros,tale:tale,state:state,Wikifier:Wikifier,Util:Util,History:History,SaveSystem:SaveSystem,UISystem:UISystem}})}(window,window.document);
}
/* init wapper end */
</script>
<style id="style-init-screen" type="text/css">
#init-screen { display: none; z-index: 100000; position: fixed; top: 0px; left: 0px; height: 100%; width: 100%; color: #fff; background-color: #111; text-align: center; }
#init-screen p { display: none; width: 75%; margin: 2em auto; font-family: verdana,"dejavu sans",tahoma,arial,sans-serif; font-size: 28px; font-weight: bold; font-style: italic; }
html.init-no-js #init-screen, html.init-lacking #init-screen, html.init-loading #init-screen { display: block; }
html.init-no-js #init-no-js { display: block; }
html.init-lacking #init-lacking { display: block; }
html.init-loading #init-loading { display: block; }
html.init-loading #ui-bar, html.init-loading #passages { display: none; }
noscript { color: red; font-weight: bold; }
</style>
<style id="style-fonts" type="text/css">
@font-face {
font-family: 'icomoon-sugarcube';
src: url(data:application/font-woff;charset=utf-8;base64,d09GRk9UVE8AABEkAAsAAAAAHHgAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABDRkYgAAABCAAADeQAABb40HwEm0ZGVE0AAA7sAAAAGgAAABxmn3O0R0RFRgAADwgAAAAdAAAAIABOAARPUy8yAAAPKAAAAEsAAABgL9zcQGNtYXAAAA90AAAAPQAAAVLgMPLNaGVhZAAAD7QAAAAuAAAANv41RT9oaGVhAAAP5AAAAB4AAAAkBBD/5GhtdHgAABAEAAAAHgAAAEgEkACpbWF4cAAAECQAAAAGAAAABgAhUABuYW1lAAAQLAAAAOsAAAIHCW+4AnBvc3QAABEYAAAADAAAACAAAwAAeJyNWAl0lEUS7j9OZoYkThLIIGcCCASYABkIQkQQMHIFEWEERBQEvBgE1ImrnAIRlB+E1QmycoiRS8IqizHgystjMRwyHgkEQcK94ALBAJrNPzBDar/qngxR43v7Jq+6u7q76qvq6ur6owmTSWiaVv/5idNemDZtaseXs5596qWJWROeFlqE0ERvf88I/313+BuZ9Jg79BhTYpRoPKI+6Xq4E2NZPNmf48+KbKblxTYTIq6ZdiW+mYhpZo+oL1qxDKuIFQ1Fc9FaOEQXkS76iAFiqHhUjBUTxWTxonhVzBULxVLhFatErvhYbBM7RKHYK74Rh8VxcVb8ot2RNfX5/qmpqWgeDDdO1XRRTVfVpKmmm2ruUU131fRQTbpq+qqmn2oeUE2Gah5UTX/ZOJU+p9LnVPqcSp9T6XMqfU6lz6n0OZU+p9LnVPqcSp9T6XMqfc4H/+D9Px6HENoi7U3tLW2xpmtLtKXa29oybbn2V+0d7V3Nq+VoK7T3tJXa37T3tVXaam2Ntlb7QFunfajlah9p67UN2kbRkk8jQsSIUi3N1NDU0bTBtNd0wnQxcnDkqMjtZpu5o3moOcucYzYsvSyBesOix9xpjm0VOyz2qzgtLil+RPwz8Xr9Ypvu95iCXr/XYvNnG/l2EtYfTCQs7YNEfvTIaB9MclhkG+LUsBMDGYEMc50zjtpsKYzFJhnYYKlzptxSS3GYnWhkGNBQ10y5uU6kkG8z1pvq3OL31L3nT6wLeuo2wkZawLWLREbeG/CWttVKVD1iJ3rd5qMXvY+E2LeZ6Fb5QhIRSXOIbj58GhNfQ9CN0UeIAi/YJMG+gnXZTPpFMuOd0NSN0aVYfrA3b1zLImaFhEmx1TFWVjWPlXpYfT3IoepXMK0B76S/20isGtFV9WjS1m8hm2gWk9lM5jApDJPZLKcAxJXO4Bey5rmsD8AofbTCQLfOYHjjsdGseQ9gTvmWhOmdX6QF/UgMGjdbWhArucpWYd7kYPCFJCK3tWTwlzFMmKnAC60yHSRvH1swGLOiH5MFYdI3TLKtbFAaEw8b9A16w6+xzTvZ5oGRDP7emoMAeMguVOChbwaDX8AYWrDmr4Br42WGeT1kAcAXMtkdqcCDbONFm7H8HhNvXM8i+rEw9mL6+wo8VM1hpYOkequEEgK1avgvtYBK3PJwFFrsWVJjeuUsFTYSKFz0DOuboM5cYpBxoJwaeGGYRDuHnb5Qor2mIkYCVWEjD+rmw2cUUBxjhgIq4xIn7ZfHHYoYiRZx8k4Y7VTZi7T5M/xp9rKegVL8XIarrMwwBUyR0LRvx1IS9raX7aSlz91NWtqysURrOEyfarWcqH3qR0Qp8C2t+tdAEhO2zFWztPbkdCC+J2VwQxIp2WNIOErakZjUG/rXPNqHxA/fjyVxmG1JyV5NVNq5CVUH+UDFnocAx2NqEeX35NlbRhmVfpPdlxnw4JdmpPl85Y7fzJcblfaA18DPUpttM7x+j71VVNBlujvKYbhwcdNuVQJGREyIyGGYR6XokY97vvCwDl54b+JvNCBFzKoY6YaWJWPgm/fyq4nOdelE4tcGfqquzD6F47JMseokZnVeG3CxjwMujOZceg1uOj1eIA56fUZU5cb5TTjxM9H+u+sTrQxctMJFC+KvQBXRy+tPEj2XGUGi+XcjiWKuWEmLnnEGkeP3QjYtKJ5gSMkGZNO8hotwVVqsEwiQPctI1PMih61pVUKix8lUEs+aGllthsfErtPhWq8uc0TAhTMQ/XSw4Gev4YF3A17dSAOR19ZwESQW6mAhQDRwGBuzsDAN+7wQwQt1xUzTI+EqtzokzIO6pCZdKjJ4vtzvsvsTgviZjco8u8FhWGrJzERPz3MHE3Tdn5DnhqdWrFuAoBs3G844VHiTRMe+uGXjIE2MF5pKr7gxs2C/zoaExrNhiQsofZl60BX0Qpo30vBm2gMJPiPBYkCtXSft6dnbiS7MhmuazB9KdHx+MTshkM+WunU9mMB2+DmSlk5YTuKlNdOJuEfoJcGYz976J9Gp13ALv3zyC6KDPyKZlty1FDF9ZMvuLwE++UQFibs7rSTRuM14El1ffQQuSn/sLtDJ9bB3izWfxKNV/YlyjCEQePDmWdBi5Ee6PO8g0ck+uOsn+5qRFQYUNSLa2SsVQaTzgQwOXCT6PKIYWjqNMEA4Qd5fDQ8121xFov8/knUcdilpK/J3wYCxC58hOp+1h8QDjHfLQ6VQ9P6iT4A1exCQrCroHyJymD0oyEMkx0kYipkF/ROB+elXh/P+MmDensIy25Bourg3ZOyKzMUL+/OFXLykjRsSXR3zJFHl9m1E11dXhMjZ/Z+EyNXHJxEdLbkCCEcecClKIm79asklkdhjuFqJ3iOhXruOh9VG0WFXhV5D23U8pDbKPb8ncqJdpwS5fKtVNSxlo2Sz5CkhbYxQ2CYUK+gi+qFhyhxh+emyFa/c0gfPI559nHNIO3QhkcQnZwRXUqduEl3LxWWL8ewi+hWnImwTj6GqKHoMfvn2U+TpzcfP4VqWdBqJOOOXt2gqVF9LvorYQ2hQyZJ6WJ7cATx+zwOHOgFEH34ioyPQe2UR5KwaNwsvP+08QqLbOU5MC/F4OVa+i5B55hIcWNHvTtCrT/yK/T3Avb71O8jceFlCOE1iVJvxHCirO+DA2l6CZ+LwVvact5ghAFYnD147I6GaROyLV2BFFh7RGNtxyFlwFDbeNxkB2OXh23KO4wJesEBYzx1DsOcQntMmJ7ZiYhHCwno9GbxZmDU53oCqq3gc6CQSaVz+DMiZ9KEsV6pBvz5TBCtW4GUrbYFr261oNfwaf2QPDiqu4E3sLwUiG6dKq3wZuwxrwd5cx97sPgTxfBHlwtVjOL4iAAIERFnJa3fB6I5NzkF81jycUDonDLzLQPd8Dyav8bAPTwywMkXglqx4k2cQ+PuQY0B2Mq9/iIR5WBJk3iIpNRFvqJEADSmdjuOWl7QlOsHnebjkOZDiCzyEC090bsq8tiFyQi7GrEjp3BRJRJj4aRVjmqF3L4jYhHrC1ELAiHZzZ5Nw7+bS8brnXoRH5Uyi8rXINFUfvkV0yf2GbmWpySz1x9tSGdFKRpTM5Dke/phEoqF3JtQlPDWA9+Pptun7WSafydHXF7CmbD6Z0XFSP3obzktMCqO1lp2KyGFt24//3s4wL5HRLtQZPbxY78lXlEUiNnqhtBNVl/f+QkSW2OxEBJ/BiYvHytDbex6bAtsmKApMG9tILnqjvkfvdKFEP79mv00/wFL3s50DWdNf2O4ZSIV42JDI6YNh63GRqhsjB15y4HrdbIOUdZlr8qqrqHOuLLoGgb2qb8Louy1IVS+fhafPVKLG9N+H6Po3eELy9h/apsNd51Bq0jHOxYc3wur/tEaW/u7JNJ1pN9DD7MRGZZg/twm5JhlPsNqrZNGSxL+wfNTMlq/qK52CeRJDpEIlGrwap5AKu6y9G6PubVhabZXm5OEl3JCIGI+owE1uPeo7XN0quKKlA98TDfguNlk9BUs/tTig9IR/OCvAKSRF43Ja9hTjwQCPJG/UqCidT+GlaSCjfwB5uQBk5AHudQUZ9TZREDWJqLe7D4Ck4CMhKqsIzoo6VwyadnYxcuzNcyCn8LnSLZJfDUWZS0daLg59lvgSC4Dmv81TWcoS9BbjYyi4AYFSdX8ha8PNps35CgF6lYwKiZE2pVgVToUbhzGQbcFXjb9XqrKPmAd7U9iWBtdxLBcmutgruMunSmcoT1HZ5i5W5Tqbz5Tp9/osQReus8NXbslDG/D4DI8lzxEqGfIQPYFSn1FqCVeBk/A6vsSh+kSLGiKHTCi3ZoKWhkluzcRtnlqSG9qW5DbO2zN9PktewGvPcxsJDneew+2GSg8Q8YSPqzNXJsoTsyNTd/v0cvzBynh8YSHp4zPLxp96FSMKEh1l9tZRX5rayMI4I9R3ByqlnEzDCzk+w8XmkLb8Iy5ytk7eTdXLxm6l6k0dXmffgcHVD1UacDdTOHlZE7wU6/ZCW/NKRFWbVxZR9ZAXtyBUr/b1Icp78gPYuxuuwgZUPK3aXkaO0rZvmmLmwWadJ1FQNBqzjjf0R11b1EiKOUDaZ2+PjGTh+Gyy8SPHCoVl+k8KgBVVIUDGf4wPT9tIU4jIYZhH19GjCu5VhId18MJ7E/NkVqhgp12v8SEPk3IcO/ScP3EtqlcPCtWg18wfKKgYURcbCfieAs91mwe/e+3uQH4wweJ2636XrK7z7Vy+oXKLkYSfMv6e5/KNdkcMRVR/jGfoi6ErObffrjhryk5FbpeiXJkitw/hYkpkXMSFaXnsXYi7ArzdcvpAxvdH4cUOrRtB062uMCD4/Wn0uEgLch4L+n8AuYFh2a7JTNzYcqAKqdDiIPpmB5+8oswVDfxHeFF7ZBrUbOht5d5RtVykdud72XVglaJqOXPVcpBjarkayokG/lK1xVqzk9mQl6LWsw6YsfO+dpKwExN0+5KYqGYipoEw83/I6ol4MVF8rr2pHfd7g/iZo/0u1P0uS3Rdpfuf+5XCi0WNc0PDGl5SNJfuQa7aTSEih0xoS80E5YTJlpqJ2zy1ZEtoG0vsvqwJZ8+eG/EWPYHPkeRBPfCqFByo3bPnojj1FY3BSRyY/pOkF9RycB9Xi35DvpbLeUnnWlt0xYW4ErUIKrqHez3UckDZoDOsplbZNFHrJUK5Xi6t1ZMTjJD36Nbo/zd063KxIrePQn5tRf8PlqV0RnicY2BgYGQAgpOd+YYg+lw3kyOMBgA8PwUsAAB4nGNgZGBg4ANiCQYQYGJgBEIFIGYB8xgABaoAUwAAAHicY2BmYmCcwMDKwMHow5jGwMDgDqW/MkgytDAwMDGwMjPAgQCCyRCQ5prC4PCA4QMD44P/Dxj0GB8wKDQwMDDCFSgAISMAEEIMHwB4nGNgYGBmgGAZBkYGEPAB8hjBfBYGAyDNAYRMIIkHch8Y/v8HsxggLAUmAUaoLjBgZGNA5o5IAADrtAjMAAAAeJxjYGRgYADild0rzsfz23xl4GZiAIFz3UyOCPr/AyYGxgdALgcDWBoAMdIKXgAAeJxjYGRgYHzw/wGDHhMDA8M/BiAJFEEBzABt5wP2AAB4nGNigAAmBqxAgcEAiQ0hOdHUJDA4MDAAABelAT4AAAAAUAAAIQAAeJydj81Kw0AUhb9pk0LRTV3oNhS3iTMRXNR9F66lq4K0IYQsmoFJ8yo+iG/km3gSZyEoCB243I9zz/0Z4Jp3DOMzrLiPPGPJS+Q5BR+RE1YmjZxyZR4iL6S/yWmSpZT11DXyjBueIs/Z8xo5keczcsqtuYu8YG2eaanwnBSejpyegYYDQfrAkRrayp+87/J+aA6hGo6S/nD9qG6nWecpB/lqMkr9zCpvFP/v/PaVOFWd+nKxFT1quO/OWx+aOisLm22yX9dJK13ubF5aJ/9lH9xJD/K2U1em1eP57OrQt77LXGEvnPwFPSJZ7QB4nGNgZsALAAB9AAQ=) format('woff');
font-weight: normal;
font-style: normal;
}
</style>
<style id="style-structural" type="text/css">
body {
margin: 3.5em 3.5em 3.5em 21em;
}
#store-area {
display: none;
z-index: 0;
}
#ui-bar {
position: fixed;
z-index: 50;
top: 0;
left: 0;
width: 14.5em;
height: 100%;
margin: 0;
padding: 3.5em 1.5em 0 3.5em;
}
/* Default menu styling */
body.ui-open {
overflow: hidden;
}
#ui-overlay {
display: none;
z-index: 1000;
position: fixed;
top: 0px;
left: 0px;
height: 100%;
width: 100%;
}
#ui-body-close {
display: none;
z-index: 1110;
position: fixed;
white-space: nowrap;
}
#ui-body {
display: none;
z-index: 1100;
position: fixed;
overflow: auto;
min-width: 140px;
max-width: 90%;
max-height: 90%;
}
/* Options menu styling */
#ui-body.options [id|="option-body"] {
display: table;
width: 100%;
}
#ui-body.options [id|="option-label"] {
display: table-cell;
width: 80%;
padding: 0.33em 2em 0.4em 0.33em;
}
#ui-body.options [id|="option-control"] {
display: table-cell;
padding: 0.33em 0.33em 0.4em;
white-space: nowrap;
}
/* Passages area styling */
#passages {
z-index: 10;
margin-right: 16%;
}
/* Stop text selection on UI widgets */
button, #ui-body-close, #ui-body.dialog-list a, #ui-body.options a[id|="option-input"] {
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
</style>
<style id="style-appearance" type="text/css">
body {
color: #fff;
background-color: #111;
font-family: verdana, "dejavu sans", tahoma, arial, sans-serif;
font-size: 12px;
}
a {
cursor: pointer;
color: #46d;
}
a:hover {
color: #79f;
}
a:active {
color: #f70;
}
a.link-internal, a.link-external {
font-weight: bold;
text-decoration: none;
}
a.link-internal:hover, a.link-external:hover {
text-decoration: underline;
}
a.link-broken {
padding: 3px;
color: #000;
background-color: red;
font-weight: bold;
text-decoration: none;
}
hr {
height: 1px;
border: none;
background-color: #fff;
}
input, textarea {
color: #fff;
background-color: #333;
border: 1px solid #fff;
}
input[type="text"], textarea {
min-width: 16em;
}
input {
padding: 2px 3px;
}
input:focus, textarea:focus {
border: 1px solid #292;
}
input:hover, textarea:hover {
border: 1px solid #f70;
}
button {
cursor: pointer;
padding: 4px 6px;
color: #fff;
background-color: #36c;
border: 1px solid #58e;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
text-decoration: none;
text-shadow: 1px 1px rgba(0, 0, 0, 0.4);
-webkit-transition-duration: 200ms;
-moz-transition-duration: 200ms;
transition-duration: 200ms;
}
button:hover {
background-color: #58e;
border-color: #7af;
}
button:active {
background-color: #f70;
border-color: #f92;
}
.error {
margin: 0 12px 0 3px;
padding: 3px 5px;
color: #000;
background-color: red;
font-weight: bold;
}
.error[title] {
cursor: help;
}
.highlight, .marked {
color: yellow;
font-weight: bold;
font-style: italic;
}
.nobr {
white-space: nowrap;
}
.transition-in {
opacity: 0;
}
#ui-bar {
background-color: #222;
border-right: 1px solid #fff;
}
#ui-bar header, #menu, #ui-bar footer {
text-align: right;
}
#ui-bar header, #menu {
font-weight: bold;
}
#menu, #ui-bar footer {
margin-top: 3em;
}
#menu ul {
margin: 1em 0;
padding: 0;
list-style: none;
}
#menu li {
margin-bottom: 1em;
}
#menu li a {
text-decoration: none;
}
#story-title {
margin: 0;
font-size: 210%;
}
#story-subtitle {
font-size: 111%;
}
#story-author {
font-size: 111%;
}
#story-caption {
margin-top: 3em;
text-align: right;
}
#menu-story {
line-height: 1.125;
}
[data-icon], a.link-back:before, a.link-return:after, a.link-external:after,
#menu-saves a:before, #menu-rewind a:before, #menu-restart a:before, #menu-options a:before, #menu-share a:before,
#ui-body-close, #ui-body.options a[id|="option-input"]:before, #ui-body.options a[id|="option-input"].enabled:before {
font-family: 'icomoon-sugarcube';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
[data-icon]:before {
content: attr(data-icon) "\00a0\00a0";
}
a.link-back:before {
content: "\e00a\00a0\00a0";
}
a.link-return:after {
content: "\00a0\00a0\e00b";
}
#passages a.link-external:after {
content: "\00a0\e010";
}
#menu-saves a:before {
content: "\e011\00a0\00a0";
}
#menu-rewind a:before {
content: "\e012\00a0\00a0";
}
#menu-restart a:before {
content: "\e013\00a0\00a0";
}
#menu-options a:before {
content: "\e014\00a0\00a0";
}
#menu-share a:before {
content: "\e015\00a0\00a0";
}
#credits, #version {
margin-top: 1em;
color: #999;
font-weight: normal;
font-size: 71%;
}
/* Default menu styling */
#ui-overlay {
opacity: 0.8;
background-color: #000;
}
#ui-body-close {
opacity: 1;
cursor: pointer;
font-size: 111%;
margin: 0;
padding: 3px 4px;
font-weight: normal;
color: #fff;
background-color: #36c;
border: 1px solid #58e;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
text-decoration: none;
text-shadow: 1px 1px rgba(0, 0, 0, 0.4);
-webkit-transition-duration: 200ms;
-moz-transition-duration: 200ms;
transition-duration: 200ms;
}
#ui-body-close:hover {
background-color: #58e;
border-color: #7af;
}
#ui-body-close:active {
background-color: #f70;
border-color: #f92;
}
#ui-body {
opacity: 1;
background-color: #222;
border: 1px solid #fff;
text-align: left;
line-height: 2;
}
#ui-body div {
padding: 0.2em;
}
/* Default menu button styling */
#ui-body > ul > li + li > button {
margin-left: 12px;
}
/* General dialog styling */
#ui-body.dialog {
min-width: 280px;
padding: 0.33em 1em 0.66em;
}
#ui-body.dialog > ul {
display: block;
width: 100%;
margin: 0;
padding: 0;
list-style: none;
text-align: left;
}
#ui-body.dialog > ul li {
display: inline-block;
margin: 0;
padding: 0.4em 0.4em 0.5em;
}
/* List-based dialog styling (primarily for the Rewind & Share menus) */
#ui-body.dialog-list ul {
margin: 0;
padding: 0;
list-style: none;
}
#ui-body.dialog-list li {
margin: 0;
}
#ui-body.dialog-list li:nth-child(even) {
background-color: #333;
}
#ui-body.dialog-list li a {
display: block;
padding: 0.25em 0.75em;
color: #fff;
font-weight: normal;
text-decoration: none;
}
#ui-body.dialog-list li a:hover {
background-color: #47b;
}
#ui-body.dialog-list li a:active {
background-color: #f70;
}
/* Saves menu styling */
#ui-body.saves table {
border-spacing: 0;
min-width: 320px;
width: 100%;
}
#ui-body.saves tr:nth-child(even) {
background-color: #333;
}
#ui-body.saves td {
padding: 0.33em 0.33em;
line-height: 1.2;
}
#ui-body.saves td:first-child {
min-width: 1.5em;
text-align: center;
}
#ui-body.saves .empty {
color: #999;
}
#ui-body.saves ul {
display: block;
margin: 0;
padding: 0;
list-style: none;
white-space: nowrap;
}
#ui-body.saves li {
display: inline-block;
margin: 0;
padding: 0.33em 0.33em 0.4em;
}
#ui-body.saves > div:not(:first-child) {
border-top: 1px solid #fff;
}
#saves-import-label {
margin: 0 6px;
font-weight: bold;
}
#saves-import-file {
margin: 0 6px 6px;
}
/* Options menu styling */
#ui-body.options div[id|="option-body"] + div[id|="option-body"],
#ui-body.options div[id|="option-body"] + br + div[id|="option-body"] {
margin-top: 0.5em;
}
#ui-body.options select[id|="option-input"] {
cursor: pointer;
padding: 3px 6px;
font-weight: normal;
color: #fff;
background-color: #36c;
border: 1px solid #58e;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
text-decoration: none;
text-shadow: 1px 1px rgba(0, 0, 0, 0.4);
-webkit-transition-duration: 200ms;
-moz-transition-duration: 200ms;
transition-duration: 200ms;
white-space: nowrap;
}
#ui-body.options a[id|="option-input"] {
cursor: pointer;
padding: 4px 6px;
font-weight: normal;
color: #fff;
background-color: #36c;
border: 1px solid #58e;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
text-decoration: none;
text-shadow: 1px 1px rgba(0, 0, 0, 0.4);
-webkit-transition-duration: 200ms;
-moz-transition-duration: 200ms;
transition-duration: 200ms;
white-space: nowrap;
}
#ui-body.options a[id|="option-input"]:hover {
background-color: #58e;
border-color: #7af;
}
#ui-body.options a[id|="option-input"].enabled {
background-color: #292;
border-color: #4b4;
}
#ui-body.options a[id|="option-input"].enabled:hover {
background-color: #4b4;
border-color: #6d6;
}
#ui-body.options a[id|="option-input"]:before {
content: "\e002\00a0\00a0";
}
#ui-body.options a[id|="option-input"].enabled:before {
content: "\e003\00a0\00a0";
}
/* Passages area styling */
.passage {
line-height: 1.75;
text-align: left;
transition: opacity 400ms ease-in;
-webkit-transition: opacity 400ms ease-in;
}
.passage ul, .passage ol {
margin-left: 0.5em;
padding-left: 1.5em;
}
.passage table {
margin: 1em 0;
border-collapse: collapse;
font-size: 100%;
}
.passage th, .passage td, .passage tr, .passage caption {
padding: 3px;
}
</style>
<style id="style-media-queries" type="text/css">
/* Increase viewport utilization as its size decreases. */
@media screen and (max-width: 1440px) {
#passages {
margin-right: 8%;
}
}
@media screen and (max-width: 1136px) {
body {
margin: 3.5% 3.5% 3.5% 20em;
}
#ui-bar {
padding-top: 3.5%;
padding-left: 2.5em;
}
#passages {
margin: 0;
}
}
</style>
<style id="style-media-queries-narrow" type="text/css">
/* Handle very narrow viewports. */
@media screen and (max-width: 800px) {
body {
margin: 0;
}
#ui-bar {
position: relative;
top: 0;
left: 0;
width: auto;
height: auto;
margin: 0;
padding: 2.5% 3.5% 0;
border: none;
border-bottom: 1px solid #fff;
}
#ui-bar header, #story-caption, #ui-bar footer {
text-align: left;
width: 66%;
}
#menu {
position: absolute;
top: 0;
right: 0;
margin: 2.5% 3.5% 0 0;
}
#menu ul {
margin: 0;
}
#menu li {
margin-bottom: 0.5em;
}
#menu-story {
margin-bottom: 0.7em;
line-height: 0.85;
}
#passages {
width: auto;
margin: 2em 3.5% 3.5%;
}
}
</style>
</head>
<body id="body">
<div id="init-screen">
<p id="init-no-js"><noscript>Apologies! JavaScript is required. Please enable it to continue.</noscript></p>
<p id="init-lacking">Apologies! Your web browser lacks required capabilities. Please consider upgrading it or switching to a more modern web browser.</p>
<p id="init-loading">Initializing. Please wait&hellip;<br /><progress></progress></p>
</div>
<div id="store-area" data-size="15" hidden><div tiddler="common controls" tags="" created="201409251806" modifier="twee" twine-position="777,377">&lt;&lt;button &quot;[]&quot;&gt;&gt;&lt;&lt;stopallsound&gt;&gt;&lt;&lt;/button&gt;&gt;\s\n&lt;&lt;button &quot;||&quot;&gt;&gt;&lt;&lt;pauseallsound&gt;&gt;&lt;&lt;/button&gt;&gt;\s\n&lt;&lt;button &quot;&lt;)&quot;&gt;&gt;&lt;&lt;quieter&gt;&gt;&lt;&lt;/button&gt;&gt;\s\n&lt;&lt;button &quot;&lt;)))&quot;&gt;&gt;&lt;&lt;louder&gt;&gt;&lt;&lt;/button&gt;&gt;\s\n&lt;&lt;button &quot;|&gt;&quot;&gt;&gt;&lt;&lt;playsound $background_music 0.5&gt;&gt;&lt;&lt;/button&gt;&gt;\s\n&lt;&lt;button &quot;Loop simple&quot;&gt;&gt;&lt;&lt;loopsound $background_music 0.5&gt;&gt;&lt;&lt;/button&gt;&gt;\s\n&lt;&lt;button &quot;Loop w/crossfade&quot;&gt;&gt;&lt;&lt;fadeinsound $background_music 0.5 80&gt;&gt;&lt;&lt;/button&gt;&gt;</div><div tiddler="quieter" tags="" created="201409251339" modifier="twee" twine-position="593,23">&lt;&lt;set $currentLoops = []&gt;&gt;\s\n&lt;&lt;set $background_music = &quot;accordion.mp3&quot;&gt;&gt;\s\n&lt;&lt;set $footsteps = &quot;footsteps.mp3&quot;&gt;&gt;\s\n[[&lt;- loopsound, fadesound etc.|loopsound]]&lt;div align=&quot;right&quot;&gt;[[jumpscare]]&lt;/div&gt;\s\n\n&lt;h2&gt;quieter, louder&lt;/h2&gt;\s\n\n&lt;&lt;display &quot;common controls&quot;&gt;&gt;\n\nThese macros adjust the overall volume of the story. The relative proportions of individual audio clips will be preserved.\n\nThese macros do NOT change the system volume. If the reader has their system volume down to two bars, these controls adjust the volume within that two-bar range.\n\nThis means the reader can have rainymoods.com playing in one tab at a certain volume, and then your story playing in another tab at a different volume.\n\n&lt;h3&gt;{{{&lt;&lt;quieter&gt;&gt;}}}&lt;/h3&gt;\s\nReduces the story's overall volume by 1/10th of the reader's current system volume.\n\n&lt;h3&gt;{{{&lt;&lt;louder&gt;&gt;}}}&lt;/h3&gt;\s\nIncreases the story's overally volume by 1/10th of the reader's current system volume.\n\nTogether, these options create a 10-unit range for the reader to adjust your story's volume (within the reader's system volume.)\n\n[[&lt;- loopsound, fadesound etc.|loopsound]]&lt;div align=&quot;right&quot;&gt;[[jumpscare]]&lt;/div&gt;</div><div tiddler="StoryTitle" tags="" created="201409251311" modifier="twee" twine-position="10,150">sub-Q Demo\nsqTwineSound \nv. 0.8.0</div><div tiddler="loopsound" tags="" created="201409251344" modifier="twee" twine-position="445,20">&lt;&lt;set $currentLoops = []&gt;&gt;\s\n&lt;&lt;set $background_music = &quot;accordion.mp3&quot;&gt;&gt;\s\n&lt;&lt;set $footsteps = &quot;footsteps.mp3&quot;&gt;&gt;\s\n[[&lt;- pausesound, stopsound|pausesound]]&lt;div align=&quot;right&quot;&gt;[[quieter, louder -&gt;|quieter]]&lt;/div&gt;\s\n\n&lt;h2&gt;loopsound, unloopsound, fadeinsound, fadeinsounds, fadeoutsound, fadeoutsounds, playsounds, pauseallsound, stopallsound&lt;/h2&gt;\s\n\n&lt;&lt;display &quot;single loop controls&quot;&gt;&gt;\n&lt;&lt;display &quot;multiple loop controls&quot;&gt;&gt;\n\nNote that you must keep track of what's playing--what you want to stop and start--on your own.\n\n\n&lt;h3&gt;{{{&lt;&lt;loopsound &quot;accordion.mp3&quot;&gt;&gt;}}}&lt;/h3&gt;\s\nThe parameters (in this order, please):\n\nParameters:\n\n&lt;ul&gt;&lt;li&gt;REQUIRED: clipName (e.g. &quot;backgroundMusic.mp3&quot; or $backgroundMusic)&lt;/li&gt;&lt;li&gt;OPTIONAL: decimal proportion of volume (0.0 being minimum/mute, and 1.0 being maximum/default)&lt;/li&gt;&lt;li&gt;OPTIONAL: number of milliseconds to overlap/crossfade the loop (1000 ms by default, must be &gt;= 10 ms if declared)&lt;/li&gt;&lt;/ul&gt;\s\n\nStarts playing the given clip on repeat. Note that browsers will not necessarily play looping audio seamlessly.\n\n&lt;h3&gt;{{{&lt;&lt;unloopsound $footsteps&gt;&gt;}}}&lt;/h3&gt;\s\nLet the given sound stop when it finishes its current loop (so the sound no longer repeats.)\n\n&lt;h3&gt;{{{&lt;&lt;fadeinsound &quot;footsteps.mp3&quot;&gt;&gt;}}}&lt;/h3&gt;\s\nIdentical to loopsound, but performs a fade in over the given overlap period.\n\n&lt;h3&gt;{{{&lt;&lt;fadeinsounds [&quot;accordion.mp3&quot;, &quot;footsteps.mp3&quot;]&gt;&gt;}}}&lt;/h3&gt;\s\nOR IDEALLY\n&lt;h3&gt;{{{&lt;&lt;set $spookySounds = [$moodMusic, $footSteps]&gt;&gt;}}}\n{{{&lt;&lt;fadeinsounds $spookySounds&gt;&gt;}}}&lt;/h3&gt;\s\n\nFade in multiple sounds at once. Previous clip volume and overlap is remembered.\n\n&lt;h3&gt;{{{&lt;&lt;fadeoutsound $birdsong&gt;&gt;}}}&lt;/h3&gt;\s\nIdentical to stopsound, but fades out the sound over 2 seconds.\n\n&lt;h3&gt;{{{&lt;&lt;fadeoutsounds [&quot;moodMusic.mp3&quot;, &quot;footsteps.mp3&quot;]&gt;&gt;}}}&lt;/h3&gt;\s\n&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;OR IDEALLY\n&lt;h3&gt;{{{&lt;&lt;set $spookySounds = [$moodMusic, $footSteps]&gt;&gt;}}}\n{{{&lt;&lt;fadeoutsounds $spookySounds&gt;&gt;}}}&lt;/h3&gt;\s\n\nFade out multiple sounds at once.\n\n&lt;h3&gt;{{{&lt;&lt;playsounds [&quot;moodMusic.mp3&quot;, &quot;footsteps.mp3&quot;]&gt;&gt;}}}&lt;/h3&gt;\s\n&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;OR IDEALLY\n&lt;h3&gt;{{{&lt;&lt;set $spookySounds = [$moodMusic, $footSteps]&gt;&gt;}}}\n{{{&lt;&lt;playsounds $spookySounds&gt;&gt;}}}&lt;/h3&gt;\s\n\nPlay multiple sounds at once (picking up where we left off)\n\nParameters:\n\n&lt;ul&gt;&lt;li&gt;REQUIRED: clipName (e.g. &quot;backgroundMusic.mp3&quot; or $backgroundMusic)&lt;/li&gt;&lt;li&gt;OPTIONAL: decimal proportion of volume (0.0 being minimum/mute, and 1.0 being maximum/default)&lt;/li&gt;&lt;li&gt;OPTIONAL: number of milliseconds to overlap/crossfade the loop (1000 ms by default, must be &gt;= 10 ms if declared)&lt;/li&gt;&lt;li&gt;OPTIONAL: true if you'd like to loop, false if no&lt;/li&gt;&lt;/ul&gt;\s\n\n&lt;h3&gt;{{{&lt;&lt;pauseallsound&gt;&gt;}}}&lt;/h3&gt;\nPauses all sounds at their current location. \n\n&lt;h3&gt;{{{&lt;&lt;stopallsound&gt;&gt;}}}&lt;/h3&gt;\nStops all sounds immediately. If any stopped sound is played again, it will play from the beginning.\n\n[[&lt;- pausesound, stopsound|pausesound]]&lt;div align=&quot;right&quot;&gt;[[quieter, louder -&gt;|quieter]]&lt;/div&gt;\s</div><div tiddler="audio attribution" tags="" created="201409251600" modifier="twee" twine-position="162,282">All sample sounds acquired from &lt;a href=&quot;http://soundbible.com/&quot; target=&quot;_blank&quot;&gt;soundbible.com&lt;/a&gt;.\n\n&lt;ul&gt;\n&lt;li&gt;&lt;a href=&quot;http://soundbible.com/1954-Cat-Meow-2.html&quot; target=&quot;_blank&quot;&gt;Soft meow&lt;/a&gt;&lt;/li&gt;\n&lt;li&gt;&lt;a href=&quot;http://soundbible.com/1509-Cat-Scream.html&quot; target=&quot;_blank&quot;&gt;Cat scream&lt;/a&gt;&lt;/li&gt;\n&lt;li&gt;&lt;a href=&quot;http://soundbible.com/528-Accordion.html&quot; target=&quot;_blank&quot;&gt;Accordion Music&lt;/a&gt;&lt;/li&gt;\n&lt;li&gt;&lt;a href=&quot;http://soundbible.com/2057-Footsteps-On-Cement.html&quot; target=&quot;_blank&quot;&gt;Footsteps&lt;/a&gt;&lt;/li&gt;\n&lt;/ul&gt;\n\n[[Back to start|Start]]</div><div tiddler="Start" tags="" created="201409251311" modifier="twee" twine-position="14,12">&lt;&lt;set $sound = &quot;Yes&quot;&gt;&gt;\s\n&lt;&lt;set $currentLoops = []&gt;&gt;\s\n&lt;&lt;set $background_music = &quot;accordion.mp3&quot;&gt;&gt;\s\n&lt;&lt;set $footsteps = &quot;footsteps.mp3&quot;&gt;&gt;\s\n&lt;h2&gt;Welcome to the sub-Q Sound Macro Suite Demo&lt;/h2&gt;\s\n&lt;h3&gt;Macros&lt;/h3&gt;\s\n&lt;ul&gt;&lt;li&gt;[[playsound]], [[updatevolume|playsound]]&lt;/li&gt;\n&lt;li&gt;[[pausesound]], [[pauseallsound|pausesound]]&lt;/li&gt;\n&lt;li&gt;[[loopsound]], [[unloopsound|loopsound]], [[fadeinsound|loopsound]], [[fadeinsounds|loopsound]], [[fadeoutsound|loopsound]], [[fadeoutsounds|loopsound]], [[playsounds|loopsound]], [[stopsound|loopsound]], [[stopallsound|loopsound]]&lt;/li&gt;\n&lt;li&gt;[[quieter]], [[louder|quieter]]&lt;/li&gt;\n&lt;li&gt;[[jumpscare]]&lt;/li&gt;&lt;/ul&gt;\n&lt;h3&gt;Overview&lt;/h3&gt;\s\nThis suite builds on Leon Arnott's incredibly rad HTML5 sound macros by adding\n&lt;ul&gt;&lt;li&gt;story-wide volume control&lt;/li&gt;\n&lt;li&gt;individual volume control&lt;/li&gt;\n&lt;li&gt;seamless loops (with crossfade)&lt;/li&gt;\n&lt;li&gt;fade duration control&lt;/li&gt;\n&lt;li&gt;the ability to start multiple audio tracks at once&lt;/li&gt;&lt;/ul&gt;\s\n\nA macro is a piece of code you can insert in a Twine passage like so:\n{{{&lt;&lt;playsound $thisSound&gt;&gt;}}}\n\nThis demo shows what the sub-Q suite of sound macros can be used to do.\n\n&lt;h3&gt;Quick Reference&lt;/h3&gt;\s\n&lt;&lt;display &quot;questions&quot;&gt;&gt;\s\n\n&lt;h3&gt;Before We Start&lt;/h3&gt;\s\nIn this demo, I use &quot;clip&quot; and &quot;track&quot; to mean the playback of a specific audio file.\n\nThese macros recognize the following file formats, but be advised not every format works in every browser: ogg, mp3, wav, and webm.\n\nFor optimal performance of these macros, the &lt;a href=&quot;http://www.motoslave.net/sugarcube/&quot; target=&quot;_blank&quot;&gt;latest Sugarcube story format is recommended&lt;/a&gt;. This demo uses Sugarcube v1.0.3.\n\nIn the Sugarcube story format, you can pass your audio clip name[s] as a string (e.g. &quot;meow.mp3&quot;) or a variable (e.g. $meow, assuming you have defined {{{&lt;&lt;set $meow = &quot;meow.mp3&quot;&gt;&gt;}}}.) But in Sugarcane and Jonah, the audio clip names must be passed as strings (e.g. &quot;meow.mp3&quot;). You will see both these strings and variables used in the examples.\n\nNote that, even in Sugarcube, string variables are recommended because they help you do things like this:\n\n&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{{{&lt;&lt;set $heartbeat = &quot;heartbeat.mp3&quot;&gt;&gt;}}}\n&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{{{&lt;&lt;set $spookyMusic = &quot;spookyMusic.mp3&quot;&gt;&gt;}}}\n&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{{{&lt;&lt;set $spookyClips = [$heartbeat, $spookyMusic]&gt;&gt;}}}\n&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;...\n&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{{{&lt;&lt;fadeinsounds $spookyClips&gt;&gt;}}}\n&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{{{&lt;&lt;timedcontinue 2s&gt;&gt;}}}\n&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;...But then things weren't so scary...\n&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{{{&lt;&lt;fadeoutsounds $spookyClips&gt;&gt;}}}\n\n(Speaking of, if you'd like the &quot;timedcontinue&quot; macro, it's available in the &lt;a href=&quot;http://www.glorioustrainwrecks.com/node/5462&quot; target=&quot;_blank&quot;&gt;Glorious Trainwrecks Replace Macro Set&lt;/a&gt;!)\n\nHuge thanks to Leon Arnott for founding these sound macros.\n\nFeel free to save this demo locally and import the HTML into Twine to inspect it. Remember that the JavaScript in this demo and on github is &quot;beautiful,&quot; so it's easy to read. Before you paste it into a Twine project, you may want to &lt;a href=&quot;http://jscompress.com/&quot; target=&quot;_blank&quot;&gt;minimize it&lt;/a&gt; for efficiency.\n\nReady? Let's go!\n\n-&gt; [[Walk through|playsound]] all macros\n</div><div tiddler="single loop controls" tags="" created="201409251508" modifier="twee" twine-position="778,534">&lt;table&gt;\s\n&lt;tr&gt;&lt;td&gt;Fade in Music at 1/4 Volume w/ Tiny Fade/Crossfade: &lt;/td&gt;&lt;td&gt;&lt;&lt;button &quot;Fade In&quot;&gt;&gt;&lt;&lt;set $currentLoops.push($background_music)&gt;&gt;&lt;&lt;fadeinsound $background_music 0.25 80&gt;&gt;&lt;&lt;/button&gt;&gt;&lt;/td&gt;&lt;/tr&gt;\s\n&lt;tr&gt;&lt;td&gt;Unloop Music: &lt;/td&gt;&lt;td&gt;&lt;&lt;button &quot;Unloop&quot;&gt;&gt;&lt;&lt;set $currentLoops.splice($currentLoops.indexOf($background_music),1)&gt;&gt;\s\n&lt;&lt;unloopsound $background_music&gt;&gt;&lt;&lt;/button&gt;&gt;&lt;/td&gt;&lt;/tr&gt;\s\n&lt;tr&gt;&lt;td&gt;Fade Out Music: &lt;/td&gt;&lt;td&gt;&lt;&lt;button &quot;Fade Out&quot;&gt;&gt;&lt;&lt;set $currentLoops.splice($currentLoops.indexOf($background_music),1)&gt;&gt;\s\n&lt;&lt;fadeoutsound $background_music&gt;&gt;&lt;&lt;/button&gt;&gt;&lt;/td&gt;&lt;/tr&gt;\s\n&lt;tr&gt;&lt;td&gt;Pause Music: &lt;/td&gt;&lt;td&gt;&lt;&lt;button &quot;||&quot;&gt;&gt;&lt;&lt;pausesound $background_music&gt;&gt;&lt;&lt;/button&gt;&gt;&lt;/td&gt;&lt;/tr&gt;\n&lt;tr&gt;&lt;td&gt;Resume Music Loop (pick up where we left off): &lt;/td&gt;&lt;td&gt;&lt;&lt;button &quot;|&gt;&quot;&gt;&gt;&lt;&lt;set $currentLoops.push($background_music)&gt;&gt;&lt;&lt;playsound $background_music true&gt;&gt;&lt;&lt;/button&gt;&gt;&lt;/td&gt;&lt;/tr&gt;\s\n&lt;tr&gt;&lt;td&gt;Stop Music: &lt;/td&gt;&lt;td&gt;&lt;&lt;button &quot;[]&quot;&gt;&gt;&lt;&lt;set $currentLoops.splice($currentLoops.indexOf($background_music),1)&gt;&gt;\s\n&lt;&lt;stopsound $background_music&gt;&gt;&lt;&lt;/button&gt;&gt;&lt;/td&gt;&lt;/tr&gt;\s\n&lt;/table&gt;\s</div><div tiddler="jumpscare" tags="" created="201409251345" modifier="twee" twine-position="746,25">&lt;&lt;set $currentLoops = []&gt;&gt;\s\n&lt;&lt;set $loud_meow = &quot;cat_scream.mp3&quot;&gt;&gt;\s\n[[&lt;- quieter &amp; louder|quieter]]&lt;div align=&quot;right&quot;&gt;[[Back to intro|Start]]&lt;/div&gt;\s\n\n&lt;h2&gt;jumpscare&lt;/h2&gt;\s\n{{{&lt;&lt;jumpscare&gt;&gt;}}} plays a clip at the current system volume, regardless of whether the reader turned the story volume down.\n\nThis macro does NOT change the system volume. If the reader has their system volume down to two bars, the jumpscare sound will play at the full two bars' worth of volume.\n\nEven so, PLEASE WARN YOUR READERS BEFORE USING JUMPSCARE. Providing a warning about possible jump scares at the beginning of your story will\n\n&lt;ul&gt;\s\n&lt;li&gt;Increase suspense&lt;/li&gt;\n&lt;li&gt;Increase/maintain reader goodwill toward Twine in general&lt;/li&gt;\n&lt;li&gt;Prevent lawsuits&lt;/li&gt;\n&lt;li&gt;Prevent me from feeling guilty for providing this macro&lt;/li&gt;\n&lt;/ul&gt;\s\n\nPlease use jumpscare responsibly.\n\nJump Scare: &lt;&lt;button &quot;Reeeowwwr!&quot;&gt;&gt;&lt;&lt;jumpscare $loud_meow&gt;&gt;&lt;&lt;/button&gt;&gt;\n\nThat's everything!\n\n&lt;&lt;display &quot;questions&quot;&gt;&gt;\n\nEnjoy, and happy Twining.\n\n\n\n[[&lt;- quieter &amp; louder|quieter]]&lt;div align=&quot;right&quot;&gt;[[Back to intro|Start]]&lt;/div&gt;\n</div><div tiddler="questions" tags="" created="201409251712" modifier="twee" twine-position="344,217">&lt;h4&gt;More info about these macros&lt;/h4&gt;\s\n&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://github.com/AteYourLembas/sqTwineSound&quot; target=&quot;_blank&quot;&gt;Get the source and more on github&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://sub-q.com/questions&quot; target=&quot;_blank&quot;&gt;FAQ/Q&amp;A&lt;/a&gt; (on the sub-Q site)&lt;/li&gt;\n&lt;li&gt;&lt;a href=&quot;http://sub-q.com/forums/topic/what-would-you-like-to-see-sqtwinesound-do-that-its-not-doing/&quot; target=&quot;_blank&quot;&gt;Feature Requests&lt;/a&gt; (on the sub-Q site)&lt;/li&gt;&lt;/ul&gt;</div><div tiddler="pausesound" tags="" created="201409251343" modifier="twee" twine-position="307,20">&lt;&lt;set $currentLoops = []&gt;&gt;\s\n&lt;&lt;set $background_music = &quot;accordion.mp3&quot;&gt;&gt;\s\n&lt;&lt;set $footsteps = &quot;footsteps.mp3&quot;&gt;&gt;\s\n[[&lt;- playsound|playsound]]&lt;div align=&quot;right&quot;&gt;[[loopsound, fadesound, etc. -&gt;|loopsound]]&lt;/div&gt;\s\n\n&lt;h2&gt;pausesound, stopsound&lt;/h2&gt;\s\n\n&lt;&lt;display &quot;common controls&quot;&gt;&gt;\n\n&lt;h3&gt;{{{&lt;&lt;pausesound $background_music&gt;&gt;}}}&lt;/h3&gt;\s\nPauses $background_music at its current location. \nUse {{{&lt;&lt;playsound $background_music&gt;&gt;}}} to resume it.\n\n\n&lt;h3&gt;{{{&lt;&lt;stopsound $backgroundMusic&gt;&gt;}}}&lt;/h3&gt;\s\nStop the given sound immediately.\nIf the sound is played again, it will play from the beginning.\n\n\n\n[[&lt;- playsound|playsound]]&lt;div align=&quot;right&quot;&gt;[[loopsound, fadesound, etc. -&gt;|loopsound]]&lt;/div&gt;\s</div><div tiddler="StoryAuthor" tags="" created="201409251311" modifier="twee" twine-position="10,290">&lt;&lt;set $background_music = &quot;accordion.mp3&quot;&gt;&gt;\s\n\nsqTwineSound\nsource &amp; demo\nby Tory Hoke\n&lt;a href=&quot;http://www.twitter.com/toryhoke&quot; target=&quot;_blank&quot;&gt;@toryhoke&lt;/a&gt;\n&lt;a href=&quot;http://www.toryhoke.com&quot;&gt;toryhoke.com&lt;/a&gt;\n\nBased on sound macros\nby Leon Arnott\nof &lt;a href=&quot;http://www.glorioustrainwrecks.com&quot; target=&quot;_blank&quot;&gt;Glorious Trainwrecks&lt;/a&gt;\n\n\nA little background music\n&lt;p align=&quot;right&quot;&gt;&lt;&lt;display &quot;common controls&quot;&gt;&gt;&lt;/p&gt;\n\n[[Audio attributions|audio attribution]]\n\nDeveloped for\nTwine v 1.4.2\nSugarcube v 1.0+</div><div tiddler="playsound" tags="" created="201409251342" modifier="twee" twine-position="166,17">&lt;&lt;set $soft_meow = &quot;soft_meow.mp3&quot;&gt;&gt;\s\n&lt;&lt;set $background_music = &quot;accordion.mp3&quot;&gt;&gt;\s\n[[&lt;- Back to start|Start]]&lt;div align=&quot;right&quot;&gt;[[pausesound, stopsound -&gt;|pausesound]]&lt;/div&gt;\s\n\n&lt;h2&gt;playsound, updatevolume&lt;/h2&gt;\s\n\nPlay Cat Meow at full available volume: &lt;&lt;button &quot;|&gt;&quot;&gt;&gt;&lt;&lt;stopsound $soft_meow&gt;&gt;&lt;&lt;playsound $soft_meow 1.0&gt;&gt;&lt;&lt;/button&gt;&gt;\nPlay Cat Meow at 1/2 volume: &lt;&lt;button &quot;|&gt;&quot;&gt;&gt;&lt;&lt;stopsound $soft_meow&gt;&gt;&lt;&lt;playsound $soft_meow 0.5&gt;&gt;&lt;&lt;/button&gt;&gt;\nPlay Cat Meow at 1/4 volume, with fade in, on loop: &lt;&lt;button &quot;|&gt;&quot;&gt;&gt;&lt;&lt;stopsound $soft_meow&gt;&gt;&lt;&lt;fadeinsound $soft_meow 0.25&gt;&gt;&lt;&lt;/button&gt;&gt;\nStop All Sound: &lt;&lt;button &quot;[]&quot;&gt;&gt;&lt;&lt;stopallsound&gt;&gt;&lt;&lt;/button&gt;&gt;\n\n&lt;h3&gt;{{{&lt;&lt;playsound &quot;introMusic.mp3&quot; 0.5 200 true&gt;&gt;}}}&lt;/h3&gt;\s\n{{{&lt;&lt;playsound&gt;&gt;}}} lets you do a little bit of sound mixing.\n\n Parameters:\n\n&lt;ul&gt;&lt;li&gt;REQUIRED: clipName (e.g. &quot;backgroundMusic.mp3&quot; or $backgroundMusic)&lt;/li&gt;&lt;li&gt;OPTIONAL: decimal proportion of volume (0.0 being minimum/mute, and 1.0 being maximum/default)&lt;/li&gt;&lt;li&gt;OPTIONAL: number of milliseconds to overlap/crossfade the loop (1000 ms by default, must be &gt;= 10 ms if declared)&lt;/li&gt;&lt;li&gt;OPTIONAL: true if you'd like to loop, false if no&lt;/li&gt;&lt;/ul&gt;\s\n\nSo this plays a clip once, no fade, at full global volume:\n\n {{{&lt;&lt;playsound $walla&quot;&gt;&gt;}}}\n\nThis fades in a quiet background $walla that will loop and crossfade with 2000 ms (2 seconds) of overlap:\n \n {{{&lt;&lt;playsound $walla 0.2 2000 true&gt;&gt;}}}\n\n This plays $meow once, no fade, at loudest available volume:\n \n {{{&lt;&lt;playsound $meow 1.0&gt;&gt;}}}\n\nThe last used volume will be remembered when you stop and restart the clip.\n\nNOTE: It's best practice to stop a sound before attempting to play it again. Any attempt to play a sound already playing is ignored.\s\n\n&lt;h3&gt;{{{&lt;&lt;updatevolume $backgroundMusic 0.5&gt;&gt;}}}&lt;/h3&gt;\s\nGiven a decimal between 0.0 and 1.0, update the clip's volume proportion and the clip's actual volume.\n\nParameters:\n\n&lt;ul&gt;&lt;li&gt;REQUIRED: clipName (e.g. &quot;backgroundMusic.mp3&quot; or $backgroundMusic)&lt;/li&gt;&lt;li&gt;REQUIRED: decimal proportion of volume (0.0 being minimum/mute, and 1.0 being maximum/default)&lt;/li&gt;&lt;/ul&gt;\s\n\n\nLoop Music at 0.50 volume: &lt;&lt;button &quot;|&gt;&quot;&gt;&gt;&lt;&lt;fadeinsound $background_music 0.50&gt;&gt;&lt;&lt;/button&gt;&gt;\nChange volume to 0.10 volume: &lt;&lt;button &quot;Volume 0.10&quot;&gt;&gt;&lt;&lt;updatevolume $background_music 0.10&gt;&gt;&lt;&lt;/button&gt;&gt;\nChange volume to 0.90 volume: &lt;&lt;button &quot;Volume 0.90&quot;&gt;&gt;&lt;&lt;updatevolume $background_music 0.90&gt;&gt;&lt;&lt;/button&gt;&gt;\nStop Music: &lt;&lt;button &quot;[]&quot;&gt;&gt;&lt;&lt;stopsound $background_music&gt;&gt;&lt;&lt;/button&gt;&gt;\n\n[[&lt;- Back to start|Start]]&lt;div align=&quot;right&quot;&gt;[[pausesound, stopsound -&gt;|pausesound]]&lt;/div&gt;\s</div><div tiddler="main" tags="stylesheet" created="201409252041" modifier="twee" twine-position="17,720">/* Your story will use the CSS in this passage to style the page.\nGive this passage more tags, and it will only affect passages with those tags.\nExample selectors: */\n\nbody {\n\t/* This affects the entire page */\n\tcolor: #FFF;\n\tbackground-color: #587e7e;\n\t\n}\n\n#ui-bar {\n width: 250px;\n\n}\n\n\n#passages {\n margin-left: 125px;\n width: 75%;\n min-height: 100%;\n padding-bottom: 0;\n margin-bottom: 0;\n border: 0;\n}\n\n.passage {\n\t/* This only affects passages */\n\tfont-size: medium;\n\t\n}\n.passage a {\n\t/* This affects passage links */\n\tcolor: #F2F5A9;\n\t\n}\n.passage a:hover {\n\t/* This affects links while the cursor is over them */\n\t\n\tcolor: #FFBF00;\n\n}</div><div tiddler="multiple loop controls" tags="" created="201409251537" modifier="twee" twine-position="774,681">&lt;table&gt;\s\n&lt;tr&gt;&lt;td&gt;Fade in Footsteps at 3/4 volume w/ 2 second fade: &lt;/td&gt;&lt;td&gt;&lt;&lt;button &quot;Fade in&quot;&gt;&gt;&lt;&lt;set $currentLoops.push($footsteps)&gt;&gt;&lt;&lt;fadeinsound $footsteps 0.75 2000&gt;&gt;&lt;&lt;/button&gt;&gt;&lt;/td&gt;&lt;/tr&gt;\s\n&lt;tr&gt;&lt;td&gt;Fade out Footsteps: &lt;/td&gt;&lt;td&gt;&lt;&lt;button &quot;Fade out&quot;&gt;&gt;&lt;&lt;set $currentLoops.splice($currentLoops.indexOf($footsteps),1)&gt;&gt;\s\n&lt;&lt;fadeoutsound $footsteps&gt;&gt;&lt;&lt;/button&gt;&gt;&lt;/td&gt;&lt;/tr&gt;\s\n&lt;tr&gt;&lt;td&gt;Fade Out All Current Loops: &lt;/td&gt;&lt;td&gt;&lt;&lt;button &quot;Fade Out All&quot;&gt;&gt;&lt;&lt;fadeoutsounds $currentLoops&gt;&gt;&lt;&lt;set $currentLoops.splice($currentLoops.indexOf($background_music),1)&gt;&gt;&lt;&lt;set $currentLoops.splice($currentLoops.indexOf($footsteps),1)&gt;&gt;&lt;&lt;/button&gt;&gt;&lt;/td&gt;&lt;/tr&gt;\s\n&lt;tr&gt;&lt;td&gt;Pause All Sounds : &lt;/td&gt;&lt;td&gt;&lt;&lt;button &quot;*||*&quot;&gt;&gt;&lt;&lt;pauseallsound&gt;&gt;&lt;&lt;/button&gt;&gt;&lt;/td&gt;&lt;/tr&gt;\s\n&lt;tr&gt;&lt;td&gt;Resume Any Paused Sounds/Loops : &lt;/td&gt;&lt;td&gt;&lt;&lt;button &quot;Resume All&quot;&gt;&gt;&lt;&lt;playsounds $currentLoops&gt;&gt;&lt;&lt;/button&gt;&gt;&lt;/td&gt;&lt;/tr&gt;\s\n&lt;tr&gt;&lt;td&gt;Stop All Sound : &lt;/td&gt;&lt;td&gt;&lt;&lt;button &quot;*[]*&quot;&gt;&gt;&lt;&lt;stopallsound&gt;&gt;&lt;&lt;set $currentLoops.splice($currentLoops.indexOf($background_music),1)&gt;&gt;&lt;&lt;set $currentLoops.splice($currentLoops.indexOf($footsteps),1)&gt;&gt;&lt;&lt;/button&gt;&gt;&lt;/td&gt;&lt;/tr&gt;\s\n&lt;/table&gt;</div><div tiddler="sqTwineSound Macros v0.8.0" tags="script" created="201409251426" modifier="twee" twine-position="14,435">/*\nsqTwineSound HTML5 Sound Macro Suite\nCopyright 2014 Tory Hoke\n\nProgram URI: http://www.sub-q.com/plugins/sqTwineSound/\nDescription: Sound macros for Twine creations, including controls for volume, fade interval, and playing multiple tracks at once.\nVersion: 0.8.0\nAuthor: Tory Hoke\nAuthor URI: http://www.toryhoke.com\nLicense: GNU General Public License\nLicense URI: http://www.opensource.org/licenses/gpl-license.php\nRepository: https://github.com/AteYourLembas/sqTwineSound\nFAQ / Q &amp; A: http://sub-q.com/questions (password: ThinkVast)\nBug Reports/Feature Requests: http://sub-q.com/forums/topic/what-would-you-like-to-see-sqtwinesound-do-that-its-not-doing/ (password: ThinkVast)\n\n sub-Q.com is password-protected while it's in beta (until January 2015.)\n Please kick the tires and report any issues with the website\n via the sub-Q.com Contact form.\n\n\nThis program based on:\nTwine: HTML5 sound macros by Leon Arnott of Glorious Trainwrecks\nthe source and influence of which appear under a Creative Commons CC0 1.0 Universal License\n\nThis program uses\n\n easeInOutSine()\n Copyright © 2001 Robert Penner\n All rights reserved.\n \n As distributed by Kirupa\n http://www.kirupa.com/forum/showthread.php?378287-Robert-Penner-s-Easing-Equations-in-Pure-JS-(no-jQuery)\n \n Open source under the BSD License. \n \n \n Redistribution and use in source and binary forms, with or without modification, \n are permitted provided that the following conditions are met:\n \n Redistributions of source code must retain the above copyright notice, this list of \n conditions and the following disclaimer.\n Redistributions in binary form must reproduce the above copyright notice, this list \n of conditions and the following disclaimer in the documentation and/or other materials \n provided with the distribution.\n \n Neither the name of the author nor the names of contributors may be used to endorse \n or promote products derived from this software without specific prior written permission.\n \n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot; AND ANY \n EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\n GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED \n AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED \n OF THE POSSIBILITY OF SUCH DAMAGE. \n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n \nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\n*/\n\n(function () {\n version.extensions.soundMacros = {\n major: 0,\n minor: 8,\n revision: 0\n };\n\n var globalVolume = 1.0;\n var updateInterval = 10; //Update sound volume, etc. once every 10 ms\n var defaultOverlap = 1000; //Default track overlap is 1000 ms\n var minVolume = 0.01; // Minimum possible volume -- 0 is mute, so we want somethings slightly above that\n var soundInterval = 0.1; // Creates an interval of 1/10 creates ten stages of loudness. Used by quieter/louder. Feel free to tweak\n var fileExtensions = [&quot;ogg&quot;, &quot;mp3&quot;, &quot;wav&quot;, &quot;webm&quot;]; // Acceptable file extensions for audio\n var clips = {};\n\n // Convenience vars\n var clipNameLabel = &quot;Clip Name&quot;;\n var overlapLabel = &quot;Overlap&quot;;\n var volumeProportionLabel = &quot;Volume Proportion&quot;;\n var loopLabel = &quot;Loop?&quot;;\n\n\n //------------ Robert Penner via Kirupa math methods ----------\n //-------------------------------------------------------------\n\n function easeInOutSine(currentIteration, startValue, changeInValue, totalIterations) {\n return changeInValue / 2 * (1 - Math.cos(Math.PI * currentIteration / totalIterations)) + startValue;\n }\n\n\n //------------ End Math methods -------------------------------\n //-------------------------------------------------------------\n\n //------------- pausableTimeout ---------\n //--------------------------------------\n function pausableTimeout(func, params) {\n\n this.funcToRun = func;\n this.waitStartTime = -1;\n this.waitEndTime = -1;\n this.waitDuration = -1;\n\n this.activate = function(waitDuration) {\n\n if (this.pausedAt !== undefined) { this.waitDuration = this.timeRemaining(); }\n else if (waitDuration !== undefined) this.waitDuration = waitDuration;\n else if (this.waitDuration &gt; -1 ) { console.log(&quot;Warning: No wait duration given to pausableTimeout. Using last specified one.&quot;); }\n else return; // Don't bother to start a loop with no wait duration\n\n this.waitStartTime = new Date().getTime();\n this.waitEndTime = new Date().getTime() + this.waitDuration;\n this.timeout = setTimeout(this.funcToRun, this.waitDuration, params);\n };\n\n this.deactivate = function() {\n this.pausedAt = this.timeElapsed();\n if (this.timeout !== undefined) clearTimeout(this.timeout);\n };\n\n this.stopAndClear = function() {\n if (this.pausedAt !== undefined) delete this.pausedAt;\n if (this.timeout !== undefined) { clearTimeout(this.timeout); delete this.timeout; }\n };\n\n this.timeElapsed = function() {\n return new Date().getTime() - this.waitStartTime;\n };\n\n this.timeRemaining = function() {\n if (this.pausedAt !== undefined) return this.waitDuration - this.pausedAt;\n return this.waitEndTime - new Date().getTime();\n };\n }\n //------------- /pausableTimeout --------\n //--------------------------------------\n\n\n //------------- sqAudio ----------------\n //--------------------------------------\n function sqAudio(fullPath, clipName, fileExt) {\n\n this.fullPath = fullPath;\n this.clipName = clipName; // Let a clip know its own name\n this.fileExt = fileExt;\n\n // Defaults\n this.volumeProportion = 1.0; // By default, full volume\n this.overlap = defaultOverlap; // By default, defaultOverlap ms\n this.isPlayable = false; // Assume audio is not playable\n this.looping = false; // Assume audio not looping\n this.alternate = false;\n this.mainAudio = new Audio();\n this.partnerAudio = new Audio();\n\n this.mainAudio.setAttribute(&quot;src&quot;, this.fullPath);\n if (this.mainAudio.canPlayType) {\n for (var i = -1; i &lt; fileExtensions.length; i += 1) {\n if (i &gt;= 0) fileExt = fileExtensions[i];\n if (this.mainAudio.canPlayType(&quot;audio/&quot; + fileExt)) break;\n }\n if (i &lt; fileExtensions.length) {\n this.mainAudio.interval = null;\n this.partnerAudio.setAttribute(&quot;src&quot;, this.fullPath);\n this.partnerAudio.interval = null;\n this.isPlayable = true;\n\n } else {\n console.log(&quot;Browser can't play '&quot; + this.clipName + &quot;'&quot;);\n }\n } \n\n // Convenience method for getting duration\n // TODO : protect this against audio not being loaded yet\n //\n this.getDuration = function () {\n\n return this.mainAudio.duration;\n };\n\n // Get what we consider the current audio track\n //\n this._getActiveAudio = function() {\n return (this.alternate) ? this.partnerAudio : this.mainAudio;\n };\n\n // Get what we consider the idle audio track\n //\n this._getIdleAudio = function() {\n return (this.alternate) ? this.mainAudio : this.partnerAudio;\n };\n\n\n\n // Perform fade on specified audio\n // Use ease\n //\n this.__fadeSound = function(audioObj, fadeIn) {\n\n var startVolume = fadeIn ? 0 : globalVolume * this.volumeProportion;\n var deltaVolume = globalVolume * this.volumeProportion * (fadeIn ? 1 : -1);\n\n //alert(&quot;__fadeSound! fadeIn &quot; + fadeIn + &quot;, globalVolume &quot; + globalVolume + &quot;, volProp &quot; + this.volumeProportion + &quot; startVol &quot; + startVolume + &quot; deltaVolume &quot; + deltaVolume);\n\n // Handy vars for easing\n var totalIterations = this.overlap/updateInterval;\n var currentIteration = 1;\n\n audioObj.interval = setInterval(function() {\n\n //Use easing to prevent sound popping in or out\n //\n var desiredVolume = easeInOutSine(currentIteration, startVolume, deltaVolume, totalIterations);\n \n //alert(&quot;Well desiredVol is &quot; + desiredVolume + &quot; cos currIter &quot; + currentIteration + &quot; startVol &quot; + startVolume + &quot; delta vol &quot; + deltaVolume + &quot; total iter &quot; + totalIterations);\n //This should never happen, but if it does, skip the fade\n if (isNaN(desiredVolume)) {\n audioObj.volume = startVolume + deltaVolume;\n console.log(&quot;There was a problem with the fade. Possibly overlap &quot; + this.overlap + &quot; is shorter than updateInterval &quot; + updateInterval + &quot;? &quot;);\n } else {\n audioObj.volume = desiredVolume;\n }\n currentIteration += 1;\n \n if (audioObj.volume === (startVolume + deltaVolume)) { \n //alert(&quot;Grats! You reached your destination of &quot; + audioObj.volume); \n clearInterval(audioObj.interval); \n }\n\n //This effectively stops the loop and poises the volume to be played again\n //That way the clip isn't needlessly looping when no one can hear it.\n if (audioObj.volume === 0) {\n audioObj.pause();\n audioObj.currentTime = 0;\n }\n }, updateInterval);\n\n };\n\n\n // Manages starting one loop before the last play has ended\n // and cross-fading the ends\n //\n this._crossfadeLoop = function(params) {\n\n var sqAudioObj = params[0];\n var currAudioObj = params[1];\n\n // Let loop expire if no longer looping\n //\n if (!sqAudioObj.looping) { return; }\n\n var nextAudioObj = sqAudioObj.alternate ? sqAudioObj.mainAudio : sqAudioObj.partnerAudio;\n sqAudioObj.alternate = !sqAudioObj.alternate;\n\n // Don't even bother with crossfade if there's no overlap\n if (sqAudioObj.overlap !== undefined &amp;&amp; sqAudioObj.overlap &gt; 1) {\n\n // fade out current sound\n //\n sqAudioObj._fadeSound(currAudioObj, false);\n\n // And fade in our partner\n //\n //nextAudioObj.volume = 0; \n //if (nextAudioObj.currentTime &gt; 0) nextAudioObj.currentTime = 0;\n //nextAudioObj.play();\n sqAudioObj._fadeSound(nextAudioObj, true);\n\n }\n else {\n sqAudioObj.updateVolume(); \n nextAudioObj.currentTime = 0;\n nextAudioObj.play();\n }\n\n // Kick off the next timer to crossfade\n // Might as well garbage collect the old crossfadeTimeout, too.\n //\n //if (sqAudioObj.crossfadeTimeout !== undefined) { sqAudioObj.crossfadeTimeout.stopAndClear(); delete sqAudioObj.crossfadeTimeout; }\n //if (isNaN(sqAudioObj.getDuration())) { throwError(&quot;Can't loop because duration is not known (audio not loaded, probably not found.)&quot;); return; }\n //sqAudioObj.crossfadeTimeout = new pausableTimeout(sqAudioObj._crossfadeLoop, [sqAudioObj, nextAudioObj]); \n //sqAudioObj.crossfadeTimeout.activate(sqAudioObj.getDuration()*1000-sqAudioObj.overlap);\n\n };\n\n\n this._fadeSound = function(activeAudioObj, fadeIn) {\n\n // Set the goal volume as a proportion of the global volume\n // (e.g. if global volume is 0.4, and volume proportion is 0.25, overall the goal volume is 0.1)\n //\n var goalVolume = globalVolume * this.volumeProportion;\n if (activeAudioObj.interval) clearInterval(activeAudioObj.interval);\n if (fadeIn) {\n if (activeAudioObj.currentTime &gt; 0) activeAudioObj.currentTime = 0;\n activeAudioObj.volume = 0; \n this.loop();\n\n } else {\n\n if (!activeAudioObj.currentTime) return;\n activeAudioObj.volume = goalVolume;\n activeAudioObj.play();\n }\n this.__fadeSound(activeAudioObj, fadeIn);\n\n };\n\n\n // Fade sound on whatever the active audio is\n //\n this.fadeSound = function(fadeIn) {\n if (fadeIn) {\n this.stopAndClear();\n this.looping = true;\n }\n else this.looping = false;\n this._fadeSound(this._getActiveAudio(), fadeIn);\n };\n\n // Update volume proportion and volume of both audio clips\n //\n this.setVolumeProportion = function(volumeProportion) {\n this.volumeProportion = volumeProportion;\n };\n\n // Update volume of active audio clips (assumes vol proportion and global vol already set)\n //\n this.updateVolume = function() {\n\n //alert(&quot;about to set vol to &quot; + globalVolume + &quot; x &quot; + this.volumeProportion);\n this._getActiveAudio().volume = globalVolume * this.volumeProportion;\n };\n\n // Play the current audio object and reactivate any paused timer\n //\n this.play = function(loop) {\n\n //If it's a loop we want, just loop and don't make a big deal out of it\n if (loop) this.loop();\n\n else {\n\n var activeAudioObj = this._getActiveAudio();\n if (activeAudioObj) { \n activeAudioObj.play();\n }\n }\n };\n\n // Pause whatever audio is currently playing and pause the timer, too\n //\n this.pause = function() {\n if (this.crossfadeTimeout !== undefined) this.crossfadeTimeout.deactivate();\n this._getActiveAudio().pause();\n };\n\n // Stop whatever audio is currently playing and dump the timer\n //\n this.stopAndClear = function() {\n var activeAudioObj = this._getActiveAudio();\n activeAudioObj.pause();\n if (activeAudioObj.currentTime &gt; 0) activeAudioObj.currentTime = 0;\n if (this.crossfadeTimeout !== undefined) { this.crossfadeTimeout.stopAndClear(); delete this.crossfadeTimeout; }\n };\n\n\n // Loop the track\n //\n this.loop = function() {\n\n this.looping = true;\n var activeAudioObj = this._getActiveAudio();\n\n // Create new timeout if one does not already exist; otherwise just reuse the existing one\n //\n this.crossfadeTimeout = (this.crossfadeTimeout === undefined) ? new pausableTimeout(this._crossfadeLoop, [this, activeAudioObj]) : this.crossfadeTimeout; \n if (isNaN(this.getDuration())) { return throwError(&quot;Can't loop because duration is not known (audio not loaded, probably not found.)&quot;); }\n this.crossfadeTimeout.activate((this.getDuration()*1000)-this.overlap);\n activeAudioObj.play();\n };\n\n\n }\n //------------ /sqAudio ----------------\n //--------------------------------------\n\n\n\n /***********************************************************\n * MAIN METHOD\n /***********************************************************\n /\n / Here be monsters. Proceed with caution.\n /\n */\n\n // Verify that the audio can be played in browser\n //\n function parseAudio(c) {\n\n var d = c.exec(div.innerHTML); // returns list of form [&quot;url/to/audio.fileType&quot;,/to/audio,fileType]\n\n while(d) {\n if (d) {\n if (!clips.hasOwnProperty(d[1])) {\n\n var parser = document.createElement('a');\n parser.href = d[1].toString();\n var pathnameSubstrings = parser.pathname.split(&quot;/&quot;);\n var clipName = pathnameSubstrings[pathnameSubstrings.length-1];\n var sqAudioObj = new sqAudio(parser.href + &quot;.&quot; + d[2].toString(), clipName, d[2].toString());\n if (sqAudioObj.isPlayable) { clips[clipName] = sqAudioObj;}\n }\n }\n d = c.exec(div.innerHTML); // yes, we could just do a do/while, but some envs don't like that\n }\n }\n\n // Parse all used audio file names\n // Use whatever store area element is available in the story format\n //\n var storeElement = (document.getElementById(&quot;store-area&quot;) ? document.getElementById(&quot;store-area&quot;) : document.getElementById(&quot;storeArea&quot;));\n var div = storeElement.firstChild;\n while (div) {\n var b = String.fromCharCode(92);\n var q = '&quot;';\n var re = &quot;['&quot; + q + &quot;]([^&quot; + q + &quot;']*?)&quot; + b + &quot;.(&quot; + fileExtensions.join(&quot;|&quot;) + &quot;)['&quot; + q + &quot;]&quot;;\n parseAudio(new RegExp(re, &quot;gi&quot;));\n div = div.nextSibling;\n }\n /***********************************************************\n * END MAIN METHOD\n /***********************************************************/\n\n\n\n /***********************************************************\n * SUPPORTING FUNCTIONS FOR THE MACROS\n /***********************************************************\n /\n / Here be monsters.\n /\n */\n\n // Given the clipName, get the active soundtrack\n //\n function getSoundTrack(clipName) {\n clipName = cleanClipName(clipName.toString());\n if (!clips.hasOwnProperty(clipName)) { return throwError(&quot;Given clipName &quot; + clipName + &quot; does not exist in this project. Please check your variable names.&quot;); }\n return clips[clipName];\n\n }\n\n\n // Centralized function for sound fading\n //\n function fadeSound(clipName, fadeIn) {\n\n var soundtrack = getSoundTrack(clipName);\n if (soundtrack === &quot;undefined&quot;) { return throwError(&quot;audio clip &quot; + clipName + &quot; not found&quot;); } \n soundtrack.fadeSound(fadeIn);\n \n }\n\n\n // Adjust the volume of ALL audio in the page\n //\n function adjustVolume(direction) {\n\n // Note soundInterval and minVolume are declared globally (at top of the script)\n var maxVolume = 1.0; // This is native to JavaScript. Changing will cause unexpected behavior\n globalVolume = Math.max(minVolume, Math.min(maxVolume, globalVolume + (soundInterval * direction)));\n for (var soundIndex in clips) {\n if (clips.hasOwnProperty(soundIndex)) {\n clips[soundIndex].updateVolume();\n }\n }\n }\n\n // Common argument management\n // Because of the total expected arguments (one string, one float, one int, one boolean)\n // This method attempts to be forgiving of sequence. \n // Be advised if there were even one more argument, it probably couldn't be so forgiving anymore!\n //\n function manageCommonArgs(func, requiredArgs) {\n\n // Look at the list of available arguments, clean them up, and take the first one of each desired type:\n // Recreate the arguments as a list in required sequence [clipName, volumeProportion, overlap, loop]\n\n var clipName;\n var volumeProportion;\n var overlap;\n var loop;\n\n for (var i = 0; i &lt; func.args.length; i++) {\n switch (typeof func.args[i]) {\n case &quot;string&quot; :\n if (clipName === undefined) clipName = func.args[i].toString();\n break;\n case &quot;number&quot; :\n var tempNum = parseFloat(func.args[i]);\n if (volumeProportion === undefined &amp;&amp; tempNum &lt;= 1.0) volumeProportion = tempNum;\n else if (overlap === undefined &amp;&amp; tempNum &gt;=updateInterval) overlap = tempNum; \n break;\n case &quot;boolean&quot; :\n if (loop === undefined) loop = func.args[i];\n break;\n }\n }\n\n for (var requiredArg in requiredArgs) {\n if (requiredArgs.hasOwnProperty(requiredArg)) {\n switch (requiredArg) {\n case clipNameLabel :\n if (clipName === undefined) { return throwError(&quot;No audio clip name specified.&quot;); } \n break;\n case volumeProportionLabel :\n if (volumeProportion === undefined || volumeProportion &gt; 1.0 || volumeProportion &lt; 0.0) { return throwError(&quot;No volume proportion specified (must be a decimal number no smaller than 0.0 and no bigger than 1.0.)&quot;); }\n break;\n case overlapLabel :\n if (overlap === undefined) { return throwError(&quot;No fade duration specified (must be a number in milliseconds greater than + &quot; + updateInterval + &quot; ms.)&quot;); }\n break;\n case loopLabel :\n if (loop === undefined) { return throwError(&quot;No loop flag provided (must be a boolean, aka true or false.)&quot;); }\n break;\n }\n }\n }\n return [clipName, volumeProportion, overlap, loop];\n }\n\n // Get the clipName up to the . if a . exists, otherwise do no harm\n //\n function cleanClipName(clipName) {\n\n var parser = document.createElement('a');\n parser.href = clipName.toString();\n var pathnameSubstrings = parser.pathname.split(&quot;/&quot;);\n clipName = pathnameSubstrings[pathnameSubstrings.length-1];\n return clipName.lastIndexOf(&quot;.&quot;) &gt; -1 ? clipName.slice(0, clipName.lastIndexOf(&quot;.&quot;)) : clipName;\n }\n\n\n /***********************************************************\n * END SUPPORTING FUNCTIONS FOR THE MACROS\n /***********************************************************/\n\n\n\n /***********************************************************\n /***********************************************************\n * MACROS\n /***********************************************************\n /***********************************************************\n */\n\n /* updatevolume\n \n Given a decimal between 0.0 and 1.0, \n updates the clip's volume proportion and the clip's actual volume\n \n */\n macros.add(&quot;updatevolume&quot;, {\n handler: function () {\n \n var args = manageCommonArgs(this, [clipNameLabel, volumeProportionLabel]);\n var soundtrack = getSoundTrack(this.args[0]);\n soundtrack.setVolumeProportion(args[1]);\n soundtrack.updateVolume();\n }\n });\n\n /** playsound \n\n This version of the macro lets you do a little bit of sound mixing.\n \n Parameters:\n\n REQUIRED: clipName \n OPTIONAL: decimal proportion of volume (0.0 being minimum/mute, and 1.0 being maximum/default)\n OPTIONAL: number of milliseconds to overlap/crossfade the loop (0 ms by default)\n OPTIONAL: true if you'd like to loop, false if no\n \n \n */\n macros.add(&quot;playsound&quot;, {\n handler : function () {\n\n var args = manageCommonArgs(this, [clipNameLabel]);\n\n var soundtrack = getSoundTrack(this.args[0]);\n var volumeProportion = args[1] !== undefined ? args[1] : soundtrack.volumeProportion;\n soundtrack.overlap = args[2] !== undefined ? args[2] : defaultOverlap;\n var loop = args[3] !== undefined ? args[3] : false;\n soundtrack.setVolumeProportion(volumeProportion);\n soundtrack.updateVolume();\n soundtrack.play(loop); \n }\n });\n\n\n /* playsounds\n \n Play multiple sounds at once (picking up where we left off)\n If you give it no sounds to play, it quietly ignores the command.\n\n Parameters:\n\n OPTIONAL: clipName\n OPTIONAL: decimal proportion of volume (0.0 being minimum/mute, and 1.0 being maximum/default)\n OPTIONAL: number of milliseconds to overlap/crossfade (0 ms by default)\n OPTIONAL: true if you'd like to loop, false if no\n \n /\n */\n macros.add(&quot;playsounds&quot;, {\n handler: function () {\n\n var clipNameString = this.args[0];\n if (this.args[0] === undefined || this.args[0] == &quot;&quot;) return;\n clipNameString = this.args[0].toString();\n if (clipNameString == &quot;[]&quot;) return;\n var clipNames = clipNameString.split(&quot;,&quot;);\n if (clipNames.length &lt; 1) return;\n var args = manageCommonArgs(this);\n for (var index = 0; index &lt; clipNames.length; index++) {\n var soundtrack = getSoundTrack(cleanClipName(clipNames[index]));\n var volumeProportion = args[1] !== undefined ? args[1] : soundtrack.volumeProportion;\n soundtrack.overlap = args[2] !== undefined ? args[2] : defaultOverlap;\n var loop = args[3] !== undefined ? args[3] : false;\n soundtrack.setVolumeProportion(volumeProportion);\n soundtrack.updateVolume();\n soundtrack.play(loop); \n }\n }\n });\n\n\n\n /* pausesound\n \n Pauses clip at its current location. \n Use playsound to resume it.\n\n Parameters:\n\n REQUIRED: clipName\n\n */ \n macros.add(&quot;pausesound&quot;, {\n handler: function() {\n var args = manageCommonArgs(this, [clipNameLabel]); \n getSoundTrack(this.args[0]).pause();\n }\n });\n\n\n /* &lt;&lt;pauseallsound&gt;&gt; \n \n Pauses all sounds at their current location. \n \n If you'd like the option to start multiple sounds,\n take a look at &lt;&lt;playsounds&gt;&gt; and &lt;&lt;fadeinsounds&gt;&gt;\n */ \n macros.add(&quot;pauseallsound&quot;, {\n handler: function () {\n for (var clipName in clips) {\n if (clips.hasOwnProperty(clipName)) {\n getSoundTrack(clipName).pause();\n }\n }\n }\n });\n\n /* stopsound\n \n Stop the given sound immediately\n If the sound is played again, it will play from the beginning\n \n Parameters:\n\n REQUIRED: clipName \n */ \n macros.add(&quot;stopsound&quot;, {\n handler: function() {\n var args = manageCommonArgs(this, [clipNameLabel]); \n getSoundTrack(this.args[0]).stopAndClear();\n }\n });\n\n\n /* &lt;&lt;stopallsound&gt;&gt;\n \n Stops all sounds immediately.\n If any stopped sound is played again, it will play from the beginning\n \n If you'd like the option to start multiple sounds,\n take a look at &lt;&lt;playsounds&gt;&gt; and &lt;&lt;fadeinsounds&gt;&gt;\n */ \n macros.add(&quot;stopallsound&quot;, {\n handler: function () {\n for (var clipName in clips) {\n if (clips.hasOwnProperty(clipName)) {\n if (clips[clipName] !== undefined) clips[clipName].stopAndClear();\n }\n }\n }\n });\n\n /* loopsound\n \n Starts playing the given clip on repeat.\n Note that browsers will not necessarily play looping audio seamlessly.\n For seamless audio, use a fade duration/overlap (third parameter) greater than 1 millisecond\n (Well, you probably want something more perceptibe than 1 millisecond!)\n \n Parameters:\n\n REQUIRED: clipName \n OPTIONAL: decimal proportion of volume (0.0 being minimum/mute, and 1.0 being maximum/default)\n OPTIONAL: number of milliseconds to overlap/crossfade the loop (0 ms by default)\n */ \n macros.add(&quot;loopsound&quot;, {\n handler: function () {\n \n var args = manageCommonArgs(this, [clipNameLabel]);\n var soundtrack = getSoundTrack(this.args[0]);\n var volumeProportion = args[1] !== undefined ? args[1] : soundtrack.volumeProportion;\n soundtrack.overlap = args[2] !== undefined ? args[2] : defaultOverlap;\n soundtrack.setVolumeProportion(volumeProportion);\n soundtrack.updateVolume();\n soundtrack.loop();\n }\n });\n\n\n /* unloopsound \n \n Let the given sound stop when it finishes its current loop\n (so the sound no longer repeats.)\n\n Parameters:\n\n REQUIRED: clipName \n\n */ \n macros.add(&quot;unloopsound&quot;, {\n handler: function () {\n var args = manageCommonArgs(this, [clipNameLabel]); \n getSoundTrack(this.args[0]).looping = false;\n }\n });\n\n\n /* fadeinsound\n \n Identical to loopsound, but fades in the sound over 2 seconds.\n\n Parameters:\n\n REQUIRED: clipName\n OPTIONAL: decimal proportion of volume (0.0 being minimum/mute, and 1.0 being maximum/default)\n OPTIONAL: number of milliseconds to overlap/crossfade the loop (defaults to clip's last set overlap)\n\n */\n macros.add(&quot;fadeinsound&quot;, {\n handler: function () {\n\n var args = manageCommonArgs(this, [clipNameLabel]);\n \n var soundtrack = getSoundTrack(this.args[0]);\n var volumeProportion = args[1] !== undefined ? args[1] : soundtrack.volumeProportion; \n soundtrack.overlap = args[2] !== undefined ? args[2] : soundtrack.overlap;\n soundtrack.volumeProportion=volumeProportion;\n soundtrack.fadeSound(true);\n }\n });\n\n /* fadeinsounds\n\n Fade in multiple sounds at once.\n \n Parameters:\n\n REQUIRED: clipNames as list \n OPTIONAL: decimal proportion of volume (0.0 being minimum/mute, and 1.0 being maximum/default)\n OPTIONAL: number of milliseconds to overlap/crossfade the loop (defaults to clip's last set overlap)\n \n */\n macros.add(&quot;fadeinsounds&quot;, {\n handler: function () {\n\n var clipNameString = this.args[0];\n if (this.args[0] === undefined || this.args[0] == &quot;&quot;) return;\n clipNameString = this.args[0].toString();\n if (clipNameString == &quot;[]&quot;) return;\n var clipNames = clipNameString.split(&quot;,&quot;);\n if (clipNames.length &lt; 1) return;\n\n var args = manageCommonArgs(this);\n\n for (var index = 0; index &lt; clipNames.length; index++) {\n var soundtrack = getSoundTrack(this.args[0]);\n var volumeProportion = args[1] !== undefined ? args[1] : soundtrack.volumeProportion; \n soundtrack.overlap = args[2] !== undefined ? args[2] : soundtrack.overlap;\n soundtrack.volumeProportion=volumeProportion;\n soundtrack.fadeSound(true); \n }\n }\n });\n\n /* fadeoutsound\n \n Identical to stopsound, but fades out the sound over the stored fade duration (overlap).\n \n Parameters:\n\n REQUIRED: clipName \n\n */\n macros.add(&quot;fadeoutsound&quot;, {\n handler: function () {\n var args = manageCommonArgs(this, [clipNameLabel]); \n fadeSound(this.args[0].toString(), false);\n }\n });\n\n\n /* fadeoutsounds\n \n Fade out multiple sounds at once.\n If you give it no sounds to play, it quietly ignores the command.\n\n Parameters:\n\n REQUIRED: clipNames as list \n \n */\n macros.add(&quot;fadeoutsounds&quot;, {\n handler: function () {\n\n var clipNameString = this.args[0];\n if (this.args[0] === undefined) return;\n clipNameString = this.args[0].toString();\n if (clipNameString == &quot;[]&quot;) return;\n var clipNames = clipNameString.split(&quot;,&quot;);\n if (clipNames.length &lt; 1) return;\n\n for (var index = 0; index &lt; clipNames.length; index++) {\n fadeSound(cleanClipName(clipNames[index]), false);\n }\n }\n });\n\n\n /* &lt;&lt;quieter&gt;&gt;\n \n Reduces the story's globalVolume by 1/10th of the reader's system volume.\n Thus creates a 10-unit volume range for the story\n \n */\n macros.add(&quot;quieter&quot;, {\n handler: function () {\n adjustVolume(-1);\n }\n });\n\n /* &lt;&lt;louder&gt;&gt;\n \n Increases the story's globalVolume by 1/10th of the reader's system volume.\n Thus creates a 10-unit volume range for the story\n \n */\n macros.add(&quot;louder&quot;, {\n handler: function () {\n adjustVolume(1);\n }\n });\n\n\n /* jumpscare\n \n Play the clip at maximum story volume\n Don't affect any stored volume options\n PLEASE GIVE THE READER A STARTLE WARNING BEFORE USING THIS.\n \n */\n macros.add(&quot;jumpscare&quot;, {\n handler: function () {\n var args = manageCommonArgs(this, [clipNameLabel]);\n var soundtrack = getSoundTrack(this.args[0]);\n soundtrack.setVolumeProportion(1.0);\n soundtrack.updateVolume();\n soundtrack.play();\n }\n });\n\n /***********************************************************\n * END MACROS\n /***********************************************************/\n\n\n\n}());\n\n// You read the whole thing! THAT'S PRETTY RAD. Keep up the good work, and happy Twining.\n\n</div></div>
</body>
</html>