"}!function(o){window.onerror=function(e,t,n,r,a){window.onerror=o,Utils.storyElement.parent().append(dialog({message:"Sorry to interrupt, but this page's code has got itself in a mess.\n\n".concat(printJSError(a),"\n(This is probably due to a bug in the Harlowe game engine.)")}).addClass("harlowe-crash")),"function"==typeof o&&o.apply(void 0,arguments)}}(window.onerror),Utils.onStartup(function(){var n,e,t,r,a=$("tw-storydata");0!==a.length&&(Utils.options.ifid=a.attr("ifid"),(a.attr("tags")||"").split(/\s/).forEach(function(e){"uncompressed-pure-values"!==e&&"uncompressed-saves"!==e||(Utils.options.uncompressedPureValues=!0),"uncompressed-structures"!==e&&"uncompressed-saves"!==e||(Utils.options.uncompressedStructures=!0)}),(a.attr("options")||"").split(/\s/).forEach(function(e){e&&(Utils.options[e]=!0),"debug"===e&&DebugMode()}),a=(a=a.attr("startnode"))||[].reduce.call($("tw-passagedata"),function(e,t){t=t.getAttribute("pid");return t").concat($(t).html()))}),(e=Section.create()).stack=[{tempVariables:Object.create(VarScope)}],(r=Passages.loadMetadata(e)).length&&(t=dialog({parent:Utils.storyElement.parent(),message:"These errors occurred when running the `(metadata:)` macro calls in this story's passages:"}),r.forEach(function(e){return t.find("p").append(e.render())})),(r=!Utils.options.debug&&State.hasSessionStorage&&sessionStorage.getItem("Saved Session"))&&!0===State.deserialise(e,r)?Engine.showPassage(State.passage):Engine.goToPassage(a))})}),define("macros",["utils/naturalsort","utils","utils/operationutils","datatypes/changercommand","datatypes/custommacro","datatypes/lambda","datatypes/codehook","internaltypes/changedescriptor","internaltypes/twineerror"],function(g,e,t,o,r,y,b,p,v){var w=e.insensitiveName,k=e.nth,S=e.andList,T=t.objectName,_=t.typeName,d=t.toSource,x=Array.isArray,i={};function O(e){return e===s.TypeSignature.Any||(x(e.innerType)?e.innerType.some(O):!!e.innerType&&O(e.innerType))}function a(e,t,n,r){var a,o,i,s,c,l,u,p,d=t.fn,f=t.typeSignature,h=t.returnType,m=(r=function(e){for(var t,n,r,a=[],o=0;o=f.length&&!i)return v.create("datatype",r.length-f.length+" too many values were given to "+e+".",o);if(!(p=p||i).innerType||"rest"!==p.pattern&&"zero or more"!==p.pattern||(i=p.innerType,"rest"===p.pattern&&(p=p.innerType)),!function e(t,n){if(null===n)return void 0===t;var r=_typeof(t);if("function"!=typeof n&&n.pattern){if("optional"===n.pattern||"zero or more"===n.pattern)return void 0===t||e(t,n.innerType);if("either"===n.pattern){for(var a=0;a tw-passagedata").get().forEach(function(e){e=t(e),m.set(e.attr("name"),new r(e))})}),m}),define("renderer",["jquery","utils","markup","internaltypes/twineerror"],function(a,e,S,T){var _=e.escape,x=e.insensitiveName,O=e.options;function A(e,t,n){n=2"+e+""+t+">"}var C="text-align: center; max-width:50%; ";function E(m,g){function y(e,t,n){e=E(e.children,g);return e&&A(e,t,n)}var b="",v=[];if(m)for(var e,w=(m=Array.isArray(m)?m:[m]).length,k=0;k",1);e",!m[e+1]||m[e+1].type!==n.type)break}else m[e].type===n.type?(b=(b+=("<"+t+">").repeat(Math.max(0,m[e].depth-r)))+(""+t+">").repeat(Math.max(0,r-m[e].depth))+"
",r=m[e].depth):b+=E([m[e]],g);e+=1}b+=(""+t+">").repeat(r+1);break;case"align":for(;n&&"align"===n.type;){var a=n.align,o=e+=1;if("left"===a){--e;break}for(;e"+o+"\n",n=m[e]}break;case"column":for(var s,c=[];n&&"column"===n.type;){var l=n.column,u=e+=1;if("none"===l){--e;break}for(;e"+c.map(function(e){return"').concat(e.body,"\n")}).join("")+"");break;case"heading":for(b+="";++e";break}b+=E([m[e]],g)}break;case"br":if(!v.length||/td|th/.test(v[0])){b+=" ";for(var p=m[e+1];p&&("br"===p.type||"tag"===p.type&&/^ ",p=m[(e+=1)+1]}break;case"hr":b+="";break;case"escapedLine":case"comment":break;case"inlineUrl":b+=''+n.text+"";break;case"scriptStyleTag":case"tag":var d=n.text.toLowerCase();/^<\/?(?:table|thead|tbody|tr|tfoot|td|th|svg)\b/.test(d)&&!n.text.endsWith("/>")&&v[n.text.startsWith("")?"shift":"unshift"](d),b+=n.text.startsWith("")?n.text:n.text.replace(/(\/)?>$/,function(e,t){return" data-raw".concat(t?">".concat(n.text.match(/[\w-]+/)):"",">")});break;case"sub":case"sup":case"strong":case"em":b+=y(n,n.type);break;case"strike":b+=y(n,"s");break;case"bold":b+=y(n,"b");break;case"italic":b+=y(n,"i");break;case"twineLink":d=_slicedToArray(S.lex("(link-goto:"+JSON.stringify(n.innerText)+","+JSON.stringify(n.passage)+")").children,1)[0];b+='',g.code.push(d);break;case"hook":b+="',g.source.push(n.children);break;case"unclosedHook":return b+="',g.source.push(m.slice(e+1,w)),{v:b};case"verbatim":b+=A(_(n.innerText).replace(/\n/g," "),"tw-verbatim");break;case"collapsed":b+=y(n,"tw-collapsed");break;case"unclosedCollapsed":return{v:b+=""+E(m.slice(e+1,w),g)+""};case"variable":case"tempVariable":case"macro":var f=[],h=[];if("macro"===n.type&&!function e(t){"string"!==t.type&&"hook"!==t.type&&t.children.every(e);var n=x(t.name);if("macro"!==t.type||"prompt"!==n&&"confirm"!==n){if("hook"===t.type&&!t.everyLeaf(function(e){return"error"!==e.type||(h.push(e),!1)}))return!1}else f.push(t);return!0}(n),h.length)return{v:T.create("syntax","This code hook's markup contained "+h.length+" error"+(h.length?"s":"")+": \u2014"+h.map(function(e){return e.message}).join(" \u2014")).render(_(n.text))[0].outerHTML};d=f.map(function(e){return e.blockerTree=g.blockers.length,g.blockers.push(e),e.blockerTree});b+='',g.code.push(n);break;default:b+=n.children&&n.children.length?E(n.children,g):n.text}k=e}(k))return e.v;return b}return Object.freeze({exec:function(e){var r={code:[],blockers:[],source:[]},e=E(e="string"==typeof e?S.lex(e).children:e,r),e=a(a.parseHTML(e,document,!0));return e.findAndFilter("script:not([src])").each(function(e,t){var n=t.getAttribute("type");n&&"text/javascript"!==n.toLowerCase()||t.setAttribute("type","application/x-harlowe")}),r.blockers=r.blockers.map(function(e){e.blockedValue=!0;e=Object.create(e);return e.blockedValue=!1,e}),e.findAndFilter("tw-expression[code]:not([data-raw]), tw-expression[blockers]:not([data-raw]), tw-hook[source]:not([data-raw])").each(function(e,t){var n;(t=a(t)).attr("blockers")&&(n=t.popAttr("blockers").split(",").map(function(e){return r.blockers[e]}),t.data("blockers",n)),t.attr("source")&&t.data("source",r.source[t.popAttr("source")]),t.attr("code")&&t.data("code",r.code[t.popAttr("code")])}),e}})}),define("repl",["utils","markup","section"],function(e,t,n){e.onStartup(function(){return setTimeout(function(){e.options.debug&&(window.REPL=function(e){e=n.create().eval(t.lex("(print:"+e+")"));return e.TwineScript_Run?e.TwineScript_Run().source:e},window.LEX=function(e){e=t.lex(e);return 1===e.length?e[0]:e})})})}),define("section",["jquery","utils","twinescript/runner","twinescript/operations","state","utils/operationutils","utils/renderutils","utils/scripttag","datatypes/changercommand","datatypes/colour","datatypes/lambda","datatypes/codehook","internaltypes/changedescriptor","internaltypes/varscope","internaltypes/twineerror","internaltypes/twinenotifier"],function(p,f,a,u,r,e,t,i,d,h,o,m,g,y,b,v){var w=e.printBuiltinValue,k=e.objectName,S=e.typeID,T=e.isObject,s=t.collapse,_=Object.assign,x=Object.create,O=Object.keys;function A(e,t,n){if(t&&"object"===_typeof(t)&&d.isPrototypeOf(t)){var r=n.popData("source")||(null==(r=n[0].cachedData)?void 0:r.source),a=(null!=(a=n[0])&&a.cachedData&&(n[0].cachedData.source=void 0),n.data("originalSource",r),g.create({target:n,source:r,section:this,append:"append"})),o=t.run(a);if(b.containsError(o)&&e.replaceWith(o.render(e.attr("title"))),!this.renderInto(r,null,a))return o=f.insensitiveName(e.attr("name")),["if","elseif","unless","else","testfalse"].includes(o)&&(e.addClass("false"),"elseif"!==o)&&(this.stackTop.lastHookShown=!1),n.data("live")&&function(t,n,r){function a(e){p&&(d-=(e-p)*(f.options.debug&&void 0!==f.options.speedMultiplier?f.options.speedMultiplier:1)),p=e,0").data("evalReplay",e)}function c(e,t){var n=this.eval(t);e.append(E(this.evalReplay)),e.append(function(e,t){if(/a \((go-to|undo|redirect|restart):\) command/.exec(null==t?void 0:t.TwineScript_TypeName))return p("").data("goto",{section:e,command:t})}(this,n)),this.stackTop.evaluateOnly&&n&&(d.isPrototypeOf(n)||"function"==typeof n.TwineScript_Run)&&(n=b.create("syntax","I can't work out what ".concat(this.stackTop.evaluateOnly," should evaluate to, because it contains a ").concat(d.isPrototypeOf(n)?"changer.":"command."),"Please rewrite this without putting changers or commands here."));var r=p();for(i=e;d.isPrototypeOf(n);){var a=C(i),o=a.whitespace;if((i=a.nextElem)[0]&&i[0].nodeType===Node.TEXT_NODE&&"+"===i[0].textContent.trim()){var i,a=i,s=C(a),c=s.whitespace;if((i=s.nextElem).is("tw-expression")){var s=i.popData("code")||(null==(s=i[0])||null==(s=s.cachedData)?void 0:s.code),l=(null!=(l=i[0])&&l.cachedData&&(i[0].cachedData.code=void 0),this.eval(s));if(b.containsError(l)){n=l;break}s=u["+"](n,l);p(o).add(a).add(c).remove(),n=b.containsError(s)?b.create("operation","I can't combine "+k(n)+" with "+k(l)+".","function"==typeof l.TwineScript_Run?"If you want to attach this changer to ".concat(k(l),", remove the + between them."):"Changers can only be added to other changers."):s;continue}}if(i.is("tw-expression")){c=i.popData("code")||(null==(a=i[0])||null==(a=a.cachedData)?void 0:a.code),s=(null!=(l=i[0])&&l.cachedData&&(i[0].cachedData.code=void 0),this.eval(c));if(i.append(E(this.evalReplay)),b.containsError(s)){n=s;break}if(s&&"object"===_typeof(s)&&"function"==typeof s.TwineScript_Attach){n=s.TwineScript_Attach(this,n);break}return d.isPrototypeOf(s)?void e.replaceWith(b.create("operation","Changers like (".concat(n.macroName,":) need to be combined using + between them."),"Place the + between the changer macros, or the variables holding them. The + is absent only between a changer and its attached hook or command.").render(e.attr("title"))):void e.replaceWith(b.create("operation","".concat(k(s)," can't have changers like (").concat(n.macroName,":) attached."),"Changers placed just before hooks, links and commands will attempt to attach, but in this case it didn't work.").render(e.attr("title")))}if(i.is("tw-hook")){o.remove(),r=i;break}n.macroName||f.impossible("Section.runExpression","changer has no macroName");a=e.attr("title")||"("+n.macroName+": ...)";return void e.replaceWith(b.create("syntax","The (".concat(n.macroName,":) changer should be stored in a variable or attached to a hook."),"Macros like this should appear before a hook: ".concat(a,"[Some text]")).render(e.attr("title")))}e.attr("return",S(n)),r=r.length?r:C(e).nextElem.filter("tw-hook"),(t=b.containsError(n))?e.replaceWith(t.render(e.attr("title")).append(E(this.evalReplay))):v.isPrototypeOf(n)?e.append(n.render()):n&&"function"==typeof n.TwineScript_Run?(n=n.TwineScript_Run(this),b.containsError(n)?e.replaceWith(n.render(e.attr("title"))):g.isPrototypeOf(n)?null!=(t=n.data)&&t.live?e.replaceWith(b.create("unimplemented","I currently can't attach (live:) or (event:) macros to commands - only hooks.").render(e.attr("title"))):(n.section=this,n.target=i,this.renderInto("",i,n)):T(n)&&n.blocked?(this.stackTop.blocked=n.blocked,e.data("code",{type:"macro",blockedValue:!0,text:e.attr("title")||"",start:0,end:(e.attr("title")||"").length})):n&&f.impossible("Section.runExpression","TwineScript_Run() returned a non-ChangeDescriptor ".concat(_typeof(n),': "').concat(n,'"'))):r.length&&A.call(this,e,n,r)||("string"==typeof n||"number"==typeof n||n instanceof Map||n instanceof Set||Array.isArray(n)||h.isPrototypeOf(n)||m.isPrototypeOf(n)||n&&"function"==typeof n.TwineScript_Print&&!d.isPrototypeOf(n)?(n=w(n),b.containsError(n)?e.replaceWith(n.render(e.attr("title"))):"string"==typeof n||Array.isArray(n)?this.renderInto(n,e):f.impossible("printBuiltinValue() produced a non-string non-array ".concat(_typeof(n)))):d.isPrototypeOf(n)||"boolean"==typeof n||f.impossible("Section.runExpression","The expression evaluated to an unknown value: ".concat(n)))}var l={add:[],remove:[]};return Object.preventExtensions({create:function(){var e=0");return this.stack.unshift({desc:g.create({target:n,source:e,section:this,append:"append"}),tempVariables:this.stackTop.tempVariables,evaluateOnly:t,finalIter:!0}),this.execute(),0<(e=n.find("tw-error")).length?e:n},speculate:function(e,t,n){this.stack.unshift({evaluateOnly:n,finalIter:!0,tempVariables:_(x(y),{TwineScript_VariableStore:{type:"temp",name:n}}),speculativePassage:t});var r,n=this.evalReplay;return this.evalReplay=null,o.isPrototypeOf(e)?r=e.apply(this,{fail:!1,pass:!0}):e&&(r=a(this,e)),this.stack.shift(),this.evalReplay=n,r},renderInto:function(e,a,t){var o=this,r=3 element.",'The error was "'.concat(e,'". Check the browser console for more details.')).render(t.text(),t)))}}}),this.stackTop.blocked||(n.length&&r&&s(n),n.findAndFilter("tw-collapsed,[collapsing=true]").each(function(){s(p(this))}),setTimeout(function(){return n.find("input, textarea").first().focus()},100),this.stack.shift())},updateEnchantments:function(){this.enchantments.forEach(function(e){e.disenchant(),e.enchantScope()})},on:function(e,t){return l[e].push(t),this},addEnchantment:function(t){var n=this;this.enchantments.push(t),l.add.forEach(function(e){return e(n,t)})},removeEnchantment:function(t){var n=this,e=this.enchantments.indexOf(t);this.enchantments.splice(e,1),t.disenchant(),l.remove.forEach(function(e){return e(n,t)})},unblock:function(e){for(this.stack.length||f.impossible("Section.unblock","stack is empty"),this.stackTop.blocked=!1,void 0!==e&&(this.stackTop.blockedValues=(this.stackTop.blockedValues||[]).concat(e));this.stack.length&&!this.stackTop.blocked;)this.execute();if(!this.stack.length)for(;0>>17,461845907),o=s(o=o<<13|o>>>19,5)+3864292196|0;return o^=n.length,o=s(o^=o>>>16,2246822507),o=s(o^=o>>>13,3266489909),o=((o^=o>>>16)>>>0)+1831565813*e,function(){i.seedIter+=1;var e=o+=1831565813,e=s(e^e>>>15,1|e);return(((e^=e+s(e^e>>>7,61|e))^e>>>14)>>>0)/4294967296}}function r(e,t){for(var n,r=t.variables,a=h(null),o=e.length-1;0<=o;--o){for(var i,s,c=e[o],l=0,u=["mockVisits","mockTurns","seed","seedIter"];ln.size?C(n):r+(S.size?"+"+C(S):"")+(k.size?"-"+C(k):"")}else"string"==typeof n&&"string"==typeof t&&n&&(n.startsWith(t)?o=r+"+"+C(n.slice(t.length)):n.endsWith(t)&&(o=C(n.slice(0,n.length-t.length))+"+"+r));return o?"it"===r?{via:o}:o:"it"===r?void 0:C(n)}(a,t,"it");a&&("it"===a.via?delete d.variables[e]:d.valueRefs[e]=a);break}}},TwineScript_GetProperty:function(e){return this[e]},TwineScript_DefineType:function(e,t){this.TwineScript_TypeDefs[e]=t,hasOwnProperty.call(d.variables,"TwineScript_TypeDefs")||(d.variables.TwineScript_TypeDefs=h(null)),d.variables.TwineScript_TypeDefs[e]=t}}),r(u.slice(0,p+1),e),i=e,m(),w=S(e.seed,e.seedIter)}function T(e){d=c.create(e);e=a.serialise(!0),f=e.past,e=e.pastAndPresent;if(a.hasSessionStorage&&"string"==typeof e)try{sessionStorage.setItem("Saved Session",e)}catch(e){}}function _(e,t,n,r){for(var a in r)if(hasOwnProperty.call(r,a)&&!a.startsWith("TwineScript_"))if("object"===_typeof(r[a]))if(hasOwnProperty.call(r[a],"at")){n.valueRefs[a]=r[a];var o=r[a],i=o.at,s=o.from,c=o.to,l=o.hash,u=o.seed,p=o.seedIter,o=o.blockedValues;if(!b.has(i))throw Error('The data refers to a passage named `"'.concat(n.passage,"\"`, but it isn't in this story."));var d=b.get(i).get("source"),f=d.slice(s,c);if(void 0!==l)for(var h=0,m=c-s;y.hash(f).toString(16)!==l;){if(h+m>=d.length)throw Error("The value (or type) of the variable `$".concat(a,"` couldn't be found in the passage `\"").concat(i,'"`.'));(h+=1)===s&&(h+=1),f=d.slice(h,h+m)}c=k(f,"","macro");void 0!==u&&void 0!==p&&(w=S(u,p)),void 0!==o&&(e.stackTop.blockedValues=o,c.forEach(function e(t){var n;"string"!==t.type&&"hook"!==t.type&&t.children.every(e),"macro"!==t.type||"prompt"!==(n=y.insensitiveName(t.name))&&"confirm"!==n||(t.blockedValue=!0)})),r[a]=e.eval(c)}else if(hasOwnProperty.call(r[a],"via")){for(var g=t.length-1;0<=g;--g)if(hasOwnProperty.call(t[g].variables,a)){e.Identifiers.it=t[g].variables[a];break}r[a]=e.eval(k(r[a].via,"","macro")),e.Identifiers.it=0}else hasOwnProperty.call(r[a],"changer")&&(r[a].changer=e.eval(k(r[a].changer,"","macro")),r[a].hook=e.eval(k(r[a].hook,"","macro")),_(e,t,n,r[a].variables),r[a]=v.create(r[a]));else r[a]=e.eval(k(r[a],"","macro"));else"TwineScript_MockVisits"===a&&(n.mockVisits=r[a])}return g(),d.seed=i.seed,d.seedIter=0,(a={get passage(){return d.passage},get variables(){return i.variables},get pastLength(){return p},get turns(){return p+1+(i.turns||0)+(i.mockTurns||0)},get futureLength(){return u.length-1-p},get mockVisits(){return i.mockVisits||[]},set mockVisits(e){i.mockVisits=e,d.mockVisits=e,m()},get mockTurns(){return i.mockTurns||0},set mockTurns(e){i.mockTurns=e,d.mockTurns=e},history:function(){return i.history},forgetUndos:function(e){e<0&&(e=u.length+e);var t,e=u.splice(0,Math.min(u.length-1,e));e.length&&(p=u.length-1,t=u[0],r(e,t),t.pastVisits.push(e[e.length-1].passage),t.turns=(t.turns||0)+e.length,i.turns=(i.turns||0)+e.length,t.forgetVisits&&(t.pastVisits=t.pastVisits.slice(t.forgetVisits-t.turns),t.forgetVisits-=t.turns),f="",0===p&&n("tw-link[undo], tw-icon[alt='Undo']",y.storyElement).each(function(e,t){(n(t).closest("tw-expression, tw-hook").data("forgetUndosEvent")||Object)(t)}),l.forgetUndos.forEach(function(e){return e()}))},forgetVisits:function(e){(e=e<0?u.length+e:e)>p+i.turns&&(e=p+i.turns),d.forgetVisits=i.forgetVisits=Math.max(i.forgetVisits||0,e),m()},passageNameVisited:function(e){var t=0;if(!b.get(e))return 0;for(var n=0;n>>9)>>>0},permutations:function(){for(var e=arguments.length,t=new Array(e),n=0;n","<":"<",""":'"',"'":"'"," ":String.fromCharCode(160),"":String.fromCharCode(8204)}[e]})},escape:function(e){return e.replace(/[&><"']/g,function(e){return{"&":"&",">":">","<":"<",'"':""","'":"'"}[e]})},insensitiveName:function(e){return(e+"").toLowerCase().replace(b,"")},allKeysDown:function(){for(var e=arguments.length,t=new Array(e),n=0;n").parent()),i&&e.css("transform-origin",i),e.attr("data-t8n",t).addClass("transition-out").css({"animation-duration":"".concat(n,"ms"),"animation-delay":"".concat(-o,"ms"),"animation-play-state":"paused"}),requestAnimationFrame(function(){v.childrenProbablyInline(e)?e.css("display","inline"):e.parent().is("tw-backdrop,tw-story")||e[0].setAttribute("style",e[0].getAttribute("style")+"display:block !important;width:100%")}),y(e,n,r-o,a,function(){e.remove()}))},transitionIn:function(u,e,t){var p,n=3").parent()),o&&u.css("transform-origin",o),u.attr("data-t8n",e).addClass("transition-in").css(_objectSpread({"animation-duration":"".concat(t,"ms"),"animation-delay":"".concat(-a,"ms")},n-a?{visibility:"hidden","animation-play-state":"paused"}:{})),requestAnimationFrame(function(){v.childrenProbablyInline(u)?u.css("display","inline"):u.parent().is("tw-backdrop,tw-story")||u[0].setAttribute("style",u[0].getAttribute("style")+"display:block !important;width:100%")}),y(u,t,n-a,r,function(){var e=0===u.filter(f.join(",")).length;if(p&&e){u.find("tw-transition-container, .transition-in, .transition-out").each(function(e,t){((t=d(t)).data("expediteAnim")||Object)()});for(var t=[],n=u.find("*"),r=0;rT?i(r[0],3):(116*r[0]-16)/S,S*TT?i(r[2],3):(116*r[2]-16)/S].map(function(e,t){return e*k[t]}),t=_slicedToArray(x(w([[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]],w([[.9554734527042182,-.023098536874261423,.0632593086610217],[-.028369706963208136,1.0099954580058226,.021041398966943008],[.012314001688319899,-.020507696433477912,1.3303659366080753]],_(n)))).map(function(e){return u(255,l(0,255*(.0031308<(e=e)?1.055*i(e,1/2.4)-.055:12.92*e)))}),3);return{r:t[0],g:t[1],b:t[2],a:e}}function e(e){function t(e){return 1e-5<=n[e]&&n[e]<=255-1e-5}var n=O(e);if(Object.keys(n).every(t))return n;var r=(e=_objectSpread({},e)).c,a=0;for(e.c/=2;1e-5"},TwineScript_is:function(e){var t;return!!A.isPrototypeOf(e)&&(e.lcha&&this.lcha?e.lcha.l===this.lcha.l&&e.lcha.c===this.lcha.c&&e.lcha.h===this.lcha.h&&e.a===this.a:(t=this.toRGBA(),(e=e.toRGBA()).r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a))},TwineScript_Clone:function(){return A.create(this)},toRGBAString:function(){var e=this.toRGBA(),t=e.r,n=e.g,r=e.b,e=e.a;return"rgba(".concat(t,", ").concat(n,", ").concat(r,", ").concat(e,")")},toHSLA:function(){return n(this.toRGBA())},toRGBA:function(){return this.lch?e(_objectSpread({a:this.a},this.lch)):this},toLCHA:function(){return this.lch?_objectSpread({a:this.a},this.lch):(t=(e=this).r,n=e.g,r=e.b,e=e.a,n=[116*(t=x(w([[1.0479298208405488,.022946793341019088,-.05019222954313557],[.029627815688159344,.990434484573249,-.01707382502938514],[-.009243058152591178,.015055144896577895,.7518742899580008]],w([[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],_([t/255,n/255,r/255].map(function(e){return e<.04045?e/12.92:i((e+.055)/1.055,2.4)}))))).map(function(e,t){return e/k[t]}).map(function(e){return T").css("background-color",e).css("background-color"))?{r:0,g:0,b:0,a:0}:t.startsWith("rgb")?t.match(/\d+/g).reduce(function(e,t,n){return e["rgb"[n]]=+t,e},{}):{r:192,g:192,b:192},v[e]=t)})(e)):!("h"in e&&"s"in e&&"l"in e)||"r"in e||"g"in e||"b"in e?("a"in e&&"number"==typeof e.a||(e.a=1),"h"in e&&"c"in e&&!("s"in e)&&"l"in e?g(y(this),{a:e.a,lch:{l:e.l,c:e.c,h:e.h}}):g(y(this),e)):this.create((a=(t=e).h,o=e.s,i=e.l,t=e.a,0===o?{r:e=d(255*i),g:e,b:e}:(r=2*i-(n=i<.5?i*(1+o):i+o-i*o),{r:d(255*s((a/=360)+1/3)),g:d(255*s(a)),b:d(255*s(a-1/3)),a:t})));function s(e){return e<0&&(e+=1),1").append(k.exec(r.code)),b=e.stack.length,r=(e.stack.unshift({tempVariables:a,dom:g,output:function(e){y=e}}),e.evalReplay);for(e.evalReplay=null,e.execute();e.stack.length>b;)e.stack.shift();e.evalReplay=r;r=g.find("tw-error");return r.length?(g.prepend(o.map(function(e){return e.render()})," "),x.create("propagated","".concat(r.length," error").concat(1"},create:function(e,t){var n=2").parent()[0]}).filter(Boolean))}return g(n.get(e))}var n,r,a=e.dom,m=":not(tw-error, tw-error *)",o=g();this.next&&(o=o.add(l.call(this.next,e)));if(this.selector){if("string"===this.selector.type)i=this.selector.data,n=c((n=a).textNodes(),i),r=g(),n.forEach(function(e){r=r.add(g(e).wrapAll("").parent())}),i=r;else{if("base"===this.selector.type)return o.add(t(l.call(this.selector.data,e),this.property));n=this.selector.data,e='tw-hook[name="'+(n=s.insensitiveName(n).replace(/"/g,"""))+'"],tw-enchantment[name="'+n+'"]';var e=e+={page:", tw-story",passage:", tw-passage",sidebar:", tw-sidebar",link:", tw-link, .enchantment-link"}[n]||"",i=a.findAndFilter(e).add(a.parentsUntil(s.storyElement.parent())).filter(e)}o=this.property?o.add(t(i,this.property)):o.add(i)}return o=o.get().reduce(function(e,t){return t=g(t),e.add(t.is("tw-enchantment")&&t.contents().length<=1?t.contents():t)},g())}function a(e){var t,n;return e?(t=e.selector,n=e.property,e=e.next,[JSON.stringify(["base"===t.type?a(t.data):s.insensitiveName(t.data),n])].concat(_toConsumableArray(a(e))).sort()):[]}var o=Object.freeze({forEach:function(e,n){var t=l.call(this,e).each(function(e,t){return n(g(t),e)});return e.dom.findAndFilter("tw-pseudo-hook").contents().unwrap(),t},hooks:function(e){return l.call(this,e)},get TwineScript_ObjectName(){return"the hook name ".concat(this.TwineScript_ToSource())},TwineScript_TypeID:"hookName",TwineScript_TypeName:"a hook name (like ?this)",TwineScript_Unstorable:!0,TwineScript_ToSource:function(){var e="",t=this.selector,n=t.type,t=t.data;return"name"===n?t.match(RegExp("^"+s.anyRealLetter+"+$"))?e+="?"+t:e+="(hooks-named:"+JSON.stringify(t)+")":"string"===n?e+=JSON.stringify(t):"base"===n&&(e+=t.TwineScript_ToSource()+"'s "+r(this.property,"property")),this.next&&(e+=" + "+this.next.TwineScript_ToSource()),e},"TwineScript_+":function(e){for(var t=this.TwineScript_Clone(),n=t;n.next;)n=n.next;return n.next=e,t},TwineScript_is:function(e){return a(this)+""==a(e)+""},TwineScript_GetProperty:function(e){return o.create({type:"base",data:this},e,void 0)},TwineScript_Properties:["chars","links","lines","visited"],TwineScript_Clone:function(){return o.create(this.selector,this.property,this.next)},create:function(e,t){var n=2").text(e)];for(var a=h(e,"",t||"macro"),o=[],i="",s=a,c=a.start;c'))[0])),i+=a.text[c-a.start]}return o.length&&(o[o.length-1].textContent=i),o}}),define("debugmode/mode",["jquery","utils","utils/naturalsort","state","engine","internaltypes/varref","internaltypes/twineerror","utils/operationutils","utils/renderutils","passages","section","debugmode/panel","debugmode/highlight","utils/typecolours"],function(I,V,M,D,F,L,H,e,t,z,q,W,B,n){var U=e.objectName,$=e.isObject,G=e.toSource,Y=e.typeID,J=t.dialog,X=n.CSS,K=function(e,t){var f=V.escape,i=V.nth,n=V.debounce,r=I(document.documentElement),a=M(),o={darkMode:!0,fadePanel:!0,evalReplay:!0,width:null,maxHeight:400};if(D.hasStorage)try{var s=localStorage.getItem("(Debug Options "+V.options.ifid+")");s&&(o=JSON.parse(s))}catch(e){}function c(){if(D.hasStorage)try{localStorage.setItem("(Debug Options "+V.options.ifid+")",JSON.stringify(o))}catch(e){}}W.defaultMaxHeight=o.maxHeight;function l(e){return n(function(){if(V.options.debug)return e.apply(this,arguments)},{maxWait:2e3})}var h=I('\n