narrat 3.9.7 → 3.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,22 +1,22 @@
1
- (function(Z,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(Z=typeof globalThis<"u"?globalThis:Z||self,i(Z.narrat={},Z.Vue))})(this,function(Z,i){"use strict";var jO=Object.defineProperty;var DO=(Z,i,wt)=>i in Z?jO(Z,i,{enumerable:!0,configurable:!0,writable:!0,value:wt}):Z[i]=wt;var xe=(Z,i,wt)=>(DO(Z,typeof i!="symbol"?i+"":i,wt),wt);var wt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function dp(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var ol={exports:{}};/*!
1
+ (function(Z,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(Z=typeof globalThis<"u"?globalThis:Z||self,i(Z.narrat={},Z.Vue))})(this,function(Z,i){"use strict";var MO=Object.defineProperty;var BO=(Z,i,wt)=>i in Z?MO(Z,i,{enumerable:!0,configurable:!0,writable:!0,value:wt}):Z[i]=wt;var De=(Z,i,wt)=>(BO(Z,typeof i!="symbol"?i+"":i,wt),wt);var wt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Vi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function mp(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var sl={exports:{}};/*!
2
2
  * @overview es6-promise - a tiny implementation of Promises/A+.
3
3
  * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
4
4
  * @license Licensed under MIT license
5
5
  * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
6
6
  * @version v4.2.8+1e68dce6
7
- */(function(e,t){(function(n,r){e.exports=r()})(wt,function(){function n(H){var oe=typeof H;return H!==null&&(oe==="object"||oe==="function")}function r(H){return typeof H=="function"}var o=void 0;Array.isArray?o=Array.isArray:o=function(H){return Object.prototype.toString.call(H)==="[object Array]"};var a=o,s=0,c=void 0,d=void 0,u=function(oe,ie){L[s]=oe,L[s+1]=ie,s+=2,s===2&&(d?d(P):W())};function h(H){d=H}function l(H){u=H}var f=typeof window<"u"?window:void 0,m=f||{},y=m.MutationObserver||m.WebKitMutationObserver,b=typeof self>"u"&&typeof process<"u"&&{}.toString.call(process)==="[object process]",S=typeof Uint8ClampedArray<"u"&&typeof importScripts<"u"&&typeof MessageChannel<"u";function T(){return function(){return process.nextTick(P)}}function I(){return typeof c<"u"?function(){c(P)}:F()}function x(){var H=0,oe=new y(P),ie=document.createTextNode("");return oe.observe(ie,{characterData:!0}),function(){ie.data=H=++H%2}}function B(){var H=new MessageChannel;return H.port1.onmessage=P,function(){return H.port2.postMessage(0)}}function F(){var H=setTimeout;return function(){return H(P,1)}}var L=new Array(1e3);function P(){for(var H=0;H<s;H+=2){var oe=L[H],ie=L[H+1];oe(ie),L[H]=void 0,L[H+1]=void 0}s=0}function Y(){try{var H=Function("return this")().require("vertx");return c=H.runOnLoop||H.runOnContext,I()}catch{return F()}}var W=void 0;b?W=T():y?W=x():S?W=B():f===void 0&&typeof dp=="function"?W=Y():W=F();function X(H,oe){var ie=this,ue=new this.constructor(Q);ue[z]===void 0&&R(ue);var _e=ie._state;if(_e){var $e=arguments[_e-1];u(function(){return ne(_e,ue,$e,ie._result)})}else M(ie,ue,H,oe);return ue}function G(H){var oe=this;if(H&&typeof H=="object"&&H.constructor===oe)return H;var ie=new oe(Q);return $(ie,H),ie}var z=Math.random().toString(36).substring(2);function Q(){}var te=void 0,ke=1,Ne=2;function Ze(){return new TypeError("You cannot resolve a promise with itself")}function qe(){return new TypeError("A promises callback cannot return that same promise.")}function nt(H,oe,ie,ue){try{H.call(oe,ie,ue)}catch(_e){return _e}}function j(H,oe,ie){u(function(ue){var _e=!1,$e=nt(ie,oe,function(Se){_e||(_e=!0,oe!==Se?$(ue,Se):v(ue,Se))},function(Se){_e||(_e=!0,C(ue,Se))},"Settle: "+(ue._label||" unknown promise"));!_e&&$e&&(_e=!0,C(ue,$e))},H)}function g(H,oe){oe._state===ke?v(H,oe._result):oe._state===Ne?C(H,oe._result):M(oe,void 0,function(ie){return $(H,ie)},function(ie){return C(H,ie)})}function E(H,oe,ie){oe.constructor===H.constructor&&ie===X&&oe.constructor.resolve===G?g(H,oe):ie===void 0?v(H,oe):r(ie)?j(H,oe,ie):v(H,oe)}function $(H,oe){if(H===oe)C(H,Ze());else if(n(oe)){var ie=void 0;try{ie=oe.then}catch(ue){C(H,ue);return}E(H,oe,ie)}else v(H,oe)}function _(H){H._onerror&&H._onerror(H._result),U(H)}function v(H,oe){H._state===te&&(H._result=oe,H._state=ke,H._subscribers.length!==0&&u(U,H))}function C(H,oe){H._state===te&&(H._state=Ne,H._result=oe,u(_,H))}function M(H,oe,ie,ue){var _e=H._subscribers,$e=_e.length;H._onerror=null,_e[$e]=oe,_e[$e+ke]=ie,_e[$e+Ne]=ue,$e===0&&H._state&&u(U,H)}function U(H){var oe=H._subscribers,ie=H._state;if(oe.length!==0){for(var ue=void 0,_e=void 0,$e=H._result,Se=0;Se<oe.length;Se+=3)ue=oe[Se],_e=oe[Se+ie],ue?ne(ie,ue,_e,$e):_e($e);H._subscribers.length=0}}function ne(H,oe,ie,ue){var _e=r(ie),$e=void 0,Se=void 0,at=!0;if(_e){try{$e=ie(ue)}catch(Rt){at=!1,Se=Rt}if(oe===$e){C(oe,qe());return}}else $e=ue;oe._state!==te||(_e&&at?$(oe,$e):at===!1?C(oe,Se):H===ke?v(oe,$e):H===Ne&&C(oe,$e))}function ee(H,oe){try{oe(function(ue){$(H,ue)},function(ue){C(H,ue)})}catch(ie){C(H,ie)}}var re=0;function Ee(){return re++}function R(H){H[z]=re++,H._state=void 0,H._result=void 0,H._subscribers=[]}function J(){return new Error("Array Methods must be provided an Array")}var fe=function(){function H(oe,ie){this._instanceConstructor=oe,this.promise=new oe(Q),this.promise[z]||R(this.promise),a(ie)?(this.length=ie.length,this._remaining=ie.length,this._result=new Array(this.length),this.length===0?v(this.promise,this._result):(this.length=this.length||0,this._enumerate(ie),this._remaining===0&&v(this.promise,this._result))):C(this.promise,J())}return H.prototype._enumerate=function(ie){for(var ue=0;this._state===te&&ue<ie.length;ue++)this._eachEntry(ie[ue],ue)},H.prototype._eachEntry=function(ie,ue){var _e=this._instanceConstructor,$e=_e.resolve;if($e===G){var Se=void 0,at=void 0,Rt=!1;try{Se=ie.then}catch(Et){Rt=!0,at=Et}if(Se===X&&ie._state!==te)this._settledAt(ie._state,ue,ie._result);else if(typeof Se!="function")this._remaining--,this._result[ue]=ie;else if(_e===We){var Bt=new _e(Q);Rt?C(Bt,at):E(Bt,ie,Se),this._willSettleAt(Bt,ue)}else this._willSettleAt(new _e(function(Et){return Et(ie)}),ue)}else this._willSettleAt($e(ie),ue)},H.prototype._settledAt=function(ie,ue,_e){var $e=this.promise;$e._state===te&&(this._remaining--,ie===Ne?C($e,_e):this._result[ue]=_e),this._remaining===0&&v($e,this._result)},H.prototype._willSettleAt=function(ie,ue){var _e=this;M(ie,void 0,function($e){return _e._settledAt(ke,ue,$e)},function($e){return _e._settledAt(Ne,ue,$e)})},H}();function ce(H){return new fe(this,H).promise}function be(H){var oe=this;return a(H)?new oe(function(ie,ue){for(var _e=H.length,$e=0;$e<_e;$e++)oe.resolve(H[$e]).then(ie,ue)}):new oe(function(ie,ue){return ue(new TypeError("You must pass an array to race."))})}function ve(H){var oe=this,ie=new oe(Q);return C(ie,H),ie}function Le(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function Qe(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var We=function(){function H(oe){this[z]=Ee(),this._result=this._state=void 0,this._subscribers=[],Q!==oe&&(typeof oe!="function"&&Le(),this instanceof H?ee(this,oe):Qe())}return H.prototype.catch=function(ie){return this.then(null,ie)},H.prototype.finally=function(ie){var ue=this,_e=ue.constructor;return r(ie)?ue.then(function($e){return _e.resolve(ie()).then(function(){return $e})},function($e){return _e.resolve(ie()).then(function(){throw $e})}):ue.then(ie,ie)},H}();We.prototype.then=X,We.all=ce,We.race=be,We.resolve=G,We.reject=ve,We._setScheduler=h,We._setAsap=l,We._asap=u;function Ce(){var H=void 0;if(typeof wt<"u")H=wt;else if(typeof self<"u")H=self;else try{H=Function("return this")()}catch{throw new Error("polyfill failed because global object is unavailable in this environment")}var oe=H.Promise;if(oe){var ie=null;try{ie=Object.prototype.toString.call(oe.resolve())}catch{}if(ie==="[object Promise]"&&!oe.cast)return}H.Promise=We}return We.polyfill=Ce,We.Promise=We,We})})(ol);var fp=ol.exports;fp.polyfill();class Ao{constructor(){xe(this,"debug");xe(this,"logger",{log:()=>{}})}setupDebugger(t){this.debug=t,t&&(this.logger.log=console.log.bind(window.console))}}const Io=new Ao,Ft=Io.logger;function mr(e,t){return Date.now()-e+t}function Fi(e){const t=parseInt(e,10);let n=Math.floor(t/3600),r=Math.floor((t-n*3600)/60),o=t-n*3600-r*60;return n<10&&(n="0"+n),r<10&&(r="0"+r),o<10&&(o="0"+o),n+":"+r+":"+o}const pp=i.defineComponent({props:{containerCssClass:[String,Object],cantClose:{type:Boolean,default:!1}},methods:{close(){this.cantClose||this.$emit("close")}}}),zt=(e,t)=>{const n=e.__vccOpts||e;for(const[r,o]of t)n[r]=o;return n},mp={class:"modal-header"},hp={class:"modal-body"},yp={class:"modal-footer"};function gp(e,t,n,r,o,a){return i.openBlock(),i.createBlock(i.Transition,{name:"fade"},{default:i.withCtx(()=>[i.createElementVNode("div",{class:"modal-mask",onClick:t[2]||(t[2]=(...s)=>e.close&&e.close(...s))},[i.createElementVNode("div",{class:i.normalizeClass(["modal-container bg-gray-800 nrt-card-4",e.containerCssClass]),onClick:t[1]||(t[1]=s=>s.stopPropagation())},[i.createElementVNode("div",mp,[e.cantClose?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("button",{key:0,class:"close-button",onClick:t[0]||(t[0]=(...s)=>e.close&&e.close(...s))}," X ")),i.renderSlot(e.$slots,"header",{},()=>[i.createTextVNode(" default header ")])]),i.createElementVNode("div",hp,[i.renderSlot(e.$slots,"body",{},()=>[i.createTextVNode(" default body ")])]),i.createElementVNode("div",yp,[i.renderSlot(e.$slots,"footer")])],2)])]),_:3})}const _n=zt(pp,[["render",gp]]);function Gn(){return`${Date.now()}-${Math.floor(Math.random()*1e11)}-${Math.floor(Math.random()*1e11)}`}const il="3.4.0";function Vi(){return`NARRAT_SAVE_${le().saveFileName}`}const _p="gameSave";let it;function bn(){if(it)return it;if(!it){let e=null;try{let t=localStorage.getItem(Vi());t||(t=localStorage.getItem(_p)),t&&(localStorage.setItem(`${Vi()}_BACKUP`,t),e=JSON.parse(t)),e&&typeof e=="object"&&e.slots&&e.slots[0]&&e.slots[0].id||(e=null,localStorage.clear())}catch(t){Zn(`Save file deleted because it was either broken or an outdated format: ${t}`)}e?it=e:it=al()}return Tp(it),ll(it),Kr(),it}function bp(){it=al(),Kr()}function sl(){return{achievements:{achievements:{}},data:{}}}function Tp(e){e.version==="1.4.0"&&(e.globalSave=sl(),e.version="1.5.0"),e.version==="1.5.0"&&(e.version="2.16.0"),e.version==="2.16.0"&&(e.slots.forEach(t=>{t&&t.saveData&&(t.saveData.settings={baseSettings:{textSpeed:30,animateText:!0,fontSize:16},customSettings:{}})}),e.version="2.17.0"),e.version==="2.17.0"&&(e.slots.forEach(t=>{t&&t.saveData&&(t.saveData.config={gameCharacter:"game",playerCharacter:"player"})}),e.version="3.2.3"),e.version==="3.2.3"&&(e.slots.forEach(t=>{t&&t.saveData&&(t.saveData.choices={choices:{}})}),e.version="3.3.8"),e.version==="3.3.8"&&(e.slots.forEach(t=>{t&&t.saveData&&(t.saveData.rendering={dialogPanelMode:"auto"})}),e.version="3.3.9"),e.version==="3.3.9"&&(e.slots.forEach(t=>{t&&t.saveData&&(t.saveData.plugins={},t.saveData.customStores={})}),e.version="3.4.0")}function al(){const e={version:il,slots:[],globalSave:sl()};return ll(e),e}function ll(e){const t=le().saves.slots??10;e.slots.length<1&&(e.slots[0]={slotType:"auto",id:Gn(),saveData:null,slotNumber:0}),e.slots[0].slotType="auto";for(let n=1;n<t+1;n++)e.slots.length<=n&&(e.slots[n]={slotNumber:n,slotType:le().saves.mode==="manual"?"manual":"auto",id:Gn(),saveData:null})}function cl(e,t,n){const r=wp(n);if(it.slots[r])it.slots[r].saveData=e;else{ae(`Tried to save to slot ${n} but it doesn't exist`);return}it.globalSave=t,Kr()}function vp(e){it.lastSaveSlot=e}function Kr(){localStorage.setItem(Vi(),JSON.stringify(it))}function Sp(){const e=it.slots.find(t=>!t.saveData);return e?e.id:!1}function wp(e){return it.slots.findIndex(t=>t.id===e)}function Gr(e){return it.slots.find(t=>t.id===e)}function Ui(){return it.slots.find(e=>e.slotType==="auto")}function kp(e){const t=it.slots.findIndex(n=>n.id===e);it.slots[t].saveData=null,Kr()}function Cp(e,t){const n=Gr(e);n&&n.saveData&&(n.saveData.metadata.name=t),Kr()}function $p(){return{saveDate:new Date().toISOString(),name:"New Save"}}function Ep({slot:e,name:t,extractedSave:n}){const r=Gr(e),o=$p();r&&r.saveData?o.name=r.saveData.metadata.name:o.name=t??"Auto Save",le().saves.mode==="manual"&&(o.name="Auto Save");const a={...n.gameSave,version:il,metadata:o},s=bn().globalSave;Object.assign(s,n.globalSave);const c={saveSlot:a,global:s};return cl(a,s,e),c}function Op(e,t,n,r){const o=e.saveSlot,a=e.global;cl({...o,main:{...o.main,playTime:t},metadata:{...o.metadata,name:r??"Manual Save",saveDate:new Date().toISOString()}},a,n)}var ul=!1;function No(e,t,n){return Array.isArray(e)?(e.length=Math.max(e.length,t),e.splice(t,1,n),n):(e[t]=n,n)}function qi(e,t){if(Array.isArray(e)){e.splice(t,1);return}delete e[t]}function Ap(){return dl().__VUE_DEVTOOLS_GLOBAL_HOOK__}function dl(){return typeof navigator<"u"&&typeof window<"u"?window:typeof global<"u"?global:{}}const Ip=typeof Proxy=="function",Np="devtools-plugin:setup",Pp="plugin:settings:set";let hr,Hi;function jp(){var e;return hr!==void 0||(typeof window<"u"&&window.performance?(hr=!0,Hi=window.performance):typeof global<"u"&&(!((e=global.perf_hooks)===null||e===void 0)&&e.performance)?(hr=!0,Hi=global.perf_hooks.performance):hr=!1),hr}function Dp(){return jp()?Hi.now():Date.now()}class xp{constructor(t,n){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=t,this.hook=n;const r={};if(t.settings)for(const s in t.settings){const c=t.settings[s];r[s]=c.defaultValue}const o=`__vue-devtools-plugin-settings__${t.id}`;let a=Object.assign({},r);try{const s=localStorage.getItem(o),c=JSON.parse(s);Object.assign(a,c)}catch{}this.fallbacks={getSettings(){return a},setSettings(s){try{localStorage.setItem(o,JSON.stringify(s))}catch{}a=s},now(){return Dp()}},n&&n.on(Pp,(s,c)=>{s===this.plugin.id&&this.fallbacks.setSettings(c)}),this.proxiedOn=new Proxy({},{get:(s,c)=>this.target?this.target.on[c]:(...d)=>{this.onQueue.push({method:c,args:d})}}),this.proxiedTarget=new Proxy({},{get:(s,c)=>this.target?this.target[c]:c==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(c)?(...d)=>(this.targetQueue.push({method:c,args:d,resolve:()=>{}}),this.fallbacks[c](...d)):(...d)=>new Promise(u=>{this.targetQueue.push({method:c,args:d,resolve:u})})})}async setRealTarget(t){this.target=t;for(const n of this.onQueue)this.target.on[n.method](...n.args);for(const n of this.targetQueue)n.resolve(await this.target[n.method](...n.args))}}function fl(e,t){const n=e,r=dl(),o=Ap(),a=Ip&&n.enableEarlyProxy;if(o&&(r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!a))o.emit(Np,e,t);else{const s=a?new xp(n,o):null;(r.__VUE_DEVTOOLS_PLUGINS__=r.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:n,setupFn:t,proxy:s}),s&&t(s.proxiedTarget)}}/*!
7
+ */(function(e,t){(function(n,r){e.exports=r()})(wt,function(){function n(H){var oe=typeof H;return H!==null&&(oe==="object"||oe==="function")}function r(H){return typeof H=="function"}var o=void 0;Array.isArray?o=Array.isArray:o=function(H){return Object.prototype.toString.call(H)==="[object Array]"};var a=o,s=0,c=void 0,d=void 0,u=function(oe,ie){L[s]=oe,L[s+1]=ie,s+=2,s===2&&(d?d(P):W())};function h(H){d=H}function l(H){u=H}var f=typeof window<"u"?window:void 0,m=f||{},y=m.MutationObserver||m.WebKitMutationObserver,b=typeof self>"u"&&typeof process<"u"&&{}.toString.call(process)==="[object process]",S=typeof Uint8ClampedArray<"u"&&typeof importScripts<"u"&&typeof MessageChannel<"u";function T(){return function(){return process.nextTick(P)}}function I(){return typeof c<"u"?function(){c(P)}:F()}function D(){var H=0,oe=new y(P),ie=document.createTextNode("");return oe.observe(ie,{characterData:!0}),function(){ie.data=H=++H%2}}function R(){var H=new MessageChannel;return H.port1.onmessage=P,function(){return H.port2.postMessage(0)}}function F(){var H=setTimeout;return function(){return H(P,1)}}var L=new Array(1e3);function P(){for(var H=0;H<s;H+=2){var oe=L[H],ie=L[H+1];oe(ie),L[H]=void 0,L[H+1]=void 0}s=0}function Y(){try{var H=Function("return this")().require("vertx");return c=H.runOnLoop||H.runOnContext,I()}catch{return F()}}var W=void 0;b?W=T():y?W=D():S?W=R():f===void 0&&typeof mp=="function"?W=Y():W=F();function X(H,oe){var ie=this,ue=new this.constructor(Q);ue[z]===void 0&&B(ue);var _e=ie._state;if(_e){var $e=arguments[_e-1];u(function(){return ne(_e,ue,$e,ie._result)})}else M(ie,ue,H,oe);return ue}function G(H){var oe=this;if(H&&typeof H=="object"&&H.constructor===oe)return H;var ie=new oe(Q);return $(ie,H),ie}var z=Math.random().toString(36).substring(2);function Q(){}var te=void 0,ke=1,Ne=2;function Ze(){return new TypeError("You cannot resolve a promise with itself")}function qe(){return new TypeError("A promises callback cannot return that same promise.")}function nt(H,oe,ie,ue){try{H.call(oe,ie,ue)}catch(_e){return _e}}function j(H,oe,ie){u(function(ue){var _e=!1,$e=nt(ie,oe,function(we){_e||(_e=!0,oe!==we?$(ue,we):v(ue,we))},function(we){_e||(_e=!0,C(ue,we))},"Settle: "+(ue._label||" unknown promise"));!_e&&$e&&(_e=!0,C(ue,$e))},H)}function g(H,oe){oe._state===ke?v(H,oe._result):oe._state===Ne?C(H,oe._result):M(oe,void 0,function(ie){return $(H,ie)},function(ie){return C(H,ie)})}function E(H,oe,ie){oe.constructor===H.constructor&&ie===X&&oe.constructor.resolve===G?g(H,oe):ie===void 0?v(H,oe):r(ie)?j(H,oe,ie):v(H,oe)}function $(H,oe){if(H===oe)C(H,Ze());else if(n(oe)){var ie=void 0;try{ie=oe.then}catch(ue){C(H,ue);return}E(H,oe,ie)}else v(H,oe)}function _(H){H._onerror&&H._onerror(H._result),U(H)}function v(H,oe){H._state===te&&(H._result=oe,H._state=ke,H._subscribers.length!==0&&u(U,H))}function C(H,oe){H._state===te&&(H._state=Ne,H._result=oe,u(_,H))}function M(H,oe,ie,ue){var _e=H._subscribers,$e=_e.length;H._onerror=null,_e[$e]=oe,_e[$e+ke]=ie,_e[$e+Ne]=ue,$e===0&&H._state&&u(U,H)}function U(H){var oe=H._subscribers,ie=H._state;if(oe.length!==0){for(var ue=void 0,_e=void 0,$e=H._result,we=0;we<oe.length;we+=3)ue=oe[we],_e=oe[we+ie],ue?ne(ie,ue,_e,$e):_e($e);H._subscribers.length=0}}function ne(H,oe,ie,ue){var _e=r(ie),$e=void 0,we=void 0,lt=!0;if(_e){try{$e=ie(ue)}catch(Bt){lt=!1,we=Bt}if(oe===$e){C(oe,qe());return}}else $e=ue;oe._state!==te||(_e&&lt?$(oe,$e):lt===!1?C(oe,we):H===ke?v(oe,$e):H===Ne&&C(oe,$e))}function ee(H,oe){try{oe(function(ue){$(H,ue)},function(ue){C(H,ue)})}catch(ie){C(H,ie)}}var re=0;function Ee(){return re++}function B(H){H[z]=re++,H._state=void 0,H._result=void 0,H._subscribers=[]}function J(){return new Error("Array Methods must be provided an Array")}var fe=function(){function H(oe,ie){this._instanceConstructor=oe,this.promise=new oe(Q),this.promise[z]||B(this.promise),a(ie)?(this.length=ie.length,this._remaining=ie.length,this._result=new Array(this.length),this.length===0?v(this.promise,this._result):(this.length=this.length||0,this._enumerate(ie),this._remaining===0&&v(this.promise,this._result))):C(this.promise,J())}return H.prototype._enumerate=function(ie){for(var ue=0;this._state===te&&ue<ie.length;ue++)this._eachEntry(ie[ue],ue)},H.prototype._eachEntry=function(ie,ue){var _e=this._instanceConstructor,$e=_e.resolve;if($e===G){var we=void 0,lt=void 0,Bt=!1;try{we=ie.then}catch(Ot){Bt=!0,lt=Ot}if(we===X&&ie._state!==te)this._settledAt(ie._state,ue,ie._result);else if(typeof we!="function")this._remaining--,this._result[ue]=ie;else if(_e===We){var Rt=new _e(Q);Bt?C(Rt,lt):E(Rt,ie,we),this._willSettleAt(Rt,ue)}else this._willSettleAt(new _e(function(Ot){return Ot(ie)}),ue)}else this._willSettleAt($e(ie),ue)},H.prototype._settledAt=function(ie,ue,_e){var $e=this.promise;$e._state===te&&(this._remaining--,ie===Ne?C($e,_e):this._result[ue]=_e),this._remaining===0&&v($e,this._result)},H.prototype._willSettleAt=function(ie,ue){var _e=this;M(ie,void 0,function($e){return _e._settledAt(ke,ue,$e)},function($e){return _e._settledAt(Ne,ue,$e)})},H}();function ce(H){return new fe(this,H).promise}function be(H){var oe=this;return a(H)?new oe(function(ie,ue){for(var _e=H.length,$e=0;$e<_e;$e++)oe.resolve(H[$e]).then(ie,ue)}):new oe(function(ie,ue){return ue(new TypeError("You must pass an array to race."))})}function Se(H){var oe=this,ie=new oe(Q);return C(ie,H),ie}function Le(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function Qe(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var We=function(){function H(oe){this[z]=Ee(),this._result=this._state=void 0,this._subscribers=[],Q!==oe&&(typeof oe!="function"&&Le(),this instanceof H?ee(this,oe):Qe())}return H.prototype.catch=function(ie){return this.then(null,ie)},H.prototype.finally=function(ie){var ue=this,_e=ue.constructor;return r(ie)?ue.then(function($e){return _e.resolve(ie()).then(function(){return $e})},function($e){return _e.resolve(ie()).then(function(){throw $e})}):ue.then(ie,ie)},H}();We.prototype.then=X,We.all=ce,We.race=be,We.resolve=G,We.reject=Se,We._setScheduler=h,We._setAsap=l,We._asap=u;function Ce(){var H=void 0;if(typeof wt<"u")H=wt;else if(typeof self<"u")H=self;else try{H=Function("return this")()}catch{throw new Error("polyfill failed because global object is unavailable in this environment")}var oe=H.Promise;if(oe){var ie=null;try{ie=Object.prototype.toString.call(oe.resolve())}catch{}if(ie==="[object Promise]"&&!oe.cast)return}H.Promise=We}return We.polyfill=Ce,We.Promise=We,We})})(sl);var hp=sl.exports;hp.polyfill();class Io{constructor(){De(this,"debug");De(this,"logger",{log:()=>{}})}setupDebugger(t){this.debug=t,t&&(this.logger.log=console.log.bind(window.console))}}const No=new Io,Ft=No.logger;function hr(e,t){return Date.now()-e+t}function Ui(e){const t=parseInt(e,10);let n=Math.floor(t/3600),r=Math.floor((t-n*3600)/60),o=t-n*3600-r*60;return n<10&&(n="0"+n),r<10&&(r="0"+r),o<10&&(o="0"+o),n+":"+r+":"+o}const yp=i.defineComponent({props:{containerCssClass:[String,Object],cantClose:{type:Boolean,default:!1}},methods:{close(){this.cantClose||this.$emit("close")}}}),zt=(e,t)=>{const n=e.__vccOpts||e;for(const[r,o]of t)n[r]=o;return n},gp={class:"modal-header"},_p={class:"modal-body"},bp={class:"modal-footer"};function Tp(e,t,n,r,o,a){return i.openBlock(),i.createBlock(i.Transition,{name:"fade"},{default:i.withCtx(()=>[i.createElementVNode("div",{class:"modal-mask",onClick:t[2]||(t[2]=(...s)=>e.close&&e.close(...s))},[i.createElementVNode("div",{class:i.normalizeClass(["modal-container bg-gray-800 nrt-card-4",e.containerCssClass]),onClick:t[1]||(t[1]=s=>s.stopPropagation())},[i.createElementVNode("div",gp,[e.cantClose?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("button",{key:0,class:"close-button",onClick:t[0]||(t[0]=(...s)=>e.close&&e.close(...s))}," X ")),i.renderSlot(e.$slots,"header",{},()=>[i.createTextVNode(" default header ")])]),i.createElementVNode("div",_p,[i.renderSlot(e.$slots,"body",{},()=>[i.createTextVNode(" default body ")])]),i.createElementVNode("div",bp,[i.renderSlot(e.$slots,"footer")])],2)])]),_:3})}const _n=zt(yp,[["render",Tp]]);function zn(){return`${Date.now()}-${Math.floor(Math.random()*1e11)}-${Math.floor(Math.random()*1e11)}`}const al="3.4.0";function qi(){return`NARRAT_SAVE_${le().saveFileName}`}const vp="gameSave";let it;function bn(){if(it)return it;if(!it){let e=null;try{let t=localStorage.getItem(qi());t||(t=localStorage.getItem(vp)),t&&(localStorage.setItem(`${qi()}_BACKUP`,t),e=JSON.parse(t)),e&&typeof e=="object"&&e.slots&&e.slots[0]&&e.slots[0].id||(e=null,localStorage.clear())}catch(t){er(`Save file deleted because it was either broken or an outdated format: ${t}`)}e?it=e:it=cl()}return wp(it),ul(it),Gr(),it}function Sp(){it=cl(),Gr()}function ll(){return{achievements:{achievements:{}},data:{}}}function wp(e){e.version==="1.4.0"&&(e.globalSave=ll(),e.version="1.5.0"),e.version==="1.5.0"&&(e.version="2.16.0"),e.version==="2.16.0"&&(e.slots.forEach(t=>{t&&t.saveData&&(t.saveData.settings={baseSettings:{textSpeed:30,animateText:!0,fontSize:16},customSettings:{}})}),e.version="2.17.0"),e.version==="2.17.0"&&(e.slots.forEach(t=>{t&&t.saveData&&(t.saveData.config={gameCharacter:"game",playerCharacter:"player"})}),e.version="3.2.3"),e.version==="3.2.3"&&(e.slots.forEach(t=>{t&&t.saveData&&(t.saveData.choices={choices:{}})}),e.version="3.3.8"),e.version==="3.3.8"&&(e.slots.forEach(t=>{t&&t.saveData&&(t.saveData.rendering={dialogPanelMode:"auto"})}),e.version="3.3.9"),e.version==="3.3.9"&&(e.slots.forEach(t=>{t&&t.saveData&&(t.saveData.plugins={},t.saveData.customStores={})}),e.version="3.4.0")}function cl(){const e={version:al,slots:[],globalSave:ll()};return ul(e),e}function ul(e){const t=le().saves.slots??10;e.slots.length<1&&(e.slots[0]={slotType:"auto",id:zn(),saveData:null,slotNumber:0}),e.slots[0].slotType="auto";for(let n=1;n<t+1;n++)e.slots.length<=n&&(e.slots[n]={slotNumber:n,slotType:le().saves.mode==="manual"?"manual":"auto",id:zn(),saveData:null})}function dl(e,t,n){const r=$p(n);if(it.slots[r])it.slots[r].saveData=e;else{ae(`Tried to save to slot ${n} but it doesn't exist`);return}it.globalSave=t,Gr()}function kp(e){it.lastSaveSlot=e}function Gr(){localStorage.setItem(qi(),JSON.stringify(it))}function Cp(){const e=it.slots.find(t=>!t.saveData);return e?e.id:!1}function $p(e){return it.slots.findIndex(t=>t.id===e)}function zr(e){return it.slots.find(t=>t.id===e)}function Hi(){return it.slots.find(e=>e.slotType==="auto")}function Ep(e){const t=it.slots.findIndex(n=>n.id===e);it.slots[t].saveData=null,Gr()}function Op(e,t){const n=zr(e);n&&n.saveData&&(n.saveData.metadata.name=t),Gr()}function Ap(){return{saveDate:new Date().toISOString(),name:"New Save"}}function Ip({slot:e,name:t,extractedSave:n}){const r=zr(e),o=Ap();r&&r.saveData?o.name=r.saveData.metadata.name:o.name=t??"Auto Save",le().saves.mode==="manual"&&(o.name="Auto Save");const a={...n.gameSave,version:al,metadata:o},s=bn().globalSave;Object.assign(s,n.globalSave);const c={saveSlot:a,global:s};return dl(a,s,e),c}function Np(e,t,n,r){const o=e.saveSlot,a=e.global;dl({...o,main:{...o.main,playTime:t},metadata:{...o.metadata,name:r??"Manual Save",saveDate:new Date().toISOString()}},a,n)}var fl=!1;function Po(e,t,n){return Array.isArray(e)?(e.length=Math.max(e.length,t),e.splice(t,1,n),n):(e[t]=n,n)}function Ki(e,t){if(Array.isArray(e)){e.splice(t,1);return}delete e[t]}function Pp(){return pl().__VUE_DEVTOOLS_GLOBAL_HOOK__}function pl(){return typeof navigator<"u"&&typeof window<"u"?window:typeof global<"u"?global:{}}const jp=typeof Proxy=="function",xp="devtools-plugin:setup",Dp="plugin:settings:set";let yr,Gi;function Lp(){var e;return yr!==void 0||(typeof window<"u"&&window.performance?(yr=!0,Gi=window.performance):typeof global<"u"&&(!((e=global.perf_hooks)===null||e===void 0)&&e.performance)?(yr=!0,Gi=global.perf_hooks.performance):yr=!1),yr}function Mp(){return Lp()?Gi.now():Date.now()}class Bp{constructor(t,n){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=t,this.hook=n;const r={};if(t.settings)for(const s in t.settings){const c=t.settings[s];r[s]=c.defaultValue}const o=`__vue-devtools-plugin-settings__${t.id}`;let a=Object.assign({},r);try{const s=localStorage.getItem(o),c=JSON.parse(s);Object.assign(a,c)}catch{}this.fallbacks={getSettings(){return a},setSettings(s){try{localStorage.setItem(o,JSON.stringify(s))}catch{}a=s},now(){return Mp()}},n&&n.on(Dp,(s,c)=>{s===this.plugin.id&&this.fallbacks.setSettings(c)}),this.proxiedOn=new Proxy({},{get:(s,c)=>this.target?this.target.on[c]:(...d)=>{this.onQueue.push({method:c,args:d})}}),this.proxiedTarget=new Proxy({},{get:(s,c)=>this.target?this.target[c]:c==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(c)?(...d)=>(this.targetQueue.push({method:c,args:d,resolve:()=>{}}),this.fallbacks[c](...d)):(...d)=>new Promise(u=>{this.targetQueue.push({method:c,args:d,resolve:u})})})}async setRealTarget(t){this.target=t;for(const n of this.onQueue)this.target.on[n.method](...n.args);for(const n of this.targetQueue)n.resolve(await this.target[n.method](...n.args))}}function ml(e,t){const n=e,r=pl(),o=Pp(),a=jp&&n.enableEarlyProxy;if(o&&(r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!a))o.emit(xp,e,t);else{const s=a?new Bp(n,o):null;(r.__VUE_DEVTOOLS_PLUGINS__=r.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:n,setupFn:t,proxy:s}),s&&t(s.proxiedTarget)}}/*!
8
8
  * pinia v2.1.7
9
9
  * (c) 2023 Eduardo San Martin Morote
10
10
  * @license MIT
11
- */let zr;const Wr=e=>zr=e,pl=process.env.NODE_ENV!=="production"?Symbol("pinia"):Symbol();function zn(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var tn;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(tn||(tn={}));const Po=typeof window<"u",Qr=(process.env.NODE_ENV!=="production"||!1)&&process.env.NODE_ENV!=="test"&&Po,ml=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof global=="object"&&global.global===global?global:typeof globalThis=="object"?globalThis:{HTMLElement:null};function Lp(e,{autoBom:t=!1}={}){return t&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e}function Ki(e,t,n){const r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){gl(r.response,t,n)},r.onerror=function(){console.error("could not download file")},r.send()}function hl(e){const t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function jo(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{const n=document.createEvent("MouseEvents");n.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(n)}}const Do=typeof navigator=="object"?navigator:{userAgent:""},yl=/Macintosh/.test(Do.userAgent)&&/AppleWebKit/.test(Do.userAgent)&&!/Safari/.test(Do.userAgent),gl=Po?typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype&&!yl?Mp:"msSaveOrOpenBlob"in Do?Rp:Bp:()=>{};function Mp(e,t="download",n){const r=document.createElement("a");r.download=t,r.rel="noopener",typeof e=="string"?(r.href=e,r.origin!==location.origin?hl(r.href)?Ki(e,t,n):(r.target="_blank",jo(r)):jo(r)):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){jo(r)},0))}function Rp(e,t="download",n){if(typeof e=="string")if(hl(e))Ki(e,t,n);else{const r=document.createElement("a");r.href=e,r.target="_blank",setTimeout(function(){jo(r)})}else navigator.msSaveOrOpenBlob(Lp(e,n),t)}function Bp(e,t,n,r){if(r=r||open("","_blank"),r&&(r.document.title=r.document.body.innerText="downloading..."),typeof e=="string")return Ki(e,t,n);const o=e.type==="application/octet-stream",a=/constructor/i.test(String(ml.HTMLElement))||"safari"in ml,s=/CriOS\/[\d]+/.test(navigator.userAgent);if((s||o&&a||yl)&&typeof FileReader<"u"){const c=new FileReader;c.onloadend=function(){let d=c.result;if(typeof d!="string")throw r=null,new Error("Wrong reader.result type");d=s?d:d.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=d:location.assign(d),r=null},c.readAsDataURL(e)}else{const c=URL.createObjectURL(e);r?r.location.assign(c):location.href=c,r=null,setTimeout(function(){URL.revokeObjectURL(c)},4e4)}}function ut(e,t){const n="🍍 "+e;typeof __VUE_DEVTOOLS_TOAST__=="function"?__VUE_DEVTOOLS_TOAST__(n,t):t==="error"?console.error(n):t==="warn"?console.warn(n):console.log(n)}function Gi(e){return"_a"in e&&"install"in e}function _l(){if(!("clipboard"in navigator))return ut("Your browser doesn't support the Clipboard API","error"),!0}function bl(e){return e instanceof Error&&e.message.toLowerCase().includes("document is not focused")?(ut('You need to activate the "Emulate a focused page" setting in the "Rendering" panel of devtools.',"warn"),!0):!1}async function Fp(e){if(!_l())try{await navigator.clipboard.writeText(JSON.stringify(e.state.value)),ut("Global state copied to clipboard.")}catch(t){if(bl(t))return;ut("Failed to serialize the state. Check the console for more details.","error"),console.error(t)}}async function Vp(e){if(!_l())try{Tl(e,JSON.parse(await navigator.clipboard.readText())),ut("Global state pasted from clipboard.")}catch(t){if(bl(t))return;ut("Failed to deserialize the state from clipboard. Check the console for more details.","error"),console.error(t)}}async function Up(e){try{gl(new Blob([JSON.stringify(e.state.value)],{type:"text/plain;charset=utf-8"}),"pinia-state.json")}catch(t){ut("Failed to export the state as JSON. Check the console for more details.","error"),console.error(t)}}let Tn;function qp(){Tn||(Tn=document.createElement("input"),Tn.type="file",Tn.accept=".json");function e(){return new Promise((t,n)=>{Tn.onchange=async()=>{const r=Tn.files;if(!r)return t(null);const o=r.item(0);return t(o?{text:await o.text(),file:o}:null)},Tn.oncancel=()=>t(null),Tn.onerror=n,Tn.click()})}return e}async function Hp(e){try{const n=await qp()();if(!n)return;const{text:r,file:o}=n;Tl(e,JSON.parse(r)),ut(`Global state imported from "${o.name}".`)}catch(t){ut("Failed to import the state from JSON. Check the console for more details.","error"),console.error(t)}}function Tl(e,t){for(const n in t){const r=e.state.value[n];r?Object.assign(r,t[n]):e.state.value[n]=t[n]}}function Wt(e){return{_custom:{display:e}}}const vl="🍍 Pinia (root)",zi="_root";function Kp(e){return Gi(e)?{id:zi,label:vl}:{id:e.$id,label:e.$id}}function Gp(e){if(Gi(e)){const n=Array.from(e._s.keys()),r=e._s;return{state:n.map(a=>({editable:!0,key:a,value:e.state.value[a]})),getters:n.filter(a=>r.get(a)._getters).map(a=>{const s=r.get(a);return{editable:!1,key:a,value:s._getters.reduce((c,d)=>(c[d]=s[d],c),{})}})}}const t={state:Object.keys(e.$state).map(n=>({editable:!0,key:n,value:e.$state[n]}))};return e._getters&&e._getters.length&&(t.getters=e._getters.map(n=>({editable:!1,key:n,value:e[n]}))),e._customProperties.size&&(t.customProperties=Array.from(e._customProperties).map(n=>({editable:!0,key:n,value:e[n]}))),t}function zp(e){return e?Array.isArray(e)?e.reduce((t,n)=>(t.keys.push(n.key),t.operations.push(n.type),t.oldValue[n.key]=n.oldValue,t.newValue[n.key]=n.newValue,t),{oldValue:{},keys:[],operations:[],newValue:{}}):{operation:Wt(e.type),key:Wt(e.key),oldValue:e.oldValue,newValue:e.newValue}:{}}function Wp(e){switch(e){case tn.direct:return"mutation";case tn.patchFunction:return"$patch";case tn.patchObject:return"$patch";default:return"unknown"}}let yr=!0;const xo=[],Wn="pinia:mutations",bt="pinia",{assign:Qp}=Object,Lo=e=>"🍍 "+e;function Yp(e,t){fl({id:"dev.esm.pinia",label:"Pinia 🍍",logo:"https://pinia.vuejs.org/logo.svg",packageName:"pinia",homepage:"https://pinia.vuejs.org",componentStateTypes:xo,app:e},n=>{typeof n.now!="function"&&ut("You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html."),n.addTimelineLayer({id:Wn,label:"Pinia 🍍",color:15064968}),n.addInspector({id:bt,label:"Pinia 🍍",icon:"storage",treeFilterPlaceholder:"Search stores",actions:[{icon:"content_copy",action:()=>{Fp(t)},tooltip:"Serialize and copy the state"},{icon:"content_paste",action:async()=>{await Vp(t),n.sendInspectorTree(bt),n.sendInspectorState(bt)},tooltip:"Replace the state with the content of your clipboard"},{icon:"save",action:()=>{Up(t)},tooltip:"Save the state as a JSON file"},{icon:"folder_open",action:async()=>{await Hp(t),n.sendInspectorTree(bt),n.sendInspectorState(bt)},tooltip:"Import the state from a JSON file"}],nodeActions:[{icon:"restore",tooltip:'Reset the state (with "$reset")',action:r=>{const o=t._s.get(r);o?typeof o.$reset!="function"?ut(`Cannot reset "${r}" store because it doesn't have a "$reset" method implemented.`,"warn"):(o.$reset(),ut(`Store "${r}" reset.`)):ut(`Cannot reset "${r}" store because it wasn't found.`,"warn")}}]}),n.on.inspectComponent((r,o)=>{const a=r.componentInstance&&r.componentInstance.proxy;if(a&&a._pStores){const s=r.componentInstance.proxy._pStores;Object.values(s).forEach(c=>{r.instanceData.state.push({type:Lo(c.$id),key:"state",editable:!0,value:c._isOptionsAPI?{_custom:{value:i.toRaw(c.$state),actions:[{icon:"restore",tooltip:"Reset the state of this store",action:()=>c.$reset()}]}}:Object.keys(c.$state).reduce((d,u)=>(d[u]=c.$state[u],d),{})}),c._getters&&c._getters.length&&r.instanceData.state.push({type:Lo(c.$id),key:"getters",editable:!1,value:c._getters.reduce((d,u)=>{try{d[u]=c[u]}catch(h){d[u]=h}return d},{})})})}}),n.on.getInspectorTree(r=>{if(r.app===e&&r.inspectorId===bt){let o=[t];o=o.concat(Array.from(t._s.values())),r.rootNodes=(r.filter?o.filter(a=>"$id"in a?a.$id.toLowerCase().includes(r.filter.toLowerCase()):vl.toLowerCase().includes(r.filter.toLowerCase())):o).map(Kp)}}),n.on.getInspectorState(r=>{if(r.app===e&&r.inspectorId===bt){const o=r.nodeId===zi?t:t._s.get(r.nodeId);if(!o)return;o&&(r.state=Gp(o))}}),n.on.editInspectorState((r,o)=>{if(r.app===e&&r.inspectorId===bt){const a=r.nodeId===zi?t:t._s.get(r.nodeId);if(!a)return ut(`store "${r.nodeId}" not found`,"error");const{path:s}=r;Gi(a)?s.unshift("state"):(s.length!==1||!a._customProperties.has(s[0])||s[0]in a.$state)&&s.unshift("$state"),yr=!1,r.set(a,s,r.state.value),yr=!0}}),n.on.editComponentState(r=>{if(r.type.startsWith("🍍")){const o=r.type.replace(/^🍍\s*/,""),a=t._s.get(o);if(!a)return ut(`store "${o}" not found`,"error");const{path:s}=r;if(s[0]!=="state")return ut(`Invalid path for store "${o}":
11
+ */let Wr;const Qr=e=>Wr=e,hl=process.env.NODE_ENV!=="production"?Symbol("pinia"):Symbol();function Wn(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var tn;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(tn||(tn={}));const jo=typeof window<"u",Yr=(process.env.NODE_ENV!=="production"||!1)&&process.env.NODE_ENV!=="test"&&jo,yl=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof global=="object"&&global.global===global?global:typeof globalThis=="object"?globalThis:{HTMLElement:null};function Rp(e,{autoBom:t=!1}={}){return t&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e}function zi(e,t,n){const r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){bl(r.response,t,n)},r.onerror=function(){console.error("could not download file")},r.send()}function gl(e){const t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function xo(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{const n=document.createEvent("MouseEvents");n.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(n)}}const Do=typeof navigator=="object"?navigator:{userAgent:""},_l=/Macintosh/.test(Do.userAgent)&&/AppleWebKit/.test(Do.userAgent)&&!/Safari/.test(Do.userAgent),bl=jo?typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype&&!_l?Fp:"msSaveOrOpenBlob"in Do?Vp:Up:()=>{};function Fp(e,t="download",n){const r=document.createElement("a");r.download=t,r.rel="noopener",typeof e=="string"?(r.href=e,r.origin!==location.origin?gl(r.href)?zi(e,t,n):(r.target="_blank",xo(r)):xo(r)):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){xo(r)},0))}function Vp(e,t="download",n){if(typeof e=="string")if(gl(e))zi(e,t,n);else{const r=document.createElement("a");r.href=e,r.target="_blank",setTimeout(function(){xo(r)})}else navigator.msSaveOrOpenBlob(Rp(e,n),t)}function Up(e,t,n,r){if(r=r||open("","_blank"),r&&(r.document.title=r.document.body.innerText="downloading..."),typeof e=="string")return zi(e,t,n);const o=e.type==="application/octet-stream",a=/constructor/i.test(String(yl.HTMLElement))||"safari"in yl,s=/CriOS\/[\d]+/.test(navigator.userAgent);if((s||o&&a||_l)&&typeof FileReader<"u"){const c=new FileReader;c.onloadend=function(){let d=c.result;if(typeof d!="string")throw r=null,new Error("Wrong reader.result type");d=s?d:d.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=d:location.assign(d),r=null},c.readAsDataURL(e)}else{const c=URL.createObjectURL(e);r?r.location.assign(c):location.href=c,r=null,setTimeout(function(){URL.revokeObjectURL(c)},4e4)}}function ut(e,t){const n="🍍 "+e;typeof __VUE_DEVTOOLS_TOAST__=="function"?__VUE_DEVTOOLS_TOAST__(n,t):t==="error"?console.error(n):t==="warn"?console.warn(n):console.log(n)}function Wi(e){return"_a"in e&&"install"in e}function Tl(){if(!("clipboard"in navigator))return ut("Your browser doesn't support the Clipboard API","error"),!0}function vl(e){return e instanceof Error&&e.message.toLowerCase().includes("document is not focused")?(ut('You need to activate the "Emulate a focused page" setting in the "Rendering" panel of devtools.',"warn"),!0):!1}async function qp(e){if(!Tl())try{await navigator.clipboard.writeText(JSON.stringify(e.state.value)),ut("Global state copied to clipboard.")}catch(t){if(vl(t))return;ut("Failed to serialize the state. Check the console for more details.","error"),console.error(t)}}async function Hp(e){if(!Tl())try{Sl(e,JSON.parse(await navigator.clipboard.readText())),ut("Global state pasted from clipboard.")}catch(t){if(vl(t))return;ut("Failed to deserialize the state from clipboard. Check the console for more details.","error"),console.error(t)}}async function Kp(e){try{bl(new Blob([JSON.stringify(e.state.value)],{type:"text/plain;charset=utf-8"}),"pinia-state.json")}catch(t){ut("Failed to export the state as JSON. Check the console for more details.","error"),console.error(t)}}let Tn;function Gp(){Tn||(Tn=document.createElement("input"),Tn.type="file",Tn.accept=".json");function e(){return new Promise((t,n)=>{Tn.onchange=async()=>{const r=Tn.files;if(!r)return t(null);const o=r.item(0);return t(o?{text:await o.text(),file:o}:null)},Tn.oncancel=()=>t(null),Tn.onerror=n,Tn.click()})}return e}async function zp(e){try{const n=await Gp()();if(!n)return;const{text:r,file:o}=n;Sl(e,JSON.parse(r)),ut(`Global state imported from "${o.name}".`)}catch(t){ut("Failed to import the state from JSON. Check the console for more details.","error"),console.error(t)}}function Sl(e,t){for(const n in t){const r=e.state.value[n];r?Object.assign(r,t[n]):e.state.value[n]=t[n]}}function Wt(e){return{_custom:{display:e}}}const wl="🍍 Pinia (root)",Qi="_root";function Wp(e){return Wi(e)?{id:Qi,label:wl}:{id:e.$id,label:e.$id}}function Qp(e){if(Wi(e)){const n=Array.from(e._s.keys()),r=e._s;return{state:n.map(a=>({editable:!0,key:a,value:e.state.value[a]})),getters:n.filter(a=>r.get(a)._getters).map(a=>{const s=r.get(a);return{editable:!1,key:a,value:s._getters.reduce((c,d)=>(c[d]=s[d],c),{})}})}}const t={state:Object.keys(e.$state).map(n=>({editable:!0,key:n,value:e.$state[n]}))};return e._getters&&e._getters.length&&(t.getters=e._getters.map(n=>({editable:!1,key:n,value:e[n]}))),e._customProperties.size&&(t.customProperties=Array.from(e._customProperties).map(n=>({editable:!0,key:n,value:e[n]}))),t}function Yp(e){return e?Array.isArray(e)?e.reduce((t,n)=>(t.keys.push(n.key),t.operations.push(n.type),t.oldValue[n.key]=n.oldValue,t.newValue[n.key]=n.newValue,t),{oldValue:{},keys:[],operations:[],newValue:{}}):{operation:Wt(e.type),key:Wt(e.key),oldValue:e.oldValue,newValue:e.newValue}:{}}function Jp(e){switch(e){case tn.direct:return"mutation";case tn.patchFunction:return"$patch";case tn.patchObject:return"$patch";default:return"unknown"}}let gr=!0;const Lo=[],Qn="pinia:mutations",bt="pinia",{assign:Xp}=Object,Mo=e=>"🍍 "+e;function Zp(e,t){ml({id:"dev.esm.pinia",label:"Pinia 🍍",logo:"https://pinia.vuejs.org/logo.svg",packageName:"pinia",homepage:"https://pinia.vuejs.org",componentStateTypes:Lo,app:e},n=>{typeof n.now!="function"&&ut("You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html."),n.addTimelineLayer({id:Qn,label:"Pinia 🍍",color:15064968}),n.addInspector({id:bt,label:"Pinia 🍍",icon:"storage",treeFilterPlaceholder:"Search stores",actions:[{icon:"content_copy",action:()=>{qp(t)},tooltip:"Serialize and copy the state"},{icon:"content_paste",action:async()=>{await Hp(t),n.sendInspectorTree(bt),n.sendInspectorState(bt)},tooltip:"Replace the state with the content of your clipboard"},{icon:"save",action:()=>{Kp(t)},tooltip:"Save the state as a JSON file"},{icon:"folder_open",action:async()=>{await zp(t),n.sendInspectorTree(bt),n.sendInspectorState(bt)},tooltip:"Import the state from a JSON file"}],nodeActions:[{icon:"restore",tooltip:'Reset the state (with "$reset")',action:r=>{const o=t._s.get(r);o?typeof o.$reset!="function"?ut(`Cannot reset "${r}" store because it doesn't have a "$reset" method implemented.`,"warn"):(o.$reset(),ut(`Store "${r}" reset.`)):ut(`Cannot reset "${r}" store because it wasn't found.`,"warn")}}]}),n.on.inspectComponent((r,o)=>{const a=r.componentInstance&&r.componentInstance.proxy;if(a&&a._pStores){const s=r.componentInstance.proxy._pStores;Object.values(s).forEach(c=>{r.instanceData.state.push({type:Mo(c.$id),key:"state",editable:!0,value:c._isOptionsAPI?{_custom:{value:i.toRaw(c.$state),actions:[{icon:"restore",tooltip:"Reset the state of this store",action:()=>c.$reset()}]}}:Object.keys(c.$state).reduce((d,u)=>(d[u]=c.$state[u],d),{})}),c._getters&&c._getters.length&&r.instanceData.state.push({type:Mo(c.$id),key:"getters",editable:!1,value:c._getters.reduce((d,u)=>{try{d[u]=c[u]}catch(h){d[u]=h}return d},{})})})}}),n.on.getInspectorTree(r=>{if(r.app===e&&r.inspectorId===bt){let o=[t];o=o.concat(Array.from(t._s.values())),r.rootNodes=(r.filter?o.filter(a=>"$id"in a?a.$id.toLowerCase().includes(r.filter.toLowerCase()):wl.toLowerCase().includes(r.filter.toLowerCase())):o).map(Wp)}}),n.on.getInspectorState(r=>{if(r.app===e&&r.inspectorId===bt){const o=r.nodeId===Qi?t:t._s.get(r.nodeId);if(!o)return;o&&(r.state=Qp(o))}}),n.on.editInspectorState((r,o)=>{if(r.app===e&&r.inspectorId===bt){const a=r.nodeId===Qi?t:t._s.get(r.nodeId);if(!a)return ut(`store "${r.nodeId}" not found`,"error");const{path:s}=r;Wi(a)?s.unshift("state"):(s.length!==1||!a._customProperties.has(s[0])||s[0]in a.$state)&&s.unshift("$state"),gr=!1,r.set(a,s,r.state.value),gr=!0}}),n.on.editComponentState(r=>{if(r.type.startsWith("🍍")){const o=r.type.replace(/^🍍\s*/,""),a=t._s.get(o);if(!a)return ut(`store "${o}" not found`,"error");const{path:s}=r;if(s[0]!=="state")return ut(`Invalid path for store "${o}":
12
12
  ${s}
13
- Only state can be modified.`);s[0]="$state",yr=!1,r.set(a,s,r.state.value),yr=!0}})})}function Jp(e,t){xo.includes(Lo(t.$id))||xo.push(Lo(t.$id)),fl({id:"dev.esm.pinia",label:"Pinia 🍍",logo:"https://pinia.vuejs.org/logo.svg",packageName:"pinia",homepage:"https://pinia.vuejs.org",componentStateTypes:xo,app:e,settings:{logStoreChanges:{label:"Notify about new/deleted stores",type:"boolean",defaultValue:!0}}},n=>{const r=typeof n.now=="function"?n.now.bind(n):Date.now;t.$onAction(({after:s,onError:c,name:d,args:u})=>{const h=Sl++;n.addTimelineEvent({layerId:Wn,event:{time:r(),title:"🛫 "+d,subtitle:"start",data:{store:Wt(t.$id),action:Wt(d),args:u},groupId:h}}),s(l=>{Pn=void 0,n.addTimelineEvent({layerId:Wn,event:{time:r(),title:"🛬 "+d,subtitle:"end",data:{store:Wt(t.$id),action:Wt(d),args:u,result:l},groupId:h}})}),c(l=>{Pn=void 0,n.addTimelineEvent({layerId:Wn,event:{time:r(),logType:"error",title:"💥 "+d,subtitle:"end",data:{store:Wt(t.$id),action:Wt(d),args:u,error:l},groupId:h}})})},!0),t._customProperties.forEach(s=>{i.watch(()=>i.unref(t[s]),(c,d)=>{n.notifyComponentUpdate(),n.sendInspectorState(bt),yr&&n.addTimelineEvent({layerId:Wn,event:{time:r(),title:"Change",subtitle:s,data:{newValue:c,oldValue:d},groupId:Pn}})},{deep:!0})}),t.$subscribe(({events:s,type:c},d)=>{if(n.notifyComponentUpdate(),n.sendInspectorState(bt),!yr)return;const u={time:r(),title:Wp(c),data:Qp({store:Wt(t.$id)},zp(s)),groupId:Pn};c===tn.patchFunction?u.subtitle="⤵️":c===tn.patchObject?u.subtitle="🧩":s&&!Array.isArray(s)&&(u.subtitle=s.type),s&&(u.data["rawEvent(s)"]={_custom:{display:"DebuggerEvent",type:"object",tooltip:"raw DebuggerEvent[]",value:s}}),n.addTimelineEvent({layerId:Wn,event:u})},{detached:!0,flush:"sync"});const o=t._hotUpdate;t._hotUpdate=i.markRaw(s=>{o(s),n.addTimelineEvent({layerId:Wn,event:{time:r(),title:"🔥 "+t.$id,subtitle:"HMR update",data:{store:Wt(t.$id),info:Wt("HMR update")}}}),n.notifyComponentUpdate(),n.sendInspectorTree(bt),n.sendInspectorState(bt)});const{$dispose:a}=t;t.$dispose=()=>{a(),n.notifyComponentUpdate(),n.sendInspectorTree(bt),n.sendInspectorState(bt),n.getSettings().logStoreChanges&&ut(`Disposed "${t.$id}" store 🗑`)},n.notifyComponentUpdate(),n.sendInspectorTree(bt),n.sendInspectorState(bt),n.getSettings().logStoreChanges&&ut(`"${t.$id}" store installed 🆕`)})}let Sl=0,Pn;function wl(e,t,n){const r=t.reduce((o,a)=>(o[a]=i.toRaw(e)[a],o),{});for(const o in r)e[o]=function(){const a=Sl,s=n?new Proxy(e,{get(...d){return Pn=a,Reflect.get(...d)},set(...d){return Pn=a,Reflect.set(...d)}}):e;Pn=a;const c=r[o].apply(s,arguments);return Pn=void 0,c}}function Xp({app:e,store:t,options:n}){if(t.$id.startsWith("__hot:"))return;t._isOptionsAPI=!!n.state,wl(t,Object.keys(n.actions),t._isOptionsAPI);const r=t._hotUpdate;i.toRaw(t)._hotUpdate=function(o){r.apply(this,arguments),wl(t,Object.keys(o._hmrPayload.actions),!!t._isOptionsAPI)},Jp(e,t)}function Zp(){const e=i.effectScope(!0),t=e.run(()=>i.ref({}));let n=[],r=[];const o=i.markRaw({install(a){Wr(o),o._a=a,a.provide(pl,o),a.config.globalProperties.$pinia=o,Qr&&Yp(a,o),r.forEach(s=>n.push(s)),r=[]},use(a){return!this._a&&!ul?r.push(a):n.push(a),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return Qr&&typeof Proxy<"u"&&o.use(Xp),o}function kl(e,t){for(const n in t){const r=t[n];if(!(n in e))continue;const o=e[n];zn(o)&&zn(r)&&!i.isRef(r)&&!i.isReactive(r)?e[n]=kl(o,r):e[n]=r}return e}const Cl=()=>{};function $l(e,t,n,r=Cl){e.push(t);const o=()=>{const a=e.indexOf(t);a>-1&&(e.splice(a,1),r())};return!n&&i.getCurrentScope()&&i.onScopeDispose(o),o}function gr(e,...t){e.slice().forEach(n=>{n(...t)})}const em=e=>e();function Wi(e,t){e instanceof Map&&t instanceof Map&&t.forEach((n,r)=>e.set(r,n)),e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const n in t){if(!t.hasOwnProperty(n))continue;const r=t[n],o=e[n];zn(o)&&zn(r)&&e.hasOwnProperty(n)&&!i.isRef(r)&&!i.isReactive(r)?e[n]=Wi(o,r):e[n]=r}return e}const tm=process.env.NODE_ENV!=="production"?Symbol("pinia:skipHydration"):Symbol();function nm(e){return!zn(e)||!e.hasOwnProperty(tm)}const{assign:Vt}=Object;function El(e){return!!(i.isRef(e)&&e.effect)}function Ol(e,t,n,r){const{state:o,actions:a,getters:s}=t,c=n.state.value[e];let d;function u(){!c&&(process.env.NODE_ENV==="production"||!r)&&(n.state.value[e]=o?o():{});const h=process.env.NODE_ENV!=="production"&&r?i.toRefs(i.ref(o?o():{}).value):i.toRefs(n.state.value[e]);return Vt(h,a,Object.keys(s||{}).reduce((l,f)=>(process.env.NODE_ENV!=="production"&&f in h&&console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${f}" in store "${e}".`),l[f]=i.markRaw(i.computed(()=>{Wr(n);const m=n._s.get(e);return s[f].call(m,m)})),l),{}))}return d=Qi(e,u,t,n,r,!0),d}function Qi(e,t,n={},r,o,a){let s;const c=Vt({actions:{}},n);if(process.env.NODE_ENV!=="production"&&!r._e.active)throw new Error("Pinia destroyed");const d={deep:!0};process.env.NODE_ENV!=="production"&&!ul&&(d.onTrigger=X=>{u?m=X:u==!1&&!P._hotUpdating&&(Array.isArray(m)?m.push(X):console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug."))});let u,h,l=[],f=[],m;const y=r.state.value[e];!a&&!y&&(process.env.NODE_ENV==="production"||!o)&&(r.state.value[e]={});const b=i.ref({});let S;function T(X){let G;u=h=!1,process.env.NODE_ENV!=="production"&&(m=[]),typeof X=="function"?(X(r.state.value[e]),G={type:tn.patchFunction,storeId:e,events:m}):(Wi(r.state.value[e],X),G={type:tn.patchObject,payload:X,storeId:e,events:m});const z=S=Symbol();i.nextTick().then(()=>{S===z&&(u=!0)}),h=!0,gr(l,G,r.state.value[e])}const I=a?function(){const{state:G}=n,z=G?G():{};this.$patch(Q=>{Vt(Q,z)})}:process.env.NODE_ENV!=="production"?()=>{throw new Error(`🍍: Store "${e}" is built using the setup syntax and does not implement $reset().`)}:Cl;function x(){s.stop(),l=[],f=[],r._s.delete(e)}function B(X,G){return function(){Wr(r);const z=Array.from(arguments),Q=[],te=[];function ke(qe){Q.push(qe)}function Ne(qe){te.push(qe)}gr(f,{args:z,name:X,store:P,after:ke,onError:Ne});let Ze;try{Ze=G.apply(this&&this.$id===e?this:P,z)}catch(qe){throw gr(te,qe),qe}return Ze instanceof Promise?Ze.then(qe=>(gr(Q,qe),qe)).catch(qe=>(gr(te,qe),Promise.reject(qe))):(gr(Q,Ze),Ze)}}const F=i.markRaw({actions:{},getters:{},state:[],hotState:b}),L={_p:r,$id:e,$onAction:$l.bind(null,f),$patch:T,$reset:I,$subscribe(X,G={}){const z=$l(l,X,G.detached,()=>Q()),Q=s.run(()=>i.watch(()=>r.state.value[e],te=>{(G.flush==="sync"?h:u)&&X({storeId:e,type:tn.direct,events:m},te)},Vt({},d,G)));return z},$dispose:x},P=i.reactive(process.env.NODE_ENV!=="production"||Qr?Vt({_hmrPayload:F,_customProperties:i.markRaw(new Set)},L):L);r._s.set(e,P);const W=(r._a&&r._a.runWithContext||em)(()=>r._e.run(()=>(s=i.effectScope()).run(t)));for(const X in W){const G=W[X];if(i.isRef(G)&&!El(G)||i.isReactive(G))process.env.NODE_ENV!=="production"&&o?No(b.value,X,i.toRef(W,X)):a||(y&&nm(G)&&(i.isRef(G)?G.value=y[X]:Wi(G,y[X])),r.state.value[e][X]=G),process.env.NODE_ENV!=="production"&&F.state.push(X);else if(typeof G=="function"){const z=process.env.NODE_ENV!=="production"&&o?G:B(X,G);W[X]=z,process.env.NODE_ENV!=="production"&&(F.actions[X]=G),c.actions[X]=G}else process.env.NODE_ENV!=="production"&&El(G)&&(F.getters[X]=a?n.getters[X]:G,Po&&(W._getters||(W._getters=i.markRaw([]))).push(X))}if(Vt(P,W),Vt(i.toRaw(P),W),Object.defineProperty(P,"$state",{get:()=>process.env.NODE_ENV!=="production"&&o?b.value:r.state.value[e],set:X=>{if(process.env.NODE_ENV!=="production"&&o)throw new Error("cannot set hotState");T(G=>{Vt(G,X)})}}),process.env.NODE_ENV!=="production"&&(P._hotUpdate=i.markRaw(X=>{P._hotUpdating=!0,X._hmrPayload.state.forEach(G=>{if(G in P.$state){const z=X.$state[G],Q=P.$state[G];typeof z=="object"&&zn(z)&&zn(Q)?kl(z,Q):X.$state[G]=Q}No(P,G,i.toRef(X.$state,G))}),Object.keys(P.$state).forEach(G=>{G in X.$state||qi(P,G)}),u=!1,h=!1,r.state.value[e]=i.toRef(X._hmrPayload,"hotState"),h=!0,i.nextTick().then(()=>{u=!0});for(const G in X._hmrPayload.actions){const z=X[G];No(P,G,B(G,z))}for(const G in X._hmrPayload.getters){const z=X._hmrPayload.getters[G],Q=a?i.computed(()=>(Wr(r),z.call(P,P))):z;No(P,G,Q)}Object.keys(P._hmrPayload.getters).forEach(G=>{G in X._hmrPayload.getters||qi(P,G)}),Object.keys(P._hmrPayload.actions).forEach(G=>{G in X._hmrPayload.actions||qi(P,G)}),P._hmrPayload=X._hmrPayload,P._getters=X._getters,P._hotUpdating=!1})),Qr){const X={writable:!0,configurable:!0,enumerable:!1};["_p","_hmrPayload","_getters","_customProperties"].forEach(G=>{Object.defineProperty(P,G,Vt({value:P[G]},X))})}return r._p.forEach(X=>{if(Qr){const G=s.run(()=>X({store:P,app:r._a,pinia:r,options:c}));Object.keys(G||{}).forEach(z=>P._customProperties.add(z)),Vt(P,G)}else Vt(P,s.run(()=>X({store:P,app:r._a,pinia:r,options:c})))}),process.env.NODE_ENV!=="production"&&P.$state&&typeof P.$state=="object"&&typeof P.$state.constructor=="function"&&!P.$state.constructor.toString().includes("[native code]")&&console.warn(`[🍍]: The "state" must be a plain object. It cannot be
13
+ Only state can be modified.`);s[0]="$state",gr=!1,r.set(a,s,r.state.value),gr=!0}})})}function em(e,t){Lo.includes(Mo(t.$id))||Lo.push(Mo(t.$id)),ml({id:"dev.esm.pinia",label:"Pinia 🍍",logo:"https://pinia.vuejs.org/logo.svg",packageName:"pinia",homepage:"https://pinia.vuejs.org",componentStateTypes:Lo,app:e,settings:{logStoreChanges:{label:"Notify about new/deleted stores",type:"boolean",defaultValue:!0}}},n=>{const r=typeof n.now=="function"?n.now.bind(n):Date.now;t.$onAction(({after:s,onError:c,name:d,args:u})=>{const h=kl++;n.addTimelineEvent({layerId:Qn,event:{time:r(),title:"🛫 "+d,subtitle:"start",data:{store:Wt(t.$id),action:Wt(d),args:u},groupId:h}}),s(l=>{jn=void 0,n.addTimelineEvent({layerId:Qn,event:{time:r(),title:"🛬 "+d,subtitle:"end",data:{store:Wt(t.$id),action:Wt(d),args:u,result:l},groupId:h}})}),c(l=>{jn=void 0,n.addTimelineEvent({layerId:Qn,event:{time:r(),logType:"error",title:"💥 "+d,subtitle:"end",data:{store:Wt(t.$id),action:Wt(d),args:u,error:l},groupId:h}})})},!0),t._customProperties.forEach(s=>{i.watch(()=>i.unref(t[s]),(c,d)=>{n.notifyComponentUpdate(),n.sendInspectorState(bt),gr&&n.addTimelineEvent({layerId:Qn,event:{time:r(),title:"Change",subtitle:s,data:{newValue:c,oldValue:d},groupId:jn}})},{deep:!0})}),t.$subscribe(({events:s,type:c},d)=>{if(n.notifyComponentUpdate(),n.sendInspectorState(bt),!gr)return;const u={time:r(),title:Jp(c),data:Xp({store:Wt(t.$id)},Yp(s)),groupId:jn};c===tn.patchFunction?u.subtitle="⤵️":c===tn.patchObject?u.subtitle="🧩":s&&!Array.isArray(s)&&(u.subtitle=s.type),s&&(u.data["rawEvent(s)"]={_custom:{display:"DebuggerEvent",type:"object",tooltip:"raw DebuggerEvent[]",value:s}}),n.addTimelineEvent({layerId:Qn,event:u})},{detached:!0,flush:"sync"});const o=t._hotUpdate;t._hotUpdate=i.markRaw(s=>{o(s),n.addTimelineEvent({layerId:Qn,event:{time:r(),title:"🔥 "+t.$id,subtitle:"HMR update",data:{store:Wt(t.$id),info:Wt("HMR update")}}}),n.notifyComponentUpdate(),n.sendInspectorTree(bt),n.sendInspectorState(bt)});const{$dispose:a}=t;t.$dispose=()=>{a(),n.notifyComponentUpdate(),n.sendInspectorTree(bt),n.sendInspectorState(bt),n.getSettings().logStoreChanges&&ut(`Disposed "${t.$id}" store 🗑`)},n.notifyComponentUpdate(),n.sendInspectorTree(bt),n.sendInspectorState(bt),n.getSettings().logStoreChanges&&ut(`"${t.$id}" store installed 🆕`)})}let kl=0,jn;function Cl(e,t,n){const r=t.reduce((o,a)=>(o[a]=i.toRaw(e)[a],o),{});for(const o in r)e[o]=function(){const a=kl,s=n?new Proxy(e,{get(...d){return jn=a,Reflect.get(...d)},set(...d){return jn=a,Reflect.set(...d)}}):e;jn=a;const c=r[o].apply(s,arguments);return jn=void 0,c}}function tm({app:e,store:t,options:n}){if(t.$id.startsWith("__hot:"))return;t._isOptionsAPI=!!n.state,Cl(t,Object.keys(n.actions),t._isOptionsAPI);const r=t._hotUpdate;i.toRaw(t)._hotUpdate=function(o){r.apply(this,arguments),Cl(t,Object.keys(o._hmrPayload.actions),!!t._isOptionsAPI)},em(e,t)}function nm(){const e=i.effectScope(!0),t=e.run(()=>i.ref({}));let n=[],r=[];const o=i.markRaw({install(a){Qr(o),o._a=a,a.provide(hl,o),a.config.globalProperties.$pinia=o,Yr&&Zp(a,o),r.forEach(s=>n.push(s)),r=[]},use(a){return!this._a&&!fl?r.push(a):n.push(a),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return Yr&&typeof Proxy<"u"&&o.use(tm),o}function $l(e,t){for(const n in t){const r=t[n];if(!(n in e))continue;const o=e[n];Wn(o)&&Wn(r)&&!i.isRef(r)&&!i.isReactive(r)?e[n]=$l(o,r):e[n]=r}return e}const El=()=>{};function Ol(e,t,n,r=El){e.push(t);const o=()=>{const a=e.indexOf(t);a>-1&&(e.splice(a,1),r())};return!n&&i.getCurrentScope()&&i.onScopeDispose(o),o}function _r(e,...t){e.slice().forEach(n=>{n(...t)})}const rm=e=>e();function Yi(e,t){e instanceof Map&&t instanceof Map&&t.forEach((n,r)=>e.set(r,n)),e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const n in t){if(!t.hasOwnProperty(n))continue;const r=t[n],o=e[n];Wn(o)&&Wn(r)&&e.hasOwnProperty(n)&&!i.isRef(r)&&!i.isReactive(r)?e[n]=Yi(o,r):e[n]=r}return e}const om=process.env.NODE_ENV!=="production"?Symbol("pinia:skipHydration"):Symbol();function im(e){return!Wn(e)||!e.hasOwnProperty(om)}const{assign:Vt}=Object;function Al(e){return!!(i.isRef(e)&&e.effect)}function Il(e,t,n,r){const{state:o,actions:a,getters:s}=t,c=n.state.value[e];let d;function u(){!c&&(process.env.NODE_ENV==="production"||!r)&&(n.state.value[e]=o?o():{});const h=process.env.NODE_ENV!=="production"&&r?i.toRefs(i.ref(o?o():{}).value):i.toRefs(n.state.value[e]);return Vt(h,a,Object.keys(s||{}).reduce((l,f)=>(process.env.NODE_ENV!=="production"&&f in h&&console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${f}" in store "${e}".`),l[f]=i.markRaw(i.computed(()=>{Qr(n);const m=n._s.get(e);return s[f].call(m,m)})),l),{}))}return d=Ji(e,u,t,n,r,!0),d}function Ji(e,t,n={},r,o,a){let s;const c=Vt({actions:{}},n);if(process.env.NODE_ENV!=="production"&&!r._e.active)throw new Error("Pinia destroyed");const d={deep:!0};process.env.NODE_ENV!=="production"&&!fl&&(d.onTrigger=X=>{u?m=X:u==!1&&!P._hotUpdating&&(Array.isArray(m)?m.push(X):console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug."))});let u,h,l=[],f=[],m;const y=r.state.value[e];!a&&!y&&(process.env.NODE_ENV==="production"||!o)&&(r.state.value[e]={});const b=i.ref({});let S;function T(X){let G;u=h=!1,process.env.NODE_ENV!=="production"&&(m=[]),typeof X=="function"?(X(r.state.value[e]),G={type:tn.patchFunction,storeId:e,events:m}):(Yi(r.state.value[e],X),G={type:tn.patchObject,payload:X,storeId:e,events:m});const z=S=Symbol();i.nextTick().then(()=>{S===z&&(u=!0)}),h=!0,_r(l,G,r.state.value[e])}const I=a?function(){const{state:G}=n,z=G?G():{};this.$patch(Q=>{Vt(Q,z)})}:process.env.NODE_ENV!=="production"?()=>{throw new Error(`🍍: Store "${e}" is built using the setup syntax and does not implement $reset().`)}:El;function D(){s.stop(),l=[],f=[],r._s.delete(e)}function R(X,G){return function(){Qr(r);const z=Array.from(arguments),Q=[],te=[];function ke(qe){Q.push(qe)}function Ne(qe){te.push(qe)}_r(f,{args:z,name:X,store:P,after:ke,onError:Ne});let Ze;try{Ze=G.apply(this&&this.$id===e?this:P,z)}catch(qe){throw _r(te,qe),qe}return Ze instanceof Promise?Ze.then(qe=>(_r(Q,qe),qe)).catch(qe=>(_r(te,qe),Promise.reject(qe))):(_r(Q,Ze),Ze)}}const F=i.markRaw({actions:{},getters:{},state:[],hotState:b}),L={_p:r,$id:e,$onAction:Ol.bind(null,f),$patch:T,$reset:I,$subscribe(X,G={}){const z=Ol(l,X,G.detached,()=>Q()),Q=s.run(()=>i.watch(()=>r.state.value[e],te=>{(G.flush==="sync"?h:u)&&X({storeId:e,type:tn.direct,events:m},te)},Vt({},d,G)));return z},$dispose:D},P=i.reactive(process.env.NODE_ENV!=="production"||Yr?Vt({_hmrPayload:F,_customProperties:i.markRaw(new Set)},L):L);r._s.set(e,P);const W=(r._a&&r._a.runWithContext||rm)(()=>r._e.run(()=>(s=i.effectScope()).run(t)));for(const X in W){const G=W[X];if(i.isRef(G)&&!Al(G)||i.isReactive(G))process.env.NODE_ENV!=="production"&&o?Po(b.value,X,i.toRef(W,X)):a||(y&&im(G)&&(i.isRef(G)?G.value=y[X]:Yi(G,y[X])),r.state.value[e][X]=G),process.env.NODE_ENV!=="production"&&F.state.push(X);else if(typeof G=="function"){const z=process.env.NODE_ENV!=="production"&&o?G:R(X,G);W[X]=z,process.env.NODE_ENV!=="production"&&(F.actions[X]=G),c.actions[X]=G}else process.env.NODE_ENV!=="production"&&Al(G)&&(F.getters[X]=a?n.getters[X]:G,jo&&(W._getters||(W._getters=i.markRaw([]))).push(X))}if(Vt(P,W),Vt(i.toRaw(P),W),Object.defineProperty(P,"$state",{get:()=>process.env.NODE_ENV!=="production"&&o?b.value:r.state.value[e],set:X=>{if(process.env.NODE_ENV!=="production"&&o)throw new Error("cannot set hotState");T(G=>{Vt(G,X)})}}),process.env.NODE_ENV!=="production"&&(P._hotUpdate=i.markRaw(X=>{P._hotUpdating=!0,X._hmrPayload.state.forEach(G=>{if(G in P.$state){const z=X.$state[G],Q=P.$state[G];typeof z=="object"&&Wn(z)&&Wn(Q)?$l(z,Q):X.$state[G]=Q}Po(P,G,i.toRef(X.$state,G))}),Object.keys(P.$state).forEach(G=>{G in X.$state||Ki(P,G)}),u=!1,h=!1,r.state.value[e]=i.toRef(X._hmrPayload,"hotState"),h=!0,i.nextTick().then(()=>{u=!0});for(const G in X._hmrPayload.actions){const z=X[G];Po(P,G,R(G,z))}for(const G in X._hmrPayload.getters){const z=X._hmrPayload.getters[G],Q=a?i.computed(()=>(Qr(r),z.call(P,P))):z;Po(P,G,Q)}Object.keys(P._hmrPayload.getters).forEach(G=>{G in X._hmrPayload.getters||Ki(P,G)}),Object.keys(P._hmrPayload.actions).forEach(G=>{G in X._hmrPayload.actions||Ki(P,G)}),P._hmrPayload=X._hmrPayload,P._getters=X._getters,P._hotUpdating=!1})),Yr){const X={writable:!0,configurable:!0,enumerable:!1};["_p","_hmrPayload","_getters","_customProperties"].forEach(G=>{Object.defineProperty(P,G,Vt({value:P[G]},X))})}return r._p.forEach(X=>{if(Yr){const G=s.run(()=>X({store:P,app:r._a,pinia:r,options:c}));Object.keys(G||{}).forEach(z=>P._customProperties.add(z)),Vt(P,G)}else Vt(P,s.run(()=>X({store:P,app:r._a,pinia:r,options:c})))}),process.env.NODE_ENV!=="production"&&P.$state&&typeof P.$state=="object"&&typeof P.$state.constructor=="function"&&!P.$state.constructor.toString().includes("[native code]")&&console.warn(`[🍍]: The "state" must be a plain object. It cannot be
14
14
  state: () => new MyClass()
15
- Found in store "${P.$id}".`),y&&a&&n.hydrate&&n.hydrate(P.$state,y),u=!0,h=!0,P}function et(e,t,n){let r,o;const a=typeof t=="function";if(typeof e=="string")r=e,o=a?n:t;else if(o=e,r=e.id,process.env.NODE_ENV!=="production"&&typeof r!="string")throw new Error('[🍍]: "defineStore()" must be passed a store id as its first argument.');function s(c,d){const u=i.hasInjectionContext();if(c=(process.env.NODE_ENV==="test"&&zr&&zr._testing?null:c)||(u?i.inject(pl,null):null),c&&Wr(c),process.env.NODE_ENV!=="production"&&!zr)throw new Error(`[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?
15
+ Found in store "${P.$id}".`),y&&a&&n.hydrate&&n.hydrate(P.$state,y),u=!0,h=!0,P}function et(e,t,n){let r,o;const a=typeof t=="function";if(typeof e=="string")r=e,o=a?n:t;else if(o=e,r=e.id,process.env.NODE_ENV!=="production"&&typeof r!="string")throw new Error('[🍍]: "defineStore()" must be passed a store id as its first argument.');function s(c,d){const u=i.hasInjectionContext();if(c=(process.env.NODE_ENV==="test"&&Wr&&Wr._testing?null:c)||(u?i.inject(hl,null):null),c&&Qr(c),process.env.NODE_ENV!=="production"&&!Wr)throw new Error(`[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?
16
16
  See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.
17
- This will fail in production.`);c=zr,c._s.has(r)||(a?Qi(r,t,o,c):Ol(r,o,c),process.env.NODE_ENV!=="production"&&(s._pinia=c));const h=c._s.get(r);if(process.env.NODE_ENV!=="production"&&d){const l="__hot:"+r,f=a?Qi(l,t,o,c,!0):Ol(l,Vt({},o),c,!0);d._hotUpdate(f),delete c.state.value[l],c._s.delete(l)}if(process.env.NODE_ENV!=="production"&&Po){const l=i.getCurrentInstance();if(l&&l.proxy&&!d){const f=l.proxy,m="_pStores"in f?f._pStores:f._pStores={};m[r]=h}}return h}return s.$id=r,s}function Yr(e,t){return Array.isArray(t)?t.reduce((n,r)=>(n[r]=function(){return e(this.$pinia)[r]},n),{}):Object.keys(t).reduce((n,r)=>(n[r]=function(){const o=e(this.$pinia),a=t[r];return typeof a=="function"?a.call(this,o):o[a]},n),{})}const _r=et("tooltips",{state:()=>({tooltip:null}),actions:{addCustomTooltip(e){e.title&&(e.title=nn(e.title)),e.text=nn(e.text),this.tooltip=e},addTooltip(e,t){const n=Ei(e);n&&this.addCustomTooltip({keyword:e,title:n.title,text:n.description,x:(t==null?void 0:t.x)??window.screenX,y:(t==null?void 0:t.y)??window.screenY,width:Fn().options.width})},deleteTooltip(){this.tooltip=null}}});function Mo(){return window}function rm(e){const t=Fn().options.keywordsPrefix,n=new RegExp(`${t}(\\w*)`,"gi");return e=e.replace(n,om),e}Mo().onTooltipEnter=(e,t)=>{const n={x:e.clientX,y:e.clientY-20};_r().addTooltip(t,n)},Mo().onTooltipLeave=()=>{_r().deleteTooltip()};function om(e,t){const n=t.toLowerCase();return Ei(n)?`<span class='highlighted-tooltip-keyword'
17
+ This will fail in production.`);c=Wr,c._s.has(r)||(a?Ji(r,t,o,c):Il(r,o,c),process.env.NODE_ENV!=="production"&&(s._pinia=c));const h=c._s.get(r);if(process.env.NODE_ENV!=="production"&&d){const l="__hot:"+r,f=a?Ji(l,t,o,c,!0):Il(l,Vt({},o),c,!0);d._hotUpdate(f),delete c.state.value[l],c._s.delete(l)}if(process.env.NODE_ENV!=="production"&&jo){const l=i.getCurrentInstance();if(l&&l.proxy&&!d){const f=l.proxy,m="_pStores"in f?f._pStores:f._pStores={};m[r]=h}}return h}return s.$id=r,s}function Jr(e,t){return Array.isArray(t)?t.reduce((n,r)=>(n[r]=function(){return e(this.$pinia)[r]},n),{}):Object.keys(t).reduce((n,r)=>(n[r]=function(){const o=e(this.$pinia),a=t[r];return typeof a=="function"?a.call(this,o):o[a]},n),{})}const br=et("tooltips",{state:()=>({tooltip:null}),actions:{addCustomTooltip(e){e.title&&(e.title=nn(e.title)),e.text=nn(e.text),this.tooltip=e},addTooltip(e,t){const n=Ai(e);n&&this.addCustomTooltip({keyword:e,title:n.title,text:n.description,x:(t==null?void 0:t.x)??window.screenX,y:(t==null?void 0:t.y)??window.screenY,width:Vn().options.width})},deleteTooltip(){this.tooltip=null}}});function Bo(){return window}function sm(e){const t=Vn().options.keywordsPrefix,n=new RegExp(`${t}(\\w*)`,"gi");return e=e.replace(n,am),e}Bo().onTooltipEnter=(e,t)=>{const n={x:e.clientX,y:e.clientY-20};br().addTooltip(t,n)},Bo().onTooltipLeave=()=>{br().deleteTooltip()};function am(e,t){const n=t.toLowerCase();return Ai(n)?`<span class='highlighted-tooltip-keyword'
18
18
  onmouseenter="onTooltipEnter(event, '${n}')"
19
- onmouseleave="onTooltipLeave()">${t}</span>`:n}function Al(e,t,n="$"){return t.replace(/%{[^}]*}/g,r=>{const o=r.substr(2,r.length-3);return Yi(e,o,n)})}function nn(e){const t=Mr(),n=Al(t,e,"$");return rm(n)}function Yi(e,t,n){const[r,o]=Ni(e,t,n);return r[o]}const Il=/\$\$"/,im=e=>typeof e=="string"&&e.search(Il)===0;function sm(e){let t=null;const n=[],r=/<[^>]*>/g;do t=r.exec(e),t&&n.push(t);while(t);return n}const Fe=et("dialog",{state:()=>({dialog:[],playMode:"normal"}),actions:{generateSaveData(){return{dialog:Re(this.dialog)}},loadSaveData(e){this.dialog=e.dialog},addDialog(e){this.dialog.push({...e,interactive:e.interactive??!1,id:Gn(),text:nn(e.text)}),this.dialog.length>200&&this.dialog.shift()},toggleAutoPlay(){this.playMode=this.playMode==="auto"?"normal":"auto"},toggleSkip(){this.playMode=this.playMode==="skip"?"normal":"skip"},clearDialog(){this.dialog.splice(0,this.dialog.length)},reset(){this.dialog=[],this.playMode="normal"}},getters:{currentDialog(){return this.dialog[this.dialog.length-1]}}});var rn={};/*!
19
+ onmouseleave="onTooltipLeave()">${t}</span>`:n}function Nl(e,t,n="$"){return t.replace(/%{[^}]*}/g,r=>{const o=r.substr(2,r.length-3);return Xi(e,o,n)})}function nn(e){const t=Br(),n=Nl(t,e,"$");return sm(n)}function Xi(e,t,n){const[r,o]=ji(e,t,n);return r[o]}const Pl=/\$\$"/,lm=e=>typeof e=="string"&&e.search(Pl)===0;function cm(e){let t=null;const n=[],r=/<[^>]*>/g;do t=r.exec(e),t&&n.push(t);while(t);return n}const Fe=et("dialog",{state:()=>({dialog:[],playMode:"normal"}),actions:{generateSaveData(){return{dialog:Be(this.dialog)}},loadSaveData(e){this.dialog=e.dialog},addDialog(e){this.dialog.push({...e,interactive:e.interactive??!1,id:zn(),text:nn(e.text)}),this.dialog.length>200&&this.dialog.shift()},toggleAutoPlay(){this.playMode=this.playMode==="auto"?"normal":"auto"},toggleSkip(){this.playMode=this.playMode==="skip"?"normal":"skip"},clearDialog(){this.dialog.splice(0,this.dialog.length)},makeLastDialogInteractive(){this.dialog[this.dialog.length-1].interactive=!0},reset(){this.dialog=[],this.playMode="normal"}},getters:{currentDialog(){return this.dialog[this.dialog.length-1]}}});var rn={};/*!
20
20
  * howler.js v2.2.4
21
21
  * howlerjs.com
22
22
  *
@@ -24,7 +24,7 @@ This will fail in production.`);c=zr,c._s.has(r)||(a?Qi(r,t,o,c):Ol(r,o,c),proce
24
24
  * goldfirestudios.com
25
25
  *
26
26
  * MIT License
27
- */(function(e){(function(){var t=function(){this.init()};t.prototype={init:function(){var l=this||n;return l._counter=1e3,l._html5AudioPool=[],l.html5PoolSize=10,l._codecs={},l._howls=[],l._muted=!1,l._volume=1,l._canPlayEvent="canplaythrough",l._navigator=typeof window<"u"&&window.navigator?window.navigator:null,l.masterGain=null,l.noAudio=!1,l.usingWebAudio=!0,l.autoSuspend=!0,l.ctx=null,l.autoUnlock=!0,l._setup(),l},volume:function(l){var f=this||n;if(l=parseFloat(l),f.ctx||h(),typeof l<"u"&&l>=0&&l<=1){if(f._volume=l,f._muted)return f;f.usingWebAudio&&f.masterGain.gain.setValueAtTime(l,n.ctx.currentTime);for(var m=0;m<f._howls.length;m++)if(!f._howls[m]._webAudio)for(var y=f._howls[m]._getSoundIds(),b=0;b<y.length;b++){var S=f._howls[m]._soundById(y[b]);S&&S._node&&(S._node.volume=S._volume*l)}return f}return f._volume},mute:function(l){var f=this||n;f.ctx||h(),f._muted=l,f.usingWebAudio&&f.masterGain.gain.setValueAtTime(l?0:f._volume,n.ctx.currentTime);for(var m=0;m<f._howls.length;m++)if(!f._howls[m]._webAudio)for(var y=f._howls[m]._getSoundIds(),b=0;b<y.length;b++){var S=f._howls[m]._soundById(y[b]);S&&S._node&&(S._node.muted=l?!0:S._muted)}return f},stop:function(){for(var l=this||n,f=0;f<l._howls.length;f++)l._howls[f].stop();return l},unload:function(){for(var l=this||n,f=l._howls.length-1;f>=0;f--)l._howls[f].unload();return l.usingWebAudio&&l.ctx&&typeof l.ctx.close<"u"&&(l.ctx.close(),l.ctx=null,h()),l},codecs:function(l){return(this||n)._codecs[l.replace(/^x-/,"")]},_setup:function(){var l=this||n;if(l.state=l.ctx&&l.ctx.state||"suspended",l._autoSuspend(),!l.usingWebAudio)if(typeof Audio<"u")try{var f=new Audio;typeof f.oncanplaythrough>"u"&&(l._canPlayEvent="canplay")}catch{l.noAudio=!0}else l.noAudio=!0;try{var f=new Audio;f.muted&&(l.noAudio=!0)}catch{}return l.noAudio||l._setupCodecs(),l},_setupCodecs:function(){var l=this||n,f=null;try{f=typeof Audio<"u"?new Audio:null}catch{return l}if(!f||typeof f.canPlayType!="function")return l;var m=f.canPlayType("audio/mpeg;").replace(/^no$/,""),y=l._navigator?l._navigator.userAgent:"",b=y.match(/OPR\/(\d+)/g),S=b&&parseInt(b[0].split("/")[1],10)<33,T=y.indexOf("Safari")!==-1&&y.indexOf("Chrome")===-1,I=y.match(/Version\/(.*?) /),x=T&&I&&parseInt(I[1],10)<15;return l._codecs={mp3:!!(!S&&(m||f.canPlayType("audio/mp3;").replace(/^no$/,""))),mpeg:!!m,opus:!!f.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!f.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!f.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(f.canPlayType('audio/wav; codecs="1"')||f.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!f.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!f.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(f.canPlayType("audio/x-m4a;")||f.canPlayType("audio/m4a;")||f.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(f.canPlayType("audio/x-m4b;")||f.canPlayType("audio/m4b;")||f.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(f.canPlayType("audio/x-mp4;")||f.canPlayType("audio/mp4;")||f.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!!(!x&&f.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!!(!x&&f.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!f.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(f.canPlayType("audio/x-flac;")||f.canPlayType("audio/flac;")).replace(/^no$/,"")},l},_unlockAudio:function(){var l=this||n;if(!(l._audioUnlocked||!l.ctx)){l._audioUnlocked=!1,l.autoUnlock=!1,!l._mobileUnloaded&&l.ctx.sampleRate!==44100&&(l._mobileUnloaded=!0,l.unload()),l._scratchBuffer=l.ctx.createBuffer(1,1,22050);var f=function(m){for(;l._html5AudioPool.length<l.html5PoolSize;)try{var y=new Audio;y._unlocked=!0,l._releaseHtml5Audio(y)}catch{l.noAudio=!0;break}for(var b=0;b<l._howls.length;b++)if(!l._howls[b]._webAudio)for(var S=l._howls[b]._getSoundIds(),T=0;T<S.length;T++){var I=l._howls[b]._soundById(S[T]);I&&I._node&&!I._node._unlocked&&(I._node._unlocked=!0,I._node.load())}l._autoResume();var x=l.ctx.createBufferSource();x.buffer=l._scratchBuffer,x.connect(l.ctx.destination),typeof x.start>"u"?x.noteOn(0):x.start(0),typeof l.ctx.resume=="function"&&l.ctx.resume(),x.onended=function(){x.disconnect(0),l._audioUnlocked=!0,document.removeEventListener("touchstart",f,!0),document.removeEventListener("touchend",f,!0),document.removeEventListener("click",f,!0),document.removeEventListener("keydown",f,!0);for(var B=0;B<l._howls.length;B++)l._howls[B]._emit("unlock")}};return document.addEventListener("touchstart",f,!0),document.addEventListener("touchend",f,!0),document.addEventListener("click",f,!0),document.addEventListener("keydown",f,!0),l}},_obtainHtml5Audio:function(){var l=this||n;if(l._html5AudioPool.length)return l._html5AudioPool.pop();var f=new Audio().play();return f&&typeof Promise<"u"&&(f instanceof Promise||typeof f.then=="function")&&f.catch(function(){console.warn("HTML5 Audio pool exhausted, returning potentially locked audio object.")}),new Audio},_releaseHtml5Audio:function(l){var f=this||n;return l._unlocked&&f._html5AudioPool.push(l),f},_autoSuspend:function(){var l=this;if(!(!l.autoSuspend||!l.ctx||typeof l.ctx.suspend>"u"||!n.usingWebAudio)){for(var f=0;f<l._howls.length;f++)if(l._howls[f]._webAudio){for(var m=0;m<l._howls[f]._sounds.length;m++)if(!l._howls[f]._sounds[m]._paused)return l}return l._suspendTimer&&clearTimeout(l._suspendTimer),l._suspendTimer=setTimeout(function(){if(l.autoSuspend){l._suspendTimer=null,l.state="suspending";var y=function(){l.state="suspended",l._resumeAfterSuspend&&(delete l._resumeAfterSuspend,l._autoResume())};l.ctx.suspend().then(y,y)}},3e4),l}},_autoResume:function(){var l=this;if(!(!l.ctx||typeof l.ctx.resume>"u"||!n.usingWebAudio))return l.state==="running"&&l.ctx.state!=="interrupted"&&l._suspendTimer?(clearTimeout(l._suspendTimer),l._suspendTimer=null):l.state==="suspended"||l.state==="running"&&l.ctx.state==="interrupted"?(l.ctx.resume().then(function(){l.state="running";for(var f=0;f<l._howls.length;f++)l._howls[f]._emit("resume")}),l._suspendTimer&&(clearTimeout(l._suspendTimer),l._suspendTimer=null)):l.state==="suspending"&&(l._resumeAfterSuspend=!0),l}};var n=new t,r=function(l){var f=this;if(!l.src||l.src.length===0){console.error("An array of source files must be passed with any new Howl.");return}f.init(l)};r.prototype={init:function(l){var f=this;return n.ctx||h(),f._autoplay=l.autoplay||!1,f._format=typeof l.format!="string"?l.format:[l.format],f._html5=l.html5||!1,f._muted=l.mute||!1,f._loop=l.loop||!1,f._pool=l.pool||5,f._preload=typeof l.preload=="boolean"||l.preload==="metadata"?l.preload:!0,f._rate=l.rate||1,f._sprite=l.sprite||{},f._src=typeof l.src!="string"?l.src:[l.src],f._volume=l.volume!==void 0?l.volume:1,f._xhr={method:l.xhr&&l.xhr.method?l.xhr.method:"GET",headers:l.xhr&&l.xhr.headers?l.xhr.headers:null,withCredentials:l.xhr&&l.xhr.withCredentials?l.xhr.withCredentials:!1},f._duration=0,f._state="unloaded",f._sounds=[],f._endTimers={},f._queue=[],f._playLock=!1,f._onend=l.onend?[{fn:l.onend}]:[],f._onfade=l.onfade?[{fn:l.onfade}]:[],f._onload=l.onload?[{fn:l.onload}]:[],f._onloaderror=l.onloaderror?[{fn:l.onloaderror}]:[],f._onplayerror=l.onplayerror?[{fn:l.onplayerror}]:[],f._onpause=l.onpause?[{fn:l.onpause}]:[],f._onplay=l.onplay?[{fn:l.onplay}]:[],f._onstop=l.onstop?[{fn:l.onstop}]:[],f._onmute=l.onmute?[{fn:l.onmute}]:[],f._onvolume=l.onvolume?[{fn:l.onvolume}]:[],f._onrate=l.onrate?[{fn:l.onrate}]:[],f._onseek=l.onseek?[{fn:l.onseek}]:[],f._onunlock=l.onunlock?[{fn:l.onunlock}]:[],f._onresume=[],f._webAudio=n.usingWebAudio&&!f._html5,typeof n.ctx<"u"&&n.ctx&&n.autoUnlock&&n._unlockAudio(),n._howls.push(f),f._autoplay&&f._queue.push({event:"play",action:function(){f.play()}}),f._preload&&f._preload!=="none"&&f.load(),f},load:function(){var l=this,f=null;if(n.noAudio){l._emit("loaderror",null,"No audio support.");return}typeof l._src=="string"&&(l._src=[l._src]);for(var m=0;m<l._src.length;m++){var y,b;if(l._format&&l._format[m])y=l._format[m];else{if(b=l._src[m],typeof b!="string"){l._emit("loaderror",null,"Non-string found in selected audio sources - ignoring.");continue}y=/^data:audio\/([^;,]+);/i.exec(b),y||(y=/\.([^.]+)$/.exec(b.split("?",1)[0])),y&&(y=y[1].toLowerCase())}if(y||console.warn('No file extension was found. Consider using the "format" property or specify an extension.'),y&&n.codecs(y)){f=l._src[m];break}}if(!f){l._emit("loaderror",null,"No codec support for selected audio sources.");return}return l._src=f,l._state="loading",window.location.protocol==="https:"&&f.slice(0,5)==="http:"&&(l._html5=!0,l._webAudio=!1),new o(l),l._webAudio&&s(l),l},play:function(l,f){var m=this,y=null;if(typeof l=="number")y=l,l=null;else{if(typeof l=="string"&&m._state==="loaded"&&!m._sprite[l])return null;if(typeof l>"u"&&(l="__default",!m._playLock)){for(var b=0,S=0;S<m._sounds.length;S++)m._sounds[S]._paused&&!m._sounds[S]._ended&&(b++,y=m._sounds[S]._id);b===1?l=null:y=null}}var T=y?m._soundById(y):m._inactiveSound();if(!T)return null;if(y&&!l&&(l=T._sprite||"__default"),m._state!=="loaded"){T._sprite=l,T._ended=!1;var I=T._id;return m._queue.push({event:"play",action:function(){m.play(I)}}),I}if(y&&!T._paused)return f||m._loadQueue("play"),T._id;m._webAudio&&n._autoResume();var x=Math.max(0,T._seek>0?T._seek:m._sprite[l][0]/1e3),B=Math.max(0,(m._sprite[l][0]+m._sprite[l][1])/1e3-x),F=B*1e3/Math.abs(T._rate),L=m._sprite[l][0]/1e3,P=(m._sprite[l][0]+m._sprite[l][1])/1e3;T._sprite=l,T._ended=!1;var Y=function(){T._paused=!1,T._seek=x,T._start=L,T._stop=P,T._loop=!!(T._loop||m._sprite[l][2])};if(x>=P){m._ended(T);return}var W=T._node;if(m._webAudio){var X=function(){m._playLock=!1,Y(),m._refreshBuffer(T);var te=T._muted||m._muted?0:T._volume;W.gain.setValueAtTime(te,n.ctx.currentTime),T._playStart=n.ctx.currentTime,typeof W.bufferSource.start>"u"?T._loop?W.bufferSource.noteGrainOn(0,x,86400):W.bufferSource.noteGrainOn(0,x,B):T._loop?W.bufferSource.start(0,x,86400):W.bufferSource.start(0,x,B),F!==1/0&&(m._endTimers[T._id]=setTimeout(m._ended.bind(m,T),F)),f||setTimeout(function(){m._emit("play",T._id),m._loadQueue()},0)};n.state==="running"&&n.ctx.state!=="interrupted"?X():(m._playLock=!0,m.once("resume",X),m._clearTimer(T._id))}else{var G=function(){W.currentTime=x,W.muted=T._muted||m._muted||n._muted||W.muted,W.volume=T._volume*n.volume(),W.playbackRate=T._rate;try{var te=W.play();if(te&&typeof Promise<"u"&&(te instanceof Promise||typeof te.then=="function")?(m._playLock=!0,Y(),te.then(function(){m._playLock=!1,W._unlocked=!0,f?m._loadQueue():m._emit("play",T._id)}).catch(function(){m._playLock=!1,m._emit("playerror",T._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),T._ended=!0,T._paused=!0})):f||(m._playLock=!1,Y(),m._emit("play",T._id)),W.playbackRate=T._rate,W.paused){m._emit("playerror",T._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");return}l!=="__default"||T._loop?m._endTimers[T._id]=setTimeout(m._ended.bind(m,T),F):(m._endTimers[T._id]=function(){m._ended(T),W.removeEventListener("ended",m._endTimers[T._id],!1)},W.addEventListener("ended",m._endTimers[T._id],!1))}catch(ke){m._emit("playerror",T._id,ke)}};W.src==="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"&&(W.src=m._src,W.load());var z=window&&window.ejecta||!W.readyState&&n._navigator.isCocoonJS;if(W.readyState>=3||z)G();else{m._playLock=!0,m._state="loading";var Q=function(){m._state="loaded",G(),W.removeEventListener(n._canPlayEvent,Q,!1)};W.addEventListener(n._canPlayEvent,Q,!1),m._clearTimer(T._id)}}return T._id},pause:function(l){var f=this;if(f._state!=="loaded"||f._playLock)return f._queue.push({event:"pause",action:function(){f.pause(l)}}),f;for(var m=f._getSoundIds(l),y=0;y<m.length;y++){f._clearTimer(m[y]);var b=f._soundById(m[y]);if(b&&!b._paused&&(b._seek=f.seek(m[y]),b._rateSeek=0,b._paused=!0,f._stopFade(m[y]),b._node))if(f._webAudio){if(!b._node.bufferSource)continue;typeof b._node.bufferSource.stop>"u"?b._node.bufferSource.noteOff(0):b._node.bufferSource.stop(0),f._cleanBuffer(b._node)}else(!isNaN(b._node.duration)||b._node.duration===1/0)&&b._node.pause();arguments[1]||f._emit("pause",b?b._id:null)}return f},stop:function(l,f){var m=this;if(m._state!=="loaded"||m._playLock)return m._queue.push({event:"stop",action:function(){m.stop(l)}}),m;for(var y=m._getSoundIds(l),b=0;b<y.length;b++){m._clearTimer(y[b]);var S=m._soundById(y[b]);S&&(S._seek=S._start||0,S._rateSeek=0,S._paused=!0,S._ended=!0,m._stopFade(y[b]),S._node&&(m._webAudio?S._node.bufferSource&&(typeof S._node.bufferSource.stop>"u"?S._node.bufferSource.noteOff(0):S._node.bufferSource.stop(0),m._cleanBuffer(S._node)):(!isNaN(S._node.duration)||S._node.duration===1/0)&&(S._node.currentTime=S._start||0,S._node.pause(),S._node.duration===1/0&&m._clearSound(S._node))),f||m._emit("stop",S._id))}return m},mute:function(l,f){var m=this;if(m._state!=="loaded"||m._playLock)return m._queue.push({event:"mute",action:function(){m.mute(l,f)}}),m;if(typeof f>"u")if(typeof l=="boolean")m._muted=l;else return m._muted;for(var y=m._getSoundIds(f),b=0;b<y.length;b++){var S=m._soundById(y[b]);S&&(S._muted=l,S._interval&&m._stopFade(S._id),m._webAudio&&S._node?S._node.gain.setValueAtTime(l?0:S._volume,n.ctx.currentTime):S._node&&(S._node.muted=n._muted?!0:l),m._emit("mute",S._id))}return m},volume:function(){var l=this,f=arguments,m,y;if(f.length===0)return l._volume;if(f.length===1||f.length===2&&typeof f[1]>"u"){var b=l._getSoundIds(),S=b.indexOf(f[0]);S>=0?y=parseInt(f[0],10):m=parseFloat(f[0])}else f.length>=2&&(m=parseFloat(f[0]),y=parseInt(f[1],10));var T;if(typeof m<"u"&&m>=0&&m<=1){if(l._state!=="loaded"||l._playLock)return l._queue.push({event:"volume",action:function(){l.volume.apply(l,f)}}),l;typeof y>"u"&&(l._volume=m),y=l._getSoundIds(y);for(var I=0;I<y.length;I++)T=l._soundById(y[I]),T&&(T._volume=m,f[2]||l._stopFade(y[I]),l._webAudio&&T._node&&!T._muted?T._node.gain.setValueAtTime(m,n.ctx.currentTime):T._node&&!T._muted&&(T._node.volume=m*n.volume()),l._emit("volume",T._id))}else return T=y?l._soundById(y):l._sounds[0],T?T._volume:0;return l},fade:function(l,f,m,y){var b=this;if(b._state!=="loaded"||b._playLock)return b._queue.push({event:"fade",action:function(){b.fade(l,f,m,y)}}),b;l=Math.min(Math.max(0,parseFloat(l)),1),f=Math.min(Math.max(0,parseFloat(f)),1),m=parseFloat(m),b.volume(l,y);for(var S=b._getSoundIds(y),T=0;T<S.length;T++){var I=b._soundById(S[T]);if(I){if(y||b._stopFade(S[T]),b._webAudio&&!I._muted){var x=n.ctx.currentTime,B=x+m/1e3;I._volume=l,I._node.gain.setValueAtTime(l,x),I._node.gain.linearRampToValueAtTime(f,B)}b._startFadeInterval(I,l,f,m,S[T],typeof y>"u")}}return b},_startFadeInterval:function(l,f,m,y,b,S){var T=this,I=f,x=m-f,B=Math.abs(x/.01),F=Math.max(4,B>0?y/B:y),L=Date.now();l._fadeTo=m,l._interval=setInterval(function(){var P=(Date.now()-L)/y;L=Date.now(),I+=x*P,I=Math.round(I*100)/100,x<0?I=Math.max(m,I):I=Math.min(m,I),T._webAudio?l._volume=I:T.volume(I,l._id,!0),S&&(T._volume=I),(m<f&&I<=m||m>f&&I>=m)&&(clearInterval(l._interval),l._interval=null,l._fadeTo=null,T.volume(m,l._id),T._emit("fade",l._id))},F)},_stopFade:function(l){var f=this,m=f._soundById(l);return m&&m._interval&&(f._webAudio&&m._node.gain.cancelScheduledValues(n.ctx.currentTime),clearInterval(m._interval),m._interval=null,f.volume(m._fadeTo,l),m._fadeTo=null,f._emit("fade",l)),f},loop:function(){var l=this,f=arguments,m,y,b;if(f.length===0)return l._loop;if(f.length===1)if(typeof f[0]=="boolean")m=f[0],l._loop=m;else return b=l._soundById(parseInt(f[0],10)),b?b._loop:!1;else f.length===2&&(m=f[0],y=parseInt(f[1],10));for(var S=l._getSoundIds(y),T=0;T<S.length;T++)b=l._soundById(S[T]),b&&(b._loop=m,l._webAudio&&b._node&&b._node.bufferSource&&(b._node.bufferSource.loop=m,m&&(b._node.bufferSource.loopStart=b._start||0,b._node.bufferSource.loopEnd=b._stop,l.playing(S[T])&&(l.pause(S[T],!0),l.play(S[T],!0)))));return l},rate:function(){var l=this,f=arguments,m,y;if(f.length===0)y=l._sounds[0]._id;else if(f.length===1){var b=l._getSoundIds(),S=b.indexOf(f[0]);S>=0?y=parseInt(f[0],10):m=parseFloat(f[0])}else f.length===2&&(m=parseFloat(f[0]),y=parseInt(f[1],10));var T;if(typeof m=="number"){if(l._state!=="loaded"||l._playLock)return l._queue.push({event:"rate",action:function(){l.rate.apply(l,f)}}),l;typeof y>"u"&&(l._rate=m),y=l._getSoundIds(y);for(var I=0;I<y.length;I++)if(T=l._soundById(y[I]),T){l.playing(y[I])&&(T._rateSeek=l.seek(y[I]),T._playStart=l._webAudio?n.ctx.currentTime:T._playStart),T._rate=m,l._webAudio&&T._node&&T._node.bufferSource?T._node.bufferSource.playbackRate.setValueAtTime(m,n.ctx.currentTime):T._node&&(T._node.playbackRate=m);var x=l.seek(y[I]),B=(l._sprite[T._sprite][0]+l._sprite[T._sprite][1])/1e3-x,F=B*1e3/Math.abs(T._rate);(l._endTimers[y[I]]||!T._paused)&&(l._clearTimer(y[I]),l._endTimers[y[I]]=setTimeout(l._ended.bind(l,T),F)),l._emit("rate",T._id)}}else return T=l._soundById(y),T?T._rate:l._rate;return l},seek:function(){var l=this,f=arguments,m,y;if(f.length===0)l._sounds.length&&(y=l._sounds[0]._id);else if(f.length===1){var b=l._getSoundIds(),S=b.indexOf(f[0]);S>=0?y=parseInt(f[0],10):l._sounds.length&&(y=l._sounds[0]._id,m=parseFloat(f[0]))}else f.length===2&&(m=parseFloat(f[0]),y=parseInt(f[1],10));if(typeof y>"u")return 0;if(typeof m=="number"&&(l._state!=="loaded"||l._playLock))return l._queue.push({event:"seek",action:function(){l.seek.apply(l,f)}}),l;var T=l._soundById(y);if(T)if(typeof m=="number"&&m>=0){var I=l.playing(y);I&&l.pause(y,!0),T._seek=m,T._ended=!1,l._clearTimer(y),!l._webAudio&&T._node&&!isNaN(T._node.duration)&&(T._node.currentTime=m);var x=function(){I&&l.play(y,!0),l._emit("seek",y)};if(I&&!l._webAudio){var B=function(){l._playLock?setTimeout(B,0):x()};setTimeout(B,0)}else x()}else if(l._webAudio){var F=l.playing(y)?n.ctx.currentTime-T._playStart:0,L=T._rateSeek?T._rateSeek-T._seek:0;return T._seek+(L+F*Math.abs(T._rate))}else return T._node.currentTime;return l},playing:function(l){var f=this;if(typeof l=="number"){var m=f._soundById(l);return m?!m._paused:!1}for(var y=0;y<f._sounds.length;y++)if(!f._sounds[y]._paused)return!0;return!1},duration:function(l){var f=this,m=f._duration,y=f._soundById(l);return y&&(m=f._sprite[y._sprite][1]/1e3),m},state:function(){return this._state},unload:function(){for(var l=this,f=l._sounds,m=0;m<f.length;m++)f[m]._paused||l.stop(f[m]._id),l._webAudio||(l._clearSound(f[m]._node),f[m]._node.removeEventListener("error",f[m]._errorFn,!1),f[m]._node.removeEventListener(n._canPlayEvent,f[m]._loadFn,!1),f[m]._node.removeEventListener("ended",f[m]._endFn,!1),n._releaseHtml5Audio(f[m]._node)),delete f[m]._node,l._clearTimer(f[m]._id);var y=n._howls.indexOf(l);y>=0&&n._howls.splice(y,1);var b=!0;for(m=0;m<n._howls.length;m++)if(n._howls[m]._src===l._src||l._src.indexOf(n._howls[m]._src)>=0){b=!1;break}return a&&b&&delete a[l._src],n.noAudio=!1,l._state="unloaded",l._sounds=[],l=null,null},on:function(l,f,m,y){var b=this,S=b["_on"+l];return typeof f=="function"&&S.push(y?{id:m,fn:f,once:y}:{id:m,fn:f}),b},off:function(l,f,m){var y=this,b=y["_on"+l],S=0;if(typeof f=="number"&&(m=f,f=null),f||m)for(S=0;S<b.length;S++){var T=m===b[S].id;if(f===b[S].fn&&T||!f&&T){b.splice(S,1);break}}else if(l)y["_on"+l]=[];else{var I=Object.keys(y);for(S=0;S<I.length;S++)I[S].indexOf("_on")===0&&Array.isArray(y[I[S]])&&(y[I[S]]=[])}return y},once:function(l,f,m){var y=this;return y.on(l,f,m,1),y},_emit:function(l,f,m){for(var y=this,b=y["_on"+l],S=b.length-1;S>=0;S--)(!b[S].id||b[S].id===f||l==="load")&&(setTimeout((function(T){T.call(this,f,m)}).bind(y,b[S].fn),0),b[S].once&&y.off(l,b[S].fn,b[S].id));return y._loadQueue(l),y},_loadQueue:function(l){var f=this;if(f._queue.length>0){var m=f._queue[0];m.event===l&&(f._queue.shift(),f._loadQueue()),l||m.action()}return f},_ended:function(l){var f=this,m=l._sprite;if(!f._webAudio&&l._node&&!l._node.paused&&!l._node.ended&&l._node.currentTime<l._stop)return setTimeout(f._ended.bind(f,l),100),f;var y=!!(l._loop||f._sprite[m][2]);if(f._emit("end",l._id),!f._webAudio&&y&&f.stop(l._id,!0).play(l._id),f._webAudio&&y){f._emit("play",l._id),l._seek=l._start||0,l._rateSeek=0,l._playStart=n.ctx.currentTime;var b=(l._stop-l._start)*1e3/Math.abs(l._rate);f._endTimers[l._id]=setTimeout(f._ended.bind(f,l),b)}return f._webAudio&&!y&&(l._paused=!0,l._ended=!0,l._seek=l._start||0,l._rateSeek=0,f._clearTimer(l._id),f._cleanBuffer(l._node),n._autoSuspend()),!f._webAudio&&!y&&f.stop(l._id,!0),f},_clearTimer:function(l){var f=this;if(f._endTimers[l]){if(typeof f._endTimers[l]!="function")clearTimeout(f._endTimers[l]);else{var m=f._soundById(l);m&&m._node&&m._node.removeEventListener("ended",f._endTimers[l],!1)}delete f._endTimers[l]}return f},_soundById:function(l){for(var f=this,m=0;m<f._sounds.length;m++)if(l===f._sounds[m]._id)return f._sounds[m];return null},_inactiveSound:function(){var l=this;l._drain();for(var f=0;f<l._sounds.length;f++)if(l._sounds[f]._ended)return l._sounds[f].reset();return new o(l)},_drain:function(){var l=this,f=l._pool,m=0,y=0;if(!(l._sounds.length<f)){for(y=0;y<l._sounds.length;y++)l._sounds[y]._ended&&m++;for(y=l._sounds.length-1;y>=0;y--){if(m<=f)return;l._sounds[y]._ended&&(l._webAudio&&l._sounds[y]._node&&l._sounds[y]._node.disconnect(0),l._sounds.splice(y,1),m--)}}},_getSoundIds:function(l){var f=this;if(typeof l>"u"){for(var m=[],y=0;y<f._sounds.length;y++)m.push(f._sounds[y]._id);return m}else return[l]},_refreshBuffer:function(l){var f=this;return l._node.bufferSource=n.ctx.createBufferSource(),l._node.bufferSource.buffer=a[f._src],l._panner?l._node.bufferSource.connect(l._panner):l._node.bufferSource.connect(l._node),l._node.bufferSource.loop=l._loop,l._loop&&(l._node.bufferSource.loopStart=l._start||0,l._node.bufferSource.loopEnd=l._stop||0),l._node.bufferSource.playbackRate.setValueAtTime(l._rate,n.ctx.currentTime),f},_cleanBuffer:function(l){var f=this,m=n._navigator&&n._navigator.vendor.indexOf("Apple")>=0;if(!l.bufferSource)return f;if(n._scratchBuffer&&l.bufferSource&&(l.bufferSource.onended=null,l.bufferSource.disconnect(0),m))try{l.bufferSource.buffer=n._scratchBuffer}catch{}return l.bufferSource=null,f},_clearSound:function(l){var f=/MSIE |Trident\//.test(n._navigator&&n._navigator.userAgent);f||(l.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var o=function(l){this._parent=l,this.init()};o.prototype={init:function(){var l=this,f=l._parent;return l._muted=f._muted,l._loop=f._loop,l._volume=f._volume,l._rate=f._rate,l._seek=0,l._paused=!0,l._ended=!0,l._sprite="__default",l._id=++n._counter,f._sounds.push(l),l.create(),l},create:function(){var l=this,f=l._parent,m=n._muted||l._muted||l._parent._muted?0:l._volume;return f._webAudio?(l._node=typeof n.ctx.createGain>"u"?n.ctx.createGainNode():n.ctx.createGain(),l._node.gain.setValueAtTime(m,n.ctx.currentTime),l._node.paused=!0,l._node.connect(n.masterGain)):n.noAudio||(l._node=n._obtainHtml5Audio(),l._errorFn=l._errorListener.bind(l),l._node.addEventListener("error",l._errorFn,!1),l._loadFn=l._loadListener.bind(l),l._node.addEventListener(n._canPlayEvent,l._loadFn,!1),l._endFn=l._endListener.bind(l),l._node.addEventListener("ended",l._endFn,!1),l._node.src=f._src,l._node.preload=f._preload===!0?"auto":f._preload,l._node.volume=m*n.volume(),l._node.load()),l},reset:function(){var l=this,f=l._parent;return l._muted=f._muted,l._loop=f._loop,l._volume=f._volume,l._rate=f._rate,l._seek=0,l._rateSeek=0,l._paused=!0,l._ended=!0,l._sprite="__default",l._id=++n._counter,l},_errorListener:function(){var l=this;l._parent._emit("loaderror",l._id,l._node.error?l._node.error.code:0),l._node.removeEventListener("error",l._errorFn,!1)},_loadListener:function(){var l=this,f=l._parent;f._duration=Math.ceil(l._node.duration*10)/10,Object.keys(f._sprite).length===0&&(f._sprite={__default:[0,f._duration*1e3]}),f._state!=="loaded"&&(f._state="loaded",f._emit("load"),f._loadQueue()),l._node.removeEventListener(n._canPlayEvent,l._loadFn,!1)},_endListener:function(){var l=this,f=l._parent;f._duration===1/0&&(f._duration=Math.ceil(l._node.duration*10)/10,f._sprite.__default[1]===1/0&&(f._sprite.__default[1]=f._duration*1e3),f._ended(l)),l._node.removeEventListener("ended",l._endFn,!1)}};var a={},s=function(l){var f=l._src;if(a[f]){l._duration=a[f].duration,u(l);return}if(/^data:[^;]+;base64,/.test(f)){for(var m=atob(f.split(",")[1]),y=new Uint8Array(m.length),b=0;b<m.length;++b)y[b]=m.charCodeAt(b);d(y.buffer,l)}else{var S=new XMLHttpRequest;S.open(l._xhr.method,f,!0),S.withCredentials=l._xhr.withCredentials,S.responseType="arraybuffer",l._xhr.headers&&Object.keys(l._xhr.headers).forEach(function(T){S.setRequestHeader(T,l._xhr.headers[T])}),S.onload=function(){var T=(S.status+"")[0];if(T!=="0"&&T!=="2"&&T!=="3"){l._emit("loaderror",null,"Failed loading audio file with status: "+S.status+".");return}d(S.response,l)},S.onerror=function(){l._webAudio&&(l._html5=!0,l._webAudio=!1,l._sounds=[],delete a[f],l.load())},c(S)}},c=function(l){try{l.send()}catch{l.onerror()}},d=function(l,f){var m=function(){f._emit("loaderror",null,"Decoding audio data failed.")},y=function(b){b&&f._sounds.length>0?(a[f._src]=b,u(f,b)):m()};typeof Promise<"u"&&n.ctx.decodeAudioData.length===1?n.ctx.decodeAudioData(l).then(y).catch(m):n.ctx.decodeAudioData(l,y,m)},u=function(l,f){f&&!l._duration&&(l._duration=f.duration),Object.keys(l._sprite).length===0&&(l._sprite={__default:[0,l._duration*1e3]}),l._state!=="loaded"&&(l._state="loaded",l._emit("load"),l._loadQueue())},h=function(){if(n.usingWebAudio){try{typeof AudioContext<"u"?n.ctx=new AudioContext:typeof webkitAudioContext<"u"?n.ctx=new webkitAudioContext:n.usingWebAudio=!1}catch{n.usingWebAudio=!1}n.ctx||(n.usingWebAudio=!1);var l=/iP(hone|od|ad)/.test(n._navigator&&n._navigator.platform),f=n._navigator&&n._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),m=f?parseInt(f[1],10):null;if(l&&m&&m<9){var y=/safari/.test(n._navigator&&n._navigator.userAgent.toLowerCase());n._navigator&&!y&&(n.usingWebAudio=!1)}n.usingWebAudio&&(n.masterGain=typeof n.ctx.createGain>"u"?n.ctx.createGainNode():n.ctx.createGain(),n.masterGain.gain.setValueAtTime(n._muted?0:n._volume,n.ctx.currentTime),n.masterGain.connect(n.ctx.destination)),n._setup()}};e.Howler=n,e.Howl=r,typeof wt<"u"?(wt.HowlerGlobal=t,wt.Howler=n,wt.Howl=r,wt.Sound=o):typeof window<"u"&&(window.HowlerGlobal=t,window.Howler=n,window.Howl=r,window.Sound=o)})();/*!
27
+ */(function(e){(function(){var t=function(){this.init()};t.prototype={init:function(){var l=this||n;return l._counter=1e3,l._html5AudioPool=[],l.html5PoolSize=10,l._codecs={},l._howls=[],l._muted=!1,l._volume=1,l._canPlayEvent="canplaythrough",l._navigator=typeof window<"u"&&window.navigator?window.navigator:null,l.masterGain=null,l.noAudio=!1,l.usingWebAudio=!0,l.autoSuspend=!0,l.ctx=null,l.autoUnlock=!0,l._setup(),l},volume:function(l){var f=this||n;if(l=parseFloat(l),f.ctx||h(),typeof l<"u"&&l>=0&&l<=1){if(f._volume=l,f._muted)return f;f.usingWebAudio&&f.masterGain.gain.setValueAtTime(l,n.ctx.currentTime);for(var m=0;m<f._howls.length;m++)if(!f._howls[m]._webAudio)for(var y=f._howls[m]._getSoundIds(),b=0;b<y.length;b++){var S=f._howls[m]._soundById(y[b]);S&&S._node&&(S._node.volume=S._volume*l)}return f}return f._volume},mute:function(l){var f=this||n;f.ctx||h(),f._muted=l,f.usingWebAudio&&f.masterGain.gain.setValueAtTime(l?0:f._volume,n.ctx.currentTime);for(var m=0;m<f._howls.length;m++)if(!f._howls[m]._webAudio)for(var y=f._howls[m]._getSoundIds(),b=0;b<y.length;b++){var S=f._howls[m]._soundById(y[b]);S&&S._node&&(S._node.muted=l?!0:S._muted)}return f},stop:function(){for(var l=this||n,f=0;f<l._howls.length;f++)l._howls[f].stop();return l},unload:function(){for(var l=this||n,f=l._howls.length-1;f>=0;f--)l._howls[f].unload();return l.usingWebAudio&&l.ctx&&typeof l.ctx.close<"u"&&(l.ctx.close(),l.ctx=null,h()),l},codecs:function(l){return(this||n)._codecs[l.replace(/^x-/,"")]},_setup:function(){var l=this||n;if(l.state=l.ctx&&l.ctx.state||"suspended",l._autoSuspend(),!l.usingWebAudio)if(typeof Audio<"u")try{var f=new Audio;typeof f.oncanplaythrough>"u"&&(l._canPlayEvent="canplay")}catch{l.noAudio=!0}else l.noAudio=!0;try{var f=new Audio;f.muted&&(l.noAudio=!0)}catch{}return l.noAudio||l._setupCodecs(),l},_setupCodecs:function(){var l=this||n,f=null;try{f=typeof Audio<"u"?new Audio:null}catch{return l}if(!f||typeof f.canPlayType!="function")return l;var m=f.canPlayType("audio/mpeg;").replace(/^no$/,""),y=l._navigator?l._navigator.userAgent:"",b=y.match(/OPR\/(\d+)/g),S=b&&parseInt(b[0].split("/")[1],10)<33,T=y.indexOf("Safari")!==-1&&y.indexOf("Chrome")===-1,I=y.match(/Version\/(.*?) /),D=T&&I&&parseInt(I[1],10)<15;return l._codecs={mp3:!!(!S&&(m||f.canPlayType("audio/mp3;").replace(/^no$/,""))),mpeg:!!m,opus:!!f.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!f.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!f.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(f.canPlayType('audio/wav; codecs="1"')||f.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!f.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!f.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(f.canPlayType("audio/x-m4a;")||f.canPlayType("audio/m4a;")||f.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(f.canPlayType("audio/x-m4b;")||f.canPlayType("audio/m4b;")||f.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(f.canPlayType("audio/x-mp4;")||f.canPlayType("audio/mp4;")||f.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!!(!D&&f.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!!(!D&&f.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!f.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(f.canPlayType("audio/x-flac;")||f.canPlayType("audio/flac;")).replace(/^no$/,"")},l},_unlockAudio:function(){var l=this||n;if(!(l._audioUnlocked||!l.ctx)){l._audioUnlocked=!1,l.autoUnlock=!1,!l._mobileUnloaded&&l.ctx.sampleRate!==44100&&(l._mobileUnloaded=!0,l.unload()),l._scratchBuffer=l.ctx.createBuffer(1,1,22050);var f=function(m){for(;l._html5AudioPool.length<l.html5PoolSize;)try{var y=new Audio;y._unlocked=!0,l._releaseHtml5Audio(y)}catch{l.noAudio=!0;break}for(var b=0;b<l._howls.length;b++)if(!l._howls[b]._webAudio)for(var S=l._howls[b]._getSoundIds(),T=0;T<S.length;T++){var I=l._howls[b]._soundById(S[T]);I&&I._node&&!I._node._unlocked&&(I._node._unlocked=!0,I._node.load())}l._autoResume();var D=l.ctx.createBufferSource();D.buffer=l._scratchBuffer,D.connect(l.ctx.destination),typeof D.start>"u"?D.noteOn(0):D.start(0),typeof l.ctx.resume=="function"&&l.ctx.resume(),D.onended=function(){D.disconnect(0),l._audioUnlocked=!0,document.removeEventListener("touchstart",f,!0),document.removeEventListener("touchend",f,!0),document.removeEventListener("click",f,!0),document.removeEventListener("keydown",f,!0);for(var R=0;R<l._howls.length;R++)l._howls[R]._emit("unlock")}};return document.addEventListener("touchstart",f,!0),document.addEventListener("touchend",f,!0),document.addEventListener("click",f,!0),document.addEventListener("keydown",f,!0),l}},_obtainHtml5Audio:function(){var l=this||n;if(l._html5AudioPool.length)return l._html5AudioPool.pop();var f=new Audio().play();return f&&typeof Promise<"u"&&(f instanceof Promise||typeof f.then=="function")&&f.catch(function(){console.warn("HTML5 Audio pool exhausted, returning potentially locked audio object.")}),new Audio},_releaseHtml5Audio:function(l){var f=this||n;return l._unlocked&&f._html5AudioPool.push(l),f},_autoSuspend:function(){var l=this;if(!(!l.autoSuspend||!l.ctx||typeof l.ctx.suspend>"u"||!n.usingWebAudio)){for(var f=0;f<l._howls.length;f++)if(l._howls[f]._webAudio){for(var m=0;m<l._howls[f]._sounds.length;m++)if(!l._howls[f]._sounds[m]._paused)return l}return l._suspendTimer&&clearTimeout(l._suspendTimer),l._suspendTimer=setTimeout(function(){if(l.autoSuspend){l._suspendTimer=null,l.state="suspending";var y=function(){l.state="suspended",l._resumeAfterSuspend&&(delete l._resumeAfterSuspend,l._autoResume())};l.ctx.suspend().then(y,y)}},3e4),l}},_autoResume:function(){var l=this;if(!(!l.ctx||typeof l.ctx.resume>"u"||!n.usingWebAudio))return l.state==="running"&&l.ctx.state!=="interrupted"&&l._suspendTimer?(clearTimeout(l._suspendTimer),l._suspendTimer=null):l.state==="suspended"||l.state==="running"&&l.ctx.state==="interrupted"?(l.ctx.resume().then(function(){l.state="running";for(var f=0;f<l._howls.length;f++)l._howls[f]._emit("resume")}),l._suspendTimer&&(clearTimeout(l._suspendTimer),l._suspendTimer=null)):l.state==="suspending"&&(l._resumeAfterSuspend=!0),l}};var n=new t,r=function(l){var f=this;if(!l.src||l.src.length===0){console.error("An array of source files must be passed with any new Howl.");return}f.init(l)};r.prototype={init:function(l){var f=this;return n.ctx||h(),f._autoplay=l.autoplay||!1,f._format=typeof l.format!="string"?l.format:[l.format],f._html5=l.html5||!1,f._muted=l.mute||!1,f._loop=l.loop||!1,f._pool=l.pool||5,f._preload=typeof l.preload=="boolean"||l.preload==="metadata"?l.preload:!0,f._rate=l.rate||1,f._sprite=l.sprite||{},f._src=typeof l.src!="string"?l.src:[l.src],f._volume=l.volume!==void 0?l.volume:1,f._xhr={method:l.xhr&&l.xhr.method?l.xhr.method:"GET",headers:l.xhr&&l.xhr.headers?l.xhr.headers:null,withCredentials:l.xhr&&l.xhr.withCredentials?l.xhr.withCredentials:!1},f._duration=0,f._state="unloaded",f._sounds=[],f._endTimers={},f._queue=[],f._playLock=!1,f._onend=l.onend?[{fn:l.onend}]:[],f._onfade=l.onfade?[{fn:l.onfade}]:[],f._onload=l.onload?[{fn:l.onload}]:[],f._onloaderror=l.onloaderror?[{fn:l.onloaderror}]:[],f._onplayerror=l.onplayerror?[{fn:l.onplayerror}]:[],f._onpause=l.onpause?[{fn:l.onpause}]:[],f._onplay=l.onplay?[{fn:l.onplay}]:[],f._onstop=l.onstop?[{fn:l.onstop}]:[],f._onmute=l.onmute?[{fn:l.onmute}]:[],f._onvolume=l.onvolume?[{fn:l.onvolume}]:[],f._onrate=l.onrate?[{fn:l.onrate}]:[],f._onseek=l.onseek?[{fn:l.onseek}]:[],f._onunlock=l.onunlock?[{fn:l.onunlock}]:[],f._onresume=[],f._webAudio=n.usingWebAudio&&!f._html5,typeof n.ctx<"u"&&n.ctx&&n.autoUnlock&&n._unlockAudio(),n._howls.push(f),f._autoplay&&f._queue.push({event:"play",action:function(){f.play()}}),f._preload&&f._preload!=="none"&&f.load(),f},load:function(){var l=this,f=null;if(n.noAudio){l._emit("loaderror",null,"No audio support.");return}typeof l._src=="string"&&(l._src=[l._src]);for(var m=0;m<l._src.length;m++){var y,b;if(l._format&&l._format[m])y=l._format[m];else{if(b=l._src[m],typeof b!="string"){l._emit("loaderror",null,"Non-string found in selected audio sources - ignoring.");continue}y=/^data:audio\/([^;,]+);/i.exec(b),y||(y=/\.([^.]+)$/.exec(b.split("?",1)[0])),y&&(y=y[1].toLowerCase())}if(y||console.warn('No file extension was found. Consider using the "format" property or specify an extension.'),y&&n.codecs(y)){f=l._src[m];break}}if(!f){l._emit("loaderror",null,"No codec support for selected audio sources.");return}return l._src=f,l._state="loading",window.location.protocol==="https:"&&f.slice(0,5)==="http:"&&(l._html5=!0,l._webAudio=!1),new o(l),l._webAudio&&s(l),l},play:function(l,f){var m=this,y=null;if(typeof l=="number")y=l,l=null;else{if(typeof l=="string"&&m._state==="loaded"&&!m._sprite[l])return null;if(typeof l>"u"&&(l="__default",!m._playLock)){for(var b=0,S=0;S<m._sounds.length;S++)m._sounds[S]._paused&&!m._sounds[S]._ended&&(b++,y=m._sounds[S]._id);b===1?l=null:y=null}}var T=y?m._soundById(y):m._inactiveSound();if(!T)return null;if(y&&!l&&(l=T._sprite||"__default"),m._state!=="loaded"){T._sprite=l,T._ended=!1;var I=T._id;return m._queue.push({event:"play",action:function(){m.play(I)}}),I}if(y&&!T._paused)return f||m._loadQueue("play"),T._id;m._webAudio&&n._autoResume();var D=Math.max(0,T._seek>0?T._seek:m._sprite[l][0]/1e3),R=Math.max(0,(m._sprite[l][0]+m._sprite[l][1])/1e3-D),F=R*1e3/Math.abs(T._rate),L=m._sprite[l][0]/1e3,P=(m._sprite[l][0]+m._sprite[l][1])/1e3;T._sprite=l,T._ended=!1;var Y=function(){T._paused=!1,T._seek=D,T._start=L,T._stop=P,T._loop=!!(T._loop||m._sprite[l][2])};if(D>=P){m._ended(T);return}var W=T._node;if(m._webAudio){var X=function(){m._playLock=!1,Y(),m._refreshBuffer(T);var te=T._muted||m._muted?0:T._volume;W.gain.setValueAtTime(te,n.ctx.currentTime),T._playStart=n.ctx.currentTime,typeof W.bufferSource.start>"u"?T._loop?W.bufferSource.noteGrainOn(0,D,86400):W.bufferSource.noteGrainOn(0,D,R):T._loop?W.bufferSource.start(0,D,86400):W.bufferSource.start(0,D,R),F!==1/0&&(m._endTimers[T._id]=setTimeout(m._ended.bind(m,T),F)),f||setTimeout(function(){m._emit("play",T._id),m._loadQueue()},0)};n.state==="running"&&n.ctx.state!=="interrupted"?X():(m._playLock=!0,m.once("resume",X),m._clearTimer(T._id))}else{var G=function(){W.currentTime=D,W.muted=T._muted||m._muted||n._muted||W.muted,W.volume=T._volume*n.volume(),W.playbackRate=T._rate;try{var te=W.play();if(te&&typeof Promise<"u"&&(te instanceof Promise||typeof te.then=="function")?(m._playLock=!0,Y(),te.then(function(){m._playLock=!1,W._unlocked=!0,f?m._loadQueue():m._emit("play",T._id)}).catch(function(){m._playLock=!1,m._emit("playerror",T._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),T._ended=!0,T._paused=!0})):f||(m._playLock=!1,Y(),m._emit("play",T._id)),W.playbackRate=T._rate,W.paused){m._emit("playerror",T._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");return}l!=="__default"||T._loop?m._endTimers[T._id]=setTimeout(m._ended.bind(m,T),F):(m._endTimers[T._id]=function(){m._ended(T),W.removeEventListener("ended",m._endTimers[T._id],!1)},W.addEventListener("ended",m._endTimers[T._id],!1))}catch(ke){m._emit("playerror",T._id,ke)}};W.src==="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"&&(W.src=m._src,W.load());var z=window&&window.ejecta||!W.readyState&&n._navigator.isCocoonJS;if(W.readyState>=3||z)G();else{m._playLock=!0,m._state="loading";var Q=function(){m._state="loaded",G(),W.removeEventListener(n._canPlayEvent,Q,!1)};W.addEventListener(n._canPlayEvent,Q,!1),m._clearTimer(T._id)}}return T._id},pause:function(l){var f=this;if(f._state!=="loaded"||f._playLock)return f._queue.push({event:"pause",action:function(){f.pause(l)}}),f;for(var m=f._getSoundIds(l),y=0;y<m.length;y++){f._clearTimer(m[y]);var b=f._soundById(m[y]);if(b&&!b._paused&&(b._seek=f.seek(m[y]),b._rateSeek=0,b._paused=!0,f._stopFade(m[y]),b._node))if(f._webAudio){if(!b._node.bufferSource)continue;typeof b._node.bufferSource.stop>"u"?b._node.bufferSource.noteOff(0):b._node.bufferSource.stop(0),f._cleanBuffer(b._node)}else(!isNaN(b._node.duration)||b._node.duration===1/0)&&b._node.pause();arguments[1]||f._emit("pause",b?b._id:null)}return f},stop:function(l,f){var m=this;if(m._state!=="loaded"||m._playLock)return m._queue.push({event:"stop",action:function(){m.stop(l)}}),m;for(var y=m._getSoundIds(l),b=0;b<y.length;b++){m._clearTimer(y[b]);var S=m._soundById(y[b]);S&&(S._seek=S._start||0,S._rateSeek=0,S._paused=!0,S._ended=!0,m._stopFade(y[b]),S._node&&(m._webAudio?S._node.bufferSource&&(typeof S._node.bufferSource.stop>"u"?S._node.bufferSource.noteOff(0):S._node.bufferSource.stop(0),m._cleanBuffer(S._node)):(!isNaN(S._node.duration)||S._node.duration===1/0)&&(S._node.currentTime=S._start||0,S._node.pause(),S._node.duration===1/0&&m._clearSound(S._node))),f||m._emit("stop",S._id))}return m},mute:function(l,f){var m=this;if(m._state!=="loaded"||m._playLock)return m._queue.push({event:"mute",action:function(){m.mute(l,f)}}),m;if(typeof f>"u")if(typeof l=="boolean")m._muted=l;else return m._muted;for(var y=m._getSoundIds(f),b=0;b<y.length;b++){var S=m._soundById(y[b]);S&&(S._muted=l,S._interval&&m._stopFade(S._id),m._webAudio&&S._node?S._node.gain.setValueAtTime(l?0:S._volume,n.ctx.currentTime):S._node&&(S._node.muted=n._muted?!0:l),m._emit("mute",S._id))}return m},volume:function(){var l=this,f=arguments,m,y;if(f.length===0)return l._volume;if(f.length===1||f.length===2&&typeof f[1]>"u"){var b=l._getSoundIds(),S=b.indexOf(f[0]);S>=0?y=parseInt(f[0],10):m=parseFloat(f[0])}else f.length>=2&&(m=parseFloat(f[0]),y=parseInt(f[1],10));var T;if(typeof m<"u"&&m>=0&&m<=1){if(l._state!=="loaded"||l._playLock)return l._queue.push({event:"volume",action:function(){l.volume.apply(l,f)}}),l;typeof y>"u"&&(l._volume=m),y=l._getSoundIds(y);for(var I=0;I<y.length;I++)T=l._soundById(y[I]),T&&(T._volume=m,f[2]||l._stopFade(y[I]),l._webAudio&&T._node&&!T._muted?T._node.gain.setValueAtTime(m,n.ctx.currentTime):T._node&&!T._muted&&(T._node.volume=m*n.volume()),l._emit("volume",T._id))}else return T=y?l._soundById(y):l._sounds[0],T?T._volume:0;return l},fade:function(l,f,m,y){var b=this;if(b._state!=="loaded"||b._playLock)return b._queue.push({event:"fade",action:function(){b.fade(l,f,m,y)}}),b;l=Math.min(Math.max(0,parseFloat(l)),1),f=Math.min(Math.max(0,parseFloat(f)),1),m=parseFloat(m),b.volume(l,y);for(var S=b._getSoundIds(y),T=0;T<S.length;T++){var I=b._soundById(S[T]);if(I){if(y||b._stopFade(S[T]),b._webAudio&&!I._muted){var D=n.ctx.currentTime,R=D+m/1e3;I._volume=l,I._node.gain.setValueAtTime(l,D),I._node.gain.linearRampToValueAtTime(f,R)}b._startFadeInterval(I,l,f,m,S[T],typeof y>"u")}}return b},_startFadeInterval:function(l,f,m,y,b,S){var T=this,I=f,D=m-f,R=Math.abs(D/.01),F=Math.max(4,R>0?y/R:y),L=Date.now();l._fadeTo=m,l._interval=setInterval(function(){var P=(Date.now()-L)/y;L=Date.now(),I+=D*P,I=Math.round(I*100)/100,D<0?I=Math.max(m,I):I=Math.min(m,I),T._webAudio?l._volume=I:T.volume(I,l._id,!0),S&&(T._volume=I),(m<f&&I<=m||m>f&&I>=m)&&(clearInterval(l._interval),l._interval=null,l._fadeTo=null,T.volume(m,l._id),T._emit("fade",l._id))},F)},_stopFade:function(l){var f=this,m=f._soundById(l);return m&&m._interval&&(f._webAudio&&m._node.gain.cancelScheduledValues(n.ctx.currentTime),clearInterval(m._interval),m._interval=null,f.volume(m._fadeTo,l),m._fadeTo=null,f._emit("fade",l)),f},loop:function(){var l=this,f=arguments,m,y,b;if(f.length===0)return l._loop;if(f.length===1)if(typeof f[0]=="boolean")m=f[0],l._loop=m;else return b=l._soundById(parseInt(f[0],10)),b?b._loop:!1;else f.length===2&&(m=f[0],y=parseInt(f[1],10));for(var S=l._getSoundIds(y),T=0;T<S.length;T++)b=l._soundById(S[T]),b&&(b._loop=m,l._webAudio&&b._node&&b._node.bufferSource&&(b._node.bufferSource.loop=m,m&&(b._node.bufferSource.loopStart=b._start||0,b._node.bufferSource.loopEnd=b._stop,l.playing(S[T])&&(l.pause(S[T],!0),l.play(S[T],!0)))));return l},rate:function(){var l=this,f=arguments,m,y;if(f.length===0)y=l._sounds[0]._id;else if(f.length===1){var b=l._getSoundIds(),S=b.indexOf(f[0]);S>=0?y=parseInt(f[0],10):m=parseFloat(f[0])}else f.length===2&&(m=parseFloat(f[0]),y=parseInt(f[1],10));var T;if(typeof m=="number"){if(l._state!=="loaded"||l._playLock)return l._queue.push({event:"rate",action:function(){l.rate.apply(l,f)}}),l;typeof y>"u"&&(l._rate=m),y=l._getSoundIds(y);for(var I=0;I<y.length;I++)if(T=l._soundById(y[I]),T){l.playing(y[I])&&(T._rateSeek=l.seek(y[I]),T._playStart=l._webAudio?n.ctx.currentTime:T._playStart),T._rate=m,l._webAudio&&T._node&&T._node.bufferSource?T._node.bufferSource.playbackRate.setValueAtTime(m,n.ctx.currentTime):T._node&&(T._node.playbackRate=m);var D=l.seek(y[I]),R=(l._sprite[T._sprite][0]+l._sprite[T._sprite][1])/1e3-D,F=R*1e3/Math.abs(T._rate);(l._endTimers[y[I]]||!T._paused)&&(l._clearTimer(y[I]),l._endTimers[y[I]]=setTimeout(l._ended.bind(l,T),F)),l._emit("rate",T._id)}}else return T=l._soundById(y),T?T._rate:l._rate;return l},seek:function(){var l=this,f=arguments,m,y;if(f.length===0)l._sounds.length&&(y=l._sounds[0]._id);else if(f.length===1){var b=l._getSoundIds(),S=b.indexOf(f[0]);S>=0?y=parseInt(f[0],10):l._sounds.length&&(y=l._sounds[0]._id,m=parseFloat(f[0]))}else f.length===2&&(m=parseFloat(f[0]),y=parseInt(f[1],10));if(typeof y>"u")return 0;if(typeof m=="number"&&(l._state!=="loaded"||l._playLock))return l._queue.push({event:"seek",action:function(){l.seek.apply(l,f)}}),l;var T=l._soundById(y);if(T)if(typeof m=="number"&&m>=0){var I=l.playing(y);I&&l.pause(y,!0),T._seek=m,T._ended=!1,l._clearTimer(y),!l._webAudio&&T._node&&!isNaN(T._node.duration)&&(T._node.currentTime=m);var D=function(){I&&l.play(y,!0),l._emit("seek",y)};if(I&&!l._webAudio){var R=function(){l._playLock?setTimeout(R,0):D()};setTimeout(R,0)}else D()}else if(l._webAudio){var F=l.playing(y)?n.ctx.currentTime-T._playStart:0,L=T._rateSeek?T._rateSeek-T._seek:0;return T._seek+(L+F*Math.abs(T._rate))}else return T._node.currentTime;return l},playing:function(l){var f=this;if(typeof l=="number"){var m=f._soundById(l);return m?!m._paused:!1}for(var y=0;y<f._sounds.length;y++)if(!f._sounds[y]._paused)return!0;return!1},duration:function(l){var f=this,m=f._duration,y=f._soundById(l);return y&&(m=f._sprite[y._sprite][1]/1e3),m},state:function(){return this._state},unload:function(){for(var l=this,f=l._sounds,m=0;m<f.length;m++)f[m]._paused||l.stop(f[m]._id),l._webAudio||(l._clearSound(f[m]._node),f[m]._node.removeEventListener("error",f[m]._errorFn,!1),f[m]._node.removeEventListener(n._canPlayEvent,f[m]._loadFn,!1),f[m]._node.removeEventListener("ended",f[m]._endFn,!1),n._releaseHtml5Audio(f[m]._node)),delete f[m]._node,l._clearTimer(f[m]._id);var y=n._howls.indexOf(l);y>=0&&n._howls.splice(y,1);var b=!0;for(m=0;m<n._howls.length;m++)if(n._howls[m]._src===l._src||l._src.indexOf(n._howls[m]._src)>=0){b=!1;break}return a&&b&&delete a[l._src],n.noAudio=!1,l._state="unloaded",l._sounds=[],l=null,null},on:function(l,f,m,y){var b=this,S=b["_on"+l];return typeof f=="function"&&S.push(y?{id:m,fn:f,once:y}:{id:m,fn:f}),b},off:function(l,f,m){var y=this,b=y["_on"+l],S=0;if(typeof f=="number"&&(m=f,f=null),f||m)for(S=0;S<b.length;S++){var T=m===b[S].id;if(f===b[S].fn&&T||!f&&T){b.splice(S,1);break}}else if(l)y["_on"+l]=[];else{var I=Object.keys(y);for(S=0;S<I.length;S++)I[S].indexOf("_on")===0&&Array.isArray(y[I[S]])&&(y[I[S]]=[])}return y},once:function(l,f,m){var y=this;return y.on(l,f,m,1),y},_emit:function(l,f,m){for(var y=this,b=y["_on"+l],S=b.length-1;S>=0;S--)(!b[S].id||b[S].id===f||l==="load")&&(setTimeout((function(T){T.call(this,f,m)}).bind(y,b[S].fn),0),b[S].once&&y.off(l,b[S].fn,b[S].id));return y._loadQueue(l),y},_loadQueue:function(l){var f=this;if(f._queue.length>0){var m=f._queue[0];m.event===l&&(f._queue.shift(),f._loadQueue()),l||m.action()}return f},_ended:function(l){var f=this,m=l._sprite;if(!f._webAudio&&l._node&&!l._node.paused&&!l._node.ended&&l._node.currentTime<l._stop)return setTimeout(f._ended.bind(f,l),100),f;var y=!!(l._loop||f._sprite[m][2]);if(f._emit("end",l._id),!f._webAudio&&y&&f.stop(l._id,!0).play(l._id),f._webAudio&&y){f._emit("play",l._id),l._seek=l._start||0,l._rateSeek=0,l._playStart=n.ctx.currentTime;var b=(l._stop-l._start)*1e3/Math.abs(l._rate);f._endTimers[l._id]=setTimeout(f._ended.bind(f,l),b)}return f._webAudio&&!y&&(l._paused=!0,l._ended=!0,l._seek=l._start||0,l._rateSeek=0,f._clearTimer(l._id),f._cleanBuffer(l._node),n._autoSuspend()),!f._webAudio&&!y&&f.stop(l._id,!0),f},_clearTimer:function(l){var f=this;if(f._endTimers[l]){if(typeof f._endTimers[l]!="function")clearTimeout(f._endTimers[l]);else{var m=f._soundById(l);m&&m._node&&m._node.removeEventListener("ended",f._endTimers[l],!1)}delete f._endTimers[l]}return f},_soundById:function(l){for(var f=this,m=0;m<f._sounds.length;m++)if(l===f._sounds[m]._id)return f._sounds[m];return null},_inactiveSound:function(){var l=this;l._drain();for(var f=0;f<l._sounds.length;f++)if(l._sounds[f]._ended)return l._sounds[f].reset();return new o(l)},_drain:function(){var l=this,f=l._pool,m=0,y=0;if(!(l._sounds.length<f)){for(y=0;y<l._sounds.length;y++)l._sounds[y]._ended&&m++;for(y=l._sounds.length-1;y>=0;y--){if(m<=f)return;l._sounds[y]._ended&&(l._webAudio&&l._sounds[y]._node&&l._sounds[y]._node.disconnect(0),l._sounds.splice(y,1),m--)}}},_getSoundIds:function(l){var f=this;if(typeof l>"u"){for(var m=[],y=0;y<f._sounds.length;y++)m.push(f._sounds[y]._id);return m}else return[l]},_refreshBuffer:function(l){var f=this;return l._node.bufferSource=n.ctx.createBufferSource(),l._node.bufferSource.buffer=a[f._src],l._panner?l._node.bufferSource.connect(l._panner):l._node.bufferSource.connect(l._node),l._node.bufferSource.loop=l._loop,l._loop&&(l._node.bufferSource.loopStart=l._start||0,l._node.bufferSource.loopEnd=l._stop||0),l._node.bufferSource.playbackRate.setValueAtTime(l._rate,n.ctx.currentTime),f},_cleanBuffer:function(l){var f=this,m=n._navigator&&n._navigator.vendor.indexOf("Apple")>=0;if(!l.bufferSource)return f;if(n._scratchBuffer&&l.bufferSource&&(l.bufferSource.onended=null,l.bufferSource.disconnect(0),m))try{l.bufferSource.buffer=n._scratchBuffer}catch{}return l.bufferSource=null,f},_clearSound:function(l){var f=/MSIE |Trident\//.test(n._navigator&&n._navigator.userAgent);f||(l.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var o=function(l){this._parent=l,this.init()};o.prototype={init:function(){var l=this,f=l._parent;return l._muted=f._muted,l._loop=f._loop,l._volume=f._volume,l._rate=f._rate,l._seek=0,l._paused=!0,l._ended=!0,l._sprite="__default",l._id=++n._counter,f._sounds.push(l),l.create(),l},create:function(){var l=this,f=l._parent,m=n._muted||l._muted||l._parent._muted?0:l._volume;return f._webAudio?(l._node=typeof n.ctx.createGain>"u"?n.ctx.createGainNode():n.ctx.createGain(),l._node.gain.setValueAtTime(m,n.ctx.currentTime),l._node.paused=!0,l._node.connect(n.masterGain)):n.noAudio||(l._node=n._obtainHtml5Audio(),l._errorFn=l._errorListener.bind(l),l._node.addEventListener("error",l._errorFn,!1),l._loadFn=l._loadListener.bind(l),l._node.addEventListener(n._canPlayEvent,l._loadFn,!1),l._endFn=l._endListener.bind(l),l._node.addEventListener("ended",l._endFn,!1),l._node.src=f._src,l._node.preload=f._preload===!0?"auto":f._preload,l._node.volume=m*n.volume(),l._node.load()),l},reset:function(){var l=this,f=l._parent;return l._muted=f._muted,l._loop=f._loop,l._volume=f._volume,l._rate=f._rate,l._seek=0,l._rateSeek=0,l._paused=!0,l._ended=!0,l._sprite="__default",l._id=++n._counter,l},_errorListener:function(){var l=this;l._parent._emit("loaderror",l._id,l._node.error?l._node.error.code:0),l._node.removeEventListener("error",l._errorFn,!1)},_loadListener:function(){var l=this,f=l._parent;f._duration=Math.ceil(l._node.duration*10)/10,Object.keys(f._sprite).length===0&&(f._sprite={__default:[0,f._duration*1e3]}),f._state!=="loaded"&&(f._state="loaded",f._emit("load"),f._loadQueue()),l._node.removeEventListener(n._canPlayEvent,l._loadFn,!1)},_endListener:function(){var l=this,f=l._parent;f._duration===1/0&&(f._duration=Math.ceil(l._node.duration*10)/10,f._sprite.__default[1]===1/0&&(f._sprite.__default[1]=f._duration*1e3),f._ended(l)),l._node.removeEventListener("ended",l._endFn,!1)}};var a={},s=function(l){var f=l._src;if(a[f]){l._duration=a[f].duration,u(l);return}if(/^data:[^;]+;base64,/.test(f)){for(var m=atob(f.split(",")[1]),y=new Uint8Array(m.length),b=0;b<m.length;++b)y[b]=m.charCodeAt(b);d(y.buffer,l)}else{var S=new XMLHttpRequest;S.open(l._xhr.method,f,!0),S.withCredentials=l._xhr.withCredentials,S.responseType="arraybuffer",l._xhr.headers&&Object.keys(l._xhr.headers).forEach(function(T){S.setRequestHeader(T,l._xhr.headers[T])}),S.onload=function(){var T=(S.status+"")[0];if(T!=="0"&&T!=="2"&&T!=="3"){l._emit("loaderror",null,"Failed loading audio file with status: "+S.status+".");return}d(S.response,l)},S.onerror=function(){l._webAudio&&(l._html5=!0,l._webAudio=!1,l._sounds=[],delete a[f],l.load())},c(S)}},c=function(l){try{l.send()}catch{l.onerror()}},d=function(l,f){var m=function(){f._emit("loaderror",null,"Decoding audio data failed.")},y=function(b){b&&f._sounds.length>0?(a[f._src]=b,u(f,b)):m()};typeof Promise<"u"&&n.ctx.decodeAudioData.length===1?n.ctx.decodeAudioData(l).then(y).catch(m):n.ctx.decodeAudioData(l,y,m)},u=function(l,f){f&&!l._duration&&(l._duration=f.duration),Object.keys(l._sprite).length===0&&(l._sprite={__default:[0,l._duration*1e3]}),l._state!=="loaded"&&(l._state="loaded",l._emit("load"),l._loadQueue())},h=function(){if(n.usingWebAudio){try{typeof AudioContext<"u"?n.ctx=new AudioContext:typeof webkitAudioContext<"u"?n.ctx=new webkitAudioContext:n.usingWebAudio=!1}catch{n.usingWebAudio=!1}n.ctx||(n.usingWebAudio=!1);var l=/iP(hone|od|ad)/.test(n._navigator&&n._navigator.platform),f=n._navigator&&n._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),m=f?parseInt(f[1],10):null;if(l&&m&&m<9){var y=/safari/.test(n._navigator&&n._navigator.userAgent.toLowerCase());n._navigator&&!y&&(n.usingWebAudio=!1)}n.usingWebAudio&&(n.masterGain=typeof n.ctx.createGain>"u"?n.ctx.createGainNode():n.ctx.createGain(),n.masterGain.gain.setValueAtTime(n._muted?0:n._volume,n.ctx.currentTime),n.masterGain.connect(n.ctx.destination)),n._setup()}};e.Howler=n,e.Howl=r,typeof wt<"u"?(wt.HowlerGlobal=t,wt.Howler=n,wt.Howl=r,wt.Sound=o):typeof window<"u"&&(window.HowlerGlobal=t,window.Howler=n,window.Howl=r,window.Sound=o)})();/*!
28
28
  * Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported.
29
29
  *
30
30
  * howler.js v2.2.4
@@ -34,66 +34,66 @@ This will fail in production.`);c=zr,c._s.has(r)||(a?Qi(r,t,o,c):Ol(r,o,c),proce
34
34
  * goldfirestudios.com
35
35
  *
36
36
  * MIT License
37
- */(function(){HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(n){var r=this;if(!r.ctx||!r.ctx.listener)return r;for(var o=r._howls.length-1;o>=0;o--)r._howls[o].stereo(n);return r},HowlerGlobal.prototype.pos=function(n,r,o){var a=this;if(!a.ctx||!a.ctx.listener)return a;if(r=typeof r!="number"?a._pos[1]:r,o=typeof o!="number"?a._pos[2]:o,typeof n=="number")a._pos=[n,r,o],typeof a.ctx.listener.positionX<"u"?(a.ctx.listener.positionX.setTargetAtTime(a._pos[0],Howler.ctx.currentTime,.1),a.ctx.listener.positionY.setTargetAtTime(a._pos[1],Howler.ctx.currentTime,.1),a.ctx.listener.positionZ.setTargetAtTime(a._pos[2],Howler.ctx.currentTime,.1)):a.ctx.listener.setPosition(a._pos[0],a._pos[1],a._pos[2]);else return a._pos;return a},HowlerGlobal.prototype.orientation=function(n,r,o,a,s,c){var d=this;if(!d.ctx||!d.ctx.listener)return d;var u=d._orientation;if(r=typeof r!="number"?u[1]:r,o=typeof o!="number"?u[2]:o,a=typeof a!="number"?u[3]:a,s=typeof s!="number"?u[4]:s,c=typeof c!="number"?u[5]:c,typeof n=="number")d._orientation=[n,r,o,a,s,c],typeof d.ctx.listener.forwardX<"u"?(d.ctx.listener.forwardX.setTargetAtTime(n,Howler.ctx.currentTime,.1),d.ctx.listener.forwardY.setTargetAtTime(r,Howler.ctx.currentTime,.1),d.ctx.listener.forwardZ.setTargetAtTime(o,Howler.ctx.currentTime,.1),d.ctx.listener.upX.setTargetAtTime(a,Howler.ctx.currentTime,.1),d.ctx.listener.upY.setTargetAtTime(s,Howler.ctx.currentTime,.1),d.ctx.listener.upZ.setTargetAtTime(c,Howler.ctx.currentTime,.1)):d.ctx.listener.setOrientation(n,r,o,a,s,c);else return u;return d},Howl.prototype.init=function(n){return function(r){var o=this;return o._orientation=r.orientation||[1,0,0],o._stereo=r.stereo||null,o._pos=r.pos||null,o._pannerAttr={coneInnerAngle:typeof r.coneInnerAngle<"u"?r.coneInnerAngle:360,coneOuterAngle:typeof r.coneOuterAngle<"u"?r.coneOuterAngle:360,coneOuterGain:typeof r.coneOuterGain<"u"?r.coneOuterGain:0,distanceModel:typeof r.distanceModel<"u"?r.distanceModel:"inverse",maxDistance:typeof r.maxDistance<"u"?r.maxDistance:1e4,panningModel:typeof r.panningModel<"u"?r.panningModel:"HRTF",refDistance:typeof r.refDistance<"u"?r.refDistance:1,rolloffFactor:typeof r.rolloffFactor<"u"?r.rolloffFactor:1},o._onstereo=r.onstereo?[{fn:r.onstereo}]:[],o._onpos=r.onpos?[{fn:r.onpos}]:[],o._onorientation=r.onorientation?[{fn:r.onorientation}]:[],n.call(this,r)}}(Howl.prototype.init),Howl.prototype.stereo=function(n,r){var o=this;if(!o._webAudio)return o;if(o._state!=="loaded")return o._queue.push({event:"stereo",action:function(){o.stereo(n,r)}}),o;var a=typeof Howler.ctx.createStereoPanner>"u"?"spatial":"stereo";if(typeof r>"u")if(typeof n=="number")o._stereo=n,o._pos=[n,0,0];else return o._stereo;for(var s=o._getSoundIds(r),c=0;c<s.length;c++){var d=o._soundById(s[c]);if(d)if(typeof n=="number")d._stereo=n,d._pos=[n,0,0],d._node&&(d._pannerAttr.panningModel="equalpower",(!d._panner||!d._panner.pan)&&t(d,a),a==="spatial"?typeof d._panner.positionX<"u"?(d._panner.positionX.setValueAtTime(n,Howler.ctx.currentTime),d._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),d._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):d._panner.setPosition(n,0,0):d._panner.pan.setValueAtTime(n,Howler.ctx.currentTime)),o._emit("stereo",d._id);else return d._stereo}return o},Howl.prototype.pos=function(n,r,o,a){var s=this;if(!s._webAudio)return s;if(s._state!=="loaded")return s._queue.push({event:"pos",action:function(){s.pos(n,r,o,a)}}),s;if(r=typeof r!="number"?0:r,o=typeof o!="number"?-.5:o,typeof a>"u")if(typeof n=="number")s._pos=[n,r,o];else return s._pos;for(var c=s._getSoundIds(a),d=0;d<c.length;d++){var u=s._soundById(c[d]);if(u)if(typeof n=="number")u._pos=[n,r,o],u._node&&((!u._panner||u._panner.pan)&&t(u,"spatial"),typeof u._panner.positionX<"u"?(u._panner.positionX.setValueAtTime(n,Howler.ctx.currentTime),u._panner.positionY.setValueAtTime(r,Howler.ctx.currentTime),u._panner.positionZ.setValueAtTime(o,Howler.ctx.currentTime)):u._panner.setPosition(n,r,o)),s._emit("pos",u._id);else return u._pos}return s},Howl.prototype.orientation=function(n,r,o,a){var s=this;if(!s._webAudio)return s;if(s._state!=="loaded")return s._queue.push({event:"orientation",action:function(){s.orientation(n,r,o,a)}}),s;if(r=typeof r!="number"?s._orientation[1]:r,o=typeof o!="number"?s._orientation[2]:o,typeof a>"u")if(typeof n=="number")s._orientation=[n,r,o];else return s._orientation;for(var c=s._getSoundIds(a),d=0;d<c.length;d++){var u=s._soundById(c[d]);if(u)if(typeof n=="number")u._orientation=[n,r,o],u._node&&(u._panner||(u._pos||(u._pos=s._pos||[0,0,-.5]),t(u,"spatial")),typeof u._panner.orientationX<"u"?(u._panner.orientationX.setValueAtTime(n,Howler.ctx.currentTime),u._panner.orientationY.setValueAtTime(r,Howler.ctx.currentTime),u._panner.orientationZ.setValueAtTime(o,Howler.ctx.currentTime)):u._panner.setOrientation(n,r,o)),s._emit("orientation",u._id);else return u._orientation}return s},Howl.prototype.pannerAttr=function(){var n=this,r=arguments,o,a,s;if(!n._webAudio)return n;if(r.length===0)return n._pannerAttr;if(r.length===1)if(typeof r[0]=="object")o=r[0],typeof a>"u"&&(o.pannerAttr||(o.pannerAttr={coneInnerAngle:o.coneInnerAngle,coneOuterAngle:o.coneOuterAngle,coneOuterGain:o.coneOuterGain,distanceModel:o.distanceModel,maxDistance:o.maxDistance,refDistance:o.refDistance,rolloffFactor:o.rolloffFactor,panningModel:o.panningModel}),n._pannerAttr={coneInnerAngle:typeof o.pannerAttr.coneInnerAngle<"u"?o.pannerAttr.coneInnerAngle:n._coneInnerAngle,coneOuterAngle:typeof o.pannerAttr.coneOuterAngle<"u"?o.pannerAttr.coneOuterAngle:n._coneOuterAngle,coneOuterGain:typeof o.pannerAttr.coneOuterGain<"u"?o.pannerAttr.coneOuterGain:n._coneOuterGain,distanceModel:typeof o.pannerAttr.distanceModel<"u"?o.pannerAttr.distanceModel:n._distanceModel,maxDistance:typeof o.pannerAttr.maxDistance<"u"?o.pannerAttr.maxDistance:n._maxDistance,refDistance:typeof o.pannerAttr.refDistance<"u"?o.pannerAttr.refDistance:n._refDistance,rolloffFactor:typeof o.pannerAttr.rolloffFactor<"u"?o.pannerAttr.rolloffFactor:n._rolloffFactor,panningModel:typeof o.pannerAttr.panningModel<"u"?o.pannerAttr.panningModel:n._panningModel});else return s=n._soundById(parseInt(r[0],10)),s?s._pannerAttr:n._pannerAttr;else r.length===2&&(o=r[0],a=parseInt(r[1],10));for(var c=n._getSoundIds(a),d=0;d<c.length;d++)if(s=n._soundById(c[d]),s){var u=s._pannerAttr;u={coneInnerAngle:typeof o.coneInnerAngle<"u"?o.coneInnerAngle:u.coneInnerAngle,coneOuterAngle:typeof o.coneOuterAngle<"u"?o.coneOuterAngle:u.coneOuterAngle,coneOuterGain:typeof o.coneOuterGain<"u"?o.coneOuterGain:u.coneOuterGain,distanceModel:typeof o.distanceModel<"u"?o.distanceModel:u.distanceModel,maxDistance:typeof o.maxDistance<"u"?o.maxDistance:u.maxDistance,refDistance:typeof o.refDistance<"u"?o.refDistance:u.refDistance,rolloffFactor:typeof o.rolloffFactor<"u"?o.rolloffFactor:u.rolloffFactor,panningModel:typeof o.panningModel<"u"?o.panningModel:u.panningModel};var h=s._panner;h||(s._pos||(s._pos=n._pos||[0,0,-.5]),t(s,"spatial"),h=s._panner),h.coneInnerAngle=u.coneInnerAngle,h.coneOuterAngle=u.coneOuterAngle,h.coneOuterGain=u.coneOuterGain,h.distanceModel=u.distanceModel,h.maxDistance=u.maxDistance,h.refDistance=u.refDistance,h.rolloffFactor=u.rolloffFactor,h.panningModel=u.panningModel}return n},Sound.prototype.init=function(n){return function(){var r=this,o=r._parent;r._orientation=o._orientation,r._stereo=o._stereo,r._pos=o._pos,r._pannerAttr=o._pannerAttr,n.call(this),r._stereo?o.stereo(r._stereo):r._pos&&o.pos(r._pos[0],r._pos[1],r._pos[2],r._id)}}(Sound.prototype.init),Sound.prototype.reset=function(n){return function(){var r=this,o=r._parent;return r._orientation=o._orientation,r._stereo=o._stereo,r._pos=o._pos,r._pannerAttr=o._pannerAttr,r._stereo?o.stereo(r._stereo):r._pos?o.pos(r._pos[0],r._pos[1],r._pos[2],r._id):r._panner&&(r._panner.disconnect(0),r._panner=void 0,o._refreshBuffer(r)),n.call(this)}}(Sound.prototype.reset);var t=function(n,r){r=r||"spatial",r==="spatial"?(n._panner=Howler.ctx.createPanner(),n._panner.coneInnerAngle=n._pannerAttr.coneInnerAngle,n._panner.coneOuterAngle=n._pannerAttr.coneOuterAngle,n._panner.coneOuterGain=n._pannerAttr.coneOuterGain,n._panner.distanceModel=n._pannerAttr.distanceModel,n._panner.maxDistance=n._pannerAttr.maxDistance,n._panner.refDistance=n._pannerAttr.refDistance,n._panner.rolloffFactor=n._pannerAttr.rolloffFactor,n._panner.panningModel=n._pannerAttr.panningModel,typeof n._panner.positionX<"u"?(n._panner.positionX.setValueAtTime(n._pos[0],Howler.ctx.currentTime),n._panner.positionY.setValueAtTime(n._pos[1],Howler.ctx.currentTime),n._panner.positionZ.setValueAtTime(n._pos[2],Howler.ctx.currentTime)):n._panner.setPosition(n._pos[0],n._pos[1],n._pos[2]),typeof n._panner.orientationX<"u"?(n._panner.orientationX.setValueAtTime(n._orientation[0],Howler.ctx.currentTime),n._panner.orientationY.setValueAtTime(n._orientation[1],Howler.ctx.currentTime),n._panner.orientationZ.setValueAtTime(n._orientation[2],Howler.ctx.currentTime)):n._panner.setOrientation(n._orientation[0],n._orientation[1],n._orientation[2])):(n._panner=Howler.ctx.createStereoPanner(),n._panner.pan.setValueAtTime(n._stereo,Howler.ctx.currentTime)),n._panner.connect(n._node),n._paused||n._parent.pause(n._id,!0).play(n._id,!0)}})()})(rn);function At(e){return new Promise((t,n)=>{setTimeout(t,e)})}const Ji=e=>e.reduce((t,n)=>({...t,[n]:n}),{}),Xi=e=>e!==null&&typeof e=="object"&&typeof e.then=="function"&&typeof e.catch=="function",Nl=["music","ambiant","sound"],Pl=Ji(Nl),ft=et("audio",{state:()=>{const e=new Map;for(const t in Pl)e.set(t,{channels:[],options:{volume:1}});return{modes:e,masterVolume:1}},actions:{stopAll(){this.modes.forEach(e=>{e.channels.forEach((t,n)=>{t&&(this.actuallyStopChannel(t),e.channels[n]=null)})})},async stopChannel(e,t){const n=this.getAudioChannel(e,t);if(!n)return;const{fadeOutTime:r}=Si(n.audio);if(this.setAudioChannel(e,t,null),Lt().options.musicFadeOutTime){const o=Qt(n.audio);o&&o.fade(o.volume(n.howlerId),0,r,n.howlerId),await At(r)}this.actuallyStopChannel(n)},async pauseChannel(e,t){const n=this.getAudioChannel(e,t);if(!n)return;const r=Qt(n.audio);if(!r){ae(`Could not find audio ${n.audio}`);return}r.pause(n.howlerId)},async playChannel(e,t,n){rn.Howler.ctx.state==="suspended"&&(console.warn("Audio context is suspended :o"),rn.Howler.ctx.resume());const r=this.getAudioChannel(e,n);if(e==="sound")return this.actuallyPlayChannel(e,n,t);r&&r.audio!==t?await this.changeChannel(e,t,n):r&&r.audio===t?await this.resumeChannel(e,n):await this.actuallyPlayChannel(e,n,t)},async resumeChannel(e,t){const n=this.getAudioChannel(e,t);if(!n)return;const r=Qt(n.audio);if(!r){ae(`Could not find audio ${n.audio}`);return}r.play(n.howlerId)},async changeChannel(e,t,n){this.getAudioChannel(e,n)&&e!=="sound"&&await this.stopChannel(e,n),await this.actuallyPlayChannel(e,n,t)},actuallyStopChannel(e){cm(e.audio,e.howlerId)},getAudioChannel(e,t){return this.modes.get(e).channels[t]||null},setAudioChannel(e,t,n){this.modes.get(e).channels[t]=n},async actuallyPlayChannel(e,t,n){const r=Qt(n);if(!r){ae(`Could not find audio ${n}`);return}const{fadeInTime:o,fadeInDelay:a}=Si(n),s=this.audioVolume(e,n);if(e!=="sound"){const c=r.play();r.volume(0,c),r.pause(c),this.setAudioChannel(e,t,{audio:n,howlerId:c}),await At(a);const d=this.getAudioChannel(e,t);d!==null&&d.audio===n&&(r.play(c),r.fade(0,s,o,c))}else if(e==="sound"){const c=r.play();r.volume(s,c),this.setAudioChannel(e,t,{audio:n,howlerId:c})}},reloadAudio(e){for(const t in e.modes){if(t==="sound")continue;const n=t;this.modes.get(n).options=Re(e.modes[n].options);for(const r in e.modes[n].channels){const o=e.modes[n].channels[r];o&&o.audio&&this.actuallyPlayChannel(n,Number(r),o.audio)}}},stopSound(e){const t=Qt(e);t&&t.stop()},generateSaveData(){const e={};for(const t in Pl){const n=this.modes.get(t);e[t]={options:Re(n.options),channels:Re(n.channels).map(r=>r?{audio:r.audio}:{audio:null})}}return{modes:e,masterVolume:this.masterVolume}},loadSaveData(e){this.masterVolume=e.masterVolume},reset(){this.stopAll()},setModeVolume(e,t){const n=this.modes.get(e);n.options.volume=t;for(const r in n.channels){const o=n.channels[r];if(o){const a=Qt(o.audio);a&&a.volume(this.modeVolume(e),o.howlerId)}}},setMasterVolume(e){this.masterVolume=e,rn.Howler.volume(e)},modeVolume(e){return this.masterVolume*this.modes.get(e).options.volume},audioVolume(e,t){var n;return this.modeVolume(e)*(((n=vf(t))==null?void 0:n.volume)??1)}}}),jl={};rn.Howler.volume(.5);let Zi={};async function am(e){Ft.log("Loading audio");const t=[];rn.Howler.volume(e.options.volume);for(const n in e.files){const r=e.files[n];r.src||(r.src=r.path,r.path||console.error(`Audio config for ${n} doesn't have any \`src\` value to find the file`),console.warn("Using `path` for audio and musics is deprecated. Please replace `path` with `src` in your config file!")),t.push(lm(n,e.files[n]))}return e.audioTriggers&&(Zi=e.audioTriggers),Promise.all(t)}function Qn(e){Zi[e]&&ft().playChannel("sound",Zi[e],0)}async function lm(e,t){return new Promise((n,r)=>{const o=new rn.Howl({...t,src:$t(t.src)});o.load(),jl[e]=o,n()})}function cm(e,t){const n=Qt(e);if(!n){Zn(`Could not find music ${e}`);return}n.stop(t)}function Qt(e){return jl[e]}function um(e){const t=Qt(e),{fadeInTime:n}=Si(e),r=t.play(),a=ft().audioVolume("music",e);return t.fade(0,a,n,r),r}async function dm(e,t){const n=Qt(e),{fadeOutTime:r}=Si(e);n.fade(n.volume(t),0,r,t),await At(r),n.stop(t)}function fm(e,t){return e-t*vo().options.extraPointsPerLevel}function Dl(e,t){const{options:n}=vo();let r=e;n.showDifficultyWithoutModifiers||(r=fm(e,t));const o=vo().options;let a=!1,s=0,c=o.difficultyText[0][1];for(;!a;)o.difficultyText.length>s&&r>=o.difficultyText[s][0]?c=o.difficultyText[s][1]:a=!0,s++;let d="";return n.showDifficultyText&&n.showDifficultyNumber?d=`${c} (${r})`:n.showDifficultyText?d=c:n.showDifficultyNumber&&(d=r.toString()),d}function pm({skill:e,skillCheckId:t,value:n}){const r=Xe(),o=r.getSkillCheck(t),a=Oi(e),s=r.skills[e].level,c=Dl(n,s);let d=!0,u=`<span class='skill-check'>[<span class='skill-check-name'>${a.name}</span> - `;return o.happened?o.succeeded?u="":(d=!1,u+=` <span class='skill-check-difficulty'>${c}</span> - <span class='skill-check-failed'>FAILED</span>]</span>`):u+=` <span class='skill-check-difficulty'>${c}</span>]</span>`,{difficultyText:u,allowed:d}}function mm(e,t){const n=Xe(),r=Oi(t.skill),o=Dl(t.difficulty,n.skills[t.skill].level);return`<span class='passive-skill-check skill-check'>[<span class='skill-check-name'>${r.name}</span> - <span class='skill-check-difficulty'>${o}</span> - ${e?'<span class="skill-check-success">Success</span>':'<span class="skill-check-failed">Failure</span>'}]</span>`}function hm(e){const{options:t}=vo(),n=ym(t,e),a=Xe().skills[e].level*t.extraPointsPerLevel;let s=n.reduce((c,d)=>c+d.unmodified,a);return t.finalRollIsHighest?(s=n.reduce((c,d)=>d.modified>c?d.modified:c,0),Ft.log(`[SKILL CHECK] Keeping only highest roll: ${s}`)):t.finalRollIsLowest&&(s=n.reduce((c,d)=>d.modified<c?d.modified:c,n[0].modified),Ft.log(`[SKILL CHECK] Keeping only lowest roll: ${s}`)),{roll:s,rolls:n}}function ym(e,t){const r=Xe().skills[t],o=r.level*e.extraPointsPerLevel;let{diceRange:a,diceCount:s}=e;e.extraDicePerLevel&&(s+=e.extraDicePerLevel*r.level);const c=[];for(let d=0;d<s;d++){const u=gm(a),h=u+o;Ft.log(`[SKILL CHECK] Roll ${d+1}/${s}: ${h}. (Base roll: ${u}, modifier: ${o} - Skill level: ${r.level})`),c.push({unmodified:u,modified:h})}return c}function gm(e){return Math.floor(Math.random()*e[1])+e[0]}function _m(e){const{skills:t}=dn(),{roll:n,rolls:r}=hm(e.skill),o=t[e.skill];let a=!1;if(typeof e.winsNeeded=="number"){const s=r.reduce((c,d)=>(xl(d.modified,e.difficulty)&&c++,c),0);s>=e.winsNeeded&&(a=!0),Ft.log(`[SKILL CHECK ${o.name}] - Dice pool mode. ${e.winsNeeded} wins needed. Got ${s} successes.
38
- (${e.id} - ${s}/${e.winsNeeded} - rolls: ${JSON.stringify(r.map(c=>c.modified))})`)}else a=xl(n,e.difficulty),Ft.log(`[SKILL CHECK ${o.name}]: ${a?"✅":"❌"}`,`(${e.id}) - ${n}/${e.difficulty}`);return Qn(a?"onSkillCheckSuccess":"onSkillCheckFailure"),a}function xl(e,t){const{options:n}=vo();let r=e>=t;return n.successOnRollsBelowThreshold&&(r=e<=t),n.failOnRollsEqualToThreshold&&e===t&&(r=!1),r}var p={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Type=e.JsonType=e.JavaScriptTypeBuilder=e.JsonTypeBuilder=e.TypeBuilder=e.TypeBuilderError=e.TransformEncodeBuilder=e.TransformDecodeBuilder=e.TemplateLiteralDslParser=e.TemplateLiteralGenerator=e.TemplateLiteralGeneratorError=e.TemplateLiteralFinite=e.TemplateLiteralFiniteError=e.TemplateLiteralParser=e.TemplateLiteralParserError=e.TemplateLiteralResolver=e.TemplateLiteralPattern=e.TemplateLiteralPatternError=e.UnionResolver=e.KeyArrayResolver=e.KeyArrayResolverError=e.KeyResolver=e.ObjectMap=e.Intrinsic=e.IndexedAccessor=e.TypeClone=e.TypeExtends=e.TypeExtendsResult=e.TypeExtendsError=e.ExtendsUndefined=e.TypeGuard=e.TypeGuardUnknownTypeError=e.ValueGuard=e.FormatRegistry=e.TypeBoxError=e.TypeRegistry=e.PatternStringExact=e.PatternNumberExact=e.PatternBooleanExact=e.PatternString=e.PatternNumber=e.PatternBoolean=e.Kind=e.Hint=e.Optional=e.Readonly=e.Transform=void 0,e.Transform=Symbol.for("TypeBox.Transform"),e.Readonly=Symbol.for("TypeBox.Readonly"),e.Optional=Symbol.for("TypeBox.Optional"),e.Hint=Symbol.for("TypeBox.Hint"),e.Kind=Symbol.for("TypeBox.Kind"),e.PatternBoolean="(true|false)",e.PatternNumber="(0|[1-9][0-9]*)",e.PatternString="(.*)",e.PatternBooleanExact=`^${e.PatternBoolean}$`,e.PatternNumberExact=`^${e.PatternNumber}$`,e.PatternStringExact=`^${e.PatternString}$`;var t;(function(j){const g=new Map;function E(){return new Map(g)}j.Entries=E;function $(){return g.clear()}j.Clear=$;function _(U){return g.delete(U)}j.Delete=_;function v(U){return g.has(U)}j.Has=v;function C(U,ne){g.set(U,ne)}j.Set=C;function M(U){return g.get(U)}j.Get=M})(t||(e.TypeRegistry=t={}));class n extends Error{constructor(g){super(g)}}e.TypeBoxError=n;var r;(function(j){const g=new Map;function E(){return new Map(g)}j.Entries=E;function $(){return g.clear()}j.Clear=$;function _(U){return g.delete(U)}j.Delete=_;function v(U){return g.has(U)}j.Has=v;function C(U,ne){g.set(U,ne)}j.Set=C;function M(U){return g.get(U)}j.Get=M})(r||(e.FormatRegistry=r={}));var o;(function(j){function g(re){return Array.isArray(re)}j.IsArray=g;function E(re){return typeof re=="bigint"}j.IsBigInt=E;function $(re){return typeof re=="boolean"}j.IsBoolean=$;function _(re){return re instanceof globalThis.Date}j.IsDate=_;function v(re){return re===null}j.IsNull=v;function C(re){return typeof re=="number"}j.IsNumber=C;function M(re){return typeof re=="object"&&re!==null}j.IsObject=M;function U(re){return typeof re=="string"}j.IsString=U;function ne(re){return re instanceof globalThis.Uint8Array}j.IsUint8Array=ne;function ee(re){return re===void 0}j.IsUndefined=ee})(o||(e.ValueGuard=o={}));class a extends n{}e.TypeGuardUnknownTypeError=a;var s;(function(j){function g(O){try{return new RegExp(O),!0}catch{return!1}}function E(O){if(!o.IsString(O))return!1;for(let N=0;N<O.length;N++){const A=O.charCodeAt(N);if(A>=7&&A<=13||A===27||A===127)return!1}return!0}function $(O){return C(O)||ot(O)}function _(O){return o.IsUndefined(O)||o.IsBigInt(O)}function v(O){return o.IsUndefined(O)||o.IsNumber(O)}function C(O){return o.IsUndefined(O)||o.IsBoolean(O)}function M(O){return o.IsUndefined(O)||o.IsString(O)}function U(O){return o.IsUndefined(O)||o.IsString(O)&&E(O)&&g(O)}function ne(O){return o.IsUndefined(O)||o.IsString(O)&&E(O)}function ee(O){return o.IsUndefined(O)||ot(O)}function re(O){return Ce(O,"Any")&&M(O.$id)}j.TAny=re;function Ee(O){return Ce(O,"Array")&&O.type==="array"&&M(O.$id)&&ot(O.items)&&v(O.minItems)&&v(O.maxItems)&&C(O.uniqueItems)&&ee(O.contains)&&v(O.minContains)&&v(O.maxContains)}j.TArray=Ee;function R(O){return Ce(O,"AsyncIterator")&&O.type==="AsyncIterator"&&M(O.$id)&&ot(O.items)}j.TAsyncIterator=R;function J(O){return Ce(O,"BigInt")&&O.type==="bigint"&&M(O.$id)&&_(O.exclusiveMaximum)&&_(O.exclusiveMinimum)&&_(O.maximum)&&_(O.minimum)&&_(O.multipleOf)}j.TBigInt=J;function fe(O){return Ce(O,"Boolean")&&O.type==="boolean"&&M(O.$id)}j.TBoolean=fe;function ce(O){return Ce(O,"Constructor")&&O.type==="Constructor"&&M(O.$id)&&o.IsArray(O.parameters)&&O.parameters.every(N=>ot(N))&&ot(O.returns)}j.TConstructor=ce;function be(O){return Ce(O,"Date")&&O.type==="Date"&&M(O.$id)&&v(O.exclusiveMaximumTimestamp)&&v(O.exclusiveMinimumTimestamp)&&v(O.maximumTimestamp)&&v(O.minimumTimestamp)&&v(O.multipleOfTimestamp)}j.TDate=be;function ve(O){return Ce(O,"Function")&&O.type==="Function"&&M(O.$id)&&o.IsArray(O.parameters)&&O.parameters.every(N=>ot(N))&&ot(O.returns)}j.TFunction=ve;function Le(O){return Ce(O,"Integer")&&O.type==="integer"&&M(O.$id)&&v(O.exclusiveMaximum)&&v(O.exclusiveMinimum)&&v(O.maximum)&&v(O.minimum)&&v(O.multipleOf)}j.TInteger=Le;function Qe(O){return Ce(O,"Intersect")&&!(o.IsString(O.type)&&O.type!=="object")&&o.IsArray(O.allOf)&&O.allOf.every(N=>ot(N)&&!dr(N))&&M(O.type)&&(C(O.unevaluatedProperties)||ee(O.unevaluatedProperties))&&M(O.$id)}j.TIntersect=Qe;function We(O){return Ce(O,"Iterator")&&O.type==="Iterator"&&M(O.$id)&&ot(O.items)}j.TIterator=We;function Ce(O,N){return H(O)&&O[e.Kind]===N}j.TKindOf=Ce;function H(O){return o.IsObject(O)&&e.Kind in O&&o.IsString(O[e.Kind])}j.TKind=H;function oe(O){return _e(O)&&o.IsString(O.const)}j.TLiteralString=oe;function ie(O){return _e(O)&&o.IsNumber(O.const)}j.TLiteralNumber=ie;function ue(O){return _e(O)&&o.IsBoolean(O.const)}j.TLiteralBoolean=ue;function _e(O){return Ce(O,"Literal")&&M(O.$id)&&(o.IsBoolean(O.const)||o.IsNumber(O.const)||o.IsString(O.const))}j.TLiteral=_e;function $e(O){return Ce(O,"Never")&&o.IsObject(O.not)&&Object.getOwnPropertyNames(O.not).length===0}j.TNever=$e;function Se(O){return Ce(O,"Not")&&ot(O.not)}j.TNot=Se;function at(O){return Ce(O,"Null")&&O.type==="null"&&M(O.$id)}j.TNull=at;function Rt(O){return Ce(O,"Number")&&O.type==="number"&&M(O.$id)&&v(O.exclusiveMaximum)&&v(O.exclusiveMinimum)&&v(O.maximum)&&v(O.minimum)&&v(O.multipleOf)}j.TNumber=Rt;function Bt(O){return Ce(O,"Object")&&O.type==="object"&&M(O.$id)&&o.IsObject(O.properties)&&$(O.additionalProperties)&&v(O.minProperties)&&v(O.maxProperties)&&Object.entries(O.properties).every(([N,A])=>E(N)&&ot(A))}j.TObject=Bt;function Et(O){return Ce(O,"Promise")&&O.type==="Promise"&&M(O.$id)&&ot(O.item)}j.TPromise=Et;function cr(O){return Ce(O,"Record")&&O.type==="object"&&M(O.$id)&&$(O.additionalProperties)&&o.IsObject(O.patternProperties)&&(N=>{const A=Object.getOwnPropertyNames(N.patternProperties);return A.length===1&&g(A[0])&&o.IsObject(N.patternProperties)&&ot(N.patternProperties[A[0]])})(O)}j.TRecord=cr;function Co(O){return o.IsObject(O)&&e.Hint in O&&O[e.Hint]==="Recursive"}j.TRecursive=Co;function ur(O){return Ce(O,"Ref")&&M(O.$id)&&o.IsString(O.$ref)}j.TRef=ur;function Ot(O){return Ce(O,"String")&&O.type==="string"&&M(O.$id)&&v(O.minLength)&&v(O.maxLength)&&U(O.pattern)&&ne(O.format)}j.TString=Ot;function Fr(O){return Ce(O,"Symbol")&&O.type==="symbol"&&M(O.$id)}j.TSymbol=Fr;function On(O){return Ce(O,"TemplateLiteral")&&O.type==="string"&&o.IsString(O.pattern)&&O.pattern[0]==="^"&&O.pattern[O.pattern.length-1]==="$"}j.TTemplateLiteral=On;function Vr(O){return Ce(O,"This")&&M(O.$id)&&o.IsString(O.$ref)}j.TThis=Vr;function dr(O){return o.IsObject(O)&&e.Transform in O}j.TTransform=dr;function rt(O){return Ce(O,"Tuple")&&O.type==="array"&&M(O.$id)&&o.IsNumber(O.minItems)&&o.IsNumber(O.maxItems)&&O.minItems===O.maxItems&&(o.IsUndefined(O.items)&&o.IsUndefined(O.additionalItems)&&O.minItems===0||o.IsArray(O.items)&&O.items.every(N=>ot(N)))}j.TTuple=rt;function Ur(O){return Ce(O,"Undefined")&&O.type==="undefined"&&M(O.$id)}j.TUndefined=Ur;function mn(O){return An(O)&&O.anyOf.every(N=>oe(N)||ie(N))}j.TUnionLiteral=mn;function An(O){return Ce(O,"Union")&&M(O.$id)&&o.IsObject(O)&&o.IsArray(O.anyOf)&&O.anyOf.every(N=>ot(N))}j.TUnion=An;function In(O){return Ce(O,"Uint8Array")&&O.type==="Uint8Array"&&M(O.$id)&&v(O.minByteLength)&&v(O.maxByteLength)}j.TUint8Array=In;function _t(O){return Ce(O,"Unknown")&&M(O.$id)}j.TUnknown=_t;function qn(O){return Ce(O,"Unsafe")}j.TUnsafe=qn;function Hn(O){return Ce(O,"Void")&&O.type==="void"&&M(O.$id)}j.TVoid=Hn;function $o(O){return o.IsObject(O)&&O[e.Readonly]==="Readonly"}j.TReadonly=$o;function qr(O){return o.IsObject(O)&&O[e.Optional]==="Optional"}j.TOptional=qr;function ot(O){return o.IsObject(O)&&(re(O)||Ee(O)||fe(O)||J(O)||R(O)||ce(O)||be(O)||ve(O)||Le(O)||Qe(O)||We(O)||_e(O)||$e(O)||Se(O)||at(O)||Rt(O)||Bt(O)||Et(O)||cr(O)||ur(O)||Ot(O)||Fr(O)||On(O)||Vr(O)||rt(O)||Ur(O)||An(O)||In(O)||_t(O)||qn(O)||Hn(O)||H(O)&&t.Has(O[e.Kind]))}j.TSchema=ot})(s||(e.TypeGuard=s={}));var c;(function(j){function g(E){return E[e.Kind]==="Intersect"?E.allOf.every($=>g($)):E[e.Kind]==="Union"?E.anyOf.some($=>g($)):E[e.Kind]==="Undefined"?!0:E[e.Kind]==="Not"?!g(E.not):!1}j.Check=g})(c||(e.ExtendsUndefined=c={}));class d extends n{}e.TypeExtendsError=d;var u;(function(j){j[j.Union=0]="Union",j[j.True=1]="True",j[j.False=2]="False"})(u||(e.TypeExtendsResult=u={}));var h;(function(j){function g(k){return k===u.False?k:u.True}function E(k){throw new d(k)}function $(k){return s.TNever(k)||s.TIntersect(k)||s.TUnion(k)||s.TUnknown(k)||s.TAny(k)}function _(k,w){return s.TNever(w)?Ce():s.TIntersect(w)?ve(k,w):s.TUnion(w)?q(k,w):s.TUnknown(w)?he():s.TAny(w)?v():E("StructuralRight")}function v(k,w){return u.True}function C(k,w){return s.TIntersect(w)?ve(k,w):s.TUnion(w)&&w.anyOf.some(ye=>s.TAny(ye)||s.TUnknown(ye))?u.True:s.TUnion(w)?u.Union:s.TUnknown(w)||s.TAny(w)?u.True:u.Union}function M(k,w){return s.TUnknown(k)?u.False:s.TAny(k)?u.Union:s.TNever(k)?u.True:u.False}function U(k,w){return s.TObject(w)&&On(w)?u.True:$(w)?_(k,w):s.TArray(w)?g(de(k.items,w.items)):u.False}function ne(k,w){return $(w)?_(k,w):s.TAsyncIterator(w)?g(de(k.items,w.items)):u.False}function ee(k,w){return $(w)?_(k,w):s.TObject(w)?rt(k,w):s.TRecord(w)?_t(k,w):s.TBigInt(w)?u.True:u.False}function re(k,w){return s.TLiteral(k)&&o.IsBoolean(k.const)||s.TBoolean(k)?u.True:u.False}function Ee(k,w){return $(w)?_(k,w):s.TObject(w)?rt(k,w):s.TRecord(w)?_t(k,w):s.TBoolean(w)?u.True:u.False}function R(k,w){return $(w)?_(k,w):s.TObject(w)?rt(k,w):s.TConstructor(w)?k.parameters.length>w.parameters.length?u.False:k.parameters.every((ye,Be)=>g(de(w.parameters[Be],ye))===u.True)?g(de(k.returns,w.returns)):u.False:u.False}function J(k,w){return $(w)?_(k,w):s.TObject(w)?rt(k,w):s.TRecord(w)?_t(k,w):s.TDate(w)?u.True:u.False}function fe(k,w){return $(w)?_(k,w):s.TObject(w)?rt(k,w):s.TFunction(w)?k.parameters.length>w.parameters.length?u.False:k.parameters.every((ye,Be)=>g(de(w.parameters[Be],ye))===u.True)?g(de(k.returns,w.returns)):u.False:u.False}function ce(k,w){return s.TLiteral(k)&&o.IsNumber(k.const)||s.TNumber(k)||s.TInteger(k)?u.True:u.False}function be(k,w){return s.TInteger(w)||s.TNumber(w)?u.True:$(w)?_(k,w):s.TObject(w)?rt(k,w):s.TRecord(w)?_t(k,w):u.False}function ve(k,w){return w.allOf.every(ye=>de(k,ye)===u.True)?u.True:u.False}function Le(k,w){return k.allOf.some(ye=>de(ye,w)===u.True)?u.True:u.False}function Qe(k,w){return $(w)?_(k,w):s.TIterator(w)?g(de(k.items,w.items)):u.False}function We(k,w){return s.TLiteral(w)&&w.const===k.const?u.True:$(w)?_(k,w):s.TObject(w)?rt(k,w):s.TRecord(w)?_t(k,w):s.TString(w)?Hn(k):s.TNumber(w)?_e(k):s.TInteger(w)?ce(k):s.TBoolean(w)?re(k):u.False}function Ce(k,w){return u.False}function H(k,w){return u.True}function oe(k){let[w,ye]=[k,0];for(;s.TNot(w);)w=w.not,ye+=1;return ye%2===0?w:e.Type.Unknown()}function ie(k,w){return s.TNot(k)?de(oe(k),w):s.TNot(w)?de(k,oe(w)):E("Invalid fallthrough for Not")}function ue(k,w){return $(w)?_(k,w):s.TObject(w)?rt(k,w):s.TRecord(w)?_t(k,w):s.TNull(w)?u.True:u.False}function _e(k,w){return s.TLiteralNumber(k)||s.TNumber(k)||s.TInteger(k)?u.True:u.False}function $e(k,w){return $(w)?_(k,w):s.TObject(w)?rt(k,w):s.TRecord(w)?_t(k,w):s.TInteger(w)||s.TNumber(w)?u.True:u.False}function Se(k,w){return Object.getOwnPropertyNames(k.properties).length===w}function at(k){return On(k)}function Rt(k){return Se(k,0)||Se(k,1)&&"description"in k.properties&&s.TUnion(k.properties.description)&&k.properties.description.anyOf.length===2&&(s.TString(k.properties.description.anyOf[0])&&s.TUndefined(k.properties.description.anyOf[1])||s.TString(k.properties.description.anyOf[1])&&s.TUndefined(k.properties.description.anyOf[0]))}function Bt(k){return Se(k,0)}function Et(k){return Se(k,0)}function cr(k){return Se(k,0)}function Co(k){return Se(k,0)}function ur(k){return On(k)}function Ot(k){const w=e.Type.Number();return Se(k,0)||Se(k,1)&&"length"in k.properties&&g(de(k.properties.length,w))===u.True}function Fr(k){return Se(k,0)}function On(k){const w=e.Type.Number();return Se(k,0)||Se(k,1)&&"length"in k.properties&&g(de(k.properties.length,w))===u.True}function Vr(k){const w=e.Type.Function([e.Type.Any()],e.Type.Any());return Se(k,0)||Se(k,1)&&"then"in k.properties&&g(de(k.properties.then,w))===u.True}function dr(k,w){return de(k,w)===u.False||s.TOptional(k)&&!s.TOptional(w)?u.False:u.True}function rt(k,w){return s.TUnknown(k)?u.False:s.TAny(k)?u.Union:s.TNever(k)||s.TLiteralString(k)&&at(w)||s.TLiteralNumber(k)&&Bt(w)||s.TLiteralBoolean(k)&&Et(w)||s.TSymbol(k)&&Rt(w)||s.TBigInt(k)&&cr(w)||s.TString(k)&&at(w)||s.TSymbol(k)&&Rt(w)||s.TNumber(k)&&Bt(w)||s.TInteger(k)&&Bt(w)||s.TBoolean(k)&&Et(w)||s.TUint8Array(k)&&ur(w)||s.TDate(k)&&Co(w)||s.TConstructor(k)&&Fr(w)||s.TFunction(k)&&Ot(w)?u.True:s.TRecord(k)&&s.TString(An(k))?w[e.Hint]==="Record"?u.True:u.False:s.TRecord(k)&&s.TNumber(An(k))?Se(w,0)?u.True:u.False:u.False}function Ur(k,w){return $(w)?_(k,w):s.TRecord(w)?_t(k,w):s.TObject(w)?(()=>{for(const ye of Object.getOwnPropertyNames(w.properties)){if(!(ye in k.properties)&&!s.TOptional(w.properties[ye]))return u.False;if(s.TOptional(w.properties[ye]))return u.True;if(dr(k.properties[ye],w.properties[ye])===u.False)return u.False}return u.True})():u.False}function mn(k,w){return $(w)?_(k,w):s.TObject(w)&&Vr(w)?u.True:s.TPromise(w)?g(de(k.item,w.item)):u.False}function An(k){return e.PatternNumberExact in k.patternProperties?e.Type.Number():e.PatternStringExact in k.patternProperties?e.Type.String():E("Unknown record key pattern")}function In(k){return e.PatternNumberExact in k.patternProperties?k.patternProperties[e.PatternNumberExact]:e.PatternStringExact in k.patternProperties?k.patternProperties[e.PatternStringExact]:E("Unable to get record value schema")}function _t(k,w){const[ye,Be]=[An(w),In(w)];return s.TLiteralString(k)&&s.TNumber(ye)&&g(de(k,Be))===u.True?u.True:s.TUint8Array(k)&&s.TNumber(ye)||s.TString(k)&&s.TNumber(ye)||s.TArray(k)&&s.TNumber(ye)?de(k,Be):s.TObject(k)?(()=>{for(const Ge of Object.getOwnPropertyNames(k.properties))if(dr(Be,k.properties[Ge])===u.False)return u.False;return u.True})():u.False}function qn(k,w){return $(w)?_(k,w):s.TObject(w)?rt(k,w):s.TRecord(w)?de(In(k),In(w)):u.False}function Hn(k,w){return s.TLiteral(k)&&o.IsString(k.const)||s.TString(k)?u.True:u.False}function $o(k,w){return $(w)?_(k,w):s.TObject(w)?rt(k,w):s.TRecord(w)?_t(k,w):s.TString(w)?u.True:u.False}function qr(k,w){return $(w)?_(k,w):s.TObject(w)?rt(k,w):s.TRecord(w)?_t(k,w):s.TSymbol(w)?u.True:u.False}function ot(k,w){return s.TTemplateLiteral(k)?de(F.Resolve(k),w):s.TTemplateLiteral(w)?de(k,F.Resolve(w)):E("Invalid fallthrough for TemplateLiteral")}function O(k,w){return s.TArray(w)&&k.items!==void 0&&k.items.every(ye=>de(ye,w.items)===u.True)}function N(k,w){return s.TNever(k)?u.True:s.TUnknown(k)?u.False:s.TAny(k)?u.Union:u.False}function A(k,w){return $(w)?_(k,w):s.TObject(w)&&On(w)||s.TArray(w)&&O(k,w)?u.True:s.TTuple(w)?o.IsUndefined(k.items)&&!o.IsUndefined(w.items)||!o.IsUndefined(k.items)&&o.IsUndefined(w.items)?u.False:o.IsUndefined(k.items)&&!o.IsUndefined(w.items)||k.items.every((ye,Be)=>de(ye,w.items[Be])===u.True)?u.True:u.False:u.False}function D(k,w){return $(w)?_(k,w):s.TObject(w)?rt(k,w):s.TRecord(w)?_t(k,w):s.TUint8Array(w)?u.True:u.False}function K(k,w){return $(w)?_(k,w):s.TObject(w)?rt(k,w):s.TRecord(w)?_t(k,w):s.TVoid(w)?He(k):s.TUndefined(w)?u.True:u.False}function q(k,w){return w.anyOf.some(ye=>de(k,ye)===u.True)?u.True:u.False}function me(k,w){return k.anyOf.every(ye=>de(ye,w)===u.True)?u.True:u.False}function he(k,w){return u.True}function De(k,w){return s.TNever(w)?Ce():s.TIntersect(w)?ve(k,w):s.TUnion(w)?q(k,w):s.TAny(w)?v():s.TString(w)?Hn(k):s.TNumber(w)?_e(k):s.TInteger(w)?ce(k):s.TBoolean(w)?re(k):s.TArray(w)?M(k):s.TTuple(w)?N(k):s.TObject(w)?rt(k,w):s.TUnknown(w)?u.True:u.False}function He(k,w){return s.TUndefined(k)||s.TUndefined(k)?u.True:u.False}function Ye(k,w){return s.TIntersect(w)?ve(k,w):s.TUnion(w)?q(k,w):s.TUnknown(w)?he():s.TAny(w)?v():s.TObject(w)?rt(k,w):s.TVoid(w)?u.True:u.False}function de(k,w){return s.TTemplateLiteral(k)||s.TTemplateLiteral(w)?ot(k,w):s.TNot(k)||s.TNot(w)?ie(k,w):s.TAny(k)?C(k,w):s.TArray(k)?U(k,w):s.TBigInt(k)?ee(k,w):s.TBoolean(k)?Ee(k,w):s.TAsyncIterator(k)?ne(k,w):s.TConstructor(k)?R(k,w):s.TDate(k)?J(k,w):s.TFunction(k)?fe(k,w):s.TInteger(k)?be(k,w):s.TIntersect(k)?Le(k,w):s.TIterator(k)?Qe(k,w):s.TLiteral(k)?We(k,w):s.TNever(k)?H():s.TNull(k)?ue(k,w):s.TNumber(k)?$e(k,w):s.TObject(k)?Ur(k,w):s.TRecord(k)?qn(k,w):s.TString(k)?$o(k,w):s.TSymbol(k)?qr(k,w):s.TTuple(k)?A(k,w):s.TPromise(k)?mn(k,w):s.TUint8Array(k)?D(k,w):s.TUndefined(k)?K(k,w):s.TUnion(k)?me(k,w):s.TUnknown(k)?De(k,w):s.TVoid(k)?Ye(k,w):E(`Unknown left type operand '${k[e.Kind]}'`)}function Ue(k,w){return de(k,w)}j.Extends=Ue})(h||(e.TypeExtends=h={}));var l;(function(j){function g(U){return U.map(ne=>v(ne))}function E(U){return new Date(U.getTime())}function $(U){return new Uint8Array(U)}function _(U){const ne=Object.getOwnPropertyNames(U).reduce((re,Ee)=>({...re,[Ee]:v(U[Ee])}),{}),ee=Object.getOwnPropertySymbols(U).reduce((re,Ee)=>({...re,[Ee]:v(U[Ee])}),{});return{...ne,...ee}}function v(U){return o.IsArray(U)?g(U):o.IsDate(U)?E(U):o.IsUint8Array(U)?$(U):o.IsObject(U)?_(U):U}function C(U){return U.map(ne=>M(ne))}j.Rest=C;function M(U,ne={}){return{...v(U),...ne}}j.Type=M})(l||(e.TypeClone=l={}));var f;(function(j){function g(R){return R.map(J=>{const{[e.Optional]:fe,...ce}=l.Type(J);return ce})}function E(R){return R.every(J=>s.TOptional(J))}function $(R){return R.some(J=>s.TOptional(J))}function _(R){return E(R.allOf)?e.Type.Optional(e.Type.Intersect(g(R.allOf))):R}function v(R){return $(R.anyOf)?e.Type.Optional(e.Type.Union(g(R.anyOf))):R}function C(R){return R[e.Kind]==="Intersect"?_(R):R[e.Kind]==="Union"?v(R):R}function M(R,J){const fe=R.allOf.reduce((ce,be)=>{const ve=re(be,J);return ve[e.Kind]==="Never"?ce:[...ce,ve]},[]);return C(e.Type.Intersect(fe))}function U(R,J){const fe=R.anyOf.map(ce=>re(ce,J));return C(e.Type.Union(fe))}function ne(R,J){const fe=R.properties[J];return o.IsUndefined(fe)?e.Type.Never():e.Type.Union([fe])}function ee(R,J){const fe=R.items;if(o.IsUndefined(fe))return e.Type.Never();const ce=fe[J];return o.IsUndefined(ce)?e.Type.Never():ce}function re(R,J){return R[e.Kind]==="Intersect"?M(R,J):R[e.Kind]==="Union"?U(R,J):R[e.Kind]==="Object"?ne(R,J):R[e.Kind]==="Tuple"?ee(R,J):e.Type.Never()}function Ee(R,J,fe={}){const ce=J.map(be=>re(R,be.toString()));return C(e.Type.Union(ce,fe))}j.Resolve=Ee})(f||(e.IndexedAccessor=f={}));var m;(function(j){function g(ee){const[re,Ee]=[ee.slice(0,1),ee.slice(1)];return`${re.toLowerCase()}${Ee}`}function E(ee){const[re,Ee]=[ee.slice(0,1),ee.slice(1)];return`${re.toUpperCase()}${Ee}`}function $(ee){return ee.toUpperCase()}function _(ee){return ee.toLowerCase()}function v(ee,re){const Ee=P.ParseExact(ee.pattern);if(!W.Check(Ee))return{...ee,pattern:C(ee.pattern,re)};const fe=[...G.Generate(Ee)].map(ve=>e.Type.Literal(ve)),ce=M(fe,re),be=e.Type.Union(ce);return e.Type.TemplateLiteral([be])}function C(ee,re){return typeof ee=="string"?re==="Uncapitalize"?g(ee):re==="Capitalize"?E(ee):re==="Uppercase"?$(ee):re==="Lowercase"?_(ee):ee:ee.toString()}function M(ee,re){if(ee.length===0)return[];const[Ee,...R]=ee;return[ne(Ee,re),...M(R,re)]}function U(ee,re){return s.TTemplateLiteral(ee)?v(ee,re):s.TUnion(ee)?e.Type.Union(M(ee.anyOf,re)):s.TLiteral(ee)?e.Type.Literal(C(ee.const,re)):ee}function ne(ee,re){return U(ee,re)}j.Map=ne})(m||(e.Intrinsic=m={}));var y;(function(j){function g(C,M){return e.Type.Intersect(C.allOf.map(U=>_(U,M)),{...C})}function E(C,M){return e.Type.Union(C.anyOf.map(U=>_(U,M)),{...C})}function $(C,M){return M(C)}function _(C,M){return C[e.Kind]==="Intersect"?g(C,M):C[e.Kind]==="Union"?E(C,M):C[e.Kind]==="Object"?$(C,M):C}function v(C,M,U){return{..._(l.Type(C),M),...U}}j.Map=v})(y||(e.ObjectMap=y={}));var b;(function(j){function g(ne){return ne[0]==="^"&&ne[ne.length-1]==="$"?ne.slice(1,ne.length-1):ne}function E(ne,ee){return ne.allOf.reduce((re,Ee)=>[...re,...C(Ee,ee)],[])}function $(ne,ee){const re=ne.anyOf.map(Ee=>C(Ee,ee));return[...re.reduce((Ee,R)=>R.map(J=>re.every(fe=>fe.includes(J))?Ee.add(J):Ee)[0],new Set)]}function _(ne,ee){return Object.getOwnPropertyNames(ne.properties)}function v(ne,ee){return ee.includePatterns?Object.getOwnPropertyNames(ne.patternProperties):[]}function C(ne,ee){return s.TIntersect(ne)?E(ne,ee):s.TUnion(ne)?$(ne,ee):s.TObject(ne)?_(ne):s.TRecord(ne)?v(ne,ee):[]}function M(ne,ee){return[...new Set(C(ne,ee))]}j.ResolveKeys=M;function U(ne){return`^(${M(ne,{includePatterns:!0}).map(Ee=>`(${g(Ee)})`).join("|")})$`}j.ResolvePattern=U})(b||(e.KeyResolver=b={}));class S extends n{}e.KeyArrayResolverError=S;var T;(function(j){function g(E){return Array.isArray(E)?E:s.TUnionLiteral(E)?E.anyOf.map($=>$.const.toString()):s.TLiteral(E)?[E.const]:s.TTemplateLiteral(E)?(()=>{const $=P.ParseExact(E.pattern);if(!W.Check($))throw new S("Cannot resolve keys from infinite template expression");return[...G.Generate($)]})():[]}j.Resolve=g})(T||(e.KeyArrayResolver=T={}));var I;(function(j){function*g($){for(const _ of $.anyOf)_[e.Kind]==="Union"?yield*g(_):yield _}function E($){return e.Type.Union([...g($)],{...$})}j.Resolve=E})(I||(e.UnionResolver=I={}));class x extends n{}e.TemplateLiteralPatternError=x;var B;(function(j){function g(v){throw new x(v)}function E(v){return v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $(v,C){return s.TTemplateLiteral(v)?v.pattern.slice(1,v.pattern.length-1):s.TUnion(v)?`(${v.anyOf.map(M=>$(M,C)).join("|")})`:s.TNumber(v)?`${C}${e.PatternNumber}`:s.TInteger(v)?`${C}${e.PatternNumber}`:s.TBigInt(v)?`${C}${e.PatternNumber}`:s.TString(v)?`${C}${e.PatternString}`:s.TLiteral(v)?`${C}${E(v.const.toString())}`:s.TBoolean(v)?`${C}${e.PatternBoolean}`:g(`Unexpected Kind '${v[e.Kind]}'`)}function _(v){return`^${v.map(C=>$(C,"")).join("")}$`}j.Create=_})(B||(e.TemplateLiteralPattern=B={}));var F;(function(j){function g(E){const $=P.ParseExact(E.pattern);if(!W.Check($))return e.Type.String();const _=[...G.Generate($)].map(v=>e.Type.Literal(v));return e.Type.Union(_)}j.Resolve=g})(F||(e.TemplateLiteralResolver=F={}));class L extends n{}e.TemplateLiteralParserError=L;var P;(function(j){function g(R,J,fe){return R[J]===fe&&R.charCodeAt(J-1)!==92}function E(R,J){return g(R,J,"(")}function $(R,J){return g(R,J,")")}function _(R,J){return g(R,J,"|")}function v(R){if(!(E(R,0)&&$(R,R.length-1)))return!1;let J=0;for(let fe=0;fe<R.length;fe++)if(E(R,fe)&&(J+=1),$(R,fe)&&(J-=1),J===0&&fe!==R.length-1)return!1;return!0}function C(R){return R.slice(1,R.length-1)}function M(R){let J=0;for(let fe=0;fe<R.length;fe++)if(E(R,fe)&&(J+=1),$(R,fe)&&(J-=1),_(R,fe)&&J===0)return!0;return!1}function U(R){for(let J=0;J<R.length;J++)if(E(R,J))return!0;return!1}function ne(R){let[J,fe]=[0,0];const ce=[];for(let ve=0;ve<R.length;ve++)if(E(R,ve)&&(J+=1),$(R,ve)&&(J-=1),_(R,ve)&&J===0){const Le=R.slice(fe,ve);Le.length>0&&ce.push(re(Le)),fe=ve+1}const be=R.slice(fe);return be.length>0&&ce.push(re(be)),ce.length===0?{type:"const",const:""}:ce.length===1?ce[0]:{type:"or",expr:ce}}function ee(R){function J(be,ve){if(!E(be,ve))throw new L("TemplateLiteralParser: Index must point to open parens");let Le=0;for(let Qe=ve;Qe<be.length;Qe++)if(E(be,Qe)&&(Le+=1),$(be,Qe)&&(Le-=1),Le===0)return[ve,Qe];throw new L("TemplateLiteralParser: Unclosed group parens in expression")}function fe(be,ve){for(let Le=ve;Le<be.length;Le++)if(E(be,Le))return[ve,Le];return[ve,be.length]}const ce=[];for(let be=0;be<R.length;be++)if(E(R,be)){const[ve,Le]=J(R,be),Qe=R.slice(ve,Le+1);ce.push(re(Qe)),be=Le}else{const[ve,Le]=fe(R,be),Qe=R.slice(ve,Le);Qe.length>0&&ce.push(re(Qe)),be=Le-1}return ce.length===0?{type:"const",const:""}:ce.length===1?ce[0]:{type:"and",expr:ce}}function re(R){return v(R)?re(C(R)):M(R)?ne(R):U(R)?ee(R):{type:"const",const:R}}j.Parse=re;function Ee(R){return re(R.slice(1,R.length-1))}j.ParseExact=Ee})(P||(e.TemplateLiteralParser=P={}));class Y extends n{}e.TemplateLiteralFiniteError=Y;var W;(function(j){function g(C){throw new Y(C)}function E(C){return C.type==="or"&&C.expr.length===2&&C.expr[0].type==="const"&&C.expr[0].const==="0"&&C.expr[1].type==="const"&&C.expr[1].const==="[1-9][0-9]*"}function $(C){return C.type==="or"&&C.expr.length===2&&C.expr[0].type==="const"&&C.expr[0].const==="true"&&C.expr[1].type==="const"&&C.expr[1].const==="false"}function _(C){return C.type==="const"&&C.const===".*"}function v(C){return $(C)?!0:E(C)||_(C)?!1:C.type==="and"?C.expr.every(M=>v(M)):C.type==="or"?C.expr.every(M=>v(M)):C.type==="const"?!0:g("Unknown expression type")}j.Check=v})(W||(e.TemplateLiteralFinite=W={}));class X extends n{}e.TemplateLiteralGeneratorError=X;var G;(function(j){function*g(C){if(C.length===1)return yield*C[0];for(const M of C[0])for(const U of g(C.slice(1)))yield`${M}${U}`}function*E(C){return yield*g(C.expr.map(M=>[...v(M)]))}function*$(C){for(const M of C.expr)yield*v(M)}function*_(C){return yield C.const}function*v(C){return C.type==="and"?yield*E(C):C.type==="or"?yield*$(C):C.type==="const"?yield*_(C):(()=>{throw new X("Unknown expression")})()}j.Generate=v})(G||(e.TemplateLiteralGenerator=G={}));var z;(function(j){function*g(v){const C=v.trim().replace(/"|'/g,"");return C==="boolean"?yield e.Type.Boolean():C==="number"?yield e.Type.Number():C==="bigint"?yield e.Type.BigInt():C==="string"?yield e.Type.String():yield(()=>{const M=C.split("|").map(U=>e.Type.Literal(U.trim()));return M.length===0?e.Type.Never():M.length===1?M[0]:e.Type.Union(M)})()}function*E(v){if(v[1]!=="{"){const C=e.Type.Literal("$"),M=$(v.slice(1));return yield*[C,...M]}for(let C=2;C<v.length;C++)if(v[C]==="}"){const M=g(v.slice(2,C)),U=$(v.slice(C+1));return yield*[...M,...U]}yield e.Type.Literal(v)}function*$(v){for(let C=0;C<v.length;C++)if(v[C]==="$"){const M=e.Type.Literal(v.slice(0,C)),U=E(v.slice(C));return yield*[M,...U]}yield e.Type.Literal(v)}function _(v){return[...$(v)]}j.Parse=_})(z||(e.TemplateLiteralDslParser=z={}));class Q{constructor(g){this.schema=g}Decode(g){return new te(this.schema,g)}}e.TransformDecodeBuilder=Q;class te{constructor(g,E){this.schema=g,this.decode=E}Encode(g){const E=l.Type(this.schema);return s.TTransform(E)?(()=>{const v={Encode:C=>E[e.Transform].Encode(g(C)),Decode:C=>this.decode(E[e.Transform].Decode(C))};return{...E,[e.Transform]:v}})():(()=>{const $={Decode:this.decode,Encode:g};return{...E,[e.Transform]:$}})()}}e.TransformEncodeBuilder=te;let ke=0;class Ne extends n{}e.TypeBuilderError=Ne;class Ze{Create(g){return g}Throw(g){throw new Ne(g)}Discard(g,E){return E.reduce(($,_)=>{const{[_]:v,...C}=$;return C},g)}Strict(g){return JSON.parse(JSON.stringify(g))}}e.TypeBuilder=Ze;class qe extends Ze{ReadonlyOptional(g){return this.Readonly(this.Optional(g))}Readonly(g){return{...l.Type(g),[e.Readonly]:"Readonly"}}Optional(g){return{...l.Type(g),[e.Optional]:"Optional"}}Any(g={}){return this.Create({...g,[e.Kind]:"Any"})}Array(g,E={}){return this.Create({...E,[e.Kind]:"Array",type:"array",items:l.Type(g)})}Boolean(g={}){return this.Create({...g,[e.Kind]:"Boolean",type:"boolean"})}Capitalize(g,E={}){return{...m.Map(l.Type(g),"Capitalize"),...E}}Composite(g,E){const $=e.Type.Intersect(g,{}),v=b.ResolveKeys($,{includePatterns:!1}).reduce((C,M)=>({...C,[M]:e.Type.Index($,[M])}),{});return e.Type.Object(v,E)}Enum(g,E={}){if(o.IsUndefined(g))return this.Throw("Enum undefined or empty");const $=Object.getOwnPropertyNames(g).filter(C=>isNaN(C)).map(C=>g[C]),v=[...new Set($)].map(C=>e.Type.Literal(C));return this.Union(v,{...E,[e.Hint]:"Enum"})}Extends(g,E,$,_,v={}){switch(h.Extends(g,E)){case u.Union:return this.Union([l.Type($,v),l.Type(_,v)]);case u.True:return l.Type($,v);case u.False:return l.Type(_,v)}}Exclude(g,E,$={}){return s.TTemplateLiteral(g)?this.Exclude(F.Resolve(g),E,$):s.TTemplateLiteral(E)?this.Exclude(g,F.Resolve(E),$):s.TUnion(g)?(()=>{const _=g.anyOf.filter(v=>h.Extends(v,E)===u.False);return _.length===1?l.Type(_[0],$):this.Union(_,$)})():h.Extends(g,E)!==u.False?this.Never($):l.Type(g,$)}Extract(g,E,$={}){return s.TTemplateLiteral(g)?this.Extract(F.Resolve(g),E,$):s.TTemplateLiteral(E)?this.Extract(g,F.Resolve(E),$):s.TUnion(g)?(()=>{const _=g.anyOf.filter(v=>h.Extends(v,E)!==u.False);return _.length===1?l.Type(_[0],$):this.Union(_,$)})():h.Extends(g,E)!==u.False?l.Type(g,$):this.Never($)}Index(g,E,$={}){return s.TArray(g)&&s.TNumber(E)?l.Type(g.items,$):s.TTuple(g)&&s.TNumber(E)?(()=>{const v=(o.IsUndefined(g.items)?[]:g.items).map(C=>l.Type(C));return this.Union(v,$)})():(()=>{const _=T.Resolve(E),v=l.Type(g);return f.Resolve(v,_,$)})()}Integer(g={}){return this.Create({...g,[e.Kind]:"Integer",type:"integer"})}Intersect(g,E={}){if(g.length===0)return e.Type.Never();if(g.length===1)return l.Type(g[0],E);g.some(C=>s.TTransform(C))&&this.Throw("Cannot intersect transform types");const $=g.every(C=>s.TObject(C)),_=l.Rest(g),v=s.TSchema(E.unevaluatedProperties)?{unevaluatedProperties:l.Type(E.unevaluatedProperties)}:{};return E.unevaluatedProperties===!1||s.TSchema(E.unevaluatedProperties)||$?this.Create({...E,...v,[e.Kind]:"Intersect",type:"object",allOf:_}):this.Create({...E,...v,[e.Kind]:"Intersect",allOf:_})}KeyOf(g,E={}){return s.TRecord(g)?(()=>{const $=Object.getOwnPropertyNames(g.patternProperties)[0];return $===e.PatternNumberExact?this.Number(E):$===e.PatternStringExact?this.String(E):this.Throw("Unable to resolve key type from Record key pattern")})():s.TTuple(g)?(()=>{const _=(o.IsUndefined(g.items)?[]:g.items).map((v,C)=>e.Type.Literal(C.toString()));return this.Union(_,E)})():s.TArray(g)?this.Number(E):(()=>{const $=b.ResolveKeys(g,{includePatterns:!1});if($.length===0)return this.Never(E);const _=$.map(v=>this.Literal(v));return this.Union(_,E)})()}Literal(g,E={}){return this.Create({...E,[e.Kind]:"Literal",const:g,type:typeof g})}Lowercase(g,E={}){return{...m.Map(l.Type(g),"Lowercase"),...E}}Never(g={}){return this.Create({...g,[e.Kind]:"Never",not:{}})}Not(g,E){return this.Create({...E,[e.Kind]:"Not",not:l.Type(g)})}Null(g={}){return this.Create({...g,[e.Kind]:"Null",type:"null"})}Number(g={}){return this.Create({...g,[e.Kind]:"Number",type:"number"})}Object(g,E={}){const $=Object.getOwnPropertyNames(g),_=$.filter(U=>s.TOptional(g[U])),v=$.filter(U=>!_.includes(U)),C=s.TSchema(E.additionalProperties)?{additionalProperties:l.Type(E.additionalProperties)}:{},M=$.reduce((U,ne)=>({...U,[ne]:l.Type(g[ne])}),{});return v.length>0?this.Create({...E,...C,[e.Kind]:"Object",type:"object",properties:M,required:v}):this.Create({...E,...C,[e.Kind]:"Object",type:"object",properties:M})}Omit(g,E,$={}){const _=T.Resolve(E);return y.Map(this.Discard(l.Type(g),["$id",e.Transform]),v=>{o.IsArray(v.required)&&(v.required=v.required.filter(C=>!_.includes(C)),v.required.length===0&&delete v.required);for(const C of Object.getOwnPropertyNames(v.properties))_.includes(C)&&delete v.properties[C];return this.Create(v)},$)}Partial(g,E={}){return y.Map(this.Discard(l.Type(g),["$id",e.Transform]),$=>{const _=Object.getOwnPropertyNames($.properties).reduce((v,C)=>({...v,[C]:this.Optional($.properties[C])}),{});return this.Object(_,this.Discard($,["required"]))},E)}Pick(g,E,$={}){const _=T.Resolve(E);return y.Map(this.Discard(l.Type(g),["$id",e.Transform]),v=>{o.IsArray(v.required)&&(v.required=v.required.filter(C=>_.includes(C)),v.required.length===0&&delete v.required);for(const C of Object.getOwnPropertyNames(v.properties))_.includes(C)||delete v.properties[C];return this.Create(v)},$)}Record(g,E,$={}){return s.TTemplateLiteral(g)?(()=>{const _=P.ParseExact(g.pattern);return W.Check(_)?this.Object([...G.Generate(_)].reduce((v,C)=>({...v,[C]:l.Type(E)}),{}),$):this.Create({...$,[e.Kind]:"Record",type:"object",patternProperties:{[g.pattern]:l.Type(E)}})})():s.TUnion(g)?(()=>{const _=I.Resolve(g);if(s.TUnionLiteral(_)){const v=_.anyOf.reduce((C,M)=>({...C,[M.const]:l.Type(E)}),{});return this.Object(v,{...$,[e.Hint]:"Record"})}else this.Throw("Record key of type union contains non-literal types")})():s.TLiteral(g)?o.IsString(g.const)||o.IsNumber(g.const)?this.Object({[g.const]:l.Type(E)},$):this.Throw("Record key of type literal is not of type string or number"):s.TInteger(g)||s.TNumber(g)?this.Create({...$,[e.Kind]:"Record",type:"object",patternProperties:{[e.PatternNumberExact]:l.Type(E)}}):s.TString(g)?(()=>{const _=o.IsUndefined(g.pattern)?e.PatternStringExact:g.pattern;return this.Create({...$,[e.Kind]:"Record",type:"object",patternProperties:{[_]:l.Type(E)}})})():this.Never()}Recursive(g,E={}){o.IsUndefined(E.$id)&&(E.$id=`T${ke++}`);const $=g({[e.Kind]:"This",$ref:`${E.$id}`});return $.$id=E.$id,this.Create({...E,[e.Hint]:"Recursive",...$})}Ref(g,E={}){return o.IsString(g)?this.Create({...E,[e.Kind]:"Ref",$ref:g}):(o.IsUndefined(g.$id)&&this.Throw("Reference target type must specify an $id"),this.Create({...E,[e.Kind]:"Ref",$ref:g.$id}))}Required(g,E={}){return y.Map(this.Discard(l.Type(g),["$id",e.Transform]),$=>{const _=Object.getOwnPropertyNames($.properties).reduce((v,C)=>({...v,[C]:this.Discard($.properties[C],[e.Optional])}),{});return this.Object(_,$)},E)}Rest(g){return s.TTuple(g)&&!o.IsUndefined(g.items)?l.Rest(g.items):s.TIntersect(g)?l.Rest(g.allOf):s.TUnion(g)?l.Rest(g.anyOf):[]}String(g={}){return this.Create({...g,[e.Kind]:"String",type:"string"})}TemplateLiteral(g,E={}){const $=o.IsString(g)?B.Create(z.Parse(g)):B.Create(g);return this.Create({...E,[e.Kind]:"TemplateLiteral",type:"string",pattern:$})}Transform(g){return new Q(g)}Tuple(g,E={}){const[$,_,v]=[!1,g.length,g.length],C=l.Rest(g),M=g.length>0?{...E,[e.Kind]:"Tuple",type:"array",items:C,additionalItems:$,minItems:_,maxItems:v}:{...E,[e.Kind]:"Tuple",type:"array",minItems:_,maxItems:v};return this.Create(M)}Uncapitalize(g,E={}){return{...m.Map(l.Type(g),"Uncapitalize"),...E}}Union(g,E={}){return s.TTemplateLiteral(g)?F.Resolve(g):(()=>{const $=g;if($.length===0)return this.Never(E);if($.length===1)return this.Create(l.Type($[0],E));const _=l.Rest($);return this.Create({...E,[e.Kind]:"Union",anyOf:_})})()}Unknown(g={}){return this.Create({...g,[e.Kind]:"Unknown"})}Unsafe(g={}){return this.Create({...g,[e.Kind]:g[e.Kind]||"Unsafe"})}Uppercase(g,E={}){return{...m.Map(l.Type(g),"Uppercase"),...E}}}e.JsonTypeBuilder=qe;class nt extends qe{AsyncIterator(g,E={}){return this.Create({...E,[e.Kind]:"AsyncIterator",type:"AsyncIterator",items:l.Type(g)})}Awaited(g,E={}){const $=_=>_.length>0?(()=>{const[v,...C]=_;return[this.Awaited(v),...$(C)]})():_;return s.TIntersect(g)?e.Type.Intersect($(g.allOf)):s.TUnion(g)?e.Type.Union($(g.anyOf)):s.TPromise(g)?this.Awaited(g.item):l.Type(g,E)}BigInt(g={}){return this.Create({...g,[e.Kind]:"BigInt",type:"bigint"})}ConstructorParameters(g,E={}){return this.Tuple([...g.parameters],{...E})}Constructor(g,E,$){const[_,v]=[l.Rest(g),l.Type(E)];return this.Create({...$,[e.Kind]:"Constructor",type:"Constructor",parameters:_,returns:v})}Date(g={}){return this.Create({...g,[e.Kind]:"Date",type:"Date"})}Function(g,E,$){const[_,v]=[l.Rest(g),l.Type(E)];return this.Create({...$,[e.Kind]:"Function",type:"Function",parameters:_,returns:v})}InstanceType(g,E={}){return l.Type(g.returns,E)}Iterator(g,E={}){return this.Create({...E,[e.Kind]:"Iterator",type:"Iterator",items:l.Type(g)})}Parameters(g,E={}){return this.Tuple(g.parameters,{...E})}Promise(g,E={}){return this.Create({...E,[e.Kind]:"Promise",type:"Promise",item:l.Type(g)})}RegExp(g,E={}){const $=o.IsString(g)?g:g.source;return this.Create({...E,[e.Kind]:"String",type:"string",pattern:$})}RegEx(g,E={}){return this.RegExp(g,E)}ReturnType(g,E={}){return l.Type(g.returns,E)}Symbol(g){return this.Create({...g,[e.Kind]:"Symbol",type:"symbol"})}Undefined(g={}){return this.Create({...g,[e.Kind]:"Undefined",type:"undefined"})}Uint8Array(g={}){return this.Create({...g,[e.Kind]:"Uint8Array",type:"Uint8Array"})}Void(g={}){return this.Create({...g,[e.Kind]:"Void",type:"void"})}}e.JavaScriptTypeBuilder=nt,e.JsonType=new qe,e.Type=new nt})(p);const bm=p.Type.Object({prefix:p.Type.Optional(p.Type.String()),suffix:p.Type.Optional(p.Type.String()),volume:p.Type.Optional(p.Type.Number())}),Ll=p.Type.Object({soundOnNewLine:p.Type.Optional(p.Type.String()),soundPerLetter:p.Type.Optional(bm)}),Tm=p.Type.Object({defaultAudio:p.Type.Optional(Ll),characterAudio:p.Type.Optional(p.Type.Record(p.Type.String(),Ll))}),vm=p.Type.Object({src:p.Type.String(),path:p.Type.Optional(p.Type.String()),volume:p.Type.Optional(p.Type.Number()),rate:p.Type.Optional(p.Type.Number()),html5:p.Type.Optional(p.Type.Boolean()),fadeInTime:p.Type.Optional(p.Type.Number()),fadeInDelay:p.Type.Optional(p.Type.Number()),fadeOutTime:p.Type.Optional(p.Type.Number()),loop:p.Type.Optional(p.Type.Boolean())}),Sm=p.Type.Record(p.Type.String(),vm),wm=p.Type.Object({volume:p.Type.Optional(p.Type.Number()),defaultMusic:p.Type.Optional(p.Type.String()),musicFadeInTime:p.Type.Optional(p.Type.Number()),musicFadeOutTime:p.Type.Optional(p.Type.Number()),musicFadeInDelay:p.Type.Optional(p.Type.Number())}),km=p.Type.Record(p.Type.String(),p.Type.String()),Ml=p.Type.Object({files:Sm,audioTriggers:km,options:wm,dialogAudio:p.Type.Optional(Tm)}),Rl={files:{},audioTriggers:{},options:{volume:1,musicFadeInTime:.5,musicFadeInDelay:.5,musicFadeOutTime:.5}},Bl=p.Type.Object({backgrounds:p.Type.Object({width:p.Type.Number(),height:p.Type.Number()}),dialogBottomPadding:p.Type.Union([p.Type.Number(),p.Type.String()]),minTextWidth:p.Type.Optional(p.Type.Number()),verticalLayoutThreshold:p.Type.Number(),defaultFontSize:p.Type.Optional(p.Type.Number()),portraits:p.Type.Object({width:p.Type.Number(),height:p.Type.Number(),offset:p.Type.Optional(p.Type.Object({landscape:p.Type.Optional(p.Type.Object({right:p.Type.Number(),bottom:p.Type.Number()})),portrait:p.Type.Optional(p.Type.Object({right:p.Type.Number(),bottom:p.Type.Number()}))}))})}),Cm={backgrounds:{width:880,height:720},dialogBottomPadding:70,verticalLayoutThreshold:600,defaultFontSize:16,portraits:{width:100,height:100}},Ro=p.Type.Object({name:p.Type.String(),description:p.Type.Optional(p.Type.String())}),$m=p.Type.Intersect([Ro,p.Type.Object({type:p.Type.Literal("number"),defaultValue:p.Type.Number(),step:p.Type.Number(),minValue:p.Type.Number(),maxValue:p.Type.Number()})]),Em=p.Type.Intersect([Ro,p.Type.Object({type:p.Type.Literal("integer"),defaultValue:p.Type.Number(),step:p.Type.Number(),minValue:p.Type.Number(),maxValue:p.Type.Number()})]),Om=p.Type.Intersect([Ro,p.Type.Object({type:p.Type.Literal("boolean"),defaultValue:p.Type.Boolean()})]),Am=p.Type.Intersect([Ro,p.Type.Object({type:p.Type.Literal("string"),defaultValue:p.Type.String()})]),Im=p.Type.Union([$m,Em,Om,Am]);function Nm(e){return e.type==="number"}function Fl(e){return e.type==="integer"}function Pm(e){return e.type==="boolean"}function jm(e){return e.type==="string"}const Vl=p.Type.Object({customSettings:p.Type.Optional(p.Type.Record(p.Type.String(),Im))}),Bo="###_--_~=:;_JUMP",es="###_--_~=:;_RETURN",Dm="###_--_~=:;_OK",Fo="###_--_~=:;_STOP";function xm(e){return e===Bo||e===es||e===Dm||e===Fo}const Lm="3.9.7",Mm=new Date("2024-02-03T15:09:28.490Z"),Rm=400,Vo=20,Uo="@empty",Ul={background:Uo},Bm=p.Type.Optional(p.Type.Object({debugMenu:p.Type.Optional(p.Type.String()),jumpMenu:p.Type.Optional(p.Type.String())})),ql=p.Type.Optional(p.Type.Object({animateText:p.Type.Optional(p.Type.Boolean()),textSpeed:p.Type.Optional(p.Type.Number()),timeBetweenLines:p.Type.Optional(p.Type.Number()),overlayMode:p.Type.Optional(p.Type.Boolean()),rightOffset:p.Type.Optional(p.Type.Number()),bottomOffset:p.Type.Optional(p.Type.Number()),width:p.Type.Optional(p.Type.Number()),height:p.Type.Optional(p.Type.Number()),hideDuringTransition:p.Type.Optional(p.Type.Boolean()),showAfterScriptEnd:p.Type.Optional(p.Type.Boolean())})),Hl=p.Type.Object({engineSplashScreen:p.Type.Optional(p.Type.Object({skip:p.Type.Optional(p.Type.Boolean()),fadeDuration:p.Type.Optional(p.Type.Number()),timeBeforeFadeout:p.Type.Optional(p.Type.Number()),overrideText:p.Type.Optional(p.Type.String()),overrideLogo:p.Type.Optional(p.Type.String())})),gameSplashScreen:p.Type.Optional(p.Type.Object({startButtonText:p.Type.Optional(p.Type.String())}))}),Kl=p.Type.Object({timeOnScreen:p.Type.Number(),alsoPrintInDialogue:p.Type.Optional(p.Type.Boolean())}),Fm=p.Type.Object({name:p.Type.String(),icon:p.Type.String(),startingValue:p.Type.Number(),maxValue:p.Type.Optional(p.Type.Number()),minValue:p.Type.Optional(p.Type.Number()),decimals:p.Type.Optional(p.Type.Number()),prefix:p.Type.Optional(p.Type.String()),suffix:p.Type.Optional(p.Type.String()),hideName:p.Type.Optional(p.Type.Boolean()),formatting:p.Type.Optional(p.Type.Object({style:p.Type.Union([p.Type.Literal("decimal"),p.Type.Literal("currency"),p.Type.Literal("percent"),p.Type.Literal("unit")]),currency:p.Type.Optional(p.Type.String()),unit:p.Type.Optional(p.Type.String())}))}),Gl=p.Type.Record(p.Type.String(),Fm),zl=p.Type.Record(p.Type.String(),p.Type.Object({onlyInteractOutsideOfScripts:p.Type.Optional(p.Type.Boolean())})),Vm=p.Type.Object({delay:p.Type.Optional(p.Type.Number()),duration:p.Type.Optional(p.Type.Number())}),Wl=p.Type.Record(p.Type.String(),Vm),Um=p.Type.Object({text:p.Type.String(),cssClass:p.Type.Optional(p.Type.String())}),Ql=p.Type.Record(p.Type.String(),Um),Yl=p.Type.Object({showScriptFinishedMessage:p.Type.Optional(p.Type.Boolean())}),Jl=p.Type.Object({mode:p.Type.String(),slots:p.Type.Number(),runOnReload:p.Type.Optional(p.Type.String()),disabled:p.Type.Optional(p.Type.Boolean())}),Xl=p.Type.Array(p.Type.String()),qm=[],Zl=p.Type.Object({baseAssetsPath:p.Type.Optional(p.Type.String()),baseDataPath:p.Type.Optional(p.Type.String()),gameTitle:p.Type.String(),saveFileName:p.Type.String(),images:p.Type.Optional(p.Type.Record(p.Type.String(),p.Type.String())),layout:Bl,settings:p.Type.Optional(Vl),gameFlow:p.Type.Optional(p.Type.Object({labelToJumpOnScriptEnd:p.Type.Optional(p.Type.String())})),dialogPanel:p.Type.Optional(ql),splashScreens:p.Type.Optional(Hl),notifications:p.Type.Optional(Kl),hudStats:Gl,interactionTags:p.Type.Optional(zl),transitions:p.Type.Optional(Wl),menuButtons:p.Type.Optional(Ql),debugging:p.Type.Optional(Yl),saves:p.Type.Optional(Jl),hotkeys:Bm}),ts={baseAssetsPath:"",baseDataPath:"",gameTitle:"Narrat Game",saveFileName:"narrat save",images:{},layout:Cm,settings:{},gameFlow:{},dialogPanel:{overlayMode:!0,rightOffset:100,bottomOffset:50,width:475,height:680,textSpeed:Vo,animateText:!0,timeBetweenLines:100,hideDuringTransition:!1,showAfterScriptEnd:!1},splashScreens:{},notifications:{timeOnScreen:2.5,alsoPrintInDialogue:!1},hudStats:{},interactionTags:{default:{onlyInteractOutsideOfScripts:!0}},transitions:{},menuButtons:{},debugging:{showScriptFinishedMessage:!1},saves:{mode:"manual",slots:10},hotkeys:{}},Hm=p.Type.Object({name:p.Type.String(),description:p.Type.String(),icon:p.Type.String(),onUse:p.Type.Optional(p.Type.Object({action:p.Type.String(),label:p.Type.String()})),tag:p.Type.Optional(p.Type.String()),category:p.Type.Optional(p.Type.String()),showIfEmpty:p.Type.Optional(p.Type.Boolean())}),ec=p.Type.Object({id:p.Type.String(),title:p.Type.String()}),tc=p.Type.Record(p.Type.String(),Hm);p.Type.Object({categories:p.Type.Array(ec),items:tc});const nc=p.Type.Object({categories:p.Type.Optional(p.Type.Array(ec)),items:p.Type.Optional(tc)}),rc={categories:[{id:"default",title:"Items"}],items:{}},Km=p.Type.Object({description:p.Type.String(),succeededDescription:p.Type.Optional(p.Type.String()),failedDescription:p.Type.Optional(p.Type.String()),hidden:p.Type.Optional(p.Type.Boolean())}),Gm=p.Type.Object({title:p.Type.String(),description:p.Type.String(),succeededDescription:p.Type.Optional(p.Type.String()),failedDescription:p.Type.Optional(p.Type.String()),endings:p.Type.Optional(p.Type.Record(p.Type.String(),p.Type.Object({success:p.Type.Boolean(),description:p.Type.String()}))),objectives:p.Type.Record(p.Type.String(),Km),category:p.Type.Optional(p.Type.String())}),zm=p.Type.Object({id:p.Type.String(),title:p.Type.String()}),Wm=p.Type.Record(p.Type.String(),Gm),oc=p.Type.Object({quests:Wm,categories:p.Type.Array(zm)}),ic={quests:{},categories:[{id:"default",title:"Quests"}]},sc=p.Type.Object({enabled:p.Type.Boolean(),background:p.Type.Optional(p.Type.String()),text:p.Type.Optional(p.Type.String()),cssClass:p.Type.Optional(p.Type.String()),position:p.Type.Object({left:p.Type.Number(),top:p.Type.Number(),width:p.Type.Optional(p.Type.Number()),height:p.Type.Optional(p.Type.Number())}),anchor:p.Type.Optional(p.Type.Object({x:p.Type.Number(),y:p.Type.Number()})),action:p.Type.Optional(p.Type.String()),actionType:p.Type.Optional(p.Type.String()),scriptClickable:p.Type.Optional(p.Type.Boolean()),tag:p.Type.Optional(p.Type.String())}),Qm=p.Type.Record(p.Type.String(),sc),ac=p.Type.Object({buttons:Qm,clickableDuringScriptsByDefault:p.Type.Optional(p.Type.Boolean())}),lc={buttons:{},clickableDuringScriptsByDefault:!1},Ym=p.Type.Intersect([sc,p.Type.Object({id:p.Type.String()})]),Jm=p.Type.Object({muted:p.Type.Optional(p.Type.Boolean()),loop:p.Type.Optional(p.Type.Boolean())}),Xm=p.Type.Object({background:p.Type.String(),video:p.Type.Optional(Jm),buttons:p.Type.Optional(p.Type.Array(p.Type.Union([p.Type.String(),Ym])))}),cc=p.Type.Record(p.Type.String(),Xm);p.Type.Object({screens:cc});const uc=p.Type.Object({screens:p.Type.Optional(cc)}),dc={screens:{}},Zm=p.Type.Object({name:p.Type.String(),description:p.Type.String(),startingLevel:p.Type.Number(),hidden:p.Type.Optional(p.Type.Boolean()),icon:p.Type.String()}),fc=p.Type.Record(p.Type.String(),Zm),pc=p.Type.Object({xpPerLevel:p.Type.Number(),notifyLevelUp:p.Type.Boolean()});p.Type.Object({skills:fc,skillOptions:pc});const mc=p.Type.Object({skills:p.Type.Optional(fc),skillOptions:p.Type.Optional(pc)}),hc={skills:{},skillOptions:{xpPerLevel:10,notifyLevelUp:!0}},eh=p.Type.Object({portraitCssClass:p.Type.Optional(p.Type.String()),color:p.Type.Optional(p.Type.String()),boxCss:p.Type.Optional(p.Type.Record(p.Type.String(),p.Type.Any())),nameCss:p.Type.Optional(p.Type.Record(p.Type.String(),p.Type.Any())),textCss:p.Type.Optional(p.Type.Record(p.Type.String(),p.Type.Any()))}),th=p.Type.Object({video:p.Type.String(),autoplay:p.Type.Optional(p.Type.Boolean()),loop:p.Type.Optional(p.Type.Boolean()),muted:p.Type.Optional(p.Type.Boolean()),width:p.Type.Optional(p.Type.Number()),height:p.Type.Optional(p.Type.Number())}),nh=p.Type.Object({image:p.Type.String(),width:p.Type.Optional(p.Type.Number()),height:p.Type.Optional(p.Type.Number())}),rh=p.Type.Union([p.Type.String(),th,nh]),oh=p.Type.Object({sprites:p.Type.Optional(p.Type.Record(p.Type.String(),rh)),name:p.Type.String(),style:p.Type.Optional(eh)}),yc=p.Type.Object({config:p.Type.Object({imagesPath:p.Type.String(),playerCharacter:p.Type.Optional(p.Type.String()),gameCharacter:p.Type.Optional(p.Type.String())}),characters:p.Type.Record(p.Type.String(),oh)}),gc={config:{imagesPath:"",playerCharacter:"player",gameCharacter:"game"},characters:{}},_c=p.Type.Object({cssClass:p.Type.Optional(p.Type.String()),textCssClass:p.Type.Optional(p.Type.String()),titleCssClass:p.Type.Optional(p.Type.String())}),bc=p.Type.Object({options:p.Type.Object({delay:p.Type.Optional(p.Type.Number()),width:p.Type.Number(),keywordsPrefix:p.Type.String(),screenEdgesMinimumMargin:p.Type.Optional(p.Type.Number()),styling:p.Type.Optional(_c)}),tooltips:p.Type.Array(p.Type.Object({keywords:p.Type.Array(p.Type.String()),title:p.Type.String(),description:p.Type.String(),styling:p.Type.Optional(_c)}))}),Tc={options:{delay:0,width:350,keywordsPrefix:"@@"},tooltips:[]},ih=p.Type.Object({name:p.Type.String(),description:p.Type.String(),icon:p.Type.Optional(p.Type.String()),lockedIcon:p.Type.Optional(p.Type.String()),secret:p.Type.Optional(p.Type.Boolean()),category:p.Type.Optional(p.Type.String())}),vc=p.Type.Object({id:p.Type.String(),title:p.Type.String()}),Sc=p.Type.Record(p.Type.String(),ih);p.Type.Object({defaultAchievementIcon:p.Type.String(),categories:p.Type.Array(vc),achievements:Sc,notifyNewAchievements:p.Type.Boolean(),secretAchievements:p.Type.Optional(p.Type.Object({censorDescription:p.Type.Optional(p.Type.Boolean()),censorName:p.Type.Optional(p.Type.Boolean()),hideUntilObtained:p.Type.Optional(p.Type.Boolean())}))});const wc=p.Type.Object({categories:p.Type.Optional(p.Type.Array(vc)),achievements:p.Type.Optional(Sc)}),kc={categories:[{id:"default",title:"Achievements"}],achievements:{},notifyNewAchievements:!0,defaultAchievementIcon:"img/achievements/trophy.png"},sh=p.Type.Object({diceRange:p.Type.Tuple([p.Type.Number(),p.Type.Number()]),diceCount:p.Type.Number(),difficultyText:p.Type.Array(p.Type.Tuple([p.Type.Number(),p.Type.String()])),extraPointsPerLevel:p.Type.Number(),extraDicePerLevel:p.Type.Optional(p.Type.Number()),successOnRollsBelowThreshold:p.Type.Boolean(),showDifficultyText:p.Type.Boolean(),showDifficultyNumber:p.Type.Boolean(),showDifficultyWithoutModifiers:p.Type.Boolean(),finalRollIsHighest:p.Type.Optional(p.Type.Boolean()),finalRollIsLowest:p.Type.Optional(p.Type.Boolean()),failOnRollsEqualToThreshold:p.Type.Optional(p.Type.Boolean())}),ah=p.Type.Object({skill:p.Type.String(),difficulty:p.Type.Number(),winsNeeded:p.Type.Optional(p.Type.Number()),hideAfterRoll:p.Type.Optional(p.Type.Boolean()),repeatable:p.Type.Optional(p.Type.Boolean())}),Cc=p.Type.Object({options:sh,skillChecks:p.Type.Record(p.Type.String(),ah)}),$c={options:{diceRange:[1,6],extraPointsPerLevel:1,extraDicePerLevel:0,diceCount:2,successOnRollsBelowThreshold:!1,showDifficultyText:!0,showDifficultyNumber:!1,showDifficultyWithoutModifiers:!1,finalRollIsHighest:!1,finalRollIsLowest:!1,difficultyText:[[2,"Very Easy"],[4,"Easy"],[6,"Medium"],[8,"Hard"],[10,"Very Hard"],[11,"Extremely Hard"],[12,"Near Impossible"]]},skillChecks:{}},lh=p.Type.Object({cssClass:p.Type.Optional(p.Type.String()),textTemplate:p.Type.Optional(p.Type.String())}),Ec=p.Type.Record(p.Type.String(),lh);p.Type.Object({choiceTextTemplate:p.Type.String(),choicePrompts:Ec});const Oc=p.Type.Object({choiceTextTemplate:p.Type.Optional(p.Type.String()),choicePrompts:p.Type.Optional(Ec)}),Ac={choicePrompts:{},choiceTextTemplate:'<span class="choice-index">%{$index}. </span> <span class="choice-text">%{$choice}</span>'},Ic=p.Type.Object({delay:p.Type.Optional(p.Type.Number()),direction:p.Type.Optional(p.Type.String()),duration:p.Type.Optional(p.Type.Number()),easing:p.Type.Optional(p.Type.String()),endDelay:p.Type.Optional(p.Type.Number()),fill:p.Type.Optional(p.Type.String()),iterationStart:p.Type.Optional(p.Type.Number()),iterations:p.Type.Optional(p.Type.Number()),keyframes:p.Type.Optional(p.Type.Any())}),ns=p.Type.Array(p.Type.Any()),ch=p.Type.Object({keyframes:p.Type.Union([p.Type.String(),ns]),options:p.Type.Optional(Ic)});p.Type.Object({keyframes:ns,options:p.Type.Optional(Ic)});const Nc=p.Type.Object({animations:p.Type.Record(p.Type.String(),ch),keyframes:p.Type.Record(p.Type.String(),ns)}),Pc={animations:{},keyframes:{}},uh=p.Type.Object({name:p.Type.String(),type:p.Type.String(),optional:p.Type.Optional(p.Type.Boolean())}),dh=p.Type.Object({keyword:p.Type.String(),label:p.Type.String(),options:p.Type.Optional(p.Type.Array(uh))}),jc=p.Type.Object({macros:p.Type.Array(dh)}),Dc={macros:[]},rs=p.Type.Object({assets:p.Type.Record(p.Type.String(),p.Type.String())}),xc=p.Type.Object({images:p.Type.Optional(rs),audio:p.Type.Optional(rs),video:p.Type.Optional(rs)}),Lc={images:{assets:{}},audio:{assets:{}},video:{assets:{}}},br={common:ts,screens:dc,buttons:lc,skills:hc,skillChecks:$c,scripts:[],audio:Rl,tooltips:Tc,achievements:kc,items:rc,quests:ic,characters:gc,choices:Ac,animations:Pc,macros:Dc,preload:Lc};var fh=function(t){return ph(t)&&!mh(t)};function ph(e){return!!e&&typeof e=="object"}function mh(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||gh(e)}var hh=typeof Symbol=="function"&&Symbol.for,yh=hh?Symbol.for("react.element"):60103;function gh(e){return e.$$typeof===yh}function _h(e){return Array.isArray(e)?[]:{}}function Jr(e,t){return t.clone!==!1&&t.isMergeableObject(e)?Tr(_h(e),e,t):e}function bh(e,t,n){return e.concat(t).map(function(r){return Jr(r,n)})}function Th(e,t){if(!t.customMerge)return Tr;var n=t.customMerge(e);return typeof n=="function"?n:Tr}function vh(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function Mc(e){return Object.keys(e).concat(vh(e))}function Rc(e,t){try{return t in e}catch{return!1}}function Sh(e,t){return Rc(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function wh(e,t,n){var r={};return n.isMergeableObject(e)&&Mc(e).forEach(function(o){r[o]=Jr(e[o],n)}),Mc(t).forEach(function(o){Sh(e,o)||(Rc(e,o)&&n.isMergeableObject(t[o])?r[o]=Th(o,n)(e[o],t[o],n):r[o]=Jr(t[o],n))}),r}function Tr(e,t,n){n=n||{},n.arrayMerge=n.arrayMerge||bh,n.isMergeableObject=n.isMergeableObject||fh,n.cloneUnlessOtherwiseSpecified=Jr;var r=Array.isArray(t),o=Array.isArray(e),a=r===o;return a?r?n.arrayMerge(e,t,n):wh(e,t,n):Jr(t,n)}Tr.all=function(t,n){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(r,o){return Tr(r,o,n)},{})};var kh=Tr,Ch=kh;const Yn=Bi(Ch),lt=et("config",{state:()=>({config:br,configModules:{}}),actions:{async setConfig(e){this.config=e},extendConfig(e){this.config=Yn(this.config,e)},generateSaveData(){return{playerCharacter:this.playerCharacter,gameCharacter:this.gameCharacter}},addConfigModule(e,t){this.configModules[e]=t},findConfigModuleKey(e){const t=Object.keys(this.configModules).find(n=>this.configModules[n].id===e.id);if(t)return t},reloadConfigModule(e,t){this.configModules[e].code=t,this.config[e]=t},loadSaveData(e){this.config.characters.config.playerCharacter=e.playerCharacter,this.config.characters.config.gameCharacter=e.gameCharacter}},getters:{playerCharacter(){return this.config.characters.config.playerCharacter??"player"},gameCharacter(){return this.config.characters.config.gameCharacter??"game"}}});function Bc(e){const t=Xe(),n=t.getSkillCheck(e.id);if(n&&n.happened&&(n.succeeded||!e.repeatable))return n;const r=_m(e);return Uc(mm(r,e)),r?t.passSkillCheck(e.id,e.hideAfterRoll):t.failSkillCheck(e.id,e.hideAfterRoll),t.getSkillCheck(e.id)}function $h(e,t=[]){const n=e.options,r=e.staticOptions,o=!!n.condition;if(o)return r.success;if(!o){for(const[a,s]of r.elseifs.entries())if(t[a]===!0)return s.branch}if(!o&&r.failure)return r.failure}function Fc(e){return typeof e=="object"}function Vc(e){return typeof e=="string"&&e.search(/\$/)===0}function Uc(e){const t={speaker:lt().gameCharacter,text:e,interactive:!1};Fe().addDialog(t)}async function os(e){Fe().addDialog(e)}function Eh(e,t){if(t<e.length)return e[t]}/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */function qc(e){return typeof e>"u"||e===null}function Oh(e){return typeof e=="object"&&e!==null}function Ah(e){return Array.isArray(e)?e:qc(e)?[]:[e]}function Ih(e,t){var n,r,o,a;if(t)for(a=Object.keys(t),n=0,r=a.length;n<r;n+=1)o=a[n],e[o]=t[o];return e}function Nh(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}function Ph(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var jh=qc,Dh=Oh,xh=Ah,Lh=Nh,Mh=Ph,Rh=Ih,ct={isNothing:jh,isObject:Dh,toArray:xh,repeat:Lh,isNegativeZero:Mh,extend:Rh};function Hc(e,t){var n="",r=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+=`
37
+ */(function(){HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(n){var r=this;if(!r.ctx||!r.ctx.listener)return r;for(var o=r._howls.length-1;o>=0;o--)r._howls[o].stereo(n);return r},HowlerGlobal.prototype.pos=function(n,r,o){var a=this;if(!a.ctx||!a.ctx.listener)return a;if(r=typeof r!="number"?a._pos[1]:r,o=typeof o!="number"?a._pos[2]:o,typeof n=="number")a._pos=[n,r,o],typeof a.ctx.listener.positionX<"u"?(a.ctx.listener.positionX.setTargetAtTime(a._pos[0],Howler.ctx.currentTime,.1),a.ctx.listener.positionY.setTargetAtTime(a._pos[1],Howler.ctx.currentTime,.1),a.ctx.listener.positionZ.setTargetAtTime(a._pos[2],Howler.ctx.currentTime,.1)):a.ctx.listener.setPosition(a._pos[0],a._pos[1],a._pos[2]);else return a._pos;return a},HowlerGlobal.prototype.orientation=function(n,r,o,a,s,c){var d=this;if(!d.ctx||!d.ctx.listener)return d;var u=d._orientation;if(r=typeof r!="number"?u[1]:r,o=typeof o!="number"?u[2]:o,a=typeof a!="number"?u[3]:a,s=typeof s!="number"?u[4]:s,c=typeof c!="number"?u[5]:c,typeof n=="number")d._orientation=[n,r,o,a,s,c],typeof d.ctx.listener.forwardX<"u"?(d.ctx.listener.forwardX.setTargetAtTime(n,Howler.ctx.currentTime,.1),d.ctx.listener.forwardY.setTargetAtTime(r,Howler.ctx.currentTime,.1),d.ctx.listener.forwardZ.setTargetAtTime(o,Howler.ctx.currentTime,.1),d.ctx.listener.upX.setTargetAtTime(a,Howler.ctx.currentTime,.1),d.ctx.listener.upY.setTargetAtTime(s,Howler.ctx.currentTime,.1),d.ctx.listener.upZ.setTargetAtTime(c,Howler.ctx.currentTime,.1)):d.ctx.listener.setOrientation(n,r,o,a,s,c);else return u;return d},Howl.prototype.init=function(n){return function(r){var o=this;return o._orientation=r.orientation||[1,0,0],o._stereo=r.stereo||null,o._pos=r.pos||null,o._pannerAttr={coneInnerAngle:typeof r.coneInnerAngle<"u"?r.coneInnerAngle:360,coneOuterAngle:typeof r.coneOuterAngle<"u"?r.coneOuterAngle:360,coneOuterGain:typeof r.coneOuterGain<"u"?r.coneOuterGain:0,distanceModel:typeof r.distanceModel<"u"?r.distanceModel:"inverse",maxDistance:typeof r.maxDistance<"u"?r.maxDistance:1e4,panningModel:typeof r.panningModel<"u"?r.panningModel:"HRTF",refDistance:typeof r.refDistance<"u"?r.refDistance:1,rolloffFactor:typeof r.rolloffFactor<"u"?r.rolloffFactor:1},o._onstereo=r.onstereo?[{fn:r.onstereo}]:[],o._onpos=r.onpos?[{fn:r.onpos}]:[],o._onorientation=r.onorientation?[{fn:r.onorientation}]:[],n.call(this,r)}}(Howl.prototype.init),Howl.prototype.stereo=function(n,r){var o=this;if(!o._webAudio)return o;if(o._state!=="loaded")return o._queue.push({event:"stereo",action:function(){o.stereo(n,r)}}),o;var a=typeof Howler.ctx.createStereoPanner>"u"?"spatial":"stereo";if(typeof r>"u")if(typeof n=="number")o._stereo=n,o._pos=[n,0,0];else return o._stereo;for(var s=o._getSoundIds(r),c=0;c<s.length;c++){var d=o._soundById(s[c]);if(d)if(typeof n=="number")d._stereo=n,d._pos=[n,0,0],d._node&&(d._pannerAttr.panningModel="equalpower",(!d._panner||!d._panner.pan)&&t(d,a),a==="spatial"?typeof d._panner.positionX<"u"?(d._panner.positionX.setValueAtTime(n,Howler.ctx.currentTime),d._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),d._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):d._panner.setPosition(n,0,0):d._panner.pan.setValueAtTime(n,Howler.ctx.currentTime)),o._emit("stereo",d._id);else return d._stereo}return o},Howl.prototype.pos=function(n,r,o,a){var s=this;if(!s._webAudio)return s;if(s._state!=="loaded")return s._queue.push({event:"pos",action:function(){s.pos(n,r,o,a)}}),s;if(r=typeof r!="number"?0:r,o=typeof o!="number"?-.5:o,typeof a>"u")if(typeof n=="number")s._pos=[n,r,o];else return s._pos;for(var c=s._getSoundIds(a),d=0;d<c.length;d++){var u=s._soundById(c[d]);if(u)if(typeof n=="number")u._pos=[n,r,o],u._node&&((!u._panner||u._panner.pan)&&t(u,"spatial"),typeof u._panner.positionX<"u"?(u._panner.positionX.setValueAtTime(n,Howler.ctx.currentTime),u._panner.positionY.setValueAtTime(r,Howler.ctx.currentTime),u._panner.positionZ.setValueAtTime(o,Howler.ctx.currentTime)):u._panner.setPosition(n,r,o)),s._emit("pos",u._id);else return u._pos}return s},Howl.prototype.orientation=function(n,r,o,a){var s=this;if(!s._webAudio)return s;if(s._state!=="loaded")return s._queue.push({event:"orientation",action:function(){s.orientation(n,r,o,a)}}),s;if(r=typeof r!="number"?s._orientation[1]:r,o=typeof o!="number"?s._orientation[2]:o,typeof a>"u")if(typeof n=="number")s._orientation=[n,r,o];else return s._orientation;for(var c=s._getSoundIds(a),d=0;d<c.length;d++){var u=s._soundById(c[d]);if(u)if(typeof n=="number")u._orientation=[n,r,o],u._node&&(u._panner||(u._pos||(u._pos=s._pos||[0,0,-.5]),t(u,"spatial")),typeof u._panner.orientationX<"u"?(u._panner.orientationX.setValueAtTime(n,Howler.ctx.currentTime),u._panner.orientationY.setValueAtTime(r,Howler.ctx.currentTime),u._panner.orientationZ.setValueAtTime(o,Howler.ctx.currentTime)):u._panner.setOrientation(n,r,o)),s._emit("orientation",u._id);else return u._orientation}return s},Howl.prototype.pannerAttr=function(){var n=this,r=arguments,o,a,s;if(!n._webAudio)return n;if(r.length===0)return n._pannerAttr;if(r.length===1)if(typeof r[0]=="object")o=r[0],typeof a>"u"&&(o.pannerAttr||(o.pannerAttr={coneInnerAngle:o.coneInnerAngle,coneOuterAngle:o.coneOuterAngle,coneOuterGain:o.coneOuterGain,distanceModel:o.distanceModel,maxDistance:o.maxDistance,refDistance:o.refDistance,rolloffFactor:o.rolloffFactor,panningModel:o.panningModel}),n._pannerAttr={coneInnerAngle:typeof o.pannerAttr.coneInnerAngle<"u"?o.pannerAttr.coneInnerAngle:n._coneInnerAngle,coneOuterAngle:typeof o.pannerAttr.coneOuterAngle<"u"?o.pannerAttr.coneOuterAngle:n._coneOuterAngle,coneOuterGain:typeof o.pannerAttr.coneOuterGain<"u"?o.pannerAttr.coneOuterGain:n._coneOuterGain,distanceModel:typeof o.pannerAttr.distanceModel<"u"?o.pannerAttr.distanceModel:n._distanceModel,maxDistance:typeof o.pannerAttr.maxDistance<"u"?o.pannerAttr.maxDistance:n._maxDistance,refDistance:typeof o.pannerAttr.refDistance<"u"?o.pannerAttr.refDistance:n._refDistance,rolloffFactor:typeof o.pannerAttr.rolloffFactor<"u"?o.pannerAttr.rolloffFactor:n._rolloffFactor,panningModel:typeof o.pannerAttr.panningModel<"u"?o.pannerAttr.panningModel:n._panningModel});else return s=n._soundById(parseInt(r[0],10)),s?s._pannerAttr:n._pannerAttr;else r.length===2&&(o=r[0],a=parseInt(r[1],10));for(var c=n._getSoundIds(a),d=0;d<c.length;d++)if(s=n._soundById(c[d]),s){var u=s._pannerAttr;u={coneInnerAngle:typeof o.coneInnerAngle<"u"?o.coneInnerAngle:u.coneInnerAngle,coneOuterAngle:typeof o.coneOuterAngle<"u"?o.coneOuterAngle:u.coneOuterAngle,coneOuterGain:typeof o.coneOuterGain<"u"?o.coneOuterGain:u.coneOuterGain,distanceModel:typeof o.distanceModel<"u"?o.distanceModel:u.distanceModel,maxDistance:typeof o.maxDistance<"u"?o.maxDistance:u.maxDistance,refDistance:typeof o.refDistance<"u"?o.refDistance:u.refDistance,rolloffFactor:typeof o.rolloffFactor<"u"?o.rolloffFactor:u.rolloffFactor,panningModel:typeof o.panningModel<"u"?o.panningModel:u.panningModel};var h=s._panner;h||(s._pos||(s._pos=n._pos||[0,0,-.5]),t(s,"spatial"),h=s._panner),h.coneInnerAngle=u.coneInnerAngle,h.coneOuterAngle=u.coneOuterAngle,h.coneOuterGain=u.coneOuterGain,h.distanceModel=u.distanceModel,h.maxDistance=u.maxDistance,h.refDistance=u.refDistance,h.rolloffFactor=u.rolloffFactor,h.panningModel=u.panningModel}return n},Sound.prototype.init=function(n){return function(){var r=this,o=r._parent;r._orientation=o._orientation,r._stereo=o._stereo,r._pos=o._pos,r._pannerAttr=o._pannerAttr,n.call(this),r._stereo?o.stereo(r._stereo):r._pos&&o.pos(r._pos[0],r._pos[1],r._pos[2],r._id)}}(Sound.prototype.init),Sound.prototype.reset=function(n){return function(){var r=this,o=r._parent;return r._orientation=o._orientation,r._stereo=o._stereo,r._pos=o._pos,r._pannerAttr=o._pannerAttr,r._stereo?o.stereo(r._stereo):r._pos?o.pos(r._pos[0],r._pos[1],r._pos[2],r._id):r._panner&&(r._panner.disconnect(0),r._panner=void 0,o._refreshBuffer(r)),n.call(this)}}(Sound.prototype.reset);var t=function(n,r){r=r||"spatial",r==="spatial"?(n._panner=Howler.ctx.createPanner(),n._panner.coneInnerAngle=n._pannerAttr.coneInnerAngle,n._panner.coneOuterAngle=n._pannerAttr.coneOuterAngle,n._panner.coneOuterGain=n._pannerAttr.coneOuterGain,n._panner.distanceModel=n._pannerAttr.distanceModel,n._panner.maxDistance=n._pannerAttr.maxDistance,n._panner.refDistance=n._pannerAttr.refDistance,n._panner.rolloffFactor=n._pannerAttr.rolloffFactor,n._panner.panningModel=n._pannerAttr.panningModel,typeof n._panner.positionX<"u"?(n._panner.positionX.setValueAtTime(n._pos[0],Howler.ctx.currentTime),n._panner.positionY.setValueAtTime(n._pos[1],Howler.ctx.currentTime),n._panner.positionZ.setValueAtTime(n._pos[2],Howler.ctx.currentTime)):n._panner.setPosition(n._pos[0],n._pos[1],n._pos[2]),typeof n._panner.orientationX<"u"?(n._panner.orientationX.setValueAtTime(n._orientation[0],Howler.ctx.currentTime),n._panner.orientationY.setValueAtTime(n._orientation[1],Howler.ctx.currentTime),n._panner.orientationZ.setValueAtTime(n._orientation[2],Howler.ctx.currentTime)):n._panner.setOrientation(n._orientation[0],n._orientation[1],n._orientation[2])):(n._panner=Howler.ctx.createStereoPanner(),n._panner.pan.setValueAtTime(n._stereo,Howler.ctx.currentTime)),n._panner.connect(n._node),n._paused||n._parent.pause(n._id,!0).play(n._id,!0)}})()})(rn);function kt(e){return new Promise((t,n)=>{setTimeout(t,e)})}const Zi=e=>e.reduce((t,n)=>({...t,[n]:n}),{}),es=e=>e!==null&&typeof e=="object"&&typeof e.then=="function"&&typeof e.catch=="function",jl=["music","ambiant","sound"],xl=Zi(jl),ft=et("audio",{state:()=>{const e=new Map;for(const t in xl)e.set(t,{channels:[],options:{volume:1}});return{modes:e,masterVolume:1}},actions:{stopAll(){this.modes.forEach(e=>{e.channels.forEach((t,n)=>{t&&(this.actuallyStopChannel(t),e.channels[n]=null)})})},async stopChannel(e,t){const n=this.getAudioChannel(e,t);if(!n)return;const{fadeOutTime:r}=ki(n.audio);if(this.setAudioChannel(e,t,null),Lt().options.musicFadeOutTime){const o=Qt(n.audio);o&&o.fade(o.volume(n.howlerId),0,r,n.howlerId),await kt(r)}this.actuallyStopChannel(n)},async pauseChannel(e,t){const n=this.getAudioChannel(e,t);if(!n)return;const r=Qt(n.audio);if(!r){ae(`Could not find audio ${n.audio}`);return}r.pause(n.howlerId)},async playChannel(e,t,n){rn.Howler.ctx.state==="suspended"&&(console.warn("Audio context is suspended :o"),rn.Howler.ctx.resume());const r=this.getAudioChannel(e,n);if(e==="sound")return this.actuallyPlayChannel(e,n,t);r&&r.audio!==t?await this.changeChannel(e,t,n):r&&r.audio===t?await this.resumeChannel(e,n):await this.actuallyPlayChannel(e,n,t)},async resumeChannel(e,t){const n=this.getAudioChannel(e,t);if(!n)return;const r=Qt(n.audio);if(!r){ae(`Could not find audio ${n.audio}`);return}r.play(n.howlerId)},async changeChannel(e,t,n){this.getAudioChannel(e,n)&&e!=="sound"&&await this.stopChannel(e,n),await this.actuallyPlayChannel(e,n,t)},actuallyStopChannel(e){fm(e.audio,e.howlerId)},getAudioChannel(e,t){return this.modes.get(e).channels[t]||null},setAudioChannel(e,t,n){this.modes.get(e).channels[t]=n},async actuallyPlayChannel(e,t,n){const r=Qt(n);if(!r){ae(`Could not find audio ${n}`);return}const{fadeInTime:o,fadeInDelay:a}=ki(n),s=this.audioVolume(e,n);if(e!=="sound"){const c=r.play();r.volume(0,c),r.pause(c),this.setAudioChannel(e,t,{audio:n,howlerId:c}),await kt(a);const d=this.getAudioChannel(e,t);d!==null&&d.audio===n&&(r.play(c),r.fade(0,s,o,c))}else if(e==="sound"){const c=r.play();r.volume(s,c),this.setAudioChannel(e,t,{audio:n,howlerId:c})}},reloadAudio(e){for(const t in e.modes){if(t==="sound")continue;const n=t;this.modes.get(n).options=Be(e.modes[n].options);for(const r in e.modes[n].channels){const o=e.modes[n].channels[r];o&&o.audio&&this.actuallyPlayChannel(n,Number(r),o.audio)}}},stopSound(e){const t=Qt(e);t&&t.stop()},generateSaveData(){const e={};for(const t in xl){const n=this.modes.get(t);e[t]={options:Be(n.options),channels:Be(n.channels).map(r=>r?{audio:r.audio}:{audio:null})}}return{modes:e,masterVolume:this.masterVolume}},loadSaveData(e){this.masterVolume=e.masterVolume},reset(){this.stopAll()},setModeVolume(e,t){const n=this.modes.get(e);n.options.volume=t;for(const r in n.channels){const o=n.channels[r];if(o){const a=Qt(o.audio);a&&a.volume(this.modeVolume(e),o.howlerId)}}},setMasterVolume(e){this.masterVolume=e,rn.Howler.volume(e)},modeVolume(e){return this.masterVolume*this.modes.get(e).options.volume},audioVolume(e,t){var n;return this.modeVolume(e)*(((n=kf(t))==null?void 0:n.volume)??1)}}}),Dl={};rn.Howler.volume(.5);let ts={};async function um(e){Ft.log("Loading audio");const t=[];rn.Howler.volume(e.options.volume);for(const n in e.files){const r=e.files[n];r.src||(r.src=r.path,r.path||console.error(`Audio config for ${n} doesn't have any \`src\` value to find the file`),console.warn("Using `path` for audio and musics is deprecated. Please replace `path` with `src` in your config file!")),t.push(dm(n,e.files[n]))}return e.audioTriggers&&(ts=e.audioTriggers),Promise.all(t)}function Yn(e){ts[e]&&ft().playChannel("sound",ts[e],0)}async function dm(e,t){return new Promise((n,r)=>{const o=new rn.Howl({...t,src:Et(t.src)});o.load(),Dl[e]=o,n()})}function fm(e,t){const n=Qt(e);if(!n){er(`Could not find music ${e}`);return}n.stop(t)}function Qt(e){return Dl[e]}function pm(e){const t=Qt(e),{fadeInTime:n}=ki(e),r=t.play(),a=ft().audioVolume("music",e);return t.fade(0,a,n,r),r}async function mm(e,t){const n=Qt(e),{fadeOutTime:r}=ki(e);n.fade(n.volume(t),0,r,t),await kt(r),n.stop(t)}function hm(e,t){return e-t*So().options.extraPointsPerLevel}function Ll(e,t){const{options:n}=So();let r=e;n.showDifficultyWithoutModifiers||(r=hm(e,t));const o=So().options;let a=!1,s=0,c=o.difficultyText[0][1];for(;!a;)o.difficultyText.length>s&&r>=o.difficultyText[s][0]?c=o.difficultyText[s][1]:a=!0,s++;let d="";return n.showDifficultyText&&n.showDifficultyNumber?d=`${c} (${r})`:n.showDifficultyText?d=c:n.showDifficultyNumber&&(d=r.toString()),d}function ym({skill:e,skillCheckId:t,value:n}){const r=Xe(),o=r.getSkillCheck(t),a=Ii(e),s=r.skills[e].level,c=Ll(n,s);let d=!0,u=`<span class='skill-check'>[<span class='skill-check-name'>${a.name}</span> - `;return o.happened?o.succeeded?u="":(d=!1,u+=` <span class='skill-check-difficulty'>${c}</span> - <span class='skill-check-failed'>FAILED</span>]</span>`):u+=` <span class='skill-check-difficulty'>${c}</span>]</span>`,{difficultyText:u,allowed:d}}function gm(e,t){const n=Xe(),r=Ii(t.skill),o=Ll(t.difficulty,n.skills[t.skill].level);return`<span class='passive-skill-check skill-check'>[<span class='skill-check-name'>${r.name}</span> - <span class='skill-check-difficulty'>${o}</span> - ${e?'<span class="skill-check-success">Success</span>':'<span class="skill-check-failed">Failure</span>'}]</span>`}function _m(e){const{options:t}=So(),n=bm(t,e),a=Xe().skills[e].level*t.extraPointsPerLevel;let s=n.reduce((c,d)=>c+d.unmodified,a);return t.finalRollIsHighest?(s=n.reduce((c,d)=>d.modified>c?d.modified:c,0),Ft.log(`[SKILL CHECK] Keeping only highest roll: ${s}`)):t.finalRollIsLowest&&(s=n.reduce((c,d)=>d.modified<c?d.modified:c,n[0].modified),Ft.log(`[SKILL CHECK] Keeping only lowest roll: ${s}`)),{roll:s,rolls:n}}function bm(e,t){const r=Xe().skills[t],o=r.level*e.extraPointsPerLevel;let{diceRange:a,diceCount:s}=e;e.extraDicePerLevel&&(s+=e.extraDicePerLevel*r.level);const c=[];for(let d=0;d<s;d++){const u=Tm(a),h=u+o;Ft.log(`[SKILL CHECK] Roll ${d+1}/${s}: ${h}. (Base roll: ${u}, modifier: ${o} - Skill level: ${r.level})`),c.push({unmodified:u,modified:h})}return c}function Tm(e){return Math.floor(Math.random()*e[1])+e[0]}function vm(e){const{skills:t}=dn(),{roll:n,rolls:r}=_m(e.skill),o=t[e.skill];let a=!1;if(typeof e.winsNeeded=="number"){const s=r.reduce((c,d)=>(Ml(d.modified,e.difficulty)&&c++,c),0);s>=e.winsNeeded&&(a=!0),Ft.log(`[SKILL CHECK ${o.name}] - Dice pool mode. ${e.winsNeeded} wins needed. Got ${s} successes.
38
+ (${e.id} - ${s}/${e.winsNeeded} - rolls: ${JSON.stringify(r.map(c=>c.modified))})`)}else a=Ml(n,e.difficulty),Ft.log(`[SKILL CHECK ${o.name}]: ${a?"✅":"❌"}`,`(${e.id}) - ${n}/${e.difficulty}`);return Yn(a?"onSkillCheckSuccess":"onSkillCheckFailure"),a}function Ml(e,t){const{options:n}=So();let r=e>=t;return n.successOnRollsBelowThreshold&&(r=e<=t),n.failOnRollsEqualToThreshold&&e===t&&(r=!1),r}var p={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Type=e.JsonType=e.JavaScriptTypeBuilder=e.JsonTypeBuilder=e.TypeBuilder=e.TypeBuilderError=e.TransformEncodeBuilder=e.TransformDecodeBuilder=e.TemplateLiteralDslParser=e.TemplateLiteralGenerator=e.TemplateLiteralGeneratorError=e.TemplateLiteralFinite=e.TemplateLiteralFiniteError=e.TemplateLiteralParser=e.TemplateLiteralParserError=e.TemplateLiteralResolver=e.TemplateLiteralPattern=e.TemplateLiteralPatternError=e.UnionResolver=e.KeyArrayResolver=e.KeyArrayResolverError=e.KeyResolver=e.ObjectMap=e.Intrinsic=e.IndexedAccessor=e.TypeClone=e.TypeExtends=e.TypeExtendsResult=e.TypeExtendsError=e.ExtendsUndefined=e.TypeGuard=e.TypeGuardUnknownTypeError=e.ValueGuard=e.FormatRegistry=e.TypeBoxError=e.TypeRegistry=e.PatternStringExact=e.PatternNumberExact=e.PatternBooleanExact=e.PatternString=e.PatternNumber=e.PatternBoolean=e.Kind=e.Hint=e.Optional=e.Readonly=e.Transform=void 0,e.Transform=Symbol.for("TypeBox.Transform"),e.Readonly=Symbol.for("TypeBox.Readonly"),e.Optional=Symbol.for("TypeBox.Optional"),e.Hint=Symbol.for("TypeBox.Hint"),e.Kind=Symbol.for("TypeBox.Kind"),e.PatternBoolean="(true|false)",e.PatternNumber="(0|[1-9][0-9]*)",e.PatternString="(.*)",e.PatternBooleanExact=`^${e.PatternBoolean}$`,e.PatternNumberExact=`^${e.PatternNumber}$`,e.PatternStringExact=`^${e.PatternString}$`;var t;(function(j){const g=new Map;function E(){return new Map(g)}j.Entries=E;function $(){return g.clear()}j.Clear=$;function _(U){return g.delete(U)}j.Delete=_;function v(U){return g.has(U)}j.Has=v;function C(U,ne){g.set(U,ne)}j.Set=C;function M(U){return g.get(U)}j.Get=M})(t||(e.TypeRegistry=t={}));class n extends Error{constructor(g){super(g)}}e.TypeBoxError=n;var r;(function(j){const g=new Map;function E(){return new Map(g)}j.Entries=E;function $(){return g.clear()}j.Clear=$;function _(U){return g.delete(U)}j.Delete=_;function v(U){return g.has(U)}j.Has=v;function C(U,ne){g.set(U,ne)}j.Set=C;function M(U){return g.get(U)}j.Get=M})(r||(e.FormatRegistry=r={}));var o;(function(j){function g(re){return Array.isArray(re)}j.IsArray=g;function E(re){return typeof re=="bigint"}j.IsBigInt=E;function $(re){return typeof re=="boolean"}j.IsBoolean=$;function _(re){return re instanceof globalThis.Date}j.IsDate=_;function v(re){return re===null}j.IsNull=v;function C(re){return typeof re=="number"}j.IsNumber=C;function M(re){return typeof re=="object"&&re!==null}j.IsObject=M;function U(re){return typeof re=="string"}j.IsString=U;function ne(re){return re instanceof globalThis.Uint8Array}j.IsUint8Array=ne;function ee(re){return re===void 0}j.IsUndefined=ee})(o||(e.ValueGuard=o={}));class a extends n{}e.TypeGuardUnknownTypeError=a;var s;(function(j){function g(O){try{return new RegExp(O),!0}catch{return!1}}function E(O){if(!o.IsString(O))return!1;for(let N=0;N<O.length;N++){const A=O.charCodeAt(N);if(A>=7&&A<=13||A===27||A===127)return!1}return!0}function $(O){return C(O)||ot(O)}function _(O){return o.IsUndefined(O)||o.IsBigInt(O)}function v(O){return o.IsUndefined(O)||o.IsNumber(O)}function C(O){return o.IsUndefined(O)||o.IsBoolean(O)}function M(O){return o.IsUndefined(O)||o.IsString(O)}function U(O){return o.IsUndefined(O)||o.IsString(O)&&E(O)&&g(O)}function ne(O){return o.IsUndefined(O)||o.IsString(O)&&E(O)}function ee(O){return o.IsUndefined(O)||ot(O)}function re(O){return Ce(O,"Any")&&M(O.$id)}j.TAny=re;function Ee(O){return Ce(O,"Array")&&O.type==="array"&&M(O.$id)&&ot(O.items)&&v(O.minItems)&&v(O.maxItems)&&C(O.uniqueItems)&&ee(O.contains)&&v(O.minContains)&&v(O.maxContains)}j.TArray=Ee;function B(O){return Ce(O,"AsyncIterator")&&O.type==="AsyncIterator"&&M(O.$id)&&ot(O.items)}j.TAsyncIterator=B;function J(O){return Ce(O,"BigInt")&&O.type==="bigint"&&M(O.$id)&&_(O.exclusiveMaximum)&&_(O.exclusiveMinimum)&&_(O.maximum)&&_(O.minimum)&&_(O.multipleOf)}j.TBigInt=J;function fe(O){return Ce(O,"Boolean")&&O.type==="boolean"&&M(O.$id)}j.TBoolean=fe;function ce(O){return Ce(O,"Constructor")&&O.type==="Constructor"&&M(O.$id)&&o.IsArray(O.parameters)&&O.parameters.every(N=>ot(N))&&ot(O.returns)}j.TConstructor=ce;function be(O){return Ce(O,"Date")&&O.type==="Date"&&M(O.$id)&&v(O.exclusiveMaximumTimestamp)&&v(O.exclusiveMinimumTimestamp)&&v(O.maximumTimestamp)&&v(O.minimumTimestamp)&&v(O.multipleOfTimestamp)}j.TDate=be;function Se(O){return Ce(O,"Function")&&O.type==="Function"&&M(O.$id)&&o.IsArray(O.parameters)&&O.parameters.every(N=>ot(N))&&ot(O.returns)}j.TFunction=Se;function Le(O){return Ce(O,"Integer")&&O.type==="integer"&&M(O.$id)&&v(O.exclusiveMaximum)&&v(O.exclusiveMinimum)&&v(O.maximum)&&v(O.minimum)&&v(O.multipleOf)}j.TInteger=Le;function Qe(O){return Ce(O,"Intersect")&&!(o.IsString(O.type)&&O.type!=="object")&&o.IsArray(O.allOf)&&O.allOf.every(N=>ot(N)&&!fr(N))&&M(O.type)&&(C(O.unevaluatedProperties)||ee(O.unevaluatedProperties))&&M(O.$id)}j.TIntersect=Qe;function We(O){return Ce(O,"Iterator")&&O.type==="Iterator"&&M(O.$id)&&ot(O.items)}j.TIterator=We;function Ce(O,N){return H(O)&&O[e.Kind]===N}j.TKindOf=Ce;function H(O){return o.IsObject(O)&&e.Kind in O&&o.IsString(O[e.Kind])}j.TKind=H;function oe(O){return _e(O)&&o.IsString(O.const)}j.TLiteralString=oe;function ie(O){return _e(O)&&o.IsNumber(O.const)}j.TLiteralNumber=ie;function ue(O){return _e(O)&&o.IsBoolean(O.const)}j.TLiteralBoolean=ue;function _e(O){return Ce(O,"Literal")&&M(O.$id)&&(o.IsBoolean(O.const)||o.IsNumber(O.const)||o.IsString(O.const))}j.TLiteral=_e;function $e(O){return Ce(O,"Never")&&o.IsObject(O.not)&&Object.getOwnPropertyNames(O.not).length===0}j.TNever=$e;function we(O){return Ce(O,"Not")&&ot(O.not)}j.TNot=we;function lt(O){return Ce(O,"Null")&&O.type==="null"&&M(O.$id)}j.TNull=lt;function Bt(O){return Ce(O,"Number")&&O.type==="number"&&M(O.$id)&&v(O.exclusiveMaximum)&&v(O.exclusiveMinimum)&&v(O.maximum)&&v(O.minimum)&&v(O.multipleOf)}j.TNumber=Bt;function Rt(O){return Ce(O,"Object")&&O.type==="object"&&M(O.$id)&&o.IsObject(O.properties)&&$(O.additionalProperties)&&v(O.minProperties)&&v(O.maxProperties)&&Object.entries(O.properties).every(([N,A])=>E(N)&&ot(A))}j.TObject=Rt;function Ot(O){return Ce(O,"Promise")&&O.type==="Promise"&&M(O.$id)&&ot(O.item)}j.TPromise=Ot;function ur(O){return Ce(O,"Record")&&O.type==="object"&&M(O.$id)&&$(O.additionalProperties)&&o.IsObject(O.patternProperties)&&(N=>{const A=Object.getOwnPropertyNames(N.patternProperties);return A.length===1&&g(A[0])&&o.IsObject(N.patternProperties)&&ot(N.patternProperties[A[0]])})(O)}j.TRecord=ur;function $o(O){return o.IsObject(O)&&e.Hint in O&&O[e.Hint]==="Recursive"}j.TRecursive=$o;function dr(O){return Ce(O,"Ref")&&M(O.$id)&&o.IsString(O.$ref)}j.TRef=dr;function At(O){return Ce(O,"String")&&O.type==="string"&&M(O.$id)&&v(O.minLength)&&v(O.maxLength)&&U(O.pattern)&&ne(O.format)}j.TString=At;function Vr(O){return Ce(O,"Symbol")&&O.type==="symbol"&&M(O.$id)}j.TSymbol=Vr;function An(O){return Ce(O,"TemplateLiteral")&&O.type==="string"&&o.IsString(O.pattern)&&O.pattern[0]==="^"&&O.pattern[O.pattern.length-1]==="$"}j.TTemplateLiteral=An;function Ur(O){return Ce(O,"This")&&M(O.$id)&&o.IsString(O.$ref)}j.TThis=Ur;function fr(O){return o.IsObject(O)&&e.Transform in O}j.TTransform=fr;function rt(O){return Ce(O,"Tuple")&&O.type==="array"&&M(O.$id)&&o.IsNumber(O.minItems)&&o.IsNumber(O.maxItems)&&O.minItems===O.maxItems&&(o.IsUndefined(O.items)&&o.IsUndefined(O.additionalItems)&&O.minItems===0||o.IsArray(O.items)&&O.items.every(N=>ot(N)))}j.TTuple=rt;function qr(O){return Ce(O,"Undefined")&&O.type==="undefined"&&M(O.$id)}j.TUndefined=qr;function mn(O){return In(O)&&O.anyOf.every(N=>oe(N)||ie(N))}j.TUnionLiteral=mn;function In(O){return Ce(O,"Union")&&M(O.$id)&&o.IsObject(O)&&o.IsArray(O.anyOf)&&O.anyOf.every(N=>ot(N))}j.TUnion=In;function Nn(O){return Ce(O,"Uint8Array")&&O.type==="Uint8Array"&&M(O.$id)&&v(O.minByteLength)&&v(O.maxByteLength)}j.TUint8Array=Nn;function _t(O){return Ce(O,"Unknown")&&M(O.$id)}j.TUnknown=_t;function Hn(O){return Ce(O,"Unsafe")}j.TUnsafe=Hn;function Kn(O){return Ce(O,"Void")&&O.type==="void"&&M(O.$id)}j.TVoid=Kn;function Eo(O){return o.IsObject(O)&&O[e.Readonly]==="Readonly"}j.TReadonly=Eo;function Hr(O){return o.IsObject(O)&&O[e.Optional]==="Optional"}j.TOptional=Hr;function ot(O){return o.IsObject(O)&&(re(O)||Ee(O)||fe(O)||J(O)||B(O)||ce(O)||be(O)||Se(O)||Le(O)||Qe(O)||We(O)||_e(O)||$e(O)||we(O)||lt(O)||Bt(O)||Rt(O)||Ot(O)||ur(O)||dr(O)||At(O)||Vr(O)||An(O)||Ur(O)||rt(O)||qr(O)||In(O)||Nn(O)||_t(O)||Hn(O)||Kn(O)||H(O)&&t.Has(O[e.Kind]))}j.TSchema=ot})(s||(e.TypeGuard=s={}));var c;(function(j){function g(E){return E[e.Kind]==="Intersect"?E.allOf.every($=>g($)):E[e.Kind]==="Union"?E.anyOf.some($=>g($)):E[e.Kind]==="Undefined"?!0:E[e.Kind]==="Not"?!g(E.not):!1}j.Check=g})(c||(e.ExtendsUndefined=c={}));class d extends n{}e.TypeExtendsError=d;var u;(function(j){j[j.Union=0]="Union",j[j.True=1]="True",j[j.False=2]="False"})(u||(e.TypeExtendsResult=u={}));var h;(function(j){function g(k){return k===u.False?k:u.True}function E(k){throw new d(k)}function $(k){return s.TNever(k)||s.TIntersect(k)||s.TUnion(k)||s.TUnknown(k)||s.TAny(k)}function _(k,w){return s.TNever(w)?Ce():s.TIntersect(w)?Se(k,w):s.TUnion(w)?q(k,w):s.TUnknown(w)?he():s.TAny(w)?v():E("StructuralRight")}function v(k,w){return u.True}function C(k,w){return s.TIntersect(w)?Se(k,w):s.TUnion(w)&&w.anyOf.some(ye=>s.TAny(ye)||s.TUnknown(ye))?u.True:s.TUnion(w)?u.Union:s.TUnknown(w)||s.TAny(w)?u.True:u.Union}function M(k,w){return s.TUnknown(k)?u.False:s.TAny(k)?u.Union:s.TNever(k)?u.True:u.False}function U(k,w){return s.TObject(w)&&An(w)?u.True:$(w)?_(k,w):s.TArray(w)?g(de(k.items,w.items)):u.False}function ne(k,w){return $(w)?_(k,w):s.TAsyncIterator(w)?g(de(k.items,w.items)):u.False}function ee(k,w){return $(w)?_(k,w):s.TObject(w)?rt(k,w):s.TRecord(w)?_t(k,w):s.TBigInt(w)?u.True:u.False}function re(k,w){return s.TLiteral(k)&&o.IsBoolean(k.const)||s.TBoolean(k)?u.True:u.False}function Ee(k,w){return $(w)?_(k,w):s.TObject(w)?rt(k,w):s.TRecord(w)?_t(k,w):s.TBoolean(w)?u.True:u.False}function B(k,w){return $(w)?_(k,w):s.TObject(w)?rt(k,w):s.TConstructor(w)?k.parameters.length>w.parameters.length?u.False:k.parameters.every((ye,Re)=>g(de(w.parameters[Re],ye))===u.True)?g(de(k.returns,w.returns)):u.False:u.False}function J(k,w){return $(w)?_(k,w):s.TObject(w)?rt(k,w):s.TRecord(w)?_t(k,w):s.TDate(w)?u.True:u.False}function fe(k,w){return $(w)?_(k,w):s.TObject(w)?rt(k,w):s.TFunction(w)?k.parameters.length>w.parameters.length?u.False:k.parameters.every((ye,Re)=>g(de(w.parameters[Re],ye))===u.True)?g(de(k.returns,w.returns)):u.False:u.False}function ce(k,w){return s.TLiteral(k)&&o.IsNumber(k.const)||s.TNumber(k)||s.TInteger(k)?u.True:u.False}function be(k,w){return s.TInteger(w)||s.TNumber(w)?u.True:$(w)?_(k,w):s.TObject(w)?rt(k,w):s.TRecord(w)?_t(k,w):u.False}function Se(k,w){return w.allOf.every(ye=>de(k,ye)===u.True)?u.True:u.False}function Le(k,w){return k.allOf.some(ye=>de(ye,w)===u.True)?u.True:u.False}function Qe(k,w){return $(w)?_(k,w):s.TIterator(w)?g(de(k.items,w.items)):u.False}function We(k,w){return s.TLiteral(w)&&w.const===k.const?u.True:$(w)?_(k,w):s.TObject(w)?rt(k,w):s.TRecord(w)?_t(k,w):s.TString(w)?Kn(k):s.TNumber(w)?_e(k):s.TInteger(w)?ce(k):s.TBoolean(w)?re(k):u.False}function Ce(k,w){return u.False}function H(k,w){return u.True}function oe(k){let[w,ye]=[k,0];for(;s.TNot(w);)w=w.not,ye+=1;return ye%2===0?w:e.Type.Unknown()}function ie(k,w){return s.TNot(k)?de(oe(k),w):s.TNot(w)?de(k,oe(w)):E("Invalid fallthrough for Not")}function ue(k,w){return $(w)?_(k,w):s.TObject(w)?rt(k,w):s.TRecord(w)?_t(k,w):s.TNull(w)?u.True:u.False}function _e(k,w){return s.TLiteralNumber(k)||s.TNumber(k)||s.TInteger(k)?u.True:u.False}function $e(k,w){return $(w)?_(k,w):s.TObject(w)?rt(k,w):s.TRecord(w)?_t(k,w):s.TInteger(w)||s.TNumber(w)?u.True:u.False}function we(k,w){return Object.getOwnPropertyNames(k.properties).length===w}function lt(k){return An(k)}function Bt(k){return we(k,0)||we(k,1)&&"description"in k.properties&&s.TUnion(k.properties.description)&&k.properties.description.anyOf.length===2&&(s.TString(k.properties.description.anyOf[0])&&s.TUndefined(k.properties.description.anyOf[1])||s.TString(k.properties.description.anyOf[1])&&s.TUndefined(k.properties.description.anyOf[0]))}function Rt(k){return we(k,0)}function Ot(k){return we(k,0)}function ur(k){return we(k,0)}function $o(k){return we(k,0)}function dr(k){return An(k)}function At(k){const w=e.Type.Number();return we(k,0)||we(k,1)&&"length"in k.properties&&g(de(k.properties.length,w))===u.True}function Vr(k){return we(k,0)}function An(k){const w=e.Type.Number();return we(k,0)||we(k,1)&&"length"in k.properties&&g(de(k.properties.length,w))===u.True}function Ur(k){const w=e.Type.Function([e.Type.Any()],e.Type.Any());return we(k,0)||we(k,1)&&"then"in k.properties&&g(de(k.properties.then,w))===u.True}function fr(k,w){return de(k,w)===u.False||s.TOptional(k)&&!s.TOptional(w)?u.False:u.True}function rt(k,w){return s.TUnknown(k)?u.False:s.TAny(k)?u.Union:s.TNever(k)||s.TLiteralString(k)&&lt(w)||s.TLiteralNumber(k)&&Rt(w)||s.TLiteralBoolean(k)&&Ot(w)||s.TSymbol(k)&&Bt(w)||s.TBigInt(k)&&ur(w)||s.TString(k)&&lt(w)||s.TSymbol(k)&&Bt(w)||s.TNumber(k)&&Rt(w)||s.TInteger(k)&&Rt(w)||s.TBoolean(k)&&Ot(w)||s.TUint8Array(k)&&dr(w)||s.TDate(k)&&$o(w)||s.TConstructor(k)&&Vr(w)||s.TFunction(k)&&At(w)?u.True:s.TRecord(k)&&s.TString(In(k))?w[e.Hint]==="Record"?u.True:u.False:s.TRecord(k)&&s.TNumber(In(k))?we(w,0)?u.True:u.False:u.False}function qr(k,w){return $(w)?_(k,w):s.TRecord(w)?_t(k,w):s.TObject(w)?(()=>{for(const ye of Object.getOwnPropertyNames(w.properties)){if(!(ye in k.properties)&&!s.TOptional(w.properties[ye]))return u.False;if(s.TOptional(w.properties[ye]))return u.True;if(fr(k.properties[ye],w.properties[ye])===u.False)return u.False}return u.True})():u.False}function mn(k,w){return $(w)?_(k,w):s.TObject(w)&&Ur(w)?u.True:s.TPromise(w)?g(de(k.item,w.item)):u.False}function In(k){return e.PatternNumberExact in k.patternProperties?e.Type.Number():e.PatternStringExact in k.patternProperties?e.Type.String():E("Unknown record key pattern")}function Nn(k){return e.PatternNumberExact in k.patternProperties?k.patternProperties[e.PatternNumberExact]:e.PatternStringExact in k.patternProperties?k.patternProperties[e.PatternStringExact]:E("Unable to get record value schema")}function _t(k,w){const[ye,Re]=[In(w),Nn(w)];return s.TLiteralString(k)&&s.TNumber(ye)&&g(de(k,Re))===u.True?u.True:s.TUint8Array(k)&&s.TNumber(ye)||s.TString(k)&&s.TNumber(ye)||s.TArray(k)&&s.TNumber(ye)?de(k,Re):s.TObject(k)?(()=>{for(const Ge of Object.getOwnPropertyNames(k.properties))if(fr(Re,k.properties[Ge])===u.False)return u.False;return u.True})():u.False}function Hn(k,w){return $(w)?_(k,w):s.TObject(w)?rt(k,w):s.TRecord(w)?de(Nn(k),Nn(w)):u.False}function Kn(k,w){return s.TLiteral(k)&&o.IsString(k.const)||s.TString(k)?u.True:u.False}function Eo(k,w){return $(w)?_(k,w):s.TObject(w)?rt(k,w):s.TRecord(w)?_t(k,w):s.TString(w)?u.True:u.False}function Hr(k,w){return $(w)?_(k,w):s.TObject(w)?rt(k,w):s.TRecord(w)?_t(k,w):s.TSymbol(w)?u.True:u.False}function ot(k,w){return s.TTemplateLiteral(k)?de(F.Resolve(k),w):s.TTemplateLiteral(w)?de(k,F.Resolve(w)):E("Invalid fallthrough for TemplateLiteral")}function O(k,w){return s.TArray(w)&&k.items!==void 0&&k.items.every(ye=>de(ye,w.items)===u.True)}function N(k,w){return s.TNever(k)?u.True:s.TUnknown(k)?u.False:s.TAny(k)?u.Union:u.False}function A(k,w){return $(w)?_(k,w):s.TObject(w)&&An(w)||s.TArray(w)&&O(k,w)?u.True:s.TTuple(w)?o.IsUndefined(k.items)&&!o.IsUndefined(w.items)||!o.IsUndefined(k.items)&&o.IsUndefined(w.items)?u.False:o.IsUndefined(k.items)&&!o.IsUndefined(w.items)||k.items.every((ye,Re)=>de(ye,w.items[Re])===u.True)?u.True:u.False:u.False}function x(k,w){return $(w)?_(k,w):s.TObject(w)?rt(k,w):s.TRecord(w)?_t(k,w):s.TUint8Array(w)?u.True:u.False}function K(k,w){return $(w)?_(k,w):s.TObject(w)?rt(k,w):s.TRecord(w)?_t(k,w):s.TVoid(w)?He(k):s.TUndefined(w)?u.True:u.False}function q(k,w){return w.anyOf.some(ye=>de(k,ye)===u.True)?u.True:u.False}function me(k,w){return k.anyOf.every(ye=>de(ye,w)===u.True)?u.True:u.False}function he(k,w){return u.True}function xe(k,w){return s.TNever(w)?Ce():s.TIntersect(w)?Se(k,w):s.TUnion(w)?q(k,w):s.TAny(w)?v():s.TString(w)?Kn(k):s.TNumber(w)?_e(k):s.TInteger(w)?ce(k):s.TBoolean(w)?re(k):s.TArray(w)?M(k):s.TTuple(w)?N(k):s.TObject(w)?rt(k,w):s.TUnknown(w)?u.True:u.False}function He(k,w){return s.TUndefined(k)||s.TUndefined(k)?u.True:u.False}function Ye(k,w){return s.TIntersect(w)?Se(k,w):s.TUnion(w)?q(k,w):s.TUnknown(w)?he():s.TAny(w)?v():s.TObject(w)?rt(k,w):s.TVoid(w)?u.True:u.False}function de(k,w){return s.TTemplateLiteral(k)||s.TTemplateLiteral(w)?ot(k,w):s.TNot(k)||s.TNot(w)?ie(k,w):s.TAny(k)?C(k,w):s.TArray(k)?U(k,w):s.TBigInt(k)?ee(k,w):s.TBoolean(k)?Ee(k,w):s.TAsyncIterator(k)?ne(k,w):s.TConstructor(k)?B(k,w):s.TDate(k)?J(k,w):s.TFunction(k)?fe(k,w):s.TInteger(k)?be(k,w):s.TIntersect(k)?Le(k,w):s.TIterator(k)?Qe(k,w):s.TLiteral(k)?We(k,w):s.TNever(k)?H():s.TNull(k)?ue(k,w):s.TNumber(k)?$e(k,w):s.TObject(k)?qr(k,w):s.TRecord(k)?Hn(k,w):s.TString(k)?Eo(k,w):s.TSymbol(k)?Hr(k,w):s.TTuple(k)?A(k,w):s.TPromise(k)?mn(k,w):s.TUint8Array(k)?x(k,w):s.TUndefined(k)?K(k,w):s.TUnion(k)?me(k,w):s.TUnknown(k)?xe(k,w):s.TVoid(k)?Ye(k,w):E(`Unknown left type operand '${k[e.Kind]}'`)}function Ue(k,w){return de(k,w)}j.Extends=Ue})(h||(e.TypeExtends=h={}));var l;(function(j){function g(U){return U.map(ne=>v(ne))}function E(U){return new Date(U.getTime())}function $(U){return new Uint8Array(U)}function _(U){const ne=Object.getOwnPropertyNames(U).reduce((re,Ee)=>({...re,[Ee]:v(U[Ee])}),{}),ee=Object.getOwnPropertySymbols(U).reduce((re,Ee)=>({...re,[Ee]:v(U[Ee])}),{});return{...ne,...ee}}function v(U){return o.IsArray(U)?g(U):o.IsDate(U)?E(U):o.IsUint8Array(U)?$(U):o.IsObject(U)?_(U):U}function C(U){return U.map(ne=>M(ne))}j.Rest=C;function M(U,ne={}){return{...v(U),...ne}}j.Type=M})(l||(e.TypeClone=l={}));var f;(function(j){function g(B){return B.map(J=>{const{[e.Optional]:fe,...ce}=l.Type(J);return ce})}function E(B){return B.every(J=>s.TOptional(J))}function $(B){return B.some(J=>s.TOptional(J))}function _(B){return E(B.allOf)?e.Type.Optional(e.Type.Intersect(g(B.allOf))):B}function v(B){return $(B.anyOf)?e.Type.Optional(e.Type.Union(g(B.anyOf))):B}function C(B){return B[e.Kind]==="Intersect"?_(B):B[e.Kind]==="Union"?v(B):B}function M(B,J){const fe=B.allOf.reduce((ce,be)=>{const Se=re(be,J);return Se[e.Kind]==="Never"?ce:[...ce,Se]},[]);return C(e.Type.Intersect(fe))}function U(B,J){const fe=B.anyOf.map(ce=>re(ce,J));return C(e.Type.Union(fe))}function ne(B,J){const fe=B.properties[J];return o.IsUndefined(fe)?e.Type.Never():e.Type.Union([fe])}function ee(B,J){const fe=B.items;if(o.IsUndefined(fe))return e.Type.Never();const ce=fe[J];return o.IsUndefined(ce)?e.Type.Never():ce}function re(B,J){return B[e.Kind]==="Intersect"?M(B,J):B[e.Kind]==="Union"?U(B,J):B[e.Kind]==="Object"?ne(B,J):B[e.Kind]==="Tuple"?ee(B,J):e.Type.Never()}function Ee(B,J,fe={}){const ce=J.map(be=>re(B,be.toString()));return C(e.Type.Union(ce,fe))}j.Resolve=Ee})(f||(e.IndexedAccessor=f={}));var m;(function(j){function g(ee){const[re,Ee]=[ee.slice(0,1),ee.slice(1)];return`${re.toLowerCase()}${Ee}`}function E(ee){const[re,Ee]=[ee.slice(0,1),ee.slice(1)];return`${re.toUpperCase()}${Ee}`}function $(ee){return ee.toUpperCase()}function _(ee){return ee.toLowerCase()}function v(ee,re){const Ee=P.ParseExact(ee.pattern);if(!W.Check(Ee))return{...ee,pattern:C(ee.pattern,re)};const fe=[...G.Generate(Ee)].map(Se=>e.Type.Literal(Se)),ce=M(fe,re),be=e.Type.Union(ce);return e.Type.TemplateLiteral([be])}function C(ee,re){return typeof ee=="string"?re==="Uncapitalize"?g(ee):re==="Capitalize"?E(ee):re==="Uppercase"?$(ee):re==="Lowercase"?_(ee):ee:ee.toString()}function M(ee,re){if(ee.length===0)return[];const[Ee,...B]=ee;return[ne(Ee,re),...M(B,re)]}function U(ee,re){return s.TTemplateLiteral(ee)?v(ee,re):s.TUnion(ee)?e.Type.Union(M(ee.anyOf,re)):s.TLiteral(ee)?e.Type.Literal(C(ee.const,re)):ee}function ne(ee,re){return U(ee,re)}j.Map=ne})(m||(e.Intrinsic=m={}));var y;(function(j){function g(C,M){return e.Type.Intersect(C.allOf.map(U=>_(U,M)),{...C})}function E(C,M){return e.Type.Union(C.anyOf.map(U=>_(U,M)),{...C})}function $(C,M){return M(C)}function _(C,M){return C[e.Kind]==="Intersect"?g(C,M):C[e.Kind]==="Union"?E(C,M):C[e.Kind]==="Object"?$(C,M):C}function v(C,M,U){return{..._(l.Type(C),M),...U}}j.Map=v})(y||(e.ObjectMap=y={}));var b;(function(j){function g(ne){return ne[0]==="^"&&ne[ne.length-1]==="$"?ne.slice(1,ne.length-1):ne}function E(ne,ee){return ne.allOf.reduce((re,Ee)=>[...re,...C(Ee,ee)],[])}function $(ne,ee){const re=ne.anyOf.map(Ee=>C(Ee,ee));return[...re.reduce((Ee,B)=>B.map(J=>re.every(fe=>fe.includes(J))?Ee.add(J):Ee)[0],new Set)]}function _(ne,ee){return Object.getOwnPropertyNames(ne.properties)}function v(ne,ee){return ee.includePatterns?Object.getOwnPropertyNames(ne.patternProperties):[]}function C(ne,ee){return s.TIntersect(ne)?E(ne,ee):s.TUnion(ne)?$(ne,ee):s.TObject(ne)?_(ne):s.TRecord(ne)?v(ne,ee):[]}function M(ne,ee){return[...new Set(C(ne,ee))]}j.ResolveKeys=M;function U(ne){return`^(${M(ne,{includePatterns:!0}).map(Ee=>`(${g(Ee)})`).join("|")})$`}j.ResolvePattern=U})(b||(e.KeyResolver=b={}));class S extends n{}e.KeyArrayResolverError=S;var T;(function(j){function g(E){return Array.isArray(E)?E:s.TUnionLiteral(E)?E.anyOf.map($=>$.const.toString()):s.TLiteral(E)?[E.const]:s.TTemplateLiteral(E)?(()=>{const $=P.ParseExact(E.pattern);if(!W.Check($))throw new S("Cannot resolve keys from infinite template expression");return[...G.Generate($)]})():[]}j.Resolve=g})(T||(e.KeyArrayResolver=T={}));var I;(function(j){function*g($){for(const _ of $.anyOf)_[e.Kind]==="Union"?yield*g(_):yield _}function E($){return e.Type.Union([...g($)],{...$})}j.Resolve=E})(I||(e.UnionResolver=I={}));class D extends n{}e.TemplateLiteralPatternError=D;var R;(function(j){function g(v){throw new D(v)}function E(v){return v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $(v,C){return s.TTemplateLiteral(v)?v.pattern.slice(1,v.pattern.length-1):s.TUnion(v)?`(${v.anyOf.map(M=>$(M,C)).join("|")})`:s.TNumber(v)?`${C}${e.PatternNumber}`:s.TInteger(v)?`${C}${e.PatternNumber}`:s.TBigInt(v)?`${C}${e.PatternNumber}`:s.TString(v)?`${C}${e.PatternString}`:s.TLiteral(v)?`${C}${E(v.const.toString())}`:s.TBoolean(v)?`${C}${e.PatternBoolean}`:g(`Unexpected Kind '${v[e.Kind]}'`)}function _(v){return`^${v.map(C=>$(C,"")).join("")}$`}j.Create=_})(R||(e.TemplateLiteralPattern=R={}));var F;(function(j){function g(E){const $=P.ParseExact(E.pattern);if(!W.Check($))return e.Type.String();const _=[...G.Generate($)].map(v=>e.Type.Literal(v));return e.Type.Union(_)}j.Resolve=g})(F||(e.TemplateLiteralResolver=F={}));class L extends n{}e.TemplateLiteralParserError=L;var P;(function(j){function g(B,J,fe){return B[J]===fe&&B.charCodeAt(J-1)!==92}function E(B,J){return g(B,J,"(")}function $(B,J){return g(B,J,")")}function _(B,J){return g(B,J,"|")}function v(B){if(!(E(B,0)&&$(B,B.length-1)))return!1;let J=0;for(let fe=0;fe<B.length;fe++)if(E(B,fe)&&(J+=1),$(B,fe)&&(J-=1),J===0&&fe!==B.length-1)return!1;return!0}function C(B){return B.slice(1,B.length-1)}function M(B){let J=0;for(let fe=0;fe<B.length;fe++)if(E(B,fe)&&(J+=1),$(B,fe)&&(J-=1),_(B,fe)&&J===0)return!0;return!1}function U(B){for(let J=0;J<B.length;J++)if(E(B,J))return!0;return!1}function ne(B){let[J,fe]=[0,0];const ce=[];for(let Se=0;Se<B.length;Se++)if(E(B,Se)&&(J+=1),$(B,Se)&&(J-=1),_(B,Se)&&J===0){const Le=B.slice(fe,Se);Le.length>0&&ce.push(re(Le)),fe=Se+1}const be=B.slice(fe);return be.length>0&&ce.push(re(be)),ce.length===0?{type:"const",const:""}:ce.length===1?ce[0]:{type:"or",expr:ce}}function ee(B){function J(be,Se){if(!E(be,Se))throw new L("TemplateLiteralParser: Index must point to open parens");let Le=0;for(let Qe=Se;Qe<be.length;Qe++)if(E(be,Qe)&&(Le+=1),$(be,Qe)&&(Le-=1),Le===0)return[Se,Qe];throw new L("TemplateLiteralParser: Unclosed group parens in expression")}function fe(be,Se){for(let Le=Se;Le<be.length;Le++)if(E(be,Le))return[Se,Le];return[Se,be.length]}const ce=[];for(let be=0;be<B.length;be++)if(E(B,be)){const[Se,Le]=J(B,be),Qe=B.slice(Se,Le+1);ce.push(re(Qe)),be=Le}else{const[Se,Le]=fe(B,be),Qe=B.slice(Se,Le);Qe.length>0&&ce.push(re(Qe)),be=Le-1}return ce.length===0?{type:"const",const:""}:ce.length===1?ce[0]:{type:"and",expr:ce}}function re(B){return v(B)?re(C(B)):M(B)?ne(B):U(B)?ee(B):{type:"const",const:B}}j.Parse=re;function Ee(B){return re(B.slice(1,B.length-1))}j.ParseExact=Ee})(P||(e.TemplateLiteralParser=P={}));class Y extends n{}e.TemplateLiteralFiniteError=Y;var W;(function(j){function g(C){throw new Y(C)}function E(C){return C.type==="or"&&C.expr.length===2&&C.expr[0].type==="const"&&C.expr[0].const==="0"&&C.expr[1].type==="const"&&C.expr[1].const==="[1-9][0-9]*"}function $(C){return C.type==="or"&&C.expr.length===2&&C.expr[0].type==="const"&&C.expr[0].const==="true"&&C.expr[1].type==="const"&&C.expr[1].const==="false"}function _(C){return C.type==="const"&&C.const===".*"}function v(C){return $(C)?!0:E(C)||_(C)?!1:C.type==="and"?C.expr.every(M=>v(M)):C.type==="or"?C.expr.every(M=>v(M)):C.type==="const"?!0:g("Unknown expression type")}j.Check=v})(W||(e.TemplateLiteralFinite=W={}));class X extends n{}e.TemplateLiteralGeneratorError=X;var G;(function(j){function*g(C){if(C.length===1)return yield*C[0];for(const M of C[0])for(const U of g(C.slice(1)))yield`${M}${U}`}function*E(C){return yield*g(C.expr.map(M=>[...v(M)]))}function*$(C){for(const M of C.expr)yield*v(M)}function*_(C){return yield C.const}function*v(C){return C.type==="and"?yield*E(C):C.type==="or"?yield*$(C):C.type==="const"?yield*_(C):(()=>{throw new X("Unknown expression")})()}j.Generate=v})(G||(e.TemplateLiteralGenerator=G={}));var z;(function(j){function*g(v){const C=v.trim().replace(/"|'/g,"");return C==="boolean"?yield e.Type.Boolean():C==="number"?yield e.Type.Number():C==="bigint"?yield e.Type.BigInt():C==="string"?yield e.Type.String():yield(()=>{const M=C.split("|").map(U=>e.Type.Literal(U.trim()));return M.length===0?e.Type.Never():M.length===1?M[0]:e.Type.Union(M)})()}function*E(v){if(v[1]!=="{"){const C=e.Type.Literal("$"),M=$(v.slice(1));return yield*[C,...M]}for(let C=2;C<v.length;C++)if(v[C]==="}"){const M=g(v.slice(2,C)),U=$(v.slice(C+1));return yield*[...M,...U]}yield e.Type.Literal(v)}function*$(v){for(let C=0;C<v.length;C++)if(v[C]==="$"){const M=e.Type.Literal(v.slice(0,C)),U=E(v.slice(C));return yield*[M,...U]}yield e.Type.Literal(v)}function _(v){return[...$(v)]}j.Parse=_})(z||(e.TemplateLiteralDslParser=z={}));class Q{constructor(g){this.schema=g}Decode(g){return new te(this.schema,g)}}e.TransformDecodeBuilder=Q;class te{constructor(g,E){this.schema=g,this.decode=E}Encode(g){const E=l.Type(this.schema);return s.TTransform(E)?(()=>{const v={Encode:C=>E[e.Transform].Encode(g(C)),Decode:C=>this.decode(E[e.Transform].Decode(C))};return{...E,[e.Transform]:v}})():(()=>{const $={Decode:this.decode,Encode:g};return{...E,[e.Transform]:$}})()}}e.TransformEncodeBuilder=te;let ke=0;class Ne extends n{}e.TypeBuilderError=Ne;class Ze{Create(g){return g}Throw(g){throw new Ne(g)}Discard(g,E){return E.reduce(($,_)=>{const{[_]:v,...C}=$;return C},g)}Strict(g){return JSON.parse(JSON.stringify(g))}}e.TypeBuilder=Ze;class qe extends Ze{ReadonlyOptional(g){return this.Readonly(this.Optional(g))}Readonly(g){return{...l.Type(g),[e.Readonly]:"Readonly"}}Optional(g){return{...l.Type(g),[e.Optional]:"Optional"}}Any(g={}){return this.Create({...g,[e.Kind]:"Any"})}Array(g,E={}){return this.Create({...E,[e.Kind]:"Array",type:"array",items:l.Type(g)})}Boolean(g={}){return this.Create({...g,[e.Kind]:"Boolean",type:"boolean"})}Capitalize(g,E={}){return{...m.Map(l.Type(g),"Capitalize"),...E}}Composite(g,E){const $=e.Type.Intersect(g,{}),v=b.ResolveKeys($,{includePatterns:!1}).reduce((C,M)=>({...C,[M]:e.Type.Index($,[M])}),{});return e.Type.Object(v,E)}Enum(g,E={}){if(o.IsUndefined(g))return this.Throw("Enum undefined or empty");const $=Object.getOwnPropertyNames(g).filter(C=>isNaN(C)).map(C=>g[C]),v=[...new Set($)].map(C=>e.Type.Literal(C));return this.Union(v,{...E,[e.Hint]:"Enum"})}Extends(g,E,$,_,v={}){switch(h.Extends(g,E)){case u.Union:return this.Union([l.Type($,v),l.Type(_,v)]);case u.True:return l.Type($,v);case u.False:return l.Type(_,v)}}Exclude(g,E,$={}){return s.TTemplateLiteral(g)?this.Exclude(F.Resolve(g),E,$):s.TTemplateLiteral(E)?this.Exclude(g,F.Resolve(E),$):s.TUnion(g)?(()=>{const _=g.anyOf.filter(v=>h.Extends(v,E)===u.False);return _.length===1?l.Type(_[0],$):this.Union(_,$)})():h.Extends(g,E)!==u.False?this.Never($):l.Type(g,$)}Extract(g,E,$={}){return s.TTemplateLiteral(g)?this.Extract(F.Resolve(g),E,$):s.TTemplateLiteral(E)?this.Extract(g,F.Resolve(E),$):s.TUnion(g)?(()=>{const _=g.anyOf.filter(v=>h.Extends(v,E)!==u.False);return _.length===1?l.Type(_[0],$):this.Union(_,$)})():h.Extends(g,E)!==u.False?l.Type(g,$):this.Never($)}Index(g,E,$={}){return s.TArray(g)&&s.TNumber(E)?l.Type(g.items,$):s.TTuple(g)&&s.TNumber(E)?(()=>{const v=(o.IsUndefined(g.items)?[]:g.items).map(C=>l.Type(C));return this.Union(v,$)})():(()=>{const _=T.Resolve(E),v=l.Type(g);return f.Resolve(v,_,$)})()}Integer(g={}){return this.Create({...g,[e.Kind]:"Integer",type:"integer"})}Intersect(g,E={}){if(g.length===0)return e.Type.Never();if(g.length===1)return l.Type(g[0],E);g.some(C=>s.TTransform(C))&&this.Throw("Cannot intersect transform types");const $=g.every(C=>s.TObject(C)),_=l.Rest(g),v=s.TSchema(E.unevaluatedProperties)?{unevaluatedProperties:l.Type(E.unevaluatedProperties)}:{};return E.unevaluatedProperties===!1||s.TSchema(E.unevaluatedProperties)||$?this.Create({...E,...v,[e.Kind]:"Intersect",type:"object",allOf:_}):this.Create({...E,...v,[e.Kind]:"Intersect",allOf:_})}KeyOf(g,E={}){return s.TRecord(g)?(()=>{const $=Object.getOwnPropertyNames(g.patternProperties)[0];return $===e.PatternNumberExact?this.Number(E):$===e.PatternStringExact?this.String(E):this.Throw("Unable to resolve key type from Record key pattern")})():s.TTuple(g)?(()=>{const _=(o.IsUndefined(g.items)?[]:g.items).map((v,C)=>e.Type.Literal(C.toString()));return this.Union(_,E)})():s.TArray(g)?this.Number(E):(()=>{const $=b.ResolveKeys(g,{includePatterns:!1});if($.length===0)return this.Never(E);const _=$.map(v=>this.Literal(v));return this.Union(_,E)})()}Literal(g,E={}){return this.Create({...E,[e.Kind]:"Literal",const:g,type:typeof g})}Lowercase(g,E={}){return{...m.Map(l.Type(g),"Lowercase"),...E}}Never(g={}){return this.Create({...g,[e.Kind]:"Never",not:{}})}Not(g,E){return this.Create({...E,[e.Kind]:"Not",not:l.Type(g)})}Null(g={}){return this.Create({...g,[e.Kind]:"Null",type:"null"})}Number(g={}){return this.Create({...g,[e.Kind]:"Number",type:"number"})}Object(g,E={}){const $=Object.getOwnPropertyNames(g),_=$.filter(U=>s.TOptional(g[U])),v=$.filter(U=>!_.includes(U)),C=s.TSchema(E.additionalProperties)?{additionalProperties:l.Type(E.additionalProperties)}:{},M=$.reduce((U,ne)=>({...U,[ne]:l.Type(g[ne])}),{});return v.length>0?this.Create({...E,...C,[e.Kind]:"Object",type:"object",properties:M,required:v}):this.Create({...E,...C,[e.Kind]:"Object",type:"object",properties:M})}Omit(g,E,$={}){const _=T.Resolve(E);return y.Map(this.Discard(l.Type(g),["$id",e.Transform]),v=>{o.IsArray(v.required)&&(v.required=v.required.filter(C=>!_.includes(C)),v.required.length===0&&delete v.required);for(const C of Object.getOwnPropertyNames(v.properties))_.includes(C)&&delete v.properties[C];return this.Create(v)},$)}Partial(g,E={}){return y.Map(this.Discard(l.Type(g),["$id",e.Transform]),$=>{const _=Object.getOwnPropertyNames($.properties).reduce((v,C)=>({...v,[C]:this.Optional($.properties[C])}),{});return this.Object(_,this.Discard($,["required"]))},E)}Pick(g,E,$={}){const _=T.Resolve(E);return y.Map(this.Discard(l.Type(g),["$id",e.Transform]),v=>{o.IsArray(v.required)&&(v.required=v.required.filter(C=>_.includes(C)),v.required.length===0&&delete v.required);for(const C of Object.getOwnPropertyNames(v.properties))_.includes(C)||delete v.properties[C];return this.Create(v)},$)}Record(g,E,$={}){return s.TTemplateLiteral(g)?(()=>{const _=P.ParseExact(g.pattern);return W.Check(_)?this.Object([...G.Generate(_)].reduce((v,C)=>({...v,[C]:l.Type(E)}),{}),$):this.Create({...$,[e.Kind]:"Record",type:"object",patternProperties:{[g.pattern]:l.Type(E)}})})():s.TUnion(g)?(()=>{const _=I.Resolve(g);if(s.TUnionLiteral(_)){const v=_.anyOf.reduce((C,M)=>({...C,[M.const]:l.Type(E)}),{});return this.Object(v,{...$,[e.Hint]:"Record"})}else this.Throw("Record key of type union contains non-literal types")})():s.TLiteral(g)?o.IsString(g.const)||o.IsNumber(g.const)?this.Object({[g.const]:l.Type(E)},$):this.Throw("Record key of type literal is not of type string or number"):s.TInteger(g)||s.TNumber(g)?this.Create({...$,[e.Kind]:"Record",type:"object",patternProperties:{[e.PatternNumberExact]:l.Type(E)}}):s.TString(g)?(()=>{const _=o.IsUndefined(g.pattern)?e.PatternStringExact:g.pattern;return this.Create({...$,[e.Kind]:"Record",type:"object",patternProperties:{[_]:l.Type(E)}})})():this.Never()}Recursive(g,E={}){o.IsUndefined(E.$id)&&(E.$id=`T${ke++}`);const $=g({[e.Kind]:"This",$ref:`${E.$id}`});return $.$id=E.$id,this.Create({...E,[e.Hint]:"Recursive",...$})}Ref(g,E={}){return o.IsString(g)?this.Create({...E,[e.Kind]:"Ref",$ref:g}):(o.IsUndefined(g.$id)&&this.Throw("Reference target type must specify an $id"),this.Create({...E,[e.Kind]:"Ref",$ref:g.$id}))}Required(g,E={}){return y.Map(this.Discard(l.Type(g),["$id",e.Transform]),$=>{const _=Object.getOwnPropertyNames($.properties).reduce((v,C)=>({...v,[C]:this.Discard($.properties[C],[e.Optional])}),{});return this.Object(_,$)},E)}Rest(g){return s.TTuple(g)&&!o.IsUndefined(g.items)?l.Rest(g.items):s.TIntersect(g)?l.Rest(g.allOf):s.TUnion(g)?l.Rest(g.anyOf):[]}String(g={}){return this.Create({...g,[e.Kind]:"String",type:"string"})}TemplateLiteral(g,E={}){const $=o.IsString(g)?R.Create(z.Parse(g)):R.Create(g);return this.Create({...E,[e.Kind]:"TemplateLiteral",type:"string",pattern:$})}Transform(g){return new Q(g)}Tuple(g,E={}){const[$,_,v]=[!1,g.length,g.length],C=l.Rest(g),M=g.length>0?{...E,[e.Kind]:"Tuple",type:"array",items:C,additionalItems:$,minItems:_,maxItems:v}:{...E,[e.Kind]:"Tuple",type:"array",minItems:_,maxItems:v};return this.Create(M)}Uncapitalize(g,E={}){return{...m.Map(l.Type(g),"Uncapitalize"),...E}}Union(g,E={}){return s.TTemplateLiteral(g)?F.Resolve(g):(()=>{const $=g;if($.length===0)return this.Never(E);if($.length===1)return this.Create(l.Type($[0],E));const _=l.Rest($);return this.Create({...E,[e.Kind]:"Union",anyOf:_})})()}Unknown(g={}){return this.Create({...g,[e.Kind]:"Unknown"})}Unsafe(g={}){return this.Create({...g,[e.Kind]:g[e.Kind]||"Unsafe"})}Uppercase(g,E={}){return{...m.Map(l.Type(g),"Uppercase"),...E}}}e.JsonTypeBuilder=qe;class nt extends qe{AsyncIterator(g,E={}){return this.Create({...E,[e.Kind]:"AsyncIterator",type:"AsyncIterator",items:l.Type(g)})}Awaited(g,E={}){const $=_=>_.length>0?(()=>{const[v,...C]=_;return[this.Awaited(v),...$(C)]})():_;return s.TIntersect(g)?e.Type.Intersect($(g.allOf)):s.TUnion(g)?e.Type.Union($(g.anyOf)):s.TPromise(g)?this.Awaited(g.item):l.Type(g,E)}BigInt(g={}){return this.Create({...g,[e.Kind]:"BigInt",type:"bigint"})}ConstructorParameters(g,E={}){return this.Tuple([...g.parameters],{...E})}Constructor(g,E,$){const[_,v]=[l.Rest(g),l.Type(E)];return this.Create({...$,[e.Kind]:"Constructor",type:"Constructor",parameters:_,returns:v})}Date(g={}){return this.Create({...g,[e.Kind]:"Date",type:"Date"})}Function(g,E,$){const[_,v]=[l.Rest(g),l.Type(E)];return this.Create({...$,[e.Kind]:"Function",type:"Function",parameters:_,returns:v})}InstanceType(g,E={}){return l.Type(g.returns,E)}Iterator(g,E={}){return this.Create({...E,[e.Kind]:"Iterator",type:"Iterator",items:l.Type(g)})}Parameters(g,E={}){return this.Tuple(g.parameters,{...E})}Promise(g,E={}){return this.Create({...E,[e.Kind]:"Promise",type:"Promise",item:l.Type(g)})}RegExp(g,E={}){const $=o.IsString(g)?g:g.source;return this.Create({...E,[e.Kind]:"String",type:"string",pattern:$})}RegEx(g,E={}){return this.RegExp(g,E)}ReturnType(g,E={}){return l.Type(g.returns,E)}Symbol(g){return this.Create({...g,[e.Kind]:"Symbol",type:"symbol"})}Undefined(g={}){return this.Create({...g,[e.Kind]:"Undefined",type:"undefined"})}Uint8Array(g={}){return this.Create({...g,[e.Kind]:"Uint8Array",type:"Uint8Array"})}Void(g={}){return this.Create({...g,[e.Kind]:"Void",type:"void"})}}e.JavaScriptTypeBuilder=nt,e.JsonType=new qe,e.Type=new nt})(p);const Sm=p.Type.Object({prefix:p.Type.Optional(p.Type.String()),suffix:p.Type.Optional(p.Type.String()),volume:p.Type.Optional(p.Type.Number())}),Bl=p.Type.Object({soundOnNewLine:p.Type.Optional(p.Type.String()),soundPerLetter:p.Type.Optional(Sm)}),wm=p.Type.Object({defaultAudio:p.Type.Optional(Bl),characterAudio:p.Type.Optional(p.Type.Record(p.Type.String(),Bl))}),km=p.Type.Object({src:p.Type.String(),path:p.Type.Optional(p.Type.String()),volume:p.Type.Optional(p.Type.Number()),rate:p.Type.Optional(p.Type.Number()),html5:p.Type.Optional(p.Type.Boolean()),fadeInTime:p.Type.Optional(p.Type.Number()),fadeInDelay:p.Type.Optional(p.Type.Number()),fadeOutTime:p.Type.Optional(p.Type.Number()),loop:p.Type.Optional(p.Type.Boolean())}),Cm=p.Type.Record(p.Type.String(),km),$m=p.Type.Object({volume:p.Type.Optional(p.Type.Number()),defaultMusic:p.Type.Optional(p.Type.String()),musicFadeInTime:p.Type.Optional(p.Type.Number()),musicFadeOutTime:p.Type.Optional(p.Type.Number()),musicFadeInDelay:p.Type.Optional(p.Type.Number())}),Em=p.Type.Record(p.Type.String(),p.Type.String()),Rl=p.Type.Object({files:Cm,audioTriggers:Em,options:$m,dialogAudio:p.Type.Optional(wm)}),Fl={files:{},audioTriggers:{},options:{volume:1,musicFadeInTime:.5,musicFadeInDelay:.5,musicFadeOutTime:.5}},Vl=p.Type.Object({backgrounds:p.Type.Object({width:p.Type.Number(),height:p.Type.Number()}),dialogBottomPadding:p.Type.Union([p.Type.Number(),p.Type.String()]),minTextWidth:p.Type.Optional(p.Type.Number()),verticalLayoutThreshold:p.Type.Number(),defaultFontSize:p.Type.Optional(p.Type.Number()),portraits:p.Type.Object({width:p.Type.Number(),height:p.Type.Number(),offset:p.Type.Optional(p.Type.Object({landscape:p.Type.Optional(p.Type.Object({right:p.Type.Number(),bottom:p.Type.Number()})),portrait:p.Type.Optional(p.Type.Object({right:p.Type.Number(),bottom:p.Type.Number()}))}))})}),Om={backgrounds:{width:880,height:720},dialogBottomPadding:70,verticalLayoutThreshold:600,defaultFontSize:16,portraits:{width:100,height:100}},Ro=p.Type.Object({name:p.Type.String(),description:p.Type.Optional(p.Type.String())}),Am=p.Type.Intersect([Ro,p.Type.Object({type:p.Type.Literal("number"),defaultValue:p.Type.Number(),step:p.Type.Number(),minValue:p.Type.Number(),maxValue:p.Type.Number()})]),Im=p.Type.Intersect([Ro,p.Type.Object({type:p.Type.Literal("integer"),defaultValue:p.Type.Number(),step:p.Type.Number(),minValue:p.Type.Number(),maxValue:p.Type.Number()})]),Nm=p.Type.Intersect([Ro,p.Type.Object({type:p.Type.Literal("boolean"),defaultValue:p.Type.Boolean()})]),Pm=p.Type.Intersect([Ro,p.Type.Object({type:p.Type.Literal("string"),defaultValue:p.Type.String()})]),jm=p.Type.Union([Am,Im,Nm,Pm]);function xm(e){return e.type==="number"}function Ul(e){return e.type==="integer"}function Dm(e){return e.type==="boolean"}function Lm(e){return e.type==="string"}const ql=p.Type.Object({customSettings:p.Type.Optional(p.Type.Record(p.Type.String(),jm))}),Fo="###_--_~=:;_JUMP",ns="###_--_~=:;_RETURN",Mm="###_--_~=:;_OK",Vo="###_--_~=:;_STOP";function Bm(e){return e===Fo||e===ns||e===Mm||e===Vo}const Rm="3.10.0",Fm=new Date("2024-04-10T20:14:33.729Z"),Vm=400,Uo=20,qo="@empty",Hl={background:qo},Um=p.Type.Optional(p.Type.Object({debugMenu:p.Type.Optional(p.Type.String()),jumpMenu:p.Type.Optional(p.Type.String())})),Kl=p.Type.Optional(p.Type.Object({animateText:p.Type.Optional(p.Type.Boolean()),textSpeed:p.Type.Optional(p.Type.Number()),timeBetweenLines:p.Type.Optional(p.Type.Number()),overlayMode:p.Type.Optional(p.Type.Boolean()),rightOffset:p.Type.Optional(p.Type.Number()),bottomOffset:p.Type.Optional(p.Type.Number()),width:p.Type.Optional(p.Type.Number()),height:p.Type.Optional(p.Type.Number()),hideDuringTransition:p.Type.Optional(p.Type.Boolean()),showAfterScriptEnd:p.Type.Optional(p.Type.Boolean())})),Gl=p.Type.Object({engineSplashScreen:p.Type.Optional(p.Type.Object({skip:p.Type.Optional(p.Type.Boolean()),fadeDuration:p.Type.Optional(p.Type.Number()),timeBeforeFadeout:p.Type.Optional(p.Type.Number()),overrideText:p.Type.Optional(p.Type.String()),overrideLogo:p.Type.Optional(p.Type.String())})),gameSplashScreen:p.Type.Optional(p.Type.Object({startButtonText:p.Type.Optional(p.Type.String())}))}),zl=p.Type.Object({timeOnScreen:p.Type.Number(),alsoPrintInDialogue:p.Type.Optional(p.Type.Boolean())}),qm=p.Type.Object({name:p.Type.String(),icon:p.Type.String(),startingValue:p.Type.Number(),maxValue:p.Type.Optional(p.Type.Number()),minValue:p.Type.Optional(p.Type.Number()),decimals:p.Type.Optional(p.Type.Number()),prefix:p.Type.Optional(p.Type.String()),suffix:p.Type.Optional(p.Type.String()),hideName:p.Type.Optional(p.Type.Boolean()),formatting:p.Type.Optional(p.Type.Object({style:p.Type.Union([p.Type.Literal("decimal"),p.Type.Literal("currency"),p.Type.Literal("percent"),p.Type.Literal("unit")]),currency:p.Type.Optional(p.Type.String()),unit:p.Type.Optional(p.Type.String())}))}),Wl=p.Type.Record(p.Type.String(),qm),Ql=p.Type.Record(p.Type.String(),p.Type.Object({onlyInteractOutsideOfScripts:p.Type.Optional(p.Type.Boolean())})),Hm=p.Type.Object({delay:p.Type.Optional(p.Type.Number()),duration:p.Type.Optional(p.Type.Number())}),Yl=p.Type.Record(p.Type.String(),Hm),Km=p.Type.Object({text:p.Type.String(),cssClass:p.Type.Optional(p.Type.String())}),Jl=p.Type.Record(p.Type.String(),Km),Xl=p.Type.Object({showScriptFinishedMessage:p.Type.Optional(p.Type.Boolean())}),Zl=p.Type.Object({mode:p.Type.String(),slots:p.Type.Number(),runOnReload:p.Type.Optional(p.Type.String()),disabled:p.Type.Optional(p.Type.Boolean())}),ec=p.Type.Array(p.Type.String()),Gm=[],tc=p.Type.Object({baseAssetsPath:p.Type.Optional(p.Type.String()),baseDataPath:p.Type.Optional(p.Type.String()),gameTitle:p.Type.String(),saveFileName:p.Type.String(),images:p.Type.Optional(p.Type.Record(p.Type.String(),p.Type.String())),layout:Vl,settings:p.Type.Optional(ql),gameFlow:p.Type.Optional(p.Type.Object({labelToJumpOnScriptEnd:p.Type.Optional(p.Type.String())})),dialogPanel:p.Type.Optional(Kl),splashScreens:p.Type.Optional(Gl),notifications:p.Type.Optional(zl),hudStats:Wl,interactionTags:p.Type.Optional(Ql),transitions:p.Type.Optional(Yl),menuButtons:p.Type.Optional(Jl),debugging:p.Type.Optional(Xl),saves:p.Type.Optional(Zl),hotkeys:Um}),rs={baseAssetsPath:"",baseDataPath:"",gameTitle:"Narrat Game",saveFileName:"narrat save",images:{},layout:Om,settings:{},gameFlow:{},dialogPanel:{overlayMode:!0,rightOffset:100,bottomOffset:50,width:475,height:680,textSpeed:Uo,animateText:!0,timeBetweenLines:100,hideDuringTransition:!1,showAfterScriptEnd:!1},splashScreens:{},notifications:{timeOnScreen:2.5,alsoPrintInDialogue:!1},hudStats:{},interactionTags:{default:{onlyInteractOutsideOfScripts:!0}},transitions:{},menuButtons:{},debugging:{showScriptFinishedMessage:!1},saves:{mode:"manual",slots:10},hotkeys:{}},zm=p.Type.Object({name:p.Type.String(),description:p.Type.String(),icon:p.Type.String(),onUse:p.Type.Optional(p.Type.Object({action:p.Type.String(),label:p.Type.String()})),tag:p.Type.Optional(p.Type.String()),category:p.Type.Optional(p.Type.String()),showIfEmpty:p.Type.Optional(p.Type.Boolean())}),nc=p.Type.Object({id:p.Type.String(),title:p.Type.String()}),rc=p.Type.Record(p.Type.String(),zm);p.Type.Object({categories:p.Type.Array(nc),items:rc});const oc=p.Type.Object({categories:p.Type.Optional(p.Type.Array(nc)),items:p.Type.Optional(rc)}),ic={categories:[{id:"default",title:"Items"}],items:{}},Wm=p.Type.Object({description:p.Type.String(),succeededDescription:p.Type.Optional(p.Type.String()),failedDescription:p.Type.Optional(p.Type.String()),hidden:p.Type.Optional(p.Type.Boolean())}),Qm=p.Type.Object({title:p.Type.String(),description:p.Type.String(),succeededDescription:p.Type.Optional(p.Type.String()),failedDescription:p.Type.Optional(p.Type.String()),endings:p.Type.Optional(p.Type.Record(p.Type.String(),p.Type.Object({success:p.Type.Boolean(),description:p.Type.String()}))),objectives:p.Type.Record(p.Type.String(),Wm),category:p.Type.Optional(p.Type.String())}),Ym=p.Type.Object({id:p.Type.String(),title:p.Type.String()}),Jm=p.Type.Record(p.Type.String(),Qm),sc=p.Type.Object({quests:Jm,categories:p.Type.Array(Ym)}),ac={quests:{},categories:[{id:"default",title:"Quests"}]},lc=p.Type.Object({enabled:p.Type.Boolean(),background:p.Type.Optional(p.Type.String()),text:p.Type.Optional(p.Type.String()),cssClass:p.Type.Optional(p.Type.String()),position:p.Type.Object({left:p.Type.Number(),top:p.Type.Number(),width:p.Type.Optional(p.Type.Number()),height:p.Type.Optional(p.Type.Number())}),anchor:p.Type.Optional(p.Type.Object({x:p.Type.Number(),y:p.Type.Number()})),action:p.Type.Optional(p.Type.String()),actionType:p.Type.Optional(p.Type.String()),scriptClickable:p.Type.Optional(p.Type.Boolean()),tag:p.Type.Optional(p.Type.String())}),Xm=p.Type.Record(p.Type.String(),lc),cc=p.Type.Object({buttons:Xm,clickableDuringScriptsByDefault:p.Type.Optional(p.Type.Boolean())}),uc={buttons:{},clickableDuringScriptsByDefault:!1},Zm=p.Type.Intersect([lc,p.Type.Object({id:p.Type.String()})]),eh=p.Type.Object({muted:p.Type.Optional(p.Type.Boolean()),loop:p.Type.Optional(p.Type.Boolean())}),th=p.Type.Object({background:p.Type.String(),video:p.Type.Optional(eh),buttons:p.Type.Optional(p.Type.Array(p.Type.Union([p.Type.String(),Zm])))}),dc=p.Type.Record(p.Type.String(),th);p.Type.Object({screens:dc});const fc=p.Type.Object({screens:p.Type.Optional(dc)}),pc={screens:{}},nh=p.Type.Object({name:p.Type.String(),description:p.Type.String(),startingLevel:p.Type.Number(),hidden:p.Type.Optional(p.Type.Boolean()),icon:p.Type.String()}),mc=p.Type.Record(p.Type.String(),nh),hc=p.Type.Object({xpPerLevel:p.Type.Number(),notifyLevelUp:p.Type.Boolean()});p.Type.Object({skills:mc,skillOptions:hc});const yc=p.Type.Object({skills:p.Type.Optional(mc),skillOptions:p.Type.Optional(hc)}),gc={skills:{},skillOptions:{xpPerLevel:10,notifyLevelUp:!0}},rh=p.Type.Object({portraitCssClass:p.Type.Optional(p.Type.String()),color:p.Type.Optional(p.Type.String()),boxCss:p.Type.Optional(p.Type.Record(p.Type.String(),p.Type.Any())),nameCss:p.Type.Optional(p.Type.Record(p.Type.String(),p.Type.Any())),textCss:p.Type.Optional(p.Type.Record(p.Type.String(),p.Type.Any()))}),oh=p.Type.Object({video:p.Type.String(),autoplay:p.Type.Optional(p.Type.Boolean()),loop:p.Type.Optional(p.Type.Boolean()),muted:p.Type.Optional(p.Type.Boolean()),width:p.Type.Optional(p.Type.Number()),height:p.Type.Optional(p.Type.Number())}),ih=p.Type.Object({image:p.Type.String(),width:p.Type.Optional(p.Type.Number()),height:p.Type.Optional(p.Type.Number())}),sh=p.Type.Union([p.Type.String(),oh,ih]),ah=p.Type.Object({sprites:p.Type.Optional(p.Type.Record(p.Type.String(),sh)),name:p.Type.String(),style:p.Type.Optional(rh)}),_c=p.Type.Object({config:p.Type.Object({imagesPath:p.Type.String(),playerCharacter:p.Type.Optional(p.Type.String()),gameCharacter:p.Type.Optional(p.Type.String())}),characters:p.Type.Record(p.Type.String(),ah)}),bc={config:{imagesPath:"",playerCharacter:"player",gameCharacter:"game"},characters:{}},Tc=p.Type.Object({cssClass:p.Type.Optional(p.Type.String()),textCssClass:p.Type.Optional(p.Type.String()),titleCssClass:p.Type.Optional(p.Type.String())}),vc=p.Type.Object({options:p.Type.Object({delay:p.Type.Optional(p.Type.Number()),width:p.Type.Number(),keywordsPrefix:p.Type.String(),screenEdgesMinimumMargin:p.Type.Optional(p.Type.Number()),styling:p.Type.Optional(Tc)}),tooltips:p.Type.Array(p.Type.Object({keywords:p.Type.Array(p.Type.String()),title:p.Type.String(),description:p.Type.String(),styling:p.Type.Optional(Tc)}))}),Sc={options:{delay:0,width:350,keywordsPrefix:"@@"},tooltips:[]},lh=p.Type.Object({name:p.Type.String(),description:p.Type.String(),icon:p.Type.Optional(p.Type.String()),lockedIcon:p.Type.Optional(p.Type.String()),secret:p.Type.Optional(p.Type.Boolean()),category:p.Type.Optional(p.Type.String())}),wc=p.Type.Object({id:p.Type.String(),title:p.Type.String()}),kc=p.Type.Record(p.Type.String(),lh);p.Type.Object({defaultAchievementIcon:p.Type.String(),categories:p.Type.Array(wc),achievements:kc,notifyNewAchievements:p.Type.Boolean(),secretAchievements:p.Type.Optional(p.Type.Object({censorDescription:p.Type.Optional(p.Type.Boolean()),censorName:p.Type.Optional(p.Type.Boolean()),hideUntilObtained:p.Type.Optional(p.Type.Boolean())}))});const Cc=p.Type.Object({categories:p.Type.Optional(p.Type.Array(wc)),achievements:p.Type.Optional(kc)}),$c={categories:[{id:"default",title:"Achievements"}],achievements:{},notifyNewAchievements:!0,defaultAchievementIcon:"img/achievements/trophy.png"},ch=p.Type.Object({diceRange:p.Type.Tuple([p.Type.Number(),p.Type.Number()]),diceCount:p.Type.Number(),difficultyText:p.Type.Array(p.Type.Tuple([p.Type.Number(),p.Type.String()])),extraPointsPerLevel:p.Type.Number(),extraDicePerLevel:p.Type.Optional(p.Type.Number()),successOnRollsBelowThreshold:p.Type.Boolean(),showDifficultyText:p.Type.Boolean(),showDifficultyNumber:p.Type.Boolean(),showDifficultyWithoutModifiers:p.Type.Boolean(),finalRollIsHighest:p.Type.Optional(p.Type.Boolean()),finalRollIsLowest:p.Type.Optional(p.Type.Boolean()),failOnRollsEqualToThreshold:p.Type.Optional(p.Type.Boolean())}),uh=p.Type.Object({skill:p.Type.String(),difficulty:p.Type.Number(),winsNeeded:p.Type.Optional(p.Type.Number()),hideAfterRoll:p.Type.Optional(p.Type.Boolean()),repeatable:p.Type.Optional(p.Type.Boolean())}),Ec=p.Type.Object({options:ch,skillChecks:p.Type.Record(p.Type.String(),uh)}),Oc={options:{diceRange:[1,6],extraPointsPerLevel:1,extraDicePerLevel:0,diceCount:2,successOnRollsBelowThreshold:!1,showDifficultyText:!0,showDifficultyNumber:!1,showDifficultyWithoutModifiers:!1,finalRollIsHighest:!1,finalRollIsLowest:!1,difficultyText:[[2,"Very Easy"],[4,"Easy"],[6,"Medium"],[8,"Hard"],[10,"Very Hard"],[11,"Extremely Hard"],[12,"Near Impossible"]]},skillChecks:{}},dh=p.Type.Object({cssClass:p.Type.Optional(p.Type.String()),textTemplate:p.Type.Optional(p.Type.String())}),Ac=p.Type.Record(p.Type.String(),dh);p.Type.Object({choiceTextTemplate:p.Type.String(),choicePrompts:Ac});const Ic=p.Type.Object({choiceTextTemplate:p.Type.Optional(p.Type.String()),choicePrompts:p.Type.Optional(Ac)}),Nc={choicePrompts:{},choiceTextTemplate:'<span class="choice-index">%{$index}. </span> <span class="choice-text">%{$choice}</span>'},Pc=p.Type.Object({delay:p.Type.Optional(p.Type.Number()),direction:p.Type.Optional(p.Type.String()),duration:p.Type.Optional(p.Type.Number()),easing:p.Type.Optional(p.Type.String()),endDelay:p.Type.Optional(p.Type.Number()),fill:p.Type.Optional(p.Type.String()),iterationStart:p.Type.Optional(p.Type.Number()),iterations:p.Type.Optional(p.Type.Number()),keyframes:p.Type.Optional(p.Type.Any())}),os=p.Type.Array(p.Type.Any()),fh=p.Type.Object({keyframes:p.Type.Union([p.Type.String(),os]),options:p.Type.Optional(Pc)});p.Type.Object({keyframes:os,options:p.Type.Optional(Pc)});const jc=p.Type.Object({animations:p.Type.Record(p.Type.String(),fh),keyframes:p.Type.Record(p.Type.String(),os)}),xc={animations:{},keyframes:{}},ph=p.Type.Object({name:p.Type.String(),type:p.Type.String(),optional:p.Type.Optional(p.Type.Boolean())}),mh=p.Type.Object({keyword:p.Type.String(),label:p.Type.String(),options:p.Type.Optional(p.Type.Array(ph))}),Dc=p.Type.Object({macros:p.Type.Array(mh)}),Lc={macros:[]},is=p.Type.Object({assets:p.Type.Record(p.Type.String(),p.Type.String())}),Mc=p.Type.Object({images:p.Type.Optional(is),audio:p.Type.Optional(is),video:p.Type.Optional(is)}),Bc={images:{assets:{}},audio:{assets:{}},video:{assets:{}}},Tr={common:rs,screens:pc,buttons:uc,skills:gc,skillChecks:Oc,scripts:[],audio:Fl,tooltips:Sc,achievements:$c,items:ic,quests:ac,characters:bc,choices:Nc,animations:xc,macros:Lc,preload:Bc};var hh=function(t){return yh(t)&&!gh(t)};function yh(e){return!!e&&typeof e=="object"}function gh(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||Th(e)}var _h=typeof Symbol=="function"&&Symbol.for,bh=_h?Symbol.for("react.element"):60103;function Th(e){return e.$$typeof===bh}function vh(e){return Array.isArray(e)?[]:{}}function Xr(e,t){return t.clone!==!1&&t.isMergeableObject(e)?vr(vh(e),e,t):e}function Sh(e,t,n){return e.concat(t).map(function(r){return Xr(r,n)})}function wh(e,t){if(!t.customMerge)return vr;var n=t.customMerge(e);return typeof n=="function"?n:vr}function kh(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function Rc(e){return Object.keys(e).concat(kh(e))}function Fc(e,t){try{return t in e}catch{return!1}}function Ch(e,t){return Fc(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function $h(e,t,n){var r={};return n.isMergeableObject(e)&&Rc(e).forEach(function(o){r[o]=Xr(e[o],n)}),Rc(t).forEach(function(o){Ch(e,o)||(Fc(e,o)&&n.isMergeableObject(t[o])?r[o]=wh(o,n)(e[o],t[o],n):r[o]=Xr(t[o],n))}),r}function vr(e,t,n){n=n||{},n.arrayMerge=n.arrayMerge||Sh,n.isMergeableObject=n.isMergeableObject||hh,n.cloneUnlessOtherwiseSpecified=Xr;var r=Array.isArray(t),o=Array.isArray(e),a=r===o;return a?r?n.arrayMerge(e,t,n):$h(e,t,n):Xr(t,n)}vr.all=function(t,n){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(r,o){return vr(r,o,n)},{})};var Eh=vr,Oh=Eh;const Jn=Vi(Oh),st=et("config",{state:()=>({config:Tr,configModules:{}}),actions:{async setConfig(e){this.config=e},extendConfig(e){this.config=Jn(this.config,e)},generateSaveData(){return{playerCharacter:this.playerCharacter,gameCharacter:this.gameCharacter}},addConfigModule(e,t){this.configModules[e]=t},findConfigModuleKey(e){const t=Object.keys(this.configModules).find(n=>this.configModules[n].id===e.id);if(t)return t},reloadConfigModule(e,t){this.configModules[e].code=t,this.config[e]=t},loadSaveData(e){this.config.characters.config.playerCharacter=e.playerCharacter,this.config.characters.config.gameCharacter=e.gameCharacter}},getters:{playerCharacter(){return this.config.characters.config.playerCharacter??"player"},gameCharacter(){return this.config.characters.config.gameCharacter??"game"}}});function Vc(e){const t=Xe(),n=t.getSkillCheck(e.id);if(n&&n.happened&&(n.succeeded||!e.repeatable))return n;const r=vm(e);return Hc(gm(r,e)),r?t.passSkillCheck(e.id,e.hideAfterRoll):t.failSkillCheck(e.id,e.hideAfterRoll),t.getSkillCheck(e.id)}function Ah(e,t=[]){const n=e.options,r=e.staticOptions,o=!!n.condition;if(o)return r.success;if(!o){for(const[a,s]of r.elseifs.entries())if(t[a]===!0)return s.branch}if(!o&&r.failure)return r.failure}function Uc(e){return typeof e=="object"}function qc(e){return typeof e=="string"&&e.search(/\$/)===0}function Hc(e){const t={speaker:st().gameCharacter,text:e,interactive:!1};Fe().addDialog(t)}async function Ho(e){Fe().addDialog(e)}function Ih(e,t){if(t<e.length)return e[t]}/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */function Kc(e){return typeof e>"u"||e===null}function Nh(e){return typeof e=="object"&&e!==null}function Ph(e){return Array.isArray(e)?e:Kc(e)?[]:[e]}function jh(e,t){var n,r,o,a;if(t)for(a=Object.keys(t),n=0,r=a.length;n<r;n+=1)o=a[n],e[o]=t[o];return e}function xh(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}function Dh(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var Lh=Kc,Mh=Nh,Bh=Ph,Rh=xh,Fh=Dh,Vh=jh,ct={isNothing:Lh,isObject:Mh,toArray:Bh,repeat:Rh,isNegativeZero:Fh,extend:Vh};function Gc(e,t){var n="",r=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+=`
39
39
 
40
- `+e.mark.snippet),r+" "+n):r}function Xr(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=Hc(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Xr.prototype=Object.create(Error.prototype),Xr.prototype.constructor=Xr,Xr.prototype.toString=function(t){return this.name+": "+Hc(this,t)};var kt=Xr;function is(e,t,n,r,o){var a="",s="",c=Math.floor(o/2)-1;return r-t>c&&(a=" ... ",t=r-c+a.length),n-r>c&&(s=" ...",n=r+c-s.length),{str:a+e.slice(t,n).replace(/\t/g,"→")+s,pos:r-t+a.length}}function ss(e,t){return ct.repeat(" ",t-e.length)+e}function Bh(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var n=/\r?\n|\r|\0/g,r=[0],o=[],a,s=-1;a=n.exec(e.buffer);)o.push(a.index),r.push(a.index+a[0].length),e.position<=a.index&&s<0&&(s=r.length-2);s<0&&(s=r.length-1);var c="",d,u,h=Math.min(e.line+t.linesAfter,o.length).toString().length,l=t.maxLength-(t.indent+h+3);for(d=1;d<=t.linesBefore&&!(s-d<0);d++)u=is(e.buffer,r[s-d],o[s-d],e.position-(r[s]-r[s-d]),l),c=ct.repeat(" ",t.indent)+ss((e.line-d+1).toString(),h)+" | "+u.str+`
41
- `+c;for(u=is(e.buffer,r[s],o[s],e.position,l),c+=ct.repeat(" ",t.indent)+ss((e.line+1).toString(),h)+" | "+u.str+`
40
+ `+e.mark.snippet),r+" "+n):r}function Zr(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=Gc(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Zr.prototype=Object.create(Error.prototype),Zr.prototype.constructor=Zr,Zr.prototype.toString=function(t){return this.name+": "+Gc(this,t)};var Ct=Zr;function ss(e,t,n,r,o){var a="",s="",c=Math.floor(o/2)-1;return r-t>c&&(a=" ... ",t=r-c+a.length),n-r>c&&(s=" ...",n=r+c-s.length),{str:a+e.slice(t,n).replace(/\t/g,"→")+s,pos:r-t+a.length}}function as(e,t){return ct.repeat(" ",t-e.length)+e}function Uh(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var n=/\r?\n|\r|\0/g,r=[0],o=[],a,s=-1;a=n.exec(e.buffer);)o.push(a.index),r.push(a.index+a[0].length),e.position<=a.index&&s<0&&(s=r.length-2);s<0&&(s=r.length-1);var c="",d,u,h=Math.min(e.line+t.linesAfter,o.length).toString().length,l=t.maxLength-(t.indent+h+3);for(d=1;d<=t.linesBefore&&!(s-d<0);d++)u=ss(e.buffer,r[s-d],o[s-d],e.position-(r[s]-r[s-d]),l),c=ct.repeat(" ",t.indent)+as((e.line-d+1).toString(),h)+" | "+u.str+`
41
+ `+c;for(u=ss(e.buffer,r[s],o[s],e.position,l),c+=ct.repeat(" ",t.indent)+as((e.line+1).toString(),h)+" | "+u.str+`
42
42
  `,c+=ct.repeat("-",t.indent+h+3+u.pos)+`^
43
- `,d=1;d<=t.linesAfter&&!(s+d>=o.length);d++)u=is(e.buffer,r[s+d],o[s+d],e.position-(r[s]-r[s+d]),l),c+=ct.repeat(" ",t.indent)+ss((e.line+d+1).toString(),h)+" | "+u.str+`
44
- `;return c.replace(/\n$/,"")}var Fh=Bh,Vh=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Uh=["scalar","sequence","mapping"];function qh(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(r){t[String(r)]=n})}),t}function Hh(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(Vh.indexOf(n)===-1)throw new kt('Unknown option "'+n+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(n){return n},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=qh(t.styleAliases||null),Uh.indexOf(this.kind)===-1)throw new kt('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var pt=Hh;function Kc(e,t){var n=[];return e[t].forEach(function(r){var o=n.length;n.forEach(function(a,s){a.tag===r.tag&&a.kind===r.kind&&a.multi===r.multi&&(o=s)}),n[o]=r}),n}function Kh(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,n;function r(o){o.multi?(e.multi[o.kind].push(o),e.multi.fallback.push(o)):e[o.kind][o.tag]=e.fallback[o.tag]=o}for(t=0,n=arguments.length;t<n;t+=1)arguments[t].forEach(r);return e}function as(e){return this.extend(e)}as.prototype.extend=function(t){var n=[],r=[];if(t instanceof pt)r.push(t);else if(Array.isArray(t))r=r.concat(t);else if(t&&(Array.isArray(t.implicit)||Array.isArray(t.explicit)))t.implicit&&(n=n.concat(t.implicit)),t.explicit&&(r=r.concat(t.explicit));else throw new kt("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(a){if(!(a instanceof pt))throw new kt("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(a.loadKind&&a.loadKind!=="scalar")throw new kt("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(a.multi)throw new kt("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),r.forEach(function(a){if(!(a instanceof pt))throw new kt("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var o=Object.create(as.prototype);return o.implicit=(this.implicit||[]).concat(n),o.explicit=(this.explicit||[]).concat(r),o.compiledImplicit=Kc(o,"implicit"),o.compiledExplicit=Kc(o,"explicit"),o.compiledTypeMap=Kh(o.compiledImplicit,o.compiledExplicit),o};var Gc=as,zc=new pt("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),Wc=new pt("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),Qc=new pt("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),Yc=new Gc({explicit:[zc,Wc,Qc]});function Gh(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function zh(){return null}function Wh(e){return e===null}var Jc=new pt("tag:yaml.org,2002:null",{kind:"scalar",resolve:Gh,construct:zh,predicate:Wh,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function Qh(e){if(e===null)return!1;var t=e.length;return t===4&&(e==="true"||e==="True"||e==="TRUE")||t===5&&(e==="false"||e==="False"||e==="FALSE")}function Yh(e){return e==="true"||e==="True"||e==="TRUE"}function Jh(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var Xc=new pt("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Qh,construct:Yh,predicate:Jh,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function Xh(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function Zh(e){return 48<=e&&e<=55}function ey(e){return 48<=e&&e<=57}function ty(e){if(e===null)return!1;var t=e.length,n=0,r=!1,o;if(!t)return!1;if(o=e[n],(o==="-"||o==="+")&&(o=e[++n]),o==="0"){if(n+1===t)return!0;if(o=e[++n],o==="b"){for(n++;n<t;n++)if(o=e[n],o!=="_"){if(o!=="0"&&o!=="1")return!1;r=!0}return r&&o!=="_"}if(o==="x"){for(n++;n<t;n++)if(o=e[n],o!=="_"){if(!Xh(e.charCodeAt(n)))return!1;r=!0}return r&&o!=="_"}if(o==="o"){for(n++;n<t;n++)if(o=e[n],o!=="_"){if(!Zh(e.charCodeAt(n)))return!1;r=!0}return r&&o!=="_"}}if(o==="_")return!1;for(;n<t;n++)if(o=e[n],o!=="_"){if(!ey(e.charCodeAt(n)))return!1;r=!0}return!(!r||o==="_")}function ny(e){var t=e,n=1,r;if(t.indexOf("_")!==-1&&(t=t.replace(/_/g,"")),r=t[0],(r==="-"||r==="+")&&(r==="-"&&(n=-1),t=t.slice(1),r=t[0]),t==="0")return 0;if(r==="0"){if(t[1]==="b")return n*parseInt(t.slice(2),2);if(t[1]==="x")return n*parseInt(t.slice(2),16);if(t[1]==="o")return n*parseInt(t.slice(2),8)}return n*parseInt(t,10)}function ry(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!ct.isNegativeZero(e)}var Zc=new pt("tag:yaml.org,2002:int",{kind:"scalar",resolve:ty,construct:ny,predicate:ry,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),oy=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function iy(e){return!(e===null||!oy.test(e)||e[e.length-1]==="_")}function sy(e){var t,n;return t=e.replace(/_/g,"").toLowerCase(),n=t[0]==="-"?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),t===".inf"?n===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t===".nan"?NaN:n*parseFloat(t,10)}var ay=/^[-+]?[0-9]+e/;function ly(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(ct.isNegativeZero(e))return"-0.0";return n=e.toString(10),ay.test(n)?n.replace("e",".e"):n}function cy(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||ct.isNegativeZero(e))}var eu=new pt("tag:yaml.org,2002:float",{kind:"scalar",resolve:iy,construct:sy,predicate:cy,represent:ly,defaultStyle:"lowercase"}),tu=Yc.extend({implicit:[Jc,Xc,Zc,eu]}),nu=tu,ru=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),ou=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function uy(e){return e===null?!1:ru.exec(e)!==null||ou.exec(e)!==null}function dy(e){var t,n,r,o,a,s,c,d=0,u=null,h,l,f;if(t=ru.exec(e),t===null&&(t=ou.exec(e)),t===null)throw new Error("Date resolve error");if(n=+t[1],r=+t[2]-1,o=+t[3],!t[4])return new Date(Date.UTC(n,r,o));if(a=+t[4],s=+t[5],c=+t[6],t[7]){for(d=t[7].slice(0,3);d.length<3;)d+="0";d=+d}return t[9]&&(h=+t[10],l=+(t[11]||0),u=(h*60+l)*6e4,t[9]==="-"&&(u=-u)),f=new Date(Date.UTC(n,r,o,a,s,c,d)),u&&f.setTime(f.getTime()-u),f}function fy(e){return e.toISOString()}var iu=new pt("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:uy,construct:dy,instanceOf:Date,represent:fy});function py(e){return e==="<<"||e===null}var su=new pt("tag:yaml.org,2002:merge",{kind:"scalar",resolve:py}),ls=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
45
- \r`;function my(e){if(e===null)return!1;var t,n,r=0,o=e.length,a=ls;for(n=0;n<o;n++)if(t=a.indexOf(e.charAt(n)),!(t>64)){if(t<0)return!1;r+=6}return r%8===0}function hy(e){var t,n,r=e.replace(/[\r\n=]/g,""),o=r.length,a=ls,s=0,c=[];for(t=0;t<o;t++)t%4===0&&t&&(c.push(s>>16&255),c.push(s>>8&255),c.push(s&255)),s=s<<6|a.indexOf(r.charAt(t));return n=o%4*6,n===0?(c.push(s>>16&255),c.push(s>>8&255),c.push(s&255)):n===18?(c.push(s>>10&255),c.push(s>>2&255)):n===12&&c.push(s>>4&255),new Uint8Array(c)}function yy(e){var t="",n=0,r,o,a=e.length,s=ls;for(r=0;r<a;r++)r%3===0&&r&&(t+=s[n>>18&63],t+=s[n>>12&63],t+=s[n>>6&63],t+=s[n&63]),n=(n<<8)+e[r];return o=a%3,o===0?(t+=s[n>>18&63],t+=s[n>>12&63],t+=s[n>>6&63],t+=s[n&63]):o===2?(t+=s[n>>10&63],t+=s[n>>4&63],t+=s[n<<2&63],t+=s[64]):o===1&&(t+=s[n>>2&63],t+=s[n<<4&63],t+=s[64],t+=s[64]),t}function gy(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var au=new pt("tag:yaml.org,2002:binary",{kind:"scalar",resolve:my,construct:hy,predicate:gy,represent:yy}),_y=Object.prototype.hasOwnProperty,by=Object.prototype.toString;function Ty(e){if(e===null)return!0;var t=[],n,r,o,a,s,c=e;for(n=0,r=c.length;n<r;n+=1){if(o=c[n],s=!1,by.call(o)!=="[object Object]")return!1;for(a in o)if(_y.call(o,a))if(!s)s=!0;else return!1;if(!s)return!1;if(t.indexOf(a)===-1)t.push(a);else return!1}return!0}function vy(e){return e!==null?e:[]}var lu=new pt("tag:yaml.org,2002:omap",{kind:"sequence",resolve:Ty,construct:vy}),Sy=Object.prototype.toString;function wy(e){if(e===null)return!0;var t,n,r,o,a,s=e;for(a=new Array(s.length),t=0,n=s.length;t<n;t+=1){if(r=s[t],Sy.call(r)!=="[object Object]"||(o=Object.keys(r),o.length!==1))return!1;a[t]=[o[0],r[o[0]]]}return!0}function ky(e){if(e===null)return[];var t,n,r,o,a,s=e;for(a=new Array(s.length),t=0,n=s.length;t<n;t+=1)r=s[t],o=Object.keys(r),a[t]=[o[0],r[o[0]]];return a}var cu=new pt("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:wy,construct:ky}),Cy=Object.prototype.hasOwnProperty;function $y(e){if(e===null)return!0;var t,n=e;for(t in n)if(Cy.call(n,t)&&n[t]!==null)return!1;return!0}function Ey(e){return e!==null?e:{}}var uu=new pt("tag:yaml.org,2002:set",{kind:"mapping",resolve:$y,construct:Ey}),cs=nu.extend({implicit:[iu,su],explicit:[au,lu,cu,uu]}),jn=Object.prototype.hasOwnProperty,qo=1,du=2,fu=3,Ho=4,us=1,Oy=2,pu=3,Ay=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Iy=/[\x85\u2028\u2029]/,Ny=/[,\[\]\{\}]/,mu=/^(?:!|!!|![a-z\-]+!)$/i,hu=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function yu(e){return Object.prototype.toString.call(e)}function on(e){return e===10||e===13}function Jn(e){return e===9||e===32}function It(e){return e===9||e===32||e===10||e===13}function vr(e){return e===44||e===91||e===93||e===123||e===125}function Py(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function jy(e){return e===120?2:e===117?4:e===85?8:0}function Dy(e){return 48<=e&&e<=57?e-48:-1}function gu(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
46
- `:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"…":e===95?" ":e===76?"\u2028":e===80?"\u2029":""}function xy(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}for(var _u=new Array(256),bu=new Array(256),Sr=0;Sr<256;Sr++)_u[Sr]=gu(Sr)?1:0,bu[Sr]=gu(Sr);function Ly(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||cs,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function Tu(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=Fh(n),new kt(t,n)}function ge(e,t){throw Tu(e,t)}function Ko(e,t){e.onWarning&&e.onWarning.call(null,Tu(e,t))}var vu={YAML:function(t,n,r){var o,a,s;t.version!==null&&ge(t,"duplication of %YAML directive"),r.length!==1&&ge(t,"YAML directive accepts exactly one argument"),o=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),o===null&&ge(t,"ill-formed argument of the YAML directive"),a=parseInt(o[1],10),s=parseInt(o[2],10),a!==1&&ge(t,"unacceptable YAML version of the document"),t.version=r[0],t.checkLineBreaks=s<2,s!==1&&s!==2&&Ko(t,"unsupported YAML version of the document")},TAG:function(t,n,r){var o,a;r.length!==2&&ge(t,"TAG directive accepts exactly two arguments"),o=r[0],a=r[1],mu.test(o)||ge(t,"ill-formed tag handle (first argument) of the TAG directive"),jn.call(t.tagMap,o)&&ge(t,'there is a previously declared suffix for "'+o+'" tag handle'),hu.test(a)||ge(t,"ill-formed tag prefix (second argument) of the TAG directive");try{a=decodeURIComponent(a)}catch{ge(t,"tag prefix is malformed: "+a)}t.tagMap[o]=a}};function Dn(e,t,n,r){var o,a,s,c;if(t<n){if(c=e.input.slice(t,n),r)for(o=0,a=c.length;o<a;o+=1)s=c.charCodeAt(o),s===9||32<=s&&s<=1114111||ge(e,"expected valid JSON character");else Ay.test(c)&&ge(e,"the stream contains non-printable characters");e.result+=c}}function Su(e,t,n,r){var o,a,s,c;for(ct.isObject(n)||ge(e,"cannot merge mappings; the provided source object is unacceptable"),o=Object.keys(n),s=0,c=o.length;s<c;s+=1)a=o[s],jn.call(t,a)||(t[a]=n[a],r[a]=!0)}function wr(e,t,n,r,o,a,s,c,d){var u,h;if(Array.isArray(o))for(o=Array.prototype.slice.call(o),u=0,h=o.length;u<h;u+=1)Array.isArray(o[u])&&ge(e,"nested arrays are not supported inside keys"),typeof o=="object"&&yu(o[u])==="[object Object]"&&(o[u]="[object Object]");if(typeof o=="object"&&yu(o)==="[object Object]"&&(o="[object Object]"),o=String(o),t===null&&(t={}),r==="tag:yaml.org,2002:merge")if(Array.isArray(a))for(u=0,h=a.length;u<h;u+=1)Su(e,t,a[u],n);else Su(e,t,a,n);else!e.json&&!jn.call(n,o)&&jn.call(t,o)&&(e.line=s||e.line,e.lineStart=c||e.lineStart,e.position=d||e.position,ge(e,"duplicated mapping key")),o==="__proto__"?Object.defineProperty(t,o,{configurable:!0,enumerable:!0,writable:!0,value:a}):t[o]=a,delete n[o];return t}function ds(e){var t;t=e.input.charCodeAt(e.position),t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):ge(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function st(e,t,n){for(var r=0,o=e.input.charCodeAt(e.position);o!==0;){for(;Jn(o);)o===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),o=e.input.charCodeAt(++e.position);if(t&&o===35)do o=e.input.charCodeAt(++e.position);while(o!==10&&o!==13&&o!==0);if(on(o))for(ds(e),o=e.input.charCodeAt(e.position),r++,e.lineIndent=0;o===32;)e.lineIndent++,o=e.input.charCodeAt(++e.position);else break}return n!==-1&&r!==0&&e.lineIndent<n&&Ko(e,"deficient indentation"),r}function Go(e){var t=e.position,n;return n=e.input.charCodeAt(t),!!((n===45||n===46)&&n===e.input.charCodeAt(t+1)&&n===e.input.charCodeAt(t+2)&&(t+=3,n=e.input.charCodeAt(t),n===0||It(n)))}function fs(e,t){t===1?e.result+=" ":t>1&&(e.result+=ct.repeat(`
47
- `,t-1))}function My(e,t,n){var r,o,a,s,c,d,u,h,l=e.kind,f=e.result,m;if(m=e.input.charCodeAt(e.position),It(m)||vr(m)||m===35||m===38||m===42||m===33||m===124||m===62||m===39||m===34||m===37||m===64||m===96||(m===63||m===45)&&(o=e.input.charCodeAt(e.position+1),It(o)||n&&vr(o)))return!1;for(e.kind="scalar",e.result="",a=s=e.position,c=!1;m!==0;){if(m===58){if(o=e.input.charCodeAt(e.position+1),It(o)||n&&vr(o))break}else if(m===35){if(r=e.input.charCodeAt(e.position-1),It(r))break}else{if(e.position===e.lineStart&&Go(e)||n&&vr(m))break;if(on(m))if(d=e.line,u=e.lineStart,h=e.lineIndent,st(e,!1,-1),e.lineIndent>=t){c=!0,m=e.input.charCodeAt(e.position);continue}else{e.position=s,e.line=d,e.lineStart=u,e.lineIndent=h;break}}c&&(Dn(e,a,s,!1),fs(e,e.line-d),a=s=e.position,c=!1),Jn(m)||(s=e.position+1),m=e.input.charCodeAt(++e.position)}return Dn(e,a,s,!1),e.result?!0:(e.kind=l,e.result=f,!1)}function Ry(e,t){var n,r,o;if(n=e.input.charCodeAt(e.position),n!==39)return!1;for(e.kind="scalar",e.result="",e.position++,r=o=e.position;(n=e.input.charCodeAt(e.position))!==0;)if(n===39)if(Dn(e,r,e.position,!0),n=e.input.charCodeAt(++e.position),n===39)r=e.position,e.position++,o=e.position;else return!0;else on(n)?(Dn(e,r,o,!0),fs(e,st(e,!1,t)),r=o=e.position):e.position===e.lineStart&&Go(e)?ge(e,"unexpected end of the document within a single quoted scalar"):(e.position++,o=e.position);ge(e,"unexpected end of the stream within a single quoted scalar")}function By(e,t){var n,r,o,a,s,c;if(c=e.input.charCodeAt(e.position),c!==34)return!1;for(e.kind="scalar",e.result="",e.position++,n=r=e.position;(c=e.input.charCodeAt(e.position))!==0;){if(c===34)return Dn(e,n,e.position,!0),e.position++,!0;if(c===92){if(Dn(e,n,e.position,!0),c=e.input.charCodeAt(++e.position),on(c))st(e,!1,t);else if(c<256&&_u[c])e.result+=bu[c],e.position++;else if((s=jy(c))>0){for(o=s,a=0;o>0;o--)c=e.input.charCodeAt(++e.position),(s=Py(c))>=0?a=(a<<4)+s:ge(e,"expected hexadecimal character");e.result+=xy(a),e.position++}else ge(e,"unknown escape sequence");n=r=e.position}else on(c)?(Dn(e,n,r,!0),fs(e,st(e,!1,t)),n=r=e.position):e.position===e.lineStart&&Go(e)?ge(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}ge(e,"unexpected end of the stream within a double quoted scalar")}function Fy(e,t){var n=!0,r,o,a,s=e.tag,c,d=e.anchor,u,h,l,f,m,y=Object.create(null),b,S,T,I;if(I=e.input.charCodeAt(e.position),I===91)h=93,m=!1,c=[];else if(I===123)h=125,m=!0,c={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=c),I=e.input.charCodeAt(++e.position);I!==0;){if(st(e,!0,t),I=e.input.charCodeAt(e.position),I===h)return e.position++,e.tag=s,e.anchor=d,e.kind=m?"mapping":"sequence",e.result=c,!0;n?I===44&&ge(e,"expected the node content, but found ','"):ge(e,"missed comma between flow collection entries"),S=b=T=null,l=f=!1,I===63&&(u=e.input.charCodeAt(e.position+1),It(u)&&(l=f=!0,e.position++,st(e,!0,t))),r=e.line,o=e.lineStart,a=e.position,kr(e,t,qo,!1,!0),S=e.tag,b=e.result,st(e,!0,t),I=e.input.charCodeAt(e.position),(f||e.line===r)&&I===58&&(l=!0,I=e.input.charCodeAt(++e.position),st(e,!0,t),kr(e,t,qo,!1,!0),T=e.result),m?wr(e,c,y,S,b,T,r,o,a):l?c.push(wr(e,null,y,S,b,T,r,o,a)):c.push(b),st(e,!0,t),I=e.input.charCodeAt(e.position),I===44?(n=!0,I=e.input.charCodeAt(++e.position)):n=!1}ge(e,"unexpected end of the stream within a flow collection")}function Vy(e,t){var n,r,o=us,a=!1,s=!1,c=t,d=0,u=!1,h,l;if(l=e.input.charCodeAt(e.position),l===124)r=!1;else if(l===62)r=!0;else return!1;for(e.kind="scalar",e.result="";l!==0;)if(l=e.input.charCodeAt(++e.position),l===43||l===45)us===o?o=l===43?pu:Oy:ge(e,"repeat of a chomping mode identifier");else if((h=Dy(l))>=0)h===0?ge(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?ge(e,"repeat of an indentation width identifier"):(c=t+h-1,s=!0);else break;if(Jn(l)){do l=e.input.charCodeAt(++e.position);while(Jn(l));if(l===35)do l=e.input.charCodeAt(++e.position);while(!on(l)&&l!==0)}for(;l!==0;){for(ds(e),e.lineIndent=0,l=e.input.charCodeAt(e.position);(!s||e.lineIndent<c)&&l===32;)e.lineIndent++,l=e.input.charCodeAt(++e.position);if(!s&&e.lineIndent>c&&(c=e.lineIndent),on(l)){d++;continue}if(e.lineIndent<c){o===pu?e.result+=ct.repeat(`
48
- `,a?1+d:d):o===us&&a&&(e.result+=`
49
- `);break}for(r?Jn(l)?(u=!0,e.result+=ct.repeat(`
43
+ `,d=1;d<=t.linesAfter&&!(s+d>=o.length);d++)u=ss(e.buffer,r[s+d],o[s+d],e.position-(r[s]-r[s+d]),l),c+=ct.repeat(" ",t.indent)+as((e.line+d+1).toString(),h)+" | "+u.str+`
44
+ `;return c.replace(/\n$/,"")}var qh=Uh,Hh=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Kh=["scalar","sequence","mapping"];function Gh(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(r){t[String(r)]=n})}),t}function zh(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(Hh.indexOf(n)===-1)throw new Ct('Unknown option "'+n+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(n){return n},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=Gh(t.styleAliases||null),Kh.indexOf(this.kind)===-1)throw new Ct('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var pt=zh;function zc(e,t){var n=[];return e[t].forEach(function(r){var o=n.length;n.forEach(function(a,s){a.tag===r.tag&&a.kind===r.kind&&a.multi===r.multi&&(o=s)}),n[o]=r}),n}function Wh(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,n;function r(o){o.multi?(e.multi[o.kind].push(o),e.multi.fallback.push(o)):e[o.kind][o.tag]=e.fallback[o.tag]=o}for(t=0,n=arguments.length;t<n;t+=1)arguments[t].forEach(r);return e}function ls(e){return this.extend(e)}ls.prototype.extend=function(t){var n=[],r=[];if(t instanceof pt)r.push(t);else if(Array.isArray(t))r=r.concat(t);else if(t&&(Array.isArray(t.implicit)||Array.isArray(t.explicit)))t.implicit&&(n=n.concat(t.implicit)),t.explicit&&(r=r.concat(t.explicit));else throw new Ct("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(a){if(!(a instanceof pt))throw new Ct("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(a.loadKind&&a.loadKind!=="scalar")throw new Ct("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(a.multi)throw new Ct("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),r.forEach(function(a){if(!(a instanceof pt))throw new Ct("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var o=Object.create(ls.prototype);return o.implicit=(this.implicit||[]).concat(n),o.explicit=(this.explicit||[]).concat(r),o.compiledImplicit=zc(o,"implicit"),o.compiledExplicit=zc(o,"explicit"),o.compiledTypeMap=Wh(o.compiledImplicit,o.compiledExplicit),o};var Wc=ls,Qc=new pt("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),Yc=new pt("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),Jc=new pt("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),Xc=new Wc({explicit:[Qc,Yc,Jc]});function Qh(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function Yh(){return null}function Jh(e){return e===null}var Zc=new pt("tag:yaml.org,2002:null",{kind:"scalar",resolve:Qh,construct:Yh,predicate:Jh,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function Xh(e){if(e===null)return!1;var t=e.length;return t===4&&(e==="true"||e==="True"||e==="TRUE")||t===5&&(e==="false"||e==="False"||e==="FALSE")}function Zh(e){return e==="true"||e==="True"||e==="TRUE"}function ey(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var eu=new pt("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Xh,construct:Zh,predicate:ey,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function ty(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function ny(e){return 48<=e&&e<=55}function ry(e){return 48<=e&&e<=57}function oy(e){if(e===null)return!1;var t=e.length,n=0,r=!1,o;if(!t)return!1;if(o=e[n],(o==="-"||o==="+")&&(o=e[++n]),o==="0"){if(n+1===t)return!0;if(o=e[++n],o==="b"){for(n++;n<t;n++)if(o=e[n],o!=="_"){if(o!=="0"&&o!=="1")return!1;r=!0}return r&&o!=="_"}if(o==="x"){for(n++;n<t;n++)if(o=e[n],o!=="_"){if(!ty(e.charCodeAt(n)))return!1;r=!0}return r&&o!=="_"}if(o==="o"){for(n++;n<t;n++)if(o=e[n],o!=="_"){if(!ny(e.charCodeAt(n)))return!1;r=!0}return r&&o!=="_"}}if(o==="_")return!1;for(;n<t;n++)if(o=e[n],o!=="_"){if(!ry(e.charCodeAt(n)))return!1;r=!0}return!(!r||o==="_")}function iy(e){var t=e,n=1,r;if(t.indexOf("_")!==-1&&(t=t.replace(/_/g,"")),r=t[0],(r==="-"||r==="+")&&(r==="-"&&(n=-1),t=t.slice(1),r=t[0]),t==="0")return 0;if(r==="0"){if(t[1]==="b")return n*parseInt(t.slice(2),2);if(t[1]==="x")return n*parseInt(t.slice(2),16);if(t[1]==="o")return n*parseInt(t.slice(2),8)}return n*parseInt(t,10)}function sy(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!ct.isNegativeZero(e)}var tu=new pt("tag:yaml.org,2002:int",{kind:"scalar",resolve:oy,construct:iy,predicate:sy,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),ay=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function ly(e){return!(e===null||!ay.test(e)||e[e.length-1]==="_")}function cy(e){var t,n;return t=e.replace(/_/g,"").toLowerCase(),n=t[0]==="-"?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),t===".inf"?n===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t===".nan"?NaN:n*parseFloat(t,10)}var uy=/^[-+]?[0-9]+e/;function dy(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(ct.isNegativeZero(e))return"-0.0";return n=e.toString(10),uy.test(n)?n.replace("e",".e"):n}function fy(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||ct.isNegativeZero(e))}var nu=new pt("tag:yaml.org,2002:float",{kind:"scalar",resolve:ly,construct:cy,predicate:fy,represent:dy,defaultStyle:"lowercase"}),ru=Xc.extend({implicit:[Zc,eu,tu,nu]}),ou=ru,iu=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),su=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function py(e){return e===null?!1:iu.exec(e)!==null||su.exec(e)!==null}function my(e){var t,n,r,o,a,s,c,d=0,u=null,h,l,f;if(t=iu.exec(e),t===null&&(t=su.exec(e)),t===null)throw new Error("Date resolve error");if(n=+t[1],r=+t[2]-1,o=+t[3],!t[4])return new Date(Date.UTC(n,r,o));if(a=+t[4],s=+t[5],c=+t[6],t[7]){for(d=t[7].slice(0,3);d.length<3;)d+="0";d=+d}return t[9]&&(h=+t[10],l=+(t[11]||0),u=(h*60+l)*6e4,t[9]==="-"&&(u=-u)),f=new Date(Date.UTC(n,r,o,a,s,c,d)),u&&f.setTime(f.getTime()-u),f}function hy(e){return e.toISOString()}var au=new pt("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:py,construct:my,instanceOf:Date,represent:hy});function yy(e){return e==="<<"||e===null}var lu=new pt("tag:yaml.org,2002:merge",{kind:"scalar",resolve:yy}),cs=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
45
+ \r`;function gy(e){if(e===null)return!1;var t,n,r=0,o=e.length,a=cs;for(n=0;n<o;n++)if(t=a.indexOf(e.charAt(n)),!(t>64)){if(t<0)return!1;r+=6}return r%8===0}function _y(e){var t,n,r=e.replace(/[\r\n=]/g,""),o=r.length,a=cs,s=0,c=[];for(t=0;t<o;t++)t%4===0&&t&&(c.push(s>>16&255),c.push(s>>8&255),c.push(s&255)),s=s<<6|a.indexOf(r.charAt(t));return n=o%4*6,n===0?(c.push(s>>16&255),c.push(s>>8&255),c.push(s&255)):n===18?(c.push(s>>10&255),c.push(s>>2&255)):n===12&&c.push(s>>4&255),new Uint8Array(c)}function by(e){var t="",n=0,r,o,a=e.length,s=cs;for(r=0;r<a;r++)r%3===0&&r&&(t+=s[n>>18&63],t+=s[n>>12&63],t+=s[n>>6&63],t+=s[n&63]),n=(n<<8)+e[r];return o=a%3,o===0?(t+=s[n>>18&63],t+=s[n>>12&63],t+=s[n>>6&63],t+=s[n&63]):o===2?(t+=s[n>>10&63],t+=s[n>>4&63],t+=s[n<<2&63],t+=s[64]):o===1&&(t+=s[n>>2&63],t+=s[n<<4&63],t+=s[64],t+=s[64]),t}function Ty(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var cu=new pt("tag:yaml.org,2002:binary",{kind:"scalar",resolve:gy,construct:_y,predicate:Ty,represent:by}),vy=Object.prototype.hasOwnProperty,Sy=Object.prototype.toString;function wy(e){if(e===null)return!0;var t=[],n,r,o,a,s,c=e;for(n=0,r=c.length;n<r;n+=1){if(o=c[n],s=!1,Sy.call(o)!=="[object Object]")return!1;for(a in o)if(vy.call(o,a))if(!s)s=!0;else return!1;if(!s)return!1;if(t.indexOf(a)===-1)t.push(a);else return!1}return!0}function ky(e){return e!==null?e:[]}var uu=new pt("tag:yaml.org,2002:omap",{kind:"sequence",resolve:wy,construct:ky}),Cy=Object.prototype.toString;function $y(e){if(e===null)return!0;var t,n,r,o,a,s=e;for(a=new Array(s.length),t=0,n=s.length;t<n;t+=1){if(r=s[t],Cy.call(r)!=="[object Object]"||(o=Object.keys(r),o.length!==1))return!1;a[t]=[o[0],r[o[0]]]}return!0}function Ey(e){if(e===null)return[];var t,n,r,o,a,s=e;for(a=new Array(s.length),t=0,n=s.length;t<n;t+=1)r=s[t],o=Object.keys(r),a[t]=[o[0],r[o[0]]];return a}var du=new pt("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:$y,construct:Ey}),Oy=Object.prototype.hasOwnProperty;function Ay(e){if(e===null)return!0;var t,n=e;for(t in n)if(Oy.call(n,t)&&n[t]!==null)return!1;return!0}function Iy(e){return e!==null?e:{}}var fu=new pt("tag:yaml.org,2002:set",{kind:"mapping",resolve:Ay,construct:Iy}),us=ou.extend({implicit:[au,lu],explicit:[cu,uu,du,fu]}),xn=Object.prototype.hasOwnProperty,Ko=1,pu=2,mu=3,Go=4,ds=1,Ny=2,hu=3,Py=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,jy=/[\x85\u2028\u2029]/,xy=/[,\[\]\{\}]/,yu=/^(?:!|!!|![a-z\-]+!)$/i,gu=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function _u(e){return Object.prototype.toString.call(e)}function on(e){return e===10||e===13}function Xn(e){return e===9||e===32}function It(e){return e===9||e===32||e===10||e===13}function Sr(e){return e===44||e===91||e===93||e===123||e===125}function Dy(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function Ly(e){return e===120?2:e===117?4:e===85?8:0}function My(e){return 48<=e&&e<=57?e-48:-1}function bu(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
46
+ `:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"…":e===95?" ":e===76?"\u2028":e===80?"\u2029":""}function By(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}for(var Tu=new Array(256),vu=new Array(256),wr=0;wr<256;wr++)Tu[wr]=bu(wr)?1:0,vu[wr]=bu(wr);function Ry(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||us,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function Su(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=qh(n),new Ct(t,n)}function ge(e,t){throw Su(e,t)}function zo(e,t){e.onWarning&&e.onWarning.call(null,Su(e,t))}var wu={YAML:function(t,n,r){var o,a,s;t.version!==null&&ge(t,"duplication of %YAML directive"),r.length!==1&&ge(t,"YAML directive accepts exactly one argument"),o=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),o===null&&ge(t,"ill-formed argument of the YAML directive"),a=parseInt(o[1],10),s=parseInt(o[2],10),a!==1&&ge(t,"unacceptable YAML version of the document"),t.version=r[0],t.checkLineBreaks=s<2,s!==1&&s!==2&&zo(t,"unsupported YAML version of the document")},TAG:function(t,n,r){var o,a;r.length!==2&&ge(t,"TAG directive accepts exactly two arguments"),o=r[0],a=r[1],yu.test(o)||ge(t,"ill-formed tag handle (first argument) of the TAG directive"),xn.call(t.tagMap,o)&&ge(t,'there is a previously declared suffix for "'+o+'" tag handle'),gu.test(a)||ge(t,"ill-formed tag prefix (second argument) of the TAG directive");try{a=decodeURIComponent(a)}catch{ge(t,"tag prefix is malformed: "+a)}t.tagMap[o]=a}};function Dn(e,t,n,r){var o,a,s,c;if(t<n){if(c=e.input.slice(t,n),r)for(o=0,a=c.length;o<a;o+=1)s=c.charCodeAt(o),s===9||32<=s&&s<=1114111||ge(e,"expected valid JSON character");else Py.test(c)&&ge(e,"the stream contains non-printable characters");e.result+=c}}function ku(e,t,n,r){var o,a,s,c;for(ct.isObject(n)||ge(e,"cannot merge mappings; the provided source object is unacceptable"),o=Object.keys(n),s=0,c=o.length;s<c;s+=1)a=o[s],xn.call(t,a)||(t[a]=n[a],r[a]=!0)}function kr(e,t,n,r,o,a,s,c,d){var u,h;if(Array.isArray(o))for(o=Array.prototype.slice.call(o),u=0,h=o.length;u<h;u+=1)Array.isArray(o[u])&&ge(e,"nested arrays are not supported inside keys"),typeof o=="object"&&_u(o[u])==="[object Object]"&&(o[u]="[object Object]");if(typeof o=="object"&&_u(o)==="[object Object]"&&(o="[object Object]"),o=String(o),t===null&&(t={}),r==="tag:yaml.org,2002:merge")if(Array.isArray(a))for(u=0,h=a.length;u<h;u+=1)ku(e,t,a[u],n);else ku(e,t,a,n);else!e.json&&!xn.call(n,o)&&xn.call(t,o)&&(e.line=s||e.line,e.lineStart=c||e.lineStart,e.position=d||e.position,ge(e,"duplicated mapping key")),o==="__proto__"?Object.defineProperty(t,o,{configurable:!0,enumerable:!0,writable:!0,value:a}):t[o]=a,delete n[o];return t}function fs(e){var t;t=e.input.charCodeAt(e.position),t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):ge(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function at(e,t,n){for(var r=0,o=e.input.charCodeAt(e.position);o!==0;){for(;Xn(o);)o===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),o=e.input.charCodeAt(++e.position);if(t&&o===35)do o=e.input.charCodeAt(++e.position);while(o!==10&&o!==13&&o!==0);if(on(o))for(fs(e),o=e.input.charCodeAt(e.position),r++,e.lineIndent=0;o===32;)e.lineIndent++,o=e.input.charCodeAt(++e.position);else break}return n!==-1&&r!==0&&e.lineIndent<n&&zo(e,"deficient indentation"),r}function Wo(e){var t=e.position,n;return n=e.input.charCodeAt(t),!!((n===45||n===46)&&n===e.input.charCodeAt(t+1)&&n===e.input.charCodeAt(t+2)&&(t+=3,n=e.input.charCodeAt(t),n===0||It(n)))}function ps(e,t){t===1?e.result+=" ":t>1&&(e.result+=ct.repeat(`
47
+ `,t-1))}function Fy(e,t,n){var r,o,a,s,c,d,u,h,l=e.kind,f=e.result,m;if(m=e.input.charCodeAt(e.position),It(m)||Sr(m)||m===35||m===38||m===42||m===33||m===124||m===62||m===39||m===34||m===37||m===64||m===96||(m===63||m===45)&&(o=e.input.charCodeAt(e.position+1),It(o)||n&&Sr(o)))return!1;for(e.kind="scalar",e.result="",a=s=e.position,c=!1;m!==0;){if(m===58){if(o=e.input.charCodeAt(e.position+1),It(o)||n&&Sr(o))break}else if(m===35){if(r=e.input.charCodeAt(e.position-1),It(r))break}else{if(e.position===e.lineStart&&Wo(e)||n&&Sr(m))break;if(on(m))if(d=e.line,u=e.lineStart,h=e.lineIndent,at(e,!1,-1),e.lineIndent>=t){c=!0,m=e.input.charCodeAt(e.position);continue}else{e.position=s,e.line=d,e.lineStart=u,e.lineIndent=h;break}}c&&(Dn(e,a,s,!1),ps(e,e.line-d),a=s=e.position,c=!1),Xn(m)||(s=e.position+1),m=e.input.charCodeAt(++e.position)}return Dn(e,a,s,!1),e.result?!0:(e.kind=l,e.result=f,!1)}function Vy(e,t){var n,r,o;if(n=e.input.charCodeAt(e.position),n!==39)return!1;for(e.kind="scalar",e.result="",e.position++,r=o=e.position;(n=e.input.charCodeAt(e.position))!==0;)if(n===39)if(Dn(e,r,e.position,!0),n=e.input.charCodeAt(++e.position),n===39)r=e.position,e.position++,o=e.position;else return!0;else on(n)?(Dn(e,r,o,!0),ps(e,at(e,!1,t)),r=o=e.position):e.position===e.lineStart&&Wo(e)?ge(e,"unexpected end of the document within a single quoted scalar"):(e.position++,o=e.position);ge(e,"unexpected end of the stream within a single quoted scalar")}function Uy(e,t){var n,r,o,a,s,c;if(c=e.input.charCodeAt(e.position),c!==34)return!1;for(e.kind="scalar",e.result="",e.position++,n=r=e.position;(c=e.input.charCodeAt(e.position))!==0;){if(c===34)return Dn(e,n,e.position,!0),e.position++,!0;if(c===92){if(Dn(e,n,e.position,!0),c=e.input.charCodeAt(++e.position),on(c))at(e,!1,t);else if(c<256&&Tu[c])e.result+=vu[c],e.position++;else if((s=Ly(c))>0){for(o=s,a=0;o>0;o--)c=e.input.charCodeAt(++e.position),(s=Dy(c))>=0?a=(a<<4)+s:ge(e,"expected hexadecimal character");e.result+=By(a),e.position++}else ge(e,"unknown escape sequence");n=r=e.position}else on(c)?(Dn(e,n,r,!0),ps(e,at(e,!1,t)),n=r=e.position):e.position===e.lineStart&&Wo(e)?ge(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}ge(e,"unexpected end of the stream within a double quoted scalar")}function qy(e,t){var n=!0,r,o,a,s=e.tag,c,d=e.anchor,u,h,l,f,m,y=Object.create(null),b,S,T,I;if(I=e.input.charCodeAt(e.position),I===91)h=93,m=!1,c=[];else if(I===123)h=125,m=!0,c={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=c),I=e.input.charCodeAt(++e.position);I!==0;){if(at(e,!0,t),I=e.input.charCodeAt(e.position),I===h)return e.position++,e.tag=s,e.anchor=d,e.kind=m?"mapping":"sequence",e.result=c,!0;n?I===44&&ge(e,"expected the node content, but found ','"):ge(e,"missed comma between flow collection entries"),S=b=T=null,l=f=!1,I===63&&(u=e.input.charCodeAt(e.position+1),It(u)&&(l=f=!0,e.position++,at(e,!0,t))),r=e.line,o=e.lineStart,a=e.position,Cr(e,t,Ko,!1,!0),S=e.tag,b=e.result,at(e,!0,t),I=e.input.charCodeAt(e.position),(f||e.line===r)&&I===58&&(l=!0,I=e.input.charCodeAt(++e.position),at(e,!0,t),Cr(e,t,Ko,!1,!0),T=e.result),m?kr(e,c,y,S,b,T,r,o,a):l?c.push(kr(e,null,y,S,b,T,r,o,a)):c.push(b),at(e,!0,t),I=e.input.charCodeAt(e.position),I===44?(n=!0,I=e.input.charCodeAt(++e.position)):n=!1}ge(e,"unexpected end of the stream within a flow collection")}function Hy(e,t){var n,r,o=ds,a=!1,s=!1,c=t,d=0,u=!1,h,l;if(l=e.input.charCodeAt(e.position),l===124)r=!1;else if(l===62)r=!0;else return!1;for(e.kind="scalar",e.result="";l!==0;)if(l=e.input.charCodeAt(++e.position),l===43||l===45)ds===o?o=l===43?hu:Ny:ge(e,"repeat of a chomping mode identifier");else if((h=My(l))>=0)h===0?ge(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?ge(e,"repeat of an indentation width identifier"):(c=t+h-1,s=!0);else break;if(Xn(l)){do l=e.input.charCodeAt(++e.position);while(Xn(l));if(l===35)do l=e.input.charCodeAt(++e.position);while(!on(l)&&l!==0)}for(;l!==0;){for(fs(e),e.lineIndent=0,l=e.input.charCodeAt(e.position);(!s||e.lineIndent<c)&&l===32;)e.lineIndent++,l=e.input.charCodeAt(++e.position);if(!s&&e.lineIndent>c&&(c=e.lineIndent),on(l)){d++;continue}if(e.lineIndent<c){o===hu?e.result+=ct.repeat(`
48
+ `,a?1+d:d):o===ds&&a&&(e.result+=`
49
+ `);break}for(r?Xn(l)?(u=!0,e.result+=ct.repeat(`
50
50
  `,a?1+d:d)):u?(u=!1,e.result+=ct.repeat(`
51
51
  `,d+1)):d===0?a&&(e.result+=" "):e.result+=ct.repeat(`
52
52
  `,d):e.result+=ct.repeat(`
53
- `,a?1+d:d),a=!0,s=!0,d=0,n=e.position;!on(l)&&l!==0;)l=e.input.charCodeAt(++e.position);Dn(e,n,e.position,!1)}return!0}function wu(e,t){var n,r=e.tag,o=e.anchor,a=[],s,c=!1,d;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=a),d=e.input.charCodeAt(e.position);d!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,ge(e,"tab characters must not be used in indentation")),!(d!==45||(s=e.input.charCodeAt(e.position+1),!It(s))));){if(c=!0,e.position++,st(e,!0,-1)&&e.lineIndent<=t){a.push(null),d=e.input.charCodeAt(e.position);continue}if(n=e.line,kr(e,t,fu,!1,!0),a.push(e.result),st(e,!0,-1),d=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&d!==0)ge(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return c?(e.tag=r,e.anchor=o,e.kind="sequence",e.result=a,!0):!1}function Uy(e,t,n){var r,o,a,s,c,d,u=e.tag,h=e.anchor,l={},f=Object.create(null),m=null,y=null,b=null,S=!1,T=!1,I;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=l),I=e.input.charCodeAt(e.position);I!==0;){if(!S&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,ge(e,"tab characters must not be used in indentation")),r=e.input.charCodeAt(e.position+1),a=e.line,(I===63||I===58)&&It(r))I===63?(S&&(wr(e,l,f,m,y,null,s,c,d),m=y=b=null),T=!0,S=!0,o=!0):S?(S=!1,o=!0):ge(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,I=r;else{if(s=e.line,c=e.lineStart,d=e.position,!kr(e,n,du,!1,!0))break;if(e.line===a){for(I=e.input.charCodeAt(e.position);Jn(I);)I=e.input.charCodeAt(++e.position);if(I===58)I=e.input.charCodeAt(++e.position),It(I)||ge(e,"a whitespace character is expected after the key-value separator within a block mapping"),S&&(wr(e,l,f,m,y,null,s,c,d),m=y=b=null),T=!0,S=!1,o=!1,m=e.tag,y=e.result;else if(T)ge(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=u,e.anchor=h,!0}else if(T)ge(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=u,e.anchor=h,!0}if((e.line===a||e.lineIndent>t)&&(S&&(s=e.line,c=e.lineStart,d=e.position),kr(e,t,Ho,!0,o)&&(S?y=e.result:b=e.result),S||(wr(e,l,f,m,y,b,s,c,d),m=y=b=null),st(e,!0,-1),I=e.input.charCodeAt(e.position)),(e.line===a||e.lineIndent>t)&&I!==0)ge(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return S&&wr(e,l,f,m,y,null,s,c,d),T&&(e.tag=u,e.anchor=h,e.kind="mapping",e.result=l),T}function qy(e){var t,n=!1,r=!1,o,a,s;if(s=e.input.charCodeAt(e.position),s!==33)return!1;if(e.tag!==null&&ge(e,"duplication of a tag property"),s=e.input.charCodeAt(++e.position),s===60?(n=!0,s=e.input.charCodeAt(++e.position)):s===33?(r=!0,o="!!",s=e.input.charCodeAt(++e.position)):o="!",t=e.position,n){do s=e.input.charCodeAt(++e.position);while(s!==0&&s!==62);e.position<e.length?(a=e.input.slice(t,e.position),s=e.input.charCodeAt(++e.position)):ge(e,"unexpected end of the stream within a verbatim tag")}else{for(;s!==0&&!It(s);)s===33&&(r?ge(e,"tag suffix cannot contain exclamation marks"):(o=e.input.slice(t-1,e.position+1),mu.test(o)||ge(e,"named tag handle cannot contain such characters"),r=!0,t=e.position+1)),s=e.input.charCodeAt(++e.position);a=e.input.slice(t,e.position),Ny.test(a)&&ge(e,"tag suffix cannot contain flow indicator characters")}a&&!hu.test(a)&&ge(e,"tag name cannot contain such characters: "+a);try{a=decodeURIComponent(a)}catch{ge(e,"tag name is malformed: "+a)}return n?e.tag=a:jn.call(e.tagMap,o)?e.tag=e.tagMap[o]+a:o==="!"?e.tag="!"+a:o==="!!"?e.tag="tag:yaml.org,2002:"+a:ge(e,'undeclared tag handle "'+o+'"'),!0}function Hy(e){var t,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&ge(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!It(n)&&!vr(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&ge(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function Ky(e){var t,n,r;if(r=e.input.charCodeAt(e.position),r!==42)return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;r!==0&&!It(r)&&!vr(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&ge(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),jn.call(e.anchorMap,n)||ge(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],st(e,!0,-1),!0}function kr(e,t,n,r,o){var a,s,c,d=1,u=!1,h=!1,l,f,m,y,b,S;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,a=s=c=Ho===n||fu===n,r&&st(e,!0,-1)&&(u=!0,e.lineIndent>t?d=1:e.lineIndent===t?d=0:e.lineIndent<t&&(d=-1)),d===1)for(;qy(e)||Hy(e);)st(e,!0,-1)?(u=!0,c=a,e.lineIndent>t?d=1:e.lineIndent===t?d=0:e.lineIndent<t&&(d=-1)):c=!1;if(c&&(c=u||o),(d===1||Ho===n)&&(qo===n||du===n?b=t:b=t+1,S=e.position-e.lineStart,d===1?c&&(wu(e,S)||Uy(e,S,b))||Fy(e,b)?h=!0:(s&&Vy(e,b)||Ry(e,b)||By(e,b)?h=!0:Ky(e)?(h=!0,(e.tag!==null||e.anchor!==null)&&ge(e,"alias node should not have any properties")):My(e,b,qo===n)&&(h=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):d===0&&(h=c&&wu(e,S))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&ge(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),l=0,f=e.implicitTypes.length;l<f;l+=1)if(y=e.implicitTypes[l],y.resolve(e.result)){e.result=y.construct(e.result),e.tag=y.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(jn.call(e.typeMap[e.kind||"fallback"],e.tag))y=e.typeMap[e.kind||"fallback"][e.tag];else for(y=null,m=e.typeMap.multi[e.kind||"fallback"],l=0,f=m.length;l<f;l+=1)if(e.tag.slice(0,m[l].tag.length)===m[l].tag){y=m[l];break}y||ge(e,"unknown tag !<"+e.tag+">"),e.result!==null&&y.kind!==e.kind&&ge(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+y.kind+'", not "'+e.kind+'"'),y.resolve(e.result,e.tag)?(e.result=y.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):ge(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||h}function Gy(e){var t=e.position,n,r,o,a=!1,s;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(s=e.input.charCodeAt(e.position))!==0&&(st(e,!0,-1),s=e.input.charCodeAt(e.position),!(e.lineIndent>0||s!==37));){for(a=!0,s=e.input.charCodeAt(++e.position),n=e.position;s!==0&&!It(s);)s=e.input.charCodeAt(++e.position);for(r=e.input.slice(n,e.position),o=[],r.length<1&&ge(e,"directive name must not be less than one character in length");s!==0;){for(;Jn(s);)s=e.input.charCodeAt(++e.position);if(s===35){do s=e.input.charCodeAt(++e.position);while(s!==0&&!on(s));break}if(on(s))break;for(n=e.position;s!==0&&!It(s);)s=e.input.charCodeAt(++e.position);o.push(e.input.slice(n,e.position))}s!==0&&ds(e),jn.call(vu,r)?vu[r](e,r,o):Ko(e,'unknown document directive "'+r+'"')}if(st(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,st(e,!0,-1)):a&&ge(e,"directives end mark is expected"),kr(e,e.lineIndent-1,Ho,!1,!0),st(e,!0,-1),e.checkLineBreaks&&Iy.test(e.input.slice(t,e.position))&&Ko(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&Go(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,st(e,!0,-1));return}if(e.position<e.length-1)ge(e,"end of the stream or a document separator is expected");else return}function ku(e,t){e=String(e),t=t||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
54
- `),e.charCodeAt(0)===65279&&(e=e.slice(1)));var n=new Ly(e,t),r=e.indexOf("\0");for(r!==-1&&(n.position=r,ge(n,"null byte is not allowed in input")),n.input+="\0";n.input.charCodeAt(n.position)===32;)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)Gy(n);return n.documents}function zy(e,t,n){t!==null&&typeof t=="object"&&typeof n>"u"&&(n=t,t=null);var r=ku(e,n);if(typeof t!="function")return r;for(var o=0,a=r.length;o<a;o+=1)t(r[o])}function Wy(e,t){var n=ku(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new kt("expected a single document in the stream, but found more")}}var Qy=zy,Yy=Wy,Cu={loadAll:Qy,load:Yy},$u=Object.prototype.toString,Eu=Object.prototype.hasOwnProperty,ps=65279,Jy=9,Zr=10,Xy=13,Zy=32,eg=33,tg=34,ms=35,ng=37,rg=38,og=39,ig=42,Ou=44,sg=45,zo=58,ag=61,lg=62,cg=63,ug=64,Au=91,Iu=93,dg=96,Nu=123,fg=124,Pu=125,Tt={};Tt[0]="\\0",Tt[7]="\\a",Tt[8]="\\b",Tt[9]="\\t",Tt[10]="\\n",Tt[11]="\\v",Tt[12]="\\f",Tt[13]="\\r",Tt[27]="\\e",Tt[34]='\\"',Tt[92]="\\\\",Tt[133]="\\N",Tt[160]="\\_",Tt[8232]="\\L",Tt[8233]="\\P";var pg=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],mg=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function hg(e,t){var n,r,o,a,s,c,d;if(t===null)return{};for(n={},r=Object.keys(t),o=0,a=r.length;o<a;o+=1)s=r[o],c=String(t[s]),s.slice(0,2)==="!!"&&(s="tag:yaml.org,2002:"+s.slice(2)),d=e.compiledTypeMap.fallback[s],d&&Eu.call(d.styleAliases,c)&&(c=d.styleAliases[c]),n[s]=c;return n}function yg(e){var t,n,r;if(t=e.toString(16).toUpperCase(),e<=255)n="x",r=2;else if(e<=65535)n="u",r=4;else if(e<=4294967295)n="U",r=8;else throw new kt("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+ct.repeat("0",r-t.length)+t}var gg=1,eo=2;function _g(e){this.schema=e.schema||cs,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=ct.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=hg(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?eo:gg,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function ju(e,t){for(var n=ct.repeat(" ",t),r=0,o=-1,a="",s,c=e.length;r<c;)o=e.indexOf(`
53
+ `,a?1+d:d),a=!0,s=!0,d=0,n=e.position;!on(l)&&l!==0;)l=e.input.charCodeAt(++e.position);Dn(e,n,e.position,!1)}return!0}function Cu(e,t){var n,r=e.tag,o=e.anchor,a=[],s,c=!1,d;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=a),d=e.input.charCodeAt(e.position);d!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,ge(e,"tab characters must not be used in indentation")),!(d!==45||(s=e.input.charCodeAt(e.position+1),!It(s))));){if(c=!0,e.position++,at(e,!0,-1)&&e.lineIndent<=t){a.push(null),d=e.input.charCodeAt(e.position);continue}if(n=e.line,Cr(e,t,mu,!1,!0),a.push(e.result),at(e,!0,-1),d=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&d!==0)ge(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return c?(e.tag=r,e.anchor=o,e.kind="sequence",e.result=a,!0):!1}function Ky(e,t,n){var r,o,a,s,c,d,u=e.tag,h=e.anchor,l={},f=Object.create(null),m=null,y=null,b=null,S=!1,T=!1,I;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=l),I=e.input.charCodeAt(e.position);I!==0;){if(!S&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,ge(e,"tab characters must not be used in indentation")),r=e.input.charCodeAt(e.position+1),a=e.line,(I===63||I===58)&&It(r))I===63?(S&&(kr(e,l,f,m,y,null,s,c,d),m=y=b=null),T=!0,S=!0,o=!0):S?(S=!1,o=!0):ge(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,I=r;else{if(s=e.line,c=e.lineStart,d=e.position,!Cr(e,n,pu,!1,!0))break;if(e.line===a){for(I=e.input.charCodeAt(e.position);Xn(I);)I=e.input.charCodeAt(++e.position);if(I===58)I=e.input.charCodeAt(++e.position),It(I)||ge(e,"a whitespace character is expected after the key-value separator within a block mapping"),S&&(kr(e,l,f,m,y,null,s,c,d),m=y=b=null),T=!0,S=!1,o=!1,m=e.tag,y=e.result;else if(T)ge(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=u,e.anchor=h,!0}else if(T)ge(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=u,e.anchor=h,!0}if((e.line===a||e.lineIndent>t)&&(S&&(s=e.line,c=e.lineStart,d=e.position),Cr(e,t,Go,!0,o)&&(S?y=e.result:b=e.result),S||(kr(e,l,f,m,y,b,s,c,d),m=y=b=null),at(e,!0,-1),I=e.input.charCodeAt(e.position)),(e.line===a||e.lineIndent>t)&&I!==0)ge(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return S&&kr(e,l,f,m,y,null,s,c,d),T&&(e.tag=u,e.anchor=h,e.kind="mapping",e.result=l),T}function Gy(e){var t,n=!1,r=!1,o,a,s;if(s=e.input.charCodeAt(e.position),s!==33)return!1;if(e.tag!==null&&ge(e,"duplication of a tag property"),s=e.input.charCodeAt(++e.position),s===60?(n=!0,s=e.input.charCodeAt(++e.position)):s===33?(r=!0,o="!!",s=e.input.charCodeAt(++e.position)):o="!",t=e.position,n){do s=e.input.charCodeAt(++e.position);while(s!==0&&s!==62);e.position<e.length?(a=e.input.slice(t,e.position),s=e.input.charCodeAt(++e.position)):ge(e,"unexpected end of the stream within a verbatim tag")}else{for(;s!==0&&!It(s);)s===33&&(r?ge(e,"tag suffix cannot contain exclamation marks"):(o=e.input.slice(t-1,e.position+1),yu.test(o)||ge(e,"named tag handle cannot contain such characters"),r=!0,t=e.position+1)),s=e.input.charCodeAt(++e.position);a=e.input.slice(t,e.position),xy.test(a)&&ge(e,"tag suffix cannot contain flow indicator characters")}a&&!gu.test(a)&&ge(e,"tag name cannot contain such characters: "+a);try{a=decodeURIComponent(a)}catch{ge(e,"tag name is malformed: "+a)}return n?e.tag=a:xn.call(e.tagMap,o)?e.tag=e.tagMap[o]+a:o==="!"?e.tag="!"+a:o==="!!"?e.tag="tag:yaml.org,2002:"+a:ge(e,'undeclared tag handle "'+o+'"'),!0}function zy(e){var t,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&ge(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!It(n)&&!Sr(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&ge(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function Wy(e){var t,n,r;if(r=e.input.charCodeAt(e.position),r!==42)return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;r!==0&&!It(r)&&!Sr(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&ge(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),xn.call(e.anchorMap,n)||ge(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],at(e,!0,-1),!0}function Cr(e,t,n,r,o){var a,s,c,d=1,u=!1,h=!1,l,f,m,y,b,S;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,a=s=c=Go===n||mu===n,r&&at(e,!0,-1)&&(u=!0,e.lineIndent>t?d=1:e.lineIndent===t?d=0:e.lineIndent<t&&(d=-1)),d===1)for(;Gy(e)||zy(e);)at(e,!0,-1)?(u=!0,c=a,e.lineIndent>t?d=1:e.lineIndent===t?d=0:e.lineIndent<t&&(d=-1)):c=!1;if(c&&(c=u||o),(d===1||Go===n)&&(Ko===n||pu===n?b=t:b=t+1,S=e.position-e.lineStart,d===1?c&&(Cu(e,S)||Ky(e,S,b))||qy(e,b)?h=!0:(s&&Hy(e,b)||Vy(e,b)||Uy(e,b)?h=!0:Wy(e)?(h=!0,(e.tag!==null||e.anchor!==null)&&ge(e,"alias node should not have any properties")):Fy(e,b,Ko===n)&&(h=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):d===0&&(h=c&&Cu(e,S))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&ge(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),l=0,f=e.implicitTypes.length;l<f;l+=1)if(y=e.implicitTypes[l],y.resolve(e.result)){e.result=y.construct(e.result),e.tag=y.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(xn.call(e.typeMap[e.kind||"fallback"],e.tag))y=e.typeMap[e.kind||"fallback"][e.tag];else for(y=null,m=e.typeMap.multi[e.kind||"fallback"],l=0,f=m.length;l<f;l+=1)if(e.tag.slice(0,m[l].tag.length)===m[l].tag){y=m[l];break}y||ge(e,"unknown tag !<"+e.tag+">"),e.result!==null&&y.kind!==e.kind&&ge(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+y.kind+'", not "'+e.kind+'"'),y.resolve(e.result,e.tag)?(e.result=y.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):ge(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||h}function Qy(e){var t=e.position,n,r,o,a=!1,s;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(s=e.input.charCodeAt(e.position))!==0&&(at(e,!0,-1),s=e.input.charCodeAt(e.position),!(e.lineIndent>0||s!==37));){for(a=!0,s=e.input.charCodeAt(++e.position),n=e.position;s!==0&&!It(s);)s=e.input.charCodeAt(++e.position);for(r=e.input.slice(n,e.position),o=[],r.length<1&&ge(e,"directive name must not be less than one character in length");s!==0;){for(;Xn(s);)s=e.input.charCodeAt(++e.position);if(s===35){do s=e.input.charCodeAt(++e.position);while(s!==0&&!on(s));break}if(on(s))break;for(n=e.position;s!==0&&!It(s);)s=e.input.charCodeAt(++e.position);o.push(e.input.slice(n,e.position))}s!==0&&fs(e),xn.call(wu,r)?wu[r](e,r,o):zo(e,'unknown document directive "'+r+'"')}if(at(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,at(e,!0,-1)):a&&ge(e,"directives end mark is expected"),Cr(e,e.lineIndent-1,Go,!1,!0),at(e,!0,-1),e.checkLineBreaks&&jy.test(e.input.slice(t,e.position))&&zo(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&Wo(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,at(e,!0,-1));return}if(e.position<e.length-1)ge(e,"end of the stream or a document separator is expected");else return}function $u(e,t){e=String(e),t=t||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
54
+ `),e.charCodeAt(0)===65279&&(e=e.slice(1)));var n=new Ry(e,t),r=e.indexOf("\0");for(r!==-1&&(n.position=r,ge(n,"null byte is not allowed in input")),n.input+="\0";n.input.charCodeAt(n.position)===32;)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)Qy(n);return n.documents}function Yy(e,t,n){t!==null&&typeof t=="object"&&typeof n>"u"&&(n=t,t=null);var r=$u(e,n);if(typeof t!="function")return r;for(var o=0,a=r.length;o<a;o+=1)t(r[o])}function Jy(e,t){var n=$u(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new Ct("expected a single document in the stream, but found more")}}var Xy=Yy,Zy=Jy,Eu={loadAll:Xy,load:Zy},Ou=Object.prototype.toString,Au=Object.prototype.hasOwnProperty,ms=65279,eg=9,eo=10,tg=13,ng=32,rg=33,og=34,hs=35,ig=37,sg=38,ag=39,lg=42,Iu=44,cg=45,Qo=58,ug=61,dg=62,fg=63,pg=64,Nu=91,Pu=93,mg=96,ju=123,hg=124,xu=125,Tt={};Tt[0]="\\0",Tt[7]="\\a",Tt[8]="\\b",Tt[9]="\\t",Tt[10]="\\n",Tt[11]="\\v",Tt[12]="\\f",Tt[13]="\\r",Tt[27]="\\e",Tt[34]='\\"',Tt[92]="\\\\",Tt[133]="\\N",Tt[160]="\\_",Tt[8232]="\\L",Tt[8233]="\\P";var yg=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],gg=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function _g(e,t){var n,r,o,a,s,c,d;if(t===null)return{};for(n={},r=Object.keys(t),o=0,a=r.length;o<a;o+=1)s=r[o],c=String(t[s]),s.slice(0,2)==="!!"&&(s="tag:yaml.org,2002:"+s.slice(2)),d=e.compiledTypeMap.fallback[s],d&&Au.call(d.styleAliases,c)&&(c=d.styleAliases[c]),n[s]=c;return n}function bg(e){var t,n,r;if(t=e.toString(16).toUpperCase(),e<=255)n="x",r=2;else if(e<=65535)n="u",r=4;else if(e<=4294967295)n="U",r=8;else throw new Ct("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+ct.repeat("0",r-t.length)+t}var Tg=1,to=2;function vg(e){this.schema=e.schema||us,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=ct.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=_g(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?to:Tg,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Du(e,t){for(var n=ct.repeat(" ",t),r=0,o=-1,a="",s,c=e.length;r<c;)o=e.indexOf(`
55
55
  `,r),o===-1?(s=e.slice(r),r=c):(s=e.slice(r,o+1),r=o+1),s.length&&s!==`
56
- `&&(a+=n),a+=s;return a}function hs(e,t){return`
57
- `+ct.repeat(" ",e.indent*t)}function bg(e,t){var n,r,o;for(n=0,r=e.implicitTypes.length;n<r;n+=1)if(o=e.implicitTypes[n],o.resolve(t))return!0;return!1}function Wo(e){return e===Zy||e===Jy}function to(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==ps||65536<=e&&e<=1114111}function Du(e){return to(e)&&e!==ps&&e!==Xy&&e!==Zr}function xu(e,t,n){var r=Du(e),o=r&&!Wo(e);return(n?r:r&&e!==Ou&&e!==Au&&e!==Iu&&e!==Nu&&e!==Pu)&&e!==ms&&!(t===zo&&!o)||Du(t)&&!Wo(t)&&e===ms||t===zo&&o}function Tg(e){return to(e)&&e!==ps&&!Wo(e)&&e!==sg&&e!==cg&&e!==zo&&e!==Ou&&e!==Au&&e!==Iu&&e!==Nu&&e!==Pu&&e!==ms&&e!==rg&&e!==ig&&e!==eg&&e!==fg&&e!==ag&&e!==lg&&e!==og&&e!==tg&&e!==ng&&e!==ug&&e!==dg}function vg(e){return!Wo(e)&&e!==zo}function no(e,t){var n=e.charCodeAt(t),r;return n>=55296&&n<=56319&&t+1<e.length&&(r=e.charCodeAt(t+1),r>=56320&&r<=57343)?(n-55296)*1024+r-56320+65536:n}function Lu(e){var t=/^\n* /;return t.test(e)}var Mu=1,ys=2,Ru=3,Bu=4,Cr=5;function Sg(e,t,n,r,o,a,s,c){var d,u=0,h=null,l=!1,f=!1,m=r!==-1,y=-1,b=Tg(no(e,0))&&vg(no(e,e.length-1));if(t||s)for(d=0;d<e.length;u>=65536?d+=2:d++){if(u=no(e,d),!to(u))return Cr;b=b&&xu(u,h,c),h=u}else{for(d=0;d<e.length;u>=65536?d+=2:d++){if(u=no(e,d),u===Zr)l=!0,m&&(f=f||d-y-1>r&&e[y+1]!==" ",y=d);else if(!to(u))return Cr;b=b&&xu(u,h,c),h=u}f=f||m&&d-y-1>r&&e[y+1]!==" "}return!l&&!f?b&&!s&&!o(e)?Mu:a===eo?Cr:ys:n>9&&Lu(e)?Cr:s?a===eo?Cr:ys:f?Bu:Ru}function wg(e,t,n,r,o){e.dump=function(){if(t.length===0)return e.quotingType===eo?'""':"''";if(!e.noCompatMode&&(pg.indexOf(t)!==-1||mg.test(t)))return e.quotingType===eo?'"'+t+'"':"'"+t+"'";var a=e.indent*Math.max(1,n),s=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-a),c=r||e.flowLevel>-1&&n>=e.flowLevel;function d(u){return bg(e,u)}switch(Sg(t,c,e.indent,s,d,e.quotingType,e.forceQuotes&&!r,o)){case Mu:return t;case ys:return"'"+t.replace(/'/g,"''")+"'";case Ru:return"|"+Fu(t,e.indent)+Vu(ju(t,a));case Bu:return">"+Fu(t,e.indent)+Vu(ju(kg(t,s),a));case Cr:return'"'+Cg(t)+'"';default:throw new kt("impossible error: invalid scalar style")}}()}function Fu(e,t){var n=Lu(e)?String(t):"",r=e[e.length-1]===`
56
+ `&&(a+=n),a+=s;return a}function ys(e,t){return`
57
+ `+ct.repeat(" ",e.indent*t)}function Sg(e,t){var n,r,o;for(n=0,r=e.implicitTypes.length;n<r;n+=1)if(o=e.implicitTypes[n],o.resolve(t))return!0;return!1}function Yo(e){return e===ng||e===eg}function no(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==ms||65536<=e&&e<=1114111}function Lu(e){return no(e)&&e!==ms&&e!==tg&&e!==eo}function Mu(e,t,n){var r=Lu(e),o=r&&!Yo(e);return(n?r:r&&e!==Iu&&e!==Nu&&e!==Pu&&e!==ju&&e!==xu)&&e!==hs&&!(t===Qo&&!o)||Lu(t)&&!Yo(t)&&e===hs||t===Qo&&o}function wg(e){return no(e)&&e!==ms&&!Yo(e)&&e!==cg&&e!==fg&&e!==Qo&&e!==Iu&&e!==Nu&&e!==Pu&&e!==ju&&e!==xu&&e!==hs&&e!==sg&&e!==lg&&e!==rg&&e!==hg&&e!==ug&&e!==dg&&e!==ag&&e!==og&&e!==ig&&e!==pg&&e!==mg}function kg(e){return!Yo(e)&&e!==Qo}function ro(e,t){var n=e.charCodeAt(t),r;return n>=55296&&n<=56319&&t+1<e.length&&(r=e.charCodeAt(t+1),r>=56320&&r<=57343)?(n-55296)*1024+r-56320+65536:n}function Bu(e){var t=/^\n* /;return t.test(e)}var Ru=1,gs=2,Fu=3,Vu=4,$r=5;function Cg(e,t,n,r,o,a,s,c){var d,u=0,h=null,l=!1,f=!1,m=r!==-1,y=-1,b=wg(ro(e,0))&&kg(ro(e,e.length-1));if(t||s)for(d=0;d<e.length;u>=65536?d+=2:d++){if(u=ro(e,d),!no(u))return $r;b=b&&Mu(u,h,c),h=u}else{for(d=0;d<e.length;u>=65536?d+=2:d++){if(u=ro(e,d),u===eo)l=!0,m&&(f=f||d-y-1>r&&e[y+1]!==" ",y=d);else if(!no(u))return $r;b=b&&Mu(u,h,c),h=u}f=f||m&&d-y-1>r&&e[y+1]!==" "}return!l&&!f?b&&!s&&!o(e)?Ru:a===to?$r:gs:n>9&&Bu(e)?$r:s?a===to?$r:gs:f?Vu:Fu}function $g(e,t,n,r,o){e.dump=function(){if(t.length===0)return e.quotingType===to?'""':"''";if(!e.noCompatMode&&(yg.indexOf(t)!==-1||gg.test(t)))return e.quotingType===to?'"'+t+'"':"'"+t+"'";var a=e.indent*Math.max(1,n),s=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-a),c=r||e.flowLevel>-1&&n>=e.flowLevel;function d(u){return Sg(e,u)}switch(Cg(t,c,e.indent,s,d,e.quotingType,e.forceQuotes&&!r,o)){case Ru:return t;case gs:return"'"+t.replace(/'/g,"''")+"'";case Fu:return"|"+Uu(t,e.indent)+qu(Du(t,a));case Vu:return">"+Uu(t,e.indent)+qu(Du(Eg(t,s),a));case $r:return'"'+Og(t)+'"';default:throw new Ct("impossible error: invalid scalar style")}}()}function Uu(e,t){var n=Bu(e)?String(t):"",r=e[e.length-1]===`
58
58
  `,o=r&&(e[e.length-2]===`
59
59
  `||e===`
60
60
  `),a=o?"+":r?"":"-";return n+a+`
61
- `}function Vu(e){return e[e.length-1]===`
62
- `?e.slice(0,-1):e}function kg(e,t){for(var n=/(\n+)([^\n]*)/g,r=function(){var u=e.indexOf(`
63
- `);return u=u!==-1?u:e.length,n.lastIndex=u,Uu(e.slice(0,u),t)}(),o=e[0]===`
61
+ `}function qu(e){return e[e.length-1]===`
62
+ `?e.slice(0,-1):e}function Eg(e,t){for(var n=/(\n+)([^\n]*)/g,r=function(){var u=e.indexOf(`
63
+ `);return u=u!==-1?u:e.length,n.lastIndex=u,Hu(e.slice(0,u),t)}(),o=e[0]===`
64
64
  `||e[0]===" ",a,s;s=n.exec(e);){var c=s[1],d=s[2];a=d[0]===" ",r+=c+(!o&&!a&&d!==""?`
65
- `:"")+Uu(d,t),o=a}return r}function Uu(e,t){if(e===""||e[0]===" ")return e;for(var n=/ [^ ]/g,r,o=0,a,s=0,c=0,d="";r=n.exec(e);)c=r.index,c-o>t&&(a=s>o?s:c,d+=`
65
+ `:"")+Hu(d,t),o=a}return r}function Hu(e,t){if(e===""||e[0]===" ")return e;for(var n=/ [^ ]/g,r,o=0,a,s=0,c=0,d="";r=n.exec(e);)c=r.index,c-o>t&&(a=s>o?s:c,d+=`
66
66
  `+e.slice(o,a),o=a+1),s=c;return d+=`
67
67
  `,e.length-o>t&&s>o?d+=e.slice(o,s)+`
68
- `+e.slice(s+1):d+=e.slice(o),d.slice(1)}function Cg(e){for(var t="",n=0,r,o=0;o<e.length;n>=65536?o+=2:o++)n=no(e,o),r=Tt[n],!r&&to(n)?(t+=e[o],n>=65536&&(t+=e[o+1])):t+=r||yg(n);return t}function $g(e,t,n){var r="",o=e.tag,a,s,c;for(a=0,s=n.length;a<s;a+=1)c=n[a],e.replacer&&(c=e.replacer.call(n,String(a),c)),(vn(e,t,c,!1,!1)||typeof c>"u"&&vn(e,t,null,!1,!1))&&(r!==""&&(r+=","+(e.condenseFlow?"":" ")),r+=e.dump);e.tag=o,e.dump="["+r+"]"}function qu(e,t,n,r){var o="",a=e.tag,s,c,d;for(s=0,c=n.length;s<c;s+=1)d=n[s],e.replacer&&(d=e.replacer.call(n,String(s),d)),(vn(e,t+1,d,!0,!0,!1,!0)||typeof d>"u"&&vn(e,t+1,null,!0,!0,!1,!0))&&((!r||o!=="")&&(o+=hs(e,t)),e.dump&&Zr===e.dump.charCodeAt(0)?o+="-":o+="- ",o+=e.dump);e.tag=a,e.dump=o||"[]"}function Eg(e,t,n){var r="",o=e.tag,a=Object.keys(n),s,c,d,u,h;for(s=0,c=a.length;s<c;s+=1)h="",r!==""&&(h+=", "),e.condenseFlow&&(h+='"'),d=a[s],u=n[d],e.replacer&&(u=e.replacer.call(n,d,u)),vn(e,t,d,!1,!1)&&(e.dump.length>1024&&(h+="? "),h+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),vn(e,t,u,!1,!1)&&(h+=e.dump,r+=h));e.tag=o,e.dump="{"+r+"}"}function Og(e,t,n,r){var o="",a=e.tag,s=Object.keys(n),c,d,u,h,l,f;if(e.sortKeys===!0)s.sort();else if(typeof e.sortKeys=="function")s.sort(e.sortKeys);else if(e.sortKeys)throw new kt("sortKeys must be a boolean or a function");for(c=0,d=s.length;c<d;c+=1)f="",(!r||o!=="")&&(f+=hs(e,t)),u=s[c],h=n[u],e.replacer&&(h=e.replacer.call(n,u,h)),vn(e,t+1,u,!0,!0,!0)&&(l=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,l&&(e.dump&&Zr===e.dump.charCodeAt(0)?f+="?":f+="? "),f+=e.dump,l&&(f+=hs(e,t)),vn(e,t+1,h,!0,l)&&(e.dump&&Zr===e.dump.charCodeAt(0)?f+=":":f+=": ",f+=e.dump,o+=f));e.tag=a,e.dump=o||"{}"}function Hu(e,t,n){var r,o,a,s,c,d;for(o=n?e.explicitTypes:e.implicitTypes,a=0,s=o.length;a<s;a+=1)if(c=o[a],(c.instanceOf||c.predicate)&&(!c.instanceOf||typeof t=="object"&&t instanceof c.instanceOf)&&(!c.predicate||c.predicate(t))){if(n?c.multi&&c.representName?e.tag=c.representName(t):e.tag=c.tag:e.tag="?",c.represent){if(d=e.styleMap[c.tag]||c.defaultStyle,$u.call(c.represent)==="[object Function]")r=c.represent(t,d);else if(Eu.call(c.represent,d))r=c.represent[d](t,d);else throw new kt("!<"+c.tag+'> tag resolver accepts not "'+d+'" style');e.dump=r}return!0}return!1}function vn(e,t,n,r,o,a,s){e.tag=null,e.dump=n,Hu(e,n,!1)||Hu(e,n,!0);var c=$u.call(e.dump),d=r,u;r&&(r=e.flowLevel<0||e.flowLevel>t);var h=c==="[object Object]"||c==="[object Array]",l,f;if(h&&(l=e.duplicates.indexOf(n),f=l!==-1),(e.tag!==null&&e.tag!=="?"||f||e.indent!==2&&t>0)&&(o=!1),f&&e.usedDuplicates[l])e.dump="*ref_"+l;else{if(h&&f&&!e.usedDuplicates[l]&&(e.usedDuplicates[l]=!0),c==="[object Object]")r&&Object.keys(e.dump).length!==0?(Og(e,t,e.dump,o),f&&(e.dump="&ref_"+l+e.dump)):(Eg(e,t,e.dump),f&&(e.dump="&ref_"+l+" "+e.dump));else if(c==="[object Array]")r&&e.dump.length!==0?(e.noArrayIndent&&!s&&t>0?qu(e,t-1,e.dump,o):qu(e,t,e.dump,o),f&&(e.dump="&ref_"+l+e.dump)):($g(e,t,e.dump),f&&(e.dump="&ref_"+l+" "+e.dump));else if(c==="[object String]")e.tag!=="?"&&wg(e,e.dump,t,a,d);else{if(c==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new kt("unacceptable kind of an object to dump "+c)}e.tag!==null&&e.tag!=="?"&&(u=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?u="!"+u:u.slice(0,18)==="tag:yaml.org,2002:"?u="!!"+u.slice(18):u="!<"+u+">",e.dump=u+" "+e.dump)}return!0}function Ag(e,t){var n=[],r=[],o,a;for(gs(e,n,r),o=0,a=r.length;o<a;o+=1)t.duplicates.push(n[r[o]]);t.usedDuplicates=new Array(a)}function gs(e,t,n){var r,o,a;if(e!==null&&typeof e=="object")if(o=t.indexOf(e),o!==-1)n.indexOf(o)===-1&&n.push(o);else if(t.push(e),Array.isArray(e))for(o=0,a=e.length;o<a;o+=1)gs(e[o],t,n);else for(r=Object.keys(e),o=0,a=r.length;o<a;o+=1)gs(e[r[o]],t,n)}function Ig(e,t){t=t||{};var n=new _g(t);n.noRefs||Ag(e,n);var r=e;return n.replacer&&(r=n.replacer.call({"":r},"",r)),vn(n,0,r,!0,!0)?n.dump+`
69
- `:""}var Ng=Ig,Pg={dump:Ng};function _s(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var jg=pt,Dg=Gc,xg=Yc,Lg=tu,Mg=nu,Rg=cs,Bg=Cu.load,Fg=Cu.loadAll,Vg=Pg.dump,Ug=kt,qg={binary:au,float:eu,map:Qc,null:Jc,pairs:cu,set:uu,timestamp:iu,bool:Xc,int:Zc,merge:su,omap:lu,seq:Wc,str:zc},Hg=_s("safeLoad","load"),Kg=_s("safeLoadAll","loadAll"),Gg=_s("safeDump","dump"),zg={Type:jg,Schema:Dg,FAILSAFE_SCHEMA:xg,JSON_SCHEMA:Lg,CORE_SCHEMA:Mg,DEFAULT_SCHEMA:Rg,load:Bg,loadAll:Fg,dump:Vg,YAMLException:Ug,types:qg,safeLoad:Hg,safeLoadAll:Kg,safeDump:Gg};function Qo(e){return new Promise((t,n)=>{const r=new XMLHttpRequest;r.onload=function(){r.status>=200&&r.status<300?t(r.responseText):(ae(`Failed to load file ${e}`,r.status),n(r.status))},r.open("GET",e),r.send()})}async function ro(e){try{const t=await Qo(e);let n;if(e.endsWith(".json"))n=JSON.parse(t);else if(e.endsWith(".yaml"))n=zg.load(t);else{const r=`Unsupported file type for data file ${e} (must be .json or .yaml)`;throw new Error(r)}if(!n)throw new Error(`Data loaded from ${e} is empty`);return n}catch(t){throw console.error(`Failed to load data file ${e}: ${t}`),t}}const Wg=(e,t)=>{const n={};for(const r in e)n[r]=t(e[r]);return n},Ku=(e,t)=>{for(const n in e){const r=e[n];t(r,n,e),typeof r=="object"&&r!==null&&Ku(r,t)}},Xn={};async function Qg(e){return Xn[e]?Xn[e]:Gu(e,e)}async function Yg(e){Ft.log("Loading images");const t=[],n=async(o,a)=>await Gu(o,a),r=(o,a)=>{t.push(n(o,a))};for(const o in e.common.images){const a=e.common.images[o];r(o,a)}if(e.preload.images)for(const o in e.preload.images.assets){const a=e.preload.images.assets[o];r(o,a)}for(const o in e.screens.screens){const a=e.screens.screens[o];if(a.background&&!e.common.images[a.background]&&!a.video&&r(a.background,a.background),a.buttons)for(const s in a.buttons){const c=a.buttons[s];typeof c=="object"&&c.background&&!e.common.images[c.background]&&r(c.background,c.background)}}return Promise.all(t)}async function Gu(e,t){if(Xn[e])return Xn[e];if(t===Uo){const r=new Image;return Xn[e]=r,r}const n=new Promise((r,o)=>{const a=new Image;a.onload=()=>{Xn[e]=a,r(a)},a.onerror=s=>{ae(`Failed to load image ${e} at ${t}`,s),o(s)},a.src=$t(t)});return Xn[e]=n,n}const Yo={};function Jg(e){return Yo[e]??{}}function zu(e,t,n){const r=Jg(e.transition),o=e.duration??r.duration??500,a=e.delay??r.delay??0;return{...e,resolve:n,duration:o,delay:a,oldScreen:t}}const vt=et("notifications",{state:()=>({notifications:[],enabled:!0}),actions:{async addNotification(e,t,n){if(!this.enabled)return;e=nn(e);const r=`${Date.now()}-${Math.random()*1e4}`;this.notifications.push({id:r,text:e,description:t,icon:n}),le().notifications.alsoPrintInDialogue&&Uc(`[NOTIFICATION] ${e}`),await At(le().notifications.timeOnScreen*1e3),this.deleteNotification(r)},deleteNotification(e){const t=this.findNotifications(e);t&&this.notifications.splice(this.notifications.indexOf(t),1)},findNotifications(e){return this.notifications.find(t=>t.id===e)},disableNotifications(){this.enabled=!1;for(const e in this.notifications)this.deleteNotification(e)},enableNotifications(){this.enabled=!0}}}),mt=et("inventory",{state:()=>({items:{},interactionTags:{}}),actions:{generateSaveData(){return{items:Re(this.items),interactionTags:Re(this.interactionTags)}},loadSaveData(e){this.items={...this.items,...e.items},this.interactionTags={...e.interactionTags}},updateConfig(e){Object.keys(e.items).forEach(t=>{this.items[t]||(this.items[t]={amount:0,id:t})})},reset(e){this.$reset(),this.updateConfig(e)},hasItem(e,t){var n;return t||(t=1),((n=this.items[e])==null?void 0:n.amount)>=t},getExistingItem(e){return this.items[e]},getItemAmount(e){var t;return((t=this.getExistingItem(e))==null?void 0:t.amount)||0},add(e){const t=this.getExistingItem(e.id);t?t.amount+=e.amount:this.items[e.id]={...e};const n=en(e.id).name,r=e.amount>1?`${n} x ${e.amount}`:n;vt().addNotification(`Received item: ${r}`)},enableInteraction(e){e||(e="default"),this.interactionTags[e]={blockedInteraction:!1}},disableInteraction(e){e||(e="default"),this.interactionTags[e]={blockedInteraction:!0}},onScriptStart(){const e=le().interactionTags;Object.keys(e).forEach(t=>{e[t].onlyInteractOutsideOfScripts&&this.disableInteraction(t)})},onScriptEnd(){const e=le().interactionTags;Object.keys(e).forEach(t=>{e[t].onlyInteractOutsideOfScripts&&this.enableInteraction(t)})},isInteractionTagBlocked(e){return e||(e="default"),this.interactionTags[e]?this.interactionTags[e].blockedInteraction:!1},remove(e){const t=this.getExistingItem(e.id);t&&(t.amount-=e.amount,vt().addNotification(`Lost item: ${en(e.id).name} x ${e.amount}`),t.amount<=0&&this.deleteItem(e.id))},deleteItem(e){this.getExistingItem(e)&&(this.items[e].amount=0)},canUseItem(e){var n;const t=en(e.id);return!!(t&&t.onUse&&!this.isInteractionTagBlocked(t.tag)&&!((n=Fe().currentDialog)!=null&&n.choices))},useItem(e){let t=!1;const n=en(e.id);if(e&&this.canUseItem(e)&&n){const r=n.onUse;t=!0,Qn("onItemUsed"),r.action==="jump"?we().jumpToLabel(r.label):r.action==="run"?we().runThenGoBackToPreviousDialog(r.label,!0):(t=!1,ae(`Unknown action ${r.action}`))}return t}}}),Ut=et("screens",{state:()=>({layers:[{screen:"default"}],buttons:{}}),actions:{setScreen(e,t,n){return new Promise(r=>{const o=this.layers[t||0];let a;const s=(o==null?void 0:o.screen)??null;if(s===e){r();return}n&&(a=zu(n,s,r)),this.layers[t||0]={screen:e,transition:a},a||r()})},finishTransition(e){const t=this.layers[e];if(!t)ae(`Tried to finish transition on layer ${e} but it doesn't exist`);else if(t.transition){const n=t.transition.resolve;delete t.transition,n()}},transitionScreen(e,t,n){return this.setScreen(e,n??0,t)},emptyLayer(e,t){return new Promise(n=>{const r=this.layers[e];if(!r){Zn(`Tried to empty layer ${e} but it doesn't exist`);return}if(t){const o=r.screen,a=zu(t,o,n);r.transition=a}r.screen="@empty",t||n()})},updateConfig(e){console.log("update config!");const t=Ve().buttons.buttons;for(const n in t)this.buttons[n]||(this.buttons[n]={state:t[n].enabled})},reset(e){this.$reset(),this.updateConfig(e)},changeButton(e,t){if(!this.buttons[e]){ae(`Tried to change button ${e} but it doesn't exist`);return}this.buttons[e].state=t},generateSaveData(){return{layers:Re(this.layers).filter(e=>e).map(e=>e.screen??null),buttons:Re(this.buttons)}},loadSaveData(e){this.layers=e.layers.map(t=>(t!==null&&typeof t!="string"&&(t=null),{screen:t})),this.buttons=Yn(this.buttons,e.buttons)},isButtonDisabled(e){const t=this.getButtonState(e);return t==="hidden"||t==="greyed"||t===!1},isButtonInteractible(e){const t=this.getButtonState(e);return t?t===!0:!1},isButtonClickable(e){if(!this.isButtonInteractible(e))return!1;const n=Vn(e);return!!Jo(n)},getButtonState(e){const t=Vn(e),n=this.buttons[e],r=t.tag||"default",o=n.state;return o===!0&&mt().isInteractionTagBlocked(r)?"greyed":o},clickOnButton(e){if(!this.isButtonClickable(e))return;const t=we(),n=Vn(e);Qn("onButtonClicked");const r=n.action;r&&(n.actionType==="run"?t.runLabelFunction(r):t.jumpToLabel(r))}},getters:{nonEmptyLayers(e){return e.layers.filter(t=>t)},isTransitioning(e){return e.layers.some(t=>t==null?void 0:t.transition)}}});function Jo(e){if(!Te().inScript)return!0;const t=Ci().clickableDuringScriptsByDefault;if(t)return e.scriptClickable!==!1;if(!t)return e.scriptClickable===!0}const Xg=["screenObject","sprite"];function Wu(e){return typeof e=="object"&&e!==null&&Xg.includes(e._entityType)}function Zg(e){return typeof e=="object"&&e!==null&&e._entityType==="sprite"}function e_(e){if(e.includes(" ")){const t=e.split(" ");return{label:t[0],args:t.slice(1)}}else return{label:e}}const xt=et("screenObjects",{state:()=>({tree:[],objectsList:{}}),actions:{addObject(e){e.parent?e.parent.children.push(e):this.tree.push(e),this.objectsList[e.id]=e},createObject(e){const t={_entityType:"screenObject",id:Gn(),name:"Screen Object",tags:[],x:0,y:0,anchor:{x:0,y:0},width:1,height:1,opacity:1,scale:1,layer:0,children:[],...e};return this.addObject(t),t},destroyObject(e){let t=e;typeof t=="string"&&(t=this.getObject(t));for(let n=t.children.length-1;n>=0;n--)this.destroyObject(t.children[n]);if(t.parent){const n=t.parent,r=n.children.indexOf(t);r!==-1?n.children.splice(r,1):console.warn(`Could not find object ${t.id} in parent's children`)}else{const n=this.tree.indexOf(t);n!==-1?this.tree.splice(n,1):console.warn(`Object to destroy not found in store (${t.id})`)}delete this.objectsList[t.id]},createSprite(e){const t=this.createObject(e);return t._entityType="sprite",Qg(e.image).then(n=>{const r=this.getObject(t.id);r.width===1&&r.height===1&&(r.width=n.width,r.height=n.height)}),t},getObject(e){return this.objectsList[e]},isScreenObjectClickable(e){return Jo(e)?!!e.onClick:!1},clickObject(e){if(this.isScreenObjectClickable(e)&&e.onClick){Qn("onSpriteClicked");let t;if(typeof e.onClick=="string"){const n=e_(e.onClick);t={label:n.label,args:n.args}}else t=e.onClick;t.method=t.method??e.clickMethod??"jump",t.args=t.args??[],t.method==="run"?we().runThenGoBackToPreviousDialog(t.label,...t.args):t.method==="jump"?we().jumpToLabel(t.label,...t.args):ae(`Unknown sprite click method ${e.clickMethod}`)}},generateSaveData(){return{tree:Re(this.tree.map(e=>e.id)),objectsList:Re(Wg(this.objectsList,e=>this.screenObjectToSave(e)))}},loadSaveData(e){this.objectsList=this.loadAllObjects(e.objectsList),this.tree=e.tree.map(t=>this.objectsList[t])},reset(){this.$reset()},screenObjectToSave(e){return{...e,children:e.children.map(t=>t.id),parent:e.parent?e.parent.id:void 0}},loadAllObjects(e){for(const t of Object.values(e)){const n=t;n.parent=n.parent?e[n.parent]:void 0,n.children=n.children.map(r=>e[r])}return e},emptyLayer(e){for(let t=this.tree.length-1;t>=0;t--){const n=this.tree[t];n.layer===e&&this.destroyObject(n)}},emptyAllLayers(){for(let e=this.tree.length-1;e>=0;e--){const t=this.tree[e];this.destroyObject(t)}}}});function Qu(e){return"save"in e}function Yu(e){return"globalSave"in e}function t_(e){return"config"in e}const n_=i.defineComponent({props:{percentage:Number,step:String},methods:{loadingStyle(){return{width:`${this.percentage*60}vw`}}},computed:{}}),r_={id:"loading-bar"},o_={id:"loading-text"};function i_(e,t,n,r,o,a){return i.openBlock(),i.createElementBlock("div",r_,[i.createElementVNode("div",{id:"inner-loading-bar",style:i.normalizeStyle(e.loadingStyle())},null,4),i.createElementVNode("div",o_,[i.createElementVNode("h3",null,"Loading "+i.toDisplayString(Math.floor(e.percentage*100))+"% - "+i.toDisplayString(e.step),1)])])}const s_=zt(n_,[["render",i_]]),a_="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Generator:%20Adobe%20Illustrator%2019.0.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%206.00%20Build%200)%20--%3e%3csvg%20version='1.1'%20id='Rat'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20x='0px'%20y='0px'%20viewBox='0%200%20595.3%20595.3'%20style='enable-background:new%200%200%20595.3%20595.3;'%20xml:space='preserve'%3e%3cstyle%20type='text/css'%3e%20.st0{fill:%23E23B33;}%20%3c/style%3e%3cpath%20id='Rat_Shape'%20class='st0'%20d='M556.9,82.5c-10.8-24.3-47-57.1-71.3-65.6c-24.3-8.4-64.1-0.3-88.7,22.3%20c-20,18.4-26,28.2-29.1,37c-2.1,5.9-4.8,13.5-6,20.9v0c-0.5,4.1-4.5,7-8.6,6.1c-10.4-2.3-29.5-6-44.4-6.3%20c-13.7-0.2-30.1,3.2-40.4,5.7c-4.5,1.1-8.8-2.2-8.8-6.8c-0.1-5.3-1.1-12.3-4.8-19.6c-8.5-16.9-19.6-32.6-57.8-47.4%20c-31.9-12.4-75.1-9.7-100.8,1.8c-28.1,12.6-42.4,37.9-54,61.8c-14.4,29.8-14.9,83.6-6.4,104c12.8,30.7,35.8,47.2,52.6,53%20c11.3,3.8,28.2,3.7,38.2,3.3c4.2-0.2,7.7,3.3,7.5,7.5c-0.7,13.6-0.9,41.5,7,61.4c7.7,19.4,29.7,62.3,50.7,101.2%20c0,0.1-14.6,2.9-31.4,6.8c-23.9,5.5-52.6,12.7-54.3,13.7c-3.5,2.1-3,10-2.7,12c0.5,3.4,5.3,8.1,6.9,8.3c3.9,0.3,31.3-7.6,55.7-14.6%20c18.5-5.3,34.9-9.3,35.5-8.2c5.1,9.3,10,18,14.4,25.8c5.2,9.1,10.7,16.4,14.1,23.6c1.1,2.3-16.6,5.8-32.5,14.7%20c-16.4,9.1-29.7,21-32.3,24c-1.8,2.1-3,6-1.2,10.7c1.1,2.9,10,5.7,12.4,5.1c6.8-1.7,16.5-12.5,33.1-21.1%20c16.3-8.5,32.9-14.9,33.8-13.6c9.7,14.3,16.9,21.6,22.6,31.2c9.8,16.5,27.3,45.9,46.6,39.5c6.4-2.1,31.1-33.6,53.3-68.6%20c1.3-2.1,16.1,11.3,30.4,23.2c13.8,11.4,22.7,20.6,27.1,21.4c5.4,1,14.2-7.7,14.1-14.7c-0.1-2.7-14.3-13.8-29.1-26.2%20c-14.5-12.1-30.1-22.8-29.2-24.3c7.6-12,14.5-23.7,20.1-33.9c4.3-7.8,8.9-16,13-24.7c0.6-1.2,15.9,3,31.4,7.1c15.3,4,26.7,10,31,8%20c6.9-3,11.6-13.8,9.4-18.3c-1.1-2.3-17-7.3-33.2-12c-14.2-4.1-28-6.5-27.7-7.3c15.5-34,28.8-64.8,27.6-69.6%20c-1.7-7.1,2.6-11.9,7-36.5c3.2-18.1,4.7-40.9,5.2-51.7c0.2-3.5,2.8-6.3,6.3-6.7c3.1-0.3,6.9-0.9,10.5-1.9c7.8-2,18.6-7.8,36.4-20.6%20c17.9-12.8,38.7-49.6,44.4-67.8S567.6,106.8,556.9,82.5z%20M265.1,336.2c-8.1,4-13,7-26.4,9.6c-6.9,1.4-29.4-0.2-40.7-4.6%20c-10.5-4.1-19.9-7.6-30-15.4s-15.7-13.2-15.7-15.3c0-4.4,6-9.4,11-9.4c5.1,0,14.5,9.2,29.7,16.6c14.3,7,17.9,6.1,25.4,7.3%20c2.9,0.5,7.7,0.6,10.7,0.4c14.1-1.3,21.4-5.9,25.3-8.8c4-3,13.7-12.9,17.2-12.5c8,1,18.9,3.4,18.9,7.1%20C290.4,319,273.2,332.1,265.1,336.2z%20M320.9,521.4c-4.3,3.7-17.7,13.5-23.3,13.5c-2.8,0-7.4-8.2-11.5-16.8%20c-4.1-8.5-9.1-21.1-9.1-31.6c0-4.6,6-7.4,13.4-9.2c7.2-1.7,27.3-1.8,29.9-1.1c6.8,1.7,12.9,2.2,12.7,6.4c-0.4,12.7-7,18.9-8.3,24.3%20C323.4,512.3,323.4,519.2,320.9,521.4z%20M431.1,320.3c-9.2,7.4-10.6,8.1-24.9,13.7c-11.3,4.4-28.6,5.8-41.6,3.6%20c-12.2-2.1-22.3-4.6-29.5-10.1c-9.7-7.3-16.4-15.1-16.4-19.8c0-3.7,6.4-4.3,14.5-4.9c3.5-0.3,9.3,5.9,13.2,9.2%20c8.1,6.8,14.8,8,28.8,9.9c2.9,0.4,7.8,0.4,10.7,0.1c7.5-0.9,12-0.4,25.8-8.2c20-11.2,17.8-14.4,25.1-12.6c2.2,0.6,5.8,1.2,5.6,5.6%20C442.4,309,440.5,312.7,431.1,320.3z'/%3e%3c/svg%3e",l_={id:"engine-splash-screen",class:"flex justify-center items-center"},c_={id:"engine-splash-title"},u_=["src"],bs=i.defineComponent({__name:"engine-splash",emits:["finished"],setup(e,{emit:t}){const n=t,r=i.ref("hidden"),o=i.computed(()=>({transitionDuration:`${h.value}s`})),a=i.computed(()=>({invisible:r.value!=="appear"})),s=Te(),c=i.computed(()=>{var m;return((m=le().splashScreens)==null?void 0:m.engineSplashScreen)??{}}),d=i.computed(()=>typeof c.value.overrideText=="string"?c.value.overrideText:"Made with narrat engine"),u=i.computed(()=>c.value.overrideLogo??a_),h=i.computed(()=>typeof c.value.fadeDuration=="number"?c.value.fadeDuration:.8),l=i.computed(()=>typeof c.value.timeBeforeFadeout=="number"?c.value.timeBeforeFadeout:1.5);i.onMounted(async()=>{if(await At(10),r.value="appear",c.value.skip||s.options.debug){f();return}await At(h.value*1e3),await At(l.value*1e3),r.value="disappear",await At(h.value*1e3),f()});function f(){s.loading.loaded?n("finished"):s.listener.once("gameLoaded",()=>{n("finished")})}return(m,y)=>(i.openBlock(),i.createElementBlock("div",l_,[i.createElementVNode("div",{id:"engine-splash-header",class:i.normalizeClass(["flex justify-center flex-col items-center",a.value]),style:i.normalizeStyle(o.value)},[i.createElementVNode("h1",c_,i.toDisplayString(d.value),1),i.createElementVNode("img",{src:u.value,alt:"Narrat Logo",id:"engine-splash-logo"},null,8,u_),i.createVNode(s_,{percentage:i.unref(s).loading.percentage,step:i.unref(s).loading.step},null,8,["percentage","step"])],6)]))}});class Ts{constructor(){xe(this,"listeners",{})}on(t,n){return this.listeners[t]||this.addEventToMap(t),this.listeners[t].add(n),n}off(t,n){return this.listeners[t]&&this.listeners[t].delete(n),n}once(t,n){const r=(...o)=>{this.off(t,r),n(...o)};return this.on(t,r)}emit(t,...n){this.listeners[t]&&this.listeners[t].forEach(r=>r(...n))}clear(){Object.keys(this.listeners).forEach(t=>{delete this.listeners[t]})}addEventToMap(t){this.listeners[t]=new Set}}class d_ extends Ts{setup(){const t=()=>{this.emit("preUpdate"),this.emit("update"),this.emit("postUpdate"),requestAnimationFrame(t)};t()}}const oo=new d_;Z.Vec2=void 0,(e=>{function t(y,b){return{x:y??0,y:b??0}}e.create=t;function n(y){return Math.sqrt(y.x*y.x+y.y*y.y)}e.magnitude=n;function r(y){const b=n(y);return b===0?t(0,0):{x:y.x/b,y:y.y/b}}e.normalize=r;function o(y,b){return{x:y.x+b.x,y:y.y+b.y}}e.add=o;function a(y,b){return{x:y.x-b.x,y:y.y-b.y}}e.subtract=a;function s(y,b){return{x:y.x*b.x,y:y.y*b.y}}e.multiply=s;function c(y,b){return{x:y.x*b,y:y.y*b}}e.scale=c;function d(y,b){return{x:y.x/b.x,y:y.y/b.y}}e.divide=d;function u(y,b){return n(a(y,b))}e.distance=u;function h(y,b,S){return{x:y.x+(b.x-y.x)*S,y:y.y+(b.y-y.y)*S}}e.lerp=h;function l(y,b){const S=Math.cos(b),T=Math.sin(b);return{x:y.x*S-y.y*T,y:y.x*T+y.y*S}}e.rotate=l;function f(y,b){const S=a(b,y);return e.normalize({x:-S.y,y:S.x})}e.normal=f;function m(y,b){return y.x*b.x+y.y*b.y}e.dot=m})(Z.Vec2||(Z.Vec2={}));function vs(e,t,n,r){const o=e/n,a=t/r;return Math.min(o,a)}const sn=et("settings",{state:()=>({baseSettings:{textSpeed:30,animateText:!0,fontSize:16},settingsSchema:{textSpeed:{type:"number",defaultValue:30,minValue:1,maxValue:100,step:5,name:"Text Speed",description:"The speed at which text plays."},animateText:{type:"boolean",defaultValue:!0,name:"Animate Text",description:"Whether or not text should animate."},fontSize:{type:"integer",defaultValue:16,minValue:8,maxValue:64,step:1,name:"Font Size",description:"The base font size for the game."}},customSettings:{},customSettingsSchema:{}}),actions:{reset(e){this.$reset(),this.updateConfig(e)},getSetting(e){if(typeof this.baseSettings[e]<"u")return this.baseSettings[e];if(typeof this.customSettings[e]<"u")return this.customSettings[e];ae(`Setting ${e} does not exist.`)},getSettingSchema(e){if(typeof this.settingsSchema[e]<"u")return this.settingsSchema[e];if(typeof this.customSettingsSchema[e]<"u")return this.customSettingsSchema[e];ae(`Setting ${e} does not exist.`)},getAllSettingSchemas(){return{...this.settingsSchema,...this.customSettingsSchema}},setSetting(e,t){typeof this.baseSettings[e]<"u"?this.baseSettings[e]=t:typeof this.customSettings[e]<"u"?this.customSettings[e]=t:ae(`Setting ${e} does not exist.`),e==="fontSize"&&document.documentElement.style.setProperty("font-size",`${t}px`),e==="textSpeed"&&(le().dialogPanel.textSpeed=t),e==="animateText"&&(le().dialogPanel.animateText=t)},updateConfig(e){var t;if(this.setSetting("textSpeed",e.dialogPanel.textSpeed??Vo),this.setSetting("animateText",e.dialogPanel.animateText??!0),this.setSetting("fontSize",e.layout.defaultFontSize??16),(t=e.settings)!=null&&t.customSettings)for(const n in e.settings.customSettings)this.addCustomSetting(n,e.settings.customSettings[n])},addCustomSetting(e,t){this.customSettings[e]=t.defaultValue,this.customSettingsSchema[e]=t},generateSaveData(){return{baseSettings:Re(this.baseSettings),customSettings:Re(this.customSettings)}},loadSaveData(e){for(const t in e.baseSettings)this.setSetting(t,e.baseSettings[t]);for(const t in e.customSettings)typeof this.customSettings[t]<"u"&&this.setSetting(t,e.customSettings[t])}}});function io(e,t=50,n={}){let r;const o=n.isImmediate??!1,a=n.callback??!1,s=n.maxWait;let c=Date.now(),d=[];function u(){if(s!==void 0){const l=Date.now()-c;if(l+t>=s)return s-l}return t}const h=function(...l){const f=this;return new Promise((m,y)=>{const b=function(){if(r=void 0,c=Date.now(),!o){const I=e.apply(f,l);a&&a(I),d.forEach(({resolve:x})=>x(I)),d=[]}},S=o&&r===void 0;r!==void 0&&clearTimeout(r);const T=u();if(r=setTimeout(b,T),S){const I=e.apply(f,l);return a&&a(I),m(I)}d.push({resolve:m,reject:y})})};return h.cancel=function(l){r!==void 0&&clearTimeout(r),d.forEach(({reject:f})=>f(l)),d=[]},h}const Je=et("rendering",{state:()=>({screenHeight:window.innerHeight,screenWidth:window.innerWidth,layoutMode:"horizontal",resizeObserver:null,containerElement:null,narratAppElement:null,dialogPanelMode:"auto"}),actions:{generateSaveData(){return{dialogPanelMode:this.dialogPanelMode}},loadSaveData(e){this.dialogPanelMode=e.dialogPanelMode},reset(){this.dialogPanelMode="auto"},updateScreenSize(e,t){this.screenHeight=t,this.screenWidth=e,e<le().layout.verticalLayoutThreshold?(this.layoutMode="vertical",document.querySelector("html").style.fontSize=`${sn().baseSettings.fontSize}px`??"40px"):(this.layoutMode="horizontal",document.querySelector("html").style.fontSize=`${sn().baseSettings.fontSize}px`??"16px")},setContainer(e){this.containerElement=e,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeObserver=new ResizeObserver(io(()=>{this.refreshScreenSize()},100,{maxWait:200})),this.resizeObserver.observe(e),this.refreshScreenSize()},refreshScreenSize(){const e=this.containerElement;e&&this.updateScreenSize(e.clientWidth,e.clientHeight)}},getters:{gameScaleRatio(e){return vs(this.screenWidth,this.screenHeight,this.gameWidth,this.gameHeight)},overlayMode(e){return!!(le().dialogPanel.overlayMode&&e.layoutMode==="horizontal")},gameWidth(){const e=le();return this.layoutMode==="vertical"||this.overlayMode?e.layout.backgrounds.width:e.layout.backgrounds.width+Ii()},gameHeight(){const e=le();return this.layoutMode==="vertical",e.layout.backgrounds.height},dialogWidth(){return this.layoutMode==="vertical"?this.viewportWidth:Ii()},dialogHeight(){return this.layoutMode==="vertical"?this.actualGameHeight-this.gameHeight:le().dialogPanel.height??this.gameHeight},actualGameHeight(){let e=this.gameHeight;return this.layoutMode==="vertical"&&(e=this.screenHeight/this.gameScaleRatio),e},viewportRatio(e){if(this.layoutMode==="vertical"){const t=le().layout.backgrounds;return e.screenWidth/t.width}return 1},viewportHeight(e){return le().layout.backgrounds.height*this.viewportRatio},viewportWidth(e){return le().layout.backgrounds.width*this.viewportRatio},showDialog(e){if(this.dialogPanelMode==="on")return!0;if(this.dialogPanelMode==="off")return!1;if(!this.overlayMode||this.layoutMode==="vertical")return!0;const t=Te().inScript;let n=!0;return Ut().isTransitioning&&le().dialogPanel.hideDuringTransition&&(n=!1),!le().dialogPanel.showAfterScriptEnd&&!t&&(n=!1),n},container(){return this.containerElement?this.containerElement:document.body},inputsContainer(){return Te().hasCustomContainer?this.container:window},narratApp(){return this.narratAppElement?this.narratAppElement:document.body}}});class f_ extends EventTarget{constructor(){super(...arguments);xe(this,"gamepadAvailable",!0);xe(this,"gameActions",{});xe(this,"keyboardState",{});xe(this,"actions",{});xe(this,"lastInputMethodUsed","km");xe(this,"gamepad",null)}kbEvent(){this.changeLastInput("km")}getGamepads(){return navigator.getGamepads?navigator.getGamepads():(this.gamepadAvailable=!1,[])}gamepadEvent(){this.changeLastInput("gamepad")}mouseEvent(){this.changeLastInput("km")}changeLastInput(n){this.lastInputMethodUsed!==n&&(this.lastInputMethodUsed=n,this.dispatchEvent(new CustomEvent("change-input",{detail:n})))}getGamepad(){const n=this.getGamepads().filter(r=>r!==null);if(n.length>0)return n[0]}startListening(){this.updateGamepad();const n=Je().inputsContainer;n.addEventListener("mousemove",r=>{this.mouseEvent()}),n.addEventListener("keydown",r=>{this.kbEvent();const o=this.getKeyboardState(r.key).current;this.keyboardState[r.key]={previous:o,current:!0}}),n.addEventListener("keyup",r=>{this.kbEvent();const o=this.getKeyboardState(r.key).current;this.keyboardState[r.key]={previous:o,current:!1}}),oo.on("preUpdate",()=>{this.update()})}updateGamepad(){const n=this.getGamepad();n?this.gamepad?this.updateAllNarratButtons(n,this.gamepad):this.gamepad=this.setupNarratGamepad(n):this.gamepad=null}setupNarratGamepad(n){return{id:n.id,gamepad:n,buttons:n.buttons.map((o,a)=>this.getNarratButtonFromGamepad(o,o,a))}}updateAllNarratButtons(n,r){for(const[o,a]of n.buttons.entries()){const s=r.buttons[o];s.previous=Re(s.state),s.state=Re(a),s.previous.pressed!==s.state.pressed&&this.gamepadEvent()}}getNarratButtonFromGamepad(n,r,o){return{index:o,state:Re(r),previous:Re(r)}}addAction(n){if(this.gameActions[n.id]=n,n.type==="button"){const r={config:n,active:!1,justPressed:!1,justReleased:!1};this.actions[n.id]={state:r,previous:Re(r)}}else{const r={config:n,value:Z.Vec2.create(0,0),fullState:{left:0,right:0,up:0,down:0}};this.actions[n.id]={state:r,previous:Re(r)}}}getAnalog(n){return this.actions[n]||ae(`Action ${n} does not exist`),this.actions[n].state}getButton(n){return this.actions[n]||ae(`Action ${n} does not exist`),this.actions[n].state}getKeyboardState(n){return this.keyboardState[n]?this.keyboardState[n]:(this.keyboardState[n]={current:!1,previous:!1},this.keyboardState[n])}getGamepadState(n){return this.gamepad&&this.gamepad.buttons.length>n?{current:this.gamepad.buttons[n].state,previous:this.gamepad.buttons[n].previous}:null}debugGamepad(){if(this.gamepad)for(const[n,r]of this.gamepad.buttons.entries())r.state.pressed,r.previous.pressed}update(){this.updateGamepad(),this.debugGamepad();for(const n of Object.values(this.gameActions))if(n.type==="button"){const r=this.actions[n.id],o=Re(r.state),a=r.state;r.previous=o,n.action==="press"&&(n.keybinds.some(c=>{let d=!1;if(typeof c.keyboardKey=="string"&&this.getKeyboardState(c.keyboardKey).current===!0&&(d=!0),typeof c.gamepadButton=="number"){const u=this.getGamepadState(c.gamepadButton);u&&u.current.pressed===!0&&(d=!0)}return d})?a.active=!0:a.active=!1,a.active&&!o.active?a.justPressed=!0:a.justPressed=!1,!a.active&&o.active?a.justReleased=!0:a.justReleased=!1)}else if(n.type==="analog"){const r=this.actions[n.id],o=r.state;Re(r.state),r.previous=Re(o);let a=Z.Vec2.create(0,0);n.keybinds.forEach(s=>{this.getKeyboardState(s.left).current&&(o.fullState.left=1,a.x-=1),this.getKeyboardState(s.right).current&&(o.fullState.right=1,a.x+=1),this.getKeyboardState(s.up).current&&(o.fullState.up=1,a.y-=1),this.getKeyboardState(s.down).current&&(o.fullState.down=1,a.y+=1)}),a=Z.Vec2.normalize(a),o.value=a}}}const xn=new f_,ht=et("menu",{state:()=>({menus:{},activeMenu:!1}),getters:{showSkills(){return Object.entries(dn().skills).length>0},showInventory(){return Object.entries(wi().items).length>0},showQuests(){return Object.entries(So().quests).length>0},showAchievements(){return Object.entries(wo().achievements).length>0},menuTabsToShow(e){return e.menus.menu.tabs.map(t=>{const n=le().menuButtons[t.id]||{};return{...t,...n}}).filter(t=>t.condition?t.condition():!0)},menu(e){return e.activeMenu?e.menus[e.activeMenu]:void 0},tab(){if(this.menu)return this.menu.tabs[this.menu.activeTab]}},actions:{setup(){},addMenu(e,t){this.menus[e]={...t,id:e}},addMenuOption(e,t){this.menus[e]||(this.menus[e]={id:e,label:e,tabs:[],activeTab:0}),this.menus[e].tabs.push(t)},setActiveTab(e){this.menu&&(this.menu.activeTab=e)},openMenu(e){this.activeMenu=e},closeMenu(){this.activeMenu=!1},toggleMenu(){this.activeMenu?this.activeMenu=!1:this.activeMenu="menu"}}}),p_=[{id:"left",type:"button",action:"press",keybinds:[{keyboardKey:"ArrowLeft",gamepadButton:14}]},{id:"right",type:"button",action:"press",keybinds:[{keyboardKey:"ArrowRight",gamepadButton:15}]},{id:"up",type:"button",action:"press",keybinds:[{keyboardKey:"ArrowUp",gamepadButton:12}]},{id:"down",type:"button",action:"press",keybinds:[{keyboardKey:"ArrowDown",gamepadButton:13}]},{id:"continue",type:"button",action:"press",keybinds:[{keyboardKey:"Enter",gamepadButton:0}]},{id:"cancel",type:"button",action:"press",keybinds:[{keyboardKey:"Escape",gamepadButton:1}]},{id:"system",type:"button",action:"press",keybinds:[{keyboardKey:"n",gamepadButton:9}]},{id:"menu",type:"button",action:"press",keybinds:[{keyboardKey:"m",gamepadButton:8}]},{id:"previousTab",type:"button",action:"press",keybinds:[{keyboardKey:"p",gamepadButton:4}]},{id:"nextTab",type:"button",action:"press",keybinds:[{keyboardKey:"o",gamepadButton:5}]},{id:"subPreviousTab",type:"button",action:"press",keybinds:[{keyboardKey:"i",gamepadButton:6}]},{id:"subNextTab",type:"button",action:"press",keybinds:[{keyboardKey:"u",gamepadButton:7}]},{id:"viewportSelect",type:"button",action:"press",keybinds:[{keyboardKey:"v",gamepadButton:2}]},{id:"autoPlay",type:"button",action:"press",keybinds:[{keyboardKey:"a",gamepadButton:6}]},{id:"skip",type:"button",action:"press",keybinds:[{keyboardKey:"s",gamepadButton:7}]}],Ke=et("inputs",{state:()=>({inputStack:[],baseInputListener:null,inputMode:"mk",inGameInputListener:null}),actions:{setupInputs(){xn.addEventListener("change-input",e=>{this.inputMode=e.detail});for(const e of p_)xn.addAction(e);this.listenToBaseNarratInputs(),oo.on("preUpdate",()=>{for(const[e,t]of Object.entries(xn.actions))if(t.state.config.type==="button"){const n=t;n.state.justPressed&&this.triggerListeners(e,"press",n),n.state.justReleased&&this.triggerListeners(e,"release",n)}else t.state.config.type})},createInGameInputListener(){this.inGameInputListener||(this.inGameInputListener=this.registerInputListener("in-game",{system:{press:()=>{ht().openMenu("system")}},menu:{press:()=>{ht().openMenu("menu")}}}))},removeInGameInputListener(){this.inGameInputListener&&(this.unregisterInputListener(this.inGameInputListener),this.inGameInputListener=null)},listenToContainerInputs(){xn.startListening()},listenToBaseNarratInputs(){},triggerListeners(e,t,n){const r=this.inputStack[this.inputStack.length-1];if(r&&r.actions[e]&&r.actions[e][t])if(n.state.config.type==="button"){const o=r.actions[e][t],a=n;o(n.state.config,a.state,a.previous)}else console.warn("Analog events not implemented yet")},getInputs(){return xn},registerInputListener(e,t){const r={id:`${Date.now()}-${Math.floor(Math.random()*1e8)}`,name:e,actions:t??{}};return this.inputStack.push(r),r},unregisterInputListener(e){const t=this.inputStack.findIndex(n=>n.id===e.id);if(t===-1)throw new Error("Input listener not found");this.inputStack.splice(t,1)},registerActions(e,t,n){e.actions[t]=n}}}),Nt=et("scenes-store",{state:()=>({scenes:{},activeScene:"engine-splash",currentOptions:{}}),getters:{isPlaying(e){return e.activeScene!=="engine-splash"&&e.activeScene!=="game-splash"&&e.activeScene!=="start-menu"}},actions:{generateSaveData(){return{activeScene:this.activeScene}},loadSaveData(e){},changeScene(e,t){const n=this.activeScene;if(n&&n!==e){const r=this.scenes[n];r.onLeaving&&r.onLeaving(),this.currentOptions={},this.activeScene=e,this.currentOptions=t||{},this.scenes[e].onStarting&&this.scenes[e].onStarting()}},getSceneConfig(e){return this.scenes[e]},onEngineSplashFinished(){this.changeScene("game-splash")},finishedScene(e){this.scenes[e].onFinished&&this.scenes[e].onFinished()},addNewScene(e){this.scenes[e.id]=e}}}),m_={id:"game-splash-screen",style:{height:"100%",padding:"20px"},class:"flex justify-center items-center"},h_={id:"game-splash-screen-header flex justify-center flex-col items-center",class:"flex justify-center flex-col items-center"},y_={class:"title",id:"game-splash-title"},Ss=i.defineComponent({__name:"game-splash",setup(e){const t=i.ref(null),n=Te(),r=i.computed(()=>{var d;return((d=le().splashScreens)==null?void 0:d.gameSplashScreen)??{}}),o=i.computed(()=>typeof r.value.startButtonText=="string"?r.value.startButtonText:"Press to start"),a=i.computed(()=>n.loading.loaded),s=i.computed(()=>le().gameTitle||"Narrat Game");function c(){Nt().changeScene("start-menu")}return i.onMounted(()=>{t.value=Ke().registerInputListener("game-splash",{continue:{press:()=>{c()}},system:{press:()=>{c()}}}),n.options.debug&&c()}),i.onUnmounted(()=>{t.value&&Ke().unregisterInputListener(t.value)}),(d,u)=>(i.openBlock(),i.createElementBlock("div",m_,[i.createElementVNode("div",h_,[i.createElementVNode("h1",y_,i.toDisplayString(s.value),1),a.value?(i.openBlock(),i.createElementBlock("button",{key:0,class:"nrt-button menu-button main-menu-button large splash-start-button override",onClick:c},i.toDisplayString(o.value),1)):i.createCommentVNode("",!0)])]))}});function Sn(e){if(!e.listener)return console.warn("No input listener provided for navigation"),null;const t=i.ref(-1),n=i.computed(()=>e.mode==="grid"?t.value%e.columns:0),r=i.ref([]),o=i.ref(xn.lastInputMethodUsed),a=i.ref(null);function s(){var W,X;return(W=e.container)!=null&&W.value?e.container.value.children:(X=e.elements)!=null&&X.value?e.elements.value.filter(G=>G!==null):[]}function c(){r.value=s()}const d=i.computed(()=>l(t.value));function u(W){return r.value?W>=0&&W<r.value.length:!1}function h(W){const X=t.value;if(u(W)&&(t.value=W,d.value)){o.value==="gamepad"&&d.value.classList.add("selected");const G=l(X);G&&X!==W&&G.classList.remove("selected"),e.onSelected&&e.onSelected(W)}}function l(W){return r.value?r.value[W]:null}function f(){r.value&&(t.value===0?e.loopForbidden||h(r.value.length-1):h(t.value-1))}function m(){r.value&&(t.value===r.value.length-1?e.loopForbidden||h(0):h(t.value+1))}function y(){if(!r.value)return;const W=e,X=t.value;!e.loopForbidden&&X<W.columns?h(r.value.length-1):h(t.value-e.columns)}function b(){if(!r.value)return;const W=e,X=t.value;!e.loopForbidden&&X>=r.value.length-W.columns?h(0):h(t.value+e.columns)}function S(){e.mode==="grid"?y():e.mode==="list"&&f()}function T(){e.mode==="grid"?b():e.mode==="list"&&m()}function I(){(e.mode==="grid"||e.mode==="list")&&f()}function x(){(e.mode==="grid"||e.mode==="list")&&m()}function B(){e.onChosen&&e.onChosen(t.value)}i.onMounted(()=>{Y()});function F(){e.listener&&(e.onlyVertical||(delete e.listener.actions.left,delete e.listener.actions.right),e.onlyHorizontal||(delete e.listener.actions.up,delete e.listener.actions.down),e.noChoosing||delete e.listener.actions.continue,a.value&&xn.removeEventListener("change-input",a.value))}function L(){d.value&&d.value.classList.add("selected")}function P(){d.value&&d.value.classList.remove("selected")}function Y(){e.listener&&(c(),a.value=W=>{o.value=W.detail,W.detail==="gamepad"?L():P()},xn.addEventListener("change-input",a.value),e.onlyVertical||(e.listener.actions.left={press:I},e.listener.actions.right={press:x}),e.onlyHorizontal||(e.listener.actions.up={press:S},e.listener.actions.down={press:T}),e.noChoosing||(e.listener.actions.continue={press:B}),h(0))}return i.onUnmounted(()=>{F()}),i.watch(()=>{var W;return(W=e.elements)==null?void 0:W.value},W=>{W&&c()}),{selectedIndex:t,selectedElement:d,currentColumn:n,buttonDown:T,buttonUp:S,buttonLeft:I,buttonRight:x,selectUp:y,selectDown:b,selectPrevious:f,selectNext:m,select:h,disable:F,mount:Y}}const g_={class:"used-save-slot flex flex-row justify-between items-center grow"},__={class:"flex flex-col save-slot-number-container"},b_={class:"save-slot-number"},T_={class:"flex flex-col justify-center save-info"},v_={key:1,class:"save-name"},S_={class:"flex flex-col"},w_={key:0},k_={key:1},C_={key:2},$_=["onClick"],ws=i.defineComponent({__name:"save-slot-ui",props:{saveSlot:{},id:{},actions:{},selected:{type:Boolean},inputListener:{}},emits:["choice","cancel"],setup(e,{expose:t,emit:n}){var B;const r=e,o=i.ref(null),a=i.ref(null),s=i.ref(null);t({slotContainer:s});const c=i.ref(((B=r.saveSlot.saveData)==null?void 0:B.metadata.name)??"Empty Save"),d=i.ref(0),u=i.computed(()=>r.saveSlot.saveData!==null),h=i.computed(()=>r.saveSlot.saveData),l=i.computed(()=>le().saves.mode),f=i.computed(()=>{const F=r.saveSlot.saveData;if(F&&F.screen.layers[0]){const L=xr(F.screen.layers[0]);if(L)return{backgroundImage:`url(${Lr(L.background)})`}}return!1}),m=n;function y(F){m("choice",F)}function b(F){return h.value?Fi(h.value.main.playTime/1e3):"00:00:00"}function S(){h.value&&Cp(r.saveSlot.id,c.value)}function T(){const F=le().saves.slots;let L="";const P=r.saveSlot.slotNumber;return P===0&&le().saves.mode==="manual"?"AUTO":(F>=10&&P<10&&(L+="0"),F>=100&&P<100&&(L+="0"),L+P)}function I(){o.value=Sn({mode:"list",container:a,listener:r.inputListener,onlyHorizontal:!0,onSelected:F=>{d.value=F},onChosen:F=>{y(F)}}),o.value.mount()}function x(){o.value.disable(),o.value=null}return i.watch(()=>r.selected,(F,L)=>{F&&!o.value&&I(),!F&&o.value&&x()}),i.onUnmounted(()=>{o.value&&x()}),(F,L)=>(i.openBlock(),i.createElementBlock("div",{class:"save-slot flex flex-row",ref_key:"slotContainer",ref:s},[i.createElementVNode("div",g_,[i.createElementVNode("div",__,[i.createElementVNode("h1",b_,i.toDisplayString(T()),1)]),f.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"save-slot-screenshot",style:i.normalizeStyle(f.value)},null,4)):i.createCommentVNode("",!0),i.createElementVNode("div",T_,[u.value?i.withDirectives((i.openBlock(),i.createElementBlock("input",{key:0,type:"text",class:"save-name","onUpdate:modelValue":L[0]||(L[0]=P=>c.value=P),onInput:S},null,544)),[[i.vModelText,c.value]]):(i.openBlock(),i.createElementBlock("h3",v_,i.toDisplayString(c.value),1)),i.createElementVNode("div",S_,[h.value?(i.openBlock(),i.createElementBlock("p",w_,i.toDisplayString(new Date(h.value.metadata.saveDate).toLocaleString()),1)):i.createCommentVNode("",!0),h.value?(i.openBlock(),i.createElementBlock("p",k_,"Play time: "+i.toDisplayString(b(F.saveSlot)),1)):i.createCommentVNode("",!0),l.value==="game-slots"?(i.openBlock(),i.createElementBlock("p",C_,i.toDisplayString(F.saveSlot.slotType==="auto"?"Auto Save":"Manual Save"),1)):i.createCommentVNode("",!0)])]),i.createElementVNode("div",{class:"flex flex-row",ref_key:"actionsContainer",ref:a},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(F.actions,(P,Y)=>(i.openBlock(),i.createElementBlock("button",{class:i.normalizeClass(["nrt-button",{selected:F.selected&&Y===d.value}]),onClick:()=>y(Y),key:Y},[i.createElementVNode("h3",null,i.toDisplayString(P),1)],10,$_))),128))],512)])],512))}}),E_=i.createElementVNode("h3",{class:"title"},"Confirmation",-1),Xo=i.defineComponent({__name:"yes-no",props:{prompt:{type:String,required:!0},onConfirm:{type:Function,required:!1},onRefuse:{type:Function,required:!1}},emits:["choice"],setup(e,{emit:t}){const n=i.ref(Ke().registerInputListener("yes-no",{cancel:{press:()=>{s(!1)}},continue:{press:()=>{s(!0)}}})),r=i.ref(null);Sn({mode:"list",container:r,listener:n.value,onChosen:c=>{s(c===0)}});const o=e,a=t;function s(c){c===!0&&o.onConfirm?o.onConfirm():c===!1&&o.onRefuse&&o.onRefuse(),a("choice",c)}return i.onMounted(()=>{}),i.onUnmounted(()=>{n.value&&Ke().unregisterInputListener(n.value)}),(c,d)=>(i.openBlock(),i.createBlock(_n,{onClose:d[2]||(d[2]=()=>s(!1)),containerCssClass:"yes-no-modal"},{header:i.withCtx(()=>[E_]),body:i.withCtx(()=>[i.createElementVNode("h3",null,i.toDisplayString(e.prompt),1),i.createElementVNode("div",{class:"flex justify-center",ref_key:"buttonsContainer",ref:r},[i.createElementVNode("button",{class:"nrt-button",onClick:d[0]||(d[0]=()=>s(!0))},"Yes"),i.createElementVNode("button",{class:"nrt-button",onClick:d[1]||(d[1]=()=>s(!1))},"No")],512)]),_:1}))}}),O_={class:"nrt-title"},A_={key:0},I_={class:"saves-section"},N_=i.createElementVNode("h3",{class:"saves-section-title"},"Auto save",-1),P_={class:"saves-section"},j_=i.createElementVNode("h3",{class:"saves-section-title"},"Manual Saves",-1),D_={key:1,class:"saves-section"},x_=i.createElementVNode("h3",{class:"saves-section-title"},"Save Slots",-1),L_={class:"saves-container flex flex-col"},Ju=i.defineComponent({__name:"save-slots",props:{mode:{}},emits:["chosen","close"],setup(e,{emit:t}){const n=e,r=i.ref(Ke().registerInputListener("save-slots",{cancel:{press:()=>{Y()}}})),o=i.ref(0),a=i.reactive([]),s=i.computed(()=>a.slice(0,1)),c=i.computed(()=>a.slice(1)),d=i.ref([]),u=i.ref([]),h=i.ref([]),l=i.ref([]),f=i.ref([]);i.ref({mode:"list",elements:l,listener:r.value,onlyVertical:!0,noChoosing:!0,onSelected:G=>{o.value=G}});const m=Sn({mode:"list",elements:l,listener:r.value,onlyVertical:!0,noChoosing:!0,onSelected:G=>{o.value=G}}),y=i.computed(()=>{const G=o.value;return f.value.length<G+1?null:f.value[G].id}),b=i.reactive(n.mode==="load"?["Load","Delete"]:["Choose"]),S=i.computed(()=>le().saves.mode),T=i.reactive({prompt:"Are you sure you want to delete this save file?",saveToDelete:null,onConfirm:()=>{P(T.saveToDelete),T.saveToDelete=null},onRefuse:()=>{T.saveToDelete=null}}),I=i.reactive({prompt:"Are you sure you want to overwrite this save file?",saveToOverwrite:null,onConfirm:()=>{F(I.saveToOverwrite),I.saveToOverwrite=null},onRefuse:()=>{I.saveToOverwrite=null}}),x=t;i.onBeforeMount(()=>{bn().slots.forEach((Q,te)=>{a[te]=Q})});function B(){l.value=S.value==="manual"?[...u.value.map(z=>z.slotContainer),...h.value.map(z=>z.slotContainer)]:d.value.map(z=>z.slotContainer);const G=S.value==="manual"?[...s.value,...c.value]:a;f.value=G.map(z=>({id:z.id}))}i.onMounted(()=>{B()}),i.onUnmounted(()=>{m.value&&(m.value.disable(),m.value=null),r.value&&Ke().unregisterInputListener(r.value)});function F(G){x("chosen",{slotId:G})}function L(G){const z=X(G);if(z){if(le().saves.mode==="manual"&&z.slotType==="auto"){Te().alert("Sorry","Can't delete the auto save slot!");return}T.saveToDelete=G}}function P(G){kp(G);const z=a.find(Q=>Q.id===G);z&&(z.saveData=null),B()}function Y(){x("close")}function W(G,z){const Q=b[z];Q==="Load"?F(G):Q==="Delete"?L(G):Q==="Choose"&&(I.saveToOverwrite=G)}function X(G){return a.find(z=>z.id===G)}return(G,z)=>(i.openBlock(),i.createBlock(_n,{onClose:Y,containerCssClass:"save-modal",cantClose:!1},{header:i.withCtx(()=>[i.createElementVNode("h3",O_,i.toDisplayString(G.mode==="load"?"Choose a save to load":"Pick a slot to save the game"),1)]),body:i.withCtx(()=>[S.value==="manual"?(i.openBlock(),i.createElementBlock("div",A_,[i.createElementVNode("div",I_,[N_,i.createVNode(i.TransitionGroup,{name:"list",tag:"div"},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,Q=>(i.openBlock(),i.createBlock(ws,{key:Q.id,saveSlot:Q,id:Q.id,actions:b,onChoice:te=>W(Q.id,te),inputListener:r.value,selected:y.value===Q.id,ref_for:!0,ref_key:"autoSlotsElements",ref:u},null,8,["saveSlot","id","actions","onChoice","inputListener","selected"]))),128))]),_:1})]),i.createElementVNode("div",P_,[j_,i.createVNode(i.TransitionGroup,{name:"list",tag:"div"},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.value,Q=>(i.openBlock(),i.createBlock(ws,{key:Q.id,saveSlot:Q,id:Q.id,actions:b,onChoice:te=>W(Q.id,te),inputListener:r.value,selected:y.value===Q.id,ref_for:!0,ref_key:"manualSlotsElements",ref:h},null,8,["saveSlot","id","actions","onChoice","inputListener","selected"]))),128))]),_:1})])])):(i.openBlock(),i.createElementBlock("div",D_,[x_,i.createElementVNode("div",L_,[i.createVNode(i.TransitionGroup,{name:"list",tag:"div"},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a,Q=>(i.openBlock(),i.createBlock(ws,{key:Q.id,saveSlot:Q,id:Q.id,actions:b,onChoice:te=>W(Q.id,te),selected:y.value===Q.id,inputListener:r.value,ref_for:!0,ref_key:"saveSlotsElements",ref:d},null,8,["saveSlot","id","actions","onChoice","selected","inputListener"]))),128))]),_:1})])])),T.saveToDelete?(i.openBlock(),i.createBlock(Xo,{key:2,prompt:T.prompt,onRefuse:T.onRefuse,onConfirm:T.onConfirm},null,8,["prompt","onRefuse","onConfirm"])):i.createCommentVNode("",!0),I.saveToOverwrite?(i.openBlock(),i.createBlock(Xo,{key:3,prompt:I.prompt,onRefuse:I.onRefuse,onConfirm:I.onConfirm},null,8,["prompt","onRefuse","onConfirm"])):i.createCommentVNode("",!0)]),_:1}))}}),M_=i.defineComponent({__name:"start-menu-button",props:{button:{}},emits:["click"],setup(e){return(t,n)=>(i.openBlock(),i.createElementBlock("button",{class:i.normalizeClass(["nrt-button menu-button main-menu-button large override",t.button.cssClass]),onClick:n[0]||(n[0]=r=>t.$emit("click"))},i.toDisplayString(t.button.title),3))}});class ks extends Ts{setup(t=!1){const r=t?"keydown":"keyup",o=io(s=>{qt.emit("debouncedKeydown",s)},10,{isImmediate:!0,maxWait:10}),a=Je().inputsContainer;a.addEventListener("keydown",s=>{qt.emit("keydown",s)}),a.addEventListener(r,s=>{o(s)})}}const qt=new ks,Cs=et("startMenu",{state:()=>({buttons:[]}),actions:{addButtonsFromPlugins(){Ie.plugins.forEach(t=>{t.startMenuButtons&&t.startMenuButtons.forEach(n=>{const r=window.narrat.app;n.popupComponent&&r.component(n.popupComponent.name,n.popupComponent.component),this.buttons.push(n)})})}}});function R_(){ad()}function Xu(){R_(),Te().menuReturn()}async function B_(e){if(le().saves.mode==="manual"){const t=Ui();t&&(e=t.id)}Te().setSaveSlot(e),ld(bn().globalSave),Zu(),we().runGame()}function Zu(){ft().stopAll(),Qn("onPressStart"),we().start(),Te().prepareToPlay(),Ie.callHook("onGameStart")}async function F_(e,t){if(le().saves.mode==="manual"){const n=Ui();n&&(t=n.id)}if(Te().setSaveSlot(t),Zu(),e.saveData){tT({gameSave:e.saveData,globalSave:bn().globalSave}),ft().reloadAudio(e.saveData.audio);const n=we(),r=le().saves.runOnReload;typeof r=="string"&&await we().runLabelFunction(r),n.jumpToLabel(e.saveData.vm.lastLabel)}}const V_={id:"game-menu"},U_={id:"game-header",class:"flex flex-col justify-between items-center"},q_={id:"game-title-container"},H_={id:"game-title-text"},K_={class:"nrt-title"},$s=zt(i.defineComponent({__name:"StartMenu",setup(e){const t=i.ref(Ke().registerInputListener("start-menu",{})),n=i.ref([]),r=i.ref(null),o=i.ref(!1),a=i.ref(!1),s=i.ref(null),c=i.ref(null),d=i.ref(!1),u=i.ref(!1),h=i.ref(null),l=Cs(),f=i.ref(!1),m=i.ref(null),y=i.computed(()=>l.buttons),b=Sn({mode:"list",container:r,listener:t.value,onChosen:Q=>{S(n.value[Q])}});function S(Q){switch(Q.id){case"continue":P();break;case"new-game":T();break;case"load-game":Y();break;case"exit":Te().exitGame();break;default:x(Q);break}}async function T(){o.value&&le().saves.mode==="manual"&&!le().saves.disabled?u.value=!0:I()}async function I(){if(c.value===null)if(le().saves.mode==="manual"){const Q=Ui();if(!Q){ae("No autosave found");return}c.value=Q.id}else{const Q=Sp();if(!Q){ae("No free slot found");return}c.value=Q}u.value=!1,await B_(c.value)}function x(Q){const te=y.value.findIndex(Ne=>Ne.id===Q.id),ke=y.value[te];ke.action&&ke.action(),ke.popupComponent&&(f.value=ke)}function B(){f.value=!1}function F(){u.value=!1}async function L(){if(!c.value)return;const Q=Gr(c.value);if(!Q){ae("No save file found");return}F_(Q,c.value)}function P(){typeof s.value=="string"&&(c.value=s.value,L())}function Y(){d.value=!0}function W({slotId:Q}){const te=Gr(Q);te&&te.saveData?(c.value=Q,L()):T()}i.onMounted(()=>{const Q=bn();Q.slots.some(te=>te.saveData)&&(o.value=!0),(le().saves.mode==="manual"||Q.slots.some(te=>!te.saveData))&&(a.value=!0),Q.lastSaveSlot&&Gr(Q.lastSaveSlot)&&(s.value=Q.lastSaveSlot),X(),h.value=qt.on("debouncedKeydown",te=>{te.key===" "&&I(),te.key==="c"&&P()}),i.nextTick(()=>{b.select(0)}),Lt().options.defaultMusic&&(m.value=um(Lt().options.defaultMusic))});function X(){const Q=le().saves.disabled;s.value&&!Q&&n.value.push(G({id:"continue",title:"Continue",cssClass:"continue-button"})),a.value&&n.value.push(G({id:"new-game",title:"New Game",cssClass:"start-button"})),o.value&&!Q&&n.value.push(G({id:"load-game",title:"Load Game",cssClass:"continue-button"}));for(const te of y.value)n.value.push({id:te.id,title:te.text,cssClass:`${te.id}-start-menu-button`});n.value.push(G({id:"exit",title:"Exit",cssClass:"exit-button"}))}function G({id:Q,title:te,cssClass:ke}){const Ne=le().menuButtons[Q];if(Ne){let Ze=ke;return Ne.cssClass&&(Ze=`${Ne.cssClass} ${ke}`),{id:Q,title:Ne.text??te,cssClass:Ze}}return{id:Q,title:te,cssClass:ke}}i.onUnmounted(()=>{if(t.value&&Ke().unregisterInputListener(t.value),h.value&&qt.off("debouncedKeydown",h.value),typeof m.value=="number"){const Q=Lt().options.defaultMusic;dm(Q,m.value)}});const z=i.computed(()=>le().gameTitle);return(Q,te)=>(i.openBlock(),i.createElementBlock("div",V_,[d.value?(i.openBlock(),i.createBlock(Ju,{key:0,mode:"load",onChosen:W,onClose:te[0]||(te[0]=ke=>d.value=!1)})):i.createCommentVNode("",!0),u.value?(i.openBlock(),i.createBlock(Xo,{key:1,prompt:"This will override your previous autosave, are you sure?",onConfirm:I,onRefuse:F})):i.createCommentVNode("",!0),i.createElementVNode("div",U_,[i.createElementVNode("div",q_,[i.createElementVNode("h1",H_,i.toDisplayString(z.value),1)]),i.createElementVNode("div",{class:"flex flex-col start-menu-buttons-container",ref_key:"buttonsContainer",ref:r},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.value,ke=>(i.openBlock(),i.createBlock(M_,{key:ke.id,button:ke,onClick:Ne=>S(ke)},null,8,["button","onClick"]))),128))],512)]),f.value?(i.openBlock(),i.createBlock(i.Teleport,{key:2,to:"#narrat"},[i.createVNode(_n,{onClose:B,class:i.normalizeClass(`start-menu-popup-${f.value.id}`)},{header:i.withCtx(()=>[i.createElementVNode("h3",K_,i.toDisplayString(f.value.text),1)]),body:i.withCtx(()=>[f.value.popupComponent?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(f.value.popupComponent.component),{key:0,onClose:B},null,32)):i.createCommentVNode("",!0)]),_:1},8,["class"])])):i.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-a3f319bb"]]);function Zo(e){const t=$i().characters[e];return t||ae(`Character ${e} not found`),t}function G_(e,t){const n=Zo(e);if(n&&(t||(t="default"),n.sprites)){const r=n.sprites[t];return r==="none"?void 0:typeof r=="string"?{image:r}:r}}function ed(e){return`${$i().config.imagesPath}${e}`}function z_(e){return typeof e=="object"&&Object.hasOwn(e,"image")}function W_(e){return typeof e=="object"&&Object.hasOwn(e,"video")}function Es(e){var t;return e?((t=Zo(e))==null?void 0:t.style)||{}:{}}const Q_=["src"],Y_=["autoplay","loop","muted"],J_=["src"],X_=i.defineComponent({__name:"dialog-picture",props:{picture:{},video:{},character:{},pose:{}},setup(e){const t=e,n=i.computed(()=>t.video),r=i.computed(()=>Je().layoutMode),o=i.computed(()=>{var d;const s={};if(!t.character)return{};t.character&&(s[t.character]=!0);const c=Zo(t.character);return(d=c==null?void 0:c.style)!=null&&d.portraitCssClass&&(s[c.style.portraitCssClass]=!0),s}),a=i.computed(()=>{var m,y;const s=Je(),c=le().layout;let d=0,u=0;const h=c.portraits;if(r.value==="vertical"){const b=((m=h.offset)==null?void 0:m.portrait)??{right:0,bottom:0};d=20+b.right,u=s.dialogHeight+b.bottom}else{const b=((y=h.offset)==null?void 0:y.landscape)??{right:0,bottom:0},S=le().dialogPanel.rightOffset??ts.dialogPanel.rightOffset;d=Ii()-10+b.right+S,u=200+b.bottom}let l=c.portraits.width,f=c.portraits.height;return t.video&&(l=t.video.width??l,f=t.video.height??f),t.picture&&(l=t.picture.width??l,f=t.picture.height??f),{right:`${d}px`,bottom:`${u}px`,width:`${l}px`,height:`${f}px`}});return(s,c)=>{var d;return i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["dialog-picture override",o.value]),style:i.normalizeStyle(a.value)},[s.picture?(i.openBlock(),i.createElementBlock("img",{key:0,src:i.unref($t)(i.unref(ed)((d=s.picture)==null?void 0:d.image)),class:i.normalizeClass(["picture override",o.value])},null,10,Q_)):i.createCommentVNode("",!0),n.value?(i.openBlock(),i.createElementBlock("video",{key:1,class:"picture override",autoplay:n.value.autoplay!==!1,loop:n.value.loop!==!1,muted:!!n.value.muted},[i.createElementVNode("source",{src:i.unref($t)(i.unref(ed)(n.value.video))},null,8,J_)],8,Y_)):i.createCommentVNode("",!0)],6)}}});function Z_(){return Lt().dialogAudio}function td(e){const t=Z_();if(t){if(t.characterAudio&&t.characterAudio[e])return t.characterAudio[e];if(t.defaultAudio)return t.defaultAudio}}function nd(e,t){if(typeof t!="string")return;const n=td(e);return n==null?void 0:n.soundPerLetter}function eb(e,t){if(typeof t!="string")return;const n=nd(e,t);if(!n)return;const r=n;let o="";return r.prefix&&(o+=r.prefix),o+=t,r.suffix&&(o+=r.suffix),o}function tb(e,t){if(typeof t!="string")return;const n=t.toLowerCase(),r=eb(e,n);if(typeof r!="string")return;const o=Qt(r);if(o){const a=nd(e,n);let s=1;a.volume&&(s=a.volume);const c=ft().audioVolume("sound",r)*s;o.volume(c),o.play()}}function nb(e){const t=td(e);if(t!=null&&t.soundOnNewLine){const n=Qt(t.soundOnNewLine);if(n){const r=ft().audioVolume("sound",t.soundOnNewLine);n.volume(r),n.play()}}}const rb=["innerHTML"],ob=["innerHTML"],ib=["innerHTML"],sb={key:1},ab=["onClick","innerHTML"],lb={key:1},cb={key:2,class:"buttons-container"},ub=i.defineComponent({__name:"dialog-box",props:{options:{},active:{type:Boolean},inputListener:{}},setup(e,{expose:t}){const n=i.ref(null),r=i.ref(""),o=i.ref(!1),a=i.ref(null),s=i.ref(null),c=i.ref(!1),d=i.ref(null),u=i.ref(null),h=i.ref(null),l=i.ref(null),f=i.ref(null),m=e,y=i.ref(null);m.active&&(y.value=Sn({mode:"list",container:n,listener:m.inputListener,onlyVertical:!0,onChosen:R=>{ee.value&&M.value?F(M.value[R]):I(" ")}})),i.onMounted(()=>{ke(),c.value=!0}),i.onUnmounted(()=>{b(),z(),nt({unmounted:!0})});function b(){a.value&&(clearTimeout(a.value),a.value=null),S()}function S(){y.value&&(y.value.disable(),y.value=null)}function T(R){I(R.key)}function I(R){if(!ee.value){c.value&&s&&R===" "&&nt({pressedSpace:!0});return}if(ee.value&&m.options.textField&&R==="Enter"&&X(),ee.value&&!m.options.textField){let J=-1;switch(R){case" ":J=0;break;case"1":J=0;break;case"2":J=1;break;case"3":J=2;break;case"4":J=3;break;case"5":J=4;break;case"6":J=5;break;case"7":J=6;break;case"8":J=7;break}J!==-1&&M.value&&J<M.value.length?F(M.value[J]):J===0&&F(J)}}function x(){ee.value||c.value&&s&&nt({pressedSpace:!0})}function B(){o.value||F(0)}function F(R){L();let J;typeof R=="object"?J=R.originalIndex:J=R,Te().playerAnswered(J)}function L(){b(),nt({unmounted:!0}),o.value=!0}function P(R){const J={};return R.allowed||(J.pointerEvents="none",J.textDecoration="line-through"),J}function Y(R,J){const fe={index:R+1,choice:J.choice};let ce='<span class="choice-index">%{$index}. </span> <span class="choice-text">%{$choice}</span>';if(Va().choiceTextTemplate&&(ce=Va().choiceTextTemplate),J.flag){const be=wf(J.flag);be!=null&&be.textTemplate&&(ce=be.textTemplate)}return Al(fe,ce)}function W(R){const J={};if(R.allowed||(J["strike-anim"]=!0),R.seenBefore&&(J["seen-before"]=!0),R.flag){const fe=wf(R.flag);fe!=null&&fe.cssClass&&(J[fe.cssClass]=!0)}return J}function X(){const R=r.value;z(),Te().playerAnswered(R)}function G(){m.options.textField&&(a.value=setTimeout(()=>{ee.value&&(f.value=Ke().registerInputListener("text-field-input-grabber",{}),l.value&&l.value.focus())},100))}function z(){f.value&&(Ke().unregisterInputListener(f.value),f.value=null)}function Q(R,J){const fe=m.options.text.substring(R,J);s.value.text+=fe;const ce=fe.substring(0,1);return tb(m.options.styleId,ce),J}function te(R){const J=R[0];return s.value.text+=J,s.value.skippedChars+=J.length,J.length}function ke(){if(!m.options.old)if(Fe().playMode==="skip")Ne();else if(nb(m.options.styleId),le().dialogPanel.animateText){s.value={text:"",index:0,startTime:Date.now(),timer:null,skippedChars:0,tags:sm(m.options.text),finished:!1};const R=s.value;R.timer=setInterval(()=>{qe()},30)}else E.value&&(d.value=setTimeout(()=>{nt()},(le().dialogPanel.textSpeed??Vo)*m.options.text.length))}function Ne(){Fe().playMode==="skip"&&!m.options.old&&(E.value?u.value=setTimeout(()=>{nt()},100):(Fe().toggleSkip(),nt({unmounted:!0})))}function Ze(){Fe().playMode==="auto"&&!m.options.old&&E.value&&ee&&B()}function qe(){const R=s.value;if(!R)return;const J=R.index,fe=Date.now()-R.startTime;let ce=!1,be=Math.round(fe/(le().dialogPanel.textSpeed??Vo))+R.skippedChars;if(be>m.options.text.length&&(ce=!0,R.finished=!0,be=m.options.text.length),be!==R.index){let ve=J;for(;R.tags.length>0&&be>=R.tags[0].index;){ve=Q(ve,R.tags[0].index);const Le=te(R.tags.shift());ve+=Le,be+=Le}ve=Q(ve,be),R.index=ve}ce&&nt()}function nt({unmounted:R,pressedSpace:J}={}){G(),setTimeout(()=>{y.value&&y.value.select(0)},10),s.value&&(s.value.timer&&clearInterval(s.value.timer),s.value=null),d.value&&!J&&clearTimeout(d.value),u.value&&clearTimeout(u.value),h.value&&clearTimeout(h.value),!R&&!J&&Fe().playMode!=="normal"&&E&&(h.value=setTimeout(()=>{B()},Fe().playMode==="auto"?le().dialogPanel.timeBetweenLines??br.common.dialogPanel.timeBetweenLines:0))}const j=i.computed(()=>m.options.title?" &nbsp;–&nbsp; ":""),g=i.computed(()=>({...Es(m.options.styleId).boxCss})),E=i.computed(()=>!M.value&&!m.options.textField),$=i.computed(()=>{const R={};return m.options.title&&(R["dialog-box-followup"]=!0),m.options.old?R["dialog-box-old"]=!0:R["dialog-box-new"]=!0,R}),_=i.computed(()=>{const R=Es(m.options.styleId);return{color:R.color,...R.nameCss}}),v=i.computed(()=>Es(m.options.styleId).textCss),C=i.computed(()=>s.value?s.value.text:m.options.text),M=i.computed(()=>{if(m.options.choices)return m.options.choices}),U=i.computed(()=>Fe().playMode==="skip"),ne=i.computed(()=>Fe().playMode==="auto"),ee=i.computed(()=>m.active&&c.value&&!o.value&&!h.value&&!s.value&&m.options.interactive&&!Ee.value),re=Te(),Ee=i.computed(()=>re.paused);return i.watch(()=>m.options,(R,J)=>{!J.old&&R.old&&s&&nt({unmounted:!0})}),i.watch(U,(R,J)=>{R&&!J&&Ne()}),i.watch(ne,(R,J)=>{R&&!J&&Ze()}),t({keyboardEvent:T}),(R,J)=>{const fe=i.resolveDirective("visible");return i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["dialog-box w-full override",$.value]),style:i.normalizeStyle(g.value)},[i.createElementVNode("div",{class:"dialog-content",onClick:x},[R.options.title?(i.openBlock(),i.createElementBlock("span",{key:0,class:"dialog-title override",style:i.normalizeStyle(_.value),innerHTML:R.options.title},null,12,rb)):i.createCommentVNode("",!0),i.createElementVNode("span",{class:"dialog-text dialog-separator override",style:i.normalizeStyle(v.value),innerHTML:j.value},null,12,ob),i.createElementVNode("span",{class:i.normalizeClass(["dialog-text override",R.options.cssClass]),style:i.normalizeStyle(v.value),innerHTML:C.value},null,14,ib),R.options.old?i.createCommentVNode("",!0):i.withDirectives((i.openBlock(),i.createElementBlock("div",sb,[M.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"dialog-choices",ref_key:"choicesDiv",ref:n},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(M.value,(ce,be)=>(i.openBlock(),i.createElementBlock("p",{key:be,style:i.normalizeStyle(P(ce)),class:i.normalizeClass([W(ce),"dialog-choice override"]),onClick:ve=>F(ce),innerHTML:Y(be,ce)},null,14,ab))),128))],512)):R.options.textField?(i.openBlock(),i.createElementBlock("div",lb,[i.withDirectives(i.createElementVNode("input",{autofocus:"",type:"text",class:"label-input nrt-input",ref_key:"playerInput",ref:l,id:"player-input-field","onUpdate:modelValue":J[0]||(J[0]=ce=>r.value=ce)},null,512),[[i.vModelText,r.value]]),i.createElementVNode("button",{onClick:X,class:"nrt-button",id:"player-input-submit"}," Submit ")])):(i.openBlock(),i.createElementBlock("div",cb,[i.createElementVNode("div",{onClick:J[1]||(J[1]=ce=>F(0)),ref:"continue",class:"interact-button nrt-button override"}," Continue ",512)]))])),[[fe,ee.value]])])],6)}}}),db={key:0,class:"auto-play-feedback-container"},fb=i.defineComponent({__name:"AutoPlayFeedback",setup(e){const t=Fe(),n=i.computed(()=>t.playMode==="auto"),r=i.computed(()=>t.playMode==="skip"),o=i.computed(()=>n.value?"auto-play-feedback-auto":r.value?"auto-play-feedback-skip":{}),a=i.computed(()=>n.value?"Auto Play":r.value?"Skip":"");return(s,c)=>a.value?(i.openBlock(),i.createElementBlock("div",db,[i.createElementVNode("div",{class:i.normalizeClass(["auto-play-feedback",o.value])},i.toDisplayString(a.value),3)])):i.createCommentVNode("",!0)}}),pb=i.createElementVNode("div",{class:"anchor"},null,-1),Os=i.defineComponent({__name:"game-dialog",setup(e){const t=i.computed(()=>Je().layoutMode),n=i.computed(()=>Ke().inGameInputListener),r=i.ref(Te().inScript),o=i.ref(null),a=Je(),s=we(),c=i.computed(()=>s.stack),d=Fe(),u=i.computed(()=>d.dialog),h=i.ref(null),l=i.ref(null),f=i.ref(null),m=i.computed(()=>{let z="0px";const Q=le().layout.dialogBottomPadding;return typeof Q=="number"?z=`${Q}px`:typeof Q=="string"&&(z=Q),{paddingBottom:z}}),y=i.computed(()=>{if(u.value.length>0)return u.value[u.value.length-1]}),b=i.computed(()=>{if(y.value)return y.value.speaker}),S=i.computed(()=>{if(y.value)return y.value.pose}),T=i.computed(()=>{if(y.value){const z=b.value;let Q=S.value;return z?(Q||(Q="idle"),Q):void 0}}),I=i.computed(()=>{if(!T.value)return;const z=b.value;return G_(z,T.value)}),x=i.computed(()=>{const z=I.value;if(z_(z))return z}),B=i.computed(()=>{const z=I.value;if(W_(z))return z}),F=i.computed(()=>a.dialogWidth),L=i.computed(()=>Te().inScript);i.watch(L,z=>{z?r.value=!0:Fe().playMode!=="normal"?(Fe().playMode==="skip"&&(Fe().playMode="normal"),o.value=setTimeout(()=>{r.value=!1},500)):r.value=!1}),i.onMounted(()=>{if(n.value){const Q=n.value;Q.actions.autoPlay={press:()=>{Fe().toggleAutoPlay()}},Q.actions.skip={press:()=>{Fe().toggleSkip()}}}const z=Q=>{l.value&&l.value.keyboardEvent&&l.value.keyboardEvent(Q)};z.value=qt.on("debouncedKeydown",z)}),i.onUnmounted(()=>{n.value&&(delete n.value.actions.autoPlay,delete n.value.actions.skip),f.value&&qt.off("debouncedKeydown",f.value),o.value&&clearTimeout(o.value)});const P=i.computed(()=>{let z;const Q=`${Je().dialogHeight}px`,te={};if(Je().overlayMode){te.position="absolute";const ke=le().dialogPanel.rightOffset??br.common.dialogPanel.rightOffset;te.right=`${ke}px`;const Ne=le().dialogPanel.bottomOffset??br.common.dialogPanel.bottomOffset;te.bottom=`${Ne}px`}return{...te,width:t.value==="horizontal"?`${F.value}px`:"100%",height:Q,transform:z,transformOrigin:"right"}});function Y(){Fe().toggleAutoPlay()}function W(){Fe().toggleSkip()}function X(z,Q){const te=Zo(z.speaker);let ke=(te==null?void 0:te.name)??"Missing Character";return Q>=1&&u.value[Q-1].speaker===z.speaker&&(ke=void 0),z.choices&&z.choices.forEach(Ne=>{Ne.choice=nn(Ne.choice)}),{title:ke??"",text:z.text,cssClass:z.cssClass,styleId:z.speaker,choices:z.choices,old:Q<u.value.length-1,interactive:z.interactive,textField:z.textField}}function G(z){return z===d.dialog.length-1&&c.value.length>0}return i.watch(u.value,z=>{if(h.value){const Q=h.value;Q.scrollTop=Q.scrollHeight+1e8}}),(z,Q)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(fb),i.createVNode(i.Transition,{name:"fade"},{default:i.withCtx(()=>[(x.value||B.value)&&i.unref(a).showDialog?(i.openBlock(),i.createBlock(X_,{key:0,picture:x.value,video:B.value,character:b.value,pose:S.value},null,8,["picture","video","character","pose"])):i.createCommentVNode("",!0)]),_:1}),i.createVNode(i.Transition,{name:"dialog-transition"},{default:i.withCtx(()=>[i.unref(a).showDialog?(i.openBlock(),i.createElementBlock("div",{key:0,class:"dialog override",ref_key:"dialogRef",ref:h,style:i.normalizeStyle(P.value)},[i.createVNode(i.TransitionGroup,{name:"list",tag:"div",class:"dialog-container w-full override",style:i.normalizeStyle(m.value)},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(u.value,(te,ke)=>(i.openBlock(),i.createBlock(ub,{ref_for:!0,ref:Ne=>l.value=Ne,key:te.id,options:X(te,ke),active:G(ke),inputListener:n.value},null,8,["options","active","inputListener"]))),128))]),_:1},8,["style"]),(i.openBlock(),i.createBlock(i.Teleport,{to:"#narrat-app"},[i.createElementVNode("div",{class:"auto-skip-buttons flex"},[i.createElementVNode("div",{class:"nrt-button menu-toggle-button auto-button auto",onClick:Y}," Auto "),i.createElementVNode("div",{class:"nrt-button menu-toggle-button auto-button skip",onClick:W}," Skip ")])])),pb],4)):i.createCommentVNode("",!0)]),_:1})],64))}}),mb=["id"],hb=["src"],yb={class:"tab-title"},rd=i.defineComponent({__name:"tab-selector",props:{tab:{},active:{type:Boolean}},emits:["click"],setup(e,{emit:t}){const n=e,r=t,o=i.computed(()=>n.active?"tab-active":"tab-inactive");function a(){r("click")}return(s,c)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["tab",o.value]),id:`tab-${s.tab.id}`,onClick:a},[i.createElementVNode("div",{class:i.normalizeClass(["tab-title-container",s.active?"active":""])},[s.tab.icon?(i.openBlock(),i.createElementBlock("img",{key:0,src:s.tab.icon,alt:"tab icon",class:"tab-icon"},null,8,hb)):i.createCommentVNode("",!0),i.createElementVNode("span",yb,i.toDisplayString(s.tab.label),1)],2)],10,mb))}}),gb={class:"tabs-controller"},_b={key:0,class:"tabs-controller__tabs"},bb={key:1,class:"tab-content"},Tb={key:2},vb=[i.createElementVNode("div",{class:"tab-content__empty"},[i.createElementVNode("p",null,"No tab selected")],-1)],Sb=i.defineComponent({__name:"TabsController",props:{tabs:{},defaultTab:{}},emits:["tab-change","close"],setup(e,{emit:t}){const n=i.ref(Ke().registerInputListener("tabs-controller",{cancel:{press:()=>{r("close")}},system:{press:()=>{r("close")}},menu:{press:()=>{r("close")}},previousTab:{press:()=>{a.value>0&&s(a.value-1)}},nextTab:{press:()=>{a.value<o.tabs.length-1&&s(a.value+1)}}})),r=t,o=e,a=i.ref(o.defaultTab);function s(d){a.value=d,r("tab-change",d)}const c=i.computed(()=>o.tabs[a.value]);return i.onUnmounted(()=>{n.value&&(Ke().unregisterInputListener(n.value),n.value=null)}),(d,u)=>(i.openBlock(),i.createElementBlock("div",gb,[d.tabs.length>1?(i.openBlock(),i.createElementBlock("div",_b,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.tabs,(h,l)=>(i.openBlock(),i.createBlock(rd,{key:h.id,tab:h,active:l===a.value,onClick:()=>s(l),inputListener:n.value},null,8,["tab","active","onClick","inputListener"]))),128))])):i.createCommentVNode("",!0),c.value?(i.openBlock(),i.createElementBlock("div",bb,[c.value?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(c.value.component),{key:0,inputListener:n.value,onClose:u[0]||(u[0]=h=>d.$emit("close"))},null,40,["inputListener"])):i.createCommentVNode("",!0)])):(i.openBlock(),i.createElementBlock("div",Tb,vb))]))}}),wb={class:"menu-container menu-toggle"},kb=["onClick","id"],Cb={class:"nrt-title"},As=i.defineComponent({__name:"menu-buttons",setup(e){const t=ht(),n=i.ref(null);i.onMounted(()=>{Ie.callHook("onGameMounted")}),i.onUnmounted(()=>{n.value&&qt.off("keydown",n.value),Ie.callHook("onGameUnmounted")});function r(h){ht().activeMenu=h}const o=i.computed(()=>t.menus),a=i.computed(()=>t.menu),s=i.computed(()=>{var h;return(((h=a.value)==null?void 0:h.tabs)??[]).filter(l=>l.condition?l.condition():!0).map(l=>({id:l.id,label:l.text,component:l.component}))});function c(){t.closeMenu()}function d(h){t.setActiveTab(h)}function u(){return c()}return(h,l)=>(i.openBlock(),i.createElementBlock("div",wb,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,(f,m)=>(i.openBlock(),i.createElementBlock("button",{key:f.id,onClick:y=>r(f.id),id:f.cssId??`${m}-menu-button`,class:"nrt-button menu-toggle-button"},i.toDisplayString(f.label),9,kb))),128)),a.value?(i.openBlock(),i.createBlock(i.Teleport,{key:0,to:"#narrat"},[i.createVNode(_n,{containerCssClass:{[a.value.cssClass]:!0,"menu-modal":!0},onClose:c},{header:i.withCtx(()=>{var f;return[i.createElementVNode("h3",Cb,i.toDisplayString(((f=i.unref(t).tab)==null?void 0:f.text)??a.value.label),1)]}),body:i.withCtx(()=>[i.createVNode(Sb,{onTabChange:d,onClose:u,tabs:s.value,defaultTab:a.value.activeTab},null,8,["tabs","defaultTab"])]),_:1},8,["containerCssClass"])])):i.createCommentVNode("",!0)]))}});function od(e){const t={};return e.selected&&(t.selected=!0),e.clickable&&e.viewportClickable&&!e.transitioning&&(t.interactable=!0),(!e.clickable||!e.viewportClickable)&&(t["nrt-disabled"]=!0),e.transitioning&&(t.transitioning=!0),e.greyed&&(t.greyed=!0),e.hidden&&(t.hidden=!0),e.cssClass&&(t[e.cssClass]=!0),t}function $b(e,t,n){return{selected:t,clickable:e.onClick!==void 0,viewportClickable:Jo(e),transitioning:n,greyed:!1,hidden:!1,cssClass:e.cssClass}}function Eb(e,t,n){const r=Vn(e),o=Ut().getButtonState(e);return{selected:t,clickable:Ut().isButtonInteractible(e),viewportClickable:Jo(r),transitioning:n,greyed:o==="greyed",hidden:o==="hidden"||o===!1,cssClass:r.cssClass}}function Ob(e,t,n){return od(Eb(e,t,n))}function Ab(e,t,n){return od($b(e,t,n))}const Ib=["id"],Nb=["innerHTML"],Pb=i.defineComponent({__name:"screen-object",props:{screenObject:{},layerSelected:{type:Boolean},transitioning:{type:Boolean},activeInteractive:{}},setup(e){const t=e,n=xt();function r(c){t.transitioning||t.screenObject.onClick&&n.clickObject(c)}const o=i.computed(()=>{if(!t.layerSelected)return!1;const c=t.activeInteractive;return c.type==="screenObject"&&c.id===t.screenObject.id}),a=i.computed(()=>Ab(t.screenObject,o.value,t.transitioning)),s=i.computed(()=>{const c={};t.screenObject.opacity!==1&&(c.opacity=t.screenObject.opacity);let d=t.screenObject.x,u=t.screenObject.y,h=t.screenObject.width,l=t.screenObject.height;if(t.screenObject.anchor){const m=t.screenObject.anchor;d=t.screenObject.x-h*m.x,u=t.screenObject.y-l*m.y,c.transformOrigin=`${m.x*100}% ${m.y*100}%`}t.screenObject.scale&&(h=h*t.screenObject.scale,l=l*t.screenObject.scale);const f={...c,left:`${d}px`,top:`${u}px`,width:`${h}px`,height:`${l}px`};return Zg(t.screenObject)&&(f.backgroundImage=`url(${Lr(t.screenObject.image)})`),f});return(c,d)=>{const u=i.resolveComponent("ScreenObject",!0);return i.openBlock(),i.createElementBlock("div",{tabindex:"-1",class:i.normalizeClass(["viewport-object",a.value]),id:`viewport-object-${t.screenObject.id}`,onClick:d[0]||(d[0]=h=>r(c.screenObject)),style:i.normalizeStyle(s.value)},[i.createElementVNode("span",{innerHTML:t.screenObject.text?i.unref(nn)(t.screenObject.text):void 0},null,8,Nb),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.screenObject.children,h=>(i.openBlock(),i.createBlock(u,{transitioning:c.transitioning,key:h.id,screenObject:h},null,8,["transitioning","screenObject"]))),128))],14,Ib)}}}),jb=["id","innerHTML"],Db=i.defineComponent({__name:"viewport-button",props:{id:{},layerSelected:{type:Boolean},transitioning:{type:Boolean},activeInteractive:{}},setup(e){const t=e,n=Ut();i.computed(()=>n.getButtonState(t.id));const r=i.computed(()=>Vn(t.id)),o=r.value.background?Lr(r.value.background):null,a=i.computed(()=>{if(!t.layerSelected)return!1;const h=t.activeInteractive;return h.type==="button"&&h.id===t.id});i.computed(()=>n.isButtonClickable(t.id));const s=i.computed(()=>{const h=r.value.text??"";return nn(h)}),c=i.computed(()=>Ob(t.id,a.value,t.transitioning)),d=i.computed(()=>{const h={};r.value.position.width&&(h.width=`${r.value.position.width}px`),r.value.position.height&&(h.height=`${r.value.position.height}px`),r.value.background&&(h.backgroundImage=`url(${o})`);let l=r.value.position.left,f=r.value.position.top;return r.value.anchor&&(l=r.value.position.left-r.value.position.width*r.value.anchor.x,f=r.value.position.top-r.value.position.height*r.value.anchor.y),{...h,left:`${l}px`,top:`${f}px`}});function u(){n.clickOnButton(t.id)}return(h,l)=>(i.openBlock(),i.createElementBlock("div",{tabindex:"-1",class:i.normalizeClass(["viewport-button",c.value]),id:`viewport-button-${h.id}`,onClick:l[0]||(l[0]=f=>u()),style:i.normalizeStyle(d.value),innerHTML:s.value},null,14,jb))}}),xb=["id"],Lb=["id","loop","muted"],Mb=["src"],Rb=["id"],Is=i.defineComponent({__name:"screen-layer",props:{layer:{},layerIndex:{},transitioning:{type:Boolean},activeInteractive:{}},setup(e){const t=e,n=Te(),r=xt(),o=i.computed(()=>!!(t.activeInteractive&&t.activeInteractive.layer===t.layerIndex)),a=i.computed(()=>r.tree.filter(S=>S.layer===t.layerIndex)),s=i.computed(()=>le().layout.backgrounds.width),c=i.computed(()=>le().layout.backgrounds.height),d=i.computed(()=>t.layer),u=i.computed(()=>{const S=xr(d.value);return S||ae(`Screen ${d.value} doesn't have a config`),S}),h=i.computed(()=>n.isInGame),l=i.computed(()=>u.value.buttons||[]),f=i.computed(()=>u.value.video),m=i.computed(()=>({width:`${s.value}px`,height:`${c.value}px`})),y=i.computed(()=>{let S;return u.value.background!==Uo&&(S=`url(${Lr(u.value.background)})`),{backgroundImage:S,position:"absolute",left:0,top:0,width:`${s.value}px`,height:`${c.value}px`}}),b=i.computed(()=>({position:"absolute",left:0,top:0,width:`${s.value}px`,height:`${c.value}px`}));return(S,T)=>h.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"viewport-layer",id:`viewport-layer-${d.value}`,style:i.normalizeStyle(m.value)},[f.value?(i.openBlock(),i.createElementBlock("video",{key:0,class:"viewport-layer-background",id:`viewport-layer-background-${d.value}`,style:i.normalizeStyle(b.value),autoplay:"",loop:f.value.loop!==!1,muted:!!f.value.muted},[i.createElementVNode("source",{src:i.unref($t)(u.value.background)},null,8,Mb)],12,Lb)):(i.openBlock(),i.createElementBlock("div",{key:1,class:"viewport-layer-background",id:`viewport-layer-background-${d.value}`,style:i.normalizeStyle(y.value)},null,12,Rb)),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.value,I=>(i.openBlock(),i.createBlock(Db,{key:I,id:I,layerSelected:o.value,transitioning:S.transitioning,activeInteractive:S.activeInteractive},null,8,["id","layerSelected","transitioning","activeInteractive"]))),128)),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,I=>(i.openBlock(),i.createBlock(Pb,{key:I.id,screenObject:I,transitioning:S.transitioning,layerSelected:o.value,activeInteractive:S.activeInteractive},null,8,["screenObject","transitioning","layerSelected","activeInteractive"]))),128))],12,xb)):i.createCommentVNode("",!0)}}),Bb=i.defineComponent({__name:"NarratTransition",props:{name:{type:String,required:!0},duration:{type:Number,required:!0},delay:Number},emits:["complete"],setup(e,{emit:t}){i.useSlots();const n=t,r=e,o=i.ref("start"),a=i.reactive({oldSlotClasses:{},oldSlotStyle:{},newSlotClasses:{},newSlotStyle:{}});return i.onMounted(async()=>{const s=`narrat-transition-${r.name}`;a.newSlotClasses={[`${s}-enter-from`]:!0},a.oldSlotClasses={[`${s}-leave-active`]:!0},await At(30),a.oldSlotStyle={transitionDuration:`${r.duration/1e3}s`},a.newSlotStyle={transitionDuration:`${r.duration/1e3}s`},a.oldSlotClasses[`${s}-leave-to`]=!0,a.newSlotClasses[`${s}-enter-active`]=!0,await At(r.delay??0),delete a.newSlotClasses[`${s}-enter-from`],await At(r.duration),o.value="end",n("complete")}),(s,c)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[o.value!=="end"?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["transition-holder",a.oldSlotClasses]),style:i.normalizeStyle(a.oldSlotStyle)},[i.renderSlot(s.$slots,"oldElement")],6)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(["transition-holder",a.newSlotClasses]),style:i.normalizeStyle(a.newSlotStyle)},[i.renderSlot(s.$slots,"newElement")],6)],64))}});function id(e,t,n){return e<t?t:e>n?n:e}const Ns=i.defineComponent({__name:"screens",setup(e){const t=i.computed(()=>Ke().inGameInputListener),n=Te(),r=Ut(),o=xt(),a=i.ref(0),s=i.computed(()=>r.nonEmptyLayers),c=i.computed(()=>{const y=[];return s.value.reduce((b,S,T)=>{const x=xr(S.screen).buttons;if(x)for(const F of x)r.isButtonClickable(F)&&b.push({id:F,type:"button",layer:T});const B=o.tree.filter(F=>F.layer===T);for(const F of B)o.isScreenObjectClickable(F)&&b.push({id:F.id,type:"screenObject",layer:T});return b},y)}),d=i.computed(()=>{if(c.value.length===0)return null;let y=a.value;return y>c.value.length-1&&(y=c.value.length-1),c.value[y]}),u=i.computed(()=>le().layout.backgrounds.width),h=i.computed(()=>le().layout.backgrounds.height),l=i.computed(()=>n.isInGame);function f(y){r.finishTransition(y)}const m=i.computed(()=>{const y=u.value;return{height:`${h.value}px`,width:`${y}px`}});return i.onMounted(()=>{i.nextTick(()=>{if(t.value){const y=t.value.actions;y.previousTab={press:()=>{a.value>0?a.value--:a.value=c.value.length-1,a.value=id(a.value,0,c.value.length-1)}},y.left=y.previousTab,y.nextTab={press:()=>{a.value<c.value.length-1?a.value++:a.value=0,a.value=id(a.value,0,c.value.length-1)}},y.right=y.nextTab,y.viewportSelect={press:()=>{if(d.value){const b=d.value;b.type==="button"?r.clickOnButton(b.id):b.type==="screenObject"&&o.clickObject(o.getObject(b.id))}}}}})}),i.onUnmounted(()=>{if(t.value){const y=t.value;delete y.actions.previousTab,delete y.actions.left,delete y.actions.nextTab,delete y.actions.right}}),(y,b)=>l.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"viewport",id:"narrat-viewport",style:i.normalizeStyle(m.value)},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,(S,T)=>(i.openBlock(),i.createElementBlock("div",{key:S.screen??"",class:"layer-container"},[S.transition?(i.openBlock(),i.createBlock(Bb,{key:0,name:S.transition.transition,duration:S.transition.duration,delay:S.transition.delay,onComplete:()=>f(T)},{oldElement:i.withCtx(()=>[S.transition.oldScreen?(i.openBlock(),i.createBlock(Is,{key:0,layer:S.transition.oldScreen,layerIndex:T,transitioning:!0},null,8,["layer","layerIndex"])):i.createCommentVNode("",!0)]),newElement:i.withCtx(()=>[S.screen?(i.openBlock(),i.createBlock(Is,{key:0,layer:S.screen,layerIndex:T,transitioning:!0},null,8,["layer","layerIndex"])):i.createCommentVNode("",!0)]),_:2},1032,["name","duration","delay","onComplete"])):S.screen?(i.openBlock(),i.createBlock(Is,{key:1,layer:S.screen,layerIndex:T,transitioning:!1,activeInteractive:d.value},null,8,["layer","layerIndex","activeInteractive"])):i.createCommentVNode("",!0)]))),128))],4)):i.createCommentVNode("",!0)}}),Pt=et("hud",{state:()=>({hudStats:{},visible:!0}),actions:{updateConfig(e){for(const t in e.hudStats)this.hudStats[t]||(this.hudStats[t]={value:e.hudStats[t].startingValue})},reset(e){this.$reset(),this.updateConfig(e)},setStat(e,t){this.hudStats[e].value=t,this.getStat(e).value<(sr(e).minValue??0)&&(this.hudStats[e].value=sr(e).minValue??0),this.getStat(e).value>(sr(e).maxValue??1/0)&&(this.hudStats[e].value=sr(e).maxValue??1/0)},addStat(e,t){this.setStat(e,this.getStatValue(e)+t)},getStat(e){return this.hudStats[e]},getStatValue(e){return this.hudStats[e].value},generateSaveData(){return{hudStats:Re(this.hudStats),visible:this.visible}},loadSaveData(e){this.hudStats=Yn(this.hudStats,e.hudStats),this.visible=e.visible},setVisibility(e){this.visible=e}}}),Fb=i.defineComponent({data(){return{}},methods:{getStatImage(e){return $t(this.statsConfig[e].icon)},formatStat(e,t){var c;const n=sr(e),r=n.decimals??2,o=Math.floor(t*10**r)/10**r,a={};(c=n.formatting)!=null&&c.style&&(a.style=n.formatting.style,n.formatting.style==="currency"&&(a.currency=n.formatting.currency??"USD",a.currencyDisplay="narrowSymbol"),n.formatting.style==="unit"&&(a.unit=n.formatting.unit??"day"));let s;try{s=o.toLocaleString(void 0,a)}catch(d){ae(`Error formatting HUD stat, probably using an invalid config: ${d}`),console.error(d),s=o.toLocaleString()}return s},statPrefix(e){const t=sr(e);return t.prefix??(t.suffix||t.hideName?"":t.name)},statSuffix(e){return sr(e).suffix??""}},computed:{...Yr(Pt,["hudStats"]),...Yr(Je,["layoutMode"]),statsConfig(){return le().hudStats},stats(){return this.hudStats},hudStyle(){let e="0";return this.layoutMode==="horizontal"&&(e=`${Ii()+(le().dialogPanel.rightOffset??br.common.dialogPanel.rightOffset)}px`),{right:e}},hasHud(){return Pt().visible===!1?!1:Object.keys(Pt().hudStats).length>0}}}),Vb=["src"],Ub=["innerHTML"],qb=["innerHTML"];function Hb(e,t,n,r,o,a){return e.hasHud?(i.openBlock(),i.createElementBlock("div",{key:0,class:"hud",style:i.normalizeStyle(e.hudStyle)},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.stats,(s,c)=>(i.openBlock(),i.createElementBlock("div",{key:c,class:"hud-stat"},[i.createElementVNode("img",{class:"hud-icon",src:e.getStatImage(c)},null,8,Vb),i.createElementVNode("span",{class:"bold hud-text",innerHTML:e.statPrefix(c)},null,8,Ub),i.createElementVNode("span",null,i.toDisplayString(e.formatStat(c,s.value)),1),e.statSuffix?(i.openBlock(),i.createElementBlock("span",{key:0,innerHTML:e.statSuffix(c)},null,8,qb)):i.createCommentVNode("",!0)]))),128))],4)):i.createCommentVNode("",!0)}const Ps=zt(Fb,[["render",Hb]]),js=i.defineComponent({__name:"in-game",setup(e){const t=Ke(),n=i.computed(()=>t.inGameInputListener),r=Te(),o=Je(),a=i.computed(()=>o.layoutMode),s=i.computed(()=>r.saving),c=i.ref(null),d=Fe(),u=i.ref(null),h=i.computed(()=>s.value&&!s.value.withPrompt||s.value&&c.value),l=i.computed(()=>{let b="row";return a.value==="vertical"&&(b="column"),{flexDirection:b}});function f(b){if(c.value=null,b===null){xs(b,!1);return}xs(b,!0)}function m(){c.value=!0}function y(){c.value=!1,xs(null,!1),c.value=null}return i.onBeforeMount(()=>{t.createInGameInputListener()}),i.onMounted(()=>{u.value=qt.on("debouncedKeydown",b=>{Te().debugMode||((b.key==="a"||b.key==="A")&&d.toggleAutoPlay(),(b.key==="s"||b.key==="S")&&d.toggleSkip())})}),i.onUnmounted(()=>{n.value&&t.removeInGameInputListener(),u.value&&qt.off("debouncedKeydown",u.value)}),i.computed(()=>Pt().visible===!1?!1:Object.keys(Pt().hudStats).length>0),(b,S)=>(i.openBlock(),i.createElementBlock("div",{class:"game",style:i.normalizeStyle(l.value)},[i.createVNode(Ps),i.createVNode(As),i.createVNode(Ns),i.createVNode(Os),h.value?(i.openBlock(),i.createBlock(Ju,{key:0,mode:"pick",onChosen:f,onClose:S[0]||(S[0]=()=>f(null))})):i.createCommentVNode("",!0),s.value&&s.value.withPrompt&&c.value===null?(i.openBlock(),i.createBlock(Xo,{key:1,prompt:"Would you like to save the game?",onConfirm:m,onRefuse:y})):i.createCommentVNode("",!0)],4))}}),Kb={class:"chapter-title-scene"},Gb=["innerHTML"],zb=["innerHTML"],Wb=i.defineComponent({__name:"chapter-title",props:{options:{}},setup(e){const t=e,n=i.ref(null);function r(){n.value=null,Nt().changeScene("playing"),we().jumpToLabel(t.options.next_label)}return i.onMounted(()=>{n.value=setTimeout(r,t.options.duration??2e3)}),i.onUnmounted(()=>{n.value&&(clearTimeout(n.value),n.value=null)}),(o,a)=>(i.openBlock(),i.createElementBlock("div",Kb,[i.createElementVNode("h1",{class:"title chapter-title",innerHTML:t.options.title},null,8,Gb),t.options.subtitle?(i.openBlock(),i.createElementBlock("h2",{key:0,class:"subtitle chapter-subtitle",innerHTML:t.options.subtitle},null,8,zb)):i.createCommentVNode("",!0)]))}}),sd={"engine-splash":{id:"engine-splash",component:i.shallowRef(bs),props:{}},"game-splash":{id:"game-splash",component:i.shallowRef(Ss),props:{}},"start-menu":{id:"start-menu",component:i.shallowRef($s),props:{}},playing:{id:"playing",component:i.shallowRef(js),props:{}},"chapter-title":{id:"chapter-title",component:i.shallowRef(Wb),props:{}}};let an={};function Qb(e){an=e}function Yb(){sd["engine-splash"].onFinished=()=>{Nt().onEngineSplashFinished()},Nt().scenes=sd}function Jb(){return an}function ad(){for(const e in an){const t=an[e],n=t.store();let r;t_(t)&&(r=Ve()[t.config]),n.reset&&!t.avoidReset&&n.reset(r)}Ie.plugins.forEach(e=>{e.reset&&e.reset()})}function Xb(){const e={},t={};for(const n in an){const r=an[n];if(Qu(r)){const o=r.store();o.generateSaveData?e[r.save]=o.generateSaveData():ae(`Store ${n} has no generateSaveData method. Trying to generate save data for ${r.save}`)}if(Yu(r)){const o=r.store();o.generateGlobalSaveData?t[r.globalSave]=o.generateGlobalSaveData():ae(`Store ${n} has no generateGlobalSaveData method. Trying to generate save data for ${r.globalSave}`)}}return Ie.plugins.forEach(n=>{n.save&&(e.plugins[n.pluginId]=n.save())}),Ie.customStores().forEach(([n,r])=>{if(r.save){const o=r.save();o&&(o.customStores[n]=o)}}),{gameSave:e,globalSave:t}}function Zb(e){for(const t in an){const n=an[t];if(Qu(n)){const r=n.store();r.loadSaveData?r.loadSaveData(e[n.save]):ae(`Store ${t} has no loadSaveData method. Trying to load save data for ${n.save}`)}}Ie.plugins.forEach(t=>{t.load&&e.plugins[t.pluginId]&&t.load(e.plugins[t.pluginId])}),Ie.customStores().forEach(([t,n])=>{n.load&&n.load(e.customStores[t])})}function ld(e){for(const t in an){const n=an[t];if(Yu(n)){const r=n.store();r.loadGlobalSaveData?r.loadGlobalSaveData(e[n.globalSave]):ae(`Store ${t} has no loadGlobalSaveData method. Trying to load global save data for ${n.globalSave}`)}}}function eT(e){Zb(e.gameSave),ld(e.globalSave)}function Ds({slotId:e,name:t}){const n=Te(),r=e??n.saveSlot;n.saveData=Ep({slot:r,name:t,extractedSave:Xb()})}function tT(e){eT(e)}function cd(){we().globalData={},bn().globalSave.data={},Ds({})}function ud({saveName:e,withPrompt:t}){return new Promise(n=>{we().hasJumped?Te().startManualSave(n,e,t):n()})}function xs(e,t){var r;const n=Te();if(!n.saving){ae("No saving in progress!");return}if(!t||!e){n.cancelManualSave();return}n.saveData?(Op(n.saveData,mr(n.playTime.start,n.playTime.previousPlaytime),e.slotId,(r=n.saving)==null?void 0:r.name),n.alert("Success","Game saved!")):ae("There was no data to save!"),n.cancelManualSave()}const we=et("vm",{state:()=>({stack:[],data:{},globalData:{},lastLabel:"main",script:{},labelStack:["main"],commandsWaitingForPlayerAnswer:[],hasJumped:!1}),actions:{generateSaveData(){return{lastLabel:this.lastLabel,data:Ha(this.data,e=>Wu(e)?{_entityType:e._entityType,id:e.id}:e)}},generateGlobalSaveData(){return{data:Re(this.globalData)}},loadSaveData(e){this.lastLabel=e.lastLabel,this.data=e.data,this.findEntitiesInData(this.data)},loadGlobalSaveData(e){this.globalData=e.data},findEntitiesInData(e){Ku(this.data,(t,n,r)=>{if(Wu(t)){const o=xt().getObject(t.id);o?r[n]=o:Zn(`Trying to reload sprite ${n} (${JSON.stringify(t)} - ${t.id}) but it does not exist.`)}})},setReturnValue(e){this.currentFrame.returnValue=e},waitForPlayerAnswer(e){this.commandsWaitingForPlayerAnswer.push(e)},popAnswerQueue(){return this.commandsWaitingForPlayerAnswer.pop()},addScopedVariable(e,t){this.currentFrame&&(this.currentFrame.scope[e]=t)},async loadScripts(e){this.readGlobalData();const t=await this.loadConfigScriptFiles(e),n=Te().options.scripts;this.addAllScripts([...t,...n])},async loadConfigScriptFiles(e){const t=[];for(const r of e)t.push(Qo(Ai(r)));return(await Promise.all(t)).map((r,o)=>({fileName:e[o],code:r,id:e[o],type:"script"}))},addAllScripts(e){const t=Date.now();for(const r of e)Ie.addNarratScript(r);const n=Date.now();Ft.log(`scripts parsed in ${n-t} ms`)},start(){this.setStack({currentIndex:0,branchData:{branch:Ie.script.main.branch},label:"main"}),this.setStack({currentIndex:0,branchData:{branch:Ie.script.main.branch},label:"main"})},setLastLabel(e){this.lastLabel=e},reset(){this.$reset(),this.stack=[],this.data={},this.hasJumped=!0,this.setStack({currentIndex:0,branchData:{branch:Ie.script.main.branch},label:"main"})},readGlobalData(){this.globalData=bn().globalSave.data},setScript(e){Ie.script=e},overrideData(e){this.data=e},setStack(e){this.stack=[];const t=this.frameOptionsToFrame(e);this.lastLabel=e.label,this.stack.push(t)},frameOptionsToFrame(e){const t=e.branchData,n={...e,blocks:[],scope:{},returnValue:null};if(this.addBlock(n,{branchData:t,currentIndex:e.currentIndex}),e.scope&&(n.scope=e.scope),e.args&&e.branchData.args)for(const[r,o]of e.branchData.args.entries())e.args.length>r&&(n.scope[o]=e.args[r]);return n},addBlock(e,t){e.blocks.push(t)},async addAndRunBlock(e){const t=this.currentFrame;if(!t)throw new Error("No frame to add block to");return this.addBlock(t,e),await this.runBlock()},setData(e,t){const n=Mr();Of(n,e,t)},addInstruction(e,t){const n=Mr();Af(n,e,t)},addFrame(e){if(!e.label)if(this.currentFrame)e.label=this.currentFrame.label;else throw new Error("Tried to add a new frame but no label was passed and there is no current frame label");const t=this.frameOptionsToFrame(e);this.stack.push(t)},async addAndRunFrame(e){return await this.addFrame(e),await this.runFrame()},async runFrame(){if(!this.currentFrame)throw new Error("Tried to run a frame but there is no current frame");let t;for(;this.currentBlock;){const n=await this.runBlock();if(n===Bo||n===Fo)return this.cleanFrame(),n;if(n===es)return this.cleanFrame()}return this.cleanFrame(),t},cleanFrame(){const e=this.currentFrame,{returnValue:t}=e;return this.stack.splice(this.stack.length-1,1),t},async runBlock(){const e=this.currentBlock;if(!e)throw new Error("Tried to run a block but there is no current block");let t;for(;this.currentLine;){if(t=await this.runLineOnly(),xm(t))return this.cleanBlock(),t;e.currentIndex++}return this.cleanBlock(),t},cleanBlock(){if(!this.currentFrame){ae("Tried to clean a block but there is no current frame");return}if(!this.currentFrame.blocks){ae("Tried to clean a block but there is no current block");return}this.currentFrame.blocks.splice(this.currentFrame.blocks.length-1,1)},async runGame(){let e=await this.runFrame();for(;e===Bo;){const t=this.jumpTarget;if(!t){ae("Tried to jump but no target was set");return}this.hasJumped=!0,this.setStack(t),await Ds({}),e=await this.runFrame()}e!==Fo&&this.stack.length===0&&this.reachedEndOfScript()},async nextLineOnly(){return this.stack.length===0||this.isBlockFinished()?!1:(this.currentBlock.currentIndex++,!0)},isBlockFinished(){return!this.currentBlock||this.currentBlock&&this.currentBlock.currentIndex>=this.currentBlock.branchData.branch.length},reachedEndOfScript(){if(le().gameFlow.labelToJumpOnScriptEnd&&this.lastLabel!==le().gameFlow.labelToJumpOnScriptEnd){this.jumpToLabel(le().gameFlow.labelToJumpOnScriptEnd);return}Te().endingScript(),Te().options.debug&&le().debugging.showScriptFinishedMessage},async runLineOnly(){const e=this.currentLine;if(!e){ae("There is no line of script to run.");return}return Te().startingScript(),await yd(e)},async runLabelFunction(e,...t){const n=Ie.script[e];if(!n){ae(`Tried to run a label that doesn't exist: ${e}`);return}const r={currentIndex:0,branchData:n,label:e,args:t};return this.addAndRunFrame(r)},runCustomFrame(e){this.addAndRunFrame(e)},async jumpToLabel(e,...t){const n=Ie.script[e];if(!n){ae(`Label ${e} doesn't exist. Is the file with this label added in the list of script files to load in the config?`);return}e!==this.lastLabel&&(this.hasJumped=!0),this.setLastLabel(e),this.setStack({currentIndex:0,branchData:n,args:t,label:e}),this.runGame()},async runThenGoBackToPreviousDialog(e,...t){const n=Fe(),r=n.dialog[n.dialog.length-1],o=Te().inScript,a=await this.runLabelFunction(e,...t);return o?n.dialog.push(r):Te().endingScript(),a}},getters:{currentFrame(e){return e.stack[e.stack.length-1]},scope(){var e;return((e=this.currentFrame)==null?void 0:e.scope)??{}},currentBlock(){const e=this.currentFrame;return e?e.blocks[e.blocks.length-1]:void 0},currentLine(){const e=this.currentBlock;if(e&&e.branchData.branch.length>e.currentIndex)return e.branchData.branch[e.currentIndex]},commandWaitingForAnswer(){if(this.commandsWaitingForPlayerAnswer.length>0)return this.commandsWaitingForPlayerAnswer[0]}}}),dd=new Ao;dd.setupDebugger(!1);const Ht=dd.logger;function nT(e){return rT((t,n,r)=>_T(t,n,r),e.code,e.fileName)}function rT(e,t,n){const r={fileName:n,currentLine:0,error:(s,c)=>e(r,s,c),processCommandsFunction:Ls,indentSize:0};r.indentSize=fT(r,t);const o=cT(r,t);r.currentLine=0,Ht.log(o);const a={};for(const s of o){s.code.search(":")===-1&&r.error(s.line,"First indentation level should only be used to specify labels");const d=s.code.replace(":","").split(/ +/g),u=d[0],h=d.slice(1);s.branch||r.error(s.line,"This line should have a branch but doesn't"),a[u]={branch:Ls(r,s.branch,void 0),args:h}}return a}function Ls(e,t,n){const r=e.currentLine;if(!t){let s=0;return n&&(s=n.line),e.error(s,"Processing of command failed because the current branch has no lines inside"),[]}const o={processCommandsFunction:Ls,parserContext:e,lines:t,currentLine:0,line:t[0]},a=[];for(;o.currentLine<t.length;){const s=t[o.currentLine];o.line=s;const c=Ms(e,s,s.expression),d=Ie.commands[c.command.operator];let u=d==null?void 0:d.parser;u||(u=Ie.commands.text.parser),Ht.log(Ie.commands.text);const{newLine:h}=u(o,c);o.currentLine=h,e.currentLine=r+h,a.push(c)}return a}function Ms(e,t,n){Ht.log(n),typeof n[0]!="string"&&e.error(t.line,"Expression operator should be a string");const r={code:t.code,fileName:e.fileName,line:t.line,command:{staticOptions:{},commandType:n[0],operator:n[0],args:n.slice(1).map(s=>oT(e,t,s)),options:{}}},o=n[0];if(!Ie.commands[o]){const s=["else","success","failure"];!im(o)&&!s.includes(o)&&e.error(t.line,`Unknown command ${o}`)}return r}function oT(e,t,n){return Array.isArray(n)?Ms(e,t,n):n}function iT(e){return e==="true"?!0:e==="false"?!1:e==="undefined"?void 0:e===null?null:isNaN(Number(e))?e:Number(e)}function sT(e,t){t.charAt(t.length-1)===":"&&(t=t.substr(0,t.length-1));const n=aT(t),[r]=pd(e,n);return r}function aT(e){const t=/(["'])(?:\\\1|.)*?\1/g,n=[];let r;for(;(r=t.exec(e))!=null;)n.push(r);let o=0,a=[];for(const s of n){const c=s.index;if(c>o){const u=e.substr(o,c-o),h=fd(u);a=[...a,...h]}const d=s[0].replace(/\\/g,"");a.push(`$$"${d.substring(1,d.length-1)}`),o=c+s[0].length}return a=[...a,...fd(e.substr(o))],a.push(")"),a}function fd(e){e=e.replace(/: *$/g,"");let t=e.split(" ").filter(n=>n);return t=t.reduce((n,r)=>[...n,...r.split(/(\(|\))/g)].filter(o=>o&&o),[]),t.map(n=>iT(n))}function pd(e,t){Ht.log("===============");let n=[],r=0,o=md(t)+r,a=Rs(t)+r;for(Ht.log(`Parsing expression: ${t}`),Ht.log(`Parenthesis start index: ${o} - end: ${a}`);o!==-1&&a>o;){n=[...n,...t.slice(r,o)];const d=t.slice(o+1);Ht.log(`Found a sub expression. Before: ${n} - After: ${d}`),r=o;const[u,h]=pd(e,d),l=r+h;n.push(u),r=l+1;const f=t.slice(r);Ht.log(`Sub expression came back: ${u} - rest of string: ${f}`),o=md(f),o!==-1&&(o+=r),a=Rs(f),a!==-1&&(a+=r)}a!==-1&&Ht.log("Found parenthesis end before new opening parenthesis, close this expression");const s=Rs(t.slice(r))+r;if(s===-1)return e.error(e.currentLine,'Expression is not closed (missing ")" closing parenthesis)'),[n,s];const c=t.slice(r,s);return Ht.log(`End of expression: ${s} - ${c}`),Ht.log("==================="),n=[...n,...c],lT(e,n),[n,s+1]}function lT(e,t){t.length<1&&e.error(e.currentLine,"Expression is empty")}function md(e){return e.findIndex(t=>t==="(")}function Rs(e){return e.findIndex(t=>t===")")}function cT(e,t){const n=t.split(/\r?\n|$/).map(o=>{const a=o.search(/ *\/\//g);return a!==-1?o.substr(0,a):o});return hd(e,n,0,0).lines}function hd(e,t,n,r){let o=!0,a=n;const s=[];for(;o&&!(a>=t.length);){let c=t[a];if(c.search(/^\s*$/)!==-1)a++;else{const d=dT(e,c);if(c=c.substring(d*e.indentSize),uT(e,d,a),d<r)o=!1;else if(d>r){(s.length===0||d-r!==1)&&e.error(a,"Wrong double indentation");const u=hd(e,t,a,d);s[s.length-1].branch=u.lines,a=u.endLine}else{const u=sT(e,c),h={code:c,indentation:d,line:a,expression:u};s.push(h),a++,e.currentLine=a}}}return{lines:s,endLine:a}}function uT(e,t,n){t%1!==0&&e.error(n,`Indentation level of ${t} incorrect. Expected indentation of ${e.indentSize} spaces for this file.`)}function dT(e,t){return t.search(/[^ ]/)/e.indentSize}function fT(e,t){const n=/\n( *)/,r=t.match(n);return!r||r.length<2?(e.error(0,"Can't detect indentation level. Make sure you indent with at least 2 spaces and consistently"),0):(Ht.log(r),r[1].length)}class pT{constructor(){xe(this,"plugins",[]);xe(this,"pinia");xe(this,"script",{});xe(this,"scripts",[]);xe(this,"commands",{})}addCommand(t){this.commands[t.keyword]=t}addPlugin(t){if(this.plugins.push(t),t.customCommands)for(const n of t.customCommands)this.addCommand(n)}callHook(t,...n){for(const r of this.plugins)typeof r[t]=="function"&&r[t](...n)}addNarratScript(t){const n=nT(t);this.script={...this.script,...n},this.scripts.push(t)}customStores(){const t=[];for(const n of this.plugins)if(n.customStores)for(const r in n.customStores)t.push([r,n.customStores[r](this.pinia)]);return t}addCustomSettings(){for(const t of this.plugins)if(t.customSettings)for(const n in t.customSettings)sn().addCustomSetting(n,t.customSettings[n])}}const Ie=new pT;async function yd(e,t){var r;const n=we();try{return await ei(e,t)}catch(o){console.error(o),console.error(e),ae(`Narrat script runtime error at <span class="error-filename">${e.fileName}:${e.line+1}</span>
68
+ `+e.slice(s+1):d+=e.slice(o),d.slice(1)}function Og(e){for(var t="",n=0,r,o=0;o<e.length;n>=65536?o+=2:o++)n=ro(e,o),r=Tt[n],!r&&no(n)?(t+=e[o],n>=65536&&(t+=e[o+1])):t+=r||bg(n);return t}function Ag(e,t,n){var r="",o=e.tag,a,s,c;for(a=0,s=n.length;a<s;a+=1)c=n[a],e.replacer&&(c=e.replacer.call(n,String(a),c)),(vn(e,t,c,!1,!1)||typeof c>"u"&&vn(e,t,null,!1,!1))&&(r!==""&&(r+=","+(e.condenseFlow?"":" ")),r+=e.dump);e.tag=o,e.dump="["+r+"]"}function Ku(e,t,n,r){var o="",a=e.tag,s,c,d;for(s=0,c=n.length;s<c;s+=1)d=n[s],e.replacer&&(d=e.replacer.call(n,String(s),d)),(vn(e,t+1,d,!0,!0,!1,!0)||typeof d>"u"&&vn(e,t+1,null,!0,!0,!1,!0))&&((!r||o!=="")&&(o+=ys(e,t)),e.dump&&eo===e.dump.charCodeAt(0)?o+="-":o+="- ",o+=e.dump);e.tag=a,e.dump=o||"[]"}function Ig(e,t,n){var r="",o=e.tag,a=Object.keys(n),s,c,d,u,h;for(s=0,c=a.length;s<c;s+=1)h="",r!==""&&(h+=", "),e.condenseFlow&&(h+='"'),d=a[s],u=n[d],e.replacer&&(u=e.replacer.call(n,d,u)),vn(e,t,d,!1,!1)&&(e.dump.length>1024&&(h+="? "),h+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),vn(e,t,u,!1,!1)&&(h+=e.dump,r+=h));e.tag=o,e.dump="{"+r+"}"}function Ng(e,t,n,r){var o="",a=e.tag,s=Object.keys(n),c,d,u,h,l,f;if(e.sortKeys===!0)s.sort();else if(typeof e.sortKeys=="function")s.sort(e.sortKeys);else if(e.sortKeys)throw new Ct("sortKeys must be a boolean or a function");for(c=0,d=s.length;c<d;c+=1)f="",(!r||o!=="")&&(f+=ys(e,t)),u=s[c],h=n[u],e.replacer&&(h=e.replacer.call(n,u,h)),vn(e,t+1,u,!0,!0,!0)&&(l=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,l&&(e.dump&&eo===e.dump.charCodeAt(0)?f+="?":f+="? "),f+=e.dump,l&&(f+=ys(e,t)),vn(e,t+1,h,!0,l)&&(e.dump&&eo===e.dump.charCodeAt(0)?f+=":":f+=": ",f+=e.dump,o+=f));e.tag=a,e.dump=o||"{}"}function Gu(e,t,n){var r,o,a,s,c,d;for(o=n?e.explicitTypes:e.implicitTypes,a=0,s=o.length;a<s;a+=1)if(c=o[a],(c.instanceOf||c.predicate)&&(!c.instanceOf||typeof t=="object"&&t instanceof c.instanceOf)&&(!c.predicate||c.predicate(t))){if(n?c.multi&&c.representName?e.tag=c.representName(t):e.tag=c.tag:e.tag="?",c.represent){if(d=e.styleMap[c.tag]||c.defaultStyle,Ou.call(c.represent)==="[object Function]")r=c.represent(t,d);else if(Au.call(c.represent,d))r=c.represent[d](t,d);else throw new Ct("!<"+c.tag+'> tag resolver accepts not "'+d+'" style');e.dump=r}return!0}return!1}function vn(e,t,n,r,o,a,s){e.tag=null,e.dump=n,Gu(e,n,!1)||Gu(e,n,!0);var c=Ou.call(e.dump),d=r,u;r&&(r=e.flowLevel<0||e.flowLevel>t);var h=c==="[object Object]"||c==="[object Array]",l,f;if(h&&(l=e.duplicates.indexOf(n),f=l!==-1),(e.tag!==null&&e.tag!=="?"||f||e.indent!==2&&t>0)&&(o=!1),f&&e.usedDuplicates[l])e.dump="*ref_"+l;else{if(h&&f&&!e.usedDuplicates[l]&&(e.usedDuplicates[l]=!0),c==="[object Object]")r&&Object.keys(e.dump).length!==0?(Ng(e,t,e.dump,o),f&&(e.dump="&ref_"+l+e.dump)):(Ig(e,t,e.dump),f&&(e.dump="&ref_"+l+" "+e.dump));else if(c==="[object Array]")r&&e.dump.length!==0?(e.noArrayIndent&&!s&&t>0?Ku(e,t-1,e.dump,o):Ku(e,t,e.dump,o),f&&(e.dump="&ref_"+l+e.dump)):(Ag(e,t,e.dump),f&&(e.dump="&ref_"+l+" "+e.dump));else if(c==="[object String]")e.tag!=="?"&&$g(e,e.dump,t,a,d);else{if(c==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new Ct("unacceptable kind of an object to dump "+c)}e.tag!==null&&e.tag!=="?"&&(u=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?u="!"+u:u.slice(0,18)==="tag:yaml.org,2002:"?u="!!"+u.slice(18):u="!<"+u+">",e.dump=u+" "+e.dump)}return!0}function Pg(e,t){var n=[],r=[],o,a;for(_s(e,n,r),o=0,a=r.length;o<a;o+=1)t.duplicates.push(n[r[o]]);t.usedDuplicates=new Array(a)}function _s(e,t,n){var r,o,a;if(e!==null&&typeof e=="object")if(o=t.indexOf(e),o!==-1)n.indexOf(o)===-1&&n.push(o);else if(t.push(e),Array.isArray(e))for(o=0,a=e.length;o<a;o+=1)_s(e[o],t,n);else for(r=Object.keys(e),o=0,a=r.length;o<a;o+=1)_s(e[r[o]],t,n)}function jg(e,t){t=t||{};var n=new vg(t);n.noRefs||Pg(e,n);var r=e;return n.replacer&&(r=n.replacer.call({"":r},"",r)),vn(n,0,r,!0,!0)?n.dump+`
69
+ `:""}var xg=jg,Dg={dump:xg};function bs(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var Lg=pt,Mg=Wc,Bg=Xc,Rg=ru,Fg=ou,Vg=us,Ug=Eu.load,qg=Eu.loadAll,Hg=Dg.dump,Kg=Ct,Gg={binary:cu,float:nu,map:Jc,null:Zc,pairs:du,set:fu,timestamp:au,bool:eu,int:tu,merge:lu,omap:uu,seq:Yc,str:Qc},zg=bs("safeLoad","load"),Wg=bs("safeLoadAll","loadAll"),Qg=bs("safeDump","dump"),Yg={Type:Lg,Schema:Mg,FAILSAFE_SCHEMA:Bg,JSON_SCHEMA:Rg,CORE_SCHEMA:Fg,DEFAULT_SCHEMA:Vg,load:Ug,loadAll:qg,dump:Hg,YAMLException:Kg,types:Gg,safeLoad:zg,safeLoadAll:Wg,safeDump:Qg};function Jo(e){return new Promise((t,n)=>{const r=new XMLHttpRequest;r.onload=function(){r.status>=200&&r.status<300?t(r.responseText):(ae(`Failed to load file ${e}`,r.status),n(r.status))},r.open("GET",e),r.send()})}async function oo(e){try{const t=await Jo(e);let n;if(e.endsWith(".json"))n=JSON.parse(t);else if(e.endsWith(".yaml"))n=Yg.load(t);else{const r=`Unsupported file type for data file ${e} (must be .json or .yaml)`;throw new Error(r)}if(!n)throw new Error(`Data loaded from ${e} is empty`);return n}catch(t){throw console.error(`Failed to load data file ${e}: ${t}`),t}}const Jg=(e,t)=>{const n={};for(const r in e)n[r]=t(e[r]);return n},zu=(e,t)=>{for(const n in e){const r=e[n];t(r,n,e),typeof r=="object"&&r!==null&&zu(r,t)}},Zn={};async function Xg(e){return Zn[e]?Zn[e]:Wu(e,e)}async function Zg(e){Ft.log("Loading images");const t=[],n=async(o,a)=>await Wu(o,a),r=(o,a)=>{t.push(n(o,a))};for(const o in e.common.images){const a=e.common.images[o];r(o,a)}if(e.preload.images)for(const o in e.preload.images.assets){const a=e.preload.images.assets[o];r(o,a)}for(const o in e.screens.screens){const a=e.screens.screens[o];if(a.background&&!e.common.images[a.background]&&!a.video&&r(a.background,a.background),a.buttons)for(const s in a.buttons){const c=a.buttons[s];typeof c=="object"&&c.background&&!e.common.images[c.background]&&r(c.background,c.background)}}return Promise.all(t)}async function Wu(e,t){if(Zn[e])return Zn[e];if(t===qo){const r=new Image;return Zn[e]=r,r}const n=new Promise((r,o)=>{const a=new Image;a.onload=()=>{Zn[e]=a,r(a)},a.onerror=s=>{ae(`Failed to load image ${e} at ${t}`,s),o(s)},a.src=Et(t)});return Zn[e]=n,n}const Xo={};function e_(e){return Xo[e]??{}}function Qu(e,t,n){const r=e_(e.transition),o=e.duration??r.duration??500,a=e.delay??r.delay??0;return{...e,resolve:n,duration:o,delay:a,oldScreen:t}}const vt=et("notifications",{state:()=>({notifications:[],enabled:!0}),actions:{async addNotification(e,t,n){if(!this.enabled)return;e=nn(e);const r=`${Date.now()}-${Math.random()*1e4}`;this.notifications.push({id:r,text:e,description:t,icon:n}),le().notifications.alsoPrintInDialogue&&Hc(`[NOTIFICATION] ${e}`),await kt(le().notifications.timeOnScreen*1e3),this.deleteNotification(r)},deleteNotification(e){const t=this.findNotifications(e);t&&this.notifications.splice(this.notifications.indexOf(t),1)},findNotifications(e){return this.notifications.find(t=>t.id===e)},disableNotifications(){this.enabled=!1;for(const e in this.notifications)this.deleteNotification(e)},enableNotifications(){this.enabled=!0}}}),mt=et("inventory",{state:()=>({items:{},interactionTags:{}}),actions:{generateSaveData(){return{items:Be(this.items),interactionTags:Be(this.interactionTags)}},loadSaveData(e){this.items={...this.items,...e.items},this.interactionTags={...e.interactionTags}},updateConfig(e){Object.keys(e.items).forEach(t=>{this.items[t]||(this.items[t]={amount:0,id:t})})},reset(e){this.$reset(),this.updateConfig(e)},hasItem(e,t){var n;return t||(t=1),((n=this.items[e])==null?void 0:n.amount)>=t},getExistingItem(e){return this.items[e]},getItemAmount(e){var t;return((t=this.getExistingItem(e))==null?void 0:t.amount)||0},add(e){const t=this.getExistingItem(e.id);t?t.amount+=e.amount:this.items[e.id]={...e};const n=en(e.id).name,r=e.amount>1?`${n} x ${e.amount}`:n;vt().addNotification(`Received item: ${r}`)},enableInteraction(e){e||(e="default"),this.interactionTags[e]={blockedInteraction:!1}},disableInteraction(e){e||(e="default"),this.interactionTags[e]={blockedInteraction:!0}},onScriptStart(){const e=le().interactionTags;Object.keys(e).forEach(t=>{e[t].onlyInteractOutsideOfScripts&&this.disableInteraction(t)})},onScriptEnd(){const e=le().interactionTags;Object.keys(e).forEach(t=>{e[t].onlyInteractOutsideOfScripts&&this.enableInteraction(t)})},isInteractionTagBlocked(e){return e||(e="default"),this.interactionTags[e]?this.interactionTags[e].blockedInteraction:!1},remove(e){const t=this.getExistingItem(e.id);t&&(t.amount-=e.amount,vt().addNotification(`Lost item: ${en(e.id).name} x ${e.amount}`),t.amount<=0&&this.deleteItem(e.id))},deleteItem(e){this.getExistingItem(e)&&(this.items[e].amount=0)},canUseItem(e){var n;const t=en(e.id);return!!(t&&t.onUse&&!this.isInteractionTagBlocked(t.tag)&&!((n=Fe().currentDialog)!=null&&n.choices))},useItem(e){let t=!1;const n=en(e.id);if(e&&this.canUseItem(e)&&n){const r=n.onUse;t=!0,Yn("onItemUsed"),r.action==="jump"?ve().jumpToLabel(r.label):r.action==="run"?ve().runThenGoBackToPreviousDialog(r.label,!0):(t=!1,ae(`Unknown action ${r.action}`))}return t}}}),Ut=et("screens",{state:()=>({layers:[{screen:"default"}],buttons:{}}),actions:{setScreen(e,t,n){return new Promise(r=>{const o=this.layers[t||0];let a;const s=(o==null?void 0:o.screen)??null;if(s===e){r();return}n&&(a=Qu(n,s,r)),this.layers[t||0]={screen:e,transition:a},a||r()})},finishTransition(e){const t=this.layers[e];if(!t)ae(`Tried to finish transition on layer ${e} but it doesn't exist`);else if(t.transition){const n=t.transition.resolve;delete t.transition,n()}},transitionScreen(e,t,n){return this.setScreen(e,n??0,t)},emptyLayer(e,t){return new Promise(n=>{const r=this.layers[e];if(!r){er(`Tried to empty layer ${e} but it doesn't exist`);return}if(t){const o=r.screen,a=Qu(t,o,n);r.transition=a}r.screen="@empty",t||n()})},updateConfig(e){console.log("update config!");const t=Ve().buttons.buttons;for(const n in t)this.buttons[n]||(this.buttons[n]={state:t[n].enabled})},reset(e){this.$reset(),this.updateConfig(e)},changeButton(e,t){if(!this.buttons[e]){ae(`Tried to change button ${e} but it doesn't exist`);return}this.buttons[e].state=t},generateSaveData(){return{layers:Be(this.layers).filter(e=>e).map(e=>e.screen??null),buttons:Be(this.buttons)}},loadSaveData(e){this.layers=e.layers.map(t=>(t!==null&&typeof t!="string"&&(t=null),{screen:t})),this.buttons=Jn(this.buttons,e.buttons)},isButtonDisabled(e){const t=this.getButtonState(e);return t==="hidden"||t==="greyed"||t===!1},isButtonInteractible(e){const t=this.getButtonState(e);return t?t===!0:!1},isButtonClickable(e){if(!this.isButtonInteractible(e))return!1;const n=Un(e);return!!Zo(n)},getButtonState(e){const t=Un(e),n=this.buttons[e],r=t.tag||"default",o=n.state;return o===!0&&mt().isInteractionTagBlocked(r)?"greyed":o},clickOnButton(e){if(!this.isButtonClickable(e))return;const t=ve(),n=Un(e);Yn("onButtonClicked");const r=n.action;r&&(n.actionType==="run"?t.runLabelFunction(r):t.jumpToLabel(r))}},getters:{nonEmptyLayers(e){return e.layers.filter(t=>t)},isTransitioning(e){return e.layers.some(t=>t==null?void 0:t.transition)}}});function Zo(e){if(!Te().inScript)return!0;const t=Ei().clickableDuringScriptsByDefault;if(t)return e.scriptClickable!==!1;if(!t)return e.scriptClickable===!0}const t_=["screenObject","sprite"];function Yu(e){return typeof e=="object"&&e!==null&&t_.includes(e._entityType)}function n_(e){return typeof e=="object"&&e!==null&&e._entityType==="sprite"}function r_(e){if(e.includes(" ")){const t=e.split(" ");return{label:t[0],args:t.slice(1)}}else return{label:e}}const Dt=et("screenObjects",{state:()=>({tree:[],objectsList:{}}),actions:{addObject(e){e.parent?e.parent.children.push(e):this.tree.push(e),this.objectsList[e.id]=e},createObject(e){const t={_entityType:"screenObject",id:zn(),name:"Screen Object",tags:[],x:0,y:0,anchor:{x:0,y:0},width:1,height:1,opacity:1,scale:1,layer:0,children:[],...e};return this.addObject(t),t},destroyObject(e){let t=e;typeof t=="string"&&(t=this.getObject(t));for(let n=t.children.length-1;n>=0;n--)this.destroyObject(t.children[n]);if(t.parent){const n=t.parent,r=n.children.indexOf(t);r!==-1?n.children.splice(r,1):console.warn(`Could not find object ${t.id} in parent's children`)}else{const n=this.tree.indexOf(t);n!==-1?this.tree.splice(n,1):console.warn(`Object to destroy not found in store (${t.id})`)}delete this.objectsList[t.id]},createSprite(e){const t=this.createObject(e);return t._entityType="sprite",Xg(e.image).then(n=>{const r=this.getObject(t.id);r.width===1&&r.height===1&&(r.width=n.width,r.height=n.height)}),t},getObject(e){return this.objectsList[e]},isScreenObjectClickable(e){return Zo(e)?!!e.onClick:!1},clickObject(e){if(this.isScreenObjectClickable(e)&&e.onClick){Yn("onSpriteClicked");let t;if(typeof e.onClick=="string"){const n=r_(e.onClick);t={label:n.label,args:n.args}}else t=e.onClick;t.method=t.method??e.clickMethod??"jump",t.args=t.args??[],t.method==="run"?ve().runThenGoBackToPreviousDialog(t.label,...t.args):t.method==="jump"?ve().jumpToLabel(t.label,...t.args):ae(`Unknown sprite click method ${e.clickMethod}`)}},generateSaveData(){return{tree:Be(this.tree.map(e=>e.id)),objectsList:Be(Jg(this.objectsList,e=>this.screenObjectToSave(e)))}},loadSaveData(e){this.objectsList=this.loadAllObjects(e.objectsList),this.tree=e.tree.map(t=>this.objectsList[t])},reset(){this.$reset()},screenObjectToSave(e){return{...e,children:e.children.map(t=>t.id),parent:e.parent?e.parent.id:void 0}},loadAllObjects(e){for(const t of Object.values(e)){const n=t;n.parent=n.parent?e[n.parent]:void 0,n.children=n.children.map(r=>e[r])}return e},emptyLayer(e){for(let t=this.tree.length-1;t>=0;t--){const n=this.tree[t];n.layer===e&&this.destroyObject(n)}},emptyAllLayers(){for(let e=this.tree.length-1;e>=0;e--){const t=this.tree[e];this.destroyObject(t)}}}});function Ju(e){return"save"in e}function Xu(e){return"globalSave"in e}function o_(e){return"config"in e}const i_=i.defineComponent({props:{percentage:Number,step:String},methods:{loadingStyle(){return{width:`${this.percentage*60}vw`}}},computed:{}}),s_={id:"loading-bar"},a_={id:"loading-text"};function l_(e,t,n,r,o,a){return i.openBlock(),i.createElementBlock("div",s_,[i.createElementVNode("div",{id:"inner-loading-bar",style:i.normalizeStyle(e.loadingStyle())},null,4),i.createElementVNode("div",a_,[i.createElementVNode("h3",null,"Loading "+i.toDisplayString(Math.floor(e.percentage*100))+"% - "+i.toDisplayString(e.step),1)])])}const c_=zt(i_,[["render",l_]]),u_="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Generator:%20Adobe%20Illustrator%2019.0.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%206.00%20Build%200)%20--%3e%3csvg%20version='1.1'%20id='Rat'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20x='0px'%20y='0px'%20viewBox='0%200%20595.3%20595.3'%20style='enable-background:new%200%200%20595.3%20595.3;'%20xml:space='preserve'%3e%3cstyle%20type='text/css'%3e%20.st0{fill:%23E23B33;}%20%3c/style%3e%3cpath%20id='Rat_Shape'%20class='st0'%20d='M556.9,82.5c-10.8-24.3-47-57.1-71.3-65.6c-24.3-8.4-64.1-0.3-88.7,22.3%20c-20,18.4-26,28.2-29.1,37c-2.1,5.9-4.8,13.5-6,20.9v0c-0.5,4.1-4.5,7-8.6,6.1c-10.4-2.3-29.5-6-44.4-6.3%20c-13.7-0.2-30.1,3.2-40.4,5.7c-4.5,1.1-8.8-2.2-8.8-6.8c-0.1-5.3-1.1-12.3-4.8-19.6c-8.5-16.9-19.6-32.6-57.8-47.4%20c-31.9-12.4-75.1-9.7-100.8,1.8c-28.1,12.6-42.4,37.9-54,61.8c-14.4,29.8-14.9,83.6-6.4,104c12.8,30.7,35.8,47.2,52.6,53%20c11.3,3.8,28.2,3.7,38.2,3.3c4.2-0.2,7.7,3.3,7.5,7.5c-0.7,13.6-0.9,41.5,7,61.4c7.7,19.4,29.7,62.3,50.7,101.2%20c0,0.1-14.6,2.9-31.4,6.8c-23.9,5.5-52.6,12.7-54.3,13.7c-3.5,2.1-3,10-2.7,12c0.5,3.4,5.3,8.1,6.9,8.3c3.9,0.3,31.3-7.6,55.7-14.6%20c18.5-5.3,34.9-9.3,35.5-8.2c5.1,9.3,10,18,14.4,25.8c5.2,9.1,10.7,16.4,14.1,23.6c1.1,2.3-16.6,5.8-32.5,14.7%20c-16.4,9.1-29.7,21-32.3,24c-1.8,2.1-3,6-1.2,10.7c1.1,2.9,10,5.7,12.4,5.1c6.8-1.7,16.5-12.5,33.1-21.1%20c16.3-8.5,32.9-14.9,33.8-13.6c9.7,14.3,16.9,21.6,22.6,31.2c9.8,16.5,27.3,45.9,46.6,39.5c6.4-2.1,31.1-33.6,53.3-68.6%20c1.3-2.1,16.1,11.3,30.4,23.2c13.8,11.4,22.7,20.6,27.1,21.4c5.4,1,14.2-7.7,14.1-14.7c-0.1-2.7-14.3-13.8-29.1-26.2%20c-14.5-12.1-30.1-22.8-29.2-24.3c7.6-12,14.5-23.7,20.1-33.9c4.3-7.8,8.9-16,13-24.7c0.6-1.2,15.9,3,31.4,7.1c15.3,4,26.7,10,31,8%20c6.9-3,11.6-13.8,9.4-18.3c-1.1-2.3-17-7.3-33.2-12c-14.2-4.1-28-6.5-27.7-7.3c15.5-34,28.8-64.8,27.6-69.6%20c-1.7-7.1,2.6-11.9,7-36.5c3.2-18.1,4.7-40.9,5.2-51.7c0.2-3.5,2.8-6.3,6.3-6.7c3.1-0.3,6.9-0.9,10.5-1.9c7.8-2,18.6-7.8,36.4-20.6%20c17.9-12.8,38.7-49.6,44.4-67.8S567.6,106.8,556.9,82.5z%20M265.1,336.2c-8.1,4-13,7-26.4,9.6c-6.9,1.4-29.4-0.2-40.7-4.6%20c-10.5-4.1-19.9-7.6-30-15.4s-15.7-13.2-15.7-15.3c0-4.4,6-9.4,11-9.4c5.1,0,14.5,9.2,29.7,16.6c14.3,7,17.9,6.1,25.4,7.3%20c2.9,0.5,7.7,0.6,10.7,0.4c14.1-1.3,21.4-5.9,25.3-8.8c4-3,13.7-12.9,17.2-12.5c8,1,18.9,3.4,18.9,7.1%20C290.4,319,273.2,332.1,265.1,336.2z%20M320.9,521.4c-4.3,3.7-17.7,13.5-23.3,13.5c-2.8,0-7.4-8.2-11.5-16.8%20c-4.1-8.5-9.1-21.1-9.1-31.6c0-4.6,6-7.4,13.4-9.2c7.2-1.7,27.3-1.8,29.9-1.1c6.8,1.7,12.9,2.2,12.7,6.4c-0.4,12.7-7,18.9-8.3,24.3%20C323.4,512.3,323.4,519.2,320.9,521.4z%20M431.1,320.3c-9.2,7.4-10.6,8.1-24.9,13.7c-11.3,4.4-28.6,5.8-41.6,3.6%20c-12.2-2.1-22.3-4.6-29.5-10.1c-9.7-7.3-16.4-15.1-16.4-19.8c0-3.7,6.4-4.3,14.5-4.9c3.5-0.3,9.3,5.9,13.2,9.2%20c8.1,6.8,14.8,8,28.8,9.9c2.9,0.4,7.8,0.4,10.7,0.1c7.5-0.9,12-0.4,25.8-8.2c20-11.2,17.8-14.4,25.1-12.6c2.2,0.6,5.8,1.2,5.6,5.6%20C442.4,309,440.5,312.7,431.1,320.3z'/%3e%3c/svg%3e",d_={id:"engine-splash-screen",class:"flex justify-center items-center"},f_={id:"engine-splash-title"},p_=["src"],Ts=i.defineComponent({__name:"engine-splash",emits:["finished"],setup(e,{emit:t}){const n=t,r=i.ref("hidden"),o=i.computed(()=>({transitionDuration:`${h.value}s`})),a=i.computed(()=>({invisible:r.value!=="appear"})),s=Te(),c=i.computed(()=>{var m;return((m=le().splashScreens)==null?void 0:m.engineSplashScreen)??{}}),d=i.computed(()=>typeof c.value.overrideText=="string"?c.value.overrideText:"Made with narrat engine"),u=i.computed(()=>c.value.overrideLogo??u_),h=i.computed(()=>typeof c.value.fadeDuration=="number"?c.value.fadeDuration:.8),l=i.computed(()=>typeof c.value.timeBeforeFadeout=="number"?c.value.timeBeforeFadeout:1.5);i.onMounted(async()=>{if(await kt(10),r.value="appear",c.value.skip||s.options.debug){f();return}await kt(h.value*1e3),await kt(l.value*1e3),r.value="disappear",await kt(h.value*1e3),f()});function f(){s.loading.loaded?n("finished"):s.listener.once("gameLoaded",()=>{n("finished")})}return(m,y)=>(i.openBlock(),i.createElementBlock("div",d_,[i.createElementVNode("div",{id:"engine-splash-header",class:i.normalizeClass(["flex justify-center flex-col items-center",a.value]),style:i.normalizeStyle(o.value)},[i.createElementVNode("h1",f_,i.toDisplayString(d.value),1),i.createElementVNode("img",{src:u.value,alt:"Narrat Logo",id:"engine-splash-logo"},null,8,p_),i.createVNode(c_,{percentage:i.unref(s).loading.percentage,step:i.unref(s).loading.step},null,8,["percentage","step"])],6)]))}});class vs{constructor(){De(this,"listeners",{})}on(t,n){return this.listeners[t]||this.addEventToMap(t),this.listeners[t].add(n),n}off(t,n){return this.listeners[t]&&this.listeners[t].delete(n),n}once(t,n){const r=(...o)=>{this.off(t,r),n(...o)};return this.on(t,r)}emit(t,...n){this.listeners[t]&&this.listeners[t].forEach(r=>r(...n))}clear(){Object.keys(this.listeners).forEach(t=>{delete this.listeners[t]})}addEventToMap(t){this.listeners[t]=new Set}}class m_ extends vs{setup(){const t=()=>{this.emit("preUpdate"),this.emit("update"),this.emit("postUpdate"),requestAnimationFrame(t)};t()}}const io=new m_;Z.Vec2=void 0,(e=>{function t(y,b){return{x:y??0,y:b??0}}e.create=t;function n(y){return Math.sqrt(y.x*y.x+y.y*y.y)}e.magnitude=n;function r(y){const b=n(y);return b===0?t(0,0):{x:y.x/b,y:y.y/b}}e.normalize=r;function o(y,b){return{x:y.x+b.x,y:y.y+b.y}}e.add=o;function a(y,b){return{x:y.x-b.x,y:y.y-b.y}}e.subtract=a;function s(y,b){return{x:y.x*b.x,y:y.y*b.y}}e.multiply=s;function c(y,b){return{x:y.x*b,y:y.y*b}}e.scale=c;function d(y,b){return{x:y.x/b.x,y:y.y/b.y}}e.divide=d;function u(y,b){return n(a(y,b))}e.distance=u;function h(y,b,S){return{x:y.x+(b.x-y.x)*S,y:y.y+(b.y-y.y)*S}}e.lerp=h;function l(y,b){const S=Math.cos(b),T=Math.sin(b);return{x:y.x*S-y.y*T,y:y.x*T+y.y*S}}e.rotate=l;function f(y,b){const S=a(b,y);return e.normalize({x:-S.y,y:S.x})}e.normal=f;function m(y,b){return y.x*b.x+y.y*b.y}e.dot=m})(Z.Vec2||(Z.Vec2={}));function Ss(e,t,n,r){const o=e/n,a=t/r;return Math.min(o,a)}const sn=et("settings",{state:()=>({baseSettings:{textSpeed:30,animateText:!0,fontSize:16},settingsSchema:{textSpeed:{type:"number",defaultValue:30,minValue:1,maxValue:100,step:5,name:"Text Speed",description:"The speed at which text plays."},animateText:{type:"boolean",defaultValue:!0,name:"Animate Text",description:"Whether or not text should animate."},fontSize:{type:"integer",defaultValue:16,minValue:8,maxValue:64,step:1,name:"Font Size",description:"The base font size for the game."}},customSettings:{},customSettingsSchema:{}}),actions:{reset(e){this.$reset(),this.updateConfig(e)},getSetting(e){if(typeof this.baseSettings[e]<"u")return this.baseSettings[e];if(typeof this.customSettings[e]<"u")return this.customSettings[e];ae(`Setting ${e} does not exist.`)},getSettingSchema(e){if(typeof this.settingsSchema[e]<"u")return this.settingsSchema[e];if(typeof this.customSettingsSchema[e]<"u")return this.customSettingsSchema[e];ae(`Setting ${e} does not exist.`)},getAllSettingSchemas(){return{...this.settingsSchema,...this.customSettingsSchema}},setSetting(e,t){typeof this.baseSettings[e]<"u"?this.baseSettings[e]=t:typeof this.customSettings[e]<"u"?this.customSettings[e]=t:ae(`Setting ${e} does not exist.`),e==="fontSize"&&document.documentElement.style.setProperty("font-size",`${t}px`),e==="textSpeed"&&(le().dialogPanel.textSpeed=t),e==="animateText"&&(le().dialogPanel.animateText=t)},updateConfig(e){var t;if(this.setSetting("textSpeed",e.dialogPanel.textSpeed??Uo),this.setSetting("animateText",e.dialogPanel.animateText??!0),this.setSetting("fontSize",e.layout.defaultFontSize??16),(t=e.settings)!=null&&t.customSettings)for(const n in e.settings.customSettings)this.addCustomSetting(n,e.settings.customSettings[n])},addCustomSetting(e,t){this.customSettings[e]=t.defaultValue,this.customSettingsSchema[e]=t},generateSaveData(){return{baseSettings:Be(this.baseSettings),customSettings:Be(this.customSettings)}},loadSaveData(e){for(const t in e.baseSettings)this.setSetting(t,e.baseSettings[t]);for(const t in e.customSettings)typeof this.customSettings[t]<"u"&&this.setSetting(t,e.customSettings[t])}}});function so(e,t=50,n={}){let r;const o=n.isImmediate??!1,a=n.callback??!1,s=n.maxWait;let c=Date.now(),d=[];function u(){if(s!==void 0){const l=Date.now()-c;if(l+t>=s)return s-l}return t}const h=function(...l){const f=this;return new Promise((m,y)=>{const b=function(){if(r=void 0,c=Date.now(),!o){const I=e.apply(f,l);a&&a(I),d.forEach(({resolve:D})=>D(I)),d=[]}},S=o&&r===void 0;r!==void 0&&clearTimeout(r);const T=u();if(r=setTimeout(b,T),S){const I=e.apply(f,l);return a&&a(I),m(I)}d.push({resolve:m,reject:y})})};return h.cancel=function(l){r!==void 0&&clearTimeout(r),d.forEach(({reject:f})=>f(l)),d=[]},h}const Je=et("rendering",{state:()=>({screenHeight:window.innerHeight,screenWidth:window.innerWidth,layoutMode:"horizontal",resizeObserver:null,containerElement:null,narratAppElement:null,dialogPanelMode:"auto"}),actions:{generateSaveData(){return{dialogPanelMode:this.dialogPanelMode}},loadSaveData(e){this.dialogPanelMode=e.dialogPanelMode},reset(){this.dialogPanelMode="auto"},updateScreenSize(e,t){this.screenHeight=t,this.screenWidth=e,e<le().layout.verticalLayoutThreshold?(this.layoutMode="vertical",document.querySelector("html").style.fontSize=`${sn().baseSettings.fontSize}px`??"40px"):(this.layoutMode="horizontal",document.querySelector("html").style.fontSize=`${sn().baseSettings.fontSize}px`??"16px")},setContainer(e){this.containerElement=e,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeObserver=new ResizeObserver(so(()=>{this.refreshScreenSize()},100,{maxWait:200})),this.resizeObserver.observe(e),this.refreshScreenSize()},refreshScreenSize(){const e=this.containerElement;e&&this.updateScreenSize(e.clientWidth,e.clientHeight)}},getters:{gameScaleRatio(e){return Ss(this.screenWidth,this.screenHeight,this.gameWidth,this.gameHeight)},overlayMode(e){return!!(le().dialogPanel.overlayMode&&e.layoutMode==="horizontal")},gameWidth(){const e=le();return this.layoutMode==="vertical"||this.overlayMode?e.layout.backgrounds.width:e.layout.backgrounds.width+Pi()},gameHeight(){const e=le();return this.layoutMode==="vertical",e.layout.backgrounds.height},dialogWidth(){return this.layoutMode==="vertical"?this.viewportWidth:Pi()},dialogHeight(){return this.layoutMode==="vertical"?this.actualGameHeight-this.gameHeight:le().dialogPanel.height??this.gameHeight},actualGameHeight(){let e=this.gameHeight;return this.layoutMode==="vertical"&&(e=this.screenHeight/this.gameScaleRatio),e},viewportRatio(e){if(this.layoutMode==="vertical"){const t=le().layout.backgrounds;return e.screenWidth/t.width}return 1},viewportHeight(e){return le().layout.backgrounds.height*this.viewportRatio},viewportWidth(e){return le().layout.backgrounds.width*this.viewportRatio},showDialog(e){if(this.dialogPanelMode==="on")return!0;if(this.dialogPanelMode==="off")return!1;if(!this.overlayMode||this.layoutMode==="vertical")return!0;const t=Te().inScript;let n=!0;return Ut().isTransitioning&&le().dialogPanel.hideDuringTransition&&(n=!1),!le().dialogPanel.showAfterScriptEnd&&!t&&(n=!1),n},container(){return this.containerElement?this.containerElement:document.body},inputsContainer(){return Te().hasCustomContainer?this.container:window},narratApp(){return this.narratAppElement?this.narratAppElement:document.body}}});class h_ extends EventTarget{constructor(){super(...arguments);De(this,"gamepadAvailable",!0);De(this,"gameActions",{});De(this,"keyboardState",{});De(this,"actions",{});De(this,"lastInputMethodUsed","km");De(this,"gamepad",null)}kbEvent(){this.changeLastInput("km")}getGamepads(){return navigator.getGamepads?navigator.getGamepads():(this.gamepadAvailable=!1,[])}gamepadEvent(){this.changeLastInput("gamepad")}mouseEvent(){this.changeLastInput("km")}changeLastInput(n){this.lastInputMethodUsed!==n&&(this.lastInputMethodUsed=n,this.dispatchEvent(new CustomEvent("change-input",{detail:n})))}getGamepad(){const n=this.getGamepads().filter(r=>r!==null);if(n.length>0)return n[0]}startListening(){this.updateGamepad();const n=Je().inputsContainer;n.addEventListener("mousemove",r=>{this.mouseEvent()}),n.addEventListener("keydown",r=>{this.kbEvent();const o=this.getKeyboardState(r.key).current;this.keyboardState[r.key]={previous:o,current:!0}}),n.addEventListener("keyup",r=>{this.kbEvent();const o=this.getKeyboardState(r.key).current;this.keyboardState[r.key]={previous:o,current:!1}}),io.on("preUpdate",()=>{this.update()})}updateGamepad(){const n=this.getGamepad();n?this.gamepad?this.updateAllNarratButtons(n,this.gamepad):this.gamepad=this.setupNarratGamepad(n):this.gamepad=null}setupNarratGamepad(n){return{id:n.id,gamepad:n,buttons:n.buttons.map((o,a)=>this.getNarratButtonFromGamepad(o,o,a))}}updateAllNarratButtons(n,r){for(const[o,a]of n.buttons.entries()){const s=r.buttons[o];s.previous=Be(s.state),s.state=Be(a),s.previous.pressed!==s.state.pressed&&this.gamepadEvent()}}getNarratButtonFromGamepad(n,r,o){return{index:o,state:Be(r),previous:Be(r)}}addAction(n){if(this.gameActions[n.id]=n,n.type==="button"){const r={config:n,active:!1,justPressed:!1,justReleased:!1};this.actions[n.id]={state:r,previous:Be(r)}}else{const r={config:n,value:Z.Vec2.create(0,0),fullState:{left:0,right:0,up:0,down:0}};this.actions[n.id]={state:r,previous:Be(r)}}}getAnalog(n){return this.actions[n]||ae(`Action ${n} does not exist`),this.actions[n].state}getButton(n){return this.actions[n]||ae(`Action ${n} does not exist`),this.actions[n].state}getKeyboardState(n){return this.keyboardState[n]?this.keyboardState[n]:(this.keyboardState[n]={current:!1,previous:!1},this.keyboardState[n])}getGamepadState(n){return this.gamepad&&this.gamepad.buttons.length>n?{current:this.gamepad.buttons[n].state,previous:this.gamepad.buttons[n].previous}:null}debugGamepad(){if(this.gamepad)for(const[n,r]of this.gamepad.buttons.entries())r.state.pressed,r.previous.pressed}update(){this.updateGamepad(),this.debugGamepad();for(const n of Object.values(this.gameActions))if(n.type==="button"){const r=this.actions[n.id],o=Be(r.state),a=r.state;r.previous=o,n.action==="press"&&(n.keybinds.some(c=>{let d=!1;if(typeof c.keyboardKey=="string"&&this.getKeyboardState(c.keyboardKey).current===!0&&(d=!0),typeof c.gamepadButton=="number"){const u=this.getGamepadState(c.gamepadButton);u&&u.current.pressed===!0&&(d=!0)}return d})?a.active=!0:a.active=!1,a.active&&!o.active?a.justPressed=!0:a.justPressed=!1,!a.active&&o.active?a.justReleased=!0:a.justReleased=!1)}else if(n.type==="analog"){const r=this.actions[n.id],o=r.state;Be(r.state),r.previous=Be(o);let a=Z.Vec2.create(0,0);n.keybinds.forEach(s=>{this.getKeyboardState(s.left).current&&(o.fullState.left=1,a.x-=1),this.getKeyboardState(s.right).current&&(o.fullState.right=1,a.x+=1),this.getKeyboardState(s.up).current&&(o.fullState.up=1,a.y-=1),this.getKeyboardState(s.down).current&&(o.fullState.down=1,a.y+=1)}),a=Z.Vec2.normalize(a),o.value=a}}}const Ln=new h_,ht=et("menu",{state:()=>({menus:{},activeMenu:!1}),getters:{showSkills(){return Object.entries(dn().skills).length>0},showInventory(){return Object.entries(Ci().items).length>0},showQuests(){return Object.entries(wo().quests).length>0},showAchievements(){return Object.entries(ko().achievements).length>0},menuTabsToShow(e){return e.menus.menu.tabs.map(t=>{const n=le().menuButtons[t.id]||{};return{...t,...n}}).filter(t=>t.condition?t.condition():!0)},menu(e){return e.activeMenu?e.menus[e.activeMenu]:void 0},tab(){if(this.menu)return this.menu.tabs[this.menu.activeTab]}},actions:{setup(){},addMenu(e,t){this.menus[e]={...t,id:e}},addMenuOption(e,t){this.menus[e]||(this.menus[e]={id:e,label:e,tabs:[],activeTab:0}),this.menus[e].tabs.push(t)},setActiveTab(e){this.menu&&(this.menu.activeTab=e)},openMenu(e){this.activeMenu=e},closeMenu(){this.activeMenu=!1},toggleMenu(){this.activeMenu?this.activeMenu=!1:this.activeMenu="menu"}}}),y_=[{id:"left",type:"button",action:"press",keybinds:[{keyboardKey:"ArrowLeft",gamepadButton:14}]},{id:"right",type:"button",action:"press",keybinds:[{keyboardKey:"ArrowRight",gamepadButton:15}]},{id:"up",type:"button",action:"press",keybinds:[{keyboardKey:"ArrowUp",gamepadButton:12}]},{id:"down",type:"button",action:"press",keybinds:[{keyboardKey:"ArrowDown",gamepadButton:13}]},{id:"continue",type:"button",action:"press",keybinds:[{keyboardKey:"Enter",gamepadButton:0}]},{id:"cancel",type:"button",action:"press",keybinds:[{keyboardKey:"Escape",gamepadButton:1}]},{id:"system",type:"button",action:"press",keybinds:[{keyboardKey:"n",gamepadButton:9}]},{id:"menu",type:"button",action:"press",keybinds:[{keyboardKey:"m",gamepadButton:8}]},{id:"previousTab",type:"button",action:"press",keybinds:[{keyboardKey:"p",gamepadButton:4}]},{id:"nextTab",type:"button",action:"press",keybinds:[{keyboardKey:"o",gamepadButton:5}]},{id:"subPreviousTab",type:"button",action:"press",keybinds:[{keyboardKey:"i",gamepadButton:6}]},{id:"subNextTab",type:"button",action:"press",keybinds:[{keyboardKey:"u",gamepadButton:7}]},{id:"viewportSelect",type:"button",action:"press",keybinds:[{keyboardKey:"v",gamepadButton:2}]},{id:"autoPlay",type:"button",action:"press",keybinds:[{keyboardKey:"a",gamepadButton:6}]},{id:"skip",type:"button",action:"press",keybinds:[{keyboardKey:"s",gamepadButton:7}]}],Ke=et("inputs",{state:()=>({inputStack:[],baseInputListener:null,inputMode:"mk",inGameInputListener:null}),actions:{setupInputs(){Ln.addEventListener("change-input",e=>{this.inputMode=e.detail});for(const e of y_)Ln.addAction(e);this.listenToBaseNarratInputs(),io.on("preUpdate",()=>{for(const[e,t]of Object.entries(Ln.actions))if(t.state.config.type==="button"){const n=t;n.state.justPressed&&this.triggerListeners(e,"press",n),n.state.justReleased&&this.triggerListeners(e,"release",n)}else t.state.config.type})},createInGameInputListener(){this.inGameInputListener||(this.inGameInputListener=this.registerInputListener("in-game",{system:{press:()=>{ht().openMenu("system")}},menu:{press:()=>{ht().openMenu("menu")}}}))},removeInGameInputListener(){this.inGameInputListener&&(this.unregisterInputListener(this.inGameInputListener),this.inGameInputListener=null)},listenToContainerInputs(){Ln.startListening()},listenToBaseNarratInputs(){},triggerListeners(e,t,n){const r=this.inputStack[this.inputStack.length-1];if(r&&r.actions[e]&&r.actions[e][t])if(n.state.config.type==="button"){const o=r.actions[e][t],a=n;o(n.state.config,a.state,a.previous)}else console.warn("Analog events not implemented yet")},getInputs(){return Ln},registerInputListener(e,t){const r={id:`${Date.now()}-${Math.floor(Math.random()*1e8)}`,name:e,actions:t??{}};return this.inputStack.push(r),r},unregisterInputListener(e){const t=this.inputStack.findIndex(n=>n.id===e.id);if(t===-1)throw new Error("Input listener not found");this.inputStack.splice(t,1)},registerActions(e,t,n){e.actions[t]=n}}}),Nt=et("scenes-store",{state:()=>({scenes:{},activeScene:"engine-splash",currentOptions:{}}),getters:{isPlaying(e){return e.activeScene!=="engine-splash"&&e.activeScene!=="game-splash"&&e.activeScene!=="start-menu"}},actions:{generateSaveData(){return{activeScene:this.activeScene}},loadSaveData(e){},changeScene(e,t){const n=this.activeScene;if(n&&n!==e){const r=this.scenes[n];r.onLeaving&&r.onLeaving(),this.currentOptions={},this.activeScene=e,this.currentOptions=t||{},this.scenes[e].onStarting&&this.scenes[e].onStarting()}},getSceneConfig(e){return this.scenes[e]},onEngineSplashFinished(){this.changeScene("game-splash")},finishedScene(e){this.scenes[e].onFinished&&this.scenes[e].onFinished()},addNewScene(e){this.scenes[e.id]=e}}}),g_={id:"game-splash-screen",style:{height:"100%",padding:"20px"},class:"flex justify-center items-center"},__={id:"game-splash-screen-header flex justify-center flex-col items-center",class:"flex justify-center flex-col items-center"},b_={class:"title",id:"game-splash-title"},ws=i.defineComponent({__name:"game-splash",setup(e){const t=i.ref(null),n=Te(),r=i.computed(()=>{var d;return((d=le().splashScreens)==null?void 0:d.gameSplashScreen)??{}}),o=i.computed(()=>typeof r.value.startButtonText=="string"?r.value.startButtonText:"Press to start"),a=i.computed(()=>n.loading.loaded),s=i.computed(()=>le().gameTitle||"Narrat Game");function c(){Nt().changeScene("start-menu")}return i.onMounted(()=>{t.value=Ke().registerInputListener("game-splash",{continue:{press:()=>{c()}},system:{press:()=>{c()}}}),n.options.debug&&c()}),i.onUnmounted(()=>{t.value&&Ke().unregisterInputListener(t.value)}),(d,u)=>(i.openBlock(),i.createElementBlock("div",g_,[i.createElementVNode("div",__,[i.createElementVNode("h1",b_,i.toDisplayString(s.value),1),a.value?(i.openBlock(),i.createElementBlock("button",{key:0,class:"nrt-button menu-button main-menu-button large splash-start-button override",onClick:c},i.toDisplayString(o.value),1)):i.createCommentVNode("",!0)])]))}});function Sn(e){if(!e.listener)return console.warn("No input listener provided for navigation"),null;const t=i.ref(-1),n=i.computed(()=>e.mode==="grid"?t.value%e.columns:0),r=i.ref([]),o=i.ref(Ln.lastInputMethodUsed),a=i.ref(null);function s(){var W,X;return(W=e.container)!=null&&W.value?e.container.value.children:(X=e.elements)!=null&&X.value?e.elements.value.filter(G=>G!==null):[]}function c(){r.value=s()}const d=i.computed(()=>l(t.value));function u(W){return r.value?W>=0&&W<r.value.length:!1}function h(W){const X=t.value;if(u(W)&&(t.value=W,d.value)){o.value==="gamepad"&&d.value.classList.add("selected");const G=l(X);G&&X!==W&&G.classList.remove("selected"),e.onSelected&&e.onSelected(W)}}function l(W){return r.value?r.value[W]:null}function f(){r.value&&(t.value===0?e.loopForbidden||h(r.value.length-1):h(t.value-1))}function m(){r.value&&(t.value===r.value.length-1?e.loopForbidden||h(0):h(t.value+1))}function y(){if(!r.value)return;const W=e,X=t.value;!e.loopForbidden&&X<W.columns?h(r.value.length-1):h(t.value-e.columns)}function b(){if(!r.value)return;const W=e,X=t.value;!e.loopForbidden&&X>=r.value.length-W.columns?h(0):h(t.value+e.columns)}function S(){e.mode==="grid"?y():e.mode==="list"&&f()}function T(){e.mode==="grid"?b():e.mode==="list"&&m()}function I(){(e.mode==="grid"||e.mode==="list")&&f()}function D(){(e.mode==="grid"||e.mode==="list")&&m()}function R(){e.onChosen&&e.onChosen(t.value)}i.onMounted(()=>{Y()});function F(){e.listener&&(e.onlyVertical||(delete e.listener.actions.left,delete e.listener.actions.right),e.onlyHorizontal||(delete e.listener.actions.up,delete e.listener.actions.down),e.noChoosing||delete e.listener.actions.continue,a.value&&Ln.removeEventListener("change-input",a.value))}function L(){d.value&&d.value.classList.add("selected")}function P(){d.value&&d.value.classList.remove("selected")}function Y(){e.listener&&(c(),a.value=W=>{o.value=W.detail,W.detail==="gamepad"?L():P()},Ln.addEventListener("change-input",a.value),e.onlyVertical||(e.listener.actions.left={press:I},e.listener.actions.right={press:D}),e.onlyHorizontal||(e.listener.actions.up={press:S},e.listener.actions.down={press:T}),e.noChoosing||(e.listener.actions.continue={press:R}),h(0))}return i.onUnmounted(()=>{F()}),i.watch(()=>{var W;return(W=e.elements)==null?void 0:W.value},W=>{W&&c()}),{selectedIndex:t,selectedElement:d,currentColumn:n,buttonDown:T,buttonUp:S,buttonLeft:I,buttonRight:D,selectUp:y,selectDown:b,selectPrevious:f,selectNext:m,select:h,disable:F,mount:Y}}const T_={class:"used-save-slot flex flex-row justify-between items-center grow"},v_={class:"flex flex-col save-slot-number-container"},S_={class:"save-slot-number"},w_={class:"flex flex-col justify-center save-info"},k_={key:1,class:"save-name"},C_={class:"flex flex-col"},$_={key:0},E_={key:1},O_={key:2},A_=["onClick"],ks=i.defineComponent({__name:"save-slot-ui",props:{saveSlot:{},id:{},actions:{},selected:{type:Boolean},inputListener:{}},emits:["choice","cancel"],setup(e,{expose:t,emit:n}){var R;const r=e,o=i.ref(null),a=i.ref(null),s=i.ref(null);t({slotContainer:s});const c=i.ref(((R=r.saveSlot.saveData)==null?void 0:R.metadata.name)??"Empty Save"),d=i.ref(0),u=i.computed(()=>r.saveSlot.saveData!==null),h=i.computed(()=>r.saveSlot.saveData),l=i.computed(()=>le().saves.mode),f=i.computed(()=>{const F=r.saveSlot.saveData;if(F&&F.screens.layers[0]){const L=Lr(F.screens.layers[0]);if(L)return{backgroundImage:`url(${Mr(L.background)})`}}return!1}),m=n;function y(F){m("choice",F)}function b(F){return h.value?Ui(h.value.main.playTime/1e3):"00:00:00"}function S(){h.value&&Op(r.saveSlot.id,c.value)}function T(){const F=le().saves.slots;let L="";const P=r.saveSlot.slotNumber;return P===0&&le().saves.mode==="manual"?"AUTO":(F>=10&&P<10&&(L+="0"),F>=100&&P<100&&(L+="0"),L+P)}function I(){o.value=Sn({mode:"list",container:a,listener:r.inputListener,onlyHorizontal:!0,onSelected:F=>{d.value=F},onChosen:F=>{y(F)}}),o.value.mount()}function D(){o.value.disable(),o.value=null}return i.watch(()=>r.selected,(F,L)=>{F&&!o.value&&I(),!F&&o.value&&D()}),i.onUnmounted(()=>{o.value&&D()}),(F,L)=>(i.openBlock(),i.createElementBlock("div",{class:"save-slot flex flex-row",ref_key:"slotContainer",ref:s},[i.createElementVNode("div",T_,[i.createElementVNode("div",v_,[i.createElementVNode("h1",S_,i.toDisplayString(T()),1)]),f.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"save-slot-screenshot",style:i.normalizeStyle(f.value)},null,4)):i.createCommentVNode("",!0),i.createElementVNode("div",w_,[u.value?i.withDirectives((i.openBlock(),i.createElementBlock("input",{key:0,type:"text",class:"save-name","onUpdate:modelValue":L[0]||(L[0]=P=>c.value=P),onInput:S},null,544)),[[i.vModelText,c.value]]):(i.openBlock(),i.createElementBlock("h3",k_,i.toDisplayString(c.value),1)),i.createElementVNode("div",C_,[h.value?(i.openBlock(),i.createElementBlock("p",$_,i.toDisplayString(new Date(h.value.metadata.saveDate).toLocaleString()),1)):i.createCommentVNode("",!0),h.value?(i.openBlock(),i.createElementBlock("p",E_,"Play time: "+i.toDisplayString(b(F.saveSlot)),1)):i.createCommentVNode("",!0),l.value==="game-slots"?(i.openBlock(),i.createElementBlock("p",O_,i.toDisplayString(F.saveSlot.slotType==="auto"?"Auto Save":"Manual Save"),1)):i.createCommentVNode("",!0)])]),i.createElementVNode("div",{class:"flex flex-row",ref_key:"actionsContainer",ref:a},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(F.actions,(P,Y)=>(i.openBlock(),i.createElementBlock("button",{class:i.normalizeClass(["nrt-button",{selected:F.selected&&Y===d.value}]),onClick:()=>y(Y),key:Y},[i.createElementVNode("h3",null,i.toDisplayString(P),1)],10,A_))),128))],512)])],512))}}),I_=i.createElementVNode("h3",{class:"title"},"Confirmation",-1),ei=i.defineComponent({__name:"yes-no",props:{prompt:{type:String,required:!0},onConfirm:{type:Function,required:!1},onRefuse:{type:Function,required:!1}},emits:["choice"],setup(e,{emit:t}){const n=i.ref(Ke().registerInputListener("yes-no",{cancel:{press:()=>{s(!1)}},continue:{press:()=>{s(!0)}}})),r=i.ref(null);Sn({mode:"list",container:r,listener:n.value,onChosen:c=>{s(c===0)}});const o=e,a=t;function s(c){c===!0&&o.onConfirm?o.onConfirm():c===!1&&o.onRefuse&&o.onRefuse(),a("choice",c)}return i.onMounted(()=>{}),i.onUnmounted(()=>{n.value&&Ke().unregisterInputListener(n.value)}),(c,d)=>(i.openBlock(),i.createBlock(_n,{onClose:d[2]||(d[2]=()=>s(!1)),containerCssClass:"yes-no-modal"},{header:i.withCtx(()=>[I_]),body:i.withCtx(()=>[i.createElementVNode("h3",null,i.toDisplayString(e.prompt),1),i.createElementVNode("div",{class:"flex justify-center",ref_key:"buttonsContainer",ref:r},[i.createElementVNode("button",{class:"nrt-button",onClick:d[0]||(d[0]=()=>s(!0))},"Yes"),i.createElementVNode("button",{class:"nrt-button",onClick:d[1]||(d[1]=()=>s(!1))},"No")],512)]),_:1}))}}),N_={class:"nrt-title"},P_={key:0},j_={class:"saves-section"},x_=i.createElementVNode("h3",{class:"saves-section-title"},"Auto save",-1),D_={class:"saves-section"},L_=i.createElementVNode("h3",{class:"saves-section-title"},"Manual Saves",-1),M_={key:1,class:"saves-section"},B_=i.createElementVNode("h3",{class:"saves-section-title"},"Save Slots",-1),R_={class:"saves-container flex flex-col"},Zu=i.defineComponent({__name:"save-slots",props:{mode:{}},emits:["chosen","close"],setup(e,{emit:t}){const n=e,r=i.ref(Ke().registerInputListener("save-slots",{cancel:{press:()=>{Y()}}})),o=i.ref(0),a=i.reactive([]),s=i.computed(()=>a.slice(0,1)),c=i.computed(()=>a.slice(1)),d=i.ref([]),u=i.ref([]),h=i.ref([]),l=i.ref([]),f=i.ref([]);i.ref({mode:"list",elements:l,listener:r.value,onlyVertical:!0,noChoosing:!0,onSelected:G=>{o.value=G}});const m=Sn({mode:"list",elements:l,listener:r.value,onlyVertical:!0,noChoosing:!0,onSelected:G=>{o.value=G}}),y=i.computed(()=>{const G=o.value;return f.value.length<G+1?null:f.value[G].id}),b=i.reactive(n.mode==="load"?["Load","Delete"]:["Choose"]),S=i.computed(()=>le().saves.mode),T=i.reactive({prompt:"Are you sure you want to delete this save file?",saveToDelete:null,onConfirm:()=>{P(T.saveToDelete),T.saveToDelete=null},onRefuse:()=>{T.saveToDelete=null}}),I=i.reactive({prompt:"Are you sure you want to overwrite this save file?",saveToOverwrite:null,onConfirm:()=>{F(I.saveToOverwrite),I.saveToOverwrite=null},onRefuse:()=>{I.saveToOverwrite=null}}),D=t;i.onBeforeMount(()=>{bn().slots.forEach((Q,te)=>{a[te]=Q})});function R(){l.value=S.value==="manual"?[...u.value.map(z=>z.slotContainer),...h.value.map(z=>z.slotContainer)]:d.value.map(z=>z.slotContainer);const G=S.value==="manual"?[...s.value,...c.value]:a;f.value=G.map(z=>({id:z.id}))}i.onMounted(()=>{R()}),i.onUnmounted(()=>{m.value&&(m.value.disable(),m.value=null),r.value&&Ke().unregisterInputListener(r.value)});function F(G){D("chosen",{slotId:G})}function L(G){const z=X(G);if(z){if(le().saves.mode==="manual"&&z.slotType==="auto"){Te().alert("Sorry","Can't delete the auto save slot!");return}T.saveToDelete=G}}function P(G){Ep(G);const z=a.find(Q=>Q.id===G);z&&(z.saveData=null),R()}function Y(){D("close")}function W(G,z){const Q=b[z];Q==="Load"?F(G):Q==="Delete"?L(G):Q==="Choose"&&(I.saveToOverwrite=G)}function X(G){return a.find(z=>z.id===G)}return(G,z)=>(i.openBlock(),i.createBlock(_n,{onClose:Y,containerCssClass:"save-modal",cantClose:!1},{header:i.withCtx(()=>[i.createElementVNode("h3",N_,i.toDisplayString(G.mode==="load"?"Choose a save to load":"Pick a slot to save the game"),1)]),body:i.withCtx(()=>[S.value==="manual"?(i.openBlock(),i.createElementBlock("div",P_,[i.createElementVNode("div",j_,[x_,i.createVNode(i.TransitionGroup,{name:"list",tag:"div"},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,Q=>(i.openBlock(),i.createBlock(ks,{key:Q.id,saveSlot:Q,id:Q.id,actions:b,onChoice:te=>W(Q.id,te),inputListener:r.value,selected:y.value===Q.id,ref_for:!0,ref_key:"autoSlotsElements",ref:u},null,8,["saveSlot","id","actions","onChoice","inputListener","selected"]))),128))]),_:1})]),i.createElementVNode("div",D_,[L_,i.createVNode(i.TransitionGroup,{name:"list",tag:"div"},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.value,Q=>(i.openBlock(),i.createBlock(ks,{key:Q.id,saveSlot:Q,id:Q.id,actions:b,onChoice:te=>W(Q.id,te),inputListener:r.value,selected:y.value===Q.id,ref_for:!0,ref_key:"manualSlotsElements",ref:h},null,8,["saveSlot","id","actions","onChoice","inputListener","selected"]))),128))]),_:1})])])):(i.openBlock(),i.createElementBlock("div",M_,[B_,i.createElementVNode("div",R_,[i.createVNode(i.TransitionGroup,{name:"list",tag:"div"},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a,Q=>(i.openBlock(),i.createBlock(ks,{key:Q.id,saveSlot:Q,id:Q.id,actions:b,onChoice:te=>W(Q.id,te),selected:y.value===Q.id,inputListener:r.value,ref_for:!0,ref_key:"saveSlotsElements",ref:d},null,8,["saveSlot","id","actions","onChoice","selected","inputListener"]))),128))]),_:1})])])),T.saveToDelete?(i.openBlock(),i.createBlock(ei,{key:2,prompt:T.prompt,onRefuse:T.onRefuse,onConfirm:T.onConfirm},null,8,["prompt","onRefuse","onConfirm"])):i.createCommentVNode("",!0),I.saveToOverwrite?(i.openBlock(),i.createBlock(ei,{key:3,prompt:I.prompt,onRefuse:I.onRefuse,onConfirm:I.onConfirm},null,8,["prompt","onRefuse","onConfirm"])):i.createCommentVNode("",!0)]),_:1}))}}),F_=i.defineComponent({__name:"start-menu-button",props:{button:{}},emits:["click"],setup(e){return(t,n)=>(i.openBlock(),i.createElementBlock("button",{class:i.normalizeClass(["nrt-button menu-button main-menu-button large override",t.button.cssClass]),onClick:n[0]||(n[0]=r=>t.$emit("click"))},i.toDisplayString(t.button.title),3))}});class Cs extends vs{setup(t=!1){const r=t?"keydown":"keyup",o=so(s=>{qt.emit("debouncedKeydown",s)},10,{isImmediate:!0,maxWait:10}),a=Je().inputsContainer;a.addEventListener("keydown",s=>{qt.emit("keydown",s)}),a.addEventListener(r,s=>{o(s)})}}const qt=new Cs,$s=et("startMenu",{state:()=>({buttons:[]}),actions:{addButtonsFromPlugins(){Ie.plugins.forEach(t=>{t.startMenuButtons&&t.startMenuButtons.forEach(n=>{const r=window.narrat.app;n.popupComponent&&r.component(n.popupComponent.name,n.popupComponent.component),this.buttons.push(n)})})}}});function V_(){cd()}function ed(){V_(),Te().menuReturn()}async function U_(e){if(le().saves.mode==="manual"){const t=Hi();t&&(e=t.id)}Te().setSaveSlot(e),ud(bn().globalSave),td(),ve().runGame()}function td(){ft().stopAll(),Yn("onPressStart"),ve().start(),Te().prepareToPlay(),Ie.callHook("onGameStart")}async function q_(e,t){if(le().saves.mode==="manual"){const n=Hi();n&&(t=n.id)}if(Te().setSaveSlot(t),td(),e.saveData){oT({gameSave:e.saveData,globalSave:bn().globalSave}),ft().reloadAudio(e.saveData.audio);const n=ve(),r=le().saves.runOnReload;typeof r=="string"&&await ve().runLabelFunction(r),n.jumpToLabel(e.saveData.vm.lastLabel)}}const H_={id:"game-menu"},K_={id:"game-header",class:"flex flex-col justify-between items-center"},G_={id:"game-title-container"},z_={id:"game-title-text"},W_={class:"nrt-title"},Es=zt(i.defineComponent({__name:"StartMenu",setup(e){const t=i.ref(Ke().registerInputListener("start-menu",{})),n=i.ref([]),r=i.ref(null),o=i.ref(!1),a=i.ref(!1),s=i.ref(null),c=i.ref(null),d=i.ref(!1),u=i.ref(!1),h=i.ref(null),l=$s(),f=i.ref(!1),m=i.ref(null),y=i.computed(()=>l.buttons),b=Sn({mode:"list",container:r,listener:t.value,onChosen:Q=>{S(n.value[Q])}});function S(Q){switch(Q.id){case"continue":P();break;case"new-game":T();break;case"load-game":Y();break;case"exit":Te().exitGame();break;default:D(Q);break}}async function T(){o.value&&le().saves.mode==="manual"&&!le().saves.disabled?u.value=!0:I()}async function I(){if(c.value===null)if(le().saves.mode==="manual"){const Q=Hi();if(!Q){ae("No autosave found");return}c.value=Q.id}else{const Q=Cp();if(!Q){ae("No free slot found");return}c.value=Q}u.value=!1,await U_(c.value)}function D(Q){const te=y.value.findIndex(Ne=>Ne.id===Q.id),ke=y.value[te];ke.action&&ke.action(),ke.popupComponent&&(f.value=ke)}function R(){f.value=!1}function F(){u.value=!1}async function L(){if(!c.value)return;const Q=zr(c.value);if(!Q){ae("No save file found");return}q_(Q,c.value)}function P(){typeof s.value=="string"&&(c.value=s.value,L())}function Y(){d.value=!0}function W({slotId:Q}){const te=zr(Q);te&&te.saveData?(c.value=Q,L()):T()}i.onMounted(()=>{const Q=bn();Q.slots.some(te=>te.saveData)&&(o.value=!0),(le().saves.mode==="manual"||Q.slots.some(te=>!te.saveData))&&(a.value=!0),Q.lastSaveSlot&&zr(Q.lastSaveSlot)&&(s.value=Q.lastSaveSlot),X(),h.value=qt.on("debouncedKeydown",te=>{te.key===" "&&I(),te.key==="c"&&P()}),i.nextTick(()=>{b.select(0)}),Lt().options.defaultMusic&&(m.value=pm(Lt().options.defaultMusic))});function X(){const Q=le().saves.disabled;s.value&&!Q&&n.value.push(G({id:"continue",title:"Continue",cssClass:"continue-button"})),a.value&&n.value.push(G({id:"new-game",title:"New Game",cssClass:"start-button"})),o.value&&!Q&&n.value.push(G({id:"load-game",title:"Load Game",cssClass:"continue-button"}));for(const te of y.value)n.value.push({id:te.id,title:te.text,cssClass:`${te.id}-start-menu-button`});n.value.push(G({id:"exit",title:"Exit",cssClass:"exit-button"}))}function G({id:Q,title:te,cssClass:ke}){const Ne=le().menuButtons[Q];if(Ne){let Ze=ke;return Ne.cssClass&&(Ze=`${Ne.cssClass} ${ke}`),{id:Q,title:Ne.text??te,cssClass:Ze}}return{id:Q,title:te,cssClass:ke}}i.onUnmounted(()=>{if(t.value&&Ke().unregisterInputListener(t.value),h.value&&qt.off("debouncedKeydown",h.value),typeof m.value=="number"){const Q=Lt().options.defaultMusic;mm(Q,m.value)}});const z=i.computed(()=>le().gameTitle);return(Q,te)=>(i.openBlock(),i.createElementBlock("div",H_,[d.value?(i.openBlock(),i.createBlock(Zu,{key:0,mode:"load",onChosen:W,onClose:te[0]||(te[0]=ke=>d.value=!1)})):i.createCommentVNode("",!0),u.value?(i.openBlock(),i.createBlock(ei,{key:1,prompt:"This will override your previous autosave, are you sure?",onConfirm:I,onRefuse:F})):i.createCommentVNode("",!0),i.createElementVNode("div",K_,[i.createElementVNode("div",G_,[i.createElementVNode("h1",z_,i.toDisplayString(z.value),1)]),i.createElementVNode("div",{class:"flex flex-col start-menu-buttons-container",ref_key:"buttonsContainer",ref:r},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.value,ke=>(i.openBlock(),i.createBlock(F_,{key:ke.id,button:ke,onClick:Ne=>S(ke)},null,8,["button","onClick"]))),128))],512)]),f.value?(i.openBlock(),i.createBlock(i.Teleport,{key:2,to:"#narrat"},[i.createVNode(_n,{onClose:R,class:i.normalizeClass(`start-menu-popup-${f.value.id}`)},{header:i.withCtx(()=>[i.createElementVNode("h3",W_,i.toDisplayString(f.value.text),1)]),body:i.withCtx(()=>[f.value.popupComponent?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(f.value.popupComponent.component),{key:0,onClose:R},null,32)):i.createCommentVNode("",!0)]),_:1},8,["class"])])):i.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-a3f319bb"]]);function ti(e){const t=Oi().characters[e];return t||ae(`Character ${e} not found`),t}function Q_(e,t){const n=ti(e);if(n&&(t||(t="default"),n.sprites)){const r=n.sprites[t];return r==="none"?void 0:typeof r=="string"?{image:r}:r}}function nd(e){return`${Oi().config.imagesPath}${e}`}function Y_(e){return typeof e=="object"&&Object.hasOwn(e,"image")}function J_(e){return typeof e=="object"&&Object.hasOwn(e,"video")}function Os(e){var t;return e?((t=ti(e))==null?void 0:t.style)||{}:{}}const X_=["src"],Z_=["autoplay","loop","muted"],eb=["src"],tb=i.defineComponent({__name:"dialog-picture",props:{picture:{},video:{},character:{},pose:{}},setup(e){const t=e,n=i.computed(()=>t.video),r=i.computed(()=>Je().layoutMode),o=i.computed(()=>{var d;const s={};if(!t.character)return{};t.character&&(s[t.character]=!0);const c=ti(t.character);return(d=c==null?void 0:c.style)!=null&&d.portraitCssClass&&(s[c.style.portraitCssClass]=!0),s}),a=i.computed(()=>{var m,y;const s=Je(),c=le().layout;let d=0,u=0;const h=c.portraits;if(r.value==="vertical"){const b=((m=h.offset)==null?void 0:m.portrait)??{right:0,bottom:0};d=20+b.right,u=s.dialogHeight+b.bottom}else{const b=((y=h.offset)==null?void 0:y.landscape)??{right:0,bottom:0},S=le().dialogPanel.rightOffset??rs.dialogPanel.rightOffset;d=Pi()-10+b.right+S,u=200+b.bottom}let l=c.portraits.width,f=c.portraits.height;return t.video&&(l=t.video.width??l,f=t.video.height??f),t.picture&&(l=t.picture.width??l,f=t.picture.height??f),{right:`${d}px`,bottom:`${u}px`,width:`${l}px`,height:`${f}px`}});return(s,c)=>{var d;return i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["dialog-picture override",o.value]),style:i.normalizeStyle(a.value)},[s.picture?(i.openBlock(),i.createElementBlock("img",{key:0,src:i.unref(Et)(i.unref(nd)((d=s.picture)==null?void 0:d.image)),class:i.normalizeClass(["picture override",o.value])},null,10,X_)):i.createCommentVNode("",!0),n.value?(i.openBlock(),i.createElementBlock("video",{key:1,class:"picture override",autoplay:n.value.autoplay!==!1,loop:n.value.loop!==!1,muted:!!n.value.muted},[i.createElementVNode("source",{src:i.unref(Et)(i.unref(nd)(n.value.video))},null,8,eb)],8,Z_)):i.createCommentVNode("",!0)],6)}}});function nb(){return Lt().dialogAudio}function rd(e){const t=nb();if(t){if(t.characterAudio&&t.characterAudio[e])return t.characterAudio[e];if(t.defaultAudio)return t.defaultAudio}}function od(e,t){if(typeof t!="string")return;const n=rd(e);return n==null?void 0:n.soundPerLetter}function rb(e,t){if(typeof t!="string")return;const n=od(e,t);if(!n)return;const r=n;let o="";return r.prefix&&(o+=r.prefix),o+=t,r.suffix&&(o+=r.suffix),o}function ob(e,t){if(typeof t!="string")return;const n=t.toLowerCase(),r=rb(e,n);if(typeof r!="string")return;const o=Qt(r);if(o){const a=od(e,n);let s=1;a.volume&&(s=a.volume);const c=ft().audioVolume("sound",r)*s;o.volume(c),o.play()}}function ib(e){const t=rd(e);if(t!=null&&t.soundOnNewLine){const n=Qt(t.soundOnNewLine);if(n){const r=ft().audioVolume("sound",t.soundOnNewLine);n.volume(r),n.play()}}}const sb=["innerHTML"],ab=["innerHTML"],lb=["innerHTML"],cb={key:1},ub=["onClick","innerHTML"],db={key:1},fb={key:2,class:"buttons-container"},pb=i.defineComponent({__name:"dialog-box",props:{options:{},active:{type:Boolean},inputListener:{}},setup(e,{expose:t}){const n=i.ref(null),r=i.ref(""),o=i.ref(!1),a=i.ref(null),s=i.ref(null),c=i.ref(!1),d=i.ref(null),u=i.ref(null),h=i.ref(null),l=i.ref(null),f=i.ref(null),m=e,y=i.ref(null);m.active&&(y.value=Sn({mode:"list",container:n,listener:m.inputListener,onlyVertical:!0,onChosen:B=>{ee.value&&M.value?F(M.value[B]):I(" ")}})),i.onMounted(()=>{ke(),c.value=!0}),i.onUnmounted(()=>{b(),z(),nt({unmounted:!0})});function b(){a.value&&(clearTimeout(a.value),a.value=null),S()}function S(){y.value&&(y.value.disable(),y.value=null)}function T(B){I(B.key)}function I(B){if(!ee.value){c.value&&s&&B===" "&&nt({pressedSpace:!0});return}if(ee.value&&m.options.textField&&B==="Enter"&&X(),ee.value&&!m.options.textField){let J=-1;switch(B){case" ":J=0;break;case"1":J=0;break;case"2":J=1;break;case"3":J=2;break;case"4":J=3;break;case"5":J=4;break;case"6":J=5;break;case"7":J=6;break;case"8":J=7;break}J!==-1&&M.value&&J<M.value.length?F(M.value[J]):J===0&&F(J)}}function D(){ee.value||c.value&&s&&nt({pressedSpace:!0})}function R(){o.value||F(0)}function F(B){L();let J;typeof B=="object"?J=B.originalIndex:J=B,Te().playerAnswered(J)}function L(){b(),nt({unmounted:!0}),o.value=!0}function P(B){const J={};return B.allowed||(J.pointerEvents="none",J.textDecoration="line-through"),J}function Y(B,J){const fe={index:B+1,choice:J.choice};let ce='<span class="choice-index">%{$index}. </span> <span class="choice-text">%{$choice}</span>';if(Ua().choiceTextTemplate&&(ce=Ua().choiceTextTemplate),J.flag){const be=$f(J.flag);be!=null&&be.textTemplate&&(ce=be.textTemplate)}return Nl(fe,ce)}function W(B){const J={};if(B.allowed||(J["strike-anim"]=!0),B.seenBefore&&(J["seen-before"]=!0),B.flag){const fe=$f(B.flag);fe!=null&&fe.cssClass&&(J[fe.cssClass]=!0)}return J}function X(){const B=r.value;z(),Te().playerAnswered(B)}function G(){m.options.textField&&(a.value=setTimeout(()=>{ee.value&&(f.value=Ke().registerInputListener("text-field-input-grabber",{}),l.value&&l.value.focus())},100))}function z(){f.value&&(Ke().unregisterInputListener(f.value),f.value=null)}function Q(B,J){const fe=m.options.text.substring(B,J);s.value.text+=fe;const ce=fe.substring(0,1);return ob(m.options.styleId,ce),J}function te(B){const J=B[0];return s.value.text+=J,s.value.skippedChars+=J.length,J.length}function ke(){if(!m.options.old)if(Fe().playMode==="skip")Ne();else if(ib(m.options.styleId),le().dialogPanel.animateText){s.value={text:"",index:0,startTime:Date.now(),timer:null,skippedChars:0,tags:cm(m.options.text),finished:!1};const B=s.value;B.timer=setInterval(()=>{qe()},30)}else E.value&&(d.value=setTimeout(()=>{nt()},(le().dialogPanel.textSpeed??Uo)*m.options.text.length))}function Ne(){Fe().playMode==="skip"&&!m.options.old&&(E.value?u.value=setTimeout(()=>{nt()},100):(Fe().toggleSkip(),nt({unmounted:!0})))}function Ze(){Fe().playMode==="auto"&&!m.options.old&&E.value&&ee&&R()}function qe(){const B=s.value;if(!B)return;const J=B.index,fe=Date.now()-B.startTime;let ce=!1,be=Math.round(fe/(le().dialogPanel.textSpeed??Uo))+B.skippedChars;if(be>m.options.text.length&&(ce=!0,B.finished=!0,be=m.options.text.length),be!==B.index){let Se=J;for(;B.tags.length>0&&be>=B.tags[0].index;){Se=Q(Se,B.tags[0].index);const Le=te(B.tags.shift());Se+=Le,be+=Le}Se=Q(Se,be),B.index=Se}ce&&nt()}function nt({unmounted:B,pressedSpace:J}={}){ve().endTextAnimation(),G(),setTimeout(()=>{y.value&&y.value.select(0)},10),s.value&&(s.value.timer&&clearInterval(s.value.timer),s.value=null),d.value&&!J&&clearTimeout(d.value),u.value&&clearTimeout(u.value),h.value&&clearTimeout(h.value),!B&&!J&&Fe().playMode!=="normal"&&E&&(h.value=setTimeout(()=>{R()},Fe().playMode==="auto"?le().dialogPanel.timeBetweenLines??Tr.common.dialogPanel.timeBetweenLines:0))}const j=i.computed(()=>m.options.title?" &nbsp;–&nbsp; ":""),g=i.computed(()=>({...Os(m.options.styleId).boxCss})),E=i.computed(()=>!M.value&&!m.options.textField),$=i.computed(()=>{const B={};return m.options.title&&(B["dialog-box-followup"]=!0),m.options.old?B["dialog-box-old"]=!0:B["dialog-box-new"]=!0,B}),_=i.computed(()=>{const B=Os(m.options.styleId);return{color:B.color,...B.nameCss}}),v=i.computed(()=>Os(m.options.styleId).textCss),C=i.computed(()=>s.value?s.value.text:m.options.text),M=i.computed(()=>{if(m.options.choices)return m.options.choices}),U=i.computed(()=>Fe().playMode==="skip"),ne=i.computed(()=>Fe().playMode==="auto"),ee=i.computed(()=>m.active&&c.value&&!o.value&&!h.value&&!s.value&&m.options.interactive&&!Ee.value),re=Te(),Ee=i.computed(()=>re.paused);return i.watch(()=>m.options,(B,J)=>{!J.old&&B.old&&s&&nt({unmounted:!0})}),i.watch(U,(B,J)=>{B&&!J&&Ne()}),i.watch(ne,(B,J)=>{B&&!J&&Ze()}),t({keyboardEvent:T}),(B,J)=>{const fe=i.resolveDirective("visible");return i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["dialog-box w-full override",$.value]),style:i.normalizeStyle(g.value)},[i.createElementVNode("div",{class:"dialog-content",onClick:D},[B.options.title?(i.openBlock(),i.createElementBlock("span",{key:0,class:"dialog-title override",style:i.normalizeStyle(_.value),innerHTML:B.options.title},null,12,sb)):i.createCommentVNode("",!0),i.createElementVNode("span",{class:"dialog-text dialog-separator override",style:i.normalizeStyle(v.value),innerHTML:j.value},null,12,ab),i.createElementVNode("span",{class:i.normalizeClass(["dialog-text override",B.options.cssClass]),style:i.normalizeStyle(v.value),innerHTML:C.value},null,14,lb),B.options.old?i.createCommentVNode("",!0):i.withDirectives((i.openBlock(),i.createElementBlock("div",cb,[M.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"dialog-choices",ref_key:"choicesDiv",ref:n},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(M.value,(ce,be)=>(i.openBlock(),i.createElementBlock("p",{key:be,style:i.normalizeStyle(P(ce)),class:i.normalizeClass([W(ce),"dialog-choice override"]),onClick:Se=>F(ce),innerHTML:Y(be,ce)},null,14,ub))),128))],512)):B.options.textField?(i.openBlock(),i.createElementBlock("div",db,[i.withDirectives(i.createElementVNode("input",{autofocus:"",type:"text",class:"label-input nrt-input",ref_key:"playerInput",ref:l,id:"player-input-field","onUpdate:modelValue":J[0]||(J[0]=ce=>r.value=ce)},null,512),[[i.vModelText,r.value]]),i.createElementVNode("button",{onClick:X,class:"nrt-button",id:"player-input-submit"}," Submit ")])):(i.openBlock(),i.createElementBlock("div",fb,[i.createElementVNode("div",{onClick:J[1]||(J[1]=ce=>F(0)),ref:"continue",class:"interact-button nrt-button override"}," Continue ",512)]))])),[[fe,ee.value]])])],6)}}}),mb={key:0,class:"auto-play-feedback-container"},hb=i.defineComponent({__name:"AutoPlayFeedback",setup(e){const t=Fe(),n=i.computed(()=>t.playMode==="auto"),r=i.computed(()=>t.playMode==="skip"),o=i.computed(()=>n.value?"auto-play-feedback-auto":r.value?"auto-play-feedback-skip":{}),a=i.computed(()=>n.value?"Auto Play":r.value?"Skip":"");return(s,c)=>a.value?(i.openBlock(),i.createElementBlock("div",mb,[i.createElementVNode("div",{class:i.normalizeClass(["auto-play-feedback",o.value])},i.toDisplayString(a.value),3)])):i.createCommentVNode("",!0)}}),yb=i.createElementVNode("div",{class:"anchor"},null,-1),As=i.defineComponent({__name:"game-dialog",setup(e){const t=i.computed(()=>Je().layoutMode),n=i.computed(()=>Ke().inGameInputListener),r=i.ref(Te().inScript),o=i.ref(null),a=Je(),s=ve(),c=i.computed(()=>s.stack),d=Fe(),u=i.computed(()=>d.dialog),h=i.ref(null),l=i.ref(null),f=i.ref(null),m=i.computed(()=>{let z="0px";const Q=le().layout.dialogBottomPadding;return typeof Q=="number"?z=`${Q}px`:typeof Q=="string"&&(z=Q),{paddingBottom:z}}),y=i.computed(()=>{if(u.value.length>0)return u.value[u.value.length-1]}),b=i.computed(()=>{if(y.value)return y.value.speaker}),S=i.computed(()=>{if(y.value)return y.value.pose}),T=i.computed(()=>{if(y.value){const z=b.value;let Q=S.value;return z?(Q||(Q="idle"),Q):void 0}}),I=i.computed(()=>{if(!T.value)return;const z=b.value;return Q_(z,T.value)}),D=i.computed(()=>{const z=I.value;if(Y_(z))return z}),R=i.computed(()=>{const z=I.value;if(J_(z))return z}),F=i.computed(()=>a.dialogWidth),L=i.computed(()=>Te().inScript);i.watch(L,z=>{z?r.value=!0:Fe().playMode!=="normal"?(Fe().playMode==="skip"&&(Fe().playMode="normal"),o.value=setTimeout(()=>{r.value=!1},500)):r.value=!1}),i.onMounted(()=>{if(n.value){const Q=n.value;Q.actions.autoPlay={press:()=>{Fe().toggleAutoPlay()}},Q.actions.skip={press:()=>{Fe().toggleSkip()}}}const z=Q=>{l.value&&l.value.keyboardEvent&&l.value.keyboardEvent(Q)};z.value=qt.on("debouncedKeydown",z)}),i.onUnmounted(()=>{n.value&&(delete n.value.actions.autoPlay,delete n.value.actions.skip),f.value&&qt.off("debouncedKeydown",f.value),o.value&&clearTimeout(o.value)});const P=i.computed(()=>{let z;const Q=`${Je().dialogHeight}px`,te={};if(Je().overlayMode){te.position="absolute";const ke=le().dialogPanel.rightOffset??Tr.common.dialogPanel.rightOffset;te.right=`${ke}px`;const Ne=le().dialogPanel.bottomOffset??Tr.common.dialogPanel.bottomOffset;te.bottom=`${Ne}px`}return{...te,width:t.value==="horizontal"?`${F.value}px`:"100%",height:Q,transform:z,transformOrigin:"right"}});function Y(){Fe().toggleAutoPlay()}function W(){Fe().toggleSkip()}function X(z,Q){const te=ti(z.speaker);let ke=(te==null?void 0:te.name)??"Missing Character";return Q>=1&&u.value[Q-1].speaker===z.speaker&&(ke=void 0),z.choices&&z.choices.forEach(Ne=>{Ne.choice=nn(Ne.choice)}),{title:ke??"",text:z.text,cssClass:z.cssClass,styleId:z.speaker,choices:z.choices,old:Q<u.value.length-1,interactive:z.interactive,textField:z.textField}}function G(z){return z===d.dialog.length-1&&c.value.length>0}return i.watch(u.value,z=>{if(h.value){const Q=h.value;Q.scrollTop=Q.scrollHeight+1e8}}),(z,Q)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(hb),i.createVNode(i.Transition,{name:"fade"},{default:i.withCtx(()=>[(D.value||R.value)&&i.unref(a).showDialog?(i.openBlock(),i.createBlock(tb,{key:0,picture:D.value,video:R.value,character:b.value,pose:S.value},null,8,["picture","video","character","pose"])):i.createCommentVNode("",!0)]),_:1}),i.createVNode(i.Transition,{name:"dialog-transition"},{default:i.withCtx(()=>[i.unref(a).showDialog?(i.openBlock(),i.createElementBlock("div",{key:0,class:"dialog override",ref_key:"dialogRef",ref:h,style:i.normalizeStyle(P.value)},[i.createVNode(i.TransitionGroup,{name:"list",tag:"div",class:"dialog-container w-full override",style:i.normalizeStyle(m.value)},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(u.value,(te,ke)=>(i.openBlock(),i.createBlock(pb,{ref_for:!0,ref:Ne=>l.value=Ne,key:te.id,options:X(te,ke),active:G(ke),inputListener:n.value},null,8,["options","active","inputListener"]))),128))]),_:1},8,["style"]),(i.openBlock(),i.createBlock(i.Teleport,{to:"#narrat-app"},[i.createElementVNode("div",{class:"auto-skip-buttons flex"},[i.createElementVNode("div",{class:"nrt-button menu-toggle-button auto-button auto",onClick:Y}," Auto "),i.createElementVNode("div",{class:"nrt-button menu-toggle-button auto-button skip",onClick:W}," Skip ")])])),yb],4)):i.createCommentVNode("",!0)]),_:1})],64))}}),gb=["id"],_b=["src"],bb={class:"tab-title"},id=i.defineComponent({__name:"tab-selector",props:{tab:{},active:{type:Boolean}},emits:["click"],setup(e,{emit:t}){const n=e,r=t,o=i.computed(()=>n.active?"tab-active":"tab-inactive");function a(){r("click")}return(s,c)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["tab",o.value]),id:`tab-${s.tab.id}`,onClick:a},[i.createElementVNode("div",{class:i.normalizeClass(["tab-title-container",s.active?"active":""])},[s.tab.icon?(i.openBlock(),i.createElementBlock("img",{key:0,src:s.tab.icon,alt:"tab icon",class:"tab-icon"},null,8,_b)):i.createCommentVNode("",!0),i.createElementVNode("span",bb,i.toDisplayString(s.tab.label),1)],2)],10,gb))}}),Tb={class:"tabs-controller"},vb={key:0,class:"tabs-controller__tabs"},Sb={key:1,class:"tab-content"},wb={key:2},kb=[i.createElementVNode("div",{class:"tab-content__empty"},[i.createElementVNode("p",null,"No tab selected")],-1)],Cb=i.defineComponent({__name:"TabsController",props:{tabs:{},defaultTab:{}},emits:["tab-change","close"],setup(e,{emit:t}){const n=i.ref(Ke().registerInputListener("tabs-controller",{cancel:{press:()=>{r("close")}},system:{press:()=>{r("close")}},menu:{press:()=>{r("close")}},previousTab:{press:()=>{a.value>0&&s(a.value-1)}},nextTab:{press:()=>{a.value<o.tabs.length-1&&s(a.value+1)}}})),r=t,o=e,a=i.ref(o.defaultTab);function s(d){a.value=d,r("tab-change",d)}const c=i.computed(()=>o.tabs[a.value]);return i.onUnmounted(()=>{n.value&&(Ke().unregisterInputListener(n.value),n.value=null)}),(d,u)=>(i.openBlock(),i.createElementBlock("div",Tb,[d.tabs.length>1?(i.openBlock(),i.createElementBlock("div",vb,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.tabs,(h,l)=>(i.openBlock(),i.createBlock(id,{key:h.id,tab:h,active:l===a.value,onClick:()=>s(l),inputListener:n.value},null,8,["tab","active","onClick","inputListener"]))),128))])):i.createCommentVNode("",!0),c.value?(i.openBlock(),i.createElementBlock("div",Sb,[c.value?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(c.value.component),{key:0,inputListener:n.value,onClose:u[0]||(u[0]=h=>d.$emit("close"))},null,40,["inputListener"])):i.createCommentVNode("",!0)])):(i.openBlock(),i.createElementBlock("div",wb,kb))]))}}),$b={class:"menu-container menu-toggle"},Eb=["onClick","id"],Ob={class:"nrt-title"},Is=i.defineComponent({__name:"menu-buttons",setup(e){const t=ht(),n=i.ref(null);i.onMounted(()=>{Ie.callHook("onGameMounted")}),i.onUnmounted(()=>{n.value&&qt.off("keydown",n.value),Ie.callHook("onGameUnmounted")});function r(h){ht().activeMenu=h}const o=i.computed(()=>t.menus),a=i.computed(()=>t.menu),s=i.computed(()=>{var h;return(((h=a.value)==null?void 0:h.tabs)??[]).filter(l=>l.condition?l.condition():!0).map(l=>({id:l.id,label:l.text,component:l.component}))});function c(){t.closeMenu()}function d(h){t.setActiveTab(h)}function u(){return c()}return(h,l)=>(i.openBlock(),i.createElementBlock("div",$b,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,(f,m)=>(i.openBlock(),i.createElementBlock("button",{key:f.id,onClick:y=>r(f.id),id:f.cssId??`${m}-menu-button`,class:"nrt-button menu-toggle-button"},i.toDisplayString(f.label),9,Eb))),128)),a.value?(i.openBlock(),i.createBlock(i.Teleport,{key:0,to:"#narrat"},[i.createVNode(_n,{containerCssClass:{[a.value.cssClass]:!0,"menu-modal":!0},onClose:c},{header:i.withCtx(()=>{var f;return[i.createElementVNode("h3",Ob,i.toDisplayString(((f=i.unref(t).tab)==null?void 0:f.text)??a.value.label),1)]}),body:i.withCtx(()=>[i.createVNode(Cb,{onTabChange:d,onClose:u,tabs:s.value,defaultTab:a.value.activeTab},null,8,["tabs","defaultTab"])]),_:1},8,["containerCssClass"])])):i.createCommentVNode("",!0)]))}});function sd(e){const t={};return e.selected&&(t.selected=!0),e.clickable&&e.viewportClickable&&!e.transitioning&&(t.interactable=!0),(!e.clickable||!e.viewportClickable)&&(t["nrt-disabled"]=!0),e.transitioning&&(t.transitioning=!0),e.greyed&&(t.greyed=!0),e.hidden&&(t.hidden=!0),e.cssClass&&(t[e.cssClass]=!0),t}function Ab(e,t,n){return{selected:t,clickable:e.onClick!==void 0,viewportClickable:Zo(e),transitioning:n,greyed:!1,hidden:!1,cssClass:e.cssClass}}function Ib(e,t,n){const r=Un(e),o=Ut().getButtonState(e);return{selected:t,clickable:Ut().isButtonInteractible(e),viewportClickable:Zo(r),transitioning:n,greyed:o==="greyed",hidden:o==="hidden"||o===!1,cssClass:r.cssClass}}function Nb(e,t,n){return sd(Ib(e,t,n))}function Pb(e,t,n){return sd(Ab(e,t,n))}const jb=["id"],xb=["innerHTML"],Db=i.defineComponent({__name:"screen-object",props:{screenObject:{},layerSelected:{type:Boolean},transitioning:{type:Boolean},activeInteractive:{}},setup(e){const t=e,n=Dt();function r(c){t.transitioning||t.screenObject.onClick&&n.clickObject(c)}const o=i.computed(()=>{if(!t.layerSelected)return!1;const c=t.activeInteractive;return c.type==="screenObject"&&c.id===t.screenObject.id}),a=i.computed(()=>Pb(t.screenObject,o.value,t.transitioning)),s=i.computed(()=>{const c={};t.screenObject.opacity!==1&&(c.opacity=t.screenObject.opacity);let d=t.screenObject.x,u=t.screenObject.y,h=t.screenObject.width,l=t.screenObject.height;if(t.screenObject.anchor){const m=t.screenObject.anchor;d=t.screenObject.x-h*m.x,u=t.screenObject.y-l*m.y,c.transformOrigin=`${m.x*100}% ${m.y*100}%`}t.screenObject.scale&&(h=h*t.screenObject.scale,l=l*t.screenObject.scale);const f={...c,left:`${d}px`,top:`${u}px`,width:`${h}px`,height:`${l}px`};return n_(t.screenObject)&&(f.backgroundImage=`url(${Mr(t.screenObject.image)})`),f});return(c,d)=>{const u=i.resolveComponent("ScreenObject",!0);return i.openBlock(),i.createElementBlock("div",{tabindex:"-1",class:i.normalizeClass(["viewport-object",a.value]),id:`viewport-object-${t.screenObject.id}`,onClick:d[0]||(d[0]=h=>r(c.screenObject)),style:i.normalizeStyle(s.value)},[i.createElementVNode("span",{innerHTML:t.screenObject.text?i.unref(nn)(t.screenObject.text):void 0},null,8,xb),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.screenObject.children,h=>(i.openBlock(),i.createBlock(u,{transitioning:c.transitioning,key:h.id,screenObject:h},null,8,["transitioning","screenObject"]))),128))],14,jb)}}}),Lb=["id","innerHTML"],Mb=i.defineComponent({__name:"viewport-button",props:{id:{},layerSelected:{type:Boolean},transitioning:{type:Boolean},activeInteractive:{}},setup(e){const t=e,n=Ut();i.computed(()=>n.getButtonState(t.id));const r=i.computed(()=>Un(t.id)),o=r.value.background?Mr(r.value.background):null,a=i.computed(()=>{if(!t.layerSelected)return!1;const h=t.activeInteractive;return h.type==="button"&&h.id===t.id});i.computed(()=>n.isButtonClickable(t.id));const s=i.computed(()=>{const h=r.value.text??"";return nn(h)}),c=i.computed(()=>Nb(t.id,a.value,t.transitioning)),d=i.computed(()=>{const h={};r.value.position.width&&(h.width=`${r.value.position.width}px`),r.value.position.height&&(h.height=`${r.value.position.height}px`),r.value.background&&(h.backgroundImage=`url(${o})`);let l=r.value.position.left,f=r.value.position.top;return r.value.anchor&&(l=r.value.position.left-r.value.position.width*r.value.anchor.x,f=r.value.position.top-r.value.position.height*r.value.anchor.y),{...h,left:`${l}px`,top:`${f}px`}});function u(){n.clickOnButton(t.id)}return(h,l)=>(i.openBlock(),i.createElementBlock("div",{tabindex:"-1",class:i.normalizeClass(["viewport-button",c.value]),id:`viewport-button-${h.id}`,onClick:l[0]||(l[0]=f=>u()),style:i.normalizeStyle(d.value),innerHTML:s.value},null,14,Lb))}}),Bb=["id"],Rb=["id","loop","muted"],Fb=["src"],Vb=["id"],Ns=i.defineComponent({__name:"screen-layer",props:{layer:{},layerIndex:{},transitioning:{type:Boolean},activeInteractive:{}},setup(e){const t=e,n=Te(),r=Dt(),o=i.computed(()=>!!(t.activeInteractive&&t.activeInteractive.layer===t.layerIndex)),a=i.computed(()=>r.tree.filter(S=>S.layer===t.layerIndex)),s=i.computed(()=>le().layout.backgrounds.width),c=i.computed(()=>le().layout.backgrounds.height),d=i.computed(()=>t.layer),u=i.computed(()=>{const S=Lr(d.value);return S||ae(`Screen ${d.value} doesn't have a config`),S}),h=i.computed(()=>n.isInGame),l=i.computed(()=>u.value.buttons||[]),f=i.computed(()=>u.value.video),m=i.computed(()=>({width:`${s.value}px`,height:`${c.value}px`})),y=i.computed(()=>{let S;return u.value.background!==qo&&(S=`url(${Mr(u.value.background)})`),{backgroundImage:S,position:"absolute",left:0,top:0,width:`${s.value}px`,height:`${c.value}px`}}),b=i.computed(()=>({position:"absolute",left:0,top:0,width:`${s.value}px`,height:`${c.value}px`}));return(S,T)=>h.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"viewport-layer",id:`viewport-layer-${d.value}`,style:i.normalizeStyle(m.value)},[f.value?(i.openBlock(),i.createElementBlock("video",{key:0,class:"viewport-layer-background",id:`viewport-layer-background-${d.value}`,style:i.normalizeStyle(b.value),autoplay:"",loop:f.value.loop!==!1,muted:!!f.value.muted},[i.createElementVNode("source",{src:i.unref(Et)(u.value.background)},null,8,Fb)],12,Rb)):(i.openBlock(),i.createElementBlock("div",{key:1,class:"viewport-layer-background",id:`viewport-layer-background-${d.value}`,style:i.normalizeStyle(y.value)},null,12,Vb)),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.value,I=>(i.openBlock(),i.createBlock(Mb,{key:I,id:I,layerSelected:o.value,transitioning:S.transitioning,activeInteractive:S.activeInteractive},null,8,["id","layerSelected","transitioning","activeInteractive"]))),128)),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,I=>(i.openBlock(),i.createBlock(Db,{key:I.id,screenObject:I,transitioning:S.transitioning,layerSelected:o.value,activeInteractive:S.activeInteractive},null,8,["screenObject","transitioning","layerSelected","activeInteractive"]))),128))],12,Bb)):i.createCommentVNode("",!0)}}),Ub=i.defineComponent({__name:"NarratTransition",props:{name:{type:String,required:!0},duration:{type:Number,required:!0},delay:Number},emits:["complete"],setup(e,{emit:t}){i.useSlots();const n=t,r=e,o=i.ref("start"),a=i.reactive({oldSlotClasses:{},oldSlotStyle:{},newSlotClasses:{},newSlotStyle:{}});return i.onMounted(async()=>{const s=`narrat-transition-${r.name}`;a.newSlotClasses={[`${s}-enter-from`]:!0},a.oldSlotClasses={[`${s}-leave-active`]:!0},await kt(30),a.oldSlotStyle={transitionDuration:`${r.duration/1e3}s`},a.newSlotStyle={transitionDuration:`${r.duration/1e3}s`},a.oldSlotClasses[`${s}-leave-to`]=!0,a.newSlotClasses[`${s}-enter-active`]=!0,await kt(r.delay??0),delete a.newSlotClasses[`${s}-enter-from`],await kt(r.duration),o.value="end",n("complete")}),(s,c)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[o.value!=="end"?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["transition-holder",a.oldSlotClasses]),style:i.normalizeStyle(a.oldSlotStyle)},[i.renderSlot(s.$slots,"oldElement")],6)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(["transition-holder",a.newSlotClasses]),style:i.normalizeStyle(a.newSlotStyle)},[i.renderSlot(s.$slots,"newElement")],6)],64))}});function ad(e,t,n){return e<t?t:e>n?n:e}const Ps=i.defineComponent({__name:"screens",setup(e){const t=i.computed(()=>Ke().inGameInputListener),n=Te(),r=Ut(),o=Dt(),a=i.ref(0),s=i.computed(()=>r.nonEmptyLayers),c=i.computed(()=>{const y=[];return s.value.reduce((b,S,T)=>{const D=Lr(S.screen).buttons;if(D)for(const F of D)r.isButtonClickable(F)&&b.push({id:F,type:"button",layer:T});const R=o.tree.filter(F=>F.layer===T);for(const F of R)o.isScreenObjectClickable(F)&&b.push({id:F.id,type:"screenObject",layer:T});return b},y)}),d=i.computed(()=>{if(c.value.length===0)return null;let y=a.value;return y>c.value.length-1&&(y=c.value.length-1),c.value[y]}),u=i.computed(()=>le().layout.backgrounds.width),h=i.computed(()=>le().layout.backgrounds.height),l=i.computed(()=>n.isInGame);function f(y){r.finishTransition(y)}const m=i.computed(()=>{const y=u.value;return{height:`${h.value}px`,width:`${y}px`}});return i.onMounted(()=>{i.nextTick(()=>{if(t.value){const y=t.value.actions;y.previousTab={press:()=>{a.value>0?a.value--:a.value=c.value.length-1,a.value=ad(a.value,0,c.value.length-1)}},y.left=y.previousTab,y.nextTab={press:()=>{a.value<c.value.length-1?a.value++:a.value=0,a.value=ad(a.value,0,c.value.length-1)}},y.right=y.nextTab,y.viewportSelect={press:()=>{if(d.value){const b=d.value;b.type==="button"?r.clickOnButton(b.id):b.type==="screenObject"&&o.clickObject(o.getObject(b.id))}}}}})}),i.onUnmounted(()=>{if(t.value){const y=t.value;delete y.actions.previousTab,delete y.actions.left,delete y.actions.nextTab,delete y.actions.right}}),(y,b)=>l.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"viewport",id:"narrat-viewport",style:i.normalizeStyle(m.value)},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,(S,T)=>(i.openBlock(),i.createElementBlock("div",{key:S.screen??"",class:"layer-container"},[S.transition?(i.openBlock(),i.createBlock(Ub,{key:0,name:S.transition.transition,duration:S.transition.duration,delay:S.transition.delay,onComplete:()=>f(T)},{oldElement:i.withCtx(()=>[S.transition.oldScreen?(i.openBlock(),i.createBlock(Ns,{key:0,layer:S.transition.oldScreen,layerIndex:T,transitioning:!0},null,8,["layer","layerIndex"])):i.createCommentVNode("",!0)]),newElement:i.withCtx(()=>[S.screen?(i.openBlock(),i.createBlock(Ns,{key:0,layer:S.screen,layerIndex:T,transitioning:!0},null,8,["layer","layerIndex"])):i.createCommentVNode("",!0)]),_:2},1032,["name","duration","delay","onComplete"])):S.screen?(i.openBlock(),i.createBlock(Ns,{key:1,layer:S.screen,layerIndex:T,transitioning:!1,activeInteractive:d.value},null,8,["layer","layerIndex","activeInteractive"])):i.createCommentVNode("",!0)]))),128))],4)):i.createCommentVNode("",!0)}}),Pt=et("hud",{state:()=>({hudStats:{},visible:!0}),actions:{updateConfig(e){for(const t in e.hudStats)this.hudStats[t]||(this.hudStats[t]={value:e.hudStats[t].startingValue})},reset(e){this.$reset(),this.updateConfig(e)},setStat(e,t){this.hudStats[e].value=t,this.getStat(e).value<(ar(e).minValue??0)&&(this.hudStats[e].value=ar(e).minValue??0),this.getStat(e).value>(ar(e).maxValue??1/0)&&(this.hudStats[e].value=ar(e).maxValue??1/0)},addStat(e,t){this.setStat(e,this.getStatValue(e)+t)},getStat(e){return this.hudStats[e]},getStatValue(e){return this.hudStats[e].value},generateSaveData(){return{hudStats:Be(this.hudStats),visible:this.visible}},loadSaveData(e){this.hudStats=Jn(this.hudStats,e.hudStats),this.visible=e.visible},setVisibility(e){this.visible=e}}}),qb=i.defineComponent({data(){return{}},methods:{getStatImage(e){return Et(this.statsConfig[e].icon)},formatStat(e,t){var c;const n=ar(e),r=n.decimals??2,o=Math.floor(t*10**r)/10**r,a={};(c=n.formatting)!=null&&c.style&&(a.style=n.formatting.style,n.formatting.style==="currency"&&(a.currency=n.formatting.currency??"USD",a.currencyDisplay="narrowSymbol"),n.formatting.style==="unit"&&(a.unit=n.formatting.unit??"day"));let s;try{s=o.toLocaleString(void 0,a)}catch(d){ae(`Error formatting HUD stat, probably using an invalid config: ${d}`),console.error(d),s=o.toLocaleString()}return s},statPrefix(e){const t=ar(e);return t.prefix??(t.suffix||t.hideName?"":t.name)},statSuffix(e){return ar(e).suffix??""}},computed:{...Jr(Pt,["hudStats"]),...Jr(Je,["layoutMode"]),statsConfig(){return le().hudStats},stats(){return this.hudStats},hudStyle(){let e="0";return this.layoutMode==="horizontal"&&(e=`${Pi()+(le().dialogPanel.rightOffset??Tr.common.dialogPanel.rightOffset)}px`),{right:e}},hasHud(){return Pt().visible===!1?!1:Object.keys(Pt().hudStats).length>0}}}),Hb=["src"],Kb=["innerHTML"],Gb=["innerHTML"];function zb(e,t,n,r,o,a){return e.hasHud?(i.openBlock(),i.createElementBlock("div",{key:0,class:"hud",style:i.normalizeStyle(e.hudStyle)},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.stats,(s,c)=>(i.openBlock(),i.createElementBlock("div",{key:c,class:"hud-stat"},[i.createElementVNode("img",{class:"hud-icon",src:e.getStatImage(c)},null,8,Hb),i.createElementVNode("span",{class:"bold hud-text",innerHTML:e.statPrefix(c)},null,8,Kb),i.createElementVNode("span",null,i.toDisplayString(e.formatStat(c,s.value)),1),e.statSuffix?(i.openBlock(),i.createElementBlock("span",{key:0,innerHTML:e.statSuffix(c)},null,8,Gb)):i.createCommentVNode("",!0)]))),128))],4)):i.createCommentVNode("",!0)}const js=zt(qb,[["render",zb]]),xs=i.defineComponent({__name:"in-game",setup(e){const t=Ke(),n=i.computed(()=>t.inGameInputListener),r=Te(),o=Je(),a=i.computed(()=>o.layoutMode),s=i.computed(()=>r.saving),c=i.ref(null),d=Fe(),u=i.ref(null),h=i.computed(()=>s.value&&!s.value.withPrompt||s.value&&c.value),l=i.computed(()=>{let b="row";return a.value==="vertical"&&(b="column"),{flexDirection:b}});function f(b){if(c.value=null,b===null){Ls(b,!1);return}Ls(b,!0)}function m(){c.value=!0}function y(){c.value=!1,Ls(null,!1),c.value=null}return i.onBeforeMount(()=>{t.createInGameInputListener()}),i.onMounted(()=>{u.value=qt.on("debouncedKeydown",b=>{Te().debugMode||((b.key==="a"||b.key==="A")&&d.toggleAutoPlay(),(b.key==="s"||b.key==="S")&&d.toggleSkip())})}),i.onUnmounted(()=>{n.value&&t.removeInGameInputListener(),u.value&&qt.off("debouncedKeydown",u.value)}),i.computed(()=>Pt().visible===!1?!1:Object.keys(Pt().hudStats).length>0),(b,S)=>(i.openBlock(),i.createElementBlock("div",{class:"game",style:i.normalizeStyle(l.value)},[i.createVNode(js),i.createVNode(Is),i.createVNode(Ps),i.createVNode(As),h.value?(i.openBlock(),i.createBlock(Zu,{key:0,mode:"pick",onChosen:f,onClose:S[0]||(S[0]=()=>f(null))})):i.createCommentVNode("",!0),s.value&&s.value.withPrompt&&c.value===null?(i.openBlock(),i.createBlock(ei,{key:1,prompt:"Would you like to save the game?",onConfirm:m,onRefuse:y})):i.createCommentVNode("",!0)],4))}}),Wb={class:"chapter-title-scene"},Qb=["innerHTML"],Yb=["innerHTML"],Jb=i.defineComponent({__name:"chapter-title",props:{options:{}},setup(e){const t=e,n=i.ref(null);function r(){n.value=null,Nt().changeScene("playing"),ve().jumpToLabel(t.options.next_label)}return i.onMounted(()=>{n.value=setTimeout(r,t.options.duration??2e3)}),i.onUnmounted(()=>{n.value&&(clearTimeout(n.value),n.value=null)}),(o,a)=>(i.openBlock(),i.createElementBlock("div",Wb,[i.createElementVNode("h1",{class:"title chapter-title",innerHTML:t.options.title},null,8,Qb),t.options.subtitle?(i.openBlock(),i.createElementBlock("h2",{key:0,class:"subtitle chapter-subtitle",innerHTML:t.options.subtitle},null,8,Yb)):i.createCommentVNode("",!0)]))}}),ld={"engine-splash":{id:"engine-splash",component:i.shallowRef(Ts),props:{}},"game-splash":{id:"game-splash",component:i.shallowRef(ws),props:{}},"start-menu":{id:"start-menu",component:i.shallowRef(Es),props:{}},playing:{id:"playing",component:i.shallowRef(xs),props:{}},"chapter-title":{id:"chapter-title",component:i.shallowRef(Jb),props:{}}};let an={};function Xb(e){an=e}function Zb(){ld["engine-splash"].onFinished=()=>{Nt().onEngineSplashFinished()},Nt().scenes=ld}function eT(){return an}function cd(){for(const e in an){const t=an[e],n=t.store();let r;o_(t)&&(r=Ve()[t.config]),n.reset&&!t.avoidReset&&n.reset(r)}Ie.plugins.forEach(e=>{e.reset&&e.reset()})}function tT(){const e={},t={};for(const n in an){const r=an[n];if(Ju(r)){const o=r.store();o.generateSaveData?e[r.save]=o.generateSaveData():ae(`Store ${n} has no generateSaveData method. Trying to generate save data for ${r.save}`)}if(Xu(r)){const o=r.store();o.generateGlobalSaveData?t[r.globalSave]=o.generateGlobalSaveData():ae(`Store ${n} has no generateGlobalSaveData method. Trying to generate save data for ${r.globalSave}`)}}return Ie.plugins.forEach(n=>{n.save&&(e.plugins[n.pluginId]=n.save())}),Ie.customStores().forEach(([n,r])=>{if(r.save){const o=r.save();o&&(o.customStores[n]=o)}}),{gameSave:e,globalSave:t}}function nT(e){for(const t in an){const n=an[t];if(Ju(n)){const r=n.store();r.loadSaveData?r.loadSaveData(e[n.save]):ae(`Store ${t} has no loadSaveData method. Trying to load save data for ${n.save}`)}}Ie.plugins.forEach(t=>{t.load&&e.plugins[t.pluginId]&&t.load(e.plugins[t.pluginId])}),Ie.customStores().forEach(([t,n])=>{n.load&&n.load(e.customStores[t])})}function ud(e){for(const t in an){const n=an[t];if(Xu(n)){const r=n.store();r.loadGlobalSaveData?r.loadGlobalSaveData(e[n.globalSave]):ae(`Store ${t} has no loadGlobalSaveData method. Trying to load global save data for ${n.globalSave}`)}}}function rT(e){nT(e.gameSave),ud(e.globalSave)}function Ds({slotId:e,name:t}){const n=Te(),r=e??n.saveSlot;n.saveData=Ip({slot:r,name:t,extractedSave:tT()})}function oT(e){rT(e)}function dd(){ve().globalData={},bn().globalSave.data={},Ds({})}function fd({saveName:e,withPrompt:t}){return new Promise(n=>{ve().hasJumped?Te().startManualSave(n,e,t):n()})}function Ls(e,t){var r;const n=Te();if(!n.saving){ae("No saving in progress!");return}if(!t||!e){n.cancelManualSave();return}n.saveData?(Np(n.saveData,hr(n.playTime.start,n.playTime.previousPlaytime),e.slotId,(r=n.saving)==null?void 0:r.name),n.alert("Success","Game saved!")):ae("There was no data to save!"),n.cancelManualSave()}const ve=et("vm",{state:()=>({stack:[],data:{},globalData:{},lastLabel:"main",script:{},labelStack:["main"],commandsWaitingForPlayerAnswer:[],promisesWaitingForTextAnimation:[],hasJumped:!1}),actions:{generateSaveData(){return{lastLabel:this.lastLabel,data:Ka(this.data,e=>Yu(e)?{_entityType:e._entityType,id:e.id}:e)}},generateGlobalSaveData(){return{data:Be(this.globalData)}},loadSaveData(e){this.lastLabel=e.lastLabel,this.data=e.data,this.findEntitiesInData(this.data)},loadGlobalSaveData(e){this.globalData=e.data},findEntitiesInData(e){zu(this.data,(t,n,r)=>{if(Yu(t)){const o=Dt().getObject(t.id);o?r[n]=o:er(`Trying to reload sprite ${n} (${JSON.stringify(t)} - ${t.id}) but it does not exist.`)}})},setReturnValue(e){this.currentFrame.returnValue=e},waitForPlayerAnswer(e){this.commandsWaitingForPlayerAnswer.push(e)},waitForEndTextAnimation(){return new Promise(e=>{this.promisesWaitingForTextAnimation.push(e)})},endTextAnimation(){for(const e of this.promisesWaitingForTextAnimation)e();this.promisesWaitingForTextAnimation=[]},popAnswerQueue(){return this.commandsWaitingForPlayerAnswer.pop()},addScopedVariable(e,t){this.currentFrame&&(this.currentFrame.scope[e]=t)},async loadScripts(e){this.readGlobalData();const t=await this.loadConfigScriptFiles(e),n=Te().options.scripts;this.addAllScripts([...t,...n])},async loadConfigScriptFiles(e){const t=[];for(const r of e)t.push(Jo(Ni(r)));return(await Promise.all(t)).map((r,o)=>({fileName:e[o],code:r,id:e[o],type:"script"}))},addAllScripts(e){const t=Date.now();for(const r of e)Ie.addNarratScript(r);const n=Date.now();Ft.log(`scripts parsed in ${n-t} ms`)},start(){this.setStack({currentIndex:0,branchData:{branch:Ie.script.main.branch},label:"main"}),this.setStack({currentIndex:0,branchData:{branch:Ie.script.main.branch},label:"main"})},setLastLabel(e){this.lastLabel=e},reset(){this.$reset(),this.stack=[],this.data={},this.hasJumped=!0,this.setStack({currentIndex:0,branchData:{branch:Ie.script.main.branch},label:"main"})},readGlobalData(){this.globalData=bn().globalSave.data},setScript(e){Ie.script=e},overrideData(e){this.data=e},setStack(e){this.stack=[];const t=this.frameOptionsToFrame(e);this.lastLabel=e.label,this.stack.push(t)},frameOptionsToFrame(e){const t=e.branchData,n={...e,blocks:[],scope:{},returnValue:null};if(this.addBlock(n,{branchData:t,currentIndex:e.currentIndex}),e.scope&&(n.scope=e.scope),e.args&&e.branchData.args)for(const[r,o]of e.branchData.args.entries())e.args.length>r&&(n.scope[o]=e.args[r]);return n},addBlock(e,t){e.blocks.push(t)},async addAndRunBlock(e){const t=this.currentFrame;if(!t)throw new Error("No frame to add block to");return this.addBlock(t,e),await this.runBlock()},setData(e,t){const n=Br();Nf(n,e,t)},addInstruction(e,t){const n=Br();Pf(n,e,t)},addFrame(e){if(!e.label)if(this.currentFrame)e.label=this.currentFrame.label;else throw new Error("Tried to add a new frame but no label was passed and there is no current frame label");const t=this.frameOptionsToFrame(e);this.stack.push(t)},async addAndRunFrame(e){return await this.addFrame(e),await this.runFrame()},async runFrame(){if(!this.currentFrame)throw new Error("Tried to run a frame but there is no current frame");let t;for(;this.currentBlock;){const n=await this.runBlock();if(n===Fo||n===Vo)return this.cleanFrame(),n;if(n===ns)return this.cleanFrame()}return this.cleanFrame(),t},cleanFrame(){const e=this.currentFrame,{returnValue:t}=e;return this.stack.splice(this.stack.length-1,1),t},async runBlock(){const e=this.currentBlock;if(!e)throw new Error("Tried to run a block but there is no current block");let t;for(;this.currentLine;){if(t=await this.runLineOnly(),Bm(t))return this.cleanBlock(),t;e.currentIndex++}return this.cleanBlock(),t},cleanBlock(){if(!this.currentFrame){ae("Tried to clean a block but there is no current frame");return}if(!this.currentFrame.blocks){ae("Tried to clean a block but there is no current block");return}this.currentFrame.blocks.splice(this.currentFrame.blocks.length-1,1)},async runGame(){let e=await this.runFrame();for(;e===Fo;){const t=this.jumpTarget;if(!t){ae("Tried to jump but no target was set");return}this.hasJumped=!0,this.setStack(t),await Ds({}),e=await this.runFrame()}e!==Vo&&this.stack.length===0&&this.reachedEndOfScript()},async nextLineOnly(){return this.stack.length===0||this.isBlockFinished()?!1:(this.currentBlock.currentIndex++,!0)},isBlockFinished(){return!this.currentBlock||this.currentBlock&&this.currentBlock.currentIndex>=this.currentBlock.branchData.branch.length},reachedEndOfScript(){if(le().gameFlow.labelToJumpOnScriptEnd&&this.lastLabel!==le().gameFlow.labelToJumpOnScriptEnd){this.jumpToLabel(le().gameFlow.labelToJumpOnScriptEnd);return}Te().endingScript(),Te().options.debug&&le().debugging.showScriptFinishedMessage},async runLineOnly(){const e=this.currentLine;if(!e){ae("There is no line of script to run.");return}return Te().startingScript(),await _d(e)},async runLabelFunction(e,...t){const n=Ie.script[e];if(!n){ae(`Tried to run a label that doesn't exist: ${e}`);return}const r={currentIndex:0,branchData:n,label:e,args:t};return this.addAndRunFrame(r)},runCustomFrame(e){this.addAndRunFrame(e)},async jumpToLabel(e,...t){const n=Ie.script[e];if(!n){ae(`Label ${e} doesn't exist. Is the file with this label added in the list of script files to load in the config?`);return}e!==this.lastLabel&&(this.hasJumped=!0),this.setLastLabel(e),this.setStack({currentIndex:0,branchData:n,args:t,label:e}),this.runGame()},async runThenGoBackToPreviousDialog(e,...t){const n=Fe(),r=n.dialog[n.dialog.length-1],o=Te().inScript,a=await this.runLabelFunction(e,...t);return o?n.dialog.push(r):Te().endingScript(),a}},getters:{currentFrame(e){return e.stack[e.stack.length-1]},scope(){var e;return((e=this.currentFrame)==null?void 0:e.scope)??{}},currentBlock(){const e=this.currentFrame;return e?e.blocks[e.blocks.length-1]:void 0},currentLine(){const e=this.currentBlock;if(e&&e.branchData.branch.length>e.currentIndex)return e.branchData.branch[e.currentIndex]},commandWaitingForAnswer(){if(this.commandsWaitingForPlayerAnswer.length>0)return this.commandsWaitingForPlayerAnswer[0]}}}),pd=new Io;pd.setupDebugger(!1);const Ht=pd.logger;function iT(e){return sT((t,n,r)=>vT(t,n,r),e.code,e.fileName)}function sT(e,t,n){const r={fileName:n,currentLine:0,error:(s,c)=>e(r,s,c),processCommandsFunction:Ms,indentSize:0};r.indentSize=yT(r,t);const o=pT(r,t);r.currentLine=0,Ht.log(o);const a={};for(const s of o){s.code.search(":")===-1&&r.error(s.line,"First indentation level should only be used to specify labels");const d=s.code.replace(":","").split(/ +/g),u=d[0],h=d.slice(1);s.branch||r.error(s.line,"This line should have a branch but doesn't"),a[u]={branch:Ms(r,s.branch,void 0),args:h}}return a}function Ms(e,t,n){const r=e.currentLine;if(!t){let s=0;return n&&(s=n.line),e.error(s,"Processing of command failed because the current branch has no lines inside"),[]}const o={processCommandsFunction:Ms,parserContext:e,lines:t,currentLine:0,line:t[0]},a=[];for(;o.currentLine<t.length;){const s=t[o.currentLine];o.line=s;const c=Bs(e,s,s.expression),d=Ie.commands[c.command.operator];let u=d==null?void 0:d.parser;u||(u=Ie.commands.text.parser),Ht.log(Ie.commands.text);const{newLine:h}=u(o,c);o.currentLine=h,e.currentLine=r+h,a.push(c)}return a}function Bs(e,t,n){Ht.log(n),typeof n[0]!="string"&&e.error(t.line,"Expression operator should be a string");const r={code:t.code,fileName:e.fileName,line:t.line,command:{staticOptions:{},commandType:n[0],operator:n[0],args:n.slice(1).map(s=>aT(e,t,s)),options:{}}},o=n[0];if(!Ie.commands[o]){const s=["else","success","failure"];!lm(o)&&!s.includes(o)&&e.error(t.line,`Unknown command ${o}`)}return r}function aT(e,t,n){return Array.isArray(n)?Bs(e,t,n):n}function lT(e){return e==="true"?!0:e==="false"?!1:e==="undefined"?void 0:e===null?null:isNaN(Number(e))?e:Number(e)}function cT(e,t){t.charAt(t.length-1)===":"&&(t=t.substr(0,t.length-1));const n=uT(t),[r]=hd(e,n);return r}function uT(e){const t=/(["'])(?:\\\1|.)*?\1/g,n=[];let r;for(;(r=t.exec(e))!=null;)n.push(r);let o=0,a=[];for(const s of n){const c=s.index;if(c>o){const u=e.substr(o,c-o),h=md(u);a=[...a,...h]}const d=s[0].replace(/\\/g,"");a.push(`$$"${d.substring(1,d.length-1)}`),o=c+s[0].length}return a=[...a,...md(e.substr(o))],a.push(")"),a}function md(e){e=e.replace(/: *$/g,"");let t=e.split(" ").filter(n=>n);return t=t.reduce((n,r)=>[...n,...r.split(/(\(|\))/g)].filter(o=>o&&o),[]),t.map(n=>lT(n))}function hd(e,t){Ht.log("===============");let n=[],r=0,o=yd(t)+r,a=Rs(t)+r;for(Ht.log(`Parsing expression: ${t}`),Ht.log(`Parenthesis start index: ${o} - end: ${a}`);o!==-1&&a>o;){n=[...n,...t.slice(r,o)];const d=t.slice(o+1);Ht.log(`Found a sub expression. Before: ${n} - After: ${d}`),r=o;const[u,h]=hd(e,d),l=r+h;n.push(u),r=l+1;const f=t.slice(r);Ht.log(`Sub expression came back: ${u} - rest of string: ${f}`),o=yd(f),o!==-1&&(o+=r),a=Rs(f),a!==-1&&(a+=r)}a!==-1&&Ht.log("Found parenthesis end before new opening parenthesis, close this expression");const s=Rs(t.slice(r))+r;if(s===-1)return e.error(e.currentLine,'Expression is not closed (missing ")" closing parenthesis)'),[n,s];const c=t.slice(r,s);return Ht.log(`End of expression: ${s} - ${c}`),Ht.log("==================="),n=[...n,...c],dT(e,n),[n,s+1]}function dT(e,t){t.length<1&&e.error(e.currentLine,"Expression is empty")}function yd(e){return e.findIndex(t=>t==="(")}function Rs(e){return e.findIndex(t=>t===")")}function fT(e,t){return t.split(/\r?\n|$/).reduce((r,o,a)=>{const s={code:o,line:a,multiline:!1},c=o.search(/\\$/);c!==-1&&(s.multiline=!0,o=o.substring(0,c));const d=o.search(/ *\/\//g);return d!==-1&&(o=o.substring(0,d)),s.code=o,s.code.search(/^\s*$/)===-1&&(r.length>0&&r[r.length-1].multiline?(r[r.length-1].code+=o,r[r.length-1].multiline=s.multiline):r.push(s)),r},[])}function pT(e,t){const n=fT(e,t);return gd(e,n,0,0).lines}function gd(e,t,n,r){let o=!0,a=n;const s=[];for(;o&&!(a>=t.length);){const c=t[a];let d=c.code;const u=hT(e,d);if(d=d.substring(u*e.indentSize),mT(e,u,a),u<r)o=!1;else if(u>r){(s.length===0||u-r!==1)&&e.error(c.line,"Wrong double indentation");const h=gd(e,t,a,u);s[s.length-1].branch=h.lines,a=h.endLine}else{const h=cT(e,d),l={code:d,indentation:u,line:c.line,expression:h};s.push(l),a++,e.currentLine=a}}return{lines:s,endLine:a}}function mT(e,t,n){t%1!==0&&e.error(n,`Indentation level of ${t} incorrect. Expected indentation of ${e.indentSize} spaces for this file.`)}function hT(e,t){return t.search(/[^ ]/)/e.indentSize}function yT(e,t){const n=t.match(/: *[\n\r]+( *)/);return!n||n.length<2?(e.error(0,"Can't detect indentation level. Make sure you indent with at least 2 spaces and consistently"),0):(Ht.log(n),n[1].length)}class gT{constructor(){De(this,"plugins",[]);De(this,"pinia");De(this,"script",{});De(this,"scripts",[]);De(this,"commands",{})}addCommand(t){this.commands[t.keyword]=t}addPlugin(t){if(this.plugins.push(t),t.customCommands)for(const n of t.customCommands)this.addCommand(n)}callHook(t,...n){for(const r of this.plugins)typeof r[t]=="function"&&r[t](...n)}addNarratScript(t){const n=iT(t);this.script={...this.script,...n},this.scripts.push(t)}customStores(){const t=[];for(const n of this.plugins)if(n.customStores)for(const r in n.customStores)t.push([r,n.customStores[r](this.pinia)]);return t}addCustomSettings(){for(const t of this.plugins)if(t.customSettings)for(const n in t.customSettings)sn().addCustomSetting(n,t.customSettings[n])}}const Ie=new gT;async function _d(e,t){var r;const n=ve();try{return await ni(e,t)}catch(o){console.error(o),console.error(e),ae(`Narrat script runtime error at <span class="error-filename">${e.fileName}:${e.line+1}</span>
70
70
  <b>${o}</b>
71
71
  Script: ${e.code}
72
- Label: ${((r=n.currentFrame)==null?void 0:r.label)||"none"}`)}}async function mT(e,t){const n=e.command,r=Ie.commands[n.commandType];if(r){const o={args:[],options:{},operator:n.operator,staticOptions:n.staticOptions,code:e.code,commandType:n.commandType,fileName:e.fileName,line:e.line},a=r.argTypes;o.options={};for(const[s,c]of n.args.entries()){let d;if(Fc(c))d=await ei(c,t);else if(typeof c=="string")if(c.search(Il)===0)d=nn(c.substring(3));else if(Vc(c)){const u=Mr(),h=zS(u,c);if(h){const[l,f]=h;d=l[f]}else d=c}else d=c;else d=c;if(o.args.push(d),Array.isArray(a)&&a.length>s){const u=a[s];d!==null&&(o.options[u.name]=d)}}return o}else throw new Error(`${n.commandType} is not a valid command`)}async function ei(e,t){const n=await mT(e,t),r=Ie.commands[n.commandType];if(r)return await r.run(n,t);throw new Error(`${n.commandType} is not a valid command`)}async function hT(e){Qn("onPlayerAnswered");const t=we(),n=t.popAnswerQueue(),r=t.currentLine;try{if(n){const o=Ie.commands[n.commandType];if(o)return await o.processPlayerAnswer(n,e)}}catch(o){console.error(o),ae(`Error after player answer at ${r.fileName}:${r.line+1} (${r.code}<br /> - Error: ${o}`)}}function yT(){return{baseAssetsPath:"",baseDataPath:"",configPath:"data/config.json",logging:!1,debug:!1,scripts:[],container:"#game-holder"}}class gT extends Ts{}const Te=et("main",{state:()=>({ready:!1,playing:!1,errors:[],playTime:{start:0,previousPlaytime:0},saveSlot:"",paused:!1,debugMode:!0,options:{baseAssetsPath:"",baseDataPath:"",configPath:"data/config.json",logging:!1,debug:!1,scripts:[]},loading:{step:"Loading",percentage:.1,loaded:!1},alerts:[],saving:null,listener:new gT,inScript:!1}),actions:{setLoadingStep(e,t){this.loading.step=e,this.loading.percentage=t},gameLoaded(){this.loading.loaded=!0,this.listener.emit("gameLoaded")},async alert(e,t){return new Promise(n=>{this.alerts.push({title:e,text:t,resolver:n,id:Gn()})})},closeAlert(e){const t=this.alerts.findIndex(n=>n.id===e);t!==-1&&(this.alerts[t].resolver(),this.alerts.splice(t,1))},startingScript(){mt().onScriptStart(),this.inScript=!0},endingScript(){mt().onScriptEnd(),this.inScript=!1},prepareToPlay(){this.ready=!0,this.startPlaying(),Nt().changeScene("playing")},setSaveSlot(e){this.saveSlot=e,vp(e)},startManualSave(e,t,n){this.saving={name:t,withPrompt:n,resolver:e}},cancelManualSave(){this.saving&&(this.saving.resolver(),this.saving=null)},playerAnswered(e){hT(e)},menuReturn(){Nt().changeScene("start-menu")},createError(e){this.errors.push({text:e,type:"error"})},createWarning(e){this.errors.push({text:e,type:"warning"})},clearErrors(){this.errors=[]},pause(){this.paused=!0},unpause(){this.paused=!1},setOptions(e){this.options=e},startPlaying(){this.playing=!0,this.playTime.start=Date.now()},reset(){this.ready=!1,this.paused=!1,this.playing=!1,this.ready=!0},generateSaveData(){return{playTime:mr(this.playTime.start,this.playTime.previousPlaytime)}},loadSaveData(e){this.playTime.previousPlaytime=e.playTime},exitGame(){window.close()}},getters:{isInGame(e){return Nt().isPlaying},totalPlayTime(e){return mr(e.playTime.start,e.playTime.previousPlaytime)},sessionPlayTime(e){return mr(e.playTime.start,0)},hasCustomContainer(e){return(e.options.container??"")!=="#game-holder"}}});function _T(e,t,n){console.error(`Parser error: ${e.fileName}:${e.currentLine}`,n);const r=`[Parser Error] in <span class="error-filename">${e.fileName}:${t+1}</span> - <b>${n}</b>`;ae(r)}function ae(e,...t){const n=Te();console.error(e,...t),e=e.replace(/[\r\n]/g,`
73
- <br />`),n.createError(`❌ ${e}`)}function Zn(e,...t){const n=Te();console.warn(e,...t),e=e.replace(/[\r\n]/g,`
74
- <br />`),n.createWarning(`⚠️ ${e}`)}const ti=p.Type.Object({screens:p.Type.Union([p.Type.String(),uc]),buttons:p.Type.Optional(p.Type.Union([p.Type.String(),ac])),skills:p.Type.Optional(p.Type.Union([p.Type.String(),mc])),skillChecks:p.Type.Optional(p.Type.Union([p.Type.String(),Cc])),scripts:p.Type.Optional(p.Type.Union([p.Type.String(),Xl])),audio:p.Type.Union([p.Type.String(),Ml]),tooltips:p.Type.Optional(p.Type.Union([p.Type.String(),bc])),items:p.Type.Optional(p.Type.Union([p.Type.String(),nc])),achievements:p.Type.Optional(p.Type.Union([p.Type.String(),wc])),quests:p.Type.Optional(p.Type.Union([p.Type.String(),oc])),characters:p.Type.Union([p.Type.String(),yc]),choices:p.Type.Optional(p.Type.Union([p.Type.String(),Oc])),animations:p.Type.Optional(p.Type.Union([p.Type.String(),Nc])),macros:p.Type.Optional(jc),preload:p.Type.Optional(xc)}),Bs=p.Type.Intersect([ti,p.Type.Object({common:Zl})]),Fs=p.Type.Intersect([ti,p.Type.Object({baseAssetsPath:p.Type.Optional(p.Type.String()),baseDataPath:p.Type.Optional(p.Type.String()),gameTitle:p.Type.String(),saveFileName:p.Type.String(),images:p.Type.Optional(p.Type.Record(p.Type.String(),p.Type.String())),layout:Bl,settings:p.Type.Optional(Vl),gameFlow:p.Type.Optional(p.Type.Object({labelToJumpOnScriptEnd:p.Type.Optional(p.Type.String())})),dialogPanel:p.Type.Optional(ql),splashScreens:p.Type.Optional(Hl),notifications:p.Type.Optional(Kl),hudStats:Gl,interactionTags:p.Type.Optional(zl),transitions:p.Type.Optional(Wl),menuButtons:p.Type.Optional(Ql),debugging:p.Type.Optional(Yl),saves:p.Type.Optional(Jl)})]),Vs=p.Type.Union([Bs,Fs]);function ni(e){return"common"in e}var Us={exports:{}},gd={},Yt={},$r={},so={},Pe={},ao={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class n extends t{constructor(I){if(super(),!e.IDENTIFIER.test(I))throw new Error("CodeGen: name must be a valid identifier");this.str=I}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=n;class r extends t{constructor(I){super(),this._items=typeof I=="string"?[I]:I}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const I=this._items[0];return I===""||I==='""'}get str(){var I;return(I=this._str)!==null&&I!==void 0?I:this._str=this._items.reduce((x,B)=>`${x}${B}`,"")}get names(){var I;return(I=this._names)!==null&&I!==void 0?I:this._names=this._items.reduce((x,B)=>(B instanceof n&&(x[B.str]=(x[B.str]||0)+1),x),{})}}e._Code=r,e.nil=new r("");function o(T,...I){const x=[T[0]];let B=0;for(;B<I.length;)c(x,I[B]),x.push(T[++B]);return new r(x)}e._=o;const a=new r("+");function s(T,...I){const x=[m(T[0])];let B=0;for(;B<I.length;)x.push(a),c(x,I[B]),x.push(a,m(T[++B]));return d(x),new r(x)}e.str=s;function c(T,I){I instanceof r?T.push(...I._items):I instanceof n?T.push(I):T.push(l(I))}e.addCodeArg=c;function d(T){let I=1;for(;I<T.length-1;){if(T[I]===a){const x=u(T[I-1],T[I+1]);if(x!==void 0){T.splice(I-1,3,x);continue}T[I++]="+"}I++}}function u(T,I){if(I==='""')return T;if(T==='""')return I;if(typeof T=="string")return I instanceof n||T[T.length-1]!=='"'?void 0:typeof I!="string"?`${T.slice(0,-1)}${I}"`:I[0]==='"'?T.slice(0,-1)+I.slice(1):void 0;if(typeof I=="string"&&I[0]==='"'&&!(T instanceof n))return`"${T}${I.slice(1)}`}function h(T,I){return I.emptyStr()?T:T.emptyStr()?I:s`${T}${I}`}e.strConcat=h;function l(T){return typeof T=="number"||typeof T=="boolean"||T===null?T:m(Array.isArray(T)?T.join(","):T)}function f(T){return new r(m(T))}e.stringify=f;function m(T){return JSON.stringify(T).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=m;function y(T){return typeof T=="string"&&e.IDENTIFIER.test(T)?new r(`.${T}`):o`[${T}]`}e.getProperty=y;function b(T){if(typeof T=="string"&&e.IDENTIFIER.test(T))return new r(`${T}`);throw new Error(`CodeGen: invalid export name: ${T}, use explicit $id name mapping`)}e.getEsmExportName=b;function S(T){return new r(T.toString())}e.regexpCode=S})(ao);var qs={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=ao;class n extends Error{constructor(u){super(`CodeGen: "code" for ${u} not defined`),this.value=u.value}}var r;(function(d){d[d.Started=0]="Started",d[d.Completed=1]="Completed"})(r=e.UsedValueState||(e.UsedValueState={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class o{constructor({prefixes:u,parent:h}={}){this._names={},this._prefixes=u,this._parent=h}toName(u){return u instanceof t.Name?u:this.name(u)}name(u){return new t.Name(this._newName(u))}_newName(u){const h=this._names[u]||this._nameGroup(u);return`${u}${h.index++}`}_nameGroup(u){var h,l;if(!((l=(h=this._parent)===null||h===void 0?void 0:h._prefixes)===null||l===void 0)&&l.has(u)||this._prefixes&&!this._prefixes.has(u))throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);return this._names[u]={prefix:u,index:0}}}e.Scope=o;class a extends t.Name{constructor(u,h){super(h),this.prefix=u}setValue(u,{property:h,itemIndex:l}){this.value=u,this.scopePath=(0,t._)`.${new t.Name(h)}[${l}]`}}e.ValueScopeName=a;const s=(0,t._)`\n`;class c extends o{constructor(u){super(u),this._values={},this._scope=u.scope,this.opts={...u,_n:u.lines?s:t.nil}}get(){return this._scope}name(u){return new a(u,this._newName(u))}value(u,h){var l;if(h.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const f=this.toName(u),{prefix:m}=f,y=(l=h.key)!==null&&l!==void 0?l:h.ref;let b=this._values[m];if(b){const I=b.get(y);if(I)return I}else b=this._values[m]=new Map;b.set(y,f);const S=this._scope[m]||(this._scope[m]=[]),T=S.length;return S[T]=h.ref,f.setValue(h,{property:m,itemIndex:T}),f}getValue(u,h){const l=this._values[u];if(l)return l.get(h)}scopeRefs(u,h=this._values){return this._reduceValues(h,l=>{if(l.scopePath===void 0)throw new Error(`CodeGen: name "${l}" has no value`);return(0,t._)`${u}${l.scopePath}`})}scopeCode(u=this._values,h,l){return this._reduceValues(u,f=>{if(f.value===void 0)throw new Error(`CodeGen: name "${f}" has no value`);return f.value.code},h,l)}_reduceValues(u,h,l={},f){let m=t.nil;for(const y in u){const b=u[y];if(!b)continue;const S=l[y]=l[y]||new Map;b.forEach(T=>{if(S.has(T))return;S.set(T,r.Started);let I=h(T);if(I){const x=this.opts.es5?e.varKinds.var:e.varKinds.const;m=(0,t._)`${m}${x} ${T} = ${I};${this.opts._n}`}else if(I=f==null?void 0:f(T))m=(0,t._)`${m}${I}${this.opts._n}`;else throw new n(T);S.set(T,r.Completed)})}return m}}e.ValueScope=c})(qs),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=ao,n=qs;var r=ao;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}});var o=qs;Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class a{optimizeNodes(){return this}optimizeNames(_,v){return this}}class s extends a{constructor(_,v,C){super(),this.varKind=_,this.name=v,this.rhs=C}render({es5:_,_n:v}){const C=_?n.varKinds.var:this.varKind,M=this.rhs===void 0?"":` = ${this.rhs}`;return`${C} ${this.name}${M};`+v}optimizeNames(_,v){if(_[this.name.str])return this.rhs&&(this.rhs=te(this.rhs,_,v)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class c extends a{constructor(_,v,C){super(),this.lhs=_,this.rhs=v,this.sideEffects=C}render({_n:_}){return`${this.lhs} = ${this.rhs};`+_}optimizeNames(_,v){if(!(this.lhs instanceof t.Name&&!_[this.lhs.str]&&!this.sideEffects))return this.rhs=te(this.rhs,_,v),this}get names(){const _=this.lhs instanceof t.Name?{}:{...this.lhs.names};return Q(_,this.rhs)}}class d extends c{constructor(_,v,C,M){super(_,C,M),this.op=v}render({_n:_}){return`${this.lhs} ${this.op}= ${this.rhs};`+_}}class u extends a{constructor(_){super(),this.label=_,this.names={}}render({_n:_}){return`${this.label}:`+_}}class h extends a{constructor(_){super(),this.label=_,this.names={}}render({_n:_}){return`break${this.label?` ${this.label}`:""};`+_}}class l extends a{constructor(_){super(),this.error=_}render({_n:_}){return`throw ${this.error};`+_}get names(){return this.error.names}}class f extends a{constructor(_){super(),this.code=_}render({_n:_}){return`${this.code};`+_}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(_,v){return this.code=te(this.code,_,v),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class m extends a{constructor(_=[]){super(),this.nodes=_}render(_){return this.nodes.reduce((v,C)=>v+C.render(_),"")}optimizeNodes(){const{nodes:_}=this;let v=_.length;for(;v--;){const C=_[v].optimizeNodes();Array.isArray(C)?_.splice(v,1,...C):C?_[v]=C:_.splice(v,1)}return _.length>0?this:void 0}optimizeNames(_,v){const{nodes:C}=this;let M=C.length;for(;M--;){const U=C[M];U.optimizeNames(_,v)||(ke(_,U.names),C.splice(M,1))}return C.length>0?this:void 0}get names(){return this.nodes.reduce((_,v)=>z(_,v.names),{})}}class y extends m{render(_){return"{"+_._n+super.render(_)+"}"+_._n}}class b extends m{}class S extends y{}S.kind="else";class T extends y{constructor(_,v){super(v),this.condition=_}render(_){let v=`if(${this.condition})`+super.render(_);return this.else&&(v+="else "+this.else.render(_)),v}optimizeNodes(){super.optimizeNodes();const _=this.condition;if(_===!0)return this.nodes;let v=this.else;if(v){const C=v.optimizeNodes();v=this.else=Array.isArray(C)?new S(C):C}if(v)return _===!1?v instanceof T?v:v.nodes:this.nodes.length?this:new T(Ne(_),v instanceof T?[v]:v.nodes);if(!(_===!1||!this.nodes.length))return this}optimizeNames(_,v){var C;if(this.else=(C=this.else)===null||C===void 0?void 0:C.optimizeNames(_,v),!!(super.optimizeNames(_,v)||this.else))return this.condition=te(this.condition,_,v),this}get names(){const _=super.names;return Q(_,this.condition),this.else&&z(_,this.else.names),_}}T.kind="if";class I extends y{}I.kind="for";class x extends I{constructor(_){super(),this.iteration=_}render(_){return`for(${this.iteration})`+super.render(_)}optimizeNames(_,v){if(super.optimizeNames(_,v))return this.iteration=te(this.iteration,_,v),this}get names(){return z(super.names,this.iteration.names)}}class B extends I{constructor(_,v,C,M){super(),this.varKind=_,this.name=v,this.from=C,this.to=M}render(_){const v=_.es5?n.varKinds.var:this.varKind,{name:C,from:M,to:U}=this;return`for(${v} ${C}=${M}; ${C}<${U}; ${C}++)`+super.render(_)}get names(){const _=Q(super.names,this.from);return Q(_,this.to)}}class F extends I{constructor(_,v,C,M){super(),this.loop=_,this.varKind=v,this.name=C,this.iterable=M}render(_){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(_)}optimizeNames(_,v){if(super.optimizeNames(_,v))return this.iterable=te(this.iterable,_,v),this}get names(){return z(super.names,this.iterable.names)}}class L extends y{constructor(_,v,C){super(),this.name=_,this.args=v,this.async=C}render(_){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(_)}}L.kind="func";class P extends m{render(_){return"return "+super.render(_)}}P.kind="return";class Y extends y{render(_){let v="try"+super.render(_);return this.catch&&(v+=this.catch.render(_)),this.finally&&(v+=this.finally.render(_)),v}optimizeNodes(){var _,v;return super.optimizeNodes(),(_=this.catch)===null||_===void 0||_.optimizeNodes(),(v=this.finally)===null||v===void 0||v.optimizeNodes(),this}optimizeNames(_,v){var C,M;return super.optimizeNames(_,v),(C=this.catch)===null||C===void 0||C.optimizeNames(_,v),(M=this.finally)===null||M===void 0||M.optimizeNames(_,v),this}get names(){const _=super.names;return this.catch&&z(_,this.catch.names),this.finally&&z(_,this.finally.names),_}}class W extends y{constructor(_){super(),this.error=_}render(_){return`catch(${this.error})`+super.render(_)}}W.kind="catch";class X extends y{render(_){return"finally"+super.render(_)}}X.kind="finally";class G{constructor(_,v={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...v,_n:v.lines?`
75
- `:""},this._extScope=_,this._scope=new n.Scope({parent:_}),this._nodes=[new b]}toString(){return this._root.render(this.opts)}name(_){return this._scope.name(_)}scopeName(_){return this._extScope.name(_)}scopeValue(_,v){const C=this._extScope.value(_,v);return(this._values[C.prefix]||(this._values[C.prefix]=new Set)).add(C),C}getScopeValue(_,v){return this._extScope.getValue(_,v)}scopeRefs(_){return this._extScope.scopeRefs(_,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(_,v,C,M){const U=this._scope.toName(v);return C!==void 0&&M&&(this._constants[U.str]=C),this._leafNode(new s(_,U,C)),U}const(_,v,C){return this._def(n.varKinds.const,_,v,C)}let(_,v,C){return this._def(n.varKinds.let,_,v,C)}var(_,v,C){return this._def(n.varKinds.var,_,v,C)}assign(_,v,C){return this._leafNode(new c(_,v,C))}add(_,v){return this._leafNode(new d(_,e.operators.ADD,v))}code(_){return typeof _=="function"?_():_!==t.nil&&this._leafNode(new f(_)),this}object(..._){const v=["{"];for(const[C,M]of _)v.length>1&&v.push(","),v.push(C),(C!==M||this.opts.es5)&&(v.push(":"),(0,t.addCodeArg)(v,M));return v.push("}"),new t._Code(v)}if(_,v,C){if(this._blockNode(new T(_)),v&&C)this.code(v).else().code(C).endIf();else if(v)this.code(v).endIf();else if(C)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(_){return this._elseNode(new T(_))}else(){return this._elseNode(new S)}endIf(){return this._endBlockNode(T,S)}_for(_,v){return this._blockNode(_),v&&this.code(v).endFor(),this}for(_,v){return this._for(new x(_),v)}forRange(_,v,C,M,U=this.opts.es5?n.varKinds.var:n.varKinds.let){const ne=this._scope.toName(_);return this._for(new B(U,ne,v,C),()=>M(ne))}forOf(_,v,C,M=n.varKinds.const){const U=this._scope.toName(_);if(this.opts.es5){const ne=v instanceof t.Name?v:this.var("_arr",v);return this.forRange("_i",0,(0,t._)`${ne}.length`,ee=>{this.var(U,(0,t._)`${ne}[${ee}]`),C(U)})}return this._for(new F("of",M,U,v),()=>C(U))}forIn(_,v,C,M=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(_,(0,t._)`Object.keys(${v})`,C);const U=this._scope.toName(_);return this._for(new F("in",M,U,v),()=>C(U))}endFor(){return this._endBlockNode(I)}label(_){return this._leafNode(new u(_))}break(_){return this._leafNode(new h(_))}return(_){const v=new P;if(this._blockNode(v),this.code(_),v.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(P)}try(_,v,C){if(!v&&!C)throw new Error('CodeGen: "try" without "catch" and "finally"');const M=new Y;if(this._blockNode(M),this.code(_),v){const U=this.name("e");this._currNode=M.catch=new W(U),v(U)}return C&&(this._currNode=M.finally=new X,this.code(C)),this._endBlockNode(W,X)}throw(_){return this._leafNode(new l(_))}block(_,v){return this._blockStarts.push(this._nodes.length),_&&this.code(_).endBlock(v),this}endBlock(_){const v=this._blockStarts.pop();if(v===void 0)throw new Error("CodeGen: not in self-balancing block");const C=this._nodes.length-v;if(C<0||_!==void 0&&C!==_)throw new Error(`CodeGen: wrong number of nodes: ${C} vs ${_} expected`);return this._nodes.length=v,this}func(_,v=t.nil,C,M){return this._blockNode(new L(_,v,C)),M&&this.code(M).endFunc(),this}endFunc(){return this._endBlockNode(L)}optimize(_=1){for(;_-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(_){return this._currNode.nodes.push(_),this}_blockNode(_){this._currNode.nodes.push(_),this._nodes.push(_)}_endBlockNode(_,v){const C=this._currNode;if(C instanceof _||v&&C instanceof v)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${v?`${_.kind}/${v.kind}`:_.kind}"`)}_elseNode(_){const v=this._currNode;if(!(v instanceof T))throw new Error('CodeGen: "else" without "if"');return this._currNode=v.else=_,this}get _root(){return this._nodes[0]}get _currNode(){const _=this._nodes;return _[_.length-1]}set _currNode(_){const v=this._nodes;v[v.length-1]=_}}e.CodeGen=G;function z($,_){for(const v in _)$[v]=($[v]||0)+(_[v]||0);return $}function Q($,_){return _ instanceof t._CodeOrName?z($,_.names):$}function te($,_,v){if($ instanceof t.Name)return C($);if(!M($))return $;return new t._Code($._items.reduce((U,ne)=>(ne instanceof t.Name&&(ne=C(ne)),ne instanceof t._Code?U.push(...ne._items):U.push(ne),U),[]));function C(U){const ne=v[U.str];return ne===void 0||_[U.str]!==1?U:(delete _[U.str],ne)}function M(U){return U instanceof t._Code&&U._items.some(ne=>ne instanceof t.Name&&_[ne.str]===1&&v[ne.str]!==void 0)}}function ke($,_){for(const v in _)$[v]=($[v]||0)-(_[v]||0)}function Ne($){return typeof $=="boolean"||typeof $=="number"||$===null?!$:(0,t._)`!${E($)}`}e.not=Ne;const Ze=g(e.operators.AND);function qe(...$){return $.reduce(Ze)}e.and=qe;const nt=g(e.operators.OR);function j(...$){return $.reduce(nt)}e.or=j;function g($){return(_,v)=>_===t.nil?v:v===t.nil?_:(0,t._)`${E(_)} ${$} ${E(v)}`}function E($){return $ instanceof t.Name?$:(0,t._)`(${$})`}}(Pe);var Me={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;const t=Pe,n=ao;function r(L){const P={};for(const Y of L)P[Y]=!0;return P}e.toHash=r;function o(L,P){return typeof P=="boolean"?P:Object.keys(P).length===0?!0:(a(L,P),!s(P,L.self.RULES.all))}e.alwaysValidSchema=o;function a(L,P=L.schema){const{opts:Y,self:W}=L;if(!Y.strictSchema||typeof P=="boolean")return;const X=W.RULES.keywords;for(const G in P)X[G]||F(L,`unknown keyword: "${G}"`)}e.checkUnknownRules=a;function s(L,P){if(typeof L=="boolean")return!L;for(const Y in L)if(P[Y])return!0;return!1}e.schemaHasRules=s;function c(L,P){if(typeof L=="boolean")return!L;for(const Y in L)if(Y!=="$ref"&&P.all[Y])return!0;return!1}e.schemaHasRulesButRef=c;function d({topSchemaRef:L,schemaPath:P},Y,W,X){if(!X){if(typeof Y=="number"||typeof Y=="boolean")return Y;if(typeof Y=="string")return(0,t._)`${Y}`}return(0,t._)`${L}${P}${(0,t.getProperty)(W)}`}e.schemaRefOrVal=d;function u(L){return f(decodeURIComponent(L))}e.unescapeFragment=u;function h(L){return encodeURIComponent(l(L))}e.escapeFragment=h;function l(L){return typeof L=="number"?`${L}`:L.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=l;function f(L){return L.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=f;function m(L,P){if(Array.isArray(L))for(const Y of L)P(Y);else P(L)}e.eachItem=m;function y({mergeNames:L,mergeToName:P,mergeValues:Y,resultToName:W}){return(X,G,z,Q)=>{const te=z===void 0?G:z instanceof t.Name?(G instanceof t.Name?L(X,G,z):P(X,G,z),z):G instanceof t.Name?(P(X,z,G),G):Y(G,z);return Q===t.Name&&!(te instanceof t.Name)?W(X,te):te}}e.mergeEvaluated={props:y({mergeNames:(L,P,Y)=>L.if((0,t._)`${Y} !== true && ${P} !== undefined`,()=>{L.if((0,t._)`${P} === true`,()=>L.assign(Y,!0),()=>L.assign(Y,(0,t._)`${Y} || {}`).code((0,t._)`Object.assign(${Y}, ${P})`))}),mergeToName:(L,P,Y)=>L.if((0,t._)`${Y} !== true`,()=>{P===!0?L.assign(Y,!0):(L.assign(Y,(0,t._)`${Y} || {}`),S(L,Y,P))}),mergeValues:(L,P)=>L===!0?!0:{...L,...P},resultToName:b}),items:y({mergeNames:(L,P,Y)=>L.if((0,t._)`${Y} !== true && ${P} !== undefined`,()=>L.assign(Y,(0,t._)`${P} === true ? true : ${Y} > ${P} ? ${Y} : ${P}`)),mergeToName:(L,P,Y)=>L.if((0,t._)`${Y} !== true`,()=>L.assign(Y,P===!0?!0:(0,t._)`${Y} > ${P} ? ${Y} : ${P}`)),mergeValues:(L,P)=>L===!0?!0:Math.max(L,P),resultToName:(L,P)=>L.var("items",P)})};function b(L,P){if(P===!0)return L.var("props",!0);const Y=L.var("props",(0,t._)`{}`);return P!==void 0&&S(L,Y,P),Y}e.evaluatedPropsToName=b;function S(L,P,Y){Object.keys(Y).forEach(W=>L.assign((0,t._)`${P}${(0,t.getProperty)(W)}`,!0))}e.setEvaluated=S;const T={};function I(L,P){return L.scopeValue("func",{ref:P,code:T[P.code]||(T[P.code]=new n._Code(P.code))})}e.useFunc=I;var x;(function(L){L[L.Num=0]="Num",L[L.Str=1]="Str"})(x=e.Type||(e.Type={}));function B(L,P,Y){if(L instanceof t.Name){const W=P===x.Num;return Y?W?(0,t._)`"[" + ${L} + "]"`:(0,t._)`"['" + ${L} + "']"`:W?(0,t._)`"/" + ${L}`:(0,t._)`"/" + ${L}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return Y?(0,t.getProperty)(L).toString():"/"+l(L)}e.getErrorPath=B;function F(L,P,Y=L.opts.strictSchema){if(Y){if(P=`strict mode: ${P}`,Y===!0)throw new Error(P);L.self.logger.warn(P)}}e.checkStrictMode=F})(Me);var ln={};Object.defineProperty(ln,"__esModule",{value:!0});const St=Pe,bT={data:new St.Name("data"),valCxt:new St.Name("valCxt"),instancePath:new St.Name("instancePath"),parentData:new St.Name("parentData"),parentDataProperty:new St.Name("parentDataProperty"),rootData:new St.Name("rootData"),dynamicAnchors:new St.Name("dynamicAnchors"),vErrors:new St.Name("vErrors"),errors:new St.Name("errors"),this:new St.Name("this"),self:new St.Name("self"),scope:new St.Name("scope"),json:new St.Name("json"),jsonPos:new St.Name("jsonPos"),jsonLen:new St.Name("jsonLen"),jsonPart:new St.Name("jsonPart")};ln.default=bT,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=Pe,n=Me,r=ln;e.keywordError={message:({keyword:S})=>(0,t.str)`must pass "${S}" keyword validation`},e.keyword$DataError={message:({keyword:S,schemaType:T})=>T?(0,t.str)`"${S}" keyword must be ${T} ($data)`:(0,t.str)`"${S}" keyword is invalid ($data)`};function o(S,T=e.keywordError,I,x){const{it:B}=S,{gen:F,compositeRule:L,allErrors:P}=B,Y=l(S,T,I);x??(L||P)?d(F,Y):u(B,(0,t._)`[${Y}]`)}e.reportError=o;function a(S,T=e.keywordError,I){const{it:x}=S,{gen:B,compositeRule:F,allErrors:L}=x,P=l(S,T,I);d(B,P),F||L||u(x,r.default.vErrors)}e.reportExtraError=a;function s(S,T){S.assign(r.default.errors,T),S.if((0,t._)`${r.default.vErrors} !== null`,()=>S.if(T,()=>S.assign((0,t._)`${r.default.vErrors}.length`,T),()=>S.assign(r.default.vErrors,null)))}e.resetErrorsCount=s;function c({gen:S,keyword:T,schemaValue:I,data:x,errsCount:B,it:F}){if(B===void 0)throw new Error("ajv implementation error");const L=S.name("err");S.forRange("i",B,r.default.errors,P=>{S.const(L,(0,t._)`${r.default.vErrors}[${P}]`),S.if((0,t._)`${L}.instancePath === undefined`,()=>S.assign((0,t._)`${L}.instancePath`,(0,t.strConcat)(r.default.instancePath,F.errorPath))),S.assign((0,t._)`${L}.schemaPath`,(0,t.str)`${F.errSchemaPath}/${T}`),F.opts.verbose&&(S.assign((0,t._)`${L}.schema`,I),S.assign((0,t._)`${L}.data`,x))})}e.extendErrors=c;function d(S,T){const I=S.const("err",T);S.if((0,t._)`${r.default.vErrors} === null`,()=>S.assign(r.default.vErrors,(0,t._)`[${I}]`),(0,t._)`${r.default.vErrors}.push(${I})`),S.code((0,t._)`${r.default.errors}++`)}function u(S,T){const{gen:I,validateName:x,schemaEnv:B}=S;B.$async?I.throw((0,t._)`new ${S.ValidationError}(${T})`):(I.assign((0,t._)`${x}.errors`,T),I.return(!1))}const h={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function l(S,T,I){const{createErrors:x}=S.it;return x===!1?(0,t._)`{}`:f(S,T,I)}function f(S,T,I={}){const{gen:x,it:B}=S,F=[m(B,I),y(S,I)];return b(S,T,F),x.object(...F)}function m({errorPath:S},{instancePath:T}){const I=T?(0,t.str)`${S}${(0,n.getErrorPath)(T,n.Type.Str)}`:S;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,I)]}function y({keyword:S,it:{errSchemaPath:T}},{schemaPath:I,parentSchema:x}){let B=x?T:(0,t.str)`${T}/${S}`;return I&&(B=(0,t.str)`${B}${(0,n.getErrorPath)(I,n.Type.Str)}`),[h.schemaPath,B]}function b(S,{params:T,message:I},x){const{keyword:B,data:F,schemaValue:L,it:P}=S,{opts:Y,propertyName:W,topSchemaRef:X,schemaPath:G}=P;x.push([h.keyword,B],[h.params,typeof T=="function"?T(S):T||(0,t._)`{}`]),Y.messages&&x.push([h.message,typeof I=="function"?I(S):I]),Y.verbose&&x.push([h.schema,L],[h.parentSchema,(0,t._)`${X}${G}`],[r.default.data,F]),W&&x.push([h.propertyName,W])}}(so),Object.defineProperty($r,"__esModule",{value:!0}),$r.boolOrEmptySchema=$r.topBoolOrEmptySchema=void 0;const TT=so,vT=Pe,ST=ln,wT={message:"boolean schema is false"};function kT(e){const{gen:t,schema:n,validateName:r}=e;n===!1?_d(e,!1):typeof n=="object"&&n.$async===!0?t.return(ST.default.data):(t.assign((0,vT._)`${r}.errors`,null),t.return(!0))}$r.topBoolOrEmptySchema=kT;function CT(e,t){const{gen:n,schema:r}=e;r===!1?(n.var(t,!1),_d(e)):n.var(t,!0)}$r.boolOrEmptySchema=CT;function _d(e,t){const{gen:n,data:r}=e,o={gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,TT.reportError)(o,wT,void 0,t)}var lo={},er={};Object.defineProperty(er,"__esModule",{value:!0}),er.getRules=er.isJSONType=void 0;const $T=["string","number","integer","boolean","null","object","array"],ET=new Set($T);function OT(e){return typeof e=="string"&&ET.has(e)}er.isJSONType=OT;function AT(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}er.getRules=AT;var wn={};Object.defineProperty(wn,"__esModule",{value:!0}),wn.shouldUseRule=wn.shouldUseGroup=wn.schemaHasRulesForType=void 0;function IT({schema:e,self:t},n){const r=t.RULES.types[n];return r&&r!==!0&&bd(e,r)}wn.schemaHasRulesForType=IT;function bd(e,t){return t.rules.some(n=>Td(e,n))}wn.shouldUseGroup=bd;function Td(e,t){var n;return e[t.keyword]!==void 0||((n=t.definition.implements)===null||n===void 0?void 0:n.some(r=>e[r]!==void 0))}wn.shouldUseRule=Td,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;const t=er,n=wn,r=so,o=Pe,a=Me;var s;(function(x){x[x.Correct=0]="Correct",x[x.Wrong=1]="Wrong"})(s=e.DataType||(e.DataType={}));function c(x){const B=d(x.type);if(B.includes("null")){if(x.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!B.length&&x.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');x.nullable===!0&&B.push("null")}return B}e.getSchemaTypes=c;function d(x){const B=Array.isArray(x)?x:x?[x]:[];if(B.every(t.isJSONType))return B;throw new Error("type must be JSONType or JSONType[]: "+B.join(","))}e.getJSONTypes=d;function u(x,B){const{gen:F,data:L,opts:P}=x,Y=l(B,P.coerceTypes),W=B.length>0&&!(Y.length===0&&B.length===1&&(0,n.schemaHasRulesForType)(x,B[0]));if(W){const X=b(B,L,P.strictNumbers,s.Wrong);F.if(X,()=>{Y.length?f(x,B,Y):T(x)})}return W}e.coerceAndCheckDataType=u;const h=new Set(["string","number","integer","boolean","null"]);function l(x,B){return B?x.filter(F=>h.has(F)||B==="array"&&F==="array"):[]}function f(x,B,F){const{gen:L,data:P,opts:Y}=x,W=L.let("dataType",(0,o._)`typeof ${P}`),X=L.let("coerced",(0,o._)`undefined`);Y.coerceTypes==="array"&&L.if((0,o._)`${W} == 'object' && Array.isArray(${P}) && ${P}.length == 1`,()=>L.assign(P,(0,o._)`${P}[0]`).assign(W,(0,o._)`typeof ${P}`).if(b(B,P,Y.strictNumbers),()=>L.assign(X,P))),L.if((0,o._)`${X} !== undefined`);for(const z of F)(h.has(z)||z==="array"&&Y.coerceTypes==="array")&&G(z);L.else(),T(x),L.endIf(),L.if((0,o._)`${X} !== undefined`,()=>{L.assign(P,X),m(x,X)});function G(z){switch(z){case"string":L.elseIf((0,o._)`${W} == "number" || ${W} == "boolean"`).assign(X,(0,o._)`"" + ${P}`).elseIf((0,o._)`${P} === null`).assign(X,(0,o._)`""`);return;case"number":L.elseIf((0,o._)`${W} == "boolean" || ${P} === null
72
+ Label: ${((r=n.currentFrame)==null?void 0:r.label)||"none"}`)}}async function _T(e,t){const n=e.command,r=Ie.commands[n.commandType];if(r){const o={args:[],options:{},operator:n.operator,staticOptions:n.staticOptions,code:e.code,commandType:n.commandType,fileName:e.fileName,line:e.line},a=r.argTypes;o.options={};for(const[s,c]of n.args.entries()){let d;if(Uc(c))d=await ni(c,t);else if(typeof c=="string")if(c.search(Pl)===0)d=nn(c.substring(3));else if(qc(c)){const u=Br(),h=YS(u,c);if(h){const[l,f]=h;d=l[f]}else d=c}else d=c;else d=c;if(o.args.push(d),Array.isArray(a)&&a.length>s){const u=a[s];d!==null&&(o.options[u.name]=d)}}return o}else throw new Error(`${n.commandType} is not a valid command`)}async function ni(e,t){const n=await _T(e,t),r=Ie.commands[n.commandType];if(r)return await r.run(n,t);throw new Error(`${n.commandType} is not a valid command`)}async function bd(e){Yn("onPlayerAnswered");const t=ve(),n=t.popAnswerQueue(),r=t.currentLine;try{if(n){const o=Ie.commands[n.commandType];if(o)return await o.processPlayerAnswer(n,e)}}catch(o){console.error(o),ae(`Error after player answer at ${r.fileName}:${r.line+1} (${r.code}<br /> - Error: ${o}`)}}function bT(){return{baseAssetsPath:"",baseDataPath:"",configPath:"data/config.json",logging:!1,debug:!1,scripts:[],container:"#game-holder"}}class TT extends vs{}const Te=et("main",{state:()=>({ready:!1,playing:!1,errors:[],playTime:{start:0,previousPlaytime:0},saveSlot:"",paused:!1,debugMode:!0,options:{baseAssetsPath:"",baseDataPath:"",configPath:"data/config.json",logging:!1,debug:!1,scripts:[]},loading:{step:"Loading",percentage:.1,loaded:!1},alerts:[],saving:null,listener:new TT,inScript:!1}),actions:{setLoadingStep(e,t){this.loading.step=e,this.loading.percentage=t},gameLoaded(){this.loading.loaded=!0,this.listener.emit("gameLoaded")},async alert(e,t){return new Promise(n=>{this.alerts.push({title:e,text:t,resolver:n,id:zn()})})},closeAlert(e){const t=this.alerts.findIndex(n=>n.id===e);t!==-1&&(this.alerts[t].resolver(),this.alerts.splice(t,1))},startingScript(){mt().onScriptStart(),this.inScript=!0},endingScript(){mt().onScriptEnd(),this.inScript=!1},prepareToPlay(){this.ready=!0,this.startPlaying(),Nt().changeScene("playing")},setSaveSlot(e){this.saveSlot=e,kp(e)},startManualSave(e,t,n){this.saving={name:t,withPrompt:n,resolver:e}},cancelManualSave(){this.saving&&(this.saving.resolver(),this.saving=null)},playerAnswered(e){bd(e)},menuReturn(){Nt().changeScene("start-menu")},createError(e){this.errors.push({text:e,type:"error"})},createWarning(e){this.errors.push({text:e,type:"warning"})},clearErrors(){this.errors=[]},pause(){this.paused=!0},unpause(){this.paused=!1},setOptions(e){this.options=e},startPlaying(){this.playing=!0,this.playTime.start=Date.now()},reset(){this.ready=!1,this.paused=!1,this.playing=!1,this.ready=!0},generateSaveData(){return{playTime:hr(this.playTime.start,this.playTime.previousPlaytime)}},loadSaveData(e){this.playTime.previousPlaytime=e.playTime},exitGame(){window.close()}},getters:{isInGame(e){return Nt().isPlaying},totalPlayTime(e){return hr(e.playTime.start,e.playTime.previousPlaytime)},sessionPlayTime(e){return hr(e.playTime.start,0)},hasCustomContainer(e){return(e.options.container??"")!=="#game-holder"}}});function vT(e,t,n){console.error(`Parser error: ${e.fileName}:${e.currentLine}`,n);const r=`[Parser Error] in <span class="error-filename">${e.fileName}:${t+1}</span> - <b>${n}</b>`;ae(r)}function ae(e,...t){const n=Te();console.error(e,...t),e=e.replace(/[\r\n]/g,`
73
+ <br />`),n.createError(`❌ ${e}`)}function er(e,...t){const n=Te();console.warn(e,...t),e=e.replace(/[\r\n]/g,`
74
+ <br />`),n.createWarning(`⚠️ ${e}`)}const ri=p.Type.Object({screens:p.Type.Union([p.Type.String(),fc]),buttons:p.Type.Optional(p.Type.Union([p.Type.String(),cc])),skills:p.Type.Optional(p.Type.Union([p.Type.String(),yc])),skillChecks:p.Type.Optional(p.Type.Union([p.Type.String(),Ec])),scripts:p.Type.Optional(p.Type.Union([p.Type.String(),ec])),audio:p.Type.Union([p.Type.String(),Rl]),tooltips:p.Type.Optional(p.Type.Union([p.Type.String(),vc])),items:p.Type.Optional(p.Type.Union([p.Type.String(),oc])),achievements:p.Type.Optional(p.Type.Union([p.Type.String(),Cc])),quests:p.Type.Optional(p.Type.Union([p.Type.String(),sc])),characters:p.Type.Union([p.Type.String(),_c]),choices:p.Type.Optional(p.Type.Union([p.Type.String(),Ic])),animations:p.Type.Optional(p.Type.Union([p.Type.String(),jc])),macros:p.Type.Optional(Dc),preload:p.Type.Optional(Mc)}),Fs=p.Type.Intersect([ri,p.Type.Object({common:tc})]),Vs=p.Type.Intersect([ri,p.Type.Object({baseAssetsPath:p.Type.Optional(p.Type.String()),baseDataPath:p.Type.Optional(p.Type.String()),gameTitle:p.Type.String(),saveFileName:p.Type.String(),images:p.Type.Optional(p.Type.Record(p.Type.String(),p.Type.String())),layout:Vl,settings:p.Type.Optional(ql),gameFlow:p.Type.Optional(p.Type.Object({labelToJumpOnScriptEnd:p.Type.Optional(p.Type.String())})),dialogPanel:p.Type.Optional(Kl),splashScreens:p.Type.Optional(Gl),notifications:p.Type.Optional(zl),hudStats:Wl,interactionTags:p.Type.Optional(Ql),transitions:p.Type.Optional(Yl),menuButtons:p.Type.Optional(Jl),debugging:p.Type.Optional(Xl),saves:p.Type.Optional(Zl)})]),Us=p.Type.Union([Fs,Vs]);function oi(e){return"common"in e}var qs={exports:{}},Td={},Yt={},Er={},ao={},Pe={},lo={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class n extends t{constructor(I){if(super(),!e.IDENTIFIER.test(I))throw new Error("CodeGen: name must be a valid identifier");this.str=I}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=n;class r extends t{constructor(I){super(),this._items=typeof I=="string"?[I]:I}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const I=this._items[0];return I===""||I==='""'}get str(){var I;return(I=this._str)!==null&&I!==void 0?I:this._str=this._items.reduce((D,R)=>`${D}${R}`,"")}get names(){var I;return(I=this._names)!==null&&I!==void 0?I:this._names=this._items.reduce((D,R)=>(R instanceof n&&(D[R.str]=(D[R.str]||0)+1),D),{})}}e._Code=r,e.nil=new r("");function o(T,...I){const D=[T[0]];let R=0;for(;R<I.length;)c(D,I[R]),D.push(T[++R]);return new r(D)}e._=o;const a=new r("+");function s(T,...I){const D=[m(T[0])];let R=0;for(;R<I.length;)D.push(a),c(D,I[R]),D.push(a,m(T[++R]));return d(D),new r(D)}e.str=s;function c(T,I){I instanceof r?T.push(...I._items):I instanceof n?T.push(I):T.push(l(I))}e.addCodeArg=c;function d(T){let I=1;for(;I<T.length-1;){if(T[I]===a){const D=u(T[I-1],T[I+1]);if(D!==void 0){T.splice(I-1,3,D);continue}T[I++]="+"}I++}}function u(T,I){if(I==='""')return T;if(T==='""')return I;if(typeof T=="string")return I instanceof n||T[T.length-1]!=='"'?void 0:typeof I!="string"?`${T.slice(0,-1)}${I}"`:I[0]==='"'?T.slice(0,-1)+I.slice(1):void 0;if(typeof I=="string"&&I[0]==='"'&&!(T instanceof n))return`"${T}${I.slice(1)}`}function h(T,I){return I.emptyStr()?T:T.emptyStr()?I:s`${T}${I}`}e.strConcat=h;function l(T){return typeof T=="number"||typeof T=="boolean"||T===null?T:m(Array.isArray(T)?T.join(","):T)}function f(T){return new r(m(T))}e.stringify=f;function m(T){return JSON.stringify(T).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=m;function y(T){return typeof T=="string"&&e.IDENTIFIER.test(T)?new r(`.${T}`):o`[${T}]`}e.getProperty=y;function b(T){if(typeof T=="string"&&e.IDENTIFIER.test(T))return new r(`${T}`);throw new Error(`CodeGen: invalid export name: ${T}, use explicit $id name mapping`)}e.getEsmExportName=b;function S(T){return new r(T.toString())}e.regexpCode=S})(lo);var Hs={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=lo;class n extends Error{constructor(u){super(`CodeGen: "code" for ${u} not defined`),this.value=u.value}}var r;(function(d){d[d.Started=0]="Started",d[d.Completed=1]="Completed"})(r=e.UsedValueState||(e.UsedValueState={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class o{constructor({prefixes:u,parent:h}={}){this._names={},this._prefixes=u,this._parent=h}toName(u){return u instanceof t.Name?u:this.name(u)}name(u){return new t.Name(this._newName(u))}_newName(u){const h=this._names[u]||this._nameGroup(u);return`${u}${h.index++}`}_nameGroup(u){var h,l;if(!((l=(h=this._parent)===null||h===void 0?void 0:h._prefixes)===null||l===void 0)&&l.has(u)||this._prefixes&&!this._prefixes.has(u))throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);return this._names[u]={prefix:u,index:0}}}e.Scope=o;class a extends t.Name{constructor(u,h){super(h),this.prefix=u}setValue(u,{property:h,itemIndex:l}){this.value=u,this.scopePath=(0,t._)`.${new t.Name(h)}[${l}]`}}e.ValueScopeName=a;const s=(0,t._)`\n`;class c extends o{constructor(u){super(u),this._values={},this._scope=u.scope,this.opts={...u,_n:u.lines?s:t.nil}}get(){return this._scope}name(u){return new a(u,this._newName(u))}value(u,h){var l;if(h.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const f=this.toName(u),{prefix:m}=f,y=(l=h.key)!==null&&l!==void 0?l:h.ref;let b=this._values[m];if(b){const I=b.get(y);if(I)return I}else b=this._values[m]=new Map;b.set(y,f);const S=this._scope[m]||(this._scope[m]=[]),T=S.length;return S[T]=h.ref,f.setValue(h,{property:m,itemIndex:T}),f}getValue(u,h){const l=this._values[u];if(l)return l.get(h)}scopeRefs(u,h=this._values){return this._reduceValues(h,l=>{if(l.scopePath===void 0)throw new Error(`CodeGen: name "${l}" has no value`);return(0,t._)`${u}${l.scopePath}`})}scopeCode(u=this._values,h,l){return this._reduceValues(u,f=>{if(f.value===void 0)throw new Error(`CodeGen: name "${f}" has no value`);return f.value.code},h,l)}_reduceValues(u,h,l={},f){let m=t.nil;for(const y in u){const b=u[y];if(!b)continue;const S=l[y]=l[y]||new Map;b.forEach(T=>{if(S.has(T))return;S.set(T,r.Started);let I=h(T);if(I){const D=this.opts.es5?e.varKinds.var:e.varKinds.const;m=(0,t._)`${m}${D} ${T} = ${I};${this.opts._n}`}else if(I=f==null?void 0:f(T))m=(0,t._)`${m}${I}${this.opts._n}`;else throw new n(T);S.set(T,r.Completed)})}return m}}e.ValueScope=c})(Hs),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=lo,n=Hs;var r=lo;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}});var o=Hs;Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class a{optimizeNodes(){return this}optimizeNames(_,v){return this}}class s extends a{constructor(_,v,C){super(),this.varKind=_,this.name=v,this.rhs=C}render({es5:_,_n:v}){const C=_?n.varKinds.var:this.varKind,M=this.rhs===void 0?"":` = ${this.rhs}`;return`${C} ${this.name}${M};`+v}optimizeNames(_,v){if(_[this.name.str])return this.rhs&&(this.rhs=te(this.rhs,_,v)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class c extends a{constructor(_,v,C){super(),this.lhs=_,this.rhs=v,this.sideEffects=C}render({_n:_}){return`${this.lhs} = ${this.rhs};`+_}optimizeNames(_,v){if(!(this.lhs instanceof t.Name&&!_[this.lhs.str]&&!this.sideEffects))return this.rhs=te(this.rhs,_,v),this}get names(){const _=this.lhs instanceof t.Name?{}:{...this.lhs.names};return Q(_,this.rhs)}}class d extends c{constructor(_,v,C,M){super(_,C,M),this.op=v}render({_n:_}){return`${this.lhs} ${this.op}= ${this.rhs};`+_}}class u extends a{constructor(_){super(),this.label=_,this.names={}}render({_n:_}){return`${this.label}:`+_}}class h extends a{constructor(_){super(),this.label=_,this.names={}}render({_n:_}){return`break${this.label?` ${this.label}`:""};`+_}}class l extends a{constructor(_){super(),this.error=_}render({_n:_}){return`throw ${this.error};`+_}get names(){return this.error.names}}class f extends a{constructor(_){super(),this.code=_}render({_n:_}){return`${this.code};`+_}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(_,v){return this.code=te(this.code,_,v),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class m extends a{constructor(_=[]){super(),this.nodes=_}render(_){return this.nodes.reduce((v,C)=>v+C.render(_),"")}optimizeNodes(){const{nodes:_}=this;let v=_.length;for(;v--;){const C=_[v].optimizeNodes();Array.isArray(C)?_.splice(v,1,...C):C?_[v]=C:_.splice(v,1)}return _.length>0?this:void 0}optimizeNames(_,v){const{nodes:C}=this;let M=C.length;for(;M--;){const U=C[M];U.optimizeNames(_,v)||(ke(_,U.names),C.splice(M,1))}return C.length>0?this:void 0}get names(){return this.nodes.reduce((_,v)=>z(_,v.names),{})}}class y extends m{render(_){return"{"+_._n+super.render(_)+"}"+_._n}}class b extends m{}class S extends y{}S.kind="else";class T extends y{constructor(_,v){super(v),this.condition=_}render(_){let v=`if(${this.condition})`+super.render(_);return this.else&&(v+="else "+this.else.render(_)),v}optimizeNodes(){super.optimizeNodes();const _=this.condition;if(_===!0)return this.nodes;let v=this.else;if(v){const C=v.optimizeNodes();v=this.else=Array.isArray(C)?new S(C):C}if(v)return _===!1?v instanceof T?v:v.nodes:this.nodes.length?this:new T(Ne(_),v instanceof T?[v]:v.nodes);if(!(_===!1||!this.nodes.length))return this}optimizeNames(_,v){var C;if(this.else=(C=this.else)===null||C===void 0?void 0:C.optimizeNames(_,v),!!(super.optimizeNames(_,v)||this.else))return this.condition=te(this.condition,_,v),this}get names(){const _=super.names;return Q(_,this.condition),this.else&&z(_,this.else.names),_}}T.kind="if";class I extends y{}I.kind="for";class D extends I{constructor(_){super(),this.iteration=_}render(_){return`for(${this.iteration})`+super.render(_)}optimizeNames(_,v){if(super.optimizeNames(_,v))return this.iteration=te(this.iteration,_,v),this}get names(){return z(super.names,this.iteration.names)}}class R extends I{constructor(_,v,C,M){super(),this.varKind=_,this.name=v,this.from=C,this.to=M}render(_){const v=_.es5?n.varKinds.var:this.varKind,{name:C,from:M,to:U}=this;return`for(${v} ${C}=${M}; ${C}<${U}; ${C}++)`+super.render(_)}get names(){const _=Q(super.names,this.from);return Q(_,this.to)}}class F extends I{constructor(_,v,C,M){super(),this.loop=_,this.varKind=v,this.name=C,this.iterable=M}render(_){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(_)}optimizeNames(_,v){if(super.optimizeNames(_,v))return this.iterable=te(this.iterable,_,v),this}get names(){return z(super.names,this.iterable.names)}}class L extends y{constructor(_,v,C){super(),this.name=_,this.args=v,this.async=C}render(_){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(_)}}L.kind="func";class P extends m{render(_){return"return "+super.render(_)}}P.kind="return";class Y extends y{render(_){let v="try"+super.render(_);return this.catch&&(v+=this.catch.render(_)),this.finally&&(v+=this.finally.render(_)),v}optimizeNodes(){var _,v;return super.optimizeNodes(),(_=this.catch)===null||_===void 0||_.optimizeNodes(),(v=this.finally)===null||v===void 0||v.optimizeNodes(),this}optimizeNames(_,v){var C,M;return super.optimizeNames(_,v),(C=this.catch)===null||C===void 0||C.optimizeNames(_,v),(M=this.finally)===null||M===void 0||M.optimizeNames(_,v),this}get names(){const _=super.names;return this.catch&&z(_,this.catch.names),this.finally&&z(_,this.finally.names),_}}class W extends y{constructor(_){super(),this.error=_}render(_){return`catch(${this.error})`+super.render(_)}}W.kind="catch";class X extends y{render(_){return"finally"+super.render(_)}}X.kind="finally";class G{constructor(_,v={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...v,_n:v.lines?`
75
+ `:""},this._extScope=_,this._scope=new n.Scope({parent:_}),this._nodes=[new b]}toString(){return this._root.render(this.opts)}name(_){return this._scope.name(_)}scopeName(_){return this._extScope.name(_)}scopeValue(_,v){const C=this._extScope.value(_,v);return(this._values[C.prefix]||(this._values[C.prefix]=new Set)).add(C),C}getScopeValue(_,v){return this._extScope.getValue(_,v)}scopeRefs(_){return this._extScope.scopeRefs(_,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(_,v,C,M){const U=this._scope.toName(v);return C!==void 0&&M&&(this._constants[U.str]=C),this._leafNode(new s(_,U,C)),U}const(_,v,C){return this._def(n.varKinds.const,_,v,C)}let(_,v,C){return this._def(n.varKinds.let,_,v,C)}var(_,v,C){return this._def(n.varKinds.var,_,v,C)}assign(_,v,C){return this._leafNode(new c(_,v,C))}add(_,v){return this._leafNode(new d(_,e.operators.ADD,v))}code(_){return typeof _=="function"?_():_!==t.nil&&this._leafNode(new f(_)),this}object(..._){const v=["{"];for(const[C,M]of _)v.length>1&&v.push(","),v.push(C),(C!==M||this.opts.es5)&&(v.push(":"),(0,t.addCodeArg)(v,M));return v.push("}"),new t._Code(v)}if(_,v,C){if(this._blockNode(new T(_)),v&&C)this.code(v).else().code(C).endIf();else if(v)this.code(v).endIf();else if(C)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(_){return this._elseNode(new T(_))}else(){return this._elseNode(new S)}endIf(){return this._endBlockNode(T,S)}_for(_,v){return this._blockNode(_),v&&this.code(v).endFor(),this}for(_,v){return this._for(new D(_),v)}forRange(_,v,C,M,U=this.opts.es5?n.varKinds.var:n.varKinds.let){const ne=this._scope.toName(_);return this._for(new R(U,ne,v,C),()=>M(ne))}forOf(_,v,C,M=n.varKinds.const){const U=this._scope.toName(_);if(this.opts.es5){const ne=v instanceof t.Name?v:this.var("_arr",v);return this.forRange("_i",0,(0,t._)`${ne}.length`,ee=>{this.var(U,(0,t._)`${ne}[${ee}]`),C(U)})}return this._for(new F("of",M,U,v),()=>C(U))}forIn(_,v,C,M=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(_,(0,t._)`Object.keys(${v})`,C);const U=this._scope.toName(_);return this._for(new F("in",M,U,v),()=>C(U))}endFor(){return this._endBlockNode(I)}label(_){return this._leafNode(new u(_))}break(_){return this._leafNode(new h(_))}return(_){const v=new P;if(this._blockNode(v),this.code(_),v.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(P)}try(_,v,C){if(!v&&!C)throw new Error('CodeGen: "try" without "catch" and "finally"');const M=new Y;if(this._blockNode(M),this.code(_),v){const U=this.name("e");this._currNode=M.catch=new W(U),v(U)}return C&&(this._currNode=M.finally=new X,this.code(C)),this._endBlockNode(W,X)}throw(_){return this._leafNode(new l(_))}block(_,v){return this._blockStarts.push(this._nodes.length),_&&this.code(_).endBlock(v),this}endBlock(_){const v=this._blockStarts.pop();if(v===void 0)throw new Error("CodeGen: not in self-balancing block");const C=this._nodes.length-v;if(C<0||_!==void 0&&C!==_)throw new Error(`CodeGen: wrong number of nodes: ${C} vs ${_} expected`);return this._nodes.length=v,this}func(_,v=t.nil,C,M){return this._blockNode(new L(_,v,C)),M&&this.code(M).endFunc(),this}endFunc(){return this._endBlockNode(L)}optimize(_=1){for(;_-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(_){return this._currNode.nodes.push(_),this}_blockNode(_){this._currNode.nodes.push(_),this._nodes.push(_)}_endBlockNode(_,v){const C=this._currNode;if(C instanceof _||v&&C instanceof v)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${v?`${_.kind}/${v.kind}`:_.kind}"`)}_elseNode(_){const v=this._currNode;if(!(v instanceof T))throw new Error('CodeGen: "else" without "if"');return this._currNode=v.else=_,this}get _root(){return this._nodes[0]}get _currNode(){const _=this._nodes;return _[_.length-1]}set _currNode(_){const v=this._nodes;v[v.length-1]=_}}e.CodeGen=G;function z($,_){for(const v in _)$[v]=($[v]||0)+(_[v]||0);return $}function Q($,_){return _ instanceof t._CodeOrName?z($,_.names):$}function te($,_,v){if($ instanceof t.Name)return C($);if(!M($))return $;return new t._Code($._items.reduce((U,ne)=>(ne instanceof t.Name&&(ne=C(ne)),ne instanceof t._Code?U.push(...ne._items):U.push(ne),U),[]));function C(U){const ne=v[U.str];return ne===void 0||_[U.str]!==1?U:(delete _[U.str],ne)}function M(U){return U instanceof t._Code&&U._items.some(ne=>ne instanceof t.Name&&_[ne.str]===1&&v[ne.str]!==void 0)}}function ke($,_){for(const v in _)$[v]=($[v]||0)-(_[v]||0)}function Ne($){return typeof $=="boolean"||typeof $=="number"||$===null?!$:(0,t._)`!${E($)}`}e.not=Ne;const Ze=g(e.operators.AND);function qe(...$){return $.reduce(Ze)}e.and=qe;const nt=g(e.operators.OR);function j(...$){return $.reduce(nt)}e.or=j;function g($){return(_,v)=>_===t.nil?v:v===t.nil?_:(0,t._)`${E(_)} ${$} ${E(v)}`}function E($){return $ instanceof t.Name?$:(0,t._)`(${$})`}}(Pe);var Me={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;const t=Pe,n=lo;function r(L){const P={};for(const Y of L)P[Y]=!0;return P}e.toHash=r;function o(L,P){return typeof P=="boolean"?P:Object.keys(P).length===0?!0:(a(L,P),!s(P,L.self.RULES.all))}e.alwaysValidSchema=o;function a(L,P=L.schema){const{opts:Y,self:W}=L;if(!Y.strictSchema||typeof P=="boolean")return;const X=W.RULES.keywords;for(const G in P)X[G]||F(L,`unknown keyword: "${G}"`)}e.checkUnknownRules=a;function s(L,P){if(typeof L=="boolean")return!L;for(const Y in L)if(P[Y])return!0;return!1}e.schemaHasRules=s;function c(L,P){if(typeof L=="boolean")return!L;for(const Y in L)if(Y!=="$ref"&&P.all[Y])return!0;return!1}e.schemaHasRulesButRef=c;function d({topSchemaRef:L,schemaPath:P},Y,W,X){if(!X){if(typeof Y=="number"||typeof Y=="boolean")return Y;if(typeof Y=="string")return(0,t._)`${Y}`}return(0,t._)`${L}${P}${(0,t.getProperty)(W)}`}e.schemaRefOrVal=d;function u(L){return f(decodeURIComponent(L))}e.unescapeFragment=u;function h(L){return encodeURIComponent(l(L))}e.escapeFragment=h;function l(L){return typeof L=="number"?`${L}`:L.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=l;function f(L){return L.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=f;function m(L,P){if(Array.isArray(L))for(const Y of L)P(Y);else P(L)}e.eachItem=m;function y({mergeNames:L,mergeToName:P,mergeValues:Y,resultToName:W}){return(X,G,z,Q)=>{const te=z===void 0?G:z instanceof t.Name?(G instanceof t.Name?L(X,G,z):P(X,G,z),z):G instanceof t.Name?(P(X,z,G),G):Y(G,z);return Q===t.Name&&!(te instanceof t.Name)?W(X,te):te}}e.mergeEvaluated={props:y({mergeNames:(L,P,Y)=>L.if((0,t._)`${Y} !== true && ${P} !== undefined`,()=>{L.if((0,t._)`${P} === true`,()=>L.assign(Y,!0),()=>L.assign(Y,(0,t._)`${Y} || {}`).code((0,t._)`Object.assign(${Y}, ${P})`))}),mergeToName:(L,P,Y)=>L.if((0,t._)`${Y} !== true`,()=>{P===!0?L.assign(Y,!0):(L.assign(Y,(0,t._)`${Y} || {}`),S(L,Y,P))}),mergeValues:(L,P)=>L===!0?!0:{...L,...P},resultToName:b}),items:y({mergeNames:(L,P,Y)=>L.if((0,t._)`${Y} !== true && ${P} !== undefined`,()=>L.assign(Y,(0,t._)`${P} === true ? true : ${Y} > ${P} ? ${Y} : ${P}`)),mergeToName:(L,P,Y)=>L.if((0,t._)`${Y} !== true`,()=>L.assign(Y,P===!0?!0:(0,t._)`${Y} > ${P} ? ${Y} : ${P}`)),mergeValues:(L,P)=>L===!0?!0:Math.max(L,P),resultToName:(L,P)=>L.var("items",P)})};function b(L,P){if(P===!0)return L.var("props",!0);const Y=L.var("props",(0,t._)`{}`);return P!==void 0&&S(L,Y,P),Y}e.evaluatedPropsToName=b;function S(L,P,Y){Object.keys(Y).forEach(W=>L.assign((0,t._)`${P}${(0,t.getProperty)(W)}`,!0))}e.setEvaluated=S;const T={};function I(L,P){return L.scopeValue("func",{ref:P,code:T[P.code]||(T[P.code]=new n._Code(P.code))})}e.useFunc=I;var D;(function(L){L[L.Num=0]="Num",L[L.Str=1]="Str"})(D=e.Type||(e.Type={}));function R(L,P,Y){if(L instanceof t.Name){const W=P===D.Num;return Y?W?(0,t._)`"[" + ${L} + "]"`:(0,t._)`"['" + ${L} + "']"`:W?(0,t._)`"/" + ${L}`:(0,t._)`"/" + ${L}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return Y?(0,t.getProperty)(L).toString():"/"+l(L)}e.getErrorPath=R;function F(L,P,Y=L.opts.strictSchema){if(Y){if(P=`strict mode: ${P}`,Y===!0)throw new Error(P);L.self.logger.warn(P)}}e.checkStrictMode=F})(Me);var ln={};Object.defineProperty(ln,"__esModule",{value:!0});const St=Pe,ST={data:new St.Name("data"),valCxt:new St.Name("valCxt"),instancePath:new St.Name("instancePath"),parentData:new St.Name("parentData"),parentDataProperty:new St.Name("parentDataProperty"),rootData:new St.Name("rootData"),dynamicAnchors:new St.Name("dynamicAnchors"),vErrors:new St.Name("vErrors"),errors:new St.Name("errors"),this:new St.Name("this"),self:new St.Name("self"),scope:new St.Name("scope"),json:new St.Name("json"),jsonPos:new St.Name("jsonPos"),jsonLen:new St.Name("jsonLen"),jsonPart:new St.Name("jsonPart")};ln.default=ST,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=Pe,n=Me,r=ln;e.keywordError={message:({keyword:S})=>(0,t.str)`must pass "${S}" keyword validation`},e.keyword$DataError={message:({keyword:S,schemaType:T})=>T?(0,t.str)`"${S}" keyword must be ${T} ($data)`:(0,t.str)`"${S}" keyword is invalid ($data)`};function o(S,T=e.keywordError,I,D){const{it:R}=S,{gen:F,compositeRule:L,allErrors:P}=R,Y=l(S,T,I);D??(L||P)?d(F,Y):u(R,(0,t._)`[${Y}]`)}e.reportError=o;function a(S,T=e.keywordError,I){const{it:D}=S,{gen:R,compositeRule:F,allErrors:L}=D,P=l(S,T,I);d(R,P),F||L||u(D,r.default.vErrors)}e.reportExtraError=a;function s(S,T){S.assign(r.default.errors,T),S.if((0,t._)`${r.default.vErrors} !== null`,()=>S.if(T,()=>S.assign((0,t._)`${r.default.vErrors}.length`,T),()=>S.assign(r.default.vErrors,null)))}e.resetErrorsCount=s;function c({gen:S,keyword:T,schemaValue:I,data:D,errsCount:R,it:F}){if(R===void 0)throw new Error("ajv implementation error");const L=S.name("err");S.forRange("i",R,r.default.errors,P=>{S.const(L,(0,t._)`${r.default.vErrors}[${P}]`),S.if((0,t._)`${L}.instancePath === undefined`,()=>S.assign((0,t._)`${L}.instancePath`,(0,t.strConcat)(r.default.instancePath,F.errorPath))),S.assign((0,t._)`${L}.schemaPath`,(0,t.str)`${F.errSchemaPath}/${T}`),F.opts.verbose&&(S.assign((0,t._)`${L}.schema`,I),S.assign((0,t._)`${L}.data`,D))})}e.extendErrors=c;function d(S,T){const I=S.const("err",T);S.if((0,t._)`${r.default.vErrors} === null`,()=>S.assign(r.default.vErrors,(0,t._)`[${I}]`),(0,t._)`${r.default.vErrors}.push(${I})`),S.code((0,t._)`${r.default.errors}++`)}function u(S,T){const{gen:I,validateName:D,schemaEnv:R}=S;R.$async?I.throw((0,t._)`new ${S.ValidationError}(${T})`):(I.assign((0,t._)`${D}.errors`,T),I.return(!1))}const h={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function l(S,T,I){const{createErrors:D}=S.it;return D===!1?(0,t._)`{}`:f(S,T,I)}function f(S,T,I={}){const{gen:D,it:R}=S,F=[m(R,I),y(S,I)];return b(S,T,F),D.object(...F)}function m({errorPath:S},{instancePath:T}){const I=T?(0,t.str)`${S}${(0,n.getErrorPath)(T,n.Type.Str)}`:S;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,I)]}function y({keyword:S,it:{errSchemaPath:T}},{schemaPath:I,parentSchema:D}){let R=D?T:(0,t.str)`${T}/${S}`;return I&&(R=(0,t.str)`${R}${(0,n.getErrorPath)(I,n.Type.Str)}`),[h.schemaPath,R]}function b(S,{params:T,message:I},D){const{keyword:R,data:F,schemaValue:L,it:P}=S,{opts:Y,propertyName:W,topSchemaRef:X,schemaPath:G}=P;D.push([h.keyword,R],[h.params,typeof T=="function"?T(S):T||(0,t._)`{}`]),Y.messages&&D.push([h.message,typeof I=="function"?I(S):I]),Y.verbose&&D.push([h.schema,L],[h.parentSchema,(0,t._)`${X}${G}`],[r.default.data,F]),W&&D.push([h.propertyName,W])}}(ao),Object.defineProperty(Er,"__esModule",{value:!0}),Er.boolOrEmptySchema=Er.topBoolOrEmptySchema=void 0;const wT=ao,kT=Pe,CT=ln,$T={message:"boolean schema is false"};function ET(e){const{gen:t,schema:n,validateName:r}=e;n===!1?vd(e,!1):typeof n=="object"&&n.$async===!0?t.return(CT.default.data):(t.assign((0,kT._)`${r}.errors`,null),t.return(!0))}Er.topBoolOrEmptySchema=ET;function OT(e,t){const{gen:n,schema:r}=e;r===!1?(n.var(t,!1),vd(e)):n.var(t,!0)}Er.boolOrEmptySchema=OT;function vd(e,t){const{gen:n,data:r}=e,o={gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,wT.reportError)(o,$T,void 0,t)}var co={},tr={};Object.defineProperty(tr,"__esModule",{value:!0}),tr.getRules=tr.isJSONType=void 0;const AT=["string","number","integer","boolean","null","object","array"],IT=new Set(AT);function NT(e){return typeof e=="string"&&IT.has(e)}tr.isJSONType=NT;function PT(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}tr.getRules=PT;var wn={};Object.defineProperty(wn,"__esModule",{value:!0}),wn.shouldUseRule=wn.shouldUseGroup=wn.schemaHasRulesForType=void 0;function jT({schema:e,self:t},n){const r=t.RULES.types[n];return r&&r!==!0&&Sd(e,r)}wn.schemaHasRulesForType=jT;function Sd(e,t){return t.rules.some(n=>wd(e,n))}wn.shouldUseGroup=Sd;function wd(e,t){var n;return e[t.keyword]!==void 0||((n=t.definition.implements)===null||n===void 0?void 0:n.some(r=>e[r]!==void 0))}wn.shouldUseRule=wd,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;const t=tr,n=wn,r=ao,o=Pe,a=Me;var s;(function(D){D[D.Correct=0]="Correct",D[D.Wrong=1]="Wrong"})(s=e.DataType||(e.DataType={}));function c(D){const R=d(D.type);if(R.includes("null")){if(D.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!R.length&&D.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');D.nullable===!0&&R.push("null")}return R}e.getSchemaTypes=c;function d(D){const R=Array.isArray(D)?D:D?[D]:[];if(R.every(t.isJSONType))return R;throw new Error("type must be JSONType or JSONType[]: "+R.join(","))}e.getJSONTypes=d;function u(D,R){const{gen:F,data:L,opts:P}=D,Y=l(R,P.coerceTypes),W=R.length>0&&!(Y.length===0&&R.length===1&&(0,n.schemaHasRulesForType)(D,R[0]));if(W){const X=b(R,L,P.strictNumbers,s.Wrong);F.if(X,()=>{Y.length?f(D,R,Y):T(D)})}return W}e.coerceAndCheckDataType=u;const h=new Set(["string","number","integer","boolean","null"]);function l(D,R){return R?D.filter(F=>h.has(F)||R==="array"&&F==="array"):[]}function f(D,R,F){const{gen:L,data:P,opts:Y}=D,W=L.let("dataType",(0,o._)`typeof ${P}`),X=L.let("coerced",(0,o._)`undefined`);Y.coerceTypes==="array"&&L.if((0,o._)`${W} == 'object' && Array.isArray(${P}) && ${P}.length == 1`,()=>L.assign(P,(0,o._)`${P}[0]`).assign(W,(0,o._)`typeof ${P}`).if(b(R,P,Y.strictNumbers),()=>L.assign(X,P))),L.if((0,o._)`${X} !== undefined`);for(const z of F)(h.has(z)||z==="array"&&Y.coerceTypes==="array")&&G(z);L.else(),T(D),L.endIf(),L.if((0,o._)`${X} !== undefined`,()=>{L.assign(P,X),m(D,X)});function G(z){switch(z){case"string":L.elseIf((0,o._)`${W} == "number" || ${W} == "boolean"`).assign(X,(0,o._)`"" + ${P}`).elseIf((0,o._)`${P} === null`).assign(X,(0,o._)`""`);return;case"number":L.elseIf((0,o._)`${W} == "boolean" || ${P} === null
76
76
  || (${W} == "string" && ${P} && ${P} == +${P})`).assign(X,(0,o._)`+${P}`);return;case"integer":L.elseIf((0,o._)`${W} === "boolean" || ${P} === null
77
77
  || (${W} === "string" && ${P} && ${P} == +${P} && !(${P} % 1))`).assign(X,(0,o._)`+${P}`);return;case"boolean":L.elseIf((0,o._)`${P} === "false" || ${P} === 0 || ${P} === null`).assign(X,!1).elseIf((0,o._)`${P} === "true" || ${P} === 1`).assign(X,!0);return;case"null":L.elseIf((0,o._)`${P} === "" || ${P} === 0 || ${P} === false`),L.assign(X,null);return;case"array":L.elseIf((0,o._)`${W} === "string" || ${W} === "number"
78
- || ${W} === "boolean" || ${P} === null`).assign(X,(0,o._)`[${P}]`)}}}function m({gen:x,parentData:B,parentDataProperty:F},L){x.if((0,o._)`${B} !== undefined`,()=>x.assign((0,o._)`${B}[${F}]`,L))}function y(x,B,F,L=s.Correct){const P=L===s.Correct?o.operators.EQ:o.operators.NEQ;let Y;switch(x){case"null":return(0,o._)`${B} ${P} null`;case"array":Y=(0,o._)`Array.isArray(${B})`;break;case"object":Y=(0,o._)`${B} && typeof ${B} == "object" && !Array.isArray(${B})`;break;case"integer":Y=W((0,o._)`!(${B} % 1) && !isNaN(${B})`);break;case"number":Y=W();break;default:return(0,o._)`typeof ${B} ${P} ${x}`}return L===s.Correct?Y:(0,o.not)(Y);function W(X=o.nil){return(0,o.and)((0,o._)`typeof ${B} == "number"`,X,F?(0,o._)`isFinite(${B})`:o.nil)}}e.checkDataType=y;function b(x,B,F,L){if(x.length===1)return y(x[0],B,F,L);let P;const Y=(0,a.toHash)(x);if(Y.array&&Y.object){const W=(0,o._)`typeof ${B} != "object"`;P=Y.null?W:(0,o._)`!${B} || ${W}`,delete Y.null,delete Y.array,delete Y.object}else P=o.nil;Y.number&&delete Y.integer;for(const W in Y)P=(0,o.and)(P,y(W,B,F,L));return P}e.checkDataTypes=b;const S={message:({schema:x})=>`must be ${x}`,params:({schema:x,schemaValue:B})=>typeof x=="string"?(0,o._)`{type: ${x}}`:(0,o._)`{type: ${B}}`};function T(x){const B=I(x);(0,r.reportError)(B,S)}e.reportTypeError=T;function I(x){const{gen:B,data:F,schema:L}=x,P=(0,a.schemaRefOrVal)(x,L,"type");return{gen:B,keyword:"type",data:F,schema:L.type,schemaCode:P,schemaValue:P,parentSchema:L,params:{},it:x}}}(lo);var ri={};Object.defineProperty(ri,"__esModule",{value:!0}),ri.assignDefaults=void 0;const Er=Pe,NT=Me;function PT(e,t){const{properties:n,items:r}=e.schema;if(t==="object"&&n)for(const o in n)vd(e,o,n[o].default);else t==="array"&&Array.isArray(r)&&r.forEach((o,a)=>vd(e,a,o.default))}ri.assignDefaults=PT;function vd(e,t,n){const{gen:r,compositeRule:o,data:a,opts:s}=e;if(n===void 0)return;const c=(0,Er._)`${a}${(0,Er.getProperty)(t)}`;if(o){(0,NT.checkStrictMode)(e,`default is ignored for: ${c}`);return}let d=(0,Er._)`${c} === undefined`;s.useDefaults==="empty"&&(d=(0,Er._)`${d} || ${c} === null || ${c} === ""`),r.if(d,(0,Er._)`${c} = ${(0,Er.stringify)(n)}`)}var cn={},je={};Object.defineProperty(je,"__esModule",{value:!0}),je.validateUnion=je.validateArray=je.usePattern=je.callValidateCode=je.schemaProperties=je.allSchemaProperties=je.noPropertyInData=je.propertyInData=je.isOwnProperty=je.hasPropFunc=je.reportMissingProp=je.checkMissingProp=je.checkReportMissingProp=void 0;const ze=Pe,Hs=Me,Ln=ln,jT=Me;function DT(e,t){const{gen:n,data:r,it:o}=e;n.if(Gs(n,r,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ze._)`${t}`},!0),e.error()})}je.checkReportMissingProp=DT;function xT({gen:e,data:t,it:{opts:n}},r,o){return(0,ze.or)(...r.map(a=>(0,ze.and)(Gs(e,t,a,n.ownProperties),(0,ze._)`${o} = ${a}`)))}je.checkMissingProp=xT;function LT(e,t){e.setParams({missingProperty:t},!0),e.error()}je.reportMissingProp=LT;function Sd(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ze._)`Object.prototype.hasOwnProperty`})}je.hasPropFunc=Sd;function Ks(e,t,n){return(0,ze._)`${Sd(e)}.call(${t}, ${n})`}je.isOwnProperty=Ks;function MT(e,t,n,r){const o=(0,ze._)`${t}${(0,ze.getProperty)(n)} !== undefined`;return r?(0,ze._)`${o} && ${Ks(e,t,n)}`:o}je.propertyInData=MT;function Gs(e,t,n,r){const o=(0,ze._)`${t}${(0,ze.getProperty)(n)} === undefined`;return r?(0,ze.or)(o,(0,ze.not)(Ks(e,t,n))):o}je.noPropertyInData=Gs;function wd(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}je.allSchemaProperties=wd;function RT(e,t){return wd(t).filter(n=>!(0,Hs.alwaysValidSchema)(e,t[n]))}je.schemaProperties=RT;function BT({schemaCode:e,data:t,it:{gen:n,topSchemaRef:r,schemaPath:o,errorPath:a},it:s},c,d,u){const h=u?(0,ze._)`${e}, ${t}, ${r}${o}`:t,l=[[Ln.default.instancePath,(0,ze.strConcat)(Ln.default.instancePath,a)],[Ln.default.parentData,s.parentData],[Ln.default.parentDataProperty,s.parentDataProperty],[Ln.default.rootData,Ln.default.rootData]];s.opts.dynamicRef&&l.push([Ln.default.dynamicAnchors,Ln.default.dynamicAnchors]);const f=(0,ze._)`${h}, ${n.object(...l)}`;return d!==ze.nil?(0,ze._)`${c}.call(${d}, ${f})`:(0,ze._)`${c}(${f})`}je.callValidateCode=BT;const FT=(0,ze._)`new RegExp`;function VT({gen:e,it:{opts:t}},n){const r=t.unicodeRegExp?"u":"",{regExp:o}=t.code,a=o(n,r);return e.scopeValue("pattern",{key:a.toString(),ref:a,code:(0,ze._)`${o.code==="new RegExp"?FT:(0,jT.useFunc)(e,o)}(${n}, ${r})`})}je.usePattern=VT;function UT(e){const{gen:t,data:n,keyword:r,it:o}=e,a=t.name("valid");if(o.allErrors){const c=t.let("valid",!0);return s(()=>t.assign(c,!1)),c}return t.var(a,!0),s(()=>t.break()),a;function s(c){const d=t.const("len",(0,ze._)`${n}.length`);t.forRange("i",0,d,u=>{e.subschema({keyword:r,dataProp:u,dataPropType:Hs.Type.Num},a),t.if((0,ze.not)(a),c)})}}je.validateArray=UT;function qT(e){const{gen:t,schema:n,keyword:r,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(n.some(d=>(0,Hs.alwaysValidSchema)(o,d))&&!o.opts.unevaluated)return;const s=t.let("valid",!1),c=t.name("_valid");t.block(()=>n.forEach((d,u)=>{const h=e.subschema({keyword:r,schemaProp:u,compositeRule:!0},c);t.assign(s,(0,ze._)`${s} || ${c}`),e.mergeValidEvaluated(h,c)||t.if((0,ze.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}je.validateUnion=qT,Object.defineProperty(cn,"__esModule",{value:!0}),cn.validateKeywordUsage=cn.validSchemaType=cn.funcKeywordCode=cn.macroKeywordCode=void 0;const Ct=Pe,tr=ln,HT=je,KT=so;function GT(e,t){const{gen:n,keyword:r,schema:o,parentSchema:a,it:s}=e,c=t.macro.call(s.self,o,a,s),d=Cd(n,r,c);s.opts.validateSchema!==!1&&s.self.validateSchema(c,!0);const u=n.name("valid");e.subschema({schema:c,schemaPath:Ct.nil,errSchemaPath:`${s.errSchemaPath}/${r}`,topSchemaRef:d,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}cn.macroKeywordCode=GT;function zT(e,t){var n;const{gen:r,keyword:o,schema:a,parentSchema:s,$data:c,it:d}=e;QT(d,t);const u=!c&&t.compile?t.compile.call(d.self,a,s,d):t.validate,h=Cd(r,o,u),l=r.let("valid");e.block$data(l,f),e.ok((n=t.valid)!==null&&n!==void 0?n:l);function f(){if(t.errors===!1)b(),t.modifying&&kd(e),S(()=>e.error());else{const T=t.async?m():y();t.modifying&&kd(e),S(()=>WT(e,T))}}function m(){const T=r.let("ruleErrs",null);return r.try(()=>b((0,Ct._)`await `),I=>r.assign(l,!1).if((0,Ct._)`${I} instanceof ${d.ValidationError}`,()=>r.assign(T,(0,Ct._)`${I}.errors`),()=>r.throw(I))),T}function y(){const T=(0,Ct._)`${h}.errors`;return r.assign(T,null),b(Ct.nil),T}function b(T=t.async?(0,Ct._)`await `:Ct.nil){const I=d.opts.passContext?tr.default.this:tr.default.self,x=!("compile"in t&&!c||t.schema===!1);r.assign(l,(0,Ct._)`${T}${(0,HT.callValidateCode)(e,h,I,x)}`,t.modifying)}function S(T){var I;r.if((0,Ct.not)((I=t.valid)!==null&&I!==void 0?I:l),T)}}cn.funcKeywordCode=zT;function kd(e){const{gen:t,data:n,it:r}=e;t.if(r.parentData,()=>t.assign(n,(0,Ct._)`${r.parentData}[${r.parentDataProperty}]`))}function WT(e,t){const{gen:n}=e;n.if((0,Ct._)`Array.isArray(${t})`,()=>{n.assign(tr.default.vErrors,(0,Ct._)`${tr.default.vErrors} === null ? ${t} : ${tr.default.vErrors}.concat(${t})`).assign(tr.default.errors,(0,Ct._)`${tr.default.vErrors}.length`),(0,KT.extendErrors)(e)},()=>e.error())}function QT({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Cd(e,t,n){if(n===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof n=="function"?{ref:n}:{ref:n,code:(0,Ct.stringify)(n)})}function YT(e,t,n=!1){return!t.length||t.some(r=>r==="array"?Array.isArray(e):r==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==r||n&&typeof e>"u")}cn.validSchemaType=YT;function JT({schema:e,opts:t,self:n,errSchemaPath:r},o,a){if(Array.isArray(o.keyword)?!o.keyword.includes(a):o.keyword!==a)throw new Error("ajv implementation error");const s=o.dependencies;if(s!=null&&s.some(c=>!Object.prototype.hasOwnProperty.call(e,c)))throw new Error(`parent schema must have dependencies of ${a}: ${s.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[a])){const d=`keyword "${a}" value is invalid at path "${r}": `+n.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")n.logger.error(d);else throw new Error(d)}}cn.validateKeywordUsage=JT;var Mn={};Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.extendSubschemaMode=Mn.extendSubschemaData=Mn.getSubschema=void 0;const un=Pe,$d=Me;function XT(e,{keyword:t,schemaProp:n,schema:r,schemaPath:o,errSchemaPath:a,topSchemaRef:s}){if(t!==void 0&&r!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){const c=e.schema[t];return n===void 0?{schema:c,schemaPath:(0,un._)`${e.schemaPath}${(0,un.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:c[n],schemaPath:(0,un._)`${e.schemaPath}${(0,un.getProperty)(t)}${(0,un.getProperty)(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,$d.escapeFragment)(n)}`}}if(r!==void 0){if(o===void 0||a===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:r,schemaPath:o,topSchemaRef:s,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')}Mn.getSubschema=XT;function ZT(e,t,{dataProp:n,dataPropType:r,data:o,dataTypes:a,propertyName:s}){if(o!==void 0&&n!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:c}=t;if(n!==void 0){const{errorPath:u,dataPathArr:h,opts:l}=t,f=c.let("data",(0,un._)`${t.data}${(0,un.getProperty)(n)}`,!0);d(f),e.errorPath=(0,un.str)`${u}${(0,$d.getErrorPath)(n,r,l.jsPropertySyntax)}`,e.parentDataProperty=(0,un._)`${n}`,e.dataPathArr=[...h,e.parentDataProperty]}if(o!==void 0){const u=o instanceof un.Name?o:c.let("data",o,!0);d(u),s!==void 0&&(e.propertyName=s)}a&&(e.dataTypes=a);function d(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}Mn.extendSubschemaData=ZT;function ev(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:o,allErrors:a}){r!==void 0&&(e.compositeRule=r),o!==void 0&&(e.createErrors=o),a!==void 0&&(e.allErrors=a),e.jtdDiscriminator=t,e.jtdMetadata=n}Mn.extendSubschemaMode=ev;var yt={},Ed=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,o,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[o]))return!1;for(o=r;o--!==0;){var s=a[o];if(!e(t[s],n[s]))return!1}return!0}return t!==t&&n!==n},Od={exports:{}},Rn=Od.exports=function(e,t,n){typeof t=="function"&&(n=t,t={}),n=t.cb||n;var r=typeof n=="function"?n:n.pre||function(){},o=n.post||function(){};oi(t,r,o,e,"",e)};Rn.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},Rn.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},Rn.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},Rn.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function oi(e,t,n,r,o,a,s,c,d,u){if(r&&typeof r=="object"&&!Array.isArray(r)){t(r,o,a,s,c,d,u);for(var h in r){var l=r[h];if(Array.isArray(l)){if(h in Rn.arrayKeywords)for(var f=0;f<l.length;f++)oi(e,t,n,l[f],o+"/"+h+"/"+f,a,o,h,r,f)}else if(h in Rn.propsKeywords){if(l&&typeof l=="object")for(var m in l)oi(e,t,n,l[m],o+"/"+h+"/"+tv(m),a,o,h,r,m)}else(h in Rn.keywords||e.allKeys&&!(h in Rn.skipKeywords))&&oi(e,t,n,l,o+"/"+h,a,o,h,r)}n(r,o,a,s,c,d,u)}}function tv(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var nv=Od.exports;Object.defineProperty(yt,"__esModule",{value:!0}),yt.getSchemaRefs=yt.resolveUrl=yt.normalizeId=yt._getFullPath=yt.getFullPath=yt.inlineRef=void 0;const rv=Me,ov=Ed,iv=nv,sv=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function av(e,t=!0){return typeof e=="boolean"?!0:t===!0?!zs(e):t?Ad(e)<=t:!1}yt.inlineRef=av;const lv=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function zs(e){for(const t in e){if(lv.has(t))return!0;const n=e[t];if(Array.isArray(n)&&n.some(zs)||typeof n=="object"&&zs(n))return!0}return!1}function Ad(e){let t=0;for(const n in e){if(n==="$ref")return 1/0;if(t++,!sv.has(n)&&(typeof e[n]=="object"&&(0,rv.eachItem)(e[n],r=>t+=Ad(r)),t===1/0))return 1/0}return t}function Id(e,t="",n){n!==!1&&(t=Or(t));const r=e.parse(t);return Nd(e,r)}yt.getFullPath=Id;function Nd(e,t){return e.serialize(t).split("#")[0]+"#"}yt._getFullPath=Nd;const cv=/#\/?$/;function Or(e){return e?e.replace(cv,""):""}yt.normalizeId=Or;function uv(e,t,n){return n=Or(n),e.resolve(t,n)}yt.resolveUrl=uv;const dv=/^[a-z_][-a-z0-9._]*$/i;function fv(e,t){if(typeof e=="boolean")return{};const{schemaId:n,uriResolver:r}=this.opts,o=Or(e[n]||t),a={"":o},s=Id(r,o,!1),c={},d=new Set;return iv(e,{allKeys:!0},(l,f,m,y)=>{if(y===void 0)return;const b=s+f;let S=a[y];typeof l[n]=="string"&&(S=T.call(this,l[n])),I.call(this,l.$anchor),I.call(this,l.$dynamicAnchor),a[f]=S;function T(x){const B=this.opts.uriResolver.resolve;if(x=Or(S?B(S,x):x),d.has(x))throw h(x);d.add(x);let F=this.refs[x];return typeof F=="string"&&(F=this.refs[F]),typeof F=="object"?u(l,F.schema,x):x!==Or(b)&&(x[0]==="#"?(u(l,c[x],x),c[x]=l):this.refs[x]=b),x}function I(x){if(typeof x=="string"){if(!dv.test(x))throw new Error(`invalid anchor "${x}"`);T.call(this,`#${x}`)}}}),c;function u(l,f,m){if(f!==void 0&&!ov(l,f))throw h(m)}function h(l){return new Error(`reference "${l}" resolves to more than one schema`)}}yt.getSchemaRefs=fv,Object.defineProperty(Yt,"__esModule",{value:!0}),Yt.getData=Yt.KeywordCxt=Yt.validateFunctionCode=void 0;const Pd=$r,jd=lo,Ws=wn,ii=lo,pv=ri,co=cn,Qs=Mn,pe=Pe,Oe=ln,mv=yt,kn=Me,uo=so;function hv(e){if(Md(e)&&(Rd(e),Ld(e))){_v(e);return}Dd(e,()=>(0,Pd.topBoolOrEmptySchema)(e))}Yt.validateFunctionCode=hv;function Dd({gen:e,validateName:t,schema:n,schemaEnv:r,opts:o},a){o.code.es5?e.func(t,(0,pe._)`${Oe.default.data}, ${Oe.default.valCxt}`,r.$async,()=>{e.code((0,pe._)`"use strict"; ${xd(n,o)}`),gv(e,o),e.code(a)}):e.func(t,(0,pe._)`${Oe.default.data}, ${yv(o)}`,r.$async,()=>e.code(xd(n,o)).code(a))}function yv(e){return(0,pe._)`{${Oe.default.instancePath}="", ${Oe.default.parentData}, ${Oe.default.parentDataProperty}, ${Oe.default.rootData}=${Oe.default.data}${e.dynamicRef?(0,pe._)`, ${Oe.default.dynamicAnchors}={}`:pe.nil}}={}`}function gv(e,t){e.if(Oe.default.valCxt,()=>{e.var(Oe.default.instancePath,(0,pe._)`${Oe.default.valCxt}.${Oe.default.instancePath}`),e.var(Oe.default.parentData,(0,pe._)`${Oe.default.valCxt}.${Oe.default.parentData}`),e.var(Oe.default.parentDataProperty,(0,pe._)`${Oe.default.valCxt}.${Oe.default.parentDataProperty}`),e.var(Oe.default.rootData,(0,pe._)`${Oe.default.valCxt}.${Oe.default.rootData}`),t.dynamicRef&&e.var(Oe.default.dynamicAnchors,(0,pe._)`${Oe.default.valCxt}.${Oe.default.dynamicAnchors}`)},()=>{e.var(Oe.default.instancePath,(0,pe._)`""`),e.var(Oe.default.parentData,(0,pe._)`undefined`),e.var(Oe.default.parentDataProperty,(0,pe._)`undefined`),e.var(Oe.default.rootData,Oe.default.data),t.dynamicRef&&e.var(Oe.default.dynamicAnchors,(0,pe._)`{}`)})}function _v(e){const{schema:t,opts:n,gen:r}=e;Dd(e,()=>{n.$comment&&t.$comment&&Fd(e),wv(e),r.let(Oe.default.vErrors,null),r.let(Oe.default.errors,0),n.unevaluated&&bv(e),Bd(e),$v(e)})}function bv(e){const{gen:t,validateName:n}=e;e.evaluated=t.const("evaluated",(0,pe._)`${n}.evaluated`),t.if((0,pe._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,pe._)`${e.evaluated}.props`,(0,pe._)`undefined`)),t.if((0,pe._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,pe._)`${e.evaluated}.items`,(0,pe._)`undefined`))}function xd(e,t){const n=typeof e=="object"&&e[t.schemaId];return n&&(t.code.source||t.code.process)?(0,pe._)`/*# sourceURL=${n} */`:pe.nil}function Tv(e,t){if(Md(e)&&(Rd(e),Ld(e))){vv(e,t);return}(0,Pd.boolOrEmptySchema)(e,t)}function Ld({schema:e,self:t}){if(typeof e=="boolean")return!e;for(const n in e)if(t.RULES.all[n])return!0;return!1}function Md(e){return typeof e.schema!="boolean"}function vv(e,t){const{schema:n,gen:r,opts:o}=e;o.$comment&&n.$comment&&Fd(e),kv(e),Cv(e);const a=r.const("_errs",Oe.default.errors);Bd(e,a),r.var(t,(0,pe._)`${a} === ${Oe.default.errors}`)}function Rd(e){(0,kn.checkUnknownRules)(e),Sv(e)}function Bd(e,t){if(e.opts.jtd)return Vd(e,[],!1,t);const n=(0,jd.getSchemaTypes)(e.schema),r=(0,jd.coerceAndCheckDataType)(e,n);Vd(e,n,!r,t)}function Sv(e){const{schema:t,errSchemaPath:n,opts:r,self:o}=e;t.$ref&&r.ignoreKeywordsWithRef&&(0,kn.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function wv(e){const{schema:t,opts:n}=e;t.default!==void 0&&n.useDefaults&&n.strictSchema&&(0,kn.checkStrictMode)(e,"default is ignored in the schema root")}function kv(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,mv.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function Cv(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Fd({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:o}){const a=n.$comment;if(o.$comment===!0)e.code((0,pe._)`${Oe.default.self}.logger.log(${a})`);else if(typeof o.$comment=="function"){const s=(0,pe.str)`${r}/$comment`,c=e.scopeValue("root",{ref:t.root});e.code((0,pe._)`${Oe.default.self}.opts.$comment(${a}, ${s}, ${c}.schema)`)}}function $v(e){const{gen:t,schemaEnv:n,validateName:r,ValidationError:o,opts:a}=e;n.$async?t.if((0,pe._)`${Oe.default.errors} === 0`,()=>t.return(Oe.default.data),()=>t.throw((0,pe._)`new ${o}(${Oe.default.vErrors})`)):(t.assign((0,pe._)`${r}.errors`,Oe.default.vErrors),a.unevaluated&&Ev(e),t.return((0,pe._)`${Oe.default.errors} === 0`))}function Ev({gen:e,evaluated:t,props:n,items:r}){n instanceof pe.Name&&e.assign((0,pe._)`${t}.props`,n),r instanceof pe.Name&&e.assign((0,pe._)`${t}.items`,r)}function Vd(e,t,n,r){const{gen:o,schema:a,data:s,allErrors:c,opts:d,self:u}=e,{RULES:h}=u;if(a.$ref&&(d.ignoreKeywordsWithRef||!(0,kn.schemaHasRulesButRef)(a,h))){o.block(()=>Kd(e,"$ref",h.all.$ref.definition));return}d.jtd||Ov(e,t),o.block(()=>{for(const f of h.rules)l(f);l(h.post)});function l(f){(0,Ws.shouldUseGroup)(a,f)&&(f.type?(o.if((0,ii.checkDataType)(f.type,s,d.strictNumbers)),Ud(e,f),t.length===1&&t[0]===f.type&&n&&(o.else(),(0,ii.reportTypeError)(e)),o.endIf()):Ud(e,f),c||o.if((0,pe._)`${Oe.default.errors} === ${r||0}`))}}function Ud(e,t){const{gen:n,schema:r,opts:{useDefaults:o}}=e;o&&(0,pv.assignDefaults)(e,t.type),n.block(()=>{for(const a of t.rules)(0,Ws.shouldUseRule)(r,a)&&Kd(e,a.keyword,a.definition,t.type)})}function Ov(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(Av(e,t),e.opts.allowUnionTypes||Iv(e,t),Nv(e,e.dataTypes))}function Av(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(n=>{qd(e.dataTypes,n)||Ys(e,`type "${n}" not allowed by context "${e.dataTypes.join(",")}"`)}),jv(e,t)}}function Iv(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Ys(e,"use allowUnionTypes to allow union type keyword")}function Nv(e,t){const n=e.self.RULES.all;for(const r in n){const o=n[r];if(typeof o=="object"&&(0,Ws.shouldUseRule)(e.schema,o)){const{type:a}=o.definition;a.length&&!a.some(s=>Pv(t,s))&&Ys(e,`missing type "${a.join(",")}" for keyword "${r}"`)}}}function Pv(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function qd(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function jv(e,t){const n=[];for(const r of e.dataTypes)qd(t,r)?n.push(r):t.includes("integer")&&r==="number"&&n.push("integer");e.dataTypes=n}function Ys(e,t){const n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,(0,kn.checkStrictMode)(e,t,e.opts.strictTypes)}class Hd{constructor(t,n,r){if((0,co.validateKeywordUsage)(t,n,r),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=r,this.data=t.data,this.schema=t.schema[r],this.$data=n.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,kn.schemaRefOrVal)(t,this.schema,r,this.$data),this.schemaType=n.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=n,this.$data)this.schemaCode=t.gen.const("vSchema",Gd(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,co.validSchemaType)(this.schema,n.schemaType,n.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(n.schemaType)}`);("code"in n?n.trackErrors:n.errors!==!1)&&(this.errsCount=t.gen.const("_errs",Oe.default.errors))}result(t,n,r){this.failResult((0,pe.not)(t),n,r)}failResult(t,n,r){this.gen.if(t),r?r():this.error(),n?(this.gen.else(),n(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,n){this.failResult((0,pe.not)(t),void 0,n)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);const{schemaCode:n}=this;this.fail((0,pe._)`${n} !== undefined && (${(0,pe.or)(this.invalid$data(),t)})`)}error(t,n,r){if(n){this.setParams(n),this._error(t,r),this.setParams({});return}this._error(t,r)}_error(t,n){(t?uo.reportExtraError:uo.reportError)(this,this.def.error,n)}$dataError(){(0,uo.reportError)(this,this.def.$dataError||uo.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,uo.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,n){n?Object.assign(this.params,t):this.params=t}block$data(t,n,r=pe.nil){this.gen.block(()=>{this.check$data(t,r),n()})}check$data(t=pe.nil,n=pe.nil){if(!this.$data)return;const{gen:r,schemaCode:o,schemaType:a,def:s}=this;r.if((0,pe.or)((0,pe._)`${o} === undefined`,n)),t!==pe.nil&&r.assign(t,!0),(a.length||s.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),t!==pe.nil&&r.assign(t,!1)),r.else()}invalid$data(){const{gen:t,schemaCode:n,schemaType:r,def:o,it:a}=this;return(0,pe.or)(s(),c());function s(){if(r.length){if(!(n instanceof pe.Name))throw new Error("ajv implementation error");const d=Array.isArray(r)?r:[r];return(0,pe._)`${(0,ii.checkDataTypes)(d,n,a.opts.strictNumbers,ii.DataType.Wrong)}`}return pe.nil}function c(){if(o.validateSchema){const d=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,pe._)`!${d}(${n})`}return pe.nil}}subschema(t,n){const r=(0,Qs.getSubschema)(this.it,t);(0,Qs.extendSubschemaData)(r,this.it,t),(0,Qs.extendSubschemaMode)(r,t);const o={...this.it,...r,items:void 0,props:void 0};return Tv(o,n),o}mergeEvaluated(t,n){const{it:r,gen:o}=this;r.opts.unevaluated&&(r.props!==!0&&t.props!==void 0&&(r.props=kn.mergeEvaluated.props(o,t.props,r.props,n)),r.items!==!0&&t.items!==void 0&&(r.items=kn.mergeEvaluated.items(o,t.items,r.items,n)))}mergeValidEvaluated(t,n){const{it:r,gen:o}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return o.if(n,()=>this.mergeEvaluated(t,pe.Name)),!0}}Yt.KeywordCxt=Hd;function Kd(e,t,n,r){const o=new Hd(e,n,t);"code"in n?n.code(o,r):o.$data&&n.validate?(0,co.funcKeywordCode)(o,n):"macro"in n?(0,co.macroKeywordCode)(o,n):(n.compile||n.validate)&&(0,co.funcKeywordCode)(o,n)}const Dv=/^\/(?:[^~]|~0|~1)*$/,xv=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Gd(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let o,a;if(e==="")return Oe.default.rootData;if(e[0]==="/"){if(!Dv.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,a=Oe.default.rootData}else{const u=xv.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);const h=+u[1];if(o=u[2],o==="#"){if(h>=t)throw new Error(d("property/index",h));return r[t-h]}if(h>t)throw new Error(d("data",h));if(a=n[t-h],!o)return a}let s=a;const c=o.split("/");for(const u of c)u&&(a=(0,pe._)`${a}${(0,pe.getProperty)((0,kn.unescapeJsonPointer)(u))}`,s=(0,pe._)`${s} && ${a}`);return s;function d(u,h){return`Cannot access ${u} ${h} levels up, current level is ${t}`}}Yt.getData=Gd;var fo={};Object.defineProperty(fo,"__esModule",{value:!0});class Lv extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}fo.default=Lv;var po={};Object.defineProperty(po,"__esModule",{value:!0});const Js=yt;class Mv extends Error{constructor(t,n,r,o){super(o||`can't resolve reference ${r} from id ${n}`),this.missingRef=(0,Js.resolveUrl)(t,n,r),this.missingSchema=(0,Js.normalizeId)((0,Js.getFullPath)(t,this.missingRef))}}po.default=Mv;var jt={};Object.defineProperty(jt,"__esModule",{value:!0}),jt.resolveSchema=jt.getCompilingSchema=jt.resolveRef=jt.compileSchema=jt.SchemaEnv=void 0;const Jt=Pe,Rv=fo,nr=ln,Xt=yt,zd=Me,Bv=Yt;class si{constructor(t){var n;this.refs={},this.dynamicAnchors={};let r;typeof t.schema=="object"&&(r=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(n=t.baseId)!==null&&n!==void 0?n:(0,Xt.normalizeId)(r==null?void 0:r[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=r==null?void 0:r.$async,this.refs={}}}jt.SchemaEnv=si;function Xs(e){const t=Wd.call(this,e);if(t)return t;const n=(0,Xt.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:r,lines:o}=this.opts.code,{ownProperties:a}=this.opts,s=new Jt.CodeGen(this.scope,{es5:r,lines:o,ownProperties:a});let c;e.$async&&(c=s.scopeValue("Error",{ref:Rv.default,code:(0,Jt._)`require("ajv/dist/runtime/validation_error").default`}));const d=s.scopeName("validate");e.validateName=d;const u={gen:s,allErrors:this.opts.allErrors,data:nr.default.data,parentData:nr.default.parentData,parentDataProperty:nr.default.parentDataProperty,dataNames:[nr.default.data],dataPathArr:[Jt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Jt.stringify)(e.schema)}:{ref:e.schema}),validateName:d,ValidationError:c,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:Jt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Jt._)`""`,opts:this.opts,self:this};let h;try{this._compilations.add(e),(0,Bv.validateFunctionCode)(u),s.optimize(this.opts.code.optimize);const l=s.toString();h=`${s.scopeRefs(nr.default.scope)}return ${l}`,this.opts.code.process&&(h=this.opts.code.process(h,e));const m=new Function(`${nr.default.self}`,`${nr.default.scope}`,h)(this,this.scope.get());if(this.scope.value(d,{ref:m}),m.errors=null,m.schema=e.schema,m.schemaEnv=e,e.$async&&(m.$async=!0),this.opts.code.source===!0&&(m.source={validateName:d,validateCode:l,scopeValues:s._values}),this.opts.unevaluated){const{props:y,items:b}=u;m.evaluated={props:y instanceof Jt.Name?void 0:y,items:b instanceof Jt.Name?void 0:b,dynamicProps:y instanceof Jt.Name,dynamicItems:b instanceof Jt.Name},m.source&&(m.source.evaluated=(0,Jt.stringify)(m.evaluated))}return e.validate=m,e}catch(l){throw delete e.validate,delete e.validateName,h&&this.logger.error("Error compiling schema, function code:",h),l}finally{this._compilations.delete(e)}}jt.compileSchema=Xs;function Fv(e,t,n){var r;n=(0,Xt.resolveUrl)(this.opts.uriResolver,t,n);const o=e.refs[n];if(o)return o;let a=qv.call(this,e,n);if(a===void 0){const s=(r=e.localRefs)===null||r===void 0?void 0:r[n],{schemaId:c}=this.opts;s&&(a=new si({schema:s,schemaId:c,root:e,baseId:t}))}if(a!==void 0)return e.refs[n]=Vv.call(this,a)}jt.resolveRef=Fv;function Vv(e){return(0,Xt.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Xs.call(this,e)}function Wd(e){for(const t of this._compilations)if(Uv(t,e))return t}jt.getCompilingSchema=Wd;function Uv(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function qv(e,t){let n;for(;typeof(n=this.refs[t])=="string";)t=n;return n||this.schemas[t]||ai.call(this,e,t)}function ai(e,t){const n=this.opts.uriResolver.parse(t),r=(0,Xt._getFullPath)(this.opts.uriResolver,n);let o=(0,Xt.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===o)return Zs.call(this,n,e);const a=(0,Xt.normalizeId)(r),s=this.refs[a]||this.schemas[a];if(typeof s=="string"){const c=ai.call(this,e,s);return typeof(c==null?void 0:c.schema)!="object"?void 0:Zs.call(this,n,c)}if(typeof(s==null?void 0:s.schema)=="object"){if(s.validate||Xs.call(this,s),a===(0,Xt.normalizeId)(t)){const{schema:c}=s,{schemaId:d}=this.opts,u=c[d];return u&&(o=(0,Xt.resolveUrl)(this.opts.uriResolver,o,u)),new si({schema:c,schemaId:d,root:e,baseId:o})}return Zs.call(this,n,s)}}jt.resolveSchema=ai;const Hv=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Zs(e,{baseId:t,schema:n,root:r}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(const c of e.fragment.slice(1).split("/")){if(typeof n=="boolean")return;const d=n[(0,zd.unescapeFragment)(c)];if(d===void 0)return;n=d;const u=typeof n=="object"&&n[this.opts.schemaId];!Hv.has(c)&&u&&(t=(0,Xt.resolveUrl)(this.opts.uriResolver,t,u))}let a;if(typeof n!="boolean"&&n.$ref&&!(0,zd.schemaHasRulesButRef)(n,this.RULES)){const c=(0,Xt.resolveUrl)(this.opts.uriResolver,t,n.$ref);a=ai.call(this,r,c)}const{schemaId:s}=this.opts;if(a=a||new si({schema:n,schemaId:s,root:r,baseId:t}),a.schema!==a.root.schema)return a}const Kv={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1};var ea={},ta={exports:{}};/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */(function(e,t){(function(n,r){r(t)})(wt,function(n){function r(){for(var N=arguments.length,A=Array(N),D=0;D<N;D++)A[D]=arguments[D];if(A.length>1){A[0]=A[0].slice(0,-1);for(var K=A.length-1,q=1;q<K;++q)A[q]=A[q].slice(1,-1);return A[K]=A[K].slice(1),A.join("")}else return A[0]}function o(N){return"(?:"+N+")"}function a(N){return N===void 0?"undefined":N===null?"null":Object.prototype.toString.call(N).split(" ").pop().split("]").shift().toLowerCase()}function s(N){return N.toUpperCase()}function c(N){return N!=null?N instanceof Array?N:typeof N.length!="number"||N.split||N.setInterval||N.call?[N]:Array.prototype.slice.call(N):[]}function d(N,A){var D=N;if(A)for(var K in A)D[K]=A[K];return D}function u(N){var A="[A-Za-z]",D="[0-9]",K=r(D,"[A-Fa-f]"),q=o(o("%[EFef]"+K+"%"+K+K+"%"+K+K)+"|"+o("%[89A-Fa-f]"+K+"%"+K+K)+"|"+o("%"+K+K)),me="[\\:\\/\\?\\#\\[\\]\\@]",he="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",De=r(me,he),He=N?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Ye=N?"[\\uE000-\\uF8FF]":"[]",de=r(A,D,"[\\-\\.\\_\\~]",He);o(A+r(A,D,"[\\+\\-\\.]")+"*"),o(o(q+"|"+r(de,he,"[\\:]"))+"*");var Ue=o(o("25[0-5]")+"|"+o("2[0-4]"+D)+"|"+o("1"+D+D)+"|"+o("0?[1-9]"+D)+"|0?0?"+D),k=o(Ue+"\\."+Ue+"\\."+Ue+"\\."+Ue),w=o(K+"{1,4}"),ye=o(o(w+"\\:"+w)+"|"+k),Be=o(o(w+"\\:")+"{6}"+ye),Ge=o("\\:\\:"+o(w+"\\:")+"{5}"+ye),Kn=o(o(w)+"?\\:\\:"+o(w+"\\:")+"{4}"+ye),hn=o(o(o(w+"\\:")+"{0,1}"+w)+"?\\:\\:"+o(w+"\\:")+"{3}"+ye),yn=o(o(o(w+"\\:")+"{0,2}"+w)+"?\\:\\:"+o(w+"\\:")+"{2}"+ye),Hr=o(o(o(w+"\\:")+"{0,3}"+w)+"?\\:\\:"+w+"\\:"+ye),fr=o(o(o(w+"\\:")+"{0,4}"+w)+"?\\:\\:"+ye),Gt=o(o(o(w+"\\:")+"{0,5}"+w)+"?\\:\\:"+w),gn=o(o(o(w+"\\:")+"{0,6}"+w)+"?\\:\\:"),pr=o([Be,Ge,Kn,hn,yn,Hr,fr,Gt,gn].join("|")),Nn=o(o(de+"|"+q)+"+");o("[vV]"+K+"+\\."+r(de,he,"[\\:]")+"+"),o(o(q+"|"+r(de,he))+"*");var Eo=o(q+"|"+r(de,he,"[\\:\\@]"));return o(o(q+"|"+r(de,he,"[\\@]"))+"+"),o(o(Eo+"|"+r("[\\/\\?]",Ye))+"*"),{NOT_SCHEME:new RegExp(r("[^]",A,D,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(r("[^\\%\\:]",de,he),"g"),NOT_HOST:new RegExp(r("[^\\%\\[\\]\\:]",de,he),"g"),NOT_PATH:new RegExp(r("[^\\%\\/\\:\\@]",de,he),"g"),NOT_PATH_NOSCHEME:new RegExp(r("[^\\%\\/\\@]",de,he),"g"),NOT_QUERY:new RegExp(r("[^\\%]",de,he,"[\\:\\@\\/\\?]",Ye),"g"),NOT_FRAGMENT:new RegExp(r("[^\\%]",de,he,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(r("[^]",de,he),"g"),UNRESERVED:new RegExp(de,"g"),OTHER_CHARS:new RegExp(r("[^\\%]",de,De),"g"),PCT_ENCODED:new RegExp(q,"g"),IPV4ADDRESS:new RegExp("^("+k+")$"),IPV6ADDRESS:new RegExp("^\\[?("+pr+")"+o(o("\\%25|\\%(?!"+K+"{2})")+"("+Nn+")")+"?\\]?$")}}var h=u(!1),l=u(!0),f=function(){function N(A,D){var K=[],q=!0,me=!1,he=void 0;try{for(var De=A[Symbol.iterator](),He;!(q=(He=De.next()).done)&&(K.push(He.value),!(D&&K.length===D));q=!0);}catch(Ye){me=!0,he=Ye}finally{try{!q&&De.return&&De.return()}finally{if(me)throw he}}return K}return function(A,D){if(Array.isArray(A))return A;if(Symbol.iterator in Object(A))return N(A,D);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),m=function(N){if(Array.isArray(N)){for(var A=0,D=Array(N.length);A<N.length;A++)D[A]=N[A];return D}else return Array.from(N)},y=2147483647,b=36,S=1,T=26,I=38,x=700,B=72,F=128,L="-",P=/^xn--/,Y=/[^\0-\x7E]/,W=/[\x2E\u3002\uFF0E\uFF61]/g,X={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},G=b-S,z=Math.floor,Q=String.fromCharCode;function te(N){throw new RangeError(X[N])}function ke(N,A){for(var D=[],K=N.length;K--;)D[K]=A(N[K]);return D}function Ne(N,A){var D=N.split("@"),K="";D.length>1&&(K=D[0]+"@",N=D[1]),N=N.replace(W,".");var q=N.split("."),me=ke(q,A).join(".");return K+me}function Ze(N){for(var A=[],D=0,K=N.length;D<K;){var q=N.charCodeAt(D++);if(q>=55296&&q<=56319&&D<K){var me=N.charCodeAt(D++);(me&64512)==56320?A.push(((q&1023)<<10)+(me&1023)+65536):(A.push(q),D--)}else A.push(q)}return A}var qe=function(A){return String.fromCodePoint.apply(String,m(A))},nt=function(A){return A-48<10?A-22:A-65<26?A-65:A-97<26?A-97:b},j=function(A,D){return A+22+75*(A<26)-((D!=0)<<5)},g=function(A,D,K){var q=0;for(A=K?z(A/x):A>>1,A+=z(A/D);A>G*T>>1;q+=b)A=z(A/G);return z(q+(G+1)*A/(A+I))},E=function(A){var D=[],K=A.length,q=0,me=F,he=B,De=A.lastIndexOf(L);De<0&&(De=0);for(var He=0;He<De;++He)A.charCodeAt(He)>=128&&te("not-basic"),D.push(A.charCodeAt(He));for(var Ye=De>0?De+1:0;Ye<K;){for(var de=q,Ue=1,k=b;;k+=b){Ye>=K&&te("invalid-input");var w=nt(A.charCodeAt(Ye++));(w>=b||w>z((y-q)/Ue))&&te("overflow"),q+=w*Ue;var ye=k<=he?S:k>=he+T?T:k-he;if(w<ye)break;var Be=b-ye;Ue>z(y/Be)&&te("overflow"),Ue*=Be}var Ge=D.length+1;he=g(q-de,Ge,de==0),z(q/Ge)>y-me&&te("overflow"),me+=z(q/Ge),q%=Ge,D.splice(q++,0,me)}return String.fromCodePoint.apply(String,D)},$=function(A){var D=[];A=Ze(A);var K=A.length,q=F,me=0,he=B,De=!0,He=!1,Ye=void 0;try{for(var de=A[Symbol.iterator](),Ue;!(De=(Ue=de.next()).done);De=!0){var k=Ue.value;k<128&&D.push(Q(k))}}catch(Oo){He=!0,Ye=Oo}finally{try{!De&&de.return&&de.return()}finally{if(He)throw Ye}}var w=D.length,ye=w;for(w&&D.push(L);ye<K;){var Be=y,Ge=!0,Kn=!1,hn=void 0;try{for(var yn=A[Symbol.iterator](),Hr;!(Ge=(Hr=yn.next()).done);Ge=!0){var fr=Hr.value;fr>=q&&fr<Be&&(Be=fr)}}catch(Oo){Kn=!0,hn=Oo}finally{try{!Ge&&yn.return&&yn.return()}finally{if(Kn)throw hn}}var Gt=ye+1;Be-q>z((y-me)/Gt)&&te("overflow"),me+=(Be-q)*Gt,q=Be;var gn=!0,pr=!1,Nn=void 0;try{for(var Eo=A[Symbol.iterator](),ap;!(gn=(ap=Eo.next()).done);gn=!0){var lp=ap.value;if(lp<q&&++me>y&&te("overflow"),lp==q){for(var Li=me,Mi=b;;Mi+=b){var Ri=Mi<=he?S:Mi>=he+T?T:Mi-he;if(Li<Ri)break;var cp=Li-Ri,up=b-Ri;D.push(Q(j(Ri+cp%up,0))),Li=z(cp/up)}D.push(Q(j(Li,0))),he=g(me,Gt,ye==w),me=0,++ye}}}catch(Oo){pr=!0,Nn=Oo}finally{try{!gn&&Eo.return&&Eo.return()}finally{if(pr)throw Nn}}++me,++q}return D.join("")},_=function(A){return Ne(A,function(D){return P.test(D)?E(D.slice(4).toLowerCase()):D})},v=function(A){return Ne(A,function(D){return Y.test(D)?"xn--"+$(D):D})},C={version:"2.1.0",ucs2:{decode:Ze,encode:qe},decode:E,encode:$,toASCII:v,toUnicode:_},M={};function U(N){var A=N.charCodeAt(0),D=void 0;return A<16?D="%0"+A.toString(16).toUpperCase():A<128?D="%"+A.toString(16).toUpperCase():A<2048?D="%"+(A>>6|192).toString(16).toUpperCase()+"%"+(A&63|128).toString(16).toUpperCase():D="%"+(A>>12|224).toString(16).toUpperCase()+"%"+(A>>6&63|128).toString(16).toUpperCase()+"%"+(A&63|128).toString(16).toUpperCase(),D}function ne(N){for(var A="",D=0,K=N.length;D<K;){var q=parseInt(N.substr(D+1,2),16);if(q<128)A+=String.fromCharCode(q),D+=3;else if(q>=194&&q<224){if(K-D>=6){var me=parseInt(N.substr(D+4,2),16);A+=String.fromCharCode((q&31)<<6|me&63)}else A+=N.substr(D,6);D+=6}else if(q>=224){if(K-D>=9){var he=parseInt(N.substr(D+4,2),16),De=parseInt(N.substr(D+7,2),16);A+=String.fromCharCode((q&15)<<12|(he&63)<<6|De&63)}else A+=N.substr(D,9);D+=9}else A+=N.substr(D,3),D+=3}return A}function ee(N,A){function D(K){var q=ne(K);return q.match(A.UNRESERVED)?q:K}return N.scheme&&(N.scheme=String(N.scheme).replace(A.PCT_ENCODED,D).toLowerCase().replace(A.NOT_SCHEME,"")),N.userinfo!==void 0&&(N.userinfo=String(N.userinfo).replace(A.PCT_ENCODED,D).replace(A.NOT_USERINFO,U).replace(A.PCT_ENCODED,s)),N.host!==void 0&&(N.host=String(N.host).replace(A.PCT_ENCODED,D).toLowerCase().replace(A.NOT_HOST,U).replace(A.PCT_ENCODED,s)),N.path!==void 0&&(N.path=String(N.path).replace(A.PCT_ENCODED,D).replace(N.scheme?A.NOT_PATH:A.NOT_PATH_NOSCHEME,U).replace(A.PCT_ENCODED,s)),N.query!==void 0&&(N.query=String(N.query).replace(A.PCT_ENCODED,D).replace(A.NOT_QUERY,U).replace(A.PCT_ENCODED,s)),N.fragment!==void 0&&(N.fragment=String(N.fragment).replace(A.PCT_ENCODED,D).replace(A.NOT_FRAGMENT,U).replace(A.PCT_ENCODED,s)),N}function re(N){return N.replace(/^0*(.*)/,"$1")||"0"}function Ee(N,A){var D=N.match(A.IPV4ADDRESS)||[],K=f(D,2),q=K[1];return q?q.split(".").map(re).join("."):N}function R(N,A){var D=N.match(A.IPV6ADDRESS)||[],K=f(D,3),q=K[1],me=K[2];if(q){for(var he=q.toLowerCase().split("::").reverse(),De=f(he,2),He=De[0],Ye=De[1],de=Ye?Ye.split(":").map(re):[],Ue=He.split(":").map(re),k=A.IPV4ADDRESS.test(Ue[Ue.length-1]),w=k?7:8,ye=Ue.length-w,Be=Array(w),Ge=0;Ge<w;++Ge)Be[Ge]=de[Ge]||Ue[ye+Ge]||"";k&&(Be[w-1]=Ee(Be[w-1],A));var Kn=Be.reduce(function(Gt,gn,pr){if(!gn||gn==="0"){var Nn=Gt[Gt.length-1];Nn&&Nn.index+Nn.length===pr?Nn.length++:Gt.push({index:pr,length:1})}return Gt},[]),hn=Kn.sort(function(Gt,gn){return gn.length-Gt.length})[0],yn=void 0;if(hn&&hn.length>1){var Hr=Be.slice(0,hn.index),fr=Be.slice(hn.index+hn.length);yn=Hr.join(":")+"::"+fr.join(":")}else yn=Be.join(":");return me&&(yn+="%"+me),yn}else return N}var J=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,fe="".match(/(){0}/)[1]===void 0;function ce(N){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},D={},K=A.iri!==!1?l:h;A.reference==="suffix"&&(N=(A.scheme?A.scheme+":":"")+"//"+N);var q=N.match(J);if(q){fe?(D.scheme=q[1],D.userinfo=q[3],D.host=q[4],D.port=parseInt(q[5],10),D.path=q[6]||"",D.query=q[7],D.fragment=q[8],isNaN(D.port)&&(D.port=q[5])):(D.scheme=q[1]||void 0,D.userinfo=N.indexOf("@")!==-1?q[3]:void 0,D.host=N.indexOf("//")!==-1?q[4]:void 0,D.port=parseInt(q[5],10),D.path=q[6]||"",D.query=N.indexOf("?")!==-1?q[7]:void 0,D.fragment=N.indexOf("#")!==-1?q[8]:void 0,isNaN(D.port)&&(D.port=N.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?q[4]:void 0)),D.host&&(D.host=R(Ee(D.host,K),K)),D.scheme===void 0&&D.userinfo===void 0&&D.host===void 0&&D.port===void 0&&!D.path&&D.query===void 0?D.reference="same-document":D.scheme===void 0?D.reference="relative":D.fragment===void 0?D.reference="absolute":D.reference="uri",A.reference&&A.reference!=="suffix"&&A.reference!==D.reference&&(D.error=D.error||"URI is not a "+A.reference+" reference.");var me=M[(A.scheme||D.scheme||"").toLowerCase()];if(!A.unicodeSupport&&(!me||!me.unicodeSupport)){if(D.host&&(A.domainHost||me&&me.domainHost))try{D.host=C.toASCII(D.host.replace(K.PCT_ENCODED,ne).toLowerCase())}catch(he){D.error=D.error||"Host's domain name can not be converted to ASCII via punycode: "+he}ee(D,h)}else ee(D,K);me&&me.parse&&me.parse(D,A)}else D.error=D.error||"URI can not be parsed.";return D}function be(N,A){var D=A.iri!==!1?l:h,K=[];return N.userinfo!==void 0&&(K.push(N.userinfo),K.push("@")),N.host!==void 0&&K.push(R(Ee(String(N.host),D),D).replace(D.IPV6ADDRESS,function(q,me,he){return"["+me+(he?"%25"+he:"")+"]"})),(typeof N.port=="number"||typeof N.port=="string")&&(K.push(":"),K.push(String(N.port))),K.length?K.join(""):void 0}var ve=/^\.\.?\//,Le=/^\/\.(\/|$)/,Qe=/^\/\.\.(\/|$)/,We=/^\/?(?:.|\n)*?(?=\/|$)/;function Ce(N){for(var A=[];N.length;)if(N.match(ve))N=N.replace(ve,"");else if(N.match(Le))N=N.replace(Le,"/");else if(N.match(Qe))N=N.replace(Qe,"/"),A.pop();else if(N==="."||N==="..")N="";else{var D=N.match(We);if(D){var K=D[0];N=N.slice(K.length),A.push(K)}else throw new Error("Unexpected dot segment condition")}return A.join("")}function H(N){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},D=A.iri?l:h,K=[],q=M[(A.scheme||N.scheme||"").toLowerCase()];if(q&&q.serialize&&q.serialize(N,A),N.host&&!D.IPV6ADDRESS.test(N.host)){if(A.domainHost||q&&q.domainHost)try{N.host=A.iri?C.toUnicode(N.host):C.toASCII(N.host.replace(D.PCT_ENCODED,ne).toLowerCase())}catch(De){N.error=N.error||"Host's domain name can not be converted to "+(A.iri?"Unicode":"ASCII")+" via punycode: "+De}}ee(N,D),A.reference!=="suffix"&&N.scheme&&(K.push(N.scheme),K.push(":"));var me=be(N,A);if(me!==void 0&&(A.reference!=="suffix"&&K.push("//"),K.push(me),N.path&&N.path.charAt(0)!=="/"&&K.push("/")),N.path!==void 0){var he=N.path;!A.absolutePath&&(!q||!q.absolutePath)&&(he=Ce(he)),me===void 0&&(he=he.replace(/^\/\//,"/%2F")),K.push(he)}return N.query!==void 0&&(K.push("?"),K.push(N.query)),N.fragment!==void 0&&(K.push("#"),K.push(N.fragment)),K.join("")}function oe(N,A){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},K=arguments[3],q={};return K||(N=ce(H(N,D),D),A=ce(H(A,D),D)),D=D||{},!D.tolerant&&A.scheme?(q.scheme=A.scheme,q.userinfo=A.userinfo,q.host=A.host,q.port=A.port,q.path=Ce(A.path||""),q.query=A.query):(A.userinfo!==void 0||A.host!==void 0||A.port!==void 0?(q.userinfo=A.userinfo,q.host=A.host,q.port=A.port,q.path=Ce(A.path||""),q.query=A.query):(A.path?(A.path.charAt(0)==="/"?q.path=Ce(A.path):((N.userinfo!==void 0||N.host!==void 0||N.port!==void 0)&&!N.path?q.path="/"+A.path:N.path?q.path=N.path.slice(0,N.path.lastIndexOf("/")+1)+A.path:q.path=A.path,q.path=Ce(q.path)),q.query=A.query):(q.path=N.path,A.query!==void 0?q.query=A.query:q.query=N.query),q.userinfo=N.userinfo,q.host=N.host,q.port=N.port),q.scheme=N.scheme),q.fragment=A.fragment,q}function ie(N,A,D){var K=d({scheme:"null"},D);return H(oe(ce(N,K),ce(A,K),K,!0),K)}function ue(N,A){return typeof N=="string"?N=H(ce(N,A),A):a(N)==="object"&&(N=ce(H(N,A),A)),N}function _e(N,A,D){return typeof N=="string"?N=H(ce(N,D),D):a(N)==="object"&&(N=H(N,D)),typeof A=="string"?A=H(ce(A,D),D):a(A)==="object"&&(A=H(A,D)),N===A}function $e(N,A){return N&&N.toString().replace(!A||!A.iri?h.ESCAPE:l.ESCAPE,U)}function Se(N,A){return N&&N.toString().replace(!A||!A.iri?h.PCT_ENCODED:l.PCT_ENCODED,ne)}var at={scheme:"http",domainHost:!0,parse:function(A,D){return A.host||(A.error=A.error||"HTTP URIs must have a host."),A},serialize:function(A,D){var K=String(A.scheme).toLowerCase()==="https";return(A.port===(K?443:80)||A.port==="")&&(A.port=void 0),A.path||(A.path="/"),A}},Rt={scheme:"https",domainHost:at.domainHost,parse:at.parse,serialize:at.serialize};function Bt(N){return typeof N.secure=="boolean"?N.secure:String(N.scheme).toLowerCase()==="wss"}var Et={scheme:"ws",domainHost:!0,parse:function(A,D){var K=A;return K.secure=Bt(K),K.resourceName=(K.path||"/")+(K.query?"?"+K.query:""),K.path=void 0,K.query=void 0,K},serialize:function(A,D){if((A.port===(Bt(A)?443:80)||A.port==="")&&(A.port=void 0),typeof A.secure=="boolean"&&(A.scheme=A.secure?"wss":"ws",A.secure=void 0),A.resourceName){var K=A.resourceName.split("?"),q=f(K,2),me=q[0],he=q[1];A.path=me&&me!=="/"?me:void 0,A.query=he,A.resourceName=void 0}return A.fragment=void 0,A}},cr={scheme:"wss",domainHost:Et.domainHost,parse:Et.parse,serialize:Et.serialize},Co={},ur="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",Ot="[0-9A-Fa-f]",Fr=o(o("%[EFef]"+Ot+"%"+Ot+Ot+"%"+Ot+Ot)+"|"+o("%[89A-Fa-f]"+Ot+"%"+Ot+Ot)+"|"+o("%"+Ot+Ot)),On="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Vr="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",dr=r(Vr,'[\\"\\\\]'),rt="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Ur=new RegExp(ur,"g"),mn=new RegExp(Fr,"g"),An=new RegExp(r("[^]",On,"[\\.]",'[\\"]',dr),"g"),In=new RegExp(r("[^]",ur,rt),"g"),_t=In;function qn(N){var A=ne(N);return A.match(Ur)?A:N}var Hn={scheme:"mailto",parse:function(A,D){var K=A,q=K.to=K.path?K.path.split(","):[];if(K.path=void 0,K.query){for(var me=!1,he={},De=K.query.split("&"),He=0,Ye=De.length;He<Ye;++He){var de=De[He].split("=");switch(de[0]){case"to":for(var Ue=de[1].split(","),k=0,w=Ue.length;k<w;++k)q.push(Ue[k]);break;case"subject":K.subject=Se(de[1],D);break;case"body":K.body=Se(de[1],D);break;default:me=!0,he[Se(de[0],D)]=Se(de[1],D);break}}me&&(K.headers=he)}K.query=void 0;for(var ye=0,Be=q.length;ye<Be;++ye){var Ge=q[ye].split("@");if(Ge[0]=Se(Ge[0]),D.unicodeSupport)Ge[1]=Se(Ge[1],D).toLowerCase();else try{Ge[1]=C.toASCII(Se(Ge[1],D).toLowerCase())}catch(Kn){K.error=K.error||"Email address's domain name can not be converted to ASCII via punycode: "+Kn}q[ye]=Ge.join("@")}return K},serialize:function(A,D){var K=A,q=c(A.to);if(q){for(var me=0,he=q.length;me<he;++me){var De=String(q[me]),He=De.lastIndexOf("@"),Ye=De.slice(0,He).replace(mn,qn).replace(mn,s).replace(An,U),de=De.slice(He+1);try{de=D.iri?C.toUnicode(de):C.toASCII(Se(de,D).toLowerCase())}catch(ye){K.error=K.error||"Email address's domain name can not be converted to "+(D.iri?"Unicode":"ASCII")+" via punycode: "+ye}q[me]=Ye+"@"+de}K.path=q.join(",")}var Ue=A.headers=A.headers||{};A.subject&&(Ue.subject=A.subject),A.body&&(Ue.body=A.body);var k=[];for(var w in Ue)Ue[w]!==Co[w]&&k.push(w.replace(mn,qn).replace(mn,s).replace(In,U)+"="+Ue[w].replace(mn,qn).replace(mn,s).replace(_t,U));return k.length&&(K.query=k.join("&")),K}},$o=/^([^\:]+)\:(.*)/,qr={scheme:"urn",parse:function(A,D){var K=A.path&&A.path.match($o),q=A;if(K){var me=D.scheme||q.scheme||"urn",he=K[1].toLowerCase(),De=K[2],He=me+":"+(D.nid||he),Ye=M[He];q.nid=he,q.nss=De,q.path=void 0,Ye&&(q=Ye.parse(q,D))}else q.error=q.error||"URN can not be parsed.";return q},serialize:function(A,D){var K=D.scheme||A.scheme||"urn",q=A.nid,me=K+":"+(D.nid||q),he=M[me];he&&(A=he.serialize(A,D));var De=A,He=A.nss;return De.path=(q||D.nid)+":"+He,De}},ot=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,O={scheme:"urn:uuid",parse:function(A,D){var K=A;return K.uuid=K.nss,K.nss=void 0,!D.tolerant&&(!K.uuid||!K.uuid.match(ot))&&(K.error=K.error||"UUID is not valid."),K},serialize:function(A,D){var K=A;return K.nss=(A.uuid||"").toLowerCase(),K}};M[at.scheme]=at,M[Rt.scheme]=Rt,M[Et.scheme]=Et,M[cr.scheme]=cr,M[Hn.scheme]=Hn,M[qr.scheme]=qr,M[O.scheme]=O,n.SCHEMES=M,n.pctEncChar=U,n.pctDecChars=ne,n.parse=ce,n.removeDotSegments=Ce,n.serialize=H,n.resolveComponents=oe,n.resolve=ie,n.normalize=ue,n.equal=_e,n.escapeComponent=$e,n.unescapeComponent=Se,Object.defineProperty(n,"__esModule",{value:!0})})})(ta,ta.exports);var Gv=ta.exports;Object.defineProperty(ea,"__esModule",{value:!0});const Qd=Gv;Qd.code='require("ajv/dist/runtime/uri").default',ea.default=Qd,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=Yt;Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var n=Pe;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return n.CodeGen}});const r=fo,o=po,a=er,s=jt,c=Pe,d=yt,u=lo,h=Me,l=Kv,f=ea,m=(j,g)=>new RegExp(j,g);m.code="new RegExp";const y=["removeAdditional","useDefaults","coerceTypes"],b=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),S={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},T={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},I=200;function x(j){var g,E,$,_,v,C,M,U,ne,ee,re,Ee,R,J,fe,ce,be,ve,Le,Qe,We,Ce,H,oe,ie;const ue=j.strict,_e=(g=j.code)===null||g===void 0?void 0:g.optimize,$e=_e===!0||_e===void 0?1:_e||0,Se=($=(E=j.code)===null||E===void 0?void 0:E.regExp)!==null&&$!==void 0?$:m,at=(_=j.uriResolver)!==null&&_!==void 0?_:f.default;return{strictSchema:(C=(v=j.strictSchema)!==null&&v!==void 0?v:ue)!==null&&C!==void 0?C:!0,strictNumbers:(U=(M=j.strictNumbers)!==null&&M!==void 0?M:ue)!==null&&U!==void 0?U:!0,strictTypes:(ee=(ne=j.strictTypes)!==null&&ne!==void 0?ne:ue)!==null&&ee!==void 0?ee:"log",strictTuples:(Ee=(re=j.strictTuples)!==null&&re!==void 0?re:ue)!==null&&Ee!==void 0?Ee:"log",strictRequired:(J=(R=j.strictRequired)!==null&&R!==void 0?R:ue)!==null&&J!==void 0?J:!1,code:j.code?{...j.code,optimize:$e,regExp:Se}:{optimize:$e,regExp:Se},loopRequired:(fe=j.loopRequired)!==null&&fe!==void 0?fe:I,loopEnum:(ce=j.loopEnum)!==null&&ce!==void 0?ce:I,meta:(be=j.meta)!==null&&be!==void 0?be:!0,messages:(ve=j.messages)!==null&&ve!==void 0?ve:!0,inlineRefs:(Le=j.inlineRefs)!==null&&Le!==void 0?Le:!0,schemaId:(Qe=j.schemaId)!==null&&Qe!==void 0?Qe:"$id",addUsedSchema:(We=j.addUsedSchema)!==null&&We!==void 0?We:!0,validateSchema:(Ce=j.validateSchema)!==null&&Ce!==void 0?Ce:!0,validateFormats:(H=j.validateFormats)!==null&&H!==void 0?H:!0,unicodeRegExp:(oe=j.unicodeRegExp)!==null&&oe!==void 0?oe:!0,int32range:(ie=j.int32range)!==null&&ie!==void 0?ie:!0,uriResolver:at}}class B{constructor(g={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,g=this.opts={...g,...x(g)};const{es5:E,lines:$}=this.opts.code;this.scope=new c.ValueScope({scope:{},prefixes:b,es5:E,lines:$}),this.logger=z(g.logger);const _=g.validateFormats;g.validateFormats=!1,this.RULES=(0,a.getRules)(),F.call(this,S,g,"NOT SUPPORTED"),F.call(this,T,g,"DEPRECATED","warn"),this._metaOpts=X.call(this),g.formats&&Y.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),g.keywords&&W.call(this,g.keywords),typeof g.meta=="object"&&this.addMetaSchema(g.meta),P.call(this),g.validateFormats=_}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:g,meta:E,schemaId:$}=this.opts;let _=l;$==="id"&&(_={...l},_.id=_.$id,delete _.$id),E&&g&&this.addMetaSchema(_,_[$],!1)}defaultMeta(){const{meta:g,schemaId:E}=this.opts;return this.opts.defaultMeta=typeof g=="object"?g[E]||g:void 0}validate(g,E){let $;if(typeof g=="string"){if($=this.getSchema(g),!$)throw new Error(`no schema with key or ref "${g}"`)}else $=this.compile(g);const _=$(E);return"$async"in $||(this.errors=$.errors),_}compile(g,E){const $=this._addSchema(g,E);return $.validate||this._compileSchemaEnv($)}compileAsync(g,E){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:$}=this.opts;return _.call(this,g,E);async function _(ee,re){await v.call(this,ee.$schema);const Ee=this._addSchema(ee,re);return Ee.validate||C.call(this,Ee)}async function v(ee){ee&&!this.getSchema(ee)&&await _.call(this,{$ref:ee},!0)}async function C(ee){try{return this._compileSchemaEnv(ee)}catch(re){if(!(re instanceof o.default))throw re;return M.call(this,re),await U.call(this,re.missingSchema),C.call(this,ee)}}function M({missingSchema:ee,missingRef:re}){if(this.refs[ee])throw new Error(`AnySchema ${ee} is loaded but ${re} cannot be resolved`)}async function U(ee){const re=await ne.call(this,ee);this.refs[ee]||await v.call(this,re.$schema),this.refs[ee]||this.addSchema(re,ee,E)}async function ne(ee){const re=this._loading[ee];if(re)return re;try{return await(this._loading[ee]=$(ee))}finally{delete this._loading[ee]}}}addSchema(g,E,$,_=this.opts.validateSchema){if(Array.isArray(g)){for(const C of g)this.addSchema(C,void 0,$,_);return this}let v;if(typeof g=="object"){const{schemaId:C}=this.opts;if(v=g[C],v!==void 0&&typeof v!="string")throw new Error(`schema ${C} must be string`)}return E=(0,d.normalizeId)(E||v),this._checkUnique(E),this.schemas[E]=this._addSchema(g,$,E,_,!0),this}addMetaSchema(g,E,$=this.opts.validateSchema){return this.addSchema(g,E,!0,$),this}validateSchema(g,E){if(typeof g=="boolean")return!0;let $;if($=g.$schema,$!==void 0&&typeof $!="string")throw new Error("$schema must be a string");if($=$||this.opts.defaultMeta||this.defaultMeta(),!$)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const _=this.validate($,g);if(!_&&E){const v="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(v);else throw new Error(v)}return _}getSchema(g){let E;for(;typeof(E=L.call(this,g))=="string";)g=E;if(E===void 0){const{schemaId:$}=this.opts,_=new s.SchemaEnv({schema:{},schemaId:$});if(E=s.resolveSchema.call(this,_,g),!E)return;this.refs[g]=E}return E.validate||this._compileSchemaEnv(E)}removeSchema(g){if(g instanceof RegExp)return this._removeAllSchemas(this.schemas,g),this._removeAllSchemas(this.refs,g),this;switch(typeof g){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const E=L.call(this,g);return typeof E=="object"&&this._cache.delete(E.schema),delete this.schemas[g],delete this.refs[g],this}case"object":{const E=g;this._cache.delete(E);let $=g[this.opts.schemaId];return $&&($=(0,d.normalizeId)($),delete this.schemas[$],delete this.refs[$]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(g){for(const E of g)this.addKeyword(E);return this}addKeyword(g,E){let $;if(typeof g=="string")$=g,typeof E=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),E.keyword=$);else if(typeof g=="object"&&E===void 0){if(E=g,$=E.keyword,Array.isArray($)&&!$.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(te.call(this,$,E),!E)return(0,h.eachItem)($,v=>ke.call(this,v)),this;Ze.call(this,E);const _={...E,type:(0,u.getJSONTypes)(E.type),schemaType:(0,u.getJSONTypes)(E.schemaType)};return(0,h.eachItem)($,_.type.length===0?v=>ke.call(this,v,_):v=>_.type.forEach(C=>ke.call(this,v,_,C))),this}getKeyword(g){const E=this.RULES.all[g];return typeof E=="object"?E.definition:!!E}removeKeyword(g){const{RULES:E}=this;delete E.keywords[g],delete E.all[g];for(const $ of E.rules){const _=$.rules.findIndex(v=>v.keyword===g);_>=0&&$.rules.splice(_,1)}return this}addFormat(g,E){return typeof E=="string"&&(E=new RegExp(E)),this.formats[g]=E,this}errorsText(g=this.errors,{separator:E=", ",dataVar:$="data"}={}){return!g||g.length===0?"No errors":g.map(_=>`${$}${_.instancePath} ${_.message}`).reduce((_,v)=>_+E+v)}$dataMetaSchema(g,E){const $=this.RULES.all;g=JSON.parse(JSON.stringify(g));for(const _ of E){const v=_.split("/").slice(1);let C=g;for(const M of v)C=C[M];for(const M in $){const U=$[M];if(typeof U!="object")continue;const{$data:ne}=U.definition,ee=C[M];ne&&ee&&(C[M]=nt(ee))}}return g}_removeAllSchemas(g,E){for(const $ in g){const _=g[$];(!E||E.test($))&&(typeof _=="string"?delete g[$]:_&&!_.meta&&(this._cache.delete(_.schema),delete g[$]))}}_addSchema(g,E,$,_=this.opts.validateSchema,v=this.opts.addUsedSchema){let C;const{schemaId:M}=this.opts;if(typeof g=="object")C=g[M];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof g!="boolean")throw new Error("schema must be object or boolean")}let U=this._cache.get(g);if(U!==void 0)return U;$=(0,d.normalizeId)(C||$);const ne=d.getSchemaRefs.call(this,g,$);return U=new s.SchemaEnv({schema:g,schemaId:M,meta:E,baseId:$,localRefs:ne}),this._cache.set(U.schema,U),v&&!$.startsWith("#")&&($&&this._checkUnique($),this.refs[$]=U),_&&this.validateSchema(g,!0),U}_checkUnique(g){if(this.schemas[g]||this.refs[g])throw new Error(`schema with key or id "${g}" already exists`)}_compileSchemaEnv(g){if(g.meta?this._compileMetaSchema(g):s.compileSchema.call(this,g),!g.validate)throw new Error("ajv implementation error");return g.validate}_compileMetaSchema(g){const E=this.opts;this.opts=this._metaOpts;try{s.compileSchema.call(this,g)}finally{this.opts=E}}}e.default=B,B.ValidationError=r.default,B.MissingRefError=o.default;function F(j,g,E,$="error"){for(const _ in j){const v=_;v in g&&this.logger[$](`${E}: option ${_}. ${j[v]}`)}}function L(j){return j=(0,d.normalizeId)(j),this.schemas[j]||this.refs[j]}function P(){const j=this.opts.schemas;if(j)if(Array.isArray(j))this.addSchema(j);else for(const g in j)this.addSchema(j[g],g)}function Y(){for(const j in this.opts.formats){const g=this.opts.formats[j];g&&this.addFormat(j,g)}}function W(j){if(Array.isArray(j)){this.addVocabulary(j);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const g in j){const E=j[g];E.keyword||(E.keyword=g),this.addKeyword(E)}}function X(){const j={...this.opts};for(const g of y)delete j[g];return j}const G={log(){},warn(){},error(){}};function z(j){if(j===!1)return G;if(j===void 0)return console;if(j.log&&j.warn&&j.error)return j;throw new Error("logger must implement log, warn and error methods")}const Q=/^[a-z_$][a-z0-9_$:-]*$/i;function te(j,g){const{RULES:E}=this;if((0,h.eachItem)(j,$=>{if(E.keywords[$])throw new Error(`Keyword ${$} is already defined`);if(!Q.test($))throw new Error(`Keyword ${$} has invalid name`)}),!!g&&g.$data&&!("code"in g||"validate"in g))throw new Error('$data keyword must have "code" or "validate" function')}function ke(j,g,E){var $;const _=g==null?void 0:g.post;if(E&&_)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:v}=this;let C=_?v.post:v.rules.find(({type:U})=>U===E);if(C||(C={type:E,rules:[]},v.rules.push(C)),v.keywords[j]=!0,!g)return;const M={keyword:j,definition:{...g,type:(0,u.getJSONTypes)(g.type),schemaType:(0,u.getJSONTypes)(g.schemaType)}};g.before?Ne.call(this,C,M,g.before):C.rules.push(M),v.all[j]=M,($=g.implements)===null||$===void 0||$.forEach(U=>this.addKeyword(U))}function Ne(j,g,E){const $=j.rules.findIndex(_=>_.keyword===E);$>=0?j.rules.splice($,0,g):(j.rules.push(g),this.logger.warn(`rule ${E} is not defined`))}function Ze(j){let{metaSchema:g}=j;g!==void 0&&(j.$data&&this.opts.$data&&(g=nt(g)),j.validateSchema=this.compile(g,!0))}const qe={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function nt(j){return{anyOf:[j,qe]}}}(gd);var na={},ra={},oa={};Object.defineProperty(oa,"__esModule",{value:!0});const zv={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};oa.default=zv;var rr={};Object.defineProperty(rr,"__esModule",{value:!0}),rr.callRef=rr.getValidate=void 0;const Wv=po,Yd=je,Dt=Pe,Ar=ln,Jd=jt,li=Me,Qv={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:n,it:r}=e,{baseId:o,schemaEnv:a,validateName:s,opts:c,self:d}=r,{root:u}=a;if((n==="#"||n==="#/")&&o===u.baseId)return l();const h=Jd.resolveRef.call(d,u,o,n);if(h===void 0)throw new Wv.default(r.opts.uriResolver,o,n);if(h instanceof Jd.SchemaEnv)return f(h);return m(h);function l(){if(a===u)return ci(e,s,a,a.$async);const y=t.scopeValue("root",{ref:u});return ci(e,(0,Dt._)`${y}.validate`,u,u.$async)}function f(y){const b=Xd(e,y);ci(e,b,y,y.$async)}function m(y){const b=t.scopeValue("schema",c.code.source===!0?{ref:y,code:(0,Dt.stringify)(y)}:{ref:y}),S=t.name("valid"),T=e.subschema({schema:y,dataTypes:[],schemaPath:Dt.nil,topSchemaRef:b,errSchemaPath:n},S);e.mergeEvaluated(T),e.ok(S)}}};function Xd(e,t){const{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):(0,Dt._)`${n.scopeValue("wrapper",{ref:t})}.validate`}rr.getValidate=Xd;function ci(e,t,n,r){const{gen:o,it:a}=e,{allErrors:s,schemaEnv:c,opts:d}=a,u=d.passContext?Ar.default.this:Dt.nil;r?h():l();function h(){if(!c.$async)throw new Error("async schema referenced by sync schema");const y=o.let("valid");o.try(()=>{o.code((0,Dt._)`await ${(0,Yd.callValidateCode)(e,t,u)}`),m(t),s||o.assign(y,!0)},b=>{o.if((0,Dt._)`!(${b} instanceof ${a.ValidationError})`,()=>o.throw(b)),f(b),s||o.assign(y,!1)}),e.ok(y)}function l(){e.result((0,Yd.callValidateCode)(e,t,u),()=>m(t),()=>f(t))}function f(y){const b=(0,Dt._)`${y}.errors`;o.assign(Ar.default.vErrors,(0,Dt._)`${Ar.default.vErrors} === null ? ${b} : ${Ar.default.vErrors}.concat(${b})`),o.assign(Ar.default.errors,(0,Dt._)`${Ar.default.vErrors}.length`)}function m(y){var b;if(!a.opts.unevaluated)return;const S=(b=n==null?void 0:n.validate)===null||b===void 0?void 0:b.evaluated;if(a.props!==!0)if(S&&!S.dynamicProps)S.props!==void 0&&(a.props=li.mergeEvaluated.props(o,S.props,a.props));else{const T=o.var("props",(0,Dt._)`${y}.evaluated.props`);a.props=li.mergeEvaluated.props(o,T,a.props,Dt.Name)}if(a.items!==!0)if(S&&!S.dynamicItems)S.items!==void 0&&(a.items=li.mergeEvaluated.items(o,S.items,a.items));else{const T=o.var("items",(0,Dt._)`${y}.evaluated.items`);a.items=li.mergeEvaluated.items(o,T,a.items,Dt.Name)}}}rr.callRef=ci,rr.default=Qv,Object.defineProperty(ra,"__esModule",{value:!0});const Yv=oa,Jv=rr,Xv=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Yv.default,Jv.default];ra.default=Xv;var ia={},sa={};Object.defineProperty(sa,"__esModule",{value:!0});const ui=Pe,Bn=ui.operators,di={maximum:{okStr:"<=",ok:Bn.LTE,fail:Bn.GT},minimum:{okStr:">=",ok:Bn.GTE,fail:Bn.LT},exclusiveMaximum:{okStr:"<",ok:Bn.LT,fail:Bn.GTE},exclusiveMinimum:{okStr:">",ok:Bn.GT,fail:Bn.LTE}},Zv={message:({keyword:e,schemaCode:t})=>(0,ui.str)`must be ${di[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,ui._)`{comparison: ${di[e].okStr}, limit: ${t}}`},e0={keyword:Object.keys(di),type:"number",schemaType:"number",$data:!0,error:Zv,code(e){const{keyword:t,data:n,schemaCode:r}=e;e.fail$data((0,ui._)`${n} ${di[t].fail} ${r} || isNaN(${n})`)}};sa.default=e0;var aa={};Object.defineProperty(aa,"__esModule",{value:!0});const mo=Pe,t0={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>(0,mo.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,mo._)`{multipleOf: ${e}}`},code(e){const{gen:t,data:n,schemaCode:r,it:o}=e,a=o.opts.multipleOfPrecision,s=t.let("res"),c=a?(0,mo._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${a}`:(0,mo._)`${s} !== parseInt(${s})`;e.fail$data((0,mo._)`(${r} === 0 || (${s} = ${n}/${r}, ${c}))`)}};aa.default=t0;var la={},ca={};Object.defineProperty(ca,"__esModule",{value:!0});function Zd(e){const t=e.length;let n=0,r=0,o;for(;r<t;)n++,o=e.charCodeAt(r++),o>=55296&&o<=56319&&r<t&&(o=e.charCodeAt(r),(o&64512)===56320&&r++);return n}ca.default=Zd,Zd.code='require("ajv/dist/runtime/ucs2length").default',Object.defineProperty(la,"__esModule",{value:!0});const or=Pe,n0=Me,r0=ca,o0={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n=e==="maxLength"?"more":"fewer";return(0,or.str)`must NOT have ${n} than ${t} characters`},params:({schemaCode:e})=>(0,or._)`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:r,it:o}=e,a=t==="maxLength"?or.operators.GT:or.operators.LT,s=o.opts.unicode===!1?(0,or._)`${n}.length`:(0,or._)`${(0,n0.useFunc)(e.gen,r0.default)}(${n})`;e.fail$data((0,or._)`${s} ${a} ${r}`)}};la.default=o0;var ua={};Object.defineProperty(ua,"__esModule",{value:!0});const i0=je,fi=Pe,s0={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,fi.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,fi._)`{pattern: ${e}}`},code(e){const{data:t,$data:n,schema:r,schemaCode:o,it:a}=e,s=a.opts.unicodeRegExp?"u":"",c=n?(0,fi._)`(new RegExp(${o}, ${s}))`:(0,i0.usePattern)(e,r);e.fail$data((0,fi._)`!${c}.test(${t})`)}};ua.default=s0;var da={};Object.defineProperty(da,"__esModule",{value:!0});const ho=Pe,a0={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n=e==="maxProperties"?"more":"fewer";return(0,ho.str)`must NOT have ${n} than ${t} properties`},params:({schemaCode:e})=>(0,ho._)`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:r}=e,o=t==="maxProperties"?ho.operators.GT:ho.operators.LT;e.fail$data((0,ho._)`Object.keys(${n}).length ${o} ${r}`)}};da.default=a0;var fa={};Object.defineProperty(fa,"__esModule",{value:!0});const yo=je,go=Pe,l0=Me,c0={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>(0,go.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,go._)`{missingProperty: ${e}}`},code(e){const{gen:t,schema:n,schemaCode:r,data:o,$data:a,it:s}=e,{opts:c}=s;if(!a&&n.length===0)return;const d=n.length>=c.loopRequired;if(s.allErrors?u():h(),c.strictRequired){const m=e.parentSchema.properties,{definedProperties:y}=e.it;for(const b of n)if((m==null?void 0:m[b])===void 0&&!y.has(b)){const S=s.schemaEnv.baseId+s.errSchemaPath,T=`required property "${b}" is not defined at "${S}" (strictRequired)`;(0,l0.checkStrictMode)(s,T,s.opts.strictRequired)}}function u(){if(d||a)e.block$data(go.nil,l);else for(const m of n)(0,yo.checkReportMissingProp)(e,m)}function h(){const m=t.let("missing");if(d||a){const y=t.let("valid",!0);e.block$data(y,()=>f(m,y)),e.ok(y)}else t.if((0,yo.checkMissingProp)(e,n,m)),(0,yo.reportMissingProp)(e,m),t.else()}function l(){t.forOf("prop",r,m=>{e.setParams({missingProperty:m}),t.if((0,yo.noPropertyInData)(t,o,m,c.ownProperties),()=>e.error())})}function f(m,y){e.setParams({missingProperty:m}),t.forOf(m,r,()=>{t.assign(y,(0,yo.propertyInData)(t,o,m,c.ownProperties)),t.if((0,go.not)(y),()=>{e.error(),t.break()})},go.nil)}}};fa.default=c0;var pa={};Object.defineProperty(pa,"__esModule",{value:!0});const _o=Pe,u0={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n=e==="maxItems"?"more":"fewer";return(0,_o.str)`must NOT have ${n} than ${t} items`},params:({schemaCode:e})=>(0,_o._)`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:r}=e,o=t==="maxItems"?_o.operators.GT:_o.operators.LT;e.fail$data((0,_o._)`${n}.length ${o} ${r}`)}};pa.default=u0;var ma={},bo={};Object.defineProperty(bo,"__esModule",{value:!0});const ef=Ed;ef.code='require("ajv/dist/runtime/equal").default',bo.default=ef,Object.defineProperty(ma,"__esModule",{value:!0});const ha=lo,gt=Pe,d0=Me,f0=bo,p0={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>(0,gt.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,gt._)`{i: ${e}, j: ${t}}`},code(e){const{gen:t,data:n,$data:r,schema:o,parentSchema:a,schemaCode:s,it:c}=e;if(!r&&!o)return;const d=t.let("valid"),u=a.items?(0,ha.getSchemaTypes)(a.items):[];e.block$data(d,h,(0,gt._)`${s} === false`),e.ok(d);function h(){const y=t.let("i",(0,gt._)`${n}.length`),b=t.let("j");e.setParams({i:y,j:b}),t.assign(d,!0),t.if((0,gt._)`${y} > 1`,()=>(l()?f:m)(y,b))}function l(){return u.length>0&&!u.some(y=>y==="object"||y==="array")}function f(y,b){const S=t.name("item"),T=(0,ha.checkDataTypes)(u,S,c.opts.strictNumbers,ha.DataType.Wrong),I=t.const("indices",(0,gt._)`{}`);t.for((0,gt._)`;${y}--;`,()=>{t.let(S,(0,gt._)`${n}[${y}]`),t.if(T,(0,gt._)`continue`),u.length>1&&t.if((0,gt._)`typeof ${S} == "string"`,(0,gt._)`${S} += "_"`),t.if((0,gt._)`typeof ${I}[${S}] == "number"`,()=>{t.assign(b,(0,gt._)`${I}[${S}]`),e.error(),t.assign(d,!1).break()}).code((0,gt._)`${I}[${S}] = ${y}`)})}function m(y,b){const S=(0,d0.useFunc)(t,f0.default),T=t.name("outer");t.label(T).for((0,gt._)`;${y}--;`,()=>t.for((0,gt._)`${b} = ${y}; ${b}--;`,()=>t.if((0,gt._)`${S}(${n}[${y}], ${n}[${b}])`,()=>{e.error(),t.assign(d,!1).break(T)})))}}};ma.default=p0;var ya={};Object.defineProperty(ya,"__esModule",{value:!0});const ga=Pe,m0=Me,h0=bo,y0={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>(0,ga._)`{allowedValue: ${e}}`},code(e){const{gen:t,data:n,$data:r,schemaCode:o,schema:a}=e;r||a&&typeof a=="object"?e.fail$data((0,ga._)`!${(0,m0.useFunc)(t,h0.default)}(${n}, ${o})`):e.fail((0,ga._)`${a} !== ${n}`)}};ya.default=y0;var _a={};Object.defineProperty(_a,"__esModule",{value:!0});const To=Pe,g0=Me,_0=bo,b0={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,To._)`{allowedValues: ${e}}`},code(e){const{gen:t,data:n,$data:r,schema:o,schemaCode:a,it:s}=e;if(!r&&o.length===0)throw new Error("enum must have non-empty array");const c=o.length>=s.opts.loopEnum;let d;const u=()=>d??(d=(0,g0.useFunc)(t,_0.default));let h;if(c||r)h=t.let("valid"),e.block$data(h,l);else{if(!Array.isArray(o))throw new Error("ajv implementation error");const m=t.const("vSchema",a);h=(0,To.or)(...o.map((y,b)=>f(m,b)))}e.pass(h);function l(){t.assign(h,!1),t.forOf("v",a,m=>t.if((0,To._)`${u()}(${n}, ${m})`,()=>t.assign(h,!0).break()))}function f(m,y){const b=o[y];return typeof b=="object"&&b!==null?(0,To._)`${u()}(${n}, ${m}[${y}])`:(0,To._)`${n} === ${b}`}}};_a.default=b0,Object.defineProperty(ia,"__esModule",{value:!0});const T0=sa,v0=aa,S0=la,w0=ua,k0=da,C0=fa,$0=pa,E0=ma,O0=ya,A0=_a,I0=[T0.default,v0.default,S0.default,w0.default,k0.default,C0.default,$0.default,E0.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},O0.default,A0.default];ia.default=I0;var ba={},Ir={};Object.defineProperty(Ir,"__esModule",{value:!0}),Ir.validateAdditionalItems=void 0;const ir=Pe,Ta=Me,N0={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,ir.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,ir._)`{limit: ${e}}`},code(e){const{parentSchema:t,it:n}=e,{items:r}=t;if(!Array.isArray(r)){(0,Ta.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas');return}tf(e,r)}};function tf(e,t){const{gen:n,schema:r,data:o,keyword:a,it:s}=e;s.items=!0;const c=n.const("len",(0,ir._)`${o}.length`);if(r===!1)e.setParams({len:t.length}),e.pass((0,ir._)`${c} <= ${t.length}`);else if(typeof r=="object"&&!(0,Ta.alwaysValidSchema)(s,r)){const u=n.var("valid",(0,ir._)`${c} <= ${t.length}`);n.if((0,ir.not)(u),()=>d(u)),e.ok(u)}function d(u){n.forRange("i",t.length,c,h=>{e.subschema({keyword:a,dataProp:h,dataPropType:Ta.Type.Num},u),s.allErrors||n.if((0,ir.not)(u),()=>n.break())})}}Ir.validateAdditionalItems=tf,Ir.default=N0;var va={},Nr={};Object.defineProperty(Nr,"__esModule",{value:!0}),Nr.validateTuple=void 0;const nf=Pe,pi=Me,P0=je,j0={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:n}=e;if(Array.isArray(t))return rf(e,"additionalItems",t);n.items=!0,!(0,pi.alwaysValidSchema)(n,t)&&e.ok((0,P0.validateArray)(e))}};function rf(e,t,n=e.schema){const{gen:r,parentSchema:o,data:a,keyword:s,it:c}=e;h(o),c.opts.unevaluated&&n.length&&c.items!==!0&&(c.items=pi.mergeEvaluated.items(r,n.length,c.items));const d=r.name("valid"),u=r.const("len",(0,nf._)`${a}.length`);n.forEach((l,f)=>{(0,pi.alwaysValidSchema)(c,l)||(r.if((0,nf._)`${u} > ${f}`,()=>e.subschema({keyword:s,schemaProp:f,dataProp:f},d)),e.ok(d))});function h(l){const{opts:f,errSchemaPath:m}=c,y=n.length,b=y===l.minItems&&(y===l.maxItems||l[t]===!1);if(f.strictTuples&&!b){const S=`"${s}" is ${y}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;(0,pi.checkStrictMode)(c,S,f.strictTuples)}}}Nr.validateTuple=rf,Nr.default=j0,Object.defineProperty(va,"__esModule",{value:!0});const D0=Nr,x0={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,D0.validateTuple)(e,"items")};va.default=x0;var Sa={};Object.defineProperty(Sa,"__esModule",{value:!0});const of=Pe,L0=Me,M0=je,R0=Ir,B0={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,of.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,of._)`{limit: ${e}}`},code(e){const{schema:t,parentSchema:n,it:r}=e,{prefixItems:o}=n;r.items=!0,!(0,L0.alwaysValidSchema)(r,t)&&(o?(0,R0.validateAdditionalItems)(e,o):e.ok((0,M0.validateArray)(e)))}};Sa.default=B0;var wa={};Object.defineProperty(wa,"__esModule",{value:!0});const Kt=Pe,mi=Me,F0={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>t===void 0?(0,Kt.str)`must contain at least ${e} valid item(s)`:(0,Kt.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,Kt._)`{minContains: ${e}}`:(0,Kt._)`{minContains: ${e}, maxContains: ${t}}`},code(e){const{gen:t,schema:n,parentSchema:r,data:o,it:a}=e;let s,c;const{minContains:d,maxContains:u}=r;a.opts.next?(s=d===void 0?1:d,c=u):s=1;const h=t.const("len",(0,Kt._)`${o}.length`);if(e.setParams({min:s,max:c}),c===void 0&&s===0){(0,mi.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(c!==void 0&&s>c){(0,mi.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,mi.alwaysValidSchema)(a,n)){let b=(0,Kt._)`${h} >= ${s}`;c!==void 0&&(b=(0,Kt._)`${b} && ${h} <= ${c}`),e.pass(b);return}a.items=!0;const l=t.name("valid");c===void 0&&s===1?m(l,()=>t.if(l,()=>t.break())):s===0?(t.let(l,!0),c!==void 0&&t.if((0,Kt._)`${o}.length > 0`,f)):(t.let(l,!1),f()),e.result(l,()=>e.reset());function f(){const b=t.name("_valid"),S=t.let("count",0);m(b,()=>t.if(b,()=>y(S)))}function m(b,S){t.forRange("i",0,h,T=>{e.subschema({keyword:"contains",dataProp:T,dataPropType:mi.Type.Num,compositeRule:!0},b),S()})}function y(b){t.code((0,Kt._)`${b}++`),c===void 0?t.if((0,Kt._)`${b} >= ${s}`,()=>t.assign(l,!0).break()):(t.if((0,Kt._)`${b} > ${c}`,()=>t.assign(l,!1).break()),s===1?t.assign(l,!0):t.if((0,Kt._)`${b} >= ${s}`,()=>t.assign(l,!0)))}}};wa.default=F0;var sf={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=Pe,n=Me,r=je;e.error={message:({params:{property:d,depsCount:u,deps:h}})=>{const l=u===1?"property":"properties";return(0,t.str)`must have ${l} ${h} when property ${d} is present`},params:({params:{property:d,depsCount:u,deps:h,missingProperty:l}})=>(0,t._)`{property: ${d},
78
+ || ${W} === "boolean" || ${P} === null`).assign(X,(0,o._)`[${P}]`)}}}function m({gen:D,parentData:R,parentDataProperty:F},L){D.if((0,o._)`${R} !== undefined`,()=>D.assign((0,o._)`${R}[${F}]`,L))}function y(D,R,F,L=s.Correct){const P=L===s.Correct?o.operators.EQ:o.operators.NEQ;let Y;switch(D){case"null":return(0,o._)`${R} ${P} null`;case"array":Y=(0,o._)`Array.isArray(${R})`;break;case"object":Y=(0,o._)`${R} && typeof ${R} == "object" && !Array.isArray(${R})`;break;case"integer":Y=W((0,o._)`!(${R} % 1) && !isNaN(${R})`);break;case"number":Y=W();break;default:return(0,o._)`typeof ${R} ${P} ${D}`}return L===s.Correct?Y:(0,o.not)(Y);function W(X=o.nil){return(0,o.and)((0,o._)`typeof ${R} == "number"`,X,F?(0,o._)`isFinite(${R})`:o.nil)}}e.checkDataType=y;function b(D,R,F,L){if(D.length===1)return y(D[0],R,F,L);let P;const Y=(0,a.toHash)(D);if(Y.array&&Y.object){const W=(0,o._)`typeof ${R} != "object"`;P=Y.null?W:(0,o._)`!${R} || ${W}`,delete Y.null,delete Y.array,delete Y.object}else P=o.nil;Y.number&&delete Y.integer;for(const W in Y)P=(0,o.and)(P,y(W,R,F,L));return P}e.checkDataTypes=b;const S={message:({schema:D})=>`must be ${D}`,params:({schema:D,schemaValue:R})=>typeof D=="string"?(0,o._)`{type: ${D}}`:(0,o._)`{type: ${R}}`};function T(D){const R=I(D);(0,r.reportError)(R,S)}e.reportTypeError=T;function I(D){const{gen:R,data:F,schema:L}=D,P=(0,a.schemaRefOrVal)(D,L,"type");return{gen:R,keyword:"type",data:F,schema:L.type,schemaCode:P,schemaValue:P,parentSchema:L,params:{},it:D}}}(co);var ii={};Object.defineProperty(ii,"__esModule",{value:!0}),ii.assignDefaults=void 0;const Or=Pe,xT=Me;function DT(e,t){const{properties:n,items:r}=e.schema;if(t==="object"&&n)for(const o in n)kd(e,o,n[o].default);else t==="array"&&Array.isArray(r)&&r.forEach((o,a)=>kd(e,a,o.default))}ii.assignDefaults=DT;function kd(e,t,n){const{gen:r,compositeRule:o,data:a,opts:s}=e;if(n===void 0)return;const c=(0,Or._)`${a}${(0,Or.getProperty)(t)}`;if(o){(0,xT.checkStrictMode)(e,`default is ignored for: ${c}`);return}let d=(0,Or._)`${c} === undefined`;s.useDefaults==="empty"&&(d=(0,Or._)`${d} || ${c} === null || ${c} === ""`),r.if(d,(0,Or._)`${c} = ${(0,Or.stringify)(n)}`)}var cn={},je={};Object.defineProperty(je,"__esModule",{value:!0}),je.validateUnion=je.validateArray=je.usePattern=je.callValidateCode=je.schemaProperties=je.allSchemaProperties=je.noPropertyInData=je.propertyInData=je.isOwnProperty=je.hasPropFunc=je.reportMissingProp=je.checkMissingProp=je.checkReportMissingProp=void 0;const ze=Pe,Ks=Me,Mn=ln,LT=Me;function MT(e,t){const{gen:n,data:r,it:o}=e;n.if(zs(n,r,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ze._)`${t}`},!0),e.error()})}je.checkReportMissingProp=MT;function BT({gen:e,data:t,it:{opts:n}},r,o){return(0,ze.or)(...r.map(a=>(0,ze.and)(zs(e,t,a,n.ownProperties),(0,ze._)`${o} = ${a}`)))}je.checkMissingProp=BT;function RT(e,t){e.setParams({missingProperty:t},!0),e.error()}je.reportMissingProp=RT;function Cd(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ze._)`Object.prototype.hasOwnProperty`})}je.hasPropFunc=Cd;function Gs(e,t,n){return(0,ze._)`${Cd(e)}.call(${t}, ${n})`}je.isOwnProperty=Gs;function FT(e,t,n,r){const o=(0,ze._)`${t}${(0,ze.getProperty)(n)} !== undefined`;return r?(0,ze._)`${o} && ${Gs(e,t,n)}`:o}je.propertyInData=FT;function zs(e,t,n,r){const o=(0,ze._)`${t}${(0,ze.getProperty)(n)} === undefined`;return r?(0,ze.or)(o,(0,ze.not)(Gs(e,t,n))):o}je.noPropertyInData=zs;function $d(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}je.allSchemaProperties=$d;function VT(e,t){return $d(t).filter(n=>!(0,Ks.alwaysValidSchema)(e,t[n]))}je.schemaProperties=VT;function UT({schemaCode:e,data:t,it:{gen:n,topSchemaRef:r,schemaPath:o,errorPath:a},it:s},c,d,u){const h=u?(0,ze._)`${e}, ${t}, ${r}${o}`:t,l=[[Mn.default.instancePath,(0,ze.strConcat)(Mn.default.instancePath,a)],[Mn.default.parentData,s.parentData],[Mn.default.parentDataProperty,s.parentDataProperty],[Mn.default.rootData,Mn.default.rootData]];s.opts.dynamicRef&&l.push([Mn.default.dynamicAnchors,Mn.default.dynamicAnchors]);const f=(0,ze._)`${h}, ${n.object(...l)}`;return d!==ze.nil?(0,ze._)`${c}.call(${d}, ${f})`:(0,ze._)`${c}(${f})`}je.callValidateCode=UT;const qT=(0,ze._)`new RegExp`;function HT({gen:e,it:{opts:t}},n){const r=t.unicodeRegExp?"u":"",{regExp:o}=t.code,a=o(n,r);return e.scopeValue("pattern",{key:a.toString(),ref:a,code:(0,ze._)`${o.code==="new RegExp"?qT:(0,LT.useFunc)(e,o)}(${n}, ${r})`})}je.usePattern=HT;function KT(e){const{gen:t,data:n,keyword:r,it:o}=e,a=t.name("valid");if(o.allErrors){const c=t.let("valid",!0);return s(()=>t.assign(c,!1)),c}return t.var(a,!0),s(()=>t.break()),a;function s(c){const d=t.const("len",(0,ze._)`${n}.length`);t.forRange("i",0,d,u=>{e.subschema({keyword:r,dataProp:u,dataPropType:Ks.Type.Num},a),t.if((0,ze.not)(a),c)})}}je.validateArray=KT;function GT(e){const{gen:t,schema:n,keyword:r,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(n.some(d=>(0,Ks.alwaysValidSchema)(o,d))&&!o.opts.unevaluated)return;const s=t.let("valid",!1),c=t.name("_valid");t.block(()=>n.forEach((d,u)=>{const h=e.subschema({keyword:r,schemaProp:u,compositeRule:!0},c);t.assign(s,(0,ze._)`${s} || ${c}`),e.mergeValidEvaluated(h,c)||t.if((0,ze.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}je.validateUnion=GT,Object.defineProperty(cn,"__esModule",{value:!0}),cn.validateKeywordUsage=cn.validSchemaType=cn.funcKeywordCode=cn.macroKeywordCode=void 0;const $t=Pe,nr=ln,zT=je,WT=ao;function QT(e,t){const{gen:n,keyword:r,schema:o,parentSchema:a,it:s}=e,c=t.macro.call(s.self,o,a,s),d=Od(n,r,c);s.opts.validateSchema!==!1&&s.self.validateSchema(c,!0);const u=n.name("valid");e.subschema({schema:c,schemaPath:$t.nil,errSchemaPath:`${s.errSchemaPath}/${r}`,topSchemaRef:d,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}cn.macroKeywordCode=QT;function YT(e,t){var n;const{gen:r,keyword:o,schema:a,parentSchema:s,$data:c,it:d}=e;XT(d,t);const u=!c&&t.compile?t.compile.call(d.self,a,s,d):t.validate,h=Od(r,o,u),l=r.let("valid");e.block$data(l,f),e.ok((n=t.valid)!==null&&n!==void 0?n:l);function f(){if(t.errors===!1)b(),t.modifying&&Ed(e),S(()=>e.error());else{const T=t.async?m():y();t.modifying&&Ed(e),S(()=>JT(e,T))}}function m(){const T=r.let("ruleErrs",null);return r.try(()=>b((0,$t._)`await `),I=>r.assign(l,!1).if((0,$t._)`${I} instanceof ${d.ValidationError}`,()=>r.assign(T,(0,$t._)`${I}.errors`),()=>r.throw(I))),T}function y(){const T=(0,$t._)`${h}.errors`;return r.assign(T,null),b($t.nil),T}function b(T=t.async?(0,$t._)`await `:$t.nil){const I=d.opts.passContext?nr.default.this:nr.default.self,D=!("compile"in t&&!c||t.schema===!1);r.assign(l,(0,$t._)`${T}${(0,zT.callValidateCode)(e,h,I,D)}`,t.modifying)}function S(T){var I;r.if((0,$t.not)((I=t.valid)!==null&&I!==void 0?I:l),T)}}cn.funcKeywordCode=YT;function Ed(e){const{gen:t,data:n,it:r}=e;t.if(r.parentData,()=>t.assign(n,(0,$t._)`${r.parentData}[${r.parentDataProperty}]`))}function JT(e,t){const{gen:n}=e;n.if((0,$t._)`Array.isArray(${t})`,()=>{n.assign(nr.default.vErrors,(0,$t._)`${nr.default.vErrors} === null ? ${t} : ${nr.default.vErrors}.concat(${t})`).assign(nr.default.errors,(0,$t._)`${nr.default.vErrors}.length`),(0,WT.extendErrors)(e)},()=>e.error())}function XT({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Od(e,t,n){if(n===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof n=="function"?{ref:n}:{ref:n,code:(0,$t.stringify)(n)})}function ZT(e,t,n=!1){return!t.length||t.some(r=>r==="array"?Array.isArray(e):r==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==r||n&&typeof e>"u")}cn.validSchemaType=ZT;function ev({schema:e,opts:t,self:n,errSchemaPath:r},o,a){if(Array.isArray(o.keyword)?!o.keyword.includes(a):o.keyword!==a)throw new Error("ajv implementation error");const s=o.dependencies;if(s!=null&&s.some(c=>!Object.prototype.hasOwnProperty.call(e,c)))throw new Error(`parent schema must have dependencies of ${a}: ${s.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[a])){const d=`keyword "${a}" value is invalid at path "${r}": `+n.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")n.logger.error(d);else throw new Error(d)}}cn.validateKeywordUsage=ev;var Bn={};Object.defineProperty(Bn,"__esModule",{value:!0}),Bn.extendSubschemaMode=Bn.extendSubschemaData=Bn.getSubschema=void 0;const un=Pe,Ad=Me;function tv(e,{keyword:t,schemaProp:n,schema:r,schemaPath:o,errSchemaPath:a,topSchemaRef:s}){if(t!==void 0&&r!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){const c=e.schema[t];return n===void 0?{schema:c,schemaPath:(0,un._)`${e.schemaPath}${(0,un.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:c[n],schemaPath:(0,un._)`${e.schemaPath}${(0,un.getProperty)(t)}${(0,un.getProperty)(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Ad.escapeFragment)(n)}`}}if(r!==void 0){if(o===void 0||a===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:r,schemaPath:o,topSchemaRef:s,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')}Bn.getSubschema=tv;function nv(e,t,{dataProp:n,dataPropType:r,data:o,dataTypes:a,propertyName:s}){if(o!==void 0&&n!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:c}=t;if(n!==void 0){const{errorPath:u,dataPathArr:h,opts:l}=t,f=c.let("data",(0,un._)`${t.data}${(0,un.getProperty)(n)}`,!0);d(f),e.errorPath=(0,un.str)`${u}${(0,Ad.getErrorPath)(n,r,l.jsPropertySyntax)}`,e.parentDataProperty=(0,un._)`${n}`,e.dataPathArr=[...h,e.parentDataProperty]}if(o!==void 0){const u=o instanceof un.Name?o:c.let("data",o,!0);d(u),s!==void 0&&(e.propertyName=s)}a&&(e.dataTypes=a);function d(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}Bn.extendSubschemaData=nv;function rv(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:o,allErrors:a}){r!==void 0&&(e.compositeRule=r),o!==void 0&&(e.createErrors=o),a!==void 0&&(e.allErrors=a),e.jtdDiscriminator=t,e.jtdMetadata=n}Bn.extendSubschemaMode=rv;var yt={},Id=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,o,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[o]))return!1;for(o=r;o--!==0;){var s=a[o];if(!e(t[s],n[s]))return!1}return!0}return t!==t&&n!==n},Nd={exports:{}},Rn=Nd.exports=function(e,t,n){typeof t=="function"&&(n=t,t={}),n=t.cb||n;var r=typeof n=="function"?n:n.pre||function(){},o=n.post||function(){};si(t,r,o,e,"",e)};Rn.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},Rn.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},Rn.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},Rn.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function si(e,t,n,r,o,a,s,c,d,u){if(r&&typeof r=="object"&&!Array.isArray(r)){t(r,o,a,s,c,d,u);for(var h in r){var l=r[h];if(Array.isArray(l)){if(h in Rn.arrayKeywords)for(var f=0;f<l.length;f++)si(e,t,n,l[f],o+"/"+h+"/"+f,a,o,h,r,f)}else if(h in Rn.propsKeywords){if(l&&typeof l=="object")for(var m in l)si(e,t,n,l[m],o+"/"+h+"/"+ov(m),a,o,h,r,m)}else(h in Rn.keywords||e.allKeys&&!(h in Rn.skipKeywords))&&si(e,t,n,l,o+"/"+h,a,o,h,r)}n(r,o,a,s,c,d,u)}}function ov(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var iv=Nd.exports;Object.defineProperty(yt,"__esModule",{value:!0}),yt.getSchemaRefs=yt.resolveUrl=yt.normalizeId=yt._getFullPath=yt.getFullPath=yt.inlineRef=void 0;const sv=Me,av=Id,lv=iv,cv=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function uv(e,t=!0){return typeof e=="boolean"?!0:t===!0?!Ws(e):t?Pd(e)<=t:!1}yt.inlineRef=uv;const dv=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Ws(e){for(const t in e){if(dv.has(t))return!0;const n=e[t];if(Array.isArray(n)&&n.some(Ws)||typeof n=="object"&&Ws(n))return!0}return!1}function Pd(e){let t=0;for(const n in e){if(n==="$ref")return 1/0;if(t++,!cv.has(n)&&(typeof e[n]=="object"&&(0,sv.eachItem)(e[n],r=>t+=Pd(r)),t===1/0))return 1/0}return t}function jd(e,t="",n){n!==!1&&(t=Ar(t));const r=e.parse(t);return xd(e,r)}yt.getFullPath=jd;function xd(e,t){return e.serialize(t).split("#")[0]+"#"}yt._getFullPath=xd;const fv=/#\/?$/;function Ar(e){return e?e.replace(fv,""):""}yt.normalizeId=Ar;function pv(e,t,n){return n=Ar(n),e.resolve(t,n)}yt.resolveUrl=pv;const mv=/^[a-z_][-a-z0-9._]*$/i;function hv(e,t){if(typeof e=="boolean")return{};const{schemaId:n,uriResolver:r}=this.opts,o=Ar(e[n]||t),a={"":o},s=jd(r,o,!1),c={},d=new Set;return lv(e,{allKeys:!0},(l,f,m,y)=>{if(y===void 0)return;const b=s+f;let S=a[y];typeof l[n]=="string"&&(S=T.call(this,l[n])),I.call(this,l.$anchor),I.call(this,l.$dynamicAnchor),a[f]=S;function T(D){const R=this.opts.uriResolver.resolve;if(D=Ar(S?R(S,D):D),d.has(D))throw h(D);d.add(D);let F=this.refs[D];return typeof F=="string"&&(F=this.refs[F]),typeof F=="object"?u(l,F.schema,D):D!==Ar(b)&&(D[0]==="#"?(u(l,c[D],D),c[D]=l):this.refs[D]=b),D}function I(D){if(typeof D=="string"){if(!mv.test(D))throw new Error(`invalid anchor "${D}"`);T.call(this,`#${D}`)}}}),c;function u(l,f,m){if(f!==void 0&&!av(l,f))throw h(m)}function h(l){return new Error(`reference "${l}" resolves to more than one schema`)}}yt.getSchemaRefs=hv,Object.defineProperty(Yt,"__esModule",{value:!0}),Yt.getData=Yt.KeywordCxt=Yt.validateFunctionCode=void 0;const Dd=Er,Ld=co,Qs=wn,ai=co,yv=ii,uo=cn,Ys=Bn,pe=Pe,Oe=ln,gv=yt,kn=Me,fo=ao;function _v(e){if(Fd(e)&&(Vd(e),Rd(e))){vv(e);return}Md(e,()=>(0,Dd.topBoolOrEmptySchema)(e))}Yt.validateFunctionCode=_v;function Md({gen:e,validateName:t,schema:n,schemaEnv:r,opts:o},a){o.code.es5?e.func(t,(0,pe._)`${Oe.default.data}, ${Oe.default.valCxt}`,r.$async,()=>{e.code((0,pe._)`"use strict"; ${Bd(n,o)}`),Tv(e,o),e.code(a)}):e.func(t,(0,pe._)`${Oe.default.data}, ${bv(o)}`,r.$async,()=>e.code(Bd(n,o)).code(a))}function bv(e){return(0,pe._)`{${Oe.default.instancePath}="", ${Oe.default.parentData}, ${Oe.default.parentDataProperty}, ${Oe.default.rootData}=${Oe.default.data}${e.dynamicRef?(0,pe._)`, ${Oe.default.dynamicAnchors}={}`:pe.nil}}={}`}function Tv(e,t){e.if(Oe.default.valCxt,()=>{e.var(Oe.default.instancePath,(0,pe._)`${Oe.default.valCxt}.${Oe.default.instancePath}`),e.var(Oe.default.parentData,(0,pe._)`${Oe.default.valCxt}.${Oe.default.parentData}`),e.var(Oe.default.parentDataProperty,(0,pe._)`${Oe.default.valCxt}.${Oe.default.parentDataProperty}`),e.var(Oe.default.rootData,(0,pe._)`${Oe.default.valCxt}.${Oe.default.rootData}`),t.dynamicRef&&e.var(Oe.default.dynamicAnchors,(0,pe._)`${Oe.default.valCxt}.${Oe.default.dynamicAnchors}`)},()=>{e.var(Oe.default.instancePath,(0,pe._)`""`),e.var(Oe.default.parentData,(0,pe._)`undefined`),e.var(Oe.default.parentDataProperty,(0,pe._)`undefined`),e.var(Oe.default.rootData,Oe.default.data),t.dynamicRef&&e.var(Oe.default.dynamicAnchors,(0,pe._)`{}`)})}function vv(e){const{schema:t,opts:n,gen:r}=e;Md(e,()=>{n.$comment&&t.$comment&&qd(e),$v(e),r.let(Oe.default.vErrors,null),r.let(Oe.default.errors,0),n.unevaluated&&Sv(e),Ud(e),Av(e)})}function Sv(e){const{gen:t,validateName:n}=e;e.evaluated=t.const("evaluated",(0,pe._)`${n}.evaluated`),t.if((0,pe._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,pe._)`${e.evaluated}.props`,(0,pe._)`undefined`)),t.if((0,pe._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,pe._)`${e.evaluated}.items`,(0,pe._)`undefined`))}function Bd(e,t){const n=typeof e=="object"&&e[t.schemaId];return n&&(t.code.source||t.code.process)?(0,pe._)`/*# sourceURL=${n} */`:pe.nil}function wv(e,t){if(Fd(e)&&(Vd(e),Rd(e))){kv(e,t);return}(0,Dd.boolOrEmptySchema)(e,t)}function Rd({schema:e,self:t}){if(typeof e=="boolean")return!e;for(const n in e)if(t.RULES.all[n])return!0;return!1}function Fd(e){return typeof e.schema!="boolean"}function kv(e,t){const{schema:n,gen:r,opts:o}=e;o.$comment&&n.$comment&&qd(e),Ev(e),Ov(e);const a=r.const("_errs",Oe.default.errors);Ud(e,a),r.var(t,(0,pe._)`${a} === ${Oe.default.errors}`)}function Vd(e){(0,kn.checkUnknownRules)(e),Cv(e)}function Ud(e,t){if(e.opts.jtd)return Hd(e,[],!1,t);const n=(0,Ld.getSchemaTypes)(e.schema),r=(0,Ld.coerceAndCheckDataType)(e,n);Hd(e,n,!r,t)}function Cv(e){const{schema:t,errSchemaPath:n,opts:r,self:o}=e;t.$ref&&r.ignoreKeywordsWithRef&&(0,kn.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function $v(e){const{schema:t,opts:n}=e;t.default!==void 0&&n.useDefaults&&n.strictSchema&&(0,kn.checkStrictMode)(e,"default is ignored in the schema root")}function Ev(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,gv.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function Ov(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function qd({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:o}){const a=n.$comment;if(o.$comment===!0)e.code((0,pe._)`${Oe.default.self}.logger.log(${a})`);else if(typeof o.$comment=="function"){const s=(0,pe.str)`${r}/$comment`,c=e.scopeValue("root",{ref:t.root});e.code((0,pe._)`${Oe.default.self}.opts.$comment(${a}, ${s}, ${c}.schema)`)}}function Av(e){const{gen:t,schemaEnv:n,validateName:r,ValidationError:o,opts:a}=e;n.$async?t.if((0,pe._)`${Oe.default.errors} === 0`,()=>t.return(Oe.default.data),()=>t.throw((0,pe._)`new ${o}(${Oe.default.vErrors})`)):(t.assign((0,pe._)`${r}.errors`,Oe.default.vErrors),a.unevaluated&&Iv(e),t.return((0,pe._)`${Oe.default.errors} === 0`))}function Iv({gen:e,evaluated:t,props:n,items:r}){n instanceof pe.Name&&e.assign((0,pe._)`${t}.props`,n),r instanceof pe.Name&&e.assign((0,pe._)`${t}.items`,r)}function Hd(e,t,n,r){const{gen:o,schema:a,data:s,allErrors:c,opts:d,self:u}=e,{RULES:h}=u;if(a.$ref&&(d.ignoreKeywordsWithRef||!(0,kn.schemaHasRulesButRef)(a,h))){o.block(()=>Wd(e,"$ref",h.all.$ref.definition));return}d.jtd||Nv(e,t),o.block(()=>{for(const f of h.rules)l(f);l(h.post)});function l(f){(0,Qs.shouldUseGroup)(a,f)&&(f.type?(o.if((0,ai.checkDataType)(f.type,s,d.strictNumbers)),Kd(e,f),t.length===1&&t[0]===f.type&&n&&(o.else(),(0,ai.reportTypeError)(e)),o.endIf()):Kd(e,f),c||o.if((0,pe._)`${Oe.default.errors} === ${r||0}`))}}function Kd(e,t){const{gen:n,schema:r,opts:{useDefaults:o}}=e;o&&(0,yv.assignDefaults)(e,t.type),n.block(()=>{for(const a of t.rules)(0,Qs.shouldUseRule)(r,a)&&Wd(e,a.keyword,a.definition,t.type)})}function Nv(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(Pv(e,t),e.opts.allowUnionTypes||jv(e,t),xv(e,e.dataTypes))}function Pv(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(n=>{Gd(e.dataTypes,n)||Js(e,`type "${n}" not allowed by context "${e.dataTypes.join(",")}"`)}),Lv(e,t)}}function jv(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Js(e,"use allowUnionTypes to allow union type keyword")}function xv(e,t){const n=e.self.RULES.all;for(const r in n){const o=n[r];if(typeof o=="object"&&(0,Qs.shouldUseRule)(e.schema,o)){const{type:a}=o.definition;a.length&&!a.some(s=>Dv(t,s))&&Js(e,`missing type "${a.join(",")}" for keyword "${r}"`)}}}function Dv(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Gd(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function Lv(e,t){const n=[];for(const r of e.dataTypes)Gd(t,r)?n.push(r):t.includes("integer")&&r==="number"&&n.push("integer");e.dataTypes=n}function Js(e,t){const n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,(0,kn.checkStrictMode)(e,t,e.opts.strictTypes)}class zd{constructor(t,n,r){if((0,uo.validateKeywordUsage)(t,n,r),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=r,this.data=t.data,this.schema=t.schema[r],this.$data=n.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,kn.schemaRefOrVal)(t,this.schema,r,this.$data),this.schemaType=n.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=n,this.$data)this.schemaCode=t.gen.const("vSchema",Qd(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,uo.validSchemaType)(this.schema,n.schemaType,n.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(n.schemaType)}`);("code"in n?n.trackErrors:n.errors!==!1)&&(this.errsCount=t.gen.const("_errs",Oe.default.errors))}result(t,n,r){this.failResult((0,pe.not)(t),n,r)}failResult(t,n,r){this.gen.if(t),r?r():this.error(),n?(this.gen.else(),n(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,n){this.failResult((0,pe.not)(t),void 0,n)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);const{schemaCode:n}=this;this.fail((0,pe._)`${n} !== undefined && (${(0,pe.or)(this.invalid$data(),t)})`)}error(t,n,r){if(n){this.setParams(n),this._error(t,r),this.setParams({});return}this._error(t,r)}_error(t,n){(t?fo.reportExtraError:fo.reportError)(this,this.def.error,n)}$dataError(){(0,fo.reportError)(this,this.def.$dataError||fo.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,fo.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,n){n?Object.assign(this.params,t):this.params=t}block$data(t,n,r=pe.nil){this.gen.block(()=>{this.check$data(t,r),n()})}check$data(t=pe.nil,n=pe.nil){if(!this.$data)return;const{gen:r,schemaCode:o,schemaType:a,def:s}=this;r.if((0,pe.or)((0,pe._)`${o} === undefined`,n)),t!==pe.nil&&r.assign(t,!0),(a.length||s.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),t!==pe.nil&&r.assign(t,!1)),r.else()}invalid$data(){const{gen:t,schemaCode:n,schemaType:r,def:o,it:a}=this;return(0,pe.or)(s(),c());function s(){if(r.length){if(!(n instanceof pe.Name))throw new Error("ajv implementation error");const d=Array.isArray(r)?r:[r];return(0,pe._)`${(0,ai.checkDataTypes)(d,n,a.opts.strictNumbers,ai.DataType.Wrong)}`}return pe.nil}function c(){if(o.validateSchema){const d=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,pe._)`!${d}(${n})`}return pe.nil}}subschema(t,n){const r=(0,Ys.getSubschema)(this.it,t);(0,Ys.extendSubschemaData)(r,this.it,t),(0,Ys.extendSubschemaMode)(r,t);const o={...this.it,...r,items:void 0,props:void 0};return wv(o,n),o}mergeEvaluated(t,n){const{it:r,gen:o}=this;r.opts.unevaluated&&(r.props!==!0&&t.props!==void 0&&(r.props=kn.mergeEvaluated.props(o,t.props,r.props,n)),r.items!==!0&&t.items!==void 0&&(r.items=kn.mergeEvaluated.items(o,t.items,r.items,n)))}mergeValidEvaluated(t,n){const{it:r,gen:o}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return o.if(n,()=>this.mergeEvaluated(t,pe.Name)),!0}}Yt.KeywordCxt=zd;function Wd(e,t,n,r){const o=new zd(e,n,t);"code"in n?n.code(o,r):o.$data&&n.validate?(0,uo.funcKeywordCode)(o,n):"macro"in n?(0,uo.macroKeywordCode)(o,n):(n.compile||n.validate)&&(0,uo.funcKeywordCode)(o,n)}const Mv=/^\/(?:[^~]|~0|~1)*$/,Bv=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Qd(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let o,a;if(e==="")return Oe.default.rootData;if(e[0]==="/"){if(!Mv.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,a=Oe.default.rootData}else{const u=Bv.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);const h=+u[1];if(o=u[2],o==="#"){if(h>=t)throw new Error(d("property/index",h));return r[t-h]}if(h>t)throw new Error(d("data",h));if(a=n[t-h],!o)return a}let s=a;const c=o.split("/");for(const u of c)u&&(a=(0,pe._)`${a}${(0,pe.getProperty)((0,kn.unescapeJsonPointer)(u))}`,s=(0,pe._)`${s} && ${a}`);return s;function d(u,h){return`Cannot access ${u} ${h} levels up, current level is ${t}`}}Yt.getData=Qd;var po={};Object.defineProperty(po,"__esModule",{value:!0});class Rv extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}po.default=Rv;var mo={};Object.defineProperty(mo,"__esModule",{value:!0});const Xs=yt;class Fv extends Error{constructor(t,n,r,o){super(o||`can't resolve reference ${r} from id ${n}`),this.missingRef=(0,Xs.resolveUrl)(t,n,r),this.missingSchema=(0,Xs.normalizeId)((0,Xs.getFullPath)(t,this.missingRef))}}mo.default=Fv;var jt={};Object.defineProperty(jt,"__esModule",{value:!0}),jt.resolveSchema=jt.getCompilingSchema=jt.resolveRef=jt.compileSchema=jt.SchemaEnv=void 0;const Jt=Pe,Vv=po,rr=ln,Xt=yt,Yd=Me,Uv=Yt;class li{constructor(t){var n;this.refs={},this.dynamicAnchors={};let r;typeof t.schema=="object"&&(r=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(n=t.baseId)!==null&&n!==void 0?n:(0,Xt.normalizeId)(r==null?void 0:r[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=r==null?void 0:r.$async,this.refs={}}}jt.SchemaEnv=li;function Zs(e){const t=Jd.call(this,e);if(t)return t;const n=(0,Xt.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:r,lines:o}=this.opts.code,{ownProperties:a}=this.opts,s=new Jt.CodeGen(this.scope,{es5:r,lines:o,ownProperties:a});let c;e.$async&&(c=s.scopeValue("Error",{ref:Vv.default,code:(0,Jt._)`require("ajv/dist/runtime/validation_error").default`}));const d=s.scopeName("validate");e.validateName=d;const u={gen:s,allErrors:this.opts.allErrors,data:rr.default.data,parentData:rr.default.parentData,parentDataProperty:rr.default.parentDataProperty,dataNames:[rr.default.data],dataPathArr:[Jt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Jt.stringify)(e.schema)}:{ref:e.schema}),validateName:d,ValidationError:c,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:Jt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Jt._)`""`,opts:this.opts,self:this};let h;try{this._compilations.add(e),(0,Uv.validateFunctionCode)(u),s.optimize(this.opts.code.optimize);const l=s.toString();h=`${s.scopeRefs(rr.default.scope)}return ${l}`,this.opts.code.process&&(h=this.opts.code.process(h,e));const m=new Function(`${rr.default.self}`,`${rr.default.scope}`,h)(this,this.scope.get());if(this.scope.value(d,{ref:m}),m.errors=null,m.schema=e.schema,m.schemaEnv=e,e.$async&&(m.$async=!0),this.opts.code.source===!0&&(m.source={validateName:d,validateCode:l,scopeValues:s._values}),this.opts.unevaluated){const{props:y,items:b}=u;m.evaluated={props:y instanceof Jt.Name?void 0:y,items:b instanceof Jt.Name?void 0:b,dynamicProps:y instanceof Jt.Name,dynamicItems:b instanceof Jt.Name},m.source&&(m.source.evaluated=(0,Jt.stringify)(m.evaluated))}return e.validate=m,e}catch(l){throw delete e.validate,delete e.validateName,h&&this.logger.error("Error compiling schema, function code:",h),l}finally{this._compilations.delete(e)}}jt.compileSchema=Zs;function qv(e,t,n){var r;n=(0,Xt.resolveUrl)(this.opts.uriResolver,t,n);const o=e.refs[n];if(o)return o;let a=Gv.call(this,e,n);if(a===void 0){const s=(r=e.localRefs)===null||r===void 0?void 0:r[n],{schemaId:c}=this.opts;s&&(a=new li({schema:s,schemaId:c,root:e,baseId:t}))}if(a!==void 0)return e.refs[n]=Hv.call(this,a)}jt.resolveRef=qv;function Hv(e){return(0,Xt.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Zs.call(this,e)}function Jd(e){for(const t of this._compilations)if(Kv(t,e))return t}jt.getCompilingSchema=Jd;function Kv(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Gv(e,t){let n;for(;typeof(n=this.refs[t])=="string";)t=n;return n||this.schemas[t]||ci.call(this,e,t)}function ci(e,t){const n=this.opts.uriResolver.parse(t),r=(0,Xt._getFullPath)(this.opts.uriResolver,n);let o=(0,Xt.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===o)return ea.call(this,n,e);const a=(0,Xt.normalizeId)(r),s=this.refs[a]||this.schemas[a];if(typeof s=="string"){const c=ci.call(this,e,s);return typeof(c==null?void 0:c.schema)!="object"?void 0:ea.call(this,n,c)}if(typeof(s==null?void 0:s.schema)=="object"){if(s.validate||Zs.call(this,s),a===(0,Xt.normalizeId)(t)){const{schema:c}=s,{schemaId:d}=this.opts,u=c[d];return u&&(o=(0,Xt.resolveUrl)(this.opts.uriResolver,o,u)),new li({schema:c,schemaId:d,root:e,baseId:o})}return ea.call(this,n,s)}}jt.resolveSchema=ci;const zv=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function ea(e,{baseId:t,schema:n,root:r}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(const c of e.fragment.slice(1).split("/")){if(typeof n=="boolean")return;const d=n[(0,Yd.unescapeFragment)(c)];if(d===void 0)return;n=d;const u=typeof n=="object"&&n[this.opts.schemaId];!zv.has(c)&&u&&(t=(0,Xt.resolveUrl)(this.opts.uriResolver,t,u))}let a;if(typeof n!="boolean"&&n.$ref&&!(0,Yd.schemaHasRulesButRef)(n,this.RULES)){const c=(0,Xt.resolveUrl)(this.opts.uriResolver,t,n.$ref);a=ci.call(this,r,c)}const{schemaId:s}=this.opts;if(a=a||new li({schema:n,schemaId:s,root:r,baseId:t}),a.schema!==a.root.schema)return a}const Wv={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1};var ta={},na={exports:{}};/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */(function(e,t){(function(n,r){r(t)})(wt,function(n){function r(){for(var N=arguments.length,A=Array(N),x=0;x<N;x++)A[x]=arguments[x];if(A.length>1){A[0]=A[0].slice(0,-1);for(var K=A.length-1,q=1;q<K;++q)A[q]=A[q].slice(1,-1);return A[K]=A[K].slice(1),A.join("")}else return A[0]}function o(N){return"(?:"+N+")"}function a(N){return N===void 0?"undefined":N===null?"null":Object.prototype.toString.call(N).split(" ").pop().split("]").shift().toLowerCase()}function s(N){return N.toUpperCase()}function c(N){return N!=null?N instanceof Array?N:typeof N.length!="number"||N.split||N.setInterval||N.call?[N]:Array.prototype.slice.call(N):[]}function d(N,A){var x=N;if(A)for(var K in A)x[K]=A[K];return x}function u(N){var A="[A-Za-z]",x="[0-9]",K=r(x,"[A-Fa-f]"),q=o(o("%[EFef]"+K+"%"+K+K+"%"+K+K)+"|"+o("%[89A-Fa-f]"+K+"%"+K+K)+"|"+o("%"+K+K)),me="[\\:\\/\\?\\#\\[\\]\\@]",he="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",xe=r(me,he),He=N?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Ye=N?"[\\uE000-\\uF8FF]":"[]",de=r(A,x,"[\\-\\.\\_\\~]",He);o(A+r(A,x,"[\\+\\-\\.]")+"*"),o(o(q+"|"+r(de,he,"[\\:]"))+"*");var Ue=o(o("25[0-5]")+"|"+o("2[0-4]"+x)+"|"+o("1"+x+x)+"|"+o("0?[1-9]"+x)+"|0?0?"+x),k=o(Ue+"\\."+Ue+"\\."+Ue+"\\."+Ue),w=o(K+"{1,4}"),ye=o(o(w+"\\:"+w)+"|"+k),Re=o(o(w+"\\:")+"{6}"+ye),Ge=o("\\:\\:"+o(w+"\\:")+"{5}"+ye),Gn=o(o(w)+"?\\:\\:"+o(w+"\\:")+"{4}"+ye),hn=o(o(o(w+"\\:")+"{0,1}"+w)+"?\\:\\:"+o(w+"\\:")+"{3}"+ye),yn=o(o(o(w+"\\:")+"{0,2}"+w)+"?\\:\\:"+o(w+"\\:")+"{2}"+ye),Kr=o(o(o(w+"\\:")+"{0,3}"+w)+"?\\:\\:"+w+"\\:"+ye),pr=o(o(o(w+"\\:")+"{0,4}"+w)+"?\\:\\:"+ye),Gt=o(o(o(w+"\\:")+"{0,5}"+w)+"?\\:\\:"+w),gn=o(o(o(w+"\\:")+"{0,6}"+w)+"?\\:\\:"),mr=o([Re,Ge,Gn,hn,yn,Kr,pr,Gt,gn].join("|")),Pn=o(o(de+"|"+q)+"+");o("[vV]"+K+"+\\."+r(de,he,"[\\:]")+"+"),o(o(q+"|"+r(de,he))+"*");var Oo=o(q+"|"+r(de,he,"[\\:\\@]"));return o(o(q+"|"+r(de,he,"[\\@]"))+"+"),o(o(Oo+"|"+r("[\\/\\?]",Ye))+"*"),{NOT_SCHEME:new RegExp(r("[^]",A,x,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(r("[^\\%\\:]",de,he),"g"),NOT_HOST:new RegExp(r("[^\\%\\[\\]\\:]",de,he),"g"),NOT_PATH:new RegExp(r("[^\\%\\/\\:\\@]",de,he),"g"),NOT_PATH_NOSCHEME:new RegExp(r("[^\\%\\/\\@]",de,he),"g"),NOT_QUERY:new RegExp(r("[^\\%]",de,he,"[\\:\\@\\/\\?]",Ye),"g"),NOT_FRAGMENT:new RegExp(r("[^\\%]",de,he,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(r("[^]",de,he),"g"),UNRESERVED:new RegExp(de,"g"),OTHER_CHARS:new RegExp(r("[^\\%]",de,xe),"g"),PCT_ENCODED:new RegExp(q,"g"),IPV4ADDRESS:new RegExp("^("+k+")$"),IPV6ADDRESS:new RegExp("^\\[?("+mr+")"+o(o("\\%25|\\%(?!"+K+"{2})")+"("+Pn+")")+"?\\]?$")}}var h=u(!1),l=u(!0),f=function(){function N(A,x){var K=[],q=!0,me=!1,he=void 0;try{for(var xe=A[Symbol.iterator](),He;!(q=(He=xe.next()).done)&&(K.push(He.value),!(x&&K.length===x));q=!0);}catch(Ye){me=!0,he=Ye}finally{try{!q&&xe.return&&xe.return()}finally{if(me)throw he}}return K}return function(A,x){if(Array.isArray(A))return A;if(Symbol.iterator in Object(A))return N(A,x);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),m=function(N){if(Array.isArray(N)){for(var A=0,x=Array(N.length);A<N.length;A++)x[A]=N[A];return x}else return Array.from(N)},y=2147483647,b=36,S=1,T=26,I=38,D=700,R=72,F=128,L="-",P=/^xn--/,Y=/[^\0-\x7E]/,W=/[\x2E\u3002\uFF0E\uFF61]/g,X={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},G=b-S,z=Math.floor,Q=String.fromCharCode;function te(N){throw new RangeError(X[N])}function ke(N,A){for(var x=[],K=N.length;K--;)x[K]=A(N[K]);return x}function Ne(N,A){var x=N.split("@"),K="";x.length>1&&(K=x[0]+"@",N=x[1]),N=N.replace(W,".");var q=N.split("."),me=ke(q,A).join(".");return K+me}function Ze(N){for(var A=[],x=0,K=N.length;x<K;){var q=N.charCodeAt(x++);if(q>=55296&&q<=56319&&x<K){var me=N.charCodeAt(x++);(me&64512)==56320?A.push(((q&1023)<<10)+(me&1023)+65536):(A.push(q),x--)}else A.push(q)}return A}var qe=function(A){return String.fromCodePoint.apply(String,m(A))},nt=function(A){return A-48<10?A-22:A-65<26?A-65:A-97<26?A-97:b},j=function(A,x){return A+22+75*(A<26)-((x!=0)<<5)},g=function(A,x,K){var q=0;for(A=K?z(A/D):A>>1,A+=z(A/x);A>G*T>>1;q+=b)A=z(A/G);return z(q+(G+1)*A/(A+I))},E=function(A){var x=[],K=A.length,q=0,me=F,he=R,xe=A.lastIndexOf(L);xe<0&&(xe=0);for(var He=0;He<xe;++He)A.charCodeAt(He)>=128&&te("not-basic"),x.push(A.charCodeAt(He));for(var Ye=xe>0?xe+1:0;Ye<K;){for(var de=q,Ue=1,k=b;;k+=b){Ye>=K&&te("invalid-input");var w=nt(A.charCodeAt(Ye++));(w>=b||w>z((y-q)/Ue))&&te("overflow"),q+=w*Ue;var ye=k<=he?S:k>=he+T?T:k-he;if(w<ye)break;var Re=b-ye;Ue>z(y/Re)&&te("overflow"),Ue*=Re}var Ge=x.length+1;he=g(q-de,Ge,de==0),z(q/Ge)>y-me&&te("overflow"),me+=z(q/Ge),q%=Ge,x.splice(q++,0,me)}return String.fromCodePoint.apply(String,x)},$=function(A){var x=[];A=Ze(A);var K=A.length,q=F,me=0,he=R,xe=!0,He=!1,Ye=void 0;try{for(var de=A[Symbol.iterator](),Ue;!(xe=(Ue=de.next()).done);xe=!0){var k=Ue.value;k<128&&x.push(Q(k))}}catch(Ao){He=!0,Ye=Ao}finally{try{!xe&&de.return&&de.return()}finally{if(He)throw Ye}}var w=x.length,ye=w;for(w&&x.push(L);ye<K;){var Re=y,Ge=!0,Gn=!1,hn=void 0;try{for(var yn=A[Symbol.iterator](),Kr;!(Ge=(Kr=yn.next()).done);Ge=!0){var pr=Kr.value;pr>=q&&pr<Re&&(Re=pr)}}catch(Ao){Gn=!0,hn=Ao}finally{try{!Ge&&yn.return&&yn.return()}finally{if(Gn)throw hn}}var Gt=ye+1;Re-q>z((y-me)/Gt)&&te("overflow"),me+=(Re-q)*Gt,q=Re;var gn=!0,mr=!1,Pn=void 0;try{for(var Oo=A[Symbol.iterator](),up;!(gn=(up=Oo.next()).done);gn=!0){var dp=up.value;if(dp<q&&++me>y&&te("overflow"),dp==q){for(var Bi=me,Ri=b;;Ri+=b){var Fi=Ri<=he?S:Ri>=he+T?T:Ri-he;if(Bi<Fi)break;var fp=Bi-Fi,pp=b-Fi;x.push(Q(j(Fi+fp%pp,0))),Bi=z(fp/pp)}x.push(Q(j(Bi,0))),he=g(me,Gt,ye==w),me=0,++ye}}}catch(Ao){mr=!0,Pn=Ao}finally{try{!gn&&Oo.return&&Oo.return()}finally{if(mr)throw Pn}}++me,++q}return x.join("")},_=function(A){return Ne(A,function(x){return P.test(x)?E(x.slice(4).toLowerCase()):x})},v=function(A){return Ne(A,function(x){return Y.test(x)?"xn--"+$(x):x})},C={version:"2.1.0",ucs2:{decode:Ze,encode:qe},decode:E,encode:$,toASCII:v,toUnicode:_},M={};function U(N){var A=N.charCodeAt(0),x=void 0;return A<16?x="%0"+A.toString(16).toUpperCase():A<128?x="%"+A.toString(16).toUpperCase():A<2048?x="%"+(A>>6|192).toString(16).toUpperCase()+"%"+(A&63|128).toString(16).toUpperCase():x="%"+(A>>12|224).toString(16).toUpperCase()+"%"+(A>>6&63|128).toString(16).toUpperCase()+"%"+(A&63|128).toString(16).toUpperCase(),x}function ne(N){for(var A="",x=0,K=N.length;x<K;){var q=parseInt(N.substr(x+1,2),16);if(q<128)A+=String.fromCharCode(q),x+=3;else if(q>=194&&q<224){if(K-x>=6){var me=parseInt(N.substr(x+4,2),16);A+=String.fromCharCode((q&31)<<6|me&63)}else A+=N.substr(x,6);x+=6}else if(q>=224){if(K-x>=9){var he=parseInt(N.substr(x+4,2),16),xe=parseInt(N.substr(x+7,2),16);A+=String.fromCharCode((q&15)<<12|(he&63)<<6|xe&63)}else A+=N.substr(x,9);x+=9}else A+=N.substr(x,3),x+=3}return A}function ee(N,A){function x(K){var q=ne(K);return q.match(A.UNRESERVED)?q:K}return N.scheme&&(N.scheme=String(N.scheme).replace(A.PCT_ENCODED,x).toLowerCase().replace(A.NOT_SCHEME,"")),N.userinfo!==void 0&&(N.userinfo=String(N.userinfo).replace(A.PCT_ENCODED,x).replace(A.NOT_USERINFO,U).replace(A.PCT_ENCODED,s)),N.host!==void 0&&(N.host=String(N.host).replace(A.PCT_ENCODED,x).toLowerCase().replace(A.NOT_HOST,U).replace(A.PCT_ENCODED,s)),N.path!==void 0&&(N.path=String(N.path).replace(A.PCT_ENCODED,x).replace(N.scheme?A.NOT_PATH:A.NOT_PATH_NOSCHEME,U).replace(A.PCT_ENCODED,s)),N.query!==void 0&&(N.query=String(N.query).replace(A.PCT_ENCODED,x).replace(A.NOT_QUERY,U).replace(A.PCT_ENCODED,s)),N.fragment!==void 0&&(N.fragment=String(N.fragment).replace(A.PCT_ENCODED,x).replace(A.NOT_FRAGMENT,U).replace(A.PCT_ENCODED,s)),N}function re(N){return N.replace(/^0*(.*)/,"$1")||"0"}function Ee(N,A){var x=N.match(A.IPV4ADDRESS)||[],K=f(x,2),q=K[1];return q?q.split(".").map(re).join("."):N}function B(N,A){var x=N.match(A.IPV6ADDRESS)||[],K=f(x,3),q=K[1],me=K[2];if(q){for(var he=q.toLowerCase().split("::").reverse(),xe=f(he,2),He=xe[0],Ye=xe[1],de=Ye?Ye.split(":").map(re):[],Ue=He.split(":").map(re),k=A.IPV4ADDRESS.test(Ue[Ue.length-1]),w=k?7:8,ye=Ue.length-w,Re=Array(w),Ge=0;Ge<w;++Ge)Re[Ge]=de[Ge]||Ue[ye+Ge]||"";k&&(Re[w-1]=Ee(Re[w-1],A));var Gn=Re.reduce(function(Gt,gn,mr){if(!gn||gn==="0"){var Pn=Gt[Gt.length-1];Pn&&Pn.index+Pn.length===mr?Pn.length++:Gt.push({index:mr,length:1})}return Gt},[]),hn=Gn.sort(function(Gt,gn){return gn.length-Gt.length})[0],yn=void 0;if(hn&&hn.length>1){var Kr=Re.slice(0,hn.index),pr=Re.slice(hn.index+hn.length);yn=Kr.join(":")+"::"+pr.join(":")}else yn=Re.join(":");return me&&(yn+="%"+me),yn}else return N}var J=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,fe="".match(/(){0}/)[1]===void 0;function ce(N){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},x={},K=A.iri!==!1?l:h;A.reference==="suffix"&&(N=(A.scheme?A.scheme+":":"")+"//"+N);var q=N.match(J);if(q){fe?(x.scheme=q[1],x.userinfo=q[3],x.host=q[4],x.port=parseInt(q[5],10),x.path=q[6]||"",x.query=q[7],x.fragment=q[8],isNaN(x.port)&&(x.port=q[5])):(x.scheme=q[1]||void 0,x.userinfo=N.indexOf("@")!==-1?q[3]:void 0,x.host=N.indexOf("//")!==-1?q[4]:void 0,x.port=parseInt(q[5],10),x.path=q[6]||"",x.query=N.indexOf("?")!==-1?q[7]:void 0,x.fragment=N.indexOf("#")!==-1?q[8]:void 0,isNaN(x.port)&&(x.port=N.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?q[4]:void 0)),x.host&&(x.host=B(Ee(x.host,K),K)),x.scheme===void 0&&x.userinfo===void 0&&x.host===void 0&&x.port===void 0&&!x.path&&x.query===void 0?x.reference="same-document":x.scheme===void 0?x.reference="relative":x.fragment===void 0?x.reference="absolute":x.reference="uri",A.reference&&A.reference!=="suffix"&&A.reference!==x.reference&&(x.error=x.error||"URI is not a "+A.reference+" reference.");var me=M[(A.scheme||x.scheme||"").toLowerCase()];if(!A.unicodeSupport&&(!me||!me.unicodeSupport)){if(x.host&&(A.domainHost||me&&me.domainHost))try{x.host=C.toASCII(x.host.replace(K.PCT_ENCODED,ne).toLowerCase())}catch(he){x.error=x.error||"Host's domain name can not be converted to ASCII via punycode: "+he}ee(x,h)}else ee(x,K);me&&me.parse&&me.parse(x,A)}else x.error=x.error||"URI can not be parsed.";return x}function be(N,A){var x=A.iri!==!1?l:h,K=[];return N.userinfo!==void 0&&(K.push(N.userinfo),K.push("@")),N.host!==void 0&&K.push(B(Ee(String(N.host),x),x).replace(x.IPV6ADDRESS,function(q,me,he){return"["+me+(he?"%25"+he:"")+"]"})),(typeof N.port=="number"||typeof N.port=="string")&&(K.push(":"),K.push(String(N.port))),K.length?K.join(""):void 0}var Se=/^\.\.?\//,Le=/^\/\.(\/|$)/,Qe=/^\/\.\.(\/|$)/,We=/^\/?(?:.|\n)*?(?=\/|$)/;function Ce(N){for(var A=[];N.length;)if(N.match(Se))N=N.replace(Se,"");else if(N.match(Le))N=N.replace(Le,"/");else if(N.match(Qe))N=N.replace(Qe,"/"),A.pop();else if(N==="."||N==="..")N="";else{var x=N.match(We);if(x){var K=x[0];N=N.slice(K.length),A.push(K)}else throw new Error("Unexpected dot segment condition")}return A.join("")}function H(N){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},x=A.iri?l:h,K=[],q=M[(A.scheme||N.scheme||"").toLowerCase()];if(q&&q.serialize&&q.serialize(N,A),N.host&&!x.IPV6ADDRESS.test(N.host)){if(A.domainHost||q&&q.domainHost)try{N.host=A.iri?C.toUnicode(N.host):C.toASCII(N.host.replace(x.PCT_ENCODED,ne).toLowerCase())}catch(xe){N.error=N.error||"Host's domain name can not be converted to "+(A.iri?"Unicode":"ASCII")+" via punycode: "+xe}}ee(N,x),A.reference!=="suffix"&&N.scheme&&(K.push(N.scheme),K.push(":"));var me=be(N,A);if(me!==void 0&&(A.reference!=="suffix"&&K.push("//"),K.push(me),N.path&&N.path.charAt(0)!=="/"&&K.push("/")),N.path!==void 0){var he=N.path;!A.absolutePath&&(!q||!q.absolutePath)&&(he=Ce(he)),me===void 0&&(he=he.replace(/^\/\//,"/%2F")),K.push(he)}return N.query!==void 0&&(K.push("?"),K.push(N.query)),N.fragment!==void 0&&(K.push("#"),K.push(N.fragment)),K.join("")}function oe(N,A){var x=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},K=arguments[3],q={};return K||(N=ce(H(N,x),x),A=ce(H(A,x),x)),x=x||{},!x.tolerant&&A.scheme?(q.scheme=A.scheme,q.userinfo=A.userinfo,q.host=A.host,q.port=A.port,q.path=Ce(A.path||""),q.query=A.query):(A.userinfo!==void 0||A.host!==void 0||A.port!==void 0?(q.userinfo=A.userinfo,q.host=A.host,q.port=A.port,q.path=Ce(A.path||""),q.query=A.query):(A.path?(A.path.charAt(0)==="/"?q.path=Ce(A.path):((N.userinfo!==void 0||N.host!==void 0||N.port!==void 0)&&!N.path?q.path="/"+A.path:N.path?q.path=N.path.slice(0,N.path.lastIndexOf("/")+1)+A.path:q.path=A.path,q.path=Ce(q.path)),q.query=A.query):(q.path=N.path,A.query!==void 0?q.query=A.query:q.query=N.query),q.userinfo=N.userinfo,q.host=N.host,q.port=N.port),q.scheme=N.scheme),q.fragment=A.fragment,q}function ie(N,A,x){var K=d({scheme:"null"},x);return H(oe(ce(N,K),ce(A,K),K,!0),K)}function ue(N,A){return typeof N=="string"?N=H(ce(N,A),A):a(N)==="object"&&(N=ce(H(N,A),A)),N}function _e(N,A,x){return typeof N=="string"?N=H(ce(N,x),x):a(N)==="object"&&(N=H(N,x)),typeof A=="string"?A=H(ce(A,x),x):a(A)==="object"&&(A=H(A,x)),N===A}function $e(N,A){return N&&N.toString().replace(!A||!A.iri?h.ESCAPE:l.ESCAPE,U)}function we(N,A){return N&&N.toString().replace(!A||!A.iri?h.PCT_ENCODED:l.PCT_ENCODED,ne)}var lt={scheme:"http",domainHost:!0,parse:function(A,x){return A.host||(A.error=A.error||"HTTP URIs must have a host."),A},serialize:function(A,x){var K=String(A.scheme).toLowerCase()==="https";return(A.port===(K?443:80)||A.port==="")&&(A.port=void 0),A.path||(A.path="/"),A}},Bt={scheme:"https",domainHost:lt.domainHost,parse:lt.parse,serialize:lt.serialize};function Rt(N){return typeof N.secure=="boolean"?N.secure:String(N.scheme).toLowerCase()==="wss"}var Ot={scheme:"ws",domainHost:!0,parse:function(A,x){var K=A;return K.secure=Rt(K),K.resourceName=(K.path||"/")+(K.query?"?"+K.query:""),K.path=void 0,K.query=void 0,K},serialize:function(A,x){if((A.port===(Rt(A)?443:80)||A.port==="")&&(A.port=void 0),typeof A.secure=="boolean"&&(A.scheme=A.secure?"wss":"ws",A.secure=void 0),A.resourceName){var K=A.resourceName.split("?"),q=f(K,2),me=q[0],he=q[1];A.path=me&&me!=="/"?me:void 0,A.query=he,A.resourceName=void 0}return A.fragment=void 0,A}},ur={scheme:"wss",domainHost:Ot.domainHost,parse:Ot.parse,serialize:Ot.serialize},$o={},dr="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",At="[0-9A-Fa-f]",Vr=o(o("%[EFef]"+At+"%"+At+At+"%"+At+At)+"|"+o("%[89A-Fa-f]"+At+"%"+At+At)+"|"+o("%"+At+At)),An="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Ur="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",fr=r(Ur,'[\\"\\\\]'),rt="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",qr=new RegExp(dr,"g"),mn=new RegExp(Vr,"g"),In=new RegExp(r("[^]",An,"[\\.]",'[\\"]',fr),"g"),Nn=new RegExp(r("[^]",dr,rt),"g"),_t=Nn;function Hn(N){var A=ne(N);return A.match(qr)?A:N}var Kn={scheme:"mailto",parse:function(A,x){var K=A,q=K.to=K.path?K.path.split(","):[];if(K.path=void 0,K.query){for(var me=!1,he={},xe=K.query.split("&"),He=0,Ye=xe.length;He<Ye;++He){var de=xe[He].split("=");switch(de[0]){case"to":for(var Ue=de[1].split(","),k=0,w=Ue.length;k<w;++k)q.push(Ue[k]);break;case"subject":K.subject=we(de[1],x);break;case"body":K.body=we(de[1],x);break;default:me=!0,he[we(de[0],x)]=we(de[1],x);break}}me&&(K.headers=he)}K.query=void 0;for(var ye=0,Re=q.length;ye<Re;++ye){var Ge=q[ye].split("@");if(Ge[0]=we(Ge[0]),x.unicodeSupport)Ge[1]=we(Ge[1],x).toLowerCase();else try{Ge[1]=C.toASCII(we(Ge[1],x).toLowerCase())}catch(Gn){K.error=K.error||"Email address's domain name can not be converted to ASCII via punycode: "+Gn}q[ye]=Ge.join("@")}return K},serialize:function(A,x){var K=A,q=c(A.to);if(q){for(var me=0,he=q.length;me<he;++me){var xe=String(q[me]),He=xe.lastIndexOf("@"),Ye=xe.slice(0,He).replace(mn,Hn).replace(mn,s).replace(In,U),de=xe.slice(He+1);try{de=x.iri?C.toUnicode(de):C.toASCII(we(de,x).toLowerCase())}catch(ye){K.error=K.error||"Email address's domain name can not be converted to "+(x.iri?"Unicode":"ASCII")+" via punycode: "+ye}q[me]=Ye+"@"+de}K.path=q.join(",")}var Ue=A.headers=A.headers||{};A.subject&&(Ue.subject=A.subject),A.body&&(Ue.body=A.body);var k=[];for(var w in Ue)Ue[w]!==$o[w]&&k.push(w.replace(mn,Hn).replace(mn,s).replace(Nn,U)+"="+Ue[w].replace(mn,Hn).replace(mn,s).replace(_t,U));return k.length&&(K.query=k.join("&")),K}},Eo=/^([^\:]+)\:(.*)/,Hr={scheme:"urn",parse:function(A,x){var K=A.path&&A.path.match(Eo),q=A;if(K){var me=x.scheme||q.scheme||"urn",he=K[1].toLowerCase(),xe=K[2],He=me+":"+(x.nid||he),Ye=M[He];q.nid=he,q.nss=xe,q.path=void 0,Ye&&(q=Ye.parse(q,x))}else q.error=q.error||"URN can not be parsed.";return q},serialize:function(A,x){var K=x.scheme||A.scheme||"urn",q=A.nid,me=K+":"+(x.nid||q),he=M[me];he&&(A=he.serialize(A,x));var xe=A,He=A.nss;return xe.path=(q||x.nid)+":"+He,xe}},ot=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,O={scheme:"urn:uuid",parse:function(A,x){var K=A;return K.uuid=K.nss,K.nss=void 0,!x.tolerant&&(!K.uuid||!K.uuid.match(ot))&&(K.error=K.error||"UUID is not valid."),K},serialize:function(A,x){var K=A;return K.nss=(A.uuid||"").toLowerCase(),K}};M[lt.scheme]=lt,M[Bt.scheme]=Bt,M[Ot.scheme]=Ot,M[ur.scheme]=ur,M[Kn.scheme]=Kn,M[Hr.scheme]=Hr,M[O.scheme]=O,n.SCHEMES=M,n.pctEncChar=U,n.pctDecChars=ne,n.parse=ce,n.removeDotSegments=Ce,n.serialize=H,n.resolveComponents=oe,n.resolve=ie,n.normalize=ue,n.equal=_e,n.escapeComponent=$e,n.unescapeComponent=we,Object.defineProperty(n,"__esModule",{value:!0})})})(na,na.exports);var Qv=na.exports;Object.defineProperty(ta,"__esModule",{value:!0});const Xd=Qv;Xd.code='require("ajv/dist/runtime/uri").default',ta.default=Xd,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=Yt;Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var n=Pe;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return n.CodeGen}});const r=po,o=mo,a=tr,s=jt,c=Pe,d=yt,u=co,h=Me,l=Wv,f=ta,m=(j,g)=>new RegExp(j,g);m.code="new RegExp";const y=["removeAdditional","useDefaults","coerceTypes"],b=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),S={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},T={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},I=200;function D(j){var g,E,$,_,v,C,M,U,ne,ee,re,Ee,B,J,fe,ce,be,Se,Le,Qe,We,Ce,H,oe,ie;const ue=j.strict,_e=(g=j.code)===null||g===void 0?void 0:g.optimize,$e=_e===!0||_e===void 0?1:_e||0,we=($=(E=j.code)===null||E===void 0?void 0:E.regExp)!==null&&$!==void 0?$:m,lt=(_=j.uriResolver)!==null&&_!==void 0?_:f.default;return{strictSchema:(C=(v=j.strictSchema)!==null&&v!==void 0?v:ue)!==null&&C!==void 0?C:!0,strictNumbers:(U=(M=j.strictNumbers)!==null&&M!==void 0?M:ue)!==null&&U!==void 0?U:!0,strictTypes:(ee=(ne=j.strictTypes)!==null&&ne!==void 0?ne:ue)!==null&&ee!==void 0?ee:"log",strictTuples:(Ee=(re=j.strictTuples)!==null&&re!==void 0?re:ue)!==null&&Ee!==void 0?Ee:"log",strictRequired:(J=(B=j.strictRequired)!==null&&B!==void 0?B:ue)!==null&&J!==void 0?J:!1,code:j.code?{...j.code,optimize:$e,regExp:we}:{optimize:$e,regExp:we},loopRequired:(fe=j.loopRequired)!==null&&fe!==void 0?fe:I,loopEnum:(ce=j.loopEnum)!==null&&ce!==void 0?ce:I,meta:(be=j.meta)!==null&&be!==void 0?be:!0,messages:(Se=j.messages)!==null&&Se!==void 0?Se:!0,inlineRefs:(Le=j.inlineRefs)!==null&&Le!==void 0?Le:!0,schemaId:(Qe=j.schemaId)!==null&&Qe!==void 0?Qe:"$id",addUsedSchema:(We=j.addUsedSchema)!==null&&We!==void 0?We:!0,validateSchema:(Ce=j.validateSchema)!==null&&Ce!==void 0?Ce:!0,validateFormats:(H=j.validateFormats)!==null&&H!==void 0?H:!0,unicodeRegExp:(oe=j.unicodeRegExp)!==null&&oe!==void 0?oe:!0,int32range:(ie=j.int32range)!==null&&ie!==void 0?ie:!0,uriResolver:lt}}class R{constructor(g={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,g=this.opts={...g,...D(g)};const{es5:E,lines:$}=this.opts.code;this.scope=new c.ValueScope({scope:{},prefixes:b,es5:E,lines:$}),this.logger=z(g.logger);const _=g.validateFormats;g.validateFormats=!1,this.RULES=(0,a.getRules)(),F.call(this,S,g,"NOT SUPPORTED"),F.call(this,T,g,"DEPRECATED","warn"),this._metaOpts=X.call(this),g.formats&&Y.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),g.keywords&&W.call(this,g.keywords),typeof g.meta=="object"&&this.addMetaSchema(g.meta),P.call(this),g.validateFormats=_}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:g,meta:E,schemaId:$}=this.opts;let _=l;$==="id"&&(_={...l},_.id=_.$id,delete _.$id),E&&g&&this.addMetaSchema(_,_[$],!1)}defaultMeta(){const{meta:g,schemaId:E}=this.opts;return this.opts.defaultMeta=typeof g=="object"?g[E]||g:void 0}validate(g,E){let $;if(typeof g=="string"){if($=this.getSchema(g),!$)throw new Error(`no schema with key or ref "${g}"`)}else $=this.compile(g);const _=$(E);return"$async"in $||(this.errors=$.errors),_}compile(g,E){const $=this._addSchema(g,E);return $.validate||this._compileSchemaEnv($)}compileAsync(g,E){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:$}=this.opts;return _.call(this,g,E);async function _(ee,re){await v.call(this,ee.$schema);const Ee=this._addSchema(ee,re);return Ee.validate||C.call(this,Ee)}async function v(ee){ee&&!this.getSchema(ee)&&await _.call(this,{$ref:ee},!0)}async function C(ee){try{return this._compileSchemaEnv(ee)}catch(re){if(!(re instanceof o.default))throw re;return M.call(this,re),await U.call(this,re.missingSchema),C.call(this,ee)}}function M({missingSchema:ee,missingRef:re}){if(this.refs[ee])throw new Error(`AnySchema ${ee} is loaded but ${re} cannot be resolved`)}async function U(ee){const re=await ne.call(this,ee);this.refs[ee]||await v.call(this,re.$schema),this.refs[ee]||this.addSchema(re,ee,E)}async function ne(ee){const re=this._loading[ee];if(re)return re;try{return await(this._loading[ee]=$(ee))}finally{delete this._loading[ee]}}}addSchema(g,E,$,_=this.opts.validateSchema){if(Array.isArray(g)){for(const C of g)this.addSchema(C,void 0,$,_);return this}let v;if(typeof g=="object"){const{schemaId:C}=this.opts;if(v=g[C],v!==void 0&&typeof v!="string")throw new Error(`schema ${C} must be string`)}return E=(0,d.normalizeId)(E||v),this._checkUnique(E),this.schemas[E]=this._addSchema(g,$,E,_,!0),this}addMetaSchema(g,E,$=this.opts.validateSchema){return this.addSchema(g,E,!0,$),this}validateSchema(g,E){if(typeof g=="boolean")return!0;let $;if($=g.$schema,$!==void 0&&typeof $!="string")throw new Error("$schema must be a string");if($=$||this.opts.defaultMeta||this.defaultMeta(),!$)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const _=this.validate($,g);if(!_&&E){const v="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(v);else throw new Error(v)}return _}getSchema(g){let E;for(;typeof(E=L.call(this,g))=="string";)g=E;if(E===void 0){const{schemaId:$}=this.opts,_=new s.SchemaEnv({schema:{},schemaId:$});if(E=s.resolveSchema.call(this,_,g),!E)return;this.refs[g]=E}return E.validate||this._compileSchemaEnv(E)}removeSchema(g){if(g instanceof RegExp)return this._removeAllSchemas(this.schemas,g),this._removeAllSchemas(this.refs,g),this;switch(typeof g){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const E=L.call(this,g);return typeof E=="object"&&this._cache.delete(E.schema),delete this.schemas[g],delete this.refs[g],this}case"object":{const E=g;this._cache.delete(E);let $=g[this.opts.schemaId];return $&&($=(0,d.normalizeId)($),delete this.schemas[$],delete this.refs[$]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(g){for(const E of g)this.addKeyword(E);return this}addKeyword(g,E){let $;if(typeof g=="string")$=g,typeof E=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),E.keyword=$);else if(typeof g=="object"&&E===void 0){if(E=g,$=E.keyword,Array.isArray($)&&!$.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(te.call(this,$,E),!E)return(0,h.eachItem)($,v=>ke.call(this,v)),this;Ze.call(this,E);const _={...E,type:(0,u.getJSONTypes)(E.type),schemaType:(0,u.getJSONTypes)(E.schemaType)};return(0,h.eachItem)($,_.type.length===0?v=>ke.call(this,v,_):v=>_.type.forEach(C=>ke.call(this,v,_,C))),this}getKeyword(g){const E=this.RULES.all[g];return typeof E=="object"?E.definition:!!E}removeKeyword(g){const{RULES:E}=this;delete E.keywords[g],delete E.all[g];for(const $ of E.rules){const _=$.rules.findIndex(v=>v.keyword===g);_>=0&&$.rules.splice(_,1)}return this}addFormat(g,E){return typeof E=="string"&&(E=new RegExp(E)),this.formats[g]=E,this}errorsText(g=this.errors,{separator:E=", ",dataVar:$="data"}={}){return!g||g.length===0?"No errors":g.map(_=>`${$}${_.instancePath} ${_.message}`).reduce((_,v)=>_+E+v)}$dataMetaSchema(g,E){const $=this.RULES.all;g=JSON.parse(JSON.stringify(g));for(const _ of E){const v=_.split("/").slice(1);let C=g;for(const M of v)C=C[M];for(const M in $){const U=$[M];if(typeof U!="object")continue;const{$data:ne}=U.definition,ee=C[M];ne&&ee&&(C[M]=nt(ee))}}return g}_removeAllSchemas(g,E){for(const $ in g){const _=g[$];(!E||E.test($))&&(typeof _=="string"?delete g[$]:_&&!_.meta&&(this._cache.delete(_.schema),delete g[$]))}}_addSchema(g,E,$,_=this.opts.validateSchema,v=this.opts.addUsedSchema){let C;const{schemaId:M}=this.opts;if(typeof g=="object")C=g[M];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof g!="boolean")throw new Error("schema must be object or boolean")}let U=this._cache.get(g);if(U!==void 0)return U;$=(0,d.normalizeId)(C||$);const ne=d.getSchemaRefs.call(this,g,$);return U=new s.SchemaEnv({schema:g,schemaId:M,meta:E,baseId:$,localRefs:ne}),this._cache.set(U.schema,U),v&&!$.startsWith("#")&&($&&this._checkUnique($),this.refs[$]=U),_&&this.validateSchema(g,!0),U}_checkUnique(g){if(this.schemas[g]||this.refs[g])throw new Error(`schema with key or id "${g}" already exists`)}_compileSchemaEnv(g){if(g.meta?this._compileMetaSchema(g):s.compileSchema.call(this,g),!g.validate)throw new Error("ajv implementation error");return g.validate}_compileMetaSchema(g){const E=this.opts;this.opts=this._metaOpts;try{s.compileSchema.call(this,g)}finally{this.opts=E}}}e.default=R,R.ValidationError=r.default,R.MissingRefError=o.default;function F(j,g,E,$="error"){for(const _ in j){const v=_;v in g&&this.logger[$](`${E}: option ${_}. ${j[v]}`)}}function L(j){return j=(0,d.normalizeId)(j),this.schemas[j]||this.refs[j]}function P(){const j=this.opts.schemas;if(j)if(Array.isArray(j))this.addSchema(j);else for(const g in j)this.addSchema(j[g],g)}function Y(){for(const j in this.opts.formats){const g=this.opts.formats[j];g&&this.addFormat(j,g)}}function W(j){if(Array.isArray(j)){this.addVocabulary(j);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const g in j){const E=j[g];E.keyword||(E.keyword=g),this.addKeyword(E)}}function X(){const j={...this.opts};for(const g of y)delete j[g];return j}const G={log(){},warn(){},error(){}};function z(j){if(j===!1)return G;if(j===void 0)return console;if(j.log&&j.warn&&j.error)return j;throw new Error("logger must implement log, warn and error methods")}const Q=/^[a-z_$][a-z0-9_$:-]*$/i;function te(j,g){const{RULES:E}=this;if((0,h.eachItem)(j,$=>{if(E.keywords[$])throw new Error(`Keyword ${$} is already defined`);if(!Q.test($))throw new Error(`Keyword ${$} has invalid name`)}),!!g&&g.$data&&!("code"in g||"validate"in g))throw new Error('$data keyword must have "code" or "validate" function')}function ke(j,g,E){var $;const _=g==null?void 0:g.post;if(E&&_)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:v}=this;let C=_?v.post:v.rules.find(({type:U})=>U===E);if(C||(C={type:E,rules:[]},v.rules.push(C)),v.keywords[j]=!0,!g)return;const M={keyword:j,definition:{...g,type:(0,u.getJSONTypes)(g.type),schemaType:(0,u.getJSONTypes)(g.schemaType)}};g.before?Ne.call(this,C,M,g.before):C.rules.push(M),v.all[j]=M,($=g.implements)===null||$===void 0||$.forEach(U=>this.addKeyword(U))}function Ne(j,g,E){const $=j.rules.findIndex(_=>_.keyword===E);$>=0?j.rules.splice($,0,g):(j.rules.push(g),this.logger.warn(`rule ${E} is not defined`))}function Ze(j){let{metaSchema:g}=j;g!==void 0&&(j.$data&&this.opts.$data&&(g=nt(g)),j.validateSchema=this.compile(g,!0))}const qe={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function nt(j){return{anyOf:[j,qe]}}}(Td);var ra={},oa={},ia={};Object.defineProperty(ia,"__esModule",{value:!0});const Yv={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};ia.default=Yv;var or={};Object.defineProperty(or,"__esModule",{value:!0}),or.callRef=or.getValidate=void 0;const Jv=mo,Zd=je,xt=Pe,Ir=ln,ef=jt,ui=Me,Xv={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:n,it:r}=e,{baseId:o,schemaEnv:a,validateName:s,opts:c,self:d}=r,{root:u}=a;if((n==="#"||n==="#/")&&o===u.baseId)return l();const h=ef.resolveRef.call(d,u,o,n);if(h===void 0)throw new Jv.default(r.opts.uriResolver,o,n);if(h instanceof ef.SchemaEnv)return f(h);return m(h);function l(){if(a===u)return di(e,s,a,a.$async);const y=t.scopeValue("root",{ref:u});return di(e,(0,xt._)`${y}.validate`,u,u.$async)}function f(y){const b=tf(e,y);di(e,b,y,y.$async)}function m(y){const b=t.scopeValue("schema",c.code.source===!0?{ref:y,code:(0,xt.stringify)(y)}:{ref:y}),S=t.name("valid"),T=e.subschema({schema:y,dataTypes:[],schemaPath:xt.nil,topSchemaRef:b,errSchemaPath:n},S);e.mergeEvaluated(T),e.ok(S)}}};function tf(e,t){const{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):(0,xt._)`${n.scopeValue("wrapper",{ref:t})}.validate`}or.getValidate=tf;function di(e,t,n,r){const{gen:o,it:a}=e,{allErrors:s,schemaEnv:c,opts:d}=a,u=d.passContext?Ir.default.this:xt.nil;r?h():l();function h(){if(!c.$async)throw new Error("async schema referenced by sync schema");const y=o.let("valid");o.try(()=>{o.code((0,xt._)`await ${(0,Zd.callValidateCode)(e,t,u)}`),m(t),s||o.assign(y,!0)},b=>{o.if((0,xt._)`!(${b} instanceof ${a.ValidationError})`,()=>o.throw(b)),f(b),s||o.assign(y,!1)}),e.ok(y)}function l(){e.result((0,Zd.callValidateCode)(e,t,u),()=>m(t),()=>f(t))}function f(y){const b=(0,xt._)`${y}.errors`;o.assign(Ir.default.vErrors,(0,xt._)`${Ir.default.vErrors} === null ? ${b} : ${Ir.default.vErrors}.concat(${b})`),o.assign(Ir.default.errors,(0,xt._)`${Ir.default.vErrors}.length`)}function m(y){var b;if(!a.opts.unevaluated)return;const S=(b=n==null?void 0:n.validate)===null||b===void 0?void 0:b.evaluated;if(a.props!==!0)if(S&&!S.dynamicProps)S.props!==void 0&&(a.props=ui.mergeEvaluated.props(o,S.props,a.props));else{const T=o.var("props",(0,xt._)`${y}.evaluated.props`);a.props=ui.mergeEvaluated.props(o,T,a.props,xt.Name)}if(a.items!==!0)if(S&&!S.dynamicItems)S.items!==void 0&&(a.items=ui.mergeEvaluated.items(o,S.items,a.items));else{const T=o.var("items",(0,xt._)`${y}.evaluated.items`);a.items=ui.mergeEvaluated.items(o,T,a.items,xt.Name)}}}or.callRef=di,or.default=Xv,Object.defineProperty(oa,"__esModule",{value:!0});const Zv=ia,e0=or,t0=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Zv.default,e0.default];oa.default=t0;var sa={},aa={};Object.defineProperty(aa,"__esModule",{value:!0});const fi=Pe,Fn=fi.operators,pi={maximum:{okStr:"<=",ok:Fn.LTE,fail:Fn.GT},minimum:{okStr:">=",ok:Fn.GTE,fail:Fn.LT},exclusiveMaximum:{okStr:"<",ok:Fn.LT,fail:Fn.GTE},exclusiveMinimum:{okStr:">",ok:Fn.GT,fail:Fn.LTE}},n0={message:({keyword:e,schemaCode:t})=>(0,fi.str)`must be ${pi[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,fi._)`{comparison: ${pi[e].okStr}, limit: ${t}}`},r0={keyword:Object.keys(pi),type:"number",schemaType:"number",$data:!0,error:n0,code(e){const{keyword:t,data:n,schemaCode:r}=e;e.fail$data((0,fi._)`${n} ${pi[t].fail} ${r} || isNaN(${n})`)}};aa.default=r0;var la={};Object.defineProperty(la,"__esModule",{value:!0});const ho=Pe,o0={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>(0,ho.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,ho._)`{multipleOf: ${e}}`},code(e){const{gen:t,data:n,schemaCode:r,it:o}=e,a=o.opts.multipleOfPrecision,s=t.let("res"),c=a?(0,ho._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${a}`:(0,ho._)`${s} !== parseInt(${s})`;e.fail$data((0,ho._)`(${r} === 0 || (${s} = ${n}/${r}, ${c}))`)}};la.default=o0;var ca={},ua={};Object.defineProperty(ua,"__esModule",{value:!0});function nf(e){const t=e.length;let n=0,r=0,o;for(;r<t;)n++,o=e.charCodeAt(r++),o>=55296&&o<=56319&&r<t&&(o=e.charCodeAt(r),(o&64512)===56320&&r++);return n}ua.default=nf,nf.code='require("ajv/dist/runtime/ucs2length").default',Object.defineProperty(ca,"__esModule",{value:!0});const ir=Pe,i0=Me,s0=ua,a0={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n=e==="maxLength"?"more":"fewer";return(0,ir.str)`must NOT have ${n} than ${t} characters`},params:({schemaCode:e})=>(0,ir._)`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:r,it:o}=e,a=t==="maxLength"?ir.operators.GT:ir.operators.LT,s=o.opts.unicode===!1?(0,ir._)`${n}.length`:(0,ir._)`${(0,i0.useFunc)(e.gen,s0.default)}(${n})`;e.fail$data((0,ir._)`${s} ${a} ${r}`)}};ca.default=a0;var da={};Object.defineProperty(da,"__esModule",{value:!0});const l0=je,mi=Pe,c0={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,mi.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,mi._)`{pattern: ${e}}`},code(e){const{data:t,$data:n,schema:r,schemaCode:o,it:a}=e,s=a.opts.unicodeRegExp?"u":"",c=n?(0,mi._)`(new RegExp(${o}, ${s}))`:(0,l0.usePattern)(e,r);e.fail$data((0,mi._)`!${c}.test(${t})`)}};da.default=c0;var fa={};Object.defineProperty(fa,"__esModule",{value:!0});const yo=Pe,u0={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n=e==="maxProperties"?"more":"fewer";return(0,yo.str)`must NOT have ${n} than ${t} properties`},params:({schemaCode:e})=>(0,yo._)`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:r}=e,o=t==="maxProperties"?yo.operators.GT:yo.operators.LT;e.fail$data((0,yo._)`Object.keys(${n}).length ${o} ${r}`)}};fa.default=u0;var pa={};Object.defineProperty(pa,"__esModule",{value:!0});const go=je,_o=Pe,d0=Me,f0={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>(0,_o.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,_o._)`{missingProperty: ${e}}`},code(e){const{gen:t,schema:n,schemaCode:r,data:o,$data:a,it:s}=e,{opts:c}=s;if(!a&&n.length===0)return;const d=n.length>=c.loopRequired;if(s.allErrors?u():h(),c.strictRequired){const m=e.parentSchema.properties,{definedProperties:y}=e.it;for(const b of n)if((m==null?void 0:m[b])===void 0&&!y.has(b)){const S=s.schemaEnv.baseId+s.errSchemaPath,T=`required property "${b}" is not defined at "${S}" (strictRequired)`;(0,d0.checkStrictMode)(s,T,s.opts.strictRequired)}}function u(){if(d||a)e.block$data(_o.nil,l);else for(const m of n)(0,go.checkReportMissingProp)(e,m)}function h(){const m=t.let("missing");if(d||a){const y=t.let("valid",!0);e.block$data(y,()=>f(m,y)),e.ok(y)}else t.if((0,go.checkMissingProp)(e,n,m)),(0,go.reportMissingProp)(e,m),t.else()}function l(){t.forOf("prop",r,m=>{e.setParams({missingProperty:m}),t.if((0,go.noPropertyInData)(t,o,m,c.ownProperties),()=>e.error())})}function f(m,y){e.setParams({missingProperty:m}),t.forOf(m,r,()=>{t.assign(y,(0,go.propertyInData)(t,o,m,c.ownProperties)),t.if((0,_o.not)(y),()=>{e.error(),t.break()})},_o.nil)}}};pa.default=f0;var ma={};Object.defineProperty(ma,"__esModule",{value:!0});const bo=Pe,p0={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n=e==="maxItems"?"more":"fewer";return(0,bo.str)`must NOT have ${n} than ${t} items`},params:({schemaCode:e})=>(0,bo._)`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:r}=e,o=t==="maxItems"?bo.operators.GT:bo.operators.LT;e.fail$data((0,bo._)`${n}.length ${o} ${r}`)}};ma.default=p0;var ha={},To={};Object.defineProperty(To,"__esModule",{value:!0});const rf=Id;rf.code='require("ajv/dist/runtime/equal").default',To.default=rf,Object.defineProperty(ha,"__esModule",{value:!0});const ya=co,gt=Pe,m0=Me,h0=To,y0={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>(0,gt.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,gt._)`{i: ${e}, j: ${t}}`},code(e){const{gen:t,data:n,$data:r,schema:o,parentSchema:a,schemaCode:s,it:c}=e;if(!r&&!o)return;const d=t.let("valid"),u=a.items?(0,ya.getSchemaTypes)(a.items):[];e.block$data(d,h,(0,gt._)`${s} === false`),e.ok(d);function h(){const y=t.let("i",(0,gt._)`${n}.length`),b=t.let("j");e.setParams({i:y,j:b}),t.assign(d,!0),t.if((0,gt._)`${y} > 1`,()=>(l()?f:m)(y,b))}function l(){return u.length>0&&!u.some(y=>y==="object"||y==="array")}function f(y,b){const S=t.name("item"),T=(0,ya.checkDataTypes)(u,S,c.opts.strictNumbers,ya.DataType.Wrong),I=t.const("indices",(0,gt._)`{}`);t.for((0,gt._)`;${y}--;`,()=>{t.let(S,(0,gt._)`${n}[${y}]`),t.if(T,(0,gt._)`continue`),u.length>1&&t.if((0,gt._)`typeof ${S} == "string"`,(0,gt._)`${S} += "_"`),t.if((0,gt._)`typeof ${I}[${S}] == "number"`,()=>{t.assign(b,(0,gt._)`${I}[${S}]`),e.error(),t.assign(d,!1).break()}).code((0,gt._)`${I}[${S}] = ${y}`)})}function m(y,b){const S=(0,m0.useFunc)(t,h0.default),T=t.name("outer");t.label(T).for((0,gt._)`;${y}--;`,()=>t.for((0,gt._)`${b} = ${y}; ${b}--;`,()=>t.if((0,gt._)`${S}(${n}[${y}], ${n}[${b}])`,()=>{e.error(),t.assign(d,!1).break(T)})))}}};ha.default=y0;var ga={};Object.defineProperty(ga,"__esModule",{value:!0});const _a=Pe,g0=Me,_0=To,b0={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>(0,_a._)`{allowedValue: ${e}}`},code(e){const{gen:t,data:n,$data:r,schemaCode:o,schema:a}=e;r||a&&typeof a=="object"?e.fail$data((0,_a._)`!${(0,g0.useFunc)(t,_0.default)}(${n}, ${o})`):e.fail((0,_a._)`${a} !== ${n}`)}};ga.default=b0;var ba={};Object.defineProperty(ba,"__esModule",{value:!0});const vo=Pe,T0=Me,v0=To,S0={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,vo._)`{allowedValues: ${e}}`},code(e){const{gen:t,data:n,$data:r,schema:o,schemaCode:a,it:s}=e;if(!r&&o.length===0)throw new Error("enum must have non-empty array");const c=o.length>=s.opts.loopEnum;let d;const u=()=>d??(d=(0,T0.useFunc)(t,v0.default));let h;if(c||r)h=t.let("valid"),e.block$data(h,l);else{if(!Array.isArray(o))throw new Error("ajv implementation error");const m=t.const("vSchema",a);h=(0,vo.or)(...o.map((y,b)=>f(m,b)))}e.pass(h);function l(){t.assign(h,!1),t.forOf("v",a,m=>t.if((0,vo._)`${u()}(${n}, ${m})`,()=>t.assign(h,!0).break()))}function f(m,y){const b=o[y];return typeof b=="object"&&b!==null?(0,vo._)`${u()}(${n}, ${m}[${y}])`:(0,vo._)`${n} === ${b}`}}};ba.default=S0,Object.defineProperty(sa,"__esModule",{value:!0});const w0=aa,k0=la,C0=ca,$0=da,E0=fa,O0=pa,A0=ma,I0=ha,N0=ga,P0=ba,j0=[w0.default,k0.default,C0.default,$0.default,E0.default,O0.default,A0.default,I0.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},N0.default,P0.default];sa.default=j0;var Ta={},Nr={};Object.defineProperty(Nr,"__esModule",{value:!0}),Nr.validateAdditionalItems=void 0;const sr=Pe,va=Me,x0={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,sr.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,sr._)`{limit: ${e}}`},code(e){const{parentSchema:t,it:n}=e,{items:r}=t;if(!Array.isArray(r)){(0,va.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas');return}of(e,r)}};function of(e,t){const{gen:n,schema:r,data:o,keyword:a,it:s}=e;s.items=!0;const c=n.const("len",(0,sr._)`${o}.length`);if(r===!1)e.setParams({len:t.length}),e.pass((0,sr._)`${c} <= ${t.length}`);else if(typeof r=="object"&&!(0,va.alwaysValidSchema)(s,r)){const u=n.var("valid",(0,sr._)`${c} <= ${t.length}`);n.if((0,sr.not)(u),()=>d(u)),e.ok(u)}function d(u){n.forRange("i",t.length,c,h=>{e.subschema({keyword:a,dataProp:h,dataPropType:va.Type.Num},u),s.allErrors||n.if((0,sr.not)(u),()=>n.break())})}}Nr.validateAdditionalItems=of,Nr.default=x0;var Sa={},Pr={};Object.defineProperty(Pr,"__esModule",{value:!0}),Pr.validateTuple=void 0;const sf=Pe,hi=Me,D0=je,L0={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:n}=e;if(Array.isArray(t))return af(e,"additionalItems",t);n.items=!0,!(0,hi.alwaysValidSchema)(n,t)&&e.ok((0,D0.validateArray)(e))}};function af(e,t,n=e.schema){const{gen:r,parentSchema:o,data:a,keyword:s,it:c}=e;h(o),c.opts.unevaluated&&n.length&&c.items!==!0&&(c.items=hi.mergeEvaluated.items(r,n.length,c.items));const d=r.name("valid"),u=r.const("len",(0,sf._)`${a}.length`);n.forEach((l,f)=>{(0,hi.alwaysValidSchema)(c,l)||(r.if((0,sf._)`${u} > ${f}`,()=>e.subschema({keyword:s,schemaProp:f,dataProp:f},d)),e.ok(d))});function h(l){const{opts:f,errSchemaPath:m}=c,y=n.length,b=y===l.minItems&&(y===l.maxItems||l[t]===!1);if(f.strictTuples&&!b){const S=`"${s}" is ${y}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;(0,hi.checkStrictMode)(c,S,f.strictTuples)}}}Pr.validateTuple=af,Pr.default=L0,Object.defineProperty(Sa,"__esModule",{value:!0});const M0=Pr,B0={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,M0.validateTuple)(e,"items")};Sa.default=B0;var wa={};Object.defineProperty(wa,"__esModule",{value:!0});const lf=Pe,R0=Me,F0=je,V0=Nr,U0={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,lf.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,lf._)`{limit: ${e}}`},code(e){const{schema:t,parentSchema:n,it:r}=e,{prefixItems:o}=n;r.items=!0,!(0,R0.alwaysValidSchema)(r,t)&&(o?(0,V0.validateAdditionalItems)(e,o):e.ok((0,F0.validateArray)(e)))}};wa.default=U0;var ka={};Object.defineProperty(ka,"__esModule",{value:!0});const Kt=Pe,yi=Me,q0={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>t===void 0?(0,Kt.str)`must contain at least ${e} valid item(s)`:(0,Kt.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,Kt._)`{minContains: ${e}}`:(0,Kt._)`{minContains: ${e}, maxContains: ${t}}`},code(e){const{gen:t,schema:n,parentSchema:r,data:o,it:a}=e;let s,c;const{minContains:d,maxContains:u}=r;a.opts.next?(s=d===void 0?1:d,c=u):s=1;const h=t.const("len",(0,Kt._)`${o}.length`);if(e.setParams({min:s,max:c}),c===void 0&&s===0){(0,yi.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(c!==void 0&&s>c){(0,yi.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,yi.alwaysValidSchema)(a,n)){let b=(0,Kt._)`${h} >= ${s}`;c!==void 0&&(b=(0,Kt._)`${b} && ${h} <= ${c}`),e.pass(b);return}a.items=!0;const l=t.name("valid");c===void 0&&s===1?m(l,()=>t.if(l,()=>t.break())):s===0?(t.let(l,!0),c!==void 0&&t.if((0,Kt._)`${o}.length > 0`,f)):(t.let(l,!1),f()),e.result(l,()=>e.reset());function f(){const b=t.name("_valid"),S=t.let("count",0);m(b,()=>t.if(b,()=>y(S)))}function m(b,S){t.forRange("i",0,h,T=>{e.subschema({keyword:"contains",dataProp:T,dataPropType:yi.Type.Num,compositeRule:!0},b),S()})}function y(b){t.code((0,Kt._)`${b}++`),c===void 0?t.if((0,Kt._)`${b} >= ${s}`,()=>t.assign(l,!0).break()):(t.if((0,Kt._)`${b} > ${c}`,()=>t.assign(l,!1).break()),s===1?t.assign(l,!0):t.if((0,Kt._)`${b} >= ${s}`,()=>t.assign(l,!0)))}}};ka.default=q0;var cf={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=Pe,n=Me,r=je;e.error={message:({params:{property:d,depsCount:u,deps:h}})=>{const l=u===1?"property":"properties";return(0,t.str)`must have ${l} ${h} when property ${d} is present`},params:({params:{property:d,depsCount:u,deps:h,missingProperty:l}})=>(0,t._)`{property: ${d},
79
79
  missingProperty: ${l},
80
80
  depsCount: ${u},
81
- deps: ${h}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(d){const[u,h]=a(d);s(d,u),c(d,h)}};function a({schema:d}){const u={},h={};for(const l in d){if(l==="__proto__")continue;const f=Array.isArray(d[l])?u:h;f[l]=d[l]}return[u,h]}function s(d,u=d.schema){const{gen:h,data:l,it:f}=d;if(Object.keys(u).length===0)return;const m=h.let("missing");for(const y in u){const b=u[y];if(b.length===0)continue;const S=(0,r.propertyInData)(h,l,y,f.opts.ownProperties);d.setParams({property:y,depsCount:b.length,deps:b.join(", ")}),f.allErrors?h.if(S,()=>{for(const T of b)(0,r.checkReportMissingProp)(d,T)}):(h.if((0,t._)`${S} && (${(0,r.checkMissingProp)(d,b,m)})`),(0,r.reportMissingProp)(d,m),h.else())}}e.validatePropertyDeps=s;function c(d,u=d.schema){const{gen:h,data:l,keyword:f,it:m}=d,y=h.name("valid");for(const b in u)(0,n.alwaysValidSchema)(m,u[b])||(h.if((0,r.propertyInData)(h,l,b,m.opts.ownProperties),()=>{const S=d.subschema({keyword:f,schemaProp:b},y);d.mergeValidEvaluated(S,y)},()=>h.var(y,!0)),d.ok(y))}e.validateSchemaDeps=c,e.default=o})(sf);var ka={};Object.defineProperty(ka,"__esModule",{value:!0});const af=Pe,V0=Me,U0={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>(0,af._)`{propertyName: ${e.propertyName}}`},code(e){const{gen:t,schema:n,data:r,it:o}=e;if((0,V0.alwaysValidSchema)(o,n))return;const a=t.name("valid");t.forIn("key",r,s=>{e.setParams({propertyName:s}),e.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},a),t.if((0,af.not)(a),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(a)}};ka.default=U0;var hi={};Object.defineProperty(hi,"__esModule",{value:!0});const yi=je,Zt=Pe,q0=ln,gi=Me,H0={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>(0,Zt._)`{additionalProperty: ${e.additionalProperty}}`},code(e){const{gen:t,schema:n,parentSchema:r,data:o,errsCount:a,it:s}=e;if(!a)throw new Error("ajv implementation error");const{allErrors:c,opts:d}=s;if(s.props=!0,d.removeAdditional!=="all"&&(0,gi.alwaysValidSchema)(s,n))return;const u=(0,yi.allSchemaProperties)(r.properties),h=(0,yi.allSchemaProperties)(r.patternProperties);l(),e.ok((0,Zt._)`${a} === ${q0.default.errors}`);function l(){t.forIn("key",o,S=>{!u.length&&!h.length?y(S):t.if(f(S),()=>y(S))})}function f(S){let T;if(u.length>8){const I=(0,gi.schemaRefOrVal)(s,r.properties,"properties");T=(0,yi.isOwnProperty)(t,I,S)}else u.length?T=(0,Zt.or)(...u.map(I=>(0,Zt._)`${S} === ${I}`)):T=Zt.nil;return h.length&&(T=(0,Zt.or)(T,...h.map(I=>(0,Zt._)`${(0,yi.usePattern)(e,I)}.test(${S})`))),(0,Zt.not)(T)}function m(S){t.code((0,Zt._)`delete ${o}[${S}]`)}function y(S){if(d.removeAdditional==="all"||d.removeAdditional&&n===!1){m(S);return}if(n===!1){e.setParams({additionalProperty:S}),e.error(),c||t.break();return}if(typeof n=="object"&&!(0,gi.alwaysValidSchema)(s,n)){const T=t.name("valid");d.removeAdditional==="failing"?(b(S,T,!1),t.if((0,Zt.not)(T),()=>{e.reset(),m(S)})):(b(S,T),c||t.if((0,Zt.not)(T),()=>t.break()))}}function b(S,T,I){const x={keyword:"additionalProperties",dataProp:S,dataPropType:gi.Type.Str};I===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(x,T)}}};hi.default=H0;var Ca={};Object.defineProperty(Ca,"__esModule",{value:!0});const K0=Yt,lf=je,$a=Me,cf=hi,G0={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,parentSchema:r,data:o,it:a}=e;a.opts.removeAdditional==="all"&&r.additionalProperties===void 0&&cf.default.code(new K0.KeywordCxt(a,cf.default,"additionalProperties"));const s=(0,lf.allSchemaProperties)(n);for(const l of s)a.definedProperties.add(l);a.opts.unevaluated&&s.length&&a.props!==!0&&(a.props=$a.mergeEvaluated.props(t,(0,$a.toHash)(s),a.props));const c=s.filter(l=>!(0,$a.alwaysValidSchema)(a,n[l]));if(c.length===0)return;const d=t.name("valid");for(const l of c)u(l)?h(l):(t.if((0,lf.propertyInData)(t,o,l,a.opts.ownProperties)),h(l),a.allErrors||t.else().var(d,!0),t.endIf()),e.it.definedProperties.add(l),e.ok(d);function u(l){return a.opts.useDefaults&&!a.compositeRule&&n[l].default!==void 0}function h(l){e.subschema({keyword:"properties",schemaProp:l,dataProp:l},d)}}};Ca.default=G0;var Ea={};Object.defineProperty(Ea,"__esModule",{value:!0});const uf=je,_i=Pe,df=Me,ff=Me,z0={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,data:r,parentSchema:o,it:a}=e,{opts:s}=a,c=(0,uf.allSchemaProperties)(n),d=c.filter(b=>(0,df.alwaysValidSchema)(a,n[b]));if(c.length===0||d.length===c.length&&(!a.opts.unevaluated||a.props===!0))return;const u=s.strictSchema&&!s.allowMatchingProperties&&o.properties,h=t.name("valid");a.props!==!0&&!(a.props instanceof _i.Name)&&(a.props=(0,ff.evaluatedPropsToName)(t,a.props));const{props:l}=a;f();function f(){for(const b of c)u&&m(b),a.allErrors?y(b):(t.var(h,!0),y(b),t.if(h))}function m(b){for(const S in u)new RegExp(b).test(S)&&(0,df.checkStrictMode)(a,`property ${S} matches pattern ${b} (use allowMatchingProperties)`)}function y(b){t.forIn("key",r,S=>{t.if((0,_i._)`${(0,uf.usePattern)(e,b)}.test(${S})`,()=>{const T=d.includes(b);T||e.subschema({keyword:"patternProperties",schemaProp:b,dataProp:S,dataPropType:ff.Type.Str},h),a.opts.unevaluated&&l!==!0?t.assign((0,_i._)`${l}[${S}]`,!0):!T&&!a.allErrors&&t.if((0,_i.not)(h),()=>t.break())})})}}};Ea.default=z0;var Oa={};Object.defineProperty(Oa,"__esModule",{value:!0});const W0=Me,Q0={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:n,it:r}=e;if((0,W0.alwaysValidSchema)(r,n)){e.fail();return}const o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Oa.default=Q0;var Aa={};Object.defineProperty(Aa,"__esModule",{value:!0});const Y0={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:je.validateUnion,error:{message:"must match a schema in anyOf"}};Aa.default=Y0;var Ia={};Object.defineProperty(Ia,"__esModule",{value:!0});const bi=Pe,J0=Me,X0={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>(0,bi._)`{passingSchemas: ${e.passing}}`},code(e){const{gen:t,schema:n,parentSchema:r,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(o.opts.discriminator&&r.discriminator)return;const a=n,s=t.let("valid",!1),c=t.let("passing",null),d=t.name("_valid");e.setParams({passing:c}),t.block(u),e.result(s,()=>e.reset(),()=>e.error(!0));function u(){a.forEach((h,l)=>{let f;(0,J0.alwaysValidSchema)(o,h)?t.var(d,!0):f=e.subschema({keyword:"oneOf",schemaProp:l,compositeRule:!0},d),l>0&&t.if((0,bi._)`${d} && ${s}`).assign(s,!1).assign(c,(0,bi._)`[${c}, ${l}]`).else(),t.if(d,()=>{t.assign(s,!0),t.assign(c,l),f&&e.mergeEvaluated(f,bi.Name)})})}}};Ia.default=X0;var Na={};Object.defineProperty(Na,"__esModule",{value:!0});const Z0=Me,eS={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:n,it:r}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");const o=t.name("valid");n.forEach((a,s)=>{if((0,Z0.alwaysValidSchema)(r,a))return;const c=e.subschema({keyword:"allOf",schemaProp:s},o);e.ok(o),e.mergeEvaluated(c)})}};Na.default=eS;var Pa={};Object.defineProperty(Pa,"__esModule",{value:!0});const Ti=Pe,pf=Me,tS={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>(0,Ti.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Ti._)`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:t,parentSchema:n,it:r}=e;n.then===void 0&&n.else===void 0&&(0,pf.checkStrictMode)(r,'"if" without "then" and "else" is ignored');const o=mf(r,"then"),a=mf(r,"else");if(!o&&!a)return;const s=t.let("valid",!0),c=t.name("_valid");if(d(),e.reset(),o&&a){const h=t.let("ifClause");e.setParams({ifClause:h}),t.if(c,u("then",h),u("else",h))}else o?t.if(c,u("then")):t.if((0,Ti.not)(c),u("else"));e.pass(s,()=>e.error(!0));function d(){const h=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},c);e.mergeEvaluated(h)}function u(h,l){return()=>{const f=e.subschema({keyword:h},c);t.assign(s,c),e.mergeValidEvaluated(f,s),l?t.assign(l,(0,Ti._)`${h}`):e.setParams({ifClause:h})}}}};function mf(e,t){const n=e.schema[t];return n!==void 0&&!(0,pf.alwaysValidSchema)(e,n)}Pa.default=tS;var ja={};Object.defineProperty(ja,"__esModule",{value:!0});const nS=Me,rS={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){t.if===void 0&&(0,nS.checkStrictMode)(n,`"${e}" without "if" is ignored`)}};ja.default=rS,Object.defineProperty(ba,"__esModule",{value:!0});const oS=Ir,iS=va,sS=Nr,aS=Sa,lS=wa,cS=sf,uS=ka,dS=hi,fS=Ca,pS=Ea,mS=Oa,hS=Aa,yS=Ia,gS=Na,_S=Pa,bS=ja;function TS(e=!1){const t=[mS.default,hS.default,yS.default,gS.default,_S.default,bS.default,uS.default,dS.default,cS.default,fS.default,pS.default];return e?t.push(iS.default,aS.default):t.push(oS.default,sS.default),t.push(lS.default),t}ba.default=TS;var Da={},xa={};Object.defineProperty(xa,"__esModule",{value:!0});const tt=Pe,vS={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,tt.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,tt._)`{format: ${e}}`},code(e,t){const{gen:n,data:r,$data:o,schema:a,schemaCode:s,it:c}=e,{opts:d,errSchemaPath:u,schemaEnv:h,self:l}=c;if(!d.validateFormats)return;o?f():m();function f(){const y=n.scopeValue("formats",{ref:l.formats,code:d.code.formats}),b=n.const("fDef",(0,tt._)`${y}[${s}]`),S=n.let("fType"),T=n.let("format");n.if((0,tt._)`typeof ${b} == "object" && !(${b} instanceof RegExp)`,()=>n.assign(S,(0,tt._)`${b}.type || "string"`).assign(T,(0,tt._)`${b}.validate`),()=>n.assign(S,(0,tt._)`"string"`).assign(T,b)),e.fail$data((0,tt.or)(I(),x()));function I(){return d.strictSchema===!1?tt.nil:(0,tt._)`${s} && !${T}`}function x(){const B=h.$async?(0,tt._)`(${b}.async ? await ${T}(${r}) : ${T}(${r}))`:(0,tt._)`${T}(${r})`,F=(0,tt._)`(typeof ${T} == "function" ? ${B} : ${T}.test(${r}))`;return(0,tt._)`${T} && ${T} !== true && ${S} === ${t} && !${F}`}}function m(){const y=l.formats[a];if(!y){I();return}if(y===!0)return;const[b,S,T]=x(y);b===t&&e.pass(B());function I(){if(d.strictSchema===!1){l.logger.warn(F());return}throw new Error(F());function F(){return`unknown format "${a}" ignored in schema at path "${u}"`}}function x(F){const L=F instanceof RegExp?(0,tt.regexpCode)(F):d.code.formats?(0,tt._)`${d.code.formats}${(0,tt.getProperty)(a)}`:void 0,P=n.scopeValue("formats",{key:a,ref:F,code:L});return typeof F=="object"&&!(F instanceof RegExp)?[F.type||"string",F.validate,(0,tt._)`${P}.validate`]:["string",F,P]}function B(){if(typeof y=="object"&&!(y instanceof RegExp)&&y.async){if(!h.$async)throw new Error("async format in sync schema");return(0,tt._)`await ${T}(${r})`}return typeof S=="function"?(0,tt._)`${T}(${r})`:(0,tt._)`${T}.test(${r})`}}}};xa.default=vS,Object.defineProperty(Da,"__esModule",{value:!0});const SS=[xa.default];Da.default=SS;var Pr={};Object.defineProperty(Pr,"__esModule",{value:!0}),Pr.contentVocabulary=Pr.metadataVocabulary=void 0,Pr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],Pr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"],Object.defineProperty(na,"__esModule",{value:!0});const wS=ra,kS=ia,CS=ba,$S=Da,hf=Pr,ES=[wS.default,kS.default,(0,CS.default)(),$S.default,hf.metadataVocabulary,hf.contentVocabulary];na.default=ES;var La={},yf={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0,function(t){t.Tag="tag",t.Mapping="mapping"}(e.DiscrError||(e.DiscrError={}))})(yf),Object.defineProperty(La,"__esModule",{value:!0});const jr=Pe,Ma=yf,gf=jt,OS=Me,AS={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===Ma.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>(0,jr._)`{error: ${e}, tag: ${n}, tagValue: ${t}}`},code(e){const{gen:t,data:n,schema:r,parentSchema:o,it:a}=e,{oneOf:s}=o;if(!a.opts.discriminator)throw new Error("discriminator: requires discriminator option");const c=r.propertyName;if(typeof c!="string")throw new Error("discriminator: requires propertyName");if(r.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");const d=t.let("valid",!1),u=t.const("tag",(0,jr._)`${n}${(0,jr.getProperty)(c)}`);t.if((0,jr._)`typeof ${u} == "string"`,()=>h(),()=>e.error(!1,{discrError:Ma.DiscrError.Tag,tag:u,tagName:c})),e.ok(d);function h(){const m=f();t.if(!1);for(const y in m)t.elseIf((0,jr._)`${u} === ${y}`),t.assign(d,l(m[y]));t.else(),e.error(!1,{discrError:Ma.DiscrError.Mapping,tag:u,tagName:c}),t.endIf()}function l(m){const y=t.name("valid"),b=e.subschema({keyword:"oneOf",schemaProp:m},y);return e.mergeEvaluated(b,jr.Name),y}function f(){var m;const y={},b=T(o);let S=!0;for(let B=0;B<s.length;B++){let F=s[B];F!=null&&F.$ref&&!(0,OS.schemaHasRulesButRef)(F,a.self.RULES)&&(F=gf.resolveRef.call(a.self,a.schemaEnv.root,a.baseId,F==null?void 0:F.$ref),F instanceof gf.SchemaEnv&&(F=F.schema));const L=(m=F==null?void 0:F.properties)===null||m===void 0?void 0:m[c];if(typeof L!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${c}"`);S=S&&(b||T(F)),I(L,B)}if(!S)throw new Error(`discriminator: "${c}" must be required`);return y;function T({required:B}){return Array.isArray(B)&&B.includes(c)}function I(B,F){if(B.const)x(B.const,F);else if(B.enum)for(const L of B.enum)x(L,F);else throw new Error(`discriminator: "properties/${c}" must have "const" or "enum"`)}function x(B,F){if(typeof B!="string"||B in y)throw new Error(`discriminator: "${c}" values must be unique strings`);y[B]=F}}}};La.default=AS;const IS={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;const n=gd,r=na,o=La,a=IS,s=["/properties"],c="http://json-schema.org/draft-07/schema";class d extends n.default{_addVocabularies(){super._addVocabularies(),r.default.forEach(y=>this.addVocabulary(y)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const y=this.opts.$data?this.$dataMetaSchema(a,s):a;this.addMetaSchema(y,c,!1),this.refs["http://json-schema.org/schema"]=c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}}e.exports=t=d,Object.defineProperty(t,"__esModule",{value:!0}),t.default=d;var u=Yt;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var h=Pe;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return h._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return h.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return h.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return h.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return h.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return h.CodeGen}});var l=fo;Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return l.default}});var f=po;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return f.default}})})(Us,Us.exports);var NS=Us.exports;const PS=Bi(NS);function jS(e,t){for(const n in t.screens){const r=t.screens[n];if(r.buttons)for(const[o,a]of r.buttons.entries())typeof a=="object"&&(e.buttons.buttons[a.id]=a,r.buttons[o]=a.id)}return t}function DS(e,t){if(t.transitions)for(const n in t.transitions)Yo[n]?Object.assign(Yo[n],t.transitions[n]):Yo[n]=t.transitions[n];return t}function xS(e,t,n){switch(e){case"screens":return jS(t,n);case"common":return DS(t,n);default:return n}}function _f(e,t,n){const r=e[t],o=(a,s,c)=>s;if(n){let a=Yn(r,n,{arrayMerge:o});return a=xS(t,e,a),a}}function Ra(e){return!(!e||!e.default)}function Ba(e){if(Te().clearErrors(),!Ra(e))return;console.log("Received HMR update for ",e.default.id);const t=e.default;if(Fa(t))vt().addNotification(`Reloaded ${t.fileName}`,"You can continue playing with the changes."),Ie.addNarratScript(t);else if(vi(t)){const n=lt().findConfigModuleKey(t);if(n){const r=_f(lt().config,n,t.code);lt().reloadConfigModule(n,r);const o=Object.values(Jb()).find(a=>a.config===n);o&&o.store().updateConfig&&o.store().updateConfig(r)}console.log(`Yaml update ${t.fileName}}`)}else console.error("Unknown module type",t)}function Fa(e){return typeof e=="object"&&e!==null&&typeof e.code=="string"&&typeof e.fileName=="string"&&typeof e.id=="string"&&e.type==="script"}function vi(e){return typeof e=="object"&&e!==null&&typeof e.code=="object"&&typeof e.fileName=="string"&&typeof e.id=="string"&&e.type==="yaml"}window.narratHMRHandler=e=>{const t=window.narrat;t&&t.handleHMR(e);const n=new CustomEvent("narrat-hmr",{detail:{newModule:e}});document.body.dispatchEvent(n)};class V{constructor(t,n,r,o){xe(this,"keyword");xe(this,"runner");xe(this,"argTypes");xe(this,"parser");xe(this,"onPlayerAnswered");xe(this,"returnAfterPlayerAnswer");this.keyword=t,this.runner=r,this.argTypes=n,o?this.parser=o:this.parser=Dr(this.keyword,this.argTypes),this.returnAfterPlayerAnswer=!1}async run(t,n){let r=await this.runner(t,n);return this.returnAfterPlayerAnswer&&(r=await new Promise((o,a)=>{we().waitForPlayerAnswer(t),t.finishCommand=o})),r}async processPlayerAnswer(t,n){let r=n;return this.onPlayerAnswered&&(r=await this.onPlayerAnswered(t,n)),this.returnAfterPlayerAnswer&&t.finishCommand&&t.finishCommand(r),r}static FromOptions(t){const n=new V(t.keyword,t.argTypes,t.runner,t.parser);return n.onPlayerAnswered=t.onPlayerAnswered,n.returnAfterPlayerAnswer=t.returnAfterPlayerAnswer??!1,n}}function Dr(e,t){let n=[];if(t!=="any"){n=[];let r=!1;const o=t.reduce((a,s)=>(s.type==="rest"&&(r=!0),s.optional&&a++,a),0);o>=1?n.push(t.length-o):n.push(t.length),n.push(t.length),r&&(n[1]=1/0)}return(r,o)=>{const a={newLine:r.currentLine+1},s=o.command.args;if(t!=="any"&&(s.length<n[0]||s.length>n[1]))return console.log("Error details"),console.log(o.command),console.log(s),r.parserContext.error(r.line.line,`Command ${e}: Expected ${n.join(" to ")} arguments but got ${s.length}`),a;if(o.command.commandType=e,t!=="any"){let c=!1;o.command.args.forEach((d,u)=>{if(c)return;const h=t[u];if(h.type==="rest"){c=!0;return}!Fc(d)&&!Vc(d)&&(h.type==="any"||typeof d===h.type||r.parserContext.error(r.line.line,`Command ${e}: Argument #${u+1} (${h.name}) should be a ${h.type}, but got type ${typeof d}: ${JSON.stringify(d)}`))})}return{newLine:r.currentLine+1}}}function se(e,t){console.error("Runtime error ========================="),console.error(`Command: ${e.commandType}`),console.error("Args: ",e.args),console.error("Options: ",e.options),ae(`Runtime error at ${e.fileName}:${e.line} (${e.commandType}) ${e.code}. -
81
+ deps: ${h}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(d){const[u,h]=a(d);s(d,u),c(d,h)}};function a({schema:d}){const u={},h={};for(const l in d){if(l==="__proto__")continue;const f=Array.isArray(d[l])?u:h;f[l]=d[l]}return[u,h]}function s(d,u=d.schema){const{gen:h,data:l,it:f}=d;if(Object.keys(u).length===0)return;const m=h.let("missing");for(const y in u){const b=u[y];if(b.length===0)continue;const S=(0,r.propertyInData)(h,l,y,f.opts.ownProperties);d.setParams({property:y,depsCount:b.length,deps:b.join(", ")}),f.allErrors?h.if(S,()=>{for(const T of b)(0,r.checkReportMissingProp)(d,T)}):(h.if((0,t._)`${S} && (${(0,r.checkMissingProp)(d,b,m)})`),(0,r.reportMissingProp)(d,m),h.else())}}e.validatePropertyDeps=s;function c(d,u=d.schema){const{gen:h,data:l,keyword:f,it:m}=d,y=h.name("valid");for(const b in u)(0,n.alwaysValidSchema)(m,u[b])||(h.if((0,r.propertyInData)(h,l,b,m.opts.ownProperties),()=>{const S=d.subschema({keyword:f,schemaProp:b},y);d.mergeValidEvaluated(S,y)},()=>h.var(y,!0)),d.ok(y))}e.validateSchemaDeps=c,e.default=o})(cf);var Ca={};Object.defineProperty(Ca,"__esModule",{value:!0});const uf=Pe,H0=Me,K0={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>(0,uf._)`{propertyName: ${e.propertyName}}`},code(e){const{gen:t,schema:n,data:r,it:o}=e;if((0,H0.alwaysValidSchema)(o,n))return;const a=t.name("valid");t.forIn("key",r,s=>{e.setParams({propertyName:s}),e.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},a),t.if((0,uf.not)(a),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(a)}};Ca.default=K0;var gi={};Object.defineProperty(gi,"__esModule",{value:!0});const _i=je,Zt=Pe,G0=ln,bi=Me,z0={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>(0,Zt._)`{additionalProperty: ${e.additionalProperty}}`},code(e){const{gen:t,schema:n,parentSchema:r,data:o,errsCount:a,it:s}=e;if(!a)throw new Error("ajv implementation error");const{allErrors:c,opts:d}=s;if(s.props=!0,d.removeAdditional!=="all"&&(0,bi.alwaysValidSchema)(s,n))return;const u=(0,_i.allSchemaProperties)(r.properties),h=(0,_i.allSchemaProperties)(r.patternProperties);l(),e.ok((0,Zt._)`${a} === ${G0.default.errors}`);function l(){t.forIn("key",o,S=>{!u.length&&!h.length?y(S):t.if(f(S),()=>y(S))})}function f(S){let T;if(u.length>8){const I=(0,bi.schemaRefOrVal)(s,r.properties,"properties");T=(0,_i.isOwnProperty)(t,I,S)}else u.length?T=(0,Zt.or)(...u.map(I=>(0,Zt._)`${S} === ${I}`)):T=Zt.nil;return h.length&&(T=(0,Zt.or)(T,...h.map(I=>(0,Zt._)`${(0,_i.usePattern)(e,I)}.test(${S})`))),(0,Zt.not)(T)}function m(S){t.code((0,Zt._)`delete ${o}[${S}]`)}function y(S){if(d.removeAdditional==="all"||d.removeAdditional&&n===!1){m(S);return}if(n===!1){e.setParams({additionalProperty:S}),e.error(),c||t.break();return}if(typeof n=="object"&&!(0,bi.alwaysValidSchema)(s,n)){const T=t.name("valid");d.removeAdditional==="failing"?(b(S,T,!1),t.if((0,Zt.not)(T),()=>{e.reset(),m(S)})):(b(S,T),c||t.if((0,Zt.not)(T),()=>t.break()))}}function b(S,T,I){const D={keyword:"additionalProperties",dataProp:S,dataPropType:bi.Type.Str};I===!1&&Object.assign(D,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(D,T)}}};gi.default=z0;var $a={};Object.defineProperty($a,"__esModule",{value:!0});const W0=Yt,df=je,Ea=Me,ff=gi,Q0={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,parentSchema:r,data:o,it:a}=e;a.opts.removeAdditional==="all"&&r.additionalProperties===void 0&&ff.default.code(new W0.KeywordCxt(a,ff.default,"additionalProperties"));const s=(0,df.allSchemaProperties)(n);for(const l of s)a.definedProperties.add(l);a.opts.unevaluated&&s.length&&a.props!==!0&&(a.props=Ea.mergeEvaluated.props(t,(0,Ea.toHash)(s),a.props));const c=s.filter(l=>!(0,Ea.alwaysValidSchema)(a,n[l]));if(c.length===0)return;const d=t.name("valid");for(const l of c)u(l)?h(l):(t.if((0,df.propertyInData)(t,o,l,a.opts.ownProperties)),h(l),a.allErrors||t.else().var(d,!0),t.endIf()),e.it.definedProperties.add(l),e.ok(d);function u(l){return a.opts.useDefaults&&!a.compositeRule&&n[l].default!==void 0}function h(l){e.subschema({keyword:"properties",schemaProp:l,dataProp:l},d)}}};$a.default=Q0;var Oa={};Object.defineProperty(Oa,"__esModule",{value:!0});const pf=je,Ti=Pe,mf=Me,hf=Me,Y0={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,data:r,parentSchema:o,it:a}=e,{opts:s}=a,c=(0,pf.allSchemaProperties)(n),d=c.filter(b=>(0,mf.alwaysValidSchema)(a,n[b]));if(c.length===0||d.length===c.length&&(!a.opts.unevaluated||a.props===!0))return;const u=s.strictSchema&&!s.allowMatchingProperties&&o.properties,h=t.name("valid");a.props!==!0&&!(a.props instanceof Ti.Name)&&(a.props=(0,hf.evaluatedPropsToName)(t,a.props));const{props:l}=a;f();function f(){for(const b of c)u&&m(b),a.allErrors?y(b):(t.var(h,!0),y(b),t.if(h))}function m(b){for(const S in u)new RegExp(b).test(S)&&(0,mf.checkStrictMode)(a,`property ${S} matches pattern ${b} (use allowMatchingProperties)`)}function y(b){t.forIn("key",r,S=>{t.if((0,Ti._)`${(0,pf.usePattern)(e,b)}.test(${S})`,()=>{const T=d.includes(b);T||e.subschema({keyword:"patternProperties",schemaProp:b,dataProp:S,dataPropType:hf.Type.Str},h),a.opts.unevaluated&&l!==!0?t.assign((0,Ti._)`${l}[${S}]`,!0):!T&&!a.allErrors&&t.if((0,Ti.not)(h),()=>t.break())})})}}};Oa.default=Y0;var Aa={};Object.defineProperty(Aa,"__esModule",{value:!0});const J0=Me,X0={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:n,it:r}=e;if((0,J0.alwaysValidSchema)(r,n)){e.fail();return}const o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Aa.default=X0;var Ia={};Object.defineProperty(Ia,"__esModule",{value:!0});const Z0={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:je.validateUnion,error:{message:"must match a schema in anyOf"}};Ia.default=Z0;var Na={};Object.defineProperty(Na,"__esModule",{value:!0});const vi=Pe,eS=Me,tS={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>(0,vi._)`{passingSchemas: ${e.passing}}`},code(e){const{gen:t,schema:n,parentSchema:r,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(o.opts.discriminator&&r.discriminator)return;const a=n,s=t.let("valid",!1),c=t.let("passing",null),d=t.name("_valid");e.setParams({passing:c}),t.block(u),e.result(s,()=>e.reset(),()=>e.error(!0));function u(){a.forEach((h,l)=>{let f;(0,eS.alwaysValidSchema)(o,h)?t.var(d,!0):f=e.subschema({keyword:"oneOf",schemaProp:l,compositeRule:!0},d),l>0&&t.if((0,vi._)`${d} && ${s}`).assign(s,!1).assign(c,(0,vi._)`[${c}, ${l}]`).else(),t.if(d,()=>{t.assign(s,!0),t.assign(c,l),f&&e.mergeEvaluated(f,vi.Name)})})}}};Na.default=tS;var Pa={};Object.defineProperty(Pa,"__esModule",{value:!0});const nS=Me,rS={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:n,it:r}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");const o=t.name("valid");n.forEach((a,s)=>{if((0,nS.alwaysValidSchema)(r,a))return;const c=e.subschema({keyword:"allOf",schemaProp:s},o);e.ok(o),e.mergeEvaluated(c)})}};Pa.default=rS;var ja={};Object.defineProperty(ja,"__esModule",{value:!0});const Si=Pe,yf=Me,oS={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>(0,Si.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Si._)`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:t,parentSchema:n,it:r}=e;n.then===void 0&&n.else===void 0&&(0,yf.checkStrictMode)(r,'"if" without "then" and "else" is ignored');const o=gf(r,"then"),a=gf(r,"else");if(!o&&!a)return;const s=t.let("valid",!0),c=t.name("_valid");if(d(),e.reset(),o&&a){const h=t.let("ifClause");e.setParams({ifClause:h}),t.if(c,u("then",h),u("else",h))}else o?t.if(c,u("then")):t.if((0,Si.not)(c),u("else"));e.pass(s,()=>e.error(!0));function d(){const h=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},c);e.mergeEvaluated(h)}function u(h,l){return()=>{const f=e.subschema({keyword:h},c);t.assign(s,c),e.mergeValidEvaluated(f,s),l?t.assign(l,(0,Si._)`${h}`):e.setParams({ifClause:h})}}}};function gf(e,t){const n=e.schema[t];return n!==void 0&&!(0,yf.alwaysValidSchema)(e,n)}ja.default=oS;var xa={};Object.defineProperty(xa,"__esModule",{value:!0});const iS=Me,sS={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){t.if===void 0&&(0,iS.checkStrictMode)(n,`"${e}" without "if" is ignored`)}};xa.default=sS,Object.defineProperty(Ta,"__esModule",{value:!0});const aS=Nr,lS=Sa,cS=Pr,uS=wa,dS=ka,fS=cf,pS=Ca,mS=gi,hS=$a,yS=Oa,gS=Aa,_S=Ia,bS=Na,TS=Pa,vS=ja,SS=xa;function wS(e=!1){const t=[gS.default,_S.default,bS.default,TS.default,vS.default,SS.default,pS.default,mS.default,fS.default,hS.default,yS.default];return e?t.push(lS.default,uS.default):t.push(aS.default,cS.default),t.push(dS.default),t}Ta.default=wS;var Da={},La={};Object.defineProperty(La,"__esModule",{value:!0});const tt=Pe,kS={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,tt.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,tt._)`{format: ${e}}`},code(e,t){const{gen:n,data:r,$data:o,schema:a,schemaCode:s,it:c}=e,{opts:d,errSchemaPath:u,schemaEnv:h,self:l}=c;if(!d.validateFormats)return;o?f():m();function f(){const y=n.scopeValue("formats",{ref:l.formats,code:d.code.formats}),b=n.const("fDef",(0,tt._)`${y}[${s}]`),S=n.let("fType"),T=n.let("format");n.if((0,tt._)`typeof ${b} == "object" && !(${b} instanceof RegExp)`,()=>n.assign(S,(0,tt._)`${b}.type || "string"`).assign(T,(0,tt._)`${b}.validate`),()=>n.assign(S,(0,tt._)`"string"`).assign(T,b)),e.fail$data((0,tt.or)(I(),D()));function I(){return d.strictSchema===!1?tt.nil:(0,tt._)`${s} && !${T}`}function D(){const R=h.$async?(0,tt._)`(${b}.async ? await ${T}(${r}) : ${T}(${r}))`:(0,tt._)`${T}(${r})`,F=(0,tt._)`(typeof ${T} == "function" ? ${R} : ${T}.test(${r}))`;return(0,tt._)`${T} && ${T} !== true && ${S} === ${t} && !${F}`}}function m(){const y=l.formats[a];if(!y){I();return}if(y===!0)return;const[b,S,T]=D(y);b===t&&e.pass(R());function I(){if(d.strictSchema===!1){l.logger.warn(F());return}throw new Error(F());function F(){return`unknown format "${a}" ignored in schema at path "${u}"`}}function D(F){const L=F instanceof RegExp?(0,tt.regexpCode)(F):d.code.formats?(0,tt._)`${d.code.formats}${(0,tt.getProperty)(a)}`:void 0,P=n.scopeValue("formats",{key:a,ref:F,code:L});return typeof F=="object"&&!(F instanceof RegExp)?[F.type||"string",F.validate,(0,tt._)`${P}.validate`]:["string",F,P]}function R(){if(typeof y=="object"&&!(y instanceof RegExp)&&y.async){if(!h.$async)throw new Error("async format in sync schema");return(0,tt._)`await ${T}(${r})`}return typeof S=="function"?(0,tt._)`${T}(${r})`:(0,tt._)`${T}.test(${r})`}}}};La.default=kS,Object.defineProperty(Da,"__esModule",{value:!0});const CS=[La.default];Da.default=CS;var jr={};Object.defineProperty(jr,"__esModule",{value:!0}),jr.contentVocabulary=jr.metadataVocabulary=void 0,jr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],jr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"],Object.defineProperty(ra,"__esModule",{value:!0});const $S=oa,ES=sa,OS=Ta,AS=Da,_f=jr,IS=[$S.default,ES.default,(0,OS.default)(),AS.default,_f.metadataVocabulary,_f.contentVocabulary];ra.default=IS;var Ma={},bf={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0,function(t){t.Tag="tag",t.Mapping="mapping"}(e.DiscrError||(e.DiscrError={}))})(bf),Object.defineProperty(Ma,"__esModule",{value:!0});const xr=Pe,Ba=bf,Tf=jt,NS=Me,PS={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===Ba.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>(0,xr._)`{error: ${e}, tag: ${n}, tagValue: ${t}}`},code(e){const{gen:t,data:n,schema:r,parentSchema:o,it:a}=e,{oneOf:s}=o;if(!a.opts.discriminator)throw new Error("discriminator: requires discriminator option");const c=r.propertyName;if(typeof c!="string")throw new Error("discriminator: requires propertyName");if(r.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");const d=t.let("valid",!1),u=t.const("tag",(0,xr._)`${n}${(0,xr.getProperty)(c)}`);t.if((0,xr._)`typeof ${u} == "string"`,()=>h(),()=>e.error(!1,{discrError:Ba.DiscrError.Tag,tag:u,tagName:c})),e.ok(d);function h(){const m=f();t.if(!1);for(const y in m)t.elseIf((0,xr._)`${u} === ${y}`),t.assign(d,l(m[y]));t.else(),e.error(!1,{discrError:Ba.DiscrError.Mapping,tag:u,tagName:c}),t.endIf()}function l(m){const y=t.name("valid"),b=e.subschema({keyword:"oneOf",schemaProp:m},y);return e.mergeEvaluated(b,xr.Name),y}function f(){var m;const y={},b=T(o);let S=!0;for(let R=0;R<s.length;R++){let F=s[R];F!=null&&F.$ref&&!(0,NS.schemaHasRulesButRef)(F,a.self.RULES)&&(F=Tf.resolveRef.call(a.self,a.schemaEnv.root,a.baseId,F==null?void 0:F.$ref),F instanceof Tf.SchemaEnv&&(F=F.schema));const L=(m=F==null?void 0:F.properties)===null||m===void 0?void 0:m[c];if(typeof L!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${c}"`);S=S&&(b||T(F)),I(L,R)}if(!S)throw new Error(`discriminator: "${c}" must be required`);return y;function T({required:R}){return Array.isArray(R)&&R.includes(c)}function I(R,F){if(R.const)D(R.const,F);else if(R.enum)for(const L of R.enum)D(L,F);else throw new Error(`discriminator: "properties/${c}" must have "const" or "enum"`)}function D(R,F){if(typeof R!="string"||R in y)throw new Error(`discriminator: "${c}" values must be unique strings`);y[R]=F}}}};Ma.default=PS;const jS={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;const n=Td,r=ra,o=Ma,a=jS,s=["/properties"],c="http://json-schema.org/draft-07/schema";class d extends n.default{_addVocabularies(){super._addVocabularies(),r.default.forEach(y=>this.addVocabulary(y)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const y=this.opts.$data?this.$dataMetaSchema(a,s):a;this.addMetaSchema(y,c,!1),this.refs["http://json-schema.org/schema"]=c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}}e.exports=t=d,Object.defineProperty(t,"__esModule",{value:!0}),t.default=d;var u=Yt;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var h=Pe;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return h._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return h.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return h.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return h.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return h.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return h.CodeGen}});var l=po;Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return l.default}});var f=mo;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return f.default}})})(qs,qs.exports);var xS=qs.exports;const DS=Vi(xS);function LS(e,t){for(const n in t.screens){const r=t.screens[n];if(r.buttons)for(const[o,a]of r.buttons.entries())typeof a=="object"&&(e.buttons.buttons[a.id]=a,r.buttons[o]=a.id)}return t}function MS(e,t){if(t.transitions)for(const n in t.transitions)Xo[n]?Object.assign(Xo[n],t.transitions[n]):Xo[n]=t.transitions[n];return t}function BS(e,t,n){switch(e){case"screens":return LS(t,n);case"common":return MS(t,n);default:return n}}function vf(e,t,n){const r=e[t],o=(a,s,c)=>s;if(n){let a=Jn(r,n,{arrayMerge:o});return a=BS(t,e,a),a}}function Ra(e){return!(!e||!e.default)}function Fa(e){if(Te().clearErrors(),!Ra(e))return;console.log("Received HMR update for ",e.default.id);const t=e.default;if(Va(t))vt().addNotification(`Reloaded ${t.fileName}`,"You can continue playing with the changes."),Ie.addNarratScript(t);else if(wi(t)){const n=st().findConfigModuleKey(t);if(n){const r=vf(st().config,n,t.code);st().reloadConfigModule(n,r);const o=Object.values(eT()).find(a=>a.config===n);o&&o.store().updateConfig&&o.store().updateConfig(r)}console.log(`Yaml update ${t.fileName}}`)}else console.error("Unknown module type",t)}function Va(e){return typeof e=="object"&&e!==null&&typeof e.code=="string"&&typeof e.fileName=="string"&&typeof e.id=="string"&&e.type==="script"}function wi(e){return typeof e=="object"&&e!==null&&typeof e.code=="object"&&typeof e.fileName=="string"&&typeof e.id=="string"&&e.type==="yaml"}window.narratHMRHandler=e=>{const t=window.narrat;t&&t.handleHMR(e);const n=new CustomEvent("narrat-hmr",{detail:{newModule:e}});document.body.dispatchEvent(n)};class V{constructor(t,n,r,o){De(this,"keyword");De(this,"runner");De(this,"argTypes");De(this,"parser");De(this,"onPlayerAnswered");De(this,"returnAfterPlayerAnswer");this.keyword=t,this.runner=r,this.argTypes=n,o?this.parser=o:this.parser=Dr(this.keyword,this.argTypes),this.returnAfterPlayerAnswer=!1}async run(t,n){let r=await this.runner(t,n);return this.returnAfterPlayerAnswer&&(r=await new Promise((o,a)=>{ve().waitForPlayerAnswer(t),t.finishCommand=o})),r}async processPlayerAnswer(t,n){let r=n;return this.onPlayerAnswered&&(r=await this.onPlayerAnswered(t,n)),this.returnAfterPlayerAnswer&&t.finishCommand&&t.finishCommand(r),r}static FromOptions(t){const n=new V(t.keyword,t.argTypes,t.runner,t.parser);return n.onPlayerAnswered=t.onPlayerAnswered,n.returnAfterPlayerAnswer=t.returnAfterPlayerAnswer??!1,n}}function Dr(e,t){let n=[];if(t!=="any"){n=[];let r=!1;const o=t.reduce((a,s)=>(s.type==="rest"&&(r=!0),s.optional&&a++,a),0);o>=1?n.push(t.length-o):n.push(t.length),n.push(t.length),r&&(n[1]=1/0)}return(r,o)=>{const a={newLine:r.currentLine+1},s=o.command.args;if(t!=="any"&&(s.length<n[0]||s.length>n[1]))return console.log("Error details"),console.log(o.command),console.log(s),r.parserContext.error(r.line.line,`Command ${e}: Expected ${n.join(" to ")} arguments but got ${s.length}`),a;if(o.command.commandType=e,t!=="any"){let c=!1;o.command.args.forEach((d,u)=>{if(c)return;const h=t[u];if(h.type==="rest"){c=!0;return}!Uc(d)&&!qc(d)&&(h.type==="any"||typeof d===h.type||r.parserContext.error(r.line.line,`Command ${e}: Argument #${u+1} (${h.name}) should be a ${h.type}, but got type ${typeof d}: ${JSON.stringify(d)}`))})}return{newLine:r.currentLine+1}}}function se(e,t){console.error("Runtime error ========================="),console.error(`Command: ${e.commandType}`),console.error("Args: ",e.args),console.error("Options: ",e.options),ae(`Runtime error at ${e.fileName}:${e.line} (${e.commandType}) ${e.code}. -
82
82
  <br />
83
- Error: ${t}`),console.error("============================")}function LS(e,...t){console.log(`[${e.fileName}:${e.line}] log: `,...t)}function bf(e,t,n){const r=V.FromOptions({keyword:e,argTypes:t,runner:async o=>await we().runLabelFunction(n,...o.args)});Ie.addCommand(r)}const MS=V.FromOptions({keyword:"create_macro",argTypes:"any",runner:async e=>{e.args.length<2&&se(e,"create_macro command needs at least a name and a label");const t=e.args[0],n=e.args[1],o=e.args.slice(2).map(a=>({name:a,type:"any"}));bf(t,o,n)}}),RS=[["items",nc,rc],["achievements",wc,kc],["screens",uc,dc],["skills",mc,hc],["skillChecks",Cc,$c],["buttons",ac,lc],["scripts",Xl,qm],["audio",Ml,Rl],["quests",oc,ic],["tooltips",bc,Tc],["characters",yc,gc],["choices",Oc,Ac],["animations",Nc,Pc],["macros",jc,Dc],["preload",xc,Lc]],BS=[["common",Zl,ts]],Cn=new PS({allErrors:!0}),FS=["baseAssetsPath","baseDataPath","gameTitle","saveFileName","images","layout","settings","gameFlow","dialogPanel","splashScreens","notifications","hudStats","interactionTags","transitions","menuButtons","debugging","saves"];async function VS(e,t){for(const[n,r,o]of BS){const a=t[n];let s=Tf(o);try{if(!Cn.validate(r,a))throw console.error(Cn.errors),new Error(`${Cn.errorsText()}`)}catch(c){console.error(c),ae(`${n} config error: ${c}`)}typeof a<"u"&&(s=Tf(a,s)),e[n]=s}}function Tf(e,t){return typeof e=="object"?Array.isArray(e)?[...e]:{...t,...e}:typeof e<"u"?e:t}async function US(e,t){for(const n of FS){const r=t[n];r&&(typeof r=="object"&&!Array.isArray(r)?e.common[n]={...e.common[n],...r}:e.common[n]=r)}}async function qS(e){const t={...br};ni(e)?await VS(t,e):US(t,e);for(const n of RS){const r=n[0],o=n[1],a=n[2];let s=e[r];if(s&&typeof s=="string")try{if(s=await ro(Ua(t.common.baseDataPath,s)),!Cn.validate(o,s))throw console.error(Cn.errors),new Error(`${Cn.errorsText()}`)}catch(c){console.error(c),ae(`${r} config error: ${c}`),s={...a}}s&&(Array.isArray(s)?t[r]=s:typeof s=="object"?t[r]={...a,...s}:t[r]=s)}for(const n in t)_f(t,n,t[n]);for(const n of t.macros.macros){const r=n.options??[];bf(n.keyword,r,n.label)}return t}async function HS(e){let t;if(e.config){const o=e.config;t={};for(const a in o){const s=o[a];vi(s)?(lt().addConfigModule(a,{id:s.id,configKey:a,code:s.code}),t[a]=s.code):t[a]=s}}else if(e.configPath)t=await ro(e.configPath);else throw ae("No config file or config object provided"),new Error("No config file or config object provided");let n=t;return ni(t)&&(n=t.common),n.baseAssetsPath=e.baseAssetsPath??n.baseAssetsPath??"",n.baseDataPath=e.baseDataPath??n.baseDataPath??"",Cn.validate(Vs,t)||(ae("Config file validation failed."),console.log(Cn.errors),ae(Cn.errorsText())),qS(t)}function Ve(){return lt().config}function le(){return Ve().common}function sr(e){const t=le().hudStats[e];return t||ae(`Hud stat ${e} doesn't exist`),t}function Lt(){return Ve().audio}function vf(e){const t=Lt().files[e];if(!t){Zn(`Audio file ${e} doesn't exist`);return}return t}function Si(e){const t=vf(e),n=((t==null?void 0:t.fadeInDelay)??Lt().options.musicFadeInDelay)*1e3,r=((t==null?void 0:t.fadeInTime)??Lt().options.musicFadeInTime)*1e3,o=((t==null?void 0:t.fadeOutTime)??Lt().options.musicFadeOutTime)*1e3;return{fadeInDelay:n,fadeInTime:r,fadeOutTime:o}}function dn(){return Ve().skills}function vo(){return Ve().skillChecks}function wi(){return Ve().items}function So(){return Ve().quests}function ki(){return Ve().screens}function Ci(){return Ve().buttons}function Fn(){return Ve().tooltips}function $i(){return Ve().characters}function Va(){return Ve().choices}function Sf(){return Ve().animations}function wf(e){return Va().choicePrompts[e]}function xr(e){return e===Uo?Ul:ki().screens[e]?ki().screens[e]:(ae(`Screen config for screen ${e} doesn't exist`),Ul)}function Ei(e){const n=Fn().tooltips.find(r=>r.keywords.includes(e));return n||(ae(`Tooltip config for keyword ${e} not found`),null)}function Oi(e){const t=Ve().skills.skills[e];return t||ae(`Skill config for skill ${e} doesn't exist`),t}function kf(e){const t=Ve().skillChecks.skillChecks[e];return t||ae(`Skill check config for skill check ${e} doesn't exist`),t}function Cf(e){return!!Ve().skillChecks.skillChecks[e]}function Lr(e){return e.startsWith("http")?e:$t(e)}function $t(e){var n,r,o,a;if(e.startsWith("http"))return e;let t=e;return le().images[e]?t=le().images[e]:(n=Ve().preload.images)!=null&&n.assets[e]?t=(r=Ve().preload.images)==null?void 0:r.assets[e]:(o=Ve().preload.video)!=null&&o.assets[e]&&(t=(a=Ve().preload.video)==null?void 0:a.assets[e]),le().baseAssetsPath?`${le().baseAssetsPath}${t}`:t}function Ua(e,t){return`${e}${t}`}function Ai(e){return le().baseDataPath?`${le().baseDataPath}${e}`:e}function Vn(e){const t=Ci().buttons[e];return t||ae(`Button config for button ${e} doesn't exist`),t}function en(e){const t=wi().items[e];return t||ae(`Item config for skill ${e} doesn't exist`),t}function wo(){return Ve().achievements}function qa(e){const t=wo().achievements[e];return t||ae(`Achievement config for achievement ${e} doesn't exist`),t}function $n(e){return So().quests[e]}function $f(e,t){const r=$n(e).endings;return r||ae(`Quest ${e} doesn't have any endings`),r[t]||ae(`Quest ${e} has no ending called ${t}`),r[t]}function ko(e,t){return $n(e).objectives[t]}function Ii(){return le().dialogPanel.width??Rm}const dt=et("quests",{state:()=>({quests:{}}),actions:{getQuest(e){const t=this.quests[e];if(t)return t;{const n=`Quest ${e} doesn't exist!`;throw ae(n),new Error(n)}},getObjective(e,t){const n=this.getQuest(e);if(!n){const a=`Quest ${e} doesn't exist!`;throw ae(a),new Error(a)}const r=n.objectives[t];if(r)return r;const o=`Objective ${t} doesn't exist in quest ${e}!`;throw ae(o),new Error(o)},updateConfig(e){const t=e.quests;for(const n of Object.keys(t)){const r=t[n];this.quests[n]||(this.quests[n]={id:n,state:"hidden",objectives:{},extraData:{}});for(const o of Object.keys(r.objectives)){const a=r.objectives[o];this.quests[n].objectives[o]||(this.quests[n].objectives[o]={extraData:{},id:o,state:a.hidden?"hidden":"unlocked"})}}},reset(e){this.$reset(),this.updateConfig(e)},startQuest(e){const t=this.getQuest(e);t?(t.state="unlocked",vt().addNotification(`Started quest: ${$n(e).title}`)):ae(`Quest ${e} doesn't exist!`)},startObjective(e,t){const n=this.getObjective(e,t);n?(n.state="unlocked",vt().addNotification(`New quest objective: ${ko(e,t).description}`)):ae(`Objective ${t} doesn't exist in quest ${e}!`)},completeObjective(e,t){const n=this.getObjective(e,t);n?(n.state="completed",vt().addNotification(`Completed quest objective: ${ko(e,t).description}`)):ae(`Objective ${t} doesn't exist in quest ${e}!`)},completeQuest(e,t){const n=this.getQuest(e);if(n){if(n.state="completed",typeof t=="string"){n.ending=t;const r=$f(e,t);n.succeeded=r.success}else typeof t=="boolean"?n.succeeded=t:n.succeeded=!0;vt().addNotification(`Completed quest: ${$n(e).title}`)}else ae(`Quest ${e} doesn't exist!`)},isQuestCompleted(e){const t=this.getQuest(e);return t?t.state==="completed":!1},isQuestSucceeded(e){const t=this.getQuest(e);return t?t.state==="completed"&&t.succeeded:!1},isQuestFailed(e){const t=this.getQuest(e);return t?t.state==="completed"&&!t.succeeded:!1},getQuestEnding(e){const t=this.getQuest(e);return t?t.ending:!1},questHasEnding(e,t){return this.getQuestEnding(e)===t},isObjectiveCompleted(e,t){const n=this.getObjective(e,t);return n?n.state==="completed":!1},isQuestStarted(e){const t=this.getQuest(e);return t&&t.state==="unlocked"},isObjectiveStarted(e,t){return this.getObjective(e,t).state==="unlocked"},removeQuest(e){delete this.quests[e]},generateSaveData(){return{quests:Re(this.quests)}},loadSaveData(e){this.quests=e.quests}}});function Ef(e,t,n,r="$"){if(!n.startsWith(r))return isNaN(Number(n))?[null,n]:[null,Number(n)];n=n.substring(1);const o=/\[/,a=/\]/;let s=n.search(o);n.search(a);let c=n,d=t,u=0;for(;u<n.length;){if(s>u||s===-1){const h=s>u?s:n.length;let l=n.substring(u,h);isNaN(Number(l))||(l=Number(l)),u>0&&(d=d[c]),[d,c]=GS(d,l)}if(s!==-1){u=s;const h=n.substring(s+1),l=KS(h)+s,f=n.substring(s+1,l),[m,y]=Ef(e,e,f);let b=y;m&&(b=m[y]),typeof b=="number"||!isNaN(Number(b))?b=Number(b):typeof b!="string"&&console.error(`invalid array index (${b}) key type when compiling: ${n}`),d=d[c],c=b,u=l+1;const S=n.substring(u);s=S.search(o),s!==-1&&(s+=u),S.search(a)}else u=n.length}return[d,c]}function KS(e){let t=!1,n=0,r,o=1;for(;!t;){r=e.substring(n);const a=r.search(/\[/),s=r.search(/\]/);a!==-1&&a<s?(n+=a+1,o++):(n+=s+1,o--),o===0&&(t=!0),a===-1&&s===-1&&!t&&ae(`Could not find closing bracket in ${e}`)}return n}function GS(e,t){if(typeof t=="number")return[e,t];t.startsWith(".")&&(t=t.substring(1));const n=t.split(".");let r=e;const o=n.length-1;let a=n[0],s=0;for(s=0;s<o;s++)a=n[s],typeof r[a]>"u"&&(r[a]={}),r=r[a];return a=n[s],[r,a]}function Ni(e,t,n="$"){return Ef(e,e,t)}function zS(e,t){return Ni(e,t)}function Of(e,t,n){const[r,o]=Ni(e,t);r[o]=n}function Af(e,t,n){const[r,o]=Ni(e,t),a=r[o]||0;r[o]=n+a}function Mr(){const e=we(),t=Xe(),n=Ut(),r=mt(),o=we().scope,a={data:e.data,global:e.globalData,skills:t.skills,skillChecks:t.skillChecks,buttons:n.buttons,items:r.items,quests:dt().quests,stats:Pt().hudStats,scope:o,config:le(),gameOptions:Te().options,baseSettings:sn().baseSettings,customSettings:sn().customSettings};return new Proxy(a,{get:(c,d,u)=>{const h=we().scope,l=we().data;return typeof h[d]<"u"?h[d]:typeof l[d]<"u"?l[d]:Reflect.get(c,d,u)},set:(c,d,u,h)=>{const l=we().scope,f=we().data;if(typeof l[d]<"u")l[d]=u;else{if(typeof c[d]<"u")return Reflect.set(c,d,u,h);typeof u=="object"?f[d]={}:f[d]=u}return!0}})}function Re(e){if(e===null)return null;if(typeof e=="object")if(Array.isArray(e)){const t=[];for(const n in e)t[n]=Re(e[n]);return t}else{const t={};for(const n in e)t[n]=Re(e[n]);return t}else return e}function Ha(e,t){if(e===null)return null;if(typeof e=="object"){const n=t(e);if(t(e))return n;if(Array.isArray(e)){const r=[];for(const o in e)r[o]=Ha(e[o],t);return r}else{const r={};for(const o in e)r[o]=Ha(e[o],t);return r}}else return t(e)}const Xe=et("skills",{state:()=>({skillChecks:{},skills:{}}),actions:{setupSkillCheck(e,t){this.skillChecks[t]=e},passSkillCheck(e,t){this.skillChecks[e].happened=!0,this.skillChecks[e].succeeded=!0,t&&(this.skillChecks[e].hidden=!0)},failSkillCheck(e,t){this.skillChecks[e].happened=!0,this.skillChecks[e].succeeded=!1,t&&(this.skillChecks[e].hidden=!0)},resetSkillCheck(e){this.skillChecks[e].happened=!1,this.skillChecks[e].succeeded=!1,this.skillChecks[e].hidden=!1},generateSaveData(){return{skillChecks:Re(this.skillChecks),skills:Re(this.skills)}},getSkillCheck(e){return this.skillChecks[e]||this.setupSkillCheck(this.createSkillCheckState(),e),this.skillChecks[e]},createSkillCheckState(){return{happened:!1,succeeded:!1,hidden:!1}},loadSaveData(e){this.skillChecks=Yn(this.skillChecks,e.skillChecks),this.skills=Yn(this.skills,e.skills)},updateConfig(e){const t=e.skills;for(const n in t)this.skills[n]||(this.skills[n]={id:n,level:t[n].startingLevel||0,xp:0})},reset(e){this.$reset(),this.updateConfig(e)},getSkill(e){return this.skills[e]},getSkillLevel(e){return this.getSkill(e).level},getSkillXp(e){return this.getSkill(e).xp},addXp(e,t){const n=this.getSkill(e);n||ae(`Skill ${e} doesn't exist`),n.xp+=t,n.xp>=dn().skillOptions.xpPerLevel&&(n.xp=0,n.level++,this.levelledUp(e))},setSkillLevel(e,t){const n=this.getSkill(e);n||ae(`Skill ${e} doesn't exist`),n.level=t,this.levelledUp(e)},incrementSkill(e,t){this.getSkill(e).level+=t,this.levelledUp(e)},levelledUp(e){const t=dn().skills[e].name,n=this.skills[e].level;dn().skillOptions.notifyLevelUp&&vt().addNotification(`Your skill in ${t} is now level ${n}`)}}});function En(e){return Array.isArray?Array.isArray(e):Pf(e)==="[object Array]"}const WS=1/0;function QS(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-WS?"-0":t}function YS(e){return e==null?"":QS(e)}function fn(e){return typeof e=="string"}function If(e){return typeof e=="number"}function JS(e){return e===!0||e===!1||XS(e)&&Pf(e)=="[object Boolean]"}function Nf(e){return typeof e=="object"}function XS(e){return Nf(e)&&e!==null}function Mt(e){return e!=null}function Ka(e){return!e.trim().length}function Pf(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const yA="Extended search is not available",ZS="Incorrect 'index' type",ew=e=>`Invalid value for key ${e}`,tw=e=>`Pattern length exceeds max of ${e}.`,nw=e=>`Missing ${e} property in key`,rw=e=>`Property 'weight' in key '${e}' must be a positive integer`,jf=Object.prototype.hasOwnProperty;class ow{constructor(t){this._keys=[],this._keyMap={};let n=0;t.forEach(r=>{let o=Df(r);n+=o.weight,this._keys.push(o),this._keyMap[o.id]=o,n+=o.weight}),this._keys.forEach(r=>{r.weight/=n})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Df(e){let t=null,n=null,r=null,o=1,a=null;if(fn(e)||En(e))r=e,t=xf(e),n=Ga(e);else{if(!jf.call(e,"name"))throw new Error(nw("name"));const s=e.name;if(r=s,jf.call(e,"weight")&&(o=e.weight,o<=0))throw new Error(rw(s));t=xf(s),n=Ga(s),a=e.getFn}return{path:t,id:n,weight:o,src:r,getFn:a}}function xf(e){return En(e)?e:e.split(".")}function Ga(e){return En(e)?e.join("."):e}function iw(e,t){let n=[],r=!1;const o=(a,s,c)=>{if(Mt(a))if(!s[c])n.push(a);else{let d=s[c];const u=a[d];if(!Mt(u))return;if(c===s.length-1&&(fn(u)||If(u)||JS(u)))n.push(YS(u));else if(En(u)){r=!0;for(let h=0,l=u.length;h<l;h+=1)o(u[h],s,c+1)}else s.length&&o(u,s,c+1)}};return o(e,fn(t)?t.split("."):t,0),r?n:n[0]}var Ae={...{isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},...{includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},...{location:0,threshold:.6,distance:100},...{useExtendedSearch:!1,getFn:iw,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1}};const sw=/[^ ]+/g;function aw(e=1,t=3){const n=new Map,r=Math.pow(10,t);return{get(o){const a=o.match(sw).length;if(n.has(a))return n.get(a);const s=1/Math.pow(a,.5*e),c=parseFloat(Math.round(s*r)/r);return n.set(a,c),c},clear(){n.clear()}}}class za{constructor({getFn:t=Ae.getFn,fieldNormWeight:n=Ae.fieldNormWeight}={}){this.norm=aw(n,3),this.getFn=t,this.isCreated=!1,this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach((n,r)=>{this._keysMap[n.id]=r})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,fn(this.docs[0])?this.docs.forEach((t,n)=>{this._addString(t,n)}):this.docs.forEach((t,n)=>{this._addObject(t,n)}),this.norm.clear())}add(t){const n=this.size();fn(t)?this._addString(t,n):this._addObject(t,n)}removeAt(t){this.records.splice(t,1);for(let n=t,r=this.size();n<r;n+=1)this.records[n].i-=1}getValueForItemAtKeyId(t,n){return t[this._keysMap[n]]}size(){return this.records.length}_addString(t,n){if(!Mt(t)||Ka(t))return;let r={v:t,i:n,n:this.norm.get(t)};this.records.push(r)}_addObject(t,n){let r={i:n,$:{}};this.keys.forEach((o,a)=>{let s=o.getFn?o.getFn(t):this.getFn(t,o.path);if(Mt(s)){if(En(s)){let c=[];const d=[{nestedArrIndex:-1,value:s}];for(;d.length;){const{nestedArrIndex:u,value:h}=d.pop();if(Mt(h))if(fn(h)&&!Ka(h)){let l={v:h,i:u,n:this.norm.get(h)};c.push(l)}else En(h)&&h.forEach((l,f)=>{d.push({nestedArrIndex:f,value:l})})}r.$[a]=c}else if(fn(s)&&!Ka(s)){let c={v:s,n:this.norm.get(s)};r.$[a]=c}}}),this.records.push(r)}toJSON(){return{keys:this.keys,records:this.records}}}function Lf(e,t,{getFn:n=Ae.getFn,fieldNormWeight:r=Ae.fieldNormWeight}={}){const o=new za({getFn:n,fieldNormWeight:r});return o.setKeys(e.map(Df)),o.setSources(t),o.create(),o}function lw(e,{getFn:t=Ae.getFn,fieldNormWeight:n=Ae.fieldNormWeight}={}){const{keys:r,records:o}=e,a=new za({getFn:t,fieldNormWeight:n});return a.setKeys(r),a.setIndexRecords(o),a}function Pi(e,{errors:t=0,currentLocation:n=0,expectedLocation:r=0,distance:o=Ae.distance,ignoreLocation:a=Ae.ignoreLocation}={}){const s=t/e.length;if(a)return s;const c=Math.abs(r-n);return o?s+c/o:c?1:s}function cw(e=[],t=Ae.minMatchCharLength){let n=[],r=-1,o=-1,a=0;for(let s=e.length;a<s;a+=1){let c=e[a];c&&r===-1?r=a:!c&&r!==-1&&(o=a-1,o-r+1>=t&&n.push([r,o]),r=-1)}return e[a-1]&&a-r>=t&&n.push([r,a-1]),n}const ar=32;function uw(e,t,n,{location:r=Ae.location,distance:o=Ae.distance,threshold:a=Ae.threshold,findAllMatches:s=Ae.findAllMatches,minMatchCharLength:c=Ae.minMatchCharLength,includeMatches:d=Ae.includeMatches,ignoreLocation:u=Ae.ignoreLocation}={}){if(t.length>ar)throw new Error(tw(ar));const h=t.length,l=e.length,f=Math.max(0,Math.min(r,l));let m=a,y=f;const b=c>1||d,S=b?Array(l):[];let T;for(;(T=e.indexOf(t,y))>-1;){let P=Pi(t,{currentLocation:T,expectedLocation:f,distance:o,ignoreLocation:u});if(m=Math.min(P,m),y=T+h,b){let Y=0;for(;Y<h;)S[T+Y]=1,Y+=1}}y=-1;let I=[],x=1,B=h+l;const F=1<<h-1;for(let P=0;P<h;P+=1){let Y=0,W=B;for(;Y<W;)Pi(t,{errors:P,currentLocation:f+W,expectedLocation:f,distance:o,ignoreLocation:u})<=m?Y=W:B=W,W=Math.floor((B-Y)/2+Y);B=W;let X=Math.max(1,f-W+1),G=s?l:Math.min(f+W,l)+h,z=Array(G+2);z[G+1]=(1<<P)-1;for(let te=G;te>=X;te-=1){let ke=te-1,Ne=n[e.charAt(ke)];if(b&&(S[ke]=+!!Ne),z[te]=(z[te+1]<<1|1)&Ne,P&&(z[te]|=(I[te+1]|I[te])<<1|1|I[te+1]),z[te]&F&&(x=Pi(t,{errors:P,currentLocation:ke,expectedLocation:f,distance:o,ignoreLocation:u}),x<=m)){if(m=x,y=ke,y<=f)break;X=Math.max(1,2*f-y)}}if(Pi(t,{errors:P+1,currentLocation:f,expectedLocation:f,distance:o,ignoreLocation:u})>m)break;I=z}const L={isMatch:y>=0,score:Math.max(.001,x)};if(b){const P=cw(S,c);P.length?d&&(L.indices=P):L.isMatch=!1}return L}function dw(e){let t={};for(let n=0,r=e.length;n<r;n+=1){const o=e.charAt(n);t[o]=(t[o]||0)|1<<r-n-1}return t}class Mf{constructor(t,{location:n=Ae.location,threshold:r=Ae.threshold,distance:o=Ae.distance,includeMatches:a=Ae.includeMatches,findAllMatches:s=Ae.findAllMatches,minMatchCharLength:c=Ae.minMatchCharLength,isCaseSensitive:d=Ae.isCaseSensitive,ignoreLocation:u=Ae.ignoreLocation}={}){if(this.options={location:n,threshold:r,distance:o,includeMatches:a,findAllMatches:s,minMatchCharLength:c,isCaseSensitive:d,ignoreLocation:u},this.pattern=d?t:t.toLowerCase(),this.chunks=[],!this.pattern.length)return;const h=(f,m)=>{this.chunks.push({pattern:f,alphabet:dw(f),startIndex:m})},l=this.pattern.length;if(l>ar){let f=0;const m=l%ar,y=l-m;for(;f<y;)h(this.pattern.substr(f,ar),f),f+=ar;if(m){const b=l-ar;h(this.pattern.substr(b),b)}}else h(this.pattern,0)}searchIn(t){const{isCaseSensitive:n,includeMatches:r}=this.options;if(n||(t=t.toLowerCase()),this.pattern===t){let y={isMatch:!0,score:0};return r&&(y.indices=[[0,t.length-1]]),y}const{location:o,distance:a,threshold:s,findAllMatches:c,minMatchCharLength:d,ignoreLocation:u}=this.options;let h=[],l=0,f=!1;this.chunks.forEach(({pattern:y,alphabet:b,startIndex:S})=>{const{isMatch:T,score:I,indices:x}=uw(t,y,b,{location:o+S,distance:a,threshold:s,findAllMatches:c,minMatchCharLength:d,includeMatches:r,ignoreLocation:u});T&&(f=!0),l+=I,T&&x&&(h=[...h,...x])});let m={isMatch:f,score:f?l/this.chunks.length:1};return f&&r&&(m.indices=h),m}}class Un{constructor(t){this.pattern=t}static isMultiMatch(t){return Rf(t,this.multiRegex)}static isSingleMatch(t){return Rf(t,this.singleRegex)}search(){}}function Rf(e,t){const n=e.match(t);return n?n[1]:null}class fw extends Un{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const n=t===this.pattern;return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class pw extends Un{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const r=t.indexOf(this.pattern)===-1;return{isMatch:r,score:r?0:1,indices:[0,t.length-1]}}}class mw extends Un{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const n=t.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class hw extends Un{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const n=!t.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}}class yw extends Un{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const n=t.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[t.length-this.pattern.length,t.length-1]}}}class gw extends Un{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const n=!t.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}}class Bf extends Un{constructor(t,{location:n=Ae.location,threshold:r=Ae.threshold,distance:o=Ae.distance,includeMatches:a=Ae.includeMatches,findAllMatches:s=Ae.findAllMatches,minMatchCharLength:c=Ae.minMatchCharLength,isCaseSensitive:d=Ae.isCaseSensitive,ignoreLocation:u=Ae.ignoreLocation}={}){super(t),this._bitapSearch=new Mf(t,{location:n,threshold:r,distance:o,includeMatches:a,findAllMatches:s,minMatchCharLength:c,isCaseSensitive:d,ignoreLocation:u})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class Ff extends Un{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let n=0,r;const o=[],a=this.pattern.length;for(;(r=t.indexOf(this.pattern,n))>-1;)n=r+a,o.push([r,n-1]);const s=!!o.length;return{isMatch:s,score:s?0:1,indices:o}}}const Wa=[fw,Ff,mw,hw,gw,yw,pw,Bf],Vf=Wa.length,_w=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,bw="|";function Tw(e,t={}){return e.split(bw).map(n=>{let r=n.trim().split(_w).filter(a=>a&&!!a.trim()),o=[];for(let a=0,s=r.length;a<s;a+=1){const c=r[a];let d=!1,u=-1;for(;!d&&++u<Vf;){const h=Wa[u];let l=h.isMultiMatch(c);l&&(o.push(new h(l,t)),d=!0)}if(!d)for(u=-1;++u<Vf;){const h=Wa[u];let l=h.isSingleMatch(c);if(l){o.push(new h(l,t));break}}}return o})}const vw=new Set([Bf.type,Ff.type]);class Sw{constructor(t,{isCaseSensitive:n=Ae.isCaseSensitive,includeMatches:r=Ae.includeMatches,minMatchCharLength:o=Ae.minMatchCharLength,ignoreLocation:a=Ae.ignoreLocation,findAllMatches:s=Ae.findAllMatches,location:c=Ae.location,threshold:d=Ae.threshold,distance:u=Ae.distance}={}){this.query=null,this.options={isCaseSensitive:n,includeMatches:r,minMatchCharLength:o,findAllMatches:s,ignoreLocation:a,location:c,threshold:d,distance:u},this.pattern=n?t:t.toLowerCase(),this.query=Tw(this.pattern,this.options)}static condition(t,n){return n.useExtendedSearch}searchIn(t){const n=this.query;if(!n)return{isMatch:!1,score:1};const{includeMatches:r,isCaseSensitive:o}=this.options;t=o?t:t.toLowerCase();let a=0,s=[],c=0;for(let d=0,u=n.length;d<u;d+=1){const h=n[d];s.length=0,a=0;for(let l=0,f=h.length;l<f;l+=1){const m=h[l],{isMatch:y,indices:b,score:S}=m.search(t);if(y){if(a+=1,c+=S,r){const T=m.constructor.type;vw.has(T)?s=[...s,...b]:s.push(b)}}else{c=0,a=0,s.length=0;break}}if(a){let l={isMatch:!0,score:c/a};return r&&(l.indices=s),l}}return{isMatch:!1,score:1}}}const Qa=[];function ww(...e){Qa.push(...e)}function Ya(e,t){for(let n=0,r=Qa.length;n<r;n+=1){let o=Qa[n];if(o.condition(e,t))return new o(e,t)}return new Mf(e,t)}const ji={AND:"$and",OR:"$or"},Ja={PATH:"$path",PATTERN:"$val"},Xa=e=>!!(e[ji.AND]||e[ji.OR]),kw=e=>!!e[Ja.PATH],Cw=e=>!En(e)&&Nf(e)&&!Xa(e),Uf=e=>({[ji.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function qf(e,t,{auto:n=!0}={}){const r=o=>{let a=Object.keys(o);const s=kw(o);if(!s&&a.length>1&&!Xa(o))return r(Uf(o));if(Cw(o)){const d=s?o[Ja.PATH]:a[0],u=s?o[Ja.PATTERN]:o[d];if(!fn(u))throw new Error(ew(d));const h={keyId:Ga(d),pattern:u};return n&&(h.searcher=Ya(u,t)),h}let c={children:[],operator:a[0]};return a.forEach(d=>{const u=o[d];En(u)&&u.forEach(h=>{c.children.push(r(h))})}),c};return Xa(e)||(e=Uf(e)),r(e)}function $w(e,{ignoreFieldNorm:t=Ae.ignoreFieldNorm}){e.forEach(n=>{let r=1;n.matches.forEach(({key:o,norm:a,score:s})=>{const c=o?o.weight:null;r*=Math.pow(s===0&&c?Number.EPSILON:s,(c||1)*(t?1:a))}),n.score=r})}function Ew(e,t){const n=e.matches;t.matches=[],Mt(n)&&n.forEach(r=>{if(!Mt(r.indices)||!r.indices.length)return;const{indices:o,value:a}=r;let s={indices:o,value:a};r.key&&(s.key=r.key.src),r.idx>-1&&(s.refIndex=r.idx),t.matches.push(s)})}function Ow(e,t){t.score=e.score}function Aw(e,t,{includeMatches:n=Ae.includeMatches,includeScore:r=Ae.includeScore}={}){const o=[];return n&&o.push(Ew),r&&o.push(Ow),e.map(a=>{const{idx:s}=a,c={item:t[s],refIndex:s};return o.length&&o.forEach(d=>{d(a,c)}),c})}class Rr{constructor(t,n={},r){this.options={...Ae,...n},this.options.useExtendedSearch,this._keyStore=new ow(this.options.keys),this.setCollection(t,r)}setCollection(t,n){if(this._docs=t,n&&!(n instanceof za))throw new Error(ZS);this._myIndex=n||Lf(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){Mt(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const n=[];for(let r=0,o=this._docs.length;r<o;r+=1){const a=this._docs[r];t(a,r)&&(this.removeAt(r),r-=1,o-=1,n.push(a))}return n}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:n=-1}={}){const{includeMatches:r,includeScore:o,shouldSort:a,sortFn:s,ignoreFieldNorm:c}=this.options;let d=fn(t)?fn(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return $w(d,{ignoreFieldNorm:c}),a&&d.sort(s),If(n)&&n>-1&&(d=d.slice(0,n)),Aw(d,this._docs,{includeMatches:r,includeScore:o})}_searchStringList(t){const n=Ya(t,this.options),{records:r}=this._myIndex,o=[];return r.forEach(({v:a,i:s,n:c})=>{if(!Mt(a))return;const{isMatch:d,score:u,indices:h}=n.searchIn(a);d&&o.push({item:a,idx:s,matches:[{score:u,value:a,norm:c,indices:h}]})}),o}_searchLogical(t){const n=qf(t,this.options),r=(c,d,u)=>{if(!c.children){const{keyId:l,searcher:f}=c,m=this._findMatches({key:this._keyStore.get(l),value:this._myIndex.getValueForItemAtKeyId(d,l),searcher:f});return m&&m.length?[{idx:u,item:d,matches:m}]:[]}const h=[];for(let l=0,f=c.children.length;l<f;l+=1){const m=c.children[l],y=r(m,d,u);if(y.length)h.push(...y);else if(c.operator===ji.AND)return[]}return h},o=this._myIndex.records,a={},s=[];return o.forEach(({$:c,i:d})=>{if(Mt(c)){let u=r(n,c,d);u.length&&(a[d]||(a[d]={idx:d,item:c,matches:[]},s.push(a[d])),u.forEach(({matches:h})=>{a[d].matches.push(...h)}))}}),s}_searchObjectList(t){const n=Ya(t,this.options),{keys:r,records:o}=this._myIndex,a=[];return o.forEach(({$:s,i:c})=>{if(!Mt(s))return;let d=[];r.forEach((u,h)=>{d.push(...this._findMatches({key:u,value:s[h],searcher:n}))}),d.length&&a.push({idx:c,item:s,matches:d})}),a}_findMatches({key:t,value:n,searcher:r}){if(!Mt(n))return[];let o=[];if(En(n))n.forEach(({v:a,i:s,n:c})=>{if(!Mt(a))return;const{isMatch:d,score:u,indices:h}=r.searchIn(a);d&&o.push({score:u,key:t,value:a,idx:s,norm:c,indices:h})});else{const{v:a,n:s}=n,{isMatch:c,score:d,indices:u}=r.searchIn(a);c&&o.push({score:d,key:t,value:a,norm:s,indices:u})}return o}}Rr.version="6.6.2",Rr.createIndex=Lf,Rr.parseIndex=lw,Rr.config=Ae,Rr.parseQuery=qf,ww(Sw);const Iw=i.createElementVNode("h3",{class:"title"},"Jump to label",-1),Nw={key:0,class:"search-results"},Pw={key:1},jw=[i.createElementVNode("h3",null,"No matches found",-1)],Dw=i.defineComponent({__name:"debug-jumping",emits:["close","jump"],setup(e,{emit:t}){const n=t;let r;const o=i.ref(null),a=i.ref(""),s=i.ref([]),c=i.ref(0),d=i.ref(null);function u(){const f=a.value,m=r.search(f);s.value=m.map(y=>y.item),s.value.length>0&&c.value>s.value.length-1&&(c.value=s.value.length-1)}function h(f){if(f===c.value)return{background:"var(--light-background)"}}const l=i.computed(()=>Object.keys(Ie.script).sort());return i.onMounted(()=>{Te().debugMode=!0,r=new Rr(l.value,{includeScore:!0}),s.value=l.value,c.value=0,setTimeout(()=>{i.nextTick(()=>{d.value&&d.value.focus()})},10),o.value=Ke().registerInputListener("debug-jumping",{up:{press:()=>{c.value>0?c.value--:c.value=s.value.length-1}},down:{press:()=>{s.value.length>c.value+1?c.value++:c.value=0}},continue:{press:()=>{if(s.value.length>0&&c.value<s.value.length){const f=s.value[c.value];we().jumpToLabel(f),n("close")}}},escape:{press:()=>{n("close")}}})}),i.onUnmounted(()=>{o.value&&Ke().unregisterInputListener(o.value),Te().debugMode=!1}),(f,m)=>(i.openBlock(),i.createBlock(_n,{onClose:m[1]||(m[1]=y=>f.$emit("close")),containerCssClass:"jump-menu-container"},{header:i.withCtx(()=>[Iw]),body:i.withCtx(()=>[i.withDirectives(i.createElementVNode("input",{type:"text",class:"label-input nrt-input",ref_key:"search",ref:d,"onUpdate:modelValue":m[0]||(m[0]=y=>a.value=y),onInput:u},null,544),[[i.vModelText,a.value]]),s.value.length>0?(i.openBlock(),i.createElementBlock("div",Nw,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,(y,b)=>(i.openBlock(),i.createElementBlock("div",{class:"search-result",style:i.normalizeStyle(h(b)),key:b},i.toDisplayString(y),5))),128))])):(i.openBlock(),i.createElementBlock("div",Pw,jw))]),_:1}))}}),xw=i.defineComponent({components:{ModalWindow:_n,DebugJumping:Dw},setup(){const e=Xe(),t=i.computed(()=>e.skills),n=i.computed(()=>e.skillChecks);return{skills:t,skillChecks:n}},data(){return{showDebug:!1,jumping:!1,inputListener:null}},mounted(){const e=Je(),t=le().hotkeys.debugMenu??"d",n=le().hotkeys.jumpMenu??"j";e.inputsContainer.addEventListener("keydown",r=>{this.jumping||(r.key===t&&this.toggle(),r.key===n&&this.jump())})},methods:{closeJumping(){this.jumping=!1},labelSelected(e){const t=e.target.value;we().jumpToLabel(t),this.close()},close(){this.showDebug=!1,this.endDebug()},closeErrors(){Te().clearErrors()},open(){this.showDebug=!0,this.startDebug(),we(),dt(),mt(),Xe()},toggle(){this.showDebug?this.close():this.open()},startDebug(){Te().debugMode=!0},endDebug(){Te().debugMode=!1},jump(){this.jumping=!0,this.startDebug()},save(){Ds({})},resetSave(){bp()},resetGlobalSave(){cd()},wordCount(){const t=Object.values(this.script).reduce((n,r)=>(Ft.log(n),n+this.countWordsInScriptBranch(r.branch)),0);alert(`You have ${t} words`)},countWordsInScriptLine(e){if(e.command.commandType==="talk"&&typeof e.command.args[2]=="string")return this.countWordsInString(e.command.args[2]);if(e.command.commandType==="text")return this.countWordsInString(e.code);if(e.command.commandType==="choice"){const t=e.command.staticOptions;let n=this.countWordsInScriptLine(t.prompt);return n+=t.choices.reduce((o,a)=>o+this.countWordsInString(a.prompt.code),0),t.choices.reduce((o,a)=>a.branch?o+this.countWordsInScriptBranch(a.branch):o,n)}if(e.command.commandType==="if"){const t=e.command.staticOptions;return[t.success,t.failure].reduce((r,o)=>o?r+this.countWordsInScriptBranch(o):r,0)}return 0},countWordsInString(e){return e.split(" ").length},countWordsInScriptBranch(e){return e.reduce((t,n)=>n?t+this.countWordsInScriptLine(n):t,0)},getPlayTimeString(){const e=mr(this.playTime.start,this.playTime.previousPlaytime);return Fi(e/1e3)}},computed:{...Yr(we,["data"]),...Yr(Te,["playTime","errors","playing"]),...Yr(Nt,["activeScene"]),labels(){const e=this.script;return Object.keys(e).sort()},script(){return Ie.script},variables(){return this.data}}}),Lw={class:"debug-menu"},Mw={key:0,class:"debug-info"},Rw=[i.createStaticVNode("<h3>Debug mode is ON</h3><ul><li><b>j</b>: Quick Label Jump</li><li><b>d</b>: Debug Menu</li><li><b>a</b>: Auto Play</li><li><b>s</b>: Skip</li><li><b>Space</b>: New Game</li><li><b>c</b>: Continue</li><li><b>Escape</b>: Toggle Menu</li></ul>",2)],Bw=i.createElementVNode("h3",{class:"title"},"Error(s)",-1),Fw=["innerHTML"],Vw=i.createElementVNode("h3",{class:"title"},"Debug Menu!",-1),Uw={class:"container"},qw=i.createElementVNode("option",{class:"nrt-option",selected:"",disabled:""}," Jump to a label ",-1),Hw=["value"],Kw={class:"grid grid-cols-3 gap-4"},Gw=i.createElementVNode("h2",null,"Variables Editor",-1),zw=i.createElementVNode("p",null,[i.createTextVNode(" This has been removed. Use the "),i.createElementVNode("a",{href:"https://devtools.vuejs.org/"},"Vue Devtools"),i.createTextVNode(" instead and inspect the contents of the pinia store ")],-1),Ww={ref:"variablesViewer"},Qw=i.createElementVNode("h2",null,"Skill Checks",-1),Yw={class:"table-auto"},Jw=i.createElementVNode("thead",null,[i.createElementVNode("tr",null,[i.createElementVNode("th",null,"Skill Check"),i.createElementVNode("th",null,"Happened"),i.createElementVNode("th",null,"Succeeded")])],-1),Xw=i.createElementVNode("h2",null,"App State editor (entire app and engine",-1),Zw=i.createElementVNode("h3",{style:{color:"pink"}}," Use for debugging, editing some of those things can cause issues ",-1),ek={ref:"stateViewer"};function tk(e,t,n,r,o,a){const s=i.resolveComponent("DebugJumping"),c=i.resolveComponent("ModalWindow");return i.openBlock(),i.createElementBlock("div",Lw,[i.createElementVNode("button",{onClick:t[0]||(t[0]=(...d)=>e.open&&e.open(...d)),class:"nrt-button debug-button"},"Debug Menu"),!e.playing&&e.activeScene==="menu"?(i.openBlock(),i.createElementBlock("div",Mw,Rw)):i.createCommentVNode("",!0),e.jumping?(i.openBlock(),i.createBlock(s,{key:1,onClose:e.closeJumping},null,8,["onClose"])):i.createCommentVNode("",!0),e.errors.length>0?(i.openBlock(),i.createBlock(c,{key:2,onClose:e.closeErrors,containerCssClass:"debug-menu-container"},{header:i.withCtx(()=>[Bw]),body:i.withCtx(()=>[i.createTextVNode(" There are errors in your dialogue scripts. Open the developer console for more details. "),i.createElementVNode("ul",null,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.errors,(d,u)=>(i.openBlock(),i.createElementBlock("li",{key:u,class:i.normalizeClass(["error-message list-disc",d.type==="error"?"error":"warning"]),innerHTML:d.text},null,10,Fw))),128))])]),_:1},8,["onClose"])):i.createCommentVNode("",!0),e.showDebug?(i.openBlock(),i.createBlock(c,{key:3,onClose:e.close,containerCssClass:"debug-menu-container"},{header:i.withCtx(()=>[Vw]),body:i.withCtx(()=>[i.createElementVNode("div",Uw,[i.createTextVNode(" Hello this is the debug menu. "),i.createElementVNode("select",{class:"nrt-select",name:"label-selector",onChange:t[1]||(t[1]=d=>e.labelSelected(d))},[qw,(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.labels,d=>(i.openBlock(),i.createElementBlock("option",{class:"nrt-option",value:d,key:d},i.toDisplayString(d),9,Hw))),128))],32),i.createElementVNode("div",Kw,[i.createElementVNode("button",{onClick:t[2]||(t[2]=(...d)=>e.wordCount&&e.wordCount(...d)),class:"nrt-button"},"Word Count"),i.createElementVNode("button",{onClick:t[3]||(t[3]=(...d)=>e.save&&e.save(...d)),class:"nrt-button"},"Save Game"),i.createElementVNode("button",{onClick:t[4]||(t[4]=(...d)=>e.resetSave&&e.resetSave(...d)),class:"nrt-button"},"Reset Save"),i.createElementVNode("button",{onClick:t[5]||(t[5]=(...d)=>e.resetGlobalSave&&e.resetGlobalSave(...d)),class:"nrt-button"}," Reset GLOBAL Save ")]),i.createElementVNode("h3",null,"Play time: "+i.toDisplayString(e.getPlayTimeString()),1),Gw,zw,i.createElementVNode("div",Ww,null,512),Qw,i.createElementVNode("table",Yw,[Jw,i.createElementVNode("tbody",null,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.skillChecks,(d,u)=>(i.openBlock(),i.createElementBlock("tr",{key:u},[i.createElementVNode("td",null,i.toDisplayString(u),1),i.createElementVNode("td",null,i.toDisplayString(d.happened?"✅":"❌"),1),i.createElementVNode("td",null,i.toDisplayString(d.happened?d.succeeded?"✅":"❌":"NA"),1)]))),128))])]),Xw,Zw,i.createElementVNode("div",ek,null,512)])]),_:1},8,["onClose"])):i.createCommentVNode("",!0)])}const nk=zt(xw,[["render",tk]]),rk=["src"],ok=["innerHTML"],ik=["innerHTML"],sk=i.defineComponent({__name:"notification-toast",setup(e){const t=vt(),n=i.computed(()=>t.notifications),r=o=>{if(o.description)return{marginTop:"10px"}};return(o,a)=>(i.openBlock(),i.createBlock(i.TransitionGroup,{name:"notification",tag:"div",class:"notifications-holder"},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.value,(s,c)=>(i.openBlock(),i.createElementBlock("div",{class:"notification nrt-tile",key:c},[s.icon?(i.openBlock(),i.createElementBlock("img",{key:0,src:i.unref($t)(s.icon),class:"notification-icon",style:i.normalizeStyle(r(s))},null,12,rk)):i.createCommentVNode("",!0),i.createElementVNode("span",{innerHTML:s.text,class:"notification-text"},null,8,ok),s.description?(i.openBlock(),i.createElementBlock("p",{key:1,innerHTML:s.description,class:"notification-description"},null,8,ik)):i.createCommentVNode("",!0)]))),128))]),_:1}))}}),ak={class:"title"},lk=i.defineComponent({__name:"alert-modal",props:{title:{type:String,required:!1},text:{type:String,required:!1}},emits:["close"],setup(e,{emit:t}){const n=t;function r(){n("close")}const o=i.ref(Ke().registerInputListener("yes-no",{cancel:{press:()=>{r()}},continue:{press:()=>{r()}},system:{press:()=>{r()}}}));return i.onUnmounted(()=>{o.value&&Ke().unregisterInputListener(o.value)}),(a,s)=>(i.openBlock(),i.createBlock(_n,{onClose:r,containerCssClass:"yes-no-modal"},{header:i.withCtx(()=>[i.createElementVNode("h3",ak,i.toDisplayString(e.title??"Alert"),1)]),body:i.withCtx(()=>[i.createElementVNode("h3",null,i.toDisplayString(e.text),1)]),_:1}))}}),ck=i.createElementVNode("hr",null,null,-1),uk=i.defineComponent({__name:"floating-tooltip",props:{title:{},text:{},width:{},x:{},y:{},screenWidth:{},screenHeight:{},screenMargin:{},cssClass:{},textCssClass:{},titleCssClass:{}},setup(e){const t=i.ref(150),n=i.ref(null),r=e,o=i.computed(()=>r.screenWidth??window.innerWidth),a=i.computed(()=>r.screenHeight??window.innerHeight),s=i.computed(()=>{const c=r.screenMargin??5,d={};let u=r.x-r.width/2;u=Math.min(u,o.value-r.width-c),u=Math.max(c,u),d.left=`${u}px`;let h=a.value-r.y;return h=Math.max(h,c),h=Math.min(h,a.value-t.value-c),d.bottom=`${h}px`,d.width=`${r.width}px`,d});return i.onMounted(()=>{n.value&&(t.value=n.value.clientHeight)}),(c,d)=>(i.openBlock(),i.createBlock(i.Transition,{name:"fade"},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["floating-tooltip",c.cssClass]),style:i.normalizeStyle(s.value),ref_key:"element",ref:n},[c.title?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["floating-tooltip-title",c.titleCssClass])},[i.createTextVNode(i.toDisplayString(r.title)+" ",1),ck],2)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(["floating-tooltip-text",c.textCssClass])},i.toDisplayString(r.text),3)],6)]),_:1}))}}),dk={class:"tooltips-ui"},fk=i.defineComponent({__name:"tooltips-ui",setup(e){const t=_r(),n=Je(),r=i.computed(()=>t.tooltip),o=i.computed(()=>n.screenWidth),a=i.computed(()=>n.screenHeight),s=i.computed(()=>{if(r.value)return{...r.value,screenMargin:Fn().options.screenEdgesMinimumMargin??5,screenWidth:o.value,screenHeight:a.value,...c(r.value)}});function c(d){var h,l;let u={};return Fn().options.styling&&(u={...u,...Fn().options.styling}),(h=Ei(d.keyword))!=null&&h.styling&&(u={...u,...(l=Ei(d.keyword))==null?void 0:l.styling}),u}return(d,u)=>(i.openBlock(),i.createElementBlock("div",dk,[r.value?(i.openBlock(),i.createBlock(uk,i.normalizeProps(i.mergeProps({key:0},s.value)),null,16)):i.createCommentVNode("",!0)]))}}),Za={};async function pk(e){Ft.log("Loading videos");const t=[],n=async(o,a)=>await mk(o,a),r=(o,a)=>{t.push(n(o,a))};if(e.preload.video)for(const o in e.preload.video.assets){const a=e.preload.video.assets[o];r(o,a)}return Promise.all(t)}async function mk(e,t){if(Za[e])return Za[e];const n=new Promise((r,o)=>{const a=document.createElement("video");a.onloadeddata=()=>{r(a)},a.onerror=s=>{ae(`Could not load video ${t}`,s),o(s)},a.src=$t(t)});return Za[e]=n,n}async function hk(){const t=Ve().scripts;ft().setMasterVolume(Lt().options.volume??1),await we().loadScripts(t),ht().setup();for(const[,n]of Ie.customStores())if(n.setup){const r=n.setup();Xi(r)&&await r}Ie.addCustomSettings(),ad()}async function yk(){const e=Te(),t=Yg(Ve()),n=pk(Ve()),r=am(Lt());if(Ie.plugins){const o=[];for(const a of Ie.plugins)a.loadingPromises&&o.push(Promise.all(a.loadingPromises));o.length>0&&(e.setLoadingStep("Plugins",0),await Promise.all(o))}e.setLoadingStep("Assets",.3),await Promise.all([t,n,r]),Ie.callHook("onAssetsLoaded"),e.setLoadingStep("Starting",.9),await hk(),Ie.callHook("onGameSetup"),e.gameLoaded()}const gk=["id"],_k=i.defineComponent({__name:"GameScene",props:{sceneId:{},options:{}},setup(e){const t=e,n=Nt(),r=i.computed(()=>n.getSceneConfig(t.sceneId));function o(){n.finishedScene(t.sceneId)}return(a,s)=>(i.openBlock(),i.createElementBlock("div",{class:"game-scene",id:`scene-${a.sceneId}`},[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(r.value.component),{onFinished:o,options:a.options},null,40,["options"]))],8,gk))}}),lr=et("achievements",{state:()=>({achievements:{}}),actions:{generateGlobalSaveData(){return{achievements:Re(this.achievements)}},loadGlobalSaveData(e){this.achievements={...this.achievements,...Re(e.achievements)}},updateConfig(e){Object.keys(e.achievements).forEach(t=>{this.achievements[t]||(this.achievements[t]={id:t,unlocked:!1})})},reset(e){this.$reset(),this.updateConfig(e)},hasAchievement(e){var t;return((t=this.achievements[e])==null?void 0:t.unlocked)??!1},getExistingAchievement(e){return this.achievements[e]},unlock(e){const t=this.getExistingAchievement(e);if(!t){ae(`Tried to unlock achievement ${e} but it doesn't exist`);return}if(!t.unlocked){const n=new Date().toISOString();t.unlocked=!0,t.unlockTime=n}if(wo().notifyNewAchievements){const n=qa(e);vt().addNotification(`New Achievement: ${n.name}`,n.description,n.icon)}}}}),el=et("choices-tracking-store",{state:()=>({choices:{}}),getters:{},actions:{trackChoice(e,t){this.choices[e]||(this.choices[e]={}),this.choices[e][t]=!0},hasSeenChoice(e,t){var n;return((n=this.choices[e])==null?void 0:n[t])??!1},generateSaveData(){return{choices:Re(this.choices)}},loadSaveData(e){this.choices=Re(e.choices)},reset(){this.$reset()}}});Qb({main:{store:Te,save:"main"},achievements:{store:lr,config:"achievements",globalSave:"achievements"},audio:{store:ft,config:"audio",save:"audio"},choicesTracking:{store:el,config:"choices",save:"choices"},config:{store:lt,save:"config"},dialog:{store:Fe,save:"dialog"},hud:{store:Pt,config:"common",save:"hud"},inputs:{store:Ke},inventory:{store:mt,config:"items",save:"inventory"},menu:{store:ht},notifications:{store:vt,config:"common"},quests:{store:dt,config:"quests",save:"quests"},rendering:{store:Je,save:"rendering"},screens:{store:Ut,config:"screens",save:"screens"},sprites:{store:xt,save:"screenObjects"},settings:{store:sn,save:"settings",config:"common"},skills:{store:Xe,config:"skills",save:"skills"},startMenu:{store:Cs},tooltips:{store:_r,config:"tooltips"},vm:{store:we,save:"vm",globalSave:"data"},scenes:{store:Nt,save:"scenes",avoidReset:!0}});const bk=i.defineComponent({__name:"app",props:{options:{}},setup(e){const t=e,n=Te(),r=Nt(),o=i.computed(()=>r.activeScene),a=i.computed(()=>n.alerts),s=Je(),c=i.computed(()=>({transform:`scale(${s.gameScaleRatio}, ${s.gameScaleRatio})`,width:`${s.gameWidth}px`,height:`${s.actualGameHeight}px`})),d=i.computed(()=>ht().activeMenu?"app-blurred-by-modal":{});function u(l){Te().closeAlert(l)}function h(){Je().refreshScreenSize()}return i.onMounted(async()=>{Ie.callHook("onAppMounted"),await yk(),s.inputsContainer.addEventListener("resize",io(()=>{h()},100,{maxWait:200})),qt.setup(t.options.debug),setTimeout(()=>{h()},50)}),(l,f)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createElementVNode("div",{id:"narrat",style:i.normalizeStyle(c.value)},[i.createElementVNode("div",{id:"narrat-app",class:i.normalizeClass(d.value),tabindex:"0"},[i.createVNode(i.Transition,{name:"screens-fade"},{default:i.withCtx(()=>[(i.openBlock(),i.createBlock(_k,{key:o.value,sceneId:o.value,options:i.unref(r).currentOptions},null,8,["sceneId","options"]))]),_:1}),l.options.debug?(i.openBlock(),i.createBlock(nk,{key:0})):i.createCommentVNode("",!0),i.createVNode(sk),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,m=>(i.openBlock(),i.createBlock(lk,{key:m.id,title:m.title,text:m.text,onClose:()=>u(m.id)},null,8,["title","text","onClose"]))),128))],2)],4),i.createVNode(fk)],64))}}),Tk=new V("add_level",[{name:"skillKey",type:"string"},{name:"amount",type:"number"}],async e=>{let{skillKey:t,amount:n}=e.options;if((!t||!n)&&se(e,"add_level command needs a skill id and a value as parameters"),!Number.isInteger(n)){const r=n;n=Math.round(n),console.warn(`add_level expects a level to be an integer. Auto Rounding ${r} to ${n}`)}Xe().incrementSkill(t,n)}),vk=V.FromOptions({keyword:"set_level",argTypes:[{name:"skill",type:"string"},{name:"level",type:"number"}],runner:async e=>{let{skill:t,level:n}=e.options;if((!t||!n)&&se(e,"set_level command needs a skill id and a value as parameters"),!Number.isInteger(n)){const r=n;n=Math.round(n),console.warn(`set_level expects a level to be an integer. Auto Rounding ${r} to ${n}`)}Xe().setSkillLevel(t,n)}}),Sk=new V("add_xp",[{name:"xpKey",type:"string"},{name:"xpToAdd",type:"number"}],async e=>{const{xpKey:t,xpToAdd:n}=e.options;(!t||!n)&&se(e,"add_xp command needs a skill id and a value as parameters"),Xe().addXp(t,n)}),wk=new V("get_level",[{name:"skillKey",type:"string"}],async e=>{const{skillKey:t}=e.options;t||se(e,"get_level command needs a skill id as parameter");const n=Xe().getSkill(t);return n||se(e,`Skill ${t} not found`),n.level}),kk=new V("get_xp",[{name:"xpKey",type:"string"}],async e=>{const{xpKey:t}=e.options;t||se(e,"get_xp command needs a skill id as parameter");const n=Xe().getSkillXp(t);return n||se(e,`XP ${t} not found`),n}),Ck=new V("roll",[{name:"id",type:"string"},{name:"skill",type:"string",optional:!0},{name:"difficulty",type:"number",optional:!0},{name:"mode",type:"string",optional:!0}],async e=>{const{id:t}=e.options;let n={id:t};if(e.args.length===1&&Cf(t))n={...kf(t),id:t};else{const{skill:o,difficulty:a,mode:s}=e.options;if(!o||!a){se(e,"roll command needs a skill and a difficulty as parameters, or the skill check id to be configured in skillChecks.yaml");return}n={skill:o,difficulty:a,id:t},s==="hideAfterRoll"&&(n.hideAfterRoll=!0),s==="repeatable"&&(n.repeatable=!0)}return Bc(n).succeeded}),$k=new V("get_skill_check",[{name:"skillCheckId",type:"string"}],async e=>Xe().getSkillCheck(e.options.skillCheckId)),Ek=new V("skill_check_result",[{name:"skillCheckId",type:"string"}],async e=>Xe().getSkillCheck(e.options.skillCheckId).succeeded),Ok=new V("reset_roll",[{name:"id",type:"string"}],async e=>Xe().resetSkillCheck(e.options.id)),Ak=new V("add_stat",[{name:"statKey",type:"string"},{name:"amountToAdd",type:"number"}],async e=>{const{statKey:t,amountToAdd:n}=e.options;(!t||typeof n!="number")&&se(e,"add_stat command needs a stat id and a value as parameters"),Pt().addStat(t,n)}),Ik=new V("set_stat",[{name:"statKey",type:"string"},{name:"value",type:"number"}],async e=>{const{statKey:t,value:n}=e.options;(!t||typeof n!="number")&&se(e,"set_stat command needs a stat id and a value as parameters"),Pt().setStat(t,n)}),Nk=new V("get_stat_value",[{name:"statKey",type:"string"}],async e=>{const{statKey:t}=e.options;return t||se(e,"get_stat_value command needs a stat id as parameter"),Pt().getStatValue(t)}),Pk=new V("show_hud",[],async e=>{Pt().setVisibility(!0)}),jk=new V("hide_hud",[],async e=>{Pt().setVisibility(!1)}),Dk=V.FromOptions({keyword:"jump",argTypes:"any",runner:async e=>{(e.args.length<1||typeof e.args[0]!="string")&&se(e,"requires a label argument");const t=e.args[0],n=we(),r={branchData:Ie.script[t],label:t,args:e.args.splice(1),currentIndex:0};if(!Ie.script[t]){ae(`Trying to jump but label ${t} not found`);return}return n.jumpTarget=r,Bo}}),xk=V.FromOptions({keyword:"run",argTypes:"any",runner:async e=>{(e.args.length<1||typeof e.args[0]!="string")&&se(e,"run command needs a label to argument run");const t=e.args[0];return await we().runLabelFunction(t,...e.args.slice(1))}}),Lk=V.FromOptions({keyword:"var",argTypes:[{name:"name",type:"string"},{name:"value",type:"any"}],runner:async e=>{const{name:t,value:n}=e.options;we().addScopedVariable(t,n)}}),Mk=V.FromOptions({keyword:"return",argTypes:[{name:"value",type:"any"}],runner:async e=>{const{value:t}=e.options;return we().setReturnValue(t),es}}),Rk=V.FromOptions({keyword:"log",argTypes:"any",runner:async e=>{LS(e,...e.args)}}),Bk=V.FromOptions({keyword:"menu_return",argTypes:[],runner:async e=>(Xu(),Fo)}),Fk=V.FromOptions({keyword:"save",argTypes:[{name:"name",type:"string",optional:!0}],runner:async e=>{await ud({saveName:e.options.name})}}),Vk=V.FromOptions({keyword:"save_prompt",argTypes:[{name:"name",type:"string",optional:!0}],runner:async e=>{await ud({saveName:e.options.name,withPrompt:!0})}}),Uk=V.FromOptions({keyword:"reset_global_save",argTypes:[],runner:async e=>{await cd()}}),qk=V.FromOptions({keyword:"new",argTypes:[{name:"name",type:"string"},{name:"rest",type:"rest",optional:!0}],runner:async e=>{const t=e.options.name;if(t==="Array")return[...e.args.slice(1)];if(t==="Object")return{}}}),Hk=[{name:"mode",type:"string"},{name:"audio",type:"string"},{name:"channel",type:"number",optional:!0}],Kk=new V("play",Hk,async e=>{const t=ft(),{mode:n,audio:r,channel:o}=e.options,a=Di(e,n);a&&t.playChannel(a,r,o??0)}),Gk=new V("resume",[{name:"mode",type:"string"},{name:"channel",type:"number",optional:!0}],async e=>{const t=ft(),{mode:n,channel:r}=e.options,o=Di(e,n);o&&t.resumeChannel(o,r??0)}),zk=new V("pause",[{name:"mode",type:"string"},{name:"channel",type:"number",optional:!0}],async e=>{const t=ft(),{mode:n,channel:r}=e.options,o=Di(e,n);o&&t.pauseChannel(o,r??0)}),Wk=new V("stop",[{name:"mode",type:"string"},{name:"channel",type:"number",optional:!0}],async e=>{const t=ft(),{mode:n,channel:r}=e.options,o=Di(e,n);o&&t.stopChannel(o,r??0)});function Di(e,t){return Qk(t)?t:(se(e,`${t} is not a valid audio mode.`),!1)}function Qk(e){return!!Nl.includes(e)}const Yk=new V("set",[{name:"key",type:"string"},{name:"value",type:"any"}],async e=>{const t=Mr();Of(t,`$${e.options.key}`,e.options.value)}),Jk=new V("add",[{name:"key",type:"string"},{name:"value",type:"any"}],async e=>{const t=Mr();Af(t,`$${e.options.key}`,e.options.value)}),Xk=new V("set_screen",[{name:"screen",type:"string"},{name:"layer",type:"number",optional:!0},{name:"transitionName",type:"string",optional:!0},{name:"transitionDuration",type:"number",optional:!0},{name:"transitionDelay",type:"number",optional:!0}],async e=>{const t=Ut();if(!xr(e.options.screen)){se(e,`Screen ${e.options.screen} doesn't exist in the config`);return}return e.options.transitionName?t.transitionScreen(e.options.screen,{transition:e.options.transitionName,duration:e.options.transitionDuration,delay:e.options.transitionDelay},e.options.layer):t.setScreen(e.options.screen,e.options.layer??0)}),Zk=new V("empty_layer",[{name:"layer",type:"number"},{name:"transitionName",type:"string",optional:!0},{name:"transitionDuration",type:"number",optional:!0},{name:"transitionDelay",type:"number",optional:!0}],async e=>{const t=Ut();return e.options.transitionName?t.emptyLayer(e.options.layer,{transition:e.options.transitionName,duration:e.options.transitionDuration,delay:e.options.transitionDelay}):t.emptyLayer(e.options.layer)}),eC=new V("set_button",[{name:"buttonId",type:"string"},{name:"state",type:"any"}],async e=>{const{buttonId:t,state:n}=e.options,r=Ut();if(!Vn(t)){se(e,`Button ${t} doesn't exist in the config`);return}r.changeButton(t,n)}),tC=V.FromOptions({keyword:"talk",argTypes:[{name:"speaker",type:"string"},{name:"pose",type:"string"},{name:"text",type:"string"}],runner:async(e,t)=>{await os({speaker:e.options.speaker,pose:e.options.pose,cssClass:"talk-command",text:`"${e.options.text}"`,choices:t,interactive:!0})},returnAfterPlayerAnswer:!0}),nC=V.FromOptions({keyword:"think",argTypes:[{name:"speaker",type:"string"},{name:"pose",type:"string"},{name:"text",type:"string"}],runner:async(e,t)=>{await os({speaker:e.options.speaker,pose:e.options.pose,cssClass:"think-command",text:`${e.options.text}`,choices:t,interactive:!0})},returnAfterPlayerAnswer:!0}),rC=()=>{const e=Dr("text",[]);return(t,n)=>{const r=e(t,n);return n.command.staticOptions={text:n.code.substring(1,n.code.length-1)},r}},oC=V.FromOptions({keyword:"text",argTypes:[],runner:async(e,t)=>{await os({speaker:lt().gameCharacter,cssClass:"text-command",text:e.staticOptions.text,choices:t,interactive:!0})},parser:rC(),returnAfterPlayerAnswer:!0}),iC=new V("add_item",[{name:"id",type:"string"},{name:"amount",type:"number"}],async e=>{const{id:t,amount:n}=e.options;mt().add({id:t,amount:n})}),sC=new V("remove_item",[{name:"id",type:"string"},{name:"amount",type:"number"}],async e=>{const{id:t,amount:n}=e.options;mt().remove({id:t,amount:n})}),aC=new V("has_item?",[{name:"id",type:"string"},{name:"amount",type:"number",optional:!0}],async e=>{const{id:t,amount:n}=e.options;return mt().hasItem(t,n)}),lC=new V("item_amount?",[{name:"id",type:"string"}],async e=>{const{id:t}=e.options;return mt().getItemAmount(t)}),cC=new V("enable_interaction",[{name:"tag",type:"string"}],async e=>{const t=e.options.tag;mt().enableInteraction(t)}),uC=new V("disable_interaction",[{name:"tag",type:"string"}],async e=>{const t=e.options.tag;mt().disableInteraction(t)}),dC=new V("start_quest",[{name:"questId",type:"string"}],async e=>{const t=e.options.questId;dt().startQuest(t)}),fC=new V("start_objective",[{name:"questId",type:"string"},{name:"objectiveId",type:"string"}],async e=>{const{questId:t,objectiveId:n}=e.options;dt().startObjective(t,n)}),pC=new V("complete_objective",[{name:"questId",type:"string"},{name:"objectiveId",type:"string"}],async e=>{const{questId:t,objectiveId:n}=e.options;dt().completeObjective(t,n)}),mC=new V("complete_quest",[{name:"questId",type:"string"},{name:"ending",type:"any",optional:!0}],async e=>{const{questId:t,ending:n}=e.options;dt().completeQuest(t,n)}),hC=new V("quest_completed?",[{name:"questId",type:"string"}],async e=>{const{questId:t}=e.options;return dt().isQuestCompleted(t)}),yC=new V("quest_succeeded?",[{name:"questId",type:"string"}],async e=>{const{questId:t}=e.options;return dt().isQuestSucceeded(t)}),gC=new V("quest_failed?",[{name:"questId",type:"string"}],async e=>{const{questId:t}=e.options;return dt().isQuestFailed(t)}),_C=new V("quest_ending?",[{name:"questId",type:"string"}],async e=>{const{questId:t}=e.options;return dt().getQuestEnding(t)}),bC=new V("quest_has_ending?",[{name:"questId",type:"string"},{name:"ending",type:"string"}],async e=>{const{questId:t,ending:n}=e.options;return dt().questHasEnding(t,n)}),TC=new V("objective_completed?",[{name:"questId",type:"string"},{name:"objectiveId",type:"string"}],async e=>{const{questId:t,objectiveId:n}=e.options;return dt().isObjectiveCompleted(t,n)}),vC=new V("quest_started?",[{name:"questId",type:"string"}],async e=>{const{questId:t}=e.options;return dt().isQuestStarted(t)}),SC=new V("objective_started?",[{name:"questId",type:"string"},{name:"objectiveId",type:"string"}],async e=>{const{questId:t,objectiveId:n}=e.options;return dt().isObjectiveStarted(t,n)}),wC=V.FromOptions({keyword:"wait",argTypes:[{name:"duration",type:"number"}],runner:async e=>{await At(e.options.duration)}}),kC=new V("notify",[{name:"text",type:"string"},{name:"description",type:"string",optional:!0},{name:"icon",type:"string",optional:!0}],async e=>{const{text:t,icon:n,description:r}=e.options;vt().addNotification(t,r,n)}),CC=new V("disable_notifications",[],async e=>{vt().disableNotifications()}),$C=new V("enable_notifications",[],async e=>{vt().enableNotifications()}),EC=new V("clear_dialog",[],async e=>{Fe().clearDialog()}),OC=new V("if",[{name:"condition",type:"boolean"}],async e=>{const t=[];for(const o of e.staticOptions.elseifs){const a=o.condition,s=await ei(a);t.push(s)}const n=$h(e,t),r=we();if(n){const o={branchData:{branch:n},currentIndex:0};return r.addAndRunBlock(o)}},(e,t)=>{let n=e.currentLine;Dr("if",[{name:"condition",type:"string"}])(e,t);const{lines:o,currentLine:a,line:s}=e,c=t.command;let d,u=a,h=!1;const l=[];for(;!h;){u++;const f=Eh(o,u);if(f&&f.code.startsWith("elseif")){const m=f.expression;if(!Array.isArray(m)){e.parserContext.error(f.line,"Expected an expression after elseif"),h=!0;break}if(m.length>2){e.parserContext.error(f.line,"Expected only one argument after elseif"),h=!0;break}l.push({branch:e.processCommandsFunction(e.parserContext,f.branch,s),condition:Ms(e.parserContext,f,m[1])})}else f&&f.code==="else:"?d=e.processCommandsFunction(e.parserContext,f.branch,s):(h=!0,u--)}return c.staticOptions={success:e.processCommandsFunction(e.parserContext,s.branch,s),elseifs:l,failure:d},u++,n=u,{newLine:n}}),AC=new V("==","any",async e=>{e.args.length<1&&se(e,"requires at least 1 arguments");let t=e.args[0],n=!0;for(const r of e.args)if(r!=t){n=!1;break}else t=r;return n}),IC=new V(">",[{name:"a",type:"any"},{name:"b",type:"any"}],async e=>{const{a:t,b:n}=e.options;return t>n}),NC=new V("<",[{name:"a",type:"any"},{name:"b",type:"any"}],async e=>{const{a:t,b:n}=e.options;return t<n}),PC=new V(">=",[{name:"a",type:"any"},{name:"b",type:"any"}],async e=>{const{a:t,b:n}=e.options;return t>=n}),jC=new V("<=",[{name:"a",type:"any"},{name:"b",type:"any"}],async e=>{const{a:t,b:n}=e.options;return t<=n}),DC=new V("!=",[{name:"a",type:"any"},{name:"b",type:"any"}],async e=>{const{a:t,b:n}=e.options;return t!=n}),xC=new V("!",[{name:"a",type:"any"}],async e=>{const{a:t}=e.options;return!t}),LC=new V("&&","any",async e=>{const t=e.args;return e.args.length<2&&se(e,"requires at least two arguments"),t.reduce((n,r)=>n&&r,!0)}),MC=new V("||","any",async e=>(e.args.length<2&&se(e,"requires at least two arguments"),e.args.reduce((t,n)=>t||n,!1))),RC=new V("?",[{name:"a",type:"any"},{name:"b",type:"any"},{name:"c",type:"any"}],async e=>{const{a:t,b:n,c:r}=e.options;return t?n:r}),BC=new V("+","any",async e=>(e.args.length<2&&se(e,"requires at least two arguments"),e.args.reduce((t,n)=>typeof n=="number"?t+n:(se(e,"requires all arguments to be numbers"),t),0))),FC=new V("-","any",async e=>(e.args.length<2&&se(e,"requires at least two arguments"),e.args.slice(1).reduce((t,n)=>typeof n=="number"?t-n:(se(e,"requires all arguments to be numbers"),t),e.args[0]))),VC=new V("neg",[{name:"a",type:"number"}],async e=>(e.args.length!==1&&se(e,"requires one argument"),-e.options.a)),UC=new V("abs",[{name:"a",type:"number"}],async e=>(e.args.length!==1&&se(e,"requires one argument"),Math.abs(e.options.a))),qC=new V("*","any",async e=>(e.args.length<2&&se(e,"requires at least two arguments"),e.args.reduce((t,n)=>typeof n=="number"?t*n:(se(e,"requires all arguments to be numbers"),t),1))),HC=new V("/","any",async e=>{e.args.length<2&&se(e,"requires at least two arguments");const t=e.args[0]/e.args[1];return e.args.slice(2).reduce((n,r)=>typeof r=="number"?n/r:(se(e,"requires all arguments to be numbers"),n),t)}),KC=async e=>{const{prompt:t,choices:n}=e.staticOptions,r=[];for(const[,s]of n.entries()){const c=await ei(s.prompt);r.push(c)}e.options.choiceResults=r;const o=r.map((s,c)=>{var f;let d=!0;s.skillCheck&&(d=((f=s.skillCheck)==null?void 0:f.allowed)??!1);const u=el().hasSeenChoice(t.code,n[c].prompt.code);return{flag:s.flag,seenBefore:u,choice:s.text,originalIndex:c,allowed:d}}).filter(s=>s.choice),a=await yd(t,o);return await QC(e,a)};function GC(e,t){t.branch||e.parserContext.error(t.line,`Choice option doesn't have any branch to go to (${t.code} - ${t.line})`);let n,r;const o=t.branch;return t.expression[1]==="roll"||t.expression[2]==="roll"?((!o[0].branch||!o[1].branch)&&e.parserContext.error(t.line,`Choice option with a skill roll needs success and failure branches (${t.code} - ${t.line})`),n={success:e.processCommandsFunction(e.parserContext,o[0].branch,t),failure:e.processCommandsFunction(e.parserContext,o[1].branch,t)}):r=e.processCommandsFunction(e.parserContext,o,t),{prompt:e.processCommandsFunction(e.parserContext,[t],t)[0],branch:r,skillBranches:n}}const zC=(e,t)=>{let n=e.currentLine;Dr("choice",[]);const{line:r}=e,o=t.command;(!r.branch||r.branch.length<2)&&e.parserContext.error(r.line,"Choice menu needs to have at least one option");const a=r.branch[0];a||e.parserContext.error(e.line.line,"Choice prompt is missing ");const c=r.branch.slice(1).map((d,u)=>(d.branch||e.parserContext.error(d.line,`Choice option doesn't have any branch to go to (${d.code})`),d=YC(e.parserContext,d),GC(e,d)));return o.staticOptions={prompt:e.processCommandsFunction(e.parserContext,[a],r)[0],choices:c},n++,{newLine:n}},WC=V.FromOptions({keyword:"choice",argTypes:[],runner:KC,parser:zC}),QC=async(e,t)=>{const n=t,r=we(),{choices:o}=e.staticOptions,a=o[n],s=e.options.choiceResults[n],c=e.staticOptions.prompt;el().trackChoice(c.code,a.prompt.code);let d=s.text,u;if(s.skillCheck?(d=null,Bc(s.skillCheck.options).succeeded?u=a.skillBranches.success:u=a.skillBranches.failure):u=a.branch,d){const h={speaker:lt().playerCharacter,text:d,interactive:!1};Fe().addDialog(h)}if(u){const h={currentIndex:0,branchData:{branch:u}};return await r.addAndRunBlock(h)}};function YC(e,t){return{code:`choicePrompt ${t.code}`,indentation:t.indentation,line:t.line,branch:t.branch,expression:["choicePrompt",...t.expression]}}const JC=new V("choicePrompt","any",async e=>{const t=e.args;return t.length===1?XC(t[0]):t.length===2?ZC(t):t.length>2?t[0]==="roll"||t[1]==="roll"?t$(e,t):e$(e,t):(se(e,"Invalid choice prompt line"),{text:t[0]})});function XC(e){return{text:e}}function ZC(e){return{text:e[1],flag:e[0]}}function e$(e,t){const n=t[1]==="if"?1:2;if(t[n]!=="if")return se(e,"Invalid choice prompt line"),{text:t[0]};const r=n===2;let o=r?t[1]:t[0],a=!0;t.length>n+1&&(a=t[n+1]),a||(o=null);const s={text:o};return r&&(s.flag=t[0]),s}function t$(e,t){const n=t[0]==="roll"?0:1,r=n===1,o=n,a=t[o+1];let s={},c=o+2;Cf(a)?s={...kf(a),id:a}:(s={id:a,skill:t[o+2],difficulty:t[o+3]},c=o+4);const d=t[c];c++;let u=!1,h=!1,l;t.length>c&&(t[c]==="if"?(h=!0,t.length<c+2&&se(e,'Missing condition argument after "if" in choice with a skill check'),l=t[c+1]):(u=t[c],t.length>c+1&&(c++,t[c]==="if"?(h=!0,t.length<c+2&&se(e,'Missing condition argument after "if" in choice with a skill check'),l=t[c+1]):se(e,`Invalid argument after skill check mode: ${t[c]}. The next argument can only be an if condition.`)))),u==="hideAfterRoll"&&(s.hideAfterRoll=!0),u==="repeatable"&&(s.repeatable=!0);const f=Xe().getSkillCheck(a);if(f.hidden||h&&!l)return{text:null};const m=!f.happened||f.happened&&f.succeeded||s.repeatable,{difficultyText:y}=pm({skill:s.skill,skillCheckId:a,value:s.difficulty}),S={text:`${y} ${d}`,skillCheck:{allowed:m,options:s}};return r&&(S.flag=t[0]),S}const Hf=V.FromOptions({keyword:"text_field",argTypes:[{name:"prompt",type:"string"}],returnAfterPlayerAnswer:!0,runner:async e=>{const t={speaker:lt().gameCharacter,text:e.options.prompt,textField:!0,interactive:!0};Fe().addDialog(t)}});Hf.onPlayerAnswered=async(e,t)=>(typeof t!="string"&&se(e,"The player's answer should be a string"),t);const n$=V.FromOptions({keyword:"text_field_prompt",argTypes:[{name:"prompt",type:"string"}],runner:async e=>{const t={speaker:lt().gameCharacter,text:e.options.prompt,textField:!0,interactive:!0};Fe().addDialog(t)}}),r$=new V("random",[{name:"a",type:"number"},{name:"b",type:"number"}],async e=>{const{a:t,b:n}=e.options;return typeof t!="number"||typeof n!="number"?(se(e,"random command needs two numbers as parameters"),0):Math.floor(Math.random()*(n-t+1))+t}),o$=new V("random_float",[{name:"a",type:"number"},{name:"b",type:"number"}],async e=>{const{a:t,b:n}=e.options;return typeof t!="number"||typeof n!="number"?(se(e,"random_float command needs two numbers as parameters"),0):Math.random()*(n-t)+t}),i$=new V("random_from_args",[],async e=>{const t=e.args;return!t||!t.length?(se(e,"random_from_args command needs at least one argument"),0):t[Math.floor(Math.random()*t.length)]}),s$=new V("random_from_array",[{name:"a",type:"any"}],async e=>{const{a:t}=e.options;return Array.isArray(t)?t[Math.floor(Math.random()*t.length)]:(se(e,"random_from_array command needs an array as parameter"),0)}),a$=new V("concat","any",async e=>(e.args.length<2&&se(e,"requires at least two arguments"),e.args.reduce((t,n)=>typeof n=="string"?`${t}${n}`:(se(e,"requires all arguments to be strings"),t),""))),l$=new V("join","any",async e=>{const t=e.args[0];return e.args.length<3&&se(e,"requires at least 3 arguments"),e.args.slice(1).reduce((n,r)=>typeof r=="string"?`${n}${t}${r}`:(se(e,"requires all arguments to be strings"),n),"")}),c$=V.FromOptions({keyword:"min",argTypes:[{name:"min",type:"number"},{name:"value",type:"number"}],runner:async e=>{const{min:t,value:n}=e.options;return n<t?n:t}}),u$=V.FromOptions({keyword:"max",argTypes:[{name:"max",type:"number"},{name:"value",type:"number"}],runner:async e=>{const{max:t,value:n}=e.options;return n>t?n:t}}),d$=V.FromOptions({keyword:"clamp",argTypes:[{name:"min",type:"number"},{name:"max",type:"number"},{name:"value",type:"number"}],runner:async e=>{const{min:t,max:n,value:r}=e.options;return r<t?t:r>n?n:r}}),f$=V.FromOptions({keyword:"floor",argTypes:[{name:"value",type:"number"}],runner:async e=>{const{value:t}=e.options;return Math.floor(t)}}),p$=V.FromOptions({keyword:"ceil",argTypes:[{name:"value",type:"number"}],runner:async e=>{const{value:t}=e.options;return Math.ceil(t)}}),m$=V.FromOptions({keyword:"round",argTypes:[{name:"value",type:"number"}],runner:async e=>{const{value:t}=e.options;return Math.round(t)}}),h$=V.FromOptions({keyword:"sqrt",argTypes:[{name:"value",type:"number"}],runner:async e=>{const{value:t}=e.options;return Math.sqrt(t)}}),y$=V.FromOptions({keyword:"^",argTypes:[{name:"base",type:"number"},{name:"exponent",type:"number"}],runner:async e=>{const{base:t,exponent:n}=e.options;return Math.pow(t,n)}}),g$=new V("create_sprite",[{name:"image",type:"string"},{name:"x",type:"number"},{name:"y",type:"number"},{name:"parent",type:"any",optional:!0}],async e=>{const t=xt(),{x:n,y:r,image:o,parent:a}=e.options,s={x:n,y:r,image:o};return typeof a=="object"&&(s.parent=a),typeof a=="string"&&(s.parent=xt().getObject(a)),t.createSprite(s)}),_$=new V("create_object",[{name:"x",type:"number"},{name:"y",type:"number"},{name:"parent",type:"any",optional:!0}],async e=>{const t=xt(),{x:n,y:r,parent:o}=e.options,a={x:n,y:r};return typeof o=="object"&&(a.parent=o),typeof o=="string"&&(a.parent=xt().getObject(o)),t.createObject(a)}),b$=new V("delete_sprite",[{name:"sprite",type:"any"}],async e=>xt().destroyObject(e.options.sprite)),T$=V.FromOptions({keyword:"empty_sprites",argTypes:[{name:"layer",type:"number",optional:!0}],runner:async e=>{const t=xt(),{layer:n}=e.options;return typeof n=="number"?t.emptyLayer(n):t.emptyAllLayers()}}),v$=V.FromOptions({keyword:"shuffle",argTypes:[{name:"array",type:"any"}],runner:async e=>{const t=e.options.array;if(!Array.isArray(t)){se(e,"requires an array argument");return}return F$(t),t}}),S$=V.FromOptions({keyword:"push",argTypes:[{name:"array",type:"any"},{name:"value",type:"any"}],runner:async e=>{const{array:t,value:n}=e.options;if(!Array.isArray(t)){se(e,"requires an array argument");return}return t.push(n),t}}),w$=V.FromOptions({keyword:"pop",argTypes:[{name:"array",type:"any"}],runner:async e=>{const{array:t}=e.options;if(!Array.isArray(t)){se(e,"requires an array argument");return}return t.pop()}}),k$=V.FromOptions({keyword:"shift",argTypes:[{name:"array",type:"any"}],runner:async e=>{const{array:t}=e.options;if(!Array.isArray(t)){se(e,"requires an array argument");return}return t.shift()}}),C$=V.FromOptions({keyword:"unshift",argTypes:[{name:"array",type:"any"},{name:"value",type:"any"}],runner:async e=>{const{array:t,value:n}=e.options;if(!Array.isArray(t)){se(e,"requires an array argument");return}return t.unshift(n),t}}),$$=V.FromOptions({keyword:"array_join",argTypes:[{name:"array",type:"any"},{name:"separator",type:"string",optional:!0}],runner:async e=>{const{array:t,separator:n}=e.options;if(!Array.isArray(t)){se(e,"requires an array argument");return}if(typeof n<"u"&&typeof n!="string"){se(e,"array join string separator must be a string");return}return t.join(n),t}}),E$=V.FromOptions({keyword:"array_concat",argTypes:[{name:"array",type:"any"},{name:"rest",type:"rest",optional:!0}],runner:async e=>{const{array:t}=e.options,n=e.args;if(!Array.isArray(t)){se(e,"requires an array argument");return}for(const r of n)if(!Array.isArray(r)){se(e,"All concat arguments should be arrays");return}return t.concat(...n.slice(1))}}),O$=V.FromOptions({keyword:"includes",argTypes:[{name:"array",type:"any"},{name:"searchElement",type:"string"}],runner:async e=>{const{array:t,searchElement:n}=e.options;return Array.isArray(t)||se(e,"requires an array argument"),typeof n>"u"&&se(e,"requires a search element argument"),t.includes(n)}}),A$=V.FromOptions({keyword:"reverse",argTypes:[{name:"array",type:"any"}],runner:async e=>{const{array:t}=e.options;return Array.isArray(t)||se(e,"requires an array argument"),t.reverse(),t}}),I$=V.FromOptions({keyword:"slice",argTypes:[{name:"array",type:"any"},{name:"start",type:"number"},{name:"end",type:"number",optional:!0}],runner:async e=>{const{array:t,start:n,end:r}=e.options;return Array.isArray(t)||se(e,"requires an array argument"),typeof n!="number"&&se(e,"requires a start index argument"),typeof r<"u"&&typeof r!="number"&&se(e,"end index argument must be a number if present"),t.slice(n,r)}}),N$=V.FromOptions({keyword:"splice",argTypes:[{name:"array",type:"any"},{name:"start",type:"number"},{name:"end",type:"number",optional:!0}],runner:async e=>{const{array:t,start:n,end:r}=e.options;return Array.isArray(t)||se(e,"requires an array argument"),typeof n!="number"&&se(e,"requires a start index argument"),typeof r<"u"&&typeof r!="number"&&se(e,"end index argument must be a number if present"),t.splice(n,r)}}),P$=V.FromOptions({keyword:"array_find_index",argTypes:[{name:"array",type:"any"},{name:"predicateLabel",type:"string"},{name:"rest",type:"rest",optional:!0}],runner:async e=>{const{array:t,predicateLabel:n}=e.options;Array.isArray(t)||se(e,"requires an array argument");for(const[r,o]of t.entries())if(await we().runLabelFunction(n,o,r,t,...e.args.slice(2))===!0)return r;return-1}}),j$=V.FromOptions({keyword:"array_find",argTypes:[{name:"array",type:"any"},{name:"predicateLabel",type:"string"},{name:"rest",type:"rest",optional:!0}],runner:async e=>{const{array:t,predicateLabel:n}=e.options;Array.isArray(t)||se(e,"requires an array argument");for(const[r,o]of t.entries())if(await we().runLabelFunction(n,o,r,t,...e.args.slice(2))===!0)return o;return null}}),D$=V.FromOptions({keyword:"array_filter",argTypes:[{name:"array",type:"any"},{name:"predicateLabel",type:"string"},{name:"rest",type:"rest",optional:!0}],runner:async e=>{const{array:t,predicateLabel:n}=e.options;Array.isArray(t)||se(e,"requires an array argument");const r=[];for(const[o,a]of t.entries())await we().runLabelFunction(n,a,o,t,...e.args.slice(2))===!0&&r.push(a);return r}}),x$=V.FromOptions({keyword:"array_map",argTypes:[{name:"array",type:"any"},{name:"mapperLabel",type:"string"},{name:"rest",type:"rest",optional:!0}],runner:async e=>{const{array:t,mapperLabel:n}=e.options;Array.isArray(t)||se(e,"requires an array argument");const r=[];for(const[o,a]of t.entries()){const s=await we().runLabelFunction(n,a,o,t,...e.args.slice(2));r.push(s)}return r}}),L$=V.FromOptions({keyword:"array_reduce",argTypes:[{name:"array",type:"any"},{name:"reducerLabel",type:"string"},{name:"initValue",type:"any"},{name:"rest",type:"rest",optional:!0}],runner:async e=>{const{array:t,reducerLabel:n,initValue:r}=e.options;Array.isArray(t)||se(e,"requires an array argument");let o=r;for(const[a,s]of t.entries())o=await we().runLabelFunction(n,o,s,a,t,...e.args.slice(3));return o}}),M$=V.FromOptions({keyword:"array_some",argTypes:[{name:"array",type:"any"},{name:"predicateLabel",type:"string"},{name:"rest",type:"rest",optional:!0}],runner:async e=>{const{array:t,predicateLabel:n}=e.options;Array.isArray(t)||se(e,"requires an array argument");for(const[r,o]of t.entries())if(await we().runLabelFunction(n,o,r,t,...e.args.slice(2))===!0)return!0;return!1}}),R$=V.FromOptions({keyword:"array_every",argTypes:[{name:"array",type:"any"},{name:"predicateLabel",type:"string"},{name:"rest",type:"rest",optional:!0}],runner:async e=>{const{array:t,predicateLabel:n}=e.options;Array.isArray(t)||se(e,"requires an array argument");for(const[r,o]of t.entries())if(await we().runLabelFunction(n,o,r,t,...e.args.slice(2))!==!0)return!1;return!0}}),B$=V.FromOptions({keyword:"array_entries",argTypes:[{name:"array",type:"any"}],runner:async e=>{const{array:t}=e.options;return Array.isArray(t)||se(e,"requires an array argument"),t.entries()}});function F$(e){for(let t=e.length-1;t>0;t--){const n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}}const Br={keyframes:{"narrat-screenshake":[{transform:"translateX(0)"},{transform:"translateX(5px)"},{transform:"translateX(-5px)"},{transform:"translateX(5px)"},{transform:"translateX(0)"}]},animations:{"narrat-screenshake":{keyframes:"narrat-screenshake",options:{duration:150,iterations:3}}}};function V$(e){return typeof e=="string"?document.querySelector(e):e}function U$(e){if(typeof e=="string"){const t=Sf();t.keyframes[e]?e=t.keyframes[e]:Br.keyframes[e]?e=Br.keyframes[e]:(ae(`[Animation] Animation not found: ${e}`),e=Br.keyframes["narrat-screenshake"])}return e}function q$(e){let t;if(typeof e=="string"){const n=Sf();n.animations[e]?t=n.animations[e]:Br.animations[e]?t=Br.animations[e]:(ae(`[Animation] Animation not found: ${e}`),t=Br.animations["narrat-screenshake"])}else t=e;return H$(t)}function H$(e){return{keyframes:[...U$(e.keyframes)],options:{...e.options}}}async function Kf(e,t,n){return new Promise(r=>{const o=V$(e);o||(ae(`[Animation] Element not found: ${e}`),r({}));const a=q$(t);n&&Object.assign(a.options,n),o.animate(a.keyframes,a.options).addEventListener("finish",r)})}const K$=V.FromOptions({keyword:"load_data",argTypes:[{name:"url",type:"string"}],runner:async e=>{const{url:t}=e.options;return await ro(Ai(t))}}),G$=V.FromOptions({keyword:"change_player_character",argTypes:[{name:"character",type:"string"}],runner:async e=>{const{character:t}=e.options;lt().config.characters.config.playerCharacter=t}}),z$=V.FromOptions({keyword:"change_game_character",argTypes:[{name:"character",type:"string"}],runner:async e=>{const{character:t}=e.options;lt().config.characters.config.gameCharacter=t}}),W$=V.FromOptions({keyword:"json_stringify",argTypes:[{name:"value",type:"any"}],runner:async e=>{const{value:t}=e.options;return JSON.stringify(t)}}),Q$=V.FromOptions({keyword:"json_parse",argTypes:[{name:"value",type:"string"}],runner:async e=>{const{value:t}=e.options;return JSON.parse(t)}}),Y$=V.FromOptions({keyword:"set_dialog_panel_mode",argTypes:[{name:"mode",type:"string"}],runner:async e=>{const{mode:t}=e.options;Je().dialogPanelMode=t}}),Gf=[{name:"element",type:"string"},{name:"animation",type:"string"},{name:"duration",optional:!0,type:"number"},{name:"iterations",optional:!0,type:"number"}];function zf(e){const{element:t,animation:n,duration:r,iterations:o}=e.options,a={};return o&&(a.iterations=o),r&&(a.duration=r),a}const J$=V.FromOptions({keyword:"animate",argTypes:Gf,runner:async e=>{const{element:t,animation:n}=e.options,r=zf(e);Kf(t,n,r)}}),X$=V.FromOptions({keyword:"animate_wait",argTypes:Gf,runner:async e=>{const{element:t,animation:n}=e.options;await Kf(t,n,zf(e))}}),Z$=V.FromOptions({keyword:"time_now",argTypes:[],runner:async e=>Date.now()}),e1=V.FromOptions({keyword:"total_playtime",argTypes:[],runner:async e=>Te().totalPlayTime}),t1=V.FromOptions({keyword:"session_playtime",argTypes:[],runner:async e=>Te().sessionPlayTime}),n1=V.FromOptions({keyword:"to_days",argTypes:[{name:"time",type:"number"}],runner:async e=>Math.floor(e.options.time/864e5)}),r1=V.FromOptions({keyword:"to_hours",argTypes:[{name:"time",type:"number"}],runner:async e=>Math.floor(e.options.time/36e5)}),o1=V.FromOptions({keyword:"to_minutes",argTypes:[{name:"time",type:"number"}],runner:async e=>Math.floor(e.options.time/6e4)}),i1=V.FromOptions({keyword:"to_seconds",argTypes:[{name:"time",type:"number"}],runner:async e=>Math.floor(e.options.time/1e3)}),s1=new V("unlock_achievement",[{name:"id",type:"string"}],async e=>{const{id:t}=e.options;lr().unlock(t)}),a1=new V("has_achievement?",[{name:"id",type:"string"}],async e=>{const{id:t}=e.options;return lr().hasAchievement(t)}),l1=V.FromOptions({keyword:"get_setting",argTypes:[{name:"setting",type:"string"}],runner:async e=>{const{setting:t}=e.options;return t||se(e,"get_setting command needs a setting id"),sn().getSetting(t)}}),c1=V.FromOptions({keyword:"set_setting",argTypes:[{name:"setting",type:"string"},{name:"value",type:"any"}],runner:async e=>{const{setting:t,value:n}=e.options;t||se(e,"set_setting command needs a setting id"),sn().setSetting(t,n)}}),u1=V.FromOptions({keyword:"object_entries",argTypes:[{name:"obj",type:"any"}],runner:async e=>{const t=e.options.obj;return typeof t!="object"?(se(e,"Requires an object argument."),[]):Object.entries(t)}}),d1=V.FromOptions({keyword:"object_keys",argTypes:[{name:"obj",type:"any"}],runner:async e=>{const t=e.options.obj;return typeof t!="object"?(se(e,"Requires an object argument."),[]):Object.keys(t)}}),f1=V.FromOptions({keyword:"object_values",argTypes:[{name:"obj",type:"any"}],runner:async e=>{const t=e.options.obj;return typeof t!="object"?(se(e,"Requires an object argument."),[]):Object.values(t)}}),p1=V.FromOptions({keyword:"object_has",argTypes:[{name:"obj",type:"any"},{name:"key",type:"string"}],runner:async e=>{const{obj:t,key:n}=e.options;return typeof t!="object"?(se(e,"Requires an object argument."),!1):Object.hasOwn(t,n)}}),m1=V.FromOptions({keyword:"for_of",argTypes:[{name:"target",type:"any"},{name:"predicateLabel",type:"string"},{name:"rest",type:"rest",optional:!0}],runner:async e=>{const{target:t,predicateLabel:n}=e.options;if(typeof t!="object")return se(e,"Requires an object argument."),!1;for(const r of t)await we().runLabelFunction(n,r,...e.args.slice(2))}}),h1=V.FromOptions({keyword:"for_in",argTypes:[{name:"target",type:"any"},{name:"predicateLabel",type:"string"},{name:"rest",type:"rest",optional:!0}],runner:async e=>{const{target:t,predicateLabel:n}=e.options;if(typeof t!="object")return se(e,"Requires an object argument."),!1;for(const r in t)await we().runLabelFunction(n,r,t[r],...e.args.slice(2))}}),y1=V.FromOptions({keyword:"change_scene",argTypes:[{name:"scene",type:"string"},{name:"rest",type:"rest",optional:!0}],runner:async e=>{const{scene:t}=e.options;await Nt().changeScene(t,g1(e.args.slice(1)))}});function g1(e){const t={};let n=0;for(;n<e.length&&!(n+1>=e.length);){const r=e[n],o=e[n+1];t[r]=o,n+=2}return t}function _1(e){e.addCommand(WC),e.addCommand(JC),e.addCommand(OC),e.addCommand(Ak),e.addCommand(Ik),e.addCommand(Nk),e.addCommand(Pk),e.addCommand(jk),e.addCommand(EC),e.addCommand(kC),e.addCommand(CC),e.addCommand($C),e.addCommand(zk),e.addCommand(Kk),e.addCommand(Gk),e.addCommand(Wk),e.addCommand(eC),e.addCommand(Xk),e.addCommand(Zk),e.addCommand(g$),e.addCommand(_$),e.addCommand(b$),e.addCommand(T$),e.addCommand(wC),e.addCommand(AC),e.addCommand(IC),e.addCommand(NC),e.addCommand(PC),e.addCommand(jC),e.addCommand(DC),e.addCommand(xC),e.addCommand(LC),e.addCommand(MC),e.addCommand(RC),e.addCommand(BC),e.addCommand(FC),e.addCommand(qC),e.addCommand(HC),e.addCommand(VC),e.addCommand(UC),e.addCommand(Jk),e.addCommand(Yk),e.addCommand(oC),e.addCommand(tC),e.addCommand(nC),e.addCommand(Dk),e.addCommand(xk),e.addCommand(Lk),e.addCommand(Mk),e.addCommand(Rk),e.addCommand(Bk),e.addCommand(Fk),e.addCommand(Uk),e.addCommand(Vk),e.addCommand(qk),e.addCommand(dC),e.addCommand(fC),e.addCommand(pC),e.addCommand(mC),e.addCommand(vC),e.addCommand(SC),e.addCommand(hC),e.addCommand(yC),e.addCommand(gC),e.addCommand(_C),e.addCommand(bC),e.addCommand(TC),e.addCommand(iC),e.addCommand(sC),e.addCommand(cC),e.addCommand(uC),e.addCommand(aC),e.addCommand(lC),e.addCommand(Tk),e.addCommand(vk),e.addCommand(Sk),e.addCommand(Ck),e.addCommand(Ok),e.addCommand($k),e.addCommand(Ek),e.addCommand(wk),e.addCommand(kk),e.addCommand(Hf),e.addCommand(n$),e.addCommand(r$),e.addCommand(o$),e.addCommand(i$),e.addCommand(s$),e.addCommand(a$),e.addCommand(l$),e.addCommand(c$),e.addCommand(u$),e.addCommand(d$),e.addCommand(f$),e.addCommand(m$),e.addCommand(p$),e.addCommand(h$),e.addCommand(y$),e.addCommand(v$),e.addCommand(S$),e.addCommand(w$),e.addCommand(k$),e.addCommand(C$),e.addCommand($$),e.addCommand(E$),e.addCommand(O$),e.addCommand(A$),e.addCommand(I$),e.addCommand(N$),e.addCommand(P$),e.addCommand(j$),e.addCommand(D$),e.addCommand(x$),e.addCommand(L$),e.addCommand(M$),e.addCommand(R$),e.addCommand(B$),e.addCommand(d1),e.addCommand(f1),e.addCommand(u1),e.addCommand(p1),e.addCommand(m1),e.addCommand(h1),e.addCommand(K$),e.addCommand(G$),e.addCommand(z$),e.addCommand(W$),e.addCommand(Q$),e.addCommand(Y$),e.addCommand(J$),e.addCommand(X$),e.addCommand(Z$),e.addCommand(e1),e.addCommand(t1),e.addCommand(n1),e.addCommand(r1),e.addCommand(o1),e.addCommand(i1),e.addCommand(s1),e.addCommand(a1),e.addCommand(c1),e.addCommand(l1),e.addCommand(MS),e.addCommand(y1)}const b1=i.defineComponent({data(){return{muted:!1,volumes:[],modeNames:{master:"Master volume:",music:"Music:",ambiant:"Ambiant:",sound:"Sound effects:"}}},mounted(){const e=ft(),t=rn.Howler.volume();this.volumes.push({mode:"master",volume:t}),e.modes.forEach((n,r)=>{this.volumes.push({mode:r,volume:e.modes.get(r).options.volume})})},methods:{changeVolume(e,t){const n=t.target;e==="master"?ft().setMasterVolume(n.value):ft().setModeVolume(e,n.value)},toggleMute(){this.muted?(rn.Howler.mute(!1),this.muted=!1):(rn.Howler.mute(!0),this.muted=!0)}}}),T1={class:"volume-controls"},v1=i.createElementVNode("h3",{class:"nrt-subtitle"},"Volume",-1),S1={for:"volume",class:"volume-label"},w1=["onUpdate:modelValue","onChange"];function k1(e,t,n,r,o,a){return i.openBlock(),i.createElementBlock("div",T1,[v1,(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.volumes,(s,c)=>(i.openBlock(),i.createElementBlock("div",{class:"volume-control",key:s.mode},[i.createElementVNode("label",S1,i.toDisplayString(e.modeNames[s.mode]),1),i.withDirectives(i.createElementVNode("input",{ref_for:!0,ref:"slider",class:"volume-slider",type:"range",id:"volume",name:"volume",min:"0",max:"1",step:"0.1","onUpdate:modelValue":d=>e.volumes[c].volume=d,onChange:d=>e.changeVolume(s.mode,d)},null,40,w1),[[i.vModelText,e.volumes[c].volume]])]))),128))])}const C1=zt(b1,[["render",k1]]),$1={class:"settings-widget-container"},E1=["for","id"],O1=["id","name","min","max","step"],A1=["id","name"],I1=["id","name"],N1={class:"mx-8"},P1={class:"text-left setting-description"},j1=i.createElementVNode("hr",{class:"h-px my-8 bg-gray-200 border-0 dark:bg-gray-700 setting-separator"},null,-1),D1=i.defineComponent({__name:"setting-widget",props:{settingId:{}},setup(e){const t=e,n=sn(),r=i.computed(()=>n.getSetting(t.settingId)),o=i.ref(r.value),a=i.computed(()=>n.getSettingSchema(t.settingId));function s(c){let d=c;Fl(a.value)&&(d=Math.round(d)),n.setSetting(t.settingId,d)}return i.watch(o,c=>{s(c)}),(c,d)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createElementVNode("div",$1,[i.createElementVNode("label",{for:c.settingId,class:"setting-label",id:`setting-label-${c.settingId}`},i.toDisplayString(a.value.name),9,E1),i.unref(Nm)(a.value)||i.unref(Fl)(a.value)?i.withDirectives((i.openBlock(),i.createElementBlock("input",{key:0,ref:"slider",class:"number-slider setting-slider",type:"range",id:`setting-slider-${c.settingId}`,name:c.settingId,min:a.value.minValue,max:a.value.maxValue,step:a.value.step,"onUpdate:modelValue":d[0]||(d[0]=u=>o.value=u)},null,8,O1)),[[i.vModelText,o.value]]):i.unref(Pm)(a.value)?i.withDirectives((i.openBlock(),i.createElementBlock("input",{key:1,type:"checkbox",class:"setting-checkbox",id:`setting-checkbox-${c.settingId}`,name:c.settingId,"onUpdate:modelValue":d[1]||(d[1]=u=>o.value=u)},null,8,A1)),[[i.vModelCheckbox,o.value]]):i.unref(jm)(a.value)?i.withDirectives((i.openBlock(),i.createElementBlock("input",{key:2,type:"text",class:"setting-text",id:`setting-text-${c.settingId}`,name:c.settingId,"onUpdate:modelValue":d[2]||(d[2]=u=>o.value=u)},null,8,I1)),[[i.vModelText,o.value]]):i.createCommentVNode("",!0),i.createElementVNode("span",N1,i.toDisplayString(o.value),1)]),i.createElementVNode("p",P1,i.toDisplayString(a.value.description),1),j1],64))}}),x1={class:"container mx-auto settings-menu-container"},L1=i.createElementVNode("h2",{class:"settings-menu-title subtitle text-center"},"Settings",-1),M1=i.defineComponent({__name:"settings-menu",setup(e){const t=sn(),n=i.computed(()=>t.getAllSettingSchemas());return(r,o)=>(i.openBlock(),i.createElementBlock("div",x1,[L1,(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.value,(a,s)=>(i.openBlock(),i.createBlock(D1,{settingId:s,key:s},null,8,["settingId"]))),128))]))}}),R1={class:"menu-content"},B1=i.defineComponent({__name:"MainMenu",props:{inputListener:{}},emits:["close"],setup(e,{emit:t}){const n=e,r=t,o=i.ref(null),a=i.ref(null);function s(){window.close()}function c(){Xu(),d()}function d(){r("close")}function u(){const h=mr(Te().playTime.start,Te().playTime.previousPlaytime);return Fi(h/1e3)}return i.onMounted(()=>{a.value=Sn({mode:"list",container:o,listener:n.inputListener,onChosen:h=>{h===0?c():h===1&&s()}}),a.value.mount()}),i.onUnmounted(()=>{a.value&&(a.value.disable(),a.value=null)}),(h,l)=>(i.openBlock(),i.createElementBlock("div",R1,[i.createElementVNode("h3",null,"Play time: "+i.toDisplayString(u()),1),i.createVNode(C1),i.createElementVNode("div",{ref_key:"mainActions",ref:o},[i.createElementVNode("button",{class:"nrt-button nrt-title quit-button",onClick:c}," Main Menu "),i.createElementVNode("button",{class:"nrt-button nrt-title quit-button",onClick:s}," Exit ")],512),i.createVNode(M1)]))}}),F1={class:"sub-tabs-controller"},V1={key:0,class:"sub-tabs-controller__tabs"},U1={key:1,class:"sub-tab-content"},q1={key:2},H1=[i.createElementVNode("div",{class:"sub-tab-content__empty"},[i.createElementVNode("p",null,"No tab selected")],-1)],K1=i.defineComponent({__name:"SubTabController",props:{tabs:{},defaultTab:{},inputListener:{}},emits:["tab-change","close"],setup(e,{emit:t}){const n=t,r=e,o=i.ref(r.defaultTab);function a(c){o.value=c,n("tab-change",c)}const s=i.computed(()=>r.tabs[o.value]);return i.onMounted(()=>{r.inputListener.actions.subPreviousTab={press:()=>{o.value>0&&a(o.value-1)}},r.inputListener.actions.subNextTab={press:()=>{o.value<r.tabs.length-1&&a(o.value+1)}}}),i.onUnmounted(()=>{delete r.inputListener.actions.subPreviousTab,delete r.inputListener.actions.subNextTab}),(c,d)=>(i.openBlock(),i.createElementBlock("div",F1,[c.tabs.length>1?(i.openBlock(),i.createElementBlock("div",V1,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.tabs,(u,h)=>(i.openBlock(),i.createBlock(rd,{key:u.id,tab:u,active:h===o.value,onClick:()=>a(h)},null,8,["tab","active","onClick"]))),128))])):i.createCommentVNode("",!0),s.value?(i.openBlock(),i.createElementBlock("div",U1,[s.value?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(s.value.component),i.mergeProps({key:s.value.id,inputListener:c.inputListener},s.value.extraProps,{onClose:d[0]||(d[0]=u=>c.$emit("close"))}),null,16,["inputListener"])):i.createCommentVNode("",!0)])):(i.openBlock(),i.createElementBlock("div",q1,H1))]))}}),G1=["onClick"],z1={class:"item-title"},W1={class:"item-amount"},Q1=i.defineComponent({__name:"inventory-section",props:{items:{},title:{},id:{},inputListener:{}},emits:["chosen"],setup(e,{emit:t}){const n=e,r=i.ref(null),o=i.ref(null),a=t;function s(u){a("chosen",u)}function c(u){return{backgroundImage:`url(${$t(en(u).icon)})`}}function d(u){return en(u).name}return i.onMounted(()=>{o.value=Sn({mode:"grid",listener:n.inputListener,columns:3,container:r,onChosen:u=>{s(n.items[u].id)}}),o.value.mount()}),i.onUnmounted(()=>{o.value&&(o.value.disable(),o.value=null)}),(u,h)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["inventory-section",`section-${n.id}`])},[i.createElementVNode("h3",null,i.toDisplayString(u.title),1),i.createElementVNode("div",{class:"inventory-section-items",ref_key:"itemsContainer",ref:r},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(u.items,l=>(i.openBlock(),i.createElementBlock("button",{onClick:()=>s(l.id),class:i.normalizeClass(["item-display",`item-${l.id}`]),style:i.normalizeStyle(c(l.id)),key:l.id},[i.createElementVNode("h3",z1,i.toDisplayString(d(l.id)),1),i.createElementVNode("h3",W1,i.toDisplayString(l.amount),1)],14,G1))),128))],512)],2))}}),Y1={class:"flex flex-row item-description-container"},J1={class:"flex item-left"},X1={class:"flex item-right"},Z1=i.createElementVNode("hr",{class:"hr-solid"},null,-1),eE=i.defineComponent({__name:"item-details",props:{item:{}},emits:["use","close"],setup(e,{emit:t}){const n=e,r=i.ref(null),o=i.computed(()=>en(n.item.id)),a=i.computed(()=>({backgroundImage:`url(${$t(o.value.icon)})`})),s=t,c=i.computed(()=>mt().canUseItem(n.item));function d(){c.value&&s("use")}function u(){s("close")}return i.onMounted(()=>{r.value=Ke().registerInputListener("item-details",{continue:{press:()=>{c.value&&d()}},cancel:{press:()=>{u()}}})}),i.onUnmounted(()=>{r.value&&(Ke().unregisterInputListener(r.value),r.value=null)}),(h,l)=>(i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",Y1,[i.createElementVNode("div",J1,[i.createElementVNode("div",{class:"item-display",style:i.normalizeStyle(a.value)},null,4)]),i.createElementVNode("div",X1,[i.createElementVNode("h2",null,i.toDisplayString(o.value.name),1),Z1,i.createElementVNode("h3",null,"Amount: "+i.toDisplayString(h.item.amount),1),i.createElementVNode("p",null,i.toDisplayString(o.value.description),1),i.createElementVNode("button",{onClick:d,class:i.normalizeClass(["nrt-button",c.value?"":"nrt-disabled"])}," Use ",2)])]),i.createElementVNode("button",{class:"nrt-button",onClick:u},i.toDisplayString("<--"))]))}}),tE={key:0},nE={key:2},rE=[i.createElementVNode("h2",null,"The inventory is empty!",-1)],oE=i.defineComponent({__name:"inventory-ui",props:{section:{},inputListener:{}},emits:["close"],setup(e,{emit:t}){const n=mt(),r=i.computed(()=>n.items),o=i.ref(!1),a=i.computed(()=>o.value?r.value[o.value]:null);function s(){ht().closeMenu()}function c(h){o.value=h}function d(){o.value=!1}function u(){n.useItem(a.value)&&s()}return(h,l)=>!a.value&&h.section.items.length>0?(i.openBlock(),i.createElementBlock("div",tE,[i.createVNode(Q1,{items:h.section.items,title:h.section.title,inputListener:h.inputListener,id:h.section.id,onChosen:c},null,8,["items","title","inputListener","id"])])):typeof o.value=="string"?(i.openBlock(),i.createBlock(eE,{key:1,item:r.value[o.value],onUse:u,onClose:d},null,8,["item"])):(i.openBlock(),i.createElementBlock("div",nE,rE))}}),iE=i.defineComponent({__name:"InventoryTab",props:{inputListener:{}},setup(e){const t=mt(),n=i.computed(()=>t.items),r=i.computed(()=>Object.values(n.value).filter(s=>s.amount>0?!0:!!en(s.id).showIfEmpty)),o=i.computed(()=>{const s=Ve().items.categories,c=[];if(s.length>1){const d={id:"all",title:"All",items:r.value};c.push(d)}for(const d in s){const u=s[d],h=u.id,l=r.value.filter(f=>en(f.id).category===h);c.push({id:h,title:u.title,items:l})}return c}),a=i.computed(()=>{const s=[];return o.value.forEach(c=>{s.push({id:c.id,label:c.title,component:oE,extraProps:{section:c}})}),s});return(s,c)=>(i.openBlock(),i.createElementBlock("div",null,[i.createVNode(K1,{tabs:a.value,defaultTab:0,inputListener:s.inputListener},null,8,["tabs","inputListener"])]))}}),sE=["id"],aE={class:"obtained-status"},lE={class:"achievement-title"},cE={class:"achievement-description"},uE=i.defineComponent({__name:"achievement-tile",props:{achievement:{}},setup(e){const t=e,n=lr(),r=i.computed(()=>n.getExistingAchievement(t.achievement)),o=i.computed(()=>qa(t.achievement)),a=wo().secretAchievements??{censorName:!0,censorDescription:!0},s=i.computed(()=>{let h=r.value.unlocked?o.value.icon:o.value.lockedIcon;return h||(h=wo().defaultAchievementIcon),{backgroundImage:`url(${$t(h)})`}}),c=i.computed(()=>!o.value.secret||!a.censorName?o.value.name:"Hidden Achievement"),d=i.computed(()=>!o.value.secret||!a.censorDescription?o.value.description:"This achievement is hidden. Complete it to discover more."),u=i.computed(()=>r.value.unlocked?`Obtained ${new Date(r.value.unlockTime).toLocaleDateString()}`:"Not obtained yet");return(h,l)=>(i.openBlock(),i.createElementBlock("div",{class:"achievement-display nrt-tile",id:`achievement-${h.achievement}`},[i.createElementVNode("div",{class:"achievement-icon",style:i.normalizeStyle(s.value)},null,4),i.createElementVNode("p",aE,i.toDisplayString(u.value),1),i.createElementVNode("h3",lE,i.toDisplayString(c.value),1),i.createElementVNode("p",cE,i.toDisplayString(d.value),1)],8,sE))}}),dE={class:"achievements-section-achievements"},fE=i.defineComponent({__name:"achievements-section",props:{achievements:{},title:{},id:{}},setup(e){const t=e;return(n,r)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["achievements-section",`section-${t.id}`])},[i.createElementVNode("h3",null,i.toDisplayString(n.title),1),i.createElementVNode("div",dE,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.achievements,o=>(i.openBlock(),i.createBlock(uE,{achievement:o.id,key:o.id},null,8,["achievement"]))),128))])],2))}}),pE=i.defineComponent({setup(){const e=lr(),t=Fe(),n=i.computed(()=>e.achievements),r=i.computed(()=>t.currentDialog.choices);return{achievements:n,currentlyChoosing:r}},emits:["close"],data(){return{chosenId:!1}},mounted(){},methods:{close(){this.$emit("close")},clickAchievement(e){this.chosenId=e},closeAchievement(){this.chosenId=!1}},computed:{achievementsToDisplay(){return Object.values(this.achievements)},chosenAchievement(){return this.chosenId?this.achievements[this.chosenId]:null},chosenAchievementConf(){return this.chosenId?this.achievementConf[this.chosenId]:null},achievementConf(){return Ve().achievements.achievements},sections(){const e=Ve().achievements.categories,t=[];return this.achievementsToDisplay.reduce((r,o)=>{const a=qa(o.id).category??"default",s=e.find(d=>d.id===a);if(!s)return ae(`Unknown category ${a}`),r;let c=r.find(d=>d.id===a);return c||(c={id:a,title:s.title,achievements:[]},r.push(c)),c.achievements.push(o),r},t)}},components:{AchievementsSection:fE}}),mE={key:0},hE={key:1},yE=[i.createElementVNode("h2",null,"The achievements section is empty!",-1)];function gE(e,t,n,r,o,a){const s=i.resolveComponent("AchievementsSection");return Object.keys(e.achievementsToDisplay).length>0?(i.openBlock(),i.createElementBlock("div",mE,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.sections,c=>(i.openBlock(),i.createBlock(s,{key:c.id,achievements:c.achievements,title:c.title,id:c.id,onChosen:e.clickAchievement},null,8,["achievements","title","id","onChosen"]))),128))])):(i.openBlock(),i.createElementBlock("div",hE,yE))}const _E=zt(pE,[["render",gE]]),bE={class:"quest-display"},TE={class:"quest-title"},vE={class:"quest-description"},SE={key:0,class:"quest-objectives-container list-disc"},wE=i.defineComponent({__name:"QuestDetails",props:{quest:{}},setup(e){const t=e,n=i.computed(()=>$n(t.quest.id));function r(c){return ko(t.quest.id,c)}const o=i.computed(()=>{switch(t.quest.state){case"hidden":return" Hidden";case"unlocked":return"";case"completed":return" (Completed)";default:return" Unknown"}}),a=i.computed(()=>t.quest.ending?$f(t.quest.id,t.quest.ending).description:t.quest.succeeded&&n.value.succeededDescription?n.value.succeededDescription:!t.quest.succeeded&&n.value.failedDescription?n.value.failedDescription:n.value.description),s=i.computed(()=>Object.values(t.quest.objectives).filter(c=>c.state!=="hidden"));return(c,d)=>(i.openBlock(),i.createElementBlock("div",bE,[i.createElementVNode("div",{class:i.normalizeClass(["quest-header",c.quest.state==="completed"?"quest-completed":"quest-in-progress"])},[i.createElementVNode("h3",TE,i.toDisplayString(n.value.title)+" "+i.toDisplayString(o.value),1)],2),i.createElementVNode("p",vE,i.toDisplayString(a.value),1),c.quest.state!=="completed"?(i.openBlock(),i.createElementBlock("ul",SE,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,u=>(i.openBlock(),i.createElementBlock("li",{class:"quest-objective-display",key:u.id},[i.createElementVNode("p",{class:i.normalizeClass(["quest-objective-description",u.state==="completed"?"quest-objective-completed":"quest-objctive-in-progress"])},i.toDisplayString(r(u.id).description),3)]))),128))])):i.createCommentVNode("",!0)]))}}),kE={class:"quest-list-title"},CE=i.defineComponent({__name:"QuestDisplay",props:{quest:{}},setup(e){const t=e,n=i.computed(()=>$n(t.quest.id));return(r,o)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["quest-list-display",r.quest.state==="completed"?"quest-list-completed":"quest-list-in-progress"])},[i.createElementVNode("p",kE,i.toDisplayString(n.value.title),1)],2))}}),$E={key:0},EE={key:0},OE={key:1},AE=i.defineComponent({__name:"quests-list-section",props:{quests:{},sectionId:{},title:{},fallbackText:{}},emits:["quest-selected"],setup(e,{emit:t}){const n=e,r=i.computed(()=>So().categories),o=i.computed(()=>{const a=[];return n.quests.reduce((c,d)=>{const u=$n(d.id).category??"default",h=r.value.find(f=>f.id===u);if(!h)return ae(`Quest category ${u} not found in config`),c;let l=c.find(f=>f.category.id===u);return l||(l={category:h,quests:[]},c.push(l)),l.quests.push(d),c},a)});return(a,s)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass([`${a.sectionId}-quests-container`,"quests-section"])},[i.createElementVNode("h3",null,i.toDisplayString(a.title),1),a.quests.length>0?(i.openBlock(),i.createElementBlock("div",$E,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,c=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass([`${a.sectionId}-${c.category.id}-category`,"quests-category"]),key:c.category.id},[r.value.length>1?(i.openBlock(),i.createElementBlock("h4",EE,i.toDisplayString(c.category.title),1)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(`${a.sectionId}-${c.category.id}-quests`)},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.quests,d=>(i.openBlock(),i.createBlock(CE,{key:d.id,quest:d,onClick:u=>a.$emit("quest-selected",d)},null,8,["quest","onClick"]))),128))],2)],2))),128))])):(i.openBlock(),i.createElementBlock("div",OE,[i.createElementVNode("p",null,i.toDisplayString(a.fallbackText),1)]))],2))}}),IE=i.defineComponent({setup(){const e=dt(),t=i.computed(()=>e.quests),n=i.ref(null);return{quests:t,selectedQuest:n}},computed:{questsToDisplay(){return Object.values(this.quests).filter(e=>e.state!=="hidden")},activeQuests(){return this.questsToDisplay.filter(e=>e.state==="unlocked")},completedQuests(){return this.questsToDisplay.filter(e=>e.state==="completed")},questsUiClass(){return Je().layoutMode==="horizontal"?"quests-ui-horizontal":"quests-ui-vertical"}},mounted(){this.activeQuests.length>0?this.selectedQuest=this.activeQuests[0]:this.completedQuests.length>0&&(this.selectedQuest=this.completedQuests[0])},methods:{clickOnQuest(e){this.selectedQuest=e}},components:{QuestDetails:wE,QuestsListSection:AE}}),NE={class:"quests-list-container"},PE={class:"quest-details"};function jE(e,t,n,r,o,a){const s=i.resolveComponent("QuestsListSection"),c=i.resolveComponent("QuestDetails");return i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["quests-ui",e.questsUiClass])},[i.createElementVNode("div",NE,[i.createVNode(s,{quests:e.activeQuests,sectionId:"active",title:"Active Quests",fallbackText:"No active quests",onQuestSelected:e.clickOnQuest},null,8,["quests","onQuestSelected"]),i.createVNode(s,{quests:e.completedQuests,sectionId:"completed",title:"Completed Quests",fallbackText:"No completed quests",onQuestSelected:e.clickOnQuest},null,8,["quests","onQuestSelected"])]),i.createElementVNode("div",PE,[e.selectedQuest?(i.openBlock(),i.createBlock(c,{key:0,quest:e.selectedQuest},null,8,["quest"])):i.createCommentVNode("",!0)])],2)}const DE=zt(IE,[["render",jE]]);function Wf(e){const t=Xe(),n=i.computed(()=>t.skills),r=i.computed(()=>n.value[e]),o=i.computed(()=>dn().skills),a=i.computed(()=>dn().skillOptions.xpPerLevel),s=i.computed(()=>({backgroundImage:`url(${$t(o.value[e].icon)})`})),c=i.computed(()=>o.value[e].name),d=i.computed(()=>o.value[e].description),u=i.computed(()=>`Level ${n.value[e].level}`);return{skills:n,skillsStore:t,skillConfig:o,xpPerLevel:a,skillState:r,skillStyle:s,skillName:c,skillDescription:d,skillLevelText:u}}const xE=e=>(i.pushScopeId("data-v-a94cb74f"),e=e(),i.popScopeId(),e),LE=["id"],ME={class:"flex flex-row skill-description-container"},RE={class:"flex skill-left"},BE={class:"flex skill-right"},FE=xE(()=>i.createElementVNode("hr",{class:"hr-solid"},null,-1)),VE=["innerHTML"],UE=zt(i.defineComponent({__name:"SkillDetails",props:{chosenSkill:{},inputListener:{}},emits:["cancel"],setup(e,{emit:t}){const n=e,r=t,o=i.ref(null),a=i.ref(null);function s(){r("cancel")}const{skillStyle:c,skillName:d,skillDescription:u,skillLevelText:h}=Wf(n.chosenSkill);return i.onMounted(()=>{o.value=Sn({mode:"list",listener:n.inputListener,container:a,onChosen:()=>{s()}}),o.value.mount()}),i.onUnmounted(()=>{o.value&&(o.value.disable(),o.value=null)}),(l,f)=>(i.openBlock(),i.createElementBlock("div",{id:`skill-display-${l.chosenSkill}`},[i.createElementVNode("div",ME,[i.createElementVNode("div",RE,[i.createElementVNode("div",{class:"skill-display",style:i.normalizeStyle(i.unref(c))},null,4)]),i.createElementVNode("div",BE,[i.createElementVNode("h2",null,i.toDisplayString(i.unref(d)),1),FE,i.createElementVNode("h3",null,i.toDisplayString(i.unref(h)),1),i.createElementVNode("p",{innerHTML:i.unref(u)},null,8,VE)])]),i.createElementVNode("div",{ref_key:"buttonsContainer",ref:a},[i.createElementVNode("button",{class:"nrt-button",onClick:s},i.toDisplayString("<--"))],512)],8,LE))}}),[["__scopeId","data-v-a94cb74f"]]),qE={class:"skill-title"},HE={class:"skill-xp-container"},KE={class:"skill-xp-text"},GE={class:"skill-level"},zE=zt(i.defineComponent({__name:"SkillGridElement",props:{chosenSkill:{},inputListener:{}},emits:["choose"],setup(e,{expose:t,emit:n}){const r=e,o=i.ref(null);t({gridElement:o});const a=n;function s(){a("choose")}const{skillStyle:c,skillName:d,skillState:u,xpPerLevel:h}=Wf(r.chosenSkill),l=i.computed(()=>({width:`${Math.floor(u.value.xp/h.value*100)}%`}));return(f,m)=>(i.openBlock(),i.createElementBlock("button",{onClick:s,class:"skill-grid-element",style:i.normalizeStyle(i.unref(c)),ref_key:"gridElement",ref:o},[i.createElementVNode("h3",qE,i.toDisplayString(i.unref(d)),1),i.createElementVNode("div",HE,[i.createElementVNode("div",{class:"skill-xp-bar",style:i.normalizeStyle(l.value)},null,4),i.createElementVNode("h3",KE,i.toDisplayString(i.unref(u).xp)+" / "+i.toDisplayString(i.unref(h))+" XP",1)]),i.createElementVNode("h3",GE,i.toDisplayString(i.unref(u).level),1)],4))}}),[["__scopeId","data-v-8d457bf9"]]),WE={class:"skills-container"},QE=zt(i.defineComponent({__name:"SkillsGrid",props:{inputListener:{},lastChosenSkill:{type:[String,Boolean]}},emits:["choose"],setup(e,{emit:t}){const n=e,r=i.ref([]),o=i.computed(()=>r.value.map(f=>f.gridElement)),a=Xe(),s=i.computed(()=>a.skills),c=i.ref(null),d=t;function u(f){d("choose",f)}const h=i.computed(()=>dn().skills),l=i.computed(()=>{const f={};for(const m in s.value)h.value[m].hidden&&s.value[m].level<1||(f[m]=s.value[m]);return Object.values(f)});return i.onMounted(()=>{var f;if(c.value=Sn({mode:"grid",listener:n.inputListener,elements:o,columns:3,onChosen:m=>{u(l.value[m].id)}}),(f=c.value)==null||f.mount(),typeof n.lastChosenSkill=="string"){const m=l.value.findIndex(y=>y.id===n.lastChosenSkill);m>=0&&c.value.select(m)}}),i.onUnmounted(()=>{c.value&&c.value.disable()}),(f,m)=>(i.openBlock(),i.createElementBlock("div",WE,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.value,y=>(i.openBlock(),i.createBlock(zE,{ref_for:!0,ref_key:"skillGridElements",ref:r,key:y.id,onChoose:()=>u(y.id),chosenSkill:y.id,inputListener:f.inputListener},null,8,["onChoose","chosenSkill","inputListener"]))),128))]))}}),[["__scopeId","data-v-31202bb8"]]),YE=i.defineComponent({__name:"SkillsWindow",props:{inputListener:{}},setup(e){const t=i.ref(!1),n=i.ref(!1);function r(a){n.value=a,t.value=a}function o(){t.value=!1}return(a,s)=>t.value?typeof t.value=="string"?(i.openBlock(),i.createBlock(UE,{key:1,chosenSkill:t.value,inputListener:a.inputListener,onCancel:o},null,8,["chosenSkill","inputListener"])):i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(QE,{key:0,inputListener:a.inputListener,lastChosenSkill:n.value,onChoose:r},null,8,["inputListener","lastChosenSkill"]))}});function JE(e){e.component("MainMenu",B1),e.component("InventoryTab",iE),e.component("AchievementsUI",_E),e.component("QuestsUi",DE),e.component("SkillsWindow",YE),ht().menus={system:{label:"System",cssClass:"system-menu",id:"system",tabs:[{id:"system-tab",cssId:"system-tab",text:"System",component:"MainMenu"}],activeTab:0},menu:{label:"Menu",id:"menu",cssClass:"menu-menu",tabs:[{id:"skills",cssId:"skills-menu-button",text:"Skills",condition:()=>ht().showSkills,component:"SkillsWindow"},{id:"inventory",cssId:"inventory-menu-button",text:"Items",condition:()=>ht().showInventory,component:"InventoryTab"},{id:"quests",cssId:"quests-menu-button",text:"Quests",condition:()=>ht().showQuests,component:"QuestsUi"},{id:"achievements",cssId:"achievements-menu-button",text:"Achievements",condition:()=>ht().showAchievements,component:"AchievementsUI"}],activeTab:0}}}function tl(e,t,n){const r=window.narrat.app;for(const o in t.tabs){const a=t.tabs[o].component;r.component(a,n[a])}ht().addMenu(e,t)}function XE(e,t,n){window.narrat.app.component(t.component,n),ht().addMenuOption(e,t)}function ZE(){for(const e of Ie.plugins){if(e.customMenuButtons)for(const t of e.customMenuButtons)tl(t.config.id,t.config,t.components);if(e.customMenuTabs)for(const t of e.customMenuTabs)XE(t.config.id,t.config,t.component)}}function eO(e){e.directive("visible",{mounted(t,n){n.value?t.style.visibility="visible":t.style.visibility="hidden"},updated(t,n){n.value?t.style.visibility="visible":t.style.visibility="hidden"}})}class xi{constructor(){xe(this,"pluginId","narrat-plugin")}onPageLoaded(){}onNarratSetup(){}onAppMounted(){}onAssetsLoaded(){}onGameSetup(){}onGameStart(){}onGameMounted(){}onGameDismounted(){}}function Qf(e){Ie.addPlugin(e)}function Yf(e){Ie.addCommand(e)}const tO={args:[],canvasResizePolicy:0,executable:"",experimentalVK:!1,fileSizes:{"index.pck":54160,"index.wasm":52315256},focusCanvas:!1,gdextensionLibs:[]};function nO(){window.godotReady=!0,window.narratReadyCallback&&window.narratReadyCallback(),console.log("godot ready")}window.godotReadyCallback=nO;class Jf extends xi{constructor(n){super();xe(this,"customCommands",[]);xe(this,"canvas");xe(this,"app");xe(this,"messageQueue",[]);xe(this,"narrat");xe(this,"narratReady",!1);xe(this,"engineConfig");xe(this,"engine");const r={...tO,...n.engineConfigOverrides??{}};n.godotGamePath&&(r.executable=n.godotGamePath),this.engineConfig=r,this.customCommands=[V.FromOptions({keyword:"godot_pause",argTypes:[],runner:async o=>{this.addMessageForGodot({type:"pause",payload:{}})}}),V.FromOptions({keyword:"godot_resume",argTypes:[],runner:async o=>{this.addMessageForGodot({type:"resume",payload:{}})}})]}onAppMounted(){const n=document.querySelector("#narrat");if(!n){console.error("no app");return}this.narrat=window.narrat;const r=document.createElement("canvas");this.app=n,this.canvas=r,r.id="godot-canvas",r.style.position="absolute",r.style.zIndex="0",n.appendChild(r),window.addEventListener("keydown",a=>{if(a.fakeEvent)return;const s=new KeyboardEvent(a.type,a);s.fakeEvent=!0,this.canvas.dispatchEvent(s)}),window.addEventListener("keyup",a=>{if(a.fakeEvent)return;const s=new KeyboardEvent(a.type,a);s.fakeEvent=!0,this.canvas.dispatchEvent(s)}),new window.Engine(this.engineConfig).startGame(),this.resizeCanvas(),window.godot=this,this.narratReady=!0,window.narratReadyCallback&&window.narratReadyCallback()}getCanvas(){return document.querySelector("#godot-canvas")}addMessageForGodot(n){this.messageQueue.unshift(n),window.godotCallback&&window.godotCallback(n)}grabNextMessage(){return this.messageQueue.pop()}async run(n,...r){const o=await this.narrat.run(n,...r),a={type:"run_end",payload:{label:n,args:r,result:o}};this.addMessageForGodot(a)}isJson(n){try{JSON.parse(n)}catch{return!1}return!0}resizeCanvas(){const n=Je(),r=n.gameWidth,o=n.gameHeight;this.canvas.width=r,this.canvas.height=o,this.canvas.style.width=`${r}px`,this.canvas.style.height=`${o}px`,window.requestAnimationFrame(()=>this.resizeCanvas())}}class Xf extends xi{constructor(n={}){super();xe(this,"defaultTheme");xe(this,"themes",[]);xe(this,"activeTheme");xe(this,"customCommands");xe(this,"initialConfig");n.defaultTheme&&(this.defaultTheme=n.defaultTheme),n.themes&&(this.themes=n.themes),this.customCommands=[this.createChangeThemeCommand()]}onNarratSetup(){if(this.defaultTheme){const n=this.themes.find(r=>r.id===this.defaultTheme);if(!n){ae(`Theme ${this.defaultTheme} not found`);return}this.setTheme(n)}}addTheme(n){this.themes.push(n)}createChangeThemeCommand(){return V.FromOptions({keyword:"change_theme",argTypes:[{name:"theme",type:"string"}],runner:async r=>{this.changeTheme(r.options.theme)}})}changeTheme(n){if(n==="default"){this.removeCurrentTheme();return}const r=this.findTheme(n);this.setTheme(r)}findTheme(n){const r=this.themes.find(o=>o.id===n);return r||ae(`Theme ${n} not found`),r}setTheme(n){this.activeTheme&&this.removeCurrentTheme(),this.activeTheme={themeTag:this.createThemeTag(n),id:n.id},document.head.appendChild(this.activeTheme.themeTag),n.extendedConfig&&(this.initialConfig=Yn({},lt().config),lt().extendConfig(n.extendedConfig))}createThemeTag(n){if(this.isInlineTheme(n)){const r=document.createElement("style");return r.innerHTML=n.css,r}else{const r=document.createElement("link");return r.rel="stylesheet",r.href=n.cssPath,r.id=n.id,r}}isInlineTheme(n){return n.css!==void 0}isExternalTheme(n){return n.cssPath!==void 0}removeCurrentTheme(){this.activeTheme&&(this.activeTheme.themeTag&&this.activeTheme.themeTag.remove(),this.findTheme(this.activeTheme.id).extendedConfig&&(lt().config=this.initialConfig)),this.activeTheme=void 0}}const Zf={css:"body{font-size:52px}",id:"narrat-fun-theme",extendedConfig:{}},ep={id:"narrat-text-only",css:"#narrat-app{--bg-color: #131720;--text-color: #d9e1f2;--primary: hsl(255, 30%, 55%);--focus: hsl(210, 90%, 50%);--secondary: #42b983;--dialog-box-bg: transparent;--dialog-box-border: none}.interact-button{background:unset;border:none;font-size:2rem;font-weight:700;color:#fff;font-family:monospace;text-shadow:-4px 4px 2px #000}.dialog{box-shadow:none!important;text-align:center}.dialog-text{font-size:1.5rem;font-family:monospace;text-shadow:-4px 4px 2px #000}",extendedConfig:{common:{dialogPanel:{textSpeed:30,animateText:!0,timeBetweenLines:100,overlayMode:!0,rightOffset:300,bottomOffset:150,width:700,height:680}}}},rO=Object.freeze(Object.defineProperty({__proto__:null,BaseConfigInputSchema:ti,CommandPlugin:V,ConfigInputSchema:Vs,ConfigInputSchemaWithCommon:Bs,ConfigInputSchemaWithoutCommon:Fs,EngineSplash:bs,GameDialog:Os,GameSplash:Ss,GodotPlugin:Jf,Hud:Ps,InGame:js,InputsListener:ks,LogManager:Ao,MenuButtons:As,ModalWindow:_n,NarratPlugin:xi,NarratThemesPlugin:Xf,Screens:Ns,StartMenu:$s,get Vec2(){return Z.Vec2},addCommand:Yf,aspectRatioFit:vs,audioConfig:Lt,buttonsConfig:Ci,charactersConfig:$i,constructNarratObject:nl,debounce:io,error:ae,findVariable:Yi,funTheme:Zf,gameloop:oo,generateObjectFromList:Ji,generateParser:Dr,getAssetUrl:$t,getButtonConfig:Vn,getConfig:le,getDataUrl:Ai,getFile:Qo,getImageUrl:Lr,getItemConfig:en,getObjectiveConfig:ko,getQuestConfig:$n,getScreenConfig:xr,getSkillConfig:Oi,getSplitConfigUrl:Ua,getWindow:Mo,handleHMR:Ba,inputEvents:qt,isConfigInputWithCommon:ni,isModuleValid:Ra,isNarratScript:Fa,isNarratYaml:vi,isPromise:Xi,itemsConfig:wi,loadDataFile:ro,logManager:Io,logger:Ft,processText:nn,questsConfig:So,randomId:Gn,registerMenuButton:tl,registerPlugin:Qf,screensConfig:ki,skillsConfig:dn,textOnlyTheme:ep,timeout:At,tooltipsConfig:Fn,useAchievements:lr,useAudio:ft,useConfig:lt,useDialogStore:Fe,useHud:Pt,useInputs:Ke,useInventory:mt,useMain:Te,useMenu:ht,useNotifications:vt,useQuests:dt,useRenderingStore:Je,useScenes:Nt,useScreenObjects:xt,useScreens:Ut,useSkills:Xe,useTooltips:_r,useVM:we,warning:Zn},Symbol.toStringTag,{value:"Module"}));function nl(e){const t={app:e,vm:Ie,handleHMR:Ba,jump:n=>we().jumpToLabel(n),run:(n,...r)=>we().runThenGoBackToPreviousDialog(n,...r),getSave:()=>bn(),exports:rO};return window.narrat=t,t}var oO=Object.prototype.toString,tp=function(t){if(t===void 0)return"undefined";if(t===null)return"null";var n=typeof t;if(n==="boolean")return"boolean";if(n==="string")return"string";if(n==="number")return"number";if(n==="symbol")return"symbol";if(n==="function")return cO(t)?"generatorfunction":"function";if(iO(t))return"array";if(fO(t))return"buffer";if(dO(t))return"arguments";if(aO(t))return"date";if(sO(t))return"error";if(lO(t))return"regexp";switch(np(t)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(uO(t))return"generator";switch(n=oO.call(t),n){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return n.slice(8,-1).toLowerCase().replace(/\s/g,"")};function np(e){return typeof e.constructor=="function"?e.constructor.name:null}function iO(e){return Array.isArray?Array.isArray(e):e instanceof Array}function sO(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function aO(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function lO(e){return e instanceof RegExp?!0:typeof e.flags=="string"&&typeof e.ignoreCase=="boolean"&&typeof e.multiline=="boolean"&&typeof e.global=="boolean"}function cO(e,t){return np(e)==="GeneratorFunction"}function uO(e){return typeof e.throw=="function"&&typeof e.return=="function"&&typeof e.next=="function"}function dO(e){try{if(typeof e.length=="number"&&typeof e.callee=="function")return!0}catch(t){if(t.message.indexOf("callee")!==-1)return!0}return!1}function fO(e){return e.constructor&&typeof e.constructor.isBuffer=="function"?e.constructor.isBuffer(e):!1}/*!
83
+ Error: ${t}`),console.error("============================")}function RS(e,...t){console.log(`[${e.fileName}:${e.line}] log: `,...t)}function Sf(e,t,n){const r=V.FromOptions({keyword:e,argTypes:t,runner:async o=>await ve().runLabelFunction(n,...o.args)});Ie.addCommand(r)}const FS=V.FromOptions({keyword:"create_macro",argTypes:"any",runner:async e=>{e.args.length<2&&se(e,"create_macro command needs at least a name and a label");const t=e.args[0],n=e.args[1],o=e.args.slice(2).map(a=>({name:a,type:"any"}));Sf(t,o,n)}}),VS=[["items",oc,ic],["achievements",Cc,$c],["screens",fc,pc],["skills",yc,gc],["skillChecks",Ec,Oc],["buttons",cc,uc],["scripts",ec,Gm],["audio",Rl,Fl],["quests",sc,ac],["tooltips",vc,Sc],["characters",_c,bc],["choices",Ic,Nc],["animations",jc,xc],["macros",Dc,Lc],["preload",Mc,Bc]],US=[["common",tc,rs]],Cn=new DS({allErrors:!0}),qS=["baseAssetsPath","baseDataPath","gameTitle","saveFileName","images","layout","settings","gameFlow","dialogPanel","splashScreens","notifications","hudStats","interactionTags","transitions","menuButtons","debugging","saves"];async function HS(e,t){for(const[n,r,o]of US){const a=t[n];let s=wf(o);try{if(!Cn.validate(r,a))throw console.error(Cn.errors),new Error(`${Cn.errorsText()}`)}catch(c){console.error(c),ae(`${n} config error: ${c}`)}typeof a<"u"&&(s=wf(a,s)),e[n]=s}}function wf(e,t){return typeof e=="object"?Array.isArray(e)?[...e]:{...t,...e}:typeof e<"u"?e:t}async function KS(e,t){for(const n of qS){const r=t[n];r&&(typeof r=="object"&&!Array.isArray(r)?e.common[n]={...e.common[n],...r}:e.common[n]=r)}}async function GS(e){const t={...Tr};oi(e)?await HS(t,e):KS(t,e);for(const n of VS){const r=n[0],o=n[1],a=n[2];let s=e[r];if(s&&typeof s=="string")try{if(s=await oo(qa(t.common.baseDataPath,s)),!Cn.validate(o,s))throw console.error(Cn.errors),new Error(`${Cn.errorsText()}`)}catch(c){console.error(c),ae(`${r} config error: ${c}`),s={...a}}s&&(Array.isArray(s)?t[r]=s:typeof s=="object"?t[r]={...a,...s}:t[r]=s)}for(const n in t)vf(t,n,t[n]);for(const n of t.macros.macros){const r=n.options??[];Sf(n.keyword,r,n.label)}return t}async function zS(e){let t;if(e.config){const o=e.config;t={};for(const a in o){const s=o[a];wi(s)?(st().addConfigModule(a,{id:s.id,configKey:a,code:s.code}),t[a]=s.code):t[a]=s}}else if(e.configPath)t=await oo(e.configPath);else throw ae("No config file or config object provided"),new Error("No config file or config object provided");let n=t;return oi(t)&&(n=t.common),n.baseAssetsPath=e.baseAssetsPath??n.baseAssetsPath??"",n.baseDataPath=e.baseDataPath??n.baseDataPath??"",Cn.validate(Us,t)||(ae("Config file validation failed."),console.log(Cn.errors),ae(Cn.errorsText())),GS(t)}function Ve(){return st().config}function le(){return Ve().common}function ar(e){const t=le().hudStats[e];return t||ae(`Hud stat ${e} doesn't exist`),t}function Lt(){return Ve().audio}function kf(e){const t=Lt().files[e];if(!t){er(`Audio file ${e} doesn't exist`);return}return t}function ki(e){const t=kf(e),n=((t==null?void 0:t.fadeInDelay)??Lt().options.musicFadeInDelay)*1e3,r=((t==null?void 0:t.fadeInTime)??Lt().options.musicFadeInTime)*1e3,o=((t==null?void 0:t.fadeOutTime)??Lt().options.musicFadeOutTime)*1e3;return{fadeInDelay:n,fadeInTime:r,fadeOutTime:o}}function dn(){return Ve().skills}function So(){return Ve().skillChecks}function Ci(){return Ve().items}function wo(){return Ve().quests}function $i(){return Ve().screens}function Ei(){return Ve().buttons}function Vn(){return Ve().tooltips}function Oi(){return Ve().characters}function Ua(){return Ve().choices}function Cf(){return Ve().animations}function $f(e){return Ua().choicePrompts[e]}function Lr(e){return e===qo?Hl:$i().screens[e]?$i().screens[e]:(ae(`Screen config for screen ${e} doesn't exist`),Hl)}function Ai(e){const n=Vn().tooltips.find(r=>r.keywords.includes(e));return n||(ae(`Tooltip config for keyword ${e} not found`),null)}function Ii(e){const t=Ve().skills.skills[e];return t||ae(`Skill config for skill ${e} doesn't exist`),t}function Ef(e){const t=Ve().skillChecks.skillChecks[e];return t||ae(`Skill check config for skill check ${e} doesn't exist`),t}function Of(e){return!!Ve().skillChecks.skillChecks[e]}function Mr(e){return e.startsWith("http")?e:Et(e)}function Et(e){var n,r,o,a;if(e.startsWith("http"))return e;let t=e;return le().images[e]?t=le().images[e]:(n=Ve().preload.images)!=null&&n.assets[e]?t=(r=Ve().preload.images)==null?void 0:r.assets[e]:(o=Ve().preload.video)!=null&&o.assets[e]&&(t=(a=Ve().preload.video)==null?void 0:a.assets[e]),le().baseAssetsPath?`${le().baseAssetsPath}${t}`:t}function qa(e,t){return`${e}${t}`}function Ni(e){return le().baseDataPath?`${le().baseDataPath}${e}`:e}function Un(e){const t=Ei().buttons[e];return t||ae(`Button config for button ${e} doesn't exist`),t}function en(e){const t=Ci().items[e];return t||ae(`Item config for skill ${e} doesn't exist`),t}function ko(){return Ve().achievements}function Ha(e){const t=ko().achievements[e];return t||ae(`Achievement config for achievement ${e} doesn't exist`),t}function $n(e){return wo().quests[e]}function Af(e,t){const r=$n(e).endings;return r||ae(`Quest ${e} doesn't have any endings`),r[t]||ae(`Quest ${e} has no ending called ${t}`),r[t]}function Co(e,t){return $n(e).objectives[t]}function Pi(){return le().dialogPanel.width??Vm}const dt=et("quests",{state:()=>({quests:{}}),actions:{getQuest(e){const t=this.quests[e];if(t)return t;{const n=`Quest ${e} doesn't exist!`;throw ae(n),new Error(n)}},getObjective(e,t){const n=this.getQuest(e);if(!n){const a=`Quest ${e} doesn't exist!`;throw ae(a),new Error(a)}const r=n.objectives[t];if(r)return r;const o=`Objective ${t} doesn't exist in quest ${e}!`;throw ae(o),new Error(o)},updateConfig(e){const t=e.quests;for(const n of Object.keys(t)){const r=t[n];this.quests[n]||(this.quests[n]={id:n,state:"hidden",objectives:{},extraData:{}});for(const o of Object.keys(r.objectives)){const a=r.objectives[o];this.quests[n].objectives[o]||(this.quests[n].objectives[o]={extraData:{},id:o,state:a.hidden?"hidden":"unlocked"})}}},reset(e){this.$reset(),this.updateConfig(e)},startQuest(e){const t=this.getQuest(e);t?(t.state="unlocked",vt().addNotification(`Started quest: ${$n(e).title}`)):ae(`Quest ${e} doesn't exist!`)},startObjective(e,t){const n=this.getObjective(e,t);n?(n.state="unlocked",vt().addNotification(`New quest objective: ${Co(e,t).description}`)):ae(`Objective ${t} doesn't exist in quest ${e}!`)},completeObjective(e,t){const n=this.getObjective(e,t);n?(n.state="completed",vt().addNotification(`Completed quest objective: ${Co(e,t).description}`)):ae(`Objective ${t} doesn't exist in quest ${e}!`)},completeQuest(e,t){const n=this.getQuest(e);if(n){if(n.state="completed",typeof t=="string"){n.ending=t;const r=Af(e,t);n.succeeded=r.success}else typeof t=="boolean"?n.succeeded=t:n.succeeded=!0;vt().addNotification(`Completed quest: ${$n(e).title}`)}else ae(`Quest ${e} doesn't exist!`)},isQuestCompleted(e){const t=this.getQuest(e);return t?t.state==="completed":!1},isQuestSucceeded(e){const t=this.getQuest(e);return t?t.state==="completed"&&t.succeeded:!1},isQuestFailed(e){const t=this.getQuest(e);return t?t.state==="completed"&&!t.succeeded:!1},getQuestEnding(e){const t=this.getQuest(e);return t?t.ending:!1},questHasEnding(e,t){return this.getQuestEnding(e)===t},isObjectiveCompleted(e,t){const n=this.getObjective(e,t);return n?n.state==="completed":!1},isQuestStarted(e){const t=this.getQuest(e);return t&&t.state==="unlocked"},isObjectiveStarted(e,t){return this.getObjective(e,t).state==="unlocked"},removeQuest(e){delete this.quests[e]},generateSaveData(){return{quests:Be(this.quests)}},loadSaveData(e){this.quests=e.quests}}});function If(e,t,n,r="$"){if(!n.startsWith(r))return isNaN(Number(n))?[null,n]:[null,Number(n)];n=n.substring(1);const o=/\[/,a=/\]/;let s=n.search(o);n.search(a);let c=n,d=t,u=0;for(;u<n.length;){if(s>u||s===-1){const h=s>u?s:n.length;let l=n.substring(u,h);isNaN(Number(l))||(l=Number(l)),u>0&&(d=d[c]),[d,c]=QS(d,l)}if(s!==-1){u=s;const h=n.substring(s+1),l=WS(h)+s,f=n.substring(s+1,l),[m,y]=If(e,e,f);let b=y;m&&(b=m[y]),typeof b=="number"||!isNaN(Number(b))?b=Number(b):typeof b!="string"&&console.error(`invalid array index (${b}) key type when compiling: ${n}`),d=d[c],c=b,u=l+1;const S=n.substring(u);s=S.search(o),s!==-1&&(s+=u),S.search(a)}else u=n.length}return[d,c]}function WS(e){let t=!1,n=0,r,o=1;for(;!t;){r=e.substring(n);const a=r.search(/\[/),s=r.search(/\]/);a!==-1&&a<s?(n+=a+1,o++):(n+=s+1,o--),o===0&&(t=!0),a===-1&&s===-1&&!t&&ae(`Could not find closing bracket in ${e}`)}return n}function QS(e,t){if(typeof t=="number")return[e,t];t.startsWith(".")&&(t=t.substring(1));const n=t.split(".");let r=e;const o=n.length-1;let a=n[0],s=0;for(s=0;s<o;s++)a=n[s],typeof r[a]>"u"&&(r[a]={}),r=r[a];return a=n[s],[r,a]}function ji(e,t,n="$"){return If(e,e,t)}function YS(e,t){return ji(e,t)}function Nf(e,t,n){const[r,o]=ji(e,t);r[o]=n}function Pf(e,t,n){const[r,o]=ji(e,t),a=r[o]||0;r[o]=n+a}function Br(){const e=ve(),t=Xe(),n=Ut(),r=mt(),o=ve().scope,a={data:e.data,global:e.globalData,skills:t.skills,skillChecks:t.skillChecks,buttons:n.buttons,items:r.items,quests:dt().quests,stats:Pt().hudStats,scope:o,config:le(),gameOptions:Te().options,baseSettings:sn().baseSettings,customSettings:sn().customSettings};return new Proxy(a,{get:(c,d,u)=>{const h=ve().scope,l=ve().data;return typeof h[d]<"u"?h[d]:typeof l[d]<"u"?l[d]:Reflect.get(c,d,u)},set:(c,d,u,h)=>{const l=ve().scope,f=ve().data;if(typeof l[d]<"u")l[d]=u;else{if(typeof c[d]<"u")return Reflect.set(c,d,u,h);typeof u=="object"?f[d]={}:f[d]=u}return!0}})}function Be(e){if(e===null)return null;if(typeof e=="object")if(Array.isArray(e)){const t=[];for(const n in e)t[n]=Be(e[n]);return t}else{const t={};for(const n in e)t[n]=Be(e[n]);return t}else return e}function Ka(e,t){if(e===null)return null;if(typeof e=="object"){const n=t(e);if(t(e))return n;if(Array.isArray(e)){const r=[];for(const o in e)r[o]=Ka(e[o],t);return r}else{const r={};for(const o in e)r[o]=Ka(e[o],t);return r}}else return t(e)}const Xe=et("skills",{state:()=>({skillChecks:{},skills:{}}),actions:{setupSkillCheck(e,t){this.skillChecks[t]=e},passSkillCheck(e,t){this.skillChecks[e].happened=!0,this.skillChecks[e].succeeded=!0,t&&(this.skillChecks[e].hidden=!0)},failSkillCheck(e,t){this.skillChecks[e].happened=!0,this.skillChecks[e].succeeded=!1,t&&(this.skillChecks[e].hidden=!0)},resetSkillCheck(e){this.skillChecks[e].happened=!1,this.skillChecks[e].succeeded=!1,this.skillChecks[e].hidden=!1},generateSaveData(){return{skillChecks:Be(this.skillChecks),skills:Be(this.skills)}},getSkillCheck(e){return this.skillChecks[e]||this.setupSkillCheck(this.createSkillCheckState(),e),this.skillChecks[e]},createSkillCheckState(){return{happened:!1,succeeded:!1,hidden:!1}},loadSaveData(e){this.skillChecks=Jn(this.skillChecks,e.skillChecks),this.skills=Jn(this.skills,e.skills)},updateConfig(e){const t=e.skills;for(const n in t)this.skills[n]||(this.skills[n]={id:n,level:t[n].startingLevel||0,xp:0})},reset(e){this.$reset(),this.updateConfig(e)},getSkill(e){return this.skills[e]},getSkillLevel(e){return this.getSkill(e).level},getSkillXp(e){return this.getSkill(e).xp},addXp(e,t){const n=this.getSkill(e);n||ae(`Skill ${e} doesn't exist`),n.xp+=t,n.xp>=dn().skillOptions.xpPerLevel&&(n.xp=0,n.level++,this.levelledUp(e))},setSkillLevel(e,t){const n=this.getSkill(e);n||ae(`Skill ${e} doesn't exist`),n.level=t,this.levelledUp(e)},incrementSkill(e,t){this.getSkill(e).level+=t,this.levelledUp(e)},levelledUp(e){const t=dn().skills[e].name,n=this.skills[e].level;dn().skillOptions.notifyLevelUp&&vt().addNotification(`Your skill in ${t} is now level ${n}`)}}});function En(e){return Array.isArray?Array.isArray(e):Df(e)==="[object Array]"}const JS=1/0;function XS(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-JS?"-0":t}function ZS(e){return e==null?"":XS(e)}function fn(e){return typeof e=="string"}function jf(e){return typeof e=="number"}function ew(e){return e===!0||e===!1||tw(e)&&Df(e)=="[object Boolean]"}function xf(e){return typeof e=="object"}function tw(e){return xf(e)&&e!==null}function Mt(e){return e!=null}function Ga(e){return!e.trim().length}function Df(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const TA="Extended search is not available",nw="Incorrect 'index' type",rw=e=>`Invalid value for key ${e}`,ow=e=>`Pattern length exceeds max of ${e}.`,iw=e=>`Missing ${e} property in key`,sw=e=>`Property 'weight' in key '${e}' must be a positive integer`,Lf=Object.prototype.hasOwnProperty;class aw{constructor(t){this._keys=[],this._keyMap={};let n=0;t.forEach(r=>{let o=Mf(r);n+=o.weight,this._keys.push(o),this._keyMap[o.id]=o,n+=o.weight}),this._keys.forEach(r=>{r.weight/=n})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Mf(e){let t=null,n=null,r=null,o=1,a=null;if(fn(e)||En(e))r=e,t=Bf(e),n=za(e);else{if(!Lf.call(e,"name"))throw new Error(iw("name"));const s=e.name;if(r=s,Lf.call(e,"weight")&&(o=e.weight,o<=0))throw new Error(sw(s));t=Bf(s),n=za(s),a=e.getFn}return{path:t,id:n,weight:o,src:r,getFn:a}}function Bf(e){return En(e)?e:e.split(".")}function za(e){return En(e)?e.join("."):e}function lw(e,t){let n=[],r=!1;const o=(a,s,c)=>{if(Mt(a))if(!s[c])n.push(a);else{let d=s[c];const u=a[d];if(!Mt(u))return;if(c===s.length-1&&(fn(u)||jf(u)||ew(u)))n.push(ZS(u));else if(En(u)){r=!0;for(let h=0,l=u.length;h<l;h+=1)o(u[h],s,c+1)}else s.length&&o(u,s,c+1)}};return o(e,fn(t)?t.split("."):t,0),r?n:n[0]}var Ae={...{isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},...{includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},...{location:0,threshold:.6,distance:100},...{useExtendedSearch:!1,getFn:lw,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1}};const cw=/[^ ]+/g;function uw(e=1,t=3){const n=new Map,r=Math.pow(10,t);return{get(o){const a=o.match(cw).length;if(n.has(a))return n.get(a);const s=1/Math.pow(a,.5*e),c=parseFloat(Math.round(s*r)/r);return n.set(a,c),c},clear(){n.clear()}}}class Wa{constructor({getFn:t=Ae.getFn,fieldNormWeight:n=Ae.fieldNormWeight}={}){this.norm=uw(n,3),this.getFn=t,this.isCreated=!1,this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach((n,r)=>{this._keysMap[n.id]=r})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,fn(this.docs[0])?this.docs.forEach((t,n)=>{this._addString(t,n)}):this.docs.forEach((t,n)=>{this._addObject(t,n)}),this.norm.clear())}add(t){const n=this.size();fn(t)?this._addString(t,n):this._addObject(t,n)}removeAt(t){this.records.splice(t,1);for(let n=t,r=this.size();n<r;n+=1)this.records[n].i-=1}getValueForItemAtKeyId(t,n){return t[this._keysMap[n]]}size(){return this.records.length}_addString(t,n){if(!Mt(t)||Ga(t))return;let r={v:t,i:n,n:this.norm.get(t)};this.records.push(r)}_addObject(t,n){let r={i:n,$:{}};this.keys.forEach((o,a)=>{let s=o.getFn?o.getFn(t):this.getFn(t,o.path);if(Mt(s)){if(En(s)){let c=[];const d=[{nestedArrIndex:-1,value:s}];for(;d.length;){const{nestedArrIndex:u,value:h}=d.pop();if(Mt(h))if(fn(h)&&!Ga(h)){let l={v:h,i:u,n:this.norm.get(h)};c.push(l)}else En(h)&&h.forEach((l,f)=>{d.push({nestedArrIndex:f,value:l})})}r.$[a]=c}else if(fn(s)&&!Ga(s)){let c={v:s,n:this.norm.get(s)};r.$[a]=c}}}),this.records.push(r)}toJSON(){return{keys:this.keys,records:this.records}}}function Rf(e,t,{getFn:n=Ae.getFn,fieldNormWeight:r=Ae.fieldNormWeight}={}){const o=new Wa({getFn:n,fieldNormWeight:r});return o.setKeys(e.map(Mf)),o.setSources(t),o.create(),o}function dw(e,{getFn:t=Ae.getFn,fieldNormWeight:n=Ae.fieldNormWeight}={}){const{keys:r,records:o}=e,a=new Wa({getFn:t,fieldNormWeight:n});return a.setKeys(r),a.setIndexRecords(o),a}function xi(e,{errors:t=0,currentLocation:n=0,expectedLocation:r=0,distance:o=Ae.distance,ignoreLocation:a=Ae.ignoreLocation}={}){const s=t/e.length;if(a)return s;const c=Math.abs(r-n);return o?s+c/o:c?1:s}function fw(e=[],t=Ae.minMatchCharLength){let n=[],r=-1,o=-1,a=0;for(let s=e.length;a<s;a+=1){let c=e[a];c&&r===-1?r=a:!c&&r!==-1&&(o=a-1,o-r+1>=t&&n.push([r,o]),r=-1)}return e[a-1]&&a-r>=t&&n.push([r,a-1]),n}const lr=32;function pw(e,t,n,{location:r=Ae.location,distance:o=Ae.distance,threshold:a=Ae.threshold,findAllMatches:s=Ae.findAllMatches,minMatchCharLength:c=Ae.minMatchCharLength,includeMatches:d=Ae.includeMatches,ignoreLocation:u=Ae.ignoreLocation}={}){if(t.length>lr)throw new Error(ow(lr));const h=t.length,l=e.length,f=Math.max(0,Math.min(r,l));let m=a,y=f;const b=c>1||d,S=b?Array(l):[];let T;for(;(T=e.indexOf(t,y))>-1;){let P=xi(t,{currentLocation:T,expectedLocation:f,distance:o,ignoreLocation:u});if(m=Math.min(P,m),y=T+h,b){let Y=0;for(;Y<h;)S[T+Y]=1,Y+=1}}y=-1;let I=[],D=1,R=h+l;const F=1<<h-1;for(let P=0;P<h;P+=1){let Y=0,W=R;for(;Y<W;)xi(t,{errors:P,currentLocation:f+W,expectedLocation:f,distance:o,ignoreLocation:u})<=m?Y=W:R=W,W=Math.floor((R-Y)/2+Y);R=W;let X=Math.max(1,f-W+1),G=s?l:Math.min(f+W,l)+h,z=Array(G+2);z[G+1]=(1<<P)-1;for(let te=G;te>=X;te-=1){let ke=te-1,Ne=n[e.charAt(ke)];if(b&&(S[ke]=+!!Ne),z[te]=(z[te+1]<<1|1)&Ne,P&&(z[te]|=(I[te+1]|I[te])<<1|1|I[te+1]),z[te]&F&&(D=xi(t,{errors:P,currentLocation:ke,expectedLocation:f,distance:o,ignoreLocation:u}),D<=m)){if(m=D,y=ke,y<=f)break;X=Math.max(1,2*f-y)}}if(xi(t,{errors:P+1,currentLocation:f,expectedLocation:f,distance:o,ignoreLocation:u})>m)break;I=z}const L={isMatch:y>=0,score:Math.max(.001,D)};if(b){const P=fw(S,c);P.length?d&&(L.indices=P):L.isMatch=!1}return L}function mw(e){let t={};for(let n=0,r=e.length;n<r;n+=1){const o=e.charAt(n);t[o]=(t[o]||0)|1<<r-n-1}return t}class Ff{constructor(t,{location:n=Ae.location,threshold:r=Ae.threshold,distance:o=Ae.distance,includeMatches:a=Ae.includeMatches,findAllMatches:s=Ae.findAllMatches,minMatchCharLength:c=Ae.minMatchCharLength,isCaseSensitive:d=Ae.isCaseSensitive,ignoreLocation:u=Ae.ignoreLocation}={}){if(this.options={location:n,threshold:r,distance:o,includeMatches:a,findAllMatches:s,minMatchCharLength:c,isCaseSensitive:d,ignoreLocation:u},this.pattern=d?t:t.toLowerCase(),this.chunks=[],!this.pattern.length)return;const h=(f,m)=>{this.chunks.push({pattern:f,alphabet:mw(f),startIndex:m})},l=this.pattern.length;if(l>lr){let f=0;const m=l%lr,y=l-m;for(;f<y;)h(this.pattern.substr(f,lr),f),f+=lr;if(m){const b=l-lr;h(this.pattern.substr(b),b)}}else h(this.pattern,0)}searchIn(t){const{isCaseSensitive:n,includeMatches:r}=this.options;if(n||(t=t.toLowerCase()),this.pattern===t){let y={isMatch:!0,score:0};return r&&(y.indices=[[0,t.length-1]]),y}const{location:o,distance:a,threshold:s,findAllMatches:c,minMatchCharLength:d,ignoreLocation:u}=this.options;let h=[],l=0,f=!1;this.chunks.forEach(({pattern:y,alphabet:b,startIndex:S})=>{const{isMatch:T,score:I,indices:D}=pw(t,y,b,{location:o+S,distance:a,threshold:s,findAllMatches:c,minMatchCharLength:d,includeMatches:r,ignoreLocation:u});T&&(f=!0),l+=I,T&&D&&(h=[...h,...D])});let m={isMatch:f,score:f?l/this.chunks.length:1};return f&&r&&(m.indices=h),m}}class qn{constructor(t){this.pattern=t}static isMultiMatch(t){return Vf(t,this.multiRegex)}static isSingleMatch(t){return Vf(t,this.singleRegex)}search(){}}function Vf(e,t){const n=e.match(t);return n?n[1]:null}class hw extends qn{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const n=t===this.pattern;return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class yw extends qn{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const r=t.indexOf(this.pattern)===-1;return{isMatch:r,score:r?0:1,indices:[0,t.length-1]}}}class gw extends qn{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const n=t.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class _w extends qn{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const n=!t.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}}class bw extends qn{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const n=t.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[t.length-this.pattern.length,t.length-1]}}}class Tw extends qn{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const n=!t.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}}class Uf extends qn{constructor(t,{location:n=Ae.location,threshold:r=Ae.threshold,distance:o=Ae.distance,includeMatches:a=Ae.includeMatches,findAllMatches:s=Ae.findAllMatches,minMatchCharLength:c=Ae.minMatchCharLength,isCaseSensitive:d=Ae.isCaseSensitive,ignoreLocation:u=Ae.ignoreLocation}={}){super(t),this._bitapSearch=new Ff(t,{location:n,threshold:r,distance:o,includeMatches:a,findAllMatches:s,minMatchCharLength:c,isCaseSensitive:d,ignoreLocation:u})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class qf extends qn{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let n=0,r;const o=[],a=this.pattern.length;for(;(r=t.indexOf(this.pattern,n))>-1;)n=r+a,o.push([r,n-1]);const s=!!o.length;return{isMatch:s,score:s?0:1,indices:o}}}const Qa=[hw,qf,gw,_w,Tw,bw,yw,Uf],Hf=Qa.length,vw=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Sw="|";function ww(e,t={}){return e.split(Sw).map(n=>{let r=n.trim().split(vw).filter(a=>a&&!!a.trim()),o=[];for(let a=0,s=r.length;a<s;a+=1){const c=r[a];let d=!1,u=-1;for(;!d&&++u<Hf;){const h=Qa[u];let l=h.isMultiMatch(c);l&&(o.push(new h(l,t)),d=!0)}if(!d)for(u=-1;++u<Hf;){const h=Qa[u];let l=h.isSingleMatch(c);if(l){o.push(new h(l,t));break}}}return o})}const kw=new Set([Uf.type,qf.type]);class Cw{constructor(t,{isCaseSensitive:n=Ae.isCaseSensitive,includeMatches:r=Ae.includeMatches,minMatchCharLength:o=Ae.minMatchCharLength,ignoreLocation:a=Ae.ignoreLocation,findAllMatches:s=Ae.findAllMatches,location:c=Ae.location,threshold:d=Ae.threshold,distance:u=Ae.distance}={}){this.query=null,this.options={isCaseSensitive:n,includeMatches:r,minMatchCharLength:o,findAllMatches:s,ignoreLocation:a,location:c,threshold:d,distance:u},this.pattern=n?t:t.toLowerCase(),this.query=ww(this.pattern,this.options)}static condition(t,n){return n.useExtendedSearch}searchIn(t){const n=this.query;if(!n)return{isMatch:!1,score:1};const{includeMatches:r,isCaseSensitive:o}=this.options;t=o?t:t.toLowerCase();let a=0,s=[],c=0;for(let d=0,u=n.length;d<u;d+=1){const h=n[d];s.length=0,a=0;for(let l=0,f=h.length;l<f;l+=1){const m=h[l],{isMatch:y,indices:b,score:S}=m.search(t);if(y){if(a+=1,c+=S,r){const T=m.constructor.type;kw.has(T)?s=[...s,...b]:s.push(b)}}else{c=0,a=0,s.length=0;break}}if(a){let l={isMatch:!0,score:c/a};return r&&(l.indices=s),l}}return{isMatch:!1,score:1}}}const Ya=[];function $w(...e){Ya.push(...e)}function Ja(e,t){for(let n=0,r=Ya.length;n<r;n+=1){let o=Ya[n];if(o.condition(e,t))return new o(e,t)}return new Ff(e,t)}const Di={AND:"$and",OR:"$or"},Xa={PATH:"$path",PATTERN:"$val"},Za=e=>!!(e[Di.AND]||e[Di.OR]),Ew=e=>!!e[Xa.PATH],Ow=e=>!En(e)&&xf(e)&&!Za(e),Kf=e=>({[Di.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function Gf(e,t,{auto:n=!0}={}){const r=o=>{let a=Object.keys(o);const s=Ew(o);if(!s&&a.length>1&&!Za(o))return r(Kf(o));if(Ow(o)){const d=s?o[Xa.PATH]:a[0],u=s?o[Xa.PATTERN]:o[d];if(!fn(u))throw new Error(rw(d));const h={keyId:za(d),pattern:u};return n&&(h.searcher=Ja(u,t)),h}let c={children:[],operator:a[0]};return a.forEach(d=>{const u=o[d];En(u)&&u.forEach(h=>{c.children.push(r(h))})}),c};return Za(e)||(e=Kf(e)),r(e)}function Aw(e,{ignoreFieldNorm:t=Ae.ignoreFieldNorm}){e.forEach(n=>{let r=1;n.matches.forEach(({key:o,norm:a,score:s})=>{const c=o?o.weight:null;r*=Math.pow(s===0&&c?Number.EPSILON:s,(c||1)*(t?1:a))}),n.score=r})}function Iw(e,t){const n=e.matches;t.matches=[],Mt(n)&&n.forEach(r=>{if(!Mt(r.indices)||!r.indices.length)return;const{indices:o,value:a}=r;let s={indices:o,value:a};r.key&&(s.key=r.key.src),r.idx>-1&&(s.refIndex=r.idx),t.matches.push(s)})}function Nw(e,t){t.score=e.score}function Pw(e,t,{includeMatches:n=Ae.includeMatches,includeScore:r=Ae.includeScore}={}){const o=[];return n&&o.push(Iw),r&&o.push(Nw),e.map(a=>{const{idx:s}=a,c={item:t[s],refIndex:s};return o.length&&o.forEach(d=>{d(a,c)}),c})}class Rr{constructor(t,n={},r){this.options={...Ae,...n},this.options.useExtendedSearch,this._keyStore=new aw(this.options.keys),this.setCollection(t,r)}setCollection(t,n){if(this._docs=t,n&&!(n instanceof Wa))throw new Error(nw);this._myIndex=n||Rf(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){Mt(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const n=[];for(let r=0,o=this._docs.length;r<o;r+=1){const a=this._docs[r];t(a,r)&&(this.removeAt(r),r-=1,o-=1,n.push(a))}return n}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:n=-1}={}){const{includeMatches:r,includeScore:o,shouldSort:a,sortFn:s,ignoreFieldNorm:c}=this.options;let d=fn(t)?fn(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return Aw(d,{ignoreFieldNorm:c}),a&&d.sort(s),jf(n)&&n>-1&&(d=d.slice(0,n)),Pw(d,this._docs,{includeMatches:r,includeScore:o})}_searchStringList(t){const n=Ja(t,this.options),{records:r}=this._myIndex,o=[];return r.forEach(({v:a,i:s,n:c})=>{if(!Mt(a))return;const{isMatch:d,score:u,indices:h}=n.searchIn(a);d&&o.push({item:a,idx:s,matches:[{score:u,value:a,norm:c,indices:h}]})}),o}_searchLogical(t){const n=Gf(t,this.options),r=(c,d,u)=>{if(!c.children){const{keyId:l,searcher:f}=c,m=this._findMatches({key:this._keyStore.get(l),value:this._myIndex.getValueForItemAtKeyId(d,l),searcher:f});return m&&m.length?[{idx:u,item:d,matches:m}]:[]}const h=[];for(let l=0,f=c.children.length;l<f;l+=1){const m=c.children[l],y=r(m,d,u);if(y.length)h.push(...y);else if(c.operator===Di.AND)return[]}return h},o=this._myIndex.records,a={},s=[];return o.forEach(({$:c,i:d})=>{if(Mt(c)){let u=r(n,c,d);u.length&&(a[d]||(a[d]={idx:d,item:c,matches:[]},s.push(a[d])),u.forEach(({matches:h})=>{a[d].matches.push(...h)}))}}),s}_searchObjectList(t){const n=Ja(t,this.options),{keys:r,records:o}=this._myIndex,a=[];return o.forEach(({$:s,i:c})=>{if(!Mt(s))return;let d=[];r.forEach((u,h)=>{d.push(...this._findMatches({key:u,value:s[h],searcher:n}))}),d.length&&a.push({idx:c,item:s,matches:d})}),a}_findMatches({key:t,value:n,searcher:r}){if(!Mt(n))return[];let o=[];if(En(n))n.forEach(({v:a,i:s,n:c})=>{if(!Mt(a))return;const{isMatch:d,score:u,indices:h}=r.searchIn(a);d&&o.push({score:u,key:t,value:a,idx:s,norm:c,indices:h})});else{const{v:a,n:s}=n,{isMatch:c,score:d,indices:u}=r.searchIn(a);c&&o.push({score:d,key:t,value:a,norm:s,indices:u})}return o}}Rr.version="6.6.2",Rr.createIndex=Rf,Rr.parseIndex=dw,Rr.config=Ae,Rr.parseQuery=Gf,$w(Cw);const jw=i.createElementVNode("h3",{class:"title"},"Jump to label",-1),xw={key:0,class:"search-results"},Dw={key:1},Lw=[i.createElementVNode("h3",null,"No matches found",-1)],Mw=i.defineComponent({__name:"debug-jumping",emits:["close","jump"],setup(e,{emit:t}){const n=t;let r;const o=i.ref(null),a=i.ref(""),s=i.ref([]),c=i.ref(0),d=i.ref(null);function u(){const f=a.value,m=r.search(f);s.value=m.map(y=>y.item),s.value.length>0&&c.value>s.value.length-1&&(c.value=s.value.length-1)}function h(f){if(f===c.value)return{background:"var(--light-background)"}}const l=i.computed(()=>Object.keys(Ie.script).sort());return i.onMounted(()=>{Te().debugMode=!0,r=new Rr(l.value,{includeScore:!0}),s.value=l.value,c.value=0,setTimeout(()=>{i.nextTick(()=>{d.value&&d.value.focus()})},10),o.value=Ke().registerInputListener("debug-jumping",{up:{press:()=>{c.value>0?c.value--:c.value=s.value.length-1}},down:{press:()=>{s.value.length>c.value+1?c.value++:c.value=0}},continue:{press:()=>{if(s.value.length>0&&c.value<s.value.length){const f=s.value[c.value];ve().jumpToLabel(f),n("close")}}},escape:{press:()=>{n("close")}}})}),i.onUnmounted(()=>{o.value&&Ke().unregisterInputListener(o.value),Te().debugMode=!1}),(f,m)=>(i.openBlock(),i.createBlock(_n,{onClose:m[1]||(m[1]=y=>f.$emit("close")),containerCssClass:"jump-menu-container"},{header:i.withCtx(()=>[jw]),body:i.withCtx(()=>[i.withDirectives(i.createElementVNode("input",{type:"text",class:"label-input nrt-input",ref_key:"search",ref:d,"onUpdate:modelValue":m[0]||(m[0]=y=>a.value=y),onInput:u},null,544),[[i.vModelText,a.value]]),s.value.length>0?(i.openBlock(),i.createElementBlock("div",xw,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,(y,b)=>(i.openBlock(),i.createElementBlock("div",{class:"search-result",style:i.normalizeStyle(h(b)),key:b},i.toDisplayString(y),5))),128))])):(i.openBlock(),i.createElementBlock("div",Dw,Lw))]),_:1}))}}),Bw=i.defineComponent({components:{ModalWindow:_n,DebugJumping:Mw},setup(){const e=Xe(),t=i.computed(()=>e.skills),n=i.computed(()=>e.skillChecks);return{skills:t,skillChecks:n}},data(){return{showDebug:!1,jumping:!1,inputListener:null}},mounted(){const e=Je(),t=le().hotkeys.debugMenu??"d",n=le().hotkeys.jumpMenu??"j";e.inputsContainer.addEventListener("keydown",r=>{this.jumping||(r.key===t&&this.toggle(),r.key===n&&this.jump())})},methods:{closeJumping(){this.jumping=!1},labelSelected(e){const t=e.target.value;ve().jumpToLabel(t),this.close()},close(){this.showDebug=!1,this.endDebug()},closeErrors(){Te().clearErrors()},open(){this.showDebug=!0,this.startDebug(),ve(),dt(),mt(),Xe()},toggle(){this.showDebug?this.close():this.open()},startDebug(){Te().debugMode=!0},endDebug(){Te().debugMode=!1},jump(){this.jumping=!0,this.startDebug()},save(){Ds({})},resetSave(){Sp()},resetGlobalSave(){dd()},wordCount(){const t=Object.values(this.script).reduce((n,r)=>(Ft.log(n),n+this.countWordsInScriptBranch(r.branch)),0);alert(`You have ${t} words`)},countWordsInScriptLine(e){if(e.command.commandType==="talk"&&typeof e.command.args[2]=="string")return this.countWordsInString(e.command.args[2]);if(e.command.commandType==="text")return this.countWordsInString(e.code);if(e.command.commandType==="choice"){const t=e.command.staticOptions;let n=this.countWordsInScriptLine(t.prompt);return n+=t.choices.reduce((o,a)=>o+this.countWordsInString(a.prompt.code),0),t.choices.reduce((o,a)=>a.branch?o+this.countWordsInScriptBranch(a.branch):o,n)}if(e.command.commandType==="if"){const t=e.command.staticOptions;return[t.success,t.failure].reduce((r,o)=>o?r+this.countWordsInScriptBranch(o):r,0)}return 0},countWordsInString(e){return e.split(" ").length},countWordsInScriptBranch(e){return e.reduce((t,n)=>n?t+this.countWordsInScriptLine(n):t,0)},getPlayTimeString(){const e=hr(this.playTime.start,this.playTime.previousPlaytime);return Ui(e/1e3)}},computed:{...Jr(ve,["data"]),...Jr(Te,["playTime","errors","playing"]),...Jr(Nt,["activeScene"]),labels(){const e=this.script;return Object.keys(e).sort()},script(){return Ie.script},variables(){return this.data}}}),Rw={class:"debug-menu"},Fw={key:0,class:"debug-info"},Vw=[i.createStaticVNode("<h3>Debug mode is ON</h3><ul><li><b>j</b>: Quick Label Jump</li><li><b>d</b>: Debug Menu</li><li><b>a</b>: Auto Play</li><li><b>s</b>: Skip</li><li><b>Space</b>: New Game</li><li><b>c</b>: Continue</li><li><b>Escape</b>: Toggle Menu</li></ul>",2)],Uw=i.createElementVNode("h3",{class:"title"},"Error(s)",-1),qw=["innerHTML"],Hw=i.createElementVNode("h3",{class:"title"},"Debug Menu!",-1),Kw={class:"container"},Gw=i.createElementVNode("option",{class:"nrt-option",selected:"",disabled:""}," Jump to a label ",-1),zw=["value"],Ww={class:"grid grid-cols-3 gap-4"},Qw=i.createElementVNode("h2",null,"Variables Editor",-1),Yw=i.createElementVNode("p",null,[i.createTextVNode(" This has been removed. Use the "),i.createElementVNode("a",{href:"https://devtools.vuejs.org/"},"Vue Devtools"),i.createTextVNode(" instead and inspect the contents of the pinia store ")],-1),Jw={ref:"variablesViewer"},Xw=i.createElementVNode("h2",null,"Skill Checks",-1),Zw={class:"table-auto"},ek=i.createElementVNode("thead",null,[i.createElementVNode("tr",null,[i.createElementVNode("th",null,"Skill Check"),i.createElementVNode("th",null,"Happened"),i.createElementVNode("th",null,"Succeeded")])],-1),tk=i.createElementVNode("h2",null,"App State editor (entire app and engine",-1),nk=i.createElementVNode("h3",{style:{color:"pink"}}," Use for debugging, editing some of those things can cause issues ",-1),rk={ref:"stateViewer"};function ok(e,t,n,r,o,a){const s=i.resolveComponent("DebugJumping"),c=i.resolveComponent("ModalWindow");return i.openBlock(),i.createElementBlock("div",Rw,[i.createElementVNode("button",{onClick:t[0]||(t[0]=(...d)=>e.open&&e.open(...d)),class:"nrt-button debug-button"},"Debug Menu"),!e.playing&&e.activeScene==="menu"?(i.openBlock(),i.createElementBlock("div",Fw,Vw)):i.createCommentVNode("",!0),e.jumping?(i.openBlock(),i.createBlock(s,{key:1,onClose:e.closeJumping},null,8,["onClose"])):i.createCommentVNode("",!0),e.errors.length>0?(i.openBlock(),i.createBlock(c,{key:2,onClose:e.closeErrors,containerCssClass:"debug-menu-container"},{header:i.withCtx(()=>[Uw]),body:i.withCtx(()=>[i.createTextVNode(" There are errors in your dialogue scripts. Open the developer console for more details. "),i.createElementVNode("ul",null,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.errors,(d,u)=>(i.openBlock(),i.createElementBlock("li",{key:u,class:i.normalizeClass(["error-message list-disc",d.type==="error"?"error":"warning"]),innerHTML:d.text},null,10,qw))),128))])]),_:1},8,["onClose"])):i.createCommentVNode("",!0),e.showDebug?(i.openBlock(),i.createBlock(c,{key:3,onClose:e.close,containerCssClass:"debug-menu-container"},{header:i.withCtx(()=>[Hw]),body:i.withCtx(()=>[i.createElementVNode("div",Kw,[i.createTextVNode(" Hello this is the debug menu. "),i.createElementVNode("select",{class:"nrt-select",name:"label-selector",onChange:t[1]||(t[1]=d=>e.labelSelected(d))},[Gw,(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.labels,d=>(i.openBlock(),i.createElementBlock("option",{class:"nrt-option",value:d,key:d},i.toDisplayString(d),9,zw))),128))],32),i.createElementVNode("div",Ww,[i.createElementVNode("button",{onClick:t[2]||(t[2]=(...d)=>e.wordCount&&e.wordCount(...d)),class:"nrt-button"},"Word Count"),i.createElementVNode("button",{onClick:t[3]||(t[3]=(...d)=>e.save&&e.save(...d)),class:"nrt-button"},"Save Game"),i.createElementVNode("button",{onClick:t[4]||(t[4]=(...d)=>e.resetSave&&e.resetSave(...d)),class:"nrt-button"},"Reset Save"),i.createElementVNode("button",{onClick:t[5]||(t[5]=(...d)=>e.resetGlobalSave&&e.resetGlobalSave(...d)),class:"nrt-button"}," Reset GLOBAL Save ")]),i.createElementVNode("h3",null,"Play time: "+i.toDisplayString(e.getPlayTimeString()),1),Qw,Yw,i.createElementVNode("div",Jw,null,512),Xw,i.createElementVNode("table",Zw,[ek,i.createElementVNode("tbody",null,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.skillChecks,(d,u)=>(i.openBlock(),i.createElementBlock("tr",{key:u},[i.createElementVNode("td",null,i.toDisplayString(u),1),i.createElementVNode("td",null,i.toDisplayString(d.happened?"✅":"❌"),1),i.createElementVNode("td",null,i.toDisplayString(d.happened?d.succeeded?"✅":"❌":"NA"),1)]))),128))])]),tk,nk,i.createElementVNode("div",rk,null,512)])]),_:1},8,["onClose"])):i.createCommentVNode("",!0)])}const ik=zt(Bw,[["render",ok]]),sk=["src"],ak=["innerHTML"],lk=["innerHTML"],ck=i.defineComponent({__name:"notification-toast",setup(e){const t=vt(),n=i.computed(()=>t.notifications),r=o=>{if(o.description)return{marginTop:"10px"}};return(o,a)=>(i.openBlock(),i.createBlock(i.TransitionGroup,{name:"notification",tag:"div",class:"notifications-holder"},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.value,(s,c)=>(i.openBlock(),i.createElementBlock("div",{class:"notification nrt-tile",key:c},[s.icon?(i.openBlock(),i.createElementBlock("img",{key:0,src:i.unref(Et)(s.icon),class:"notification-icon",style:i.normalizeStyle(r(s))},null,12,sk)):i.createCommentVNode("",!0),i.createElementVNode("span",{innerHTML:s.text,class:"notification-text"},null,8,ak),s.description?(i.openBlock(),i.createElementBlock("p",{key:1,innerHTML:s.description,class:"notification-description"},null,8,lk)):i.createCommentVNode("",!0)]))),128))]),_:1}))}}),uk={class:"title"},dk=i.defineComponent({__name:"alert-modal",props:{title:{type:String,required:!1},text:{type:String,required:!1}},emits:["close"],setup(e,{emit:t}){const n=t;function r(){n("close")}const o=i.ref(Ke().registerInputListener("yes-no",{cancel:{press:()=>{r()}},continue:{press:()=>{r()}},system:{press:()=>{r()}}}));return i.onUnmounted(()=>{o.value&&Ke().unregisterInputListener(o.value)}),(a,s)=>(i.openBlock(),i.createBlock(_n,{onClose:r,containerCssClass:"yes-no-modal"},{header:i.withCtx(()=>[i.createElementVNode("h3",uk,i.toDisplayString(e.title??"Alert"),1)]),body:i.withCtx(()=>[i.createElementVNode("h3",null,i.toDisplayString(e.text),1)]),_:1}))}}),fk=i.createElementVNode("hr",null,null,-1),pk=i.defineComponent({__name:"floating-tooltip",props:{title:{},text:{},width:{},x:{},y:{},screenWidth:{},screenHeight:{},screenMargin:{},cssClass:{},textCssClass:{},titleCssClass:{}},setup(e){const t=i.ref(150),n=i.ref(null),r=e,o=i.computed(()=>r.screenWidth??window.innerWidth),a=i.computed(()=>r.screenHeight??window.innerHeight),s=i.computed(()=>{const c=r.screenMargin??5,d={};let u=r.x-r.width/2;u=Math.min(u,o.value-r.width-c),u=Math.max(c,u),d.left=`${u}px`;let h=a.value-r.y;return h=Math.max(h,c),h=Math.min(h,a.value-t.value-c),d.bottom=`${h}px`,d.width=`${r.width}px`,d});return i.onMounted(()=>{n.value&&(t.value=n.value.clientHeight)}),(c,d)=>(i.openBlock(),i.createBlock(i.Transition,{name:"fade"},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["floating-tooltip",c.cssClass]),style:i.normalizeStyle(s.value),ref_key:"element",ref:n},[c.title?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["floating-tooltip-title",c.titleCssClass])},[i.createTextVNode(i.toDisplayString(r.title)+" ",1),fk],2)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(["floating-tooltip-text",c.textCssClass])},i.toDisplayString(r.text),3)],6)]),_:1}))}}),mk={class:"tooltips-ui"},hk=i.defineComponent({__name:"tooltips-ui",setup(e){const t=br(),n=Je(),r=i.computed(()=>t.tooltip),o=i.computed(()=>n.screenWidth),a=i.computed(()=>n.screenHeight),s=i.computed(()=>{if(r.value)return{...r.value,screenMargin:Vn().options.screenEdgesMinimumMargin??5,screenWidth:o.value,screenHeight:a.value,...c(r.value)}});function c(d){var h,l;let u={};return Vn().options.styling&&(u={...u,...Vn().options.styling}),(h=Ai(d.keyword))!=null&&h.styling&&(u={...u,...(l=Ai(d.keyword))==null?void 0:l.styling}),u}return(d,u)=>(i.openBlock(),i.createElementBlock("div",mk,[r.value?(i.openBlock(),i.createBlock(pk,i.normalizeProps(i.mergeProps({key:0},s.value)),null,16)):i.createCommentVNode("",!0)]))}}),el={};async function yk(e){Ft.log("Loading videos");const t=[],n=async(o,a)=>await gk(o,a),r=(o,a)=>{t.push(n(o,a))};if(e.preload.video)for(const o in e.preload.video.assets){const a=e.preload.video.assets[o];r(o,a)}return Promise.all(t)}async function gk(e,t){if(el[e])return el[e];const n=new Promise((r,o)=>{const a=document.createElement("video");a.onloadeddata=()=>{r(a)},a.onerror=s=>{ae(`Could not load video ${t}`,s),o(s)},a.src=Et(t)});return el[e]=n,n}async function _k(){const t=Ve().scripts;ft().setMasterVolume(Lt().options.volume??1),await ve().loadScripts(t),ht().setup();for(const[,n]of Ie.customStores())if(n.setup){const r=n.setup();es(r)&&await r}Ie.addCustomSettings(),cd()}async function bk(){const e=Te(),t=Zg(Ve()),n=yk(Ve()),r=um(Lt());if(Ie.plugins){const o=[];for(const a of Ie.plugins)a.loadingPromises&&o.push(Promise.all(a.loadingPromises));o.length>0&&(e.setLoadingStep("Plugins",0),await Promise.all(o))}e.setLoadingStep("Assets",.3),await Promise.all([t,n,r]),Ie.callHook("onAssetsLoaded"),e.setLoadingStep("Starting",.9),await _k(),Ie.callHook("onGameSetup"),e.gameLoaded()}const Tk=["id"],vk=i.defineComponent({__name:"GameScene",props:{sceneId:{},options:{}},setup(e){const t=e,n=Nt(),r=i.computed(()=>n.getSceneConfig(t.sceneId));function o(){n.finishedScene(t.sceneId)}return(a,s)=>(i.openBlock(),i.createElementBlock("div",{class:"game-scene",id:`scene-${a.sceneId}`},[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(r.value.component),{onFinished:o,options:a.options},null,40,["options"]))],8,Tk))}}),cr=et("achievements",{state:()=>({achievements:{}}),actions:{generateGlobalSaveData(){return{achievements:Be(this.achievements)}},loadGlobalSaveData(e){this.achievements={...this.achievements,...Be(e.achievements)}},updateConfig(e){Object.keys(e.achievements).forEach(t=>{this.achievements[t]||(this.achievements[t]={id:t,unlocked:!1})})},reset(e){this.$reset(),this.updateConfig(e)},hasAchievement(e){var t;return((t=this.achievements[e])==null?void 0:t.unlocked)??!1},getExistingAchievement(e){return this.achievements[e]},unlock(e){const t=this.getExistingAchievement(e);if(!t){ae(`Tried to unlock achievement ${e} but it doesn't exist`);return}if(!t.unlocked){const n=new Date().toISOString();t.unlocked=!0,t.unlockTime=n}if(ko().notifyNewAchievements){const n=Ha(e);vt().addNotification(`New Achievement: ${n.name}`,n.description,n.icon)}}}}),tl=et("choices-tracking-store",{state:()=>({choices:{}}),getters:{},actions:{trackChoice(e,t){this.choices[e]||(this.choices[e]={}),this.choices[e][t]=!0},hasSeenChoice(e,t){var n;return((n=this.choices[e])==null?void 0:n[t])??!1},generateSaveData(){return{choices:Be(this.choices)}},loadSaveData(e){this.choices=Be(e.choices)},reset(){this.$reset()}}});Xb({main:{store:Te,save:"main"},achievements:{store:cr,config:"achievements",globalSave:"achievements"},audio:{store:ft,config:"audio",save:"audio"},choicesTracking:{store:tl,config:"choices",save:"choices"},config:{store:st,save:"config"},dialog:{store:Fe,save:"dialog"},hud:{store:Pt,config:"common",save:"hud"},inputs:{store:Ke},inventory:{store:mt,config:"items",save:"inventory"},menu:{store:ht},notifications:{store:vt,config:"common"},quests:{store:dt,config:"quests",save:"quests"},rendering:{store:Je,save:"rendering"},screens:{store:Ut,config:"screens",save:"screens"},sprites:{store:Dt,save:"screenObjects"},settings:{store:sn,save:"settings",config:"common"},skills:{store:Xe,config:"skills",save:"skills"},startMenu:{store:$s},tooltips:{store:br,config:"tooltips"},vm:{store:ve,save:"vm",globalSave:"data"},scenes:{store:Nt,save:"scenes",avoidReset:!0}});const Sk=i.defineComponent({__name:"app",props:{options:{}},setup(e){const t=e,n=Te(),r=Nt(),o=i.computed(()=>r.activeScene),a=i.computed(()=>n.alerts),s=Je(),c=i.computed(()=>({transform:`scale(${s.gameScaleRatio}, ${s.gameScaleRatio})`,width:`${s.gameWidth}px`,height:`${s.actualGameHeight}px`})),d=i.computed(()=>ht().activeMenu?"app-blurred-by-modal":{});function u(l){Te().closeAlert(l)}function h(){Je().refreshScreenSize()}return i.onMounted(async()=>{Ie.callHook("onAppMounted"),await bk(),s.inputsContainer.addEventListener("resize",so(()=>{h()},100,{maxWait:200})),qt.setup(t.options.debug),setTimeout(()=>{h()},50)}),(l,f)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createElementVNode("div",{id:"narrat",style:i.normalizeStyle(c.value)},[i.createElementVNode("div",{id:"narrat-app",class:i.normalizeClass(d.value),tabindex:"0"},[i.createVNode(i.Transition,{name:"screens-fade"},{default:i.withCtx(()=>[(i.openBlock(),i.createBlock(vk,{key:o.value,sceneId:o.value,options:i.unref(r).currentOptions},null,8,["sceneId","options"]))]),_:1}),l.options.debug?(i.openBlock(),i.createBlock(ik,{key:0})):i.createCommentVNode("",!0),i.createVNode(ck),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,m=>(i.openBlock(),i.createBlock(dk,{key:m.id,title:m.title,text:m.text,onClose:()=>u(m.id)},null,8,["title","text","onClose"]))),128))],2)],4),i.createVNode(hk)],64))}}),wk=new V("add_level",[{name:"skillKey",type:"string"},{name:"amount",type:"number"}],async e=>{let{skillKey:t,amount:n}=e.options;if((!t||!n)&&se(e,"add_level command needs a skill id and a value as parameters"),!Number.isInteger(n)){const r=n;n=Math.round(n),console.warn(`add_level expects a level to be an integer. Auto Rounding ${r} to ${n}`)}Xe().incrementSkill(t,n)}),kk=V.FromOptions({keyword:"set_level",argTypes:[{name:"skill",type:"string"},{name:"level",type:"number"}],runner:async e=>{let{skill:t,level:n}=e.options;if((!t||!n)&&se(e,"set_level command needs a skill id and a value as parameters"),!Number.isInteger(n)){const r=n;n=Math.round(n),console.warn(`set_level expects a level to be an integer. Auto Rounding ${r} to ${n}`)}Xe().setSkillLevel(t,n)}}),Ck=new V("add_xp",[{name:"xpKey",type:"string"},{name:"xpToAdd",type:"number"}],async e=>{const{xpKey:t,xpToAdd:n}=e.options;(!t||!n)&&se(e,"add_xp command needs a skill id and a value as parameters"),Xe().addXp(t,n)}),$k=new V("get_level",[{name:"skillKey",type:"string"}],async e=>{const{skillKey:t}=e.options;t||se(e,"get_level command needs a skill id as parameter");const n=Xe().getSkill(t);return n||se(e,`Skill ${t} not found`),n.level}),Ek=new V("get_xp",[{name:"xpKey",type:"string"}],async e=>{const{xpKey:t}=e.options;t||se(e,"get_xp command needs a skill id as parameter");const n=Xe().getSkillXp(t);return n||se(e,`XP ${t} not found`),n}),Ok=new V("roll",[{name:"id",type:"string"},{name:"skill",type:"string",optional:!0},{name:"difficulty",type:"number",optional:!0},{name:"mode",type:"string",optional:!0}],async e=>{const{id:t}=e.options;let n={id:t};if(e.args.length===1&&Of(t))n={...Ef(t),id:t};else{const{skill:o,difficulty:a,mode:s}=e.options;if(!o||!a){se(e,"roll command needs a skill and a difficulty as parameters, or the skill check id to be configured in skillChecks.yaml");return}n={skill:o,difficulty:a,id:t},s==="hideAfterRoll"&&(n.hideAfterRoll=!0),s==="repeatable"&&(n.repeatable=!0)}return Vc(n).succeeded}),Ak=new V("get_skill_check",[{name:"skillCheckId",type:"string"}],async e=>Xe().getSkillCheck(e.options.skillCheckId)),Ik=new V("skill_check_result",[{name:"skillCheckId",type:"string"}],async e=>Xe().getSkillCheck(e.options.skillCheckId).succeeded),Nk=new V("reset_roll",[{name:"id",type:"string"}],async e=>Xe().resetSkillCheck(e.options.id)),Pk=new V("add_stat",[{name:"statKey",type:"string"},{name:"amountToAdd",type:"number"}],async e=>{const{statKey:t,amountToAdd:n}=e.options;(!t||typeof n!="number")&&se(e,"add_stat command needs a stat id and a value as parameters"),Pt().addStat(t,n)}),jk=new V("set_stat",[{name:"statKey",type:"string"},{name:"value",type:"number"}],async e=>{const{statKey:t,value:n}=e.options;(!t||typeof n!="number")&&se(e,"set_stat command needs a stat id and a value as parameters"),Pt().setStat(t,n)}),xk=new V("get_stat_value",[{name:"statKey",type:"string"}],async e=>{const{statKey:t}=e.options;return t||se(e,"get_stat_value command needs a stat id as parameter"),Pt().getStatValue(t)}),Dk=new V("show_hud",[],async e=>{Pt().setVisibility(!0)}),Lk=new V("hide_hud",[],async e=>{Pt().setVisibility(!1)}),Mk=V.FromOptions({keyword:"jump",argTypes:"any",runner:async e=>{(e.args.length<1||typeof e.args[0]!="string")&&se(e,"requires a label argument");const t=e.args[0],n=ve(),r={branchData:Ie.script[t],label:t,args:e.args.splice(1),currentIndex:0};if(!Ie.script[t]){ae(`Trying to jump but label ${t} not found`);return}return n.jumpTarget=r,Fo}}),Bk=V.FromOptions({keyword:"run",argTypes:"any",runner:async e=>{(e.args.length<1||typeof e.args[0]!="string")&&se(e,"run command needs a label to argument run");const t=e.args[0];return await ve().runLabelFunction(t,...e.args.slice(1))}}),Rk=V.FromOptions({keyword:"var",argTypes:[{name:"name",type:"string"},{name:"value",type:"any"}],runner:async e=>{const{name:t,value:n}=e.options;ve().addScopedVariable(t,n)}}),Fk=V.FromOptions({keyword:"return",argTypes:[{name:"value",type:"any"}],runner:async e=>{const{value:t}=e.options;return ve().setReturnValue(t),ns}}),Vk=V.FromOptions({keyword:"log",argTypes:"any",runner:async e=>{RS(e,...e.args)}}),Uk=V.FromOptions({keyword:"menu_return",argTypes:[],runner:async e=>(ed(),Vo)}),qk=V.FromOptions({keyword:"save",argTypes:[{name:"name",type:"string",optional:!0}],runner:async e=>{await fd({saveName:e.options.name})}}),Hk=V.FromOptions({keyword:"save_prompt",argTypes:[{name:"name",type:"string",optional:!0}],runner:async e=>{await fd({saveName:e.options.name,withPrompt:!0})}}),Kk=V.FromOptions({keyword:"reset_global_save",argTypes:[],runner:async e=>{await dd()}}),Gk=V.FromOptions({keyword:"new",argTypes:[{name:"name",type:"string"},{name:"rest",type:"rest",optional:!0}],runner:async e=>{const t=e.options.name;if(t==="Array")return[...e.args.slice(1)];if(t==="Object")return{}}}),zk=[{name:"mode",type:"string"},{name:"audio",type:"string"},{name:"channel",type:"number",optional:!0}],Wk=new V("play",zk,async e=>{const t=ft(),{mode:n,audio:r,channel:o}=e.options,a=Li(e,n);a&&t.playChannel(a,r,o??0)}),Qk=new V("resume",[{name:"mode",type:"string"},{name:"channel",type:"number",optional:!0}],async e=>{const t=ft(),{mode:n,channel:r}=e.options,o=Li(e,n);o&&t.resumeChannel(o,r??0)}),Yk=new V("pause",[{name:"mode",type:"string"},{name:"channel",type:"number",optional:!0}],async e=>{const t=ft(),{mode:n,channel:r}=e.options,o=Li(e,n);o&&t.pauseChannel(o,r??0)}),Jk=new V("stop",[{name:"mode",type:"string"},{name:"channel",type:"number",optional:!0}],async e=>{const t=ft(),{mode:n,channel:r}=e.options,o=Li(e,n);o&&t.stopChannel(o,r??0)});function Li(e,t){return Xk(t)?t:(se(e,`${t} is not a valid audio mode.`),!1)}function Xk(e){return!!jl.includes(e)}const Zk=new V("set",[{name:"key",type:"string"},{name:"value",type:"any"}],async e=>{const t=Br();Nf(t,`$${e.options.key}`,e.options.value)}),eC=new V("add",[{name:"key",type:"string"},{name:"value",type:"any"}],async e=>{const t=Br();Pf(t,`$${e.options.key}`,e.options.value)}),tC=new V("set_screen",[{name:"screen",type:"string"},{name:"layer",type:"number",optional:!0},{name:"transitionName",type:"string",optional:!0},{name:"transitionDuration",type:"number",optional:!0},{name:"transitionDelay",type:"number",optional:!0}],async e=>{const t=Ut();if(!Lr(e.options.screen)){se(e,`Screen ${e.options.screen} doesn't exist in the config`);return}return e.options.transitionName?t.transitionScreen(e.options.screen,{transition:e.options.transitionName,duration:e.options.transitionDuration,delay:e.options.transitionDelay},e.options.layer):t.setScreen(e.options.screen,e.options.layer??0)}),nC=new V("empty_layer",[{name:"layer",type:"number"},{name:"transitionName",type:"string",optional:!0},{name:"transitionDuration",type:"number",optional:!0},{name:"transitionDelay",type:"number",optional:!0}],async e=>{const t=Ut();return e.options.transitionName?t.emptyLayer(e.options.layer,{transition:e.options.transitionName,duration:e.options.transitionDuration,delay:e.options.transitionDelay}):t.emptyLayer(e.options.layer)}),rC=new V("set_button",[{name:"buttonId",type:"string"},{name:"state",type:"any"}],async e=>{const{buttonId:t,state:n}=e.options,r=Ut();if(!Un(t)){se(e,`Button ${t} doesn't exist in the config`);return}r.changeButton(t,n)});class On extends V{static async ManageAutoAdvance(t){console.log("not interactive"),await ve().waitForEndTextAnimation(),console.log("text animation ended"),await kt(t.options.delay||0),console.log("delay ended"),t.options.autoAdvance?(console.log("player answered"),bd(0)):(console.log("make dialog interactive"),Fe().makeLastDialogInteractive())}static ShouldBeInteractive(t){return!t.options.delay&&!t.options.autoAdvance}}const nl=[{name:"speaker",type:"string"},{name:"pose",type:"string"},{name:"text",type:"string"},{name:"delay",type:"number",optional:!0},{name:"autoAdvance",type:"boolean",optional:!0}],oC=On.FromOptions({keyword:"talk",argTypes:nl,runner:async(e,t)=>{const n=On.ShouldBeInteractive(e);await Ho({speaker:e.options.speaker,pose:e.options.pose,cssClass:"talk-command",text:`"${e.options.text}"`,choices:t,interactive:n}),n||On.ManageAutoAdvance(e)},returnAfterPlayerAnswer:!0}),iC=On.FromOptions({keyword:"think",argTypes:nl,runner:async(e,t)=>{const n=On.ShouldBeInteractive(e);await Ho({speaker:e.options.speaker,pose:e.options.pose,cssClass:"think-command",text:`${e.options.text}`,choices:t,interactive:n}),n||On.ManageAutoAdvance(e)},returnAfterPlayerAnswer:!0}),sC=On.FromOptions({keyword:"narrate",argTypes:nl.slice(2,5),runner:async(e,t)=>{const n=On.ShouldBeInteractive(e);await Ho({speaker:st().gameCharacter,cssClass:"text-command",text:`${e.options.text}`,choices:t,interactive:n}),n||On.ManageAutoAdvance(e)},returnAfterPlayerAnswer:!0}),aC=()=>{const e=Dr("text",[]);return(t,n)=>{console.log(n);const r=e(t,n);return n.command.staticOptions={text:n.code.substring(1,n.code.length-1)},r}},lC=V.FromOptions({keyword:"text",argTypes:[],runner:async(e,t)=>{await Ho({speaker:st().gameCharacter,cssClass:"text-command",text:e.staticOptions.text,choices:t,interactive:!0})},parser:aC(),returnAfterPlayerAnswer:!0}),cC=new V("add_item",[{name:"id",type:"string"},{name:"amount",type:"number"}],async e=>{const{id:t,amount:n}=e.options;mt().add({id:t,amount:n})}),uC=new V("remove_item",[{name:"id",type:"string"},{name:"amount",type:"number"}],async e=>{const{id:t,amount:n}=e.options;mt().remove({id:t,amount:n})}),dC=new V("has_item?",[{name:"id",type:"string"},{name:"amount",type:"number",optional:!0}],async e=>{const{id:t,amount:n}=e.options;return mt().hasItem(t,n)}),fC=new V("item_amount?",[{name:"id",type:"string"}],async e=>{const{id:t}=e.options;return mt().getItemAmount(t)}),pC=new V("enable_interaction",[{name:"tag",type:"string"}],async e=>{const t=e.options.tag;mt().enableInteraction(t)}),mC=new V("disable_interaction",[{name:"tag",type:"string"}],async e=>{const t=e.options.tag;mt().disableInteraction(t)}),hC=new V("start_quest",[{name:"questId",type:"string"}],async e=>{const t=e.options.questId;dt().startQuest(t)}),yC=new V("start_objective",[{name:"questId",type:"string"},{name:"objectiveId",type:"string"}],async e=>{const{questId:t,objectiveId:n}=e.options;dt().startObjective(t,n)}),gC=new V("complete_objective",[{name:"questId",type:"string"},{name:"objectiveId",type:"string"}],async e=>{const{questId:t,objectiveId:n}=e.options;dt().completeObjective(t,n)}),_C=new V("complete_quest",[{name:"questId",type:"string"},{name:"ending",type:"any",optional:!0}],async e=>{const{questId:t,ending:n}=e.options;dt().completeQuest(t,n)}),bC=new V("quest_completed?",[{name:"questId",type:"string"}],async e=>{const{questId:t}=e.options;return dt().isQuestCompleted(t)}),TC=new V("quest_succeeded?",[{name:"questId",type:"string"}],async e=>{const{questId:t}=e.options;return dt().isQuestSucceeded(t)}),vC=new V("quest_failed?",[{name:"questId",type:"string"}],async e=>{const{questId:t}=e.options;return dt().isQuestFailed(t)}),SC=new V("quest_ending?",[{name:"questId",type:"string"}],async e=>{const{questId:t}=e.options;return dt().getQuestEnding(t)}),wC=new V("quest_has_ending?",[{name:"questId",type:"string"},{name:"ending",type:"string"}],async e=>{const{questId:t,ending:n}=e.options;return dt().questHasEnding(t,n)}),kC=new V("objective_completed?",[{name:"questId",type:"string"},{name:"objectiveId",type:"string"}],async e=>{const{questId:t,objectiveId:n}=e.options;return dt().isObjectiveCompleted(t,n)}),CC=new V("quest_started?",[{name:"questId",type:"string"}],async e=>{const{questId:t}=e.options;return dt().isQuestStarted(t)}),$C=new V("objective_started?",[{name:"questId",type:"string"},{name:"objectiveId",type:"string"}],async e=>{const{questId:t,objectiveId:n}=e.options;return dt().isObjectiveStarted(t,n)}),EC=V.FromOptions({keyword:"wait",argTypes:[{name:"duration",type:"number"}],runner:async e=>{await kt(e.options.duration)}}),OC=new V("notify",[{name:"text",type:"string"},{name:"description",type:"string",optional:!0},{name:"icon",type:"string",optional:!0}],async e=>{const{text:t,icon:n,description:r}=e.options;vt().addNotification(t,r,n)}),AC=new V("disable_notifications",[],async e=>{vt().disableNotifications()}),IC=new V("enable_notifications",[],async e=>{vt().enableNotifications()}),NC=new V("clear_dialog",[],async e=>{Fe().clearDialog()}),PC=new V("if",[{name:"condition",type:"boolean"}],async e=>{const t=[];for(const o of e.staticOptions.elseifs){const a=o.condition,s=await ni(a);t.push(s)}const n=Ah(e,t),r=ve();if(n){const o={branchData:{branch:n},currentIndex:0};return r.addAndRunBlock(o)}},(e,t)=>{let n=e.currentLine;Dr("if",[{name:"condition",type:"string"}])(e,t);const{lines:o,currentLine:a,line:s}=e,c=t.command;let d,u=a,h=!1;const l=[];for(;!h;){u++;const f=Ih(o,u);if(f&&f.code.startsWith("elseif")){const m=f.expression;if(!Array.isArray(m)){e.parserContext.error(f.line,"Expected an expression after elseif"),h=!0;break}if(m.length>2){e.parserContext.error(f.line,"Expected only one argument after elseif"),h=!0;break}l.push({branch:e.processCommandsFunction(e.parserContext,f.branch,s),condition:Bs(e.parserContext,f,m[1])})}else f&&f.code==="else:"?d=e.processCommandsFunction(e.parserContext,f.branch,s):(h=!0,u--)}return c.staticOptions={success:e.processCommandsFunction(e.parserContext,s.branch,s),elseifs:l,failure:d},u++,n=u,{newLine:n}}),jC=new V("==","any",async e=>{e.args.length<1&&se(e,"requires at least 1 arguments");let t=e.args[0],n=!0;for(const r of e.args)if(r!=t){n=!1;break}else t=r;return n}),xC=new V(">",[{name:"a",type:"any"},{name:"b",type:"any"}],async e=>{const{a:t,b:n}=e.options;return t>n}),DC=new V("<",[{name:"a",type:"any"},{name:"b",type:"any"}],async e=>{const{a:t,b:n}=e.options;return t<n}),LC=new V(">=",[{name:"a",type:"any"},{name:"b",type:"any"}],async e=>{const{a:t,b:n}=e.options;return t>=n}),MC=new V("<=",[{name:"a",type:"any"},{name:"b",type:"any"}],async e=>{const{a:t,b:n}=e.options;return t<=n}),BC=new V("!=",[{name:"a",type:"any"},{name:"b",type:"any"}],async e=>{const{a:t,b:n}=e.options;return t!=n}),RC=new V("!",[{name:"a",type:"any"}],async e=>{const{a:t}=e.options;return!t}),FC=new V("&&","any",async e=>{const t=e.args;return e.args.length<2&&se(e,"requires at least two arguments"),t.reduce((n,r)=>n&&r,!0)}),VC=new V("||","any",async e=>(e.args.length<2&&se(e,"requires at least two arguments"),e.args.reduce((t,n)=>t||n,!1))),UC=new V("?",[{name:"a",type:"any"},{name:"b",type:"any"},{name:"c",type:"any"}],async e=>{const{a:t,b:n,c:r}=e.options;return t?n:r}),qC=new V("+","any",async e=>(e.args.length<2&&se(e,"requires at least two arguments"),e.args.reduce((t,n)=>typeof n=="number"?t+n:(se(e,"requires all arguments to be numbers"),t),0))),HC=new V("-","any",async e=>(e.args.length<2&&se(e,"requires at least two arguments"),e.args.slice(1).reduce((t,n)=>typeof n=="number"?t-n:(se(e,"requires all arguments to be numbers"),t),e.args[0]))),KC=new V("neg",[{name:"a",type:"number"}],async e=>(e.args.length!==1&&se(e,"requires one argument"),-e.options.a)),GC=new V("abs",[{name:"a",type:"number"}],async e=>(e.args.length!==1&&se(e,"requires one argument"),Math.abs(e.options.a))),zC=new V("*","any",async e=>(e.args.length<2&&se(e,"requires at least two arguments"),e.args.reduce((t,n)=>typeof n=="number"?t*n:(se(e,"requires all arguments to be numbers"),t),1))),WC=new V("/","any",async e=>{e.args.length<2&&se(e,"requires at least two arguments");const t=e.args[0]/e.args[1];return e.args.slice(2).reduce((n,r)=>typeof r=="number"?n/r:(se(e,"requires all arguments to be numbers"),n),t)}),QC=async e=>{const{prompt:t,choices:n}=e.staticOptions,r=[];for(const[,s]of n.entries()){const c=await ni(s.prompt);r.push(c)}e.options.choiceResults=r;const o=r.map((s,c)=>{var f;let d=!0;s.skillCheck&&(d=((f=s.skillCheck)==null?void 0:f.allowed)??!1);const u=tl().hasSeenChoice(t.code,n[c].prompt.code);return{flag:s.flag,seenBefore:u,choice:s.text,originalIndex:c,allowed:d}}).filter(s=>s.choice),a=await _d(t,o);return await ZC(e,a)};function YC(e,t){t.branch||e.parserContext.error(t.line,`Choice option doesn't have any branch to go to (${t.code} - ${t.line})`);let n,r;const o=t.branch;return t.expression[1]==="roll"||t.expression[2]==="roll"?((!o[0].branch||!o[1].branch)&&e.parserContext.error(t.line,`Choice option with a skill roll needs success and failure branches (${t.code} - ${t.line})`),n={success:e.processCommandsFunction(e.parserContext,o[0].branch,t),failure:e.processCommandsFunction(e.parserContext,o[1].branch,t)}):r=e.processCommandsFunction(e.parserContext,o,t),{prompt:e.processCommandsFunction(e.parserContext,[t],t)[0],branch:r,skillBranches:n}}const JC=(e,t)=>{let n=e.currentLine;Dr("choice",[]);const{line:r}=e,o=t.command;(!r.branch||r.branch.length<2)&&e.parserContext.error(r.line,"Choice menu needs to have at least one option");const a=r.branch[0];a||e.parserContext.error(e.line.line,"Choice prompt is missing ");const c=r.branch.slice(1).map((d,u)=>(d.branch||e.parserContext.error(d.line,`Choice option doesn't have any branch to go to (${d.code})`),d=e$(e.parserContext,d),YC(e,d)));return o.staticOptions={prompt:e.processCommandsFunction(e.parserContext,[a],r)[0],choices:c},n++,{newLine:n}},XC=V.FromOptions({keyword:"choice",argTypes:[],runner:QC,parser:JC}),ZC=async(e,t)=>{const n=t,r=ve(),{choices:o}=e.staticOptions,a=o[n],s=e.options.choiceResults[n],c=e.staticOptions.prompt;tl().trackChoice(c.code,a.prompt.code);let d=s.text,u;if(s.skillCheck?(d=null,Vc(s.skillCheck.options).succeeded?u=a.skillBranches.success:u=a.skillBranches.failure):u=a.branch,d){const h={speaker:st().playerCharacter,text:d,interactive:!1};Fe().addDialog(h)}if(u){const h={currentIndex:0,branchData:{branch:u}};return await r.addAndRunBlock(h)}};function e$(e,t){return{code:`choicePrompt ${t.code}`,indentation:t.indentation,line:t.line,branch:t.branch,expression:["choicePrompt",...t.expression]}}const t$=new V("choicePrompt","any",async e=>{const t=e.args;return t.length===1?n$(t[0]):t.length===2?r$(t):t.length>2?t[0]==="roll"||t[1]==="roll"?i$(e,t):o$(e,t):(se(e,"Invalid choice prompt line"),{text:t[0]})});function n$(e){return{text:e}}function r$(e){return{text:e[1],flag:e[0]}}function o$(e,t){const n=t[1]==="if"?1:2;if(t[n]!=="if")return se(e,"Invalid choice prompt line"),{text:t[0]};const r=n===2;let o=r?t[1]:t[0],a=!0;t.length>n+1&&(a=t[n+1]),a||(o=null);const s={text:o};return r&&(s.flag=t[0]),s}function i$(e,t){const n=t[0]==="roll"?0:1,r=n===1,o=n,a=t[o+1];let s={},c=o+2;Of(a)?s={...Ef(a),id:a}:(s={id:a,skill:t[o+2],difficulty:t[o+3]},c=o+4);const d=t[c];c++;let u=!1,h=!1,l;t.length>c&&(t[c]==="if"?(h=!0,t.length<c+2&&se(e,'Missing condition argument after "if" in choice with a skill check'),l=t[c+1]):(u=t[c],t.length>c+1&&(c++,t[c]==="if"?(h=!0,t.length<c+2&&se(e,'Missing condition argument after "if" in choice with a skill check'),l=t[c+1]):se(e,`Invalid argument after skill check mode: ${t[c]}. The next argument can only be an if condition.`)))),u==="hideAfterRoll"&&(s.hideAfterRoll=!0),u==="repeatable"&&(s.repeatable=!0);const f=Xe().getSkillCheck(a);if(f.hidden||h&&!l)return{text:null};const m=!f.happened||f.happened&&f.succeeded||s.repeatable,{difficultyText:y}=ym({skill:s.skill,skillCheckId:a,value:s.difficulty}),S={text:`${y} ${d}`,skillCheck:{allowed:m,options:s}};return r&&(S.flag=t[0]),S}const zf=V.FromOptions({keyword:"text_field",argTypes:[{name:"prompt",type:"string"}],returnAfterPlayerAnswer:!0,runner:async e=>{const t={speaker:st().gameCharacter,text:e.options.prompt,textField:!0,interactive:!0};Fe().addDialog(t)}});zf.onPlayerAnswered=async(e,t)=>(typeof t!="string"&&se(e,"The player's answer should be a string"),t);const s$=V.FromOptions({keyword:"text_field_prompt",argTypes:[{name:"prompt",type:"string"}],runner:async e=>{const t={speaker:st().gameCharacter,text:e.options.prompt,textField:!0,interactive:!0};Fe().addDialog(t)}}),a$=new V("random",[{name:"a",type:"number"},{name:"b",type:"number"}],async e=>{const{a:t,b:n}=e.options;return typeof t!="number"||typeof n!="number"?(se(e,"random command needs two numbers as parameters"),0):Math.floor(Math.random()*(n-t+1))+t}),l$=new V("random_float",[{name:"a",type:"number"},{name:"b",type:"number"}],async e=>{const{a:t,b:n}=e.options;return typeof t!="number"||typeof n!="number"?(se(e,"random_float command needs two numbers as parameters"),0):Math.random()*(n-t)+t}),c$=new V("random_from_args",[],async e=>{const t=e.args;return!t||!t.length?(se(e,"random_from_args command needs at least one argument"),0):t[Math.floor(Math.random()*t.length)]}),u$=new V("random_from_array",[{name:"a",type:"any"}],async e=>{const{a:t}=e.options;return Array.isArray(t)?t[Math.floor(Math.random()*t.length)]:(se(e,"random_from_array command needs an array as parameter"),0)}),d$=new V("concat","any",async e=>(e.args.length<2&&se(e,"requires at least two arguments"),e.args.reduce((t,n)=>typeof n=="string"?`${t}${n}`:(se(e,"requires all arguments to be strings"),t),""))),f$=new V("join","any",async e=>{const t=e.args[0];return e.args.length<3&&se(e,"requires at least 3 arguments"),e.args.slice(1).reduce((n,r)=>typeof r=="string"?`${n}${t}${r}`:(se(e,"requires all arguments to be strings"),n),"")}),p$=V.FromOptions({keyword:"min",argTypes:[{name:"min",type:"number"},{name:"value",type:"number"}],runner:async e=>{const{min:t,value:n}=e.options;return n<t?n:t}}),m$=V.FromOptions({keyword:"max",argTypes:[{name:"max",type:"number"},{name:"value",type:"number"}],runner:async e=>{const{max:t,value:n}=e.options;return n>t?n:t}}),h$=V.FromOptions({keyword:"clamp",argTypes:[{name:"min",type:"number"},{name:"max",type:"number"},{name:"value",type:"number"}],runner:async e=>{const{min:t,max:n,value:r}=e.options;return r<t?t:r>n?n:r}}),y$=V.FromOptions({keyword:"floor",argTypes:[{name:"value",type:"number"}],runner:async e=>{const{value:t}=e.options;return Math.floor(t)}}),g$=V.FromOptions({keyword:"ceil",argTypes:[{name:"value",type:"number"}],runner:async e=>{const{value:t}=e.options;return Math.ceil(t)}}),_$=V.FromOptions({keyword:"round",argTypes:[{name:"value",type:"number"}],runner:async e=>{const{value:t}=e.options;return Math.round(t)}}),b$=V.FromOptions({keyword:"sqrt",argTypes:[{name:"value",type:"number"}],runner:async e=>{const{value:t}=e.options;return Math.sqrt(t)}}),T$=V.FromOptions({keyword:"^",argTypes:[{name:"base",type:"number"},{name:"exponent",type:"number"}],runner:async e=>{const{base:t,exponent:n}=e.options;return Math.pow(t,n)}}),v$=new V("create_sprite",[{name:"image",type:"string"},{name:"x",type:"number"},{name:"y",type:"number"},{name:"parent",type:"any",optional:!0}],async e=>{const t=Dt(),{x:n,y:r,image:o,parent:a}=e.options,s={x:n,y:r,image:o};return typeof a=="object"&&(s.parent=a),typeof a=="string"&&(s.parent=Dt().getObject(a)),t.createSprite(s)}),S$=new V("create_object",[{name:"x",type:"number"},{name:"y",type:"number"},{name:"parent",type:"any",optional:!0}],async e=>{const t=Dt(),{x:n,y:r,parent:o}=e.options,a={x:n,y:r};return typeof o=="object"&&(a.parent=o),typeof o=="string"&&(a.parent=Dt().getObject(o)),t.createObject(a)}),w$=new V("delete_sprite",[{name:"sprite",type:"any"}],async e=>Dt().destroyObject(e.options.sprite)),k$=V.FromOptions({keyword:"empty_sprites",argTypes:[{name:"layer",type:"number",optional:!0}],runner:async e=>{const t=Dt(),{layer:n}=e.options;return typeof n=="number"?t.emptyLayer(n):t.emptyAllLayers()}}),C$=V.FromOptions({keyword:"shuffle",argTypes:[{name:"array",type:"any"}],runner:async e=>{const t=e.options.array;if(!Array.isArray(t)){se(e,"requires an array argument");return}return H$(t),t}}),$$=V.FromOptions({keyword:"push",argTypes:[{name:"array",type:"any"},{name:"value",type:"any"}],runner:async e=>{const{array:t,value:n}=e.options;if(!Array.isArray(t)){se(e,"requires an array argument");return}return t.push(n),t}}),E$=V.FromOptions({keyword:"pop",argTypes:[{name:"array",type:"any"}],runner:async e=>{const{array:t}=e.options;if(!Array.isArray(t)){se(e,"requires an array argument");return}return t.pop()}}),O$=V.FromOptions({keyword:"shift",argTypes:[{name:"array",type:"any"}],runner:async e=>{const{array:t}=e.options;if(!Array.isArray(t)){se(e,"requires an array argument");return}return t.shift()}}),A$=V.FromOptions({keyword:"unshift",argTypes:[{name:"array",type:"any"},{name:"value",type:"any"}],runner:async e=>{const{array:t,value:n}=e.options;if(!Array.isArray(t)){se(e,"requires an array argument");return}return t.unshift(n),t}}),I$=V.FromOptions({keyword:"array_join",argTypes:[{name:"array",type:"any"},{name:"separator",type:"string",optional:!0}],runner:async e=>{const{array:t,separator:n}=e.options;if(!Array.isArray(t)){se(e,"requires an array argument");return}if(typeof n<"u"&&typeof n!="string"){se(e,"array join string separator must be a string");return}return t.join(n),t}}),N$=V.FromOptions({keyword:"array_concat",argTypes:[{name:"array",type:"any"},{name:"rest",type:"rest",optional:!0}],runner:async e=>{const{array:t}=e.options,n=e.args;if(!Array.isArray(t)){se(e,"requires an array argument");return}for(const r of n)if(!Array.isArray(r)){se(e,"All concat arguments should be arrays");return}return t.concat(...n.slice(1))}}),P$=V.FromOptions({keyword:"includes",argTypes:[{name:"array",type:"any"},{name:"searchElement",type:"string"}],runner:async e=>{const{array:t,searchElement:n}=e.options;return Array.isArray(t)||se(e,"requires an array argument"),typeof n>"u"&&se(e,"requires a search element argument"),t.includes(n)}}),j$=V.FromOptions({keyword:"reverse",argTypes:[{name:"array",type:"any"}],runner:async e=>{const{array:t}=e.options;return Array.isArray(t)||se(e,"requires an array argument"),t.reverse(),t}}),x$=V.FromOptions({keyword:"slice",argTypes:[{name:"array",type:"any"},{name:"start",type:"number"},{name:"end",type:"number",optional:!0}],runner:async e=>{const{array:t,start:n,end:r}=e.options;return Array.isArray(t)||se(e,"requires an array argument"),typeof n!="number"&&se(e,"requires a start index argument"),typeof r<"u"&&typeof r!="number"&&se(e,"end index argument must be a number if present"),t.slice(n,r)}}),D$=V.FromOptions({keyword:"splice",argTypes:[{name:"array",type:"any"},{name:"start",type:"number"},{name:"end",type:"number",optional:!0}],runner:async e=>{const{array:t,start:n,end:r}=e.options;return Array.isArray(t)||se(e,"requires an array argument"),typeof n!="number"&&se(e,"requires a start index argument"),typeof r<"u"&&typeof r!="number"&&se(e,"end index argument must be a number if present"),t.splice(n,r)}}),L$=V.FromOptions({keyword:"array_find_index",argTypes:[{name:"array",type:"any"},{name:"predicateLabel",type:"string"},{name:"rest",type:"rest",optional:!0}],runner:async e=>{const{array:t,predicateLabel:n}=e.options;Array.isArray(t)||se(e,"requires an array argument");for(const[r,o]of t.entries())if(await ve().runLabelFunction(n,o,r,t,...e.args.slice(2))===!0)return r;return-1}}),M$=V.FromOptions({keyword:"array_find",argTypes:[{name:"array",type:"any"},{name:"predicateLabel",type:"string"},{name:"rest",type:"rest",optional:!0}],runner:async e=>{const{array:t,predicateLabel:n}=e.options;Array.isArray(t)||se(e,"requires an array argument");for(const[r,o]of t.entries())if(await ve().runLabelFunction(n,o,r,t,...e.args.slice(2))===!0)return o;return null}}),B$=V.FromOptions({keyword:"array_filter",argTypes:[{name:"array",type:"any"},{name:"predicateLabel",type:"string"},{name:"rest",type:"rest",optional:!0}],runner:async e=>{const{array:t,predicateLabel:n}=e.options;Array.isArray(t)||se(e,"requires an array argument");const r=[];for(const[o,a]of t.entries())await ve().runLabelFunction(n,a,o,t,...e.args.slice(2))===!0&&r.push(a);return r}}),R$=V.FromOptions({keyword:"array_map",argTypes:[{name:"array",type:"any"},{name:"mapperLabel",type:"string"},{name:"rest",type:"rest",optional:!0}],runner:async e=>{const{array:t,mapperLabel:n}=e.options;Array.isArray(t)||se(e,"requires an array argument");const r=[];for(const[o,a]of t.entries()){const s=await ve().runLabelFunction(n,a,o,t,...e.args.slice(2));r.push(s)}return r}}),F$=V.FromOptions({keyword:"array_reduce",argTypes:[{name:"array",type:"any"},{name:"reducerLabel",type:"string"},{name:"initValue",type:"any"},{name:"rest",type:"rest",optional:!0}],runner:async e=>{const{array:t,reducerLabel:n,initValue:r}=e.options;Array.isArray(t)||se(e,"requires an array argument");let o=r;for(const[a,s]of t.entries())o=await ve().runLabelFunction(n,o,s,a,t,...e.args.slice(3));return o}}),V$=V.FromOptions({keyword:"array_some",argTypes:[{name:"array",type:"any"},{name:"predicateLabel",type:"string"},{name:"rest",type:"rest",optional:!0}],runner:async e=>{const{array:t,predicateLabel:n}=e.options;Array.isArray(t)||se(e,"requires an array argument");for(const[r,o]of t.entries())if(await ve().runLabelFunction(n,o,r,t,...e.args.slice(2))===!0)return!0;return!1}}),U$=V.FromOptions({keyword:"array_every",argTypes:[{name:"array",type:"any"},{name:"predicateLabel",type:"string"},{name:"rest",type:"rest",optional:!0}],runner:async e=>{const{array:t,predicateLabel:n}=e.options;Array.isArray(t)||se(e,"requires an array argument");for(const[r,o]of t.entries())if(await ve().runLabelFunction(n,o,r,t,...e.args.slice(2))!==!0)return!1;return!0}}),q$=V.FromOptions({keyword:"array_entries",argTypes:[{name:"array",type:"any"}],runner:async e=>{const{array:t}=e.options;return Array.isArray(t)||se(e,"requires an array argument"),t.entries()}});function H$(e){for(let t=e.length-1;t>0;t--){const n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}}const Fr={keyframes:{"narrat-screenshake":[{transform:"translateX(0)"},{transform:"translateX(5px)"},{transform:"translateX(-5px)"},{transform:"translateX(5px)"},{transform:"translateX(0)"}]},animations:{"narrat-screenshake":{keyframes:"narrat-screenshake",options:{duration:150,iterations:3}}}};function K$(e){return typeof e=="string"?document.querySelector(e):e}function G$(e){if(typeof e=="string"){const t=Cf();t.keyframes[e]?e=t.keyframes[e]:Fr.keyframes[e]?e=Fr.keyframes[e]:(ae(`[Animation] Animation not found: ${e}`),e=Fr.keyframes["narrat-screenshake"])}return e}function z$(e){let t;if(typeof e=="string"){const n=Cf();n.animations[e]?t=n.animations[e]:Fr.animations[e]?t=Fr.animations[e]:(ae(`[Animation] Animation not found: ${e}`),t=Fr.animations["narrat-screenshake"])}else t=e;return W$(t)}function W$(e){return{keyframes:[...G$(e.keyframes)],options:{...e.options}}}async function Wf(e,t,n){return new Promise(r=>{const o=K$(e);o||(ae(`[Animation] Element not found: ${e}`),r({}));const a=z$(t);n&&Object.assign(a.options,n),o.animate(a.keyframes,a.options).addEventListener("finish",r)})}const Q$=V.FromOptions({keyword:"load_data",argTypes:[{name:"url",type:"string"}],runner:async e=>{const{url:t}=e.options;return await oo(Ni(t))}}),Y$=V.FromOptions({keyword:"change_player_character",argTypes:[{name:"character",type:"string"}],runner:async e=>{const{character:t}=e.options;st().config.characters.config.playerCharacter=t}}),J$=V.FromOptions({keyword:"change_game_character",argTypes:[{name:"character",type:"string"}],runner:async e=>{const{character:t}=e.options;st().config.characters.config.gameCharacter=t}}),X$=V.FromOptions({keyword:"json_stringify",argTypes:[{name:"value",type:"any"}],runner:async e=>{const{value:t}=e.options;return JSON.stringify(t)}}),Z$=V.FromOptions({keyword:"json_parse",argTypes:[{name:"value",type:"string"}],runner:async e=>{const{value:t}=e.options;return JSON.parse(t)}}),e1=V.FromOptions({keyword:"set_dialog_panel_mode",argTypes:[{name:"mode",type:"string"}],runner:async e=>{const{mode:t}=e.options;Je().dialogPanelMode=t}}),Qf=[{name:"element",type:"string"},{name:"animation",type:"string"},{name:"duration",optional:!0,type:"number"},{name:"iterations",optional:!0,type:"number"}];function Yf(e){const{element:t,animation:n,duration:r,iterations:o}=e.options,a={};return o&&(a.iterations=o),r&&(a.duration=r),a}const t1=V.FromOptions({keyword:"animate",argTypes:Qf,runner:async e=>{const{element:t,animation:n}=e.options,r=Yf(e);Wf(t,n,r)}}),n1=V.FromOptions({keyword:"animate_wait",argTypes:Qf,runner:async e=>{const{element:t,animation:n}=e.options;await Wf(t,n,Yf(e))}}),r1=V.FromOptions({keyword:"time_now",argTypes:[],runner:async e=>Date.now()}),o1=V.FromOptions({keyword:"total_playtime",argTypes:[],runner:async e=>Te().totalPlayTime}),i1=V.FromOptions({keyword:"session_playtime",argTypes:[],runner:async e=>Te().sessionPlayTime}),s1=V.FromOptions({keyword:"to_days",argTypes:[{name:"time",type:"number"}],runner:async e=>Math.floor(e.options.time/864e5)}),a1=V.FromOptions({keyword:"to_hours",argTypes:[{name:"time",type:"number"}],runner:async e=>Math.floor(e.options.time/36e5)}),l1=V.FromOptions({keyword:"to_minutes",argTypes:[{name:"time",type:"number"}],runner:async e=>Math.floor(e.options.time/6e4)}),c1=V.FromOptions({keyword:"to_seconds",argTypes:[{name:"time",type:"number"}],runner:async e=>Math.floor(e.options.time/1e3)}),u1=new V("unlock_achievement",[{name:"id",type:"string"}],async e=>{const{id:t}=e.options;cr().unlock(t)}),d1=new V("has_achievement?",[{name:"id",type:"string"}],async e=>{const{id:t}=e.options;return cr().hasAchievement(t)}),f1=V.FromOptions({keyword:"get_setting",argTypes:[{name:"setting",type:"string"}],runner:async e=>{const{setting:t}=e.options;return t||se(e,"get_setting command needs a setting id"),sn().getSetting(t)}}),p1=V.FromOptions({keyword:"set_setting",argTypes:[{name:"setting",type:"string"},{name:"value",type:"any"}],runner:async e=>{const{setting:t,value:n}=e.options;t||se(e,"set_setting command needs a setting id"),sn().setSetting(t,n)}}),m1=V.FromOptions({keyword:"object_entries",argTypes:[{name:"obj",type:"any"}],runner:async e=>{const t=e.options.obj;return typeof t!="object"?(se(e,"Requires an object argument."),[]):Object.entries(t)}}),h1=V.FromOptions({keyword:"object_keys",argTypes:[{name:"obj",type:"any"}],runner:async e=>{const t=e.options.obj;return typeof t!="object"?(se(e,"Requires an object argument."),[]):Object.keys(t)}}),y1=V.FromOptions({keyword:"object_values",argTypes:[{name:"obj",type:"any"}],runner:async e=>{const t=e.options.obj;return typeof t!="object"?(se(e,"Requires an object argument."),[]):Object.values(t)}}),g1=V.FromOptions({keyword:"object_has",argTypes:[{name:"obj",type:"any"},{name:"key",type:"string"}],runner:async e=>{const{obj:t,key:n}=e.options;return typeof t!="object"?(se(e,"Requires an object argument."),!1):Object.hasOwn(t,n)}}),_1=V.FromOptions({keyword:"for_of",argTypes:[{name:"target",type:"any"},{name:"predicateLabel",type:"string"},{name:"rest",type:"rest",optional:!0}],runner:async e=>{const{target:t,predicateLabel:n}=e.options;if(typeof t!="object")return se(e,"Requires an object argument."),!1;for(const r of t)await ve().runLabelFunction(n,r,...e.args.slice(2))}}),b1=V.FromOptions({keyword:"for_in",argTypes:[{name:"target",type:"any"},{name:"predicateLabel",type:"string"},{name:"rest",type:"rest",optional:!0}],runner:async e=>{const{target:t,predicateLabel:n}=e.options;if(typeof t!="object")return se(e,"Requires an object argument."),!1;for(const r in t)await ve().runLabelFunction(n,r,t[r],...e.args.slice(2))}}),T1=V.FromOptions({keyword:"change_scene",argTypes:[{name:"scene",type:"string"},{name:"rest",type:"rest",optional:!0}],runner:async e=>{const{scene:t}=e.options;await Nt().changeScene(t,v1(e.args.slice(1)))}});function v1(e){const t={};let n=0;for(;n<e.length&&!(n+1>=e.length);){const r=e[n],o=e[n+1];t[r]=o,n+=2}return t}function S1(e){e.addCommand(XC),e.addCommand(t$),e.addCommand(PC),e.addCommand(Pk),e.addCommand(jk),e.addCommand(xk),e.addCommand(Dk),e.addCommand(Lk),e.addCommand(NC),e.addCommand(OC),e.addCommand(AC),e.addCommand(IC),e.addCommand(Yk),e.addCommand(Wk),e.addCommand(Qk),e.addCommand(Jk),e.addCommand(rC),e.addCommand(tC),e.addCommand(nC),e.addCommand(v$),e.addCommand(S$),e.addCommand(w$),e.addCommand(k$),e.addCommand(EC),e.addCommand(jC),e.addCommand(xC),e.addCommand(DC),e.addCommand(LC),e.addCommand(MC),e.addCommand(BC),e.addCommand(RC),e.addCommand(FC),e.addCommand(VC),e.addCommand(UC),e.addCommand(qC),e.addCommand(HC),e.addCommand(zC),e.addCommand(WC),e.addCommand(KC),e.addCommand(GC),e.addCommand(eC),e.addCommand(Zk),e.addCommand(lC),e.addCommand(oC),e.addCommand(iC),e.addCommand(sC),e.addCommand(Mk),e.addCommand(Bk),e.addCommand(Rk),e.addCommand(Fk),e.addCommand(Vk),e.addCommand(Uk),e.addCommand(qk),e.addCommand(Kk),e.addCommand(Hk),e.addCommand(Gk),e.addCommand(hC),e.addCommand(yC),e.addCommand(gC),e.addCommand(_C),e.addCommand(CC),e.addCommand($C),e.addCommand(bC),e.addCommand(TC),e.addCommand(vC),e.addCommand(SC),e.addCommand(wC),e.addCommand(kC),e.addCommand(cC),e.addCommand(uC),e.addCommand(pC),e.addCommand(mC),e.addCommand(dC),e.addCommand(fC),e.addCommand(wk),e.addCommand(kk),e.addCommand(Ck),e.addCommand(Ok),e.addCommand(Nk),e.addCommand(Ak),e.addCommand(Ik),e.addCommand($k),e.addCommand(Ek),e.addCommand(zf),e.addCommand(s$),e.addCommand(a$),e.addCommand(l$),e.addCommand(c$),e.addCommand(u$),e.addCommand(d$),e.addCommand(f$),e.addCommand(p$),e.addCommand(m$),e.addCommand(h$),e.addCommand(y$),e.addCommand(_$),e.addCommand(g$),e.addCommand(b$),e.addCommand(T$),e.addCommand(C$),e.addCommand($$),e.addCommand(E$),e.addCommand(O$),e.addCommand(A$),e.addCommand(I$),e.addCommand(N$),e.addCommand(P$),e.addCommand(j$),e.addCommand(x$),e.addCommand(D$),e.addCommand(L$),e.addCommand(M$),e.addCommand(B$),e.addCommand(R$),e.addCommand(F$),e.addCommand(V$),e.addCommand(U$),e.addCommand(q$),e.addCommand(h1),e.addCommand(y1),e.addCommand(m1),e.addCommand(g1),e.addCommand(_1),e.addCommand(b1),e.addCommand(Q$),e.addCommand(Y$),e.addCommand(J$),e.addCommand(X$),e.addCommand(Z$),e.addCommand(e1),e.addCommand(t1),e.addCommand(n1),e.addCommand(r1),e.addCommand(o1),e.addCommand(i1),e.addCommand(s1),e.addCommand(a1),e.addCommand(l1),e.addCommand(c1),e.addCommand(u1),e.addCommand(d1),e.addCommand(p1),e.addCommand(f1),e.addCommand(FS),e.addCommand(T1)}const w1=i.defineComponent({data(){return{muted:!1,volumes:[],modeNames:{master:"Master volume:",music:"Music:",ambiant:"Ambiant:",sound:"Sound effects:"}}},mounted(){const e=ft(),t=rn.Howler.volume();this.volumes.push({mode:"master",volume:t}),e.modes.forEach((n,r)=>{this.volumes.push({mode:r,volume:e.modes.get(r).options.volume})})},methods:{changeVolume(e,t){const n=t.target;e==="master"?ft().setMasterVolume(n.value):ft().setModeVolume(e,n.value)},toggleMute(){this.muted?(rn.Howler.mute(!1),this.muted=!1):(rn.Howler.mute(!0),this.muted=!0)}}}),k1={class:"volume-controls"},C1=i.createElementVNode("h3",{class:"nrt-subtitle"},"Volume",-1),$1={for:"volume",class:"volume-label"},E1=["onUpdate:modelValue","onChange"];function O1(e,t,n,r,o,a){return i.openBlock(),i.createElementBlock("div",k1,[C1,(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.volumes,(s,c)=>(i.openBlock(),i.createElementBlock("div",{class:"volume-control",key:s.mode},[i.createElementVNode("label",$1,i.toDisplayString(e.modeNames[s.mode]),1),i.withDirectives(i.createElementVNode("input",{ref_for:!0,ref:"slider",class:"volume-slider",type:"range",id:"volume",name:"volume",min:"0",max:"1",step:"0.1","onUpdate:modelValue":d=>e.volumes[c].volume=d,onChange:d=>e.changeVolume(s.mode,d)},null,40,E1),[[i.vModelText,e.volumes[c].volume]])]))),128))])}const A1=zt(w1,[["render",O1]]),I1={class:"settings-widget-container"},N1=["for","id"],P1=["id","name","min","max","step"],j1=["id","name"],x1=["id","name"],D1={class:"mx-8"},L1={class:"text-left setting-description"},M1=i.createElementVNode("hr",{class:"h-px my-8 bg-gray-200 border-0 dark:bg-gray-700 setting-separator"},null,-1),B1=i.defineComponent({__name:"setting-widget",props:{settingId:{}},setup(e){const t=e,n=sn(),r=i.computed(()=>n.getSetting(t.settingId)),o=i.ref(r.value),a=i.computed(()=>n.getSettingSchema(t.settingId));function s(c){let d=c;Ul(a.value)&&(d=Math.round(d)),n.setSetting(t.settingId,d)}return i.watch(o,c=>{s(c)}),(c,d)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createElementVNode("div",I1,[i.createElementVNode("label",{for:c.settingId,class:"setting-label",id:`setting-label-${c.settingId}`},i.toDisplayString(a.value.name),9,N1),i.unref(xm)(a.value)||i.unref(Ul)(a.value)?i.withDirectives((i.openBlock(),i.createElementBlock("input",{key:0,ref:"slider",class:"number-slider setting-slider",type:"range",id:`setting-slider-${c.settingId}`,name:c.settingId,min:a.value.minValue,max:a.value.maxValue,step:a.value.step,"onUpdate:modelValue":d[0]||(d[0]=u=>o.value=u)},null,8,P1)),[[i.vModelText,o.value]]):i.unref(Dm)(a.value)?i.withDirectives((i.openBlock(),i.createElementBlock("input",{key:1,type:"checkbox",class:"setting-checkbox",id:`setting-checkbox-${c.settingId}`,name:c.settingId,"onUpdate:modelValue":d[1]||(d[1]=u=>o.value=u)},null,8,j1)),[[i.vModelCheckbox,o.value]]):i.unref(Lm)(a.value)?i.withDirectives((i.openBlock(),i.createElementBlock("input",{key:2,type:"text",class:"setting-text",id:`setting-text-${c.settingId}`,name:c.settingId,"onUpdate:modelValue":d[2]||(d[2]=u=>o.value=u)},null,8,x1)),[[i.vModelText,o.value]]):i.createCommentVNode("",!0),i.createElementVNode("span",D1,i.toDisplayString(o.value),1)]),i.createElementVNode("p",L1,i.toDisplayString(a.value.description),1),M1],64))}}),R1={class:"container mx-auto settings-menu-container"},F1=i.createElementVNode("h2",{class:"settings-menu-title subtitle text-center"},"Settings",-1),V1=i.defineComponent({__name:"settings-menu",setup(e){const t=sn(),n=i.computed(()=>t.getAllSettingSchemas());return(r,o)=>(i.openBlock(),i.createElementBlock("div",R1,[F1,(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.value,(a,s)=>(i.openBlock(),i.createBlock(B1,{settingId:s,key:s},null,8,["settingId"]))),128))]))}}),U1={class:"menu-content"},q1=i.defineComponent({__name:"MainMenu",props:{inputListener:{}},emits:["close"],setup(e,{emit:t}){const n=e,r=t,o=i.ref(null),a=i.ref(null);function s(){window.close()}function c(){ed(),d()}function d(){r("close")}function u(){const h=hr(Te().playTime.start,Te().playTime.previousPlaytime);return Ui(h/1e3)}return i.onMounted(()=>{a.value=Sn({mode:"list",container:o,listener:n.inputListener,onChosen:h=>{h===0?c():h===1&&s()}}),a.value.mount()}),i.onUnmounted(()=>{a.value&&(a.value.disable(),a.value=null)}),(h,l)=>(i.openBlock(),i.createElementBlock("div",U1,[i.createElementVNode("h3",null,"Play time: "+i.toDisplayString(u()),1),i.createVNode(A1),i.createElementVNode("div",{ref_key:"mainActions",ref:o},[i.createElementVNode("button",{class:"nrt-button nrt-title quit-button",onClick:c}," Main Menu "),i.createElementVNode("button",{class:"nrt-button nrt-title quit-button",onClick:s}," Exit ")],512),i.createVNode(V1)]))}}),H1={class:"sub-tabs-controller"},K1={key:0,class:"sub-tabs-controller__tabs"},G1={key:1,class:"sub-tab-content"},z1={key:2},W1=[i.createElementVNode("div",{class:"sub-tab-content__empty"},[i.createElementVNode("p",null,"No tab selected")],-1)],Q1=i.defineComponent({__name:"SubTabController",props:{tabs:{},defaultTab:{},inputListener:{}},emits:["tab-change","close"],setup(e,{emit:t}){const n=t,r=e,o=i.ref(r.defaultTab);function a(c){o.value=c,n("tab-change",c)}const s=i.computed(()=>r.tabs[o.value]);return i.onMounted(()=>{r.inputListener.actions.subPreviousTab={press:()=>{o.value>0&&a(o.value-1)}},r.inputListener.actions.subNextTab={press:()=>{o.value<r.tabs.length-1&&a(o.value+1)}}}),i.onUnmounted(()=>{delete r.inputListener.actions.subPreviousTab,delete r.inputListener.actions.subNextTab}),(c,d)=>(i.openBlock(),i.createElementBlock("div",H1,[c.tabs.length>1?(i.openBlock(),i.createElementBlock("div",K1,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.tabs,(u,h)=>(i.openBlock(),i.createBlock(id,{key:u.id,tab:u,active:h===o.value,onClick:()=>a(h)},null,8,["tab","active","onClick"]))),128))])):i.createCommentVNode("",!0),s.value?(i.openBlock(),i.createElementBlock("div",G1,[s.value?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(s.value.component),i.mergeProps({key:s.value.id,inputListener:c.inputListener},s.value.extraProps,{onClose:d[0]||(d[0]=u=>c.$emit("close"))}),null,16,["inputListener"])):i.createCommentVNode("",!0)])):(i.openBlock(),i.createElementBlock("div",z1,W1))]))}}),Y1=["onClick"],J1={class:"item-title"},X1={class:"item-amount"},Z1=i.defineComponent({__name:"inventory-section",props:{items:{},title:{},id:{},inputListener:{}},emits:["chosen"],setup(e,{emit:t}){const n=e,r=i.ref(null),o=i.ref(null),a=t;function s(u){a("chosen",u)}function c(u){return{backgroundImage:`url(${Et(en(u).icon)})`}}function d(u){return en(u).name}return i.onMounted(()=>{o.value=Sn({mode:"grid",listener:n.inputListener,columns:3,container:r,onChosen:u=>{s(n.items[u].id)}}),o.value.mount()}),i.onUnmounted(()=>{o.value&&(o.value.disable(),o.value=null)}),(u,h)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["inventory-section",`section-${n.id}`])},[i.createElementVNode("h3",null,i.toDisplayString(u.title),1),i.createElementVNode("div",{class:"inventory-section-items",ref_key:"itemsContainer",ref:r},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(u.items,l=>(i.openBlock(),i.createElementBlock("button",{onClick:()=>s(l.id),class:i.normalizeClass(["item-display",`item-${l.id}`]),style:i.normalizeStyle(c(l.id)),key:l.id},[i.createElementVNode("h3",J1,i.toDisplayString(d(l.id)),1),i.createElementVNode("h3",X1,i.toDisplayString(l.amount),1)],14,Y1))),128))],512)],2))}}),eE={class:"flex flex-row item-description-container"},tE={class:"flex item-left"},nE={class:"flex item-right"},rE=i.createElementVNode("hr",{class:"hr-solid"},null,-1),oE=i.defineComponent({__name:"item-details",props:{item:{}},emits:["use","close"],setup(e,{emit:t}){const n=e,r=i.ref(null),o=i.computed(()=>en(n.item.id)),a=i.computed(()=>({backgroundImage:`url(${Et(o.value.icon)})`})),s=t,c=i.computed(()=>mt().canUseItem(n.item));function d(){c.value&&s("use")}function u(){s("close")}return i.onMounted(()=>{r.value=Ke().registerInputListener("item-details",{continue:{press:()=>{c.value&&d()}},cancel:{press:()=>{u()}}})}),i.onUnmounted(()=>{r.value&&(Ke().unregisterInputListener(r.value),r.value=null)}),(h,l)=>(i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",eE,[i.createElementVNode("div",tE,[i.createElementVNode("div",{class:"item-display",style:i.normalizeStyle(a.value)},null,4)]),i.createElementVNode("div",nE,[i.createElementVNode("h2",null,i.toDisplayString(o.value.name),1),rE,i.createElementVNode("h3",null,"Amount: "+i.toDisplayString(h.item.amount),1),i.createElementVNode("p",null,i.toDisplayString(o.value.description),1),i.createElementVNode("button",{onClick:d,class:i.normalizeClass(["nrt-button",c.value?"":"nrt-disabled"])}," Use ",2)])]),i.createElementVNode("button",{class:"nrt-button",onClick:u},i.toDisplayString("<--"))]))}}),iE={key:0},sE={key:2},aE=[i.createElementVNode("h2",null,"The inventory is empty!",-1)],lE=i.defineComponent({__name:"inventory-ui",props:{section:{},inputListener:{}},emits:["close"],setup(e,{emit:t}){const n=mt(),r=i.computed(()=>n.items),o=i.ref(!1),a=i.computed(()=>o.value?r.value[o.value]:null);function s(){ht().closeMenu()}function c(h){o.value=h}function d(){o.value=!1}function u(){n.useItem(a.value)&&s()}return(h,l)=>!a.value&&h.section.items.length>0?(i.openBlock(),i.createElementBlock("div",iE,[i.createVNode(Z1,{items:h.section.items,title:h.section.title,inputListener:h.inputListener,id:h.section.id,onChosen:c},null,8,["items","title","inputListener","id"])])):typeof o.value=="string"?(i.openBlock(),i.createBlock(oE,{key:1,item:r.value[o.value],onUse:u,onClose:d},null,8,["item"])):(i.openBlock(),i.createElementBlock("div",sE,aE))}}),cE=i.defineComponent({__name:"InventoryTab",props:{inputListener:{}},setup(e){const t=mt(),n=i.computed(()=>t.items),r=i.computed(()=>Object.values(n.value).filter(s=>s.amount>0?!0:!!en(s.id).showIfEmpty)),o=i.computed(()=>{const s=Ve().items.categories,c=[];if(s.length>1){const d={id:"all",title:"All",items:r.value};c.push(d)}for(const d in s){const u=s[d],h=u.id,l=r.value.filter(f=>en(f.id).category===h);c.push({id:h,title:u.title,items:l})}return c}),a=i.computed(()=>{const s=[];return o.value.forEach(c=>{s.push({id:c.id,label:c.title,component:lE,extraProps:{section:c}})}),s});return(s,c)=>(i.openBlock(),i.createElementBlock("div",null,[i.createVNode(Q1,{tabs:a.value,defaultTab:0,inputListener:s.inputListener},null,8,["tabs","inputListener"])]))}}),uE=["id"],dE={class:"obtained-status"},fE={class:"achievement-title"},pE={class:"achievement-description"},mE=i.defineComponent({__name:"achievement-tile",props:{achievement:{}},setup(e){const t=e,n=cr(),r=i.computed(()=>n.getExistingAchievement(t.achievement)),o=i.computed(()=>Ha(t.achievement)),a=ko().secretAchievements??{censorName:!0,censorDescription:!0},s=i.computed(()=>{let h=r.value.unlocked?o.value.icon:o.value.lockedIcon;return h||(h=ko().defaultAchievementIcon),{backgroundImage:`url(${Et(h)})`}}),c=i.computed(()=>!o.value.secret||!a.censorName?o.value.name:"Hidden Achievement"),d=i.computed(()=>!o.value.secret||!a.censorDescription?o.value.description:"This achievement is hidden. Complete it to discover more."),u=i.computed(()=>r.value.unlocked?`Obtained ${new Date(r.value.unlockTime).toLocaleDateString()}`:"Not obtained yet");return(h,l)=>(i.openBlock(),i.createElementBlock("div",{class:"achievement-display nrt-tile",id:`achievement-${h.achievement}`},[i.createElementVNode("div",{class:"achievement-icon",style:i.normalizeStyle(s.value)},null,4),i.createElementVNode("p",dE,i.toDisplayString(u.value),1),i.createElementVNode("h3",fE,i.toDisplayString(c.value),1),i.createElementVNode("p",pE,i.toDisplayString(d.value),1)],8,uE))}}),hE={class:"achievements-section-achievements"},yE=i.defineComponent({__name:"achievements-section",props:{achievements:{},title:{},id:{}},setup(e){const t=e;return(n,r)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["achievements-section",`section-${t.id}`])},[i.createElementVNode("h3",null,i.toDisplayString(n.title),1),i.createElementVNode("div",hE,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.achievements,o=>(i.openBlock(),i.createBlock(mE,{achievement:o.id,key:o.id},null,8,["achievement"]))),128))])],2))}}),gE=i.defineComponent({setup(){const e=cr(),t=Fe(),n=i.computed(()=>e.achievements),r=i.computed(()=>t.currentDialog.choices);return{achievements:n,currentlyChoosing:r}},emits:["close"],data(){return{chosenId:!1}},mounted(){},methods:{close(){this.$emit("close")},clickAchievement(e){this.chosenId=e},closeAchievement(){this.chosenId=!1}},computed:{achievementsToDisplay(){return Object.values(this.achievements)},chosenAchievement(){return this.chosenId?this.achievements[this.chosenId]:null},chosenAchievementConf(){return this.chosenId?this.achievementConf[this.chosenId]:null},achievementConf(){return Ve().achievements.achievements},sections(){const e=Ve().achievements.categories,t=[];return this.achievementsToDisplay.reduce((r,o)=>{const a=Ha(o.id).category??"default",s=e.find(d=>d.id===a);if(!s)return ae(`Unknown category ${a}`),r;let c=r.find(d=>d.id===a);return c||(c={id:a,title:s.title,achievements:[]},r.push(c)),c.achievements.push(o),r},t)}},components:{AchievementsSection:yE}}),_E={key:0},bE={key:1},TE=[i.createElementVNode("h2",null,"The achievements section is empty!",-1)];function vE(e,t,n,r,o,a){const s=i.resolveComponent("AchievementsSection");return Object.keys(e.achievementsToDisplay).length>0?(i.openBlock(),i.createElementBlock("div",_E,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.sections,c=>(i.openBlock(),i.createBlock(s,{key:c.id,achievements:c.achievements,title:c.title,id:c.id,onChosen:e.clickAchievement},null,8,["achievements","title","id","onChosen"]))),128))])):(i.openBlock(),i.createElementBlock("div",bE,TE))}const SE=zt(gE,[["render",vE]]),wE={class:"quest-display"},kE={class:"quest-title"},CE={class:"quest-description"},$E={key:0,class:"quest-objectives-container list-disc"},EE=i.defineComponent({__name:"QuestDetails",props:{quest:{}},setup(e){const t=e,n=i.computed(()=>$n(t.quest.id));function r(c){return Co(t.quest.id,c)}const o=i.computed(()=>{switch(t.quest.state){case"hidden":return" Hidden";case"unlocked":return"";case"completed":return" (Completed)";default:return" Unknown"}}),a=i.computed(()=>t.quest.ending?Af(t.quest.id,t.quest.ending).description:t.quest.succeeded&&n.value.succeededDescription?n.value.succeededDescription:!t.quest.succeeded&&n.value.failedDescription?n.value.failedDescription:n.value.description),s=i.computed(()=>Object.values(t.quest.objectives).filter(c=>c.state!=="hidden"));return(c,d)=>(i.openBlock(),i.createElementBlock("div",wE,[i.createElementVNode("div",{class:i.normalizeClass(["quest-header",c.quest.state==="completed"?"quest-completed":"quest-in-progress"])},[i.createElementVNode("h3",kE,i.toDisplayString(n.value.title)+" "+i.toDisplayString(o.value),1)],2),i.createElementVNode("p",CE,i.toDisplayString(a.value),1),c.quest.state!=="completed"?(i.openBlock(),i.createElementBlock("ul",$E,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,u=>(i.openBlock(),i.createElementBlock("li",{class:"quest-objective-display",key:u.id},[i.createElementVNode("p",{class:i.normalizeClass(["quest-objective-description",u.state==="completed"?"quest-objective-completed":"quest-objctive-in-progress"])},i.toDisplayString(r(u.id).description),3)]))),128))])):i.createCommentVNode("",!0)]))}}),OE={class:"quest-list-title"},AE=i.defineComponent({__name:"QuestDisplay",props:{quest:{}},setup(e){const t=e,n=i.computed(()=>$n(t.quest.id));return(r,o)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["quest-list-display",r.quest.state==="completed"?"quest-list-completed":"quest-list-in-progress"])},[i.createElementVNode("p",OE,i.toDisplayString(n.value.title),1)],2))}}),IE={key:0},NE={key:0},PE={key:1},jE=i.defineComponent({__name:"quests-list-section",props:{quests:{},sectionId:{},title:{},fallbackText:{}},emits:["quest-selected"],setup(e,{emit:t}){const n=e,r=i.computed(()=>wo().categories),o=i.computed(()=>{const a=[];return n.quests.reduce((c,d)=>{const u=$n(d.id).category??"default",h=r.value.find(f=>f.id===u);if(!h)return ae(`Quest category ${u} not found in config`),c;let l=c.find(f=>f.category.id===u);return l||(l={category:h,quests:[]},c.push(l)),l.quests.push(d),c},a)});return(a,s)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass([`${a.sectionId}-quests-container`,"quests-section"])},[i.createElementVNode("h3",null,i.toDisplayString(a.title),1),a.quests.length>0?(i.openBlock(),i.createElementBlock("div",IE,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,c=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass([`${a.sectionId}-${c.category.id}-category`,"quests-category"]),key:c.category.id},[r.value.length>1?(i.openBlock(),i.createElementBlock("h4",NE,i.toDisplayString(c.category.title),1)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(`${a.sectionId}-${c.category.id}-quests`)},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.quests,d=>(i.openBlock(),i.createBlock(AE,{key:d.id,quest:d,onClick:u=>a.$emit("quest-selected",d)},null,8,["quest","onClick"]))),128))],2)],2))),128))])):(i.openBlock(),i.createElementBlock("div",PE,[i.createElementVNode("p",null,i.toDisplayString(a.fallbackText),1)]))],2))}}),xE=i.defineComponent({setup(){const e=dt(),t=i.computed(()=>e.quests),n=i.ref(null);return{quests:t,selectedQuest:n}},computed:{questsToDisplay(){return Object.values(this.quests).filter(e=>e.state!=="hidden")},activeQuests(){return this.questsToDisplay.filter(e=>e.state==="unlocked")},completedQuests(){return this.questsToDisplay.filter(e=>e.state==="completed")},questsUiClass(){return Je().layoutMode==="horizontal"?"quests-ui-horizontal":"quests-ui-vertical"}},mounted(){this.activeQuests.length>0?this.selectedQuest=this.activeQuests[0]:this.completedQuests.length>0&&(this.selectedQuest=this.completedQuests[0])},methods:{clickOnQuest(e){this.selectedQuest=e}},components:{QuestDetails:EE,QuestsListSection:jE}}),DE={class:"quests-list-container"},LE={class:"quest-details"};function ME(e,t,n,r,o,a){const s=i.resolveComponent("QuestsListSection"),c=i.resolveComponent("QuestDetails");return i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["quests-ui",e.questsUiClass])},[i.createElementVNode("div",DE,[i.createVNode(s,{quests:e.activeQuests,sectionId:"active",title:"Active Quests",fallbackText:"No active quests",onQuestSelected:e.clickOnQuest},null,8,["quests","onQuestSelected"]),i.createVNode(s,{quests:e.completedQuests,sectionId:"completed",title:"Completed Quests",fallbackText:"No completed quests",onQuestSelected:e.clickOnQuest},null,8,["quests","onQuestSelected"])]),i.createElementVNode("div",LE,[e.selectedQuest?(i.openBlock(),i.createBlock(c,{key:0,quest:e.selectedQuest},null,8,["quest"])):i.createCommentVNode("",!0)])],2)}const BE=zt(xE,[["render",ME]]);function Jf(e){const t=Xe(),n=i.computed(()=>t.skills),r=i.computed(()=>n.value[e]),o=i.computed(()=>dn().skills),a=i.computed(()=>dn().skillOptions.xpPerLevel),s=i.computed(()=>({backgroundImage:`url(${Et(o.value[e].icon)})`})),c=i.computed(()=>o.value[e].name),d=i.computed(()=>o.value[e].description),u=i.computed(()=>`Level ${n.value[e].level}`);return{skills:n,skillsStore:t,skillConfig:o,xpPerLevel:a,skillState:r,skillStyle:s,skillName:c,skillDescription:d,skillLevelText:u}}const RE=e=>(i.pushScopeId("data-v-a94cb74f"),e=e(),i.popScopeId(),e),FE=["id"],VE={class:"flex flex-row skill-description-container"},UE={class:"flex skill-left"},qE={class:"flex skill-right"},HE=RE(()=>i.createElementVNode("hr",{class:"hr-solid"},null,-1)),KE=["innerHTML"],GE=zt(i.defineComponent({__name:"SkillDetails",props:{chosenSkill:{},inputListener:{}},emits:["cancel"],setup(e,{emit:t}){const n=e,r=t,o=i.ref(null),a=i.ref(null);function s(){r("cancel")}const{skillStyle:c,skillName:d,skillDescription:u,skillLevelText:h}=Jf(n.chosenSkill);return i.onMounted(()=>{o.value=Sn({mode:"list",listener:n.inputListener,container:a,onChosen:()=>{s()}}),o.value.mount()}),i.onUnmounted(()=>{o.value&&(o.value.disable(),o.value=null)}),(l,f)=>(i.openBlock(),i.createElementBlock("div",{id:`skill-display-${l.chosenSkill}`},[i.createElementVNode("div",VE,[i.createElementVNode("div",UE,[i.createElementVNode("div",{class:"skill-display",style:i.normalizeStyle(i.unref(c))},null,4)]),i.createElementVNode("div",qE,[i.createElementVNode("h2",null,i.toDisplayString(i.unref(d)),1),HE,i.createElementVNode("h3",null,i.toDisplayString(i.unref(h)),1),i.createElementVNode("p",{innerHTML:i.unref(u)},null,8,KE)])]),i.createElementVNode("div",{ref_key:"buttonsContainer",ref:a},[i.createElementVNode("button",{class:"nrt-button",onClick:s},i.toDisplayString("<--"))],512)],8,FE))}}),[["__scopeId","data-v-a94cb74f"]]),zE={class:"skill-title"},WE={class:"skill-xp-container"},QE={class:"skill-xp-text"},YE={class:"skill-level"},JE=zt(i.defineComponent({__name:"SkillGridElement",props:{chosenSkill:{},inputListener:{}},emits:["choose"],setup(e,{expose:t,emit:n}){const r=e,o=i.ref(null);t({gridElement:o});const a=n;function s(){a("choose")}const{skillStyle:c,skillName:d,skillState:u,xpPerLevel:h}=Jf(r.chosenSkill),l=i.computed(()=>({width:`${Math.floor(u.value.xp/h.value*100)}%`}));return(f,m)=>(i.openBlock(),i.createElementBlock("button",{onClick:s,class:"skill-grid-element",style:i.normalizeStyle(i.unref(c)),ref_key:"gridElement",ref:o},[i.createElementVNode("h3",zE,i.toDisplayString(i.unref(d)),1),i.createElementVNode("div",WE,[i.createElementVNode("div",{class:"skill-xp-bar",style:i.normalizeStyle(l.value)},null,4),i.createElementVNode("h3",QE,i.toDisplayString(i.unref(u).xp)+" / "+i.toDisplayString(i.unref(h))+" XP",1)]),i.createElementVNode("h3",YE,i.toDisplayString(i.unref(u).level),1)],4))}}),[["__scopeId","data-v-8d457bf9"]]),XE={class:"skills-container"},ZE=zt(i.defineComponent({__name:"SkillsGrid",props:{inputListener:{},lastChosenSkill:{type:[String,Boolean]}},emits:["choose"],setup(e,{emit:t}){const n=e,r=i.ref([]),o=i.computed(()=>r.value.map(f=>f.gridElement)),a=Xe(),s=i.computed(()=>a.skills),c=i.ref(null),d=t;function u(f){d("choose",f)}const h=i.computed(()=>dn().skills),l=i.computed(()=>{const f={};for(const m in s.value)h.value[m].hidden&&s.value[m].level<1||(f[m]=s.value[m]);return Object.values(f)});return i.onMounted(()=>{var f;if(c.value=Sn({mode:"grid",listener:n.inputListener,elements:o,columns:3,onChosen:m=>{u(l.value[m].id)}}),(f=c.value)==null||f.mount(),typeof n.lastChosenSkill=="string"){const m=l.value.findIndex(y=>y.id===n.lastChosenSkill);m>=0&&c.value.select(m)}}),i.onUnmounted(()=>{c.value&&c.value.disable()}),(f,m)=>(i.openBlock(),i.createElementBlock("div",XE,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.value,y=>(i.openBlock(),i.createBlock(JE,{ref_for:!0,ref_key:"skillGridElements",ref:r,key:y.id,onChoose:()=>u(y.id),chosenSkill:y.id,inputListener:f.inputListener},null,8,["onChoose","chosenSkill","inputListener"]))),128))]))}}),[["__scopeId","data-v-31202bb8"]]),eO=i.defineComponent({__name:"SkillsWindow",props:{inputListener:{}},setup(e){const t=i.ref(!1),n=i.ref(!1);function r(a){n.value=a,t.value=a}function o(){t.value=!1}return(a,s)=>t.value?typeof t.value=="string"?(i.openBlock(),i.createBlock(GE,{key:1,chosenSkill:t.value,inputListener:a.inputListener,onCancel:o},null,8,["chosenSkill","inputListener"])):i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(ZE,{key:0,inputListener:a.inputListener,lastChosenSkill:n.value,onChoose:r},null,8,["inputListener","lastChosenSkill"]))}});function tO(e){e.component("MainMenu",q1),e.component("InventoryTab",cE),e.component("AchievementsUI",SE),e.component("QuestsUi",BE),e.component("SkillsWindow",eO),ht().menus={system:{label:"System",cssClass:"system-menu",id:"system",tabs:[{id:"system-tab",cssId:"system-tab",text:"System",component:"MainMenu"}],activeTab:0},menu:{label:"Menu",id:"menu",cssClass:"menu-menu",tabs:[{id:"skills",cssId:"skills-menu-button",text:"Skills",condition:()=>ht().showSkills,component:"SkillsWindow"},{id:"inventory",cssId:"inventory-menu-button",text:"Items",condition:()=>ht().showInventory,component:"InventoryTab"},{id:"quests",cssId:"quests-menu-button",text:"Quests",condition:()=>ht().showQuests,component:"QuestsUi"},{id:"achievements",cssId:"achievements-menu-button",text:"Achievements",condition:()=>ht().showAchievements,component:"AchievementsUI"}],activeTab:0}}}function rl(e,t,n){const r=window.narrat.app;for(const o in t.tabs){const a=t.tabs[o].component;r.component(a,n[a])}ht().addMenu(e,t)}function nO(e,t,n){window.narrat.app.component(t.component,n),ht().addMenuOption(e,t)}function rO(){for(const e of Ie.plugins){if(e.customMenuButtons)for(const t of e.customMenuButtons)rl(t.config.id,t.config,t.components);if(e.customMenuTabs)for(const t of e.customMenuTabs)nO(t.config.id,t.config,t.component)}}function oO(e){e.directive("visible",{mounted(t,n){n.value?t.style.visibility="visible":t.style.visibility="hidden"},updated(t,n){n.value?t.style.visibility="visible":t.style.visibility="hidden"}})}class Mi{constructor(){De(this,"pluginId","narrat-plugin")}onPageLoaded(){}onNarratSetup(){}onAppMounted(){}onAssetsLoaded(){}onGameSetup(){}onGameStart(){}onGameMounted(){}onGameDismounted(){}}function Xf(e){Ie.addPlugin(e)}function Zf(e){Ie.addCommand(e)}const iO={args:[],canvasResizePolicy:0,executable:"",experimentalVK:!1,fileSizes:{"index.pck":54160,"index.wasm":52315256},focusCanvas:!1,gdextensionLibs:[]};function sO(){window.godotReady=!0,window.narratReadyCallback&&window.narratReadyCallback(),console.log("godot ready")}window.godotReadyCallback=sO;class ep extends Mi{constructor(n){super();De(this,"customCommands",[]);De(this,"canvas");De(this,"app");De(this,"messageQueue",[]);De(this,"narrat");De(this,"narratReady",!1);De(this,"engineConfig");De(this,"engine");const r={...iO,...n.engineConfigOverrides??{}};n.godotGamePath&&(r.executable=n.godotGamePath),this.engineConfig=r,this.customCommands=[V.FromOptions({keyword:"godot_pause",argTypes:[],runner:async o=>{this.addMessageForGodot({type:"pause",payload:{}})}}),V.FromOptions({keyword:"godot_resume",argTypes:[],runner:async o=>{this.addMessageForGodot({type:"resume",payload:{}})}})]}onAppMounted(){const n=document.querySelector("#narrat");if(!n){console.error("no app");return}this.narrat=window.narrat;const r=document.createElement("canvas");this.app=n,this.canvas=r,r.id="godot-canvas",r.style.position="absolute",r.style.zIndex="0",n.appendChild(r),window.addEventListener("keydown",a=>{if(a.fakeEvent)return;const s=new KeyboardEvent(a.type,a);s.fakeEvent=!0,this.canvas.dispatchEvent(s)}),window.addEventListener("keyup",a=>{if(a.fakeEvent)return;const s=new KeyboardEvent(a.type,a);s.fakeEvent=!0,this.canvas.dispatchEvent(s)}),new window.Engine(this.engineConfig).startGame(),this.resizeCanvas(),window.godot=this,this.narratReady=!0,window.narratReadyCallback&&window.narratReadyCallback()}getCanvas(){return document.querySelector("#godot-canvas")}addMessageForGodot(n){this.messageQueue.unshift(n),window.godotCallback&&window.godotCallback(n)}grabNextMessage(){return this.messageQueue.pop()}async run(n,...r){const o=await this.narrat.run(n,...r),a={type:"run_end",payload:{label:n,args:r,result:o}};this.addMessageForGodot(a)}isJson(n){try{JSON.parse(n)}catch{return!1}return!0}resizeCanvas(){const n=Je(),r=n.gameWidth,o=n.gameHeight;this.canvas.width=r,this.canvas.height=o,this.canvas.style.width=`${r}px`,this.canvas.style.height=`${o}px`,window.requestAnimationFrame(()=>this.resizeCanvas())}}class tp extends Mi{constructor(n={}){super();De(this,"defaultTheme");De(this,"themes",[]);De(this,"activeTheme");De(this,"customCommands");De(this,"initialConfig");n.defaultTheme&&(this.defaultTheme=n.defaultTheme),n.themes&&(this.themes=n.themes),this.customCommands=[this.createChangeThemeCommand()]}onNarratSetup(){if(this.defaultTheme){const n=this.themes.find(r=>r.id===this.defaultTheme);if(!n){ae(`Theme ${this.defaultTheme} not found`);return}this.setTheme(n)}}addTheme(n){this.themes.push(n)}createChangeThemeCommand(){return V.FromOptions({keyword:"change_theme",argTypes:[{name:"theme",type:"string"}],runner:async r=>{this.changeTheme(r.options.theme)}})}changeTheme(n){if(n==="default"){this.removeCurrentTheme();return}const r=this.findTheme(n);this.setTheme(r)}findTheme(n){const r=this.themes.find(o=>o.id===n);return r||ae(`Theme ${n} not found`),r}setTheme(n){this.activeTheme&&this.removeCurrentTheme(),this.activeTheme={themeTag:this.createThemeTag(n),id:n.id},document.head.appendChild(this.activeTheme.themeTag),n.extendedConfig&&(this.initialConfig=Jn({},st().config),st().extendConfig(n.extendedConfig))}createThemeTag(n){if(this.isInlineTheme(n)){const r=document.createElement("style");return r.innerHTML=n.css,r}else{const r=document.createElement("link");return r.rel="stylesheet",r.href=n.cssPath,r.id=n.id,r}}isInlineTheme(n){return n.css!==void 0}isExternalTheme(n){return n.cssPath!==void 0}removeCurrentTheme(){this.activeTheme&&(this.activeTheme.themeTag&&this.activeTheme.themeTag.remove(),this.findTheme(this.activeTheme.id).extendedConfig&&(st().config=this.initialConfig)),this.activeTheme=void 0}}const np={css:"body{font-size:52px}",id:"narrat-fun-theme",extendedConfig:{}},rp={id:"narrat-text-only",css:"#narrat-app{--bg-color: #131720;--text-color: #d9e1f2;--primary: hsl(255, 30%, 55%);--focus: hsl(210, 90%, 50%);--secondary: #42b983;--dialog-box-bg: transparent;--dialog-box-border: none}.interact-button{background:unset;border:none;font-size:2rem;font-weight:700;color:#fff;font-family:monospace;text-shadow:-4px 4px 2px #000}.dialog{box-shadow:none!important;text-align:center}.dialog-text{font-size:1.5rem;font-family:monospace;text-shadow:-4px 4px 2px #000}",extendedConfig:{common:{dialogPanel:{textSpeed:30,animateText:!0,timeBetweenLines:100,overlayMode:!0,rightOffset:300,bottomOffset:150,width:700,height:680}}}},aO=Object.freeze(Object.defineProperty({__proto__:null,BaseConfigInputSchema:ri,CommandPlugin:V,ConfigInputSchema:Us,ConfigInputSchemaWithCommon:Fs,ConfigInputSchemaWithoutCommon:Vs,EngineSplash:Ts,GameDialog:As,GameSplash:ws,GodotPlugin:ep,Hud:js,InGame:xs,InputsListener:Cs,LogManager:Io,MenuButtons:Is,ModalWindow:_n,NarratPlugin:Mi,NarratThemesPlugin:tp,Screens:Ps,StartMenu:Es,get Vec2(){return Z.Vec2},addCommand:Zf,aspectRatioFit:Ss,audioConfig:Lt,buttonsConfig:Ei,charactersConfig:Oi,constructNarratObject:ol,debounce:so,error:ae,findVariable:Xi,funTheme:np,gameloop:io,generateObjectFromList:Zi,generateParser:Dr,getAssetUrl:Et,getButtonConfig:Un,getConfig:le,getDataUrl:Ni,getFile:Jo,getImageUrl:Mr,getItemConfig:en,getObjectiveConfig:Co,getQuestConfig:$n,getScreenConfig:Lr,getSkillConfig:Ii,getSplitConfigUrl:qa,getWindow:Bo,handleHMR:Fa,inputEvents:qt,isConfigInputWithCommon:oi,isModuleValid:Ra,isNarratScript:Va,isNarratYaml:wi,isPromise:es,itemsConfig:Ci,loadDataFile:oo,logManager:No,logger:Ft,processText:nn,questsConfig:wo,randomId:zn,registerMenuButton:rl,registerPlugin:Xf,screensConfig:$i,skillsConfig:dn,textOnlyTheme:rp,timeout:kt,tooltipsConfig:Vn,useAchievements:cr,useAudio:ft,useConfig:st,useDialogStore:Fe,useHud:Pt,useInputs:Ke,useInventory:mt,useMain:Te,useMenu:ht,useNotifications:vt,useQuests:dt,useRenderingStore:Je,useScenes:Nt,useScreenObjects:Dt,useScreens:Ut,useSkills:Xe,useTooltips:br,useVM:ve,warning:er},Symbol.toStringTag,{value:"Module"}));function ol(e){const t={app:e,vm:Ie,handleHMR:Fa,jump:n=>ve().jumpToLabel(n),run:(n,...r)=>ve().runThenGoBackToPreviousDialog(n,...r),getSave:()=>bn(),exports:aO};return window.narrat=t,t}var lO=Object.prototype.toString,op=function(t){if(t===void 0)return"undefined";if(t===null)return"null";var n=typeof t;if(n==="boolean")return"boolean";if(n==="string")return"string";if(n==="number")return"number";if(n==="symbol")return"symbol";if(n==="function")return pO(t)?"generatorfunction":"function";if(cO(t))return"array";if(yO(t))return"buffer";if(hO(t))return"arguments";if(dO(t))return"date";if(uO(t))return"error";if(fO(t))return"regexp";switch(ip(t)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(mO(t))return"generator";switch(n=lO.call(t),n){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return n.slice(8,-1).toLowerCase().replace(/\s/g,"")};function ip(e){return typeof e.constructor=="function"?e.constructor.name:null}function cO(e){return Array.isArray?Array.isArray(e):e instanceof Array}function uO(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function dO(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function fO(e){return e instanceof RegExp?!0:typeof e.flags=="string"&&typeof e.ignoreCase=="boolean"&&typeof e.multiline=="boolean"&&typeof e.global=="boolean"}function pO(e,t){return ip(e)==="GeneratorFunction"}function mO(e){return typeof e.throw=="function"&&typeof e.return=="function"&&typeof e.next=="function"}function hO(e){try{if(typeof e.length=="number"&&typeof e.callee=="function")return!0}catch(t){if(t.message.indexOf("callee")!==-1)return!0}return!1}function yO(e){return e.constructor&&typeof e.constructor.isBuffer=="function"?e.constructor.isBuffer(e):!1}/*!
84
84
  * shallow-clone <https://github.com/jonschlinkert/shallow-clone>
85
85
  *
86
86
  * Copyright (c) 2015-present, Jon Schlinkert.
87
87
  * Released under the MIT License.
88
- */const rp=Symbol.prototype.valueOf,pO=tp;function mO(e,t){switch(pO(e)){case"array":return e.slice();case"object":return Object.assign({},e);case"date":return new e.constructor(Number(e));case"map":return new Map(e);case"set":return new Set(e);case"buffer":return _O(e);case"symbol":return bO(e);case"arraybuffer":return yO(e);case"float32array":case"float64array":case"int16array":case"int32array":case"int8array":case"uint16array":case"uint32array":case"uint8clampedarray":case"uint8array":return gO(e);case"regexp":return hO(e);case"error":return Object.create(e);default:return e}}function hO(e){const t=e.flags!==void 0?e.flags:/\w+$/.exec(e)||void 0,n=new e.constructor(e.source,t);return n.lastIndex=e.lastIndex,n}function yO(e){const t=new e.constructor(e.byteLength);return new Uint8Array(t).set(new Uint8Array(e)),t}function gO(e,t){return new e.constructor(e.buffer,e.byteOffset,e.length)}function _O(e){const t=e.length,n=Buffer.allocUnsafe?Buffer.allocUnsafe(t):Buffer.from(t);return e.copy(n),n}function bO(e){return rp?Object(rp.call(e)):{}}var TO=mO;/*!
88
+ */const sp=Symbol.prototype.valueOf,gO=op;function _O(e,t){switch(gO(e)){case"array":return e.slice();case"object":return Object.assign({},e);case"date":return new e.constructor(Number(e));case"map":return new Map(e);case"set":return new Set(e);case"buffer":return SO(e);case"symbol":return wO(e);case"arraybuffer":return TO(e);case"float32array":case"float64array":case"int16array":case"int32array":case"int8array":case"uint16array":case"uint32array":case"uint8clampedarray":case"uint8array":return vO(e);case"regexp":return bO(e);case"error":return Object.create(e);default:return e}}function bO(e){const t=e.flags!==void 0?e.flags:/\w+$/.exec(e)||void 0,n=new e.constructor(e.source,t);return n.lastIndex=e.lastIndex,n}function TO(e){const t=new e.constructor(e.byteLength);return new Uint8Array(t).set(new Uint8Array(e)),t}function vO(e,t){return new e.constructor(e.buffer,e.byteOffset,e.length)}function SO(e){const t=e.length,n=Buffer.allocUnsafe?Buffer.allocUnsafe(t):Buffer.from(t);return e.copy(n),n}function wO(e){return sp?Object(sp.call(e)):{}}var kO=_O;/*!
89
89
  * isobject <https://github.com/jonschlinkert/isobject>
90
90
  *
91
91
  * Copyright (c) 2014-2017, Jon Schlinkert.
92
92
  * Released under the MIT License.
93
- */var vO=function(t){return t!=null&&typeof t=="object"&&Array.isArray(t)===!1};/*!
93
+ */var CO=function(t){return t!=null&&typeof t=="object"&&Array.isArray(t)===!1};/*!
94
94
  * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
95
95
  *
96
96
  * Copyright (c) 2014-2017, Jon Schlinkert.
97
97
  * Released under the MIT License.
98
- */var SO=vO;function op(e){return SO(e)===!0&&Object.prototype.toString.call(e)==="[object Object]"}var wO=function(t){var n,r;return!(op(t)===!1||(n=t.constructor,typeof n!="function")||(r=n.prototype,op(r)===!1)||r.hasOwnProperty("isPrototypeOf")===!1)};const kO=TO,CO=tp,$O=wO;function rl(e,t){switch(CO(e)){case"object":return EO(e,t);case"array":return OO(e,t);default:return kO(e)}}function EO(e,t){if(typeof t=="function")return t(e);if(t||$O(e)){const n=new e.constructor;for(let r in e)n[r]=rl(e[r],t);return n}return e}function OO(e,t){const n=new e.constructor(e.length);for(let r=0;r<e.length;r++)n[r]=rl(e[r],t);return n}var AO=rl;const IO=Bi(AO);let pn;Ie.callHook("onPageLoaded");async function ip(e){oo.setup(),console.log("Starting narrat...");const t=Object.assign(yT(),e),n=Zp();pn=i.createApp(bk,{options:t}),pn.use(n),Yb(),Te().setOptions(t),eO(pn);const r=await HS(t);lt().setConfig(r),bn(),Ke().setupInputs(),Ie.pinia=n,Te(),nl(pn),JE(pn),ZE(),Cs().addButtonsFromPlugins(),_1(Ie),Io.setupDebugger(t.debug),console.log(`%c Narrat game engine v${Lm} - Built at ${Mm.toLocaleString()}`,"background: #222; color: #bada55"),Ie.callHook("onNarratSetup");let o;return typeof t.container=="string"?o=document.querySelector(t.container):o=t.container,o||alert("The narrat container was not found!"),Je().setContainer(o),Ke().listenToContainerInputs(),pn.mount(o),Je().narratAppElement=document.querySelector("#narrat-app"),o.focus(),pn}async function sp(){pn.unmount(),pn=null}async function NO(){const e=IO(Te().options);return await sp(),await ip(e)}function PO(e,t){pn.component(e,t)}Z.BaseConfigInputSchema=ti,Z.CommandPlugin=V,Z.ConfigInputSchema=Vs,Z.ConfigInputSchemaWithCommon=Bs,Z.ConfigInputSchemaWithoutCommon=Fs,Z.EngineSplash=bs,Z.GameDialog=Os,Z.GameSplash=Ss,Z.GodotPlugin=Jf,Z.Hud=Ps,Z.InGame=js,Z.InputsListener=ks,Z.LogManager=Ao,Z.MenuButtons=As,Z.ModalWindow=_n,Z.NarratPlugin=xi,Z.NarratThemesPlugin=Xf,Z.Screens=Ns,Z.StartMenu=$s,Z.addCommand=Yf,Z.aspectRatioFit=vs,Z.audioConfig=Lt,Z.buttonsConfig=Ci,Z.charactersConfig=$i,Z.constructNarratObject=nl,Z.debounce=io,Z.error=ae,Z.findVariable=Yi,Z.funTheme=Zf,Z.gameloop=oo,Z.generateObjectFromList=Ji,Z.generateParser=Dr,Z.getAssetUrl=$t,Z.getButtonConfig=Vn,Z.getConfig=le,Z.getDataUrl=Ai,Z.getFile=Qo,Z.getImageUrl=Lr,Z.getItemConfig=en,Z.getObjectiveConfig=ko,Z.getQuestConfig=$n,Z.getScreenConfig=xr,Z.getSkillConfig=Oi,Z.getSplitConfigUrl=Ua,Z.getWindow=Mo,Z.handleHMR=Ba,Z.inputEvents=qt,Z.isConfigInputWithCommon=ni,Z.isModuleValid=Ra,Z.isNarratScript=Fa,Z.isNarratYaml=vi,Z.isPromise=Xi,Z.itemsConfig=wi,Z.loadDataFile=ro,Z.logManager=Io,Z.logger=Ft,Z.processText=nn,Z.questsConfig=So,Z.randomId=Gn,Z.registerComponent=PO,Z.registerMenuButton=tl,Z.registerPlugin=Qf,Z.restartApp=NO,Z.screensConfig=ki,Z.skillsConfig=dn,Z.startApp=ip,Z.stopApp=sp,Z.textOnlyTheme=ep,Z.timeout=At,Z.tooltipsConfig=Fn,Z.useAchievements=lr,Z.useAudio=ft,Z.useConfig=lt,Z.useDialogStore=Fe,Z.useHud=Pt,Z.useInputs=Ke,Z.useInventory=mt,Z.useMain=Te,Z.useMenu=ht,Z.useNotifications=vt,Z.useQuests=dt,Z.useRenderingStore=Je,Z.useScenes=Nt,Z.useScreenObjects=xt,Z.useScreens=Ut,Z.useSkills=Xe,Z.useTooltips=_r,Z.useVM=we,Z.warning=Zn,Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"})});
98
+ */var $O=CO;function ap(e){return $O(e)===!0&&Object.prototype.toString.call(e)==="[object Object]"}var EO=function(t){var n,r;return!(ap(t)===!1||(n=t.constructor,typeof n!="function")||(r=n.prototype,ap(r)===!1)||r.hasOwnProperty("isPrototypeOf")===!1)};const OO=kO,AO=op,IO=EO;function il(e,t){switch(AO(e)){case"object":return NO(e,t);case"array":return PO(e,t);default:return OO(e)}}function NO(e,t){if(typeof t=="function")return t(e);if(t||IO(e)){const n=new e.constructor;for(let r in e)n[r]=il(e[r],t);return n}return e}function PO(e,t){const n=new e.constructor(e.length);for(let r=0;r<e.length;r++)n[r]=il(e[r],t);return n}var jO=il;const xO=Vi(jO);let pn;Ie.callHook("onPageLoaded");async function lp(e){io.setup(),console.log("Starting narrat...");const t=Object.assign(bT(),e),n=nm();pn=i.createApp(Sk,{options:t}),pn.use(n),Zb(),Te().setOptions(t),oO(pn);const r=await zS(t);st().setConfig(r),bn(),Ke().setupInputs(),Ie.pinia=n,Te(),ol(pn),tO(pn),rO(),$s().addButtonsFromPlugins(),S1(Ie),No.setupDebugger(t.debug),console.log(`%c Narrat game engine v${Rm} - Built at ${Fm.toLocaleString()}`,"background: #222; color: #bada55"),Ie.callHook("onNarratSetup");let o;return typeof t.container=="string"?o=document.querySelector(t.container):o=t.container,o||alert("The narrat container was not found!"),Je().setContainer(o),Ke().listenToContainerInputs(),pn.mount(o),Je().narratAppElement=document.querySelector("#narrat-app"),o.focus(),pn}async function cp(){pn.unmount(),pn=null}async function DO(){const e=xO(Te().options);return await cp(),await lp(e)}function LO(e,t){pn.component(e,t)}Z.BaseConfigInputSchema=ri,Z.CommandPlugin=V,Z.ConfigInputSchema=Us,Z.ConfigInputSchemaWithCommon=Fs,Z.ConfigInputSchemaWithoutCommon=Vs,Z.EngineSplash=Ts,Z.GameDialog=As,Z.GameSplash=ws,Z.GodotPlugin=ep,Z.Hud=js,Z.InGame=xs,Z.InputsListener=Cs,Z.LogManager=Io,Z.MenuButtons=Is,Z.ModalWindow=_n,Z.NarratPlugin=Mi,Z.NarratThemesPlugin=tp,Z.Screens=Ps,Z.StartMenu=Es,Z.addCommand=Zf,Z.aspectRatioFit=Ss,Z.audioConfig=Lt,Z.buttonsConfig=Ei,Z.charactersConfig=Oi,Z.constructNarratObject=ol,Z.debounce=so,Z.error=ae,Z.findVariable=Xi,Z.funTheme=np,Z.gameloop=io,Z.generateObjectFromList=Zi,Z.generateParser=Dr,Z.getAssetUrl=Et,Z.getButtonConfig=Un,Z.getConfig=le,Z.getDataUrl=Ni,Z.getFile=Jo,Z.getImageUrl=Mr,Z.getItemConfig=en,Z.getObjectiveConfig=Co,Z.getQuestConfig=$n,Z.getScreenConfig=Lr,Z.getSkillConfig=Ii,Z.getSplitConfigUrl=qa,Z.getWindow=Bo,Z.handleHMR=Fa,Z.inputEvents=qt,Z.isConfigInputWithCommon=oi,Z.isModuleValid=Ra,Z.isNarratScript=Va,Z.isNarratYaml=wi,Z.isPromise=es,Z.itemsConfig=Ci,Z.loadDataFile=oo,Z.logManager=No,Z.logger=Ft,Z.processText=nn,Z.questsConfig=wo,Z.randomId=zn,Z.registerComponent=LO,Z.registerMenuButton=rl,Z.registerPlugin=Xf,Z.restartApp=DO,Z.screensConfig=$i,Z.skillsConfig=dn,Z.startApp=lp,Z.stopApp=cp,Z.textOnlyTheme=rp,Z.timeout=kt,Z.tooltipsConfig=Vn,Z.useAchievements=cr,Z.useAudio=ft,Z.useConfig=st,Z.useDialogStore=Fe,Z.useHud=Pt,Z.useInputs=Ke,Z.useInventory=mt,Z.useMain=Te,Z.useMenu=ht,Z.useNotifications=vt,Z.useQuests=dt,Z.useRenderingStore=Je,Z.useScenes=Nt,Z.useScreenObjects=Dt,Z.useScreens=Ut,Z.useSkills=Xe,Z.useTooltips=br,Z.useVM=ve,Z.warning=er,Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"})});
99
99
  //# sourceMappingURL=narrat.umd.js.map