diff --git a/CHANGELOG.md b/CHANGELOG.md
index da3aa6639b91d08ea39e755429717b9f1010e34a..5ea4da7921b729d93e0e086dfbeb1e32f2ceee78 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
 ## Unreleased
 
+* added a cervix micropump upgrade to allow it to grow other fillable implants
+* fixes
+
 ## 0.10.7.1-4.0.0-alpha.32 - 2024-07-06
 
 * cheatEditActor replaces cheatEditSlave and cheatEditPlayer
diff --git a/devTools/tweeGo/storyFormats/sugarcube-2/format.js b/devTools/tweeGo/storyFormats/sugarcube-2/format.js
index c8adb0e2050a239bbf6bed4306303257f1fd792b..502dc8e6a90ecb60638c8faa5fd982c9e47f169f 100644
--- a/devTools/tweeGo/storyFormats/sugarcube-2/format.js
+++ b/devTools/tweeGo/storyFormats/sugarcube-2/format.js
@@ -1 +1 @@
-window.storyFormat({"name":"SugarCube","version":"2.36.1","description":"A full featured, highly customizable story format.  See its <a href=\"http://www.motoslave.net/sugarcube/2/#documentation\" target=\"_blank\">documentation</a>.","author":"Thomas Michael Edwards","image":"icon.svg","url":"http://www.motoslave.net/sugarcube/","license":"BSD-2-Clause","proofing":false,"source":"<!DOCTYPE html>\n<html data-init=\"no-js\">\n<head>\n<meta charset=\"UTF-8\" />\n<title>{{STORY_NAME}}</title>\n<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\" />\n<!--\n\nSugarCube (v2.36.1): A free (gratis and libre) story format.\n\nCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>.\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\n   list of conditions and the following disclaimer.\n2. Redistributions in binary form must reproduce the above copyright notice,\n   this list of conditions and the following disclaimer in the documentation\n   and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n-->\n<script id=\"script-libraries\" type=\"text/javascript\">\nif(document.head&&document.addEventListener&&document.querySelector&&Object.create&&Object.freeze&&JSON){document.documentElement.setAttribute(\"data-init\", \"loading\");\n/*! @source http://purl.eligrey.com/github/classList.js/blob/1.2.20171210/classList.js */\n\"document\"in self&&(\"classList\"in document.createElement(\"_\")&&(!document.createElementNS||\"classList\"in document.createElementNS(\"http://www.w3.org/2000/svg\",\"g\"))||!function(t){\"use strict\";if(\"Element\"in t){var e=\"classList\",n=\"prototype\",i=t.Element[n],s=Object,r=String[n].trim||function(){return this.replace(/^\\s+|\\s+$/g,\"\")},o=Array[n].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},c=function(t,e){this.name=t,this.code=DOMException[t],this.message=e},a=function(t,e){if(\"\"===e)throw new c(\"SYNTAX_ERR\",\"The token must not be empty.\");if(/\\s/.test(e))throw new c(\"INVALID_CHARACTER_ERR\",\"The token must not contain space characters.\");return o.call(t,e)},l=function(t){for(var e=r.call(t.getAttribute(\"class\")||\"\"),n=e?e.split(/\\s+/):[],i=0,s=n.length;s>i;i++)this.push(n[i]);this._updateClassName=function(){t.setAttribute(\"class\",this.toString())}},u=l[n]=[],h=function(){return new l(this)};if(c[n]=Error[n],u.item=function(t){return this[t]||null},u.contains=function(t){return~a(this,t+\"\")},u.add=function(){var t,e=arguments,n=0,i=e.length,s=!1;do t=e[n]+\"\",~a(this,t)||(this.push(t),s=!0);while(++n<i);s&&this._updateClassName()},u.remove=function(){var t,e,n=arguments,i=0,s=n.length,r=!1;do for(t=n[i]+\"\",e=a(this,t);~e;)this.splice(e,1),r=!0,e=a(this,t);while(++i<s);r&&this._updateClassName()},u.toggle=function(t,e){var n=this.contains(t),i=n?e!==!0&&\"remove\":e!==!1&&\"add\";return i&&this[i](t),e===!0||e===!1?e:!n},u.replace=function(t,e){var n=a(t+\"\");~n&&(this.splice(n,1,e),this._updateClassName())},u.toString=function(){return this.join(\" \")},s.defineProperty){var f={get:h,enumerable:!0,configurable:!0};try{s.defineProperty(i,e,f)}catch(p){void 0!==p.number&&-2146823252!==p.number||(f.enumerable=!1,s.defineProperty(i,e,f))}}else s[n].__defineGetter__&&i.__defineGetter__(e,h)}}(self),function(){\"use strict\";var t=document.createElement(\"_\");if(t.classList.add(\"c1\",\"c2\"),!t.classList.contains(\"c2\")){var e=function(t){var e=DOMTokenList.prototype[t];DOMTokenList.prototype[t]=function(t){var n,i=arguments.length;for(n=0;i>n;n++)t=arguments[n],e.call(this,t)}};e(\"add\"),e(\"remove\")}if(t.classList.toggle(\"c3\",!1),t.classList.contains(\"c3\")){var n=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(t,e){return 1 in arguments&&!this.contains(t)==!e?e:n.call(this,t)}}\"replace\"in document.createElement(\"_\").classList||(DOMTokenList.prototype.replace=function(t,e){var n=this.toString().split(\" \"),i=n.indexOf(t+\"\");~i&&(n=n.slice(i),this.remove.apply(this,n),this.add(e),this.add.apply(this,n.slice(1)))}),t=null}());\n/*! jQuery v3.7.1 | (c) OpenJS Foundation and other contributors | jquery.org/license */\n!function(e,t){\"use strict\";\"object\"==typeof module&&\"object\"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error(\"jQuery requires a window with a document\");return t(e)}:t(e)}(\"undefined\"!=typeof window?window:this,function(ie,e){\"use strict\";var oe=[],r=Object.getPrototypeOf,ae=oe.slice,g=oe.flat?function(e){return oe.flat.call(e)}:function(e){return oe.concat.apply([],e)},s=oe.push,se=oe.indexOf,n={},i=n.toString,ue=n.hasOwnProperty,o=ue.toString,a=o.call(Object),le={},v=function(e){return\"function\"==typeof e&&\"number\"!=typeof e.nodeType&&\"function\"!=typeof e.item},y=function(e){return null!=e&&e===e.window},C=ie.document,u={type:!0,src:!0,nonce:!0,noModule:!0};function m(e,t,n){var r,i,o=(n=n||C).createElement(\"script\");if(o.text=e,t)for(r in u)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+\"\":\"object\"==typeof e||\"function\"==typeof e?n[i.call(e)]||\"object\":typeof e}var t=\"3.7.1\",l=/HTML$/i,ce=function(e,t){return new ce.fn.init(e,t)};function c(e){var t=!!e&&\"length\"in e&&e.length,n=x(e);return!v(e)&&!y(e)&&(\"array\"===n||0===t||\"number\"==typeof t&&0<t&&t-1 in e)}function fe(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}ce.fn=ce.prototype={jquery:t,constructor:ce,length:0,toArray:function(){return ae.call(this)},get:function(e){return null==e?ae.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=ce.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return ce.each(this,e)},map:function(n){return this.pushStack(ce.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(ae.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(ce.grep(this,function(e,t){return(t+1)%2}))},odd:function(){return this.pushStack(ce.grep(this,function(e,t){return t%2}))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(0<=n&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:s,sort:oe.sort,splice:oe.splice},ce.extend=ce.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for(\"boolean\"==typeof a&&(l=a,a=arguments[s]||{},s++),\"object\"==typeof a||v(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)r=e[t],\"__proto__\"!==t&&a!==r&&(l&&r&&(ce.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||ce.isPlainObject(n)?n:{},i=!1,a[t]=ce.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},ce.extend({expando:\"jQuery\"+(t+Math.random()).replace(/\\D/g,\"\"),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||\"[object Object]\"!==i.call(e))&&(!(t=r(e))||\"function\"==typeof(n=ue.call(t,\"constructor\")&&t.constructor)&&o.call(n)===a)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t,n){m(e,{nonce:t&&t.nonce},n)},each:function(e,t){var n,r=0;if(c(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},text:function(e){var t,n=\"\",r=0,i=e.nodeType;if(!i)while(t=e[r++])n+=ce.text(t);return 1===i||11===i?e.textContent:9===i?e.documentElement.textContent:3===i||4===i?e.nodeValue:n},makeArray:function(e,t){var n=t||[];return null!=e&&(c(Object(e))?ce.merge(n,\"string\"==typeof e?[e]:e):s.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:se.call(t,e,n)},isXMLDoc:function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!l.test(t||n&&n.nodeName||\"HTML\")},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,a=!n;i<o;i++)!t(e[i],i)!==a&&r.push(e[i]);return r},map:function(e,t,n){var r,i,o=0,a=[];if(c(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&a.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&a.push(i);return g(a)},guid:1,support:le}),\"function\"==typeof Symbol&&(ce.fn[Symbol.iterator]=oe[Symbol.iterator]),ce.each(\"Boolean Number String Function Array Date RegExp Object Error Symbol\".split(\" \"),function(e,t){n[\"[object \"+t+\"]\"]=t.toLowerCase()});var pe=oe.pop,de=oe.sort,he=oe.splice,ge=\"[\\\\x20\\\\t\\\\r\\\\n\\\\f]\",ve=new RegExp(\"^\"+ge+\"+|((?:^|[^\\\\\\\\])(?:\\\\\\\\.)*)\"+ge+\"+$\",\"g\");ce.contains=function(e,t){var n=t&&t.parentNode;return e===n||!(!n||1!==n.nodeType||!(e.contains?e.contains(n):e.compareDocumentPosition&&16&e.compareDocumentPosition(n)))};var f=/([\\0-\\x1f\\x7f]|^-?\\d)|^-$|[^\\x80-\\uFFFF\\w-]/g;function p(e,t){return t?\"\\0\"===e?\"\\ufffd\":e.slice(0,-1)+\"\\\\\"+e.charCodeAt(e.length-1).toString(16)+\" \":\"\\\\\"+e}ce.escapeSelector=function(e){return(e+\"\").replace(f,p)};var ye=C,me=s;!function(){var e,b,w,o,a,T,r,C,d,i,k=me,S=ce.expando,E=0,n=0,s=W(),c=W(),u=W(),h=W(),l=function(e,t){return e===t&&(a=!0),0},f=\"checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped\",t=\"(?:\\\\\\\\[\\\\da-fA-F]{1,6}\"+ge+\"?|\\\\\\\\[^\\\\r\\\\n\\\\f]|[\\\\w-]|[^\\0-\\\\x7f])+\",p=\"\\\\[\"+ge+\"*(\"+t+\")(?:\"+ge+\"*([*^$|!~]?=)\"+ge+\"*(?:'((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\"|(\"+t+\"))|)\"+ge+\"*\\\\]\",g=\":(\"+t+\")(?:\\\\((('((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\")|((?:\\\\\\\\.|[^\\\\\\\\()[\\\\]]|\"+p+\")*)|.*)\\\\)|)\",v=new RegExp(ge+\"+\",\"g\"),y=new RegExp(\"^\"+ge+\"*,\"+ge+\"*\"),m=new RegExp(\"^\"+ge+\"*([>+~]|\"+ge+\")\"+ge+\"*\"),x=new RegExp(ge+\"|>\"),j=new RegExp(g),A=new RegExp(\"^\"+t+\"$\"),D={ID:new RegExp(\"^#(\"+t+\")\"),CLASS:new RegExp(\"^\\\\.(\"+t+\")\"),TAG:new RegExp(\"^(\"+t+\"|[*])\"),ATTR:new RegExp(\"^\"+p),PSEUDO:new RegExp(\"^\"+g),CHILD:new RegExp(\"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\\\(\"+ge+\"*(even|odd|(([+-]|)(\\\\d*)n|)\"+ge+\"*(?:([+-]|)\"+ge+\"*(\\\\d+)|))\"+ge+\"*\\\\)|)\",\"i\"),bool:new RegExp(\"^(?:\"+f+\")$\",\"i\"),needsContext:new RegExp(\"^\"+ge+\"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\\\(\"+ge+\"*((?:-\\\\d)?\\\\d*)\"+ge+\"*\\\\)|)(?=[^-]|$)\",\"i\")},N=/^(?:input|select|textarea|button)$/i,q=/^h\\d$/i,L=/^(?:#([\\w-]+)|(\\w+)|\\.([\\w-]+))$/,H=/[+~]/,O=new RegExp(\"\\\\\\\\[\\\\da-fA-F]{1,6}\"+ge+\"?|\\\\\\\\([^\\\\r\\\\n\\\\f])\",\"g\"),P=function(e,t){var n=\"0x\"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},M=function(){V()},R=J(function(e){return!0===e.disabled&&fe(e,\"fieldset\")},{dir:\"parentNode\",next:\"legend\"});try{k.apply(oe=ae.call(ye.childNodes),ye.childNodes),oe[ye.childNodes.length].nodeType}catch(e){k={apply:function(e,t){me.apply(e,ae.call(t))},call:function(e){me.apply(e,ae.call(arguments,1))}}}function I(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],\"string\"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(V(e),e=e||T,C)){if(11!==p&&(u=L.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return k.call(n,a),n}else if(f&&(a=f.getElementById(i))&&I.contains(e,a)&&a.id===i)return k.call(n,a),n}else{if(u[2])return k.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&e.getElementsByClassName)return k.apply(n,e.getElementsByClassName(i)),n}if(!(h[t+\" \"]||d&&d.test(t))){if(c=t,f=e,1===p&&(x.test(t)||m.test(t))){(f=H.test(t)&&U(e.parentNode)||e)==e&&le.scope||((s=e.getAttribute(\"id\"))?s=ce.escapeSelector(s):e.setAttribute(\"id\",s=S)),o=(l=Y(t)).length;while(o--)l[o]=(s?\"#\"+s:\":scope\")+\" \"+Q(l[o]);c=l.join(\",\")}try{return k.apply(n,f.querySelectorAll(c)),n}catch(e){h(t,!0)}finally{s===S&&e.removeAttribute(\"id\")}}}return re(t.replace(ve,\"$1\"),e,n,r)}function W(){var r=[];return function e(t,n){return r.push(t+\" \")>b.cacheLength&&delete e[r.shift()],e[t+\" \"]=n}}function F(e){return e[S]=!0,e}function $(e){var t=T.createElement(\"fieldset\");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function B(t){return function(e){return fe(e,\"input\")&&e.type===t}}function _(t){return function(e){return(fe(e,\"input\")||fe(e,\"button\"))&&e.type===t}}function z(t){return function(e){return\"form\"in e?e.parentNode&&!1===e.disabled?\"label\"in e?\"label\"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&R(e)===t:e.disabled===t:\"label\"in e&&e.disabled===t}}function X(a){return F(function(o){return o=+o,F(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function U(e){return e&&\"undefined\"!=typeof e.getElementsByTagName&&e}function V(e){var t,n=e?e.ownerDocument||e:ye;return n!=T&&9===n.nodeType&&n.documentElement&&(r=(T=n).documentElement,C=!ce.isXMLDoc(T),i=r.matches||r.webkitMatchesSelector||r.msMatchesSelector,r.msMatchesSelector&&ye!=T&&(t=T.defaultView)&&t.top!==t&&t.addEventListener(\"unload\",M),le.getById=$(function(e){return r.appendChild(e).id=ce.expando,!T.getElementsByName||!T.getElementsByName(ce.expando).length}),le.disconnectedMatch=$(function(e){return i.call(e,\"*\")}),le.scope=$(function(){return T.querySelectorAll(\":scope\")}),le.cssHas=$(function(){try{return T.querySelector(\":has(*,:jqfake)\"),!1}catch(e){return!0}}),le.getById?(b.filter.ID=function(e){var t=e.replace(O,P);return function(e){return e.getAttribute(\"id\")===t}},b.find.ID=function(e,t){if(\"undefined\"!=typeof t.getElementById&&C){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(O,P);return function(e){var t=\"undefined\"!=typeof e.getAttributeNode&&e.getAttributeNode(\"id\");return t&&t.value===n}},b.find.ID=function(e,t){if(\"undefined\"!=typeof t.getElementById&&C){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode(\"id\"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode(\"id\"))&&n.value===e)return[o]}return[]}}),b.find.TAG=function(e,t){return\"undefined\"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):t.querySelectorAll(e)},b.find.CLASS=function(e,t){if(\"undefined\"!=typeof t.getElementsByClassName&&C)return t.getElementsByClassName(e)},d=[],$(function(e){var t;r.appendChild(e).innerHTML=\"<a id='\"+S+\"' href='' disabled='disabled'></a><select id='\"+S+\"-\\r\\\\' disabled='disabled'><option selected=''></option></select>\",e.querySelectorAll(\"[selected]\").length||d.push(\"\\\\[\"+ge+\"*(?:value|\"+f+\")\"),e.querySelectorAll(\"[id~=\"+S+\"-]\").length||d.push(\"~=\"),e.querySelectorAll(\"a#\"+S+\"+*\").length||d.push(\".#.+[+~]\"),e.querySelectorAll(\":checked\").length||d.push(\":checked\"),(t=T.createElement(\"input\")).setAttribute(\"type\",\"hidden\"),e.appendChild(t).setAttribute(\"name\",\"D\"),r.appendChild(e).disabled=!0,2!==e.querySelectorAll(\":disabled\").length&&d.push(\":enabled\",\":disabled\"),(t=T.createElement(\"input\")).setAttribute(\"name\",\"\"),e.appendChild(t),e.querySelectorAll(\"[name='']\").length||d.push(\"\\\\[\"+ge+\"*name\"+ge+\"*=\"+ge+\"*(?:''|\\\"\\\")\")}),le.cssHas||d.push(\":has\"),d=d.length&&new RegExp(d.join(\"|\")),l=function(e,t){if(e===t)return a=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!le.sortDetached&&t.compareDocumentPosition(e)===n?e===T||e.ownerDocument==ye&&I.contains(ye,e)?-1:t===T||t.ownerDocument==ye&&I.contains(ye,t)?1:o?se.call(o,e)-se.call(o,t):0:4&n?-1:1)}),T}for(e in I.matches=function(e,t){return I(e,null,null,t)},I.matchesSelector=function(e,t){if(V(e),C&&!h[t+\" \"]&&(!d||!d.test(t)))try{var n=i.call(e,t);if(n||le.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){h(t,!0)}return 0<I(t,T,null,[e]).length},I.contains=function(e,t){return(e.ownerDocument||e)!=T&&V(e),ce.contains(e,t)},I.attr=function(e,t){(e.ownerDocument||e)!=T&&V(e);var n=b.attrHandle[t.toLowerCase()],r=n&&ue.call(b.attrHandle,t.toLowerCase())?n(e,t,!C):void 0;return void 0!==r?r:e.getAttribute(t)},I.error=function(e){throw new Error(\"Syntax error, unrecognized expression: \"+e)},ce.uniqueSort=function(e){var t,n=[],r=0,i=0;if(a=!le.sortStable,o=!le.sortStable&&ae.call(e,0),de.call(e,l),a){while(t=e[i++])t===e[i]&&(r=n.push(i));while(r--)he.call(e,n[r],1)}return o=null,e},ce.fn.uniqueSort=function(){return this.pushStack(ce.uniqueSort(ae.apply(this)))},(b=ce.expr={cacheLength:50,createPseudo:F,match:D,attrHandle:{},find:{},relative:{\">\":{dir:\"parentNode\",first:!0},\" \":{dir:\"parentNode\"},\"+\":{dir:\"previousSibling\",first:!0},\"~\":{dir:\"previousSibling\"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(O,P),e[3]=(e[3]||e[4]||e[5]||\"\").replace(O,P),\"~=\"===e[2]&&(e[3]=\" \"+e[3]+\" \"),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),\"nth\"===e[1].slice(0,3)?(e[3]||I.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*(\"even\"===e[3]||\"odd\"===e[3])),e[5]=+(e[7]+e[8]||\"odd\"===e[3])):e[3]&&I.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return D.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||\"\":n&&j.test(n)&&(t=Y(n,!0))&&(t=n.indexOf(\")\",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(O,P).toLowerCase();return\"*\"===e?function(){return!0}:function(e){return fe(e,t)}},CLASS:function(e){var t=s[e+\" \"];return t||(t=new RegExp(\"(^|\"+ge+\")\"+e+\"(\"+ge+\"|$)\"))&&s(e,function(e){return t.test(\"string\"==typeof e.className&&e.className||\"undefined\"!=typeof e.getAttribute&&e.getAttribute(\"class\")||\"\")})},ATTR:function(n,r,i){return function(e){var t=I.attr(e,n);return null==t?\"!=\"===r:!r||(t+=\"\",\"=\"===r?t===i:\"!=\"===r?t!==i:\"^=\"===r?i&&0===t.indexOf(i):\"*=\"===r?i&&-1<t.indexOf(i):\"$=\"===r?i&&t.slice(-i.length)===i:\"~=\"===r?-1<(\" \"+t.replace(v,\" \")+\" \").indexOf(i):\"|=\"===r&&(t===i||t.slice(0,i.length+1)===i+\"-\"))}},CHILD:function(d,e,t,h,g){var v=\"nth\"!==d.slice(0,3),y=\"last\"!==d.slice(-4),m=\"of-type\"===e;return 1===h&&0===g?function(e){return!!e.parentNode}:function(e,t,n){var r,i,o,a,s,u=v!==y?\"nextSibling\":\"previousSibling\",l=e.parentNode,c=m&&e.nodeName.toLowerCase(),f=!n&&!m,p=!1;if(l){if(v){while(u){o=e;while(o=o[u])if(m?fe(o,c):1===o.nodeType)return!1;s=u=\"only\"===d&&!s&&\"nextSibling\"}return!0}if(s=[y?l.firstChild:l.lastChild],y&&f){p=(a=(r=(i=l[S]||(l[S]={}))[d]||[])[0]===E&&r[1])&&r[2],o=a&&l.childNodes[a];while(o=++a&&o&&o[u]||(p=a=0)||s.pop())if(1===o.nodeType&&++p&&o===e){i[d]=[E,a,p];break}}else if(f&&(p=a=(r=(i=e[S]||(e[S]={}))[d]||[])[0]===E&&r[1]),!1===p)while(o=++a&&o&&o[u]||(p=a=0)||s.pop())if((m?fe(o,c):1===o.nodeType)&&++p&&(f&&((i=o[S]||(o[S]={}))[d]=[E,p]),o===e))break;return(p-=g)===h||p%h==0&&0<=p/h}}},PSEUDO:function(e,o){var t,a=b.pseudos[e]||b.setFilters[e.toLowerCase()]||I.error(\"unsupported pseudo: \"+e);return a[S]?a(o):1<a.length?(t=[e,e,\"\",o],b.setFilters.hasOwnProperty(e.toLowerCase())?F(function(e,t){var n,r=a(e,o),i=r.length;while(i--)e[n=se.call(e,r[i])]=!(t[n]=r[i])}):function(e){return a(e,0,t)}):a}},pseudos:{not:F(function(e){var r=[],i=[],s=ne(e.replace(ve,\"$1\"));return s[S]?F(function(e,t,n,r){var i,o=s(e,null,r,[]),a=e.length;while(a--)(i=o[a])&&(e[a]=!(t[a]=i))}):function(e,t,n){return r[0]=e,s(r,null,n,i),r[0]=null,!i.pop()}}),has:F(function(t){return function(e){return 0<I(t,e).length}}),contains:F(function(t){return t=t.replace(O,P),function(e){return-1<(e.textContent||ce.text(e)).indexOf(t)}}),lang:F(function(n){return A.test(n||\"\")||I.error(\"unsupported lang: \"+n),n=n.replace(O,P).toLowerCase(),function(e){var t;do{if(t=C?e.lang:e.getAttribute(\"xml:lang\")||e.getAttribute(\"lang\"))return(t=t.toLowerCase())===n||0===t.indexOf(n+\"-\")}while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var t=ie.location&&ie.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===r},focus:function(e){return e===function(){try{return T.activeElement}catch(e){}}()&&T.hasFocus()&&!!(e.type||e.href||~e.tabIndex)},enabled:z(!1),disabled:z(!0),checked:function(e){return fe(e,\"input\")&&!!e.checked||fe(e,\"option\")&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!b.pseudos.empty(e)},header:function(e){return q.test(e.nodeName)},input:function(e){return N.test(e.nodeName)},button:function(e){return fe(e,\"input\")&&\"button\"===e.type||fe(e,\"button\")},text:function(e){var t;return fe(e,\"input\")&&\"text\"===e.type&&(null==(t=e.getAttribute(\"type\"))||\"text\"===t.toLowerCase())},first:X(function(){return[0]}),last:X(function(e,t){return[t-1]}),eq:X(function(e,t,n){return[n<0?n+t:n]}),even:X(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:X(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:X(function(e,t,n){var r;for(r=n<0?n+t:t<n?t:n;0<=--r;)e.push(r);return e}),gt:X(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=b.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})b.pseudos[e]=B(e);for(e in{submit:!0,reset:!0})b.pseudos[e]=_(e);function G(){}function Y(e,t){var n,r,i,o,a,s,u,l=c[e+\" \"];if(l)return t?0:l.slice(0);a=e,s=[],u=b.preFilter;while(a){for(o in n&&!(r=y.exec(a))||(r&&(a=a.slice(r[0].length)||a),s.push(i=[])),n=!1,(r=m.exec(a))&&(n=r.shift(),i.push({value:n,type:r[0].replace(ve,\" \")}),a=a.slice(n.length)),b.filter)!(r=D[o].exec(a))||u[o]&&!(r=u[o](r))||(n=r.shift(),i.push({value:n,type:o,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?I.error(e):c(e,s).slice(0)}function Q(e){for(var t=0,n=e.length,r=\"\";t<n;t++)r+=e[t].value;return r}function J(a,e,t){var s=e.dir,u=e.next,l=u||s,c=t&&\"parentNode\"===l,f=n++;return e.first?function(e,t,n){while(e=e[s])if(1===e.nodeType||c)return a(e,t,n);return!1}:function(e,t,n){var r,i,o=[E,f];if(n){while(e=e[s])if((1===e.nodeType||c)&&a(e,t,n))return!0}else while(e=e[s])if(1===e.nodeType||c)if(i=e[S]||(e[S]={}),u&&fe(e,u))e=e[s]||e;else{if((r=i[l])&&r[0]===E&&r[1]===f)return o[2]=r[2];if((i[l]=o)[2]=a(e,t,n))return!0}return!1}}function K(i){return 1<i.length?function(e,t,n){var r=i.length;while(r--)if(!i[r](e,t,n))return!1;return!0}:i[0]}function Z(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function ee(d,h,g,v,y,e){return v&&!v[S]&&(v=ee(v)),y&&!y[S]&&(y=ee(y,e)),F(function(e,t,n,r){var i,o,a,s,u=[],l=[],c=t.length,f=e||function(e,t,n){for(var r=0,i=t.length;r<i;r++)I(e,t[r],n);return n}(h||\"*\",n.nodeType?[n]:n,[]),p=!d||!e&&h?f:Z(f,u,d,n,r);if(g?g(p,s=y||(e?d:c||v)?[]:t,n,r):s=p,v){i=Z(s,l),v(i,[],n,r),o=i.length;while(o--)(a=i[o])&&(s[l[o]]=!(p[l[o]]=a))}if(e){if(y||d){if(y){i=[],o=s.length;while(o--)(a=s[o])&&i.push(p[o]=a);y(null,s=[],i,r)}o=s.length;while(o--)(a=s[o])&&-1<(i=y?se.call(e,a):u[o])&&(e[i]=!(t[i]=a))}}else s=Z(s===t?s.splice(c,s.length):s),y?y(null,t,s,r):k.apply(t,s)})}function te(e){for(var i,t,n,r=e.length,o=b.relative[e[0].type],a=o||b.relative[\" \"],s=o?1:0,u=J(function(e){return e===i},a,!0),l=J(function(e){return-1<se.call(i,e)},a,!0),c=[function(e,t,n){var r=!o&&(n||t!=w)||((i=t).nodeType?u(e,t,n):l(e,t,n));return i=null,r}];s<r;s++)if(t=b.relative[e[s].type])c=[J(K(c),t)];else{if((t=b.filter[e[s].type].apply(null,e[s].matches))[S]){for(n=++s;n<r;n++)if(b.relative[e[n].type])break;return ee(1<s&&K(c),1<s&&Q(e.slice(0,s-1).concat({value:\" \"===e[s-2].type?\"*\":\"\"})).replace(ve,\"$1\"),t,s<n&&te(e.slice(s,n)),n<r&&te(e=e.slice(n)),n<r&&Q(e))}c.push(t)}return K(c)}function ne(e,t){var n,v,y,m,x,r,i=[],o=[],a=u[e+\" \"];if(!a){t||(t=Y(e)),n=t.length;while(n--)(a=te(t[n]))[S]?i.push(a):o.push(a);(a=u(e,(v=o,m=0<(y=i).length,x=0<v.length,r=function(e,t,n,r,i){var o,a,s,u=0,l=\"0\",c=e&&[],f=[],p=w,d=e||x&&b.find.TAG(\"*\",i),h=E+=null==p?1:Math.random()||.1,g=d.length;for(i&&(w=t==T||t||i);l!==g&&null!=(o=d[l]);l++){if(x&&o){a=0,t||o.ownerDocument==T||(V(o),n=!C);while(s=v[a++])if(s(o,t||T,n)){k.call(r,o);break}i&&(E=h)}m&&((o=!s&&o)&&u--,e&&c.push(o))}if(u+=l,m&&l!==u){a=0;while(s=y[a++])s(c,f,t,n);if(e){if(0<u)while(l--)c[l]||f[l]||(f[l]=pe.call(r));f=Z(f)}k.apply(r,f),i&&!e&&0<f.length&&1<u+y.length&&ce.uniqueSort(r)}return i&&(E=h,w=p),c},m?F(r):r))).selector=e}return a}function re(e,t,n,r){var i,o,a,s,u,l=\"function\"==typeof e&&e,c=!r&&Y(e=l.selector||e);if(n=n||[],1===c.length){if(2<(o=c[0]=c[0].slice(0)).length&&\"ID\"===(a=o[0]).type&&9===t.nodeType&&C&&b.relative[o[1].type]){if(!(t=(b.find.ID(a.matches[0].replace(O,P),t)||[])[0]))return n;l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}i=D.needsContext.test(e)?0:o.length;while(i--){if(a=o[i],b.relative[s=a.type])break;if((u=b.find[s])&&(r=u(a.matches[0].replace(O,P),H.test(o[0].type)&&U(t.parentNode)||t))){if(o.splice(i,1),!(e=r.length&&Q(o)))return k.apply(n,r),n;break}}}return(l||ne(e,c))(r,t,!C,n,!t||H.test(e)&&U(t.parentNode)||t),n}G.prototype=b.filters=b.pseudos,b.setFilters=new G,le.sortStable=S.split(\"\").sort(l).join(\"\")===S,V(),le.sortDetached=$(function(e){return 1&e.compareDocumentPosition(T.createElement(\"fieldset\"))}),ce.find=I,ce.expr[\":\"]=ce.expr.pseudos,ce.unique=ce.uniqueSort,I.compile=ne,I.select=re,I.setDocument=V,I.tokenize=Y,I.escape=ce.escapeSelector,I.getText=ce.text,I.isXML=ce.isXMLDoc,I.selectors=ce.expr,I.support=ce.support,I.uniqueSort=ce.uniqueSort}();var d=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&ce(e).is(n))break;r.push(e)}return r},h=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},b=ce.expr.match.needsContext,w=/^<([a-z][^\\/\\0>:\\x20\\t\\r\\n\\f]*)[\\x20\\t\\r\\n\\f]*\\/?>(?:<\\/\\1>|)$/i;function T(e,n,r){return v(n)?ce.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?ce.grep(e,function(e){return e===n!==r}):\"string\"!=typeof n?ce.grep(e,function(e){return-1<se.call(n,e)!==r}):ce.filter(n,e,r)}ce.filter=function(e,t,n){var r=t[0];return n&&(e=\":not(\"+e+\")\"),1===t.length&&1===r.nodeType?ce.find.matchesSelector(r,e)?[r]:[]:ce.find.matches(e,ce.grep(t,function(e){return 1===e.nodeType}))},ce.fn.extend({find:function(e){var t,n,r=this.length,i=this;if(\"string\"!=typeof e)return this.pushStack(ce(e).filter(function(){for(t=0;t<r;t++)if(ce.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)ce.find(e,i[t],n);return 1<r?ce.uniqueSort(n):n},filter:function(e){return this.pushStack(T(this,e||[],!1))},not:function(e){return this.pushStack(T(this,e||[],!0))},is:function(e){return!!T(this,\"string\"==typeof e&&b.test(e)?ce(e):e||[],!1).length}});var k,S=/^(?:\\s*(<[\\w\\W]+>)[^>]*|#([\\w-]+))$/;(ce.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||k,\"string\"==typeof e){if(!(r=\"<\"===e[0]&&\">\"===e[e.length-1]&&3<=e.length?[null,e,null]:S.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof ce?t[0]:t,ce.merge(this,ce.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:C,!0)),w.test(r[1])&&ce.isPlainObject(t))for(r in t)v(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=C.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):v(e)?void 0!==n.ready?n.ready(e):e(ce):ce.makeArray(e,this)}).prototype=ce.fn,k=ce(C);var E=/^(?:parents|prev(?:Until|All))/,j={children:!0,contents:!0,next:!0,prev:!0};function A(e,t){while((e=e[t])&&1!==e.nodeType);return e}ce.fn.extend({has:function(e){var t=ce(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(ce.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a=\"string\"!=typeof e&&ce(e);if(!b.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?-1<a.index(n):1===n.nodeType&&ce.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(1<o.length?ce.uniqueSort(o):o)},index:function(e){return e?\"string\"==typeof e?se.call(ce(e),this[0]):se.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(ce.uniqueSort(ce.merge(this.get(),ce(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),ce.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return d(e,\"parentNode\")},parentsUntil:function(e,t,n){return d(e,\"parentNode\",n)},next:function(e){return A(e,\"nextSibling\")},prev:function(e){return A(e,\"previousSibling\")},nextAll:function(e){return d(e,\"nextSibling\")},prevAll:function(e){return d(e,\"previousSibling\")},nextUntil:function(e,t,n){return d(e,\"nextSibling\",n)},prevUntil:function(e,t,n){return d(e,\"previousSibling\",n)},siblings:function(e){return h((e.parentNode||{}).firstChild,e)},children:function(e){return h(e.firstChild)},contents:function(e){return null!=e.contentDocument&&r(e.contentDocument)?e.contentDocument:(fe(e,\"template\")&&(e=e.content||e),ce.merge([],e.childNodes))}},function(r,i){ce.fn[r]=function(e,t){var n=ce.map(this,i,e);return\"Until\"!==r.slice(-5)&&(t=e),t&&\"string\"==typeof t&&(n=ce.filter(t,n)),1<this.length&&(j[r]||ce.uniqueSort(n),E.test(r)&&n.reverse()),this.pushStack(n)}});var D=/[^\\x20\\t\\r\\n\\f]+/g;function N(e){return e}function q(e){throw e}function L(e,t,n,r){var i;try{e&&v(i=e.promise)?i.call(e).done(t).fail(n):e&&v(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}ce.Callbacks=function(r){var e,n;r=\"string\"==typeof r?(e=r,n={},ce.each(e.match(D)||[],function(e,t){n[t]=!0}),n):ce.extend({},r);var i,t,o,a,s=[],u=[],l=-1,c=function(){for(a=a||r.once,o=i=!0;u.length;l=-1){t=u.shift();while(++l<s.length)!1===s[l].apply(t[0],t[1])&&r.stopOnFalse&&(l=s.length,t=!1)}r.memory||(t=!1),i=!1,a&&(s=t?[]:\"\")},f={add:function(){return s&&(t&&!i&&(l=s.length-1,u.push(t)),function n(e){ce.each(e,function(e,t){v(t)?r.unique&&f.has(t)||s.push(t):t&&t.length&&\"string\"!==x(t)&&n(t)})}(arguments),t&&!i&&c()),this},remove:function(){return ce.each(arguments,function(e,t){var n;while(-1<(n=ce.inArray(t,s,n)))s.splice(n,1),n<=l&&l--}),this},has:function(e){return e?-1<ce.inArray(e,s):0<s.length},empty:function(){return s&&(s=[]),this},disable:function(){return a=u=[],s=t=\"\",this},disabled:function(){return!s},lock:function(){return a=u=[],t||i||(s=t=\"\"),this},locked:function(){return!!a},fireWith:function(e,t){return a||(t=[e,(t=t||[]).slice?t.slice():t],u.push(t),i||c()),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!o}};return f},ce.extend({Deferred:function(e){var o=[[\"notify\",\"progress\",ce.Callbacks(\"memory\"),ce.Callbacks(\"memory\"),2],[\"resolve\",\"done\",ce.Callbacks(\"once memory\"),ce.Callbacks(\"once memory\"),0,\"resolved\"],[\"reject\",\"fail\",ce.Callbacks(\"once memory\"),ce.Callbacks(\"once memory\"),1,\"rejected\"]],i=\"pending\",a={state:function(){return i},always:function(){return s.done(arguments).fail(arguments),this},\"catch\":function(e){return a.then(null,e)},pipe:function(){var i=arguments;return ce.Deferred(function(r){ce.each(o,function(e,t){var n=v(i[t[4]])&&i[t[4]];s[t[1]](function(){var e=n&&n.apply(this,arguments);e&&v(e.promise)?e.promise().progress(r.notify).done(r.resolve).fail(r.reject):r[t[0]+\"With\"](this,n?[e]:arguments)})}),i=null}).promise()},then:function(t,n,r){var u=0;function l(i,o,a,s){return function(){var n=this,r=arguments,e=function(){var e,t;if(!(i<u)){if((e=a.apply(n,r))===o.promise())throw new TypeError(\"Thenable self-resolution\");t=e&&(\"object\"==typeof e||\"function\"==typeof e)&&e.then,v(t)?s?t.call(e,l(u,o,N,s),l(u,o,q,s)):(u++,t.call(e,l(u,o,N,s),l(u,o,q,s),l(u,o,N,o.notifyWith))):(a!==N&&(n=void 0,r=[e]),(s||o.resolveWith)(n,r))}},t=s?e:function(){try{e()}catch(e){ce.Deferred.exceptionHook&&ce.Deferred.exceptionHook(e,t.error),u<=i+1&&(a!==q&&(n=void 0,r=[e]),o.rejectWith(n,r))}};i?t():(ce.Deferred.getErrorHook?t.error=ce.Deferred.getErrorHook():ce.Deferred.getStackHook&&(t.error=ce.Deferred.getStackHook()),ie.setTimeout(t))}}return ce.Deferred(function(e){o[0][3].add(l(0,e,v(r)?r:N,e.notifyWith)),o[1][3].add(l(0,e,v(t)?t:N)),o[2][3].add(l(0,e,v(n)?n:q))}).promise()},promise:function(e){return null!=e?ce.extend(e,a):a}},s={};return ce.each(o,function(e,t){var n=t[2],r=t[5];a[t[1]]=n.add,r&&n.add(function(){i=r},o[3-e][2].disable,o[3-e][3].disable,o[0][2].lock,o[0][3].lock),n.add(t[3].fire),s[t[0]]=function(){return s[t[0]+\"With\"](this===s?void 0:this,arguments),this},s[t[0]+\"With\"]=n.fireWith}),a.promise(s),e&&e.call(s,s),s},when:function(e){var n=arguments.length,t=n,r=Array(t),i=ae.call(arguments),o=ce.Deferred(),a=function(t){return function(e){r[t]=this,i[t]=1<arguments.length?ae.call(arguments):e,--n||o.resolveWith(r,i)}};if(n<=1&&(L(e,o.done(a(t)).resolve,o.reject,!n),\"pending\"===o.state()||v(i[t]&&i[t].then)))return o.then();while(t--)L(i[t],a(t),o.reject);return o.promise()}});var H=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;ce.Deferred.exceptionHook=function(e,t){ie.console&&ie.console.warn&&e&&H.test(e.name)&&ie.console.warn(\"jQuery.Deferred exception: \"+e.message,e.stack,t)},ce.readyException=function(e){ie.setTimeout(function(){throw e})};var O=ce.Deferred();function P(){C.removeEventListener(\"DOMContentLoaded\",P),ie.removeEventListener(\"load\",P),ce.ready()}ce.fn.ready=function(e){return O.then(e)[\"catch\"](function(e){ce.readyException(e)}),this},ce.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--ce.readyWait:ce.isReady)||(ce.isReady=!0)!==e&&0<--ce.readyWait||O.resolveWith(C,[ce])}}),ce.ready.then=O.then,\"complete\"===C.readyState||\"loading\"!==C.readyState&&!C.documentElement.doScroll?ie.setTimeout(ce.ready):(C.addEventListener(\"DOMContentLoaded\",P),ie.addEventListener(\"load\",P));var M=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if(\"object\"===x(n))for(s in i=!0,n)M(e,t,s,n[s],!0,o,a);else if(void 0!==r&&(i=!0,v(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(ce(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},R=/^-ms-/,I=/-([a-z])/g;function W(e,t){return t.toUpperCase()}function F(e){return e.replace(R,\"ms-\").replace(I,W)}var $=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function B(){this.expando=ce.expando+B.uid++}B.uid=1,B.prototype={cache:function(e){var t=e[this.expando];return t||(t={},$(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if(\"string\"==typeof t)i[F(t)]=n;else for(r in t)i[F(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][F(t)]},access:function(e,t,n){return void 0===t||t&&\"string\"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(F):(t=F(t))in r?[t]:t.match(D)||[]).length;while(n--)delete r[t[n]]}(void 0===t||ce.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!ce.isEmptyObject(t)}};var _=new B,z=new B,X=/^(?:\\{[\\w\\W]*\\}|\\[[\\w\\W]*\\])$/,U=/[A-Z]/g;function V(e,t,n){var r,i;if(void 0===n&&1===e.nodeType)if(r=\"data-\"+t.replace(U,\"-$&\").toLowerCase(),\"string\"==typeof(n=e.getAttribute(r))){try{n=\"true\"===(i=n)||\"false\"!==i&&(\"null\"===i?null:i===+i+\"\"?+i:X.test(i)?JSON.parse(i):i)}catch(e){}z.set(e,t,n)}else n=void 0;return n}ce.extend({hasData:function(e){return z.hasData(e)||_.hasData(e)},data:function(e,t,n){return z.access(e,t,n)},removeData:function(e,t){z.remove(e,t)},_data:function(e,t,n){return _.access(e,t,n)},_removeData:function(e,t){_.remove(e,t)}}),ce.fn.extend({data:function(n,e){var t,r,i,o=this[0],a=o&&o.attributes;if(void 0===n){if(this.length&&(i=z.get(o),1===o.nodeType&&!_.get(o,\"hasDataAttrs\"))){t=a.length;while(t--)a[t]&&0===(r=a[t].name).indexOf(\"data-\")&&(r=F(r.slice(5)),V(o,r,i[r]));_.set(o,\"hasDataAttrs\",!0)}return i}return\"object\"==typeof n?this.each(function(){z.set(this,n)}):M(this,function(e){var t;if(o&&void 0===e)return void 0!==(t=z.get(o,n))?t:void 0!==(t=V(o,n))?t:void 0;this.each(function(){z.set(this,n,e)})},null,e,1<arguments.length,null,!0)},removeData:function(e){return this.each(function(){z.remove(this,e)})}}),ce.extend({queue:function(e,t,n){var r;if(e)return t=(t||\"fx\")+\"queue\",r=_.get(e,t),n&&(!r||Array.isArray(n)?r=_.access(e,t,ce.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||\"fx\";var n=ce.queue(e,t),r=n.length,i=n.shift(),o=ce._queueHooks(e,t);\"inprogress\"===i&&(i=n.shift(),r--),i&&(\"fx\"===t&&n.unshift(\"inprogress\"),delete o.stop,i.call(e,function(){ce.dequeue(e,t)},o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+\"queueHooks\";return _.get(e,n)||_.access(e,n,{empty:ce.Callbacks(\"once memory\").add(function(){_.remove(e,[t+\"queue\",n])})})}}),ce.fn.extend({queue:function(t,n){var e=2;return\"string\"!=typeof t&&(n=t,t=\"fx\",e--),arguments.length<e?ce.queue(this[0],t):void 0===n?this:this.each(function(){var e=ce.queue(this,t,n);ce._queueHooks(this,t),\"fx\"===t&&\"inprogress\"!==e[0]&&ce.dequeue(this,t)})},dequeue:function(e){return this.each(function(){ce.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||\"fx\",[])},promise:function(e,t){var n,r=1,i=ce.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};\"string\"!=typeof e&&(t=e,e=void 0),e=e||\"fx\";while(a--)(n=_.get(o[a],e+\"queueHooks\"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var G=/[+-]?(?:\\d*\\.|)\\d+(?:[eE][+-]?\\d+|)/.source,Y=new RegExp(\"^(?:([+-])=|)(\"+G+\")([a-z%]*)$\",\"i\"),Q=[\"Top\",\"Right\",\"Bottom\",\"Left\"],J=C.documentElement,K=function(e){return ce.contains(e.ownerDocument,e)},Z={composed:!0};J.getRootNode&&(K=function(e){return ce.contains(e.ownerDocument,e)||e.getRootNode(Z)===e.ownerDocument});var ee=function(e,t){return\"none\"===(e=t||e).style.display||\"\"===e.style.display&&K(e)&&\"none\"===ce.css(e,\"display\")};function te(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return ce.css(e,t,\"\")},u=s(),l=n&&n[3]||(ce.cssNumber[t]?\"\":\"px\"),c=e.nodeType&&(ce.cssNumber[t]||\"px\"!==l&&+u)&&Y.exec(ce.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)ce.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,ce.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var ne={};function re(e,t){for(var n,r,i,o,a,s,u,l=[],c=0,f=e.length;c<f;c++)(r=e[c]).style&&(n=r.style.display,t?(\"none\"===n&&(l[c]=_.get(r,\"display\")||null,l[c]||(r.style.display=\"\")),\"\"===r.style.display&&ee(r)&&(l[c]=(u=a=o=void 0,a=(i=r).ownerDocument,s=i.nodeName,(u=ne[s])||(o=a.body.appendChild(a.createElement(s)),u=ce.css(o,\"display\"),o.parentNode.removeChild(o),\"none\"===u&&(u=\"block\"),ne[s]=u)))):\"none\"!==n&&(l[c]=\"none\",_.set(r,\"display\",n)));for(c=0;c<f;c++)null!=l[c]&&(e[c].style.display=l[c]);return e}ce.fn.extend({show:function(){return re(this,!0)},hide:function(){return re(this)},toggle:function(e){return\"boolean\"==typeof e?e?this.show():this.hide():this.each(function(){ee(this)?ce(this).show():ce(this).hide()})}});var xe,be,we=/^(?:checkbox|radio)$/i,Te=/<([a-z][^\\/\\0>\\x20\\t\\r\\n\\f]*)/i,Ce=/^$|^module$|\\/(?:java|ecma)script/i;xe=C.createDocumentFragment().appendChild(C.createElement(\"div\")),(be=C.createElement(\"input\")).setAttribute(\"type\",\"radio\"),be.setAttribute(\"checked\",\"checked\"),be.setAttribute(\"name\",\"t\"),xe.appendChild(be),le.checkClone=xe.cloneNode(!0).cloneNode(!0).lastChild.checked,xe.innerHTML=\"<textarea>x</textarea>\",le.noCloneChecked=!!xe.cloneNode(!0).lastChild.defaultValue,xe.innerHTML=\"<option></option>\",le.option=!!xe.lastChild;var ke={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,\"\",\"\"]};function Se(e,t){var n;return n=\"undefined\"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||\"*\"):\"undefined\"!=typeof e.querySelectorAll?e.querySelectorAll(t||\"*\"):[],void 0===t||t&&fe(e,t)?ce.merge([e],n):n}function Ee(e,t){for(var n=0,r=e.length;n<r;n++)_.set(e[n],\"globalEval\",!t||_.get(t[n],\"globalEval\"))}ke.tbody=ke.tfoot=ke.colgroup=ke.caption=ke.thead,ke.th=ke.td,le.option||(ke.optgroup=ke.option=[1,\"<select multiple='multiple'>\",\"</select>\"]);var je=/<|&#?\\w+;/;function Ae(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if(\"object\"===x(o))ce.merge(p,o.nodeType?[o]:o);else if(je.test(o)){a=a||f.appendChild(t.createElement(\"div\")),s=(Te.exec(o)||[\"\",\"\"])[1].toLowerCase(),u=ke[s]||ke._default,a.innerHTML=u[1]+ce.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;ce.merge(p,a.childNodes),(a=f.firstChild).textContent=\"\"}else p.push(t.createTextNode(o));f.textContent=\"\",d=0;while(o=p[d++])if(r&&-1<ce.inArray(o,r))i&&i.push(o);else if(l=K(o),a=Se(f.appendChild(o),\"script\"),l&&Ee(a),n){c=0;while(o=a[c++])Ce.test(o.type||\"\")&&n.push(o)}return f}var De=/^([^.]*)(?:\\.(.+)|)/;function Ne(){return!0}function qe(){return!1}function Le(e,t,n,r,i,o){var a,s;if(\"object\"==typeof t){for(s in\"string\"!=typeof n&&(r=r||n,n=void 0),t)Le(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&(\"string\"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=qe;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return ce().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=ce.guid++)),e.each(function(){ce.event.add(this,t,i,r,n)})}function He(e,r,t){t?(_.set(e,r,!1),ce.event.add(e,r,{namespace:!1,handler:function(e){var t,n=_.get(this,r);if(1&e.isTrigger&&this[r]){if(n)(ce.event.special[r]||{}).delegateType&&e.stopPropagation();else if(n=ae.call(arguments),_.set(this,r,n),this[r](),t=_.get(this,r),_.set(this,r,!1),n!==t)return e.stopImmediatePropagation(),e.preventDefault(),t}else n&&(_.set(this,r,ce.event.trigger(n[0],n.slice(1),this)),e.stopPropagation(),e.isImmediatePropagationStopped=Ne)}})):void 0===_.get(e,r)&&ce.event.add(e,r,Ne)}ce.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=_.get(t);if($(t)){n.handler&&(n=(o=n).handler,i=o.selector),i&&ce.find.matchesSelector(J,i),n.guid||(n.guid=ce.guid++),(u=v.events)||(u=v.events=Object.create(null)),(a=v.handle)||(a=v.handle=function(e){return\"undefined\"!=typeof ce&&ce.event.triggered!==e.type?ce.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||\"\").match(D)||[\"\"]).length;while(l--)d=g=(s=De.exec(e[l])||[])[1],h=(s[2]||\"\").split(\".\").sort(),d&&(f=ce.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=ce.event.special[d]||{},c=ce.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&ce.expr.match.needsContext.test(i),namespace:h.join(\".\")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),ce.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=_.hasData(e)&&_.get(e);if(v&&(u=v.events)){l=(t=(t||\"\").match(D)||[\"\"]).length;while(l--)if(d=g=(s=De.exec(t[l])||[])[1],h=(s[2]||\"\").split(\".\").sort(),d){f=ce.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp(\"(^|\\\\.)\"+h.join(\"\\\\.(?:.*\\\\.|)\")+\"(\\\\.|$)\"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&(\"**\"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||ce.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)ce.event.remove(e,d+t[l],n,r,!0);ce.isEmptyObject(u)&&_.remove(e,\"handle events\")}},dispatch:function(e){var t,n,r,i,o,a,s=new Array(arguments.length),u=ce.event.fix(e),l=(_.get(this,\"events\")||Object.create(null))[u.type]||[],c=ce.event.special[u.type]||{};for(s[0]=u,t=1;t<arguments.length;t++)s[t]=arguments[t];if(u.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,u)){a=ce.event.handlers.call(this,u,l),t=0;while((i=a[t++])&&!u.isPropagationStopped()){u.currentTarget=i.elem,n=0;while((o=i.handlers[n++])&&!u.isImmediatePropagationStopped())u.rnamespace&&!1!==o.namespace&&!u.rnamespace.test(o.namespace)||(u.handleObj=o,u.data=o.data,void 0!==(r=((ce.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,s))&&!1===(u.result=r)&&(u.preventDefault(),u.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,u),u.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!(\"click\"===e.type&&1<=e.button))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&(\"click\"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+\" \"]&&(a[i]=r.needsContext?-1<ce(i,this).index(l):ce.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(t,e){Object.defineProperty(ce.Event.prototype,t,{enumerable:!0,configurable:!0,get:v(e)?function(){if(this.originalEvent)return e(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[t]},set:function(e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e})}})},fix:function(e){return e[ce.expando]?e:new ce.Event(e)},special:{load:{noBubble:!0},click:{setup:function(e){var t=this||e;return we.test(t.type)&&t.click&&fe(t,\"input\")&&He(t,\"click\",!0),!1},trigger:function(e){var t=this||e;return we.test(t.type)&&t.click&&fe(t,\"input\")&&He(t,\"click\"),!0},_default:function(e){var t=e.target;return we.test(t.type)&&t.click&&fe(t,\"input\")&&_.get(t,\"click\")||fe(t,\"a\")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},ce.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},ce.Event=function(e,t){if(!(this instanceof ce.Event))return new ce.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Ne:qe,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&ce.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[ce.expando]=!0},ce.Event.prototype={constructor:ce.Event,isDefaultPrevented:qe,isPropagationStopped:qe,isImmediatePropagationStopped:qe,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Ne,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Ne,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Ne,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},ce.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,\"char\":!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:!0},ce.event.addProp),ce.each({focus:\"focusin\",blur:\"focusout\"},function(r,i){function o(e){if(C.documentMode){var t=_.get(this,\"handle\"),n=ce.event.fix(e);n.type=\"focusin\"===e.type?\"focus\":\"blur\",n.isSimulated=!0,t(e),n.target===n.currentTarget&&t(n)}else ce.event.simulate(i,e.target,ce.event.fix(e))}ce.event.special[r]={setup:function(){var e;if(He(this,r,!0),!C.documentMode)return!1;(e=_.get(this,i))||this.addEventListener(i,o),_.set(this,i,(e||0)+1)},trigger:function(){return He(this,r),!0},teardown:function(){var e;if(!C.documentMode)return!1;(e=_.get(this,i)-1)?_.set(this,i,e):(this.removeEventListener(i,o),_.remove(this,i))},_default:function(e){return _.get(e.target,r)},delegateType:i},ce.event.special[i]={setup:function(){var e=this.ownerDocument||this.document||this,t=C.documentMode?this:e,n=_.get(t,i);n||(C.documentMode?this.addEventListener(i,o):e.addEventListener(r,o,!0)),_.set(t,i,(n||0)+1)},teardown:function(){var e=this.ownerDocument||this.document||this,t=C.documentMode?this:e,n=_.get(t,i)-1;n?_.set(t,i,n):(C.documentMode?this.removeEventListener(i,o):e.removeEventListener(r,o,!0),_.remove(t,i))}}}),ce.each({mouseenter:\"mouseover\",mouseleave:\"mouseout\",pointerenter:\"pointerover\",pointerleave:\"pointerout\"},function(e,i){ce.event.special[e]={delegateType:i,bindType:i,handle:function(e){var t,n=e.relatedTarget,r=e.handleObj;return n&&(n===this||ce.contains(this,n))||(e.type=r.origType,t=r.handler.apply(this,arguments),e.type=i),t}}}),ce.fn.extend({on:function(e,t,n,r){return Le(this,e,t,n,r)},one:function(e,t,n,r){return Le(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,ce(e.delegateTarget).off(r.namespace?r.origType+\".\"+r.namespace:r.origType,r.selector,r.handler),this;if(\"object\"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&\"function\"!=typeof t||(n=t,t=void 0),!1===n&&(n=qe),this.each(function(){ce.event.remove(this,e,n,t)})}});var Oe=/<script|<style|<link/i,Pe=/checked\\s*(?:[^=]|=\\s*.checked.)/i,Me=/^\\s*<!\\[CDATA\\[|\\]\\]>\\s*$/g;function Re(e,t){return fe(e,\"table\")&&fe(11!==t.nodeType?t:t.firstChild,\"tr\")&&ce(e).children(\"tbody\")[0]||e}function Ie(e){return e.type=(null!==e.getAttribute(\"type\"))+\"/\"+e.type,e}function We(e){return\"true/\"===(e.type||\"\").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute(\"type\"),e}function Fe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(_.hasData(e)&&(s=_.get(e).events))for(i in _.remove(t,\"handle events\"),s)for(n=0,r=s[i].length;n<r;n++)ce.event.add(t,i,s[i][n]);z.hasData(e)&&(o=z.access(e),a=ce.extend({},o),z.set(t,a))}}function $e(n,r,i,o){r=g(r);var e,t,a,s,u,l,c=0,f=n.length,p=f-1,d=r[0],h=v(d);if(h||1<f&&\"string\"==typeof d&&!le.checkClone&&Pe.test(d))return n.each(function(e){var t=n.eq(e);h&&(r[0]=d.call(this,e,t.html())),$e(t,r,i,o)});if(f&&(t=(e=Ae(r,n[0].ownerDocument,!1,n,o)).firstChild,1===e.childNodes.length&&(e=t),t||o)){for(s=(a=ce.map(Se(e,\"script\"),Ie)).length;c<f;c++)u=e,c!==p&&(u=ce.clone(u,!0,!0),s&&ce.merge(a,Se(u,\"script\"))),i.call(n[c],u,c);if(s)for(l=a[a.length-1].ownerDocument,ce.map(a,We),c=0;c<s;c++)u=a[c],Ce.test(u.type||\"\")&&!_.access(u,\"globalEval\")&&ce.contains(l,u)&&(u.src&&\"module\"!==(u.type||\"\").toLowerCase()?ce._evalUrl&&!u.noModule&&ce._evalUrl(u.src,{nonce:u.nonce||u.getAttribute(\"nonce\")},l):m(u.textContent.replace(Me,\"\"),u,l))}return n}function Be(e,t,n){for(var r,i=t?ce.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||ce.cleanData(Se(r)),r.parentNode&&(n&&K(r)&&Ee(Se(r,\"script\")),r.parentNode.removeChild(r));return e}ce.extend({htmlPrefilter:function(e){return e},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=K(e);if(!(le.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||ce.isXMLDoc(e)))for(a=Se(c),r=0,i=(o=Se(e)).length;r<i;r++)s=o[r],u=a[r],void 0,\"input\"===(l=u.nodeName.toLowerCase())&&we.test(s.type)?u.checked=s.checked:\"input\"!==l&&\"textarea\"!==l||(u.defaultValue=s.defaultValue);if(t)if(n)for(o=o||Se(e),a=a||Se(c),r=0,i=o.length;r<i;r++)Fe(o[r],a[r]);else Fe(e,c);return 0<(a=Se(c,\"script\")).length&&Ee(a,!f&&Se(e,\"script\")),c},cleanData:function(e){for(var t,n,r,i=ce.event.special,o=0;void 0!==(n=e[o]);o++)if($(n)){if(t=n[_.expando]){if(t.events)for(r in t.events)i[r]?ce.event.remove(n,r):ce.removeEvent(n,r,t.handle);n[_.expando]=void 0}n[z.expando]&&(n[z.expando]=void 0)}}}),ce.fn.extend({detach:function(e){return Be(this,e,!0)},remove:function(e){return Be(this,e)},text:function(e){return M(this,function(e){return void 0===e?ce.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return $e(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Re(this,e).appendChild(e)})},prepend:function(){return $e(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Re(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return $e(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return $e(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(ce.cleanData(Se(e,!1)),e.textContent=\"\");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return ce.clone(this,e,t)})},html:function(e){return M(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if(\"string\"==typeof e&&!Oe.test(e)&&!ke[(Te.exec(e)||[\"\",\"\"])[1].toLowerCase()]){e=ce.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(ce.cleanData(Se(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var n=[];return $e(this,arguments,function(e){var t=this.parentNode;ce.inArray(this,n)<0&&(ce.cleanData(Se(this)),t&&t.replaceChild(e,this))},n)}}),ce.each({appendTo:\"append\",prependTo:\"prepend\",insertBefore:\"before\",insertAfter:\"after\",replaceAll:\"replaceWith\"},function(e,a){ce.fn[e]=function(e){for(var t,n=[],r=ce(e),i=r.length-1,o=0;o<=i;o++)t=o===i?this:this.clone(!0),ce(r[o])[a](t),s.apply(n,t.get());return this.pushStack(n)}});var _e=new RegExp(\"^(\"+G+\")(?!px)[a-z%]+$\",\"i\"),ze=/^--/,Xe=function(e){var t=e.ownerDocument.defaultView;return t&&t.opener||(t=ie),t.getComputedStyle(e)},Ue=function(e,t,n){var r,i,o={};for(i in t)o[i]=e.style[i],e.style[i]=t[i];for(i in r=n.call(e),t)e.style[i]=o[i];return r},Ve=new RegExp(Q.join(\"|\"),\"i\");function Ge(e,t,n){var r,i,o,a,s=ze.test(t),u=e.style;return(n=n||Xe(e))&&(a=n.getPropertyValue(t)||n[t],s&&a&&(a=a.replace(ve,\"$1\")||void 0),\"\"!==a||K(e)||(a=ce.style(e,t)),!le.pixelBoxStyles()&&_e.test(a)&&Ve.test(t)&&(r=u.width,i=u.minWidth,o=u.maxWidth,u.minWidth=u.maxWidth=u.width=a,a=n.width,u.width=r,u.minWidth=i,u.maxWidth=o)),void 0!==a?a+\"\":a}function Ye(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}!function(){function e(){if(l){u.style.cssText=\"position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0\",l.style.cssText=\"position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%\",J.appendChild(u).appendChild(l);var e=ie.getComputedStyle(l);n=\"1%\"!==e.top,s=12===t(e.marginLeft),l.style.right=\"60%\",o=36===t(e.right),r=36===t(e.width),l.style.position=\"absolute\",i=12===t(l.offsetWidth/3),J.removeChild(u),l=null}}function t(e){return Math.round(parseFloat(e))}var n,r,i,o,a,s,u=C.createElement(\"div\"),l=C.createElement(\"div\");l.style&&(l.style.backgroundClip=\"content-box\",l.cloneNode(!0).style.backgroundClip=\"\",le.clearCloneStyle=\"content-box\"===l.style.backgroundClip,ce.extend(le,{boxSizingReliable:function(){return e(),r},pixelBoxStyles:function(){return e(),o},pixelPosition:function(){return e(),n},reliableMarginLeft:function(){return e(),s},scrollboxSize:function(){return e(),i},reliableTrDimensions:function(){var e,t,n,r;return null==a&&(e=C.createElement(\"table\"),t=C.createElement(\"tr\"),n=C.createElement(\"div\"),e.style.cssText=\"position:absolute;left:-11111px;border-collapse:separate\",t.style.cssText=\"box-sizing:content-box;border:1px solid\",t.style.height=\"1px\",n.style.height=\"9px\",n.style.display=\"block\",J.appendChild(e).appendChild(t).appendChild(n),r=ie.getComputedStyle(t),a=parseInt(r.height,10)+parseInt(r.borderTopWidth,10)+parseInt(r.borderBottomWidth,10)===t.offsetHeight,J.removeChild(e)),a}}))}();var Qe=[\"Webkit\",\"Moz\",\"ms\"],Je=C.createElement(\"div\").style,Ke={};function Ze(e){var t=ce.cssProps[e]||Ke[e];return t||(e in Je?e:Ke[e]=function(e){var t=e[0].toUpperCase()+e.slice(1),n=Qe.length;while(n--)if((e=Qe[n]+t)in Je)return e}(e)||e)}var et=/^(none|table(?!-c[ea]).+)/,tt={position:\"absolute\",visibility:\"hidden\",display:\"block\"},nt={letterSpacing:\"0\",fontWeight:\"400\"};function rt(e,t,n){var r=Y.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||\"px\"):t}function it(e,t,n,r,i,o){var a=\"width\"===t?1:0,s=0,u=0,l=0;if(n===(r?\"border\":\"content\"))return 0;for(;a<4;a+=2)\"margin\"===n&&(l+=ce.css(e,n+Q[a],!0,i)),r?(\"content\"===n&&(u-=ce.css(e,\"padding\"+Q[a],!0,i)),\"margin\"!==n&&(u-=ce.css(e,\"border\"+Q[a]+\"Width\",!0,i))):(u+=ce.css(e,\"padding\"+Q[a],!0,i),\"padding\"!==n?u+=ce.css(e,\"border\"+Q[a]+\"Width\",!0,i):s+=ce.css(e,\"border\"+Q[a]+\"Width\",!0,i));return!r&&0<=o&&(u+=Math.max(0,Math.ceil(e[\"offset\"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))||0),u+l}function ot(e,t,n){var r=Xe(e),i=(!le.boxSizingReliable()||n)&&\"border-box\"===ce.css(e,\"boxSizing\",!1,r),o=i,a=Ge(e,t,r),s=\"offset\"+t[0].toUpperCase()+t.slice(1);if(_e.test(a)){if(!n)return a;a=\"auto\"}return(!le.boxSizingReliable()&&i||!le.reliableTrDimensions()&&fe(e,\"tr\")||\"auto\"===a||!parseFloat(a)&&\"inline\"===ce.css(e,\"display\",!1,r))&&e.getClientRects().length&&(i=\"border-box\"===ce.css(e,\"boxSizing\",!1,r),(o=s in e)&&(a=e[s])),(a=parseFloat(a)||0)+it(e,t,n||(i?\"border\":\"content\"),o,r,a)+\"px\"}function at(e,t,n,r,i){return new at.prototype.init(e,t,n,r,i)}ce.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Ge(e,\"opacity\");return\"\"===n?\"1\":n}}}},cssNumber:{animationIterationCount:!0,aspectRatio:!0,borderImageSlice:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,scale:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeMiterlimit:!0,strokeOpacity:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=F(t),u=ze.test(t),l=e.style;if(u||(t=Ze(s)),a=ce.cssHooks[t]||ce.cssHooks[s],void 0===n)return a&&\"get\"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];\"string\"===(o=typeof n)&&(i=Y.exec(n))&&i[1]&&(n=te(e,t,i),o=\"number\"),null!=n&&n==n&&(\"number\"!==o||u||(n+=i&&i[3]||(ce.cssNumber[s]?\"\":\"px\")),le.clearCloneStyle||\"\"!==n||0!==t.indexOf(\"background\")||(l[t]=\"inherit\"),a&&\"set\"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=F(t);return ze.test(t)||(t=Ze(s)),(a=ce.cssHooks[t]||ce.cssHooks[s])&&\"get\"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Ge(e,t,r)),\"normal\"===i&&t in nt&&(i=nt[t]),\"\"===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),ce.each([\"height\",\"width\"],function(e,u){ce.cssHooks[u]={get:function(e,t,n){if(t)return!et.test(ce.css(e,\"display\"))||e.getClientRects().length&&e.getBoundingClientRect().width?ot(e,u,n):Ue(e,tt,function(){return ot(e,u,n)})},set:function(e,t,n){var r,i=Xe(e),o=!le.scrollboxSize()&&\"absolute\"===i.position,a=(o||n)&&\"border-box\"===ce.css(e,\"boxSizing\",!1,i),s=n?it(e,u,n,a,i):0;return a&&o&&(s-=Math.ceil(e[\"offset\"+u[0].toUpperCase()+u.slice(1)]-parseFloat(i[u])-it(e,u,\"border\",!1,i)-.5)),s&&(r=Y.exec(t))&&\"px\"!==(r[3]||\"px\")&&(e.style[u]=t,t=ce.css(e,u)),rt(0,t,s)}}}),ce.cssHooks.marginLeft=Ye(le.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Ge(e,\"marginLeft\"))||e.getBoundingClientRect().left-Ue(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+\"px\"}),ce.each({margin:\"\",padding:\"\",border:\"Width\"},function(i,o){ce.cssHooks[i+o]={expand:function(e){for(var t=0,n={},r=\"string\"==typeof e?e.split(\" \"):[e];t<4;t++)n[i+Q[t]+o]=r[t]||r[t-2]||r[0];return n}},\"margin\"!==i&&(ce.cssHooks[i+o].set=rt)}),ce.fn.extend({css:function(e,t){return M(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=Xe(e),i=t.length;a<i;a++)o[t[a]]=ce.css(e,t[a],!1,r);return o}return void 0!==n?ce.style(e,t,n):ce.css(e,t)},e,t,1<arguments.length)}}),((ce.Tween=at).prototype={constructor:at,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||ce.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(ce.cssNumber[n]?\"\":\"px\")},cur:function(){var e=at.propHooks[this.prop];return e&&e.get?e.get(this):at.propHooks._default.get(this)},run:function(e){var t,n=at.propHooks[this.prop];return this.options.duration?this.pos=t=ce.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):at.propHooks._default.set(this),this}}).init.prototype=at.prototype,(at.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=ce.css(e.elem,e.prop,\"\"))&&\"auto\"!==t?t:0},set:function(e){ce.fx.step[e.prop]?ce.fx.step[e.prop](e):1!==e.elem.nodeType||!ce.cssHooks[e.prop]&&null==e.elem.style[Ze(e.prop)]?e.elem[e.prop]=e.now:ce.style(e.elem,e.prop,e.now+e.unit)}}}).scrollTop=at.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},ce.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:\"swing\"},ce.fx=at.prototype.init,ce.fx.step={};var st,ut,lt,ct,ft=/^(?:toggle|show|hide)$/,pt=/queueHooks$/;function dt(){ut&&(!1===C.hidden&&ie.requestAnimationFrame?ie.requestAnimationFrame(dt):ie.setTimeout(dt,ce.fx.interval),ce.fx.tick())}function ht(){return ie.setTimeout(function(){st=void 0}),st=Date.now()}function gt(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i[\"margin\"+(n=Q[r])]=i[\"padding\"+n]=e;return t&&(i.opacity=i.width=e),i}function vt(e,t,n){for(var r,i=(yt.tweeners[t]||[]).concat(yt.tweeners[\"*\"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function yt(o,e,t){var n,a,r=0,i=yt.prefilters.length,s=ce.Deferred().always(function(){delete u.elem}),u=function(){if(a)return!1;for(var e=st||ht(),t=Math.max(0,l.startTime+l.duration-e),n=1-(t/l.duration||0),r=0,i=l.tweens.length;r<i;r++)l.tweens[r].run(n);return s.notifyWith(o,[l,n,t]),n<1&&i?t:(i||s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l]),!1)},l=s.promise({elem:o,props:ce.extend({},e),opts:ce.extend(!0,{specialEasing:{},easing:ce.easing._default},t),originalProperties:e,originalOptions:t,startTime:st||ht(),duration:t.duration,tweens:[],createTween:function(e,t){var n=ce.Tween(o,l.opts,e,t,l.opts.specialEasing[e]||l.opts.easing);return l.tweens.push(n),n},stop:function(e){var t=0,n=e?l.tweens.length:0;if(a)return this;for(a=!0;t<n;t++)l.tweens[t].run(1);return e?(s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l,e])):s.rejectWith(o,[l,e]),this}}),c=l.props;for(!function(e,t){var n,r,i,o,a;for(n in e)if(i=t[r=F(n)],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=ce.cssHooks[r])&&\"expand\"in a)for(n in o=a.expand(o),delete e[r],o)n in e||(e[n]=o[n],t[n]=i);else t[r]=i}(c,l.opts.specialEasing);r<i;r++)if(n=yt.prefilters[r].call(l,o,c,l.opts))return v(n.stop)&&(ce._queueHooks(l.elem,l.opts.queue).stop=n.stop.bind(n)),n;return ce.map(c,vt,l),v(l.opts.start)&&l.opts.start.call(o,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),ce.fx.timer(ce.extend(u,{elem:o,anim:l,queue:l.opts.queue})),l}ce.Animation=ce.extend(yt,{tweeners:{\"*\":[function(e,t){var n=this.createTween(e,t);return te(n.elem,e,Y.exec(t),n),n}]},tweener:function(e,t){v(e)?(t=e,e=[\"*\"]):e=e.match(D);for(var n,r=0,i=e.length;r<i;r++)n=e[r],yt.tweeners[n]=yt.tweeners[n]||[],yt.tweeners[n].unshift(t)},prefilters:[function(e,t,n){var r,i,o,a,s,u,l,c,f=\"width\"in t||\"height\"in t,p=this,d={},h=e.style,g=e.nodeType&&ee(e),v=_.get(e,\"fxshow\");for(r in n.queue||(null==(a=ce._queueHooks(e,\"fx\")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,ce.queue(e,\"fx\").length||a.empty.fire()})})),t)if(i=t[r],ft.test(i)){if(delete t[r],o=o||\"toggle\"===i,i===(g?\"hide\":\"show\")){if(\"show\"!==i||!v||void 0===v[r])continue;g=!0}d[r]=v&&v[r]||ce.style(e,r)}if((u=!ce.isEmptyObject(t))||!ce.isEmptyObject(d))for(r in f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=v&&v.display)&&(l=_.get(e,\"display\")),\"none\"===(c=ce.css(e,\"display\"))&&(l?c=l:(re([e],!0),l=e.style.display||l,c=ce.css(e,\"display\"),re([e]))),(\"inline\"===c||\"inline-block\"===c&&null!=l)&&\"none\"===ce.css(e,\"float\")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l=\"none\"===c?\"\":c)),h.display=\"inline-block\")),n.overflow&&(h.overflow=\"hidden\",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1,d)u||(v?\"hidden\"in v&&(g=v.hidden):v=_.access(e,\"fxshow\",{display:l}),o&&(v.hidden=!g),g&&re([e],!0),p.done(function(){for(r in g||re([e]),_.remove(e,\"fxshow\"),d)ce.style(e,r,d[r])})),u=vt(g?v[r]:0,r,p),r in v||(v[r]=u.start,g&&(u.end=u.start,u.start=0))}],prefilter:function(e,t){t?yt.prefilters.unshift(e):yt.prefilters.push(e)}}),ce.speed=function(e,t,n){var r=e&&\"object\"==typeof e?ce.extend({},e):{complete:n||!n&&t||v(e)&&e,duration:e,easing:n&&t||t&&!v(t)&&t};return ce.fx.off?r.duration=0:\"number\"!=typeof r.duration&&(r.duration in ce.fx.speeds?r.duration=ce.fx.speeds[r.duration]:r.duration=ce.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue=\"fx\"),r.old=r.complete,r.complete=function(){v(r.old)&&r.old.call(this),r.queue&&ce.dequeue(this,r.queue)},r},ce.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ee).css(\"opacity\",0).show().end().animate({opacity:t},e,n,r)},animate:function(t,e,n,r){var i=ce.isEmptyObject(t),o=ce.speed(e,n,r),a=function(){var e=yt(this,ce.extend({},t),o);(i||_.get(this,\"finish\"))&&e.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(i,e,o){var a=function(e){var t=e.stop;delete e.stop,t(o)};return\"string\"!=typeof i&&(o=e,e=i,i=void 0),e&&this.queue(i||\"fx\",[]),this.each(function(){var e=!0,t=null!=i&&i+\"queueHooks\",n=ce.timers,r=_.get(this);if(t)r[t]&&r[t].stop&&a(r[t]);else for(t in r)r[t]&&r[t].stop&&pt.test(t)&&a(r[t]);for(t=n.length;t--;)n[t].elem!==this||null!=i&&n[t].queue!==i||(n[t].anim.stop(o),e=!1,n.splice(t,1));!e&&o||ce.dequeue(this,i)})},finish:function(a){return!1!==a&&(a=a||\"fx\"),this.each(function(){var e,t=_.get(this),n=t[a+\"queue\"],r=t[a+\"queueHooks\"],i=ce.timers,o=n?n.length:0;for(t.finish=!0,ce.queue(this,a,[]),r&&r.stop&&r.stop.call(this,!0),e=i.length;e--;)i[e].elem===this&&i[e].queue===a&&(i[e].anim.stop(!0),i.splice(e,1));for(e=0;e<o;e++)n[e]&&n[e].finish&&n[e].finish.call(this);delete t.finish})}}),ce.each([\"toggle\",\"show\",\"hide\"],function(e,r){var i=ce.fn[r];ce.fn[r]=function(e,t,n){return null==e||\"boolean\"==typeof e?i.apply(this,arguments):this.animate(gt(r,!0),e,t,n)}}),ce.each({slideDown:gt(\"show\"),slideUp:gt(\"hide\"),slideToggle:gt(\"toggle\"),fadeIn:{opacity:\"show\"},fadeOut:{opacity:\"hide\"},fadeToggle:{opacity:\"toggle\"}},function(e,r){ce.fn[e]=function(e,t,n){return this.animate(r,e,t,n)}}),ce.timers=[],ce.fx.tick=function(){var e,t=0,n=ce.timers;for(st=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||ce.fx.stop(),st=void 0},ce.fx.timer=function(e){ce.timers.push(e),ce.fx.start()},ce.fx.interval=13,ce.fx.start=function(){ut||(ut=!0,dt())},ce.fx.stop=function(){ut=null},ce.fx.speeds={slow:600,fast:200,_default:400},ce.fn.delay=function(r,e){return r=ce.fx&&ce.fx.speeds[r]||r,e=e||\"fx\",this.queue(e,function(e,t){var n=ie.setTimeout(e,r);t.stop=function(){ie.clearTimeout(n)}})},lt=C.createElement(\"input\"),ct=C.createElement(\"select\").appendChild(C.createElement(\"option\")),lt.type=\"checkbox\",le.checkOn=\"\"!==lt.value,le.optSelected=ct.selected,(lt=C.createElement(\"input\")).value=\"t\",lt.type=\"radio\",le.radioValue=\"t\"===lt.value;var mt,xt=ce.expr.attrHandle;ce.fn.extend({attr:function(e,t){return M(this,ce.attr,e,t,1<arguments.length)},removeAttr:function(e){return this.each(function(){ce.removeAttr(this,e)})}}),ce.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return\"undefined\"==typeof e.getAttribute?ce.prop(e,t,n):(1===o&&ce.isXMLDoc(e)||(i=ce.attrHooks[t.toLowerCase()]||(ce.expr.match.bool.test(t)?mt:void 0)),void 0!==n?null===n?void ce.removeAttr(e,t):i&&\"set\"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+\"\"),n):i&&\"get\"in i&&null!==(r=i.get(e,t))?r:null==(r=ce.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!le.radioValue&&\"radio\"===t&&fe(e,\"input\")){var n=e.value;return e.setAttribute(\"type\",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(D);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),mt={set:function(e,t,n){return!1===t?ce.removeAttr(e,n):e.setAttribute(n,n),n}},ce.each(ce.expr.match.bool.source.match(/\\w+/g),function(e,t){var a=xt[t]||ce.find.attr;xt[t]=function(e,t,n){var r,i,o=t.toLowerCase();return n||(i=xt[o],xt[o]=r,r=null!=a(e,t,n)?o:null,xt[o]=i),r}});var bt=/^(?:input|select|textarea|button)$/i,wt=/^(?:a|area)$/i;function Tt(e){return(e.match(D)||[]).join(\" \")}function Ct(e){return e.getAttribute&&e.getAttribute(\"class\")||\"\"}function kt(e){return Array.isArray(e)?e:\"string\"==typeof e&&e.match(D)||[]}ce.fn.extend({prop:function(e,t){return M(this,ce.prop,e,t,1<arguments.length)},removeProp:function(e){return this.each(function(){delete this[ce.propFix[e]||e]})}}),ce.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&ce.isXMLDoc(e)||(t=ce.propFix[t]||t,i=ce.propHooks[t]),void 0!==n?i&&\"set\"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&\"get\"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=ce.find.attr(e,\"tabindex\");return t?parseInt(t,10):bt.test(e.nodeName)||wt.test(e.nodeName)&&e.href?0:-1}}},propFix:{\"for\":\"htmlFor\",\"class\":\"className\"}}),le.optSelected||(ce.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),ce.each([\"tabIndex\",\"readOnly\",\"maxLength\",\"cellSpacing\",\"cellPadding\",\"rowSpan\",\"colSpan\",\"useMap\",\"frameBorder\",\"contentEditable\"],function(){ce.propFix[this.toLowerCase()]=this}),ce.fn.extend({addClass:function(t){var e,n,r,i,o,a;return v(t)?this.each(function(e){ce(this).addClass(t.call(this,e,Ct(this)))}):(e=kt(t)).length?this.each(function(){if(r=Ct(this),n=1===this.nodeType&&\" \"+Tt(r)+\" \"){for(o=0;o<e.length;o++)i=e[o],n.indexOf(\" \"+i+\" \")<0&&(n+=i+\" \");a=Tt(n),r!==a&&this.setAttribute(\"class\",a)}}):this},removeClass:function(t){var e,n,r,i,o,a;return v(t)?this.each(function(e){ce(this).removeClass(t.call(this,e,Ct(this)))}):arguments.length?(e=kt(t)).length?this.each(function(){if(r=Ct(this),n=1===this.nodeType&&\" \"+Tt(r)+\" \"){for(o=0;o<e.length;o++){i=e[o];while(-1<n.indexOf(\" \"+i+\" \"))n=n.replace(\" \"+i+\" \",\" \")}a=Tt(n),r!==a&&this.setAttribute(\"class\",a)}}):this:this.attr(\"class\",\"\")},toggleClass:function(t,n){var e,r,i,o,a=typeof t,s=\"string\"===a||Array.isArray(t);return v(t)?this.each(function(e){ce(this).toggleClass(t.call(this,e,Ct(this),n),n)}):\"boolean\"==typeof n&&s?n?this.addClass(t):this.removeClass(t):(e=kt(t),this.each(function(){if(s)for(o=ce(this),i=0;i<e.length;i++)r=e[i],o.hasClass(r)?o.removeClass(r):o.addClass(r);else void 0!==t&&\"boolean\"!==a||((r=Ct(this))&&_.set(this,\"__className__\",r),this.setAttribute&&this.setAttribute(\"class\",r||!1===t?\"\":_.get(this,\"__className__\")||\"\"))}))},hasClass:function(e){var t,n,r=0;t=\" \"+e+\" \";while(n=this[r++])if(1===n.nodeType&&-1<(\" \"+Tt(Ct(n))+\" \").indexOf(t))return!0;return!1}});var St=/\\r/g;ce.fn.extend({val:function(n){var r,e,i,t=this[0];return arguments.length?(i=v(n),this.each(function(e){var t;1===this.nodeType&&(null==(t=i?n.call(this,e,ce(this).val()):n)?t=\"\":\"number\"==typeof t?t+=\"\":Array.isArray(t)&&(t=ce.map(t,function(e){return null==e?\"\":e+\"\"})),(r=ce.valHooks[this.type]||ce.valHooks[this.nodeName.toLowerCase()])&&\"set\"in r&&void 0!==r.set(this,t,\"value\")||(this.value=t))})):t?(r=ce.valHooks[t.type]||ce.valHooks[t.nodeName.toLowerCase()])&&\"get\"in r&&void 0!==(e=r.get(t,\"value\"))?e:\"string\"==typeof(e=t.value)?e.replace(St,\"\"):null==e?\"\":e:void 0}}),ce.extend({valHooks:{option:{get:function(e){var t=ce.find.attr(e,\"value\");return null!=t?t:Tt(ce.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a=\"select-one\"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!fe(n.parentNode,\"optgroup\"))){if(t=ce(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=ce.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=-1<ce.inArray(ce.valHooks.option.get(r),o))&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),ce.each([\"radio\",\"checkbox\"],function(){ce.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=-1<ce.inArray(ce(e).val(),t)}},le.checkOn||(ce.valHooks[this].get=function(e){return null===e.getAttribute(\"value\")?\"on\":e.value})});var Et=ie.location,jt={guid:Date.now()},At=/\\?/;ce.parseXML=function(e){var t,n;if(!e||\"string\"!=typeof e)return null;try{t=(new ie.DOMParser).parseFromString(e,\"text/xml\")}catch(e){}return n=t&&t.getElementsByTagName(\"parsererror\")[0],t&&!n||ce.error(\"Invalid XML: \"+(n?ce.map(n.childNodes,function(e){return e.textContent}).join(\"\\n\"):e)),t};var Dt=/^(?:focusinfocus|focusoutblur)$/,Nt=function(e){e.stopPropagation()};ce.extend(ce.event,{trigger:function(e,t,n,r){var i,o,a,s,u,l,c,f,p=[n||C],d=ue.call(e,\"type\")?e.type:e,h=ue.call(e,\"namespace\")?e.namespace.split(\".\"):[];if(o=f=a=n=n||C,3!==n.nodeType&&8!==n.nodeType&&!Dt.test(d+ce.event.triggered)&&(-1<d.indexOf(\".\")&&(d=(h=d.split(\".\")).shift(),h.sort()),u=d.indexOf(\":\")<0&&\"on\"+d,(e=e[ce.expando]?e:new ce.Event(d,\"object\"==typeof e&&e)).isTrigger=r?2:3,e.namespace=h.join(\".\"),e.rnamespace=e.namespace?new RegExp(\"(^|\\\\.)\"+h.join(\"\\\\.(?:.*\\\\.|)\")+\"(\\\\.|$)\"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:ce.makeArray(t,[e]),c=ce.event.special[d]||{},r||!c.trigger||!1!==c.trigger.apply(n,t))){if(!r&&!c.noBubble&&!y(n)){for(s=c.delegateType||d,Dt.test(s+d)||(o=o.parentNode);o;o=o.parentNode)p.push(o),a=o;a===(n.ownerDocument||C)&&p.push(a.defaultView||a.parentWindow||ie)}i=0;while((o=p[i++])&&!e.isPropagationStopped())f=o,e.type=1<i?s:c.bindType||d,(l=(_.get(o,\"events\")||Object.create(null))[e.type]&&_.get(o,\"handle\"))&&l.apply(o,t),(l=u&&o[u])&&l.apply&&$(o)&&(e.result=l.apply(o,t),!1===e.result&&e.preventDefault());return e.type=d,r||e.isDefaultPrevented()||c._default&&!1!==c._default.apply(p.pop(),t)||!$(n)||u&&v(n[d])&&!y(n)&&((a=n[u])&&(n[u]=null),ce.event.triggered=d,e.isPropagationStopped()&&f.addEventListener(d,Nt),n[d](),e.isPropagationStopped()&&f.removeEventListener(d,Nt),ce.event.triggered=void 0,a&&(n[u]=a)),e.result}},simulate:function(e,t,n){var r=ce.extend(new ce.Event,n,{type:e,isSimulated:!0});ce.event.trigger(r,null,t)}}),ce.fn.extend({trigger:function(e,t){return this.each(function(){ce.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return ce.event.trigger(e,t,n,!0)}});var qt=/\\[\\]$/,Lt=/\\r?\\n/g,Ht=/^(?:submit|button|image|reset|file)$/i,Ot=/^(?:input|select|textarea|keygen)/i;function Pt(n,e,r,i){var t;if(Array.isArray(e))ce.each(e,function(e,t){r||qt.test(n)?i(n,t):Pt(n+\"[\"+(\"object\"==typeof t&&null!=t?e:\"\")+\"]\",t,r,i)});else if(r||\"object\"!==x(e))i(n,e);else for(t in e)Pt(n+\"[\"+t+\"]\",e[t],r,i)}ce.param=function(e,t){var n,r=[],i=function(e,t){var n=v(t)?t():t;r[r.length]=encodeURIComponent(e)+\"=\"+encodeURIComponent(null==n?\"\":n)};if(null==e)return\"\";if(Array.isArray(e)||e.jquery&&!ce.isPlainObject(e))ce.each(e,function(){i(this.name,this.value)});else for(n in e)Pt(n,e[n],t,i);return r.join(\"&\")},ce.fn.extend({serialize:function(){return ce.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=ce.prop(this,\"elements\");return e?ce.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!ce(this).is(\":disabled\")&&Ot.test(this.nodeName)&&!Ht.test(e)&&(this.checked||!we.test(e))}).map(function(e,t){var n=ce(this).val();return null==n?null:Array.isArray(n)?ce.map(n,function(e){return{name:t.name,value:e.replace(Lt,\"\\r\\n\")}}):{name:t.name,value:n.replace(Lt,\"\\r\\n\")}}).get()}});var Mt=/%20/g,Rt=/#.*$/,It=/([?&])_=[^&]*/,Wt=/^(.*?):[ \\t]*([^\\r\\n]*)$/gm,Ft=/^(?:GET|HEAD)$/,$t=/^\\/\\//,Bt={},_t={},zt=\"*/\".concat(\"*\"),Xt=C.createElement(\"a\");function Ut(o){return function(e,t){\"string\"!=typeof e&&(t=e,e=\"*\");var n,r=0,i=e.toLowerCase().match(D)||[];if(v(t))while(n=i[r++])\"+\"===n[0]?(n=n.slice(1)||\"*\",(o[n]=o[n]||[]).unshift(t)):(o[n]=o[n]||[]).push(t)}}function Vt(t,i,o,a){var s={},u=t===_t;function l(e){var r;return s[e]=!0,ce.each(t[e]||[],function(e,t){var n=t(i,o,a);return\"string\"!=typeof n||u||s[n]?u?!(r=n):void 0:(i.dataTypes.unshift(n),l(n),!1)}),r}return l(i.dataTypes[0])||!s[\"*\"]&&l(\"*\")}function Gt(e,t){var n,r,i=ce.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&ce.extend(!0,e,r),e}Xt.href=Et.href,ce.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Et.href,type:\"GET\",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Et.protocol),global:!0,processData:!0,async:!0,contentType:\"application/x-www-form-urlencoded; charset=UTF-8\",accepts:{\"*\":zt,text:\"text/plain\",html:\"text/html\",xml:\"application/xml, text/xml\",json:\"application/json, text/javascript\"},contents:{xml:/\\bxml\\b/,html:/\\bhtml/,json:/\\bjson\\b/},responseFields:{xml:\"responseXML\",text:\"responseText\",json:\"responseJSON\"},converters:{\"* text\":String,\"text html\":!0,\"text json\":JSON.parse,\"text xml\":ce.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Gt(Gt(e,ce.ajaxSettings),t):Gt(ce.ajaxSettings,e)},ajaxPrefilter:Ut(Bt),ajaxTransport:Ut(_t),ajax:function(e,t){\"object\"==typeof e&&(t=e,e=void 0),t=t||{};var c,f,p,n,d,r,h,g,i,o,v=ce.ajaxSetup({},t),y=v.context||v,m=v.context&&(y.nodeType||y.jquery)?ce(y):ce.event,x=ce.Deferred(),b=ce.Callbacks(\"once memory\"),w=v.statusCode||{},a={},s={},u=\"canceled\",T={readyState:0,getResponseHeader:function(e){var t;if(h){if(!n){n={};while(t=Wt.exec(p))n[t[1].toLowerCase()+\" \"]=(n[t[1].toLowerCase()+\" \"]||[]).concat(t[2])}t=n[e.toLowerCase()+\" \"]}return null==t?null:t.join(\", \")},getAllResponseHeaders:function(){return h?p:null},setRequestHeader:function(e,t){return null==h&&(e=s[e.toLowerCase()]=s[e.toLowerCase()]||e,a[e]=t),this},overrideMimeType:function(e){return null==h&&(v.mimeType=e),this},statusCode:function(e){var t;if(e)if(h)T.always(e[T.status]);else for(t in e)w[t]=[w[t],e[t]];return this},abort:function(e){var t=e||u;return c&&c.abort(t),l(0,t),this}};if(x.promise(T),v.url=((e||v.url||Et.href)+\"\").replace($t,Et.protocol+\"//\"),v.type=t.method||t.type||v.method||v.type,v.dataTypes=(v.dataType||\"*\").toLowerCase().match(D)||[\"\"],null==v.crossDomain){r=C.createElement(\"a\");try{r.href=v.url,r.href=r.href,v.crossDomain=Xt.protocol+\"//\"+Xt.host!=r.protocol+\"//\"+r.host}catch(e){v.crossDomain=!0}}if(v.data&&v.processData&&\"string\"!=typeof v.data&&(v.data=ce.param(v.data,v.traditional)),Vt(Bt,v,t,T),h)return T;for(i in(g=ce.event&&v.global)&&0==ce.active++&&ce.event.trigger(\"ajaxStart\"),v.type=v.type.toUpperCase(),v.hasContent=!Ft.test(v.type),f=v.url.replace(Rt,\"\"),v.hasContent?v.data&&v.processData&&0===(v.contentType||\"\").indexOf(\"application/x-www-form-urlencoded\")&&(v.data=v.data.replace(Mt,\"+\")):(o=v.url.slice(f.length),v.data&&(v.processData||\"string\"==typeof v.data)&&(f+=(At.test(f)?\"&\":\"?\")+v.data,delete v.data),!1===v.cache&&(f=f.replace(It,\"$1\"),o=(At.test(f)?\"&\":\"?\")+\"_=\"+jt.guid+++o),v.url=f+o),v.ifModified&&(ce.lastModified[f]&&T.setRequestHeader(\"If-Modified-Since\",ce.lastModified[f]),ce.etag[f]&&T.setRequestHeader(\"If-None-Match\",ce.etag[f])),(v.data&&v.hasContent&&!1!==v.contentType||t.contentType)&&T.setRequestHeader(\"Content-Type\",v.contentType),T.setRequestHeader(\"Accept\",v.dataTypes[0]&&v.accepts[v.dataTypes[0]]?v.accepts[v.dataTypes[0]]+(\"*\"!==v.dataTypes[0]?\", \"+zt+\"; q=0.01\":\"\"):v.accepts[\"*\"]),v.headers)T.setRequestHeader(i,v.headers[i]);if(v.beforeSend&&(!1===v.beforeSend.call(y,T,v)||h))return T.abort();if(u=\"abort\",b.add(v.complete),T.done(v.success),T.fail(v.error),c=Vt(_t,v,t,T)){if(T.readyState=1,g&&m.trigger(\"ajaxSend\",[T,v]),h)return T;v.async&&0<v.timeout&&(d=ie.setTimeout(function(){T.abort(\"timeout\")},v.timeout));try{h=!1,c.send(a,l)}catch(e){if(h)throw e;l(-1,e)}}else l(-1,\"No Transport\");function l(e,t,n,r){var i,o,a,s,u,l=t;h||(h=!0,d&&ie.clearTimeout(d),c=void 0,p=r||\"\",T.readyState=0<e?4:0,i=200<=e&&e<300||304===e,n&&(s=function(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while(\"*\"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader(\"Content-Type\"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+\" \"+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}(v,T,n)),!i&&-1<ce.inArray(\"script\",v.dataTypes)&&ce.inArray(\"json\",v.dataTypes)<0&&(v.converters[\"text script\"]=function(){}),s=function(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if(\"*\"===o)o=u;else if(\"*\"!==u&&u!==o){if(!(a=l[u+\" \"+o]||l[\"* \"+o]))for(i in l)if((s=i.split(\" \"))[1]===o&&(a=l[u+\" \"+s[0]]||l[\"* \"+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e[\"throws\"])t=a(t);else try{t=a(t)}catch(e){return{state:\"parsererror\",error:a?e:\"No conversion from \"+u+\" to \"+o}}}return{state:\"success\",data:t}}(v,s,T,i),i?(v.ifModified&&((u=T.getResponseHeader(\"Last-Modified\"))&&(ce.lastModified[f]=u),(u=T.getResponseHeader(\"etag\"))&&(ce.etag[f]=u)),204===e||\"HEAD\"===v.type?l=\"nocontent\":304===e?l=\"notmodified\":(l=s.state,o=s.data,i=!(a=s.error))):(a=l,!e&&l||(l=\"error\",e<0&&(e=0))),T.status=e,T.statusText=(t||l)+\"\",i?x.resolveWith(y,[o,l,T]):x.rejectWith(y,[T,l,a]),T.statusCode(w),w=void 0,g&&m.trigger(i?\"ajaxSuccess\":\"ajaxError\",[T,v,i?o:a]),b.fireWith(y,[T,l]),g&&(m.trigger(\"ajaxComplete\",[T,v]),--ce.active||ce.event.trigger(\"ajaxStop\")))}return T},getJSON:function(e,t,n){return ce.get(e,t,n,\"json\")},getScript:function(e,t){return ce.get(e,void 0,t,\"script\")}}),ce.each([\"get\",\"post\"],function(e,i){ce[i]=function(e,t,n,r){return v(t)&&(r=r||n,n=t,t=void 0),ce.ajax(ce.extend({url:e,type:i,dataType:r,data:t,success:n},ce.isPlainObject(e)&&e))}}),ce.ajaxPrefilter(function(e){var t;for(t in e.headers)\"content-type\"===t.toLowerCase()&&(e.contentType=e.headers[t]||\"\")}),ce._evalUrl=function(e,t,n){return ce.ajax({url:e,type:\"GET\",dataType:\"script\",cache:!0,async:!1,global:!1,converters:{\"text script\":function(){}},dataFilter:function(e){ce.globalEval(e,t,n)}})},ce.fn.extend({wrapAll:function(e){var t;return this[0]&&(v(e)&&(e=e.call(this[0])),t=ce(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(n){return v(n)?this.each(function(e){ce(this).wrapInner(n.call(this,e))}):this.each(function(){var e=ce(this),t=e.contents();t.length?t.wrapAll(n):e.append(n)})},wrap:function(t){var n=v(t);return this.each(function(e){ce(this).wrapAll(n?t.call(this,e):t)})},unwrap:function(e){return this.parent(e).not(\"body\").each(function(){ce(this).replaceWith(this.childNodes)}),this}}),ce.expr.pseudos.hidden=function(e){return!ce.expr.pseudos.visible(e)},ce.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},ce.ajaxSettings.xhr=function(){try{return new ie.XMLHttpRequest}catch(e){}};var Yt={0:200,1223:204},Qt=ce.ajaxSettings.xhr();le.cors=!!Qt&&\"withCredentials\"in Qt,le.ajax=Qt=!!Qt,ce.ajaxTransport(function(i){var o,a;if(le.cors||Qt&&!i.crossDomain)return{send:function(e,t){var n,r=i.xhr();if(r.open(i.type,i.url,i.async,i.username,i.password),i.xhrFields)for(n in i.xhrFields)r[n]=i.xhrFields[n];for(n in i.mimeType&&r.overrideMimeType&&r.overrideMimeType(i.mimeType),i.crossDomain||e[\"X-Requested-With\"]||(e[\"X-Requested-With\"]=\"XMLHttpRequest\"),e)r.setRequestHeader(n,e[n]);o=function(e){return function(){o&&(o=a=r.onload=r.onerror=r.onabort=r.ontimeout=r.onreadystatechange=null,\"abort\"===e?r.abort():\"error\"===e?\"number\"!=typeof r.status?t(0,\"error\"):t(r.status,r.statusText):t(Yt[r.status]||r.status,r.statusText,\"text\"!==(r.responseType||\"text\")||\"string\"!=typeof r.responseText?{binary:r.response}:{text:r.responseText},r.getAllResponseHeaders()))}},r.onload=o(),a=r.onerror=r.ontimeout=o(\"error\"),void 0!==r.onabort?r.onabort=a:r.onreadystatechange=function(){4===r.readyState&&ie.setTimeout(function(){o&&a()})},o=o(\"abort\");try{r.send(i.hasContent&&i.data||null)}catch(e){if(o)throw e}},abort:function(){o&&o()}}}),ce.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),ce.ajaxSetup({accepts:{script:\"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript\"},contents:{script:/\\b(?:java|ecma)script\\b/},converters:{\"text script\":function(e){return ce.globalEval(e),e}}}),ce.ajaxPrefilter(\"script\",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type=\"GET\")}),ce.ajaxTransport(\"script\",function(n){var r,i;if(n.crossDomain||n.scriptAttrs)return{send:function(e,t){r=ce(\"<script>\").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on(\"load error\",i=function(e){r.remove(),i=null,e&&t(\"error\"===e.type?404:200,e.type)}),C.head.appendChild(r[0])},abort:function(){i&&i()}}});var Jt,Kt=[],Zt=/(=)\\?(?=&|$)|\\?\\?/;ce.ajaxSetup({jsonp:\"callback\",jsonpCallback:function(){var e=Kt.pop()||ce.expando+\"_\"+jt.guid++;return this[e]=!0,e}}),ce.ajaxPrefilter(\"json jsonp\",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Zt.test(e.url)?\"url\":\"string\"==typeof e.data&&0===(e.contentType||\"\").indexOf(\"application/x-www-form-urlencoded\")&&Zt.test(e.data)&&\"data\");if(a||\"jsonp\"===e.dataTypes[0])return r=e.jsonpCallback=v(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Zt,\"$1\"+r):!1!==e.jsonp&&(e.url+=(At.test(e.url)?\"&\":\"?\")+e.jsonp+\"=\"+r),e.converters[\"script json\"]=function(){return o||ce.error(r+\" was not called\"),o[0]},e.dataTypes[0]=\"json\",i=ie[r],ie[r]=function(){o=arguments},n.always(function(){void 0===i?ce(ie).removeProp(r):ie[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Kt.push(r)),o&&v(i)&&i(o[0]),o=i=void 0}),\"script\"}),le.createHTMLDocument=((Jt=C.implementation.createHTMLDocument(\"\").body).innerHTML=\"<form></form><form></form>\",2===Jt.childNodes.length),ce.parseHTML=function(e,t,n){return\"string\"!=typeof e?[]:(\"boolean\"==typeof t&&(n=t,t=!1),t||(le.createHTMLDocument?((r=(t=C.implementation.createHTMLDocument(\"\")).createElement(\"base\")).href=C.location.href,t.head.appendChild(r)):t=C),o=!n&&[],(i=w.exec(e))?[t.createElement(i[1])]:(i=Ae([e],t,o),o&&o.length&&ce(o).remove(),ce.merge([],i.childNodes)));var r,i,o},ce.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(\" \");return-1<s&&(r=Tt(e.slice(s)),e=e.slice(0,s)),v(t)?(n=t,t=void 0):t&&\"object\"==typeof t&&(i=\"POST\"),0<a.length&&ce.ajax({url:e,type:i||\"GET\",dataType:\"html\",data:t}).done(function(e){o=arguments,a.html(r?ce(\"<div>\").append(ce.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},ce.expr.pseudos.animated=function(t){return ce.grep(ce.timers,function(e){return t===e.elem}).length},ce.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=ce.css(e,\"position\"),c=ce(e),f={};\"static\"===l&&(e.style.position=\"relative\"),s=c.offset(),o=ce.css(e,\"top\"),u=ce.css(e,\"left\"),(\"absolute\"===l||\"fixed\"===l)&&-1<(o+u).indexOf(\"auto\")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),v(t)&&(t=t.call(e,n,ce.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),\"using\"in t?t.using.call(e,f):c.css(f)}},ce.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){ce.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if(\"fixed\"===ce.css(r,\"position\"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&\"static\"===ce.css(e,\"position\"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=ce(e).offset()).top+=ce.css(e,\"borderTopWidth\",!0),i.left+=ce.css(e,\"borderLeftWidth\",!0))}return{top:t.top-i.top-ce.css(r,\"marginTop\",!0),left:t.left-i.left-ce.css(r,\"marginLeft\",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&\"static\"===ce.css(e,\"position\"))e=e.offsetParent;return e||J})}}),ce.each({scrollLeft:\"pageXOffset\",scrollTop:\"pageYOffset\"},function(t,i){var o=\"pageYOffset\"===i;ce.fn[t]=function(e){return M(this,function(e,t,n){var r;if(y(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),ce.each([\"top\",\"left\"],function(e,n){ce.cssHooks[n]=Ye(le.pixelPosition,function(e,t){if(t)return t=Ge(e,n),_e.test(t)?ce(e).position()[n]+\"px\":t})}),ce.each({Height:\"height\",Width:\"width\"},function(a,s){ce.each({padding:\"inner\"+a,content:s,\"\":\"outer\"+a},function(r,o){ce.fn[o]=function(e,t){var n=arguments.length&&(r||\"boolean\"!=typeof e),i=r||(!0===e||!0===t?\"margin\":\"border\");return M(this,function(e,t,n){var r;return y(e)?0===o.indexOf(\"outer\")?e[\"inner\"+a]:e.document.documentElement[\"client\"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body[\"scroll\"+a],r[\"scroll\"+a],e.body[\"offset\"+a],r[\"offset\"+a],r[\"client\"+a])):void 0===n?ce.css(e,t,i):ce.style(e,t,n,i)},s,n?e:void 0,n)}})}),ce.each([\"ajaxStart\",\"ajaxStop\",\"ajaxComplete\",\"ajaxError\",\"ajaxSuccess\",\"ajaxSend\"],function(e,t){ce.fn[t]=function(e){return this.on(t,e)}}),ce.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,\"**\"):this.off(t,e||\"**\",n)},hover:function(e,t){return this.on(\"mouseenter\",e).on(\"mouseleave\",t||e)}}),ce.each(\"blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu\".split(\" \"),function(e,n){ce.fn[n]=function(e,t){return 0<arguments.length?this.on(n,null,e,t):this.trigger(n)}});var en=/^[\\s\\uFEFF\\xA0]+|([^\\s\\uFEFF\\xA0])[\\s\\uFEFF\\xA0]+$/g;ce.proxy=function(e,t){var n,r,i;if(\"string\"==typeof t&&(n=e[t],t=e,e=n),v(e))return r=ae.call(arguments,2),(i=function(){return e.apply(t||this,r.concat(ae.call(arguments)))}).guid=e.guid=e.guid||ce.guid++,i},ce.holdReady=function(e){e?ce.readyWait++:ce.ready(!0)},ce.isArray=Array.isArray,ce.parseJSON=JSON.parse,ce.nodeName=fe,ce.isFunction=v,ce.isWindow=y,ce.camelCase=F,ce.type=x,ce.now=Date.now,ce.isNumeric=function(e){var t=ce.type(e);return(\"number\"===t||\"string\"===t)&&!isNaN(e-parseFloat(e))},ce.trim=function(e){return null==e?\"\":(e+\"\").replace(en,\"$1\")},\"function\"==typeof define&&define.amd&&define(\"jquery\",[],function(){return ce});var tn=ie.jQuery,nn=ie.$;return ce.noConflict=function(e){return ie.$===ce&&(ie.$=nn),e&&ie.jQuery===ce&&(ie.jQuery=tn),ce},\"undefined\"==typeof e&&(ie.jQuery=ie.$=ce),ce});\n/*\n * jQuery throttle / debounce - v1.1 - 3/7/2010\n * http://benalman.com/projects/jquery-throttle-debounce-plugin/\n * \n * Copyright (c) 2010 \"Cowboy\" Ben Alman\n * Dual licensed under the MIT and GPL licenses.\n * http://benalman.com/about/license/\n */\n(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);\n/*!\n * imagesLoaded PACKAGED v4.1.4\n * JavaScript is all like \"You images are done yet or what?\"\n * MIT License\n */\n!function(e,t){\"function\"==typeof define&&define.amd?define(\"ev-emitter/ev-emitter\",t):\"object\"==typeof module&&module.exports?module.exports=t():e.EvEmitter=t()}(\"undefined\"!=typeof window?window:this,function(){function e(){}var t=e.prototype;return t.on=function(e,t){if(e&&t){var i=this._events=this._events||{},n=i[e]=i[e]||[];return n.indexOf(t)==-1&&n.push(t),this}},t.once=function(e,t){if(e&&t){this.on(e,t);var i=this._onceEvents=this._onceEvents||{},n=i[e]=i[e]||{};return n[t]=!0,this}},t.off=function(e,t){var i=this._events&&this._events[e];if(i&&i.length){var n=i.indexOf(t);return n!=-1&&i.splice(n,1),this}},t.emitEvent=function(e,t){var i=this._events&&this._events[e];if(i&&i.length){i=i.slice(0),t=t||[];for(var n=this._onceEvents&&this._onceEvents[e],o=0;o<i.length;o++){var r=i[o],s=n&&n[r];s&&(this.off(e,r),delete n[r]),r.apply(this,t)}return this}},t.allOff=function(){delete this._events,delete this._onceEvents},e}),function(e,t){\"use strict\";\"function\"==typeof define&&define.amd?define([\"ev-emitter/ev-emitter\"],function(i){return t(e,i)}):\"object\"==typeof module&&module.exports?module.exports=t(e,require(\"ev-emitter\")):e.imagesLoaded=t(e,e.EvEmitter)}(\"undefined\"!=typeof window?window:this,function(e,t){function i(e,t){for(var i in t)e[i]=t[i];return e}function n(e){if(Array.isArray(e))return e;var t=\"object\"==typeof e&&\"number\"==typeof e.length;return t?d.call(e):[e]}function o(e,t,r){if(!(this instanceof o))return new o(e,t,r);var s=e;return\"string\"==typeof e&&(s=document.querySelectorAll(e)),s?(this.elements=n(s),this.options=i({},this.options),\"function\"==typeof t?r=t:i(this.options,t),r&&this.on(\"always\",r),this.getImages(),h&&(this.jqDeferred=new h.Deferred),void setTimeout(this.check.bind(this))):void a.error(\"Bad element for imagesLoaded \"+(s||e))}function r(e){this.img=e}function s(e,t){this.url=e,this.element=t,this.img=new Image}var h=e.jQuery,a=e.console,d=Array.prototype.slice;o.prototype=Object.create(t.prototype),o.prototype.options={},o.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)},o.prototype.addElementImages=function(e){\"IMG\"==e.nodeName&&this.addImage(e),this.options.background===!0&&this.addElementBackgroundImages(e);var t=e.nodeType;if(t&&u[t]){for(var i=e.querySelectorAll(\"img\"),n=0;n<i.length;n++){var o=i[n];this.addImage(o)}if(\"string\"==typeof this.options.background){var r=e.querySelectorAll(this.options.background);for(n=0;n<r.length;n++){var s=r[n];this.addElementBackgroundImages(s)}}}};var u={1:!0,9:!0,11:!0};return o.prototype.addElementBackgroundImages=function(e){var t=getComputedStyle(e);if(t)for(var i=/url\\((['\"])?(.*?)\\1\\)/gi,n=i.exec(t.backgroundImage);null!==n;){var o=n&&n[2];o&&this.addBackground(o,e),n=i.exec(t.backgroundImage)}},o.prototype.addImage=function(e){var t=new r(e);this.images.push(t)},o.prototype.addBackground=function(e,t){var i=new s(e,t);this.images.push(i)},o.prototype.check=function(){function e(e,i,n){setTimeout(function(){t.progress(e,i,n)})}var t=this;return this.progressedCount=0,this.hasAnyBroken=!1,this.images.length?void this.images.forEach(function(t){t.once(\"progress\",e),t.check()}):void this.complete()},o.prototype.progress=function(e,t,i){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded,this.emitEvent(\"progress\",[this,e,t]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,e),this.progressedCount==this.images.length&&this.complete(),this.options.debug&&a&&a.log(\"progress: \"+i,e,t)},o.prototype.complete=function(){var e=this.hasAnyBroken?\"fail\":\"done\";if(this.isComplete=!0,this.emitEvent(e,[this]),this.emitEvent(\"always\",[this]),this.jqDeferred){var t=this.hasAnyBroken?\"reject\":\"resolve\";this.jqDeferred[t](this)}},r.prototype=Object.create(t.prototype),r.prototype.check=function(){var e=this.getIsImageComplete();return e?void this.confirm(0!==this.img.naturalWidth,\"naturalWidth\"):(this.proxyImage=new Image,this.proxyImage.addEventListener(\"load\",this),this.proxyImage.addEventListener(\"error\",this),this.img.addEventListener(\"load\",this),this.img.addEventListener(\"error\",this),void(this.proxyImage.src=this.img.src))},r.prototype.getIsImageComplete=function(){return this.img.complete&&this.img.naturalWidth},r.prototype.confirm=function(e,t){this.isLoaded=e,this.emitEvent(\"progress\",[this,this.img,t])},r.prototype.handleEvent=function(e){var t=\"on\"+e.type;this[t]&&this[t](e)},r.prototype.onload=function(){this.confirm(!0,\"onload\"),this.unbindEvents()},r.prototype.onerror=function(){this.confirm(!1,\"onerror\"),this.unbindEvents()},r.prototype.unbindEvents=function(){this.proxyImage.removeEventListener(\"load\",this),this.proxyImage.removeEventListener(\"error\",this),this.img.removeEventListener(\"load\",this),this.img.removeEventListener(\"error\",this)},s.prototype=Object.create(r.prototype),s.prototype.check=function(){this.img.addEventListener(\"load\",this),this.img.addEventListener(\"error\",this),this.img.src=this.url;var e=this.getIsImageComplete();e&&(this.confirm(0!==this.img.naturalWidth,\"naturalWidth\"),this.unbindEvents())},s.prototype.unbindEvents=function(){this.img.removeEventListener(\"load\",this),this.img.removeEventListener(\"error\",this)},s.prototype.confirm=function(e,t){this.isLoaded=e,this.emitEvent(\"progress\",[this,this.element,t])},o.makeJQueryPlugin=function(t){t=t||e.jQuery,t&&(h=t,h.fn.imagesLoaded=function(e,t){var i=new o(this,e,t);return i.jqDeferred.promise(h(this))})},o.makeJQueryPlugin(),o});\n/*! lz-string-1.3.3-min.js | (c) 2013 Pieroxy | Licensed under a WTFPL license */\nvar 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}\n/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/dist/FileSaver.js */\n(function(a,b){if(\"function\"==typeof define&&define.amd)define([],b);else if(\"undefined\"!=typeof exports)b();else{b(),a.FileSaver={exports:{}}.exports}})(this,function(){\"use strict\";function b(a,b){return\"undefined\"==typeof b?b={autoBom:!1}:\"object\"!=typeof b&&(console.warn(\"Deprecated: Expected third argument to be a object\"),b={autoBom:!b}),b.autoBom&&/^\\s*(?:text\\/\\S*|application\\/xml|\\S*\\/\\S*\\+xml)\\s*;.*charset\\s*=\\s*utf-8/i.test(a.type)?new Blob([\"\\uFEFF\",a],{type:a.type}):a}function c(a,b,c){var d=new XMLHttpRequest;d.open(\"GET\",a),d.responseType=\"blob\",d.onload=function(){g(d.response,b,c)},d.onerror=function(){console.error(\"could not download file\")},d.send()}function d(a){var b=new XMLHttpRequest;b.open(\"HEAD\",a,!1);try{b.send()}catch(a){}return 200<=b.status&&299>=b.status}function e(a){try{a.dispatchEvent(new MouseEvent(\"click\"))}catch(c){var b=document.createEvent(\"MouseEvents\");b.initMouseEvent(\"click\",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),a.dispatchEvent(b)}}var f=\"object\"==typeof window&&window.window===window?window:\"object\"==typeof self&&self.self===self?self:\"object\"==typeof global&&global.global===global?global:void 0,a=/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),g=f.saveAs||(\"object\"!=typeof window||window!==f?function(){}:\"download\"in HTMLAnchorElement.prototype&&!a?function(b,g,h){var i=f.URL||f.webkitURL,j=document.createElement(\"a\");g=g||b.name||\"download\",j.download=g,j.rel=\"noopener\",\"string\"==typeof b?(j.href=b,j.origin===location.origin?e(j):d(j.href)?c(b,g,h):e(j,j.target=\"_blank\")):(j.href=i.createObjectURL(b),setTimeout(function(){i.revokeObjectURL(j.href)},4E4),setTimeout(function(){e(j)},0))}:\"msSaveOrOpenBlob\"in navigator?function(f,g,h){if(g=g||f.name||\"download\",\"string\"!=typeof f)navigator.msSaveOrOpenBlob(b(f,h),g);else if(d(f))c(f,g,h);else{var i=document.createElement(\"a\");i.href=f,i.target=\"_blank\",setTimeout(function(){e(i)})}}:function(b,d,e,g){if(g=g||open(\"\",\"_blank\"),g&&(g.document.title=g.document.body.innerText=\"downloading...\"),\"string\"==typeof b)return c(b,d,e);var h=\"application/octet-stream\"===b.type,i=/constructor/i.test(f.HTMLElement)||f.safari,j=/CriOS\\/[\\d]+/.test(navigator.userAgent);if((j||h&&i||a)&&\"undefined\"!=typeof FileReader){var k=new FileReader;k.onloadend=function(){var a=k.result;a=j?a:a.replace(/^data:[^;]*;/,\"data:attachment/file;\"),g?g.location.href=a:location=a,g=null},k.readAsDataURL(b)}else{var l=f.URL||f.webkitURL,m=l.createObjectURL(b);g?g.location=m:location.href=m,g=null,setTimeout(function(){l.revokeObjectURL(m)},4E4)}});f.saveAs=g.saveAs=g,\"undefined\"!=typeof module&&(module.exports=g)});\n/*! console_hack.js | (c) 2015 Thomas Michael Edwards | Licensed under SugarCube's Simple BSD license */\n!function(){for(var methods=[\"assert\",\"clear\",\"count\",\"debug\",\"dir\",\"dirxml\",\"error\",\"exception\",\"group\",\"groupCollapsed\",\"groupEnd\",\"info\",\"log\",\"markTimeline\",\"profile\",\"profileEnd\",\"table\",\"time\",\"timeEnd\",\"timeline\",\"timelineEnd\",\"timeStamp\",\"trace\",\"warn\"],length=methods.length,noop=function(){},console=window.console=window.console||{};length--;){var method=methods[length];console[method]||(console[method]=noop)}}();\n}else{document.documentElement.setAttribute(\"data-init\", \"lacking\");}\n</script>\n<style id=\"style-normalize\" type=\"text/css\">/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */\n\n/**\n * 1. Set default font family to sans-serif.\n * 2. Prevent iOS and IE text size adjust after device orientation change,\n *    without disabling user zoom.\n */\n\nhtml {\n  font-family: sans-serif; /* 1 */\n  -ms-text-size-adjust: 100%; /* 2 */\n  -webkit-text-size-adjust: 100%; /* 2 */\n}\n\n/**\n * Remove default margin.\n */\n\nbody {\n  margin: 0;\n}\n\n/* HTML5 display definitions\n   ========================================================================== */\n\n/**\n * Correct `block` display not defined for any HTML5 element in IE 8/9.\n * Correct `block` display not defined for `details` or `summary` in IE 10/11\n * and Firefox.\n * Correct `block` display not defined for `main` in IE 11.\n */\n\narticle,\naside,\ndetails,\nfigcaption,\nfigure,\nfooter,\nheader,\nhgroup,\nmain,\nmenu,\nnav,\nsection,\nsummary {\n  display: block;\n}\n\n/**\n * 1. Correct `inline-block` display not defined in IE 8/9.\n * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.\n */\n\naudio,\ncanvas,\nprogress,\nvideo {\n  display: inline-block; /* 1 */\n  vertical-align: baseline; /* 2 */\n}\n\n/**\n * Prevent modern browsers from displaying `audio` without controls.\n * Remove excess height in iOS 5 devices.\n */\n\naudio:not([controls]) {\n  display: none;\n  height: 0;\n}\n\n/**\n * Address `[hidden]` styling not present in IE 8/9/10.\n * Hide the `template` element in IE 8/9/10/11, Safari, and Firefox < 22.\n */\n\n[hidden],\ntemplate {\n  display: none;\n}\n\n/* Links\n   ========================================================================== */\n\n/**\n * Remove the gray background color from active links in IE 10.\n */\n\na {\n  background-color: transparent;\n}\n\n/**\n * Improve readability of focused elements when they are also in an\n * active/hover state.\n */\n\na:active,\na:hover {\n  outline: 0;\n}\n\n/* Text-level semantics\n   ========================================================================== */\n\n/**\n * Address styling not present in IE 8/9/10/11, Safari, and Chrome.\n */\n\nabbr[title] {\n  border-bottom: 1px dotted;\n}\n\n/**\n * Address style set to `bolder` in Firefox 4+, Safari, and Chrome.\n */\n\nb,\nstrong {\n  font-weight: bold;\n}\n\n/**\n * Address styling not present in Safari and Chrome.\n */\n\ndfn {\n  font-style: italic;\n}\n\n/**\n * Address variable `h1` font-size and margin within `section` and `article`\n * contexts in Firefox 4+, Safari, and Chrome.\n */\n\nh1 {\n  font-size: 2em;\n  margin: 0.67em 0;\n}\n\n/**\n * Address styling not present in IE 8/9.\n */\n\nmark {\n  background: #ff0;\n  color: #000;\n}\n\n/**\n * Address inconsistent and variable font size in all browsers.\n */\n\nsmall {\n  font-size: 80%;\n}\n\n/**\n * Prevent `sub` and `sup` affecting `line-height` in all browsers.\n */\n\nsub,\nsup {\n  font-size: 75%;\n  line-height: 0;\n  position: relative;\n  vertical-align: baseline;\n}\n\nsup {\n  top: -0.5em;\n}\n\nsub {\n  bottom: -0.25em;\n}\n\n/* Embedded content\n   ========================================================================== */\n\n/**\n * Remove border when inside `a` element in IE 8/9/10.\n */\n\nimg {\n  border: 0;\n}\n\n/**\n * Correct overflow not hidden in IE 9/10/11.\n */\n\nsvg:not(:root) {\n  overflow: hidden;\n}\n\n/* Grouping content\n   ========================================================================== */\n\n/**\n * Address margin not present in IE 8/9 and Safari.\n */\n\nfigure {\n  margin: 1em 40px;\n}\n\n/**\n * Address differences between Firefox and other browsers.\n */\n\nhr {\n  box-sizing: content-box;\n  height: 0;\n}\n\n/**\n * Contain overflow in all browsers.\n */\n\npre {\n  overflow: auto;\n}\n\n/**\n * Address odd `em`-unit font size rendering in all browsers.\n */\n\ncode,\nkbd,\npre,\nsamp {\n  font-family: monospace, monospace;\n  font-size: 1em;\n}\n\n/* Forms\n   ========================================================================== */\n\n/**\n * Known limitation: by default, Chrome and Safari on OS X allow very limited\n * styling of `select`, unless a `border` property is set.\n */\n\n/**\n * 1. Correct color not being inherited.\n *    Known issue: affects color of disabled elements.\n * 2. Correct font properties not being inherited.\n * 3. Address margins set differently in Firefox 4+, Safari, and Chrome.\n */\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n  color: inherit; /* 1 */\n  font: inherit; /* 2 */\n  margin: 0; /* 3 */\n}\n\n/**\n * Address `overflow` set to `hidden` in IE 8/9/10/11.\n */\n\nbutton {\n  overflow: visible;\n}\n\n/**\n * Address inconsistent `text-transform` inheritance for `button` and `select`.\n * All other form control elements do not inherit `text-transform` values.\n * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.\n * Correct `select` style inheritance in Firefox.\n */\n\nbutton,\nselect {\n  text-transform: none;\n}\n\n/**\n * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`\n *    and `video` controls.\n * 2. Correct inability to style clickable `input` types in iOS.\n * 3. Improve usability and consistency of cursor style between image-type\n *    `input` and others.\n */\n\nbutton,\nhtml input[type=\"button\"], /* 1 */\ninput[type=\"reset\"],\ninput[type=\"submit\"] {\n  -webkit-appearance: button; /* 2 */\n  cursor: pointer; /* 3 */\n}\n\n/**\n * Re-set default cursor for disabled elements.\n */\n\nbutton[disabled],\nhtml input[disabled] {\n  cursor: default;\n}\n\n/**\n * Remove inner padding and border in Firefox 4+.\n */\n\nbutton::-moz-focus-inner,\ninput::-moz-focus-inner {\n  border: 0;\n  padding: 0;\n}\n\n/**\n * Address Firefox 4+ setting `line-height` on `input` using `!important` in\n * the UA stylesheet.\n */\n\ninput {\n  line-height: normal;\n}\n\n/**\n * It's recommended that you don't attempt to style these elements.\n * Firefox's implementation doesn't respect box-sizing, padding, or width.\n *\n * 1. Address box sizing set to `content-box` in IE 8/9/10.\n * 2. Remove excess padding in IE 8/9/10.\n */\n\ninput[type=\"checkbox\"],\ninput[type=\"radio\"] {\n  box-sizing: border-box; /* 1 */\n  padding: 0; /* 2 */\n}\n\n/**\n * Fix the cursor style for Chrome's increment/decrement buttons. For certain\n * `font-size` values of the `input`, it causes the cursor style of the\n * decrement button to change from `default` to `text`.\n */\n\ninput[type=\"number\"]::-webkit-inner-spin-button,\ninput[type=\"number\"]::-webkit-outer-spin-button {\n  height: auto;\n}\n\n/**\n * 1. Address `appearance` set to `searchfield` in Safari and Chrome.\n * 2. Address `box-sizing` set to `border-box` in Safari and Chrome.\n */\n\ninput[type=\"search\"] {\n  -webkit-appearance: textfield; /* 1 */\n  box-sizing: content-box; /* 2 */\n}\n\n/**\n * Remove inner padding and search cancel button in Safari and Chrome on OS X.\n * Safari (but not Chrome) clips the cancel button when the search input has\n * padding (and `textfield` appearance).\n */\n\ninput[type=\"search\"]::-webkit-search-cancel-button,\ninput[type=\"search\"]::-webkit-search-decoration {\n  -webkit-appearance: none;\n}\n\n/**\n * Define consistent border, margin, and padding.\n */\n\nfieldset {\n  border: 1px solid #c0c0c0;\n  margin: 0 2px;\n  padding: 0.35em 0.625em 0.75em;\n}\n\n/**\n * 1. Correct `color` not being inherited in IE 8/9/10/11.\n * 2. Remove padding so people aren't caught out if they zero out fieldsets.\n */\n\nlegend {\n  border: 0; /* 1 */\n  padding: 0; /* 2 */\n}\n\n/**\n * Remove default vertical scrollbar in IE 8/9/10/11.\n */\n\ntextarea {\n  overflow: auto;\n}\n\n/**\n * Don't inherit the `font-weight` (applied by a rule above).\n * NOTE: the default cannot safely be changed in Chrome and Safari on OS X.\n */\n\noptgroup {\n  font-weight: bold;\n}\n\n/* Tables\n   ========================================================================== */\n\n/**\n * Remove most spacing between table cells.\n */\n\ntable {\n  border-collapse: collapse;\n  border-spacing: 0;\n}\n\ntd,\nth {\n  padding: 0;\n}\n</style>\n<style id=\"style-init-screen\" type=\"text/css\">/***********************************************************************************************************************\n\n\tcss/_mixins.css\n\n\tCopyright © 2020–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\n/***********************************************************************************************************************\n\n\tcss/init-screen.css\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\n@keyframes init-loading-spin {\n\t0%   { transform: rotate(0deg); }\n\t100% { transform: rotate(360deg); }\n}\n#init-screen {\n\tdisplay: none;\n\tz-index: 500000;\n\tposition: fixed;\n\ttop: 0px;\n\tleft: 0px;\n\theight: 100%;\n\twidth: 100%;\n\tfont: 28px/1 Helmet, Freesans, sans-serif;\n\tfont-weight: bold;\n\tcolor: #eee;\n\tbackground-color: #111;\n\ttext-align: center;\n}\n#init-screen > div {\n\tdisplay: none;\n\tposition: relative;\n\tmargin: 0 auto;\n\tmax-width: 1136px;\n\ttop: 25%;\n}\nhtml[data-init=\"no-js\"] #init-screen, html[data-init=\"lacking\"] #init-screen, html[data-init=\"loading\"] #init-screen {\n\tdisplay: block;\n}\nhtml[data-init=\"no-js\"] #init-no-js, html[data-init=\"lacking\"] #init-lacking {\n\tdisplay: block;\n\tpadding: 0 1em;\n}\nhtml[data-init=\"no-js\"] #init-no-js {\n\tcolor: red;\n}\nhtml[data-init=\"loading\"] #init-loading {\n\tdisplay: block;\n\tborder: 24px solid transparent;\n\tborder-radius: 50%;\n\tborder-top-color: #7f7f7f;\n\tborder-bottom-color: #7f7f7f;\n\twidth: 100px;\n\theight: 100px;\n\tanimation: init-loading-spin 2s linear infinite;\n}\nhtml[data-init=\"loading\"] #init-loading > div {\n\ttext-indent: 9999em;\n\toverflow: hidden;\n\twhite-space: nowrap;\n}\nhtml[data-init=\"loading\"] #ui-bar, html[data-init=\"loading\"] #passages {\n\tdisplay: none;\n}\n</style>\n<style id=\"style-font\" type=\"text/css\">/***********************************************************************************************************************\n\n\tcss/_mixins.css\n\n\tCopyright © 2020–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\n/***********************************************************************************************************************\n\n\tcss/font.css\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\n@font-face {\n\t/*\n\t\ttme-fa-icons (2020-03-27)\n\n\t\t`tme-fa-icons` is a subset of the Font Awesome font v4.7.0 by Dave Gandy (http://fontawesome.com)\n\t\tand is licensed under the SIL OFL 1.1 (http://scripts.sil.org/OFL).\n\t*/\n\tfont-family: \"tme-fa-icons\";\n\tsrc: url('data:application/octet-stream;base64,d09GRgABAAAAADLAAA8AAAAAWHgAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABWAAAADsAAABUIIslek9TLzIAAAGUAAAAQwAAAFY+IEkIY21hcAAAAdgAAAG8AAAF3rob9jFjdnQgAAADlAAAABMAAAAgBtX/BGZwZ20AAAOoAAAFkAAAC3CKkZBZZ2FzcAAACTgAAAAIAAAACAAAABBnbHlmAAAJQAAAI6gAADv+gJOpzGhlYWQAACzoAAAAMwAAADYY1IZaaGhlYQAALRwAAAAgAAAAJAfCBClobXR4AAAtPAAAAJEAAAFMBfb/0WxvY2EAAC3QAAAAqAAAAKhjiHI5bWF4cAAALngAAAAgAAAAIAFjDA9uYW1lAAAumAAAAY0AAAL94+zEpHBvc3QAADAoAAACHAAAA11cG/YjcHJlcAAAMkQAAAB6AAAAhuVBK7x4nGNgZGBg4GIwYLBjYHJx8wlh4MtJLMljkGJgYYAAkDwymzEnMz2RgQPGA8qxgGkOIGaDiAIAJjsFSAB4nGNgZNZgnMDAysDAVMW0h4GBoQdCMz5gMGRkAooysDIzYAUBaa4pDA4vGF4EMgf9z2KIYg5imAYUZgTJAQDSIQumAHic7dTVbltRAETR7dpNCikzQ8rMzMxt/M39mHnsU1/TfZz5jFpaV7pXJunMDLAZmOqaZjD5y4Tx+uPTyeL5lG2L5zN+L94zG8+ztr7ulXH1fra4bvK9M79xiWW2sNXPbWeFHexkF7vZw172sZ8DHOQQhznCUY5xnBOc5BSnOcNZVjnHeS5wkUtc5gpX/f3r3OAmt7jNHe5yj/s84CGPeMwTnvKM57zgJa94zRve8o73fOAjn/jMF77yje/84Ce/WGPun1zi/2tlXKbp3Xyc44bFyZanSWokJDXOOjXSk/LUSXn+pEwCKTNBaqQqZU5IjX+XMjukTBEp80TKZJEyY6RMGylzR8oEkjKLpEwlKfNJyqSSMrOkTC8pc0zKRJMy26RMOSnzTsrkk7IDpGwDKXtByoaQsiukbA0p+0PKJpGyU6RsFyl7RmosQcrukbKFpOwjKZtJyo6Ssq2k7C0pG0zKLpOy1aTsNymbTsrOk7L9pNwBUi4CKbeBlCtByr0g5XKQckNIuSak3BVSLgwpt4aUq0PK/SHlEpFyk0i5TqTcKVIuFim3i5QrRso9I+WykXLjXOYNzP8BuAPUwHicY2BAAxIQyBz0PwuEARJsA90AeJytVml300YUHXlJnIQsJQstamHExGmwRiZswYAJQbJjIF2crZWgixQ76b7xid/gX/Nk2nPoN35a7xsvJJC053Cak6N3583VzNtlElqS2AvrkZSbL8XU1iaN7DwJ6YZNy1F8KDt7IWWKyd8FURCtltq3HYdERCJQta6wRBD7HlmaZHzoUUbLtqRXTcotPekuW+NBvVXffho6yrE7oaRmM3RoPbIlVRhVokimPVLSpmWo+itJK7y/wsxXzVDCiE4iabwZxtBI3htntMpoNbbjKIpsstwoUiSa4UEUeZTVEufkigkMygfNkPLKpxHlw/yIrNijnFawS7bT/L4vead3OT+xX29RtuRAH8iO7ODsdCVfhFtbYdy0k+0oVBF213dCbNnsVP9mj/KaRgO3KzK90IxgqXyFECs/ocz+IVktnE/5kkejWrKRE0HrZU7sSz6B1uOIKXHNGFnQ3dEJEdT9kjMM9pg+Hvzx3imWCxMCeBzLekclnAgTKWFzNEnaMHJgJWWLKqn1rpg45XVaxFvCfu3a0ZfOaONQd2I8Ww8dWzlRyfFoUqeZTJ3aSc2jKQ2ilHQmeMyvAyg/oklebWM1iZVH0zhmxoREIgIt3EtTQSw7saQpBM2jGb25G6a5di1apMkD9dyj9/TmVri501PaDvSzRn9Wp2I62AvT6WnkL/Fp2uUiRen66Rl+TOJB1gIykS02w5SDB2/9DtLL15YchdcG2O7t8yuofdZE8KQB+xvQHk/VKQlMhZhViFZAYq1rWZbJ1awWqcjUd0OaVr6s0wSKchwXx76Mcf1fMzOWmBK+34nTsyMuPXPtSwjTHHybdT2a16nFcgFxZnlOp1mW7+s0x/IDneZZntfpCEtbp6MsP9RpgeVHOh1jeUELmnTfwZCLMOQCDpAwhKUDQ1hegiEsFQxhuQhDWBZhCMslGMLyYxjCchmGsLysZdXUU0nj2plYBmxCYGKOHrnMReVqKrlUQrtoVGpDnhJulVQUz6p/ZaBePPKGObAWSJfIml8xzpWPRuX41hUtbxo7V8Cx6m8fjvY58VLWi4U/Bf/V1lQlvWLNw5Or8BuGnmwnqjapeHRNl89VPbr+X1RUWAv0G0iFWCjKsmxwZyKEjzqdhmqglUPMbMw8tOt1y5qfw/03MUIWUP34NxQaC9yDTllJWe3grNXX27LcO4NyOBMsSTE38/pW+CIjs9J+kVnKno98HnAFjEpl2GoDrRW82ScxD5neJM8EcVtRNkja2M4EiQ0c84B5850EJmHqqg3kTuGGDfgFYW7BeSdconqjLIfuRezzKKT8W6fiRPaoaIzAs9kbYa/vQspvcQwkNPmlfgxUFaGpGDUV0DRSbqgGX8bZum1Cxg70Iyp2w7Ks4sPHFveVkm0ZhHykiNWjo5/WXqJOqtx+ZhSX752+BcEgNTF/e990cZDKu1rJMkdtA1O3GpVT15pD41WH6uZR9b3j7BM5a5puuiceel/TqtvBxVwssPZtDtJSJhfU9WGFDaLLxaVQ6mU0Se+4BxgWGNDvUIqN/6v62HyeK1WF0XEk307Ut9HnYAz8D9h/R/UD0Pdj6HINLs/3mhOfbvThbJmuohfrp+g3MGutuVm6BtzQdAPiIUetjrjKDXynBnF6pLkc6SHgY90V4gHAJoDF4BPdtYzmUwCj+Yw5PsDnzGHQZA6DLeYw2GbOGsAOcxjsMofBHnMYfMGcdYAvmcMgZA6DiDkMnjAnAHjKHAZfMYfB18xh8A1z7gN8yxwGMXMYJMxhsK/p1jDMLV7QXaC2QVWgA1NPWNzD4lBTZcj+jheG/b1BzP7BIKb+qOn2kPoTLwz1Z4OY+otBTP1V050h9TdeGOrvBjH1D4OY+ky/GMtlBr+MfJcKB5RdbD7n74n3D9vFQLkAAQAB//8AD3icrXsLcFzlleZ//v+++nb37dfte/VotVrdrW5JltuKpO6WJVluPyXbsmOEbGRjO4KVjWPZlsM4QIU4IYGlgCE2yxqKIQkJg2GreKQCTCZb1CZkiswjzOwOmSTATNVWTZLdDUwSMrVDsomD23vOf69assFAqgbk+773P4//nPOdc/5mwNjFl8WjosbaWblmxiOmIlTGYXzb11M7Z2ohAMbZCcZ5iG9prZl4whfwGju05xtttitUdwXYEUgkbQtWga5lC+XBaqJI285qpb8dVEc8Gnm5L5QM/f58yAlB399a7dD0mWAmdAqaMvBmKPKX9TdDwSjod9yhx03FAPcvI6Gk2lV33XoXUtKgL8C6Wa0WSzXbVjhg6JoqIPShCK0FOvOuE48K1V4B1VUQAVevugmP7Fz2CmTzW5/8+ZGP/+Kp7h/8oI4MuOZ7M5B9IvujH2Wf+PnCAjzn8ZK6AieMKRcvXnxWWSWCzGARlPcqtqs21WZzEBFgYIVDAYWzVJIrXBlH+hXGlWNM00GAJmYZ8sKBzTJFVZVppijqDFMVdTIWLa0o5JrdaHusPZGIG1IjFhQGK2mAZEe56kJnR1bTY7ZT7eivFGODBTdma3pHtlCNDVbwmgMHx/aO4R8ffeet5/ZCG6TfuV03IaSJU3oIzKsGO9+5PV+BwU5xqnOQx1aO8fW71yvD9fPn55/fA22PmsaFvfSgwZ8wzPiFvZ2DUMnzJ2hHVDMmHucPsSRrq7UQo4DMAV/AW7CANw/Zru3NIx20bBEpXwukArlxxOPReibaG63/SyQyiftzcBy3k1HuOHgjEgFHnkYfh4VodDJC4138Ff8hv5PlWbrWmm2O6grNEgGNCWGnbFtRm1Z04gzQPPWvkqMWF4eWU8DB267Df+gNe84bBvfRpfNI5Ny5yAmHDh5/PPLuByMlekDS9DsRR73nWHetwBShSO5PqCBQONO4E2wGlSvYZG6gMzeQ09SWFZC0tWION3oOVVXGTbGM+hrAzQj0O25yoN8R8YzzRsaZdzLwhpsGPEm783hAJ9+kq286eDX5pn/VydDjvk7i8EuchU21JJ3DNOqFzeABmywPcNXxhu/wB+3whrqwVw7Cn1j8vPfdDH6O7PR3fDV/Cb85wua/waSit309grZJHHOhHEQ9CA7zTGVCUb0ZvXzc1lrRe5Af+4An0aSL9op0IU9y6vRFtAYGKy7KJGFbQrdg2dXqGAwWilld0zUy9xLqd6A/zeFuy7gzYFmBOwOhZ6NNhZakm8YTI7S1pyM1mM032V26qevXGlzZ8+TKvROlB/BBkO9ACDalB7OZuBnuC5tRcAItpalENNOfhajVH1A2a1HjbHZ4N4r54oWLz4qPoe4jrMo2sonapm5QRQBQ3XycKVxwRRxjQuVCnWc6mrzOZ5FvBiraOmia5FubYRpok8n0ioRTKOQMNbWiszxYWAFZrQ1sB+dDJTFYghzyiBN3oB857ndIAha4Se/+YGUtjAkXXUO2xPE2eoe3TWPeMOXmzNi+j9w1HghvVbSAmu4c6nFac6MgbzXFU2baDr1241+98TfHtU/9t7df+MzU4msmfPYj06Wbw8Gqohda0/FkSyiyvtPGG/FsMKq1pLqmPvndkye/+y+08eYIHEJZpFmJra2Nop/VWuKcCwPvgRhnGlOFps6iIdAEmFVAKh53jblZyBU6nAFdbfX03tGwioZ9oGnEyDSWTQCyFzhoR+s/jdjgWLmc3L2K21zEmXCsM5aDm4g9Ny5v0PZVb+dY9Rcd/sl5eTiPj0nTaeiU+BhhW2qbuzJcUy2Nc2gCrjBkxWCqZiArGgOuwSzjAlDb5L91XfpvfYbpij6ZRIUWYoVcLqC2+UqNLddsMrekY3GZztVl2uQjpl4xjedIM+Uybc/r5viShuHgcgXuwQtpuoMHz8utCe/s8S+Y/7xMaYu2DX1yDrez3lp3cyyKdop+HLcLi878Uh9SKOSlj73cOIUFRVKVKHhaSS9JP452RCcYoJ3w85bz8Ckp9VN4xeZj9atpH4FnPCV4OtiDNIVYCrWwsbauK81VxUlaQnA+riFBisoUsiU0LbQpASCmmRAwg1MNJoH19uQ6WpriUV1jIQjphA5QjosiTfiy1tF+kPJKMTFYpAu6lkx40odnTv7VjYtC/QtTJyGH9HmMnKamGrcaqmaagRsMUwR9WeLmwsQREvIRevSvYa8uVFXo9Sc0w5A8/Rp5+jcxhXLuYAOIx/pbY+ggFp0FV8lNoLNAEQvyDkwBZR9T1ZC6xR0qFgsybix3DJcR7iIGwCsCHHQM0nYKVSBXQZPnqG7KDZiqrn8K524gpN9ghAx42k4GsvF3nohnA0kbnglkC9mrl7h4Db2TommKcVE1QOPRd97K5WJxsKO5nIjHbHtx/og3kK8iWys1he/EkKlqCbFOB6iKQp5Q5Yp6DB0AsjmPvHEFSGsoFraPaVpI2zLc2lmudErjJ/eeQwbKPoRBZulcwhwXYc6i1SdiEpiCF+KrFOIrAzKaHdhQ79tw4MAGuJv4rt8sQQu80jloGnnDfNVJBa+vn1WjSg1d8NHrg44FbTgdJ5+T77yy/gDI5wY7633yTbI7+CdyMDyEL2paDd0BvZjyfIYXH2/H+aqjDfXUisgnk3rFYMePoyZBegWanQpM5hKdlUSU1JnoQH2iG1d90IYADi0JPV2/oxMEeB7apm+aBngFw/ObMjzHzv7dgzyOh48fHZnmO9c8Wv+2RAGwHiP20UNnzx46mvYxyaMixDpZX22lQqQgRDqG4kYcMo92cpypAOo0Ti+iSYXJRGc5l8wvQhPfqpE0SYa7nDwkeQyh26OOlbecqVumoCwJ8+mDm+9/5T4eOyOt+4wk8WjavYTIG+7nD5Li2cWv8zGkMYoz51q2u3Y1JQSwfcumSn9JUxW0CZIWQ5isqKCo8zoGFPybx/lyHD2w4AaCBw7Ap1HIxAaHyZlr1tXG1owMt7h5Ox5QmxF4Iv6vDhaQoTFAYADuYIlnLa7b7RwtiOBDtVK1dbyCMXXxn5azOIIKfLFKaQP9K3HKIMYEQosvhkIWH23TQ9wIpCq9M4WxycnJsQIUYrEJ/bPGuOZohfHVzdmMaAmHm418c7DU3xdoyYPebFktPJtpHu7fefjw4R0VHiNTa06ZUTPe09a1sdTUVNrYtbo3nth11VW7tBa1d/U1a1t71rdG2u1IJNkWDYdbUs0pnnFT+OloWzISsdsjqVpvy9prqrNjed41POfPx2+J7TIXaWP5Wgf5bvToBEvpppQYOXPOJoda4gTQE6TsNK8sAvUSSHBFygfnfM9wL+8aK/Bddv0tZ8SufyKZ7ml7s20iCWdsPpPu4YVaXuur/2M6WX8riReTE21vtPUAnn4iyTxdf0vJ+/QM0pwsUL4D5BmUBQEeXpaU4W6RtExzN1In7eT9qHPpIoUdqAzSrdyHIPo1JNRps1uioCWJyIm2U/JG8oO4aZMXozF8b4RupRd5JJv7Nn8ZeUyxjlrakhJHcwO2gHMUDgGLR0MmS0GrIoMRWos0K81LUnPZYgmkw6sM8HtCoQTaT9y0Wu3f/MZuCYfijhMPhUVQNdL2hY8kMroS/8UvEqqeSfC/xzPV07k3vsqyrL+2ykYnhJjEz45OLIdbu4ncrbrWhImzltU7oqqaXAEdMWiHxPsSdvuF70K6/xf6FejjL13YBvFVP+UXrkwnyelZjBcltoLypQIoEmsoiDUw4C2QFS/I/J6yx5ybWOOqaMad0kJlKo+ElAdLqvRTMqOsgucuM64j3hgHU1H1mIkQ084Oje3eXT1lZwL1nwaD0BZMNfFTcHpv+sf7v6LEo4oZMlRbFNqH9tb60nEN0UkQ0mYawZNpR878eFuD1lWsl/Jb9J5iMbPlDKnkh3raBmS66U1M9Jm5rKUmMel1dKLOcxrVSgf5dJqU4o0g0pJyTlV37x4bytpCATOG8VUT4+m9cPoURiakE34ZMes/wbB0Roun+2p7h9oLSlwzQqZq2eIr+xe2/Rhp5QF8hHn5Hh/FfM9ibs32UrNG+l22ZbrnJ8N+fERAcD6YCp6nuPc2Aq/vWXiMfzKaye/BDfzTLPwe33MT8ns4P/y0uiLBdyZw3qRvNvGZegjF6H+escXvreOnkD7zm7IkADTbJEkU4sdw1jmwzpTj42smHLB82ijenjfx9YsXkccR+B5+I1azGtQk+4maTpnLlsBL75E7O1IPea+mzfPmUwQt00FJoG+nPxN/zruZzZprTljyx2GpXiHdYWBZtcINeB+2xVP16/GT9euDwf00TbqgK5gK7QvCmfp/wPn15WDa3BcM1l/Hy8F9wZQ31nf4Q2IjjrXyG+BnzXnMmqXiTuB5CLa01gINjvb8mesSTwHuSAEtzm8anp+uvwbdprkfhUs0wCNIxH6TP1l/vf6aPDThK0TXI5I+tjj+SX/8wIcaPxWX4y+CqsCiEIiAIzhsKrgfh+6qv+4L4RETPl6/zqMKukki9AA96OseZb3Zk7UKVKxZKt65tpR1J9p1sTGgP5Z4ah+KEzl73R/xEfr+I8H5fchlN/Jr0n0c3fSGkrz+vbhd5m2ZWltThDeKUaKh3WTZXWauS+WomBdMkjGvOCRuT9YfcIZxk0x24/5cT3q8redxe8TpTsLn03b9LIaFo/I0eQ7uxtjQm6rffI4elnTcJfbwX/qRFyG+Vw+SaJdyFIpugk0WXCcnaZFo1323viNAWHZPvk1+ugfjTf2sbcPR5LDT442bhwPj6Z5z9qi9wr8B85Ji51yXb3tISxlpSUtaZEYnFX8ZbHI6C8vk4ll2h5/YdRQbM0CUbSmXHsd5rH5zWz7fBnc/5iA1NLANwyQZ2+5JjiYfQ4mle+BxJA1prT9g+770dv4zTz9RnTPp+JlY4DJKoroOucmyT4fnsGIeFC3H9EtmB+qnGyP6413tPvs4BhIwipskDKakeIg+KKTgbl92JBkkHn1J3c8t+9ia2vBKhMFkGBJtEjrGDIzKE1SeAgTJiDAVRYpKmSGwMlksJor5gUWgjKlXYS0gurS4neaYflXJnaWBUjDKNAVhkWoF1WhHz7uJ2PapE8NHJkulySPD62/qVmLapMq10a997JqvnphQarc8dO3UQ2smYr38pfOWszK6fTs+eBKfHy4j8t2uWNrWnbDx5CNfe+TkxrHVE/EEW4ynxM9H2FhtpAeE2tnGFUH1J4xXChxD5hACLNXbLgOA3WU353rI37Y44SipbwdxwED/mEC0rOmuIzmlGkw7SBzNxZ6NN3519+zXRhV1Uosp3TdtGD68s4eXJo8uzHVtjyXc85gC9MYmRh+euuaRk+vhAG43Tm3RLGW7Clp52Oesq3N7dKVjnW9KxCdWjyFvi/nUs+Ja5CnPxtn+2t4NnVwLrELw76JqDMz1MacMGJoR0I5RVsA1lR/DLEdonLJLQWnOMcSamKlrszLnWWZ3mzcVOjsrnYWynTfVNmQ6aQFxrWtL9SQtgjqsojbxf5lp+qquSF1rVGyk02qZZEEKRkPdlv9ff3LVQ6MTFMas8xSft3fNVbd+vqg1KaF5w7RwBsirUye24UVXDS3oIcj/nz+56mF6qQlUAQ++gGoNytcxFG7P98DWMXMoHIL/6l/Z7p1riv8ko2oiyiru129WsSrmUjO1XdtWc0Pr7miOoWOV9YUQ07WQPmsCisWYDge5puAUAI3NIk6EQACmaQ+BGRaAwOSemV1TH90+vnlDrZBNFOi/nEUlLL96lYx5VZLqB5zDQLFQzGm6KuUX89L6YqxRuaPsCwXYTlJE1EVJt9ycWTo8bereoW7Wv38ewfOzmgI/N42Kn53LatjTxUCv85zbEyg+Y5hTcDddq99M2ysc8/51lABfjZ++8KvSxvUlnpCj7U+mIG3vR8yhXSbXEbaB3cDmatdds4lrhi9Z8hskNo2hkI+RQHWN6fMIUwKGFZiNhDmCNq6BoR1gejCoTzNdD86woB6cPDh33YFr91w99dHJLePr1tp525NylKZkzJtthLplN+ADzhOxjpiN1trRPwb/vhKfqIcMg8Mr3DDqd38o4cM36y9KWa+Tsn7v4/ocj134Vcg2TZsf/ABFKH4tYwrtObZYYxoF3QiQC+PjATwUho5+W8MkQlOOqUDxnlMNjZpsfB8zjJCxZe2afKeTjXeuboqT2XcOlsACB6XROFhWch7AeNy/VsZfx4fO5Aj8EjTVRPjLdtrmTS1NX7Azce6kmjZnnHf+1iuBiG0duzsmQTiZPzfjEoTGAqZ7xqt/nmmai8gXOWb0/sG9z8vyyPNOZjKDf9DlRgmQR93keVlHOU/9RTkfH8W8ieTQzWpsc21DGRM0Xw4soAUWDEDPtMB0oS9I5qeXC0PhMySPyTWjuYFctn9JEgWLp6FSXdz71TeSgzuQBmnXVHPXGqWhIhXkF+H2lQXxVqiSO5OthN9CQQSazmBOhdycwSgoZRJvQ28Yz8SVltDiwd3PUxMLN9De1dWehinH5783RvA9xhpyoHgnWAfGvE3sqtqOFT25rGIoMB4GBa0NAaepg2KYyiwVijQqFKGtopEeUFFYgQCboj0jZ8cCk7U1Q2W3MBBLjMRi0SCKxO0od6gD6Muon6Q35JGLDZS9DEpfLNZTA4aqrmrD0rwHCAO8Cs/Ur4a3J0Lql9WU4RfBJiYySfg+cviqaczLvipt59LuhbjXflPdSuRLUUd/9VV422jRv6SF/NbehYrcQ1p2AZ6jd80L5+kSRwE3WV+OVGTs9GvnU6yLDbJsrZ2aE+iijskqPtuHgTAktgz0r+xtaUaslZRRH6FKlRJrBwO9bK+lef8YXipg7j8GSJjM+GRPmSApRv6n//T4VrH3qqbRaNxoqoxSNMfwD6MV18yPulftrX+xZ7gXeka7vMCPgf2aQ8+N4bPuaKz7lg2LIGjjTT3x4T4jvubPYKL+cFtPTxscwm0DA+yVNaMjbFNt/cE9k+sUpoxgas8Gu1qjhG7GqUu+oAFel8B2gTDcgt+54If2XXv1VVsmVvRkM4m4TnnrYCGLtt5foc4F2rWO/NrIbxENvBHUy0WJBYqEg8hbyklAxoATvupfHMCZ3wAHaASEAFz/Y7pUPh+ZumWK7z65G1KGftgMJro0NbIzrOvbm1sCuhL9tBGKtrof1aLaZkdRjS4zYhzSDTDVw4bldnrPGtubWgKGiH0adR1JuR9VI/qErSgB72HMk0emp2+anr6F7kfTydZ+zdKSO0EdDRuTqaip3xAIjapaLa1aWqg/kmqNQEiXzza3ZFbqId3euezR4Iiqbkj5j7ZEIeTX7X4n9vLvLmKL2mAXILVUp0WPoyLCVJVGQ+/yNlGhjP8PNLq4y9vNy9rPrn+eW36OaPmdX0nTF7EIpu9XPlvW1XMgOiHbSHIL1ji1nsbpBdbAyXtlTRwjSHuCqyJvkjfAVEiMe317oeLEURlNKa/CI7tfVLxLp5qb4tFwUFVYJ3R6/STHqy1Xi1R9RLvvd6lSPIba14rZoo6zwa3w/7L18OGzRwC+N7B52+HD2zYPfA8OP3iIH9kyjkd4Fdwj9x85skUPzfXhQd9cSN96mB+97yjgoYUXvZ7kxYu/UW7mL7Eo+rwKK9byTKWsSWWz6N8VBaZxB5ShgDJZHerscm0J6L1at2fNGPH4CqQNZ+gAGTeaPZVNBB52IJ7nt/uI3N/B0707Do+8vmEH37rpdTLX8eEDd47Xr564Y3aIj+67azM8Q4dwYHjpHbJoOu1/8OkH++lk4s59Y2Lo+tsevG1ukA/N3uHb9f9TbkFebNRET61I/GEuOEtdCkxKcdfISpPptmSn01kdVNF4Y4NjHF1rWnh0cxWZKImsJdKcKPPIkZR5RIoYkcJ7dh665dDOHqV/4jgc2ILXkYz77zgwypGsH1zKst/L+ir6nJVsPdtR2zaC4aQTZC9CR4p0jigDQ6gmexJcUeeXdbS0xY7WslzDdpPF8uryAPX0L+tqoVNFD5QrFi7rbKGXwYnkJGCpwra4XMZe1th6JZcOCL0VgV445HepqL+l5jVdKMHP1VeH89a/WtYaK2/9Z/g4noyFYduzjf6WpSS0FIKDRovrC4aaQ9ZArQ9b1r/K58P0Yhi/4Msl4WPhFbUuzCTBb1OitsjmCVsAn+Qs3eokTJ1FeEQlI1nGXNlfnbS8tcc/sYz4wU8vsbd+lr/UII5u7mncOYBJ+WKc+5jsETe/L03AXCfmN4IlTVnCOYiVSxyWr5h45up7d/Lpu568c7ey4zRcu6yjzk9P3Xvu3im5qb9yaf98ab2AwZIsy0Zrq6nXxkG22zi121ScGiC71IoiZwcZqlAmzUCmvaU5GgkkzaQfoNCjlKimWnxvGhtR5b4r0roYFX59BZLFsvVB5NMRIVAGQ65bJoBsRuaFbLJM/0n3nZCLlZaWYKj+efWy88WezKv+yiG5dKnN23mX2uUJbi5bY+Rc4XgxBrHXGnlYb637gwLPEuXVBmD1ViiIyzgRfl5f9NddvfoB9NDxw0clWD9KV0FbdhMMjzfc+H7uJXEG8fo6Ns4O1q5fU+KCCq16PhXG3JuJcczFw6GwEaLSBXkQwNwF4DgLs1AgHDqA2FToAXEgCDpj+jTudDaDgUmnGsaG9bWx1UOVctJGzBlDf2HJWgZyh1HHkeV53RK5WC6Gc8fr45AzKSByxwlWHShTsxydSgfVLhALUZsXOiS8w0TlVOdJ006bC4ZayA43j7cN9WCqeCgYDTvGJzKnKG0Jn7ou6KSC18Frs8FUk2Jch1frv65/kWLdMMbf2fWfDKac4HFdaYpb8HY9ZDXZhnEylEgHP7t2L6YMcO46M22b111HA113zoFBDJQUpy/WLx6B36K+MxQdmlHBKerm0BIJKqUu68GgoLY0VSpexdChJiDC1WpC9qwK1cQYpS7U0BW0JAzeMrX6P+hRI2Dy4z/hqqmb4gS3jG8GLT77P1Ue5E4wfOFTFoioAS8NYVYZhv9umJapaPV6hct6wHdkHiowcqVYnvUivt5Qa+3vK/X2dBXy2Uy6pclBE4pR4XkwxWHTtq93vH+tv0l2U6pFvbNRePWrv51uBFbBWmgHbw/upXv+0LnRc1AxL/RjLrVgmvx/yP0Fq1KJxarV2A+PHct2HDvWwbvxJIYX60/THfzHrcdGH7shQm/iC2l6E/fXRumtaPU/ybeyx+p34UkVL0LJv9PAUHOomzL1w8q9uZaYoV3SIOoujHBKKii60eKMxhJHXUMgTQW0InVqqErq22AbYN6BHOMkFCMtlpWLDDc/0NM23tYLZ1uGMX5ZrWfPtkQj+chQ61lZiH+gZSiai0Sbz4JhDbeswXd2PSVr8E/twqtr8KXdu690Q2KpI6jHMMuhBjdRdbG9iQslEae6YVhDV7gBdOiHgK4iKtSERkv4yOpAP8ZMpimmNqtSRuUFG50FDD2AeaYRNrasGS0P2LTwuGDncpRJNtZ5Fpev85SVhMY6T3ewBJrtjAFIs8XZi95eSXOXLJkW75wKaXmE7afkst1TsjBDJxP3v3I//kG6Z9R+ce7WnfcfrvHRo6fPnT46CpteTMJZ7yXKMb2XTlHieMpspgUYLz+k3UsJV/LFTWNH7vvT08eHlfWHHtx+69yLSbZMRhHWhDn2SG0oYCC3qE/B0qAKuZqPg+b5XkErlwWmYkKlMkNY2eLmUAqF3OJinmKjrPIhuK1/W/IJ6z8kh5K1D2aK+/UTWqOzkz1fC4xVOgKKKqgjZqKV9nhTGGOgUGnZjiK4Mq8jJFKOMwJ0UxSLdlO/Ymvrtq8H3/UG+nBNcG0e7Vh79xt/yOf37KklDMPYaeyc3LZ1y8hwT671KoP8BApooL9agOqYUm2FATeRptTcdeQGxexmC3pWyw2u5ZSr4l9xsLCKW+DaaeqxVskXZql+XdTggY9NDrcHk331MoTzqZSj3fGlCe3GxJQT6IsGjeBkQOGQO53v+VKSb9E1EVMQ5vKs2/R7axiimWAmiVCh4/MZ1eYrecvvMWx9oa71KppmNkVhBs6G6m+veHkw8amOFi0QFY4pTI7RrikRxSd1jgBaCeytDEHmYSsUN/HTEEyqQVQ6ppY4937ER/nPmMXaWK6W8TvQy1cj+s28wcIlS70LHqQsSoS5rB18abP70ubwv0VMqrRhJALnb2SJXZ76vg7pAPc9++oF2+s8XzLyZUMt/3ajhy35encPGy4n+lIy4Xvvou1JERMJFmTa8zqHldSwlaBa9k6VC63heDzM/3cYttfndDMiKlbIwCN7eV2F8FS61toUNZhCzHltUoKChwg/yah6WVnr8jIXJer+ultoizj14CWn/GfvvEU5uIjTdtnx8nw86K1TlzWF5QsXBhYXGlw+3rLk/5IB/G8+gzZuYUagPa8ByoUaWfiRIuA35I4CrJOMVariLtOCaKD+Ryq3gvWTwSDci1AAfVtQi7zzsmWE4F5Vq/+RPKDe8714vX5SVSVGuXjxa2K/iCyN42qyOkbLkXwt6FIjmt5sRsHC11VB2yANZQl1HL+GWjFC9Em4Vx7Q2oKTeB2+oKkeL3xEkBU015zWlri4VEBrpICIlwZ7Eso2mgSVKs8GLeJN5YsLnmn7Lh7/45KS6ncSg5I/Por8NcaWi7UW27Te2JeyTGPqPg3VS9j2CzJyeznjn1qaGXCrpsq8ro655n7+1zi3WwkBRkGuRl5e3eMyi6L0TvDJcnYwTnM14fWG5Xyh5nXVLya56BmNJRUi25oYoiGRJBGXdaO+Rb1Y9R861mlZYzodsf21K8/wZ1mC8I75Hr9viTsF+fsW5BzxTSO1IFQNz6DJvnC/lPv9L6Ab4KcvfJU6gC94y9NfMP31s7i5XY5RIn6LJqKRxjAKDuOVppiQA65ycUhaEvVeQya8dVuF6uCYKClVFADVGd5FyGt9RTWAAgg50ahiNFm2YkcCarHv3QTW/6Jna0TY0VA0FEpnMkbciKJ0RGSrrMN/XzzKfy7p3saOsq21cUl7FVQ2Dboqxg8D38S4hnxooL2bGRU1qurqAtP1Q1M7xzd3Sd4MKlx9aN7cxtWq/1OQAi25ohrK0s0ilVHwbgmKVNGWD1T/IMmcmd2u68h5MhPsLpW6Mf7ZEUPfceC+0zfhdXy9uTm5cQffujnZrMQFzmZdv+n0HyDOnl33Z4RjOcFoIL338N50IIpBxBEd9+2+7fV+vGGHQ5Y18NCTDw1EwkITYRu/JwZe9fPMI+IfxFUsyjbSqvKhAcwt168pdedsTBbTzZxTnRzRxQyV/if8uggP8y2VcpqWw7iyTmgJOy3GuEu5oK35P5xC0L6GZFag308hopD9/6r3KyoE7rKG5Tqi3D9z8s6TM/3+7mEeeCxiPDanxdWDjxmRxwKIeebmVFVePajGtTl5VaWLcGDdLdMVpbTvxD0n9pWUyvQtew1RfioQFOU/1vU/Lotg4KmyMEz9nnuM2OINTVu8ETPuuUeXPuNZUcFYEmd9rFRbYSxfVUjLiN9dFerqyvd2yKWFBEEB548Fup3m1PWnBQHUERnjyKYur0O1v1pBfvl30u2Hnj4EwydOw/CBOyd23vd4+YefpuUbvHb84elmO9HXD1P3Tq1f48YM5VZ17msH5/d1fPtmWQndeOwTd1EnZNeXbtwsoBRbcbJ29T3T0GbGDO+3J95aen6KxViWDVCHL8i5wsPAxPLfE1FDb55RmQnmCYgrEoijOyX+6KeDoE66Tt5ONjkSgheKBA9LqL6qpqchU0E7QaSYtJ3+irSVimrrmpLJU3ej0gsK6vTRXbdlEXtnb9u17Z9B+Un9m9Hg5rmoE93YF4zCPwZ31H9b/6f6b3cEgzvAgAIYO4IwfMe64Q03nOX3fXzD8Lo7brzrLtiCz85tCkajwb6N0b9LJD738MOfSxTs2x7mj3yGsEgjzzBYB9Xw2hGCYAZOzYWG2uR6nFlvxlJeEZfO732ziNsX84be4ffMGz7/gRmQb1dyTX8Q/dtArU8Hb8Wybmgod53NBlQOilxbg9mPCIstK3sTAzE7O5BMJuTKkvJgwfulBskXM0CBMymXLQrpkSoDMVmJ6aA2QjGG4SJkRk38g5sd61dtYGoQ4St+jHY+U23r4aVWOEjtseoMnDgvfwCEm2+hp6r/X91AK4zYkU3HMVEaxnR3qBfqPzn+/wHPnsOreJxjYGRgYABi1vIsoXh+m68M3MwvgCIMt5YoxkDp2P9f/2exVDAHAbkcDEwgUQAz1Qu/AHicY2BkYGAO+p/FwMBS9v/r/68sFQxAERQQDACh8QbyeJxdT0sVwzAMy49AkAxAkbT3UQiAITGAISmAYQiA9th4ttUs7Q568UeSlVidiwSkB3PUPg+ESd6ZD/+8v7HyrtzwghY89ZB6BcyrYqc6RZhw48YhaA1Wc/v1PQtdeXJ/HppUmFM597nvBVK7D+Z+E8/uQZLBgDyaz3Llvxx02S3c/Hv813JrznryZP4F+6lSfQAAAAAAAAAAUAC2ATABaAGyAfoCJAKwAzYDmgQSBFwExgUyBbQF/AZOBvwHRAe2B/YISgigCPIJGglCCWQJignACgAKQAp2CroLAAtGC4oL8gxcDPINng5iDuYPag/6EF4RIBGGEeQSShKYEyQTbhOyFAoUYhS+FVoVphYoFooXHBeGGFoYnhjGGOwZChlOGXgZrBneGhwaWhqgGtIbLhvyHHQc2B1QHZ4d/wABAAAAUwBtAAYAAAAAAAIAIAAwAHMAAAB2C3AAAAAAeJx1kN9q2zAUh39q0441YxcbjN3tXJWWEcc1lEGvWkLbXZeSu8JUV/6T2VKQlY48w95ifYa9zt6jd/vFESUUYiP5O5/O8ZEE4AP+QWH9nHKsWeEdozXv4A0uIu/Sf488IN9G3sMQPyLv0/+MfICv+BV5iI/4wz+owVtGM/yNrPBZfYm8g/fqW+Rd+svIA/Jd5D18UovI+/S/Ix9gqp4iD3GoniduvvR1WQU5mhxLlmap3C/FUdVWN6IXoXK+k3MpnA2maVySuza0ZlToUZ07292YctFov6k2eWp8VzsrJ0m6qa+NNV4H87Dq1j2WWQiFFN61chX7yNy7mclDUoUwPxuPN/tjAoc5lvCoUaJCgOCI9pjfDGk/BPfMEGaus2pYaDQ0GgtWVP1Kx/ico2BkaQ0zGnKCnHNL09KNuK451721rLqhLfmfht5vzdrmp7Sr3nUfC07YL92afU1r+wrd7/Dh5WwdHrmLjDawanUK3+9acPXqPML7Wq3NaHL6pL+1QHuGMd8t5/8PvPGO3QAAAHicbZLnlpswEIV9DRiwvZtseu89Ib333vvmBWRZYMVC0pHEEufpg8BO/kTncOfTaLgMOtPr97o17P1/baKPACEiDBAjQYohRhhjDevYhu3YwA7sxC7sxh7sxT7sxwEcxCEcxhEcxTEcxwmcxCmcxhmcxTmcxwVcxCVkuIwruIpruI4buIlbuI07uIt7uI8HeIhHeIwneIpneI4XeIlXeI03eIt3eI8P+IhP+Iwv+Ipv+I5N/OiF1hEz9JKxUrtFrDl1lWF9NR9QIikToRaVjUouKxvOmNBjLxnlhgo2DbnM1djLKrNGnGPScSUzItzGv93yPP2bSQSX84z9cqFQdJ56yZRmMhW8mLlJJSaBI0XYPDaZKDUviZmvr6DrNjJMi0WcK1MTM02mqpbZlJtEsNx5SI238jSodJtoS7qv+BpPw67IY9xU+dg5TXjROTWwdGrIOzWhT+uA0jolxqjaZrSOnCF2Nmq16651EYpMm1fakAul9SJQeR5QVYQlk1VkZ8SwoVNFIVjWnKQrlBGdMToftdoZjrs77DajqXKrS02YEFxbbtdWkG0x44JJVUS5aBqKSlJwmhDrmOF2Hv9Wqsy4TNqoKhfmSrrQKuNSL5nvPG6p0s0AkEWkSWVZMy1Kx3ljk03qLuZ14lTmB8gNGmByGrGfjLrhlhJV2f7SaIneNF1ypQNbybBUSgZswQaWEUNngeay1/sD4l/60HicY/DewXAiKGIjI2Nf5AbGnRwMHAzJBRsZWJ02MTAyaIEYm7mYGDkgLD4GMIvNaRfTAaA0J5DN7rSLwQHCZmZw2ajC2BEYscGhI2Ijc4rLRjUQbxdHAwMji0NHckgESEkkEGzmYWLk0drB+L91A0vvRiYGFwAMdiP0AAA=') format('woff');\n}\n</style>\n<style id=\"style-core\" type=\"text/css\">/***********************************************************************************************************************\n\n\tcss/_mixins.css\n\n\tCopyright © 2020–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\n/***********************************************************************************************************************\n\n\tcss/core.css\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\n/*\n\tDefault structural styles.\n*/\nhtml {\n\t/*\n\t\tWe define the base font size and line height here as they affect the layout\n\t\tof the base page elements (i.e. `#ui-bar`, `#ui-dialog`, and `#story`).\n\t*/\n\tfont: 16px/1 Helmet, Freesans, sans-serif;\n}\n\n/* Story data styling. */\n#store-area, tw-storydata {\n\tdisplay: none !important;\n\tz-index: 0;\n}\n\n/* Special no transition styling. */\n.no-transition {\n\ttransition: none !important;\n}\n\n\n/*\n\tFullscreen appearance styles.\n*/\n*:fullscreen { /* Cause Blink/WebKit to behave like Gecko. */\n\theight: 100%;\n\twidth: 100%;\n}\nbody::-ms-backdrop { /* Prevent IE 11 from hiding the `body` element's background. */\n\tbackground: none;\n}\n\n\n/*\n\tDefault appearance styles.\n*/\n*:focus {\n\toutline: thin dotted;\n}\n*:disabled {\n\tcursor: not-allowed !important;\n}\nbody {\n\tcolor: #eee;\n\tbackground-color: #111;\n\toverflow: auto;\n}\na {\n\tcursor: pointer;\n\tcolor: #68d;\n\ttext-decoration: none;\n\ttransition-duration: 200ms;\n}\na:hover {\n\tcolor: #8af;\n\ttext-decoration: underline;\n}\na.link-broken {\n\tcolor: #c22;\n}\na.link-broken:hover {\n\tcolor: #e44;\n}\na[disabled], span.link-disabled {\n\tcolor: #aaa;\n\tcursor: not-allowed !important;\n\t/*\n\t\tNOTE: Do not use `pointer-events` here as it disables\n\t\tthe display of a cursor in some browsers.\n\n\t\tpointer-events: none;\n\t*/\n\ttext-decoration: none;\n}\narea {\n\tcursor: pointer;\n}\nbutton {\n\tcursor: pointer;\n\tcolor: #eee;\n\tbackground-color: #35a;\n\tborder: 1px solid #57c;\n\tline-height: normal;\n\tpadding: 0.4em;\n\ttransition-duration: 200ms;\n\tuser-select: none;\n}\nbutton:hover {\n\tbackground-color: #57c;\n\tborder-color: #79e;\n}\nbutton:disabled {\n\tbackground-color: #444;\n\tborder: 1px solid #666;\n}\ninput, select, textarea {\n\tcolor: #eee;\n\tbackground-color: transparent;\n\tborder: 1px solid #444;\n\tpadding: 0.4em;\n}\nselect {\n\tpadding: 0.34em 0.4em;\n}\ninput[type=\"text\"] {\n\tmin-width: 18em;\n}\ntextarea {\n\tmin-width: 30em;\n\tresize: vertical;\n}\ninput[type=\"checkbox\"], input[type=\"file\"], input[type=\"radio\"], select {\n\tcursor: pointer;\n}\n/* BEGIN: input[type=\"range\"] */\ninput[type=\"range\"] {\n\t-webkit-appearance: none;\n\tmin-height: 1.2em;\n}\ninput[type=\"range\"]:focus {\n\toutline: none;\n}\ninput[type=\"range\"]::-webkit-slider-runnable-track {\n\tbackground: #222;\n\tborder: 1px solid #444;\n\tborder-radius: 0;\n\tcursor: pointer;\n\theight: 10px;\n\twidth: 100%;\n}\ninput[type=\"range\"]::-webkit-slider-thumb {\n\t-webkit-appearance: none;\n\tbackground: #35a;\n\tborder: 1px solid #57c;\n\tborder-radius: 0;\n\tcursor: pointer;\n\theight: 18px;\n\t/*\n\t\tNOTE: Ideally, `margin-top` should be `0` for Edge/Spartan (ca. v17), but\n\t\treal WebKit/Blink-based browsers need it.  Since there's more of them and\n\t\tEdge is co-opting the prefix anyway, we cater to them.  Edge will simply\n\t\thave to look ever so slightly off.\n\t*/\n\tmargin-top: -5px;\n\twidth: 33px;\n}\ninput[type=\"range\"]:focus::-webkit-slider-runnable-track {\n\tbackground: #222;\n}\ninput[type=\"range\"]::-moz-range-track {\n\tbackground: #222;\n\tborder: 1px solid #444;\n\tborder-radius: 0;\n\tcursor: pointer;\n\theight: 10px;\n\twidth: 100%;\n}\ninput[type=\"range\"]::-moz-range-thumb {\n\tbackground: #35a;\n\tborder: 1px solid #57c;\n\tborder-radius: 0;\n\tcursor: pointer;\n\theight: 18px;\n\twidth: 33px;\n}\ninput[type=\"range\"]::-ms-track {\n\tbackground: transparent;\n\tborder-color: transparent;\n\tcolor: transparent;\n\tcursor: pointer;\n\theight: 10px;\n\twidth: calc(100% - 1px);\n}\ninput[type=\"range\"]::-ms-fill-lower {\n\tbackground: #222;\n\tborder: 1px solid #444;\n\tborder-radius: 0;\n}\ninput[type=\"range\"]::-ms-fill-upper {\n\tbackground: #222;\n\tborder: 1px solid #444;\n\tborder-radius: 0;\n}\ninput[type=\"range\"]::-ms-thumb {\n\tbackground: #35a;\n\tborder: 1px solid #57c;\n\tborder-radius: 0;\n\tcursor: pointer;\n\theight: 16px;\n\twidth: 33px;\n}\n/* END: input[type=\"range\"] */\ninput:not(:disabled):focus, select:not(:disabled):focus, textarea:not(:disabled):focus,\ninput:not(:disabled):hover, select:not(:disabled):hover, textarea:not(:disabled):hover {\n\tbackground-color: #333;\n\tborder-color: #eee;\n}\nhr {\n\tdisplay: block;\n\theight: 1px;\n\tborder: none;\n\tborder-top: 1px solid #eee;\n\tmargin: 1em 0;\n\tpadding: 0;\n}\naudio, canvas, progress, video {\n\tmax-width: 100%;\n\tvertical-align: middle;\n}\n\n.error-view {\n\tbackground-color: #511;\n\tborder-left: 0.5em solid #c22;\n\tdisplay: inline-block;\n\tmargin: 0.1em;\n\tmax-width: 100%;\n\tpadding: 0 0.25em;\n\tposition: relative;\n}\n.error-view > .error-toggle {\n\tbackground-color: transparent;\n\tborder: none;\n\tline-height: inherit;\n\tleft: 0;\n\tpadding: 0;\n\tposition: absolute;\n\ttop: 0;\n\twidth: 1.75em;\n}\n.error-view > .error {\n\tdisplay: inline-block;\n\tmargin-left: 0.25em;\n}\n.error-view > .error-toggle + .error {\n\tmargin-left: 1.5em;\n}\n.error-view > .error-source[hidden] {\n\tdisplay: none;\n}\n.error-view > .error-source:not([hidden]) {\n\tbackground-color: rgba(0, 0, 0, 0.2);\n\tdisplay: block;\n\tmargin: 0 0 0.25em;\n\toverflow-x: auto;\n\tpadding: 0.25em;\n}\n\n.highlight, .marked {\n\tcolor: yellow;\n\tfont-weight: bold;\n\tfont-style: italic;\n}\n.nobr {\n\twhite-space: nowrap;\n}\n\n[data-icon]:before,\n[data-icon-before]:before,\n[data-icon-after]:after,\n.error-view > .error-toggle:before,\n.error-view > .error:before,\na.link-external:after {\n\tfont-family: tme-fa-icons !important;\n\t/* stylelint-disable-line font-family-no-missing-generic-family-keyword */\n\tfont-style: normal;\n\tfont-weight: 900;\n\tfont-variant: normal;\n\tline-height: 1;\n\tspeak: never;\n\ttext-rendering: auto;\n\ttext-transform: none;\n\t-webkit-font-smoothing: antialiased;\n\t-moz-osx-font-smoothing: grayscale;\n}\n[data-icon]:before {\n\tcontent: attr(data-icon);\n}\n[data-icon-before]:before {\n\tcontent: attr(data-icon-before) \"\\00a0\\00a0\";\n}\n[data-icon-after]:after {\n\tcontent: \"\\00a0\\00a0\" attr(data-icon-after);\n}\n.error-view > .error-toggle:before {\n\tcontent: \"\\e81a\";\n}\n.error-view > .error-toggle.enabled:before {\n\tcontent: \"\\e818\";\n}\n.error-view > .error:before {\n\tcontent: \"\\e80d\\00a0\\00a0\";\n}\na.link-external:after {\n\tcontent: \"\\00a0\\e80e\";\n}\n</style>\n<style id=\"style-core-display\" type=\"text/css\">/***********************************************************************************************************************\n\n\tcss/_mixins.css\n\n\tCopyright © 2020–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\n/***********************************************************************************************************************\n\n\tcss/core-display.css\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\n/*\n\tDefault structural styles.\n*/\n#story {\n\tz-index: 10;\n\tmargin: 2.5em;\n}\n@media screen and (max-width: 1136px) {\n\t#story {\n\t\tmargin-right: 1.5em;\n\t}\n}\n#passages {\n\tmax-width: 54em;\n\tmargin: 0 auto;\n}\n</style>\n<style id=\"style-core-passage\" type=\"text/css\">/***********************************************************************************************************************\n\n\tcss/_mixins.css\n\n\tCopyright © 2020–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\n/***********************************************************************************************************************\n\n\tcss/core-passage.css\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\n/*\n\tDefault appearance styles.\n*/\n.passage {\n\tline-height: 1.75;\n\ttext-align: left;\n\ttransition: opacity 400ms ease-in;\n}\n.passage-in {\n\topacity: 0;\n}\n.passage ul, .passage ol {\n\tmargin-left: 0.5em;\n\tpadding-left: 1.5em;\n}\n.passage table {\n\tmargin: 1em 0;\n\tborder-collapse: collapse;\n\tfont-size: 100%;\n}\n.passage tr, .passage th, .passage td, .passage caption {\n\tpadding: 3px;\n}\n\n\n/*\n\tAccessibility styles.\n*/\n@media (prefers-reduced-motion: reduce) {\n\t.passage {\n\t\ttransition: opacity 0s;\n\t}\n}\n</style>\n<style id=\"style-core-macro\" type=\"text/css\">/***********************************************************************************************************************\n\n\tcss/_mixins.css\n\n\tCopyright © 2020–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\n/***********************************************************************************************************************\n\n\tcss/core-macro.css\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\n/*\n\tDefault appearance styles.\n*/\n@keyframes cursor-blink {\n\t0% { opacity: 1; }\n\t50% { opacity: 0; }\n\t100% { opacity: 1; }\n}\n\n.macro-linkappend-insert,\n.macro-linkprepend-insert,\n.macro-linkreplace-insert,\n.macro-append-insert,\n.macro-prepend-insert,\n.macro-replace-insert,\n.macro-repeat-insert,\n.macro-timed-insert {\n\ttransition: opacity 400ms ease-in;\n}\n.macro-linkappend-in,\n.macro-linkprepend-in,\n.macro-linkreplace-in,\n.macro-append-in,\n.macro-prepend-in,\n.macro-replace-in,\n.macro-repeat-in,\n.macro-timed-in {\n\topacity: 0;\n}\n\n.macro-type-cursor:after {\n\tanimation: cursor-blink 1s infinite;\n\tcontent: \"\\2590\"; /* \"\\2588\" */\n\topacity: 1;\n}\n</style>\n<style id=\"style-ui-dialog\" type=\"text/css\">/***********************************************************************************************************************\n\n\tcss/_mixins.css\n\n\tCopyright © 2020–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\n/***********************************************************************************************************************\n\n\tcss/ui-dialog.css\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\n/*\n\tPatches to the core styles.\n*/\nhtml[data-dialog] body {\n\toverflow: hidden;\n}\n\n\n/*\n\tDefault structural styles.\n*/\n#ui-overlay.open {\n\tvisibility: visible;\n\ttransition: opacity 200ms ease-in;\n}\n#ui-overlay:not(.open) {\n\ttransition: visibility 200ms step-end, opacity 200ms ease-in;\n}\n#ui-overlay {\n\tvisibility: hidden;\n\topacity: 0;\n\tz-index: 100000;\n\tposition: fixed;\n\t/*\n\ttop: -50vh;\n\tleft: -50vw;\n\theight: 200vh;\n\twidth: 200vw;\n\t*/\n\ttop: -50%;\n\tleft: -50%;\n\theight: 200%;\n\twidth: 200%;\n}\n#ui-dialog.open {\n\tdisplay: block;\n\ttransition: opacity 200ms ease-in;\n}\n/*\n\tWe do not animate `#ui-dialog:not(.open)` for various reasons.  Chief among\n\tthem, however, is so that the dialog isn't in the middle of its animation\n\twhen other page updates happen.\n\n\te.g. The restoration of `overflow` on `body` would cause the still animating\n\t     dialog to jump around a little if a scrollbar were to pop in.\n\n\t     Any dialog action which performs a task which has its own animations\n\t     (e.g. passage display) or causes the page to reload in addition to\n\t     closing the dialog could cause display shenanigans.\n*/\n#ui-dialog {\n\tdisplay: none;\n\topacity: 0;\n\tz-index: 100100;\n\tposition: fixed;\n\ttop: 50px;\n\tmargin: 0;\n\tpadding: 0;\n}\n#ui-dialog > * {\n\tbox-sizing: border-box;\n}\n#ui-dialog-titlebar {\n\tposition: relative;\n}\n#ui-dialog-close {\n\tdisplay: block;\n\tposition: absolute;\n\tright: 0;\n\ttop: 0;\n\twhite-space: nowrap;\n}\n#ui-dialog-body {\n\toverflow: auto;\n\tmin-width: 280px;\n\theight: 92%; /* fallback for browsers without support for calc() */\n\theight: calc(100% - 2.1em); /* parent - title(2.1em) */\n}\n\n\n/*\n\tAccessibility styles.\n*/\n@media (prefers-reduced-motion: reduce) {\n\t#ui-overlay.open {\n\t\ttransition: opacity 0s;\n\t}\n\t#ui-overlay:not(.open) {\n\t\ttransition: opacity 0s;\n\t}\n\t#ui-dialog.open {\n\t\ttransition: opacity 0s;\n\t}\n}\n\n\n/*\n\tDefault appearance styles.\n*/\n#ui-overlay {\n\tbackground-color: #000;\n}\n#ui-overlay.open {\n\topacity: 0.8;\n}\n#ui-dialog {\n\tmax-width: 66em;\n}\n#ui-dialog.open {\n\topacity: 1;\n}\n#ui-dialog-titlebar {\n\tbackground-color: #444;\n\tmin-height: 24px;\n}\n#ui-dialog-title {\n\tmargin: 0;\n\tpadding: 0.2em 3.5em 0.2em 0.5em;\n\tfont-size: 1.5em;\n\ttext-align: center;\n\ttext-transform: uppercase;\n}\n#ui-dialog-close {\n\tcursor: pointer;\n\tfont-size: 120%;\n\tmargin: 0;\n\tpadding: 0;\n\twidth: 3.6em;\n\theight: 92%;\n\tbackground-color: transparent;\n\tborder: 1px solid transparent;\n\ttransition-duration: 200ms;\n}\n#ui-dialog-close:hover {\n\tbackground-color: #b44;\n\tborder-color: #d66;\n}\n#ui-dialog-body {\n\tbackground-color: #111;\n\tborder: 1px solid #444;\n\ttext-align: left;\n\tline-height: 1.5;\n\tpadding: 1em;\n}\n#ui-dialog-body > *:first-child {\n\tmargin-top: 0;\n}\n#ui-dialog-body hr {\n\tbackground-color: #444;\n}\n\n/* Default dialog button bar styling. */\n#ui-dialog-body ul.buttons {\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n}\n#ui-dialog-body ul.buttons li {\n\tdisplay: inline-block;\n\tmargin: 0;\n\tpadding: 0.4em 0.4em 0 0;\n}\n#ui-dialog-body ul.buttons > li + li > button {\n\tmargin-left: 1em;\n}\n\n/* Stop text selection on certain UI elements. */\n#ui-dialog-close {\n\tuser-select: none;\n}\n\n\n/*\n\tDefault font icon styles.\n*/\n#ui-dialog-close {\n\tfont-family: tme-fa-icons !important;\n\t/* stylelint-disable-line font-family-no-missing-generic-family-keyword */\n\tfont-style: normal;\n\tfont-weight: 900;\n\tfont-variant: normal;\n\tline-height: 1;\n\tspeak: never;\n\ttext-rendering: auto;\n\ttext-transform: none;\n\t-webkit-font-smoothing: antialiased;\n\t-moz-osx-font-smoothing: grayscale;\n}\n</style>\n<style id=\"style-ui\" type=\"text/css\">/***********************************************************************************************************************\n\n\tcss/_mixins.css\n\n\tCopyright © 2020–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\n/***********************************************************************************************************************\n\n\tcss/ui.css\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\n/*\n\tDefault structural styles.\n*/\n/* Settings dialog styling. */\n#ui-dialog-body.settings [id|=\"setting-body\"] > div:first-child {\n\tdisplay: table;\n\twidth: 100%;\n}\n#ui-dialog-body.settings [id|=\"setting-label\"] {\n\tdisplay: table-cell;\n\tpadding: 0.4em 2em 0.4em 0;\n}\n#ui-dialog-body.settings [id|=\"setting-label\"] + div {\n\tdisplay: table-cell;\n\tmin-width: 8em;\n\ttext-align: right;\n\tvertical-align: middle;\n\twhite-space: nowrap;\n}\n\n\n/*\n\tBuilt-in dialog appearance styles.\n*/\n/* List-based dialog styling (primarily for the Jumpto & Share dialogs). */\n#ui-dialog-body.list {\n\tpadding: 0;\n}\n#ui-dialog-body.list ul {\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n\tborder: 1px solid transparent;\n}\n#ui-dialog-body.list li {\n\tmargin: 0;\n}\n#ui-dialog-body.list li:not(:first-child) {\n\tborder-top: 1px solid #444;\n}\n#ui-dialog-body.list li a {\n\tdisplay: block;\n\tpadding: 0.25em 0.75em;\n\tborder: 1px solid transparent;\n\tcolor: #eee;\n\ttext-decoration: none;\n}\n#ui-dialog-body.list li a:hover {\n\tbackground-color: #333;\n\tborder-color: #eee;\n}\n\n/* Saves dialog styling. */\n#ui-dialog-body.saves {\n\tpadding: 0 0 1px; /* Webkit/Blink need 1px bottom padding or they'll trigger the scroll bar */\n}\n#ui-dialog-body.saves > *:not(:first-child) {\n\tborder-top: 1px solid #444;\n}\n#ui-dialog-body.saves table {\n\tborder-spacing: 0;\n\twidth: 100%;\n}\n#ui-dialog-body.saves tr:not(:first-child) {\n\tborder-top: 1px solid #444;\n}\n#ui-dialog-body.saves td {\n\tpadding: 0.33em 0.33em;\n}\n#ui-dialog-body.saves td:first-child {\n\tmin-width: 1.5em;\n\ttext-align: center;\n}\n#ui-dialog-body.saves td:nth-child(3) {\n\tline-height: 1.2;\n}\n#ui-dialog-body.saves td:last-child {\n\ttext-align: right;\n}\n#ui-dialog-body.saves .empty {\n\tcolor: #999;\n\tspeak: none;\n\ttext-align: center;\n\tuser-select: none;\n}\n#ui-dialog-body.saves .datestamp {\n\tfont-size: 75%;\n\tmargin-left: 1em;\n}\n#ui-dialog-body.saves ul.buttons li {\n\tpadding: 0.4em;\n}\n#ui-dialog-body.saves ul.buttons > li + li > button {\n\tmargin-left: 0.2em;\n}\n#ui-dialog-body.saves ul.buttons li:last-child {\n\t/*\n\t\tUsing `position:absolute;right:0;` here can produce poor results,\n\t\tso we use `float:right` instead.\n\t*/\n\tfloat: right;\n}\n\n/* Settings dialog styling. */\n#ui-dialog-body.settings div[id|=\"header-body\"] {\n\tmargin: 1em 0;\n}\n#ui-dialog-body.settings div[id|=\"header-body\"]:first-child {\n\tmargin-top: 0;\n}\n#ui-dialog-body.settings div[id|=\"header-body\"]:not(:first-child) {\n\tborder-top: 1px solid #444;\n\tpadding-top: 1em;\n}\n#ui-dialog-body.settings div[id|=\"header-body\"] > * {\n\tmargin: 0;\n}\n#ui-dialog-body.settings h2[id|=\"header-heading\"] {\n\tfont-size: 1.375em;\n}\n#ui-dialog-body.settings p[id|=\"header-desc\"],\n#ui-dialog-body.settings p[id|=\"setting-desc\"] {\n\tfont-size: 87.5%;\n\tmargin: 0 0 0 0.5em;\n}\n#ui-dialog-body.settings div[id|=\"setting-body\"] + div[id|=\"setting-body\"] {\n\tmargin: 1em 0;\n}\n#ui-dialog-body.settings [id|=\"setting-control\"] {\n\twhite-space: nowrap;\n}\n#ui-dialog-body.settings button[id|=\"setting-control\"] {\n\tcolor: #eee;\n\tbackground-color: transparent;\n\tborder: 1px solid #444;\n\tpadding: 0.4em;\n}\n#ui-dialog-body.settings button[id|=\"setting-control\"]:hover {\n\tbackground-color: #333;\n\tborder-color: #eee;\n}\n#ui-dialog-body.settings button[id|=\"setting-control\"].enabled {\n\tbackground-color: #282;\n\tborder-color: #4a4;\n}\n#ui-dialog-body.settings button[id|=\"setting-control\"].enabled:hover {\n\tbackground-color: #4a4;\n\tborder-color: #6c6;\n}\n#ui-dialog-body.settings input[type=\"range\"][id|=\"setting-control\"] {\n\tmax-width: 35vw;\n}\n\n/* Stop text selection on certain UI elements. */\n#ui-dialog-body.list a,\n#ui-dialog-body.settings span[id|=\"setting-input\"] {\n\tuser-select: none;\n}\n\n\n/*\n\tDefault font icon styles.\n*/\n#ui-dialog-body.saves button[id=\"saves-export\"]:before,\n#ui-dialog-body.saves button[id=\"saves-toClipboard\"]:before,\n#ui-dialog-body.saves button[id=\"saves-import\"]:before,\n#ui-dialog-body.saves button[id=\"saves-clear\"]:before,\n#ui-dialog-body.settings button[id|=\"setting-control\"]:after,\n#ui-dialog-body.settings button[id|=\"setting-control\"].enabled:after {\n\tfont-family: tme-fa-icons !important;\n\t/* stylelint-disable-line font-family-no-missing-generic-family-keyword */\n\tfont-style: normal;\n\tfont-weight: 900;\n\tfont-variant: normal;\n\tline-height: 1;\n\tspeak: never;\n\ttext-rendering: auto;\n\ttext-transform: none;\n\t-webkit-font-smoothing: antialiased;\n\t-moz-osx-font-smoothing: grayscale;\n}\n#ui-dialog-body.saves button[id=\"saves-export\"]:before {\n\tcontent: \"\\e829\\00a0\";\n}\n#ui-dialog-body.saves button[id=\"saves-toClipboard\"]:before {\n\tcontent: \"\\e82b\\00a0\";\n}\n#ui-dialog-body.saves button[id=\"saves-import\"]:before {\n\tcontent: \"\\e82a\\00a0\";\n}\n#ui-dialog-body.saves button[id=\"saves-clear\"]:before {\n\tcontent: \"\\e827\\00a0\";\n}\n#ui-dialog-body.settings button[id|=\"setting-control\"]:after {\n\tcontent: \"\\00a0\\00a0\\e830\";\n}\n#ui-dialog-body.settings button[id|=\"setting-control\"].enabled:after {\n\tcontent: \"\\00a0\\00a0\\e831\";\n}\n</style>\n<style id=\"style-ui-bar\" type=\"text/css\">/***********************************************************************************************************************\n\n\tcss/_mixins.css\n\n\tCopyright © 2020–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\n/***********************************************************************************************************************\n\n\tcss/ui-bar.css\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\n/*\n\tPatches to the core styles.\n*/\n#story {\n\tmargin-left: 20em;\n\ttransition: margin-left 200ms ease-in;\n}\n#ui-bar.stowed ~ #story {\n\tmargin-left: 4.5em;\n}\n@media screen and (max-width: 1136px) {\n\t#story {\n\t\tmargin-left: 19em;\n\t}\n\t#ui-bar.stowed ~ #story {\n\t\tmargin-left: 3.5em;\n\t}\n}\n/*\n\tAt very narrow viewport widths, set `#story{margin-left}` equal to the value\n\tof `#ui-bar.stowed~#story{margin-left}`, so that `#ui-bar` will side over top\n\tof `#story` when unstowed, rather than shoving it over.\n*/\n@media screen and (max-width: 768px) {\n\t#story {\n\t\tmargin-left: 3.5em;\n\t}\n}\n\n\n/*\n\tDefault structural styles.\n*/\n#ui-bar {\n\tposition: fixed;\n\tz-index: 50;\n\ttop: 0;\n\tleft: 0;\n\twidth: 17.5em;\n\theight: 100%;\n\tmargin: 0;\n\tpadding: 0;\n\ttransition: left 200ms ease-in;\n}\n#ui-bar.stowed {\n\tleft: -15.5em;\n}\n#ui-bar-tray {\n\tposition: absolute;\n\ttop: 0.2em;\n\tleft: 0;\n\tright: 0;\n}\n#ui-bar-body {\n\theight: 90%; /* fallback for browsers without support for calc() */\n\theight: calc(100% - 2.5em);\n\tmargin: 2.5em 0;\n\tpadding: 0 1.5em;\n}\n#ui-bar.stowed #ui-bar-history,\n#ui-bar.stowed #ui-bar-body {\n\tvisibility: hidden;\n\ttransition: visibility 200ms step-end;\n}\n\n\n/*\n\tAccessibility styles.\n*/\n@media (prefers-reduced-motion: reduce) {\n\t#story {\n\t\ttransition: margin-left 0s;\n\t}\n\t#ui-bar {\n\t\ttransition: left 0s;\n\t}\n}\n\n\n/*\n\tDefault appearance styles.\n*/\n#ui-bar {\n\tbackground-color: #222;\n\tborder-right: 1px solid #444;\n\ttext-align: center;\n}\n#ui-bar a {\n\ttext-decoration: none;\n}\n#ui-bar hr {\n\tborder-color: #444;\n}\n#ui-bar-toggle,\n#ui-bar-history [id|=\"history\"] {\n\tfont-size: 1.2em;\n\tline-height: inherit;\n\tcolor: #eee;\n\tbackground-color: transparent;\n\tborder: 1px solid #444;\n}\n#ui-bar-toggle {\n\tdisplay: block;\n\tposition: absolute;\n\ttop: 0;\n\tright: 0;\n\tborder-right: none;\n\tpadding: 0.3em 0.45em 0.25em;\n}\n#ui-bar.stowed #ui-bar-toggle {\n\tpadding: 0.3em 0.35em 0.25em 0.55em;\n}\n#ui-bar-toggle:hover {\n\tbackground-color: #444;\n\tborder-color: #eee;\n}\n#ui-bar-history {\n\tmargin: 0 auto;\n}\n#ui-bar-history [id|=\"history\"] {\n\tpadding: 0.2em 0.45em 0.35em;\n}\n#ui-bar-history #history-jumpto {\n\tpadding: 0.2em 0.665em 0.35em;\n}\n#ui-bar-history [id|=\"history\"]:not(:first-child) {\n\tmargin-left: 1.2em;\n}\n#ui-bar-history [id|=\"history\"]:hover {\n\tbackground-color: #444;\n\tborder-color: #eee;\n}\n#ui-bar-history [id|=\"history\"]:disabled {\n\tcolor: #444;\n\tbackground-color: transparent;\n\tborder-color: #444;\n}\n#ui-bar-body {\n\tline-height: 1.5;\n\toverflow: auto;\n}\n#ui-bar-body > :not(:first-child) {\n\tmargin-top: 2em;\n}\n#story-title {\n\tmargin: 0;\n\tfont-size: 162.5%;\n}\n#story-author {\n\tmargin-top: 2em;\n\tfont-weight: bold;\n}\n#menu ul {\n\tmargin: 1em 0 0;\n\tpadding: 0;\n\tlist-style: none;\n\tborder: 1px solid #444;\n}\n#menu ul:empty {\n\tdisplay: none;\n}\n#menu li {\n\tmargin: 0;\n}\n#menu li:not(:first-child) {\n\tborder-top: 1px solid #444;\n}\n#menu li a {\n\tdisplay: block;\n\tpadding: 0.25em 0.75em;\n\tborder: 1px solid transparent;\n\tcolor: #eee;\n\ttext-transform: uppercase;\n}\n#menu li a:hover {\n\tbackground-color: #444;\n\tborder-color: #eee;\n}\n\n/* Stop text selection on certain UI elements. */\n#ui-bar-history [id|=\"history\"],\n#ui-bar-toggle,\n#menu a {\n\tuser-select: none;\n}\n\n\n/*\n\tDefault font icon styles.\n*/\n#ui-bar-toggle:before,\n#ui-bar-history [id|=\"history\"],\n#menu-core li[id|=\"menu-item\"] a:before {\n\tfont-family: tme-fa-icons !important;\n\t/* stylelint-disable-line font-family-no-missing-generic-family-keyword */\n\tfont-style: normal;\n\tfont-weight: 900;\n\tfont-variant: normal;\n\tline-height: 1;\n\tspeak: never;\n\ttext-rendering: auto;\n\ttext-transform: none;\n\t-webkit-font-smoothing: antialiased;\n\t-moz-osx-font-smoothing: grayscale;\n}\n#ui-bar-toggle:before {\n\tcontent: \"\\e81d\";\n}\n#ui-bar.stowed #ui-bar-toggle:before {\n\tcontent: \"\\e81e\";\n}\n#menu-item-saves a:before {\n\tcontent: \"\\e82b\\00a0\";\n}\n#menu-item-settings a:before {\n\tcontent: \"\\e82d\\00a0\";\n}\n#menu-item-restart a:before {\n\tcontent: \"\\e82c\\00a0\";\n}\n#menu-item-share a:before {\n\tcontent: \"\\e82f\\00a0\";\n}\n</style>\n<style id=\"style-idb-backend\" type=\"text/css\">/***********************************************************************************************************************\n\n\tcss/_mixins.css\n\n\tCopyright © 2020–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\n#saves-export-reminder {\n\tpadding: 0.5em 1em 0;\n}\n\n#saves-list-container {\n\tdisplay: flex;\n\tflex-direction: column;\n}\n\n#saves-list-container .savesListRow {\n\tdisplay: flex;\n\tflex-flow: row nowrap;\n\talign-items: center;\n\tborder-top: 1px solid #444;\n\tpadding: 4px;\n}\n\n@media (min-width: 40rem) {\n\t#saves-list-container .savesListRow {\n\t\tmax-height: 2.4em;\n\t}\n}\n\n#saves-list-container .savesListRow .saveGroup {\n\tdisplay: flex;\n\tflex-flow: row wrap;\n\talign-items: center;\n\tflex-grow: 1;\n\tflex-shrink: 1;\n\t/* Set min-width to allow parent correctly to resize this element's children */\n\tmin-width: 0;\n}\n\n#saves-list-container .savesListRow .saveGroup > div {\n\tdisplay: flex;\n\tjustify-content: center;\n\tmargin: 0 10px;\n\tflex-grow: 0;\n\tflex-shrink: 0;\n}\n\n#saves-list-container .savesListRow .saveGroup .saveId {\n\tmin-width: 2em;\n\tmargin-left: 4px;\n\tmargin-right: -6px;\n}\n\n\n#saves-list-container .savesListRow .saveGroup .saveButton {\n\tdisplay: flex;\n\tjustify-content: center;\n\tmin-width: 110px;\n\tmargin: 0 10px;\n}\n\n#saves-list-container .savesListRow .saveGroup .saveName {\n\twidth: 5em;\n}\n\n#saves-list-container .savesListRow .saveGroup .saveButton input {\n\tmargin: 3px 0;\n}\n\n#saves-list-container .savesListRow .saveGroup > .saveDetails {\n\tdisplay: flex;\n\tflex: 1 1 0;\n\tflex-direction: column;\n\talign-items: stretch;\n\tjustify-content: stretch;\n\tmin-width: 100px;\n}\n\n#saves-list-container .savesListRow .saveGroup > .saveDetails span {\n\tmax-height: 80px;\n\twhite-space: nowrap;\n\toverflow-x: clip;\n}\n\n.jumpToSaveTransition {\n\tbackground-color: #444;\n\ttransition-duration: 1s;\n}\n\n/*\n * footer for the save list\n */\n#savesListFooter {\n\tjustify-content: space-between;\n\tpadding: 0 !important;\n\tline-height: normal;\n}\n\n#savesListFooter div {\n\tdisplay: flex;\n\tjustify-content: stretch;\n}\n\n.datestamp {\n\tfont-size: 0.8em;\n}\n\n.listMargin {\n\tdisplay: inline-block;\n\tmargin: 1px 0;\n}\n\n.right {\n\tfloat: right;\n}\n\n.saveMenuButton {\n\tbackground-color: #35a !important;\n}\n\n.saveMenuButton:hover {\n\tbackground-color: #35a !important;\n}\n\n.saveMenuConfirm {\n\tmargin-top: 20px;\n\tmargin-left: 150px;\n}\n\n.green {\n\tcolor: #38b20a\n}\n\n.gold {\n\tcolor: gold;\n}\n\n.red {\n\tcolor: #ec3535;\n}\n\n.saveBorder {\n\tmax-width: 700px;\n\tmargin: 10px 2px;\n\tpadding: 5px 2px 30px;\n\tborder: 1px solid var(--200);\n}\n\n/* dol-specific */\n#saveList ul.buttons {\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n\tborder-top: 1px solid var(--750);\n}\n\n#saveList ul.buttons li {\n\tpadding: 0.4em;\n\tdisplay: inline-block;\n\tmargin: 0;\n}\n\n#saveList ul.buttons li:last-child {\n\tfloat: right;\n}\n\n#saveList button[id=\"saves-export\"]:before,\n#saveList button[id=\"saves-toClipboard\"]:before,\n#saveList button[id=\"saves-import\"]:before,\n#saveList button[id=\"saves-clear\"]:before {\n\tfont-family: tme-fa-icons !important;\n\t/* stylelint-disable-line font-family-no-missing-generic-family-keyword */\n\tfont-style: normal;\n\tfont-weight: 900;\n\tfont-variant: normal;\n\tline-height: 1;\n\tspeak: never;\n\ttext-rendering: auto;\n\ttext-transform: none;\n\t-webkit-font-smoothing: antialiased;\n\t-moz-osx-font-smoothing: grayscale;\n}\n#saveList button[id=\"saves-export\"]:before {\n\tcontent: \"\\e829\\00a0\";\n}\n#saveList button[id=\"saves-toClipboard\"]:before {\n\tcontent: \"\\e82b\\00a0\";\n}\n#saveList button[id=\"saves-import\"]:before {\n\tcontent: \"\\e82a\\00a0\";\n}\n#saveList button[id=\"saves-clear\"]:before {\n\tcontent: \"\\e827\\00a0\";\n}</style>\n<style id=\"style-ui-debug\" type=\"text/css\">/***********************************************************************************************************************\n\n\tcss/_mixins.css\n\n\tCopyright © 2020–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\n/***********************************************************************************************************************\n\n\tcss/ui-debug.css\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\n/*\n\tDefault debug bar styles.\n*/\n#debug-bar {\n\tbackground-color: #222;\n\tborder-left: 1px solid #444;\n\tborder-top: 1px solid #444;\n\tbottom: 0;\n\tmargin: 0;\n\tmax-height: 75%;\n\t/* max-width: 28em;\n\tmin-width: 22em; */\n\tpadding: 0.5em;\n\tposition: fixed;\n\tright: 0;\n\tz-index: 99900;\n}\n#debug-bar > div:not([id]) + div {\n\tmargin-top: 0.5em;\n}\n#debug-bar > div > label {\n\tmargin-right: 0.5em;\n}\n#debug-bar > div > input[type=\"text\"] {\n\tmin-width: 0;\n\twidth: 8em;\n}\n#debug-bar > div > select {\n\twidth: 15em;\n}\n\n#debug-bar-toggle {\n\tcolor: #eee;\n\tbackground-color: #222;\n\tborder: 1px solid #444;\n\theight: 101%; /* fallback for browsers without support for calc() */\n\theight: calc(100% + 1px);\n\tleft: -2em; /* fallback for browsers without support for calc() */\n\tleft: calc(-2em - 1px);\n\tposition: absolute;\n\ttop: -1px;\n\twidth: 2em;\n}\n#debug-bar-toggle:hover {\n\tbackground-color: #333;\n\tborder-color: #eee;\n}\n\n#debug-bar-hint {\n\tbottom: 0.175em;\n\tfont-size: 4.5em;\n\topacity: 0.33;\n\tpointer-events: none;\n\tposition: fixed;\n\tright: 0.6em;\n\tuser-select: none;\n\twhite-space: nowrap;\n}\n\n#debug-bar-watch {\n\tbackground-color: #222;\n\tborder-left: 1px solid #444;\n\tborder-top: 1px solid #444;\n\tbottom: 102%; /* fallback for browsers without support for calc() */\n\tbottom: calc(100% + 1px);\n\tfont-size: 0.9em;\n\tleft: -1px;\n\tmax-height: 650%; /* fallback for browsers without support for vh units */\n\tmax-height: 65vh;\n\tposition: absolute;\n\toverflow-x: hidden;\n\toverflow-y: scroll;\n\tright: 0;\n\tz-index: 99800;\n}\n#debug-bar-watch[hidden] {\n\tdisplay: none;\n}\n#debug-bar-watch div {\n\tcolor: #999;\n\tfont-style: italic;\n\tmargin: 1em auto;\n\ttext-align: center;\n}\n#debug-bar-watch table {\n\twidth: 100%;\n}\n#debug-bar-watch tr:nth-child(2n) {\n\tbackground-color: rgba(127, 127, 127, 0.15);\n}\n#debug-bar-watch td {\n\tpadding: 0.2em 0;\n}\n#debug-bar-watch td:first-child + td {\n\tpadding: 0.2em 0.3em 0.2em 0.1em;\n}\n#debug-bar-watch .watch-delete {\n\tbackground-color: transparent;\n\tborder: none;\n\tcolor: #c00;\n}\n#debug-bar-watch-all,\n#debug-bar-watch-none {\n\tmargin-left: 0.5em;\n}\n#debug-bar-watch-toggle,\n#debug-bar-views-toggle {\n\tcolor: #eee;\n\tbackground-color: transparent;\n\tborder: 1px solid #444;\n\tmargin-right: 1em;\n\tpadding: 0.4em;\n}\n#debug-bar-watch-toggle:hover,\n#debug-bar-views-toggle:hover {\n\tbackground-color: #333;\n\tborder-color: #eee;\n}\n#debug-bar-watch:not([hidden]) ~ div #debug-bar-watch-toggle,\nhtml[data-debug-view] #debug-bar-views-toggle {\n\tbackground-color: #282;\n\tborder-color: #4a4;\n}\n#debug-bar-watch:not([hidden]) ~ div #debug-bar-watch-toggle:hover,\nhtml[data-debug-view] #debug-bar-views-toggle:hover {\n\tbackground-color: #4a4;\n\tborder-color: #6c6;\n}\n\n#debug-bar-toggle:before,\n#debug-bar-hint:after,\n#debug-bar-watch .watch-delete:before,\n#debug-bar-watch-add:before,\n#debug-bar-watch-all:before,\n#debug-bar-watch-none:before,\n#debug-bar-watch-toggle:after,\n#debug-bar-views-toggle:after {\n\tfont-family: tme-fa-icons !important;\n\t/* stylelint-disable-line font-family-no-missing-generic-family-keyword */\n\tfont-style: normal;\n\tfont-weight: 900;\n\tfont-variant: normal;\n\tline-height: 1;\n\tspeak: never;\n\ttext-rendering: auto;\n\ttext-transform: none;\n\t-webkit-font-smoothing: antialiased;\n\t-moz-osx-font-smoothing: grayscale;\n}\n#debug-bar-toggle:before {\n\tcontent: \"\\e838\";\n}\n#debug-bar-hint:after {\n\tcontent: \"\\e838\\202f\\e822\";\n}\n#debug-bar-watch .watch-delete:before {\n\tcontent: \"\\e804\";\n}\n#debug-bar-watch-add:before {\n\tcontent: \"\\e805\";\n}\n#debug-bar-watch-all:before {\n\tcontent: \"\\e83a\";\n}\n#debug-bar-watch-none:before {\n\tcontent: \"\\e827\";\n}\n#debug-bar-watch-toggle:after,\n#debug-bar-views-toggle:after {\n\tcontent: \"\\00a0\\00a0\\e830\";\n}\n#debug-bar-watch:not([hidden]) ~ div #debug-bar-watch-toggle:after,\nhtml[data-debug-view] #debug-bar-views-toggle:after {\n\tcontent: \"\\00a0\\00a0\\e831\";\n}\n\n\n/*\n\tDefault debug view styles.\n*/\nhtml[data-debug-view] .debug {\n\tpadding: 0.25em;\n\tbackground-color: #234; /* #541, #151 */\n}\nhtml[data-debug-view] .debug[title] {\n\tcursor: help;\n}\nhtml[data-debug-view] .debug.block {\n\tdisplay: inline-block;\n\tvertical-align: middle;\n}\nhtml[data-debug-view] .debug.invalid {\n\ttext-decoration: line-through;\n}\nhtml[data-debug-view] .debug.hidden,\nhtml[data-debug-view] .debug.hidden .debug {\n\tbackground-color: #555;\n}\nhtml:not([data-debug-view]) .debug.hidden {\n\tdisplay: none;\n}\n\nhtml[data-debug-view] .debug[data-name][data-type]:before,\nhtml[data-debug-view] .debug[data-name][data-type].nonvoid:after {\n\tbackground-color: rgba(0,0,0,0.25);\n\tfont-family: monospace, monospace;\n\twhite-space: pre;\n}\nhtml[data-debug-view] .debug[data-name][data-type]:before {\n\tcontent: attr(data-name);\n}\nhtml[data-debug-view] .debug[data-name][data-type|=\"macro\"]:before {\n\tcontent: \"<<\" attr(data-name) \">>\";\n}\nhtml[data-debug-view] .debug[data-name][data-type|=\"macro\"].nonvoid:after {\n\tcontent: \"<</\" attr(data-name) \">>\";\n}\nhtml[data-debug-view] .debug[data-name][data-type|=\"html\"]:before {\n\tcontent: \"<\" attr(data-name) \">\";\n}\nhtml[data-debug-view] .debug[data-name][data-type|=\"html\"].nonvoid:after {\n\tcontent: \"</\" attr(data-name) \">\";\n}\nhtml[data-debug-view] .debug[data-name][data-type]:not(:empty):before {\n\tmargin-right: 0.25em;\n}\nhtml[data-debug-view] .debug[data-name][data-type].nonvoid:not(:empty):after {\n\tmargin-left: 0.25em;\n}\nhtml[data-debug-view] .debug[data-name][data-type|=\"special\"],\nhtml[data-debug-view] .debug[data-name][data-type|=\"special\"]:before {\n\tdisplay: block;\n}\n</style>\n</head>\n<body>\n\t<div id=\"init-screen\">\n\t\t<div id=\"init-no-js\"><noscript>JavaScript must be enabled to play.</noscript></div>\n\t\t<div id=\"init-lacking\"><p>Browser lacks capabilities required to play.</p><p>Upgrade or switch to another browser.</p></div>\n\t\t<div id=\"init-loading\"><div>Loading&hellip;</div></div>\n\t</div>\n\t{{STORY_DATA}}\n\t<script id=\"script-sugarcube\" type=\"text/javascript\">\n\t/*! SugarCube JS */\n\tif(document.documentElement.getAttribute(\"data-init\")===\"loading\"){window.TWINE1=false;\nwindow.DEBUG=false;\n(function (window, document, jQuery, undefined) {\n\"use strict\";\n\n/***********************************************************************************************************************\n\n\tlib/alert.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\n/*\n\tTODO: This regular expression should be elsewhere.\n\n\tError prologs by engine/browser: (ca. 2018)\n\t\tChrome, Opera, & Vivaldi → `Uncaught \\w*Error: …`\n\t\tEdge & IE                → `…`\n\t\tFirefox                  → `Error: …`\n\t\tOpera (Presto)           → `Uncaught exception: \\w*(?:Error|Exception): …`\n\t\tSafari (ca. v5.1)        → `\\w*(?:Error|_ERR): …`\n*/\nvar errorPrologRegExp = /^(?:(?:uncaught\\s+(?:exception:\\s+)?)?\\w*(?:error|exception|_err):\\s+)+/i; // eslint-disable-line no-unused-vars, no-var\n\nvar Alert = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\t/*******************************************************************************************************************\n\t\tError Functions.\n\t*******************************************************************************************************************/\n\tfunction mesg(where, error, isFatal, isUncaught) {\n\t\tlet mesg = 'Error';\n\t\tlet nice = `A${isFatal ? ' fatal' : 'n'} error has occurred.`;\n\n\t\tif (isFatal) {\n\t\t\tnice += ' Aborting.';\n\t\t}\n\t\telse {\n\t\t\tnice += ' You may be able to continue, but some parts may not work properly.';\n\t\t}\n\n\t\tconst isObject = error !== null && typeof error === 'object';\n\t\tconst isExLike = isObject && 'message' in error;\n\t\tconst what     = (\n\t\t\tisExLike ? String(error.message).replace(errorPrologRegExp, '') : String(error)\n\t\t).trim() || 'unknown error';\n\n\t\tif (where != null) { // lazy equality for null\n\t\t\tmesg += ` [${where}]`;\n\t\t}\n\n\t\tmesg += `: ${what}.`;\n\n\t\tif (isObject && 'stack' in error) {\n\t\t\tmesg += `\\n\\nStack Trace:\\n${error.stack}`;\n\t\t}\n\n\t\tif (mesg) {\n\t\t\tnice += `\\n\\n${mesg}`;\n\t\t}\n\n\t\t// Log a plain message.\n\t\tif (!isUncaught) {\n\t\t\tconsole[isFatal ? 'error' : 'warn'](mesg);\n\t\t}\n\n\t\t// Pop up a nice message.\n\t\twindow.alert(nice); // eslint-disable-line no-alert\n\t}\n\n\tfunction alertError(where, error) {\n\t\tmesg(where, error);\n\t}\n\n\tfunction alertFatal(where, error) {\n\t\tmesg(where, error, true);\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tError Event.\n\t*******************************************************************************************************************/\n\t/*\n\t\tSet up a global error handler for uncaught exceptions.\n\t*/\n\t(origOnError => {\n\t\twindow.onerror = function (what, source, lineNum, colNum, error) {\n\t\t\t// console.error(what, source, lineNum, colNum, error);\n\n\t\t\t// Uncaught exceptions during play may be recoverable/ignorable.\n\t\t\tif (document.readyState === 'complete') {\n\t\t\t\tmesg(null, error != null ? error : what, false, true); // lazy equality for null\n\t\t\t}\n\n\t\t\t// Uncaught exceptions during startup should be fatal.\n\t\t\telse {\n\t\t\t\tmesg(null, error != null ? error : what, true, true); // lazy equality for null\n\t\t\t\twindow.onerror = origOnError;\n\n\t\t\t\tif (typeof window.onerror === 'function') {\n\t\t\t\t\twindow.onerror.apply(this, arguments);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t})(window.onerror);\n\n\n\t/*******************************************************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************************************************/\n\treturn Object.freeze(Object.defineProperties({}, {\n\t\terror : { value : alertError },\n\t\tfatal : { value : alertFatal }\n\t}));\n})();\n\n/***********************************************************************************************************************\n\n\tlib/patterns.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/*\n\tTODO: Move all markup patterns into here.\n*/\n\n/* eslint-disable max-len */\nvar Patterns = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\t/*******************************************************************************************************************\n\t\tPatterns.\n\t*******************************************************************************************************************/\n\t/*\n\t\tWhitespace patterns.\n\n\t\tSpace class (equivalent to `\\s`):\n\t\t\t[\\u0020\\f\\n\\r\\t\\v\\u00a0\\u1680\\u180e\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]\n\t\tSpace class, sans line terminators:\n\t\t\t[\\u0020\\f\\t\\v\\u00a0\\u1680\\u180e\\u2000-\\u200a\\u202f\\u205f\\u3000\\ufeff]\n\t\tLine Terminator class:\n\t\t\t[\\n\\r\\u2028\\u2029]\n\t*/\n\tconst space = (() => {\n\t\t/*\n\t\t\tSome browsers still supported by SugarCube have faulty space classes (`\\s`).\n\t\t\tWe check for that lossage here and, if necessary, build our own class from\n\t\t\tthe component pieces.\n\t\t*/\n\t\tconst wsMap = new Map([\n\t\t\t['\\u0020', '\\\\u0020'],\n\t\t\t['\\f', '\\\\f'],\n\t\t\t['\\n', '\\\\n'],\n\t\t\t['\\r', '\\\\r'],\n\t\t\t['\\t', '\\\\t'],\n\t\t\t['\\v', '\\\\v'],\n\t\t\t['\\u00a0', '\\\\u00a0'],\n\t\t\t['\\u1680', '\\\\u1680'],\n\t\t\t['\\u180e', '\\\\u180e'],\n\t\t\t['\\u2000', '\\\\u2000'],\n\t\t\t['\\u2001', '\\\\u2001'],\n\t\t\t['\\u2002', '\\\\u2002'],\n\t\t\t['\\u2003', '\\\\u2003'],\n\t\t\t['\\u2004', '\\\\u2004'],\n\t\t\t['\\u2005', '\\\\u2005'],\n\t\t\t['\\u2006', '\\\\u2006'],\n\t\t\t['\\u2007', '\\\\u2007'],\n\t\t\t['\\u2008', '\\\\u2008'],\n\t\t\t['\\u2009', '\\\\u2009'],\n\t\t\t['\\u200a', '\\\\u200a'],\n\t\t\t['\\u2028', '\\\\u2028'],\n\t\t\t['\\u2029', '\\\\u2029'],\n\t\t\t['\\u202f', '\\\\u202f'],\n\t\t\t['\\u205f', '\\\\u205f'],\n\t\t\t['\\u3000', '\\\\u3000'],\n\t\t\t['\\ufeff', '\\\\ufeff']\n\t\t]);\n\t\tconst wsRe = /^\\s$/;\n\t\tlet missing = '';\n\n\t\twsMap.forEach((pat, char) => {\n\t\t\tif (!wsRe.test(char)) {\n\t\t\t\tmissing += pat;\n\t\t\t}\n\t\t});\n\n\t\treturn missing ? `[\\\\s${missing}]` : '\\\\s';\n\t})();\n\tconst spaceNoTerminator = '[\\\\u0020\\\\f\\\\t\\\\v\\\\u00a0\\\\u1680\\\\u180e\\\\u2000-\\\\u200a\\\\u202f\\\\u205f\\\\u3000\\\\ufeff]';\n\tconst lineTerminator    = '[\\\\n\\\\r\\\\u2028\\\\u2029]';\n\tconst notSpace          = space === '\\\\s' ? '\\\\S' : space.replace(/^\\[/, '[^');\n\n\t/*\n\t\tCharacter patterns.\n\t*/\n\tconst anyChar = `(?:.|${lineTerminator})`;\n\n\t/*\n\t\tLetter patterns.\n\n\t\tFIXME:\n\t\t\t1. The existing set, which is a TiddlyWiki holdover, should probably\n\t\t\t   encompass a significantly greater range of BMP code points.\n\t\t\t2. Should we include the surrogate pair code units (\\uD800-\\uDBFF &\n\t\t\t   \\uDC00-\\uDFFF) to handle non-BMP code points?  Further, should we\n\t\t\t   simply be checking for the code units themselves or checking for\n\t\t\t   properly mated pairs?\n\t*/\n\tconst anyLetter       = '[0-9A-Z_a-z\\\\-\\\\u00c0-\\\\u00d6\\\\u00d8-\\\\u00f6\\\\u00f8-\\\\u00ff\\\\u0150\\\\u0170\\\\u0151\\\\u0171]';\n\tconst anyLetterStrict = anyLetter.replace('\\\\-', ''); // anyLetter sans hyphen\n\n\t/*\n\t\tIdentifier patterns.\n\n\t\tNOTE: Since JavaScript's RegExp syntax does not support Unicode character\n\t\tclasses, the correct regular expression to match a valid identifier name,\n\t\twithin the scope of our needs, would be on the order of approximately 5–6\n\t\tor 11–16 KiB, depending on how the pattern was built.  That being the case,\n\t\tfor the moment we restrict valid TwineScript identifiers to US-ASCII.\n\n\t\tFIXME: Fix this to, at least, approximate the correct range.\n\t*/\n\tconst identifierFirstChar = '[$A-Z_a-z]';\n\tconst identifierNextChar  = '[$0-9A-Z_a-z]';\n\tconst identifier          = `${identifierFirstChar}${identifierNextChar}*`;\n\n\t// Variable patterns.\n\tconst variableSigil = '[$_]';\n\tconst variable      = variableSigil + identifier;\n\n\t// Macro name pattern.\n\tconst macroName = '[A-Za-z][\\\\w-]*|[=-]';\n\n\t// Template name pattern.\n\tconst templateName = '[A-Za-z][\\\\w-]*';\n\n\t// HTML tag name pattern.\n\tconst htmlTagName = (() => {\n\t\t/*\n\t\t\tElement Name:\n\t\t\t\t[A-Za-z] [0-9A-Za-z]*\n\n\t\t\tCustom Element Name:\n\t\t\t\t[a-z] (CENChar)* '-' (CENChar)*\n\t\t\tCENChar:\n\t\t\t\t\"-\" | \".\" | [0-9] | \"_\" | [a-z] | #xB7 | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x203F-#x2040] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]\n\t\t*/\n\t\tconst cENChar = '(?:[\\\\x2D.0-9A-Z_a-z\\\\xB7\\\\xC0-\\\\xD6\\\\xD8-\\\\xF6\\\\xF8-\\\\u037D\\\\u037F-\\\\u1FFF\\\\u200C\\\\u200D\\\\u203F\\\\u2040\\\\u2070-\\\\u218F\\\\u2C00-\\\\u2FEF\\\\u3001-\\\\uD7FF\\\\uF900-\\\\uFDCF\\\\uFDF0-\\\\uFFFD]|[\\\\uD800-\\\\uDB7F][\\\\uDC00-\\\\uDFFF])';\n\n\t\treturn `[A-Za-z](?:${cENChar}*-${cENChar}*|[0-9A-Za-z]*)`;\n\t})();\n\n\t// CSS ID or class sigil pattern.\n\tconst cssIdOrClassSigil = '[#.]';\n\n\t// CSS image transclusion template pattern.\n\t//\n\t// NOTE: The alignment syntax isn't supported, but removing it might break uses\n\t// of the template in the wild, so we leave it alone for now.\n\tconst cssImage = '\\\\[[<>]?[Ii][Mm][Gg]\\\\[(?:\\\\s|\\\\S)*?\\\\]\\\\]+';\n\n\t// Inline CSS pattern.\n\tconst inlineCss = (() => {\n\t\t/* legacy */\n\t\tconst twStyle   = `(${anyLetter}+)\\\\(([^\\\\)\\\\|\\\\n]+)\\\\):`;\n\t\t/* /legacy */\n\t\tconst cssStyle  = `${spaceNoTerminator}*(${anyLetter}+)${spaceNoTerminator}*:([^;\\\\|\\\\n]+);`;\n\t\tconst idOrClass = `${spaceNoTerminator}*((?:${cssIdOrClassSigil}${anyLetter}+${spaceNoTerminator}*)+);`;\n\n\t\t// [1,2] = style(value):\n\t\t// [3,4] = style:value;\n\t\t// [5]   = #id.className;\n\t\treturn `${twStyle}|${cssStyle}|${idOrClass}`;\n\t})();\n\n\t// URL pattern.\n\tconst url = '(?:file|https?|mailto|ftp|javascript|irc|news|data):[^\\\\s\\'\"]+';\n\n\n\t/*******************************************************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************************************************/\n\treturn Object.freeze({\n\t\tspace,\n\t\tspaceNoTerminator,\n\t\tlineTerminator,\n\t\tnotSpace,\n\t\tanyChar,\n\t\tanyLetter,\n\t\tanyLetterStrict,\n\t\tidentifierFirstChar,\n\t\tidentifierNextChar,\n\t\tidentifier,\n\t\tvariableSigil,\n\t\tvariable,\n\t\tmacroName,\n\t\ttemplateName,\n\t\thtmlTagName,\n\t\tcssIdOrClassSigil,\n\t\tcssImage,\n\t\tinlineCss,\n\t\turl\n\t});\n})();\n/* eslint-enable max-len */\n\n/***********************************************************************************************************************\n\n\tlib/extensions.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/* global Patterns */\n\n/*\n\tJavaScript Polyfills.\n\n\tNOTE: The ES5 and ES6 polyfills come from the vendored `es5-shim.js` and `es6-shim.js` libraries.\n*/\n(() => {\n\t'use strict';\n\n\t/*******************************************************************************************************************\n\t\tUtility Functions.\n\t*******************************************************************************************************************/\n\t/*\n\t\tTrims whitespace from either the start or end of the given string.\n\t*/\n\tconst _trimString = (() => {\n\t\t// Whitespace regular expressions.\n\t\tconst startWSRe = new RegExp(`^${Patterns.space}${Patterns.space}*`);\n\t\tconst endWSRe   = new RegExp(`${Patterns.space}${Patterns.space}*$`);\n\n\t\tfunction trimString(str, where) {\n\t\t\tconst val = String(str);\n\n\t\t\tif (!val) {\n\t\t\t\treturn val;\n\t\t\t}\n\n\t\t\tswitch (where) {\n\t\t\tcase 'start':\n\t\t\t\treturn startWSRe.test(val) ? val.replace(startWSRe, '') : val;\n\n\t\t\tcase 'end':\n\t\t\t\treturn endWSRe.test(val) ? val.replace(endWSRe, '') : val;\n\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`_trimString called with incorrect where parameter value: \"${where}\"`);\n\t\t\t}\n\t\t}\n\n\t\treturn trimString;\n\t})();\n\n\t/*\n\t\tGenerates a pad string based upon the given string and length.\n\t*/\n\tfunction _createPadString(length, padding) {\n\t\tconst targetLength = Number.parseInt(length, 10) || 0;\n\n\t\tif (targetLength < 1) {\n\t\t\treturn '';\n\t\t}\n\n\t\tlet padString = typeof padding === 'undefined' ? '' : String(padding);\n\n\t\tif (padString === '') {\n\t\t\tpadString = ' ';\n\t\t}\n\n\t\twhile (padString.length < targetLength) {\n\t\t\tconst curPadLength    = padString.length;\n\t\t\tconst remainingLength = targetLength - curPadLength;\n\n\t\t\tpadString += curPadLength > remainingLength\n\t\t\t\t? padString.slice(0, remainingLength)\n\t\t\t\t: padString;\n\t\t}\n\n\t\tif (padString.length > targetLength) {\n\t\t\tpadString = padString.slice(0, targetLength);\n\t\t}\n\n\t\treturn padString;\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tPolyfills.\n\t*******************************************************************************************************************/\n\t/*\n\t\t[ES2019] Returns a new array consisting of the source array with all sub-array elements\n\t\tconcatenated into it recursively up to the given depth.\n\t*/\n\tif (!Array.prototype.flat) {\n\t\tObject.defineProperty(Array.prototype, 'flat', {\n\t\t\tconfigurable : true,\n\t\t\twritable     : true,\n\t\t\tvalue        : (() => {\n\t\t\t\tfunction flat(/* depth */) {\n\t\t\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\t\t\tthrow new TypeError('Array.prototype.flat called on null or undefined');\n\t\t\t\t\t}\n\n\t\t\t\t\tconst depth = arguments.length === 0 ? 1 : Number(arguments[0]) || 0;\n\n\t\t\t\t\tif (depth < 1) {\n\t\t\t\t\t\treturn Array.prototype.slice.call(this);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn Array.prototype.reduce.call(\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\t(acc, cur) => {\n\t\t\t\t\t\t\tif (cur instanceof Array) {\n\t\t\t\t\t\t\t\t// acc.push.apply(acc, flat.call(cur, depth - 1));\n\t\t\t\t\t\t\t\tacc.push(...flat.call(cur, depth - 1));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tacc.push(cur);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t[]\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn flat;\n\t\t\t})()\n\t\t});\n\t}\n\n\t/*\n\t\t[ES2019] Returns a new array consisting of the result of calling the given mapping function\n\t\ton every element in the source array and then concatenating all sub-array elements into it\n\t\trecursively up to a depth of `1`.  Identical to calling `<Array>.map(fn).flat()`.\n\t*/\n\tif (!Array.prototype.flatMap) {\n\t\tObject.defineProperty(Array.prototype, 'flatMap', {\n\t\t\tconfigurable : true,\n\t\t\twritable     : true,\n\n\t\t\tvalue(/* callback [, thisArg] */) {\n\t\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\t\tthrow new TypeError('Array.prototype.flatMap called on null or undefined');\n\t\t\t\t}\n\n\t\t\t\treturn Array.prototype.map.apply(this, arguments).flat();\n\t\t\t}\n\t\t});\n\t}\n\n\t/*\n\t\t[ES2016] Returns whether the given element was found within the array.\n\t*/\n\tif (!Array.prototype.includes) {\n\t\tObject.defineProperty(Array.prototype, 'includes', {\n\t\t\tconfigurable : true,\n\t\t\twritable     : true,\n\n\t\t\tvalue(/* needle [, fromIndex] */) {\n\t\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\t\tthrow new TypeError('Array.prototype.includes called on null or undefined');\n\t\t\t\t}\n\n\t\t\t\tif (arguments.length === 0) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst length = this.length >>> 0;\n\n\t\t\t\tif (length === 0) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst needle = arguments[0];\n\t\t\t\tlet i = Number(arguments[1]) || 0;\n\n\t\t\t\tif (i < 0) {\n\t\t\t\t\ti = Math.max(0, length + i);\n\t\t\t\t}\n\n\t\t\t\tfor (/* empty */; i < length; ++i) {\n\t\t\t\t\tconst value = this[i];\n\n\t\t\t\t\tif (value === needle || value !== value && needle !== needle) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\t\t\t}\n\t\t});\n\t}\n\n\t/*\n\t\t[ES2017] Returns a new array consisting of the given object's own enumerable property/value\n\t\tpairs as `[key, value]` arrays.\n\t*/\n\tif (!Object.entries) {\n\t\tObject.defineProperty(Object, 'entries', {\n\t\t\tconfigurable : true,\n\t\t\twritable     : true,\n\n\t\t\tvalue(obj) {\n\t\t\t\tif (typeof obj !== 'object' || obj === null) {\n\t\t\t\t\tthrow new TypeError('Object.entries object parameter must be an object');\n\t\t\t\t}\n\n\t\t\t\treturn Object.keys(obj).map(key => [key, obj[key]]);\n\t\t\t}\n\t\t});\n\t}\n\n\t/*\n\t\t[ES2019] Returns a new generic object consisting of the given list's key/value pairs.\n\t*/\n\tif (!Object.fromEntries) {\n\t\tObject.defineProperty(Object, 'fromEntries', {\n\t\t\tconfigurable : true,\n\t\t\twritable     : true,\n\n\t\t\tvalue(iter) {\n\t\t\t\treturn Array.from(iter).reduce(\n\t\t\t\t\t(acc, pair) => {\n\t\t\t\t\t\tif (Object(pair) !== pair) {\n\t\t\t\t\t\t\tthrow new TypeError('Object.fromEntries iterable parameter must yield objects');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (pair[0] in acc) {\n\t\t\t\t\t\t\tObject.defineProperty(acc, pair[0], {\n\t\t\t\t\t\t\t\tconfigurable : true,\n\t\t\t\t\t\t\t\tenumerable   : true,\n\t\t\t\t\t\t\t\twritable     : true,\n\t\t\t\t\t\t\t\tvalue        : pair[1]\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tacc[pair[0]] = pair[1]; // eslint-disable-line no-param-reassign\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn acc;\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t}\n\n\t/*\n\t\t[ES2017] Returns all own property descriptors of the given object.\n\t*/\n\tif (!Object.getOwnPropertyDescriptors) {\n\t\tObject.defineProperty(Object, 'getOwnPropertyDescriptors', {\n\t\t\tconfigurable : true,\n\t\t\twritable     : true,\n\n\t\t\tvalue(obj) {\n\t\t\t\tif (obj == null) { // lazy equality for null\n\t\t\t\t\tthrow new TypeError('Object.getOwnPropertyDescriptors object parameter is null or undefined');\n\t\t\t\t}\n\n\t\t\t\tconst O = Object(obj);\n\n\t\t\t\treturn Reflect.ownKeys(O).reduce(\n\t\t\t\t\t(acc, key) => {\n\t\t\t\t\t\tconst desc = Object.getOwnPropertyDescriptor(O, key);\n\n\t\t\t\t\t\tif (typeof desc !== 'undefined') {\n\t\t\t\t\t\t\tif (key in acc) {\n\t\t\t\t\t\t\t\tObject.defineProperty(acc, key, {\n\t\t\t\t\t\t\t\t\tconfigurable : true,\n\t\t\t\t\t\t\t\t\tenumerable   : true,\n\t\t\t\t\t\t\t\t\twritable     : true,\n\t\t\t\t\t\t\t\t\tvalue        : desc\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tacc[key] = desc; // eslint-disable-line no-param-reassign\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn acc;\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t}\n\n\t/*\n\t\t[ES2017] Returns a new array consisting of the given object's own enumerable property values.\n\t*/\n\tif (!Object.values) {\n\t\tObject.defineProperty(Object, 'values', {\n\t\t\tconfigurable : true,\n\t\t\twritable     : true,\n\n\t\t\tvalue(obj) {\n\t\t\t\tif (typeof obj !== 'object' || obj === null) {\n\t\t\t\t\tthrow new TypeError('Object.values object parameter must be an object');\n\t\t\t\t}\n\n\t\t\t\treturn Object.keys(obj).map(key => obj[key]);\n\t\t\t}\n\t\t});\n\t}\n\n\t/*\n\t\t[ES2017] Returns a string based on concatenating the given padding, repeated as necessary,\n\t\tto the start of the string so that the given length is reached.\n\n\t\tNOTE: This pads based upon Unicode code units, rather than code points.\n\t*/\n\tif (!String.prototype.padStart) {\n\t\tObject.defineProperty(String.prototype, 'padStart', {\n\t\t\tconfigurable : true,\n\t\t\twritable     : true,\n\n\t\t\tvalue(length, padding) {\n\t\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\t\tthrow new TypeError('String.prototype.padStart called on null or undefined');\n\t\t\t\t}\n\n\t\t\t\tconst baseString   = String(this);\n\t\t\t\tconst baseLength   = baseString.length;\n\t\t\t\tconst targetLength = Number.parseInt(length, 10);\n\n\t\t\t\tif (targetLength <= baseLength) {\n\t\t\t\t\treturn baseString;\n\t\t\t\t}\n\n\t\t\t\treturn _createPadString(targetLength - baseLength, padding) + baseString;\n\t\t\t}\n\t\t});\n\t}\n\n\t/*\n\t\t[ES2017] Returns a string based on concatenating the given padding, repeated as necessary,\n\t\tto the end of the string so that the given length is reached.\n\n\t\tNOTE: This pads based upon Unicode code units, rather than code points.\n\t*/\n\tif (!String.prototype.padEnd) {\n\t\tObject.defineProperty(String.prototype, 'padEnd', {\n\t\t\tconfigurable : true,\n\t\t\twritable     : true,\n\n\t\t\tvalue(length, padding) {\n\t\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\t\tthrow new TypeError('String.prototype.padEnd called on null or undefined');\n\t\t\t\t}\n\n\t\t\t\tconst baseString   = String(this);\n\t\t\t\tconst baseLength   = baseString.length;\n\t\t\t\tconst targetLength = Number.parseInt(length, 10);\n\n\t\t\t\tif (targetLength <= baseLength) {\n\t\t\t\t\treturn baseString;\n\t\t\t\t}\n\n\t\t\t\treturn baseString + _createPadString(targetLength - baseLength, padding);\n\t\t\t}\n\t\t});\n\t}\n\n\t/*\n\t\t[ES2019] Returns a string with all whitespace removed from the start of the string.\n\t*/\n\tif (!String.prototype.trimStart) {\n\t\tObject.defineProperty(String.prototype, 'trimStart', {\n\t\t\tconfigurable : true,\n\t\t\twritable     : true,\n\n\t\t\tvalue() {\n\t\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\t\tthrow new TypeError('String.prototype.trimStart called on null or undefined');\n\t\t\t\t}\n\n\t\t\t\treturn _trimString(this, 'start');\n\t\t\t}\n\t\t});\n\t}\n\n\tif (!String.prototype.trimLeft) {\n\t\tObject.defineProperty(String.prototype, 'trimLeft', {\n\t\t\tconfigurable : true,\n\t\t\twritable     : true,\n\n\t\t\tvalue() {\n\t\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\t\tthrow new TypeError('String.prototype.trimLeft called on null or undefined');\n\t\t\t\t}\n\n\t\t\t\treturn _trimString(this, 'start');\n\t\t\t}\n\t\t});\n\t}\n\n\t/*\n\t\t[ES2019] Returns a string with all whitespace removed from the end of the string.\n\t*/\n\tif (!String.prototype.trimEnd) {\n\t\tObject.defineProperty(String.prototype, 'trimEnd', {\n\t\t\tconfigurable : true,\n\t\t\twritable     : true,\n\n\t\t\tvalue() {\n\t\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\t\tthrow new TypeError('String.prototype.trimEnd called on null or undefined');\n\t\t\t\t}\n\n\t\t\t\treturn _trimString(this, 'end');\n\t\t\t}\n\t\t});\n\t}\n\n\tif (!String.prototype.trimRight) {\n\t\tObject.defineProperty(String.prototype, 'trimRight', {\n\t\t\tconfigurable : true,\n\t\t\twritable     : true,\n\n\t\t\tvalue() {\n\t\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\t\tthrow new TypeError('String.prototype.trimRight called on null or undefined');\n\t\t\t\t}\n\n\t\t\t\treturn _trimString(this, 'end');\n\t\t\t}\n\t\t});\n\t}\n})();\n\n\n/*\n\tJavaScript Extensions.\n*/\n(() => {\n\t'use strict';\n\n\tfunction _nativeMathRandom(useMath) {\n\t\tif (useMath || !State.prng.isEnabled()) return Math.random();\n\t\treturn State.random();\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tUtility Functions.\n\t*******************************************************************************************************************/\n\t/*\n\t\tReturns a pseudo-random whole number (integer) within the given bounds.\n\t*/\n\tfunction _random(/* [min ,] max, [useMath] */) {\n\t\tlet min = 0;\n\t\tlet max;\n\t\tlet useMath = false;\n\n\t\tswitch (arguments.length) {\n\t\tcase 0:\n\t\t\tthrow new Error('_random called with insufficient parameters');\n\t\tcase 1:\n\t\t\tmax = arguments[0];\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tif (arguments[1] === true) {\n\t\t\t\tmax = arguments[0];\n\t\t\t\tuseMath = arguments[1];\n\t\t\t}\n\t\t\telse {\n\t\t\t\tmin = arguments[0];\n\t\t\t\tmax = arguments[1];\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tmin = arguments[0];\n\t\t\tmax = arguments[1];\n\t\t\tuseMath = arguments[2];\n\t\t\tbreak;\n\t\t}\n\n\t\tif (min > max) {\n\t\t\t[min, max] = [max, min];\n\t\t}\n\n\t\treturn Math.floor(_nativeMathRandom(useMath) * (max - min + 1)) + min;\n\t}\n\n\t/*\n\t\t[DEPRECATED]\n\t\tReturns a randomly selected index within the given length and bounds.\n\t\tBounds may be negative.\n\t*/\n\tfunction _randomIndex(length, boundsArgs) {\n\t\tlet min;\n\t\tlet max;\n\n\t\tswitch (boundsArgs.length) {\n\t\tcase 1:\n\t\t\tmin = 0;\n\t\t\tmax = length - 1;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tmin = 0;\n\t\t\tmax = Math.trunc(boundsArgs[1]);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tmin = Math.trunc(boundsArgs[1]);\n\t\t\tmax = Math.trunc(boundsArgs[2]);\n\t\t\tbreak;\n\t\t}\n\n\t\tif (Number.isNaN(min)) {\n\t\t\tmin = 0;\n\t\t}\n\t\telse if (!Number.isFinite(min) || min >= length) {\n\t\t\tmin = length - 1;\n\t\t}\n\t\telse if (min < 0) {\n\t\t\tmin = length + min;\n\n\t\t\tif (min < 0) {\n\t\t\t\tmin = 0;\n\t\t\t}\n\t\t}\n\n\t\tif (Number.isNaN(max)) {\n\t\t\tmax = 0;\n\t\t}\n\t\telse if (!Number.isFinite(max) || max >= length) {\n\t\t\tmax = length - 1;\n\t\t}\n\t\telse if (max < 0) {\n\t\t\tmax = length + max;\n\n\t\t\tif (max < 0) {\n\t\t\t\tmax = length - 1;\n\t\t\t}\n\t\t}\n\n\t\treturn _random(min, max);\n\t}\n\n\t/*\n\t\tReturns an object (`{ char, start, end }`) containing the Unicode character at\n\t\tposition `pos`, its starting position, and its ending position—surrogate pairs\n\t\tare properly handled.  If `pos` is out-of-bounds, returns an object containing\n\t\tthe empty string and start/end positions of `-1`.\n\n\t\tThis function is necessary because JavaScript strings are sequences of UTF-16\n\t\tcode units, so surrogate pairs are exposed and thus must be handled.  While the\n\t\tES6/2015 standard does improve the situation somewhat, it does not alleviate\n\t\tthe need for this function.\n\n\t\tNOTE: Will throw exceptions on invalid surrogate pairs.\n\n\t\tIDEA: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charAt\n\t*/\n\tfunction _getCodePointStartAndEnd(str, pos) {\n\t\tconst code = str.charCodeAt(pos);\n\n\t\t// Given position was out-of-bounds.\n\t\tif (Number.isNaN(code)) {\n\t\t\treturn { char : '', start : -1, end : -1 };\n\t\t}\n\n\t\t// Code unit is not a UTF-16 surrogate.\n\t\tif (code < 0xD800 || code > 0xDFFF) {\n\t\t\treturn {\n\t\t\t\tchar  : str.charAt(pos),\n\t\t\t\tstart : pos,\n\t\t\t\tend   : pos\n\t\t\t};\n\t\t}\n\n\t\t// Code unit is a high surrogate (D800–DBFF).\n\t\tif (code >= 0xD800 && code <= 0xDBFF) {\n\t\t\tconst nextPos = pos + 1;\n\n\t\t\t// End of string.\n\t\t\tif (nextPos >= str.length) {\n\t\t\t\tthrow new Error('high surrogate without trailing low surrogate');\n\t\t\t}\n\n\t\t\tconst nextCode = str.charCodeAt(nextPos);\n\n\t\t\t// Next code unit is not a low surrogate (DC00–DFFF).\n\t\t\tif (nextCode < 0xDC00 || nextCode > 0xDFFF) {\n\t\t\t\tthrow new Error('high surrogate without trailing low surrogate');\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tchar  : str.charAt(pos) + str.charAt(nextPos),\n\t\t\t\tstart : pos,\n\t\t\t\tend   : nextPos\n\t\t\t};\n\t\t}\n\n\t\t// Code unit is a low surrogate (DC00–DFFF) in the first position.\n\t\tif (pos === 0) {\n\t\t\tthrow new Error('low surrogate without leading high surrogate');\n\t\t}\n\n\t\tconst prevPos  = pos - 1;\n\t\tconst prevCode = str.charCodeAt(prevPos);\n\n\t\t// Previous code unit is not a high surrogate (D800–DBFF).\n\t\tif (prevCode < 0xD800 || prevCode > 0xDBFF) {\n\t\t\tthrow new Error('low surrogate without leading high surrogate');\n\t\t}\n\n\t\treturn {\n\t\t\tchar  : str.charAt(prevPos) + str.charAt(pos),\n\t\t\tstart : prevPos,\n\t\t\tend   : pos\n\t\t};\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tExtensions, General.\n\t*******************************************************************************************************************/\n\t/*\n\t\tRandomly selects an element from the given array, or array-like object, and returns it.\n\t*/\n\tObject.defineProperty(Array, 'random', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(array, useMath) {\n\t\t\tif (\n\t\t\t\t   typeof array !== 'object'\n\t\t\t\t|| array === null\n\t\t\t\t|| !Object.prototype.hasOwnProperty.call(array, 'length')\n\t\t\t) {\n\t\t\t\tthrow new TypeError('Array.random array parameter must be an array or array-lke object');\n\t\t\t}\n\n\t\t\tconst length = array.length >>> 0;\n\n\t\t\tif (length === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst index = _random(0, length - 1, useMath);\n\n\t\t\treturn array[index];\n\t\t}\n\t});\n\n\t/*\n\t\tConcatenates one or more unique elements to the end of the base array\n\t\tand returns the result as a new array.  Elements which are arrays will\n\t\tbe merged—i.e. their elements will be concatenated, rather than the\n\t\tarray itself.\n\t*/\n\tObject.defineProperty(Array.prototype, 'concatUnique', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(/* variadic */) {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('Array.prototype.concatUnique called on null or undefined');\n\t\t\t}\n\n\t\t\tconst result = Array.from(this);\n\n\t\t\tif (arguments.length === 0) {\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tconst items   = Array.prototype.reduce.call(arguments, (prev, cur) => prev.concat(cur), []);\n\t\t\tconst addSize = items.length;\n\n\t\t\tif (addSize === 0) {\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tconst indexOf = Array.prototype.indexOf;\n\t\t\tconst push    = Array.prototype.push;\n\n\t\t\tfor (let i = 0; i < addSize; ++i) {\n\t\t\t\tconst value = items[i];\n\n\t\t\t\tif (indexOf.call(result, value) === -1) {\n\t\t\t\t\tpush.call(result, value);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\t});\n\n\t/*\n\t\tReturns the number of times the given element was found within the array.\n\t*/\n\tObject.defineProperty(Array.prototype, 'count', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(/* needle [, fromIndex ] */) {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('Array.prototype.count called on null or undefined');\n\t\t\t}\n\n\t\t\tconst indexOf = Array.prototype.indexOf;\n\t\t\tconst needle  = arguments[0];\n\t\t\tlet pos   = Number(arguments[1]) || 0;\n\t\t\tlet count = 0;\n\n\t\t\twhile ((pos = indexOf.call(this, needle, pos)) !== -1) {\n\t\t\t\t++count;\n\t\t\t\t++pos;\n\t\t\t}\n\n\t\t\treturn count;\n\t\t}\n\t});\n\n\t/*\n\t\tReturns the number elements within the array that pass the test\n\t\timplemented by the given predicate function.\n\t*/\n\tObject.defineProperty(Array.prototype, 'countWith', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(predicate, thisArg) {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('Array.prototype.countWith called on null or undefined');\n\t\t\t}\n\t\t\tif (typeof predicate !== 'function') {\n\t\t\t\tthrow new Error('Array.prototype.countWith predicate parameter must be a function');\n\t\t\t}\n\n\t\t\tconst length = this.length >>> 0;\n\n\t\t\tif (length === 0) {\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t\tlet count = 0;\n\n\t\t\tfor (let i = 0; i < length; ++i) {\n\t\t\t\tif (predicate.call(thisArg, this[i], i, this)) {\n\t\t\t\t\t++count;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn count;\n\t\t}\n\t});\n\n\t/*\n\t\tRemoves and returns all of the given elements from the array.\n\t*/\n\tObject.defineProperty(Array.prototype, 'delete', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(/* needles */) {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('Array.prototype.delete called on null or undefined');\n\t\t\t}\n\n\t\t\tif (arguments.length === 0) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tconst length = this.length >>> 0;\n\n\t\t\tif (length === 0) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tconst needles       = Array.prototype.concat.apply([], arguments);\n\t\t\tconst needlesLength = needles.length;\n\t\t\tconst indices       = [];\n\n\t\t\tfor (let i = 0; i < length; ++i) {\n\t\t\t\tconst value = this[i];\n\n\t\t\t\tfor (let j = 0; j < needlesLength; ++j) {\n\t\t\t\t\tconst needle = needles[j];\n\n\t\t\t\t\tif (value === needle || value !== value && needle !== needle) {\n\t\t\t\t\t\tindices.push(i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst result = [];\n\n\t\t\t// Copy the elements (in original order).\n\t\t\tfor (let i = 0, iend = indices.length; i < iend; ++i) {\n\t\t\t\tresult[i] = this[indices[i]];\n\t\t\t}\n\n\t\t\tconst splice = Array.prototype.splice;\n\n\t\t\t// Delete the elements (in reverse order).\n\t\t\tfor (let i = indices.length - 1; i >= 0; --i) {\n\t\t\t\tsplice.call(this, indices[i], 1);\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\t});\n\n\t/*\n\t\tRemoves and returns all of the elements at the given indices from the array.\n\t*/\n\tObject.defineProperty(Array.prototype, 'deleteAt', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(/* indices */) {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('Array.prototype.deleteAt called on null or undefined');\n\t\t\t}\n\n\t\t\tif (arguments.length === 0) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tconst length = this.length >>> 0;\n\n\t\t\tif (length === 0) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tconst splice     = Array.prototype.splice;\n\t\t\tconst cpyIndices = [\n\t\t\t\t...new Set(\n\t\t\t\t\tArray.prototype.concat.apply([], arguments)\n\t\t\t\t\t\t// Map negative indices to their positive counterparts,\n\t\t\t\t\t\t// so the Set can properly filter out duplicates.\n\t\t\t\t\t\t.map(x => x < 0 ? Math.max(0, length + x) : x)\n\t\t\t\t).values()\n\t\t\t];\n\t\t\tconst delIndices = [...cpyIndices].sort((a, b) => b - a);\n\t\t\tconst result     = [];\n\n\t\t\t// Copy the elements (in originally specified order).\n\t\t\tfor (let i = 0, iend = cpyIndices.length; i < iend; ++i) {\n\t\t\t\tresult[i] = this[cpyIndices[i]];\n\t\t\t}\n\n\t\t\t// Delete the elements (in descending numeric order).\n\t\t\tfor (let i = 0, iend = delIndices.length; i < iend; ++i) {\n\t\t\t\tsplice.call(this, delIndices[i], 1);\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\t});\n\n\t/*\n\t\tRemoves and returns all of the elements that pass the test implemented\n\t\tby the given predicate function from the array.\n\t*/\n\tObject.defineProperty(Array.prototype, 'deleteWith', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(predicate, thisArg) {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('Array.prototype.deleteWith called on null or undefined');\n\t\t\t}\n\t\t\tif (typeof predicate !== 'function') {\n\t\t\t\tthrow new Error('Array.prototype.deleteWith predicate parameter must be a function');\n\t\t\t}\n\n\t\t\tconst length = this.length >>> 0;\n\n\t\t\tif (length === 0) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tconst splice  = Array.prototype.splice;\n\t\t\tconst indices = [];\n\t\t\tconst result  = [];\n\n\t\t\t// Copy the elements (in original order).\n\t\t\tfor (let i = 0; i < length; ++i) {\n\t\t\t\tif (predicate.call(thisArg, this[i], i, this)) {\n\t\t\t\t\tresult.push(this[i]);\n\t\t\t\t\tindices.push(i);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Delete the elements (in reverse order).\n\t\t\tfor (let i = indices.length - 1; i >= 0; --i) {\n\t\t\t\tsplice.call(this, indices[i], 1);\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\t});\n\n\t/*\n\t\tReturns the first element from the array.\n\t*/\n\tObject.defineProperty(Array.prototype, 'first', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue() {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('Array.prototype.first called on null or undefined');\n\t\t\t}\n\n\t\t\tconst length = this.length >>> 0;\n\n\t\t\tif (length === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\treturn this[0];\n\t\t}\n\t});\n\n\t/*\n\t\tReturns whether all of the given elements were found within the array.\n\t*/\n\tObject.defineProperty(Array.prototype, 'includesAll', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(/* needles */) {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('Array.prototype.includesAll called on null or undefined');\n\t\t\t}\n\n\t\t\tif (arguments.length === 1) {\n\t\t\t\tif (Array.isArray(arguments[0])) {\n\t\t\t\t\treturn Array.prototype.includesAll.apply(this, arguments[0]);\n\t\t\t\t}\n\n\t\t\t\treturn Array.prototype.includes.apply(this, arguments);\n\t\t\t}\n\n\t\t\tfor (let i = 0, iend = arguments.length; i < iend; ++i) {\n\t\t\t\tif (\n\t\t\t\t\t!Array.prototype.some.call(this, function (val) {\n\t\t\t\t\t\treturn val === this.val || val !== val && this.val !== this.val;\n\t\t\t\t\t}, { val : arguments[i] })\n\t\t\t\t) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\t});\n\n\t/*\n\t\tReturns whether any of the given elements were found within the array.\n\t*/\n\tObject.defineProperty(Array.prototype, 'includesAny', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(/* needles */) {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('Array.prototype.includesAny called on null or undefined');\n\t\t\t}\n\n\t\t\tif (arguments.length === 1) {\n\t\t\t\tif (Array.isArray(arguments[0])) {\n\t\t\t\t\treturn Array.prototype.includesAny.apply(this, arguments[0]);\n\t\t\t\t}\n\n\t\t\t\treturn Array.prototype.includes.apply(this, arguments);\n\t\t\t}\n\n\t\t\tfor (let i = 0, iend = arguments.length; i < iend; ++i) {\n\t\t\t\tif (\n\t\t\t\t\tArray.prototype.some.call(this, function (val) {\n\t\t\t\t\t\treturn val === this.val || val !== val && this.val !== this.val;\n\t\t\t\t\t}, { val : arguments[i] })\n\t\t\t\t) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\t});\n\n\t/*\n\t\tReturns the last element from the array.\n\t*/\n\tObject.defineProperty(Array.prototype, 'last', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue() {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('Array.prototype.last called on null or undefined');\n\t\t\t}\n\n\t\t\tconst length = this.length >>> 0;\n\n\t\t\tif (length === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\treturn this[length - 1];\n\t\t}\n\t});\n\n\t/*\n\t\tRandomly removes an element from the base array and returns it.\n\t*/\n\tObject.defineProperty(Array.prototype, 'pluck', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(useMath) {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('Array.prototype.pluck called on null or undefined');\n\t\t\t}\n\n\t\t\tconst length = this.length >>> 0;\n\n\t\t\tif (length === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst index = _random(0, length - 1, useMath);\n\n\t\t\treturn Array.prototype.splice.call(this, index, 1)[0];\n\t\t}\n\t});\n\n\t/*\n\t\tRandomly removes the given number of unique elements from the base array\n\t\tand returns the removed elements as a new array.\n\t*/\n\tObject.defineProperty(Array.prototype, 'pluckMany', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(wantSize) {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('Array.prototype.pluckMany called on null or undefined');\n\t\t\t}\n\n\t\t\tconst length = this.length >>> 0;\n\n\t\t\tif (length === 0) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tlet want = Math.trunc(wantSize);\n\n\t\t\tif (!Number.isInteger(want)) {\n\t\t\t\tthrow new Error('Array.prototype.pluckMany want parameter must be an integer');\n\t\t\t}\n\n\t\t\tif (want < 1) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tif (want > length) {\n\t\t\t\twant = length;\n\t\t\t}\n\n\t\t\tconst splice = Array.prototype.splice;\n\t\t\tconst result = [];\n\t\t\tlet max = length - 1;\n\n\t\t\tdo {\n\t\t\t\tresult.push(splice.call(this, _random(0, max--), 1)[0]);\n\t\t\t} while (result.length < want);\n\n\t\t\treturn result;\n\t\t}\n\t});\n\n\t/*\n\t\tAppends one or more unique elements to the end of the base array and\n\t\treturns its new length.\n\t*/\n\tObject.defineProperty(Array.prototype, 'pushUnique', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(/* variadic */) {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('Array.prototype.pushUnique called on null or undefined');\n\t\t\t}\n\n\t\t\tconst addSize = arguments.length;\n\n\t\t\tif (addSize === 0) {\n\t\t\t\treturn this.length >>> 0;\n\t\t\t}\n\n\t\t\tconst indexOf = Array.prototype.indexOf;\n\t\t\tconst push    = Array.prototype.push;\n\n\t\t\tfor (let i = 0; i < addSize; ++i) {\n\t\t\t\tconst value = arguments[i];\n\n\t\t\t\tif (indexOf.call(this, value) === -1) {\n\t\t\t\t\tpush.call(this, value);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn this.length >>> 0;\n\t\t}\n\t});\n\n\t/*\n\t\tRandomly selects an element from the base array and returns it.\n\t*/\n\tObject.defineProperty(Array.prototype, 'random', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(useMath) {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('Array.prototype.random called on null or undefined');\n\t\t\t}\n\n\t\t\tconst length = this.length >>> 0;\n\n\t\t\tif (length === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst index = _random(0, length - 1, useMath);\n\n\t\t\treturn this[index];\n\t\t}\n\t});\n\n\t/*\n\t\tRandomly selects the given number of unique elements from the base array\n\t\tand returns the selected elements as a new array.\n\t*/\n\tObject.defineProperty(Array.prototype, 'randomMany', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(wantSize) {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('Array.prototype.randomMany called on null or undefined');\n\t\t\t}\n\n\t\t\tconst length = this.length >>> 0;\n\n\t\t\tif (length === 0) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tlet want = Math.trunc(wantSize);\n\n\t\t\tif (!Number.isInteger(want)) {\n\t\t\t\tthrow new Error('Array.prototype.randomMany want parameter must be an integer');\n\t\t\t}\n\n\t\t\tif (want < 1) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tif (want > length) {\n\t\t\t\twant = length;\n\t\t\t}\n\n\t\t\tconst picked = new Map();\n\t\t\tconst result = [];\n\t\t\tconst max    = length - 1;\n\n\t\t\tdo {\n\t\t\t\tlet i;\n\t\t\t\tdo {\n\t\t\t\t\ti = _random(0, max);\n\t\t\t\t} while (picked.has(i));\n\t\t\t\tpicked.set(i, true);\n\t\t\t\tresult.push(this[i]);\n\t\t\t} while (result.length < want);\n\n\t\t\treturn result;\n\t\t}\n\t});\n\n\t/*\n\t\tRandomly shuffles the array and returns it.\n\t*/\n\tObject.defineProperty(Array.prototype, 'shuffle', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue() {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('Array.prototype.shuffle called on null or undefined');\n\t\t\t}\n\n\t\t\tconst length = this.length >>> 0;\n\n\t\t\tif (length === 0) {\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tfor (let i = length - 1; i > 0; --i) {\n\t\t\t\tconst j = Math.floor(_nativeMathRandom() * (i + 1));\n\n\t\t\t\tif (i === j) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// [this[i], this[j]] = [this[j], this[i]];\n\t\t\t\tconst swap = this[i];\n\t\t\t\tthis[i] = this[j];\n\t\t\t\tthis[j] = swap;\n\t\t\t}\n\n\t\t\treturn this;\n\t\t}\n\t});\n\n\t/*\n\t\tPrepends one or more unique elements to the beginning of the base array\n\t\tand returns its new length.\n\t*/\n\tObject.defineProperty(Array.prototype, 'unshiftUnique', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(/* variadic */) {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('Array.prototype.unshiftUnique called on null or undefined');\n\t\t\t}\n\n\t\t\tconst addSize = arguments.length;\n\n\t\t\tif (addSize === 0) {\n\t\t\t\treturn this.length >>> 0;\n\t\t\t}\n\n\t\t\tconst indexOf = Array.prototype.indexOf;\n\t\t\tconst unshift = Array.prototype.unshift;\n\n\t\t\tfor (let i = 0; i < addSize; ++i) {\n\t\t\t\tconst value = arguments[i];\n\n\t\t\t\tif (indexOf.call(this, value) === -1) {\n\t\t\t\t\tunshift.call(this, value);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn this.length >>> 0;\n\t\t}\n\t});\n\n\t/*\n\t\tReturns a bound function that supplies the given arguments to the base\n\t\tfunction, followed by the arguments are supplied to the bound function,\n\t\twhenever it is called.\n\t*/\n\tObject.defineProperty(Function.prototype, 'partial', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(/* variadic */) {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('Function.prototype.partial called on null or undefined');\n\t\t\t}\n\n\t\t\tconst slice = Array.prototype.slice;\n\t\t\tconst fn    = this;\n\t\t\tconst bound = slice.call(arguments, 0);\n\n\t\t\treturn function () {\n\t\t\t\tconst applied = [];\n\t\t\t\tlet argc = 0;\n\n\t\t\t\tfor (let i = 0; i < bound.length; ++i) {\n\t\t\t\t\tapplied.push(bound[i] === undefined ? arguments[argc++] : bound[i]);\n\t\t\t\t}\n\n\t\t\t\treturn fn.apply(this, applied.concat(slice.call(arguments, argc)));\n\t\t\t};\n\t\t}\n\t});\n\n\t/*\n\t\tReturns the given numerical clamped to the specified bounds.\n\t*/\n\tObject.defineProperty(Math, 'clamp', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(num, min, max) {\n\t\t\tconst value = Number(num);\n\t\t\treturn Number.isNaN(value) ? NaN : value.clamp(min, max);\n\t\t}\n\t});\n\n\t/*\n\t\tReturns a decimal number eased from 0 to 1.\n\n\t\tNOTE: The magnitude of the returned value decreases if num < 0.5 or increases if num > 0.5.\n\t*/\n\tObject.defineProperty(Math, 'easeInOut', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(num) {\n\t\t\treturn 1 - (Math.cos(Number(num) * Math.PI) + 1) / 2;\n\t\t}\n\t});\n\n\t/*\n\t\tReturns the number clamped to the specified bounds.\n\t*/\n\tObject.defineProperty(Number.prototype, 'clamp', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(/* min, max */) {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('Number.prototype.clamp called on null or undefined');\n\t\t\t}\n\n\t\t\tif (arguments.length !== 2) {\n\t\t\t\tthrow new Error('Number.prototype.clamp called with an incorrect number of parameters');\n\t\t\t}\n\n\t\t\tlet min = Number(arguments[0]);\n\t\t\tlet max = Number(arguments[1]);\n\n\t\t\tif (min > max) {\n\t\t\t\t[min, max] = [max, min];\n\t\t\t}\n\n\t\t\treturn Math.min(Math.max(this, min), max);\n\t\t}\n\t});\n\n\t/*\n\t\tReturns a copy of the given string with all RegExp metacharacters escaped.\n\t*/\n\tif (!RegExp.escape) {\n\t\t(() => {\n\t\t\tconst _regExpMetaCharsRe    = /[\\\\^$*+?.()|[\\]{}]/g;\n\t\t\tconst _hasRegExpMetaCharsRe = new RegExp(_regExpMetaCharsRe.source); // to drop the global flag\n\n\t\t\tObject.defineProperty(RegExp, 'escape', {\n\t\t\t\tconfigurable : true,\n\t\t\t\twritable     : true,\n\n\t\t\t\tvalue(str) {\n\t\t\t\t\tconst val = String(str);\n\t\t\t\t\treturn val && _hasRegExpMetaCharsRe.test(val)\n\t\t\t\t\t\t? val.replace(_regExpMetaCharsRe, '\\\\$&')\n\t\t\t\t\t\t: val;\n\t\t\t\t}\n\t\t\t});\n\t\t})();\n\t}\n\n\t/*\n\t\tReturns a formatted string, after replacing each format item in the given\n\t\tformat string with the text equivalent of the corresponding argument's value.\n\t*/\n\t(() => {\n\t\tconst _formatRegExp    = /{(\\d+)(?:,([+-]?\\d+))?}/g;\n\t\tconst _hasFormatRegExp = new RegExp(_formatRegExp.source); // to drop the global flag\n\n\t\tObject.defineProperty(String, 'format', {\n\t\t\tconfigurable : true,\n\t\t\twritable     : true,\n\n\t\t\tvalue(format) {\n\t\t\t\tfunction padString(str, align, pad) {\n\t\t\t\t\tif (!align) {\n\t\t\t\t\t\treturn str;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst plen = Math.abs(align) - str.length;\n\n\t\t\t\t\tif (plen < 1) {\n\t\t\t\t\t\treturn str;\n\t\t\t\t\t}\n\n\t\t\t\t\t// const padding = Array(plen + 1).join(pad);\n\t\t\t\t\tconst padding = String(pad).repeat(plen);\n\t\t\t\t\treturn align < 0 ? str + padding : padding + str;\n\t\t\t\t}\n\n\t\t\t\tif (arguments.length < 2) {\n\t\t\t\t\treturn arguments.length === 0 ? '' : format;\n\t\t\t\t}\n\n\t\t\t\tconst args = arguments.length === 2 && Array.isArray(arguments[1])\n\t\t\t\t\t? [...arguments[1]]\n\t\t\t\t\t: Array.prototype.slice.call(arguments, 1);\n\n\t\t\t\tif (args.length === 0) {\n\t\t\t\t\treturn format;\n\t\t\t\t}\n\n\t\t\t\tif (!_hasFormatRegExp.test(format)) {\n\t\t\t\t\treturn format;\n\t\t\t\t}\n\n\t\t\t\t// Possibly required by some old buggy browsers.\n\t\t\t\t_formatRegExp.lastIndex = 0;\n\n\t\t\t\treturn format.replace(_formatRegExp, (match, index, align) => {\n\t\t\t\t\tlet retval = args[index];\n\n\t\t\t\t\tif (retval == null) { // lazy equality for null\n\t\t\t\t\t\treturn '';\n\t\t\t\t\t}\n\n\t\t\t\t\twhile (typeof retval === 'function') {\n\t\t\t\t\t\tretval = retval();\n\t\t\t\t\t}\n\n\t\t\t\t\tswitch (typeof retval) {\n\t\t\t\t\tcase 'string': /* no-op */ break;\n\t\t\t\t\tcase 'object': retval = JSON.stringify(retval); break;\n\t\t\t\t\tdefault:       retval = String(retval); break;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn padString(retval, !align ? 0 : Number.parseInt(align, 10), ' ');\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t})();\n\n\t/*\n\t\tReturns whether the given string was found within the string.\n\t*/\n\tObject.defineProperty(String.prototype, 'contains', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(/* needle [, fromIndex] */) {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('String.prototype.contains called on null or undefined');\n\t\t\t}\n\n\t\t\treturn String.prototype.indexOf.apply(this, arguments) !== -1;\n\t\t}\n\t});\n\n\t/*\n\t\tReturns the number of times the given substring was found within the string.\n\t*/\n\tObject.defineProperty(String.prototype, 'count', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(/* needle [, fromIndex ] */) {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('String.prototype.count called on null or undefined');\n\t\t\t}\n\n\t\t\tconst needle = String(arguments[0] || '');\n\n\t\t\tif (needle === '') {\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t\tconst indexOf = String.prototype.indexOf;\n\t\t\tconst step    = needle.length;\n\t\t\tlet pos     = Number(arguments[1]) || 0;\n\t\t\tlet count   = 0;\n\n\t\t\twhile ((pos = indexOf.call(this, needle, pos)) !== -1) {\n\t\t\t\t++count;\n\t\t\t\tpos += step;\n\t\t\t}\n\n\t\t\treturn count;\n\t\t}\n\t});\n\n\t/*\n\t\tReturns the first Unicode code point from the string.\n\t*/\n\tObject.defineProperty(String.prototype, 'first', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue() {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('String.prototype.first called on null or undefined');\n\t\t\t}\n\n\t\t\t// Required as `this` could be a `String` object or come from a `call()` or `apply()`.\n\t\t\tconst str = String(this);\n\n\t\t\t// Get the first code point—may be one or two code units—and its end position.\n\t\t\tconst { char } = _getCodePointStartAndEnd(str, 0);\n\n\t\t\treturn char;\n\t\t}\n\t});\n\n\t/*\n\t\tReturns the last Unicode code point from the string.\n\t*/\n\tObject.defineProperty(String.prototype, 'last', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue() {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('String.prototype.last called on null or undefined');\n\t\t\t}\n\n\t\t\t// Required as `this` could be a `String` object or come from a `call()` or `apply()`.\n\t\t\tconst str = String(this);\n\n\t\t\t// Get the last code point—may be one or two code units—and its end position.\n\t\t\tconst { char } = _getCodePointStartAndEnd(str, str.length - 1);\n\n\t\t\treturn char;\n\t\t}\n\t});\n\n\t/*\n\t\tReturns a copy of the base string with `delCount` characters replaced with\n\t\t`replacement`, starting at `startAt`.\n\t*/\n\tObject.defineProperty(String.prototype, 'splice', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(startAt, delCount, replacement) {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('String.prototype.splice called on null or undefined');\n\t\t\t}\n\n\t\t\tconst length = this.length >>> 0;\n\n\t\t\tif (length === 0) {\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\tlet start = Number(startAt);\n\n\t\t\tif (!Number.isSafeInteger(start)) {\n\t\t\t\tstart = 0;\n\t\t\t}\n\t\t\telse if (start < 0) {\n\t\t\t\tstart += length;\n\n\t\t\t\tif (start < 0) {\n\t\t\t\t\tstart = 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (start > length) {\n\t\t\t\tstart = length;\n\t\t\t}\n\n\t\t\tlet count = Number(delCount);\n\n\t\t\tif (!Number.isSafeInteger(count) || count < 0) {\n\t\t\t\tcount = 0;\n\t\t\t}\n\n\t\t\tlet res = this.slice(0, start);\n\n\t\t\tif (typeof replacement !== 'undefined') {\n\t\t\t\tres += replacement;\n\t\t\t}\n\n\t\t\tif (start + count < length) {\n\t\t\t\tres += this.slice(start + count);\n\t\t\t}\n\n\t\t\treturn res;\n\t\t}\n\t});\n\n\t/*\n\t\tReturns an array of strings, split from the string, or an empty array if the\n\t\tstring is empty.\n\t*/\n\tObject.defineProperty(String.prototype, 'splitOrEmpty', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(/* [ separator [, limit ]] */) {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('String.prototype.splitOrEmpty called on null or undefined');\n\t\t\t}\n\n\t\t\t// Required as `this` could be a `String` object or come from a `call()` or `apply()`.\n\t\t\tif (String(this) === '') {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\treturn String.prototype.split.apply(this, arguments);\n\t\t}\n\t});\n\n\t/*\n\t\tReturns a copy of the base string with the first Unicode code point uppercased,\n\t\taccording to any locale-specific rules.\n\t*/\n\tObject.defineProperty(String.prototype, 'toLocaleUpperFirst', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue() {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('String.prototype.toLocaleUpperFirst called on null or undefined');\n\t\t\t}\n\n\t\t\t// Required as `this` could be a `String` object or come from a `call()` or `apply()`.\n\t\t\tconst str = String(this);\n\n\t\t\t// Get the first code point—may be one or two code units—and its end position.\n\t\t\tconst { char, end } = _getCodePointStartAndEnd(str, 0);\n\n\t\t\treturn end === -1 ? '' : char.toLocaleUpperCase() + str.slice(end + 1);\n\t\t}\n\t});\n\n\t/*\n\t\tReturns a copy of the base string with the first Unicode code point uppercased.\n\t*/\n\tObject.defineProperty(String.prototype, 'toUpperFirst', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue() {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('String.prototype.toUpperFirst called on null or undefined');\n\t\t\t}\n\n\t\t\t// Required as `this` could be a `String` object or come from a `call()` or `apply()`.\n\t\t\tconst str = String(this);\n\n\t\t\t// Get the first code point—may be one or two code units—and its end position.\n\t\t\tconst { char, end } = _getCodePointStartAndEnd(str, 0);\n\n\t\t\treturn end === -1 ? '' : char.toUpperCase() + str.slice(end + 1);\n\t\t}\n\t});\n\n\n\t/*******************************************************************************************************************\n\t\tExtensions, JSON.\n\t*******************************************************************************************************************/\n\t/*\n\t\tDefine `toJSON()` methods on each prototype we wish to support.\n\t*/\n\tObject.defineProperty(Date.prototype, 'toJSON', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue() {\n\t\t\treturn ['(revive:date)', this.toISOString()];\n\t\t}\n\t});\n\tObject.defineProperty(Function.prototype, 'toJSON', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue() {\n\t\t\t/*\n\t\t\t\tThe enclosing parenthesis here are necessary to force the function expression code\n\t\t\t\tstring, returned by `this.toString()`, to be evaluated as an expression during\n\t\t\t\trevival.  Without them, the function expression, which is likely nameless, will be\n\t\t\t\tevaluated as a function definition—which will throw a syntax error exception, since\n\t\t\t\tfunction definitions must have a name.\n\t\t\t*/\n\t\t\treturn ['(revive:eval)', `(${this.toString()})`];\n\t\t}\n\t});\n\tObject.defineProperty(Map.prototype, 'toJSON', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue() {\n\t\t\treturn ['(revive:map)', [...this]];\n\t\t}\n\t});\n\tObject.defineProperty(RegExp.prototype, 'toJSON', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue() {\n\t\t\treturn ['(revive:eval)', this.toString()];\n\t\t}\n\t});\n\tObject.defineProperty(Set.prototype, 'toJSON', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue() {\n\t\t\treturn ['(revive:set)', [...this]];\n\t\t}\n\t});\n\n\t/*\n\t\tUtility method to allow users to easily wrap their code in the revive wrapper.\n\t*/\n\tObject.defineProperty(JSON, 'reviveWrapper', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(code, data) {\n\t\t\tif (typeof code !== 'string') {\n\t\t\t\tthrow new TypeError('JSON.reviveWrapper code parameter must be a string');\n\t\t\t}\n\n\t\t\treturn ['(revive:eval)', [code, data]];\n\t\t}\n\t});\n\n\t/*\n\t\tBackup the original `JSON.stringify()` and replace it with a revive wrapper aware version.\n\t*/\n\tObject.defineProperty(JSON, '_real_stringify', {\n\t\tvalue : JSON.stringify\n\t});\n\tObject.defineProperty(JSON, 'stringify', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(value, replacer, space) {\n\t\t\treturn JSON._real_stringify(value, (key, val) => {\n\t\t\t\tlet value = val;\n\n\t\t\t\t/*\n\t\t\t\t\tCall the custom replacer, if specified.\n\t\t\t\t*/\n\t\t\t\tif (typeof replacer === 'function') {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvalue = replacer(key, value);\n\t\t\t\t\t}\n\t\t\t\t\tcatch (ex) { /* no-op; although, perhaps, it would be better to throw an error here */ }\n\t\t\t\t}\n\n\t\t\t\t/*\n\t\t\t\t\tAttempt to replace values.\n\t\t\t\t*/\n\t\t\t\tif (typeof value === 'undefined') value = ['(revive:eval)', 'undefined'];\n\t\t\t\telse if (value === Infinity) value = ['(revive:eval)', 'Infinity'];\n\t\t\t\telse if (value === -Infinity) value = ['(revive:eval)', '-Infinity'];\n\t\t\t\telse if (Number.isNaN(value)) value = ['(revive:eval)', 'NaN'];\n\n\t\t\t\treturn value;\n\t\t\t}, space);\n\t\t}\n\t});\n\n\t/*\n\t\tBackup the original `JSON.parse()` and replace it with a revive wrapper aware version.\n\t*/\n\tObject.defineProperty(JSON, '_real_parse', {\n\t\tvalue : JSON.parse\n\t});\n\tObject.defineProperty(JSON, 'parse', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(text, reviver) {\n\t\t\treturn JSON._real_parse(text, (key, val) => {\n\t\t\t\tlet value = val;\n\n\t\t\t\t/*\n\t\t\t\t\tAttempt to revive wrapped values.\n\t\t\t\t*/\n\t\t\t\tif (Array.isArray(value) && value.length === 2) {\n\t\t\t\t\tswitch (value[0]) {\n\t\t\t\t\tcase '(revive:set)':\n\t\t\t\t\t\tvalue = new Set(value[1]);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase '(revive:map)':\n\t\t\t\t\t\tvalue = new Map(value[1]);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase '(revive:date)':\n\t\t\t\t\t\tvalue = new Date(value[1]);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase '(revive:eval)':\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t/* eslint-disable no-eval */\n\t\t\t\t\t\t\t// For post-v2.9.0 `JSON.reviveWrapper()`.\n\t\t\t\t\t\t\tif (Array.isArray(value[1])) {\n\t\t\t\t\t\t\t\tconst $ReviveData$ = value[1][1]; // eslint-disable-line no-unused-vars\n\t\t\t\t\t\t\t\tvalue = eval(value[1][0]);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// For regular expressions, functions, and pre-v2.9.0 `JSON.reviveWrapper()`.\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvalue = eval(value[1]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/* eslint-enable no-eval */\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (ex) { /* no-op; although, perhaps, it would be better to throw an error here */ }\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t/* legacy */\n\t\t\t\telse if (typeof value === 'string' && value.slice(0, 10) === '@@revive@@') {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvalue = eval(value.slice(10)); // eslint-disable-line no-eval\n\t\t\t\t\t}\n\t\t\t\t\tcatch (ex) { /* no-op; although, perhaps, it would be better to throw an error here */ }\n\t\t\t\t}\n\t\t\t\t/* /legacy */\n\n\t\t\t\t/*\n\t\t\t\t\tCall the custom reviver, if specified.\n\t\t\t\t*/\n\t\t\t\tif (typeof reviver === 'function') {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvalue = reviver(key, value);\n\t\t\t\t\t}\n\t\t\t\t\tcatch (ex) { /* no-op; although, perhaps, it would be better to throw an error here */ }\n\t\t\t\t}\n\n\t\t\t\treturn value;\n\t\t\t});\n\t\t}\n\t});\n\n\n\t/*******************************************************************************************************************\n\t\tExtensions, Deprecated.\n\t*******************************************************************************************************************/\n\t/*\n\t\t[DEPRECATED] Returns whether the given element was found within the array.\n\t*/\n\tObject.defineProperty(Array.prototype, 'contains', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(/* needle [, fromIndex] */) {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('Array.prototype.contains called on null or undefined');\n\t\t\t}\n\n\t\t\treturn Array.prototype.includes.apply(this, arguments);\n\t\t}\n\t});\n\n\t/*\n\t\t[DEPRECATED] Returns whether all of the given elements were found within the array.\n\t*/\n\tObject.defineProperty(Array.prototype, 'containsAll', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(/* needle [, fromIndex] */) {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('Array.prototype.containsAll called on null or undefined');\n\t\t\t}\n\n\t\t\treturn Array.prototype.includesAll.apply(this, arguments);\n\t\t}\n\t});\n\n\t/*\n\t\t[DEPRECATED] Returns whether any of the given elements were found within the array.\n\t*/\n\tObject.defineProperty(Array.prototype, 'containsAny', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue(/* needle [, fromIndex] */) {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('Array.prototype.containsAny called on null or undefined');\n\t\t\t}\n\n\t\t\treturn Array.prototype.includesAny.apply(this, arguments);\n\t\t}\n\t});\n\n\t/*\n\t\t[DEPRECATED] Returns a new array consisting of the flattened source array.\n\t*/\n\tObject.defineProperty(Array.prototype, 'flatten', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue() {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('Array.prototype.flatten called on null or undefined');\n\t\t\t}\n\n\t\t\treturn Array.prototype.flat.call(this, Infinity);\n\t\t}\n\t});\n\n\t/*\n\t\t[DEPRECATED] Returns an array of link titles, parsed from the string.\n\n\t\tNOTE: Unused in SugarCube, only included for compatibility.\n\t*/\n\tObject.defineProperty(String.prototype, 'readBracketedList', {\n\t\tconfigurable : true,\n\t\twritable     : true,\n\n\t\tvalue() {\n\t\t\tif (this == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('String.prototype.readBracketedList called on null or undefined');\n\t\t\t}\n\n\t\t\t// RegExp groups: Double-square-bracket quoted | Unquoted.\n\t\t\tconst re    = new RegExp('(?:\\\\[\\\\[((?:\\\\s|\\\\S)*?)\\\\]\\\\])|([^\"\\'\\\\s]\\\\S*)', 'gm');\n\t\t\tconst names = [];\n\t\t\tlet match;\n\n\t\t\twhile ((match = re.exec(this)) !== null) {\n\t\t\t\tif (match[1]) { // double-square-bracket quoted\n\t\t\t\t\tnames.push(match[1]);\n\t\t\t\t}\n\t\t\t\telse if (match[2]) { // unquoted\n\t\t\t\t\tnames.push(match[2]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn names;\n\t\t}\n\t});\n})();\n\n/***********************************************************************************************************************\n\n\tlib/browser.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\nvar Browser = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\t/* eslint-disable max-len */\n\tconst userAgent = navigator.userAgent.toLowerCase();\n\n\tconst winPhone = userAgent.includes('windows phone');\n\tconst isMobile = Object.freeze({\n\t\tAndroid    : !winPhone && userAgent.includes('android'),\n\t\tBlackBerry : /blackberry|bb10/.test(userAgent),\n\t\tiOS        : !winPhone && /ip(?:hone|ad|od)/.test(userAgent),\n\t\tOpera      : !winPhone && (typeof window.operamini === 'object' || userAgent.includes('opera mini')),\n\t\tWindows    : winPhone || /iemobile|wpdesktop/.test(userAgent),\n\n\t\tany() {\n\t\t\treturn isMobile.Android || isMobile.BlackBerry || isMobile.iOS || isMobile.Opera || isMobile.Windows;\n\t\t}\n\t});\n\n\tconst isGecko = !isMobile.Windows && !/khtml|trident|edge/.test(userAgent) && userAgent.includes('gecko');\n\n\tconst isIE      = !userAgent.includes('opera') && /msie|trident/.test(userAgent);\n\tconst ieVersion = isIE\n\t\t? (() => {\n\t\t\tconst ver = /(?:msie\\s+|rv:)(\\d+\\.\\d)/.exec(userAgent);\n\t\t\treturn ver ? Number(ver[1]) : 0;\n\t\t})()\n\t\t: null;\n\n\t// opera <= 12: \"opera/9.80 (windows nt 6.1; wow64) presto/2.12.388 version/12.16\"\n\t// opera >= 15: \"mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.36 (khtml, like gecko) chrome/28.0.1500.52 safari/537.36 opr/15.0.1147.130\"\n\tconst isOpera      = userAgent.includes('opera') || userAgent.includes(' opr/');\n\tconst operaVersion = isOpera\n\t\t? (() => {\n\t\t\tconst re  = new RegExp(`${/khtml|chrome/.test(userAgent) ? 'opr' : 'version'}\\\\/(\\\\d+\\\\.\\\\d+)`);\n\t\t\tconst ver = re.exec(userAgent);\n\t\t\treturn ver ? Number(ver[1]) : 0;\n\t\t})()\n\t\t: null;\n\n\tconst isVivaldi = userAgent.includes('vivaldi');\n\t/* eslint-enable max-len */\n\n\t// Module Exports.\n\treturn Object.freeze({\n\t\tuserAgent,\n\t\tisMobile,\n\t\tisGecko,\n\t\tisIE,\n\t\tieVersion,\n\t\tisOpera,\n\t\toperaVersion,\n\t\tisVivaldi\n\t});\n})();\n\n/***********************************************************************************************************************\n\n\tlib/has.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/* global Browser */\n\nvar Has = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\t/*\n\t\tNOTE: The aggressive try/catch feature tests are necessitated by implementation\n\t\tbugs in various browsers.\n\t*/\n\n\t// Is the `HTMLAudioElement` API available?\n\tconst hasAudioElement = (() => {\n\t\ttry {\n\t\t\treturn typeof document.createElement('audio').canPlayType === 'function';\n\t\t}\n\t\tcatch (ex) { /* no-op */ }\n\n\t\treturn false;\n\t})();\n\n\t// Is the `File` API available?\n\tconst hasFile = (() => {\n\t\ttry {\n\t\t\treturn 'Blob' in window &&\n\t\t\t\t'File' in window &&\n\t\t\t\t'FileList' in window &&\n\t\t\t\t'FileReader' in window &&\n\t\t\t\t(!Browser.isOpera || Browser.operaVersion >= 15);\n\t\t}\n\t\tcatch (ex) { /* no-op */ }\n\n\t\treturn false;\n\t})();\n\n\t// Is the `geolocation` API available?\n\tconst hasGeolocation = (() => {\n\t\ttry {\n\t\t\treturn 'geolocation' in navigator &&\n\t\t\t\ttypeof navigator.geolocation.getCurrentPosition === 'function' &&\n\t\t\t\ttypeof navigator.geolocation.watchPosition === 'function';\n\t\t}\n\t\tcatch (ex) { /* no-op */ }\n\n\t\treturn false;\n\t})();\n\n\t// Is the `MutationObserver` API available?\n\tconst hasMutationObserver = (() => {\n\t\ttry {\n\t\t\treturn 'MutationObserver' in window &&\n\t\t\t\ttypeof window.MutationObserver === 'function';\n\t\t}\n\t\tcatch (ex) { /* no-op */ }\n\n\t\treturn false;\n\t})();\n\n\t// Is the `performance` API available?\n\tconst hasPerformance = (() => {\n\t\ttry {\n\t\t\treturn 'performance' in window &&\n\t\t\t\ttypeof window.performance.now === 'function';\n\t\t}\n\t\tcatch (ex) { /* no-op */ }\n\n\t\treturn false;\n\t})();\n\n\t// Is the platform a touch device?\n\tconst hasTouch = (() => {\n\t\ttry {\n\t\t\treturn 'ontouchstart' in window ||\n\t\t\t\t!!window.DocumentTouch &&\n\t\t\t\tdocument instanceof window.DocumentTouch ||\n\t\t\t\t!!navigator.maxTouchPoints ||\n\t\t\t\t!!navigator.msMaxTouchPoints;\n\t\t}\n\t\tcatch (ex) { /* no-op */ }\n\n\t\treturn false;\n\t})();\n\n\t// Is the transition end event available and by what name?\n\tconst hasTransitionEndEvent = (() => {\n\t\ttry {\n\t\t\tconst teMap = new Map([\n\t\t\t\t['transition',       'transitionend'],\n\t\t\t\t['MSTransition',     'msTransitionEnd'],\n\t\t\t\t['WebkitTransition', 'webkitTransitionEnd'],\n\t\t\t\t['MozTransition',    'transitionend']\n\t\t\t]);\n\t\t\tconst teKeys = [...teMap.keys()];\n\t\t\tconst el     = document.createElement('div');\n\n\t\t\tfor (let i = 0; i < teKeys.length; ++i) {\n\t\t\t\tif (el.style[teKeys[i]] !== undefined) {\n\t\t\t\t\treturn teMap.get(teKeys[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcatch (ex) { /* no-op */ }\n\n\t\treturn false;\n\t})();\n\n\t// Module Exports.\n\treturn Object.freeze({\n\t\taudio              : hasAudioElement,\n\t\tfileAPI            : hasFile,\n\t\tgeolocation        : hasGeolocation,\n\t\tmutationObserver   : hasMutationObserver,\n\t\tperformance        : hasPerformance,\n\t\ttouch              : hasTouch,\n\t\ttransitionEndEvent : hasTransitionEndEvent\n\t});\n})();\n\n/***********************************************************************************************************************\n\n\tlib/visibility.js\n\n\tCopyright © 2018–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\nvar Visibility = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\t/*\n\t\tThere are two versions of the Page Visibility API: First Edition and, the current,\n\t\tSecond Edition (i.e. \"Level 2\").  First Edition is mentioned here only because some\n\t\tolder browsers implement it, rather than the current specification.\n\n\t\tSEE:\n\t\t\tSecond Edition : https://www.w3.org/TR/page-visibility/\n\t\t\tFirst Edition  : https://www.w3.org/TR/2013/REC-page-visibility-20130514/\n\n\t\tNOTE: Generally, all supported browsers change the visibility state when either switching tabs\n\t\twithin the browser or minimizing the browser window.  Exceptions are noted below:\n\t\t\t* IE 9 doesn't support either version of the Page Visibility API.\n\t\t\t* Opera 12 (Presto) doesn't change the visibility state when the browser is minimized.\n\t*/\n\n\t// Vendor properties object.\n\tconst vendor = (() => {\n\t\ttry {\n\t\t\treturn Object.freeze([\n\t\t\t\t// Specification.\n\t\t\t\t{\n\t\t\t\t\thiddenProperty : 'hidden',          // boolean; historical in 2nd edition\n\t\t\t\t\tstateProperty  : 'visibilityState', // string, values: 'hidden', 'visible'; 1st edition had more values\n\t\t\t\t\tchangeEvent    : 'visibilitychange'\n\t\t\t\t},\n\n\t\t\t\t// `webkit` prefixed: old Blink & WebKit.\n\t\t\t\t{\n\t\t\t\t\thiddenProperty : 'webkitHidden',\n\t\t\t\t\tstateProperty  : 'webkitVisibilityState',\n\t\t\t\t\tchangeEvent    : 'webkitvisibilitychange'\n\t\t\t\t},\n\n\t\t\t\t// `moz` prefixed: old Gecko, maybe Seamonkey.\n\t\t\t\t{\n\t\t\t\t\thiddenProperty : 'mozHidden',\n\t\t\t\t\tstateProperty  : 'mozVisibilityState',\n\t\t\t\t\tchangeEvent    : 'mozvisibilitychange'\n\t\t\t\t},\n\n\t\t\t\t// `ms` prefixed: IE 10.\n\t\t\t\t{\n\t\t\t\t\thiddenProperty : 'msHidden',\n\t\t\t\t\tstateProperty  : 'msVisibilityState',\n\t\t\t\t\tchangeEvent    : 'msvisibilitychange'\n\t\t\t\t}\n\t\t\t].find(vnd => vnd.hiddenProperty in document));\n\t\t}\n\t\tcatch (ex) { /* no-op */ }\n\n\t\treturn undefined;\n\t})();\n\n\n\t/*******************************************************************************\n\t\tAPI Functions.\n\t*******************************************************************************/\n\n\tfunction getVendor() {\n\t\treturn vendor;\n\t}\n\n\tfunction getVisibility() {\n\t\treturn vendor && document[vendor.stateProperty] || 'visible';\n\t}\n\n\tfunction isEnabled() {\n\t\treturn Boolean(vendor);\n\t}\n\n\tfunction isHidden() {\n\t\t// return Boolean(vendor && document[vendor.stateProperty] === 'hidden');\n\t\treturn Boolean(vendor && document[vendor.hiddenProperty]); // NOTE: Historical, but probably better for 1st edition.\n\t}\n\n\n\t/*******************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************/\n\n\treturn Object.freeze(Object.defineProperties({}, {\n\t\t// Functions.\n\t\tvendor    : { get : getVendor },\n\t\tstate     : { get : getVisibility },\n\t\tisEnabled : { value : isEnabled },\n\t\tisHidden  : { value : isHidden },\n\n\t\t// Properties.\n\t\thiddenProperty : { value : vendor && vendor.hiddenProperty },\n\t\tstateProperty  : { value : vendor && vendor.stateProperty },\n\t\tchangeEvent    : { value : vendor && vendor.changeEvent }\n\t}));\n})();\n\n/***********************************************************************************************************************\n\n\tlib/fullscreen.js\n\n\tCopyright © 2018–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/* global Browser */\n\nvar Fullscreen = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\t/*\n\t\tSEE:\n\t\t\thttps://fullscreen.spec.whatwg.org\n\t\t\thttps://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API\n\t*/\n\n\t// Vendor properties object.\n\tconst vendor = (() => {\n\t\ttry {\n\t\t\treturn Object.freeze([\n\t\t\t\t// Specification.\n\t\t\t\t{\n\t\t\t\t\tisEnabled   : 'fullscreenEnabled',\n\t\t\t\t\telement     : 'fullscreenElement',\n\t\t\t\t\trequestFn   : 'requestFullscreen',\n\t\t\t\t\texitFn      : 'exitFullscreen',\n\t\t\t\t\tchangeEvent : 'fullscreenchange', // prop: onfullscreenchange\n\t\t\t\t\terrorEvent  : 'fullscreenerror'   // prop: onfullscreenerror\n\t\t\t\t},\n\n\t\t\t\t// `webkit` prefixed: old Blink, WebKit, & Edge.\n\t\t\t\t{\n\t\t\t\t\tisEnabled   : 'webkitFullscreenEnabled',\n\t\t\t\t\telement     : 'webkitFullscreenElement',\n\t\t\t\t\trequestFn   : 'webkitRequestFullscreen',\n\t\t\t\t\texitFn      : 'webkitExitFullscreen',\n\t\t\t\t\tchangeEvent : 'webkitfullscreenchange',\n\t\t\t\t\terrorEvent  : 'webkitfullscreenerror'\n\t\t\t\t},\n\n\t\t\t\t// `moz` prefixed: old Gecko, maybe Seamonkey.\n\t\t\t\t{\n\t\t\t\t\tisEnabled   : 'mozFullScreenEnabled',\n\t\t\t\t\telement     : 'mozFullScreenElement',\n\t\t\t\t\trequestFn   : 'mozRequestFullScreen',\n\t\t\t\t\texitFn      : 'mozCancelFullScreen',\n\t\t\t\t\tchangeEvent : 'mozfullscreenchange',\n\t\t\t\t\terrorEvent  : 'mozfullscreenerror'\n\t\t\t\t},\n\n\t\t\t\t// `ms` prefixed: IE 11.\n\t\t\t\t{\n\t\t\t\t\tisEnabled   : 'msFullscreenEnabled',\n\t\t\t\t\telement     : 'msFullscreenElement',\n\t\t\t\t\trequestFn   : 'msRequestFullscreen',\n\t\t\t\t\texitFn      : 'msExitFullscreen',\n\t\t\t\t\tchangeEvent : 'MSFullscreenChange',\n\t\t\t\t\terrorEvent  : 'MSFullscreenError'\n\t\t\t\t}\n\t\t\t].find(vnd => vnd.isEnabled in document));\n\t\t}\n\t\tcatch (ex) { /* no-op */ }\n\n\t\treturn undefined;\n\t})();\n\n\n\t/*******************************************************************************\n\t\tFeature Detection Functions.\n\t*******************************************************************************/\n\n\t// Return whether the request and exit fullscreen methods return a `Promise`.\n\t//\n\t// NOTE: The initial result is cached for future calls.\n\tconst _returnsPromise = (function () {\n\t\t// Cache of whether the request and exit methods return a `Promise`.\n\t\tlet _hasPromise = null;\n\n\t\tfunction _returnsPromise() {\n\t\t\tif (_hasPromise !== null) {\n\t\t\t\treturn _hasPromise;\n\t\t\t}\n\n\t\t\t_hasPromise = false;\n\n\t\t\tif (vendor) {\n\t\t\t\ttry {\n\t\t\t\t\tconst value = document.exitFullscreen();\n\n\t\t\t\t\t// Silence \"Uncaught (in promise)\" console errors from Blink.\n\t\t\t\t\t//\n\t\t\t\t\t// NOTE: Swallowing errors is generally bad, but in this case we know there's\n\t\t\t\t\t// going to be an error regardless, since we shouldn't be in fullscreen yet,\n\t\t\t\t\t// and we don't actually care about the error, since we just want the return\n\t\t\t\t\t// value, so we consign it to the bit bucket.\n\t\t\t\t\t//\n\t\t\t\t\t// NOTE: We don't ensure that the return value is not `undefined` here because\n\t\t\t\t\t// having the attempted call to `<Promise>.catch()` on an `undefined` value throw\n\t\t\t\t\t// is acceptable, since it will be caught and `false` eventually returned.\n\t\t\t\t\tvalue.catch(() => { /* no-op */ });\n\n\t\t\t\t\t_hasPromise = value instanceof Promise;\n\t\t\t\t}\n\t\t\t\tcatch (ex) { /* no-op */ }\n\t\t\t}\n\n\t\t\treturn _hasPromise;\n\t\t}\n\n\t\treturn _returnsPromise;\n\t})();\n\n\n\t/*******************************************************************************\n\t\tUtility Functions.\n\t*******************************************************************************/\n\n\tfunction _selectElement(requestedEl) {\n\t\tlet selectedEl = requestedEl || document.documentElement;\n\n\t\t// Document element scrolling workaround for older browsers.\n\t\tif (\n\t\t\t   selectedEl === document.documentElement\n\t\t\t&& (\n\t\t\t\t   vendor.requestFn === 'msRequestFullscreen'   // IE 11\n\t\t\t\t|| Browser.isOpera && Browser.operaVersion < 15 // Opera 12 (Presto)\n\t\t\t)\n\t\t) {\n\t\t\tselectedEl = document.body;\n\t\t}\n\n\t\treturn selectedEl;\n\t}\n\n\n\t/*******************************************************************************\n\t\tAPI Functions.\n\t*******************************************************************************/\n\n\tfunction getVendor() {\n\t\treturn vendor;\n\t}\n\n\tfunction getElement() {\n\t\treturn (vendor || null) && document[vendor.element];\n\t}\n\n\tfunction isEnabled() {\n\t\treturn Boolean(vendor && document[vendor.isEnabled]);\n\t}\n\n\tfunction isFullscreen() {\n\t\treturn Boolean(vendor && document[vendor.element]);\n\t}\n\n\tfunction requestFullscreen(options, requestedEl) {\n\t\tif (!vendor) {\n\t\t\treturn Promise.reject(new Error('fullscreen not supported'));\n\t\t}\n\n\t\tconst element = _selectElement(requestedEl);\n\n\t\tif (typeof element[vendor.requestFn] !== 'function') {\n\t\t\treturn Promise.reject(new Error('fullscreen not supported'));\n\t\t}\n\t\tif (isFullscreen()) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\n\t\tif (_returnsPromise()) {\n\t\t\treturn element[vendor.requestFn](options);\n\t\t}\n\t\telse { // eslint-disable-line no-else-return\n\t\t\tconst namespace = '.Fullscreen_requestFullscreen';\n\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tjQuery(element)\n\t\t\t\t\t.off(namespace)\n\t\t\t\t\t.one(`${vendor.errorEvent}${namespace} ${vendor.changeEvent}${namespace}`, ev => {\n\t\t\t\t\t\tjQuery(this).off(namespace);\n\n\t\t\t\t\t\tif (ev.type === vendor.errorEvent) {\n\t\t\t\t\t\t\treject(new Error('unknown fullscreen request error'));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\telement[vendor.requestFn](options);\n\t\t\t});\n\t\t}\n\t}\n\n\tfunction exitFullscreen() {\n\t\tif (!vendor || typeof document[vendor.exitFn] !== 'function') {\n\t\t\treturn Promise.reject(new TypeError('fullscreen not supported'));\n\t\t}\n\t\tif (!isFullscreen()) {\n\t\t\treturn Promise.reject(new TypeError('fullscreen mode not active'));\n\t\t}\n\n\t\tif (_returnsPromise()) {\n\t\t\treturn document[vendor.exitFn]();\n\t\t}\n\t\telse { // eslint-disable-line no-else-return\n\t\t\tconst namespace = '.Fullscreen_exitFullscreen';\n\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tjQuery(document)\n\t\t\t\t\t.off(namespace)\n\t\t\t\t\t.one(`${vendor.errorEvent}${namespace} ${vendor.changeEvent}${namespace}`, ev => {\n\t\t\t\t\t\tjQuery(this).off(namespace);\n\n\t\t\t\t\t\tif (ev.type === vendor.errorEvent) {\n\t\t\t\t\t\t\treject(new Error('unknown fullscreen exit error'));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\tdocument[vendor.exitFn]();\n\t\t\t});\n\t\t}\n\t}\n\n\tfunction toggleFullscreen(options, requestedEl) {\n\t\treturn isFullscreen() ? exitFullscreen() : requestFullscreen(options, requestedEl);\n\t}\n\n\tfunction onChange(handlerFn, requestedEl) {\n\t\tif (!vendor) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst element = _selectElement(requestedEl);\n\n\t\t$(element).on(vendor.changeEvent, handlerFn);\n\t}\n\n\tfunction offChange(handlerFn, requestedEl) {\n\t\tif (!vendor) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst element = _selectElement(requestedEl);\n\n\t\tif (handlerFn) {\n\t\t\t$(element).off(vendor.changeEvent, handlerFn);\n\t\t}\n\t\telse {\n\t\t\t$(element).off(vendor.changeEvent);\n\t\t}\n\t}\n\n\tfunction onError(handlerFn, requestedEl) {\n\t\tif (!vendor) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst element = _selectElement(requestedEl);\n\n\t\t$(element).on(vendor.errorEvent, handlerFn);\n\t}\n\n\tfunction offError(handlerFn, requestedEl) {\n\t\tif (!vendor) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst element = _selectElement(requestedEl);\n\n\t\tif (handlerFn) {\n\t\t\t$(element).off(vendor.errorEvent, handlerFn);\n\t\t}\n\t\telse {\n\t\t\t$(element).off(vendor.errorEvent);\n\t\t}\n\t}\n\n\n\t/*******************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************/\n\n\treturn Object.freeze(Object.defineProperties({}, {\n\t\tvendor       : { get : getVendor },\n\t\telement      : { get : getElement },\n\t\tisEnabled    : { value : isEnabled },\n\t\tisFullscreen : { value : isFullscreen },\n\t\trequest      : { value : requestFullscreen },\n\t\texit         : { value : exitFullscreen },\n\t\ttoggle       : { value : toggleFullscreen },\n\t\tonChange     : { value : onChange },\n\t\toffChange    : { value : offChange },\n\t\tonError      : { value : onError },\n\t\toffError     : { value : offError }\n\t}));\n})();\n\n/***********************************************************************************************************************\n\n\tlib/helpers.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/* global Config, L10n, State, Story, Util, Wikifier */\n\nvar { // eslint-disable-line no-var\n\t/* eslint-disable no-unused-vars */\n\tclone,\n\tconvertBreaks,\n\tsafeActiveElement,\n\tsetDisplayTitle,\n\tsetPageElement,\n\tthrowError,\n\tstringFrom\n\t/* eslint-enable no-unused-vars */\n} = (() => {\n\t'use strict';\n\n\n\t/*******************************************************************************************************************\n\t\tUtility Functions.\n\t*******************************************************************************************************************/\n\tfunction _getTextContent(source) {\n\t\tconst copy = source.cloneNode(true);\n\t\tconst frag = document.createDocumentFragment();\n\t\tlet node;\n\n\t\twhile ((node = copy.firstChild) !== null) {\n\t\t\t// Insert spaces before various elements.\n\t\t\tif (node.nodeType === Node.ELEMENT_NODE) {\n\t\t\t\tswitch (node.nodeName.toUpperCase()) {\n\t\t\t\tcase 'BR':\n\t\t\t\tcase 'DIV':\n\t\t\t\tcase 'P':\n\t\t\t\t\tfrag.appendChild(document.createTextNode(' '));\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfrag.appendChild(node);\n\t\t}\n\n\t\treturn frag.textContent;\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tHelper Functions.\n\t*******************************************************************************************************************/\n\t/*\n\t\tReturns a deep copy of the given object.\n\n\t\tNOTE:\n\t\t\t1. `clone()` does not clone functions, however, since function definitions\n\t\t\t   are immutable, the only issues are with expando properties and scope.\n\t\t\t   The former really should not be done.  The latter is problematic either\n\t\t\t   way—damned if you do, damned if you don't.\n\t\t\t2. `clone()` does not maintain referential relationships—e.g. multiple\n\t\t\t   references to the same object will, post-cloning, refer to different\n\t\t\t   equivalent objects; i.e. each reference will receive its own clone\n\t\t\t   of the original object.\n\t*/\n\tfunction clone(orig) {\n\t\t/*\n\t\t\tImmediately return the primitives and functions.\n\t\t*/\n\t\tif (typeof orig !== 'object' || orig === null) {\n\t\t\treturn orig;\n\t\t}\n\n\t\t/*\n\t\t\tUnbox instances of the primitive exemplar objects.\n\t\t*/\n\t\tif (orig instanceof String) {\n\t\t\treturn String(orig);\n\t\t}\n\t\tif (orig instanceof Number) {\n\t\t\treturn Number(orig);\n\t\t}\n\t\tif (orig instanceof Boolean) {\n\t\t\treturn Boolean(orig);\n\t\t}\n\n\t\t/*\n\t\t\tHonor native clone methods.\n\t\t*/\n\t\tif (typeof orig.clone === 'function') {\n\t\t\treturn orig.clone(true);\n\t\t}\n\t\tif (orig.nodeType && typeof orig.cloneNode === 'function') {\n\t\t\treturn orig.cloneNode(true);\n\t\t}\n\n\t\t/*\n\t\t\tCreate a copy of the original object.\n\n\t\t\tNOTE: Each non-generic object that we wish to support must be\n\t\t\texplicitly handled below.\n\t\t*/\n\t\tlet copy;\n\n\t\t// Handle instances of the core supported object types.\n\t\tif (orig instanceof Array) {\n\t\t\tcopy = new Array(orig.length);\n\t\t}\n\t\telse if (orig instanceof Date) {\n\t\t\tcopy = new Date(orig.getTime());\n\t\t}\n\t\telse if (orig instanceof Map) {\n\t\t\tcopy = new Map();\n\t\t\torig.forEach((val, key) => copy.set(key, clone(val)));\n\t\t}\n\t\telse if (orig instanceof RegExp) {\n\t\t\tcopy = new RegExp(orig);\n\t\t}\n\t\telse if (orig instanceof Set) {\n\t\t\tcopy = new Set();\n\t\t\torig.forEach(val => copy.add(clone(val)));\n\t\t}\n\n\t\t// Handle instances of unknown or generic objects.\n\t\telse {\n\t\t\t// We try to ensure that the returned copy has the same prototype as\n\t\t\t// the original, but this will probably produce less than satisfactory\n\t\t\t// results on non-generics.\n\t\t\tcopy = Object.create(Object.getPrototypeOf(orig));\n\t\t}\n\n\t\t/*\n\t\t\tDuplicate the original object's own enumerable properties, which will\n\t\t\tinclude expando properties on non-generic objects.\n\n\t\t\tNOTE: This preserves neither symbol properties nor ES5 property attributes.\n\t\t\tNeither does the delta coding or serialization code, however, so it's not\n\t\t\treally an issue at the moment.\n\t\t*/\n\t\tObject.keys(orig).forEach(name => copy[name] = clone(orig[name]));\n\n\t\treturn copy;\n\t}\n\n\t/*\n\t\tConverts <br> elements to <p> elements within the given node tree.\n\t*/\n\tfunction convertBreaks(source) {\n\t\tconst output = document.createDocumentFragment();\n\t\tlet para = document.createElement('p');\n\t\tlet node;\n\n\t\twhile ((node = source.firstChild) !== null) {\n\t\t\tif (node.nodeType === Node.ELEMENT_NODE) {\n\t\t\t\tconst tagName = node.nodeName.toUpperCase();\n\n\t\t\t\tswitch (tagName) {\n\t\t\t\tcase 'BR':\n\t\t\t\t\tif (\n\t\t\t\t\t\t   node.nextSibling !== null\n\t\t\t\t\t\t&& node.nextSibling.nodeType === Node.ELEMENT_NODE\n\t\t\t\t\t\t&& node.nextSibling.nodeName.toUpperCase() === 'BR'\n\t\t\t\t\t) {\n\t\t\t\t\t\tsource.removeChild(node.nextSibling);\n\t\t\t\t\t\tsource.removeChild(node);\n\t\t\t\t\t\toutput.appendChild(para);\n\t\t\t\t\t\tpara = document.createElement('p');\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\telse if (!para.hasChildNodes()) {\n\t\t\t\t\t\tsource.removeChild(node);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'ADDRESS':\n\t\t\t\tcase 'ARTICLE':\n\t\t\t\tcase 'ASIDE':\n\t\t\t\tcase 'BLOCKQUOTE':\n\t\t\t\tcase 'CENTER':\n\t\t\t\tcase 'DIV':\n\t\t\t\tcase 'DL':\n\t\t\t\tcase 'FIGURE':\n\t\t\t\tcase 'FOOTER':\n\t\t\t\tcase 'FORM':\n\t\t\t\tcase 'H1':\n\t\t\t\tcase 'H2':\n\t\t\t\tcase 'H3':\n\t\t\t\tcase 'H4':\n\t\t\t\tcase 'H5':\n\t\t\t\tcase 'H6':\n\t\t\t\tcase 'HEADER':\n\t\t\t\tcase 'HR':\n\t\t\t\tcase 'MAIN':\n\t\t\t\tcase 'NAV':\n\t\t\t\tcase 'OL':\n\t\t\t\tcase 'P':\n\t\t\t\tcase 'PRE':\n\t\t\t\tcase 'SECTION':\n\t\t\t\tcase 'TABLE':\n\t\t\t\tcase 'UL':\n\t\t\t\t\tif (para.hasChildNodes()) {\n\t\t\t\t\t\toutput.appendChild(para);\n\t\t\t\t\t\tpara = document.createElement('p');\n\t\t\t\t\t}\n\n\t\t\t\t\toutput.appendChild(node);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpara.appendChild(node);\n\t\t}\n\n\t\tif (para.hasChildNodes()) {\n\t\t\toutput.appendChild(para);\n\t\t}\n\n\t\tsource.appendChild(output);\n\t}\n\n\t/*\n\t\tReturns `document.activeElement` or `null`.\n\t*/\n\tfunction safeActiveElement() {\n\t\t/*\n\t\t\tIE9 contains a bug where trying to access the active element of an iframe's\n\t\t\tparent document (i.e. `window.parent.document.activeElement`) will throw an\n\t\t\texception, so we must allow for an exception to be thrown.\n\n\t\t\tWe could simply return `undefined` here, but since the API's default behavior\n\t\t\tshould be to return `document.body` or `null` when there is no selection, we\n\t\t\tchoose to return `null` in all non-element cases (i.e. whether it returns\n\t\t\t`null` or throws an exception).  Just a bit of normalization.\n\t\t*/\n\t\ttry {\n\t\t\treturn document.activeElement || null;\n\t\t}\n\t\tcatch (ex) {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\t/*\n\t\tSets the display title.\n\t*/\n\tfunction setDisplayTitle(title) {\n\t\tif (typeof title !== 'string') {\n\t\t\tthrow new TypeError(`story display title must be a string (received: ${Util.getType(title)})`);\n\t\t}\n\n\t\tconst render = document.createDocumentFragment();\n\t\tnew Wikifier(render, title);\n\n\t\tconst text = _getTextContent(render).trim();\n\n\t\t// if (text === '') {\n\t\t// \tthrow new Error('story display title must not render to an empty string or consist solely of whitespace');\n\t\t// }\n\n\t\tdocument.title = Config.passages.displayTitles && State.passage !== '' && State.passage !== Config.passages.start\n\t\t\t? `${State.passage} | ${text}`\n\t\t\t: text;\n\n\t\tconst storyTitle = document.getElementById('story-title');\n\n\t\tif (storyTitle !== null) {\n\t\t\tjQuery(storyTitle).empty().append(render);\n\t\t}\n\t}\n\n\t/*\n\t\tWikifies a passage into a DOM element corresponding to the passed ID and returns the element.\n\t*/\n\tfunction setPageElement(idOrElement, titles, defaultText) {\n\t\tconst el = typeof idOrElement === 'object'\n\t\t\t? idOrElement\n\t\t\t: document.getElementById(idOrElement);\n\n\t\tif (el == null) { // lazy equality for null\n\t\t\treturn null;\n\t\t}\n\n\t\tconst ids = Array.isArray(titles) ? titles : [titles];\n\n\t\tjQuery(el).empty();\n\n\t\tfor (let i = 0, iend = ids.length; i < iend; ++i) {\n\t\t\tif (Story.has(ids[i])) {\n\t\t\t\tel.append(Story.get(ids[i]).render());\n\t\t\t\treturn el;\n\t\t\t}\n\t\t}\n\n\t\tif (defaultText != null) { // lazy equality for null\n\t\t\tconst text = String(defaultText).trim();\n\n\t\t\tif (text !== '') {\n\t\t\t\tnew Wikifier(el, text);\n\t\t\t}\n\t\t}\n\n\t\treturn el;\n\t}\n\n\t/*\n\t\tAppends an error view to the passed DOM element.\n\t*/\n\tfunction throwError(place, message, source, stack) {\n\t\tconst $wrapper = jQuery(document.createElement('div'));\n\t\tconst $toggle  = jQuery(document.createElement('button'));\n\t\tconst $source  = jQuery(document.createElement('pre'));\n\t\tconst mesg     = `${L10n.get('errorTitle')}: ${message || 'unknown error'} ${Config.saves.version}`;\n\n\t\t$toggle\n\t\t\t.addClass('error-toggle')\n\t\t\t.ariaClick({\n\t\t\t\tlabel : L10n.get('errorToggle')\n\t\t\t}, () => {\n\t\t\t\tif ($toggle.hasClass('enabled')) {\n\t\t\t\t\t$toggle.removeClass('enabled');\n\t\t\t\t\t$source.attr({\n\t\t\t\t\t\t'aria-hidden' : true,\n\t\t\t\t\t\thidden        : 'hidden'\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$toggle.addClass('enabled');\n\t\t\t\t\t$source.removeAttr('aria-hidden hidden');\n\t\t\t\t}\n\t\t\t})\n\t\t\t.appendTo($wrapper);\n\t\tjQuery(document.createElement('span'))\n\t\t\t.addClass('error')\n\t\t\t.text(mesg)\n\t\t\t.appendTo($wrapper);\n\t\tjQuery(document.createElement('code'))\n\t\t\t.text(source)\n\t\t\t.appendTo($source);\n\t\t$source\n\t\t\t.addClass('error-source')\n\t\t\t.attr({\n\t\t\t\t'aria-hidden' : true,\n\t\t\t\thidden        : 'hidden'\n\t\t\t})\n\t\t\t.appendTo($wrapper);\n\t\tif (stack) {\n\t\t\tconst lines = stack.split('\\n');\n\t\t\tfor (const ll of lines) {\n\t\t\t\tconst div = document.createElement('div');\n\t\t\t\tdiv.append(ll.replace(/file:.*\\//, '<path>/'));\n\t\t\t\t$source.append(div);\n\t\t\t}\n\t\t}\n\t\t$wrapper\n\t\t\t.addClass('error-view')\n\t\t\t.appendTo(place);\n\n\t\tconsole.warn(`${mesg}\\n\\t${source.replace(/\\n/g, '\\n\\t')}`);\n\n\t\treturn false;\n\t}\n\n\t/*\n\t\tReturns the simple string representation of the given value or, if there is\n\t\tnone, a square bracketed representation.\n\t*/\n\tfunction stringFrom(value) {\n\t\tswitch (typeof value) {\n\t\tcase 'function':\n\t\t\treturn '[function]';\n\n\t\tcase 'number':\n\t\t\tif (Number.isNaN(value)) {\n\t\t\t\treturn '[number NaN]';\n\t\t\t}\n\n\t\t\tbreak;\n\n\t\tcase 'object':\n\t\t\tif (value === null) {\n\t\t\t\treturn '[null]';\n\t\t\t}\n\t\t\telse if (value instanceof Array) {\n\t\t\t\treturn value.map(val => stringFrom(val)).join(', ');\n\t\t\t}\n\t\t\telse if (value instanceof Set) {\n\t\t\t\treturn Array.from(value).map(val => stringFrom(val)).join(', ');\n\t\t\t}\n\t\t\telse if (value instanceof Map) {\n\t\t\t\tconst result = Array.from(value).map(([key, val]) => `${stringFrom(key)} \\u2192 ${stringFrom(val)}`);\n\t\t\t\treturn `{\\u202F${result.join(', ')}\\u202F}`;\n\t\t\t}\n\t\t\telse if (value instanceof Date) {\n\t\t\t\treturn value.toLocaleString();\n\t\t\t}\n\t\t\telse if (value instanceof Element) {\n\t\t\t\tif (\n\t\t\t\t\tvalue === document.documentElement\n\t\t\t\t\t|| value === document.head\n\t\t\t\t\t|| value === document.body\n\t\t\t\t) {\n\t\t\t\t\tthrow new Error('illegal operation; attempting to convert the <html>, <head>, or <body> tags to string is not allowed');\n\t\t\t\t}\n\n\t\t\t\treturn value.outerHTML;\n\t\t\t}\n\t\t\telse if (value instanceof Node) {\n\t\t\t\treturn value.textContent;\n\t\t\t}\n\t\t\telse if (typeof value.toString === 'function') {\n\t\t\t\treturn value.toString();\n\t\t\t}\n\n\t\t\treturn Object.prototype.toString.call(value);\n\n\t\tcase 'symbol': {\n\t\t\tconst desc = typeof value.description !== 'undefined' ? ` \"${value.description}\"` : '';\n\t\t\treturn `[symbol${desc}]`;\n\t\t}\n\n\t\tcase 'undefined':\n\t\t\treturn '[undefined]';\n\t\t}\n\n\t\treturn String(value);\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************************************************/\n\treturn Object.freeze(Object.defineProperties({}, {\n\t\tclone             : { value : clone },\n\t\tconvertBreaks     : { value : convertBreaks },\n\t\tsafeActiveElement : { value : safeActiveElement },\n\t\tsetDisplayTitle   : { value : setDisplayTitle },\n\t\tsetPageElement    : { value : setPageElement },\n\t\tthrowError        : { value : throwError },\n\t\tstringFrom        : { value : stringFrom }\n\t}));\n})();\n\n/***********************************************************************************************************************\n\n\tlib/jquery-plugins.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/* global Wikifier, errorPrologRegExp, safeActiveElement */\n\n/*\n\tWAI-ARIA methods plugin.\n\n\t`<jQuery>.ariaClick([options,] handler)`\n\t    Makes the target element(s) WAI-ARIA compatible clickables.\n\n\t`<jQuery>.ariaDisabled(state)`\n\t    Changes the disabled state of the target WAI-ARIA-compatible clickable element(s).\n\n\t`<jQuery>.ariaIsDisabled()`\n\t    Checks the disabled status of the target WAI-ARIA-compatible clickable element(s).\n*/\n(() => {\n\t'use strict';\n\n\t/*\n\t\tEvent handler & utility functions.\n\n\t\tNOTE: Do not replace the anonymous functions herein with arrow functions.\n\t*/\n\tfunction onKeypressFn(ev) {\n\t\t// 13 is Enter/Return, 32 is Space.\n\t\tif (ev.which === 13 || ev.which === 32) {\n\t\t\tev.preventDefault();\n\n\t\t\t// To allow delegation, attempt to trigger the event on `document.activeElement`,\n\t\t\t// if possible, elsewise on `this`.\n\t\t\tjQuery(safeActiveElement() || this).trigger('click');\n\t\t}\n\t}\n\n\tfunction onClickFnWrapper(fn) {\n\t\treturn function () {\n\t\t\tconst $this = jQuery(this);\n\n\t\t\tconst dataPassage = $this.attr('data-passage');\n\t\t\tconst initialDataPassage = window && window.SugarCube && window.SugarCube.State && window.SugarCube.State.passage;\n\t\t\tconst savedYOffset = window.pageYOffset;\n\n\t\t\t// Toggle \"aria-pressed\" status, if the attribute exists.\n\t\t\tif ($this.is('[aria-pressed]')) {\n\t\t\t\t$this.attr('aria-pressed', $this.attr('aria-pressed') === 'true' ? 'false' : 'true');\n\t\t\t}\n\n\t\t\t// Call the true handler.\n\t\t\tfn.apply(this, arguments);\n\n\t\t\tconst doJump = () => window.scrollTo(0, savedYOffset);\n\t\t\tif (dataPassage && (window.lastDataPassageLink === dataPassage || initialDataPassage === dataPassage)) {\n\t\t\t\tif (Config.navigation.rememberYPos && (!V.options || V.options && V.options.scrollRemember !== false)) doJump();\n\t\t\t}\n\t\t\twindow.lastDataPassageLink = dataPassage;\n\t\t};\n\t}\n\n\tfunction oneClickFnWrapper(fn) {\n\t\treturn onClickFnWrapper(function () {\n\t\t\t// Remove both event handlers (keypress & click) and the other components.\n\t\t\tjQuery(this)\n\t\t\t\t.off('.aria-clickable')\n\t\t\t\t.removeAttr('role tabindex aria-controls aria-pressed')\n\t\t\t\t.filter('button')\n\t\t\t\t.prop('disabled', true);\n\n\t\t\t// Call the true handler.\n\t\t\tfn.apply(this, arguments);\n\t\t});\n\t}\n\n\tjQuery.fn.extend({\n\t\t/*\n\t\t\tExtend jQuery's chainable methods with an `ariaClick()` method.\n\t\t*/\n\t\tariaClick(options, handler) {\n\t\t\t// Bail out if there are no target element(s) or parameters.\n\t\t\tif (this.length === 0 || arguments.length === 0) {\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tlet opts = options;\n\t\t\tlet fn   = handler;\n\n\t\t\tif (fn == null) { // lazy equality for null\n\t\t\t\tfn   = opts;\n\t\t\t\topts = undefined;\n\t\t\t}\n\n\t\t\topts = jQuery.extend({\n\t\t\t\tnamespace : undefined,\n\t\t\t\tone       : false,\n\t\t\t\tselector  : undefined,\n\t\t\t\tdata      : undefined,\n\t\t\t\trole      : undefined,\n\t\t\t\tcontrols  : undefined,\n\t\t\t\tpressed   : undefined,\n\t\t\t\tlabel     : undefined\n\t\t\t}, opts);\n\n\t\t\tif (typeof opts.namespace !== 'string') {\n\t\t\t\topts.namespace = '';\n\t\t\t}\n\t\t\telse if (opts.namespace[0] !== '.') {\n\t\t\t\topts.namespace = `.${opts.namespace}`;\n\t\t\t}\n\n\t\t\tif (typeof opts.pressed === 'boolean') {\n\t\t\t\topts.pressed = opts.pressed ? 'true' : 'false';\n\t\t\t}\n\n\t\t\t// Set `type` to `button` to suppress \"submit\" semantics, for <button> elements.\n\t\t\tthis.filter('button').prop('type', 'button');\n\n\t\t\t// Set `role`.\n\t\t\tif (opts.role != null) { // lazy equality for null\n\t\t\t\tthis.attr('role', opts.role);\n\t\t\t}\n\n\t\t\t// Elsewise, set `role` to default values based on elements.\n\t\t\telse {\n\t\t\t\tthis\n\t\t\t\t\t// Elements without an existing `role`.\n\t\t\t\t\t.not('[role]')\n\n\t\t\t\t\t// Elements that are `<a>` OR with `data-passage`.\n\t\t\t\t\t.filter('a,[data-passage]')\n\t\t\t\t\t.attr('role', 'link')\n\t\t\t\t\t.end()\n\n\t\t\t\t\t// Elements that are not `<a>` AND without `data-passage`.\n\t\t\t\t\t// WARNING: Do not merge the separate `.not()` instances below.  It is correct as-is.\n\t\t\t\t\t.not('a')\n\t\t\t\t\t.not('[data-passage]')\n\t\t\t\t\t.attr('role', 'button')\n\t\t\t\t\t.end()\n\t\t\t\t\t.end()\n\n\t\t\t\t\t.end();\n\t\t\t}\n\n\t\t\t// Set `tabindex` to `0` to make them focusable (unnecessary on <button> elements, but it doesn't hurt).\n\t\t\tthis.attr('tabindex', 0);\n\n\t\t\t// Set `aria-controls`.\n\t\t\tif (opts.controls != null) { // lazy equality for null\n\t\t\t\tthis.attr('aria-controls', opts.controls);\n\t\t\t}\n\n\t\t\t// Set `aria-pressed`.\n\t\t\tif (opts.pressed != null) { // lazy equality for null\n\t\t\t\tthis.attr('aria-pressed', opts.pressed);\n\t\t\t}\n\n\t\t\t// Set `aria-label` and `title`.\n\t\t\tif (opts.label != null) { // lazy equality for null\n\t\t\t\tthis.attr({\n\t\t\t\t\t'aria-label' : opts.label,\n\t\t\t\t\ttitle        : opts.label\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// Set the keypress handlers, for non-<button> elements.\n\t\t\t// NOTE: For the single-use case, the click handler will also remove this handler.\n\t\t\tthis.not('button').on(\n\t\t\t\t`keypress.aria-clickable${opts.namespace}`,\n\t\t\t\topts.selector,\n\t\t\t\tonKeypressFn\n\t\t\t);\n\n\t\t\t// Set the click handlers.\n\t\t\t// NOTE: To ensure both handlers are properly removed, `one()` must not be used here.\n\t\t\tthis.on(\n\t\t\t\t`click.aria-clickable${opts.namespace}`,\n\t\t\t\topts.selector,\n\t\t\t\topts.data,\n\t\t\t\topts.one ? oneClickFnWrapper(fn) : onClickFnWrapper(fn)\n\t\t\t);\n\n\t\t\t// Return `this` for further chaining.\n\t\t\treturn this;\n\t\t},\n\n\t\t/*\n\t\t\tExtend jQuery's chainable methods with an `ariaDisabled()` method.\n\t\t*/\n\t\tariaDisabled(disable) {\n\t\t\t// Bail out if there are no target element(s) or parameters.\n\t\t\tif (this.length === 0 || arguments.length === 0) {\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\t/*\n\t\t\t\tNOTE: We use `<jQuery>.each()` callbacks to invoke the `<Element>.setAttribute()`\n\t\t\t\tmethods in the following because the `<jQuery>.attr()` method does not allow you\n\t\t\t\tto set a content attribute without a value, which is recommended for boolean\n\t\t\t\tcontent attributes by the HTML specification.\n\t\t\t*/\n\n\t\t\tconst $nonDisableable = this.not('button,fieldset,input,menuitem,optgroup,option,select,textarea');\n\t\t\tconst $disableable    = this.filter('button,fieldset,input,menuitem,optgroup,option,select,textarea');\n\n\t\t\tif (disable) {\n\t\t\t\t// Add boolean content attribute `disabled` and set non-boolean content attribute\n\t\t\t\t// `aria-disabled` to `'true'`, for non-disableable elements.\n\t\t\t\t$nonDisableable.each(function () {\n\t\t\t\t\tthis.setAttribute('disabled', '');\n\t\t\t\t\tthis.setAttribute('aria-disabled', 'true');\n\t\t\t\t});\n\n\t\t\t\t// Set IDL attribute `disabled` to `true` and set non-boolean content attribute\n\t\t\t\t// `aria-disabled` to `'true'`, for disableable elements.\n\t\t\t\t$disableable.each(function () {\n\t\t\t\t\tthis.disabled = true;\n\t\t\t\t\tthis.setAttribute('aria-disabled', 'true');\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// Remove content attributes `disabled` and `aria-disabled`, for non-disableable elements.\n\t\t\t\t$nonDisableable.each(function () {\n\t\t\t\t\tthis.removeAttribute('disabled');\n\t\t\t\t\tthis.removeAttribute('aria-disabled');\n\t\t\t\t});\n\n\t\t\t\t// Set IDL attribute `disabled` to `false` and remove content attribute `aria-disabled`,\n\t\t\t\t// for disableable elements.\n\t\t\t\t$disableable.each(function () {\n\t\t\t\t\tthis.disabled = false;\n\t\t\t\t\tthis.removeAttribute('aria-disabled');\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// Return `this` for further chaining.\n\t\t\treturn this;\n\t\t},\n\n\t\t/*\n\t\t\tExtend jQuery's chainable methods with an `ariaIsDisabled()` method.\n\t\t*/\n\t\tariaIsDisabled() {\n\t\t\t// Check content attribute `disabled`.\n\t\t\t//\n\t\t\t// NOTE: We simply check the `disabled` content attribute for all elements\n\t\t\t// since we have to check it for non-disableable elements and it may also\n\t\t\t// be used for disableable elements since their `disabled` IDL attribute\n\t\t\t// is required to reflect the status of their `disabled` content attribute,\n\t\t\t// and vice versa, by the HTML specification.\n\t\t\t// return this.toArray().some(el => el.hasAttribute('disabled'));\n\t\t\treturn this.is('[disabled]');\n\t\t}\n\t});\n})();\n\n/*\n\tWikifier methods plugin.\n\n\t`jQuery.wikiWithOptions(options, sources…)`\n\t    Wikifies the given content source(s), as directed by the given options.\n\n\t`jQuery.wiki(sources…)`\n\t    Wikifies the given content source(s).\n\n\t`<jQuery>.wikiWithOptions(options, sources…)`\n\t    Wikifies the given content source(s) and appends the result to the target\n\t    element(s), as directed by the given options.\n\n\t`<jQuery>.wiki(sources…)`\n\t    Wikifies the given content source(s) and appends the result to the target\n\t    element(s).\n*/\n(() => {\n\t'use strict';\n\n\tjQuery.extend({\n\t\t/*\n\t\t\tExtend jQuery's static methods with a `wikiWithOptions()` method.\n\t\t*/\n\t\twikiWithOptions(options, ...sources) {\n\t\t\t// Bail out, if there are no content sources.\n\t\t\tif (sources.length === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Wikify the content sources into a fragment.\n\t\t\tconst frag = document.createDocumentFragment();\n\t\t\tsources.forEach(content => new Wikifier(frag, content, options));\n\n\t\t\t// Gather the text of any error elements within the fragment…\n\t\t\tconst errors = [...frag.querySelectorAll('.error')]\n\t\t\t\t.map(errEl => errEl.textContent.replace(errorPrologRegExp, ''));\n\n\t\t\t// …and throw an exception, if there were any errors.\n\t\t\tif (errors.length > 0) {\n\t\t\t\tthrow new Error(errors.join('; '));\n\t\t\t}\n\t\t},\n\n\t\t/*\n\t\t\tExtend jQuery's static methods with a `wiki()` method.\n\t\t*/\n\t\twiki(...sources) {\n\t\t\tthis.wikiWithOptions(undefined, ...sources);\n\t\t}\n\t});\n\n\tjQuery.fn.extend({\n\t\t/*\n\t\t\tExtend jQuery's chainable methods with a `wikiWithOptions()` method.\n\t\t*/\n\t\twikiWithOptions(options, ...sources) {\n\t\t\t// Bail out if there are no target element(s) or content sources.\n\t\t\tif (this.length === 0 || sources.length === 0) {\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\t// Wikify the content sources into a fragment.\n\t\t\tconst frag = document.createDocumentFragment();\n\t\t\tsources.forEach(content => new Wikifier(frag, content, options));\n\n\t\t\t// Append the fragment to the target element(s).\n\t\t\tthis.append(frag);\n\n\t\t\t// Return `this` for further chaining.\n\t\t\treturn this;\n\t\t},\n\n\t\t/*\n\t\t\tExtend jQuery's chainable methods with a `wiki()` method.\n\t\t*/\n\t\twiki(...sources) {\n\t\t\treturn this.wikiWithOptions(undefined, ...sources);\n\t\t}\n\t});\n})();\n\n/***********************************************************************************************************************\n\n\tlib/util.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/* global Has, Scripting */\n\nvar Util = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\t/*******************************************************************************************************************\n\t\tType Functions.\n\t*******************************************************************************************************************/\n\t/*\n\t\tReturns the value yielded by `typeof` (for primitives), the `@@toStringTag`\n\t\tinternal property (for objects), and `'null'` for `null`.\n\n\t\tNOTE: In ≤ES5, returns the value of the `[[Class]]` internal slot for objects.\n\t*/\n\tconst utilGetType = (() => {\n\t\t// Cache the `<Object>.toString()` method.\n\t\tconst toString = Object.prototype.toString;\n\n\t\t// If the browser is using the `Map()` and `Set()` polyfills, then return\n\t\t// a version of `utilGetType()` that contains special cases for them, since\n\t\t// they do not have a `[[Class]]` internal slot and the `@@toStringTag`\n\t\t// internal property is unavailable to them.\n\t\tif (toString.call(new Map()) === '[object Object]') {\n\t\t\treturn function utilGetType(O) {\n\t\t\t\tif (O === null) { return 'null'; }\n\n\t\t\t\t// Special cases for the `Map` and `Set` polyfills.\n\t\t\t\t//\n\t\t\t\t// NOTE: We don't special case the `WeakMap` and `WeakSet` polyfills\n\t\t\t\t// here since they're (a) unlikely to be used and (b) broken anyway.\n\t\t\t\tif (O instanceof Map) { return 'Map'; }\n\t\t\t\tif (O instanceof Set) { return 'Set'; }\n\n\t\t\t\tconst baseType = typeof O;\n\t\t\t\treturn baseType === 'object' ? toString.call(O).slice(8, -1) : baseType;\n\t\t\t};\n\t\t}\n\n\t\t// Elsewise, return the regular `utilGetType()` function.\n\t\treturn function utilGetType(O) {\n\t\t\tif (O === null) { return 'null'; }\n\n\t\t\tconst baseType = typeof O;\n\t\t\treturn baseType === 'object' ? toString.call(O).slice(8, -1) : baseType;\n\t\t};\n\t})();\n\n\t/*\n\t\tReturns whether the passed value is a boolean or one of the strings \"true\"\n\t\tor \"false\".\n\t*/\n\tfunction utilIsBoolean(obj) {\n\t\treturn typeof obj === 'boolean' || typeof obj === 'string' && (obj === 'true' || obj === 'false');\n\t}\n\n\t/*\n\t\tReturns whether the passed value is iterable.\n\t*/\n\tfunction utilIsIterable(obj) {\n\t\treturn obj != null && typeof obj[Symbol.iterator] === 'function'; // lazy equality for null\n\t}\n\n\t/*\n\t\tReturns whether the passed value is a finite number or a numeric string which\n\t\tyields a finite number when parsed.\n\t*/\n\tfunction utilIsNumeric(obj) {\n\t\tlet num;\n\n\t\tswitch (typeof obj) {\n\t\tcase 'number':\n\t\t\tnum = obj;\n\t\t\tbreak;\n\n\t\tcase 'string':\n\t\t\tnum = Number(obj);\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\treturn false;\n\t\t}\n\n\t\treturn !Number.isNaN(num) && Number.isFinite(num);\n\t}\n\n\t/*\n\t\tReturns whether the passed values pass a SameValueZero comparison.\n\n\t\tSEE: http://ecma-international.org/ecma-262/8.0/#sec-samevaluezero\n\t*/\n\tfunction utilSameValueZero(a, b) {\n\t\t/*\n\t\t\tNOTE: This comparison could also be implemented thus:\n\n\t\t\t\t```\n\t\t\t\ta === b ||\n\t\t\t\ttypeof a === 'number' && typeof b === 'number' &&\n\t\t\t\tNumber.isNaN(a) && Number.isNaN(b)\n\t\t\t\t```\n\n\t\t\tThat's needlessly verbose, however, as `NaN` is the only value in\n\t\t\tthe language which is not reflexive.\n\t\t*/\n\t\treturn a === b || a !== a && b !== b;\n\t}\n\n\t/*\n\t\tReturns a pseudo-enumeration created from the given Array, Map, Set, or generic object.\n\t*/\n\tfunction utilToEnum(obj) {\n\t\tconst pEnum = Object.create(null);\n\n\t\tif (obj instanceof Array) {\n\t\t\tobj.forEach((val, i) => pEnum[String(val)] = i);\n\t\t}\n\t\telse if (obj instanceof Set) {\n\t\t\t// NOTE: Use `<Array>.forEach()` here rather than `<Set>.forEach()`\n\t\t\t// as the latter does not provide the indices we require.\n\t\t\tArray.from(obj).forEach((val, i) => pEnum[String(val)] = i);\n\t\t}\n\t\telse if (obj instanceof Map) {\n\t\t\tobj.forEach((val, key) => pEnum[String(key)] = val);\n\t\t}\n\t\telse if (\n\t\t\t   typeof obj === 'object'\n\t\t\t&& obj !== null\n\t\t\t&& Object.getPrototypeOf(obj) === Object.prototype\n\t\t) {\n\t\t\tObject.assign(pEnum, obj);\n\t\t}\n\t\telse {\n\t\t\tthrow new TypeError('Util.toEnum obj parameter must be an Array, Map, Set, or generic object');\n\t\t}\n\n\t\treturn Object.freeze(pEnum);\n\t}\n\n\t/*\n\t\tReturns the value of the `@@toStringTag` property of the given object.\n\n\t\tNOTE: In ≤ES5, returns the value of the `[[Class]]` internal slot.\n\t*/\n\tfunction utilToStringTag(obj) {\n\t\treturn Object.prototype.toString.call(obj).slice(8, -1);\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tString Encoding Functions.\n\t*******************************************************************************************************************/\n\t/*\n\t\tReturns a trimmed and encoded slug of the passed string that should be safe\n\t\tfor use as a DOM ID or class name.\n\n\t\tNOTE: The range of illegal characters consists of: C0 controls, space, exclamation,\n\t\tdouble quote, number, dollar, percent, ampersand, single quote, left paren, right\n\t\tparen, asterisk, plus, comma, hyphen, period, forward slash, colon, semi-colon,\n\t\tless-than, equals, greater-than, question, at, left bracket, backslash, right\n\t\tbracket, caret, backquote/grave, left brace, pipe/vertical-bar, right brace, tilde,\n\t\tdelete, C1 controls.\n\t*/\n\tconst _illegalSlugCharsRe = /[\\x00-\\x20!-/:-@[-^`{-\\x9f]+/g; // eslint-disable-line no-control-regex\n\t/* legacy */\n\tconst _isInvalidSlugRe = /^-*$/; // Matches the empty string or one comprised solely of hyphens.\n\t/* /legacy */\n\n\tfunction utilSlugify(str) {\n\t\tconst base = String(str).trim();\n\n\t\t/* legacy */\n\t\tconst _legacy = base\n\t\t\t.replace(/[^\\w\\s\\u2013\\u2014-]+/g, '')\n\t\t\t.replace(/[_\\s\\u2013\\u2014-]+/g, '-')\n\t\t\t.toLocaleLowerCase();\n\n\t\tif (!_isInvalidSlugRe.test(_legacy)) {\n\t\t\treturn _legacy;\n\t\t}\n\t\t/* /legacy */\n\n\t\treturn base\n\t\t\t.replace(_illegalSlugCharsRe, '')\n\t\t\t.replace(/[_\\s\\u2013\\u2014-]+/g, '-');\n\n\t\t// For v3.\n\t\t// return base.replace(_illegalSlugCharsRe, '-');\n\t}\n\n\t/*\n\t\tReturns a sanitized version of the given string that should be safe for use\n\t\tas a filename under both Windows and Unix-based/-like operating systems.\n\n\t\tNOTE: The range of illegal characters consists of: C0 controls, double quote,\n\t\tnumber, dollar, percent, ampersand, single quote, asterisk, plus, comma,\n\t\tforward slash, colon, semi-colon, less-than, equals, greater-than, question,\n\t\tbackslash, caret, backquote/grave, pipe/vertical line, delete, C1 controls.\n\t*/\n\tconst _illegalFilenameCharsRE = /[\\x00-\\x1f\"#$%&'*+,/:;<=>?\\\\^`|\\x7f-\\x9f]+/g; // eslint-disable-line no-control-regex\n\n\tfunction utilSanitizeFilename(str) {\n\t\treturn String(str).trim()\n\t\t\t.replace(_illegalFilenameCharsRE, '');\n\t}\n\n\t/*\n\t\tReturns an entity encoded version of the passed string.\n\n\t\tNOTE: Escapes the five primary HTML special characters, the backquote,\n\t\tand SugarCube markup metacharacters.\n\t*/\n\tconst _markupCharsRe    = /[!\"#$&'*\\-/<=>?@[\\\\\\]^_`{|}~]/g;\n\tconst _hasMarkupCharsRe = new RegExp(_markupCharsRe.source); // to drop the global flag\n\tconst _markupCharsMap   = utilToEnum({\n\t\t/* eslint-disable quote-props */\n\t\t'!'  : '&#33;',\n\t\t'\"'  : '&quot;',\n\t\t'#'  : '&#35;',\n\t\t'$'  : '&#36;',\n\t\t'&'  : '&amp;',\n\t\t\"'\"  : '&#39;',\n\t\t'*'  : '&#42;',\n\t\t'-'  : '&#45;',\n\t\t'/'  : '&#47;',\n\t\t'<'  : '&lt;',\n\t\t'='  : '&#61;',\n\t\t'>'  : '&gt;',\n\t\t'?'  : '&#63;',\n\t\t'@'  : '&#64;',\n\t\t'['  : '&#91;',\n\t\t'\\\\' : '&#92;',\n\t\t']'  : '&#93;',\n\t\t'^'  : '&#94;',\n\t\t'_'  : '&#95;',\n\t\t'`'  : '&#96;',\n\t\t'{'  : '&#123;',\n\t\t'|'  : '&#124;',\n\t\t'}'  : '&#125;',\n\t\t'~'  : '&#126;'\n\t\t/* eslint-enable quote-props */\n\t});\n\n\tfunction utilEscapeMarkup(str) {\n\t\tif (str == null) { // lazy equality for null\n\t\t\treturn '';\n\t\t}\n\n\t\tconst val = String(str);\n\t\treturn val && _hasMarkupCharsRe.test(val)\n\t\t\t? val.replace(_markupCharsRe, ch => _markupCharsMap[ch])\n\t\t\t: val;\n\t}\n\n\t/*\n\t\tReturns an entity encoded version of the passed string.\n\n\t\tNOTE: Only escapes the five primary special characters and the backquote.\n\t*/\n\tconst _htmlCharsRe    = /[&<>\"'`]/g;\n\tconst _hasHtmlCharsRe = new RegExp(_htmlCharsRe.source); // to drop the global flag\n\tconst _htmlCharsMap   = utilToEnum({\n\t\t'&' : '&amp;',\n\t\t'<' : '&lt;',\n\t\t'>' : '&gt;',\n\t\t'\"' : '&quot;',\n\t\t\"'\" : '&#39;',\n\t\t'`' : '&#96;'\n\t});\n\n\tfunction utilEscape(str) {\n\t\tif (str == null) { // lazy equality for null\n\t\t\treturn '';\n\t\t}\n\n\t\tconst val = String(str);\n\t\treturn val && _hasHtmlCharsRe.test(val)\n\t\t\t? val.replace(_htmlCharsRe, ch => _htmlCharsMap[ch])\n\t\t\t: val;\n\t}\n\n\t/*\n\t\tReturns a decoded version of the passed entity encoded string.\n\n\t\tNOTE: The extended replacement set here, in contrast to `utilEscape()`,\n\t\tis required due to observed stupidity from various sources.\n\t*/\n\tconst _escapedHtmlRe    = /&(?:amp|#38|#x26|lt|#60|#x3c|gt|#62|#x3e|quot|#34|#x22|apos|#39|#x27|#96|#x60);/gi;\n\tconst _hasEscapedHtmlRe = new RegExp(_escapedHtmlRe.source, 'i'); // to drop the global flag\n\tconst _escapedHtmlMap   = utilToEnum({\n\t\t'&amp;'  : '&', // ampersand (HTML character entity, XML predefined entity)\n\t\t'&#38;'  : '&', // ampersand (decimal numeric character reference)\n\t\t'&#x26;' : '&', // ampersand (hexadecimal numeric character reference)\n\t\t'&lt;'   : '<', // less-than (HTML character entity, XML predefined entity)\n\t\t'&#60;'  : '<', // less-than (decimal numeric character reference)\n\t\t'&#x3c;' : '<', // less-than (hexadecimal numeric character reference)\n\t\t'&gt;'   : '>', // greater-than (HTML character entity, XML predefined entity)\n\t\t'&#62;'  : '>', // greater-than (decimal numeric character reference)\n\t\t'&#x3e;' : '>', // greater-than (hexadecimal numeric character reference)\n\t\t'&quot;' : '\"', // double quote (HTML character entity, XML predefined entity)\n\t\t'&#34;'  : '\"', // double quote (decimal numeric character reference)\n\t\t'&#x22;' : '\"', // double quote (hexadecimal numeric character reference)\n\t\t'&apos;' : \"'\", // apostrophe (XML predefined entity)\n\t\t'&#39;'  : \"'\", // apostrophe (decimal numeric character reference)\n\t\t'&#x27;' : \"'\", // apostrophe (hexadecimal numeric character reference)\n\t\t'&#96;'  : '`', // backquote (decimal numeric character reference)\n\t\t'&#x60;' : '`'  // backquote (hexadecimal numeric character reference)\n\t});\n\n\tfunction utilUnescape(str) {\n\t\tif (str == null) { // lazy equality for null\n\t\t\treturn '';\n\t\t}\n\n\t\tconst val = String(str);\n\t\treturn val && _hasEscapedHtmlRe.test(val)\n\t\t\t? val.replace(_escapedHtmlRe, entity => _escapedHtmlMap[entity.toLowerCase()])\n\t\t\t: val;\n\t}\n\n\t/*\n\t\tReturns an object (`{ char, start, end }`) containing the Unicode character at\n\t\tposition `pos`, its starting position, and its ending position—surrogate pairs\n\t\tare properly handled.  If `pos` is out-of-bounds, returns an object containing\n\t\tthe empty string and start/end positions of `-1`.\n\n\t\tThis function is necessary because JavaScript strings are sequences of UTF-16\n\t\tcode units, so surrogate pairs are exposed and thus must be handled.  While the\n\t\tES6/2015 standard does improve the situation somewhat, it does not alleviate\n\t\tthe need for this function.\n\n\t\tNOTE: Returns the individual code units of invalid surrogate pairs as-is.\n\n\t\tIDEA: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charAt\n\t*/\n\tfunction utilCharAndPosAt(text, position) {\n\t\tconst str  = String(text);\n\t\tconst pos  = Math.trunc(position);\n\t\tconst code = str.charCodeAt(pos);\n\n\t\t// Given position was out-of-bounds.\n\t\tif (Number.isNaN(code)) {\n\t\t\treturn { char : '', start : -1, end : -1 };\n\t\t}\n\n\t\tconst retval = {\n\t\t\tchar  : str.charAt(pos),\n\t\t\tstart : pos,\n\t\t\tend   : pos\n\t\t};\n\n\t\t// Code unit is not a UTF-16 surrogate.\n\t\tif (code < 0xD800 || code > 0xDFFF) {\n\t\t\treturn retval;\n\t\t}\n\n\t\t// Code unit is a high surrogate (D800–DBFF).\n\t\tif (code >= 0xD800 && code <= 0xDBFF) {\n\t\t\tconst nextPos = pos + 1;\n\n\t\t\t// End of string.\n\t\t\tif (nextPos >= str.length) {\n\t\t\t\treturn retval;\n\t\t\t}\n\n\t\t\tconst nextCode = str.charCodeAt(nextPos);\n\n\t\t\t// Next code unit is not a low surrogate (DC00–DFFF).\n\t\t\tif (nextCode < 0xDC00 || nextCode > 0xDFFF) {\n\t\t\t\treturn retval;\n\t\t\t}\n\n\t\t\tretval.char = retval.char + str.charAt(nextPos);\n\t\t\tretval.end = nextPos;\n\t\t\treturn retval;\n\t\t}\n\n\t\t// Code unit is a low surrogate (DC00–DFFF) in the first position.\n\t\tif (pos === 0) {\n\t\t\treturn retval;\n\t\t}\n\n\t\tconst prevPos  = pos - 1;\n\t\tconst prevCode = str.charCodeAt(prevPos);\n\n\t\t// Previous code unit is not a high surrogate (D800–DBFF).\n\t\tif (prevCode < 0xD800 || prevCode > 0xDBFF) {\n\t\t\treturn retval;\n\t\t}\n\n\t\tretval.char = str.charAt(prevPos) + retval.char;\n\t\tretval.start = prevPos;\n\t\treturn retval;\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tTime Functions.\n\t*******************************************************************************************************************/\n\t/*\n\t\tReturns the number of milliseconds elapsed since a reference epoch.\n\n\t\tNOTE: Use the Performance API, if available, elsewise use Date as a\n\t\tfailover.  The Performance API is preferred for its monotonic clock—\n\t\tmeaning, it's not subject to the vagaries of timezone changes and leap\n\t\tperiods, as is Date.\n\t*/\n\tconst _nowSource = Has.performance ? performance : Date;\n\n\tfunction utilNow() {\n\t\treturn _nowSource.now();\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tConversion Functions.\n\t*******************************************************************************************************************/\n\t/*\n\t\tReturns the number of miliseconds represented by the passed CSS time string.\n\t*/\n\tconst _cssTimeRe = /^([+-]?(?:\\d*\\.)?\\d+)([Mm]?[Ss])$/;\n\n\tfunction utilFromCssTime(cssTime) {\n\t\tconst match = _cssTimeRe.exec(String(cssTime));\n\n\t\tif (match === null) {\n\t\t\tthrow new SyntaxError(`invalid time value syntax: \"${cssTime}\"`);\n\t\t}\n\n\t\tlet msec = Number(match[1]);\n\n\t\tif (match[2].length === 1) {\n\t\t\tmsec *= 1000;\n\t\t}\n\n\t\tif (Number.isNaN(msec) || !Number.isFinite(msec)) {\n\t\t\tthrow new RangeError(`invalid time value: \"${cssTime}\"`);\n\t\t}\n\n\t\treturn msec;\n\t}\n\n\t/*\n\t\tReturns the CSS time string represented by the passed number of milliseconds.\n\t*/\n\tfunction utilToCssTime(msec) {\n\t\tif (typeof msec !== 'number' || Number.isNaN(msec) || !Number.isFinite(msec)) {\n\t\t\tlet what;\n\n\t\t\tswitch (typeof msec) {\n\t\t\tcase 'string':\n\t\t\t\twhat = `\"${msec}\"`;\n\t\t\t\tbreak;\n\n\t\t\tcase 'number':\n\t\t\t\twhat = String(msec);\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\twhat = utilToStringTag(msec);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tthrow new Error(`invalid milliseconds: ${what}`);\n\t\t}\n\n\t\treturn `${msec}ms`;\n\t}\n\n\t/*\n\t\tReturns the DOM property name represented by the passed CSS property name.\n\t*/\n\tfunction utilFromCssProperty(cssName) {\n\t\tif (!cssName.includes('-')) {\n\t\t\tswitch (cssName) {\n\t\t\tcase 'bgcolor': return 'backgroundColor';\n\t\t\tcase 'float':   return 'cssFloat';\n\t\t\tdefault:        return cssName;\n\t\t\t}\n\t\t}\n\n\t\t// Strip the leading hyphen from the `-ms-` vendor prefix, so it stays lowercased.\n\t\tconst normalized = cssName.slice(0, 4) === '-ms-' ? cssName.slice(1) : cssName;\n\n\t\treturn normalized\n\t\t\t.split('-')\n\t\t\t.map((part, i) => i === 0 ? part : part.toUpperFirst())\n\t\t\t.join('');\n\t}\n\n\t/*\n\t\tReturns an object containing the component properties parsed from the passed URL.\n\t*/\n\tfunction utilParseUrl(url) {\n\t\tconst el       = document.createElement('a');\n\t\tconst queryObj = Object.create(null);\n\n\t\t// Let the `<a>` element parse the URL.\n\t\tel.href = url;\n\n\t\t// Populate the `queryObj` object with the query string attributes.\n\t\tif (el.search) {\n\t\t\tel.search\n\t\t\t\t.replace(/^\\?/, '')\n\t\t\t\t.splitOrEmpty(/(?:&(?:amp;)?|;)/)\n\t\t\t\t.forEach(query => {\n\t\t\t\t\tconst [key, value] = query.split('=');\n\t\t\t\t\tqueryObj[key] = value;\n\t\t\t\t});\n\t\t}\n\n\t\t/*\n\t\t\tCaveats by browser:\n\t\t\t\tEdge and Internet Explorer (≥8) do not support authentication\n\t\t\t\tinformation within a URL at all and will throw a security exception\n\t\t\t\ton *any* property access if it's included.\n\n\t\t\t\tInternet Explorer does not include the leading forward slash on\n\t\t\t\t`pathname` when required.\n\n\t\t\t\tOpera (Presto) strips the authentication information from `href`\n\t\t\t\tand does not supply `username` or `password`.\n\n\t\t\t\tSafari (ca. v5.1.x) does not supply `username` or `password` and\n\t\t\t\tpeforms URI decoding on `pathname`.\n\t\t*/\n\n\t\t// Patch for IE not including the leading slash on `pathname` when required.\n\t\tconst pathname = el.host && el.pathname[0] !== '/' ? `/${el.pathname}` : el.pathname;\n\n\t\treturn {\n\t\t\t// The full URL that was originally parsed.\n\t\t\thref : el.href,\n\n\t\t\t// The request protocol, lowercased.\n\t\t\tprotocol : el.protocol,\n\n\t\t\t// // The full authentication information.\n\t\t\t// auth : el.username || el.password // eslint-disable-line no-nested-ternary\n\t\t\t// \t? `${el.username}:${el.password}`\n\t\t\t// \t: typeof el.username === 'string' ? '' : undefined,\n\t\t\t//\n\t\t\t// // The username portion of the auth info.\n\t\t\t// username : el.username,\n\t\t\t//\n\t\t\t// // The password portion of the auth info.\n\t\t\t// password : el.password,\n\n\t\t\t// The full host information, including port number, lowercased.\n\t\t\thost : el.host,\n\n\t\t\t// The hostname portion of the host info, lowercased.\n\t\t\thostname : el.hostname,\n\n\t\t\t// The port number portion of the host info.\n\t\t\tport : el.port,\n\n\t\t\t// The full path information, including query info.\n\t\t\tpath : `${pathname}${el.search}`,\n\n\t\t\t// The pathname portion of the path info.\n\t\t\tpathname,\n\n\t\t\t// The query string portion of the path info, including the leading question mark.\n\t\t\tquery  : el.search,\n\t\t\tsearch : el.search,\n\n\t\t\t// The attributes portion of the query string, parsed into an object.\n\t\t\tqueries  : queryObj,\n\t\t\tsearches : queryObj,\n\n\t\t\t// The fragment string, including the leading hash/pound sign.\n\t\t\thash : el.hash\n\t\t};\n\t}\n\n\t/*\n\t\tReturns a new exception based on the given exception.\n\n\t\tNOTE: Mostly useful for making a standard JavaScript exception type copy\n\t\tof a host exception type—e.g. `DOMException` → `Error`.\n\t*/\n\tfunction utilNewExceptionFrom(original, exceptionType, override) {\n\t\tif (typeof original !== 'object' || original === null) {\n\t\t\tthrow new Error('Util.newExceptionFrom original parameter must be an object');\n\t\t}\n\t\tif (typeof exceptionType !== 'function') {\n\t\t\tthrow new Error('Util.newExceptionFrom exceptionType parameter must be an error type constructor');\n\t\t}\n\n\t\tconst ex = new exceptionType(original.message); // eslint-disable-line new-cap\n\n\t\tif (typeof original.name !== 'undefined') {\n\t\t\tex.name = original.name;\n\t\t}\n\t\tif (typeof original.code !== 'undefined') {\n\t\t\tex.code = original.code;\n\t\t}\n\t\tif (typeof original.columnNumber !== 'undefined') {\n\t\t\tex.columnNumber = original.columnNumber;\n\t\t}\n\t\tif (typeof original.description !== 'undefined') {\n\t\t\tex.description = original.description;\n\t\t}\n\t\tif (typeof original.fileName !== 'undefined') {\n\t\t\tex.fileName = original.fileName;\n\t\t}\n\t\tif (typeof original.lineNumber !== 'undefined') {\n\t\t\tex.lineNumber = original.lineNumber;\n\t\t}\n\t\tif (typeof original.number !== 'undefined') {\n\t\t\tex.number = original.number;\n\t\t}\n\t\tif (typeof original.stack !== 'undefined') {\n\t\t\tex.stack = original.stack;\n\t\t}\n\n\t\tconst overrideType = typeof override;\n\n\t\tif (overrideType !== 'undefined') {\n\t\t\tif (overrideType === 'object' && override !== null) {\n\t\t\t\tObject.assign(ex, override);\n\t\t\t}\n\t\t\telse if (overrideType === 'string') {\n\t\t\t\tex.message = override;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new Error('Util.newExceptionFrom override parameter must be an object or string');\n\t\t\t}\n\t\t}\n\n\t\treturn ex;\n\t}\n\n\t/*\n\t\tReturns a sanitized version of the passed `KeyboardEvent.key` value from\n\t\tprevious incarnations of the specification that should better reflect the\n\t\tcurrent incarnation.\n\t*/\n\tconst utilScrubEventKey = (() => {\n\t\tlet separatorKey;\n\t\tlet decimalKey;\n\n\t\t// Attempt to determine the player's 'Separator' and 'Decimal' key values\n\t\t// based on their current locale.\n\t\tif (typeof Intl !== 'undefined' && typeof Intl.NumberFormat === 'function') {\n\t\t\tconst match = new Intl.NumberFormat().format(111111.5).match(/(\\D*)\\d+(\\D*)/);\n\n\t\t\tif (match) {\n\t\t\t\tseparatorKey = match[1];\n\t\t\t\tdecimalKey   = match[2];\n\t\t\t}\n\t\t}\n\n\t\t// Failover to US-centric values, if using `Intl.NumberFormat` failed.\n\t\tif (!separatorKey && !decimalKey) {\n\t\t\tseparatorKey = ',';\n\t\t\tdecimalKey   = '.';\n\t\t}\n\n\t\t// Maps older `KeyboardEvent.key` values to more current/correct ones.\n\t\tfunction utilScrubEventKey(key) {\n\t\t\tswitch (key) {\n\t\t\t// case 'OS':                 return 'Meta'; // Unreliable.\n\t\t\tcase 'Scroll':             return 'ScrollLock';\n\t\t\tcase 'Spacebar':           return '\\x20';\n\t\t\tcase 'Left':               return 'ArrowLeft';\n\t\t\tcase 'Right':              return 'ArrowRight';\n\t\t\tcase 'Up':                 return 'ArrowUp';\n\t\t\tcase 'Down':               return 'ArrowDown';\n\t\t\tcase 'Del':                return 'Delete';\n\t\t\tcase 'Crsel':              return 'CrSel';\n\t\t\tcase 'Exsel':              return 'ExSel';\n\t\t\tcase 'Esc':                return 'Escape';\n\t\t\tcase 'Apps':               return 'ContextMenu';\n\t\t\tcase 'Nonconvert':         return 'NonConvert';\n\t\t\tcase 'MediaNextTrack':     return 'MediaTrackNext';\n\t\t\tcase 'MediaPreviousTrack': return 'MediaTrackPrevious';\n\t\t\tcase 'VolumeUp':           return 'AudioVolumeUp';\n\t\t\tcase 'VolumeDown':         return 'AudioVolumeDown';\n\t\t\tcase 'VolumeMute':         return 'AudioVolumeMute';\n\t\t\tcase 'Zoom':               return 'ZoomToggle';\n\t\t\tcase 'SelectMedia':        /* see below */\n\t\t\tcase 'MediaSelect':        return 'LaunchMediaPlayer';\n\t\t\tcase 'Add':                return '+';\n\t\t\tcase 'Divide':             return '/';\n\t\t\tcase 'Multiply':           return '*';\n\t\t\tcase 'Subtract':           return '-';\n\t\t\tcase 'Decimal':            return decimalKey;\n\t\t\tcase 'Separator':          return separatorKey;\n\t\t\t}\n\n\t\t\treturn key;\n\t\t}\n\n\t\treturn utilScrubEventKey;\n\t})();\n\n\n\t/*******************************************************************************************************************\n\t\tBrowser API Functions.\n\t*******************************************************************************************************************/\n\t/*\n\t\tReturns whether the given media query matches.\n\t*/\n\tconst utilHasMediaQuery = (() => {\n\t\t// If the browser does not support `matchMedia()`, then return\n\t\t// a version of `utilHasMediaQuery()` that simply returns `false`.\n\t\tif (typeof window.matchMedia !== 'function') {\n\t\t\treturn function utilHasMediaQuery() {\n\t\t\t\treturn false;\n\t\t\t};\n\t\t}\n\n\t\t// Elsewise, return the regular `utilHasMediaQuery()` function.\n\t\treturn function utilHasMediaQuery(mediaQuery) {\n\t\t\treturn window.matchMedia(mediaQuery).matches;\n\t\t};\n\t})();\n\n\n\t/*******************************************************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************************************************/\n\treturn Object.freeze(Object.defineProperties({}, {\n\t\t/*\n\t\t\tType Functions.\n\t\t*/\n\t\tgetType       : { value : utilGetType },\n\t\tisBoolean     : { value : utilIsBoolean },\n\t\tisIterable    : { value : utilIsIterable },\n\t\tisNumeric     : { value : utilIsNumeric },\n\t\tsameValueZero : { value : utilSameValueZero },\n\t\ttoEnum        : { value : utilToEnum },\n\t\ttoStringTag   : { value : utilToStringTag },\n\n\t\t/*\n\t\t\tString Encoding Functions.\n\t\t*/\n\t\tslugify          : { value : utilSlugify },\n\t\tsanitizeFilename : { value : utilSanitizeFilename },\n\t\tescapeMarkup     : { value : utilEscapeMarkup },\n\t\tescape           : { value : utilEscape },\n\t\tunescape         : { value : utilUnescape },\n\t\tcharAndPosAt     : { value : utilCharAndPosAt },\n\n\t\t/*\n\t\t\tTime Functions.\n\t\t*/\n\t\tnow : { value : utilNow },\n\n\t\t/*\n\t\t\tConversion Functions.\n\t\t*/\n\t\tfromCssTime      : { value : utilFromCssTime },\n\t\ttoCssTime        : { value : utilToCssTime },\n\t\tfromCssProperty  : { value : utilFromCssProperty },\n\t\tparseUrl         : { value : utilParseUrl },\n\t\tnewExceptionFrom : { value : utilNewExceptionFrom },\n\t\tscrubEventKey    : { value : utilScrubEventKey },\n\n\t\t/*\n\t\t\tBrowser API Functions.\n\t\t*/\n\t\thasMediaQuery : { value : utilHasMediaQuery },\n\n\t\t/*\n\t\t\tLegacy Aliases.\n\t\t*/\n\t\trandom         : { value : Math.random },\n\t\tentityEncode   : { value : utilEscape },\n\t\tentityDecode   : { value : utilUnescape },\n\t\tevalExpression : { value : (...args) => Scripting.evalJavaScript(...args) }, // SEE: `markup/scripting.js`.\n\t\tevalStatements : { value : (...args) => Scripting.evalJavaScript(...args) }  // SEE: `markup/scripting.js`.\n\t}));\n})();\n\n/***********************************************************************************************************************\n\n\tlib/simplestore/simplestore.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\nvar SimpleStore = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\t// In-order list of database adapters.\n\tconst _adapters = [];\n\n\t// The initialized adapter.\n\tlet _initialized = null;\n\n\n\t/*******************************************************************************************************************\n\t\tSimpleStore Functions.\n\t*******************************************************************************************************************/\n\tfunction storeCreate(storageId, persistent) {\n\t\tif (_initialized) {\n\t\t\treturn _initialized.create(storageId, persistent);\n\t\t}\n\n\t\t// Return the first adapter which successfully initializes, elsewise throw an exception.\n\t\tfor (let i = 0; i < _adapters.length; ++i) {\n\t\t\tif (_adapters[i].init(storageId, persistent)) {\n\t\t\t\t_initialized = _adapters[i];\n\t\t\t\treturn _initialized.create(storageId, persistent);\n\t\t\t}\n\t\t}\n\n\t\tthrow new Error('no valid storage adapters found');\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************************************************/\n\treturn Object.freeze(Object.defineProperties({}, {\n\t\t/*\n\t\t\tAdapters List.\n\n\t\t\tTODO: This should probably have a getter, rather than being exported directly.\n\t\t*/\n\t\tadapters : { value : _adapters },\n\n\t\t/*\n\t\t\tCore Functions.\n\t\t*/\n\t\tcreate : { value : storeCreate }\n\t}));\n})();\n\n/***********************************************************************************************************************\n\n\tlib/simplestore/adapters/FCHost.Storage.js\n\n\tCopyright © 2013–2019 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/* global SimpleStore, Util */\n\nSimpleStore.adapters.push((() => {\n\t'use strict';\n\n\t// Adapter readiness state.\n\tlet _ok = false;\n\n\n\t/*******************************************************************************************************************\n\t\t_FCHostStorageAdapter Class.\n        Note that FCHost is only intended for a single document, so we ignore both prefixing and storageID\n\t*******************************************************************************************************************/\n\tclass _FCHostStorageAdapter {\n\t\tconstructor(persistent) {\n\t\t\tlet engine = null;\n\t\t\tlet name   = null;\n\n\t\t\tif (persistent) {\n\t\t\t\tengine = window.FCHostPersistent;\n\t\t\t\tname   = 'FCHostPersistent';\n\t\t\t}\n\t\t\telse {\n\t\t\t    engine = window.FCHostSession;\n\t\t\t\tname   = 'FCHostSession';\n\t\t\t}\n\n\t\t\tObject.defineProperties(this, {\n\t\t\t\t_engine : {\n\t\t\t\t\tvalue : engine\n\t\t\t\t},\n                \n\t\t\t\tname : {\n\t\t\t\t\tvalue : name\n\t\t\t\t},\n\n\t\t\t\tpersistent : {\n\t\t\t\t\tvalue : !!persistent\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t/* legacy */\n\t\tget length() {\n\t\t\tif (DEBUG) { console.log(`[<SimpleStore:${this.name}>.length : Number]`); }\n\n\t\t\treturn this._engine.size();\n\t\t}\n\t\t/* /legacy */\n\n\t\tsize() {\n\t\t\tif (DEBUG) { console.log(`[<SimpleStore:${this.name}>.size() : Number]`); }\n\n\t\t\treturn this._engine.size();\n\t\t}\n\n\t\tkeys() {\n\t\t\tif (DEBUG) { console.log(`[<SimpleStore:${this.name}>.keys() : String Array]`); }\n\n\t\t\treturn this._engine.keys();\n\t\t}\n\n\t\thas(key) {\n\t\t\tif (DEBUG) { console.log(`[<SimpleStore:${this.name}>.has(key: \"${key}\") : Boolean]`); }\n\n\t\t\tif (typeof key !== 'string' || !key) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn this._engine.has(key);\n\t\t}\n\n\t\tget(key) {\n\t\t\tif (DEBUG) { console.log(`[<SimpleStore:${this.name}>.get(key: \"${key}\") : Any]`); }\n\n\t\t\tif (typeof key !== 'string' || !key) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst value = this._engine.get(key);\n\n\t\t\treturn value == null ? null : _FCHostStorageAdapter._deserialize(value); // lazy equality for null\n\t\t}\n\n\t\tset(key, value) {\n\t\t\tif (DEBUG) { console.log(`[<SimpleStore:${this.name}>.set(key: \"${key}\", value: \\u2026) : Boolean]`); }\n\n\t\t\tif (typeof key !== 'string' || !key) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tthis._engine.set(key, _FCHostStorageAdapter._serialize(value));\n\n\t\t\treturn true;\n\t\t}\n\n\t\tdelete(key) {\n\t\t\tif (DEBUG) { console.log(`[<SimpleStore:${this.name}>.delete(key: \"${key}\") : Boolean]`); }\n\n\t\t\tif (typeof key !== 'string' || !key) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tthis._engine.remove(key);\n\n\t\t\treturn true;\n\t\t}\n\n\t\tclear() {\n\t\t\tif (DEBUG) { console.log(`[<SimpleStore:${this.name}>.clear() : Boolean]`); }\n\n\t\t\tthis._engine.clear();\n\n\t\t\treturn true;\n\t\t}\n\n\t\tstatic _serialize(obj) {\n\t\t\treturn JSON.stringify(obj);\n\t\t}\n\n\t\tstatic _deserialize(str) {\n\t\t\treturn JSON.parse(str);\n\t\t}\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tAdapter Utility Functions.\n\t*******************************************************************************************************************/\n\tfunction adapterInit() {\n\t\t// FCHost feature test.\n\t\tfunction hasFCHostStorage() {\n\t\t\ttry {\n\t\t\t    if (typeof window.FCHostPersistent !== 'undefined')\n\t\t\t        return true;\n\t\t\t}\n\t\t\tcatch (ex) { /* no-op */ }\n\n\t\t\treturn false;\n\t\t}\n\n\t\t_ok = hasFCHostStorage();\n\t\t\n\t\treturn _ok;\n\t}\n\n\tfunction adapterCreate(storageId, persistent) {\n\t\tif (!_ok) {\n\t\t\tthrow new Error('adapter not initialized');\n\t\t}\n\n\t\treturn new _FCHostStorageAdapter(persistent);\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************************************************/\n\treturn Object.freeze(Object.defineProperties({}, {\n\t\tinit   : { value : adapterInit },\n\t\tcreate : { value : adapterCreate }\n\t}));\n})());\n\n/***********************************************************************************************************************\n\n\tlib/simplestore/adapters/webstorage.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/* global SimpleStore, Util, Config */\n\nSimpleStore.adapters.push((() => {\n\t'use strict';\n\n\t// Adapter readiness state.\n\tlet _ok = false;\n\n\n\t/*******************************************************************************************************************\n\t\t_WebStorageAdapter Class.\n\t*******************************************************************************************************************/\n\tclass _WebStorageAdapter {\n\t\tconstructor(storageId, persistent) {\n\t\t\tconst prefix = `${storageId}.`;\n\t\t\tlet engine = null;\n\t\t\tlet name   = null;\n\n\t\t\tif (persistent) {\n\t\t\t\tengine = window.localStorage;\n\t\t\t\tname   = 'localStorage';\n\t\t\t}\n\t\t\telse {\n\t\t\t\tengine = window.sessionStorage;\n\t\t\t\tname   = 'sessionStorage';\n\t\t\t}\n\n\t\t\tObject.defineProperties(this, {\n\t\t\t\t_engine : {\n\t\t\t\t\tvalue : engine\n\t\t\t\t},\n\n\t\t\t\t_prefix : {\n\t\t\t\t\tvalue : prefix\n\t\t\t\t},\n\n\t\t\t\t_prefixRe : {\n\t\t\t\t\tvalue : new RegExp(`^${RegExp.escape(prefix)}`)\n\t\t\t\t},\n\n\t\t\t\tname : {\n\t\t\t\t\tvalue : name\n\t\t\t\t},\n\n\t\t\t\tid : {\n\t\t\t\t\tvalue : storageId\n\t\t\t\t},\n\n\t\t\t\tpersistent : {\n\t\t\t\t\tvalue : !!persistent\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t/* legacy */\n\t\tget length() {\n\t\t\tif (DEBUG) { console.log(`[<SimpleStore:${this.name}>.length : Number]`); }\n\n\t\t\t/*\n\t\t\t\tNOTE: DO NOT do something like `return this._engine.length;` here,\n\t\t\t\tas that will return the length of the entire store, rather than\n\t\t\t\tjust our prefixed keys.\n\t\t\t*/\n\t\t\treturn this.keys().length;\n\t\t}\n\t\t/* /legacy */\n\n\t\tsize() {\n\t\t\tif (DEBUG) { console.log(`[<SimpleStore:${this.name}>.size() : Number]`); }\n\n\t\t\t/*\n\t\t\t\tNOTE: DO NOT do something like `return this._engine.length;` here,\n\t\t\t\tas that will return the length of the entire store, rather than\n\t\t\t\tjust our prefixed keys.\n\t\t\t*/\n\t\t\treturn this.keys().length;\n\t\t}\n\n\t\tkeys() {\n\t\t\tif (DEBUG) { console.log(`[<SimpleStore:${this.name}>.keys() : String Array]`); }\n\n\t\t\tconst keys = [];\n\n\t\t\tfor (let i = 0; i < this._engine.length; ++i) {\n\t\t\t\tconst key = this._engine.key(i);\n\n\t\t\t\tif (this._prefixRe.test(key)) {\n\t\t\t\t\tkeys.push(key.replace(this._prefixRe, ''));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn keys;\n\t\t}\n\n\t\thas(key) {\n\t\t\tif (DEBUG) { console.log(`[<SimpleStore:${this.name}>.has(key: \"${key}\") : Boolean]`); }\n\n\t\t\tif (typeof key !== 'string' || !key) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// // FIXME: This method should probably check for the key, rather than comparing its value.\n\t\t\t// return this._engine.getItem(this._prefix + key) != null; // lazy equality for null\n\n\t\t\treturn this._engine.hasOwnProperty(this._prefix + key);\n\t\t}\n\n\t\tget(key) {\n\t\t\tif (DEBUG) { console.log(`[<SimpleStore:${this.name}>.get(key: \"${key}\") : Any]`); }\n\n\t\t\tif (typeof key !== 'string' || !key) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst value = this._engine.getItem(this._prefix + key);\n\n\t\t\treturn value == null ? null : _WebStorageAdapter._deserialize(value); // lazy equality for null\n\t\t}\n\n\t\tset(key, value) {\n\t\t\tif (DEBUG) { console.log(`[<SimpleStore:${this.name}>.set(key: \"${key}\", value: \\u2026) : Boolean]`); }\n\n\t\t\tif (typeof key !== 'string' || !key) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tthis._engine.setItem(this._prefix + key, _WebStorageAdapter._serialize(value));\n\t\t\t}\n\t\t\tcatch (ex) {\n\t\t\t\t/*\n\t\t\t\t\tIf the exception is a quota exceeded error, massage it into something\n\t\t\t\t\ta bit nicer for the player.\n\n\t\t\t\t\tNOTE: Ideally, we could simply do something like checking `ex.code`, but\n\t\t\t\t\tit's a non-standard property and not supported in all browsers.  Thus,\n\t\t\t\t\twe have to resort to pattern matching the name and message—the latter being\n\t\t\t\t\trequired by Opera (Presto).  I hate the parties responsible for this snafu\n\t\t\t\t\tso much.\n\t\t\t\t*/\n\t\t\t\tif (/quota.?(?:exceeded|reached)/i.test(ex.name + ex.message)) {\n\t\t\t\t\tthrow Util.newExceptionFrom(ex, Error, `${this.name} quota exceeded`);\n\t\t\t\t}\n\n\t\t\t\tthrow ex;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\n\t\tdelete(key) {\n\t\t\tif (DEBUG) { console.log(`[<SimpleStore:${this.name}>.delete(key: \"${key}\") : Boolean]`); }\n\n\t\t\tif (typeof key !== 'string' || !key) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tthis._engine.removeItem(this._prefix + key);\n\n\t\t\treturn true;\n\t\t}\n\n\t\tclear() {\n\t\t\tif (DEBUG) { console.log(`[<SimpleStore:${this.name}>.clear() : Boolean]`); }\n\n\t\t\tconst keys = this.keys();\n\n\t\t\tfor (let i = 0, iend = keys.length; i < iend; ++i) {\n\t\t\t\tif (DEBUG) { console.log('\\tdeleting key:', keys[i]); }\n\n\t\t\t\tthis.delete(keys[i]);\n\t\t\t}\n\n\t\t\t// return this.keys().forEach(key => {\n\t\t\t// \tif (DEBUG) { console.log('\\tdeleting key:', key); }\n\t\t\t//\n\t\t\t// \tthis.delete(key);\n\t\t\t// });\n\n\t\t\treturn true;\n\t\t}\n\n\t\tstatic _serialize(obj) {\n\t\t\tif (Config.saves.useLZString === 1) return LZString.compressToUTF16(JSON.stringify(obj));\n\t\t\treturn JSON.stringify(obj);\n\t\t}\n\n\t\tstatic _deserialize(str) {\n\t\t\tlet parsedObj = null;\n\t\t\t// parse as JSON string by default, switch to LZString\n\t\t\ttry {\n\t\t\t\tparsedObj = JSON.parse(str);\n\t\t\t\tif (Config.saves.useLZString === -1) Config.saves.useLZString = 0;\n\t\t\t}\n\t\t\tcatch (ex) {\n\t\t\t\tparsedObj = JSON.parse(LZString.decompressFromUTF16(str));\n\t\t\t\tif (Config.saves.useLZString === -1) Config.saves.useLZString = 1;\n\t\t\t}\n\t\t\treturn parsedObj;\n\t\t}\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tAdapter Utility Functions.\n\t*******************************************************************************************************************/\n\tfunction adapterInit() {\n\t\t// Web Storage feature test.\n\t\tfunction hasWebStorage(storeId) {\n\t\t\ttry {\n\t\t\t\tconst store = window[storeId];\n\t\t\t\tconst tid   = `_sc_${String(Date.now())}`;\n\t\t\t\tstore.setItem(tid, tid);\n\t\t\t\tconst result = store.getItem(tid) === tid;\n\t\t\t\tstore.removeItem(tid);\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\tcatch (ex) { /* no-op */ }\n\n\t\t\treturn false;\n\t\t}\n\n\t\t/*\n\t\t\tJust to be safe, we feature test for both `localStorage` and `sessionStorage`,\n\t\t\tas you never know what browser implementation bugs you're going to run into.\n\t\t*/\n\t\t_ok = hasWebStorage('localStorage') && hasWebStorage('sessionStorage');\n\n\t\treturn _ok;\n\t}\n\n\tfunction adapterCreate(storageId, persistent) {\n\t\tif (!_ok) {\n\t\t\tthrow new Error('adapter not initialized');\n\t\t}\n\n\t\treturn new _WebStorageAdapter(storageId, persistent);\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************************************************/\n\treturn Object.freeze(Object.defineProperties({}, {\n\t\tinit   : { value : adapterInit },\n\t\tcreate : { value : adapterCreate }\n\t}));\n})());\n\n/***********************************************************************************************************************\n\n\tlib/simplestore/adapters/cookie.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/* global SimpleStore, Util */\n\nSimpleStore.adapters.push((() => {\n\t'use strict';\n\n\t// Expiry constants.\n\tconst _MAX_EXPIRY = 'Tue, 19 Jan 2038 03:14:07 GMT'; // (new Date((Math.pow(2, 31) - 1) * 1000)).toUTCString()\n\tconst _MIN_EXPIRY = 'Thu, 01 Jan 1970 00:00:00 GMT'; // (new Date(0)).toUTCString()\n\n\t// Adapter readiness state.\n\tlet _ok = false;\n\n\n\t/*******************************************************************************************************************\n\t\t_CookieAdapter Class.\n\t*******************************************************************************************************************/\n\tclass _CookieAdapter {\n\t\tconstructor(storageId, persistent) {\n\t\t\tconst prefix = `${storageId}${persistent ? '!' : '*'}.`;\n\n\t\t\tObject.defineProperties(this, {\n\t\t\t\t_prefix : {\n\t\t\t\t\tvalue : prefix\n\t\t\t\t},\n\n\t\t\t\t_prefixRe : {\n\t\t\t\t\tvalue : new RegExp(`^${RegExp.escape(prefix)}`)\n\t\t\t\t},\n\n\t\t\t\tname : {\n\t\t\t\t\tvalue : 'cookie'\n\t\t\t\t},\n\n\t\t\t\tid : {\n\t\t\t\t\tvalue : storageId\n\t\t\t\t},\n\n\t\t\t\tpersistent : {\n\t\t\t\t\tvalue : !!persistent\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t/* legacy */\n\t\tget length() {\n\t\t\tif (DEBUG) { console.log(`[<SimpleStore:${this.name}>.length : Number]`); }\n\n\t\t\treturn this.keys().length;\n\t\t}\n\t\t/* /legacy */\n\n\t\tsize() {\n\t\t\tif (DEBUG) { console.log(`[<SimpleStore:${this.name}>.size() : Number]`); }\n\n\t\t\treturn this.keys().length;\n\t\t}\n\n\t\tkeys() {\n\t\t\tif (DEBUG) { console.log(`[<SimpleStore:${this.name}>.keys() : String Array]`); }\n\n\t\t\tif (document.cookie === '') {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tconst cookies = document.cookie.split(/;\\s*/);\n\t\t\tconst keys    = [];\n\n\t\t\tfor (let i = 0; i < cookies.length; ++i) {\n\t\t\t\tconst kvPair = cookies[i].split('=');\n\t\t\t\tconst key    = decodeURIComponent(kvPair[0]);\n\n\t\t\t\tif (this._prefixRe.test(key)) {\n\t\t\t\t\t/*\n\t\t\t\t\t\tAll stored values are serialized and an empty string serializes to a non-empty\n\t\t\t\t\t\tstring.  Therefore, receiving an empty string here signifies a deleted value,\n\t\t\t\t\t\tnot a serialized empty string, so we should omit such pairs.\n\t\t\t\t\t*/\n\t\t\t\t\tconst value = decodeURIComponent(kvPair[1]);\n\n\t\t\t\t\tif (value !== '') {\n\t\t\t\t\t\tkeys.push(key.replace(this._prefixRe, ''));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn keys;\n\t\t}\n\n\t\thas(key) {\n\t\t\tif (DEBUG) { console.log(`[<SimpleStore:${this.name}>.has(key: \"${key}\") : Boolean]`); }\n\n\t\t\tif (typeof key !== 'string' || !key) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn _CookieAdapter._getCookie(this._prefix + key) !== null;\n\t\t}\n\n\t\tget(key) {\n\t\t\tif (DEBUG) { console.log(`[<SimpleStore:${this.name}>.get(key: \"${key}\") : Any]`); }\n\n\t\t\tif (typeof key !== 'string' || !key) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst value = _CookieAdapter._getCookie(this._prefix + key);\n\n\t\t\treturn value === null ? null : _CookieAdapter._deserialize(value);\n\t\t}\n\n\t\tset(key, value) {\n\t\t\tif (DEBUG) { console.log(`[<SimpleStore:${this.name}>.set(key: \"${key}\", value: \\u2026) : Boolean]`); }\n\n\t\t\tif (typeof key !== 'string' || !key) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\t_CookieAdapter._setCookie(\n\t\t\t\t\tthis._prefix + key,\n\t\t\t\t\t_CookieAdapter._serialize(value),\n\n\t\t\t\t\t// An undefined expiry denotes a session cookie.\n\t\t\t\t\tthis.persistent ? _MAX_EXPIRY : undefined\n\t\t\t\t);\n\n\t\t\t\tif (!this.has(key)) {\n\t\t\t\t\tthrow new Error('unknown validation error during set');\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (ex) {\n\t\t\t\t// Massage the cookie exception into something a bit nicer for the player.\n\t\t\t\tthrow Util.newExceptionFrom(ex, Error, `cookie error: ${ex.message}`);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\n\t\tdelete(key) {\n\t\t\tif (DEBUG) { console.log(`[<SimpleStore:${this.name}>.delete(key: \"${key}\") : Boolean]`); }\n\n\t\t\t/*\n\t\t\t\tAttempting to delete a cookie implies setting it, so we test for its existence\n\t\t\t\tbeforehand, to avoid creating it in the event that it does not already exist.\n\t\t\t*/\n\t\t\tif (typeof key !== 'string' || !key || !this.has(key)) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\t_CookieAdapter._setCookie(\n\t\t\t\t\tthis._prefix + key,\n\n\t\t\t\t\t// Use `undefined` as the value.\n\t\t\t\t\tundefined,\n\n\t\t\t\t\t// Use the epoch as the expiry.\n\t\t\t\t\t_MIN_EXPIRY\n\t\t\t\t);\n\n\t\t\t\tif (this.has(key)) {\n\t\t\t\t\tthrow new Error('unknown validation error during delete');\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (ex) {\n\t\t\t\t// Massage the cookie exception into something a bit nicer for the player.\n\t\t\t\tthrow Util.newExceptionFrom(ex, Error, `cookie error: ${ex.message}`);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\n\t\tclear() {\n\t\t\tif (DEBUG) { console.log(`[<SimpleStore:${this.name}>.clear() : Boolean]`); }\n\n\t\t\tconst keys = this.keys();\n\n\t\t\tfor (let i = 0, iend = keys.length; i < iend; ++i) {\n\t\t\t\tif (DEBUG) { console.log('\\tdeleting key:', keys[i]); }\n\n\t\t\t\tthis.delete(keys[i]);\n\t\t\t}\n\n\t\t\t// this.keys().forEach(key => {\n\t\t\t// \tif (DEBUG) { console.log('\\tdeleting key:', key); }\n\t\t\t//\n\t\t\t// \tthis.delete(key);\n\t\t\t// });\n\n\t\t\treturn true;\n\t\t}\n\n\t\tstatic _getCookie(prefixedKey) {\n\t\t\tif (!prefixedKey || document.cookie === '') {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst cookies = document.cookie.split(/;\\s*/);\n\n\t\t\tfor (let i = 0; i < cookies.length; ++i) {\n\t\t\t\tconst kvPair = cookies[i].split('=');\n\t\t\t\tconst key    = decodeURIComponent(kvPair[0]);\n\n\t\t\t\tif (prefixedKey === key) {\n\t\t\t\t\tconst value = decodeURIComponent(kvPair[1]);\n\n\t\t\t\t\t/*\n\t\t\t\t\t\tAll stored values are serialized and an empty string serializes to a non-empty\n\t\t\t\t\t\tstring.  Therefore, receiving an empty string here signifies a deleted value,\n\t\t\t\t\t\tnot a serialized empty string, so we should yield `null` for such pairs.\n\t\t\t\t\t*/\n\t\t\t\t\treturn value || null;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn null;\n\t\t}\n\n\t\tstatic _setCookie(prefixedKey, value, expiry) {\n\t\t\tif (!prefixedKey) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet payload = `${encodeURIComponent(prefixedKey)}=`;\n\n\t\t\tif (value != null) { // lazy equality for null\n\t\t\t\tpayload += encodeURIComponent(value);\n\t\t\t}\n\n\t\t\tif (expiry != null) { // lazy equality for null\n\t\t\t\tpayload += `; expires=${expiry}`;\n\t\t\t}\n\n\t\t\tpayload += '; path=/';\n\t\t\tdocument.cookie = payload;\n\t\t}\n\n\t\tstatic _serialize(obj) {\n\t\t\t// return LZString.compressToBase64(JSON.stringify(obj)); // TODO keep LZString a config option?\n\t\t\treturn JSON.stringify(obj);\n\t\t}\n\n\t\tstatic _deserialize(str) {\n\t\t\t// return JSON.parse(LZString.decompressFromBase64(str));\n\t\t\treturn JSON.parse(str);\n\t\t}\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tAdapter Utility Functions.\n\t*******************************************************************************************************************/\n\tfunction adapterInit(\n\t\t// Only used for stores updates.\n\t\tstorageId\n\t) {\n\t\t// Cookie feature test.\n\t\ttry {\n\t\t\tconst tid = `_sc_${String(Date.now())}`;\n\n\t\t\t// We only test a session cookie as that should suffice.\n\t\t\t_CookieAdapter._setCookie(tid, _CookieAdapter._serialize(tid), undefined);\n\t\t\t_ok = _CookieAdapter._deserialize(_CookieAdapter._getCookie(tid)) === tid;\n\t\t\t_CookieAdapter._setCookie(tid, undefined, _MIN_EXPIRY);\n\t\t}\n\t\tcatch (ex) {\n\t\t\t_ok = false;\n\t\t}\n\n\t\t/* legacy */\n\t\t// Attempt to update the cookie stores, if necessary.  This should happen only during initialization.\n\t\tif (_ok) {\n\t\t\t_updateCookieStores(storageId);\n\t\t}\n\t\t/* /legacy */\n\n\t\treturn _ok;\n\t}\n\n\tfunction adapterCreate(storageId, persistent) {\n\t\tif (!_ok) {\n\t\t\tthrow new Error('adapter not initialized');\n\t\t}\n\n\t\treturn new _CookieAdapter(storageId, persistent);\n\t}\n\n\t/* legacy */\n\t// Updates old non-segmented cookie stores into segmented stores.\n\tfunction _updateCookieStores(storageId) {\n\t\tif (document.cookie === '') {\n\t\t\treturn;\n\t\t}\n\n\t\tconst oldPrefix     = `${storageId}.`;\n\t\tconst oldPrefixRe   = new RegExp(`^${RegExp.escape(oldPrefix)}`);\n\t\tconst persistPrefix = `${storageId}!.`;\n\t\tconst sessionPrefix = `${storageId}*.`;\n\t\tconst sessionTestRe = /\\.(?:state|rcWarn)$/;\n\t\tconst cookies       = document.cookie.split(/;\\s*/);\n\n\t\tfor (let i = 0; i < cookies.length; ++i) {\n\t\t\tconst kvPair = cookies[i].split('=');\n\t\t\tconst key    = decodeURIComponent(kvPair[0]);\n\n\t\t\tif (oldPrefixRe.test(key)) {\n\t\t\t\t/*\n\t\t\t\t\tAll stored values are serialized and an empty string serializes to a non-empty\n\t\t\t\t\tstring.  Therefore, receiving an empty string here signifies a deleted value,\n\t\t\t\t\tnot a serialized empty string, so we should skip processing such pairs.\n\t\t\t\t*/\n\t\t\t\tconst value = decodeURIComponent(kvPair[1]);\n\n\t\t\t\tif (value !== '') {\n\t\t\t\t\tconst persist = !sessionTestRe.test(key);\n\n\t\t\t\t\t// Delete the old k/v pair.\n\t\t\t\t\t_CookieAdapter._setCookie(\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t_MIN_EXPIRY\n\t\t\t\t\t);\n\n\t\t\t\t\t// Set the new k/v pair.\n\t\t\t\t\t_CookieAdapter._setCookie(\n\t\t\t\t\t\tkey.replace(oldPrefixRe, () => persist ? persistPrefix : sessionPrefix),\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tpersist ? _MAX_EXPIRY : undefined\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t/* /legacy */\n\n\n\t/*******************************************************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************************************************/\n\treturn Object.freeze(Object.defineProperties({}, {\n\t\tinit   : { value : adapterInit },\n\t\tcreate : { value : adapterCreate }\n\t}));\n})());\n\n/***********************************************************************************************************************\n\n\tlib/debugview.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\n/*\n\tTODO: Make this use jQuery throughout.\n*/\nvar DebugView = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\t/*******************************************************************************************************************\n\t\tDebugView Class.\n\t*******************************************************************************************************************/\n\tclass DebugView {\n\t\tconstructor(parent, type, name, title) {\n\t\t\tObject.defineProperties(this, {\n\t\t\t\tparent : {\n\t\t\t\t\tvalue : parent\n\t\t\t\t},\n\n\t\t\t\tview : {\n\t\t\t\t\tvalue : document.createElement('span')\n\t\t\t\t},\n\n\t\t\t\tbreak : {\n\t\t\t\t\tvalue : document.createElement('wbr')\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t// Set up the wrapper (`<span>`) element.\n\t\t\tjQuery(this.view)\n\t\t\t\t.attr({\n\t\t\t\t\ttitle,\n\t\t\t\t\t'aria-label' : title,\n\t\t\t\t\t'data-type'  : type != null ? type : '', // lazy equality for null\n\t\t\t\t\t'data-name'  : name != null ? name : ''  // lazy equality for null\n\t\t\t\t})\n\t\t\t\t.addClass('debug');\n\n\t\t\t// Set up the word break (`<wbr>`) element.\n\t\t\tjQuery(this.break).addClass('debug hidden');\n\n\t\t\t// Add the wrapper (`<span>`) and word break (`<wbr>`) elements to the `parent` element.\n\t\t\tthis.parent.appendChild(this.view);\n\t\t\tthis.parent.appendChild(this.break);\n\t\t}\n\n\t\tget output() {\n\t\t\treturn this.view;\n\t\t}\n\n\t\tget type() {\n\t\t\treturn this.view.getAttribute('data-type');\n\t\t}\n\t\tset type(type) {\n\t\t\tthis.view.setAttribute('data-type', type != null ? type : ''); // lazy equality for null\n\t\t}\n\n\t\tget name() {\n\t\t\treturn this.view.getAttribute('data-name');\n\t\t}\n\t\tset name(name) {\n\t\t\tthis.view.setAttribute('data-name', name != null ? name : ''); // lazy equality for null\n\t\t}\n\n\t\tget title() {\n\t\t\treturn this.view.title;\n\t\t}\n\t\tset title(title) {\n\t\t\tthis.view.title = title;\n\t\t}\n\n\t\tappend(el) {\n\t\t\tjQuery(this.view).append(el);\n\t\t\treturn this;\n\t\t}\n\n\t\tmodes(options) {\n\t\t\tif (options == null) { // lazy equality for null\n\t\t\t\tconst current = {};\n\n\t\t\t\tthis.view.className.splitOrEmpty(/\\s+/).forEach(name => {\n\t\t\t\t\tif (name !== 'debug') {\n\t\t\t\t\t\tcurrent[name] = true;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\treturn current;\n\t\t\t}\n\t\t\telse if (typeof options === 'object') {\n\t\t\t\tObject.keys(options).forEach(function (name) {\n\t\t\t\t\tthis[options[name] ? 'addClass' : 'removeClass'](name);\n\t\t\t\t}, jQuery(this.view));\n\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tthrow new Error('DebugView.prototype.modes options parameter must be an object or null/undefined');\n\t\t}\n\n\t\tremove() {\n\t\t\tconst $view = jQuery(this.view);\n\n\t\t\tif (this.view.hasChildNodes()) {\n\t\t\t\t$view.contents().appendTo(this.parent);\n\t\t\t}\n\n\t\t\t$view.remove();\n\t\t\tjQuery(this.break).remove();\n\t\t}\n\n\t\tstatic isEnabled() {\n\t\t\treturn jQuery(document.documentElement).attr('data-debug-view') === 'enabled';\n\t\t}\n\n\t\tstatic enable() {\n\t\t\tjQuery(document.documentElement).attr('data-debug-view', 'enabled');\n\t\t\tjQuery.event.trigger(':debugviewupdate');\n\t\t}\n\n\t\tstatic disable() {\n\t\t\tjQuery(document.documentElement).removeAttr('data-debug-view');\n\t\t\tjQuery.event.trigger(':debugviewupdate');\n\t\t}\n\n\t\tstatic toggle() {\n\t\t\tif (jQuery(document.documentElement).attr('data-debug-view') === 'enabled') {\n\t\t\t\tDebugView.disable();\n\t\t\t}\n\t\t\telse {\n\t\t\t\tDebugView.enable();\n\t\t\t}\n\t\t}\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************************************************/\n\treturn DebugView;\n})();\n\n/***********************************************************************************************************************\n\n\tlib/nodetyper.js\n\n\tCopyright © 2020–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/* global Util */\n\nvar NodeTyper = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\t/*******************************************************************************************************************\n\t\tNodeTyper Class.\n\t*******************************************************************************************************************/\n\tclass NodeTyper {\n\t\tconstructor(config) {\n\t\t\tif (typeof config !== 'object' || config === null) {\n\t\t\t\tthrow new Error(`config parameter must be an object (received: ${Util.getType(config)})`);\n\t\t\t}\n\t\t\tif (!config.hasOwnProperty('targetNode') || !(config.targetNode instanceof Node)) {\n\t\t\t\tthrow new Error('config parameter object \"targetNode\" property must be a node');\n\t\t\t}\n\n\t\t\tObject.defineProperties(this, {\n\t\t\t\tnode : {\n\t\t\t\t\tvalue : config.targetNode\n\t\t\t\t},\n\n\t\t\t\tchildNodes : {\n\t\t\t\t\tvalue : []\n\t\t\t\t},\n\n\t\t\t\tnodeValue : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : ''\n\t\t\t\t},\n\n\t\t\t\tappendTo : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : config.parentNode || null\n\t\t\t\t},\n\n\t\t\t\tclassNames : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : config.classNames || null\n\t\t\t\t},\n\n\t\t\t\tfinished : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : false\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tconst node = this.node;\n\n\t\t\tif (node.nodeValue) {\n\t\t\t\tthis.nodeValue = node.nodeValue;\n\t\t\t\tnode.nodeValue = '';\n\t\t\t}\n\n\t\t\tlet childNode;\n\n\t\t\twhile ((childNode = node.firstChild) !== null) {\n\t\t\t\tthis.childNodes.push(new NodeTyper({\n\t\t\t\t\ttargetNode : childNode,\n\t\t\t\t\tparentNode : node,\n\t\t\t\t\tclassNames : this.classNames\n\t\t\t\t}));\n\n\t\t\t\tnode.removeChild(childNode);\n\t\t\t}\n\t\t}\n\n\t\tfinish() {\n\t\t\twhile (this.type(true)) /* no-op */;\n\t\t\treturn false;\n\t\t}\n\n\t\ttype(flush) {\n\t\t\tif (this.finished) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (this.appendTo) {\n\t\t\t\tthis.appendTo.appendChild(this.node);\n\t\t\t\tthis.appendTo = null;\n\n\t\t\t\t// Immediately finish typing this node if….\n\t\t\t\tif (\n\t\t\t\t\t// …it's neither a element or text node.\n\t\t\t\t\tthis.node.nodeType !== Node.ELEMENT_NODE && this.node.nodeType !== Node.TEXT_NODE\n\n\t\t\t\t\t// …or the computed value of its parent node's `display` property is `'none'`.\n\t\t\t\t\t|| jQuery(this.node.parentNode).css('display') === 'none'\n\t\t\t\t) {\n\t\t\t\t\treturn this.finish();\n\t\t\t\t}\n\n\t\t\t\tif (this.node.parentNode && this.classNames) {\n\t\t\t\t\tjQuery(this.node.parentNode).addClass(this.classNames);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.nodeValue) {\n\t\t\t\tif (flush) {\n\t\t\t\t\t// Concatenate here in case we've already done some processing.\n\t\t\t\t\tthis.node.nodeValue += this.nodeValue;\n\t\t\t\t\tthis.nodeValue = '';\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t// Use `Util.charAndPosAt()` here to properly handle Unicode code points\n\t\t\t\t\t// that are comprised of surrogate pairs.\n\t\t\t\t\tconst { char, start, end } = Util.charAndPosAt(this.nodeValue, 0);\n\t\t\t\t\tthis.node.nodeValue += char;\n\t\t\t\t\tthis.nodeValue = this.nodeValue.slice(1 + end - start);\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif (this.classNames) {\n\t\t\t\tjQuery(this.node.parentNode).removeClass(this.classNames);\n\t\t\t\tthis.classNames = null;\n\t\t\t}\n\n\t\t\tconst childNodes = this.childNodes;\n\n\t\t\twhile (childNodes.length > 0) {\n\t\t\t\tif (childNodes[0].type()) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tchildNodes.shift();\n\t\t\t}\n\n\t\t\tthis.finished = true;\n\t\t\treturn false;\n\t\t}\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************************************************/\n\treturn NodeTyper;\n})();\n\n/* dumb predictable rng algorithm that i came up with as i was falling asleep yesterday */\n/* copyleft anomajou, 2024 */\n/* also, you owe author a beer now */\n\nclass PRNG {\n\tconstructor(seed, pull) {\n\t\t// primes are a prime source of entropy in our generator. pun intended. intend your puns, people!\n\t\tthis.primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29];\n\t\t// limiter makes sure that after multiplying all parts of a randomizer at their maximum theoretical values, we\n\t\t// are still below Number.MAX_SAFE_INTEGER, for better granularity.\n\t\t// incidentally, it ends up being 17623651, a prime number, which is perfect for our use\n\t\tthis.limiter = Math.floor(Math.sqrt(Number.MAX_SAFE_INTEGER / this.primes[this.primes.length - 1]));\n\t\t// factor needs to consistently overflow the limiter in an inconsistent way when multiplied by integers in\n\t\t// increments of 1, so ideally it has to be another prime in the interval (limiter/2 .. limiter).\n\t\t// unlike the limiter, it is much harder to determine programmatically...\n\t\t// note: if Number.MAX_SAFE_INTEGER is NOT 9007199254740991 on your system - you need to adjust this factor!\n\t\tthis.factor = 12345653;\n\t\t// pull is the number of times random() was called, and the main input of our generator.\n\t\t// it doesn't actually have to be an integer, just incrementable\n\t\tthis.pull = Number(pull) || 0;\n\t\t// seed is the second input for the generator. it has to be below ~1 to stay within MAX_SAFE_INTEGER (although\n\t\t// it doesn't hurt much if it's not), and it shouldn't be below ~0.25, or the factor will have trouble\n\t\t// overflowing as often as it should. still, other values should be possible, for science\n\t\tswitch (typeof seed) {\n\t\tcase 'number': {\n\t\t\tif (seed < 0.25 || seed > 1) console.warn(`recommended seed value is between 0.25 and 1, got ${seed}`);\n\t\t\tthis.seed = seed;\n\t\t\tbreak;\n\t\t}\n\t\tcase 'string': {\n\t\t\t// map character codes onto an interval between 0.25 and 1\n\t\t\t// then at some point it came to me that original string is worth preserving, so let's do that\n\t\t\tthis.seed = seed;\n\t\t\tthis.seedInt = this.str2int(seed);\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tthis.seed = (Math.random() * 3 + 1) / 4;\n\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * stupid randomizer function\n\t * @param {number} [peek=0] if set, predicts the number that is n steps ahead instead of advancing to the next one\n\t * @returns {number (0, 1)} random number between 0 and 1, non-inclusive\n\t */\n\trandom(peek = 0) {\n\t\tif (!peek) ++this.pull;\n\t\tconst limiter = this.limiter;\n\t\t// prefer seedInt before seed, allowing seed to stay a string\n\t\tconst seed = this.seedInt || this.seed;\n\t\t// make sure seed matters more by affecting effective pull so the chaos can catch up\n\t\t// chaos in this case being the ability of tiny variation in seed to result in huge difference in the outcome\n\t\t// remember, the real this.pull is meant to represent the real number of times random() was called\n\t\tconst pull = Math.floor((this.pull + peek + seed * 4327) % limiter) + 1;\n\t\t// get some extra entropy by alternating primes\n\t\tconst extra = this.primes[pull % (this.primes.length - 1)];\n\t\treturn pull * seed * extra * this.factor % (limiter - 1) / limiter;\n\t}\n\n\t/**\n\t * function to peek into the list of n future random values without altering the pull value\n\t * @param {number} depth how many numbers to return\n\t * @returns {Array} list of predicted random numbers ahead\n\t */\n\tpeek(depth = 1) {\n\t\tif (!Number.isInteger(depth)) return console.error(`can't look ahead ${depth} times`);\n\t\tif (depth > 9000) return console.error('it\\'s over 9000!');\n\t\tconst result = [];\n\t\tfor (let i = 1; i <= depth; ++i) result.push(this.random(i));\n\t\treturn result;\n\t}\n\n\t/**\n\t * string to seed converter\n\t * @param {string} string to convert\n\t * @returns {number [0.25, 1]} float between 0.25 and 1, inclusive\n\t */\n\tstr2int(string) {\n\t\tlet sum = 0;\n\t\tlet count = 0;\n\t\tfor (const char of string) {\n\t\t\tconst code = char.charCodeAt();\n\t\t\t// i don't want your emojis and non-ascii characters\n\t\t\tif (code < 32 || code > 127) continue;\n\t\t\tsum += code - 32;\n\t\t\t++count;\n\t\t}\n\t\t// some strings might lack valid characters to count, especially empty strings\n\t\treturn count ? sum / count / 127 + 0.25 : 0.25;\n\t}\n\n\t/**\n\t * test function to check the random distribution\n\t * @param {number} count how many times to roll\n\t * @param {number} granularity how many baskets to fill\n\t * @returns {Array} how many times each basket was hit\n\t */\n\ttest(count = 10, granularity = 10, advancerng) {\n\t\tconst distribution = new Array(granularity).fill(0);\n\t\tfor (let i = 1; i <= count; ++i) ++distribution[Math.floor(this.random(i) * granularity)];\n\t\tif (advancerng) this.pull += count;\n\t\treturn distribution;\n\t}\n}\nwindow.PRNG = PRNG;\n\n/***********************************************************************************************************************\n\n\tlib/stylewrapper.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/* global Patterns, Story, Wikifier */\n\nvar StyleWrapper = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\tconst _imageMarkupRe    = new RegExp(Patterns.cssImage, 'g');\n\tconst _hasImageMarkupRe = new RegExp(Patterns.cssImage);\n\n\n\t/*******************************************************************************************************************\n\t\tStyleWrapper Class.\n\t*******************************************************************************************************************/\n\tclass StyleWrapper {\n\t\tconstructor(style) {\n\t\t\tif (style == null) { // lazy equality for null\n\t\t\t\tthrow new TypeError('StyleWrapper style parameter must be an HTMLStyleElement object');\n\t\t\t}\n\n\t\t\tObject.defineProperties(this, {\n\t\t\t\tstyle : {\n\t\t\t\t\tvalue : style\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tisEmpty() {\n\t\t\t// This should work in all supported browsers.\n\t\t\treturn this.style.cssRules.length === 0;\n\t\t}\n\n\t\tset(rawCss) {\n\t\t\tthis.clear();\n\t\t\tthis.add(rawCss);\n\t\t}\n\n\t\tadd(rawCss) {\n\t\t\tlet css = rawCss;\n\n\t\t\t// Check for wiki image transclusion.\n\t\t\tif (_hasImageMarkupRe.test(css)) {\n\t\t\t\t/*\n\t\t\t\t\tThe JavaScript specifications, since at least ES3, say that `<String>.replace()`\n\t\t\t\t\tshould reset a global-flagged regular expression's `lastIndex` property to `0`\n\t\t\t\t\tupon invocation.  Buggy browser versions exist, however, which do not reset\n\t\t\t\t\t`lastIndex`, so we should do so manually to support those browsers.\n\n\t\t\t\t\tNOTE: I do not think this is actually necessary, since `_imageMarkupRe` is\n\t\t\t\t\tscoped to this module—meaning users should not be able to access it.  That\n\t\t\t\t\tbeing the case, and since we search to exhaustion which should also cause\n\t\t\t\t\t`lastIndex` to be reset, there should never be an instance where we invoke\n\t\t\t\t\t`css.replace()` and `_imageMarkupRe.lastIndex` is not already `0`.  Still,\n\t\t\t\t\tconsidering the other bug, better safe than sorry.\n\t\t\t\t*/\n\t\t\t\t_imageMarkupRe.lastIndex = 0;\n\n\t\t\t\tcss = css.replace(_imageMarkupRe, wikiImage => {\n\t\t\t\t\tconst markup = Wikifier.helpers.parseSquareBracketedMarkup({\n\t\t\t\t\t\tsource     : wikiImage,\n\t\t\t\t\t\tmatchStart : 0\n\t\t\t\t\t});\n\n\t\t\t\t\tif (markup.hasOwnProperty('error') || markup.pos < wikiImage.length) {\n\t\t\t\t\t\treturn wikiImage;\n\t\t\t\t\t}\n\n\t\t\t\t\tlet source = markup.source;\n\n\t\t\t\t\t// Handle image passage transclusion.\n\t\t\t\t\tif (source.slice(0, 5) !== 'data:' && Story.has(source)) {\n\t\t\t\t\t\tconst passage = Story.get(source);\n\n\t\t\t\t\t\tif (passage.tags.includes('Twine.image')) {\n\t\t\t\t\t\t\tsource = passage.text.trim();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t/*\n\t\t\t\t\t\tThe source may be URI- or Base64-encoded, so we cannot use `encodeURIComponent()`\n\t\t\t\t\t\there.  Instead, we simply encode any double quotes, since the URI will be\n\t\t\t\t\t\tdelimited by them.\n\t\t\t\t\t*/\n\t\t\t\t\treturn `url(\"${source.replace(/\"/g, '%22')}\")`;\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// For IE ≤ 10.\n\t\t\tif (this.style.styleSheet) {\n\t\t\t\tthis.style.styleSheet.cssText += css;\n\t\t\t}\n\n\t\t\t// For all other browsers (incl. IE ≥ 11).\n\t\t\telse {\n\t\t\t\tthis.style.appendChild(document.createTextNode(css));\n\t\t\t}\n\t\t}\n\n\t\tclear() {\n\t\t\t// For IE ≤10.\n\t\t\tif (this.style.styleSheet) {\n\t\t\t\tthis.style.styleSheet.cssText = '';\n\t\t\t}\n\n\t\t\t// For all other browsers (incl. IE ≥11).\n\t\t\telse {\n\t\t\t\tjQuery(this.style).empty();\n\t\t\t}\n\t\t}\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************************************************/\n\treturn StyleWrapper;\n})();\n\n/***********************************************************************************************************************\n\n\tutil/enumfrom.js\n\n\tCopyright © 2013–2023 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\n/*\n\tReturns a pseudo-enumeration object created from the given Array, Map, Set,\n\tor generic object.\n*/\nfunction enumFrom(O) { // eslint-disable-line no-unused-vars\n\tconst pEnum = Object.create(null);\n\n\tif (O instanceof Array) {\n\t\tO.forEach((val, i) => pEnum[String(val)] = i);\n\t}\n\telse if (O instanceof Set) {\n\t\t// NOTE: Use `<Array>.forEach()` here rather than `<Set>.forEach()`\n\t\t// as the latter does not provide the indices we require.\n\t\tArray.from(O).forEach((val, i) => pEnum[String(val)] = i);\n\t}\n\telse if (O instanceof Map) {\n\t\tO.forEach((val, key) => pEnum[String(key)] = val);\n\t}\n\telse if (\n\t\tO !== null\n\t\t&& typeof O === 'object'\n\t\t&& Object.getPrototypeOf(O) === Object.prototype\n\t) {\n\t\tObject.assign(pEnum, O);\n\t}\n\telse {\n\t\tthrow new TypeError('enumFrom object parameter must be an Array, Map, Set, or generic object');\n\t}\n\n\treturn Object.freeze(Object.defineProperties(pEnum, {\n\t\tnameFrom : {\n\t\t\tvalue(needle) {\n\t\t\t\tconst entry = Object.entries(this).find(entry => entry[1] === needle);\n\t\t\t\treturn entry ? entry[0] : undefined;\n\t\t\t}\n\t\t}\n\t}));\n}\n\n/***********************************************************************************************************************\n\n\tlib/diff.js\n\n\tCopyright © 2013–2023 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/* global clone, enumFrom */\n\nvar Diff = (() => { // eslint-disable-line no-unused-vars, no-var\n\t// Diff operations object.\n\tconst Op = enumFrom({\n\t\tDelete      : 0,\n\t\tSpliceArray : 1,\n\t\tCopy        : 2,\n\n\t\t/* legacy */\n\t\tCopyDate : 3\n\t\t/* /legacy */\n\t});\n\n\n\t/*******************************************************************************\n\t\tDiff Functions.\n\t*******************************************************************************/\n\n\t// Returns whether the given value is a finite number or a numeric string\n\t// that yields a finite number when parsed.\n\tfunction isNumeric(O) {\n\t\tlet num;\n\n\t\tswitch (typeof O) {\n\t\t\tcase 'number': num = O; break;\n\t\t\tcase 'string': num = Number(O); break;\n\t\t\tdefault:       return false;\n\t\t}\n\n\t\treturn !Number.isNaN(num) && Number.isFinite(num);\n\t}\n\n\t// Returns a delta object generated from comparing the `a` and `b` objects.\n\tfunction diff(a, b) /* delta object */ {\n\t\tconst toString = Object.prototype.toString;\n\t\tconst aIsArray = a instanceof Array;\n\t\tconst delta    = Object.create(null);\n\t\tconst keys     = [...Object.keys(a), ...Object.keys(b)]\n\t\t\t.sort()\n\t\t\t.filter((val, i, arr) => i === 0 || arr[i - 1] !== val);\n\t\tlet aOpKey;\n\n\t\t// Array operation predicate.\n\t\tconst isAOpKey = key => key === aOpKey;\n\n\t\t/* eslint-disable max-depth */\n\t\tfor (let i = 0, klen = keys.length; i < klen; ++i) {\n\t\t\tconst key  = keys[i];\n\t\t\tconst aVal = a[key];\n\t\t\tconst bVal = b[key];\n\n\t\t\t// Key exists in `a`.\n\t\t\tif (Object.hasOwn(a, key)) {\n\t\t\t\t// Key exists in both.\n\t\t\t\tif (Object.hasOwn(b, key)) {\n\t\t\t\t\t// Values are exactly the same, so do nothing.\n\t\t\t\t\tif (aVal === bVal) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Values are of the same basic type.\n\t\t\t\t\tif (typeof aVal === typeof bVal) {\n\t\t\t\t\t\t// Values are functions.\n\t\t\t\t\t\tif (typeof aVal === 'function') {\n\t\t\t\t\t\t\t/* delta[key] = [Op.Copy, bVal]; */\n\t\t\t\t\t\t\tif (aVal.toString() !== bVal.toString()) {\n\t\t\t\t\t\t\t\tdelta[key] = [Op.Copy, bVal];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Values are primitives.\n\t\t\t\t\t\telse if (typeof aVal !== 'object' || aVal === null) {\n\t\t\t\t\t\t\tdelta[key] = [Op.Copy, bVal];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Values are objects.\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tconst aValType = toString.call(aVal);\n\t\t\t\t\t\t\tconst bValType = toString.call(bVal);\n\n\t\t\t\t\t\t\t// Values are objects of the same reported type.\n\t\t\t\t\t\t\tif (aValType === bValType) {\n\t\t\t\t\t\t\t\t// Supported natives and generic objects.\n\t\t\t\t\t\t\t\tif (aVal instanceof Date) {\n\t\t\t\t\t\t\t\t\tif (aVal.getTime() !== bVal.getTime()) {\n\t\t\t\t\t\t\t\t\t\tdelta[key] = [Op.Copy, clone(bVal)];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse if (aVal instanceof Map) {\n\t\t\t\t\t\t\t\t\tdelta[key] = [Op.Copy, clone(bVal)];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse if (aVal instanceof RegExp) {\n\t\t\t\t\t\t\t\t\tif (aVal.toString() !== bVal.toString()) {\n\t\t\t\t\t\t\t\t\t\tdelta[key] = [Op.Copy, clone(bVal)];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse if (aVal instanceof Set) {\n\t\t\t\t\t\t\t\t\tdelta[key] = [Op.Copy, clone(bVal)];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse if (aVal instanceof Array || aValType === '[object Object]') {\n\t\t\t\t\t\t\t\t\tconst subDelta = diff(aVal, bVal);\n\n\t\t\t\t\t\t\t\t\tif (subDelta !== null) {\n\t\t\t\t\t\t\t\t\t\tdelta[key] = subDelta;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t// Unknown non-generic objects (custom or unsupported natives).\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t// We cannot know how to process these objects,\n\t\t\t\t\t\t\t\t\t// so we simply accept them as-is.\n\t\t\t\t\t\t\t\t\tdelta[key] = [Op.Copy, clone(bVal)];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Values are objects of different reported types.\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tdelta[key] = [Op.Copy, clone(bVal)];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Values are of different types.\n\t\t\t\t\telse {\n\t\t\t\t\t\tdelta[key] = [\n\t\t\t\t\t\t\tOp.Copy,\n\t\t\t\t\t\t\ttypeof bVal !== 'object' || bVal === null ? bVal : clone(bVal)\n\t\t\t\t\t\t];\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Key exists only in `a`.\n\t\t\t\telse {\n\t\t\t\t\tif (aIsArray && isNumeric(key)) {\n\t\t\t\t\t\tconst index = Number(key);\n\n\t\t\t\t\t\tif (!aOpKey) {\n\t\t\t\t\t\t\taOpKey = '';\n\n\t\t\t\t\t\t\tdo {\n\t\t\t\t\t\t\t\taOpKey += '~';\n\t\t\t\t\t\t\t} while (keys.some(isAOpKey));\n\n\t\t\t\t\t\t\tdelta[aOpKey] = [Op.SpliceArray, index, index];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (index < delta[aOpKey][1]) {\n\t\t\t\t\t\t\tdelta[aOpKey][1] = index;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (index > delta[aOpKey][2]) {\n\t\t\t\t\t\t\tdelta[aOpKey][2] = index;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tdelta[key] = Op.Delete;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Key exists only in `b`.\n\t\t\telse {\n\t\t\t\tdelta[key] = [\n\t\t\t\t\tOp.Copy,\n\t\t\t\t\ttypeof bVal !== 'object' || bVal === null ? bVal : clone(bVal)\n\t\t\t\t];\n\t\t\t}\n\t\t}\n\t\t/* eslint-enable max-depth */\n\n\t\treturn Object.keys(delta).length > 0 ? delta : null;\n\t}\n\n\t// Returns the object resulting from updating the `orig` object with the\n\t// `delta` object.\n\tfunction patch(orig, delta) /* patched object */ {\n\t\tconst keys    = delta ? Object.keys(delta) : [];\n\t\tconst patched = clone(orig);\n\n\t\tfor (let i = 0, klen = keys.length; i < klen; ++i) {\n\t\t\tconst key   = keys[i];\n\t\t\tconst value = delta[key];\n\n\t\t\tif (value === Op.Delete) {\n\t\t\t\tdelete patched[key];\n\t\t\t}\n\t\t\telse if (value instanceof Array) {\n\t\t\t\tswitch (value[0]) {\n\t\t\t\t\tcase Op.SpliceArray:\n\t\t\t\t\t\tpatched.splice(value[1], value[2] - value[1] + 1);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase Op.Copy:\n\t\t\t\t\t\tpatched[key] = clone(value[1]);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t/* legacy */\n\t\t\t\t\tcase Op.CopyDate:\n\t\t\t\t\t\tpatched[key] = new Date(value[1]);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t/* /legacy */\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tpatched[key] = patch(patched[key], value);\n\t\t\t}\n\t\t}\n\n\t\treturn patched;\n\t}\n\n\n\t/*******************************************************************************\n\t\tObject Exports.\n\t*******************************************************************************/\n\n\treturn Object.preventExtensions(Object.create(null, {\n\t\tOp    : { value : Op },\n\t\tdiff  : { value : diff },\n\t\tpatch : { value : patch }\n\t}));\n})();\n\n/***********************************************************************************************************************\n\n\tl10n/l10n.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/* global l10nStrings, strings */\n\nvar L10n = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\t// Replacement pattern regular expressions.\n\tconst _patternRe    = /\\{\\w+\\}/g;\n\tconst _hasPatternRe = new RegExp(_patternRe.source); // to drop the global flag\n\n\n\t/*******************************************************************************************************************\n\t\tLocalization Functions.\n\t*******************************************************************************************************************/\n\tfunction l10nInit() {\n\t\t/* legacy */\n\t\t_mapStringsToL10nStrings();\n\t\t/* /legacy */\n\t}\n\n\t/*******************************************************************************************************************\n\t\tLocalized String Functions.\n\t*******************************************************************************************************************/\n\tfunction l10nGet(ids, overrides) {\n\t\tif (!ids) {\n\t\t\treturn '';\n\t\t}\n\n\t\tconst id = (idList => {\n\t\t\tlet selectedId;\n\t\t\tidList.some(id => {\n\t\t\t\tif (l10nStrings.hasOwnProperty(id)) {\n\t\t\t\t\tselectedId = id;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\t\t\t});\n\t\t\treturn selectedId;\n\t\t})(Array.isArray(ids) ? ids : [ids]);\n\n\t\tif (!id) {\n\t\t\treturn '';\n\t\t}\n\n\t\tconst maxIterations = 50;\n\t\tlet processed = l10nStrings[id];\n\t\tlet iteration = 0;\n\n\t\twhile (_hasPatternRe.test(processed)) {\n\t\t\tif (++iteration > maxIterations) {\n\t\t\t\tthrow new Error('L10n.get exceeded maximum replacement iterations, probable infinite loop');\n\t\t\t}\n\n\t\t\t// Possibly required by some old buggy browsers.\n\t\t\t_patternRe.lastIndex = 0;\n\n\t\t\tprocessed = processed.replace(_patternRe, pat => {\n\t\t\t\tconst subId = pat.slice(1, -1);\n\n\t\t\t\tif (overrides && overrides.hasOwnProperty(subId)) {\n\t\t\t\t\treturn overrides[subId];\n\t\t\t\t}\n\t\t\t\telse if (l10nStrings.hasOwnProperty(subId)) {\n\t\t\t\t\treturn l10nStrings[subId];\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treturn processed;\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tLegacy Functions.\n\t*******************************************************************************************************************/\n\t/*\n\t\tAttempt to map legacy `strings` object properties to the `l10nStrings` object.\n\t*/\n\tfunction _mapStringsToL10nStrings() {\n\t\tif (strings && Object.keys(strings).length > 0) {\n\t\t\tObject.keys(l10nStrings).forEach(id => {\n\t\t\t\ttry {\n\t\t\t\t\tlet value;\n\n\t\t\t\t\tswitch (id) {\n\t\t\t\t\t/*\n\t\t\t\t\t\tGeneral.\n\t\t\t\t\t*/\n\t\t\t\t\tcase 'identity': value = strings.identity; break;\n\t\t\t\t\tcase 'aborting': value = strings.aborting; break;\n\t\t\t\t\tcase 'cancel':   value = strings.cancel; break;\n\t\t\t\t\tcase 'close':    value = strings.close; break;\n\t\t\t\t\tcase 'ok':       value = strings.ok; break;\n\n\t\t\t\t\t/*\n\t\t\t\t\t\tErrors.\n\t\t\t\t\t*/\n\t\t\t\t\tcase 'errorTitle':              value = strings.errors.title; break;\n\t\t\t\t\tcase 'errorNonexistentPassage': value = strings.errors.nonexistentPassage; break;\n\t\t\t\t\tcase 'errorSaveMissingData':    value = strings.errors.saveMissingData; break;\n\t\t\t\t\tcase 'errorSaveIdMismatch':     value = strings.errors.saveIdMismatch; break;\n\n\t\t\t\t\t/*\n\t\t\t\t\t\tWarnings.\n\t\t\t\t\t*/\n\t\t\t\t\tcase 'warningDegraded': value = strings.warnings.degraded; break;\n\n\t\t\t\t\t/*\n\t\t\t\t\t\tDebug View.\n\t\t\t\t\t*/\n\t\t\t\t\tcase 'debugViewTitle':  value = strings.debugView.title; break;\n\t\t\t\t\tcase 'debugViewToggle': value = strings.debugView.toggle; break;\n\n\t\t\t\t\t/*\n\t\t\t\t\t\tUI bar.\n\t\t\t\t\t*/\n\t\t\t\t\tcase 'uiBarToggle':   value = strings.uiBar.toggle; break;\n\t\t\t\t\tcase 'uiBarBackward': value = strings.uiBar.backward; break;\n\t\t\t\t\tcase 'uiBarForward':  value = strings.uiBar.forward; break;\n\t\t\t\t\tcase 'uiBarJumpto':   value = strings.uiBar.jumpto; break;\n\n\t\t\t\t\t/*\n\t\t\t\t\t\tJump To.\n\t\t\t\t\t*/\n\t\t\t\t\tcase 'jumptoTitle':       value = strings.jumpto.title; break;\n\t\t\t\t\tcase 'jumptoTurn':        value = strings.jumpto.turn; break;\n\t\t\t\t\tcase 'jumptoUnavailable': value = strings.jumpto.unavailable; break;\n\n\t\t\t\t\t/*\n\t\t\t\t\t\tSaves.\n\t\t\t\t\t*/\n\t\t\t\t\tcase 'savesTitle':       value = strings.saves.title; break;\n\t\t\t\t\tcase 'savesDisallowed':  value = strings.saves.disallowed; break;\n\t\t\t\t\tcase 'savesIncapable':   value = strings.saves.incapable; break;\n\t\t\t\t\tcase 'savesLabelAuto':   value = strings.saves.labelAuto; break;\n\t\t\t\t\tcase 'savesLabelDelete': value = strings.saves.labelDelete; break;\n\t\t\t\t\tcase 'savesLabelExport': value = strings.saves.labelExport; break;\n\t\t\t\t\tcase 'savesLabelImport': value = strings.saves.labelImport; break;\n\t\t\t\t\tcase 'savesLabelLoad':   value = strings.saves.labelLoad; break;\n\t\t\t\t\tcase 'savesLabelClear':  value = strings.saves.labelClear; break;\n\t\t\t\t\tcase 'savesLabelSave':   value = strings.saves.labelSave; break;\n\t\t\t\t\tcase 'savesLabelSlot':   value = strings.saves.labelSlot; break;\n\t\t\t\t\tcase 'savesUnavailable': value = strings.saves.unavailable; break;\n\t\t\t\t\tcase 'savesUnknownDate': value = strings.saves.unknownDate; break;\n\n\t\t\t\t\t/*\n\t\t\t\t\t\tSettings.\n\t\t\t\t\t*/\n\t\t\t\t\tcase 'settingsTitle': value = strings.settings.title; break;\n\t\t\t\t\tcase 'settingsOff':   value = strings.settings.off; break;\n\t\t\t\t\tcase 'settingsOn':    value = strings.settings.on; break;\n\t\t\t\t\tcase 'settingsReset': value = strings.settings.reset; break;\n\n\t\t\t\t\t/*\n\t\t\t\t\t\tRestart.\n\t\t\t\t\t*/\n\t\t\t\t\tcase 'restartTitle':  value = strings.restart.title; break;\n\t\t\t\t\tcase 'restartPrompt': value = strings.restart.prompt; break;\n\n\t\t\t\t\t/*\n\t\t\t\t\t\tShare.\n\t\t\t\t\t*/\n\t\t\t\t\tcase 'shareTitle': value = strings.share.title; break;\n\n\t\t\t\t\t/*\n\t\t\t\t\t\tAlert.\n\t\t\t\t\t*/\n\t\t\t\t\tcase 'alertTitle': /* none */ break;\n\n\t\t\t\t\t/*\n\t\t\t\t\t\tAutoload.\n\t\t\t\t\t*/\n\t\t\t\t\tcase 'autoloadTitle':  value = strings.autoload.title; break;\n\t\t\t\t\tcase 'autoloadCancel': value = strings.autoload.cancel; break;\n\t\t\t\t\tcase 'autoloadOk':     value = strings.autoload.ok; break;\n\t\t\t\t\tcase 'autoloadPrompt': value = strings.autoload.prompt; break;\n\n\t\t\t\t\t/*\n\t\t\t\t\t\tMacros.\n\t\t\t\t\t*/\n\t\t\t\t\tcase 'macroBackText':   value = strings.macros.back.text; break;\n\t\t\t\t\tcase 'macroReturnText': value = strings.macros.return.text; break;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (value) {\n\t\t\t\t\t\tl10nStrings[id] = value.replace(/%\\w+%/g, pat => `{${pat.slice(1, -1)}}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (ex) { /* no-op */ }\n\t\t\t});\n\t\t}\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************************************************/\n\treturn Object.freeze(Object.defineProperties({}, {\n\t\t/*\n\t\t\tLocalization Functions.\n\t\t*/\n\t\tinit : { value : l10nInit },\n\n\t\t/*\n\t\t\tLocalized String Functions.\n\t\t*/\n\t\tget : { value : l10nGet }\n\t}));\n})();\n\n/***********************************************************************************************************************\n\n\tl10n/legacy.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\n/*\n\t[DEPRECATED] The `strings` object is deprecated and should no longer be used.\n\tAll new or updated translations should be based upon the `l10nStrings` object\n\t(see: `l10n/strings.js`).\n\n\tLegacy/existing uses of the `strings` object will be mapped to the `l10nStrings`\n\tobject after user script evaluation.\n*/\nvar strings = { // eslint-disable-line no-unused-vars, no-var\n\terrors    : {},\n\twarnings  : {},\n\tdebugView : {},\n\tuiBar     : {},\n\tjumpto    : {},\n\tsaves     : {},\n\tsettings  : {},\n\trestart   : {},\n\tshare     : {},\n\tautoload  : {},\n\tmacros    : {\n\t\tback   : {},\n\t\treturn : {}\n\t}\n};\n\n/***********************************************************************************************************************\n\n\tl10n/strings.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/* eslint-disable max-len, prefer-template */\n\n/*\n\tATTENTION TRANSLATORS\n\n\tPlease use the `locale/l10n-template.js` file, from the root of the repository,\n\tas the template for your translation rather than this file.\n\n\tSEE: https://github.com/tmedwards/sugarcube-2/tree/develop/locale\n*/\nvar l10nStrings = { // eslint-disable-line no-unused-vars, no-var\n\t/*\n\t\tGeneral.\n\t*/\n\tidentity : 'game',\n\taborting : 'Aborting',\n\tcancel   : 'Cancel',\n\tclose    : 'Close',\n\tok       : 'OK',\n\n\t/*\n\t\tErrors.\n\t*/\n\terrorTitle              : 'Error',\n\terrorToggle             : 'Toggle the error view',\n\terrorNonexistentPassage : 'the passage \"{passage}\" does not exist', // NOTE: `passage` is supplied locally\n\terrorSaveDiskLoadFailed : 'failed to load save file from disk',\n\terrorSaveMissingData    : 'save is missing required data. Either the loaded file is not a save or the save has become corrupted',\n\terrorSaveIdMismatch     : 'save is from the wrong {identity}',\n\n\t/*\n\t\tWarnings.\n\t*/\n\t_warningIntroLacking  : 'Your browser either lacks or has disabled',\n\t_warningOutroDegraded : ', so this {identity} is running in a degraded mode. You may be able to continue, however, some parts may not work properly.',\n\twarningNoWebStorage   : '{_warningIntroLacking} the Web Storage API{_warningOutroDegraded}',\n\twarningDegraded       : '{_warningIntroLacking} some of the capabilities required by this {identity}{_warningOutroDegraded}',\n\n\t/*\n\t\tDebug bar.\n\t*/\n\tdebugBarToggle      : 'Toggle the debug bar',\n\tdebugBarNoWatches   : '\\u2014 no watches set \\u2014',\n\tdebugBarAddWatch    : 'Add watch',\n\tdebugBarDeleteWatch : 'Delete watch',\n\tdebugBarWatchAll    : 'Watch all',\n\tdebugBarWatchNone   : 'Delete all',\n\tdebugBarLabelAdd    : 'Add',\n\tdebugBarLabelWatch  : 'Watch',\n\tdebugBarLabelTurn   : 'Turn', // (noun) chance to act (in a game), moment, period\n\tdebugBarLabelViews  : 'Views',\n\tdebugBarViewsToggle : 'Toggle the debug views',\n\tdebugBarWatchToggle : 'Toggle the watch panel',\n\n\t/*\n\t\tUI bar.\n\t*/\n\tuiBarToggle   : 'Toggle the UI bar',\n\tuiBarBackward : 'Go backward within the {identity} history',\n\tuiBarForward  : 'Go forward within the {identity} history',\n\tuiBarJumpto   : 'Jump to a specific point within the {identity} history',\n\n\t/*\n\t\tJump To.\n\t*/\n\tjumptoTitle       : 'Jump To',\n\tjumptoTurn        : 'Turn', // (noun) chance to act (in a game), moment, period\n\tjumptoUnavailable : 'No jump points currently available\\u2026',\n\n\t/*\n\t\tSaves.\n\t*/\n\tsavesTitle       : 'Saves',\n\tsavesDisallowed  : 'Saving has been disallowed on this passage.',\n\tsavesIncapable   : '{_warningIntroLacking} the capabilities required to support saves, so saves have been disabled for this session.',\n\tsavesLabelAuto   : 'Autosave',\n\tsavesLabelDelete : 'Delete ',\n\tsavesLabelExport : 'Save to Disk\\u2026',\n\tsavesLabelImport : 'Load from Disk\\u2026',\n\tsavesLabelLoad   : 'Load ',\n\tsavesLabelClear  : 'Delete All',\n\tsavesLabelSave   : 'Save',\n\tsavesLabelSlot   : 'Slot',\n\tsavesUnavailable : 'No save slots found\\u2026',\n\tsavesUnknownDate : 'unknown',\n\n\t/*\n\t\tidb related\n\t*/\n\tsavesDisallowedReplay     : 'The scene viewer is currently in use, preventing the use of the save system.',\n\tsavesExportReminder       : 'Saves here will be lost if your browser cache is cleared. Saving to disk is recommended to avoid save loss.',\n\tsavesHeaderSaveLoad       : 'Save/Load',\n\tsavesHeaderIDName         : 'ID/Name',\n\tsavesHeaderDetails        : 'Details',\n\tsavesDescTitle            : 'Title: ',\n\tsavesDescName             : 'Save Name: ',\n\tsavesDescId               : 'Save Id: ',\n\tsavesDescDate             : 'Date: ',\n\tsavesPagerJump            : 'Jump to most recent manual save',\n\tsavesPagerPage            : 'Page:',\n\tsavesPagerSavesPerPage    : 'Saves per page:',\n\tsavesOptionsConfirmOn     : 'Require confirmation on:',\n\tsavesOptionsOverwrite     : 'Overwrite ',\n\tsavesOptionsUseLegacy     : 'Use old legacy save storage',\n\tsavesWarningSaveOnSlot    : 'Save on slot',\n\tsavesWarningOverwriteSlot : 'Overwrite save in slot',\n\tsavesWarningOverwriteID   : 'Save ID does not match, continue with overwrite?',\n\tsavesWarningDeleteInSlot  : 'Delete save in slot',\n\tsavesWarningLoad          : 'Load slot',\n\tsavesWarningDeleteAll     : 'WARNING - DO YOU REALLY WANT TO DELETE ALL SAVES?',\n\tsavesLabelToClipboard     : 'Save to Clipboard\\u2026',\n\n\n\t/*\n\t\tSettings.\n\t*/\n\tsettingsTitle : 'Settings',\n\tsettingsOff   : 'Off',\n\tsettingsOn    : 'On',\n\tsettingsReset : 'Reset to Defaults',\n\n\t/*\n\t\tRestart.\n\t*/\n\trestartTitle  : 'Restart',\n\trestartPrompt : 'Are you sure that you want to restart? Unsaved progress will be lost.',\n\n\t/*\n\t\tShare.\n\t*/\n\tshareTitle : 'Share',\n\n\t/*\n\t\tAlert.\n\t*/\n\talertTitle : 'Alert',\n\n\t/*\n\t\tAutoload.\n\t*/\n\tautoloadTitle  : 'Autoload',\n\tautoloadCancel : 'Go to start',\n\tautoloadOk     : 'Load autosave',\n\tautoloadPrompt : 'An autosave exists. Load it now or go to the start?',\n\n\t/*\n\t\tMacros.\n\t*/\n\tmacroBackText   : 'Back',  // (verb) rewind, revert\n\tmacroReturnText : 'Return' // (verb) go/send back\n};\n\n/***********************************************************************************************************************\n\n\tconfig.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/* global Save, Util */\n\nvar Config = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\t// General settings.\n\tlet _debug                 = false;\n\tlet _addVisitedLinkClass   = false;\n\tlet _cleanupWikifierOutput = false;\n\tlet _loadDelay             = 0;\n\n\t// Audio settings.\n\tlet _audioPauseOnFadeToZero = true;\n\tlet _audioPreloadMetadata   = true;\n\n\t// State history settings.\n\tlet _historyControls  = true;\n\tlet _historyMaxStates = 40;\n\tlet _sessionMaxStates = 40;\n\tlet _expiredMaxStates = 100;\n\n\t// Macros settings.\n\tlet _macrosIfAssignmentError   = true;\n\tlet _macrosMaxLoopIterations   = 1000;\n\tlet _macrosTypeSkipKey         = '\\x20'; // Space\n\tlet _macrosTypeVisitedPassages = true;\n\n\t// Navigation settings.\n\tlet _navigationOverride;\n\tlet _navigationRememberYPos ;\n\n\t// Passages settings.\n\tlet _passagesDescriptions;\n\tlet _passagesDisplayTitles = false;\n\tlet _passagesNobr          = false;\n\tlet _passagesStart; // set by `Story.load()`\n\tlet _passagesOnProcess;\n\tlet _passagesTransitionOut;\n\n\t// Saves settings.\n\tlet _savesAutoload;\n\tlet _savesAutosave;\n\tlet _savesId              = 'untitled-story';\n\tlet _savesIsAllowed;\n\tlet _savesSlots           = 8;\n\tlet _savesTryDiskOnMobile = true;\n\tlet _savesVersion;\n\tlet _savesUseLZString     = -1; // try autodetect\n\n\t// UI settings.\n\tlet _uiStowBarInitially    = 800;\n\tlet _uiUpdateStoryElements = true;\n\n\n\t/*******************************************************************************\n\t\tError Constants.\n\t*******************************************************************************/\n\n\tconst _errHistoryModeDeprecated     = 'Config.history.mode has been deprecated and is no longer used by SugarCube, please remove it from your code';\n\tconst _errHistoryTrackingDeprecated = 'Config.history.tracking has been deprecated, use Config.history.maxStates instead';\n\tconst _errSavesOnLoadDeprecated     = 'Config.saves.onLoad has been deprecated, use the Save.onLoad API instead';\n\tconst _errSavesOnSaveDeprecated     = 'Config.saves.onSave has been deprecated, use the Save.onSave API instead';\n\n\n\t/*******************************************************************************\n\t\tObject Exports.\n\t*******************************************************************************/\n\n\treturn Object.freeze({\n\t\t/*\n\t\t\tGeneral settings.\n\t\t*/\n\t\tget debug() { return _debug; },\n\t\tset debug(value) { _debug = Boolean(value); },\n\n\t\tget addVisitedLinkClass() { return _addVisitedLinkClass; },\n\t\tset addVisitedLinkClass(value) { _addVisitedLinkClass = Boolean(value); },\n\n\t\tget cleanupWikifierOutput() { return _cleanupWikifierOutput; },\n\t\tset cleanupWikifierOutput(value) { _cleanupWikifierOutput = Boolean(value); },\n\n\t\tget loadDelay() { return _loadDelay; },\n\t\tset loadDelay(value) {\n\t\t\tif (!Number.isSafeInteger(value) || value < 0) {\n\t\t\t\tthrow new RangeError('Config.loadDelay must be a non-negative integer');\n\t\t\t}\n\n\t\t\t_loadDelay = value;\n\t\t},\n\n\t\t/*\n\t\t\tAudio settings.\n\t\t*/\n\t\taudio : Object.freeze({\n\t\t\tget pauseOnFadeToZero() { return _audioPauseOnFadeToZero; },\n\t\t\tset pauseOnFadeToZero(value) { _audioPauseOnFadeToZero = Boolean(value); },\n\n\t\t\tget preloadMetadata() { return _audioPreloadMetadata; },\n\t\t\tset preloadMetadata(value) { _audioPreloadMetadata = Boolean(value); }\n\t\t}),\n\n\t\t/*\n\t\t\tState history settings.\n\t\t*/\n\t\thistory : Object.freeze({\n\t\t\t// TODO: (v3) This should be under UI settings → `Config.ui.historyControls`.\n\t\t\tget controls() { return _historyControls; },\n\t\t\tset controls(value) {\n\t\t\t\tconst controls = Boolean(value);\n\n\t\t\t\tif (_historyMaxStates === 1 && controls) {\n\t\t\t\t\tthrow new Error('Config.history.controls must be false when Config.history.maxStates is 1');\n\t\t\t\t}\n\n\t\t\t\t_historyControls = controls;\n\t\t\t},\n\n\t\t\tget maxStates() { return _historyMaxStates; },\n\t\t\tset maxStates(value) {\n\t\t\t\tif (!Number.isSafeInteger(value) || value < 1) {\n\t\t\t\t\tthrow new RangeError('Config.history.maxStates must be a positive integer');\n\t\t\t\t}\n\n\t\t\t\t_historyMaxStates = value;\n\n\t\t\t\t// Force `Config.history.controls` to `false`, when limited to `1` moment.\n\t\t\t\tif (_historyControls && value === 1) {\n\t\t\t\t\t_historyControls = false;\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tget maxSessionStates() { return _sessionMaxStates; },\n\t\t\tset maxSessionStates(value) {\n\t\t\t\tif (!Number.isSafeInteger(value) || value < 0) {\n\t\t\t\t\tthrow new RangeError('Config.history.maxSessionStates must be a non-negative integer');\n\t\t\t\t}\n\n\t\t\t\t_sessionMaxStates = value;\n\t\t\t},\n\n\t\t\tget maxExpired() { return _expiredMaxStates; },\n\t\t\tset maxExpired(value) {\n\t\t\t\t_expiredMaxStates = value;\n\t\t\t},\n\n\t\t\t// legacy\n\t\t\t// Die if deprecated state history settings are accessed.\n\t\t\tget mode()  { throw new Error(_errHistoryModeDeprecated); },\n\t\t\tset mode(_) { throw new Error(_errHistoryModeDeprecated); },\n\t\t\tget tracking()  { throw new Error(_errHistoryTrackingDeprecated); },\n\t\t\tset tracking(_) { throw new Error(_errHistoryTrackingDeprecated); }\n\t\t\t// /legacy\n\t\t}),\n\n\t\t/*\n\t\t\tMacros settings.\n\t\t*/\n\t\tmacros : Object.freeze({\n\t\t\tget ifAssignmentError() { return _macrosIfAssignmentError; },\n\t\t\tset ifAssignmentError(value) { _macrosIfAssignmentError = Boolean(value); },\n\n\t\t\tget maxLoopIterations() { return _macrosMaxLoopIterations; },\n\t\t\tset maxLoopIterations(value) {\n\t\t\t\tif (!Number.isSafeInteger(value) || value < 1) {\n\t\t\t\t\tthrow new RangeError('Config.macros.maxLoopIterations must be a positive integer');\n\t\t\t\t}\n\n\t\t\t\t_macrosMaxLoopIterations = value;\n\t\t\t},\n\n\t\t\tget typeSkipKey() { return _macrosTypeSkipKey; },\n\t\t\tset typeSkipKey(value) { _macrosTypeSkipKey = String(value); },\n\n\t\t\tget typeVisitedPassages() { return _macrosTypeVisitedPassages; },\n\t\t\tset typeVisitedPassages(value) { _macrosTypeVisitedPassages = Boolean(value); }\n\t\t}),\n\n\t\t/*\n\t\t\tNavigation settings.\n\t\t*/\n\t\tnavigation : Object.freeze({\n\t\t\tget override() { return _navigationOverride; },\n\t\t\tset override(value) {\n\t\t\t\tif (!(value == null || value instanceof Function)) { // lazy equality for null\n\t\t\t\t\tthrow new TypeError(`Config.navigation.override must be a function or null/undefined (received: ${Util.getType(value)})`);\n\t\t\t\t}\n\n\t\t\t\t_navigationOverride = value;\n\t\t\t},\n\t\t\tget rememberYPos() { return _navigationRememberYPos; },\n\t\t\tset rememberYPos(value) { _navigationRememberYPos = value; }\n\t\t}),\n\n\t\t/*\n\t\t\tPassages settings.\n\t\t*/\n\t\tpassages : Object.freeze({\n\t\t\tget descriptions() { return _passagesDescriptions; },\n\t\t\tset descriptions(value) {\n\t\t\t\tif (value != null) { // lazy equality for null\n\t\t\t\t\tconst valueType = Util.getType(value);\n\n\t\t\t\t\tif (valueType !== 'boolean' && valueType !== 'Object' && valueType !== 'function') {\n\t\t\t\t\t\tthrow new TypeError(`Config.passages.descriptions must be a boolean, object, function, or null/undefined (received: ${valueType})`);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t_passagesDescriptions = value;\n\t\t\t},\n\n\t\t\t// TODO: (v3) This should be under Navigation settings → `Config.navigation.updateTitle`.\n\t\t\tget displayTitles() { return _passagesDisplayTitles; },\n\t\t\tset displayTitles(value) { _passagesDisplayTitles = Boolean(value); },\n\n\t\t\tget nobr() { return _passagesNobr; },\n\t\t\tset nobr(value) { _passagesNobr = Boolean(value); },\n\n\t\t\tget onProcess() { return _passagesOnProcess; },\n\t\t\tset onProcess(value) {\n\t\t\t\tif (value != null) { // lazy equality for null\n\t\t\t\t\tconst valueType = Util.getType(value);\n\n\t\t\t\t\tif (valueType !== 'function') {\n\t\t\t\t\t\tthrow new TypeError(`Config.passages.onProcess must be a function or null/undefined (received: ${valueType})`);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t_passagesOnProcess = value;\n\t\t\t},\n\n\t\t\t// TODO: (v3) This should be under Navigation settings → `Config.navigation.(start|startingPassage)`.\n\t\t\tget start() { return _passagesStart; },\n\t\t\tset start(value) {\n\t\t\t\tif (value != null) { // lazy equality for null\n\t\t\t\t\tconst valueType = Util.getType(value);\n\n\t\t\t\t\tif (valueType !== 'string') {\n\t\t\t\t\t\tthrow new TypeError(`Config.passages.start must be a string or null/undefined (received: ${valueType})`);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t_passagesStart = value;\n\t\t\t},\n\n\t\t\t// TODO: (v3) This should be under Navigation settings → `Config.navigation.transitionOut`.\n\t\t\tget transitionOut() { return _passagesTransitionOut; },\n\t\t\tset transitionOut(value) {\n\t\t\t\tif (value != null) { // lazy equality for null\n\t\t\t\t\tconst valueType = Util.getType(value);\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t   valueType !== 'string'\n\t\t\t\t\t\t&& (valueType !== 'number' || !Number.isSafeInteger(value) || value < 0)\n\t\t\t\t\t) {\n\t\t\t\t\t\tthrow new TypeError(`Config.passages.transitionOut must be a string, non-negative integer, or null/undefined (received: ${valueType})`);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t_passagesTransitionOut = value;\n\t\t\t}\n\t\t}),\n\n\t\t/*\n\t\t\tSaves settings.\n\t\t*/\n\t\tsaves : Object.freeze({\n\t\t\tget autoload() { return _savesAutoload; },\n\t\t\tset autoload(value) {\n\t\t\t\tif (value != null) { // lazy equality for null\n\t\t\t\t\tconst valueType = Util.getType(value);\n\n\t\t\t\t\tif (valueType !== 'boolean' && valueType !== 'string' && valueType !== 'function') {\n\t\t\t\t\t\tthrow new TypeError(`Config.saves.autoload must be a boolean, string, function, or null/undefined (received: ${valueType})`);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t_savesAutoload = value;\n\t\t\t},\n\n\t\t\tget autosave() { return _savesAutosave; },\n\t\t\tset autosave(value) {\n\t\t\t\tif (value != null) { // lazy equality for null\n\t\t\t\t\tconst valueType = Util.getType(value);\n\n\t\t\t\t\t// legacy\n\t\t\t\t\t// Convert a string value to an Array of string.\n\t\t\t\t\tif (valueType === 'string') {\n\t\t\t\t\t\t_savesAutosave = [value];\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t// /legacy\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t   valueType !== 'boolean'\n\t\t\t\t\t\t&& (valueType !== 'Array' || !value.every(item => typeof item === 'string'))\n\t\t\t\t\t\t&& valueType !== 'function'\n\t\t\t\t\t) {\n\t\t\t\t\t\tthrow new TypeError(`Config.saves.autosave must be a boolean, Array<string>, function, or null/undefined (received: ${valueType}${valueType === 'Array' ? '<any>' : ''})`);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t_savesAutosave = value;\n\t\t\t},\n\n\t\t\tget id() { return _savesId; },\n\t\t\tset id(value) {\n\t\t\t\tif (typeof value !== 'string' || value === '') {\n\t\t\t\t\tthrow new TypeError(`Config.saves.id must be a non-empty string (received: ${Util.getType(value)})`);\n\t\t\t\t}\n\n\t\t\t\t_savesId = value;\n\t\t\t},\n\n\t\t\tget isAllowed() { return _savesIsAllowed; },\n\t\t\tset isAllowed(value) {\n\t\t\t\tif (!(value == null || value instanceof Function)) { // lazy equality for null\n\t\t\t\t\tthrow new TypeError(`Config.saves.isAllowed must be a function or null/undefined (received: ${Util.getType(value)})`);\n\t\t\t\t}\n\n\t\t\t\t_savesIsAllowed = value;\n\t\t\t},\n\n\t\t\tget slots() { return _savesSlots; },\n\t\t\tset slots(value) {\n\t\t\t\tif (!Number.isSafeInteger(value) || value < 0) {\n\t\t\t\t\tthrow new TypeError(`Config.saves.slots must be a non-negative integer (received: ${Util.getType(value)})`);\n\t\t\t\t}\n\n\t\t\t\t_savesSlots = value;\n\t\t\t},\n\n\t\t\tget tryDiskOnMobile() { return _savesTryDiskOnMobile; },\n\t\t\tset tryDiskOnMobile(value) { _savesTryDiskOnMobile = Boolean(value); },\n\n\t\t\tget version() { return _savesVersion; },\n\t\t\tset version(value) { _savesVersion = value; },\n\n\t\t\tget useLZString() { return _savesUseLZString; },\n\t\t\tset useLZString(value) { return _savesUseLZString = value; },\n\n\t\t\t// legacy\n\t\t\t// Die if deprecated saves onLoad handler getter is accessed.\n\t\t\tget onLoad() { throw new Error(_errSavesOnLoadDeprecated); },\n\t\t\t// Warn if deprecated saves onLoad handler setter is assigned to, then\n\t\t\t// pass the handler to the `Save.onLoad` API for compatibilities sake.\n\t\t\tset onLoad(value) {\n\t\t\t\tconsole.warn(_errSavesOnLoadDeprecated);\n\t\t\t\tSave.onLoad.add(value);\n\t\t\t},\n\n\t\t\t// Die if deprecated saves onSave handler getter is accessed.\n\t\t\tget onSave() { throw new Error(_errSavesOnSaveDeprecated); },\n\t\t\t// Warn if deprecated saves onSave handler setter is assigned to, then\n\t\t\t// pass the handler to the `Save.onSave` API for compatibilities sake.\n\t\t\tset onSave(value) {\n\t\t\t\tconsole.warn(_errSavesOnSaveDeprecated);\n\t\t\t\tSave.onSave.add(value);\n\t\t\t}\n\t\t\t// /legacy\n\t\t}),\n\n\t\t/*\n\t\t\tUI settings.\n\t\t*/\n\t\tui : Object.freeze({\n\t\t\tget stowBarInitially() { return _uiStowBarInitially; },\n\t\t\tset stowBarInitially(value) {\n\t\t\t\tconst valueType = Util.getType(value);\n\n\t\t\t\tif (\n\t\t\t\t\t   valueType !== 'boolean'\n\t\t\t\t\t&& (valueType !== 'number' || !Number.isSafeInteger(value) || value < 0)\n\t\t\t\t) {\n\t\t\t\t\tthrow new TypeError(`Config.ui.stowBarInitially must be a boolean or non-negative integer (received: ${valueType})`);\n\t\t\t\t}\n\n\t\t\t\t_uiStowBarInitially = value;\n\t\t\t},\n\n\t\t\tget updateStoryElements() { return _uiUpdateStoryElements; },\n\t\t\tset updateStoryElements(value) { _uiUpdateStoryElements = Boolean(value); }\n\t\t})\n\t});\n})();\n\n/***********************************************************************************************************************\n\n\tsimpleaudio.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/* global Config, Has, LoadScreen, Story, Util, Visibility, clone */\n\nvar SimpleAudio = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\t/*\n\t\tEvents that count as user activation—i.e. \"user gestures\", \"activation behavior\".\n\n\t\tNOTE (ca. Dec, 2018): This not an exhaustive list and varies significantly by browser.\n\t\tProposals for a specification/standard are still very much in flux at this point.\n\n\t\tTODO (ca. Dec, 2018): Revisit this topic.\n\n\t\tSEE: (too many to list)\n\t\t\thttps://github.com/whatwg/html/issues/3849\n\t\t\thttps://github.com/whatwg/html/issues/1903\n\t\t\thttps://html.spec.whatwg.org/#activation\n\t\t\thttps://docs.google.com/spreadsheets/d/1DGXjhQ6D3yZXIePOMo0dsd2agz0t5W7rYH1NwJ-QGJo/edit#gid=0\n\t*/\n\tconst _gestureEventNames = Object.freeze(['click', 'contextmenu', 'dblclick', 'keyup', 'mouseup', 'pointerup', 'touchend']);\n\n\t// Special group IDs.\n\tconst _specialIds = Object.freeze([':not', ':all', ':looped', ':muted', ':paused', ':playing']);\n\n\t// Format specifier regular expression.\n\tconst _formatSpecRe = /^([\\w-]+)\\s*\\|\\s*(\\S.*)$/; // e.g. 'mp3|https://audiohost.tld/id'\n\n\t// ID verification regular expressions.\n\tconst _badIdRe = /[:\\s]/;\n\n\t// Tracks collection.\n\tconst _tracks = new Map();\n\n\t// Groups collection.\n\tconst _groups = new Map();\n\n\t// Playlists collection.\n\tconst _lists = new Map();\n\n\t// Subscriber collection.\n\tconst _subscribers = new Map();\n\n\t// Master playback rate.\n\tlet _masterRate = 1;\n\n\t// Master playback volume.\n\tlet _masterVolume = 1;\n\n\t// Master mute state.\n\tlet _masterMute = false;\n\n\t// Master mute on tab/window visibility state.\n\tlet _masterMuteOnHidden = false;\n\n\n\t/*******************************************************************************************************************\n\t\tFeature Detection Functions.\n\t*******************************************************************************************************************/\n\t// Return whether the `<HTMLAudioElement>.play()` method returns a `Promise`.\n\t//\n\t// NOTE: The initial result is cached for future calls.\n\tconst _playReturnsPromise = (function () {\n\t\t// Cache of whether `<HTMLAudioElement>.play()` returns a `Promise`.\n\t\tlet _hasPromise = null;\n\n\t\tfunction _playReturnsPromise() {\n\t\t\tif (_hasPromise !== null) {\n\t\t\t\treturn _hasPromise;\n\t\t\t}\n\n\t\t\t_hasPromise = false;\n\n\t\t\tif (Has.audio) {\n\t\t\t\ttry {\n\t\t\t\t\tconst audio = document.createElement('audio');\n\n\t\t\t\t\t// NOTE (ca. Jan 01, 2020): Firefox will still log an \"Autoplay is only allowed\n\t\t\t\t\t// when […] media is muted.\" message to the console when attempting the test\n\t\t\t\t\t// below, even though the audio has been muted.  Stay classy, Firefox.\n\t\t\t\t\t//\n\t\t\t\t\t// QUESTION (ca. Jan 01, 2020): Keep this?  It's only here to appease Firefox,\n\t\t\t\t\t// but doesn't seem to work as Firefox seems to ignore mute in violation of the\n\t\t\t\t\t// `HTMLAudioElement` specification—willfully or simply a bug, I can't say.\n\t\t\t\t\taudio.muted = true;\n\n\t\t\t\t\tconst value = audio.play();\n\n\t\t\t\t\t// Silence \"Uncaught (in promise)\" console errors from Blink.\n\t\t\t\t\t//\n\t\t\t\t\t// NOTE: Swallowing errors is generally bad, but in this case we know there's\n\t\t\t\t\t// going to be an error regardless, since there's no source, and we don't actually\n\t\t\t\t\t// care about the error, since we just want the return value, so we consign it\n\t\t\t\t\t// to the bit bucket.\n\t\t\t\t\t//\n\t\t\t\t\t// NOTE: We don't ensure that the return value is not `undefined` here because\n\t\t\t\t\t// having the attempted call to `<Promise>.catch()` on an `undefined` value throw\n\t\t\t\t\t// is acceptable, since it will be caught and `false` eventually returned.\n\t\t\t\t\tvalue.catch(() => { /* no-op */ });\n\n\t\t\t\t\t_hasPromise = value instanceof Promise;\n\t\t\t\t}\n\t\t\t\tcatch (ex) { /* no-op */ }\n\t\t\t}\n\n\t\t\treturn _hasPromise;\n\t\t}\n\n\t\treturn _playReturnsPromise;\n\t})();\n\n\n\t/*******************************************************************************************************************\n\t\tAudioTrack Class.\n\t*******************************************************************************************************************/\n\tclass AudioTrack {\n\t\tconstructor(obj) {\n\t\t\t// Process the given array of sources or AudioTrack object.\n\t\t\tif (obj instanceof Array) {\n\t\t\t\tthis._create(obj);\n\t\t\t}\n\t\t\telse if (obj instanceof AudioTrack) {\n\t\t\t\tthis._copy(obj);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new Error('sources parameter must be either an array, of URIs or source objects, or an AudioTrack instance');\n\t\t\t}\n\t\t}\n\n\t\t_create(sourceList) {\n\t\t\tconst dataUriRe   = /^data:\\s*audio\\/(?:x-)?([^;,]+)\\s*[;,]/i;\n\t\t\tconst extRe       = /\\.([^./\\\\]+)$/;\n\t\t\tconst formats     = AudioTrack.formats;\n\t\t\tconst usedSources = [];\n\t\t\t/*\n\t\t\t\tHTMLAudioElement: DOM factory method vs. constructor\n\n\t\t\t\tUse of the DOM factory method, `document.createElement('audio')`, should be\n\t\t\t\tpreferred over use of the constructor, `new Audio()`.  The reason being that\n\t\t\t\tobjects created by the latter are, erroneously, treated differently, often\n\t\t\t\tunfavorably, by certain browser engines—e.g. within some versions of the iOS\n\t\t\t\tbrowser core.\n\n\t\t\t\tNotably, the only difference between the two, per the specification, is that\n\t\t\t\tobjects created via the constructor should have their `preload` property\n\t\t\t\tautomatically set to 'auto'.  Thus, there's no technical reason to prefer\n\t\t\t\tusage of the constructor, even discounting buggy browser implementations.\n\t\t\t*/\n\t\t\tconst audio = document.createElement('audio');\n\n\t\t\t// Initially set the `preload` attribute to `'none'`.\n\t\t\taudio.preload = 'none';\n\n\t\t\t// Process the array of sources, adding any valid sources to the `usedSources`\n\t\t\t// array and to the audio element as source elements.\n\t\t\tsourceList.forEach(src => {\n\t\t\t\tlet srcUri = null;\n\n\t\t\t\tswitch (typeof src) {\n\t\t\t\tcase 'string':\n\t\t\t\t\t{\n\t\t\t\t\t\tlet match;\n\n\t\t\t\t\t\tif (src.slice(0, 5) === 'data:') {\n\t\t\t\t\t\t\tmatch = dataUriRe.exec(src);\n\n\t\t\t\t\t\t\tif (match === null) {\n\t\t\t\t\t\t\t\tthrow new Error('source data URI missing media type');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tmatch = extRe.exec(Util.parseUrl(src).pathname);\n\n\t\t\t\t\t\t\tif (match === null) {\n\t\t\t\t\t\t\t\tthrow new Error('source URL missing file extension');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (formats[match[1]]) {\n\t\t\t\t\t\t\tsrcUri = src;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'object':\n\t\t\t\t\t{\n\t\t\t\t\t\tif (src === null) {\n\t\t\t\t\t\t\tthrow new Error('source object cannot be null');\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (!src.hasOwnProperty('src')) {\n\t\t\t\t\t\t\tthrow new Error('source object missing required \"src\" property');\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (!src.hasOwnProperty('format')) {\n\t\t\t\t\t\t\tthrow new Error('source object missing required \"format\" property');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (formats[src.format]) {\n\t\t\t\t\t\t\tsrcUri = src.src;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error(`invalid source value (type: ${typeof src})`);\n\t\t\t\t}\n\n\t\t\t\tif (srcUri !== null) {\n\t\t\t\t\tconst source = document.createElement('source');\n\t\t\t\t\tsource.src = srcUri;\n\t\t\t\t\taudio.appendChild(source);\n\t\t\t\t\tusedSources.push(srcUri);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tif (audio.hasChildNodes()) {\n\t\t\t\t// Set the `preload` attribute to `'metadata'`, unless preloading has been disabled.\n\t\t\t\tif (Config.audio.preloadMetadata) {\n\t\t\t\t\taudio.preload = 'metadata';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis._finalize(audio, usedSources, clone(sourceList));\n\t\t}\n\n\t\t_copy(obj) {\n\t\t\tthis._finalize(\n\t\t\t\tobj.audio.cloneNode(true), // deep clone of the audio element & its children\n\t\t\t\tclone(obj.sources),\n\t\t\t\tclone(obj.originals)\n\t\t\t);\n\t\t}\n\n\t\t_finalize(audio, sources, originals) {\n\t\t\t// Set up our own properties.\n\t\t\tObject.defineProperties(this, {\n\t\t\t\taudio : {\n\t\t\t\t\tconfigurable : true,\n\t\t\t\t\tvalue        : audio\n\t\t\t\t},\n\n\t\t\t\tsources : {\n\t\t\t\t\tvalue : Object.freeze(sources)\n\t\t\t\t},\n\n\t\t\t\toriginals : {\n\t\t\t\t\tvalue : Object.freeze(originals)\n\t\t\t\t},\n\n\t\t\t\t_error : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : false\n\t\t\t\t},\n\n\t\t\t\t_faderId : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : null\n\t\t\t\t},\n\n\t\t\t\t_mute : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : false\n\t\t\t\t},\n\n\t\t\t\t_rate : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : 1\n\t\t\t\t},\n\n\t\t\t\t_volume : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : 1\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t// Set up event handlers on the audio and source elements.\n\t\t\tjQuery(this.audio)\n\t\t\t\t/*\n\t\t\t\t\tUpon receiving a `loadstart` event on the audio element, set `_error` to\n\t\t\t\t\t`false`.\n\t\t\t\t*/\n\t\t\t\t.on('loadstart.AudioTrack', () => this._error = false)\n\t\t\t\t/*\n\t\t\t\t\tUpon receiving an `error` event on the audio element, set `_error` to\n\t\t\t\t\t`true`.\n\n\t\t\t\t\tCaveats by browser:\n\t\t\t\t\t\tEdge violates the specification by triggering `error` events from source\n\t\t\t\t\t\telements on their parent media element, rather than the source element.\n\t\t\t\t\t\tTo enable error handling in all browsers, we set the error handler on the\n\t\t\t\t\t\taudio element and have the final source element forward its `error` event.\n\n\t\t\t\t\t\tIE does not trigger, at least some, `error` events from source elements at\n\t\t\t\t\t\tall, not on the source element or its parent media element.  AFAIK, nothing\n\t\t\t\t\t\tcan be done about this lossage.\n\t\t\t\t*/\n\t\t\t\t.on('error.AudioTrack', () => this._error = true)\n\t\t\t\t/*\n\t\t\t\t\tUpon receiving an `error` event on the final source element (if any), trigger\n\t\t\t\t\tan `error` event on the audio element—that being necessary because the source\n\t\t\t\t\t`error` event does not bubble.\n\t\t\t\t*/\n\t\t\t\t.find('source:last-of-type')\n\t\t\t\t.on('error.AudioTrack', () => this._trigger('error'));\n\n\t\t\t// Subscribe to command messages.\n\t\t\tsubscribe(this, mesg => {\n\t\t\t\tif (!this.audio) {\n\t\t\t\t\tunsubscribe(this);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tswitch (mesg) {\n\t\t\t\tcase 'loadwithscreen':\n\t\t\t\t\tif (this.hasSource()) {\n\t\t\t\t\t\tconst lockId = LoadScreen.lock();\n\t\t\t\t\t\tthis\n\t\t\t\t\t\t\t// NOTE: Do not use an arrow function here.\n\t\t\t\t\t\t\t.one(\n\t\t\t\t\t\t\t\t'canplaythrough.AudioTrack_loadwithscreen error.AudioTrack_loadwithscreen',\n\t\t\t\t\t\t\t\tfunction () {\n\t\t\t\t\t\t\t\t\tjQuery(this).off('.AudioTrack_loadwithscreen');\n\t\t\t\t\t\t\t\t\tLoadScreen.unlock(lockId);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.load();\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'load':   this.load();               break;\n\t\t\t\tcase 'mute':   this._updateAudioMute();   break;\n\t\t\t\tcase 'rate':   this._updateAudioRate();   break;\n\t\t\t\tcase 'stop':   this.stop();               break;\n\t\t\t\tcase 'volume': this._updateAudioVolume(); break;\n\t\t\t\tcase 'unload': this.unload();             break;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t// Synchronize with the current master audio settings.\n\t\t\tthis._updateAudioMute();\n\t\t\tthis._updateAudioRate();\n\t\t\tthis._updateAudioVolume();\n\t\t}\n\n\t\t_trigger(eventName) {\n\t\t\t// Do not use `trigger()` here as we do not want these events to bubble.\n\t\t\tjQuery(this.audio).triggerHandler(eventName);\n\t\t}\n\n\t\t_destroy() {\n\t\t\t/*\n\t\t\t\tStrictly speaking, self-destruction is not necessary as this object will,\n\t\t\t\teventually, be garbage collected.  That said, since the audio element contains\n\t\t\t\tdata buffers for the selected audio source, which may be quite large, manually\n\t\t\t\tpurging them as soon as we know that they're no longer needed is not a bad idea.\n\t\t\t*/\n\t\t\tunsubscribe(this);\n\n\t\t\tif (!this.audio) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tjQuery(this.audio).off();\n\t\t\tthis.unload();\n\t\t\tthis._error = true;\n\n\t\t\t// Delete the audio element property.\n\t\t\tdelete this.audio;\n\t\t}\n\n\t\tclone() {\n\t\t\treturn new AudioTrack(this);\n\t\t}\n\n\t\tload() {\n\t\t\tthis.fadeStop();\n\t\t\tthis.audio.pause();\n\n\t\t\tif (!this.audio.hasChildNodes()) {\n\t\t\t\tif (this.sources.length === 0) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis.sources.forEach(srcUri => {\n\t\t\t\t\tconst source = document.createElement('source');\n\t\t\t\t\tsource.src = srcUri;\n\t\t\t\t\tthis.audio.appendChild(source);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (this.audio.preload !== 'auto') {\n\t\t\t\tthis.audio.preload = 'auto';\n\t\t\t}\n\n\t\t\tif (!this.isLoading()) {\n\t\t\t\tthis.audio.load();\n\t\t\t}\n\t\t}\n\n\t\tunload() {\n\t\t\tthis.fadeStop();\n\t\t\tthis.stop();\n\n\t\t\tconst audio = this.audio;\n\t\t\taudio.preload = 'none';\n\n\t\t\t// Remove all source elements.\n\t\t\twhile (audio.hasChildNodes()) {\n\t\t\t\taudio.removeChild(audio.firstChild);\n\t\t\t}\n\n\t\t\t// Force the audio element to drop any existing data buffers.\n\t\t\taudio.load();\n\t\t}\n\n\t\tplay() {\n\t\t\tif (!this.hasSource()) {\n\t\t\t\treturn Promise.reject(new Error('none of the candidate sources were acceptable'));\n\t\t\t}\n\n\t\t\tif (this.isUnloaded()) {\n\t\t\t\treturn Promise.reject(new Error('no sources are loaded'));\n\t\t\t}\n\n\t\t\tif (this.isFailed()) {\n\t\t\t\treturn Promise.reject(new Error('failed to load any of the sources'));\n\t\t\t}\n\n\t\t\tif (this.audio.preload !== 'auto') {\n\t\t\t\tthis.audio.preload = 'auto';\n\t\t\t}\n\n\t\t\tconst namespace = '.AudioTrack_play';\n\n\t\t\treturn _playReturnsPromise()\n\t\t\t\t? this.audio.play()\n\t\t\t\t: new Promise((resolve, reject) => {\n\t\t\t\t\tif (this.isPlaying()) {\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tjQuery(this.audio)\n\t\t\t\t\t\t\t.off(namespace)\n\t\t\t\t\t\t\t.one(`error${namespace} playing${namespace} timeupdate${namespace}`, ev => {\n\t\t\t\t\t\t\t\tjQuery(this).off(namespace);\n\n\t\t\t\t\t\t\t\tif (ev.type === 'error') {\n\t\t\t\t\t\t\t\t\treject(new Error('unknown audio play error'));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\tthis.audio.play();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t}\n\n\t\tplayWhenAllowed() {\n\t\t\tthis.play().catch(() => {\n\t\t\t\tconst gestures = _gestureEventNames.map(name => `${name}.AudioTrack_playWhenAllowed`).join(' ');\n\t\t\t\tjQuery(document).one(gestures, () => {\n\t\t\t\t\tjQuery(document).off('.AudioTrack_playWhenAllowed');\n\t\t\t\t\tthis.audio.play();\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\tpause() {\n\t\t\tthis.audio.pause();\n\t\t}\n\n\t\tstop() {\n\t\t\tthis.audio.pause();\n\t\t\tthis.time(0);\n\t\t\tthis._trigger(':stopped');\n\t\t}\n\n\t\tfade(duration, toVol, fromVol) {\n\t\t\tif (typeof duration !== 'number') {\n\t\t\t\tthrow new TypeError('duration parameter must be a number');\n\t\t\t}\n\t\t\tif (typeof toVol !== 'number') {\n\t\t\t\tthrow new TypeError('toVolume parameter must be a number');\n\t\t\t}\n\t\t\tif (fromVol != null && typeof fromVol !== 'number') { // lazy equality for null\n\t\t\t\tthrow new TypeError('fromVolume parameter must be a number');\n\t\t\t}\n\n\t\t\tif (!this.hasSource()) {\n\t\t\t\treturn Promise.reject(new Error('none of the candidate sources were acceptable'));\n\t\t\t}\n\n\t\t\tif (this.isUnloaded()) {\n\t\t\t\treturn Promise.reject(new Error('no sources are loaded'));\n\t\t\t}\n\n\t\t\tif (this.isFailed()) {\n\t\t\t\treturn Promise.reject(new Error('failed to load any of the sources'));\n\t\t\t}\n\n\t\t\tthis.fadeStop();\n\n\t\t\tconst from = Math.clamp(fromVol == null ? this.volume() : fromVol, 0, 1); // lazy equality for null\n\t\t\tconst to   = Math.clamp(toVol, 0, 1);\n\n\t\t\tif (from === to) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.volume(from);\n\n\t\t\t/*\n\t\t\t\tWe listen for the `timeupdate` event here, rather than `playing`, because\n\t\t\t\tvarious browsers (notably, mobile browsers) are poor at firing media events\n\t\t\t\tin a timely fashion, so we use `timeupdate` to ensure that we don't start\n\t\t\t\tthe fade until the track is actually progressing.\n\t\t\t*/\n\t\t\tjQuery(this.audio)\n\t\t\t\t.off('timeupdate.AudioTrack_fade')\n\t\t\t\t.one('timeupdate.AudioTrack_fade', () => {\n\t\t\t\t\tlet min;\n\t\t\t\t\tlet max;\n\n\t\t\t\t\t// Fade in.\n\t\t\t\t\tif (from < to) {\n\t\t\t\t\t\tmin = from;\n\t\t\t\t\t\tmax = to;\n\t\t\t\t\t}\n\t\t\t\t\t// Fade out.\n\t\t\t\t\telse {\n\t\t\t\t\t\tmin = to;\n\t\t\t\t\t\tmax = from;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst time     = Math.max(duration, 1);\n\t\t\t\t\tconst interval = 25; // in milliseconds\n\t\t\t\t\tconst delta    = (to - from) / (time / (interval / 1000));\n\n\t\t\t\t\tthis._trigger(':fading');\n\t\t\t\t\tthis._faderId = setInterval(() => {\n\t\t\t\t\t\tif (!this.isPlaying()) {\n\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t\tWhile it may seem like a good idea to also set the track volume\n\t\t\t\t\t\t\t\tto the `to` value here, we should not do so.  We cannot know why\n\t\t\t\t\t\t\t\tthe track is no longer playing, nor if the volume has been modified\n\t\t\t\t\t\t\t\tin the interim, so doing so now may clobber an end-user set volume.\n\t\t\t\t\t\t\t*/\n\t\t\t\t\t\t\tthis.fadeStop();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tthis.volume(Math.clamp(this.volume() + delta, min, max));\n\n\t\t\t\t\t\tif (Config.audio.pauseOnFadeToZero && this.volume() === 0) {\n\t\t\t\t\t\t\tthis.pause();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (this.volume() === to) {\n\t\t\t\t\t\t\tthis.fadeStop();\n\t\t\t\t\t\t\tthis._trigger(':faded');\n\t\t\t\t\t\t}\n\t\t\t\t\t}, interval);\n\t\t\t\t});\n\n\t\t\treturn this.play();\n\t\t}\n\n\t\tfadeIn(duration, fromVol) {\n\t\t\treturn this.fade(duration, 1, fromVol);\n\t\t}\n\n\t\tfadeOut(duration, fromVol) {\n\t\t\treturn this.fade(duration, 0, fromVol);\n\t\t}\n\n\t\tfadeStop() {\n\t\t\tif (this._faderId !== null) {\n\t\t\t\tclearInterval(this._faderId);\n\t\t\t\tthis._faderId = null;\n\t\t\t}\n\t\t}\n\n\t\tloop(loop) {\n\t\t\tif (loop == null) { // lazy equality for null\n\t\t\t\treturn this.audio.loop;\n\t\t\t}\n\n\t\t\tthis.audio.loop = !!loop;\n\n\t\t\treturn this;\n\t\t}\n\n\t\tmute(mute) {\n\t\t\tif (mute == null) { // lazy equality for null\n\t\t\t\treturn this._mute;\n\t\t\t}\n\n\t\t\tthis._mute = !!mute;\n\t\t\tthis._updateAudioMute();\n\n\t\t\treturn this;\n\t\t}\n\t\t_updateAudioMute() {\n\t\t\tthis.audio.muted = this._mute || _masterMute;\n\t\t}\n\n\t\trate(rate) {\n\t\t\tif (rate == null) { // lazy equality for null\n\t\t\t\treturn this._rate;\n\t\t\t}\n\n\t\t\tif (typeof rate !== 'number') {\n\t\t\t\tthrow new TypeError('rate parameter must be a number');\n\t\t\t}\n\n\t\t\t/*\n\t\t\t\tClamp the playback rate to sane values—some browsers also do this to varying degrees.\n\n\t\t\t\tNOTE (ca. Aug 2016): The specification allows negative values for reverse playback,\n\t\t\t\thowever, most browsers either completely ignore negative values or clamp them to\n\t\t\t\tsome positive value.  In some (notably, IE & Edge), setting a negative playback\n\t\t\t\trate breaks the associated controls, if displayed.\n\t\t\t*/\n\t\t\t/*\n\t\t\tthis._rate = rate < 0\n\t\t\t\t? Math.clamp(rate, -0.2, -5) // clamp to 5× slower & faster, backward\n\t\t\t\t: Math.clamp(rate, 0.2, 5);  // clamp to 5× slower & faster, forward\n\t\t\t*/\n\t\t\tthis._rate = Math.clamp(rate, 0.2, 5); // clamp to 5× slower & faster\n\t\t\tthis._updateAudioRate();\n\n\t\t\treturn this;\n\t\t}\n\t\t_updateAudioRate() {\n\t\t\t/*\n\t\t\tconst rate = this._rate * _masterRate;\n\t\t\tthis.audio.playbackRate = rate < 0\n\t\t\t\t? Math.clamp(rate, -0.2, -5) // clamp to 5× slower & faster, backward\n\t\t\t\t: Math.clamp(rate, 0.2, 5);  // clamp to 5× slower & faster, forward\n\t\t\t*/\n\t\t\tthis.audio.playbackRate = Math.clamp(this._rate * _masterRate, 0.2, 5); // clamp to 5× slower & faster\n\t\t}\n\n\t\ttime(time) {\n\t\t\tif (time == null) { // lazy equality for null\n\t\t\t\treturn this.audio.currentTime;\n\t\t\t}\n\n\t\t\tif (typeof time !== 'number') {\n\t\t\t\tthrow new TypeError('time parameter must be a number');\n\t\t\t}\n\n\t\t\t/*\n\t\t\t\tNOTE (historic): If we try to modify the audio clip's `.currentTime` property\n\t\t\t\tbefore its metadata has been loaded, it will throw an `InvalidStateError`\n\t\t\t\t(since it doesn't know its duration, allowing `.currentTime` to be set would\n\t\t\t\tbe undefined behavior), so in case an exception is thrown we provide a fallback\n\t\t\t\tusing the `loadedmetadata` event.\n\n\t\t\t\tNOTE (ca. 2016): This workaround should no longer be necessary in most browsers.\n\t\t\t\tThat said, it will still be required for some time to service legacy browsers.\n\n\t\t\t\tNOTE (ca. Dec 09, 2018): Firefox will still log an `InvalidStateError` to the\n\t\t\t\tconsole when attempting to modify the clip's `.currentTime` property before its\n\t\t\t\tmetadata has been loaded, even though it handles the situation properly—by waiting\n\t\t\t\tfor the metadata, as all browsers do now.  To prevent this spurious logging, we\n\t\t\t\tmust now manually check for the existence of the metadata and always failover to\n\t\t\t\tan event regardless of if the browser needs it or not—because I don't want to\n\t\t\t\tintroduce a browser check here.  Stay classy, Firefox.\n\t\t\t*/\n\t\t\tif (this.hasMetadata()) {\n\t\t\t\tthis.audio.currentTime = time;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tjQuery(this.audio)\n\t\t\t\t\t.off('loadedmetadata.AudioTrack_time')\n\t\t\t\t\t.one('loadedmetadata.AudioTrack_time', () => this.audio.currentTime = time);\n\t\t\t}\n\n\t\t\treturn this;\n\t\t}\n\n\t\tvolume(volume) {\n\t\t\tif (volume == null) { // lazy equality for null\n\t\t\t\treturn this._volume;\n\t\t\t}\n\n\t\t\tif (typeof volume !== 'number') {\n\t\t\t\tthrow new TypeError('volume parameter must be a number');\n\t\t\t}\n\n\t\t\tthis._volume = Math.clamp(volume, 0, 1); // clamp to 0 (silent) & 1 (full loudness)\n\t\t\tthis._updateAudioVolume();\n\n\t\t\treturn this;\n\t\t}\n\t\t_updateAudioVolume() {\n\t\t\tthis.audio.volume = Math.clamp(this._volume * _masterVolume, 0, 1);\n\t\t}\n\n\t\tduration() {\n\t\t\t// NOTE: May return a double (normally), Infinity (for streams), or NaN (without metadata).\n\t\t\treturn this.audio.duration;\n\t\t}\n\n\t\tremaining() {\n\t\t\t// NOTE: May return a double (normally), Infinity (for streams), or NaN (without metadata).\n\t\t\treturn this.audio.duration - this.audio.currentTime;\n\t\t}\n\n\t\tisFailed() {\n\t\t\treturn this._error;\n\t\t}\n\n\t\tisLoading() {\n\t\t\treturn this.audio.networkState === HTMLMediaElement.NETWORK_LOADING;\n\t\t}\n\n\t\tisUnloaded() {\n\t\t\treturn !this.audio.hasChildNodes();\n\t\t}\n\n\t\tisUnavailable() {\n\t\t\treturn !this.hasSource() || this.isUnloaded() || this.isFailed();\n\t\t}\n\n\t\tisPlaying() {\n\t\t\t// NOTE: The `this.hasSomeData()` check is probably no longer necessary.\n\t\t\treturn !this.audio.paused && this.hasSomeData();\n\t\t}\n\n\t\tisPaused() {\n\t\t\t/*\n\t\t\t\tIf the selected audio resource is a stream, `currentTime` may return a non-zero\n\t\t\t\tvalue even at the earliest available position within the stream as the browser\n\t\t\t\tmay have dropped the earliest chunks of buffered data or the stream may have a\n\t\t\t\ttimeline which does not start at zero.\n\n\t\t\t\tIn an attempt to guard against these possiblities, as best as we can, we test\n\t\t\t\t`duration` against `Infinity` first, which should yield true for actual streams.\n\t\t\t*/\n\t\t\treturn this.audio.paused\n\t\t\t\t&& (this.audio.duration === Infinity || this.audio.currentTime > 0)\n\t\t\t\t&& !this.audio.ended;\n\t\t}\n\n\t\tisStopped() {\n\t\t\treturn this.audio.paused && this.audio.currentTime === 0;\n\t\t}\n\n\t\tisEnded() {\n\t\t\treturn this.audio.ended;\n\t\t}\n\n\t\tisFading() {\n\t\t\treturn this._faderId !== null;\n\t\t}\n\n\t\tisSeeking() {\n\t\t\treturn this.audio.seeking;\n\t\t}\n\n\t\thasSource() {\n\t\t\treturn this.sources.length > 0;\n\t\t}\n\n\t\thasNoData() {\n\t\t\treturn this.audio.readyState === HTMLMediaElement.HAVE_NOTHING;\n\t\t}\n\n\t\thasMetadata() {\n\t\t\treturn this.audio.readyState >= HTMLMediaElement.HAVE_METADATA;\n\t\t}\n\n\t\thasSomeData() {\n\t\t\treturn this.audio.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA;\n\t\t}\n\n\t\thasData() {\n\t\t\treturn this.audio.readyState === HTMLMediaElement.HAVE_ENOUGH_DATA;\n\t\t}\n\n\t\ton(...args) {\n\t\t\tjQuery.fn.on.apply(jQuery(this.audio), args);\n\t\t\treturn this;\n\t\t}\n\n\t\tone(...args) {\n\t\t\tjQuery.fn.one.apply(jQuery(this.audio), args);\n\t\t\treturn this;\n\t\t}\n\n\t\toff(...args) {\n\t\t\tjQuery.fn.off.apply(jQuery(this.audio), args);\n\t\t\treturn this;\n\t\t}\n\t}\n\n\t// Attach the static data members.\n\tObject.defineProperties(AudioTrack, {\n\t\t/*\n\t\t\tCache of supported (common) audio formats.\n\n\t\t\tNOTE: Caveats by browser/engine:\n\t\t\t\tOpera ≤12 (Presto) will return a false-negative if the codecs value is quoted\n\t\t\t\twith single quotes, requiring the use of either double quotes or no quotes.\n\n\t\t\t\tSome versions of Blink-based browsers (e.g. Chrome, Opera ≥15) will return a\n\t\t\t\tfalse-negative for WAVE audio if the preferred MIME-type of 'audio/wave' is\n\t\t\t\tspecified, requiring the addition of 'audio/wav' for them.\n\t\t*/\n\t\tformats : {\n\t\t\tvalue : (() => {\n\t\t\t\tconst audio = document.createElement('audio');\n\t\t\t\tconst types = new Map();\n\n\t\t\t\tfunction canPlay(mimeType) {\n\t\t\t\t\tif (!types.has(mimeType)) {\n\t\t\t\t\t\t// Some early implementations return 'no' instead of the empty string.\n\t\t\t\t\t\ttypes.set(mimeType, audio.canPlayType(mimeType).replace(/^no$/i, '') !== '');\n\t\t\t\t\t}\n\n\t\t\t\t\treturn types.get(mimeType);\n\t\t\t\t}\n\n\t\t\t\treturn Object.assign(Object.create(null), {\n\t\t\t\t\t// AAC — MPEG-2 AAC audio; specific profiles vary, but commonly \"AAC-LC\".\n\t\t\t\t\taac : canPlay('audio/aac'),\n\n\t\t\t\t\t// CAF — Codecs vary.\n\t\t\t\t\tcaf : canPlay('audio/x-caf') || canPlay('audio/caf'),\n\n\t\t\t\t\t// FLAC.\n\t\t\t\t\tflac : canPlay('audio/x-flac') || canPlay('audio/flac'),\n\n\t\t\t\t\t// MP3 — MPEG-1/-2 Layer-III audio.\n\t\t\t\t\tmp3  : canPlay('audio/mpeg; codecs=\"mp3\"') || canPlay('audio/mpeg') || canPlay('audio/mp3') || canPlay('audio/mpa'),\n\t\t\t\t\tmpeg : canPlay('audio/mpeg'),\n\n\t\t\t\t\t// MP4 — Codecs vary, but commonly \"mp4a.40.2\" (a.k.a. \"AAC-LC\").\n\t\t\t\t\tm4a : canPlay('audio/x-m4a') || canPlay('audio/m4a') || canPlay('audio/aac'),\n\t\t\t\t\tmp4 : canPlay('audio/x-mp4') || canPlay('audio/mp4') || canPlay('audio/aac'),\n\n\t\t\t\t\t// OGG — Codecs vary, but commonly \"vorbis\" and, more recently, \"opus\".\n\t\t\t\t\togg : canPlay('audio/ogg'),\n\t\t\t\t\toga : canPlay('audio/ogg'),\n\n\t\t\t\t\t// OPUS — Opus audio in an Ogg container.\n\t\t\t\t\topus : canPlay('audio/ogg; codecs=\"opus\"') || canPlay('audio/opus'),\n\n\t\t\t\t\t// WAVE — Codecs vary, but commonly \"1\" (1 is the FourCC for PCM/LPCM).\n\t\t\t\t\twav  : canPlay('audio/wave; codecs=\"1\"') || canPlay('audio/wav; codecs=\"1\"') || canPlay('audio/wave') || canPlay('audio/wav'),\n\t\t\t\t\twave : canPlay('audio/wave; codecs=\"1\"') || canPlay('audio/wav; codecs=\"1\"') || canPlay('audio/wave') || canPlay('audio/wav'),\n\n\t\t\t\t\t// WEBM — Codecs vary, but commonly \"vorbis\" and, more recently, \"opus\".\n\t\t\t\t\tweba : canPlay('audio/webm'),\n\t\t\t\t\twebm : canPlay('audio/webm')\n\t\t\t\t});\n\t\t\t})()\n\t\t}\n\t});\n\n\n\t/*******************************************************************************************************************\n\t\tAudioList Class.\n\t*******************************************************************************************************************/\n\tclass AudioList {\n\t\tconstructor(obj) {\n\t\t\t// Process the given array of track objects or AudioList object.\n\t\t\tif (obj instanceof Array) {\n\t\t\t\tthis._create(obj);\n\t\t\t}\n\t\t\telse if (obj instanceof AudioList) {\n\t\t\t\tthis._copy(obj);\n\t\t\t\t// this._create(obj.tracks);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new Error('tracks parameter must be either an array, of track objects, or an AudioTrack instance');\n\t\t\t}\n\t\t}\n\n\t\t_create(trackList) {\n\t\t\t// Map the array of tracks to playlist track objects.\n\t\t\tthis._finalize(trackList.map(trackObj => {\n\t\t\t\tif (typeof trackObj !== 'object') { // lazy equality for null\n\t\t\t\t\tthrow new Error('tracks parameter array members must be objects');\n\t\t\t\t}\n\n\t\t\t\tlet own;\n\t\t\t\tlet rate;\n\t\t\t\tlet track;\n\t\t\t\tlet volume;\n\n\t\t\t\tif (trackObj instanceof AudioTrack) {\n\t\t\t\t\town    = true;\n\t\t\t\t\trate   = trackObj.rate();\n\t\t\t\t\ttrack  = trackObj.clone();\n\t\t\t\t\tvolume = trackObj.volume();\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (!trackObj.hasOwnProperty('track')) {\n\t\t\t\t\t\tthrow new Error('track object missing required \"track\" property');\n\t\t\t\t\t}\n\t\t\t\t\telse if (!(trackObj.track instanceof AudioTrack)) {\n\t\t\t\t\t\tthrow new Error('track object\\'s \"track\" property must be an AudioTrack object');\n\t\t\t\t\t}\n\t\t\t\t\t// else if (!trackObj.hasOwnProperty('volume')) {\n\t\t\t\t\t// \tthrow new Error('track object missing required \"volume\" property');\n\t\t\t\t\t// }\n\n\t\t\t\t\town    = trackObj.hasOwnProperty('own') && trackObj.own;\n\t\t\t\t\trate   = trackObj.hasOwnProperty('rate') ? trackObj.rate : trackObj.track.rate();\n\t\t\t\t\ttrack  = trackObj.track;\n\t\t\t\t\tvolume = trackObj.hasOwnProperty('volume') ? trackObj.volume : trackObj.track.volume();\n\t\t\t\t}\n\n\t\t\t\ttrack.stop();\n\t\t\t\ttrack.loop(false);\n\t\t\t\ttrack.mute(false);\n\t\t\t\ttrack.rate(rate);\n\t\t\t\ttrack.volume(volume);\n\t\t\t\ttrack.on('ended.AudioList', () => this._onEnd());\n\n\t\t\t\treturn { own, track, volume, rate };\n\t\t\t}));\n\t\t}\n\n\t\t_copy(obj) {\n\t\t\tthis._finalize(clone(obj.tracks));\n\t\t}\n\n\t\t_finalize(tracks) {\n\t\t\t// Set up our own properties.\n\t\t\tObject.defineProperties(this, {\n\t\t\t\ttracks : {\n\t\t\t\t\tconfigurable : true,\n\t\t\t\t\tvalue        : Object.freeze(tracks)\n\t\t\t\t},\n\n\t\t\t\tqueue : {\n\t\t\t\t\tconfigurable : true,\n\t\t\t\t\tvalue        : []\n\t\t\t\t},\n\n\t\t\t\tcurrent : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : null\n\t\t\t\t},\n\n\t\t\t\t_rate : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : 1\n\t\t\t\t},\n\n\t\t\t\t_volume : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : 1\n\t\t\t\t},\n\n\t\t\t\t_mute : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : false\n\t\t\t\t},\n\n\t\t\t\t_loop : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : false\n\t\t\t\t},\n\n\t\t\t\t_shuffle : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : false\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t_destroy() {\n\t\t\t/*\n\t\t\t\tStrictly speaking, self-destruction is not necessary as this object will,\n\t\t\t\teventually, be garbage collected.\n\t\t\t*/\n\t\t\t// Stop playback.\n\t\t\tthis.stop();\n\n\t\t\t// Destroy all owned tracks.\n\t\t\tthis.tracks\n\t\t\t\t.filter(trackObj => trackObj.own)\n\t\t\t\t.forEach(trackObj => trackObj.track._destroy());\n\n\t\t\t// Delete the reference-type properties.\n\t\t\tdelete this.tracks;\n\t\t\tdelete this.queue;\n\t\t}\n\n\t\tload() {\n\t\t\tthis.tracks.forEach(trackObj => trackObj.track.load());\n\t\t}\n\n\t\tunload() {\n\t\t\tthis.stop();\n\t\t\tthis.tracks.forEach(trackObj => trackObj.track.unload());\n\t\t}\n\n\t\tplay() {\n\t\t\tif (this.current === null || this.current.track.isUnavailable() || this.current.track.isEnded()) {\n\t\t\t\tif (this.queue.length === 0) {\n\t\t\t\t\tthis._fillQueue();\n\t\t\t\t}\n\n\t\t\t\tif (!this._next()) {\n\t\t\t\t\treturn Promise.reject(new Error('no tracks were available'));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn this.current.track.play();\n\t\t}\n\n\t\tplayWhenAllowed() {\n\t\t\tthis.play().catch(() => {\n\t\t\t\tconst gestures = _gestureEventNames.map(name => `${name}.AudioList_playWhenAllowed`).join(' ');\n\t\t\t\tjQuery(document).one(gestures, () => {\n\t\t\t\t\tjQuery(document).off('.AudioList_playWhenAllowed');\n\t\t\t\t\tthis.play();\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\tpause() {\n\t\t\tif (this.current !== null) {\n\t\t\t\tthis.current.track.pause();\n\t\t\t}\n\t\t}\n\n\t\tstop() {\n\t\t\tif (this.current !== null) {\n\t\t\t\tthis.current.track.stop();\n\t\t\t\tthis.current = null;\n\t\t\t}\n\n\t\t\tthis._drainQueue();\n\t\t}\n\n\t\tskip() {\n\t\t\tif (this._next()) {\n\t\t\t\tthis.current.track.play();\n\t\t\t}\n\t\t\telse if (this._loop) {\n\t\t\t\tthis.play();\n\t\t\t}\n\t\t}\n\n\t\tfade(duration, toVol, fromVol) {\n\t\t\tif (typeof duration !== 'number') {\n\t\t\t\tthrow new TypeError('duration parameter must be a number');\n\t\t\t}\n\t\t\tif (typeof toVol !== 'number') {\n\t\t\t\tthrow new TypeError('toVolume parameter must be a number');\n\t\t\t}\n\t\t\tif (fromVol != null && typeof fromVol !== 'number') { // lazy equality for null\n\t\t\t\tthrow new TypeError('fromVolume parameter must be a number');\n\t\t\t}\n\n\t\t\tif (this.queue.length === 0) {\n\t\t\t\tthis._fillQueue();\n\t\t\t}\n\n\t\t\tif (this.current === null || this.current.track.isUnavailable() || this.current.track.isEnded()) {\n\t\t\t\tif (!this._next()) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst adjToVol = Math.clamp(toVol, 0, 1) * this.current.volume;\n\t\t\tlet adjFromVol;\n\n\t\t\tif (fromVol != null) { // lazy equality for null\n\t\t\t\tadjFromVol = Math.clamp(fromVol, 0, 1) * this.current.volume;\n\t\t\t}\n\n\t\t\tthis._volume = toVol; // NOTE: Kludgey, but necessary.\n\n\t\t\treturn this.current.track.fade(duration, adjToVol, adjFromVol);\n\t\t}\n\n\t\tfadeIn(duration, fromVol) {\n\t\t\treturn this.fade(duration, 1, fromVol);\n\t\t}\n\n\t\tfadeOut(duration, fromVol) {\n\t\t\treturn this.fade(duration, 0, fromVol);\n\t\t}\n\n\t\tfadeStop() {\n\t\t\tif (this.current !== null) {\n\t\t\t\tthis.current.track.fadeStop();\n\t\t\t}\n\t\t}\n\n\t\tloop(loop) {\n\t\t\tif (loop == null) { // lazy equality for null\n\t\t\t\treturn this._loop;\n\t\t\t}\n\n\t\t\tthis._loop = !!loop;\n\n\t\t\treturn this;\n\t\t}\n\n\t\tmute(mute) {\n\t\t\tif (mute == null) { // lazy equality for null\n\t\t\t\treturn this._mute;\n\t\t\t}\n\n\t\t\tthis._mute = !!mute;\n\n\t\t\tif (this.current !== null) {\n\t\t\t\tthis.current.track.mute(this._mute);\n\t\t\t}\n\n\t\t\treturn this;\n\t\t}\n\n\t\trate(rate) {\n\t\t\tif (rate == null) { // lazy equality for null\n\t\t\t\treturn this._rate;\n\t\t\t}\n\n\t\t\tif (typeof rate !== 'number') {\n\t\t\t\tthrow new TypeError('rate parameter must be a number');\n\t\t\t}\n\n\t\t\tthis._rate = Math.clamp(rate, 0.2, 5); // clamp to 5× slower & faster\n\n\t\t\tif (this.current !== null) {\n\t\t\t\tthis.current.track.rate(this._rate * this.current.rate);\n\t\t\t}\n\n\t\t\treturn this;\n\t\t}\n\n\t\tshuffle(shuffle) {\n\t\t\tif (shuffle == null) { // lazy equality for null\n\t\t\t\treturn this._shuffle;\n\t\t\t}\n\n\t\t\tthis._shuffle = !!shuffle;\n\n\t\t\tif (this.queue.length > 0) {\n\t\t\t\tthis._fillQueue();\n\n\t\t\t\t// Try not to immediately replay the last track when not shuffling.\n\t\t\t\tif (!this._shuffle && this.current !== null && this.queue.length > 1) {\n\t\t\t\t\tconst firstIdx = this.queue.findIndex(trackObj => trackObj === this.current);\n\n\t\t\t\t\tif (firstIdx !== -1) {\n\t\t\t\t\t\tthis.queue.push(...this.queue.splice(0, firstIdx + 1));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn this;\n\t\t}\n\n\t\tvolume(volume) {\n\t\t\tif (volume == null) { // lazy equality for null\n\t\t\t\treturn this._volume;\n\t\t\t}\n\n\t\t\tif (typeof volume !== 'number') {\n\t\t\t\tthrow new TypeError('volume parameter must be a number');\n\t\t\t}\n\n\t\t\tthis._volume = Math.clamp(volume, 0, 1); // clamp to 0 (silent) & 1 (full loudness)\n\n\t\t\tif (this.current !== null) {\n\t\t\t\tthis.current.track.volume(this._volume * this.current.volume);\n\t\t\t}\n\n\t\t\treturn this;\n\t\t}\n\n\t\tduration() {\n\t\t\tif (arguments.length > 0) {\n\t\t\t\tthrow new Error('duration takes no parameters');\n\t\t\t}\n\n\t\t\t// NOTE: May return a double (normally), Infinity (for streams), or NaN (without metadata).\n\t\t\treturn this.tracks\n\t\t\t\t.map(trackObj => trackObj.track.duration())\n\t\t\t\t.reduce((prev, cur) => prev + cur, 0);\n\t\t}\n\n\t\tremaining() {\n\t\t\tif (arguments.length > 0) {\n\t\t\t\tthrow new Error('remaining takes no parameters');\n\t\t\t}\n\n\t\t\t// NOTE: May return a double (normally), Infinity (for streams), or NaN (without metadata).\n\t\t\tlet remainingTime = this.queue\n\t\t\t\t.map(trackObj => trackObj.track.duration())\n\t\t\t\t.reduce((prev, cur) => prev + cur, 0);\n\n\t\t\tif (this.current !== null) {\n\t\t\t\tremainingTime += this.current.track.remaining();\n\t\t\t}\n\n\t\t\treturn remainingTime;\n\t\t}\n\n\t\ttime() {\n\t\t\tif (arguments.length > 0) {\n\t\t\t\tthrow new Error('time takes no parameters');\n\t\t\t}\n\n\t\t\treturn this.duration() - this.remaining();\n\t\t}\n\n\t\tisPlaying() {\n\t\t\treturn this.current !== null && this.current.track.isPlaying();\n\t\t}\n\n\t\tisPaused() {\n\t\t\treturn this.current === null || this.current.track.isPaused();\n\t\t}\n\n\t\tisStopped() {\n\t\t\treturn this.queue.length === 0 && this.current === null;\n\t\t}\n\n\t\tisEnded() {\n\t\t\treturn this.queue.length === 0 && (this.current === null || this.current.track.isEnded());\n\t\t}\n\n\t\tisFading() {\n\t\t\treturn this.current !== null && this.current.track.isFading();\n\t\t}\n\n\t\t_next() {\n\t\t\tif (this.current !== null) {\n\t\t\t\tthis.current.track.stop();\n\t\t\t\tthis.current = null;\n\t\t\t}\n\n\t\t\tlet nextTrack;\n\n\t\t\twhile ((nextTrack = this.queue.shift())) {\n\t\t\t\tif (!nextTrack.track.isUnavailable()) {\n\t\t\t\t\tthis.current = nextTrack;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.current === null) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tthis.current.track.mute(this._mute);\n\t\t\tthis.current.track.rate(this._rate * this.current.rate);\n\t\t\tthis.current.track.volume(this._volume * this.current.volume);\n\n\t\t\t// Attempt to protect against the `loop` state being reenabled\n\t\t\t// outside of the playlist.  Mostly for unowned tracks.\n\t\t\t//\n\t\t\t// TODO: Should we reapply the `ended` event handler too?\n\t\t\tthis.current.track.loop(false);\n\n\t\t\treturn true;\n\t\t}\n\n\t\t_onEnd() {\n\t\t\tif (this.queue.length === 0) {\n\t\t\t\tif (!this._loop) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis._fillQueue();\n\t\t\t}\n\n\t\t\tif (!this._next()) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.current.track.play();\n\t\t}\n\n\t\t_drainQueue() {\n\t\t\tthis.queue.splice(0);\n\t\t}\n\n\t\t_fillQueue() {\n\t\t\tthis._drainQueue();\n\t\t\tthis.queue.push(...this.tracks.filter(trackObj => !trackObj.track.isUnavailable()));\n\n\t\t\tif (this.queue.length === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (this._shuffle) {\n\t\t\t\tthis.queue.shuffle();\n\n\t\t\t\t// Try not to immediately replay the last track when shuffling.\n\t\t\t\tif (this.queue.length > 1 && this.queue[0] === this.current) {\n\t\t\t\t\tthis.queue.push(this.queue.shift());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tAudioRunner Class.\n\t*******************************************************************************************************************/\n\tclass AudioRunner {\n\t\tconstructor(list) {\n\t\t\tif (!(list instanceof Set || list instanceof AudioRunner)) {\n\t\t\t\tthrow new TypeError('list parameter must be a Set or a AudioRunner instance');\n\t\t\t}\n\n\t\t\t// Set up our own properties.\n\t\t\tObject.defineProperties(this, {\n\t\t\t\ttrackIds : {\n\t\t\t\t\tvalue : new Set(list instanceof AudioRunner ? list.trackIds : list)\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tload() {\n\t\t\tAudioRunner._run(this.trackIds, AudioTrack.prototype.load);\n\t\t}\n\n\t\tunload() {\n\t\t\tAudioRunner._run(this.trackIds, AudioTrack.prototype.unload);\n\t\t}\n\n\t\tplay() {\n\t\t\tAudioRunner._run(this.trackIds, AudioTrack.prototype.play);\n\t\t}\n\n\t\tplayWhenAllowed() {\n\t\t\tAudioRunner._run(this.trackIds, AudioTrack.prototype.playWhenAllowed);\n\t\t}\n\n\t\tpause() {\n\t\t\tAudioRunner._run(this.trackIds, AudioTrack.prototype.pause);\n\t\t}\n\n\t\tstop() {\n\t\t\tAudioRunner._run(this.trackIds, AudioTrack.prototype.stop);\n\t\t}\n\n\t\tfade(duration, toVol, fromVol) {\n\t\t\tif (duration == null || toVol == null) { // lazy equality for null\n\t\t\t\tthrow new Error('fade requires parameters');\n\t\t\t}\n\n\t\t\tAudioRunner._run(this.trackIds, AudioTrack.prototype.fade, duration, toVol, fromVol);\n\t\t}\n\n\t\tfadeIn(duration, fromVol) {\n\t\t\tif (duration == null) { // lazy equality for null\n\t\t\t\tthrow new Error('fadeIn requires a parameter');\n\t\t\t}\n\n\t\t\tAudioRunner._run(this.trackIds, AudioTrack.prototype.fadeIn, duration, fromVol);\n\t\t}\n\n\t\tfadeOut(duration, fromVol) {\n\t\t\tif (duration == null) { // lazy equality for null\n\t\t\t\tthrow new Error('fadeOut requires a parameter');\n\t\t\t}\n\n\t\t\tAudioRunner._run(this.trackIds, AudioTrack.prototype.fadeOut, duration, fromVol);\n\t\t}\n\n\t\tfadeStop() {\n\t\t\tAudioRunner._run(this.trackIds, AudioTrack.prototype.fadeStop);\n\t\t}\n\n\t\tloop(loop) {\n\t\t\tif (loop == null) { // lazy equality for null\n\t\t\t\tthrow new Error('loop requires a parameter');\n\t\t\t}\n\n\t\t\tAudioRunner._run(this.trackIds, AudioTrack.prototype.loop, loop);\n\t\t\treturn this;\n\t\t}\n\n\t\tmute(mute) {\n\t\t\tif (mute == null) { // lazy equality for null\n\t\t\t\tthrow new Error('mute requires a parameter');\n\t\t\t}\n\n\t\t\tAudioRunner._run(this.trackIds, AudioTrack.prototype.mute, mute);\n\t\t\treturn this;\n\t\t}\n\n\t\trate(rate) {\n\t\t\tif (rate == null) { // lazy equality for null\n\t\t\t\tthrow new Error('rate requires a parameter');\n\t\t\t}\n\n\t\t\tAudioRunner._run(this.trackIds, AudioTrack.prototype.rate, rate);\n\t\t\treturn this;\n\t\t}\n\n\t\ttime(time) {\n\t\t\tif (time == null) { // lazy equality for null\n\t\t\t\tthrow new Error('time requires a parameter');\n\t\t\t}\n\n\t\t\tAudioRunner._run(this.trackIds, AudioTrack.prototype.time, time);\n\t\t\treturn this;\n\t\t}\n\n\t\tvolume(volume) {\n\t\t\tif (volume == null) { // lazy equality for null\n\t\t\t\tthrow new Error('volume requires a parameter');\n\t\t\t}\n\n\t\t\tAudioRunner._run(this.trackIds, AudioTrack.prototype.volume, volume);\n\t\t\treturn this;\n\t\t}\n\n\t\ton(...args) {\n\t\t\tAudioRunner._run(this.trackIds, AudioTrack.prototype.on, ...args);\n\t\t\treturn this;\n\t\t}\n\n\t\tone(...args) {\n\t\t\tAudioRunner._run(this.trackIds, AudioTrack.prototype.one, ...args);\n\t\t\treturn this;\n\t\t}\n\n\t\toff(...args) {\n\t\t\tAudioRunner._run(this.trackIds, AudioTrack.prototype.off, ...args);\n\t\t\treturn this;\n\t\t}\n\n\t\tstatic _run(ids, fn, ...args) {\n\t\t\tids.forEach(id => {\n\t\t\t\tconst track = _tracks.get(id);\n\n\t\t\t\tif (track) {\n\t\t\t\t\tfn.apply(track, args);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tTrack Functions.\n\t*******************************************************************************************************************/\n\t/*\n\t\tSimpleAudio.tracks.add(trackId, sources…);\n\n\t\tE.g.\n\t\t\tSimpleAudio.tracks.add(\n\t\t\t\t'over_the_top',\n\t\t\t\t'https://audiohost.tld/id/over_the_top.mp3',\n\t\t\t\t'https://audiohost.tld/id/over_the_top.ogg'\n\t\t\t);\n\t*/\n\tfunction trackAdd(/* trackId , sources… */) {\n\t\tif (arguments.length < 2) {\n\t\t\tconst errors = [];\n\t\t\tif (arguments.length < 1) { errors.push('track ID'); }\n\t\t\tif (arguments.length < 2) { errors.push('sources'); }\n\t\t\tthrow new Error(`no ${errors.join(' or ')} specified`);\n\t\t}\n\n\t\tconst id   = String(arguments[0]).trim();\n\t\tconst what = `track ID \"${id}\"`;\n\n\t\tif (_badIdRe.test(id)) {\n\t\t\tthrow new Error(`invalid ${what}: track IDs must not contain colons or whitespace`);\n\t\t}\n\n\t\tconst sources = Array.isArray(arguments[1])\n\t\t\t? Array.from(arguments[1])\n\t\t\t: Array.from(arguments).slice(1);\n\t\tlet track;\n\n\t\ttry {\n\t\t\ttrack = _newTrack(sources);\n\t\t}\n\t\tcatch (ex) {\n\t\t\tthrow new Error(`${what}: error during track initialization: ${ex.message}`);\n\t\t}\n\n\t\t// If in Test Mode and no supported sources were specified, throw an error.\n\t\tif (Config.debug && !track.hasSource()) {\n\t\t\tthrow new Error(`${what}: no supported audio sources found`);\n\t\t}\n\n\t\t// If a track by the given ID already exists, destroy it.\n\t\tif (_tracks.has(id)) {\n\t\t\t_tracks.get(id)._destroy();\n\t\t}\n\n\t\t// Add the track to the cache.\n\t\t_tracks.set(id, track);\n\t}\n\n\tfunction trackDelete(id) {\n\t\tif (_tracks.has(id)) {\n\t\t\t_tracks.get(id)._destroy();\n\t\t}\n\n\t\t// TODO: Should this also remove references to the track from groups and playlists?\n\n\t\treturn _tracks.delete(id);\n\t}\n\n\tfunction trackClear() {\n\t\t_tracks.forEach(track => track._destroy());\n\t\t_tracks.clear();\n\t}\n\n\tfunction trackHas(id) {\n\t\treturn _tracks.has(id);\n\t}\n\n\tfunction trackGet(id) {\n\t\treturn _tracks.get(id) || null;\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tGroup Functions.\n\t*******************************************************************************************************************/\n\t/*\n\t\tSimpleAudio.groups.add(groupId, trackIds…);\n\n\t\tE.g.\n\t\t\tSimpleAudio.groups.add(':ui', 'beep', 'boop', 'boing');\n\t*/\n\tfunction groupAdd(/* groupId , trackIds… */) {\n\t\tif (arguments.length < 2) {\n\t\t\tconst errors = [];\n\t\t\tif (arguments.length < 1) { errors.push('group ID'); }\n\t\t\tif (arguments.length < 2) { errors.push('track IDs'); }\n\t\t\tthrow new Error(`no ${errors.join(' or ')} specified`);\n\t\t}\n\n\t\tconst id   = String(arguments[0]).trim();\n\t\tconst what = `group ID \"${id}\"`;\n\n\t\tif (id[0] !== ':' || _badIdRe.test(id.slice(1))) {\n\t\t\tthrow new Error(`invalid ${what}: group IDs must start with a colon and must not contain colons or whitespace`);\n\t\t}\n\n\t\tif (_specialIds.includes(id)) {\n\t\t\tthrow new Error(`cannot clobber special ${what}`);\n\t\t}\n\n\t\tconst trackIds = Array.isArray(arguments[1])\n\t\t\t? Array.from(arguments[1])\n\t\t\t: Array.from(arguments).slice(1);\n\t\tlet group;\n\n\t\ttry {\n\t\t\tgroup = new Set(trackIds.map(trackId => {\n\t\t\t\tif (!_tracks.has(trackId)) {\n\t\t\t\t\tthrow new Error(`track \"${trackId}\" does not exist`);\n\t\t\t\t}\n\n\t\t\t\treturn trackId;\n\t\t\t}));\n\t\t}\n\t\tcatch (ex) {\n\t\t\tthrow new Error(`${what}: error during group initialization: ${ex.message}`);\n\t\t}\n\n\t\t// Add the group to the cache.\n\t\t_groups.set(id, Object.freeze(Array.from(group)));\n\t}\n\n\tfunction groupDelete(id) {\n\t\treturn _groups.delete(id);\n\t}\n\n\tfunction groupClear() {\n\t\t_groups.clear();\n\t}\n\n\tfunction groupHas(id) {\n\t\treturn _groups.has(id);\n\t}\n\n\tfunction groupGet(id) {\n\t\treturn _groups.get(id) || null;\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tPlaylist Functions.\n\t*******************************************************************************************************************/\n\t/*\n\t\tSimpleAudio.lists.add(listId, sources…);\n\t\t\tWhere `sources` may be either a track ID or descriptor (object).\n\t\t\tTrack descriptors are either { id, [own], [rate], [volume] } or { sources, [rate], [volume] }.\n\n\t\tNOTE: Rate properties are currently unsupported due to poor browser support.\n\n\t\tE.g.\n\t\t\tSimpleAudio.lists.add(\n\t\t\t\t'bgm',\n\t\t\t\t'over_the_top',\n\t\t\t\t{\n\t\t\t\t\tid     : 'heavens_a_lie',\n\t\t\t\t\tvolume : 0.5,\n\t\t\t\t\town    : true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tsources : [\n\t\t\t\t\t\t'https://audiohost.tld/id/swamped.mp3',\n\t\t\t\t\t\t'https://audiohost.tld/id/swamped.ogg'\n\t\t\t\t\t],\n\t\t\t\t\tvolume  : 0.75\n\t\t\t\t}\n\t\t\t);\n\t*/\n\tfunction listAdd(/* listId , sources… */) {\n\t\tif (arguments.length < 2) {\n\t\t\tconst errors = [];\n\t\t\tif (arguments.length < 1) { errors.push('list ID'); }\n\t\t\tif (arguments.length < 2) { errors.push('track IDs'); }\n\t\t\tthrow new Error(`no ${errors.join(' or ')} specified`);\n\t\t}\n\n\t\tconst id   = String(arguments[0]).trim();\n\t\tconst what = `list ID \"${id}\"`;\n\n\t\tif (_badIdRe.test(id)) {\n\t\t\treturn this.error(`invalid ${what}: list IDs must not contain colons or whitespace`);\n\t\t}\n\n\t\tconst descriptors = Array.isArray(arguments[1])\n\t\t\t? Array.from(arguments[1])\n\t\t\t: Array.from(arguments).slice(1);\n\t\tlet list;\n\n\t\ttry {\n\t\t\tlist = new AudioList(descriptors.map(desc => {\n\t\t\t\tif (desc === null) {\n\t\t\t\t\tthrow new Error('track descriptor must be a string or object (type: null)');\n\t\t\t\t}\n\n\t\t\t\tswitch (typeof desc) {\n\t\t\t\tcase 'string':\n\t\t\t\t\t// Simply a track ID, so convert it into an object.\n\t\t\t\t\tdesc = { id : desc }; // eslint-disable-line no-param-reassign\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'object':\n\t\t\t\t\tif (!desc.hasOwnProperty('id') && !desc.hasOwnProperty('sources')) {\n\t\t\t\t\t\tthrow new Error('track descriptor must contain one of either an \"id\" or a \"sources\" property');\n\t\t\t\t\t}\n\t\t\t\t\telse if (desc.hasOwnProperty('id') && desc.hasOwnProperty('sources')) {\n\t\t\t\t\t\tthrow new Error('track descriptor must contain either an \"id\" or a \"sources\" property, not both');\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error(`track descriptor must be a string or object (type: ${typeof desc})`);\n\t\t\t\t}\n\n\t\t\t\tlet own;\n\t\t\t\t// let rate;\n\t\t\t\tlet track;\n\t\t\t\tlet volume;\n\n\t\t\t\tif (desc.hasOwnProperty('id')) {\n\t\t\t\t\tif (typeof desc.id !== 'string') {\n\t\t\t\t\t\tthrow new Error('\"id\" property must be a string');\n\t\t\t\t\t}\n\t\t\t\t\tif (!_tracks.has(desc.id)) {\n\t\t\t\t\t\tthrow new Error(`track \"${desc.id}\" does not exist`);\n\t\t\t\t\t}\n\n\t\t\t\t\ttrack = _tracks.get(desc.id);\n\t\t\t\t}\n\t\t\t\telse if (desc.hasOwnProperty('sources')) {\n\t\t\t\t\tif (!Array.isArray(desc.sources) || desc.sources.length === 0) {\n\t\t\t\t\t\tthrow new Error('\"sources\" property must be a non-empty array');\n\t\t\t\t\t}\n\t\t\t\t\tif (desc.hasOwnProperty('own')) {\n\t\t\t\t\t\tthrow new Error('\"own\" property is not allowed with the \"sources\" property');\n\t\t\t\t\t}\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\ttrack = _newTrack(desc.sources);\n\t\t\t\t\t\town = true;\n\t\t\t\t\t}\n\t\t\t\t\tcatch (ex) {\n\t\t\t\t\t\tthrow new Error(`error during track initialization: ${ex.message}`);\n\t\t\t\t\t}\n\n\t\t\t\t\t// If in Test Mode and no supported sources were specified, return an error.\n\t\t\t\t\tif (Config.debug && !track.hasSource()) {\n\t\t\t\t\t\tthrow new Error('no supported audio sources found');\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (desc.hasOwnProperty('own')) {\n\t\t\t\t\tif (typeof desc.own !== 'boolean') {\n\t\t\t\t\t\tthrow new Error('\"own\" property must be a boolean');\n\t\t\t\t\t}\n\n\t\t\t\t\town = desc.own;\n\n\t\t\t\t\tif (own) {\n\t\t\t\t\t\ttrack = track.clone();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// if (desc.hasOwnProperty('rate')) {\n\t\t\t\t// \tif (\n\t\t\t\t// \t\t   typeof desc.rate !== 'number'\n\t\t\t\t// \t\t|| Number.isNaN(desc.rate)\n\t\t\t\t// \t\t|| !Number.isFinite(desc.rate)\n\t\t\t\t// \t) {\n\t\t\t\t// \t\tthrow new Error('\"rate\" property must be a finite number');\n\t\t\t\t// \t}\n\t\t\t\t//\n\t\t\t\t// \trate = desc.rate;\n\t\t\t\t// }\n\n\t\t\t\tif (desc.hasOwnProperty('volume')) {\n\t\t\t\t\tif (\n\t\t\t\t\t\t   typeof desc.volume !== 'number'\n\t\t\t\t\t\t|| Number.isNaN(desc.volume)\n\t\t\t\t\t\t|| !Number.isFinite(desc.volume)\n\t\t\t\t\t\t|| desc.volume < 0\n\t\t\t\t\t) {\n\t\t\t\t\t\tthrow new Error('\"volume\" property must be a non-negative finite number');\n\t\t\t\t\t}\n\n\t\t\t\t\tvolume = desc.volume;\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\town    : own != null ? own : false, // lazy equality for null,\n\t\t\t\t\t// rate   : rate != null ? rate : track.rate(), // lazy equality for null,\n\t\t\t\t\ttrack,\n\t\t\t\t\tvolume : volume != null ? volume : track.volume() // lazy equality for null\n\t\t\t\t};\n\t\t\t}));\n\t\t}\n\t\tcatch (ex) {\n\t\t\tthrow new Error(`${what}: error during playlist initialization: ${ex.message}`);\n\t\t}\n\n\t\t// If a playlist by the given ID already exists, destroy it.\n\t\tif (_lists.has(id)) {\n\t\t\t_lists.get(id)._destroy();\n\t\t}\n\n\t\t// Add the playlist to the cache.\n\t\t_lists.set(id, list);\n\t}\n\n\tfunction listDelete(id) {\n\t\tif (_lists.has(id)) {\n\t\t\t_lists.get(id)._destroy();\n\t\t}\n\n\t\treturn _lists.delete(id);\n\t}\n\n\tfunction listClear() {\n\t\t_lists.forEach(list => list._destroy());\n\t\t_lists.clear();\n\t}\n\n\tfunction listHas(id) {\n\t\treturn _lists.has(id);\n\t}\n\n\tfunction listGet(id) {\n\t\treturn _lists.get(id) || null;\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tRunner Functions.\n\t*******************************************************************************************************************/\n\tconst _runnerParseSelector = (() => {\n\t\tconst notWsRe = /\\S/g;\n\t\tconst parenRe = /[()]/g;\n\n\t\tfunction processNegation(str, startPos) {\n\t\t\tlet match;\n\n\t\t\tnotWsRe.lastIndex = startPos;\n\t\t\tmatch = notWsRe.exec(str);\n\n\t\t\tif (match === null || match[0] !== '(') {\n\t\t\t\tthrow new Error('invalid \":not()\" syntax: missing parentheticals');\n\t\t\t}\n\n\t\t\tparenRe.lastIndex = notWsRe.lastIndex;\n\t\t\tconst start  = notWsRe.lastIndex;\n\t\t\tconst result = { str : '', nextMatch : -1 };\n\t\t\tlet depth = 1;\n\n\t\t\twhile ((match = parenRe.exec(str)) !== null) {\n\t\t\t\tif (match[0] === '(') {\n\t\t\t\t\t++depth;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t--depth;\n\t\t\t\t}\n\n\t\t\t\tif (depth < 1) {\n\t\t\t\t\tresult.nextMatch = parenRe.lastIndex;\n\t\t\t\t\tresult.str = str.slice(start, result.nextMatch - 1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\n\t\tfunction parseSelector(idArg) {\n\t\t\tconst ids  = [];\n\t\t\tconst idRe = /:?[^\\s:()]+/g;\n\t\t\tlet match;\n\n\t\t\twhile ((match = idRe.exec(idArg)) !== null) {\n\t\t\t\tconst id = match[0];\n\n\t\t\t\t// Group negation.\n\t\t\t\tif (id === ':not') {\n\t\t\t\t\tif (ids.length === 0) {\n\t\t\t\t\t\tthrow new Error('invalid negation: no group ID preceded \":not()\"');\n\t\t\t\t\t}\n\n\t\t\t\t\tconst parent = ids[ids.length - 1];\n\n\t\t\t\t\tif (parent.id[0] !== ':') {\n\t\t\t\t\t\tthrow new Error(`invalid negation of track \"${parent.id}\": only groups may be negated with \":not()\"`);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst negation = processNegation(idArg, idRe.lastIndex);\n\n\t\t\t\t\tif (negation.nextMatch === -1) {\n\t\t\t\t\t\tthrow new Error('unknown error parsing \":not()\"');\n\t\t\t\t\t}\n\n\t\t\t\t\tidRe.lastIndex = negation.nextMatch;\n\t\t\t\t\tparent.not = parseSelector(negation.str);\n\t\t\t\t}\n\n\t\t\t\t// Group or track ID.\n\t\t\t\telse {\n\t\t\t\t\tids.push({ id });\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn ids;\n\t\t}\n\n\t\treturn parseSelector;\n\t})();\n\n\t/*\n\t\tSimpleAudio.select(selector).…;\n\n\t\tE.g.\n\t\t\tSimpleAudio.select(':ui').…\n\t\t\tSimpleAudio.select(':ui:not(boop)').…\n\t\t\tSimpleAudio.select('boop beep').…\n\t\t\tSimpleAudio.select(':ui :sfx').…\n\t\t\tSimpleAudio.select(':ui:not(boop) :sfx overthetop').…\n\t*/\n\tfunction runnerGet(/* selector */) {\n\t\tif (arguments.length === 0) {\n\t\t\tthrow new Error('no track selector specified');\n\t\t}\n\n\t\tconst selector = String(arguments[0]).trim();\n\t\tconst trackIds = new Set();\n\n\t\ttry {\n\t\t\tconst allIds = Array.from(_tracks.keys());\n\n\t\t\tfunction renderIds(idObj) {\n\t\t\t\tconst id = idObj.id;\n\t\t\t\tlet ids;\n\n\t\t\t\tswitch (id) {\n\t\t\t\tcase ':all':     ids = allIds; break;\n\t\t\t\tcase ':looped':  ids = allIds.filter(id => _tracks.get(id).loop()); break;\n\t\t\t\tcase ':muted':   ids = allIds.filter(id => _tracks.get(id).mute()); break;\n\t\t\t\tcase ':paused':  ids = allIds.filter(id => _tracks.get(id).isPaused()); break;\n\t\t\t\tcase ':playing': ids = allIds.filter(id => _tracks.get(id).isPlaying()); break;\n\t\t\t\tdefault:         ids = id[0] === ':' ? _groups.get(id) : [id]; break;\n\t\t\t\t}\n\n\t\t\t\tif (idObj.hasOwnProperty('not')) {\n\t\t\t\t\tconst negated = idObj.not.map(idObj => renderIds(idObj)).flat(Infinity);\n\t\t\t\t\tids = ids.filter(id => !negated.includes(id));\n\t\t\t\t}\n\n\t\t\t\treturn ids;\n\t\t\t}\n\n\t\t\t_runnerParseSelector(selector).forEach(idObj => renderIds(idObj).forEach(id => {\n\t\t\t\tif (!_tracks.has(id)) {\n\t\t\t\t\tthrow new Error(`track \"${id}\" does not exist`);\n\t\t\t\t}\n\n\t\t\t\ttrackIds.add(id);\n\t\t\t}));\n\t\t}\n\t\tcatch (ex) {\n\t\t\tthrow new Error(`error during runner initialization: ${ex.message}`);\n\t\t}\n\n\t\treturn new AudioRunner(trackIds);\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tMaster Audio Functions.\n\t*******************************************************************************************************************/\n\tfunction masterLoad() {\n\t\tpublish('load');\n\t}\n\n\tfunction masterLoadWithScreen() {\n\t\tpublish('loadwithscreen');\n\t}\n\n\tfunction masterMute(mute) {\n\t\tif (mute == null) { // lazy equality for null\n\t\t\treturn _masterMute;\n\t\t}\n\n\t\t_masterMute = !!mute;\n\t\tpublish('mute', _masterMute);\n\t}\n\n\tfunction masterMuteOnHidden(mute) {\n\t\t// NOTE: Some older browsers—notably: IE 9—do not support the Page Visibility API.\n\t\tif (!Visibility.isEnabled()) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (mute == null) { // lazy equality for null\n\t\t\treturn _masterMuteOnHidden;\n\t\t}\n\n\t\t_masterMuteOnHidden = !!mute;\n\n\t\tconst namespace = '.SimpleAudio_masterMuteOnHidden';\n\n\t\tif (_masterMuteOnHidden) {\n\t\t\tconst visibilityChange = `${Visibility.changeEvent}${namespace}`;\n\t\t\tjQuery(document)\n\t\t\t\t.off(namespace)\n\t\t\t\t.on(visibilityChange, () => masterMute(Visibility.isHidden()));\n\n\t\t\t// Only change the mute state initially if hidden.\n\t\t\tif (Visibility.isHidden()) {\n\t\t\t\tmasterMute(true);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tjQuery(document).off(namespace);\n\t\t}\n\t}\n\n\tfunction masterRate(rate) {\n\t\tif (rate == null) { // lazy equality for null\n\t\t\treturn _masterRate;\n\t\t}\n\n\t\tif (typeof rate !== 'number' || Number.isNaN(rate) || !Number.isFinite(rate)) {\n\t\t\tthrow new Error('rate must be a finite number');\n\t\t}\n\n\t\t_masterRate = Math.clamp(rate, 0.2, 5); // clamp to 5× slower & faster\n\t\tpublish('rate', _masterRate);\n\t}\n\n\tfunction masterStop() {\n\t\tpublish('stop');\n\t}\n\n\tfunction masterUnload() {\n\t\tpublish('unload');\n\t}\n\n\tfunction masterVolume(volume) {\n\t\tif (volume == null) { // lazy equality for null\n\t\t\treturn _masterVolume;\n\t\t}\n\n\t\tif (typeof volume !== 'number' || Number.isNaN(volume) || !Number.isFinite(volume)) {\n\t\t\tthrow new Error('volume must be a finite number');\n\t\t}\n\n\t\t_masterVolume = Math.clamp(volume, 0, 1); // clamp to 0 (silent) & 1 (full loudness)\n\t\tpublish('volume', _masterVolume);\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tSubscription Functions.\n\t*******************************************************************************************************************/\n\tfunction subscribe(id, callback) {\n\t\tif (typeof callback !== 'function') {\n\t\t\tthrow new Error('callback parameter must be a function');\n\t\t}\n\n\t\t_subscribers.set(id, callback);\n\t}\n\n\tfunction unsubscribe(id) {\n\t\t_subscribers.delete(id);\n\t}\n\n\tfunction publish(mesg, data) {\n\t\t_subscribers.forEach(fn => fn(mesg, data));\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tUtility Functions.\n\t*******************************************************************************************************************/\n\tfunction _newTrack(sources) {\n\t\treturn new AudioTrack(sources.map(source => {\n\t\t\t// Handle audio passages.\n\t\t\tif (source.slice(0, 5) !== 'data:' && Story.has(source)) {\n\t\t\t\tconst passage = Story.get(source);\n\n\t\t\t\tif (passage.tags.includes('Twine.audio')) {\n\t\t\t\t\treturn passage.text.trim();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Handle URIs—possibly prefixed with a format specifier.\n\t\t\tconst match = _formatSpecRe.exec(source);\n\t\t\treturn match === null ? source : {\n\t\t\t\tformat : match[1],\n\t\t\t\tsrc    : match[2]\n\t\t\t};\n\t\t}));\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************************************************/\n\treturn Object.freeze(Object.defineProperties({}, {\n\t\t// Track Functions.\n\t\ttracks : {\n\t\t\tvalue : Object.freeze(Object.defineProperties({}, {\n\t\t\t\tadd    : { value : trackAdd },\n\t\t\t\tdelete : { value : trackDelete },\n\t\t\t\tclear  : { value : trackClear },\n\t\t\t\thas    : { value : trackHas },\n\t\t\t\tget    : { value : trackGet }\n\t\t\t}))\n\t\t},\n\n\t\t// Group Functions.\n\t\tgroups : {\n\t\t\tvalue : Object.freeze(Object.defineProperties({}, {\n\t\t\t\tadd    : { value : groupAdd },\n\t\t\t\tdelete : { value : groupDelete },\n\t\t\t\tclear  : { value : groupClear },\n\t\t\t\thas    : { value : groupHas },\n\t\t\t\tget    : { value : groupGet }\n\t\t\t}))\n\t\t},\n\n\t\t// Playlist Functions.\n\t\tlists : {\n\t\t\tvalue : Object.freeze(Object.defineProperties({}, {\n\t\t\t\tadd    : { value : listAdd },\n\t\t\t\tdelete : { value : listDelete },\n\t\t\t\tclear  : { value : listClear },\n\t\t\t\thas    : { value : listHas },\n\t\t\t\tget    : { value : listGet }\n\t\t\t}))\n\t\t},\n\n\t\t// Runner Functions.\n\t\tselect : { value : runnerGet },\n\n\t\t// Master Audio Functions.\n\t\tload           : { value : masterLoad },\n\t\tloadWithScreen : { value : masterLoadWithScreen },\n\t\tmute           : { value : masterMute },\n\t\tmuteOnHidden   : { value : masterMuteOnHidden },\n\t\trate           : { value : masterRate },\n\t\tstop           : { value : masterStop },\n\t\tunload         : { value : masterUnload },\n\t\tvolume         : { value : masterVolume }\n\t}));\n})();\n\n/***********************************************************************************************************************\n\n\tstate.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/* global Config, Diff, Engine, PRNG, Scripting, clone, session, storage, V */\n\nvar State = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\t// History moment stack.\n\tlet _history = [];\n\n\t// Currently active/played moment.\n\tlet _active = momentCreate();\n\n\t// Currently active/played moment index.\n\tlet _activeIndex = -1;\n\n\t// Titles of all moments which have expired (i.e. fallen off the bottom of the stack).\n\tlet _expired = [];\n\n\t// (optional) Seedable PRNG object.\n\tlet _prng = null;\n\n\t// Temporary variables object.\n\tlet _tempVariables = {};\n\n\n\t/*******************************************************************************************************************\n\t\tState Functions.\n\t*******************************************************************************************************************/\n\t/*\n\t\tResets the story state.\n\t*/\n\tfunction stateReset() {\n\t\tif (DEBUG) { console.log('[State/stateReset()]'); }\n\n\t\t/*\n\t\t\tDelete the active session.\n\t\t*/\n\t\tsession.delete('state');\n\n\t\t/*\n\t\t\tReset the properties.\n\t\t*/\n\t\t_history     = [];\n\t\t_active      = momentCreate();\n\t\t_activeIndex = -1;\n\t\t_expired     = [];\n\t\t_prng        = _prng === null ? null : new PRNG(_prng.seed);\n\t}\n\n\t/*\n\t\tRestores the story state from the active session.\n\t*/\n\tfunction stateRestore(soft) {\n\t\tif (DEBUG) { console.log('[State/stateRestore()]'); }\n\n\t\t/*\n\t\t\tAttempt to restore an active session.\n\t\t*/\n\t\tif (session.has('state') && !soft) {\n\t\t\t/*\n\t\t\t\tRetrieve the session.\n\t\t\t*/\n\t\t\tconst stateObj = session.get('state');\n\n\t\t\tif (DEBUG) { console.log('\\tsession state:', stateObj); }\n\n\t\t\tif (stateObj == null) { // lazy equality for null\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t/*\n\t\t\t\tRestore the session.\n\t\t\t*/\n\t\t\tstateUnmarshal(stateObj);\n\t\t\treturn true;\n\t\t}\n\n\t\t// perform soft reset from history\n\t\tif (soft) {\n\t\t\tconst frame = _history[_activeIndex];\n\t\t\tif (!frame) return false;\n\t\t\tconst states = Config.history.maxSessionStates;\n\t\t\tConfig.history.maxSessionStates = 0; // prevent writes into sessionStorage\n\t\t\tmomentActivate(frame);\n\t\t\tConfig.history.maxSessionStates = states;\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tfunction reduceHistorySize(stateObj, targetSize) {\n\t\tif (!targetSize) return;\n\t\t// pick up which frames to preserve, aiming at preserving the frames both before and after the active one\n\t\tconst currentIndex = stateObj.index;\n\t\tconst currentHistoryLength = stateObj.history.length;\n\t\ttargetSize = Math.min(currentHistoryLength, targetSize);\n\t\tconst invertedIndex = currentHistoryLength - 1 - currentIndex;\n\t\tlet startingIndex = 0;\n\t\tconst radius = Math.floor(targetSize / 2); // how many frames can we cover on both sides from active frame\n\n\t\tif (currentIndex < invertedIndex) { // active index is closer to the beginning of the array [* i * * * *]\n\t\t\tif (radius >= currentIndex) startingIndex = 0; // there's enough space to include the oldest frame [(* i *) * * *]\n\t\t\telse startingIndex = currentIndex - radius; // starting index will extend into the past as much as the radius can allow [* (* i *) * *]\n\t\t}\n\t\telse { // active index is closer to the end of the array [* * * * i *]\n\t\t\tif (radius >= invertedIndex) startingIndex = currentHistoryLength - targetSize; // enough space to include the newest frame [* * * (* i *)]\n\t\t\telse startingIndex = currentIndex - radius; // [* * (* i *) *]\n\t\t}\n\t\tstateObj.index -= startingIndex; // correct the index\n\t\tstateObj.history = stateObj.history.slice(startingIndex, startingIndex + targetSize);\n\n\t\treturn stateObj;\n\t}\n\n\t/*\n\t\tReturns the current story state marshaled into a serializable object.\n\t*/\n\tfunction stateMarshal(noDelta = true, depth = Config.history.maxSessionStates, useClone = false) {\n\t\tif (depth === 0) return null; // don't bother\n\t\t/*\n\t\t\tGather the properties.\n\t\t*/\n\t\tconst stateObj = {\n\t\t\tindex   : _activeIndex,\n\t\t\thistory : useClone ? clone(_history) : _history\n\t\t};\n\n\t\tif (_history.length > depth) reduceHistorySize(stateObj, depth);\n\t\tif (!noDelta) {\n\t\t\tstateObj.delta = historyDeltaEncode(stateObj.history);\n\t\t\tdelete stateObj.history;\n\t\t}\n\n\t\tif (_expired.length > 0) stateObj.expired = [..._expired];\n\t\tif (_prng !== null && _prng.hasOwnProperty('seed')) stateObj.seed = _prng.seed;\n\n\t\treturn stateObj;\n\t}\n\n\t/*\n\t\tRestores the story state from a marshaled story state serialization object.\n\t*/\n\tfunction stateUnmarshal(stateObj, noDeltaFlag = true) {\n\t\tlet noDelta = noDeltaFlag;\n\t\tif (stateObj == null) { // lazy equality for null\n\t\t\tthrow new Error('state object is null or undefined');\n\t\t}\n\n\t\tif (!stateObj.hasOwnProperty(noDelta ? 'history' : 'delta') || stateObj[noDelta ? 'history' : 'delta'].length === 0) {\n\t\t\tif (stateObj.hasOwnProperty('delta')) {\n\t\t\t\tconsole.log(\"warning: stateObj is delta-encoded when it shouldn't be\");\n\t\t\t\tnoDelta = false;\n\t\t\t}\n\t\t\telse if (stateObj.hasOwnProperty('history')) {\n\t\t\t\tconsole.log('warning: stateObj is not delta-encoded when it should be');\n\t\t\t\tnoDelta = true;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new Error('state object has no history or history is empty');\n\t\t\t}\n\t\t}\n\n\t\tif (!stateObj.hasOwnProperty('index')) {\n\t\t\tthrow new Error('state object has no index');\n\t\t}\n\n\t\t/*\n\t\t\tRestore the properties.\n\t\t*/\n\t\t_history     = noDelta ? clone(stateObj.history) : historyDeltaDecode(stateObj.delta);\n\t\t_activeIndex = stateObj.index;\n\t\t_expired     = stateObj.hasOwnProperty('expired') ? [...stateObj.expired] : [];\n\n\t\tif (stateObj.hasOwnProperty('seed') && _prng !== null) {\n\t\t\t/*\n\t\t\t\tWe only need to restore the PRNG's seed here as `momentActivate()` will handle\n\t\t\t\tfully restoring the PRNG to its proper state.\n\t\t\t*/\n\t\t\t_prng.seed = stateObj.seed;\n\t\t}\n\n\t\t/*\n\t\t\tActivate the current moment (do this only after all properties have been restored).\n\t\t*/\n\t\tmomentActivate(_activeIndex);\n\t}\n\n\t/*\n\t\tReturns the current story state marshaled into a save-compatible serializable object.\n\t*/\n\tfunction stateMarshalForSave(depth = 100, noDelta = true) {\n\t\treturn stateMarshal(noDelta, depth, true);\n\t}\n\n\t/*\n\t\tRestores the story state from a marshaled save-compatible story state serialization object.\n\t*/\n\tfunction stateUnmarshalForSave(stateObj) {\n\t\treturn stateUnmarshal(stateObj, true);\n\t}\n\n\t/*\n\t\tReturns the titles of expired moments.\n\t*/\n\tfunction stateExpired() {\n\t\treturn _expired;\n\t}\n\n\t/*\n\t\tReturns the total number of played moments (expired + in-play history moments).\n\t*/\n\tfunction stateTurns() {\n\t\treturn _expired.length + historyLength();\n\t}\n\n\t/*\n\t\tReturns the passage titles of all played moments (expired + in-play history moments).\n\t*/\n\tfunction stateTitles() {\n\t\treturn _expired.concat(_history.slice(0, historyLength()).map(moment => moment.title));\n\t}\n\n\t/*\n\t\tReturns whether a passage with the given title has been played (expired + in-play history moments).\n\t*/\n\tfunction stateHasPlayed(title) {\n\t\tif (title == null || title === '') { // lazy equality for null\n\t\t\treturn false;\n\t\t}\n\n\t\tif (_expired.includes(title)) {\n\t\t\treturn true;\n\t\t}\n\t\telse if (_history.slice(0, historyLength()).some(moment => moment.title === title)) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * @returns {object} decoded session state\n\t */\n\tfunction getSessionState() {\n\t\tif (Config.history.maxSessionStates === 0) return;\n\n\t\tconst sessionState = session.get(\"state\");\n\t\t// if (Object.hasOwn(sessionState, \"delta\")) {\n\t\tif (sessionState.hasOwnProperty(\"delta\")) {\n\t\t\tsessionState.history = State.deltaDecode(sessionState.delta);\n\t\t\tdelete sessionState.delta;\n\t\t}\n\t\treturn sessionState;\n\t}\n\n\t/**\n\t * Tries saving sessionState into sessionStorage until it fits the quota.\n\t * sessionState must have history property.\n\t *\n\t * @param {object} sessionState decoded session state\n\t */\n\tfunction setSessionState(sessionState) {\n\t\tif (!sessionState || !sessionState.history) throw new Error(\"setSessionState error: not a valid sessionState object\");\n\t\tlet pass = false;\n\t\tlet sstates = Config.history.maxSessionStates;\n\t\tif (sstates === 0) return pass;\n\n\t\ttry {\n\t\t\t// if history is bigger than session states limit, reduce the history to match\n\t\t\tif (sessionState.history.length > sstates) reduceHistorySize(sessionState, sstates);\n\t\t\tif (sstates) session.set(\"state\", sessionState); // don't do session writes if sstates is 0, NaN, undefined, etc.\n\t\t\tpass = true;\n\t\t}\n\t\tcatch (ex) {\n\t\t\tconsole.log(\"session.set failed, recovering\");\n\t\t\tif (sstates > sessionState.history.length) sstates = sessionState.length;\n\t\t\twhile (sstates && !pass) {\n\t\t\t\ttry {\n\t\t\t\t\tsstates--;\n\t\t\t\t\treduceHistorySize(sessionState, sstates);\n\t\t\t\t\tsession.set(\"state\", sessionState);\n\t\t\t\t\tpass = true;\n\t\t\t\t}\n\t\t\t\tcatch (ex) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tConfig.history.maxSessionStates = sstates;\n\t\t\tif (V.options) V.options.maxSessionStates = sstates;\n\t\t\t// eslint-disable-next-line no-undef\n\t\t\tif (Errors) Errors.report(\"Save data is too big for current History depth setting. It's value was automatically adjusted to \" + sstates);\n\t\t}\n\t\treturn pass;\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tMoment Functions.\n\t*******************************************************************************************************************/\n\t/*\n\t\tReturns a new moment object created from the given passage title and variables object.\n\t*/\n\tfunction momentCreate(title, variables) {\n\t\treturn {\n\t\t\ttitle     : title == null ? '' : String(title),       // lazy equality for null\n\t\t\tvariables : variables == null ? {} : clone(variables) // lazy equality for null\n\t\t};\n\t}\n\n\t/*\n\t\tReturns the active (present) moment.\n\t*/\n\tfunction momentActive() {\n\t\treturn _active;\n\t}\n\n\t/*\n\t\tReturns the index within the history of the active (present) moment.\n\t*/\n\tfunction momentActiveIndex() {\n\t\treturn _activeIndex;\n\t}\n\n\t/*\n\t\tReturns the title from the active (present) moment.\n\t*/\n\tfunction momentActiveTitle() {\n\t\treturn _active.title;\n\t}\n\n\t/*\n\t\tReturns the variables from the active (present) moment.\n\t*/\n\tfunction momentActiveVariables() {\n\t\treturn _active.variables;\n\t}\n\n\t/*\n\t\tReturns the active (present) moment after setting it to either the given moment object\n\t\tor the moment object at the given history index.  Additionally, updates the active session\n\t\tand triggers a history update event.\n\t*/\n\tfunction momentActivate(moment) {\n\t\tif (moment == null) { // lazy equality for null\n\t\t\tthrow new Error('moment activation attempted with null or undefined');\n\t\t}\n\n\t\t/*\n\t\t\tSet the active moment.\n\t\t*/\n\t\tswitch (typeof moment) {\n\t\tcase 'object':\n\t\t\t_active = clone(moment);\n\t\t\tbreak;\n\n\t\tcase 'number':\n\t\t\tif (historyIsEmpty()) {\n\t\t\t\tthrow new Error('moment activation attempted with index on empty history');\n\t\t\t}\n\n\t\t\tif (moment < 0 || moment >= historySize()) {\n\t\t\t\tthrow new RangeError(`moment activation attempted with out-of-bounds index; need [0, ${historySize() - 1}], got ${moment}`);\n\t\t\t}\n\n\t\t\t_active = clone(_history[moment]);\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tthrow new TypeError(`moment activation attempted with a \"${typeof moment}\"; must be an object or valid history stack index`);\n\t\t}\n\n\t\t/*\n\t\t\tRestore the seedable PRNG.\n\t\t*/\n\t\tif (_prng !== null) {\n\t\t\t_prng = new PRNG(_prng.seed, _active.pull);\n\t\t}\n\n\t\t/*\n\t\t\tUpdate the active session.\n\t\t*/\n\t\tlet pass = false;\n\t\twhile (Config.history.maxSessionStates > 0 && !pass) {\n\t\t\ttry {\n\t\t\t\tsession.set('state', stateMarshal());\n\t\t\t\tpass = true;\n\t\t\t}\n\t\t\tcatch { // maxSessionStates is too high to fit sessionStorage\n\t\t\t\tconsole.log('session.set error, reducing maxSessionStates');\n\t\t\t\t// eslint-disable-next-line max-len\n\t\t\t\tif (Config.history.maxSessionStates > State.history.length) Config.history.maxSessionStates = State.history.length;\n\t\t\t\tConfig.history.maxSessionStates--;\n\t\t\t\tif (window.Errors) { // call dol-specific errors reporter if available\n\t\t\t\t\twindow.Errors.report(`Save data is too big for current history depth setting. It's value was auto-adjusted to ${Config.history.maxSessionStates}`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/*\n\t\t\tTrigger a global `:historyupdate` event.\n\n\t\t\tNOTE: We do this here because setting a new active moment is a core component\n\t\t\tof, virtually, all history updates.\n\t\t*/\n\t\tjQuery.event.trigger(':historyupdate');\n\n\t\treturn _active;\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tHistory Functions.\n\t*******************************************************************************************************************/\n\t/*\n\t\tReturns the moment history.\n\t*/\n\tfunction historyGet() {\n\t\treturn _history;\n\t}\n\n\t/*\n\t\tReturns the number of active history moments (past only).\n\t*/\n\tfunction historyLength() {\n\t\treturn _activeIndex + 1;\n\t}\n\n\t/*\n\t\tReturns the total number of history moments (past + future).\n\t*/\n\tfunction historySize() {\n\t\treturn _history.length;\n\t}\n\n\t/*\n\t\tReturns whether the history is empty.\n\t*/\n\tfunction historyIsEmpty() {\n\t\treturn _history.length === 0;\n\t}\n\n\t/*\n\t\tReturns the current (pre-play version of the active) moment within the history.\n\t*/\n\tfunction historyCurrent() {\n\t\treturn _history.length > 0 ? _history[_activeIndex] : null;\n\t}\n\n\t/*\n\t\tReturns the topmost (most recent) moment within the history.\n\t*/\n\tfunction historyTop() {\n\t\treturn _history.length > 0 ? _history[_history.length - 1] : null;\n\t}\n\n\t/*\n\t\tReturns the bottommost (least recent) moment within the history.\n\t*/\n\tfunction historyBottom() {\n\t\treturn _history.length > 0 ? _history[0] : null;\n\t}\n\n\t/*\n\t\tReturns the moment at the given index within the history.\n\t*/\n\tfunction historyIndex(index) {\n\t\tif (historyIsEmpty() || index < 0 || index > _activeIndex) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn _history[index];\n\t}\n\n\t/*\n\t\tReturns the moment at the given offset from the active moment within the history.\n\t*/\n\tfunction historyPeek(offset) {\n\t\tif (historyIsEmpty()) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst lengthOffset = 1 + (offset ? Math.abs(offset) : 0);\n\n\t\tif (lengthOffset > historyLength()) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn _history[historyLength() - lengthOffset];\n\t}\n\n\t/*\n\t\tReturns whether a moment with the given title exists within the history.\n\t*/\n\tfunction historyHas(title) {\n\t\tif (historyIsEmpty() || title == null || title === '') { // lazy equality for null\n\t\t\treturn false;\n\t\t}\n\n\t\tfor (let i = _activeIndex; i >= 0; --i) {\n\t\t\tif (_history[i].title === title) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/*\n\t\tCreates a new moment and pushes it onto the history, discarding future moments if necessary.\n\t*/\n\tfunction historyCreate(title) {\n\t\tif (DEBUG) { console.log(`[State/historyCreate(title: \"${title}\")]`); }\n\n\t\t/*\n\t\t\tTODO: It might be good to have some assertions about the passage title here.\n\t\t*/\n\n\t\t/*\n\t\t\tIf we're not at the top of the stack, discard the future moments.\n\t\t*/\n\t\tif (historyLength() < historySize()) {\n\t\t\tif (DEBUG) { console.log(`\\tnon-top push; discarding ${historySize() - historyLength()} future moments`); }\n\n\t\t\t_history.splice(historyLength(), historySize() - historyLength());\n\t\t}\n\n\t\t/*\n\t\t\tPush the new moment onto the history stack.\n\t\t*/\n\t\t_history.push(momentCreate(title, _active.variables));\n\n\t\tif (_prng) {\n\t\t\tconst top = historyTop();\n\t\t\ttop.pull = _prng.pull;\n\t\t}\n\n\t\t/*\n\t\t\tTruncate the history, if necessary, by discarding moments from the bottom.\n\t\t*/\n\t\twhile (historySize() > Config.history.maxStates) {\n\t\t\tif (Config.history.maxExpired === 0) _history.shift();\n\t\t\telse {\n\t\t\t\t_expired.push(_history.shift().title);\n\t\t\t}\n\t\t\twhile (_expired.length > Config.history.maxExpired) _expired.shift();\n\t\t}\n\n\t\t/*\n\t\t\tActivate the new top moment.\n\t\t*/\n\t\t_activeIndex = historySize() - 1;\n\t\tmomentActivate(_activeIndex);\n\n\t\treturn historyLength();\n\t}\n\n\t/*\n\t\tActivate the moment at the given index within the history.\n\t*/\n\tfunction historyGoTo(index) {\n\t\tif (DEBUG) { console.log(`[State/historyGoTo(index: ${index})]`); }\n\n\t\tif (\n\t\t\t   index == null /* lazy equality for null */\n\t\t\t|| index < 0\n\t\t\t|| index >= historySize()\n\t\t\t|| index === _activeIndex\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\t_activeIndex = index;\n\t\tmomentActivate(_activeIndex);\n\n\t\treturn true;\n\t}\n\n\t/*\n\t\tActivate the moment at the given offset from the active moment within the history.\n\t*/\n\tfunction historyGo(offset) {\n\t\tif (DEBUG) { console.log(`[State/historyGo(offset: ${offset})]`); }\n\n\t\tif (offset == null || offset === 0) { // lazy equality for null\n\t\t\treturn false;\n\t\t}\n\n\t\treturn historyGoTo(_activeIndex + offset);\n\t}\n\n\t/*\n\t\tReturns the delta encoded form of the given history array.\n\t*/\n\tfunction historyDeltaEncode(historyArr) {\n\t\tif (!Array.isArray(historyArr)) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif (historyArr.length === 0) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// NOTE: The `clone()` call here is likely unnecessary within the current codebase.\n\t\t// const delta = [clone(historyArr[0])];\n\t\tconst delta = [historyArr[0]];\n\n\t\tfor (let i = 1, iend = historyArr.length; i < iend; ++i) {\n\t\t\tdelta.push(Diff.diff(historyArr[i - 1], historyArr[i]));\n\t\t}\n\n\t\treturn delta;\n\t}\n\n\t/*\n\t\tReturns a history array from the given delta encoded history array.\n\t*/\n\tfunction historyDeltaDecode(delta) {\n\t\tif (!Array.isArray(delta)) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif (delta.length === 0) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst historyArr = [clone(delta[0])];\n\n\t\tfor (let i = 1, iend = delta.length; i < iend; ++i) {\n\t\t\thistoryArr.push(Diff.patch(historyArr[i - 1], delta[i]));\n\t\t}\n\n\t\treturn historyArr;\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tPRNG Functions.\n\t*******************************************************************************************************************/\n\tfunction prngInit(seed, useEntropy) {\n\t\tif (DEBUG) { console.log(`[State/prngInit(seed: ${seed}, useEntropy: ${useEntropy})]`); }\n\n\t\tif (!historyIsEmpty()) {\n\t\t\tlet scriptSection;\n\n\t\t\tif (TWINE1) { // for Twine 1\n\t\t\t\tscriptSection = 'a script-tagged passage';\n\t\t\t}\n\t\t\telse { // for Twine 2\n\t\t\t\tscriptSection = 'the Story JavaScript';\n\t\t\t}\n\n\t\t\tthrow new Error(`State.prng.init must be called during initialization, within either ${scriptSection} or the StoryInit special passage`);\n\t\t}\n\n\t\t/* Regenerate the PRNG object, then assign the state to the active moment. */\n\t\t_prng = new PRNG(seed);\n\t\t_active.pull = _prng.pull;\n\t}\n\n\tfunction prngIsEnabled() {\n\t\treturn _prng !== null;\n\t}\n\n\tfunction prngPull() {\n\t\treturn _prng ? _prng.pull : NaN;\n\t}\n\n\tfunction prngSeed() {\n\t\treturn _prng ? _prng.seed : null;\n\t}\n\n\tfunction prngPeek(count) {\n\t\treturn _prng.peek(count);\n\t}\n\n\tfunction prngStr2Int(string) {\n\t\treturn _prng.str2int(string);\n\t}\n\n\tfunction prngTest(count, granularity, advancerng) {\n\t\treturn _prng.test(count, granularity, advancerng);\n\t}\n\n\tfunction prngRandom() {\n\t\tif (DEBUG) { console.log('[State/prngRandom()]'); }\n\n\t\treturn _prng ? _prng.random() : Math.random();\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tTemporary Variables Functions.\n\t*******************************************************************************************************************/\n\t/*\n\t\tClear the temporary variables.\n\t*/\n\tfunction tempVariablesClear() {\n\t\tif (DEBUG) { console.log('[State/tempVariablesClear()]'); }\n\n\t\t_tempVariables = {};\n\n\t\t/* legacy */\n\t\tTempVariables = _tempVariables; // eslint-disable-line no-undef\n\t\t/* /legacy */\n\t}\n\n\t/*\n\t\tReturns the current temporary variables.\n\t*/\n\tfunction tempVariables() {\n\t\treturn _tempVariables;\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tVariable Chain Parsing Functions.\n\t*******************************************************************************************************************/\n\t/*\n\t\tReturns the value of the given story/temporary variable.\n\t*/\n\tfunction variableGet(varExpression) {\n\t\ttry {\n\t\t\treturn Scripting.evalTwineScript(varExpression);\n\t\t}\n\t\tcatch (ex) { /* no-op */ }\n\t}\n\n\t/*\n\t\tSets the value of the given story/temporary variable.\n\t*/\n\tfunction variableSet(varExpression, value) {\n\t\ttry {\n\t\t\tScripting.evalTwineScript(`${varExpression} = evalTwineScript$Data$`, null, value);\n\t\t\treturn true;\n\t\t}\n\t\tcatch (ex) { /* no-op */ }\n\n\t\treturn false;\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tStory Metadata Functions.\n\t*******************************************************************************************************************/\n\tconst _METADATA_STORE = 'metadata';\n\n\tfunction metadataClear() {\n\t\tstorage.delete(_METADATA_STORE);\n\t}\n\n\tfunction metadataDelete(key) {\n\t\tif (typeof key !== 'string') {\n\t\t\tthrow new TypeError(`State.metadata.delete key parameter must be a string (received: ${typeof key})`);\n\t\t}\n\n\t\tconst store = storage.get(_METADATA_STORE);\n\n\t\tif (store && store.hasOwnProperty(key)) {\n\t\t\tif (Object.keys(store).length === 1) {\n\t\t\t\tstorage.delete(_METADATA_STORE);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tdelete store[key];\n\t\t\t\tstorage.set(_METADATA_STORE, store);\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction metadataEntries() {\n\t\tconst store = storage.get(_METADATA_STORE);\n\t\treturn store && Object.entries(store);\n\t}\n\n\tfunction metadataGet(key) {\n\t\tif (typeof key !== 'string') {\n\t\t\tthrow new TypeError(`State.metadata.get key parameter must be a string (received: ${typeof key})`);\n\t\t}\n\n\t\tconst store = storage.get(_METADATA_STORE);\n\t\treturn store && store.hasOwnProperty(key) ? store[key] : undefined;\n\t}\n\n\tfunction metadataHas(key) {\n\t\tif (typeof key !== 'string') {\n\t\t\tthrow new TypeError(`State.metadata.has key parameter must be a string (received: ${typeof key})`);\n\t\t}\n\n\t\tconst store = storage.get(_METADATA_STORE);\n\t\treturn store && store.hasOwnProperty(key);\n\t}\n\n\tfunction metadataKeys() {\n\t\tconst store = storage.get(_METADATA_STORE);\n\t\treturn store && Object.keys(store);\n\t}\n\n\tfunction metadataSet(key, value) {\n\t\tif (typeof key !== 'string') {\n\t\t\tthrow new TypeError(`State.metadata.set key parameter must be a string (received: ${typeof key})`);\n\t\t}\n\n\t\tif (typeof value === 'undefined') {\n\t\t\tmetadataDelete(key);\n\t\t}\n\t\telse {\n\t\t\tconst store = storage.get(_METADATA_STORE) || {};\n\t\t\tstore[key] = value;\n\t\t\tstorage.set(_METADATA_STORE, store);\n\t\t}\n\t}\n\n\tfunction metadataSize() {\n\t\tconst store = storage.get(_METADATA_STORE);\n\t\treturn store ? Object.keys(store).length : 0;\n\t}\n\n\t/**\n\t * alias story and temporary variables to the global namespace\n\t */\n\tObject.defineProperties(window, {\n\t\t// often redefined by individual games, needs to be configurable\n\t\t/* Story variables property. */\n\t\t// eslint-disable-next-line id-length\n\t\tV : { get() { return _active.variables; }, configurable : true },\n\t\t/* Temporary variables property. */\n\t\tT : { get() { return _tempVariables; }, configurable : true }\n\t});\n\n\t/*******************************************************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************************************************/\n\treturn Object.freeze(Object.defineProperties({}, {\n\t\t/*\n\t\t\tState Functions.\n\t\t*/\n\t\treset            : { value : stateReset },\n\t\trestore          : { value : stateRestore },\n\t\tmarshalForSave   : { value : stateMarshalForSave },\n\t\tunmarshalForSave : { value : stateUnmarshalForSave },\n\t\texpired          : { get : stateExpired },\n\t\tturns            : { get : stateTurns },\n\t\tpassages         : { get : stateTitles },\n\t\thasPlayed        : { value : stateHasPlayed },\n\t\tgetSessionState  : { value : getSessionState },\n\t\tsetSessionState  : { value : setSessionState },\n\n\t\t/*\n\t\t\tMoment Functions.\n\t\t*/\n\t\tactive      : { get : momentActive },\n\t\tactiveIndex : { get : momentActiveIndex },\n\t\tpassage     : { get : momentActiveTitle },     // shortcut for `State.active.title`\n\t\tvariables   : { get : momentActiveVariables }, // shortcut for `State.active.variables`\n\n\t\t/*\n\t\t\tHistory Functions.\n\t\t*/\n\t\thistory     : { get : historyGet },\n\t\tlength      : { get : historyLength },\n\t\tsize        : { get : historySize },\n\t\tisEmpty     : { value : historyIsEmpty },\n\t\tcurrent     : { get : historyCurrent },\n\t\ttop         : { get : historyTop },\n\t\tbottom      : { get : historyBottom },\n\t\tindex       : { value : historyIndex },\n\t\tpeek        : { value : historyPeek },\n\t\thas         : { value : historyHas },\n\t\tcreate      : { value : historyCreate },\n\t\tgoTo        : { value : historyGoTo },\n\t\tgo          : { value : historyGo },\n\t\tdeltaEncode : { value : historyDeltaEncode },\n\t\tdeltaDecode : { value : historyDeltaDecode },\n\n\t\t/*\n\t\t\tPRNG Functions.\n\t\t*/\n\t\tprng : {\n\t\t\tvalue : Object.freeze(Object.defineProperties({}, {\n\t\t\t\tinit      : { value : prngInit },\n\t\t\t\tisEnabled : { value : prngIsEnabled },\n\t\t\t\tpull      : { get : prngPull },\n\t\t\t\tseed      : { get : prngSeed },\n\t\t\t\tstr2int   : { value : prngStr2Int },\n\t\t\t\ttest      : { value : prngTest },\n\t\t\t\tpeek      : { value : prngPeek }\n\t\t\t}))\n\t\t},\n\t\trandom : { value : prngRandom },\n\n\t\t/*\n\t\t\tTemporary Variables Functions.\n\t\t*/\n\t\tclearTemporary : { value : tempVariablesClear },\n\t\ttemporary      : { get : tempVariables },\n\n\t\t/*\n\t\t\tVariable Chain Parsing Functions.\n\t\t*/\n\t\tgetVar : { value : variableGet },\n\t\tsetVar : { value : variableSet },\n\n\t\t/*\n\t\t\tStory Metadata Functions.\n\t\t*/\n\t\tmetadata : {\n\t\t\tvalue : Object.freeze(Object.defineProperties({}, {\n\t\t\t\tclear   : { value : metadataClear },\n\t\t\t\tdelete  : { value : metadataDelete },\n\t\t\t\tentries : { value : metadataEntries },\n\t\t\t\tget     : { value : metadataGet },\n\t\t\t\thas     : { value : metadataHas },\n\t\t\t\tkeys    : { value : metadataKeys },\n\t\t\t\tset     : { value : metadataSet },\n\t\t\t\tsize    : { get : metadataSize }\n\t\t\t}))\n\t\t},\n\n\t\t/*\n\t\t\tLegacy Aliases.\n\t\t*/\n\t\tinitPRNG : { value : prngInit },\n\t\trestart  : { value : () => Engine.restart() },\n\t\tbackward : { value : () => Engine.backward() },\n\t\tforward  : { value : () => Engine.forward() },\n\t\tdisplay  : { value : (...args) => Engine.display(...args) },\n\t\tshow     : { value : (...args) => Engine.show(...args) },\n\t\tplay     : { value : (...args) => Engine.play(...args) }\n\t}));\n})();\n\n/***********************************************************************************************************************\n\n\tmarkup/scripting.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/* global Engine, Patterns, State, Story, Util, stringFrom */\n\nvar Scripting = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\t/* eslint-disable no-unused-vars */\n\n\t/*******************************************************************************************************************\n\t\tDeprecated Legacy Functions.\n\t*******************************************************************************************************************/\n\t/*\n\t\t[DEPRECATED] Returns the jQuery-wrapped target element(s) after making them accessible\n\t\tclickables (ARIA compatibility).\n\n\t\tNOTE: Unused, included only for compatibility.\n\t*/\n\tfunction addAccessibleClickHandler(targets, selector, handler, one, namespace) {\n\t\tif (arguments.length < 2) {\n\t\t\tthrow new Error('addAccessibleClickHandler insufficient number of parameters');\n\t\t}\n\n\t\tlet fn;\n\t\tlet opts;\n\n\t\tif (typeof selector === 'function') {\n\t\t\tfn = selector;\n\t\t\topts = {\n\t\t\t\tnamespace : one,\n\t\t\t\tone       : !!handler\n\t\t\t};\n\t\t}\n\t\telse {\n\t\t\tfn = handler;\n\t\t\topts = {\n\t\t\t\tnamespace,\n\t\t\t\tone : !!one,\n\t\t\t\tselector\n\t\t\t};\n\t\t}\n\n\t\tif (typeof fn !== 'function') {\n\t\t\tthrow new TypeError('addAccessibleClickHandler handler parameter must be a function');\n\t\t}\n\n\t\treturn jQuery(targets).ariaClick(opts, fn);\n\t}\n\n\t/*\n\t\t[DEPRECATED] Returns a new DOM element, optionally appending it to the passed DOM element, if any.\n\n\t\tNOTE: Unused, included only for compatibility.\n\t*/\n\tfunction insertElement(place, type, id, classNames, text, title) { // eslint-disable-line max-params\n\t\tconst $el = jQuery(document.createElement(type));\n\n\t\t// Add attributes/properties.\n\t\tif (id) {\n\t\t\t$el.attr('id', id);\n\t\t}\n\n\t\tif (classNames) {\n\t\t\t$el.addClass(classNames);\n\t\t}\n\n\t\tif (title) {\n\t\t\t$el.attr('title', title);\n\t\t}\n\n\t\t// Add text content.\n\t\tif (text) {\n\t\t\t$el.text(text);\n\t\t}\n\n\t\t// Append it to the given node.\n\t\tif (place) {\n\t\t\t$el.appendTo(place);\n\t\t}\n\n\t\treturn $el[0];\n\t}\n\n\t/*\n\t\t[DEPRECATED] Creates a new text node and appends it to the passed DOM element.\n\n\t\tNOTE: Unused, included only for compatibility.\n\t*/\n\tfunction insertText(place, text) {\n\t\tjQuery(place).append(document.createTextNode(text));\n\t}\n\n\t/*\n\t\t[DEPRECATED] Removes all children from the passed DOM node.\n\n\t\tNOTE: Unused, included only for compatibility.\n\t*/\n\tfunction removeChildren(node) {\n\t\tjQuery(node).empty();\n\t}\n\n\t/*\n\t\t[DEPRECATED] Removes the passed DOM node.\n\n\t\tNOTE: Unused, included only for compatibility.\n\t*/\n\tfunction removeElement(node) {\n\t\tjQuery(node).remove();\n\t}\n\n\t/*\n\t\t[DEPRECATED] Fades a DOM element in or out.\n\n\t\tNOTE: Unused, included only for compatibility.\n\t*/\n\tfunction fade(el, options) {\n\t\t/* eslint-disable no-param-reassign */\n\t\tconst direction = options.fade === 'in' ? 1 : -1;\n\t\tlet current;\n\t\tlet proxy      = el.cloneNode(true);\n\t\tlet intervalId; // eslint-disable-line prefer-const\n\n\t\tfunction tick() {\n\t\t\tcurrent += 0.05 * direction;\n\t\t\tsetOpacity(proxy, Math.easeInOut(current));\n\n\t\t\tif (direction === 1 && current >= 1 || direction === -1 && current <= 0) {\n\t\t\t\tel.style.visibility = options.fade === 'in' ? 'visible' : 'hidden';\n\t\t\t\tproxy.parentNode.replaceChild(el, proxy);\n\t\t\t\tproxy = null;\n\t\t\t\twindow.clearInterval(intervalId);\n\n\t\t\t\tif (options.onComplete) {\n\t\t\t\t\toptions.onComplete();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction setOpacity(el, opacity) {\n\t\t\t// Old IE.\n\t\t\tel.style.zoom = 1;\n\t\t\tel.style.filter = `alpha(opacity=${Math.floor(opacity * 100)})`;\n\n\t\t\t// CSS.\n\t\t\tel.style.opacity = opacity;\n\t\t}\n\n\t\tel.parentNode.replaceChild(proxy, el);\n\n\t\tif (options.fade === 'in') {\n\t\t\tcurrent = 0;\n\t\t\tproxy.style.visibility = 'visible';\n\t\t}\n\t\telse {\n\t\t\tcurrent = 1;\n\t\t}\n\n\t\tsetOpacity(proxy, current);\n\t\tintervalId = window.setInterval(tick, 25);\n\t\t/* eslint-enable no-param-reassign */\n\t}\n\n\t/*\n\t\t[DEPRECATED] Scrolls the browser window to ensure that a DOM element is in view.\n\n\t\tNOTE: Unused, included only for compatibility.\n\t*/\n\tfunction scrollWindowTo(el, incrementBy) {\n\t\t/* eslint-disable no-param-reassign */\n\t\tlet increment = incrementBy != null ? Number(incrementBy) : 0.1; // lazy equality for null\n\n\t\tif (Number.isNaN(increment) || !Number.isFinite(increment) || increment < 0) {\n\t\t\tincrement = 0.1;\n\t\t}\n\t\telse if (increment > 1) {\n\t\t\tincrement = 1;\n\t\t}\n\n\t\tconst start     = window.scrollY ? window.scrollY : document.body.scrollTop;\n\t\tconst end       = ensureVisible(el);\n\t\tconst distance  = Math.abs(start - end);\n\t\tconst direction = start > end ? -1 : 1;\n\t\tlet progress   = 0;\n\t\tlet intervalId; // eslint-disable-line prefer-const\n\n\t\tfunction tick() {\n\t\t\tprogress += increment;\n\t\t\twindow.scroll(0, start + direction * (distance * Math.easeInOut(progress)));\n\n\t\t\tif (progress >= 1) {\n\t\t\t\twindow.clearInterval(intervalId);\n\t\t\t}\n\t\t}\n\n\t\tfunction findPosY(el) { // eslint-disable-line no-shadow\n\t\t\tlet curtop = 0;\n\n\t\t\twhile (el.offsetParent) {\n\t\t\t\tcurtop += el.offsetTop;\n\t\t\t\tel = el.offsetParent;\n\t\t\t}\n\n\t\t\treturn curtop;\n\t\t}\n\n\t\tfunction ensureVisible(el) { // eslint-disable-line no-shadow\n\t\t\tconst posTop    = findPosY(el);\n\t\t\tconst posBottom = posTop + el.offsetHeight;\n\t\t\tconst winTop    = window.scrollY ? window.scrollY : document.body.scrollTop;\n\t\t\tconst winHeight = window.innerHeight ? window.innerHeight : document.body.clientHeight;\n\t\t\tconst winBottom = winTop + winHeight;\n\n\t\t\treturn posTop >= winTop && posBottom > winBottom && el.offsetHeight < winHeight\n\t\t\t\t? posTop - (winHeight - el.offsetHeight) + 20\n\t\t\t\t: posTop;\n\t\t}\n\n\t\tintervalId = window.setInterval(tick, 25);\n\t\t/* eslint-enable no-param-reassign */\n\t}\n\n\t/*\n\t\t[DEPRECATED] Returns the simple string representation of the passed value or,\n\t\tif there is none, the passed default value.\n\n\t\tNOTE: Unused, included only for compatibility.\n\t*/\n\tfunction toStringOrDefault(value /* , defValue */) {\n\t\treturn stringFrom(value);\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tUser Functions.\n\t*******************************************************************************************************************/\n\t/*\n\t\tReturns a random value from its given arguments.\n\t*/\n\tfunction either(/* variadic */) {\n\t\tif (arguments.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn Array.prototype.concat.apply([], arguments).random();\n\t}\n\n\t/*\n\t\tRemoves the given key, and its value, from the story metadata store.\n\t*/\n\tfunction forget(key) {\n\t\tif (typeof key !== 'string') {\n\t\t\tthrow new TypeError(`forget key parameter must be a string (received: ${Util.getType(key)})`);\n\t\t}\n\n\t\tState.metadata.delete(key);\n\t}\n\n\t/*\n\t\tReturns whether a passage with the given title exists within the story\n\t\thistory.  If multiple passage titles are given, returns the logical-AND\n\t\taggregate of the set.\n\t*/\n\tfunction hasVisited(/* variadic */) {\n\t\tif (arguments.length === 0) {\n\t\t\tthrow new Error('hasVisited called with insufficient parameters');\n\t\t}\n\n\t\tif (State.isEmpty()) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst needles = Array.prototype.concat.apply([], arguments);\n\t\tconst played  = State.passages;\n\n\t\tfor (let i = 0, iend = needles.length; i < iend; ++i) {\n\t\t\tif (!played.includes(needles[i])) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/*\n\t\tReturns the number of turns that have passed since the last instance of the given passage\n\t\toccurred within the story history or `-1` if it does not exist.  If multiple passages are\n\t\tgiven, returns the lowest count (which can be `-1`).\n\t*/\n\tfunction lastVisited(/* variadic */) {\n\t\tif (arguments.length === 0) {\n\t\t\tthrow new Error('lastVisited called with insufficient parameters');\n\t\t}\n\n\t\tif (State.isEmpty()) {\n\t\t\treturn -1;\n\t\t}\n\n\t\tconst needles = Array.prototype.concat.apply([], arguments);\n\t\tconst played  = State.passages;\n\t\tconst uBound  = played.length - 1;\n\t\tlet turns = State.turns;\n\n\t\tfor (let i = 0, iend = needles.length; i < iend && turns > -1; ++i) {\n\t\t\tconst lastIndex = played.lastIndexOf(needles[i]);\n\t\t\tturns = Math.min(turns, lastIndex === -1 ? -1 : uBound - lastIndex);\n\t\t}\n\n\t\treturn turns;\n\t}\n\n\t/*\n\t\tSets the given key/value pair within the story metadata store.\n\t*/\n\tfunction memorize(key, value) {\n\t\tif (typeof key !== 'string') {\n\t\t\tthrow new TypeError(`memorize key parameter must be a string (received: ${Util.getType(key)})`);\n\t\t}\n\n\t\tState.metadata.set(key, value);\n\t}\n\n\t/*\n\t\tReturns the title of the current passage.\n\t*/\n\tfunction passage() {\n\t\treturn State.passage;\n\t}\n\n\t/*\n\t\tReturns the title of a previous passage, either the most recent one whose title does not\n\t\tmatch that of the active passage or the one at the optional offset, or an empty string,\n\t\tif there is no such passage.\n\t*/\n\tfunction previous(/* legacy: offset */) {\n\t\tconst passages = State.passages;\n\n\t\t/* legacy: behavior with an offset */\n\t\tif (arguments.length > 0) {\n\t\t\tconst offset = Number(arguments[0]);\n\n\t\t\tif (!Number.isSafeInteger(offset) || offset < 1) {\n\t\t\t\tthrow new RangeError('previous offset parameter must be a positive integer greater than zero');\n\t\t\t}\n\n\t\t\treturn passages.length > offset ? passages[passages.length - 1 - offset] : '';\n\t\t}\n\t\t/* /legacy */\n\n\t\tfor (let i = passages.length - 2; i >= 0; --i) {\n\t\t\tif (passages[i] !== State.passage) {\n\t\t\t\treturn passages[i];\n\t\t\t}\n\t\t}\n\n\t\treturn '';\n\t}\n\n\t/*\n\t\tReturns a pseudo-random whole number (integer) within the range of the given bounds.\n\t*/\n\tfunction random(/* [min ,] max */) {\n\t\tlet min;\n\t\tlet max;\n\n\t\tswitch (arguments.length) {\n\t\tcase 0:\n\t\t\tthrow new Error('random called with insufficient parameters');\n\t\tcase 1:\n\t\t\tmin = 0;\n\t\t\tmax = Math.trunc(arguments[0]);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tmin = Math.trunc(arguments[0]);\n\t\t\tmax = Math.trunc(arguments[1]);\n\t\t\tbreak;\n\t\t}\n\n\t\tif (!Number.isInteger(min)) {\n\t\t\tthrow new Error('random min parameter must be an integer');\n\t\t}\n\t\tif (!Number.isInteger(max)) {\n\t\t\tthrow new Error('random max parameter must be an integer');\n\t\t}\n\n\t\tif (min > max) {\n\t\t\t[min, max] = [max, min];\n\t\t}\n\n\t\treturn Math.floor(State.random() * (max - min + 1)) + min;\n\t}\n\n\t/*\n\t\tReturns a pseudo-random real number (floating-point) within the range of the given bounds.\n\n\t\tNOTE: Unlike with its sibling function `random()`, the `max` parameter\n\t\tis exclusive, not inclusive—i.e. the range goes to, but does not include,\n\t\tthe given value.\n\t*/\n\tfunction randomFloat(/* [min ,] max */) {\n\t\tlet min;\n\t\tlet max;\n\n\t\tswitch (arguments.length) {\n\t\tcase 0:\n\t\t\tthrow new Error('randomFloat called with insufficient parameters');\n\t\tcase 1:\n\t\t\tmin = 0.0;\n\t\t\tmax = Number(arguments[0]);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tmin = Number(arguments[0]);\n\t\t\tmax = Number(arguments[1]);\n\t\t\tbreak;\n\t\t}\n\n\t\tif (Number.isNaN(min) || !Number.isFinite(min)) {\n\t\t\tthrow new Error('randomFloat min parameter must be a number');\n\t\t}\n\t\tif (Number.isNaN(max) || !Number.isFinite(max)) {\n\t\t\tthrow new Error('randomFloat max parameter must be a number');\n\t\t}\n\n\t\tif (min > max) {\n\t\t\t[min, max] = [max, min];\n\t\t}\n\n\t\treturn State.random() * (max - min) + min;\n\t}\n\n\t/*\n\t\tReturns the value of the given key from the story metadata store\n\t\tor the given default value if the key does not exist.\n\t*/\n\tfunction recall(key, defaultValue) {\n\t\tif (typeof key !== 'string') {\n\t\t\tthrow new TypeError(`recall key parameter must be a string (received: ${Util.getType(key)})`);\n\t\t}\n\n\t\treturn State.metadata.has(key) ? State.metadata.get(key) : defaultValue;\n\t}\n\n\t/*\n\t\tReturns a new array consisting of all of the tags of the given passages.\n\t*/\n\tfunction tags(/* variadic */) {\n\t\tif (arguments.length === 0) {\n\t\t\treturn Story.get(State.passage).tags.slice(0);\n\t\t}\n\n\t\tconst passages = Array.prototype.concat.apply([], arguments);\n\t\tlet tags = [];\n\n\t\tfor (let i = 0, iend = passages.length; i < iend; ++i) {\n\t\t\ttags = tags.concat(Story.get(passages[i]).tags);\n\t\t}\n\n\t\treturn tags;\n\t}\n\n\t/*\n\t\tReturns a reference to the current temporary _variables store.\n\t*/\n\tfunction temporary() {\n\t\treturn State.temporary;\n\t}\n\n\t/*\n\t\tReturns the number of milliseconds which have passed since the current passage was rendered.\n\t*/\n\tfunction time() {\n\t\treturn Engine.lastPlay === null ? 0 : Util.now() - Engine.lastPlay;\n\t}\n\n\t/*\n\t\tReturns the number of passages that the player has visited.\n\n\t\tNOTE: Passages which were visited but have been undone—e.g. via the backward\n\t\tbutton or the `<<back>>` macro—are no longer part of the in-play story\n\t\thistory and thus are not tallied.  Passages which were visited but have\n\t\texpired from the story history, on the other hand, are tallied.\n\t*/\n\tfunction turns() {\n\t\treturn State.turns;\n\t}\n\n\t/*\n\t\tReturns a reference to the current story $variables store.\n\t*/\n\tfunction variables() {\n\t\treturn State.variables;\n\t}\n\n\t/*\n\t\tReturns the number of times that the passage with the given title exists within the story\n\t\thistory.  If multiple passage titles are given, returns the lowest count.\n\t*/\n\tfunction visited(/* variadic */) {\n\t\tif (State.isEmpty()) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tconst needles = Array.prototype.concat.apply([], arguments.length === 0 ? [State.passage] : arguments);\n\t\tconst played  = State.passages;\n\t\tlet count = State.turns;\n\n\t\tfor (let i = 0, iend = needles.length; i < iend && count > 0; ++i) {\n\t\t\tcount = Math.min(count, played.count(needles[i]));\n\t\t}\n\n\t\treturn count;\n\t}\n\n\t/*\n\t\tReturns the number of passages within the story history which are tagged with all of the given tags.\n\t*/\n\tfunction visitedTags(/* variadic */) {\n\t\tif (arguments.length === 0) {\n\t\t\tthrow new Error('visitedTags called with insufficient parameters');\n\t\t}\n\n\t\tif (State.isEmpty()) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tconst needles = Array.prototype.concat.apply([], arguments);\n\t\tconst nLength = needles.length;\n\t\tconst played  = State.passages;\n\t\tconst seen    = new Map();\n\t\tlet count = 0;\n\n\t\tfor (let i = 0, iend = played.length; i < iend; ++i) {\n\t\t\tconst title = played[i];\n\n\t\t\tif (seen.has(title)) {\n\t\t\t\tif (seen.get(title)) {\n\t\t\t\t\t++count;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconst tags = Story.get(title).tags;\n\n\t\t\t\tif (tags.length > 0) {\n\t\t\t\t\tlet found = 0;\n\n\t\t\t\t\tfor (let j = 0; j < nLength; ++j) {\n\t\t\t\t\t\tif (tags.includes(needles[j])) {\n\t\t\t\t\t\t\t++found;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (found === nLength) {\n\t\t\t\t\t\t++count;\n\t\t\t\t\t\tseen.set(title, true);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tseen.set(title, false);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn count;\n\t}\n\n\t/* eslint-enable no-unused-vars */\n\n\n\t/*******************************************************************************************************************\n\t\tImport Functions.\n\t*******************************************************************************************************************/\n\tvar { // eslint-disable-line no-var\n\t\t/* eslint-disable no-unused-vars */\n\t\timportScripts,\n\t\timportStyles\n\t\t/* eslint-enable no-unused-vars */\n\t} = (() => {\n\t\t// Slugify the given URL.\n\t\tfunction slugifyUrl(url) {\n\t\t\treturn Util.parseUrl(url).path\n\t\t\t\t.replace(/^[^\\w]+|[^\\w]+$/g, '')\n\t\t\t\t.replace(/[^\\w]+/g, '-')\n\t\t\t\t.toLocaleLowerCase();\n\t\t}\n\n\t\t// Add a <script> element which will load the script from the given URL.\n\t\tfunction addScript(url) {\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t/*\n\t\t\t\t\tWARNING: The ordering of the code within this function is important,\n\t\t\t\t\tas some browsers don't play well with different arrangements, so\n\t\t\t\t\tbe careful when mucking around with it.\n\n\t\t\t\t\tThe best supported ordering seems be: events → DOM append → attributes.\n\t\t\t\t*/\n\t\t\t\tjQuery(document.createElement('script'))\n\t\t\t\t\t.one('load abort error', ev => {\n\t\t\t\t\t\tjQuery(ev.target).off();\n\n\t\t\t\t\t\tif (ev.type === 'load') {\n\t\t\t\t\t\t\tresolve(ev.target);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\treject(new Error(`importScripts failed to load the script \"${url}\".`));\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t\t.appendTo(document.head)\n\t\t\t\t\t.attr({\n\t\t\t\t\t\tid   : `script-imported-${slugifyUrl(url)}`,\n\t\t\t\t\t\ttype : 'text/javascript',\n\t\t\t\t\t\tsrc  : url\n\t\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\t// Add a <link> element which will load the stylesheet from the given URL.\n\t\tfunction addStyle(url) {\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t/*\n\t\t\t\t\tWARNING: The ordering of the code within this function is important,\n\t\t\t\t\tas some browsers don't play well with different arrangements, so\n\t\t\t\t\tbe careful when mucking around with it.\n\n\t\t\t\t\tThe best supported ordering seems be: events → DOM append → attributes.\n\t\t\t\t*/\n\t\t\t\tjQuery(document.createElement('link'))\n\t\t\t\t\t.one('load abort error', ev => {\n\t\t\t\t\t\tjQuery(ev.target).off();\n\n\t\t\t\t\t\tif (ev.type === 'load') {\n\t\t\t\t\t\t\tresolve(ev.target);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\treject(new Error(`importStyles failed to load the stylesheet \"${url}\".`));\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t\t.appendTo(document.head)\n\t\t\t\t\t.attr({\n\t\t\t\t\t\tid   : `style-imported-${slugifyUrl(url)}`,\n\t\t\t\t\t\trel  : 'stylesheet',\n\t\t\t\t\t\thref : url\n\t\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\t// Turn a list of callbacks into a sequential chain of `Promise` objects.\n\t\tfunction sequence(callbacks) {\n\t\t\treturn callbacks.reduce((seq, fn) => seq = seq.then(fn), Promise.resolve()); // eslint-disable-line no-param-reassign\n\t\t}\n\n\t\t/*\n\t\t\tImport scripts from a URL.\n\t\t*/\n\t\tfunction importScripts(...urls) {\n\t\t\treturn Promise.all(urls.map(oneOrSeries => {\n\t\t\t\t// Array of URLs to be imported in sequence.\n\t\t\t\tif (Array.isArray(oneOrSeries)) {\n\t\t\t\t\treturn sequence(oneOrSeries.map(url => () => addScript(url)));\n\t\t\t\t}\n\n\t\t\t\t// Single URL to be imported.\n\t\t\t\treturn addScript(oneOrSeries);\n\t\t\t}));\n\t\t}\n\n\t\t/*\n\t\t\tImport stylesheets from a URL.\n\t\t*/\n\t\tfunction importStyles(...urls) {\n\t\t\treturn Promise.all(urls.map(oneOrSeries => {\n\t\t\t\t// Array of URLs to be imported in sequence.\n\t\t\t\tif (Array.isArray(oneOrSeries)) {\n\t\t\t\t\treturn sequence(oneOrSeries.map(url => () => addStyle(url)));\n\t\t\t\t}\n\n\t\t\t\t// Single URL to be imported.\n\t\t\t\treturn addStyle(oneOrSeries);\n\t\t\t}));\n\t\t}\n\n\t\t// Exports.\n\t\treturn {\n\t\t\timportScripts,\n\t\t\timportStyles\n\t\t};\n\t})();\n\n\n\t/*******************************************************************************************************************\n\t\tParsing Functions.\n\t*******************************************************************************************************************/\n\t/*\n\t\tReturns the given string after converting all TwineScript syntactical sugars to\n\t\ttheir native JavaScript counterparts.\n\t*/\n\tconst parse = (() => {\n\t\tconst tokenTable = Util.toEnum({\n\t\t\t/* eslint-disable quote-props */\n\t\t\t// Story $variable sigil-prefix.\n\t\t\t'$'     : 'State.variables.',\n\t\t\t// Temporary _variable sigil-prefix.\n\t\t\t'_'     : 'State.temporary.',\n\t\t\t// Assignment operators.\n\t\t\t'to'    : '=',\n\t\t\t// Equality operators.\n\t\t\t'eq'    : '==',\n\t\t\t'neq'   : '!=',\n\t\t\t'is'    : '===',\n\t\t\t'isnot' : '!==',\n\t\t\t// Relational operators.\n\t\t\t'gt'    : '>',\n\t\t\t'gte'   : '>=',\n\t\t\t'lt'    : '<',\n\t\t\t'lte'   : '<=',\n\t\t\t// Logical operators.\n\t\t\t'and'   : '&&',\n\t\t\t'or'    : '||',\n\t\t\t// Unary operators.\n\t\t\t'not'   : '!',\n\t\t\t'def'   : '\"undefined\" !== typeof',\n\t\t\t'ndef'  : '\"undefined\" === typeof'\n\t\t\t/* eslint-enable quote-props */\n\t\t});\n\t\tconst parseRe = new RegExp([\n\t\t\t'(?:\"\"|\\'\\'|``)',                                     //   Empty quotes (incl. template literal)\n\t\t\t'(?:\"(?:\\\\\\\\.|[^\"\\\\\\\\])+\")',                          //   Double quoted, non-empty\n\t\t\t\"(?:'(?:\\\\\\\\.|[^'\\\\\\\\])+')\",                          //   Single quoted, non-empty\n\t\t\t'(`(?:\\\\\\\\.|[^`\\\\\\\\])+`)',                            // 1=Template literal, non-empty\n\t\t\t'(?:[=+\\\\-*\\\\/%<>&\\\\|\\\\^~!?:,;\\\\(\\\\)\\\\[\\\\]{}]+)',     //   Operator delimiters\n\t\t\t'([^\"\\'=+\\\\-*\\\\/%<>&\\\\|\\\\^~!?:,;\\\\(\\\\)\\\\[\\\\]{}\\\\s]+)' // 2=Barewords\n\t\t].join('|'), 'g');\n\t\tconst notSpaceRe      = /\\S/;\n\t\tconst varTest         = new RegExp(`^${Patterns.variable}`);\n\t\tconst withColonTestRe = /^\\s*:/;\n\t\tconst withNotTestRe   = /^\\s+not\\b/;\n\n\t\tfunction parse(rawCodeString) {\n\t\t\tif (parseRe.lastIndex !== 0) {\n\t\t\t\tthrow new RangeError('Scripting.parse last index is non-zero at start');\n\t\t\t}\n\n\t\t\tlet code  = rawCodeString;\n\t\t\tlet match;\n\n\t\t\twhile ((match = parseRe.exec(code)) !== null) {\n\t\t\t\t// no-op: Empty quotes | Double quoted | Single quoted | Operator delimiters\n\n\t\t\t\t// Template literal, non-empty.\n\t\t\t\tif (match[1]) {\n\t\t\t\t\tconst rawTemplate = match[1];\n\t\t\t\t\tconst parsedTemplate = parseTemplate(rawTemplate);\n\n\t\t\t\t\tif (parsedTemplate !== rawTemplate) {\n\t\t\t\t\t\tcode = code.splice(\n\t\t\t\t\t\t\tmatch.index,        // starting index\n\t\t\t\t\t\t\trawTemplate.length, // replace how many\n\t\t\t\t\t\t\tparsedTemplate      // replacement string\n\t\t\t\t\t\t);\n\t\t\t\t\t\tparseRe.lastIndex += parsedTemplate.length - rawTemplate.length;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Barewords.\n\t\t\t\telse if (match[2]) {\n\t\t\t\t\tlet token = match[2];\n\n\t\t\t\t\t// If the token is simply a dollar-sign or underscore, then it's either\n\t\t\t\t\t// just the raw character or, probably, a function alias, so skip it.\n\t\t\t\t\tif (token === '$' || token === '_') {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\t// If the token is a story $variable or temporary _variable, reset it\n\t\t\t\t\t// to just its sigil—for later mapping.\n\t\t\t\t\telse if (varTest.test(token)) {\n\t\t\t\t\t\ttoken = token[0];\n\t\t\t\t\t}\n\n\t\t\t\t\t// If the token is `is`, check to see if it's followed by `not`, if so,\n\t\t\t\t\t// convert them into the `isnot` operator.\n\t\t\t\t\t//\n\t\t\t\t\t// NOTE: This is a safety feature, since `$a is not $b` probably sounds\n\t\t\t\t\t// reasonable to most users.\n\t\t\t\t\telse if (token === 'is') {\n\t\t\t\t\t\tconst start = parseRe.lastIndex;\n\t\t\t\t\t\tconst ahead = code.slice(start);\n\n\t\t\t\t\t\tif (withNotTestRe.test(ahead)) {\n\t\t\t\t\t\t\tcode = code.splice(start, ahead.search(notSpaceRe));\n\t\t\t\t\t\t\ttoken = 'isnot';\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// If the token is followed by a colon, then it's likely to be an object\n\t\t\t\t\t// property, so skip it.\n\t\t\t\t\telse {\n\t\t\t\t\t\tconst ahead = code.slice(parseRe.lastIndex);\n\n\t\t\t\t\t\tif (withColonTestRe.test(ahead)) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// If the finalized token has a mapping, replace it within the code string\n\t\t\t\t\t// with its counterpart.\n\t\t\t\t\tif (tokenTable[token]) {\n\t\t\t\t\t\tcode = code.splice(\n\t\t\t\t\t\t\tmatch.index,      // starting index\n\t\t\t\t\t\t\ttoken.length,     // replace how many\n\t\t\t\t\t\t\ttokenTable[token] // replacement string\n\t\t\t\t\t\t);\n\t\t\t\t\t\tparseRe.lastIndex += tokenTable[token].length - token.length;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn code;\n\t\t}\n\n\t\tconst templateGroupStartRe = /\\$\\{/g;\n\t\tconst templateGroupParseRe = new RegExp([\n\t\t\t'(?:\"\"|\\'\\')',               //   Empty quotes\n\t\t\t'(?:\"(?:\\\\\\\\.|[^\"\\\\\\\\])+\")', //   Double quoted, non-empty\n\t\t\t\"(?:'(?:\\\\\\\\.|[^'\\\\\\\\])+')\", //   Single quoted, non-empty\n\t\t\t'(\\\\{)',                     // 1=Opening curly brace\n\t\t\t'(\\\\})'                      // 2=Closing curly brace\n\t\t].join('|'), 'g');\n\n\t\tfunction parseTemplate(rawTemplateLiteral) {\n\t\t\tif (templateGroupStartRe.lastIndex !== 0) {\n\t\t\t\tthrow new RangeError('Scripting.parse last index is non-zero at start of template literal');\n\t\t\t}\n\n\t\t\tlet template   = rawTemplateLiteral;\n\t\t\tlet startMatch;\n\n\t\t\twhile ((startMatch = templateGroupStartRe.exec(template)) !== null) {\n\t\t\t\tconst startIdx = startMatch.index + 2;\n\t\t\t\tlet endIdx   = startIdx;\n\t\t\t\tlet depth    = 1;\n\t\t\t\tlet endMatch;\n\n\t\t\t\ttemplateGroupParseRe.lastIndex = startIdx;\n\n\t\t\t\twhile ((endMatch = templateGroupParseRe.exec(template)) !== null) {\n\t\t\t\t\t// Opening curly brace.\n\t\t\t\t\tif (endMatch[1]) {\n\t\t\t\t\t\t++depth;\n\t\t\t\t\t}\n\t\t\t\t\t// Closing curly brace.\n\t\t\t\t\telse if (endMatch[2]) {\n\t\t\t\t\t\t--depth;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (depth === 0) {\n\t\t\t\t\t\tendIdx = endMatch.index;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// If the group is not empty, replace it within the template\n\t\t\t\t// with its parsed counterpart.\n\t\t\t\tif (endIdx > startIdx) {\n\t\t\t\t\tconst parseIndex = parseRe.lastIndex;\n\t\t\t\t\tconst rawGroup   = template.slice(startIdx, endIdx);\n\n\t\t\t\t\tparseRe.lastIndex = 0;\n\t\t\t\t\tconst parsedGroup = parse(rawGroup);\n\t\t\t\t\tparseRe.lastIndex = parseIndex;\n\n\t\t\t\t\ttemplate = template.splice(\n\t\t\t\t\t\tstartIdx,        // starting index\n\t\t\t\t\t\trawGroup.length, // replace how many\n\t\t\t\t\t\tparsedGroup      // replacement string\n\t\t\t\t\t);\n\t\t\t\t\ttemplateGroupStartRe.lastIndex += parsedGroup.length - rawGroup.length;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn template;\n\t\t}\n\n\t\treturn parse;\n\t})();\n\n\n\t/*******************************************************************************************************************\n\t\tEval Functions.\n\t*******************************************************************************************************************/\n\t/* eslint-disable no-eval, no-extra-parens, no-unused-vars */\n\t/*\n\t\tEvaluates the given JavaScript code and returns the result, throwing if there were errors.\n\t*/\n\tfunction evalJavaScript(code, output, data) {\n\t\treturn (function (code, output, evalJavaScript$Data$) {\n\t\t\treturn eval(code);\n\t\t}).call(output ? { output } : null, String(code), output, data);\n\t}\n\n\t/*\n\t\tEvaluates the given TwineScript code and returns the result, throwing if there were errors.\n\t*/\n\tfunction evalTwineScript(code, output, data) {\n\t\t// NOTE: Do not move the dollar sign to the front of `evalTwineScript$Data$`,\n\t\t// as `parse()` will break references to it within the code string.\n\t\treturn (function (code, output, evalTwineScript$Data$) {\n\t\t\treturn eval(code);\n\t\t}).call(output ? { output } : null, parse(String(code)), output, data);\n\t}\n\t/* eslint-enable no-eval, no-extra-parens, no-unused-vars */\n\n\n\t/*******************************************************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************************************************/\n\treturn Object.freeze(Object.defineProperties({}, {\n\t\tparse           : { value : parse },\n\t\tevalJavaScript  : { value : evalJavaScript },\n\t\tevalTwineScript : { value : evalTwineScript }\n\t}));\n})();\n\n/***********************************************************************************************************************\n\n\tmarkup/lexer.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\nvar { // eslint-disable-line no-var\n\t/* eslint-disable no-unused-vars */\n\tEOF,\n\tLexer\n\t/* eslint-enable no-unused-vars */\n} = (() => {\n\t'use strict';\n\n\t// End of file (string, actually).\n\tconst EOF = -1;\n\n\n\t/*******************************************************************************************************************\n\t\tLexer Class.\n\t*******************************************************************************************************************/\n\tclass Lexer {\n\t\tconstructor(source, initialState) {\n\t\t\tif (arguments.length < 2) {\n\t\t\t\tthrow new Error('Lexer constructor called with too few parameters (source:string , initialState:function)');\n\t\t\t}\n\n\t\t\t/*\n\t\t\t\tthis.source  → the string to be scanned\n\t\t\t\tthis.initial → initial state\n\t\t\t\tthis.state   → current state\n\t\t\t\tthis.start   → start position of an item\n\t\t\t\tthis.pos     → current position in the source string\n\t\t\t\tthis.depth   → current brace/bracket/parenthesis nesting depth\n\t\t\t\tthis.items   → scanned item queue\n\t\t\t\tthis.data    → lexing data\n\t\t\t*/\n\t\t\tObject.defineProperties(this, {\n\t\t\t\tsource : {\n\t\t\t\t\tvalue : source\n\t\t\t\t},\n\n\t\t\t\tinitial : {\n\t\t\t\t\tvalue : initialState\n\t\t\t\t},\n\n\t\t\t\tstate : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : initialState\n\t\t\t\t},\n\n\t\t\t\tstart : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : 0\n\t\t\t\t},\n\n\t\t\t\tpos : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : 0\n\t\t\t\t},\n\n\t\t\t\tdepth : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : 0\n\t\t\t\t},\n\n\t\t\t\titems : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : []\n\t\t\t\t},\n\n\t\t\t\tdata : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : {}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treset() {\n\t\t\tthis.state  = this.initial;\n\t\t\tthis.start  = 0;\n\t\t\tthis.pos    = 0;\n\t\t\tthis.depth  = 0;\n\t\t\tthis.items  = [];\n\t\t\tthis.data   = {};\n\t\t}\n\n\t\trun() {\n\t\t\t// scan the source string until no states remain\n\t\t\twhile (this.state !== null) {\n\t\t\t\tthis.state = this.state(this);\n\t\t\t}\n\n\t\t\t// return the array of items\n\t\t\treturn this.items;\n\t\t}\n\n\t\tnextItem() {\n\t\t\t// scan the source string until we have an item or no states remain\n\t\t\twhile (this.items.length === 0 && this.state !== null) {\n\t\t\t\tthis.state = this.state(this);\n\t\t\t}\n\n\t\t\t// return the current item\n\t\t\treturn this.items.shift();\n\t\t}\n\n\t\tnext() {\n\t\t\tif (this.pos >= this.source.length) {\n\t\t\t\treturn EOF;\n\t\t\t}\n\n\t\t\treturn this.source[this.pos++];\n\t\t}\n\n\t\tpeek() {\n\t\t\tif (this.pos >= this.source.length) {\n\t\t\t\treturn EOF;\n\t\t\t}\n\n\t\t\treturn this.source[this.pos];\n\t\t}\n\n\t\tbackup(num) {\n\t\t\t// if (num) {\n\t\t\t// \tthis.pos -= num;\n\t\t\t// }\n\t\t\t// else {\n\t\t\t// \t--this.pos;\n\t\t\t// }\n\t\t\tthis.pos -= num || 1;\n\t\t}\n\n\t\tforward(num) {\n\t\t\t// if (num) {\n\t\t\t// \tthis.pos += num;\n\t\t\t// }\n\t\t\t// else {\n\t\t\t// \t++this.pos;\n\t\t\t// }\n\t\t\tthis.pos += num || 1;\n\t\t}\n\n\t\tignore() {\n\t\t\tthis.start = this.pos;\n\t\t}\n\n\t\taccept(valid) {\n\t\t\tconst ch = this.next();\n\n\t\t\tif (ch === EOF) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (valid.includes(ch)) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tthis.backup();\n\t\t\treturn false;\n\t\t}\n\n\t\tacceptRe(validRe) {\n\t\t\tconst ch = this.next();\n\n\t\t\tif (ch === EOF) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (validRe.test(ch)) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tthis.backup();\n\t\t\treturn false;\n\t\t}\n\n\t\tacceptRun(valid) {\n\t\t\tfor (;;) {\n\t\t\t\tconst ch = this.next();\n\n\t\t\t\tif (ch === EOF) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (!valid.includes(ch)) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.backup();\n\t\t}\n\n\t\tacceptRunRe(validRe) {\n\t\t\tfor (;;) {\n\t\t\t\tconst ch = this.next();\n\n\t\t\t\tif (ch === EOF) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (!validRe.test(ch)) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.backup();\n\t\t}\n\n\t\temit(type) {\n\t\t\tthis.items.push({\n\t\t\t\ttype,\n\t\t\t\ttext  : this.source.slice(this.start, this.pos),\n\t\t\t\tstart : this.start,\n\t\t\t\tpos   : this.pos\n\t\t\t});\n\t\t\tthis.start = this.pos;\n\t\t}\n\n\t\terror(type, message) {\n\t\t\tif (arguments.length < 2) {\n\t\t\t\tthrow new Error('Lexer.prototype.error called with too few parameters (type:number , message:string)');\n\t\t\t}\n\n\t\t\tthis.items.push({\n\t\t\t\ttype,\n\t\t\t\tmessage,\n\t\t\t\ttext  : this.source.slice(this.start, this.pos),\n\t\t\t\tstart : this.start,\n\t\t\t\tpos   : this.pos\n\t\t\t});\n\t\t\treturn null;\n\t\t}\n\n\t\tstatic enumFromNames(names) {\n\t\t\tconst obj = names.reduce((obj, name, i) => {\n\t\t\t\tobj[name] = i; // eslint-disable-line no-param-reassign\n\t\t\t\treturn obj;\n\t\t\t}, {});\n\t\t\treturn Object.freeze(Object.assign(Object.create(null), obj));\n\t\t}\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************************************************/\n\treturn {\n\t\tEOF,\n\t\tLexer\n\t};\n})();\n\n/***********************************************************************************************************************\n\n\tmarkup/wikifier.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/*\n\tglobal Config, EOF, Engine, Lexer, Patterns, Scripting, State, Story, TempState, Util, convertBreaks,\n\t       errorPrologRegExp\n*/\n\n/*\n\tTODO: The Wikifier, and associated code, could stand to receive a serious refactoring.\n*/\n/* eslint-disable max-len */\nvar Wikifier = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\t// Wikifier call depth.\n\tlet _callDepth = 0;\n\n\n\t/*******************************************************************************************************************\n\t\tWikifier Class.\n\t*******************************************************************************************************************/\n\tclass Wikifier {\n\t\tconstructor(destination, source, options) {\n\t\t\tif (Wikifier.Parser.Profile.isEmpty()) {\n\t\t\t\tWikifier.Parser.Profile.compile();\n\t\t\t}\n\n\t\t\tObject.defineProperties(this, {\n\t\t\t\t// General Wikifier properties.\n\t\t\t\tsource : {\n\t\t\t\t\tvalue : String(source)\n\t\t\t\t},\n\n\t\t\t\toptions : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : Object.assign({\n\t\t\t\t\t\tprofile : 'all'\n\t\t\t\t\t}, options)\n\t\t\t\t},\n\n\t\t\t\tnextMatch : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : 0\n\t\t\t\t},\n\n\t\t\t\toutput : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : null\n\t\t\t\t},\n\n\t\t\t\t// Macro parser ('macro') related properties.\n\t\t\t\t_rawArgs : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : ''\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t// No destination specified.  Create a fragment to act as the output buffer.\n\t\t\tif (destination == null) { // lazy equality for null\n\t\t\t\tthis.output = document.createDocumentFragment();\n\t\t\t}\n\n\t\t\t// jQuery-wrapped destination.  Grab the first element.\n\t\t\telse if (destination.jquery) { // cannot use `hasOwnProperty()` here as `jquery` is from jQuery's prototype\n\t\t\t\tthis.output = destination[0];\n\t\t\t}\n\n\t\t\t// Normal destination.\n\t\t\telse {\n\t\t\t\tthis.output = destination;\n\t\t\t}\n\n\t\t\t/*\n\t\t\t\tWikify the source into the output buffer element, possibly converting line\n\t\t\t\tbreaks into paragraphs.\n\n\t\t\t\tNOTE: There's no catch clause here because this try/finally exists solely\n\t\t\t\tto ensure that the call depth is properly restored in the event that an\n\t\t\t\tuncaught exception is thrown during the call to `subWikify()`.\n\t\t\t*/\n\t\t\ttry {\n\t\t\t\t++_callDepth;\n\n\t\t\t\tthis.subWikify(this.output);\n\n\t\t\t\t// Limit line break conversion to non-recursive calls.\n\t\t\t\tif (_callDepth === 1 && Config.cleanupWikifierOutput) {\n\t\t\t\t\tconvertBreaks(this.output);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\t--_callDepth;\n\t\t\t}\n\t\t}\n\n\t\tsubWikify(output, terminator, options) {\n\t\t\t// Placed at top to prevent any execution\n\t\t\tif (Wikifier.stopWikify) return;\n\n\t\t\t// Cache and temporarily replace the current output buffer.\n\t\t\tconst oldOutput = this.output;\n\t\t\tthis.output = output;\n\n\t\t\tlet newOptions;\n\t\t\tlet oldOptions;\n\n\t\t\t// Parser option overrides.\n\t\t\tif (Wikifier.Option.length > 0) {\n\t\t\t\tnewOptions = Object.assign(newOptions || {}, Wikifier.Option.options);\n\t\t\t}\n\t\t\t// Local parameter option overrides.\n\t\t\tif (options !== null && typeof options === 'object') {\n\t\t\t\tnewOptions = Object.assign(newOptions || {}, options);\n\t\t\t}\n\t\t\t// If new options exist, cache and temporarily replace the current options.\n\t\t\tif (newOptions) {\n\t\t\t\toldOptions = this.options;\n\t\t\t\tthis.options = Object.assign({}, this.options, newOptions);\n\t\t\t}\n\n\t\t\tconst parsersProfile   = Wikifier.Parser.Profile.get(this.options.profile);\n\t\t\tconst terminatorRegExp = terminator\n\t\t\t\t? new RegExp(`(?:${terminator})`, this.options.ignoreTerminatorCase ? 'gim' : 'gm')\n\t\t\t\t: null;\n\t\t\tlet terminatorMatch;\n\t\t\tlet parserMatch;\n\n\t\t\tdo {\n\t\t\t\t// Prepare the RegExp match positions.\n\t\t\t\tparsersProfile.parserRegExp.lastIndex = this.nextMatch;\n\n\t\t\t\tif (terminatorRegExp) {\n\t\t\t\t\tterminatorRegExp.lastIndex = this.nextMatch;\n\t\t\t\t}\n\n\t\t\t\t// Get the first matches.\n\t\t\t\tparserMatch     = parsersProfile.parserRegExp.exec(this.source);\n\t\t\t\tterminatorMatch = terminatorRegExp ? terminatorRegExp.exec(this.source) : null;\n\n\t\t\t\t// Try for a terminator match, unless there's a closer parser match.\n\t\t\t\tif (terminatorMatch && (!parserMatch || terminatorMatch.index <= parserMatch.index)) {\n\t\t\t\t\t// Output any text before the match.\n\t\t\t\t\tif (terminatorMatch.index > this.nextMatch) {\n\t\t\t\t\t\tthis.outputText(this.output, this.nextMatch, terminatorMatch.index);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Set the match parameters.\n\t\t\t\t\tthis.matchStart  = terminatorMatch.index;\n\t\t\t\t\tthis.matchLength = terminatorMatch[0].length;\n\t\t\t\t\tthis.matchText   = terminatorMatch[0];\n\t\t\t\t\tthis.nextMatch   = terminatorRegExp.lastIndex;\n\n\t\t\t\t\t// Restore the original output buffer and options.\n\t\t\t\t\tthis.output = oldOutput;\n\n\t\t\t\t\tif (oldOptions) {\n\t\t\t\t\t\tthis.options = oldOptions;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Exit.\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Try for a parser match.\n\t\t\t\telse if (parserMatch) {\n\t\t\t\t\t// Output any text before the match.\n\t\t\t\t\tif (parserMatch.index > this.nextMatch) {\n\t\t\t\t\t\tthis.outputText(this.output, this.nextMatch, parserMatch.index);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Set the match parameters.\n\t\t\t\t\tthis.matchStart  = parserMatch.index;\n\t\t\t\t\tthis.matchLength = parserMatch[0].length;\n\t\t\t\t\tthis.matchText   = parserMatch[0];\n\t\t\t\t\tthis.nextMatch   = parsersProfile.parserRegExp.lastIndex;\n\n\t\t\t\t\t// Figure out which parser matched.\n\t\t\t\t\tlet matchingParser;\n\n\t\t\t\t\tfor (let i = 1, iend = parserMatch.length; i < iend; ++i) {\n\t\t\t\t\t\tif (parserMatch[i]) {\n\t\t\t\t\t\t\tmatchingParser = i - 1;\n\t\t\t\t\t\t\tbreak; // stop once we've found the matching parser\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Call the parser.\n\t\t\t\t\tparsersProfile.parsers[matchingParser].handler(this);\n\n\t\t\t\t\tif (Wikifier.stopWikify) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (TempState.break != null) { // lazy equality for null\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} while (terminatorMatch || parserMatch);\n\n\t\t\t// Output any text after the last match.\n\t\t\tif (TempState.break == null) { // lazy equality for null\n\t\t\t\tif (this.nextMatch < this.source.length) {\n\t\t\t\t\tthis.outputText(this.output, this.nextMatch, this.source.length);\n\t\t\t\t\tthis.nextMatch = this.source.length;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// In case of <<break>>/<<continue>>, remove the last <br>.\n\t\t\telse if (\n\t\t\t\t   this.output.lastChild\n\t\t\t\t&& this.output.lastChild.nodeType === Node.ELEMENT_NODE\n\t\t\t\t&& this.output.lastChild.nodeName.toUpperCase() === 'BR'\n\t\t\t) {\n\t\t\t\tjQuery(this.output.lastChild).remove();\n\t\t\t}\n\n\t\t\t// Restore the original output buffer and options.\n\t\t\tthis.output = oldOutput;\n\n\t\t\tif (oldOptions) {\n\t\t\t\tthis.options = oldOptions;\n\t\t\t}\n\t\t}\n\n\t\toutputText(destination, startPos, endPos) {\n\t\t\tdestination.appendChild(document.createTextNode(this.source.substring(startPos, endPos)));\n\t\t}\n\n\t\t/*\n\t\t\t[DEPRECATED] Meant to be called by legacy macros, this returns the raw, unprocessed\n\t\t\ttext given to the currently executing macro.\n\t\t*/\n\t\trawArgs() {\n\t\t\treturn this._rawArgs;\n\t\t}\n\n\t\t/*\n\t\t\t[DEPRECATED] Meant to be called by legacy macros, this returns the text given to\n\t\t\tthe currently executing macro after doing TwineScript-to-JavaScript transformations.\n\t\t*/\n\t\tfullArgs() {\n\t\t\treturn Scripting.parse(this._rawArgs);\n\t\t}\n\n\t\t/*\n\t\t\tReturns the output generated by wikifying the given text, throwing if there were errors.\n\t\t*/\n\t\tstatic wikifyEval(text) {\n\t\t\tconst output = document.createDocumentFragment();\n\n\t\t\tnew Wikifier(output, text);\n\n\t\t\tconst errors = output.querySelector('.error');\n\n\t\t\tif (errors !== null) {\n\t\t\t\tthrow new Error(errors.textContent.replace(errorPrologRegExp, ''));\n\t\t\t}\n\n\t\t\treturn output;\n\t\t}\n\n\t\t/*\n\t\t\tCreate and return an internal link.\n\t\t*/\n\t\tstatic createInternalLink(destination, passage, text, callback) {\n\t\t\tconst $link = jQuery(document.createElement('a'));\n\n\t\t\tif (passage != null) { // lazy equality for null\n\t\t\t\t$link.attr('data-passage', passage);\n\n\t\t\t\tif (Story.has(passage)) {\n\t\t\t\t\t$link.addClass('link-internal');\n\n\t\t\t\t\tif (Config.addVisitedLinkClass && State.hasPlayed(passage)) {\n\t\t\t\t\t\t$link.addClass('link-visited');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$link.addClass('link-broken');\n\t\t\t\t}\n\n\t\t\t\t$link.ariaClick({ one : true }, () => {\n\t\t\t\t\tif (typeof callback === 'function') {\n\t\t\t\t\t\tcallback();\n\t\t\t\t\t}\n\n\t\t\t\t\tEngine.play(passage);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (text) {\n\t\t\t\t$link.append(document.createTextNode(text));\n\t\t\t}\n\n\t\t\tif (destination) {\n\t\t\t\t$link.appendTo(destination);\n\t\t\t}\n\n\t\t\t// For legacy-compatibility we must return the DOM node.\n\t\t\treturn $link[0];\n\t\t}\n\n\t\t/*\n\t\t\tCreate and return an external link.\n\t\t*/\n\t\tstatic createExternalLink(destination, url, text) {\n\t\t\tconst $link = jQuery(document.createElement('a'))\n\t\t\t\t.attr('target', '_blank')\n\t\t\t\t.addClass('link-external')\n\t\t\t\t.text(text)\n\t\t\t\t.appendTo(destination);\n\n\t\t\tif (url != null) { // lazy equality for null\n\t\t\t\t$link.attr({\n\t\t\t\t\thref     : url,\n\t\t\t\t\ttabindex : 0 // for accessiblity\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// For legacy-compatibility we must return the DOM node.\n\t\t\treturn $link[0];\n\t\t}\n\n\t\t/*\n\t\t\tReturns whether the given link source is external (probably).\n\t\t*/\n\t\tstatic isExternalLink(link) {\n\t\t\tif (Story.has(link)) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst urlRegExp = new RegExp(`^${Patterns.url}`, 'gim');\n\t\t\treturn urlRegExp.test(link) || /[/.?#]/.test(link);\n\t\t}\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tOption Static Object.\n\t*******************************************************************************************************************/\n\tObject.defineProperty(Wikifier, 'Option', {\n\t\tvalue : (() => {\n\t\t\t// Options array (stack).\n\t\t\tlet _optionsStack = [];\n\n\n\t\t\t/*\n\t\t\t\tGlobalOption Functions.\n\t\t\t*/\n\t\t\tfunction optionLength() {\n\t\t\t\treturn _optionsStack.length;\n\t\t\t}\n\n\t\t\tfunction optionGetter() {\n\t\t\t\treturn Object.assign({}, ..._optionsStack);\n\t\t\t}\n\n\t\t\tfunction optionClear() {\n\t\t\t\t_optionsStack = [];\n\t\t\t}\n\n\t\t\tfunction optionGet(idx) {\n\t\t\t\treturn _optionsStack[idx];\n\t\t\t}\n\n\t\t\tfunction optionPop() {\n\t\t\t\treturn _optionsStack.pop();\n\t\t\t}\n\n\t\t\tfunction optionPush(options) {\n\t\t\t\tif (typeof options !== 'object' || options === null) {\n\t\t\t\t\tthrow new TypeError(`Wikifier.Option.push options parameter must be an object (received: ${Util.getType(options)})`);\n\t\t\t\t}\n\n\t\t\t\treturn _optionsStack.push(options);\n\t\t\t}\n\n\n\t\t\t/*\n\t\t\t\tExports.\n\t\t\t*/\n\t\t\treturn Object.freeze(Object.defineProperties({}, {\n\t\t\t\tlength  : { get : optionLength },\n\t\t\t\toptions : { get : optionGetter },\n\t\t\t\tclear   : { value : optionClear },\n\t\t\t\tget     : { value : optionGet },\n\t\t\t\tpop     : { value : optionPop },\n\t\t\t\tpush    : { value : optionPush }\n\t\t\t}));\n\t\t})()\n\t});\n\n\n\t/*******************************************************************************************************************\n\t\tParser Static Object.\n\t*******************************************************************************************************************/\n\tObject.defineProperty(Wikifier, 'Parser', {\n\t\tvalue : (() => {\n\t\t\t// Parser definition array.  Ordering matters, so this must be an ordered list.\n\t\t\tconst _parsers = [];\n\n\t\t\t// Parser profiles object.\n\t\t\tlet _profiles;\n\n\n\t\t\t/*\n\t\t\t\tParser Functions.\n\t\t\t*/\n\t\t\tfunction parsersGetter() {\n\t\t\t\treturn _parsers;\n\t\t\t}\n\n\t\t\tfunction parsersAdd(parser) {\n\t\t\t\t// Parser object sanity checks.\n\t\t\t\tif (typeof parser !== 'object') {\n\t\t\t\t\tthrow new Error('Wikifier.Parser.add parser parameter must be an object');\n\t\t\t\t}\n\n\t\t\t\tif (!parser.hasOwnProperty('name')) {\n\t\t\t\t\tthrow new Error('parser object missing required \"name\" property');\n\t\t\t\t}\n\t\t\t\telse if (typeof parser.name !== 'string') {\n\t\t\t\t\tthrow new Error('parser object \"name\" property must be a string');\n\t\t\t\t}\n\n\t\t\t\tif (!parser.hasOwnProperty('match')) {\n\t\t\t\t\tthrow new Error('parser object missing required \"match\" property');\n\t\t\t\t}\n\t\t\t\telse if (typeof parser.match !== 'string') {\n\t\t\t\t\tthrow new Error('parser object \"match\" property must be a string');\n\t\t\t\t}\n\n\t\t\t\tif (!parser.hasOwnProperty('handler')) {\n\t\t\t\t\tthrow new Error('parser object missing required \"handler\" property');\n\t\t\t\t}\n\t\t\t\telse if (typeof parser.handler !== 'function') {\n\t\t\t\t\tthrow new Error('parser object \"handler\" property must be a function');\n\t\t\t\t}\n\n\t\t\t\tif (parser.hasOwnProperty('profiles') && !Array.isArray(parser.profiles)) {\n\t\t\t\t\tthrow new Error('parser object \"profiles\" property must be an array');\n\t\t\t\t}\n\n\t\t\t\t// Check for an existing parser with the same name.\n\t\t\t\tif (parsersHas(parser.name)) {\n\t\t\t\t\tthrow new Error(`cannot clobber existing parser \"${parser.name}\"`);\n\t\t\t\t}\n\n\t\t\t\t// Add the parser to the end of the array.\n\t\t\t\t_parsers.push(parser);\n\t\t\t}\n\n\t\t\tfunction parsersDelete(name) {\n\t\t\t\tconst parser = _parsers.find(parser => parser.name === name);\n\n\t\t\t\tif (parser) {\n\t\t\t\t\t_parsers.delete(parser);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction parsersIsEmpty() {\n\t\t\t\treturn _parsers.length === 0;\n\t\t\t}\n\n\t\t\tfunction parsersHas(name) {\n\t\t\t\treturn !!_parsers.find(parser => parser.name === name);\n\t\t\t}\n\n\t\t\tfunction parsersGet(name) {\n\t\t\t\treturn _parsers.find(parser => parser.name === name) || null;\n\t\t\t}\n\n\n\t\t\t/*\n\t\t\t\tParser Profile Functions.\n\t\t\t*/\n\t\t\tfunction profilesGetter() {\n\t\t\t\treturn _profiles;\n\t\t\t}\n\n\t\t\tfunction profilesCompile() {\n\t\t\t\tif (DEBUG) { console.log('[Wikifier.Parser/profilesCompile()]'); }\n\n\t\t\t\tconst all  = _parsers;\n\t\t\t\tconst core = all.filter(parser => !Array.isArray(parser.profiles) || parser.profiles.includes('core'));\n\n\t\t\t\t_profiles = Object.freeze({\n\t\t\t\t\tall : {\n\t\t\t\t\t\tparsers      : all,\n\t\t\t\t\t\tparserRegExp : new RegExp(all.map(parser => `(${parser.match})`).join('|'), 'gm')\n\t\t\t\t\t},\n\t\t\t\t\tcore : {\n\t\t\t\t\t\tparsers      : core,\n\t\t\t\t\t\tparserRegExp : new RegExp(core.map(parser => `(${parser.match})`).join('|'), 'gm')\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\treturn _profiles;\n\t\t\t}\n\n\t\t\tfunction profilesIsEmpty() {\n\t\t\t\treturn typeof _profiles !== 'object' || Object.keys(_profiles).length === 0;\n\t\t\t}\n\n\t\t\tfunction profilesGet(profile) {\n\t\t\t\tif (typeof _profiles !== 'object' || !_profiles.hasOwnProperty(profile)) {\n\t\t\t\t\tthrow new Error(`nonexistent parser profile \"${profile}\"`);\n\t\t\t\t}\n\n\t\t\t\treturn _profiles[profile];\n\t\t\t}\n\n\t\t\tfunction profilesHas(profile) {\n\t\t\t\treturn typeof _profiles === 'object' && _profiles.hasOwnProperty(profile);\n\t\t\t}\n\n\n\t\t\t/*\n\t\t\t\tExports.\n\t\t\t*/\n\t\t\treturn Object.freeze(Object.defineProperties({}, {\n\t\t\t\t/*\n\t\t\t\t\tParser Containers.\n\t\t\t\t*/\n\t\t\t\tparsers : { get : parsersGetter },\n\n\t\t\t\t/*\n\t\t\t\t\tParser Functions.\n\t\t\t\t*/\n\t\t\t\tadd     : { value : parsersAdd },\n\t\t\t\tdelete  : { value : parsersDelete },\n\t\t\t\tisEmpty : { value : parsersIsEmpty },\n\t\t\t\thas     : { value : parsersHas },\n\t\t\t\tget     : { value : parsersGet },\n\n\t\t\t\t/*\n\t\t\t\t\tParser Profile.\n\t\t\t\t*/\n\t\t\t\tProfile : {\n\t\t\t\t\tvalue : Object.freeze(Object.defineProperties({}, {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t\tProfiles Containers.\n\t\t\t\t\t\t*/\n\t\t\t\t\t\tprofiles : { get : profilesGetter },\n\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t\tProfiles Functions.\n\t\t\t\t\t\t*/\n\t\t\t\t\t\tcompile : { value : profilesCompile },\n\t\t\t\t\t\tisEmpty : { value : profilesIsEmpty },\n\t\t\t\t\t\thas     : { value : profilesHas },\n\t\t\t\t\t\tget     : { value : profilesGet }\n\t\t\t\t\t}))\n\t\t\t\t}\n\t\t\t}));\n\t\t})()\n\t});\n\n\n\t/*******************************************************************************************************************\n\t\tAdditional Static Properties.\n\t*******************************************************************************************************************/\n\tObject.defineProperties(Wikifier, {\n\t\thelpers        : { value : {} },\n\t\t/* Global exit flag */\n\t\tstopWikify     : { value : false, writable : true },\n\t\t/*\n\t\t\tLegacy Aliases.\n\t\t*/\n\t\tgetValue       : { value : State.getVar },              // SEE: `state.js`.\n\t\tsetValue       : { value : State.setVar },              // SEE: `state.js`.\n\t\tparse          : { value : Scripting.parse },           // SEE: `markup/scripting.js`.\n\t\tevalExpression : { value : Scripting.evalTwineScript }, // SEE: `markup/scripting.js`.\n\t\tevalStatements : { value : Scripting.evalTwineScript }, // SEE: `markup/scripting.js`.\n\t\ttextPrimitives : { value : Patterns }                   // SEE: `lib/patterns.js`.\n\t});\n\n\n\t/*******************************************************************************************************************\n\t\tHelper Static Methods.\n\t*******************************************************************************************************************/\n\tObject.defineProperties(Wikifier.helpers, {\n\t\tinlineCss : {\n\t\t\tvalue : (() => {\n\t\t\t\tconst lookaheadRe = new RegExp(Patterns.inlineCss, 'gm');\n\t\t\t\tconst idOrClassRe = new RegExp(`(${Patterns.cssIdOrClassSigil})(${Patterns.anyLetter}+)`, 'g');\n\n\t\t\t\tfunction helperInlineCss(w) {\n\t\t\t\t\tconst css = { classes : [], id : '', styles : {} };\n\t\t\t\t\tlet matched;\n\n\t\t\t\t\tdo {\n\t\t\t\t\t\tlookaheadRe.lastIndex = w.nextMatch;\n\n\t\t\t\t\t\tconst match = lookaheadRe.exec(w.source);\n\n\t\t\t\t\t\tmatched = match && match.index === w.nextMatch;\n\n\t\t\t\t\t\tif (matched) {\n\t\t\t\t\t\t\tif (match[1]) {\n\t\t\t\t\t\t\t\tcss.styles[Util.fromCssProperty(match[1])] = match[2].trim();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (match[3]) {\n\t\t\t\t\t\t\t\tcss.styles[Util.fromCssProperty(match[3])] = match[4].trim();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (match[5]) {\n\t\t\t\t\t\t\t\tlet subMatch;\n\n\t\t\t\t\t\t\t\tidOrClassRe.lastIndex = 0; // NOTE: Guard against buggy implementations.\n\n\t\t\t\t\t\t\t\twhile ((subMatch = idOrClassRe.exec(match[5])) !== null) {\n\t\t\t\t\t\t\t\t\tif (subMatch[1] === '.') {\n\t\t\t\t\t\t\t\t\t\tcss.classes.push(subMatch[2]);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\tcss.id = subMatch[2];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tw.nextMatch = lookaheadRe.lastIndex; // eslint-disable-line no-param-reassign\n\t\t\t\t\t\t}\n\t\t\t\t\t} while (matched);\n\n\t\t\t\t\treturn css;\n\t\t\t\t}\n\n\t\t\t\treturn helperInlineCss;\n\t\t\t})()\n\t\t},\n\n\t\tevalText : {\n\t\t\tvalue(text) {\n\t\t\t\tlet result;\n\n\t\t\t\ttry {\n\t\t\t\t\tresult = Scripting.evalTwineScript(text);\n\n\t\t\t\t\t/*\n\t\t\t\t\t\tAttempt to prevent the leakage of auto-globals by enforcing that\n\t\t\t\t\t\tthe resultant value be either a string or a number.\n\n\t\t\t\t\t\tNOTE: This is not a foolproof solution to the problem of auto-global\n\t\t\t\t\t\tleakage.  Various auto-globals, which return strings or numbers, can\n\t\t\t\t\t\tstill leak through—e.g. `window.status` → string.\n\t\t\t\t\t*/\n\t\t\t\t\tswitch (typeof result) {\n\t\t\t\t\tcase 'string':\n\t\t\t\t\t\tif (result.trim() === '') {\n\t\t\t\t\t\t\tresult = text;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'number':\n\t\t\t\t\t\tresult = String(result);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tresult = text;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (ex) {\n\t\t\t\t\tresult = text;\n\t\t\t\t}\n\n\t\t\t\treturn result;\n\t\t\t}\n\t\t},\n\n\t\tevalPassageId : {\n\t\t\tvalue(passage) {\n\t\t\t\tif (passage == null || Story.has(passage)) { // lazy equality for null; `0` is a valid name, so we cannot simply evaluate `passage`\n\t\t\t\t\treturn passage;\n\t\t\t\t}\n\n\t\t\t\treturn Wikifier.helpers.evalText(passage);\n\t\t\t}\n\t\t},\n\n\t\thasBlockContext : {\n\t\t\tvalue(nodes) {\n\t\t\t\tconst hasGCS = typeof window.getComputedStyle === 'function';\n\n\t\t\t\tfor (let i = nodes.length - 1; i >= 0; --i) {\n\t\t\t\t\tconst node = nodes[i];\n\n\t\t\t\t\tswitch (node.nodeType) {\n\t\t\t\t\tcase Node.ELEMENT_NODE:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tconst tagName = node.nodeName.toUpperCase();\n\n\t\t\t\t\t\t\tif (tagName === 'BR') {\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst styles = hasGCS ? window.getComputedStyle(node, null) : node.currentStyle;\n\n\t\t\t\t\t\t\tif (styles && styles.display) {\n\t\t\t\t\t\t\t\tif (styles.display === 'none') {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn styles.display === 'block';\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t\tWebKit/Blink-based browsers do not attach any computed style\n\t\t\t\t\t\t\t\tinformation to elements until they're inserted into the DOM\n\t\t\t\t\t\t\t\t(and probably visible), not even the default browser styles\n\t\t\t\t\t\t\t\tand any user styles.  So, we make an assumption based on the\n\t\t\t\t\t\t\t\telement.\n\t\t\t\t\t\t\t*/\n\t\t\t\t\t\t\tswitch (tagName) {\n\t\t\t\t\t\t\tcase 'ADDRESS':\n\t\t\t\t\t\t\tcase 'ARTICLE':\n\t\t\t\t\t\t\tcase 'ASIDE':\n\t\t\t\t\t\t\tcase 'BLOCKQUOTE':\n\t\t\t\t\t\t\tcase 'CENTER':\n\t\t\t\t\t\t\tcase 'DIV':\n\t\t\t\t\t\t\tcase 'DL':\n\t\t\t\t\t\t\tcase 'FIGURE':\n\t\t\t\t\t\t\tcase 'FOOTER':\n\t\t\t\t\t\t\tcase 'FORM':\n\t\t\t\t\t\t\tcase 'H1':\n\t\t\t\t\t\t\tcase 'H2':\n\t\t\t\t\t\t\tcase 'H3':\n\t\t\t\t\t\t\tcase 'H4':\n\t\t\t\t\t\t\tcase 'H5':\n\t\t\t\t\t\t\tcase 'H6':\n\t\t\t\t\t\t\tcase 'HEADER':\n\t\t\t\t\t\t\tcase 'HR':\n\t\t\t\t\t\t\tcase 'MAIN':\n\t\t\t\t\t\t\tcase 'NAV':\n\t\t\t\t\t\t\tcase 'OL':\n\t\t\t\t\t\t\tcase 'P':\n\t\t\t\t\t\t\tcase 'PRE':\n\t\t\t\t\t\t\tcase 'SECTION':\n\t\t\t\t\t\t\tcase 'TABLE':\n\t\t\t\t\t\t\tcase 'UL':\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn false;\n\n\t\t\t\t\tcase Node.COMMENT_NODE:\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t},\n\n\t\tcreateShadowSetterCallback : {\n\t\t\tvalue : (() => {\n\t\t\t\tlet macroParser = null;\n\n\t\t\t\tfunction cacheMacroParser() {\n\t\t\t\t\tif (!macroParser) {\n\t\t\t\t\t\tmacroParser = Wikifier.Parser.get('macro');\n\n\t\t\t\t\t\tif (!macroParser) {\n\t\t\t\t\t\t\tthrow new Error('cannot find \"macro\" parser');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn macroParser;\n\t\t\t\t}\n\n\t\t\t\tfunction getMacroContextShadowView() {\n\t\t\t\t\tconst macro = macroParser || cacheMacroParser();\n\t\t\t\t\tconst view  = new Set();\n\n\t\t\t\t\tfor (let context = macro.context; context !== null; context = context.parent) {\n\t\t\t\t\t\tif (context._shadows) {\n\t\t\t\t\t\t\tcontext._shadows.forEach(name => view.add(name));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn [...view];\n\t\t\t\t}\n\n\t\t\t\tfunction helperCreateShadowSetterCallback(code) {\n\t\t\t\t\tconst shadowStore = {};\n\n\t\t\t\t\tgetMacroContextShadowView().forEach(varName => {\n\t\t\t\t\t\tconst varKey = varName.slice(1);\n\t\t\t\t\t\tconst store  = varName[0] === '$' ? State.variables : State.temporary;\n\t\t\t\t\t\tshadowStore[varName] = store[varKey];\n\t\t\t\t\t});\n\n\t\t\t\t\treturn function () {\n\t\t\t\t\t\tconst shadowNames = Object.keys(shadowStore);\n\t\t\t\t\t\tconst valueCache  = shadowNames.length > 0 ? {} : null;\n\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t\tThere's no catch clause because this try/finally is here simply to ensure that\n\t\t\t\t\t\t\tproper cleanup is done in the event that an exception is thrown during the\n\t\t\t\t\t\t\tevaluation.\n\t\t\t\t\t\t*/\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t\tCache the existing values of the variables to be shadowed and assign the\n\t\t\t\t\t\t\t\tshadow values.\n\t\t\t\t\t\t\t*/\n\t\t\t\t\t\t\tshadowNames.forEach(varName => {\n\t\t\t\t\t\t\t\tconst varKey = varName.slice(1);\n\t\t\t\t\t\t\t\tconst store  = varName[0] === '$' ? State.variables : State.temporary;\n\n\t\t\t\t\t\t\t\tif (store.hasOwnProperty(varKey)) {\n\t\t\t\t\t\t\t\t\tvalueCache[varKey] = store[varKey];\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tstore[varKey] = shadowStore[varName];\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t// Evaluate the JavaScript.\n\t\t\t\t\t\t\treturn Scripting.evalJavaScript(code);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfinally {\n\t\t\t\t\t\t\t// Revert the variable shadowing.\n\t\t\t\t\t\t\tshadowNames.forEach(varName => {\n\t\t\t\t\t\t\t\tconst varKey = varName.slice(1);\n\t\t\t\t\t\t\t\tconst store  = varName[0] === '$' ? State.variables : State.temporary;\n\n\t\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t\t\tUpdate the shadow store with the variable's current value, in case it\n\t\t\t\t\t\t\t\t\twas modified during the callback.\n\t\t\t\t\t\t\t\t*/\n\t\t\t\t\t\t\t\tshadowStore[varName] = store[varKey];\n\n\t\t\t\t\t\t\t\tif (valueCache.hasOwnProperty(varKey)) {\n\t\t\t\t\t\t\t\t\tstore[varKey] = valueCache[varKey];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tdelete store[varKey];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treturn helperCreateShadowSetterCallback;\n\t\t\t})()\n\t\t},\n\n\t\tparseSquareBracketedMarkup : {\n\t\t\tvalue : (() => {\n\t\t\t\t/* eslint-disable no-param-reassign */\n\t\t\t\tconst Item = Lexer.enumFromNames([ // lex item types object (pseudo-enumeration)\n\t\t\t\t\t'Error',     // error\n\t\t\t\t\t'DelimLTR',  // '|' or '->'\n\t\t\t\t\t'DelimRTL',  // '<-'\n\t\t\t\t\t'InnerMeta', // ']['\n\t\t\t\t\t'ImageMeta', // '[img[', '[<img[', or '[>img['\n\t\t\t\t\t'LinkMeta',  // '[['\n\t\t\t\t\t'Link',      // link destination\n\t\t\t\t\t'RightMeta', // ']]'\n\t\t\t\t\t'Setter',    // setter expression\n\t\t\t\t\t'Source',    // image source\n\t\t\t\t\t'Text'       // link text or image alt text\n\t\t\t\t]);\n\t\t\t\tconst Delim = Lexer.enumFromNames([ // delimiter state object (pseudo-enumeration)\n\t\t\t\t\t'None', // no delimiter encountered\n\t\t\t\t\t'LTR',  // '|' or '->'\n\t\t\t\t\t'RTL'   // '<-'\n\t\t\t\t]);\n\n\t\t\t\t// Lexing functions.\n\t\t\t\tfunction slurpQuote(lexer, endQuote) {\n\t\t\t\t\tloop: for (;;) {\n\t\t\t\t\t\t/* eslint-disable indent */\n\t\t\t\t\t\tswitch (lexer.next()) {\n\t\t\t\t\t\tcase '\\\\':\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tconst ch = lexer.next();\n\n\t\t\t\t\t\t\t\tif (ch !== EOF && ch !== '\\n') {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/* falls through */\n\t\t\t\t\t\tcase EOF:\n\t\t\t\t\t\tcase '\\n':\n\t\t\t\t\t\t\treturn EOF;\n\n\t\t\t\t\t\tcase endQuote:\n\t\t\t\t\t\t\tbreak loop;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t/* eslint-enable indent */\n\t\t\t\t\t}\n\n\t\t\t\t\treturn lexer.pos;\n\t\t\t\t}\n\n\t\t\t\tfunction lexLeftMeta(lexer) {\n\t\t\t\t\tif (!lexer.accept('[')) {\n\t\t\t\t\t\treturn lexer.error(Item.Error, 'malformed square-bracketed markup');\n\t\t\t\t\t}\n\n\t\t\t\t\t// Is link markup.\n\t\t\t\t\tif (lexer.accept('[')) {\n\t\t\t\t\t\tlexer.data.isLink = true;\n\t\t\t\t\t\tlexer.emit(Item.LinkMeta);\n\t\t\t\t\t}\n\n\t\t\t\t\t// May be image markup.\n\t\t\t\t\telse {\n\t\t\t\t\t\tlexer.accept('<>'); // aligner syntax\n\n\t\t\t\t\t\tif (!lexer.accept('Ii') || !lexer.accept('Mm') || !lexer.accept('Gg') || !lexer.accept('[')) {\n\t\t\t\t\t\t\treturn lexer.error(Item.Error, 'malformed square-bracketed markup');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlexer.data.isLink = false;\n\t\t\t\t\t\tlexer.emit(Item.ImageMeta);\n\t\t\t\t\t}\n\n\t\t\t\t\tlexer.depth = 2; // account for both initial left square brackets\n\t\t\t\t\treturn lexCoreComponents;\n\t\t\t\t}\n\n\t\t\t\tfunction lexCoreComponents(lexer) {\n\t\t\t\t\tconst what = lexer.data.isLink ? 'link' : 'image';\n\t\t\t\t\tlet delim = Delim.None;\n\n\t\t\t\t\tfor (;;) {\n\t\t\t\t\t\tswitch (lexer.next()) {\n\t\t\t\t\t\tcase EOF:\n\t\t\t\t\t\tcase '\\n':\n\t\t\t\t\t\t\treturn lexer.error(Item.Error, `unterminated ${what} markup`);\n\n\t\t\t\t\t\tcase '\"':\n\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t\tThis is not entirely reliable within sections that allow raw strings, since\n\t\t\t\t\t\t\t\tit's possible, however unlikely, for a raw string to contain unpaired double\n\t\t\t\t\t\t\t\tquotes.  The likelihood is low enough, however, that I'm deeming the risk as\n\t\t\t\t\t\t\t\tacceptable—for now, at least.\n\t\t\t\t\t\t\t*/\n\t\t\t\t\t\t\tif (slurpQuote(lexer, '\"') === EOF) {\n\t\t\t\t\t\t\t\treturn lexer.error(Item.Error, `unterminated double quoted string in ${what} markup`);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase '|': // possible pipe ('|') delimiter\n\t\t\t\t\t\t\tif (delim === Delim.None) {\n\t\t\t\t\t\t\t\tdelim = Delim.LTR;\n\t\t\t\t\t\t\t\tlexer.backup();\n\t\t\t\t\t\t\t\tlexer.emit(Item.Text);\n\t\t\t\t\t\t\t\tlexer.forward();\n\t\t\t\t\t\t\t\tlexer.emit(Item.DelimLTR);\n\t\t\t\t\t\t\t\t// lexer.ignore();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase '-': // possible right arrow ('->') delimiter\n\t\t\t\t\t\t\tif (delim === Delim.None && lexer.peek() === '>') {\n\t\t\t\t\t\t\t\tdelim = Delim.LTR;\n\t\t\t\t\t\t\t\tlexer.backup();\n\t\t\t\t\t\t\t\tlexer.emit(Item.Text);\n\t\t\t\t\t\t\t\tlexer.forward(2);\n\t\t\t\t\t\t\t\tlexer.emit(Item.DelimLTR);\n\t\t\t\t\t\t\t\t// lexer.ignore();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase '<': // possible left arrow ('<-') delimiter\n\t\t\t\t\t\t\tif (delim === Delim.None && lexer.peek() === '-') {\n\t\t\t\t\t\t\t\tdelim = Delim.RTL;\n\t\t\t\t\t\t\t\tlexer.backup();\n\t\t\t\t\t\t\t\tlexer.emit(lexer.data.isLink ? Item.Link : Item.Source);\n\t\t\t\t\t\t\t\tlexer.forward(2);\n\t\t\t\t\t\t\t\tlexer.emit(Item.DelimRTL);\n\t\t\t\t\t\t\t\t// lexer.ignore();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase '[':\n\t\t\t\t\t\t\t++lexer.depth;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase ']':\n\t\t\t\t\t\t\t--lexer.depth;\n\n\t\t\t\t\t\t\tif (lexer.depth === 1) {\n\t\t\t\t\t\t\t\tswitch (lexer.peek()) {\n\t\t\t\t\t\t\t\tcase '[':\n\t\t\t\t\t\t\t\t\t++lexer.depth;\n\t\t\t\t\t\t\t\t\tlexer.backup();\n\n\t\t\t\t\t\t\t\t\tif (delim === Delim.RTL) {\n\t\t\t\t\t\t\t\t\t\tlexer.emit(Item.Text);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\tlexer.emit(lexer.data.isLink ? Item.Link : Item.Source);\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tlexer.forward(2);\n\t\t\t\t\t\t\t\t\tlexer.emit(Item.InnerMeta);\n\t\t\t\t\t\t\t\t\t// lexer.ignore();\n\t\t\t\t\t\t\t\t\treturn lexer.data.isLink ? lexSetter : lexImageLink;\n\n\t\t\t\t\t\t\t\tcase ']':\n\t\t\t\t\t\t\t\t\t--lexer.depth;\n\t\t\t\t\t\t\t\t\tlexer.backup();\n\n\t\t\t\t\t\t\t\t\tif (delim === Delim.RTL) {\n\t\t\t\t\t\t\t\t\t\tlexer.emit(Item.Text);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\tlexer.emit(lexer.data.isLink ? Item.Link : Item.Source);\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tlexer.forward(2);\n\t\t\t\t\t\t\t\t\tlexer.emit(Item.RightMeta);\n\t\t\t\t\t\t\t\t\t// lexer.ignore();\n\t\t\t\t\t\t\t\t\treturn null;\n\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\treturn lexer.error(Item.Error, `malformed ${what} markup`);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfunction lexImageLink(lexer) {\n\t\t\t\t\tconst what = lexer.data.isLink ? 'link' : 'image';\n\n\t\t\t\t\tfor (;;) {\n\t\t\t\t\t\tswitch (lexer.next()) {\n\t\t\t\t\t\tcase EOF:\n\t\t\t\t\t\tcase '\\n':\n\t\t\t\t\t\t\treturn lexer.error(Item.Error, `unterminated ${what} markup`);\n\n\t\t\t\t\t\tcase '\"':\n\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t\tThis is not entirely reliable within sections that allow raw strings, since\n\t\t\t\t\t\t\t\tit's possible, however unlikely, for a raw string to contain unpaired double\n\t\t\t\t\t\t\t\tquotes.  The likelihood is low enough, however, that I'm deeming the risk as\n\t\t\t\t\t\t\t\tacceptable—for now, at least.\n\t\t\t\t\t\t\t*/\n\t\t\t\t\t\t\tif (slurpQuote(lexer, '\"') === EOF) {\n\t\t\t\t\t\t\t\treturn lexer.error(Item.Error, `unterminated double quoted string in ${what} markup link component`);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase '[':\n\t\t\t\t\t\t\t++lexer.depth;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase ']':\n\t\t\t\t\t\t\t--lexer.depth;\n\n\t\t\t\t\t\t\tif (lexer.depth === 1) {\n\t\t\t\t\t\t\t\tswitch (lexer.peek()) {\n\t\t\t\t\t\t\t\tcase '[':\n\t\t\t\t\t\t\t\t\t++lexer.depth;\n\t\t\t\t\t\t\t\t\tlexer.backup();\n\t\t\t\t\t\t\t\t\tlexer.emit(Item.Link);\n\t\t\t\t\t\t\t\t\tlexer.forward(2);\n\t\t\t\t\t\t\t\t\tlexer.emit(Item.InnerMeta);\n\t\t\t\t\t\t\t\t\t// lexer.ignore();\n\t\t\t\t\t\t\t\t\treturn lexSetter;\n\n\t\t\t\t\t\t\t\tcase ']':\n\t\t\t\t\t\t\t\t\t--lexer.depth;\n\t\t\t\t\t\t\t\t\tlexer.backup();\n\t\t\t\t\t\t\t\t\tlexer.emit(Item.Link);\n\t\t\t\t\t\t\t\t\tlexer.forward(2);\n\t\t\t\t\t\t\t\t\tlexer.emit(Item.RightMeta);\n\t\t\t\t\t\t\t\t\t// lexer.ignore();\n\t\t\t\t\t\t\t\t\treturn null;\n\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\treturn lexer.error(Item.Error, `malformed ${what} markup`);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfunction lexSetter(lexer) {\n\t\t\t\t\tconst what = lexer.data.isLink ? 'link' : 'image';\n\n\t\t\t\t\tfor (;;) {\n\t\t\t\t\t\tswitch (lexer.next()) {\n\t\t\t\t\t\tcase EOF:\n\t\t\t\t\t\tcase '\\n':\n\t\t\t\t\t\t\treturn lexer.error(Item.Error, `unterminated ${what} markup`);\n\n\t\t\t\t\t\tcase '\"':\n\t\t\t\t\t\t\tif (slurpQuote(lexer, '\"') === EOF) {\n\t\t\t\t\t\t\t\treturn lexer.error(Item.Error, `unterminated double quoted string in ${what} markup setter component`);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase \"'\":\n\t\t\t\t\t\t\tif (slurpQuote(lexer, \"'\") === EOF) {\n\t\t\t\t\t\t\t\treturn lexer.error(Item.Error, `unterminated single quoted string in ${what} markup setter component`);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase '[':\n\t\t\t\t\t\t\t++lexer.depth;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase ']':\n\t\t\t\t\t\t\t--lexer.depth;\n\n\t\t\t\t\t\t\tif (lexer.depth === 1) {\n\t\t\t\t\t\t\t\tif (lexer.peek() !== ']') {\n\t\t\t\t\t\t\t\t\treturn lexer.error(Item.Error, `malformed ${what} markup`);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t--lexer.depth;\n\t\t\t\t\t\t\t\tlexer.backup();\n\t\t\t\t\t\t\t\tlexer.emit(Item.Setter);\n\t\t\t\t\t\t\t\tlexer.forward(2);\n\t\t\t\t\t\t\t\tlexer.emit(Item.RightMeta);\n\t\t\t\t\t\t\t\t// lexer.ignore();\n\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Parse function.\n\t\t\t\tfunction parseSquareBracketedMarkup(w) {\n\t\t\t\t\t// Initialize the lexer.\n\t\t\t\t\tconst lexer  = new Lexer(w.source, lexLeftMeta);\n\n\t\t\t\t\t// Set the initial positions within the source string.\n\t\t\t\t\tlexer.start = lexer.pos = w.matchStart;\n\n\t\t\t\t\t// Lex the raw argument string.\n\t\t\t\t\tconst markup = {};\n\t\t\t\t\tconst items  = lexer.run();\n\t\t\t\t\tconst last   = items.last();\n\n\t\t\t\t\tif (last && last.type === Item.Error) {\n\t\t\t\t\t\tmarkup.error = last.message;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\titems.forEach(item => {\n\t\t\t\t\t\t\tconst text = item.text.trim();\n\n\t\t\t\t\t\t\tswitch (item.type) {\n\t\t\t\t\t\t\tcase Item.ImageMeta:\n\t\t\t\t\t\t\t\tmarkup.isImage = true;\n\n\t\t\t\t\t\t\t\tif (text[1] === '<') {\n\t\t\t\t\t\t\t\t\tmarkup.align = 'left';\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse if (text[1] === '>') {\n\t\t\t\t\t\t\t\t\tmarkup.align = 'right';\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase Item.LinkMeta:\n\t\t\t\t\t\t\t\tmarkup.isLink = true;\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase Item.Link:\n\t\t\t\t\t\t\t\tif (text[0] === '~') {\n\t\t\t\t\t\t\t\t\tmarkup.forceInternal = true;\n\t\t\t\t\t\t\t\t\tmarkup.link = text.slice(1);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tmarkup.link = text;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase Item.Setter:\n\t\t\t\t\t\t\t\tmarkup.setter = text;\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase Item.Source:\n\t\t\t\t\t\t\t\tmarkup.source = text;\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase Item.Text:\n\t\t\t\t\t\t\t\tmarkup.text = text;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tmarkup.pos = lexer.pos;\n\t\t\t\t\treturn markup;\n\t\t\t\t}\n\n\t\t\t\treturn parseSquareBracketedMarkup;\n\t\t\t\t/* eslint-enable no-param-reassign */\n\t\t\t})()\n\t\t}\n\t});\n\n\n\t/*******************************************************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************************************************/\n\treturn Wikifier;\n})();\n/* eslint-enable max-len */\n\n/***********************************************************************************************************************\n\n\tmarkup/parserlib.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/*\n\tglobal Config, DebugView, EOF, Engine, Lexer, Macro, MacroContext, Patterns, Scripting, State, Story, Template,\n\t       Wikifier, stringFrom, throwError\n*/\n/* eslint \"no-param-reassign\": [ 2, { \"props\" : false } ] */\n\n(() => {\n\t'use strict';\n\n\t/*******************************************************************************************************************\n\t\tUtility Functions.\n\t*******************************************************************************************************************/\n\tfunction _verbatimTagHandler(w) {\n\t\tthis.lookahead.lastIndex = w.matchStart;\n\n\t\tconst match = this.lookahead.exec(w.source);\n\n\t\tif (match && match.index === w.matchStart) {\n\t\t\tw.nextMatch = this.lookahead.lastIndex;\n\n\t\t\tjQuery(document.createDocumentFragment())\n\t\t\t\t.append(match[1])\n\t\t\t\t.appendTo(w.output);\n\t\t}\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tParsers.\n\t*******************************************************************************************************************/\n\tWikifier.Parser.add({\n\t\tname       : 'quoteByBlock',\n\t\tprofiles   : ['block'],\n\t\tmatch      : '^<<<\\\\n',\n\t\tterminator : '^<<<\\\\n',\n\n\t\thandler(w) {\n\t\t\tif (!Wikifier.helpers.hasBlockContext(w.output.childNodes)) {\n\t\t\t\tjQuery(w.output).append(document.createTextNode(w.matchText));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tw.subWikify(\n\t\t\t\tjQuery(document.createElement('blockquote'))\n\t\t\t\t\t.appendTo(w.output)\n\t\t\t\t\t.get(0),\n\t\t\t\tthis.terminator\n\t\t\t);\n\t\t}\n\t});\n\n\tWikifier.Parser.add({\n\t\tname       : 'quoteByLine',\n\t\tprofiles   : ['block'],\n\t\tmatch      : '^>+',\n\t\tlookahead  : /^>+/gm,\n\t\tterminator : '\\\\n',\n\n\t\thandler(w) {\n\t\t\tif (!Wikifier.helpers.hasBlockContext(w.output.childNodes)) {\n\t\t\t\tjQuery(w.output).append(document.createTextNode(w.matchText));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst destStack = [w.output];\n\t\t\tlet curLevel = 0;\n\t\t\tlet newLevel = w.matchLength;\n\t\t\tlet matched;\n\t\t\tlet i;\n\n\t\t\tdo {\n\t\t\t\tif (newLevel > curLevel) {\n\t\t\t\t\tfor (i = curLevel; i < newLevel; ++i) {\n\t\t\t\t\t\tdestStack.push(\n\t\t\t\t\t\t\tjQuery(document.createElement('blockquote'))\n\t\t\t\t\t\t\t\t.appendTo(destStack[destStack.length - 1])\n\t\t\t\t\t\t\t\t.get(0)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (newLevel < curLevel) {\n\t\t\t\t\tfor (i = curLevel; i > newLevel; --i) {\n\t\t\t\t\t\tdestStack.pop();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcurLevel = newLevel;\n\t\t\t\tw.subWikify(destStack[destStack.length - 1], this.terminator);\n\t\t\t\tjQuery(document.createElement('br')).appendTo(destStack[destStack.length - 1]);\n\n\t\t\t\tthis.lookahead.lastIndex = w.nextMatch;\n\n\t\t\t\tconst match = this.lookahead.exec(w.source);\n\n\t\t\t\tmatched = match && match.index === w.nextMatch;\n\n\t\t\t\tif (matched) {\n\t\t\t\t\tnewLevel = match[0].length;\n\t\t\t\t\tw.nextMatch += match[0].length;\n\t\t\t\t}\n\t\t\t} while (matched);\n\t\t}\n\t});\n\n\t/*\n\tChanges to the default macro parser with 3 things:\n\t- Fixes an issue that causes tags that start with \"end\" to not get parsed, therefore not providing a payload.\n\t- Adds support for object literals as macro arguments.\n\t\tExtends the functionality to accept object literals directly, eliminating\n\t\tthe need to use template literals or other workarounds to pass complex data structures.\n\n\t\tAlso allows us to define arrow function inside object literals.\n\n\t\tExample usage:\n\t\tBefore: <<macroName `{\"key\": \"value\"}`>>\n\t\tAfter:  <<macroName {key:\"value\"}>>\n\n\t\tArrow function:  <<macroName {key: () => \"returnvalue\"}>>\n\n\t- Adds support for function calls as macro arguments.\n\t\tExtends the functionality to accept function calls anywhere in the argument list.\n\t\tBefore any function call was converted into a string.\n\n\t\tExample usage:\n\t\t\t<<macroName \"arg1\" myFunction(\"param\") \"arg3\">>\n\t\t\t<<macroName \"arg1\" myFunction(\"longer string\") \"arg3\">>\n\t*/\n\tWikifier.Parser.add({\n\t\tname      : 'macro',\n\t\tprofiles  : ['core'],\n\t\tmatch     : '<<',\n\t\tlookahead : new RegExp(`<<(/?${Patterns.macroName})(?:\\\\s*)((?:(?:/\\\\*[^*]*\\\\*+(?:[^/*][^*]*\\\\*+)*/)|(?://.*\\\\n)|(?:\\`(?:\\\\\\\\.|[^\\`\\\\\\\\])*\\`)|(?:\"(?:\\\\\\\\.|[^\"\\\\\\\\])*\")|(?:'(?:\\\\\\\\.|[^'\\\\\\\\])*')|(?:\\\\[(?:[<>]?[Ii][Mm][Gg])?\\\\[[^\\\\r\\\\n]*?\\\\]\\\\]+)|[^>]|(?:>(?!>)))*)>>`, 'gm'),\n\t\tworking   : { source : '', name : '', arguments : '', index : 0 }, // the working parse object\n\t\tcontext   : null, // last execution context object (top-level macros, hierarchically, have a null context)\n\n\t\thandler(w) {\n\t\t\tconst matchStart = this.lookahead.lastIndex = w.matchStart;\n\n\t\t\tif (this.parseTag(w)) {\n\t\t\t\t/*\n\t\t\t\t\tIf `parseBody()` is called below, it will modify the current working\n\t\t\t\t\tvalues, so we must cache them now.\n\t\t\t\t*/\n\t\t\t\tconst nextMatch = w.nextMatch;\n\t\t\t\tconst name      = this.working.name;\n\t\t\t\tconst rawArgs   = this.working.arguments;\n\t\t\t\tlet macro;\n\n\t\t\t\ttry {\n\t\t\t\t\tmacro = Macro.get(name);\n\n\t\t\t\t\tif (macro) {\n\t\t\t\t\t\tlet payload = null;\n\n\t\t\t\t\t\tif (typeof macro.tags !== 'undefined') {\n\t\t\t\t\t\t\tpayload = this.parseBody(w, macro);\n\n\t\t\t\t\t\t\tif (!payload) {\n\t\t\t\t\t\t\t\tw.nextMatch = nextMatch; // we must reset `w.nextMatch` here, as `parseBody()` modifies it\n\t\t\t\t\t\t\t\treturn throwError(\n\t\t\t\t\t\t\t\t\tw.output,\n\t\t\t\t\t\t\t\t\t`cannot find a closing tag for macro <<${name}>>`,\n\t\t\t\t\t\t\t\t\t`${w.source.slice(matchStart, w.nextMatch)}\\u2026`\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (typeof macro.handler === 'function') {\n\t\t\t\t\t\t\tconst args = !payload\n\t\t\t\t\t\t\t\t? this.createArgs(rawArgs, this.skipArgs(macro, macro.name))\n\t\t\t\t\t\t\t\t: payload[0].args;\n\n\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t\tNew-style macros.\n\t\t\t\t\t\t\t*/\n\t\t\t\t\t\t\tif (typeof macro._MACRO_API !== 'undefined') {\n\t\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t\t\tAdd the macro's execution context to the context chain.\n\t\t\t\t\t\t\t\t*/\n\t\t\t\t\t\t\t\tthis.context = new MacroContext({\n\t\t\t\t\t\t\t\t\tmacro,\n\t\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\t\targs,\n\t\t\t\t\t\t\t\t\tpayload,\n\t\t\t\t\t\t\t\t\tsource : w.source.slice(matchStart, w.nextMatch),\n\t\t\t\t\t\t\t\t\tparent : this.context,\n\t\t\t\t\t\t\t\t\tparser : w\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t\t\tCall the handler.\n\n\t\t\t\t\t\t\t\t\tNOTE: There's no catch clause here because this try/finally exists solely\n\t\t\t\t\t\t\t\t\tto ensure that the execution context is properly restored in the event\n\t\t\t\t\t\t\t\t\tthat an uncaught exception is thrown during the handler call.\n\t\t\t\t\t\t\t\t*/\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tmacro.handler.call(this.context);\n\t\t\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t\t\t\tQUESTION: Swap to the following, which passes macro arguments in\n\t\t\t\t\t\t\t\t\t\tas parameters to the handler function, in addition to them being\n\t\t\t\t\t\t\t\t\t\tavailable on its `this`?  If so, it might still be something to\n\t\t\t\t\t\t\t\t\t\thold off on until v3, when the legacy macro API is removed.\n\n\t\t\t\t\t\t\t\t\t\tmacro.handler.apply(this.context, this.context.args);\n\t\t\t\t\t\t\t\t\t*/\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tfinally {\n\t\t\t\t\t\t\t\t\t// eslint-disable-next-line max-depth\n\t\t\t\t\t\t\t\t\tif (macro.isWidget && Wikifier.stopWikify === 1) {\n\t\t\t\t\t\t\t\t\t\tWikifier.stopWikify = 0;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tthis.context = this.context.parent;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t\t[DEPRECATED] Old-style/legacy macros.\n\t\t\t\t\t\t\t*/\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t\t\tSet up the raw arguments string.\n\t\t\t\t\t\t\t\t*/\n\t\t\t\t\t\t\t\tconst prevRawArgs = w._rawArgs;\n\t\t\t\t\t\t\t\tw._rawArgs = rawArgs;\n\n\t\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t\t\tCall the handler.\n\n\t\t\t\t\t\t\t\t\tNOTE: There's no catch clause here because this try/finally exists solely\n\t\t\t\t\t\t\t\t\tto ensure that the previous raw arguments string is properly restored in\n\t\t\t\t\t\t\t\t\tthe event that an uncaught exception is thrown during the handler call.\n\t\t\t\t\t\t\t\t*/\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tmacro.handler(w.output, name, args, w, payload);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tfinally {\n\t\t\t\t\t\t\t\t\tw._rawArgs = prevRawArgs;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\treturn throwError(\n\t\t\t\t\t\t\t\tw.output,\n\t\t\t\t\t\t\t\t`macro <<${name}>> handler function ${typeof macro.handler === 'undefined' ? 'does not exist' : 'is not a function'}`,\n\t\t\t\t\t\t\t\tw.source.slice(matchStart, w.nextMatch)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse if (Macro.tags.has(name)) {\n\t\t\t\t\t\tconst tags = Macro.tags.get(name);\n\t\t\t\t\t\treturn throwError(\n\t\t\t\t\t\t\tw.output,\n\t\t\t\t\t\t\t`child tag <<${name}>> was found outside of a call to its parent macro${tags.length === 1 ? '' : 's'} <<${tags.join('>>, <<')}>>`,\n\t\t\t\t\t\t\tw.source.slice(matchStart, w.nextMatch)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\treturn throwError(\n\t\t\t\t\t\t\tw.output,\n\t\t\t\t\t\t\t`macro <<${name}>> does not exist`,\n\t\t\t\t\t\t\tw.source.slice(matchStart, w.nextMatch)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (ex) {\n\t\t\t\t\treturn throwError(\n\t\t\t\t\t\tw.output,\n\t\t\t\t\t\t`cannot execute ${macro && macro.isWidget ? 'widget' : 'macro'} <<${name}>>: ${ex.message}`,\n\t\t\t\t\t\tw.source.slice(matchStart, w.nextMatch)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\tthis.working.source    = '';\n\t\t\t\t\tthis.working.name      = '';\n\t\t\t\t\tthis.working.arguments = '';\n\t\t\t\t\tthis.working.index     = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tw.outputText(w.output, w.matchStart, w.nextMatch);\n\t\t\t}\n\t\t},\n\n\t\tparseTag(w) {\n\t\t\tconst match = this.lookahead.exec(w.source);\n\n\t\t\tif (match && match.index === w.matchStart && match[1]) {\n\t\t\t\tw.nextMatch = this.lookahead.lastIndex;\n\n\t\t\t\tthis.working.source    = w.source.slice(match.index, this.lookahead.lastIndex);\n\t\t\t\tthis.working.name      = match[1];\n\t\t\t\tthis.working.arguments = match[2];\n\t\t\t\tthis.working.index     = match.index;\n\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t},\n\n\t\tparseBody(w, macro) {\n\t\t\tconst openTag  = this.working.name;\n\t\t\tconst closeTag = `/${openTag}`;\n\t\t\tconst closeAlt = `end${openTag}`;\n\t\t\tconst bodyTags = Array.isArray(macro.tags) ? macro.tags : false;\n\t\t\tconst payload  = [];\n\t\t\tlet end          = -1;\n\t\t\tlet opened       = 1;\n\t\t\tlet curSource    = this.working.source;\n\t\t\tlet curTag       = this.working.name;\n\t\t\tlet curArgument  = this.working.arguments;\n\t\t\tlet contentStart = w.nextMatch;\n\n\t\t\twhile ((w.matchStart = w.source.indexOf(this.match, w.nextMatch)) !== -1) {\n\t\t\t\tif (!this.parseTag(w)) {\n\t\t\t\t\tthis.lookahead.lastIndex = w.nextMatch = w.matchStart + this.match.length;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst tagSource = this.working.source;\n\t\t\t\tconst tagName   = this.working.name;\n\t\t\t\tconst tagArgs   = this.working.arguments;\n\t\t\t\tconst tagBegin  = this.working.index;\n\t\t\t\tconst tagEnd    = w.nextMatch;\n\t\t\t\tconst hasArgs   = tagArgs.trim() !== '';\n\n\t\t\t\tswitch (tagName) {\n\t\t\t\tcase openTag:\n\t\t\t\t\t++opened;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase closeAlt:\n\t\t\t\tcase closeTag:\n\t\t\t\t\tif (hasArgs) {\n\t\t\t\t\t\t// Skip over malformed closing tags and throw.\n\t\t\t\t\t\tw.nextMatch = tagBegin + 2 + tagName.length;\n\t\t\t\t\t\tthrow new Error(`malformed closing tag: \"${tagSource}\"`);\n\t\t\t\t\t}\n\t\t\t\t\t--opened;\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tif (hasArgs && tagName.startsWith('/')) { // tags starting with 'end' used to have same treatment\n\t\t\t\t\t\t// Skip over malformed alien closing tags.\n\t\t\t\t\t\tthis.lookahead.lastIndex = w.nextMatch = tagBegin + 2 + tagName.length;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif (opened === 1 && bodyTags) {\n\t\t\t\t\t\tfor (let i = 0, iend = bodyTags.length; i < iend; ++i) {\n\t\t\t\t\t\t\tif (tagName === bodyTags[i]) {\n\t\t\t\t\t\t\t\tpayload.push({\n\t\t\t\t\t\t\t\t\tsource    : curSource,\n\t\t\t\t\t\t\t\t\tname      : curTag,\n\t\t\t\t\t\t\t\t\targuments : curArgument,\n\t\t\t\t\t\t\t\t\targs      : this.createArgs(curArgument, this.skipArgs(macro, curTag)),\n\t\t\t\t\t\t\t\t\tcontents  : w.source.slice(contentStart, tagBegin)\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tcurSource    = tagSource;\n\t\t\t\t\t\t\t\tcurTag       = tagName;\n\t\t\t\t\t\t\t\tcurArgument  = tagArgs;\n\t\t\t\t\t\t\t\tcontentStart = tagEnd;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (opened === 0) {\n\t\t\t\t\tpayload.push({\n\t\t\t\t\t\tsource    : curSource,\n\t\t\t\t\t\tname      : curTag,\n\t\t\t\t\t\targuments : curArgument,\n\t\t\t\t\t\targs      : this.createArgs(curArgument, this.skipArgs(macro, curTag)),\n\t\t\t\t\t\tcontents  : w.source.slice(contentStart, tagBegin)\n\t\t\t\t\t});\n\t\t\t\t\tend = tagEnd;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (end !== -1) {\n\t\t\t\tw.nextMatch = end;\n\t\t\t\treturn payload;\n\t\t\t}\n\n\t\t\treturn null;\n\t\t},\n\n\t\tcreateArgs(rawArgsString, skipArgs) {\n\t\t\tconst args = skipArgs ? [] : this.parseArgs(rawArgsString);\n\n\t\t\t// Extend the args array with the raw and full argument strings.\n\t\t\tObject.defineProperties(args, {\n\t\t\t\traw : {\n\t\t\t\t\tvalue : rawArgsString\n\t\t\t\t},\n\t\t\t\tfull : {\n\t\t\t\t\tvalue : Scripting.parse(rawArgsString)\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn args;\n\t\t},\n\n\t\tskipArgs(macro, tagName) {\n\t\t\tif (typeof macro.skipArgs !== 'undefined') {\n\t\t\t\tconst sa = macro.skipArgs;\n\n\t\t\t\treturn typeof sa === 'boolean' && sa || Array.isArray(sa) && sa.includes(tagName);\n\t\t\t}\n\t\t\t/* legacy */\n\t\t\telse if (typeof macro.skipArg0 !== 'undefined') {\n\t\t\t\treturn macro.skipArg0 && macro.name === tagName;\n\t\t\t}\n\t\t\t/* /legacy */\n\n\t\t\treturn false;\n\t\t},\n\n\t\tparseArgs : (() => {\n\t\t\tconst Item = Lexer.enumFromNames([ // lex item types object (pseudo-enumeration)\n\t\t\t\t'Error',         // error\n\t\t\t\t'Bareword',      // bare identifier\n\t\t\t\t'Expression',    // expression (backquoted)\n\t\t\t\t'String',        // quoted string (single or double)\n\t\t\t\t'SquareBracket', // [[…]] or [img[…]]\n\t\t\t\t'ObjectLiteral',\n\t\t\t\t'FunctionCall'\n\t\t\t]);\n\t\t\tconst spaceRe    = new RegExp(Patterns.space);\n\t\t\tconst notSpaceRe = new RegExp(Patterns.notSpace);\n\t\t\tconst varTest    = new RegExp(`^${Patterns.variable}`);\n\n\t\t\t// Lexing functions.\n\t\t\tfunction slurpQuote(lexer, endQuote) {\n\t\t\t\tloop: for (;;) {\n\t\t\t\t\t/* eslint-disable indent */\n\t\t\t\t\tswitch (lexer.next()) {\n\t\t\t\t\tcase '\\\\':\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tconst ch = lexer.next();\n\n\t\t\t\t\t\t\tif (ch !== EOF && ch !== '\\n') {\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t/* falls through */\n\t\t\t\t\tcase EOF:\n\t\t\t\t\tcase '\\n':\n\t\t\t\t\t\treturn EOF;\n\n\t\t\t\t\tcase endQuote:\n\t\t\t\t\t\tbreak loop;\n\t\t\t\t\t}\n\t\t\t\t\t/* eslint-enable indent */\n\t\t\t\t}\n\t\t\t\treturn lexer.pos;\n\t\t\t}\n\n\t\t\tfunction genericSlurp(lexer, openChar, closeChar, initCount) {\n\t\t\t\tlet count = initCount;\n\n\t\t\t\tloop: for (;;) {\n\t\t\t\t\tconst ch = lexer.next();\n\n\t\t\t\t\tswitch (ch) {\n\t\t\t\t\tcase openChar:\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase closeChar:\n\t\t\t\t\t\tcount--;\n\n\t\t\t\t\t\tif (count === 0) {\n\t\t\t\t\t\t\tbreak loop;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase EOF:\n\t\t\t\t\tcase '\\n':\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn lexer.pos;\n\t\t\t}\n\n\t\t\tfunction lexSpace(lexer) {\n\t\t\t\tconst offset = lexer.source.slice(lexer.pos).search(notSpaceRe);\n\t\t\t\tlet remainingStr = lexer.source.slice(lexer.pos); // Capture the remaining part of the string for lookahead\n\n\t\t\t\tif (offset === EOF) {\n\t\t\t\t\t// no non-whitespace characters, so bail\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\telse if (offset !== 0) {\n\t\t\t\t\tlexer.pos += offset;\n\t\t\t\t\tlexer.ignore();\n\t\t\t\t\tremainingStr = lexer.source.slice(lexer.pos); // Update remainingStr after skipping spaces\n\t\t\t\t}\n\n\t\t\t\t// Check if the next token looks like a function call\n\t\t\t\tif (/^[a-zA-Z_$][0-9a-zA-Z_$]*\\s*\\(/.test(remainingStr)) {\n\t\t\t\t\tlexer.next(); // Advance the lexer's position to skip the first character of the function name\n\t\t\t\t\treturn lexFunctionCall;\n\t\t\t\t}\n\n\t\t\t\t// determine what the next state is\n\t\t\t\tswitch (lexer.next()) {\n\t\t\t\tcase '`':\n\t\t\t\t\treturn lexExpression;\n\t\t\t\tcase '\"':\n\t\t\t\t\treturn lexDoubleQuote;\n\t\t\t\tcase \"'\":\n\t\t\t\t\treturn lexSingleQuote;\n\t\t\t\tcase '[':\n\t\t\t\t\treturn lexSquareBracket;\n\t\t\t\tcase '{':\n\t\t\t\t\treturn lexObjectLiteral;\n\t\t\t\tdefault:\n\t\t\t\t\treturn lexBareword;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction lexExpression(lexer) {\n\t\t\t\tif (slurpQuote(lexer, '`') === EOF) {\n\t\t\t\t\treturn lexer.error(Item.Error, 'unterminated backquote expression');\n\t\t\t\t}\n\n\t\t\t\tlexer.emit(Item.Expression);\n\t\t\t\treturn lexSpace;\n\t\t\t}\n\n\t\t\tfunction lexDoubleQuote(lexer) {\n\t\t\t\tif (slurpQuote(lexer, '\"') === EOF) {\n\t\t\t\t\treturn lexer.error(Item.Error, 'unterminated double quoted string');\n\t\t\t\t}\n\n\t\t\t\tlexer.emit(Item.String);\n\t\t\t\treturn lexSpace;\n\t\t\t}\n\n\t\t\tfunction lexSingleQuote(lexer) {\n\t\t\t\tif (slurpQuote(lexer, \"'\") === EOF) {\n\t\t\t\t\treturn lexer.error(Item.Error, 'unterminated single quoted string');\n\t\t\t\t}\n\n\t\t\t\tlexer.emit(Item.String);\n\t\t\t\treturn lexSpace;\n\t\t\t}\n\n\t\t\tfunction lexSquareBracket(lexer) {\n\t\t\t\tconst imgMeta = '<>IiMmGg';\n\t\t\t\tlet what;\n\n\t\t\t\tif (lexer.accept(imgMeta)) {\n\t\t\t\t\twhat = 'image';\n\t\t\t\t\tlexer.acceptRun(imgMeta);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\twhat = 'link';\n\t\t\t\t}\n\n\t\t\t\tif (!lexer.accept('[')) {\n\t\t\t\t\treturn lexer.error(Item.Error, `malformed ${what} markup`);\n\t\t\t\t}\n\n\t\t\t\t// Initial depth is 2 to account for double brackets [[\n\t\t\t\tif (genericSlurp(lexer, '[', ']', 2) === EOF) {\n\t\t\t\t\treturn lexer.error(Item.Error, `unterminated ${what} markup`);\n\t\t\t\t}\n\n\t\t\t\tlexer.emit(Item.SquareBracket);\n\t\t\t\treturn lexSpace;\n\t\t\t}\n\n\t\t\tfunction lexObjectLiteral(lexer) {\n\t\t\t\tif (genericSlurp(lexer, '{', '}', 1) === EOF) {\n\t\t\t\t\treturn lexer.error(Item.Error, 'unterminated object literal');\n\t\t\t\t}\n\n\t\t\t\tlexer.emit(Item.ObjectLiteral);\n\t\t\t\treturn lexSpace;\n\t\t\t}\n\n\t\t\tfunction lexFunctionCall(lexer) {\n\t\t\t\tif (genericSlurp(lexer, '(', ')', 0) === EOF) {\n\t\t\t\t\treturn lexer.error(Item.Error, 'unterminated function call');\n\t\t\t\t}\n\t\t\t\tlexer.emit(Item.FunctionCall);\n\t\t\t\treturn lexSpace;\n\t\t\t}\n\n\t\t\tfunction lexBareword(lexer) {\n\t\t\t\tconst offset = lexer.source.slice(lexer.pos).search(spaceRe);\n\t\t\t\tlexer.pos = offset === EOF ? lexer.source.length : lexer.pos + offset;\n\t\t\t\tlexer.emit(Item.Bareword);\n\t\t\t\treturn offset === EOF ? null : lexSpace;\n\t\t\t}\n\n\t\t\t// Parse function.\n\t\t\tfunction parseMacroArgs(rawArgsString) {\n\t\t\t\t// Initialize the lexer.\n\t\t\t\tconst lexer = new Lexer(rawArgsString, lexSpace);\n\t\t\t\tconst args  = [];\n\n\t\t\t\t// Lex the raw argument string.\n\t\t\t\tlexer.run().forEach(item => {\n\t\t\t\t\tlet arg = item.text;\n\n\t\t\t\t\tswitch (item.type) {\n\t\t\t\t\tcase Item.Error:\n\t\t\t\t\t\tthrow new Error(`unable to parse macro argument \"${arg}\": ${item.message}`);\n\n\t\t\t\t\tcase Item.Bareword:\n\t\t\t\t\t\t// A variable, so substitute its value.\n\t\t\t\t\t\tif (varTest.test(arg)) {\n\t\t\t\t\t\t\targ = State.getVar(arg);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Property access on the settings or setup objects, so try to evaluate it.\n\t\t\t\t\t\telse if (/^(?:settings|setup)[.[]/.test(arg)) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\targ = Scripting.evalTwineScript(arg);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (ex) {\n\t\t\t\t\t\t\t\tthrow new Error(`unable to parse macro argument \"${arg}\": ${ex.message}`);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Null literal, so convert it into null.\n\t\t\t\t\t\telse if (arg === 'null') {\n\t\t\t\t\t\t\targ = null;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Undefined literal, so convert it into undefined.\n\t\t\t\t\t\telse if (arg === 'undefined') {\n\t\t\t\t\t\t\targ = undefined;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Boolean true literal, so convert it into true.\n\t\t\t\t\t\telse if (arg === 'true') {\n\t\t\t\t\t\t\targ = true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Boolean false literal, so convert it into false.\n\t\t\t\t\t\telse if (arg === 'false') {\n\t\t\t\t\t\t\targ = false;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// NaN literal, so convert it into NaN.\n\t\t\t\t\t\telse if (arg === 'NaN') {\n\t\t\t\t\t\t\targ = NaN;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Attempt to convert it into a number, in case it's a numeric literal.\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tconst argAsNum = Number(arg);\n\n\t\t\t\t\t\t\tif (!Number.isNaN(argAsNum)) {\n\t\t\t\t\t\t\t\targ = argAsNum;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase Item.Expression:\n\t\t\t\t\t\targ = arg.slice(1, -1).trim(); // remove the backquotes and trim the expression\n\n\t\t\t\t\t\t// Empty backquotes.\n\t\t\t\t\t\tif (arg === '') {\n\t\t\t\t\t\t\targ = undefined;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Evaluate the expression.\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t\t\tThe enclosing parenthesis here are necessary to force a code string\n\t\t\t\t\t\t\t\t\tconsisting solely of an object literal to be evaluated as such, rather\n\t\t\t\t\t\t\t\t\tthan as a code block.\n\t\t\t\t\t\t\t\t*/\n\t\t\t\t\t\t\t\targ = Scripting.evalTwineScript(`(${arg})`);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (ex) {\n\t\t\t\t\t\t\t\tthrow new Error(`unable to parse macro argument expression \"${arg}\": ${ex.message}`);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase Item.String:\n\t\t\t\t\t\t// Evaluate the string to handle escaped characters.\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\targ = Scripting.evalJavaScript(arg);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (ex) {\n\t\t\t\t\t\t\tthrow new Error(`unable to parse macro argument string \"${arg}\": ${ex.message}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase Item.SquareBracket:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tconst markup = Wikifier.helpers.parseSquareBracketedMarkup({\n\t\t\t\t\t\t\t\tsource     : arg,\n\t\t\t\t\t\t\t\tmatchStart : 0\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tif (markup.hasOwnProperty('error')) {\n\t\t\t\t\t\t\t\tthrow new Error(`unable to parse macro argument \"${arg}\": ${markup.error}`);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (markup.pos < arg.length) {\n\t\t\t\t\t\t\t\tthrow new Error(`unable to parse macro argument \"${arg}\": unexpected character(s) \"${arg.slice(markup.pos)}\" (pos: ${markup.pos})`);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Convert to a link or image object.\n\t\t\t\t\t\t\tif (markup.isLink) {\n\t\t\t\t\t\t\t\t// .isLink, [.text], [.forceInternal], .link, [.setter]\n\t\t\t\t\t\t\t\targ = { isLink : true };\n\t\t\t\t\t\t\t\targ.count    = markup.hasOwnProperty('text') ? 2 : 1;\n\t\t\t\t\t\t\t\targ.link     = Wikifier.helpers.evalPassageId(markup.link);\n\t\t\t\t\t\t\t\targ.text     = markup.hasOwnProperty('text') ? Wikifier.helpers.evalText(markup.text) : arg.link;\n\t\t\t\t\t\t\t\targ.external = !markup.forceInternal && Wikifier.isExternalLink(arg.link);\n\t\t\t\t\t\t\t\targ.setFn    = markup.hasOwnProperty('setter')\n\t\t\t\t\t\t\t\t\t? Wikifier.helpers.createShadowSetterCallback(Scripting.parse(markup.setter))\n\t\t\t\t\t\t\t\t\t: null;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (markup.isImage) {\n\t\t\t\t\t\t\t\t// .isImage, [.align], [.title], .source, [.forceInternal], [.link], [.setter]\n\t\t\t\t\t\t\t\targ = (source => {\n\t\t\t\t\t\t\t\t\tconst imgObj = {\n\t\t\t\t\t\t\t\t\t\tsource,\n\t\t\t\t\t\t\t\t\t\tisImage : true\n\t\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\t\t// Check for Twine 1.4 Base64 image passage transclusion.\n\t\t\t\t\t\t\t\t\tif (source.slice(0, 5) !== 'data:' && Story.has(source)) {\n\t\t\t\t\t\t\t\t\t\tconst passage = Story.get(source);\n\n\t\t\t\t\t\t\t\t\t\tif (passage.tags.includes('Twine.image')) {\n\t\t\t\t\t\t\t\t\t\t\timgObj.source  = passage.text;\n\t\t\t\t\t\t\t\t\t\t\timgObj.passage = passage.title;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\treturn imgObj;\n\t\t\t\t\t\t\t\t})(Wikifier.helpers.evalPassageId(markup.source));\n\n\t\t\t\t\t\t\t\tif (markup.hasOwnProperty('align')) {\n\t\t\t\t\t\t\t\t\targ.align = markup.align;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (markup.hasOwnProperty('text')) {\n\t\t\t\t\t\t\t\t\targ.title = Wikifier.helpers.evalText(markup.text);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (markup.hasOwnProperty('link')) {\n\t\t\t\t\t\t\t\t\targ.link     = Wikifier.helpers.evalPassageId(markup.link);\n\t\t\t\t\t\t\t\t\targ.external = !markup.forceInternal && Wikifier.isExternalLink(arg.link);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\targ.setFn = markup.hasOwnProperty('setter')\n\t\t\t\t\t\t\t\t\t? Wikifier.helpers.createShadowSetterCallback(Scripting.parse(markup.setter))\n\t\t\t\t\t\t\t\t\t: null;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Item.ObjectLiteral:\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\targ = Scripting.evalTwineScript(`(${arg})`);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (ex) {\n\t\t\t\t\t\t\tthrow new Error(`unable to parse macro argument object literal \"${arg}\": ${ex.message}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Item.FunctionCall:\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\targ = Scripting.evalTwineScript(arg);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (ex) {\n\t\t\t\t\t\t\tthrow new Error(`unable to parse macro argument \"${arg}\": ${ex.message}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\targs.push(arg);\n\t\t\t\t});\n\n\t\t\t\treturn args;\n\t\t\t}\n\n\t\t\treturn parseMacroArgs;\n\t\t})()\n\t});\n\n\n\tWikifier.Parser.add({\n\t\tname     : 'link',\n\t\tprofiles : ['core'],\n\t\tmatch    : '\\\\[\\\\[[^[]',\n\n\t\thandler(w) {\n\t\t\tconst markup = Wikifier.helpers.parseSquareBracketedMarkup(w);\n\n\t\t\tif (markup.hasOwnProperty('error')) {\n\t\t\t\tw.outputText(w.output, w.matchStart, w.nextMatch);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tw.nextMatch = markup.pos;\n\n\t\t\t// text=(text), forceInternal=(~), link=link, setter=(setter)\n\t\t\tconst link  = Wikifier.helpers.evalPassageId(markup.link);\n\t\t\tconst text  = markup.hasOwnProperty('text') ? Wikifier.helpers.evalText(markup.text) : link;\n\t\t\tconst setFn = markup.hasOwnProperty('setter')\n\t\t\t\t? Wikifier.helpers.createShadowSetterCallback(Scripting.parse(markup.setter))\n\t\t\t\t: null;\n\n\t\t\t// Debug view setup.\n\t\t\tconst output = (Config.debug\n\t\t\t\t? new DebugView(w.output, 'link-markup', '[[link]]', w.source.slice(w.matchStart, w.nextMatch))\n\t\t\t\t: w\n\t\t\t).output;\n\n\t\t\tif (markup.forceInternal || !Wikifier.isExternalLink(link)) {\n\t\t\t\tWikifier.createInternalLink(output, link, text, setFn);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tWikifier.createExternalLink(output, link, text);\n\t\t\t}\n\t\t}\n\t});\n\n\tWikifier.Parser.add({\n\t\tname     : 'urlLink',\n\t\tprofiles : ['core'],\n\t\tmatch    : Patterns.url,\n\n\t\thandler(w) {\n\t\t\tw.outputText(Wikifier.createExternalLink(w.output, w.matchText), w.matchStart, w.nextMatch);\n\t\t}\n\t});\n\n\tWikifier.Parser.add({\n\t\tname     : 'image',\n\t\tprofiles : ['core'],\n\t\tmatch    : '\\\\[[<>]?[Ii][Mm][Gg]\\\\[',\n\n\t\thandler(w) {\n\t\t\tconst markup = Wikifier.helpers.parseSquareBracketedMarkup(w);\n\n\t\t\tif (markup.hasOwnProperty('error')) {\n\t\t\t\tw.outputText(w.output, w.matchStart, w.nextMatch);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tw.nextMatch = markup.pos;\n\n\t\t\t// Debug view setup.\n\t\t\tlet debugView;\n\n\t\t\tif (Config.debug) {\n\t\t\t\tdebugView = new DebugView(\n\t\t\t\t\tw.output,\n\t\t\t\t\t'image-markup',\n\t\t\t\t\tmarkup.hasOwnProperty('link') ? '[img[][link]]' : '[img[]]',\n\t\t\t\t\tw.source.slice(w.matchStart, w.nextMatch)\n\t\t\t\t);\n\t\t\t\tdebugView.modes({ block : true });\n\t\t\t}\n\n\t\t\t// align=(left|right), title=(title), source=source, forceInternal=(~), link=(link), setter=(setter)\n\t\t\tconst setFn = markup.hasOwnProperty('setter')\n\t\t\t\t? Wikifier.helpers.createShadowSetterCallback(Scripting.parse(markup.setter))\n\t\t\t\t: null;\n\t\t\tlet el     = (Config.debug ? debugView : w).output;\n\t\t\tlet source;\n\n\t\t\tif (markup.hasOwnProperty('link')) {\n\t\t\t\tconst link = Wikifier.helpers.evalPassageId(markup.link);\n\n\t\t\t\tif (markup.forceInternal || !Wikifier.isExternalLink(link)) {\n\t\t\t\t\tel = Wikifier.createInternalLink(el, link, null, setFn);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tel = Wikifier.createExternalLink(el, link);\n\t\t\t\t}\n\n\t\t\t\tel.classList.add('link-image');\n\t\t\t}\n\n\t\t\tel = jQuery(document.createElement('img'))\n\t\t\t\t.appendTo(el)\n\t\t\t\t.get(0);\n\t\t\tsource = Wikifier.helpers.evalPassageId(markup.source);\n\n\t\t\t// Check for image passage transclusion.\n\t\t\tif (source.slice(0, 5) !== 'data:' && Story.has(source)) {\n\t\t\t\tconst passage = Story.get(source);\n\n\t\t\t\tif (passage.tags.includes('Twine.image')) {\n\t\t\t\t\tel.setAttribute('data-passage', passage.title);\n\t\t\t\t\tsource = passage.text.trim();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tel.src = source;\n\n\t\t\tif (markup.hasOwnProperty('text')) {\n\t\t\t\tel.title = Wikifier.helpers.evalText(markup.text);\n\t\t\t}\n\n\t\t\tif (markup.hasOwnProperty('align')) {\n\t\t\t\tel.align = markup.align;\n\t\t\t}\n\t\t}\n\t});\n\n\tWikifier.Parser.add({\n\t\tname      : 'monospacedByBlock',\n\t\tprofiles  : ['block'],\n\t\tmatch     : '^\\\\{\\\\{\\\\{\\\\n',\n\t\tlookahead : /^\\{\\{\\{\\n((?:^[^\\n]*\\n)+?)(^\\}\\}\\}$\\n?)/gm,\n\n\t\thandler(w) {\n\t\t\tthis.lookahead.lastIndex = w.matchStart;\n\n\t\t\tconst match = this.lookahead.exec(w.source);\n\n\t\t\tif (match && match.index === w.matchStart) {\n\t\t\t\tconst pre = jQuery(document.createElement('pre'));\n\t\t\t\tjQuery(document.createElement('code'))\n\t\t\t\t\t.text(match[1])\n\t\t\t\t\t.appendTo(pre);\n\t\t\t\tpre.appendTo(w.output);\n\t\t\t\tw.nextMatch = this.lookahead.lastIndex;\n\t\t\t}\n\t\t}\n\t});\n\n\tWikifier.Parser.add({\n\t\tname     : 'formatByChar',\n\t\tprofiles : ['core'],\n\t\tmatch    : \"''|//|__|\\\\^\\\\^|~~|==|\\\\{\\\\{\\\\{\",\n\n\t\thandler(w) {\n\t\t\tswitch (w.matchText) {\n\t\t\tcase \"''\":\n\t\t\t\tw.subWikify(jQuery(document.createElement('strong')).appendTo(w.output).get(0), \"''\");\n\t\t\t\tbreak;\n\n\t\t\tcase '//':\n\t\t\t\tw.subWikify(jQuery(document.createElement('em')).appendTo(w.output).get(0), '//');\n\t\t\t\tbreak;\n\n\t\t\tcase '__':\n\t\t\t\tw.subWikify(jQuery(document.createElement('u')).appendTo(w.output).get(0), '__');\n\t\t\t\tbreak;\n\n\t\t\tcase '^^':\n\t\t\t\tw.subWikify(jQuery(document.createElement('sup')).appendTo(w.output).get(0), '\\\\^\\\\^');\n\t\t\t\tbreak;\n\n\t\t\tcase '~~':\n\t\t\t\tw.subWikify(jQuery(document.createElement('sub')).appendTo(w.output).get(0), '~~');\n\t\t\t\tbreak;\n\n\t\t\tcase '==':\n\t\t\t\tw.subWikify(jQuery(document.createElement('s')).appendTo(w.output).get(0), '==');\n\t\t\t\tbreak;\n\n\t\t\tcase '{{{':\n\t\t\t\t{\n\t\t\t\t\tconst lookahead = /\\{\\{\\{((?:.|\\n)*?)\\}\\}\\}/gm;\n\n\t\t\t\t\tlookahead.lastIndex = w.matchStart;\n\n\t\t\t\t\tconst match = lookahead.exec(w.source);\n\n\t\t\t\t\tif (match && match.index === w.matchStart) {\n\t\t\t\t\t\tjQuery(document.createElement('code'))\n\t\t\t\t\t\t\t.text(match[1])\n\t\t\t\t\t\t\t.appendTo(w.output);\n\t\t\t\t\t\tw.nextMatch = lookahead.lastIndex;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t});\n\n\tWikifier.Parser.add({\n\t\tname       : 'customStyle',\n\t\tprofiles   : ['core'],\n\t\tmatch      : '@@',\n\t\tterminator : '@@',\n\t\tblockRe    : /\\s*\\n/gm,\n\n\t\thandler(w) {\n\t\t\tconst css = Wikifier.helpers.inlineCss(w);\n\n\t\t\tthis.blockRe.lastIndex = w.nextMatch; // must follow the call to `inlineCss()`\n\n\t\t\tconst blockMatch = this.blockRe.exec(w.source);\n\t\t\tconst blockLevel = blockMatch && blockMatch.index === w.nextMatch;\n\t\t\tconst $el        = jQuery(document.createElement(blockLevel ? 'div' : 'span'))\n\t\t\t\t.appendTo(w.output);\n\n\t\t\tif (css.classes.length === 0 && css.id === '' && Object.keys(css.styles).length === 0) {\n\t\t\t\t$el.addClass('marked');\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcss.classes.forEach(className => $el.addClass(className));\n\n\t\t\t\tif (css.id !== '') {\n\t\t\t\t\t$el.attr('id', css.id);\n\t\t\t\t}\n\n\t\t\t\t$el.css(css.styles);\n\t\t\t}\n\n\t\t\tif (blockLevel) {\n\t\t\t\t// Skip the leading and, if it exists, trailing newlines.\n\t\t\t\tw.nextMatch += blockMatch[0].length;\n\t\t\t\tw.subWikify($el[0], `\\\\n?${this.terminator}`);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tw.subWikify($el[0], this.terminator);\n\t\t\t}\n\t\t}\n\t});\n\n\tWikifier.Parser.add({\n\t\tname      : 'verbatimText',\n\t\tprofiles  : ['core'],\n\t\tmatch     : '\"{3}|<[Nn][Oo][Ww][Ii][Kk][Ii]>',\n\t\tlookahead : /(?:\"{3}((?:.|\\n)*?)\"{3})|(?:<[Nn][Oo][Ww][Ii][Kk][Ii]>((?:.|\\n)*?)<\\/[Nn][Oo][Ww][Ii][Kk][Ii]>)/gm,\n\n\t\thandler(w) {\n\t\t\tthis.lookahead.lastIndex = w.matchStart;\n\n\t\t\tconst match = this.lookahead.exec(w.source);\n\n\t\t\tif (match && match.index === w.matchStart) {\n\t\t\t\tw.nextMatch = this.lookahead.lastIndex;\n\n\t\t\t\tjQuery(document.createElement('span'))\n\t\t\t\t\t.addClass('verbatim')\n\t\t\t\t\t.text(match[1] || match[2])\n\t\t\t\t\t.appendTo(w.output);\n\t\t\t}\n\t\t}\n\t});\n\n\tWikifier.Parser.add({\n\t\tname     : 'horizontalRule',\n\t\tprofiles : ['core'],\n\t\tmatch    : '^----+$\\\\n?|<[Hh][Rr]\\\\s*/?>\\\\n?',\n\n\t\thandler(w) {\n\t\t\tjQuery(document.createElement('hr')).appendTo(w.output);\n\t\t}\n\t});\n\n\tWikifier.Parser.add({\n\t\tname     : 'emdash',\n\t\tprofiles : ['core'],\n\t\tmatch    : '--',\n\n\t\thandler(w) {\n\t\t\tjQuery(document.createTextNode('\\u2014')).appendTo(w.output);\n\t\t}\n\t});\n\n\tWikifier.Parser.add({\n\t\tname     : 'doubleDollarSign',\n\t\tprofiles : ['core'],\n\t\tmatch    : '\\\\${2}', // eslint-disable-line no-template-curly-in-string\n\n\t\thandler(w) {\n\t\t\tjQuery(document.createTextNode('$')).appendTo(w.output);\n\t\t}\n\t});\n\n\tWikifier.Parser.add({\n\t\t/*\n\t\t\tSupported syntax:\n\t\t\t\t$variable\n\t\t\t\t$variable.property\n\t\t\t\t$variable[numericIndex]\n\t\t\t\t$variable[\"property\"]\n\t\t\t\t$variable['property']\n\t\t\t\t$variable[$indexOrPropertyVariable]\n\n\t\t\tNOTE: I really do not like how the initial bit of the regexp matches.\n\t\t*/\n\t\tname     : 'nakedVariable',\n\t\tprofiles : ['core'],\n\t\tmatch    : `${Patterns.variable}(?:(?:\\\\.${Patterns.identifier})|(?:\\\\[\\\\d+\\\\])|(?:\\\\[\"(?:\\\\\\\\.|[^\"\\\\\\\\])+\"\\\\])|(?:\\\\['(?:\\\\\\\\.|[^'\\\\\\\\])+'\\\\])|(?:\\\\[${Patterns.variable}\\\\]))*`,\n\n\t\thandler(w) {\n\t\t\tconst result = State.getVar(w.matchText);\n\n\t\t\tif (result == null) { // lazy equality for null\n\t\t\t\tjQuery(document.createTextNode(w.matchText)).appendTo(w.output);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tnew Wikifier(\n\t\t\t\t\t(Config.debug\n\t\t\t\t\t\t? new DebugView(w.output, 'variable', w.matchText, w.matchText) // Debug view setup.\n\t\t\t\t\t\t: w\n\t\t\t\t\t).output,\n\t\t\t\t\tstringFrom(result)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t});\n\n\tWikifier.Parser.add({\n\t\tname     : 'template',\n\t\tprofiles : ['core'],\n\t\tmatch    : `\\\\?${Patterns.templateName}`,\n\n\t\thandler(w) {\n\t\t\tconst name = w.matchText.slice(1);\n\t\t\tlet template = Template.get(name);\n\t\t\tlet result   = null;\n\n\t\t\t// If we have an array of templates, randomly choose one.\n\t\t\tif (template instanceof Array) {\n\t\t\t\ttemplate = template.random();\n\t\t\t}\n\n\t\t\tswitch (typeof template) {\n\t\t\tcase 'function':\n\t\t\t\ttry {\n\t\t\t\t\tresult = stringFrom(template.call({ name }));\n\t\t\t\t}\n\t\t\t\tcatch (ex) {\n\t\t\t\t\treturn throwError(\n\t\t\t\t\t\tw.output,\n\t\t\t\t\t\t`cannot execute function template ?${name}: ${ex.message}`,\n\t\t\t\t\t\tw.source.slice(w.matchStart, w.nextMatch)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'string':\n\t\t\t\tresult = template;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (result === null) {\n\t\t\t\tjQuery(document.createTextNode(w.matchText)).appendTo(w.output);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tnew Wikifier(\n\t\t\t\t\t(Config.debug\n\t\t\t\t\t\t? new DebugView(w.output, 'template', w.matchText, w.matchText) // Debug view setup.\n\t\t\t\t\t\t: w\n\t\t\t\t\t).output,\n\t\t\t\t\tresult\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t});\n\n\tWikifier.Parser.add({\n\t\tname       : 'heading',\n\t\tprofiles   : ['block'],\n\t\tmatch      : '^!{1,6}',\n\t\tterminator : '\\\\n',\n\n\t\thandler(w) {\n\t\t\tif (!Wikifier.helpers.hasBlockContext(w.output.childNodes)) {\n\t\t\t\tjQuery(w.output).append(document.createTextNode(w.matchText));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tw.subWikify(\n\t\t\t\tjQuery(document.createElement(`h${w.matchLength}`)).appendTo(w.output).get(0),\n\t\t\t\tthis.terminator\n\t\t\t);\n\t\t}\n\t});\n\n\tWikifier.Parser.add({\n\t\tname           : 'table',\n\t\tprofiles       : ['block'],\n\t\tmatch          : '^\\\\|(?:[^\\\\n]*)\\\\|(?:[fhck]?)$',\n\t\tlookahead      : /^\\|([^\\n]*)\\|([fhck]?)$/gm,\n\t\trowTerminator  : '\\\\|(?:[cfhk]?)$\\\\n?',\n\t\tcellPattern    : '(?:\\\\|([^\\\\n\\\\|]*)\\\\|)|(\\\\|[cfhk]?$\\\\n?)',\n\t\tcellTerminator : '(?:\\\\u0020*)\\\\|',\n\t\trowTypes       : { c : 'caption', f : 'tfoot', h : 'thead', '' : 'tbody' }, // eslint-disable-line id-length\n\n\t\thandler(w) {\n\t\t\tif (!Wikifier.helpers.hasBlockContext(w.output.childNodes)) {\n\t\t\t\tjQuery(w.output).append(document.createTextNode(w.matchText));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst table       = jQuery(document.createElement('table')).appendTo(w.output).get(0);\n\t\t\tconst prevColumns = [];\n\t\t\tlet curRowType    = null;\n\t\t\tlet $rowContainer = null;\n\t\t\tlet rowCount      = 0;\n\t\t\tlet matched;\n\n\t\t\tw.nextMatch = w.matchStart;\n\n\t\t\tdo {\n\t\t\t\tthis.lookahead.lastIndex = w.nextMatch;\n\n\t\t\t\tconst match = this.lookahead.exec(w.source);\n\n\t\t\t\tmatched = match && match.index === w.nextMatch;\n\n\t\t\t\tif (matched) {\n\t\t\t\t\tconst nextRowType = match[2];\n\n\t\t\t\t\tif (nextRowType === 'k') {\n\t\t\t\t\t\ttable.className = match[1];\n\t\t\t\t\t\tw.nextMatch += match[0].length + 1;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tif (nextRowType !== curRowType) {\n\t\t\t\t\t\t\tcurRowType = nextRowType;\n\t\t\t\t\t\t\t$rowContainer = jQuery(document.createElement(this.rowTypes[nextRowType]))\n\t\t\t\t\t\t\t\t.appendTo(table);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (curRowType === 'c') {\n\t\t\t\t\t\t\t$rowContainer.css('caption-side', rowCount === 0 ? 'top' : 'bottom');\n\t\t\t\t\t\t\tw.nextMatch += 1;\n\t\t\t\t\t\t\tw.subWikify($rowContainer[0], this.rowTerminator);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tthis.rowHandler(\n\t\t\t\t\t\t\t\tw,\n\t\t\t\t\t\t\t\tjQuery(document.createElement('tr'))\n\t\t\t\t\t\t\t\t\t.appendTo($rowContainer)\n\t\t\t\t\t\t\t\t\t.get(0),\n\t\t\t\t\t\t\t\tprevColumns\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t++rowCount;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} while (matched);\n\t\t},\n\n\t\trowHandler(w, rowEl, prevColumns) {\n\t\t\tconst cellRe = new RegExp(this.cellPattern, 'gm');\n\t\t\tlet col         = 0;\n\t\t\tlet curColCount = 1;\n\t\t\tlet matched;\n\n\t\t\tdo {\n\t\t\t\tcellRe.lastIndex = w.nextMatch;\n\n\t\t\t\tconst cellMatch = cellRe.exec(w.source);\n\n\t\t\t\tmatched = cellMatch && cellMatch.index === w.nextMatch;\n\n\t\t\t\tif (matched) {\n\t\t\t\t\tif (cellMatch[1] === '~') {\n\t\t\t\t\t\tconst last = prevColumns[col];\n\n\t\t\t\t\t\tif (last) {\n\t\t\t\t\t\t\t++last.rowCount;\n\t\t\t\t\t\t\tlast.$element\n\t\t\t\t\t\t\t\t.attr('rowspan', last.rowCount)\n\t\t\t\t\t\t\t\t.css('vertical-align', 'middle');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tw.nextMatch = cellMatch.index + cellMatch[0].length - 1;\n\t\t\t\t\t}\n\t\t\t\t\telse if (cellMatch[1] === '>') {\n\t\t\t\t\t\t++curColCount;\n\t\t\t\t\t\tw.nextMatch = cellMatch.index + cellMatch[0].length - 1;\n\t\t\t\t\t}\n\t\t\t\t\telse if (cellMatch[2]) {\n\t\t\t\t\t\tw.nextMatch = cellMatch.index + cellMatch[0].length;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t++w.nextMatch;\n\n\t\t\t\t\t\tconst css = Wikifier.helpers.inlineCss(w);\n\t\t\t\t\t\tlet spaceLeft  = false;\n\t\t\t\t\t\tlet spaceRight = false;\n\t\t\t\t\t\tlet $cell;\n\n\t\t\t\t\t\twhile (w.source.substr(w.nextMatch, 1) === ' ') {\n\t\t\t\t\t\t\tspaceLeft = true;\n\t\t\t\t\t\t\t++w.nextMatch;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (w.source.substr(w.nextMatch, 1) === '!') {\n\t\t\t\t\t\t\t$cell = jQuery(document.createElement('th')).appendTo(rowEl);\n\t\t\t\t\t\t\t++w.nextMatch;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t$cell = jQuery(document.createElement('td')).appendTo(rowEl);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tprevColumns[col] = {\n\t\t\t\t\t\t\trowCount : 1,\n\t\t\t\t\t\t\t$element : $cell\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tif (curColCount > 1) {\n\t\t\t\t\t\t\t$cell.attr('colspan', curColCount);\n\t\t\t\t\t\t\tcurColCount = 1;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tw.subWikify($cell[0], this.cellTerminator);\n\n\t\t\t\t\t\tif (w.matchText.substr(w.matchText.length - 2, 1) === ' ') {\n\t\t\t\t\t\t\tspaceRight = true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcss.classes.forEach(className => $cell.addClass(className));\n\n\t\t\t\t\t\tif (css.id !== '') {\n\t\t\t\t\t\t\t$cell.attr('id', css.id);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (spaceLeft && spaceRight) {\n\t\t\t\t\t\t\tcss.styles['text-align'] = 'center';\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (spaceLeft) {\n\t\t\t\t\t\t\tcss.styles['text-align'] = 'right';\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (spaceRight) {\n\t\t\t\t\t\t\tcss.styles['text-align'] = 'left';\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$cell.css(css.styles);\n\n\t\t\t\t\t\tw.nextMatch = w.nextMatch - 1;\n\t\t\t\t\t}\n\n\t\t\t\t\t++col;\n\t\t\t\t}\n\t\t\t} while (matched);\n\t\t}\n\t});\n\n\tWikifier.Parser.add({\n\t\tname       : 'list',\n\t\tprofiles   : ['block'],\n\t\tmatch      : '^(?:(?:\\\\*+)|(?:#+))',\n\t\tlookahead  : /^(?:(\\*+)|(#+))/gm,\n\t\tterminator : '\\\\n',\n\n\t\thandler(w) {\n\t\t\tif (!Wikifier.helpers.hasBlockContext(w.output.childNodes)) {\n\t\t\t\tjQuery(w.output).append(document.createTextNode(w.matchText));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tw.nextMatch = w.matchStart;\n\n\t\t\tconst destStack = [w.output];\n\t\t\tlet curType  = null;\n\t\t\tlet curLevel = 0;\n\t\t\tlet matched;\n\t\t\tlet i;\n\n\t\t\tdo {\n\t\t\t\tthis.lookahead.lastIndex = w.nextMatch;\n\n\t\t\t\tconst match = this.lookahead.exec(w.source);\n\n\t\t\t\tmatched = match && match.index === w.nextMatch;\n\n\t\t\t\tif (matched) {\n\t\t\t\t\tconst newType  = match[2] ? 'ol' : 'ul';\n\t\t\t\t\tconst newLevel = match[0].length;\n\n\t\t\t\t\tw.nextMatch += match[0].length;\n\n\t\t\t\t\tif (newLevel > curLevel) {\n\t\t\t\t\t\tfor (i = curLevel; i < newLevel; ++i) {\n\t\t\t\t\t\t\tdestStack.push(\n\t\t\t\t\t\t\t\tjQuery(document.createElement(newType))\n\t\t\t\t\t\t\t\t\t.appendTo(destStack[destStack.length - 1])\n\t\t\t\t\t\t\t\t\t.get(0)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse if (newLevel < curLevel) {\n\t\t\t\t\t\tfor (i = curLevel; i > newLevel; --i) {\n\t\t\t\t\t\t\tdestStack.pop();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse if (newLevel === curLevel && newType !== curType) {\n\t\t\t\t\t\tdestStack.pop();\n\t\t\t\t\t\tdestStack.push(\n\t\t\t\t\t\t\tjQuery(document.createElement(newType))\n\t\t\t\t\t\t\t\t.appendTo(destStack[destStack.length - 1])\n\t\t\t\t\t\t\t\t.get(0)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tcurLevel = newLevel;\n\t\t\t\t\tcurType = newType;\n\t\t\t\t\tw.subWikify(\n\t\t\t\t\t\tjQuery(document.createElement('li'))\n\t\t\t\t\t\t\t.appendTo(destStack[destStack.length - 1])\n\t\t\t\t\t\t\t.get(0),\n\t\t\t\t\t\tthis.terminator\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} while (matched);\n\t\t}\n\t});\n\n\tWikifier.Parser.add({\n\t\tname      : 'commentByBlock',\n\t\tprofiles  : ['core'],\n\t\tmatch     : '(?:/(?:%|\\\\*))|(?:<!--)',\n\t\tlookahead : /(?:\\/(%|\\*)(?:(?:.|\\n)*?)\\1\\/)|(?:<!--(?:(?:.|\\n)*?)-->)/gm,\n\n\t\thandler(w) {\n\t\t\tthis.lookahead.lastIndex = w.matchStart;\n\n\t\t\tconst match = this.lookahead.exec(w.source);\n\n\t\t\tif (match && match.index === w.matchStart) {\n\t\t\t\tw.nextMatch = this.lookahead.lastIndex;\n\t\t\t}\n\t\t}\n\t});\n\n\tWikifier.Parser.add({\n\t\tname     : 'lineContinuation',\n\t\tprofiles : ['core'],\n\n\t\t// WARNING: The ordering here is important: end-of-line, start-of-line, end-of-string, start-of-string.\n\t\tmatch : `\\\\\\\\${Patterns.spaceNoTerminator}*\\\\n|\\\\n${Patterns.spaceNoTerminator}*\\\\\\\\|\\\\n?\\\\\\\\${Patterns.spaceNoTerminator}*$|^${Patterns.spaceNoTerminator}*\\\\\\\\\\\\n?`,\n\n\t\thandler(w) {\n\t\t\tw.nextMatch = w.matchStart + w.matchLength;\n\t\t}\n\t});\n\n\tWikifier.Parser.add({\n\t\tname     : 'lineBreak',\n\t\tprofiles : ['core'],\n\t\tmatch    : '\\\\n|<[Bb][Rr]\\\\s*/?>',\n\n\t\thandler(w) {\n\t\t\tif (!w.options.nobr) {\n\t\t\t\tjQuery(document.createElement('br')).appendTo(w.output);\n\t\t\t}\n\t\t}\n\t});\n\n\tWikifier.Parser.add({\n\t\tname     : 'htmlCharacterReference',\n\t\tprofiles : ['core'],\n\t\tmatch    : '(?:(?:&#?[0-9A-Za-z]{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]));)+|&#?[0-9A-Za-z]{2,8};)',\n\n\t\thandler(w) {\n\t\t\tjQuery(document.createDocumentFragment())\n\t\t\t\t.append(w.matchText)\n\t\t\t\t.appendTo(w.output);\n\t\t}\n\t});\n\n\tWikifier.Parser.add({\n\t\tname     : 'xmlProlog',\n\t\tprofiles : ['core'],\n\t\tmatch    : '<\\\\?[Xx][Mm][Ll][^>]*\\\\?>',\n\n\t\thandler(w) {\n\t\t\tw.nextMatch = w.matchStart + w.matchLength;\n\t\t}\n\t});\n\n\tWikifier.Parser.add({\n\t\tname      : 'verbatimHtml',\n\t\tprofiles  : ['core'],\n\t\tmatch     : '<[Hh][Tt][Mm][Ll]>',\n\t\tlookahead : /<[Hh][Tt][Mm][Ll]>((?:.|\\n)*?)<\\/[Hh][Tt][Mm][Ll]>/gm,\n\t\thandler   : _verbatimTagHandler\n\t});\n\n\tWikifier.Parser.add({\n\t\tname      : 'verbatimScriptTag',\n\t\tprofiles  : ['core'],\n\t\tmatch     : '<[Ss][Cc][Rr][Ii][Pp][Tt][^>]*>',\n\t\tlookahead : /(<[Ss][Cc][Rr][Ii][Pp][Tt]*>(?:.|\\n)*?<\\/[Ss][Cc][Rr][Ii][Pp][Tt]>)/gm,\n\t\thandler   : _verbatimTagHandler\n\t});\n\n\tWikifier.Parser.add({\n\t\tname           : 'styleTag',\n\t\tprofiles       : ['core'],\n\t\tmatch          : '<[Ss][Tt][Yy][Ll][Ee][^>]*>',\n\t\tlookahead      : /(<[Ss][Tt][Yy][Ll][Ee]*>)((?:.|\\n)*?)(<\\/[Ss][Tt][Yy][Ll][Ee]>)/gm,\n\t\timageMarkup    : new RegExp(Patterns.cssImage, 'g'),\n\t\thasImageMarkup : new RegExp(Patterns.cssImage),\n\n\t\thandler(w) {\n\t\t\tthis.lookahead.lastIndex = w.matchStart;\n\n\t\t\tconst match = this.lookahead.exec(w.source);\n\n\t\t\tif (match && match.index === w.matchStart) {\n\t\t\t\tw.nextMatch = this.lookahead.lastIndex;\n\n\t\t\t\tlet css = match[2];\n\n\t\t\t\t// Check for wiki image transclusion.\n\t\t\t\tif (this.hasImageMarkup.test(css)) {\n\t\t\t\t\tthis.imageMarkup.lastIndex = 0;\n\n\t\t\t\t\tcss = css.replace(this.imageMarkup, wikiImage => {\n\t\t\t\t\t\tconst markup = Wikifier.helpers.parseSquareBracketedMarkup({\n\t\t\t\t\t\t\tsource     : wikiImage,\n\t\t\t\t\t\t\tmatchStart : 0\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tif (markup.hasOwnProperty('error') || markup.pos < wikiImage.length) {\n\t\t\t\t\t\t\treturn wikiImage;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet source = markup.source;\n\n\t\t\t\t\t\t// Handle image passage transclusion.\n\t\t\t\t\t\tif (source.slice(0, 5) !== 'data:' && Story.has(source)) {\n\t\t\t\t\t\t\tconst passage = Story.get(source);\n\n\t\t\t\t\t\t\tif (passage.tags.includes('Twine.image')) {\n\t\t\t\t\t\t\t\tsource = passage.text;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t\tThe source may be URI- or Base64-encoded, so we cannot use `encodeURIComponent()`\n\t\t\t\t\t\t\there.  Instead, we simply encode any double quotes, since the URI will be\n\t\t\t\t\t\t\tdelimited by them.\n\t\t\t\t\t\t*/\n\t\t\t\t\t\treturn `url(\"${source.replace(/\"/g, '%22')}\")`;\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tjQuery(document.createDocumentFragment())\n\t\t\t\t\t.append(match[1] + css + match[3])\n\t\t\t\t\t.appendTo(w.output);\n\t\t\t}\n\t\t}\n\t});\n\n\tWikifier.Parser.add({\n\t\tname      : 'svgTag',\n\t\tprofiles  : ['core'],\n\t\tmatch     : '<[Ss][Vv][Gg][^>]*>',\n\t\tlookahead : /<(\\/?)[Ss][Vv][Gg][^>]*>/gm,\n\t\tnamespace : 'http://www.w3.org/2000/svg',\n\n\t\thandler(w) {\n\t\t\tthis.lookahead.lastIndex = w.nextMatch;\n\n\t\t\tlet depth = 1;\n\t\t\tlet match;\n\n\t\t\twhile (depth > 0 && (match = this.lookahead.exec(w.source)) !== null) {\n\t\t\t\tdepth += match[1] === '/' ? -1 : 1;\n\t\t\t}\n\n\t\t\tif (depth === 0) {\n\t\t\t\tw.nextMatch = this.lookahead.lastIndex;\n\n\t\t\t\tconst svgTag = w.source.slice(w.matchStart, this.lookahead.lastIndex);\n\t\t\t\tconst $frag  = jQuery(document.createDocumentFragment()).append(svgTag);\n\n\t\t\t\t// Postprocess the relevant SVG element nodes.\n\t\t\t\t$frag.find('a[data-passage],image[data-passage]').each((_, el) => {\n\t\t\t\t\tconst tagName = el.tagName.toLowerCase();\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.processAttributeDirectives(el);\n\t\t\t\t\t}\n\t\t\t\t\tcatch (ex) {\n\t\t\t\t\t\treturn throwError(\n\t\t\t\t\t\t\tw.output,\n\t\t\t\t\t\t\t`svg|<${tagName}>: ${ex.message}`,\n\t\t\t\t\t\t\t`${w.matchText}\\u2026`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (el.hasAttribute('data-passage')) {\n\t\t\t\t\t\tthis.processDataAttributes(el, tagName);\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t$frag.appendTo(w.output);\n\t\t\t}\n\t\t},\n\n\t\tprocessAttributeDirectives(el) {\n\t\t\t// NOTE: The `.attributes` property yields a live collection, so we\n\t\t\t// must make a non-live copy of it as we will be adding and removing\n\t\t\t// members of said collection if any directives are found.\n\t\t\t[...el.attributes].forEach(({ name, value }) => {\n\t\t\t\tconst evalShorthand = name[0] === '@';\n\n\t\t\t\tif (evalShorthand || name.startsWith('sc-eval:')) {\n\t\t\t\t\tconst newName = name.slice(evalShorthand ? 1 : 8); // Remove eval directive prefix.\n\n\t\t\t\t\tif (newName === 'data-setter') {\n\t\t\t\t\t\tthrow new Error(`evaluation directive is not allowed on the data-setter attribute: \"${name}\"`);\n\t\t\t\t\t}\n\n\t\t\t\t\tlet result;\n\n\t\t\t\t\t// Evaluate the value as TwineScript.\n\t\t\t\t\ttry {\n\t\t\t\t\t\tresult = Scripting.evalTwineScript(value);\n\t\t\t\t\t}\n\t\t\t\t\tcatch (ex) {\n\t\t\t\t\t\tthrow new Error(`bad evaluation from attribute directive \"${name}\": ${ex.message}`);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Assign the result to the new attribute and remove the old one.\n\t\t\t\t\ttry {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t\tNOTE: Most browsers (ca. Nov 2017) have broken `setAttribute()`\n\t\t\t\t\t\t\tmethod implementations that throw on attribute names that start\n\t\t\t\t\t\t\twith, or contain, various symbols that are completely valid per\n\t\t\t\t\t\t\tthe specification.  Thus this code could fail if the user chooses\n\t\t\t\t\t\t\tattribute names that, after removing the directive prefix, are\n\t\t\t\t\t\t\tunpalatable to `setAttribute()`.\n\t\t\t\t\t\t*/\n\t\t\t\t\t\tel.setAttribute(newName, result);\n\t\t\t\t\t\tel.removeAttribute(name);\n\t\t\t\t\t}\n\t\t\t\t\tcatch (ex) {\n\t\t\t\t\t\tthrow new Error(`cannot transform attribute directive \"${name}\" into attribute \"${newName}\"`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\n\t\tprocessDataAttributes(el, tagName) {\n\t\t\tlet passage = el.getAttribute('data-passage');\n\n\t\t\tif (passage == null) { // lazy equality for null\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst evaluated = Wikifier.helpers.evalPassageId(passage);\n\n\t\t\tif (evaluated !== passage) {\n\t\t\t\tpassage = evaluated;\n\t\t\t\tel.setAttribute('data-passage', evaluated);\n\t\t\t}\n\n\t\t\tif (passage !== '') {\n\t\t\t\t// '<image>' element, so attempt media passage transclusion.\n\t\t\t\tif (tagName === 'image') {\n\t\t\t\t\tif (passage.slice(0, 5) !== 'data:' && Story.has(passage)) {\n\t\t\t\t\t\tpassage = Story.get(passage);\n\n\t\t\t\t\t\tif (passage.tags.includes('Twine.image')) {\n\t\t\t\t\t\t\t// NOTE: SVG `.href` IDL attribute is read-only,\n\t\t\t\t\t\t\t// so set its `href` content attribute instead.\n\t\t\t\t\t\t\tel.setAttribute('href', passage.text.trim());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Elsewise, assume a link element of some type—e.g., '<a>'.\n\t\t\t\telse {\n\t\t\t\t\tlet setter = el.getAttribute('data-setter');\n\t\t\t\t\tlet setFn;\n\n\t\t\t\t\tif (setter != null) { // lazy equality for null\n\t\t\t\t\t\tsetter = String(setter).trim();\n\n\t\t\t\t\t\tif (setter !== '') {\n\t\t\t\t\t\t\tsetFn = Wikifier.helpers.createShadowSetterCallback(Scripting.parse(setter));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (Story.has(passage)) {\n\t\t\t\t\t\tel.classList.add('link-internal');\n\n\t\t\t\t\t\tif (Config.addVisitedLinkClass && State.hasPlayed(passage)) {\n\t\t\t\t\t\t\tel.classList.add('link-visited');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tel.classList.add('link-broken');\n\t\t\t\t\t}\n\n\t\t\t\t\tjQuery(el).ariaClick({ one : true }, function () {\n\t\t\t\t\t\tif (typeof setFn === 'function') {\n\t\t\t\t\t\t\tsetFn.call(this);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tEngine.play(passage);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\tWikifier.Parser.add({\n\t\t/*\n\t\t\tNOTE: This parser MUST come after any parser which handles HTML tag-\n\t\t\tlike constructs—e.g. 'verbatimText', 'horizontalRule', 'lineBreak',\n\t\t\t'xmlProlog', 'verbatimHtml', 'verbatimSvgTag', 'verbatimScriptTag',\n\t\t\tand 'styleTag'.\n\t\t*/\n\t\tname      : 'htmlTag',\n\t\tprofiles  : ['core'],\n\t\tmatch     : `<${Patterns.htmlTagName}(?:\\\\s+[^\\\\u0000-\\\\u001F\\\\u007F-\\\\u009F\\\\s\"'>\\\\/=]+(?:\\\\s*=\\\\s*(?:\"[^\"]*?\"|'[^']*?'|[^\\\\s\"'=<>\\`]+))?)*\\\\s*\\\\/?>`,\n\t\ttagRe     : new RegExp(`^<(${Patterns.htmlTagName})`),\n\t\tmediaTags : ['audio', 'img', 'source', 'track', 'video'], // NOTE: The `<picture>` element should not be in this list.\n\t\tnobrTags  : ['audio', 'colgroup', 'datalist', 'dl', 'figure', 'meter', 'ol', 'optgroup', 'picture', 'progress', 'ruby', 'select', 'table', 'tbody', 'tfoot', 'thead', 'tr', 'ul', 'video'],\n\t\tvoidTags  : ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'],\n\n\t\thandler(w) {\n\t\t\tconst tagMatch = this.tagRe.exec(w.matchText);\n\t\t\tconst tag      = tagMatch && tagMatch[1];\n\t\t\tconst tagName  = tag && tag.toLowerCase();\n\n\t\t\tif (tagName) {\n\t\t\t\tconst isVoid = this.voidTags.includes(tagName) || w.matchText.endsWith('/>');\n\t\t\t\tconst isNobr = this.nobrTags.includes(tagName);\n\t\t\t\tlet terminator;\n\t\t\t\tlet terminatorMatch;\n\n\t\t\t\tif (!isVoid) {\n\t\t\t\t\tterminator = `<\\\\/${tagName}\\\\s*>`;\n\n\t\t\t\t\tconst terminatorRe = new RegExp(terminator, 'gim'); // ignore case during match\n\n\t\t\t\t\tterminatorRe.lastIndex = w.matchStart;\n\t\t\t\t\tterminatorMatch = terminatorRe.exec(w.source);\n\t\t\t\t}\n\n\t\t\t\tif (isVoid || terminatorMatch) {\n\t\t\t\t\tlet output    = w.output;\n\t\t\t\t\tlet el        = document.createElement(w.output.tagName);\n\t\t\t\t\tlet debugView;\n\n\t\t\t\t\tel.innerHTML = w.matchText;\n\n\t\t\t\t\t/*\n\t\t\t\t\t\tNOTE: The use of a `while` statement here is curious, however,\n\t\t\t\t\t\tI'm hesitant to change it for fear of breaking some edge case.\n\t\t\t\t\t*/\n\t\t\t\t\twhile (el.firstChild) {\n\t\t\t\t\t\tel = el.firstChild;\n\t\t\t\t\t}\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.processAttributeDirectives(el);\n\t\t\t\t\t}\n\t\t\t\t\tcatch (ex) {\n\t\t\t\t\t\treturn throwError(\n\t\t\t\t\t\t\tw.output,\n\t\t\t\t\t\t\t`<${tagName}>: ${ex.message}`,\n\t\t\t\t\t\t\t`${w.matchText}\\u2026`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (el.hasAttribute('data-passage')) {\n\t\t\t\t\t\tthis.processDataAttributes(el, tagName);\n\n\t\t\t\t\t\t// Debug view setup.\n\t\t\t\t\t\tif (Config.debug) {\n\t\t\t\t\t\t\tdebugView = new DebugView(\n\t\t\t\t\t\t\t\tw.output,\n\t\t\t\t\t\t\t\t`html-${tagName}`,\n\t\t\t\t\t\t\t\ttagName,\n\t\t\t\t\t\t\t\tw.matchText\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tdebugView.modes({\n\t\t\t\t\t\t\t\tblock   : tagName === 'img',\n\t\t\t\t\t\t\t\tnonvoid : terminatorMatch\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\toutput = debugView.output;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (terminatorMatch) {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t\tNOTE: There's no catch clause here because this try/finally exists\n\t\t\t\t\t\t\tsolely to ensure that the options stack is properly restored in\n\t\t\t\t\t\t\tthe event that an uncaught exception is thrown during the call to\n\t\t\t\t\t\t\t`subWikify()`.\n\t\t\t\t\t\t*/\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tWikifier.Option.push({ nobr : isNobr });\n\t\t\t\t\t\t\tw.subWikify(el, terminator, { ignoreTerminatorCase : true });\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfinally {\n\t\t\t\t\t\t\tWikifier.Option.pop();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t\tDebug view modification.  If the current element has any debug\n\t\t\t\t\t\t\tview descendants who have \"block\" mode set, then set its debug\n\t\t\t\t\t\t\tview to the same.  It just makes things look a bit nicer.\n\t\t\t\t\t\t*/\n\t\t\t\t\t\tif (debugView && jQuery(el).find('.debug.block').length > 0) {\n\t\t\t\t\t\t\tdebugView.modes({ block : true });\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t/*\n\t\t\t\t\t\tNOTE: The use of `cloneNode(true)` here for `<track>` elements\n\t\t\t\t\t\tis necessary to workaround a poorly understood rehoming issue.\n\t\t\t\t\t*/\n\t\t\t\t\toutput.appendChild(tagName === 'track' ? el.cloneNode(true) : el);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\treturn throwError(\n\t\t\t\t\t\tw.output,\n\t\t\t\t\t\t`cannot find a closing tag for HTML <${tag}>`,\n\t\t\t\t\t\t`${w.matchText}\\u2026`\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\tprocessAttributeDirectives(el) {\n\t\t\t// NOTE: The `.attributes` property yields a live collection, so we\n\t\t\t// must make a non-live copy of it as we will be adding and removing\n\t\t\t// members of said collection if any directives are found.\n\t\t\t[...el.attributes].forEach(({ name, value }) => {\n\t\t\t\tconst evalShorthand = name[0] === '@';\n\n\t\t\t\tif (evalShorthand || name.startsWith('sc-eval:')) {\n\t\t\t\t\tconst newName = name.slice(evalShorthand ? 1 : 8); // Remove eval directive prefix.\n\n\t\t\t\t\tif (newName === 'data-setter') {\n\t\t\t\t\t\tthrow new Error(`evaluation directive is not allowed on the data-setter attribute: \"${name}\"`);\n\t\t\t\t\t}\n\n\t\t\t\t\tlet result;\n\n\t\t\t\t\t// Evaluate the value as TwineScript.\n\t\t\t\t\ttry {\n\t\t\t\t\t\tresult = Scripting.evalTwineScript(value);\n\t\t\t\t\t}\n\t\t\t\t\tcatch (ex) {\n\t\t\t\t\t\tthrow new Error(`bad evaluation from attribute directive \"${name}\": ${ex.message}`);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Assign the result to the new attribute and remove the old one.\n\t\t\t\t\ttry {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t\tNOTE: Most browsers (ca. Nov 2017) have broken `setAttribute()`\n\t\t\t\t\t\t\tmethod implementations that throw on attribute names that start\n\t\t\t\t\t\t\twith, or contain, various symbols that are completely valid per\n\t\t\t\t\t\t\tthe specification.  Thus this code could fail if the user chooses\n\t\t\t\t\t\t\tattribute names that, after removing the directive prefix, are\n\t\t\t\t\t\t\tunpalatable to `setAttribute()`.\n\t\t\t\t\t\t*/\n\t\t\t\t\t\tel.setAttribute(newName, result);\n\t\t\t\t\t\tel.removeAttribute(name);\n\t\t\t\t\t}\n\t\t\t\t\tcatch (ex) {\n\t\t\t\t\t\tthrow new Error(`cannot transform attribute directive \"${name}\" into attribute \"${newName}\"`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\n\t\tprocessDataAttributes(el, tagName) {\n\t\t\tlet passage = el.getAttribute('data-passage');\n\n\t\t\tif (passage == null) { // lazy equality for null\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst evaluated = Wikifier.helpers.evalPassageId(passage);\n\n\t\t\tif (evaluated !== passage) {\n\t\t\t\tpassage = evaluated;\n\t\t\t\tel.setAttribute('data-passage', evaluated);\n\t\t\t}\n\n\t\t\tif (passage !== '') {\n\t\t\t\t// Media element, so attempt media passage transclusion.\n\t\t\t\tif (this.mediaTags.includes(tagName)) {\n\t\t\t\t\tif (passage.slice(0, 5) !== 'data:' && Story.has(passage)) {\n\t\t\t\t\t\tpassage = Story.get(passage);\n\n\t\t\t\t\t\tlet parentName;\n\t\t\t\t\t\tlet twineTag;\n\n\t\t\t\t\t\tswitch (tagName) {\n\t\t\t\t\t\tcase 'audio':\n\t\t\t\t\t\tcase 'video':\n\t\t\t\t\t\t\ttwineTag = `Twine.${tagName}`;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'img':\n\t\t\t\t\t\t\ttwineTag = 'Twine.image';\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'track':\n\t\t\t\t\t\t\ttwineTag = 'Twine.vtt';\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'source':\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tconst $parent = $(el).closest('audio,picture,video');\n\n\t\t\t\t\t\t\t\tif ($parent.length) {\n\t\t\t\t\t\t\t\t\tparentName = $parent.get(0).tagName.toLowerCase();\n\t\t\t\t\t\t\t\t\ttwineTag = `Twine.${parentName === 'picture' ? 'image' : parentName}`;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (passage.tags.includes(twineTag)) {\n\t\t\t\t\t\t\tel[parentName === 'picture' ? 'srcset' : 'src'] = passage.text.trim();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Elsewise, assume a link element of some type—e.g., '<a>', '<area>', '<button>', etc.\n\t\t\t\telse {\n\t\t\t\t\tlet setter = el.getAttribute('data-setter');\n\t\t\t\t\tlet setFn;\n\n\t\t\t\t\tif (setter != null) { // lazy equality for null\n\t\t\t\t\t\tsetter = String(setter).trim();\n\n\t\t\t\t\t\tif (setter !== '') {\n\t\t\t\t\t\t\tsetFn = Wikifier.helpers.createShadowSetterCallback(Scripting.parse(setter));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (Story.has(passage)) {\n\t\t\t\t\t\tel.classList.add('link-internal');\n\n\t\t\t\t\t\tif (Config.addVisitedLinkClass && State.hasPlayed(passage)) {\n\t\t\t\t\t\t\tel.classList.add('link-visited');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tel.classList.add('link-broken');\n\t\t\t\t\t}\n\n\t\t\t\t\tjQuery(el).ariaClick({ one : true }, function () {\n\t\t\t\t\t\tif (typeof setFn === 'function') {\n\t\t\t\t\t\t\tsetFn.call(this);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tEngine.play(passage);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n})();\n\n/***********************************************************************************************************************\n\n\tmarkup/template.js\n\n\tCopyright © 2019–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/* global Patterns */\n\nvar Template = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\t// Template definitions.\n\tconst _templates = new Map();\n\n\t// Valid template name regular expression.\n\tconst _validNameRe = new RegExp(`^(?:${Patterns.templateName})$`);\n\n\t// Valid template type predicate.\n\tconst _validType = template => {\n\t\tconst templateType = typeof template;\n\t\treturn templateType === 'function' || templateType === 'string';\n\t};\n\n\n\t/*******************************************************************************\n\t\tTemplate Functions.\n\t*******************************************************************************/\n\n\tfunction templateAdd(name, template) {\n\t\tif (\n\t\t\t   !_validType(template)\n\t\t\t&& !(template instanceof Array && template.length > 0 && template.every(_validType))\n\t\t) {\n\t\t\tthrow new TypeError(`invalid template type (${name}); templates must be: functions, strings, or an array of either`);\n\t\t}\n\n\t\t(name instanceof Array ? name : [name]).forEach(name => {\n\t\t\tif (!_validNameRe.test(name)) {\n\t\t\t\tthrow new Error(`invalid template name \"${name}\"`);\n\t\t\t}\n\t\t\tif (_templates.has(name)) {\n\t\t\t\tthrow new Error(`cannot clobber existing template ?${name}`);\n\t\t\t}\n\n\t\t\t_templates.set(name, template);\n\t\t});\n\t}\n\n\tfunction templateDelete(name) {\n\t\t(name instanceof Array ? name : [name]).forEach(name => _templates.delete(name));\n\t}\n\n\tfunction templateGet(name) {\n\t\treturn _templates.has(name) ? _templates.get(name) : null;\n\t}\n\n\tfunction templateHas(name) {\n\t\treturn _templates.has(name);\n\t}\n\n\tfunction templateSize() {\n\t\treturn _templates.size;\n\t}\n\n\n\t/*******************************************************************************\n\t\tObject Exports.\n\t*******************************************************************************/\n\n\treturn Object.freeze(Object.defineProperties({}, {\n\t\tadd    : { value : templateAdd },\n\t\tdelete : { value : templateDelete },\n\t\tget    : { value : templateGet },\n\t\thas    : { value : templateHas },\n\t\tsize   : { get : templateSize }\n\t}));\n})();\n\n/***********************************************************************************************************************\n\n\tmacros/macro.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/* global Patterns, Scripting, macros */\n\nvar Macro = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\t// Macro definitions.\n\tconst _macros = {};\n\n\t// Map of all macro tags and their parents (key: 'tag name' => value: ['list of parent names']).\n\tconst _tags = {};\n\n\t// Valid macro name regular expression.\n\tconst _validNameRe = new RegExp(`^(?:${Patterns.macroName})$`);\n\n\n\t/*******************************************************************************************************************\n\t\tMacros Functions.\n\t*******************************************************************************************************************/\n\tfunction macrosAdd(name, def) {\n\t\tif (Array.isArray(name)) {\n\t\t\tname.forEach(name => macrosAdd(name, def));\n\t\t\treturn;\n\t\t}\n\n\t\tif (!_validNameRe.test(name)) {\n\t\t\tthrow new Error(`invalid macro name \"${name}\"`);\n\t\t}\n\n\t\tif (macrosHas(name)) {\n\t\t\tthrow new Error(`cannot clobber existing macro <<${name}>>`);\n\t\t}\n\t\telse if (tagsHas(name)) {\n\t\t\tthrow new Error(`cannot clobber child tag <<${name}>> of parent macro${_tags[name].length === 1 ? '' : 's'} <<${_tags[name].join('>>, <<')}>>`);\n\t\t}\n\n\t\ttry {\n\t\t\tif (typeof def === 'object') {\n\t\t\t\t// Add the macro definition.\n\t\t\t\t//\n\t\t\t\t// NOTE: Since `macrosGet()` may return legacy macros, we add the `_MACRO_API`\n\t\t\t\t// flag to (modern) API macros, so that the macro formatter will know how to\n\t\t\t\t// call the macro.  This should be removed in v3.\n\t\t\t\t_macros[name] = Object.assign(Object.create(null), def, { _MACRO_API : true });\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// Add the macro alias.\n\t\t\t\tif (macrosHas(def)) {\n\t\t\t\t\t_macros[name] = Object.create(_macros[def], {\n\t\t\t\t\t\t_ALIAS_OF : {\n\t\t\t\t\t\t\tenumerable : true,\n\t\t\t\t\t\t\tvalue      : def\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthrow new Error(`cannot create alias of nonexistent macro <<${def}>>`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tObject.defineProperty(_macros, name, { writable : false });\n\t\t}\n\t\tcatch (ex) {\n\t\t\tif (ex.name === 'TypeError') {\n\t\t\t\tthrow new Error(`cannot clobber protected macro <<${name}>>`);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new Error(`unknown error when attempting to add macro <<${name}>>: [${ex.name}] ${ex.message}`);\n\t\t\t}\n\t\t}\n\n\t\t// Tags post-processing.\n\t\tif (typeof _macros[name].tags !== 'undefined') {\n\t\t\tif (_macros[name].tags == null) { // lazy equality for null\n\t\t\t\ttagsRegister(name);\n\t\t\t}\n\t\t\telse if (Array.isArray(_macros[name].tags)) {\n\t\t\t\ttagsRegister(name, _macros[name].tags);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new Error(`bad value for \"tags\" property of macro <<${name}>>`);\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction macrosDelete(name) {\n\t\tif (Array.isArray(name)) {\n\t\t\tname.forEach(name => macrosDelete(name));\n\t\t\treturn;\n\t\t}\n\n\t\tif (macrosHas(name)) {\n\t\t\t// Tags pre-processing.\n\t\t\tif (typeof _macros[name].tags !== 'undefined') {\n\t\t\t\ttagsUnregister(name);\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\t// Remove the macro definition.\n\t\t\t\tObject.defineProperty(_macros, name, { writable : true });\n\t\t\t\tdelete _macros[name];\n\t\t\t}\n\t\t\tcatch (ex) {\n\t\t\t\tthrow new Error(`unknown error removing macro <<${name}>>: ${ex.message}`);\n\t\t\t}\n\t\t}\n\t\telse if (tagsHas(name)) {\n\t\t\tthrow new Error(`cannot remove child tag <<${name}>> of parent macro <<${_tags[name]}>>`);\n\t\t}\n\t}\n\n\tfunction macrosIsEmpty() {\n\t\treturn Object.keys(_macros).length === 0;\n\t}\n\n\tfunction macrosHas(name) {\n\t\treturn _macros.hasOwnProperty(name);\n\t}\n\n\tfunction macrosGet(name) {\n\t\tlet macro = null;\n\n\t\tif (macrosHas(name) && typeof _macros[name].handler === 'function') {\n\t\t\tmacro = _macros[name];\n\t\t}\n\t\t/* legacy macro support */\n\t\telse if (macros.hasOwnProperty(name) && typeof macros[name].handler === 'function') {\n\t\t\tmacro = macros[name];\n\t\t}\n\t\t/* /legacy macro support */\n\n\t\treturn macro;\n\t}\n\n\tfunction macrosInit(handler = 'init') { // eslint-disable-line no-unused-vars\n\t\tObject.keys(_macros).forEach(name => {\n\t\t\tif (typeof _macros[name][handler] === 'function') {\n\t\t\t\t_macros[name][handler](name);\n\t\t\t}\n\t\t});\n\n\t\t/* legacy macro support */\n\t\tObject.keys(macros).forEach(name => {\n\t\t\tif (typeof macros[name][handler] === 'function') {\n\t\t\t\tmacros[name][handler](name);\n\t\t\t}\n\t\t});\n\t\t/* /legacy macro support */\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tTags Functions.\n\t*******************************************************************************************************************/\n\tfunction tagsRegister(parent, bodyTags) {\n\t\tif (!parent) {\n\t\t\tthrow new Error('no parent specified');\n\t\t}\n\n\t\tconst endTags = [`/${parent}`, `end${parent}`]; // automatically create the closing tags\n\t\tconst allTags = [].concat(endTags, Array.isArray(bodyTags) ? bodyTags : []);\n\n\t\tfor (let i = 0; i < allTags.length; ++i) {\n\t\t\tconst tag = allTags[i];\n\n\t\t\tif (macrosHas(tag)) {\n\t\t\t\tthrow new Error('cannot register tag for an existing macro');\n\t\t\t}\n\n\t\t\tif (tagsHas(tag)) {\n\t\t\t\tif (!_tags[tag].includes(parent)) {\n\t\t\t\t\t_tags[tag].push(parent);\n\t\t\t\t\t_tags[tag].sort();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\t_tags[tag] = [parent];\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction tagsUnregister(parent) {\n\t\tif (!parent) {\n\t\t\tthrow new Error('no parent specified');\n\t\t}\n\n\t\tObject.keys(_tags).forEach(tag => {\n\t\t\tconst i = _tags[tag].indexOf(parent);\n\n\t\t\tif (i !== -1) {\n\t\t\t\tif (_tags[tag].length === 1) {\n\t\t\t\t\tdelete _tags[tag];\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t_tags[tag].splice(i, 1);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tfunction tagsHas(name) {\n\t\treturn _tags.hasOwnProperty(name);\n\t}\n\n\tfunction tagsGet(name) {\n\t\treturn tagsHas(name) ? _tags[name] : null;\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************************************************/\n\treturn Object.freeze(Object.defineProperties({}, {\n\t\t/*\n\t\t\tMacro Functions.\n\t\t*/\n\t\tadd     : { value : macrosAdd },\n\t\tdelete  : { value : macrosDelete },\n\t\tisEmpty : { value : macrosIsEmpty },\n\t\thas     : { value : macrosHas },\n\t\tget     : { value : macrosGet },\n\t\tinit    : { value : macrosInit },\n\n\t\t/*\n\t\t\tTags Functions.\n\t\t*/\n\t\ttags : {\n\t\t\tvalue : Object.freeze(Object.defineProperties({}, {\n\t\t\t\tregister   : { value : tagsRegister },\n\t\t\t\tunregister : { value : tagsUnregister },\n\t\t\t\thas        : { value : tagsHas },\n\t\t\t\tget        : { value : tagsGet }\n\t\t\t}))\n\t\t},\n\n\t\t/*\n\t\t\tLegacy Aliases.\n\t\t*/\n\t\tevalStatements : { value : (...args) => Scripting.evalJavaScript(...args) } // SEE: `markup/scripting.js`.\n\t}));\n})();\n\n/***********************************************************************************************************************\n\n\tmacros/macrocontext.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/* global Config, DebugView, Patterns, State, Wikifier, throwError */\n\nvar MacroContext = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\t/*******************************************************************************************************************\n\t\tMacroContext Class.\n\t*******************************************************************************************************************/\n\tclass MacroContext {\n\t\tconstructor(contextData) {\n\t\t\tconst context = Object.assign({\n\t\t\t\tparent      : null,\n\t\t\t\tmacro       : null,\n\t\t\t\tname        : '',\n\t\t\t\tdisplayName : '',\n\t\t\t\targs        : null,\n\t\t\t\tpayload     : null,\n\t\t\t\tparser      : null,\n\t\t\t\tsource      : ''\n\t\t\t}, contextData);\n\n\t\t\tif (context.macro === null || context.name === '' || context.parser === null) {\n\t\t\t\tthrow new TypeError('context object missing required properties');\n\t\t\t}\n\n\t\t\tObject.defineProperties(this, {\n\t\t\t\tself : {\n\t\t\t\t\tvalue : context.macro\n\t\t\t\t},\n\n\t\t\t\tname : {\n\t\t\t\t\tvalue : typeof context.macro._ALIAS_OF === 'undefined' ? context.name : context.macro._ALIAS_OF\n\t\t\t\t},\n\n\t\t\t\tdisplayName : {\n\t\t\t\t\tvalue : context.name\n\t\t\t\t},\n\n\t\t\t\targs : {\n\t\t\t\t\tvalue : context.args\n\t\t\t\t},\n\n\t\t\t\tpayload : {\n\t\t\t\t\tvalue : context.payload\n\t\t\t\t},\n\n\t\t\t\tsource : {\n\t\t\t\t\tvalue : context.source\n\t\t\t\t},\n\n\t\t\t\tparent : {\n\t\t\t\t\tvalue : context.parent\n\t\t\t\t},\n\n\t\t\t\tparser : {\n\t\t\t\t\tvalue : context.parser\n\t\t\t\t},\n\n\t\t\t\t_output : {\n\t\t\t\t\tvalue : context.parser.output\n\t\t\t\t},\n\n\t\t\t\t_shadows : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : null\n\t\t\t\t},\n\n\t\t\t\t_debugView : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : null\n\t\t\t\t},\n\n\t\t\t\t_debugViewEnabled : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : Config.debug\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tget output() {\n\t\t\treturn this._debugViewEnabled ? this.debugView.output : this._output;\n\t\t}\n\n\t\tget shadows() {\n\t\t\treturn [...this._shadows];\n\t\t}\n\n\t\tget shadowView() {\n\t\t\tconst view = new Set();\n\t\t\tthis.contextSelectAll(ctx => ctx._shadows)\n\t\t\t\t.forEach(ctx => ctx._shadows.forEach(name => view.add(name)));\n\t\t\treturn [...view];\n\t\t}\n\n\t\tget debugView() {\n\t\t\tif (this._debugViewEnabled) {\n\t\t\t\treturn this._debugView !== null ? this._debugView : this.createDebugView();\n\t\t\t}\n\n\t\t\treturn null;\n\t\t}\n\n\t\tcontextHas(filter) {\n\t\t\tlet context = this;\n\n\t\t\twhile ((context = context.parent) !== null) {\n\t\t\t\tif (filter(context)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\t\tcontextSelect(filter) {\n\t\t\tlet context = this;\n\n\t\t\twhile ((context = context.parent) !== null) {\n\t\t\t\tif (filter(context)) {\n\t\t\t\t\treturn context;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn null;\n\t\t}\n\n\t\tcontextSelectAll(filter) {\n\t\t\tconst result = [];\n\t\t\tlet context = this;\n\n\t\t\twhile ((context = context.parent) !== null) {\n\t\t\t\tif (filter(context)) {\n\t\t\t\t\tresult.push(context);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\n\t\taddShadow(...names) {\n\t\t\tif (!this._shadows) {\n\t\t\t\tthis._shadows = new Set();\n\t\t\t}\n\n\t\t\tconst varRe = new RegExp(`^${Patterns.variable}$`);\n\n\t\t\tnames\n\t\t\t\t.flat(Infinity)\n\t\t\t\t.forEach(name => {\n\t\t\t\t\tif (typeof name !== 'string') {\n\t\t\t\t\t\tthrow new TypeError(`variable name must be a string; type: ${typeof name}`);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!varRe.test(name)) {\n\t\t\t\t\t\tthrow new Error(`invalid variable name \"${name}\"`);\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._shadows.add(name);\n\t\t\t\t});\n\t\t}\n\n\t\tcreateShadowWrapper(callback, doneCallback, startCallback) {\n\t\t\tconst shadowContext = this;\n\t\t\tlet shadowStore;\n\n\t\t\tif (typeof callback === 'function') {\n\t\t\t\tshadowStore = {};\n\t\t\t\tthis.shadowView.forEach(varName => {\n\t\t\t\t\tconst varKey = varName.slice(1);\n\t\t\t\t\tconst store  = varName[0] === '$' ? State.variables : State.temporary;\n\t\t\t\t\tshadowStore[varName] = store[varKey];\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn function (...args) {\n\t\t\t\tif (typeof startCallback === 'function') {\n\t\t\t\t\tstartCallback.apply(this, args);\n\t\t\t\t}\n\n\t\t\t\tif (typeof callback === 'function') {\n\t\t\t\t\tconst shadowNames = Object.keys(shadowStore);\n\t\t\t\t\tconst valueCache  = shadowNames.length > 0 ? {} : null;\n\t\t\t\t\tconst macroParser = Wikifier.Parser.get('macro');\n\t\t\t\t\tlet contextCache;\n\n\t\t\t\t\t/*\n\t\t\t\t\t\tThere's no catch clause because this try/finally is here simply to ensure that\n\t\t\t\t\t\tproper cleanup is done in the event that an exception is thrown during the\n\t\t\t\t\t\tcallback.\n\t\t\t\t\t*/\n\t\t\t\t\ttry {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t\tCache the existing values of the variables to be shadowed and assign the\n\t\t\t\t\t\t\tshadow values.\n\t\t\t\t\t\t*/\n\t\t\t\t\t\tshadowNames.forEach(varName => {\n\t\t\t\t\t\t\tconst varKey = varName.slice(1);\n\t\t\t\t\t\t\tconst store  = varName[0] === '$' ? State.variables : State.temporary;\n\n\t\t\t\t\t\t\tif (store.hasOwnProperty(varKey)) {\n\t\t\t\t\t\t\t\tvalueCache[varKey] = store[varKey];\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tstore[varKey] = shadowStore[varName];\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\t// Cache the existing macro execution context and assign the shadow context.\n\t\t\t\t\t\tcontextCache = macroParser.context;\n\t\t\t\t\t\tmacroParser.context = shadowContext;\n\n\t\t\t\t\t\t// Call the callback function.\n\t\t\t\t\t\tcallback.apply(this, args);\n\t\t\t\t\t}\n\t\t\t\t\tfinally {\n\t\t\t\t\t\t// Revert the macro execution context shadowing.\n\t\t\t\t\t\tif (contextCache !== undefined) {\n\t\t\t\t\t\t\tmacroParser.context = contextCache;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Revert the variable shadowing.\n\t\t\t\t\t\tshadowNames.forEach(varName => {\n\t\t\t\t\t\t\tconst varKey = varName.slice(1);\n\t\t\t\t\t\t\tconst store  = varName[0] === '$' ? State.variables : State.temporary;\n\n\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t\tUpdate the shadow store with the variable's current value, in case it\n\t\t\t\t\t\t\t\twas modified during the callback.\n\t\t\t\t\t\t\t*/\n\t\t\t\t\t\t\tshadowStore[varName] = store[varKey];\n\n\t\t\t\t\t\t\tif (valueCache.hasOwnProperty(varKey)) {\n\t\t\t\t\t\t\t\tstore[varKey] = valueCache[varKey];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tdelete store[varKey];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (typeof doneCallback === 'function') {\n\t\t\t\t\tdoneCallback.apply(this, args);\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\tcreateDebugView(name, title) {\n\t\t\tthis._debugView = new DebugView(\n\t\t\t\tthis._output,\n\t\t\t\t'macro',\n\t\t\t\tname ? name : this.displayName,\n\t\t\t\ttitle ? title : this.source\n\t\t\t);\n\n\t\t\tif (this.payload !== null && this.payload.length > 0) {\n\t\t\t\tthis._debugView.modes({ nonvoid : true });\n\t\t\t}\n\n\t\t\tthis._debugViewEnabled = true;\n\t\t\treturn this._debugView;\n\t\t}\n\n\t\tremoveDebugView() {\n\t\t\tif (this._debugView !== null) {\n\t\t\t\tthis._debugView.remove();\n\t\t\t\tthis._debugView = null;\n\t\t\t}\n\n\t\t\tthis._debugViewEnabled = false;\n\t\t}\n\n\t\terror(message, source, stack) {\n\t\t\treturn throwError(this._output, `<<${this.displayName}>>: ${message}`, source ? source : this.source, stack);\n\t\t}\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************************************************/\n\treturn MacroContext;\n})();\n\n/***********************************************************************************************************************\n\n\tmacros/macrolib.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/*\n\tglobal Config, DebugView, Engine, Has, L10n, Macro, NodeTyper, Patterns, Scripting, SimpleAudio, State,\n\t       Story, TempState, Util, Wikifier, postdisplay, prehistory, storage, stringFrom\n*/\n\n(() => {\n\t'use strict';\n\n\t/*******************************************************************************************************************\n\t\tVariables Macros.\n\t*******************************************************************************************************************/\n\t/*\n\t\t<<capture>>\n\t*/\n\tMacro.add('capture', {\n\t\tskipArgs : true,\n\t\ttags     : null,\n\t\ttsVarRe  : new RegExp(`(${Patterns.variable})`,'g'),\n\n\t\thandler() {\n\t\t\tif (this.args.raw.length === 0) {\n\t\t\t\treturn this.error('no story/temporary variable list specified');\n\t\t\t}\n\n\t\t\tconst valueCache = {};\n\n\t\t\t/*\n\t\t\t\tThere's no catch clause because this try/finally is here simply to ensure that\n\t\t\t\tproper cleanup is done in the event that an exception is thrown during the\n\t\t\t\t`Wikifier` call.\n\t\t\t*/\n\t\t\ttry {\n\t\t\t\tconst tsVarRe = this.self.tsVarRe;\n\t\t\t\tlet match;\n\n\t\t\t\t/*\n\t\t\t\t\tCache the existing values of the variables and add a shadow.\n\t\t\t\t*/\n\t\t\t\twhile ((match = tsVarRe.exec(this.args.raw)) !== null) {\n\t\t\t\t\tconst varName = match[1];\n\t\t\t\t\tconst varKey  = varName.slice(1);\n\t\t\t\t\tconst store   = varName[0] === '$' ? State.variables : State.temporary;\n\n\t\t\t\t\tif (store.hasOwnProperty(varKey)) {\n\t\t\t\t\t\tvalueCache[varKey] = store[varKey];\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.addShadow(varName);\n\t\t\t\t}\n\n\t\t\t\tnew Wikifier(this.output, this.payload[0].contents);\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\t// Revert the variable shadowing.\n\t\t\t\tthis.shadows.forEach(varName => {\n\t\t\t\t\tconst varKey = varName.slice(1);\n\t\t\t\t\tconst store  = varName[0] === '$' ? State.variables : State.temporary;\n\n\t\t\t\t\tif (valueCache.hasOwnProperty(varKey)) {\n\t\t\t\t\t\tstore[varKey] = valueCache[varKey];\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tdelete store[varKey];\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t});\n\n\t/*\n\t\t<<set>>\n\t*/\n\tMacro.add('set', {\n\t\tskipArgs : true,\n\n\t\thandler() {\n\t\t\tif (this.args.full.length === 0) {\n\t\t\t\treturn this.error('no expression specified');\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tScripting.evalJavaScript(this.args.full);\n\t\t\t}\n\t\t\tcatch (ex) {\n\t\t\t\treturn this.error(`bad evaluation: ${typeof ex === 'object' ? `${ex.name}: ${ex.message}` : ex}`, null, ex.stack);\n\t\t\t}\n\n\t\t\t// Custom debug view setup.\n\t\t\tif (Config.debug) {\n\t\t\t\tthis.debugView.modes({ hidden : true });\n\t\t\t}\n\t\t}\n\t});\n\n\t/*\n\t\t<<unset>>\n\t*/\n\tMacro.add('unset', {\n\t\tskipArgs : true,\n\n\t\thandler() {\n\t\t\tif (this.args.full.length === 0) {\n\t\t\t\treturn this.error('no story/temporary variable list specified');\n\t\t\t}\n\n\t\t\tconst searchRe  = /[,;\\s]*((?:State\\.(?:variables|temporary)|setup)\\.)/g;\n\t\t\tconst replacer  = (_, p1) => `; delete ${p1}`;\n\t\t\tconst cleanupRe = /^; /;\n\n\t\t\ttry {\n\t\t\t\tconst unsetExp = this.args.full.replace(searchRe, replacer).replace(cleanupRe, '');\n\n\t\t\t\tScripting.evalJavaScript(unsetExp);\n\t\t\t}\n\t\t\tcatch (ex) {\n\t\t\t\treturn this.error(`bad evaluation: ${getErrorMessage(ex)}`);\n\t\t\t}\n\n\t\t\t// Custom debug view setup.\n\t\t\tif (Config.debug) {\n\t\t\t\tthis.debugView.modes({ hidden : true });\n\t\t\t}\n\t\t}\n\t});\n\n\t/*\n\t\t<<remember>>\n\t*/\n\tMacro.add('remember', {\n\t\tskipArgs : true,\n\t\tjsVarRe  : new RegExp(`State\\\\.variables\\\\.(${Patterns.identifier})`, 'g'),\n\n\t\thandler() {\n\t\t\tif (this.args.full.length === 0) {\n\t\t\t\treturn this.error('no expression specified');\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tScripting.evalJavaScript(this.args.full);\n\t\t\t}\n\t\t\tcatch (ex) {\n\t\t\t\treturn this.error(`bad evaluation: ${typeof ex === 'object' ? ex.message : ex}`);\n\t\t\t}\n\n\t\t\tconst remember = storage.get('remember') || {};\n\t\t\tconst jsVarRe  = this.self.jsVarRe;\n\t\t\tlet match;\n\n\t\t\twhile ((match = jsVarRe.exec(this.args.full)) !== null) {\n\t\t\t\tconst name = match[1];\n\t\t\t\tremember[name] = State.variables[name];\n\t\t\t}\n\n\t\t\tif (!storage.set('remember', remember)) {\n\t\t\t\treturn this.error(`unknown error, cannot remember: ${this.args.raw}`);\n\t\t\t}\n\n\t\t\t// Custom debug view setup.\n\t\t\tif (Config.debug) {\n\t\t\t\tthis.debugView.modes({ hidden : true });\n\t\t\t}\n\t\t},\n\n\t\tinit() {\n\t\t\tconst remember = storage.get('remember');\n\n\t\t\tif (remember) {\n\t\t\t\tObject.keys(remember).forEach(name => State.variables[name] = remember[name]);\n\t\t\t}\n\t\t}\n\t});\n\n\t/*\n\t\t<<forget>>\n\t*/\n\tMacro.add('forget', {\n\t\tskipArgs : true,\n\t\tjsVarRe  : new RegExp(`State\\\\.variables\\\\.(${Patterns.identifier})`, 'g'),\n\n\t\thandler() {\n\t\t\tif (this.args.full.length === 0) {\n\t\t\t\treturn this.error('no story variable list specified');\n\t\t\t}\n\n\t\t\tconst remember = storage.get('remember');\n\t\t\tconst jsVarRe  = this.self.jsVarRe;\n\t\t\tlet match;\n\t\t\tlet needStore = false;\n\n\t\t\twhile ((match = jsVarRe.exec(this.args.full)) !== null) {\n\t\t\t\tconst name = match[1];\n\n\t\t\t\tif (State.variables.hasOwnProperty(name)) {\n\t\t\t\t\tdelete State.variables[name];\n\t\t\t\t}\n\n\t\t\t\tif (remember && remember.hasOwnProperty(name)) {\n\t\t\t\t\tneedStore = true;\n\t\t\t\t\tdelete remember[name];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (needStore) {\n\t\t\t\tif (Object.keys(remember).length === 0) {\n\t\t\t\t\tif (!storage.delete('remember')) {\n\t\t\t\t\t\treturn this.error('unknown error, cannot update remember store');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (!storage.set('remember', remember)) {\n\t\t\t\t\treturn this.error('unknown error, cannot update remember store');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Custom debug view setup.\n\t\t\tif (Config.debug) {\n\t\t\t\tthis.debugView.modes({ hidden : true });\n\t\t\t}\n\t\t}\n\t});\n\n\n\t/*******************************************************************************************************************\n\t\tScripting Macros.\n\t*******************************************************************************************************************/\n\t/*\n\t\t<<run>>\n\t*/\n\tMacro.add('run', 'set'); // add <<run>> as an alias of <<set>>\n\n\t/*\n\t\t<<script>>\n\t*/\n\tMacro.add('script', {\n\t\tskipArgs : true,\n\t\ttags     : null,\n\n\t\thandler() {\n\t\t\tconst output = document.createDocumentFragment();\n\n\t\t\ttry {\n\t\t\t\tScripting.evalJavaScript(this.payload[0].contents, output);\n\t\t\t}\n\t\t\tcatch (ex) {\n\t\t\t\treturn this.error(`bad evaluation: ${typeof ex === 'object' ? ex.message : ex}`);\n\t\t\t}\n\n\t\t\t// Custom debug view setup.\n\t\t\tif (Config.debug) {\n\t\t\t\tthis.createDebugView();\n\t\t\t}\n\n\t\t\tif (output.hasChildNodes()) {\n\t\t\t\tthis.output.appendChild(output);\n\t\t\t}\n\t\t}\n\t});\n\n\n\t/*******************************************************************************************************************\n\t\tDisplay Macros.\n\t*******************************************************************************************************************/\n\t/*\n\t\t<<include>>\n\t*/\n\tMacro.add('include', {\n\t\thandler() {\n\t\t\tif (this.args.length === 0) {\n\t\t\t\treturn this.error('no passage specified');\n\t\t\t}\n\n\t\t\tlet passage;\n\n\t\t\tif (typeof this.args[0] === 'object') {\n\t\t\t\t// Argument was in wiki link syntax.\n\t\t\t\tpassage = this.args[0].link;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// Argument was simply the passage name.\n\t\t\t\tpassage = this.args[0];\n\t\t\t}\n\n\t\t\tif (!Story.has(passage)) {\n\t\t\t\treturn this.error(`passage \"${passage}\" does not exist`);\n\t\t\t}\n\n\t\t\t// Custom debug view setup.\n\t\t\tif (Config.debug) {\n\t\t\t\tthis.debugView.modes({ block : true });\n\t\t\t}\n\n\t\t\tpassage = Story.get(passage);\n\t\t\tlet $el;\n\n\t\t\tif (this.args[1]) {\n\t\t\t\t$el = jQuery(document.createElement(this.args[1]))\n\t\t\t\t\t.addClass(`${passage.domId} macro-${this.name}`)\n\t\t\t\t\t.attr('data-passage', passage.title)\n\t\t\t\t\t.appendTo(this.output);\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$el = jQuery(this.output);\n\t\t\t}\n\n\t\t\t$el.wiki(passage.processText());\n\t\t}\n\t});\n\n\t/*\n\t\t<<nobr>>\n\t*/\n\tMacro.add('nobr', {\n\t\tskipArgs : true,\n\t\ttags     : null,\n\n\t\thandler() {\n\t\t\t/*\n\t\t\t\tWikify the contents, after removing all leading & trailing newlines and compacting\n\t\t\t\tall internal sequences of newlines into single spaces.\n\t\t\t*/\n\t\t\tnew Wikifier(this.output, this.payload[0].contents.replace(/^\\n+|\\n+$/g, '').replace(/\\n+/g, ' '));\n\t\t}\n\t});\n\n\t/*\n\t\t<<print>>, <<=>>, & <<->>\n\t*/\n\tMacro.add(['print', '=', '-'], {\n\t\tskipArgs : true,\n\n\t\thandler() {\n\t\t\tif (this.args.full.length === 0) {\n\t\t\t\treturn this.error('no expression specified');\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tconst result = stringFrom(Scripting.evalJavaScript(this.args.full));\n\n\t\t\t\tif (result !== null) {\n\t\t\t\t\tnew Wikifier(this.output, this.name === '-' ? Util.escape(result) : result);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (ex) {\n\t\t\t\treturn this.error(`bad evaluation: ${typeof ex === 'object' ? `${ex.name}: ${ex.message}` : ex}`, null, ex.stack);\n\t\t\t}\n\t\t}\n\t});\n\n\t/*\n\t\t<<silently>>\n\t*/\n\tMacro.add('silently', {\n\t\tskipArgs : true,\n\t\ttags     : null,\n\n\t\thandler() {\n\t\t\tconst frag = document.createDocumentFragment();\n\t\t\tnew Wikifier(frag, this.payload[0].contents.trim());\n\n\t\t\tif (Config.debug) {\n\t\t\t\t// Custom debug view setup.\n\t\t\t\tthis.debugView.modes({ block : true, hidden : true });\n\t\t\t\tthis.output.appendChild(frag);\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// Discard the output, unless there were errors.\n\t\t\t\tconst errList = [...frag.querySelectorAll('.error')].map(errEl => errEl.textContent);\n\n\t\t\t\tif (errList.length > 0) {\n\t\t\t\t\treturn this.error(`error${errList.length === 1 ? '' : 's'} within contents (${errList.join('; ')})`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\t/*\n\t\t<<type speed [start delay] [class classes] [element tag] [id ID] [keep|none] [skipkey key]>>\n\t*/\n\tMacro.add('type', {\n\t\tisAsync : true,\n\t\ttags    : null,\n\t\ttypeId  : 0,\n\n\t\thandler() {\n\t\t\tif (this.args.length === 0) {\n\t\t\t\treturn this.error('no speed specified');\n\t\t\t}\n\n\t\t\tconst speed = Util.fromCssTime(this.args[0]); // in milliseconds\n\n\t\t\tif (speed < 0) {\n\t\t\t\treturn this.error(`speed time value must be non-negative (received: ${this.args[0]})`);\n\t\t\t}\n\n\t\t\tlet cursor;\n\t\t\tlet elClass = '';\n\t\t\tlet elId    = '';\n\t\t\tlet elTag   = 'div';\n\t\t\tlet skipKey = Config.macros.typeSkipKey;\n\t\t\tlet start   = 400; // in milliseconds\n\n\t\t\t// Process optional arguments.\n\t\t\tconst options = this.args.slice(1);\n\n\t\t\twhile (options.length > 0) {\n\t\t\t\tconst option = options.shift();\n\n\t\t\t\tswitch (option) {\n\t\t\t\tcase 'class': {\n\t\t\t\t\tif (options.length === 0) {\n\t\t\t\t\t\treturn this.error('class option missing required class name(s)');\n\t\t\t\t\t}\n\n\t\t\t\t\telClass = options.shift();\n\n\t\t\t\t\tif (elClass === '') {\n\t\t\t\t\t\tthrow new Error('class option class name(s) must be non-empty (received: \"\")');\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase 'element': {\n\t\t\t\t\tif (options.length === 0) {\n\t\t\t\t\t\treturn this.error('element option missing required element tag name');\n\t\t\t\t\t}\n\n\t\t\t\t\telTag = options.shift();\n\n\t\t\t\t\tif (elTag === '') {\n\t\t\t\t\t\tthrow new Error('element option tag name must be non-empty (received: \"\")');\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase 'id': {\n\t\t\t\t\tif (options.length === 0) {\n\t\t\t\t\t\treturn this.error('id option missing required ID');\n\t\t\t\t\t}\n\n\t\t\t\t\telId = options.shift();\n\n\t\t\t\t\tif (elId === '') {\n\t\t\t\t\t\tthrow new Error('id option ID must be non-empty (received: \"\")');\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase 'keep':\n\t\t\t\t\tcursor = 'keep';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'none':\n\t\t\t\t\tcursor = 'none';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'skipkey': {\n\t\t\t\t\tif (options.length === 0) {\n\t\t\t\t\t\treturn this.error('skipkey option missing required key value');\n\t\t\t\t\t}\n\n\t\t\t\t\tskipKey = options.shift();\n\n\t\t\t\t\tif (skipKey === '') {\n\t\t\t\t\t\tthrow new Error('skipkey option key value must be non-empty (received: \"\")');\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase 'start': {\n\t\t\t\t\tif (options.length === 0) {\n\t\t\t\t\t\treturn this.error('start option missing required time value');\n\t\t\t\t\t}\n\n\t\t\t\t\tconst value = options.shift();\n\t\t\t\t\tstart = Util.fromCssTime(value);\n\n\t\t\t\t\tif (start < 0) {\n\t\t\t\t\t\tthrow new Error(`start option time value must be non-negative (received: ${value})`);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tdefault:\n\t\t\t\t\treturn this.error(`unknown option: ${option}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst contents = this.payload[0].contents;\n\n\t\t\t// Do nothing if there's no content to type out.\n\t\t\tif (contents.trim() === '') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Custom debug view setup.\n\t\t\tif (Config.debug) {\n\t\t\t\tthis.debugView.modes({ block : true });\n\t\t\t}\n\n\t\t\t// Set up our base class name and event namespace.\n\t\t\tconst className = `macro-${this.name}`;\n\t\t\tconst namespace = `.${className}`;\n\n\t\t\t// Create a target to be later replaced by the typing wrapper.\n\t\t\tconst $target = jQuery(document.createElement(elTag))\n\t\t\t\t.addClass(`${className} ${className}-target`)\n\t\t\t\t.appendTo(this.output);\n\n\t\t\t// Initialize the queue and clean up handlers.\n\t\t\tif (!TempState.macroTypeQueue) {\n\t\t\t\t// Set up the typing handler queue for all invocations.\n\t\t\t\tTempState.macroTypeQueue = [];\n\n\t\t\t\t// Immediately clear any existing handlers from our namespace and set up a\n\t\t\t\t// `:passageinit` event handler to clean up after navigation.\n\t\t\t\t$(document)\n\t\t\t\t\t.off(namespace)\n\t\t\t\t\t.one(`:passageinit${namespace}`, () => $(document).off(namespace));\n\t\t\t}\n\n\t\t\t// If the queue is empty at this point, set the start typing flag.\n\t\t\tconst startTyping = TempState.macroTypeQueue.length === 0;\n\n\t\t\t// Generate our unique ID.\n\t\t\tconst selfId = ++this.self.typeId;\n\n\t\t\t// Push our typing handler onto the queue.\n\t\t\tTempState.macroTypeQueue.push({\n\t\t\t\tid : selfId,\n\n\t\t\t\thandler() {\n\t\t\t\t\tconst $wrapper = jQuery(document.createElement(elTag))\n\t\t\t\t\t\t.addClass(className);\n\n\t\t\t\t\t// Add the user ID, if any.\n\t\t\t\t\tif (elId) {\n\t\t\t\t\t\t$wrapper.attr('id', elId);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Add the user class(es), if any.\n\t\t\t\t\tif (elClass) {\n\t\t\t\t\t\t$wrapper.addClass(elClass);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Wikify the contents into `$wrapper`.\n\t\t\t\t\tnew Wikifier($wrapper, contents);\n\n\t\t\t\t\t// Cache info about the current turn.\n\t\t\t\t\tconst passage = State.passage;\n\t\t\t\t\tconst turn    = State.turns;\n\n\t\t\t\t\t// Skip typing if….\n\t\t\t\t\tif (\n\t\t\t\t\t\t// …we've visited the passage before.\n\t\t\t\t\t\t!Config.macros.typeVisitedPassages\n\t\t\t\t\t\t&& State.passages.slice(0, -1).some(title => title === passage)\n\n\t\t\t\t\t\t// …there were any content errors.\n\t\t\t\t\t\t|| $wrapper.find('.error').length > 0\n\t\t\t\t\t) {\n\t\t\t\t\t\t$target.replaceWith($wrapper);\n\n\t\t\t\t\t\t// Remove this handler from the queue.\n\t\t\t\t\t\tTempState.macroTypeQueue.shift();\n\n\t\t\t\t\t\t// Run the next typing handler in the queue, if any.\n\t\t\t\t\t\tif (TempState.macroTypeQueue.length > 0) {\n\t\t\t\t\t\t\tTempState.macroTypeQueue.first().handler();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Exit.\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Create a new `NodeTyper` instance for the wrapper's contents and\n\t\t\t\t\t// replace the target with the typing wrapper.\n\t\t\t\t\tconst typer = new NodeTyper({\n\t\t\t\t\t\ttargetNode : $wrapper.get(0),\n\t\t\t\t\t\tclassNames : cursor === 'none' ? null : `${className}-cursor`\n\t\t\t\t\t});\n\t\t\t\t\t$target.replaceWith($wrapper);\n\n\t\t\t\t\t// Set up event IDs.\n\t\t\t\t\tconst typingCompleteId = ':typingcomplete';\n\t\t\t\t\tconst typingStartId    = ':typingstart';\n\t\t\t\t\tconst typingStopId     = ':typingstop';\n\t\t\t\t\tconst keydownAndNS     = `keydown${namespace}`;\n\t\t\t\t\tconst typingStopAndNS  = `${typingStopId}${namespace}`;\n\n\t\t\t\t\t// Set up handlers for spacebar aborting and continuations.\n\t\t\t\t\t$(document)\n\t\t\t\t\t\t.off(keydownAndNS)\n\t\t\t\t\t\t.on(keydownAndNS, ev => {\n\t\t\t\t\t\t\t// Finish typing if the player aborts via the skip key.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tUtil.scrubEventKey(ev.key) === skipKey\n\t\t\t\t\t\t\t\t&& (ev.target === document.body || ev.target === document.documentElement)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tev.preventDefault();\n\t\t\t\t\t\t\t\t$(document).off(keydownAndNS);\n\t\t\t\t\t\t\t\ttyper.finish();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.one(typingStopAndNS, () => {\n\t\t\t\t\t\t\tif (TempState.macroTypeQueue) {\n\t\t\t\t\t\t\t\t// If the queue is empty, fire the typing complete event.\n\t\t\t\t\t\t\t\tif (TempState.macroTypeQueue.length === 0) {\n\t\t\t\t\t\t\t\t\tjQuery.event.trigger(typingCompleteId);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Elsewise, run the next typing handler in the queue.\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tTempState.macroTypeQueue.first().handler();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t// Set up the typing interval and start/stop event firing.\n\t\t\t\t\tconst typeNode = function typeNode() {\n\t\t\t\t\t\tconst typeNodeMember = function typeNodeMember(typeIntervalId) {\n\t\t\t\t\t\t\t// Stop typing if….\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t// …we've navigated away.\n\t\t\t\t\t\t\t\tState.passage !== passage\n\t\t\t\t\t\t\t\t|| State.turns !== turn\n\n\t\t\t\t\t\t\t\t// …we're done typing.\n\t\t\t\t\t\t\t\t|| !typer.type()\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t// Terminate the timer, if it exists.\n\t\t\t\t\t\t\t\tif (typeIntervalId) {\n\t\t\t\t\t\t\t\t\tclearInterval(typeIntervalId);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t// Remove this handler from the queue, if the queue still exists and the\n\t\t\t\t\t\t\t\t// handler IDs match.\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tTempState.macroTypeQueue\n\t\t\t\t\t\t\t\t\t&& TempState.macroTypeQueue.length > 0\n\t\t\t\t\t\t\t\t\t&& TempState.macroTypeQueue.first().id === selfId\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tTempState.macroTypeQueue.shift();\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t// Fire the typing stop event.\n\t\t\t\t\t\t\t\t$wrapper.trigger(typingStopId);\n\n\t\t\t\t\t\t\t\t// Add the done class to the wrapper.\n\t\t\t\t\t\t\t\t$wrapper.addClass(`${className}-done`);\n\n\t\t\t\t\t\t\t\t// Add the cursor class to the wrapper, if we're keeping it.\n\t\t\t\t\t\t\t\tif (cursor === 'keep') {\n\t\t\t\t\t\t\t\t\t$wrapper.addClass(`${className}-cursor`);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// Fire the typing start event.\n\t\t\t\t\t\t$wrapper.trigger(typingStartId);\n\n\t\t\t\t\t\t// Type the initial node member.\n\t\t\t\t\t\ttypeNodeMember();\n\n\t\t\t\t\t\t// Set up the interval to continue typing.\n\t\t\t\t\t\tconst typeNodeMemberId = setInterval(() => typeNodeMember(typeNodeMemberId), speed);\n\t\t\t\t\t};\n\n\t\t\t\t\t// Kick off typing the node.\n\t\t\t\t\tif (start) {\n\t\t\t\t\t\tsetTimeout(typeNode, start);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\ttypeNode();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t// If we're to start typing, then either set up a `:passageend` event handler\n\t\t\t// to do so or start it immediately, depending on the engine state.\n\t\t\tif (startTyping) {\n\t\t\t\tif (Engine.isPlaying()) {\n\t\t\t\t\t$(document).one(`:passageend${namespace}`, () => TempState.macroTypeQueue.first().handler());\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tTempState.macroTypeQueue.first().handler();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\t/*\n\t\t[DEPRECATED] <<display>>\n\t*/\n\tMacro.add('display', 'include'); // add <<display>> as an alias of <<include>>\n\n\n\t/*******************************************************************************************************************\n\t\tControl Macros.\n\t*******************************************************************************************************************/\n\t/*\n\t\t<<if>>, <<elseif>>, & <<else>>\n\t*/\n\tMacro.add('if', {\n\t\tskipArgs   : true,\n\t\ttags       : ['elseif', 'else'],\n\t\telseifWsRe : /^\\s*if\\b/i,\n\t\tifAssignRe : /[^!=&^|<>*/%+-]=[^=>]/,\n\n\t\thandler() {\n\t\t\tlet i;\n\n\t\t\ttry {\n\t\t\t\tconst len = this.payload.length;\n\n\t\t\t\t// Sanity checks.\n\t\t\t\tconst elseifWsRe = this.self.elseifWsRe;\n\t\t\t\tconst ifAssignRe = this.self.ifAssignRe;\n\n\t\t\t\tfor (/* declared previously */ i = 0; i < len; ++i) {\n\t\t\t\t\t/* eslint-disable prefer-template */\n\t\t\t\t\tswitch (this.payload[i].name) {\n\t\t\t\t\tcase 'else':\n\t\t\t\t\t\tif (this.payload[i].args.raw.length > 0) {\n\t\t\t\t\t\t\tif (elseifWsRe.test(this.payload[i].args.raw)) {\n\t\t\t\t\t\t\t\treturn this.error(`whitespace is not allowed between the \"else\" and \"if\" in <<elseif>> clause${i > 0 ? ' (#' + i + ')' : ''}`);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn this.error(`<<else>> does not accept a conditional expression (perhaps you meant to use <<elseif>>), invalid: ${this.payload[i].args.raw}`);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (i + 1 !== len) {\n\t\t\t\t\t\t\treturn this.error('<<else>> must be the final clause');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tif (this.payload[i].args.full.length === 0) {\n\t\t\t\t\t\t\treturn this.error(`no conditional expression specified for <<${this.payload[i].name}>> clause${i > 0 ? ' (#' + i + ')' : ''}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (\n\t\t\t\t\t\t\t   Config.macros.ifAssignmentError\n\t\t\t\t\t\t\t&& ifAssignRe.test(this.payload[i].args.full)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn this.error(`assignment operator found within <<${this.payload[i].name}>> clause${i > 0 ? ' (#' + i + ')' : ''} (perhaps you meant to use an equality operator: ==, ===, eq, is), invalid: ${this.payload[i].args.raw}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t/* eslint-enable prefer-template */\n\t\t\t\t}\n\n\t\t\t\tconst evalJavaScript = Scripting.evalJavaScript;\n\t\t\t\tlet success = false;\n\n\t\t\t\t// Evaluate the clauses.\n\t\t\t\tfor (/* declared previously */ i = 0; i < len; ++i) {\n\t\t\t\t\t// Custom debug view setup for the current clause.\n\t\t\t\t\tif (Config.debug) {\n\t\t\t\t\t\tthis\n\t\t\t\t\t\t\t.createDebugView(this.payload[i].name, this.payload[i].source)\n\t\t\t\t\t\t\t.modes({ nonvoid : false });\n\t\t\t\t\t}\n\n\t\t\t\t\t// Conditional test.\n\t\t\t\t\tif (this.payload[i].name === 'else' || !!evalJavaScript(this.payload[i].args.full)) {\n\t\t\t\t\t\tsuccess = true;\n\t\t\t\t\t\tnew Wikifier(this.output, this.payload[i].contents);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse if (Config.debug) {\n\t\t\t\t\t\t// Custom debug view setup for a failed conditional.\n\t\t\t\t\t\tthis.debugView.modes({\n\t\t\t\t\t\t\thidden  : true,\n\t\t\t\t\t\t\tinvalid : true\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Custom debug view setup for the remaining clauses.\n\t\t\t\tif (Config.debug) {\n\t\t\t\t\tfor (++i; i < len; ++i) {\n\t\t\t\t\t\tthis\n\t\t\t\t\t\t\t.createDebugView(this.payload[i].name, this.payload[i].source)\n\t\t\t\t\t\t\t.modes({\n\t\t\t\t\t\t\t\tnonvoid : false,\n\t\t\t\t\t\t\t\thidden  : true,\n\t\t\t\t\t\t\t\tinvalid : true\n\t\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\t/*\n\t\t\t\t\t\tFake a debug view for `<</if>>`.  We do this to aid the checking of nesting\n\t\t\t\t\t\tand as a quick indicator of if any of the clauses matched.\n\t\t\t\t\t*/\n\t\t\t\t\tthis\n\t\t\t\t\t\t.createDebugView(`/${this.name}`, `<</${this.name}>>`)\n\t\t\t\t\t\t.modes({\n\t\t\t\t\t\t\tnonvoid : false,\n\t\t\t\t\t\t\thidden  : !success,\n\t\t\t\t\t\t\tinvalid : !success\n\t\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (ex) {\n\t\t\t\treturn this.error(`bad conditional expression in <<${i === 0 ? 'if' : 'elseif'}>> clause${i > 0 ? ' (#' + i + ')' : ''}: ${typeof ex === 'object' ? `${ex.name}: ${ex.message}` : ex}`, null, ex.stack); // eslint-disable-line prefer-template\n\t\t\t}\n\t\t}\n\t});\n\n\t/*\n\t\t<<switch>>, <<case>>, & <<default>>\n\t*/\n\tMacro.add('switch', {\n\t\tskipArgs : ['switch'],\n\t\ttags     : ['case', 'default'],\n\n\t\thandler() {\n\t\t\tif (this.args.full.length === 0) {\n\t\t\t\treturn this.error('no expression specified');\n\t\t\t}\n\n\t\t\tconst len = this.payload.length;\n\n\t\t\t// if (len === 1 || !this.payload.some(p => p.name === 'case')) {\n\t\t\tif (len === 1) {\n\t\t\t\treturn this.error('no cases specified');\n\t\t\t}\n\n\t\t\tlet i;\n\n\t\t\t// Sanity checks.\n\t\t\tfor (/* declared previously */ i = 1; i < len; ++i) {\n\t\t\t\tswitch (this.payload[i].name) {\n\t\t\t\tcase 'default':\n\t\t\t\t\tif (this.payload[i].args.length > 0) {\n\t\t\t\t\t\treturn this.error(`<<default>> does not accept values, invalid: ${this.payload[i].args.raw}`);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (i + 1 !== len) {\n\t\t\t\t\t\treturn this.error('<<default>> must be the final case');\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tif (this.payload[i].args.length === 0) {\n\t\t\t\t\t\treturn this.error(`no value(s) specified for <<${this.payload[i].name}>> (#${i})`);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet result;\n\n\t\t\ttry {\n\t\t\t\tresult = Scripting.evalJavaScript(this.args.full);\n\t\t\t}\n\t\t\tcatch (ex) {\n\t\t\t\treturn this.error(`bad evaluation: ${typeof ex === 'object' ? ex.message : ex}`);\n\t\t\t}\n\n\t\t\tconst debugView = this.debugView; // cache it now, to be modified later\n\t\t\tlet success = false;\n\n\t\t\t// Initial debug view setup for `<<switch>>`.\n\t\t\tif (Config.debug) {\n\t\t\t\tdebugView\n\t\t\t\t\t.modes({\n\t\t\t\t\t\tnonvoid : false,\n\t\t\t\t\t\thidden  : true\n\t\t\t\t\t});\n\t\t\t}\n\n\t\t\t// Evaluate the clauses.\n\t\t\tfor (/* declared previously */ i = 1; i < len; ++i) {\n\t\t\t\t// Custom debug view setup for the current case.\n\t\t\t\tif (Config.debug) {\n\t\t\t\t\tthis\n\t\t\t\t\t\t.createDebugView(this.payload[i].name, this.payload[i].source)\n\t\t\t\t\t\t.modes({ nonvoid : false });\n\t\t\t\t}\n\n\t\t\t\t// Case test(s).\n\t\t\t\tif (this.payload[i].name === 'default' || this.payload[i].args.some(val => val === result)) {\n\t\t\t\t\tsuccess = true;\n\t\t\t\t\tnew Wikifier(this.output, this.payload[i].contents);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if (Config.debug) {\n\t\t\t\t\t// Custom debug view setup for a failed case.\n\t\t\t\t\tthis.debugView.modes({\n\t\t\t\t\t\thidden  : true,\n\t\t\t\t\t\tinvalid : true\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Custom debug view setup for the remaining cases.\n\t\t\tif (Config.debug) {\n\t\t\t\tfor (++i; i < len; ++i) {\n\t\t\t\t\tthis\n\t\t\t\t\t\t.createDebugView(this.payload[i].name, this.payload[i].source)\n\t\t\t\t\t\t.modes({\n\t\t\t\t\t\t\tnonvoid : false,\n\t\t\t\t\t\t\thidden  : true,\n\t\t\t\t\t\t\tinvalid : true\n\t\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t/*\n\t\t\t\t\tFinalize the debug view for `<<switch>>` and fake a debug view for `<</switch>>`.\n\t\t\t\t\tWe do both as a quick indicator of if any of the cases matched and the latter\n\t\t\t\t\tto aid the checking of nesting.\n\t\t\t\t*/\n\t\t\t\tdebugView\n\t\t\t\t\t.modes({\n\t\t\t\t\t\tnonvoid : false,\n\t\t\t\t\t\thidden  : true, // !success,\n\t\t\t\t\t\tinvalid : !success\n\t\t\t\t\t});\n\t\t\t\tthis\n\t\t\t\t\t.createDebugView(`/${this.name}`, `<</${this.name}>>`)\n\t\t\t\t\t.modes({\n\t\t\t\t\t\tnonvoid : false,\n\t\t\t\t\t\thidden  : true, // !success,\n\t\t\t\t\t\tinvalid : !success\n\t\t\t\t\t});\n\t\t\t}\n\t\t}\n\t});\n\n\t/*\n\t\t<<for>>, <<break>>, & <<continue>>\n\t*/\n\tMacro.add('for', {\n\t\t/* eslint-disable max-len */\n\t\tskipArgs    : true,\n\t\ttags        : null,\n\t\thasRangeRe  : new RegExp(`^\\\\S${Patterns.anyChar}*?\\\\s+range\\\\s+\\\\S${Patterns.anyChar}*?$`),\n\t\trangeRe     : new RegExp(`^(?:State\\\\.(variables|temporary)\\\\.(${Patterns.identifier})\\\\s*,\\\\s*)?State\\\\.(variables|temporary)\\\\.(${Patterns.identifier})\\\\s+range\\\\s+(\\\\S${Patterns.anyChar}*?)$`),\n\t\tthreePartRe : /^([^;]*?)\\s*;\\s*([^;]*?)\\s*;\\s*([^;]*?)$/,\n\t\tforInRe     : /^\\S+\\s+in\\s+\\S+/i,\n\t\tforOfRe     : /^\\S+\\s+of\\s+\\S+/i,\n\t\t/* eslint-enable max-len */\n\n\t\thandler() {\n\t\t\tconst argsStr = this.args.full.trim();\n\t\t\tconst payload = this.payload[0].contents.replace(/\\n$/, '');\n\n\t\t\t// Empty form.\n\t\t\tif (argsStr.length === 0) {\n\t\t\t\tthis.self.handleFor.call(this, payload, null, true, null);\n\t\t\t}\n\n\t\t\t// Range form.\n\t\t\telse if (this.self.hasRangeRe.test(argsStr)) {\n\t\t\t\tconst parts = argsStr.match(this.self.rangeRe);\n\n\t\t\t\tif (parts === null) {\n\t\t\t\t\treturn this.error('invalid range form syntax, format: [index ,] value range collection');\n\t\t\t\t}\n\n\t\t\t\tthis.self.handleForRange.call(\n\t\t\t\t\tthis,\n\t\t\t\t\tpayload,\n\t\t\t\t\t{ type : parts[1], name : parts[2] },\n\t\t\t\t\t{ type : parts[3], name : parts[4] },\n\t\t\t\t\tparts[5]\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Conditional forms.\n\t\t\telse {\n\t\t\t\tlet init;\n\t\t\t\tlet condition;\n\t\t\t\tlet post;\n\n\t\t\t\t// Conditional-only form.\n\t\t\t\tif (argsStr.indexOf(';') === -1) {\n\t\t\t\t\t// Sanity checks.\n\t\t\t\t\tif (this.self.forInRe.test(argsStr)) {\n\t\t\t\t\t\treturn this.error('invalid syntax, for…in is not supported; see: for…range');\n\t\t\t\t\t}\n\t\t\t\t\telse if (this.self.forOfRe.test(argsStr)) {\n\t\t\t\t\t\treturn this.error('invalid syntax, for…of is not supported; see: for…range');\n\t\t\t\t\t}\n\n\t\t\t\t\tcondition = argsStr;\n\t\t\t\t}\n\n\t\t\t\t// 3-part conditional form.\n\t\t\t\telse {\n\t\t\t\t\tconst parts = argsStr.match(this.self.threePartRe);\n\n\t\t\t\t\tif (parts === null) {\n\t\t\t\t\t\treturn this.error('invalid 3-part conditional form syntax, format: [init] ; [condition] ; [post]');\n\t\t\t\t\t}\n\n\t\t\t\t\tinit      = parts[1];\n\t\t\t\t\tcondition = parts[2].trim();\n\t\t\t\t\tpost      = parts[3];\n\n\t\t\t\t\tif (condition.length === 0) {\n\t\t\t\t\t\tcondition = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.self.handleFor.call(this, payload, init, condition, post);\n\t\t\t}\n\t\t},\n\n\t\thandleFor(payload, init, condition, post) {\n\t\t\tconst evalJavaScript = Scripting.evalJavaScript;\n\t\t\tlet first  = true;\n\t\t\tlet safety = Config.macros.maxLoopIterations;\n\n\t\t\t// Custom debug view setup.\n\t\t\tif (Config.debug) {\n\t\t\t\tthis.debugView.modes({ block : true });\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tTempState.break = null;\n\n\t\t\t\tif (init) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tevalJavaScript(init);\n\t\t\t\t\t}\n\t\t\t\t\tcatch (ex) {\n\t\t\t\t\t\treturn this.error(`bad init expression: ${typeof ex === 'object' ? ex.message : ex}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\twhile (evalJavaScript(condition)) {\n\t\t\t\t\tif (Wikifier.stopWikify) return;\n\n\t\t\t\t\tif (--safety < 0) {\n\t\t\t\t\t\treturn this.error(`exceeded configured maximum loop iterations (${Config.macros.maxLoopIterations})`);\n\t\t\t\t\t}\n\n\t\t\t\t\tnew Wikifier(this.output, first ? payload.replace(/^\\n/, '') : payload);\n\n\t\t\t\t\tif (first) {\n\t\t\t\t\t\tfirst = false;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (TempState.break != null) { // lazy equality for null\n\t\t\t\t\t\tif (TempState.break === 1) {\n\t\t\t\t\t\t\tTempState.break = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (TempState.break === 2) {\n\t\t\t\t\t\t\tTempState.break = null;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (post) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tevalJavaScript(post);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (ex) {\n\t\t\t\t\t\t\treturn this.error(`bad post expression: ${typeof ex === 'object' ? ex.message : ex}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (ex) {\n\t\t\t\treturn this.error(`bad conditional expression: ${typeof ex === 'object' ? ex.message : ex}`);\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tTempState.break = null;\n\t\t\t}\n\t\t},\n\n\t\thandleForRange(payload, indexVar, valueVar, rangeExp) {\n\t\t\tlet first     = true;\n\t\t\tlet rangeList;\n\n\t\t\ttry {\n\t\t\t\trangeList = this.self.toRangeList(rangeExp);\n\t\t\t}\n\t\t\tcatch (ex) {\n\t\t\t\treturn this.error(ex.message);\n\t\t\t}\n\n\t\t\t// Custom debug view setup.\n\t\t\tif (Config.debug) {\n\t\t\t\tthis.debugView.modes({ block : true });\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tTempState.break = null;\n\n\t\t\t\tfor (let i = 0; i < rangeList.length; ++i) {\n\t\t\t\t\tif (indexVar.name) {\n\t\t\t\t\t\tState[indexVar.type][indexVar.name] = rangeList[i][0];\n\t\t\t\t\t}\n\n\t\t\t\t\tState[valueVar.type][valueVar.name] = rangeList[i][1];\n\n\t\t\t\t\tnew Wikifier(this.output, first ? payload.replace(/^\\n/, '') : payload);\n\n\t\t\t\t\tif (first) {\n\t\t\t\t\t\tfirst = false;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (TempState.break != null) { // lazy equality for null\n\t\t\t\t\t\tif (TempState.break === 1) {\n\t\t\t\t\t\t\tTempState.break = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (TempState.break === 2) {\n\t\t\t\t\t\t\tTempState.break = null;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (ex) {\n\t\t\t\treturn this.error(typeof ex === 'object' ? ex.message : ex);\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tTempState.break = null;\n\t\t\t}\n\t\t},\n\n\t\ttoRangeList(rangeExp) {\n\t\t\tconst evalJavaScript = Scripting.evalJavaScript;\n\t\t\tlet value;\n\n\t\t\ttry {\n\t\t\t\t/*\n\t\t\t\t\tNOTE: If the first character is the left curly brace, then we\n\t\t\t\t\tassume that it's part of an object literal and wrap it within\n\t\t\t\t\tparenthesis to ensure that it is not mistaken for a block\n\t\t\t\t\tduring evaluation—which would cause an error.\n\t\t\t\t*/\n\t\t\t\tvalue = evalJavaScript(rangeExp[0] === '{' ? `(${rangeExp})` : rangeExp);\n\t\t\t}\n\t\t\tcatch (ex) {\n\t\t\t\tif (typeof ex !== 'object') {\n\t\t\t\t\tthrow new Error(`bad range expression: ${ex}`);\n\t\t\t\t}\n\n\t\t\t\tex.message = `bad range expression: ${ex.message}`;\n\t\t\t\tthrow ex;\n\t\t\t}\n\n\t\t\tlet list;\n\n\t\t\tswitch (typeof value) {\n\t\t\tcase 'string':\n\t\t\t\tlist = [];\n\t\t\t\tfor (let i = 0; i < value.length; /* empty */) {\n\t\t\t\t\tconst obj = Util.charAndPosAt(value, i);\n\t\t\t\t\tlist.push([i, obj.char]);\n\t\t\t\t\ti = 1 + obj.end;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 'object':\n\t\t\t\tif (Array.isArray(value)) {\n\t\t\t\t\tlist = value.map((val, i) => [i, val]);\n\t\t\t\t}\n\t\t\t\telse if (value instanceof Set) {\n\t\t\t\t\tlist = [...value].map((val, i) => [i, val]);\n\t\t\t\t}\n\t\t\t\telse if (value instanceof Map) {\n\t\t\t\t\tlist = [...value.entries()];\n\t\t\t\t}\n\t\t\t\telse if (Util.toStringTag(value) === 'Object') {\n\t\t\t\t\tlist = Object.keys(value).map(key => [key, value[key]]);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthrow new Error(`unsupported range expression type: ${Util.toStringTag(value)}`);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`unsupported range expression type: ${typeof value}`);\n\t\t\t}\n\n\t\t\treturn list;\n\t\t}\n\t});\n\tMacro.add(['break', 'continue'], {\n\t\tskipArgs : true,\n\n\t\thandler() {\n\t\t\tif (this.contextHas(ctx => ctx.name === 'for')) {\n\t\t\t\tTempState.break = this.name === 'continue' ? 1 : 2;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn this.error('must only be used in conjunction with its parent macro <<for>>');\n\t\t\t}\n\n\t\t\t// Custom debug view setup.\n\t\t\tif (Config.debug) {\n\t\t\t\tthis.debugView.modes({ hidden : true });\n\t\t\t}\n\t\t}\n\t});\n\n\n\t/*******************************************************************************************************************\n\t\tInteractive Macros.\n\t*******************************************************************************************************************/\n\t/*\n\t\t<<button>> & <<link>>\n\t*/\n\tMacro.add(['button', 'link'], {\n\t\tisAsync : true,\n\t\ttags    : null,\n\n\t\thandler() {\n\t\t\tif (this.args.length === 0) {\n\t\t\t\treturn this.error(`no ${this.name === 'button' ? 'button' : 'link'} text specified`);\n\t\t\t}\n\n\t\t\tconst $link = jQuery(document.createElement(this.name === 'button' ? 'button' : 'a'));\n\t\t\tlet passage;\n\n\t\t\tif (typeof this.args[0] === 'object') {\n\t\t\t\tif (this.args[0].isImage) {\n\t\t\t\t\t// Argument was in wiki image syntax.\n\t\t\t\t\tconst $image = jQuery(document.createElement('img'))\n\t\t\t\t\t\t.attr('src', this.args[0].source)\n\t\t\t\t\t\t.appendTo($link);\n\n\t\t\t\t\t$link.addClass('link-image');\n\n\t\t\t\t\tif (this.args[0].hasOwnProperty('passage')) {\n\t\t\t\t\t\t$image.attr('data-passage', this.args[0].passage);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.args[0].hasOwnProperty('title')) {\n\t\t\t\t\t\t$image.attr('title', this.args[0].title);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.args[0].hasOwnProperty('align')) {\n\t\t\t\t\t\t$image.attr('align', this.args[0].align);\n\t\t\t\t\t}\n\n\t\t\t\t\tpassage = this.args[0].link;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t// Argument was in wiki link syntax.\n\t\t\t\t\t$link.append(document.createTextNode(this.args[0].text));\n\t\t\t\t\tpassage = this.args[0].link;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// Argument was simply the link text.\n\t\t\t\t$link.wikiWithOptions({ profile : 'core' }, this.args[0]);\n\t\t\t\tpassage = this.args.length > 1 ? this.args[1] : undefined;\n\t\t\t}\n\n\t\t\tif (passage != null) { // lazy equality for null\n\t\t\t\t$link.attr('data-passage', passage);\n\n\t\t\t\tif (Story.has(passage)) {\n\t\t\t\t\t$link.addClass('link-internal');\n\n\t\t\t\t\tif (Config.addVisitedLinkClass && State.hasPlayed(passage)) {\n\t\t\t\t\t\t$link.addClass('link-visited');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$link.addClass('link-broken');\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$link.addClass('link-internal');\n\t\t\t}\n\n\t\t\t$link\n\t\t\t\t.addClass(`macro-${this.name}`)\n\t\t\t\t.ariaClick({\n\t\t\t\t\tnamespace : '.macros',\n\t\t\t\t\trole      : passage != null ? 'link' : 'button', // lazy equality for null\n\t\t\t\t\tone       : passage != null // lazy equality for null\n\t\t\t\t}, this.createShadowWrapper(\n\t\t\t\t\tthis.payload[0].contents !== ''\n\t\t\t\t\t\t? () => Wikifier.wikifyEval(this.payload[0].contents.trim())\n\t\t\t\t\t\t: null,\n\t\t\t\t\tpassage != null // lazy equality for null\n\t\t\t\t\t\t? () => Engine.play(passage)\n\t\t\t\t\t\t: null\n\t\t\t\t))\n\t\t\t\t.appendTo(this.output);\n\t\t}\n\t});\n\n\t/*\n\t\t<<checkbox>>\n\t*/\n\tMacro.add('checkbox', {\n\t\tisAsync : true,\n\n\t\thandler() {\n\t\t\tif (this.args.length < 3) {\n\t\t\t\tconst errors = [];\n\t\t\t\tif (this.args.length < 1) { errors.push('variable name'); }\n\t\t\t\tif (this.args.length < 2) { errors.push('unchecked value'); }\n\t\t\t\tif (this.args.length < 3) { errors.push('checked value'); }\n\t\t\t\treturn this.error(`no ${errors.join(' or ')} specified`);\n\t\t\t}\n\n\t\t\t// Ensure that the variable name argument is a string.\n\t\t\tif (typeof this.args[0] !== 'string') {\n\t\t\t\treturn this.error('variable name argument is not a string');\n\t\t\t}\n\n\t\t\tconst varName = this.args[0].trim();\n\n\t\t\t// Try to ensure that we receive the variable's name (incl. sigil), not its value.\n\t\t\tif (varName[0] !== '$' && varName[0] !== '_') {\n\t\t\t\treturn this.error(`variable name \"${this.args[0]}\" is missing its sigil ($ or _)`);\n\t\t\t}\n\n\t\t\tconst varId        = Util.slugify(varName);\n\t\t\tconst uncheckValue = this.args[1];\n\t\t\tconst checkValue   = this.args[2];\n\t\t\tconst el           = document.createElement('input');\n\n\t\t\t/*\n\t\t\t\tSet up and append the input element to the output buffer.\n\t\t\t*/\n\t\t\tjQuery(el)\n\t\t\t\t.attr({\n\t\t\t\t\tid       : `${this.name}-${varId}`,\n\t\t\t\t\tname     : `${this.name}-${varId}`,\n\t\t\t\t\ttype     : 'checkbox',\n\t\t\t\t\ttabindex : 0 // for accessiblity\n\t\t\t\t})\n\t\t\t\t.addClass(`macro-${this.name}`)\n\t\t\t\t.on('change.macros', this.createShadowWrapper(function () {\n\t\t\t\t\tState.setVar(varName, this.checked ? checkValue : uncheckValue);\n\t\t\t\t}))\n\t\t\t\t.appendTo(this.output);\n\n\t\t\t/*\n\t\t\t\tSet the variable and input element to the appropriate value and state, as requested.\n\t\t\t*/\n\t\t\tswitch (this.args[3]) {\n\t\t\tcase 'autocheck':\n\t\t\t\tif (State.getVar(varName) === checkValue) {\n\t\t\t\t\tel.checked = true;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tState.setVar(varName, uncheckValue);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'checked':\n\t\t\t\tel.checked = true;\n\t\t\t\tState.setVar(varName, checkValue);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tState.setVar(varName, uncheckValue);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t});\n\n\t/*\n\t\t<<cycle>>, <<listbox>>, <<option>>, & <<optionsfrom>>\n\t*/\n\tMacro.add(['cycle', 'listbox'], {\n\t\tisAsync  : true,\n\t\tskipArgs : ['optionsfrom'],\n\t\ttags     : ['option', 'optionsfrom'],\n\n\t\thandler() {\n\t\t\tif (this.args.length === 0) {\n\t\t\t\treturn this.error('no variable name specified');\n\t\t\t}\n\n\t\t\t// Ensure that the variable name argument is a string.\n\t\t\tif (typeof this.args[0] !== 'string') {\n\t\t\t\treturn this.error('variable name argument is not a string');\n\t\t\t}\n\n\t\t\tconst varName = this.args[0].trim();\n\n\t\t\t// Try to ensure that we receive the variable's name (incl. sigil), not its value.\n\t\t\tif (varName[0] !== '$' && varName[0] !== '_') {\n\t\t\t\treturn this.error(`variable name \"${this.args[0]}\" is missing its sigil ($ or _)`);\n\t\t\t}\n\n\t\t\tconst varId = Util.slugify(varName);\n\t\t\tconst len   = this.payload.length;\n\n\t\t\tif (len === 1) {\n\t\t\t\treturn this.error('no options specified');\n\t\t\t}\n\n\t\t\tconst config = {\n\t\t\t\tautoselect : false,\n\t\t\t\tonce       : false\n\t\t\t};\n\n\t\t\t// Process arguments.\n\t\t\tfor (let i = 1; i < this.args.length; ++i) {\n\t\t\t\tconst arg = this.args[i];\n\n\t\t\t\tswitch (arg) {\n\t\t\t\tcase 'once':       config.once = true; break;\n\t\t\t\tcase 'autoselect': config.autoselect = true; break;\n\t\t\t\tdefault:           return this.error(`unknown argument: ${arg}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst options    = [];\n\t\t\tconst tagCount   = { option : 0, optionsfrom : 0 };\n\t\t\tlet selectedIdx = -1;\n\n\t\t\t// Get the options and selected index, if any.\n\t\t\tfor (let i = 1; i < len; ++i) {\n\t\t\t\tconst payload = this.payload[i];\n\n\t\t\t\t// <<option label value [selected]>>\n\t\t\t\tif (payload.name === 'option') {\n\t\t\t\t\t++tagCount.option;\n\n\t\t\t\t\tif (payload.args.length === 0) {\n\t\t\t\t\t\treturn this.error(`no arguments specified for <<${payload.name}>> (#${tagCount.option})`);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst option = { label : String(payload.args[0]) };\n\t\t\t\t\tlet isSelected = false;\n\n\t\t\t\t\tswitch (payload.args.length) {\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\toption.value = payload.args[0];\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 2:\n\t\t\t\t\t\tif (payload.args[1] === 'selected') {\n\t\t\t\t\t\t\toption.value = payload.args[0];\n\t\t\t\t\t\t\tisSelected = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\toption.value = payload.args[1];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\toption.value = payload.args[1];\n\n\t\t\t\t\t\tif (payload.args[2] === 'selected') {\n\t\t\t\t\t\t\tisSelected = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\toptions.push(option);\n\n\t\t\t\t\tif (isSelected) {\n\t\t\t\t\t\tif (config.autoselect) {\n\t\t\t\t\t\t\treturn this.error('cannot specify both the autoselect and selected keywords');\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (selectedIdx !== -1) {\n\t\t\t\t\t\t\treturn this.error(`multiple selected keywords specified for <<${payload.name}>> (#${selectedIdx + 1} & #${tagCount.option})`);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tselectedIdx = options.length - 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// <<optionsfrom expression>>\n\t\t\t\telse {\n\t\t\t\t\t++tagCount.optionsfrom;\n\n\t\t\t\t\tif (payload.args.full.length === 0) {\n\t\t\t\t\t\treturn this.error(`no expression specified for <<${payload.name}>> (#${tagCount.optionsfrom})`);\n\t\t\t\t\t}\n\n\t\t\t\t\tlet result;\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t\tNOTE: If the first character is the left curly brace, then we\n\t\t\t\t\t\t\tassume that it's part of an object literal and wrap it within\n\t\t\t\t\t\t\tparenthesis to ensure that it is not mistaken for a block\n\t\t\t\t\t\t\tduring evaluation—which would cause an error.\n\t\t\t\t\t\t*/\n\t\t\t\t\t\tconst exp = payload.args.full;\n\t\t\t\t\t\tresult = Scripting.evalJavaScript(exp[0] === '{' ? `(${exp})` : exp);\n\t\t\t\t\t}\n\t\t\t\t\tcatch (ex) {\n\t\t\t\t\t\treturn this.error(`bad evaluation: ${typeof ex === 'object' ? ex.message : ex}`);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (typeof result !== 'object' || result === null) {\n\t\t\t\t\t\treturn this.error(`expression must yield a supported collection or generic object (type: ${result === null ? 'null' : typeof result})`);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (result instanceof Array || result instanceof Set) {\n\t\t\t\t\t\tresult.forEach(val => options.push({ label : String(val), value : val }));\n\t\t\t\t\t}\n\t\t\t\t\telse if (result instanceof Map) {\n\t\t\t\t\t\tresult.forEach((val, key) => options.push({ label : String(key), value : val }));\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tconst oType = Util.toStringTag(result);\n\n\t\t\t\t\t\tif (oType !== 'Object') {\n\t\t\t\t\t\t\treturn this.error(`expression must yield a supported collection or generic object (object type: ${oType})`);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tObject.keys(result).forEach(key => options.push({ label : key, value : result[key] }));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// No options were selected by the user, so we must select one.\n\t\t\tif (selectedIdx === -1) {\n\t\t\t\t// Attempt to automatically select an option by matching the variable's current value.\n\t\t\t\tif (config.autoselect) {\n\t\t\t\t\t// NOTE: This will usually fail for objects due to a variety of reasons.\n\t\t\t\t\tconst sameValueZero = Util.sameValueZero;\n\t\t\t\t\tconst curValue      = State.getVar(varName);\n\t\t\t\t\tconst curValueIdx   = options.findIndex(opt => sameValueZero(opt.value, curValue));\n\t\t\t\t\tselectedIdx = curValueIdx === -1 ? 0 : curValueIdx;\n\t\t\t\t}\n\n\t\t\t\t// Simply select the first option.\n\t\t\t\telse {\n\t\t\t\t\tselectedIdx = 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Set up and append the appropriate element to the output buffer.\n\t\t\tif (this.name === 'cycle') {\n\t\t\t\tconst lastIdx = options.length - 1;\n\n\t\t\t\tif (config.once && selectedIdx === lastIdx) {\n\t\t\t\t\tjQuery(this.output)\n\t\t\t\t\t\t.wikiWithOptions({ profile : 'core' }, options[selectedIdx].label);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tlet cycleIdx = selectedIdx;\n\t\t\t\t\tjQuery(document.createElement('a'))\n\t\t\t\t\t\t.wikiWithOptions({ profile : 'core' }, options[selectedIdx].label)\n\t\t\t\t\t\t.attr('id', `${this.name}-${varId}`)\n\t\t\t\t\t\t.addClass(`macro-${this.name}`)\n\t\t\t\t\t\t.ariaClick({\n\t\t\t\t\t\t\tnamespace : '.macros',\n\t\t\t\t\t\t\trole      : 'button'\n\t\t\t\t\t\t}, this.createShadowWrapper(function () {\n\t\t\t\t\t\t\tconst $this = $(this);\n\t\t\t\t\t\t\tcycleIdx = (cycleIdx + 1) % options.length;\n\t\t\t\t\t\t\tState.setVar(varName, options[cycleIdx].value);\n\t\t\t\t\t\t\t$this.empty().wikiWithOptions({ profile : 'core' }, options[cycleIdx].label);\n\n\t\t\t\t\t\t\tif (config.once && cycleIdx === lastIdx) {\n\t\t\t\t\t\t\t\t$this.off().contents().unwrap();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}))\n\t\t\t\t\t\t.appendTo(this.output);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse { // this.name === 'listbox'\n\t\t\t\tconst $select = jQuery(document.createElement('select'));\n\n\t\t\t\toptions.forEach((opt, i) => {\n\t\t\t\t\tjQuery(document.createElement('option'))\n\t\t\t\t\t\t.val(i)\n\t\t\t\t\t\t.text(opt.label)\n\t\t\t\t\t\t.appendTo($select);\n\t\t\t\t});\n\n\t\t\t\t$select\n\t\t\t\t\t.attr({\n\t\t\t\t\t\tid       : `${this.name}-${varId}`,\n\t\t\t\t\t\tname     : `${this.name}-${varId}`,\n\t\t\t\t\t\ttabindex : 0 // for accessiblity\n\t\t\t\t\t})\n\t\t\t\t\t.addClass(`macro-${this.name}`)\n\t\t\t\t\t.val(selectedIdx)\n\t\t\t\t\t.on('change.macros', this.createShadowWrapper(function () {\n\t\t\t\t\t\tState.setVar(varName, options[Number(this.value)].value);\n\t\t\t\t\t}))\n\t\t\t\t\t.appendTo(this.output);\n\t\t\t}\n\n\t\t\t// Set the variable to the appropriate value, as requested.\n\t\t\tState.setVar(varName, options[selectedIdx].value);\n\t\t}\n\t});\n\n\t/*\n\t\t<<linkappend>>, <<linkprepend>>, & <<linkreplace>>\n\t*/\n\tMacro.add(['linkappend', 'linkprepend', 'linkreplace'], {\n\t\tisAsync : true,\n\t\ttags    : null,\n\t\tt8nRe   : /^(?:transition|t8n)$/,\n\n\t\thandler() {\n\t\t\tif (this.args.length === 0) {\n\t\t\t\treturn this.error('no link text specified');\n\t\t\t}\n\n\t\t\tconst $link      = jQuery(document.createElement('a'));\n\t\t\tconst $insert    = jQuery(document.createElement('span'));\n\t\t\tconst transition = this.args.length > 1 && this.self.t8nRe.test(this.args[1]);\n\n\t\t\t$link\n\t\t\t\t.wikiWithOptions({ profile : 'core' }, this.args[0])\n\t\t\t\t.addClass(`link-internal macro-${this.name}`)\n\t\t\t\t.ariaClick({\n\t\t\t\t\tnamespace : '.macros',\n\t\t\t\t\tone       : true\n\t\t\t\t}, this.createShadowWrapper(\n\t\t\t\t\t() => {\n\t\t\t\t\t\tif (this.name === 'linkreplace') {\n\t\t\t\t\t\t\t$link.remove();\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t$link\n\t\t\t\t\t\t\t\t.wrap(`<span class=\"macro-${this.name}\"></span>`)\n\t\t\t\t\t\t\t\t.replaceWith(() => $link.html());\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (this.payload[0].contents !== '') {\n\t\t\t\t\t\t\tconst frag = document.createDocumentFragment();\n\t\t\t\t\t\t\tnew Wikifier(frag, this.payload[0].contents);\n\t\t\t\t\t\t\t$insert.append(frag);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (transition) {\n\t\t\t\t\t\t\tsetTimeout(() => $insert.removeClass(`macro-${this.name}-in`), Engine.minDomActionDelay);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// as adding and replacing content might add or change links, auto-regenerating the hotkeys might be needed\n\t\t\t\t\t\tLinks.generate();\n\t\t\t\t\t}\n\t\t\t\t))\n\t\t\t\t.appendTo(this.output);\n\n\t\t\t$insert.addClass(`macro-${this.name}-insert`);\n\n\t\t\tif (transition) {\n\t\t\t\t$insert.addClass(`macro-${this.name}-in`);\n\t\t\t}\n\n\t\t\tif (this.name === 'linkprepend') {\n\t\t\t\t$insert.insertBefore($link);\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$insert.insertAfter($link);\n\t\t\t}\n\t\t}\n\t});\n\n\t/*\n\t\t<<numberbox>> & <<textbox>>\n\t*/\n\tMacro.add(['numberbox', 'textbox'], {\n\t\tisAsync : true,\n\n\t\thandler() {\n\t\t\tif (this.args.length < 2) {\n\t\t\t\tconst errors = [];\n\t\t\t\tif (this.args.length < 1) { errors.push('variable name'); }\n\t\t\t\tif (this.args.length < 2) { errors.push('default value'); }\n\t\t\t\treturn this.error(`no ${errors.join(' or ')} specified`);\n\t\t\t}\n\n\t\t\t// Ensure that the variable name argument is a string.\n\t\t\tif (typeof this.args[0] !== 'string') {\n\t\t\t\treturn this.error('variable name argument is not a string');\n\t\t\t}\n\n\t\t\tconst varName = this.args[0].trim();\n\n\t\t\t// Try to ensure that we receive the variable's name (incl. sigil), not its value.\n\t\t\tif (varName[0] !== '$' && varName[0] !== '_') {\n\t\t\t\treturn this.error(`variable name \"${this.args[0]}\" is missing its sigil ($ or _)`);\n\t\t\t}\n\n\t\t\t// Custom debug view setup.\n\t\t\tif (Config.debug) {\n\t\t\t\tthis.debugView.modes({ block : true });\n\t\t\t}\n\n\t\t\tconst asNumber     = this.name === 'numberbox';\n\t\t\tconst defaultValue = asNumber ? Number(this.args[1]) : this.args[1];\n\n\t\t\tif (asNumber && Number.isNaN(defaultValue)) {\n\t\t\t\treturn this.error(`default value \"${this.args[1]}\" is neither a number nor can it be parsed into a number`);\n\t\t\t}\n\n\t\t\tconst varId = Util.slugify(varName);\n\t\t\tconst el    = document.createElement('input');\n\t\t\tlet autofocus = false;\n\t\t\tlet passage;\n\n\t\t\tif (this.args.length > 3) {\n\t\t\t\tpassage   = this.args[2];\n\t\t\t\tautofocus = this.args[3] === 'autofocus';\n\t\t\t}\n\t\t\telse if (this.args.length > 2) {\n\t\t\t\tif (this.args[2] === 'autofocus') {\n\t\t\t\t\tautofocus = true;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tpassage = this.args[2];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (typeof passage === 'object') {\n\t\t\t\t// Argument was in wiki link syntax.\n\t\t\t\tpassage = passage.link;\n\t\t\t}\n\n\t\t\t// Set up and append the input element to the output buffer.\n\t\t\tjQuery(el)\n\t\t\t\t.attr({\n\t\t\t\t\tid        : `${this.name}-${varId}`,\n\t\t\t\t\tname      : `${this.name}-${varId}`,\n\t\t\t\t\ttype      : asNumber ? 'number' : 'text',\n\t\t\t\t\tinputmode : asNumber ? 'decimal' : 'text',\n\t\t\t\t\ttabindex  : 0 // for accessiblity\n\t\t\t\t})\n\t\t\t\t.addClass(`macro-${this.name}`)\n\t\t\t\t.on('change.macros', this.createShadowWrapper(function () {\n\t\t\t\t\tState.setVar(varName, asNumber ? Number(this.value) : this.value);\n\t\t\t\t}))\n\t\t\t\t.on('keypress.macros', this.createShadowWrapper(function (ev) {\n\t\t\t\t\t// If Return/Enter is pressed, set the variable and, optionally, forward to another passage.\n\t\t\t\t\tif (ev.which === 13) { // 13 is Return/Enter\n\t\t\t\t\t\tev.preventDefault();\n\t\t\t\t\t\tState.setVar(varName, asNumber ? Number(this.value) : this.value);\n\n\t\t\t\t\t\tif (passage != null) { // lazy equality for null\n\t\t\t\t\t\t\tEngine.play(passage);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}))\n\t\t\t\t.appendTo(this.output);\n\n\t\t\t// Set the step value for `<input type=\"number\">`.\n\t\t\tif (asNumber) {\n\t\t\t\tel.step = 'any';\n\t\t\t}\n\n\t\t\t// Set the variable and input element to the default value.\n\t\t\tState.setVar(varName, defaultValue);\n\t\t\tel.value = defaultValue;\n\n\t\t\t// Autofocus the input element, if requested.\n\t\t\tif (autofocus) {\n\t\t\t\t// Set the element's \"autofocus\" attribute.\n\t\t\t\tel.setAttribute('autofocus', 'autofocus');\n\n\t\t\t\t// Set up a single-use post-display task to autofocus the element.\n\t\t\t\tpostdisplay[`#autofocus:${el.id}`] = task => {\n\t\t\t\t\tdelete postdisplay[task]; // single-use task\n\t\t\t\t\tsetTimeout(() => el.focus(), Engine.minDomActionDelay);\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t});\n\n\t/*\n\t\t<<radiobutton>>\n\t*/\n\tMacro.add('radiobutton', {\n\t\tisAsync : true,\n\n\t\thandler() {\n\t\t\tif (this.args.length < 2) {\n\t\t\t\tconst errors = [];\n\t\t\t\tif (this.args.length < 1) { errors.push('variable name'); }\n\t\t\t\tif (this.args.length < 2) { errors.push('checked value'); }\n\t\t\t\treturn this.error(`no ${errors.join(' or ')} specified`);\n\t\t\t}\n\n\t\t\t// Ensure that the variable name argument is a string.\n\t\t\tif (typeof this.args[0] !== 'string') {\n\t\t\t\treturn this.error('variable name argument is not a string');\n\t\t\t}\n\n\t\t\tconst varName = this.args[0].trim();\n\n\t\t\t// Try to ensure that we receive the variable's name (incl. sigil), not its value.\n\t\t\tif (varName[0] !== '$' && varName[0] !== '_') {\n\t\t\t\treturn this.error(`variable name \"${this.args[0]}\" is missing its sigil ($ or _)`);\n\t\t\t}\n\n\t\t\tconst varId      = Util.slugify(varName);\n\t\t\tconst checkValue = this.args[1];\n\t\t\tconst el         = document.createElement('input');\n\n\t\t\t/*\n\t\t\t\tSet up and initialize the group counter.\n\t\t\t*/\n\t\t\tif (!TempState.hasOwnProperty(this.name)) {\n\t\t\t\tTempState[this.name] = {};\n\t\t\t}\n\n\t\t\tif (!TempState[this.name].hasOwnProperty(varId)) {\n\t\t\t\tTempState[this.name][varId] = 0;\n\t\t\t}\n\n\t\t\t/*\n\t\t\t\tSet up and append the input element to the output buffer.\n\t\t\t*/\n\t\t\tjQuery(el)\n\t\t\t\t.attr({\n\t\t\t\t\tid       : `${this.name}-${varId}-${TempState[this.name][varId]++}`,\n\t\t\t\t\tname     : `${this.name}-${varId}`,\n\t\t\t\t\ttype     : 'radio',\n\t\t\t\t\ttabindex : 0 // for accessiblity\n\t\t\t\t})\n\t\t\t\t.addClass(`macro-${this.name}`)\n\t\t\t\t.on('change.macros', this.createShadowWrapper(function () {\n\t\t\t\t\tif (this.checked) {\n\t\t\t\t\t\tState.setVar(varName, checkValue);\n\t\t\t\t\t}\n\t\t\t\t}))\n\t\t\t\t.appendTo(this.output);\n\n\t\t\t/*\n\t\t\t\tSet the variable to the checked value and the input element to checked, if requested.\n\t\t\t*/\n\t\t\tswitch (this.args[2]) {\n\t\t\tcase 'autocheck':\n\t\t\t\tif (State.getVar(varName) === checkValue) {\n\t\t\t\t\tel.checked = true;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'checked':\n\t\t\t\tel.checked = true;\n\t\t\t\tState.setVar(varName, checkValue);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t});\n\n\t/*\n\t\t<<textarea>>\n\t*/\n\tMacro.add('textarea', {\n\t\tisAsync : true,\n\n\t\thandler() {\n\t\t\tif (this.args.length < 2) {\n\t\t\t\tconst errors = [];\n\t\t\t\tif (this.args.length < 1) { errors.push('variable name'); }\n\t\t\t\tif (this.args.length < 2) { errors.push('default value'); }\n\t\t\t\treturn this.error(`no ${errors.join(' or ')} specified`);\n\t\t\t}\n\n\t\t\t// Ensure that the variable name argument is a string.\n\t\t\tif (typeof this.args[0] !== 'string') {\n\t\t\t\treturn this.error('variable name argument is not a string');\n\t\t\t}\n\n\t\t\tconst varName = this.args[0].trim();\n\n\t\t\t// Try to ensure that we receive the variable's name (incl. sigil), not its value.\n\t\t\tif (varName[0] !== '$' && varName[0] !== '_') {\n\t\t\t\treturn this.error(`variable name \"${this.args[0]}\" is missing its sigil ($ or _)`);\n\t\t\t}\n\n\t\t\t// Custom debug view setup.\n\t\t\tif (Config.debug) {\n\t\t\t\tthis.debugView.modes({ block : true });\n\t\t\t}\n\n\t\t\tconst varId        = Util.slugify(varName);\n\t\t\tconst defaultValue = this.args[1];\n\t\t\tconst autofocus    = this.args[2] === 'autofocus';\n\t\t\tconst el           = document.createElement('textarea');\n\n\t\t\t/*\n\t\t\t\tSet up and append the textarea element to the output buffer.\n\t\t\t*/\n\t\t\tjQuery(el)\n\t\t\t\t.attr({\n\t\t\t\t\tid       : `${this.name}-${varId}`,\n\t\t\t\t\tname     : `${this.name}-${varId}`,\n\t\t\t\t\trows     : 4,\n\t\t\t\t\t// cols     : 68, // instead of setting \"cols\" we set the `min-width` in CSS\n\t\t\t\t\ttabindex : 0 // for accessiblity\n\t\t\t\t})\n\t\t\t\t.addClass(`macro-${this.name}`)\n\t\t\t\t.on('change.macros', this.createShadowWrapper(function () {\n\t\t\t\t\tState.setVar(varName, this.value);\n\t\t\t\t}))\n\t\t\t\t.appendTo(this.output);\n\n\t\t\t/*\n\t\t\t\tSet the variable and textarea element to the default value.\n\t\t\t*/\n\t\t\tState.setVar(varName, defaultValue);\n\t\t\t// Ideally, we should be setting `.defaultValue` here, but IE doesn't support it,\n\t\t\t// so we have to use `.textContent`, which is equivalent.\n\t\t\tel.textContent = defaultValue;\n\n\t\t\t/*\n\t\t\t\tAutofocus the textarea element, if requested.\n\t\t\t*/\n\t\t\tif (autofocus) {\n\t\t\t\t// Set the element's \"autofocus\" attribute.\n\t\t\t\tel.setAttribute('autofocus', 'autofocus');\n\n\t\t\t\t// Set up a single-use post-display task to autofocus the element.\n\t\t\t\tpostdisplay[`#autofocus:${el.id}`] = task => {\n\t\t\t\t\tdelete postdisplay[task]; // single-use task\n\t\t\t\t\tsetTimeout(() => el.focus(), Engine.minDomActionDelay);\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t});\n\n\t/*\n\t\t[DEPRECATED] <<click>>\n\t*/\n\tMacro.add('click', 'link'); // add <<click>> as an alias of <<link>>\n\n\n\t/*******************************************************************************************************************\n\t\tLinks Macros.\n\t*******************************************************************************************************************/\n\t/*\n\t\t<<actions>>\n\t*/\n\tMacro.add('actions', {\n\t\thandler() {\n\t\t\tconst $list = jQuery(document.createElement('ul'))\n\t\t\t\t.addClass(this.name)\n\t\t\t\t.appendTo(this.output);\n\n\t\t\tfor (let i = 0; i < this.args.length; ++i) {\n\t\t\t\tlet passage;\n\t\t\t\tlet text;\n\t\t\t\tlet $image;\n\t\t\t\tlet setFn;\n\n\t\t\t\tif (typeof this.args[i] === 'object') {\n\t\t\t\t\tif (this.args[i].isImage) {\n\t\t\t\t\t\t// Argument was in wiki image syntax.\n\t\t\t\t\t\t$image = jQuery(document.createElement('img'))\n\t\t\t\t\t\t\t.attr('src', this.args[i].source);\n\n\t\t\t\t\t\tif (this.args[i].hasOwnProperty('passage')) {\n\t\t\t\t\t\t\t$image.attr('data-passage', this.args[i].passage);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (this.args[i].hasOwnProperty('title')) {\n\t\t\t\t\t\t\t$image.attr('title', this.args[i].title);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (this.args[i].hasOwnProperty('align')) {\n\t\t\t\t\t\t\t$image.attr('align', this.args[i].align);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpassage = this.args[i].link;\n\t\t\t\t\t\tsetFn   = this.args[i].setFn;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t// Argument was in wiki link syntax.\n\t\t\t\t\t\ttext    = this.args[i].text;\n\t\t\t\t\t\tpassage = this.args[i].link;\n\t\t\t\t\t\tsetFn   = this.args[i].setFn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t// Argument was simply the passage name.\n\t\t\t\t\ttext = passage = this.args[i];\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t   State.variables.hasOwnProperty('#actions')\n\t\t\t\t\t&& State.variables['#actions'].hasOwnProperty(passage)\n\t\t\t\t\t&& State.variables['#actions'][passage]\n\t\t\t\t) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst $link = jQuery(Wikifier.createInternalLink(\n\t\t\t\t\tjQuery(document.createElement('li')).appendTo($list),\n\t\t\t\t\tpassage,\n\t\t\t\t\tnull,\n\t\t\t\t\t((passage, fn) => () => {\n\t\t\t\t\t\tif (!State.variables.hasOwnProperty('#actions')) {\n\t\t\t\t\t\t\tState.variables['#actions'] = {};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tState.variables['#actions'][passage] = true;\n\n\t\t\t\t\t\tif (typeof fn === 'function') {\n\t\t\t\t\t\t\tfn();\n\t\t\t\t\t\t}\n\t\t\t\t\t})(passage, setFn)\n\t\t\t\t))\n\t\t\t\t\t.addClass(`macro-${this.name}`)\n\t\t\t\t\t.append($image || document.createTextNode(text));\n\n\t\t\t\tif ($image) {\n\t\t\t\t\t$link.addClass('link-image');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\t/*\n\t\t<<back>> & <<return>>\n\t*/\n\tMacro.add(['back', 'return'], {\n\t\thandler() {\n\t\t\t/* legacy */\n\t\t\tif (this.args.length > 1) {\n\t\t\t\treturn this.error('too many arguments specified, check the documentation for details');\n\t\t\t}\n\t\t\t/* /legacy */\n\n\t\t\tlet momentIndex = -1;\n\t\t\tlet passage;\n\t\t\tlet text;\n\t\t\tlet $image;\n\n\t\t\tif (this.args.length === 1) {\n\t\t\t\tif (typeof this.args[0] === 'object') {\n\t\t\t\t\tif (this.args[0].isImage) {\n\t\t\t\t\t\t// Argument was in wiki image syntax.\n\t\t\t\t\t\t$image = jQuery(document.createElement('img'))\n\t\t\t\t\t\t\t.attr('src', this.args[0].source);\n\n\t\t\t\t\t\tif (this.args[0].hasOwnProperty('passage')) {\n\t\t\t\t\t\t\t$image.attr('data-passage', this.args[0].passage);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (this.args[0].hasOwnProperty('title')) {\n\t\t\t\t\t\t\t$image.attr('title', this.args[0].title);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (this.args[0].hasOwnProperty('align')) {\n\t\t\t\t\t\t\t$image.attr('align', this.args[0].align);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (this.args[0].hasOwnProperty('link')) {\n\t\t\t\t\t\t\tpassage = this.args[0].link;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t// Argument was in wiki link syntax.\n\t\t\t\t\t\tif (this.args[0].count === 1) {\n\t\t\t\t\t\t\t// Simple link syntax: `[[...]]`.\n\t\t\t\t\t\t\tpassage = this.args[0].link;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t// Pretty link syntax: `[[...|...]]`.\n\t\t\t\t\t\t\ttext    = this.args[0].text;\n\t\t\t\t\t\t\tpassage = this.args[0].link;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (this.args.length === 1) {\n\t\t\t\t\t// Argument was simply the link text.\n\t\t\t\t\ttext = this.args[0];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (passage == null) { // lazy equality for null\n\t\t\t\t/*\n\t\t\t\t\tFind the index and title of the most recent moment whose title does not match\n\t\t\t\t\tthat of the active (present) moment's.\n\t\t\t\t*/\n\t\t\t\tfor (let i = State.length - 2; i >= 0; --i) {\n\t\t\t\t\tif (State.history[i].title !== State.passage) {\n\t\t\t\t\t\tmomentIndex = i;\n\t\t\t\t\t\tpassage = State.history[i].title;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// If we failed to find a passage and we're `<<return>>`, fallback to `State.expired`.\n\t\t\t\tif (passage == null && this.name === 'return') { // lazy equality for null\n\t\t\t\t\tfor (let i = State.expired.length - 1; i >= 0; --i) {\n\t\t\t\t\t\tif (State.expired[i] !== State.passage) {\n\t\t\t\t\t\t\tpassage = State.expired[i];\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (!Story.has(passage)) {\n\t\t\t\t\treturn this.error(`passage \"${passage}\" does not exist`);\n\t\t\t\t}\n\n\t\t\t\tif (this.name === 'back') {\n\t\t\t\t\t/*\n\t\t\t\t\t\tFind the index of the most recent moment whose title matches that of the\n\t\t\t\t\t\tspecified passage.\n\t\t\t\t\t*/\n\t\t\t\t\tfor (let i = State.length - 2; i >= 0; --i) {\n\t\t\t\t\t\tif (State.history[i].title === passage) {\n\t\t\t\t\t\t\tmomentIndex = i;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (momentIndex === -1) {\n\t\t\t\t\t\treturn this.error(`cannot find passage \"${passage}\" in the current story history`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (passage == null) { // lazy equality for null\n\t\t\t\treturn this.error('cannot find passage');\n\t\t\t}\n\n\t\t\t// if (this.name === \"back\" && momentIndex === -1) {\n\t\t\t// \t// no-op; we're already at the first passage in the current story history\n\t\t\t// \treturn;\n\t\t\t// }\n\n\t\t\tlet $link;\n\n\t\t\tif (this.name !== 'back' || momentIndex !== -1) {\n\t\t\t\t$link = jQuery(document.createElement('a'))\n\t\t\t\t\t.addClass('link-internal')\n\t\t\t\t\t.ariaClick(\n\t\t\t\t\t\t{ one : true },\n\t\t\t\t\t\tthis.name === 'return'\n\t\t\t\t\t\t\t? () => Engine.play(passage)\n\t\t\t\t\t\t\t: () => Engine.goTo(momentIndex)\n\t\t\t\t\t);\n\n\t\t\t\tif ($image) {\n\t\t\t\t\t$link.addClass('link-image');\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$link = jQuery(document.createElement('span'))\n\t\t\t\t\t.addClass('link-disabled');\n\t\t\t}\n\n\t\t\t$link\n\t\t\t\t.addClass(`macro-${this.name}`)\n\t\t\t\t.append($image || document.createTextNode(text || L10n.get(`macro${this.name.toUpperFirst()}Text`)))\n\t\t\t\t.appendTo(this.output);\n\t\t}\n\t});\n\n\t/*\n\t\t<<choice>>\n\t*/\n\tMacro.add('choice', {\n\t\thandler() {\n\t\t\tif (this.args.length === 0) {\n\t\t\t\treturn this.error('no passage specified');\n\t\t\t}\n\n\t\t\tconst choiceId = State.passage;\n\t\t\tlet passage;\n\t\t\tlet text;\n\t\t\tlet $image;\n\t\t\tlet setFn;\n\n\t\t\tif (this.args.length === 1) {\n\t\t\t\tif (typeof this.args[0] === 'object') {\n\t\t\t\t\tif (this.args[0].isImage) {\n\t\t\t\t\t\t// Argument was in wiki image syntax.\n\t\t\t\t\t\t$image = jQuery(document.createElement('img'))\n\t\t\t\t\t\t\t.attr('src', this.args[0].source);\n\n\t\t\t\t\t\tif (this.args[0].hasOwnProperty('passage')) {\n\t\t\t\t\t\t\t$image.attr('data-passage', this.args[0].passage);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (this.args[0].hasOwnProperty('title')) {\n\t\t\t\t\t\t\t$image.attr('title', this.args[0].title);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (this.args[0].hasOwnProperty('align')) {\n\t\t\t\t\t\t\t$image.attr('align', this.args[0].align);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpassage = this.args[0].link;\n\t\t\t\t\t\tsetFn   = this.args[0].setFn;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t// Argument was in wiki link syntax.\n\t\t\t\t\t\ttext    = this.args[0].text;\n\t\t\t\t\t\tpassage = this.args[0].link;\n\t\t\t\t\t\tsetFn   = this.args[0].setFn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t// Argument was simply the passage name.\n\t\t\t\t\ttext = passage = this.args[0];\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// NOTE: The arguments here are backwards.\n\t\t\t\tpassage = this.args[0];\n\t\t\t\ttext    = this.args[1];\n\t\t\t}\n\n\t\t\tlet $link;\n\n\t\t\tif (\n\t\t\t\t   State.variables.hasOwnProperty('#choice')\n\t\t\t\t&& State.variables['#choice'].hasOwnProperty(choiceId)\n\t\t\t\t&& State.variables['#choice'][choiceId]\n\t\t\t) {\n\t\t\t\t$link = jQuery(document.createElement('span'))\n\t\t\t\t\t.addClass(`link-disabled macro-${this.name}`)\n\t\t\t\t\t.attr('tabindex', -1)\n\t\t\t\t\t.append($image || document.createTextNode(text))\n\t\t\t\t\t.appendTo(this.output);\n\n\t\t\t\tif ($image) {\n\t\t\t\t\t$link.addClass('link-image');\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t$link = jQuery(Wikifier.createInternalLink(this.output, passage, null, () => {\n\t\t\t\tif (!State.variables.hasOwnProperty('#choice')) {\n\t\t\t\t\tState.variables['#choice'] = {};\n\t\t\t\t}\n\n\t\t\t\tState.variables['#choice'][choiceId] = true;\n\n\t\t\t\tif (typeof setFn === 'function') {\n\t\t\t\t\tsetFn();\n\t\t\t\t}\n\t\t\t}))\n\t\t\t\t.addClass(`macro-${this.name}`)\n\t\t\t\t.append($image || document.createTextNode(text));\n\n\t\t\tif ($image) {\n\t\t\t\t$link.addClass('link-image');\n\t\t\t}\n\t\t}\n\t});\n\n\n\t/*******************************************************************************************************************\n\t\tDOM Macros.\n\t*******************************************************************************************************************/\n\t/*\n\t\t<<addclass>> & <<toggleclass>>\n\t*/\n\tMacro.add(['addclass', 'toggleclass'], {\n\t\thandler() {\n\t\t\tif (this.args.length < 2) {\n\t\t\t\tconst errors = [];\n\t\t\t\tif (this.args.length < 1) { errors.push('selector'); }\n\t\t\t\tif (this.args.length < 2) { errors.push('class names'); }\n\t\t\t\treturn this.error(`no ${errors.join(' or ')} specified`);\n\t\t\t}\n\n\t\t\tconst $targets = jQuery(this.args[0]);\n\n\t\t\tif ($targets.length === 0) {\n\t\t\t\treturn this.error(`no elements matched the selector \"${this.args[0]}\"`);\n\t\t\t}\n\n\t\t\tswitch (this.name) {\n\t\t\tcase 'addclass':\n\t\t\t\t$targets.addClass(this.args[1].trim());\n\t\t\t\tbreak;\n\n\t\t\tcase 'toggleclass':\n\t\t\t\t$targets.toggleClass(this.args[1].trim());\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// Custom debug view setup.\n\t\t\tif (Config.debug) {\n\t\t\t\tthis.debugView.modes({ hidden : true });\n\t\t\t}\n\t\t}\n\t});\n\n\t/*\n\t\t<<removeclass>>\n\t*/\n\tMacro.add('removeclass', {\n\t\thandler() {\n\t\t\tif (this.args.length === 0) {\n\t\t\t\treturn this.error('no selector specified');\n\t\t\t}\n\n\t\t\tconst $targets = jQuery(this.args[0]);\n\n\t\t\tif ($targets.length === 0) {\n\t\t\t\treturn this.error(`no elements matched the selector \"${this.args[0]}\"`);\n\t\t\t}\n\n\t\t\tif (this.args.length > 1) {\n\t\t\t\t$targets.removeClass(this.args[1].trim());\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$targets.removeClass();\n\t\t\t}\n\n\t\t\t// Custom debug view setup.\n\t\t\tif (Config.debug) {\n\t\t\t\tthis.debugView.modes({ hidden : true });\n\t\t\t}\n\t\t}\n\t});\n\n\t/*\n\t\t<<copy>>\n\t*/\n\tMacro.add('copy', {\n\t\thandler() {\n\t\t\tif (this.args.length === 0) {\n\t\t\t\treturn this.error('no selector specified');\n\t\t\t}\n\n\t\t\tconst $targets = jQuery(this.args[0]);\n\n\t\t\tif ($targets.length === 0) {\n\t\t\t\treturn this.error(`no elements matched the selector \"${this.args[0]}\"`);\n\t\t\t}\n\n\t\t\tjQuery(this.output).append($targets.html());\n\n\t\t\t// Custom debug view setup.\n\t\t\tif (Config.debug) {\n\t\t\t\tthis.debugView.modes({ hidden : true });\n\t\t\t}\n\t\t}\n\t});\n\n\t/*\n\t\t<<append>>, <<prepend>>, & <<replace>>\n\t*/\n\tMacro.add(['append', 'prepend', 'replace'], {\n\t\ttags  : null,\n\t\tt8nRe : /^(?:transition|t8n)$/,\n\n\t\thandler() {\n\t\t\tif (this.args.length === 0) {\n\t\t\t\treturn this.error('no selector specified');\n\t\t\t}\n\n\t\t\tconst $targets = jQuery(this.args[0]);\n\n\t\t\tif ($targets.length === 0) {\n\t\t\t\treturn this.error(`no elements matched the selector \"${this.args[0]}\"`);\n\t\t\t}\n\n\t\t\tif (this.payload[0].contents !== '') {\n\t\t\t\tconst transition = this.args.length > 1 && this.self.t8nRe.test(this.args[1]);\n\t\t\t\tlet $insert;\n\n\t\t\t\tif (transition) {\n\t\t\t\t\t$insert = jQuery(document.createElement('span'));\n\t\t\t\t\t$insert.addClass(`macro-${this.name}-insert macro-${this.name}-in`);\n\t\t\t\t\tsetTimeout(() => $insert.removeClass(`macro-${this.name}-in`), Engine.minDomActionDelay);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$insert = jQuery(document.createDocumentFragment());\n\t\t\t\t}\n\n\t\t\t\t$insert.wiki(this.payload[0].contents);\n\n\t\t\t\tswitch (this.name) {\n\t\t\t\tcase 'replace':\n\t\t\t\t\t$targets.empty();\n\t\t\t\t\t/* falls through */\n\n\t\t\t\tcase 'append':\n\t\t\t\t\t$targets.append($insert);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'prepend':\n\t\t\t\t\t$targets.prepend($insert);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (this.name === 'replace') {\n\t\t\t\t$targets.empty();\n\t\t\t}\n\n\t\t\t// Custom debug view setup.\n\t\t\tif (Config.debug) {\n\t\t\t\tthis.debugView.modes({ hidden : true });\n\t\t\t}\n\n\t\t\t// re-number links\n\t\t\tLinks.generate();\n\t\t}\n\t});\n\n\t/*\n\t\t<<remove>>\n\t*/\n\tMacro.add('remove', {\n\t\thandler() {\n\t\t\tif (this.args.length === 0) {\n\t\t\t\treturn this.error('no selector specified');\n\t\t\t}\n\n\t\t\tconst $targets = jQuery(this.args[0]);\n\n\t\t\tif ($targets.length === 0) {\n\t\t\t\treturn this.error(`no elements matched the selector \"${this.args[0]}\"`);\n\t\t\t}\n\n\t\t\t$targets.remove();\n\n\t\t\t// Custom debug view setup.\n\t\t\tif (Config.debug) {\n\t\t\t\tthis.debugView.modes({ hidden : true });\n\t\t\t}\n\t\t}\n\t});\n\n\n\t/*******************************************************************************************************************\n\t\tAudio Macros.\n\t*******************************************************************************************************************/\n\tif (Has.audio) {\n\t\tconst errorOnePlaybackAction = (cur, prev) => `only one playback action allowed per invocation, \"${cur}\" cannot be combined with \"${prev}\"`;\n\n\t\t/*\n\t\t\t<<audio>>\n\t\t*/\n\t\tMacro.add('audio', {\n\t\t\thandler() {\n\t\t\t\tif (this.args.length < 2) {\n\t\t\t\t\tconst errors = [];\n\t\t\t\t\tif (this.args.length < 1) { errors.push('track and/or group IDs'); }\n\t\t\t\t\tif (this.args.length < 2) { errors.push('actions'); }\n\t\t\t\t\treturn this.error(`no ${errors.join(' or ')} specified`);\n\t\t\t\t}\n\n\t\t\t\tlet selected;\n\n\t\t\t\t// Process the track and/or group IDs.\n\t\t\t\ttry {\n\t\t\t\t\tselected = SimpleAudio.select(this.args[0]);\n\t\t\t\t}\n\t\t\t\tcatch (ex) {\n\t\t\t\t\treturn this.error(ex.message);\n\t\t\t\t}\n\n\t\t\t\tconst args = this.args.slice(1);\n\t\t\t\tlet action;\n\t\t\t\tlet fadeOver = 5;\n\t\t\t\tlet fadeTo;\n\t\t\t\tlet loop;\n\t\t\t\tlet mute;\n\t\t\t\tlet passage;\n\t\t\t\tlet time;\n\t\t\t\tlet volume;\n\n\t\t\t\t// Process arguments.\n\t\t\t\twhile (args.length > 0) {\n\t\t\t\t\tconst arg = args.shift();\n\t\t\t\t\tlet raw;\n\n\t\t\t\t\tswitch (arg) {\n\t\t\t\t\tcase 'load':\n\t\t\t\t\tcase 'pause':\n\t\t\t\t\tcase 'play':\n\t\t\t\t\tcase 'stop':\n\t\t\t\t\tcase 'unload':\n\t\t\t\t\t\tif (action) {\n\t\t\t\t\t\t\treturn this.error(errorOnePlaybackAction(arg, action));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\taction = arg;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'fadein':\n\t\t\t\t\t\tif (action) {\n\t\t\t\t\t\t\treturn this.error(errorOnePlaybackAction(arg, action));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\taction = 'fade';\n\t\t\t\t\t\tfadeTo = 1;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'fadeout':\n\t\t\t\t\t\tif (action) {\n\t\t\t\t\t\t\treturn this.error(errorOnePlaybackAction(arg, action));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\taction = 'fade';\n\t\t\t\t\t\tfadeTo = 0;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'fadeto':\n\t\t\t\t\t\tif (action) {\n\t\t\t\t\t\t\treturn this.error(errorOnePlaybackAction(arg, action));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (args.length === 0) {\n\t\t\t\t\t\t\treturn this.error('fadeto missing required level value');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\taction = 'fade';\n\t\t\t\t\t\traw = args.shift();\n\t\t\t\t\t\tfadeTo = Number.parseFloat(raw);\n\n\t\t\t\t\t\tif (Number.isNaN(fadeTo) || !Number.isFinite(fadeTo)) {\n\t\t\t\t\t\t\treturn this.error(`cannot parse fadeto: ${raw}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'fadeoverto':\n\t\t\t\t\t\tif (action) {\n\t\t\t\t\t\t\treturn this.error(errorOnePlaybackAction(arg, action));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (args.length < 2) {\n\t\t\t\t\t\t\tconst errors = [];\n\t\t\t\t\t\t\tif (args.length < 1) { errors.push('seconds'); }\n\t\t\t\t\t\t\tif (args.length < 2) { errors.push('level'); }\n\t\t\t\t\t\t\treturn this.error(`fadeoverto missing required ${errors.join(' and ')} value${errors.length > 1 ? 's' : ''}`);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\taction = 'fade';\n\t\t\t\t\t\traw = args.shift();\n\t\t\t\t\t\tfadeOver = Number.parseFloat(raw);\n\n\t\t\t\t\t\tif (Number.isNaN(fadeOver) || !Number.isFinite(fadeOver)) {\n\t\t\t\t\t\t\treturn this.error(`cannot parse fadeoverto: ${raw}`);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\traw = args.shift();\n\t\t\t\t\t\tfadeTo = Number.parseFloat(raw);\n\n\t\t\t\t\t\tif (Number.isNaN(fadeTo) || !Number.isFinite(fadeTo)) {\n\t\t\t\t\t\t\treturn this.error(`cannot parse fadeoverto: ${raw}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'volume':\n\t\t\t\t\t\tif (args.length === 0) {\n\t\t\t\t\t\t\treturn this.error('volume missing required level value');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\traw = args.shift();\n\t\t\t\t\t\tvolume = Number.parseFloat(raw);\n\n\t\t\t\t\t\tif (Number.isNaN(volume) || !Number.isFinite(volume)) {\n\t\t\t\t\t\t\treturn this.error(`cannot parse volume: ${raw}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'mute':\n\t\t\t\t\tcase 'unmute':\n\t\t\t\t\t\tmute = arg === 'mute';\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'time':\n\t\t\t\t\t\tif (args.length === 0) {\n\t\t\t\t\t\t\treturn this.error('time missing required seconds value');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\traw = args.shift();\n\t\t\t\t\t\ttime = Number.parseFloat(raw);\n\n\t\t\t\t\t\tif (Number.isNaN(time) || !Number.isFinite(time)) {\n\t\t\t\t\t\t\treturn this.error(`cannot parse time: ${raw}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'loop':\n\t\t\t\t\tcase 'unloop':\n\t\t\t\t\t\tloop = arg === 'loop';\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'goto':\n\t\t\t\t\t\tif (args.length === 0) {\n\t\t\t\t\t\t\treturn this.error('goto missing required passage title');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\traw = args.shift();\n\n\t\t\t\t\t\tif (typeof raw === 'object') {\n\t\t\t\t\t\t\t// Argument was in wiki link syntax.\n\t\t\t\t\t\t\tpassage = raw.link;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t// Argument was simply the passage name.\n\t\t\t\t\t\t\tpassage = raw;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!Story.has(passage)) {\n\t\t\t\t\t\t\treturn this.error(`passage \"${passage}\" does not exist`);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn this.error(`unknown action: ${arg}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tif (volume != null) { // lazy equality for null\n\t\t\t\t\t\tselected.volume(volume);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (time != null) { // lazy equality for null\n\t\t\t\t\t\tselected.time(time);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (mute != null) { // lazy equality for null\n\t\t\t\t\t\tselected.mute(mute);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (loop != null) { // lazy equality for null\n\t\t\t\t\t\tselected.loop(loop);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (passage != null) { // lazy equality for null\n\t\t\t\t\t\tconst nsEnded = `ended.macros.macro-${this.name}_goto`;\n\t\t\t\t\t\tselected\n\t\t\t\t\t\t\t.off(nsEnded)\n\t\t\t\t\t\t\t.one(nsEnded, () => {\n\t\t\t\t\t\t\t\tselected.off(nsEnded);\n\t\t\t\t\t\t\t\tEngine.play(passage);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tswitch (action) {\n\t\t\t\t\tcase 'fade':\n\t\t\t\t\t\tselected.fade(fadeOver, fadeTo);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'load':\n\t\t\t\t\t\tselected.load();\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'pause':\n\t\t\t\t\t\tselected.pause();\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'play':\n\t\t\t\t\t\tselected.playWhenAllowed();\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'stop':\n\t\t\t\t\t\tselected.stop();\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'unload':\n\t\t\t\t\t\tselected.unload();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Custom debug view setup.\n\t\t\t\t\tif (Config.debug) {\n\t\t\t\t\t\tthis.debugView.modes({ hidden : true });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (ex) {\n\t\t\t\t\treturn this.error(`error executing action: ${ex.message}`);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t/*\n\t\t\t<<cacheaudio track_id source_list>>\n\t\t*/\n\t\tMacro.add('cacheaudio', {\n\t\t\thandler() {\n\t\t\t\tif (this.args.length < 2) {\n\t\t\t\t\tconst errors = [];\n\t\t\t\t\tif (this.args.length < 1) { errors.push('track ID'); }\n\t\t\t\t\tif (this.args.length < 2) { errors.push('sources'); }\n\t\t\t\t\treturn this.error(`no ${errors.join(' or ')} specified`);\n\t\t\t\t}\n\n\t\t\t\tconst id       = String(this.args[0]).trim();\n\t\t\t\tconst oldFmtRe = /^format:\\s*([\\w-]+)\\s*;\\s*/i;\n\n\t\t\t\ttry {\n\t\t\t\t\tSimpleAudio.tracks.add(id, this.args.slice(1).map(source => {\n\t\t\t\t\t\t/* legacy */\n\t\t\t\t\t\t// Transform an old format specifier into the new style.\n\t\t\t\t\t\tif (oldFmtRe.test(source)) {\n\t\t\t\t\t\t\t// If in Test Mode, return an error.\n\t\t\t\t\t\t\tif (Config.debug) {\n\t\t\t\t\t\t\t\treturn this.error(`track ID \"${id}\": format specifier migration required, \"format:formatId;\" \\u2192 \"formatId|\"`);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsource = source.replace(oldFmtRe, '$1|'); // eslint-disable-line no-param-reassign\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn source;\n\t\t\t\t\t\t/* /legacy */\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\tcatch (ex) {\n\t\t\t\t\treturn this.error(ex.message);\n\t\t\t\t}\n\n\t\t\t\t// If in Test Mode and no supported sources were specified, return an error.\n\t\t\t\tif (Config.debug && !SimpleAudio.tracks.get(id).hasSource()) {\n\t\t\t\t\treturn this.error(`track ID \"${id}\": no supported audio sources found`);\n\t\t\t\t}\n\n\t\t\t\t// Custom debug view setup.\n\t\t\t\tif (Config.debug) {\n\t\t\t\t\tthis.debugView.modes({ hidden : true });\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t/*\n\t\t\t<<createaudiogroup group_id>>\n\t\t\t\t<<track track_id>>\n\t\t\t\t…\n\t\t\t<</createaudiogroup>>\n\t\t*/\n\t\tMacro.add('createaudiogroup', {\n\t\t\ttags : ['track'],\n\n\t\t\thandler() {\n\t\t\t\tif (this.args.length === 0) {\n\t\t\t\t\treturn this.error('no group ID specified');\n\t\t\t\t}\n\n\t\t\t\tif (this.payload.length === 1) {\n\t\t\t\t\treturn this.error('no tracks defined via <<track>>');\n\t\t\t\t}\n\n\t\t\t\t// Initial debug view setup for `<<createaudiogroup>>`.\n\t\t\t\tif (Config.debug) {\n\t\t\t\t\tthis.debugView\n\t\t\t\t\t\t.modes({\n\t\t\t\t\t\t\tnonvoid : false,\n\t\t\t\t\t\t\thidden  : true\n\t\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconst groupId  = String(this.args[0]).trim();\n\t\t\t\tconst trackIds = [];\n\n\t\t\t\tfor (let i = 1, len = this.payload.length; i < len; ++i) {\n\t\t\t\t\tif (this.payload[i].args.length < 1) {\n\t\t\t\t\t\treturn this.error('no track ID specified');\n\t\t\t\t\t}\n\n\t\t\t\t\ttrackIds.push(String(this.payload[i].args[0]).trim());\n\n\t\t\t\t\t// Custom debug view setup for the current `<<track>>`.\n\t\t\t\t\tif (Config.debug) {\n\t\t\t\t\t\tthis\n\t\t\t\t\t\t\t.createDebugView(this.payload[i].name, this.payload[i].source)\n\t\t\t\t\t\t\t.modes({\n\t\t\t\t\t\t\t\tnonvoid : false,\n\t\t\t\t\t\t\t\thidden  : true\n\t\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tSimpleAudio.groups.add(groupId, trackIds);\n\t\t\t\t}\n\t\t\t\tcatch (ex) {\n\t\t\t\t\treturn this.error(ex.message);\n\t\t\t\t}\n\n\t\t\t\t// Custom fake debug view setup for `<</createaudiogroup>>`.\n\t\t\t\tif (Config.debug) {\n\t\t\t\t\tthis\n\t\t\t\t\t\t.createDebugView(`/${this.name}`, `<</${this.name}>>`)\n\t\t\t\t\t\t.modes({\n\t\t\t\t\t\t\tnonvoid : false,\n\t\t\t\t\t\t\thidden  : true\n\t\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t/*\n\t\t\t<<createplaylist list_id>>\n\t\t\t\t<<track track_id action_list>>\n\t\t\t\t…\n\t\t\t<</createplaylist>>\n\t\t*/\n\t\tMacro.add('createplaylist', {\n\t\t\ttags : ['track'],\n\n\t\t\thandler() {\n\t\t\t\tif (this.args.length === 0) {\n\t\t\t\t\treturn this.error('no list ID specified');\n\t\t\t\t}\n\n\t\t\t\tif (this.payload.length === 1) {\n\t\t\t\t\treturn this.error('no tracks defined via <<track>>');\n\t\t\t\t}\n\n\t\t\t\tconst playlist = Macro.get('playlist');\n\n\t\t\t\tif (playlist.from !== null && playlist.from !== 'createplaylist') {\n\t\t\t\t\treturn this.error('a playlist has already been defined with <<setplaylist>>');\n\t\t\t\t}\n\n\t\t\t\t// Initial debug view setup for `<<createplaylist>>`.\n\t\t\t\tif (Config.debug) {\n\t\t\t\t\tthis.debugView\n\t\t\t\t\t\t.modes({\n\t\t\t\t\t\t\tnonvoid : false,\n\t\t\t\t\t\t\thidden  : true\n\t\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconst listId    = String(this.args[0]).trim();\n\t\t\t\tconst trackObjs = [];\n\n\t\t\t\tfor (let i = 1, len = this.payload.length; i < len; ++i) {\n\t\t\t\t\tif (this.payload[i].args.length === 0) {\n\t\t\t\t\t\treturn this.error('no track ID specified');\n\t\t\t\t\t}\n\n\t\t\t\t\tconst trackObj = { id : String(this.payload[i].args[0]).trim() };\n\t\t\t\t\tconst args     = this.payload[i].args.slice(1);\n\n\t\t\t\t\t// Process arguments.\n\t\t\t\t\twhile (args.length > 0) {\n\t\t\t\t\t\tconst arg = args.shift();\n\t\t\t\t\t\tlet raw;\n\t\t\t\t\t\tlet parsed;\n\n\t\t\t\t\t\tswitch (arg) {\n\t\t\t\t\t\tcase 'copy': // [DEPRECATED]\n\t\t\t\t\t\tcase 'own':\n\t\t\t\t\t\t\ttrackObj.own = true;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase 'rate':\n\t\t\t\t\t\t\t// if (args.length === 0) {\n\t\t\t\t\t\t\t// \treturn this.error('rate missing required speed value');\n\t\t\t\t\t\t\t// }\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t// raw = args.shift();\n\t\t\t\t\t\t\t// parsed = Number.parseFloat(raw);\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t// if (Number.isNaN(parsed) || !Number.isFinite(parsed)) {\n\t\t\t\t\t\t\t// \treturn this.error(`cannot parse rate: ${raw}`);\n\t\t\t\t\t\t\t// }\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t// trackObj.rate = parsed;\n\t\t\t\t\t\t\tif (args.length > 0) {\n\t\t\t\t\t\t\t\targs.shift();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase 'volume':\n\t\t\t\t\t\t\tif (args.length === 0) {\n\t\t\t\t\t\t\t\treturn this.error('volume missing required level value');\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\traw = args.shift();\n\t\t\t\t\t\t\tparsed = Number.parseFloat(raw);\n\n\t\t\t\t\t\t\tif (Number.isNaN(parsed) || !Number.isFinite(parsed)) {\n\t\t\t\t\t\t\t\treturn this.error(`cannot parse volume: ${raw}`);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\ttrackObj.volume = parsed;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn this.error(`unknown action: ${arg}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\ttrackObjs.push(trackObj);\n\n\t\t\t\t\t// Custom debug view setup for the current `<<track>>`.\n\t\t\t\t\tif (Config.debug) {\n\t\t\t\t\t\tthis\n\t\t\t\t\t\t\t.createDebugView(this.payload[i].name, this.payload[i].source)\n\t\t\t\t\t\t\t.modes({\n\t\t\t\t\t\t\t\tnonvoid : false,\n\t\t\t\t\t\t\t\thidden  : true\n\t\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tSimpleAudio.lists.add(listId, trackObjs);\n\t\t\t\t}\n\t\t\t\tcatch (ex) {\n\t\t\t\t\treturn this.error(ex.message);\n\t\t\t\t}\n\n\t\t\t\t// Lock `<<playlist>>` into our syntax.\n\t\t\t\tif (playlist.from === null) {\n\t\t\t\t\tplaylist.from = 'createplaylist';\n\t\t\t\t}\n\n\t\t\t\t// Custom fake debug view setup for `<</createplaylist>>`.\n\t\t\t\tif (Config.debug) {\n\t\t\t\t\tthis\n\t\t\t\t\t\t.createDebugView(`/${this.name}`, `<</${this.name}>>`)\n\t\t\t\t\t\t.modes({\n\t\t\t\t\t\t\tnonvoid : false,\n\t\t\t\t\t\t\thidden  : true\n\t\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t/*\n\t\t\t<<masteraudio action_list>>\n\t\t*/\n\t\tMacro.add('masteraudio', {\n\t\t\thandler() {\n\t\t\t\tif (this.args.length === 0) {\n\t\t\t\t\treturn this.error('no actions specified');\n\t\t\t\t}\n\n\t\t\t\tconst args = this.args.slice(0);\n\t\t\t\tlet action;\n\t\t\t\tlet mute;\n\t\t\t\tlet muteOnHide;\n\t\t\t\tlet volume;\n\n\t\t\t\t// Process arguments.\n\t\t\t\twhile (args.length > 0) {\n\t\t\t\t\tconst arg = args.shift();\n\t\t\t\t\tlet raw;\n\n\t\t\t\t\tswitch (arg) {\n\t\t\t\t\tcase 'load':\n\t\t\t\t\tcase 'stop':\n\t\t\t\t\tcase 'unload':\n\t\t\t\t\t\tif (action) {\n\t\t\t\t\t\t\treturn this.error(errorOnePlaybackAction(arg, action));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\taction = arg;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'mute':\n\t\t\t\t\tcase 'unmute':\n\t\t\t\t\t\tmute = arg === 'mute';\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'muteonhide':\n\t\t\t\t\tcase 'nomuteonhide':\n\t\t\t\t\t\tmuteOnHide = arg === 'muteonhide';\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'volume':\n\t\t\t\t\t\tif (args.length === 0) {\n\t\t\t\t\t\t\treturn this.error('volume missing required level value');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\traw = args.shift();\n\t\t\t\t\t\tvolume = Number.parseFloat(raw);\n\n\t\t\t\t\t\tif (Number.isNaN(volume) || !Number.isFinite(volume)) {\n\t\t\t\t\t\t\treturn this.error(`cannot parse volume: ${raw}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn this.error(`unknown action: ${arg}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tif (mute != null) { // lazy equality for null\n\t\t\t\t\t\tSimpleAudio.mute(mute);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (muteOnHide != null) { // lazy equality for null\n\t\t\t\t\t\tSimpleAudio.muteOnHidden(muteOnHide);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (volume != null) { // lazy equality for null\n\t\t\t\t\t\tSimpleAudio.volume(volume);\n\t\t\t\t\t}\n\n\t\t\t\t\tswitch (action) {\n\t\t\t\t\tcase 'load':\n\t\t\t\t\t\tSimpleAudio.load();\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'stop':\n\t\t\t\t\t\tSimpleAudio.stop();\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'unload':\n\t\t\t\t\t\tSimpleAudio.unload();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Custom debug view setup.\n\t\t\t\t\tif (Config.debug) {\n\t\t\t\t\t\tthis.debugView.modes({ hidden : true });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (ex) {\n\t\t\t\t\treturn this.error(`error executing action: ${ex.message}`);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t/*\n\t\t\t<<playlist list_id action_list>>  ← <<createplaylist>> syntax\n\t\t\t<<playlist action_list>>          ← <<setplaylist>> syntax\n\t\t*/\n\t\tMacro.add('playlist', {\n\t\t\tfrom : null,\n\n\t\t\thandler() {\n\t\t\t\tconst from = this.self.from;\n\n\t\t\t\tif (from === null) {\n\t\t\t\t\treturn this.error('no playlists have been created');\n\t\t\t\t}\n\n\t\t\t\tlet list;\n\t\t\t\tlet args;\n\n\t\t\t\tif (from === 'createplaylist') {\n\t\t\t\t\tif (this.args.length < 2) {\n\t\t\t\t\t\tconst errors = [];\n\t\t\t\t\t\tif (this.args.length < 1) { errors.push('list ID'); }\n\t\t\t\t\t\tif (this.args.length < 2) { errors.push('actions'); }\n\t\t\t\t\t\treturn this.error(`no ${errors.join(' or ')} specified`);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst id = String(this.args[0]).trim();\n\n\t\t\t\t\tif (!SimpleAudio.lists.has(id)) {\n\t\t\t\t\t\treturn this.error(`playlist \"${id}\" does not exist`);\n\t\t\t\t\t}\n\n\t\t\t\t\tlist = SimpleAudio.lists.get(id);\n\t\t\t\t\targs = this.args.slice(1);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (this.args.length === 0) {\n\t\t\t\t\t\treturn this.error('no actions specified');\n\t\t\t\t\t}\n\n\t\t\t\t\tlist = SimpleAudio.lists.get('setplaylist');\n\t\t\t\t\targs = this.args.slice(0);\n\t\t\t\t}\n\n\t\t\t\tlet action;\n\t\t\t\tlet fadeOver = 5;\n\t\t\t\tlet fadeTo;\n\t\t\t\tlet loop;\n\t\t\t\tlet mute;\n\t\t\t\tlet shuffle;\n\t\t\t\tlet volume;\n\n\t\t\t\t// Process arguments.\n\t\t\t\twhile (args.length > 0) {\n\t\t\t\t\tconst arg = args.shift();\n\t\t\t\t\tlet raw;\n\n\t\t\t\t\tswitch (arg) {\n\t\t\t\t\tcase 'load':\n\t\t\t\t\tcase 'pause':\n\t\t\t\t\tcase 'play':\n\t\t\t\t\tcase 'skip':\n\t\t\t\t\tcase 'stop':\n\t\t\t\t\tcase 'unload':\n\t\t\t\t\t\tif (action) {\n\t\t\t\t\t\t\treturn this.error(errorOnePlaybackAction(arg, action));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\taction = arg;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'fadein':\n\t\t\t\t\t\tif (action) {\n\t\t\t\t\t\t\treturn this.error(errorOnePlaybackAction(arg, action));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\taction = 'fade';\n\t\t\t\t\t\tfadeTo = 1;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'fadeout':\n\t\t\t\t\t\tif (action) {\n\t\t\t\t\t\t\treturn this.error(errorOnePlaybackAction(arg, action));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\taction = 'fade';\n\t\t\t\t\t\tfadeTo = 0;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'fadeto':\n\t\t\t\t\t\tif (action) {\n\t\t\t\t\t\t\treturn this.error(errorOnePlaybackAction(arg, action));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (args.length === 0) {\n\t\t\t\t\t\t\treturn this.error('fadeto missing required level value');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\taction = 'fade';\n\t\t\t\t\t\traw = args.shift();\n\t\t\t\t\t\tfadeTo = Number.parseFloat(raw);\n\n\t\t\t\t\t\tif (Number.isNaN(fadeTo) || !Number.isFinite(fadeTo)) {\n\t\t\t\t\t\t\treturn this.error(`cannot parse fadeto: ${raw}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'fadeoverto':\n\t\t\t\t\t\tif (action) {\n\t\t\t\t\t\t\treturn this.error(errorOnePlaybackAction(arg, action));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (args.length < 2) {\n\t\t\t\t\t\t\tconst errors = [];\n\t\t\t\t\t\t\tif (args.length < 1) { errors.push('seconds'); }\n\t\t\t\t\t\t\tif (args.length < 2) { errors.push('level'); }\n\t\t\t\t\t\t\treturn this.error(`fadeoverto missing required ${errors.join(' and ')} value${errors.length > 1 ? 's' : ''}`);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\taction = 'fade';\n\t\t\t\t\t\traw = args.shift();\n\t\t\t\t\t\tfadeOver = Number.parseFloat(raw);\n\n\t\t\t\t\t\tif (Number.isNaN(fadeOver) || !Number.isFinite(fadeOver)) {\n\t\t\t\t\t\t\treturn this.error(`cannot parse fadeoverto: ${raw}`);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\traw = args.shift();\n\t\t\t\t\t\tfadeTo = Number.parseFloat(raw);\n\n\t\t\t\t\t\tif (Number.isNaN(fadeTo) || !Number.isFinite(fadeTo)) {\n\t\t\t\t\t\t\treturn this.error(`cannot parse fadeoverto: ${raw}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'volume':\n\t\t\t\t\t\tif (args.length === 0) {\n\t\t\t\t\t\t\treturn this.error('volume missing required level value');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\traw = args.shift();\n\t\t\t\t\t\tvolume = Number.parseFloat(raw);\n\n\t\t\t\t\t\tif (Number.isNaN(volume) || !Number.isFinite(volume)) {\n\t\t\t\t\t\t\treturn this.error(`cannot parse volume: ${raw}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'mute':\n\t\t\t\t\tcase 'unmute':\n\t\t\t\t\t\tmute = arg === 'mute';\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'loop':\n\t\t\t\t\tcase 'unloop':\n\t\t\t\t\t\tloop = arg === 'loop';\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'shuffle':\n\t\t\t\t\tcase 'unshuffle':\n\t\t\t\t\t\tshuffle = arg === 'shuffle';\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn this.error(`unknown action: ${arg}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tif (volume != null) { // lazy equality for null\n\t\t\t\t\t\tlist.volume(volume);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (mute != null) { // lazy equality for null\n\t\t\t\t\t\tlist.mute(mute);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (loop != null) { // lazy equality for null\n\t\t\t\t\t\tlist.loop(loop);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (shuffle != null) { // lazy equality for null\n\t\t\t\t\t\tlist.shuffle(shuffle);\n\t\t\t\t\t}\n\n\t\t\t\t\tswitch (action) {\n\t\t\t\t\tcase 'fade':\n\t\t\t\t\t\tlist.fade(fadeOver, fadeTo);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'load':\n\t\t\t\t\t\tlist.load();\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'pause':\n\t\t\t\t\t\tlist.pause();\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'play':\n\t\t\t\t\t\tlist.playWhenAllowed();\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'skip':\n\t\t\t\t\t\tlist.skip();\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'stop':\n\t\t\t\t\t\tlist.stop();\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'unload':\n\t\t\t\t\t\tlist.unload();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Custom debug view setup.\n\t\t\t\t\tif (Config.debug) {\n\t\t\t\t\t\tthis.debugView.modes({ hidden : true });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (ex) {\n\t\t\t\t\treturn this.error(`error executing action: ${ex.message}`);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t/*\n\t\t\t<<removeaudiogroup group_id>>\n\t\t*/\n\t\tMacro.add('removeaudiogroup', {\n\t\t\thandler() {\n\t\t\t\tif (this.args.length === 0) {\n\t\t\t\t\treturn this.error('no group ID specified');\n\t\t\t\t}\n\n\t\t\t\tconst id = String(this.args[0]).trim();\n\n\t\t\t\tif (!SimpleAudio.groups.has(id)) {\n\t\t\t\t\treturn this.error(`group \"${id}\" does not exist`);\n\t\t\t\t}\n\n\t\t\t\tSimpleAudio.groups.delete(id);\n\n\t\t\t\t// Custom debug view setup.\n\t\t\t\tif (Config.debug) {\n\t\t\t\t\tthis.debugView.modes({ hidden : true });\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t/*\n\t\t\t<<removeplaylist list_id>>\n\t\t*/\n\t\tMacro.add('removeplaylist', {\n\t\t\thandler() {\n\t\t\t\tif (this.args.length === 0) {\n\t\t\t\t\treturn this.error('no list ID specified');\n\t\t\t\t}\n\n\t\t\t\tconst id = String(this.args[0]).trim();\n\n\t\t\t\tif (!SimpleAudio.lists.has(id)) {\n\t\t\t\t\treturn this.error(`playlist \"${id}\" does not exist`);\n\t\t\t\t}\n\n\t\t\t\tSimpleAudio.lists.delete(id);\n\n\t\t\t\t// Custom debug view setup.\n\t\t\t\tif (Config.debug) {\n\t\t\t\t\tthis.debugView.modes({ hidden : true });\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t/*\n\t\t\t<<waitforaudio>>\n\t\t*/\n\t\tMacro.add('waitforaudio', {\n\t\t\tskipArgs : true,\n\n\t\t\thandler() {\n\t\t\t\tSimpleAudio.loadWithScreen();\n\t\t\t}\n\t\t});\n\n\t\t/*\n\t\t\t[DEPRECATED] <<setplaylist track_id_list>>\n\t\t*/\n\t\tMacro.add('setplaylist', {\n\t\t\thandler() {\n\t\t\t\tif (this.args.length === 0) {\n\t\t\t\t\treturn this.error('no track ID(s) specified');\n\t\t\t\t}\n\n\t\t\t\tconst playlist = Macro.get('playlist');\n\n\t\t\t\tif (playlist.from !== null && playlist.from !== 'setplaylist') {\n\t\t\t\t\treturn this.error('playlists have already been defined with <<createplaylist>>');\n\t\t\t\t}\n\n\t\t\t\t// Create the new playlist.\n\t\t\t\ttry {\n\t\t\t\t\tSimpleAudio.lists.add('setplaylist', this.args.slice(0));\n\t\t\t\t}\n\t\t\t\tcatch (ex) {\n\t\t\t\t\treturn this.error(ex.message);\n\t\t\t\t}\n\n\t\t\t\t// Lock `<<playlist>>` into our syntax.\n\t\t\t\tif (playlist.from === null) {\n\t\t\t\t\tplaylist.from = 'setplaylist';\n\t\t\t\t}\n\n\t\t\t\t// Custom debug view setup.\n\t\t\t\tif (Config.debug) {\n\t\t\t\t\tthis.debugView.modes({ hidden : true });\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t/*\n\t\t\t[DEPRECATED] <<stopallaudio>>\n\t\t*/\n\t\tMacro.add('stopallaudio', {\n\t\t\tskipArgs : true,\n\n\t\t\thandler() {\n\t\t\t\tSimpleAudio.select(':all').stop();\n\n\t\t\t\t// Custom debug view setup.\n\t\t\t\tif (Config.debug) {\n\t\t\t\t\tthis.debugView.modes({ hidden : true });\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\telse {\n\t\t/* The HTML5 <audio> API appears to be missing or disabled, set up no-op macros. */\n\t\tMacro.add([\n\t\t\t'audio',\n\t\t\t'cacheaudio',\n\t\t\t'createaudiogroup',\n\t\t\t'createplaylist',\n\t\t\t'masteraudio',\n\t\t\t'playlist',\n\t\t\t'removeaudiogroup',\n\t\t\t'removeplaylist',\n\t\t\t'waitforaudio',\n\n\t\t\t// Deprecated.\n\t\t\t'setplaylist',\n\t\t\t'stopallaudio'\n\t\t], {\n\t\t\tskipArgs : true,\n\n\t\t\thandler() {\n\t\t\t\t/* no-op */\n\n\t\t\t\t// Custom debug view setup.\n\t\t\t\tif (Config.debug) {\n\t\t\t\t\tthis.debugView.modes({ hidden : true });\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tMiscellaneous Macros.\n\t*******************************************************************************************************************/\n\t/*\n\t\t<<done>>\n\t*/\n\tMacro.add('done', {\n\t\tskipArgs : true,\n\t\ttags     : null,\n\n\t\thandler() {\n\t\t\tconst contents = this.payload[0].contents.trim();\n\n\t\t\t// Do nothing if there's no content to process.\n\t\t\tif (contents === '') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsetTimeout(this.createShadowWrapper(\n\t\t\t\t() => $.wiki(contents)\n\t\t\t), Engine.minDomActionDelay);\n\t\t}\n\t});\n\n\t/*\n\t\t<<goto>>\n\t*/\n\tMacro.add('goto', {\n\t\thandler() {\n\t\t\tif (this.args.length === 0) {\n\t\t\t\treturn this.error('no passage specified');\n\t\t\t}\n\n\t\t\tlet passage;\n\n\t\t\tif (typeof this.args[0] === 'object') {\n\t\t\t\t// Argument was in wiki link syntax.\n\t\t\t\tpassage = this.args[0].link;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// Argument was simply the passage name.\n\t\t\t\tpassage = this.args[0];\n\t\t\t}\n\n\t\t\tif (!Story.has(passage)) {\n\t\t\t\treturn this.error(`passage \"${passage}\" does not exist`);\n\t\t\t}\n\n\t\t\t/*\n\t\t\t\tCall `Engine.play()` asynchronously.\n\n\t\t\t\tNOTE: This does not terminate the current Wikifier call chain,\n\t\t\t\tthough, ideally, it should.  Doing so would not be trivial, however,\n\t\t\t\tand there's also the question of whether that behavior would be\n\t\t\t\tunwanted by users, who are used to the current behavior from\n\t\t\t\tsimilar macros and constructs.\n\t\t\t*/\n\t\t\tWikifier.stopWikify = 2; // actually, let's make it.\n\t\t\tsetTimeout(() => Engine.play(passage), Engine.minDomActionDelay);\n\t\t}\n\t});\n\n\t/*\n\t\t<<repeat>> & <<stop>>\n\t*/\n\tMacro.add('repeat', {\n\t\tisAsync : true,\n\t\ttags    : null,\n\t\ttimers  : new Set(),\n\t\tt8nRe   : /^(?:transition|t8n)$/,\n\n\t\thandler() {\n\t\t\tif (this.args.length === 0) {\n\t\t\t\treturn this.error('no time value specified');\n\t\t\t}\n\n\t\t\tlet delay;\n\n\t\t\ttry {\n\t\t\t\tdelay = Math.max(Engine.minDomActionDelay, Util.fromCssTime(this.args[0]));\n\t\t\t}\n\t\t\tcatch (ex) {\n\t\t\t\treturn this.error(ex.message);\n\t\t\t}\n\n\t\t\t// Custom debug view setup.\n\t\t\tif (Config.debug) {\n\t\t\t\tthis.debugView.modes({ block : true });\n\t\t\t}\n\n\t\t\tconst transition = this.args.length > 1 && this.self.t8nRe.test(this.args[1]);\n\t\t\tconst $wrapper   = jQuery(document.createElement('span'))\n\t\t\t\t.addClass(`macro-${this.name}`)\n\t\t\t\t.appendTo(this.output);\n\n\t\t\t// Register the timer.\n\t\t\tthis.self.registerInterval(this.createShadowWrapper(() => {\n\t\t\t\tconst frag = document.createDocumentFragment();\n\t\t\t\tnew Wikifier(frag, this.payload[0].contents);\n\n\t\t\t\tlet $output = $wrapper;\n\n\t\t\t\tif (transition) {\n\t\t\t\t\t$output = jQuery(document.createElement('span'))\n\t\t\t\t\t\t.addClass('macro-repeat-insert macro-repeat-in')\n\t\t\t\t\t\t.appendTo($output);\n\t\t\t\t}\n\n\t\t\t\t$output.append(frag);\n\n\t\t\t\tif (transition) {\n\t\t\t\t\tsetTimeout(() => $output.removeClass('macro-repeat-in'), Engine.minDomActionDelay);\n\t\t\t\t}\n\t\t\t}), delay);\n\t\t},\n\n\t\tregisterInterval(callback, delay) {\n\t\t\tif (typeof callback !== 'function') {\n\t\t\t\tthrow new TypeError('callback parameter must be a function');\n\t\t\t}\n\n\t\t\t// Cache info about the current turn.\n\t\t\tconst passage = State.passage;\n\t\t\tconst turn    = State.turns;\n\n\t\t\t// Timer info.\n\t\t\tconst timers = this.timers;\n\t\t\tlet timerId = null;\n\n\t\t\t// Set up the interval.\n\t\t\ttimerId = setInterval(() => {\n\t\t\t\t// Terminate if we've navigated away.\n\t\t\t\tif (State.passage !== passage || State.turns !== turn) {\n\t\t\t\t\tclearInterval(timerId);\n\t\t\t\t\ttimers.delete(timerId);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet timerIdCache;\n\t\t\t\t/*\n\t\t\t\t\tThere's no catch clause because this try/finally is here simply to ensure that\n\t\t\t\t\tproper cleanup is done in the event that an exception is thrown during the\n\t\t\t\t\t`Wikifier` call.\n\t\t\t\t*/\n\t\t\t\ttry {\n\t\t\t\t\tTempState.break = null;\n\n\t\t\t\t\t// Set up the `repeatTimerId` value, caching the existing value, if necessary.\n\t\t\t\t\tif (TempState.hasOwnProperty('repeatTimerId')) {\n\t\t\t\t\t\ttimerIdCache = TempState.repeatTimerId;\n\t\t\t\t\t}\n\n\t\t\t\t\tTempState.repeatTimerId = timerId;\n\n\t\t\t\t\t// Execute the callback.\n\t\t\t\t\tcallback.call(this);\n\t\t\t\t}\n\t\t\t\tfinally {\n\t\t\t\t\t// Teardown the `repeatTimerId` property, restoring the cached value, if necessary.\n\t\t\t\t\tif (typeof timerIdCache !== 'undefined') {\n\t\t\t\t\t\tTempState.repeatTimerId = timerIdCache;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tdelete TempState.repeatTimerId;\n\t\t\t\t\t}\n\n\t\t\t\t\tTempState.break = null;\n\t\t\t\t}\n\t\t\t}, delay);\n\t\t\ttimers.add(timerId);\n\n\t\t\t// Set up a single-use `prehistory` task to remove pending timers.\n\t\t\tif (!prehistory.hasOwnProperty('#repeat-timers-cleanup')) {\n\t\t\t\tprehistory['#repeat-timers-cleanup'] = task => {\n\t\t\t\t\tdelete prehistory[task]; // single-use task\n\t\t\t\t\ttimers.forEach(timerId => clearInterval(timerId));\n\t\t\t\t\ttimers.clear();\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t});\n\tMacro.add('stop', {\n\t\tskipArgs : true,\n\n\t\thandler() {\n\t\t\tif (!TempState.hasOwnProperty('repeatTimerId')) {\n\t\t\t\treturn this.error('must only be used in conjunction with its parent macro <<repeat>>');\n\t\t\t}\n\n\t\t\tconst timers  = Macro.get('repeat').timers;\n\t\t\tconst timerId = TempState.repeatTimerId;\n\t\t\tclearInterval(timerId);\n\t\t\ttimers.delete(timerId);\n\t\t\tTempState.break = 2;\n\n\t\t\t// Custom debug view setup.\n\t\t\tif (Config.debug) {\n\t\t\t\tthis.debugView.modes({ hidden : true });\n\t\t\t}\n\t\t}\n\t});\n\n\t/*\n\t\t<<timed>> & <<next>>\n\t*/\n\tMacro.add('timed', {\n\t\tisAsync : true,\n\t\ttags    : ['next'],\n\t\ttimers  : new Set(),\n\t\tt8nRe   : /^(?:transition|t8n)$/,\n\n\t\thandler() {\n\t\t\tif (this.args.length === 0) {\n\t\t\t\treturn this.error('no time value specified in <<timed>>');\n\t\t\t}\n\n\t\t\tconst items = [];\n\n\t\t\ttry {\n\t\t\t\titems.push({\n\t\t\t\t\tname    : this.name,\n\t\t\t\t\tsource  : this.source,\n\t\t\t\t\tdelay   : Math.max(Engine.minDomActionDelay, Util.fromCssTime(this.args[0])),\n\t\t\t\t\tcontent : this.payload[0].contents\n\t\t\t\t});\n\t\t\t}\n\t\t\tcatch (ex) {\n\t\t\t\treturn this.error(`${ex.message} in <<timed>>`);\n\t\t\t}\n\n\t\t\tif (this.payload.length > 1) {\n\t\t\t\tlet i;\n\n\t\t\t\ttry {\n\t\t\t\t\tlet len;\n\n\t\t\t\t\tfor (i = 1, len = this.payload.length; i < len; ++i) {\n\t\t\t\t\t\titems.push({\n\t\t\t\t\t\t\tname   : this.payload[i].name,\n\t\t\t\t\t\t\tsource : this.payload[i].source,\n\t\t\t\t\t\t\tdelay  : this.payload[i].args.length === 0\n\t\t\t\t\t\t\t\t? items[items.length - 1].delay\n\t\t\t\t\t\t\t\t: Math.max(Engine.minDomActionDelay, Util.fromCssTime(this.payload[i].args[0])),\n\t\t\t\t\t\t\tcontent : this.payload[i].contents\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (ex) {\n\t\t\t\t\treturn this.error(`${ex.message} in <<next>> (#${i})`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Custom debug view setup.\n\t\t\tif (Config.debug) {\n\t\t\t\tthis.debugView.modes({ block : true });\n\t\t\t}\n\n\t\t\tconst transition = this.args.length > 1 && this.self.t8nRe.test(this.args[1]);\n\t\t\tconst $wrapper   = jQuery(document.createElement('span'))\n\t\t\t\t.addClass(`macro-${this.name}`)\n\t\t\t\t.appendTo(this.output);\n\n\t\t\t// Register the timer.\n\t\t\tthis.self.registerTimeout(this.createShadowWrapper(item => {\n\t\t\t\tconst frag = document.createDocumentFragment();\n\t\t\t\tnew Wikifier(frag, item.content);\n\n\t\t\t\t// Output.\n\t\t\t\tlet $output = $wrapper;\n\n\t\t\t\t// Custom debug view setup for `<<next>>`.\n\t\t\t\tif (Config.debug && item.name === 'next') {\n\t\t\t\t\t$output = jQuery(new DebugView( // eslint-disable-line no-param-reassign\n\t\t\t\t\t\t$output[0],\n\t\t\t\t\t\t'macro',\n\t\t\t\t\t\titem.name,\n\t\t\t\t\t\titem.source\n\t\t\t\t\t).output);\n\t\t\t\t}\n\n\t\t\t\tif (transition) {\n\t\t\t\t\t$output = jQuery(document.createElement('span'))\n\t\t\t\t\t\t.addClass('macro-timed-insert macro-timed-in')\n\t\t\t\t\t\t.appendTo($output);\n\t\t\t\t}\n\n\t\t\t\t$output.append(frag);\n\n\t\t\t\tif (transition) {\n\t\t\t\t\tsetTimeout(() => $output.removeClass('macro-timed-in'), Engine.minDomActionDelay);\n\t\t\t\t}\n\t\t\t}), items);\n\t\t},\n\n\t\tregisterTimeout(callback, items) {\n\t\t\tif (typeof callback !== 'function') {\n\t\t\t\tthrow new TypeError('callback parameter must be a function');\n\t\t\t}\n\n\t\t\t// Cache info about the current turn.\n\t\t\tconst passage = State.passage;\n\t\t\tconst turn    = State.turns;\n\n\t\t\t// Timer info.\n\t\t\tconst timers = this.timers;\n\t\t\tlet timerId  = null;\n\t\t\tlet nextItem = items.shift();\n\n\t\t\tconst worker = function () {\n\t\t\t\t// Bookkeeping.\n\t\t\t\ttimers.delete(timerId);\n\n\t\t\t\t// Terminate if we've navigated away.\n\t\t\t\tif (State.passage !== passage || State.turns !== turn) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Set the current item and set up the next worker, if any.\n\t\t\t\tconst curItem = nextItem;\n\n\t\t\t\tif ((nextItem = items.shift()) != null) { // lazy equality for null\n\t\t\t\t\ttimerId = setTimeout(worker, nextItem.delay);\n\t\t\t\t\ttimers.add(timerId);\n\t\t\t\t}\n\n\t\t\t\t// Execute the callback.\n\t\t\t\tcallback.call(this, curItem);\n\t\t\t};\n\n\t\t\t// Setup the timeout.\n\t\t\ttimerId = setTimeout(worker, nextItem.delay);\n\t\t\ttimers.add(timerId);\n\n\t\t\t// Set up a single-use `prehistory` task to remove pending timers.\n\t\t\tif (!prehistory.hasOwnProperty('#timed-timers-cleanup')) {\n\t\t\t\tprehistory['#timed-timers-cleanup'] = task => {\n\t\t\t\t\tdelete prehistory[task]; // single-use task\n\t\t\t\t\ttimers.forEach(timerId => clearTimeout(timerId)); // eslint-disable-line no-shadow\n\t\t\t\t\ttimers.clear();\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t});\n\n\t/*\n\t\t<<widget>>\n\t*/\n\tMacro.add('widget', {\n\t\ttags : null,\n\n\t\thandler() {\n\t\t\tif (this.args.length === 0) {\n\t\t\t\treturn this.error('no widget name specified');\n\t\t\t}\n\n\t\t\tconst widgetName = this.args[0];\n\t\t\tconst isNonVoid  = this.args.length > 1 && this.args[1] === 'container';\n\n\t\t\tif (Macro.has(widgetName)) {\n\t\t\t\tif (!Macro.get(widgetName).isWidget) {\n\t\t\t\t\treturn this.error(`cannot clobber existing macro \"${widgetName}\"`);\n\t\t\t\t}\n\n\t\t\t\t// Delete the existing widget.\n\t\t\t\tMacro.delete(widgetName);\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tconst widgetDef = {\n\t\t\t\t\tisWidget : true,\n\t\t\t\t\thandler  : (function (widgetCode) {\n\t\t\t\t\t\treturn function () {\n\t\t\t\t\t\t\tconst shadowStore = {};\n\n\t\t\t\t\t\t\t// Cache the existing value of the `_args` variable, if necessary.\n\t\t\t\t\t\t\tif (State.temporary.hasOwnProperty('args')) {\n\t\t\t\t\t\t\t\tshadowStore._args = State.temporary.args;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Set up the widget `_args` variable and add a shadow.\n\t\t\t\t\t\t\tState.temporary.args = [...this.args];\n\t\t\t\t\t\t\tState.temporary.args.raw = this.args.raw;\n\t\t\t\t\t\t\tState.temporary.args.full = this.args.full;\n\t\t\t\t\t\t\tthis.addShadow('_args');\n\n\t\t\t\t\t\t\tif (isNonVoid) {\n\t\t\t\t\t\t\t\t// Cache the existing value of the `_contents` variable, if necessary.\n\t\t\t\t\t\t\t\tif (State.temporary.hasOwnProperty('contents')) {\n\t\t\t\t\t\t\t\t\tshadowStore._contents = State.temporary.contents;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t// Set up the widget `_contents` variable and add a shadow.\n\t\t\t\t\t\t\t\tState.temporary.contents = this.payload[0].contents;\n\t\t\t\t\t\t\t\tthis.addShadow('_contents');\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t/* legacy */\n\t\t\t\t\t\t\t// Cache the existing value of the `$args` variable, if necessary.\n\t\t\t\t\t\t\tif (State.variables.hasOwnProperty('args')) {\n\t\t\t\t\t\t\t\tshadowStore.$args = State.variables.args;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Set up the widget `$args` variable and add a shadow.\n\t\t\t\t\t\t\tState.variables.args = State.temporary.args;\n\t\t\t\t\t\t\tthis.addShadow('$args');\n\t\t\t\t\t\t\t/* /legacy */\n\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t// Set up the error trapping variables.\n\t\t\t\t\t\t\t\tconst resFrag = document.createDocumentFragment();\n\t\t\t\t\t\t\t\tconst errList = [];\n\n\t\t\t\t\t\t\t\t// Wikify the widget's code.\n\t\t\t\t\t\t\t\tnew Wikifier(resFrag, widgetCode);\n\n\t\t\t\t\t\t\t\t// Carry over the output, unless there were errors.\n\t\t\t\t\t\t\t\tArray.from(resFrag.querySelectorAll('.error')).forEach(errEl => {\n\t\t\t\t\t\t\t\t\terrList.push(errEl.textContent);\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\tif (errList.length === 0) {\n\t\t\t\t\t\t\t\t\tthis.output.appendChild(resFrag);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\treturn this.error(`error${errList.length > 1 ? 's' : ''} within widget code (${errList.join('; ')})`);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (ex) {\n\t\t\t\t\t\t\t\treturn this.error(`cannot execute widget: ${ex.message}`);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfinally {\n\t\t\t\t\t\t\t\t// Revert the `_args` variable shadowing.\n\t\t\t\t\t\t\t\tif (shadowStore.hasOwnProperty('_args')) {\n\t\t\t\t\t\t\t\t\tState.temporary.args = shadowStore._args;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tdelete State.temporary.args;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (isNonVoid) {\n\t\t\t\t\t\t\t\t\t// Revert the `_contents` variable shadowing.\n\t\t\t\t\t\t\t\t\tif (shadowStore.hasOwnProperty('_contents')) {\n\t\t\t\t\t\t\t\t\t\tState.temporary.contents = shadowStore._contents;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\tdelete State.temporary.contents;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t/* legacy */\n\t\t\t\t\t\t\t\t// Revert the `$args` variable shadowing.\n\t\t\t\t\t\t\t\tif (shadowStore.hasOwnProperty('$args')) {\n\t\t\t\t\t\t\t\t\tState.variables.args = shadowStore.$args;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tdelete State.variables.args;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/* /legacy */\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\t\t\t\t\t})(this.payload[0].contents)\n\t\t\t\t};\n\n\t\t\t\tif (isNonVoid) {\n\t\t\t\t\twidgetDef.tags = [];\n\t\t\t\t}\n\n\t\t\t\tMacro.add(widgetName, widgetDef);\n\n\t\t\t\t// Custom debug view setup.\n\t\t\t\tif (Config.debug) {\n\t\t\t\t\tthis.debugView.modes({ hidden : true });\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (ex) {\n\t\t\t\treturn this.error(`cannot create widget macro \"${widgetName}\": ${ex.message}`);\n\t\t\t}\n\t\t}\n\t});\n\n\t/*\n\t\t<<exit>> & <<exitAll>>\n\t*/\n\tMacro.add(['exit', 'exitAll'], {\n\t\thandler() {\n\t\t\tWikifier.stopWikify = this.name === 'exit' ? 1 : 2;\n\t\t}\n\t});\n})();\n\n/***********************************************************************************************************************\n\n\tutil/gettypeof.js\n\n\tCopyright © 2013–2023 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n\n/*\n\tReturns the value `'null'` for `null`, the value yielded by `typeof` for\n\tprimitives and functions, or the `@@toStringTag` internal property for objects.\n\n\tExamples:\n\t\tgetTypeOf(42n)            → 'bigint'\n\t\tgetTypeOf(true)           → 'boolean'\n\t\tgetTypeOf(function () {}) → 'function'\n\t\tgetTypeOf(42)             → 'number'\n\t\tgetTypeOf(null)           → 'null'\n\t\tgetTypeOf(\"fnord\")        → 'string'\n\t\tgetTypeOf(Symbol(\"ZETA\")) → 'symbol'\n\t\tgetTypeOf(undefined)      → 'undefined'\n\t\tgetTypeOf(['a', 'b'])     → 'Array'\n\t\tgetTypeOf({ a : 'b' })    → 'Object'\n\t\tgetTypeOf(new Date())     → 'Date'\n\t\tgetTypeOf(new Map())      → 'Map'\n\t\tgetTypeOf(new Set())      → 'Set'\n\t\tEtc.\n*/\nvar getTypeOf = (() => { // eslint-disable-line no-unused-vars, no-var\n\t// Cache built-in object method.\n\tconst toString = Object.prototype.toString;\n\tconst slice    = String.prototype.slice;\n\n\tfunction getTypeOf(O) {\n\t\t// Special case for `null`, since `typeof` is a buggy piece of shit.\n\t\tif (O === null) { return 'null'; }\n\n\t\tconst baseType = typeof O;\n\t\treturn baseType === 'object' ? slice.call(toString.call(O), 8, -1) : baseType;\n\t}\n\n\treturn getTypeOf;\n})();\n\n/***********************************************************************************************************************\n\n\tdialog.js\n\n\tCopyright © 2013–2023 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/* global Has, L10n, Story, getTypeOf */\n\nvar Dialog = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\t// Default top position.\n\tconst DEFAULT_TOP = 50; // in pixels w/o unit\n\n\t// jQuery-wrapped dialog elements.\n\tlet $overlay = null;\n\tlet $dialog  = null;\n\tlet $title   = null;\n\tlet $body    = null;\n\n\t// Last active/focused non-dialog element.\n\tlet lastActive = null;\n\n\t// Mutation resize handler.\n\tlet observer = null;\n\n\t// Active close callback, if any.\n\tlet onCloseFn = null;\n\n\t// Width of the browser's scrollbars.\n\tlet scrollbarWidth = 0;\n\n\n\t/*******************************************************************************\n\t\tInitialization Functions.\n\t*******************************************************************************/\n\n\tfunction init() {\n\t\tif (DEBUG) { console.log('[Dialog/init()]'); }\n\n\t\tif (document.getElementById('ui-dialog')) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Calculate and record the width of scrollbars.\n\t\tscrollbarWidth = (() => {\n\t\t\tlet calcWidth;\n\n\t\t\ttry {\n\t\t\t\tconst inner = document.createElement('p');\n\t\t\t\tinner.style.width  = '100%';\n\t\t\t\tinner.style.height = '200px';\n\n\t\t\t\tconst outer = document.createElement('div');\n\t\t\t\touter.style.position   = 'absolute';\n\t\t\t\touter.style.left       = '0';\n\t\t\t\touter.style.top        = '0';\n\t\t\t\touter.style.width      = '100px';\n\t\t\t\touter.style.height     = '100px';\n\t\t\t\touter.style.visibility = 'hidden';\n\t\t\t\touter.style.overflow   = 'hidden';\n\n\t\t\t\touter.appendChild(inner);\n\t\t\t\tdocument.body.appendChild(outer);\n\n\t\t\t\tconst w1 = inner.offsetWidth;\n\t\t\t\t// The `overflow: scroll` style property value does not work consistently\n\t\t\t\t// with scrollbars which are styled with `::-webkit-scrollbar`, so we use\n\t\t\t\t// `overflow: auto` with dimensions guaranteed to force a scrollbar.\n\t\t\t\touter.style.overflow = 'auto';\n\t\t\t\tlet w2 = inner.offsetWidth;\n\n\t\t\t\tif (w1 === w2) {\n\t\t\t\t\tw2 = outer.clientWidth;\n\t\t\t\t}\n\n\t\t\t\tdocument.body.removeChild(outer);\n\n\t\t\t\tcalcWidth = w1 - w2;\n\t\t\t}\n\t\t\tcatch (ex) { /* no-op */ }\n\n\t\t\treturn calcWidth || 17; // 17px is a reasonable failover\n\t\t})();\n\n\t\t// Generate the dialog elements.\n\t\tconst $elems = jQuery(document.createDocumentFragment())\n\t\t\t.append(\n\t\t\t\t/* eslint-disable max-len */\n\t\t\t\t  '<div id=\"ui-overlay\" class=\"ui-close\"></div>'\n\t\t\t\t+ '<div id=\"ui-dialog\" tabindex=\"0\" role=\"dialog\" aria-labelledby=\"ui-dialog-title\" aria-modal=\"true\">'\n\t\t\t\t+     '<div id=\"ui-dialog-titlebar\">'\n\t\t\t\t+         '<h1 id=\"ui-dialog-title\"></h1>'\n\t\t\t\t+         `<button id=\"ui-dialog-close\" class=\"ui-close\" tabindex=\"0\" aria-label=\"${L10n.get('textClose')}\">\\ue804</button>`\n\t\t\t\t+     '</div>'\n\t\t\t\t+     '<div id=\"ui-dialog-body\"></div>'\n\t\t\t\t+ '</div>'\n\t\t\t\t/* eslint-enable max-len */\n\t\t\t);\n\n\t\t// Cache the dialog elements, since they're going to be used often.\n\t\t//\n\t\t// NOTE: We rewrap the elements themselves, rather than simply using\n\t\t// the results of `find()`, so that we cache uncluttered jQuery-wrappers\n\t\t// (i.e. `context` refers to the elements and there is no `prevObject`).\n\t\t$overlay = jQuery($elems.find('#ui-overlay').get(0));\n\t\t$dialog  = jQuery($elems.find('#ui-dialog').get(0));\n\t\t$title   = jQuery($elems.find('#ui-dialog-title').get(0));\n\t\t$body    = jQuery($elems.find('#ui-dialog-body').get(0));\n\n\t\t// Insert the dialog elements into the page before the main script.\n\t\t$elems.insertBefore('body>script#script-sugarcube');\n\t}\n\n\n\t/*******************************************************************************\n\t\tUtility Functions.\n\t*******************************************************************************/\n\n\t/*\n\t\tCalculate the inset values, in pixels, required to fit the dialog within\n\t\tthe current viewport based on the size of its contents and the viewport's\n\t\tdimentions.\n\t*/\n\tfunction calcInset(top) {\n\t\tconst $window = jQuery(window);\n\t\tconst inset   = { left : '', right : '', top : '', bottom : '' };\n\t\tconst minPos  = 10;\n\n\t\t// Unset the dialog's inset values, so the browser can resize it based on\n\t\t// its content.\n\t\t$dialog.css(inset);\n\n\t\t// Calculate the dialog's new inset values based on its current dimensions.\n\t\t//\n\t\t// NOTE: Subtract `1` from both space values to address a Firefox issue.\n\t\t// QUESTION: Is this still necessary?\n\t\tlet horzSpace = $window.width() - $dialog.outerWidth(true) - 1;\n\t\tlet vertSpace = $window.height() - $dialog.outerHeight(true) - 1;\n\n\t\tif (horzSpace <= minPos * 2 + scrollbarWidth) {\n\t\t\tvertSpace -= scrollbarWidth;\n\t\t}\n\n\t\tif (vertSpace <= minPos * 2 + scrollbarWidth) {\n\t\t\thorzSpace -= scrollbarWidth;\n\t\t}\n\n\t\t/* eslint-disable prefer-template */\n\t\t// Calculate the horizontal inset values in pixels.\n\t\tif (horzSpace <= minPos * 2) {\n\t\t\tinset.left = inset.right = minPos + 'px';\n\t\t}\n\t\telse {\n\t\t\tinset.left = inset.right = (horzSpace / 2 >> 0) + 'px';\n\t\t}\n\n\t\t// Calculate the vertical inset values in pixels.\n\t\tif (vertSpace <= minPos * 2) {\n\t\t\tinset.top = inset.bottom = minPos + 'px';\n\t\t}\n\t\telse {\n\t\t\tconst vertPos = vertSpace / 2 >> 0;\n\n\t\t\tif (vertPos > top) {\n\t\t\t\tinset.top = top + 'px';\n\t\t\t}\n\t\t\telse {\n\t\t\t\tinset.top = inset.bottom = vertPos + 'px';\n\t\t\t}\n\t\t}\n\t\t/* eslint-enable prefer-template */\n\n\t\treturn inset;\n\t}\n\n\t/*\n\t\tResize handler.\n\t*/\n\tfunction onResize(top) {\n\t\tif ($dialog.css('display') === 'block') {\n\t\t\t$dialog.css(calcInset(top != null ? top : DEFAULT_TOP)); // lazy equality for null\n\t\t}\n\t}\n\n\n\t/*******************************************************************************\n\t\tAPI Functions.\n\t*******************************************************************************/\n\n\t/*\n\t\tAppends the specified content sources to the dialog's body container.\n\t\tReturns `Dialog` for further chaining.\n\t*/\n\tfunction append(...args) {\n\t\t$body.append(...args);\n\t\treturn Dialog;\n\t}\n\n\t/*\n\t\tCloses and resets the dialog.\n\t\tReturns `Dialog` for further chaining.\n\t*/\n\tfunction close(ev) {\n\t\t// Trigger a `:dialogclosing` event on the dialog body.\n\t\t$body.trigger(':dialogclosing');\n\n\t\t// Largely reverse the actions taken in `dialogOpen()`.\n\t\tjQuery(document).off('.dialog-close');\n\n\t\tif (observer) {\n\t\t\tobserver.disconnect();\n\t\t\tobserver = null;\n\t\t}\n\t\telse {\n\t\t\t$body.off('.dialog-resize');\n\t\t}\n\n\t\tjQuery(window)\n\t\t\t.off('.dialog-resize');\n\t\t$dialog\n\t\t\t.removeClass('open')\n\t\t\t.css({ left : '', right : '', top : '', bottom : '' });\n\n\t\tjQuery('#ui-bar,#story')\n\t\t\t.find('[tabindex=-2]')\n\t\t\t.removeAttr('aria-hidden')\n\t\t\t.attr('tabindex', 0);\n\t\tjQuery('body>[tabindex=-3]')\n\t\t\t.removeAttr('aria-hidden')\n\t\t\t.removeAttr('tabindex');\n\n\t\t$overlay\n\t\t\t.removeClass('open');\n\t\tjQuery(document.documentElement)\n\t\t\t.removeAttr('data-dialog');\n\n\t\t// Clear the dialog's content.\n\t\t$title\n\t\t\t.empty();\n\t\t$body\n\t\t\t.empty()\n\t\t\t.removeClass();\n\n\t\t// Attempt to restore focus to whichever element had it prior to opening the dialog.\n\t\tif (lastActive) {\n\t\t\tlastActive.focus();\n\t\t\tlastActive = null;\n\t\t}\n\n\t\t// Call the given close callback, if any.\n\t\tif (onCloseFn) {\n\t\t\t// NOTE: There's no catch clause here because this try/finally exists\n\t\t\t// solely to ensure that the close callback is properly reset in the\n\t\t\t// event that an uncaught exception is thrown during the callback call.\n\t\t\ttry {\n\t\t\t\tonCloseFn(ev);\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tonCloseFn = null;\n\t\t\t}\n\t\t}\n\n\t\t// Trigger a `:dialogclosed` event on the dialog body.\n\t\t/* legacy */\n\t\t$body.trigger(':dialogclose');\n\t\t/* /legacy */\n\t\t$body.trigger(':dialogclosed');\n\n\t\treturn Dialog;\n\t}\n\n\t/*\n\t\tPrepares the dialog for use.\n\t\tReturns `Dialog` for further chaining.\n\t*/\n\tfunction create(title, classNames) {\n\t\t$title\n\t\t\t.empty()\n\t\t\t.append((title != null ? String(title) : '') || '\\u00A0'); // lazy equality for null\n\n\t\t$body\n\t\t\t.empty()\n\t\t\t.removeClass();\n\n\t\tif (classNames != null) { // lazy equality for null\n\t\t\t$body.addClass(classNames);\n\t\t}\n\n\t\treturn Dialog;\n\t}\n\n\t/*\n\t\tEmpties the dialog's body container.\n\t\tReturns `Dialog` for further chaining.\n\t*/\n\tfunction empty() {\n\t\t$body.empty();\n\t\treturn Dialog;\n\t}\n\n\t/*\n\t\tReturns the dialog's body container.\n\t*/\n\tfunction getBody() {\n\t\treturn $body.get(0);\n\t}\n\n\t/*\n\t\tReturns whether the dialog is open.\n\t\tThe test may be narrowed by specifing class names.\n\t*/\n\tfunction isOpen(classNames) {\n\t\treturn $dialog.hasClass('open')\n\t\t\t&& (classNames ? classNames.splitOrEmpty(/\\s+/).every(cn => $body.hasClass(cn)) : true);\n\t}\n\n\t/*\n\t\tOpens the dialog.\n\t\tReturns `Dialog` for further chaining.\n\t*/\n\tfunction open(options, onClose) {\n\t\t// Grab the options we care about.\n\t\tconst { top } = Object.assign({ top : DEFAULT_TOP }, options);\n\n\t\t// Record the given close callback.\n\t\tif (onClose != null) { // lazy equality for null\n\t\t\tconst closeType = getTypeOf(onClose);\n\n\t\t\tif (closeType !== 'function') {\n\t\t\t\tthrow new TypeError(`Dialog.open onClose parameter must be a function (received: ${closeType})`);\n\t\t\t}\n\n\t\t\tonCloseFn = onClose;\n\t\t}\n\t\telse {\n\t\t\tonCloseFn = null;\n\t\t}\n\n\t\t// Trigger a `:dialogopening` event on the dialog body.\n\t\t$body.trigger(':dialogopening');\n\n\t\t// Record the last active/focused non-dialog element.\n\t\tif (!isOpen()) {\n\t\t\tlastActive = document.activeElement || null;\n\t\t}\n\n\t\t// Add the `data-dialog` attribute to <html> (mostly used to style <body>).\n\t\tjQuery(document.documentElement).attr('data-dialog', 'open');\n\n\t\t// Display the overlay.\n\t\t$overlay.addClass('open');\n\n\t\t// Add `aria-hidden=true` to all direct non-dialog-children of <body> to\n\t\t// hide the underlying page from screen readers while the dialog is open.\n\t\tjQuery('body>:not(script,#store-area,tw-storydata,#ui-bar,#ui-overlay,#ui-dialog)')\n\t\t\t.attr('tabindex', -3)\n\t\t\t.attr('aria-hidden', true);\n\t\tjQuery('#ui-bar,#story')\n\t\t\t.find('[tabindex]:not([tabindex^=-])')\n\t\t\t.attr('tabindex', -2)\n\t\t\t.attr('aria-hidden', true);\n\n\t\t// Create our throttled resize handler.\n\t\tconst resizeHandler = jQuery.throttle(40, () => onResize(top));\n\n\t\t// Add the imagesLoaded handlers to images.\n\t\t$body.imagesLoaded().always(resizeHandler);\n\n\t\t// Display the dialog.\n\t\t$dialog\n\t\t\t.css(calcInset(top))\n\t\t\t.addClass('open')\n\t\t\t.focus();\n\n\t\t// Attach the window `resize` event resize handler.\n\t\tjQuery(window)\n\t\t\t.off('.dialog-resize')\n\t\t\t.on('resize.dialog-resize', resizeHandler);\n\n\t\t// Add the dialog mutation resize handler.\n\t\tif (Has.mutationObserver) {\n\t\t\tobserver = new MutationObserver(mutations => {\n\t\t\t\tfor (let i = 0; i < mutations.length; ++i) {\n\t\t\t\t\tif (mutations[i].type === 'childList') {\n\t\t\t\t\t\t$body.imagesLoaded().always(resizeHandler);\n\t\t\t\t\t\tresizeHandler();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\tobserver.observe(getBody(), {\n\t\t\t\tchildList : true,\n\t\t\t\tsubtree   : true\n\t\t\t});\n\t\t}\n\t\telse {\n\t\t\t$body\n\t\t\t\t.off('.dialog-resize')\n\t\t\t\t.on(\n\t\t\t\t\t'DOMNodeInserted.dialog-resize DOMNodeRemoved.dialog-resize',\n\t\t\t\t\t() => {\n\t\t\t\t\t\t$body.imagesLoaded().always(resizeHandler);\n\t\t\t\t\t\tresizeHandler();\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t}\n\n\t\t// Set up the delegated close handler.\n\t\tjQuery(document)\n\t\t\t.off('.dialog-close')\n\t\t\t.one('click.dialog-close', '.ui-close', ev => {\n\t\t\t\t// NOTE: Do not allow this event handler to return the `Dialog` static object,\n\t\t\t\t// as doing so causes Edge (ca. 18) to throw a \"Number expected\" exception due\n\t\t\t\t// to `Dialog` not having a prototype.\n\t\t\t\tclose(ev);\n\t\t\t\t/* implicit `return undefined;` */\n\t\t\t})\n\t\t\t.one('keypress.dialog-close', '.ui-close', function (ev) {\n\t\t\t\t// 13 is Enter/Return, 32 is Space.\n\t\t\t\tif (ev.which === 13 || ev.which === 32) {\n\t\t\t\t\tjQuery(this).trigger('click');\n\t\t\t\t}\n\t\t\t});\n\n\t\t// Trigger a `:dialogopened` event on the dialog body.\n\t\t/* legacy */\n\t\t$body.trigger(':dialogopen');\n\t\t/* /legacy */\n\t\t$body.trigger(':dialogopened');\n\n\t\treturn Dialog;\n\t}\n\n\t/*\n\t\tResize the dialog.\n\t*/\n\tfunction resize(options) {\n\t\treturn onResize(typeof options === 'object' ? options.top : undefined);\n\t}\n\n\t/*\n\t\tRenders and appends the specified content sources to the dialog's body container.\n\t\tReturns `Dialog` for further chaining.\n\t*/\n\tfunction wiki(...args) {\n\t\t$body.wiki(...args);\n\t\treturn Dialog;\n\t}\n\n\t/*\n\t\tRenders and appends the specified passage to the dialog's body container.\n\t\tReturns `Dialog` for further chaining.\n\t*/\n\tfunction wikiPassage(name) {\n\t\treturn wiki(Story.get(name).processText());\n\t}\n\n\n\t/*******************************************************************************\n\t\tDeprecated Functions.\n\t*******************************************************************************/\n\n\t/*\n\t\t[DEPRECATED] Prepares the dialog for use.\n\t\tReturns the dialog's body container.\n\t*/\n\tfunction setup(title, classNames) {\n\t\t// console.warn('[DEPRECATED] Dialog.setup() is deprecated.');\n\n\t\tcreate(title, classNames);\n\t\treturn getBody();\n\t}\n\n\n\t/*******************************************************************************\n\t\tObject Exports.\n\t*******************************************************************************/\n\n\treturn Object.preventExtensions(Object.create(null, {\n\t\tappend      : { value : append },\n\t\tbody        : { value : getBody },\n\t\tclose       : { value : close },\n\t\tcreate      : { value : create },\n\t\tempty       : { value : empty },\n\t\tinit        : { value : init },\n\t\tisOpen      : { value : isOpen },\n\t\topen        : { value : open },\n\t\tresize      : { value : resize },\n\t\twiki        : { value : wiki },\n\t\twikiPassage : { value : wikiPassage },\n\n\t\t// Deprecated Functions.\n\t\tsetup : { value : setup }\n\t}));\n})();\n\n/***********************************************************************************************************************\n\n\tengine.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/*\n\tglobal Alert, Config, DebugView, Dialog, Has, LoadScreen, Save, State, Story, StyleWrapper, UI, UIBar, Util,\n\t       Wikifier, postdisplay, postrender, predisplay, prehistory, prerender, setDisplayTitle\n*/\n\nvar Engine = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\t// Engine state types object (pseudo-enumeration).\n\tconst States = Util.toEnum({\n\t\tIdle      : 'idle',\n\t\tPlaying   : 'playing',\n\t\tRendering : 'rendering'\n\t});\n\n\t// Minimum delay for DOM actions (in milliseconds).\n\tconst minDomActionDelay = 40;\n\n\t// Cache of the debug view(s) for initialization special passage(s).\n\tconst _initDebugViews = [];\n\n\t// Current state of the engine (default: `Engine.States.Idle`).\n\tlet _state = States.Idle;\n\n\t// Last time `enginePlay()` was called (in milliseconds).\n\tlet _lastPlay = null;\n\n\t// Cache of the outline patching <style> element (`StyleWrapper`-wrapped).\n\tlet _outlinePatch = null;\n\n\t// List of objects describing `StoryInterface` elements to update via passages during navigation.\n\tlet _updating = null;\n\n\n\t/*******************************************************************************************************************\n\t\tEngine Functions.\n\t*******************************************************************************************************************/\n\t/*\n\t\tInitialize the core story elements and perform some bookkeeping.\n\t*/\n\tfunction engineInit() {\n\t\tif (DEBUG) { console.log('[Engine/engineInit()]'); }\n\n\t\t/*\n\t\t\tRemove #init-no-js & #init-lacking from #init-screen.\n\t\t*/\n\t\tjQuery('#init-no-js,#init-lacking').remove();\n\n\t\t/*\n\t\t\tGenerate the core story elements and insert them into the page before the store area.\n\t\t*/\n\t\t(() => {\n\t\t\tconst $elems = jQuery(document.createDocumentFragment());\n\t\t\tconst markup = Story.has('StoryInterface') && Story.get('StoryInterface').text.trim();\n\n\t\t\tif (markup) {\n\t\t\t\t// Remove the UI bar, its styles, and events.\n\t\t\t\tUIBar.destroy();\n\n\t\t\t\t// Remove the core display area styles.\n\t\t\t\tjQuery(document.head).find('#style-core-display').remove();\n\n\t\t\t\t$elems.append(markup);\n\n\t\t\t\tconst $passages = $elems.find('#passages');\n\n\t\t\t\tif ($passages.length === 0) {\n\t\t\t\t\tthrow new Error('no element with ID \"passages\" found within \"StoryInterface\" special passage');\n\t\t\t\t}\n\n\t\t\t\t// Empty `#passages` and set the `aria-live` content attribute to `'polite'` if necessary.\n\t\t\t\t$passages\n\t\t\t\t\t.empty()\n\n\t\t\t\t\t// Without an existing `aria-live`.\n\t\t\t\t\t.not('[aria-live]')\n\t\t\t\t\t.attr('aria-live', 'polite')\n\t\t\t\t\t.end();\n\n\t\t\t\t// Data passage elements updated once during initialization.\n\t\t\t\t$elems.find('[data-init-passage]').each((i, el) => {\n\t\t\t\t\tif (el.id === 'passages') {\n\t\t\t\t\t\tthrow new Error(`\"StoryInterface\" element <${el.nodeName.toLowerCase()} id=\"passages\"> must not contain a \"data-init-passage\" content attribute`);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst passage = el.getAttribute('data-init-passage').trim();\n\n\t\t\t\t\tif (el.hasAttribute('data-passage')) {\n\t\t\t\t\t\tthrow new Error(`\"StoryInterface\" element <${el.nodeName.toLowerCase()} data-init-passage=\"${passage}\"> must not contain a \"data-passage\" content attribute`);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (el.firstElementChild !== null) {\n\t\t\t\t\t\tthrow new Error(`\"StoryInterface\" element <${el.nodeName.toLowerCase()} data-init-passage=\"${passage}\"> contains child elements`);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (Story.has(passage)) {\n\t\t\t\t\t\tjQuery(el).empty().wiki(Story.get(passage).processText().trim());\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t// Data passage elements updated upon navigation.\n\t\t\t\tconst updating = [];\n\t\t\t\t$elems.find('[data-passage]').each((i, el) => {\n\t\t\t\t\tif (el.id === 'passages') {\n\t\t\t\t\t\tthrow new Error(`\"StoryInterface\" element <${el.nodeName.toLowerCase()} id=\"passages\"> must not contain a \"data-passage\" content attribute`);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst passage = el.getAttribute('data-passage').trim();\n\n\t\t\t\t\tif (el.firstElementChild !== null) {\n\t\t\t\t\t\tthrow new Error(`\"StoryInterface\" element <${el.nodeName.toLowerCase()} data-passage=\"${passage}\"> contains child elements`);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (Story.has(passage)) {\n\t\t\t\t\t\tupdating.push({\n\t\t\t\t\t\t\tpassage,\n\t\t\t\t\t\t\telement : el\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif (updating.length > 0) {\n\t\t\t\t\t_updating = updating;\n\t\t\t\t}\n\n\t\t\t\tConfig.ui.updateStoryElements = false;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$elems.append('<div id=\"story\" role=\"main\"><div id=\"passages\" aria-live=\"polite\"></div></div>');\n\t\t\t}\n\n\t\t\t// Insert the core UI elements into the page before the main script.\n\t\t\t$elems.insertBefore('body>script#script-sugarcube');\n\t\t})();\n\n\t\t/*\n\t\t\tGenerate and cache the ARIA outlines <style> element (`StyleWrapper`-wrapped)\n\t\t\tand set up the handler to manipulate the outlines.\n\n\t\t\tIDEA: http://www.paciellogroup.com/blog/2012/04/how-to-remove-css-outlines-in-an-accessible-manner/\n\t\t*/\n\t\t_outlinePatch = new StyleWrapper((\n\t\t\t() => jQuery(document.createElement('style'))\n\t\t\t\t.attr({\n\t\t\t\t\tid   : 'style-aria-outlines',\n\t\t\t\t\ttype : 'text/css'\n\t\t\t\t})\n\t\t\t\t.appendTo(document.head)\n\t\t\t\t.get(0) // return the <style> element itself\n\t\t)());\n\t\t_hideOutlines(); // initially hide outlines\n\t\tlet _lastOutlineEvent;\n\t\tjQuery(document).on(\n\t\t\t'mousedown.aria-outlines keydown.aria-outlines',\n\t\t\tev => {\n\t\t\t\tif (ev.type !== _lastOutlineEvent) {\n\t\t\t\t\t_lastOutlineEvent = ev.type;\n\n\t\t\t\t\tif (ev.type === 'keydown') {\n\t\t\t\t\t\t_showOutlines();\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t_hideOutlines();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n\n\t/*\n\t\tStarts the story.\n\t*/\n\tfunction engineStart() {\n\t\tif (DEBUG) { console.log('[Engine/engineStart()]'); }\n\n\t\t/*\n\t\t\tExecute `init`-tagged special passages.\n\t\t*/\n\t\tStory.getAllInit().forEach(passage => {\n\t\t\ttry {\n\t\t\t\tconst debugBuffer = Wikifier.wikifyEval(passage.text);\n\n\t\t\t\tif (Config.debug) {\n\t\t\t\t\tconst debugView = new DebugView(\n\t\t\t\t\t\tdocument.createDocumentFragment(),\n\t\t\t\t\t\t'special',\n\t\t\t\t\t\t`${passage.title} [init-tagged]`,\n\t\t\t\t\t\t`${passage.title} [init-tagged]`\n\t\t\t\t\t);\n\t\t\t\t\tdebugView.modes({ hidden : true });\n\t\t\t\t\tdebugView.append(debugBuffer);\n\t\t\t\t\t_initDebugViews.push(debugView.output);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (ex) {\n\t\t\t\tconsole.error(ex);\n\t\t\t\tAlert.error(`${passage.title} [init-tagged]`, typeof ex === 'object' ? ex.message : ex);\n\t\t\t}\n\t\t});\n\n\t\t/*\n\t\t\tExecute the StoryInit special passage.\n\t\t*/\n\t\tif (Story.has('StoryInit')) {\n\t\t\ttry {\n\t\t\t\tconst debugBuffer = Wikifier.wikifyEval(Story.get('StoryInit').text);\n\n\t\t\t\tif (Config.debug) {\n\t\t\t\t\tconst debugView = new DebugView(\n\t\t\t\t\t\tdocument.createDocumentFragment(),\n\t\t\t\t\t\t'special',\n\t\t\t\t\t\t'StoryInit',\n\t\t\t\t\t\t'StoryInit'\n\t\t\t\t\t);\n\t\t\t\t\tdebugView.modes({ hidden : true });\n\t\t\t\t\tdebugView.append(debugBuffer);\n\t\t\t\t\t_initDebugViews.push(debugView.output);\n\t\t\t\t}\n\t\t\t\t// story init executes on every game start, after all variables have been initialized\n\t\t\t\t// and also on every page reload, before the saved session is loaded\n\t\t\t\t// it's a great place to load a custom user settings script\n\t\t\t\tnew Promise((resolve, reject) => {\n\t\t\t\t\tjQuery(document.createElement('script'))\n\t\t\t\t\t\t.one('load abort error', ev => {\n\t\t\t\t\t\t\tjQuery(ev.target).off();\n\t\t\t\t\t\t\tif (ev.type === 'load') {\n\t\t\t\t\t\t\t\tresolve(ev.target);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\treject(new Error('importScripts failed to load the script \"usettings.js\".'));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.appendTo(document.head)\n\t\t\t\t\t\t.attr({\n\t\t\t\t\t\t\tid   : 'script-imported-usettings.js',\n\t\t\t\t\t\t\ttype : 'text/javascript',\n\t\t\t\t\t\t\tsrc  : 'usettings.js'\n\t\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t\t\t.then(() => console.log('usettings.js is active'))\n\t\t\t\t\t.catch(() => console.log('usettings.js not active, this is normal'));\n\t\t\t}\n\t\t\tcatch (ex) {\n\t\t\t\tconsole.error(ex);\n\t\t\t\tAlert.error('StoryInit', typeof ex === 'object' ? ex.message : ex);\n\t\t\t}\n\t\t}\n\n\t\t// Sanity checks.\n\t\tif (Config.passages.start == null) { // lazy equality for null\n\t\t\tthrow new Error('starting passage not selected');\n\t\t}\n\t\tif (!Story.has(Config.passages.start)) {\n\t\t\tthrow new Error(`starting passage (\"${Config.passages.start}\") not found`);\n\t\t}\n\n\t\t// Focus the document element initially.\n\t\tjQuery(document.documentElement).focus();\n\n\t\t/*\n\t\t\tAttempt to restore an active session.  Failing that, attempt to autoload the autosave,\n\t\t\tif requested.  Failing that, display the starting passage.\n\t\t*/\n\t\tif (State.restore()) {\n\t\t\tengineShow();\n\t\t}\n\t\telse {\n\t\t\tlet loadStart = true;\n\n\t\t\tswitch (typeof Config.saves.autoload) {\n\t\t\tcase 'boolean':\n\t\t\t\tif (Config.saves.autoload && Save.autosave.ok() && Save.autosave.has()) {\n\t\t\t\t\tif (DEBUG) { console.log(`\\tattempting autoload: \"${Save.autosave.get().title}\"`); }\n\n\t\t\t\t\tloadStart = !Save.autosave.load();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'string':\n\t\t\t\tif (Config.saves.autoload === 'prompt' && Save.autosave.ok() && Save.autosave.has()) {\n\t\t\t\t\tloadStart = false;\n\t\t\t\t\tUI.buildAutoload();\n\t\t\t\t\tDialog.open();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'function':\n\t\t\t\tif (Save.autosave.ok() && Save.autosave.has() && !!Config.saves.autoload()) {\n\t\t\t\t\tif (DEBUG) { console.log(`\\tattempting autoload: \"${Save.autosave.get().title}\"`); }\n\n\t\t\t\t\tloadStart = !Save.autosave.load();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (loadStart) {\n\t\t\t\tif (DEBUG) { console.log(`\\tstarting passage: \"${Config.passages.start}\"`); }\n\n\t\t\t\tenginePlay(Config.passages.start);\n\t\t\t}\n\t\t}\n\t}\n\n\t/*\n\t\tRestarts the story.\n\t*/\n\tfunction engineRestart() {\n\t\tif (DEBUG) { console.log('[Engine/engineRestart()]'); }\n\n\t\t/*\n\t\t\tShow the loading screen to hide any unsightly rendering shenanigans during the\n\t\t\tpage reload.\n\t\t*/\n\t\tLoadScreen.show();\n\n\t\t/*\n\t\t\tScroll the window to the top.\n\n\t\t\tThis is required by most browsers for the starting passage or it will remain at\n\t\t\twhatever its current scroll position is after the page reload.  We do it generally,\n\t\t\trather than only for the currently set starting passage, since the starting passage\n\t\t\tmay be dynamically manipulated.\n\t\t*/\n\t\twindow.scroll(0, 0);\n\n\t\t/*\n\t\t\tDelete the active session.\n\t\t*/\n\t\tState.reset();\n\n\t\t/*\n\t\t\tTrigger an ':enginerestart' event.\n\t\t*/\n\t\tjQuery.event.trigger(':enginerestart');\n\n\t\t/*\n\t\t\tReload the page.\n\t\t*/\n\t\twindow.location.reload();\n\t}\n\n\t/*\n\t\tReturns the current state of the engine.\n\t*/\n\tfunction engineState() {\n\t\treturn _state;\n\t}\n\n\t/*\n\t\tReturns whether the engine is idle.\n\t*/\n\tfunction engineIsIdle() {\n\t\treturn _state === States.Idle;\n\t}\n\n\t/*\n\t\tReturns whether the engine is playing.\n\t*/\n\tfunction engineIsPlaying() {\n\t\treturn _state !== States.Idle;\n\t}\n\n\t/*\n\t\tReturns whether the engine is rendering.\n\t*/\n\tfunction engineIsRendering() {\n\t\treturn _state === States.Rendering;\n\t}\n\n\t/*\n\t\tReturns a timestamp representing the last time `Engine.play()` was called.\n\t*/\n\tfunction engineLastPlay() {\n\t\treturn _lastPlay;\n\t}\n\n\t/*\n\t\tActivate the moment at the given index within the state history and show it.\n\t*/\n\tfunction engineGoTo(idx) {\n\t\tconst succeded = State.goTo(idx);\n\n\t\tif (succeded) {\n\t\t\tengineShow();\n\t\t}\n\n\t\treturn succeded;\n\t}\n\n\t/*\n\t\tActivate the moment at the given offset from the active moment within the state history\n\t\tand show it.\n\t*/\n\tfunction engineGo(offset) {\n\t\tconst succeded = State.go(offset);\n\n\t\tif (succeded) {\n\t\t\tengineShow();\n\t\t}\n\n\t\treturn succeded;\n\t}\n\n\t/*\n\t\tGo to the moment which directly precedes the active moment and show it.\n\t*/\n\tfunction engineBackward() {\n\t\treturn engineGo(-1);\n\t}\n\n\t/*\n\t\tGo to the moment which directly follows the active moment and show it.\n\t*/\n\tfunction engineForward() {\n\t\treturn engineGo(1);\n\t}\n\n\t/*\n\t\tRenders and displays the active (present) moment's associated passage without adding\n\t\ta new moment to the history.\n\t*/\n\tfunction engineShow() {\n\t\treturn enginePlay(State.passage, true);\n\t}\n\n\t/*\n\t\tRenders and displays the passage referenced by the given title, optionally without\n\t\tadding a new moment to the history.\n\t*/\n\tfunction enginePlay(title, noHistory) {\n\t\tif (DEBUG) { console.log(`[Engine/enginePlay(title: \"${title}\", noHistory: ${noHistory})]`); }\n\n\t\tlet passageTitle = title;\n\n\t\t// Update the engine state.\n\t\t_state = States.Playing;\n\n\t\t// Reset the temporary state and variables objects.\n\t\tTempState = {}; // eslint-disable-line no-undef\n\t\tState.clearTemporary();\n\n\t\t// Debug view setup.\n\t\tlet passageReadyOutput;\n\t\tlet passageDoneOutput;\n\n\t\t// Execute the navigation override callback.\n\t\tif (typeof Config.navigation.override === 'function') {\n\t\t\ttry {\n\t\t\t\tconst overrideTitle = Config.navigation.override(passageTitle);\n\n\t\t\t\tif (overrideTitle) {\n\t\t\t\t\tpassageTitle = overrideTitle;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (ex) { /* no-op */ }\n\t\t}\n\n\t\t// Retrieve the passage by the given title.\n\t\t//\n\t\t// NOTE: The values of the `title` parameter and `passageTitle` variable\n\t\t// may be empty, strings, or numbers (though using a number as reference\n\t\t// to a numeric title should be discouraged), so after loading the passage,\n\t\t// always refer to `passage.title` and never to the others.\n\t\tconst passage = Story.get(passageTitle);\n\n\t\t// Execute the pre-history events and tasks.\n\t\tjQuery.event.trigger({\n\t\t\ttype : ':passageinit',\n\t\t\tpassage\n\t\t});\n\t\tObject.keys(prehistory).forEach(task => {\n\t\t\tif (typeof prehistory[task] === 'function') {\n\t\t\t\tprehistory[task].call(passage, task);\n\t\t\t}\n\t\t});\n\n\t\t// Create a new entry in the history.\n\t\tif (!noHistory) {\n\t\t\tState.create(passage.title);\n\t\t}\n\n\t\t// Clear the document body's classes.\n\t\tif (document.body.className) {\n\t\t\tdocument.body.className = '';\n\t\t}\n\n\t\t// Update the last play time.\n\t\t//\n\t\t// NOTE: This is mostly for event, task, and special passage code,\n\t\t// though the likelihood of it being needed this early is low.  This\n\t\t// will be updated again later at the end.\n\t\t_lastPlay = Util.now();\n\n\t\t// Execute pre-display tasks and the `PassageReady` special passage.\n\t\tObject.keys(predisplay).forEach(task => {\n\t\t\tif (typeof predisplay[task] === 'function') {\n\t\t\t\tpredisplay[task].call(passage, task);\n\t\t\t}\n\t\t});\n\n\t\tif (Story.has('PassageReady')) {\n\t\t\ttry {\n\t\t\t\tpassageReadyOutput = Wikifier.wikifyEval(Story.get('PassageReady').text);\n\t\t\t}\n\t\t\tcatch (ex) {\n\t\t\t\tconsole.error(ex);\n\t\t\t\tAlert.error('PassageReady', ex.message);\n\t\t\t}\n\t\t}\n\n\t\t// Update the engine state.\n\t\t_state = States.Rendering;\n\n\t\t// Get the passage's tags as a string, or `null` if there aren't any.\n\t\tconst dataTags = passage.tags.length > 0 ? passage.tags.join(' ') : null;\n\n\t\t// Create and set up the incoming passage element.\n\t\tconst passageEl = document.createElement('div');\n\t\tjQuery(passageEl)\n\t\t\t.attr({\n\t\t\t\tid             : passage.domId,\n\t\t\t\t'data-passage' : passage.title,\n\t\t\t\t'data-tags'    : dataTags\n\t\t\t})\n\t\t\t.addClass(`passage ${passage.className}`);\n\n\t\t// Add the passage's classes and tags to the document body.\n\t\tjQuery(document.body)\n\t\t\t.attr('data-tags', dataTags)\n\t\t\t.addClass(passage.className);\n\n\t\t// Add the passage's tags to the document element.\n\t\tjQuery(document.documentElement)\n\t\t\t.attr('data-tags', dataTags);\n\n\t\t// Execute pre-render events and tasks.\n\t\tjQuery.event.trigger({\n\t\t\ttype    : ':passagestart',\n\t\t\tcontent : passageEl,\n\t\t\tpassage\n\t\t});\n\t\tObject.keys(prerender).forEach(task => {\n\t\t\tif (typeof prerender[task] === 'function') {\n\t\t\t\tprerender[task].call(passage, passageEl, task);\n\t\t\t}\n\t\t});\n\n\t\t// Render the `PassageHeader` passage, if it exists, into the passage element.\n\t\tif (Story.has('PassageHeader')) {\n\t\t\tnew Wikifier(passageEl, Story.get('PassageHeader').processText());\n\t\t}\n\n\t\t// Render the passage into its element.\n\t\tpassageEl.appendChild(passage.render());\n\n\t\t// Render the `PassageFooter` passage, if it exists, into the passage element.\n\t\tif (Story.has('PassageFooter')) {\n\t\t\tnew Wikifier(passageEl, Story.get('PassageFooter').processText());\n\t\t}\n\n\t\t// Execute post-render events and tasks.\n\t\tjQuery.event.trigger({\n\t\t\ttype    : ':passagerender',\n\t\t\tcontent : passageEl,\n\t\t\tpassage\n\t\t});\n\t\tObject.keys(postrender).forEach(task => {\n\t\t\tif (typeof postrender[task] === 'function') {\n\t\t\t\tpostrender[task].call(passage, passageEl, task);\n\t\t\t}\n\t\t});\n\n\t\t// Cache the passage container.\n\t\tconst containerEl = document.getElementById('passages');\n\n\t\t// Empty the passage container.\n\t\tif (containerEl.hasChildNodes()) {\n\t\t\tif (\n\t\t\t\t   typeof Config.passages.transitionOut === 'number'\n\t\t\t\t|| typeof Config.passages.transitionOut === 'string'\n\t\t\t\t&& Config.passages.transitionOut !== ''\n\t\t\t\t&& Has.transitionEndEvent\n\t\t\t) {\n\t\t\t\t[...containerEl.childNodes].forEach(outgoing => {\n\t\t\t\t\tconst $outgoing = jQuery(outgoing);\n\n\t\t\t\t\tif (outgoing.nodeType === Node.ELEMENT_NODE && $outgoing.hasClass('passage')) {\n\t\t\t\t\t\tif ($outgoing.hasClass('passage-out')) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$outgoing\n\t\t\t\t\t\t\t.attr({\n\t\t\t\t\t\t\t\tid          : `out-${$outgoing.attr('id')}`,\n\t\t\t\t\t\t\t\t'aria-live' : 'off'\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.addClass('passage-out');\n\n\t\t\t\t\t\tif (typeof Config.passages.transitionOut === 'string') {\n\t\t\t\t\t\t\t$outgoing.on(Has.transitionEndEvent, ev => {\n\t\t\t\t\t\t\t\tif (ev.propertyName === Config.passages.transitionOut) {\n\t\t\t\t\t\t\t\t\t$outgoing.remove();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tsetTimeout(\n\t\t\t\t\t\t\t\t() => $outgoing.remove(),\n\t\t\t\t\t\t\t\tMath.max(minDomActionDelay, Config.passages.transitionOut)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t$outgoing.remove();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\tjQuery(containerEl).empty();\n\t\t\t}\n\t\t}\n\n\t\t// Append the passage element to the passage container and set up its transition.\n\t\tjQuery(passageEl)\n\t\t\t.addClass('passage-in')\n\t\t\t.appendTo(containerEl);\n\t\tsetTimeout(() => jQuery(passageEl).removeClass('passage-in'), minDomActionDelay);\n\n\t\t// Update the story display title, if necessary.\n\t\tif (Story.has('StoryDisplayTitle')) {\n\t\t\t// NOTE: We don't have an `else` here because that case will be handled later (below).\n\t\t\tif (_updating !== null || !Config.ui.updateStoryElements) {\n\t\t\t\tsetDisplayTitle(Story.get('StoryDisplayTitle').processText());\n\t\t\t}\n\t\t}\n\t\telse if (Config.passages.displayTitles && passage.title !== Config.passages.start) {\n\t\t\tdocument.title = `${passage.title} | ${Story.title}`;\n\t\t}\n\n\t\t// Scroll the window to the top.\n\t\twindow.scroll(0, 0);\n\n\t\t// Update the engine state.\n\t\t_state = States.Playing;\n\n\t\t// Execute post-display events, tasks, and the `PassageDone` special passage.\n\t\tif (Story.has('PassageDone')) {\n\t\t\ttry {\n\t\t\t\tpassageDoneOutput = Wikifier.wikifyEval(Story.get('PassageDone').text);\n\t\t\t}\n\t\t\tcatch (ex) {\n\t\t\t\tconsole.error(ex);\n\t\t\t\tAlert.error('PassageDone', ex.message);\n\t\t\t}\n\t\t}\n\n\t\tjQuery.event.trigger({\n\t\t\ttype    : ':passagedisplay',\n\t\t\tcontent : passageEl,\n\t\t\tpassage\n\t\t});\n\t\tObject.keys(postdisplay).forEach(task => {\n\t\t\tif (typeof postdisplay[task] === 'function') {\n\t\t\t\tpostdisplay[task].call(passage, task);\n\t\t\t}\n\t\t});\n\n\t\t// Update the other interface elements, if necessary.\n\t\tif (_updating !== null) {\n\t\t\t_updating.forEach(pair => {\n\t\t\t\tjQuery(pair.element).empty();\n\t\t\t\tnew Wikifier(pair.element, Story.get(pair.passage).processText().trim());\n\t\t\t});\n\t\t}\n\t\telse if (Config.ui.updateStoryElements) {\n\t\t\tUIBar.update();\n\t\t}\n\n\t\t// Add the completed debug views for `StoryInit`, `PassageReady`, and `PassageDone`\n\t\t// to the incoming passage element.\n\t\tif (Config.debug) {\n\t\t\tlet debugView;\n\n\t\t\t// Prepend the `PassageReady` debug view.\n\t\t\tif (passageReadyOutput != null) { // lazy equality for null\n\t\t\t\tdebugView = new DebugView(\n\t\t\t\t\tdocument.createDocumentFragment(),\n\t\t\t\t\t'special',\n\t\t\t\t\t'PassageReady',\n\t\t\t\t\t'PassageReady'\n\t\t\t\t);\n\t\t\t\tdebugView.modes({ hidden : true });\n\t\t\t\tdebugView.append(passageReadyOutput);\n\t\t\t\tjQuery(passageEl).prepend(debugView.output);\n\t\t\t}\n\n\t\t\t// Append the `PassageDone` debug view.\n\t\t\tif (passageDoneOutput != null) { // lazy equality for null\n\t\t\t\tdebugView = new DebugView(\n\t\t\t\t\tdocument.createDocumentFragment(),\n\t\t\t\t\t'special',\n\t\t\t\t\t'PassageDone',\n\t\t\t\t\t'PassageDone'\n\t\t\t\t);\n\t\t\t\tdebugView.modes({ hidden : true });\n\t\t\t\tdebugView.append(passageDoneOutput);\n\t\t\t\tjQuery(passageEl).append(debugView.output);\n\t\t\t}\n\n\t\t\t// Prepend the cached initialization debug views, if we're showing the first moment/turn.\n\t\t\tif (State.turns === 1 && _initDebugViews.length > 0) {\n\t\t\t\tjQuery(passageEl).prepend(_initDebugViews);\n\t\t\t}\n\t\t}\n\n\t\t// Last second post-processing for accessibility and other things.\n\t\tjQuery('#story')\n\t\t\t// Add `link-external` to all `href` bearing `<a>` elements which don't have it.\n\t\t\t.find('a[href]:not(.link-external)')\n\t\t\t.addClass('link-external')\n\t\t\t.end()\n\t\t\t// Add `tabindex=0` to all interactive elements which don't have it.\n\t\t\t.find('a,link,button,input,select,textarea')\n\t\t\t.not('[tabindex]')\n\t\t\t.attr('tabindex', 0);\n\n\t\t// Handle autosaves.\n\t\tswitch (typeof Config.saves.autosave) {\n\t\tcase 'boolean':\n\t\t\tif (Config.saves.autosave) {\n\t\t\t\tSave.autosave.save();\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'object':\n\t\t\tif (passage.tags.some(tag => Config.saves.autosave.includes(tag))) {\n\t\t\t\tSave.autosave.save();\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'function':\n\t\t\tif (Config.saves.autosave()) {\n\t\t\t\tSave.autosave.save();\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\t// Execute post-play events.\n\t\tjQuery.event.trigger({\n\t\t\ttype    : ':passageend',\n\t\t\tcontent : passageEl,\n\t\t\tpassage\n\t\t});\n\n\t\t// Reset the engine state.\n\t\t_state = States.Idle;\n\n\t\t// Update the last play time.\n\t\t_lastPlay = Util.now();\n\n\t\treturn passageEl;\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tLegacy Functions.\n\t*******************************************************************************************************************/\n\t/*\n\t\t[DEPRECATED] Play the given passage, optionally without altering the history.\n\t*/\n\tfunction engineDisplay(title, link, option) {\n\t\tif (DEBUG) { console.log('[Engine/engineDisplay()]'); }\n\n\t\tlet noHistory = false;\n\n\t\t// Process the option parameter.\n\t\tswitch (option) {\n\t\tcase undefined:\n\t\t\t/* no-op */\n\t\t\tbreak;\n\n\t\tcase 'replace':\n\t\tcase 'back':\n\t\t\tnoHistory = true;\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tthrow new Error(`Engine.display option parameter called with obsolete value \"${option}\"; please notify the developer`);\n\t\t}\n\n\t\tenginePlay(title, noHistory);\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tUtility Functions.\n\t*******************************************************************************************************************/\n\tfunction _hideOutlines() {\n\t\t_outlinePatch.set('*:focus{outline:none;}');\n\t}\n\n\tfunction _showOutlines() {\n\t\t_outlinePatch.clear();\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************************************************/\n\treturn Object.freeze(Object.defineProperties({}, {\n\t\t/*\n\t\t\tConstants.\n\t\t*/\n\t\tStates            : { value : States },\n\t\tminDomActionDelay : { value : minDomActionDelay },\n\n\t\t/*\n\t\t\tCore Functions.\n\t\t*/\n\t\tinit        : { value : engineInit },\n\t\tstart       : { value : engineStart },\n\t\trestart     : { value : engineRestart },\n\t\tstate       : { get : engineState },\n\t\tisIdle      : { value : engineIsIdle },\n\t\tisPlaying   : { value : engineIsPlaying },\n\t\tisRendering : { value : engineIsRendering },\n\t\tlastPlay    : { get : engineLastPlay },\n\t\tgoTo        : { value : engineGoTo },\n\t\tgo          : { value : engineGo },\n\t\tbackward    : { value : engineBackward },\n\t\tforward     : { value : engineForward },\n\t\tshow        : { value : engineShow },\n\t\tplay        : { value : enginePlay },\n\n\t\t/*\n\t\t\tLegacy Functions.\n\t\t*/\n\t\tdisplay : { value : engineDisplay }\n\t}));\n})();\n\n/***********************************************************************************************************************\n\n\tpassage.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/* global Config, L10n, Util, Wikifier */\n\nvar Passage = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\tlet _tagsToSkip;\n\tlet _twine1Unescape;\n\n\t/*\n\t\tTags which should not be transformed into classes:\n\t\t\tdebug      → special tag\n\t\t\tnobr       → special tag\n\t\t\tpassage    → the default class\n\t\t\tscript     → special tag (only in Twine 1)\n\t\t\tstylesheet → special tag (only in Twine 1)\n\t\t\ttwine.*    → special tag\n\t\t\twidget     → special tag\n\t*/\n\t// For Twine 1\n\tif (TWINE1) {\n\t\t_tagsToSkip = /^(?:debug|nobr|passage|script|stylesheet|widget|twine\\..*)$/i;\n\t}\n\t// For Twine 2\n\telse {\n\t\t_tagsToSkip = /^(?:debug|nobr|passage|widget|twine\\..*)$/i;\n\t}\n\n\t// For Twine 1\n\tif (TWINE1) {\n\t\t/*\n\t\t\tReturns a decoded version of the passed Twine 1 passage store encoded string.\n\t\t*/\n\t\tconst _twine1EscapesRe    = /(?:\\\\n|\\\\t|\\\\s|\\\\|\\r)/g;\n\t\tconst _hasTwine1EscapesRe = new RegExp(_twine1EscapesRe.source); // to drop the global flag\n\t\tconst _twine1EscapesMap   = Object.freeze({\n\t\t\t'\\\\n' : '\\n',\n\t\t\t'\\\\t' : '\\t',\n\t\t\t'\\\\s' : '\\\\',\n\t\t\t'\\\\'  : '\\\\',\n\t\t\t'\\r'  : ''\n\t\t});\n\n\t\t_twine1Unescape = function (str) {\n\t\t\tif (str == null) { // lazy equality for null\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\tconst val = String(str);\n\t\t\treturn val && _hasTwine1EscapesRe.test(val)\n\t\t\t\t? val.replace(_twine1EscapesRe, esc => _twine1EscapesMap[esc])\n\t\t\t\t: val;\n\t\t};\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tPassage Class.\n\t*******************************************************************************************************************/\n\tclass Passage {\n\t\tconstructor(title, el) {\n\t\t\tObject.defineProperties(this, {\n\t\t\t\t// Passage title/ID.\n\t\t\t\ttitle : {\n\t\t\t\t\tvalue : Util.unescape(title)\n\t\t\t\t},\n\n\t\t\t\t// Passage data element (within the story data element; i.e. T1: '[tiddler]', T2: 'tw-passagedata').\n\t\t\t\telement : {\n\t\t\t\t\tvalue : el || null\n\t\t\t\t},\n\n\t\t\t\t// Passage tags array (unique).\n\t\t\t\ttags : {\n\t\t\t\t\tvalue : Object.freeze(\n\t\t\t\t\t\tel && el.hasAttribute('tags')\n\t\t\t\t\t\t\t? Array.from(new Set(el.getAttribute('tags').trim().splitOrEmpty(/\\s+/)))\n\t\t\t\t\t\t\t: []\n\t\t\t\t\t)\n\t\t\t\t},\n\n\t\t\t\t// Passage excerpt.  Used by the `description()` method.\n\t\t\t\t_excerpt : {\n\t\t\t\t\twritable : true,\n\t\t\t\t\tvalue    : null\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t// Properties dependant upon the above set.\n\t\t\tObject.defineProperties(this, {\n\t\t\t\t// Passage DOM-compatible ID.\n\t\t\t\tdomId : {\n\t\t\t\t\tvalue : `passage-${Util.slugify(this.title)}`\n\t\t\t\t},\n\n\t\t\t\t// Passage classes array (sorted and unique).\n\t\t\t\tclasses : {\n\t\t\t\t\tvalue : Object.freeze(this.tags.length === 0 ? [] : (() =>\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t\tReturn the sorted list of unique classes.\n\n\t\t\t\t\t\t\tNOTE: The `this.tags` array is already sorted and unique,\n\t\t\t\t\t\t\tso we only need to filter and map here.\n\t\t\t\t\t\t*/\n\t\t\t\t\t\tthis.tags\n\t\t\t\t\t\t\t.filter(tag => !_tagsToSkip.test(tag))\n\t\t\t\t\t\t\t.map(tag => Util.slugify(tag))\n\t\t\t\t\t)())\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t// Getters.\n\t\tget className() {\n\t\t\treturn this.classes.join(' ');\n\t\t}\n\n\t\t// TODO: (v3) This should be → `get source`.\n\t\tget text() {\n\t\t\tif (this.element == null) { // lazy equality for null\n\t\t\t\tconst passage = Util.escapeMarkup(this.title);\n\t\t\t\tconst mesg    = `${L10n.get('errorTitle')}: ${L10n.get('errorNonexistentPassage', { passage })}`;\n\t\t\t\treturn `<div class=\"error-view\"><span class=\"error\">${mesg}</span></div>`;\n\t\t\t}\n\n\t\t\t// For Twine 1\n\t\t\tif (TWINE1) {\n\t\t\t\treturn _twine1Unescape(this.element.textContent);\n\t\t\t}\n\t\t\t// For Twine 2\n\t\t\telse { // eslint-disable-line no-else-return\n\t\t\t\treturn this.element.textContent.replace(/\\r/g, '');\n\t\t\t}\n\t\t}\n\n\t\tdescription() {\n\t\t\tconst descriptions = Config.passages.descriptions;\n\n\t\t\tswitch (typeof descriptions) {\n\t\t\tcase 'boolean':\n\t\t\t\tif (descriptions) {\n\t\t\t\t\treturn this.title;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 'object':\n\t\t\t\tif (descriptions.hasOwnProperty(this.title)) {\n\t\t\t\t\treturn descriptions[this.title];\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 'function':\n\t\t\t\t{\n\t\t\t\t\tconst result = descriptions.call(this);\n\n\t\t\t\t\tif (result) {\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// Initialize the excerpt cache from the raw passage text, if necessary.\n\t\t\tif (this._excerpt === null) {\n\t\t\t\tthis._excerpt = Passage.getExcerptFromText(this.text);\n\t\t\t}\n\n\t\t\treturn this._excerpt;\n\t\t}\n\n\t\t// TODO: (v3) This should be → `get text`.\n\t\tprocessText() {\n\t\t\tif (this.element == null) { // lazy equality for null\n\t\t\t\treturn this.text;\n\t\t\t}\n\n\t\t\t// Handle image passage transclusion.\n\t\t\tif (this.tags.includes('Twine.image')) {\n\t\t\t\treturn `[img[${this.text}]]`;\n\t\t\t}\n\n\t\t\tlet processed = this.text;\n\n\t\t\t// Handle `Config.passages.onProcess`.\n\t\t\tif (Config.passages.onProcess) {\n\t\t\t\tprocessed = Config.passages.onProcess.call(null, {\n\t\t\t\t\ttitle : this.title,\n\t\t\t\t\ttags  : this.tags,\n\t\t\t\t\ttext  : processed\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// Handle `Config.passages.nobr` and the `nobr` tag.\n\t\t\tif (Config.passages.nobr || this.tags.includes('nobr')) {\n\t\t\t\t// Remove all leading & trailing newlines and compact all internal sequences\n\t\t\t\t// of newlines into single spaces.\n\t\t\t\tprocessed = processed.replace(/^\\n+|\\n+$/g, '').replace(/\\n+/g, ' ');\n\t\t\t}\n\n\t\t\t// Reset stopWikify flag at the end of a passage\n\t\t\tWikifier.stopWikify = 0;\n\n\t\t\treturn processed;\n\t\t}\n\n\t\trender(options) {\n\t\t\t// Wikify the passage into a document fragment.\n\t\t\tconst frag = document.createDocumentFragment();\n\t\t\tnew Wikifier(frag, this.processText(), options);\n\n\t\t\t// Update the excerpt cache to reflect the rendered text, if we need it for the passage description\n\t\t\tif (Config.passages.descriptions == null) {\n\t\t\t\tthis._excerpt = Passage.getExcerptFromNode(frag);\n\t\t\t}\n\n\t\t\treturn frag;\n\t\t}\n\n\t\tstatic getExcerptFromNode(node, count) {\n\t\t\tif (DEBUG) { console.log(`[Passage.getExcerptFromNode(node=…, count=${count})]`, node); }\n\n\t\t\tif (!node.hasChildNodes()) {\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\t// WARNING: es5-shim's `<String>.trim()` can cause \"too much recursion\" errors\n\t\t\t// here on very large strings (e.g., ≥40 KiB), at least in Firefox, for unknown\n\t\t\t// reasons.\n\t\t\t//\n\t\t\t// To fix the issue, we're removed `\\u180E` from es5-shim's whitespace pattern\n\t\t\t// to prevent it from erroneously shimming `<String>.trim()` in the first place.\n\t\t\tlet excerpt = node.textContent.trim();\n\n\t\t\tif (excerpt !== '') {\n\t\t\t\tconst excerptRe = new RegExp(`(\\\\S+(?:\\\\s+\\\\S+){0,${count > 0 ? count - 1 : 7}})`);\n\t\t\t\texcerpt = excerpt\n\t\t\t\t\t// Compact whitespace.\n\t\t\t\t\t.replace(/\\s+/g, ' ')\n\t\t\t\t\t// Attempt to match the excerpt regexp.\n\t\t\t\t\t.match(excerptRe);\n\t\t\t}\n\n\t\t\treturn excerpt ? `${excerpt[1]}\\u2026` : '\\u2026'; // horizontal ellipsis\n\t\t}\n\n\t\tstatic getExcerptFromText(text, count) {\n\t\t\tif (DEBUG) { console.log(`[Passage.getExcerptFromText(text=…, count=${count})]`, text); }\n\n\t\t\tif (text === '') {\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\tconst excerptRe = new RegExp(`(\\\\S+(?:\\\\s+\\\\S+){0,${count > 0 ? count - 1 : 7}})`);\n\t\t\tconst excerpt   = text\n\t\t\t\t// Strip macro tags (replace with a space).\n\t\t\t\t.replace(/<<.*?>>/g, ' ')\n\t\t\t\t// Strip html tags (replace with a space).\n\t\t\t\t.replace(/<.*?>/g, ' ')\n\t\t\t\t// The above might have left problematic whitespace, so trim.\n\t\t\t\t.trim()\n\t\t\t\t// Strip table markup.\n\t\t\t\t.replace(/^\\s*\\|.*\\|.*?$/gm, '')\n\t\t\t\t// Strip image markup.\n\t\t\t\t.replace(/\\[[<>]?img\\[[^\\]]*\\]\\]/g, '')\n\t\t\t\t// Clean link markup (remove all but the link text).\n\t\t\t\t.replace(/\\[\\[([^|\\]]*?)(?:(?:\\||->|<-)[^\\]]*)?\\]\\]/g, '$1')\n\t\t\t\t// Clean heading markup.\n\t\t\t\t.replace(/^\\s*!+(.*?)$/gm, '$1')\n\t\t\t\t// Clean bold/italic/underline/highlight styles.\n\t\t\t\t.replace(/'{2}|\\/{2}|_{2}|@{2}/g, '')\n\t\t\t\t// A final trim.\n\t\t\t\t.trim()\n\t\t\t\t// Compact whitespace.\n\t\t\t\t.replace(/\\s+/g, ' ')\n\t\t\t\t// Attempt to match the excerpt regexp.\n\t\t\t\t.match(excerptRe);\n\t\t\treturn excerpt ? `${excerpt[1]}\\u2026` : '\\u2026'; // horizontal ellipsis\n\t\t}\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************************************************/\n\treturn Passage;\n})();\n\n/***********************************************************************************************************************\n\n\tsave.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/* global Config, Dialog, Engine, L10n, State, Story, UI, Util, storage, idb */\n\nvar Save = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\t// Save operation type pseudo-enumeration.\n\tconst Type = Util.toEnum({\n\t\tAutosave  : 'autosave',\n\t\tDisk      : 'disk',\n\t\tSerialize : 'serialize',\n\t\tSlot      : 'slot'\n\t});\n\n\t// The upper bound of the saves slots.\n\tlet _slotsUBound = -1;\n\n\t// Set of onLoad handlers.\n\tconst _onLoadHandlers = new Set();\n\n\t// Set of onSave handlers.\n\tconst _onSaveHandlers = new Set();\n\n\n\t/********************************\n\t\tsplit save stuff\n\t********************************/\n\tlet useSplit = () => Story.domId === 'free-cities'; // todo: make it a proper toggle\n\tfunction indexGet() {\n\t\treturn storage.get('index');\n\t}\n\n\tfunction splitSave(slot, data) {\n\t\tstorage.set(slot === 'autosave' ? slot : `slot${slot}`, data);\n\t\tconst index = indexGet();\n\t\tdelete data.state;\n\t\tslot === 'autosave' ? index.autosave = data : index.slots[slot] = data;\n\t\ttry {\n\t\t\tstorage.set('index', index);\n\t\t}\n\t\tcatch (ex) {\n\t\t\tstorage.delete(slot === 'autosave' ? 'autosave' : `slot${slot}`);\n\t\t\t// eslint-disable-next-line no-alert\n\t\t\talert('Storage quota exceeded, try removing other saves first');\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tfunction splitDelete(slot) {\n\t\tstorage.delete(slot === 'autosave' ? slot : `slot${slot}`);\n\t\tconst index = indexGet();\n\t\tslot === 'autosave' ? index.autosave = null : index.slots[slot] = null;\n\t\tstorage.set('index', index);\n\t\treturn true;\n\t}\n\n\t/*******************************************************************************************************************\n\t\tSaves Functions.\n\t*******************************************************************************************************************/\n\tfunction savesInit() {\n\t\tif (DEBUG) { console.log('[Save/savesInit()]'); }\n\n\t\t// Disable save slots and the autosave when Web Storage is unavailable.\n\t\tif (storage.name === 'cookie') {\n\t\t\tsavesObjClear();\n\t\t\tConfig.saves.autoload = undefined;\n\t\t\tConfig.saves.autosave = undefined;\n\t\t\tConfig.saves.slots = 0;\n\t\t\treturn false;\n\t\t}\n\n\t\tlet saves   = savesObjGet();\n\t\tlet updated = false;\n\n\t\t// Handle the author changing the number of save slots.\n\t\tif (Config.saves.slots !== saves.slots.length) {\n\t\t\tif (Config.saves.slots < saves.slots.length) {\n\t\t\t\t// Attempt to decrease the number of slots; this will only compact\n\t\t\t\t// the slots array, by removing empty slots, no saves will be deleted.\n\t\t\t\tsaves.slots.reverse();\n\n\t\t\t\tsaves.slots = saves.slots.filter(function (val) {\n\t\t\t\t\tif (val === null && this.count > 0) {\n\t\t\t\t\t\t--this.count;\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn true;\n\t\t\t\t}, { count : saves.slots.length - Config.saves.slots });\n\n\t\t\t\tsaves.slots.reverse();\n\t\t\t}\n\t\t\telse if (Config.saves.slots > saves.slots.length) {\n\t\t\t\t// Attempt to increase the number of slots.\n\t\t\t\t_appendSlots(saves.slots, Config.saves.slots - saves.slots.length);\n\t\t\t}\n\n\t\t\tupdated = true;\n\t\t}\n\n\t\t// If the saves object was updated, then update the store.\n\t\tif (updated) {\n\t\t\t_savesObjSave(saves);\n\t\t}\n\n\t\t_slotsUBound = saves.slots.length - 1;\n\n\t\treturn true;\n\t}\n\n\tfunction savesObjCreate() {\n\t\treturn {\n\t\t\tautosave : null,\n\t\t\tslots    : _appendSlots([], Config.saves.slots)\n\t\t};\n\t}\n\n\tfunction savesObjGet() {\n\t\tconst saves = storage.get(useSplit() ? 'index' : 'saves');\n\t\treturn saves === null ? savesObjCreate() : saves;\n\t}\n\n\tfunction savesObjClear() {\n\t\tstorage.delete('saves');\n\t\tif (useSplit()) {\n\t\t\tstorage.delete('index');\n\t\t\tstorage.delete('autosave');\n\t\t\tfor (let i = 0; i < Config.save.slots - 1; i++) storage.delete(`slot${i}`);\n\t\t}\n\t\treturn true;\n\t}\n\n\tfunction savesOk() {\n\t\treturn autosaveOk() || slotsOk();\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tAutosave Functions.\n\t*******************************************************************************************************************/\n\tfunction autosaveOk() {\n\t\treturn storage.name !== 'cookie' && typeof Config.saves.autosave !== 'undefined';\n\t}\n\n\tfunction autosaveHas() {\n\t\tconst saves = useSplit() ? { autosave : storage.get('autosave') } : savesObjGet();\n\n\t\tif (saves.autosave === null) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tfunction autosaveGet() {\n\t\tconst saves = useSplit() ? { autosave : storage.get('autosave') } : savesObjGet();\n\t\treturn saves.autosave;\n\t}\n\n\tfunction autosaveLoad() {\n\t\tconst saves = useSplit() ? { autosave : storage.get('autosave') } : savesObjGet();\n\n\t\tif (saves.autosave === null) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn _unmarshal(saves.autosave);\n\t}\n\n\tfunction autosaveSave(title, metadata) {\n\t\tif (typeof Config.saves.isAllowed === 'function' && !Config.saves.isAllowed()) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// idb intercept, don't care about no titles or metadata\n\t\t// don't know of a game where it would be relevant\n\t\tif (idb.active) {\n\t\t\tidb.saveState(0);\n\t\t\treturn true;\n\t\t}\n\n\n\t\tconst saves        = savesObjGet();\n\t\tconst supplemental = {\n\t\t\ttitle : title || Story.get(State.passage).description(),\n\t\t\tdate  : Date.now()\n\t\t};\n\n\t\tif (metadata != null) { // lazy equality for null\n\t\t\tsupplemental.metadata = metadata;\n\t\t}\n\n\t\tconst saveData = _marshal(supplemental, { type : Type.Autosave });\n\t\tif (useSplit()) return splitSave('autosave', saveData);\n\t\tsaves.autosave = saveData;\n\n\t\treturn _savesObjSave(saves);\n\t}\n\n\tfunction autosaveDelete() {\n\t\tif (useSplit()) return splitDelete('autosave');\n\n\t\tconst saves = savesObjGet();\n\t\tsaves.autosave = null;\n\t\treturn _savesObjSave(saves);\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tSlots Functions.\n\t*******************************************************************************************************************/\n\tfunction slotsOk() {\n\t\treturn storage.name !== 'cookie' && _slotsUBound !== -1;\n\t}\n\n\tfunction slotsLength() {\n\t\treturn _slotsUBound + 1;\n\t}\n\n\tfunction slotsCount() {\n\t\tif (!slotsOk()) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tconst saves = savesObjGet();\n\t\tlet count = 0;\n\n\t\tfor (let i = 0, iend = saves.slots.length; i < iend; ++i) {\n\t\t\tif (saves.slots[i] !== null) {\n\t\t\t\t++count;\n\t\t\t}\n\t\t}\n\t\treturn count;\n\t}\n\n\tfunction slotsIsEmpty() {\n\t\treturn slotsCount() === 0;\n\t}\n\n\tfunction slotsHas(slot) {\n\t\tif (slot < 0 || slot > _slotsUBound) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst saves = savesObjGet();\n\n\t\tif (slot >= saves.slots.length || saves.slots[slot] === null) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tfunction slotsGet(slot) {\n\t\tif (slot < 0 || slot > _slotsUBound) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst saves = savesObjGet();\n\n\t\tif (slot >= saves.slots.length) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn useSplit() ? storage.get(`slot${slot}`) : saves.slots[slot];\n\t}\n\n\tfunction slotsLoad(slot) {\n\t\tif (slot < 0 || slot > _slotsUBound) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst saves = savesObjGet();\n\n\t\tif (slot >= saves.slots.length || saves.slots[slot] === null) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn _unmarshal(useSplit() ? storage.get(`slot${slot}`) : saves.slots[slot]);\n\t}\n\n\tfunction slotsSave(slot, title, metadata) {\n\t\tif (typeof Config.saves.isAllowed === 'function' && !Config.saves.isAllowed()) {\n\t\t\tif (Dialog.isOpen()) {\n\t\t\t\t$(document).one(':dialogclosed', () => UI.alert(L10n.get('savesDisallowed')));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tUI.alert(L10n.get('savesDisallowed'));\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\t\tif (slot < 0 || slot > _slotsUBound) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst saves = savesObjGet();\n\n\t\tif (slot >= saves.slots.length) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst supplemental = {\n\t\t\ttitle : title || Story.get(State.passage).description(),\n\t\t\tdate  : Date.now()\n\t\t};\n\n\t\tif (metadata != null) { // lazy equality for null\n\t\t\tsupplemental.metadata = metadata;\n\t\t}\n\n\t\tconst saveData = _marshal(supplemental, { type : Type.Slot });\n\t\tif (useSplit()) return splitSave(slot, saveData);\n\n\t\tsaves.slots[slot] = saveData;\n\n\t\treturn _savesObjSave(saves);\n\t}\n\n\tfunction slotsDelete(slot) {\n\t\tif (slot < 0 || slot > _slotsUBound) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst saves = savesObjGet();\n\n\t\tif (slot >= saves.slots.length) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (useSplit()) return splitDelete(slot);\n\n\t\tsaves.slots[slot] = null;\n\t\treturn _savesObjSave(saves);\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tDisk Import/Export Functions.\n\t*******************************************************************************************************************/\n\tfunction exportToDisk(filename, metadata) {\n\t\tif (typeof Config.saves.isAllowed === 'function' && !Config.saves.isAllowed()) {\n\t\t\tif (Dialog.isOpen()) {\n\t\t\t\t$(document).one(':dialogclosed', () => UI.alert(L10n.get('savesDisallowed')));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tUI.alert(L10n.get('savesDisallowed'));\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tfunction getDatestamp() {\n\t\t\tconst now = new Date();\n\t\t\tlet MM = now.getMonth() + 1;\n\t\t\tlet DD = now.getDate();\n\t\t\tlet hh = now.getHours();\n\t\t\tlet mm = now.getMinutes();\n\t\t\tlet ss = now.getSeconds();\n\n\t\t\tif (MM < 10) { MM = `0${MM}`; }\n\t\t\tif (DD < 10) { DD = `0${DD}`; }\n\t\t\tif (hh < 10) { hh = `0${hh}`; }\n\t\t\tif (mm < 10) { mm = `0${mm}`; }\n\t\t\tif (ss < 10) { ss = `0${ss}`; }\n\n\t\t\treturn `${now.getFullYear()}${MM}${DD}-${hh}${mm}${ss}`;\n\t\t}\n\n\t\tfunction getFilename(str) {\n\t\t\treturn Util.sanitizeFilename(str)\n\t\t\t\t.replace(/[_\\s\\u2013\\u2014-]+/g, '-'); // legacy\n\t\t}\n\n\t\tconst baseName     = filename == null ? Story.domId : getFilename(filename); // lazy equality for null\n\t\tconst saveName     = `${baseName}-${getDatestamp()}.save`;\n\t\tconst supplemental = metadata == null ? {} : { metadata }; // lazy equality for null\n\t\tconst saveObj      = LZString.compressToBase64(JSON.stringify(_marshal(supplemental, { type : Type.Disk })));\n\t\tsaveAs(new Blob([saveObj], { type : 'text/plain;charset=UTF-8' }), saveName);\n\t}\n\n\tfunction importFromDisk(event) {\n\t\tconst file   = event.target.files[0];\n\t\tconst reader = new FileReader();\n\n\t\t// Add the handler that will capture the file information once the load is finished.\n\t\tjQuery(reader).one('loadend', () => {\n\t\t\tif (reader.error) {\n\t\t\t\tconst ex = reader.error;\n\t\t\t\tUI.alert(`${L10n.get('errorSaveDiskLoadFailed').toUpperFirst()} (${ex.name}: ${ex.message}).</p><p>${L10n.get('aborting')}.`);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet saveObj;\n\n\t\t\ttry {\n\t\t\t\tsaveObj = JSON.parse(\n\t\t\t\t\t/* legacy */ /\\.json$/i.test(file.name) || /^\\{/.test(reader.result)\n\t\t\t\t\t\t? reader.result\n\t\t\t\t\t\t: /* /legacy */ LZString.decompressFromBase64(reader.result)\n\t\t\t\t);\n\t\t\t}\n\t\t\tcatch (ex) { /* no-op; `_unmarshal()` will handle the error */ }\n\n\t\t\t_unmarshal(saveObj);\n\t\t});\n\n\t\t// Initiate the file load.\n\t\treader.readAsText(file);\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tSerialization Functions.\n\t*******************************************************************************************************************/\n\tfunction serialize(metadata) {\n\t\tif (typeof Config.saves.isAllowed === 'function' && !Config.saves.isAllowed()) {\n\t\t\tif (Dialog.isOpen()) {\n\t\t\t\t$(document).one(':dialogclosed', () => UI.alert(L10n.get('savesDisallowed')));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tUI.alert(L10n.get('savesDisallowed'));\n\t\t\t}\n\n\t\t\treturn null;\n\t\t}\n\n\t\tconst supplemental = metadata == null ? {} : { metadata }; // lazy equality for null\n\t\treturn LZString.compressToBase64(JSON.stringify(_marshal(supplemental, { type : Type.Serialize })));\n\t}\n\n\tfunction deserialize(base64Str) {\n\t\t/*\n\t\t\tNOTE: We purposefully do not attempt to catch parameter shenanigans\n\t\t\there, instead relying on `_unmarshal()` to do the heavy lifting.\n\t\t*/\n\n\t\tlet saveObj;\n\n\t\ttry {\n\t\t\tsaveObj = JSON.parse(LZString.decompressFromBase64(base64Str));\n\t\t}\n\t\tcatch (ex) { /* no-op; `_unmarshal()` will handle the error */ }\n\n\t\tif (!_unmarshal(saveObj)) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn saveObj.metadata;\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tEvent Functions.\n\t*******************************************************************************************************************/\n\tfunction onLoadAdd(handler) {\n\t\tconst valueType = Util.getType(handler);\n\n\t\tif (valueType !== 'function') {\n\t\t\tthrow new TypeError(`Save.onLoad.add handler parameter must be a function (received: ${valueType})`);\n\t\t}\n\n\t\t_onLoadHandlers.add(handler);\n\t}\n\n\tfunction onLoadClear() {\n\t\t_onLoadHandlers.clear();\n\t}\n\n\tfunction onLoadDelete(handler) {\n\t\treturn _onLoadHandlers.delete(handler);\n\t}\n\n\tfunction onLoadSize() {\n\t\treturn _onLoadHandlers.size;\n\t}\n\n\tfunction onSaveAdd(handler) {\n\t\tconst valueType = Util.getType(handler);\n\n\t\tif (valueType !== 'function') {\n\t\t\tthrow new TypeError(`Save.onSave.add handler parameter must be a function (received: ${valueType})`);\n\t\t}\n\n\t\t_onSaveHandlers.add(handler);\n\t}\n\n\tfunction onSaveClear() {\n\t\t_onSaveHandlers.clear();\n\t}\n\n\tfunction onSaveDelete(handler) {\n\t\treturn _onSaveHandlers.delete(handler);\n\t}\n\n\tfunction onSaveSize() {\n\t\treturn _onSaveHandlers.size;\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tUtility Functions.\n\t*******************************************************************************************************************/\n\tfunction _appendSlots(array, num) {\n\t\tfor (let i = 0; i < num; ++i) {\n\t\t\tarray.push(null);\n\t\t}\n\n\t\treturn array;\n\t}\n\n\tfunction _savesObjIsEmpty(saves) {\n\t\tconst slots = saves.slots;\n\t\tlet isSlotsEmpty = true;\n\n\t\tfor (let i = 0, iend = slots.length; i < iend; ++i) {\n\t\t\tif (slots[i] !== null) {\n\t\t\t\tisSlotsEmpty = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn saves.autosave === null && isSlotsEmpty;\n\t}\n\n\tfunction _savesObjSave(saves) {\n\t\tif (_savesObjIsEmpty(saves)) {\n\t\t\tstorage.delete('saves');\n\t\t\treturn true;\n\t\t}\n\n\t\treturn storage.set('saves', saves);\n\t}\n\n\tfunction _marshal(supplemental, details) {\n\t\tif (DEBUG) { console.log(`[Save/_marshal(…, { type : '${details.type}' })]`); }\n\n\t\tif (supplemental != null && typeof supplemental !== 'object') { // lazy equality for null\n\t\t\tthrow new Error('supplemental parameter must be an object');\n\t\t}\n\n\t\tconst saveObj = Object.assign({}, supplemental, {\n\t\t\tid    : Config.saves.id,\n\t\t\tstate : State.marshalForSave()\n\t\t});\n\n\t\tif (Config.saves.version) {\n\t\t\tsaveObj.version = Config.saves.version;\n\t\t}\n\n\t\t_onSaveHandlers.forEach(fn => fn(saveObj, details));\n\n\t\t// Delta encode the state history and delete the non-encoded property.\n\t\tsaveObj.state.delta = State.deltaEncode(saveObj.state.history);\n\t\tdelete saveObj.state.history;\n\n\t\treturn saveObj;\n\t}\n\n\tfunction _unmarshal(saveObj) {\n\t\tif (DEBUG) { console.log('[Save/_unmarshal()]'); }\n\n\t\ttry {\n\t\t\t/* eslint-disable no-param-reassign */\n\n\t\t\tif (!saveObj || !saveObj.hasOwnProperty('id') || !saveObj.hasOwnProperty('state')) {\n\t\t\t\tthrow new Error(L10n.get('errorSaveMissingData'));\n\t\t\t}\n\n\t\t\t// Delta decode the state history and delete the encoded property.\n\t\t\tif (!saveObj.state.history) {\n\t\t\t\tif (saveObj.state.jdelta) delete saveObj.state.jdelta;\n\t\t\t\tif (saveObj.state.delta) saveObj.state.history = State.deltaDecode(saveObj.state.delta);\n\t\t\t\tdelete saveObj.state.delta;\n\t\t\t}\n\n\t\t\t_onLoadHandlers.forEach(fn => fn(saveObj));\n\n\t\t\tif (saveObj.id !== Config.saves.id) {\n\t\t\t\tthrow new Error(L10n.get('errorSaveIdMismatch'));\n\t\t\t}\n\n\t\t\t// Restore the state.\n\t\t\tState.unmarshalForSave(saveObj.state); // may also throw exceptions\n\n\t\t\t// Show the active moment.\n\t\t\tEngine.show();\n\t\t\t/* eslint-enable no-param-reassign */\n\t\t}\n\t\tcatch (ex) {\n\t\t\tUI.alert(`${ex.message.toUpperFirst()}.</p><p>${L10n.get('aborting')}.`);\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************************************************/\n\treturn Object.freeze(Object.defineProperties({}, {\n\t\t/*\n\t\t\tSave Functions.\n\t\t*/\n\t\tinit  : { value : savesInit },\n\t\tget   : { value : savesObjGet },\n\t\tclear : { value : savesObjClear },\n\t\tok    : { value : savesOk },\n\n\t\t/*\n\t\t\tAutosave Functions.\n\t\t*/\n\t\tautosave : {\n\t\t\tvalue : Object.freeze(Object.defineProperties({}, {\n\t\t\t\tok     : { value : autosaveOk },\n\t\t\t\thas    : { value : autosaveHas },\n\t\t\t\tget    : { value : autosaveGet },\n\t\t\t\tload   : { value : autosaveLoad },\n\t\t\t\tsave   : { value : autosaveSave },\n\t\t\t\tdelete : { value : autosaveDelete }\n\t\t\t}))\n\t\t},\n\n\t\t/*\n\t\t\tSlots Functions.\n\t\t*/\n\t\tslots : {\n\t\t\tvalue : Object.freeze(Object.defineProperties({}, {\n\t\t\t\tok      : { value : slotsOk },\n\t\t\t\tlength  : { get : slotsLength },\n\t\t\t\tisEmpty : { value : slotsIsEmpty },\n\t\t\t\tcount   : { value : slotsCount },\n\t\t\t\thas     : { value : slotsHas },\n\t\t\t\tget     : { value : slotsGet },\n\t\t\t\tload    : { value : slotsLoad },\n\t\t\t\tsave    : { value : slotsSave },\n\t\t\t\tdelete  : { value : slotsDelete }\n\t\t\t}))\n\t\t},\n\n\t\t/*\n\t\t\tDisk Import/Export Functions.\n\t\t*/\n\t\texport : { value : exportToDisk },\n\t\timport : { value : importFromDisk },\n\n\t\t/*\n\t\t\tSerialization Functions.\n\t\t*/\n\t\tserialize   : { value : serialize },\n\t\tdeserialize : { value : deserialize },\n\n\t\t/*\n\t\t\tEvent Functions.\n\t\t*/\n\t\tonLoad : {\n\t\t\tvalue : Object.freeze(Object.defineProperties({}, {\n\t\t\t\tadd      : { value : onLoadAdd },\n\t\t\t\tclear    : { value : onLoadClear },\n\t\t\t\tdelete   : { value : onLoadDelete },\n\t\t\t\tsize     : { get : onLoadSize },\n\t\t\t\thandlers : { value : _onLoadHandlers }\n\t\t\t}))\n\t\t},\n\t\tonSave : {\n\t\t\tvalue : Object.freeze(Object.defineProperties({}, {\n\t\t\t\tadd      : { value : onSaveAdd },\n\t\t\t\tclear    : { value : onSaveClear },\n\t\t\t\tdelete   : { value : onSaveDelete },\n\t\t\t\tsize     : { get : onSaveSize },\n\t\t\t\thandlers : { value : _onSaveHandlers }\n\t\t\t}))\n\t\t}\n\t}));\n})();\n\n/***********************************************************************************************************************\n\n\tsetting.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/* global Util, settings:true, storage */\n\nvar Setting = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\t// Setting control types object (pseudo-enumeration).\n\tconst Types = Util.toEnum({\n\t\tHeader : 0,\n\t\tToggle : 1,\n\t\tList   : 2,\n\t\tRange  : 3\n\t});\n\n\t// Setting definition array.\n\tconst _definitions = [];\n\n\n\t/*******************************************************************************************************************\n\t\tSettings Functions.\n\t*******************************************************************************************************************/\n\tfunction settingsInit() {\n\t\tif (DEBUG) { console.log('[Setting/settingsInit()]'); }\n\n\t\t/* legacy */\n\t\t// Attempt to migrate an existing `options` store to `settings`.\n\t\tif (storage.has('options')) {\n\t\t\tconst old = storage.get('options');\n\n\t\t\tif (old !== null) {\n\t\t\t\twindow.SugarCube.settings = settings = Object.assign(settingsCreate(), old);\n\t\t\t}\n\n\t\t\tsettingsSave();\n\t\t\tstorage.delete('options');\n\t\t}\n\t\t/* /legacy */\n\n\t\t// Load existing settings.\n\t\tsettingsLoad();\n\n\t\t// Execute `onInit` callbacks.\n\t\t_definitions.forEach(def => {\n\t\t\tif (def.hasOwnProperty('onInit')) {\n\t\t\t\tconst thisArg = {\n\t\t\t\t\tname    : def.name,\n\t\t\t\t\tvalue   : settings[def.name],\n\t\t\t\t\tdefault : def.default\n\t\t\t\t};\n\n\t\t\t\tif (def.hasOwnProperty('list')) {\n\t\t\t\t\tthisArg.list = def.list;\n\t\t\t\t}\n\n\t\t\t\tdef.onInit.call(thisArg);\n\t\t\t}\n\t\t});\n\t}\n\n\tfunction settingsCreate() {\n\t\treturn Object.create(null);\n\t}\n\n\tfunction settingsSave() {\n\t\tconst savedSettings = settingsCreate();\n\n\t\tif (Object.keys(settings).length > 0) {\n\t\t\t_definitions\n\t\t\t\t.filter(def => def.type !== Types.Header && settings[def.name] !== def.default)\n\t\t\t\t.forEach(def => savedSettings[def.name] = settings[def.name]);\n\t\t}\n\n\t\tif (Object.keys(savedSettings).length === 0) {\n\t\t\tstorage.delete('settings');\n\t\t\treturn true;\n\t\t}\n\n\t\treturn storage.set('settings', savedSettings);\n\t}\n\n\tfunction settingsLoad() {\n\t\tconst defaultSettings = settingsCreate();\n\t\tconst loadedSettings  = storage.get('settings') || settingsCreate();\n\n\t\t// Load the defaults.\n\t\t_definitions\n\t\t\t.filter(def => def.type !== Types.Header)\n\t\t\t.forEach(def => defaultSettings[def.name] = def.default);\n\n\t\t// Assign to the `settings` object while overwriting the defaults with the loaded settings.\n\t\twindow.SugarCube.settings = settings = Object.assign(defaultSettings, loadedSettings);\n\t}\n\n\tfunction settingsClear() {\n\t\twindow.SugarCube.settings = settings = settingsCreate();\n\t\tstorage.delete('settings');\n\t\treturn true;\n\t}\n\n\tfunction settingsReset(name) {\n\t\tif (arguments.length === 0) {\n\t\t\tsettingsClear();\n\t\t\tsettingsLoad();\n\t\t}\n\t\telse {\n\t\t\tif (name == null || !definitionsHas(name)) { // lazy equality for null\n\t\t\t\tthrow new Error(`nonexistent setting \"${name}\"`);\n\t\t\t}\n\n\t\t\tconst def = definitionsGet(name);\n\n\t\t\tif (def.type !== Types.Header) {\n\t\t\t\tsettings[name] = def.default;\n\t\t\t}\n\t\t}\n\n\t\treturn settingsSave();\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tDefinitions Functions.\n\t*******************************************************************************************************************/\n\tfunction definitionsForEach(callback, thisArg) {\n\t\t_definitions.forEach(callback, thisArg);\n\t}\n\n\tfunction definitionsAdd(type, name, def) {\n\t\tif (arguments.length < 3) {\n\t\t\tconst errors = [];\n\t\t\tif (arguments.length < 1) { errors.push('type'); }\n\t\t\tif (arguments.length < 2) { errors.push('name'); }\n\t\t\tif (arguments.length < 3) { errors.push('definition'); }\n\t\t\tthrow new Error(`missing parameters, no ${errors.join(' or ')} specified`);\n\t\t}\n\n\t\tif (typeof def !== 'object') {\n\t\t\tthrow new TypeError('definition parameter must be an object');\n\t\t}\n\n\t\tif (definitionsHas(name)) {\n\t\t\tthrow new Error(`cannot clobber existing setting \"${name}\"`);\n\t\t}\n\n\t\t/*\n\t\t\tDefinition object properties and types:\n\t\t\t\ttype      →  (all)   → Setting.Types\n\t\t\t\tname      →  (all)   → string\n\t\t\t\tlabel     →  (all)   → string\n\t\t\t\tdesc      →  (all)   → string\n\t\t\t\tdefault\n\t\t\t\t\t(if defined)\n \t\t\t\t\t\t  →  Toggle  → boolean\n\t\t\t\t\t\t  →  List    → Array\n\t\t\t\t\t\t  →  Range   → number\n\t\t\t\t\t(if undefined)\n\t\t\t\t\t\t  →  Toggle  → false\n\t\t\t\t\t\t  →  List    → list[0]\n\t\t\t\t\t\t  →  Range   → max\n\t\t\t\tlist      →  List    → Array\n\t\t\t\tmin       →  Range   → number\n\t\t\t\tmax       →  Range   → number\n\t\t\t\tstep      →  Range   → number\n\t\t\t\tonInit    →  (all)   → function\n\t\t\t\tonChange  →  (all)   → function\n\t\t*/\n\t\tconst definition = {\n\t\t\ttype,\n\t\t\tname,\n\t\t\tlabel : typeof def.label === 'string' ? def.label.trim() : ''\n\t\t};\n\n\t\tif (typeof def.desc === 'string') {\n\t\t\tconst desc = def.desc.trim();\n\n\t\t\tif (desc !== '') {\n\t\t\t\tdefinition.desc = desc;\n\t\t\t}\n\t\t}\n\n\t\tswitch (type) {\n\t\tcase Types.Header:\n\t\t\tbreak;\n\n\t\tcase Types.Toggle:\n\t\t\tdefinition.default = !!def.default;\n\t\t\tbreak;\n\n\t\tcase Types.List:\n\t\t\tif (!def.hasOwnProperty('list')) {\n\t\t\t\tthrow new Error('no list specified');\n\t\t\t}\n\t\t\telse if (!Array.isArray(def.list)) {\n\t\t\t\tthrow new TypeError('list must be an array');\n\t\t\t}\n\t\t\telse if (def.list.length === 0) {\n\t\t\t\tthrow new Error('list must not be empty');\n\t\t\t}\n\n\t\t\tdefinition.list = Object.freeze(def.list);\n\n\t\t\tif (def.default == null) { // lazy equality for null\n\t\t\t\tdefinition.default = def.list[0];\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconst defaultIndex = def.list.indexOf(def.default);\n\n\t\t\t\tif (defaultIndex === -1) {\n\t\t\t\t\tthrow new Error('list does not contain default');\n\t\t\t\t}\n\n\t\t\t\tdefinition.default = def.list[defaultIndex];\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase Types.Range:\n\t\t\tif (!def.hasOwnProperty('min')) {\n\t\t\t\tthrow new Error('no min specified');\n\t\t\t}\n\t\t\telse if (\n\t\t\t\t   typeof def.min !== 'number'\n\t\t\t\t|| Number.isNaN(def.min)\n\t\t\t\t|| !Number.isFinite(def.min)\n\t\t\t) {\n\t\t\t\tthrow new TypeError('min must be a finite number');\n\t\t\t}\n\n\t\t\tif (!def.hasOwnProperty('max')) {\n\t\t\t\tthrow new Error('no max specified');\n\t\t\t}\n\t\t\telse if (\n\t\t\t\t   typeof def.max !== 'number'\n\t\t\t\t|| Number.isNaN(def.max)\n\t\t\t\t|| !Number.isFinite(def.max)\n\t\t\t) {\n\t\t\t\tthrow new TypeError('max must be a finite number');\n\t\t\t}\n\n\t\t\tif (!def.hasOwnProperty('step')) {\n\t\t\t\tthrow new Error('no step specified');\n\t\t\t}\n\t\t\telse if (\n\t\t\t\t   typeof def.step !== 'number'\n\t\t\t\t|| Number.isNaN(def.step)\n\t\t\t\t|| !Number.isFinite(def.step)\n\t\t\t\t|| def.step <= 0\n\t\t\t) {\n\t\t\t\tthrow new TypeError('step must be a finite number greater than zero');\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// Determine how many fractional digits we need to be concerned with based on the step value.\n\t\t\t\tconst fracDigits = (() => {\n\t\t\t\t\tconst str = String(def.step);\n\t\t\t\t\tconst pos = str.lastIndexOf('.');\n\t\t\t\t\treturn pos === -1 ? 0 : str.length - pos - 1;\n\t\t\t\t})();\n\n\t\t\t\t// Set up a function to validate a given value against the step value.\n\t\t\t\tfunction stepValidate(value) {\n\t\t\t\t\tif (fracDigits > 0) {\n\t\t\t\t\t\tconst ma = Number(`${def.min}e${fracDigits}`);\n\t\t\t\t\t\tconst sa = Number(`${def.step}e${fracDigits}`);\n\t\t\t\t\t\tconst va = Number(`${value}e${fracDigits}`) - ma;\n\t\t\t\t\t\treturn Number(`${va - va % sa + ma}e-${fracDigits}`);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst va = value - def.min;\n\t\t\t\t\treturn va - va % def.step + def.min;\n\t\t\t\t}\n\n\t\t\t\t// Sanity check the max value against the step value.\n\t\t\t\tif (stepValidate(def.max) !== def.max) {\n\t\t\t\t\tthrow new RangeError(`max (${def.max}) is not a multiple of the step (${def.step}) plus the min (${def.min})`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdefinition.max = def.max;\n\t\t\tdefinition.min = def.min;\n\t\t\tdefinition.step = def.step;\n\n\t\t\tif (def.default == null) { // lazy equality for null\n\t\t\t\tdefinition.default = def.max;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (\n\t\t\t\t\t   typeof def.default !== 'number'\n\t\t\t\t\t|| Number.isNaN(def.default)\n\t\t\t\t\t|| !Number.isFinite(def.default)\n\t\t\t\t) {\n\t\t\t\t\tthrow new TypeError('default must be a finite number');\n\t\t\t\t}\n\t\t\t\telse if (def.default < def.min) {\n\t\t\t\t\tthrow new RangeError(`default (${def.default}) is less than min (${def.min})`);\n\t\t\t\t}\n\t\t\t\telse if (def.default > def.max) {\n\t\t\t\t\tthrow new RangeError(`default (${def.default}) is greater than max (${def.max})`);\n\t\t\t\t}\n\n\t\t\t\tdefinition.default = def.default;\n\t\t\t}\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tthrow new Error(`unknown Setting type: ${type}`);\n\t\t}\n\n\t\tif (typeof def.onInit === 'function') {\n\t\t\tdefinition.onInit = Object.freeze(def.onInit);\n\t\t}\n\n\t\tif (typeof def.onChange === 'function') {\n\t\t\tdefinition.onChange = Object.freeze(def.onChange);\n\t\t}\n\n\t\t_definitions.push(Object.freeze(definition));\n\t}\n\n\tfunction definitionsAddHeader(name, desc) {\n\t\tdefinitionsAdd(Types.Header, name, { desc });\n\t}\n\n\tfunction definitionsAddToggle(...args) {\n\t\tdefinitionsAdd(Types.Toggle, ...args);\n\t}\n\n\tfunction definitionsAddList(...args) {\n\t\tdefinitionsAdd(Types.List, ...args);\n\t}\n\n\tfunction definitionsAddRange(...args) {\n\t\tdefinitionsAdd(Types.Range, ...args);\n\t}\n\n\tfunction definitionsIsEmpty() {\n\t\treturn _definitions.length === 0;\n\t}\n\n\tfunction definitionsHas(name) {\n\t\treturn _definitions.some(definition => definition.name === name);\n\t}\n\n\tfunction definitionsGet(name) {\n\t\treturn _definitions.find(definition => definition.name === name);\n\t}\n\n\tfunction definitionsDelete(name) {\n\t\tif (definitionsHas(name)) {\n\t\t\tdelete settings[name];\n\t\t}\n\n\t\tfor (let i = 0; i < _definitions.length; ++i) {\n\t\t\tif (_definitions[i].name === name) {\n\t\t\t\t_definitions.splice(i, 1);\n\t\t\t\tdefinitionsDelete(name);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************************************************/\n\treturn Object.freeze(Object.defineProperties({}, {\n\t\t/*\n\t\t\tEnumerations.\n\t\t*/\n\t\tTypes : { value : Types },\n\n\t\t/*\n\t\t\tSettings Functions.\n\t\t*/\n\t\tinit   : { value : settingsInit },\n\t\tcreate : { value : settingsCreate },\n\t\tsave   : { value : settingsSave },\n\t\tload   : { value : settingsLoad },\n\t\tclear  : { value : settingsClear },\n\t\treset  : { value : settingsReset },\n\n\t\t/*\n\t\t\tDefinitions Functions.\n\t\t*/\n\t\tforEach   : { value : definitionsForEach },\n\t\tadd       : { value : definitionsAdd },\n\t\taddHeader : { value : definitionsAddHeader },\n\t\taddToggle : { value : definitionsAddToggle },\n\t\taddList   : { value : definitionsAddList },\n\t\taddRange  : { value : definitionsAddRange },\n\t\tisEmpty   : { value : definitionsIsEmpty },\n\t\thas       : { value : definitionsHas },\n\t\tget       : { value : definitionsGet },\n\t\tdelete    : { value : definitionsDelete }\n\t}));\n})();\n\n/***********************************************************************************************************************\n\n\tstory.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/* global Alert, Config, Passage, Scripting, StyleWrapper, Util, Wikifier */\n\nvar Story = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\t// Map of normal passages.\n\tconst _passages = {};\n\n\t// List of init passages.\n\tconst _inits = [];\n\n\t// List of script passages.\n\tconst _scripts = [];\n\n\t// List of style passages.\n\tconst _styles = [];\n\n\t// List of widget passages.\n\tconst _widgets = [];\n\n\t// Story title.\n\tlet _title = '';\n\n\t// Story IFID.\n\tlet _ifId = '';\n\n\t// DOM-compatible ID.\n\tlet _domId = '';\n\n\n\t/*******************************************************************************************************************\n\t\tStory Functions.\n\t*******************************************************************************************************************/\n\tfunction storyLoad() {\n\t\tif (DEBUG) { console.log('[Story/storyLoad()]'); }\n\n\t\tconst validationCodeTags = [\n\t\t\t'init',\n\t\t\t'widget'\n\t\t];\n\t\tconst validationNoCodeTagPassages = [\n\t\t\t'PassageDone',\n\t\t\t'PassageFooter',\n\t\t\t'PassageHeader',\n\t\t\t'PassageReady',\n\t\t\t'StoryAuthor',\n\t\t\t'StoryBanner',\n\t\t\t'StoryCaption',\n\t\t\t'StoryInit',\n\t\t\t'StoryMenu',\n\t\t\t'StoryShare',\n\t\t\t'StorySubtitle'\n\t\t];\n\n\t\tfunction validateStartingPassage(passage) {\n\t\t\tif (passage.tags.includesAny(validationCodeTags)) {\n\t\t\t\tthrow new Error(`starting passage \"${passage.title}\" contains special tags; invalid: \"${passage.tags.filter(tag => validationCodeTags.includes(tag)).sort().join('\", \"')}\"`);\n\t\t\t}\n\t\t}\n\n\t\tfunction validateSpecialPassages(passage, ...tags) {\n\t\t\tif (validationNoCodeTagPassages.includes(passage.title)) {\n\t\t\t\tthrow new Error(`special passage \"${passage.title}\" contains special tags; invalid: \"${tags.sort().join('\", \"')}\"`);\n\t\t\t}\n\n\t\t\tconst codeTags  = [...validationCodeTags];\n\t\t\tconst foundTags = [];\n\n\t\t\tpassage.tags.forEach(tag => {\n\t\t\t\tif (codeTags.includes(tag)) {\n\t\t\t\t\tfoundTags.push(...codeTags.delete(tag));\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tif (foundTags.length > 1) {\n\t\t\t\tthrow new Error(`passage \"${passage.title}\" contains multiple special tags; invalid: \"${foundTags.sort().join('\", \"')}\"`);\n\t\t\t}\n\t\t}\n\n\t\t// For Twine 1.\n\t\tif (TWINE1) {\n\t\t\t/*\n\t\t\t\tAdditional Twine 1 validation setup.\n\t\t\t*/\n\t\t\tvalidationCodeTags.unshift('script', 'stylesheet');\n\t\t\tvalidationNoCodeTagPassages.push('StoryTitle');\n\n\t\t\t/*\n\t\t\t\tSet the default starting passage.\n\t\t\t*/\n\t\t\tConfig.passages.start = (() => {\n\t\t\t\t/*\n\t\t\t\t\tHandle the Twine 1.4+ Test Play From Here feature.\n\n\t\t\t\t\tWARNING: Do not remove the `String()` wrapper from or change the quote\n\t\t\t\t\tstyle of the `\"START_AT\"` replacement target.  The former is there to\n\t\t\t\t\tkeep UglifyJS from pruning the code into oblivion—i.e. minifying the\n\t\t\t\t\tcode into something broken.  The latter is there because the Twine 1\n\t\t\t\t\tpattern that matches it depends upon the double quotes.\n\n\t\t\t\t*/\n\t\t\t\tconst testPlay = String(\"START_AT\"); // eslint-disable-line quotes\n\n\t\t\t\tif (testPlay !== '') {\n\t\t\t\t\tif (DEBUG) { console.log(`\\tTest play; starting passage: \"${testPlay}\"`); }\n\n\t\t\t\t\tConfig.debug = true;\n\t\t\t\t\treturn testPlay;\n\t\t\t\t}\n\n\t\t\t\t// In the absence of a `testPlay` value, return 'Start'.\n\t\t\t\treturn 'Start';\n\t\t\t})();\n\n\t\t\t/*\n\t\t\t\tProcess the passages, excluding any tagged 'Twine.private' or 'annotation'.\n\t\t\t*/\n\t\t\tjQuery('#store-area')\n\t\t\t\t.children(':not([tags~=\"Twine.private\"],[tags~=\"annotation\"])')\n\t\t\t\t.each(function () {\n\t\t\t\t\tconst $this   = jQuery(this);\n\t\t\t\t\tconst passage = new Passage($this.attr('tiddler'), this);\n\n\t\t\t\t\t// Special cases.\n\t\t\t\t\tif (passage.title === Config.passages.start) {\n\t\t\t\t\t\tvalidateStartingPassage(passage);\n\t\t\t\t\t\t_passages[passage.title] = passage;\n\t\t\t\t\t}\n\t\t\t\t\telse if (passage.tags.includes('init')) {\n\t\t\t\t\t\tvalidateSpecialPassages(passage, 'init');\n\t\t\t\t\t\t_inits.push(passage);\n\t\t\t\t\t}\n\t\t\t\t\telse if (passage.tags.includes('stylesheet')) {\n\t\t\t\t\t\tvalidateSpecialPassages(passage, 'stylesheet');\n\t\t\t\t\t\t_styles.push(passage);\n\t\t\t\t\t}\n\t\t\t\t\telse if (passage.tags.includes('script')) {\n\t\t\t\t\t\tvalidateSpecialPassages(passage, 'script');\n\t\t\t\t\t\t_scripts.push(passage);\n\t\t\t\t\t}\n\t\t\t\t\telse if (passage.tags.includes('widget')) {\n\t\t\t\t\t\tvalidateSpecialPassages(passage, 'widget');\n\t\t\t\t\t\t_widgets.push(passage);\n\t\t\t\t\t}\n\n\t\t\t\t\t// All other passages.\n\t\t\t\t\telse {\n\t\t\t\t\t\t_passages[passage.title] = passage;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t/*\n\t\t\t\tSet the story title or throw an exception.\n\t\t\t*/\n\t\t\tif (_passages.hasOwnProperty('StoryTitle')) {\n\t\t\t\tconst buf = document.createDocumentFragment();\n\t\t\t\tnew Wikifier(buf, _passages.StoryTitle.processText().trim());\n\t\t\t\t_storySetTitle(buf.textContent);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new Error('cannot find the \"StoryTitle\" special passage');\n\t\t\t}\n\n\t\t\t/*\n\t\t\t\tSet the default saves ID (must be done after the call to `_storySetTitle()`).\n\t\t\t*/\n\t\t\tConfig.saves.id = Story.domId;\n\t\t}\n\n\t\t// For Twine 2.\n\t\telse {\n\t\t\tconst $storydata = jQuery('tw-storydata');\n\t\t\tconst startNode  = $storydata.attr('startnode') || '';\n\n\t\t\t/*\n\t\t\t\tSet the default starting passage.\n\t\t\t*/\n\t\t\tConfig.passages.start = null; // no default in Twine 2\n\n\t\t\t/*\n\t\t\t\tProcess story options.\n\n\t\t\t\tNOTE: Currently, the only option of interest is 'debug', so we\n\t\t\t\tsimply use a regular expression to check for it.\n\t\t\t*/\n\t\t\tConfig.debug = /\\bdebug\\b/.test($storydata.attr('options'));\n\n\t\t\t/*\n\t\t\t\tProcess stylesheet passages.\n\t\t\t*/\n\t\t\t$storydata\n\t\t\t\t.children('style') // alternatively: '[type=\"text/twine-css\"]' or '#twine-user-stylesheet'\n\t\t\t\t.each(function (i) {\n\t\t\t\t\t_styles.push(new Passage(`tw-user-style-${i}`, this));\n\t\t\t\t});\n\n\t\t\t/*\n\t\t\t\tProcess script passages.\n\t\t\t*/\n\t\t\t$storydata\n\t\t\t\t.children('script') // alternatively: '[type=\"text/twine-javascript\"]' or '#twine-user-script'\n\t\t\t\t.each(function (i) {\n\t\t\t\t\t_scripts.push(new Passage(`tw-user-script-${i}`, this));\n\t\t\t\t});\n\n\t\t\t/*\n\t\t\t\tProcess normal passages, excluding any tagged 'Twine.private' or 'annotation'.\n\t\t\t*/\n\t\t\t$storydata\n\t\t\t\t.children('tw-passagedata:not([tags~=\"Twine.private\"],[tags~=\"annotation\"])')\n\t\t\t\t.each(function () {\n\t\t\t\t\tconst $this   = jQuery(this);\n\t\t\t\t\tconst pid     = $this.attr('pid') || '';\n\t\t\t\t\tconst passage = new Passage($this.attr('name'), this);\n\n\t\t\t\t\t// Special cases.\n\t\t\t\t\tif (pid === startNode && startNode !== '') {\n\t\t\t\t\t\tConfig.passages.start = passage.title;\n\t\t\t\t\t\tvalidateStartingPassage(passage);\n\t\t\t\t\t\t_passages[passage.title] = passage;\n\t\t\t\t\t}\n\t\t\t\t\telse if (passage.tags.includes('init')) {\n\t\t\t\t\t\tvalidateSpecialPassages(passage, 'init');\n\t\t\t\t\t\t_inits.push(passage);\n\t\t\t\t\t}\n\t\t\t\t\telse if (passage.tags.includes('widget')) {\n\t\t\t\t\t\tvalidateSpecialPassages(passage, 'widget');\n\t\t\t\t\t\t_widgets.push(passage);\n\t\t\t\t\t}\n\n\t\t\t\t\t// All other passages.\n\t\t\t\t\telse {\n\t\t\t\t\t\t_passages[passage.title] = passage;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t/*\n\t\t\t\tGet the story IFID.\n\t\t\t*/\n\t\t\t_ifId = $storydata.attr('ifid');\n\n\t\t\t/*\n\t\t\t\tSet the story title.\n\n\t\t\t\tFIXME: Maybe `$storydata.attr('name')` should be used instead of `'{{STORY_NAME}}'`?\n\t\t\t*/\n\t\t\t// _storySetTitle($storydata.attr('name'));\n\t\t\t_storySetTitle('{{STORY_NAME}}');\n\n\t\t\t/*\n\t\t\t\tSet the default saves ID (must be done after the call to `_storySetTitle()`).\n\t\t\t*/\n\t\t\tConfig.saves.id = Story.domId;\n\t\t}\n\t}\n\n\tfunction storyInit() {\n\t\tif (DEBUG) { console.log('[Story/storyInit()]'); }\n\n\t\t/*\n\t\t\tAdd the story styles.\n\t\t*/\n\t\t(() => {\n\t\t\tconst storyStyle = document.createElement('style');\n\n\t\t\tnew StyleWrapper(storyStyle)\n\t\t\t\t.add(_styles.map(style => style.text.trim()).join('\\n'));\n\n\t\t\tjQuery(storyStyle)\n\t\t\t\t.appendTo(document.head)\n\t\t\t\t.attr({\n\t\t\t\t\tid   : 'style-story',\n\t\t\t\t\ttype : 'text/css'\n\t\t\t\t});\n\t\t})();\n\n\t\t/*\n\t\t\tEvaluate the story scripts.\n\t\t*/\n\t\tfor (let i = 0; i < _scripts.length; ++i) {\n\t\t\ttry {\n\t\t\t\tScripting.evalJavaScript(_scripts[i].text);\n\t\t\t}\n\t\t\tcatch (ex) {\n\t\t\t\tconsole.error(ex);\n\t\t\t\tAlert.error(_scripts[i].title, typeof ex === 'object' ? ex.message : ex);\n\t\t\t}\n\t\t}\n\n\t\t/*\n\t\t\tProcess the story widgets.\n\t\t*/\n\t\tfor (let i = 0; i < _widgets.length; ++i) {\n\t\t\ttry {\n\t\t\t\tWikifier.wikifyEval(_widgets[i].processText());\n\t\t\t}\n\t\t\tcatch (ex) {\n\t\t\t\tconsole.error(ex);\n\t\t\t\tAlert.error(_widgets[i].title, typeof ex === 'object' ? ex.message : ex);\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction _storySetTitle(rawTitle) {\n\t\tif (rawTitle == null) { // lazy equality for null\n\t\t\tthrow new Error('story title must not be null or undefined');\n\t\t}\n\n\t\tconst title = Util.unescape(String(rawTitle)).trim();\n\n\t\tif (title === '') { // lazy equality for null\n\t\t\tthrow new Error('story title must not be empty or consist solely of whitespace');\n\t\t}\n\n\t\tdocument.title = _title = title;\n\n\t\t// TODO: In v3 the `_domId` should be created from a combination of the\n\t\t// `_title` slug and the IFID, if available, to avoid collisions between\n\t\t// stories whose titles generate identical slugs.\n\t\t_domId = Util.slugify(_title);\n\n\t\t// [v2] Protect the `_domId` against being an empty string.\n\t\t//\n\t\t// If `_domId` is empty, attempt a failover.\n\t\tif (_domId === '') {\n\t\t\t// If `_ifId` is not empty, then use it.\n\t\t\tif (_ifId !== '') {\n\t\t\t\t_domId = _ifId;\n\t\t\t}\n\n\t\t\t// Elsewise generate a string from the `_title`'s code points (in hexadecimal).\n\t\t\telse {\n\t\t\t\tfor (let i = 0, len = _title.length; i < len; ++i) {\n\t\t\t\t\tconst { char, start, end } = Util.charAndPosAt(_title, i);\n\t\t\t\t\t_domId += char.codePointAt(0).toString(16);\n\t\t\t\t\ti += end - start;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction storyTitle() {\n\t\treturn _title;\n\t}\n\n\tfunction storyDomId() {\n\t\treturn _domId;\n\t}\n\n\tfunction storyIfId() {\n\t\treturn _ifId;\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tPassage Functions.\n\t*******************************************************************************************************************/\n\tfunction passagesAdd(passage) {\n\t\tif (!(passage instanceof Passage)) {\n\t\t\tthrow new TypeError('Story.add passage parameter must be an instance of Passage');\n\t\t}\n\n\t\tconst title = passage.title;\n\n\t\tif (!_passages.hasOwnProperty(title)) {\n\t\t\t_passages[title] = passage;\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tfunction passagesHas(title) {\n\t\tlet type = typeof title;\n\n\t\tswitch (type) {\n\t\t// Valid types.\n\t\tcase 'number':\n\t\tcase 'string':\n\t\t\treturn _passages.hasOwnProperty(String(title));\n\n\t\t// Invalid types.  We do the extra processing just to make a nicer error.\n\t\tcase 'undefined':\n\t\t\t/* no-op */\n\t\t\tbreak;\n\n\t\tcase 'object':\n\t\t\ttype = title === null ? 'null' : 'an object';\n\t\t\tbreak;\n\n\t\tdefault: // 'bigint', 'boolean', 'function', 'symbol'\n\t\t\ttype = `a ${type}`;\n\t\t\tbreak;\n\t\t}\n\n\t\tthrow new TypeError(`Story.has title parameter cannot be ${type}`);\n\t}\n\n\tfunction passagesGet(title) {\n\t\tlet type = typeof title;\n\n\t\tswitch (type) {\n\t\t// Valid types.\n\t\tcase 'number':\n\t\tcase 'string':\n\t\t/* eslint-disable indent */\n\t\t\t{\n\t\t\t\tconst id = String(title);\n\t\t\t\treturn _passages.hasOwnProperty(id) ? _passages[id] : new Passage(id || '(unknown)');\n\t\t\t}\n\t\t/* eslint-enable indent */\n\n\t\t// Invalid types.  We do the extra processing just to make a nicer error.\n\t\tcase 'undefined':\n\t\t\t/* no-op */\n\t\t\tbreak;\n\n\t\tcase 'object':\n\t\t\ttype = title === null ? 'null' : 'an object';\n\t\t\tbreak;\n\n\t\tdefault: // 'bigint', 'boolean', 'function', 'symbol'\n\t\t\ttype = `a ${type}`;\n\t\t\tbreak;\n\t\t}\n\n\t\tthrow new TypeError(`Story.get title parameter cannot be ${type}`);\n\t}\n\n\tfunction passagesGetAllInit() {\n\t\t// NOTE: Return an immutable copy, rather than the internal mutable original.\n\t\treturn Object.freeze(Array.from(_inits));\n\t}\n\n\tfunction passagesGetAllRegular() {\n\t\t// NOTE: Return an immutable copy, rather than the internal mutable original.\n\t\treturn Object.freeze(Object.assign({}, _passages));\n\t}\n\n\tfunction passagesGetAllScript() {\n\t\t// NOTE: Return an immutable copy, rather than the internal mutable original.\n\t\treturn Object.freeze(Array.from(_scripts));\n\t}\n\n\tfunction passagesGetAllStylesheet() {\n\t\t// NOTE: Return an immutable copy, rather than the internal mutable original.\n\t\treturn Object.freeze(Array.from(_styles));\n\t}\n\n\tfunction passagesGetAllWidget() {\n\t\t// NOTE: Return an immutable copy, rather than the internal mutable original.\n\t\treturn Object.freeze(Array.from(_widgets));\n\t}\n\n\tfunction passagesLookup(key, value  /* legacy */, sortKey = 'title'/* /legacy */) {\n\t\tconst results = [];\n\n\t\tObject.keys(_passages).forEach(name => {\n\t\t\tconst passage = _passages[name];\n\n\t\t\t// Objects (sans `null`).\n\t\t\tif (typeof passage[key] === 'object' && passage[key] !== null) {\n\t\t\t\t// The only object type currently supported is `Array`, since the\n\t\t\t\t// non-method `Passage` object properties currently yield only either\n\t\t\t\t// primitives or arrays.\n\t\t\t\tif (passage[key] instanceof Array && passage[key].some(m => Util.sameValueZero(m, value))) {\n\t\t\t\t\tresults.push(passage);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// All other types (incl. `null`).\n\t\t\telse if (Util.sameValueZero(passage[key], value)) {\n\t\t\t\tresults.push(passage);\n\t\t\t}\n\t\t});\n\n\t\t// For v3.\n\t\t// /* eslint-disable no-nested-ternary */\n\t\t// // QUESTION: Do we really need to sort the list?\n\t\t// results.sort((a, b) => a.title === b.title ? 0 : a.title < b.title ? -1 : +1);\n\t\t// /* eslint-enable no-nested-ternary */\n\n\t\t/* legacy */\n\t\t/* eslint-disable eqeqeq, no-nested-ternary, max-len */\n\t\tresults.sort((a, b) => a[sortKey] == b[sortKey] ? 0 : a[sortKey] < b[sortKey] ? -1 : +1); // lazy equality for null\n\t\t/* eslint-enable eqeqeq, no-nested-ternary, max-len */\n\t\t/* /legacy */\n\n\t\treturn results;\n\t}\n\n\tfunction passagesLookupWith(predicate /* legacy */, sortKey = 'title'/* /legacy */) {\n\t\tif (typeof predicate !== 'function') {\n\t\t\tthrow new TypeError('Story.lookupWith predicate parameter must be a function');\n\t\t}\n\n\t\tconst results = [];\n\n\t\tObject.keys(_passages).forEach(name => {\n\t\t\tconst passage = _passages[name];\n\n\t\t\tif (predicate(passage)) {\n\t\t\t\tresults.push(passage);\n\t\t\t}\n\t\t});\n\n\t\t// For v3.\n\t\t// /* eslint-disable no-nested-ternary */\n\t\t// // QUESTION: Do we really need to sort the list?\n\t\t// results.sort((a, b) => a.title === b.title ? 0 : a.title < b.title ? -1 : +1);\n\t\t// /* eslint-enable no-nested-ternary */\n\n\t\t/* legacy */\n\t\t/* eslint-disable eqeqeq, no-nested-ternary, max-len */\n\t\tresults.sort((a, b) => a[sortKey] == b[sortKey] ? 0 : a[sortKey] < b[sortKey] ? -1 : +1); // lazy equality for null\n\t\t/* eslint-enable eqeqeq, no-nested-ternary, max-len */\n\t\t/* /legacy */\n\n\t\treturn results;\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************************************************/\n\treturn Object.freeze(Object.defineProperties({}, {\n\t\t// Story Functions.\n\t\tload  : { value : storyLoad },\n\t\tinit  : { value : storyInit },\n\t\ttitle : { get : storyTitle },\n\t\tdomId : { get : storyDomId },\n\t\tifId  : { get : storyIfId },\n\n\t\t// Passage Functions.\n\t\tadd              : { value : passagesAdd },\n\t\thas              : { value : passagesHas },\n\t\tget              : { value : passagesGet },\n\t\tgetAllInit       : { value : passagesGetAllInit },\n\t\tgetAllRegular    : { value : passagesGetAllRegular },\n\t\tgetAllScript     : { value : passagesGetAllScript },\n\t\tgetAllStylesheet : { value : passagesGetAllStylesheet },\n\t\tgetAllWidget     : { value : passagesGetAllWidget },\n\t\tlookup           : { value : passagesLookup },\n\t\tlookupWith       : { value : passagesLookupWith }\n\t}));\n})();\n\n/***********************************************************************************************************************\n\n\tui.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/*\n\tglobal Alert, Browser, Config, Dialog, Engine, Has, L10n, Save, Setting, State, Story, Util, Wikifier, idb\n\t       errorPrologRegExp, settings\n*/\n\nvar UI = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\t/*******************************************************************************************************************\n\t\tUI Functions, Core.\n\t*******************************************************************************************************************/\n\tfunction uiAssembleLinkList(passage, listEl) {\n\t\tlet list = listEl;\n\n\t\t// Cache the values of `Config.debug` and `Config.cleanupWikifierOutput`,\n\t\t// then disable them during this method's run.\n\t\tconst debugState = Config.debug;\n\t\tconst cleanState = Config.cleanupWikifierOutput;\n\t\tConfig.debug = false;\n\t\tConfig.cleanupWikifierOutput = false;\n\n\t\ttry {\n\t\t\tif (list == null) { // lazy equality for null\n\t\t\t\tlist = document.createElement('ul');\n\t\t\t}\n\n\t\t\t// Wikify the content of the given source passage into a fragment.\n\t\t\tconst frag = document.createDocumentFragment();\n\t\t\tnew Wikifier(frag, Story.get(passage).processText().trim());\n\n\t\t\t// Gather the text of any error elements within the fragment…\n\t\t\tconst errors = [...frag.querySelectorAll('.error')]\n\t\t\t\t.map(errEl => errEl.textContent.replace(errorPrologRegExp, ''));\n\n\t\t\t// …and throw an exception, if there were any errors.\n\t\t\tif (errors.length > 0) {\n\t\t\t\tthrow new Error(errors.join('; '));\n\t\t\t}\n\n\t\t\twhile (frag.hasChildNodes()) {\n\t\t\t\tconst node = frag.firstChild;\n\n\t\t\t\t// Create list items for <a>-element nodes.\n\t\t\t\tif (node.nodeType === Node.ELEMENT_NODE && node.nodeName.toUpperCase() === 'A') {\n\t\t\t\t\tconst li = document.createElement('li');\n\t\t\t\t\tlist.appendChild(li);\n\t\t\t\t\tli.appendChild(node);\n\t\t\t\t}\n\n\t\t\t\t// Discard non-<a>-element nodes.\n\t\t\t\telse {\n\t\t\t\t\tfrag.removeChild(node);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfinally {\n\t\t\t// Restore the `Config` settings to their original values.\n\t\t\tConfig.cleanupWikifierOutput = cleanState;\n\t\t\tConfig.debug = debugState;\n\t\t}\n\n\t\treturn list;\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tUI Functions, Built-ins.\n\t*******************************************************************************************************************/\n\tfunction uiOpenAlert(message, /* options, closeFn */ ...args) {\n\t\tjQuery(Dialog.setup(L10n.get('alertTitle'), 'alert'))\n\t\t\t.append(\n\t\t\t\t  `<p>${message}</p><ul class=\"buttons\">`\n\t\t\t\t+ `<li><button id=\"alert-ok\" class=\"ui-close\">${L10n.get(['alertOk', 'ok'])}</button></li>`\n\t\t\t\t+ '</ul>'\n\t\t\t);\n\t\tDialog.open(...args);\n\t}\n\n\tfunction uiOpenJumpto(/* options, closeFn */ ...args) {\n\t\tuiBuildJumpto();\n\t\tDialog.open(...args);\n\t}\n\n\tfunction uiOpenRestart(/* options, closeFn */ ...args) {\n\t\tuiBuildRestart();\n\t\tDialog.open(...args);\n\t}\n\n\tfunction uiOpenSaves(/* options, closeFn */ ...args) {\n\t\t// use idb when available\n\t\tif (idb.active) {\n\t\t\tDialog.setup('saves', 'saves');\n\t\t\tidb.saveList();\n\t\t}\n\t\telse uiBuildSaves();\n\t\tDialog.open(...args);\n\t}\n\n\tfunction uiOpenSettings(/* options, closeFn */ ...args) {\n\t\tuiBuildSettings();\n\t\tDialog.open(...args);\n\t}\n\n\tfunction uiOpenShare(/* options, closeFn */ ...args) {\n\t\tuiBuildShare();\n\t\tDialog.open(...args);\n\t}\n\n\tfunction uiBuildAutoload() {\n\t\tif (DEBUG) { console.log('[UI/uiBuildAutoload()]'); }\n\n\t\tjQuery(Dialog.setup(L10n.get('autoloadTitle'), 'autoload'))\n\t\t\t.append(\n\t\t\t\t/* eslint-disable max-len */\n\t\t\t\t  `<p>${L10n.get('autoloadPrompt')}</p><ul class=\"buttons\">`\n\t\t\t\t+ `<li><button id=\"autoload-ok\" class=\"ui-close\">${L10n.get(['autoloadOk', 'ok'])}</button></li>`\n\t\t\t\t+ `<li><button id=\"autoload-cancel\" class=\"ui-close\">${L10n.get(['autoloadCancel', 'cancel'])}</button></li>`\n\t\t\t\t+ '</ul>'\n\t\t\t\t/* eslint-enable max-len */\n\t\t\t);\n\n\t\t// Add an additional delegated click handler for the `.ui-close` elements to handle autoloading.\n\t\tjQuery(document).one('click.autoload', '.ui-close', ev => {\n\t\t\tconst isAutoloadOk = ev.target.id === 'autoload-ok';\n\t\t\tjQuery(document).one(':dialogclosed', () => {\n\t\t\t\tif (DEBUG) { console.log(`\\tattempting autoload: \"${Save.autosave.get().title}\"`); }\n\n\t\t\t\tif (!isAutoloadOk || !Save.autosave.load()) {\n\t\t\t\t\tEngine.play(Config.passages.start);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\treturn true;\n\t}\n\n\tfunction uiBuildJumpto() {\n\t\tif (DEBUG) { console.log('[UI/uiBuildJumpto()]'); }\n\n\t\tconst list = document.createElement('ul');\n\n\t\tjQuery(Dialog.setup(L10n.get('jumptoTitle'), 'jumpto list'))\n\t\t\t.append(list);\n\n\t\tconst expired = State.expired.length;\n\n\t\tfor (let i = State.size - 1; i >= 0; --i) {\n\t\t\tif (i === State.activeIndex) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst passage = Story.get(State.history[i].title);\n\n\t\t\tif (passage && passage.tags.includes('bookmark')) {\n\t\t\t\tjQuery(document.createElement('li'))\n\t\t\t\t\t.append(\n\t\t\t\t\t\tjQuery(document.createElement('a'))\n\t\t\t\t\t\t\t.ariaClick({ one : true }, (function (idx) {\n\t\t\t\t\t\t\t\treturn () => jQuery(document).one(':dialogclosed', () => Engine.goTo(idx));\n\t\t\t\t\t\t\t})(i))\n\t\t\t\t\t\t\t.addClass('ui-close')\n\t\t\t\t\t\t\t.text(`${L10n.get('jumptoTurn')} ${expired + i + 1}: ${passage.description()}`)\n\t\t\t\t\t)\n\t\t\t\t\t.appendTo(list);\n\t\t\t}\n\t\t}\n\n\t\tif (!list.hasChildNodes()) {\n\t\t\tjQuery(list).append(`<li><a><em>${L10n.get('jumptoUnavailable')}</em></a></li>`);\n\t\t}\n\t}\n\n\tfunction uiBuildRestart() {\n\t\tif (DEBUG) { console.log('[UI/uiBuildRestart()]'); }\n\n\t\tjQuery(Dialog.setup(L10n.get('restartTitle'), 'restart'))\n\t\t\t.append(\n\t\t\t\t/* eslint-disable max-len */\n\t\t\t\t  `<p>${L10n.get('restartPrompt')}</p><ul class=\"buttons\">`\n\t\t\t\t+ `<li><button id=\"restart-ok\">${L10n.get(['restartOk', 'ok'])}</button></li>`\n\t\t\t\t+ `<li><button id=\"restart-cancel\" class=\"ui-close\">${L10n.get(['restartCancel', 'cancel'])}</button></li>`\n\t\t\t\t+ '</ul>'\n\t\t\t\t/* eslint-enable max-len */\n\t\t\t)\n\t\t\t.find('#restart-ok')\n\t\t\t/*\n\t\t\t\tInstead of adding '.ui-close' to '#restart-ok' (to receive the use of the default\n\t\t\t\tdelegated dialog close handler), we set up a special case close handler here.  We\n\t\t\t\tdo this to ensure that the invocation of `Engine.restart()` happens after the dialog\n\t\t\t\thas fully closed.  If we did not, then a race condition could occur, causing display\n\t\t\t\tshenanigans.\n\t\t\t*/\n\t\t\t.ariaClick({ one : true }, () => {\n\t\t\t\tjQuery(document).one(':dialogclosed', () => Engine.restart());\n\t\t\t\tDialog.close();\n\t\t\t});\n\n\t\treturn true;\n\t}\n\n\tfunction uiBuildSaves() {\n\t\tconst savesAllowed = typeof Config.saves.isAllowed !== 'function' || Config.saves.isAllowed();\n\n\t\tfunction createActionItem(bId, bClass, bText, bAction) {\n\t\t\tconst $btn = jQuery(document.createElement('button'))\n\t\t\t\t.attr('id', `saves-${bId}`)\n\t\t\t\t.html(bText);\n\n\t\t\tif (bClass) {\n\t\t\t\t$btn.addClass(bClass);\n\t\t\t}\n\n\t\t\tif (bAction) {\n\t\t\t\t$btn.ariaClick(bAction);\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$btn.ariaDisabled(true);\n\t\t\t}\n\n\t\t\treturn jQuery(document.createElement('li'))\n\t\t\t\t.append($btn);\n\t\t}\n\n\t\tfunction createSaveList() {\n\t\t\tfunction createButton(bId, bClass, bText, bSlot, bAction) {\n\t\t\t\tconst $btn = jQuery(document.createElement('button'))\n\t\t\t\t\t.attr('id', `saves-${bId}-${bSlot}`)\n\t\t\t\t\t.addClass(bId)\n\t\t\t\t\t.html(bText);\n\n\t\t\t\tif (bClass) {\n\t\t\t\t\t$btn.addClass(bClass);\n\t\t\t\t}\n\n\t\t\t\tif (bAction) {\n\t\t\t\t\tif (bSlot === 'auto') {\n\t\t\t\t\t\t$btn.ariaClick({\n\t\t\t\t\t\t\tlabel : `${bText} ${L10n.get('savesLabelAuto')}`\n\t\t\t\t\t\t}, () => bAction());\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t$btn.ariaClick({\n\t\t\t\t\t\t\tlabel : `${bText} ${L10n.get('savesLabelSlot')} ${bSlot + 1}`\n\t\t\t\t\t\t}, () => bAction(bSlot));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$btn.ariaDisabled(true);\n\t\t\t\t}\n\n\t\t\t\treturn $btn;\n\t\t\t}\n\n\t\t\tconst saves  = Save.get();\n\t\t\tconst $tbody = jQuery(document.createElement('tbody'));\n\n\t\t\tif (Save.autosave.ok()) {\n\t\t\t\tconst $tdSlot = jQuery(document.createElement('td'));\n\t\t\t\tconst $tdLoad = jQuery(document.createElement('td'));\n\t\t\t\tconst $tdDesc = jQuery(document.createElement('td'));\n\t\t\t\tconst $tdDele = jQuery(document.createElement('td'));\n\n\t\t\t\t// Add the slot ID.\n\t\t\t\tjQuery(document.createElement('b'))\n\t\t\t\t\t.attr({\n\t\t\t\t\t\ttitle        : L10n.get('savesLabelAuto'),\n\t\t\t\t\t\t'aria-label' : L10n.get('savesLabelAuto')\n\t\t\t\t\t})\n\t\t\t\t\t.text('A') // '\\u25C6' Black Diamond\n\t\t\t\t\t.appendTo($tdSlot);\n\n\t\t\t\tif (saves.autosave) {\n\t\t\t\t\t// Add the load button.\n\t\t\t\t\t$tdLoad.append(\n\t\t\t\t\t\tcreateButton('load', 'ui-close', L10n.get('savesLabelLoad'), 'auto', () => {\n\t\t\t\t\t\t\tjQuery(document).one(':dialogclosed', () => Save.autosave.load());\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\n\t\t\t\t\t// Add the description (title and datestamp).\n\t\t\t\t\tjQuery(document.createElement('div'))\n\t\t\t\t\t\t.text(saves.autosave.title)\n\t\t\t\t\t\t.appendTo($tdDesc);\n\t\t\t\t\tjQuery(document.createElement('div'))\n\t\t\t\t\t\t.addClass('datestamp')\n\t\t\t\t\t\t.html(\n\t\t\t\t\t\t\tsaves.autosave.date\n\t\t\t\t\t\t\t\t? `${new Date(saves.autosave.date).toLocaleString()}`\n\t\t\t\t\t\t\t\t: `<em>${L10n.get('savesUnknownDate')}</em>`\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.appendTo($tdDesc);\n\n\t\t\t\t\t// Add the delete button.\n\t\t\t\t\t$tdDele.append(\n\t\t\t\t\t\tcreateButton('delete', null, L10n.get('savesLabelDelete'), 'auto', () => {\n\t\t\t\t\t\t\tSave.autosave.delete();\n\t\t\t\t\t\t\tuiBuildSaves();\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t// Add the disabled load button.\n\t\t\t\t\t$tdLoad.append(\n\t\t\t\t\t\tcreateButton('load', null, L10n.get('savesLabelLoad'), 'auto')\n\t\t\t\t\t);\n\n\t\t\t\t\t// Add the description.\n\t\t\t\t\t$tdDesc.addClass('empty').text('\\u2022\\u00a0\\u00a0\\u2022\\u00a0\\u00a0\\u2022');\n\n\t\t\t\t\t// Add the disabled delete button.\n\t\t\t\t\t$tdDele.append(\n\t\t\t\t\t\tcreateButton('delete', null, L10n.get('savesLabelDelete'), 'auto')\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tjQuery(document.createElement('tr'))\n\t\t\t\t\t.append($tdSlot)\n\t\t\t\t\t.append($tdLoad)\n\t\t\t\t\t.append($tdDesc)\n\t\t\t\t\t.append($tdDele)\n\t\t\t\t\t.appendTo($tbody);\n\t\t\t}\n\n\t\t\tfor (let i = 0, iend = saves.slots.length; i < iend; ++i) {\n\t\t\t\tconst $tdSlot = jQuery(document.createElement('td'));\n\t\t\t\tconst $tdLoad = jQuery(document.createElement('td'));\n\t\t\t\tconst $tdDesc = jQuery(document.createElement('td'));\n\t\t\t\tconst $tdDele = jQuery(document.createElement('td'));\n\n\t\t\t\t// Add the slot ID.\n\t\t\t\t$tdSlot.append(document.createTextNode(i + 1));\n\n\t\t\t\tif (saves.slots[i]) {\n\t\t\t\t\t// Add the save and load buttons.\n\t\t\t\t\t$tdLoad.append(\n\t\t\t\t\t\tcreateButton('save', 'ui-close', L10n.get('savesLabelSave'), i, Save.slots.save),\n\t\t\t\t\t\tcreateButton('load', 'ui-close', L10n.get('savesLabelLoad'), i, slot => {\n\t\t\t\t\t\t\tjQuery(document).one(':dialogclosed', () => Save.slots.load(slot));\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\n\t\t\t\t\t// Add the description (title and datestamp).\n\t\t\t\t\tjQuery(document.createElement('div'))\n\t\t\t\t\t\t.text(saves.slots[i].title)\n\t\t\t\t\t\t.appendTo($tdDesc);\n\t\t\t\t\tjQuery(document.createElement('div'))\n\t\t\t\t\t\t.addClass('datestamp')\n\t\t\t\t\t\t.html(\n\t\t\t\t\t\t\tsaves.slots[i].date\n\t\t\t\t\t\t\t\t? `${new Date(saves.slots[i].date).toLocaleString()}`\n\t\t\t\t\t\t\t\t: `<em>${L10n.get('savesUnknownDate')}</em>`\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.appendTo($tdDesc);\n\n\t\t\t\t\t// Add the delete button.\n\t\t\t\t\t$tdDele.append(\n\t\t\t\t\t\tcreateButton('delete', null, L10n.get('savesLabelDelete'), i, slot => {\n\t\t\t\t\t\t\tSave.slots.delete(slot);\n\t\t\t\t\t\t\tuiBuildSaves();\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t// Add the save button.\n\t\t\t\t\t$tdLoad.append(\n\t\t\t\t\t\tcreateButton('save', 'ui-close', L10n.get('savesLabelSave'), i, savesAllowed ? Save.slots.save : null)\n\t\t\t\t\t);\n\n\t\t\t\t\t// Add the description.\n\t\t\t\t\t$tdDesc.addClass('empty').text('\\u2022\\u00a0\\u00a0\\u2022\\u00a0\\u00a0\\u2022');\n\n\t\t\t\t\t// Add the disabled delete button.\n\t\t\t\t\t$tdDele.append(\n\t\t\t\t\t\tcreateButton('delete', null, L10n.get('savesLabelDelete'), i)\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tjQuery(document.createElement('tr'))\n\t\t\t\t\t.append($tdSlot)\n\t\t\t\t\t.append($tdLoad)\n\t\t\t\t\t.append($tdDesc)\n\t\t\t\t\t.append($tdDele)\n\t\t\t\t\t.appendTo($tbody);\n\t\t\t}\n\n\t\t\treturn jQuery(document.createElement('table'))\n\t\t\t\t.attr('id', 'saves-list')\n\t\t\t\t.append($tbody);\n\t\t}\n\n\t\tif (DEBUG) { console.log('[UI/uiBuildSaves()]'); }\n\n\t\tconst $dialogBody = jQuery(Dialog.setup(L10n.get('savesTitle'), 'saves'));\n\t\tconst savesOk     = Save.ok();\n\t\tconst fileOk      = Has.fileAPI && (Config.saves.tryDiskOnMobile || !Browser.isMobile.any());\n\n\t\t// Add saves list.\n\t\tif (savesOk) {\n\t\t\t$dialogBody.append(createSaveList());\n\t\t}\n\n\t\t// Add button bar items (export, import, and clear).\n\t\tif (savesOk || fileOk) {\n\t\t\tconst $btnBar = jQuery(document.createElement('ul'))\n\t\t\t\t.addClass('buttons')\n\t\t\t\t.appendTo($dialogBody);\n\n\t\t\tif (fileOk) {\n\t\t\t\t$btnBar.append(createActionItem(\n\t\t\t\t\t'export',\n\t\t\t\t\t'ui-close',\n\t\t\t\t\tL10n.get('savesLabelExport'),\n\t\t\t\t\tsavesAllowed ? () => Save.export() : null\n\t\t\t\t));\n\t\t\t\tif (navigator.clipboard) {\n\t\t\t\t\t$btnBar.append(createActionItem(\n\t\t\t\t\t\t'toClipboard',\n\t\t\t\t\t\t'ui-close',\n\t\t\t\t\t\tL10n.get('savesLabelToClipboard'),\n\t\t\t\t\t\tsavesAllowed ? () => navigator.clipboard.writeText(Save.serialize()) : null\n\t\t\t\t\t));\n\t\t\t\t}\n\t\t\t\t$btnBar.append(createActionItem(\n\t\t\t\t\t'import',\n\t\t\t\t\tnull,\n\t\t\t\t\tL10n.get('savesLabelImport'),\n\t\t\t\t\t() => $dialogBody.find('#saves-import-file').trigger('click')\n\t\t\t\t));\n\n\t\t\t\t// Add the hidden `input[type=file]` element which will be triggered by the `#saves-import` button.\n\t\t\t\tjQuery(document.createElement('input'))\n\t\t\t\t\t.css({\n\t\t\t\t\t\tdisplay    : 'block',\n\t\t\t\t\t\tvisibility : 'hidden',\n\t\t\t\t\t\tposition   : 'fixed',\n\t\t\t\t\t\tleft       : '-9999px',\n\t\t\t\t\t\ttop        : '-9999px',\n\t\t\t\t\t\twidth      : '1px',\n\t\t\t\t\t\theight     : '1px'\n\t\t\t\t\t})\n\t\t\t\t\t.attr({\n\t\t\t\t\t\ttype          : 'file',\n\t\t\t\t\t\tid            : 'saves-import-file',\n\t\t\t\t\t\ttabindex      : -1,\n\t\t\t\t\t\t'aria-hidden' : true\n\t\t\t\t\t})\n\t\t\t\t\t.on('change', ev => {\n\t\t\t\t\t\tjQuery(document).one(':dialogclosed', () => Save.import(ev));\n\t\t\t\t\t\tDialog.close();\n\t\t\t\t\t})\n\t\t\t\t\t.appendTo($dialogBody);\n\t\t\t}\n\n\t\t\tif (savesOk) {\n\t\t\t\t$btnBar.append(createActionItem(\n\t\t\t\t\t'clear',\n\t\t\t\t\tnull,\n\t\t\t\t\tL10n.get('savesLabelClear'),\n\t\t\t\t\tSave.autosave.has() || !Save.slots.isEmpty()\n\t\t\t\t\t\t? () => {\n\t\t\t\t\t\t\tSave.clear();\n\t\t\t\t\t\t\tuiBuildSaves();\n\t\t\t\t\t\t}\n\t\t\t\t\t\t: null\n\t\t\t\t));\n\t\t\t}\n\n\t\t\tconst $idbBar = jQuery(document.createElement('ul'))\n\t\t\t\t.addClass('buttons')\n\t\t\t\t.appendTo($dialogBody);\n\n\t\t\t$idbBar.append(createActionItem(\n\t\t\t\t'idbToggleSaves',\n\t\t\t\tnull,\n\t\t\t\t'Enable indexedDB',\n\t\t\t\t!idb.lock\n\t\t\t\t\t? () => {\n\t\t\t\t\t\tidb.updateSettings('active', true);\n\t\t\t\t\t\tidb.saveList();\n\t\t\t\t\t}\n\t\t\t\t\t: null\n\t\t\t));\n\n\t\t\treturn true;\n\t\t}\n\n\t\tuiOpenAlert(L10n.get('savesIncapable'));\n\t\treturn false;\n\t}\n\n\tfunction uiBuildSettings() {\n\t\tif (DEBUG) { console.log('[UI/uiBuildSettings()]'); }\n\n\t\tconst $dialogBody = jQuery(Dialog.setup(L10n.get('settingsTitle'), 'settings'));\n\n\t\tSetting.forEach(control => {\n\t\t\tif (control.type === Setting.Types.Header) {\n\t\t\t\tconst name     = control.name;\n\t\t\t\tconst id       = Util.slugify(name);\n\t\t\t\tconst $header  = jQuery(document.createElement('div'));\n\t\t\t\tconst $heading = jQuery(document.createElement('h2'));\n\n\t\t\t\t$header\n\t\t\t\t\t.attr('id', `header-body-${id}`)\n\t\t\t\t\t.append($heading)\n\t\t\t\t\t.appendTo($dialogBody);\n\t\t\t\t$heading\n\t\t\t\t\t.attr('id', `header-heading-${id}`)\n\t\t\t\t\t.wiki(name);\n\n\t\t\t\t// Set up the description, if any.\n\t\t\t\tif (control.desc) {\n\t\t\t\t\tjQuery(document.createElement('p'))\n\t\t\t\t\t\t.attr('id', `header-desc-${id}`)\n\t\t\t\t\t\t.wiki(control.desc)\n\t\t\t\t\t\t.appendTo($header);\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst name        = control.name;\n\t\t\tconst id          = Util.slugify(name);\n\t\t\tconst $setting    = jQuery(document.createElement('div'));\n\t\t\tconst $label      = jQuery(document.createElement('label'));\n\t\t\tconst $controlBox = jQuery(document.createElement('div'));\n\t\t\tlet $control;\n\n\t\t\t// Set up the label+control wrapper.\n\t\t\tjQuery(document.createElement('div'))\n\t\t\t\t.append($label)\n\t\t\t\t.append($controlBox)\n\t\t\t\t.appendTo($setting);\n\n\t\t\t// Set up the description, if any.\n\t\t\tif (control.desc) {\n\t\t\t\tjQuery(document.createElement('p'))\n\t\t\t\t\t.attr('id', `setting-desc-${id}`)\n\t\t\t\t\t.wiki(control.desc)\n\t\t\t\t\t.appendTo($setting);\n\t\t\t}\n\n\t\t\t// Set up the label.\n\t\t\t$label\n\t\t\t\t.attr({\n\t\t\t\t\tid  : `setting-label-${id}`,\n\t\t\t\t\tfor : `setting-control-${id}` // must be in sync with $control's ID (see below)\n\t\t\t\t})\n\t\t\t\t.wiki(control.label);\n\n\t\t\t// Set up the control.\n\t\t\tif (settings[name] == null) { // lazy equality for null\n\t\t\t\tsettings[name] = control.default;\n\t\t\t}\n\n\t\t\tswitch (control.type) {\n\t\t\tcase Setting.Types.Toggle:\n\t\t\t\t$control = jQuery(document.createElement('button'));\n\n\t\t\t\tif (settings[name]) {\n\t\t\t\t\t$control\n\t\t\t\t\t\t.addClass('enabled')\n\t\t\t\t\t\t.text(L10n.get('settingsOn'));\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$control\n\t\t\t\t\t\t.text(L10n.get('settingsOff'));\n\t\t\t\t}\n\n\t\t\t\t$control.ariaClick(function () {\n\t\t\t\t\tif (settings[name]) {\n\t\t\t\t\t\tjQuery(this)\n\t\t\t\t\t\t\t.removeClass('enabled')\n\t\t\t\t\t\t\t.text(L10n.get('settingsOff'));\n\t\t\t\t\t\tsettings[name] = false;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tjQuery(this)\n\t\t\t\t\t\t\t.addClass('enabled')\n\t\t\t\t\t\t\t.text(L10n.get('settingsOn'));\n\t\t\t\t\t\tsettings[name] = true;\n\t\t\t\t\t}\n\n\t\t\t\t\tSetting.save();\n\n\t\t\t\t\tif (control.hasOwnProperty('onChange')) {\n\t\t\t\t\t\tcontrol.onChange.call({\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tvalue   : settings[name],\n\t\t\t\t\t\t\tdefault : control.default\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tbreak;\n\n\t\t\tcase Setting.Types.List:\n\t\t\t\t$control = jQuery(document.createElement('select'));\n\n\t\t\t\tfor (let i = 0, iend = control.list.length; i < iend; ++i) {\n\t\t\t\t\tjQuery(document.createElement('option'))\n\t\t\t\t\t\t.val(i)\n\t\t\t\t\t\t.text(control.list[i])\n\t\t\t\t\t\t.appendTo($control);\n\t\t\t\t}\n\n\t\t\t\t$control\n\t\t\t\t\t.val(control.list.indexOf(settings[name]))\n\t\t\t\t\t.attr('tabindex', 0)\n\t\t\t\t\t.on('change', function () {\n\t\t\t\t\t\tsettings[name] = control.list[Number(this.value)];\n\t\t\t\t\t\tSetting.save();\n\n\t\t\t\t\t\tif (control.hasOwnProperty('onChange')) {\n\t\t\t\t\t\t\tcontrol.onChange.call({\n\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\tvalue   : settings[name],\n\t\t\t\t\t\t\t\tdefault : control.default,\n\t\t\t\t\t\t\t\tlist    : control.list\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\tbreak;\n\n\t\t\tcase Setting.Types.Range:\n\t\t\t\t$control = jQuery(document.createElement('input'));\n\n\t\t\t\t// NOTE: Setting the value with `<jQuery>.val()` can cause odd behavior\n\t\t\t\t// in Edge if it's called before the type is set, so we use the `value`\n\t\t\t\t// content attribute here to dodge the entire issue.\n\t\t\t\t$control\n\t\t\t\t\t.attr({\n\t\t\t\t\t\ttype     : 'range',\n\t\t\t\t\t\tmin      : control.min,\n\t\t\t\t\t\tmax      : control.max,\n\t\t\t\t\t\tstep     : control.step,\n\t\t\t\t\t\tvalue    : settings[name],\n\t\t\t\t\t\ttabindex : 0\n\t\t\t\t\t})\n\t\t\t\t\t.on('change input', function () {\n\t\t\t\t\t\tsettings[name] = Number(this.value);\n\t\t\t\t\t\tSetting.save();\n\n\t\t\t\t\t\tif (control.hasOwnProperty('onChange')) {\n\t\t\t\t\t\t\tcontrol.onChange.call({\n\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\tvalue   : settings[name],\n\t\t\t\t\t\t\t\tdefault : control.default,\n\t\t\t\t\t\t\t\tmin     : control.min,\n\t\t\t\t\t\t\t\tmax     : control.max,\n\t\t\t\t\t\t\t\tstep    : control.step\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t\t.on('keypress', ev => {\n\t\t\t\t\t\tif (ev.which === 13) {\n\t\t\t\t\t\t\tev.preventDefault();\n\t\t\t\t\t\t\t$control.trigger('change');\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t$control\n\t\t\t\t.attr('id', `setting-control-${id}`)\n\t\t\t\t.appendTo($controlBox);\n\n\t\t\t$setting\n\t\t\t\t.attr('id', `setting-body-${id}`)\n\t\t\t\t.appendTo($dialogBody);\n\t\t});\n\n\t\t// Add the button bar.\n\t\t$dialogBody\n\t\t\t.append(\n\t\t\t\t  '<ul class=\"buttons\">'\n\t\t\t\t+     `<li><button id=\"settings-ok\" class=\"ui-close\">${L10n.get(['settingsOk', 'ok'])}</button></li>`\n\t\t\t\t+     `<li><button id=\"settings-reset\">${L10n.get('settingsReset')}</button></li>`\n\t\t\t\t+ '</ul>'\n\t\t\t)\n\t\t\t.find('#settings-reset')\n\t\t\t/*\n\t\t\t\tInstead of adding '.ui-close' to '#settings-reset' (to receive the use of the default\n\t\t\t\tdelegated dialog close handler), we set up a special case close handler here.  We\n\t\t\t\tdo this to ensure that the invocation of `window.location.reload()` happens after the\n\t\t\t\tdialog has fully closed.  If we did not, then a race condition could occur, causing\n\t\t\t\tdisplay shenanigans.\n\t\t\t*/\n\t\t\t.ariaClick({ one : true }, () => {\n\t\t\t\tjQuery(document).one(':dialogclosed', () => {\n\t\t\t\t\tSetting.reset();\n\t\t\t\t\twindow.location.reload();\n\t\t\t\t});\n\t\t\t\tDialog.close();\n\t\t\t});\n\n\t\treturn true;\n\t}\n\n\tfunction uiBuildShare() {\n\t\tif (DEBUG) { console.log('[UI/uiBuildShare()]'); }\n\n\t\ttry {\n\t\t\tjQuery(Dialog.setup(L10n.get('shareTitle'), 'share list'))\n\t\t\t\t.append(uiAssembleLinkList('StoryShare'));\n\t\t}\n\t\tcatch (ex) {\n\t\t\tconsole.error(ex);\n\t\t\tAlert.error('StoryShare', ex.message);\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************************************************/\n\treturn Object.freeze(Object.defineProperties({}, {\n\t\t/*\n\t\t\tUI Functions, Core.\n\t\t*/\n\t\tassembleLinkList : { value : uiAssembleLinkList },\n\n\t\t/*\n\t\t\tUI Functions, Built-ins.\n\t\t*/\n\t\talert         : { value : uiOpenAlert },\n\t\tjumpto        : { value : uiOpenJumpto },\n\t\trestart       : { value : uiOpenRestart },\n\t\tsaves         : { value : uiOpenSaves },\n\t\tsettings      : { value : uiOpenSettings },\n\t\tshare         : { value : uiOpenShare },\n\t\tbuildAutoload : { value : uiBuildAutoload },\n\t\tbuildJumpto   : { value : uiBuildJumpto },\n\t\tbuildRestart  : { value : uiBuildRestart },\n\t\tbuildSaves    : { value : uiBuildSaves },\n\t\tbuildSettings : { value : uiBuildSettings },\n\t\tbuildShare    : { value : uiBuildShare },\n\n\t\t/*\n\t\t\tLegacy Aliases.\n\t\t*/\n\t\t// `UIBar` methods.\n\t\t/* global UIBar */\n\t\tstow                     : { value : () => UIBar.stow() },\n\t\tunstow                   : { value : () => UIBar.unstow() },\n\t\tsetStoryElements         : { value : () => UIBar.update() },\n\t\t// `Dialog` methods.\n\t\tisOpen                   : { value : (...args) => Dialog.isOpen(...args) },\n\t\tbody                     : { value : () => Dialog.body() },\n\t\tsetup                    : { value : (...args) => Dialog.setup(...args) },\n\t\taddClickHandler          : { value : (...args) => Dialog.addClickHandler(...args) },\n\t\topen                     : { value : (...args) => Dialog.open(...args) },\n\t\tclose                    : { value : (...args) => Dialog.close(...args) },\n\t\tresize                   : { value : () => Dialog.resize() },\n\t\t// Deprecated method names.\n\t\tbuildDialogAutoload      : { value : uiBuildAutoload },\n\t\tbuildDialogJumpto        : { value : uiBuildJumpto },\n\t\tbuildDialogRestart       : { value : uiBuildRestart },\n\t\tbuildDialogSaves         : { value : uiBuildSaves },\n\t\tbuildDialogSettings      : { value : uiBuildSettings },\n\t\tbuildDialogShare         : { value : uiBuildShare },\n\t\tbuildLinkListFromPassage : { value : uiAssembleLinkList }\n\t}));\n})();\n\n/***********************************************************************************************************************\n\n\tuibar.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/*\n\tglobal Alert, Dialog, Engine, L10n, Setting, State, Story, UI, Config, setDisplayTitle, setPageElement\n*/\n\nvar UIBar = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\t// UI bar element cache.\n\tlet _$uiBar = null;\n\n\n\t/*******************************************************************************\n\t\tUI Bar Functions.\n\t*******************************************************************************/\n\n\tfunction uiBarDestroy() {\n\t\tif (DEBUG) { console.log('[UIBar/uiBarDestroy()]'); }\n\n\t\tif (!_$uiBar) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Hide the UI bar.\n\t\t_$uiBar.hide();\n\n\t\t// Remove its namespaced events.\n\t\tjQuery(document).off('.ui-bar');\n\n\t\t// Remove its styles.\n\t\tjQuery(document.head).find('#style-ui-bar').remove();\n\n\t\t// Remove it from the DOM.\n\t\t_$uiBar.remove();\n\n\t\t// Drop the reference to the element.\n\t\t_$uiBar = null;\n\t}\n\n\tfunction uiBarHide() {\n\t\tif (_$uiBar) {\n\t\t\t_$uiBar.hide();\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tfunction uiBarInit() {\n\t\tif (DEBUG) { console.log('[UIBar/uiBarInit()]'); }\n\n\t\tif (document.getElementById('ui-bar')) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Generate the UI bar elements.\n\t\tconst $elems = (() => {\n\t\t\tconst toggleLabel   = L10n.get('uiBarToggle');\n\t\t\tconst backwardLabel = L10n.get('uiBarBackward');\n\t\t\tconst jumptoLabel   = L10n.get('uiBarJumpto');\n\t\t\tconst forwardLabel  = L10n.get('uiBarForward');\n\n\t\t\treturn jQuery(document.createDocumentFragment())\n\t\t\t\t.append(\n\t\t\t\t\t/* eslint-disable max-len */\n\t\t\t\t\t  '<div id=\"ui-bar\" aria-live=\"polite\">'\n\t\t\t\t\t+     '<div id=\"ui-bar-tray\">'\n\t\t\t\t\t+         `<button id=\"ui-bar-toggle\" tabindex=\"0\" title=\"${toggleLabel}\" aria-label=\"${toggleLabel}\"></button>`\n\t\t\t\t\t+         '<div id=\"ui-bar-history\">'\n\t\t\t\t\t+             `<button id=\"history-backward\" tabindex=\"0\" title=\"${backwardLabel}\" aria-label=\"${backwardLabel}\">\\uE821</button>`\n\t\t\t\t\t+             `<button id=\"history-jumpto\" tabindex=\"0\" title=\"${jumptoLabel}\" aria-label=\"${jumptoLabel}\">\\uE839</button>`\n\t\t\t\t\t+             `<button id=\"history-forward\" tabindex=\"0\" title=\"${forwardLabel}\" aria-label=\"${forwardLabel}\">\\uE822</button>`\n\t\t\t\t\t+         '</div>'\n\t\t\t\t\t+     '</div>'\n\t\t\t\t\t+     '<div id=\"ui-bar-body\">'\n\t\t\t\t\t+         '<header id=\"title\" role=\"banner\">'\n\t\t\t\t\t+             '<div id=\"story-banner\"></div>'\n\t\t\t\t\t+             '<h1 id=\"story-title\"></h1>'\n\t\t\t\t\t+             '<div id=\"story-subtitle\"></div>'\n\t\t\t\t\t+             '<div id=\"story-title-separator\"></div>'\n\t\t\t\t\t+             '<p id=\"story-author\"></p>'\n\t\t\t\t\t+         '</header>'\n\t\t\t\t\t+         '<div id=\"story-caption\"></div>'\n\t\t\t\t\t+         '<nav id=\"menu\" role=\"navigation\">'\n\t\t\t\t\t+             '<ul id=\"menu-story\"></ul>'\n\t\t\t\t\t+             '<ul id=\"menu-core\">'\n\t\t\t\t\t+                 `<li id=\"menu-item-saves\"><a tabindex=\"0\">${L10n.get('savesTitle')}</a></li>`\n\t\t\t\t\t+                 `<li id=\"menu-item-settings\"><a tabindex=\"0\">${L10n.get('settingsTitle')}</a></li>`\n\t\t\t\t\t+                 `<li id=\"menu-item-restart\"><a tabindex=\"0\">${L10n.get('restartTitle')}</a></li>`\n\t\t\t\t\t+                 `<li id=\"menu-item-share\"><a tabindex=\"0\">${L10n.get('shareTitle')}</a></li>`\n\t\t\t\t\t+             '</ul>'\n\t\t\t\t\t+         '</nav>'\n\t\t\t\t\t+     '</div>'\n\t\t\t\t\t+ '</div>'\n\t\t\t\t\t/* eslint-enable max-len */\n\t\t\t\t);\n\t\t})();\n\n\t\t/*\n\t\t\tCache the UI bar element, since its going to be used often.\n\n\t\t\tNOTE: We rewrap the element itself, rather than simply using the result\n\t\t\tof `find()`, so that we cache an uncluttered jQuery-wrapper (i.e. `context`\n\t\t\trefers to the element and there is no `prevObject`).\n\t\t*/\n\t\t_$uiBar = jQuery($elems.find('#ui-bar').get(0));\n\n\t\t// Insert the UI bar elements into the page before the main script.\n\t\t$elems.insertBefore('body>script#script-sugarcube');\n\n\t\t// Set up the UI bar's global event handlers.\n\t\tjQuery(document)\n\t\t\t// Set up a handler for the history-backward/-forward buttons.\n\t\t\t.on(':historyupdate.ui-bar', (($backward, $forward) => () => {\n\t\t\t\t$backward.ariaDisabled(State.length < 2);\n\t\t\t\t$forward.ariaDisabled(State.length === State.size);\n\t\t\t})(jQuery('#history-backward'), jQuery('#history-forward')));\n\t}\n\n\tfunction uiBarIsHidden() {\n\t\treturn _$uiBar && _$uiBar.css('display') === 'none';\n\t}\n\n\tfunction uiBarIsStowed() {\n\t\treturn _$uiBar && _$uiBar.hasClass('stowed');\n\t}\n\n\tfunction uiBarShow() {\n\t\tif (_$uiBar) {\n\t\t\t_$uiBar.show();\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tfunction uiBarStart() {\n\t\tif (DEBUG) { console.log('[UIBar/uiBarStart()]'); }\n\n\t\tif (!_$uiBar) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Set up the #ui-bar's initial state.\n\t\tif (\n\t\t\ttypeof Config.ui.stowBarInitially === 'boolean'\n\t\t\t\t? Config.ui.stowBarInitially\n\t\t\t\t: jQuery(window).width() <= Config.ui.stowBarInitially\n\t\t) {\n\t\t\tuiBarStow(true);\n\t\t}\n\n\t\t// Set up the #ui-bar-toggle and #ui-bar-history widgets.\n\t\tjQuery('#ui-bar-toggle')\n\t\t\t.ariaClick({\n\t\t\t\tlabel : L10n.get('uiBarToggle')\n\t\t\t}, () => _$uiBar.toggleClass('stowed'));\n\n\t\tjQuery('#history-backward')\n\t\t\t.ariaDisabled(State.length < 2)\n\t\t\t.ariaClick({\n\t\t\t\tlabel : L10n.get('uiBarBackward')\n\t\t\t}, () => Engine.backward());\n\n\t\tif (Story.lookup('tags', 'bookmark').length > 0) {\n\t\t\tjQuery('#history-jumpto')\n\t\t\t\t.ariaClick({\n\t\t\t\t\tlabel : L10n.get('uiBarJumpto')\n\t\t\t\t}, () => UI.jumpto());\n\t\t}\n\t\telse {\n\t\t\tjQuery('#history-jumpto').remove();\n\t\t}\n\n\t\tjQuery('#history-forward')\n\t\t\t.ariaDisabled(State.length === State.size)\n\t\t\t.ariaClick({\n\t\t\t\tlabel : L10n.get('uiBarForward')\n\t\t\t}, () => Engine.forward());\n\n\t\tif (!Config.history.controls) jQuery('#ui-bar-history').hide();\n\n\t\t// Set up the story display title.\n\t\tif (Story.has('StoryDisplayTitle')) {\n\t\t\tsetDisplayTitle(Story.get('StoryDisplayTitle').processText());\n\t\t}\n\t\telse {\n\t\t\tif (TWINE1) { // for Twine 1\n\t\t\t\tsetPageElement('story-title', 'StoryTitle', Story.title);\n\t\t\t}\n\t\t\telse { // for Twine 2\n\t\t\t\tjQuery('#story-title').text(Story.title);\n\t\t\t}\n\t\t}\n\n\t\t// Set up the dynamic page elements.\n\t\tif (!Story.has('StoryCaption')) {\n\t\t\tjQuery('#story-caption').remove();\n\t\t}\n\n\t\tif (!Story.has('StoryMenu')) {\n\t\t\tjQuery('#menu-story').remove();\n\t\t}\n\n\t\tif (!Config.ui.updateStoryElements) {\n\t\t\t// We only need to set the story elements here if `Config.ui.updateStoryElements`\n\t\t\t// is falsy, since otherwise they will be set by `Engine.play()`.\n\t\t\tuiBarUpdate();\n\t\t}\n\n\t\t// Set up the Saves menu item.\n\t\tjQuery('#menu-item-saves a')\n\t\t\t.ariaClick({\n\t\t\t\trole : 'button'\n\t\t\t}, ev => {\n\t\t\t\tev.preventDefault();\n\t\t\t\t// use idb when available\n\t\t\t\tif (idb.active) {\n\t\t\t\t\tDialog.setup('saves', 'saves');\n\t\t\t\t\tidb.saveList();\n\t\t\t\t}\n\t\t\t\t// but keep the old system just in case\n\t\t\t\telse UI.buildSaves();\n\t\t\t\tDialog.open();\n\t\t\t})\n\t\t\t.text(L10n.get('savesTitle'));\n\n\t\t// Set up the Settings menu item.\n\t\tif (!Setting.isEmpty()) {\n\t\t\tjQuery('#menu-item-settings a')\n\t\t\t\t.ariaClick({\n\t\t\t\t\trole : 'button'\n\t\t\t\t}, ev => {\n\t\t\t\t\tev.preventDefault();\n\t\t\t\t\tUI.buildSettings();\n\t\t\t\t\tDialog.open();\n\t\t\t\t})\n\t\t\t\t.text(L10n.get('settingsTitle'));\n\t\t}\n\t\telse {\n\t\t\tjQuery('#menu-item-settings').remove();\n\t\t}\n\n\t\t// Set up the Restart menu item.\n\t\tjQuery('#menu-item-restart a')\n\t\t\t.ariaClick({\n\t\t\t\trole : 'button'\n\t\t\t}, ev => {\n\t\t\t\tev.preventDefault();\n\t\t\t\tUI.buildRestart();\n\t\t\t\tDialog.open();\n\t\t\t})\n\t\t\t.text(L10n.get('restartTitle'));\n\n\t\t// Set up the Share menu item.\n\t\tif (Story.has('StoryShare')) {\n\t\t\tjQuery('#menu-item-share a')\n\t\t\t\t.ariaClick({\n\t\t\t\t\trole : 'button'\n\t\t\t\t}, ev => {\n\t\t\t\t\tev.preventDefault();\n\t\t\t\t\tUI.buildShare();\n\t\t\t\t\tDialog.open();\n\t\t\t\t})\n\t\t\t\t.text(L10n.get('shareTitle'));\n\t\t}\n\t\telse {\n\t\t\tjQuery('#menu-item-share').remove();\n\t\t}\n\t}\n\n\tfunction uiBarStow(noAnimation) {\n\t\tif (_$uiBar && !_$uiBar.hasClass('stowed')) {\n\t\t\tlet $story;\n\n\t\t\tif (noAnimation) {\n\t\t\t\t$story = jQuery('#story');\n\t\t\t\t$story.addClass('no-transition');\n\t\t\t\t_$uiBar.addClass('no-transition');\n\t\t\t}\n\n\t\t\t_$uiBar.addClass('stowed');\n\n\t\t\tif (noAnimation) {\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t$story.removeClass('no-transition');\n\t\t\t\t\t_$uiBar.removeClass('no-transition');\n\t\t\t\t}, Engine.minDomActionDelay);\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tfunction uiBarUnstow(noAnimation) {\n\t\tif (_$uiBar && _$uiBar.hasClass('stowed')) {\n\t\t\tlet $story;\n\n\t\t\tif (noAnimation) {\n\t\t\t\t$story = jQuery('#story');\n\t\t\t\t$story.addClass('no-transition');\n\t\t\t\t_$uiBar.addClass('no-transition');\n\t\t\t}\n\n\t\t\t_$uiBar.removeClass('stowed');\n\n\t\t\tif (noAnimation) {\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t$story.removeClass('no-transition');\n\t\t\t\t\t_$uiBar.removeClass('no-transition');\n\t\t\t\t}, Engine.minDomActionDelay);\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tfunction uiBarUpdate() {\n\t\tif (DEBUG) { console.log('[UIBar/uiBarUpdate()]'); }\n\n\t\t// Set up the display title, both the document title and page element.\n\t\tif (Story.has('StoryDisplayTitle')) {\n\t\t\tsetDisplayTitle(Story.get('StoryDisplayTitle').processText());\n\t\t}\n\n\t\tif (!_$uiBar) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Set up the (non-navigation) dynamic page elements.\n\t\tsetPageElement('story-banner', 'StoryBanner');\n\t\tsetPageElement('story-subtitle', 'StorySubtitle');\n\t\tsetPageElement('story-author', 'StoryAuthor');\n\t\tsetPageElement('story-caption', 'StoryCaption');\n\n\t\t// Set up the #menu-story items.\n\t\tconst menuStory = document.getElementById('menu-story');\n\n\t\tif (menuStory !== null) {\n\t\t\tjQuery(menuStory).empty();\n\n\t\t\tif (Story.has('StoryMenu')) {\n\t\t\t\ttry {\n\t\t\t\t\tUI.assembleLinkList('StoryMenu', menuStory);\n\t\t\t\t}\n\t\t\t\tcatch (ex) {\n\t\t\t\t\tconsole.error(ex);\n\t\t\t\t\tAlert.error('StoryMenu', ex.message);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\n\t/*******************************************************************************\n\t\tObject Exports.\n\t*******************************************************************************/\n\n\treturn Object.freeze(Object.defineProperties({}, {\n\t\tdestroy  : { value : uiBarDestroy },\n\t\thide     : { value : uiBarHide },\n\t\tinit     : { value : uiBarInit },\n\t\tisHidden : { value : uiBarIsHidden },\n\t\tisStowed : { value : uiBarIsStowed },\n\t\tshow     : { value : uiBarShow },\n\t\tstart    : { value : uiBarStart },\n\t\tstow     : { value : uiBarStow },\n\t\tunstow   : { value : uiBarUnstow },\n\t\tupdate   : { value : uiBarUpdate },\n\n\t\t// Legacy Functions.\n\t\tsetStoryElements : { value : uiBarUpdate }\n\t}));\n})();\n\n/***********************************************************************************************************************\n\n\tdebugbar.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/*\n\tglobal DebugView, Engine, L10n, Patterns, State, Util, session\n*/\n\nvar DebugBar = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\tconst _variableRe   = new RegExp(`^${Patterns.variable}$`);\n\tconst _numericKeyRe = /^\\d+$/;\n\tconst _watchList    = [];\n\tlet _$debugBar   = null;\n\tlet _$watchBody  = null;\n\tlet _$watchList  = null;\n\tlet _$turnSelect = null;\n\tlet _stowed      = true;\n\n\n\t/*******************************************************************************************************************\n\t\tDebug Bar Functions.\n\t*******************************************************************************************************************/\n\tfunction debugBarInit() {\n\t\tif (DEBUG) { console.log('[DebugBar/debugBarInit()]'); }\n\n\t\t/*\n\t\t\tGenerate the debug bar elements and append them to the `<body>`.\n\t\t*/\n\t\tconst barToggleLabel   = L10n.get('debugBarToggle');\n\t\tconst watchAddLabel    = L10n.get('debugBarAddWatch');\n\t\tconst watchAllLabel    = L10n.get('debugBarWatchAll');\n\t\tconst watchNoneLabel   = L10n.get('debugBarWatchNone');\n\t\tconst watchToggleLabel = L10n.get('debugBarWatchToggle');\n\t\tconst viewsToggleLabel = L10n.get('debugBarViewsToggle');\n\n\t\tjQuery(document.createDocumentFragment())\n\t\t\t.append(\n\t\t\t\t/* eslint-disable max-len */\n\t\t\t\t  '<div id=\"debug-bar\">'\n\t\t\t\t+     '<div id=\"debug-bar-watch\">'\n\t\t\t\t+         `<div>${L10n.get('debugBarNoWatches')}</div>>`\n\t\t\t\t+     '</div>'\n\t\t\t\t+     '<div>'\n\t\t\t\t+         `<button id=\"debug-bar-watch-toggle\" tabindex=\"0\" title=\"${watchToggleLabel}\" aria-label=\"${watchToggleLabel}\">${L10n.get('debugBarLabelWatch')}</button>`\n\t\t\t\t+         `<label id=\"debug-bar-watch-label\" for=\"debug-bar-watch-input\">${L10n.get('debugBarLabelAdd')}</label>`\n\t\t\t\t+         '<input id=\"debug-bar-watch-input\" name=\"debug-bar-watch-input\" type=\"text\" list=\"debug-bar-watch-list\" tabindex=\"0\">'\n\t\t\t\t+         '<datalist id=\"debug-bar-watch-list\" aria-hidden=\"true\" hidden=\"hidden\"></datalist>'\n\t\t\t\t+         `<button id=\"debug-bar-watch-add\" tabindex=\"0\" title=\"${watchAddLabel}\" aria-label=\"${watchAddLabel}\"></button>`\n\t\t\t\t+         `<button id=\"debug-bar-watch-all\" tabindex=\"0\" title=\"${watchAllLabel}\" aria-label=\"${watchAllLabel}\"></button>`\n\t\t\t\t+         `<button id=\"debug-bar-watch-none\" tabindex=\"0\" title=\"${watchNoneLabel}\" aria-label=\"${watchNoneLabel}\"></button>`\n\t\t\t\t+     '</div>'\n\t\t\t\t+     '<div>'\n\t\t\t\t+         `<button id=\"debug-bar-views-toggle\" tabindex=\"0\" title=\"${viewsToggleLabel}\" aria-label=\"${viewsToggleLabel}\">${L10n.get('debugBarLabelViews')}</button>`\n\t\t\t\t+         `<label id=\"debug-bar-turn-label\" for=\"debug-bar-turn-select\">${L10n.get('debugBarLabelTurn')}</label>`\n\t\t\t\t+         '<select id=\"debug-bar-turn-select\" tabindex=\"0\"></select>'\n\t\t\t\t+     '</div>'\n\t\t\t\t+     `<button id=\"debug-bar-toggle\" tabindex=\"0\" title=\"${barToggleLabel}\" aria-label=\"${barToggleLabel}\"></button>`\n\t\t\t\t+ '</div>'\n\t\t\t\t+ '<div id=\"debug-bar-hint\"></div>'\n\t\t\t\t/* eslint-enable max-len */\n\t\t\t)\n\t\t\t.appendTo('body');\n\n\t\t/*\n\t\t\tCache various oft used elements.\n\n\t\t\tNOTE: We rewrap the elements themselves, rather than simply using\n\t\t\tthe results of `find()`, so that we cache uncluttered jQuery-wrappers\n\t\t\t(i.e. `context` refers to the elements and there is no `prevObject`).\n\t\t*/\n\t\t_$debugBar   = jQuery('#debug-bar');\n\t\t_$watchBody  = jQuery(_$debugBar.find('#debug-bar-watch').get(0));\n\t\t_$watchList  = jQuery(_$debugBar.find('#debug-bar-watch-list').get(0));\n\t\t_$turnSelect = jQuery(_$debugBar.find('#debug-bar-turn-select').get(0));\n\n\t\tconst $barToggle   = jQuery(_$debugBar.find('#debug-bar-toggle').get(0));\n\t\tconst $watchToggle = jQuery(_$debugBar.find('#debug-bar-watch-toggle').get(0));\n\t\tconst $watchInput  = jQuery(_$debugBar.find('#debug-bar-watch-input').get(0));\n\t\tconst $watchAdd    = jQuery(_$debugBar.find('#debug-bar-watch-add').get(0));\n\t\tconst $watchAll    = jQuery(_$debugBar.find('#debug-bar-watch-all').get(0));\n\t\tconst $watchNone   = jQuery(_$debugBar.find('#debug-bar-watch-none').get(0));\n\t\tconst $viewsToggle = jQuery(_$debugBar.find('#debug-bar-views-toggle').get(0));\n\n\t\t/*\n\t\t\tSet up the debug bar's local event handlers.\n\t\t*/\n\t\t$barToggle\n\t\t\t.ariaClick(debugBarToggle);\n\t\t$watchToggle\n\t\t\t.ariaClick(debugBarWatchToggle);\n\t\t$watchInput\n\t\t\t.on(':addwatch', function () {\n\t\t\t\tdebugBarWatchAdd(this.value.trim());\n\t\t\t\tthis.value = '';\n\t\t\t})\n\t\t\t.on('keypress', ev => {\n\t\t\t\tif (ev.which === 13) { // 13 is Return/Enter\n\t\t\t\t\tev.preventDefault();\n\t\t\t\t\t$watchInput.trigger(':addwatch');\n\t\t\t\t}\n\t\t\t});\n\t\t$watchAdd\n\t\t\t.ariaClick(() => $watchInput.trigger(':addwatch'));\n\t\t$watchAll\n\t\t\t.ariaClick(debugBarWatchAddAll);\n\t\t$watchNone\n\t\t\t.ariaClick(debugBarWatchClear);\n\t\t_$turnSelect\n\t\t\t.on('change', function () {\n\t\t\t\tEngine.goTo(Number(this.value));\n\t\t\t});\n\t\t$viewsToggle\n\t\t\t.ariaClick(() => {\n\t\t\t\tDebugView.toggle();\n\t\t\t\t_updateSession();\n\t\t\t});\n\n\t\t/*\n\t\t\tSet up the debug bar's global event handlers.\n\t\t*/\n\t\tjQuery(document)\n\t\t\t// Set up a handler for the history select.\n\t\t\t.on(':historyupdate.debug-bar', _updateTurnSelect)\n\t\t\t// Set up a handler for the variables watch.\n\t\t\t.on(':passageend.debug-bar', () => {\n\t\t\t\t_updateWatchBody();\n\t\t\t\t_updateWatchList();\n\t\t\t})\n\t\t\t// Set up a handler for engine resets to clear the active debug session.\n\t\t\t.on(':enginerestart.debug-bar', _clearSession);\n\n\t\t/*\n\t\t\tInitially enable debug views if there's no active debug session.\n\t\t*/\n\t\tif (!_hasSession()) {\n\t\t\tDebugView.enable();\n\t\t}\n\t}\n\n\tfunction debugBarStart() {\n\t\tif (DEBUG) { console.log('[DebugBar/debugBarStart()]'); }\n\n\t\t// Attempt to restore an existing session.\n\t\t_restoreSession();\n\n\t\t// Update the UI.\n\t\t_updateBar();\n\t\t_updateTurnSelect();\n\t\t_updateWatchBody();\n\t\t_updateWatchList();\n\t}\n\n\tfunction debugBarIsStowed() {\n\t\treturn _stowed;\n\t}\n\n\tfunction debugBarStow() {\n\t\t_debugBarStowNoUpdate();\n\t\t_stowed = true;\n\t\t_updateSession();\n\t}\n\n\tfunction debugBarUnstow() {\n\t\t_debugBarUnstowNoUpdate();\n\t\t_stowed = false;\n\t\t_updateSession();\n\t}\n\n\tfunction debugBarToggle() {\n\t\tif (_stowed) {\n\t\t\tdebugBarUnstow();\n\t\t}\n\t\telse {\n\t\t\tdebugBarStow();\n\t\t}\n\t}\n\n\tfunction debugBarWatchAdd(varName) {\n\t\tif (!_variableRe.test(varName)) {\n\t\t\treturn;\n\t\t}\n\n\t\t_watchList.pushUnique(varName);\n\t\t_watchList.sort();\n\t\t_updateWatchBody();\n\t\t_updateWatchList();\n\t\t_updateSession();\n\t}\n\n\tfunction debugBarWatchAddAll() {\n\t\tObject.keys(State.variables).map(name => _watchList.pushUnique(`$${name}`));\n\t\tObject.keys(State.temporary).map(name => _watchList.pushUnique(`_${name}`));\n\n\t\t_watchList.sort();\n\t\t_updateWatchBody();\n\t\t_updateWatchList();\n\t\t_updateSession();\n\t}\n\n\tfunction debugBarWatchClear() {\n\t\tfor (let i = _watchList.length - 1; i >= 0; --i) {\n\t\t\t_watchList.pop();\n\t\t}\n\n\t\t_updateWatchBody();\n\t\t_updateWatchList();\n\t\t_updateSession();\n\t}\n\n\tfunction debugBarWatchDelete(varName) {\n\t\t_watchList.delete(varName);\n\t\t_updateWatchBody();\n\t\t_updateWatchList();\n\t\t_updateSession();\n\t}\n\n\tfunction debugBarWatchDisable() {\n\t\t_debugBarWatchDisableNoUpdate();\n\t\t_updateSession();\n\t}\n\n\tfunction debugBarWatchEnable() {\n\t\t_debugBarWatchEnableNoUpdate();\n\t\t_updateSession();\n\t}\n\n\tfunction debugBarWatchIsEnabled() {\n\t\treturn !_$watchBody.attr('hidden');\n\t}\n\n\tfunction debugBarWatchToggle() {\n\t\tif (_$watchBody.attr('hidden')) {\n\t\t\tdebugBarWatchEnable();\n\t\t}\n\t\telse {\n\t\t\tdebugBarWatchDisable();\n\t\t}\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tUtility Functions.\n\t*******************************************************************************************************************/\n\tfunction _debugBarStowNoUpdate() {\n\t\t_$debugBar.css('right', `-${_$debugBar.outerWidth()}px`);\n\t}\n\n\tfunction _debugBarUnstowNoUpdate() {\n\t\t_$debugBar.css('right', 0);\n\t}\n\n\tfunction _debugBarWatchDisableNoUpdate() {\n\t\t_$watchBody.attr({\n\t\t\t'aria-hidden' : true,\n\t\t\thidden        : 'hidden'\n\t\t});\n\t}\n\n\tfunction _debugBarWatchEnableNoUpdate() {\n\t\t_$watchBody.removeAttr('aria-hidden hidden');\n\t}\n\n\tfunction _clearSession() {\n\t\tsession.delete('debugState');\n\t}\n\n\tfunction _hasSession() {\n\t\treturn session.has('debugState');\n\t}\n\n\tfunction _restoreSession() {\n\t\tif (!_hasSession()) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst debugState = session.get('debugState');\n\n\t\t_stowed = debugState.stowed;\n\n\t\t_watchList.push(...debugState.watchList);\n\n\t\tif (debugState.watchEnabled) {\n\t\t\t_debugBarWatchEnableNoUpdate();\n\t\t}\n\t\telse {\n\t\t\t_debugBarWatchDisableNoUpdate();\n\t\t}\n\n\t\tif (debugState.viewsEnabled) {\n\t\t\tDebugView.enable();\n\t\t}\n\t\telse {\n\t\t\tDebugView.disable();\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tfunction _updateSession() {\n\t\tsession.set('debugState', {\n\t\t\tstowed       : _stowed,\n\t\t\twatchList    : _watchList,\n\t\t\twatchEnabled : debugBarWatchIsEnabled(),\n\t\t\tviewsEnabled : DebugView.isEnabled()\n\t\t});\n\t}\n\n\tfunction _updateBar() {\n\t\tif (_stowed) {\n\t\t\tdebugBarStow();\n\t\t}\n\t\telse {\n\t\t\tdebugBarUnstow();\n\t\t}\n\t}\n\n\tfunction _updateWatchBody() {\n\t\tif (_watchList.length === 0) {\n\t\t\t_$watchBody\n\t\t\t\t.empty()\n\t\t\t\t.append(`<div>${L10n.get('debugBarNoWatches')}</div>`);\n\t\t\treturn;\n\t\t}\n\n\t\tconst delLabel = L10n.get('debugBarDeleteWatch');\n\t\tconst $table   = jQuery(document.createElement('table'));\n\t\tconst $tbody   = jQuery(document.createElement('tbody'));\n\n\t\tfor (let i = 0, len = _watchList.length; i < len; ++i) {\n\t\t\tconst varName = _watchList[i];\n\t\t\tconst varKey  = varName.slice(1);\n\t\t\tconst store   = varName[0] === '$' ? State.variables : State.temporary;\n\t\t\tconst $row    = jQuery(document.createElement('tr'));\n\t\t\tconst $delBtn = jQuery(document.createElement('button'));\n\t\t\tconst $code   = jQuery(document.createElement('code'));\n\n\t\t\t$delBtn\n\t\t\t\t.addClass('watch-delete')\n\t\t\t\t.attr('data-name', varName)\n\t\t\t\t.ariaClick({\n\t\t\t\t\tone   : true,\n\t\t\t\t\tlabel : delLabel\n\t\t\t\t}, () => debugBarWatchDelete(varName));\n\t\t\t$code\n\t\t\t\t.text(_toWatchString(store[varKey]));\n\n\t\t\tjQuery(document.createElement('td'))\n\t\t\t\t.append($delBtn)\n\t\t\t\t.appendTo($row);\n\t\t\tjQuery(document.createElement('td'))\n\t\t\t\t.text(varName)\n\t\t\t\t.appendTo($row);\n\t\t\tjQuery(document.createElement('td'))\n\t\t\t\t.append($code)\n\t\t\t\t.appendTo($row);\n\t\t\t$row\n\t\t\t\t.appendTo($tbody);\n\t\t}\n\n\t\t$table\n\t\t\t.append($tbody);\n\t\t_$watchBody\n\t\t\t.empty()\n\t\t\t.append($table);\n\t}\n\n\tfunction _updateWatchList() {\n\t\tconst svn = Object.keys(State.variables);\n\t\tconst tvn = Object.keys(State.temporary);\n\n\t\tif (svn.length === 0 && tvn.length === 0) {\n\t\t\t_$watchList.empty();\n\t\t\treturn;\n\t\t}\n\n\t\tconst names   = [...svn.map(name => `$${name}`), ...tvn.map(name => `_${name}`)].sort();\n\t\tconst options = document.createDocumentFragment();\n\n\t\tnames.delete(_watchList);\n\n\t\tfor (let i = 0, len = names.length; i < len; ++i) {\n\t\t\tjQuery(document.createElement('option'))\n\t\t\t\t.val(names[i])\n\t\t\t\t.appendTo(options);\n\t\t}\n\n\t\t_$watchList\n\t\t\t.empty()\n\t\t\t.append(options);\n\t}\n\n\tfunction _updateTurnSelect() {\n\t\tconst histLen = State.size;\n\t\tconst expLen  = State.expired.length;\n\t\tconst options = document.createDocumentFragment();\n\n\t\tfor (let i = 0; i < histLen; ++i) {\n\t\t\tjQuery(document.createElement('option'))\n\t\t\t\t.val(i)\n\t\t\t\t.text(`${expLen + i + 1}. ${Util.escape(State.history[i].title)}`)\n\t\t\t\t.appendTo(options);\n\t\t}\n\n\t\t_$turnSelect\n\t\t\t.empty()\n\t\t\t.ariaDisabled(histLen < 2)\n\t\t\t.append(options)\n\t\t\t.val(State.activeIndex);\n\t}\n\n\tfunction _toWatchString(value) {\n\t\t/*\n\t\t\tHandle the `null` primitive.\n\t\t*/\n\t\tif (value === null) {\n\t\t\treturn 'null';\n\t\t}\n\n\t\t/*\n\t\t\tHandle the rest of the primitives and functions.\n\t\t*/\n\t\tswitch (typeof value) {\n\t\tcase 'number':\n\t\t\tif (Number.isNaN(value)) {\n\t\t\t\treturn 'NaN';\n\t\t\t}\n\t\t\telse if (!Number.isFinite(value)) {\n\t\t\t\treturn 'Infinity';\n\t\t\t}\n\t\t\t/* falls through */\n\t\tcase 'boolean':\n\t\tcase 'symbol':\n\t\tcase 'undefined':\n\t\t\treturn String(value);\n\n\t\tcase 'string':\n\t\t\treturn JSON.stringify(value);\n\n\t\tcase 'function':\n\t\t\treturn 'Function';\n\t\t}\n\n\t\tconst objType = Util.toStringTag(value);\n\n\t\t// /*\n\t\t// \tHandle instances of the primitive exemplar objects (`Boolean`, `Number`, `String`).\n\t\t// */\n\t\t// if (objType === 'Boolean') {\n\t\t// \treturn `Boolean\\u202F{${String(value)}}`;\n\t\t// }\n\t\t// if (objType === 'Number') {\n\t\t// \treturn `Number\\u202F{${String(value)}}`;\n\t\t// }\n\t\t// if (objType === 'String') {\n\t\t// \treturn `String\\u202F{\"${String(value)}\"}`;\n\t\t// }\n\n\t\t/*\n\t\t\tHandle `Date` objects.\n\t\t*/\n\t\tif (objType === 'Date') {\n\t\t\t// return `Date\\u202F${value.toISOString()}`;\n\t\t\treturn `Date\\u202F{${value.toLocaleString()}}`;\n\t\t}\n\n\t\t/*\n\t\t\tHandle `RegExp` objects.\n\t\t*/\n\t\tif (objType === 'RegExp') {\n\t\t\treturn `RegExp\\u202F${value.toString()}`;\n\t\t}\n\n\t\tconst result = [];\n\n\t\t/*\n\t\t\tHandle `Array` & `Set` objects.\n\t\t*/\n\t\tif (value instanceof Array || value instanceof Set) {\n\t\t\tconst list = value instanceof Array ? value : Array.from(value);\n\n\t\t\t// own numeric properties\n\t\t\t// NOTE: Do not use `<Array>.forEach()` here as it skips undefined members.\n\t\t\tfor (let i = 0, len = list.length; i < len; ++i) {\n\t\t\t\tresult.push(list.hasOwnProperty(i) ? _toWatchString(list[i]) : '<empty>');\n\t\t\t}\n\n\t\t\t// own enumerable non-numeric expando properties\n\t\t\tObject.keys(list)\n\t\t\t\t.filter(key => !_numericKeyRe.test(key))\n\t\t\t\t.forEach(key => result.push(`${_toWatchString(key)}: ${_toWatchString(list[key])}`));\n\n\t\t\treturn `${objType}(${list.length})\\u202F[${result.join(', ')}]`;\n\t\t}\n\n\t\t/*\n\t\t\tHandle `Map` objects.\n\t\t*/\n\t\tif (value instanceof Map) {\n\t\t\tvalue.forEach((val, key) => result.push(`${_toWatchString(key)} \\u2192 ${_toWatchString(val)}`));\n\n\t\t\treturn `${objType}(${value.size})\\u202F{${result.join(', ')}}`;\n\t\t}\n\n\t\t/*\n\t\t\tGeneral object handling.\n\t\t*/\n\t\t// own enumerable properties\n\t\tObject.keys(value)\n\t\t\t.forEach(key => result.push(`${_toWatchString(key)}: ${_toWatchString(value[key])}`));\n\n\t\treturn `${objType}\\u202F{${result.join(', ')}}`;\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************************************************/\n\treturn Object.freeze(Object.defineProperties({}, {\n\t\t/*\n\t\t\tDebug Bar Functions.\n\t\t*/\n\t\tinit     : { value : debugBarInit },\n\t\tisStowed : { value : debugBarIsStowed },\n\t\tstart    : { value : debugBarStart },\n\t\tstow     : { value : debugBarStow },\n\t\ttoggle   : { value : debugBarToggle },\n\t\tunstow   : { value : debugBarUnstow },\n\n\t\t/*\n\t\t\tWatch Functions.\n\t\t*/\n\t\twatch : {\n\t\t\tvalue : Object.freeze(Object.defineProperties({}, {\n\t\t\t\tadd       : { value : debugBarWatchAdd },\n\t\t\t\tall       : { value : debugBarWatchAddAll },\n\t\t\t\tclear     : { value : debugBarWatchClear },\n\t\t\t\tdelete    : { value : debugBarWatchDelete },\n\t\t\t\tdisable   : { value : debugBarWatchDisable },\n\t\t\t\tenable    : { value : debugBarWatchEnable },\n\t\t\t\tisEnabled : { value : debugBarWatchIsEnabled },\n\t\t\t\ttoggle    : { value : debugBarWatchToggle }\n\t\t\t}))\n\t\t}\n\t}));\n})();\n\n/***********************************************************************************************************************\n\n\tloadscreen.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/* global Config, Engine */\n\nvar LoadScreen = (() => { // eslint-disable-line no-unused-vars, no-var\n\t'use strict';\n\n\t// Locks collection.\n\tconst _locks = new Set();\n\n\t// Auto-incrementing lock ID.\n\tlet _autoId = 0;\n\n\n\t/*******************************************************************************************************************\n\t\tLoadScreen Functions.\n\t*******************************************************************************************************************/\n\t/*\n\t\tInitialize management of the loading screen.\n\t*/\n\tfunction loadScreenInit() {\n\t\tif (DEBUG) { console.log('[LoadScreen/loadScreenInit()]'); }\n\n\t\t// Add a `readystatechange` listener for hiding/showing the loading screen.\n\t\tjQuery(document).on('readystatechange.SugarCube', () => {\n\t\t\tif (DEBUG) { console.log(`[LoadScreen/<readystatechange>] document.readyState: \"${document.readyState}\"; locks(${_locks.size}):`, _locks); }\n\n\t\t\tif (_locks.size > 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// The value of `document.readyState` may be: 'loading' -> 'interactive' -> 'complete'.\n\t\t\t// Though, to reach this point, it must already be in, at least, the 'interactive' state.\n\t\t\tif (document.readyState === 'complete') {\n\t\t\t\tif (jQuery(document.documentElement).attr('data-init') === 'loading') {\n\t\t\t\t\tif (Config.loadDelay > 0) {\n\t\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\t\tif (_locks.size === 0) {\n\t\t\t\t\t\t\t\tloadScreenHide();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, Math.max(Engine.minDomActionDelay, Config.loadDelay));\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tloadScreenHide();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tloadScreenShow();\n\t\t\t}\n\t\t});\n\t}\n\n\t/*\n\t\tClear the loading screen.\n\t*/\n\tfunction loadScreenClear() {\n\t\tif (DEBUG) { console.log('[LoadScreen/loadScreenClear()]'); }\n\n\t\t// Remove the event listener.\n\t\tjQuery(document).off('readystatechange.SugarCube');\n\n\t\t// Clear all locks.\n\t\t_locks.clear();\n\n\t\t// Hide the loading screen.\n\t\tloadScreenHide();\n\t}\n\n\t/*\n\t\tHide the loading screen.\n\t*/\n\tfunction loadScreenHide() {\n\t\tif (DEBUG) { console.log('[LoadScreen/loadScreenHide()]'); }\n\n\t\tjQuery(document.documentElement).removeAttr('data-init');\n\t}\n\n\t/*\n\t\tShow the loading screen.\n\t*/\n\tfunction loadScreenShow() {\n\t\tif (DEBUG) { console.log('[LoadScreen/loadScreenShow()]'); }\n\n\t\tjQuery(document.documentElement).attr('data-init', 'loading');\n\t}\n\n\t/*\n\t\tReturns a new lock ID after locking and showing the loading screen.\n\t*/\n\tfunction loadScreenLock() {\n\t\tif (DEBUG) { console.log('[LoadScreen/loadScreenLock()]'); }\n\n\t\t++_autoId;\n\t\t_locks.add(_autoId);\n\n\t\tif (DEBUG) { console.log(`\\tacquired loading screen lock; id: ${_autoId}`); }\n\n\t\tloadScreenShow();\n\t\treturn _autoId;\n\t}\n\n\t/*\n\t\tRemove the lock associated with the given lock ID and, if no locks remain,\n\t\ttrigger a `readystatechange` event.\n\t*/\n\tfunction loadScreenUnlock(id) {\n\t\tif (DEBUG) { console.log(`[LoadScreen/loadScreenUnlock(id: ${id})]`); }\n\n\t\tif (id == null) { // lazy equality for null\n\t\t\tthrow new Error('LoadScreen.unlock called with a null or undefined ID');\n\t\t}\n\n\t\tif (_locks.has(id)) {\n\t\t\t_locks.delete(id);\n\n\t\t\tif (DEBUG) { console.log(`\\treleased loading screen lock; id: ${id}`); }\n\t\t}\n\n\t\tif (_locks.size === 0) {\n\t\t\tjQuery(document).trigger('readystatechange');\n\t\t}\n\t}\n\n\n\t/*******************************************************************************************************************\n\t\tModule Exports.\n\t*******************************************************************************************************************/\n\treturn Object.freeze(Object.defineProperties({}, {\n\t\tinit   : { value : loadScreenInit },\n\t\tclear  : { value : loadScreenClear },\n\t\thide   : { value : loadScreenHide },\n\t\tshow   : { value : loadScreenShow },\n\t\tlock   : { value : loadScreenLock },\n\t\tunlock : { value : loadScreenUnlock }\n\t}));\n})();\n\n/* eslint no-undef: \"off\", no-param-reassign: \"off\", no-alert: \"off\", no-fallthrough: \"off\", no-dupe-args: \"warn\", no-irregular-whitespace: \"warn\", max-len: \"off\", key-spacing: [\"warn\", {beforeColon: false, afterColon: true}], comma-dangle: [\"warn\", \"always-multiline\"], quotes: [\"warn\", \"double\"], indent: [\"warn\", \"tab\", {SwitchCase: 1}], id-length: \"off\", brace-style: [\"warn\", \"1tbs\"] */\n\n/*\n * \"simple\" indexedDB backend for storing save data, working similarly to existing webStorage system\n * indexedDB works faster, has virtually unlimited storage, but does not work properly in private mode. then again, localStorage doesn't persist in private mode either\n * indexedDB operates asynchronously, by making requests that may be fulfilled or rejected later, without blocking the rest of the code, but also without a guarantee that requested values will be available when that rest of the code runs. this requires some working around.\n * unlike old synchronous operations, most functions do not return the value immediately, but a promise to return it when it's completed. these promises can then be used to retrieve that data by calling Promise.then() callback function\n * for example, `idb.getItem(0).then((value) => console.log(value))` will first attempt to retrieve save data from slot 0, and then when that is done - the then() function triggers, in this case printing retrieved value to the console\n *\n * this implementation doesn't rely on caches, doesn't compress save data in any way, and separates save details store from save data store to speed up building the save list and allow extra features like timestamp highlighting at minimal processing cost\n * as a consequence, it requires more disk space, and a completely separate namespace that might need extra setup for games that override the default save list appearance\n * generally though, just adding a \"saveList\" id or class to the div element where the saves should appear and replacing the function/macro that populates that div with \"if (idb.active) idb.saveList(); else old-custom-way-of-building-save-menu\" should be enough to make it work.\n */\n\nconst idb = (() => {\n\t\"use strict\";\n\n\t// return early if indexedDB is unavailable\n\tif (window.indexedDB == null) return Object.freeze({\n\t\tlock: true,\n\t\t/* eslint-disable brace-style */\n\t\tinit() { return false; },\n\t\tget active() { return false; },\n\t\tset active(_) { return false; },\n\t\tget footerHTML() { return false; },\n\t\tset footerHTML(_) { return false; },\n\t\t/* eslint-enable brace-style */\n\t});\n\n\tlet lock = true; // don't allow multiple operations at the same time, majority of sugarcube is not async\n\tlet active = true; // whether to use indexedDB or the old localStorage\n\tlet dbName = \"idb\"; // database name\n\tlet migrationNeeded = false; // flag to migrate old saves\n\tlet open = false; // some browsers randomly decide to close db still in use\n\tlet settings = {}; // persistent db settings stored in localStorage\n\tupdateSettings();\n\tlet saveDetails = []; // cache so we don't have to query all items from details store on every page change\n\n\tlet db; // database to be\n\n\tlet openRequest = null;\n\t// open the database. should stay open while the page is open.\n\tfunction openDB(name = dbName) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tdbName = name;\n\t\t\topenRequest = indexedDB.open(idb.dbName);\n\t\t\t// bring the database up to date\n\t\t\topenRequest.onupgradeneeded = event => {\n\t\t\t\tconsole.log(\"updating idb\", event.oldVersion);\n\t\t\t\tswitch (event.oldVersion) {\n\t\t\t\t\tcase 0: // 0 means we're creating a new database from scratch\n\t\t\t\t\t\t// create an object store for saves, containing lots of data\n\t\t\t\t\t\topenRequest.result.createObjectStore(\"saves\", { keyPath: \"slot\" });\n\t\t\t\t\t\t// and a separate store for small details, that should be fast to access\n\t\t\t\t\t\topenRequest.result.createObjectStore(\"details\", { keyPath: \"slot\" });\n\t\t\t\t\t\t// flag old saves from localStorage for migration\n\t\t\t\t\t\tmigrationNeeded = true;\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\tbreak; // put db upgrade code here if it's ever needed\n\t\t\t\t}\n\t\t\t};\n\t\t\t// errors most often happen in private browsing mode. nothing to do here.\n\t\t\topenRequest.onerror = () => {\n\t\t\t\tconsole.log(\"error opening idb\", openRequest.error);\n\t\t\t\treject(openRequest.error);\n\t\t\t};\n\t\t\t// indexedDB is opened, mark the rest of the system as active\n\t\t\topenRequest.onsuccess = () => {\n\t\t\t\tdb = openRequest.result;\n\t\t\t\tlock = false;\n\t\t\t\topen = true;\n\t\t\t\tgetSaveDetails().then(d => saveDetails = d);\n\t\t\t\tconsole.log(\"idbOpen success\");\n\t\t\t\tif (navigator.storage && typeof navigator.storage.persist === \"function\") navigator.storage.persist();\n\t\t\t\tdb.onclose = ev => {\n\t\t\t\t\topen = false;\n\t\t\t\t\tactive = false;\n\t\t\t\t\tconsole.log(\"idb connection closed, this shouldn't happen\", ev);\n\t\t\t\t\tif (Errors) Errors.report(\"ERROR: idb connection closed unexpectedly\", ev);\n\t\t\t\t\telse alert(\"ERROR: idb connection closed unexpectedly\");\n\t\t\t\t};\n\t\t\t\tdb.onerror = ev => {\n\t\t\t\t\tconsole.error(`Database error: ${ev.target.errorCode}`);\n\t\t\t\t\tactive = false;\n\t\t\t\t};\n\t\t\t\t// this only triggers after initial db creation, but can't be put into onupgradeneeded because you need database to be successfully open before putting stuff into it\n\t\t\t\tif (migrationNeeded) {\n\t\t\t\t\timportFromLocalStorage();\n\t\t\t\t\tmigrationNeeded = false;\n\t\t\t\t}\n\t\t\t\tresolve(db);\n\t\t\t};\n\t\t\topenRequest.onblocked = () => {\n\t\t\t\tconsole.log(\"something went wrong\", openRequest.error);\n\t\t\t\treject(openRequest.error);\n\t\t\t};\n\t\t});\n\t}\n\n\t/**\n\t * synchronize internal settings with persistent storage\n\t * allowing them to survive page reload\n\t *\n\t * @param {string} setting accessor to modify\n\t * @param {boolean} value to set\n\t */\n\tfunction updateSettings(setting, value) {\n\t\tconst storageName = \"idb-settings\";\n\t\tsettings = JSON.parse(localStorage.getItem(storageName)) || {\n\t\t\twarnSave: V.confirmSave || false,\n\t\t\twarnLoad: V.confirmLoad || false,\n\t\t\twarnDelete: V.confirmDelete || true,\n\t\t\tactive: !window.FCHostPersistent,\n\t\t\tuseDelta: false,\n\t\t};\n\t\tif (setting) settings[setting] = value;\n\t\tactive = settings.active; // one-way sync, only change default when triggered by user, not by fail-safes\n\t\tlocalStorage.setItem(storageName, JSON.stringify(settings));\n\t}\n\tupdateSettings();\n\n\tconst baddies = [];\n\t/**\n\t * scan and stringify functions that wormed their way into story vars\n\t * and other objects with custom toJSON revivals\n\t *\n\t * @param {object} target to scan\n\t * @param {object} path to report\n\t * @param {boolean} verbose flag to report objects too complex for idb\n\t */\n\tfunction funNuke(target, path = \"\", verbose = true) {\n\t\tif (!target) return console.log(\"no target specified\");\n\t\tfor (const key in target) {\n\t\t\tconst value = target[key];\n\t\t\tconst newPath = `${path}['${key}']`;\n\t\t\tif (value == null) continue;\n\t\t\telse if (typeof value === \"function\" || value.toJSON) {\n\t\t\t\t// we've got a baddie, round him up!\n\t\t\t\tif (verbose && V.idbTest) {\n\t\t\t\t\tconsole.log(`Warn: ${newPath} of type ${typeof value} shouldn't be in STORY variables!!!`);\n\t\t\t\t}\n\t\t\t\ttarget[key] = JSON.stringify(value);\n\t\t\t\tbaddies.push(newPath);\n\t\t\t} else if (typeof value === \"object\") funNuke(value, newPath, verbose);\n\t\t}\n\t}\n\n\t/**\n\t * restore nuked functions and other nasty stuff\n\t *\n\t * @param {object} target store to alter\n\t * @param {array} paths to restore\n\t */\n\tfunction ekuNnuf(target = V, paths) {\n\t\t/**\n\t\t * sub-function to revive specified path\n\t\t *\n\t\t * @param {object} target\n\t\t * @param {string} path string in a format \"['path']['to']['object']\"\n\t\t * @returns true on success\n\t\t */\n\t\tfunction revive(target, path) {\n\t\t\tif (typeof path !== \"string\" || path === \"\") return console.log(\"Warn: invalid path\", clone(path));\n\t\t\tconst accessors = path.slice(2,-2).split(\"']['\");\n\t\t\tlet ref = target;\n\t\t\tfor (let i = 0, destination = accessors.length - 1; i <= destination; i++) {\n\t\t\t\tif (i === destination) ref[accessors[i]] = JSON.parse(ref[accessors[i]]);\n\t\t\t\telse ref = ref[accessors[i]];\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tlet path = \"\";\n\t\twhile (path = paths.shift()) {\n\t\t\ttry {\n\t\t\t\trevive(target, path);\n\t\t\t} catch (ex) {\n\t\t\t\tconsole.log(\"WARN: couldn't restore story var function\", path);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * copy saves from localStorage into indexedDB, without regard for what's already in there\n\t *\n\t * @returns {boolean} success of the operation\n\t */\n\tasync function importFromLocalStorage() {\n\t\tfunction processSave(saveObj) {\n\t\t\tconst save = saveObj.state;\n\t\t\tif (save.jdelta) delete save.jdelta; // jdelta wasn't a great idea\n\t\t\tif (save.delta) save.history = State.deltaDecode(save.delta);\n\t\t\tdelete save.delta;\n\t\t\tif (window.DoLSave) DoLSave.decompressIfNeeded({ state: save });\n\n\t\t\tconst vars = save.history[save.index].variables;\n\t\t\tif (!vars.saveId) {\n\t\t\t\t// assign saveId, use Math.random() to not trip prng\n\t\t\t\tconst saveId = Math.floor(Math.random() * 90000) + 10000;\n\t\t\t\tsave.history.forEach(s => s.variables.saveId = saveId);\n\t\t\t}\n\n\t\t\tconst data = {\n\t\t\t\tdate: saveObj.date,\n\t\t\t\tid: saveObj.id,\n\t\t\t\ttitle: saveObj.title,\n\t\t\t\tmetadata: saveObj.metadata || { saveId: vars.saveId, saveName: vars.saveName },\n\t\t\t};\n\n\t\t\treturn [save, data];\n\t\t}\n\n\t\tlet mtCount = 0;\n\t\tconst oldSaves = Save.get();\n\t\tconst autoSave = oldSaves.autosave;\n\t\tif (autoSave != null) {\n\t\t\t// autosave was moved from a separate slot in old system to just 0\n\t\t\t// if multiple autosaves are to be implemented, they can use negative slot numbers\n\t\t\tconst saveData = processSave(save);\n\t\t\t// setItem only allows one operation at a time to prevent possible exploits, so wait for it to finish\n\t\t\tawait setItem(0, saveData[0], { slot: 0, data: saveData[1] });\n\t\t} else mtCount++;\n\t\tfor (let i = 0; i < oldSaves.slots.length; i++) {\n\t\t\tconst slotSave = oldSaves.slots[i];\n\t\t\tif (slotSave != null) {\n\t\t\t\tconst saveData = processSave(slotSave);\n\t\t\t\tawait setItem(i + 1, saveData[0], { slot: i + 1, data: saveData[1] });\n\t\t\t} else mtCount++;\n\t\t}\n\t\tif (mtCount === oldSaves.slots.length + 1) { // all slots are empty, different storage method?\n\t\t\tconst index = storage.get(\"index\");\n\t\t\tif (index && index.slots) {\n\t\t\t\t// fc-like\n\t\t\t\tconst autosave = storage.get(\"autosave\");\n\t\t\t\tif (autosave) {\n\t\t\t\t\tconst saveData = processSave(autosave);\n\t\t\t\t\tawait setItem(0, saveData[0], { slot: 0, data: saveData[1] });\n\t\t\t\t}\n\t\t\t\tfor (let i = 0; i < index.slots.length; i++) {\n\t\t\t\t\tconst slotSave = storage.get(\"slot\" + i); // eslint-disable-line prefer-template\n\t\t\t\t\tif (!slotSave) continue;\n\t\t\t\t\tconst saveData = processSave(slotSave);\n\t\t\t\t\tawait setItem(i + 1, saveData[0], { slot: i + 1, data: saveData[1] });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tawait getSaveDetails().then(d => saveDetails = d);\n\t\tconsole.log(\"idb migration successful\");\n\t\treturn true;\n\t}\n\n\t/**\n\t * turn transaction event handlers into promises\n\t *\n\t * @param {Request} transaction\n\t */\n\tfunction makePromise(transaction) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\ttransaction.onsuccess = () => {\n\t\t\t\tlock = false;\n\t\t\t\treturn resolve(transaction.result);\n\t\t\t};\n\t\t\ttransaction.oncomplete = () => {\n\t\t\t\tlock = false;\n\t\t\t\treturn resolve(transaction.result);\n\t\t\t};\n\t\t\ttransaction.onerror = ev => {\n\t\t\t\tlock = false;\n\t\t\t\tactive = false;\n\t\t\t\tconsole.log(transaction.error, ev, \"error\");\n\t\t\t\treturn reject(transaction.error);\n\t\t\t};\n\t\t\ttransaction.onabort = () => {\n\t\t\t\tlock = false;\n\t\t\t\tconsole.log(\"aborted\", transaction.error);\n\t\t\t\treturn reject(transaction.error);\n\t\t\t};\n\t\t});\n\t}\n\n\t/**\n\t * retrieve an item from indexedDB\n\t *\n\t * @param {number} slot\n\t * @returns {Promise} promise to return a value some day\n\t */\n\tasync function getItem(slot) {\n\t\tif (!open) await openDB();\n\t\tconst transactionRequest = db.transaction(\"saves\", \"readonly\");\n\t\tconst item = transactionRequest.objectStore(\"saves\").get(slot);\n\n\t\treturn makePromise(item);\n\t}\n\n\t/**\n\t * place a save object into saves store and a provided or calculated details object into details store\n\t * will replace existing object in specified slot without a second thought\n\t *\n\t * @param {number} slot slot to write into\n\t * @param {object} saveObj valid save object with unencoded history\n\t * @param {object} details optional save details to override what's going into details store\n\t * @returns {Promise | undefined} promise to report on success of this operation some day or return early\n\t */\n\tasync function setItem(slot, saveObj, details) {\n\t\tif (lock) return;\n\t\t// if (saveObj == null || !Object.hasOwn(saveObj, \"history\")) return false;\n\t\tif (saveObj == null || !saveObj.hasOwnProperty(\"history\")) return false;\n\t\tlock = true;\n\n\t\t// prepare save details\n\t\tconst savesItem = { slot, data: saveObj };\n\t\tconst saveVars = saveObj.history[saveObj.index].variables;\n\t\tconst metadata = { saveId: saveVars.saveId, saveName: saveVars.saveName };\n\t\tconst detailsItem = details || {\n\t\t\tslot,\n\t\t\tdata: {\n\t\t\t\tid: Story.domId,\n\t\t\t\ttitle: Story.get(State.passage).description(),\n\t\t\t\tdate: Date.now(),\n\t\t\t\tmetadata,\n\t\t\t},\n\t\t};\n\t\tdetailsItem.slot = slot; // ensure that slot is in the details\n\n\t\t// expect failures here\n\t\ttry {\n\t\t\tif (!open) await openDB();\n\t\t\t// sanitize complex data structures that can't be stored in idb\n\t\t\tlet counter = 0; // only report problems for the first frame\n\t\t\tsaveObj.history.forEach(s => {\n\t\t\t\tbaddies.splice(0); // clear the baddies\n\t\t\t\tfunNuke(s.variables, \"\", !counter++); // wrap up new baddies\n\t\t\t\tif (baddies.length) s.baddies = clone(baddies); // seal the records\n\t\t\t});\n\t\t\tif (settings.useDelta) {\n\t\t\t\tsaveObj.delta = State.deltaEncode(saveObj.history);\n\t\t\t\tdelete saveObj.history;\n\t\t\t}\n\n\t\t\t// open a request to set or replace an existing slot\n\t\t\tconst transactionRequest = db.transaction([\"saves\", \"details\"], \"readwrite\");\n\t\t\ttransactionRequest.objectStore(\"saves\").delete(slot);\n\t\t\ttransactionRequest.objectStore(\"saves\").add(savesItem);\n\t\t\ttransactionRequest.objectStore(\"details\").delete(slot);\n\t\t\ttransactionRequest.objectStore(\"details\").add(detailsItem);\n\n\t\t\treturn makePromise(transactionRequest);\n\t\t} catch (ex) {\n\t\t\t// admit the defeat and go home\n\t\t\tif (window.Errors) Errors.report(`idb.setItem failure unknown. Couldn't complete the save in slot ${slot}`);\n\t\t\telse alert(`idb.setItem failure unknown. Couldn't complete the save in slot ${slot}`);\n\t\t\tlock = false;\n\t\t\t// return a promise, because some code down the line expects .then()\n\t\t\treturn new Promise(resolve => resolve(false));\n\t\t}\n\t}\n\n\t/**\n\t * delete save data in a specified slot\n\t *\n\t * @param {number} slot\n\t * @returns {Promise | undefined} promise to report on success or return early\n\t */\n\tasync function deleteItem(slot) {\n\t\tif (lock) return;\n\t\tif (!open) await openDB();\n\t\tlock = true;\n\n\t\tconst transactionRequest = db.transaction([\"saves\", \"details\"], \"readwrite\");\n\t\ttransactionRequest.objectStore(\"saves\").delete(slot);\n\t\ttransactionRequest.objectStore(\"details\").delete(slot);\n\n\t\treturn makePromise(transactionRequest).then(await getSaveDetails().then(d => saveDetails = d));\n\t}\n\n\t/**\n\t * actually load a save from idb\n\t *\n\t * @param {number} slot\n\t */\n\tfunction loadState(slot) {\n\t\tif (lock) return;\n\t\treturn getItem(slot).then(value => {\n\t\t\tif (value == null) return false;\n\t\t\tif (value.data.delta) {\n\t\t\t\tvalue.data.history = State.deltaDecode(value.data.delta);\n\t\t\t\tdelete value.data.delta;\n\t\t\t}\n\t\t\tvalue.data.history.forEach(s => {\n\t\t\t\t// restore story var functions\n\t\t\t\tif (s.baddies) {\n\t\t\t\t\tekuNnuf(s.variables, s.baddies);\n\t\t\t\t\tdelete s.baddies;\n\t\t\t\t}\n\t\t\t});\n\t\t\tSave.onLoad.handlers.forEach(fn => fn({ state: value.data }));\n\t\t\tState.unmarshalForSave(value.data);\n\t\t\tState.show();\n\t\t});\n\t}\n\n\t/**\n\t * save current game into idb\n\t *\n\t * @param {number} slot\n\t */\n\tasync function saveState(slot) {\n\t\tif (lock) return;\n\t\tconst saveObj = State.marshalForSave();\n\t\t// assign V.saveId if necessary\n\t\tif (!V.saveId) {\n\t\t\tconst saveId = Math.floor(Math.random() * 90000) + 10000;\n\t\t\tV.saveId = saveId;\n\t\t\tState.history.forEach(s => s.variables.saveId = saveId);\n\t\t\tsaveObj.history.forEach(s => s.variables.saveId = saveId);\n\t\t}\n\t\tSave.onSave.handlers.forEach(fn => fn({ state: saveObj, date: Date.now() }, { type: slot <= 0 ? \"autosave\" : \"slot\" })); // run onSave handlers\n\t\tif (saveObj != null) {\n\t\t\tawait setItem(slot, saveObj);\n\t\t\tawait getSaveDetails().then(d => saveDetails = d);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * get all elements from details db\n\t * details db mirrors metadata for real saves in saves db\n\t *\n\t * @returns {Array} list of details for all saves in idb\n\t */\n\tasync function getSaveDetails() {\n\t\tif (!open) await openDB();\n\t\tconst transactionRequest = db.transaction([\"details\"], \"readonly\");\n\t\tconst details = transactionRequest.objectStore(\"details\").getAll();\n\n\t\treturn makePromise(details);\n\t}\n\n\tasync function getAllSaves() {\n\t\tif (!open) await openDB();\n\t\tconst transactionRequest = db.transaction([\"saves\"], \"readonly\");\n\t\tconst details = transactionRequest.objectStore(\"saves\").getAll();\n\n\t\treturn makePromise(details);\n\t}\n\n\t/**\n\t * mercilessly clear all object stores one step short from outright deleting the db itself\n\t *\n\t * @returns {Promise | undefined} promise to maybe report when the deed is done or return early\n\t */\n\tasync function clearAll() {\n\t\tif (lock) return;\n\t\tif (!open) await openDB();\n\t\tconst transactionRequest = db.transaction([\"saves\", \"details\"], \"readwrite\");\n\t\ttransactionRequest.objectStore(\"saves\").clear();\n\t\ttransactionRequest.objectStore(\"details\").clear();\n\t\tsaveDetails = [];\n\n\t\treturn makePromise(transactionRequest);\n\t}\n\n\t/**\n\t * check if saves are allowed\n\t */\n\tfunction savesAllowed() {\n\t\treturn typeof Config.saves.isAllowed !== \"function\" || Config.saves.isAllowed();\n\t}\n\n\t/**\n\t * define saveList variables\n\t */\n\n\tlet listLength; // store save list length in idb\n\tlet listPage; // same with the current page\n\tconst listLengthMax = 20; // maximum number of rows\n\tconst listPageMax = 20; // maximum number of pages\n\tlet latestSave = { slot: 1, date: 0 }; // keep track of the most recent save, separately from autosave on slot 0\n\tlet extraSaveWarn;\n\tlet footerHTML = \"\"; // add some text to fill empty space at the deleteAll button\n\n\t/**\n\t * construct a saves list page, with configurable length\n\t *\n\t * @param {number} page\n\t * @param {number} length\n\t * @returns {DocumentFragment};\n\t */\n\tfunction generateSavesPage(page = listPage - 1, length = listLength) {\n\t\tconst listContainer = document.createElement(\"div\");\n\t\tlistContainer.id = \"saves-list-container\";\n\t\tlistContainer.appendChild(generateHeaderRow());\n\t\t// cache whether saves are allowed\n\t\tconst saveUnlock = savesAllowed();\n\n\t\t// find the most recent save that is not autosave\n\t\tlatestSave = { slot: 1, date: 0 }; // re-init latest slot every time\n\t\tlet autoSaveDate; // store timestamp for the autosave separately\n\t\tsaveDetails.forEach(d => {\n\t\t\tif (d.slot === 0) autoSaveDate = d.data.date;\n\t\t\telse if (d.data.date > latestSave.date) {\n\t\t\t\tlatestSave.slot = d.slot;\n\t\t\t\tlatestSave.date = d.data.date;\n\t\t\t}\n\t\t});\n\t\t// default list length is set here\n\t\tif (!listLength) {\n\t\t\t// idb is indexed by slot, so the highest is always last\n\t\t\tconst slot = saveDetails.length ? saveDetails.last().slot : 0;\n\t\t\t// adjust list length to include saves in the highest slot\n\t\t\t// max pages is 20 (still too low if you're using 1080x1920 portrait mode)\n\t\t\t// by default, list length is 10, resulting into up to 200 slots across 20 pages\n\t\t\t// max list length is 20, resulting into up to 400 slots\n\t\t\t// having a save anywhere in slots > 200 shall increase list length so it won't disappear\n\t\t\t// it can also be used to increase default list length without any extra variables\n\t\t\tfor (listLength = 10; slot > listLength * listPageMax && listLength < listLengthMax; listLength++);\n\t\t\tlength = listLength;\n\t\t}\n\t\t// if not set to a correct value, show the page with the most recent save\n\t\tif (!Number.isInteger(page)) {\n\t\t\t// autosave is shown on every page, so if autosave is the most recent save - open the page with the most recent non-autosave with the same ID\n\t\t\tconst latestSlot = saveDetails.find(d => d.slot === latestSave.slot);\n\t\t\tif (latestSlot) {\n\t\t\t\tconst autoSaveExists = saveDetails[0].slot === 0;\n\t\t\t\tconst ignoreAutoSave = latestSlot.data.date > autoSaveDate || latestSlot.data.metadata.saveId === saveDetails[0].data.metadata.saveId;\n\t\t\t\tif (!autoSaveExists || ignoreAutoSave) page = Math.floor((latestSave.slot - 1) / length);\n\t\t\t\telse page = 0;\n\t\t\t} else page = 0;\n\t\t\tlistPage = page + 1;\n\t\t}\n\n\t\t// getSaveDetails can take longer to init listLength and listPage than it takes for their fields to be placed on page, gotta update them in such case\n\t\tconst pageField = document.getElementById(\"pageNum\");\n\t\tif (pageField != null) pageField.value = listPage;\n\t\tconst lengthField = document.getElementById(\"pageLen\");\n\t\tif (lengthField != null) lengthField.value = listLength;\n\n\t\t// default object details for an empty slot\n\t\tconst defaultDetailsObj = { date: \"\", title: \"\", metadata: { saveId: \"\", saveName: \"\" } };\n\n\t\t// always show autosave on top\n\t\tconst autoDetailsObj = saveDetails[0] && saveDetails[0].slot === 0 ? saveDetails[0].data : clone(defaultDetailsObj);\n\t\tif (autoSaveDate > latestSave.date) autoDetailsObj.latestSlot = true;\n\t\tautoDetailsObj.slot = 0;\n\t\t// don't show if autosaves are disabled by the engine\n\t\tif (Save.autosave.ok())\tlistContainer.appendChild(generateSaveRow(autoDetailsObj));\n\n\t\t// main loop for adding the save rows\n\t\tfor (let slot = length * page + 1; slot < length * (page + 1) + 1; slot++) {\n\t\t\t// create default details\n\t\t\tlet detailsObj = clone(defaultDetailsObj);\n\t\t\t// if a save exists in idb, replace the details with recorded ones\n\t\t\tconst detailsIndex = saveDetails.findIndex(d => d.slot === slot);\n\t\t\tif (detailsIndex !== -1) {\n\t\t\t\tdetailsObj = saveDetails[detailsIndex].data;\n\t\t\t\t// add a flag to highlight the most recent save\n\t\t\t\tif (Number(latestSave.slot) === slot) detailsObj.latestSlot = true;\n\t\t\t}\n\t\t\tdetailsObj.slot = slot;\n\t\t\tdetailsObj.saveUnlock = saveUnlock;\n\t\t\tlistContainer.appendChild(generateSaveRow(detailsObj));\n\t\t}\n\n\t\treturn listContainer;\n\t}\n\n\t/**\n\t * construct the header row for the save list\n\t * warning: unnecessarily complicated DOM manipulations\n\t *\n\t * @returns {DocumentFragment} header row\n\t */\n\tfunction generateHeaderRow() {\n\t\tconst frag = document.createDocumentFragment();\n\t\tconst saveListHeader = document.createElement(\"div\");\n\t\tsaveListHeader.className = \"savesListRow\";\n\t\tfrag.appendChild(saveListHeader);\n\n\t\tconst headerSaveGroup = document.createElement(\"div\");\n\t\theaderSaveGroup.className = \"saveGroup\";\n\t\tsaveListHeader.appendChild(headerSaveGroup);\n\n\t\tconst headerSaveId = document.createElement(\"div\");\n\t\theaderSaveId.className = \"saveId\";\n\t\theaderSaveId.innerText = \"#\";\n\t\theaderSaveGroup.appendChild(headerSaveId);\n\n\t\tconst headerSaveButton = document.createElement(\"div\");\n\t\theaderSaveButton.className = \"saveButton\";\n\t\theaderSaveButton.innerText = L10n.get(\"savesHeaderSaveLoad\");\n\t\theaderSaveGroup.appendChild(headerSaveButton);\n\n\t\tconst headerSaveName = document.createElement(\"div\");\n\t\theaderSaveName.className = \"saveName\";\n\t\theaderSaveName.innerText = L10n.get(\"savesHeaderIDName\");\n\t\theaderSaveGroup.appendChild(headerSaveName);\n\n\t\tconst headerSaveDetails = document.createElement(\"div\");\n\t\theaderSaveDetails.className = \"saveDetails\";\n\t\theaderSaveDetails.innerText = L10n.get(\"savesHeaderDetails\");\n\t\theaderSaveGroup.appendChild(headerSaveDetails);\n\n\t\tconst headerDeleteButton = document.createElement(\"div\");\n\t\theaderDeleteButton.className = \"deleteButton\";\n\t\theaderSaveGroup.appendChild(headerDeleteButton);\n\n\t\treturn frag;\n\t}\n\n\t/**\n\t * construct the footer row for the save list\n\t * warning: unnecessarily complicated DOM manipulations\n\t *\n\t * @returns {HTMLUListElement} footer row\n\t */\n\tfunction generateFooterRow() {\n\t\tconst container = document.createElement(\"ul\");\n\t\tcontainer.className = \"buttons\";\n\t\tlet li;\n\n\t\tconst exportButton = document.createElement(\"button\");\n\t\texportButton.id = \"saves-export\";\n\t\texportButton.className = \"ui-close\";\n\t\texportButton.innerText = L10n.get(\"savesLabelExport\");\n\t\tif (savesAllowed()) {\n\t\t\texportButton.onclick = Save.export;\n\t\t\texportButton.classList.add(\"saveMenuButton\");\n\t\t} else exportButton.disabled = true;\n\t\tli = document.createElement(\"li\");\n\t\tli.appendChild(exportButton);\n\t\tcontainer.appendChild(li);\n\n\t\tif (navigator.clipboard) {\n\t\t\tconst toClipboardButton = document.createElement(\"button\");\n\t\t\ttoClipboardButton.id = \"saves-toClipboard\";\n\t\t\ttoClipboardButton.className = \"ui-close\";\n\t\t\ttoClipboardButton.innerText = L10n.get(\"savesLabelToClipboard\");\n\t\t\tif (savesAllowed()) {\n\t\t\t\ttoClipboardButton.onclick = () => {\n\t\t\t\t\tnavigator.clipboard.writeText(Save.serialize());\n\t\t\t\t\twindow.closeOverlay();\n\t\t\t\t};\n\t\t\t\ttoClipboardButton.classList.add(\"saveMenuButton\");\n\t\t\t} else toClipboardButton.disabled = true;\n\t\t\tli = document.createElement(\"li\");\n\t\t\tli.appendChild(toClipboardButton);\n\t\t\tcontainer.appendChild(li);\n\t\t}\n\n\t\tconst importButton = document.createElement(\"button\");\n\t\timportButton.id = \"saves-import\";\n\t\timportButton.className = \"saveMenuButton\";\n\t\timportButton.innerText = L10n.get(\"savesLabelImport\");\n\t\timportButton.onclick = () => jQuery(document.createElement(\"input\")).prop(\"type\", \"file\").on(\"change\", SugarCube.Save.import).trigger(\"click\"); // gotta give it to anthaum for finding this\n\t\tli = document.createElement(\"li\");\n\t\tli.appendChild(importButton);\n\t\tcontainer.appendChild(li);\n\n\t\tconst clearAllButton = document.createElement(\"button\");\n\t\tclearAllButton.className = \"saves-clear saveMenuButton\";\n\t\tclearAllButton.innerText = L10n.get(\"savesLabelClear\");\n\t\tclearAllButton.onclick = () => saveList(\"confirm clear\");\n\t\tli = document.createElement(\"li\");\n\t\tli.appendChild(clearAllButton);\n\t\tcontainer.appendChild(li);\n\n\t\treturn container;\n\t}\n\n\t/**\n\t * all this to generate a single saves row from provided details\n\t * pure js dom manipulations are ugly\n\t *\n\t * @param {object} details save details\n\t * @returns {DocumentFragment}\n\t */\n\tfunction generateSaveRow(details) {\n\t\t// save row to be returned\n\t\tconst row = document.createElement(\"div\");\n\t\t// add a fancy transition that would highlight the row with this id\n\t\tif (details.latestSlot && details.slot !== 0) row.id = \"latestSaveRow\";\n\t\trow.className = \"savesListRow\";\n\n\t\t// save group container\n\t\tconst group = document.createElement(\"div\");\n\t\tgroup.className = \"saveGroup\";\n\n\t\t// save ID\n\t\tconst saveId = document.createElement(\"div\");\n\t\tsaveId.className = \"saveId\";\n\t\tsaveId.innerText = details.slot === 0 ? \"A\" : details.slot;\n\t\tif (details.slot > listPageMax * listLengthMax || details.slot < 0) saveId.classList.add(\"red\");\n\n\t\t// save/load buttons container\n\t\tconst saveload = document.createElement(\"div\");\n\t\tsaveload.className = \"saveButton\";\n\n\t\t// save button\n\t\tconst saveButton = document.createElement(\"button\");\n\t\tsaveButton.innerText = L10n.get(\"savesLabelSave\");\n\t\tif (details.saveUnlock) {\n\t\t\tsaveButton.className = \"saveMenuButton\";\n\t\t\tsaveButton.onclick = () => saveList(\"confirm save\", details);\n\t\t} else {\n\t\t\tsaveButton.disabled = true;\n\t\t}\n\n\t\t// load button\n\t\tconst loadButton = document.createElement(\"button\");\n\t\tloadButton.innerText = L10n.get(\"savesLabelLoad\");\n\t\tif (details.date) {\n\t\t\tloadButton.className = \"saveMenuButton\";\n\t\t\tloadButton.onclick = () => saveList(\"confirm load\", details);\n\t\t} else {\n\t\t\tloadButton.disabled = true;\n\t\t}\n\t\tif (details.slot !== 0) saveload.appendChild(saveButton);\n\t\tsaveload.appendChild(loadButton);\n\n\t\t// save name\n\t\tconst saveName = document.createElement(\"div\");\n\t\tsaveName.className = \"saveName\";\n\t\t// highlight saves with currently loaded save's id\n\t\tif (V.saveId === details.metadata.saveId) saveName.classList.add(\"gold\");\n\t\tsaveName.innerText = details.metadata.saveName ? details.metadata.saveName.slice(0, 10) : details.metadata.saveId;\n\n\t\t// save details\n\t\tconst saveDetails = document.createElement(\"div\");\n\t\tsaveDetails.className = \"saveDetails\";\n\t\t// description\n\t\tconst description = document.createElement(\"span\");\n\t\tdescription.innerText = details.title || \"\\xa0\";\n\t\t// date stamp\n\t\tconst date = document.createElement(\"span\");\n\t\tdate.className = \"datestamp\";\n\t\tif (details.date) {\n\t\t\t// highlight (most) recent save(s)\n\t\t\tif (details.latestSlot) date.classList.add(\"green\");\n\t\t\telse if (details.date > Date.now() - 1800000) date.classList.add(\"gold\");\n\t\t\tdate.innerText = new Date(details.date).toLocaleString();\n\t\t} else date.innerText = \"\\xa0\";\n\t\tsaveDetails.appendChild(description);\n\t\tsaveDetails.appendChild(date);\n\n\t\t// delete button\n\t\tconst deleteButton = document.createElement(\"button\");\n\t\tdeleteButton.className = \"deleteButton right\";\n\t\tdeleteButton.innerText = L10n.get(\"savesLabelDelete\");\n\t\tif (details.date) {\n\t\t\tdeleteButton.classList.add(\"saveMenuButton\");\n\t\t\tdeleteButton.onclick = () => saveList(\"confirm delete\", details);\n\t\t} else {\n\t\t\tdeleteButton.disabled = true;\n\t\t}\n\n\t\tgroup.append(saveId, saveload, saveName, saveDetails);\n\t\trow.appendChild(group);\n\t\trow.appendChild(deleteButton);\n\n\t\treturn row;\n\t}\n\n\t/**\n\t * @returns {HTMLUListElement}\n\t */\n\tfunction generatePager() {\n\t\tconst container = document.createElement(\"ul\");\n\t\tcontainer.className = \"buttons\";\n\t\tlet li;\n\n\t\tli = document.createElement(\"li\");\n\t\tli.append(L10n.get(\"savesPagerPage\"));\n\t\tcontainer.appendChild(li);\n\n\t\t// previous page button\n\t\tconst prevPage = document.createElement(\"button\");\n\t\tprevPage.append(\"<\");\n\t\tif (listPage > 1) {\n\t\t\tprevPage.classList.add(\"saveMenuButton\");\n\t\t\tprevPage.onclick = () => {\n\t\t\t\t--listPage;\n\t\t\t\tsaveList(\"show saves\");\n\t\t\t};\n\t\t} else prevPage.disabled = true;\n\t\tli = document.createElement(\"li\");\n\t\tli.appendChild(prevPage);\n\t\tcontainer.appendChild(li);\n\n\n\t\t// page number input\n\t\tconst pageNum = document.createElement(\"input\");\n\t\tObject.assign(pageNum, {\n\t\t\tid: \"pageNum\",\n\t\t\ttype: \"number\",\n\t\t\tvalue: listPage,\n\t\t\tstyle: \"width: 3em\",\n\t\t\tmin: 1,\n\t\t\tmax: listPageMax,\n\t\t\tonchange: () => {\n\t\t\t\tlistPage = Math.clamp(Math.round(pageNum.value), 1, listPageMax);\n\t\t\t\tsaveList(\"show saves\");\n\t\t\t},\n\t\t});\n\t\tcontainer.appendChild(pageNum); // Not in a li to keep closer to buttons\n\n\t\t// next page button\n\t\tconst nextPage = document.createElement(\"button\");\n\t\tnextPage.append(\">\");\n\t\tif (listPage < listPageMax) {\n\t\t\tnextPage.classList.add(\"saveMenuButton\");\n\t\t\tnextPage.onclick = () => {\n\t\t\t\t++listPage;\n\t\t\t\tsaveList(\"show saves\");\n\t\t\t};\n\t\t} else nextPage.disabled = true;\n\t\tnextPage.onclick = () => {\n\t\t\tif (listPage < listPageMax) listPage++;\n\t\t\tsaveList(\"show saves\");\n\t\t};\n\t\tli = document.createElement(\"li\");\n\t\tli.appendChild(nextPage);\n\t\tcontainer.appendChild(li);\n\n\t\tli = document.createElement(\"li\");\n\t\tli.append(L10n.get(\"savesPagerSavesPerPage\"));\n\t\tcontainer.appendChild(li);\n\n\t\t// list length input\n\t\tconst pageLen = document.createElement(\"input\");\n\t\tObject.assign(pageLen, {\n\t\t\tid: \"pageLen\",\n\t\t\ttype: \"number\",\n\t\t\tvalue: listLength,\n\t\t\tstyle: \"width: 3em\",\n\t\t\tmin: 1,\n\t\t\tmax: listLengthMax,\n\t\t\tonchange: () => {\n\t\t\t\tlistLength = Math.clamp(pageLen.value, 1, listLengthMax);\n\t\t\t\tsaveList(\"show saves\");\n\t\t\t},\n\t\t});\n\t\tli = document.createElement(\"li\");\n\t\tli.append(pageLen);\n\t\tcontainer.appendChild(li);\n\n\t\t// jump to most recent save button\n\t\tconst jumpToLatest = document.createElement(\"button\");\n\t\tjumpToLatest.className = \"saveMenuButton\";\n\t\tjumpToLatest.innerText = L10n.get(\"savesPagerJump\");\n\t\tjumpToLatest.onclick = () => {\n\t\t\t// potentially exploitable to allow saving to slots way above the limit, but the limit is arbitrary to begin with, and idb doesn't actually suffer one bit from going beyond that limit\n\t\t\tlistPage = Math.floor((latestSave.slot - 1) / listLength + 1);\n\t\t\tsaveList(\"show saves\");\n\t\t\tsetTimeout(() => {\n\t\t\t\tconst el = document.getElementById(\"latestSaveRow\");\n\t\t\t\tif (el != null) {\n\t\t\t\t\tel.classList.remove(\"jumpToSaveTransition\");\n\t\t\t\t\tel.classList.add(\"jumpToSaveTransition\");\n\t\t\t\t}\n\t\t\t}, Engine.minDomActionDelay + 100);\n\t\t};\n\t\tli = document.createElement(\"li\");\n\t\tli.appendChild(jumpToLatest);\n\t\tcontainer.appendChild(li);\n\n\t\treturn container;\n\t}\n\n\t// itch app must die or at least update to kitch version, smh\n\tconst replaceChildren = !!document.body.replaceChildren;\n\n\t// alias for closing the saves menu\n\tif (typeof window.closeOverlay === \"undefined\") window.closeOverlay = Dialog.close;\n\n\t/**\n\t * replace contents of saveList div with something useful\n\t *\n\t * @param {string} mode switch for displaying saves list or confirmations\n\t * @param {object} details save details for confirmations\n\t */\n\tasync function saveList(mode, details) {\n\t\tif (!open) await openDB();\n\t\tif (active && !settings.active) updateSettings(\"active\", true); // for when it's called from old save menu\n\t\tif (!mode) {\n\t\t\t// update saveDetails every time menu opens with no options, in case game was saved in another tab\n\t\t\tawait getSaveDetails().then(d => saveDetails = d);\n\t\t\tmode = \"show saves\";\n\t\t}\n\n\t\tawait new Promise(r => setTimeout(0, r(true))); // this actually ensures that #saveList had time to render into DOM\n\t\tconst savesDiv = document.getElementById(\"saveList\") || document.getElementsByClassName(\"saveList\")[0] || document.getElementsByClassName(\"saves\")[0];\n\t\tconst list = document.createDocumentFragment();\n\n\t\t// prepare a re-usable cancel button\n\t\tconst cancelButton = document.createElement(\"button\");\n\t\tcancelButton.className = \"saveMenuButton saveMenuConfirm\";\n\t\tcancelButton.innerText = L10n.get(\"cancel\");\n\t\tcancelButton.onclick = () => saveList(\"show saves\");\n\n\t\t// prepare old save info (if provided)\n\t\tfunction generateOldSaveDescription(details) {\n\t\t\tconst oldSaveDescription = document.createDocumentFragment();\n\t\t\tif (!details || !details.date) return oldSaveDescription;\n\n\t\t\tconst oldSaveTitle = document.createElement(\"p\");\n\t\t\toldSaveTitle.innerText = `${L10n.get(\"savesDescTitle\")} ${details.title}`;\n\n\t\t\tconst oldSaveData = document.createElement(\"p\");\n\t\t\toldSaveData.innerText = `${details.metadata.saveName ? L10n.get(\"savesDescName\") + details.metadata.saveName : L10n.get(\"savesDescId\") + details.metadata.saveId} ${L10n.get(\"savesDescDate\")} ${new Date(details.date).toLocaleString()}`;\n\n\t\t\toldSaveDescription.append(oldSaveTitle, oldSaveData);\n\n\t\t\treturn oldSaveDescription;\n\t\t}\n\n\t\tswitch (mode) {\n\t\t\tcase \"show saves\": {\n\t\t\t\t// print saves list\n\t\t\t\t// show the warnings\n\t\t\t\tif (!savesAllowed()) {\n\t\t\t\t\tconst notAllowedWarning = document.createElement(\"h3\");\n\t\t\t\t\tnotAllowedWarning.className = \"red\";\n\t\t\t\t\tnotAllowedWarning.innerText = V.replayScene ? L10n.get(\"savesDisallowedReplay\") : L10n.get(\"savesDisallowed\");\n\t\t\t\t\tlist.appendChild(notAllowedWarning);\n\t\t\t\t}\n\n\t\t\t\tconst exportReminder = document.createElement(\"p\");\n\t\t\t\texportReminder.id = \"saves-export-reminder\";\n\t\t\t\texportReminder.innerText = L10n.get(\"savesExportReminder\");\n\t\t\t\tlist.appendChild(exportReminder);\n\n\t\t\t\t// extra saves warning\n\t\t\t\tif (extraSaveWarn) {\n\t\t\t\t\tconst lostSaves = document.createElement(\"p\");\n\t\t\t\t\tlostSaves.innerHTML = \"<i class=\\\"description\\\"><u>Where are my saves?</u></i> \";\n\t\t\t\t\tconst lostSavesTooltip = document.createElement(\"mouse\");\n\t\t\t\t\tlostSavesTooltip.classList.add(\"tooltip\", \"linkBlue\");\n\t\t\t\t\tlostSavesTooltip.innerText = \"(?)\";\n\t\t\t\t\tlostSavesTooltip.appendChild(document.createElement(\"span\"));\n\t\t\t\t\tlostSavesTooltip.lastChild.innerText = \"If you can't find your saves, it's possible you saved them using a different storage method. Try toggling the \\\"Use old legacy storage\\\" option below the saves list.\";\n\t\t\t\t\tlostSaves.appendChild(lostSavesTooltip);\n\t\t\t\t\tlist.appendChild(lostSaves);\n\t\t\t\t}\n\n\t\t\t\t// THE SAVES LIST\n\t\t\t\tlist.appendChild(generateSavesPage());\n\n\t\t\t\t// button row\n\t\t\t\tlist.appendChild(generateFooterRow());\n\n\t\t\t\t// add pager\n\t\t\t\tlist.appendChild(generatePager());\n\n\t\t\t\t// add confirmation toggles\n\t\t\t\tlet ul = document.createElement(\"ul\");\n\t\t\t\tul.className = \"buttons\";\n\t\t\t\tlet li;\n\t\t\t\tli = document.createElement(\"li\");\n\t\t\t\tli.append(L10n.get(\"savesOptionsConfirmOn\"));\n\t\t\t\tul.appendChild(li);\n\n\t\t\t\tconst reqSaveLabel = document.createElement(\"label\");\n\t\t\t\treqSaveLabel.innerText = L10n.get(\"savesOptionsOverwrite\");\n\t\t\t\tconst reqSave = document.createElement(\"input\");\n\t\t\t\treqSave.type = \"checkbox\";\n\t\t\t\treqSave.checked = settings.warnSave;\n\t\t\t\treqSave.onchange = () => updateSettings(\"warnSave\", reqSave.checked);\n\t\t\t\treqSaveLabel.appendChild(reqSave);\n\t\t\t\tli = document.createElement(\"li\");\n\t\t\t\tli.appendChild(reqSaveLabel);\n\t\t\t\tul.appendChild(li);\n\n\t\t\t\tconst reqLoadLabel = document.createElement(\"label\");\n\t\t\t\treqLoadLabel.innerText = L10n.get(\"savesLabelLoad\");\n\t\t\t\tconst reqLoad = document.createElement(\"input\");\n\t\t\t\treqLoad.type = \"checkbox\";\n\t\t\t\treqLoad.checked = settings.warnLoad;\n\t\t\t\treqLoad.onchange = () => updateSettings(\"warnLoad\", reqLoad.checked);\n\t\t\t\treqLoadLabel.appendChild(reqLoad);\n\t\t\t\tli = document.createElement(\"li\");\n\t\t\t\tli.appendChild(reqLoadLabel);\n\t\t\t\tul.append(\"|\", li);\n\n\t\t\t\tconst reqDeleteLabel = document.createElement(\"label\");\n\t\t\t\treqDeleteLabel.innerText = L10n.get(\"savesLabelDelete\");\n\t\t\t\tconst reqDelete = document.createElement(\"input\");\n\t\t\t\treqDelete.type = \"checkbox\";\n\t\t\t\treqDelete.checked = settings.warnDelete;\n\t\t\t\treqDelete.onchange = () => updateSettings(\"warnDelete\", reqDelete.checked);\n\t\t\t\treqDeleteLabel.appendChild(reqDelete);\n\t\t\t\tli = document.createElement(\"li\");\n\t\t\t\tli.appendChild(reqDeleteLabel);\n\t\t\t\tul.append(\"|\", li);\n\n\t\t\t\t// last element gets floated to the right. empty one doesn't matter\n\t\t\t\tul.append(document.createElement(\"li\"));\n\n\t\t\t\tlist.append(ul);\n\n\t\t\t\t// add instant idb switcher\n\t\t\t\tul = document.createElement(\"ul\");\n\t\t\t\tul.className = \"buttons\";\n\t\t\t\tconst idbtoggle = document.createElement(\"button\");\n\t\t\t\tidbtoggle.id = \"saves-idb-toggle\";\n\t\t\t\tidbtoggle.className = \"saveMenuButton\";\n\t\t\t\tidbtoggle.innerText = L10n.get(\"savesOptionsUseLegacy\");\n\t\t\t\tidbtoggle.onclick = () => {\n\t\t\t\t\tupdateSettings(\"active\", false);\n\t\t\t\t\tif (window.DoLSave)\t$.wiki(\"<<replace #saveList>><<saveList>><</replace>>\");\n\t\t\t\t\telse UI.buildSaves();\n\t\t\t\t};\n\t\t\t\tli = document.createElement(\"li\");\n\t\t\t\tli.appendChild(idbtoggle);\n\t\t\t\tul.appendChild(li);\n\t\t\t\tlist.appendChild(ul);\n\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tif (replaceChildren) savesDiv.replaceChildren(list);\n\t\t\t\t\telse { // curse you, itch app!\n\t\t\t\t\t\tsavesDiv.innerHTML = \"\";\n\t\t\t\t\t\tsavesDiv.appendChild(list);\n\t\t\t\t\t}\n\t\t\t\t\tconst pageField = document.getElementById(\"pageNum\");\n\t\t\t\t\tif (pageField != null) pageField.value = listPage;\n\t\t\t\t\tconst lengthField = document.getElementById(\"pageLen\");\n\t\t\t\t\tif (lengthField != null) lengthField.value = listLength;\n\t\t\t\t\tDialog.resize(); // fix dialog size\n\t\t\t\t}, Engine.minDomActionDelay);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"confirm save\": {\n\t\t\t\t// skip confirmation if the slot is empty, but do not skip on saveId mismatch, even if confirmation is not required\n\t\t\t\tif (!details.date || !settings.warnSave && details.metadata.saveId === V.saveId) return saveState(details.slot).then(window.closeOverlay());\n\t\t\t\tconst confirmSaveWarning = document.createElement(\"div\");\n\t\t\t\tconfirmSaveWarning.className = \"saveBorder\";\n\n\t\t\t\tconst confirmSaveWarningTitle = document.createElement(\"h3\");\n\t\t\t\tconfirmSaveWarningTitle.className = \"red\";\n\t\t\t\tconfirmSaveWarningTitle.innerText = `${details.date === \"\" ? L10n.get(\"savesWarningSaveOnSlot\") : L10n.get(\"savesWarningOverwriteSlot\")} ${details.slot}?`;\n\n\t\t\t\tif (details.date && V.saveId !== details.metadata.saveId) {\n\t\t\t\t\tconst overwriteWarning = document.createElement(\"span\");\n\t\t\t\t\toverwriteWarning.className = \"red\";\n\t\t\t\t\toverwriteWarning.innerText = L10n.get(\"savesWarningOverwriteID\");\n\t\t\t\t}\n\n\t\t\t\tconst saveButton = document.createElement(\"input\");\n\t\t\t\tObject.assign(saveButton, {\n\t\t\t\t\ttype: \"button\",\n\t\t\t\t\tclassName: \"saveMenuButton saveMenuConfirm\",\n\t\t\t\t\tvalue: L10n.get(\"savesLabelSave\"),\n\t\t\t\t\tonclick: () => saveState(details.slot).then(() => window.closeOverlay()),\n\t\t\t\t});\n\t\t\t\tconfirmSaveWarning.append(confirmSaveWarningTitle, generateOldSaveDescription(details), saveButton, cancelButton);\n\n\t\t\t\tlist.appendChild(confirmSaveWarning);\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tif (replaceChildren) savesDiv.replaceChildren(list);\n\t\t\t\t\telse { // curse you, itch app!\n\t\t\t\t\t\tsavesDiv.innerHTML = \"\";\n\t\t\t\t\t\tsavesDiv.appendChild(list);\n\t\t\t\t\t}\n\t\t\t\t}, Engine.minDomActionDelay);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"confirm delete\": {\n\t\t\t\t// skip confirmation if corresponding toggle is off\n\t\t\t\tif (!settings.warnDelete) return deleteItem(details.slot).then(() => saveList(\"show saves\"));\n\t\t\t\tconst confirmDeleteWarning = document.createElement(\"div\");\n\t\t\t\tconfirmDeleteWarning.className = \"saveBorder\";\n\t\t\t\tconst confirmDeleteWarningTitle = document.createElement(\"h3\");\n\t\t\t\tconfirmDeleteWarningTitle.className = \"red\";\n\t\t\t\tconfirmDeleteWarningTitle.innerText = `${L10n.get(\"savesWarningDeleteInSlot\") + (details.slot === 0 ? \"auto\" : details.slot)}?`;\n\n\t\t\t\tconst deleteButton = document.createElement(\"input\");\n\t\t\t\tObject.assign(deleteButton, {\n\t\t\t\t\ttype: \"button\",\n\t\t\t\t\tclassName: \"saveMenuButton saveMenuConfirm\",\n\t\t\t\t\tvalue: L10n.get(\"savesLabelDelete\"),\n\t\t\t\t\tonclick: () => deleteItem(details.slot).then(() => saveList(\"show saves\")),\n\t\t\t\t});\n\n\t\t\t\tconfirmDeleteWarning.append(confirmDeleteWarningTitle, generateOldSaveDescription(details), deleteButton, cancelButton);\n\n\t\t\t\tlist.appendChild(confirmDeleteWarning);\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tif (replaceChildren) savesDiv.replaceChildren(list);\n\t\t\t\t\telse { // curse you, itch app!\n\t\t\t\t\t\tsavesDiv.innerHTML = \"\";\n\t\t\t\t\t\tsavesDiv.appendChild(list);\n\t\t\t\t\t}\n\t\t\t\t}, Engine.minDomActionDelay);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"confirm load\": {\n\t\t\t\t// skip confirmation if corresponding toggle is off\n\t\t\t\tif (!settings.warnLoad) return loadState(details.slot).then(() => window.closeOverlay());\n\t\t\t\tconst confirmLoad = document.createElement(\"div\");\n\t\t\t\tconfirmLoad.className = \"saveBorder\";\n\t\t\t\tconst confirmLoadTitle = document.createElement(\"h3\");\n\t\t\t\tconfirmLoadTitle.className = \"red\";\n\t\t\t\tconfirmLoadTitle.innerText = `${L10n.get(\"savesWarningLoad\") + (details.slot === 0 ? \"auto\" : details.slot)}?`;\n\n\t\t\t\tconst loadButton = document.createElement(\"input\");\n\t\t\t\tObject.assign(loadButton, {\n\t\t\t\t\ttype: \"button\",\n\t\t\t\t\tclassName: \"saveMenuButton saveMenuConfirm\",\n\t\t\t\t\tvalue: L10n.get(\"savesLabelLoad\"),\n\t\t\t\t\tonclick: () => idb.loadState(details.slot).then(() => window.closeOverlay()),\n\t\t\t\t});\n\t\t\t\tconfirmLoad.append(confirmLoadTitle, generateOldSaveDescription(details), loadButton, cancelButton);\n\n\t\t\t\tlist.appendChild(confirmLoad);\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tif (replaceChildren) savesDiv.replaceChildren(list);\n\t\t\t\t\telse { // curse you, itch app!\n\t\t\t\t\t\tsavesDiv.innerHTML = \"\";\n\t\t\t\t\t\tsavesDiv.appendChild(list);\n\t\t\t\t\t}\n\t\t\t\t}, Engine.minDomActionDelay);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"confirm clear\": {\n\t\t\t\t// storage wipes always require confirmation\n\t\t\t\tconst confirmClear = document.createElement(\"div\");\n\t\t\t\tconfirmClear.className = \"saveBorder\";\n\t\t\t\tconst confirmClearTitle = document.createElement(\"h2\");\n\t\t\t\tconfirmClearTitle.className = \"red\";\n\t\t\t\tconfirmClearTitle.innerText = L10n.get(\"savesWarningDeleteAll\");\n\n\t\t\t\tconst clearButton = document.createElement(\"input\");\n\t\t\t\tObject.assign(clearButton, {\n\t\t\t\t\ttype: \"button\",\n\t\t\t\t\tclassName: \"saveMenuButton saveMenuConfirm\",\n\t\t\t\t\tvalue: L10n.get(\"savesLabelClear\"),\n\t\t\t\t\tonclick: () => clearAll().then(() => saveList(\"show saves\")),\n\t\t\t\t});\n\t\t\t\tconfirmClear.append(confirmClearTitle, clearButton, cancelButton);\n\n\t\t\t\tlist.appendChild(confirmClear);\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tif (replaceChildren) savesDiv.replaceChildren(list);\n\t\t\t\t\telse { // curse you, itch app!\n\t\t\t\t\t\tsavesDiv.innerHTML = \"\";\n\t\t\t\t\t\tsavesDiv.appendChild(list);\n\t\t\t\t\t}\n\t\t\t\t}, Engine.minDomActionDelay);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * test function for closing the db\n\t */\n\tfunction close() {\n\t\tdb.close();\n\t\topen = false;\n\t}\n\n\treturn Object.freeze({\n\t\tget dbName() {\n\t\t\treturn dbName;\n\t\t},\n\t\tset dbName(val) {\n\t\t\tdbName = val;\n\t\t},\n\t\tget lock() {\n\t\t\treturn lock;\n\t\t},\n\t\tset lock(val) {\n\t\t\tlock = Boolean(val);\n\t\t},\n\t\tget active() {\n\t\t\treturn active;\n\t\t},\n\t\tset active(val) {\n\t\t\tactive = val;\n\t\t},\n\t\tget listLength() {\n\t\t\treturn listLength;\n\t\t},\n\t\tset listLength(val) {\n\t\t\tlistLength = val;\n\t\t},\n\t\tget listPage() {\n\t\t\treturn listPage;\n\t\t},\n\t\tset listPage(val) {\n\t\t\tlistPage = val;\n\t\t},\n\t\tgetItem,\n\t\tsetItem,\n\t\tdeleteItem,\n\t\tclearAll,\n\t\tgetSaveDetails,\n\t\tgetAllSaves,\n\t\tsaveState,\n\t\tloadState,\n\t\timportFromLocalStorage,\n\t\tsaveList,\n\t\tget footerHTML() {\n\t\t\treturn footerHTML;\n\t\t},\n\t\tset footerHTML(val) {\n\t\t\treturn footerHTML = val;\n\t\t},\n\t\tinit(dbName) {\n\t\t\treturn openDB(dbName);\n\t\t},\n\t\tclose,\n\t\tupdateSettings,\n\t\tbaddies,\n\t\tfunNuke,\n\t\tekuNnuf,\n\t});\n})();\nwindow.idb = idb;\n\n/* eslint no-undef: \"off\", no-param-reassign: \"off\", no-alert: \"off\", no-fallthrough: \"off\", no-dupe-args: \"warn\", no-irregular-whitespace: \"warn\", max-len: \"off\", key-spacing: [\"warn\", {beforeColon: false, afterColon: true}], comma-dangle: [\"warn\", \"always-multiline\"], quotes: [\"warn\", \"double\"], indent: [\"warn\", \"tab\", {SwitchCase: 1}], id-length: \"off\", prefer-template: \"off\", brace-style: [\"warn\", \"1tbs\"] */\n/**\n * hotkeys support for links and buttons\n */\n\nconst Links = (() => {\n\t\"use strict\";\n\n\tlet currentLinks = [];\n\tlet numberPrepend = \"(\";\n\tlet numberAppend = \") \";\n\tlet enabled = true;\n\tlet disableNumbers = false;\n\tlet disableRNGReload = false;\n\tlet keyNumberMatcher;\n\tlet maxKeyDescLength;\n\tlet throttle = false;\n\tlet shiftDown = false;\n\tlet skipElements = \".no-numberify, .no-numberify *\"; // here, we match class \"no-numberify\", and then also all it's children\n\tlet includeElements = \"\"; // here, we can set up a matcher for exceptions that shouldn't be skipped\n\n\tfunction keyNumberMatcherUpdate() {\n\t\tkeyNumberMatcher = new RegExp(RegExp.escape(numberPrepend) + \"((Ctrl|Alt|Shift) \\\\+ )?\\\\d\" + RegExp.escape(numberAppend));\n\t\t// limit the search to as little characters from the start of the line as possible to eliminate or at least reduce false-positives with custom append/prepend values\n\t\tmaxKeyDescLength = numberAppend.length + numberPrepend.length + 9;\n\t}\n\tkeyNumberMatcherUpdate();\n\n\tfunction getPrettyKeyNumber(counter) {\n\t\tlet str = \"\";\n\n\t\tswitch (Math.floor((counter - 1) / 10)) { // 10 should be counted as 0\n\t\t\tcase 3: str = \"Alt + \"; break;\n\t\t\tcase 2: str = \"Ctrl + \"; break;\n\t\t\tcase 1: str = \"Shift + \"; break;\n\t\t}\n\t\tstr += (counter % 10).toString();\n\n\t\treturn str;\n\t}\n\n\tfunction generateLinkNumbers(content, visibility) {\n\t\tif (!enabled || disableNumbers || V.options && !V.options.numberify_enabled) return;\n\n\t\t// don't run this too often. ward off the worst outcomes of bad programming that would trigger massive <<replace>> spam\n\t\tconst stamp = performance.now();\n\t\tif (throttle + 100 > stamp) {\n\t\t\tthrottle = stamp;\n\t\t\tgenerateDebounce();\n\t\t\treturn;\n\t\t}\n\t\tthrottle = stamp;\n\n\t\t// find all visible .link-internal elements, then remove from them all skipElements unless they are also in includeElements\n\t\tif (visibility) {\n\t\t\t// using :hidden pseudo-class is preferred for telling actual visibility of the link, but it's not available at the passagerender time\n\t\t\tcurrentLinks = $(content).find(\".link-internal\").not(\":hidden\");\n\t\t} else {\n\t\t\tcurrentLinks = $(content).find(\".link-internal\").filter((i, link) => getComputedStyle(link).display !== \"none\");\n\t\t}\n\t\tif (skipElements && includeElements) {\n\t\t\tconst goodies = $(content).find(includeElements);\n\t\t\tconst baddies = $(content).find(skipElements).not(goodies);\n\t\t\tcurrentLinks = currentLinks.not(baddies);\n\t\t} else if (skipElements) {\n\t\t\tconst baddies = $(content).find(skipElements);\n\t\t\tcurrentLinks = currentLinks.not(baddies);\n\t\t}\n\n\t\tfor (let i = 0; i < Math.min(currentLinks.length, 40); i++) {\n\t\t\tconst el = currentLinks[i];\n\t\t\tconst keyNumber = numberPrepend + getPrettyKeyNumber(i + 1) + numberAppend;\n\t\t\tif (keyNumberMatcher.test(el.innerHTML.slice(0, maxKeyDescLength))) {\n\t\t\t\t// replace previously assigned number\n\t\t\t\tel.innerHTML = el.innerHTML.replace(keyNumberMatcher, keyNumber);\n\t\t\t} else {\n\t\t\t\tel.prepend(keyNumber);\n\t\t\t}\n\t\t}\n\t\tif (enabled === \"debug\") console.log(`Links: generated ${currentLinks.length} links, took ${performance.now() - stamp}ms\"`);\n\t}\n\n\t// this is a mostly user-triggered function that is almost guaranteed to have the passage already rendered\n\tfunction generate() {\n\t\treturn generateLinkNumbers(document.getElementsByClassName(\"passage\")[0] || document, true);\n\t}\n\t// and this is our bouncer that we employ to prevent unwanted spam\n\tconst generateDebounce = $.debounce(200, generate);\n\n\tfunction linkFollow(index) {\n\t\tif (disableNumbers) return;\n\t\tif ($(currentLinks).length >= index) $(currentLinks[index - 1].click());\n\t}\n\n\tfunction inputFocused() {\n\t\tif ([\"INPUT\", \"TEXTAREA\"].includes(document.activeElement.tagName) && ![\"radio\", \"button\", \"checkbox\", \"submit\", \"reset\", \"image\"].includes(document.activeElement.type)) return true;\n\t\treturn false;\n\t}\n\n\tfunction init() {\n\t\t// collect all links and assign their numbers\n\t\t$(document).on(\":passagerender\", ev => {\n\t\t\tcurrentLinks = [];\n\t\t\tthrottle = 0;\n\t\t\tgenerateLinkNumbers(ev.content);\n\t\t});\n\n\t\t// prevent numpad keys from triggering browser's default shortcuts\n\t\t$(document).on(\"keydown\", ev => {\n\t\t\tif (ev.code.startsWith(\"Shift\")) return shiftDown = true;\n\t\t\tif (inputFocused()) return;\n\t\t\tif (ev.code.startsWith(\"Numpad\")) ev.preventDefault();\n\t\t});\n\n\t\t// assign shortcuts\n\t\t$(document).on(\"keyup\", ev => {\n\t\t\tif (ev.code.startsWith(\"Shift\")) return shiftDown = false;\n\t\t\tif (!enabled || V.tempDisable || V.options && !V.options.numberify_enabled || inputFocused()) return;\n\t\t\tif (document.activeElement.tagName === \"INPUT\" && document.activeElement.type !== \"radio\" && document.activeElement.type !== \"checkbox\") return;\n\n\t\t\tlet offset = 0;\n\t\t\tif (ev.shiftKey) offset = 10;\n\t\t\telse if (ev.code.startsWith(\"Numpad\") && shiftDown) offset = 10; // windows must die\n\t\t\telse if (ev.ctrlKey) offset = 20;\n\t\t\telse if (ev.altKey) offset = 30;\n\n\t\t\tswitch (ev.code) {\n\t\t\t\tcase \"Digit1\": case \"Numpad1\": case \"KeyN\":\n\t\t\t\t\tlinkFollow(offset + 1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"Digit2\": case \"Numpad2\":\n\t\t\t\t\tlinkFollow(offset + 2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"Digit3\": case \"Numpad3\":\n\t\t\t\t\tlinkFollow(offset + 3);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"Digit4\": case \"Numpad4\":\n\t\t\t\t\tlinkFollow(offset + 4);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"Digit5\": case \"Numpad5\":\n\t\t\t\t\tlinkFollow(offset + 5);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"Digit6\": case \"Numpad6\":\n\t\t\t\t\tlinkFollow(offset + 6);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"Digit7\": case \"Numpad7\":\n\t\t\t\t\tlinkFollow(offset + 7);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"Digit8\": case \"Numpad8\":\n\t\t\t\t\tlinkFollow(offset + 8);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"Digit9\": case \"Numpad9\":\n\t\t\t\t\tlinkFollow(offset + 9);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"Digit0\": case \"Numpad0\":\n\t\t\t\t\tlinkFollow(offset + 10);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"NumpadDivide\":\n\t\t\t\t\t// go back in history, twice if shift is pressed\n\t\t\t\t\tif (ev.shiftKey) Engine.go(-2);\n\t\t\t\t\telse Engine.backward();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"NumpadMultiply\":\n\t\t\t\t\t// reload current page with different rng\n\t\t\t\t\tif (disableRNGReload) break; // let game devs disable potentially cheaty option\n\t\t\t\t\tState.restore(true);\n\t\t\t\t\t// State.unmarshalForSave(State.marshalForSave()); // save and immediately reload current state\n\t\t\t\t\tif (State.prng.isEnabled()) { // hack for predictable rng\n\t\t\t\t\t\tState.random(); // update rng pool\n\t\t\t\t\t\tconst frame = State.history[State.activeIndex]; // active history frame\n\t\t\t\t\t\tframe.pull = State.prng.pull; // update pull\n\t\t\t\t\t}\n\t\t\t\t\tEngine.show();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"NumpadSubtract\":\n\t\t\t\t\t// go forward in history\n\t\t\t\t\tif (ev.shiftKey) Engine.go(2);\n\t\t\t\t\telse Engine.forward();\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t});\n\t}\n\n\treturn Object.freeze(Object.defineProperties({}, {\n\t\tinit: { value: init },\n\t\tgenerate: { value: generate },\n\t\tgenerateLinkNumbers: { value: generateLinkNumbers },\n\t\tpushTheButton:       { value: linkFollow },\n\t\tnumberPrepend:       { get() { return numberPrepend;    }, set(val) { numberPrepend = val; keyNumberMatcherUpdate(); } },\n\t\tnumberAppend:        { get() { return numberAppend;     }, set(val) { numberAppend = val; keyNumberMatcherUpdate(); } },\n\t\tskipElements:        { get() { return skipElements;     }, set(val) { skipElements = val; } },\n\t\tincludeElements:     { get() { return includeElements;  }, set(val) { includeElements = val; } },\n\t\tenabled:             { get() { return enabled;          }, set(val) { enabled = val; } },\n\t\tdisableRNGReload:    { get() { return disableRNGReload; }, set(val) { disableRNGReload = val; } },\n\t\tdisableNumbers:      { get() { return disableNumbers;   }, set(val) { disableNumbers = val; } },\n\t\tthrottle:            { get() { return throttle;         }, set(val) { throttle = val; } },\n\t\tcurrentLinks:        { get() { return currentLinks;     } },\n\t}));\n})();\nwindow.Links = Links;\n\n/***********************************************************************************************************************\n\n\tsugarcube.js\n\n\tCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.\n\tUse of this source code is governed by a BSD 2-clause \"Simplified\" License, which may be found in the LICENSE file.\n\n***********************************************************************************************************************/\n/*\n\tglobal Alert, Browser, Config, Dialog, Engine, Fullscreen, Has, LoadScreen, SimpleStore, L10n, Macro, Passage,\n\t       Save, Scripting, Setting, SimpleAudio, State, Story, UI, UIBar, DebugBar, Util, Visibility, Wikifier\n\t, Links, idb\n*/\n/* eslint-disable no-var */\n\n/*\n\tVersion object.\n*/\nvar version = Object.freeze({\n\ttitle      : 'SugarCube',\n\tmajor      : 2,\n\tminor      : 36,\n\tpatch      : 1,\n\tprerelease : null,\n\tbuild      : 743,\n\tdate       : new Date(\"2024-07-09T16:34:39.044Z\"),\n\t/* legacy */\n\textensions : {},\n\t/* /legacy */\n\n\ttoString() {\n\t\t'use strict';\n\n\t\tconst prerelease = this.prerelease ? `-${this.prerelease}` : '';\n\t\treturn `${this.major}.${this.minor}.${this.patch}${prerelease}+${this.build}`;\n\t},\n\n\tshort() {\n\t\t'use strict';\n\n\t\tconst prerelease = this.prerelease ? `-${this.prerelease}` : '';\n\t\treturn `${this.title} (v${this.major}.${this.minor}.${this.patch}${prerelease})`;\n\t},\n\n\tlong() {\n\t\t'use strict';\n\n\t\treturn `${this.title} v${this.toString()} (${this.date.toUTCString()})`;\n\t}\n});\n\n/* eslint-disable no-unused-vars */\n/*\n\tInternal variables.\n*/\n// Temporary state object.\nvar TempState = {};\n\n// Legacy macros object.\nvar macros = {};\n\n// Post-display task callbacks object.\nvar postdisplay = {};\n\n// Post-render task callbacks object.\nvar postrender = {};\n\n// Pre-display task callbacks object.\nvar predisplay = {};\n\n// Pre-history task callbacks object.\nvar prehistory = {};\n\n// Pre-render task callbacks object.\nvar prerender = {};\n\n// Session storage manager object.\nvar session = null;\n\n// Settings object.\nvar settings = {};\n\n// Setup object.\nvar setup = {};\n\n// Persistant storage manager object.\nvar storage = null;\n\n/*\n\tLegacy aliases.\n*/\nvar browser       = Browser;\nvar config        = Config;\nvar has           = Has;\nvar History       = State;\nvar state         = State;\nvar tale          = Story;\nvar TempVariables = State.temporary;\n/* eslint-enable no-unused-vars */\n\n/*\n\tGlobal `SugarCube` object.  Allows scripts to detect if they're running in SugarCube by\n\ttesting for the object (e.g. `\"SugarCube\" in window`) and contains exported identifiers\n\tfor debugging purposes.\n*/\nwindow.SugarCube = {};\n\n/*\n\tMain function, entry point for the story.\n*/\njQuery(() => {\n\t'use strict';\n\n\tif (DEBUG) { console.log('[SugarCube/main()] Document loaded; beginning startup.'); }\n\n\t/*\n\t\tWARNING!\n\n\t\tThe ordering of the code within this function is critically important,\n\t\tso be careful when mucking around with it.\n\t*/\n\ttry {\n\t\t// Acquire an initial lock for and initialize the loading screen.\n\t\tconst lockId = LoadScreen.lock();\n\t\tLoadScreen.init();\n\n\t\t// Normalize the document.\n\t\tif (document.normalize) {\n\t\t\tdocument.normalize();\n\t\t}\n\n\t\t// Load the story data (must be done before most anything else).\n\t\tStory.load();\n\n\t\t// Instantiate the storage and session objects.\n\t\t// NOTE: `SimpleStore.create(storageId, persistent)`\n\t\tstorage = SimpleStore.create(Story.domId, true);\n\t\tsession = SimpleStore.create(Story.domId, false);\n\n\t\t// Initialize the user interface (must be done before story initialization, specifically before scripts).\n\t\tDialog.init();\n\t\tUIBar.init();\n\t\tEngine.init();\n\n\t\t// Initialize the story (largely load the user styles, scripts, and widgets).\n\t\tStory.init();\n\n\t\t// Initialize the localization (must be done after story initialization).\n\t\tL10n.init();\n\n\t\t// Alert when the browser is degrading required capabilities (must be done after localization initialization).\n\t\tif (!session.has('rcWarn') && storage.name === 'cookie') {\n\t\t\t/* eslint-disable no-alert */\n\t\t\tsession.set('rcWarn', 1);\n\t\t\twindow.alert(L10n.get('warningNoWebStorage'));\n\t\t\t/* eslint-enable no-alert */\n\t\t}\n\n\t\t// Initialize the saves (must be done after story initialization, but before engine start).\n\t\tSave.init();\n\n\t\t// Initialize the settings.\n\t\tSetting.init();\n\n\t\t// Initialize indexedDB\n\t\tidb.init(Story.domId);\n\n\t\t// Initialize hotkeys\n\t\tLinks.init();\n\n\t\t// Initialize the macros.\n\t\tMacro.init();\n\n\t\t// Start the engine (should be done as late as possible, but before interface startup).\n\t\tEngine.start();\n\n\t\t// Initialize the debug bar interface (should be done as late as possible, but before interface startup).\n\t\tif (Config.debug) {\n\t\t\tDebugBar.init();\n\t\t}\n\n\t\t// Set a recurring timer to start the interfaces (necessary due to DOM readiness issues in some browsers).\n\t\tconst $window    = $(window);\n\t\tconst vprCheckId = setInterval(() => {\n\t\t\t// If `$window.width()` returns a zero value, bail out and wait.\n\t\t\tif (!$window.width()) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Clear the recurring timer.\n\t\t\tclearInterval(vprCheckId);\n\n\t\t\t// Start the UI bar interface.\n\t\t\tUIBar.start();\n\n\t\t\t// Start the debug bar interface.\n\t\t\tif (Config.debug) {\n\t\t\t\tDebugBar.start();\n\t\t\t}\n\n\t\t\t// Trigger the `:storyready` global synthetic event.\n\t\t\tjQuery.event.trigger({ type : ':storyready' });\n\n\t\t\t// Release the loading screen lock after a short delay.\n\t\t\tsetTimeout(() => LoadScreen.unlock(lockId), Engine.minDomActionDelay * 2);\n\t\t}, Engine.minDomActionDelay);\n\n\t\t// Finally, export identifiers for debugging purposes.\n\t\tObject.defineProperty(window, 'SugarCube', {\n\t\t\t// WARNING: We need to assign new values at points, so seal it, do not freeze it.\n\t\t\tvalue : Object.seal(Object.assign(Object.create(null), {\n\t\t\t\tBrowser,\n\t\t\t\tConfig,\n\t\t\t\tDialog,\n\t\t\t\tEngine,\n\t\t\t\tFullscreen,\n\t\t\t\tHas,\n\t\t\t\tL10n,\n\t\t\t\tMacro,\n\t\t\t\tPassage,\n\t\t\t\tSave,\n\t\t\t\tScripting,\n\t\t\t\tSetting,\n\t\t\t\tSimpleAudio,\n\t\t\t\tState,\n\t\t\t\tStory,\n\t\t\t\tUI,\n\t\t\t\tUIBar,\n\t\t\t\tDebugBar,\n\t\t\t\tUtil,\n\t\t\t\tVisibility,\n\t\t\t\tWikifier,\n\t\t\t\tsession,\n\t\t\t\tsettings,\n\t\t\t\tsetup,\n\t\t\t\tstorage,\n\t\t\t\tversion\n\t\t\t}))\n\t\t});\n\n\t\tif (DEBUG) { console.log('[SugarCube/main()] Startup complete; story ready.'); }\n\t}\n\tcatch (ex) {\n\t\tconsole.error(ex);\n\t\tLoadScreen.clear();\n\t\treturn Alert.fatal(null, ex.message, ex);\n\t}\n});\n\n})(window, window.document, jQuery);\n}\n\t</script>\n</body>\n</html>\n"});
\ No newline at end of file
+window.storyFormat({"name":"SugarCube","version":"2.36.1","description":"A full featured, highly customizable story format.  See its <a href=\"http://www.motoslave.net/sugarcube/2/#documentation\" target=\"_blank\">documentation</a>.","author":"Thomas Michael Edwards","image":"icon.svg","url":"http://www.motoslave.net/sugarcube/","license":"BSD-2-Clause","proofing":false,"source":"<!DOCTYPE html>\n<html data-init=\"no-js\">\n<head>\n<meta charset=\"UTF-8\" />\n<title>{{STORY_NAME}}</title>\n<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\" />\n<!--\n\nSugarCube (v2.36.1): A free (gratis and libre) story format.\n\nCopyright © 2013–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>.\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\n   list of conditions and the following disclaimer.\n2. Redistributions in binary form must reproduce the above copyright notice,\n   this list of conditions and the following disclaimer in the documentation\n   and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n-->\n<script id=\"script-libraries\" type=\"text/javascript\">\nif(document.head&&document.addEventListener&&document.querySelector&&Object.create&&Object.freeze&&JSON){document.documentElement.setAttribute(\"data-init\", \"loading\");\n/*! @source http://purl.eligrey.com/github/classList.js/blob/1.2.20171210/classList.js */\n\"document\"in self&&(\"classList\"in document.createElement(\"_\")&&(!document.createElementNS||\"classList\"in document.createElementNS(\"http://www.w3.org/2000/svg\",\"g\"))||!function(t){\"use strict\";if(\"Element\"in t){var e=\"classList\",n=\"prototype\",i=t.Element[n],s=Object,r=String[n].trim||function(){return this.replace(/^\\s+|\\s+$/g,\"\")},o=Array[n].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},c=function(t,e){this.name=t,this.code=DOMException[t],this.message=e},a=function(t,e){if(\"\"===e)throw new c(\"SYNTAX_ERR\",\"The token must not be empty.\");if(/\\s/.test(e))throw new c(\"INVALID_CHARACTER_ERR\",\"The token must not contain space characters.\");return o.call(t,e)},l=function(t){for(var e=r.call(t.getAttribute(\"class\")||\"\"),n=e?e.split(/\\s+/):[],i=0,s=n.length;s>i;i++)this.push(n[i]);this._updateClassName=function(){t.setAttribute(\"class\",this.toString())}},u=l[n]=[],h=function(){return new l(this)};if(c[n]=Error[n],u.item=function(t){return this[t]||null},u.contains=function(t){return~a(this,t+\"\")},u.add=function(){var t,e=arguments,n=0,i=e.length,s=!1;do t=e[n]+\"\",~a(this,t)||(this.push(t),s=!0);while(++n<i);s&&this._updateClassName()},u.remove=function(){var t,e,n=arguments,i=0,s=n.length,r=!1;do for(t=n[i]+\"\",e=a(this,t);~e;)this.splice(e,1),r=!0,e=a(this,t);while(++i<s);r&&this._updateClassName()},u.toggle=function(t,e){var n=this.contains(t),i=n?e!==!0&&\"remove\":e!==!1&&\"add\";return i&&this[i](t),e===!0||e===!1?e:!n},u.replace=function(t,e){var n=a(t+\"\");~n&&(this.splice(n,1,e),this._updateClassName())},u.toString=function(){return this.join(\" \")},s.defineProperty){var f={get:h,enumerable:!0,configurable:!0};try{s.defineProperty(i,e,f)}catch(p){void 0!==p.number&&-2146823252!==p.number||(f.enumerable=!1,s.defineProperty(i,e,f))}}else s[n].__defineGetter__&&i.__defineGetter__(e,h)}}(self),function(){\"use strict\";var t=document.createElement(\"_\");if(t.classList.add(\"c1\",\"c2\"),!t.classList.contains(\"c2\")){var e=function(t){var e=DOMTokenList.prototype[t];DOMTokenList.prototype[t]=function(t){var n,i=arguments.length;for(n=0;i>n;n++)t=arguments[n],e.call(this,t)}};e(\"add\"),e(\"remove\")}if(t.classList.toggle(\"c3\",!1),t.classList.contains(\"c3\")){var n=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(t,e){return 1 in arguments&&!this.contains(t)==!e?e:n.call(this,t)}}\"replace\"in document.createElement(\"_\").classList||(DOMTokenList.prototype.replace=function(t,e){var n=this.toString().split(\" \"),i=n.indexOf(t+\"\");~i&&(n=n.slice(i),this.remove.apply(this,n),this.add(e),this.add.apply(this,n.slice(1)))}),t=null}());\n/*! jQuery v3.7.1 | (c) OpenJS Foundation and other contributors | jquery.org/license */\n!function(e,t){\"use strict\";\"object\"==typeof module&&\"object\"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error(\"jQuery requires a window with a document\");return t(e)}:t(e)}(\"undefined\"!=typeof window?window:this,function(ie,e){\"use strict\";var oe=[],r=Object.getPrototypeOf,ae=oe.slice,g=oe.flat?function(e){return oe.flat.call(e)}:function(e){return oe.concat.apply([],e)},s=oe.push,se=oe.indexOf,n={},i=n.toString,ue=n.hasOwnProperty,o=ue.toString,a=o.call(Object),le={},v=function(e){return\"function\"==typeof e&&\"number\"!=typeof e.nodeType&&\"function\"!=typeof e.item},y=function(e){return null!=e&&e===e.window},C=ie.document,u={type:!0,src:!0,nonce:!0,noModule:!0};function m(e,t,n){var r,i,o=(n=n||C).createElement(\"script\");if(o.text=e,t)for(r in u)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+\"\":\"object\"==typeof e||\"function\"==typeof e?n[i.call(e)]||\"object\":typeof e}var t=\"3.7.1\",l=/HTML$/i,ce=function(e,t){return new ce.fn.init(e,t)};function c(e){var t=!!e&&\"length\"in e&&e.length,n=x(e);return!v(e)&&!y(e)&&(\"array\"===n||0===t||\"number\"==typeof t&&0<t&&t-1 in e)}function fe(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}ce.fn=ce.prototype={jquery:t,constructor:ce,length:0,toArray:function(){return ae.call(this)},get:function(e){return null==e?ae.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=ce.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return ce.each(this,e)},map:function(n){return this.pushStack(ce.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(ae.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(ce.grep(this,function(e,t){return(t+1)%2}))},odd:function(){return this.pushStack(ce.grep(this,function(e,t){return t%2}))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(0<=n&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:s,sort:oe.sort,splice:oe.splice},ce.extend=ce.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for(\"boolean\"==typeof a&&(l=a,a=arguments[s]||{},s++),\"object\"==typeof a||v(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)r=e[t],\"__proto__\"!==t&&a!==r&&(l&&r&&(ce.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||ce.isPlainObject(n)?n:{},i=!1,a[t]=ce.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},ce.extend({expando:\"jQuery\"+(t+Math.random()).replace(/\\D/g,\"\"),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||\"[object Object]\"!==i.call(e))&&(!(t=r(e))||\"function\"==typeof(n=ue.call(t,\"constructor\")&&t.constructor)&&o.call(n)===a)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t,n){m(e,{nonce:t&&t.nonce},n)},each:function(e,t){var n,r=0;if(c(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},text:function(e){var t,n=\"\",r=0,i=e.nodeType;if(!i)while(t=e[r++])n+=ce.text(t);return 1===i||11===i?e.textContent:9===i?e.documentElement.textContent:3===i||4===i?e.nodeValue:n},makeArray:function(e,t){var n=t||[];return null!=e&&(c(Object(e))?ce.merge(n,\"string\"==typeof e?[e]:e):s.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:se.call(t,e,n)},isXMLDoc:function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!l.test(t||n&&n.nodeName||\"HTML\")},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,a=!n;i<o;i++)!t(e[i],i)!==a&&r.push(e[i]);return r},map:function(e,t,n){var r,i,o=0,a=[];if(c(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&a.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&a.push(i);return g(a)},guid:1,support:le}),\"function\"==typeof Symbol&&(ce.fn[Symbol.iterator]=oe[Symbol.iterator]),ce.each(\"Boolean Number String Function Array Date RegExp Object Error Symbol\".split(\" \"),function(e,t){n[\"[object \"+t+\"]\"]=t.toLowerCase()});var pe=oe.pop,de=oe.sort,he=oe.splice,ge=\"[\\\\x20\\\\t\\\\r\\\\n\\\\f]\",ve=new RegExp(\"^\"+ge+\"+|((?:^|[^\\\\\\\\])(?:\\\\\\\\.)*)\"+ge+\"+$\",\"g\");ce.contains=function(e,t){var n=t&&t.parentNode;return e===n||!(!n||1!==n.nodeType||!(e.contains?e.contains(n):e.compareDocumentPosition&&16&e.compareDocumentPosition(n)))};var f=/([\\0-\\x1f\\x7f]|^-?\\d)|^-$|[^\\x80-\\uFFFF\\w-]/g;function p(e,t){return t?\"\\0\"===e?\"\\ufffd\":e.slice(0,-1)+\"\\\\\"+e.charCodeAt(e.length-1).toString(16)+\" \":\"\\\\\"+e}ce.escapeSelector=function(e){return(e+\"\").replace(f,p)};var ye=C,me=s;!function(){var e,b,w,o,a,T,r,C,d,i,k=me,S=ce.expando,E=0,n=0,s=W(),c=W(),u=W(),h=W(),l=function(e,t){return e===t&&(a=!0),0},f=\"checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped\",t=\"(?:\\\\\\\\[\\\\da-fA-F]{1,6}\"+ge+\"?|\\\\\\\\[^\\\\r\\\\n\\\\f]|[\\\\w-]|[^\\0-\\\\x7f])+\",p=\"\\\\[\"+ge+\"*(\"+t+\")(?:\"+ge+\"*([*^$|!~]?=)\"+ge+\"*(?:'((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\"|(\"+t+\"))|)\"+ge+\"*\\\\]\",g=\":(\"+t+\")(?:\\\\((('((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\")|((?:\\\\\\\\.|[^\\\\\\\\()[\\\\]]|\"+p+\")*)|.*)\\\\)|)\",v=new RegExp(ge+\"+\",\"g\"),y=new RegExp(\"^\"+ge+\"*,\"+ge+\"*\"),m=new RegExp(\"^\"+ge+\"*([>+~]|\"+ge+\")\"+ge+\"*\"),x=new RegExp(ge+\"|>\"),j=new RegExp(g),A=new RegExp(\"^\"+t+\"$\"),D={ID:new RegExp(\"^#(\"+t+\")\"),CLASS:new RegExp(\"^\\\\.(\"+t+\")\"),TAG:new RegExp(\"^(\"+t+\"|[*])\"),ATTR:new RegExp(\"^\"+p),PSEUDO:new RegExp(\"^\"+g),CHILD:new RegExp(\"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\\\(\"+ge+\"*(even|odd|(([+-]|)(\\\\d*)n|)\"+ge+\"*(?:([+-]|)\"+ge+\"*(\\\\d+)|))\"+ge+\"*\\\\)|)\",\"i\"),bool:new RegExp(\"^(?:\"+f+\")$\",\"i\"),needsContext:new RegExp(\"^\"+ge+\"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\\\(\"+ge+\"*((?:-\\\\d)?\\\\d*)\"+ge+\"*\\\\)|)(?=[^-]|$)\",\"i\")},N=/^(?:input|select|textarea|button)$/i,q=/^h\\d$/i,L=/^(?:#([\\w-]+)|(\\w+)|\\.([\\w-]+))$/,H=/[+~]/,O=new RegExp(\"\\\\\\\\[\\\\da-fA-F]{1,6}\"+ge+\"?|\\\\\\\\([^\\\\r\\\\n\\\\f])\",\"g\"),P=function(e,t){var n=\"0x\"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},M=function(){V()},R=J(function(e){return!0===e.disabled&&fe(e,\"fieldset\")},{dir:\"parentNode\",next:\"legend\"});try{k.apply(oe=ae.call(ye.childNodes),ye.childNodes),oe[ye.childNodes.length].nodeType}catch(e){k={apply:function(e,t){me.apply(e,ae.call(t))},call:function(e){me.apply(e,ae.call(arguments,1))}}}function I(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],\"string\"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(V(e),e=e||T,C)){if(11!==p&&(u=L.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return k.call(n,a),n}else if(f&&(a=f.getElementById(i))&&I.contains(e,a)&&a.id===i)return k.call(n,a),n}else{if(u[2])return k.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&e.getElementsByClassName)return k.apply(n,e.getElementsByClassName(i)),n}if(!(h[t+\" \"]||d&&d.test(t))){if(c=t,f=e,1===p&&(x.test(t)||m.test(t))){(f=H.test(t)&&U(e.parentNode)||e)==e&&le.scope||((s=e.getAttribute(\"id\"))?s=ce.escapeSelector(s):e.setAttribute(\"id\",s=S)),o=(l=Y(t)).length;while(o--)l[o]=(s?\"#\"+s:\":scope\")+\" \"+Q(l[o]);c=l.join(\",\")}try{return k.apply(n,f.querySelectorAll(c)),n}catch(e){h(t,!0)}finally{s===S&&e.removeAttribute(\"id\")}}}return re(t.replace(ve,\"$1\"),e,n,r)}function W(){var r=[];return function e(t,n){return r.push(t+\" \")>b.cacheLength&&delete e[r.shift()],e[t+\" \"]=n}}function F(e){return e[S]=!0,e}function $(e){var t=T.createElement(\"fieldset\");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function B(t){return function(e){return fe(e,\"input\")&&e.type===t}}function _(t){return function(e){return(fe(e,\"input\")||fe(e,\"button\"))&&e.type===t}}function z(t){return function(e){return\"form\"in e?e.parentNode&&!1===e.disabled?\"label\"in e?\"label\"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&R(e)===t:e.disabled===t:\"label\"in e&&e.disabled===t}}function X(a){return F(function(o){return o=+o,F(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function U(e){return e&&\"undefined\"!=typeof e.getElementsByTagName&&e}function V(e){var t,n=e?e.ownerDocument||e:ye;return n!=T&&9===n.nodeType&&n.documentElement&&(r=(T=n).documentElement,C=!ce.isXMLDoc(T),i=r.matches||r.webkitMatchesSelector||r.msMatchesSelector,r.msMatchesSelector&&ye!=T&&(t=T.defaultView)&&t.top!==t&&t.addEventListener(\"unload\",M),le.getById=$(function(e){return r.appendChild(e).id=ce.expando,!T.getElementsByName||!T.getElementsByName(ce.expando).length}),le.disconnectedMatch=$(function(e){return i.call(e,\"*\")}),le.scope=$(function(){return T.querySelectorAll(\":scope\")}),le.cssHas=$(function(){try{return T.querySelector(\":has(*,:jqfake)\"),!1}catch(e){return!0}}),le.getById?(b.filter.ID=function(e){var t=e.replace(O,P);return function(e){return e.getAttribute(\"id\")===t}},b.find.ID=function(e,t){if(\"undefined\"!=typeof t.getElementById&&C){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(O,P);return function(e){var t=\"undefined\"!=typeof e.getAttributeNode&&e.getAttributeNode(\"id\");return t&&t.value===n}},b.find.ID=function(e,t){if(\"undefined\"!=typeof t.getElementById&&C){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode(\"id\"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode(\"id\"))&&n.value===e)return[o]}return[]}}),b.find.TAG=function(e,t){return\"undefined\"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):t.querySelectorAll(e)},b.find.CLASS=function(e,t){if(\"undefined\"!=typeof t.getElementsByClassName&&C)return t.getElementsByClassName(e)},d=[],$(function(e){var t;r.appendChild(e).innerHTML=\"<a id='\"+S+\"' href='' disabled='disabled'></a><select id='\"+S+\"-\\r\\\\' disabled='disabled'><option selected=''></option></select>\",e.querySelectorAll(\"[selected]\").length||d.push(\"\\\\[\"+ge+\"*(?:value|\"+f+\")\"),e.querySelectorAll(\"[id~=\"+S+\"-]\").length||d.push(\"~=\"),e.querySelectorAll(\"a#\"+S+\"+*\").length||d.push(\".#.+[+~]\"),e.querySelectorAll(\":checked\").length||d.push(\":checked\"),(t=T.createElement(\"input\")).setAttribute(\"type\",\"hidden\"),e.appendChild(t).setAttribute(\"name\",\"D\"),r.appendChild(e).disabled=!0,2!==e.querySelectorAll(\":disabled\").length&&d.push(\":enabled\",\":disabled\"),(t=T.createElement(\"input\")).setAttribute(\"name\",\"\"),e.appendChild(t),e.querySelectorAll(\"[name='']\").length||d.push(\"\\\\[\"+ge+\"*name\"+ge+\"*=\"+ge+\"*(?:''|\\\"\\\")\")}),le.cssHas||d.push(\":has\"),d=d.length&&new RegExp(d.join(\"|\")),l=function(e,t){if(e===t)return a=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!le.sortDetached&&t.compareDocumentPosition(e)===n?e===T||e.ownerDocument==ye&&I.contains(ye,e)?-1:t===T||t.ownerDocument==ye&&I.contains(ye,t)?1:o?se.call(o,e)-se.call(o,t):0:4&n?-1:1)}),T}for(e in I.matches=function(e,t){return I(e,null,null,t)},I.matchesSelector=function(e,t){if(V(e),C&&!h[t+\" \"]&&(!d||!d.test(t)))try{var n=i.call(e,t);if(n||le.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){h(t,!0)}return 0<I(t,T,null,[e]).length},I.contains=function(e,t){return(e.ownerDocument||e)!=T&&V(e),ce.contains(e,t)},I.attr=function(e,t){(e.ownerDocument||e)!=T&&V(e);var n=b.attrHandle[t.toLowerCase()],r=n&&ue.call(b.attrHandle,t.toLowerCase())?n(e,t,!C):void 0;return void 0!==r?r:e.getAttribute(t)},I.error=function(e){throw new Error(\"Syntax error, unrecognized expression: \"+e)},ce.uniqueSort=function(e){var t,n=[],r=0,i=0;if(a=!le.sortStable,o=!le.sortStable&&ae.call(e,0),de.call(e,l),a){while(t=e[i++])t===e[i]&&(r=n.push(i));while(r--)he.call(e,n[r],1)}return o=null,e},ce.fn.uniqueSort=function(){return this.pushStack(ce.uniqueSort(ae.apply(this)))},(b=ce.expr={cacheLength:50,createPseudo:F,match:D,attrHandle:{},find:{},relative:{\">\":{dir:\"parentNode\",first:!0},\" \":{dir:\"parentNode\"},\"+\":{dir:\"previousSibling\",first:!0},\"~\":{dir:\"previousSibling\"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(O,P),e[3]=(e[3]||e[4]||e[5]||\"\").replace(O,P),\"~=\"===e[2]&&(e[3]=\" \"+e[3]+\" \"),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),\"nth\"===e[1].slice(0,3)?(e[3]||I.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*(\"even\"===e[3]||\"odd\"===e[3])),e[5]=+(e[7]+e[8]||\"odd\"===e[3])):e[3]&&I.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return D.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||\"\":n&&j.test(n)&&(t=Y(n,!0))&&(t=n.indexOf(\")\",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(O,P).toLowerCase();return\"*\"===e?function(){return!0}:function(e){return fe(e,t)}},CLASS:function(e){var t=s[e+\" \"];return t||(t=new RegExp(\"(^|\"+ge+\")\"+e+\"(\"+ge+\"|$)\"))&&s(e,function(e){return t.test(\"string\"==typeof e.className&&e.className||\"undefined\"!=typeof e.getAttribute&&e.getAttribute(\"class\")||\"\")})},ATTR:function(n,r,i){return function(e){var t=I.attr(e,n);return null==t?\"!=\"===r:!r||(t+=\"\",\"=\"===r?t===i:\"!=\"===r?t!==i:\"^=\"===r?i&&0===t.indexOf(i):\"*=\"===r?i&&-1<t.indexOf(i):\"$=\"===r?i&&t.slice(-i.length)===i:\"~=\"===r?-1<(\" \"+t.replace(v,\" \")+\" \").indexOf(i):\"|=\"===r&&(t===i||t.slice(0,i.length+1)===i+\"-\"))}},CHILD:function(d,e,t,h,g){var v=\"nth\"!==d.slice(0,3),y=\"last\"!==d.slice(-4),m=\"of-type\"===e;return 1===h&&0===g?function(e){return!!e.parentNode}:function(e,t,n){var r,i,o,a,s,u=v!==y?\"nextSibling\":\"previousSibling\",l=e.parentNode,c=m&&e.nodeName.toLowerCase(),f=!n&&!m,p=!1;if(l){if(v){while(u){o=e;while(o=o[u])if(m?fe(o,c):1===o.nodeType)return!1;s=u=\"only\"===d&&!s&&\"nextSibling\"}return!0}if(s=[y?l.firstChild:l.lastChild],y&&f){p=(a=(r=(i=l[S]||(l[S]={}))[d]||[])[0]===E&&r[1])&&r[2],o=a&&l.childNodes[a];while(o=++a&&o&&o[u]||(p=a=0)||s.pop())if(1===o.nodeType&&++p&&o===e){i[d]=[E,a,p];break}}else if(f&&(p=a=(r=(i=e[S]||(e[S]={}))[d]||[])[0]===E&&r[1]),!1===p)while(o=++a&&o&&o[u]||(p=a=0)||s.pop())if((m?fe(o,c):1===o.nodeType)&&++p&&(f&&((i=o[S]||(o[S]={}))[d]=[E,p]),o===e))break;return(p-=g)===h||p%h==0&&0<=p/h}}},PSEUDO:function(e,o){var t,a=b.pseudos[e]||b.setFilters[e.toLowerCase()]||I.error(\"unsupported pseudo: \"+e);return a[S]?a(o):1<a.length?(t=[e,e,\"\",o],b.setFilters.hasOwnProperty(e.toLowerCase())?F(function(e,t){var n,r=a(e,o),i=r.length;while(i--)e[n=se.call(e,r[i])]=!(t[n]=r[i])}):function(e){return a(e,0,t)}):a}},pseudos:{not:F(function(e){var r=[],i=[],s=ne(e.replace(ve,\"$1\"));return s[S]?F(function(e,t,n,r){var i,o=s(e,null,r,[]),a=e.length;while(a--)(i=o[a])&&(e[a]=!(t[a]=i))}):function(e,t,n){return r[0]=e,s(r,null,n,i),r[0]=null,!i.pop()}}),has:F(function(t){return function(e){return 0<I(t,e).length}}),contains:F(function(t){return t=t.replace(O,P),function(e){return-1<(e.textContent||ce.text(e)).indexOf(t)}}),lang:F(function(n){return A.test(n||\"\")||I.error(\"unsupported lang: \"+n),n=n.replace(O,P).toLowerCase(),function(e){var t;do{if(t=C?e.lang:e.getAttribute(\"xml:lang\")||e.getAttribute(\"lang\"))return(t=t.toLowerCase())===n||0===t.indexOf(n+\"-\")}while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var t=ie.location&&ie.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===r},focus:function(e){return e===function(){try{return T.activeElement}catch(e){}}()&&T.hasFocus()&&!!(e.type||e.href||~e.tabIndex)},enabled:z(!1),disabled:z(!0),checked:function(e){return fe(e,\"input\")&&!!e.checked||fe(e,\"option\")&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!b.pseudos.empty(e)},header:function(e){return q.test(e.nodeName)},input:function(e){return N.test(e.nodeName)},button:function(e){return fe(e,\"input\")&&\"button\"===e.type||fe(e,\"button\")},text:function(e){var t;return fe(e,\"input\")&&\"text\"===e.type&&(null==(t=e.getAttribute(\"type\"))||\"text\"===t.toLowerCase())},first:X(function(){return[0]}),last:X(function(e,t){return[t-1]}),eq:X(function(e,t,n){return[n<0?n+t:n]}),even:X(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:X(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:X(function(e,t,n){var r;for(r=n<0?n+t:t<n?t:n;0<=--r;)e.push(r);return e}),gt:X(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=b.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})b.pseudos[e]=B(e);for(e in{submit:!0,reset:!0})b.pseudos[e]=_(e);function G(){}function Y(e,t){var n,r,i,o,a,s,u,l=c[e+\" \"];if(l)return t?0:l.slice(0);a=e,s=[],u=b.preFilter;while(a){for(o in n&&!(r=y.exec(a))||(r&&(a=a.slice(r[0].length)||a),s.push(i=[])),n=!1,(r=m.exec(a))&&(n=r.shift(),i.push({value:n,type:r[0].replace(ve,\" \")}),a=a.slice(n.length)),b.filter)!(r=D[o].exec(a))||u[o]&&!(r=u[o](r))||(n=r.shift(),i.push({value:n,type:o,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?I.error(e):c(e,s).slice(0)}function Q(e){for(var t=0,n=e.length,r=\"\";t<n;t++)r+=e[t].value;return r}function J(a,e,t){var s=e.dir,u=e.next,l=u||s,c=t&&\"parentNode\"===l,f=n++;return e.first?function(e,t,n){while(e=e[s])if(1===e.nodeType||c)return a(e,t,n);return!1}:function(e,t,n){var r,i,o=[E,f];if(n){while(e=e[s])if((1===e.nodeType||c)&&a(e,t,n))return!0}else while(e=e[s])if(1===e.nodeType||c)if(i=e[S]||(e[S]={}),u&&fe(e,u))e=e[s]||e;else{if((r=i[l])&&r[0]===E&&r[1]===f)return o[2]=r[2];if((i[l]=o)[2]=a(e,t,n))return!0}return!1}}function K(i){return 1<i.length?function(e,t,n){var r=i.length;while(r--)if(!i[r](e,t,n))return!1;return!0}:i[0]}function Z(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function ee(d,h,g,v,y,e){return v&&!v[S]&&(v=ee(v)),y&&!y[S]&&(y=ee(y,e)),F(function(e,t,n,r){var i,o,a,s,u=[],l=[],c=t.length,f=e||function(e,t,n){for(var r=0,i=t.length;r<i;r++)I(e,t[r],n);return n}(h||\"*\",n.nodeType?[n]:n,[]),p=!d||!e&&h?f:Z(f,u,d,n,r);if(g?g(p,s=y||(e?d:c||v)?[]:t,n,r):s=p,v){i=Z(s,l),v(i,[],n,r),o=i.length;while(o--)(a=i[o])&&(s[l[o]]=!(p[l[o]]=a))}if(e){if(y||d){if(y){i=[],o=s.length;while(o--)(a=s[o])&&i.push(p[o]=a);y(null,s=[],i,r)}o=s.length;while(o--)(a=s[o])&&-1<(i=y?se.call(e,a):u[o])&&(e[i]=!(t[i]=a))}}else s=Z(s===t?s.splice(c,s.length):s),y?y(null,t,s,r):k.apply(t,s)})}function te(e){for(var i,t,n,r=e.length,o=b.relative[e[0].type],a=o||b.relative[\" \"],s=o?1:0,u=J(function(e){return e===i},a,!0),l=J(function(e){return-1<se.call(i,e)},a,!0),c=[function(e,t,n){var r=!o&&(n||t!=w)||((i=t).nodeType?u(e,t,n):l(e,t,n));return i=null,r}];s<r;s++)if(t=b.relative[e[s].type])c=[J(K(c),t)];else{if((t=b.filter[e[s].type].apply(null,e[s].matches))[S]){for(n=++s;n<r;n++)if(b.relative[e[n].type])break;return ee(1<s&&K(c),1<s&&Q(e.slice(0,s-1).concat({value:\" \"===e[s-2].type?\"*\":\"\"})).replace(ve,\"$1\"),t,s<n&&te(e.slice(s,n)),n<r&&te(e=e.slice(n)),n<r&&Q(e))}c.push(t)}return K(c)}function ne(e,t){var n,v,y,m,x,r,i=[],o=[],a=u[e+\" \"];if(!a){t||(t=Y(e)),n=t.length;while(n--)(a=te(t[n]))[S]?i.push(a):o.push(a);(a=u(e,(v=o,m=0<(y=i).length,x=0<v.length,r=function(e,t,n,r,i){var o,a,s,u=0,l=\"0\",c=e&&[],f=[],p=w,d=e||x&&b.find.TAG(\"*\",i),h=E+=null==p?1:Math.random()||.1,g=d.length;for(i&&(w=t==T||t||i);l!==g&&null!=(o=d[l]);l++){if(x&&o){a=0,t||o.ownerDocument==T||(V(o),n=!C);while(s=v[a++])if(s(o,t||T,n)){k.call(r,o);break}i&&(E=h)}m&&((o=!s&&o)&&u--,e&&c.push(o))}if(u+=l,m&&l!==u){a=0;while(s=y[a++])s(c,f,t,n);if(e){if(0<u)while(l--)c[l]||f[l]||(f[l]=pe.call(r));f=Z(f)}k.apply(r,f),i&&!e&&0<f.length&&1<u+y.length&&ce.uniqueSort(r)}return i&&(E=h,w=p),c},m?F(r):r))).selector=e}return a}function re(e,t,n,r){var i,o,a,s,u,l=\"function\"==typeof e&&e,c=!r&&Y(e=l.selector||e);if(n=n||[],1===c.length){if(2<(o=c[0]=c[0].slice(0)).length&&\"ID\"===(a=o[0]).type&&9===t.nodeType&&C&&b.relative[o[1].type]){if(!(t=(b.find.ID(a.matches[0].replace(O,P),t)||[])[0]))return n;l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}i=D.needsContext.test(e)?0:o.length;while(i--){if(a=o[i],b.relative[s=a.type])break;if((u=b.find[s])&&(r=u(a.matches[0].replace(O,P),H.test(o[0].type)&&U(t.parentNode)||t))){if(o.splice(i,1),!(e=r.length&&Q(o)))return k.apply(n,r),n;break}}}return(l||ne(e,c))(r,t,!C,n,!t||H.test(e)&&U(t.parentNode)||t),n}G.prototype=b.filters=b.pseudos,b.setFilters=new G,le.sortStable=S.split(\"\").sort(l).join(\"\")===S,V(),le.sortDetached=$(function(e){return 1&e.compareDocumentPosition(T.createElement(\"fieldset\"))}),ce.find=I,ce.expr[\":\"]=ce.expr.pseudos,ce.unique=ce.uniqueSort,I.compile=ne,I.select=re,I.setDocument=V,I.tokenize=Y,I.escape=ce.escapeSelector,I.getText=ce.text,I.isXML=ce.isXMLDoc,I.selectors=ce.expr,I.support=ce.support,I.uniqueSort=ce.uniqueSort}();var d=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&ce(e).is(n))break;r.push(e)}return r},h=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},b=ce.expr.match.needsContext,w=/^<([a-z][^\\/\\0>:\\x20\\t\\r\\n\\f]*)[\\x20\\t\\r\\n\\f]*\\/?>(?:<\\/\\1>|)$/i;function T(e,n,r){return v(n)?ce.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?ce.grep(e,function(e){return e===n!==r}):\"string\"!=typeof n?ce.grep(e,function(e){return-1<se.call(n,e)!==r}):ce.filter(n,e,r)}ce.filter=function(e,t,n){var r=t[0];return n&&(e=\":not(\"+e+\")\"),1===t.length&&1===r.nodeType?ce.find.matchesSelector(r,e)?[r]:[]:ce.find.matches(e,ce.grep(t,function(e){return 1===e.nodeType}))},ce.fn.extend({find:function(e){var t,n,r=this.length,i=this;if(\"string\"!=typeof e)return this.pushStack(ce(e).filter(function(){for(t=0;t<r;t++)if(ce.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)ce.find(e,i[t],n);return 1<r?ce.uniqueSort(n):n},filter:function(e){return this.pushStack(T(this,e||[],!1))},not:function(e){return this.pushStack(T(this,e||[],!0))},is:function(e){return!!T(this,\"string\"==typeof e&&b.test(e)?ce(e):e||[],!1).length}});var k,S=/^(?:\\s*(<[\\w\\W]+>)[^>]*|#([\\w-]+))$/;(ce.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||k,\"string\"==typeof e){if(!(r=\"<\"===e[0]&&\">\"===e[e.length-1]&&3<=e.length?[null,e,null]:S.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof ce?t[0]:t,ce.merge(this,ce.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:C,!0)),w.test(r[1])&&ce.isPlainObject(t))for(r in t)v(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=C.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):v(e)?void 0!==n.ready?n.ready(e):e(ce):ce.makeArray(e,this)}).prototype=ce.fn,k=ce(C);var E=/^(?:parents|prev(?:Until|All))/,j={children:!0,contents:!0,next:!0,prev:!0};function A(e,t){while((e=e[t])&&1!==e.nodeType);return e}ce.fn.extend({has:function(e){var t=ce(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(ce.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a=\"string\"!=typeof e&&ce(e);if(!b.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?-1<a.index(n):1===n.nodeType&&ce.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(1<o.length?ce.uniqueSort(o):o)},index:function(e){return e?\"string\"==typeof e?se.call(ce(e),this[0]):se.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(ce.uniqueSort(ce.merge(this.get(),ce(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),ce.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return d(e,\"parentNode\")},parentsUntil:function(e,t,n){return d(e,\"parentNode\",n)},next:function(e){return A(e,\"nextSibling\")},prev:function(e){return A(e,\"previousSibling\")},nextAll:function(e){return d(e,\"nextSibling\")},prevAll:function(e){return d(e,\"previousSibling\")},nextUntil:function(e,t,n){return d(e,\"nextSibling\",n)},prevUntil:function(e,t,n){return d(e,\"previousSibling\",n)},siblings:function(e){return h((e.parentNode||{}).firstChild,e)},children:function(e){return h(e.firstChild)},contents:function(e){return null!=e.contentDocument&&r(e.contentDocument)?e.contentDocument:(fe(e,\"template\")&&(e=e.content||e),ce.merge([],e.childNodes))}},function(r,i){ce.fn[r]=function(e,t){var n=ce.map(this,i,e);return\"Until\"!==r.slice(-5)&&(t=e),t&&\"string\"==typeof t&&(n=ce.filter(t,n)),1<this.length&&(j[r]||ce.uniqueSort(n),E.test(r)&&n.reverse()),this.pushStack(n)}});var D=/[^\\x20\\t\\r\\n\\f]+/g;function N(e){return e}function q(e){throw e}function L(e,t,n,r){var i;try{e&&v(i=e.promise)?i.call(e).done(t).fail(n):e&&v(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}ce.Callbacks=function(r){var e,n;r=\"string\"==typeof r?(e=r,n={},ce.each(e.match(D)||[],function(e,t){n[t]=!0}),n):ce.extend({},r);var i,t,o,a,s=[],u=[],l=-1,c=function(){for(a=a||r.once,o=i=!0;u.length;l=-1){t=u.shift();while(++l<s.length)!1===s[l].apply(t[0],t[1])&&r.stopOnFalse&&(l=s.length,t=!1)}r.memory||(t=!1),i=!1,a&&(s=t?[]:\"\")},f={add:function(){return s&&(t&&!i&&(l=s.length-1,u.push(t)),function n(e){ce.each(e,function(e,t){v(t)?r.unique&&f.has(t)||s.push(t):t&&t.length&&\"string\"!==x(t)&&n(t)})}(arguments),t&&!i&&c()),this},remove:function(){return ce.each(arguments,function(e,t){var n;while(-1<(n=ce.inArray(t,s,n)))s.splice(n,1),n<=l&&l--}),this},has:function(e){return e?-1<ce.inArray(e,s):0<s.length},empty:function(){return s&&(s=[]),this},disable:function(){return a=u=[],s=t=\"\",this},disabled:function(){return!s},lock:function(){return a=u=[],t||i||(s=t=\"\"),this},locked:function(){return!!a},fireWith:function(e,t){return a||(t=[e,(t=t||[]).slice?t.slice():t],u.push(t),i||c()),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!o}};return f},ce.extend({Deferred:function(e){var o=[[\"notify\",\"progress\",ce.Callbacks(\"memory\"),ce.Callbacks(\"memory\"),2],[\"resolve\",\"done\",ce.Callbacks(\"once memory\"),ce.Callbacks(\"once memory\"),0,\"resolved\"],[\"reject\",\"fail\",ce.Callbacks(\"once memory\"),ce.Callbacks(\"once memory\"),1,\"rejected\"]],i=\"pending\",a={state:function(){return i},always:function(){return s.done(arguments).fail(arguments),this},\"catch\":function(e){return a.then(null,e)},pipe:function(){var i=arguments;return ce.Deferred(function(r){ce.each(o,function(e,t){var n=v(i[t[4]])&&i[t[4]];s[t[1]](function(){var e=n&&n.apply(this,arguments);e&&v(e.promise)?e.promise().progress(r.notify).done(r.resolve).fail(r.reject):r[t[0]+\"With\"](this,n?[e]:arguments)})}),i=null}).promise()},then:function(t,n,r){var u=0;function l(i,o,a,s){return function(){var n=this,r=arguments,e=function(){var e,t;if(!(i<u)){if((e=a.apply(n,r))===o.promise())throw new TypeError(\"Thenable self-resolution\");t=e&&(\"object\"==typeof e||\"function\"==typeof e)&&e.then,v(t)?s?t.call(e,l(u,o,N,s),l(u,o,q,s)):(u++,t.call(e,l(u,o,N,s),l(u,o,q,s),l(u,o,N,o.notifyWith))):(a!==N&&(n=void 0,r=[e]),(s||o.resolveWith)(n,r))}},t=s?e:function(){try{e()}catch(e){ce.Deferred.exceptionHook&&ce.Deferred.exceptionHook(e,t.error),u<=i+1&&(a!==q&&(n=void 0,r=[e]),o.rejectWith(n,r))}};i?t():(ce.Deferred.getErrorHook?t.error=ce.Deferred.getErrorHook():ce.Deferred.getStackHook&&(t.error=ce.Deferred.getStackHook()),ie.setTimeout(t))}}return ce.Deferred(function(e){o[0][3].add(l(0,e,v(r)?r:N,e.notifyWith)),o[1][3].add(l(0,e,v(t)?t:N)),o[2][3].add(l(0,e,v(n)?n:q))}).promise()},promise:function(e){return null!=e?ce.extend(e,a):a}},s={};return ce.each(o,function(e,t){var n=t[2],r=t[5];a[t[1]]=n.add,r&&n.add(function(){i=r},o[3-e][2].disable,o[3-e][3].disable,o[0][2].lock,o[0][3].lock),n.add(t[3].fire),s[t[0]]=function(){return s[t[0]+\"With\"](this===s?void 0:this,arguments),this},s[t[0]+\"With\"]=n.fireWith}),a.promise(s),e&&e.call(s,s),s},when:function(e){var n=arguments.length,t=n,r=Array(t),i=ae.call(arguments),o=ce.Deferred(),a=function(t){return function(e){r[t]=this,i[t]=1<arguments.length?ae.call(arguments):e,--n||o.resolveWith(r,i)}};if(n<=1&&(L(e,o.done(a(t)).resolve,o.reject,!n),\"pending\"===o.state()||v(i[t]&&i[t].then)))return o.then();while(t--)L(i[t],a(t),o.reject);return o.promise()}});var H=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;ce.Deferred.exceptionHook=function(e,t){ie.console&&ie.console.warn&&e&&H.test(e.name)&&ie.console.warn(\"jQuery.Deferred exception: \"+e.message,e.stack,t)},ce.readyException=function(e){ie.setTimeout(function(){throw e})};var O=ce.Deferred();function P(){C.removeEventListener(\"DOMContentLoaded\",P),ie.removeEventListener(\"load\",P),ce.ready()}ce.fn.ready=function(e){return O.then(e)[\"catch\"](function(e){ce.readyException(e)}),this},ce.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--ce.readyWait:ce.isReady)||(ce.isReady=!0)!==e&&0<--ce.readyWait||O.resolveWith(C,[ce])}}),ce.ready.then=O.then,\"complete\"===C.readyState||\"loading\"!==C.readyState&&!C.documentElement.doScroll?ie.setTimeout(ce.ready):(C.addEventListener(\"DOMContentLoaded\",P),ie.addEventListener(\"load\",P));var M=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if(\"object\"===x(n))for(s in i=!0,n)M(e,t,s,n[s],!0,o,a);else if(void 0!==r&&(i=!0,v(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(ce(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},R=/^-ms-/,I=/-([a-z])/g;function W(e,t){return t.toUpperCase()}function F(e){return e.replace(R,\"ms-\").replace(I,W)}var $=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function B(){this.expando=ce.expando+B.uid++}B.uid=1,B.prototype={cache:function(e){var t=e[this.expando];return t||(t={},$(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if(\"string\"==typeof t)i[F(t)]=n;else for(r in t)i[F(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][F(t)]},access:function(e,t,n){return void 0===t||t&&\"string\"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(F):(t=F(t))in r?[t]:t.match(D)||[]).length;while(n--)delete r[t[n]]}(void 0===t||ce.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!ce.isEmptyObject(t)}};var _=new B,z=new B,X=/^(?:\\{[\\w\\W]*\\}|\\[[\\w\\W]*\\])$/,U=/[A-Z]/g;function V(e,t,n){var r,i;if(void 0===n&&1===e.nodeType)if(r=\"data-\"+t.replace(U,\"-$&\").toLowerCase(),\"string\"==typeof(n=e.getAttribute(r))){try{n=\"true\"===(i=n)||\"false\"!==i&&(\"null\"===i?null:i===+i+\"\"?+i:X.test(i)?JSON.parse(i):i)}catch(e){}z.set(e,t,n)}else n=void 0;return n}ce.extend({hasData:function(e){return z.hasData(e)||_.hasData(e)},data:function(e,t,n){return z.access(e,t,n)},removeData:function(e,t){z.remove(e,t)},_data:function(e,t,n){return _.access(e,t,n)},_removeData:function(e,t){_.remove(e,t)}}),ce.fn.extend({data:function(n,e){var t,r,i,o=this[0],a=o&&o.attributes;if(void 0===n){if(this.length&&(i=z.get(o),1===o.nodeType&&!_.get(o,\"hasDataAttrs\"))){t=a.length;while(t--)a[t]&&0===(r=a[t].name).indexOf(\"data-\")&&(r=F(r.slice(5)),V(o,r,i[r]));_.set(o,\"hasDataAttrs\",!0)}return i}return\"object\"==typeof n?this.each(function(){z.set(this,n)}):M(this,function(e){var t;if(o&&void 0===e)return void 0!==(t=z.get(o,n))?t:void 0!==(t=V(o,n))?t:void 0;this.each(function(){z.set(this,n,e)})},null,e,1<arguments.length,null,!0)},removeData:function(e){return this.each(function(){z.remove(this,e)})}}),ce.extend({queue:function(e,t,n){var r;if(e)return t=(t||\"fx\")+\"queue\",r=_.get(e,t),n&&(!r||Array.isArray(n)?r=_.access(e,t,ce.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||\"fx\";var n=ce.queue(e,t),r=n.length,i=n.shift(),o=ce._queueHooks(e,t);\"inprogress\"===i&&(i=n.shift(),r--),i&&(\"fx\"===t&&n.unshift(\"inprogress\"),delete o.stop,i.call(e,function(){ce.dequeue(e,t)},o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+\"queueHooks\";return _.get(e,n)||_.access(e,n,{empty:ce.Callbacks(\"once memory\").add(function(){_.remove(e,[t+\"queue\",n])})})}}),ce.fn.extend({queue:function(t,n){var e=2;return\"string\"!=typeof t&&(n=t,t=\"fx\",e--),arguments.length<e?ce.queue(this[0],t):void 0===n?this:this.each(function(){var e=ce.queue(this,t,n);ce._queueHooks(this,t),\"fx\"===t&&\"inprogress\"!==e[0]&&ce.dequeue(this,t)})},dequeue:function(e){return this.each(function(){ce.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||\"fx\",[])},promise:function(e,t){var n,r=1,i=ce.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};\"string\"!=typeof e&&(t=e,e=void 0),e=e||\"fx\";while(a--)(n=_.get(o[a],e+\"queueHooks\"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var G=/[+-]?(?:\\d*\\.|)\\d+(?:[eE][+-]?\\d+|)/.source,Y=new RegExp(\"^(?:([+-])=|)(\"+G+\")([a-z%]*)$\",\"i\"),Q=[\"Top\",\"Right\",\"Bottom\",\"Left\"],J=C.documentElement,K=function(e){return ce.contains(e.ownerDocument,e)},Z={composed:!0};J.getRootNode&&(K=function(e){return ce.contains(e.ownerDocument,e)||e.getRootNode(Z)===e.ownerDocument});var ee=function(e,t){return\"none\"===(e=t||e).style.display||\"\"===e.style.display&&K(e)&&\"none\"===ce.css(e,\"display\")};function te(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return ce.css(e,t,\"\")},u=s(),l=n&&n[3]||(ce.cssNumber[t]?\"\":\"px\"),c=e.nodeType&&(ce.cssNumber[t]||\"px\"!==l&&+u)&&Y.exec(ce.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)ce.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,ce.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var ne={};function re(e,t){for(var n,r,i,o,a,s,u,l=[],c=0,f=e.length;c<f;c++)(r=e[c]).style&&(n=r.style.display,t?(\"none\"===n&&(l[c]=_.get(r,\"display\")||null,l[c]||(r.style.display=\"\")),\"\"===r.style.display&&ee(r)&&(l[c]=(u=a=o=void 0,a=(i=r).ownerDocument,s=i.nodeName,(u=ne[s])||(o=a.body.appendChild(a.createElement(s)),u=ce.css(o,\"display\"),o.parentNode.removeChild(o),\"none\"===u&&(u=\"block\"),ne[s]=u)))):\"none\"!==n&&(l[c]=\"none\",_.set(r,\"display\",n)));for(c=0;c<f;c++)null!=l[c]&&(e[c].style.display=l[c]);return e}ce.fn.extend({show:function(){return re(this,!0)},hide:function(){return re(this)},toggle:function(e){return\"boolean\"==typeof e?e?this.show():this.hide():this.each(function(){ee(this)?ce(this).show():ce(this).hide()})}});var xe,be,we=/^(?:checkbox|radio)$/i,Te=/<([a-z][^\\/\\0>\\x20\\t\\r\\n\\f]*)/i,Ce=/^$|^module$|\\/(?:java|ecma)script/i;xe=C.createDocumentFragment().appendChild(C.createElement(\"div\")),(be=C.createElement(\"input\")).setAttribute(\"type\",\"radio\"),be.setAttribute(\"checked\",\"checked\"),be.setAttribute(\"name\",\"t\"),xe.appendChild(be),le.checkClone=xe.cloneNode(!0).cloneNode(!0).lastChild.checked,xe.innerHTML=\"<textarea>x</textarea>\",le.noCloneChecked=!!xe.cloneNode(!0).lastChild.defaultValue,xe.innerHTML=\"<option></option>\",le.option=!!xe.lastChild;var ke={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,\"\",\"\"]};function Se(e,t){var n;return n=\"undefined\"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||\"*\"):\"undefined\"!=typeof e.querySelectorAll?e.querySelectorAll(t||\"*\"):[],void 0===t||t&&fe(e,t)?ce.merge([e],n):n}function Ee(e,t){for(var n=0,r=e.length;n<r;n++)_.set(e[n],\"globalEval\",!t||_.get(t[n],\"globalEval\"))}ke.tbody=ke.tfoot=ke.colgroup=ke.caption=ke.thead,ke.th=ke.td,le.option||(ke.optgroup=ke.option=[1,\"<select multiple='multiple'>\",\"</select>\"]);var je=/<|&#?\\w+;/;function Ae(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if(\"object\"===x(o))ce.merge(p,o.nodeType?[o]:o);else if(je.test(o)){a=a||f.appendChild(t.createElement(\"div\")),s=(Te.exec(o)||[\"\",\"\"])[1].toLowerCase(),u=ke[s]||ke._default,a.innerHTML=u[1]+ce.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;ce.merge(p,a.childNodes),(a=f.firstChild).textContent=\"\"}else p.push(t.createTextNode(o));f.textContent=\"\",d=0;while(o=p[d++])if(r&&-1<ce.inArray(o,r))i&&i.push(o);else if(l=K(o),a=Se(f.appendChild(o),\"script\"),l&&Ee(a),n){c=0;while(o=a[c++])Ce.test(o.type||\"\")&&n.push(o)}return f}var De=/^([^.]*)(?:\\.(.+)|)/;function Ne(){return!0}function qe(){return!1}function Le(e,t,n,r,i,o){var a,s;if(\"object\"==typeof t){for(s in\"string\"!=typeof n&&(r=r||n,n=void 0),t)Le(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&(\"string\"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=qe;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return ce().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=ce.guid++)),e.each(function(){ce.event.add(this,t,i,r,n)})}function He(e,r,t){t?(_.set(e,r,!1),ce.event.add(e,r,{namespace:!1,handler:function(e){var t,n=_.get(this,r);if(1&e.isTrigger&&this[r]){if(n)(ce.event.special[r]||{}).delegateType&&e.stopPropagation();else if(n=ae.call(arguments),_.set(this,r,n),this[r](),t=_.get(this,r),_.set(this,r,!1),n!==t)return e.stopImmediatePropagation(),e.preventDefault(),t}else n&&(_.set(this,r,ce.event.trigger(n[0],n.slice(1),this)),e.stopPropagation(),e.isImmediatePropagationStopped=Ne)}})):void 0===_.get(e,r)&&ce.event.add(e,r,Ne)}ce.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=_.get(t);if($(t)){n.handler&&(n=(o=n).handler,i=o.selector),i&&ce.find.matchesSelector(J,i),n.guid||(n.guid=ce.guid++),(u=v.events)||(u=v.events=Object.create(null)),(a=v.handle)||(a=v.handle=function(e){return\"undefined\"!=typeof ce&&ce.event.triggered!==e.type?ce.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||\"\").match(D)||[\"\"]).length;while(l--)d=g=(s=De.exec(e[l])||[])[1],h=(s[2]||\"\").split(\".\").sort(),d&&(f=ce.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=ce.event.special[d]||{},c=ce.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&ce.expr.match.needsContext.test(i),namespace:h.join(\".\")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),ce.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=_.hasData(e)&&_.get(e);if(v&&(u=v.events)){l=(t=(t||\"\").match(D)||[\"\"]).length;while(l--)if(d=g=(s=De.exec(t[l])||[])[1],h=(s[2]||\"\").split(\".\").sort(),d){f=ce.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp(\"(^|\\\\.)\"+h.join(\"\\\\.(?:.*\\\\.|)\")+\"(\\\\.|$)\"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&(\"**\"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||ce.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)ce.event.remove(e,d+t[l],n,r,!0);ce.isEmptyObject(u)&&_.remove(e,\"handle events\")}},dispatch:function(e){var t,n,r,i,o,a,s=new Array(arguments.length),u=ce.event.fix(e),l=(_.get(this,\"events\")||Object.create(null))[u.type]||[],c=ce.event.special[u.type]||{};for(s[0]=u,t=1;t<arguments.length;t++)s[t]=arguments[t];if(u.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,u)){a=ce.event.handlers.call(this,u,l),t=0;while((i=a[t++])&&!u.isPropagationStopped()){u.currentTarget=i.elem,n=0;while((o=i.handlers[n++])&&!u.isImmediatePropagationStopped())u.rnamespace&&!1!==o.namespace&&!u.rnamespace.test(o.namespace)||(u.handleObj=o,u.data=o.data,void 0!==(r=((ce.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,s))&&!1===(u.result=r)&&(u.preventDefault(),u.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,u),u.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!(\"click\"===e.type&&1<=e.button))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&(\"click\"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+\" \"]&&(a[i]=r.needsContext?-1<ce(i,this).index(l):ce.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(t,e){Object.defineProperty(ce.Event.prototype,t,{enumerable:!0,configurable:!0,get:v(e)?function(){if(this.originalEvent)return e(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[t]},set:function(e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e})}})},fix:function(e){return e[ce.expando]?e:new ce.Event(e)},special:{load:{noBubble:!0},click:{setup:function(e){var t=this||e;return we.test(t.type)&&t.click&&fe(t,\"input\")&&He(t,\"click\",!0),!1},trigger:function(e){var t=this||e;return we.test(t.type)&&t.click&&fe(t,\"input\")&&He(t,\"click\"),!0},_default:function(e){var t=e.target;return we.test(t.type)&&t.click&&fe(t,\"input\")&&_.get(t,\"click\")||fe(t,\"a\")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},ce.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},ce.Event=function(e,t){if(!(this instanceof ce.Event))return new ce.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Ne:qe,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&ce.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[ce.expando]=!0},ce.Event.prototype={constructor:ce.Event,isDefaultPrevented:qe,isPropagationStopped:qe,isImmediatePropagationStopped:qe,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Ne,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Ne,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Ne,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},ce.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,\"char\":!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:!0},ce.event.addProp),ce.each({focus:\"focusin\",blur:\"focusout\"},function(r,i){function o(e){if(C.documentMode){var t=_.get(this,\"handle\"),n=ce.event.fix(e);n.type=\"focusin\"===e.type?\"focus\":\"blur\",n.isSimulated=!0,t(e),n.target===n.currentTarget&&t(n)}else ce.event.simulate(i,e.target,ce.event.fix(e))}ce.event.special[r]={setup:function(){var e;if(He(this,r,!0),!C.documentMode)return!1;(e=_.get(this,i))||this.addEventListener(i,o),_.set(this,i,(e||0)+1)},trigger:function(){return He(this,r),!0},teardown:function(){var e;if(!C.documentMode)return!1;(e=_.get(this,i)-1)?_.set(this,i,e):(this.removeEventListener(i,o),_.remove(this,i))},_default:function(e){return _.get(e.target,r)},delegateType:i},ce.event.special[i]={setup:function(){var e=this.ownerDocument||this.document||this,t=C.documentMode?this:e,n=_.get(t,i);n||(C.documentMode?this.addEventListener(i,o):e.addEventListener(r,o,!0)),_.set(t,i,(n||0)+1)},teardown:function(){var e=this.ownerDocument||this.document||this,t=C.documentMode?this:e,n=_.get(t,i)-1;n?_.set(t,i,n):(C.documentMode?this.removeEventListener(i,o):e.removeEventListener(r,o,!0),_.remove(t,i))}}}),ce.each({mouseenter:\"mouseover\",mouseleave:\"mouseout\",pointerenter:\"pointerover\",pointerleave:\"pointerout\"},function(e,i){ce.event.special[e]={delegateType:i,bindType:i,handle:function(e){var t,n=e.relatedTarget,r=e.handleObj;return n&&(n===this||ce.contains(this,n))||(e.type=r.origType,t=r.handler.apply(this,arguments),e.type=i),t}}}),ce.fn.extend({on:function(e,t,n,r){return Le(this,e,t,n,r)},one:function(e,t,n,r){return Le(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,ce(e.delegateTarget).off(r.namespace?r.origType+\".\"+r.namespace:r.origType,r.selector,r.handler),this;if(\"object\"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&\"function\"!=typeof t||(n=t,t=void 0),!1===n&&(n=qe),this.each(function(){ce.event.remove(this,e,n,t)})}});var Oe=/<script|<style|<link/i,Pe=/checked\\s*(?:[^=]|=\\s*.checked.)/i,Me=/^\\s*<!\\[CDATA\\[|\\]\\]>\\s*$/g;function Re(e,t){return fe(e,\"table\")&&fe(11!==t.nodeType?t:t.firstChild,\"tr\")&&ce(e).children(\"tbody\")[0]||e}function Ie(e){return e.type=(null!==e.getAttribute(\"type\"))+\"/\"+e.type,e}function We(e){return\"true/\"===(e.type||\"\").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute(\"type\"),e}function Fe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(_.hasData(e)&&(s=_.get(e).events))for(i in _.remove(t,\"handle events\"),s)for(n=0,r=s[i].length;n<r;n++)ce.event.add(t,i,s[i][n]);z.hasData(e)&&(o=z.access(e),a=ce.extend({},o),z.set(t,a))}}function $e(n,r,i,o){r=g(r);var e,t,a,s,u,l,c=0,f=n.length,p=f-1,d=r[0],h=v(d);if(h||1<f&&\"string\"==typeof d&&!le.checkClone&&Pe.test(d))return n.each(function(e){var t=n.eq(e);h&&(r[0]=d.call(this,e,t.html())),$e(t,r,i,o)});if(f&&(t=(e=Ae(r,n[0].ownerDocument,!1,n,o)).firstChild,1===e.childNodes.length&&(e=t),t||o)){for(s=(a=ce.map(Se(e,\"script\"),Ie)).length;c<f;c++)u=e,c!==p&&(u=ce.clone(u,!0,!0),s&&ce.merge(a,Se(u,\"script\"))),i.call(n[c],u,c);if(s)for(l=a[a.length-1].ownerDocument,ce.map(a,We),c=0;c<s;c++)u=a[c],Ce.test(u.type||\"\")&&!_.access(u,\"globalEval\")&&ce.contains(l,u)&&(u.src&&\"module\"!==(u.type||\"\").toLowerCase()?ce._evalUrl&&!u.noModule&&ce._evalUrl(u.src,{nonce:u.nonce||u.getAttribute(\"nonce\")},l):m(u.textContent.replace(Me,\"\"),u,l))}return n}function Be(e,t,n){for(var r,i=t?ce.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||ce.cleanData(Se(r)),r.parentNode&&(n&&K(r)&&Ee(Se(r,\"script\")),r.parentNode.removeChild(r));return e}ce.extend({htmlPrefilter:function(e){return e},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=K(e);if(!(le.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||ce.isXMLDoc(e)))for(a=Se(c),r=0,i=(o=Se(e)).length;r<i;r++)s=o[r],u=a[r],void 0,\"input\"===(l=u.nodeName.toLowerCase())&&we.test(s.type)?u.checked=s.checked:\"input\"!==l&&\"textarea\"!==l||(u.defaultValue=s.defaultValue);if(t)if(n)for(o=o||Se(e),a=a||Se(c),r=0,i=o.length;r<i;r++)Fe(o[r],a[r]);else Fe(e,c);return 0<(a=Se(c,\"script\")).length&&Ee(a,!f&&Se(e,\"script\")),c},cleanData:function(e){for(var t,n,r,i=ce.event.special,o=0;void 0!==(n=e[o]);o++)if($(n)){if(t=n[_.expando]){if(t.events)for(r in t.events)i[r]?ce.event.remove(n,r):ce.removeEvent(n,r,t.handle);n[_.expando]=void 0}n[z.expando]&&(n[z.expando]=void 0)}}}),ce.fn.extend({detach:function(e){return Be(this,e,!0)},remove:function(e){return Be(this,e)},text:function(e){return M(this,function(e){return void 0===e?ce.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return $e(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Re(this,e).appendChild(e)})},prepend:function(){return $e(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Re(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return $e(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return $e(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(ce.cleanData(Se(e,!1)),e.textContent=\"\");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return ce.clone(this,e,t)})},html:function(e){return M(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if(\"string\"==typeof e&&!Oe.test(e)&&!ke[(Te.exec(e)||[\"\",\"\"])[1].toLowerCase()]){e=ce.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(ce.cleanData(Se(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var n=[];return $e(this,arguments,function(e){var t=this.parentNode;ce.inArray(this,n)<0&&(ce.cleanData(Se(this)),t&&t.replaceChild(e,this))},n)}}),ce.each({appendTo:\"append\",prependTo:\"prepend\",insertBefore:\"before\",insertAfter:\"after\",replaceAll:\"replaceWith\"},function(e,a){ce.fn[e]=function(e){for(var t,n=[],r=ce(e),i=r.length-1,o=0;o<=i;o++)t=o===i?this:this.clone(!0),ce(r[o])[a](t),s.apply(n,t.get());return this.pushStack(n)}});var _e=new RegExp(\"^(\"+G+\")(?!px)[a-z%]+$\",\"i\"),ze=/^--/,Xe=function(e){var t=e.ownerDocument.defaultView;return t&&t.opener||(t=ie),t.getComputedStyle(e)},Ue=function(e,t,n){var r,i,o={};for(i in t)o[i]=e.style[i],e.style[i]=t[i];for(i in r=n.call(e),t)e.style[i]=o[i];return r},Ve=new RegExp(Q.join(\"|\"),\"i\");function Ge(e,t,n){var r,i,o,a,s=ze.test(t),u=e.style;return(n=n||Xe(e))&&(a=n.getPropertyValue(t)||n[t],s&&a&&(a=a.replace(ve,\"$1\")||void 0),\"\"!==a||K(e)||(a=ce.style(e,t)),!le.pixelBoxStyles()&&_e.test(a)&&Ve.test(t)&&(r=u.width,i=u.minWidth,o=u.maxWidth,u.minWidth=u.maxWidth=u.width=a,a=n.width,u.width=r,u.minWidth=i,u.maxWidth=o)),void 0!==a?a+\"\":a}function Ye(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}!function(){function e(){if(l){u.style.cssText=\"position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0\",l.style.cssText=\"position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%\",J.appendChild(u).appendChild(l);var e=ie.getComputedStyle(l);n=\"1%\"!==e.top,s=12===t(e.marginLeft),l.style.right=\"60%\",o=36===t(e.right),r=36===t(e.width),l.style.position=\"absolute\",i=12===t(l.offsetWidth/3),J.removeChild(u),l=null}}function t(e){return Math.round(parseFloat(e))}var n,r,i,o,a,s,u=C.createElement(\"div\"),l=C.createElement(\"div\");l.style&&(l.style.backgroundClip=\"content-box\",l.cloneNode(!0).style.backgroundClip=\"\",le.clearCloneStyle=\"content-box\"===l.style.backgroundClip,ce.extend(le,{boxSizingReliable:function(){return e(),r},pixelBoxStyles:function(){return e(),o},pixelPosition:function(){return e(),n},reliableMarginLeft:function(){return e(),s},scrollboxSize:function(){return e(),i},reliableTrDimensions:function(){var e,t,n,r;return null==a&&(e=C.createElement(\"table\"),t=C.createElement(\"tr\"),n=C.createElement(\"div\"),e.style.cssText=\"position:absolute;left:-11111px;border-collapse:separate\",t.style.cssText=\"box-sizing:content-box;border:1px solid\",t.style.height=\"1px\",n.style.height=\"9px\",n.style.display=\"block\",J.appendChild(e).appendChild(t).appendChild(n),r=ie.getComputedStyle(t),a=parseInt(r.height,10)+parseInt(r.borderTopWidth,10)+parseInt(r.borderBottomWidth,10)===t.offsetHeight,J.removeChild(e)),a}}))}();var Qe=[\"Webkit\",\"Moz\",\"ms\"],Je=C.createElement(\"div\").style,Ke={};function Ze(e){var t=ce.cssProps[e]||Ke[e];return t||(e in Je?e:Ke[e]=function(e){var t=e[0].toUpperCase()+e.slice(1),n=Qe.length;while(n--)if((e=Qe[n]+t)in Je)return e}(e)||e)}var et=/^(none|table(?!-c[ea]).+)/,tt={position:\"absolute\",visibility:\"hidden\",display:\"block\"},nt={letterSpacing:\"0\",fontWeight:\"400\"};function rt(e,t,n){var r=Y.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||\"px\"):t}function it(e,t,n,r,i,o){var a=\"width\"===t?1:0,s=0,u=0,l=0;if(n===(r?\"border\":\"content\"))return 0;for(;a<4;a+=2)\"margin\"===n&&(l+=ce.css(e,n+Q[a],!0,i)),r?(\"content\"===n&&(u-=ce.css(e,\"padding\"+Q[a],!0,i)),\"margin\"!==n&&(u-=ce.css(e,\"border\"+Q[a]+\"Width\",!0,i))):(u+=ce.css(e,\"padding\"+Q[a],!0,i),\"padding\"!==n?u+=ce.css(e,\"border\"+Q[a]+\"Width\",!0,i):s+=ce.css(e,\"border\"+Q[a]+\"Width\",!0,i));return!r&&0<=o&&(u+=Math.max(0,Math.ceil(e[\"offset\"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))||0),u+l}function ot(e,t,n){var r=Xe(e),i=(!le.boxSizingReliable()||n)&&\"border-box\"===ce.css(e,\"boxSizing\",!1,r),o=i,a=Ge(e,t,r),s=\"offset\"+t[0].toUpperCase()+t.slice(1);if(_e.test(a)){if(!n)return a;a=\"auto\"}return(!le.boxSizingReliable()&&i||!le.reliableTrDimensions()&&fe(e,\"tr\")||\"auto\"===a||!parseFloat(a)&&\"inline\"===ce.css(e,\"display\",!1,r))&&e.getClientRects().length&&(i=\"border-box\"===ce.css(e,\"boxSizing\",!1,r),(o=s in e)&&(a=e[s])),(a=parseFloat(a)||0)+it(e,t,n||(i?\"border\":\"content\"),o,r,a)+\"px\"}function at(e,t,n,r,i){return new at.prototype.init(e,t,n,r,i)}ce.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Ge(e,\"opacity\");return\"\"===n?\"1\":n}}}},cssNumber:{animationIterationCount:!0,aspectRatio:!0,borderImageSlice:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,scale:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeMiterlimit:!0,strokeOpacity:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=F(t),u=ze.test(t),l=e.style;if(u||(t=Ze(s)),a=ce.cssHooks[t]||ce.cssHooks[s],void 0===n)return a&&\"get\"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];\"string\"===(o=typeof n)&&(i=Y.exec(n))&&i[1]&&(n=te(e,t,i),o=\"number\"),null!=n&&n==n&&(\"number\"!==o||u||(n+=i&&i[3]||(ce.cssNumber[s]?\"\":\"px\")),le.clearCloneStyle||\"\"!==n||0!==t.indexOf(\"background\")||(l[t]=\"inherit\"),a&&\"set\"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=F(t);return ze.test(t)||(t=Ze(s)),(a=ce.cssHooks[t]||ce.cssHooks[s])&&\"get\"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Ge(e,t,r)),\"normal\"===i&&t in nt&&(i=nt[t]),\"\"===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),ce.each([\"height\",\"width\"],function(e,u){ce.cssHooks[u]={get:function(e,t,n){if(t)return!et.test(ce.css(e,\"display\"))||e.getClientRects().length&&e.getBoundingClientRect().width?ot(e,u,n):Ue(e,tt,function(){return ot(e,u,n)})},set:function(e,t,n){var r,i=Xe(e),o=!le.scrollboxSize()&&\"absolute\"===i.position,a=(o||n)&&\"border-box\"===ce.css(e,\"boxSizing\",!1,i),s=n?it(e,u,n,a,i):0;return a&&o&&(s-=Math.ceil(e[\"offset\"+u[0].toUpperCase()+u.slice(1)]-parseFloat(i[u])-it(e,u,\"border\",!1,i)-.5)),s&&(r=Y.exec(t))&&\"px\"!==(r[3]||\"px\")&&(e.style[u]=t,t=ce.css(e,u)),rt(0,t,s)}}}),ce.cssHooks.marginLeft=Ye(le.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Ge(e,\"marginLeft\"))||e.getBoundingClientRect().left-Ue(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+\"px\"}),ce.each({margin:\"\",padding:\"\",border:\"Width\"},function(i,o){ce.cssHooks[i+o]={expand:function(e){for(var t=0,n={},r=\"string\"==typeof e?e.split(\" \"):[e];t<4;t++)n[i+Q[t]+o]=r[t]||r[t-2]||r[0];return n}},\"margin\"!==i&&(ce.cssHooks[i+o].set=rt)}),ce.fn.extend({css:function(e,t){return M(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=Xe(e),i=t.length;a<i;a++)o[t[a]]=ce.css(e,t[a],!1,r);return o}return void 0!==n?ce.style(e,t,n):ce.css(e,t)},e,t,1<arguments.length)}}),((ce.Tween=at).prototype={constructor:at,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||ce.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(ce.cssNumber[n]?\"\":\"px\")},cur:function(){var e=at.propHooks[this.prop];return e&&e.get?e.get(this):at.propHooks._default.get(this)},run:function(e){var t,n=at.propHooks[this.prop];return this.options.duration?this.pos=t=ce.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):at.propHooks._default.set(this),this}}).init.prototype=at.prototype,(at.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=ce.css(e.elem,e.prop,\"\"))&&\"auto\"!==t?t:0},set:function(e){ce.fx.step[e.prop]?ce.fx.step[e.prop](e):1!==e.elem.nodeType||!ce.cssHooks[e.prop]&&null==e.elem.style[Ze(e.prop)]?e.elem[e.prop]=e.now:ce.style(e.elem,e.prop,e.now+e.unit)}}}).scrollTop=at.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},ce.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:\"swing\"},ce.fx=at.prototype.init,ce.fx.step={};var st,ut,lt,ct,ft=/^(?:toggle|show|hide)$/,pt=/queueHooks$/;function dt(){ut&&(!1===C.hidden&&ie.requestAnimationFrame?ie.requestAnimationFrame(dt):ie.setTimeout(dt,ce.fx.interval),ce.fx.tick())}function ht(){return ie.setTimeout(function(){st=void 0}),st=Date.now()}function gt(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i[\"margin\"+(n=Q[r])]=i[\"padding\"+n]=e;return t&&(i.opacity=i.width=e),i}function vt(e,t,n){for(var r,i=(yt.tweeners[t]||[]).concat(yt.tweeners[\"*\"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function yt(o,e,t){var n,a,r=0,i=yt.prefilters.length,s=ce.Deferred().always(function(){delete u.elem}),u=function(){if(a)return!1;for(var e=st||ht(),t=Math.max(0,l.startTime+l.duration-e),n=1-(t/l.duration||0),r=0,i=l.tweens.length;r<i;r++)l.tweens[r].run(n);return s.notifyWith(o,[l,n,t]),n<1&&i?t:(i||s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l]),!1)},l=s.promise({elem:o,props:ce.extend({},e),opts:ce.extend(!0,{specialEasing:{},easing:ce.easing._default},t),originalProperties:e,originalOptions:t,startTime:st||ht(),duration:t.duration,tweens:[],createTween:function(e,t){var n=ce.Tween(o,l.opts,e,t,l.opts.specialEasing[e]||l.opts.easing);return l.tweens.push(n),n},stop:function(e){var t=0,n=e?l.tweens.length:0;if(a)return this;for(a=!0;t<n;t++)l.tweens[t].run(1);return e?(s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l,e])):s.rejectWith(o,[l,e]),this}}),c=l.props;for(!function(e,t){var n,r,i,o,a;for(n in e)if(i=t[r=F(n)],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=ce.cssHooks[r])&&\"expand\"in a)for(n in o=a.expand(o),delete e[r],o)n in e||(e[n]=o[n],t[n]=i);else t[r]=i}(c,l.opts.specialEasing);r<i;r++)if(n=yt.prefilters[r].call(l,o,c,l.opts))return v(n.stop)&&(ce._queueHooks(l.elem,l.opts.queue).stop=n.stop.bind(n)),n;return ce.map(c,vt,l),v(l.opts.start)&&l.opts.start.call(o,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),ce.fx.timer(ce.extend(u,{elem:o,anim:l,queue:l.opts.queue})),l}ce.Animation=ce.extend(yt,{tweeners:{\"*\":[function(e,t){var n=this.createTween(e,t);return te(n.elem,e,Y.exec(t),n),n}]},tweener:function(e,t){v(e)?(t=e,e=[\"*\"]):e=e.match(D);for(var n,r=0,i=e.length;r<i;r++)n=e[r],yt.tweeners[n]=yt.tweeners[n]||[],yt.tweeners[n].unshift(t)},prefilters:[function(e,t,n){var r,i,o,a,s,u,l,c,f=\"width\"in t||\"height\"in t,p=this,d={},h=e.style,g=e.nodeType&&ee(e),v=_.get(e,\"fxshow\");for(r in n.queue||(null==(a=ce._queueHooks(e,\"fx\")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,ce.queue(e,\"fx\").length||a.empty.fire()})})),t)if(i=t[r],ft.test(i)){if(delete t[r],o=o||\"toggle\"===i,i===(g?\"hide\":\"show\")){if(\"show\"!==i||!v||void 0===v[r])continue;g=!0}d[r]=v&&v[r]||ce.style(e,r)}if((u=!ce.isEmptyObject(t))||!ce.isEmptyObject(d))for(r in f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=v&&v.display)&&(l=_.get(e,\"display\")),\"none\"===(c=ce.css(e,\"display\"))&&(l?c=l:(re([e],!0),l=e.style.display||l,c=ce.css(e,\"display\"),re([e]))),(\"inline\"===c||\"inline-block\"===c&&null!=l)&&\"none\"===ce.css(e,\"float\")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l=\"none\"===c?\"\":c)),h.display=\"inline-block\")),n.overflow&&(h.overflow=\"hidden\",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1,d)u||(v?\"hidden\"in v&&(g=v.hidden):v=_.access(e,\"fxshow\",{display:l}),o&&(v.hidden=!g),g&&re([e],!0),p.done(function(){for(r in g||re([e]),_.remove(e,\"fxshow\"),d)ce.style(e,r,d[r])})),u=vt(g?v[r]:0,r,p),r in v||(v[r]=u.start,g&&(u.end=u.start,u.start=0))}],prefilter:function(e,t){t?yt.prefilters.unshift(e):yt.prefilters.push(e)}}),ce.speed=function(e,t,n){var r=e&&\"object\"==typeof e?ce.extend({},e):{complete:n||!n&&t||v(e)&&e,duration:e,easing:n&&t||t&&!v(t)&&t};return ce.fx.off?r.duration=0:\"number\"!=typeof r.duration&&(r.duration in ce.fx.speeds?r.duration=ce.fx.speeds[r.duration]:r.duration=ce.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue=\"fx\"),r.old=r.complete,r.complete=function(){v(r.old)&&r.old.call(this),r.queue&&ce.dequeue(this,r.queue)},r},ce.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ee).css(\"opacity\",0).show().end().animate({opacity:t},e,n,r)},animate:function(t,e,n,r){var i=ce.isEmptyObject(t),o=ce.speed(e,n,r),a=function(){var e=yt(this,ce.extend({},t),o);(i||_.get(this,\"finish\"))&&e.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(i,e,o){var a=function(e){var t=e.stop;delete e.stop,t(o)};return\"string\"!=typeof i&&(o=e,e=i,i=void 0),e&&this.queue(i||\"fx\",[]),this.each(function(){var e=!0,t=null!=i&&i+\"queueHooks\",n=ce.timers,r=_.get(this);if(t)r[t]&&r[t].stop&&a(r[t]);else for(t in r)r[t]&&r[t].stop&&pt.test(t)&&a(r[t]);for(t=n.length;t--;)n[t].elem!==this||null!=i&&n[t].queue!==i||(n[t].anim.stop(o),e=!1,n.splice(t,1));!e&&o||ce.dequeue(this,i)})},finish:function(a){return!1!==a&&(a=a||\"fx\"),this.each(function(){var e,t=_.get(this),n=t[a+\"queue\"],r=t[a+\"queueHooks\"],i=ce.timers,o=n?n.length:0;for(t.finish=!0,ce.queue(this,a,[]),r&&r.stop&&r.stop.call(this,!0),e=i.length;e--;)i[e].elem===this&&i[e].queue===a&&(i[e].anim.stop(!0),i.splice(e,1));for(e=0;e<o;e++)n[e]&&n[e].finish&&n[e].finish.call(this);delete t.finish})}}),ce.each([\"toggle\",\"show\",\"hide\"],function(e,r){var i=ce.fn[r];ce.fn[r]=function(e,t,n){return null==e||\"boolean\"==typeof e?i.apply(this,arguments):this.animate(gt(r,!0),e,t,n)}}),ce.each({slideDown:gt(\"show\"),slideUp:gt(\"hide\"),slideToggle:gt(\"toggle\"),fadeIn:{opacity:\"show\"},fadeOut:{opacity:\"hide\"},fadeToggle:{opacity:\"toggle\"}},function(e,r){ce.fn[e]=function(e,t,n){return this.animate(r,e,t,n)}}),ce.timers=[],ce.fx.tick=function(){var e,t=0,n=ce.timers;for(st=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||ce.fx.stop(),st=void 0},ce.fx.timer=function(e){ce.timers.push(e),ce.fx.start()},ce.fx.interval=13,ce.fx.start=function(){ut||(ut=!0,dt())},ce.fx.stop=function(){ut=null},ce.fx.speeds={slow:600,fast:200,_default:400},ce.fn.delay=function(r,e){return r=ce.fx&&ce.fx.speeds[r]||r,e=e||\"fx\",this.queue(e,function(e,t){var n=ie.setTimeout(e,r);t.stop=function(){ie.clearTimeout(n)}})},lt=C.createElement(\"input\"),ct=C.createElement(\"select\").appendChild(C.createElement(\"option\")),lt.type=\"checkbox\",le.checkOn=\"\"!==lt.value,le.optSelected=ct.selected,(lt=C.createElement(\"input\")).value=\"t\",lt.type=\"radio\",le.radioValue=\"t\"===lt.value;var mt,xt=ce.expr.attrHandle;ce.fn.extend({attr:function(e,t){return M(this,ce.attr,e,t,1<arguments.length)},removeAttr:function(e){return this.each(function(){ce.removeAttr(this,e)})}}),ce.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return\"undefined\"==typeof e.getAttribute?ce.prop(e,t,n):(1===o&&ce.isXMLDoc(e)||(i=ce.attrHooks[t.toLowerCase()]||(ce.expr.match.bool.test(t)?mt:void 0)),void 0!==n?null===n?void ce.removeAttr(e,t):i&&\"set\"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+\"\"),n):i&&\"get\"in i&&null!==(r=i.get(e,t))?r:null==(r=ce.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!le.radioValue&&\"radio\"===t&&fe(e,\"input\")){var n=e.value;return e.setAttribute(\"type\",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(D);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),mt={set:function(e,t,n){return!1===t?ce.removeAttr(e,n):e.setAttribute(n,n),n}},ce.each(ce.expr.match.bool.source.match(/\\w+/g),function(e,t){var a=xt[t]||ce.find.attr;xt[t]=function(e,t,n){var r,i,o=t.toLowerCase();return n||(i=xt[o],xt[o]=r,r=null!=a(e,t,n)?o:null,xt[o]=i),r}});var bt=/^(?:input|select|textarea|button)$/i,wt=/^(?:a|area)$/i;function Tt(e){return(e.match(D)||[]).join(\" \")}function Ct(e){return e.getAttribute&&e.getAttribute(\"class\")||\"\"}function kt(e){return Array.isArray(e)?e:\"string\"==typeof e&&e.match(D)||[]}ce.fn.extend({prop:function(e,t){return M(this,ce.prop,e,t,1<arguments.length)},removeProp:function(e){return this.each(function(){delete this[ce.propFix[e]||e]})}}),ce.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&ce.isXMLDoc(e)||(t=ce.propFix[t]||t,i=ce.propHooks[t]),void 0!==n?i&&\"set\"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&\"get\"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=ce.find.attr(e,\"tabindex\");return t?parseInt(t,10):bt.test(e.nodeName)||wt.test(e.nodeName)&&e.href?0:-1}}},propFix:{\"for\":\"htmlFor\",\"class\":\"className\"}}),le.optSelected||(ce.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),ce.each([\"tabIndex\",\"readOnly\",\"maxLength\",\"cellSpacing\",\"cellPadding\",\"rowSpan\",\"colSpan\",\"useMap\",\"frameBorder\",\"contentEditable\"],function(){ce.propFix[this.toLowerCase()]=this}),ce.fn.extend({addClass:function(t){var e,n,r,i,o,a;return v(t)?this.each(function(e){ce(this).addClass(t.call(this,e,Ct(this)))}):(e=kt(t)).length?this.each(function(){if(r=Ct(this),n=1===this.nodeType&&\" \"+Tt(r)+\" \"){for(o=0;o<e.length;o++)i=e[o],n.indexOf(\" \"+i+\" \")<0&&(n+=i+\" \");a=Tt(n),r!==a&&this.setAttribute(\"class\",a)}}):this},removeClass:function(t){var e,n,r,i,o,a;return v(t)?this.each(function(e){ce(this).removeClass(t.call(this,e,Ct(this)))}):arguments.length?(e=kt(t)).length?this.each(function(){if(r=Ct(this),n=1===this.nodeType&&\" \"+Tt(r)+\" \"){for(o=0;o<e.length;o++){i=e[o];while(-1<n.indexOf(\" \"+i+\" \"))n=n.replace(\" \"+i+\" \",\" \")}a=Tt(n),r!==a&&this.setAttribute(\"class\",a)}}):this:this.attr(\"class\",\"\")},toggleClass:function(t,n){var e,r,i,o,a=typeof t,s=\"string\"===a||Array.isArray(t);return v(t)?this.each(function(e){ce(this).toggleClass(t.call(this,e,Ct(this),n),n)}):\"boolean\"==typeof n&&s?n?this.addClass(t):this.removeClass(t):(e=kt(t),this.each(function(){if(s)for(o=ce(this),i=0;i<e.length;i++)r=e[i],o.hasClass(r)?o.removeClass(r):o.addClass(r);else void 0!==t&&\"boolean\"!==a||((r=Ct(this))&&_.set(this,\"__className__\",r),this.setAttribute&&this.setAttribute(\"class\",r||!1===t?\"\":_.get(this,\"__className__\")||\"\"))}))},hasClass:function(e){var t,n,r=0;t=\" \"+e+\" \";while(n=this[r++])if(1===n.nodeType&&-1<(\" \"+Tt(Ct(n))+\" \").indexOf(t))return!0;return!1}});var St=/\\r/g;ce.fn.extend({val:function(n){var r,e,i,t=this[0];return arguments.length?(i=v(n),this.each(function(e){var t;1===this.nodeType&&(null==(t=i?n.call(this,e,ce(this).val()):n)?t=\"\":\"number\"==typeof t?t+=\"\":Array.isArray(t)&&(t=ce.map(t,function(e){return null==e?\"\":e+\"\"})),(r=ce.valHooks[this.type]||ce.valHooks[this.nodeName.toLowerCase()])&&\"set\"in r&&void 0!==r.set(this,t,\"value\")||(this.value=t))})):t?(r=ce.valHooks[t.type]||ce.valHooks[t.nodeName.toLowerCase()])&&\"get\"in r&&void 0!==(e=r.get(t,\"value\"))?e:\"string\"==typeof(e=t.value)?e.replace(St,\"\"):null==e?\"\":e:void 0}}),ce.extend({valHooks:{option:{get:function(e){var t=ce.find.attr(e,\"value\");return null!=t?t:Tt(ce.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a=\"select-one\"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!fe(n.parentNode,\"optgroup\"))){if(t=ce(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=ce.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=-1<ce.inArray(ce.valHooks.option.get(r),o))&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),ce.each([\"radio\",\"checkbox\"],function(){ce.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=-1<ce.inArray(ce(e).val(),t)}},le.checkOn||(ce.valHooks[this].get=function(e){return null===e.getAttribute(\"value\")?\"on\":e.value})});var Et=ie.location,jt={guid:Date.now()},At=/\\?/;ce.parseXML=function(e){var t,n;if(!e||\"string\"!=typeof e)return null;try{t=(new ie.DOMParser).parseFromString(e,\"text/xml\")}catch(e){}return n=t&&t.getElementsByTagName(\"parsererror\")[0],t&&!n||ce.error(\"Invalid XML: \"+(n?ce.map(n.childNodes,function(e){return e.textContent}).join(\"\\n\"):e)),t};var Dt=/^(?:focusinfocus|focusoutblur)$/,Nt=function(e){e.stopPropagation()};ce.extend(ce.event,{trigger:function(e,t,n,r){var i,o,a,s,u,l,c,f,p=[n||C],d=ue.call(e,\"type\")?e.type:e,h=ue.call(e,\"namespace\")?e.namespace.split(\".\"):[];if(o=f=a=n=n||C,3!==n.nodeType&&8!==n.nodeType&&!Dt.test(d+ce.event.triggered)&&(-1<d.indexOf(\".\")&&(d=(h=d.split(\".\")).shift(),h.sort()),u=d.indexOf(\":\")<0&&\"on\"+d,(e=e[ce.expando]?e:new ce.Event(d,\"object\"==typeof e&&e)).isTrigger=r?2:3,e.namespace=h.join(\".\"),e.rnamespace=e.namespace?new RegExp(\"(^|\\\\.)\"+h.join(\"\\\\.(?:.*\\\\.|)\")+\"(\\\\.|$)\"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:ce.makeArray(t,[e]),c=ce.event.special[d]||{},r||!c.trigger||!1!==c.trigger.apply(n,t))){if(!r&&!c.noBubble&&!y(n)){for(s=c.delegateType||d,Dt.test(s+d)||(o=o.parentNode);o;o=o.parentNode)p.push(o),a=o;a===(n.ownerDocument||C)&&p.push(a.defaultView||a.parentWindow||ie)}i=0;while((o=p[i++])&&!e.isPropagationStopped())f=o,e.type=1<i?s:c.bindType||d,(l=(_.get(o,\"events\")||Object.create(null))[e.type]&&_.get(o,\"handle\"))&&l.apply(o,t),(l=u&&o[u])&&l.apply&&$(o)&&(e.result=l.apply(o,t),!1===e.result&&e.preventDefault());return e.type=d,r||e.isDefaultPrevented()||c._default&&!1!==c._default.apply(p.pop(),t)||!$(n)||u&&v(n[d])&&!y(n)&&((a=n[u])&&(n[u]=null),ce.event.triggered=d,e.isPropagationStopped()&&f.addEventListener(d,Nt),n[d](),e.isPropagationStopped()&&f.removeEventListener(d,Nt),ce.event.triggered=void 0,a&&(n[u]=a)),e.result}},simulate:function(e,t,n){var r=ce.extend(new ce.Event,n,{type:e,isSimulated:!0});ce.event.trigger(r,null,t)}}),ce.fn.extend({trigger:function(e,t){return this.each(function(){ce.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return ce.event.trigger(e,t,n,!0)}});var qt=/\\[\\]$/,Lt=/\\r?\\n/g,Ht=/^(?:submit|button|image|reset|file)$/i,Ot=/^(?:input|select|textarea|keygen)/i;function Pt(n,e,r,i){var t;if(Array.isArray(e))ce.each(e,function(e,t){r||qt.test(n)?i(n,t):Pt(n+\"[\"+(\"object\"==typeof t&&null!=t?e:\"\")+\"]\",t,r,i)});else if(r||\"object\"!==x(e))i(n,e);else for(t in e)Pt(n+\"[\"+t+\"]\",e[t],r,i)}ce.param=function(e,t){var n,r=[],i=function(e,t){var n=v(t)?t():t;r[r.length]=encodeURIComponent(e)+\"=\"+encodeURIComponent(null==n?\"\":n)};if(null==e)return\"\";if(Array.isArray(e)||e.jquery&&!ce.isPlainObject(e))ce.each(e,function(){i(this.name,this.value)});else for(n in e)Pt(n,e[n],t,i);return r.join(\"&\")},ce.fn.extend({serialize:function(){return ce.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=ce.prop(this,\"elements\");return e?ce.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!ce(this).is(\":disabled\")&&Ot.test(this.nodeName)&&!Ht.test(e)&&(this.checked||!we.test(e))}).map(function(e,t){var n=ce(this).val();return null==n?null:Array.isArray(n)?ce.map(n,function(e){return{name:t.name,value:e.replace(Lt,\"\\r\\n\")}}):{name:t.name,value:n.replace(Lt,\"\\r\\n\")}}).get()}});var Mt=/%20/g,Rt=/#.*$/,It=/([?&])_=[^&]*/,Wt=/^(.*?):[ \\t]*([^\\r\\n]*)$/gm,Ft=/^(?:GET|HEAD)$/,$t=/^\\/\\//,Bt={},_t={},zt=\"*/\".concat(\"*\"),Xt=C.createElement(\"a\");function Ut(o){return function(e,t){\"string\"!=typeof e&&(t=e,e=\"*\");var n,r=0,i=e.toLowerCase().match(D)||[];if(v(t))while(n=i[r++])\"+\"===n[0]?(n=n.slice(1)||\"*\",(o[n]=o[n]||[]).unshift(t)):(o[n]=o[n]||[]).push(t)}}function Vt(t,i,o,a){var s={},u=t===_t;function l(e){var r;return s[e]=!0,ce.each(t[e]||[],function(e,t){var n=t(i,o,a);return\"string\"!=typeof n||u||s[n]?u?!(r=n):void 0:(i.dataTypes.unshift(n),l(n),!1)}),r}return l(i.dataTypes[0])||!s[\"*\"]&&l(\"*\")}function Gt(e,t){var n,r,i=ce.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&ce.extend(!0,e,r),e}Xt.href=Et.href,ce.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Et.href,type:\"GET\",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Et.protocol),global:!0,processData:!0,async:!0,contentType:\"application/x-www-form-urlencoded; charset=UTF-8\",accepts:{\"*\":zt,text:\"text/plain\",html:\"text/html\",xml:\"application/xml, text/xml\",json:\"application/json, text/javascript\"},contents:{xml:/\\bxml\\b/,html:/\\bhtml/,json:/\\bjson\\b/},responseFields:{xml:\"responseXML\",text:\"responseText\",json:\"responseJSON\"},converters:{\"* text\":String,\"text html\":!0,\"text json\":JSON.parse,\"text xml\":ce.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Gt(Gt(e,ce.ajaxSettings),t):Gt(ce.ajaxSettings,e)},ajaxPrefilter:Ut(Bt),ajaxTransport:Ut(_t),ajax:function(e,t){\"object\"==typeof e&&(t=e,e=void 0),t=t||{};var c,f,p,n,d,r,h,g,i,o,v=ce.ajaxSetup({},t),y=v.context||v,m=v.context&&(y.nodeType||y.jquery)?ce(y):ce.event,x=ce.Deferred(),b=ce.Callbacks(\"once memory\"),w=v.statusCode||{},a={},s={},u=\"canceled\",T={readyState:0,getResponseHeader:function(e){var t;if(h){if(!n){n={};while(t=Wt.exec(p))n[t[1].toLowerCase()+\" \"]=(n[t[1].toLowerCase()+\" \"]||[]).concat(t[2])}t=n[e.toLowerCase()+\" \"]}return null==t?null:t.join(\", \")},getAllResponseHeaders:function(){return h?p:null},setRequestHeader:function(e,t){return null==h&&(e=s[e.toLowerCase()]=s[e.toLowerCase()]||e,a[e]=t),this},overrideMimeType:function(e){return null==h&&(v.mimeType=e),this},statusCode:function(e){var t;if(e)if(h)T.always(e[T.status]);else for(t in e)w[t]=[w[t],e[t]];return this},abort:function(e){var t=e||u;return c&&c.abort(t),l(0,t),this}};if(x.promise(T),v.url=((e||v.url||Et.href)+\"\").replace($t,Et.protocol+\"//\"),v.type=t.method||t.type||v.method||v.type,v.dataTypes=(v.dataType||\"*\").toLowerCase().match(D)||[\"\"],null==v.crossDomain){r=C.createElement(\"a\");try{r.href=v.url,r.href=r.href,v.crossDomain=Xt.protocol+\"//\"+Xt.host!=r.protocol+\"//\"+r.host}catch(e){v.crossDomain=!0}}if(v.data&&v.processData&&\"string\"!=typeof v.data&&(v.data=ce.param(v.data,v.traditional)),Vt(Bt,v,t,T),h)return T;for(i in(g=ce.event&&v.global)&&0==ce.active++&&ce.event.trigger(\"ajaxStart\"),v.type=v.type.toUpperCase(),v.hasContent=!Ft.test(v.type),f=v.url.replace(Rt,\"\"),v.hasContent?v.data&&v.processData&&0===(v.contentType||\"\").indexOf(\"application/x-www-form-urlencoded\")&&(v.data=v.data.replace(Mt,\"+\")):(o=v.url.slice(f.length),v.data&&(v.processData||\"string\"==typeof v.data)&&(f+=(At.test(f)?\"&\":\"?\")+v.data,delete v.data),!1===v.cache&&(f=f.replace(It,\"$1\"),o=(At.test(f)?\"&\":\"?\")+\"_=\"+jt.guid+++o),v.url=f+o),v.ifModified&&(ce.lastModified[f]&&T.setRequestHeader(\"If-Modified-Since\",ce.lastModified[f]),ce.etag[f]&&T.setRequestHeader(\"If-None-Match\",ce.etag[f])),(v.data&&v.hasContent&&!1!==v.contentType||t.contentType)&&T.setRequestHeader(\"Content-Type\",v.contentType),T.setRequestHeader(\"Accept\",v.dataTypes[0]&&v.accepts[v.dataTypes[0]]?v.accepts[v.dataTypes[0]]+(\"*\"!==v.dataTypes[0]?\", \"+zt+\"; q=0.01\":\"\"):v.accepts[\"*\"]),v.headers)T.setRequestHeader(i,v.headers[i]);if(v.beforeSend&&(!1===v.beforeSend.call(y,T,v)||h))return T.abort();if(u=\"abort\",b.add(v.complete),T.done(v.success),T.fail(v.error),c=Vt(_t,v,t,T)){if(T.readyState=1,g&&m.trigger(\"ajaxSend\",[T,v]),h)return T;v.async&&0<v.timeout&&(d=ie.setTimeout(function(){T.abort(\"timeout\")},v.timeout));try{h=!1,c.send(a,l)}catch(e){if(h)throw e;l(-1,e)}}else l(-1,\"No Transport\");function l(e,t,n,r){var i,o,a,s,u,l=t;h||(h=!0,d&&ie.clearTimeout(d),c=void 0,p=r||\"\",T.readyState=0<e?4:0,i=200<=e&&e<300||304===e,n&&(s=function(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while(\"*\"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader(\"Content-Type\"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+\" \"+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}(v,T,n)),!i&&-1<ce.inArray(\"script\",v.dataTypes)&&ce.inArray(\"json\",v.dataTypes)<0&&(v.converters[\"text script\"]=function(){}),s=function(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if(\"*\"===o)o=u;else if(\"*\"!==u&&u!==o){if(!(a=l[u+\" \"+o]||l[\"* \"+o]))for(i in l)if((s=i.split(\" \"))[1]===o&&(a=l[u+\" \"+s[0]]||l[\"* \"+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e[\"throws\"])t=a(t);else try{t=a(t)}catch(e){return{state:\"parsererror\",error:a?e:\"No conversion from \"+u+\" to \"+o}}}return{state:\"success\",data:t}}(v,s,T,i),i?(v.ifModified&&((u=T.getResponseHeader(\"Last-Modified\"))&&(ce.lastModified[f]=u),(u=T.getResponseHeader(\"etag\"))&&(ce.etag[f]=u)),204===e||\"HEAD\"===v.type?l=\"nocontent\":304===e?l=\"notmodified\":(l=s.state,o=s.data,i=!(a=s.error))):(a=l,!e&&l||(l=\"error\",e<0&&(e=0))),T.status=e,T.statusText=(t||l)+\"\",i?x.resolveWith(y,[o,l,T]):x.rejectWith(y,[T,l,a]),T.statusCode(w),w=void 0,g&&m.trigger(i?\"ajaxSuccess\":\"ajaxError\",[T,v,i?o:a]),b.fireWith(y,[T,l]),g&&(m.trigger(\"ajaxComplete\",[T,v]),--ce.active||ce.event.trigger(\"ajaxStop\")))}return T},getJSON:function(e,t,n){return ce.get(e,t,n,\"json\")},getScript:function(e,t){return ce.get(e,void 0,t,\"script\")}}),ce.each([\"get\",\"post\"],function(e,i){ce[i]=function(e,t,n,r){return v(t)&&(r=r||n,n=t,t=void 0),ce.ajax(ce.extend({url:e,type:i,dataType:r,data:t,success:n},ce.isPlainObject(e)&&e))}}),ce.ajaxPrefilter(function(e){var t;for(t in e.headers)\"content-type\"===t.toLowerCase()&&(e.contentType=e.headers[t]||\"\")}),ce._evalUrl=function(e,t,n){return ce.ajax({url:e,type:\"GET\",dataType:\"script\",cache:!0,async:!1,global:!1,converters:{\"text script\":function(){}},dataFilter:function(e){ce.globalEval(e,t,n)}})},ce.fn.extend({wrapAll:function(e){var t;return this[0]&&(v(e)&&(e=e.call(this[0])),t=ce(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(n){return v(n)?this.each(function(e){ce(this).wrapInner(n.call(this,e))}):this.each(function(){var e=ce(this),t=e.contents();t.length?t.wrapAll(n):e.append(n)})},wrap:function(t){var n=v(t);return this.each(function(e){ce(this).wrapAll(n?t.call(this,e):t)})},unwrap:function(e){return this.parent(e).not(\"body\").each(function(){ce(this).replaceWith(this.childNodes)}),this}}),ce.expr.pseudos.hidden=function(e){return!ce.expr.pseudos.visible(e)},ce.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},ce.ajaxSettings.xhr=function(){try{return new ie.XMLHttpRequest}catch(e){}};var Yt={0:200,1223:204},Qt=ce.ajaxSettings.xhr();le.cors=!!Qt&&\"withCredentials\"in Qt,le.ajax=Qt=!!Qt,ce.ajaxTransport(function(i){var o,a;if(le.cors||Qt&&!i.crossDomain)return{send:function(e,t){var n,r=i.xhr();if(r.open(i.type,i.url,i.async,i.username,i.password),i.xhrFields)for(n in i.xhrFields)r[n]=i.xhrFields[n];for(n in i.mimeType&&r.overrideMimeType&&r.overrideMimeType(i.mimeType),i.crossDomain||e[\"X-Requested-With\"]||(e[\"X-Requested-With\"]=\"XMLHttpRequest\"),e)r.setRequestHeader(n,e[n]);o=function(e){return function(){o&&(o=a=r.onload=r.onerror=r.onabort=r.ontimeout=r.onreadystatechange=null,\"abort\"===e?r.abort():\"error\"===e?\"number\"!=typeof r.status?t(0,\"error\"):t(r.status,r.statusText):t(Yt[r.status]||r.status,r.statusText,\"text\"!==(r.responseType||\"text\")||\"string\"!=typeof r.responseText?{binary:r.response}:{text:r.responseText},r.getAllResponseHeaders()))}},r.onload=o(),a=r.onerror=r.ontimeout=o(\"error\"),void 0!==r.onabort?r.onabort=a:r.onreadystatechange=function(){4===r.readyState&&ie.setTimeout(function(){o&&a()})},o=o(\"abort\");try{r.send(i.hasContent&&i.data||null)}catch(e){if(o)throw e}},abort:function(){o&&o()}}}),ce.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),ce.ajaxSetup({accepts:{script:\"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript\"},contents:{script:/\\b(?:java|ecma)script\\b/},converters:{\"text script\":function(e){return ce.globalEval(e),e}}}),ce.ajaxPrefilter(\"script\",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type=\"GET\")}),ce.ajaxTransport(\"script\",function(n){var r,i;if(n.crossDomain||n.scriptAttrs)return{send:function(e,t){r=ce(\"<script>\").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on(\"load error\",i=function(e){r.remove(),i=null,e&&t(\"error\"===e.type?404:200,e.type)}),C.head.appendChild(r[0])},abort:function(){i&&i()}}});var Jt,Kt=[],Zt=/(=)\\?(?=&|$)|\\?\\?/;ce.ajaxSetup({jsonp:\"callback\",jsonpCallback:function(){var e=Kt.pop()||ce.expando+\"_\"+jt.guid++;return this[e]=!0,e}}),ce.ajaxPrefilter(\"json jsonp\",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Zt.test(e.url)?\"url\":\"string\"==typeof e.data&&0===(e.contentType||\"\").indexOf(\"application/x-www-form-urlencoded\")&&Zt.test(e.data)&&\"data\");if(a||\"jsonp\"===e.dataTypes[0])return r=e.jsonpCallback=v(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Zt,\"$1\"+r):!1!==e.jsonp&&(e.url+=(At.test(e.url)?\"&\":\"?\")+e.jsonp+\"=\"+r),e.converters[\"script json\"]=function(){return o||ce.error(r+\" was not called\"),o[0]},e.dataTypes[0]=\"json\",i=ie[r],ie[r]=function(){o=arguments},n.always(function(){void 0===i?ce(ie).removeProp(r):ie[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Kt.push(r)),o&&v(i)&&i(o[0]),o=i=void 0}),\"script\"}),le.createHTMLDocument=((Jt=C.implementation.createHTMLDocument(\"\").body).innerHTML=\"<form></form><form></form>\",2===Jt.childNodes.length),ce.parseHTML=function(e,t,n){return\"string\"!=typeof e?[]:(\"boolean\"==typeof t&&(n=t,t=!1),t||(le.createHTMLDocument?((r=(t=C.implementation.createHTMLDocument(\"\")).createElement(\"base\")).href=C.location.href,t.head.appendChild(r)):t=C),o=!n&&[],(i=w.exec(e))?[t.createElement(i[1])]:(i=Ae([e],t,o),o&&o.length&&ce(o).remove(),ce.merge([],i.childNodes)));var r,i,o},ce.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(\" \");return-1<s&&(r=Tt(e.slice(s)),e=e.slice(0,s)),v(t)?(n=t,t=void 0):t&&\"object\"==typeof t&&(i=\"POST\"),0<a.length&&ce.ajax({url:e,type:i||\"GET\",dataType:\"html\",data:t}).done(function(e){o=arguments,a.html(r?ce(\"<div>\").append(ce.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},ce.expr.pseudos.animated=function(t){return ce.grep(ce.timers,function(e){return t===e.elem}).length},ce.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=ce.css(e,\"position\"),c=ce(e),f={};\"static\"===l&&(e.style.position=\"relative\"),s=c.offset(),o=ce.css(e,\"top\"),u=ce.css(e,\"left\"),(\"absolute\"===l||\"fixed\"===l)&&-1<(o+u).indexOf(\"auto\")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),v(t)&&(t=t.call(e,n,ce.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),\"using\"in t?t.using.call(e,f):c.css(f)}},ce.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){ce.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if(\"fixed\"===ce.css(r,\"position\"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&\"static\"===ce.css(e,\"position\"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=ce(e).offset()).top+=ce.css(e,\"borderTopWidth\",!0),i.left+=ce.css(e,\"borderLeftWidth\",!0))}return{top:t.top-i.top-ce.css(r,\"marginTop\",!0),left:t.left-i.left-ce.css(r,\"marginLeft\",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&\"static\"===ce.css(e,\"position\"))e=e.offsetParent;return e||J})}}),ce.each({scrollLeft:\"pageXOffset\",scrollTop:\"pageYOffset\"},function(t,i){var o=\"pageYOffset\"===i;ce.fn[t]=function(e){return M(this,function(e,t,n){var r;if(y(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),ce.each([\"top\",\"left\"],function(e,n){ce.cssHooks[n]=Ye(le.pixelPosition,function(e,t){if(t)return t=Ge(e,n),_e.test(t)?ce(e).position()[n]+\"px\":t})}),ce.each({Height:\"height\",Width:\"width\"},function(a,s){ce.each({padding:\"inner\"+a,content:s,\"\":\"outer\"+a},function(r,o){ce.fn[o]=function(e,t){var n=arguments.length&&(r||\"boolean\"!=typeof e),i=r||(!0===e||!0===t?\"margin\":\"border\");return M(this,function(e,t,n){var r;return y(e)?0===o.indexOf(\"outer\")?e[\"inner\"+a]:e.document.documentElement[\"client\"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body[\"scroll\"+a],r[\"scroll\"+a],e.body[\"offset\"+a],r[\"offset\"+a],r[\"client\"+a])):void 0===n?ce.css(e,t,i):ce.style(e,t,n,i)},s,n?e:void 0,n)}})}),ce.each([\"ajaxStart\",\"ajaxStop\",\"ajaxComplete\",\"ajaxError\",\"ajaxSuccess\",\"ajaxSend\"],function(e,t){ce.fn[t]=function(e){return this.on(t,e)}}),ce.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,\"**\"):this.off(t,e||\"**\",n)},hover:function(e,t){return this.on(\"mouseenter\",e).on(\"mouseleave\",t||e)}}),ce.each(\"blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu\".split(\" \"),function(e,n){ce.fn[n]=function(e,t){return 0<arguments.length?this.on(n,null,e,t):this.trigger(n)}});var en=/^[\\s\\uFEFF\\xA0]+|([^\\s\\uFEFF\\xA0])[\\s\\uFEFF\\xA0]+$/g;ce.proxy=function(e,t){var n,r,i;if(\"string\"==typeof t&&(n=e[t],t=e,e=n),v(e))return r=ae.call(arguments,2),(i=function(){return e.apply(t||this,r.concat(ae.call(arguments)))}).guid=e.guid=e.guid||ce.guid++,i},ce.holdReady=function(e){e?ce.readyWait++:ce.ready(!0)},ce.isArray=Array.isArray,ce.parseJSON=JSON.parse,ce.nodeName=fe,ce.isFunction=v,ce.isWindow=y,ce.camelCase=F,ce.type=x,ce.now=Date.now,ce.isNumeric=function(e){var t=ce.type(e);return(\"number\"===t||\"string\"===t)&&!isNaN(e-parseFloat(e))},ce.trim=function(e){return null==e?\"\":(e+\"\").replace(en,\"$1\")},\"function\"==typeof define&&define.amd&&define(\"jquery\",[],function(){return ce});var tn=ie.jQuery,nn=ie.$;return ce.noConflict=function(e){return ie.$===ce&&(ie.$=nn),e&&ie.jQuery===ce&&(ie.jQuery=tn),ce},\"undefined\"==typeof e&&(ie.jQuery=ie.$=ce),ce});\n/*\n * jQuery throttle / debounce - v1.1 - 3/7/2010\n * http://benalman.com/projects/jquery-throttle-debounce-plugin/\n * \n * Copyright (c) 2010 \"Cowboy\" Ben Alman\n * Dual licensed under the MIT and GPL licenses.\n * http://benalman.com/about/license/\n */\n(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);\n/*!\n * imagesLoaded PACKAGED v4.1.4\n * JavaScript is all like \"You images are done yet or what?\"\n * MIT License\n */\n!function(e,t){\"function\"==typeof define&&define.amd?define(\"ev-emitter/ev-emitter\",t):\"object\"==typeof module&&module.exports?module.exports=t():e.EvEmitter=t()}(\"undefined\"!=typeof window?window:this,function(){function e(){}var t=e.prototype;return t.on=function(e,t){if(e&&t){var i=this._events=this._events||{},n=i[e]=i[e]||[];return n.indexOf(t)==-1&&n.push(t),this}},t.once=function(e,t){if(e&&t){this.on(e,t);var i=this._onceEvents=this._onceEvents||{},n=i[e]=i[e]||{};return n[t]=!0,this}},t.off=function(e,t){var i=this._events&&this._events[e];if(i&&i.length){var n=i.indexOf(t);return n!=-1&&i.splice(n,1),this}},t.emitEvent=function(e,t){var i=this._events&&this._events[e];if(i&&i.length){i=i.slice(0),t=t||[];for(var n=this._onceEvents&&this._onceEvents[e],o=0;o<i.length;o++){var r=i[o],s=n&&n[r];s&&(this.off(e,r),delete n[r]),r.apply(this,t)}return this}},t.allOff=function(){delete this._events,delete this._onceEvents},e}),function(e,t){\"use strict\";\"function\"==typeof define&&define.amd?define([\"ev-emitter/ev-emitter\"],function(i){return t(e,i)}):\"object\"==typeof module&&module.exports?module.exports=t(e,require(\"ev-emitter\")):e.imagesLoaded=t(e,e.EvEmitter)}(\"undefined\"!=typeof window?window:this,function(e,t){function i(e,t){for(var i in t)e[i]=t[i];return e}function n(e){if(Array.isArray(e))return e;var t=\"object\"==typeof e&&\"number\"==typeof e.length;return t?d.call(e):[e]}function o(e,t,r){if(!(this instanceof o))return new o(e,t,r);var s=e;return\"string\"==typeof e&&(s=document.querySelectorAll(e)),s?(this.elements=n(s),this.options=i({},this.options),\"function\"==typeof t?r=t:i(this.options,t),r&&this.on(\"always\",r),this.getImages(),h&&(this.jqDeferred=new h.Deferred),void setTimeout(this.check.bind(this))):void a.error(\"Bad element for imagesLoaded \"+(s||e))}function r(e){this.img=e}function s(e,t){this.url=e,this.element=t,this.img=new Image}var h=e.jQuery,a=e.console,d=Array.prototype.slice;o.prototype=Object.create(t.prototype),o.prototype.options={},o.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)},o.prototype.addElementImages=function(e){\"IMG\"==e.nodeName&&this.addImage(e),this.options.background===!0&&this.addElementBackgroundImages(e);var t=e.nodeType;if(t&&u[t]){for(var i=e.querySelectorAll(\"img\"),n=0;n<i.length;n++){var o=i[n];this.addImage(o)}if(\"string\"==typeof this.options.background){var r=e.querySelectorAll(this.options.background);for(n=0;n<r.length;n++){var s=r[n];this.addElementBackgroundImages(s)}}}};var u={1:!0,9:!0,11:!0};return o.prototype.addElementBackgroundImages=function(e){var t=getComputedStyle(e);if(t)for(var i=/url\\((['\"])?(.*?)\\1\\)/gi,n=i.exec(t.backgroundImage);null!==n;){var o=n&&n[2];o&&this.addBackground(o,e),n=i.exec(t.backgroundImage)}},o.prototype.addImage=function(e){var t=new r(e);this.images.push(t)},o.prototype.addBackground=function(e,t){var i=new s(e,t);this.images.push(i)},o.prototype.check=function(){function e(e,i,n){setTimeout(function(){t.progress(e,i,n)})}var t=this;return this.progressedCount=0,this.hasAnyBroken=!1,this.images.length?void this.images.forEach(function(t){t.once(\"progress\",e),t.check()}):void this.complete()},o.prototype.progress=function(e,t,i){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded,this.emitEvent(\"progress\",[this,e,t]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,e),this.progressedCount==this.images.length&&this.complete(),this.options.debug&&a&&a.log(\"progress: \"+i,e,t)},o.prototype.complete=function(){var e=this.hasAnyBroken?\"fail\":\"done\";if(this.isComplete=!0,this.emitEvent(e,[this]),this.emitEvent(\"always\",[this]),this.jqDeferred){var t=this.hasAnyBroken?\"reject\":\"resolve\";this.jqDeferred[t](this)}},r.prototype=Object.create(t.prototype),r.prototype.check=function(){var e=this.getIsImageComplete();return e?void this.confirm(0!==this.img.naturalWidth,\"naturalWidth\"):(this.proxyImage=new Image,this.proxyImage.addEventListener(\"load\",this),this.proxyImage.addEventListener(\"error\",this),this.img.addEventListener(\"load\",this),this.img.addEventListener(\"error\",this),void(this.proxyImage.src=this.img.src))},r.prototype.getIsImageComplete=function(){return this.img.complete&&this.img.naturalWidth},r.prototype.confirm=function(e,t){this.isLoaded=e,this.emitEvent(\"progress\",[this,this.img,t])},r.prototype.handleEvent=function(e){var t=\"on\"+e.type;this[t]&&this[t](e)},r.prototype.onload=function(){this.confirm(!0,\"onload\"),this.unbindEvents()},r.prototype.onerror=function(){this.confirm(!1,\"onerror\"),this.unbindEvents()},r.prototype.unbindEvents=function(){this.proxyImage.removeEventListener(\"load\",this),this.proxyImage.removeEventListener(\"error\",this),this.img.removeEventListener(\"load\",this),this.img.removeEventListener(\"error\",this)},s.prototype=Object.create(r.prototype),s.prototype.check=function(){this.img.addEventListener(\"load\",this),this.img.addEventListener(\"error\",this),this.img.src=this.url;var e=this.getIsImageComplete();e&&(this.confirm(0!==this.img.naturalWidth,\"naturalWidth\"),this.unbindEvents())},s.prototype.unbindEvents=function(){this.img.removeEventListener(\"load\",this),this.img.removeEventListener(\"error\",this)},s.prototype.confirm=function(e,t){this.isLoaded=e,this.emitEvent(\"progress\",[this,this.element,t])},o.makeJQueryPlugin=function(t){t=t||e.jQuery,t&&(h=t,h.fn.imagesLoaded=function(e,t){var i=new o(this,e,t);return i.jqDeferred.promise(h(this))})},o.makeJQueryPlugin(),o});\n/*! lz-string-1.3.3-min.js | (c) 2013 Pieroxy | Licensed under a WTFPL license */\nvar 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}\n/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/dist/FileSaver.js */\n(function(a,b){if(\"function\"==typeof define&&define.amd)define([],b);else if(\"undefined\"!=typeof exports)b();else{b(),a.FileSaver={exports:{}}.exports}})(this,function(){\"use strict\";function b(a,b){return\"undefined\"==typeof b?b={autoBom:!1}:\"object\"!=typeof b&&(console.warn(\"Deprecated: Expected third argument to be a object\"),b={autoBom:!b}),b.autoBom&&/^\\s*(?:text\\/\\S*|application\\/xml|\\S*\\/\\S*\\+xml)\\s*;.*charset\\s*=\\s*utf-8/i.test(a.type)?new Blob([\"\\uFEFF\",a],{type:a.type}):a}function c(a,b,c){var d=new XMLHttpRequest;d.open(\"GET\",a),d.responseType=\"blob\",d.onload=function(){g(d.response,b,c)},d.onerror=function(){console.error(\"could not download file\")},d.send()}function d(a){var b=new XMLHttpRequest;b.open(\"HEAD\",a,!1);try{b.send()}catch(a){}return 200<=b.status&&299>=b.status}function e(a){try{a.dispatchEvent(new MouseEvent(\"click\"))}catch(c){var b=document.createEvent(\"MouseEvents\");b.initMouseEvent(\"click\",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),a.dispatchEvent(b)}}var f=\"object\"==typeof window&&window.window===window?window:\"object\"==typeof self&&self.self===self?self:\"object\"==typeof global&&global.global===global?global:void 0,a=/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),g=f.saveAs||(\"object\"!=typeof window||window!==f?function(){}:\"download\"in HTMLAnchorElement.prototype&&!a?function(b,g,h){var i=f.URL||f.webkitURL,j=document.createElement(\"a\");g=g||b.name||\"download\",j.download=g,j.rel=\"noopener\",\"string\"==typeof b?(j.href=b,j.origin===location.origin?e(j):d(j.href)?c(b,g,h):e(j,j.target=\"_blank\")):(j.href=i.createObjectURL(b),setTimeout(function(){i.revokeObjectURL(j.href)},4E4),setTimeout(function(){e(j)},0))}:\"msSaveOrOpenBlob\"in navigator?function(f,g,h){if(g=g||f.name||\"download\",\"string\"!=typeof f)navigator.msSaveOrOpenBlob(b(f,h),g);else if(d(f))c(f,g,h);else{var i=document.createElement(\"a\");i.href=f,i.target=\"_blank\",setTimeout(function(){e(i)})}}:function(b,d,e,g){if(g=g||open(\"\",\"_blank\"),g&&(g.document.title=g.document.body.innerText=\"downloading...\"),\"string\"==typeof b)return c(b,d,e);var h=\"application/octet-stream\"===b.type,i=/constructor/i.test(f.HTMLElement)||f.safari,j=/CriOS\\/[\\d]+/.test(navigator.userAgent);if((j||h&&i||a)&&\"undefined\"!=typeof FileReader){var k=new FileReader;k.onloadend=function(){var a=k.result;a=j?a:a.replace(/^data:[^;]*;/,\"data:attachment/file;\"),g?g.location.href=a:location=a,g=null},k.readAsDataURL(b)}else{var l=f.URL||f.webkitURL,m=l.createObjectURL(b);g?g.location=m:location.href=m,g=null,setTimeout(function(){l.revokeObjectURL(m)},4E4)}});f.saveAs=g.saveAs=g,\"undefined\"!=typeof module&&(module.exports=g)});\n/*! console_hack.js | (c) 2015 Thomas Michael Edwards | Licensed under SugarCube's Simple BSD license */\n!function(){for(var methods=[\"assert\",\"clear\",\"count\",\"debug\",\"dir\",\"dirxml\",\"error\",\"exception\",\"group\",\"groupCollapsed\",\"groupEnd\",\"info\",\"log\",\"markTimeline\",\"profile\",\"profileEnd\",\"table\",\"time\",\"timeEnd\",\"timeline\",\"timelineEnd\",\"timeStamp\",\"trace\",\"warn\"],length=methods.length,noop=function(){},console=window.console=window.console||{};length--;){var method=methods[length];console[method]||(console[method]=noop)}}();\n}else{document.documentElement.setAttribute(\"data-init\", \"lacking\");}\n</script>\n<style id=\"style-normalize\" type=\"text/css\">/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}</style>\n<style id=\"style-init-screen\" type=\"text/css\">@keyframes init-loading-spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}#init-screen{display:none;z-index:500000;position:fixed;top:0;left:0;height:100%;width:100%;font:28px/1 Helmet,Freesans,sans-serif;font-weight:700;color:#eee;background-color:#111;text-align:center}#init-screen>div{display:none;position:relative;margin:0 auto;max-width:1136px;top:25%}html[data-init=lacking] #init-screen,html[data-init=loading] #init-screen,html[data-init=no-js] #init-screen{display:block}html[data-init=lacking] #init-lacking,html[data-init=no-js] #init-no-js{display:block;padding:0 1em}html[data-init=no-js] #init-no-js{color:red}html[data-init=loading] #init-loading{display:block;border:24px solid transparent;border-radius:50%;border-top-color:#7f7f7f;border-bottom-color:#7f7f7f;width:100px;height:100px;animation:init-loading-spin 2s linear infinite}html[data-init=loading] #init-loading>div{text-indent:9999em;overflow:hidden;white-space:nowrap}html[data-init=loading] #passages,html[data-init=loading] #ui-bar{display:none}</style>\n<style id=\"style-font\" type=\"text/css\">@font-face{font-family:tme-fa-icons;src:url('data:application/octet-stream;base64,d09GRgABAAAAADLAAA8AAAAAWHgAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABWAAAADsAAABUIIslek9TLzIAAAGUAAAAQwAAAFY+IEkIY21hcAAAAdgAAAG8AAAF3rob9jFjdnQgAAADlAAAABMAAAAgBtX/BGZwZ20AAAOoAAAFkAAAC3CKkZBZZ2FzcAAACTgAAAAIAAAACAAAABBnbHlmAAAJQAAAI6gAADv+gJOpzGhlYWQAACzoAAAAMwAAADYY1IZaaGhlYQAALRwAAAAgAAAAJAfCBClobXR4AAAtPAAAAJEAAAFMBfb/0WxvY2EAAC3QAAAAqAAAAKhjiHI5bWF4cAAALngAAAAgAAAAIAFjDA9uYW1lAAAumAAAAY0AAAL94+zEpHBvc3QAADAoAAACHAAAA11cG/YjcHJlcAAAMkQAAAB6AAAAhuVBK7x4nGNgZGBg4GIwYLBjYHJx8wlh4MtJLMljkGJgYYAAkDwymzEnMz2RgQPGA8qxgGkOIGaDiAIAJjsFSAB4nGNgZNZgnMDAysDAVMW0h4GBoQdCMz5gMGRkAooysDIzYAUBaa4pDA4vGF4EMgf9z2KIYg5imAYUZgTJAQDSIQumAHic7dTVbltRAETR7dpNCikzQ8rMzMxt/M39mHnsU1/TfZz5jFpaV7pXJunMDLAZmOqaZjD5y4Tx+uPTyeL5lG2L5zN+L94zG8+ztr7ulXH1fra4bvK9M79xiWW2sNXPbWeFHexkF7vZw172sZ8DHOQQhznCUY5xnBOc5BSnOcNZVjnHeS5wkUtc5gpX/f3r3OAmt7jNHe5yj/s84CGPeMwTnvKM57zgJa94zRve8o73fOAjn/jMF77yje/84Ce/WGPun1zi/2tlXKbp3Xyc44bFyZanSWokJDXOOjXSk/LUSXn+pEwCKTNBaqQqZU5IjX+XMjukTBEp80TKZJEyY6RMGylzR8oEkjKLpEwlKfNJyqSSMrOkTC8pc0zKRJMy26RMOSnzTsrkk7IDpGwDKXtByoaQsiukbA0p+0PKJpGyU6RsFyl7RmosQcrukbKFpOwjKZtJyo6Ssq2k7C0pG0zKLpOy1aTsNymbTsrOk7L9pNwBUi4CKbeBlCtByr0g5XKQckNIuSak3BVSLgwpt4aUq0PK/SHlEpFyk0i5TqTcKVIuFim3i5QrRso9I+WykXLjXOYNzP8BuAPUwHicY2BAAxIQyBz0PwuEARJsA90AeJytVml300YUHXlJnIQsJQstamHExGmwRiZswYAJQbJjIF2crZWgixQ76b7xid/gX/Nk2nPoN35a7xsvJJC053Cak6N3583VzNtlElqS2AvrkZSbL8XU1iaN7DwJ6YZNy1F8KDt7IWWKyd8FURCtltq3HYdERCJQta6wRBD7HlmaZHzoUUbLtqRXTcotPekuW+NBvVXffho6yrE7oaRmM3RoPbIlVRhVokimPVLSpmWo+itJK7y/wsxXzVDCiE4iabwZxtBI3htntMpoNbbjKIpsstwoUiSa4UEUeZTVEufkigkMygfNkPLKpxHlw/yIrNijnFawS7bT/L4vead3OT+xX29RtuRAH8iO7ODsdCVfhFtbYdy0k+0oVBF213dCbNnsVP9mj/KaRgO3KzK90IxgqXyFECs/ocz+IVktnE/5kkejWrKRE0HrZU7sSz6B1uOIKXHNGFnQ3dEJEdT9kjMM9pg+Hvzx3imWCxMCeBzLekclnAgTKWFzNEnaMHJgJWWLKqn1rpg45XVaxFvCfu3a0ZfOaONQd2I8Ww8dWzlRyfFoUqeZTJ3aSc2jKQ2ilHQmeMyvAyg/oklebWM1iZVH0zhmxoREIgIt3EtTQSw7saQpBM2jGb25G6a5di1apMkD9dyj9/TmVri501PaDvSzRn9Wp2I62AvT6WnkL/Fp2uUiRen66Rl+TOJB1gIykS02w5SDB2/9DtLL15YchdcG2O7t8yuofdZE8KQB+xvQHk/VKQlMhZhViFZAYq1rWZbJ1awWqcjUd0OaVr6s0wSKchwXx76Mcf1fMzOWmBK+34nTsyMuPXPtSwjTHHybdT2a16nFcgFxZnlOp1mW7+s0x/IDneZZntfpCEtbp6MsP9RpgeVHOh1jeUELmnTfwZCLMOQCDpAwhKUDQ1hegiEsFQxhuQhDWBZhCMslGMLyYxjCchmGsLysZdXUU0nj2plYBmxCYGKOHrnMReVqKrlUQrtoVGpDnhJulVQUz6p/ZaBePPKGObAWSJfIml8xzpWPRuX41hUtbxo7V8Cx6m8fjvY58VLWi4U/Bf/V1lQlvWLNw5Or8BuGnmwnqjapeHRNl89VPbr+X1RUWAv0G0iFWCjKsmxwZyKEjzqdhmqglUPMbMw8tOt1y5qfw/03MUIWUP34NxQaC9yDTllJWe3grNXX27LcO4NyOBMsSTE38/pW+CIjs9J+kVnKno98HnAFjEpl2GoDrRW82ScxD5neJM8EcVtRNkja2M4EiQ0c84B5850EJmHqqg3kTuGGDfgFYW7BeSdconqjLIfuRezzKKT8W6fiRPaoaIzAs9kbYa/vQspvcQwkNPmlfgxUFaGpGDUV0DRSbqgGX8bZum1Cxg70Iyp2w7Ks4sPHFveVkm0ZhHykiNWjo5/WXqJOqtx+ZhSX752+BcEgNTF/e990cZDKu1rJMkdtA1O3GpVT15pD41WH6uZR9b3j7BM5a5puuiceel/TqtvBxVwssPZtDtJSJhfU9WGFDaLLxaVQ6mU0Se+4BxgWGNDvUIqN/6v62HyeK1WF0XEk307Ut9HnYAz8D9h/R/UD0Pdj6HINLs/3mhOfbvThbJmuohfrp+g3MGutuVm6BtzQdAPiIUetjrjKDXynBnF6pLkc6SHgY90V4gHAJoDF4BPdtYzmUwCj+Yw5PsDnzGHQZA6DLeYw2GbOGsAOcxjsMofBHnMYfMGcdYAvmcMgZA6DiDkMnjAnAHjKHAZfMYfB18xh8A1z7gN8yxwGMXMYJMxhsK/p1jDMLV7QXaC2QVWgA1NPWNzD4lBTZcj+jheG/b1BzP7BIKb+qOn2kPoTLwz1Z4OY+otBTP1V050h9TdeGOrvBjH1D4OY+ky/GMtlBr+MfJcKB5RdbD7n74n3D9vFQLkAAQAB//8AD3icrXsLcFzlleZ//v+++nb37dfte/VotVrdrW5JltuKpO6WJVluPyXbsmOEbGRjO4KVjWPZlsM4QIU4IYGlgCE2yxqKIQkJg2GreKQCTCZb1CZkiswjzOwOmSTATNVWTZLdDUwSMrVDsomD23vOf69assFAqgbk+773P4//nPOdc/5mwNjFl8WjosbaWblmxiOmIlTGYXzb11M7Z2ohAMbZCcZ5iG9prZl4whfwGju05xtttitUdwXYEUgkbQtWga5lC+XBaqJI285qpb8dVEc8Gnm5L5QM/f58yAlB399a7dD0mWAmdAqaMvBmKPKX9TdDwSjod9yhx03FAPcvI6Gk2lV33XoXUtKgL8C6Wa0WSzXbVjhg6JoqIPShCK0FOvOuE48K1V4B1VUQAVevugmP7Fz2CmTzW5/8+ZGP/+Kp7h/8oI4MuOZ7M5B9IvujH2Wf+PnCAjzn8ZK6AieMKRcvXnxWWSWCzGARlPcqtqs21WZzEBFgYIVDAYWzVJIrXBlH+hXGlWNM00GAJmYZ8sKBzTJFVZVppijqDFMVdTIWLa0o5JrdaHusPZGIG1IjFhQGK2mAZEe56kJnR1bTY7ZT7eivFGODBTdma3pHtlCNDVbwmgMHx/aO4R8ffeet5/ZCG6TfuV03IaSJU3oIzKsGO9+5PV+BwU5xqnOQx1aO8fW71yvD9fPn55/fA22PmsaFvfSgwZ8wzPiFvZ2DUMnzJ2hHVDMmHucPsSRrq7UQo4DMAV/AW7CANw/Zru3NIx20bBEpXwukArlxxOPReibaG63/SyQyiftzcBy3k1HuOHgjEgFHnkYfh4VodDJC4138Ff8hv5PlWbrWmm2O6grNEgGNCWGnbFtRm1Z04gzQPPWvkqMWF4eWU8DB267Df+gNe84bBvfRpfNI5Ny5yAmHDh5/PPLuByMlekDS9DsRR73nWHetwBShSO5PqCBQONO4E2wGlSvYZG6gMzeQ09SWFZC0tWION3oOVVXGTbGM+hrAzQj0O25yoN8R8YzzRsaZdzLwhpsGPEm783hAJ9+kq286eDX5pn/VydDjvk7i8EuchU21JJ3DNOqFzeABmywPcNXxhu/wB+3whrqwVw7Cn1j8vPfdDH6O7PR3fDV/Cb85wua/waSit309grZJHHOhHEQ9CA7zTGVCUb0ZvXzc1lrRe5Af+4An0aSL9op0IU9y6vRFtAYGKy7KJGFbQrdg2dXqGAwWilld0zUy9xLqd6A/zeFuy7gzYFmBOwOhZ6NNhZakm8YTI7S1pyM1mM032V26qevXGlzZ8+TKvROlB/BBkO9ACDalB7OZuBnuC5tRcAItpalENNOfhajVH1A2a1HjbHZ4N4r54oWLz4qPoe4jrMo2sonapm5QRQBQ3XycKVxwRRxjQuVCnWc6mrzOZ5FvBiraOmia5FubYRpok8n0ioRTKOQMNbWiszxYWAFZrQ1sB+dDJTFYghzyiBN3oB857ndIAha4Se/+YGUtjAkXXUO2xPE2eoe3TWPeMOXmzNi+j9w1HghvVbSAmu4c6nFac6MgbzXFU2baDr1241+98TfHtU/9t7df+MzU4msmfPYj06Wbw8Gqohda0/FkSyiyvtPGG/FsMKq1pLqmPvndkye/+y+08eYIHEJZpFmJra2Nop/VWuKcCwPvgRhnGlOFps6iIdAEmFVAKh53jblZyBU6nAFdbfX03tGwioZ9oGnEyDSWTQCyFzhoR+s/jdjgWLmc3L2K21zEmXCsM5aDm4g9Ny5v0PZVb+dY9Rcd/sl5eTiPj0nTaeiU+BhhW2qbuzJcUy2Nc2gCrjBkxWCqZiArGgOuwSzjAlDb5L91XfpvfYbpij6ZRIUWYoVcLqC2+UqNLddsMrekY3GZztVl2uQjpl4xjedIM+Uybc/r5viShuHgcgXuwQtpuoMHz8utCe/s8S+Y/7xMaYu2DX1yDrez3lp3cyyKdop+HLcLi878Uh9SKOSlj73cOIUFRVKVKHhaSS9JP452RCcYoJ3w85bz8Ckp9VN4xeZj9atpH4FnPCV4OtiDNIVYCrWwsbauK81VxUlaQnA+riFBisoUsiU0LbQpASCmmRAwg1MNJoH19uQ6WpriUV1jIQjphA5QjosiTfiy1tF+kPJKMTFYpAu6lkx40odnTv7VjYtC/QtTJyGH9HmMnKamGrcaqmaagRsMUwR9WeLmwsQREvIRevSvYa8uVFXo9Sc0w5A8/Rp5+jcxhXLuYAOIx/pbY+ggFp0FV8lNoLNAEQvyDkwBZR9T1ZC6xR0qFgsybix3DJcR7iIGwCsCHHQM0nYKVSBXQZPnqG7KDZiqrn8K524gpN9ghAx42k4GsvF3nohnA0kbnglkC9mrl7h4Db2TommKcVE1QOPRd97K5WJxsKO5nIjHbHtx/og3kK8iWys1he/EkKlqCbFOB6iKQp5Q5Yp6DB0AsjmPvHEFSGsoFraPaVpI2zLc2lmudErjJ/eeQwbKPoRBZulcwhwXYc6i1SdiEpiCF+KrFOIrAzKaHdhQ79tw4MAGuJv4rt8sQQu80jloGnnDfNVJBa+vn1WjSg1d8NHrg44FbTgdJ5+T77yy/gDI5wY7633yTbI7+CdyMDyEL2paDd0BvZjyfIYXH2/H+aqjDfXUisgnk3rFYMePoyZBegWanQpM5hKdlUSU1JnoQH2iG1d90IYADi0JPV2/oxMEeB7apm+aBngFw/ObMjzHzv7dgzyOh48fHZnmO9c8Wv+2RAGwHiP20UNnzx46mvYxyaMixDpZX22lQqQgRDqG4kYcMo92cpypAOo0Ti+iSYXJRGc5l8wvQhPfqpE0SYa7nDwkeQyh26OOlbecqVumoCwJ8+mDm+9/5T4eOyOt+4wk8WjavYTIG+7nD5Li2cWv8zGkMYoz51q2u3Y1JQSwfcumSn9JUxW0CZIWQ5isqKCo8zoGFPybx/lyHD2w4AaCBw7Ap1HIxAaHyZlr1tXG1owMt7h5Ox5QmxF4Iv6vDhaQoTFAYADuYIlnLa7b7RwtiOBDtVK1dbyCMXXxn5azOIIKfLFKaQP9K3HKIMYEQosvhkIWH23TQ9wIpCq9M4WxycnJsQIUYrEJ/bPGuOZohfHVzdmMaAmHm418c7DU3xdoyYPebFktPJtpHu7fefjw4R0VHiNTa06ZUTPe09a1sdTUVNrYtbo3nth11VW7tBa1d/U1a1t71rdG2u1IJNkWDYdbUs0pnnFT+OloWzISsdsjqVpvy9prqrNjed41POfPx2+J7TIXaWP5Wgf5bvToBEvpppQYOXPOJoda4gTQE6TsNK8sAvUSSHBFygfnfM9wL+8aK/Bddv0tZ8SufyKZ7ml7s20iCWdsPpPu4YVaXuur/2M6WX8riReTE21vtPUAnn4iyTxdf0vJ+/QM0pwsUL4D5BmUBQEeXpaU4W6RtExzN1In7eT9qHPpIoUdqAzSrdyHIPo1JNRps1uioCWJyIm2U/JG8oO4aZMXozF8b4RupRd5JJv7Nn8ZeUyxjlrakhJHcwO2gHMUDgGLR0MmS0GrIoMRWos0K81LUnPZYgmkw6sM8HtCoQTaT9y0Wu3f/MZuCYfijhMPhUVQNdL2hY8kMroS/8UvEqqeSfC/xzPV07k3vsqyrL+2ykYnhJjEz45OLIdbu4ncrbrWhImzltU7oqqaXAEdMWiHxPsSdvuF70K6/xf6FejjL13YBvFVP+UXrkwnyelZjBcltoLypQIoEmsoiDUw4C2QFS/I/J6yx5ybWOOqaMad0kJlKo+ElAdLqvRTMqOsgucuM64j3hgHU1H1mIkQ084Oje3eXT1lZwL1nwaD0BZMNfFTcHpv+sf7v6LEo4oZMlRbFNqH9tb60nEN0UkQ0mYawZNpR878eFuD1lWsl/Jb9J5iMbPlDKnkh3raBmS66U1M9Jm5rKUmMel1dKLOcxrVSgf5dJqU4o0g0pJyTlV37x4bytpCATOG8VUT4+m9cPoURiakE34ZMes/wbB0Roun+2p7h9oLSlwzQqZq2eIr+xe2/Rhp5QF8hHn5Hh/FfM9ibs32UrNG+l22ZbrnJ8N+fERAcD6YCp6nuPc2Aq/vWXiMfzKaye/BDfzTLPwe33MT8ns4P/y0uiLBdyZw3qRvNvGZegjF6H+escXvreOnkD7zm7IkADTbJEkU4sdw1jmwzpTj42smHLB82ijenjfx9YsXkccR+B5+I1azGtQk+4maTpnLlsBL75E7O1IPea+mzfPmUwQt00FJoG+nPxN/zruZzZprTljyx2GpXiHdYWBZtcINeB+2xVP16/GT9euDwf00TbqgK5gK7QvCmfp/wPn15WDa3BcM1l/Hy8F9wZQ31nf4Q2IjjrXyG+BnzXnMmqXiTuB5CLa01gINjvb8mesSTwHuSAEtzm8anp+uvwbdprkfhUs0wCNIxH6TP1l/vf6aPDThK0TXI5I+tjj+SX/8wIcaPxWX4y+CqsCiEIiAIzhsKrgfh+6qv+4L4RETPl6/zqMKukki9AA96OseZb3Zk7UKVKxZKt65tpR1J9p1sTGgP5Z4ah+KEzl73R/xEfr+I8H5fchlN/Jr0n0c3fSGkrz+vbhd5m2ZWltThDeKUaKh3WTZXWauS+WomBdMkjGvOCRuT9YfcIZxk0x24/5cT3q8redxe8TpTsLn03b9LIaFo/I0eQ7uxtjQm6rffI4elnTcJfbwX/qRFyG+Vw+SaJdyFIpugk0WXCcnaZFo1323viNAWHZPvk1+ugfjTf2sbcPR5LDT442bhwPj6Z5z9qi9wr8B85Ji51yXb3tISxlpSUtaZEYnFX8ZbHI6C8vk4ll2h5/YdRQbM0CUbSmXHsd5rH5zWz7fBnc/5iA1NLANwyQZ2+5JjiYfQ4mle+BxJA1prT9g+770dv4zTz9RnTPp+JlY4DJKoroOucmyT4fnsGIeFC3H9EtmB+qnGyP6413tPvs4BhIwipskDKakeIg+KKTgbl92JBkkHn1J3c8t+9ia2vBKhMFkGBJtEjrGDIzKE1SeAgTJiDAVRYpKmSGwMlksJor5gUWgjKlXYS0gurS4neaYflXJnaWBUjDKNAVhkWoF1WhHz7uJ2PapE8NHJkulySPD62/qVmLapMq10a997JqvnphQarc8dO3UQ2smYr38pfOWszK6fTs+eBKfHy4j8t2uWNrWnbDx5CNfe+TkxrHVE/EEW4ynxM9H2FhtpAeE2tnGFUH1J4xXChxD5hACLNXbLgOA3WU353rI37Y44SipbwdxwED/mEC0rOmuIzmlGkw7SBzNxZ6NN3519+zXRhV1Uosp3TdtGD68s4eXJo8uzHVtjyXc85gC9MYmRh+euuaRk+vhAG43Tm3RLGW7Clp52Oesq3N7dKVjnW9KxCdWjyFvi/nUs+Ja5CnPxtn+2t4NnVwLrELw76JqDMz1MacMGJoR0I5RVsA1lR/DLEdonLJLQWnOMcSamKlrszLnWWZ3mzcVOjsrnYWynTfVNmQ6aQFxrWtL9SQtgjqsojbxf5lp+qquSF1rVGyk02qZZEEKRkPdlv9ff3LVQ6MTFMas8xSft3fNVbd+vqg1KaF5w7RwBsirUye24UVXDS3oIcj/nz+56mF6qQlUAQ++gGoNytcxFG7P98DWMXMoHIL/6l/Z7p1riv8ko2oiyiru129WsSrmUjO1XdtWc0Pr7miOoWOV9YUQ07WQPmsCisWYDge5puAUAI3NIk6EQACmaQ+BGRaAwOSemV1TH90+vnlDrZBNFOi/nEUlLL96lYx5VZLqB5zDQLFQzGm6KuUX89L6YqxRuaPsCwXYTlJE1EVJt9ycWTo8bereoW7Wv38ewfOzmgI/N42Kn53LatjTxUCv85zbEyg+Y5hTcDddq99M2ysc8/51lABfjZ++8KvSxvUlnpCj7U+mIG3vR8yhXSbXEbaB3cDmatdds4lrhi9Z8hskNo2hkI+RQHWN6fMIUwKGFZiNhDmCNq6BoR1gejCoTzNdD86woB6cPDh33YFr91w99dHJLePr1tp525NylKZkzJtthLplN+ADzhOxjpiN1trRPwb/vhKfqIcMg8Mr3DDqd38o4cM36y9KWa+Tsn7v4/ocj134Vcg2TZsf/ABFKH4tYwrtObZYYxoF3QiQC+PjATwUho5+W8MkQlOOqUDxnlMNjZpsfB8zjJCxZe2afKeTjXeuboqT2XcOlsACB6XROFhWch7AeNy/VsZfx4fO5Aj8EjTVRPjLdtrmTS1NX7Azce6kmjZnnHf+1iuBiG0duzsmQTiZPzfjEoTGAqZ7xqt/nmmai8gXOWb0/sG9z8vyyPNOZjKDf9DlRgmQR93keVlHOU/9RTkfH8W8ieTQzWpsc21DGRM0Xw4soAUWDEDPtMB0oS9I5qeXC0PhMySPyTWjuYFctn9JEgWLp6FSXdz71TeSgzuQBmnXVHPXGqWhIhXkF+H2lQXxVqiSO5OthN9CQQSazmBOhdycwSgoZRJvQ28Yz8SVltDiwd3PUxMLN9De1dWehinH5783RvA9xhpyoHgnWAfGvE3sqtqOFT25rGIoMB4GBa0NAaepg2KYyiwVijQqFKGtopEeUFFYgQCboj0jZ8cCk7U1Q2W3MBBLjMRi0SCKxO0od6gD6Muon6Q35JGLDZS9DEpfLNZTA4aqrmrD0rwHCAO8Cs/Ur4a3J0Lql9WU4RfBJiYySfg+cviqaczLvipt59LuhbjXflPdSuRLUUd/9VV422jRv6SF/NbehYrcQ1p2AZ6jd80L5+kSRwE3WV+OVGTs9GvnU6yLDbJsrZ2aE+iijskqPtuHgTAktgz0r+xtaUaslZRRH6FKlRJrBwO9bK+lef8YXipg7j8GSJjM+GRPmSApRv6n//T4VrH3qqbRaNxoqoxSNMfwD6MV18yPulftrX+xZ7gXeka7vMCPgf2aQ8+N4bPuaKz7lg2LIGjjTT3x4T4jvubPYKL+cFtPTxscwm0DA+yVNaMjbFNt/cE9k+sUpoxgas8Gu1qjhG7GqUu+oAFel8B2gTDcgt+54If2XXv1VVsmVvRkM4m4TnnrYCGLtt5foc4F2rWO/NrIbxENvBHUy0WJBYqEg8hbyklAxoATvupfHMCZ3wAHaASEAFz/Y7pUPh+ZumWK7z65G1KGftgMJro0NbIzrOvbm1sCuhL9tBGKtrof1aLaZkdRjS4zYhzSDTDVw4bldnrPGtubWgKGiH0adR1JuR9VI/qErSgB72HMk0emp2+anr6F7kfTydZ+zdKSO0EdDRuTqaip3xAIjapaLa1aWqg/kmqNQEiXzza3ZFbqId3euezR4Iiqbkj5j7ZEIeTX7X4n9vLvLmKL2mAXILVUp0WPoyLCVJVGQ+/yNlGhjP8PNLq4y9vNy9rPrn+eW36OaPmdX0nTF7EIpu9XPlvW1XMgOiHbSHIL1ji1nsbpBdbAyXtlTRwjSHuCqyJvkjfAVEiMe317oeLEURlNKa/CI7tfVLxLp5qb4tFwUFVYJ3R6/STHqy1Xi1R9RLvvd6lSPIba14rZoo6zwa3w/7L18OGzRwC+N7B52+HD2zYPfA8OP3iIH9kyjkd4Fdwj9x85skUPzfXhQd9cSN96mB+97yjgoYUXvZ7kxYu/UW7mL7Eo+rwKK9byTKWsSWWz6N8VBaZxB5ShgDJZHerscm0J6L1at2fNGPH4CqQNZ+gAGTeaPZVNBB52IJ7nt/uI3N/B0707Do+8vmEH37rpdTLX8eEDd47Xr564Y3aIj+67azM8Q4dwYHjpHbJoOu1/8OkH++lk4s59Y2Lo+tsevG1ukA/N3uHb9f9TbkFebNRET61I/GEuOEtdCkxKcdfISpPptmSn01kdVNF4Y4NjHF1rWnh0cxWZKImsJdKcKPPIkZR5RIoYkcJ7dh665dDOHqV/4jgc2ILXkYz77zgwypGsH1zKst/L+ir6nJVsPdtR2zaC4aQTZC9CR4p0jigDQ6gmexJcUeeXdbS0xY7WslzDdpPF8uryAPX0L+tqoVNFD5QrFi7rbKGXwYnkJGCpwra4XMZe1th6JZcOCL0VgV445HepqL+l5jVdKMHP1VeH89a/WtYaK2/9Z/g4noyFYduzjf6WpSS0FIKDRovrC4aaQ9ZArQ9b1r/K58P0Yhi/4Msl4WPhFbUuzCTBb1OitsjmCVsAn+Qs3eokTJ1FeEQlI1nGXNlfnbS8tcc/sYz4wU8vsbd+lr/UII5u7mncOYBJ+WKc+5jsETe/L03AXCfmN4IlTVnCOYiVSxyWr5h45up7d/Lpu568c7ey4zRcu6yjzk9P3Xvu3im5qb9yaf98ab2AwZIsy0Zrq6nXxkG22zi121ScGiC71IoiZwcZqlAmzUCmvaU5GgkkzaQfoNCjlKimWnxvGhtR5b4r0roYFX59BZLFsvVB5NMRIVAGQ65bJoBsRuaFbLJM/0n3nZCLlZaWYKj+efWy88WezKv+yiG5dKnN23mX2uUJbi5bY+Rc4XgxBrHXGnlYb637gwLPEuXVBmD1ViiIyzgRfl5f9NddvfoB9NDxw0clWD9KV0FbdhMMjzfc+H7uJXEG8fo6Ns4O1q5fU+KCCq16PhXG3JuJcczFw6GwEaLSBXkQwNwF4DgLs1AgHDqA2FToAXEgCDpj+jTudDaDgUmnGsaG9bWx1UOVctJGzBlDf2HJWgZyh1HHkeV53RK5WC6Gc8fr45AzKSByxwlWHShTsxydSgfVLhALUZsXOiS8w0TlVOdJ006bC4ZayA43j7cN9WCqeCgYDTvGJzKnKG0Jn7ou6KSC18Frs8FUk2Jch1frv65/kWLdMMbf2fWfDKac4HFdaYpb8HY9ZDXZhnEylEgHP7t2L6YMcO46M22b111HA113zoFBDJQUpy/WLx6B36K+MxQdmlHBKerm0BIJKqUu68GgoLY0VSpexdChJiDC1WpC9qwK1cQYpS7U0BW0JAzeMrX6P+hRI2Dy4z/hqqmb4gS3jG8GLT77P1Ue5E4wfOFTFoioAS8NYVYZhv9umJapaPV6hct6wHdkHiowcqVYnvUivt5Qa+3vK/X2dBXy2Uy6pclBE4pR4XkwxWHTtq93vH+tv0l2U6pFvbNRePWrv51uBFbBWmgHbw/upXv+0LnRc1AxL/RjLrVgmvx/yP0Fq1KJxarV2A+PHct2HDvWwbvxJIYX60/THfzHrcdGH7shQm/iC2l6E/fXRumtaPU/ybeyx+p34UkVL0LJv9PAUHOomzL1w8q9uZaYoV3SIOoujHBKKii60eKMxhJHXUMgTQW0InVqqErq22AbYN6BHOMkFCMtlpWLDDc/0NM23tYLZ1uGMX5ZrWfPtkQj+chQ61lZiH+gZSiai0Sbz4JhDbeswXd2PSVr8E/twqtr8KXdu690Q2KpI6jHMMuhBjdRdbG9iQslEae6YVhDV7gBdOiHgK4iKtSERkv4yOpAP8ZMpimmNqtSRuUFG50FDD2AeaYRNrasGS0P2LTwuGDncpRJNtZ5Fpev85SVhMY6T3ewBJrtjAFIs8XZi95eSXOXLJkW75wKaXmE7afkst1TsjBDJxP3v3I//kG6Z9R+ce7WnfcfrvHRo6fPnT46CpteTMJZ7yXKMb2XTlHieMpspgUYLz+k3UsJV/LFTWNH7vvT08eHlfWHHtx+69yLSbZMRhHWhDn2SG0oYCC3qE/B0qAKuZqPg+b5XkErlwWmYkKlMkNY2eLmUAqF3OJinmKjrPIhuK1/W/IJ6z8kh5K1D2aK+/UTWqOzkz1fC4xVOgKKKqgjZqKV9nhTGGOgUGnZjiK4Mq8jJFKOMwJ0UxSLdlO/Ymvrtq8H3/UG+nBNcG0e7Vh79xt/yOf37KklDMPYaeyc3LZ1y8hwT671KoP8BApooL9agOqYUm2FATeRptTcdeQGxexmC3pWyw2u5ZSr4l9xsLCKW+DaaeqxVskXZql+XdTggY9NDrcHk331MoTzqZSj3fGlCe3GxJQT6IsGjeBkQOGQO53v+VKSb9E1EVMQ5vKs2/R7axiimWAmiVCh4/MZ1eYrecvvMWx9oa71KppmNkVhBs6G6m+veHkw8amOFi0QFY4pTI7RrikRxSd1jgBaCeytDEHmYSsUN/HTEEyqQVQ6ppY4937ER/nPmMXaWK6W8TvQy1cj+s28wcIlS70LHqQsSoS5rB18abP70ubwv0VMqrRhJALnb2SJXZ76vg7pAPc9++oF2+s8XzLyZUMt/3ajhy35encPGy4n+lIy4Xvvou1JERMJFmTa8zqHldSwlaBa9k6VC63heDzM/3cYttfndDMiKlbIwCN7eV2F8FS61toUNZhCzHltUoKChwg/yah6WVnr8jIXJer+ultoizj14CWn/GfvvEU5uIjTdtnx8nw86K1TlzWF5QsXBhYXGlw+3rLk/5IB/G8+gzZuYUagPa8ByoUaWfiRIuA35I4CrJOMVariLtOCaKD+Ryq3gvWTwSDci1AAfVtQi7zzsmWE4F5Vq/+RPKDe8714vX5SVSVGuXjxa2K/iCyN42qyOkbLkXwt6FIjmt5sRsHC11VB2yANZQl1HL+GWjFC9Em4Vx7Q2oKTeB2+oKkeL3xEkBU015zWlri4VEBrpICIlwZ7Eso2mgSVKs8GLeJN5YsLnmn7Lh7/45KS6ncSg5I/Por8NcaWi7UW27Te2JeyTGPqPg3VS9j2CzJyeznjn1qaGXCrpsq8ro655n7+1zi3WwkBRkGuRl5e3eMyi6L0TvDJcnYwTnM14fWG5Xyh5nXVLya56BmNJRUi25oYoiGRJBGXdaO+Rb1Y9R861mlZYzodsf21K8/wZ1mC8I75Hr9viTsF+fsW5BzxTSO1IFQNz6DJvnC/lPv9L6Ab4KcvfJU6gC94y9NfMP31s7i5XY5RIn6LJqKRxjAKDuOVppiQA65ycUhaEvVeQya8dVuF6uCYKClVFADVGd5FyGt9RTWAAgg50ahiNFm2YkcCarHv3QTW/6Jna0TY0VA0FEpnMkbciKJ0RGSrrMN/XzzKfy7p3saOsq21cUl7FVQ2Dboqxg8D38S4hnxooL2bGRU1qurqAtP1Q1M7xzd3Sd4MKlx9aN7cxtWq/1OQAi25ohrK0s0ilVHwbgmKVNGWD1T/IMmcmd2u68h5MhPsLpW6Mf7ZEUPfceC+0zfhdXy9uTm5cQffujnZrMQFzmZdv+n0HyDOnl33Z4RjOcFoIL338N50IIpBxBEd9+2+7fV+vGGHQ5Y18NCTDw1EwkITYRu/JwZe9fPMI+IfxFUsyjbSqvKhAcwt168pdedsTBbTzZxTnRzRxQyV/if8uggP8y2VcpqWw7iyTmgJOy3GuEu5oK35P5xC0L6GZFag308hopD9/6r3KyoE7rKG5Tqi3D9z8s6TM/3+7mEeeCxiPDanxdWDjxmRxwKIeebmVFVePajGtTl5VaWLcGDdLdMVpbTvxD0n9pWUyvQtew1RfioQFOU/1vU/Lotg4KmyMEz9nnuM2OINTVu8ETPuuUeXPuNZUcFYEmd9rFRbYSxfVUjLiN9dFerqyvd2yKWFBEEB548Fup3m1PWnBQHUERnjyKYur0O1v1pBfvl30u2Hnj4EwydOw/CBOyd23vd4+YefpuUbvHb84elmO9HXD1P3Tq1f48YM5VZ17msH5/d1fPtmWQndeOwTd1EnZNeXbtwsoBRbcbJ29T3T0GbGDO+3J95aen6KxViWDVCHL8i5wsPAxPLfE1FDb55RmQnmCYgrEoijOyX+6KeDoE66Tt5ONjkSgheKBA9LqL6qpqchU0E7QaSYtJ3+irSVimrrmpLJU3ej0gsK6vTRXbdlEXtnb9u17Z9B+Un9m9Hg5rmoE93YF4zCPwZ31H9b/6f6b3cEgzvAgAIYO4IwfMe64Q03nOX3fXzD8Lo7brzrLtiCz85tCkajwb6N0b9LJD738MOfSxTs2x7mj3yGsEgjzzBYB9Xw2hGCYAZOzYWG2uR6nFlvxlJeEZfO732ziNsX84be4ffMGz7/gRmQb1dyTX8Q/dtArU8Hb8Wybmgod53NBlQOilxbg9mPCIstK3sTAzE7O5BMJuTKkvJgwfulBskXM0CBMymXLQrpkSoDMVmJ6aA2QjGG4SJkRk38g5sd61dtYGoQ4St+jHY+U23r4aVWOEjtseoMnDgvfwCEm2+hp6r/X91AK4zYkU3HMVEaxnR3qBfqPzn+/wHPnsOreJxjYGRgYABi1vIsoXh+m68M3MwvgCIMt5YoxkDp2P9f/2exVDAHAbkcDEwgUQAz1Qu/AHicY2BkYGAO+p/FwMBS9v/r/68sFQxAERQQDACh8QbyeJxdT0sVwzAMy49AkAxAkbT3UQiAITGAISmAYQiA9th4ttUs7Q568UeSlVidiwSkB3PUPg+ESd6ZD/+8v7HyrtzwghY89ZB6BcyrYqc6RZhw48YhaA1Wc/v1PQtdeXJ/HppUmFM597nvBVK7D+Z+E8/uQZLBgDyaz3Llvxx02S3c/Hv813JrznryZP4F+6lSfQAAAAAAAAAAUAC2ATABaAGyAfoCJAKwAzYDmgQSBFwExgUyBbQF/AZOBvwHRAe2B/YISgigCPIJGglCCWQJignACgAKQAp2CroLAAtGC4oL8gxcDPINng5iDuYPag/6EF4RIBGGEeQSShKYEyQTbhOyFAoUYhS+FVoVphYoFooXHBeGGFoYnhjGGOwZChlOGXgZrBneGhwaWhqgGtIbLhvyHHQc2B1QHZ4d/wABAAAAUwBtAAYAAAAAAAIAIAAwAHMAAAB2C3AAAAAAeJx1kN9q2zAUh39q0441YxcbjN3tXJWWEcc1lEGvWkLbXZeSu8JUV/6T2VKQlY48w95ifYa9zt6jd/vFESUUYiP5O5/O8ZEE4AP+QWH9nHKsWeEdozXv4A0uIu/Sf488IN9G3sMQPyLv0/+MfICv+BV5iI/4wz+owVtGM/yNrPBZfYm8g/fqW+Rd+svIA/Jd5D18UovI+/S/Ix9gqp4iD3GoniduvvR1WQU5mhxLlmap3C/FUdVWN6IXoXK+k3MpnA2maVySuza0ZlToUZ07292YctFov6k2eWp8VzsrJ0m6qa+NNV4H87Dq1j2WWQiFFN61chX7yNy7mclDUoUwPxuPN/tjAoc5lvCoUaJCgOCI9pjfDGk/BPfMEGaus2pYaDQ0GgtWVP1Kx/ico2BkaQ0zGnKCnHNL09KNuK451721rLqhLfmfht5vzdrmp7Sr3nUfC07YL92afU1r+wrd7/Dh5WwdHrmLjDawanUK3+9acPXqPML7Wq3NaHL6pL+1QHuGMd8t5/8PvPGO3QAAAHicbZLnlpswEIV9DRiwvZtseu89Ib333vvmBWRZYMVC0pHEEufpg8BO/kTncOfTaLgMOtPr97o17P1/baKPACEiDBAjQYohRhhjDevYhu3YwA7sxC7sxh7sxT7sxwEcxCEcxhEcxTEcxwmcxCmcxhmcxTmcxwVcxCVkuIwruIpruI4buIlbuI07uIt7uI8HeIhHeIwneIpneI4XeIlXeI03eIt3eI8P+IhP+Iwv+Ipv+I5N/OiF1hEz9JKxUrtFrDl1lWF9NR9QIikToRaVjUouKxvOmNBjLxnlhgo2DbnM1djLKrNGnGPScSUzItzGv93yPP2bSQSX84z9cqFQdJ56yZRmMhW8mLlJJSaBI0XYPDaZKDUviZmvr6DrNjJMi0WcK1MTM02mqpbZlJtEsNx5SI238jSodJtoS7qv+BpPw67IY9xU+dg5TXjROTWwdGrIOzWhT+uA0jolxqjaZrSOnCF2Nmq16651EYpMm1fakAul9SJQeR5QVYQlk1VkZ8SwoVNFIVjWnKQrlBGdMToftdoZjrs77DajqXKrS02YEFxbbtdWkG0x44JJVUS5aBqKSlJwmhDrmOF2Hv9Wqsy4TNqoKhfmSrrQKuNSL5nvPG6p0s0AkEWkSWVZMy1Kx3ljk03qLuZ14lTmB8gNGmByGrGfjLrhlhJV2f7SaIneNF1ypQNbybBUSgZswQaWEUNngeay1/sD4l/60HicY/DewXAiKGIjI2Nf5AbGnRwMHAzJBRsZWJ02MTAyaIEYm7mYGDkgLD4GMIvNaRfTAaA0J5DN7rSLwQHCZmZw2ajC2BEYscGhI2Ijc4rLRjUQbxdHAwMji0NHckgESEkkEGzmYWLk0drB+L91A0vvRiYGFwAMdiP0AAA=') format('woff')}</style>\n<style id=\"style-core\" type=\"text/css\">html{font:16px/1 Helmet,Freesans,sans-serif}#store-area,tw-storydata{display:none!important;z-index:0}.no-transition{transition:none!important}:fullscreen{height:100%;width:100%}body::-ms-backdrop{background:0 0}:focus{outline:thin dotted}:disabled{cursor:not-allowed!important}body{color:#eee;background-color:#111;overflow:auto}a{cursor:pointer;color:#68d;text-decoration:none;transition-duration:.2s}a:hover{color:#8af;text-decoration:underline}a.link-broken{color:#c22}a.link-broken:hover{color:#e44}a[disabled],span.link-disabled{color:#aaa;cursor:not-allowed!important;text-decoration:none}area{cursor:pointer}button{cursor:pointer;color:#eee;background-color:#35a;border:1px solid #57c;line-height:normal;padding:.4em;transition-duration:.2s;user-select:none}button:hover{background-color:#57c;border-color:#79e}button:disabled{background-color:#444;border:1px solid #666}input,select,textarea{color:#eee;background-color:transparent;border:1px solid #444;padding:.4em}select{padding:.34em .4em}input[type=text]{min-width:18em}textarea{min-width:30em;resize:vertical}input[type=checkbox],input[type=file],input[type=radio],select{cursor:pointer}input[type=range]{-webkit-appearance:none;min-height:1.2em}input[type=range]:focus{outline:0}input[type=range]::-webkit-slider-runnable-track{background:#222;border:1px solid #444;border-radius:0;cursor:pointer;height:10px;width:100%}input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;background:#35a;border:1px solid #57c;border-radius:0;cursor:pointer;height:18px;margin-top:-5px;width:33px}input[type=range]:focus::-webkit-slider-runnable-track{background:#222}input[type=range]::-moz-range-track{background:#222;border:1px solid #444;border-radius:0;cursor:pointer;height:10px;width:100%}input[type=range]::-moz-range-thumb{background:#35a;border:1px solid #57c;border-radius:0;cursor:pointer;height:18px;width:33px}input[type=range]::-ms-track{background:0 0;border-color:transparent;color:transparent;cursor:pointer;height:10px;width:calc(100% - 1px)}input[type=range]::-ms-fill-lower{background:#222;border:1px solid #444;border-radius:0}input[type=range]::-ms-fill-upper{background:#222;border:1px solid #444;border-radius:0}input[type=range]::-ms-thumb{background:#35a;border:1px solid #57c;border-radius:0;cursor:pointer;height:16px;width:33px}input:not(:disabled):focus,input:not(:disabled):hover,select:not(:disabled):focus,select:not(:disabled):hover,textarea:not(:disabled):focus,textarea:not(:disabled):hover{background-color:#333;border-color:#eee}hr{display:block;height:1px;border:none;border-top:1px solid #eee;margin:1em 0;padding:0}audio,canvas,progress,video{max-width:100%;vertical-align:middle}.error-view{background-color:#511;border-left:.5em solid #c22;display:inline-block;margin:.1em;max-width:100%;padding:0 .25em;position:relative}.error-view>.error-toggle{background-color:transparent;border:none;line-height:inherit;left:0;padding:0;position:absolute;top:0;width:1.75em}.error-view>.error{display:inline-block;margin-left:.25em}.error-view>.error-toggle+.error{margin-left:1.5em}.error-view>.error-source[hidden]{display:none}.error-view>.error-source:not([hidden]){background-color:rgba(0,0,0,.2);display:block;margin:0 0 .25em;overflow-x:auto;padding:.25em}.highlight,.marked{color:#ff0;font-weight:700;font-style:italic}.nobr{white-space:nowrap}.error-view>.error-toggle:before,.error-view>.error:before,[data-icon-after]:after,[data-icon-before]:before,[data-icon]:before,a.link-external:after{font-family:tme-fa-icons!important;font-style:normal;font-weight:900;font-variant:normal;line-height:1;speak:never;text-rendering:auto;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}[data-icon]:before{content:attr(data-icon)}[data-icon-before]:before{content:attr(data-icon-before) \"\\00a0\\00a0\"}[data-icon-after]:after{content:\"\\00a0\\00a0\" attr(data-icon-after)}.error-view>.error-toggle:before{content:\"\\e81a\"}.error-view>.error-toggle.enabled:before{content:\"\\e818\"}.error-view>.error:before{content:\"\\e80d\\00a0\\00a0\"}a.link-external:after{content:\"\\00a0\\e80e\"}</style>\n<style id=\"style-core-display\" type=\"text/css\">#story{z-index:10;margin:2.5em}@media screen and (max-width:1136px){#story{margin-right:1.5em}}#passages{max-width:54em;margin:0 auto}</style>\n<style id=\"style-core-passage\" type=\"text/css\">.passage{line-height:1.75;text-align:left;transition:opacity .4s ease-in}.passage-in{opacity:0}.passage ol,.passage ul{margin-left:.5em;padding-left:1.5em}.passage table{margin:1em 0;border-collapse:collapse;font-size:100%}.passage caption,.passage td,.passage th,.passage tr{padding:3px}@media (prefers-reduced-motion:reduce){.passage{transition:opacity 0s}}</style>\n<style id=\"style-core-macro\" type=\"text/css\">@keyframes cursor-blink{0%{opacity:1}50%{opacity:0}100%{opacity:1}}.macro-append-insert,.macro-linkappend-insert,.macro-linkprepend-insert,.macro-linkreplace-insert,.macro-prepend-insert,.macro-repeat-insert,.macro-replace-insert,.macro-timed-insert{transition:opacity .4s ease-in}.macro-append-in,.macro-linkappend-in,.macro-linkprepend-in,.macro-linkreplace-in,.macro-prepend-in,.macro-repeat-in,.macro-replace-in,.macro-timed-in{opacity:0}.macro-type-cursor:after{animation:cursor-blink 1s infinite;content:\"\\2590\";opacity:1}</style>\n<style id=\"style-ui-dialog\" type=\"text/css\">html[data-dialog] body{overflow:hidden}#ui-overlay.open{visibility:visible;transition:opacity .2s ease-in}#ui-overlay:not(.open){transition:visibility .2s step-end,opacity .2s ease-in}#ui-overlay{visibility:hidden;opacity:0;z-index:100000;position:fixed;top:-50%;left:-50%;height:200%;width:200%}#ui-dialog.open{display:block;transition:opacity .2s ease-in}#ui-dialog{display:none;opacity:0;z-index:100100;position:fixed;top:50px;margin:0;padding:0}#ui-dialog>*{box-sizing:border-box}#ui-dialog-titlebar{position:relative}#ui-dialog-close{display:block;position:absolute;right:0;top:0;white-space:nowrap}#ui-dialog-body{overflow:auto;min-width:280px;height:92%;height:calc(100% - 2.1em)}@media (prefers-reduced-motion:reduce){#ui-overlay.open{transition:opacity 0s}#ui-overlay:not(.open){transition:opacity 0s}#ui-dialog.open{transition:opacity 0s}}#ui-overlay{background-color:#000}#ui-overlay.open{opacity:.8}#ui-dialog{max-width:66em}#ui-dialog.open{opacity:1}#ui-dialog-titlebar{background-color:#444;min-height:24px}#ui-dialog-title{margin:0;padding:.2em 3.5em .2em .5em;font-size:1.5em;text-align:center;text-transform:uppercase}#ui-dialog-close{cursor:pointer;font-size:120%;margin:0;padding:0;width:3.6em;height:92%;background-color:transparent;border:1px solid transparent;transition-duration:.2s}#ui-dialog-close:hover{background-color:#b44;border-color:#d66}#ui-dialog-body{background-color:#111;border:1px solid #444;text-align:left;line-height:1.5;padding:1em}#ui-dialog-body>:first-child{margin-top:0}#ui-dialog-body hr{background-color:#444}#ui-dialog-body ul.buttons{margin:0;padding:0;list-style:none}#ui-dialog-body ul.buttons li{display:inline-block;margin:0;padding:.4em .4em 0 0}#ui-dialog-body ul.buttons>li+li>button{margin-left:1em}#ui-dialog-close{user-select:none}#ui-dialog-close{font-family:tme-fa-icons!important;font-style:normal;font-weight:900;font-variant:normal;line-height:1;speak:never;text-rendering:auto;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}</style>\n<style id=\"style-ui\" type=\"text/css\">#ui-dialog-body.settings [id|=setting-body]>div:first-child{display:table;width:100%}#ui-dialog-body.settings [id|=setting-label]{display:table-cell;padding:.4em 2em .4em 0}#ui-dialog-body.settings [id|=setting-label]+div{display:table-cell;min-width:8em;text-align:right;vertical-align:middle;white-space:nowrap}#ui-dialog-body.list{padding:0}#ui-dialog-body.list ul{margin:0;padding:0;list-style:none;border:1px solid transparent}#ui-dialog-body.list li{margin:0}#ui-dialog-body.list li:not(:first-child){border-top:1px solid #444}#ui-dialog-body.list li a{display:block;padding:.25em .75em;border:1px solid transparent;color:#eee;text-decoration:none}#ui-dialog-body.list li a:hover{background-color:#333;border-color:#eee}#ui-dialog-body.saves{padding:0 0 1px}#ui-dialog-body.saves>:not(:first-child){border-top:1px solid #444}#ui-dialog-body.saves table{border-spacing:0;width:100%}#ui-dialog-body.saves tr:not(:first-child){border-top:1px solid #444}#ui-dialog-body.saves td{padding:.33em .33em}#ui-dialog-body.saves td:first-child{min-width:1.5em;text-align:center}#ui-dialog-body.saves td:nth-child(3){line-height:1.2}#ui-dialog-body.saves td:last-child{text-align:right}#ui-dialog-body.saves .empty{color:#999;speak:none;text-align:center;user-select:none}#ui-dialog-body.saves .datestamp{font-size:75%;margin-left:1em}#ui-dialog-body.saves ul.buttons li{padding:.4em}#ui-dialog-body.saves ul.buttons>li+li>button{margin-left:.2em}#ui-dialog-body.saves ul.buttons li:last-child{float:right}#ui-dialog-body.settings div[id|=header-body]{margin:1em 0}#ui-dialog-body.settings div[id|=header-body]:first-child{margin-top:0}#ui-dialog-body.settings div[id|=header-body]:not(:first-child){border-top:1px solid #444;padding-top:1em}#ui-dialog-body.settings div[id|=header-body]>*{margin:0}#ui-dialog-body.settings h2[id|=header-heading]{font-size:1.375em}#ui-dialog-body.settings p[id|=header-desc],#ui-dialog-body.settings p[id|=setting-desc]{font-size:87.5%;margin:0 0 0 .5em}#ui-dialog-body.settings div[id|=setting-body]+div[id|=setting-body]{margin:1em 0}#ui-dialog-body.settings [id|=setting-control]{white-space:nowrap}#ui-dialog-body.settings button[id|=setting-control]{color:#eee;background-color:transparent;border:1px solid #444;padding:.4em}#ui-dialog-body.settings button[id|=setting-control]:hover{background-color:#333;border-color:#eee}#ui-dialog-body.settings button[id|=setting-control].enabled{background-color:#282;border-color:#4a4}#ui-dialog-body.settings button[id|=setting-control].enabled:hover{background-color:#4a4;border-color:#6c6}#ui-dialog-body.settings input[type=range][id|=setting-control]{max-width:35vw}#ui-dialog-body.list a,#ui-dialog-body.settings span[id|=setting-input]{user-select:none}#ui-dialog-body.saves button[id=saves-clear]:before,#ui-dialog-body.saves button[id=saves-export]:before,#ui-dialog-body.saves button[id=saves-import]:before,#ui-dialog-body.saves button[id=saves-toClipboard]:before,#ui-dialog-body.settings button[id|=setting-control].enabled:after,#ui-dialog-body.settings button[id|=setting-control]:after{font-family:tme-fa-icons!important;font-style:normal;font-weight:900;font-variant:normal;line-height:1;speak:never;text-rendering:auto;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#ui-dialog-body.saves button[id=saves-export]:before{content:\"\\e829\\00a0\"}#ui-dialog-body.saves button[id=saves-toClipboard]:before{content:\"\\e82b\\00a0\"}#ui-dialog-body.saves button[id=saves-import]:before{content:\"\\e82a\\00a0\"}#ui-dialog-body.saves button[id=saves-clear]:before{content:\"\\e827\\00a0\"}#ui-dialog-body.settings button[id|=setting-control]:after{content:\"\\00a0\\00a0\\e830\"}#ui-dialog-body.settings button[id|=setting-control].enabled:after{content:\"\\00a0\\00a0\\e831\"}</style>\n<style id=\"style-ui-bar\" type=\"text/css\">#story{margin-left:20em;transition:margin-left .2s ease-in}#ui-bar.stowed~#story{margin-left:4.5em}@media screen and (max-width:1136px){#story{margin-left:19em}#ui-bar.stowed~#story{margin-left:3.5em}}@media screen and (max-width:768px){#story{margin-left:3.5em}}#ui-bar{position:fixed;z-index:50;top:0;left:0;width:17.5em;height:100%;margin:0;padding:0;transition:left .2s ease-in}#ui-bar.stowed{left:-15.5em}#ui-bar-tray{position:absolute;top:.2em;left:0;right:0}#ui-bar-body{height:90%;height:calc(100% - 2.5em);margin:2.5em 0;padding:0 1.5em}#ui-bar.stowed #ui-bar-body,#ui-bar.stowed #ui-bar-history{visibility:hidden;transition:visibility .2s step-end}@media (prefers-reduced-motion:reduce){#story{transition:margin-left 0s}#ui-bar{transition:left 0s}}#ui-bar{background-color:#222;border-right:1px solid #444;text-align:center}#ui-bar a{text-decoration:none}#ui-bar hr{border-color:#444}#ui-bar-history [id|=history],#ui-bar-toggle{font-size:1.2em;line-height:inherit;color:#eee;background-color:transparent;border:1px solid #444}#ui-bar-toggle{display:block;position:absolute;top:0;right:0;border-right:none;padding:.3em .45em .25em}#ui-bar.stowed #ui-bar-toggle{padding:.3em .35em .25em .55em}#ui-bar-toggle:hover{background-color:#444;border-color:#eee}#ui-bar-history{margin:0 auto}#ui-bar-history [id|=history]{padding:.2em .45em .35em}#ui-bar-history #history-jumpto{padding:.2em .665em .35em}#ui-bar-history [id|=history]:not(:first-child){margin-left:1.2em}#ui-bar-history [id|=history]:hover{background-color:#444;border-color:#eee}#ui-bar-history [id|=history]:disabled{color:#444;background-color:transparent;border-color:#444}#ui-bar-body{line-height:1.5;overflow:auto}#ui-bar-body>:not(:first-child){margin-top:2em}#story-title{margin:0;font-size:162.5%}#story-author{margin-top:2em;font-weight:700}#menu ul{margin:1em 0 0;padding:0;list-style:none;border:1px solid #444}#menu ul:empty{display:none}#menu li{margin:0}#menu li:not(:first-child){border-top:1px solid #444}#menu li a{display:block;padding:.25em .75em;border:1px solid transparent;color:#eee;text-transform:uppercase}#menu li a:hover{background-color:#444;border-color:#eee}#menu a,#ui-bar-history [id|=history],#ui-bar-toggle{user-select:none}#menu-core li[id|=menu-item] a:before,#ui-bar-history [id|=history],#ui-bar-toggle:before{font-family:tme-fa-icons!important;font-style:normal;font-weight:900;font-variant:normal;line-height:1;speak:never;text-rendering:auto;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#ui-bar-toggle:before{content:\"\\e81d\"}#ui-bar.stowed #ui-bar-toggle:before{content:\"\\e81e\"}#menu-item-saves a:before{content:\"\\e82b\\00a0\"}#menu-item-settings a:before{content:\"\\e82d\\00a0\"}#menu-item-restart a:before{content:\"\\e82c\\00a0\"}#menu-item-share a:before{content:\"\\e82f\\00a0\"}</style>\n<style id=\"style-idb-backend\" type=\"text/css\">#saves-export-reminder{padding:.5em 1em 0;font-size:.96em}#saves-list-container{display:flex;flex-direction:column}#saves-list-container .savesListRow{display:flex;flex-flow:row nowrap;align-items:center;border-top:1px solid #444;padding:4px}@media (min-width:40rem){#saves-list-container .savesListRow{max-height:2.4em}}#saves-list-container .savesListRow .saveGroup{display:flex;flex-flow:row wrap;align-items:center;flex-grow:1;flex-shrink:1;min-width:0}#saves-list-container .savesListRow .saveGroup>div{display:flex;justify-content:center;margin:0 10px;flex-grow:0;flex-shrink:0}#saves-list-container .savesListRow .saveGroup .saveId{min-width:2em;margin-left:4px;margin-right:-6px}#saves-list-container .savesListRow .saveGroup .saveButton{display:flex;justify-content:center;min-width:110px;margin:0 10px}#saves-list-container .savesListRow .saveGroup .saveName{width:5em}#saves-list-container .savesListRow .saveGroup .saveButton input{margin:3px 0}#saves-list-container .savesListRow .saveGroup>.saveDetails{display:flex;flex:1 1 0;flex-direction:column;align-items:stretch;justify-content:stretch;min-width:100px}#saves-list-container .savesListRow .saveGroup>.saveDetails span{max-height:80px;white-space:nowrap;overflow-x:clip}.jumpToSaveTransition{background-color:#444;transition-duration:1s}#savesListFooter{justify-content:space-between;padding:0!important;line-height:normal}#savesListFooter div{display:flex;justify-content:stretch}.datestamp{font-size:.8em}.listMargin{display:inline-block;margin:1px 0}.right{float:right}.saveMenuButton{background-color:#35a!important}.saveMenuButton:hover{background-color:#35a!important}.saveMenuConfirm{margin-top:20px;margin-left:150px}.green{color:#38b20a}.gold{color:gold}.red{color:#ec3535}.saveBorder{max-width:700px;margin:10px 2px;padding:5px 2px 30px;border:1px solid var(--200)}#saveList ul.buttons{margin:0;padding:0;list-style:none;border-top:1px solid var(--750)}#saveList ul.buttons li{padding:.4em;display:inline-block;margin:0}#saveList ul.buttons li:last-child{float:right}#saveList button[id=saves-clear]:before,#saveList button[id=saves-export]:before,#saveList button[id=saves-import]:before,#saveList button[id=saves-toClipboard]:before{font-family:tme-fa-icons!important;font-style:normal;font-weight:900;font-variant:normal;line-height:1;speak:never;text-rendering:auto;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#saveList button[id=saves-export]:before{content:\"\\e829\\00a0\"}#saveList button[id=saves-toClipboard]:before{content:\"\\e82b\\00a0\"}#saveList button[id=saves-import]:before{content:\"\\e82a\\00a0\"}#saveList button[id=saves-clear]:before{content:\"\\e827\\00a0\"}.saves-loading .saves{text-align:center;margin-top:1em}</style>\n<style id=\"style-ui-debug\" type=\"text/css\">#debug-bar{background-color:#222;border-left:1px solid #444;border-top:1px solid #444;bottom:0;margin:0;max-height:75%;padding:.5em;position:fixed;right:0;z-index:99900}#debug-bar>div:not([id])+div{margin-top:.5em}#debug-bar>div>label{margin-right:.5em}#debug-bar>div>input[type=text]{min-width:0;width:8em}#debug-bar>div>select{width:15em}#debug-bar-toggle{color:#eee;background-color:#222;border:1px solid #444;height:101%;height:calc(100% + 1px);left:-2em;left:calc(-2em - 1px);position:absolute;top:-1px;width:2em}#debug-bar-toggle:hover{background-color:#333;border-color:#eee}#debug-bar-hint{bottom:.175em;font-size:4.5em;opacity:.33;pointer-events:none;position:fixed;right:.6em;user-select:none;white-space:nowrap}#debug-bar-watch{background-color:#222;border-left:1px solid #444;border-top:1px solid #444;bottom:102%;bottom:calc(100% + 1px);font-size:.9em;left:-1px;max-height:650%;max-height:65vh;position:absolute;overflow-x:hidden;overflow-y:scroll;right:0;z-index:99800}#debug-bar-watch[hidden]{display:none}#debug-bar-watch div{color:#999;font-style:italic;margin:1em auto;text-align:center}#debug-bar-watch table{width:100%}#debug-bar-watch tr:nth-child(2n){background-color:rgba(127,127,127,.15)}#debug-bar-watch td{padding:.2em 0}#debug-bar-watch td:first-child+td{padding:.2em .3em .2em .1em}#debug-bar-watch .watch-delete{background-color:transparent;border:none;color:#c00}#debug-bar-watch-all,#debug-bar-watch-none{margin-left:.5em}#debug-bar-views-toggle,#debug-bar-watch-toggle{color:#eee;background-color:transparent;border:1px solid #444;margin-right:1em;padding:.4em}#debug-bar-views-toggle:hover,#debug-bar-watch-toggle:hover{background-color:#333;border-color:#eee}#debug-bar-watch:not([hidden])~div #debug-bar-watch-toggle,html[data-debug-view] #debug-bar-views-toggle{background-color:#282;border-color:#4a4}#debug-bar-watch:not([hidden])~div #debug-bar-watch-toggle:hover,html[data-debug-view] #debug-bar-views-toggle:hover{background-color:#4a4;border-color:#6c6}#debug-bar-hint:after,#debug-bar-toggle:before,#debug-bar-views-toggle:after,#debug-bar-watch .watch-delete:before,#debug-bar-watch-add:before,#debug-bar-watch-all:before,#debug-bar-watch-none:before,#debug-bar-watch-toggle:after{font-family:tme-fa-icons!important;font-style:normal;font-weight:900;font-variant:normal;line-height:1;speak:never;text-rendering:auto;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#debug-bar-toggle:before{content:\"\\e838\"}#debug-bar-hint:after{content:\"\\e838\\202f\\e822\"}#debug-bar-watch .watch-delete:before{content:\"\\e804\"}#debug-bar-watch-add:before{content:\"\\e805\"}#debug-bar-watch-all:before{content:\"\\e83a\"}#debug-bar-watch-none:before{content:\"\\e827\"}#debug-bar-views-toggle:after,#debug-bar-watch-toggle:after{content:\"\\00a0\\00a0\\e830\"}#debug-bar-watch:not([hidden])~div #debug-bar-watch-toggle:after,html[data-debug-view] #debug-bar-views-toggle:after{content:\"\\00a0\\00a0\\e831\"}html[data-debug-view] .debug{padding:.25em;background-color:#234}html[data-debug-view] .debug[title]{cursor:help}html[data-debug-view] .debug.block{display:inline-block;vertical-align:middle}html[data-debug-view] .debug.invalid{text-decoration:line-through}html[data-debug-view] .debug.hidden,html[data-debug-view] .debug.hidden .debug{background-color:#555}html:not([data-debug-view]) .debug.hidden{display:none}html[data-debug-view] .debug[data-name][data-type].nonvoid:after,html[data-debug-view] .debug[data-name][data-type]:before{background-color:rgba(0,0,0,.25);font-family:monospace,monospace;white-space:pre}html[data-debug-view] .debug[data-name][data-type]:before{content:attr(data-name)}html[data-debug-view] .debug[data-name][data-type|=macro]:before{content:\"<<\" attr(data-name) \">>\"}html[data-debug-view] .debug[data-name][data-type|=macro].nonvoid:after{content:\"<</\" attr(data-name) \">>\"}html[data-debug-view] .debug[data-name][data-type|=html]:before{content:\"<\" attr(data-name) \">\"}html[data-debug-view] .debug[data-name][data-type|=html].nonvoid:after{content:\"</\" attr(data-name) \">\"}html[data-debug-view] .debug[data-name][data-type]:not(:empty):before{margin-right:.25em}html[data-debug-view] .debug[data-name][data-type].nonvoid:not(:empty):after{margin-left:.25em}html[data-debug-view] .debug[data-name][data-type|=special],html[data-debug-view] .debug[data-name][data-type|=special]:before{display:block}</style>\n</head>\n<body>\n\t<div id=\"init-screen\">\n\t\t<div id=\"init-no-js\"><noscript>JavaScript must be enabled to play.</noscript></div>\n\t\t<div id=\"init-lacking\"><p>Browser lacks capabilities required to play.</p><p>Upgrade or switch to another browser.</p></div>\n\t\t<div id=\"init-loading\"><div>Loading&hellip;</div></div>\n\t</div>\n\t{{STORY_DATA}}\n\t<script id=\"script-sugarcube\" type=\"text/javascript\">\n\t/*! SugarCube JS */\n\tif(document.documentElement.getAttribute(\"data-init\")===\"loading\"){(function(window,document,jQuery,undefined){\"use strict\";var errorPrologRegExp=/^(?:(?:uncaught\\s+(?:exception:\\s+)?)?\\w*(?:error|exception|_err):\\s+)+/i,Alert=(()=>{function mesg(where,error,isFatal,isUncaught){let mesg=\"Error\",nice=`A${isFatal?\" fatal\":\"n\"} error has occurred.`;nice+=isFatal?\" Aborting.\":\" You may be able to continue, but some parts may not work properly.\";const isObject=null!==error&&\"object\"==typeof error;null!=where&&(mesg+=` [${where}]`),mesg+=`: ${(isObject&&\"message\"in error?String(error.message).replace(errorPrologRegExp,\"\"):String(error)).trim()||\"unknown error\"}.`,isObject&&\"stack\"in error&&(mesg+=`\\n\\nStack Trace:\\n${error.stack}`),mesg&&(nice+=`\\n\\n${mesg}`),isUncaught||console[isFatal?\"error\":\"warn\"](mesg),window.alert(nice)}var origOnError;return origOnError=window.onerror,window.onerror=function(what,source,lineNum,colNum,error){\"complete\"===document.readyState?mesg(null,null!=error?error:what,!1,!0):(mesg(null,null!=error?error:what,!0,!0),window.onerror=origOnError,\"function\"==typeof window.onerror&&window.onerror.apply(this,arguments))},Object.freeze(Object.defineProperties({},{error:{value:function(where,error){mesg(where,error)}},fatal:{value:function(where,error){mesg(where,error,!0)}}}))})(),Patterns=(()=>{const space=(()=>{const wsMap=new Map([[\" \",\"\\\\u0020\"],[\"\\f\",\"\\\\f\"],[\"\\n\",\"\\\\n\"],[\"\\r\",\"\\\\r\"],[\"\\t\",\"\\\\t\"],[\"\\v\",\"\\\\v\"],[\" \",\"\\\\u00a0\"],[\" \",\"\\\\u1680\"],[\"᠎\",\"\\\\u180e\"],[\" \",\"\\\\u2000\"],[\" \",\"\\\\u2001\"],[\" \",\"\\\\u2002\"],[\" \",\"\\\\u2003\"],[\" \",\"\\\\u2004\"],[\" \",\"\\\\u2005\"],[\" \",\"\\\\u2006\"],[\" \",\"\\\\u2007\"],[\" \",\"\\\\u2008\"],[\" \",\"\\\\u2009\"],[\" \",\"\\\\u200a\"],[\"\\u2028\",\"\\\\u2028\"],[\"\\u2029\",\"\\\\u2029\"],[\" \",\"\\\\u202f\"],[\" \",\"\\\\u205f\"],[\" \",\"\\\\u3000\"],[\"\\ufeff\",\"\\\\ufeff\"]]),wsRe=/^\\s$/;let missing=\"\";return wsMap.forEach(((pat,char)=>{wsRe.test(char)||(missing+=pat)})),missing?`[\\\\s${missing}]`:\"\\\\s\"})(),spaceNoTerminator=\"[\\\\u0020\\\\f\\\\t\\\\v\\\\u00a0\\\\u1680\\\\u180e\\\\u2000-\\\\u200a\\\\u202f\\\\u205f\\\\u3000\\\\ufeff]\",notSpace=\"\\\\s\"===space?\"\\\\S\":space.replace(/^\\[/,\"[^\"),anyLetter=\"[0-9A-Z_a-z\\\\-\\\\u00c0-\\\\u00d6\\\\u00d8-\\\\u00f6\\\\u00f8-\\\\u00ff\\\\u0150\\\\u0170\\\\u0151\\\\u0171]\",anyLetterStrict=anyLetter.replace(\"\\\\-\",\"\"),htmlTagName=(()=>{const cENChar=\"(?:[\\\\x2D.0-9A-Z_a-z\\\\xB7\\\\xC0-\\\\xD6\\\\xD8-\\\\xF6\\\\xF8-\\\\u037D\\\\u037F-\\\\u1FFF\\\\u200C\\\\u200D\\\\u203F\\\\u2040\\\\u2070-\\\\u218F\\\\u2C00-\\\\u2FEF\\\\u3001-\\\\uD7FF\\\\uF900-\\\\uFDCF\\\\uFDF0-\\\\uFFFD]|[\\\\uD800-\\\\uDB7F][\\\\uDC00-\\\\uDFFF])\";return`[A-Za-z](?:${cENChar}*-${cENChar}*|[0-9A-Za-z]*)`})(),inlineCss=`(${anyLetter}+)\\\\(([^\\\\)\\\\|\\\\n]+)\\\\):|${spaceNoTerminator}*(${anyLetter}+)${spaceNoTerminator}*:([^;\\\\|\\\\n]+);|${spaceNoTerminator}*((?:[#.]${anyLetter}+${spaceNoTerminator}*)+);`;return Object.freeze({space:space,spaceNoTerminator:spaceNoTerminator,lineTerminator:\"[\\\\n\\\\r\\\\u2028\\\\u2029]\",notSpace:notSpace,anyChar:\"(?:.|[\\\\n\\\\r\\\\u2028\\\\u2029])\",anyLetter:anyLetter,anyLetterStrict:anyLetterStrict,identifierFirstChar:\"[$A-Z_a-z]\",identifierNextChar:\"[$0-9A-Z_a-z]\",identifier:\"[$A-Z_a-z][$0-9A-Z_a-z]*\",variableSigil:\"[$_]\",variable:\"[$_][$A-Z_a-z][$0-9A-Z_a-z]*\",macroName:\"[A-Za-z][\\\\w-]*|[=-]\",templateName:\"[A-Za-z][\\\\w-]*\",htmlTagName:htmlTagName,cssIdOrClassSigil:\"[#.]\",cssImage:\"\\\\[[<>]?[Ii][Mm][Gg]\\\\[(?:\\\\s|\\\\S)*?\\\\]\\\\]+\",inlineCss:inlineCss,url:\"(?:file|https?|mailto|ftp|javascript|irc|news|data):[^\\\\s'\\\"]+\"})})();(()=>{const _trimString=(()=>{const startWSRe=new RegExp(`^${Patterns.space}${Patterns.space}*`),endWSRe=new RegExp(`${Patterns.space}${Patterns.space}*$`);return function(str,where){const val=String(str);if(!val)return val;switch(where){case\"start\":return startWSRe.test(val)?val.replace(startWSRe,\"\"):val;case\"end\":return endWSRe.test(val)?val.replace(endWSRe,\"\"):val;default:throw new Error(`_trimString called with incorrect where parameter value: \"${where}\"`)}}})();function _createPadString(length,padding){const targetLength=Number.parseInt(length,10)||0;if(targetLength<1)return\"\";let padString=void 0===padding?\"\":String(padding);for(\"\"===padString&&(padString=\" \");padString.length<targetLength;){const curPadLength=padString.length,remainingLength=targetLength-curPadLength;padString+=curPadLength>remainingLength?padString.slice(0,remainingLength):padString}return padString.length>targetLength&&(padString=padString.slice(0,targetLength)),padString}Array.prototype.flat||Object.defineProperty(Array.prototype,\"flat\",{configurable:!0,writable:!0,value:function flat(){if(null==this)throw new TypeError(\"Array.prototype.flat called on null or undefined\");const depth=0===arguments.length?1:Number(arguments[0])||0;return depth<1?Array.prototype.slice.call(this):Array.prototype.reduce.call(this,((acc,cur)=>(cur instanceof Array?acc.push(...flat.call(cur,depth-1)):acc.push(cur),acc)),[])}}),Array.prototype.flatMap||Object.defineProperty(Array.prototype,\"flatMap\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"Array.prototype.flatMap called on null or undefined\");return Array.prototype.map.apply(this,arguments).flat()}}),Array.prototype.includes||Object.defineProperty(Array.prototype,\"includes\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"Array.prototype.includes called on null or undefined\");if(0===arguments.length)return!1;const length=this.length>>>0;if(0===length)return!1;const needle=arguments[0];let i=Number(arguments[1])||0;for(i<0&&(i=Math.max(0,length+i));i<length;++i){const value=this[i];if(value===needle||value!=value&&needle!=needle)return!0}return!1}}),Object.entries||Object.defineProperty(Object,\"entries\",{configurable:!0,writable:!0,value(obj){if(\"object\"!=typeof obj||null===obj)throw new TypeError(\"Object.entries object parameter must be an object\");return Object.keys(obj).map((key=>[key,obj[key]]))}}),Object.fromEntries||Object.defineProperty(Object,\"fromEntries\",{configurable:!0,writable:!0,value:iter=>Array.from(iter).reduce(((acc,pair)=>{if(Object(pair)!==pair)throw new TypeError(\"Object.fromEntries iterable parameter must yield objects\");return pair[0]in acc?Object.defineProperty(acc,pair[0],{configurable:!0,enumerable:!0,writable:!0,value:pair[1]}):acc[pair[0]]=pair[1],acc}),{})}),Object.getOwnPropertyDescriptors||Object.defineProperty(Object,\"getOwnPropertyDescriptors\",{configurable:!0,writable:!0,value(obj){if(null==obj)throw new TypeError(\"Object.getOwnPropertyDescriptors object parameter is null or undefined\");const O=Object(obj);return Reflect.ownKeys(O).reduce(((acc,key)=>{const desc=Object.getOwnPropertyDescriptor(O,key);return void 0!==desc&&(key in acc?Object.defineProperty(acc,key,{configurable:!0,enumerable:!0,writable:!0,value:desc}):acc[key]=desc),acc}),{})}}),Object.values||Object.defineProperty(Object,\"values\",{configurable:!0,writable:!0,value(obj){if(\"object\"!=typeof obj||null===obj)throw new TypeError(\"Object.values object parameter must be an object\");return Object.keys(obj).map((key=>obj[key]))}}),String.prototype.padStart||Object.defineProperty(String.prototype,\"padStart\",{configurable:!0,writable:!0,value(length,padding){if(null==this)throw new TypeError(\"String.prototype.padStart called on null or undefined\");const baseString=String(this),baseLength=baseString.length,targetLength=Number.parseInt(length,10);return targetLength<=baseLength?baseString:_createPadString(targetLength-baseLength,padding)+baseString}}),String.prototype.padEnd||Object.defineProperty(String.prototype,\"padEnd\",{configurable:!0,writable:!0,value(length,padding){if(null==this)throw new TypeError(\"String.prototype.padEnd called on null or undefined\");const baseString=String(this),baseLength=baseString.length,targetLength=Number.parseInt(length,10);return targetLength<=baseLength?baseString:baseString+_createPadString(targetLength-baseLength,padding)}}),String.prototype.trimStart||Object.defineProperty(String.prototype,\"trimStart\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"String.prototype.trimStart called on null or undefined\");return _trimString(this,\"start\")}}),String.prototype.trimLeft||Object.defineProperty(String.prototype,\"trimLeft\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"String.prototype.trimLeft called on null or undefined\");return _trimString(this,\"start\")}}),String.prototype.trimEnd||Object.defineProperty(String.prototype,\"trimEnd\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"String.prototype.trimEnd called on null or undefined\");return _trimString(this,\"end\")}}),String.prototype.trimRight||Object.defineProperty(String.prototype,\"trimRight\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"String.prototype.trimRight called on null or undefined\");return _trimString(this,\"end\")}})})(),(()=>{function _nativeMathRandom(useMath){return useMath||!State.prng.isEnabled()?Math.random():State.random()}function _random(){let max,min=0,useMath=!1;switch(arguments.length){case 0:throw new Error(\"_random called with insufficient parameters\");case 1:max=arguments[0];break;case 2:!0===arguments[1]?(max=arguments[0],useMath=arguments[1]):(min=arguments[0],max=arguments[1]);break;default:min=arguments[0],max=arguments[1],useMath=arguments[2]}return min>max&&([min,max]=[max,min]),Math.floor(_nativeMathRandom(useMath)*(max-min+1))+min}function _randomIndex(length,boundsArgs){let min,max;switch(boundsArgs.length){case 1:min=0,max=length-1;break;case 2:min=0,max=Math.trunc(boundsArgs[1]);break;default:min=Math.trunc(boundsArgs[1]),max=Math.trunc(boundsArgs[2])}return Number.isNaN(min)?min=0:!Number.isFinite(min)||min>=length?min=length-1:min<0&&(min=length+min,min<0&&(min=0)),Number.isNaN(max)?max=0:!Number.isFinite(max)||max>=length?max=length-1:max<0&&(max=length+max,max<0&&(max=length-1)),_random(min,max)}function _getCodePointStartAndEnd(str,pos){const code=str.charCodeAt(pos);if(Number.isNaN(code))return{char:\"\",start:-1,end:-1};if(code<55296||code>57343)return{char:str.charAt(pos),start:pos,end:pos};if(code>=55296&&code<=56319){const nextPos=pos+1;if(nextPos>=str.length)throw new Error(\"high surrogate without trailing low surrogate\");const nextCode=str.charCodeAt(nextPos);if(nextCode<56320||nextCode>57343)throw new Error(\"high surrogate without trailing low surrogate\");return{char:str.charAt(pos)+str.charAt(nextPos),start:pos,end:nextPos}}if(0===pos)throw new Error(\"low surrogate without leading high surrogate\");const prevPos=pos-1,prevCode=str.charCodeAt(prevPos);if(prevCode<55296||prevCode>56319)throw new Error(\"low surrogate without leading high surrogate\");return{char:str.charAt(prevPos)+str.charAt(pos),start:prevPos,end:pos}}Object.defineProperty(Array,\"random\",{configurable:!0,writable:!0,value(array,useMath){if(\"object\"!=typeof array||null===array||!Object.prototype.hasOwnProperty.call(array,\"length\"))throw new TypeError(\"Array.random array parameter must be an array or array-lke object\");const length=array.length>>>0;if(0===length)return;return array[_random(0,length-1,useMath)]}}),Object.defineProperty(Array.prototype,\"concatUnique\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"Array.prototype.concatUnique called on null or undefined\");const result=Array.from(this);if(0===arguments.length)return result;const items=Array.prototype.reduce.call(arguments,((prev,cur)=>prev.concat(cur)),[]),addSize=items.length;if(0===addSize)return result;const indexOf=Array.prototype.indexOf,push=Array.prototype.push;for(let i=0;i<addSize;++i){const value=items[i];-1===indexOf.call(result,value)&&push.call(result,value)}return result}}),Object.defineProperty(Array.prototype,\"count\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"Array.prototype.count called on null or undefined\");const indexOf=Array.prototype.indexOf,needle=arguments[0];let pos=Number(arguments[1])||0,count=0;for(;-1!==(pos=indexOf.call(this,needle,pos));)++count,++pos;return count}}),Object.defineProperty(Array.prototype,\"countWith\",{configurable:!0,writable:!0,value(predicate,thisArg){if(null==this)throw new TypeError(\"Array.prototype.countWith called on null or undefined\");if(\"function\"!=typeof predicate)throw new Error(\"Array.prototype.countWith predicate parameter must be a function\");const length=this.length>>>0;if(0===length)return 0;let count=0;for(let i=0;i<length;++i)predicate.call(thisArg,this[i],i,this)&&++count;return count}}),Object.defineProperty(Array.prototype,\"delete\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"Array.prototype.delete called on null or undefined\");if(0===arguments.length)return[];const length=this.length>>>0;if(0===length)return[];const needles=Array.prototype.concat.apply([],arguments),needlesLength=needles.length,indices=[];for(let i=0;i<length;++i){const value=this[i];for(let j=0;j<needlesLength;++j){const needle=needles[j];if(value===needle||value!=value&&needle!=needle){indices.push(i);break}}}const result=[];for(let i=0,iend=indices.length;i<iend;++i)result[i]=this[indices[i]];const splice=Array.prototype.splice;for(let i=indices.length-1;i>=0;--i)splice.call(this,indices[i],1);return result}}),Object.defineProperty(Array.prototype,\"deleteAt\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"Array.prototype.deleteAt called on null or undefined\");if(0===arguments.length)return[];const length=this.length>>>0;if(0===length)return[];const splice=Array.prototype.splice,cpyIndices=[...new Set(Array.prototype.concat.apply([],arguments).map((x=>x<0?Math.max(0,length+x):x))).values()],delIndices=[...cpyIndices].sort(((a,b)=>b-a)),result=[];for(let i=0,iend=cpyIndices.length;i<iend;++i)result[i]=this[cpyIndices[i]];for(let i=0,iend=delIndices.length;i<iend;++i)splice.call(this,delIndices[i],1);return result}}),Object.defineProperty(Array.prototype,\"deleteWith\",{configurable:!0,writable:!0,value(predicate,thisArg){if(null==this)throw new TypeError(\"Array.prototype.deleteWith called on null or undefined\");if(\"function\"!=typeof predicate)throw new Error(\"Array.prototype.deleteWith predicate parameter must be a function\");const length=this.length>>>0;if(0===length)return[];const splice=Array.prototype.splice,indices=[],result=[];for(let i=0;i<length;++i)predicate.call(thisArg,this[i],i,this)&&(result.push(this[i]),indices.push(i));for(let i=indices.length-1;i>=0;--i)splice.call(this,indices[i],1);return result}}),Object.defineProperty(Array.prototype,\"first\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"Array.prototype.first called on null or undefined\");if(0!==this.length>>>0)return this[0]}}),Object.defineProperty(Array.prototype,\"includesAll\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"Array.prototype.includesAll called on null or undefined\");if(1===arguments.length)return Array.isArray(arguments[0])?Array.prototype.includesAll.apply(this,arguments[0]):Array.prototype.includes.apply(this,arguments);for(let i=0,iend=arguments.length;i<iend;++i)if(!Array.prototype.some.call(this,(function(val){return val===this.val||val!=val&&this.val!=this.val}),{val:arguments[i]}))return!1;return!0}}),Object.defineProperty(Array.prototype,\"includesAny\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"Array.prototype.includesAny called on null or undefined\");if(1===arguments.length)return Array.isArray(arguments[0])?Array.prototype.includesAny.apply(this,arguments[0]):Array.prototype.includes.apply(this,arguments);for(let i=0,iend=arguments.length;i<iend;++i)if(Array.prototype.some.call(this,(function(val){return val===this.val||val!=val&&this.val!=this.val}),{val:arguments[i]}))return!0;return!1}}),Object.defineProperty(Array.prototype,\"last\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"Array.prototype.last called on null or undefined\");const length=this.length>>>0;if(0!==length)return this[length-1]}}),Object.defineProperty(Array.prototype,\"pluck\",{configurable:!0,writable:!0,value(useMath){if(null==this)throw new TypeError(\"Array.prototype.pluck called on null or undefined\");const length=this.length>>>0;if(0===length)return;const index=_random(0,length-1,useMath);return Array.prototype.splice.call(this,index,1)[0]}}),Object.defineProperty(Array.prototype,\"pluckMany\",{configurable:!0,writable:!0,value(wantSize){if(null==this)throw new TypeError(\"Array.prototype.pluckMany called on null or undefined\");const length=this.length>>>0;if(0===length)return[];let want=Math.trunc(wantSize);if(!Number.isInteger(want))throw new Error(\"Array.prototype.pluckMany want parameter must be an integer\");if(want<1)return[];want>length&&(want=length);const splice=Array.prototype.splice,result=[];let max=length-1;do{result.push(splice.call(this,_random(0,max--),1)[0])}while(result.length<want);return result}}),Object.defineProperty(Array.prototype,\"pushUnique\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"Array.prototype.pushUnique called on null or undefined\");const addSize=arguments.length;if(0===addSize)return this.length>>>0;const indexOf=Array.prototype.indexOf,push=Array.prototype.push;for(let i=0;i<addSize;++i){const value=arguments[i];-1===indexOf.call(this,value)&&push.call(this,value)}return this.length>>>0}}),Object.defineProperty(Array.prototype,\"random\",{configurable:!0,writable:!0,value(useMath){if(null==this)throw new TypeError(\"Array.prototype.random called on null or undefined\");const length=this.length>>>0;if(0===length)return;return this[_random(0,length-1,useMath)]}}),Object.defineProperty(Array.prototype,\"randomMany\",{configurable:!0,writable:!0,value(wantSize){if(null==this)throw new TypeError(\"Array.prototype.randomMany called on null or undefined\");const length=this.length>>>0;if(0===length)return[];let want=Math.trunc(wantSize);if(!Number.isInteger(want))throw new Error(\"Array.prototype.randomMany want parameter must be an integer\");if(want<1)return[];want>length&&(want=length);const picked=new Map,result=[],max=length-1;do{let i;do{i=_random(0,max)}while(picked.has(i));picked.set(i,!0),result.push(this[i])}while(result.length<want);return result}}),Object.defineProperty(Array.prototype,\"shuffle\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"Array.prototype.shuffle called on null or undefined\");const length=this.length>>>0;if(0===length)return this;for(let i=length-1;i>0;--i){const j=Math.floor(_nativeMathRandom()*(i+1));if(i===j)continue;const swap=this[i];this[i]=this[j],this[j]=swap}return this}}),Object.defineProperty(Array.prototype,\"unshiftUnique\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"Array.prototype.unshiftUnique called on null or undefined\");const addSize=arguments.length;if(0===addSize)return this.length>>>0;const indexOf=Array.prototype.indexOf,unshift=Array.prototype.unshift;for(let i=0;i<addSize;++i){const value=arguments[i];-1===indexOf.call(this,value)&&unshift.call(this,value)}return this.length>>>0}}),Object.defineProperty(Function.prototype,\"partial\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"Function.prototype.partial called on null or undefined\");const slice=Array.prototype.slice,fn=this,bound=slice.call(arguments,0);return function(){const applied=[];let argc=0;for(let i=0;i<bound.length;++i)applied.push(bound[i]===undefined?arguments[argc++]:bound[i]);return fn.apply(this,applied.concat(slice.call(arguments,argc)))}}}),Object.defineProperty(Math,\"clamp\",{configurable:!0,writable:!0,value(num,min,max){const value=Number(num);return Number.isNaN(value)?NaN:value.clamp(min,max)}}),Object.defineProperty(Math,\"easeInOut\",{configurable:!0,writable:!0,value:num=>1-(Math.cos(Number(num)*Math.PI)+1)/2}),Object.defineProperty(Number.prototype,\"clamp\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"Number.prototype.clamp called on null or undefined\");if(2!==arguments.length)throw new Error(\"Number.prototype.clamp called with an incorrect number of parameters\");let min=Number(arguments[0]),max=Number(arguments[1]);return min>max&&([min,max]=[max,min]),Math.min(Math.max(this,min),max)}}),RegExp.escape||(()=>{const _regExpMetaCharsRe=/[\\\\^$*+?.()|[\\]{}]/g,_hasRegExpMetaCharsRe=new RegExp(_regExpMetaCharsRe.source);Object.defineProperty(RegExp,\"escape\",{configurable:!0,writable:!0,value(str){const val=String(str);return val&&_hasRegExpMetaCharsRe.test(val)?val.replace(_regExpMetaCharsRe,\"\\\\$&\"):val}})})(),(()=>{const _formatRegExp=/{(\\d+)(?:,([+-]?\\d+))?}/g,_hasFormatRegExp=new RegExp(_formatRegExp.source);Object.defineProperty(String,\"format\",{configurable:!0,writable:!0,value(format){if(arguments.length<2)return 0===arguments.length?\"\":format;const args=2===arguments.length&&Array.isArray(arguments[1])?[...arguments[1]]:Array.prototype.slice.call(arguments,1);return 0===args.length?format:_hasFormatRegExp.test(format)?(_formatRegExp.lastIndex=0,format.replace(_formatRegExp,((match,index,align)=>{let retval=args[index];if(null==retval)return\"\";for(;\"function\"==typeof retval;)retval=retval();switch(typeof retval){case\"string\":break;case\"object\":retval=JSON.stringify(retval);break;default:retval=String(retval)}return function(str,align,pad){if(!align)return str;const plen=Math.abs(align)-str.length;if(plen<1)return str;const padding=String(pad).repeat(plen);return align<0?str+padding:padding+str}(retval,align?Number.parseInt(align,10):0,\" \")}))):format}})})(),Object.defineProperty(String.prototype,\"contains\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"String.prototype.contains called on null or undefined\");return-1!==String.prototype.indexOf.apply(this,arguments)}}),Object.defineProperty(String.prototype,\"count\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"String.prototype.count called on null or undefined\");const needle=String(arguments[0]||\"\");if(\"\"===needle)return 0;const indexOf=String.prototype.indexOf,step=needle.length;let pos=Number(arguments[1])||0,count=0;for(;-1!==(pos=indexOf.call(this,needle,pos));)++count,pos+=step;return count}}),Object.defineProperty(String.prototype,\"first\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"String.prototype.first called on null or undefined\");const str=String(this),{char:char}=_getCodePointStartAndEnd(str,0);return char}}),Object.defineProperty(String.prototype,\"last\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"String.prototype.last called on null or undefined\");const str=String(this),{char:char}=_getCodePointStartAndEnd(str,str.length-1);return char}}),Object.defineProperty(String.prototype,\"splice\",{configurable:!0,writable:!0,value(startAt,delCount,replacement){if(null==this)throw new TypeError(\"String.prototype.splice called on null or undefined\");const length=this.length>>>0;if(0===length)return\"\";let start=Number(startAt);Number.isSafeInteger(start)?start<0&&(start+=length,start<0&&(start=0)):start=0,start>length&&(start=length);let count=Number(delCount);(!Number.isSafeInteger(count)||count<0)&&(count=0);let res=this.slice(0,start);return void 0!==replacement&&(res+=replacement),start+count<length&&(res+=this.slice(start+count)),res}}),Object.defineProperty(String.prototype,\"splitOrEmpty\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"String.prototype.splitOrEmpty called on null or undefined\");return\"\"===String(this)?[]:String.prototype.split.apply(this,arguments)}}),Object.defineProperty(String.prototype,\"toLocaleUpperFirst\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"String.prototype.toLocaleUpperFirst called on null or undefined\");const str=String(this),{char:char,end:end}=_getCodePointStartAndEnd(str,0);return-1===end?\"\":char.toLocaleUpperCase()+str.slice(end+1)}}),Object.defineProperty(String.prototype,\"toUpperFirst\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"String.prototype.toUpperFirst called on null or undefined\");const str=String(this),{char:char,end:end}=_getCodePointStartAndEnd(str,0);return-1===end?\"\":char.toUpperCase()+str.slice(end+1)}}),Object.defineProperty(Date.prototype,\"toJSON\",{configurable:!0,writable:!0,value(){return[\"(revive:date)\",this.toISOString()]}}),Object.defineProperty(Function.prototype,\"toJSON\",{configurable:!0,writable:!0,value(){return[\"(revive:eval)\",`(${this.toString()})`]}}),Object.defineProperty(Map.prototype,\"toJSON\",{configurable:!0,writable:!0,value(){return[\"(revive:map)\",[...this]]}}),Object.defineProperty(RegExp.prototype,\"toJSON\",{configurable:!0,writable:!0,value(){return[\"(revive:eval)\",this.toString()]}}),Object.defineProperty(Set.prototype,\"toJSON\",{configurable:!0,writable:!0,value(){return[\"(revive:set)\",[...this]]}}),Object.defineProperty(JSON,\"reviveWrapper\",{configurable:!0,writable:!0,value(code,data){if(\"string\"!=typeof code)throw new TypeError(\"JSON.reviveWrapper code parameter must be a string\");return[\"(revive:eval)\",[code,data]]}}),Object.defineProperty(JSON,\"_real_stringify\",{value:JSON.stringify}),Object.defineProperty(JSON,\"stringify\",{configurable:!0,writable:!0,value:(value,replacer,space)=>JSON._real_stringify(value,((key,val)=>{let value=val;if(\"function\"==typeof replacer)try{value=replacer(key,value)}catch(ex){}return void 0===value?value=[\"(revive:eval)\",\"undefined\"]:value===1/0?value=[\"(revive:eval)\",\"Infinity\"]:value===-1/0?value=[\"(revive:eval)\",\"-Infinity\"]:Number.isNaN(value)&&(value=[\"(revive:eval)\",\"NaN\"]),value}),space)}),Object.defineProperty(JSON,\"_real_parse\",{value:JSON.parse}),Object.defineProperty(JSON,\"parse\",{configurable:!0,writable:!0,value(text,reviver){return JSON._real_parse(text,((key,val)=>{let value=val;if(Array.isArray(value)&&2===value.length)switch(value[0]){case\"(revive:set)\":value=new Set(value[1]);break;case\"(revive:map)\":value=new Map(value[1]);break;case\"(revive:date)\":value=new Date(value[1]);break;case\"(revive:eval)\":try{if(Array.isArray(value[1])){const $ReviveData$=value[1][1];value=eval(value[1][0])}else value=eval(value[1])}catch(ex){}}else if(\"string\"==typeof value&&\"@@revive@@\"===value.slice(0,10))try{value=eval(value.slice(10))}catch(ex){}if(\"function\"==typeof reviver)try{value=reviver(key,value)}catch(ex){}return value}))}}),Object.defineProperty(Array.prototype,\"contains\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"Array.prototype.contains called on null or undefined\");return Array.prototype.includes.apply(this,arguments)}}),Object.defineProperty(Array.prototype,\"containsAll\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"Array.prototype.containsAll called on null or undefined\");return Array.prototype.includesAll.apply(this,arguments)}}),Object.defineProperty(Array.prototype,\"containsAny\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"Array.prototype.containsAny called on null or undefined\");return Array.prototype.includesAny.apply(this,arguments)}}),Object.defineProperty(Array.prototype,\"flatten\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"Array.prototype.flatten called on null or undefined\");return Array.prototype.flat.call(this,1/0)}}),Object.defineProperty(String.prototype,\"readBracketedList\",{configurable:!0,writable:!0,value(){if(null==this)throw new TypeError(\"String.prototype.readBracketedList called on null or undefined\");const re=new RegExp(\"(?:\\\\[\\\\[((?:\\\\s|\\\\S)*?)\\\\]\\\\])|([^\\\"'\\\\s]\\\\S*)\",\"gm\"),names=[];let match;for(;null!==(match=re.exec(this));)match[1]?names.push(match[1]):match[2]&&names.push(match[2]);return names}})})();var Browser=(()=>{const userAgent=navigator.userAgent.toLowerCase(),winPhone=userAgent.includes(\"windows phone\"),isMobile=Object.freeze({Android:!winPhone&&userAgent.includes(\"android\"),BlackBerry:/blackberry|bb10/.test(userAgent),iOS:!winPhone&&/ip(?:hone|ad|od)/.test(userAgent),Opera:!winPhone&&(\"object\"==typeof window.operamini||userAgent.includes(\"opera mini\")),Windows:winPhone||/iemobile|wpdesktop/.test(userAgent),any:()=>isMobile.Android||isMobile.BlackBerry||isMobile.iOS||isMobile.Opera||isMobile.Windows}),isGecko=!isMobile.Windows&&!/khtml|trident|edge/.test(userAgent)&&userAgent.includes(\"gecko\"),isIE=!userAgent.includes(\"opera\")&&/msie|trident/.test(userAgent),ieVersion=isIE?(()=>{const ver=/(?:msie\\s+|rv:)(\\d+\\.\\d)/.exec(userAgent);return ver?Number(ver[1]):0})():null,isOpera=userAgent.includes(\"opera\")||userAgent.includes(\" opr/\"),operaVersion=isOpera?(()=>{const ver=new RegExp((/khtml|chrome/.test(userAgent)?\"opr\":\"version\")+\"\\\\/(\\\\d+\\\\.\\\\d+)\").exec(userAgent);return ver?Number(ver[1]):0})():null,isVivaldi=userAgent.includes(\"vivaldi\");return Object.freeze({userAgent:userAgent,isMobile:isMobile,isGecko:isGecko,isIE:isIE,ieVersion:ieVersion,isOpera:isOpera,operaVersion:operaVersion,isVivaldi:isVivaldi})})(),Has=(()=>{const hasAudioElement=(()=>{try{return\"function\"==typeof document.createElement(\"audio\").canPlayType}catch(ex){}return!1})(),hasFile=(()=>{try{return\"Blob\"in window&&\"File\"in window&&\"FileList\"in window&&\"FileReader\"in window&&(!Browser.isOpera||Browser.operaVersion>=15)}catch(ex){}return!1})(),hasGeolocation=(()=>{try{return\"geolocation\"in navigator&&\"function\"==typeof navigator.geolocation.getCurrentPosition&&\"function\"==typeof navigator.geolocation.watchPosition}catch(ex){}return!1})(),hasMutationObserver=(()=>{try{return\"MutationObserver\"in window&&\"function\"==typeof window.MutationObserver}catch(ex){}return!1})(),hasPerformance=(()=>{try{return\"performance\"in window&&\"function\"==typeof window.performance.now}catch(ex){}return!1})(),hasTouch=(()=>{try{return\"ontouchstart\"in window||!!window.DocumentTouch&&document instanceof window.DocumentTouch||!!navigator.maxTouchPoints||!!navigator.msMaxTouchPoints}catch(ex){}return!1})(),hasTransitionEndEvent=(()=>{try{const teMap=new Map([[\"transition\",\"transitionend\"],[\"MSTransition\",\"msTransitionEnd\"],[\"WebkitTransition\",\"webkitTransitionEnd\"],[\"MozTransition\",\"transitionend\"]]),teKeys=[...teMap.keys()],el=document.createElement(\"div\");for(let i=0;i<teKeys.length;++i)if(el.style[teKeys[i]]!==undefined)return teMap.get(teKeys[i])}catch(ex){}return!1})();return Object.freeze({audio:hasAudioElement,fileAPI:hasFile,geolocation:hasGeolocation,mutationObserver:hasMutationObserver,performance:hasPerformance,touch:hasTouch,transitionEndEvent:hasTransitionEndEvent})})(),Visibility=(()=>{const vendor=(()=>{try{return Object.freeze([{hiddenProperty:\"hidden\",stateProperty:\"visibilityState\",changeEvent:\"visibilitychange\"},{hiddenProperty:\"webkitHidden\",stateProperty:\"webkitVisibilityState\",changeEvent:\"webkitvisibilitychange\"},{hiddenProperty:\"mozHidden\",stateProperty:\"mozVisibilityState\",changeEvent:\"mozvisibilitychange\"},{hiddenProperty:\"msHidden\",stateProperty:\"msVisibilityState\",changeEvent:\"msvisibilitychange\"}].find((vnd=>vnd.hiddenProperty in document)))}catch(ex){}return undefined})();return Object.freeze(Object.defineProperties({},{vendor:{get:function(){return vendor}},state:{get:function(){return vendor&&document[vendor.stateProperty]||\"visible\"}},isEnabled:{value:function(){return Boolean(vendor)}},isHidden:{value:function(){return Boolean(vendor&&document[vendor.hiddenProperty])}},hiddenProperty:{value:vendor&&vendor.hiddenProperty},stateProperty:{value:vendor&&vendor.stateProperty},changeEvent:{value:vendor&&vendor.changeEvent}}))})(),Fullscreen=(()=>{const vendor=(()=>{try{return Object.freeze([{isEnabled:\"fullscreenEnabled\",element:\"fullscreenElement\",requestFn:\"requestFullscreen\",exitFn:\"exitFullscreen\",changeEvent:\"fullscreenchange\",errorEvent:\"fullscreenerror\"},{isEnabled:\"webkitFullscreenEnabled\",element:\"webkitFullscreenElement\",requestFn:\"webkitRequestFullscreen\",exitFn:\"webkitExitFullscreen\",changeEvent:\"webkitfullscreenchange\",errorEvent:\"webkitfullscreenerror\"},{isEnabled:\"mozFullScreenEnabled\",element:\"mozFullScreenElement\",requestFn:\"mozRequestFullScreen\",exitFn:\"mozCancelFullScreen\",changeEvent:\"mozfullscreenchange\",errorEvent:\"mozfullscreenerror\"},{isEnabled:\"msFullscreenEnabled\",element:\"msFullscreenElement\",requestFn:\"msRequestFullscreen\",exitFn:\"msExitFullscreen\",changeEvent:\"MSFullscreenChange\",errorEvent:\"MSFullscreenError\"}].find((vnd=>vnd.isEnabled in document)))}catch(ex){}return undefined})(),_returnsPromise=function(){let _hasPromise=null;return function(){if(null!==_hasPromise)return _hasPromise;if(_hasPromise=!1,vendor)try{const value=document.exitFullscreen();value.catch((()=>{})),_hasPromise=value instanceof Promise}catch(ex){}return _hasPromise}}();function _selectElement(requestedEl){let selectedEl=requestedEl||document.documentElement;return selectedEl===document.documentElement&&(\"msRequestFullscreen\"===vendor.requestFn||Browser.isOpera&&Browser.operaVersion<15)&&(selectedEl=document.body),selectedEl}function isFullscreen(){return Boolean(vendor&&document[vendor.element])}function requestFullscreen(options,requestedEl){if(!vendor)return Promise.reject(new Error(\"fullscreen not supported\"));const element=_selectElement(requestedEl);if(\"function\"!=typeof element[vendor.requestFn])return Promise.reject(new Error(\"fullscreen not supported\"));if(isFullscreen())return Promise.resolve();if(_returnsPromise())return element[vendor.requestFn](options);{const namespace=\".Fullscreen_requestFullscreen\";return new Promise(((resolve,reject)=>{jQuery(element).off(namespace).one(`${vendor.errorEvent}${namespace} ${vendor.changeEvent}${namespace}`,(ev=>{jQuery(this).off(namespace),ev.type===vendor.errorEvent?reject(new Error(\"unknown fullscreen request error\")):resolve()})),element[vendor.requestFn](options)}))}}function exitFullscreen(){if(!vendor||\"function\"!=typeof document[vendor.exitFn])return Promise.reject(new TypeError(\"fullscreen not supported\"));if(!isFullscreen())return Promise.reject(new TypeError(\"fullscreen mode not active\"));if(_returnsPromise())return document[vendor.exitFn]();{const namespace=\".Fullscreen_exitFullscreen\";return new Promise(((resolve,reject)=>{jQuery(document).off(namespace).one(`${vendor.errorEvent}${namespace} ${vendor.changeEvent}${namespace}`,(ev=>{jQuery(this).off(namespace),ev.type===vendor.errorEvent?reject(new Error(\"unknown fullscreen exit error\")):resolve()})),document[vendor.exitFn]()}))}}return Object.freeze(Object.defineProperties({},{vendor:{get:function(){return vendor}},element:{get:function(){return vendor?document[vendor.element]:null}},isEnabled:{value:function(){return Boolean(vendor&&document[vendor.isEnabled])}},isFullscreen:{value:isFullscreen},request:{value:requestFullscreen},exit:{value:exitFullscreen},toggle:{value:function(options,requestedEl){return isFullscreen()?exitFullscreen():requestFullscreen(options,requestedEl)}},onChange:{value:function(handlerFn,requestedEl){if(!vendor)return;const element=_selectElement(requestedEl);$(element).on(vendor.changeEvent,handlerFn)}},offChange:{value:function(handlerFn,requestedEl){if(!vendor)return;const element=_selectElement(requestedEl);handlerFn?$(element).off(vendor.changeEvent,handlerFn):$(element).off(vendor.changeEvent)}},onError:{value:function(handlerFn,requestedEl){if(!vendor)return;const element=_selectElement(requestedEl);$(element).on(vendor.errorEvent,handlerFn)}},offError:{value:function(handlerFn,requestedEl){if(!vendor)return;const element=_selectElement(requestedEl);handlerFn?$(element).off(vendor.errorEvent,handlerFn):$(element).off(vendor.errorEvent)}}}))})(),{clone:clone,convertBreaks:convertBreaks,safeActiveElement:safeActiveElement,setDisplayTitle:setDisplayTitle,setPageElement:setPageElement,throwError:throwError,stringFrom:stringFrom}=Object.freeze(Object.defineProperties({},{clone:{value:function clone(orig){if(\"object\"!=typeof orig||null===orig)return orig;if(orig instanceof String)return String(orig);if(orig instanceof Number)return Number(orig);if(orig instanceof Boolean)return Boolean(orig);if(\"function\"==typeof orig.clone)return orig.clone(!0);if(orig.nodeType&&\"function\"==typeof orig.cloneNode)return orig.cloneNode(!0);let copy;return orig instanceof Array?copy=new Array(orig.length):orig instanceof Date?copy=new Date(orig.getTime()):orig instanceof Map?(copy=new Map,orig.forEach(((val,key)=>copy.set(key,clone(val))))):orig instanceof RegExp?copy=new RegExp(orig):orig instanceof Set?(copy=new Set,orig.forEach((val=>copy.add(clone(val))))):copy=Object.create(Object.getPrototypeOf(orig)),Object.keys(orig).forEach((name=>copy[name]=clone(orig[name]))),copy}},convertBreaks:{value:function(source){const output=document.createDocumentFragment();let node,para=document.createElement(\"p\");for(;null!==(node=source.firstChild);){if(node.nodeType===Node.ELEMENT_NODE)switch(node.nodeName.toUpperCase()){case\"BR\":if(null!==node.nextSibling&&node.nextSibling.nodeType===Node.ELEMENT_NODE&&\"BR\"===node.nextSibling.nodeName.toUpperCase()){source.removeChild(node.nextSibling),source.removeChild(node),output.appendChild(para),para=document.createElement(\"p\");continue}if(!para.hasChildNodes()){source.removeChild(node);continue}break;case\"ADDRESS\":case\"ARTICLE\":case\"ASIDE\":case\"BLOCKQUOTE\":case\"CENTER\":case\"DIV\":case\"DL\":case\"FIGURE\":case\"FOOTER\":case\"FORM\":case\"H1\":case\"H2\":case\"H3\":case\"H4\":case\"H5\":case\"H6\":case\"HEADER\":case\"HR\":case\"MAIN\":case\"NAV\":case\"OL\":case\"P\":case\"PRE\":case\"SECTION\":case\"TABLE\":case\"UL\":para.hasChildNodes()&&(output.appendChild(para),para=document.createElement(\"p\")),output.appendChild(node);continue}para.appendChild(node)}para.hasChildNodes()&&output.appendChild(para),source.appendChild(output)}},safeActiveElement:{value:function(){try{return document.activeElement||null}catch(ex){return null}}},setDisplayTitle:{value:function(title){if(\"string\"!=typeof title)throw new TypeError(`story display title must be a string (received: ${Util.getType(title)})`);const render=document.createDocumentFragment();new Wikifier(render,title);const text=function(source){const copy=source.cloneNode(!0),frag=document.createDocumentFragment();let node;for(;null!==(node=copy.firstChild);){if(node.nodeType===Node.ELEMENT_NODE)switch(node.nodeName.toUpperCase()){case\"BR\":case\"DIV\":case\"P\":frag.appendChild(document.createTextNode(\" \"))}frag.appendChild(node)}return frag.textContent}(render).trim();document.title=Config.passages.displayTitles&&\"\"!==State.passage&&State.passage!==Config.passages.start?`${State.passage} | ${text}`:text;const storyTitle=document.getElementById(\"story-title\");null!==storyTitle&&jQuery(storyTitle).empty().append(render)}},setPageElement:{value:function(idOrElement,titles,defaultText){const el=\"object\"==typeof idOrElement?idOrElement:document.getElementById(idOrElement);if(null==el)return null;const ids=Array.isArray(titles)?titles:[titles];jQuery(el).empty();for(let i=0,iend=ids.length;i<iend;++i)if(Story.has(ids[i]))return el.append(Story.get(ids[i]).render()),el;if(null!=defaultText){const text=String(defaultText).trim();\"\"!==text&&new Wikifier(el,text)}return el}},throwError:{value:function(place,message,source,stack){const $wrapper=jQuery(document.createElement(\"div\")),$toggle=jQuery(document.createElement(\"button\")),$source=jQuery(document.createElement(\"pre\")),mesg=`${L10n.get(\"errorTitle\")}: ${message||\"unknown error\"} ${Config.saves.version}`;if($toggle.addClass(\"error-toggle\").ariaClick({label:L10n.get(\"errorToggle\")},(()=>{$toggle.hasClass(\"enabled\")?($toggle.removeClass(\"enabled\"),$source.attr({\"aria-hidden\":!0,hidden:\"hidden\"})):($toggle.addClass(\"enabled\"),$source.removeAttr(\"aria-hidden hidden\"))})).appendTo($wrapper),jQuery(document.createElement(\"span\")).addClass(\"error\").text(mesg).appendTo($wrapper),jQuery(document.createElement(\"code\")).text(source).appendTo($source),$source.addClass(\"error-source\").attr({\"aria-hidden\":!0,hidden:\"hidden\"}).appendTo($wrapper),stack){const lines=stack.split(\"\\n\");for(const ll of lines){const div=document.createElement(\"div\");div.append(ll.replace(/file:.*\\//,\"<path>/\")),$source.append(div)}}return $wrapper.addClass(\"error-view\").appendTo(place),console.warn(`${mesg}\\n\\t${source.replace(/\\n/g,\"\\n\\t\")}`),!1}},stringFrom:{value:function stringFrom(value){switch(typeof value){case\"function\":return\"[function]\";case\"number\":if(Number.isNaN(value))return\"[number NaN]\";break;case\"object\":if(null===value)return\"[null]\";if(value instanceof Array)return value.map((val=>stringFrom(val))).join(\", \");if(value instanceof Set)return Array.from(value).map((val=>stringFrom(val))).join(\", \");if(value instanceof Map)return`{ ${Array.from(value).map((([key,val])=>`${stringFrom(key)} → ${stringFrom(val)}`)).join(\", \")} }`;if(value instanceof Date)return value.toLocaleString();if(value instanceof Element){if(value===document.documentElement||value===document.head||value===document.body)throw new Error(\"illegal operation; attempting to convert the <html>, <head>, or <body> tags to string is not allowed\");return value.outerHTML}return value instanceof Node?value.textContent:\"function\"==typeof value.toString?value.toString():Object.prototype.toString.call(value);case\"symbol\":return`[symbol${void 0!==value.description?` \"${value.description}\"`:\"\"}]`;case\"undefined\":return\"[undefined]\"}return String(value)}}}));(()=>{function onKeypressFn(ev){13!==ev.which&&32!==ev.which||(ev.preventDefault(),jQuery(safeActiveElement()||this).trigger(\"click\"))}function onClickFnWrapper(fn){return function(){const $this=jQuery(this),dataPassage=$this.attr(\"data-passage\"),initialDataPassage=window&&window.SugarCube&&window.SugarCube.State&&window.SugarCube.State.passage,savedYOffset=window.pageYOffset;$this.is(\"[aria-pressed]\")&&$this.attr(\"aria-pressed\",\"true\"===$this.attr(\"aria-pressed\")?\"false\":\"true\"),fn.apply(this,arguments);!dataPassage||window.lastDataPassageLink!==dataPassage&&initialDataPassage!==dataPassage||Config.navigation.rememberYPos&&(!V.options||V.options&&!1!==V.options.scrollRemember)&&window.scrollTo(0,savedYOffset),window.lastDataPassageLink=dataPassage}}jQuery.fn.extend({ariaClick(options,handler){if(0===this.length||0===arguments.length)return this;let opts=options,fn=handler;return null==fn&&(fn=opts,opts=undefined),opts=jQuery.extend({namespace:undefined,one:!1,selector:undefined,data:undefined,role:undefined,controls:undefined,pressed:undefined,label:undefined},opts),\"string\"!=typeof opts.namespace?opts.namespace=\"\":\".\"!==opts.namespace[0]&&(opts.namespace=`.${opts.namespace}`),\"boolean\"==typeof opts.pressed&&(opts.pressed=opts.pressed?\"true\":\"false\"),this.filter(\"button\").prop(\"type\",\"button\"),null!=opts.role?this.attr(\"role\",opts.role):this.not(\"[role]\").filter(\"a,[data-passage]\").attr(\"role\",\"link\").end().not(\"a\").not(\"[data-passage]\").attr(\"role\",\"button\").end().end().end(),this.attr(\"tabindex\",0),null!=opts.controls&&this.attr(\"aria-controls\",opts.controls),null!=opts.pressed&&this.attr(\"aria-pressed\",opts.pressed),null!=opts.label&&this.attr({\"aria-label\":opts.label,title:opts.label}),this.not(\"button\").on(`keypress.aria-clickable${opts.namespace}`,opts.selector,onKeypressFn),this.on(`click.aria-clickable${opts.namespace}`,opts.selector,opts.data,opts.one?function(fn){return onClickFnWrapper((function(){jQuery(this).off(\".aria-clickable\").removeAttr(\"role tabindex aria-controls aria-pressed\").filter(\"button\").prop(\"disabled\",!0),fn.apply(this,arguments)}))}(fn):onClickFnWrapper(fn)),this},ariaDisabled(disable){if(0===this.length||0===arguments.length)return this;const $nonDisableable=this.not(\"button,fieldset,input,menuitem,optgroup,option,select,textarea\"),$disableable=this.filter(\"button,fieldset,input,menuitem,optgroup,option,select,textarea\");return disable?($nonDisableable.each((function(){this.setAttribute(\"disabled\",\"\"),this.setAttribute(\"aria-disabled\",\"true\")})),$disableable.each((function(){this.disabled=!0,this.setAttribute(\"aria-disabled\",\"true\")}))):($nonDisableable.each((function(){this.removeAttribute(\"disabled\"),this.removeAttribute(\"aria-disabled\")})),$disableable.each((function(){this.disabled=!1,this.removeAttribute(\"aria-disabled\")}))),this},ariaIsDisabled(){return this.is(\"[disabled]\")}})})(),jQuery.extend({wikiWithOptions(options,...sources){if(0===sources.length)return;const frag=document.createDocumentFragment();sources.forEach((content=>new Wikifier(frag,content,options)));const errors=[...frag.querySelectorAll(\".error\")].map((errEl=>errEl.textContent.replace(errorPrologRegExp,\"\")));if(errors.length>0)throw new Error(errors.join(\"; \"))},wiki(...sources){this.wikiWithOptions(undefined,...sources)}}),jQuery.fn.extend({wikiWithOptions(options,...sources){if(0===this.length||0===sources.length)return this;const frag=document.createDocumentFragment();return sources.forEach((content=>new Wikifier(frag,content,options))),this.append(frag),this},wiki(...sources){return this.wikiWithOptions(undefined,...sources)}});var Util=(()=>{const utilGetType=(()=>{const toString=Object.prototype.toString;return\"[object Object]\"===toString.call(new Map)?function(O){if(null===O)return\"null\";if(O instanceof Map)return\"Map\";if(O instanceof Set)return\"Set\";const baseType=typeof O;return\"object\"===baseType?toString.call(O).slice(8,-1):baseType}:function(O){if(null===O)return\"null\";const baseType=typeof O;return\"object\"===baseType?toString.call(O).slice(8,-1):baseType}})();function utilToEnum(obj){const pEnum=Object.create(null);if(obj instanceof Array)obj.forEach(((val,i)=>pEnum[String(val)]=i));else if(obj instanceof Set)Array.from(obj).forEach(((val,i)=>pEnum[String(val)]=i));else if(obj instanceof Map)obj.forEach(((val,key)=>pEnum[String(key)]=val));else{if(\"object\"!=typeof obj||null===obj||Object.getPrototypeOf(obj)!==Object.prototype)throw new TypeError(\"Util.toEnum obj parameter must be an Array, Map, Set, or generic object\");Object.assign(pEnum,obj)}return Object.freeze(pEnum)}function utilToStringTag(obj){return Object.prototype.toString.call(obj).slice(8,-1)}const _illegalSlugCharsRe=/[\\x00-\\x20!-/:-@[-^`{-\\x9f]+/g,_isInvalidSlugRe=/^-*$/;const _illegalFilenameCharsRE=/[\\x00-\\x1f\"#$%&'*+,/:;<=>?\\\\^`|\\x7f-\\x9f]+/g;const _markupCharsRe=/[!\"#$&'*\\-/<=>?@[\\\\\\]^_`{|}~]/g,_hasMarkupCharsRe=new RegExp(_markupCharsRe.source),_markupCharsMap=utilToEnum({\"!\":\"&#33;\",'\"':\"&quot;\",\"#\":\"&#35;\",$:\"&#36;\",\"&\":\"&amp;\",\"'\":\"&#39;\",\"*\":\"&#42;\",\"-\":\"&#45;\",\"/\":\"&#47;\",\"<\":\"&lt;\",\"=\":\"&#61;\",\">\":\"&gt;\",\"?\":\"&#63;\",\"@\":\"&#64;\",\"[\":\"&#91;\",\"\\\\\":\"&#92;\",\"]\":\"&#93;\",\"^\":\"&#94;\",_:\"&#95;\",\"`\":\"&#96;\",\"{\":\"&#123;\",\"|\":\"&#124;\",\"}\":\"&#125;\",\"~\":\"&#126;\"});const _htmlCharsRe=/[&<>\"'`]/g,_hasHtmlCharsRe=new RegExp(_htmlCharsRe.source),_htmlCharsMap=utilToEnum({\"&\":\"&amp;\",\"<\":\"&lt;\",\">\":\"&gt;\",'\"':\"&quot;\",\"'\":\"&#39;\",\"`\":\"&#96;\"});function utilEscape(str){if(null==str)return\"\";const val=String(str);return val&&_hasHtmlCharsRe.test(val)?val.replace(_htmlCharsRe,(ch=>_htmlCharsMap[ch])):val}const _escapedHtmlRe=/&(?:amp|#38|#x26|lt|#60|#x3c|gt|#62|#x3e|quot|#34|#x22|apos|#39|#x27|#96|#x60);/gi,_hasEscapedHtmlRe=new RegExp(_escapedHtmlRe.source,\"i\"),_escapedHtmlMap=utilToEnum({\"&amp;\":\"&\",\"&#38;\":\"&\",\"&#x26;\":\"&\",\"&lt;\":\"<\",\"&#60;\":\"<\",\"&#x3c;\":\"<\",\"&gt;\":\">\",\"&#62;\":\">\",\"&#x3e;\":\">\",\"&quot;\":'\"',\"&#34;\":'\"',\"&#x22;\":'\"',\"&apos;\":\"'\",\"&#39;\":\"'\",\"&#x27;\":\"'\",\"&#96;\":\"`\",\"&#x60;\":\"`\"});function utilUnescape(str){if(null==str)return\"\";const val=String(str);return val&&_hasEscapedHtmlRe.test(val)?val.replace(_escapedHtmlRe,(entity=>_escapedHtmlMap[entity.toLowerCase()])):val}const _nowSource=Has.performance?performance:Date;const _cssTimeRe=/^([+-]?(?:\\d*\\.)?\\d+)([Mm]?[Ss])$/;const utilScrubEventKey=(()=>{let separatorKey,decimalKey;if(\"undefined\"!=typeof Intl&&\"function\"==typeof Intl.NumberFormat){const match=(new Intl.NumberFormat).format(111111.5).match(/(\\D*)\\d+(\\D*)/);match&&(separatorKey=match[1],decimalKey=match[2])}return separatorKey||decimalKey||(separatorKey=\",\",decimalKey=\".\"),function(key){switch(key){case\"Scroll\":return\"ScrollLock\";case\"Spacebar\":return\" \";case\"Left\":return\"ArrowLeft\";case\"Right\":return\"ArrowRight\";case\"Up\":return\"ArrowUp\";case\"Down\":return\"ArrowDown\";case\"Del\":return\"Delete\";case\"Crsel\":return\"CrSel\";case\"Exsel\":return\"ExSel\";case\"Esc\":return\"Escape\";case\"Apps\":return\"ContextMenu\";case\"Nonconvert\":return\"NonConvert\";case\"MediaNextTrack\":return\"MediaTrackNext\";case\"MediaPreviousTrack\":return\"MediaTrackPrevious\";case\"VolumeUp\":return\"AudioVolumeUp\";case\"VolumeDown\":return\"AudioVolumeDown\";case\"VolumeMute\":return\"AudioVolumeMute\";case\"Zoom\":return\"ZoomToggle\";case\"SelectMedia\":case\"MediaSelect\":return\"LaunchMediaPlayer\";case\"Add\":return\"+\";case\"Divide\":return\"/\";case\"Multiply\":return\"*\";case\"Subtract\":return\"-\";case\"Decimal\":return decimalKey;case\"Separator\":return separatorKey}return key}})(),utilHasMediaQuery=\"function\"!=typeof window.matchMedia?function(){return!1}:function(mediaQuery){return window.matchMedia(mediaQuery).matches};return Object.freeze(Object.defineProperties({},{getType:{value:utilGetType},isBoolean:{value:function(obj){return\"boolean\"==typeof obj||\"string\"==typeof obj&&(\"true\"===obj||\"false\"===obj)}},isIterable:{value:function(obj){return null!=obj&&\"function\"==typeof obj[Symbol.iterator]}},isNumeric:{value:function(obj){let num;switch(typeof obj){case\"number\":num=obj;break;case\"string\":num=Number(obj);break;default:return!1}return!Number.isNaN(num)&&Number.isFinite(num)}},sameValueZero:{value:function(a,b){return a===b||a!=a&&b!=b}},toEnum:{value:utilToEnum},toStringTag:{value:utilToStringTag},slugify:{value:function(str){const base=String(str).trim(),_legacy=base.replace(/[^\\w\\s\\u2013\\u2014-]+/g,\"\").replace(/[_\\s\\u2013\\u2014-]+/g,\"-\").toLocaleLowerCase();return _isInvalidSlugRe.test(_legacy)?base.replace(_illegalSlugCharsRe,\"\").replace(/[_\\s\\u2013\\u2014-]+/g,\"-\"):_legacy}},sanitizeFilename:{value:function(str){return String(str).trim().replace(_illegalFilenameCharsRE,\"\")}},escapeMarkup:{value:function(str){if(null==str)return\"\";const val=String(str);return val&&_hasMarkupCharsRe.test(val)?val.replace(_markupCharsRe,(ch=>_markupCharsMap[ch])):val}},escape:{value:utilEscape},unescape:{value:utilUnescape},charAndPosAt:{value:function(text,position){const str=String(text),pos=Math.trunc(position),code=str.charCodeAt(pos);if(Number.isNaN(code))return{char:\"\",start:-1,end:-1};const retval={char:str.charAt(pos),start:pos,end:pos};if(code<55296||code>57343)return retval;if(code>=55296&&code<=56319){const nextPos=pos+1;if(nextPos>=str.length)return retval;const nextCode=str.charCodeAt(nextPos);return nextCode<56320||nextCode>57343||(retval.char=retval.char+str.charAt(nextPos),retval.end=nextPos),retval}if(0===pos)return retval;const prevPos=pos-1,prevCode=str.charCodeAt(prevPos);return prevCode<55296||prevCode>56319||(retval.char=str.charAt(prevPos)+retval.char,retval.start=prevPos),retval}},now:{value:function(){return _nowSource.now()}},fromCssTime:{value:function(cssTime){const match=_cssTimeRe.exec(String(cssTime));if(null===match)throw new SyntaxError(`invalid time value syntax: \"${cssTime}\"`);let msec=Number(match[1]);if(1===match[2].length&&(msec*=1e3),Number.isNaN(msec)||!Number.isFinite(msec))throw new RangeError(`invalid time value: \"${cssTime}\"`);return msec}},toCssTime:{value:function(msec){if(\"number\"!=typeof msec||Number.isNaN(msec)||!Number.isFinite(msec)){let what;switch(typeof msec){case\"string\":what=`\"${msec}\"`;break;case\"number\":what=String(msec);break;default:what=utilToStringTag(msec)}throw new Error(`invalid milliseconds: ${what}`)}return`${msec}ms`}},fromCssProperty:{value:function(cssName){if(!cssName.includes(\"-\"))switch(cssName){case\"bgcolor\":return\"backgroundColor\";case\"float\":return\"cssFloat\";default:return cssName}return(\"-ms-\"===cssName.slice(0,4)?cssName.slice(1):cssName).split(\"-\").map(((part,i)=>0===i?part:part.toUpperFirst())).join(\"\")}},parseUrl:{value:function(url){const el=document.createElement(\"a\"),queryObj=Object.create(null);el.href=url,el.search&&el.search.replace(/^\\?/,\"\").splitOrEmpty(/(?:&(?:amp;)?|;)/).forEach((query=>{const[key,value]=query.split(\"=\");queryObj[key]=value}));const pathname=el.host&&\"/\"!==el.pathname[0]?`/${el.pathname}`:el.pathname;return{href:el.href,protocol:el.protocol,host:el.host,hostname:el.hostname,port:el.port,path:`${pathname}${el.search}`,pathname:pathname,query:el.search,search:el.search,queries:queryObj,searches:queryObj,hash:el.hash}}},newExceptionFrom:{value:function(original,exceptionType,override){if(\"object\"!=typeof original||null===original)throw new Error(\"Util.newExceptionFrom original parameter must be an object\");if(\"function\"!=typeof exceptionType)throw new Error(\"Util.newExceptionFrom exceptionType parameter must be an error type constructor\");const ex=new exceptionType(original.message);void 0!==original.name&&(ex.name=original.name),void 0!==original.code&&(ex.code=original.code),void 0!==original.columnNumber&&(ex.columnNumber=original.columnNumber),void 0!==original.description&&(ex.description=original.description),void 0!==original.fileName&&(ex.fileName=original.fileName),void 0!==original.lineNumber&&(ex.lineNumber=original.lineNumber),void 0!==original.number&&(ex.number=original.number),void 0!==original.stack&&(ex.stack=original.stack);const overrideType=typeof override;if(\"undefined\"!==overrideType)if(\"object\"===overrideType&&null!==override)Object.assign(ex,override);else{if(\"string\"!==overrideType)throw new Error(\"Util.newExceptionFrom override parameter must be an object or string\");ex.message=override}return ex}},scrubEventKey:{value:utilScrubEventKey},hasMediaQuery:{value:utilHasMediaQuery},random:{value:Math.random},entityEncode:{value:utilEscape},entityDecode:{value:utilUnescape},evalExpression:{value:(...args)=>Scripting.evalJavaScript(...args)},evalStatements:{value:(...args)=>Scripting.evalJavaScript(...args)}}))})(),SimpleStore=(()=>{const _adapters=[];let _initialized=null;return Object.freeze(Object.defineProperties({},{adapters:{value:_adapters},create:{value:function(storageId,persistent){if(_initialized)return _initialized.create(storageId,persistent);for(let i=0;i<_adapters.length;++i)if(_adapters[i].init(storageId,persistent))return _initialized=_adapters[i],_initialized.create(storageId,persistent);throw new Error(\"no valid storage adapters found\")}}}))})();SimpleStore.adapters.push((()=>{let _ok=!1;class _FCHostStorageAdapter{constructor(persistent){let engine=null,name=null;persistent?(engine=window.FCHostPersistent,name=\"FCHostPersistent\"):(engine=window.FCHostSession,name=\"FCHostSession\"),Object.defineProperties(this,{_engine:{value:engine},name:{value:name},persistent:{value:!!persistent}})}get length(){return this._engine.size()}size(){return this._engine.size()}keys(){return this._engine.keys()}has(key){return!(\"string\"!=typeof key||!key)&&this._engine.has(key)}get(key){if(\"string\"!=typeof key||!key)return null;const value=this._engine.get(key);return null==value?null:_FCHostStorageAdapter._deserialize(value)}set(key,value){return!(\"string\"!=typeof key||!key)&&(this._engine.set(key,_FCHostStorageAdapter._serialize(value)),!0)}delete(key){return!(\"string\"!=typeof key||!key)&&(this._engine.remove(key),!0)}clear(){return this._engine.clear(),!0}static _serialize(obj){return JSON.stringify(obj)}static _deserialize(str){return JSON.parse(str)}}return Object.freeze(Object.defineProperties({},{init:{value:function(){return _ok=function(){try{if(void 0!==window.FCHostPersistent)return!0}catch(ex){}return!1}(),_ok}},create:{value:function(storageId,persistent){if(!_ok)throw new Error(\"adapter not initialized\");return new _FCHostStorageAdapter(persistent)}}}))})()),SimpleStore.adapters.push((()=>{let _ok=!1;class _WebStorageAdapter{constructor(storageId,persistent){const prefix=`${storageId}.`;let engine=null,name=null;persistent?(engine=window.localStorage,name=\"localStorage\"):(engine=window.sessionStorage,name=\"sessionStorage\"),Object.defineProperties(this,{_engine:{value:engine},_prefix:{value:prefix},_prefixRe:{value:new RegExp(`^${RegExp.escape(prefix)}`)},name:{value:name},id:{value:storageId},persistent:{value:!!persistent}})}get length(){return this.keys().length}size(){return this.keys().length}keys(){const keys=[];for(let i=0;i<this._engine.length;++i){const key=this._engine.key(i);this._prefixRe.test(key)&&keys.push(key.replace(this._prefixRe,\"\"))}return keys}has(key){return!(\"string\"!=typeof key||!key)&&this._engine.hasOwnProperty(this._prefix+key)}get(key){if(\"string\"!=typeof key||!key)return null;const value=this._engine.getItem(this._prefix+key);return null==value?null:_WebStorageAdapter._deserialize(value)}set(key,value){if(\"string\"!=typeof key||!key)return!1;try{this._engine.setItem(this._prefix+key,_WebStorageAdapter._serialize(value))}catch(ex){if(/quota.?(?:exceeded|reached)/i.test(ex.name+ex.message))throw Util.newExceptionFrom(ex,Error,`${this.name} quota exceeded`);throw ex}return!0}delete(key){return!(\"string\"!=typeof key||!key)&&(this._engine.removeItem(this._prefix+key),!0)}clear(){const keys=this.keys();for(let i=0,iend=keys.length;i<iend;++i)this.delete(keys[i]);return!0}static _serialize(obj){return 1===Config.saves.useLZString?LZString.compressToUTF16(JSON.stringify(obj)):JSON.stringify(obj)}static _deserialize(str){let parsedObj=null;try{parsedObj=JSON.parse(str),-1===Config.saves.useLZString&&(Config.saves.useLZString=0)}catch(ex){parsedObj=JSON.parse(LZString.decompressFromUTF16(str)),-1===Config.saves.useLZString&&(Config.saves.useLZString=1)}return parsedObj}}return Object.freeze(Object.defineProperties({},{init:{value:function(){function hasWebStorage(storeId){try{const store=window[storeId],tid=`_sc_${String(Date.now())}`;store.setItem(tid,tid);const result=store.getItem(tid)===tid;return store.removeItem(tid),result}catch(ex){}return!1}return _ok=hasWebStorage(\"localStorage\")&&hasWebStorage(\"sessionStorage\"),_ok}},create:{value:function(storageId,persistent){if(!_ok)throw new Error(\"adapter not initialized\");return new _WebStorageAdapter(storageId,persistent)}}}))})()),SimpleStore.adapters.push((()=>{const _MAX_EXPIRY=\"Tue, 19 Jan 2038 03:14:07 GMT\",_MIN_EXPIRY=\"Thu, 01 Jan 1970 00:00:00 GMT\";let _ok=!1;class _CookieAdapter{constructor(storageId,persistent){const prefix=`${storageId}${persistent?\"!\":\"*\"}.`;Object.defineProperties(this,{_prefix:{value:prefix},_prefixRe:{value:new RegExp(`^${RegExp.escape(prefix)}`)},name:{value:\"cookie\"},id:{value:storageId},persistent:{value:!!persistent}})}get length(){return this.keys().length}size(){return this.keys().length}keys(){if(\"\"===document.cookie)return[];const cookies=document.cookie.split(/;\\s*/),keys=[];for(let i=0;i<cookies.length;++i){const kvPair=cookies[i].split(\"=\"),key=decodeURIComponent(kvPair[0]);if(this._prefixRe.test(key)){\"\"!==decodeURIComponent(kvPair[1])&&keys.push(key.replace(this._prefixRe,\"\"))}}return keys}has(key){return!(\"string\"!=typeof key||!key)&&null!==_CookieAdapter._getCookie(this._prefix+key)}get(key){if(\"string\"!=typeof key||!key)return null;const value=_CookieAdapter._getCookie(this._prefix+key);return null===value?null:_CookieAdapter._deserialize(value)}set(key,value){if(\"string\"!=typeof key||!key)return!1;try{if(_CookieAdapter._setCookie(this._prefix+key,_CookieAdapter._serialize(value),this.persistent?_MAX_EXPIRY:undefined),!this.has(key))throw new Error(\"unknown validation error during set\")}catch(ex){throw Util.newExceptionFrom(ex,Error,`cookie error: ${ex.message}`)}return!0}delete(key){if(\"string\"!=typeof key||!key||!this.has(key))return!1;try{if(_CookieAdapter._setCookie(this._prefix+key,undefined,_MIN_EXPIRY),this.has(key))throw new Error(\"unknown validation error during delete\")}catch(ex){throw Util.newExceptionFrom(ex,Error,`cookie error: ${ex.message}`)}return!0}clear(){const keys=this.keys();for(let i=0,iend=keys.length;i<iend;++i)this.delete(keys[i]);return!0}static _getCookie(prefixedKey){if(!prefixedKey||\"\"===document.cookie)return null;const cookies=document.cookie.split(/;\\s*/);for(let i=0;i<cookies.length;++i){const kvPair=cookies[i].split(\"=\");if(prefixedKey===decodeURIComponent(kvPair[0])){return decodeURIComponent(kvPair[1])||null}}return null}static _setCookie(prefixedKey,value,expiry){if(!prefixedKey)return;let payload=`${encodeURIComponent(prefixedKey)}=`;null!=value&&(payload+=encodeURIComponent(value)),null!=expiry&&(payload+=`; expires=${expiry}`),payload+=\"; path=/\",document.cookie=payload}static _serialize(obj){return JSON.stringify(obj)}static _deserialize(str){return JSON.parse(str)}}return Object.freeze(Object.defineProperties({},{init:{value:function(storageId){try{const tid=`_sc_${String(Date.now())}`;_CookieAdapter._setCookie(tid,_CookieAdapter._serialize(tid),undefined),_ok=_CookieAdapter._deserialize(_CookieAdapter._getCookie(tid))===tid,_CookieAdapter._setCookie(tid,undefined,_MIN_EXPIRY)}catch(ex){_ok=!1}return _ok&&function(storageId){if(\"\"===document.cookie)return;const oldPrefix=`${storageId}.`,oldPrefixRe=new RegExp(`^${RegExp.escape(oldPrefix)}`),persistPrefix=`${storageId}!.`,sessionPrefix=`${storageId}*.`,sessionTestRe=/\\.(?:state|rcWarn)$/,cookies=document.cookie.split(/;\\s*/);for(let i=0;i<cookies.length;++i){const kvPair=cookies[i].split(\"=\"),key=decodeURIComponent(kvPair[0]);if(oldPrefixRe.test(key)){const value=decodeURIComponent(kvPair[1]);if(\"\"!==value){const persist=!sessionTestRe.test(key);_CookieAdapter._setCookie(key,undefined,_MIN_EXPIRY),_CookieAdapter._setCookie(key.replace(oldPrefixRe,(()=>persist?persistPrefix:sessionPrefix)),value,persist?_MAX_EXPIRY:undefined)}}}}(storageId),_ok}},create:{value:function(storageId,persistent){if(!_ok)throw new Error(\"adapter not initialized\");return new _CookieAdapter(storageId,persistent)}}}))})());var DebugView=(()=>{class DebugView{constructor(parent,type,name,title){Object.defineProperties(this,{parent:{value:parent},view:{value:document.createElement(\"span\")},break:{value:document.createElement(\"wbr\")}}),jQuery(this.view).attr({title:title,\"aria-label\":title,\"data-type\":null!=type?type:\"\",\"data-name\":null!=name?name:\"\"}).addClass(\"debug\"),jQuery(this.break).addClass(\"debug hidden\"),this.parent.appendChild(this.view),this.parent.appendChild(this.break)}get output(){return this.view}get type(){return this.view.getAttribute(\"data-type\")}set type(type){this.view.setAttribute(\"data-type\",null!=type?type:\"\")}get name(){return this.view.getAttribute(\"data-name\")}set name(name){this.view.setAttribute(\"data-name\",null!=name?name:\"\")}get title(){return this.view.title}set title(title){this.view.title=title}append(el){return jQuery(this.view).append(el),this}modes(options){if(null==options){const current={};return this.view.className.splitOrEmpty(/\\s+/).forEach((name=>{\"debug\"!==name&&(current[name]=!0)})),current}if(\"object\"==typeof options)return Object.keys(options).forEach((function(name){this[options[name]?\"addClass\":\"removeClass\"](name)}),jQuery(this.view)),this;throw new Error(\"DebugView.prototype.modes options parameter must be an object or null/undefined\")}remove(){const $view=jQuery(this.view);this.view.hasChildNodes()&&$view.contents().appendTo(this.parent),$view.remove(),jQuery(this.break).remove()}static isEnabled(){return\"enabled\"===jQuery(document.documentElement).attr(\"data-debug-view\")}static enable(){jQuery(document.documentElement).attr(\"data-debug-view\",\"enabled\"),jQuery.event.trigger(\":debugviewupdate\")}static disable(){jQuery(document.documentElement).removeAttr(\"data-debug-view\"),jQuery.event.trigger(\":debugviewupdate\")}static toggle(){\"enabled\"===jQuery(document.documentElement).attr(\"data-debug-view\")?DebugView.disable():DebugView.enable()}}return DebugView})(),NodeTyper=(()=>{class NodeTyper{constructor(config){if(\"object\"!=typeof config||null===config)throw new Error(`config parameter must be an object (received: ${Util.getType(config)})`);if(!(config.hasOwnProperty(\"targetNode\")&&config.targetNode instanceof Node))throw new Error('config parameter object \"targetNode\" property must be a node');Object.defineProperties(this,{node:{value:config.targetNode},childNodes:{value:[]},nodeValue:{writable:!0,value:\"\"},appendTo:{writable:!0,value:config.parentNode||null},classNames:{writable:!0,value:config.classNames||null},finished:{writable:!0,value:!1}});const node=this.node;let childNode;for(node.nodeValue&&(this.nodeValue=node.nodeValue,node.nodeValue=\"\");null!==(childNode=node.firstChild);)this.childNodes.push(new NodeTyper({targetNode:childNode,parentNode:node,classNames:this.classNames})),node.removeChild(childNode)}finish(){for(;this.type(!0););return!1}type(flush){if(this.finished)return!1;if(this.appendTo){if(this.appendTo.appendChild(this.node),this.appendTo=null,this.node.nodeType!==Node.ELEMENT_NODE&&this.node.nodeType!==Node.TEXT_NODE||\"none\"===jQuery(this.node.parentNode).css(\"display\"))return this.finish();this.node.parentNode&&this.classNames&&jQuery(this.node.parentNode).addClass(this.classNames)}if(this.nodeValue){if(flush)this.node.nodeValue+=this.nodeValue,this.nodeValue=\"\";else{const{char:char,start:start,end:end}=Util.charAndPosAt(this.nodeValue,0);this.node.nodeValue+=char,this.nodeValue=this.nodeValue.slice(1+end-start)}return!0}this.classNames&&(jQuery(this.node.parentNode).removeClass(this.classNames),this.classNames=null);const childNodes=this.childNodes;for(;childNodes.length>0;){if(childNodes[0].type())return!0;childNodes.shift()}return this.finished=!0,!1}}return NodeTyper})();class PRNG{constructor(seed,pull){switch(this.primes=[2,3,5,7,11,13,17,19,23,29],this.limiter=Math.floor(Math.sqrt(Number.MAX_SAFE_INTEGER/this.primes[this.primes.length-1])),this.factor=12345653,this.pull=Number(pull)||0,typeof seed){case\"number\":(seed<.25||seed>1)&&console.warn(`recommended seed value is between 0.25 and 1, got ${seed}`),this.seed=seed;break;case\"string\":this.seed=seed,this.seedInt=this.str2int(seed);break;default:this.seed=(3*Math.random()+1)/4}}random(peek=0){peek||++this.pull;const limiter=this.limiter,seed=this.seedInt||this.seed,pull=Math.floor((this.pull+peek+4327*seed)%limiter)+1;return pull*seed*this.primes[pull%(this.primes.length-1)]*this.factor%(limiter-1)/limiter}peek(depth=1){if(!Number.isInteger(depth))return console.error(`can't look ahead ${depth} times`);if(depth>9e3)return console.error(\"it's over 9000!\");const result=[];for(let i=1;i<=depth;++i)result.push(this.random(i));return result}str2int(string){let sum=0,count=0;for(const char of string){const code=char.charCodeAt();code<32||code>127||(sum+=code-32,++count)}return count?sum/count/127+.25:.25}test(count=10,granularity=10,advancerng){const distribution=new Array(granularity).fill(0);for(let i=1;i<=count;++i)++distribution[Math.floor(this.random(i)*granularity)];return advancerng&&(this.pull+=count),distribution}}window.PRNG=PRNG;var StyleWrapper=(()=>{const _imageMarkupRe=new RegExp(Patterns.cssImage,\"g\"),_hasImageMarkupRe=new RegExp(Patterns.cssImage);return class{constructor(style){if(null==style)throw new TypeError(\"StyleWrapper style parameter must be an HTMLStyleElement object\");Object.defineProperties(this,{style:{value:style}})}isEmpty(){return 0===this.style.cssRules.length}set(rawCss){this.clear(),this.add(rawCss)}add(rawCss){let css=rawCss;_hasImageMarkupRe.test(css)&&(_imageMarkupRe.lastIndex=0,css=css.replace(_imageMarkupRe,(wikiImage=>{const markup=Wikifier.helpers.parseSquareBracketedMarkup({source:wikiImage,matchStart:0});if(markup.hasOwnProperty(\"error\")||markup.pos<wikiImage.length)return wikiImage;let source=markup.source;if(\"data:\"!==source.slice(0,5)&&Story.has(source)){const passage=Story.get(source);passage.tags.includes(\"Twine.image\")&&(source=passage.text.trim())}return`url(\"${source.replace(/\"/g,\"%22\")}\")`}))),this.style.styleSheet?this.style.styleSheet.cssText+=css:this.style.appendChild(document.createTextNode(css))}clear(){this.style.styleSheet?this.style.styleSheet.cssText=\"\":jQuery(this.style).empty()}}})();function enumFrom(O){const pEnum=Object.create(null);if(O instanceof Array)O.forEach(((val,i)=>pEnum[String(val)]=i));else if(O instanceof Set)Array.from(O).forEach(((val,i)=>pEnum[String(val)]=i));else if(O instanceof Map)O.forEach(((val,key)=>pEnum[String(key)]=val));else{if(null===O||\"object\"!=typeof O||Object.getPrototypeOf(O)!==Object.prototype)throw new TypeError(\"enumFrom object parameter must be an Array, Map, Set, or generic object\");Object.assign(pEnum,O)}return Object.freeze(Object.defineProperties(pEnum,{nameFrom:{value(needle){const entry=Object.entries(this).find((entry=>entry[1]===needle));return entry?entry[0]:undefined}}}))}var Diff=(()=>{const Op=enumFrom({Delete:0,SpliceArray:1,Copy:2,CopyDate:3});function isNumeric(O){let num;switch(typeof O){case\"number\":num=O;break;case\"string\":num=Number(O);break;default:return!1}return!Number.isNaN(num)&&Number.isFinite(num)}return Object.preventExtensions(Object.create(null,{Op:{value:Op},diff:{value:function diff(a,b){const toString=Object.prototype.toString,aIsArray=a instanceof Array,delta=Object.create(null),keys=[...Object.keys(a),...Object.keys(b)].sort().filter(((val,i,arr)=>0===i||arr[i-1]!==val));let aOpKey;const isAOpKey=key=>key===aOpKey;for(let i=0,klen=keys.length;i<klen;++i){const key=keys[i],aVal=a[key],bVal=b[key];if(Object.hasOwn(a,key))if(Object.hasOwn(b,key)){if(aVal===bVal)continue;if(typeof aVal==typeof bVal)if(\"function\"==typeof aVal)aVal.toString()!==bVal.toString()&&(delta[key]=[Op.Copy,bVal]);else if(\"object\"!=typeof aVal||null===aVal)delta[key]=[Op.Copy,bVal];else{const aValType=toString.call(aVal);if(aValType===toString.call(bVal))if(aVal instanceof Date)aVal.getTime()!==bVal.getTime()&&(delta[key]=[Op.Copy,clone(bVal)]);else if(aVal instanceof Map)delta[key]=[Op.Copy,clone(bVal)];else if(aVal instanceof RegExp)aVal.toString()!==bVal.toString()&&(delta[key]=[Op.Copy,clone(bVal)]);else if(aVal instanceof Set)delta[key]=[Op.Copy,clone(bVal)];else if(aVal instanceof Array||\"[object Object]\"===aValType){const subDelta=diff(aVal,bVal);null!==subDelta&&(delta[key]=subDelta)}else delta[key]=[Op.Copy,clone(bVal)];else delta[key]=[Op.Copy,clone(bVal)]}else delta[key]=[Op.Copy,\"object\"!=typeof bVal||null===bVal?bVal:clone(bVal)]}else if(aIsArray&&isNumeric(key)){const index=Number(key);if(!aOpKey){aOpKey=\"\";do{aOpKey+=\"~\"}while(keys.some(isAOpKey));delta[aOpKey]=[Op.SpliceArray,index,index]}index<delta[aOpKey][1]&&(delta[aOpKey][1]=index),index>delta[aOpKey][2]&&(delta[aOpKey][2]=index)}else delta[key]=Op.Delete;else delta[key]=[Op.Copy,\"object\"!=typeof bVal||null===bVal?bVal:clone(bVal)]}return Object.keys(delta).length>0?delta:null}},patch:{value:function patch(orig,delta){const keys=delta?Object.keys(delta):[],patched=clone(orig);for(let i=0,klen=keys.length;i<klen;++i){const key=keys[i],value=delta[key];if(value===Op.Delete)delete patched[key];else if(value instanceof Array)switch(value[0]){case Op.SpliceArray:patched.splice(value[1],value[2]-value[1]+1);break;case Op.Copy:patched[key]=clone(value[1]);break;case Op.CopyDate:patched[key]=new Date(value[1])}else patched[key]=patch(patched[key],value)}return patched}}}))})(),L10n=(()=>{const _patternRe=/\\{\\w+\\}/g,_hasPatternRe=new RegExp(_patternRe.source);return Object.freeze(Object.defineProperties({},{init:{value:function(){strings&&Object.keys(strings).length>0&&Object.keys(l10nStrings).forEach((id=>{try{let value;switch(id){case\"identity\":value=strings.identity;break;case\"aborting\":value=strings.aborting;break;case\"cancel\":value=strings.cancel;break;case\"close\":value=strings.close;break;case\"ok\":value=strings.ok;break;case\"errorTitle\":value=strings.errors.title;break;case\"errorNonexistentPassage\":value=strings.errors.nonexistentPassage;break;case\"errorSaveMissingData\":value=strings.errors.saveMissingData;break;case\"errorSaveIdMismatch\":value=strings.errors.saveIdMismatch;break;case\"warningDegraded\":value=strings.warnings.degraded;break;case\"debugViewTitle\":value=strings.debugView.title;break;case\"debugViewToggle\":value=strings.debugView.toggle;break;case\"uiBarToggle\":value=strings.uiBar.toggle;break;case\"uiBarBackward\":value=strings.uiBar.backward;break;case\"uiBarForward\":value=strings.uiBar.forward;break;case\"uiBarJumpto\":value=strings.uiBar.jumpto;break;case\"jumptoTitle\":value=strings.jumpto.title;break;case\"jumptoTurn\":value=strings.jumpto.turn;break;case\"jumptoUnavailable\":value=strings.jumpto.unavailable;break;case\"savesTitle\":value=strings.saves.title;break;case\"savesDisallowed\":value=strings.saves.disallowed;break;case\"savesIncapable\":value=strings.saves.incapable;break;case\"savesLabelAuto\":value=strings.saves.labelAuto;break;case\"savesLabelDelete\":value=strings.saves.labelDelete;break;case\"savesLabelExport\":value=strings.saves.labelExport;break;case\"savesLabelImport\":value=strings.saves.labelImport;break;case\"savesLabelLoad\":value=strings.saves.labelLoad;break;case\"savesLabelClear\":value=strings.saves.labelClear;break;case\"savesLabelSave\":value=strings.saves.labelSave;break;case\"savesLabelSlot\":value=strings.saves.labelSlot;break;case\"savesUnavailable\":value=strings.saves.unavailable;break;case\"savesUnknownDate\":value=strings.saves.unknownDate;break;case\"settingsTitle\":value=strings.settings.title;break;case\"settingsOff\":value=strings.settings.off;break;case\"settingsOn\":value=strings.settings.on;break;case\"settingsReset\":value=strings.settings.reset;break;case\"restartTitle\":value=strings.restart.title;break;case\"restartPrompt\":value=strings.restart.prompt;break;case\"shareTitle\":value=strings.share.title;break;case\"alertTitle\":break;case\"autoloadTitle\":value=strings.autoload.title;break;case\"autoloadCancel\":value=strings.autoload.cancel;break;case\"autoloadOk\":value=strings.autoload.ok;break;case\"autoloadPrompt\":value=strings.autoload.prompt;break;case\"macroBackText\":value=strings.macros.back.text;break;case\"macroReturnText\":value=strings.macros.return.text}value&&(l10nStrings[id]=value.replace(/%\\w+%/g,(pat=>`{${pat.slice(1,-1)}}`)))}catch(ex){}}))}},get:{value:function(ids,overrides){if(!ids)return\"\";const id=(idList=>{let selectedId;return idList.some((id=>!!l10nStrings.hasOwnProperty(id)&&(selectedId=id,!0))),selectedId})(Array.isArray(ids)?ids:[ids]);if(!id)return\"\";let processed=l10nStrings[id],iteration=0;for(;_hasPatternRe.test(processed);){if(++iteration>50)throw new Error(\"L10n.get exceeded maximum replacement iterations, probable infinite loop\");_patternRe.lastIndex=0,processed=processed.replace(_patternRe,(pat=>{const subId=pat.slice(1,-1);return overrides&&overrides.hasOwnProperty(subId)?overrides[subId]:l10nStrings.hasOwnProperty(subId)?l10nStrings[subId]:void 0}))}return processed}}}))})(),strings={errors:{},warnings:{},debugView:{},uiBar:{},jumpto:{},saves:{},settings:{},restart:{},share:{},autoload:{},macros:{back:{},return:{}}},l10nStrings={identity:\"game\",aborting:\"Aborting\",cancel:\"Cancel\",close:\"Close\",ok:\"OK\",errorTitle:\"Error\",errorToggle:\"Toggle the error view\",errorNonexistentPassage:'the passage \"{passage}\" does not exist',errorSaveDiskLoadFailed:\"failed to load save file from disk\",errorSaveMissingData:\"save is missing required data. Either the loaded file is not a save or the save has become corrupted\",errorSaveIdMismatch:\"save is from the wrong {identity}\",_warningIntroLacking:\"Your browser either lacks or has disabled\",_warningOutroDegraded:\", so this {identity} is running in a degraded mode. You may be able to continue, however, some parts may not work properly.\",warningNoWebStorage:\"{_warningIntroLacking} the Web Storage API{_warningOutroDegraded}\",warningDegraded:\"{_warningIntroLacking} some of the capabilities required by this {identity}{_warningOutroDegraded}\",debugBarToggle:\"Toggle the debug bar\",debugBarNoWatches:\"— no watches set —\",debugBarAddWatch:\"Add watch\",debugBarDeleteWatch:\"Delete watch\",debugBarWatchAll:\"Watch all\",debugBarWatchNone:\"Delete all\",debugBarLabelAdd:\"Add\",debugBarLabelWatch:\"Watch\",debugBarLabelTurn:\"Turn\",debugBarLabelViews:\"Views\",debugBarViewsToggle:\"Toggle the debug views\",debugBarWatchToggle:\"Toggle the watch panel\",uiBarToggle:\"Toggle the UI bar\",uiBarBackward:\"Go backward within the {identity} history\",uiBarForward:\"Go forward within the {identity} history\",uiBarJumpto:\"Jump to a specific point within the {identity} history\",jumptoTitle:\"Jump To\",jumptoTurn:\"Turn\",jumptoUnavailable:\"No jump points currently available…\",savesTitle:\"Saves\",savesDisallowed:\"You can't save on this passage!\",savesIncapable:\"{_warningIntroLacking} the capabilities required to support saves, so saves have been disabled for this session.\",savesLabelAuto:\"Autosave\",savesLabelDelete:\"Delete \",savesLabelExport:\"Save to File…\",savesLabelImport:\"Load from File…\",savesLabelLoad:\"Load \",savesLabelClear:\"Delete All\",savesLabelSave:\"Save\",savesLabelSlot:\"Slot\",savesUnavailable:\"No save slots found…\",savesUnknownDate:\"unknown\",savesDisallowedReplay:\"The scene viewer is currently in use, preventing the use of the save system.\",savesExportReminder:\"Warning: If your browser cache is cleared, saves here will be lost! Consider saving to file every so often!\",savesHeaderSaveLoad:\"Save/Load\",savesHeaderIDName:\"ID/Name\",savesHeaderDetails:\"Details\",savesDescTitle:\"Title: \",savesDescName:\"Save Name: \",savesDescId:\"Save Id: \",savesDescDate:\"Date: \",savesPagerJump:\"Jump to most recent manual save\",savesPagerPage:\"Page:\",savesPagerSavesPerPage:\"Saves per page:\",savesOptionsConfirmOn:\"Require confirmation on:\",savesOptionsOverwrite:\"Overwrite \",savesOptionsUseLegacy:\"Switch to legacy save storage\",savesWarningSaveOnSlot:\"Save on slot\",savesWarningOverwriteSlot:\"Overwrite save in slot\",savesWarningOverwriteID:\"Save ID does not match, continue with overwrite?\",savesWarningDeleteInSlot:\"Delete save in slot\",savesWarningLoad:\"Load slot\",savesWarningDeleteAll:\"WARNING - DO YOU REALLY WANT TO DELETE ALL SAVES?\",savesLabelToClipboard:\"Save to Clipboard…\",settingsTitle:\"Settings\",settingsOff:\"Off\",settingsOn:\"On\",settingsReset:\"Reset to Defaults\",restartTitle:\"Restart\",restartPrompt:\"Are you sure that you want to restart? Unsaved progress will be lost.\",shareTitle:\"Share\",alertTitle:\"Alert\",autoloadTitle:\"Autoload\",autoloadCancel:\"Go to start\",autoloadOk:\"Load autosave\",autoloadPrompt:\"An autosave exists. Load it now or go to the start?\",macroBackText:\"Back\",macroReturnText:\"Return\"},Config=(()=>{let _navigationOverride,_navigationRememberYPos,_passagesDescriptions,_passagesStart,_passagesOnProcess,_passagesTransitionOut,_savesAutoload,_savesAutosave,_savesIsAllowed,_savesVersion,_debug=!1,_addVisitedLinkClass=!1,_cleanupWikifierOutput=!1,_loadDelay=0,_audioPauseOnFadeToZero=!0,_audioPreloadMetadata=!0,_historyControls=!0,_historyMaxStates=40,_sessionMaxStates=40,_expiredMaxStates=100,_macrosIfAssignmentError=!0,_macrosMaxLoopIterations=1e3,_macrosTypeSkipKey=\" \",_macrosTypeVisitedPassages=!0,_passagesDisplayTitles=!1,_passagesNobr=!1,_savesId=\"untitled-story\",_savesSlots=8,_savesTryDiskOnMobile=!0,_savesUseLZString=-1,_uiStowBarInitially=800,_uiUpdateStoryElements=!0;const _errHistoryModeDeprecated=\"Config.history.mode has been deprecated and is no longer used by SugarCube, please remove it from your code\";return Object.freeze({get debug(){return _debug},set debug(value){_debug=Boolean(value)},get addVisitedLinkClass(){return _addVisitedLinkClass},set addVisitedLinkClass(value){_addVisitedLinkClass=Boolean(value)},get cleanupWikifierOutput(){return _cleanupWikifierOutput},set cleanupWikifierOutput(value){_cleanupWikifierOutput=Boolean(value)},get loadDelay(){return _loadDelay},set loadDelay(value){if(!Number.isSafeInteger(value)||value<0)throw new RangeError(\"Config.loadDelay must be a non-negative integer\");_loadDelay=value},audio:Object.freeze({get pauseOnFadeToZero(){return _audioPauseOnFadeToZero},set pauseOnFadeToZero(value){_audioPauseOnFadeToZero=Boolean(value)},get preloadMetadata(){return _audioPreloadMetadata},set preloadMetadata(value){_audioPreloadMetadata=Boolean(value)}}),history:Object.freeze({get controls(){return _historyControls},set controls(value){const controls=Boolean(value);if(1===_historyMaxStates&&controls)throw new Error(\"Config.history.controls must be false when Config.history.maxStates is 1\");_historyControls=controls},get maxStates(){return _historyMaxStates},set maxStates(value){if(!Number.isSafeInteger(value)||value<1)throw new RangeError(\"Config.history.maxStates must be a positive integer\");_historyMaxStates=value,_historyControls&&1===value&&(_historyControls=!1)},get maxSessionStates(){return _sessionMaxStates},set maxSessionStates(value){if(!Number.isSafeInteger(value)||value<0)throw new RangeError(\"Config.history.maxSessionStates must be a non-negative integer\");_sessionMaxStates=value},get maxExpired(){return _expiredMaxStates},set maxExpired(value){_expiredMaxStates=value},get mode(){throw new Error(_errHistoryModeDeprecated)},set mode(_){throw new Error(_errHistoryModeDeprecated)},get tracking(){throw new Error(\"Config.history.tracking has been deprecated, use Config.history.maxStates instead\")},set tracking(_){throw new Error(\"Config.history.tracking has been deprecated, use Config.history.maxStates instead\")}}),macros:Object.freeze({get ifAssignmentError(){return _macrosIfAssignmentError},set ifAssignmentError(value){_macrosIfAssignmentError=Boolean(value)},get maxLoopIterations(){return _macrosMaxLoopIterations},set maxLoopIterations(value){if(!Number.isSafeInteger(value)||value<1)throw new RangeError(\"Config.macros.maxLoopIterations must be a positive integer\");_macrosMaxLoopIterations=value},get typeSkipKey(){return _macrosTypeSkipKey},set typeSkipKey(value){_macrosTypeSkipKey=String(value)},get typeVisitedPassages(){return _macrosTypeVisitedPassages},set typeVisitedPassages(value){_macrosTypeVisitedPassages=Boolean(value)}}),navigation:Object.freeze({get override(){return _navigationOverride},set override(value){if(!(null==value||value instanceof Function))throw new TypeError(`Config.navigation.override must be a function or null/undefined (received: ${Util.getType(value)})`);_navigationOverride=value},get rememberYPos(){return _navigationRememberYPos},set rememberYPos(value){_navigationRememberYPos=value}}),passages:Object.freeze({get descriptions(){return _passagesDescriptions},set descriptions(value){if(null!=value){const valueType=Util.getType(value);if(\"boolean\"!==valueType&&\"Object\"!==valueType&&\"function\"!==valueType)throw new TypeError(`Config.passages.descriptions must be a boolean, object, function, or null/undefined (received: ${valueType})`)}_passagesDescriptions=value},get displayTitles(){return _passagesDisplayTitles},set displayTitles(value){_passagesDisplayTitles=Boolean(value)},get nobr(){return _passagesNobr},set nobr(value){_passagesNobr=Boolean(value)},get onProcess(){return _passagesOnProcess},set onProcess(value){if(null!=value){const valueType=Util.getType(value);if(\"function\"!==valueType)throw new TypeError(`Config.passages.onProcess must be a function or null/undefined (received: ${valueType})`)}_passagesOnProcess=value},get start(){return _passagesStart},set start(value){if(null!=value){const valueType=Util.getType(value);if(\"string\"!==valueType)throw new TypeError(`Config.passages.start must be a string or null/undefined (received: ${valueType})`)}_passagesStart=value},get transitionOut(){return _passagesTransitionOut},set transitionOut(value){if(null!=value){const valueType=Util.getType(value);if(\"string\"!==valueType&&(\"number\"!==valueType||!Number.isSafeInteger(value)||value<0))throw new TypeError(`Config.passages.transitionOut must be a string, non-negative integer, or null/undefined (received: ${valueType})`)}_passagesTransitionOut=value}}),saves:Object.freeze({get autoload(){return _savesAutoload},set autoload(value){if(null!=value){const valueType=Util.getType(value);if(\"boolean\"!==valueType&&\"string\"!==valueType&&\"function\"!==valueType)throw new TypeError(`Config.saves.autoload must be a boolean, string, function, or null/undefined (received: ${valueType})`)}_savesAutoload=value},get autosave(){return _savesAutosave},set autosave(value){if(null!=value){const valueType=Util.getType(value);if(\"string\"===valueType)return void(_savesAutosave=[value]);if(\"boolean\"!==valueType&&(\"Array\"!==valueType||!value.every((item=>\"string\"==typeof item)))&&\"function\"!==valueType)throw new TypeError(`Config.saves.autosave must be a boolean, Array<string>, function, or null/undefined (received: ${valueType}${\"Array\"===valueType?\"<any>\":\"\"})`)}_savesAutosave=value},get id(){return _savesId},set id(value){if(\"string\"!=typeof value||\"\"===value)throw new TypeError(`Config.saves.id must be a non-empty string (received: ${Util.getType(value)})`);_savesId=value},get isAllowed(){return _savesIsAllowed},set isAllowed(value){if(!(null==value||value instanceof Function))throw new TypeError(`Config.saves.isAllowed must be a function or null/undefined (received: ${Util.getType(value)})`);_savesIsAllowed=value},get slots(){return _savesSlots},set slots(value){if(!Number.isSafeInteger(value)||value<0)throw new TypeError(`Config.saves.slots must be a non-negative integer (received: ${Util.getType(value)})`);_savesSlots=value},get tryDiskOnMobile(){return _savesTryDiskOnMobile},set tryDiskOnMobile(value){_savesTryDiskOnMobile=Boolean(value)},get version(){return _savesVersion},set version(value){_savesVersion=value},get useLZString(){return _savesUseLZString},set useLZString(value){return _savesUseLZString=value},get onLoad(){throw new Error(\"Config.saves.onLoad has been deprecated, use the Save.onLoad API instead\")},set onLoad(value){console.warn(\"Config.saves.onLoad has been deprecated, use the Save.onLoad API instead\"),Save.onLoad.add(value)},get onSave(){throw new Error(\"Config.saves.onSave has been deprecated, use the Save.onSave API instead\")},set onSave(value){console.warn(\"Config.saves.onSave has been deprecated, use the Save.onSave API instead\"),Save.onSave.add(value)}}),ui:Object.freeze({get stowBarInitially(){return _uiStowBarInitially},set stowBarInitially(value){const valueType=Util.getType(value);if(\"boolean\"!==valueType&&(\"number\"!==valueType||!Number.isSafeInteger(value)||value<0))throw new TypeError(`Config.ui.stowBarInitially must be a boolean or non-negative integer (received: ${valueType})`);_uiStowBarInitially=value},get updateStoryElements(){return _uiUpdateStoryElements},set updateStoryElements(value){_uiUpdateStoryElements=Boolean(value)}})})})(),SimpleAudio=(()=>{const _gestureEventNames=Object.freeze([\"click\",\"contextmenu\",\"dblclick\",\"keyup\",\"mouseup\",\"pointerup\",\"touchend\"]),_specialIds=Object.freeze([\":not\",\":all\",\":looped\",\":muted\",\":paused\",\":playing\"]),_formatSpecRe=/^([\\w-]+)\\s*\\|\\s*(\\S.*)$/,_badIdRe=/[:\\s]/,_tracks=new Map,_groups=new Map,_lists=new Map,_subscribers=new Map;let _masterRate=1,_masterVolume=1,_masterMute=!1,_masterMuteOnHidden=!1;const _playReturnsPromise=function(){let _hasPromise=null;return function(){if(null!==_hasPromise)return _hasPromise;if(_hasPromise=!1,Has.audio)try{const audio=document.createElement(\"audio\");audio.muted=!0;const value=audio.play();value.catch((()=>{})),_hasPromise=value instanceof Promise}catch(ex){}return _hasPromise}}();class AudioTrack{constructor(obj){if(obj instanceof Array)this._create(obj);else{if(!(obj instanceof AudioTrack))throw new Error(\"sources parameter must be either an array, of URIs or source objects, or an AudioTrack instance\");this._copy(obj)}}_create(sourceList){const dataUriRe=/^data:\\s*audio\\/(?:x-)?([^;,]+)\\s*[;,]/i,extRe=/\\.([^./\\\\]+)$/,formats=AudioTrack.formats,usedSources=[],audio=document.createElement(\"audio\");audio.preload=\"none\",sourceList.forEach((src=>{let srcUri=null;switch(typeof src){case\"string\":{let match;if(\"data:\"===src.slice(0,5)){if(match=dataUriRe.exec(src),null===match)throw new Error(\"source data URI missing media type\")}else if(match=extRe.exec(Util.parseUrl(src).pathname),null===match)throw new Error(\"source URL missing file extension\");formats[match[1]]&&(srcUri=src)}break;case\"object\":if(null===src)throw new Error(\"source object cannot be null\");if(!src.hasOwnProperty(\"src\"))throw new Error('source object missing required \"src\" property');if(!src.hasOwnProperty(\"format\"))throw new Error('source object missing required \"format\" property');formats[src.format]&&(srcUri=src.src);break;default:throw new Error(`invalid source value (type: ${typeof src})`)}if(null!==srcUri){const source=document.createElement(\"source\");source.src=srcUri,audio.appendChild(source),usedSources.push(srcUri)}})),audio.hasChildNodes()&&Config.audio.preloadMetadata&&(audio.preload=\"metadata\"),this._finalize(audio,usedSources,clone(sourceList))}_copy(obj){this._finalize(obj.audio.cloneNode(!0),clone(obj.sources),clone(obj.originals))}_finalize(audio,sources,originals){Object.defineProperties(this,{audio:{configurable:!0,value:audio},sources:{value:Object.freeze(sources)},originals:{value:Object.freeze(originals)},_error:{writable:!0,value:!1},_faderId:{writable:!0,value:null},_mute:{writable:!0,value:!1},_rate:{writable:!0,value:1},_volume:{writable:!0,value:1}}),jQuery(this.audio).on(\"loadstart.AudioTrack\",(()=>this._error=!1)).on(\"error.AudioTrack\",(()=>this._error=!0)).find(\"source:last-of-type\").on(\"error.AudioTrack\",(()=>this._trigger(\"error\"))),function(id,callback){if(\"function\"!=typeof callback)throw new Error(\"callback parameter must be a function\");_subscribers.set(id,callback)}(this,(mesg=>{if(this.audio)switch(mesg){case\"loadwithscreen\":if(this.hasSource()){const lockId=LoadScreen.lock();this.one(\"canplaythrough.AudioTrack_loadwithscreen error.AudioTrack_loadwithscreen\",(function(){jQuery(this).off(\".AudioTrack_loadwithscreen\"),LoadScreen.unlock(lockId)})).load()}break;case\"load\":this.load();break;case\"mute\":this._updateAudioMute();break;case\"rate\":this._updateAudioRate();break;case\"stop\":this.stop();break;case\"volume\":this._updateAudioVolume();break;case\"unload\":this.unload()}else unsubscribe(this)})),this._updateAudioMute(),this._updateAudioRate(),this._updateAudioVolume()}_trigger(eventName){jQuery(this.audio).triggerHandler(eventName)}_destroy(){unsubscribe(this),this.audio&&(jQuery(this.audio).off(),this.unload(),this._error=!0,delete this.audio)}clone(){return new AudioTrack(this)}load(){if(this.fadeStop(),this.audio.pause(),!this.audio.hasChildNodes()){if(0===this.sources.length)return;this.sources.forEach((srcUri=>{const source=document.createElement(\"source\");source.src=srcUri,this.audio.appendChild(source)}))}\"auto\"!==this.audio.preload&&(this.audio.preload=\"auto\"),this.isLoading()||this.audio.load()}unload(){this.fadeStop(),this.stop();const audio=this.audio;for(audio.preload=\"none\";audio.hasChildNodes();)audio.removeChild(audio.firstChild);audio.load()}play(){if(!this.hasSource())return Promise.reject(new Error(\"none of the candidate sources were acceptable\"));if(this.isUnloaded())return Promise.reject(new Error(\"no sources are loaded\"));if(this.isFailed())return Promise.reject(new Error(\"failed to load any of the sources\"));\"auto\"!==this.audio.preload&&(this.audio.preload=\"auto\");const namespace=\".AudioTrack_play\";return _playReturnsPromise()?this.audio.play():new Promise(((resolve,reject)=>{this.isPlaying()?resolve():(jQuery(this.audio).off(namespace).one(`error${namespace} playing${namespace} timeupdate${namespace}`,(ev=>{jQuery(this).off(namespace),\"error\"===ev.type?reject(new Error(\"unknown audio play error\")):resolve()})),this.audio.play())}))}playWhenAllowed(){this.play().catch((()=>{const gestures=_gestureEventNames.map((name=>`${name}.AudioTrack_playWhenAllowed`)).join(\" \");jQuery(document).one(gestures,(()=>{jQuery(document).off(\".AudioTrack_playWhenAllowed\"),this.audio.play()}))}))}pause(){this.audio.pause()}stop(){this.audio.pause(),this.time(0),this._trigger(\":stopped\")}fade(duration,toVol,fromVol){if(\"number\"!=typeof duration)throw new TypeError(\"duration parameter must be a number\");if(\"number\"!=typeof toVol)throw new TypeError(\"toVolume parameter must be a number\");if(null!=fromVol&&\"number\"!=typeof fromVol)throw new TypeError(\"fromVolume parameter must be a number\");if(!this.hasSource())return Promise.reject(new Error(\"none of the candidate sources were acceptable\"));if(this.isUnloaded())return Promise.reject(new Error(\"no sources are loaded\"));if(this.isFailed())return Promise.reject(new Error(\"failed to load any of the sources\"));this.fadeStop();const from=Math.clamp(null==fromVol?this.volume():fromVol,0,1),to=Math.clamp(toVol,0,1);return from!==to?(this.volume(from),jQuery(this.audio).off(\"timeupdate.AudioTrack_fade\").one(\"timeupdate.AudioTrack_fade\",(()=>{let min,max;from<to?(min=from,max=to):(min=to,max=from);const time=Math.max(duration,1),delta=(to-from)/(time/.025);this._trigger(\":fading\"),this._faderId=setInterval((()=>{this.isPlaying()?(this.volume(Math.clamp(this.volume()+delta,min,max)),Config.audio.pauseOnFadeToZero&&0===this.volume()&&this.pause(),this.volume()===to&&(this.fadeStop(),this._trigger(\":faded\"))):this.fadeStop()}),25)})),this.play()):void 0}fadeIn(duration,fromVol){return this.fade(duration,1,fromVol)}fadeOut(duration,fromVol){return this.fade(duration,0,fromVol)}fadeStop(){null!==this._faderId&&(clearInterval(this._faderId),this._faderId=null)}loop(loop){return null==loop?this.audio.loop:(this.audio.loop=!!loop,this)}mute(mute){return null==mute?this._mute:(this._mute=!!mute,this._updateAudioMute(),this)}_updateAudioMute(){this.audio.muted=this._mute||_masterMute}rate(rate){if(null==rate)return this._rate;if(\"number\"!=typeof rate)throw new TypeError(\"rate parameter must be a number\");return this._rate=Math.clamp(rate,.2,5),this._updateAudioRate(),this}_updateAudioRate(){this.audio.playbackRate=Math.clamp(this._rate*_masterRate,.2,5)}time(time){if(null==time)return this.audio.currentTime;if(\"number\"!=typeof time)throw new TypeError(\"time parameter must be a number\");return this.hasMetadata()?this.audio.currentTime=time:jQuery(this.audio).off(\"loadedmetadata.AudioTrack_time\").one(\"loadedmetadata.AudioTrack_time\",(()=>this.audio.currentTime=time)),this}volume(volume){if(null==volume)return this._volume;if(\"number\"!=typeof volume)throw new TypeError(\"volume parameter must be a number\");return this._volume=Math.clamp(volume,0,1),this._updateAudioVolume(),this}_updateAudioVolume(){this.audio.volume=Math.clamp(this._volume*_masterVolume,0,1)}duration(){return this.audio.duration}remaining(){return this.audio.duration-this.audio.currentTime}isFailed(){return this._error}isLoading(){return this.audio.networkState===HTMLMediaElement.NETWORK_LOADING}isUnloaded(){return!this.audio.hasChildNodes()}isUnavailable(){return!this.hasSource()||this.isUnloaded()||this.isFailed()}isPlaying(){return!this.audio.paused&&this.hasSomeData()}isPaused(){return this.audio.paused&&(this.audio.duration===1/0||this.audio.currentTime>0)&&!this.audio.ended}isStopped(){return this.audio.paused&&0===this.audio.currentTime}isEnded(){return this.audio.ended}isFading(){return null!==this._faderId}isSeeking(){return this.audio.seeking}hasSource(){return this.sources.length>0}hasNoData(){return this.audio.readyState===HTMLMediaElement.HAVE_NOTHING}hasMetadata(){return this.audio.readyState>=HTMLMediaElement.HAVE_METADATA}hasSomeData(){return this.audio.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA}hasData(){return this.audio.readyState===HTMLMediaElement.HAVE_ENOUGH_DATA}on(...args){return jQuery.fn.on.apply(jQuery(this.audio),args),this}one(...args){return jQuery.fn.one.apply(jQuery(this.audio),args),this}off(...args){return jQuery.fn.off.apply(jQuery(this.audio),args),this}}Object.defineProperties(AudioTrack,{formats:{value:(()=>{const audio=document.createElement(\"audio\"),types=new Map;function canPlay(mimeType){return types.has(mimeType)||types.set(mimeType,\"\"!==audio.canPlayType(mimeType).replace(/^no$/i,\"\")),types.get(mimeType)}return Object.assign(Object.create(null),{aac:canPlay(\"audio/aac\"),caf:canPlay(\"audio/x-caf\")||canPlay(\"audio/caf\"),flac:canPlay(\"audio/x-flac\")||canPlay(\"audio/flac\"),mp3:canPlay('audio/mpeg; codecs=\"mp3\"')||canPlay(\"audio/mpeg\")||canPlay(\"audio/mp3\")||canPlay(\"audio/mpa\"),mpeg:canPlay(\"audio/mpeg\"),m4a:canPlay(\"audio/x-m4a\")||canPlay(\"audio/m4a\")||canPlay(\"audio/aac\"),mp4:canPlay(\"audio/x-mp4\")||canPlay(\"audio/mp4\")||canPlay(\"audio/aac\"),ogg:canPlay(\"audio/ogg\"),oga:canPlay(\"audio/ogg\"),opus:canPlay('audio/ogg; codecs=\"opus\"')||canPlay(\"audio/opus\"),wav:canPlay('audio/wave; codecs=\"1\"')||canPlay('audio/wav; codecs=\"1\"')||canPlay(\"audio/wave\")||canPlay(\"audio/wav\"),wave:canPlay('audio/wave; codecs=\"1\"')||canPlay('audio/wav; codecs=\"1\"')||canPlay(\"audio/wave\")||canPlay(\"audio/wav\"),weba:canPlay(\"audio/webm\"),webm:canPlay(\"audio/webm\")})})()}});class AudioList{constructor(obj){if(obj instanceof Array)this._create(obj);else{if(!(obj instanceof AudioList))throw new Error(\"tracks parameter must be either an array, of track objects, or an AudioTrack instance\");this._copy(obj)}}_create(trackList){this._finalize(trackList.map((trackObj=>{if(\"object\"!=typeof trackObj)throw new Error(\"tracks parameter array members must be objects\");let own,rate,track,volume;if(trackObj instanceof AudioTrack)own=!0,rate=trackObj.rate(),track=trackObj.clone(),volume=trackObj.volume();else{if(!trackObj.hasOwnProperty(\"track\"))throw new Error('track object missing required \"track\" property');if(!(trackObj.track instanceof AudioTrack))throw new Error('track object\\'s \"track\" property must be an AudioTrack object');own=trackObj.hasOwnProperty(\"own\")&&trackObj.own,rate=trackObj.hasOwnProperty(\"rate\")?trackObj.rate:trackObj.track.rate(),track=trackObj.track,volume=trackObj.hasOwnProperty(\"volume\")?trackObj.volume:trackObj.track.volume()}return track.stop(),track.loop(!1),track.mute(!1),track.rate(rate),track.volume(volume),track.on(\"ended.AudioList\",(()=>this._onEnd())),{own:own,track:track,volume:volume,rate:rate}})))}_copy(obj){this._finalize(clone(obj.tracks))}_finalize(tracks){Object.defineProperties(this,{tracks:{configurable:!0,value:Object.freeze(tracks)},queue:{configurable:!0,value:[]},current:{writable:!0,value:null},_rate:{writable:!0,value:1},_volume:{writable:!0,value:1},_mute:{writable:!0,value:!1},_loop:{writable:!0,value:!1},_shuffle:{writable:!0,value:!1}})}_destroy(){this.stop(),this.tracks.filter((trackObj=>trackObj.own)).forEach((trackObj=>trackObj.track._destroy())),delete this.tracks,delete this.queue}load(){this.tracks.forEach((trackObj=>trackObj.track.load()))}unload(){this.stop(),this.tracks.forEach((trackObj=>trackObj.track.unload()))}play(){return null!==this.current&&!this.current.track.isUnavailable()&&!this.current.track.isEnded()||(0===this.queue.length&&this._fillQueue(),this._next())?this.current.track.play():Promise.reject(new Error(\"no tracks were available\"))}playWhenAllowed(){this.play().catch((()=>{const gestures=_gestureEventNames.map((name=>`${name}.AudioList_playWhenAllowed`)).join(\" \");jQuery(document).one(gestures,(()=>{jQuery(document).off(\".AudioList_playWhenAllowed\"),this.play()}))}))}pause(){null!==this.current&&this.current.track.pause()}stop(){null!==this.current&&(this.current.track.stop(),this.current=null),this._drainQueue()}skip(){this._next()?this.current.track.play():this._loop&&this.play()}fade(duration,toVol,fromVol){if(\"number\"!=typeof duration)throw new TypeError(\"duration parameter must be a number\");if(\"number\"!=typeof toVol)throw new TypeError(\"toVolume parameter must be a number\");if(null!=fromVol&&\"number\"!=typeof fromVol)throw new TypeError(\"fromVolume parameter must be a number\");if(0===this.queue.length&&this._fillQueue(),(null===this.current||this.current.track.isUnavailable()||this.current.track.isEnded())&&!this._next())return;const adjToVol=Math.clamp(toVol,0,1)*this.current.volume;let adjFromVol;return null!=fromVol&&(adjFromVol=Math.clamp(fromVol,0,1)*this.current.volume),this._volume=toVol,this.current.track.fade(duration,adjToVol,adjFromVol)}fadeIn(duration,fromVol){return this.fade(duration,1,fromVol)}fadeOut(duration,fromVol){return this.fade(duration,0,fromVol)}fadeStop(){null!==this.current&&this.current.track.fadeStop()}loop(loop){return null==loop?this._loop:(this._loop=!!loop,this)}mute(mute){return null==mute?this._mute:(this._mute=!!mute,null!==this.current&&this.current.track.mute(this._mute),this)}rate(rate){if(null==rate)return this._rate;if(\"number\"!=typeof rate)throw new TypeError(\"rate parameter must be a number\");return this._rate=Math.clamp(rate,.2,5),null!==this.current&&this.current.track.rate(this._rate*this.current.rate),this}shuffle(shuffle){if(null==shuffle)return this._shuffle;if(this._shuffle=!!shuffle,this.queue.length>0&&(this._fillQueue(),!this._shuffle&&null!==this.current&&this.queue.length>1)){const firstIdx=this.queue.findIndex((trackObj=>trackObj===this.current));-1!==firstIdx&&this.queue.push(...this.queue.splice(0,firstIdx+1))}return this}volume(volume){if(null==volume)return this._volume;if(\"number\"!=typeof volume)throw new TypeError(\"volume parameter must be a number\");return this._volume=Math.clamp(volume,0,1),null!==this.current&&this.current.track.volume(this._volume*this.current.volume),this}duration(){if(arguments.length>0)throw new Error(\"duration takes no parameters\");return this.tracks.map((trackObj=>trackObj.track.duration())).reduce(((prev,cur)=>prev+cur),0)}remaining(){if(arguments.length>0)throw new Error(\"remaining takes no parameters\");let remainingTime=this.queue.map((trackObj=>trackObj.track.duration())).reduce(((prev,cur)=>prev+cur),0);return null!==this.current&&(remainingTime+=this.current.track.remaining()),remainingTime}time(){if(arguments.length>0)throw new Error(\"time takes no parameters\");return this.duration()-this.remaining()}isPlaying(){return null!==this.current&&this.current.track.isPlaying()}isPaused(){return null===this.current||this.current.track.isPaused()}isStopped(){return 0===this.queue.length&&null===this.current}isEnded(){return 0===this.queue.length&&(null===this.current||this.current.track.isEnded())}isFading(){return null!==this.current&&this.current.track.isFading()}_next(){let nextTrack;for(null!==this.current&&(this.current.track.stop(),this.current=null);nextTrack=this.queue.shift();)if(!nextTrack.track.isUnavailable()){this.current=nextTrack;break}return null!==this.current&&(this.current.track.mute(this._mute),this.current.track.rate(this._rate*this.current.rate),this.current.track.volume(this._volume*this.current.volume),this.current.track.loop(!1),!0)}_onEnd(){if(0===this.queue.length){if(!this._loop)return;this._fillQueue()}this._next()&&this.current.track.play()}_drainQueue(){this.queue.splice(0)}_fillQueue(){this._drainQueue(),this.queue.push(...this.tracks.filter((trackObj=>!trackObj.track.isUnavailable()))),0!==this.queue.length&&this._shuffle&&(this.queue.shuffle(),this.queue.length>1&&this.queue[0]===this.current&&this.queue.push(this.queue.shift()))}}class AudioRunner{constructor(list){if(!(list instanceof Set||list instanceof AudioRunner))throw new TypeError(\"list parameter must be a Set or a AudioRunner instance\");Object.defineProperties(this,{trackIds:{value:new Set(list instanceof AudioRunner?list.trackIds:list)}})}load(){AudioRunner._run(this.trackIds,AudioTrack.prototype.load)}unload(){AudioRunner._run(this.trackIds,AudioTrack.prototype.unload)}play(){AudioRunner._run(this.trackIds,AudioTrack.prototype.play)}playWhenAllowed(){AudioRunner._run(this.trackIds,AudioTrack.prototype.playWhenAllowed)}pause(){AudioRunner._run(this.trackIds,AudioTrack.prototype.pause)}stop(){AudioRunner._run(this.trackIds,AudioTrack.prototype.stop)}fade(duration,toVol,fromVol){if(null==duration||null==toVol)throw new Error(\"fade requires parameters\");AudioRunner._run(this.trackIds,AudioTrack.prototype.fade,duration,toVol,fromVol)}fadeIn(duration,fromVol){if(null==duration)throw new Error(\"fadeIn requires a parameter\");AudioRunner._run(this.trackIds,AudioTrack.prototype.fadeIn,duration,fromVol)}fadeOut(duration,fromVol){if(null==duration)throw new Error(\"fadeOut requires a parameter\");AudioRunner._run(this.trackIds,AudioTrack.prototype.fadeOut,duration,fromVol)}fadeStop(){AudioRunner._run(this.trackIds,AudioTrack.prototype.fadeStop)}loop(loop){if(null==loop)throw new Error(\"loop requires a parameter\");return AudioRunner._run(this.trackIds,AudioTrack.prototype.loop,loop),this}mute(mute){if(null==mute)throw new Error(\"mute requires a parameter\");return AudioRunner._run(this.trackIds,AudioTrack.prototype.mute,mute),this}rate(rate){if(null==rate)throw new Error(\"rate requires a parameter\");return AudioRunner._run(this.trackIds,AudioTrack.prototype.rate,rate),this}time(time){if(null==time)throw new Error(\"time requires a parameter\");return AudioRunner._run(this.trackIds,AudioTrack.prototype.time,time),this}volume(volume){if(null==volume)throw new Error(\"volume requires a parameter\");return AudioRunner._run(this.trackIds,AudioTrack.prototype.volume,volume),this}on(...args){return AudioRunner._run(this.trackIds,AudioTrack.prototype.on,...args),this}one(...args){return AudioRunner._run(this.trackIds,AudioTrack.prototype.one,...args),this}off(...args){return AudioRunner._run(this.trackIds,AudioTrack.prototype.off,...args),this}static _run(ids,fn,...args){ids.forEach((id=>{const track=_tracks.get(id);track&&fn.apply(track,args)}))}}const _runnerParseSelector=(()=>{const notWsRe=/\\S/g,parenRe=/[()]/g;function processNegation(str,startPos){let match;if(notWsRe.lastIndex=startPos,match=notWsRe.exec(str),null===match||\"(\"!==match[0])throw new Error('invalid \":not()\" syntax: missing parentheticals');parenRe.lastIndex=notWsRe.lastIndex;const start=notWsRe.lastIndex,result={str:\"\",nextMatch:-1};let depth=1;for(;null!==(match=parenRe.exec(str));)if(\"(\"===match[0]?++depth:--depth,depth<1){result.nextMatch=parenRe.lastIndex,result.str=str.slice(start,result.nextMatch-1);break}return result}return function parseSelector(idArg){const ids=[],idRe=/:?[^\\s:()]+/g;let match;for(;null!==(match=idRe.exec(idArg));){const id=match[0];if(\":not\"===id){if(0===ids.length)throw new Error('invalid negation: no group ID preceded \":not()\"');const parent=ids[ids.length-1];if(\":\"!==parent.id[0])throw new Error(`invalid negation of track \"${parent.id}\": only groups may be negated with \":not()\"`);const negation=processNegation(idArg,idRe.lastIndex);if(-1===negation.nextMatch)throw new Error('unknown error parsing \":not()\"');idRe.lastIndex=negation.nextMatch,parent.not=parseSelector(negation.str)}else ids.push({id:id})}return ids}})();function masterMute(mute){if(null==mute)return _masterMute;_masterMute=!!mute,publish(\"mute\",_masterMute)}function unsubscribe(id){_subscribers.delete(id)}function publish(mesg,data){_subscribers.forEach((fn=>fn(mesg,data)))}function _newTrack(sources){return new AudioTrack(sources.map((source=>{if(\"data:\"!==source.slice(0,5)&&Story.has(source)){const passage=Story.get(source);if(passage.tags.includes(\"Twine.audio\"))return passage.text.trim()}const match=_formatSpecRe.exec(source);return null===match?source:{format:match[1],src:match[2]}})))}return Object.freeze(Object.defineProperties({},{tracks:{value:Object.freeze(Object.defineProperties({},{add:{value:function(){if(arguments.length<2){const errors=[];throw arguments.length<1&&errors.push(\"track ID\"),arguments.length<2&&errors.push(\"sources\"),new Error(`no ${errors.join(\" or \")} specified`)}const id=String(arguments[0]).trim(),what=`track ID \"${id}\"`;if(_badIdRe.test(id))throw new Error(`invalid ${what}: track IDs must not contain colons or whitespace`);const sources=Array.isArray(arguments[1])?Array.from(arguments[1]):Array.from(arguments).slice(1);let track;try{track=_newTrack(sources)}catch(ex){throw new Error(`${what}: error during track initialization: ${ex.message}`)}if(Config.debug&&!track.hasSource())throw new Error(`${what}: no supported audio sources found`);_tracks.has(id)&&_tracks.get(id)._destroy(),_tracks.set(id,track)}},delete:{value:function(id){return _tracks.has(id)&&_tracks.get(id)._destroy(),_tracks.delete(id)}},clear:{value:function(){_tracks.forEach((track=>track._destroy())),_tracks.clear()}},has:{value:function(id){return _tracks.has(id)}},get:{value:function(id){return _tracks.get(id)||null}}}))},groups:{value:Object.freeze(Object.defineProperties({},{add:{value:function(){if(arguments.length<2){const errors=[];throw arguments.length<1&&errors.push(\"group ID\"),arguments.length<2&&errors.push(\"track IDs\"),new Error(`no ${errors.join(\" or \")} specified`)}const id=String(arguments[0]).trim(),what=`group ID \"${id}\"`;if(\":\"!==id[0]||_badIdRe.test(id.slice(1)))throw new Error(`invalid ${what}: group IDs must start with a colon and must not contain colons or whitespace`);if(_specialIds.includes(id))throw new Error(`cannot clobber special ${what}`);const trackIds=Array.isArray(arguments[1])?Array.from(arguments[1]):Array.from(arguments).slice(1);let group;try{group=new Set(trackIds.map((trackId=>{if(!_tracks.has(trackId))throw new Error(`track \"${trackId}\" does not exist`);return trackId})))}catch(ex){throw new Error(`${what}: error during group initialization: ${ex.message}`)}_groups.set(id,Object.freeze(Array.from(group)))}},delete:{value:function(id){return _groups.delete(id)}},clear:{value:function(){_groups.clear()}},has:{value:function(id){return _groups.has(id)}},get:{value:function(id){return _groups.get(id)||null}}}))},lists:{value:Object.freeze(Object.defineProperties({},{add:{value:function(){if(arguments.length<2){const errors=[];throw arguments.length<1&&errors.push(\"list ID\"),arguments.length<2&&errors.push(\"track IDs\"),new Error(`no ${errors.join(\" or \")} specified`)}const id=String(arguments[0]).trim(),what=`list ID \"${id}\"`;if(_badIdRe.test(id))return this.error(`invalid ${what}: list IDs must not contain colons or whitespace`);const descriptors=Array.isArray(arguments[1])?Array.from(arguments[1]):Array.from(arguments).slice(1);let list;try{list=new AudioList(descriptors.map((desc=>{if(null===desc)throw new Error(\"track descriptor must be a string or object (type: null)\");switch(typeof desc){case\"string\":desc={id:desc};break;case\"object\":if(!desc.hasOwnProperty(\"id\")&&!desc.hasOwnProperty(\"sources\"))throw new Error('track descriptor must contain one of either an \"id\" or a \"sources\" property');if(desc.hasOwnProperty(\"id\")&&desc.hasOwnProperty(\"sources\"))throw new Error('track descriptor must contain either an \"id\" or a \"sources\" property, not both');break;default:throw new Error(`track descriptor must be a string or object (type: ${typeof desc})`)}let own,track,volume;if(desc.hasOwnProperty(\"id\")){if(\"string\"!=typeof desc.id)throw new Error('\"id\" property must be a string');if(!_tracks.has(desc.id))throw new Error(`track \"${desc.id}\" does not exist`);track=_tracks.get(desc.id)}else if(desc.hasOwnProperty(\"sources\")){if(!Array.isArray(desc.sources)||0===desc.sources.length)throw new Error('\"sources\" property must be a non-empty array');if(desc.hasOwnProperty(\"own\"))throw new Error('\"own\" property is not allowed with the \"sources\" property');try{track=_newTrack(desc.sources),own=!0}catch(ex){throw new Error(`error during track initialization: ${ex.message}`)}if(Config.debug&&!track.hasSource())throw new Error(\"no supported audio sources found\")}if(desc.hasOwnProperty(\"own\")){if(\"boolean\"!=typeof desc.own)throw new Error('\"own\" property must be a boolean');own=desc.own,own&&(track=track.clone())}if(desc.hasOwnProperty(\"volume\")){if(\"number\"!=typeof desc.volume||Number.isNaN(desc.volume)||!Number.isFinite(desc.volume)||desc.volume<0)throw new Error('\"volume\" property must be a non-negative finite number');volume=desc.volume}return{own:null!=own&&own,track:track,volume:null!=volume?volume:track.volume()}})))}catch(ex){throw new Error(`${what}: error during playlist initialization: ${ex.message}`)}_lists.has(id)&&_lists.get(id)._destroy(),_lists.set(id,list)}},delete:{value:function(id){return _lists.has(id)&&_lists.get(id)._destroy(),_lists.delete(id)}},clear:{value:function(){_lists.forEach((list=>list._destroy())),_lists.clear()}},has:{value:function(id){return _lists.has(id)}},get:{value:function(id){return _lists.get(id)||null}}}))},select:{value:function(){if(0===arguments.length)throw new Error(\"no track selector specified\");const selector=String(arguments[0]).trim(),trackIds=new Set;try{const allIds=Array.from(_tracks.keys());function renderIds(idObj){const id=idObj.id;let ids;switch(id){case\":all\":ids=allIds;break;case\":looped\":ids=allIds.filter((id=>_tracks.get(id).loop()));break;case\":muted\":ids=allIds.filter((id=>_tracks.get(id).mute()));break;case\":paused\":ids=allIds.filter((id=>_tracks.get(id).isPaused()));break;case\":playing\":ids=allIds.filter((id=>_tracks.get(id).isPlaying()));break;default:ids=\":\"===id[0]?_groups.get(id):[id]}if(idObj.hasOwnProperty(\"not\")){const negated=idObj.not.map((idObj=>renderIds(idObj))).flat(1/0);ids=ids.filter((id=>!negated.includes(id)))}return ids}_runnerParseSelector(selector).forEach((idObj=>renderIds(idObj).forEach((id=>{if(!_tracks.has(id))throw new Error(`track \"${id}\" does not exist`);trackIds.add(id)}))))}catch(ex){throw new Error(`error during runner initialization: ${ex.message}`)}return new AudioRunner(trackIds)}},load:{value:function(){publish(\"load\")}},loadWithScreen:{value:function(){publish(\"loadwithscreen\")}},mute:{value:masterMute},muteOnHidden:{value:function(mute){if(!Visibility.isEnabled())return!1;if(null==mute)return _masterMuteOnHidden;_masterMuteOnHidden=!!mute;const namespace=\".SimpleAudio_masterMuteOnHidden\";if(_masterMuteOnHidden){const visibilityChange=`${Visibility.changeEvent}${namespace}`;jQuery(document).off(namespace).on(visibilityChange,(()=>masterMute(Visibility.isHidden()))),Visibility.isHidden()&&masterMute(!0)}else jQuery(document).off(namespace)}},rate:{value:function(rate){if(null==rate)return _masterRate;if(\"number\"!=typeof rate||Number.isNaN(rate)||!Number.isFinite(rate))throw new Error(\"rate must be a finite number\");_masterRate=Math.clamp(rate,.2,5),publish(\"rate\",_masterRate)}},stop:{value:function(){publish(\"stop\")}},unload:{value:function(){publish(\"unload\")}},volume:{value:function(volume){if(null==volume)return _masterVolume;if(\"number\"!=typeof volume||Number.isNaN(volume)||!Number.isFinite(volume))throw new Error(\"volume must be a finite number\");_masterVolume=Math.clamp(volume,0,1),publish(\"volume\",_masterVolume)}}}))})(),State=(()=>{let _history=[],_active=momentCreate(),_activeIndex=-1,_expired=[],_prng=null,_tempVariables={};function reduceHistorySize(stateObj,targetSize){if(!targetSize)return;const currentIndex=stateObj.index,currentHistoryLength=stateObj.history.length;targetSize=Math.min(currentHistoryLength,targetSize);const invertedIndex=currentHistoryLength-1-currentIndex;let startingIndex=0;const radius=Math.floor(targetSize/2);return startingIndex=currentIndex<invertedIndex?radius>=currentIndex?0:currentIndex-radius:radius>=invertedIndex?currentHistoryLength-targetSize:currentIndex-radius,stateObj.index-=startingIndex,stateObj.history=stateObj.history.slice(startingIndex,startingIndex+targetSize),stateObj}function stateMarshal(noDelta=!0,depth=Config.history.maxSessionStates,useClone=!1){if(0===depth)return null;const stateObj={index:_activeIndex,history:useClone?clone(_history):_history};return _history.length>depth&&reduceHistorySize(stateObj,depth),noDelta||(stateObj.delta=historyDeltaEncode(stateObj.history),delete stateObj.history),_expired.length>0&&(stateObj.expired=[..._expired]),null!==_prng&&_prng.hasOwnProperty(\"seed\")&&(stateObj.seed=_prng.seed),stateObj}function stateUnmarshal(stateObj,noDeltaFlag=!0){let noDelta=noDeltaFlag;if(null==stateObj)throw new Error(\"state object is null or undefined\");if(!stateObj.hasOwnProperty(noDelta?\"history\":\"delta\")||0===stateObj[noDelta?\"history\":\"delta\"].length)if(stateObj.hasOwnProperty(\"delta\"))console.log(\"warning: stateObj is delta-encoded when it shouldn't be\"),noDelta=!1;else{if(!stateObj.hasOwnProperty(\"history\"))throw new Error(\"state object has no history or history is empty\");console.log(\"warning: stateObj is not delta-encoded when it should be\"),noDelta=!0}if(!stateObj.hasOwnProperty(\"index\"))throw new Error(\"state object has no index\");_history=noDelta?clone(stateObj.history):historyDeltaDecode(stateObj.delta),_activeIndex=stateObj.index,_expired=stateObj.hasOwnProperty(\"expired\")?[...stateObj.expired]:[],stateObj.hasOwnProperty(\"seed\")&&null!==_prng&&(_prng.seed=stateObj.seed),momentActivate(_activeIndex)}function momentCreate(title,variables){return{title:null==title?\"\":String(title),variables:null==variables?{}:clone(variables)}}function momentActivate(moment){if(null==moment)throw new Error(\"moment activation attempted with null or undefined\");switch(typeof moment){case\"object\":_active=clone(moment);break;case\"number\":if(historyIsEmpty())throw new Error(\"moment activation attempted with index on empty history\");if(moment<0||moment>=historySize())throw new RangeError(`moment activation attempted with out-of-bounds index; need [0, ${historySize()-1}], got ${moment}`);_active=clone(_history[moment]);break;default:throw new TypeError(`moment activation attempted with a \"${typeof moment}\"; must be an object or valid history stack index`)}return null!==_prng&&(_prng=new PRNG(_prng.seed,_active.pull)),jQuery.event.trigger(\":historyupdate\"),_active}function historyLength(){return _activeIndex+1}function historySize(){return _history.length}function historyIsEmpty(){return 0===_history.length}function historyTop(){return _history.length>0?_history[_history.length-1]:null}function historyGoTo(index){return!(null==index||index<0||index>=historySize()||index===_activeIndex)&&(_activeIndex=index,momentActivate(_activeIndex),!0)}function historyDeltaEncode(historyArr){if(!Array.isArray(historyArr))return null;if(0===historyArr.length)return[];const delta=[historyArr[0]];for(let i=1,iend=historyArr.length;i<iend;++i)delta.push(Diff.diff(historyArr[i-1],historyArr[i]));return delta}function historyDeltaDecode(delta){if(!Array.isArray(delta))return null;if(0===delta.length)return[];const historyArr=[clone(delta[0])];for(let i=1,iend=delta.length;i<iend;++i)historyArr.push(Diff.patch(historyArr[i-1],delta[i]));return historyArr}function prngInit(seed,useEntropy){if(!historyIsEmpty()){let scriptSection;throw scriptSection=\"the Story JavaScript\",new Error(`State.prng.init must be called during initialization, within either ${scriptSection} or the StoryInit special passage`)}_prng=new PRNG(seed),_active.pull=_prng.pull}window.addEventListener(\"beforeunload\",(function(){let pass=!1,depth=Math.min(Config.history.maxSessionStates,State.history.length);for(;depth>0&&!pass;)try{session.set(\"state\",stateMarshal(!1,depth)),pass=!0}catch{console.log(\"session.set error, reducing maxSessionStates\"),depth--}}));const _METADATA_STORE=\"metadata\";function metadataDelete(key){if(\"string\"!=typeof key)throw new TypeError(`State.metadata.delete key parameter must be a string (received: ${typeof key})`);const store=storage.get(_METADATA_STORE);store&&store.hasOwnProperty(key)&&(1===Object.keys(store).length?storage.delete(_METADATA_STORE):(delete store[key],storage.set(_METADATA_STORE,store)))}return Object.defineProperties(window,{V:{get:()=>_active.variables,configurable:!0},T:{get:()=>_tempVariables,configurable:!0}}),Object.freeze(Object.defineProperties({},{reset:{value:function(){session.delete(\"state\"),_history=[],_active=momentCreate(),_activeIndex=-1,_expired=[],_prng=null===_prng?null:new PRNG(_prng.seed)}},restore:{value:function(soft){if(session.has(\"state\")&&!soft){const stateObj=session.get(\"state\");return null!=stateObj&&(stateUnmarshal(stateObj),!0)}if(soft){const frame=_history[_activeIndex];return!!frame&&(momentActivate(frame),!0)}return!1}},marshalForSave:{value:function(depth=100,noDelta=!0){return stateMarshal(noDelta,depth,!0)}},unmarshalForSave:{value:function(stateObj){return stateUnmarshal(stateObj,!0)}},expired:{get:function(){return _expired}},turns:{get:function(){return _expired.length+historyLength()}},passages:{get:function(){return _expired.concat(_history.slice(0,historyLength()).map((moment=>moment.title)))}},hasPlayed:{value:function(title){return null!=title&&\"\"!==title&&(!!_expired.includes(title)||!!_history.slice(0,historyLength()).some((moment=>moment.title===title)))}},getSessionState:{value:function(){if(0===Config.history.maxSessionStates)return;const sessionState=session.get(\"state\");return sessionState.hasOwnProperty(\"delta\")&&(sessionState.history=State.deltaDecode(sessionState.delta),delete sessionState.delta),sessionState}},setSessionState:{value:function(sessionState){if(!sessionState||!sessionState.history)throw new Error(\"setSessionState error: not a valid sessionState object\");let pass=!1,sstates=Config.history.maxSessionStates;if(0===sstates)return pass;try{sessionState.history.length>sstates&&reduceHistorySize(sessionState,sstates),sstates&&session.set(\"state\",sessionState),pass=!0}catch(ex){for(console.log(\"session.set failed, recovering\"),sstates>sessionState.history.length&&(sstates=sessionState.length);sstates&&!pass;)try{sstates--,reduceHistorySize(sessionState,sstates),session.set(\"state\",sessionState),pass=!0}catch(ex){continue}}return pass}},active:{get:function(){return _active}},activeIndex:{get:function(){return _activeIndex}},passage:{get:function(){return _active.title}},variables:{get:function(){return _active.variables}},history:{get:function(){return _history}},length:{get:historyLength},size:{get:historySize},isEmpty:{value:historyIsEmpty},current:{get:function(){return _history.length>0?_history[_activeIndex]:null}},top:{get:historyTop},bottom:{get:function(){return _history.length>0?_history[0]:null}},index:{value:function(index){return historyIsEmpty()||index<0||index>_activeIndex?null:_history[index]}},peek:{value:function(offset){if(historyIsEmpty())return null;const lengthOffset=1+(offset?Math.abs(offset):0);return lengthOffset>historyLength()?null:_history[historyLength()-lengthOffset]}},has:{value:function(title){if(historyIsEmpty()||null==title||\"\"===title)return!1;for(let i=_activeIndex;i>=0;--i)if(_history[i].title===title)return!0;return!1}},create:{value:function(title){if(historyLength()<historySize()&&_history.splice(historyLength(),historySize()-historyLength()),_history.push(momentCreate(title,_active.variables)),_prng){historyTop().pull=_prng.pull}for(;historySize()>Config.history.maxStates;)for(0===Config.history.maxExpired?_history.shift():_expired.push(_history.shift().title);_expired.length>Config.history.maxExpired;)_expired.shift();return _activeIndex=historySize()-1,momentActivate(_activeIndex),historyLength()}},goTo:{value:historyGoTo},go:{value:function(offset){return null!=offset&&0!==offset&&historyGoTo(_activeIndex+offset)}},deltaEncode:{value:historyDeltaEncode},deltaDecode:{value:historyDeltaDecode},prng:{value:Object.freeze(Object.defineProperties({},{init:{value:prngInit},isEnabled:{value:function(){return null!==_prng}},pull:{get:function(){return _prng?_prng.pull:NaN}},seed:{get:function(){return _prng?_prng.seed:null}},str2int:{value:function(string){return _prng.str2int(string)}},test:{value:function(count,granularity,advancerng){return _prng.test(count,granularity,advancerng)}},peek:{value:function(count){return _prng.peek(count)}}}))},random:{value:function(){return _prng?_prng.random():Math.random()}},clearTemporary:{value:function(){_tempVariables={},TempVariables=_tempVariables}},temporary:{get:function(){return _tempVariables}},getVar:{value:function(varExpression){try{return Scripting.evalTwineScript(varExpression)}catch(ex){}}},setVar:{value:function(varExpression,value){try{return Scripting.evalTwineScript(`${varExpression} = evalTwineScript$Data$`,null,value),!0}catch(ex){}return!1}},metadata:{value:Object.freeze(Object.defineProperties({},{clear:{value:function(){storage.delete(_METADATA_STORE)}},delete:{value:metadataDelete},entries:{value:function(){const store=storage.get(_METADATA_STORE);return store&&Object.entries(store)}},get:{value:function(key){if(\"string\"!=typeof key)throw new TypeError(`State.metadata.get key parameter must be a string (received: ${typeof key})`);const store=storage.get(_METADATA_STORE);return store&&store.hasOwnProperty(key)?store[key]:undefined}},has:{value:function(key){if(\"string\"!=typeof key)throw new TypeError(`State.metadata.has key parameter must be a string (received: ${typeof key})`);const store=storage.get(_METADATA_STORE);return store&&store.hasOwnProperty(key)}},keys:{value:function(){const store=storage.get(_METADATA_STORE);return store&&Object.keys(store)}},set:{value:function(key,value){if(\"string\"!=typeof key)throw new TypeError(`State.metadata.set key parameter must be a string (received: ${typeof key})`);if(void 0===value)metadataDelete(key);else{const store=storage.get(_METADATA_STORE)||{};store[key]=value,storage.set(_METADATA_STORE,store)}}},size:{get:function(){const store=storage.get(_METADATA_STORE);return store?Object.keys(store).length:0}}}))},initPRNG:{value:prngInit},restart:{value:()=>Engine.restart()},backward:{value:()=>Engine.backward()},forward:{value:()=>Engine.forward()},display:{value:(...args)=>Engine.display(...args)},show:{value:(...args)=>Engine.show(...args)},play:{value:(...args)=>Engine.play(...args)}}))})(),Scripting=(()=>{function addAccessibleClickHandler(targets,selector,handler,one,namespace){if(arguments.length<2)throw new Error(\"addAccessibleClickHandler insufficient number of parameters\");let fn,opts;if(\"function\"==typeof selector?(fn=selector,opts={namespace:one,one:!!handler}):(fn=handler,opts={namespace:namespace,one:!!one,selector:selector}),\"function\"!=typeof fn)throw new TypeError(\"addAccessibleClickHandler handler parameter must be a function\");return jQuery(targets).ariaClick(opts,fn)}function insertElement(place,type,id,classNames,text,title){const $el=jQuery(document.createElement(type));return id&&$el.attr(\"id\",id),classNames&&$el.addClass(classNames),title&&$el.attr(\"title\",title),text&&$el.text(text),place&&$el.appendTo(place),$el[0]}function insertText(place,text){jQuery(place).append(document.createTextNode(text))}function removeChildren(node){jQuery(node).empty()}function removeElement(node){jQuery(node).remove()}function fade(el,options){const direction=\"in\"===options.fade?1:-1;let current,intervalId,proxy=el.cloneNode(!0);function setOpacity(el,opacity){el.style.zoom=1,el.style.filter=`alpha(opacity=${Math.floor(100*opacity)})`,el.style.opacity=opacity}el.parentNode.replaceChild(proxy,el),\"in\"===options.fade?(current=0,proxy.style.visibility=\"visible\"):current=1,setOpacity(proxy,current),intervalId=window.setInterval((function(){current+=.05*direction,setOpacity(proxy,Math.easeInOut(current)),(1===direction&&current>=1||-1===direction&&current<=0)&&(el.style.visibility=\"in\"===options.fade?\"visible\":\"hidden\",proxy.parentNode.replaceChild(el,proxy),proxy=null,window.clearInterval(intervalId),options.onComplete&&options.onComplete())}),25)}function scrollWindowTo(el,incrementBy){let increment=null!=incrementBy?Number(incrementBy):.1;Number.isNaN(increment)||!Number.isFinite(increment)||increment<0?increment=.1:increment>1&&(increment=1);const start=window.scrollY?window.scrollY:document.body.scrollTop,end=function(el){const posTop=function(el){let curtop=0;for(;el.offsetParent;)curtop+=el.offsetTop,el=el.offsetParent;return curtop}(el),posBottom=posTop+el.offsetHeight,winTop=window.scrollY?window.scrollY:document.body.scrollTop,winHeight=window.innerHeight?window.innerHeight:document.body.clientHeight,winBottom=winTop+winHeight;return posTop>=winTop&&posBottom>winBottom&&el.offsetHeight<winHeight?posTop-(winHeight-el.offsetHeight)+20:posTop}(el),distance=Math.abs(start-end),direction=start>end?-1:1;let intervalId,progress=0;intervalId=window.setInterval((function(){progress+=increment,window.scroll(0,start+direction*(distance*Math.easeInOut(progress))),progress>=1&&window.clearInterval(intervalId)}),25)}function toStringOrDefault(value){return stringFrom(value)}function either(){if(0!==arguments.length)return Array.prototype.concat.apply([],arguments).random()}function forget(key){if(\"string\"!=typeof key)throw new TypeError(`forget key parameter must be a string (received: ${Util.getType(key)})`);State.metadata.delete(key)}function hasVisited(){if(0===arguments.length)throw new Error(\"hasVisited called with insufficient parameters\");if(State.isEmpty())return!1;const needles=Array.prototype.concat.apply([],arguments),played=State.passages;for(let i=0,iend=needles.length;i<iend;++i)if(!played.includes(needles[i]))return!1;return!0}function lastVisited(){if(0===arguments.length)throw new Error(\"lastVisited called with insufficient parameters\");if(State.isEmpty())return-1;const needles=Array.prototype.concat.apply([],arguments),played=State.passages,uBound=played.length-1;let turns=State.turns;for(let i=0,iend=needles.length;i<iend&&turns>-1;++i){const lastIndex=played.lastIndexOf(needles[i]);turns=Math.min(turns,-1===lastIndex?-1:uBound-lastIndex)}return turns}function memorize(key,value){if(\"string\"!=typeof key)throw new TypeError(`memorize key parameter must be a string (received: ${Util.getType(key)})`);State.metadata.set(key,value)}function passage(){return State.passage}function previous(){const passages=State.passages;if(arguments.length>0){const offset=Number(arguments[0]);if(!Number.isSafeInteger(offset)||offset<1)throw new RangeError(\"previous offset parameter must be a positive integer greater than zero\");return passages.length>offset?passages[passages.length-1-offset]:\"\"}for(let i=passages.length-2;i>=0;--i)if(passages[i]!==State.passage)return passages[i];return\"\"}function random(){let min,max;switch(arguments.length){case 0:throw new Error(\"random called with insufficient parameters\");case 1:min=0,max=Math.trunc(arguments[0]);break;default:min=Math.trunc(arguments[0]),max=Math.trunc(arguments[1])}if(!Number.isInteger(min))throw new Error(\"random min parameter must be an integer\");if(!Number.isInteger(max))throw new Error(\"random max parameter must be an integer\");return min>max&&([min,max]=[max,min]),Math.floor(State.random()*(max-min+1))+min}function randomFloat(){let min,max;switch(arguments.length){case 0:throw new Error(\"randomFloat called with insufficient parameters\");case 1:min=0,max=Number(arguments[0]);break;default:min=Number(arguments[0]),max=Number(arguments[1])}if(Number.isNaN(min)||!Number.isFinite(min))throw new Error(\"randomFloat min parameter must be a number\");if(Number.isNaN(max)||!Number.isFinite(max))throw new Error(\"randomFloat max parameter must be a number\");return min>max&&([min,max]=[max,min]),State.random()*(max-min)+min}function recall(key,defaultValue){if(\"string\"!=typeof key)throw new TypeError(`recall key parameter must be a string (received: ${Util.getType(key)})`);return State.metadata.has(key)?State.metadata.get(key):defaultValue}function tags(){if(0===arguments.length)return Story.get(State.passage).tags.slice(0);const passages=Array.prototype.concat.apply([],arguments);let tags=[];for(let i=0,iend=passages.length;i<iend;++i)tags=tags.concat(Story.get(passages[i]).tags);return tags}function temporary(){return State.temporary}function time(){return null===Engine.lastPlay?0:Util.now()-Engine.lastPlay}function turns(){return State.turns}function variables(){return State.variables}function visited(){if(State.isEmpty())return 0;const needles=Array.prototype.concat.apply([],0===arguments.length?[State.passage]:arguments),played=State.passages;let count=State.turns;for(let i=0,iend=needles.length;i<iend&&count>0;++i)count=Math.min(count,played.count(needles[i]));return count}function visitedTags(){if(0===arguments.length)throw new Error(\"visitedTags called with insufficient parameters\");if(State.isEmpty())return 0;const needles=Array.prototype.concat.apply([],arguments),nLength=needles.length,played=State.passages,seen=new Map;let count=0;for(let i=0,iend=played.length;i<iend;++i){const title=played[i];if(seen.has(title))seen.get(title)&&++count;else{const tags=Story.get(title).tags;if(tags.length>0){let found=0;for(let j=0;j<nLength;++j)tags.includes(needles[j])&&++found;found===nLength?(++count,seen.set(title,!0)):seen.set(title,!1)}}}return count}var{importScripts:importScripts,importStyles:importStyles}=(()=>{function slugifyUrl(url){return Util.parseUrl(url).path.replace(/^[^\\w]+|[^\\w]+$/g,\"\").replace(/[^\\w]+/g,\"-\").toLocaleLowerCase()}function addScript(url){return new Promise(((resolve,reject)=>{jQuery(document.createElement(\"script\")).one(\"load abort error\",(ev=>{jQuery(ev.target).off(),\"load\"===ev.type?resolve(ev.target):reject(new Error(`importScripts failed to load the script \"${url}\".`))})).appendTo(document.head).attr({id:`script-imported-${slugifyUrl(url)}`,type:\"text/javascript\",src:url})}))}function addStyle(url){return new Promise(((resolve,reject)=>{jQuery(document.createElement(\"link\")).one(\"load abort error\",(ev=>{jQuery(ev.target).off(),\"load\"===ev.type?resolve(ev.target):reject(new Error(`importStyles failed to load the stylesheet \"${url}\".`))})).appendTo(document.head).attr({id:`style-imported-${slugifyUrl(url)}`,rel:\"stylesheet\",href:url})}))}function sequence(callbacks){return callbacks.reduce(((seq,fn)=>seq.then(fn)),Promise.resolve())}return{importScripts:function(...urls){return Promise.all(urls.map((oneOrSeries=>Array.isArray(oneOrSeries)?sequence(oneOrSeries.map((url=>()=>addScript(url)))):addScript(oneOrSeries))))},importStyles:function(...urls){return Promise.all(urls.map((oneOrSeries=>Array.isArray(oneOrSeries)?sequence(oneOrSeries.map((url=>()=>addStyle(url)))):addStyle(oneOrSeries))))}}})();const parse=(()=>{const tokenTable=Util.toEnum({$:\"State.variables.\",_:\"State.temporary.\",to:\"=\",eq:\"==\",neq:\"!=\",is:\"===\",isnot:\"!==\",gt:\">\",gte:\">=\",lt:\"<\",lte:\"<=\",and:\"&&\",or:\"||\",not:\"!\",def:'\"undefined\" !== typeof',ndef:'\"undefined\" === typeof'}),parseRe=new RegExp([\"(?:\\\"\\\"|''|``)\",'(?:\"(?:\\\\\\\\.|[^\"\\\\\\\\])+\")',\"(?:'(?:\\\\\\\\.|[^'\\\\\\\\])+')\",\"(`(?:\\\\\\\\.|[^`\\\\\\\\])+`)\",\"(?:[=+\\\\-*\\\\/%<>&\\\\|\\\\^~!?:,;\\\\(\\\\)\\\\[\\\\]{}]+)\",\"([^\\\"'=+\\\\-*\\\\/%<>&\\\\|\\\\^~!?:,;\\\\(\\\\)\\\\[\\\\]{}\\\\s]+)\"].join(\"|\"),\"g\"),notSpaceRe=/\\S/,varTest=new RegExp(`^${Patterns.variable}`),withColonTestRe=/^\\s*:/,withNotTestRe=/^\\s+not\\b/;function parse(rawCodeString){if(0!==parseRe.lastIndex)throw new RangeError(\"Scripting.parse last index is non-zero at start\");let match,code=rawCodeString;for(;null!==(match=parseRe.exec(code));)if(match[1]){const rawTemplate=match[1],parsedTemplate=parseTemplate(rawTemplate);parsedTemplate!==rawTemplate&&(code=code.splice(match.index,rawTemplate.length,parsedTemplate),parseRe.lastIndex+=parsedTemplate.length-rawTemplate.length)}else if(match[2]){let token=match[2];if(\"$\"===token||\"_\"===token)continue;if(varTest.test(token))token=token[0];else if(\"is\"===token){const start=parseRe.lastIndex,ahead=code.slice(start);withNotTestRe.test(ahead)&&(code=code.splice(start,ahead.search(notSpaceRe)),token=\"isnot\")}else{const ahead=code.slice(parseRe.lastIndex);if(withColonTestRe.test(ahead))continue}tokenTable[token]&&(code=code.splice(match.index,token.length,tokenTable[token]),parseRe.lastIndex+=tokenTable[token].length-token.length)}return code}const templateGroupStartRe=/\\$\\{/g,templateGroupParseRe=new RegExp([\"(?:\\\"\\\"|'')\",'(?:\"(?:\\\\\\\\.|[^\"\\\\\\\\])+\")',\"(?:'(?:\\\\\\\\.|[^'\\\\\\\\])+')\",\"(\\\\{)\",\"(\\\\})\"].join(\"|\"),\"g\");function parseTemplate(rawTemplateLiteral){if(0!==templateGroupStartRe.lastIndex)throw new RangeError(\"Scripting.parse last index is non-zero at start of template literal\");let startMatch,template=rawTemplateLiteral;for(;null!==(startMatch=templateGroupStartRe.exec(template));){const startIdx=startMatch.index+2;let endMatch,endIdx=startIdx,depth=1;for(templateGroupParseRe.lastIndex=startIdx;null!==(endMatch=templateGroupParseRe.exec(template));)if(endMatch[1]?++depth:endMatch[2]&&--depth,0===depth){endIdx=endMatch.index;break}if(endIdx>startIdx){const parseIndex=parseRe.lastIndex,rawGroup=template.slice(startIdx,endIdx);parseRe.lastIndex=0;const parsedGroup=parse(rawGroup);parseRe.lastIndex=parseIndex,template=template.splice(startIdx,rawGroup.length,parsedGroup),templateGroupStartRe.lastIndex+=parsedGroup.length-rawGroup.length}}return template}return parse})();function evalJavaScript(code,output,data){return function(code,output,evalJavaScript$Data$){return eval(code)}.call(output?{output:output}:null,String(code),output,data)}function evalTwineScript(code,output,data){return function(code,output,evalTwineScript$Data$){return eval(code)}.call(output?{output:output}:null,parse(String(code)),output,data)}return Object.freeze(Object.defineProperties({},{parse:{value:parse},evalJavaScript:{value:evalJavaScript},evalTwineScript:{value:evalTwineScript}}))})(),{EOF:EOF,Lexer:Lexer}={EOF:-1,Lexer:class{constructor(source,initialState){if(arguments.length<2)throw new Error(\"Lexer constructor called with too few parameters (source:string , initialState:function)\");Object.defineProperties(this,{source:{value:source},initial:{value:initialState},state:{writable:!0,value:initialState},start:{writable:!0,value:0},pos:{writable:!0,value:0},depth:{writable:!0,value:0},items:{writable:!0,value:[]},data:{writable:!0,value:{}}})}reset(){this.state=this.initial,this.start=0,this.pos=0,this.depth=0,this.items=[],this.data={}}run(){for(;null!==this.state;)this.state=this.state(this);return this.items}nextItem(){for(;0===this.items.length&&null!==this.state;)this.state=this.state(this);return this.items.shift()}next(){return this.pos>=this.source.length?-1:this.source[this.pos++]}peek(){return this.pos>=this.source.length?-1:this.source[this.pos]}backup(num){this.pos-=num||1}forward(num){this.pos+=num||1}ignore(){this.start=this.pos}accept(valid){const ch=this.next();return!(-1===ch||!valid.includes(ch)&&(this.backup(),1))}acceptRe(validRe){const ch=this.next();return!(-1===ch||!validRe.test(ch)&&(this.backup(),1))}acceptRun(valid){for(;;){const ch=this.next();if(-1===ch)return;if(!valid.includes(ch))break}this.backup()}acceptRunRe(validRe){for(;;){const ch=this.next();if(-1===ch)return;if(!validRe.test(ch))break}this.backup()}emit(type){this.items.push({type:type,text:this.source.slice(this.start,this.pos),start:this.start,pos:this.pos}),this.start=this.pos}error(type,message){if(arguments.length<2)throw new Error(\"Lexer.prototype.error called with too few parameters (type:number , message:string)\");return this.items.push({type:type,message:message,text:this.source.slice(this.start,this.pos),start:this.start,pos:this.pos}),null}static enumFromNames(names){const obj=names.reduce(((obj,name,i)=>(obj[name]=i,obj)),{});return Object.freeze(Object.assign(Object.create(null),obj))}}},Wikifier=(()=>{let _callDepth=0;class Wikifier{constructor(destination,source,options){Wikifier.Parser.Profile.isEmpty()&&Wikifier.Parser.Profile.compile(),Object.defineProperties(this,{source:{value:String(source)},options:{writable:!0,value:Object.assign({profile:\"all\"},options)},nextMatch:{writable:!0,value:0},output:{writable:!0,value:null},_rawArgs:{writable:!0,value:\"\"}}),null==destination?this.output=document.createDocumentFragment():destination.jquery?this.output=destination[0]:this.output=destination;try{++_callDepth,this.subWikify(this.output),1===_callDepth&&Config.cleanupWikifierOutput&&convertBreaks(this.output)}finally{--_callDepth}}subWikify(output,terminator,options){if(Wikifier.stopWikify)return;const oldOutput=this.output;let newOptions,oldOptions;this.output=output,Wikifier.Option.length>0&&(newOptions=Object.assign(newOptions||{},Wikifier.Option.options)),null!==options&&\"object\"==typeof options&&(newOptions=Object.assign(newOptions||{},options)),newOptions&&(oldOptions=this.options,this.options=Object.assign({},this.options,newOptions));const parsersProfile=Wikifier.Parser.Profile.get(this.options.profile),terminatorRegExp=terminator?new RegExp(`(?:${terminator})`,this.options.ignoreTerminatorCase?\"gim\":\"gm\"):null;let terminatorMatch,parserMatch;do{if(parsersProfile.parserRegExp.lastIndex=this.nextMatch,terminatorRegExp&&(terminatorRegExp.lastIndex=this.nextMatch),parserMatch=parsersProfile.parserRegExp.exec(this.source),terminatorMatch=terminatorRegExp?terminatorRegExp.exec(this.source):null,terminatorMatch&&(!parserMatch||terminatorMatch.index<=parserMatch.index))return terminatorMatch.index>this.nextMatch&&this.outputText(this.output,this.nextMatch,terminatorMatch.index),this.matchStart=terminatorMatch.index,this.matchLength=terminatorMatch[0].length,this.matchText=terminatorMatch[0],this.nextMatch=terminatorRegExp.lastIndex,this.output=oldOutput,void(oldOptions&&(this.options=oldOptions));if(parserMatch){let matchingParser;parserMatch.index>this.nextMatch&&this.outputText(this.output,this.nextMatch,parserMatch.index),this.matchStart=parserMatch.index,this.matchLength=parserMatch[0].length,this.matchText=parserMatch[0],this.nextMatch=parsersProfile.parserRegExp.lastIndex;for(let i=1,iend=parserMatch.length;i<iend;++i)if(parserMatch[i]){matchingParser=i-1;break}if(parsersProfile.parsers[matchingParser].handler(this),Wikifier.stopWikify)return;if(null!=TempState.break)break}}while(terminatorMatch||parserMatch);null==TempState.break?this.nextMatch<this.source.length&&(this.outputText(this.output,this.nextMatch,this.source.length),this.nextMatch=this.source.length):this.output.lastChild&&this.output.lastChild.nodeType===Node.ELEMENT_NODE&&\"BR\"===this.output.lastChild.nodeName.toUpperCase()&&jQuery(this.output.lastChild).remove(),this.output=oldOutput,oldOptions&&(this.options=oldOptions)}outputText(destination,startPos,endPos){destination.appendChild(document.createTextNode(this.source.substring(startPos,endPos)))}rawArgs(){return this._rawArgs}fullArgs(){return Scripting.parse(this._rawArgs)}static wikifyEval(text){const output=document.createDocumentFragment();new Wikifier(output,text);const errors=output.querySelector(\".error\");if(null!==errors)throw new Error(errors.textContent.replace(errorPrologRegExp,\"\"));return output}static createInternalLink(destination,passage,text,callback){const $link=jQuery(document.createElement(\"a\"));return null!=passage&&($link.attr(\"data-passage\",passage),Story.has(passage)?($link.addClass(\"link-internal\"),Config.addVisitedLinkClass&&State.hasPlayed(passage)&&$link.addClass(\"link-visited\")):$link.addClass(\"link-broken\"),$link.ariaClick({one:!0},(()=>{\"function\"==typeof callback&&callback(),Engine.play(passage)}))),text&&$link.append(document.createTextNode(text)),destination&&$link.appendTo(destination),$link[0]}static createExternalLink(destination,url,text){const $link=jQuery(document.createElement(\"a\")).attr(\"target\",\"_blank\").addClass(\"link-external\").text(text).appendTo(destination);return null!=url&&$link.attr({href:url,tabindex:0}),$link[0]}static isExternalLink(link){if(Story.has(link))return!1;return new RegExp(`^${Patterns.url}`,\"gim\").test(link)||/[/.?#]/.test(link)}}return Object.defineProperty(Wikifier,\"Option\",{value:(()=>{let _optionsStack=[];return Object.freeze(Object.defineProperties({},{length:{get:function(){return _optionsStack.length}},options:{get:function(){return Object.assign({},..._optionsStack)}},clear:{value:function(){_optionsStack=[]}},get:{value:function(idx){return _optionsStack[idx]}},pop:{value:function(){return _optionsStack.pop()}},push:{value:function(options){if(\"object\"!=typeof options||null===options)throw new TypeError(`Wikifier.Option.push options parameter must be an object (received: ${Util.getType(options)})`);return _optionsStack.push(options)}}}))})()}),Object.defineProperty(Wikifier,\"Parser\",{value:(()=>{const _parsers=[];let _profiles;function parsersHas(name){return!!_parsers.find((parser=>parser.name===name))}return Object.freeze(Object.defineProperties({},{parsers:{get:function(){return _parsers}},add:{value:function(parser){if(\"object\"!=typeof parser)throw new Error(\"Wikifier.Parser.add parser parameter must be an object\");if(!parser.hasOwnProperty(\"name\"))throw new Error('parser object missing required \"name\" property');if(\"string\"!=typeof parser.name)throw new Error('parser object \"name\" property must be a string');if(!parser.hasOwnProperty(\"match\"))throw new Error('parser object missing required \"match\" property');if(\"string\"!=typeof parser.match)throw new Error('parser object \"match\" property must be a string');if(!parser.hasOwnProperty(\"handler\"))throw new Error('parser object missing required \"handler\" property');if(\"function\"!=typeof parser.handler)throw new Error('parser object \"handler\" property must be a function');if(parser.hasOwnProperty(\"profiles\")&&!Array.isArray(parser.profiles))throw new Error('parser object \"profiles\" property must be an array');if(parsersHas(parser.name))throw new Error(`cannot clobber existing parser \"${parser.name}\"`);_parsers.push(parser)}},delete:{value:function(name){const parser=_parsers.find((parser=>parser.name===name));parser&&_parsers.delete(parser)}},isEmpty:{value:function(){return 0===_parsers.length}},has:{value:parsersHas},get:{value:function(name){return _parsers.find((parser=>parser.name===name))||null}},Profile:{value:Object.freeze(Object.defineProperties({},{profiles:{get:function(){return _profiles}},compile:{value:function(){const all=_parsers,core=all.filter((parser=>!Array.isArray(parser.profiles)||parser.profiles.includes(\"core\")));return _profiles=Object.freeze({all:{parsers:all,parserRegExp:new RegExp(all.map((parser=>`(${parser.match})`)).join(\"|\"),\"gm\")},core:{parsers:core,parserRegExp:new RegExp(core.map((parser=>`(${parser.match})`)).join(\"|\"),\"gm\")}}),_profiles}},isEmpty:{value:function(){return\"object\"!=typeof _profiles||0===Object.keys(_profiles).length}},has:{value:function(profile){return\"object\"==typeof _profiles&&_profiles.hasOwnProperty(profile)}},get:{value:function(profile){if(\"object\"!=typeof _profiles||!_profiles.hasOwnProperty(profile))throw new Error(`nonexistent parser profile \"${profile}\"`);return _profiles[profile]}}}))}}))})()}),Object.defineProperties(Wikifier,{helpers:{value:{}},stopWikify:{value:!1,writable:!0},getValue:{value:State.getVar},setValue:{value:State.setVar},parse:{value:Scripting.parse},evalExpression:{value:Scripting.evalTwineScript},evalStatements:{value:Scripting.evalTwineScript},textPrimitives:{value:Patterns}}),Object.defineProperties(Wikifier.helpers,{inlineCss:{value:(()=>{const lookaheadRe=new RegExp(Patterns.inlineCss,\"gm\"),idOrClassRe=new RegExp(`(${Patterns.cssIdOrClassSigil})(${Patterns.anyLetter}+)`,\"g\");return function(w){const css={classes:[],id:\"\",styles:{}};let matched;do{lookaheadRe.lastIndex=w.nextMatch;const match=lookaheadRe.exec(w.source);if(matched=match&&match.index===w.nextMatch,matched){if(match[1])css.styles[Util.fromCssProperty(match[1])]=match[2].trim();else if(match[3])css.styles[Util.fromCssProperty(match[3])]=match[4].trim();else if(match[5]){let subMatch;for(idOrClassRe.lastIndex=0;null!==(subMatch=idOrClassRe.exec(match[5]));)\".\"===subMatch[1]?css.classes.push(subMatch[2]):css.id=subMatch[2]}w.nextMatch=lookaheadRe.lastIndex}}while(matched);return css}})()},evalText:{value(text){let result;try{switch(result=Scripting.evalTwineScript(text),typeof result){case\"string\":\"\"===result.trim()&&(result=text);break;case\"number\":result=String(result);break;default:result=text}}catch(ex){result=text}return result}},evalPassageId:{value:passage=>null==passage||Story.has(passage)?passage:Wikifier.helpers.evalText(passage)},hasBlockContext:{value(nodes){const hasGCS=\"function\"==typeof window.getComputedStyle;for(let i=nodes.length-1;i>=0;--i){const node=nodes[i];switch(node.nodeType){case Node.ELEMENT_NODE:{const tagName=node.nodeName.toUpperCase();if(\"BR\"===tagName)return!0;const styles=hasGCS?window.getComputedStyle(node,null):node.currentStyle;if(styles&&styles.display){if(\"none\"===styles.display)continue;return\"block\"===styles.display}switch(tagName){case\"ADDRESS\":case\"ARTICLE\":case\"ASIDE\":case\"BLOCKQUOTE\":case\"CENTER\":case\"DIV\":case\"DL\":case\"FIGURE\":case\"FOOTER\":case\"FORM\":case\"H1\":case\"H2\":case\"H3\":case\"H4\":case\"H5\":case\"H6\":case\"HEADER\":case\"HR\":case\"MAIN\":case\"NAV\":case\"OL\":case\"P\":case\"PRE\":case\"SECTION\":case\"TABLE\":case\"UL\":return!0}}return!1;case Node.COMMENT_NODE:continue;default:return!1}}return!0}},createShadowSetterCallback:{value:(()=>{let macroParser=null;function getMacroContextShadowView(){const macro=macroParser||function(){if(!macroParser&&(macroParser=Wikifier.Parser.get(\"macro\"),!macroParser))throw new Error('cannot find \"macro\" parser');return macroParser}(),view=new Set;for(let context=macro.context;null!==context;context=context.parent)context._shadows&&context._shadows.forEach((name=>view.add(name)));return[...view]}return function(code){const shadowStore={};return getMacroContextShadowView().forEach((varName=>{const varKey=varName.slice(1),store=\"$\"===varName[0]?State.variables:State.temporary;shadowStore[varName]=store[varKey]})),function(){const shadowNames=Object.keys(shadowStore),valueCache=shadowNames.length>0?{}:null;try{return shadowNames.forEach((varName=>{const varKey=varName.slice(1),store=\"$\"===varName[0]?State.variables:State.temporary;store.hasOwnProperty(varKey)&&(valueCache[varKey]=store[varKey]),store[varKey]=shadowStore[varName]})),Scripting.evalJavaScript(code)}finally{shadowNames.forEach((varName=>{const varKey=varName.slice(1),store=\"$\"===varName[0]?State.variables:State.temporary;shadowStore[varName]=store[varKey],valueCache.hasOwnProperty(varKey)?store[varKey]=valueCache[varKey]:delete store[varKey]}))}}}})()},parseSquareBracketedMarkup:{value:(()=>{const Item=Lexer.enumFromNames([\"Error\",\"DelimLTR\",\"DelimRTL\",\"InnerMeta\",\"ImageMeta\",\"LinkMeta\",\"Link\",\"RightMeta\",\"Setter\",\"Source\",\"Text\"]),Delim=Lexer.enumFromNames([\"None\",\"LTR\",\"RTL\"]);function slurpQuote(lexer,endQuote){loop:for(;;)switch(lexer.next()){case\"\\\\\":{const ch=lexer.next();if(ch!==EOF&&\"\\n\"!==ch)break}case EOF:case\"\\n\":return EOF;case endQuote:break loop}return lexer.pos}function lexLeftMeta(lexer){if(!lexer.accept(\"[\"))return lexer.error(Item.Error,\"malformed square-bracketed markup\");if(lexer.accept(\"[\"))lexer.data.isLink=!0,lexer.emit(Item.LinkMeta);else{if(lexer.accept(\"<>\"),!(lexer.accept(\"Ii\")&&lexer.accept(\"Mm\")&&lexer.accept(\"Gg\")&&lexer.accept(\"[\")))return lexer.error(Item.Error,\"malformed square-bracketed markup\");lexer.data.isLink=!1,lexer.emit(Item.ImageMeta)}return lexer.depth=2,lexCoreComponents}function lexCoreComponents(lexer){const what=lexer.data.isLink?\"link\":\"image\";let delim=Delim.None;for(;;)switch(lexer.next()){case EOF:case\"\\n\":return lexer.error(Item.Error,`unterminated ${what} markup`);case'\"':if(slurpQuote(lexer,'\"')===EOF)return lexer.error(Item.Error,`unterminated double quoted string in ${what} markup`);break;case\"|\":delim===Delim.None&&(delim=Delim.LTR,lexer.backup(),lexer.emit(Item.Text),lexer.forward(),lexer.emit(Item.DelimLTR));break;case\"-\":delim===Delim.None&&\">\"===lexer.peek()&&(delim=Delim.LTR,lexer.backup(),lexer.emit(Item.Text),lexer.forward(2),lexer.emit(Item.DelimLTR));break;case\"<\":delim===Delim.None&&\"-\"===lexer.peek()&&(delim=Delim.RTL,lexer.backup(),lexer.emit(lexer.data.isLink?Item.Link:Item.Source),lexer.forward(2),lexer.emit(Item.DelimRTL));break;case\"[\":++lexer.depth;break;case\"]\":if(--lexer.depth,1===lexer.depth)switch(lexer.peek()){case\"[\":return++lexer.depth,lexer.backup(),delim===Delim.RTL?lexer.emit(Item.Text):lexer.emit(lexer.data.isLink?Item.Link:Item.Source),lexer.forward(2),lexer.emit(Item.InnerMeta),lexer.data.isLink?lexSetter:lexImageLink;case\"]\":return--lexer.depth,lexer.backup(),delim===Delim.RTL?lexer.emit(Item.Text):lexer.emit(lexer.data.isLink?Item.Link:Item.Source),lexer.forward(2),lexer.emit(Item.RightMeta),null;default:return lexer.error(Item.Error,`malformed ${what} markup`)}}}function lexImageLink(lexer){const what=lexer.data.isLink?\"link\":\"image\";for(;;)switch(lexer.next()){case EOF:case\"\\n\":return lexer.error(Item.Error,`unterminated ${what} markup`);case'\"':if(slurpQuote(lexer,'\"')===EOF)return lexer.error(Item.Error,`unterminated double quoted string in ${what} markup link component`);break;case\"[\":++lexer.depth;break;case\"]\":if(--lexer.depth,1===lexer.depth)switch(lexer.peek()){case\"[\":return++lexer.depth,lexer.backup(),lexer.emit(Item.Link),lexer.forward(2),lexer.emit(Item.InnerMeta),lexSetter;case\"]\":return--lexer.depth,lexer.backup(),lexer.emit(Item.Link),lexer.forward(2),lexer.emit(Item.RightMeta),null;default:return lexer.error(Item.Error,`malformed ${what} markup`)}}}function lexSetter(lexer){const what=lexer.data.isLink?\"link\":\"image\";for(;;)switch(lexer.next()){case EOF:case\"\\n\":return lexer.error(Item.Error,`unterminated ${what} markup`);case'\"':if(slurpQuote(lexer,'\"')===EOF)return lexer.error(Item.Error,`unterminated double quoted string in ${what} markup setter component`);break;case\"'\":if(slurpQuote(lexer,\"'\")===EOF)return lexer.error(Item.Error,`unterminated single quoted string in ${what} markup setter component`);break;case\"[\":++lexer.depth;break;case\"]\":if(--lexer.depth,1===lexer.depth)return\"]\"!==lexer.peek()?lexer.error(Item.Error,`malformed ${what} markup`):(--lexer.depth,lexer.backup(),lexer.emit(Item.Setter),lexer.forward(2),lexer.emit(Item.RightMeta),null)}}return function(w){const lexer=new Lexer(w.source,lexLeftMeta);lexer.start=lexer.pos=w.matchStart;const markup={},items=lexer.run(),last=items.last();return last&&last.type===Item.Error?markup.error=last.message:items.forEach((item=>{const text=item.text.trim();switch(item.type){case Item.ImageMeta:markup.isImage=!0,\"<\"===text[1]?markup.align=\"left\":\">\"===text[1]&&(markup.align=\"right\");break;case Item.LinkMeta:markup.isLink=!0;break;case Item.Link:\"~\"===text[0]?(markup.forceInternal=!0,markup.link=text.slice(1)):markup.link=text;break;case Item.Setter:markup.setter=text;break;case Item.Source:markup.source=text;break;case Item.Text:markup.text=text}})),markup.pos=lexer.pos,markup}})()}}),Wikifier})();(()=>{function _verbatimTagHandler(w){this.lookahead.lastIndex=w.matchStart;const match=this.lookahead.exec(w.source);match&&match.index===w.matchStart&&(w.nextMatch=this.lookahead.lastIndex,jQuery(document.createDocumentFragment()).append(match[1]).appendTo(w.output))}Wikifier.Parser.add({name:\"quoteByBlock\",profiles:[\"block\"],match:\"^<<<\\\\n\",terminator:\"^<<<\\\\n\",handler(w){Wikifier.helpers.hasBlockContext(w.output.childNodes)?w.subWikify(jQuery(document.createElement(\"blockquote\")).appendTo(w.output).get(0),this.terminator):jQuery(w.output).append(document.createTextNode(w.matchText))}}),Wikifier.Parser.add({name:\"quoteByLine\",profiles:[\"block\"],match:\"^>+\",lookahead:/^>+/gm,terminator:\"\\\\n\",handler(w){if(!Wikifier.helpers.hasBlockContext(w.output.childNodes))return void jQuery(w.output).append(document.createTextNode(w.matchText));const destStack=[w.output];let matched,i,curLevel=0,newLevel=w.matchLength;do{if(newLevel>curLevel)for(i=curLevel;i<newLevel;++i)destStack.push(jQuery(document.createElement(\"blockquote\")).appendTo(destStack[destStack.length-1]).get(0));else if(newLevel<curLevel)for(i=curLevel;i>newLevel;--i)destStack.pop();curLevel=newLevel,w.subWikify(destStack[destStack.length-1],this.terminator),jQuery(document.createElement(\"br\")).appendTo(destStack[destStack.length-1]),this.lookahead.lastIndex=w.nextMatch;const match=this.lookahead.exec(w.source);matched=match&&match.index===w.nextMatch,matched&&(newLevel=match[0].length,w.nextMatch+=match[0].length)}while(matched)}}),Wikifier.Parser.add({name:\"macro\",profiles:[\"core\"],match:\"<<\",lookahead:new RegExp(`<<(/?${Patterns.macroName})(?:\\\\s*)((?:(?:/\\\\*[^*]*\\\\*+(?:[^/*][^*]*\\\\*+)*/)|(?://.*\\\\n)|(?:\\`(?:\\\\\\\\.|[^\\`\\\\\\\\])*\\`)|(?:\"(?:\\\\\\\\.|[^\"\\\\\\\\])*\")|(?:'(?:\\\\\\\\.|[^'\\\\\\\\])*')|(?:\\\\[(?:[<>]?[Ii][Mm][Gg])?\\\\[[^\\\\r\\\\n]*?\\\\]\\\\]+)|[^>]|(?:>(?!>)))*)>>`,\"gm\"),working:{source:\"\",name:\"\",arguments:\"\",index:0},context:null,handler(w){const matchStart=this.lookahead.lastIndex=w.matchStart;if(this.parseTag(w)){const nextMatch=w.nextMatch,name=this.working.name,rawArgs=this.working.arguments;let macro;try{if(macro=Macro.get(name),!macro){if(Macro.tags.has(name)){const tags=Macro.tags.get(name);return throwError(w.output,`child tag <<${name}>> was found outside of a call to its parent macro${1===tags.length?\"\":\"s\"} <<${tags.join(\">>, <<\")}>>`,w.source.slice(matchStart,w.nextMatch))}return throwError(w.output,`macro <<${name}>> does not exist`,w.source.slice(matchStart,w.nextMatch))}{let payload=null;if(void 0!==macro.tags&&(payload=this.parseBody(w,macro),!payload))return w.nextMatch=nextMatch,throwError(w.output,`cannot find a closing tag for macro <<${name}>>`,`${w.source.slice(matchStart,w.nextMatch)}…`);if(\"function\"!=typeof macro.handler)return throwError(w.output,`macro <<${name}>> handler function ${void 0===macro.handler?\"does not exist\":\"is not a function\"}`,w.source.slice(matchStart,w.nextMatch));{const args=payload?payload[0].args:this.createArgs(rawArgs,this.skipArgs(macro,macro.name));if(void 0!==macro._MACRO_API){this.context=new MacroContext({macro:macro,name:name,args:args,payload:payload,source:w.source.slice(matchStart,w.nextMatch),parent:this.context,parser:w});try{macro.handler.call(this.context)}finally{macro.isWidget&&1===Wikifier.stopWikify&&(Wikifier.stopWikify=0),this.context=this.context.parent}}else{const prevRawArgs=w._rawArgs;w._rawArgs=rawArgs;try{macro.handler(w.output,name,args,w,payload)}finally{w._rawArgs=prevRawArgs}}}}}catch(ex){return throwError(w.output,`cannot execute ${macro&&macro.isWidget?\"widget\":\"macro\"} <<${name}>>: ${ex.message}`,w.source.slice(matchStart,w.nextMatch))}finally{this.working.source=\"\",this.working.name=\"\",this.working.arguments=\"\",this.working.index=0}}else w.outputText(w.output,w.matchStart,w.nextMatch)},parseTag(w){const match=this.lookahead.exec(w.source);return!(!match||match.index!==w.matchStart||!match[1])&&(w.nextMatch=this.lookahead.lastIndex,this.working.source=w.source.slice(match.index,this.lookahead.lastIndex),this.working.name=match[1],this.working.arguments=match[2],this.working.index=match.index,!0)},parseBody(w,macro){const openTag=this.working.name,closeTag=`/${openTag}`,closeAlt=`end${openTag}`,bodyTags=!!Array.isArray(macro.tags)&&macro.tags,payload=[];let end=-1,opened=1,curSource=this.working.source,curTag=this.working.name,curArgument=this.working.arguments,contentStart=w.nextMatch;for(;-1!==(w.matchStart=w.source.indexOf(this.match,w.nextMatch));){if(!this.parseTag(w)){this.lookahead.lastIndex=w.nextMatch=w.matchStart+this.match.length;continue}const tagSource=this.working.source,tagName=this.working.name,tagArgs=this.working.arguments,tagBegin=this.working.index,tagEnd=w.nextMatch,hasArgs=\"\"!==tagArgs.trim();switch(tagName){case openTag:++opened;break;case closeAlt:case closeTag:if(hasArgs)throw w.nextMatch=tagBegin+2+tagName.length,new Error(`malformed closing tag: \"${tagSource}\"`);--opened;break;default:if(hasArgs&&tagName.startsWith(\"/\")){this.lookahead.lastIndex=w.nextMatch=tagBegin+2+tagName.length;continue}if(1===opened&&bodyTags)for(let i=0,iend=bodyTags.length;i<iend;++i)tagName===bodyTags[i]&&(payload.push({source:curSource,name:curTag,arguments:curArgument,args:this.createArgs(curArgument,this.skipArgs(macro,curTag)),contents:w.source.slice(contentStart,tagBegin)}),curSource=tagSource,curTag=tagName,curArgument=tagArgs,contentStart=tagEnd)}if(0===opened){payload.push({source:curSource,name:curTag,arguments:curArgument,args:this.createArgs(curArgument,this.skipArgs(macro,curTag)),contents:w.source.slice(contentStart,tagBegin)}),end=tagEnd;break}}return-1!==end?(w.nextMatch=end,payload):null},createArgs(rawArgsString,skipArgs){const args=skipArgs?[]:this.parseArgs(rawArgsString);return Object.defineProperties(args,{raw:{value:rawArgsString},full:{value:Scripting.parse(rawArgsString)}}),args},skipArgs(macro,tagName){if(void 0!==macro.skipArgs){const sa=macro.skipArgs;return\"boolean\"==typeof sa&&sa||Array.isArray(sa)&&sa.includes(tagName)}return void 0!==macro.skipArg0&&(macro.skipArg0&&macro.name===tagName)},parseArgs:(()=>{const Item=Lexer.enumFromNames([\"Error\",\"Bareword\",\"Expression\",\"String\",\"SquareBracket\",\"ObjectLiteral\",\"FunctionCall\"]),spaceRe=new RegExp(Patterns.space),notSpaceRe=new RegExp(Patterns.notSpace),varTest=new RegExp(`^${Patterns.variable}`);function slurpQuote(lexer,endQuote){loop:for(;;)switch(lexer.next()){case\"\\\\\":{const ch=lexer.next();if(ch!==EOF&&\"\\n\"!==ch)break}case EOF:case\"\\n\":return EOF;case endQuote:break loop}return lexer.pos}function genericSlurp(lexer,openChar,closeChar,initCount){let count=initCount;loop:for(;;){switch(lexer.next()){case openChar:count++;break;case closeChar:if(count--,0===count)break loop;break;case EOF:case\"\\n\":return!1}}return lexer.pos}function lexSpace(lexer){const offset=lexer.source.slice(lexer.pos).search(notSpaceRe);let remainingStr=lexer.source.slice(lexer.pos);if(offset===EOF)return null;if(0!==offset&&(lexer.pos+=offset,lexer.ignore(),remainingStr=lexer.source.slice(lexer.pos)),/^[a-zA-Z_$][0-9a-zA-Z_$]*\\s*\\(/.test(remainingStr))return lexer.next(),lexFunctionCall;switch(lexer.next()){case\"`\":return lexExpression;case'\"':return lexDoubleQuote;case\"'\":return lexSingleQuote;case\"[\":return lexSquareBracket;case\"{\":return lexObjectLiteral;default:return lexBareword}}function lexExpression(lexer){return slurpQuote(lexer,\"`\")===EOF?lexer.error(Item.Error,\"unterminated backquote expression\"):(lexer.emit(Item.Expression),lexSpace)}function lexDoubleQuote(lexer){return slurpQuote(lexer,'\"')===EOF?lexer.error(Item.Error,\"unterminated double quoted string\"):(lexer.emit(Item.String),lexSpace)}function lexSingleQuote(lexer){return slurpQuote(lexer,\"'\")===EOF?lexer.error(Item.Error,\"unterminated single quoted string\"):(lexer.emit(Item.String),lexSpace)}function lexSquareBracket(lexer){let what;return lexer.accept(\"<>IiMmGg\")?(what=\"image\",lexer.acceptRun(\"<>IiMmGg\")):what=\"link\",lexer.accept(\"[\")?genericSlurp(lexer,\"[\",\"]\",2)===EOF?lexer.error(Item.Error,`unterminated ${what} markup`):(lexer.emit(Item.SquareBracket),lexSpace):lexer.error(Item.Error,`malformed ${what} markup`)}function lexObjectLiteral(lexer){return genericSlurp(lexer,\"{\",\"}\",1)===EOF?lexer.error(Item.Error,\"unterminated object literal\"):(lexer.emit(Item.ObjectLiteral),lexSpace)}function lexFunctionCall(lexer){return genericSlurp(lexer,\"(\",\")\",0)===EOF?lexer.error(Item.Error,\"unterminated function call\"):(lexer.emit(Item.FunctionCall),lexSpace)}function lexBareword(lexer){const offset=lexer.source.slice(lexer.pos).search(spaceRe);return lexer.pos=offset===EOF?lexer.source.length:lexer.pos+offset,lexer.emit(Item.Bareword),offset===EOF?null:lexSpace}return function(rawArgsString){const lexer=new Lexer(rawArgsString,lexSpace),args=[];return lexer.run().forEach((item=>{let arg=item.text;switch(item.type){case Item.Error:throw new Error(`unable to parse macro argument \"${arg}\": ${item.message}`);case Item.Bareword:if(varTest.test(arg))arg=State.getVar(arg);else if(/^(?:settings|setup)[.[]/.test(arg))try{arg=Scripting.evalTwineScript(arg)}catch(ex){throw new Error(`unable to parse macro argument \"${arg}\": ${ex.message}`)}else if(\"null\"===arg)arg=null;else if(\"undefined\"===arg)arg=undefined;else if(\"true\"===arg)arg=!0;else if(\"false\"===arg)arg=!1;else if(\"NaN\"===arg)arg=NaN;else{const argAsNum=Number(arg);Number.isNaN(argAsNum)||(arg=argAsNum)}break;case Item.Expression:if(arg=arg.slice(1,-1).trim(),\"\"===arg)arg=undefined;else try{arg=Scripting.evalTwineScript(`(${arg})`)}catch(ex){throw new Error(`unable to parse macro argument expression \"${arg}\": ${ex.message}`)}break;case Item.String:try{arg=Scripting.evalJavaScript(arg)}catch(ex){throw new Error(`unable to parse macro argument string \"${arg}\": ${ex.message}`)}break;case Item.SquareBracket:{const markup=Wikifier.helpers.parseSquareBracketedMarkup({source:arg,matchStart:0});if(markup.hasOwnProperty(\"error\"))throw new Error(`unable to parse macro argument \"${arg}\": ${markup.error}`);if(markup.pos<arg.length)throw new Error(`unable to parse macro argument \"${arg}\": unexpected character(s) \"${arg.slice(markup.pos)}\" (pos: ${markup.pos})`);markup.isLink?(arg={isLink:!0},arg.count=markup.hasOwnProperty(\"text\")?2:1,arg.link=Wikifier.helpers.evalPassageId(markup.link),arg.text=markup.hasOwnProperty(\"text\")?Wikifier.helpers.evalText(markup.text):arg.link,arg.external=!markup.forceInternal&&Wikifier.isExternalLink(arg.link),arg.setFn=markup.hasOwnProperty(\"setter\")?Wikifier.helpers.createShadowSetterCallback(Scripting.parse(markup.setter)):null):markup.isImage&&(arg=(source=>{const imgObj={source:source,isImage:!0};if(\"data:\"!==source.slice(0,5)&&Story.has(source)){const passage=Story.get(source);passage.tags.includes(\"Twine.image\")&&(imgObj.source=passage.text,imgObj.passage=passage.title)}return imgObj})(Wikifier.helpers.evalPassageId(markup.source)),markup.hasOwnProperty(\"align\")&&(arg.align=markup.align),markup.hasOwnProperty(\"text\")&&(arg.title=Wikifier.helpers.evalText(markup.text)),markup.hasOwnProperty(\"link\")&&(arg.link=Wikifier.helpers.evalPassageId(markup.link),arg.external=!markup.forceInternal&&Wikifier.isExternalLink(arg.link)),arg.setFn=markup.hasOwnProperty(\"setter\")?Wikifier.helpers.createShadowSetterCallback(Scripting.parse(markup.setter)):null)}break;case Item.ObjectLiteral:try{arg=Scripting.evalTwineScript(`(${arg})`)}catch(ex){throw new Error(`unable to parse macro argument object literal \"${arg}\": ${ex.message}`)}break;case Item.FunctionCall:try{arg=Scripting.evalTwineScript(arg)}catch(ex){throw new Error(`unable to parse macro argument \"${arg}\": ${ex.message}`)}}args.push(arg)})),args}})()}),Wikifier.Parser.add({name:\"link\",profiles:[\"core\"],match:\"\\\\[\\\\[[^[]\",handler(w){const markup=Wikifier.helpers.parseSquareBracketedMarkup(w);if(markup.hasOwnProperty(\"error\"))return void w.outputText(w.output,w.matchStart,w.nextMatch);w.nextMatch=markup.pos;const link=Wikifier.helpers.evalPassageId(markup.link),text=markup.hasOwnProperty(\"text\")?Wikifier.helpers.evalText(markup.text):link,setFn=markup.hasOwnProperty(\"setter\")?Wikifier.helpers.createShadowSetterCallback(Scripting.parse(markup.setter)):null,output=(Config.debug?new DebugView(w.output,\"link-markup\",\"[[link]]\",w.source.slice(w.matchStart,w.nextMatch)):w).output;markup.forceInternal||!Wikifier.isExternalLink(link)?Wikifier.createInternalLink(output,link,text,setFn):Wikifier.createExternalLink(output,link,text)}}),Wikifier.Parser.add({name:\"urlLink\",profiles:[\"core\"],match:Patterns.url,handler(w){w.outputText(Wikifier.createExternalLink(w.output,w.matchText),w.matchStart,w.nextMatch)}}),Wikifier.Parser.add({name:\"image\",profiles:[\"core\"],match:\"\\\\[[<>]?[Ii][Mm][Gg]\\\\[\",handler(w){const markup=Wikifier.helpers.parseSquareBracketedMarkup(w);if(markup.hasOwnProperty(\"error\"))return void w.outputText(w.output,w.matchStart,w.nextMatch);let debugView;w.nextMatch=markup.pos,Config.debug&&(debugView=new DebugView(w.output,\"image-markup\",markup.hasOwnProperty(\"link\")?\"[img[][link]]\":\"[img[]]\",w.source.slice(w.matchStart,w.nextMatch)),debugView.modes({block:!0}));const setFn=markup.hasOwnProperty(\"setter\")?Wikifier.helpers.createShadowSetterCallback(Scripting.parse(markup.setter)):null;let source,el=(Config.debug?debugView:w).output;if(markup.hasOwnProperty(\"link\")){const link=Wikifier.helpers.evalPassageId(markup.link);el=markup.forceInternal||!Wikifier.isExternalLink(link)?Wikifier.createInternalLink(el,link,null,setFn):Wikifier.createExternalLink(el,link),el.classList.add(\"link-image\")}if(el=jQuery(document.createElement(\"img\")).appendTo(el).get(0),source=Wikifier.helpers.evalPassageId(markup.source),\"data:\"!==source.slice(0,5)&&Story.has(source)){const passage=Story.get(source);passage.tags.includes(\"Twine.image\")&&(el.setAttribute(\"data-passage\",passage.title),source=passage.text.trim())}el.src=source,markup.hasOwnProperty(\"text\")&&(el.title=Wikifier.helpers.evalText(markup.text)),markup.hasOwnProperty(\"align\")&&(el.align=markup.align)}}),Wikifier.Parser.add({name:\"monospacedByBlock\",profiles:[\"block\"],match:\"^\\\\{\\\\{\\\\{\\\\n\",lookahead:/^\\{\\{\\{\\n((?:^[^\\n]*\\n)+?)(^\\}\\}\\}$\\n?)/gm,handler(w){this.lookahead.lastIndex=w.matchStart;const match=this.lookahead.exec(w.source);if(match&&match.index===w.matchStart){const pre=jQuery(document.createElement(\"pre\"));jQuery(document.createElement(\"code\")).text(match[1]).appendTo(pre),pre.appendTo(w.output),w.nextMatch=this.lookahead.lastIndex}}}),Wikifier.Parser.add({name:\"formatByChar\",profiles:[\"core\"],match:\"''|//|__|\\\\^\\\\^|~~|==|\\\\{\\\\{\\\\{\",handler(w){switch(w.matchText){case\"''\":w.subWikify(jQuery(document.createElement(\"strong\")).appendTo(w.output).get(0),\"''\");break;case\"//\":w.subWikify(jQuery(document.createElement(\"em\")).appendTo(w.output).get(0),\"//\");break;case\"__\":w.subWikify(jQuery(document.createElement(\"u\")).appendTo(w.output).get(0),\"__\");break;case\"^^\":w.subWikify(jQuery(document.createElement(\"sup\")).appendTo(w.output).get(0),\"\\\\^\\\\^\");break;case\"~~\":w.subWikify(jQuery(document.createElement(\"sub\")).appendTo(w.output).get(0),\"~~\");break;case\"==\":w.subWikify(jQuery(document.createElement(\"s\")).appendTo(w.output).get(0),\"==\");break;case\"{{{\":{const lookahead=/\\{\\{\\{((?:.|\\n)*?)\\}\\}\\}/gm;lookahead.lastIndex=w.matchStart;const match=lookahead.exec(w.source);match&&match.index===w.matchStart&&(jQuery(document.createElement(\"code\")).text(match[1]).appendTo(w.output),w.nextMatch=lookahead.lastIndex)}}}}),Wikifier.Parser.add({name:\"customStyle\",profiles:[\"core\"],match:\"@@\",terminator:\"@@\",blockRe:/\\s*\\n/gm,handler(w){const css=Wikifier.helpers.inlineCss(w);this.blockRe.lastIndex=w.nextMatch;const blockMatch=this.blockRe.exec(w.source),blockLevel=blockMatch&&blockMatch.index===w.nextMatch,$el=jQuery(document.createElement(blockLevel?\"div\":\"span\")).appendTo(w.output);0===css.classes.length&&\"\"===css.id&&0===Object.keys(css.styles).length?$el.addClass(\"marked\"):(css.classes.forEach((className=>$el.addClass(className))),\"\"!==css.id&&$el.attr(\"id\",css.id),$el.css(css.styles)),blockLevel?(w.nextMatch+=blockMatch[0].length,w.subWikify($el[0],`\\\\n?${this.terminator}`)):w.subWikify($el[0],this.terminator)}}),Wikifier.Parser.add({name:\"verbatimText\",profiles:[\"core\"],match:'\"{3}|<[Nn][Oo][Ww][Ii][Kk][Ii]>',lookahead:/(?:\"{3}((?:.|\\n)*?)\"{3})|(?:<[Nn][Oo][Ww][Ii][Kk][Ii]>((?:.|\\n)*?)<\\/[Nn][Oo][Ww][Ii][Kk][Ii]>)/gm,handler(w){this.lookahead.lastIndex=w.matchStart;const match=this.lookahead.exec(w.source);match&&match.index===w.matchStart&&(w.nextMatch=this.lookahead.lastIndex,jQuery(document.createElement(\"span\")).addClass(\"verbatim\").text(match[1]||match[2]).appendTo(w.output))}}),Wikifier.Parser.add({name:\"horizontalRule\",profiles:[\"core\"],match:\"^----+$\\\\n?|<[Hh][Rr]\\\\s*/?>\\\\n?\",handler(w){jQuery(document.createElement(\"hr\")).appendTo(w.output)}}),Wikifier.Parser.add({name:\"emdash\",profiles:[\"core\"],match:\"--\",handler(w){jQuery(document.createTextNode(\"—\")).appendTo(w.output)}}),Wikifier.Parser.add({name:\"doubleDollarSign\",profiles:[\"core\"],match:\"\\\\${2}\",handler(w){jQuery(document.createTextNode(\"$\")).appendTo(w.output)}}),Wikifier.Parser.add({name:\"nakedVariable\",profiles:[\"core\"],match:`${Patterns.variable}(?:(?:\\\\.${Patterns.identifier})|(?:\\\\[\\\\d+\\\\])|(?:\\\\[\"(?:\\\\\\\\.|[^\"\\\\\\\\])+\"\\\\])|(?:\\\\['(?:\\\\\\\\.|[^'\\\\\\\\])+'\\\\])|(?:\\\\[${Patterns.variable}\\\\]))*`,handler(w){const result=State.getVar(w.matchText);null==result?jQuery(document.createTextNode(w.matchText)).appendTo(w.output):new Wikifier((Config.debug?new DebugView(w.output,\"variable\",w.matchText,w.matchText):w).output,stringFrom(result))}}),Wikifier.Parser.add({name:\"template\",profiles:[\"core\"],match:`\\\\?${Patterns.templateName}`,handler(w){const name=w.matchText.slice(1);let template=Template.get(name),result=null;switch(template instanceof Array&&(template=template.random()),typeof template){case\"function\":try{result=stringFrom(template.call({name:name}))}catch(ex){return throwError(w.output,`cannot execute function template ?${name}: ${ex.message}`,w.source.slice(w.matchStart,w.nextMatch))}break;case\"string\":result=template}null===result?jQuery(document.createTextNode(w.matchText)).appendTo(w.output):new Wikifier((Config.debug?new DebugView(w.output,\"template\",w.matchText,w.matchText):w).output,result)}}),Wikifier.Parser.add({name:\"heading\",profiles:[\"block\"],match:\"^!{1,6}\",terminator:\"\\\\n\",handler(w){Wikifier.helpers.hasBlockContext(w.output.childNodes)?w.subWikify(jQuery(document.createElement(`h${w.matchLength}`)).appendTo(w.output).get(0),this.terminator):jQuery(w.output).append(document.createTextNode(w.matchText))}}),Wikifier.Parser.add({name:\"table\",profiles:[\"block\"],match:\"^\\\\|(?:[^\\\\n]*)\\\\|(?:[fhck]?)$\",lookahead:/^\\|([^\\n]*)\\|([fhck]?)$/gm,rowTerminator:\"\\\\|(?:[cfhk]?)$\\\\n?\",cellPattern:\"(?:\\\\|([^\\\\n\\\\|]*)\\\\|)|(\\\\|[cfhk]?$\\\\n?)\",cellTerminator:\"(?:\\\\u0020*)\\\\|\",rowTypes:{c:\"caption\",f:\"tfoot\",h:\"thead\",\"\":\"tbody\"},handler(w){if(!Wikifier.helpers.hasBlockContext(w.output.childNodes))return void jQuery(w.output).append(document.createTextNode(w.matchText));const table=jQuery(document.createElement(\"table\")).appendTo(w.output).get(0),prevColumns=[];let matched,curRowType=null,$rowContainer=null,rowCount=0;w.nextMatch=w.matchStart;do{this.lookahead.lastIndex=w.nextMatch;const match=this.lookahead.exec(w.source);if(matched=match&&match.index===w.nextMatch,matched){const nextRowType=match[2];\"k\"===nextRowType?(table.className=match[1],w.nextMatch+=match[0].length+1):(nextRowType!==curRowType&&(curRowType=nextRowType,$rowContainer=jQuery(document.createElement(this.rowTypes[nextRowType])).appendTo(table)),\"c\"===curRowType?($rowContainer.css(\"caption-side\",0===rowCount?\"top\":\"bottom\"),w.nextMatch+=1,w.subWikify($rowContainer[0],this.rowTerminator)):this.rowHandler(w,jQuery(document.createElement(\"tr\")).appendTo($rowContainer).get(0),prevColumns),++rowCount)}}while(matched)},rowHandler(w,rowEl,prevColumns){const cellRe=new RegExp(this.cellPattern,\"gm\");let matched,col=0,curColCount=1;do{cellRe.lastIndex=w.nextMatch;const cellMatch=cellRe.exec(w.source);if(matched=cellMatch&&cellMatch.index===w.nextMatch,matched){if(\"~\"===cellMatch[1]){const last=prevColumns[col];last&&(++last.rowCount,last.$element.attr(\"rowspan\",last.rowCount).css(\"vertical-align\",\"middle\")),w.nextMatch=cellMatch.index+cellMatch[0].length-1}else if(\">\"===cellMatch[1])++curColCount,w.nextMatch=cellMatch.index+cellMatch[0].length-1;else{if(cellMatch[2]){w.nextMatch=cellMatch.index+cellMatch[0].length;break}{++w.nextMatch;const css=Wikifier.helpers.inlineCss(w);let $cell,spaceLeft=!1,spaceRight=!1;for(;\" \"===w.source.substr(w.nextMatch,1);)spaceLeft=!0,++w.nextMatch;\"!\"===w.source.substr(w.nextMatch,1)?($cell=jQuery(document.createElement(\"th\")).appendTo(rowEl),++w.nextMatch):$cell=jQuery(document.createElement(\"td\")).appendTo(rowEl),prevColumns[col]={rowCount:1,$element:$cell},curColCount>1&&($cell.attr(\"colspan\",curColCount),curColCount=1),w.subWikify($cell[0],this.cellTerminator),\" \"===w.matchText.substr(w.matchText.length-2,1)&&(spaceRight=!0),css.classes.forEach((className=>$cell.addClass(className))),\"\"!==css.id&&$cell.attr(\"id\",css.id),spaceLeft&&spaceRight?css.styles[\"text-align\"]=\"center\":spaceLeft?css.styles[\"text-align\"]=\"right\":spaceRight&&(css.styles[\"text-align\"]=\"left\"),$cell.css(css.styles),w.nextMatch=w.nextMatch-1}}++col}}while(matched)}}),Wikifier.Parser.add({name:\"list\",profiles:[\"block\"],match:\"^(?:(?:\\\\*+)|(?:#+))\",lookahead:/^(?:(\\*+)|(#+))/gm,terminator:\"\\\\n\",handler(w){if(!Wikifier.helpers.hasBlockContext(w.output.childNodes))return void jQuery(w.output).append(document.createTextNode(w.matchText));w.nextMatch=w.matchStart;const destStack=[w.output];let matched,i,curType=null,curLevel=0;do{this.lookahead.lastIndex=w.nextMatch;const match=this.lookahead.exec(w.source);if(matched=match&&match.index===w.nextMatch,matched){const newType=match[2]?\"ol\":\"ul\",newLevel=match[0].length;if(w.nextMatch+=match[0].length,newLevel>curLevel)for(i=curLevel;i<newLevel;++i)destStack.push(jQuery(document.createElement(newType)).appendTo(destStack[destStack.length-1]).get(0));else if(newLevel<curLevel)for(i=curLevel;i>newLevel;--i)destStack.pop();else newLevel===curLevel&&newType!==curType&&(destStack.pop(),destStack.push(jQuery(document.createElement(newType)).appendTo(destStack[destStack.length-1]).get(0)));curLevel=newLevel,curType=newType,w.subWikify(jQuery(document.createElement(\"li\")).appendTo(destStack[destStack.length-1]).get(0),this.terminator)}}while(matched)}}),Wikifier.Parser.add({name:\"commentByBlock\",profiles:[\"core\"],match:\"(?:/(?:%|\\\\*))|(?:\\x3c!--)\",lookahead:/(?:\\/(%|\\*)(?:(?:.|\\n)*?)\\1\\/)|(?:<!--(?:(?:.|\\n)*?)-->)/gm,handler(w){this.lookahead.lastIndex=w.matchStart;const match=this.lookahead.exec(w.source);match&&match.index===w.matchStart&&(w.nextMatch=this.lookahead.lastIndex)}}),Wikifier.Parser.add({name:\"lineContinuation\",profiles:[\"core\"],match:`\\\\\\\\${Patterns.spaceNoTerminator}*\\\\n|\\\\n${Patterns.spaceNoTerminator}*\\\\\\\\|\\\\n?\\\\\\\\${Patterns.spaceNoTerminator}*$|^${Patterns.spaceNoTerminator}*\\\\\\\\\\\\n?`,handler(w){w.nextMatch=w.matchStart+w.matchLength}}),Wikifier.Parser.add({name:\"lineBreak\",profiles:[\"core\"],match:\"\\\\n|<[Bb][Rr]\\\\s*/?>\",handler(w){w.options.nobr||jQuery(document.createElement(\"br\")).appendTo(w.output)}}),Wikifier.Parser.add({name:\"htmlCharacterReference\",profiles:[\"core\"],match:\"(?:(?:&#?[0-9A-Za-z]{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]));)+|&#?[0-9A-Za-z]{2,8};)\",handler(w){jQuery(document.createDocumentFragment()).append(w.matchText).appendTo(w.output)}}),Wikifier.Parser.add({name:\"xmlProlog\",profiles:[\"core\"],match:\"<\\\\?[Xx][Mm][Ll][^>]*\\\\?>\",handler(w){w.nextMatch=w.matchStart+w.matchLength}}),Wikifier.Parser.add({name:\"verbatimHtml\",profiles:[\"core\"],match:\"<[Hh][Tt][Mm][Ll]>\",lookahead:/<[Hh][Tt][Mm][Ll]>((?:.|\\n)*?)<\\/[Hh][Tt][Mm][Ll]>/gm,handler:_verbatimTagHandler}),Wikifier.Parser.add({name:\"verbatimScriptTag\",profiles:[\"core\"],match:\"<[Ss][Cc][Rr][Ii][Pp][Tt][^>]*>\",lookahead:/(<[Ss][Cc][Rr][Ii][Pp][Tt]*>(?:.|\\n)*?<\\/[Ss][Cc][Rr][Ii][Pp][Tt]>)/gm,handler:_verbatimTagHandler}),Wikifier.Parser.add({name:\"styleTag\",profiles:[\"core\"],match:\"<[Ss][Tt][Yy][Ll][Ee][^>]*>\",lookahead:/(<[Ss][Tt][Yy][Ll][Ee]*>)((?:.|\\n)*?)(<\\/[Ss][Tt][Yy][Ll][Ee]>)/gm,imageMarkup:new RegExp(Patterns.cssImage,\"g\"),hasImageMarkup:new RegExp(Patterns.cssImage),handler(w){this.lookahead.lastIndex=w.matchStart;const match=this.lookahead.exec(w.source);if(match&&match.index===w.matchStart){w.nextMatch=this.lookahead.lastIndex;let css=match[2];this.hasImageMarkup.test(css)&&(this.imageMarkup.lastIndex=0,css=css.replace(this.imageMarkup,(wikiImage=>{const markup=Wikifier.helpers.parseSquareBracketedMarkup({source:wikiImage,matchStart:0});if(markup.hasOwnProperty(\"error\")||markup.pos<wikiImage.length)return wikiImage;let source=markup.source;if(\"data:\"!==source.slice(0,5)&&Story.has(source)){const passage=Story.get(source);passage.tags.includes(\"Twine.image\")&&(source=passage.text)}return`url(\"${source.replace(/\"/g,\"%22\")}\")`}))),jQuery(document.createDocumentFragment()).append(match[1]+css+match[3]).appendTo(w.output)}}}),Wikifier.Parser.add({name:\"svgTag\",profiles:[\"core\"],match:\"<[Ss][Vv][Gg][^>]*>\",lookahead:/<(\\/?)[Ss][Vv][Gg][^>]*>/gm,namespace:\"http://www.w3.org/2000/svg\",handler(w){this.lookahead.lastIndex=w.nextMatch;let match,depth=1;for(;depth>0&&null!==(match=this.lookahead.exec(w.source));)depth+=\"/\"===match[1]?-1:1;if(0===depth){w.nextMatch=this.lookahead.lastIndex;const svgTag=w.source.slice(w.matchStart,this.lookahead.lastIndex),$frag=jQuery(document.createDocumentFragment()).append(svgTag);$frag.find(\"a[data-passage],image[data-passage]\").each(((_,el)=>{const tagName=el.tagName.toLowerCase();try{this.processAttributeDirectives(el)}catch(ex){return throwError(w.output,`svg|<${tagName}>: ${ex.message}`,`${w.matchText}…`)}el.hasAttribute(\"data-passage\")&&this.processDataAttributes(el,tagName)})),$frag.appendTo(w.output)}},processAttributeDirectives(el){[...el.attributes].forEach((({name:name,value:value})=>{const evalShorthand=\"@\"===name[0];if(evalShorthand||name.startsWith(\"sc-eval:\")){const newName=name.slice(evalShorthand?1:8);if(\"data-setter\"===newName)throw new Error(`evaluation directive is not allowed on the data-setter attribute: \"${name}\"`);let result;try{result=Scripting.evalTwineScript(value)}catch(ex){throw new Error(`bad evaluation from attribute directive \"${name}\": ${ex.message}`)}try{el.setAttribute(newName,result),el.removeAttribute(name)}catch(ex){throw new Error(`cannot transform attribute directive \"${name}\" into attribute \"${newName}\"`)}}}))},processDataAttributes(el,tagName){let passage=el.getAttribute(\"data-passage\");if(null==passage)return;const evaluated=Wikifier.helpers.evalPassageId(passage);if(evaluated!==passage&&(passage=evaluated,el.setAttribute(\"data-passage\",evaluated)),\"\"!==passage)if(\"image\"===tagName)\"data:\"!==passage.slice(0,5)&&Story.has(passage)&&(passage=Story.get(passage),passage.tags.includes(\"Twine.image\")&&el.setAttribute(\"href\",passage.text.trim()));else{let setFn,setter=el.getAttribute(\"data-setter\");null!=setter&&(setter=String(setter).trim(),\"\"!==setter&&(setFn=Wikifier.helpers.createShadowSetterCallback(Scripting.parse(setter)))),Story.has(passage)?(el.classList.add(\"link-internal\"),Config.addVisitedLinkClass&&State.hasPlayed(passage)&&el.classList.add(\"link-visited\")):el.classList.add(\"link-broken\"),jQuery(el).ariaClick({one:!0},(function(){\"function\"==typeof setFn&&setFn.call(this),Engine.play(passage)}))}}}),Wikifier.Parser.add({name:\"htmlTag\",profiles:[\"core\"],match:`<${Patterns.htmlTagName}(?:\\\\s+[^\\\\u0000-\\\\u001F\\\\u007F-\\\\u009F\\\\s\"'>\\\\/=]+(?:\\\\s*=\\\\s*(?:\"[^\"]*?\"|'[^']*?'|[^\\\\s\"'=<>\\`]+))?)*\\\\s*\\\\/?>`,tagRe:new RegExp(`^<(${Patterns.htmlTagName})`),mediaTags:[\"audio\",\"img\",\"source\",\"track\",\"video\"],nobrTags:[\"audio\",\"colgroup\",\"datalist\",\"dl\",\"figure\",\"meter\",\"ol\",\"optgroup\",\"picture\",\"progress\",\"ruby\",\"select\",\"table\",\"tbody\",\"tfoot\",\"thead\",\"tr\",\"ul\",\"video\"],voidTags:[\"area\",\"base\",\"br\",\"col\",\"embed\",\"hr\",\"img\",\"input\",\"keygen\",\"link\",\"menuitem\",\"meta\",\"param\",\"source\",\"track\",\"wbr\"],handler(w){const tagMatch=this.tagRe.exec(w.matchText),tag=tagMatch&&tagMatch[1],tagName=tag&&tag.toLowerCase();if(tagName){const isVoid=this.voidTags.includes(tagName)||w.matchText.endsWith(\"/>\"),isNobr=this.nobrTags.includes(tagName);let terminator,terminatorMatch;if(!isVoid){terminator=`<\\\\/${tagName}\\\\s*>`;const terminatorRe=new RegExp(terminator,\"gim\");terminatorRe.lastIndex=w.matchStart,terminatorMatch=terminatorRe.exec(w.source)}if(!isVoid&&!terminatorMatch)return throwError(w.output,`cannot find a closing tag for HTML <${tag}>`,`${w.matchText}…`);{let debugView,output=w.output,el=document.createElement(w.output.tagName);for(el.innerHTML=w.matchText;el.firstChild;)el=el.firstChild;try{this.processAttributeDirectives(el)}catch(ex){return throwError(w.output,`<${tagName}>: ${ex.message}`,`${w.matchText}…`)}if(el.hasAttribute(\"data-passage\")&&(this.processDataAttributes(el,tagName),Config.debug&&(debugView=new DebugView(w.output,`html-${tagName}`,tagName,w.matchText),debugView.modes({block:\"img\"===tagName,nonvoid:terminatorMatch}),output=debugView.output)),terminatorMatch){try{Wikifier.Option.push({nobr:isNobr}),w.subWikify(el,terminator,{ignoreTerminatorCase:!0})}finally{Wikifier.Option.pop()}debugView&&jQuery(el).find(\".debug.block\").length>0&&debugView.modes({block:!0})}output.appendChild(\"track\"===tagName?el.cloneNode(!0):el)}}},processAttributeDirectives(el){[...el.attributes].forEach((({name:name,value:value})=>{const evalShorthand=\"@\"===name[0];if(evalShorthand||name.startsWith(\"sc-eval:\")){const newName=name.slice(evalShorthand?1:8);if(\"data-setter\"===newName)throw new Error(`evaluation directive is not allowed on the data-setter attribute: \"${name}\"`);let result;try{result=Scripting.evalTwineScript(value)}catch(ex){throw new Error(`bad evaluation from attribute directive \"${name}\": ${ex.message}`)}try{el.setAttribute(newName,result),el.removeAttribute(name)}catch(ex){throw new Error(`cannot transform attribute directive \"${name}\" into attribute \"${newName}\"`)}}}))},processDataAttributes(el,tagName){let passage=el.getAttribute(\"data-passage\");if(null==passage)return;const evaluated=Wikifier.helpers.evalPassageId(passage);if(evaluated!==passage&&(passage=evaluated,el.setAttribute(\"data-passage\",evaluated)),\"\"!==passage)if(this.mediaTags.includes(tagName)){if(\"data:\"!==passage.slice(0,5)&&Story.has(passage)){let parentName,twineTag;switch(passage=Story.get(passage),tagName){case\"audio\":case\"video\":twineTag=`Twine.${tagName}`;break;case\"img\":twineTag=\"Twine.image\";break;case\"track\":twineTag=\"Twine.vtt\";break;case\"source\":{const $parent=$(el).closest(\"audio,picture,video\");$parent.length&&(parentName=$parent.get(0).tagName.toLowerCase(),twineTag=`Twine.${\"picture\"===parentName?\"image\":parentName}`)}}passage.tags.includes(twineTag)&&(el[\"picture\"===parentName?\"srcset\":\"src\"]=passage.text.trim())}}else{let setFn,setter=el.getAttribute(\"data-setter\");null!=setter&&(setter=String(setter).trim(),\"\"!==setter&&(setFn=Wikifier.helpers.createShadowSetterCallback(Scripting.parse(setter)))),Story.has(passage)?(el.classList.add(\"link-internal\"),Config.addVisitedLinkClass&&State.hasPlayed(passage)&&el.classList.add(\"link-visited\")):el.classList.add(\"link-broken\"),jQuery(el).ariaClick({one:!0},(function(){\"function\"==typeof setFn&&setFn.call(this),Engine.play(passage)}))}}})})();var Template=(()=>{const _templates=new Map,_validNameRe=new RegExp(`^(?:${Patterns.templateName})$`),_validType=template=>{const templateType=typeof template;return\"function\"===templateType||\"string\"===templateType};return Object.freeze(Object.defineProperties({},{add:{value:function(name,template){if(!(_validType(template)||template instanceof Array&&template.length>0&&template.every(_validType)))throw new TypeError(`invalid template type (${name}); templates must be: functions, strings, or an array of either`);(name instanceof Array?name:[name]).forEach((name=>{if(!_validNameRe.test(name))throw new Error(`invalid template name \"${name}\"`);if(_templates.has(name))throw new Error(`cannot clobber existing template ?${name}`);_templates.set(name,template)}))}},delete:{value:function(name){(name instanceof Array?name:[name]).forEach((name=>_templates.delete(name)))}},get:{value:function(name){return _templates.has(name)?_templates.get(name):null}},has:{value:function(name){return _templates.has(name)}},size:{get:function(){return _templates.size}}}))})(),Macro=(()=>{const _macros={},_tags={},_validNameRe=new RegExp(`^(?:${Patterns.macroName})$`);function macrosHas(name){return _macros.hasOwnProperty(name)}function tagsRegister(parent,bodyTags){if(!parent)throw new Error(\"no parent specified\");const allTags=[].concat([`/${parent}`,`end${parent}`],Array.isArray(bodyTags)?bodyTags:[]);for(let i=0;i<allTags.length;++i){const tag=allTags[i];if(macrosHas(tag))throw new Error(\"cannot register tag for an existing macro\");tagsHas(tag)?_tags[tag].includes(parent)||(_tags[tag].push(parent),_tags[tag].sort()):_tags[tag]=[parent]}}function tagsUnregister(parent){if(!parent)throw new Error(\"no parent specified\");Object.keys(_tags).forEach((tag=>{const i=_tags[tag].indexOf(parent);-1!==i&&(1===_tags[tag].length?delete _tags[tag]:_tags[tag].splice(i,1))}))}function tagsHas(name){return _tags.hasOwnProperty(name)}return Object.freeze(Object.defineProperties({},{add:{value:function macrosAdd(name,def){if(Array.isArray(name))name.forEach((name=>macrosAdd(name,def)));else{if(!_validNameRe.test(name))throw new Error(`invalid macro name \"${name}\"`);if(macrosHas(name))throw new Error(`cannot clobber existing macro <<${name}>>`);if(tagsHas(name))throw new Error(`cannot clobber child tag <<${name}>> of parent macro${1===_tags[name].length?\"\":\"s\"} <<${_tags[name].join(\">>, <<\")}>>`);try{if(\"object\"==typeof def)_macros[name]=Object.assign(Object.create(null),def,{_MACRO_API:!0});else{if(!macrosHas(def))throw new Error(`cannot create alias of nonexistent macro <<${def}>>`);_macros[name]=Object.create(_macros[def],{_ALIAS_OF:{enumerable:!0,value:def}})}Object.defineProperty(_macros,name,{writable:!1})}catch(ex){throw\"TypeError\"===ex.name?new Error(`cannot clobber protected macro <<${name}>>`):new Error(`unknown error when attempting to add macro <<${name}>>: [${ex.name}] ${ex.message}`)}if(void 0!==_macros[name].tags)if(null==_macros[name].tags)tagsRegister(name);else{if(!Array.isArray(_macros[name].tags))throw new Error(`bad value for \"tags\" property of macro <<${name}>>`);tagsRegister(name,_macros[name].tags)}}}},delete:{value:function macrosDelete(name){if(Array.isArray(name))name.forEach((name=>macrosDelete(name)));else if(macrosHas(name)){void 0!==_macros[name].tags&&tagsUnregister(name);try{Object.defineProperty(_macros,name,{writable:!0}),delete _macros[name]}catch(ex){throw new Error(`unknown error removing macro <<${name}>>: ${ex.message}`)}}else if(tagsHas(name))throw new Error(`cannot remove child tag <<${name}>> of parent macro <<${_tags[name]}>>`)}},isEmpty:{value:function(){return 0===Object.keys(_macros).length}},has:{value:macrosHas},get:{value:function(name){let macro=null;return macrosHas(name)&&\"function\"==typeof _macros[name].handler?macro=_macros[name]:macros.hasOwnProperty(name)&&\"function\"==typeof macros[name].handler&&(macro=macros[name]),macro}},init:{value:function(handler=\"init\"){Object.keys(_macros).forEach((name=>{\"function\"==typeof _macros[name][handler]&&_macros[name][handler](name)})),Object.keys(macros).forEach((name=>{\"function\"==typeof macros[name][handler]&&macros[name][handler](name)}))}},tags:{value:Object.freeze(Object.defineProperties({},{register:{value:tagsRegister},unregister:{value:tagsUnregister},has:{value:tagsHas},get:{value:function(name){return tagsHas(name)?_tags[name]:null}}}))},evalStatements:{value:(...args)=>Scripting.evalJavaScript(...args)}}))})(),MacroContext=class{constructor(contextData){const context=Object.assign({parent:null,macro:null,name:\"\",displayName:\"\",args:null,payload:null,parser:null,source:\"\"},contextData);if(null===context.macro||\"\"===context.name||null===context.parser)throw new TypeError(\"context object missing required properties\");Object.defineProperties(this,{self:{value:context.macro},name:{value:void 0===context.macro._ALIAS_OF?context.name:context.macro._ALIAS_OF},displayName:{value:context.name},args:{value:context.args},payload:{value:context.payload},source:{value:context.source},parent:{value:context.parent},parser:{value:context.parser},_output:{value:context.parser.output},_shadows:{writable:!0,value:null},_debugView:{writable:!0,value:null},_debugViewEnabled:{writable:!0,value:Config.debug}})}get output(){return this._debugViewEnabled?this.debugView.output:this._output}get shadows(){return[...this._shadows]}get shadowView(){const view=new Set;return this.contextSelectAll((ctx=>ctx._shadows)).forEach((ctx=>ctx._shadows.forEach((name=>view.add(name))))),[...view]}get debugView(){return this._debugViewEnabled?null!==this._debugView?this._debugView:this.createDebugView():null}contextHas(filter){let context=this;for(;null!==(context=context.parent);)if(filter(context))return!0;return!1}contextSelect(filter){let context=this;for(;null!==(context=context.parent);)if(filter(context))return context;return null}contextSelectAll(filter){const result=[];let context=this;for(;null!==(context=context.parent);)filter(context)&&result.push(context);return result}addShadow(...names){this._shadows||(this._shadows=new Set);const varRe=new RegExp(`^${Patterns.variable}$`);names.flat(1/0).forEach((name=>{if(\"string\"!=typeof name)throw new TypeError(\"variable name must be a string; type: \"+typeof name);if(!varRe.test(name))throw new Error(`invalid variable name \"${name}\"`);this._shadows.add(name)}))}createShadowWrapper(callback,doneCallback,startCallback){const shadowContext=this;let shadowStore;return\"function\"==typeof callback&&(shadowStore={},this.shadowView.forEach((varName=>{const varKey=varName.slice(1),store=\"$\"===varName[0]?State.variables:State.temporary;shadowStore[varName]=store[varKey]}))),function(...args){if(\"function\"==typeof startCallback&&startCallback.apply(this,args),\"function\"==typeof callback){const shadowNames=Object.keys(shadowStore),valueCache=shadowNames.length>0?{}:null,macroParser=Wikifier.Parser.get(\"macro\");let contextCache;try{shadowNames.forEach((varName=>{const varKey=varName.slice(1),store=\"$\"===varName[0]?State.variables:State.temporary;store.hasOwnProperty(varKey)&&(valueCache[varKey]=store[varKey]),store[varKey]=shadowStore[varName]})),contextCache=macroParser.context,macroParser.context=shadowContext,callback.apply(this,args)}finally{contextCache!==undefined&&(macroParser.context=contextCache),shadowNames.forEach((varName=>{const varKey=varName.slice(1),store=\"$\"===varName[0]?State.variables:State.temporary;shadowStore[varName]=store[varKey],valueCache.hasOwnProperty(varKey)?store[varKey]=valueCache[varKey]:delete store[varKey]}))}}\"function\"==typeof doneCallback&&doneCallback.apply(this,args)}}createDebugView(name,title){return this._debugView=new DebugView(this._output,\"macro\",name||this.displayName,title||this.source),null!==this.payload&&this.payload.length>0&&this._debugView.modes({nonvoid:!0}),this._debugViewEnabled=!0,this._debugView}removeDebugView(){null!==this._debugView&&(this._debugView.remove(),this._debugView=null),this._debugViewEnabled=!1}error(message,source,stack){return throwError(this._output,`<<${this.displayName}>>: ${message}`,source||this.source,stack)}};(()=>{if(Macro.add(\"capture\",{skipArgs:!0,tags:null,tsVarRe:new RegExp(`(${Patterns.variable})`,\"g\"),handler(){if(0===this.args.raw.length)return this.error(\"no story/temporary variable list specified\");const valueCache={};try{const tsVarRe=this.self.tsVarRe;let match;for(;null!==(match=tsVarRe.exec(this.args.raw));){const varName=match[1],varKey=varName.slice(1),store=\"$\"===varName[0]?State.variables:State.temporary;store.hasOwnProperty(varKey)&&(valueCache[varKey]=store[varKey]),this.addShadow(varName)}new Wikifier(this.output,this.payload[0].contents)}finally{this.shadows.forEach((varName=>{const varKey=varName.slice(1),store=\"$\"===varName[0]?State.variables:State.temporary;valueCache.hasOwnProperty(varKey)?store[varKey]=valueCache[varKey]:delete store[varKey]}))}}}),Macro.add(\"set\",{skipArgs:!0,handler(){if(0===this.args.full.length)return this.error(\"no expression specified\");try{Scripting.evalJavaScript(this.args.full)}catch(ex){return this.error(`bad evaluation: ${\"object\"==typeof ex?`${ex.name}: ${ex.message}`:ex}`,null,ex.stack)}Config.debug&&this.debugView.modes({hidden:!0})}}),Macro.add(\"unset\",{skipArgs:!0,handler(){if(0===this.args.full.length)return this.error(\"no story/temporary variable list specified\");const searchRe=/[,;\\s]*((?:State\\.(?:variables|temporary)|setup)\\.)/g,replacer=(_,p1)=>`; delete ${p1}`,cleanupRe=/^; /;try{const unsetExp=this.args.full.replace(searchRe,replacer).replace(cleanupRe,\"\");Scripting.evalJavaScript(unsetExp)}catch(ex){return this.error(`bad evaluation: ${getErrorMessage(ex)}`)}Config.debug&&this.debugView.modes({hidden:!0})}}),Macro.add(\"remember\",{skipArgs:!0,jsVarRe:new RegExp(`State\\\\.variables\\\\.(${Patterns.identifier})`,\"g\"),handler(){if(0===this.args.full.length)return this.error(\"no expression specified\");try{Scripting.evalJavaScript(this.args.full)}catch(ex){return this.error(`bad evaluation: ${\"object\"==typeof ex?ex.message:ex}`)}const remember=storage.get(\"remember\")||{},jsVarRe=this.self.jsVarRe;let match;for(;null!==(match=jsVarRe.exec(this.args.full));){const name=match[1];remember[name]=State.variables[name]}if(!storage.set(\"remember\",remember))return this.error(`unknown error, cannot remember: ${this.args.raw}`);Config.debug&&this.debugView.modes({hidden:!0})},init(){const remember=storage.get(\"remember\");remember&&Object.keys(remember).forEach((name=>State.variables[name]=remember[name]))}}),Macro.add(\"forget\",{skipArgs:!0,jsVarRe:new RegExp(`State\\\\.variables\\\\.(${Patterns.identifier})`,\"g\"),handler(){if(0===this.args.full.length)return this.error(\"no story variable list specified\");const remember=storage.get(\"remember\"),jsVarRe=this.self.jsVarRe;let match,needStore=!1;for(;null!==(match=jsVarRe.exec(this.args.full));){const name=match[1];State.variables.hasOwnProperty(name)&&delete State.variables[name],remember&&remember.hasOwnProperty(name)&&(needStore=!0,delete remember[name])}if(needStore)if(0===Object.keys(remember).length){if(!storage.delete(\"remember\"))return this.error(\"unknown error, cannot update remember store\")}else if(!storage.set(\"remember\",remember))return this.error(\"unknown error, cannot update remember store\");Config.debug&&this.debugView.modes({hidden:!0})}}),Macro.add(\"run\",\"set\"),Macro.add(\"script\",{skipArgs:!0,tags:null,handler(){const output=document.createDocumentFragment();try{Scripting.evalJavaScript(this.payload[0].contents,output)}catch(ex){return this.error(`bad evaluation: ${\"object\"==typeof ex?ex.message:ex}`)}Config.debug&&this.createDebugView(),output.hasChildNodes()&&this.output.appendChild(output)}}),Macro.add(\"include\",{handler(){if(0===this.args.length)return this.error(\"no passage specified\");let passage,$el;if(passage=\"object\"==typeof this.args[0]?this.args[0].link:this.args[0],!Story.has(passage))return this.error(`passage \"${passage}\" does not exist`);Config.debug&&this.debugView.modes({block:!0}),passage=Story.get(passage),$el=this.args[1]?jQuery(document.createElement(this.args[1])).addClass(`${passage.domId} macro-${this.name}`).attr(\"data-passage\",passage.title).appendTo(this.output):jQuery(this.output),$el.wiki(passage.processText())}}),Macro.add(\"nobr\",{skipArgs:!0,tags:null,handler(){new Wikifier(this.output,this.payload[0].contents.replace(/^\\n+|\\n+$/g,\"\").replace(/\\n+/g,\" \"))}}),Macro.add([\"print\",\"=\",\"-\"],{skipArgs:!0,handler(){if(0===this.args.full.length)return this.error(\"no expression specified\");try{const result=stringFrom(Scripting.evalJavaScript(this.args.full));null!==result&&new Wikifier(this.output,\"-\"===this.name?Util.escape(result):result)}catch(ex){return this.error(`bad evaluation: ${\"object\"==typeof ex?`${ex.name}: ${ex.message}`:ex}`,null,ex.stack)}}}),Macro.add(\"silently\",{skipArgs:!0,tags:null,handler(){const frag=document.createDocumentFragment();if(new Wikifier(frag,this.payload[0].contents.trim()),Config.debug)this.debugView.modes({block:!0,hidden:!0}),this.output.appendChild(frag);else{const errList=[...frag.querySelectorAll(\".error\")].map((errEl=>errEl.textContent));if(errList.length>0)return this.error(`error${1===errList.length?\"\":\"s\"} within contents (${errList.join(\"; \")})`)}}}),Macro.add(\"type\",{isAsync:!0,tags:null,typeId:0,handler(){if(0===this.args.length)return this.error(\"no speed specified\");const speed=Util.fromCssTime(this.args[0]);if(speed<0)return this.error(`speed time value must be non-negative (received: ${this.args[0]})`);let cursor,elClass=\"\",elId=\"\",elTag=\"div\",skipKey=Config.macros.typeSkipKey,start=400;const options=this.args.slice(1);for(;options.length>0;){const option=options.shift();switch(option){case\"class\":if(0===options.length)return this.error(\"class option missing required class name(s)\");if(elClass=options.shift(),\"\"===elClass)throw new Error('class option class name(s) must be non-empty (received: \"\")');break;case\"element\":if(0===options.length)return this.error(\"element option missing required element tag name\");if(elTag=options.shift(),\"\"===elTag)throw new Error('element option tag name must be non-empty (received: \"\")');break;case\"id\":if(0===options.length)return this.error(\"id option missing required ID\");if(elId=options.shift(),\"\"===elId)throw new Error('id option ID must be non-empty (received: \"\")');break;case\"keep\":cursor=\"keep\";break;case\"none\":cursor=\"none\";break;case\"skipkey\":if(0===options.length)return this.error(\"skipkey option missing required key value\");if(skipKey=options.shift(),\"\"===skipKey)throw new Error('skipkey option key value must be non-empty (received: \"\")');break;case\"start\":{if(0===options.length)return this.error(\"start option missing required time value\");const value=options.shift();if(start=Util.fromCssTime(value),start<0)throw new Error(`start option time value must be non-negative (received: ${value})`);break}default:return this.error(`unknown option: ${option}`)}}const contents=this.payload[0].contents;if(\"\"===contents.trim())return;Config.debug&&this.debugView.modes({block:!0});const className=`macro-${this.name}`,namespace=`.${className}`,$target=jQuery(document.createElement(elTag)).addClass(`${className} ${className}-target`).appendTo(this.output);TempState.macroTypeQueue||(TempState.macroTypeQueue=[],$(document).off(namespace).one(`:passageinit${namespace}`,(()=>$(document).off(namespace))));const startTyping=0===TempState.macroTypeQueue.length,selfId=++this.self.typeId;TempState.macroTypeQueue.push({id:selfId,handler(){const $wrapper=jQuery(document.createElement(elTag)).addClass(className);elId&&$wrapper.attr(\"id\",elId),elClass&&$wrapper.addClass(elClass),new Wikifier($wrapper,contents);const passage=State.passage,turn=State.turns;if(!Config.macros.typeVisitedPassages&&State.passages.slice(0,-1).some((title=>title===passage))||$wrapper.find(\".error\").length>0)return $target.replaceWith($wrapper),TempState.macroTypeQueue.shift(),void(TempState.macroTypeQueue.length>0&&TempState.macroTypeQueue.first().handler());const typer=new NodeTyper({targetNode:$wrapper.get(0),classNames:\"none\"===cursor?null:`${className}-cursor`});$target.replaceWith($wrapper);const keydownAndNS=`keydown${namespace}`,typingStopAndNS=`:typingstop${namespace}`;$(document).off(keydownAndNS).on(keydownAndNS,(ev=>{Util.scrubEventKey(ev.key)!==skipKey||ev.target!==document.body&&ev.target!==document.documentElement||(ev.preventDefault(),$(document).off(keydownAndNS),typer.finish())})).one(typingStopAndNS,(()=>{TempState.macroTypeQueue&&(0===TempState.macroTypeQueue.length?jQuery.event.trigger(\":typingcomplete\"):TempState.macroTypeQueue.first().handler())}));const typeNode=function(){const typeNodeMember=function(typeIntervalId){State.passage===passage&&State.turns===turn&&typer.type()||(typeIntervalId&&clearInterval(typeIntervalId),TempState.macroTypeQueue&&TempState.macroTypeQueue.length>0&&TempState.macroTypeQueue.first().id===selfId&&TempState.macroTypeQueue.shift(),$wrapper.trigger(\":typingstop\"),$wrapper.addClass(`${className}-done`),\"keep\"===cursor&&$wrapper.addClass(`${className}-cursor`))};$wrapper.trigger(\":typingstart\"),typeNodeMember();const typeNodeMemberId=setInterval((()=>typeNodeMember(typeNodeMemberId)),speed)};start?setTimeout(typeNode,start):typeNode()}}),startTyping&&(Engine.isPlaying()?$(document).one(`:passageend${namespace}`,(()=>TempState.macroTypeQueue.first().handler())):TempState.macroTypeQueue.first().handler())}}),Macro.add(\"display\",\"include\"),Macro.add(\"if\",{skipArgs:!0,tags:[\"elseif\",\"else\"],elseifWsRe:/^\\s*if\\b/i,ifAssignRe:/[^!=&^|<>*/%+-]=[^=>]/,handler(){let i;try{const len=this.payload.length,elseifWsRe=this.self.elseifWsRe,ifAssignRe=this.self.ifAssignRe;for(i=0;i<len;++i)if(\"else\"===this.payload[i].name){if(this.payload[i].args.raw.length>0)return elseifWsRe.test(this.payload[i].args.raw)?this.error('whitespace is not allowed between the \"else\" and \"if\" in <<elseif>> clause'+(i>0?\" (#\"+i+\")\":\"\")):this.error(`<<else>> does not accept a conditional expression (perhaps you meant to use <<elseif>>), invalid: ${this.payload[i].args.raw}`);if(i+1!==len)return this.error(\"<<else>> must be the final clause\")}else{if(0===this.payload[i].args.full.length)return this.error(`no conditional expression specified for <<${this.payload[i].name}>> clause${i>0?\" (#\"+i+\")\":\"\"}`);if(Config.macros.ifAssignmentError&&ifAssignRe.test(this.payload[i].args.full))return this.error(`assignment operator found within <<${this.payload[i].name}>> clause${i>0?\" (#\"+i+\")\":\"\"} (perhaps you meant to use an equality operator: ==, ===, eq, is), invalid: ${this.payload[i].args.raw}`)}const evalJavaScript=Scripting.evalJavaScript;let success=!1;for(i=0;i<len;++i){if(Config.debug&&this.createDebugView(this.payload[i].name,this.payload[i].source).modes({nonvoid:!1}),\"else\"===this.payload[i].name||evalJavaScript(this.payload[i].args.full)){success=!0,new Wikifier(this.output,this.payload[i].contents);break}Config.debug&&this.debugView.modes({hidden:!0,invalid:!0})}if(Config.debug){for(++i;i<len;++i)this.createDebugView(this.payload[i].name,this.payload[i].source).modes({nonvoid:!1,hidden:!0,invalid:!0});this.createDebugView(`/${this.name}`,`<</${this.name}>>`).modes({nonvoid:!1,hidden:!success,invalid:!success})}}catch(ex){return this.error(`bad conditional expression in <<${0===i?\"if\":\"elseif\"}>> clause${i>0?\" (#\"+i+\")\":\"\"}: ${\"object\"==typeof ex?`${ex.name}: ${ex.message}`:ex}`,null,ex.stack)}}}),Macro.add(\"switch\",{skipArgs:[\"switch\"],tags:[\"case\",\"default\"],handler(){if(0===this.args.full.length)return this.error(\"no expression specified\");const len=this.payload.length;if(1===len)return this.error(\"no cases specified\");let i,result;for(i=1;i<len;++i)if(\"default\"===this.payload[i].name){if(this.payload[i].args.length>0)return this.error(`<<default>> does not accept values, invalid: ${this.payload[i].args.raw}`);if(i+1!==len)return this.error(\"<<default>> must be the final case\")}else if(0===this.payload[i].args.length)return this.error(`no value(s) specified for <<${this.payload[i].name}>> (#${i})`);try{result=Scripting.evalJavaScript(this.args.full)}catch(ex){return this.error(`bad evaluation: ${\"object\"==typeof ex?ex.message:ex}`)}const debugView=this.debugView;let success=!1;for(Config.debug&&debugView.modes({nonvoid:!1,hidden:!0}),i=1;i<len;++i){if(Config.debug&&this.createDebugView(this.payload[i].name,this.payload[i].source).modes({nonvoid:!1}),\"default\"===this.payload[i].name||this.payload[i].args.some((val=>val===result))){success=!0,new Wikifier(this.output,this.payload[i].contents);break}Config.debug&&this.debugView.modes({hidden:!0,invalid:!0})}if(Config.debug){for(++i;i<len;++i)this.createDebugView(this.payload[i].name,this.payload[i].source).modes({nonvoid:!1,hidden:!0,invalid:!0});debugView.modes({nonvoid:!1,hidden:!0,invalid:!success}),this.createDebugView(`/${this.name}`,`<</${this.name}>>`).modes({nonvoid:!1,hidden:!0,invalid:!success})}}}),Macro.add(\"for\",{skipArgs:!0,tags:null,hasRangeRe:new RegExp(`^\\\\S${Patterns.anyChar}*?\\\\s+range\\\\s+\\\\S${Patterns.anyChar}*?$`),rangeRe:new RegExp(`^(?:State\\\\.(variables|temporary)\\\\.(${Patterns.identifier})\\\\s*,\\\\s*)?State\\\\.(variables|temporary)\\\\.(${Patterns.identifier})\\\\s+range\\\\s+(\\\\S${Patterns.anyChar}*?)$`),threePartRe:/^([^;]*?)\\s*;\\s*([^;]*?)\\s*;\\s*([^;]*?)$/,forInRe:/^\\S+\\s+in\\s+\\S+/i,forOfRe:/^\\S+\\s+of\\s+\\S+/i,handler(){const argsStr=this.args.full.trim(),payload=this.payload[0].contents.replace(/\\n$/,\"\");if(0===argsStr.length)this.self.handleFor.call(this,payload,null,!0,null);else if(this.self.hasRangeRe.test(argsStr)){const parts=argsStr.match(this.self.rangeRe);if(null===parts)return this.error(\"invalid range form syntax, format: [index ,] value range collection\");this.self.handleForRange.call(this,payload,{type:parts[1],name:parts[2]},{type:parts[3],name:parts[4]},parts[5])}else{let init,condition,post;if(-1===argsStr.indexOf(\";\")){if(this.self.forInRe.test(argsStr))return this.error(\"invalid syntax, for…in is not supported; see: for…range\");if(this.self.forOfRe.test(argsStr))return this.error(\"invalid syntax, for…of is not supported; see: for…range\");condition=argsStr}else{const parts=argsStr.match(this.self.threePartRe);if(null===parts)return this.error(\"invalid 3-part conditional form syntax, format: [init] ; [condition] ; [post]\");init=parts[1],condition=parts[2].trim(),post=parts[3],0===condition.length&&(condition=!0)}this.self.handleFor.call(this,payload,init,condition,post)}},handleFor(payload,init,condition,post){const evalJavaScript=Scripting.evalJavaScript;let first=!0,safety=Config.macros.maxLoopIterations;Config.debug&&this.debugView.modes({block:!0});try{if(TempState.break=null,init)try{evalJavaScript(init)}catch(ex){return this.error(`bad init expression: ${\"object\"==typeof ex?ex.message:ex}`)}for(;evalJavaScript(condition);){if(Wikifier.stopWikify)return;if(--safety<0)return this.error(`exceeded configured maximum loop iterations (${Config.macros.maxLoopIterations})`);if(new Wikifier(this.output,first?payload.replace(/^\\n/,\"\"):payload),first&&(first=!1),null!=TempState.break)if(1===TempState.break)TempState.break=null;else if(2===TempState.break){TempState.break=null;break}if(post)try{evalJavaScript(post)}catch(ex){return this.error(`bad post expression: ${\"object\"==typeof ex?ex.message:ex}`)}}}catch(ex){return this.error(`bad conditional expression: ${\"object\"==typeof ex?ex.message:ex}`)}finally{TempState.break=null}},handleForRange(payload,indexVar,valueVar,rangeExp){let rangeList,first=!0;try{rangeList=this.self.toRangeList(rangeExp)}catch(ex){return this.error(ex.message)}Config.debug&&this.debugView.modes({block:!0});try{TempState.break=null;for(let i=0;i<rangeList.length;++i)if(indexVar.name&&(State[indexVar.type][indexVar.name]=rangeList[i][0]),State[valueVar.type][valueVar.name]=rangeList[i][1],new Wikifier(this.output,first?payload.replace(/^\\n/,\"\"):payload),first&&(first=!1),null!=TempState.break)if(1===TempState.break)TempState.break=null;else if(2===TempState.break){TempState.break=null;break}}catch(ex){return this.error(\"object\"==typeof ex?ex.message:ex)}finally{TempState.break=null}},toRangeList(rangeExp){const evalJavaScript=Scripting.evalJavaScript;let value,list;try{value=evalJavaScript(\"{\"===rangeExp[0]?`(${rangeExp})`:rangeExp)}catch(ex){if(\"object\"!=typeof ex)throw new Error(`bad range expression: ${ex}`);throw ex.message=`bad range expression: ${ex.message}`,ex}switch(typeof value){case\"string\":list=[];for(let i=0;i<value.length;){const obj=Util.charAndPosAt(value,i);list.push([i,obj.char]),i=1+obj.end}break;case\"object\":if(Array.isArray(value))list=value.map(((val,i)=>[i,val]));else if(value instanceof Set)list=[...value].map(((val,i)=>[i,val]));else if(value instanceof Map)list=[...value.entries()];else{if(\"Object\"!==Util.toStringTag(value))throw new Error(`unsupported range expression type: ${Util.toStringTag(value)}`);list=Object.keys(value).map((key=>[key,value[key]]))}break;default:throw new Error(\"unsupported range expression type: \"+typeof value)}return list}}),Macro.add([\"break\",\"continue\"],{skipArgs:!0,handler(){if(!this.contextHas((ctx=>\"for\"===ctx.name)))return this.error(\"must only be used in conjunction with its parent macro <<for>>\");TempState.break=\"continue\"===this.name?1:2,Config.debug&&this.debugView.modes({hidden:!0})}}),Macro.add([\"button\",\"link\"],{isAsync:!0,tags:null,handler(){if(0===this.args.length)return this.error(`no ${\"button\"===this.name?\"button\":\"link\"} text specified`);const $link=jQuery(document.createElement(\"button\"===this.name?\"button\":\"a\"));let passage;if(\"object\"==typeof this.args[0])if(this.args[0].isImage){const $image=jQuery(document.createElement(\"img\")).attr(\"src\",this.args[0].source).appendTo($link);$link.addClass(\"link-image\"),this.args[0].hasOwnProperty(\"passage\")&&$image.attr(\"data-passage\",this.args[0].passage),this.args[0].hasOwnProperty(\"title\")&&$image.attr(\"title\",this.args[0].title),this.args[0].hasOwnProperty(\"align\")&&$image.attr(\"align\",this.args[0].align),passage=this.args[0].link}else $link.append(document.createTextNode(this.args[0].text)),passage=this.args[0].link;else $link.wikiWithOptions({profile:\"core\"},this.args[0]),passage=this.args.length>1?this.args[1]:undefined;null!=passage?($link.attr(\"data-passage\",passage),Story.has(passage)?($link.addClass(\"link-internal\"),Config.addVisitedLinkClass&&State.hasPlayed(passage)&&$link.addClass(\"link-visited\")):$link.addClass(\"link-broken\")):$link.addClass(\"link-internal\"),$link.addClass(`macro-${this.name}`).ariaClick({namespace:\".macros\",role:null!=passage?\"link\":\"button\",one:null!=passage},this.createShadowWrapper(\"\"!==this.payload[0].contents?()=>Wikifier.wikifyEval(this.payload[0].contents.trim()):null,null!=passage?()=>Engine.play(passage):null)).appendTo(this.output)}}),Macro.add(\"checkbox\",{isAsync:!0,handler(){if(this.args.length<3){const errors=[];return this.args.length<1&&errors.push(\"variable name\"),this.args.length<2&&errors.push(\"unchecked value\"),this.args.length<3&&errors.push(\"checked value\"),this.error(`no ${errors.join(\" or \")} specified`)}if(\"string\"!=typeof this.args[0])return this.error(\"variable name argument is not a string\");const varName=this.args[0].trim();if(\"$\"!==varName[0]&&\"_\"!==varName[0])return this.error(`variable name \"${this.args[0]}\" is missing its sigil ($ or _)`);const varId=Util.slugify(varName),uncheckValue=this.args[1],checkValue=this.args[2],el=document.createElement(\"input\");switch(jQuery(el).attr({id:`${this.name}-${varId}`,name:`${this.name}-${varId}`,type:\"checkbox\",tabindex:0}).addClass(`macro-${this.name}`).on(\"change.macros\",this.createShadowWrapper((function(){State.setVar(varName,this.checked?checkValue:uncheckValue)}))).appendTo(this.output),this.args[3]){case\"autocheck\":State.getVar(varName)===checkValue?el.checked=!0:State.setVar(varName,uncheckValue);break;case\"checked\":el.checked=!0,State.setVar(varName,checkValue);break;default:State.setVar(varName,uncheckValue)}}}),Macro.add([\"cycle\",\"listbox\"],{isAsync:!0,skipArgs:[\"optionsfrom\"],tags:[\"option\",\"optionsfrom\"],handler(){if(0===this.args.length)return this.error(\"no variable name specified\");if(\"string\"!=typeof this.args[0])return this.error(\"variable name argument is not a string\");const varName=this.args[0].trim();if(\"$\"!==varName[0]&&\"_\"!==varName[0])return this.error(`variable name \"${this.args[0]}\" is missing its sigil ($ or _)`);const varId=Util.slugify(varName),len=this.payload.length;if(1===len)return this.error(\"no options specified\");const config={autoselect:!1,once:!1};for(let i=1;i<this.args.length;++i){const arg=this.args[i];switch(arg){case\"once\":config.once=!0;break;case\"autoselect\":config.autoselect=!0;break;default:return this.error(`unknown argument: ${arg}`)}}const options=[],tagCount={option:0,optionsfrom:0};let selectedIdx=-1;for(let i=1;i<len;++i){const payload=this.payload[i];if(\"option\"===payload.name){if(++tagCount.option,0===payload.args.length)return this.error(`no arguments specified for <<${payload.name}>> (#${tagCount.option})`);const option={label:String(payload.args[0])};let isSelected=!1;switch(payload.args.length){case 1:option.value=payload.args[0];break;case 2:\"selected\"===payload.args[1]?(option.value=payload.args[0],isSelected=!0):option.value=payload.args[1];break;default:option.value=payload.args[1],\"selected\"===payload.args[2]&&(isSelected=!0)}if(options.push(option),isSelected){if(config.autoselect)return this.error(\"cannot specify both the autoselect and selected keywords\");if(-1!==selectedIdx)return this.error(`multiple selected keywords specified for <<${payload.name}>> (#${selectedIdx+1} & #${tagCount.option})`);selectedIdx=options.length-1}}else{if(++tagCount.optionsfrom,0===payload.args.full.length)return this.error(`no expression specified for <<${payload.name}>> (#${tagCount.optionsfrom})`);let result;try{const exp=payload.args.full;result=Scripting.evalJavaScript(\"{\"===exp[0]?`(${exp})`:exp)}catch(ex){return this.error(`bad evaluation: ${\"object\"==typeof ex?ex.message:ex}`)}if(\"object\"!=typeof result||null===result)return this.error(`expression must yield a supported collection or generic object (type: ${null===result?\"null\":typeof result})`);if(result instanceof Array||result instanceof Set)result.forEach((val=>options.push({label:String(val),value:val})));else if(result instanceof Map)result.forEach(((val,key)=>options.push({label:String(key),value:val})));else{const oType=Util.toStringTag(result);if(\"Object\"!==oType)return this.error(`expression must yield a supported collection or generic object (object type: ${oType})`);Object.keys(result).forEach((key=>options.push({label:key,value:result[key]})))}}}if(-1===selectedIdx)if(config.autoselect){const sameValueZero=Util.sameValueZero,curValue=State.getVar(varName),curValueIdx=options.findIndex((opt=>sameValueZero(opt.value,curValue)));selectedIdx=-1===curValueIdx?0:curValueIdx}else selectedIdx=0;if(\"cycle\"===this.name){const lastIdx=options.length-1;if(config.once&&selectedIdx===lastIdx)jQuery(this.output).wikiWithOptions({profile:\"core\"},options[selectedIdx].label);else{let cycleIdx=selectedIdx;jQuery(document.createElement(\"a\")).wikiWithOptions({profile:\"core\"},options[selectedIdx].label).attr(\"id\",`${this.name}-${varId}`).addClass(`macro-${this.name}`).ariaClick({namespace:\".macros\",role:\"button\"},this.createShadowWrapper((function(){const $this=$(this);cycleIdx=(cycleIdx+1)%options.length,State.setVar(varName,options[cycleIdx].value),$this.empty().wikiWithOptions({profile:\"core\"},options[cycleIdx].label),config.once&&cycleIdx===lastIdx&&$this.off().contents().unwrap()}))).appendTo(this.output)}}else{const $select=jQuery(document.createElement(\"select\"));options.forEach(((opt,i)=>{jQuery(document.createElement(\"option\")).val(i).text(opt.label).appendTo($select)})),$select.attr({id:`${this.name}-${varId}`,name:`${this.name}-${varId}`,tabindex:0}).addClass(`macro-${this.name}`).val(selectedIdx).on(\"change.macros\",this.createShadowWrapper((function(){State.setVar(varName,options[Number(this.value)].value)}))).appendTo(this.output)}State.setVar(varName,options[selectedIdx].value)}}),Macro.add([\"linkappend\",\"linkprepend\",\"linkreplace\"],{isAsync:!0,tags:null,t8nRe:/^(?:transition|t8n)$/,handler(){if(0===this.args.length)return this.error(\"no link text specified\");const $link=jQuery(document.createElement(\"a\")),$insert=jQuery(document.createElement(\"span\")),transition=this.args.length>1&&this.self.t8nRe.test(this.args[1]);$link.wikiWithOptions({profile:\"core\"},this.args[0]).addClass(`link-internal macro-${this.name}`).ariaClick({namespace:\".macros\",one:!0},this.createShadowWrapper((()=>{if(\"linkreplace\"===this.name?$link.remove():$link.wrap(`<span class=\"macro-${this.name}\"></span>`).replaceWith((()=>$link.html())),\"\"!==this.payload[0].contents){const frag=document.createDocumentFragment();new Wikifier(frag,this.payload[0].contents),$insert.append(frag)}transition&&setTimeout((()=>$insert.removeClass(`macro-${this.name}-in`)),Engine.minDomActionDelay),Links.generate()}))).appendTo(this.output),$insert.addClass(`macro-${this.name}-insert`),transition&&$insert.addClass(`macro-${this.name}-in`),\"linkprepend\"===this.name?$insert.insertBefore($link):$insert.insertAfter($link)}}),Macro.add([\"numberbox\",\"textbox\"],{isAsync:!0,handler(){if(this.args.length<2){const errors=[];return this.args.length<1&&errors.push(\"variable name\"),this.args.length<2&&errors.push(\"default value\"),this.error(`no ${errors.join(\" or \")} specified`)}if(\"string\"!=typeof this.args[0])return this.error(\"variable name argument is not a string\");const varName=this.args[0].trim();if(\"$\"!==varName[0]&&\"_\"!==varName[0])return this.error(`variable name \"${this.args[0]}\" is missing its sigil ($ or _)`);Config.debug&&this.debugView.modes({block:!0});const asNumber=\"numberbox\"===this.name,defaultValue=asNumber?Number(this.args[1]):this.args[1];if(asNumber&&Number.isNaN(defaultValue))return this.error(`default value \"${this.args[1]}\" is neither a number nor can it be parsed into a number`);const varId=Util.slugify(varName),el=document.createElement(\"input\");let passage,autofocus=!1;this.args.length>3?(passage=this.args[2],autofocus=\"autofocus\"===this.args[3]):this.args.length>2&&(\"autofocus\"===this.args[2]?autofocus=!0:passage=this.args[2]),\"object\"==typeof passage&&(passage=passage.link),jQuery(el).attr({id:`${this.name}-${varId}`,name:`${this.name}-${varId}`,type:asNumber?\"number\":\"text\",inputmode:asNumber?\"decimal\":\"text\",tabindex:0}).addClass(`macro-${this.name}`).on(\"change.macros\",this.createShadowWrapper((function(){State.setVar(varName,asNumber?Number(this.value):this.value)}))).on(\"keypress.macros\",this.createShadowWrapper((function(ev){13===ev.which&&(ev.preventDefault(),State.setVar(varName,asNumber?Number(this.value):this.value),null!=passage&&Engine.play(passage))}))).appendTo(this.output),asNumber&&(el.step=\"any\"),State.setVar(varName,defaultValue),el.value=defaultValue,autofocus&&(el.setAttribute(\"autofocus\",\"autofocus\"),postdisplay[`#autofocus:${el.id}`]=task=>{delete postdisplay[task],setTimeout((()=>el.focus()),Engine.minDomActionDelay)})}}),Macro.add(\"radiobutton\",{isAsync:!0,handler(){if(this.args.length<2){const errors=[];return this.args.length<1&&errors.push(\"variable name\"),this.args.length<2&&errors.push(\"checked value\"),this.error(`no ${errors.join(\" or \")} specified`)}if(\"string\"!=typeof this.args[0])return this.error(\"variable name argument is not a string\");const varName=this.args[0].trim();if(\"$\"!==varName[0]&&\"_\"!==varName[0])return this.error(`variable name \"${this.args[0]}\" is missing its sigil ($ or _)`);const varId=Util.slugify(varName),checkValue=this.args[1],el=document.createElement(\"input\");switch(TempState.hasOwnProperty(this.name)||(TempState[this.name]={}),TempState[this.name].hasOwnProperty(varId)||(TempState[this.name][varId]=0),jQuery(el).attr({id:`${this.name}-${varId}-${TempState[this.name][varId]++}`,name:`${this.name}-${varId}`,type:\"radio\",tabindex:0}).addClass(`macro-${this.name}`).on(\"change.macros\",this.createShadowWrapper((function(){this.checked&&State.setVar(varName,checkValue)}))).appendTo(this.output),this.args[2]){case\"autocheck\":State.getVar(varName)===checkValue&&(el.checked=!0);break;case\"checked\":el.checked=!0,State.setVar(varName,checkValue)}}}),Macro.add(\"textarea\",{isAsync:!0,handler(){if(this.args.length<2){const errors=[];return this.args.length<1&&errors.push(\"variable name\"),this.args.length<2&&errors.push(\"default value\"),this.error(`no ${errors.join(\" or \")} specified`)}if(\"string\"!=typeof this.args[0])return this.error(\"variable name argument is not a string\");const varName=this.args[0].trim();if(\"$\"!==varName[0]&&\"_\"!==varName[0])return this.error(`variable name \"${this.args[0]}\" is missing its sigil ($ or _)`);Config.debug&&this.debugView.modes({block:!0});const varId=Util.slugify(varName),defaultValue=this.args[1],autofocus=\"autofocus\"===this.args[2],el=document.createElement(\"textarea\");jQuery(el).attr({id:`${this.name}-${varId}`,name:`${this.name}-${varId}`,rows:4,tabindex:0}).addClass(`macro-${this.name}`).on(\"change.macros\",this.createShadowWrapper((function(){State.setVar(varName,this.value)}))).appendTo(this.output),State.setVar(varName,defaultValue),el.textContent=defaultValue,autofocus&&(el.setAttribute(\"autofocus\",\"autofocus\"),postdisplay[`#autofocus:${el.id}`]=task=>{delete postdisplay[task],setTimeout((()=>el.focus()),Engine.minDomActionDelay)})}}),Macro.add(\"click\",\"link\"),Macro.add(\"actions\",{handler(){const $list=jQuery(document.createElement(\"ul\")).addClass(this.name).appendTo(this.output);for(let i=0;i<this.args.length;++i){let passage,text,$image,setFn;if(\"object\"==typeof this.args[i]?this.args[i].isImage?($image=jQuery(document.createElement(\"img\")).attr(\"src\",this.args[i].source),this.args[i].hasOwnProperty(\"passage\")&&$image.attr(\"data-passage\",this.args[i].passage),this.args[i].hasOwnProperty(\"title\")&&$image.attr(\"title\",this.args[i].title),this.args[i].hasOwnProperty(\"align\")&&$image.attr(\"align\",this.args[i].align),passage=this.args[i].link,setFn=this.args[i].setFn):(text=this.args[i].text,passage=this.args[i].link,setFn=this.args[i].setFn):text=passage=this.args[i],State.variables.hasOwnProperty(\"#actions\")&&State.variables[\"#actions\"].hasOwnProperty(passage)&&State.variables[\"#actions\"][passage])continue;const $link=jQuery(Wikifier.createInternalLink(jQuery(document.createElement(\"li\")).appendTo($list),passage,null,((passage,fn)=>()=>{State.variables.hasOwnProperty(\"#actions\")||(State.variables[\"#actions\"]={}),State.variables[\"#actions\"][passage]=!0,\"function\"==typeof fn&&fn()})(passage,setFn))).addClass(`macro-${this.name}`).append($image||document.createTextNode(text));$image&&$link.addClass(\"link-image\")}}}),Macro.add([\"back\",\"return\"],{handler(){if(this.args.length>1)return this.error(\"too many arguments specified, check the documentation for details\");let passage,text,$image,$link,momentIndex=-1;if(1===this.args.length&&(\"object\"==typeof this.args[0]?this.args[0].isImage?($image=jQuery(document.createElement(\"img\")).attr(\"src\",this.args[0].source),this.args[0].hasOwnProperty(\"passage\")&&$image.attr(\"data-passage\",this.args[0].passage),this.args[0].hasOwnProperty(\"title\")&&$image.attr(\"title\",this.args[0].title),this.args[0].hasOwnProperty(\"align\")&&$image.attr(\"align\",this.args[0].align),this.args[0].hasOwnProperty(\"link\")&&(passage=this.args[0].link)):(1===this.args[0].count||(text=this.args[0].text),passage=this.args[0].link):1===this.args.length&&(text=this.args[0])),null==passage){for(let i=State.length-2;i>=0;--i)if(State.history[i].title!==State.passage){momentIndex=i,passage=State.history[i].title;break}if(null==passage&&\"return\"===this.name)for(let i=State.expired.length-1;i>=0;--i)if(State.expired[i]!==State.passage){passage=State.expired[i];break}}else{if(!Story.has(passage))return this.error(`passage \"${passage}\" does not exist`);if(\"back\"===this.name){for(let i=State.length-2;i>=0;--i)if(State.history[i].title===passage){momentIndex=i;break}if(-1===momentIndex)return this.error(`cannot find passage \"${passage}\" in the current story history`)}}if(null==passage)return this.error(\"cannot find passage\");\"back\"!==this.name||-1!==momentIndex?($link=jQuery(document.createElement(\"a\")).addClass(\"link-internal\").ariaClick({one:!0},\"return\"===this.name?()=>Engine.play(passage):()=>Engine.goTo(momentIndex)),$image&&$link.addClass(\"link-image\")):$link=jQuery(document.createElement(\"span\")).addClass(\"link-disabled\"),$link.addClass(`macro-${this.name}`).append($image||document.createTextNode(text||L10n.get(`macro${this.name.toUpperFirst()}Text`))).appendTo(this.output)}}),Macro.add(\"choice\",{handler(){if(0===this.args.length)return this.error(\"no passage specified\");const choiceId=State.passage;let passage,text,$image,setFn,$link;if(1===this.args.length?\"object\"==typeof this.args[0]?this.args[0].isImage?($image=jQuery(document.createElement(\"img\")).attr(\"src\",this.args[0].source),this.args[0].hasOwnProperty(\"passage\")&&$image.attr(\"data-passage\",this.args[0].passage),this.args[0].hasOwnProperty(\"title\")&&$image.attr(\"title\",this.args[0].title),this.args[0].hasOwnProperty(\"align\")&&$image.attr(\"align\",this.args[0].align),passage=this.args[0].link,setFn=this.args[0].setFn):(text=this.args[0].text,passage=this.args[0].link,setFn=this.args[0].setFn):text=passage=this.args[0]:(passage=this.args[0],text=this.args[1]),State.variables.hasOwnProperty(\"#choice\")&&State.variables[\"#choice\"].hasOwnProperty(choiceId)&&State.variables[\"#choice\"][choiceId])return $link=jQuery(document.createElement(\"span\")).addClass(`link-disabled macro-${this.name}`).attr(\"tabindex\",-1).append($image||document.createTextNode(text)).appendTo(this.output),void($image&&$link.addClass(\"link-image\"));$link=jQuery(Wikifier.createInternalLink(this.output,passage,null,(()=>{State.variables.hasOwnProperty(\"#choice\")||(State.variables[\"#choice\"]={}),State.variables[\"#choice\"][choiceId]=!0,\"function\"==typeof setFn&&setFn()}))).addClass(`macro-${this.name}`).append($image||document.createTextNode(text)),$image&&$link.addClass(\"link-image\")}}),Macro.add([\"addclass\",\"toggleclass\"],{handler(){if(this.args.length<2){const errors=[];return this.args.length<1&&errors.push(\"selector\"),this.args.length<2&&errors.push(\"class names\"),this.error(`no ${errors.join(\" or \")} specified`)}const $targets=jQuery(this.args[0]);if(0===$targets.length)return this.error(`no elements matched the selector \"${this.args[0]}\"`);switch(this.name){case\"addclass\":$targets.addClass(this.args[1].trim());break;case\"toggleclass\":$targets.toggleClass(this.args[1].trim())}Config.debug&&this.debugView.modes({hidden:!0})}}),Macro.add(\"removeclass\",{handler(){if(0===this.args.length)return this.error(\"no selector specified\");const $targets=jQuery(this.args[0]);if(0===$targets.length)return this.error(`no elements matched the selector \"${this.args[0]}\"`);this.args.length>1?$targets.removeClass(this.args[1].trim()):$targets.removeClass(),Config.debug&&this.debugView.modes({hidden:!0})}}),Macro.add(\"copy\",{handler(){if(0===this.args.length)return this.error(\"no selector specified\");const $targets=jQuery(this.args[0]);if(0===$targets.length)return this.error(`no elements matched the selector \"${this.args[0]}\"`);jQuery(this.output).append($targets.html()),Config.debug&&this.debugView.modes({hidden:!0})}}),Macro.add([\"append\",\"prepend\",\"replace\"],{tags:null,t8nRe:/^(?:transition|t8n)$/,handler(){if(0===this.args.length)return this.error(\"no selector specified\");const $targets=jQuery(this.args[0]);if(0===$targets.length)return this.error(`no elements matched the selector \"${this.args[0]}\"`);if(\"\"!==this.payload[0].contents){let $insert;switch(this.args.length>1&&this.self.t8nRe.test(this.args[1])?($insert=jQuery(document.createElement(\"span\")),$insert.addClass(`macro-${this.name}-insert macro-${this.name}-in`),setTimeout((()=>$insert.removeClass(`macro-${this.name}-in`)),Engine.minDomActionDelay)):$insert=jQuery(document.createDocumentFragment()),$insert.wiki(this.payload[0].contents),this.name){case\"replace\":$targets.empty();case\"append\":$targets.append($insert);break;case\"prepend\":$targets.prepend($insert)}}else\"replace\"===this.name&&$targets.empty();Config.debug&&this.debugView.modes({hidden:!0}),Links.generate()}}),Macro.add(\"remove\",{handler(){if(0===this.args.length)return this.error(\"no selector specified\");const $targets=jQuery(this.args[0]);if(0===$targets.length)return this.error(`no elements matched the selector \"${this.args[0]}\"`);$targets.remove(),Config.debug&&this.debugView.modes({hidden:!0})}}),Has.audio){const errorOnePlaybackAction=(cur,prev)=>`only one playback action allowed per invocation, \"${cur}\" cannot be combined with \"${prev}\"`;Macro.add(\"audio\",{handler(){if(this.args.length<2){const errors=[];return this.args.length<1&&errors.push(\"track and/or group IDs\"),this.args.length<2&&errors.push(\"actions\"),this.error(`no ${errors.join(\" or \")} specified`)}let selected;try{selected=SimpleAudio.select(this.args[0])}catch(ex){return this.error(ex.message)}const args=this.args.slice(1);let action,fadeTo,loop,mute,passage,time,volume,fadeOver=5;for(;args.length>0;){const arg=args.shift();let raw;switch(arg){case\"load\":case\"pause\":case\"play\":case\"stop\":case\"unload\":if(action)return this.error(errorOnePlaybackAction(arg,action));action=arg;break;case\"fadein\":if(action)return this.error(errorOnePlaybackAction(arg,action));action=\"fade\",fadeTo=1;break;case\"fadeout\":if(action)return this.error(errorOnePlaybackAction(arg,action));action=\"fade\",fadeTo=0;break;case\"fadeto\":if(action)return this.error(errorOnePlaybackAction(arg,action));if(0===args.length)return this.error(\"fadeto missing required level value\");if(action=\"fade\",raw=args.shift(),fadeTo=Number.parseFloat(raw),Number.isNaN(fadeTo)||!Number.isFinite(fadeTo))return this.error(`cannot parse fadeto: ${raw}`);break;case\"fadeoverto\":if(action)return this.error(errorOnePlaybackAction(arg,action));if(args.length<2){const errors=[];return args.length<1&&errors.push(\"seconds\"),args.length<2&&errors.push(\"level\"),this.error(`fadeoverto missing required ${errors.join(\" and \")} value${errors.length>1?\"s\":\"\"}`)}if(action=\"fade\",raw=args.shift(),fadeOver=Number.parseFloat(raw),Number.isNaN(fadeOver)||!Number.isFinite(fadeOver))return this.error(`cannot parse fadeoverto: ${raw}`);if(raw=args.shift(),fadeTo=Number.parseFloat(raw),Number.isNaN(fadeTo)||!Number.isFinite(fadeTo))return this.error(`cannot parse fadeoverto: ${raw}`);break;case\"volume\":if(0===args.length)return this.error(\"volume missing required level value\");if(raw=args.shift(),volume=Number.parseFloat(raw),Number.isNaN(volume)||!Number.isFinite(volume))return this.error(`cannot parse volume: ${raw}`);break;case\"mute\":case\"unmute\":mute=\"mute\"===arg;break;case\"time\":if(0===args.length)return this.error(\"time missing required seconds value\");if(raw=args.shift(),time=Number.parseFloat(raw),Number.isNaN(time)||!Number.isFinite(time))return this.error(`cannot parse time: ${raw}`);break;case\"loop\":case\"unloop\":loop=\"loop\"===arg;break;case\"goto\":if(0===args.length)return this.error(\"goto missing required passage title\");if(raw=args.shift(),passage=\"object\"==typeof raw?raw.link:raw,!Story.has(passage))return this.error(`passage \"${passage}\" does not exist`);break;default:return this.error(`unknown action: ${arg}`)}}try{if(null!=volume&&selected.volume(volume),null!=time&&selected.time(time),null!=mute&&selected.mute(mute),null!=loop&&selected.loop(loop),null!=passage){const nsEnded=`ended.macros.macro-${this.name}_goto`;selected.off(nsEnded).one(nsEnded,(()=>{selected.off(nsEnded),Engine.play(passage)}))}switch(action){case\"fade\":selected.fade(fadeOver,fadeTo);break;case\"load\":selected.load();break;case\"pause\":selected.pause();break;case\"play\":selected.playWhenAllowed();break;case\"stop\":selected.stop();break;case\"unload\":selected.unload()}Config.debug&&this.debugView.modes({hidden:!0})}catch(ex){return this.error(`error executing action: ${ex.message}`)}}}),Macro.add(\"cacheaudio\",{handler(){if(this.args.length<2){const errors=[];return this.args.length<1&&errors.push(\"track ID\"),this.args.length<2&&errors.push(\"sources\"),this.error(`no ${errors.join(\" or \")} specified`)}const id=String(this.args[0]).trim(),oldFmtRe=/^format:\\s*([\\w-]+)\\s*;\\s*/i;try{SimpleAudio.tracks.add(id,this.args.slice(1).map((source=>{if(oldFmtRe.test(source)){if(Config.debug)return this.error(`track ID \"${id}\": format specifier migration required, \"format:formatId;\" → \"formatId|\"`);source=source.replace(oldFmtRe,\"$1|\")}return source})))}catch(ex){return this.error(ex.message)}if(Config.debug&&!SimpleAudio.tracks.get(id).hasSource())return this.error(`track ID \"${id}\": no supported audio sources found`);Config.debug&&this.debugView.modes({hidden:!0})}}),Macro.add(\"createaudiogroup\",{tags:[\"track\"],handler(){if(0===this.args.length)return this.error(\"no group ID specified\");if(1===this.payload.length)return this.error(\"no tracks defined via <<track>>\");Config.debug&&this.debugView.modes({nonvoid:!1,hidden:!0});const groupId=String(this.args[0]).trim(),trackIds=[];for(let i=1,len=this.payload.length;i<len;++i){if(this.payload[i].args.length<1)return this.error(\"no track ID specified\");trackIds.push(String(this.payload[i].args[0]).trim()),Config.debug&&this.createDebugView(this.payload[i].name,this.payload[i].source).modes({nonvoid:!1,hidden:!0})}try{SimpleAudio.groups.add(groupId,trackIds)}catch(ex){return this.error(ex.message)}Config.debug&&this.createDebugView(`/${this.name}`,`<</${this.name}>>`).modes({nonvoid:!1,hidden:!0})}}),Macro.add(\"createplaylist\",{tags:[\"track\"],handler(){if(0===this.args.length)return this.error(\"no list ID specified\");if(1===this.payload.length)return this.error(\"no tracks defined via <<track>>\");const playlist=Macro.get(\"playlist\");if(null!==playlist.from&&\"createplaylist\"!==playlist.from)return this.error(\"a playlist has already been defined with <<setplaylist>>\");Config.debug&&this.debugView.modes({nonvoid:!1,hidden:!0});const listId=String(this.args[0]).trim(),trackObjs=[];for(let i=1,len=this.payload.length;i<len;++i){if(0===this.payload[i].args.length)return this.error(\"no track ID specified\");const trackObj={id:String(this.payload[i].args[0]).trim()},args=this.payload[i].args.slice(1);for(;args.length>0;){const arg=args.shift();let raw,parsed;switch(arg){case\"copy\":case\"own\":trackObj.own=!0;break;case\"rate\":args.length>0&&args.shift();break;case\"volume\":if(0===args.length)return this.error(\"volume missing required level value\");if(raw=args.shift(),parsed=Number.parseFloat(raw),Number.isNaN(parsed)||!Number.isFinite(parsed))return this.error(`cannot parse volume: ${raw}`);trackObj.volume=parsed;break;default:return this.error(`unknown action: ${arg}`)}}trackObjs.push(trackObj),Config.debug&&this.createDebugView(this.payload[i].name,this.payload[i].source).modes({nonvoid:!1,hidden:!0})}try{SimpleAudio.lists.add(listId,trackObjs)}catch(ex){return this.error(ex.message)}null===playlist.from&&(playlist.from=\"createplaylist\"),Config.debug&&this.createDebugView(`/${this.name}`,`<</${this.name}>>`).modes({nonvoid:!1,hidden:!0})}}),Macro.add(\"masteraudio\",{handler(){if(0===this.args.length)return this.error(\"no actions specified\");const args=this.args.slice(0);let action,mute,muteOnHide,volume;for(;args.length>0;){const arg=args.shift();let raw;switch(arg){case\"load\":case\"stop\":case\"unload\":if(action)return this.error(errorOnePlaybackAction(arg,action));action=arg;break;case\"mute\":case\"unmute\":mute=\"mute\"===arg;break;case\"muteonhide\":case\"nomuteonhide\":muteOnHide=\"muteonhide\"===arg;break;case\"volume\":if(0===args.length)return this.error(\"volume missing required level value\");if(raw=args.shift(),volume=Number.parseFloat(raw),Number.isNaN(volume)||!Number.isFinite(volume))return this.error(`cannot parse volume: ${raw}`);break;default:return this.error(`unknown action: ${arg}`)}}try{switch(null!=mute&&SimpleAudio.mute(mute),null!=muteOnHide&&SimpleAudio.muteOnHidden(muteOnHide),null!=volume&&SimpleAudio.volume(volume),action){case\"load\":SimpleAudio.load();break;case\"stop\":SimpleAudio.stop();break;case\"unload\":SimpleAudio.unload()}Config.debug&&this.debugView.modes({hidden:!0})}catch(ex){return this.error(`error executing action: ${ex.message}`)}}}),Macro.add(\"playlist\",{from:null,handler(){const from=this.self.from;if(null===from)return this.error(\"no playlists have been created\");let list,args,action;if(\"createplaylist\"===from){if(this.args.length<2){const errors=[];return this.args.length<1&&errors.push(\"list ID\"),this.args.length<2&&errors.push(\"actions\"),this.error(`no ${errors.join(\" or \")} specified`)}const id=String(this.args[0]).trim();if(!SimpleAudio.lists.has(id))return this.error(`playlist \"${id}\" does not exist`);list=SimpleAudio.lists.get(id),args=this.args.slice(1)}else{if(0===this.args.length)return this.error(\"no actions specified\");list=SimpleAudio.lists.get(\"setplaylist\"),args=this.args.slice(0)}let fadeTo,loop,mute,shuffle,volume,fadeOver=5;for(;args.length>0;){const arg=args.shift();let raw;switch(arg){case\"load\":case\"pause\":case\"play\":case\"skip\":case\"stop\":case\"unload\":if(action)return this.error(errorOnePlaybackAction(arg,action));action=arg;break;case\"fadein\":if(action)return this.error(errorOnePlaybackAction(arg,action));action=\"fade\",fadeTo=1;break;case\"fadeout\":if(action)return this.error(errorOnePlaybackAction(arg,action));action=\"fade\",fadeTo=0;break;case\"fadeto\":if(action)return this.error(errorOnePlaybackAction(arg,action));if(0===args.length)return this.error(\"fadeto missing required level value\");if(action=\"fade\",raw=args.shift(),fadeTo=Number.parseFloat(raw),Number.isNaN(fadeTo)||!Number.isFinite(fadeTo))return this.error(`cannot parse fadeto: ${raw}`);break;case\"fadeoverto\":if(action)return this.error(errorOnePlaybackAction(arg,action));if(args.length<2){const errors=[];return args.length<1&&errors.push(\"seconds\"),args.length<2&&errors.push(\"level\"),this.error(`fadeoverto missing required ${errors.join(\" and \")} value${errors.length>1?\"s\":\"\"}`)}if(action=\"fade\",raw=args.shift(),fadeOver=Number.parseFloat(raw),Number.isNaN(fadeOver)||!Number.isFinite(fadeOver))return this.error(`cannot parse fadeoverto: ${raw}`);if(raw=args.shift(),fadeTo=Number.parseFloat(raw),Number.isNaN(fadeTo)||!Number.isFinite(fadeTo))return this.error(`cannot parse fadeoverto: ${raw}`);break;case\"volume\":if(0===args.length)return this.error(\"volume missing required level value\");if(raw=args.shift(),volume=Number.parseFloat(raw),Number.isNaN(volume)||!Number.isFinite(volume))return this.error(`cannot parse volume: ${raw}`);break;case\"mute\":case\"unmute\":mute=\"mute\"===arg;break;case\"loop\":case\"unloop\":loop=\"loop\"===arg;break;case\"shuffle\":case\"unshuffle\":shuffle=\"shuffle\"===arg;break;default:return this.error(`unknown action: ${arg}`)}}try{switch(null!=volume&&list.volume(volume),null!=mute&&list.mute(mute),null!=loop&&list.loop(loop),null!=shuffle&&list.shuffle(shuffle),action){case\"fade\":list.fade(fadeOver,fadeTo);break;case\"load\":list.load();break;case\"pause\":list.pause();break;case\"play\":list.playWhenAllowed();break;case\"skip\":list.skip();break;case\"stop\":list.stop();break;case\"unload\":list.unload()}Config.debug&&this.debugView.modes({hidden:!0})}catch(ex){return this.error(`error executing action: ${ex.message}`)}}}),Macro.add(\"removeaudiogroup\",{handler(){if(0===this.args.length)return this.error(\"no group ID specified\");const id=String(this.args[0]).trim();if(!SimpleAudio.groups.has(id))return this.error(`group \"${id}\" does not exist`);SimpleAudio.groups.delete(id),Config.debug&&this.debugView.modes({hidden:!0})}}),Macro.add(\"removeplaylist\",{handler(){if(0===this.args.length)return this.error(\"no list ID specified\");const id=String(this.args[0]).trim();if(!SimpleAudio.lists.has(id))return this.error(`playlist \"${id}\" does not exist`);SimpleAudio.lists.delete(id),Config.debug&&this.debugView.modes({hidden:!0})}}),Macro.add(\"waitforaudio\",{skipArgs:!0,handler(){SimpleAudio.loadWithScreen()}}),Macro.add(\"setplaylist\",{handler(){if(0===this.args.length)return this.error(\"no track ID(s) specified\");const playlist=Macro.get(\"playlist\");if(null!==playlist.from&&\"setplaylist\"!==playlist.from)return this.error(\"playlists have already been defined with <<createplaylist>>\");try{SimpleAudio.lists.add(\"setplaylist\",this.args.slice(0))}catch(ex){return this.error(ex.message)}null===playlist.from&&(playlist.from=\"setplaylist\"),Config.debug&&this.debugView.modes({hidden:!0})}}),Macro.add(\"stopallaudio\",{skipArgs:!0,handler(){SimpleAudio.select(\":all\").stop(),Config.debug&&this.debugView.modes({hidden:!0})}})}else Macro.add([\"audio\",\"cacheaudio\",\"createaudiogroup\",\"createplaylist\",\"masteraudio\",\"playlist\",\"removeaudiogroup\",\"removeplaylist\",\"waitforaudio\",\"setplaylist\",\"stopallaudio\"],{skipArgs:!0,handler(){Config.debug&&this.debugView.modes({hidden:!0})}});Macro.add(\"done\",{skipArgs:!0,tags:null,handler(){const contents=this.payload[0].contents.trim();\"\"!==contents&&setTimeout(this.createShadowWrapper((()=>$.wiki(contents))),Engine.minDomActionDelay)}}),Macro.add(\"goto\",{handler(){if(0===this.args.length)return this.error(\"no passage specified\");let passage;if(passage=\"object\"==typeof this.args[0]?this.args[0].link:this.args[0],!Story.has(passage))return this.error(`passage \"${passage}\" does not exist`);Wikifier.stopWikify=2,setTimeout((()=>Engine.play(passage)),Engine.minDomActionDelay)}}),Macro.add(\"repeat\",{isAsync:!0,tags:null,timers:new Set,t8nRe:/^(?:transition|t8n)$/,handler(){if(0===this.args.length)return this.error(\"no time value specified\");let delay;try{delay=Math.max(Engine.minDomActionDelay,Util.fromCssTime(this.args[0]))}catch(ex){return this.error(ex.message)}Config.debug&&this.debugView.modes({block:!0});const transition=this.args.length>1&&this.self.t8nRe.test(this.args[1]),$wrapper=jQuery(document.createElement(\"span\")).addClass(`macro-${this.name}`).appendTo(this.output);this.self.registerInterval(this.createShadowWrapper((()=>{const frag=document.createDocumentFragment();new Wikifier(frag,this.payload[0].contents);let $output=$wrapper;transition&&($output=jQuery(document.createElement(\"span\")).addClass(\"macro-repeat-insert macro-repeat-in\").appendTo($output)),$output.append(frag),transition&&setTimeout((()=>$output.removeClass(\"macro-repeat-in\")),Engine.minDomActionDelay)})),delay)},registerInterval(callback,delay){if(\"function\"!=typeof callback)throw new TypeError(\"callback parameter must be a function\");const passage=State.passage,turn=State.turns,timers=this.timers;let timerId=null;timerId=setInterval((()=>{if(State.passage!==passage||State.turns!==turn)return clearInterval(timerId),void timers.delete(timerId);let timerIdCache;try{TempState.break=null,TempState.hasOwnProperty(\"repeatTimerId\")&&(timerIdCache=TempState.repeatTimerId),TempState.repeatTimerId=timerId,callback.call(this)}finally{void 0!==timerIdCache?TempState.repeatTimerId=timerIdCache:delete TempState.repeatTimerId,TempState.break=null}}),delay),timers.add(timerId),prehistory.hasOwnProperty(\"#repeat-timers-cleanup\")||(prehistory[\"#repeat-timers-cleanup\"]=task=>{delete prehistory[task],timers.forEach((timerId=>clearInterval(timerId))),timers.clear()})}}),Macro.add(\"stop\",{skipArgs:!0,handler(){if(!TempState.hasOwnProperty(\"repeatTimerId\"))return this.error(\"must only be used in conjunction with its parent macro <<repeat>>\");const timers=Macro.get(\"repeat\").timers,timerId=TempState.repeatTimerId;clearInterval(timerId),timers.delete(timerId),TempState.break=2,Config.debug&&this.debugView.modes({hidden:!0})}}),Macro.add(\"timed\",{isAsync:!0,tags:[\"next\"],timers:new Set,t8nRe:/^(?:transition|t8n)$/,handler(){if(0===this.args.length)return this.error(\"no time value specified in <<timed>>\");const items=[];try{items.push({name:this.name,source:this.source,delay:Math.max(Engine.minDomActionDelay,Util.fromCssTime(this.args[0])),content:this.payload[0].contents})}catch(ex){return this.error(`${ex.message} in <<timed>>`)}if(this.payload.length>1){let i;try{let len;for(i=1,len=this.payload.length;i<len;++i)items.push({name:this.payload[i].name,source:this.payload[i].source,delay:0===this.payload[i].args.length?items[items.length-1].delay:Math.max(Engine.minDomActionDelay,Util.fromCssTime(this.payload[i].args[0])),content:this.payload[i].contents})}catch(ex){return this.error(`${ex.message} in <<next>> (#${i})`)}}Config.debug&&this.debugView.modes({block:!0});const transition=this.args.length>1&&this.self.t8nRe.test(this.args[1]),$wrapper=jQuery(document.createElement(\"span\")).addClass(`macro-${this.name}`).appendTo(this.output);this.self.registerTimeout(this.createShadowWrapper((item=>{const frag=document.createDocumentFragment();new Wikifier(frag,item.content);let $output=$wrapper;Config.debug&&\"next\"===item.name&&($output=jQuery(new DebugView($output[0],\"macro\",item.name,item.source).output)),transition&&($output=jQuery(document.createElement(\"span\")).addClass(\"macro-timed-insert macro-timed-in\").appendTo($output)),$output.append(frag),transition&&setTimeout((()=>$output.removeClass(\"macro-timed-in\")),Engine.minDomActionDelay)})),items)},registerTimeout(callback,items){if(\"function\"!=typeof callback)throw new TypeError(\"callback parameter must be a function\");const passage=State.passage,turn=State.turns,timers=this.timers;let timerId=null,nextItem=items.shift();const worker=function(){if(timers.delete(timerId),State.passage!==passage||State.turns!==turn)return;const curItem=nextItem;null!=(nextItem=items.shift())&&(timerId=setTimeout(worker,nextItem.delay),timers.add(timerId)),callback.call(this,curItem)};timerId=setTimeout(worker,nextItem.delay),timers.add(timerId),prehistory.hasOwnProperty(\"#timed-timers-cleanup\")||(prehistory[\"#timed-timers-cleanup\"]=task=>{delete prehistory[task],timers.forEach((timerId=>clearTimeout(timerId))),timers.clear()})}}),Macro.add(\"widget\",{tags:null,handler(){if(0===this.args.length)return this.error(\"no widget name specified\");const widgetName=this.args[0],isNonVoid=this.args.length>1&&\"container\"===this.args[1];if(Macro.has(widgetName)){if(!Macro.get(widgetName).isWidget)return this.error(`cannot clobber existing macro \"${widgetName}\"`);Macro.delete(widgetName)}try{const widgetDef={isWidget:!0,handler:(widgetCode=this.payload[0].contents,function(){const shadowStore={};State.temporary.hasOwnProperty(\"args\")&&(shadowStore._args=State.temporary.args),State.temporary.args=[...this.args],State.temporary.args.raw=this.args.raw,State.temporary.args.full=this.args.full,this.addShadow(\"_args\"),isNonVoid&&(State.temporary.hasOwnProperty(\"contents\")&&(shadowStore._contents=State.temporary.contents),State.temporary.contents=this.payload[0].contents,this.addShadow(\"_contents\")),State.variables.hasOwnProperty(\"args\")&&(shadowStore.$args=State.variables.args),State.variables.args=State.temporary.args,this.addShadow(\"$args\");try{const resFrag=document.createDocumentFragment(),errList=[];if(new Wikifier(resFrag,widgetCode),Array.from(resFrag.querySelectorAll(\".error\")).forEach((errEl=>{errList.push(errEl.textContent)})),0!==errList.length)return this.error(`error${errList.length>1?\"s\":\"\"} within widget code (${errList.join(\"; \")})`);this.output.appendChild(resFrag)}catch(ex){return this.error(`cannot execute widget: ${ex.message}`)}finally{shadowStore.hasOwnProperty(\"_args\")?State.temporary.args=shadowStore._args:delete State.temporary.args,isNonVoid&&(shadowStore.hasOwnProperty(\"_contents\")?State.temporary.contents=shadowStore._contents:delete State.temporary.contents),shadowStore.hasOwnProperty(\"$args\")?State.variables.args=shadowStore.$args:delete State.variables.args}})};isNonVoid&&(widgetDef.tags=[]),Macro.add(widgetName,widgetDef),Config.debug&&this.debugView.modes({hidden:!0})}catch(ex){return this.error(`cannot create widget macro \"${widgetName}\": ${ex.message}`)}var widgetCode}}),Macro.add([\"exit\",\"exitAll\"],{handler(){Wikifier.stopWikify=\"exit\"===this.name?1:2}})})();var getTypeOf=(()=>{const toString=Object.prototype.toString,slice=String.prototype.slice;return function(O){if(null===O)return\"null\";const baseType=typeof O;return\"object\"===baseType?slice.call(toString.call(O),8,-1):baseType}})(),Dialog=(()=>{const DEFAULT_TOP=50;let $overlay=null,$dialog=null,$title=null,$body=null,lastActive=null,observer=null,onCloseFn=null,scrollbarWidth=0;function calcInset(top){const $window=jQuery(window),inset={left:\"\",right:\"\",top:\"\",bottom:\"\"};$dialog.css(inset);let horzSpace=$window.width()-$dialog.outerWidth(!0)-1,vertSpace=$window.height()-$dialog.outerHeight(!0)-1;if(horzSpace<=20+scrollbarWidth&&(vertSpace-=scrollbarWidth),vertSpace<=20+scrollbarWidth&&(horzSpace-=scrollbarWidth),inset.left=inset.right=horzSpace<=20?\"10px\":(horzSpace/2|0)+\"px\",vertSpace<=20)inset.top=inset.bottom=\"10px\";else{const vertPos=vertSpace/2|0;inset.top=vertPos>top?top+\"px\":inset.bottom=vertPos+\"px\"}return inset}function onResize(top){\"block\"===$dialog.css(\"display\")&&$dialog.css(calcInset(null!=top?top:DEFAULT_TOP))}function close(ev){if($body.trigger(\":dialogclosing\"),jQuery(document).off(\".dialog-close\"),observer?(observer.disconnect(),observer=null):$body.off(\".dialog-resize\"),jQuery(window).off(\".dialog-resize\"),$dialog.removeClass(\"open\").css({left:\"\",right:\"\",top:\"\",bottom:\"\"}),jQuery(\"#ui-bar,#story\").find(\"[tabindex=-2]\").removeAttr(\"aria-hidden\").attr(\"tabindex\",0),jQuery(\"body>[tabindex=-3]\").removeAttr(\"aria-hidden\").removeAttr(\"tabindex\"),$overlay.removeClass(\"open\"),jQuery(document.documentElement).removeAttr(\"data-dialog\"),$title.empty(),$body.empty().removeClass(),lastActive&&(lastActive.focus(),lastActive=null),onCloseFn)try{onCloseFn(ev)}finally{onCloseFn=null}return $body.trigger(\":dialogclose\"),$body.trigger(\":dialogclosed\"),Dialog}function create(title,classNames){return $title.empty().append((null!=title?String(title):\"\")||\" \"),$body.empty().removeClass(),null!=classNames&&$body.addClass(classNames),Dialog}function getBody(){return $body.get(0)}function isOpen(classNames){return $dialog.hasClass(\"open\")&&(!classNames||classNames.splitOrEmpty(/\\s+/).every((cn=>$body.hasClass(cn))))}function wiki(...args){return $body.wiki(...args),Dialog}return Object.preventExtensions(Object.create(null,{append:{value:function(...args){return $body.append(...args),Dialog}},body:{value:getBody},close:{value:close},create:{value:create},empty:{value:function(){return $body.empty(),Dialog}},init:{value:function(){if(document.getElementById(\"ui-dialog\"))return;scrollbarWidth=(()=>{let calcWidth;try{const inner=document.createElement(\"p\");inner.style.width=\"100%\",inner.style.height=\"200px\";const outer=document.createElement(\"div\");outer.style.position=\"absolute\",outer.style.left=\"0\",outer.style.top=\"0\",outer.style.width=\"100px\",outer.style.height=\"100px\",outer.style.visibility=\"hidden\",outer.style.overflow=\"hidden\",outer.appendChild(inner),document.body.appendChild(outer);const w1=inner.offsetWidth;outer.style.overflow=\"auto\";let w2=inner.offsetWidth;w1===w2&&(w2=outer.clientWidth),document.body.removeChild(outer),calcWidth=w1-w2}catch(ex){}return calcWidth||17})();const $elems=jQuery(document.createDocumentFragment()).append(`<div id=\"ui-overlay\" class=\"ui-close\"></div><div id=\"ui-dialog\" tabindex=\"0\" role=\"dialog\" aria-labelledby=\"ui-dialog-title\" aria-modal=\"true\"><div id=\"ui-dialog-titlebar\"><h1 id=\"ui-dialog-title\"></h1><button id=\"ui-dialog-close\" class=\"ui-close\" tabindex=\"0\" aria-label=\"${L10n.get(\"textClose\")}\"></button></div><div id=\"ui-dialog-body\"></div></div>`);$overlay=jQuery($elems.find(\"#ui-overlay\").get(0)),$dialog=jQuery($elems.find(\"#ui-dialog\").get(0)),$title=jQuery($elems.find(\"#ui-dialog-title\").get(0)),$body=jQuery($elems.find(\"#ui-dialog-body\").get(0)),$elems.insertBefore(\"body>script#script-sugarcube\")}},isOpen:{value:isOpen},open:{value:function(options,onClose){const{top:top}=Object.assign({top:DEFAULT_TOP},options);if(null!=onClose){const closeType=getTypeOf(onClose);if(\"function\"!==closeType)throw new TypeError(`Dialog.open onClose parameter must be a function (received: ${closeType})`);onCloseFn=onClose}else onCloseFn=null;$body.trigger(\":dialogopening\"),isOpen()||(lastActive=document.activeElement||null),jQuery(document.documentElement).attr(\"data-dialog\",\"open\"),$overlay.addClass(\"open\"),jQuery(\"body>:not(script,#store-area,tw-storydata,#ui-bar,#ui-overlay,#ui-dialog)\").attr(\"tabindex\",-3).attr(\"aria-hidden\",!0),jQuery(\"#ui-bar,#story\").find(\"[tabindex]:not([tabindex^=-])\").attr(\"tabindex\",-2).attr(\"aria-hidden\",!0);const resizeHandler=jQuery.throttle(40,(()=>onResize(top)));return $body.imagesLoaded().always(resizeHandler),$dialog.css(calcInset(top)).addClass(\"open\").focus(),jQuery(window).off(\".dialog-resize\").on(\"resize.dialog-resize\",resizeHandler),Has.mutationObserver?(observer=new MutationObserver((mutations=>{for(let i=0;i<mutations.length;++i)if(\"childList\"===mutations[i].type){$body.imagesLoaded().always(resizeHandler),resizeHandler();break}})),observer.observe(getBody(),{childList:!0,subtree:!0})):$body.off(\".dialog-resize\").on(\"DOMNodeInserted.dialog-resize DOMNodeRemoved.dialog-resize\",(()=>{$body.imagesLoaded().always(resizeHandler),resizeHandler()})),jQuery(document).off(\".dialog-close\").one(\"click.dialog-close\",\".ui-close\",(ev=>{close(ev)})).one(\"keypress.dialog-close\",\".ui-close\",(function(ev){13!==ev.which&&32!==ev.which||jQuery(this).trigger(\"click\")})),$body.trigger(\":dialogopen\"),$body.trigger(\":dialogopened\"),Dialog}},resize:{value:function(options){return onResize(\"object\"==typeof options?options.top:undefined)}},wiki:{value:wiki},wikiPassage:{value:function(name){return wiki(Story.get(name).processText())}},setup:{value:function(title,classNames){return create(title,classNames),getBody()}}}))})(),Engine=(()=>{const States=Util.toEnum({Idle:\"idle\",Playing:\"playing\",Rendering:\"rendering\"}),minDomActionDelay=40,_initDebugViews=[];let _state=States.Idle,_lastPlay=null,_outlinePatch=null,_updating=null;function engineGo(offset){const succeded=State.go(offset);return succeded&&engineShow(),succeded}function engineShow(){return enginePlay(State.passage,!0)}function enginePlay(title,noHistory){let passageReadyOutput,passageDoneOutput,passageTitle=title;if(_state=States.Playing,TempState={},State.clearTemporary(),\"function\"==typeof Config.navigation.override)try{const overrideTitle=Config.navigation.override(passageTitle);overrideTitle&&(passageTitle=overrideTitle)}catch(ex){}const passage=Story.get(passageTitle);if(jQuery.event.trigger({type:\":passageinit\",passage:passage}),Object.keys(prehistory).forEach((task=>{\"function\"==typeof prehistory[task]&&prehistory[task].call(passage,task)})),noHistory||State.create(passage.title),document.body.className&&(document.body.className=\"\"),_lastPlay=Util.now(),Object.keys(predisplay).forEach((task=>{\"function\"==typeof predisplay[task]&&predisplay[task].call(passage,task)})),Story.has(\"PassageReady\"))try{passageReadyOutput=Wikifier.wikifyEval(Story.get(\"PassageReady\").text)}catch(ex){console.error(ex),Alert.error(\"PassageReady\",ex.message)}_state=States.Rendering;const dataTags=passage.tags.length>0?passage.tags.join(\" \"):null,passageEl=document.createElement(\"div\");jQuery(passageEl).attr({id:passage.domId,\"data-passage\":passage.title,\"data-tags\":dataTags}).addClass(`passage ${passage.className}`),jQuery(document.body).attr(\"data-tags\",dataTags).addClass(passage.className),jQuery(document.documentElement).attr(\"data-tags\",dataTags),jQuery.event.trigger({type:\":passagestart\",content:passageEl,passage:passage}),Object.keys(prerender).forEach((task=>{\"function\"==typeof prerender[task]&&prerender[task].call(passage,passageEl,task)})),Story.has(\"PassageHeader\")&&new Wikifier(passageEl,Story.get(\"PassageHeader\").processText()),passageEl.appendChild(passage.render()),Story.has(\"PassageFooter\")&&new Wikifier(passageEl,Story.get(\"PassageFooter\").processText()),jQuery.event.trigger({type:\":passagerender\",content:passageEl,passage:passage}),Object.keys(postrender).forEach((task=>{\"function\"==typeof postrender[task]&&postrender[task].call(passage,passageEl,task)}));const containerEl=document.getElementById(\"passages\");if(containerEl.hasChildNodes()&&(\"number\"==typeof Config.passages.transitionOut||\"string\"==typeof Config.passages.transitionOut&&\"\"!==Config.passages.transitionOut&&Has.transitionEndEvent?[...containerEl.childNodes].forEach((outgoing=>{const $outgoing=jQuery(outgoing);if(outgoing.nodeType===Node.ELEMENT_NODE&&$outgoing.hasClass(\"passage\")){if($outgoing.hasClass(\"passage-out\"))return;$outgoing.attr({id:`out-${$outgoing.attr(\"id\")}`,\"aria-live\":\"off\"}).addClass(\"passage-out\"),\"string\"==typeof Config.passages.transitionOut?$outgoing.on(Has.transitionEndEvent,(ev=>{ev.propertyName===Config.passages.transitionOut&&$outgoing.remove()})):setTimeout((()=>$outgoing.remove()),Math.max(minDomActionDelay,Config.passages.transitionOut))}else $outgoing.remove()})):jQuery(containerEl).empty()),jQuery(passageEl).addClass(\"passage-in\").appendTo(containerEl),setTimeout((()=>jQuery(passageEl).removeClass(\"passage-in\")),minDomActionDelay),Story.has(\"StoryDisplayTitle\")?null===_updating&&Config.ui.updateStoryElements||setDisplayTitle(Story.get(\"StoryDisplayTitle\").processText()):Config.passages.displayTitles&&passage.title!==Config.passages.start&&(document.title=`${passage.title} | ${Story.title}`),window.scroll(0,0),_state=States.Playing,Story.has(\"PassageDone\"))try{passageDoneOutput=Wikifier.wikifyEval(Story.get(\"PassageDone\").text)}catch(ex){console.error(ex),Alert.error(\"PassageDone\",ex.message)}if(jQuery.event.trigger({type:\":passagedisplay\",content:passageEl,passage:passage}),Object.keys(postdisplay).forEach((task=>{\"function\"==typeof postdisplay[task]&&postdisplay[task].call(passage,task)})),null!==_updating?_updating.forEach((pair=>{jQuery(pair.element).empty(),new Wikifier(pair.element,Story.get(pair.passage).processText().trim())})):Config.ui.updateStoryElements&&UIBar.update(),Config.debug){let debugView;null!=passageReadyOutput&&(debugView=new DebugView(document.createDocumentFragment(),\"special\",\"PassageReady\",\"PassageReady\"),debugView.modes({hidden:!0}),debugView.append(passageReadyOutput),jQuery(passageEl).prepend(debugView.output)),null!=passageDoneOutput&&(debugView=new DebugView(document.createDocumentFragment(),\"special\",\"PassageDone\",\"PassageDone\"),debugView.modes({hidden:!0}),debugView.append(passageDoneOutput),jQuery(passageEl).append(debugView.output)),1===State.turns&&_initDebugViews.length>0&&jQuery(passageEl).prepend(_initDebugViews)}switch(jQuery(\"#story\").find(\"a[href]:not(.link-external)\").addClass(\"link-external\").end().find(\"a,link,button,input,select,textarea\").not(\"[tabindex]\").attr(\"tabindex\",0),typeof Config.saves.autosave){case\"boolean\":Config.saves.autosave&&Save.autosave.save();break;case\"object\":passage.tags.some((tag=>Config.saves.autosave.includes(tag)))&&Save.autosave.save();break;case\"function\":Config.saves.autosave()&&Save.autosave.save()}return jQuery.event.trigger({type:\":passageend\",content:passageEl,passage:passage}),_state=States.Idle,_lastPlay=Util.now(),passageEl}function _hideOutlines(){_outlinePatch.set(\"*:focus{outline:none;}\")}return Object.freeze(Object.defineProperties({},{States:{value:States},minDomActionDelay:{value:minDomActionDelay},init:{value:function(){let _lastOutlineEvent;jQuery(\"#init-no-js,#init-lacking\").remove(),(()=>{const $elems=jQuery(document.createDocumentFragment()),markup=Story.has(\"StoryInterface\")&&Story.get(\"StoryInterface\").text.trim();if(markup){UIBar.destroy(),jQuery(document.head).find(\"#style-core-display\").remove(),$elems.append(markup);const $passages=$elems.find(\"#passages\");if(0===$passages.length)throw new Error('no element with ID \"passages\" found within \"StoryInterface\" special passage');$passages.empty().not(\"[aria-live]\").attr(\"aria-live\",\"polite\").end(),$elems.find(\"[data-init-passage]\").each(((i,el)=>{if(\"passages\"===el.id)throw new Error(`\"StoryInterface\" element <${el.nodeName.toLowerCase()} id=\"passages\"> must not contain a \"data-init-passage\" content attribute`);const passage=el.getAttribute(\"data-init-passage\").trim();if(el.hasAttribute(\"data-passage\"))throw new Error(`\"StoryInterface\" element <${el.nodeName.toLowerCase()} data-init-passage=\"${passage}\"> must not contain a \"data-passage\" content attribute`);if(null!==el.firstElementChild)throw new Error(`\"StoryInterface\" element <${el.nodeName.toLowerCase()} data-init-passage=\"${passage}\"> contains child elements`);Story.has(passage)&&jQuery(el).empty().wiki(Story.get(passage).processText().trim())}));const updating=[];$elems.find(\"[data-passage]\").each(((i,el)=>{if(\"passages\"===el.id)throw new Error(`\"StoryInterface\" element <${el.nodeName.toLowerCase()} id=\"passages\"> must not contain a \"data-passage\" content attribute`);const passage=el.getAttribute(\"data-passage\").trim();if(null!==el.firstElementChild)throw new Error(`\"StoryInterface\" element <${el.nodeName.toLowerCase()} data-passage=\"${passage}\"> contains child elements`);Story.has(passage)&&updating.push({passage:passage,element:el})})),updating.length>0&&(_updating=updating),Config.ui.updateStoryElements=!1}else $elems.append('<div id=\"story\" role=\"main\"><div id=\"passages\" aria-live=\"polite\"></div></div>');$elems.insertBefore(\"body>script#script-sugarcube\")})(),_outlinePatch=new StyleWrapper(jQuery(document.createElement(\"style\")).attr({id:\"style-aria-outlines\",type:\"text/css\"}).appendTo(document.head).get(0)),_hideOutlines(),jQuery(document).on(\"mousedown.aria-outlines keydown.aria-outlines\",(ev=>{ev.type!==_lastOutlineEvent&&(_lastOutlineEvent=ev.type,\"keydown\"===ev.type?_outlinePatch.clear():_hideOutlines())}))}},start:{value:function(){if(Story.getAllInit().forEach((passage=>{try{const debugBuffer=Wikifier.wikifyEval(passage.text);if(Config.debug){const debugView=new DebugView(document.createDocumentFragment(),\"special\",`${passage.title} [init-tagged]`,`${passage.title} [init-tagged]`);debugView.modes({hidden:!0}),debugView.append(debugBuffer),_initDebugViews.push(debugView.output)}}catch(ex){console.error(ex),Alert.error(`${passage.title} [init-tagged]`,\"object\"==typeof ex?ex.message:ex)}})),Story.has(\"StoryInit\"))try{const debugBuffer=Wikifier.wikifyEval(Story.get(\"StoryInit\").text);if(Config.debug){const debugView=new DebugView(document.createDocumentFragment(),\"special\",\"StoryInit\",\"StoryInit\");debugView.modes({hidden:!0}),debugView.append(debugBuffer),_initDebugViews.push(debugView.output)}new Promise(((resolve,reject)=>{jQuery(document.createElement(\"script\")).one(\"load abort error\",(ev=>{jQuery(ev.target).off(),\"load\"===ev.type?resolve(ev.target):reject(new Error('importScripts failed to load the script \"usettings.js\".'))})).appendTo(document.head).attr({id:\"script-imported-usettings.js\",type:\"text/javascript\",src:\"usettings.js\"})})).then((()=>console.log(\"usettings.js is active\"))).catch((()=>console.log(\"usettings.js not active, this is normal\")))}catch(ex){console.error(ex),Alert.error(\"StoryInit\",\"object\"==typeof ex?ex.message:ex)}if(null==Config.passages.start)throw new Error(\"starting passage not selected\");if(!Story.has(Config.passages.start))throw new Error(`starting passage (\"${Config.passages.start}\") not found`);if(jQuery(document.documentElement).focus(),State.restore())engineShow();else{let loadStart=!0;switch(typeof Config.saves.autoload){case\"boolean\":Config.saves.autoload&&Save.autosave.ok()&&Save.autosave.has()&&(loadStart=!Save.autosave.load());break;case\"string\":\"prompt\"===Config.saves.autoload&&Save.autosave.ok()&&Save.autosave.has()&&(loadStart=!1,UI.buildAutoload(),Dialog.open());break;case\"function\":Save.autosave.ok()&&Save.autosave.has()&&Config.saves.autoload()&&(loadStart=!Save.autosave.load())}loadStart&&enginePlay(Config.passages.start)}}},restart:{value:function(){LoadScreen.show(),window.scroll(0,0),State.reset(),jQuery.event.trigger(\":enginerestart\"),window.location.reload()}},state:{get:function(){return _state}},isIdle:{value:function(){return _state===States.Idle}},isPlaying:{value:function(){return _state!==States.Idle}},isRendering:{value:function(){return _state===States.Rendering}},lastPlay:{get:function(){return _lastPlay}},goTo:{value:function(idx){const succeded=State.goTo(idx);return succeded&&engineShow(),succeded}},go:{value:engineGo},backward:{value:function(){return engineGo(-1)}},forward:{value:function(){return engineGo(1)}},show:{value:engineShow},play:{value:enginePlay},display:{value:function(title,link,option){let noHistory=!1;switch(option){case undefined:break;case\"replace\":case\"back\":noHistory=!0;break;default:throw new Error(`Engine.display option parameter called with obsolete value \"${option}\"; please notify the developer`)}enginePlay(title,noHistory)}}}))})(),Passage=(()=>{let _tagsToSkip;_tagsToSkip=/^(?:debug|nobr|passage|widget|twine\\..*)$/i;class Passage{constructor(title,el){Object.defineProperties(this,{title:{value:Util.unescape(title)},element:{value:el||null},tags:{value:Object.freeze(el&&el.hasAttribute(\"tags\")?Array.from(new Set(el.getAttribute(\"tags\").trim().splitOrEmpty(/\\s+/))):[])},_excerpt:{writable:!0,value:null}}),Object.defineProperties(this,{domId:{value:`passage-${Util.slugify(this.title)}`},classes:{value:Object.freeze(0===this.tags.length?[]:(()=>this.tags.filter((tag=>!_tagsToSkip.test(tag))).map((tag=>Util.slugify(tag))))())}})}get className(){return this.classes.join(\" \")}get text(){if(null==this.element){const passage=Util.escapeMarkup(this.title);return`<div class=\"error-view\"><span class=\"error\">${`${L10n.get(\"errorTitle\")}: ${L10n.get(\"errorNonexistentPassage\",{passage:passage})}`}</span></div>`}return this.element.textContent.replace(/\\r/g,\"\")}description(){const descriptions=Config.passages.descriptions;switch(typeof descriptions){case\"boolean\":if(descriptions)return this.title;break;case\"object\":if(descriptions.hasOwnProperty(this.title))return descriptions[this.title];break;case\"function\":{const result=descriptions.call(this);if(result)return result}}return null===this._excerpt&&(this._excerpt=Passage.getExcerptFromText(this.text)),this._excerpt}processText(){if(null==this.element)return this.text;if(this.tags.includes(\"Twine.image\"))return`[img[${this.text}]]`;let processed=this.text;return Config.passages.onProcess&&(processed=Config.passages.onProcess.call(null,{title:this.title,tags:this.tags,text:processed})),(Config.passages.nobr||this.tags.includes(\"nobr\"))&&(processed=processed.replace(/^\\n+|\\n+$/g,\"\").replace(/\\n+/g,\" \")),Wikifier.stopWikify=0,processed}render(options){const frag=document.createDocumentFragment();return new Wikifier(frag,this.processText(),options),null==Config.passages.descriptions&&(this._excerpt=Passage.getExcerptFromNode(frag)),frag}static getExcerptFromNode(node,count){if(!node.hasChildNodes())return\"\";let excerpt=node.textContent.trim();if(\"\"!==excerpt){const excerptRe=new RegExp(`(\\\\S+(?:\\\\s+\\\\S+){0,${count>0?count-1:7}})`);excerpt=excerpt.replace(/\\s+/g,\" \").match(excerptRe)}return excerpt?`${excerpt[1]}…`:\"…\"}static getExcerptFromText(text,count){if(\"\"===text)return\"\";const excerptRe=new RegExp(`(\\\\S+(?:\\\\s+\\\\S+){0,${count>0?count-1:7}})`),excerpt=text.replace(/<<.*?>>/g,\" \").replace(/<.*?>/g,\" \").trim().replace(/^\\s*\\|.*\\|.*?$/gm,\"\").replace(/\\[[<>]?img\\[[^\\]]*\\]\\]/g,\"\").replace(/\\[\\[([^|\\]]*?)(?:(?:\\||->|<-)[^\\]]*)?\\]\\]/g,\"$1\").replace(/^\\s*!+(.*?)$/gm,\"$1\").replace(/'{2}|\\/{2}|_{2}|@{2}/g,\"\").trim().replace(/\\s+/g,\" \").match(excerptRe);return excerpt?`${excerpt[1]}…`:\"…\"}}return Passage})(),Save=(()=>{const Type=Util.toEnum({Autosave:\"autosave\",Disk:\"disk\",Serialize:\"serialize\",Slot:\"slot\"});let _slotsUBound=-1;const _onLoadHandlers=new Set,_onSaveHandlers=new Set;let useSplit=()=>\"free-cities\"===Story.domId;function indexGet(){return storage.get(\"index\")}function splitSave(slot,data){storage.set(\"autosave\"===slot?slot:`slot${slot}`,data);const index=indexGet();delete data.state,\"autosave\"===slot?index.autosave=data:index.slots[slot]=data;try{storage.set(\"index\",index)}catch(ex){storage.delete(\"autosave\"===slot?\"autosave\":`slot${slot}`),alert(\"Storage quota exceeded, try removing other saves first\")}return!0}function splitDelete(slot){storage.delete(\"autosave\"===slot?slot:`slot${slot}`);const index=indexGet();return\"autosave\"===slot?index.autosave=null:index.slots[slot]=null,storage.set(\"index\",index),!0}function savesObjGet(){const saves=storage.get(useSplit()?\"index\":\"saves\");return null===saves?{autosave:null,slots:_appendSlots([],Config.saves.slots)}:saves}function savesObjClear(){if(storage.delete(\"saves\"),useSplit()){storage.delete(\"index\"),storage.delete(\"autosave\");for(let i=0;i<Config.save.slots-1;i++)storage.delete(`slot${i}`)}return!0}function autosaveOk(){return\"cookie\"!==storage.name&&void 0!==Config.saves.autosave}function slotsOk(){return\"cookie\"!==storage.name&&-1!==_slotsUBound}function slotsCount(){if(!slotsOk())return 0;const saves=savesObjGet();let count=0;for(let i=0,iend=saves.slots.length;i<iend;++i)null!==saves.slots[i]&&++count;return count}function _appendSlots(array,num){for(let i=0;i<num;++i)array.push(null);return array}function _savesObjSave(saves){return function(saves){const slots=saves.slots;let isSlotsEmpty=!0;for(let i=0,iend=slots.length;i<iend;++i)if(null!==slots[i]){isSlotsEmpty=!1;break}return null===saves.autosave&&isSlotsEmpty}(saves)?(storage.delete(\"saves\"),!0):storage.set(\"saves\",saves)}function _marshal(supplemental,details){if(null!=supplemental&&\"object\"!=typeof supplemental)throw new Error(\"supplemental parameter must be an object\");const saveObj=Object.assign({},supplemental,{id:Config.saves.id,state:State.marshalForSave()});return Config.saves.version&&(saveObj.version=Config.saves.version),_onSaveHandlers.forEach((fn=>fn(saveObj,details))),saveObj.state.delta=State.deltaEncode(saveObj.state.history),delete saveObj.state.history,saveObj}function _unmarshal(saveObj){try{if(!saveObj||!saveObj.hasOwnProperty(\"id\")||!saveObj.hasOwnProperty(\"state\"))throw new Error(L10n.get(\"errorSaveMissingData\"));if(saveObj.state.history||(saveObj.state.jdelta&&delete saveObj.state.jdelta,saveObj.state.delta&&(saveObj.state.history=State.deltaDecode(saveObj.state.delta)),delete saveObj.state.delta),_onLoadHandlers.forEach((fn=>fn(saveObj))),saveObj.id!==Config.saves.id)throw new Error(L10n.get(\"errorSaveIdMismatch\"));State.unmarshalForSave(saveObj.state),Engine.show()}catch(ex){return UI.alert(`${ex.message.toUpperFirst()}.</p><p>${L10n.get(\"aborting\")}.`),!1}return!0}return Object.freeze(Object.defineProperties({},{init:{value:function(){if(\"cookie\"===storage.name)return savesObjClear(),Config.saves.autoload=undefined,Config.saves.autosave=undefined,Config.saves.slots=0,!1;let saves=savesObjGet(),updated=!1;return Config.saves.slots!==saves.slots.length&&(Config.saves.slots<saves.slots.length?(saves.slots.reverse(),saves.slots=saves.slots.filter((function(val){return!(null===val&&this.count>0)||(--this.count,!1)}),{count:saves.slots.length-Config.saves.slots}),saves.slots.reverse()):Config.saves.slots>saves.slots.length&&_appendSlots(saves.slots,Config.saves.slots-saves.slots.length),updated=!0),updated&&_savesObjSave(saves),_slotsUBound=saves.slots.length-1,!0}},get:{value:savesObjGet},clear:{value:savesObjClear},ok:{value:function(){return autosaveOk()||slotsOk()}},autosave:{value:Object.freeze(Object.defineProperties({},{ok:{value:autosaveOk},has:{value:function(){return null!==(useSplit()?{autosave:storage.get(\"autosave\")}:savesObjGet()).autosave}},get:{value:function(){return(useSplit()?{autosave:storage.get(\"autosave\")}:savesObjGet()).autosave}},load:{value:function(){const saves=useSplit()?{autosave:storage.get(\"autosave\")}:savesObjGet();return null!==saves.autosave&&_unmarshal(saves.autosave)}},save:{value:function(title,metadata){if(\"function\"==typeof Config.saves.isAllowed&&!Config.saves.isAllowed())return!1;if(idb.active)return idb.saveState(0),!0;const saves=savesObjGet(),supplemental={title:title||Story.get(State.passage).description(),date:Date.now()};null!=metadata&&(supplemental.metadata=metadata);const saveData=_marshal(supplemental,{type:Type.Autosave});return useSplit()?splitSave(\"autosave\",saveData):(saves.autosave=saveData,_savesObjSave(saves))}},delete:{value:function(){if(useSplit())return splitDelete(\"autosave\");const saves=savesObjGet();return saves.autosave=null,_savesObjSave(saves)}}}))},slots:{value:Object.freeze(Object.defineProperties({},{ok:{value:slotsOk},length:{get:function(){return _slotsUBound+1}},isEmpty:{value:function(){return 0===slotsCount()}},count:{value:slotsCount},has:{value:function(slot){if(slot<0||slot>_slotsUBound)return!1;const saves=savesObjGet();return!(slot>=saves.slots.length||null===saves.slots[slot])}},get:{value:function(slot){if(slot<0||slot>_slotsUBound)return null;const saves=savesObjGet();return slot>=saves.slots.length?null:useSplit()?storage.get(`slot${slot}`):saves.slots[slot]}},load:{value:function(slot){if(slot<0||slot>_slotsUBound)return!1;const saves=savesObjGet();return!(slot>=saves.slots.length||null===saves.slots[slot])&&_unmarshal(useSplit()?storage.get(`slot${slot}`):saves.slots[slot])}},save:{value:function(slot,title,metadata){if(\"function\"==typeof Config.saves.isAllowed&&!Config.saves.isAllowed())return Dialog.isOpen()?$(document).one(\":dialogclosed\",(()=>UI.alert(L10n.get(\"savesDisallowed\")))):UI.alert(L10n.get(\"savesDisallowed\")),!1;if(slot<0||slot>_slotsUBound)return!1;const saves=savesObjGet();if(slot>=saves.slots.length)return!1;const supplemental={title:title||Story.get(State.passage).description(),date:Date.now()};null!=metadata&&(supplemental.metadata=metadata);const saveData=_marshal(supplemental,{type:Type.Slot});return useSplit()?splitSave(slot,saveData):(saves.slots[slot]=saveData,_savesObjSave(saves))}},delete:{value:function(slot){if(slot<0||slot>_slotsUBound)return!1;const saves=savesObjGet();return!(slot>=saves.slots.length)&&(useSplit()?splitDelete(slot):(saves.slots[slot]=null,_savesObjSave(saves)))}}}))},export:{value:function(filename,metadata){if(\"function\"==typeof Config.saves.isAllowed&&!Config.saves.isAllowed())return void(Dialog.isOpen()?$(document).one(\":dialogclosed\",(()=>UI.alert(L10n.get(\"savesDisallowed\")))):UI.alert(L10n.get(\"savesDisallowed\")));var str;const saveName=`${null==filename?Story.domId:(str=filename,Util.sanitizeFilename(str).replace(/[_\\s\\u2013\\u2014-]+/g,\"-\"))}-${function(){const now=new Date;let MM=now.getMonth()+1,DD=now.getDate(),hh=now.getHours(),mm=now.getMinutes(),ss=now.getSeconds();return MM<10&&(MM=`0${MM}`),DD<10&&(DD=`0${DD}`),hh<10&&(hh=`0${hh}`),mm<10&&(mm=`0${mm}`),ss<10&&(ss=`0${ss}`),`${now.getFullYear()}${MM}${DD}-${hh}${mm}${ss}`}()}.save`,supplemental=null==metadata?{}:{metadata:metadata},saveObj=LZString.compressToBase64(JSON.stringify(_marshal(supplemental,{type:Type.Disk})));saveAs(new Blob([saveObj],{type:\"text/plain;charset=UTF-8\"}),saveName)}},import:{value:function(event){const file=event.target.files[0],reader=new FileReader;jQuery(reader).one(\"loadend\",(()=>{if(reader.error){const ex=reader.error;return void UI.alert(`${L10n.get(\"errorSaveDiskLoadFailed\").toUpperFirst()} (${ex.name}: ${ex.message}).</p><p>${L10n.get(\"aborting\")}.`)}let saveObj;try{saveObj=JSON.parse(/\\.json$/i.test(file.name)||/^\\{/.test(reader.result)?reader.result:LZString.decompressFromBase64(reader.result))}catch(ex){}_unmarshal(saveObj)})),reader.readAsText(file)}},serialize:{value:function(metadata){if(\"function\"==typeof Config.saves.isAllowed&&!Config.saves.isAllowed())return Dialog.isOpen()?$(document).one(\":dialogclosed\",(()=>UI.alert(L10n.get(\"savesDisallowed\")))):UI.alert(L10n.get(\"savesDisallowed\")),null;const supplemental=null==metadata?{}:{metadata:metadata};return LZString.compressToBase64(JSON.stringify(_marshal(supplemental,{type:Type.Serialize})))}},deserialize:{value:function(base64Str){let saveObj;try{saveObj=JSON.parse(LZString.decompressFromBase64(base64Str))}catch(ex){}return _unmarshal(saveObj)?saveObj.metadata:null}},onLoad:{value:Object.freeze(Object.defineProperties({},{add:{value:function(handler){const valueType=Util.getType(handler);if(\"function\"!==valueType)throw new TypeError(`Save.onLoad.add handler parameter must be a function (received: ${valueType})`);_onLoadHandlers.add(handler)}},clear:{value:function(){_onLoadHandlers.clear()}},delete:{value:function(handler){return _onLoadHandlers.delete(handler)}},size:{get:function(){return _onLoadHandlers.size}},handlers:{value:_onLoadHandlers}}))},onSave:{value:Object.freeze(Object.defineProperties({},{add:{value:function(handler){const valueType=Util.getType(handler);if(\"function\"!==valueType)throw new TypeError(`Save.onSave.add handler parameter must be a function (received: ${valueType})`);_onSaveHandlers.add(handler)}},clear:{value:function(){_onSaveHandlers.clear()}},delete:{value:function(handler){return _onSaveHandlers.delete(handler)}},size:{get:function(){return _onSaveHandlers.size}},handlers:{value:_onSaveHandlers}}))}}))})(),Setting=(()=>{const Types=Util.toEnum({Header:0,Toggle:1,List:2,Range:3}),_definitions=[];function settingsCreate(){return Object.create(null)}function settingsSave(){const savedSettings=settingsCreate();return Object.keys(settings).length>0&&_definitions.filter((def=>def.type!==Types.Header&&settings[def.name]!==def.default)).forEach((def=>savedSettings[def.name]=settings[def.name])),0===Object.keys(savedSettings).length?(storage.delete(\"settings\"),!0):storage.set(\"settings\",savedSettings)}function settingsLoad(){const defaultSettings=settingsCreate(),loadedSettings=storage.get(\"settings\")||settingsCreate();_definitions.filter((def=>def.type!==Types.Header)).forEach((def=>defaultSettings[def.name]=def.default)),window.SugarCube.settings=settings=Object.assign(defaultSettings,loadedSettings)}function settingsClear(){return window.SugarCube.settings=settings=settingsCreate(),storage.delete(\"settings\"),!0}function definitionsAdd(type,name,def){if(arguments.length<3){const errors=[];throw arguments.length<1&&errors.push(\"type\"),arguments.length<2&&errors.push(\"name\"),arguments.length<3&&errors.push(\"definition\"),new Error(`missing parameters, no ${errors.join(\" or \")} specified`)}if(\"object\"!=typeof def)throw new TypeError(\"definition parameter must be an object\");if(definitionsHas(name))throw new Error(`cannot clobber existing setting \"${name}\"`);const definition={type:type,name:name,label:\"string\"==typeof def.label?def.label.trim():\"\"};if(\"string\"==typeof def.desc){const desc=def.desc.trim();\"\"!==desc&&(definition.desc=desc)}switch(type){case Types.Header:break;case Types.Toggle:definition.default=!!def.default;break;case Types.List:if(!def.hasOwnProperty(\"list\"))throw new Error(\"no list specified\");if(!Array.isArray(def.list))throw new TypeError(\"list must be an array\");if(0===def.list.length)throw new Error(\"list must not be empty\");if(definition.list=Object.freeze(def.list),null==def.default)definition.default=def.list[0];else{const defaultIndex=def.list.indexOf(def.default);if(-1===defaultIndex)throw new Error(\"list does not contain default\");definition.default=def.list[defaultIndex]}break;case Types.Range:if(!def.hasOwnProperty(\"min\"))throw new Error(\"no min specified\");if(\"number\"!=typeof def.min||Number.isNaN(def.min)||!Number.isFinite(def.min))throw new TypeError(\"min must be a finite number\");if(!def.hasOwnProperty(\"max\"))throw new Error(\"no max specified\");if(\"number\"!=typeof def.max||Number.isNaN(def.max)||!Number.isFinite(def.max))throw new TypeError(\"max must be a finite number\");if(!def.hasOwnProperty(\"step\"))throw new Error(\"no step specified\");if(\"number\"!=typeof def.step||Number.isNaN(def.step)||!Number.isFinite(def.step)||def.step<=0)throw new TypeError(\"step must be a finite number greater than zero\");{const fracDigits=(()=>{const str=String(def.step),pos=str.lastIndexOf(\".\");return-1===pos?0:str.length-pos-1})();function stepValidate(value){if(fracDigits>0){const ma=Number(`${def.min}e${fracDigits}`),sa=Number(`${def.step}e${fracDigits}`),va=Number(`${value}e${fracDigits}`)-ma;return Number(`${va-va%sa+ma}e-${fracDigits}`)}const va=value-def.min;return va-va%def.step+def.min}if(stepValidate(def.max)!==def.max)throw new RangeError(`max (${def.max}) is not a multiple of the step (${def.step}) plus the min (${def.min})`)}if(definition.max=def.max,definition.min=def.min,definition.step=def.step,null==def.default)definition.default=def.max;else{if(\"number\"!=typeof def.default||Number.isNaN(def.default)||!Number.isFinite(def.default))throw new TypeError(\"default must be a finite number\");if(def.default<def.min)throw new RangeError(`default (${def.default}) is less than min (${def.min})`);if(def.default>def.max)throw new RangeError(`default (${def.default}) is greater than max (${def.max})`);definition.default=def.default}break;default:throw new Error(`unknown Setting type: ${type}`)}\"function\"==typeof def.onInit&&(definition.onInit=Object.freeze(def.onInit)),\"function\"==typeof def.onChange&&(definition.onChange=Object.freeze(def.onChange)),_definitions.push(Object.freeze(definition))}function definitionsHas(name){return _definitions.some((definition=>definition.name===name))}function definitionsGet(name){return _definitions.find((definition=>definition.name===name))}return Object.freeze(Object.defineProperties({},{Types:{value:Types},init:{value:function(){if(storage.has(\"options\")){const old=storage.get(\"options\");null!==old&&(window.SugarCube.settings=settings=Object.assign(settingsCreate(),old)),settingsSave(),storage.delete(\"options\")}settingsLoad(),_definitions.forEach((def=>{if(def.hasOwnProperty(\"onInit\")){const thisArg={name:def.name,value:settings[def.name],default:def.default};def.hasOwnProperty(\"list\")&&(thisArg.list=def.list),def.onInit.call(thisArg)}}))}},create:{value:settingsCreate},save:{value:settingsSave},load:{value:settingsLoad},clear:{value:settingsClear},reset:{value:function(name){if(0===arguments.length)settingsClear(),settingsLoad();else{if(null==name||!definitionsHas(name))throw new Error(`nonexistent setting \"${name}\"`);const def=definitionsGet(name);def.type!==Types.Header&&(settings[name]=def.default)}return settingsSave()}},forEach:{value:function(callback,thisArg){_definitions.forEach(callback,thisArg)}},add:{value:definitionsAdd},addHeader:{value:function(name,desc){definitionsAdd(Types.Header,name,{desc:desc})}},addToggle:{value:function(...args){definitionsAdd(Types.Toggle,...args)}},addList:{value:function(...args){definitionsAdd(Types.List,...args)}},addRange:{value:function(...args){definitionsAdd(Types.Range,...args)}},isEmpty:{value:function(){return 0===_definitions.length}},has:{value:definitionsHas},get:{value:definitionsGet},delete:{value:function definitionsDelete(name){definitionsHas(name)&&delete settings[name];for(let i=0;i<_definitions.length;++i)if(_definitions[i].name===name){_definitions.splice(i,1),definitionsDelete(name);break}}}}))})(),Story=(()=>{const _passages={},_inits=[],_scripts=[],_styles=[],_widgets=[];let _title=\"\",_ifId=\"\",_domId=\"\";function _storySetTitle(rawTitle){if(null==rawTitle)throw new Error(\"story title must not be null or undefined\");const title=Util.unescape(String(rawTitle)).trim();if(\"\"===title)throw new Error(\"story title must not be empty or consist solely of whitespace\");if(document.title=_title=title,_domId=Util.slugify(_title),\"\"===_domId)if(\"\"!==_ifId)_domId=_ifId;else for(let i=0,len=_title.length;i<len;++i){const{char:char,start:start,end:end}=Util.charAndPosAt(_title,i);_domId+=char.codePointAt(0).toString(16),i+=end-start}}return Object.freeze(Object.defineProperties({},{load:{value:function(){const validationCodeTags=[\"init\",\"widget\"],validationNoCodeTagPassages=[\"PassageDone\",\"PassageFooter\",\"PassageHeader\",\"PassageReady\",\"StoryAuthor\",\"StoryBanner\",\"StoryCaption\",\"StoryInit\",\"StoryMenu\",\"StoryShare\",\"StorySubtitle\"];function validateStartingPassage(passage){if(passage.tags.includesAny(validationCodeTags))throw new Error(`starting passage \"${passage.title}\" contains special tags; invalid: \"${passage.tags.filter((tag=>validationCodeTags.includes(tag))).sort().join('\", \"')}\"`)}function validateSpecialPassages(passage,...tags){if(validationNoCodeTagPassages.includes(passage.title))throw new Error(`special passage \"${passage.title}\" contains special tags; invalid: \"${tags.sort().join('\", \"')}\"`);const codeTags=[...validationCodeTags],foundTags=[];if(passage.tags.forEach((tag=>{codeTags.includes(tag)&&foundTags.push(...codeTags.delete(tag))})),foundTags.length>1)throw new Error(`passage \"${passage.title}\" contains multiple special tags; invalid: \"${foundTags.sort().join('\", \"')}\"`)}{const $storydata=jQuery(\"tw-storydata\"),startNode=$storydata.attr(\"startnode\")||\"\";Config.passages.start=null,Config.debug=/\\bdebug\\b/.test($storydata.attr(\"options\")),$storydata.children(\"style\").each((function(i){_styles.push(new Passage(`tw-user-style-${i}`,this))})),$storydata.children(\"script\").each((function(i){_scripts.push(new Passage(`tw-user-script-${i}`,this))})),$storydata.children('tw-passagedata:not([tags~=\"Twine.private\"],[tags~=\"annotation\"])').each((function(){const $this=jQuery(this),pid=$this.attr(\"pid\")||\"\",passage=new Passage($this.attr(\"name\"),this);pid===startNode&&\"\"!==startNode?(Config.passages.start=passage.title,validateStartingPassage(passage),_passages[passage.title]=passage):passage.tags.includes(\"init\")?(validateSpecialPassages(passage,\"init\"),_inits.push(passage)):passage.tags.includes(\"widget\")?(validateSpecialPassages(passage,\"widget\"),_widgets.push(passage)):_passages[passage.title]=passage})),_ifId=$storydata.attr(\"ifid\"),_storySetTitle(\"{{STORY_NAME}}\"),Config.saves.id=Story.domId}}},init:{value:function(){(()=>{const storyStyle=document.createElement(\"style\");new StyleWrapper(storyStyle).add(_styles.map((style=>style.text.trim())).join(\"\\n\")),jQuery(storyStyle).appendTo(document.head).attr({id:\"style-story\",type:\"text/css\"})})();for(let i=0;i<_scripts.length;++i)try{Scripting.evalJavaScript(_scripts[i].text)}catch(ex){console.error(ex),Alert.error(_scripts[i].title,\"object\"==typeof ex?ex.message:ex)}for(let i=0;i<_widgets.length;++i)try{Wikifier.wikifyEval(_widgets[i].processText())}catch(ex){console.error(ex),Alert.error(_widgets[i].title,\"object\"==typeof ex?ex.message:ex)}}},title:{get:function(){return _title}},domId:{get:function(){return _domId}},ifId:{get:function(){return _ifId}},add:{value:function(passage){if(!(passage instanceof Passage))throw new TypeError(\"Story.add passage parameter must be an instance of Passage\");const title=passage.title;return!_passages.hasOwnProperty(title)&&(_passages[title]=passage,!0)}},has:{value:function(title){let type=typeof title;switch(type){case\"number\":case\"string\":return _passages.hasOwnProperty(String(title));case\"undefined\":break;case\"object\":type=null===title?\"null\":\"an object\";break;default:type=`a ${type}`}throw new TypeError(`Story.has title parameter cannot be ${type}`)}},get:{value:function(title){let type=typeof title;switch(type){case\"number\":case\"string\":{const id=String(title);return _passages.hasOwnProperty(id)?_passages[id]:new Passage(id||\"(unknown)\")}case\"undefined\":break;case\"object\":type=null===title?\"null\":\"an object\";break;default:type=`a ${type}`}throw new TypeError(`Story.get title parameter cannot be ${type}`)}},getAllInit:{value:function(){return Object.freeze(Array.from(_inits))}},getAllRegular:{value:function(){return Object.freeze(Object.assign({},_passages))}},getAllScript:{value:function(){return Object.freeze(Array.from(_scripts))}},getAllStylesheet:{value:function(){return Object.freeze(Array.from(_styles))}},getAllWidget:{value:function(){return Object.freeze(Array.from(_widgets))}},lookup:{value:function(key,value,sortKey=\"title\"){const results=[];return Object.keys(_passages).forEach((name=>{const passage=_passages[name];\"object\"==typeof passage[key]&&null!==passage[key]?passage[key]instanceof Array&&passage[key].some((m=>Util.sameValueZero(m,value)))&&results.push(passage):Util.sameValueZero(passage[key],value)&&results.push(passage)})),results.sort(((a,b)=>a[sortKey]==b[sortKey]?0:a[sortKey]<b[sortKey]?-1:1)),results}},lookupWith:{value:function(predicate,sortKey=\"title\"){if(\"function\"!=typeof predicate)throw new TypeError(\"Story.lookupWith predicate parameter must be a function\");const results=[];return Object.keys(_passages).forEach((name=>{const passage=_passages[name];predicate(passage)&&results.push(passage)})),results.sort(((a,b)=>a[sortKey]==b[sortKey]?0:a[sortKey]<b[sortKey]?-1:1)),results}}}))})(),UI=(()=>{function uiAssembleLinkList(passage,listEl){let list=listEl;const debugState=Config.debug,cleanState=Config.cleanupWikifierOutput;Config.debug=!1,Config.cleanupWikifierOutput=!1;try{null==list&&(list=document.createElement(\"ul\"));const frag=document.createDocumentFragment();new Wikifier(frag,Story.get(passage).processText().trim());const errors=[...frag.querySelectorAll(\".error\")].map((errEl=>errEl.textContent.replace(errorPrologRegExp,\"\")));if(errors.length>0)throw new Error(errors.join(\"; \"));for(;frag.hasChildNodes();){const node=frag.firstChild;if(node.nodeType===Node.ELEMENT_NODE&&\"A\"===node.nodeName.toUpperCase()){const li=document.createElement(\"li\");list.appendChild(li),li.appendChild(node)}else frag.removeChild(node)}}finally{Config.cleanupWikifierOutput=cleanState,Config.debug=debugState}return list}function uiOpenAlert(message,...args){jQuery(Dialog.setup(L10n.get(\"alertTitle\"),\"alert\")).append(`<p>${message}</p><ul class=\"buttons\"><li><button id=\"alert-ok\" class=\"ui-close\">${L10n.get([\"alertOk\",\"ok\"])}</button></li></ul>`),Dialog.open(...args)}function uiBuildAutoload(){return jQuery(Dialog.setup(L10n.get(\"autoloadTitle\"),\"autoload\")).append(`<p>${L10n.get(\"autoloadPrompt\")}</p><ul class=\"buttons\"><li><button id=\"autoload-ok\" class=\"ui-close\">${L10n.get([\"autoloadOk\",\"ok\"])}</button></li><li><button id=\"autoload-cancel\" class=\"ui-close\">${L10n.get([\"autoloadCancel\",\"cancel\"])}</button></li></ul>`),jQuery(document).one(\"click.autoload\",\".ui-close\",(ev=>{const isAutoloadOk=\"autoload-ok\"===ev.target.id;jQuery(document).one(\":dialogclosed\",(()=>{isAutoloadOk&&Save.autosave.load()||Engine.play(Config.passages.start)}))})),!0}function uiBuildJumpto(){const list=document.createElement(\"ul\");jQuery(Dialog.setup(L10n.get(\"jumptoTitle\"),\"jumpto list\")).append(list);const expired=State.expired.length;for(let i=State.size-1;i>=0;--i){if(i===State.activeIndex)continue;const passage=Story.get(State.history[i].title);passage&&passage.tags.includes(\"bookmark\")&&jQuery(document.createElement(\"li\")).append(jQuery(document.createElement(\"a\")).ariaClick({one:!0},function(idx){return()=>jQuery(document).one(\":dialogclosed\",(()=>Engine.goTo(idx)))}(i)).addClass(\"ui-close\").text(`${L10n.get(\"jumptoTurn\")} ${expired+i+1}: ${passage.description()}`)).appendTo(list)}list.hasChildNodes()||jQuery(list).append(`<li><a><em>${L10n.get(\"jumptoUnavailable\")}</em></a></li>`)}function uiBuildRestart(){return jQuery(Dialog.setup(L10n.get(\"restartTitle\"),\"restart\")).append(`<p>${L10n.get(\"restartPrompt\")}</p><ul class=\"buttons\"><li><button id=\"restart-ok\">${L10n.get([\"restartOk\",\"ok\"])}</button></li><li><button id=\"restart-cancel\" class=\"ui-close\">${L10n.get([\"restartCancel\",\"cancel\"])}</button></li></ul>`).find(\"#restart-ok\").ariaClick({one:!0},(()=>{jQuery(document).one(\":dialogclosed\",(()=>Engine.restart())),Dialog.close()})),!0}function uiBuildSaves(){const savesAllowed=\"function\"!=typeof Config.saves.isAllowed||Config.saves.isAllowed();function createActionItem(bId,bClass,bText,bAction){const $btn=jQuery(document.createElement(\"button\")).attr(\"id\",`saves-${bId}`).html(bText);return bClass&&$btn.addClass(bClass),bAction?$btn.ariaClick(bAction):$btn.ariaDisabled(!0),jQuery(document.createElement(\"li\")).append($btn)}const $dialogBody=jQuery(Dialog.setup(L10n.get(\"savesTitle\"),\"saves\")),savesOk=Save.ok(),fileOk=Has.fileAPI&&(Config.saves.tryDiskOnMobile||!Browser.isMobile.any());if(savesOk&&$dialogBody.append(function(){function createButton(bId,bClass,bText,bSlot,bAction){const $btn=jQuery(document.createElement(\"button\")).attr(\"id\",`saves-${bId}-${bSlot}`).addClass(bId).html(bText);return bClass&&$btn.addClass(bClass),bAction?\"auto\"===bSlot?$btn.ariaClick({label:`${bText} ${L10n.get(\"savesLabelAuto\")}`},(()=>bAction())):$btn.ariaClick({label:`${bText} ${L10n.get(\"savesLabelSlot\")} ${bSlot+1}`},(()=>bAction(bSlot))):$btn.ariaDisabled(!0),$btn}const saves=Save.get(),$tbody=jQuery(document.createElement(\"tbody\"));if(Save.autosave.ok()){const $tdSlot=jQuery(document.createElement(\"td\")),$tdLoad=jQuery(document.createElement(\"td\")),$tdDesc=jQuery(document.createElement(\"td\")),$tdDele=jQuery(document.createElement(\"td\"));jQuery(document.createElement(\"b\")).attr({title:L10n.get(\"savesLabelAuto\"),\"aria-label\":L10n.get(\"savesLabelAuto\")}).text(\"A\").appendTo($tdSlot),saves.autosave?($tdLoad.append(createButton(\"load\",\"ui-close\",L10n.get(\"savesLabelLoad\"),\"auto\",(()=>{jQuery(document).one(\":dialogclosed\",(()=>Save.autosave.load()))}))),jQuery(document.createElement(\"div\")).text(saves.autosave.title).appendTo($tdDesc),jQuery(document.createElement(\"div\")).addClass(\"datestamp\").html(saves.autosave.date?`${new Date(saves.autosave.date).toLocaleString()}`:`<em>${L10n.get(\"savesUnknownDate\")}</em>`).appendTo($tdDesc),$tdDele.append(createButton(\"delete\",null,L10n.get(\"savesLabelDelete\"),\"auto\",(()=>{Save.autosave.delete(),uiBuildSaves()})))):($tdLoad.append(createButton(\"load\",null,L10n.get(\"savesLabelLoad\"),\"auto\")),$tdDesc.addClass(\"empty\").text(\"•  •  •\"),$tdDele.append(createButton(\"delete\",null,L10n.get(\"savesLabelDelete\"),\"auto\"))),jQuery(document.createElement(\"tr\")).append($tdSlot).append($tdLoad).append($tdDesc).append($tdDele).appendTo($tbody)}for(let i=0,iend=saves.slots.length;i<iend;++i){const $tdSlot=jQuery(document.createElement(\"td\")),$tdLoad=jQuery(document.createElement(\"td\")),$tdDesc=jQuery(document.createElement(\"td\")),$tdDele=jQuery(document.createElement(\"td\"));$tdSlot.append(document.createTextNode(i+1)),saves.slots[i]?($tdLoad.append(createButton(\"save\",\"ui-close\",L10n.get(\"savesLabelSave\"),i,Save.slots.save),createButton(\"load\",\"ui-close\",L10n.get(\"savesLabelLoad\"),i,(slot=>{jQuery(document).one(\":dialogclosed\",(()=>Save.slots.load(slot)))}))),jQuery(document.createElement(\"div\")).text(saves.slots[i].title).appendTo($tdDesc),jQuery(document.createElement(\"div\")).addClass(\"datestamp\").html(saves.slots[i].date?`${new Date(saves.slots[i].date).toLocaleString()}`:`<em>${L10n.get(\"savesUnknownDate\")}</em>`).appendTo($tdDesc),$tdDele.append(createButton(\"delete\",null,L10n.get(\"savesLabelDelete\"),i,(slot=>{Save.slots.delete(slot),uiBuildSaves()})))):($tdLoad.append(createButton(\"save\",\"ui-close\",L10n.get(\"savesLabelSave\"),i,savesAllowed?Save.slots.save:null)),$tdDesc.addClass(\"empty\").text(\"•  •  •\"),$tdDele.append(createButton(\"delete\",null,L10n.get(\"savesLabelDelete\"),i))),jQuery(document.createElement(\"tr\")).append($tdSlot).append($tdLoad).append($tdDesc).append($tdDele).appendTo($tbody)}return jQuery(document.createElement(\"table\")).attr(\"id\",\"saves-list\").append($tbody)}()),savesOk||fileOk){const $btnBar=jQuery(document.createElement(\"ul\")).addClass(\"buttons\").appendTo($dialogBody);fileOk&&($btnBar.append(createActionItem(\"export\",\"ui-close\",L10n.get(\"savesLabelExport\"),savesAllowed?()=>Save.export():null)),navigator.clipboard&&$btnBar.append(createActionItem(\"toClipboard\",\"ui-close\",L10n.get(\"savesLabelToClipboard\"),savesAllowed?()=>navigator.clipboard.writeText(Save.serialize()):null)),$btnBar.append(createActionItem(\"import\",null,L10n.get(\"savesLabelImport\"),(()=>$dialogBody.find(\"#saves-import-file\").trigger(\"click\")))),jQuery(document.createElement(\"input\")).css({display:\"block\",visibility:\"hidden\",position:\"fixed\",left:\"-9999px\",top:\"-9999px\",width:\"1px\",height:\"1px\"}).attr({type:\"file\",id:\"saves-import-file\",tabindex:-1,\"aria-hidden\":!0}).on(\"change\",(ev=>{jQuery(document).one(\":dialogclosed\",(()=>Save.import(ev))),Dialog.close()})).appendTo($dialogBody)),savesOk&&$btnBar.append(createActionItem(\"clear\",null,L10n.get(\"savesLabelClear\"),Save.autosave.has()||!Save.slots.isEmpty()?()=>{Save.clear(),uiBuildSaves()}:null));return jQuery(document.createElement(\"ul\")).addClass(\"buttons\").appendTo($dialogBody).append(createActionItem(\"idbToggleSaves\",null,\"Enable indexedDB\",idb.lock?null:()=>{Dialog.create(\"saves\",\"saves\").append($(document.createElement(\"h3\")).addClass(\"saves-loading\").text(\"Loading the save list, please wait...\")),idb.updateSettings(\"active\",!0),idb.saveList()})),!0}return uiOpenAlert(L10n.get(\"savesIncapable\")),!1}function uiBuildSettings(){const $dialogBody=jQuery(Dialog.setup(L10n.get(\"settingsTitle\"),\"settings\"));return Setting.forEach((control=>{if(control.type===Setting.Types.Header){const name=control.name,id=Util.slugify(name),$header=jQuery(document.createElement(\"div\")),$heading=jQuery(document.createElement(\"h2\"));return $header.attr(\"id\",`header-body-${id}`).append($heading).appendTo($dialogBody),$heading.attr(\"id\",`header-heading-${id}`).wiki(name),void(control.desc&&jQuery(document.createElement(\"p\")).attr(\"id\",`header-desc-${id}`).wiki(control.desc).appendTo($header))}const name=control.name,id=Util.slugify(name),$setting=jQuery(document.createElement(\"div\")),$label=jQuery(document.createElement(\"label\")),$controlBox=jQuery(document.createElement(\"div\"));let $control;switch(jQuery(document.createElement(\"div\")).append($label).append($controlBox).appendTo($setting),control.desc&&jQuery(document.createElement(\"p\")).attr(\"id\",`setting-desc-${id}`).wiki(control.desc).appendTo($setting),$label.attr({id:`setting-label-${id}`,for:`setting-control-${id}`}).wiki(control.label),null==settings[name]&&(settings[name]=control.default),control.type){case Setting.Types.Toggle:$control=jQuery(document.createElement(\"button\")),settings[name]?$control.addClass(\"enabled\").text(L10n.get(\"settingsOn\")):$control.text(L10n.get(\"settingsOff\")),$control.ariaClick((function(){settings[name]?(jQuery(this).removeClass(\"enabled\").text(L10n.get(\"settingsOff\")),settings[name]=!1):(jQuery(this).addClass(\"enabled\").text(L10n.get(\"settingsOn\")),settings[name]=!0),Setting.save(),control.hasOwnProperty(\"onChange\")&&control.onChange.call({name:name,value:settings[name],default:control.default})}));break;case Setting.Types.List:$control=jQuery(document.createElement(\"select\"));for(let i=0,iend=control.list.length;i<iend;++i)jQuery(document.createElement(\"option\")).val(i).text(control.list[i]).appendTo($control);$control.val(control.list.indexOf(settings[name])).attr(\"tabindex\",0).on(\"change\",(function(){settings[name]=control.list[Number(this.value)],Setting.save(),control.hasOwnProperty(\"onChange\")&&control.onChange.call({name:name,value:settings[name],default:control.default,list:control.list})}));break;case Setting.Types.Range:$control=jQuery(document.createElement(\"input\")),$control.attr({type:\"range\",min:control.min,max:control.max,step:control.step,value:settings[name],tabindex:0}).on(\"change input\",(function(){settings[name]=Number(this.value),Setting.save(),control.hasOwnProperty(\"onChange\")&&control.onChange.call({name:name,value:settings[name],default:control.default,min:control.min,max:control.max,step:control.step})})).on(\"keypress\",(ev=>{13===ev.which&&(ev.preventDefault(),$control.trigger(\"change\"))}))}$control.attr(\"id\",`setting-control-${id}`).appendTo($controlBox),$setting.attr(\"id\",`setting-body-${id}`).appendTo($dialogBody)})),$dialogBody.append(`<ul class=\"buttons\"><li><button id=\"settings-ok\" class=\"ui-close\">${L10n.get([\"settingsOk\",\"ok\"])}</button></li><li><button id=\"settings-reset\">${L10n.get(\"settingsReset\")}</button></li></ul>`).find(\"#settings-reset\").ariaClick({one:!0},(()=>{jQuery(document).one(\":dialogclosed\",(()=>{Setting.reset(),window.location.reload()})),Dialog.close()})),!0}function uiBuildShare(){try{jQuery(Dialog.setup(L10n.get(\"shareTitle\"),\"share list\")).append(uiAssembleLinkList(\"StoryShare\"))}catch(ex){return console.error(ex),Alert.error(\"StoryShare\",ex.message),!1}return!0}return Object.freeze(Object.defineProperties({},{assembleLinkList:{value:uiAssembleLinkList},alert:{value:uiOpenAlert},jumpto:{value:function(...args){uiBuildJumpto(),Dialog.open(...args)}},restart:{value:function(...args){uiBuildRestart(),Dialog.open(...args)}},saves:{value:function(...args){idb.active?(Dialog.create(\"saves\",\"saves\").append($(document.createElement(\"h3\")).addClass(\"saves-loading\").text(\"Loading the save list, please wait...\")),idb.saveList()):uiBuildSaves(),Dialog.open(...args)}},settings:{value:function(...args){uiBuildSettings(),Dialog.open(...args)}},share:{value:function(...args){uiBuildShare(),Dialog.open(...args)}},buildAutoload:{value:uiBuildAutoload},buildJumpto:{value:uiBuildJumpto},buildRestart:{value:uiBuildRestart},buildSaves:{value:uiBuildSaves},buildSettings:{value:uiBuildSettings},buildShare:{value:uiBuildShare},stow:{value:()=>UIBar.stow()},unstow:{value:()=>UIBar.unstow()},setStoryElements:{value:()=>UIBar.update()},isOpen:{value:(...args)=>Dialog.isOpen(...args)},body:{value:()=>Dialog.body()},setup:{value:(...args)=>Dialog.setup(...args)},addClickHandler:{value:(...args)=>Dialog.addClickHandler(...args)},open:{value:(...args)=>Dialog.open(...args)},close:{value:(...args)=>Dialog.close(...args)},resize:{value:()=>Dialog.resize()},buildDialogAutoload:{value:uiBuildAutoload},buildDialogJumpto:{value:uiBuildJumpto},buildDialogRestart:{value:uiBuildRestart},buildDialogSaves:{value:uiBuildSaves},buildDialogSettings:{value:uiBuildSettings},buildDialogShare:{value:uiBuildShare},buildLinkListFromPassage:{value:uiAssembleLinkList}}))})(),UIBar=(()=>{let _$uiBar=null;function uiBarStow(noAnimation){if(_$uiBar&&!_$uiBar.hasClass(\"stowed\")){let $story;noAnimation&&($story=jQuery(\"#story\"),$story.addClass(\"no-transition\"),_$uiBar.addClass(\"no-transition\")),_$uiBar.addClass(\"stowed\"),noAnimation&&setTimeout((()=>{$story.removeClass(\"no-transition\"),_$uiBar.removeClass(\"no-transition\")}),Engine.minDomActionDelay)}return this}function uiBarUpdate(){if(Story.has(\"StoryDisplayTitle\")&&setDisplayTitle(Story.get(\"StoryDisplayTitle\").processText()),!_$uiBar)return;setPageElement(\"story-banner\",\"StoryBanner\"),setPageElement(\"story-subtitle\",\"StorySubtitle\"),setPageElement(\"story-author\",\"StoryAuthor\"),setPageElement(\"story-caption\",\"StoryCaption\");const menuStory=document.getElementById(\"menu-story\");if(null!==menuStory&&(jQuery(menuStory).empty(),Story.has(\"StoryMenu\")))try{UI.assembleLinkList(\"StoryMenu\",menuStory)}catch(ex){console.error(ex),Alert.error(\"StoryMenu\",ex.message)}}return Object.freeze(Object.defineProperties({},{destroy:{value:function(){_$uiBar&&(_$uiBar.hide(),jQuery(document).off(\".ui-bar\"),jQuery(document.head).find(\"#style-ui-bar\").remove(),_$uiBar.remove(),_$uiBar=null)}},hide:{value:function(){return _$uiBar&&_$uiBar.hide(),this}},init:{value:function(){if(document.getElementById(\"ui-bar\"))return;const $elems=(()=>{const toggleLabel=L10n.get(\"uiBarToggle\"),backwardLabel=L10n.get(\"uiBarBackward\"),jumptoLabel=L10n.get(\"uiBarJumpto\"),forwardLabel=L10n.get(\"uiBarForward\");return jQuery(document.createDocumentFragment()).append(`<div id=\"ui-bar\" aria-live=\"polite\"><div id=\"ui-bar-tray\"><button id=\"ui-bar-toggle\" tabindex=\"0\" title=\"${toggleLabel}\" aria-label=\"${toggleLabel}\"></button><div id=\"ui-bar-history\"><button id=\"history-backward\" tabindex=\"0\" title=\"${backwardLabel}\" aria-label=\"${backwardLabel}\"></button><button id=\"history-jumpto\" tabindex=\"0\" title=\"${jumptoLabel}\" aria-label=\"${jumptoLabel}\"></button><button id=\"history-forward\" tabindex=\"0\" title=\"${forwardLabel}\" aria-label=\"${forwardLabel}\"></button></div></div><div id=\"ui-bar-body\"><header id=\"title\" role=\"banner\"><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\" role=\"navigation\"><ul id=\"menu-story\"></ul><ul id=\"menu-core\"><li id=\"menu-item-saves\"><a tabindex=\"0\">${L10n.get(\"savesTitle\")}</a></li><li id=\"menu-item-settings\"><a tabindex=\"0\">${L10n.get(\"settingsTitle\")}</a></li><li id=\"menu-item-restart\"><a tabindex=\"0\">${L10n.get(\"restartTitle\")}</a></li><li id=\"menu-item-share\"><a tabindex=\"0\">${L10n.get(\"shareTitle\")}</a></li></ul></nav></div></div>`)})();var $backward,$forward;_$uiBar=jQuery($elems.find(\"#ui-bar\").get(0)),$elems.insertBefore(\"body>script#script-sugarcube\"),jQuery(document).on(\":historyupdate.ui-bar\",($backward=jQuery(\"#history-backward\"),$forward=jQuery(\"#history-forward\"),()=>{$backward.ariaDisabled(State.length<2),$forward.ariaDisabled(State.length===State.size)}))}},isHidden:{value:function(){return _$uiBar&&\"none\"===_$uiBar.css(\"display\")}},isStowed:{value:function(){return _$uiBar&&_$uiBar.hasClass(\"stowed\")}},show:{value:function(){return _$uiBar&&_$uiBar.show(),this}},start:{value:function(){_$uiBar&&((\"boolean\"==typeof Config.ui.stowBarInitially?Config.ui.stowBarInitially:jQuery(window).width()<=Config.ui.stowBarInitially)&&uiBarStow(!0),jQuery(\"#ui-bar-toggle\").ariaClick({label:L10n.get(\"uiBarToggle\")},(()=>_$uiBar.toggleClass(\"stowed\"))),jQuery(\"#history-backward\").ariaDisabled(State.length<2).ariaClick({label:L10n.get(\"uiBarBackward\")},(()=>Engine.backward())),Story.lookup(\"tags\",\"bookmark\").length>0?jQuery(\"#history-jumpto\").ariaClick({label:L10n.get(\"uiBarJumpto\")},(()=>UI.jumpto())):jQuery(\"#history-jumpto\").remove(),jQuery(\"#history-forward\").ariaDisabled(State.length===State.size).ariaClick({label:L10n.get(\"uiBarForward\")},(()=>Engine.forward())),Config.history.controls||jQuery(\"#ui-bar-history\").hide(),Story.has(\"StoryDisplayTitle\")?setDisplayTitle(Story.get(\"StoryDisplayTitle\").processText()):jQuery(\"#story-title\").text(Story.title),Story.has(\"StoryCaption\")||jQuery(\"#story-caption\").remove(),Story.has(\"StoryMenu\")||jQuery(\"#menu-story\").remove(),Config.ui.updateStoryElements||uiBarUpdate(),jQuery(\"#menu-item-saves a\").ariaClick({role:\"button\"},(ev=>{ev.preventDefault(),idb.active?(Dialog.create(\"saves\",\"saves\").append($(document.createElement(\"h3\")).addClass(\"saves-loading\").text(\"Loading the save list, please wait...\")),idb.saveList()):UI.buildSaves(),Dialog.open()})).text(L10n.get(\"savesTitle\")),Setting.isEmpty()?jQuery(\"#menu-item-settings\").remove():jQuery(\"#menu-item-settings a\").ariaClick({role:\"button\"},(ev=>{ev.preventDefault(),UI.buildSettings(),Dialog.open()})).text(L10n.get(\"settingsTitle\")),jQuery(\"#menu-item-restart a\").ariaClick({role:\"button\"},(ev=>{ev.preventDefault(),UI.buildRestart(),Dialog.open()})).text(L10n.get(\"restartTitle\")),Story.has(\"StoryShare\")?jQuery(\"#menu-item-share a\").ariaClick({role:\"button\"},(ev=>{ev.preventDefault(),UI.buildShare(),Dialog.open()})).text(L10n.get(\"shareTitle\")):jQuery(\"#menu-item-share\").remove())}},stow:{value:uiBarStow},unstow:{value:function(noAnimation){if(_$uiBar&&_$uiBar.hasClass(\"stowed\")){let $story;noAnimation&&($story=jQuery(\"#story\"),$story.addClass(\"no-transition\"),_$uiBar.addClass(\"no-transition\")),_$uiBar.removeClass(\"stowed\"),noAnimation&&setTimeout((()=>{$story.removeClass(\"no-transition\"),_$uiBar.removeClass(\"no-transition\")}),Engine.minDomActionDelay)}return this}},update:{value:uiBarUpdate},setStoryElements:{value:uiBarUpdate}}))})(),DebugBar=(()=>{const _variableRe=new RegExp(`^${Patterns.variable}$`),_numericKeyRe=/^\\d+$/,_watchList=[];let _$debugBar=null,_$watchBody=null,_$watchList=null,_$turnSelect=null,_stowed=!0;function debugBarStow(){_$debugBar.css(\"right\",`-${_$debugBar.outerWidth()}px`),_stowed=!0,_updateSession()}function debugBarUnstow(){_$debugBar.css(\"right\",0),_stowed=!1,_updateSession()}function debugBarToggle(){_stowed?debugBarUnstow():debugBarStow()}function debugBarWatchAdd(varName){_variableRe.test(varName)&&(_watchList.pushUnique(varName),_watchList.sort(),_updateWatchBody(),_updateWatchList(),_updateSession())}function debugBarWatchAddAll(){Object.keys(State.variables).map((name=>_watchList.pushUnique(`$${name}`))),Object.keys(State.temporary).map((name=>_watchList.pushUnique(`_${name}`))),_watchList.sort(),_updateWatchBody(),_updateWatchList(),_updateSession()}function debugBarWatchClear(){for(let i=_watchList.length-1;i>=0;--i)_watchList.pop();_updateWatchBody(),_updateWatchList(),_updateSession()}function debugBarWatchDelete(varName){_watchList.delete(varName),_updateWatchBody(),_updateWatchList(),_updateSession()}function debugBarWatchDisable(){_debugBarWatchDisableNoUpdate(),_updateSession()}function debugBarWatchEnable(){_debugBarWatchEnableNoUpdate(),_updateSession()}function debugBarWatchIsEnabled(){return!_$watchBody.attr(\"hidden\")}function debugBarWatchToggle(){_$watchBody.attr(\"hidden\")?debugBarWatchEnable():debugBarWatchDisable()}function _debugBarWatchDisableNoUpdate(){_$watchBody.attr({\"aria-hidden\":!0,hidden:\"hidden\"})}function _debugBarWatchEnableNoUpdate(){_$watchBody.removeAttr(\"aria-hidden hidden\")}function _clearSession(){session.delete(\"debugState\")}function _hasSession(){return session.has(\"debugState\")}function _updateSession(){session.set(\"debugState\",{stowed:_stowed,watchList:_watchList,watchEnabled:debugBarWatchIsEnabled(),viewsEnabled:DebugView.isEnabled()})}function _updateWatchBody(){if(0===_watchList.length)return void _$watchBody.empty().append(`<div>${L10n.get(\"debugBarNoWatches\")}</div>`);const delLabel=L10n.get(\"debugBarDeleteWatch\"),$table=jQuery(document.createElement(\"table\")),$tbody=jQuery(document.createElement(\"tbody\"));for(let i=0,len=_watchList.length;i<len;++i){const varName=_watchList[i],varKey=varName.slice(1),store=\"$\"===varName[0]?State.variables:State.temporary,$row=jQuery(document.createElement(\"tr\")),$delBtn=jQuery(document.createElement(\"button\")),$code=jQuery(document.createElement(\"code\"));$delBtn.addClass(\"watch-delete\").attr(\"data-name\",varName).ariaClick({one:!0,label:delLabel},(()=>debugBarWatchDelete(varName))),$code.text(_toWatchString(store[varKey])),jQuery(document.createElement(\"td\")).append($delBtn).appendTo($row),jQuery(document.createElement(\"td\")).text(varName).appendTo($row),jQuery(document.createElement(\"td\")).append($code).appendTo($row),$row.appendTo($tbody)}$table.append($tbody),_$watchBody.empty().append($table)}function _updateWatchList(){const svn=Object.keys(State.variables),tvn=Object.keys(State.temporary);if(0===svn.length&&0===tvn.length)return void _$watchList.empty();const names=[...svn.map((name=>`$${name}`)),...tvn.map((name=>`_${name}`))].sort(),options=document.createDocumentFragment();names.delete(_watchList);for(let i=0,len=names.length;i<len;++i)jQuery(document.createElement(\"option\")).val(names[i]).appendTo(options);_$watchList.empty().append(options)}function _updateTurnSelect(){const histLen=State.size,expLen=State.expired.length,options=document.createDocumentFragment();for(let i=0;i<histLen;++i)jQuery(document.createElement(\"option\")).val(i).text(`${expLen+i+1}. ${Util.escape(State.history[i].title)}`).appendTo(options);_$turnSelect.empty().ariaDisabled(histLen<2).append(options).val(State.activeIndex)}function _toWatchString(value){if(null===value)return\"null\";switch(typeof value){case\"number\":if(Number.isNaN(value))return\"NaN\";if(!Number.isFinite(value))return\"Infinity\";case\"boolean\":case\"symbol\":case\"undefined\":return String(value);case\"string\":return JSON.stringify(value);case\"function\":return\"Function\"}const objType=Util.toStringTag(value);if(\"Date\"===objType)return`Date {${value.toLocaleString()}}`;if(\"RegExp\"===objType)return`RegExp ${value.toString()}`;const result=[];if(value instanceof Array||value instanceof Set){const list=value instanceof Array?value:Array.from(value);for(let i=0,len=list.length;i<len;++i)result.push(list.hasOwnProperty(i)?_toWatchString(list[i]):\"<empty>\");return Object.keys(list).filter((key=>!_numericKeyRe.test(key))).forEach((key=>result.push(`${_toWatchString(key)}: ${_toWatchString(list[key])}`))),`${objType}(${list.length}) [${result.join(\", \")}]`}return value instanceof Map?(value.forEach(((val,key)=>result.push(`${_toWatchString(key)} → ${_toWatchString(val)}`))),`${objType}(${value.size}) {${result.join(\", \")}}`):(Object.keys(value).forEach((key=>result.push(`${_toWatchString(key)}: ${_toWatchString(value[key])}`))),`${objType} {${result.join(\", \")}}`)}return Object.freeze(Object.defineProperties({},{init:{value:function(){const barToggleLabel=L10n.get(\"debugBarToggle\"),watchAddLabel=L10n.get(\"debugBarAddWatch\"),watchAllLabel=L10n.get(\"debugBarWatchAll\"),watchNoneLabel=L10n.get(\"debugBarWatchNone\"),watchToggleLabel=L10n.get(\"debugBarWatchToggle\"),viewsToggleLabel=L10n.get(\"debugBarViewsToggle\");jQuery(document.createDocumentFragment()).append(`<div id=\"debug-bar\"><div id=\"debug-bar-watch\"><div>${L10n.get(\"debugBarNoWatches\")}</div>></div><div><button id=\"debug-bar-watch-toggle\" tabindex=\"0\" title=\"${watchToggleLabel}\" aria-label=\"${watchToggleLabel}\">${L10n.get(\"debugBarLabelWatch\")}</button><label id=\"debug-bar-watch-label\" for=\"debug-bar-watch-input\">${L10n.get(\"debugBarLabelAdd\")}</label><input id=\"debug-bar-watch-input\" name=\"debug-bar-watch-input\" type=\"text\" list=\"debug-bar-watch-list\" tabindex=\"0\"><datalist id=\"debug-bar-watch-list\" aria-hidden=\"true\" hidden=\"hidden\"></datalist><button id=\"debug-bar-watch-add\" tabindex=\"0\" title=\"${watchAddLabel}\" aria-label=\"${watchAddLabel}\"></button><button id=\"debug-bar-watch-all\" tabindex=\"0\" title=\"${watchAllLabel}\" aria-label=\"${watchAllLabel}\"></button><button id=\"debug-bar-watch-none\" tabindex=\"0\" title=\"${watchNoneLabel}\" aria-label=\"${watchNoneLabel}\"></button></div><div><button id=\"debug-bar-views-toggle\" tabindex=\"0\" title=\"${viewsToggleLabel}\" aria-label=\"${viewsToggleLabel}\">${L10n.get(\"debugBarLabelViews\")}</button><label id=\"debug-bar-turn-label\" for=\"debug-bar-turn-select\">${L10n.get(\"debugBarLabelTurn\")}</label><select id=\"debug-bar-turn-select\" tabindex=\"0\"></select></div><button id=\"debug-bar-toggle\" tabindex=\"0\" title=\"${barToggleLabel}\" aria-label=\"${barToggleLabel}\"></button></div><div id=\"debug-bar-hint\"></div>`).appendTo(\"body\"),_$debugBar=jQuery(\"#debug-bar\"),_$watchBody=jQuery(_$debugBar.find(\"#debug-bar-watch\").get(0)),_$watchList=jQuery(_$debugBar.find(\"#debug-bar-watch-list\").get(0)),_$turnSelect=jQuery(_$debugBar.find(\"#debug-bar-turn-select\").get(0));const $barToggle=jQuery(_$debugBar.find(\"#debug-bar-toggle\").get(0)),$watchToggle=jQuery(_$debugBar.find(\"#debug-bar-watch-toggle\").get(0)),$watchInput=jQuery(_$debugBar.find(\"#debug-bar-watch-input\").get(0)),$watchAdd=jQuery(_$debugBar.find(\"#debug-bar-watch-add\").get(0)),$watchAll=jQuery(_$debugBar.find(\"#debug-bar-watch-all\").get(0)),$watchNone=jQuery(_$debugBar.find(\"#debug-bar-watch-none\").get(0)),$viewsToggle=jQuery(_$debugBar.find(\"#debug-bar-views-toggle\").get(0));$barToggle.ariaClick(debugBarToggle),$watchToggle.ariaClick(debugBarWatchToggle),$watchInput.on(\":addwatch\",(function(){debugBarWatchAdd(this.value.trim()),this.value=\"\"})).on(\"keypress\",(ev=>{13===ev.which&&(ev.preventDefault(),$watchInput.trigger(\":addwatch\"))})),$watchAdd.ariaClick((()=>$watchInput.trigger(\":addwatch\"))),$watchAll.ariaClick(debugBarWatchAddAll),$watchNone.ariaClick(debugBarWatchClear),_$turnSelect.on(\"change\",(function(){Engine.goTo(Number(this.value))})),$viewsToggle.ariaClick((()=>{DebugView.toggle(),_updateSession()})),jQuery(document).on(\":historyupdate.debug-bar\",_updateTurnSelect).on(\":passageend.debug-bar\",(()=>{_updateWatchBody(),_updateWatchList()})).on(\":enginerestart.debug-bar\",_clearSession),_hasSession()||DebugView.enable()}},isStowed:{value:function(){return _stowed}},start:{value:function(){(function(){if(!_hasSession())return!1;const debugState=session.get(\"debugState\");_stowed=debugState.stowed,_watchList.push(...debugState.watchList),debugState.watchEnabled?_debugBarWatchEnableNoUpdate():_debugBarWatchDisableNoUpdate();debugState.viewsEnabled?DebugView.enable():DebugView.disable()})(),_stowed?debugBarStow():debugBarUnstow(),_updateTurnSelect(),_updateWatchBody(),_updateWatchList()}},stow:{value:debugBarStow},toggle:{value:debugBarToggle},unstow:{value:debugBarUnstow},watch:{value:Object.freeze(Object.defineProperties({},{add:{value:debugBarWatchAdd},all:{value:debugBarWatchAddAll},clear:{value:debugBarWatchClear},delete:{value:debugBarWatchDelete},disable:{value:debugBarWatchDisable},enable:{value:debugBarWatchEnable},isEnabled:{value:debugBarWatchIsEnabled},toggle:{value:debugBarWatchToggle}}))}}))})(),LoadScreen=(()=>{const _locks=new Set;let _autoId=0;function loadScreenHide(){jQuery(document.documentElement).removeAttr(\"data-init\")}function loadScreenShow(){jQuery(document.documentElement).attr(\"data-init\",\"loading\")}return Object.freeze(Object.defineProperties({},{init:{value:function(){jQuery(document).on(\"readystatechange.SugarCube\",(()=>{_locks.size>0||(\"complete\"===document.readyState?\"loading\"===jQuery(document.documentElement).attr(\"data-init\")&&(Config.loadDelay>0?setTimeout((()=>{0===_locks.size&&loadScreenHide()}),Math.max(Engine.minDomActionDelay,Config.loadDelay)):loadScreenHide()):loadScreenShow())}))}},clear:{value:function(){jQuery(document).off(\"readystatechange.SugarCube\"),_locks.clear(),loadScreenHide()}},hide:{value:loadScreenHide},show:{value:loadScreenShow},lock:{value:function(){return++_autoId,_locks.add(_autoId),loadScreenShow(),_autoId}},unlock:{value:function(id){if(null==id)throw new Error(\"LoadScreen.unlock called with a null or undefined ID\");_locks.has(id)&&_locks.delete(id),0===_locks.size&&jQuery(document).trigger(\"readystatechange\")}}}))})();const idb=(()=>{if(null==window.indexedDB)return Object.freeze({lock:!0,init:()=>!1,get active(){return!1},set active(_){return!1},get footerHTML(){return!1},set footerHTML(_){return!1}});let lock=!0,active=!0,dbName=\"idb\",migrationNeeded=!1,open=!1,settings={};updateSettings();let db,saveDetails=[],openRequest=null;function openDB(name=dbName){return new Promise(((resolve,reject)=>{dbName=name,openRequest=indexedDB.open(idb.dbName),openRequest.onupgradeneeded=event=>{if(console.log(\"updating idb\",event.oldVersion),0===event.oldVersion)openRequest.result.createObjectStore(\"saves\",{keyPath:\"slot\"}),openRequest.result.createObjectStore(\"details\",{keyPath:\"slot\"}),migrationNeeded=!0},openRequest.onerror=()=>{console.log(\"error opening idb\",openRequest.error),reject(openRequest.error)},openRequest.onsuccess=()=>{db=openRequest.result,lock=!1,open=!0,getSaveDetails().then((d=>saveDetails=d)),console.log(\"idbOpen success\"),navigator.storage&&\"function\"==typeof navigator.storage.persist&&navigator.storage.persist(),db.onclose=ev=>{open=!1,active=!1,console.log(\"idb connection closed, this shouldn't happen\",ev),Errors?Errors.report(\"ERROR: idb connection closed unexpectedly\",ev):alert(\"ERROR: idb connection closed unexpectedly\")},db.onerror=ev=>{console.error(`Database error: ${ev.target.errorCode}`),active=!1},migrationNeeded&&(importFromLocalStorage(),migrationNeeded=!1),resolve(db)},openRequest.onblocked=()=>{console.log(\"something went wrong\",openRequest.error),reject(openRequest.error)}}))}function updateSettings(setting,value){settings=JSON.parse(localStorage.getItem(\"idb-settings\"))||{warnSave:V.confirmSave||!1,warnLoad:V.confirmLoad||!1,warnDelete:V.confirmDelete||!0,active:!window.FCHostPersistent,useDelta:!1},setting&&(settings[setting]=value),active=settings.active,localStorage.setItem(\"idb-settings\",JSON.stringify(settings))}updateSettings();const baddies=[];function funNuke(target,path=\"\",verbose=!0){if(!target)return console.log(\"no target specified\");for(const key in target){const value=target[key],newPath=`${path}['${key}']`;null!=value&&(\"function\"==typeof value||value.toJSON?(verbose&&V.idbTest&&console.log(`Warn: ${newPath} of type ${typeof value} shouldn't be in STORY variables!!!`),target[key]=JSON.stringify(value),baddies.push(newPath)):\"object\"==typeof value&&funNuke(value,newPath,verbose))}}function ekuNnuf(target=V,paths){function revive(target,path){if(\"string\"!=typeof path||\"\"===path)return console.log(\"Warn: invalid path\",clone(path));const accessors=path.slice(2,-2).split(\"']['\");let ref=target;for(let i=0,destination=accessors.length-1;i<=destination;i++)i===destination?ref[accessors[i]]=JSON.parse(ref[accessors[i]]):ref=ref[accessors[i]];return!0}let path=\"\";for(;path=paths.shift();)try{revive(target,path)}catch(ex){console.log(\"WARN: couldn't restore story var function\",path)}}async function importFromLocalStorage(){function processSave(saveObj){const save=saveObj.state;save.jdelta&&delete save.jdelta,save.delta&&(save.history=State.deltaDecode(save.delta)),delete save.delta,window.DoLSave&&DoLSave.decompressIfNeeded({state:save});const vars=save.history[save.index].variables;if(!vars.saveId){const saveId=Math.floor(9e4*Math.random())+1e4;save.history.forEach((s=>s.variables.saveId=saveId))}return[save,{date:saveObj.date,id:saveObj.id,title:saveObj.title,metadata:saveObj.metadata||{saveId:vars.saveId,saveName:vars.saveName}}]}let mtCount=0;const oldSaves=Save.get();if(null!=oldSaves.autosave){const saveData=processSave(save);await setItem(0,saveData[0],{slot:0,data:saveData[1]})}else mtCount++;for(let i=0;i<oldSaves.slots.length;i++){const slotSave=oldSaves.slots[i];if(null!=slotSave){const saveData=processSave(slotSave);await setItem(i+1,saveData[0],{slot:i+1,data:saveData[1]})}else mtCount++}if(mtCount===oldSaves.slots.length+1){const index=storage.get(\"index\");if(index&&index.slots){const autosave=storage.get(\"autosave\");if(autosave){const saveData=processSave(autosave);await setItem(0,saveData[0],{slot:0,data:saveData[1]})}for(let i=0;i<index.slots.length;i++){const slotSave=storage.get(\"slot\"+i);if(!slotSave)continue;const saveData=processSave(slotSave);await setItem(i+1,saveData[0],{slot:i+1,data:saveData[1]})}}}return await getSaveDetails().then((d=>saveDetails=d)),console.log(\"idb migration successful\"),!0}function makePromise(transaction){return new Promise(((resolve,reject)=>{transaction.onsuccess=()=>(lock=!1,resolve(transaction.result)),transaction.oncomplete=()=>(lock=!1,resolve(transaction.result)),transaction.onerror=ev=>(lock=!1,active=!1,console.log(transaction.error,ev,\"error\"),reject(transaction.error)),transaction.onabort=()=>(lock=!1,console.log(\"aborted\",transaction.error),reject(transaction.error))}))}async function getItem(slot){open||await openDB();return makePromise(db.transaction(\"saves\",\"readonly\").objectStore(\"saves\").get(slot))}async function setItem(slot,saveObj,details){if(lock)return;if(null==saveObj||!saveObj.hasOwnProperty(\"history\"))return!1;lock=!0;const savesItem={slot:slot,data:saveObj},saveVars=saveObj.history[saveObj.index].variables,metadata={saveId:saveVars.saveId,saveName:saveVars.saveName},detailsItem=details||{slot:slot,data:{id:Story.domId,title:Story.get(State.passage).description(),date:Date.now(),metadata:metadata}};detailsItem.slot=slot;try{open||await openDB();let counter=0;saveObj.history.forEach((s=>{baddies.splice(0),funNuke(s.variables,\"\",!counter++),baddies.length&&(s.baddies=clone(baddies))})),settings.useDelta&&(saveObj.delta=State.deltaEncode(saveObj.history),delete saveObj.history);const transactionRequest=db.transaction([\"saves\",\"details\"],\"readwrite\");return transactionRequest.objectStore(\"saves\").delete(slot),transactionRequest.objectStore(\"saves\").add(savesItem),transactionRequest.objectStore(\"details\").delete(slot),transactionRequest.objectStore(\"details\").add(detailsItem),makePromise(transactionRequest)}catch(ex){return window.Errors?Errors.report(`idb.setItem failure unknown. Couldn't complete the save in slot ${slot}`):alert(`idb.setItem failure unknown. Couldn't complete the save in slot ${slot}`),lock=!1,new Promise((resolve=>resolve(!1)))}}async function deleteItem(slot){if(lock)return;open||await openDB(),lock=!0;const transactionRequest=db.transaction([\"saves\",\"details\"],\"readwrite\");return transactionRequest.objectStore(\"saves\").delete(slot),transactionRequest.objectStore(\"details\").delete(slot),makePromise(transactionRequest).then(await getSaveDetails().then((d=>saveDetails=d)))}function loadState(slot){if(!lock)return getItem(slot).then((value=>{if(null==value)return!1;value.data.delta&&(value.data.history=State.deltaDecode(value.data.delta),delete value.data.delta),value.data.history.forEach((s=>{s.baddies&&(ekuNnuf(s.variables,s.baddies),delete s.baddies)})),Save.onLoad.handlers.forEach((fn=>fn({state:value.data}))),State.unmarshalForSave(value.data),State.show()}))}async function saveState(slot){if(lock)return;const saveObj=State.marshalForSave();if(!V.saveId){const saveId=Math.floor(9e4*Math.random())+1e4;V.saveId=saveId,State.history.forEach((s=>s.variables.saveId=saveId)),saveObj.history.forEach((s=>s.variables.saveId=saveId))}return Save.onSave.handlers.forEach((fn=>fn({state:saveObj,date:Date.now()},{type:slot<=0?\"autosave\":\"slot\"}))),null!=saveObj&&(await setItem(slot,saveObj),await getSaveDetails().then((d=>saveDetails=d)),!0)}async function getSaveDetails(){open||await openDB();return makePromise(db.transaction([\"details\"],\"readonly\").objectStore(\"details\").getAll())}async function clearAll(){if(lock)return;open||await openDB();const transactionRequest=db.transaction([\"saves\",\"details\"],\"readwrite\");return transactionRequest.objectStore(\"saves\").clear(),transactionRequest.objectStore(\"details\").clear(),saveDetails=[],makePromise(transactionRequest)}function savesAllowed(){return\"function\"!=typeof Config.saves.isAllowed||Config.saves.isAllowed()}let listLength,listPage;const listLengthMax=20,listPageMax=20;let extraSaveWarn,latestSave={slot:1,date:0},footerHTML=\"\";function generateSavesPage(page=listPage-1,length=listLength){const listContainer=document.createElement(\"div\");listContainer.id=\"saves-list-container\",listContainer.appendChild(function(){const frag=document.createDocumentFragment(),saveListHeader=document.createElement(\"div\");saveListHeader.className=\"savesListRow\",frag.appendChild(saveListHeader);const headerSaveGroup=document.createElement(\"div\");headerSaveGroup.className=\"saveGroup\",saveListHeader.appendChild(headerSaveGroup);const headerSaveId=document.createElement(\"div\");headerSaveId.className=\"saveId\",headerSaveId.innerText=\"#\",headerSaveGroup.appendChild(headerSaveId);const headerSaveButton=document.createElement(\"div\");headerSaveButton.className=\"saveButton\",headerSaveButton.innerText=L10n.get(\"savesHeaderSaveLoad\"),headerSaveGroup.appendChild(headerSaveButton);const headerSaveName=document.createElement(\"div\");headerSaveName.className=\"saveName\",headerSaveName.innerText=L10n.get(\"savesHeaderIDName\"),headerSaveGroup.appendChild(headerSaveName);const headerSaveDetails=document.createElement(\"div\");headerSaveDetails.className=\"saveDetails\",headerSaveDetails.innerText=L10n.get(\"savesHeaderDetails\"),headerSaveGroup.appendChild(headerSaveDetails);const headerDeleteButton=document.createElement(\"div\");return headerDeleteButton.className=\"deleteButton\",headerSaveGroup.appendChild(headerDeleteButton),frag}());const saveUnlock=savesAllowed();let autoSaveDate;if(latestSave={slot:1,date:0},saveDetails.forEach((d=>{0===d.slot?autoSaveDate=d.data.date:d.data.date>latestSave.date&&(latestSave.slot=d.slot,latestSave.date=d.data.date)})),!listLength){const slot=saveDetails.length?saveDetails.last().slot:0;for(listLength=10;slot>listLength*listPageMax&&listLength<listLengthMax;listLength++);length=listLength}if(!Number.isInteger(page)){const latestSlot=saveDetails.find((d=>d.slot===latestSave.slot));if(latestSlot){const autoSaveExists=0===saveDetails[0].slot,ignoreAutoSave=latestSlot.data.date>autoSaveDate||latestSlot.data.metadata.saveId===saveDetails[0].data.metadata.saveId;page=!autoSaveExists||ignoreAutoSave?Math.floor((latestSave.slot-1)/length):0}else page=0;listPage=page+1}const pageField=document.getElementById(\"pageNum\");null!=pageField&&(pageField.value=listPage);const lengthField=document.getElementById(\"pageLen\");null!=lengthField&&(lengthField.value=listLength);const defaultDetailsObj={date:\"\",title:\"\",metadata:{saveId:\"\",saveName:\"\"}},autoDetailsObj=saveDetails[0]&&0===saveDetails[0].slot?saveDetails[0].data:clone(defaultDetailsObj);autoSaveDate>latestSave.date&&(autoDetailsObj.latestSlot=!0),autoDetailsObj.slot=0,Save.autosave.ok()&&listContainer.appendChild(generateSaveRow(autoDetailsObj));for(let slot=length*page+1;slot<length*(page+1)+1;slot++){let detailsObj=clone(defaultDetailsObj);const detailsIndex=saveDetails.findIndex((d=>d.slot===slot));-1!==detailsIndex&&(detailsObj=saveDetails[detailsIndex].data,Number(latestSave.slot)===slot&&(detailsObj.latestSlot=!0)),detailsObj.slot=slot,detailsObj.saveUnlock=saveUnlock,listContainer.appendChild(generateSaveRow(detailsObj))}return listContainer}function generateSaveRow(details){const row=document.createElement(\"div\");details.latestSlot&&0!==details.slot&&(row.id=\"latestSaveRow\"),row.className=\"savesListRow\";const group=document.createElement(\"div\");group.className=\"saveGroup\";const saveId=document.createElement(\"div\");saveId.className=\"saveId\",saveId.innerText=0===details.slot?\"A\":details.slot,(details.slot>listPageMax*listLengthMax||details.slot<0)&&saveId.classList.add(\"red\");const saveload=document.createElement(\"div\");saveload.className=\"saveButton\";const saveButton=document.createElement(\"button\");saveButton.innerText=L10n.get(\"savesLabelSave\"),details.saveUnlock?(saveButton.className=\"saveMenuButton\",saveButton.onclick=()=>saveList(\"confirm save\",details)):saveButton.disabled=!0;const loadButton=document.createElement(\"button\");loadButton.innerText=L10n.get(\"savesLabelLoad\"),details.date?(loadButton.className=\"saveMenuButton\",loadButton.onclick=()=>saveList(\"confirm load\",details)):loadButton.disabled=!0,0!==details.slot&&saveload.appendChild(saveButton),saveload.appendChild(loadButton);const saveName=document.createElement(\"div\");saveName.className=\"saveName\",V.saveId===details.metadata.saveId&&saveName.classList.add(\"gold\"),saveName.innerText=details.metadata.saveName?details.metadata.saveName.slice(0,10):details.metadata.saveId;const saveDetails=document.createElement(\"div\");saveDetails.className=\"saveDetails\";const description=document.createElement(\"span\");description.innerText=details.title||\" \";const date=document.createElement(\"span\");date.className=\"datestamp\",details.date?(details.latestSlot?date.classList.add(\"green\"):details.date>Date.now()-18e5&&date.classList.add(\"gold\"),date.innerText=new Date(details.date).toLocaleString()):date.innerText=\" \",saveDetails.appendChild(description),saveDetails.appendChild(date);const deleteButton=document.createElement(\"button\");return deleteButton.className=\"deleteButton right\",deleteButton.innerText=L10n.get(\"savesLabelDelete\"),details.date?(deleteButton.classList.add(\"saveMenuButton\"),deleteButton.onclick=()=>saveList(\"confirm delete\",details)):deleteButton.disabled=!0,group.append(saveId,saveload,saveName,saveDetails),row.appendChild(group),row.appendChild(deleteButton),row}const replaceChildren=!!document.body.replaceChildren;async function saveList(mode,details){open||await openDB(),active&&!settings.active&&updateSettings(\"active\",!0),mode||(await getSaveDetails().then((d=>saveDetails=d)),mode=\"show saves\"),await new Promise((r=>setTimeout((()=>r(!0)),0)));const savesDiv=document.getElementById(\"saveList\")||document.getElementsByClassName(\"saveList\")[0]||document.getElementsByClassName(\"saves\")[0],list=document.createDocumentFragment(),cancelButton=document.createElement(\"button\");function generateOldSaveDescription(details){const oldSaveDescription=document.createDocumentFragment();if(!details||!details.date)return oldSaveDescription;const oldSaveTitle=document.createElement(\"p\");oldSaveTitle.innerText=`${L10n.get(\"savesDescTitle\")} ${details.title}`;const oldSaveData=document.createElement(\"p\");return oldSaveData.innerText=`${details.metadata.saveName?L10n.get(\"savesDescName\")+details.metadata.saveName:L10n.get(\"savesDescId\")+details.metadata.saveId} ${L10n.get(\"savesDescDate\")} ${new Date(details.date).toLocaleString()}`,oldSaveDescription.append(oldSaveTitle,oldSaveData),oldSaveDescription}switch(cancelButton.className=\"saveMenuButton saveMenuConfirm\",cancelButton.innerText=L10n.get(\"cancel\"),cancelButton.onclick=()=>saveList(\"show saves\"),mode){case\"show saves\":{if(!savesAllowed()){const notAllowedWarning=document.createElement(\"h3\");notAllowedWarning.className=\"red\",notAllowedWarning.innerText=V.replayScene?L10n.get(\"savesDisallowedReplay\"):L10n.get(\"savesDisallowed\"),list.appendChild(notAllowedWarning)}const exportReminder=document.createElement(\"p\");if(exportReminder.id=\"saves-export-reminder\",exportReminder.innerText=L10n.get(\"savesExportReminder\"),list.appendChild(exportReminder),extraSaveWarn){const lostSaves=document.createElement(\"p\");lostSaves.innerHTML='<i class=\"description\"><u>Where are my saves?</u></i> ';const lostSavesTooltip=document.createElement(\"mouse\");lostSavesTooltip.classList.add(\"tooltip\",\"linkBlue\"),lostSavesTooltip.innerText=\"(?)\",lostSavesTooltip.appendChild(document.createElement(\"span\")),lostSavesTooltip.lastChild.innerText=\"If you can't find your saves, it's possible you saved them using a different storage method. Try toggling the \\\"Use old legacy storage\\\" option below the saves list.\",lostSaves.appendChild(lostSavesTooltip),list.appendChild(lostSaves)}list.appendChild(generateSavesPage()),list.appendChild(function(){const container=document.createElement(\"ul\");let li;container.className=\"buttons\";const exportButton=document.createElement(\"button\");if(exportButton.id=\"saves-export\",exportButton.className=\"ui-close\",exportButton.innerText=L10n.get(\"savesLabelExport\"),savesAllowed()?(exportButton.onclick=()=>Save.export(),exportButton.classList.add(\"saveMenuButton\")):exportButton.disabled=!0,li=document.createElement(\"li\"),li.appendChild(exportButton),container.appendChild(li),navigator.clipboard){const toClipboardButton=document.createElement(\"button\");toClipboardButton.id=\"saves-toClipboard\",toClipboardButton.className=\"ui-close\",toClipboardButton.innerText=L10n.get(\"savesLabelToClipboard\"),savesAllowed()?(toClipboardButton.onclick=()=>{navigator.clipboard.writeText(Save.serialize()),window.closeOverlay()},toClipboardButton.classList.add(\"saveMenuButton\")):toClipboardButton.disabled=!0,li=document.createElement(\"li\"),li.appendChild(toClipboardButton),container.appendChild(li)}const importButton=document.createElement(\"button\");importButton.id=\"saves-import\",importButton.className=\"saveMenuButton\",importButton.innerText=L10n.get(\"savesLabelImport\"),importButton.onclick=()=>{jQuery(document.createElement(\"input\")).prop(\"type\",\"file\").on(\"change\",SugarCube.Save.import).trigger(\"click\"),window.closeOverlay()},li=document.createElement(\"li\"),li.appendChild(importButton),container.appendChild(li);const clearAllButton=document.createElement(\"button\");return clearAllButton.className=\"saves-clear saveMenuButton\",clearAllButton.innerText=L10n.get(\"savesLabelClear\"),clearAllButton.onclick=()=>saveList(\"confirm clear\"),li=document.createElement(\"li\"),li.appendChild(clearAllButton),container.appendChild(li),container}()),footerHTML&&list.appendChild(function(){if(!footerHTML)return null;const container=document.createElement(\"ul\");return container.className=\"buttons\",container.innerHTML=footerHTML,container}()),list.appendChild(function(){const container=document.createElement(\"ul\");let li;container.className=\"buttons\",li=document.createElement(\"li\"),li.append(L10n.get(\"savesPagerPage\")),container.appendChild(li);const prevPage=document.createElement(\"button\");prevPage.append(\"<\"),listPage>1?(prevPage.classList.add(\"saveMenuButton\"),prevPage.onclick=()=>{--listPage,saveList(\"show saves\")}):prevPage.disabled=!0,li=document.createElement(\"li\"),li.appendChild(prevPage),container.appendChild(li);const pageNum=document.createElement(\"input\");Object.assign(pageNum,{id:\"pageNum\",type:\"number\",value:listPage,style:\"width: 3em\",min:1,max:listPageMax,onchange:()=>{listPage=Math.clamp(Math.round(pageNum.value),1,listPageMax),saveList(\"show saves\")}}),container.appendChild(pageNum);const nextPage=document.createElement(\"button\");nextPage.append(\">\"),listPage<listPageMax?(nextPage.classList.add(\"saveMenuButton\"),nextPage.onclick=()=>{++listPage,saveList(\"show saves\")}):nextPage.disabled=!0,nextPage.onclick=()=>{listPage<listPageMax&&listPage++,saveList(\"show saves\")},li=document.createElement(\"li\"),li.appendChild(nextPage),container.appendChild(li),li=document.createElement(\"li\"),li.append(L10n.get(\"savesPagerSavesPerPage\")),container.appendChild(li);const pageLen=document.createElement(\"input\");Object.assign(pageLen,{id:\"pageLen\",type:\"number\",value:listLength,style:\"width: 3em\",min:1,max:listLengthMax,onchange:()=>{listLength=Math.clamp(pageLen.value,1,listLengthMax),saveList(\"show saves\")}}),li=document.createElement(\"li\"),li.append(pageLen),container.appendChild(li);const jumpToLatest=document.createElement(\"button\");return jumpToLatest.className=\"saveMenuButton\",jumpToLatest.innerText=L10n.get(\"savesPagerJump\"),jumpToLatest.onclick=()=>{listPage=Math.floor((latestSave.slot-1)/listLength+1),saveList(\"show saves\"),setTimeout((()=>{const el=document.getElementById(\"latestSaveRow\");null!=el&&(el.classList.remove(\"jumpToSaveTransition\"),el.classList.add(\"jumpToSaveTransition\"))}),Engine.minDomActionDelay+100)},li=document.createElement(\"li\"),li.appendChild(jumpToLatest),container.appendChild(li),container}());let li,ul=document.createElement(\"ul\");ul.className=\"buttons\",li=document.createElement(\"li\"),li.append(L10n.get(\"savesOptionsConfirmOn\")),ul.appendChild(li);const reqSaveLabel=document.createElement(\"label\");reqSaveLabel.innerText=L10n.get(\"savesOptionsOverwrite\");const reqSave=document.createElement(\"input\");reqSave.type=\"checkbox\",reqSave.checked=settings.warnSave,reqSave.onchange=()=>updateSettings(\"warnSave\",reqSave.checked),reqSaveLabel.appendChild(reqSave),li=document.createElement(\"li\"),li.appendChild(reqSaveLabel),ul.appendChild(li);const reqLoadLabel=document.createElement(\"label\");reqLoadLabel.innerText=L10n.get(\"savesLabelLoad\");const reqLoad=document.createElement(\"input\");reqLoad.type=\"checkbox\",reqLoad.checked=settings.warnLoad,reqLoad.onchange=()=>updateSettings(\"warnLoad\",reqLoad.checked),reqLoadLabel.appendChild(reqLoad),li=document.createElement(\"li\"),li.appendChild(reqLoadLabel),ul.append(\"|\",li);const reqDeleteLabel=document.createElement(\"label\");reqDeleteLabel.innerText=L10n.get(\"savesLabelDelete\");const reqDelete=document.createElement(\"input\");reqDelete.type=\"checkbox\",reqDelete.checked=settings.warnDelete,reqDelete.onchange=()=>updateSettings(\"warnDelete\",reqDelete.checked),reqDeleteLabel.appendChild(reqDelete),li=document.createElement(\"li\"),li.appendChild(reqDeleteLabel),ul.append(\"|\",li),ul.append(document.createElement(\"li\")),list.append(ul),ul=document.createElement(\"ul\"),ul.className=\"buttons\";const idbtoggle=document.createElement(\"button\");idbtoggle.id=\"saves-idb-toggle\",idbtoggle.className=\"saveMenuButton\",idbtoggle.innerText=L10n.get(\"savesOptionsUseLegacy\"),idbtoggle.onclick=()=>{updateSettings(\"active\",!1),window.DoLSave?$.wiki(\"<<replace #saveList>><<saveList>><</replace>>\"):UI.buildSaves()},li=document.createElement(\"li\"),li.appendChild(idbtoggle),ul.appendChild(li),list.appendChild(ul),setTimeout((()=>{replaceChildren?savesDiv.replaceChildren(list):(savesDiv.innerHTML=\"\",savesDiv.appendChild(list));const pageField=document.getElementById(\"pageNum\");null!=pageField&&(pageField.value=listPage);const lengthField=document.getElementById(\"pageLen\");null!=lengthField&&(lengthField.value=listLength),Dialog.resize()}),Engine.minDomActionDelay);break}case\"confirm save\":{if(!details.date||!settings.warnSave&&details.metadata.saveId===V.saveId)return saveState(details.slot).then(window.closeOverlay());const confirmSaveWarning=document.createElement(\"div\");confirmSaveWarning.className=\"saveBorder\";const confirmSaveWarningTitle=document.createElement(\"h3\");if(confirmSaveWarningTitle.className=\"red\",confirmSaveWarningTitle.innerText=`${\"\"===details.date?L10n.get(\"savesWarningSaveOnSlot\"):L10n.get(\"savesWarningOverwriteSlot\")} ${details.slot}?`,details.date&&V.saveId!==details.metadata.saveId){const overwriteWarning=document.createElement(\"span\");overwriteWarning.className=\"red\",overwriteWarning.innerText=L10n.get(\"savesWarningOverwriteID\")}const saveButton=document.createElement(\"input\");Object.assign(saveButton,{type:\"button\",className:\"saveMenuButton saveMenuConfirm\",value:L10n.get(\"savesLabelSave\"),onclick:()=>saveState(details.slot).then((()=>window.closeOverlay()))}),confirmSaveWarning.append(confirmSaveWarningTitle,generateOldSaveDescription(details),saveButton,cancelButton),list.appendChild(confirmSaveWarning),setTimeout((()=>{replaceChildren?savesDiv.replaceChildren(list):(savesDiv.innerHTML=\"\",savesDiv.appendChild(list))}),Engine.minDomActionDelay);break}case\"confirm delete\":{if(!settings.warnDelete)return deleteItem(details.slot).then((()=>saveList(\"show saves\")));const confirmDeleteWarning=document.createElement(\"div\");confirmDeleteWarning.className=\"saveBorder\";const confirmDeleteWarningTitle=document.createElement(\"h3\");confirmDeleteWarningTitle.className=\"red\",confirmDeleteWarningTitle.innerText=`${L10n.get(\"savesWarningDeleteInSlot\")+(0===details.slot?\"auto\":details.slot)}?`;const deleteButton=document.createElement(\"input\");Object.assign(deleteButton,{type:\"button\",className:\"saveMenuButton saveMenuConfirm\",value:L10n.get(\"savesLabelDelete\"),onclick:()=>deleteItem(details.slot).then((()=>saveList(\"show saves\")))}),confirmDeleteWarning.append(confirmDeleteWarningTitle,generateOldSaveDescription(details),deleteButton,cancelButton),list.appendChild(confirmDeleteWarning),setTimeout((()=>{replaceChildren?savesDiv.replaceChildren(list):(savesDiv.innerHTML=\"\",savesDiv.appendChild(list))}),Engine.minDomActionDelay);break}case\"confirm load\":{if(!settings.warnLoad)return loadState(details.slot).then((()=>window.closeOverlay()));const confirmLoad=document.createElement(\"div\");confirmLoad.className=\"saveBorder\";const confirmLoadTitle=document.createElement(\"h3\");confirmLoadTitle.className=\"red\",confirmLoadTitle.innerText=`${L10n.get(\"savesWarningLoad\")+(0===details.slot?\"auto\":details.slot)}?`;const loadButton=document.createElement(\"input\");Object.assign(loadButton,{type:\"button\",className:\"saveMenuButton saveMenuConfirm\",value:L10n.get(\"savesLabelLoad\"),onclick:()=>idb.loadState(details.slot).then((()=>window.closeOverlay()))}),confirmLoad.append(confirmLoadTitle,generateOldSaveDescription(details),loadButton,cancelButton),list.appendChild(confirmLoad),setTimeout((()=>{replaceChildren?savesDiv.replaceChildren(list):(savesDiv.innerHTML=\"\",savesDiv.appendChild(list))}),Engine.minDomActionDelay);break}case\"confirm clear\":{const confirmClear=document.createElement(\"div\");confirmClear.className=\"saveBorder\";const confirmClearTitle=document.createElement(\"h2\");confirmClearTitle.className=\"red\",confirmClearTitle.innerText=L10n.get(\"savesWarningDeleteAll\");const clearButton=document.createElement(\"input\");Object.assign(clearButton,{type:\"button\",className:\"saveMenuButton saveMenuConfirm\",value:L10n.get(\"savesLabelClear\"),onclick:()=>clearAll().then((()=>saveList(\"show saves\")))}),confirmClear.append(confirmClearTitle,clearButton,cancelButton),list.appendChild(confirmClear),setTimeout((()=>{replaceChildren?savesDiv.replaceChildren(list):(savesDiv.innerHTML=\"\",savesDiv.appendChild(list))}),Engine.minDomActionDelay);break}}}return void 0===window.closeOverlay&&(window.closeOverlay=Dialog.close),Object.freeze({get dbName(){return dbName},set dbName(val){dbName=val},get lock(){return lock},set lock(val){lock=Boolean(val)},get active(){return active},set active(val){active=val},get listLength(){return listLength},set listLength(val){listLength=val},get listPage(){return listPage},set listPage(val){listPage=val},getItem:getItem,setItem:setItem,deleteItem:deleteItem,clearAll:clearAll,getSaveDetails:getSaveDetails,getAllSaves:async function(){return open||await openDB(),makePromise(db.transaction([\"saves\"],\"readonly\").objectStore(\"saves\").getAll())},saveState:saveState,loadState:loadState,importFromLocalStorage:importFromLocalStorage,saveList:saveList,get footerHTML(){return footerHTML},set footerHTML(val){return footerHTML=val},init:dbName=>openDB(dbName),close:function(){db.close(),open=!1},updateSettings:updateSettings,baddies:baddies,funNuke:funNuke,ekuNnuf:ekuNnuf})})();window.idb=idb;const Links=(()=>{let keyNumberMatcher,maxKeyDescLength,currentLinks=[],numberPrepend=\"(\",numberAppend=\") \",enabled=!0,disableNumbers=!1,disableRNGReload=!1,throttle=!1,shiftDown=!1,skipElements=\".no-numberify, .no-numberify *\",includeElements=\"\";function keyNumberMatcherUpdate(){keyNumberMatcher=new RegExp(RegExp.escape(numberPrepend)+\"((Ctrl|Alt|Shift) \\\\+ )?\\\\d\"+RegExp.escape(numberAppend)),maxKeyDescLength=numberAppend.length+numberPrepend.length+9}function getPrettyKeyNumber(counter){let str=\"\";switch(Math.floor((counter-1)/10)){case 3:str=\"Alt + \";break;case 2:str=\"Ctrl + \";break;case 1:str=\"Shift + \"}return str+=(counter%10).toString(),str}function generateLinkNumbers(content,visibility){if(!enabled||disableNumbers||V.options&&!V.options.numberify_enabled)return;const stamp=performance.now();if(throttle+100>stamp)return throttle=stamp,void generateDebounce();if(throttle=stamp,currentLinks=visibility?$(content).find(\".link-internal\").not(\":hidden\"):$(content).find(\".link-internal\").filter(((i,link)=>\"none\"!==getComputedStyle(link).display)),skipElements&&includeElements){const goodies=$(content).find(includeElements),baddies=$(content).find(skipElements).not(goodies);currentLinks=currentLinks.not(baddies)}else if(skipElements){const baddies=$(content).find(skipElements);currentLinks=currentLinks.not(baddies)}for(let i=0;i<Math.min(currentLinks.length,40);i++){const el=currentLinks[i],keyNumber=numberPrepend+getPrettyKeyNumber(i+1)+numberAppend;keyNumberMatcher.test(el.innerHTML.slice(0,maxKeyDescLength))?el.innerHTML=el.innerHTML.replace(keyNumberMatcher,keyNumber):el.prepend(keyNumber)}\"debug\"===enabled&&console.log(`Links: generated ${currentLinks.length} links, took ${performance.now()-stamp}ms\"`)}function generate(){return generateLinkNumbers(document.getElementsByClassName(\"passage\")[0]||document,!0)}keyNumberMatcherUpdate();const generateDebounce=$.debounce(200,generate);function linkFollow(index){disableNumbers||$(currentLinks).length>=index&&$(currentLinks[index-1].click())}function inputFocused(){return!(![\"INPUT\",\"TEXTAREA\"].includes(document.activeElement.tagName)||[\"radio\",\"button\",\"checkbox\",\"submit\",\"reset\",\"image\"].includes(document.activeElement.type))}return Object.freeze(Object.defineProperties({},{init:{value:function(){$(document).on(\":passagerender\",(ev=>{currentLinks=[],throttle=0,generateLinkNumbers(ev.content)})),$(document).on(\"keydown\",(ev=>{if(ev.code.startsWith(\"Shift\"))return shiftDown=!0;inputFocused()||ev.code.startsWith(\"Numpad\")&&ev.preventDefault()})),$(document).on(\"keyup\",(ev=>{if(ev.code.startsWith(\"Shift\"))return shiftDown=!1;if(!enabled||V.tempDisable||V.options&&!V.options.numberify_enabled||inputFocused())return;if(\"INPUT\"===document.activeElement.tagName&&\"radio\"!==document.activeElement.type&&\"checkbox\"!==document.activeElement.type)return;let offset=0;switch(ev.shiftKey||ev.code.startsWith(\"Numpad\")&&shiftDown?offset=10:ev.ctrlKey?offset=20:ev.altKey&&(offset=30),ev.code){case\"Digit1\":case\"Numpad1\":case\"KeyN\":linkFollow(offset+1);break;case\"Digit2\":case\"Numpad2\":linkFollow(offset+2);break;case\"Digit3\":case\"Numpad3\":linkFollow(offset+3);break;case\"Digit4\":case\"Numpad4\":linkFollow(offset+4);break;case\"Digit5\":case\"Numpad5\":linkFollow(offset+5);break;case\"Digit6\":case\"Numpad6\":linkFollow(offset+6);break;case\"Digit7\":case\"Numpad7\":linkFollow(offset+7);break;case\"Digit8\":case\"Numpad8\":linkFollow(offset+8);break;case\"Digit9\":case\"Numpad9\":linkFollow(offset+9);break;case\"Digit0\":case\"Numpad0\":linkFollow(offset+10);break;case\"NumpadDivide\":ev.shiftKey?Engine.go(-2):Engine.backward();break;case\"NumpadMultiply\":if(disableRNGReload)break;if(State.restore(!0),State.prng.isEnabled()){State.random();State.history[State.activeIndex].pull=State.prng.pull}Engine.show();break;case\"NumpadSubtract\":ev.shiftKey?Engine.go(2):Engine.forward()}}))}},generate:{value:generate},generateLinkNumbers:{value:generateLinkNumbers},pushTheButton:{value:linkFollow},numberPrepend:{get:()=>numberPrepend,set(val){numberPrepend=val,keyNumberMatcherUpdate()}},numberAppend:{get:()=>numberAppend,set(val){numberAppend=val,keyNumberMatcherUpdate()}},skipElements:{get:()=>skipElements,set(val){skipElements=val}},includeElements:{get:()=>includeElements,set(val){includeElements=val}},enabled:{get:()=>enabled,set(val){enabled=val}},disableRNGReload:{get:()=>disableRNGReload,set(val){disableRNGReload=val}},disableNumbers:{get:()=>disableNumbers,set(val){disableNumbers=val}},throttle:{get:()=>throttle,set(val){throttle=val}},currentLinks:{get:()=>currentLinks}}))})();window.Links=Links;var version=Object.freeze({title:\"SugarCube\",major:2,minor:36,patch:1,prerelease:null,build:2,date:new Date(\"2024-08-12T21:03:53.604Z\"),extensions:{},toString(){const prerelease=this.prerelease?`-${this.prerelease}`:\"\";return`${this.major}.${this.minor}.${this.patch}${prerelease}+${this.build}`},short(){const prerelease=this.prerelease?`-${this.prerelease}`:\"\";return`${this.title} (v${this.major}.${this.minor}.${this.patch}${prerelease})`},long(){return`${this.title} v${this.toString()} (${this.date.toUTCString()})`}}),TempState={},macros={},postdisplay={},postrender={},predisplay={},prehistory={},prerender={},session=null,settings={},setup={},storage=null,browser=Browser,config=Config,has=Has,History=State,state=State,tale=Story,TempVariables=State.temporary;window.SugarCube={},jQuery((()=>{try{const lockId=LoadScreen.lock();LoadScreen.init(),document.normalize&&document.normalize(),Story.load(),storage=SimpleStore.create(Story.domId,!0),session=SimpleStore.create(Story.domId,!1),Dialog.init(),UIBar.init(),Engine.init(),Story.init(),L10n.init(),session.has(\"rcWarn\")||\"cookie\"!==storage.name||(session.set(\"rcWarn\",1),window.alert(L10n.get(\"warningNoWebStorage\"))),Save.init(),Setting.init(),idb.init(Story.domId),Links.init(),Macro.init(),Engine.start(),Config.debug&&DebugBar.init();const $window=$(window),vprCheckId=setInterval((()=>{$window.width()&&(clearInterval(vprCheckId),UIBar.start(),Config.debug&&DebugBar.start(),jQuery.event.trigger({type:\":storyready\"}),setTimeout((()=>LoadScreen.unlock(lockId)),2*Engine.minDomActionDelay))}),Engine.minDomActionDelay);Object.defineProperty(window,\"SugarCube\",{value:Object.seal(Object.assign(Object.create(null),{Browser:Browser,Config:Config,Dialog:Dialog,Engine:Engine,Fullscreen:Fullscreen,Has:Has,L10n:L10n,Macro:Macro,Passage:Passage,Save:Save,Scripting:Scripting,Setting:Setting,SimpleAudio:SimpleAudio,State:State,Story:Story,UI:UI,UIBar:UIBar,DebugBar:DebugBar,Util:Util,Visibility:Visibility,Wikifier:Wikifier,session:session,settings:settings,setup:setup,storage:storage,version:version}))})}catch(ex){return console.error(ex),LoadScreen.clear(),Alert.fatal(null,ex.message,ex)}}))})(window,window.document,jQuery);}\n\t</script>\n</body>\n</html>\n"});
\ No newline at end of file
diff --git a/src/js/states/HumanState.js b/src/js/states/HumanState.js
index 245ed4313c74f63971bcbe10aa5b72d807d19260..fbc946732eb950dce5fea109c2388035fcce5e8e 100644
--- a/src/js/states/HumanState.js
+++ b/src/js/states/HumanState.js
@@ -1098,7 +1098,8 @@ App.Entity.HumanState = class HumanState {
 		this.induceLactation = 0;
 		/** 0: 10: not used to producing milk(no bonuses);
 		 * 11: 50: used to producing milk;
-		 * 51: 100: heavily adapted to producing milk(big bonus) */
+		 * 51: 100: heavily adapted to producing milk(big bonus)
+		 * 101: 200: devoted to producing milk(bigger bonus) */
 		this.lactationAdaptation = 0;
 		/**
 		 * hip size
diff --git a/src/npc/generate/generateMarketSlave.js b/src/npc/generate/generateMarketSlave.js
index 09dd5ac9e0893853ec0a1e1804fbbab53734d6fd..b49e825fbfb179d7f9d15c81a52829f4981c4b52 100644
--- a/src/npc/generate/generateMarketSlave.js
+++ b/src/npc/generate/generateMarketSlave.js
@@ -493,7 +493,12 @@ globalThis.generateMarketSlave = function(market = "kidnappers", numArcology = 1
 				}
 			} else if (neighbor.FSMaturityPreferentialist > 20) {
 				if (jsRandom(0, 100) > 50) { // usually on the more mature side
-					SGProp.minAge = 36;
+					if (V.pedoMode) {
+						SGProp.minAge = 24;
+					} else {
+						SGProp.minAge = 36;
+					}
+					SGProp.ageOverridesPedoMode = 1;
 				}
 			}
 			slave = GenerateNewSlave(genes, SGProp);
@@ -1508,7 +1513,11 @@ globalThis.generateMarketSlave = function(market = "kidnappers", numArcology = 1
 		}
 		case "TSS": {
 			if (V.TSS.schoolUpgrade === 1) {
-				SGProp.minAge = 36;
+				if (V.pedoMode) {
+					SGProp.minAge = 24;
+				} else {
+					SGProp.minAge = 36;
+				}
 			} else if (V.TSS.schoolUpgrade !== 0) {
 				SGProp.minAge = V.minimumSlaveAge;
 				SGProp.maxAge = V.minimumSlaveAge + random(0, 1);
@@ -1516,6 +1525,7 @@ globalThis.generateMarketSlave = function(market = "kidnappers", numArcology = 1
 				SGProp.minAge = 18;
 				SGProp.maxAge = 18 + random(0, 1);
 			}
+			SGProp.ageOverridesPedoMode = 1;
 			SGProp.disableDisability = 1;
 			slave = GenerateNewSlave("XX", SGProp);
 			slave.career = "a slave";
@@ -1981,7 +1991,7 @@ globalThis.generateMarketSlave = function(market = "kidnappers", numArcology = 1
 				slave.natural.boobs += random(4, 20) * 50; // Slaves are being bred for breast size.
 				slave.lactation = 1;
 				slave.lactationDuration = 2;
-				slave.lactationAdaptation = 100;
+				slave.lactationAdaptation = 200;
 				slave.anus = 1;
 				slave.vagina = 3;
 				slave.vaginaLube = 2;
diff --git a/src/player/surgery map.txt b/src/player/surgery map.txt
index 84b306ae5d617f9126bc16c4a9091eea65753c4d..4d187cc4507c3fb5a7048370fb9963f395f8df1c 100644
--- a/src/player/surgery map.txt	
+++ b/src/player/surgery map.txt	
@@ -8,36 +8,35 @@ Face:
 	younger
 	older
 	undo age
-	TD face (check .faceImplant, .ageImplant in player face description!)
+	face
 	TD change shape (expensive, limited)
-	TD add/remove lip implants
-	voice (limited) (check voice in gender appearance function)
-	TD ear shape
+	add/remove lip implants (make sure to handle going over 100 properly!)
+	voice
+	ear shape
+	horns
 
 	*BALD
 	*TEETH
-	*VOICE
 	*EXTREME FACIAL RECONSTRUCTION
 
 Skin:
 	color
-	TD remove freckles and other features
+	remove freckles and other features
 
 Body:
-	TD Liposuction
-	TD shoulder reconstruction
-	TD waist reconstruction
-	TD restore heels
+	Liposuction
+	shoulder reconstruction (always +- 1, skipping 0. Once you've done it, you're permanantly scarred by it.)
+	hip reconstruction (see shoulders)
+	restore heels
 
+	*BROOD HIPS
 	*HEIGHT RECONSTRUCTION
 
 Breasts:
-	needs rework to handle implant types
-	will only do hyper implants if FS is taken
-	removing implants past a certain size requires breast reconstruction
-	TD breast shape
-	TD nipple size
-	TD areolae size + shape
+	boob size
+	breast shape
+	nipple size
+	areolae size + shape
 	TD breat mesh if supplied
 
 	*EXTREME BREAST SIZES + STRING IMPLANTS
@@ -46,6 +45,8 @@ Breasts:
 
 Belly:
 	fix belly sag
+	TD waist reconstruction (moved due to belly distorting it)
+	TD csec scar
 	TD belly implant if supplied
 
 	*REINFORCE
@@ -53,9 +54,6 @@ Belly:
 
 Butt:
 	See breasts
-	TD hip reconstruction
-	
-	*BROOD HIPS
 
 Dick:
 	TD circumcise