narraleaf-react 0.0.4 → 0.0.5

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.
Files changed (2) hide show
  1. package/dist/main.js +1 -1
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -28,4 +28,4 @@ function(){"use strict";var t;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.p
28
28
  *
29
29
  * This source code is licensed under the MIT license found in the
30
30
  * LICENSE file in the root directory of this source tree.
31
- */function c(t,e,n){var r,i={},c=null,l=null;for(r in void 0!==n&&(c=""+n),void 0!==e.key&&(c=""+e.key),void 0!==e.ref&&(l=e.ref),e)a.call(e,r)&&!u.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps)void 0===i[r]&&(i[r]=e[r]);return{$$typeof:o,type:t,key:c,ref:l,props:i,_owner:s.current}}e.jsx=c,e.jsxs=c},848:(t,e,n)=>{"use strict";t.exports=n(20)},72:t=>{"use strict";var e=[];function n(t){for(var n=-1,r=0;r<e.length;r++)if(e[r].identifier===t){n=r;break}return n}function r(t,r){for(var i={},a=[],s=0;s<t.length;s++){var u=t[s],c=r.base?u[0]+r.base:u[0],l=i[c]||0,f="".concat(c," ").concat(l);i[c]=l+1;var p=n(f),d={css:u[1],media:u[2],sourceMap:u[3],supports:u[4],layer:u[5]};if(-1!==p)e[p].references++,e[p].updater(d);else{var h=o(d,r);r.byIndex=s,e.splice(s,0,{identifier:f,updater:h,references:1})}a.push(f)}return a}function o(t,e){var n=e.domAPI(e);n.update(t);return function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,o){var i=r(t=t||[],o=o||{});return function(t){t=t||[];for(var a=0;a<i.length;a++){var s=n(i[a]);e[s].references--}for(var u=r(t,o),c=0;c<i.length;c++){var l=n(i[c]);0===e[l].references&&(e[l].updater(),e.splice(l,1))}i=u}}},659:t=>{"use strict";var e={};t.exports=function(t,n){var r=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},540:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},56:(t,e,n)=>{"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},825:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),e.styleTagTransform(r,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},113:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},12:e=>{"use strict";e.exports=t},33:t=>{"use strict";t.exports=e}},r={};function o(t){var e=r[t];if(void 0!==e)return e.exports;var i=r[t]={id:t,exports:{}};return n[t](i,i.exports,o),i.exports}o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.nc=void 0;var i={};return(()=>{"use strict";function t(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */t=function(){return n};var e,n={},r=Object.prototype,o=r.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(e){l=function(t,e,n){return t[e]=n}}function p(t,e,n,r){var o=e&&e.prototype instanceof b?e:b,a=Object.create(o.prototype),s=new I(r||[]);return i(a,"_invoke",{value:O(t,n,s)}),a}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}n.wrap=p;var h="suspendedStart",y="suspendedYield",v="executing",m="completed",g={};function b(){}function w(){}function _(){}var S={};l(S,s,(function(){return this}));var k=Object.getPrototypeOf,x=k&&k(k(L([])));x&&x!==r&&o.call(x,s)&&(S=x);var A=_.prototype=b.prototype=Object.create(S);function T(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(r,i,a,s){var u=d(t[r],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==f(l)&&o.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var r;i(this,"_invoke",{value:function(t,o){function i(){return new e((function(e,r){n(t,o,e,r)}))}return r=r?r.then(i,i):i()}})}function O(t,n,r){var o=h;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=P(s,r);if(u){if(u===g)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=v;var c=d(t,n,r);if("normal"===c.type){if(o=r.done?m:y,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=m,r.method="throw",r.arg=c.arg)}}}function P(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,P(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=d(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[s];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function n(){for(;++r<t.length;)if(o.call(t,r))return n.value=t[r],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(f(t)+" is not iterable")}return w.prototype=_,i(A,"constructor",{value:_,configurable:!0}),i(_,"constructor",{value:w,configurable:!0}),w.displayName=l(_,c,"GeneratorFunction"),n.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,l(t,c,"GeneratorFunction")),t.prototype=Object.create(A),t},n.awrap=function(t){return{__await:t}},T(E.prototype),l(E.prototype,u,(function(){return this})),n.AsyncIterator=E,n.async=function(t,e,r,o,i){void 0===i&&(i=Promise);var a=new E(p(t,e,r,o),i);return n.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},T(A),l(A,c,"Generator"),l(A,s,(function(){return this})),l(A,"toString",(function(){return"[object Generator]"})),n.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},n.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(C),!t)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(r,o){return s.type="throw",s.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),c=o.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;C(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},n}function e(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=c(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,s(r.key),r)}}function a(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t){var e=function(t,e){if("object"!=f(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==f(e)?e:e+""}function u(t){return function(t){if(Array.isArray(t))return l(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||c(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(t,e){if(t){if("string"==typeof t)return l(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(t,e):void 0}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}o.r(i),o.d(i,{Align:()=>wt,Base:()=>Bf,Character:()=>Ba,ColoredSentence:()=>Yu,CommonPosition:()=>gt,CommonPositionType:()=>st,Condition:()=>ts,Control:()=>Si,Coord2D:()=>bt,Dissolve:()=>lp,Fade:()=>Yf,FadeIn:()=>np,Game:()=>nc,GameProviders:()=>Rf,GameState:()=>_u,Image:()=>ji,Isolated:()=>Ru,Lambda:()=>Ja,LiveGame:()=>rc,Menu:()=>us,Namespace:()=>du,Player:()=>Mf,Say:()=>qu,Scene:()=>Us,Script:()=>Zs,Sentence:()=>Fa,Sound:()=>Es,SoundType:()=>gs,Storable:()=>hu,Story:()=>iu,Transform:()=>hi,Utils:()=>Aa,Word:()=>Da,useGame:()=>$u});var p=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};function d(t,e){var n=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r={},o=function(t,e,n){return"object"!==f(e)||null===e||Array.isArray(e)||"object"!==f(n)||null===n||Array.isArray(n)?Array.isArray(e)&&Array.isArray(n)?e.map((function(t,e){return"object"===f(t)&&null!==t&&!Array.isArray(t)&&n[e]?d(t,n[e]):t})):void 0===n?e:n:e.constructor!==Object||n.constructor!==Object?n||e:d(e,n)};for(var i in t)n(t,i)&&(r[i]=o(0,t[i],e[i]));for(var a in e)n(e,a)&&!n(r,a)&&("object"===f(e[a])&&null!==e[a]&&e[a].constructor===Object?r[a]=d({},e[a]):r[a]=e[a]);for(var s=arguments.length,c=new Array(s>2?s-2:0),l=2;l<s;l++)c[l-2]=arguments[l];if(c.length){var p=c[0],h=c.slice(1);return d.apply(void 0,[r,p].concat(u(h)))}return r}var h=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t},r=arguments.length>1?arguments[1]:void 0;n(this,t),this.solved=!1,this.listeners=[],this.receiver=e,this.skipController=r}return a(t,[{key:"registerSkipController",value:function(t){return this.skipController=t,this}},{key:"resolve",value:function(t){if(!this.solved){this.result=this.receiver(t),this.solved=!0,this.skipController&&this.skipController.cancel();var n,r=e(this.listeners);try{for(r.s();!(n=r.n()).done;){(0,n.value)(this.result)}}catch(t){r.e(t)}finally{r.f()}}}},{key:"then",value:function(t){this.result?t(this.result):this.listeners.push(t)}},{key:"abort",value:function(){return this.skipController?this.skipController.abort():this.result}}],[{key:"isAwaitable",value:function(e){return e instanceof t}}])}();function y(t){var n=new WeakSet;return function t(r){if(null===r||"object"!==f(r))return r;if(!n.has(r)){if(n.add(r),Array.isArray(r)){var o,i=[],a=e(r);try{for(a.s();!(o=a.n()).done;){var s=o.value;i.push(t(s))}}catch(t){a.e(t)}finally{a.f()}return i}var u={};for(var c in r)Object.prototype.hasOwnProperty.call(r,c)&&(u[c]=t(r[c]));return u}}(t)}function v(t){return"string"==typeof t?t:"#".concat((t.r||0).toString(16).padStart(2,"0")).concat((t.g||0).toString(16).padStart(2,"0")).concat((t.b||0).toString(16).padStart(2,"0")).concat(void 0===t.a?"":t.a.toString(16).padStart(2,"0"))}var m=function(){return a((function t(){n(this,t),this.events={}}),[{key:"on",value:function(t,e){return this.events[t]||(this.events[t]=[]),this.events[t].push(e),this.emit("event:EventDispatcher.register",t,e),e}},{key:"onEvents",value:function(t){var e=this,n=t.map((function(t){var n=t.type,r=t.listener;return{type:n,listener:r,cancel:function(){e.off(n,r)}}}));return{tokens:n,cancel:function(){n.forEach((function(t){return t.cancel()}))}}}},{key:"off",value:function(t,e){this.events[t]&&(this.events[t]=this.events[t].filter((function(t){return t!==e})))}},{key:"emit",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];this.events[t]&&this.events[t].forEach((function(t){t.apply(void 0,n)}))}},{key:"once",value:function(t,e){var n=this,r=function(){e.apply(void 0,arguments),n.off(t,r)};return this.on(t,r)}},{key:"any",value:function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return p(this,void 0,void 0,t().mark((function r(){var i,a,s,u,c,l=this;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.events[n]||(this.events[n]=[]),i=[],a=e(this.events[n]);try{for(a.s();!(s=a.n()).done;)u=s.value,(c=u.apply(void 0,o))&&"object"===f(c)&&"function"==typeof c.then&&i.push(c)}catch(t){a.e(t)}finally{a.f()}if(this.events[n]=this.events[n].filter((function(t){return!i.includes(t)})),0!==i.length){t.next=7;break}return t.abrupt("return",new Promise((function(t){var e=l.on("event:EventDispatcher.register",(function(r,i){if(r===n){l.off(r,e);var a=null==i?void 0:i.apply(void 0,o);a&&a.then?a.then(t):t(a)}}))})));case 7:return t.next=9,Promise.all(i);case 9:return t.abrupt("return",void 0);case 10:case"end":return t.stop()}}),r,this)})))}},{key:"clear",value:function(){this.events={}}}])}();function g(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(new Error).stack;return n?n.split("\n").slice(t+1,-e).join("\n").trim():""}function b(t){return new Promise((function(e){return setTimeout(e,t)}))}function w(t,e){if(t===e)return!0;if("object"!==f(t)||"object"!==f(e)||null===t||null===e)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(var o=0,i=n;o<i.length;o++){var a=i[o];if(!r.includes(a)||!w(t[a],e[a]))return!1}return!0}var _,S=function(){return a((function t(e,r){n(this,t),this.game=e,this.prefix=r}),[{key:"log",value:function(t){if(this.game.config.app.logger.log){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).log.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"info",value:function(t){if(this.game.config.app.logger.info){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).info.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"warn",value:function(t){if(this.game.config.app.logger.warn){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).warn.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"error",value:function(t){if(this.game.config.app.logger.error){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).error.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"debug",value:function(t){if(this.game.config.app.logger.debug){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).debug.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"trace",value:function(t){if(this.game.config.app.logger.trace){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];console.trace(this._log.apply(this,[t].concat(n)))}}},{key:"_log",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return 0===n.length?[this.prefix||"",t]:["".concat(this.prefix||""," [").concat(t,"]")].concat(n)}}])}(),k=function(){return a((function t(e){n(this,t),this.abortHandler=e,this.events=new m,this.aborted=!1}),[{key:"abort",value:function(){return this.aborted||(this.aborted=!0,this.result=this.abortHandler.apply(this,arguments)),this.result}},{key:"isAborted",value:function(){return this.aborted}},{key:"cancel",value:function(){this.aborted=!0}}])}();function x(t){return x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},x(t)}function A(t,e,n){return e=E(e),function(t,e){if(e&&("object"==x(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,T()?Reflect.construct(e,n||[],E(t).constructor):e.apply(t,n))}function T(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(T=function(){return!!t})()}function E(t){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},E(t)}function O(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&P(t,e)}function P(t,e){return P=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},P(t,e)}function j(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function C(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,L(r.key),r)}}function I(t,e,n){return e&&C(t.prototype,e),n&&C(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function L(t){var e=function(t,e){if("object"!=x(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=x(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==x(e)?e:e+""}k.EventTypes={"event:skipController.abort":"event:skipController.abort"},function(t){t.TreeNode="TreeNode",t.ContentNode="ContentNode"}(_||(_={}));var M=function(t){function e(t,n,r){var o;return j(this,e),(o=A(this,e,[_.ContentNode])).child=r||null,o.parent=n||null,o.action=t||null,o}return O(e,t),I(e,[{key:"setParent",value:function(t){if(t===this)throw new Error("Cannot set parent to itself");return this.parent=t,this}},{key:"setChild",value:function(t){if(t===this)throw new Error("Cannot set child to itself");return this.child=t,t&&t.parent!==this&&t.remove().setParent(this),this}},{key:"getChild",value:function(){return this.child||null}},{key:"getParent",value:function(){return this.parent||null}},{key:"addChild",value:function(t){return this.setChild(t),this}},{key:"removeChild",value:function(t){return t&&this.child===t?(this.child=null,t.setParent(null)):t||(this.child=null),this}},{key:"remove",value:function(){var t;return null===(t=this.parent)||void 0===t||t.removeChild(this),this}},{key:"hasChild",value:function(){return!!this.child}}],[{key:"forEachParent",value:function(t,e){for(var n=new Set,r=t;r&&!n.has(r);)n.add(r),e(r),r=r.getParent()}},{key:"forEachChild",value:function(t,e){for(var n=new Set,r=t;r&&!n.has(r);)n.add(r),e(r),r=r.getChild()}}])}(function(){return I((function t(e){j(this,t),this.type=e,this.content=void 0}),[{key:"setContent",value:function(t){return this.content=t,this}},{key:"getContent",value:function(){return this.content}}])}());function N(t){return N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},N(t)}function R(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,F(r.key),r)}}function F(t){var e=function(t,e){if("object"!=N(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=N(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==N(e)?e:e+""}var V,D=function(){return function(t,e,n){return e&&R(t.prototype,e),n&&R(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.id=""}),[{key:"setId",value:function(t){this.id=t}},{key:"getId",value:function(){return this.id}},{key:"reset",value:function(){}},{key:"fromData",value:function(t){return this}},{key:"construct",value:function(t){for(var e,n=0;n<t.length;n++){var r=t[n];0!==n&&(null===(e=t[n-1])||void 0===e||e.contentNode.setChild(r.contentNode))}return t}}])}();function B(t){return B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},B(t)}function G(t){return function(t){if(Array.isArray(t))return U(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return U(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?U(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function U(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function H(t,e,n){return e=z(e),function(t,e){if(e&&("object"==B(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,$()?Reflect.construct(e,n||[],z(t).constructor):e.apply(t,n))}function $(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return($=function(){return!!t})()}function z(t){return z=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},z(t)}function W(t,e){return W=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},W(t,e)}function q(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Y(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,K(r.key),r)}}function X(t,e,n){return e&&Y(t.prototype,e),n&&Y(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function K(t){var e=function(t,e){if("object"!=B(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=B(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==B(e)?e:e+""}var Z=Symbol("_Chained"),Q=function(){function t(e){q(this,t),this[V]=!0,this.__actions=[],this.__self=e}return X(t,[{key:"push",value:function(){var t;(t=this.__actions).push.apply(t,arguments)}},{key:"getActions",value:function(){return this.__actions}},{key:"getSelf",value:function(){return this.__self}},{key:"newChain",value:function(){return this.getSelf().chain()}}],[{key:"isChained",value:function(t){return t&&t[Z]}},{key:"toActions",value:function(e){return e.flat(2).map((function(e){return t.isChained(e)?e.fromChained(e):e})).flat(3)}}])}();V=Z;var J=function(t){function e(){return q(this,e),H(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&W(t,e)}(e,t),X(e,[{key:"chain",value:function(t){var e=Q.isChained(this)?this:this.proxy(this,new Q(this));if(!t)return e;var n=Array.isArray(t)?t:[t];return e.push.apply(e,G(n)),e}},{key:"proxy",value:function(t,e){var n=new Proxy(t,{get:function(t,r){if(r in e)return e[r];var o=t[r];return"function"==typeof o?o.bind(n):o},set:function(t,e,n){return t[e]=n,!0}});return n}},{key:"combineActions",value:function(t,e){var n=e(this.chain().newChain()),r=new da(t.chain(),da.ActionTypes.do,(new M).setContent([this.construct(Q.toActions([n]))]));return this.chain(r)}}])}(D);function tt(t){return tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tt(t)}function et(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,nt(r.key),r)}}function nt(t){var e=function(t,e){if("object"!=tt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=tt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==tt(e)?e:e+""}function rt(t,e,n){return e=it(e),function(t,e){if(e&&("object"==tt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ot()?Reflect.construct(e,n||[],it(t).constructor):e.apply(t,n))}function ot(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ot=function(){return!!t})()}function it(t){return it=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},it(t)}function at(t,e){return at=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},at(t,e)}var st,ut=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),rt(this,e)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&at(t,e)}(e,t),function(t,e,n){return e&&et(t.prototype,e),n&&et(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"toData",value:function(){return null}},{key:"fromChained",value:function(t){return t.getActions()}}])}(J),ct={center:"center",left:"left",right:"right"};function lt(t){return lt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lt(t)}function ft(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function pt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,yt(r.key),r)}}function dt(t,e,n){return e&&pt(t.prototype,e),n&&pt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function ht(t,e,n){return(e=yt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function yt(t){var e=function(t,e){if("object"!=lt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=lt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==lt(e)?e:e+""}!function(t){t.Left="left",t.Center="center",t.Right="right"}(st||(st={}));var vt=ht(ht(ht({},st.Left,"33.33%"),st.Center,"50%"),st.Right,"66.66%"),mt=function(){function t(){ft(this,t)}return dt(t,null,[{key:"isUnknown",value:function(e){return e===t.Unknown}},{key:"wrap",value:function(t){return Object.assign({left:"auto",top:"auto",right:"auto",bottom:"auto"},t)}},{key:"D2PositionToCSS",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.calc(t.y,t.yoffset),o=this.calc(t.x,t.xoffset),i=n?{bottom:r}:{top:r},a=e?{right:o}:{left:o};return this.wrap(Object.assign(Object.assign({},i),a))}},{key:"calc",value:function(e,n){if(!e||t.isUnknown(e))return"auto";if(void 0===n||t.isUnknown(n))return"".concat(e);var r="number"==typeof e?"".concat(e,"px"):e;return"calc(".concat(r," + ").concat(n,"px)")}},{key:"toCoord2D",value:function(t){if(gt.isCommonPositionType(t))return bt.fromCommonPosition(t);if(bt.isCoord2DPosition(t))return t;if(wt.isAlignPosition(t))return bt.fromAlignPosition(t);if("object"===lt(t)&&["x","y","xoffset","yoffset"].some((function(e){return e in t})))return new bt(t);throw new Error("Invalid position type")}},{key:"orUnknown",value:function(e){return t.isUnknown(e)||void 0===e?t.Unknown:e}},{key:"mergePosition",value:function(t,e){var n=this.toCoord2D(t),r=this.toCoord2D(e);return bt.merge(n,r)}},{key:"serializePosition",value:function(e){var n=this.toCoord2D(e);return{x:t.isUnknown(n.x)?0:n.x,y:t.isUnknown(n.y)?0:n.y,xoffset:t.isUnknown(n.xoffset)?0:n.xoffset,yoffset:t.isUnknown(n.yoffset)?0:n.yoffset}}},{key:"isRawCommonPositionType",value:function(t){return Object.values(st).includes(t)}},{key:"isRawCoord2DPosition",value:function(t){return"object"===lt(t)&&("x"in t||"y"in t||"xoffset"in t||"yoffset"in t)}},{key:"isRawAlignPosition",value:function(t){return"object"===lt(t)&&("xalign"in t||"yalign"in t||"xoffset"in t||"yoffset"in t)}},{key:"isRawPosition",value:function(t){return this.isRawCommonPositionType(t)||this.isRawCoord2DPosition(t)||this.isRawAlignPosition(t)}},{key:"isPosition",value:function(t){return t instanceof gt||t instanceof bt||t instanceof wt}},{key:"rawPositionToCoord2D",value:function(t){if(this.isRawCommonPositionType(t))return bt.fromCommonPosition(new gt(t));if(this.isRawCoord2DPosition(t))return new bt(t);if(this.isRawAlignPosition(t))return bt.fromAlignPosition(t);throw new Error("Invalid position type")}},{key:"tryParsePosition",value:function(t){if(this.isPosition(t))return t;if(this.isRawPosition(t))return this.rawPositionToCoord2D(t);throw new Error("Invalid position type")}}])}();mt.Unknown=Symbol("Unknown");var gt=function(){function t(e){ft(this,t),this.position=e}return dt(t,[{key:"toCSS",value:function(){return{x:vt[this.position],y:"50%",xoffset:0,yoffset:0}}}],[{key:"isCommonPositionType",value:function(e){return e instanceof t}}])}();gt.Positions=st;var bt=function(){function t(e,n){ft(this,t),"object"===lt(e)?(this.x=mt.orUnknown(e.x),this.y=mt.orUnknown(e.y),this.xoffset=mt.orUnknown(e.xoffset),this.yoffset=mt.orUnknown(e.yoffset)):(this.x=mt.orUnknown(e),this.y=mt.orUnknown(n),this.xoffset=mt.Unknown,this.yoffset=mt.Unknown)}return dt(t,[{key:"toCSS",value:function(){return{x:this.x,y:this.y,xoffset:this.xoffset,yoffset:this.yoffset}}}],[{key:"isCoord2DPosition",value:function(e){return e instanceof t}},{key:"fromCommonPosition",value:function(e){return new t({x:vt[e.position],y:"50%"})}},{key:"fromAlignPosition",value:function(e){return new t({x:mt.isUnknown(e.xalign)?mt.Unknown:"".concat(100*e.xalign,"%"),y:mt.isUnknown(e.yalign)?mt.Unknown:"".concat(100*e.yalign,"%"),xoffset:e.xoffset,yoffset:e.yoffset})}},{key:"merge",value:function(e,n){return new t({x:mt.isUnknown(n.x)?e.x:n.x,y:mt.isUnknown(n.y)?e.y:n.y,xoffset:mt.isUnknown(n.xoffset)?e.xoffset:n.xoffset,yoffset:mt.isUnknown(n.yoffset)?e.yoffset:n.yoffset})}}])}(),wt=function(){function t(e,n){ft(this,t),"object"===lt(e)?(this.xalign=mt.orUnknown(e.xalign),this.yalign=mt.orUnknown(e.yalign),this.xoffset=mt.orUnknown(e.xoffset),this.yoffset=mt.orUnknown(e.yoffset)):(this.xalign=mt.orUnknown(e),this.yalign=mt.orUnknown(n),this.xoffset=mt.Unknown,this.yoffset=mt.Unknown)}return dt(t,[{key:"toCSS",value:function(){return{x:mt.isUnknown(this.xalign)?this.xalign:"".concat(100*this.xalign,"%"),y:mt.isUnknown(this.yalign)?this.yalign:"".concat(100*this.yalign,"%"),xoffset:this.xoffset,yoffset:this.yoffset}}}],[{key:"isAlignPosition",value:function(e){return e instanceof t}}])}();const _t=t=>t;let St=_t,kt=_t;function xt(t,e,n){var r;if("string"==typeof t){let o=document;e&&(kt(Boolean(e.current),"Scope provided, but no element detected."),o=e.current),n?(null!==(r=n[t])&&void 0!==r||(n[t]=o.querySelectorAll(t)),t=n[t]):t=o.querySelectorAll(t)}else t instanceof Element&&(t=[t]);return Array.from(t||[])}const At=new WeakMap,Tt=!1,Et=!1;const Ot=["read","resolveKeyframes","update","preRender","render","postRender"];function Pt(t,e){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=Ot.reduce(((t,e)=>(t[e]=function(t){let e=new Set,n=new Set,r=!1,o=!1;const i=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function s(e){i.has(e)&&(u.schedule(e),t()),e(a)}const u={schedule:(t,o=!1,a=!1)=>{const s=a&&r?e:n;return o&&i.add(t),s.has(t)||s.add(t),t},cancel:t=>{n.delete(t),i.delete(t)},process:t=>{a=t,r?o=!0:(r=!0,[e,n]=[n,e],n.clear(),e.forEach(s),r=!1,o&&(o=!1,u.process(t)))}};return u}(i),t)),{}),{read:s,resolveKeyframes:u,update:c,preRender:l,render:f,postRender:p}=a,d=()=>{const i=Et?o.timestamp:performance.now();n=!1,o.delta=r?1e3/60:Math.max(Math.min(i-o.timestamp,40),1),o.timestamp=i,o.isProcessing=!0,s.process(o),u.process(o),c.process(o),l.process(o),f.process(o),p.process(o),o.isProcessing=!1,n&&e&&(r=!1,t(d))};return{schedule:Ot.reduce(((e,i)=>{const s=a[i];return e[i]=(e,i=!1,a=!1)=>(n||(n=!0,r=!0,o.isProcessing||t(d)),s.schedule(e,i,a)),e}),{}),cancel:t=>{for(let e=0;e<Ot.length;e++)a[Ot[e]].cancel(t)},state:o,steps:a}}const{schedule:jt,cancel:Ct,state:It,steps:Lt}=Pt("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:_t,!0);function Mt(t){let e;return()=>(void 0===e&&(e=t()),e)}const Nt=Mt((()=>void 0!==window.ScrollTimeline));class Rt{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}then(t,e){return Promise.all(this.animations).then(t).catch(e)}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t){const e=this.animations.map((e=>{if(!Nt()||!e.attachTimeline)return e.pause(),function(t,e){let n;const r=()=>{const{currentTime:r}=e,o=(null===r?0:r.value)/100;n!==o&&t(o),n=o};return jt.update(r,!0),()=>Ct(r)}((t=>{e.time=e.duration*t}),t);e.attachTimeline(t)}));return()=>{e.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;e<this.animations.length;e++)t=Math.max(t,this.animations[e].duration);return t}runAll(t){this.animations.forEach((e=>e[t]()))}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const Ft=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Vt=new Set(Ft),Dt=t=>1e3*t,Bt=t=>t/1e3,Gt={type:"spring",stiffness:500,damping:25,restSpeed:10},Ut={type:"keyframes",duration:.8},Ht={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},$t=(t,{keyframes:e})=>e.length>2?Ut:Vt.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:Gt:Ht;function zt(t,e){return t[e]||t.default||t}const Wt=!1,qt=t=>null!==t;function Yt(t,{repeat:e,repeatType:n="loop"},r){const o=t.filter(qt),i=e&&"loop"!==n&&e%2==1?0:o.length-1;return i&&void 0!==r?r:o[i]}const Xt=t=>/^0[^.\s]+$/u.test(t);const Kt=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),Zt=t=>e=>"string"==typeof e&&e.startsWith(t),Qt=Zt("--"),Jt=Zt("var(--"),te=t=>!!Jt(t)&&ee.test(t.split("/*")[0].trim()),ee=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,ne=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function re(t,e,n=1){kt(n<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[r,o]=function(t){const e=ne.exec(t);if(!e)return[,];const[,n,r,o]=e;return[`--${null!=n?n:r}`,o]}(t);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const t=i.trim();return Kt(t)?parseFloat(t):t}return te(o)?re(o,e,n+1):o}const oe=(t,e,n)=>n>e?e:n<t?t:n,ie={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},ae={...ie,transform:t=>oe(0,1,t)},se={...ie,default:1},ue=t=>Math.round(1e5*t)/1e5,ce=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,le=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,fe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;function pe(t){return"string"==typeof t}const de=t=>({test:e=>pe(e)&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),he=de("deg"),ye=de("%"),ve=de("px"),me=de("vh"),ge=de("vw"),be={...ye,parse:t=>ye.parse(t)/100,transform:t=>ye.transform(100*t)},we=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),_e=t=>t===ie||t===ve,Se=(t,e)=>parseFloat(t.split(", ")[e]),ke=(t,e)=>(n,{transform:r})=>{if("none"===r||!r)return 0;const o=r.match(/^matrix3d\((.+)\)$/u);if(o)return Se(o[1],e);{const e=r.match(/^matrix\((.+)\)$/u);return e?Se(e[1],t):0}},xe=new Set(["x","y","z"]),Ae=Ft.filter((t=>!xe.has(t)));const Te={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:ke(4,13),y:ke(5,14)};Te.translateX=Te.x,Te.translateY=Te.y;const Ee=t=>e=>e.test(t),Oe=[ie,ve,ye,he,ge,me,{test:t=>"auto"===t,parse:t=>t}],Pe=t=>Oe.find(Ee(t)),je=new Set;let Ce=!1,Ie=!1;function Le(){if(Ie){const t=Array.from(je).filter((t=>t.needsMeasurement)),e=new Set(t.map((t=>t.element))),n=new Map;e.forEach((t=>{const e=function(t){const e=[];return Ae.forEach((n=>{const r=t.getValue(n);void 0!==r&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))})),e}(t);e.length&&(n.set(t,e),t.render())})),t.forEach((t=>t.measureInitialState())),e.forEach((t=>{t.render();const e=n.get(t);e&&e.forEach((([e,n])=>{var r;null===(r=t.getValue(e))||void 0===r||r.set(n)}))})),t.forEach((t=>t.measureEndState())),t.forEach((t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)}))}Ie=!1,Ce=!1,je.forEach((t=>t.complete())),je.clear()}function Me(){je.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(Ie=!0)}))}class Ne{constructor(t,e,n,r,o,i=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=r,this.element=o,this.isAsync=i}scheduleResolve(){this.isScheduled=!0,this.isAsync?(je.add(this),Ce||(Ce=!0,jt.read(Me),jt.resolveKeyframes(Le))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:r}=this;for(let o=0;o<t.length;o++)if(null===t[o])if(0===o){const o=null==r?void 0:r.get(),i=t[t.length-1];if(void 0!==o)t[0]=o;else if(n&&e){const r=n.readValue(e,i);null!=r&&(t[0]=r)}void 0===t[0]&&(t[0]=i),r&&void 0===o&&r.set(t[0])}else t[o]=t[o-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),je.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,je.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const Re=(t,e)=>n=>Boolean(pe(n)&&fe.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),Fe=(t,e,n)=>r=>{if(!pe(r))return r;const[o,i,a,s]=r.match(ce);return{[t]:parseFloat(o),[e]:parseFloat(i),[n]:parseFloat(a),alpha:void 0!==s?parseFloat(s):1}},Ve={...ie,transform:t=>Math.round((t=>oe(0,255,t))(t))},De={test:Re("rgb","red"),parse:Fe("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+Ve.transform(t)+", "+Ve.transform(e)+", "+Ve.transform(n)+", "+ue(ae.transform(r))+")"};const Be={test:Re("#"),parse:function(t){let e="",n="",r="",o="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),o=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),o=t.substring(4,5),e+=e,n+=n,r+=r,o+=o),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}},transform:De.transform},Ge={test:Re("hsl","hue"),parse:Fe("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+ye.transform(ue(e))+", "+ye.transform(ue(n))+", "+ue(ae.transform(r))+")"},Ue={test:t=>De.test(t)||Be.test(t)||Ge.test(t),parse:t=>De.test(t)?De.parse(t):Ge.test(t)?Ge.parse(t):Be.parse(t),transform:t=>pe(t)?t:t.hasOwnProperty("red")?De.transform(t):Ge.transform(t)};const He="number",$e="color",ze="var",We="var(",qe="${}",Ye=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Xe(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},o=[];let i=0;const a=e.replace(Ye,(t=>(Ue.test(t)?(r.color.push(i),o.push($e),n.push(Ue.parse(t))):t.startsWith(We)?(r.var.push(i),o.push(ze),n.push(t)):(r.number.push(i),o.push(He),n.push(parseFloat(t))),++i,qe))).split(qe);return{values:n,split:a,indexes:r,types:o}}function Ke(t){return Xe(t).values}function Ze(t){const{split:e,types:n}=Xe(t),r=e.length;return t=>{let o="";for(let i=0;i<r;i++)if(o+=e[i],void 0!==t[i]){const e=n[i];o+=e===He?ue(t[i]):e===$e?Ue.transform(t[i]):t[i]}return o}}const Qe=t=>"number"==typeof t?0:t;const Je={test:function(t){var e,n;return isNaN(t)&&pe(t)&&((null===(e=t.match(ce))||void 0===e?void 0:e.length)||0)+((null===(n=t.match(le))||void 0===n?void 0:n.length)||0)>0},parse:Ke,createTransformer:Ze,getAnimatableNone:function(t){const e=Ke(t);return Ze(t)(e.map(Qe))}},tn=new Set(["brightness","contrast","saturate","opacity"]);function en(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[r]=n.match(ce)||[];if(!r)return t;const o=n.replace(r,"");let i=tn.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+o+")"}const nn=/\b([a-z-]*)\(.*?\)/gu,rn={...Je,getAnimatableNone:t=>{const e=t.match(nn);return e?e.map(en).join(" "):t}},on={...ie,transform:Math.round},an={borderWidth:ve,borderTopWidth:ve,borderRightWidth:ve,borderBottomWidth:ve,borderLeftWidth:ve,borderRadius:ve,radius:ve,borderTopLeftRadius:ve,borderTopRightRadius:ve,borderBottomRightRadius:ve,borderBottomLeftRadius:ve,width:ve,maxWidth:ve,height:ve,maxHeight:ve,size:ve,top:ve,right:ve,bottom:ve,left:ve,padding:ve,paddingTop:ve,paddingRight:ve,paddingBottom:ve,paddingLeft:ve,margin:ve,marginTop:ve,marginRight:ve,marginBottom:ve,marginLeft:ve,rotate:he,rotateX:he,rotateY:he,rotateZ:he,scale:se,scaleX:se,scaleY:se,scaleZ:se,skew:he,skewX:he,skewY:he,distance:ve,translateX:ve,translateY:ve,translateZ:ve,x:ve,y:ve,z:ve,perspective:ve,transformPerspective:ve,opacity:ae,originX:be,originY:be,originZ:ve,zIndex:on,backgroundPositionX:ve,backgroundPositionY:ve,fillOpacity:ae,strokeOpacity:ae,numOctaves:on},sn={...an,color:Ue,backgroundColor:Ue,outlineColor:Ue,fill:Ue,stroke:Ue,borderColor:Ue,borderTopColor:Ue,borderRightColor:Ue,borderBottomColor:Ue,borderLeftColor:Ue,filter:rn,WebkitFilter:rn},un=t=>sn[t];function cn(t,e){let n=un(t);return n!==rn&&(n=Je),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const ln=new Set(["auto","none","0"]);class fn extends Ne{constructor(t,e,n,r,o){super(t,e,n,r,o,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:n}=this;if(!e||!e.current)return;super.readKeyframes();for(let n=0;n<t.length;n++){let r=t[n];if("string"==typeof r&&(r=r.trim(),te(r))){const o=re(r,e.current);void 0!==o&&(t[n]=o),n===t.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!we.has(n)||2!==t.length)return;const[r,o]=t,i=Pe(r),a=Pe(o);if(i!==a)if(_e(i)&&_e(a))for(let e=0;e<t.length;e++){const n=t[e];"string"==typeof n&&(t[e]=parseFloat(n))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,n=[];for(let e=0;e<t.length;e++)("number"==typeof(r=t[e])?0===r:null===r||"none"===r||"0"===r||Xt(r))&&n.push(e);var r;n.length&&function(t,e,n){let r,o=0;for(;o<t.length&&!r;){const e=t[o];"string"==typeof e&&!ln.has(e)&&Xe(e).values.length&&(r=t[o]),o++}if(r&&n)for(const o of e)t[o]=cn(n,r)}(t,n,e)}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:n}=this;if(!t||!t.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Te[n](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const r=e[e.length-1];void 0!==r&&t.getValue(n,r).jump(r,!1)}measureEndState(){var t;const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const o=e.getValue(n);o&&o.jump(this.measuredOrigin,!1);const i=r.length-1,a=r[i];r[i]=Te[n](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==a&&void 0===this.finalKeyframe&&(this.finalKeyframe=a),(null===(t=this.removedTransforms)||void 0===t?void 0:t.length)&&this.removedTransforms.forEach((([t,n])=>{e.getValue(t).set(n)})),this.resolveNoneKeyframes()}}let pn;function dn(){pn=void 0}const hn={now:()=>(void 0===pn&&hn.set(It.isProcessing||Et?It.timestamp:performance.now()),pn),set:t=>{pn=t,queueMicrotask(dn)}},yn=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!Je.test(t)&&"0"!==t||t.startsWith("url(")));class vn{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:r=0,repeatDelay:o=0,repeatType:i="loop",...a}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=hn.now(),this.options={autoplay:t,delay:e,type:n,repeat:r,repeatDelay:o,repeatType:i,...a},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt}get resolved(){return this._resolved||this.hasAttemptedResolve||(Me(),Le()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=hn.now(),this.hasAttemptedResolve=!0;const{name:n,type:r,velocity:o,delay:i,onComplete:a,onUpdate:s,isGenerator:u}=this.options;if(!u&&!function(t,e,n,r){const o=t[0];if(null===o)return!1;if("display"===e||"visibility"===e)return!0;const i=t[t.length-1],a=yn(o,e),s=yn(i,e);return St(a===s,`You are trying to animate ${e} from "${o}" to "${i}". ${o} is not an animatable value - to enable this animation set ${o} to a value animatable to ${i} via the \`style\` property.`),!(!a||!s)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}(t)||"spring"===n&&r)}(t,n,r,o)){if(Wt||!i)return null==s||s(Yt(t,this.options,e)),null==a||a(),void this.resolveFinishedPromise();this.options.duration=0}const c=this.initPlayback(t,e);!1!==c&&(this._resolved={keyframes:t,finalKeyframe:e,...c},this.onPostResolved())}onPostResolved(){}then(t,e){return this.currentFinishedPromise.then(t,e)}updateFinishedPromise(){this.currentFinishedPromise=new Promise((t=>{this.resolveFinishedPromise=t}))}}function mn(t,e){return e?t*(1e3/e):0}const gn=5;function bn(t,e,n){const r=Math.max(e-gn,0);return mn(n-t(r),e-r)}const wn=.001,_n=.01,Sn=10,kn=.05,xn=1;function An({duration:t=800,bounce:e=.25,velocity:n=0,mass:r=1}){let o,i;St(t<=Dt(Sn),"Spring duration must be 10 seconds or less");let a=1-e;a=oe(kn,xn,a),t=oe(_n,Sn,Bt(t)),a<1?(o=e=>{const r=e*a,o=r*t,i=r-n,s=En(e,a),u=Math.exp(-o);return wn-i/s*u},i=e=>{const r=e*a*t,i=r*n+n,s=Math.pow(a,2)*Math.pow(e,2)*t,u=Math.exp(-r),c=En(Math.pow(e,2),a);return(-o(e)+wn>0?-1:1)*((i-s)*u)/c}):(o=e=>Math.exp(-e*t)*((e-n)*t+1)-wn,i=e=>Math.exp(-e*t)*(t*t*(n-e)));const s=function(t,e,n){let r=n;for(let n=1;n<Tn;n++)r-=t(r)/e(r);return r}(o,i,5/t);if(t=Dt(t),isNaN(s))return{stiffness:100,damping:10,duration:t};{const e=Math.pow(s,2)*r;return{stiffness:e,damping:2*a*Math.sqrt(r*e),duration:t}}}const Tn=12;function En(t,e){return t*Math.sqrt(1-e*e)}const On=["duration","bounce"],Pn=["stiffness","damping","mass"];function jn(t,e){return e.some((e=>void 0!==t[e]))}function Cn({keyframes:t,restDelta:e,restSpeed:n,...r}){const o=t[0],i=t[t.length-1],a={done:!1,value:o},{stiffness:s,damping:u,mass:c,duration:l,velocity:f,isResolvedFromDuration:p}=function(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!jn(t,Pn)&&jn(t,On)){const n=An(t);e={...e,...n,mass:1},e.isResolvedFromDuration=!0}return e}({...r,velocity:-Bt(r.velocity||0)}),d=f||0,h=u/(2*Math.sqrt(s*c)),y=i-o,v=Bt(Math.sqrt(s/c)),m=Math.abs(y)<5;let g;if(n||(n=m?.01:2),e||(e=m?.005:.5),h<1){const t=En(v,h);g=e=>{const n=Math.exp(-h*v*e);return i-n*((d+h*v*y)/t*Math.sin(t*e)+y*Math.cos(t*e))}}else if(1===h)g=t=>i-Math.exp(-v*t)*(y+(d+v*y)*t);else{const t=v*Math.sqrt(h*h-1);g=e=>{const n=Math.exp(-h*v*e),r=Math.min(t*e,300);return i-n*((d+h*v*y)*Math.sinh(r)+t*y*Math.cosh(r))/t}}return{calculatedDuration:p&&l||null,next:t=>{const r=g(t);if(p)a.done=t>=l;else{let o=0;h<1&&(o=0===t?Dt(d):bn(g,t,r));const s=Math.abs(o)<=n,u=Math.abs(i-r)<=e;a.done=s&&u}return a.value=a.done?i:r,a}}}function In({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:i=500,modifyTarget:a,min:s,max:u,restDelta:c=.5,restSpeed:l}){const f=t[0],p={done:!1,value:f},d=t=>void 0===s?u:void 0===u||Math.abs(s-t)<Math.abs(u-t)?s:u;let h=n*e;const y=f+h,v=void 0===a?y:a(y);v!==y&&(h=v-f);const m=t=>-h*Math.exp(-t/r),g=t=>v+m(t),b=t=>{const e=m(t),n=g(t);p.done=Math.abs(e)<=c,p.value=p.done?v:n};let w,_;const S=t=>{var e;(e=p.value,void 0!==s&&e<s||void 0!==u&&e>u)&&(w=t,_=Cn({keyframes:[p.value,d(p.value)],velocity:bn(g,t,p.value),damping:o,stiffness:i,restDelta:c,restSpeed:l}))};return S(0),{calculatedDuration:null,next:t=>{let e=!1;return _||void 0!==w||(e=!0,b(t),S(t)),void 0!==w&&t>=w?_.next(t-w):(!e&&b(t),p)}}}const Ln=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Mn=1e-7,Nn=12;function Rn(t,e,n,r){if(t===e&&n===r)return _t;const o=e=>function(t,e,n,r,o){let i,a,s=0;do{a=e+(n-e)/2,i=Ln(a,r,o)-t,i>0?n=a:e=a}while(Math.abs(i)>Mn&&++s<Nn);return a}(e,0,1,t,n);return t=>0===t||1===t?t:Ln(o(t),e,r)}const Fn=Rn(.42,0,1,1),Vn=Rn(0,0,.58,1),Dn=Rn(.42,0,.58,1),Bn=t=>Array.isArray(t)&&"number"!=typeof t[0],Gn=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Un=t=>e=>1-t(1-e),Hn=t=>1-Math.sin(Math.acos(t)),$n=Un(Hn),zn=Gn(Hn),Wn=Rn(.33,1.53,.69,.99),qn=Un(Wn),Yn={linear:_t,easeIn:Fn,easeInOut:Dn,easeOut:Vn,circIn:Hn,circInOut:zn,circOut:$n,backIn:qn,backInOut:Gn(qn),backOut:Wn,anticipate:t=>(t*=2)<1?.5*qn(t):.5*(2-Math.pow(2,-10*(t-1)))},Xn=t=>{if(Array.isArray(t)){kt(4===t.length,"Cubic bezier arrays must contain four numerical values.");const[e,n,r,o]=t;return Rn(e,n,r,o)}return"string"==typeof t?(kt(void 0!==Yn[t],`Invalid easing type '${t}'`),Yn[t]):t},Kn=(t,e)=>n=>e(t(n)),Zn=(...t)=>t.reduce(Kn),Qn=(t,e,n)=>{const r=e-t;return 0===r?1:(n-t)/r},Jn=(t,e,n)=>t+(e-t)*n;function tr(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function er(t,e){return n=>n>0?e:t}const nr=(t,e,n)=>{const r=t*t,o=n*(e*e-r)+r;return o<0?0:Math.sqrt(o)},rr=[Be,De,Ge];function or(t){const e=(n=t,rr.find((t=>t.test(n))));var n;if(St(Boolean(e),`'${t}' is not an animatable color. Use the equivalent color code instead.`),!Boolean(e))return!1;let r=e.parse(t);return e===Ge&&(r=function({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,n/=100;let o=0,i=0,a=0;if(e/=100){const r=n<.5?n*(1+e):n+e-n*e,s=2*n-r;o=tr(s,r,t+1/3),i=tr(s,r,t),a=tr(s,r,t-1/3)}else o=i=a=n;return{red:Math.round(255*o),green:Math.round(255*i),blue:Math.round(255*a),alpha:r}}(r)),r}const ir=(t,e)=>{const n=or(t),r=or(e);if(!n||!r)return er(t,e);const o={...n};return t=>(o.red=nr(n.red,r.red,t),o.green=nr(n.green,r.green,t),o.blue=nr(n.blue,r.blue,t),o.alpha=Jn(n.alpha,r.alpha,t),De.transform(o))},ar=new Set(["none","hidden"]);function sr(t,e){return n=>Jn(t,e,n)}function ur(t){return"number"==typeof t?sr:"string"==typeof t?te(t)?er:Ue.test(t)?ir:fr:Array.isArray(t)?cr:"object"==typeof t?Ue.test(t)?ir:lr:er}function cr(t,e){const n=[...t],r=n.length,o=t.map(((t,n)=>ur(t)(t,e[n])));return t=>{for(let e=0;e<r;e++)n[e]=o[e](t);return n}}function lr(t,e){const n={...t,...e},r={};for(const o in n)void 0!==t[o]&&void 0!==e[o]&&(r[o]=ur(t[o])(t[o],e[o]));return t=>{for(const e in r)n[e]=r[e](t);return n}}const fr=(t,e)=>{const n=Je.createTransformer(e),r=Xe(t),o=Xe(e);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?ar.has(t)&&!o.values.length||ar.has(e)&&!r.values.length?function(t,e){return ar.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):Zn(cr(function(t,e){var n;const r=[],o={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const a=e.types[i],s=t.indexes[a][o[a]],u=null!==(n=t.values[s])&&void 0!==n?n:0;r[i]=u,o[a]++}return r}(r,o),o.values),n):(St(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),er(t,e))};function pr(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return Jn(t,e,n);return ur(t)(t,e)}function dr(t,e,{clamp:n=!0,ease:r,mixer:o}={}){const i=t.length;if(kt(i===e.length,"Both input and output ranges must be the same length"),1===i)return()=>e[0];if(2===i&&t[0]===t[1])return()=>e[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const a=function(t,e,n){const r=[],o=n||pr,i=t.length-1;for(let n=0;n<i;n++){let i=o(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]||_t:e;i=Zn(t,i)}r.push(i)}return r}(e,r,o),s=a.length,u=e=>{let n=0;if(s>1)for(;n<t.length-2&&!(e<t[n+1]);n++);const r=Qn(t[n],t[n+1],e);return a[n](r)};return n?e=>u(oe(t[0],t[i-1],e)):u}function hr(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const o=Qn(0,e,r);t.push(Jn(n,1,o))}}function yr(t){const e=[0];return hr(e,t.length-1),e}function vr({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const o=Bn(r)?r.map(Xn):Xn(r),i={done:!1,value:e[0]},a=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:yr(e),t),s=dr(a,e,{ease:Array.isArray(o)?o:(u=e,c=o,u.map((()=>c||Dn)).splice(0,u.length-1))});var u,c;return{calculatedDuration:t,next:e=>(i.value=s(e),i.done=e>=t,i)}}const mr=2e4;function gr(t){let e=0;let n=t.next(e);for(;!n.done&&e<mr;)e+=50,n=t.next(e);return e>=mr?1/0:e}const br=t=>{const e=({timestamp:e})=>t(e);return{start:()=>jt.update(e,!0),stop:()=>Ct(e),now:()=>It.isProcessing?It.timestamp:hn.now()}},wr={decay:In,inertia:In,tween:vr,keyframes:vr,spring:Cn},_r=t=>t/100;class Sr extends vn{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.teardown();const{onStop:t}=this.options;t&&t()};const{name:e,motionValue:n,element:r,keyframes:o}=this.options,i=(null==r?void 0:r.KeyframeResolver)||Ne;this.resolver=new i(o,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}initPlayback(t){const{type:e="keyframes",repeat:n=0,repeatDelay:r=0,repeatType:o,velocity:i=0}=this.options,a=wr[e]||vr;let s,u;a!==vr&&"number"!=typeof t[0]&&(s=Zn(_r,pr(t[0],t[1])),t=[0,100]);const c=a({...this.options,keyframes:t});"mirror"===o&&(u=a({...this.options,keyframes:[...t].reverse(),velocity:-i})),null===c.calculatedDuration&&(c.calculatedDuration=gr(c));const{calculatedDuration:l}=c,f=l+r;return{generator:c,mirroredGenerator:u,mapPercentToKeyframes:s,calculatedDuration:l,resolvedDuration:f,totalDuration:f*(n+1)-r}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),"paused"!==this.pendingPlayState&&t?this.state=this.pendingPlayState:this.pause()}tick(t,e=!1){const{resolved:n}=this;if(!n){const{keyframes:t}=this.options;return{done:!0,value:t[t.length-1]}}const{finalKeyframe:r,generator:o,mirroredGenerator:i,mapPercentToKeyframes:a,keyframes:s,calculatedDuration:u,totalDuration:c,resolvedDuration:l}=n;if(null===this.startTime)return o.next(0);const{delay:f,repeat:p,repeatType:d,repeatDelay:h,onUpdate:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-c/this.speed,this.startTime)),e?this.currentTime=t:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const v=this.currentTime-f*(this.speed>=0?1:-1),m=this.speed>=0?v<0:v>c;this.currentTime=Math.max(v,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=c);let g=this.currentTime,b=o;if(p){const t=Math.min(this.currentTime,c)/l;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,p+1);Boolean(e%2)&&("reverse"===d?(n=1-n,h&&(n-=h/l)):"mirror"===d&&(b=i)),g=oe(0,1,n)*l}const w=m?{done:!1,value:s[0]}:b.next(g);a&&(w.value=a(w.value));let{done:_}=w;m||null===u||(_=this.speed>=0?this.currentTime>=c:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&_);return S&&void 0!==r&&(w.value=Yt(s,this.options,r)),y&&y(w.value),S&&this.finish(),w}get duration(){const{resolved:t}=this;return t?Bt(t.calculatedDuration):0}get time(){return Bt(this.currentTime)}set time(t){t=Dt(t),this.currentTime=t,null!==this.holdTime||0===this.speed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=Bt(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=br,onPlay:e,startTime:n}=this.options;this.driver||(this.driver=t((t=>this.tick(t)))),e&&e();const r=this.driver.now();null!==this.holdTime?this.startTime=r-this.holdTime:this.startTime?"finished"===this.state&&(this.startTime=r):this.startTime=null!=n?n:this.calcStartTime(),"finished"===this.state&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;this._resolved?(this.state="paused",this.holdTime=null!==(t=this.currentTime)&&void 0!==t?t:0):this.pendingPlayState="paused"}complete(){"running"!==this.state&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){null!==this.cancelTime&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const kr=new Set(["opacity","clipPath","filter","transform"]),xr=t=>Array.isArray(t)&&"number"==typeof t[0];function Ar(t){return Boolean(!t||"string"==typeof t&&t in Er||xr(t)||Array.isArray(t)&&t.every(Ar))}const Tr=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,Er={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Tr([0,.65,.55,1]),circOut:Tr([.55,0,1,.45]),backIn:Tr([.31,.01,.66,-.59]),backOut:Tr([.33,1.53,.69,.99])};function Or(t){return Pr(t)||Er.easeOut}function Pr(t){return t?xr(t)?Tr(t):Array.isArray(t)?t.map(Or):Er[t]:void 0}const jr=Mt((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));class Cr extends vn{constructor(t){super(t);const{name:e,motionValue:n,element:r,keyframes:o}=this.options;this.resolver=new fn(o,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}initPlayback(t,e){var n;let{duration:r=300,times:o,ease:i,type:a,motionValue:s,name:u,startTime:c}=this.options;if(!(null===(n=s.owner)||void 0===n?void 0:n.current))return!1;if(function(t){return"spring"===t.type||!Ar(t.ease)}(this.options)){const{onComplete:e,onUpdate:n,motionValue:s,element:u,...c}=this.options,l=function(t,e){const n=new Sr({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const o=[];let i=0;for(;!r.done&&i<2e4;)r=n.sample(i),o.push(r.value),i+=10;return{times:void 0,keyframes:o,duration:i-10,ease:"linear"}}(t,c);1===(t=l.keyframes).length&&(t[1]=t[0]),r=l.duration,o=l.times,i=l.ease,a="keyframes"}const l=function(t,e,n,{delay:r=0,duration:o=300,repeat:i=0,repeatType:a="loop",ease:s,times:u}={}){const c={[e]:n};u&&(c.offset=u);const l=Pr(s);return Array.isArray(l)&&(c.easing=l),t.animate(c,{delay:r,duration:o,easing:Array.isArray(l)?"linear":l,fill:"both",iterations:i+1,direction:"reverse"===a?"alternate":"normal"})}(s.owner.current,u,t,{...this.options,duration:r,times:o,ease:i});return l.startTime=null!=c?c:this.calcStartTime(),this.pendingTimeline?(l.timeline=this.pendingTimeline,this.pendingTimeline=void 0):l.onfinish=()=>{const{onComplete:n}=this.options;s.set(Yt(t,this.options,e)),n&&n(),this.cancel(),this.resolveFinishedPromise()},{animation:l,duration:r,times:o,type:a,ease:i,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:e}=t;return Bt(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return Bt(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.currentTime=Dt(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:e}=t;return e.playbackRate}set speed(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:e}=t;return e.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:e}=t;return e.startTime}attachTimeline(t){if(this._resolved){const{resolved:e}=this;if(!e)return _t;const{animation:n}=e;n.timeline=t,n.onfinish=null}else this.pendingTimeline=t;return _t}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:e}=t;"finished"===e.playState&&this.updateFinishedPromise(),e.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:e}=t;e.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:e,keyframes:n,duration:r,type:o,ease:i,times:a}=t;if("idle"===e.playState||"finished"===e.playState)return;if(this.time){const{motionValue:t,onUpdate:e,onComplete:s,element:u,...c}=this.options,l=new Sr({...c,keyframes:n,duration:r,type:o,ease:i,times:a,isGenerator:!0}),f=Dt(this.time);t.setWithVelocity(l.sample(f-10).value,l.sample(f).value,10)}const{onStop:s}=this.options;s&&s(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:e,name:n,repeatDelay:r,repeatType:o,damping:i,type:a}=t;return jr()&&n&&kr.has(n)&&e&&e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate&&!r&&"mirror"!==o&&0!==i&&"inertia"!==a}}const Ir=(t,e,n,r={},o,i,a)=>s=>{const u=zt(r,t)||{},c=u.delay||r.delay||0;let{elapsed:l=0}=r;l-=Dt(c);let f={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...u,delay:-l,onUpdate:t=>{e.set(t),u.onUpdate&&u.onUpdate(t)},onComplete:()=>{s(),u.onComplete&&u.onComplete(),a&&a()},onStop:a,name:t,motionValue:e,element:i?void 0:o};(function({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:o,repeat:i,repeatType:a,repeatDelay:s,from:u,elapsed:c,...l}){return!!Object.keys(l).length})(u)||(f={...f,...$t(t,f)}),f.duration&&(f.duration=Dt(f.duration)),f.repeatDelay&&(f.repeatDelay=Dt(f.repeatDelay)),void 0!==f.from&&(f.keyframes[0]=f.from);let p=!1;if((!1===f.type||0===f.duration&&!f.repeatDelay)&&(f.duration=0,0===f.delay&&(p=!0)),(Wt||Tt)&&(p=!0,f.duration=0,f.delay=0),p&&!i&&void 0!==e.get()){const t=Yt(f.keyframes,u);if(void 0!==t)return jt.update((()=>{f.onUpdate(t),f.onComplete()})),new Rt([])}return!i&&Cr.supports(f)?new Cr(f):new Sr(f)},Lr=t=>Array.isArray(t),Mr=t=>Boolean(t&&"object"==typeof t&&t.mix&&t.toValue),Nr=t=>Lr(t)?t[t.length-1]||0:t;function Rr(t,e){-1===t.indexOf(e)&&t.push(e)}function Fr(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class Vr{constructor(){this.subscriptions=[]}add(t){return Rr(this.subscriptions,t),()=>Fr(this.subscriptions,t)}notify(t,e,n){const r=this.subscriptions.length;if(r)if(1===r)this.subscriptions[0](t,e,n);else for(let o=0;o<r;o++){const r=this.subscriptions[o];r&&r(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Dr={current:void 0};class Br{constructor(t,e={}){this.version="11.5.4",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=hn.now();this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),e&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=hn.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new Vr);const n=this.events[t].add(e);return"change"===t?()=>{n(),jt.read((()=>{this.events.change.getSize()||this.stop()}))}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}setWithVelocity(t,e,n){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return Dr.current&&Dr.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=hn.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return mn(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise((e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()})).then((()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()}))}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Gr(t,e){return new Br(t,e)}function Ur(t){const e=[{},{}];return null==t||t.values.forEach(((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()})),e}function Hr(t,e,n,r){if("function"==typeof e){const[o,i]=Ur(r);e=e(void 0!==n?n:t.custom,o,i)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[o,i]=Ur(r);e=e(void 0!==n?n:t.custom,o,i)}return e}function $r(t,e,n){const r=t.getProps();return Hr(r,e,void 0!==n?n:r.custom,t)}function zr(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Gr(n))}const Wr=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),qr="data-"+Wr("framerAppearId");function Yr(t){return t.props[qr]}function Xr(t){return Vt.has(t)?"transform":kr.has(t)?Wr(t):void 0}class Kr extends Br{constructor(){super(...arguments),this.output=[],this.counts=new Map}add(t){const e=Xr(t);if(!e)return;const n=this.counts.get(e)||0;this.counts.set(e,n+1),0===n&&(this.output.push(e),this.update());let r=!1;return()=>{if(r)return;r=!0;const t=this.counts.get(e)-1;this.counts.set(e,t),0===t&&(Fr(this.output,e),this.update())}}update(){this.set(this.output.length?this.output.join(", "):"auto")}}const Zr=t=>Boolean(t&&t.getVelocity);function Qr(t,e){var n;if(!t.applyWillChange)return;let r=t.getValue("willChange");return r||(null===(n=t.props.style)||void 0===n?void 0:n.willChange)||(r=new Kr("auto"),t.addValue("willChange",r)),o=r,Boolean(Zr(o)&&o.add)?r.add(e):void 0;var o}function Jr({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,r}function to(t,e,{delay:n=0,transitionOverride:r,type:o}={}){var i;let{transition:a=t.getDefaultTransition(),transitionEnd:s,...u}=e;r&&(a=r);const c=[],l=o&&t.animationState&&t.animationState.getState()[o];for(const e in u){const r=t.getValue(e,null!==(i=t.latestValues[e])&&void 0!==i?i:null),o=u[e];if(void 0===o||l&&Jr(l,e))continue;const s={delay:n,...zt(a||{},e)};let f=!1;if(window.MotionHandoffAnimation){const n=Yr(t);if(n){const t=window.MotionHandoffAnimation(n,e,jt);null!==t&&(s.startTime=t,f=!0)}}r.start(Ir(e,r,o,t.shouldReduceMotion&&Vt.has(e)?{type:!1}:s,t,f,Qr(t,e)));const p=r.animation;p&&c.push(p)}return s&&Promise.all(c).then((()=>{jt.update((()=>{s&&function(t,e){const n=$r(t,e);let{transitionEnd:r={},transition:o={},...i}=n||{};i={...i,...r};for(const e in i)zr(t,e,Nr(i[e]))}(t,s)}))})),c}const eo={};function no(t,{layout:e,layoutId:n}){return Vt.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!eo[t]||"opacity"===t)}function ro(t,e,n){var r;const{style:o}=t,i={};for(const a in o)(Zr(o[a])||e.style&&Zr(e.style[a])||no(a,t)||void 0!==(null===(r=null==n?void 0:n.getValue(a))||void 0===r?void 0:r.liveStyle))&&(i[a]=o[a]);return n&&o&&"string"==typeof o.willChange&&(n.applyWillChange=!1),i}function oo(t,e,n){const r=ro(t,e,n);for(const n in t)if(Zr(t[n])||Zr(e[n])){r[-1!==Ft.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=t[n]}return r}const io="undefined"!=typeof window,ao={current:null},so={current:!1};function uo(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function co(t){return"string"==typeof t||Array.isArray(t)}const lo=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],fo=["initial",...lo];function po(t){return uo(t.animate)||fo.some((e=>co(t[e])))}function ho(t){return Boolean(po(t)||t.variants)}const yo={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},vo={};for(const t in yo)vo[t]={isEnabled:e=>yo[t].some((t=>!!e[t]))};const mo=[...Oe,Ue,Je],go=()=>({x:{min:0,max:0},y:{min:0,max:0}}),bo=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],wo=fo.length;class _o{scrapeMotionValuesFromProps(t,e,n){return{}}constructor({parent:t,props:e,presenceContext:n,reducedMotionConfig:r,blockInitialAnimation:o,visualState:i},a={}){this.applyWillChange=!1,this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Ne,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.isRenderScheduled=!1,this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.isRenderScheduled=!1,this.scheduleRender=()=>{this.isRenderScheduled||(this.isRenderScheduled=!0,jt.render(this.render,!1,!0))};const{latestValues:s,renderState:u}=i;this.latestValues=s,this.baseTarget={...s},this.initialValues=e.initial?{...s}:{},this.renderState=u,this.parent=t,this.props=e,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=r,this.options=a,this.blockInitialAnimation=Boolean(o),this.isControllingVariants=po(e),this.isVariantNode=ho(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:c,...l}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in l){const e=l[t];void 0!==s[t]&&Zr(e)&&e.set(s[t],!1)}}mount(t){this.current=t,At.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach(((t,e)=>this.bindToMotionValue(e,t))),so.current||function(){if(so.current=!0,io)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>ao.current=t.matches;t.addListener(e),e()}else ao.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||ao.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){At.delete(this.current),this.projection&&this.projection.unmount(),Ct(this.notifyUpdate),Ct(this.render),this.valueSubscriptions.forEach((t=>t())),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}bindToMotionValue(t,e){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const n=Vt.has(t),r=e.on("change",(e=>{this.latestValues[t]=e,this.props.onUpdate&&jt.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)})),o=e.on("renderRequest",this.scheduleRender);let i;window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,(()=>{r(),o(),i&&i(),e.owner&&e.stop()}))}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in vo){const e=vo[t];if(!e)continue;const{isEnabled:n,Feature:r}=e;if(!this.features[t]&&r&&n(this.props)&&(this.features[t]=new r(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<bo.length;e++){const n=bo[e];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);const r=t["on"+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=function(t,e,n){for(const r in e){const o=e[r],i=n[r];if(Zr(o))t.addValue(r,o);else if(Zr(i))t.addValue(r,Gr(o,{owner:t}));else if(i!==o)if(t.hasValue(r)){const e=t.getValue(r);!0===e.liveStyle?e.jump(o):e.hasAnimated||e.set(o)}else{const e=t.getStaticValue(r);t.addValue(r,Gr(void 0!==e?e:o,{owner:t}))}}for(const r in n)void 0===e[r]&&t.removeValue(r);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}getVariantContext(t=!1){if(t)return this.parent?this.parent.getVariantContext():void 0;if(!this.isControllingVariants){const t=this.parent&&this.parent.getVariantContext()||{};return void 0!==this.props.initial&&(t.initial=this.props.initial),t}const e={};for(let t=0;t<wo;t++){const n=fo[t],r=this.props[n];(co(r)||!1===r)&&(e[n]=r)}return e}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){const n=this.values.get(t);e!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return void 0===n&&void 0!==e&&(n=Gr(null===e?void 0:e,{owner:this}),this.addValue(t,n)),n}readValue(t,e){var n;let r=void 0===this.latestValues[t]&&this.current?null!==(n=this.getBaseTargetFromProps(this.props,t))&&void 0!==n?n:this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];var o;return null!=r&&("string"==typeof r&&(Kt(r)||Xt(r))?r=parseFloat(r):(o=r,!mo.find(Ee(o))&&Je.test(e)&&(r=cn(t,e))),this.setBaseTarget(t,Zr(r)?r.get():r)),Zr(r)?r.get():r}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){var e;const{initial:n}=this.props;let r;if("string"==typeof n||"object"==typeof n){const o=Hr(this.props,n,null===(e=this.presenceContext)||void 0===e?void 0:e.custom);o&&(r=o[t])}if(n&&void 0!==r)return r;const o=this.getBaseTargetFromProps(this.props,t);return void 0===o||Zr(o)?void 0!==this.initialValues[t]&&void 0===r?void 0:this.baseTarget[t]:o}on(t,e){return this.events[t]||(this.events[t]=new Vr),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class So extends _o{constructor(){super(...arguments),this.KeyframeResolver=fn}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){return t.style?t.style[e]:void 0}removeValueFromRenderState(t,{vars:e,style:n}){delete e[t],delete n[t]}}const ko=(t,e)=>e&&"number"==typeof t?e.transform(t):t,xo={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Ao=Ft.length;function To(t,e,n){const{style:r,vars:o,transformOrigin:i}=t;let a=!1,s=!1;for(const t in e){const n=e[t];if(Vt.has(t))a=!0;else if(Qt(t))o[t]=n;else{const e=ko(n,an[t]);t.startsWith("origin")?(s=!0,i[t]=e):r[t]=e}}if(e.transform||(a||n?r.transform=function(t,e,n){let r="",o=!0;for(let i=0;i<Ao;i++){const a=Ft[i],s=t[a];if(void 0===s)continue;let u=!0;if(u="number"==typeof s?s===(a.startsWith("scale")?1:0):0===parseFloat(s),!u||n){const t=ko(s,an[a]);u||(o=!1,r+=`${xo[a]||a}(${t}) `),n&&(e[a]=t)}}return r=r.trim(),n?r=n(e,o?"":r):o&&(r="none"),r}(e,t.transform,n):r.transform&&(r.transform="none")),s){const{originX:t="50%",originY:e="50%",originZ:n=0}=i;r.transformOrigin=`${t} ${e} ${n}`}}function Eo(t,e,n){return"string"==typeof t?t:ve.transform(e+n*t)}const Oo={offset:"stroke-dashoffset",array:"stroke-dasharray"},Po={offset:"strokeDashoffset",array:"strokeDasharray"};function jo(t,{attrX:e,attrY:n,attrScale:r,originX:o,originY:i,pathLength:a,pathSpacing:s=1,pathOffset:u=0,...c},l,f){if(To(t,c,f),l)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:p,style:d,dimensions:h}=t;p.transform&&(h&&(d.transform=p.transform),delete p.transform),h&&(void 0!==o||void 0!==i||d.transform)&&(d.transformOrigin=function(t,e,n){return`${Eo(e,t.x,t.width)} ${Eo(n,t.y,t.height)}`}(h,void 0!==o?o:.5,void 0!==i?i:.5)),void 0!==e&&(p.x=e),void 0!==n&&(p.y=n),void 0!==r&&(p.scale=r),void 0!==a&&function(t,e,n=1,r=0,o=!0){t.pathLength=1;const i=o?Oo:Po;t[i.offset]=ve.transform(-r);const a=ve.transform(e),s=ve.transform(n);t[i.array]=`${a} ${s}`}(p,a,s,u,!1)}const Co=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Io(t,{style:e,vars:n},r,o){Object.assign(t.style,e,o&&o.getProjectionStyles(r));for(const e in n)t.style.setProperty(e,n[e])}function Lo(t,e,n,r){Io(t,e,void 0,r);for(const n in e.attrs)t.setAttribute(Co.has(n)?n:Wr(n),e.attrs[n])}const Mo=t=>"string"==typeof t&&"svg"===t.toLowerCase();class No extends So{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=go}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(Vt.has(e)){const t=un(e);return t&&t.default||0}return e=Co.has(e)?e:Wr(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return oo(t,e,n)}build(t,e,n){jo(t,e,this.isSVGTag,n.transformTemplate)}renderInstance(t,e,n,r){Lo(t,e,0,r)}mount(t){this.isSVGTag=Mo(t.tagName),super.mount(t)}}function Ro(t,e){return function({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}(t.getBoundingClientRect(),e))}class Fo extends So{constructor(){super(...arguments),this.type="html",this.applyWillChange=!0,this.renderInstance=Io}readValueFromInstance(t,e){if(Vt.has(e)){const t=un(e);return t&&t.default||0}{const r=(n=t,window.getComputedStyle(n)),o=(Qt(e)?r.getPropertyValue(e):r[e])||0;return"string"==typeof o?o.trim():o}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return Ro(t,e)}build(t,e,n){To(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return ro(t,e,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Zr(t)&&(this.childSubscription=t.on("change",(t=>{this.current&&(this.current.textContent=`${t}`)})))}}function Vo(t){const e={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=function(t){return t instanceof SVGElement&&"svg"!==t.tagName}(t)?new No(e):new Fo(e);n.mount(t),At.set(t,n)}function Do(t,e,n){const r=Zr(t)?t:Gr(t);return r.start(Ir("",r,e,n)),r.animation}function Bo(t,e=100){const n=Cn({keyframes:[0,e],...t}),r=Math.min(gr(n),mr);return{type:"keyframes",ease:t=>n.next(r*t).value/e,duration:Bt(r)}}function Go(t,e,n,r){var o;return"number"==typeof e?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(o=r.get(e))&&void 0!==o?o:t}const Uo=(t,e,n)=>{const r=e-t;return((n-t)%r+r)%r+t};function Ho(t,e){return Bn(t)?t[Uo(0,t.length,e)]:t}function $o(t,e,n,r,o,i){!function(t,e,n){for(let r=0;r<t.length;r++){const o=t[r];o.at>e&&o.at<n&&(Fr(t,o),r--)}}(t,o,i);for(let a=0;a<e.length;a++)t.push({value:e[a],at:Jn(o,i,r[a]),easing:Ho(n,a)})}function zo(t,e){return t.at===e.at?null===t.value?1:null===e.value?-1:0:t.at-e.at}const Wo="easeInOut";function qo(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function Yo(t,e){return e[t]||(e[t]=[]),e[t]}function Xo(t){return Array.isArray(t)?t:[t]}function Ko(t,e){return t[e]?{...t,...t[e]}:{...t}}const Zo=t=>"number"==typeof t,Qo=t=>t.every(Zo);function Jo(t,e,n,r){const o=xt(t,r),i=o.length;kt(Boolean(i),"No valid element provided.");const a=[];for(let t=0;t<i;t++){const r=o[t];At.has(r)||Vo(r);const s=At.get(r),u={...n};"function"==typeof u.delay&&(u.delay=u.delay(t,i)),a.push(...to(s,{...e,transition:u},{}))}return new Rt(a)}function ti(t,e,n){const r=[],o=function(t,{defaultTransition:e={},...n}={},r){const o=e.duration||.3,i=new Map,a=new Map,s={},u=new Map;let c=0,l=0,f=0;for(let n=0;n<t.length;n++){const i=t[n];if("string"==typeof i){u.set(i,l);continue}if(!Array.isArray(i)){u.set(i.name,Go(l,i.at,c,u));continue}let[p,d,h={}]=i;void 0!==h.at&&(l=Go(l,h.at,c,u));let y=0;const v=(t,n,r,i=0,a=0)=>{const s=Xo(t),{delay:u=0,times:c=yr(s),type:p="keyframes",...d}=n;let{ease:h=e.ease||"easeOut",duration:v}=n;const m="function"==typeof u?u(i,a):u,g=s.length;if(g<=2&&"spring"===p){let t=100;if(2===g&&Qo(s)){const e=s[1]-s[0];t=Math.abs(e)}const e={...d};void 0!==v&&(e.duration=Dt(v));const n=Bo(e,t);h=n.ease,v=n.duration}null!=v||(v=o);const b=l+m,w=b+v;1===c.length&&0===c[0]&&(c[1]=1);const _=c.length-s.length;_>0&&hr(c,_),1===s.length&&s.unshift(null),$o(r,s,h,c,b,w),y=Math.max(m+v,y),f=Math.max(w,f)};if(Zr(p))v(d,h,Yo("default",qo(p,a)));else{const t=xt(p,r,s),e=t.length;for(let n=0;n<e;n++){const r=qo(t[n],a);for(const t in d)v(d[t],Ko(h,t),Yo(t,r),n,e)}}c=l,l+=y}return a.forEach(((t,r)=>{for(const o in t){const a=t[o];a.sort(zo);const s=[],u=[],c=[];for(let t=0;t<a.length;t++){const{at:e,value:n,easing:r}=a[t];s.push(n),u.push(Qn(0,f,e)),c.push(r||"easeOut")}0!==u[0]&&(u.unshift(0),s.unshift(s[0]),c.unshift(Wo)),1!==u[u.length-1]&&(u.push(1),s.push(null)),i.has(r)||i.set(r,{keyframes:{},transition:{}});const l=i.get(r);l.keyframes[o]=s,l.transition[o]={...e,duration:f,ease:c,times:u,...n}}})),i}(t,e,n);return o.forEach((({keyframes:t,transition:e},n)=>{let o;o=Zr(n)?Do(n,t.default,e.default):Jo(n,t,e),r.push(o)})),new Rt(r)}const ei=function(t,e,n){let r;var o;return o=t,r=Array.isArray(o)&&Array.isArray(o[0])?ti(t,e,ni):function(t){return"object"==typeof t&&!Array.isArray(t)}(e)?Jo(t,e,n,ni):Do(t,e,n),ni&&ni.animations.push(r),r};var ni;function ri(t){return ri="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ri(t)}function oi(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */oi=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",d="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==ri(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function T(e,n,r){var o=p;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:d,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(ri(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function ii(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=si(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function ai(t){return function(t){if(Array.isArray(t))return ui(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||si(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function si(t,e){if(t){if("string"==typeof t)return ui(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ui(t,e):void 0}}function ui(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ci(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,fi(r.key),r)}}function li(t,e,n){return(e=fi(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function fi(t){var e=function(t,e){if("object"!=ri(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ri(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ri(e)?e:e+""}var pi=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},di=li(li(li({},ct.left,"25.33%"),ct.center,"50%"),ct.right,"75.66%"),hi=function(){function t(e,n){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.sequences=[],this.control=null,this.transformers={},Array.isArray(e)){var r;(r=this.sequences).push.apply(r,ai(e)),this.sequenceOptions=Object.assign({},t.defaultSequenceOptions,n||{})}else{var o=e,i=n||t.defaultOptions;this.sequences.push({props:o,options:i||{}}),this.sequenceOptions=Object.assign({},t.defaultSequenceOptions)}}return function(t,e,n){return e&&ci(t.prototype,e),n&&ci(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"animate",value:function(e,n,r,o){var i=e.scope,a=e.overwrites,s=e.image;return pi(this,void 0,void 0,oi().mark((function e(){var r=this;return oi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){pi(r,void 0,void 0,oi().mark((function r(){var u,c,l,f,p=this;return oi().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:this.sequenceOptions.sync||(e(),o&&o(s.state)),u=0;case 2:if(!(u<this.sequenceOptions.repeat)){r.next=22;break}c=ii(this.sequences),r.prev=4,f=oi().mark((function e(){var r,o,u,c,f,h;return oi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=l.value,o=r.props,u=r.options,c=d({},p.propToCSS(n,s.state)),i.current){e.next=4;break}throw new Error("No scope found when animating.");case 4:if(f=i.current,Object.assign(f.style,c),s.state=t.mergeState(s.state,o),h=ei(f,p.propToCSS(n,s.state,a),p.optionsToFramerMotionOptions(u)||{}),p.setControl(h),!1!==(null==u?void 0:u.sync)){e.next=13;break}h.then((function(){Object.assign(f.style,p.propToCSS(n,s.state,a)),p.setControl(null)})),e.next=17;break;case 13:return e.next=15,new Promise((function(t){return h.then((function(){return t()}))}));case 15:Object.assign(f.style,p.propToCSS(n,s.state,a)),p.setControl(null);case 17:case"end":return e.stop()}}),e)})),c.s();case 7:if((l=c.n()).done){r.next=11;break}return r.delegateYield(f(),"t0",9);case 9:r.next=7;break;case 11:r.next=16;break;case 13:r.prev=13,r.t1=r.catch(4),c.e(r.t1);case 16:return r.prev=16,c.f(),r.finish(16);case 19:u++,r.next=2;break;case 22:return r.next=24,b(2);case 24:this.setControl(null),this.sequenceOptions.sync&&(e(),o&&o(s.state));case 26:case"end":return r.stop()}}),r,this,[[4,13,16,19]])})))})));case 1:case"end":return e.stop()}}),e)})))}},{key:"repeat",value:function(t){return this.sequenceOptions.repeat*=t,this}},{key:"overwrite",value:function(t,e){return this.transformers[t]=e,this}},{key:"propToCSS",value:function(e,n,r){var o,i=(null===(o=e.getLastScene())||void 0===o?void 0:o.config)||{},a=i.invertY,s=i.invertX,u={position:function(e){return t.positionToCSS(e,a,s)},backgroundColor:function(e){return t.backgroundToCSS(e)},backgroundOpacity:function(t){return{opacity:t}},opacity:function(t){return{opacity:t}},scale:function(){return"scale"in n?{width:"".concat(100*n.scale,"%")}:{}},rotation:function(){return{}},display:function(){return{}},src:function(){return{}}},c={};for(var l in c.transform=this.propToCSSTransform(e,n),this.transformers.transform&&Object.assign(c,this.transformers.transform(n)),r&&r.transform&&Object.assign(c,r.transform(n)),n)Object.prototype.hasOwnProperty.call(n,l)&&(r&&r[l]?Object.assign(c,r[l](n[l])):this.transformers[l]?Object.assign(c,this.transformers[l](n[l])):u[l]&&Object.assign(c,u[l](n[l])));return c}},{key:"optionsToFramerMotionOptions",value:function(t){if(!t)return t;var e=t.duration;return{duration:e?e/1e3:0,ease:t.ease}}},{key:"propToCSSTransform",value:function(t,e){var n;if(!t.getLastScene())throw new Error('No scene found in state, make sure you called "scene.activate()" before this method.');var r=(null===(n=t.getLastScene())||void 0===n?void 0:n.config)||{},o=r.invertY,i=r.invertX;return["translate(".concat(i?"":"-","50%, ").concat(o?"":"-","50%)"),void 0!==e.rotation&&"rotate(".concat(e.rotation,"deg)")].filter(Boolean).join(" ")}},{key:"setControl",value:function(t){return this.control=t,this}},{key:"getControl",value:function(){return this.control}},{key:"copy",value:function(){return new t(this.sequences,this.sequenceOptions)}}],[{key:"isPosition",value:function(t){return gt.isCommonPositionType(t)||bt.isCoord2DPosition(t)||wt.isAlignPosition(t)}},{key:"positionToCSS",value:function(t,e,n){return mt.D2PositionToCSS(t.toCSS(),n,e)}},{key:"backgroundToCSS",value:function(t){return null==t?{}:Aa.isStaticImageData(t)?{backgroundImage:"url(".concat(t.src,")")}:"string"==typeof t?{backgroundColor:t}:["r","g","b"].every((function(e){return e in t}))?{backgroundColor:v(t)}:{backgroundImage:"url("+t.url+")"}}},{key:"mergePosition",value:function(t,e){if(!t&&!e)throw new Error("No position found.");return t&&e?mt.mergePosition(mt.tryParsePosition(t),mt.tryParsePosition(e)):mt.toCoord2D(mt.tryParsePosition(t||e))}},{key:"mergeState",value:function(t,e){var n=this.mergePosition(t.position,e.position);return Object.assign(Object.assign({},d(t,e)),{position:n})}}])}();function yi(t){return yi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yi(t)}function vi(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,mi(r.key),r)}}function mi(t){var e=function(t,e){if("object"!=yi(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=yi(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==yi(e)?e:e+""}function gi(t,e,n){return e=wi(e),function(t,e){if(e&&("object"==yi(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,bi()?Reflect.construct(e,n||[],wi(t).constructor):e.apply(t,n))}function bi(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(bi=function(){return!!t})()}function wi(t){return wi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wi(t)}function _i(t,e){return _i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_i(t,e)}hi.defaultSequenceOptions={sync:!0,repeat:1},hi.defaultOptions={duration:0,ease:"linear"},hi.CommonImagePositionMap=di;var Si=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),gi(this,e)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_i(t,e)}(e,t),function(t,e,n){return e&&vi(t.prototype,e),n&&vi(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"do",value:function(t){return this.push(da.ActionTypes.do,t)}},{key:"doAsync",value:function(t){return this.push(da.ActionTypes.doAsync,t)}},{key:"any",value:function(t){return this.push(da.ActionTypes.any,t)}},{key:"all",value:function(t){return this.push(da.ActionTypes.all,t)}},{key:"allAsync",value:function(t){return this.push(da.ActionTypes.allAsync,t)}},{key:"repeat",value:function(t,e){return this.push(da.ActionTypes.repeat,e,t)}},{key:"push",value:function(t,e){for(var n=Q.toActions(e),r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];var a=new da(this.chain(),t,(new M).setContent([this.construct(n)].concat(o)));return this.chain(a)}}],[{key:"do",value:function(t){return(new e).do(t)}},{key:"doAsync",value:function(t){return(new e).doAsync(t)}},{key:"any",value:function(t){return(new e).any(t)}},{key:"all",value:function(t){return(new e).all(t)}},{key:"allAsync",value:function(t){return(new e).allAsync(t)}},{key:"repeat",value:function(t,n){return(new e).repeat(t,n)}}])}(ut);function ki(t){return ki="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ki(t)}function xi(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ai(r.key),r)}}function Ai(t){var e=function(t,e){if("object"!=ki(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ki(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ki(e)?e:e+""}function Ti(t,e,n){return e=Oi(e),function(t,e){if(e&&("object"==ki(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ei()?Reflect.construct(e,n||[],Oi(t).constructor):e.apply(t,n))}function Ei(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ei=function(){return!!t})()}function Oi(t){return Oi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Oi(t)}function Pi(t,e){return Pi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Pi(t,e)}var ji=function(t){function e(t,n){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(r=Ti(this,e)).events=new m,r.ref=void 0,"string"==typeof t?(r.name=t,r.config=d(e.defaultConfig,n||{}),r.config.position&&(r.config.position=mt.tryParsePosition(r.config.position))):(r.name="",r.config=d(e.defaultConfig,t),r.config.position&&(r.config.position=mt.tryParsePosition(r.config.position))),r.state=d({},r.config),r.checkConfig(),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Pi(t,e)}(e,t),function(t,e,n){return e&&xi(t.prototype,e),n&&xi(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"dispose",value:function(){return this._dispose()}},{key:"init",value:function(){return this.chain(this._init())}},{key:"checkConfig",value:function(){if(!this.config.src)throw new Error("Image src is required");if(!hi.isPosition(this.config.position))throw new Error("Invalid position\nPosition must be one of CommonImagePosition, Align, Coord2D");return this}},{key:"setSrc",value:function(t,e){var n=this;return this.combineActions(new Si,(function(r){if(e){var o=e.copy();o.setSrc(Aa.srcToString(t)),r._transitionSrc(o)}var i=new ua(r,ua.ActionTypes.setSrc,(new M).setContent(["string"==typeof t?t:Aa.staticImageDataToSrc(t)]));return r.chain(i).chain(n._flush())}))}},{key:"applyTransform",value:function(t){var e=this;return this.combineActions(new Si,(function(n){var r=new ua(n,ua.ActionTypes.applyTransform,(new M).setContent([void 0,t,g()]));return n.chain(r).chain(e._flush())}))}},{key:"show",value:function(t){var e=this,n=t instanceof hi?t:new hi([{props:{opacity:1},options:t||{}}]);return this.combineActions(new Si,(function(t){var r=new ua(t,ua.ActionTypes.show,(new M).setContent([void 0,n]));return t.chain(r).chain(e._flush())}))}},{key:"hide",value:function(t){var e=this;return this.combineActions(new Si,(function(n){var r=new ua(n,ua.ActionTypes.hide,(new M).setContent([void 0,t instanceof hi?t:new hi([{props:{opacity:0},options:t||{}}])]));return n.chain(r).chain(e._flush())}))}},{key:"toTransform",value:function(){return new hi(this.state,{duration:0})}},{key:"setScope",value:function(t){return this.ref=t,this}},{key:"getScope",value:function(){return this.ref}},{key:"copy",value:function(){return new e(this.name,this.config)}},{key:"toData",value:function(){return this.state.disposed||w(this.state,this.config)?null:{state:d({},e.serializeImageState(this.state))}}},{key:"fromData",value:function(t){return this.state=d(this.state,e.deserializeImageState(t.state)),this}},{key:"_$setDispose",value:function(){return this.state.disposed=!0,this}},{key:"_applyTransition",value:function(t){return this.chain(new ua(this.chain(),"image:applyTransition",(new M).setContent([t])))}},{key:"_init",value:function(t){return new ua(this.chain(),ua.ActionTypes.init,(new M).setContent([t]))}},{key:"_flush",value:function(){return new ua(this.chain(),ua.ActionTypes.flush,new M)}},{key:"reset",value:function(){this.state=d({},this.config)}},{key:"_transitionSrc",value:function(t){var e=t.copy();return this._applyTransition(e),this}},{key:"_dispose",value:function(){return this.chain(new ua(this.chain(),ua.ActionTypes.dispose,new M))}}],[{key:"serializeImageState",value:function(t){var e={position:function(t){return mt.serializePosition(t)}},n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=e[r]?e[r](t[r]):t[r]);return n}},{key:"deserializeImageState",value:function(t){var e={position:function(t){return mt.toCoord2D(t)}},n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=e[r]?e[r](t[r]):t[r]);return n}}])}(ut);function Ci(t){return Ci="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ci(t)}function Ii(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Li(r.key),r)}}function Li(t){var e=function(t,e){if("object"!=Ci(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ci(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ci(e)?e:e+""}ji.EventTypes={"event:image.show":"event:image.show","event:image.hide":"event:image.hide","event:image.init":"event:image.init","event:image.applyTransform":"event:image.applyTransform","event:image.mount":"event:image.mount","event:image.unmount":"event:image.unmount","event:image.ready":"event:image.ready","event:image.elementLoaded":"event:image.elementLoaded","event:image.applyTransition":"event:image.applyTransition","event:image.flush":"event:image.flush","event:image.flushComponent":"event:image.flushComponent"},ji.defaultConfig={src:"",display:!1,position:new gt(st.Center),scale:1,rotation:0,opacity:0},ji.ImagePosition=ct;var Mi=function(){return function(t,e,n){return e&&Ii(t.prototype,e),n&&Ii(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e,n,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.callee=e,this.type=n,this.contentNode=r,this.__stack=g(),this._id=""}),[{key:"executeAction",value:function(t){return{type:this.type,node:this.contentNode.getChild()}}},{key:"getId",value:function(){return this._id}},{key:"setId",value:function(t){this._id=t}},{key:"getFutureActions",value:function(){var t=this.contentNode.getChild();return t&&t.action?[t.action]:[]}}])}();Mi.ActionTypes={action:"action"};var Ni={say:"character:say",action:"character:action"},Ri={action:"scene:action",setBackground:"scene:setBackground",sleep:"scene:sleep",setTransition:"scene:setTransition",applyTransition:"scene:applyTransition",init:"scene:init",exit:"scene:exit",jumpTo:"scene:jumpTo",setBackgroundMusic:"scene:setBackgroundMusic",preUnmount:"scene:preUnmount",applyTransform:"scene:applyTransform"},Fi={action:"image:action",setSrc:"image:setSrc",setPosition:"image:setPosition",show:"image:show",hide:"image:hide",applyTransform:"image:applyTransform",init:"image:init",dispose:"image:dispose",setTransition:"image:setTransition",applyTransition:"image:applyTransition",flush:"image:flush"},Vi={action:"sound:action",play:"sound:play",stop:"sound:stop",fade:"sound:fade",setVolume:"sound:setVolume",setRate:"sound:setRate",pause:"sound:pause",resume:"sound:resume"},Di={action:"control:action",do:"control:do",doAsync:"control:doAsync",any:"control:any",all:"control:all",allAsync:"control:allAsync",repeat:"control:repeat"};function Bi(t){return Bi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bi(t)}function Gi(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=zi(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function Ui(t){return function(t){if(Array.isArray(t))return Wi(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||zi(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Hi(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Hi=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",d="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==Bi(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function T(e,n,r){var o=p;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:d,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(Bi(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function $i(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||zi(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zi(t,e){if(t){if("string"==typeof t)return Wi(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wi(t,e):void 0}}function Wi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function qi(t,e,n,r){var o=Yi(ea(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function Yi(){return Yi="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=ea(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},Yi.apply(null,arguments)}function Xi(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ki(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Qi(r.key),r)}}function Zi(t,e,n){return e&&Ki(t.prototype,e),n&&Ki(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Qi(t){var e=function(t,e){if("object"!=Bi(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Bi(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Bi(e)?e:e+""}function Ji(t,e,n){return e=ea(e),function(t,e){if(e&&("object"==Bi(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ta()?Reflect.construct(e,n||[],ea(t).constructor):e.apply(t,n))}function ta(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ta=function(){return!!t})()}function ea(t){return ea=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ea(t)}function na(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ra(t,e)}function ra(t,e){return ra=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ra(t,e)}var oa=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},ia=function(t){function e(t,n,r){var o;return Xi(this,e),(o=Ji(this,e,[t,n,r])).callee=t.getSelf(),o.contentNode.action=o,o}return na(e,t),Zi(e,[{key:"unknownType",value:function(){throw new Error("Unknown action type: "+this.type)}}])}(Mi),aa=function(t){function e(){return Xi(this,e),Ji(this,e,arguments)}return na(e,t),Zi(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===Ni.say){var r=new h((function(t){return t})).registerSkipController(new k((function(){return{type:n.type,node:n.contentNode.getChild()}}))),o=this.contentNode.getContent();return t.createText(this.getId(),o,(function(){r.resolve({type:n.type,node:n.contentNode.getChild()})})),r}throw qi(e,"unknownType",this,3)([])}}])}(ia);aa.ActionTypes=Ni;var sa=function(t){function e(){return Xi(this,e),Ji(this,e,arguments)}return na(e,t),Zi(e,[{key:"executeAction",value:function(t){var n,r=this;if(this.type===Ri.action)return qi(e,"executeAction",this,3)([t]);if(this.type===Ri.setBackground)return this.callee.state.background=this.contentNode.getContent()[0],qi(e,"executeAction",this,3)([t]);if(this.type===Ri.sleep){var o=new h((function(t){return t})),i=this.contentNode.getContent();return new Promise((function(t){"number"==typeof i?setTimeout((function(){t()}),i):h.isAwaitable(i)?i.then(t):null==i||i.then(t)})).then((function(){o.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),o}if(this.type===Ri.applyTransition){var a=(new h).registerSkipController(new k((function(){return t.logger.info("NarraLeaf-React: Background Transition","Skipped"),{type:r.type,node:r.contentNode.getChild()}}))),s=this.contentNode.getContent()[0];return this.callee.events.any("event:scene.applyTransition",s).then((function(){a.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),a}if(this.type===Ri.init){var u=new h((function(t){return t}));return e.handleSceneInit(this,t,u)}if(this.type===Ri.exit){this.callee._liveState.active=!1,t.offSrcManager(this.callee.srcManager).removeScene(this.callee);var c=new h((function(t){return t}));return this.callee.events.once("event:scene.unmount",(function(){c.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),c}if(this.type===Ri.jumpTo){var l=this.contentNode.getContent()[0],f=this.contentNode,p=(null===(n=l.sceneRoot)||void 0===n?void 0:n.contentNode)||null;return p&&f.addChild(p),qi(e,"executeAction",this,3)([t])}if(this.type===Ri.setBackgroundMusic){var d=$i(this.contentNode.getContent(),2),y=d[0],v=d[1];return this.callee.events.emit("event:scene.setBackgroundMusic",y,v||0),qi(e,"executeAction",this,3)([t])}if(this.type===Ri.preUnmount)return this.callee.events.emit("event:scene.preUnmount"),qi(e,"executeAction",this,3)([t]);if(this.type===Ri.applyTransform){var m=$i(this.contentNode.getContent(),1)[0],g=new h((function(t){return t})).registerSkipController(new k((function(){return{type:r.type,node:r.contentNode.getChild()}})));return this.callee.events.any("event:scene.applyTransform",m).then((function(){g.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),g}throw new Error("Unknown scene action type: "+this.type)}},{key:"getFutureActions",value:function(){var t,e,n;if(this.type===Ri.jumpTo){var r=null===(e=null===(t=this.contentNode.getContent()[0])||void 0===t?void 0:t.sceneRoot)||void 0===e?void 0:e.contentNode;return(null==r?void 0:r.action)?[r.action]:[]}var o=null===(n=this.contentNode.getChild())||void 0===n?void 0:n.action;return o?[o]:[]}}],[{key:"handleSceneInit",value:function(t,n,r){return t.callee._liveState.active?{type:t.type,node:t.contentNode.getChild()}:(t.callee._liveState.active=!0,n.registerSrcManager(t.callee.srcManager).addScene(t.callee),e.registerEventListeners(t.callee,n,(function(){r.resolve({type:t.type,node:t.contentNode.getChild()}),n.stage.next()})),r)}},{key:"registerEventListeners",value:function(t,e,n){t.events.once("event:scene.unmount",(function(){e.offSrcManager(t.srcManager)})),t.events.once("event:scene.mount",(function(){t.state.backgroundMusic&&(pa.initSound(e,t.state.backgroundMusic),t.events.emit("event:scene.setBackgroundMusic",t.state.backgroundMusic,t.config.backgroundMusicFade))})),t.events.once("event:scene.imageLoaded",(function(){var e=t.getInitTransform();t.events.any("event:scene.initTransform",e).then((function(){n&&n()}))}))}}])}(ia);sa.ActionTypes=Ri,(function(t){function e(){return Xi(this,e),Ji(this,e,arguments)}return na(e,t),Zi(e)}(ia)).ActionTypes={action:"story:action"};var ua=function(t){function e(){return Xi(this,e),Ji(this,e,arguments)}return na(e,t),Zi(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===Fi.init){var r=t.findElementByImage(this.callee);r&&t.disposeImage(this.callee,r.scene);var o=this.contentNode.getContent()[0];t.createImage(this.callee,o);var i=new h((function(t){return t}));return this.callee.events.once("event:image.mount",(function(){return oa(n,void 0,void 0,Hi().mark((function e(){var n;return Hi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(n=this.callee.getScope())||void 0===n?void 0:n.current){e.next=3;break}return e.next=3,this.callee.events.any(ji.EventTypes["event:image.elementLoaded"]);case 3:return e.next=5,this.callee.events.any("event:image.init");case 5:i.resolve({type:this.type,node:this.contentNode.getChild()}),t.stage.next();case 7:case"end":return e.stop()}}),e,this)})))})),i}if(this.type===Fi.setSrc)return this.callee.state.src=this.contentNode.getContent()[0],t.logger.debug("Image - Set Src",this.callee.state.src),t.stage.update(),qi(e,"executeAction",this,3)([t]);if([Fi.show,Fi.hide,Fi.applyTransform].includes(this.type)){var a=new h((function(t){return t})).registerSkipController(new k((function(){return n.type===Fi.hide&&(n.callee.state.display=!1),qi(e,"executeAction",n,3)([t])}))),s=this.contentNode.getContent()[1];return this.type===Fi.show&&(this.callee.state.display=!0,t.stage.update()),t.animateImage(ji.EventTypes["event:image.applyTransform"],this.callee,[s],(function(){var t;n.type===Fi.hide&&(n.callee.state.display=!1),a.resolve({type:n.type,node:null===(t=n.contentNode)||void 0===t?void 0:t.getChild()})})),a}if(this.type===Fi.dispose)return t.disposeImage(this.callee),this.callee._$setDispose(),qi(e,"executeAction",this,3)([t]);if(this.type===Fi.applyTransition){var u=new h((function(t){return t})).registerSkipController(new k((function(){return n.type===Fi.hide&&(n.callee.state.display=!1),{type:n.type,node:n.contentNode.getChild()}}))),c=this.contentNode.getContent()[0];return this.callee.events.any("event:image.applyTransition",c).then((function(){u.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),u}if(this.type===Fi.flush){var l=new h((function(t){return t}));return this.callee.events.any("event:image.flushComponent").then((function(){l.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),l}throw qi(e,"unknownType",this,3)([])}}])}(ia);ua.ActionTypes=Fi;var ca=function(t){function e(){return Xi(this,e),Ji(this,e,arguments)}return na(e,t),Zi(e,[{key:"executeAction",value:function(t){var e,n,r=this.callee.evaluate(this.contentNode.getContent(),{gameState:t});return null===(e=null==r?void 0:r[r.length-1])||void 0===e||e.contentNode.addChild(this.contentNode.getChild()),this.contentNode.addChild((null===(n=null==r?void 0:r[0])||void 0===n?void 0:n.contentNode)||null),{type:this.type,node:this.contentNode.getChild()}}},{key:"getFutureActions",value:function(){return[].concat(Ui(this.callee._getFutureActions()),Ui(qi(e,"getFutureActions",this,3)([])))}}])}(ia);ca.ActionTypes={action:"condition:action"};var la=function(t){function e(){return Xi(this,e),Ji(this,e,arguments)}return na(e,t),Zi(e,[{key:"executeAction",value:function(t){return this.contentNode.getContent().execute({gameState:t}),qi(e,"executeAction",this,3)([t])}}])}(ia);la.ActionTypes={action:"script:action"};var fa=function(t){function e(){return Xi(this,e),Ji(this,e,arguments)}return na(e,t),Zi(e,[{key:"executeAction",value:function(t){var e=this,n=new h((function(t){return t})),r=this.contentNode.getContent();return t.createMenu(r,(function(r){var o,i,a=(null===(o=t.game.getLiveGame().getCurrentAction())||void 0===o?void 0:o.contentNode.getChild())||null;a&&(null===(i=r.action[r.action.length-1])||void 0===i||i.contentNode.addChild(a)),n.resolve({type:e.type,node:r.action[0].contentNode})})),n}},{key:"getFutureActions",value:function(){var t=this.contentNode.getContent();return[].concat(Ui(this.callee._getFutureActions(t.choices)),Ui(qi(e,"getFutureActions",this,3)([])))}}])}(ia);fa.ActionTypes={action:"menu:action"};var pa=function(t){function e(){return Xi(this,e),Ji(this,e,arguments)}return na(e,t),Zi(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===Vi.play){if(e.initSound(t,this.callee),!this.callee.$getHowl())throw new Error("Howl is not initialized");if(this.callee.config.sync&&!this.callee.config.loop){var r=new h((function(t){return t})),o=t.playSound(this.callee.$getHowl(),(function(){var t;n.callee.$stop(),r.resolve({type:n.type,node:null===(t=n.contentNode)||void 0===t?void 0:t.getChild()})}));return this.callee.$setToken(o),r}var i=t.playSound(this.callee.$getHowl(),(function(){n.callee.$stop()}));return this.callee.$setToken(i),qi(e,"executeAction",this,3)([t])}if(this.type===Vi.stop)return this.callee.$getHowl()&&(this.callee.$getHowl().stop(),this.callee.$stop()),qi(e,"executeAction",this,3)([t]);if(this.type===Vi.fade){var a=$i(this.contentNode.getContent(),1)[0],s=a.start,u=a.end,c=a.duration;if(this.callee.$getHowl()){var l=void 0===s?this.callee.$getHowl().volume():s;this.callee.$getHowl().fade(l,u,c,this.callee.$getToken())}return qi(e,"executeAction",this,3)([t])}if(this.type===Vi.setVolume){var f=$i(this.contentNode.getContent(),1)[0];return this.callee.$getHowl()&&this.callee.$getHowl().volume(f,this.callee.$getToken()),qi(e,"executeAction",this,3)([t])}if(this.type===Vi.setRate){var p=$i(this.contentNode.getContent(),1)[0];return this.callee.$getHowl()&&this.callee.$getHowl().rate(p,this.callee.$getToken()),qi(e,"executeAction",this,3)([t])}if(this.type===Vi.pause)return this.callee.$getHowl()&&this.callee.$getHowl().pause(this.callee.$getToken()),qi(e,"executeAction",this,3)([t]);if(this.type===Vi.resume)return this.callee.$getHowl()&&this.callee.$getHowl().play(this.callee.$getToken()),qi(e,"executeAction",this,3)([t]);throw qi(e,"unknownType",this,3)([])}}],[{key:"initSound",value:function(t,e){e.$getHowl()||e.$setHowl(new(t.getHowl())(e.getHowlOptions()))}}])}(ia);pa.ActionTypes=Vi;var da=function(t){function e(){return Xi(this,e),Ji(this,e,arguments)}return na(e,t),Zi(e,[{key:"executeAllActions",value:function(t,e){return oa(this,void 0,void 0,Hi().mark((function n(){var r,o,i;return Hi().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:r=!1,o=e,i=Hi().mark((function e(){var n,r,i;return Hi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.game.getLiveGame().executeAction(t,o),t.logger.debug("Control - Next Action",n),n){e.next=4;break}return e.abrupt("return",0);case 4:if(!h.isAwaitable(n)){e.next=16;break}return e.next=7,new Promise((function(t){n.then((function(e){return t(n.result)}))}));case 7:if(r=e.sent,!(i=r.node)){e.next=13;break}o=i.action,e.next=14;break;case 13:return e.abrupt("return",0);case 14:e.next=17;break;case 16:o=n;case 17:case"end":return e.stop()}}),e)}));case 3:if(r||!o){n.next=10;break}return n.delegateYield(i(),"t0",5);case 5:if(0!==n.t0){n.next=8;break}return n.abrupt("break",10);case 8:n.next=3;break;case 10:case"end":return n.stop()}}),n)})))}},{key:"executeSingleAction",value:function(t,e){return oa(this,void 0,void 0,Hi().mark((function n(){var r,o,i;return Hi().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=t.game.getLiveGame().executeAction(t,e),!h.isAwaitable(r)){n.next=9;break}return n.next=4,new Promise((function(t){r.then((function(e){return t(r.result)}))}));case 4:return o=n.sent,i=o.node,n.abrupt("return",i);case 9:return n.abrupt("return",r);case 10:case"end":return n.stop()}}),n)})))}},{key:"execute",value:function(t,n,r){var o=this;return r.length>0?(this.executeAllActions(t,r[0]).then((function(){n.resolve({type:o.type,node:o.contentNode.getChild()}),t.stage.next()})),n):qi(e,"executeAction",this,3)([t])}},{key:"executeAction",value:function(t){var n=this,r=$i(this.contentNode.getContent(),1)[0];if(this.type===Di.do){var o=new h((function(t){return t}));return this.execute(t,o,r)}if(this.type===Di.doAsync)return oa(n,void 0,void 0,Hi().mark((function e(){return Hi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r.length>0)){e.next=3;break}return e.next=3,this.executeAllActions(t,r[0]);case 3:case"end":return e.stop()}}),e,this)}))),qi(e,"executeAction",this,3)([t]);if(this.type===Di.any){var i=new h((function(t){return t})),a=r.map((function(e){return n.executeSingleAction(t,e)}));return Promise.any(a).then((function(){i.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),i}if(this.type===Di.all){var s=new h((function(t){return t}));return oa(n,void 0,void 0,Hi().mark((function e(){var n=this;return Hi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(r.map((function(e){return n.executeSingleAction(t,e)})));case 2:s.resolve({type:this.type,node:this.contentNode.getChild()}),t.stage.next();case 4:case"end":return e.stop()}}),e,this)}))),s}if(this.type===Di.allAsync)return oa(n,void 0,void 0,Hi().mark((function e(){var n,o,i;return Hi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=Gi(r);try{for(n.s();!(o=n.n()).done;)i=o.value,this.executeSingleAction(t,i).then((function(t){}))}catch(t){n.e(t)}finally{n.f()}case 2:case"end":return e.stop()}}),e,this)}))),qi(e,"executeAction",this,3)([t]);if(this.type===Di.repeat){var u=$i(this.contentNode.getContent(),2),c=u[0],l=u[1],f=new h((function(t){return t}));return oa(n,void 0,void 0,Hi().mark((function e(){var n;return Hi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=0;case 1:if(!(n<l)){e.next=8;break}if(!(c.length>0)){e.next=5;break}return e.next=5,this.executeAllActions(t,c[0]);case 5:n++,e.next=1;break;case 8:f.resolve({type:this.type,node:this.contentNode.getChild()}),t.stage.next();case 10:case"end":return e.stop()}}),e,this)}))),f}throw new Error("Unknown control action type: "+this.type)}},{key:"getFutureActions",value:function(){var t=this.contentNode.getContent()[0],n=qi(e,"getFutureActions",this,3)([]);return[].concat(Ui(t),Ui(n))}}])}(ia);function ha(t){return ha="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ha(t)}function ya(t,e,n){return e=wa(e),function(t,e){if(e&&("object"==ha(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ga()?Reflect.construct(e,n||[],wa(t).constructor):e.apply(t,n))}function va(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ba(t,e)}function ma(t){var e="function"==typeof Map?new Map:void 0;return ma=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(ga())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var o=new(t.bind.apply(t,r));return n&&ba(o,n.prototype),o}(t,arguments,wa(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ba(n,t)},ma(t)}function ga(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ga=function(){return!!t})()}function ba(t,e){return ba=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ba(t,e)}function wa(t){return wa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wa(t)}function _a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Sa(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,xa(r.key),r)}}function ka(t,e,n){return e&&Sa(t.prototype,e),n&&Sa(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function xa(t){var e=function(t,e){if("object"!=ha(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ha(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ha(e)?e:e+""}da.ActionTypes=Di;var Aa=function(){function t(){_a(this,t)}return ka(t,null,[{key:"srcToString",value:function(t){return"string"==typeof t?t:t.src}},{key:"staticImageDataToSrc",value:function(t){return"string"==typeof t?t:t.src}},{key:"isStaticImageData",value:function(t){return void 0!==(null==t?void 0:t.src)}},{key:"backgroundToSrc",value:function(e){return t.isStaticImageData(e)?e.src:(null==e?void 0:e.url)||null}},{key:"isExternalSrc",value:function(t){return t.startsWith("http://")||t.startsWith("https://")}}])}(),Ta=function(t){function e(t,n){return _a(this,e),ya(this,e,[t,{info:n},"NarraLeafReact-StaticScriptWarning"])}return va(e,t),ka(e,null,[{key:"isWarning",value:function(t){return t instanceof e}}])}(function(t){function e(t,n){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"UseError";return _a(this,e),(r=ya(this,e,[t])).props=n,r.name=o,r}return va(e,t),ka(e,null,[{key:"isUseError",value:function(t){return t instanceof e}}])}(ma(Error))),Ea=function(){return ka((function t(e){_a(this,t),this.scene=e}),[{key:"run",value:function(){if(!this.scene.sceneRoot)return null;var t=new Map,e=new Map,n=[],r=new Set,o=this.scene.getAllChildren(this.scene.sceneRoot);if(!o.length)return null;for(n.push(o[0]);n.length;){var i=n.shift();this.checkAction(i,{imageStates:t,scenes:e},r);var a=i.contentNode.getChild();a&&a.action&&n.push(a.action)}return t}},{key:"checkAction",value:function(t,e,n){var r=e.imageStates,o=e.scenes;if(t instanceof ua)r.has(t.callee)||r.set(t.callee,{isDisposed:!1,usedExternalSrc:!1}),this.checkImage(r.get(t.callee),t);else if(t instanceof sa){var i=t.callee;if(o.has(i.name)){if(o.get(i.name)!==i){var a="Scene with name: ".concat(i.name," is duplicated\nScene: ").concat(i.name,"\n\nAt: ").concat(t.__stack);throw new Ta(a)}}else o.set(i.name,i);if(t.type===Ri.jumpTo){var s=t.contentNode.getContent()[0];if(n.has(s))return;n.add(s)}}}},{key:"checkImage",value:function(t,e){if(e.type===Fi.dispose){if(t.isDisposed){var n="Image is disposed multiple times before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new Ta(n)}t.isDisposed=!0}else if([Fi.init,Fi.show,Fi.hide,Fi.applyTransform,Fi.applyTransition].includes(e.type)){if(t.isDisposed){var r="Image is disposed before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new Ta(r)}}else if(e.type===Fi.setSrc){var o=e.contentNode.getContent()[0];Aa.isExternalSrc(o)&&(t.usedExternalSrc=!0)}}}])}();function Oa(t){return Oa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Oa(t)}function Pa(t,e,n){return e=Ca(e),function(t,e){if(e&&("object"==Oa(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ja()?Reflect.construct(e,n||[],Ca(t).constructor):e.apply(t,n))}function ja(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ja=function(){return!!t})()}function Ca(t){return Ca=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ca(t)}function Ia(t,e){return Ia=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ia(t,e)}function La(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ma(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ra(r.key),r)}}function Na(t,e,n){return e&&Ma(t.prototype,e),n&&Ma(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ra(t){var e=function(t,e){if("object"!=Oa(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Oa(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Oa(e)?e:e+""}var Fa=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};La(this,t),this.character=e,this.text=this.format(n),this.config=d(t.defaultConfig,r),this.state=y(t.defaultState)}return Na(t,[{key:"format",value:function(t){var e=[];if(Array.isArray(t))for(var n=0;n<t.length;n++)Da.isWord(t[n])?e.push(t[n]):e.push(new Da(t[n]));else e.push(Da.isWord(t)?t:new Da(t));return e}},{key:"toData",value:function(){return w(this.state,t.defaultState)?null:{state:y(this.state)}}},{key:"fromData",value:function(t){return this.state=d(this.state,t),this}},{key:"toString",value:function(){return this.text.map((function(t){return t.text})).join("")}}],[{key:"isSentence",value:function(e){return e instanceof t}},{key:"toSentence",value:function(e){return t.isSentence(e)?e:new t(null,e)}}])}();Fa.defaultConfig={color:"#000",pause:!0,voice:null},Fa.defaultState={display:!0};var Va,Da=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};La(this,t),this.text=e,this.config=d(t.defaultConfig,n)}return Na(t,null,[{key:"isWord",value:function(e){return e instanceof t}}])}();Da.defaultConfig={},Da.defaultColor="#000",function(t){t.adv="adv",t.nvl="nvl"}(Va||(Va={}));var Ba=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return La(this,e),(n=Pa(this,e)).name=t,n.config=d({},e.defaultConfig,r),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ia(t,e)}(e,t),Na(e,[{key:"say",value:function(t){var e=Array.isArray(t)?new Fa(this,t,{}):Fa.isSentence(t)?t:new Fa(this,t,{}),n=new aa(this.chain(),aa.ActionTypes.say,(new M).setContent(e));return this.chain(n)}}])}(ut);function Ga(t){return Ga="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ga(t)}function Ua(t){return function(t){if(Array.isArray(t))return $a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Ha(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ha(t,e){if(t){if("string"==typeof t)return $a(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$a(t,e):void 0}}function $a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function za(t,e,n){return e=qa(e),function(t,e){if(e&&("object"==Ga(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Wa()?Reflect.construct(e,n||[],qa(t).constructor):e.apply(t,n))}function Wa(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Wa=function(){return!!t})()}function qa(t){return qa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},qa(t)}function Ya(t,e){return Ya=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ya(t,e)}function Xa(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ka(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Qa(r.key),r)}}function Za(t,e,n){return e&&Ka(t.prototype,e),n&&Ka(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Qa(t){var e=function(t,e){if("object"!=Ga(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ga(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ga(e)?e:e+""}Ba.Modes=Va,Ba.defaultConfig={mode:Va.adv};var Ja=function(){return Za((function t(e){Xa(this,t),this.handler=e}),[{key:"evaluate",value:function(t){var e=t.gameState;return{value:this.handler(this.getCtx({gameState:e}))}}},{key:"getCtx",value:function(t){var e=t.gameState;return{gameState:e,game:e.game,liveGame:e.game.getLiveGame(),storable:e.game.getLiveGame().getStorable()}}}])}(),ts=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Xa(this,e),(t=za(this,e)).conditions={If:{condition:null,action:null},ElseIf:[],Else:{action:null}},t.config=d(e.defaultConfig,n),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ya(t,e)}(e,t),Za(e,[{key:"If",value:function(t,e){if(this.conditions.If.condition)throw new Ta("IF condition already set\nYou are trying to set multiple IF conditions for the same condition");if(this.conditions.ElseIf.length)throw new Ta("ELSE-IF condition already set\nYou are trying to set an IF condition after an ELSE-IF condition");if(this.conditions.Else.action)throw new Ta("ELSE condition already set\nYou are trying to set an IF condition after an ELSE condition");return this.conditions.If.condition=t instanceof Ja?t:new Ja(t),this.conditions.If.action=this.construct(Array.isArray(e)?e:[e]),this.chain()}},{key:"ElseIf",value:function(t,e){if(!this.conditions.If.condition)throw new Ta("IF condition not set\nYou are trying to set an ELSE-IF condition without an IF condition");if(this.conditions.Else.action)throw new Ta("ELSE condition already set\nYou are trying to set an ELSE-IF condition after an ELSE condition");return this.conditions.ElseIf.push({condition:t instanceof Ja?t:new Ja(t),action:this.construct(Array.isArray(e)?e:[e])}),this.chain()}},{key:"Else",value:function(t){if(!this.conditions.If.condition)throw new Ta("IF condition not set\nYou are trying to set an ELSE condition without an IF condition");if(this.conditions.Else.action)throw new Ta("ELSE condition already set\nYou are trying to set multiple ELSE conditions for the same condition");return this.conditions.Else.action=this.construct(Array.isArray(t)?t:[t]),this.chain()}},{key:"evaluate",value:function(t,e){var n,r,o={gameState:e.gameState},i=null===(n=t.If.condition)||void 0===n?void 0:n.evaluate(o);if(null==i?void 0:i.value)return t.If.action||null;var a,s=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Ha(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}(t.ElseIf);try{for(s.s();!(a=s.n()).done;){var u=a.value,c=null===(r=u.condition)||void 0===r?void 0:r.evaluate(o);if(null==c?void 0:c.value)return u.action||null}}catch(t){s.e(t)}finally{s.f()}return t.Else.action||null}},{key:"fromChained",value:function(t){return[Reflect.construct(ca,[this,ca.ActionTypes.action,(new M).setContent(t.conditions)])]}},{key:"construct",value:function(t,e,n){for(var r,o=Q.toActions(t),i=0;i<o.length;i++){var a=o[i].contentNode,s=null===(r=o[i+1])||void 0===r?void 0:r.contentNode;s&&a.setChild(s),i===o.length-1&&e&&a.setChild(e),0===i&&n&&n.setChild(a)}return o}},{key:"_getFutureActions",value:function(){return Q.toActions([].concat(Ua(this.conditions.If.action||[]),Ua(this.conditions.ElseIf.flatMap((function(t){return t.action||[]}))),Ua(this.conditions.Else.action||[])))}}],[{key:"getInitialState",value:function(){return{If:{condition:null,action:null},ElseIf:[],Else:{action:null}}}}])}(ut);function es(t){return es="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},es(t)}function ns(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,rs(r.key),r)}}function rs(t){var e=function(t,e){if("object"!=es(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=es(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==es(e)?e:e+""}function os(t,e,n){return e=as(e),function(t,e){if(e&&("object"==es(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,is()?Reflect.construct(e,n||[],as(t).constructor):e.apply(t,n))}function is(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(is=function(){return!!t})()}function as(t){return as=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},as(t)}function ss(t,e){return ss=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ss(t,e)}ts.defaultConfig={};var us=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=os(this,e)).choices=[],n.prompt=Fa.isSentence(t)?t:new Fa(null,t),n.config=d(e.defaultConfig,r),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ss(t,e)}(e,t),function(t,e,n){return e&&ns(t.prototype,e),n&&ns(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"choose",value:function(t,e){var n=this.chain();return Fa.isSentence(t)&&e||(Da.isWord(t)||Array.isArray(t)||"string"==typeof t)&&e?n.choices.push({prompt:Fa.toSentence(t),action:Q.toActions(e)}):"object"===es(t)&&"prompt"in t&&"action"in t?n.choices.push({prompt:Fa.toSentence(t.prompt),action:Q.toActions(t.action)}):console.warn("No valid choice added to menu, ",{arg0:t,arg1:e}),n}},{key:"fromChained",value:function(t){return[new fa(this.chain(),fa.ActionTypes.action,(new M).setContent({prompt:this.prompt,choices:t.constructChoices()}))]}},{key:"_getFutureActions",value:function(t){return t.map((function(t){return t.action})).flat(2)}},{key:"constructNodes",value:function(t,e,n){for(var r,o=0;o<t.length;o++){var i=t[o].contentNode,a=null===(r=t[o+1])||void 0===r?void 0:r.contentNode;a&&i.setChild(a),o===this.choices.length-1&&e&&i.setChild(e),0===o&&n&&n.setChild(i)}return t}},{key:"constructChoices",value:function(){var t=this;return this.choices.map((function(e){return{action:t.constructNodes(e.action),prompt:e.prompt}}))}}])}(ut);function cs(t){return cs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cs(t)}function ls(t){return function(t){if(Array.isArray(t))return fs(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return fs(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fs(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fs(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ps(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ds(r.key),r)}}function ds(t){var e=function(t,e){if("object"!=cs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=cs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==cs(e)?e:e+""}function hs(t,e,n){return e=vs(e),function(t,e){if(e&&("object"==cs(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ys()?Reflect.construct(e,n||[],vs(t).constructor):e.apply(t,n))}function ys(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ys=function(){return!!t})()}function vs(t){return vs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vs(t)}function ms(t,e){return ms=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ms(t,e)}us.defaultConfig={},us.targetAction=fa;var gs,bs=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),hs(this,e)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ms(t,e)}(e,t),function(t,e,n){return e&&ps(t.prototype,e),n&&ps(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"fromChained",value:function(t){return t.getActions()}},{key:"forEachChild",value:function(t,e){var n=new Set,r=[];for(Array.isArray(t)?r.push.apply(r,ls(t)):r.push(t);r.length;){var o=r.shift();if(!n.has(o)){n.add(o),e(o);var i=o.getFutureActions().filter((function(t){return!n.has(t)}));r.push.apply(r,ls(i))}}}},{key:"getAllChildren",value:function(t){var e=[];return this.forEachChild(t,(function(t){return e.push(t)})),e}},{key:"getAllChildrenMap",value:function(t){var e=new Map;return this.forEachChild(t,(function(t){return e.set(t.getId(),t)})),e}},{key:"getAllElementMap",value:function(t){var e=new Map;return this.forEachChild(t,(function(t){return e.set(t.callee.getId(),t.callee)})),e}},{key:"getAllChildrenElements",value:function(t){return Array.from(new Set(this.getAllChildren(t).map((function(t){return t.callee}))))}},{key:"toData",value:function(){return null}},{key:"constructNodes",value:function(t,e){for(var n,r=0;r<t.length;r++){var o=t[r];0===r&&e?e.setChild(o.contentNode):r>0&&(null===(n=t[r-1].contentNode)||void 0===n||n.setChild(o.contentNode))}return t.length?t[0].contentNode:null}}])}(J);function ws(t){return ws="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ws(t)}function _s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ss(r.key),r)}}function Ss(t){var e=function(t,e){if("object"!=ws(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ws(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ws(e)?e:e+""}function ks(t,e,n){return e=As(e),function(t,e){if(e&&("object"==ws(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,xs()?Reflect.construct(e,n||[],As(t).constructor):e.apply(t,n))}function xs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(xs=function(){return!!t})()}function As(t){return As=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},As(t)}function Ts(t,e){return Ts=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ts(t,e)}!function(t){t.soundEffect="soundEffect",t.music="music",t.voice="voice",t.backgroundMusic="backgroundMusic"}(gs||(gs={}));var Es=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=ks(this,e)).state={playing:null,token:null},t.config=d(e.defaultConfig,n),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ts(t,e)}(e,t),function(t,e,n){return e&&_s(t.prototype,e),n&&_s(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"play",value:function(){if(this.config.type===gs.backgroundMusic)throw new Error("Background music cannot be played directly");return this.pushAction(pa.ActionTypes.play,[void 0])}},{key:"stop",value:function(){if(this.config.type===gs.backgroundMusic)throw new Error("Background music cannot be stopped directly");return this.pushAction(pa.ActionTypes.stop,[void 0])}},{key:"fade",value:function(t,e,n){if(this.config.type===gs.backgroundMusic)throw new Error("Background music cannot be faded directly");return this.pushAction(pa.ActionTypes.fade,[{start:t,end:e,duration:n}])}},{key:"setVolume",value:function(t){return this.pushAction(pa.ActionTypes.setVolume,[t])}},{key:"setRate",value:function(t){return this.pushAction(pa.ActionTypes.setRate,[t])}},{key:"pause",value:function(t){return void 0!==t?this.fade(void 0,0,t):this.pushAction(pa.ActionTypes.pause,[void 0])}},{key:"resume",value:function(t){return void 0!==t?this.fade(0,this.config.volume,t):this.pushAction(pa.ActionTypes.resume,[void 0])}},{key:"getHowlOptions",value:function(){return{src:this.config.src,loop:this.config.loop,volume:this.config.volume,html5:this.config.streaming,autoplay:!1}}},{key:"getSrc",value:function(){return this.config.src}},{key:"$setToken",value:function(t){this.state.token=t}},{key:"$getToken",value:function(){return this.state.token}},{key:"$setHowl",value:function(t){this.state.playing=t}},{key:"$getHowl",value:function(){return this.state.playing}},{key:"$stop",value:function(){this.$setToken(null),this.$setHowl(null)}},{key:"toData",value:function(){return w(this.config,e.defaultConfig)?null:{config:y(this.config)}}},{key:"fromData",value:function(t){return this.config=d(this.config,t.config),this}},{key:"reset",value:function(){var t;null===(t=this.state.playing)||void 0===t||t.stop(),this.state.playing=null,this.state.token=null}},{key:"pushAction",value:function(t,e){return this.chain(new pa(this.chain(),t,(new M).setContent(e)))}}])}(ut);function Os(t){return Os="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Os(t)}function Ps(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,js(r.key),r)}}function js(t){var e=function(t,e){if("object"!=Os(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Os(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Os(e)?e:e+""}Es.defaultConfig={src:"",sync:!1,loop:!1,volume:1};var Cs=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.src=[],this.future=[]}return function(t,e,n){return e&&Ps(t.prototype,e),n&&Ps(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"register",value:function(t,e){var n=this;if(Array.isArray(t))t.forEach((function(t){return n.register(t)}));else if(t instanceof Es){if(this.isSrcRegistered(t.getSrc()))return this;this.src.push({type:"audio",src:t})}else if(t instanceof ji||Aa.isStaticImageData(t)){if(t instanceof ji){if(this.isSrcRegistered(Aa.srcToString(t.state.src)))return this}else if(this.isSrcRegistered(Aa.srcToString(t.src)))return this;this.src.push({type:"image",src:t instanceof ji?t:new ji("",{src:Aa.staticImageDataToSrc(t)})})}else if("object"===Os(t)){if(this.isSrcRegistered(t.src||""))return this;this.src.push(t)}else if("audio"===t){if(this.isSrcRegistered(e||""))return this;this.src.push({type:t,src:e instanceof Es?e:new Es({src:e})})}else{if(this.isSrcRegistered(e||""))return this;this.src.push({type:t,src:e})}return this}},{key:"isSrcRegistered",value:function(e){var n=e instanceof Es?e.getSrc():e;return this.src.some((function(e){return e.type===t.SrcTypes.audio?n===e.src.getSrc():e.type===t.SrcTypes.image?n===Aa.srcToString(e.src.state.src):n===e.src}))}},{key:"getSrc",value:function(){return this.src}},{key:"getSrcByType",value:function(t){return this.src.filter((function(e){return e.type===t}))}},{key:"registerFuture",value:function(t){return this.future.includes(t)||this.hasFuture(t)||this.future.push(t),this}},{key:"hasFuture",value:function(t){return this.future.includes(t)}}])}();function Is(t){return Is="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Is(t)}function Ls(t){return function(t){if(Array.isArray(t))return Ms(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Ms(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ms(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ms(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ns(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Rs(r.key),r)}}function Rs(t){var e=function(t,e){if("object"!=Is(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Is(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Is(e)?e:e+""}function Fs(t,e,n){return e=Bs(e),function(t,e){if(e&&("object"==Is(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Vs()?Reflect.construct(e,n||[],Bs(t).constructor):e.apply(t,n))}function Vs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Vs=function(){return!!t})()}function Ds(){return Ds="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Bs(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},Ds.apply(null,arguments)}function Bs(t){return Bs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Bs(t)}function Gs(t,e){return Gs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Gs(t,e)}Cs.SrcTypes={image:"image",video:"video",audio:"audio"};var Us=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.defaultConfig;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=Fs(this,e)).srcManager=new Cs,n.events=new m,n._liveState={active:!1},n.name=t,n.config=d(e.defaultConfig,r),n.state=d(e.defaultState,n.config),n.backgroundImage=new ji({position:new gt(st.Center),opacity:1,src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="}),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Gs(t,e)}(e,t),function(t,e,n){return e&&Ns(t.prototype,e),n&&Ns(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"activate",value:function(){return this.chain(this._init(this))}},{key:"deactivate",value:function(){return this.chain(this._exit())}},{key:"setBackground",value:function(t,e){return this.combineActions(new Si,(function(n){if(e){var r=e.copy();r.setSrc(Aa.backgroundToSrc(t)),n._transitionToScene(void 0,r,t)}return n.chain(new sa(n,"scene:setBackground",(new M).setContent([t])))}))}},{key:"applyTransform",value:function(t){return this.chain(new sa(this.chain(),"scene:applyTransform",(new M).setContent([t])))}},{key:"jumpTo",value:function(t,e){var n=this;return this.combineActions(new Si,(function(r){var o=e||{};return r.chain(new sa(r,"scene:preUnmount",(new M).setContent([])))._transitionToScene(t,o.transition).chain(t._init()).chain(n._exit())._jumpTo(t)}))}},{key:"sleep",value:function(t){return this.chain(new sa(this.chain(),"scene:sleep",(new M).setContent(t)))}},{key:"setBackgroundMusic",value:function(t,e){return this.chain(new sa(this.chain(),Ri.setBackgroundMusic,(new M).setContent([t,e])))}},{key:"toData",value:function(){var t;return{state:Object.assign(Object.assign({},y(this.state)),{backgroundMusic:null===(t=this.state.backgroundMusic)||void 0===t?void 0:t.toData(),background:this.state.background}),backgroundImageState:this.backgroundImage.toData()}}},{key:"fromData",value:function(t){return this.state=d(this.state,t.state),t.state.backgroundMusic&&(this.state.backgroundMusic=(new Es).fromData(t.state.backgroundMusic),this.state.background=t.state.background),t.backgroundImageState&&this.backgroundImage.fromData(t.backgroundImageState),this}},{key:"getInitTransform",value:function(){return new hi([{props:Object.assign(Object.assign({},this.backgroundImage.state),{opacity:1}),options:{duration:0}}])}},{key:"action",value:function(t){var n=(Array.isArray(t)?t.flat(2):t(this).flat(2)).map((function(t){return Q.isChained(t)?t.fromChained(t):t})).flat(2),r=this.getAllChildrenElements(n).filter((function(t){return t instanceof ji&&!Q.isChained(t)})),o=[this._init(this)].concat(Ls(r.map((function(t){return t._init()}))),Ls(n)),i=function(t,e,n,r){var o=Ds(Bs(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"constructNodes",this,3)([o]),a=new M(void 0,void 0,i||void 0).setContent(this);return null==i||i.setParent(a),this.sceneRoot=new sa(this.chain(),"scene:action",a),this}},{key:"registerSrc",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Set;if(this.sceneRoot){var n=new Set,r=[this.sceneRoot],o=new Set;for(Aa.backgroundToSrc(this.config.background)&&this.srcManager.register(new ji({src:Aa.backgroundToSrc(this.config.background)}));r.length;){var i=r.shift();if(i instanceof sa){if(i.type===Ri.jumpTo){var a=i,s=a.contentNode.getContent()[0];if(n.has(a)||e.has(s))continue;n.add(a),o.add(s),e.add(s)}else if(i.type===Ri.setBackground){var u=i.contentNode.getContent()[0];this.srcManager.register(new ji({src:Aa.backgroundToSrc(u)}))}}else if(i instanceof ua){var c=i;if(this.srcManager.register(c.callee),i.type===Fi.setSrc){var l=i.contentNode.getContent()[0];this.srcManager.register(new ji({src:l}))}}else if(i instanceof pa)this.srcManager.register(i.callee);else if(i instanceof da){var f=i.getFutureActions();r.push.apply(r,Ls(f))}r.push.apply(r,Ls(i.getFutureActions()))}o.forEach((function(n){n.registerSrc(e),t.srcManager.registerFuture(n.srcManager)}))}}},{key:"assignActionId",value:function(){this.getAllChildren(this.sceneRoot||[]).forEach((function(t,e){t.setId("action-".concat(e))}))}},{key:"assignElementId",value:function(){this.getAllChildrenElements(this.sceneRoot||[]).forEach((function(t,e){t.setId("element-".concat(e))}))}},{key:"reset",value:function(){this.state=d(e.defaultState,this.config),this.backgroundImage.reset()}},{key:"_applyTransition",value:function(t){return this.chain(new sa(this.chain(),"scene:applyTransition",(new M).setContent([t])))}},{key:"_jumpTo",value:function(t){return this.chain(new sa(this.chain(),"scene:jumpTo",(new M).setContent([t])))}},{key:"_exit",value:function(){return new sa(this.chain(),"scene:exit",(new M).setContent([]))}},{key:"_transitionToScene",value:function(t,e,n){var r=this.chain();if(e){var o=e.copy();t&&o.setSrc(Aa.backgroundToSrc(t.state.background)),n&&o.setSrc(Aa.backgroundToSrc(n)),r._applyTransition(o)}return r}},{key:"_init",value:function(){return new sa((arguments.length>0&&void 0!==arguments[0]?arguments[0]:this).chain(),"scene:init",(new M).setContent([]))}}])}(bs);function Hs(t){return Hs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hs(t)}function $s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,zs(r.key),r)}}function zs(t){var e=function(t,e){if("object"!=Hs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Hs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Hs(e)?e:e+""}function Ws(t,e,n){return e=Xs(e),qs(t,Ys()?Reflect.construct(e,n||[],Xs(t).constructor):e.apply(t,n))}function qs(t,e){if(e&&("object"==Hs(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Ys(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ys=function(){return!!t})()}function Xs(t){return Xs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Xs(t)}function Ks(t,e){return Ks=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ks(t,e)}Us.EventTypes={"event:scene.applyTransition":"event:scene.applyTransition","event:scene.remove":"event:scene.remove","event:scene.load":"event:scene.load","event:scene.unload":"event:scene.unload","event:scene.mount":"event:scene.mount","event:scene.unmount":"event:scene.unmount","event:scene.preUnmount":"event:scene.preUnmount","event:scene.imageLoaded":"event:scene.imageLoaded","event:scene.initTransform":"event:scene.initTransform","event:scene.setBackgroundMusic":"event:scene.setBackgroundMusic","event:scene.applyTransform":"event:scene.applyTransform"},Us.defaultConfig={background:null,invertY:!1,invertX:!1,backgroundMusic:null,backgroundMusicFade:0},Us.defaultState={};var Zs=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=Ws(this,e)).handler=t,qs(n,n.chain())}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ks(t,e)}(e,t),function(t,e,n){return e&&$s(t.prototype,e),n&&$s(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"execute",value:function(t){var e=t.gameState;this.handler(this.getCtx({gameState:e}))}},{key:"getCtx",value:function(t){var e=t.gameState;return{gameState:e,game:e.game,liveGame:e.game.getLiveGame(),storable:e.game.getLiveGame().getStorable()}}},{key:"fromChained",value:function(t){return[new la(this.chain(),la.ActionTypes.action,(new M).setContent(t))]}}])}(ut);function Qs(t){return Qs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qs(t)}function Js(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,tu(r.key),r)}}function tu(t){var e=function(t,e){if("object"!=Qs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Qs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Qs(e)?e:e+""}function eu(t,e,n){return e=ru(e),function(t,e){if(e&&("object"==Qs(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,nu()?Reflect.construct(e,n||[],ru(t).constructor):e.apply(t,n))}function nu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(nu=function(){return!!t})()}function ru(t){return ru=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ru(t)}function ou(t,e){return ou=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ou(t,e)}var iu=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=eu(this,e)).entryScene=null,n.name=t,n.config=d(e.defaultConfig,r),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ou(t,e)}(e,t),function(t,e,n){return e&&Js(t.prototype,e),n&&Js(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"entry",value:function(t){return this.entryScene=t,this}},{key:"constructStory",value:function(){var t=this.entryScene;if(!t)throw new Error("Story must have an entry scene");return t.registerSrc(),t.assignActionId(),t.assignElementId(),this.runStaticCheck(t),this}},{key:"getAllElementStates",value:function(){var t;return this.getAllChildrenElements((null===(t=this.entryScene)||void 0===t?void 0:t.sceneRoot)||[]).map((function(t){return{id:t.getId(),data:t.toData()}})).filter((function(t){return!!t.data}))}},{key:"runStaticCheck",value:function(t){return new Ea(t).run()}}])}(bs);function au(t){return au="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},au(t)}function su(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return uu(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?uu(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function uu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function cu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function lu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,pu(r.key),r)}}function fu(t,e,n){return e&&lu(t.prototype,e),n&&lu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function pu(t){var e=function(t,e){if("object"!=au(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=au(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==au(e)?e:e+""}iu.defaultConfig={};var du=function(){function t(e,n,r){cu(this,t),this.name=e,this.key=r||e,this.content=d({},n)}return fu(t,[{key:"set",value:function(e,n){return t.isSerializable(n)?(this.content[e]=n,this):(console.warn('Value "'.concat(n,'" in key "').concat(String(e),'" is not serializable, and will not be set\nat namespace "').concat(this.name,'"')),this.content[e]=n,this)}},{key:"get",value:function(t){return this.content[t]}},{key:"toData",value:function(){return this.serialize()}},{key:"load",value:function(t){t?this.content=t:console.warn("No data to load")}},{key:"serialize",value:function(){var t=this,e={};return Object.entries(this.content).forEach((function(n){var r=su(n,2),o=r[0],i=r[1];e[o]=t.wrap(i)})),e}},{key:"deserialize",value:function(t){var e=this;t?Object.entries(t).forEach((function(t){var n=su(t,2),r=n[0],o=n[1];e.content[r]=e.unwrap(o)})):console.warn("No data to load")}},{key:"toTypeName",value:function(t){return t instanceof Date?"date":"any"}},{key:"wrap",value:function(t){return{any:function(t){return{type:"any",data:t}},date:function(t){return{type:"date",data:t.toString()}}}[this.toTypeName(t)](t)}},{key:"unwrap",value:function(t){var e={any:function(t){return t.data},date:function(t){return new Date(t.data)}};return e[t.type](t)}}],[{key:"isSerializable",value:function(e){return!!["number","string","boolean"].includes(au(e))||(e instanceof Date||(null==e||(Array.isArray(e)?e.every(t.isSerializable):"object"===au(e)&&(Object.getPrototypeOf(e)===Object.prototype&&Object.values(e).every(t.isSerializable)))))}}])}(),hu=function(){return fu((function t(){cu(this,t),this.namespaces={}}),[{key:"addNamespace",value:function(t){return this.namespaces[t.key]&&console.warn("Namespace ".concat(t.key," already exists")),this.namespaces[t.key]=t,this}},{key:"getNamespace",value:function(t){return this.namespaces[t]}},{key:"setNamespace",value:function(t,e){return this.namespaces[t]=e,this}},{key:"getNamespaces",value:function(){return this.namespaces}},{key:"keys",value:function(){return Object.keys(this.namespaces)}},{key:"values",value:function(){return Object.values(this.namespaces)}},{key:"entries",value:function(){return Object.entries(this.namespaces)}},{key:"toData",value:function(){return this.entries().reduce((function(t,e){var n=su(e,2),r=n[0],o=n[1];return t[r]=o.toData(),t}),{})}},{key:"load",value:function(t){var e=this;t?Object.entries(t).forEach((function(t){var n=su(t,2),r=n[0],o=n[1];e.namespaces[r]?e.namespaces[r].load(o):console.warn("Namespace ".concat(r," not found in ").concat(e.constructor.name))})):console.warn("No data to load")}},{key:"clear",value:function(){return this.namespaces={},this}}])}(),yu=o(196);function vu(t){return vu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vu(t)}function mu(t){return function(t){if(Array.isArray(t))return gu(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return gu(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gu(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function gu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function bu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,wu(r.key),r)}}function wu(t){var e=function(t,e){if("object"!=vu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=vu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==vu(e)?e:e+""}var _u=function(){return function(t,e,n){return e&&bu(t.prototype,e),n&&bu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state={sounds:[],srcManagers:[],elements:[]},this.currentHandling=null,this.stage=n,this.game=e,this.events=new m,this.logger=new S(e,"NarraLeaf-React")}),[{key:"findElementByScene",value:function(t){return this.state.elements.find((function(e){return e.scene===t}))||null}},{key:"findElementByImage",value:function(t){return this.state.elements.find((function(e){return e.ele.images.includes(t)}))||null}},{key:"addScene",value:function(t){return this.sceneExists(t)||this.state.elements.push({scene:t,ele:this.getElementMap()}),this}},{key:"popScene",value:function(){var t=this.state.elements.pop();return t?(this.removeElements(t.scene),this):this}},{key:"removeScene",value:function(t){return this.removeElements(t),this}},{key:"getSceneElements",value:function(){return this.state.elements}},{key:"getLastScene",value:function(){var t;return(null===(t=this.state.elements[this.state.elements.length-1])||void 0===t?void 0:t.scene)||null}},{key:"sceneExists",value:function(t){return t?this.state.elements.some((function(e){return e.scene===t})):!!this.getLastScene()}},{key:"handle",value:function(t){return this.currentHandling===t||(this.currentHandling=t,t.type),this}},{key:"createText",value:function(t,e,n,r){var o,i=null===(o=this.findElementByScene(this._getLastSceneIfNot(r)))||void 0===o?void 0:o.ele.texts;if(!i)throw new Error("Scene not found");var a=this.createWaitableAction({character:e.character,sentence:e,id:t},(function(){i.splice(i.indexOf(a),1),n&&n()}));i.push(a)}},{key:"createMenu",value:function(t,e,n){var r;if(!t.choices.length)throw new Error("Menu must have at least one choice");var o=null===(r=this.findElementByScene(this._getLastSceneIfNot(n)))||void 0===r?void 0:r.ele.menus;if(!o)throw new Error("Scene not found");var i=this.createWaitableAction(t,(function(t){o.splice(o.indexOf(i),1),e&&e(t)}));o.push(i)}},{key:"createImage",value:function(t,e){var n=this._getLastSceneIfNot(e),r=this.findElementByScene(n);return r?(r.ele.images.push(t),this):this}},{key:"disposeImage",value:function(t,e){var n,r=this._getLastSceneIfNot(e),o=null===(n=this.findElementByScene(r))||void 0===n?void 0:n.ele.images;if(!o)throw new Error("Scene not found");var i=o.indexOf(t);if(-1===i)throw new Error("Image not found");return o.splice(i,1),this}},{key:"forceReset",value:function(){var t=this;this.state.elements.forEach((function(e){var n=e.scene;t.offSrcManager(n.srcManager),n._liveState.active=!1,n.events.clear()})),this.state.elements=[],this.state.srcManagers=[]}},{key:"playSound",value:function(t,e){var n=t.play(),r=[t.once("end",o.bind(this)),t.once("stop",o.bind(this))];function o(){e&&e(),r.forEach((function(t){return t.off()})),this.stage.next()}return n}},{key:"getHowl",value:function(){return yu.Howl}},{key:"animateImage",value:function(t,e,n,r){return this.anyEvent.apply(this,[t,e,r].concat(mu(n)))}},{key:"registerSrcManager",value:function(t){return this.state.srcManagers.push(t),this}},{key:"offSrcManager",value:function(t){return this.state.srcManagers=this.state.srcManagers.filter((function(e){return e!==t})),this}},{key:"getStorable",value:function(){return this.game.getLiveGame().getStorable()}},{key:"toData",value:function(){return{scenes:this.state.elements.map((function(t){return{sceneId:t.scene.getId(),elements:{images:t.ele.images.map((function(t){return t.getId()}))}}}))}}},{key:"loadData",value:function(t,e){var n=this;if(this.state.elements=[],!this.game.getLiveGame().story)throw new Error("No story loaded");t.scenes.forEach((function(t){var r=t.sceneId,o=t.elements;n.logger.debug("Loading scene: "+r);var i=e.get(r);if(!i)throw new Error("Scene not found, id: "+r+"\nNarraLeaf cannot find the element with the id from the saved game");var a={scene:i,ele:{images:o.images.map((function(t){if(!e.has(t))throw new Error("Image not found, id: "+t+"\nNarraLeaf cannot find the element with the id from the saved game");return e.get(t)})),menus:[],texts:[]}};n.state.elements.push(a),n.registerSrcManager(i.srcManager),i._liveState.active=!0,sa.registerEventListeners(i,n)}))}},{key:"initScenes",value:function(){var t=this;this.state.elements.forEach((function(e){var n=e.scene;sa.registerEventListeners(n,t)}))}},{key:"getElementMap",value:function(){return{texts:[],menus:[],images:[]}}},{key:"removeElements",value:function(t){var e=this.state.elements.findIndex((function(e){return e.scene===t}));return-1===e||this.state.elements.splice(e,1),this}},{key:"_getLastSceneIfNot",value:function(t){var e=t||this.getLastScene();if(!e||!this.sceneExists(e))throw new Error('Scene not found, please call "scene.activate()" first.');return e}},{key:"anyEvent",value:function(t,e,n){for(var r,o=this,i=arguments.length,a=new Array(i>3?i-3:0),s=3;s<i;s++)a[s-3]=arguments[s];(r=e.events).any.apply(r,[t].concat(a)).then(n).then((function(){o.stage.next()}))}},{key:"createWaitableAction",value:function(t,e){return{action:t,onClick:function(t){e&&e(t)}}}}])}();function Su(t){var e,n,r="";if("string"==typeof t||"number"==typeof t)r+=t;else if("object"==typeof t)if(Array.isArray(t)){var o=t.length;for(e=0;e<o;e++)t[e]&&(n=Su(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}_u.EventTypes={"event:state.ready":"event:state.ready","event:state.end":"event:state.end","event:state.player.skip":"event:state.player.skip","event:state.preload.unmount":"event:state.preload.unmount","event:state.preload.loaded":"event:state.preload.loaded","event:state.player.flush":"event:state.player.flush"};const ku=function(){for(var t,e,n=0,r="",o=arguments.length;n<o;n++)(t=arguments[n])&&(e=Su(t))&&(r&&(r+=" "),r+=e);return r};var xu=o(12),Au=o.n(xu);function Tu(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Eu(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Eu(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Eu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ou(t){return Ou="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ou(t)}function Pu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ju(r.key),r)}}function ju(t){var e=function(t,e){if("object"!=Ou(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ou(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ou(e)?e:e+""}var Cu=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state={width:0,height:0,minWidth:800,minHeight:450,paused:!1},this.events=new m,this.lockers=[],this.updater=null}return function(t,e,n){return e&&Pu(t.prototype,e),n&&Pu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"update",value:function(e,n){this.state.width=e,this.state.height=n,this.events.emit(t.EventTypes["event:aspectRatio.update"],e,n)}},{key:"updateMin",value:function(t,e){this.state.minWidth=t,this.state.minHeight=e}},{key:"lock",value:function(){var t=Symbol();return this.lockers.push(t),t}},{key:"unlock",value:function(t){if(t&&!this.lockers.includes(t))throw new Error("Locker not found");return this.lockers=this.lockers.filter((function(e){return e!==t})),this.triggerUpdate(),null}},{key:"isLocked",value:function(){return!!this.lockers.length}},{key:"getStyle",value:function(){return{width:"".concat(this.state.width,"px"),height:"".concat(this.state.height,"px")}}},{key:"setUpdate",value:function(t){this.updater=t}},{key:"pause",value:function(){this.state.paused=!0,this.events.emit(t.EventTypes["event:aspectRatio.pause"])}},{key:"resume",value:function(){this.state.paused=!1,this.events.emit(t.EventTypes["event:aspectRatio.resume"])}},{key:"onUpdate",value:function(e){var n=this;return this.events.on(t.EventTypes["event:aspectRatio.update"],e),function(){n.events.off(t.EventTypes["event:aspectRatio.update"],e)}}},{key:"triggerUpdate",value:function(){this.updater&&this.updater()}}])}();Cu.EventTypes={"event:aspectRatio.update":"event:aspectRatio.update","event:aspectRatio.pause":"event:aspectRatio.pause","event:aspectRatio.resume":"event:aspectRatio.resume"};var Iu=(0,xu.createContext)(null);function Lu(t){var e=t.children,n=Tu((0,xu.useState)(new Cu),1)[0];return Au().createElement(Iu.Provider,{value:{ratio:n}},e)}function Mu(){var t=(0,xu.useContext)(Iu);if(!Iu||!t)throw new Error("useRatio must be used within a RatioProvider");var e=Tu((0,xu.useReducer)((function(t){return t+1}),0),2)[1],n=t.ratio;return(0,xu.useEffect)((function(){return n.onUpdate((function(){e()}))}),[]),t}function Nu(){return Nu=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Nu.apply(null,arguments)}function Ru(t){var e=t.children,n=t.className,r=t.props,o=t.ref,i=Mu().ratio,a=i.getStyle();return Au().createElement("div",{className:ku("inset-0 flex items-center justify-center",n),style:{width:"100%",height:"100%",minWidth:"".concat(i.state.minWidth,"px"),minHeight:"".concat(i.state.minHeight,"px")}},Au().createElement("div",Nu({style:Object.assign(Object.assign({},a),{position:"relative"})},r||{},{ref:o}),e))}function Fu(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Vu(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Vu(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Vu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}const Du=function(t){var e=t.text,n=t.speed,r=t.onComplete,o=t.className,i=Fu((0,xu.useState)(""),2),a=i[0],s=i[1],u=Fu((0,xu.useState)(0),2),c=u[0],l=u[1];return(0,xu.useEffect)((function(){if(c<e.length){if(" "!==e[c]){var t=setTimeout((function(){s((function(t){return t+e[c]})),l((function(t){return t+1}))}),n);return function(){return clearTimeout(t)}}s((function(t){return t+" "})),l((function(t){return t+1}))}else r&&r()}),[c,e,n,r]),Au().createElement("span",{className:o},a)};function Bu(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Gu(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Gu(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Gu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var Uu=Au().createContext(null);function Hu(t){var e=t.children,n=t.game,r=new nc({}),o=Bu((0,xu.useState)(n||r),2),i=o[0],a=o[1];return Au().createElement(Uu.Provider,{value:{game:i,setGame:a}},e)}function $u(){var t=(0,xu.useContext)(Uu);if(!t)throw new Error("useGame must be used within a GameProvider");return t}function zu(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Wu(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wu(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Wu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function qu(t){var e,n=t.action,r=t.onClick,o=t.useTypeEffect,i=void 0===o||o,a=t.className,s=t.state,u=n.sentence,c=n.character,l=zu((0,xu.useState)(0),2),f=l[0],p=l[1],d=zu((0,xu.useState)(!1),2),h=d[0],y=d[1],m=$u().game,g=function(){p((function(t){return t+1})),f===u.text.length-1&&y(!0)};return(0,xu.useEffect)((function(){if(window){var t=function(t){m.config.elements.say.nextKey.includes(t.key)&&(h?r&&r():y(!0))};return window.addEventListener("keyup",t),function(){window.removeEventListener("keyup",t)}}console.warn("Failed to add event listener, window is not available\nat Say.tsx: onElementClick")}),[h]),(0,xu.useEffect)((function(){var t=s.events.onEvents([{type:_u.EventTypes["event:state.player.skip"],listener:s.events.on(_u.EventTypes["event:state.player.skip"],(function(){s.logger.log("NarraLeaf-React: Say","Skipped"),y(!0),r&&r()}))}]);return function(){t.cancel()}})),Au().createElement(Ru,{className:"absolute"},u.state.display&&(c&&c.config.mode!==Ba.Modes.adv?Au().createElement(Au().Fragment,null," "):Au().createElement("div",{className:ku("absolute flex items-center justify-center bottom-0 w-[calc(100%-40px)] h-[calc(33%-40px)] m-4 bg-white",m.config.elementStyles.say.container,a),onClick:function(){h?r&&r():y(!0)}},Au().createElement("div",{className:ku("absolute top-0 left-0 p-1.25 rounded-br-md m-4",m.config.elementStyles.say.nameText)},(null===(e=u.character)||void 0===e?void 0:e.name)||""),Au().createElement("div",{className:ku("text-center max-w-[80%] mx-auto",m.config.elementStyles.say.textContainer)},u.text.map((function(t,e){var n=t.config.color||u.config.color||Da.defaultColor;return h?Au().createElement("span",{key:e,style:{color:"string"==typeof n?n:v(n)},className:ku(m.config.elementStyles.say.textSpan)},t.text):e>f?null:Au().createElement("span",{key:e,style:{color:v(n)},className:ku(m.config.elementStyles.say.textSpan)},i?Au().createElement(Du,{text:t.text,onComplete:e===f?g:void 0,speed:m.config.elements.say.textInterval,className:ku(m.config.elementStyles.say.textSpan)}):t.text)}))))))}function Yu(t){var e=t.sentence,n=t.className;return Au().createElement(Au().Fragment,null,e.text.map((function(t,r){var o=t.config.color||e.config.color||Da.defaultColor;return Au().createElement("span",{key:r,style:{color:v(o)},className:n},t.text)})))}var Xu,Ku={say:qu,menu:function(t){var e=t.prompt,n=t.choices,r=t.afterChoose,o=t.state,i=$u().game,a=i.config.elements.say.use;return Au().createElement(Au().Fragment,null,Au().createElement(Ru,{className:"absolute"},Au().createElement("div",{className:"absolute flex flex-col items-center justify-center min-w-full w-full h-full"},e&&Au().createElement(a,{state:o,action:{sentence:e,character:null},useTypeEffect:!1,className:"z-10"}))),Au().createElement(Ru,{className:"absolute"},Au().createElement("div",{className:ku("absolute flex flex-col items-center justify-center min-w-full w-full h-full",i.config.elementStyles.menu.container)},Au().createElement("div",{className:"p-4 rounded-lg w-full z-20"},Au().createElement("div",{className:"flex flex-col items-center mt-4 w-full"},n.map((function(t,e){return Au().createElement("button",{key:e,className:ku("bg-white text-black p-2 mt-2 w-1/2",i.config.elementStyles.menu.choiceButton),onClick:function(){return function(t){r(t)}(t)}},Au().createElement(Yu,{key:e,sentence:t.prompt,className:ku(i.config.elementStyles.menu.choiceButtonText)}))})))))))}};function Zu(t){return Zu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zu(t)}function Qu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ju(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ec(r.key),r)}}function tc(t,e,n){return e&&Ju(t.prototype,e),n&&Ju(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function ec(t){var e=function(t,e){if("object"!=Zu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Zu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Zu(e)?e:e+""}!function(t){t.game="game"}(Xu||(Xu={}));var nc=function(){return tc((function t(e){Qu(this,t),this.liveGame=null,this.config=d(t.DefaultConfig,e)}),[{key:"useComponent",value:function(t,e){if(!Object.keys(Ku).includes(t))throw new Error("Invalid key ".concat(t));if("function"!=typeof e)throw new Error("Invalid component for key ".concat(t));return this.config.elements[t].use=e,this}},{key:"getLiveGame",value:function(){if(!this.liveGame){var t=this.createLiveGame();return this.liveGame=t,t}return this.liveGame}},{key:"createLiveGame",value:function(){return new rc(this)}}])}();nc.defaultSettings={volume:1},nc.ComponentTypes={say:"say",menu:"menu"},nc.DefaultConfig={player:{contentContainerId:"__narraleaf_content",aspectRatio:16/9,minWidth:800,minHeight:450,width:"100%",height:"100%",skipKey:["Control"],skipInterval:100},elements:{say:{nextKey:[" "],textInterval:50,use:Ku.say},img:{slowLoadWarning:!0,slowLoadThreshold:2e3},menu:{use:Ku.menu}},elementStyles:{say:{container:"",nameText:"",textContainer:"",textSpan:""},menu:{container:"",choiceButton:"",choiceButtonText:""}},app:{debug:!1,logger:{log:!1,info:!1,warn:!0,error:!0,debug:!1,trace:!1}}},nc.GameSettingsNamespace=Xu;var rc=function(){function t(e){Qu(this,t),this.currentSavedGame=null,this.story=null,this.lockedAwaiting=null,this.gameState=void 0,this._lockedCount=0,this.currentAction=null,this.game=e,this.storable=new hu,this.initNamespaces()}return tc(t,[{key:"initNamespaces",value:function(){return this.storable.clear().addNamespace(new du(t.GameSpacesKey.game,t.DefaultNamespaces.game)),this}},{key:"getStorable",value:function(){return this.storable}},{key:"loadStory",value:function(t){return this.story=t.constructStory(),this}},{key:"serialize",value:function(){var t,e,n;if(!this.gameState)throw new Error("No game state");var r=this.gameState,o=this.story;if(!o)throw new Error("No story loaded");var i=this.storable.toData(),a=r.toData(),s=(null===(t=this.getCurrentAction())||void 0===t?void 0:t.getId())||null,u=o.getAllElementStates();return{name:(null===(e=this.currentSavedGame)||void 0===e?void 0:e.name)||"",meta:{created:(null===(n=this.currentSavedGame)||void 0===n?void 0:n.meta.created)||Date.now(),updated:Date.now()},game:{store:i,stage:a,currentAction:s,elementStates:u}}}},{key:"deserialize",value:function(t){var e;if(!this.gameState)throw new Error("No game state");var n=this.gameState,r=this.story;if(!r)throw new Error("No story loaded");this.reset({gameState:n}),n.stage.forceUpdate();var o=new Map,i=new Map,a=t.game,s=a.store,u=a.stage,c=a.elementStates,l=a.currentAction;if(r.forEachChild((null===(e=r.entryScene)||void 0===e?void 0:e.sceneRoot)||[],(function(t){o.set(t.getId(),t),i.set(t.callee.getId(),t.callee)})),this.storable.load(s),c.forEach((function(t){var e=t.id,r=t.data;n.logger.debug("restore element",e);var o=i.get(e);if(!o)throw new Error("Element not found, id: "+e+"\nNarraLeaf cannot find the element with the id from the saved game");o.reset(),o.fromData(r)})),this.currentSavedGame=t,n.loadData(u,i),l){var f=o.get(l);if(!f)throw new Error("Action not found, id: "+l+"\nNarraLeaf cannot find the action with the id from the saved game");this.currentAction=f}n.stage.forceUpdate(),n.stage.next()}},{key:"newGame",value:function(){var t,e,n;if(!this.gameState)throw new Error("No game state");var r=this.gameState;this.reset({gameState:r}),this.initNamespaces();var o=this.getNewSavedGame();o.name="NewGame-"+Date.now(),this.currentSavedGame=o;var i=null===(t=this.story)||void 0===t?void 0:t.getAllElementMap((null===(n=null===(e=this.story)||void 0===e?void 0:e.entryScene)||void 0===n?void 0:n.sceneRoot)||[]);return i?i.forEach((function(t){r.logger.debug("reset element",t),t.reset()})):r.logger.warn("No elements found"),r.stage.forceUpdate(),r.stage.next(),this}},{key:"reset",value:function(t){var e,n,r=t.gameState;this.lockedAwaiting&&this.lockedAwaiting.abort(),this.currentAction=(null===(n=null===(e=this.story)||void 0===e?void 0:e.entryScene)||void 0===n?void 0:n.sceneRoot)||null,this.lockedAwaiting=null,this.currentSavedGame=null,r.forceReset()}},{key:"getCurrentAction",value:function(){return this.currentAction}},{key:"setCurrentAction",value:function(t){return this.currentAction=t,this}},{key:"next",value:function(t){var e,n;if(!this.story)throw new Error("No story loaded");if(this.lockedAwaiting){if(!this.lockedAwaiting.solved){if(this._lockedCount++,this._lockedCount>1e3)throw new Error("Locked awaiting");return this.lockedAwaiting}var r=this.lockedAwaiting.result;return this.currentAction=(null===(e=null==r?void 0:r.node)||void 0===e?void 0:e.action)||null,t.logger.debug("next action",r),this.lockedAwaiting=null,r||null}if(!this.currentAction)return t.events.emit(_u.EventTypes["event:state.end"]),t.logger.warn("LiveGame","No current action"),null;var o=this.currentAction.executeAction(t);return h.isAwaitable(o)?(this.lockedAwaiting=o,o):(t.logger.debug("next action",o),this._lockedCount=0,this.currentAction=(null===(n=o.node)||void 0===n?void 0:n.action)||null,o)}},{key:"abortAwaiting",value:function(){var t;if(this.lockedAwaiting){var e=this.lockedAwaiting.abort();this.currentAction=(null===(t=null==e?void 0:e.node)||void 0===t?void 0:t.action)||null,this.lockedAwaiting=null}}},{key:"executeAction",value:function(t,e){var n,r=e.executeAction(t);return h.isAwaitable(r)?r:(null===(n=null==r?void 0:r.node)||void 0===n?void 0:n.action)||null}},{key:"setGameState",value:function(t){return this.gameState=t,this}},{key:"getGameState",value:function(){return this.gameState}},{key:"getNewSavedGame",value:function(){var t,e,n;return{name:"",meta:{created:Date.now(),updated:Date.now()},game:{store:{},stage:{scenes:[]},elementStates:[],currentAction:(null===(n=null===(e=null===(t=this.story)||void 0===t?void 0:t.entryScene)||void 0===e?void 0:e.sceneRoot)||void 0===n?void 0:n.getId())||null}}}}])}();rc.DefaultNamespaces={game:{}},rc.GameSpacesKey={game:"game"};var oc=o(72),ic=o.n(oc),ac=o(825),sc=o.n(ac),uc=o(659),cc=o.n(uc),lc=o(56),fc=o.n(lc),pc=o(540),dc=o.n(pc),hc=o(113),yc=o.n(hc),vc=o(587),mc={};mc.styleTagTransform=yc(),mc.setAttributes=fc(),mc.insert=cc().bind(null,"head"),mc.domAPI=sc(),mc.insertStyleElement=dc();ic()(vc.A,mc);vc.A&&vc.A.locals&&vc.A.locals;var gc=o(848);const bc=(0,xu.createContext)({strict:!1});function wc(t){for(const e in t)vo[e]={...vo[e],...t[e]}}function _c({children:t,features:e,strict:n=!1}){const[,r]=(0,xu.useState)(!Sc(e)),o=(0,xu.useRef)(void 0);if(!Sc(e)){const{renderer:t,...n}=e;o.current=t,wc(n)}return(0,xu.useEffect)((()=>{Sc(e)&&e().then((({renderer:t,...e})=>{wc(e),o.current=t,r(!0)}))}),[]),(0,gc.jsx)(bc.Provider,{value:{renderer:o.current,strict:n},children:t})}function Sc(t){return"function"==typeof t}function kc(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}function xc(t,e,n={}){var r;const o=$r(t,e,"exit"===n.type?null===(r=t.presenceContext)||void 0===r?void 0:r.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=o||{};n.transitionOverride&&(i=n.transitionOverride);const a=o?()=>Promise.all(to(t,o,n)):()=>Promise.resolve(),s=t.variantChildren&&t.variantChildren.size?(r=0)=>{const{delayChildren:o=0,staggerChildren:a,staggerDirection:s}=i;return function(t,e,n=0,r=0,o=1,i){const a=[],s=(t.variantChildren.size-1)*r,u=1===o?(t=0)=>t*r:(t=0)=>s-t*r;return Array.from(t.variantChildren).sort(Ac).forEach(((t,r)=>{t.notify("AnimationStart",e),a.push(xc(t,e,{...i,delay:n+u(r)}).then((()=>t.notify("AnimationComplete",e))))})),Promise.all(a)}(t,e,o+r,a,s,n)}:()=>Promise.resolve(),{when:u}=i;if(u){const[t,e]="beforeChildren"===u?[a,s]:[s,a];return t().then((()=>e()))}return Promise.all([a(),s(n.delay)])}function Ac(t,e){return t.sortNodePosition(e)}const Tc=[...lo].reverse(),Ec=lo.length;function Oc(t){return e=>Promise.all(e.map((({animation:e,options:n})=>function(t,e,n={}){let r;if(t.notify("AnimationStart",e),Array.isArray(e)){const o=e.map((e=>xc(t,e,n)));r=Promise.all(o)}else if("string"==typeof e)r=xc(t,e,n);else{const o="function"==typeof e?$r(t,e,n.custom):e;r=Promise.all(to(t,o,n))}return r.then((()=>{t.notify("AnimationComplete",e)}))}(t,e,n))))}function Pc(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!kc(e,t)}function jc(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Cc(){return{animate:jc(!0),whileInView:jc(),whileHover:jc(),whileTap:jc(),whileDrag:jc(),whileFocus:jc(),exit:jc()}}class Ic{constructor(t){this.isMounted=!1,this.node=t}update(){}}let Lc=0;const Mc={animation:{Feature:class extends Ic{constructor(t){super(t),t.animationState||(t.animationState=function(t){let e=Oc(t),n=Cc(),r=!0;const o=e=>(n,r)=>{var o;const i=$r(t,r,"exit"===e?null===(o=t.presenceContext)||void 0===o?void 0:o.custom:void 0);if(i){const{transition:t,transitionEnd:e,...r}=i;n={...n,...r,...e}}return n};function i(i){const a=t.getProps(),s=t.getVariantContext(!0)||{},u=[],c=new Set;let l={},f=1/0;for(let e=0;e<Ec;e++){const p=Tc[e],d=n[p],h=void 0!==a[p]?a[p]:s[p],y=co(h),v=p===i?d.isActive:null;!1===v&&(f=e);let m=h===s[p]&&h!==a[p]&&y;if(m&&r&&t.manuallyAnimateOnMount&&(m=!1),d.protectedKeys={...l},!d.isActive&&null===v||!h&&!d.prevProp||uo(h)||"boolean"==typeof h)continue;let g=Pc(d.prevProp,h)||p===i&&d.isActive&&!m&&y||e>f&&y,b=!1;const w=Array.isArray(h)?h:[h];let _=w.reduce(o(p),{});!1===v&&(_={});const{prevResolvedValues:S={}}=d,k={...S,..._},x=e=>{g=!0,c.has(e)&&(b=!0,c.delete(e)),d.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in k){const e=_[t],n=S[t];if(l.hasOwnProperty(t))continue;let r=!1;r=Lr(e)&&Lr(n)?!kc(e,n):e!==n,r?null!=e?x(t):c.add(t):void 0!==e&&c.has(t)?x(t):d.protectedKeys[t]=!0}d.prevProp=h,d.prevResolvedValues=_,d.isActive&&(l={...l,..._}),r&&t.blockInitialAnimation&&(g=!1),!g||m&&!b||u.push(...w.map((t=>({animation:t,options:{type:p}}))))}if(c.size){const e={};c.forEach((n=>{const r=t.getBaseTarget(n),o=t.getValue(n);o&&(o.liveStyle=!0),e[n]=null!=r?r:null})),u.push({animation:e})}let p=Boolean(u.length);return!r||!1!==a.initial&&a.initial!==a.animate||t.manuallyAnimateOnMount||(p=!1),r=!1,p?e(u):Promise.resolve()}return{animateChanges:i,setActive:function(e,r){var o;if(n[e].isActive===r)return Promise.resolve();null===(o=t.variantChildren)||void 0===o||o.forEach((t=>{var n;return null===(n=t.animationState)||void 0===n?void 0:n.setActive(e,r)})),n[e].isActive=r;const a=i(e);for(const t in n)n[t].protectedKeys={};return a},setAnimateFunction:function(n){e=n(t)},getState:()=>n,reset:()=>{n=Cc(),r=!0}}}(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();uo(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:e}=this.node.prevProps||{};t!==e&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),null===(t=this.unmountControls)||void 0===t||t.call(this)}}},exit:{Feature:class extends Ic{constructor(){super(...arguments),this.id=Lc++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:e}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===n)return;const r=this.node.animationState.setActive("exit",!t);e&&!t&&r.then((()=>e(this.id)))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}}};function Nc(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function Rc(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const Fc=t=>e=>(t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary)(e)&&t(e,Rc(e));function Vc(t,e,n,r){return Nc(t,e,Fc(n),r)}function Dc(t){let e=null;return()=>{const n=()=>{e=null};return null===e&&(e=t,n)}}const Bc=Dc("dragHorizontal"),Gc=Dc("dragVertical");function Uc(){const t=function(t){let e=!1;if("y"===t)e=Gc();else if("x"===t)e=Bc();else{const t=Bc(),n=Gc();t&&n?e=()=>{t(),n()}:(t&&t(),n&&n())}return e}(!0);return!t||(t(),!1)}function Hc(t,e){const n=e?"pointerenter":"pointerleave",r=e?"onHoverStart":"onHoverEnd";return Vc(t.current,n,((n,o)=>{if("touch"===n.pointerType||Uc())return;const i=t.getProps();t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",e);const a=i[r];a&&jt.postRender((()=>a(n,o)))}),{passive:!t.getProps()[r]})}const $c=(t,e)=>!!e&&(t===e||$c(t,e.parentElement));function zc(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,Rc(n))}const Wc=new WeakMap,qc=new WeakMap,Yc=t=>{const e=Wc.get(t.target);e&&e(t)},Xc=t=>{t.forEach(Yc)};function Kc(t,e,n){const r=function({root:t,...e}){const n=t||document;qc.has(n)||qc.set(n,{});const r=qc.get(n),o=JSON.stringify(e);return r[o]||(r[o]=new IntersectionObserver(Xc,{root:t,...e})),r[o]}(e);return Wc.set(t,n),r.observe(t),()=>{Wc.delete(t),r.unobserve(t)}}const Zc={some:0,all:1};const Qc={inView:{Feature:class extends Ic{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:e,margin:n,amount:r="some",once:o}=t,i={root:e?e.current:void 0,rootMargin:n,threshold:"number"==typeof r?r:Zc[r]};return Kc(this.node.current,i,(t=>{const{isIntersecting:e}=t;if(this.isInView===e)return;if(this.isInView=e,o&&!e&&this.hasEnteredView)return;e&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",e);const{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),i=e?n:r;i&&i(t)}))}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:t,prevProps:e}=this.node;["amount","margin","root"].some(function({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}(t,e))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends Ic{constructor(){super(...arguments),this.removeStartListeners=_t,this.removeEndListeners=_t,this.removeAccessibleListeners=_t,this.startPointerPress=(t,e)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),r=Vc(window,"pointerup",((t,e)=>{if(!this.checkPressEnd())return;const{onTap:n,onTapCancel:r,globalTapTarget:o}=this.node.getProps(),i=o||$c(this.node.current,t.target)?n:r;i&&jt.update((()=>i(t,e)))}),{passive:!(n.onTap||n.onPointerUp)}),o=Vc(window,"pointercancel",((t,e)=>this.cancelPress(t,e)),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=Zn(r,o),this.startPress(t,e)},this.startAccessiblePress=()=>{const t=Nc(this.node.current,"keydown",(t=>{if("Enter"!==t.key||this.isPressing)return;this.removeEndListeners(),this.removeEndListeners=Nc(this.node.current,"keyup",(t=>{"Enter"===t.key&&this.checkPressEnd()&&zc("up",((t,e)=>{const{onTap:n}=this.node.getProps();n&&jt.postRender((()=>n(t,e)))}))})),zc("down",((t,e)=>{this.startPress(t,e)}))})),e=Nc(this.node.current,"blur",(()=>{this.isPressing&&zc("cancel",((t,e)=>this.cancelPress(t,e)))}));this.removeAccessibleListeners=Zn(t,e)}}startPress(t,e){this.isPressing=!0;const{onTapStart:n,whileTap:r}=this.node.getProps();r&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&jt.postRender((()=>n(t,e)))}checkPressEnd(){this.removeEndListeners(),this.isPressing=!1;return this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!Uc()}cancelPress(t,e){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&jt.postRender((()=>n(t,e)))}mount(){const t=this.node.getProps(),e=Vc(t.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),n=Nc(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Zn(e,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}},focus:{Feature:class extends Ic{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch(e){t=!0}t&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Zn(Nc(this.node.current,"focus",(()=>this.onFocus())),Nc(this.node.current,"blur",(()=>this.onBlur())))}unmount(){}}},hover:{Feature:class extends Ic{mount(){this.unmount=Zn(Hc(this.node,!0),Hc(this.node,!1))}unmount(){}}}},Jc=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function tl(t){return"string"==typeof t&&!t.includes("-")&&!!(Jc.indexOf(t)>-1||/[A-Z]/u.test(t))}const el={renderer:(t,e)=>tl(t)?new No(e):new Fo(e,{allowProjection:t!==xu.Fragment}),...Mc,...Qc};function nl(t){var e=t.children;return Au().createElement(_c,{features:el,strict:!0},e)}function rl(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return ol(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ol(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ol(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function il(t){var e=t.children,n=t.className,r=rl((0,xu.useState)({}),2),o=r[0],i=r[1],a=Mu().ratio,s=$u().game,u=rl((0,xu.useReducer)((function(t){return t+1}),0),2)[1],c=s.config.player.minWidth,l=s.config.player.minHeight;return(0,xu.useEffect)((function(){var t,e=function(){if(a.isLocked())console.warn("Ratio is locked, skipping update");else{var t=document.getElementById(s.config.player.contentContainerId);if(t){var e,n,r=t.clientWidth,o=t.clientHeight,f=s.config.player.aspectRatio;r/o>f?(e=o*f,n=o):(e=r,n=r/f),e<c&&(e=c),n<l&&(n=l),i({width:"".concat(e,"px"),height:"".concat(n,"px"),margin:"auto",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",display:"flex",alignItems:"center",justifyContent:"center"}),a.update(e,n),a.updateMin(c,l),u()}}};a.setUpdate(e);var n=function(){e(),clearTimeout(t),a.pause(),t=setTimeout((function(){a.resume()}),100)};return e(),window.addEventListener("resize",n),function(){window.removeEventListener("resize",n),clearTimeout(t)}}),[a]),Au().createElement("div",{id:s.config.player.contentContainerId,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"}},Au().createElement("div",{className:ku(n),style:o},e))}var al={start:"start",update:"update",end:"end"};function sl(t){var e=t.children,n=Mu().ratio,r=$u().game,o=(0,xu.useRef)(null);return(0,xu.useEffect)((function(){if(!o.current)throw new Error("Content container not found")}),[r.config.player.contentContainerId]),Au().createElement(Au().Fragment,null,Au().createElement("div",{ref:o,className:ku("absolute inset-0 flex items-center justify-center bg-cover bg-center overflow-hidden"),style:Object.assign({},n.getStyle())},e))}function ul(t){return ul="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ul(t)}function cl(){return cl=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},cl.apply(null,arguments)}function ll(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ll=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",d="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==ul(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function T(e,n,r){var o=p;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:d,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(ul(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function fl(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return pl(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pl(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var dl=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};function hl(t){var e=this,n=t.scene,r=t.props,o=t.state,i=(0,xu.useRef)(null),a=$u().game,s=fl((0,xu.useState)(null),2),u=s[0],c=s[1],l=fl((0,xu.useState)([]),2)[1],f=fl((0,xu.useState)(null),2),p=f[0],h=f[1],y=fl((0,xu.useState)({}),2),v=y[0],m=y[1];function g(){n.events.emit(Us.EventTypes["event:scene.imageLoaded"])}function b(t){if(p&&p.getControl()&&(console.warn("processing transform not completed"),p.getControl().complete(),p.setControl(null)),!i.current)throw new Error("scope not ready");t instanceof hi?Object.assign(i.current.style,t.propToCSS(o,n.backgroundImage.state)):Object.assign(i.current.style,t)}(0,xu.useEffect)((function(){var t=n.events.onEvents([{type:Us.EventTypes["event:scene.applyTransition"],listener:n.events.on(Us.EventTypes["event:scene.applyTransition"],(function(t){return c(t),t?new Promise((function(e){var n=t.events.onEvents([{type:al.update,listener:t.events.on(al.update,(function(t){l(t)}))},{type:al.end,listener:t.events.on(al.end,(function(){c(null),o.logger.debug("scene background transition end",t)}))},{type:al.start,listener:t.events.on(al.start,(function(){o.logger.debug("scene background transition start",t)}))}]);t.start((function(){n.cancel(),e()}))})):(o.logger.warn("transition not set"),Promise.resolve())}))},{type:Us.EventTypes["event:scene.applyTransform"],listener:n.events.on(Us.EventTypes["event:scene.applyTransform"],(function(t){return dl(e,void 0,void 0,ll().mark((function e(){return ll().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return b(t.propToCSS(o,n.backgroundImage.state)),h(t),e.next=4,t.animate({scope:i,image:n.backgroundImage},o,n.backgroundImage.state,(function(e){n.backgroundImage.state=d(n.backgroundImage.state,e),m({style:t.propToCSS(o,n.backgroundImage.state)}),h(null)}));case 4:case"end":return e.stop()}}),e)})))}))},{type:Us.EventTypes["event:scene.initTransform"],listener:n.events.on(Us.EventTypes["event:scene.initTransform"],(function(t){return dl(e,void 0,void 0,ll().mark((function e(){return ll().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o.logger.debug("init transform",t),e.next=3,t.animate({scope:i,image:n.backgroundImage},o,n.backgroundImage.state,(function(t){n.backgroundImage.state=d(n.backgroundImage.state,t)}));case 3:case"end":return e.stop()}}),e)})))}))}]);return function(){t.cancel()}}),[]),(0,xu.useEffect)((function(){b(n.backgroundImage.state)}),[]),(0,xu.useEffect)((function(){var t=o.events.onEvents([{type:_u.EventTypes["event:state.player.skip"],listener:o.events.on(_u.EventTypes["event:state.player.skip"],(function(){p&&p.getControl()&&(p.getControl().complete(),p.setControl(null))}))}]);return function(){t.cancel()}}),[p]);var w,_="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",S={src:_,style:Object.assign({opacity:0},a.config.app.debug?{border:"1px solid red"}:{})};return Au().createElement("div",null,u?u.toElementProps().map((function(t,e,n){var o=d(S,r,v,t);return Au().createElement(sl,{key:e},Au().createElement("img",cl({alt:o.alt},o,{onLoad:g,src:o.src||_,ref:e===n.length-1?i:void 0,className:"absolute"})))})):(w=d(S,r,{style:new hi([]).propToCSS(o,n.backgroundImage.state)},v),Au().createElement(sl,null,Au().createElement("img",cl({alt:w.alt},w,{onLoad:g,ref:i,src:w.src||_,className:"absolute"})))))}function yl(t){return yl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yl(t)}function vl(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */vl=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",d="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==yl(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function T(e,n,r){var o=p;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:d,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(yl(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function ml(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return gl(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gl(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function gl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var bl=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};function wl(t){var e=t.scene,n=t.state,r=t.children,o=t.className,i=Mu().ratio,a=ml((0,xu.useState)((function(){return e.state.backgroundMusic})),2),s=a[0],u=a[1],c=ml((0,xu.useState)(null),2),l=c[0],f=c[1],p=ml((0,xu.useState)(null),2),d=p[0],h=p[1];function y(t,e){return bl(this,void 0,void 0,vl().mark((function n(){var r;return vl().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(t.$getHowl()&&t.$getHowl().playing(t.$getToken())){n.next=2;break}return n.abrupt("return",Promise.resolve());case 2:return r=t.$getHowl().volume(t.$getToken()),n.next=5,new Promise((function(n){t.$getHowl().fade(r,0,e,t.$getToken()),h((function(){return n})),f(setTimeout((function(){t.$getHowl().stop(),t.$getHowl().volume(r),t.$setToken(null),n(),h(null)}),e))}));case 5:return n.abrupt("return",n.sent);case 6:case"end":return n.stop()}}),n)})))}return(0,xu.useEffect)((function(){var t=[{type:"event:scene.setBackgroundMusic",listener:e.events.on(Us.EventTypes["event:scene.setBackgroundMusic"],(function(t,e){(function(t,e){var n,r,o,i,a,c;return bl(this,void 0,void 0,vl().mark((function p(){var v,m;return vl().wrap((function(p){for(;;)switch(p.prev=p.next){case 0:if(l&&(clearTimeout(l),f(null),d&&(d(),h(null))),m=t,!(v=s)){p.next=12;break}if(!e){p.next=9;break}return p.next=7,y(v,e);case 7:p.next=12;break;case 9:null===(n=v.$getHowl())||void 0===n||n.stop(),null===(r=v.$getHowl())||void 0===r||r.volume(0),v.$setToken(null);case 12:if(m){p.next=14;break}return p.abrupt("return");case 14:null===(o=m.$getHowl())||void 0===o||o.volume(0),m.$setToken(null===(i=m.$getHowl())||void 0===i?void 0:i.play(m.$getToken()||void 0)),e?null===(a=m.$getHowl())||void 0===a||a.fade(0,m.config.volume,e,m.$getToken()):null===(c=m.$getHowl())||void 0===c||c.volume(m.config.volume,m.$getToken()),u(m);case 18:case"end":return p.stop()}}),p)})))})(t,e).then()}))},{type:"event:scene.preUnmount",listener:e.events.on(Us.EventTypes["event:scene.preUnmount"],(function(){l&&(clearTimeout(l),d&&d()),s&&y(s,e.state.backgroundMusicFade).then()}))}];return function(){t.forEach((function(t){var n=t.type,r=t.listener;e.events.off(n,r)}))}}),[]),(0,xu.useEffect)((function(){return e.events.emit(Us.EventTypes["event:scene.mount"]),function(){e.events.emit(Us.EventTypes["event:scene.unmount"])}}),[]),Au().createElement("div",{className:o},Au().createElement(hl,{scene:e,props:{width:i.state.width,height:i.state.height,src:Aa.backgroundToSrc(e.state.background)},state:n}),r)}function _l(t){if("undefined"==typeof Proxy)return t;const e=new Map;return new Proxy(((...e)=>t(...e)),{get:(n,r)=>"create"===r?t:(e.has(r)||e.set(r,t(r)),e.get(r))})}const Sl=(0,xu.createContext)({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),kl=(0,xu.createContext)({}),xl=(0,xu.createContext)(null),Al=io?xu.useLayoutEffect:xu.useEffect,{schedule:Tl,cancel:El}=Pt(queueMicrotask,!1);function Ol(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}const Pl=(0,xu.createContext)({});let jl=!1;function Cl(t,e,n,r,o){var i;const{visualElement:a}=(0,xu.useContext)(kl),s=(0,xu.useContext)(bc),u=(0,xu.useContext)(xl),c=(0,xu.useContext)(Sl).reducedMotion,l=(0,xu.useRef)();r=r||s.renderer,!l.current&&r&&(l.current=r(t,{visualState:e,parent:a,props:n,presenceContext:u,blockInitialAnimation:!!u&&!1===u.initial,reducedMotionConfig:c}));const f=l.current,p=(0,xu.useContext)(Pl);!f||f.projection||!o||"html"!==f.type&&"svg"!==f.type||function(t,e,n,r){const{layoutId:o,layout:i,drag:a,dragConstraints:s,layoutScroll:u,layoutRoot:c}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Ll(t.parent)),t.projection.setOptions({layoutId:o,layout:i,alwaysMeasureLayout:Boolean(a)||s&&Ol(s),visualElement:t,animationType:"string"==typeof i?i:"both",initialPromotionConfig:r,layoutScroll:u,layoutRoot:c})}(l.current,n,o,p),(0,xu.useInsertionEffect)((()=>{f&&f.update(n,u)}));const d=n[qr],h=(0,xu.useRef)(Boolean(d)&&!window.MotionHandoffIsComplete&&(null===(i=window.MotionHasOptimisedAnimation)||void 0===i?void 0:i.call(window,d)));return Al((()=>{f&&(f.updateFeatures(),Tl.render(f.render),h.current&&f.animationState&&f.animationState.animateChanges())})),(0,xu.useEffect)((()=>{f&&(!h.current&&f.animationState&&f.animationState.animateChanges(),h.current=!1,jl||(jl=!0,queueMicrotask(Il)))})),f}function Il(){window.MotionHandoffIsComplete=!0}function Ll(t){if(t)return!1!==t.options.allowProjection?t.projection:Ll(t.parent)}function Ml(t,e,n){return(0,xu.useCallback)((r=>{r&&t.mount&&t.mount(r),e&&(r?e.mount(r):e.unmount()),n&&("function"==typeof n?n(r):Ol(n)&&(n.current=r))}),[e])}function Nl(t){const{initial:e,animate:n}=function(t,e){if(po(t)){const{initial:e,animate:n}=t;return{initial:!1===e||co(e)?e:void 0,animate:co(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,(0,xu.useContext)(kl));return(0,xu.useMemo)((()=>({initial:e,animate:n})),[Rl(e),Rl(n)])}function Rl(t){return Array.isArray(t)?t.join(" "):t}const Fl=(0,xu.createContext)({}),Vl=Symbol.for("motionComponentSymbol");function Dl({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:r,Component:o}){t&&wc(t);const i=(0,xu.forwardRef)((function(t,i){let a;const s={...(0,xu.useContext)(Sl),...t,layoutId:Bl(t)},{isStatic:u}=s,c=Nl(t),l=r(t,u);if(!u&&io){!function(){(0,xu.useContext)(bc).strict;0}();const t=function(t){const{drag:e,layout:n}=vo;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:(null==e?void 0:e.isEnabled(t))||(null==n?void 0:n.isEnabled(t))?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}(s);a=t.MeasureLayout,c.visualElement=Cl(o,l,s,e,t.ProjectionNode)}return(0,gc.jsxs)(kl.Provider,{value:c,children:[a&&c.visualElement?(0,gc.jsx)(a,{visualElement:c.visualElement,...s}):null,n(o,t,Ml(l,c.visualElement,i),l,u,c.visualElement)]})}));return i[Vl]=o,i}function Bl({layoutId:t}){const e=(0,xu.useContext)(Fl).id;return e&&void 0!==t?e+"-"+t:t}function Gl(t){const e=Zr(t)?t.get():t;return Mr(e)?e.toValue():e}const Ul=t=>(e,n)=>{const r=(0,xu.useContext)(kl),o=(0,xu.useContext)(xl),i=()=>function({applyWillChange:t=!1,scrapeMotionValuesFromProps:e,createRenderState:n,onMount:r},o,i,a,s){const u={latestValues:zl(o,i,a,!s&&t,e),renderState:n()};return r&&(u.mount=t=>r(o,t,u)),u}(t,e,r,o,n);return n?i():function(t){const e=(0,xu.useRef)(null);return null===e.current&&(e.current=t()),e.current}(i)};function Hl(t,e){const n=Xr(e);n&&Rr(t,n)}function $l(t,e,n){const r=Array.isArray(e)?e:[e];for(let e=0;e<r.length;e++){const o=Hr(t,r[e]);if(o){const{transitionEnd:t,transition:e,...r}=o;n(r,t)}}}function zl(t,e,n,r,o){var i;const a={},s=[],u=r&&void 0===(null===(i=t.style)||void 0===i?void 0:i.willChange),c=o(t,{});for(const t in c)a[t]=Gl(c[t]);let{initial:l,animate:f}=t;const p=po(t),d=ho(t);e&&d&&!p&&!1!==t.inherit&&(void 0===l&&(l=e.initial),void 0===f&&(f=e.animate));let h=!!n&&!1===n.initial;h=h||!1===l;const y=h?f:l;return y&&"boolean"!=typeof y&&!uo(y)&&$l(t,y,((t,e)=>{for(const e in t){let n=t[e];if(Array.isArray(n)){n=n[h?n.length-1:0]}null!==n&&(a[e]=n)}for(const t in e)a[t]=e[t]})),u&&(f&&!1!==l&&!uo(f)&&$l(t,f,(t=>{for(const e in t)Hl(s,e)})),s.length&&(a.willChange=s.join(","))),a}const Wl=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),ql=()=>({...Wl(),attrs:{}}),Yl={useVisualState:Ul({scrapeMotionValuesFromProps:oo,createRenderState:ql,onMount:(t,e,{renderState:n,latestValues:r})=>{jt.read((()=>{try{n.dimensions="function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch(t){n.dimensions={x:0,y:0,width:0,height:0}}})),jt.render((()=>{jo(n,r,Mo(e.tagName),t.transformTemplate),Lo(e,n)}))}})},Xl={useVisualState:Ul({applyWillChange:!0,scrapeMotionValuesFromProps:ro,createRenderState:Wl})};function Kl(t,e,n){for(const r in e)Zr(e[r])||no(r,n)||(t[r]=e[r])}function Zl(t,e){const n={};return Kl(n,t.style||{},t),Object.assign(n,function({transformTemplate:t},e){return(0,xu.useMemo)((()=>{const n=Wl();return To(n,e,t),Object.assign({},n.vars,n.style)}),[e])}(t,e)),n}function Ql(t,e){const n={},r=Zl(t,e);return t.drag&&!1!==t.dragListener&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=!0===t.drag?"none":"pan-"+("x"===t.drag?"y":"x")),void 0===t.tabIndex&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const Jl=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function tf(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Jl.has(t)}let ef=t=>!tf(t);try{(nf=require("@emotion/is-prop-valid").default)&&(ef=t=>t.startsWith("on")?!tf(t):nf(t))}catch(V){}var nf;function rf(t,e,n,r){const o=(0,xu.useMemo)((()=>{const n=ql();return jo(n,e,Mo(r),t.transformTemplate),{...n.attrs,style:{...n.style}}}),[e]);if(t.style){const e={};Kl(e,t.style,t),o.style={...e,...o.style}}return o}function of(t=!1){return(e,n,r,{latestValues:o},i)=>{const a=(tl(e)?rf:Ql)(n,o,i,e),s=function(t,e,n){const r={};for(const o in t)"values"===o&&"object"==typeof t.values||(ef(o)||!0===n&&tf(o)||!e&&!tf(o)||t.draggable&&o.startsWith("onDrag"))&&(r[o]=t[o]);return r}(n,"string"==typeof e,t),u=e!==xu.Fragment?{...s,...a,ref:r}:{},{children:c}=n,l=(0,xu.useMemo)((()=>Zr(c)?c.get():c),[c]);return(0,xu.createElement)(e,{...u,children:l})}}function af(t,e){return function(n,{forwardMotionProps:r}={forwardMotionProps:!1}){return Dl({...tl(n)?Yl:Xl,preloadedFeatures:t,useRender:of(r),createVisualElement:e,Component:n})}}const sf=_l(af());function uf(t){return uf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},uf(t)}function cf(){return cf=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},cf.apply(null,arguments)}function lf(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */lf=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",d="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==uf(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function T(e,n,r){var o=p;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:d,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(uf(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function ff(t){return function(t){if(Array.isArray(t))return hf(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||df(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pf(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||df(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function df(t,e){if(t){if("string"==typeof t)return hf(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hf(t,e):void 0}}function hf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var yf=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};function vf(t){var e=this,n=t.image,r=t.state,o=t.onAnimationEnd,i=(0,xu.useRef)(null),a=pf((0,xu.useState)(null),2),s=a[0],u=a[1],c=pf((0,xu.useState)({style:{}}),2),l=c[0],f=c[1],p=pf((0,xu.useState)(null),2),h=p[0],y=p[1],v=pf((0,xu.useState)([]),2)[1],m=pf((0,xu.useState)(0),2),g=m[0],b=m[1],w=$u().game;(0,xu.useEffect)((function(){n.setScope(i),n.events.emit(ji.EventTypes["event:image.mount"]);var t=n.events.onEvents([].concat(ff([ji.EventTypes["event:image.show"],ji.EventTypes["event:image.hide"],ji.EventTypes["event:image.applyTransform"]].map((function(t){return{type:t,listener:n.events.on(t,(function(t){return yf(e,void 0,void 0,lf().mark((function e(){return lf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i.current){e.next=2;break}throw new Error("scope not ready");case 2:return S(t.propToCSS(r,n.state)),u(t),r.logger.debug("transform",t,t.propToCSS(r,n.state)),e.next=7,t.animate({scope:i,image:n},r,n.state,(function(e){n.state=d(n.state,e),f({style:t.propToCSS(r,n.state)}),u(null),r.logger.debug("transform end",t,t.propToCSS(r,n.state),n.state),o&&o()}));case 7:return e.abrupt("return",!0);case 8:case"end":return e.stop()}}),e)})))}))}}))),[{type:ji.EventTypes["event:image.init"],listener:n.events.on(ji.EventTypes["event:image.init"],(function(){return yf(e,void 0,void 0,lf().mark((function t(){return lf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.toTransform().animate({scope:i,image:n},r,n.state,(function(t){n.state=d(n.state,t),f({style:n.toTransform().propToCSS(r,n.state)})}));case 2:case"end":return t.stop()}}),t)})))}))}])),a=n.events.onEvents([{type:ji.EventTypes["event:image.applyTransition"],listener:n.events.on(ji.EventTypes["event:image.applyTransition"],(function(t){return y(t),t?new Promise((function(e){var n=t.events.onEvents([{type:al.update,listener:t.events.on(al.update,(function(t){v(t)}))},{type:al.end,listener:t.events.on(al.end,(function(){y(null),r.logger.debug("image transition end",t)}))},{type:al.start,listener:t.events.on(al.start,(function(){r.logger.debug("image transition start",t)}))}]);t.start((function(){n.cancel(),e()}))})):(r.logger.warn("transition not set"),Promise.resolve())}))},{type:ji.EventTypes["event:image.flushComponent"],listener:n.events.on(ji.EventTypes["event:image.flushComponent"],(function(){return yf(e,void 0,void 0,lf().mark((function t(){return lf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r.stage.update(),t.next=3,new Promise((function(t){setTimeout((function(){t()}),10)}));case 3:return t.abrupt("return",!0);case 4:case"end":return t.stop()}}),t)})))}))}]);return S(n.toTransform().propToCSS(r,n.state)),n.events.emit(ji.EventTypes["event:image.ready"],i),function(){t.cancel(),a.cancel(),n.events.emit(ji.EventTypes["event:image.unmount"])}}),[]),(0,xu.useEffect)((function(){b(performance.now())}),[]),(0,xu.useEffect)((function(){var t=r.events.onEvents([{type:_u.EventTypes["event:state.player.skip"],listener:r.events.on(_u.EventTypes["event:state.player.skip"],(function(){s&&s.getControl()&&(s.getControl().complete(),s.setControl(null),r.logger.debug("transform skip")),h&&h.controller&&(h.controller.complete(),y(null),r.logger.debug("transition skip"))}))}]);return function(){t.cancel()}}),[h,s]);var _=function(){var t=performance.now()-g,e=w.config.elements.img.slowLoadThreshold;t>e&&w.config.elements.img.slowLoadWarning&&r.logger.warn("NarraLeaf-React","Image took ".concat(t,"ms to load, which exceeds the threshold of ").concat(e,"ms. ")+"Consider enable cache for the image, so Preloader can preload it before it's used. To disable this warning, set `elements.img.slowLoadWarning` to false in the game config.")};function S(t){if(s&&s.getControl()&&(console.warn("processing transform not completed"),s.getControl().complete(),s.setControl(null)),!i.current)throw new Error("scope not ready");t instanceof hi?Object.assign(i.current.style,t.propToCSS(r,n.state)):Object.assign(i.current.style,t)}var k={src:Aa.staticImageDataToSrc(n.state.src),style:Object.assign({},w.config.app.debug?{border:"1px solid red"}:{})};return r.logger.debug("image props",k,n.state,n.state.src),Au().createElement(Ru,{className:"absolute overflow-hidden"},Au().createElement("div",cf({ref:function(t){return i.current=t},className:"absolute"},d({style:{opacity:0}},l)),h?Au().createElement(Au().Fragment,null,h.toElementProps().map((function(t,e,n){var r=d(k,t,{style:{transform:"translate(0%, -50%)"}});return Au().createElement(sf.img,cf({className:"absolute",key:e===n.length-1?"last":e,alt:r.alt},r,{onLoad:_,layout:!0}))}))):Au().createElement(sf.img,cf({alt:"image",key:"last"},k,{onLoad:_})),(n.events.emit(ji.EventTypes["event:image.flush"]),null)))}function mf(t){return mf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mf(t)}function gf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,bf(r.key),r)}}function bf(t){var e=function(t,e){if("object"!=mf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=mf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==mf(e)?e:e+""}var wf=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.preloaded=[],this.events=new m}return function(t,e,n){return e&&gf(t.prototype,e),n&&gf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"add",value:function(e){return this.has(this.getSrc(e))||(this.preloaded.push(e),this.events.emit(t.EventTypes["event:preloaded.add"],e),this.events.emit(t.EventTypes["event:preloaded.change"])),this}},{key:"get",value:function(t){var e=this;return this.preloaded.find((function(n){return e.getSrc(n)===t}))}},{key:"has",value:function(t){var e=this;return Array.isArray(t)?t.every((function(t){return e.has(t)})):this.preloaded.some((function(n){return e.getSrc(n)===t}))}},{key:"remove",value:function(e){var n=this;if(Array.isArray(e)){var r=e.map((function(t){return n.getSrc(t)}));return this.preloaded=this.preloaded.filter((function(t){return!r.includes(n.getSrc(t))})),this}var o=this.getSrc(e);return this.preloaded=this.preloaded.filter((function(t){return n.getSrc(t)!==o})),this.events.emit(t.EventTypes["event:preloaded.remove"],e),this.events.emit(t.EventTypes["event:preloaded.change"]),this}},{key:"clear",value:function(){return this.preloaded=[],this}},{key:"getSrc",value:function(t){return"string"==typeof t?t:"image"===t.type?Aa.srcToString(t.src.state.src):"video"===t.type?t.src:"audio"===t.type?t.src.getSrc():""}}])}();function _f(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Sf(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Sf(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Sf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}wf.EventTypes={"event:preloaded.add":"event:preloaded.add","event:preloaded.remove":"event:preloaded.remove","event:preloaded.change":"event:preloaded.change","event:preloaded.mount":"event:preloaded.mount","event:preloaded.ready":"event:preloaded.ready"};var kf=(0,xu.createContext)(null);function xf(t){var e=t.children,n=_f((0,xu.useState)(new wf),1)[0];return Au().createElement(Au().Fragment,null,Au().createElement(kf.Provider,{value:{preloaded:n}},e))}function Af(){if(!kf)throw new Error("usePreloaded must be used within a PreloadedProvider");return(0,xu.useContext)(kf)}function Tf(t){return function(t){if(Array.isArray(t))return Ef(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Ef(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ef(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ef(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Of(t){var e=t.state,n=Af().preloaded,r=e.getLastScene();return(0,xu.useEffect)((function(){var t,r;if("undefined"!=typeof window){var o=null===(t=e.getLastScene())||void 0===t?void 0:t.srcManager,i=(null===(r=e.getLastScene())||void 0===r?void 0:r.srcManager.future)||[],a=[].concat(Tf(o?o.src:[]),Tf(i.map((function(t){return t.src})).flat(2))),s={image:new Set,audio:new Set,video:new Set};a.forEach((function(t){t.type===Cs.SrcTypes.image?s.image.add(t.src):t.type===Cs.SrcTypes.audio?s.audio.add(t.src):t.type===Cs.SrcTypes.video&&s.video.add(t.src)})),e.logger.debug("Preloading",s,i),n.preloaded=n.preloaded.filter((function(t){if(t.type===Cs.SrcTypes.audio){var e=s[t.type].has(t.src);return e||(e=Array.from(s[t.type]).some((function(e){return n.getSrc(t)===n.getSrc(e.config.src)}))),e}if(t.type===Cs.SrcTypes.image)return s[t.type].has(t.src);var r=n.getSrc(t);return s[t.type].has(r)}));var u=[];return s.image.forEach((function(t){var r=new Image;r.src=Aa.srcToString(t.state.src),r.onload=function(){e.logger.debug("Image loaded",t.state.src)},u.push(r),n.add({type:"image",src:t})})),Promise.all([]).then((function(){e.logger.log("Preloaded","Preloaded ".concat(s.image.size," images")),n.events.emit(wf.EventTypes["event:preloaded.ready"]),e.events.emit(_u.EventTypes["event:state.preload.loaded"])})),s.audio.forEach((function(t){t.$getHowl()||t.$setHowl(new(e.getHowl())({src:t.config.src,loop:t.config.loop,volume:t.config.volume,autoplay:!1,preload:!0}))})),n.events.emit(wf.EventTypes["event:preloaded.mount"]),function(){u.forEach((function(t){t.onload=null})),e.events.emit(_u.EventTypes["event:state.preload.unmount"]),e.logger.debug("Preload unmounted")}}console.warn("Window is not supported in this environment")}),[r]),null}function Pf(t){var e=t.state,n=$u().game;return(0,xu.useEffect)((function(){if(window){var t,r,o,i=(t=function(t){n.config.player.skipKey.includes(t.key)&&e.events.emit(_u.EventTypes["event:state.player.skip"])},r=n.config.player.skipInterval,o=0,function(){var e=Date.now();if(!(e-o<r))return o=e,t.apply(void 0,arguments)});return window.addEventListener("keydown",i),function(){window.removeEventListener("keydown",i)}}e.logger.warn("NarraLeaf-React: Announcer","Cannot listen to window events")}),[]),Au().createElement(Au().Fragment,null)}var jf=o(33);function Cf(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return If(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?If(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function If(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Lf(t,e){return t.handle(e)}function Mf(t){var e=t.story,n=t.width,r=t.height,o=t.className,i=t.onReady,a=t.onEnd,s=Cf((0,xu.useReducer)((function(t){return t+1}),0),2)[1],u=$u().game,c=Cf((0,xu.useReducer)(Lf,new _u(u,{update:s,forceUpdate:function(){l.logger.warn("Player","force update"),(0,jf.flushSync)((function(){s()}))},next:y,dispatch:function(t){return f(t)}})),2),l=c[0],f=c[1],p=u.config.elements.say.use,d=u.config.elements.menu.use;function y(){for(var t=!1;!t;){var e=u.getLiveGame().next(l);if(!e)break;if(h.isAwaitable(e)){t=!0;break}f(e)}l.stage.update()}(0,xu.useEffect)((function(){return u.getLiveGame().setGameState(l).loadStory(e),function(){u.getLiveGame().setGameState(void 0)}}),[u]),(0,xu.useEffect)((function(){var t=!1,e=Promise.resolve().then((function(){t=!0,i&&i({game:u,gameState:l,liveGame:u.getLiveGame(),storable:u.getLiveGame().getStorable()});var e=l.getLastScene(),n=[];e?n.push({type:"event:scene.mount",listener:e.events.once("event:scene.mount",(function(){l.stage.next()}))}):l.stage.next();var r=l.events.onEvents([{type:_u.EventTypes["event:state.end"],listener:function(){a&&a({game:u,gameState:l,liveGame:u.getLiveGame(),storable:u.getLiveGame().getStorable()})}}]),o=l.events.onEvents([{type:_u.EventTypes["event:state.player.skip"],listener:function(){u.getLiveGame().abortAwaiting(),y()}}]);return l.stage.update(),function(){e&&n.forEach((function(t){e.events.off(t.type,t.listener)})),r.cancel(),o.cancel()}}));return function(){t&&e.then((function(t){return t()}))}}),[]),l.events.emit(_u.EventTypes["event:state.player.flush"]);var v=n||u.config.player.width,m=r||u.config.player.height;return Au().createElement(nl,null,Au().createElement("div",{style:{width:"number"==typeof v?"".concat(v,"px"):v,height:"number"==typeof m?"".concat(m,"px"):m},className:ku(o,"__narraleaf_content-player")},Au().createElement(il,{className:ku("flex-grow overflow-auto")},Au().createElement(Ru,{className:"relative"},Au().createElement(Of,{state:l}),Au().createElement(Nf,{onLoaded:function(){l.stage.update(),e&&y()},state:l},Au().createElement(Pf,{state:l}),l.getSceneElements().map((function(t){var e=t.scene,n=t.ele;return Au().createElement(wl,{key:"scene-"+e.getId(),state:l,scene:e},n.images.map((function(t){return Au().createElement(vf,{key:"image-"+t.getId(),image:t,state:l})})),n.texts.map((function(t){var e=t.action,n=t.onClick;return Au().createElement(p,{state:l,key:"say-"+e.id,action:e,onClick:function(){n(),y()}})})),n.menus.map((function(t,e){return Au().createElement("div",{key:"menu-"+e},Au().createElement(d,{state:l,prompt:t.action.prompt,choices:t.action.choices,afterChoose:function(e){t.onClick(e),y()}}))})))})))))))}function Nf(t){var e=t.children,n=t.onLoaded,r=t.state,o=Af().preloaded,i=Cf((0,xu.useState)(!1),2),a=i[0],s=i[1];return(0,xu.useEffect)((function(){var t=o.events.on(wf.EventTypes["event:preloaded.ready"],(function(){s(!0),n()})),e=r.events.on(_u.EventTypes["event:state.preload.unmount"],(function(){s(!1)}));return function(){o.events.off(wf.EventTypes["event:preloaded.ready"],t),r.events.off(_u.EventTypes["event:state.preload.unmount"],e)}}),[a]),Au().createElement(Au().Fragment,null,a?e:null)}function Rf(t){var e=t.children,n=t.game;return Au().createElement(Au().Fragment,null,Au().createElement(Lu,null,Au().createElement(Hu,{game:n},Au().createElement(xf,null,e))))}function Ff(t){return Ff="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ff(t)}function Vf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Df(r.key),r)}}function Df(t){var e=function(t,e){if("object"!=Ff(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ff(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ff(e)?e:e+""}var Bf=function(){return function(t,e,n){return e&&Vf(t.prototype,e),n&&Vf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.events=new m}),[{key:"start",value:function(t){throw new Error("Method not implemented.")}},{key:"toElementProps",value:function(){throw new Error("Method not implemented.")}},{key:"setSrc",value:function(t){throw new Error("Method not implemented.")}},{key:"requestAnimation",value:function(t,e,n){var r=this,o=t.start,i=t.end,a=t.duration,s=e.onComplete,u=e.onUpdate;return this.events.emit(al.start,null),this.controller=ei(o,i,Object.assign({duration:a/1e3,onUpdate:function(t){u&&u(t),r.events.emit(al.update,r.toElementProps())},onComplete:function(){r.controller=void 0,r.events.emit(al.end,null),s&&s()}},n)),this.controller}},{key:"copy",value:function(){throw new Error("Method not implemented.")}}])}();function Gf(t){return Gf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gf(t)}function Uf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Hf(r.key),r)}}function Hf(t){var e=function(t,e){if("object"!=Gf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Gf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Gf(e)?e:e+""}function $f(t,e,n){return e=Wf(e),function(t,e){if(e&&("object"==Gf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,zf()?Reflect.construct(e,n||[],Wf(t).constructor):e.apply(t,n))}function zf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(zf=function(){return!!t})()}function Wf(t){return Wf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wf(t)}function qf(t,e){return qf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},qf(t,e)}var Yf=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,r=arguments.length>1?arguments[1]:void 0;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=$f(this,e)).state={opacity:1},t.duration=n,r&&(t.src="string"==typeof r?r:r instanceof Us?Aa.backgroundToSrc(r.config.background):Aa.staticImageDataToSrc(r)),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&qf(t,e)}(e,t),function(t,e,n){return e&&Uf(t.prototype,e),n&&Uf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){this.src=t}},{key:"start",value:function(t){var n=this;this.state.opacity=e.Frames[0],this.requestAnimation({start:e.Frames[0],end:e.Frames[1],duration:this.duration},{onComplete:function(){t&&t(),n.state.opacity=e.Frames[1]},onUpdate:function(t){n.state.opacity=t}})}},{key:"toElementProps",value:function(){return[{},{style:{opacity:this.state.opacity},src:this.src}]}},{key:"copy",value:function(){return new e(this.duration,this.src)}}])}(Bf);function Xf(t){return Xf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xf(t)}function Kf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Zf(r.key),r)}}function Zf(t){var e=function(t,e){if("object"!=Xf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Xf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Xf(e)?e:e+""}function Qf(t,e,n){return e=tp(e),function(t,e){if(e&&("object"==Xf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Jf()?Reflect.construct(e,n||[],tp(t).constructor):e.apply(t,n))}function Jf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Jf=function(){return!!t})()}function tp(t){return tp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},tp(t)}function ep(t,e){return ep=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ep(t,e)}Yf.Frames=[0,1];var np=function(t){function e(t,n){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=arguments.length>3?arguments[3]:void 0;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(r=Qf(this,e)).state={opacity:0,transform:""},r.duration=o,r.direction=t,r.offset=n,i&&(r.src="string"==typeof i?i:i instanceof Us?Aa.backgroundToSrc(i.config.background):Aa.staticImageDataToSrc(i)),r.__stack=g(),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ep(t,e)}(e,t),function(t,e,n){return e&&Kf(t.prototype,e),n&&Kf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){this.src=t}},{key:"start",value:function(t){var e=this;if(!this.src)throw new Error("src is required, but not provided\nat:\n"+this.__stack);this.state.opacity=0,this.state.transform=this.getInitialTransform(),this.requestAnimation({start:0,end:1,duration:this.duration},{onComplete:t,onUpdate:function(t){e.state.opacity=t,e.state.transform=e.getTransform(t)}})}},{key:"toElementProps",value:function(){return[{style:{opacity:1}},{style:{opacity:this.state.opacity,transform:this.state.transform},src:this.src}]}},{key:"copy",value:function(){return new e(this.direction,this.offset,this.duration,this.src)}},{key:"getInitialTransform",value:function(){switch(this.direction){case"left":return"translateX(-".concat(this.offset,"px)");case"right":return"translateX(".concat(this.offset,"px)");case"top":return"translateY(-".concat(this.offset,"px)");case"bottom":return"translateY(".concat(this.offset,"px)");default:return""}}},{key:"getTransform",value:function(t){switch(this.direction){case"left":return"translateX(".concat((1-t)*-this.offset,"px)");case"right":return"translateX(".concat((1-t)*this.offset,"px)");case"top":return"translateY(".concat((1-t)*-this.offset,"px)");case"bottom":return"translateY(".concat((1-t)*this.offset,"px)");default:return""}}}])}(Bf);function rp(t){return rp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rp(t)}function op(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ip(r.key),r)}}function ip(t){var e=function(t,e){if("object"!=rp(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=rp(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==rp(e)?e:e+""}function ap(t,e,n){return e=up(e),function(t,e){if(e&&("object"==rp(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,sp()?Reflect.construct(e,n||[],up(t).constructor):e.apply(t,n))}function sp(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(sp=function(){return!!t})()}function up(t){return up=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},up(t)}function cp(t,e){return cp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},cp(t,e)}var lp=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,r=arguments.length>1?arguments[1]:void 0;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=ap(this,e)).state={opacity:0},t.duration=n,r&&(t.src="string"==typeof r?r:r instanceof Us?Aa.backgroundToSrc(r.config.background):Aa.staticImageDataToSrc(r)),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&cp(t,e)}(e,t),function(t,e,n){return e&&op(t.prototype,e),n&&op(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){this.src=t}},{key:"start",value:function(t){var n=this;this.state.opacity=e.Frames[0],this.requestAnimation({start:e.Frames[0],end:e.Frames[1],duration:this.duration},{onComplete:function(){n.state.opacity=e.Frames[1],t&&t()},onUpdate:function(t){n.state.opacity=t}})}},{key:"toElementProps",value:function(){return[{style:{opacity:this.state.opacity}},{style:{opacity:1-this.state.opacity},src:this.src}]}},{key:"copy",value:function(){return new e(this.duration,this.src)}}])}(Bf);lp.Frames=[1,0]})(),i})()));
31
+ */function c(t,e,n){var r,i={},c=null,l=null;for(r in void 0!==n&&(c=""+n),void 0!==e.key&&(c=""+e.key),void 0!==e.ref&&(l=e.ref),e)a.call(e,r)&&!u.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps)void 0===i[r]&&(i[r]=e[r]);return{$$typeof:o,type:t,key:c,ref:l,props:i,_owner:s.current}}e.jsx=c,e.jsxs=c},848:(t,e,n)=>{"use strict";t.exports=n(20)},72:t=>{"use strict";var e=[];function n(t){for(var n=-1,r=0;r<e.length;r++)if(e[r].identifier===t){n=r;break}return n}function r(t,r){for(var i={},a=[],s=0;s<t.length;s++){var u=t[s],c=r.base?u[0]+r.base:u[0],l=i[c]||0,f="".concat(c," ").concat(l);i[c]=l+1;var p=n(f),d={css:u[1],media:u[2],sourceMap:u[3],supports:u[4],layer:u[5]};if(-1!==p)e[p].references++,e[p].updater(d);else{var h=o(d,r);r.byIndex=s,e.splice(s,0,{identifier:f,updater:h,references:1})}a.push(f)}return a}function o(t,e){var n=e.domAPI(e);n.update(t);return function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,o){var i=r(t=t||[],o=o||{});return function(t){t=t||[];for(var a=0;a<i.length;a++){var s=n(i[a]);e[s].references--}for(var u=r(t,o),c=0;c<i.length;c++){var l=n(i[c]);0===e[l].references&&(e[l].updater(),e.splice(l,1))}i=u}}},659:t=>{"use strict";var e={};t.exports=function(t,n){var r=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},540:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},56:(t,e,n)=>{"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},825:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),e.styleTagTransform(r,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},113:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},12:e=>{"use strict";e.exports=t},33:t=>{"use strict";t.exports=e}},r={};function o(t){var e=r[t];if(void 0!==e)return e.exports;var i=r[t]={id:t,exports:{}};return n[t](i,i.exports,o),i.exports}o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.nc=void 0;var i={};return(()=>{"use strict";function t(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */t=function(){return n};var e,n={},r=Object.prototype,o=r.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(e){l=function(t,e,n){return t[e]=n}}function p(t,e,n,r){var o=e&&e.prototype instanceof b?e:b,a=Object.create(o.prototype),s=new I(r||[]);return i(a,"_invoke",{value:O(t,n,s)}),a}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}n.wrap=p;var h="suspendedStart",y="suspendedYield",v="executing",m="completed",g={};function b(){}function w(){}function _(){}var S={};l(S,s,(function(){return this}));var k=Object.getPrototypeOf,x=k&&k(k(L([])));x&&x!==r&&o.call(x,s)&&(S=x);var A=_.prototype=b.prototype=Object.create(S);function T(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(r,i,a,s){var u=d(t[r],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==f(l)&&o.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var r;i(this,"_invoke",{value:function(t,o){function i(){return new e((function(e,r){n(t,o,e,r)}))}return r=r?r.then(i,i):i()}})}function O(t,n,r){var o=h;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=P(s,r);if(u){if(u===g)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=v;var c=d(t,n,r);if("normal"===c.type){if(o=r.done?m:y,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=m,r.method="throw",r.arg=c.arg)}}}function P(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,P(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=d(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[s];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function n(){for(;++r<t.length;)if(o.call(t,r))return n.value=t[r],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(f(t)+" is not iterable")}return w.prototype=_,i(A,"constructor",{value:_,configurable:!0}),i(_,"constructor",{value:w,configurable:!0}),w.displayName=l(_,c,"GeneratorFunction"),n.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,l(t,c,"GeneratorFunction")),t.prototype=Object.create(A),t},n.awrap=function(t){return{__await:t}},T(E.prototype),l(E.prototype,u,(function(){return this})),n.AsyncIterator=E,n.async=function(t,e,r,o,i){void 0===i&&(i=Promise);var a=new E(p(t,e,r,o),i);return n.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},T(A),l(A,c,"Generator"),l(A,s,(function(){return this})),l(A,"toString",(function(){return"[object Generator]"})),n.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},n.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(C),!t)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(r,o){return s.type="throw",s.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),c=o.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;C(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},n}function e(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=c(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,s(r.key),r)}}function a(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t){var e=function(t,e){if("object"!=f(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==f(e)?e:e+""}function u(t){return function(t){if(Array.isArray(t))return l(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||c(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(t,e){if(t){if("string"==typeof t)return l(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(t,e):void 0}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}o.r(i),o.d(i,{Align:()=>wt,Base:()=>Bf,Character:()=>Ba,ColoredSentence:()=>Yu,CommonPosition:()=>gt,CommonPositionType:()=>st,Condition:()=>ts,Control:()=>Si,Coord2D:()=>bt,Dissolve:()=>lp,Fade:()=>Yf,FadeIn:()=>np,Game:()=>nc,GameProviders:()=>Rf,GameState:()=>_u,Image:()=>ji,Isolated:()=>Ru,Lambda:()=>Ja,LiveGame:()=>rc,Menu:()=>us,Namespace:()=>du,Player:()=>Mf,Say:()=>qu,Scene:()=>Us,Script:()=>Zs,Sentence:()=>Fa,Sound:()=>Es,SoundType:()=>gs,Storable:()=>hu,Story:()=>iu,Transform:()=>hi,Utils:()=>Aa,Word:()=>Da,useGame:()=>$u});var p=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};function d(t,e){var n=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r={},o=function(t,e,n){return"object"!==f(e)||null===e||Array.isArray(e)||"object"!==f(n)||null===n||Array.isArray(n)?Array.isArray(e)&&Array.isArray(n)?e.map((function(t,e){return"object"===f(t)&&null!==t&&!Array.isArray(t)&&n[e]?d(t,n[e]):t})):void 0===n?e:n:e.constructor!==Object||n.constructor!==Object?n||e:d(e,n)};for(var i in t)n(t,i)&&(r[i]=o(0,t[i],e[i]));for(var a in e)n(e,a)&&!n(r,a)&&("object"===f(e[a])&&null!==e[a]&&e[a].constructor===Object?r[a]=d({},e[a]):r[a]=e[a]);for(var s=arguments.length,c=new Array(s>2?s-2:0),l=2;l<s;l++)c[l-2]=arguments[l];if(c.length){var p=c[0],h=c.slice(1);return d.apply(void 0,[r,p].concat(u(h)))}return r}var h=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t},r=arguments.length>1?arguments[1]:void 0;n(this,t),this.solved=!1,this.listeners=[],this.receiver=e,this.skipController=r}return a(t,[{key:"registerSkipController",value:function(t){return this.skipController=t,this}},{key:"resolve",value:function(t){if(!this.solved){this.result=this.receiver(t),this.solved=!0,this.skipController&&this.skipController.cancel();var n,r=e(this.listeners);try{for(r.s();!(n=r.n()).done;){(0,n.value)(this.result)}}catch(t){r.e(t)}finally{r.f()}}}},{key:"then",value:function(t){this.result?t(this.result):this.listeners.push(t)}},{key:"abort",value:function(){return this.skipController?this.skipController.abort():this.result}}],[{key:"isAwaitable",value:function(e){return e instanceof t}}])}();function y(t){var n=new WeakSet;return function t(r){if(null===r||"object"!==f(r))return r;if(!n.has(r)){if(n.add(r),Array.isArray(r)){var o,i=[],a=e(r);try{for(a.s();!(o=a.n()).done;){var s=o.value;i.push(t(s))}}catch(t){a.e(t)}finally{a.f()}return i}var u={};for(var c in r)Object.prototype.hasOwnProperty.call(r,c)&&(u[c]=t(r[c]));return u}}(t)}function v(t){return"string"==typeof t?t:"#".concat((t.r||0).toString(16).padStart(2,"0")).concat((t.g||0).toString(16).padStart(2,"0")).concat((t.b||0).toString(16).padStart(2,"0")).concat(void 0===t.a?"":t.a.toString(16).padStart(2,"0"))}var m=function(){return a((function t(){n(this,t),this.events={}}),[{key:"on",value:function(t,e){return this.events[t]||(this.events[t]=[]),this.events[t].push(e),this.emit("event:EventDispatcher.register",t,e),e}},{key:"onEvents",value:function(t){var e=this,n=t.map((function(t){var n=t.type,r=t.listener;return{type:n,listener:r,cancel:function(){e.off(n,r)}}}));return{tokens:n,cancel:function(){n.forEach((function(t){return t.cancel()}))}}}},{key:"off",value:function(t,e){this.events[t]&&(this.events[t]=this.events[t].filter((function(t){return t!==e})))}},{key:"emit",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];this.events[t]&&this.events[t].forEach((function(t){t.apply(void 0,n)}))}},{key:"once",value:function(t,e){var n=this,r=function(){e.apply(void 0,arguments),n.off(t,r)};return this.on(t,r)}},{key:"any",value:function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return p(this,void 0,void 0,t().mark((function r(){var i,a,s,u,c,l=this;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.events[n]||(this.events[n]=[]),i=[],a=e(this.events[n]);try{for(a.s();!(s=a.n()).done;)u=s.value,(c=u.apply(void 0,o))&&"object"===f(c)&&"function"==typeof c.then&&i.push(c)}catch(t){a.e(t)}finally{a.f()}if(this.events[n]=this.events[n].filter((function(t){return!i.includes(t)})),0!==i.length){t.next=7;break}return t.abrupt("return",new Promise((function(t){var e=l.on("event:EventDispatcher.register",(function(r,i){if(r===n){l.off(r,e);var a=null==i?void 0:i.apply(void 0,o);a&&a.then?a.then(t):t(a)}}))})));case 7:return t.next=9,Promise.all(i);case 9:return t.abrupt("return",void 0);case 10:case"end":return t.stop()}}),r,this)})))}},{key:"clear",value:function(){this.events={}}}])}();function g(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(new Error).stack;return n?n.split("\n").slice(t+1,-e).join("\n").trim():""}function b(t){return new Promise((function(e){return setTimeout(e,t)}))}function w(t,e){if(t===e)return!0;if("object"!==f(t)||"object"!==f(e)||null===t||null===e)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(var o=0,i=n;o<i.length;o++){var a=i[o];if(!r.includes(a)||!w(t[a],e[a]))return!1}return!0}var _,S=function(){return a((function t(e,r){n(this,t),this.game=e,this.prefix=r}),[{key:"log",value:function(t){if(this.game.config.app.logger.log){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).log.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"info",value:function(t){if(this.game.config.app.logger.info){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).info.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"warn",value:function(t){if(this.game.config.app.logger.warn){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).warn.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"error",value:function(t){if(this.game.config.app.logger.error){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).error.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"debug",value:function(t){if(this.game.config.app.logger.debug){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).debug.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"trace",value:function(t){if(this.game.config.app.logger.trace){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];console.trace(this._log.apply(this,[t].concat(n)))}}},{key:"_log",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return 0===n.length?[this.prefix||"",t]:["".concat(this.prefix||""," [").concat(t,"]")].concat(n)}}])}(),k=function(){return a((function t(e){n(this,t),this.abortHandler=e,this.events=new m,this.aborted=!1}),[{key:"abort",value:function(){return this.aborted||(this.aborted=!0,this.result=this.abortHandler.apply(this,arguments)),this.result}},{key:"isAborted",value:function(){return this.aborted}},{key:"cancel",value:function(){this.aborted=!0}}])}();function x(t){return x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},x(t)}function A(t,e,n){return e=E(e),function(t,e){if(e&&("object"==x(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,T()?Reflect.construct(e,n||[],E(t).constructor):e.apply(t,n))}function T(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(T=function(){return!!t})()}function E(t){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},E(t)}function O(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&P(t,e)}function P(t,e){return P=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},P(t,e)}function j(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function C(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,L(r.key),r)}}function I(t,e,n){return e&&C(t.prototype,e),n&&C(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function L(t){var e=function(t,e){if("object"!=x(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=x(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==x(e)?e:e+""}k.EventTypes={"event:skipController.abort":"event:skipController.abort"},function(t){t.TreeNode="TreeNode",t.ContentNode="ContentNode"}(_||(_={}));var M=function(t){function e(t,n,r){var o;return j(this,e),(o=A(this,e,[_.ContentNode])).child=r||null,o.parent=n||null,o.action=t||null,o}return O(e,t),I(e,[{key:"setParent",value:function(t){if(t===this)throw new Error("Cannot set parent to itself");return this.parent=t,this}},{key:"setChild",value:function(t){if(t===this)throw new Error("Cannot set child to itself");return this.child=t,t&&t.parent!==this&&t.remove().setParent(this),this}},{key:"getChild",value:function(){return this.child||null}},{key:"getParent",value:function(){return this.parent||null}},{key:"addChild",value:function(t){return this.setChild(t),this}},{key:"removeChild",value:function(t){return t&&this.child===t?(this.child=null,t.setParent(null)):t||(this.child=null),this}},{key:"remove",value:function(){var t;return null===(t=this.parent)||void 0===t||t.removeChild(this),this}},{key:"hasChild",value:function(){return!!this.child}}],[{key:"forEachParent",value:function(t,e){for(var n=new Set,r=t;r&&!n.has(r);)n.add(r),e(r),r=r.getParent()}},{key:"forEachChild",value:function(t,e){for(var n=new Set,r=t;r&&!n.has(r);)n.add(r),e(r),r=r.getChild()}}])}(function(){return I((function t(e){j(this,t),this.type=e,this.content=void 0}),[{key:"setContent",value:function(t){return this.content=t,this}},{key:"getContent",value:function(){return this.content}}])}());function N(t){return N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},N(t)}function R(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,F(r.key),r)}}function F(t){var e=function(t,e){if("object"!=N(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=N(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==N(e)?e:e+""}var V,D=function(){return function(t,e,n){return e&&R(t.prototype,e),n&&R(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.id=""}),[{key:"setId",value:function(t){this.id=t}},{key:"getId",value:function(){return this.id}},{key:"reset",value:function(){}},{key:"fromData",value:function(t){return this}},{key:"construct",value:function(t){for(var e,n=0;n<t.length;n++){var r=t[n];0!==n&&(null===(e=t[n-1])||void 0===e||e.contentNode.setChild(r.contentNode))}return t}}])}();function B(t){return B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},B(t)}function G(t){return function(t){if(Array.isArray(t))return U(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return U(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?U(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function U(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function H(t,e,n){return e=z(e),function(t,e){if(e&&("object"==B(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,$()?Reflect.construct(e,n||[],z(t).constructor):e.apply(t,n))}function $(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return($=function(){return!!t})()}function z(t){return z=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},z(t)}function W(t,e){return W=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},W(t,e)}function q(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Y(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,K(r.key),r)}}function X(t,e,n){return e&&Y(t.prototype,e),n&&Y(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function K(t){var e=function(t,e){if("object"!=B(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=B(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==B(e)?e:e+""}var Z=Symbol("_Chained"),Q=function(){function t(e){q(this,t),this[V]=!0,this.__actions=[],this.__self=e}return X(t,[{key:"push",value:function(){var t;(t=this.__actions).push.apply(t,arguments)}},{key:"getActions",value:function(){return this.__actions}},{key:"getSelf",value:function(){return this.__self}},{key:"newChain",value:function(){return this.getSelf().chain()}}],[{key:"isChained",value:function(t){return t&&t[Z]}},{key:"toActions",value:function(e){return e.flat(2).map((function(e){return t.isChained(e)?e.fromChained(e):e})).flat(3)}}])}();V=Z;var J=function(t){function e(){return q(this,e),H(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&W(t,e)}(e,t),X(e,[{key:"chain",value:function(t){var e=Q.isChained(this)?this:this.proxy(this,new Q(this));if(!t)return e;var n=Array.isArray(t)?t:[t];return e.push.apply(e,G(n)),e}},{key:"proxy",value:function(t,e){var n=new Proxy(t,{get:function(t,r){if(r in e)return e[r];var o=t[r];return"function"==typeof o?o.bind(n):o},set:function(t,e,n){return t[e]=n,!0}});return n}},{key:"combineActions",value:function(t,e){var n=e(this.chain().newChain()),r=new da(t.chain(),da.ActionTypes.do,(new M).setContent([this.construct(Q.toActions([n]))]));return this.chain(r)}}])}(D);function tt(t){return tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tt(t)}function et(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,nt(r.key),r)}}function nt(t){var e=function(t,e){if("object"!=tt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=tt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==tt(e)?e:e+""}function rt(t,e,n){return e=it(e),function(t,e){if(e&&("object"==tt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ot()?Reflect.construct(e,n||[],it(t).constructor):e.apply(t,n))}function ot(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ot=function(){return!!t})()}function it(t){return it=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},it(t)}function at(t,e){return at=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},at(t,e)}var st,ut=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),rt(this,e)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&at(t,e)}(e,t),function(t,e,n){return e&&et(t.prototype,e),n&&et(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"toData",value:function(){return null}},{key:"fromChained",value:function(t){return t.getActions()}}])}(J),ct={center:"center",left:"left",right:"right"};function lt(t){return lt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lt(t)}function ft(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function pt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,yt(r.key),r)}}function dt(t,e,n){return e&&pt(t.prototype,e),n&&pt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function ht(t,e,n){return(e=yt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function yt(t){var e=function(t,e){if("object"!=lt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=lt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==lt(e)?e:e+""}!function(t){t.Left="left",t.Center="center",t.Right="right"}(st||(st={}));var vt=ht(ht(ht({},st.Left,"33.33%"),st.Center,"50%"),st.Right,"66.66%"),mt=function(){function t(){ft(this,t)}return dt(t,null,[{key:"isUnknown",value:function(e){return e===t.Unknown}},{key:"wrap",value:function(t){return Object.assign({left:"auto",top:"auto",right:"auto",bottom:"auto"},t)}},{key:"D2PositionToCSS",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.calc(t.y,t.yoffset),o=this.calc(t.x,t.xoffset),i=n?{bottom:r}:{top:r},a=e?{right:o}:{left:o};return this.wrap(Object.assign(Object.assign({},i),a))}},{key:"calc",value:function(e,n){if(!e||t.isUnknown(e))return"auto";if(void 0===n||t.isUnknown(n))return"calc(".concat(e," + 0px)");var r="number"==typeof e?"".concat(e,"px"):e;return"calc(".concat(r," + (").concat(n,"px))")}},{key:"toCoord2D",value:function(t){if(gt.isCommonPositionType(t))return bt.fromCommonPosition(t);if(bt.isCoord2DPosition(t))return t;if(wt.isAlignPosition(t))return bt.fromAlignPosition(t);if("object"===lt(t)&&["x","y","xoffset","yoffset"].some((function(e){return e in t})))return new bt(t);throw new Error("Invalid position type")}},{key:"orUnknown",value:function(e){return t.isUnknown(e)||void 0===e?t.Unknown:e}},{key:"mergePosition",value:function(t,e){var n=this.toCoord2D(t),r=this.toCoord2D(e);return bt.merge(n,r)}},{key:"serializePosition",value:function(e){var n=this.toCoord2D(e);return{x:t.isUnknown(n.x)?0:n.x,y:t.isUnknown(n.y)?0:n.y,xoffset:t.isUnknown(n.xoffset)?0:n.xoffset,yoffset:t.isUnknown(n.yoffset)?0:n.yoffset}}},{key:"isRawCommonPositionType",value:function(t){return Object.values(st).includes(t)}},{key:"isRawCoord2DPosition",value:function(t){return"object"===lt(t)&&("x"in t||"y"in t||"xoffset"in t||"yoffset"in t)}},{key:"isRawAlignPosition",value:function(t){return"object"===lt(t)&&("xalign"in t||"yalign"in t||"xoffset"in t||"yoffset"in t)}},{key:"isRawPosition",value:function(t){return this.isRawCommonPositionType(t)||this.isRawCoord2DPosition(t)||this.isRawAlignPosition(t)}},{key:"isPosition",value:function(t){return t instanceof gt||t instanceof bt||t instanceof wt}},{key:"rawPositionToCoord2D",value:function(t){if(this.isRawCommonPositionType(t))return bt.fromCommonPosition(new gt(t));if(this.isRawCoord2DPosition(t))return new bt(t);if(this.isRawAlignPosition(t))return bt.fromAlignPosition(t);throw new Error("Invalid position type")}},{key:"tryParsePosition",value:function(t){if(this.isPosition(t))return t;if(this.isRawPosition(t))return this.rawPositionToCoord2D(t);throw new Error("Invalid position type")}}])}();mt.Unknown=Symbol("Unknown");var gt=function(){function t(e){ft(this,t),this.position=e}return dt(t,[{key:"toCSS",value:function(){return{x:vt[this.position],y:"50%",xoffset:0,yoffset:0}}}],[{key:"isCommonPositionType",value:function(e){return e instanceof t}}])}();gt.Positions=st;var bt=function(){function t(e,n){ft(this,t),"object"===lt(e)?(this.x=mt.orUnknown(e.x),this.y=mt.orUnknown(e.y),this.xoffset=mt.orUnknown(e.xoffset),this.yoffset=mt.orUnknown(e.yoffset)):(this.x=mt.orUnknown(e),this.y=mt.orUnknown(n),this.xoffset=mt.Unknown,this.yoffset=mt.Unknown)}return dt(t,[{key:"toCSS",value:function(){return{x:this.x,y:this.y,xoffset:this.xoffset,yoffset:this.yoffset}}}],[{key:"isCoord2DPosition",value:function(e){return e instanceof t}},{key:"fromCommonPosition",value:function(e){return new t({x:vt[e.position],y:"50%"})}},{key:"fromAlignPosition",value:function(e){return new t({x:mt.isUnknown(e.xalign)?mt.Unknown:"".concat(100*e.xalign,"%"),y:mt.isUnknown(e.yalign)?mt.Unknown:"".concat(100*e.yalign,"%"),xoffset:e.xoffset,yoffset:e.yoffset})}},{key:"merge",value:function(e,n){return new t({x:mt.isUnknown(n.x)?e.x:n.x,y:mt.isUnknown(n.y)?e.y:n.y,xoffset:mt.isUnknown(n.xoffset)?e.xoffset:n.xoffset,yoffset:mt.isUnknown(n.yoffset)?e.yoffset:n.yoffset})}}])}(),wt=function(){function t(e,n){ft(this,t),"object"===lt(e)?(this.xalign=mt.orUnknown(e.xalign),this.yalign=mt.orUnknown(e.yalign),this.xoffset=mt.orUnknown(e.xoffset),this.yoffset=mt.orUnknown(e.yoffset)):(this.xalign=mt.orUnknown(e),this.yalign=mt.orUnknown(n),this.xoffset=mt.Unknown,this.yoffset=mt.Unknown)}return dt(t,[{key:"toCSS",value:function(){return{x:mt.isUnknown(this.xalign)?this.xalign:"".concat(100*this.xalign,"%"),y:mt.isUnknown(this.yalign)?this.yalign:"".concat(100*this.yalign,"%"),xoffset:this.xoffset,yoffset:this.yoffset}}}],[{key:"isAlignPosition",value:function(e){return e instanceof t}}])}();const _t=t=>t;let St=_t,kt=_t;function xt(t,e,n){var r;if("string"==typeof t){let o=document;e&&(kt(Boolean(e.current),"Scope provided, but no element detected."),o=e.current),n?(null!==(r=n[t])&&void 0!==r||(n[t]=o.querySelectorAll(t)),t=n[t]):t=o.querySelectorAll(t)}else t instanceof Element&&(t=[t]);return Array.from(t||[])}const At=new WeakMap,Tt=!1,Et=!1;const Ot=["read","resolveKeyframes","update","preRender","render","postRender"];function Pt(t,e){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=Ot.reduce(((t,e)=>(t[e]=function(t){let e=new Set,n=new Set,r=!1,o=!1;const i=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function s(e){i.has(e)&&(u.schedule(e),t()),e(a)}const u={schedule:(t,o=!1,a=!1)=>{const s=a&&r?e:n;return o&&i.add(t),s.has(t)||s.add(t),t},cancel:t=>{n.delete(t),i.delete(t)},process:t=>{a=t,r?o=!0:(r=!0,[e,n]=[n,e],n.clear(),e.forEach(s),r=!1,o&&(o=!1,u.process(t)))}};return u}(i),t)),{}),{read:s,resolveKeyframes:u,update:c,preRender:l,render:f,postRender:p}=a,d=()=>{const i=Et?o.timestamp:performance.now();n=!1,o.delta=r?1e3/60:Math.max(Math.min(i-o.timestamp,40),1),o.timestamp=i,o.isProcessing=!0,s.process(o),u.process(o),c.process(o),l.process(o),f.process(o),p.process(o),o.isProcessing=!1,n&&e&&(r=!1,t(d))};return{schedule:Ot.reduce(((e,i)=>{const s=a[i];return e[i]=(e,i=!1,a=!1)=>(n||(n=!0,r=!0,o.isProcessing||t(d)),s.schedule(e,i,a)),e}),{}),cancel:t=>{for(let e=0;e<Ot.length;e++)a[Ot[e]].cancel(t)},state:o,steps:a}}const{schedule:jt,cancel:Ct,state:It,steps:Lt}=Pt("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:_t,!0);function Mt(t){let e;return()=>(void 0===e&&(e=t()),e)}const Nt=Mt((()=>void 0!==window.ScrollTimeline));class Rt{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}then(t,e){return Promise.all(this.animations).then(t).catch(e)}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t){const e=this.animations.map((e=>{if(!Nt()||!e.attachTimeline)return e.pause(),function(t,e){let n;const r=()=>{const{currentTime:r}=e,o=(null===r?0:r.value)/100;n!==o&&t(o),n=o};return jt.update(r,!0),()=>Ct(r)}((t=>{e.time=e.duration*t}),t);e.attachTimeline(t)}));return()=>{e.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;e<this.animations.length;e++)t=Math.max(t,this.animations[e].duration);return t}runAll(t){this.animations.forEach((e=>e[t]()))}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const Ft=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Vt=new Set(Ft),Dt=t=>1e3*t,Bt=t=>t/1e3,Gt={type:"spring",stiffness:500,damping:25,restSpeed:10},Ut={type:"keyframes",duration:.8},Ht={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},$t=(t,{keyframes:e})=>e.length>2?Ut:Vt.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:Gt:Ht;function zt(t,e){return t[e]||t.default||t}const Wt=!1,qt=t=>null!==t;function Yt(t,{repeat:e,repeatType:n="loop"},r){const o=t.filter(qt),i=e&&"loop"!==n&&e%2==1?0:o.length-1;return i&&void 0!==r?r:o[i]}const Xt=t=>/^0[^.\s]+$/u.test(t);const Kt=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),Zt=t=>e=>"string"==typeof e&&e.startsWith(t),Qt=Zt("--"),Jt=Zt("var(--"),te=t=>!!Jt(t)&&ee.test(t.split("/*")[0].trim()),ee=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,ne=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function re(t,e,n=1){kt(n<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[r,o]=function(t){const e=ne.exec(t);if(!e)return[,];const[,n,r,o]=e;return[`--${null!=n?n:r}`,o]}(t);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const t=i.trim();return Kt(t)?parseFloat(t):t}return te(o)?re(o,e,n+1):o}const oe=(t,e,n)=>n>e?e:n<t?t:n,ie={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},ae={...ie,transform:t=>oe(0,1,t)},se={...ie,default:1},ue=t=>Math.round(1e5*t)/1e5,ce=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,le=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,fe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;function pe(t){return"string"==typeof t}const de=t=>({test:e=>pe(e)&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),he=de("deg"),ye=de("%"),ve=de("px"),me=de("vh"),ge=de("vw"),be={...ye,parse:t=>ye.parse(t)/100,transform:t=>ye.transform(100*t)},we=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),_e=t=>t===ie||t===ve,Se=(t,e)=>parseFloat(t.split(", ")[e]),ke=(t,e)=>(n,{transform:r})=>{if("none"===r||!r)return 0;const o=r.match(/^matrix3d\((.+)\)$/u);if(o)return Se(o[1],e);{const e=r.match(/^matrix\((.+)\)$/u);return e?Se(e[1],t):0}},xe=new Set(["x","y","z"]),Ae=Ft.filter((t=>!xe.has(t)));const Te={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:ke(4,13),y:ke(5,14)};Te.translateX=Te.x,Te.translateY=Te.y;const Ee=t=>e=>e.test(t),Oe=[ie,ve,ye,he,ge,me,{test:t=>"auto"===t,parse:t=>t}],Pe=t=>Oe.find(Ee(t)),je=new Set;let Ce=!1,Ie=!1;function Le(){if(Ie){const t=Array.from(je).filter((t=>t.needsMeasurement)),e=new Set(t.map((t=>t.element))),n=new Map;e.forEach((t=>{const e=function(t){const e=[];return Ae.forEach((n=>{const r=t.getValue(n);void 0!==r&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))})),e}(t);e.length&&(n.set(t,e),t.render())})),t.forEach((t=>t.measureInitialState())),e.forEach((t=>{t.render();const e=n.get(t);e&&e.forEach((([e,n])=>{var r;null===(r=t.getValue(e))||void 0===r||r.set(n)}))})),t.forEach((t=>t.measureEndState())),t.forEach((t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)}))}Ie=!1,Ce=!1,je.forEach((t=>t.complete())),je.clear()}function Me(){je.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(Ie=!0)}))}class Ne{constructor(t,e,n,r,o,i=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=r,this.element=o,this.isAsync=i}scheduleResolve(){this.isScheduled=!0,this.isAsync?(je.add(this),Ce||(Ce=!0,jt.read(Me),jt.resolveKeyframes(Le))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:r}=this;for(let o=0;o<t.length;o++)if(null===t[o])if(0===o){const o=null==r?void 0:r.get(),i=t[t.length-1];if(void 0!==o)t[0]=o;else if(n&&e){const r=n.readValue(e,i);null!=r&&(t[0]=r)}void 0===t[0]&&(t[0]=i),r&&void 0===o&&r.set(t[0])}else t[o]=t[o-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),je.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,je.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const Re=(t,e)=>n=>Boolean(pe(n)&&fe.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),Fe=(t,e,n)=>r=>{if(!pe(r))return r;const[o,i,a,s]=r.match(ce);return{[t]:parseFloat(o),[e]:parseFloat(i),[n]:parseFloat(a),alpha:void 0!==s?parseFloat(s):1}},Ve={...ie,transform:t=>Math.round((t=>oe(0,255,t))(t))},De={test:Re("rgb","red"),parse:Fe("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+Ve.transform(t)+", "+Ve.transform(e)+", "+Ve.transform(n)+", "+ue(ae.transform(r))+")"};const Be={test:Re("#"),parse:function(t){let e="",n="",r="",o="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),o=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),o=t.substring(4,5),e+=e,n+=n,r+=r,o+=o),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}},transform:De.transform},Ge={test:Re("hsl","hue"),parse:Fe("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+ye.transform(ue(e))+", "+ye.transform(ue(n))+", "+ue(ae.transform(r))+")"},Ue={test:t=>De.test(t)||Be.test(t)||Ge.test(t),parse:t=>De.test(t)?De.parse(t):Ge.test(t)?Ge.parse(t):Be.parse(t),transform:t=>pe(t)?t:t.hasOwnProperty("red")?De.transform(t):Ge.transform(t)};const He="number",$e="color",ze="var",We="var(",qe="${}",Ye=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Xe(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},o=[];let i=0;const a=e.replace(Ye,(t=>(Ue.test(t)?(r.color.push(i),o.push($e),n.push(Ue.parse(t))):t.startsWith(We)?(r.var.push(i),o.push(ze),n.push(t)):(r.number.push(i),o.push(He),n.push(parseFloat(t))),++i,qe))).split(qe);return{values:n,split:a,indexes:r,types:o}}function Ke(t){return Xe(t).values}function Ze(t){const{split:e,types:n}=Xe(t),r=e.length;return t=>{let o="";for(let i=0;i<r;i++)if(o+=e[i],void 0!==t[i]){const e=n[i];o+=e===He?ue(t[i]):e===$e?Ue.transform(t[i]):t[i]}return o}}const Qe=t=>"number"==typeof t?0:t;const Je={test:function(t){var e,n;return isNaN(t)&&pe(t)&&((null===(e=t.match(ce))||void 0===e?void 0:e.length)||0)+((null===(n=t.match(le))||void 0===n?void 0:n.length)||0)>0},parse:Ke,createTransformer:Ze,getAnimatableNone:function(t){const e=Ke(t);return Ze(t)(e.map(Qe))}},tn=new Set(["brightness","contrast","saturate","opacity"]);function en(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[r]=n.match(ce)||[];if(!r)return t;const o=n.replace(r,"");let i=tn.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+o+")"}const nn=/\b([a-z-]*)\(.*?\)/gu,rn={...Je,getAnimatableNone:t=>{const e=t.match(nn);return e?e.map(en).join(" "):t}},on={...ie,transform:Math.round},an={borderWidth:ve,borderTopWidth:ve,borderRightWidth:ve,borderBottomWidth:ve,borderLeftWidth:ve,borderRadius:ve,radius:ve,borderTopLeftRadius:ve,borderTopRightRadius:ve,borderBottomRightRadius:ve,borderBottomLeftRadius:ve,width:ve,maxWidth:ve,height:ve,maxHeight:ve,size:ve,top:ve,right:ve,bottom:ve,left:ve,padding:ve,paddingTop:ve,paddingRight:ve,paddingBottom:ve,paddingLeft:ve,margin:ve,marginTop:ve,marginRight:ve,marginBottom:ve,marginLeft:ve,rotate:he,rotateX:he,rotateY:he,rotateZ:he,scale:se,scaleX:se,scaleY:se,scaleZ:se,skew:he,skewX:he,skewY:he,distance:ve,translateX:ve,translateY:ve,translateZ:ve,x:ve,y:ve,z:ve,perspective:ve,transformPerspective:ve,opacity:ae,originX:be,originY:be,originZ:ve,zIndex:on,backgroundPositionX:ve,backgroundPositionY:ve,fillOpacity:ae,strokeOpacity:ae,numOctaves:on},sn={...an,color:Ue,backgroundColor:Ue,outlineColor:Ue,fill:Ue,stroke:Ue,borderColor:Ue,borderTopColor:Ue,borderRightColor:Ue,borderBottomColor:Ue,borderLeftColor:Ue,filter:rn,WebkitFilter:rn},un=t=>sn[t];function cn(t,e){let n=un(t);return n!==rn&&(n=Je),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const ln=new Set(["auto","none","0"]);class fn extends Ne{constructor(t,e,n,r,o){super(t,e,n,r,o,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:n}=this;if(!e||!e.current)return;super.readKeyframes();for(let n=0;n<t.length;n++){let r=t[n];if("string"==typeof r&&(r=r.trim(),te(r))){const o=re(r,e.current);void 0!==o&&(t[n]=o),n===t.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!we.has(n)||2!==t.length)return;const[r,o]=t,i=Pe(r),a=Pe(o);if(i!==a)if(_e(i)&&_e(a))for(let e=0;e<t.length;e++){const n=t[e];"string"==typeof n&&(t[e]=parseFloat(n))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,n=[];for(let e=0;e<t.length;e++)("number"==typeof(r=t[e])?0===r:null===r||"none"===r||"0"===r||Xt(r))&&n.push(e);var r;n.length&&function(t,e,n){let r,o=0;for(;o<t.length&&!r;){const e=t[o];"string"==typeof e&&!ln.has(e)&&Xe(e).values.length&&(r=t[o]),o++}if(r&&n)for(const o of e)t[o]=cn(n,r)}(t,n,e)}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:n}=this;if(!t||!t.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Te[n](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const r=e[e.length-1];void 0!==r&&t.getValue(n,r).jump(r,!1)}measureEndState(){var t;const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const o=e.getValue(n);o&&o.jump(this.measuredOrigin,!1);const i=r.length-1,a=r[i];r[i]=Te[n](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==a&&void 0===this.finalKeyframe&&(this.finalKeyframe=a),(null===(t=this.removedTransforms)||void 0===t?void 0:t.length)&&this.removedTransforms.forEach((([t,n])=>{e.getValue(t).set(n)})),this.resolveNoneKeyframes()}}let pn;function dn(){pn=void 0}const hn={now:()=>(void 0===pn&&hn.set(It.isProcessing||Et?It.timestamp:performance.now()),pn),set:t=>{pn=t,queueMicrotask(dn)}},yn=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!Je.test(t)&&"0"!==t||t.startsWith("url(")));class vn{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:r=0,repeatDelay:o=0,repeatType:i="loop",...a}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=hn.now(),this.options={autoplay:t,delay:e,type:n,repeat:r,repeatDelay:o,repeatType:i,...a},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt}get resolved(){return this._resolved||this.hasAttemptedResolve||(Me(),Le()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=hn.now(),this.hasAttemptedResolve=!0;const{name:n,type:r,velocity:o,delay:i,onComplete:a,onUpdate:s,isGenerator:u}=this.options;if(!u&&!function(t,e,n,r){const o=t[0];if(null===o)return!1;if("display"===e||"visibility"===e)return!0;const i=t[t.length-1],a=yn(o,e),s=yn(i,e);return St(a===s,`You are trying to animate ${e} from "${o}" to "${i}". ${o} is not an animatable value - to enable this animation set ${o} to a value animatable to ${i} via the \`style\` property.`),!(!a||!s)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}(t)||"spring"===n&&r)}(t,n,r,o)){if(Wt||!i)return null==s||s(Yt(t,this.options,e)),null==a||a(),void this.resolveFinishedPromise();this.options.duration=0}const c=this.initPlayback(t,e);!1!==c&&(this._resolved={keyframes:t,finalKeyframe:e,...c},this.onPostResolved())}onPostResolved(){}then(t,e){return this.currentFinishedPromise.then(t,e)}updateFinishedPromise(){this.currentFinishedPromise=new Promise((t=>{this.resolveFinishedPromise=t}))}}function mn(t,e){return e?t*(1e3/e):0}const gn=5;function bn(t,e,n){const r=Math.max(e-gn,0);return mn(n-t(r),e-r)}const wn=.001,_n=.01,Sn=10,kn=.05,xn=1;function An({duration:t=800,bounce:e=.25,velocity:n=0,mass:r=1}){let o,i;St(t<=Dt(Sn),"Spring duration must be 10 seconds or less");let a=1-e;a=oe(kn,xn,a),t=oe(_n,Sn,Bt(t)),a<1?(o=e=>{const r=e*a,o=r*t,i=r-n,s=En(e,a),u=Math.exp(-o);return wn-i/s*u},i=e=>{const r=e*a*t,i=r*n+n,s=Math.pow(a,2)*Math.pow(e,2)*t,u=Math.exp(-r),c=En(Math.pow(e,2),a);return(-o(e)+wn>0?-1:1)*((i-s)*u)/c}):(o=e=>Math.exp(-e*t)*((e-n)*t+1)-wn,i=e=>Math.exp(-e*t)*(t*t*(n-e)));const s=function(t,e,n){let r=n;for(let n=1;n<Tn;n++)r-=t(r)/e(r);return r}(o,i,5/t);if(t=Dt(t),isNaN(s))return{stiffness:100,damping:10,duration:t};{const e=Math.pow(s,2)*r;return{stiffness:e,damping:2*a*Math.sqrt(r*e),duration:t}}}const Tn=12;function En(t,e){return t*Math.sqrt(1-e*e)}const On=["duration","bounce"],Pn=["stiffness","damping","mass"];function jn(t,e){return e.some((e=>void 0!==t[e]))}function Cn({keyframes:t,restDelta:e,restSpeed:n,...r}){const o=t[0],i=t[t.length-1],a={done:!1,value:o},{stiffness:s,damping:u,mass:c,duration:l,velocity:f,isResolvedFromDuration:p}=function(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!jn(t,Pn)&&jn(t,On)){const n=An(t);e={...e,...n,mass:1},e.isResolvedFromDuration=!0}return e}({...r,velocity:-Bt(r.velocity||0)}),d=f||0,h=u/(2*Math.sqrt(s*c)),y=i-o,v=Bt(Math.sqrt(s/c)),m=Math.abs(y)<5;let g;if(n||(n=m?.01:2),e||(e=m?.005:.5),h<1){const t=En(v,h);g=e=>{const n=Math.exp(-h*v*e);return i-n*((d+h*v*y)/t*Math.sin(t*e)+y*Math.cos(t*e))}}else if(1===h)g=t=>i-Math.exp(-v*t)*(y+(d+v*y)*t);else{const t=v*Math.sqrt(h*h-1);g=e=>{const n=Math.exp(-h*v*e),r=Math.min(t*e,300);return i-n*((d+h*v*y)*Math.sinh(r)+t*y*Math.cosh(r))/t}}return{calculatedDuration:p&&l||null,next:t=>{const r=g(t);if(p)a.done=t>=l;else{let o=0;h<1&&(o=0===t?Dt(d):bn(g,t,r));const s=Math.abs(o)<=n,u=Math.abs(i-r)<=e;a.done=s&&u}return a.value=a.done?i:r,a}}}function In({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:i=500,modifyTarget:a,min:s,max:u,restDelta:c=.5,restSpeed:l}){const f=t[0],p={done:!1,value:f},d=t=>void 0===s?u:void 0===u||Math.abs(s-t)<Math.abs(u-t)?s:u;let h=n*e;const y=f+h,v=void 0===a?y:a(y);v!==y&&(h=v-f);const m=t=>-h*Math.exp(-t/r),g=t=>v+m(t),b=t=>{const e=m(t),n=g(t);p.done=Math.abs(e)<=c,p.value=p.done?v:n};let w,_;const S=t=>{var e;(e=p.value,void 0!==s&&e<s||void 0!==u&&e>u)&&(w=t,_=Cn({keyframes:[p.value,d(p.value)],velocity:bn(g,t,p.value),damping:o,stiffness:i,restDelta:c,restSpeed:l}))};return S(0),{calculatedDuration:null,next:t=>{let e=!1;return _||void 0!==w||(e=!0,b(t),S(t)),void 0!==w&&t>=w?_.next(t-w):(!e&&b(t),p)}}}const Ln=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Mn=1e-7,Nn=12;function Rn(t,e,n,r){if(t===e&&n===r)return _t;const o=e=>function(t,e,n,r,o){let i,a,s=0;do{a=e+(n-e)/2,i=Ln(a,r,o)-t,i>0?n=a:e=a}while(Math.abs(i)>Mn&&++s<Nn);return a}(e,0,1,t,n);return t=>0===t||1===t?t:Ln(o(t),e,r)}const Fn=Rn(.42,0,1,1),Vn=Rn(0,0,.58,1),Dn=Rn(.42,0,.58,1),Bn=t=>Array.isArray(t)&&"number"!=typeof t[0],Gn=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Un=t=>e=>1-t(1-e),Hn=t=>1-Math.sin(Math.acos(t)),$n=Un(Hn),zn=Gn(Hn),Wn=Rn(.33,1.53,.69,.99),qn=Un(Wn),Yn={linear:_t,easeIn:Fn,easeInOut:Dn,easeOut:Vn,circIn:Hn,circInOut:zn,circOut:$n,backIn:qn,backInOut:Gn(qn),backOut:Wn,anticipate:t=>(t*=2)<1?.5*qn(t):.5*(2-Math.pow(2,-10*(t-1)))},Xn=t=>{if(Array.isArray(t)){kt(4===t.length,"Cubic bezier arrays must contain four numerical values.");const[e,n,r,o]=t;return Rn(e,n,r,o)}return"string"==typeof t?(kt(void 0!==Yn[t],`Invalid easing type '${t}'`),Yn[t]):t},Kn=(t,e)=>n=>e(t(n)),Zn=(...t)=>t.reduce(Kn),Qn=(t,e,n)=>{const r=e-t;return 0===r?1:(n-t)/r},Jn=(t,e,n)=>t+(e-t)*n;function tr(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function er(t,e){return n=>n>0?e:t}const nr=(t,e,n)=>{const r=t*t,o=n*(e*e-r)+r;return o<0?0:Math.sqrt(o)},rr=[Be,De,Ge];function or(t){const e=(n=t,rr.find((t=>t.test(n))));var n;if(St(Boolean(e),`'${t}' is not an animatable color. Use the equivalent color code instead.`),!Boolean(e))return!1;let r=e.parse(t);return e===Ge&&(r=function({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,n/=100;let o=0,i=0,a=0;if(e/=100){const r=n<.5?n*(1+e):n+e-n*e,s=2*n-r;o=tr(s,r,t+1/3),i=tr(s,r,t),a=tr(s,r,t-1/3)}else o=i=a=n;return{red:Math.round(255*o),green:Math.round(255*i),blue:Math.round(255*a),alpha:r}}(r)),r}const ir=(t,e)=>{const n=or(t),r=or(e);if(!n||!r)return er(t,e);const o={...n};return t=>(o.red=nr(n.red,r.red,t),o.green=nr(n.green,r.green,t),o.blue=nr(n.blue,r.blue,t),o.alpha=Jn(n.alpha,r.alpha,t),De.transform(o))},ar=new Set(["none","hidden"]);function sr(t,e){return n=>Jn(t,e,n)}function ur(t){return"number"==typeof t?sr:"string"==typeof t?te(t)?er:Ue.test(t)?ir:fr:Array.isArray(t)?cr:"object"==typeof t?Ue.test(t)?ir:lr:er}function cr(t,e){const n=[...t],r=n.length,o=t.map(((t,n)=>ur(t)(t,e[n])));return t=>{for(let e=0;e<r;e++)n[e]=o[e](t);return n}}function lr(t,e){const n={...t,...e},r={};for(const o in n)void 0!==t[o]&&void 0!==e[o]&&(r[o]=ur(t[o])(t[o],e[o]));return t=>{for(const e in r)n[e]=r[e](t);return n}}const fr=(t,e)=>{const n=Je.createTransformer(e),r=Xe(t),o=Xe(e);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?ar.has(t)&&!o.values.length||ar.has(e)&&!r.values.length?function(t,e){return ar.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):Zn(cr(function(t,e){var n;const r=[],o={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const a=e.types[i],s=t.indexes[a][o[a]],u=null!==(n=t.values[s])&&void 0!==n?n:0;r[i]=u,o[a]++}return r}(r,o),o.values),n):(St(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),er(t,e))};function pr(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return Jn(t,e,n);return ur(t)(t,e)}function dr(t,e,{clamp:n=!0,ease:r,mixer:o}={}){const i=t.length;if(kt(i===e.length,"Both input and output ranges must be the same length"),1===i)return()=>e[0];if(2===i&&t[0]===t[1])return()=>e[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const a=function(t,e,n){const r=[],o=n||pr,i=t.length-1;for(let n=0;n<i;n++){let i=o(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]||_t:e;i=Zn(t,i)}r.push(i)}return r}(e,r,o),s=a.length,u=e=>{let n=0;if(s>1)for(;n<t.length-2&&!(e<t[n+1]);n++);const r=Qn(t[n],t[n+1],e);return a[n](r)};return n?e=>u(oe(t[0],t[i-1],e)):u}function hr(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const o=Qn(0,e,r);t.push(Jn(n,1,o))}}function yr(t){const e=[0];return hr(e,t.length-1),e}function vr({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const o=Bn(r)?r.map(Xn):Xn(r),i={done:!1,value:e[0]},a=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:yr(e),t),s=dr(a,e,{ease:Array.isArray(o)?o:(u=e,c=o,u.map((()=>c||Dn)).splice(0,u.length-1))});var u,c;return{calculatedDuration:t,next:e=>(i.value=s(e),i.done=e>=t,i)}}const mr=2e4;function gr(t){let e=0;let n=t.next(e);for(;!n.done&&e<mr;)e+=50,n=t.next(e);return e>=mr?1/0:e}const br=t=>{const e=({timestamp:e})=>t(e);return{start:()=>jt.update(e,!0),stop:()=>Ct(e),now:()=>It.isProcessing?It.timestamp:hn.now()}},wr={decay:In,inertia:In,tween:vr,keyframes:vr,spring:Cn},_r=t=>t/100;class Sr extends vn{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.teardown();const{onStop:t}=this.options;t&&t()};const{name:e,motionValue:n,element:r,keyframes:o}=this.options,i=(null==r?void 0:r.KeyframeResolver)||Ne;this.resolver=new i(o,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}initPlayback(t){const{type:e="keyframes",repeat:n=0,repeatDelay:r=0,repeatType:o,velocity:i=0}=this.options,a=wr[e]||vr;let s,u;a!==vr&&"number"!=typeof t[0]&&(s=Zn(_r,pr(t[0],t[1])),t=[0,100]);const c=a({...this.options,keyframes:t});"mirror"===o&&(u=a({...this.options,keyframes:[...t].reverse(),velocity:-i})),null===c.calculatedDuration&&(c.calculatedDuration=gr(c));const{calculatedDuration:l}=c,f=l+r;return{generator:c,mirroredGenerator:u,mapPercentToKeyframes:s,calculatedDuration:l,resolvedDuration:f,totalDuration:f*(n+1)-r}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),"paused"!==this.pendingPlayState&&t?this.state=this.pendingPlayState:this.pause()}tick(t,e=!1){const{resolved:n}=this;if(!n){const{keyframes:t}=this.options;return{done:!0,value:t[t.length-1]}}const{finalKeyframe:r,generator:o,mirroredGenerator:i,mapPercentToKeyframes:a,keyframes:s,calculatedDuration:u,totalDuration:c,resolvedDuration:l}=n;if(null===this.startTime)return o.next(0);const{delay:f,repeat:p,repeatType:d,repeatDelay:h,onUpdate:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-c/this.speed,this.startTime)),e?this.currentTime=t:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const v=this.currentTime-f*(this.speed>=0?1:-1),m=this.speed>=0?v<0:v>c;this.currentTime=Math.max(v,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=c);let g=this.currentTime,b=o;if(p){const t=Math.min(this.currentTime,c)/l;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,p+1);Boolean(e%2)&&("reverse"===d?(n=1-n,h&&(n-=h/l)):"mirror"===d&&(b=i)),g=oe(0,1,n)*l}const w=m?{done:!1,value:s[0]}:b.next(g);a&&(w.value=a(w.value));let{done:_}=w;m||null===u||(_=this.speed>=0?this.currentTime>=c:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&_);return S&&void 0!==r&&(w.value=Yt(s,this.options,r)),y&&y(w.value),S&&this.finish(),w}get duration(){const{resolved:t}=this;return t?Bt(t.calculatedDuration):0}get time(){return Bt(this.currentTime)}set time(t){t=Dt(t),this.currentTime=t,null!==this.holdTime||0===this.speed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=Bt(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=br,onPlay:e,startTime:n}=this.options;this.driver||(this.driver=t((t=>this.tick(t)))),e&&e();const r=this.driver.now();null!==this.holdTime?this.startTime=r-this.holdTime:this.startTime?"finished"===this.state&&(this.startTime=r):this.startTime=null!=n?n:this.calcStartTime(),"finished"===this.state&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;this._resolved?(this.state="paused",this.holdTime=null!==(t=this.currentTime)&&void 0!==t?t:0):this.pendingPlayState="paused"}complete(){"running"!==this.state&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){null!==this.cancelTime&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const kr=new Set(["opacity","clipPath","filter","transform"]),xr=t=>Array.isArray(t)&&"number"==typeof t[0];function Ar(t){return Boolean(!t||"string"==typeof t&&t in Er||xr(t)||Array.isArray(t)&&t.every(Ar))}const Tr=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,Er={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Tr([0,.65,.55,1]),circOut:Tr([.55,0,1,.45]),backIn:Tr([.31,.01,.66,-.59]),backOut:Tr([.33,1.53,.69,.99])};function Or(t){return Pr(t)||Er.easeOut}function Pr(t){return t?xr(t)?Tr(t):Array.isArray(t)?t.map(Or):Er[t]:void 0}const jr=Mt((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));class Cr extends vn{constructor(t){super(t);const{name:e,motionValue:n,element:r,keyframes:o}=this.options;this.resolver=new fn(o,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}initPlayback(t,e){var n;let{duration:r=300,times:o,ease:i,type:a,motionValue:s,name:u,startTime:c}=this.options;if(!(null===(n=s.owner)||void 0===n?void 0:n.current))return!1;if(function(t){return"spring"===t.type||!Ar(t.ease)}(this.options)){const{onComplete:e,onUpdate:n,motionValue:s,element:u,...c}=this.options,l=function(t,e){const n=new Sr({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const o=[];let i=0;for(;!r.done&&i<2e4;)r=n.sample(i),o.push(r.value),i+=10;return{times:void 0,keyframes:o,duration:i-10,ease:"linear"}}(t,c);1===(t=l.keyframes).length&&(t[1]=t[0]),r=l.duration,o=l.times,i=l.ease,a="keyframes"}const l=function(t,e,n,{delay:r=0,duration:o=300,repeat:i=0,repeatType:a="loop",ease:s,times:u}={}){const c={[e]:n};u&&(c.offset=u);const l=Pr(s);return Array.isArray(l)&&(c.easing=l),t.animate(c,{delay:r,duration:o,easing:Array.isArray(l)?"linear":l,fill:"both",iterations:i+1,direction:"reverse"===a?"alternate":"normal"})}(s.owner.current,u,t,{...this.options,duration:r,times:o,ease:i});return l.startTime=null!=c?c:this.calcStartTime(),this.pendingTimeline?(l.timeline=this.pendingTimeline,this.pendingTimeline=void 0):l.onfinish=()=>{const{onComplete:n}=this.options;s.set(Yt(t,this.options,e)),n&&n(),this.cancel(),this.resolveFinishedPromise()},{animation:l,duration:r,times:o,type:a,ease:i,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:e}=t;return Bt(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return Bt(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.currentTime=Dt(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:e}=t;return e.playbackRate}set speed(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:e}=t;return e.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:e}=t;return e.startTime}attachTimeline(t){if(this._resolved){const{resolved:e}=this;if(!e)return _t;const{animation:n}=e;n.timeline=t,n.onfinish=null}else this.pendingTimeline=t;return _t}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:e}=t;"finished"===e.playState&&this.updateFinishedPromise(),e.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:e}=t;e.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:e,keyframes:n,duration:r,type:o,ease:i,times:a}=t;if("idle"===e.playState||"finished"===e.playState)return;if(this.time){const{motionValue:t,onUpdate:e,onComplete:s,element:u,...c}=this.options,l=new Sr({...c,keyframes:n,duration:r,type:o,ease:i,times:a,isGenerator:!0}),f=Dt(this.time);t.setWithVelocity(l.sample(f-10).value,l.sample(f).value,10)}const{onStop:s}=this.options;s&&s(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:e,name:n,repeatDelay:r,repeatType:o,damping:i,type:a}=t;return jr()&&n&&kr.has(n)&&e&&e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate&&!r&&"mirror"!==o&&0!==i&&"inertia"!==a}}const Ir=(t,e,n,r={},o,i,a)=>s=>{const u=zt(r,t)||{},c=u.delay||r.delay||0;let{elapsed:l=0}=r;l-=Dt(c);let f={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...u,delay:-l,onUpdate:t=>{e.set(t),u.onUpdate&&u.onUpdate(t)},onComplete:()=>{s(),u.onComplete&&u.onComplete(),a&&a()},onStop:a,name:t,motionValue:e,element:i?void 0:o};(function({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:o,repeat:i,repeatType:a,repeatDelay:s,from:u,elapsed:c,...l}){return!!Object.keys(l).length})(u)||(f={...f,...$t(t,f)}),f.duration&&(f.duration=Dt(f.duration)),f.repeatDelay&&(f.repeatDelay=Dt(f.repeatDelay)),void 0!==f.from&&(f.keyframes[0]=f.from);let p=!1;if((!1===f.type||0===f.duration&&!f.repeatDelay)&&(f.duration=0,0===f.delay&&(p=!0)),(Wt||Tt)&&(p=!0,f.duration=0,f.delay=0),p&&!i&&void 0!==e.get()){const t=Yt(f.keyframes,u);if(void 0!==t)return jt.update((()=>{f.onUpdate(t),f.onComplete()})),new Rt([])}return!i&&Cr.supports(f)?new Cr(f):new Sr(f)},Lr=t=>Array.isArray(t),Mr=t=>Boolean(t&&"object"==typeof t&&t.mix&&t.toValue),Nr=t=>Lr(t)?t[t.length-1]||0:t;function Rr(t,e){-1===t.indexOf(e)&&t.push(e)}function Fr(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class Vr{constructor(){this.subscriptions=[]}add(t){return Rr(this.subscriptions,t),()=>Fr(this.subscriptions,t)}notify(t,e,n){const r=this.subscriptions.length;if(r)if(1===r)this.subscriptions[0](t,e,n);else for(let o=0;o<r;o++){const r=this.subscriptions[o];r&&r(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Dr={current:void 0};class Br{constructor(t,e={}){this.version="11.5.4",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=hn.now();this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),e&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=hn.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new Vr);const n=this.events[t].add(e);return"change"===t?()=>{n(),jt.read((()=>{this.events.change.getSize()||this.stop()}))}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}setWithVelocity(t,e,n){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return Dr.current&&Dr.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=hn.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return mn(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise((e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()})).then((()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()}))}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Gr(t,e){return new Br(t,e)}function Ur(t){const e=[{},{}];return null==t||t.values.forEach(((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()})),e}function Hr(t,e,n,r){if("function"==typeof e){const[o,i]=Ur(r);e=e(void 0!==n?n:t.custom,o,i)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[o,i]=Ur(r);e=e(void 0!==n?n:t.custom,o,i)}return e}function $r(t,e,n){const r=t.getProps();return Hr(r,e,void 0!==n?n:r.custom,t)}function zr(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Gr(n))}const Wr=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),qr="data-"+Wr("framerAppearId");function Yr(t){return t.props[qr]}function Xr(t){return Vt.has(t)?"transform":kr.has(t)?Wr(t):void 0}class Kr extends Br{constructor(){super(...arguments),this.output=[],this.counts=new Map}add(t){const e=Xr(t);if(!e)return;const n=this.counts.get(e)||0;this.counts.set(e,n+1),0===n&&(this.output.push(e),this.update());let r=!1;return()=>{if(r)return;r=!0;const t=this.counts.get(e)-1;this.counts.set(e,t),0===t&&(Fr(this.output,e),this.update())}}update(){this.set(this.output.length?this.output.join(", "):"auto")}}const Zr=t=>Boolean(t&&t.getVelocity);function Qr(t,e){var n;if(!t.applyWillChange)return;let r=t.getValue("willChange");return r||(null===(n=t.props.style)||void 0===n?void 0:n.willChange)||(r=new Kr("auto"),t.addValue("willChange",r)),o=r,Boolean(Zr(o)&&o.add)?r.add(e):void 0;var o}function Jr({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,r}function to(t,e,{delay:n=0,transitionOverride:r,type:o}={}){var i;let{transition:a=t.getDefaultTransition(),transitionEnd:s,...u}=e;r&&(a=r);const c=[],l=o&&t.animationState&&t.animationState.getState()[o];for(const e in u){const r=t.getValue(e,null!==(i=t.latestValues[e])&&void 0!==i?i:null),o=u[e];if(void 0===o||l&&Jr(l,e))continue;const s={delay:n,...zt(a||{},e)};let f=!1;if(window.MotionHandoffAnimation){const n=Yr(t);if(n){const t=window.MotionHandoffAnimation(n,e,jt);null!==t&&(s.startTime=t,f=!0)}}r.start(Ir(e,r,o,t.shouldReduceMotion&&Vt.has(e)?{type:!1}:s,t,f,Qr(t,e)));const p=r.animation;p&&c.push(p)}return s&&Promise.all(c).then((()=>{jt.update((()=>{s&&function(t,e){const n=$r(t,e);let{transitionEnd:r={},transition:o={},...i}=n||{};i={...i,...r};for(const e in i)zr(t,e,Nr(i[e]))}(t,s)}))})),c}const eo={};function no(t,{layout:e,layoutId:n}){return Vt.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!eo[t]||"opacity"===t)}function ro(t,e,n){var r;const{style:o}=t,i={};for(const a in o)(Zr(o[a])||e.style&&Zr(e.style[a])||no(a,t)||void 0!==(null===(r=null==n?void 0:n.getValue(a))||void 0===r?void 0:r.liveStyle))&&(i[a]=o[a]);return n&&o&&"string"==typeof o.willChange&&(n.applyWillChange=!1),i}function oo(t,e,n){const r=ro(t,e,n);for(const n in t)if(Zr(t[n])||Zr(e[n])){r[-1!==Ft.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=t[n]}return r}const io="undefined"!=typeof window,ao={current:null},so={current:!1};function uo(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function co(t){return"string"==typeof t||Array.isArray(t)}const lo=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],fo=["initial",...lo];function po(t){return uo(t.animate)||fo.some((e=>co(t[e])))}function ho(t){return Boolean(po(t)||t.variants)}const yo={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},vo={};for(const t in yo)vo[t]={isEnabled:e=>yo[t].some((t=>!!e[t]))};const mo=[...Oe,Ue,Je],go=()=>({x:{min:0,max:0},y:{min:0,max:0}}),bo=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],wo=fo.length;class _o{scrapeMotionValuesFromProps(t,e,n){return{}}constructor({parent:t,props:e,presenceContext:n,reducedMotionConfig:r,blockInitialAnimation:o,visualState:i},a={}){this.applyWillChange=!1,this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Ne,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.isRenderScheduled=!1,this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.isRenderScheduled=!1,this.scheduleRender=()=>{this.isRenderScheduled||(this.isRenderScheduled=!0,jt.render(this.render,!1,!0))};const{latestValues:s,renderState:u}=i;this.latestValues=s,this.baseTarget={...s},this.initialValues=e.initial?{...s}:{},this.renderState=u,this.parent=t,this.props=e,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=r,this.options=a,this.blockInitialAnimation=Boolean(o),this.isControllingVariants=po(e),this.isVariantNode=ho(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:c,...l}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in l){const e=l[t];void 0!==s[t]&&Zr(e)&&e.set(s[t],!1)}}mount(t){this.current=t,At.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach(((t,e)=>this.bindToMotionValue(e,t))),so.current||function(){if(so.current=!0,io)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>ao.current=t.matches;t.addListener(e),e()}else ao.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||ao.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){At.delete(this.current),this.projection&&this.projection.unmount(),Ct(this.notifyUpdate),Ct(this.render),this.valueSubscriptions.forEach((t=>t())),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}bindToMotionValue(t,e){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const n=Vt.has(t),r=e.on("change",(e=>{this.latestValues[t]=e,this.props.onUpdate&&jt.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)})),o=e.on("renderRequest",this.scheduleRender);let i;window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,(()=>{r(),o(),i&&i(),e.owner&&e.stop()}))}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in vo){const e=vo[t];if(!e)continue;const{isEnabled:n,Feature:r}=e;if(!this.features[t]&&r&&n(this.props)&&(this.features[t]=new r(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<bo.length;e++){const n=bo[e];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);const r=t["on"+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=function(t,e,n){for(const r in e){const o=e[r],i=n[r];if(Zr(o))t.addValue(r,o);else if(Zr(i))t.addValue(r,Gr(o,{owner:t}));else if(i!==o)if(t.hasValue(r)){const e=t.getValue(r);!0===e.liveStyle?e.jump(o):e.hasAnimated||e.set(o)}else{const e=t.getStaticValue(r);t.addValue(r,Gr(void 0!==e?e:o,{owner:t}))}}for(const r in n)void 0===e[r]&&t.removeValue(r);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}getVariantContext(t=!1){if(t)return this.parent?this.parent.getVariantContext():void 0;if(!this.isControllingVariants){const t=this.parent&&this.parent.getVariantContext()||{};return void 0!==this.props.initial&&(t.initial=this.props.initial),t}const e={};for(let t=0;t<wo;t++){const n=fo[t],r=this.props[n];(co(r)||!1===r)&&(e[n]=r)}return e}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){const n=this.values.get(t);e!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return void 0===n&&void 0!==e&&(n=Gr(null===e?void 0:e,{owner:this}),this.addValue(t,n)),n}readValue(t,e){var n;let r=void 0===this.latestValues[t]&&this.current?null!==(n=this.getBaseTargetFromProps(this.props,t))&&void 0!==n?n:this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];var o;return null!=r&&("string"==typeof r&&(Kt(r)||Xt(r))?r=parseFloat(r):(o=r,!mo.find(Ee(o))&&Je.test(e)&&(r=cn(t,e))),this.setBaseTarget(t,Zr(r)?r.get():r)),Zr(r)?r.get():r}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){var e;const{initial:n}=this.props;let r;if("string"==typeof n||"object"==typeof n){const o=Hr(this.props,n,null===(e=this.presenceContext)||void 0===e?void 0:e.custom);o&&(r=o[t])}if(n&&void 0!==r)return r;const o=this.getBaseTargetFromProps(this.props,t);return void 0===o||Zr(o)?void 0!==this.initialValues[t]&&void 0===r?void 0:this.baseTarget[t]:o}on(t,e){return this.events[t]||(this.events[t]=new Vr),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class So extends _o{constructor(){super(...arguments),this.KeyframeResolver=fn}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){return t.style?t.style[e]:void 0}removeValueFromRenderState(t,{vars:e,style:n}){delete e[t],delete n[t]}}const ko=(t,e)=>e&&"number"==typeof t?e.transform(t):t,xo={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Ao=Ft.length;function To(t,e,n){const{style:r,vars:o,transformOrigin:i}=t;let a=!1,s=!1;for(const t in e){const n=e[t];if(Vt.has(t))a=!0;else if(Qt(t))o[t]=n;else{const e=ko(n,an[t]);t.startsWith("origin")?(s=!0,i[t]=e):r[t]=e}}if(e.transform||(a||n?r.transform=function(t,e,n){let r="",o=!0;for(let i=0;i<Ao;i++){const a=Ft[i],s=t[a];if(void 0===s)continue;let u=!0;if(u="number"==typeof s?s===(a.startsWith("scale")?1:0):0===parseFloat(s),!u||n){const t=ko(s,an[a]);u||(o=!1,r+=`${xo[a]||a}(${t}) `),n&&(e[a]=t)}}return r=r.trim(),n?r=n(e,o?"":r):o&&(r="none"),r}(e,t.transform,n):r.transform&&(r.transform="none")),s){const{originX:t="50%",originY:e="50%",originZ:n=0}=i;r.transformOrigin=`${t} ${e} ${n}`}}function Eo(t,e,n){return"string"==typeof t?t:ve.transform(e+n*t)}const Oo={offset:"stroke-dashoffset",array:"stroke-dasharray"},Po={offset:"strokeDashoffset",array:"strokeDasharray"};function jo(t,{attrX:e,attrY:n,attrScale:r,originX:o,originY:i,pathLength:a,pathSpacing:s=1,pathOffset:u=0,...c},l,f){if(To(t,c,f),l)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:p,style:d,dimensions:h}=t;p.transform&&(h&&(d.transform=p.transform),delete p.transform),h&&(void 0!==o||void 0!==i||d.transform)&&(d.transformOrigin=function(t,e,n){return`${Eo(e,t.x,t.width)} ${Eo(n,t.y,t.height)}`}(h,void 0!==o?o:.5,void 0!==i?i:.5)),void 0!==e&&(p.x=e),void 0!==n&&(p.y=n),void 0!==r&&(p.scale=r),void 0!==a&&function(t,e,n=1,r=0,o=!0){t.pathLength=1;const i=o?Oo:Po;t[i.offset]=ve.transform(-r);const a=ve.transform(e),s=ve.transform(n);t[i.array]=`${a} ${s}`}(p,a,s,u,!1)}const Co=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Io(t,{style:e,vars:n},r,o){Object.assign(t.style,e,o&&o.getProjectionStyles(r));for(const e in n)t.style.setProperty(e,n[e])}function Lo(t,e,n,r){Io(t,e,void 0,r);for(const n in e.attrs)t.setAttribute(Co.has(n)?n:Wr(n),e.attrs[n])}const Mo=t=>"string"==typeof t&&"svg"===t.toLowerCase();class No extends So{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=go}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(Vt.has(e)){const t=un(e);return t&&t.default||0}return e=Co.has(e)?e:Wr(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return oo(t,e,n)}build(t,e,n){jo(t,e,this.isSVGTag,n.transformTemplate)}renderInstance(t,e,n,r){Lo(t,e,0,r)}mount(t){this.isSVGTag=Mo(t.tagName),super.mount(t)}}function Ro(t,e){return function({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}(t.getBoundingClientRect(),e))}class Fo extends So{constructor(){super(...arguments),this.type="html",this.applyWillChange=!0,this.renderInstance=Io}readValueFromInstance(t,e){if(Vt.has(e)){const t=un(e);return t&&t.default||0}{const r=(n=t,window.getComputedStyle(n)),o=(Qt(e)?r.getPropertyValue(e):r[e])||0;return"string"==typeof o?o.trim():o}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return Ro(t,e)}build(t,e,n){To(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return ro(t,e,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Zr(t)&&(this.childSubscription=t.on("change",(t=>{this.current&&(this.current.textContent=`${t}`)})))}}function Vo(t){const e={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=function(t){return t instanceof SVGElement&&"svg"!==t.tagName}(t)?new No(e):new Fo(e);n.mount(t),At.set(t,n)}function Do(t,e,n){const r=Zr(t)?t:Gr(t);return r.start(Ir("",r,e,n)),r.animation}function Bo(t,e=100){const n=Cn({keyframes:[0,e],...t}),r=Math.min(gr(n),mr);return{type:"keyframes",ease:t=>n.next(r*t).value/e,duration:Bt(r)}}function Go(t,e,n,r){var o;return"number"==typeof e?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(o=r.get(e))&&void 0!==o?o:t}const Uo=(t,e,n)=>{const r=e-t;return((n-t)%r+r)%r+t};function Ho(t,e){return Bn(t)?t[Uo(0,t.length,e)]:t}function $o(t,e,n,r,o,i){!function(t,e,n){for(let r=0;r<t.length;r++){const o=t[r];o.at>e&&o.at<n&&(Fr(t,o),r--)}}(t,o,i);for(let a=0;a<e.length;a++)t.push({value:e[a],at:Jn(o,i,r[a]),easing:Ho(n,a)})}function zo(t,e){return t.at===e.at?null===t.value?1:null===e.value?-1:0:t.at-e.at}const Wo="easeInOut";function qo(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function Yo(t,e){return e[t]||(e[t]=[]),e[t]}function Xo(t){return Array.isArray(t)?t:[t]}function Ko(t,e){return t[e]?{...t,...t[e]}:{...t}}const Zo=t=>"number"==typeof t,Qo=t=>t.every(Zo);function Jo(t,e,n,r){const o=xt(t,r),i=o.length;kt(Boolean(i),"No valid element provided.");const a=[];for(let t=0;t<i;t++){const r=o[t];At.has(r)||Vo(r);const s=At.get(r),u={...n};"function"==typeof u.delay&&(u.delay=u.delay(t,i)),a.push(...to(s,{...e,transition:u},{}))}return new Rt(a)}function ti(t,e,n){const r=[],o=function(t,{defaultTransition:e={},...n}={},r){const o=e.duration||.3,i=new Map,a=new Map,s={},u=new Map;let c=0,l=0,f=0;for(let n=0;n<t.length;n++){const i=t[n];if("string"==typeof i){u.set(i,l);continue}if(!Array.isArray(i)){u.set(i.name,Go(l,i.at,c,u));continue}let[p,d,h={}]=i;void 0!==h.at&&(l=Go(l,h.at,c,u));let y=0;const v=(t,n,r,i=0,a=0)=>{const s=Xo(t),{delay:u=0,times:c=yr(s),type:p="keyframes",...d}=n;let{ease:h=e.ease||"easeOut",duration:v}=n;const m="function"==typeof u?u(i,a):u,g=s.length;if(g<=2&&"spring"===p){let t=100;if(2===g&&Qo(s)){const e=s[1]-s[0];t=Math.abs(e)}const e={...d};void 0!==v&&(e.duration=Dt(v));const n=Bo(e,t);h=n.ease,v=n.duration}null!=v||(v=o);const b=l+m,w=b+v;1===c.length&&0===c[0]&&(c[1]=1);const _=c.length-s.length;_>0&&hr(c,_),1===s.length&&s.unshift(null),$o(r,s,h,c,b,w),y=Math.max(m+v,y),f=Math.max(w,f)};if(Zr(p))v(d,h,Yo("default",qo(p,a)));else{const t=xt(p,r,s),e=t.length;for(let n=0;n<e;n++){const r=qo(t[n],a);for(const t in d)v(d[t],Ko(h,t),Yo(t,r),n,e)}}c=l,l+=y}return a.forEach(((t,r)=>{for(const o in t){const a=t[o];a.sort(zo);const s=[],u=[],c=[];for(let t=0;t<a.length;t++){const{at:e,value:n,easing:r}=a[t];s.push(n),u.push(Qn(0,f,e)),c.push(r||"easeOut")}0!==u[0]&&(u.unshift(0),s.unshift(s[0]),c.unshift(Wo)),1!==u[u.length-1]&&(u.push(1),s.push(null)),i.has(r)||i.set(r,{keyframes:{},transition:{}});const l=i.get(r);l.keyframes[o]=s,l.transition[o]={...e,duration:f,ease:c,times:u,...n}}})),i}(t,e,n);return o.forEach((({keyframes:t,transition:e},n)=>{let o;o=Zr(n)?Do(n,t.default,e.default):Jo(n,t,e),r.push(o)})),new Rt(r)}const ei=function(t,e,n){let r;var o;return o=t,r=Array.isArray(o)&&Array.isArray(o[0])?ti(t,e,ni):function(t){return"object"==typeof t&&!Array.isArray(t)}(e)?Jo(t,e,n,ni):Do(t,e,n),ni&&ni.animations.push(r),r};var ni;function ri(t){return ri="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ri(t)}function oi(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */oi=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",d="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==ri(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function T(e,n,r){var o=p;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:d,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(ri(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function ii(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=si(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function ai(t){return function(t){if(Array.isArray(t))return ui(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||si(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function si(t,e){if(t){if("string"==typeof t)return ui(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ui(t,e):void 0}}function ui(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ci(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,fi(r.key),r)}}function li(t,e,n){return(e=fi(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function fi(t){var e=function(t,e){if("object"!=ri(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ri(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ri(e)?e:e+""}var pi=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},di=li(li(li({},ct.left,"25.33%"),ct.center,"50%"),ct.right,"75.66%"),hi=function(){function t(e,n){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.sequences=[],this.control=null,this.transformers={},Array.isArray(e)){var r;(r=this.sequences).push.apply(r,ai(e)),this.sequenceOptions=Object.assign({},t.defaultSequenceOptions,n||{})}else{var o=e,i=n||t.defaultOptions;this.sequences.push({props:o,options:i||{}}),this.sequenceOptions=Object.assign({},t.defaultSequenceOptions)}}return function(t,e,n){return e&&ci(t.prototype,e),n&&ci(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"animate",value:function(e,n,r,o){var i=e.scope,a=e.overwrites,s=e.image;return pi(this,void 0,void 0,oi().mark((function e(){var r=this;return oi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){pi(r,void 0,void 0,oi().mark((function r(){var u,c,l,f,p=this;return oi().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:this.sequenceOptions.sync||(e(),o&&o(s.state)),u=0;case 2:if(!(u<this.sequenceOptions.repeat)){r.next=22;break}c=ii(this.sequences),r.prev=4,f=oi().mark((function e(){var r,o,u,c,f,h;return oi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=l.value,o=r.props,u=r.options,c=d({},p.propToCSS(n,s.state)),i.current){e.next=4;break}throw new Error("No scope found when animating.");case 4:if(f=i.current,Object.assign(f.style,c),s.state=t.mergeState(s.state,o),h=ei(f,p.propToCSS(n,s.state,a),p.optionsToFramerMotionOptions(u)||{}),p.setControl(h),n.logger.debug("Animating",p.propToCSS(n,s.state,a)),!1!==(null==u?void 0:u.sync)){e.next=14;break}h.then((function(){Object.assign(f.style,p.propToCSS(n,s.state,a)),p.setControl(null)})),e.next=18;break;case 14:return e.next=16,new Promise((function(t){return h.then((function(){return t()}))}));case 16:Object.assign(f.style,p.propToCSS(n,s.state,a)),p.setControl(null);case 18:case"end":return e.stop()}}),e)})),c.s();case 7:if((l=c.n()).done){r.next=11;break}return r.delegateYield(f(),"t0",9);case 9:r.next=7;break;case 11:r.next=16;break;case 13:r.prev=13,r.t1=r.catch(4),c.e(r.t1);case 16:return r.prev=16,c.f(),r.finish(16);case 19:u++,r.next=2;break;case 22:return r.next=24,b(2);case 24:this.setControl(null),this.sequenceOptions.sync&&(e(),o&&o(s.state));case 26:case"end":return r.stop()}}),r,this,[[4,13,16,19]])})))})));case 1:case"end":return e.stop()}}),e)})))}},{key:"repeat",value:function(t){return this.sequenceOptions.repeat*=t,this}},{key:"overwrite",value:function(t,e){return this.transformers[t]=e,this}},{key:"propToCSS",value:function(e,n,r){var o,i=(null===(o=e.getLastScene())||void 0===o?void 0:o.config)||{},a=i.invertY,s=i.invertX,u={position:function(e){return t.positionToCSS(e,a,s)},backgroundColor:function(e){return t.backgroundToCSS(e)},backgroundOpacity:function(t){return{opacity:t}},opacity:function(t){return{opacity:t}},scale:function(){return"scale"in n?{width:"".concat(100*n.scale,"%")}:{}},rotation:function(){return{}},display:function(){return{}},src:function(){return{}}},c={};for(var l in c.transform=this.propToCSSTransform(e,n),this.transformers.transform&&Object.assign(c,this.transformers.transform(n)),r&&r.transform&&Object.assign(c,r.transform(n)),n)Object.prototype.hasOwnProperty.call(n,l)&&(r&&r[l]?Object.assign(c,r[l](n[l])):this.transformers[l]?Object.assign(c,this.transformers[l](n[l])):u[l]&&Object.assign(c,u[l](n[l])));return c}},{key:"optionsToFramerMotionOptions",value:function(t){if(!t)return t;var e=t.duration;return{duration:e?e/1e3:0,ease:t.ease}}},{key:"propToCSSTransform",value:function(t,e){var n;if(!t.getLastScene())throw new Error('No scene found in state, make sure you called "scene.activate()" before this method.');var r=(null===(n=t.getLastScene())||void 0===n?void 0:n.config)||{},o=r.invertY,i=r.invertX;return["translate(".concat(i?"":"-","50%, ").concat(o?"":"-","50%)"),void 0!==e.rotation&&"rotate(".concat(e.rotation,"deg)")].filter(Boolean).join(" ")}},{key:"setControl",value:function(t){return this.control=t,this}},{key:"getControl",value:function(){return this.control}},{key:"copy",value:function(){return new t(this.sequences,this.sequenceOptions)}}],[{key:"isPosition",value:function(t){return gt.isCommonPositionType(t)||bt.isCoord2DPosition(t)||wt.isAlignPosition(t)}},{key:"positionToCSS",value:function(t,e,n){return mt.D2PositionToCSS(t.toCSS(),n,e)}},{key:"backgroundToCSS",value:function(t){return null==t?{}:Aa.isStaticImageData(t)?{backgroundImage:"url(".concat(t.src,")")}:"string"==typeof t?{backgroundColor:t}:["r","g","b"].every((function(e){return e in t}))?{backgroundColor:v(t)}:{backgroundImage:"url("+t.url+")"}}},{key:"mergePosition",value:function(t,e){if(!t&&!e)throw new Error("No position found.");return t&&e?mt.mergePosition(mt.tryParsePosition(t),mt.tryParsePosition(e)):mt.toCoord2D(mt.tryParsePosition(t||e))}},{key:"mergeState",value:function(t,e){var n=this.mergePosition(t.position,e.position);return Object.assign(Object.assign({},d(t,e)),{position:n})}}])}();function yi(t){return yi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yi(t)}function vi(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,mi(r.key),r)}}function mi(t){var e=function(t,e){if("object"!=yi(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=yi(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==yi(e)?e:e+""}function gi(t,e,n){return e=wi(e),function(t,e){if(e&&("object"==yi(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,bi()?Reflect.construct(e,n||[],wi(t).constructor):e.apply(t,n))}function bi(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(bi=function(){return!!t})()}function wi(t){return wi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wi(t)}function _i(t,e){return _i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_i(t,e)}hi.defaultSequenceOptions={sync:!0,repeat:1},hi.defaultOptions={duration:0,ease:"linear"},hi.CommonImagePositionMap=di;var Si=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),gi(this,e)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_i(t,e)}(e,t),function(t,e,n){return e&&vi(t.prototype,e),n&&vi(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"do",value:function(t){return this.push(da.ActionTypes.do,t)}},{key:"doAsync",value:function(t){return this.push(da.ActionTypes.doAsync,t)}},{key:"any",value:function(t){return this.push(da.ActionTypes.any,t)}},{key:"all",value:function(t){return this.push(da.ActionTypes.all,t)}},{key:"allAsync",value:function(t){return this.push(da.ActionTypes.allAsync,t)}},{key:"repeat",value:function(t,e){return this.push(da.ActionTypes.repeat,e,t)}},{key:"push",value:function(t,e){for(var n=Q.toActions(e),r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];var a=new da(this.chain(),t,(new M).setContent([this.construct(n)].concat(o)));return this.chain(a)}}],[{key:"do",value:function(t){return(new e).do(t)}},{key:"doAsync",value:function(t){return(new e).doAsync(t)}},{key:"any",value:function(t){return(new e).any(t)}},{key:"all",value:function(t){return(new e).all(t)}},{key:"allAsync",value:function(t){return(new e).allAsync(t)}},{key:"repeat",value:function(t,n){return(new e).repeat(t,n)}}])}(ut);function ki(t){return ki="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ki(t)}function xi(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ai(r.key),r)}}function Ai(t){var e=function(t,e){if("object"!=ki(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ki(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ki(e)?e:e+""}function Ti(t,e,n){return e=Oi(e),function(t,e){if(e&&("object"==ki(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ei()?Reflect.construct(e,n||[],Oi(t).constructor):e.apply(t,n))}function Ei(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ei=function(){return!!t})()}function Oi(t){return Oi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Oi(t)}function Pi(t,e){return Pi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Pi(t,e)}var ji=function(t){function e(t,n){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(r=Ti(this,e)).events=new m,r.ref=void 0,"string"==typeof t?(r.name=t,r.config=d(e.defaultConfig,n||{}),r.config.position&&(r.config.position=mt.tryParsePosition(r.config.position))):(r.name="",r.config=d(e.defaultConfig,t),r.config.position&&(r.config.position=mt.tryParsePosition(r.config.position))),r.state=d({},r.config),r.checkConfig(),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Pi(t,e)}(e,t),function(t,e,n){return e&&xi(t.prototype,e),n&&xi(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"dispose",value:function(){return this._dispose()}},{key:"init",value:function(){return this.chain(this._init())}},{key:"checkConfig",value:function(){if(!this.config.src)throw new Error("Image src is required");if(!hi.isPosition(this.config.position))throw new Error("Invalid position\nPosition must be one of CommonImagePosition, Align, Coord2D");return this}},{key:"setSrc",value:function(t,e){var n=this;return this.combineActions(new Si,(function(r){if(e){var o=e.copy();o.setSrc(Aa.srcToString(t)),r._transitionSrc(o)}var i=new ua(r,ua.ActionTypes.setSrc,(new M).setContent(["string"==typeof t?t:Aa.staticImageDataToSrc(t)]));return r.chain(i).chain(n._flush())}))}},{key:"applyTransform",value:function(t){var e=this;return this.combineActions(new Si,(function(n){var r=new ua(n,ua.ActionTypes.applyTransform,(new M).setContent([void 0,t,g()]));return n.chain(r).chain(e._flush())}))}},{key:"show",value:function(t){var e=this,n=t instanceof hi?t:new hi([{props:{opacity:1},options:t||{}}]);return this.combineActions(new Si,(function(t){var r=new ua(t,ua.ActionTypes.show,(new M).setContent([void 0,n]));return t.chain(r).chain(e._flush())}))}},{key:"hide",value:function(t){var e=this;return this.combineActions(new Si,(function(n){var r=new ua(n,ua.ActionTypes.hide,(new M).setContent([void 0,t instanceof hi?t:new hi([{props:{opacity:0},options:t||{}}])]));return n.chain(r).chain(e._flush())}))}},{key:"toTransform",value:function(){return new hi(this.state,{duration:0})}},{key:"setScope",value:function(t){return this.ref=t,this}},{key:"getScope",value:function(){return this.ref}},{key:"copy",value:function(){return new e(this.name,this.config)}},{key:"toData",value:function(){return this.state.disposed||w(this.state,this.config)?null:{state:d({},e.serializeImageState(this.state))}}},{key:"fromData",value:function(t){return this.state=d(this.state,e.deserializeImageState(t.state)),this}},{key:"_$setDispose",value:function(){return this.state.disposed=!0,this}},{key:"_applyTransition",value:function(t){return this.chain(new ua(this.chain(),"image:applyTransition",(new M).setContent([t])))}},{key:"_init",value:function(t){return new ua(this.chain(),ua.ActionTypes.init,(new M).setContent([t]))}},{key:"_flush",value:function(){return new ua(this.chain(),ua.ActionTypes.flush,new M)}},{key:"reset",value:function(){this.state=d({},this.config)}},{key:"_transitionSrc",value:function(t){var e=t.copy();return this._applyTransition(e),this}},{key:"_dispose",value:function(){return this.chain(new ua(this.chain(),ua.ActionTypes.dispose,new M))}}],[{key:"serializeImageState",value:function(t){var e={position:function(t){return mt.serializePosition(t)}},n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=e[r]?e[r](t[r]):t[r]);return n}},{key:"deserializeImageState",value:function(t){var e={position:function(t){return mt.toCoord2D(t)}},n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=e[r]?e[r](t[r]):t[r]);return n}}])}(ut);function Ci(t){return Ci="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ci(t)}function Ii(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Li(r.key),r)}}function Li(t){var e=function(t,e){if("object"!=Ci(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ci(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ci(e)?e:e+""}ji.EventTypes={"event:image.show":"event:image.show","event:image.hide":"event:image.hide","event:image.init":"event:image.init","event:image.applyTransform":"event:image.applyTransform","event:image.mount":"event:image.mount","event:image.unmount":"event:image.unmount","event:image.ready":"event:image.ready","event:image.elementLoaded":"event:image.elementLoaded","event:image.applyTransition":"event:image.applyTransition","event:image.flush":"event:image.flush","event:image.flushComponent":"event:image.flushComponent"},ji.defaultConfig={src:"",display:!1,position:new gt(st.Center),scale:1,rotation:0,opacity:0},ji.ImagePosition=ct;var Mi=function(){return function(t,e,n){return e&&Ii(t.prototype,e),n&&Ii(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e,n,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.callee=e,this.type=n,this.contentNode=r,this.__stack=g(),this._id=""}),[{key:"executeAction",value:function(t){return{type:this.type,node:this.contentNode.getChild()}}},{key:"getId",value:function(){return this._id}},{key:"setId",value:function(t){this._id=t}},{key:"getFutureActions",value:function(){var t=this.contentNode.getChild();return t&&t.action?[t.action]:[]}}])}();Mi.ActionTypes={action:"action"};var Ni={say:"character:say",action:"character:action"},Ri={action:"scene:action",setBackground:"scene:setBackground",sleep:"scene:sleep",setTransition:"scene:setTransition",applyTransition:"scene:applyTransition",init:"scene:init",exit:"scene:exit",jumpTo:"scene:jumpTo",setBackgroundMusic:"scene:setBackgroundMusic",preUnmount:"scene:preUnmount",applyTransform:"scene:applyTransform"},Fi={action:"image:action",setSrc:"image:setSrc",setPosition:"image:setPosition",show:"image:show",hide:"image:hide",applyTransform:"image:applyTransform",init:"image:init",dispose:"image:dispose",setTransition:"image:setTransition",applyTransition:"image:applyTransition",flush:"image:flush"},Vi={action:"sound:action",play:"sound:play",stop:"sound:stop",fade:"sound:fade",setVolume:"sound:setVolume",setRate:"sound:setRate",pause:"sound:pause",resume:"sound:resume"},Di={action:"control:action",do:"control:do",doAsync:"control:doAsync",any:"control:any",all:"control:all",allAsync:"control:allAsync",repeat:"control:repeat"};function Bi(t){return Bi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bi(t)}function Gi(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=zi(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function Ui(t){return function(t){if(Array.isArray(t))return Wi(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||zi(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Hi(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Hi=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",d="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==Bi(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function T(e,n,r){var o=p;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:d,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(Bi(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function $i(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||zi(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zi(t,e){if(t){if("string"==typeof t)return Wi(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wi(t,e):void 0}}function Wi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function qi(t,e,n,r){var o=Yi(ea(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function Yi(){return Yi="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=ea(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},Yi.apply(null,arguments)}function Xi(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ki(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Qi(r.key),r)}}function Zi(t,e,n){return e&&Ki(t.prototype,e),n&&Ki(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Qi(t){var e=function(t,e){if("object"!=Bi(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Bi(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Bi(e)?e:e+""}function Ji(t,e,n){return e=ea(e),function(t,e){if(e&&("object"==Bi(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ta()?Reflect.construct(e,n||[],ea(t).constructor):e.apply(t,n))}function ta(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ta=function(){return!!t})()}function ea(t){return ea=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ea(t)}function na(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ra(t,e)}function ra(t,e){return ra=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ra(t,e)}var oa=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},ia=function(t){function e(t,n,r){var o;return Xi(this,e),(o=Ji(this,e,[t,n,r])).callee=t.getSelf(),o.contentNode.action=o,o}return na(e,t),Zi(e,[{key:"unknownType",value:function(){throw new Error("Unknown action type: "+this.type)}}])}(Mi),aa=function(t){function e(){return Xi(this,e),Ji(this,e,arguments)}return na(e,t),Zi(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===Ni.say){var r=new h((function(t){return t})).registerSkipController(new k((function(){return{type:n.type,node:n.contentNode.getChild()}}))),o=this.contentNode.getContent();return t.createText(this.getId(),o,(function(){r.resolve({type:n.type,node:n.contentNode.getChild()})})),r}throw qi(e,"unknownType",this,3)([])}}])}(ia);aa.ActionTypes=Ni;var sa=function(t){function e(){return Xi(this,e),Ji(this,e,arguments)}return na(e,t),Zi(e,[{key:"executeAction",value:function(t){var n,r=this;if(this.type===Ri.action)return qi(e,"executeAction",this,3)([t]);if(this.type===Ri.setBackground)return this.callee.state.background=this.contentNode.getContent()[0],qi(e,"executeAction",this,3)([t]);if(this.type===Ri.sleep){var o=new h((function(t){return t})),i=this.contentNode.getContent();return new Promise((function(t){"number"==typeof i?setTimeout((function(){t()}),i):h.isAwaitable(i)?i.then(t):null==i||i.then(t)})).then((function(){o.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),o}if(this.type===Ri.applyTransition){var a=(new h).registerSkipController(new k((function(){return t.logger.info("NarraLeaf-React: Background Transition","Skipped"),{type:r.type,node:r.contentNode.getChild()}}))),s=this.contentNode.getContent()[0];return this.callee.events.any("event:scene.applyTransition",s).then((function(){a.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),a}if(this.type===Ri.init){var u=new h((function(t){return t}));return e.handleSceneInit(this,t,u)}if(this.type===Ri.exit){this.callee._liveState.active=!1,t.offSrcManager(this.callee.srcManager).removeScene(this.callee);var c=new h((function(t){return t}));return this.callee.events.once("event:scene.unmount",(function(){c.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),c}if(this.type===Ri.jumpTo){var l=this.contentNode.getContent()[0],f=this.contentNode,p=(null===(n=l.sceneRoot)||void 0===n?void 0:n.contentNode)||null;return p&&f.addChild(p),qi(e,"executeAction",this,3)([t])}if(this.type===Ri.setBackgroundMusic){var d=$i(this.contentNode.getContent(),2),y=d[0],v=d[1];return this.callee.events.emit("event:scene.setBackgroundMusic",y,v||0),qi(e,"executeAction",this,3)([t])}if(this.type===Ri.preUnmount)return this.callee.events.emit("event:scene.preUnmount"),qi(e,"executeAction",this,3)([t]);if(this.type===Ri.applyTransform){var m=$i(this.contentNode.getContent(),1)[0],g=new h((function(t){return t})).registerSkipController(new k((function(){return{type:r.type,node:r.contentNode.getChild()}})));return this.callee.events.any("event:scene.applyTransform",m).then((function(){g.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),g}throw new Error("Unknown scene action type: "+this.type)}},{key:"getFutureActions",value:function(){var t,e,n;if(this.type===Ri.jumpTo){var r=null===(e=null===(t=this.contentNode.getContent()[0])||void 0===t?void 0:t.sceneRoot)||void 0===e?void 0:e.contentNode;return(null==r?void 0:r.action)?[r.action]:[]}var o=null===(n=this.contentNode.getChild())||void 0===n?void 0:n.action;return o?[o]:[]}}],[{key:"handleSceneInit",value:function(t,n,r){return t.callee._liveState.active?{type:t.type,node:t.contentNode.getChild()}:(t.callee._liveState.active=!0,n.registerSrcManager(t.callee.srcManager).addScene(t.callee),e.registerEventListeners(t.callee,n,(function(){r.resolve({type:t.type,node:t.contentNode.getChild()}),n.stage.next()})),r)}},{key:"registerEventListeners",value:function(t,e,n){t.events.once("event:scene.unmount",(function(){e.offSrcManager(t.srcManager)})),t.events.once("event:scene.mount",(function(){t.state.backgroundMusic&&(pa.initSound(e,t.state.backgroundMusic),t.events.emit("event:scene.setBackgroundMusic",t.state.backgroundMusic,t.config.backgroundMusicFade))})),t.events.once("event:scene.imageLoaded",(function(){var e=t.getInitTransform();t.events.any("event:scene.initTransform",e).then((function(){n&&n()}))}))}}])}(ia);sa.ActionTypes=Ri,(function(t){function e(){return Xi(this,e),Ji(this,e,arguments)}return na(e,t),Zi(e)}(ia)).ActionTypes={action:"story:action"};var ua=function(t){function e(){return Xi(this,e),Ji(this,e,arguments)}return na(e,t),Zi(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===Fi.init){var r=t.findElementByImage(this.callee);r&&t.disposeImage(this.callee,r.scene);var o=this.contentNode.getContent()[0];t.createImage(this.callee,o);var i=new h((function(t){return t}));return this.callee.events.once("event:image.mount",(function(){return oa(n,void 0,void 0,Hi().mark((function e(){var n;return Hi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(n=this.callee.getScope())||void 0===n?void 0:n.current){e.next=3;break}return e.next=3,this.callee.events.any(ji.EventTypes["event:image.elementLoaded"]);case 3:return e.next=5,this.callee.events.any("event:image.init");case 5:i.resolve({type:this.type,node:this.contentNode.getChild()}),t.stage.next();case 7:case"end":return e.stop()}}),e,this)})))})),i}if(this.type===Fi.setSrc)return this.callee.state.src=this.contentNode.getContent()[0],t.logger.debug("Image - Set Src",this.callee.state.src),t.stage.update(),qi(e,"executeAction",this,3)([t]);if([Fi.show,Fi.hide,Fi.applyTransform].includes(this.type)){var a=new h((function(t){return t})).registerSkipController(new k((function(){return n.type===Fi.hide&&(n.callee.state.display=!1),qi(e,"executeAction",n,3)([t])}))),s=this.contentNode.getContent()[1];return this.type===Fi.show&&(this.callee.state.display=!0,t.stage.update()),t.animateImage(ji.EventTypes["event:image.applyTransform"],this.callee,[s],(function(){var t;n.type===Fi.hide&&(n.callee.state.display=!1),a.resolve({type:n.type,node:null===(t=n.contentNode)||void 0===t?void 0:t.getChild()})})),a}if(this.type===Fi.dispose)return t.disposeImage(this.callee),this.callee._$setDispose(),qi(e,"executeAction",this,3)([t]);if(this.type===Fi.applyTransition){var u=new h((function(t){return t})).registerSkipController(new k((function(){return n.type===Fi.hide&&(n.callee.state.display=!1),{type:n.type,node:n.contentNode.getChild()}}))),c=this.contentNode.getContent()[0];return this.callee.events.any("event:image.applyTransition",c).then((function(){u.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),u}if(this.type===Fi.flush){var l=new h((function(t){return t}));return this.callee.events.any("event:image.flushComponent").then((function(){l.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),l}throw qi(e,"unknownType",this,3)([])}}])}(ia);ua.ActionTypes=Fi;var ca=function(t){function e(){return Xi(this,e),Ji(this,e,arguments)}return na(e,t),Zi(e,[{key:"executeAction",value:function(t){var e,n,r=this.callee.evaluate(this.contentNode.getContent(),{gameState:t});return null===(e=null==r?void 0:r[r.length-1])||void 0===e||e.contentNode.addChild(this.contentNode.getChild()),this.contentNode.addChild((null===(n=null==r?void 0:r[0])||void 0===n?void 0:n.contentNode)||null),{type:this.type,node:this.contentNode.getChild()}}},{key:"getFutureActions",value:function(){return[].concat(Ui(this.callee._getFutureActions()),Ui(qi(e,"getFutureActions",this,3)([])))}}])}(ia);ca.ActionTypes={action:"condition:action"};var la=function(t){function e(){return Xi(this,e),Ji(this,e,arguments)}return na(e,t),Zi(e,[{key:"executeAction",value:function(t){return this.contentNode.getContent().execute({gameState:t}),qi(e,"executeAction",this,3)([t])}}])}(ia);la.ActionTypes={action:"script:action"};var fa=function(t){function e(){return Xi(this,e),Ji(this,e,arguments)}return na(e,t),Zi(e,[{key:"executeAction",value:function(t){var e=this,n=new h((function(t){return t})),r=this.contentNode.getContent();return t.createMenu(r,(function(r){var o,i,a=(null===(o=t.game.getLiveGame().getCurrentAction())||void 0===o?void 0:o.contentNode.getChild())||null;a&&(null===(i=r.action[r.action.length-1])||void 0===i||i.contentNode.addChild(a)),n.resolve({type:e.type,node:r.action[0].contentNode})})),n}},{key:"getFutureActions",value:function(){var t=this.contentNode.getContent();return[].concat(Ui(this.callee._getFutureActions(t.choices)),Ui(qi(e,"getFutureActions",this,3)([])))}}])}(ia);fa.ActionTypes={action:"menu:action"};var pa=function(t){function e(){return Xi(this,e),Ji(this,e,arguments)}return na(e,t),Zi(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===Vi.play){if(e.initSound(t,this.callee),!this.callee.$getHowl())throw new Error("Howl is not initialized");if(this.callee.config.sync&&!this.callee.config.loop){var r=new h((function(t){return t})),o=t.playSound(this.callee.$getHowl(),(function(){var t;n.callee.$stop(),r.resolve({type:n.type,node:null===(t=n.contentNode)||void 0===t?void 0:t.getChild()})}));return this.callee.$setToken(o),r}var i=t.playSound(this.callee.$getHowl(),(function(){n.callee.$stop()}));return this.callee.$setToken(i),qi(e,"executeAction",this,3)([t])}if(this.type===Vi.stop)return this.callee.$getHowl()&&(this.callee.$getHowl().stop(),this.callee.$stop()),qi(e,"executeAction",this,3)([t]);if(this.type===Vi.fade){var a=$i(this.contentNode.getContent(),1)[0],s=a.start,u=a.end,c=a.duration;if(this.callee.$getHowl()){var l=void 0===s?this.callee.$getHowl().volume():s;this.callee.$getHowl().fade(l,u,c,this.callee.$getToken())}return qi(e,"executeAction",this,3)([t])}if(this.type===Vi.setVolume){var f=$i(this.contentNode.getContent(),1)[0];return this.callee.$getHowl()&&this.callee.$getHowl().volume(f,this.callee.$getToken()),qi(e,"executeAction",this,3)([t])}if(this.type===Vi.setRate){var p=$i(this.contentNode.getContent(),1)[0];return this.callee.$getHowl()&&this.callee.$getHowl().rate(p,this.callee.$getToken()),qi(e,"executeAction",this,3)([t])}if(this.type===Vi.pause)return this.callee.$getHowl()&&this.callee.$getHowl().pause(this.callee.$getToken()),qi(e,"executeAction",this,3)([t]);if(this.type===Vi.resume)return this.callee.$getHowl()&&this.callee.$getHowl().play(this.callee.$getToken()),qi(e,"executeAction",this,3)([t]);throw qi(e,"unknownType",this,3)([])}}],[{key:"initSound",value:function(t,e){e.$getHowl()||e.$setHowl(new(t.getHowl())(e.getHowlOptions()))}}])}(ia);pa.ActionTypes=Vi;var da=function(t){function e(){return Xi(this,e),Ji(this,e,arguments)}return na(e,t),Zi(e,[{key:"executeAllActions",value:function(t,e){return oa(this,void 0,void 0,Hi().mark((function n(){var r,o,i;return Hi().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:r=!1,o=e,i=Hi().mark((function e(){var n,r,i;return Hi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.game.getLiveGame().executeAction(t,o),t.logger.debug("Control - Next Action",n),n){e.next=4;break}return e.abrupt("return",0);case 4:if(!h.isAwaitable(n)){e.next=16;break}return e.next=7,new Promise((function(t){n.then((function(e){return t(n.result)}))}));case 7:if(r=e.sent,!(i=r.node)){e.next=13;break}o=i.action,e.next=14;break;case 13:return e.abrupt("return",0);case 14:e.next=17;break;case 16:o=n;case 17:case"end":return e.stop()}}),e)}));case 3:if(r||!o){n.next=10;break}return n.delegateYield(i(),"t0",5);case 5:if(0!==n.t0){n.next=8;break}return n.abrupt("break",10);case 8:n.next=3;break;case 10:case"end":return n.stop()}}),n)})))}},{key:"executeSingleAction",value:function(t,e){return oa(this,void 0,void 0,Hi().mark((function n(){var r,o,i;return Hi().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=t.game.getLiveGame().executeAction(t,e),!h.isAwaitable(r)){n.next=9;break}return n.next=4,new Promise((function(t){r.then((function(e){return t(r.result)}))}));case 4:return o=n.sent,i=o.node,n.abrupt("return",i);case 9:return n.abrupt("return",r);case 10:case"end":return n.stop()}}),n)})))}},{key:"execute",value:function(t,n,r){var o=this;return r.length>0?(this.executeAllActions(t,r[0]).then((function(){n.resolve({type:o.type,node:o.contentNode.getChild()}),t.stage.next()})),n):qi(e,"executeAction",this,3)([t])}},{key:"executeAction",value:function(t){var n=this,r=$i(this.contentNode.getContent(),1)[0];if(this.type===Di.do){var o=new h((function(t){return t}));return this.execute(t,o,r)}if(this.type===Di.doAsync)return oa(n,void 0,void 0,Hi().mark((function e(){return Hi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r.length>0)){e.next=3;break}return e.next=3,this.executeAllActions(t,r[0]);case 3:case"end":return e.stop()}}),e,this)}))),qi(e,"executeAction",this,3)([t]);if(this.type===Di.any){var i=new h((function(t){return t})),a=r.map((function(e){return n.executeSingleAction(t,e)}));return Promise.any(a).then((function(){i.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),i}if(this.type===Di.all){var s=new h((function(t){return t}));return oa(n,void 0,void 0,Hi().mark((function e(){var n=this;return Hi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(r.map((function(e){return n.executeSingleAction(t,e)})));case 2:s.resolve({type:this.type,node:this.contentNode.getChild()}),t.stage.next();case 4:case"end":return e.stop()}}),e,this)}))),s}if(this.type===Di.allAsync)return oa(n,void 0,void 0,Hi().mark((function e(){var n,o,i;return Hi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=Gi(r);try{for(n.s();!(o=n.n()).done;)i=o.value,this.executeSingleAction(t,i).then((function(t){}))}catch(t){n.e(t)}finally{n.f()}case 2:case"end":return e.stop()}}),e,this)}))),qi(e,"executeAction",this,3)([t]);if(this.type===Di.repeat){var u=$i(this.contentNode.getContent(),2),c=u[0],l=u[1],f=new h((function(t){return t}));return oa(n,void 0,void 0,Hi().mark((function e(){var n;return Hi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=0;case 1:if(!(n<l)){e.next=8;break}if(!(c.length>0)){e.next=5;break}return e.next=5,this.executeAllActions(t,c[0]);case 5:n++,e.next=1;break;case 8:f.resolve({type:this.type,node:this.contentNode.getChild()}),t.stage.next();case 10:case"end":return e.stop()}}),e,this)}))),f}throw new Error("Unknown control action type: "+this.type)}},{key:"getFutureActions",value:function(){var t=this.contentNode.getContent()[0],n=qi(e,"getFutureActions",this,3)([]);return[].concat(Ui(t),Ui(n))}}])}(ia);function ha(t){return ha="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ha(t)}function ya(t,e,n){return e=wa(e),function(t,e){if(e&&("object"==ha(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ga()?Reflect.construct(e,n||[],wa(t).constructor):e.apply(t,n))}function va(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ba(t,e)}function ma(t){var e="function"==typeof Map?new Map:void 0;return ma=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(ga())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var o=new(t.bind.apply(t,r));return n&&ba(o,n.prototype),o}(t,arguments,wa(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ba(n,t)},ma(t)}function ga(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ga=function(){return!!t})()}function ba(t,e){return ba=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ba(t,e)}function wa(t){return wa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wa(t)}function _a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Sa(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,xa(r.key),r)}}function ka(t,e,n){return e&&Sa(t.prototype,e),n&&Sa(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function xa(t){var e=function(t,e){if("object"!=ha(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ha(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ha(e)?e:e+""}da.ActionTypes=Di;var Aa=function(){function t(){_a(this,t)}return ka(t,null,[{key:"srcToString",value:function(t){return"string"==typeof t?t:t.src}},{key:"staticImageDataToSrc",value:function(t){return"string"==typeof t?t:t.src}},{key:"isStaticImageData",value:function(t){return void 0!==(null==t?void 0:t.src)}},{key:"backgroundToSrc",value:function(e){return t.isStaticImageData(e)?e.src:(null==e?void 0:e.url)||null}},{key:"isExternalSrc",value:function(t){return t.startsWith("http://")||t.startsWith("https://")}}])}(),Ta=function(t){function e(t,n){return _a(this,e),ya(this,e,[t,{info:n},"NarraLeafReact-StaticScriptWarning"])}return va(e,t),ka(e,null,[{key:"isWarning",value:function(t){return t instanceof e}}])}(function(t){function e(t,n){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"UseError";return _a(this,e),(r=ya(this,e,[t])).props=n,r.name=o,r}return va(e,t),ka(e,null,[{key:"isUseError",value:function(t){return t instanceof e}}])}(ma(Error))),Ea=function(){return ka((function t(e){_a(this,t),this.scene=e}),[{key:"run",value:function(){if(!this.scene.sceneRoot)return null;var t=new Map,e=new Map,n=[],r=new Set,o=this.scene.getAllChildren(this.scene.sceneRoot);if(!o.length)return null;for(n.push(o[0]);n.length;){var i=n.shift();this.checkAction(i,{imageStates:t,scenes:e},r);var a=i.contentNode.getChild();a&&a.action&&n.push(a.action)}return t}},{key:"checkAction",value:function(t,e,n){var r=e.imageStates,o=e.scenes;if(t instanceof ua)r.has(t.callee)||r.set(t.callee,{isDisposed:!1,usedExternalSrc:!1}),this.checkImage(r.get(t.callee),t);else if(t instanceof sa){var i=t.callee;if(o.has(i.name)){if(o.get(i.name)!==i){var a="Scene with name: ".concat(i.name," is duplicated\nScene: ").concat(i.name,"\n\nAt: ").concat(t.__stack);throw new Ta(a)}}else o.set(i.name,i);if(t.type===Ri.jumpTo){var s=t.contentNode.getContent()[0];if(n.has(s))return;n.add(s)}}}},{key:"checkImage",value:function(t,e){if(e.type===Fi.dispose){if(t.isDisposed){var n="Image is disposed multiple times before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new Ta(n)}t.isDisposed=!0}else if([Fi.init,Fi.show,Fi.hide,Fi.applyTransform,Fi.applyTransition].includes(e.type)){if(t.isDisposed){var r="Image is disposed before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new Ta(r)}}else if(e.type===Fi.setSrc){var o=e.contentNode.getContent()[0];Aa.isExternalSrc(o)&&(t.usedExternalSrc=!0)}}}])}();function Oa(t){return Oa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Oa(t)}function Pa(t,e,n){return e=Ca(e),function(t,e){if(e&&("object"==Oa(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ja()?Reflect.construct(e,n||[],Ca(t).constructor):e.apply(t,n))}function ja(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ja=function(){return!!t})()}function Ca(t){return Ca=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ca(t)}function Ia(t,e){return Ia=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ia(t,e)}function La(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ma(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ra(r.key),r)}}function Na(t,e,n){return e&&Ma(t.prototype,e),n&&Ma(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ra(t){var e=function(t,e){if("object"!=Oa(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Oa(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Oa(e)?e:e+""}var Fa=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};La(this,t),this.character=e,this.text=this.format(n),this.config=d(t.defaultConfig,r),this.state=y(t.defaultState)}return Na(t,[{key:"format",value:function(t){var e=[];if(Array.isArray(t))for(var n=0;n<t.length;n++)Da.isWord(t[n])?e.push(t[n]):e.push(new Da(t[n]));else e.push(Da.isWord(t)?t:new Da(t));return e}},{key:"toData",value:function(){return w(this.state,t.defaultState)?null:{state:y(this.state)}}},{key:"fromData",value:function(t){return this.state=d(this.state,t),this}},{key:"toString",value:function(){return this.text.map((function(t){return t.text})).join("")}}],[{key:"isSentence",value:function(e){return e instanceof t}},{key:"toSentence",value:function(e){return t.isSentence(e)?e:new t(null,e)}}])}();Fa.defaultConfig={color:"#000",pause:!0,voice:null},Fa.defaultState={display:!0};var Va,Da=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};La(this,t),this.text=e,this.config=d(t.defaultConfig,n)}return Na(t,null,[{key:"isWord",value:function(e){return e instanceof t}}])}();Da.defaultConfig={},Da.defaultColor="#000",function(t){t.adv="adv",t.nvl="nvl"}(Va||(Va={}));var Ba=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return La(this,e),(n=Pa(this,e)).name=t,n.config=d({},e.defaultConfig,r),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ia(t,e)}(e,t),Na(e,[{key:"say",value:function(t){var e=Array.isArray(t)?new Fa(this,t,{}):Fa.isSentence(t)?t:new Fa(this,t,{}),n=new aa(this.chain(),aa.ActionTypes.say,(new M).setContent(e));return this.chain(n)}}])}(ut);function Ga(t){return Ga="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ga(t)}function Ua(t){return function(t){if(Array.isArray(t))return $a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Ha(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ha(t,e){if(t){if("string"==typeof t)return $a(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$a(t,e):void 0}}function $a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function za(t,e,n){return e=qa(e),function(t,e){if(e&&("object"==Ga(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Wa()?Reflect.construct(e,n||[],qa(t).constructor):e.apply(t,n))}function Wa(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Wa=function(){return!!t})()}function qa(t){return qa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},qa(t)}function Ya(t,e){return Ya=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ya(t,e)}function Xa(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ka(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Qa(r.key),r)}}function Za(t,e,n){return e&&Ka(t.prototype,e),n&&Ka(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Qa(t){var e=function(t,e){if("object"!=Ga(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ga(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ga(e)?e:e+""}Ba.Modes=Va,Ba.defaultConfig={mode:Va.adv};var Ja=function(){return Za((function t(e){Xa(this,t),this.handler=e}),[{key:"evaluate",value:function(t){var e=t.gameState;return{value:this.handler(this.getCtx({gameState:e}))}}},{key:"getCtx",value:function(t){var e=t.gameState;return{gameState:e,game:e.game,liveGame:e.game.getLiveGame(),storable:e.game.getLiveGame().getStorable()}}}])}(),ts=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Xa(this,e),(t=za(this,e)).conditions={If:{condition:null,action:null},ElseIf:[],Else:{action:null}},t.config=d(e.defaultConfig,n),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ya(t,e)}(e,t),Za(e,[{key:"If",value:function(t,e){if(this.conditions.If.condition)throw new Ta("IF condition already set\nYou are trying to set multiple IF conditions for the same condition");if(this.conditions.ElseIf.length)throw new Ta("ELSE-IF condition already set\nYou are trying to set an IF condition after an ELSE-IF condition");if(this.conditions.Else.action)throw new Ta("ELSE condition already set\nYou are trying to set an IF condition after an ELSE condition");return this.conditions.If.condition=t instanceof Ja?t:new Ja(t),this.conditions.If.action=this.construct(Array.isArray(e)?e:[e]),this.chain()}},{key:"ElseIf",value:function(t,e){if(!this.conditions.If.condition)throw new Ta("IF condition not set\nYou are trying to set an ELSE-IF condition without an IF condition");if(this.conditions.Else.action)throw new Ta("ELSE condition already set\nYou are trying to set an ELSE-IF condition after an ELSE condition");return this.conditions.ElseIf.push({condition:t instanceof Ja?t:new Ja(t),action:this.construct(Array.isArray(e)?e:[e])}),this.chain()}},{key:"Else",value:function(t){if(!this.conditions.If.condition)throw new Ta("IF condition not set\nYou are trying to set an ELSE condition without an IF condition");if(this.conditions.Else.action)throw new Ta("ELSE condition already set\nYou are trying to set multiple ELSE conditions for the same condition");return this.conditions.Else.action=this.construct(Array.isArray(t)?t:[t]),this.chain()}},{key:"evaluate",value:function(t,e){var n,r,o={gameState:e.gameState},i=null===(n=t.If.condition)||void 0===n?void 0:n.evaluate(o);if(null==i?void 0:i.value)return t.If.action||null;var a,s=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Ha(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}(t.ElseIf);try{for(s.s();!(a=s.n()).done;){var u=a.value,c=null===(r=u.condition)||void 0===r?void 0:r.evaluate(o);if(null==c?void 0:c.value)return u.action||null}}catch(t){s.e(t)}finally{s.f()}return t.Else.action||null}},{key:"fromChained",value:function(t){return[Reflect.construct(ca,[this,ca.ActionTypes.action,(new M).setContent(t.conditions)])]}},{key:"construct",value:function(t,e,n){for(var r,o=Q.toActions(t),i=0;i<o.length;i++){var a=o[i].contentNode,s=null===(r=o[i+1])||void 0===r?void 0:r.contentNode;s&&a.setChild(s),i===o.length-1&&e&&a.setChild(e),0===i&&n&&n.setChild(a)}return o}},{key:"_getFutureActions",value:function(){return Q.toActions([].concat(Ua(this.conditions.If.action||[]),Ua(this.conditions.ElseIf.flatMap((function(t){return t.action||[]}))),Ua(this.conditions.Else.action||[])))}}],[{key:"getInitialState",value:function(){return{If:{condition:null,action:null},ElseIf:[],Else:{action:null}}}}])}(ut);function es(t){return es="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},es(t)}function ns(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,rs(r.key),r)}}function rs(t){var e=function(t,e){if("object"!=es(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=es(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==es(e)?e:e+""}function os(t,e,n){return e=as(e),function(t,e){if(e&&("object"==es(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,is()?Reflect.construct(e,n||[],as(t).constructor):e.apply(t,n))}function is(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(is=function(){return!!t})()}function as(t){return as=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},as(t)}function ss(t,e){return ss=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ss(t,e)}ts.defaultConfig={};var us=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=os(this,e)).choices=[],n.prompt=Fa.isSentence(t)?t:new Fa(null,t),n.config=d(e.defaultConfig,r),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ss(t,e)}(e,t),function(t,e,n){return e&&ns(t.prototype,e),n&&ns(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"choose",value:function(t,e){var n=this.chain();return Fa.isSentence(t)&&e||(Da.isWord(t)||Array.isArray(t)||"string"==typeof t)&&e?n.choices.push({prompt:Fa.toSentence(t),action:Q.toActions(e)}):"object"===es(t)&&"prompt"in t&&"action"in t?n.choices.push({prompt:Fa.toSentence(t.prompt),action:Q.toActions(t.action)}):console.warn("No valid choice added to menu, ",{arg0:t,arg1:e}),n}},{key:"fromChained",value:function(t){return[new fa(this.chain(),fa.ActionTypes.action,(new M).setContent({prompt:this.prompt,choices:t.constructChoices()}))]}},{key:"_getFutureActions",value:function(t){return t.map((function(t){return t.action})).flat(2)}},{key:"constructNodes",value:function(t,e,n){for(var r,o=0;o<t.length;o++){var i=t[o].contentNode,a=null===(r=t[o+1])||void 0===r?void 0:r.contentNode;a&&i.setChild(a),o===this.choices.length-1&&e&&i.setChild(e),0===o&&n&&n.setChild(i)}return t}},{key:"constructChoices",value:function(){var t=this;return this.choices.map((function(e){return{action:t.constructNodes(e.action),prompt:e.prompt}}))}}])}(ut);function cs(t){return cs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cs(t)}function ls(t){return function(t){if(Array.isArray(t))return fs(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return fs(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fs(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fs(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ps(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ds(r.key),r)}}function ds(t){var e=function(t,e){if("object"!=cs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=cs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==cs(e)?e:e+""}function hs(t,e,n){return e=vs(e),function(t,e){if(e&&("object"==cs(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ys()?Reflect.construct(e,n||[],vs(t).constructor):e.apply(t,n))}function ys(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ys=function(){return!!t})()}function vs(t){return vs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vs(t)}function ms(t,e){return ms=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ms(t,e)}us.defaultConfig={},us.targetAction=fa;var gs,bs=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),hs(this,e)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ms(t,e)}(e,t),function(t,e,n){return e&&ps(t.prototype,e),n&&ps(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"fromChained",value:function(t){return t.getActions()}},{key:"forEachChild",value:function(t,e){var n=new Set,r=[];for(Array.isArray(t)?r.push.apply(r,ls(t)):r.push(t);r.length;){var o=r.shift();if(!n.has(o)){n.add(o),e(o);var i=o.getFutureActions().filter((function(t){return!n.has(t)}));r.push.apply(r,ls(i))}}}},{key:"getAllChildren",value:function(t){var e=[];return this.forEachChild(t,(function(t){return e.push(t)})),e}},{key:"getAllChildrenMap",value:function(t){var e=new Map;return this.forEachChild(t,(function(t){return e.set(t.getId(),t)})),e}},{key:"getAllElementMap",value:function(t){var e=new Map;return this.forEachChild(t,(function(t){return e.set(t.callee.getId(),t.callee)})),e}},{key:"getAllChildrenElements",value:function(t){return Array.from(new Set(this.getAllChildren(t).map((function(t){return t.callee}))))}},{key:"toData",value:function(){return null}},{key:"constructNodes",value:function(t,e){for(var n,r=0;r<t.length;r++){var o=t[r];0===r&&e?e.setChild(o.contentNode):r>0&&(null===(n=t[r-1].contentNode)||void 0===n||n.setChild(o.contentNode))}return t.length?t[0].contentNode:null}}])}(J);function ws(t){return ws="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ws(t)}function _s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ss(r.key),r)}}function Ss(t){var e=function(t,e){if("object"!=ws(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ws(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ws(e)?e:e+""}function ks(t,e,n){return e=As(e),function(t,e){if(e&&("object"==ws(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,xs()?Reflect.construct(e,n||[],As(t).constructor):e.apply(t,n))}function xs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(xs=function(){return!!t})()}function As(t){return As=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},As(t)}function Ts(t,e){return Ts=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ts(t,e)}!function(t){t.soundEffect="soundEffect",t.music="music",t.voice="voice",t.backgroundMusic="backgroundMusic"}(gs||(gs={}));var Es=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=ks(this,e)).state={playing:null,token:null},t.config=d(e.defaultConfig,n),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ts(t,e)}(e,t),function(t,e,n){return e&&_s(t.prototype,e),n&&_s(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"play",value:function(){if(this.config.type===gs.backgroundMusic)throw new Error("Background music cannot be played directly");return this.pushAction(pa.ActionTypes.play,[void 0])}},{key:"stop",value:function(){if(this.config.type===gs.backgroundMusic)throw new Error("Background music cannot be stopped directly");return this.pushAction(pa.ActionTypes.stop,[void 0])}},{key:"fade",value:function(t,e,n){if(this.config.type===gs.backgroundMusic)throw new Error("Background music cannot be faded directly");return this.pushAction(pa.ActionTypes.fade,[{start:t,end:e,duration:n}])}},{key:"setVolume",value:function(t){return this.pushAction(pa.ActionTypes.setVolume,[t])}},{key:"setRate",value:function(t){return this.pushAction(pa.ActionTypes.setRate,[t])}},{key:"pause",value:function(t){return void 0!==t?this.fade(void 0,0,t):this.pushAction(pa.ActionTypes.pause,[void 0])}},{key:"resume",value:function(t){return void 0!==t?this.fade(0,this.config.volume,t):this.pushAction(pa.ActionTypes.resume,[void 0])}},{key:"getHowlOptions",value:function(){return{src:this.config.src,loop:this.config.loop,volume:this.config.volume,html5:this.config.streaming,autoplay:!1}}},{key:"getSrc",value:function(){return this.config.src}},{key:"$setToken",value:function(t){this.state.token=t}},{key:"$getToken",value:function(){return this.state.token}},{key:"$setHowl",value:function(t){this.state.playing=t}},{key:"$getHowl",value:function(){return this.state.playing}},{key:"$stop",value:function(){this.$setToken(null),this.$setHowl(null)}},{key:"toData",value:function(){return w(this.config,e.defaultConfig)?null:{config:y(this.config)}}},{key:"fromData",value:function(t){return this.config=d(this.config,t.config),this}},{key:"reset",value:function(){var t;null===(t=this.state.playing)||void 0===t||t.stop(),this.state.playing=null,this.state.token=null}},{key:"pushAction",value:function(t,e){return this.chain(new pa(this.chain(),t,(new M).setContent(e)))}}])}(ut);function Os(t){return Os="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Os(t)}function Ps(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,js(r.key),r)}}function js(t){var e=function(t,e){if("object"!=Os(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Os(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Os(e)?e:e+""}Es.defaultConfig={src:"",sync:!1,loop:!1,volume:1};var Cs=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.src=[],this.future=[]}return function(t,e,n){return e&&Ps(t.prototype,e),n&&Ps(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"register",value:function(t,e){var n=this;if(Array.isArray(t))t.forEach((function(t){return n.register(t)}));else if(t instanceof Es){if(this.isSrcRegistered(t.getSrc()))return this;this.src.push({type:"audio",src:t})}else if(t instanceof ji||Aa.isStaticImageData(t)){if(t instanceof ji){if(this.isSrcRegistered(Aa.srcToString(t.state.src)))return this}else if(this.isSrcRegistered(Aa.srcToString(t.src)))return this;this.src.push({type:"image",src:t instanceof ji?t:new ji("",{src:Aa.staticImageDataToSrc(t)})})}else if("object"===Os(t)){if(this.isSrcRegistered(t.src||""))return this;this.src.push(t)}else if("audio"===t){if(this.isSrcRegistered(e||""))return this;this.src.push({type:t,src:e instanceof Es?e:new Es({src:e})})}else{if(this.isSrcRegistered(e||""))return this;this.src.push({type:t,src:e})}return this}},{key:"isSrcRegistered",value:function(e){var n=e instanceof Es?e.getSrc():e;return this.src.some((function(e){return e.type===t.SrcTypes.audio?n===e.src.getSrc():e.type===t.SrcTypes.image?n===Aa.srcToString(e.src.state.src):n===e.src}))}},{key:"getSrc",value:function(){return this.src}},{key:"getSrcByType",value:function(t){return this.src.filter((function(e){return e.type===t}))}},{key:"registerFuture",value:function(t){return this.future.includes(t)||this.hasFuture(t)||this.future.push(t),this}},{key:"hasFuture",value:function(t){return this.future.includes(t)}}])}();function Is(t){return Is="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Is(t)}function Ls(t){return function(t){if(Array.isArray(t))return Ms(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Ms(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ms(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ms(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ns(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Rs(r.key),r)}}function Rs(t){var e=function(t,e){if("object"!=Is(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Is(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Is(e)?e:e+""}function Fs(t,e,n){return e=Bs(e),function(t,e){if(e&&("object"==Is(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Vs()?Reflect.construct(e,n||[],Bs(t).constructor):e.apply(t,n))}function Vs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Vs=function(){return!!t})()}function Ds(){return Ds="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Bs(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},Ds.apply(null,arguments)}function Bs(t){return Bs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Bs(t)}function Gs(t,e){return Gs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Gs(t,e)}Cs.SrcTypes={image:"image",video:"video",audio:"audio"};var Us=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.defaultConfig;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=Fs(this,e)).srcManager=new Cs,n.events=new m,n._liveState={active:!1},n.name=t,n.config=d(e.defaultConfig,r),n.state=d(e.defaultState,n.config),n.backgroundImage=new ji({position:new gt(st.Center),opacity:1,src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="}),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Gs(t,e)}(e,t),function(t,e,n){return e&&Ns(t.prototype,e),n&&Ns(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"activate",value:function(){return this.chain(this._init(this))}},{key:"deactivate",value:function(){return this.chain(this._exit())}},{key:"setBackground",value:function(t,e){return this.combineActions(new Si,(function(n){if(e){var r=e.copy();r.setSrc(Aa.backgroundToSrc(t)),n._transitionToScene(void 0,r,t)}return n.chain(new sa(n,"scene:setBackground",(new M).setContent([t])))}))}},{key:"applyTransform",value:function(t){return this.chain(new sa(this.chain(),"scene:applyTransform",(new M).setContent([t])))}},{key:"jumpTo",value:function(t,e){var n=this;return this.combineActions(new Si,(function(r){var o=e||{};return r.chain(new sa(r,"scene:preUnmount",(new M).setContent([])))._transitionToScene(t,o.transition).chain(t._init()).chain(n._exit())._jumpTo(t)}))}},{key:"sleep",value:function(t){return this.chain(new sa(this.chain(),"scene:sleep",(new M).setContent(t)))}},{key:"setBackgroundMusic",value:function(t,e){return this.chain(new sa(this.chain(),Ri.setBackgroundMusic,(new M).setContent([t,e])))}},{key:"toData",value:function(){var t;return{state:Object.assign(Object.assign({},y(this.state)),{backgroundMusic:null===(t=this.state.backgroundMusic)||void 0===t?void 0:t.toData(),background:this.state.background}),backgroundImageState:this.backgroundImage.toData()}}},{key:"fromData",value:function(t){return this.state=d(this.state,t.state),t.state.backgroundMusic&&(this.state.backgroundMusic=(new Es).fromData(t.state.backgroundMusic),this.state.background=t.state.background),t.backgroundImageState&&this.backgroundImage.fromData(t.backgroundImageState),this}},{key:"getInitTransform",value:function(){return new hi([{props:Object.assign(Object.assign({},this.backgroundImage.state),{opacity:1}),options:{duration:0}}])}},{key:"action",value:function(t){var n=(Array.isArray(t)?t.flat(2):t(this).flat(2)).map((function(t){return Q.isChained(t)?t.fromChained(t):t})).flat(2),r=this.getAllChildrenElements(n).filter((function(t){return t instanceof ji&&!Q.isChained(t)})),o=[this._init(this)].concat(Ls(r.map((function(t){return t._init()}))),Ls(n)),i=function(t,e,n,r){var o=Ds(Bs(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"constructNodes",this,3)([o]),a=new M(void 0,void 0,i||void 0).setContent(this);return null==i||i.setParent(a),this.sceneRoot=new sa(this.chain(),"scene:action",a),this}},{key:"registerSrc",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Set;if(this.sceneRoot){var n=new Set,r=new Set,o=[this.sceneRoot],i=new Set;for(Aa.backgroundToSrc(this.config.background)&&this.srcManager.register(new ji({src:Aa.backgroundToSrc(this.config.background)}));o.length;){var a=o.shift();if(!n.has(a)){if(n.add(a),a instanceof sa){if(a.type===Ri.jumpTo){var s=a,u=s.contentNode.getContent()[0];if(r.has(s)||e.has(u))continue;r.add(s),i.add(u),e.add(u)}else if(a.type===Ri.setBackground){var c=a.contentNode.getContent()[0];this.srcManager.register(new ji({src:Aa.backgroundToSrc(c)}))}}else if(a instanceof ua){var l=a;if(this.srcManager.register(l.callee),a.type===Fi.setSrc){var f=a.contentNode.getContent()[0];this.srcManager.register(new ji({src:f}))}}else if(a instanceof pa)this.srcManager.register(a.callee);else if(a instanceof da){var p=a.getFutureActions();o.push.apply(o,Ls(p))}o.push.apply(o,Ls(a.getFutureActions()))}}i.forEach((function(n){n.registerSrc(e),t.srcManager.registerFuture(n.srcManager)}))}}},{key:"assignActionId",value:function(){this.getAllChildren(this.sceneRoot||[]).forEach((function(t,e){t.setId("action-".concat(e))}))}},{key:"assignElementId",value:function(){this.getAllChildrenElements(this.sceneRoot||[]).forEach((function(t,e){t.setId("element-".concat(e))}))}},{key:"reset",value:function(){this.state=d(e.defaultState,this.config),this.backgroundImage.reset()}},{key:"_applyTransition",value:function(t){return this.chain(new sa(this.chain(),"scene:applyTransition",(new M).setContent([t])))}},{key:"_jumpTo",value:function(t){return this.chain(new sa(this.chain(),"scene:jumpTo",(new M).setContent([t])))}},{key:"_exit",value:function(){return new sa(this.chain(),"scene:exit",(new M).setContent([]))}},{key:"_transitionToScene",value:function(t,e,n){var r=this.chain();if(e){var o=e.copy();t&&o.setSrc(Aa.backgroundToSrc(t.state.background)),n&&o.setSrc(Aa.backgroundToSrc(n)),r._applyTransition(o)}return r}},{key:"_init",value:function(){return new sa((arguments.length>0&&void 0!==arguments[0]?arguments[0]:this).chain(),"scene:init",(new M).setContent([]))}}])}(bs);function Hs(t){return Hs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hs(t)}function $s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,zs(r.key),r)}}function zs(t){var e=function(t,e){if("object"!=Hs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Hs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Hs(e)?e:e+""}function Ws(t,e,n){return e=Xs(e),qs(t,Ys()?Reflect.construct(e,n||[],Xs(t).constructor):e.apply(t,n))}function qs(t,e){if(e&&("object"==Hs(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Ys(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ys=function(){return!!t})()}function Xs(t){return Xs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Xs(t)}function Ks(t,e){return Ks=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ks(t,e)}Us.EventTypes={"event:scene.applyTransition":"event:scene.applyTransition","event:scene.remove":"event:scene.remove","event:scene.load":"event:scene.load","event:scene.unload":"event:scene.unload","event:scene.mount":"event:scene.mount","event:scene.unmount":"event:scene.unmount","event:scene.preUnmount":"event:scene.preUnmount","event:scene.imageLoaded":"event:scene.imageLoaded","event:scene.initTransform":"event:scene.initTransform","event:scene.setBackgroundMusic":"event:scene.setBackgroundMusic","event:scene.applyTransform":"event:scene.applyTransform"},Us.defaultConfig={background:null,invertY:!1,invertX:!1,backgroundMusic:null,backgroundMusicFade:0},Us.defaultState={};var Zs=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=Ws(this,e)).handler=t,qs(n,n.chain())}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ks(t,e)}(e,t),function(t,e,n){return e&&$s(t.prototype,e),n&&$s(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"execute",value:function(t){var e=t.gameState;this.handler(this.getCtx({gameState:e}))}},{key:"getCtx",value:function(t){var e=t.gameState;return{gameState:e,game:e.game,liveGame:e.game.getLiveGame(),storable:e.game.getLiveGame().getStorable()}}},{key:"fromChained",value:function(t){return[new la(this.chain(),la.ActionTypes.action,(new M).setContent(t))]}}])}(ut);function Qs(t){return Qs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qs(t)}function Js(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,tu(r.key),r)}}function tu(t){var e=function(t,e){if("object"!=Qs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Qs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Qs(e)?e:e+""}function eu(t,e,n){return e=ru(e),function(t,e){if(e&&("object"==Qs(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,nu()?Reflect.construct(e,n||[],ru(t).constructor):e.apply(t,n))}function nu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(nu=function(){return!!t})()}function ru(t){return ru=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ru(t)}function ou(t,e){return ou=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ou(t,e)}var iu=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=eu(this,e)).entryScene=null,n.name=t,n.config=d(e.defaultConfig,r),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ou(t,e)}(e,t),function(t,e,n){return e&&Js(t.prototype,e),n&&Js(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"entry",value:function(t){return this.entryScene=t,this}},{key:"constructStory",value:function(){var t=this.entryScene;if(!t)throw new Error("Story must have an entry scene");return t.registerSrc(),t.assignActionId(),t.assignElementId(),this.runStaticCheck(t),this}},{key:"getAllElementStates",value:function(){var t;return this.getAllChildrenElements((null===(t=this.entryScene)||void 0===t?void 0:t.sceneRoot)||[]).map((function(t){return{id:t.getId(),data:t.toData()}})).filter((function(t){return!!t.data}))}},{key:"runStaticCheck",value:function(t){return new Ea(t).run()}}])}(bs);function au(t){return au="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},au(t)}function su(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return uu(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?uu(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function uu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function cu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function lu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,pu(r.key),r)}}function fu(t,e,n){return e&&lu(t.prototype,e),n&&lu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function pu(t){var e=function(t,e){if("object"!=au(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=au(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==au(e)?e:e+""}iu.defaultConfig={};var du=function(){function t(e,n,r){cu(this,t),this.name=e,this.key=r||e,this.content=d({},n)}return fu(t,[{key:"set",value:function(e,n){return t.isSerializable(n)?(this.content[e]=n,this):(console.warn('Value "'.concat(n,'" in key "').concat(String(e),'" is not serializable, and will not be set\nat namespace "').concat(this.name,'"')),this.content[e]=n,this)}},{key:"get",value:function(t){return this.content[t]}},{key:"toData",value:function(){return this.serialize()}},{key:"load",value:function(t){t?this.content=t:console.warn("No data to load")}},{key:"serialize",value:function(){var t=this,e={};return Object.entries(this.content).forEach((function(n){var r=su(n,2),o=r[0],i=r[1];e[o]=t.wrap(i)})),e}},{key:"deserialize",value:function(t){var e=this;t?Object.entries(t).forEach((function(t){var n=su(t,2),r=n[0],o=n[1];e.content[r]=e.unwrap(o)})):console.warn("No data to load")}},{key:"toTypeName",value:function(t){return t instanceof Date?"date":"any"}},{key:"wrap",value:function(t){return{any:function(t){return{type:"any",data:t}},date:function(t){return{type:"date",data:t.toString()}}}[this.toTypeName(t)](t)}},{key:"unwrap",value:function(t){var e={any:function(t){return t.data},date:function(t){return new Date(t.data)}};return e[t.type](t)}}],[{key:"isSerializable",value:function(e){return!!["number","string","boolean"].includes(au(e))||(e instanceof Date||(null==e||(Array.isArray(e)?e.every(t.isSerializable):"object"===au(e)&&(Object.getPrototypeOf(e)===Object.prototype&&Object.values(e).every(t.isSerializable)))))}}])}(),hu=function(){return fu((function t(){cu(this,t),this.namespaces={}}),[{key:"addNamespace",value:function(t){return this.namespaces[t.key]&&console.warn("Namespace ".concat(t.key," already exists")),this.namespaces[t.key]=t,this}},{key:"getNamespace",value:function(t){return this.namespaces[t]}},{key:"setNamespace",value:function(t,e){return this.namespaces[t]=e,this}},{key:"getNamespaces",value:function(){return this.namespaces}},{key:"keys",value:function(){return Object.keys(this.namespaces)}},{key:"values",value:function(){return Object.values(this.namespaces)}},{key:"entries",value:function(){return Object.entries(this.namespaces)}},{key:"toData",value:function(){return this.entries().reduce((function(t,e){var n=su(e,2),r=n[0],o=n[1];return t[r]=o.toData(),t}),{})}},{key:"load",value:function(t){var e=this;t?Object.entries(t).forEach((function(t){var n=su(t,2),r=n[0],o=n[1];e.namespaces[r]?e.namespaces[r].load(o):console.warn("Namespace ".concat(r," not found in ").concat(e.constructor.name))})):console.warn("No data to load")}},{key:"clear",value:function(){return this.namespaces={},this}}])}(),yu=o(196);function vu(t){return vu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vu(t)}function mu(t){return function(t){if(Array.isArray(t))return gu(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return gu(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gu(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function gu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function bu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,wu(r.key),r)}}function wu(t){var e=function(t,e){if("object"!=vu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=vu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==vu(e)?e:e+""}var _u=function(){return function(t,e,n){return e&&bu(t.prototype,e),n&&bu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state={sounds:[],srcManagers:[],elements:[]},this.currentHandling=null,this.stage=n,this.game=e,this.events=new m,this.logger=new S(e,"NarraLeaf-React")}),[{key:"findElementByScene",value:function(t){return this.state.elements.find((function(e){return e.scene===t}))||null}},{key:"findElementByImage",value:function(t){return this.state.elements.find((function(e){return e.ele.images.includes(t)}))||null}},{key:"addScene",value:function(t){return this.sceneExists(t)||this.state.elements.push({scene:t,ele:this.getElementMap()}),this}},{key:"popScene",value:function(){var t=this.state.elements.pop();return t?(this.removeElements(t.scene),this):this}},{key:"removeScene",value:function(t){return this.removeElements(t),this}},{key:"getSceneElements",value:function(){return this.state.elements}},{key:"getLastScene",value:function(){var t;return(null===(t=this.state.elements[this.state.elements.length-1])||void 0===t?void 0:t.scene)||null}},{key:"sceneExists",value:function(t){return t?this.state.elements.some((function(e){return e.scene===t})):!!this.getLastScene()}},{key:"handle",value:function(t){return this.currentHandling===t||(this.currentHandling=t,t.type),this}},{key:"createText",value:function(t,e,n,r){var o,i=null===(o=this.findElementByScene(this._getLastSceneIfNot(r)))||void 0===o?void 0:o.ele.texts;if(!i)throw new Error("Scene not found");var a=this.createWaitableAction({character:e.character,sentence:e,id:t},(function(){i.splice(i.indexOf(a),1),n&&n()}));i.push(a)}},{key:"createMenu",value:function(t,e,n){var r;if(!t.choices.length)throw new Error("Menu must have at least one choice");var o=null===(r=this.findElementByScene(this._getLastSceneIfNot(n)))||void 0===r?void 0:r.ele.menus;if(!o)throw new Error("Scene not found");var i=this.createWaitableAction(t,(function(t){o.splice(o.indexOf(i),1),e&&e(t)}));o.push(i)}},{key:"createImage",value:function(t,e){var n=this._getLastSceneIfNot(e),r=this.findElementByScene(n);return r?(r.ele.images.push(t),this):this}},{key:"disposeImage",value:function(t,e){var n,r=this._getLastSceneIfNot(e),o=null===(n=this.findElementByScene(r))||void 0===n?void 0:n.ele.images;if(!o)throw new Error("Scene not found");var i=o.indexOf(t);if(-1===i)throw new Error("Image not found");return o.splice(i,1),this}},{key:"forceReset",value:function(){var t=this;this.state.elements.forEach((function(e){var n=e.scene;t.offSrcManager(n.srcManager),n._liveState.active=!1,n.events.clear()})),this.state.elements=[],this.state.srcManagers=[]}},{key:"playSound",value:function(t,e){var n=t.play(),r=[t.once("end",o.bind(this)),t.once("stop",o.bind(this))];function o(){e&&e(),r.forEach((function(t){return t.off()})),this.stage.next()}return n}},{key:"getHowl",value:function(){return yu.Howl}},{key:"animateImage",value:function(t,e,n,r){return this.anyEvent.apply(this,[t,e,r].concat(mu(n)))}},{key:"registerSrcManager",value:function(t){return this.state.srcManagers.push(t),this}},{key:"offSrcManager",value:function(t){return this.state.srcManagers=this.state.srcManagers.filter((function(e){return e!==t})),this}},{key:"getStorable",value:function(){return this.game.getLiveGame().getStorable()}},{key:"toData",value:function(){return{scenes:this.state.elements.map((function(t){return{sceneId:t.scene.getId(),elements:{images:t.ele.images.map((function(t){return t.getId()}))}}}))}}},{key:"loadData",value:function(t,e){var n=this;if(this.state.elements=[],!this.game.getLiveGame().story)throw new Error("No story loaded");t.scenes.forEach((function(t){var r=t.sceneId,o=t.elements;n.logger.debug("Loading scene: "+r);var i=e.get(r);if(!i)throw new Error("Scene not found, id: "+r+"\nNarraLeaf cannot find the element with the id from the saved game");var a={scene:i,ele:{images:o.images.map((function(t){if(!e.has(t))throw new Error("Image not found, id: "+t+"\nNarraLeaf cannot find the element with the id from the saved game");return e.get(t)})),menus:[],texts:[]}};n.state.elements.push(a),n.registerSrcManager(i.srcManager),i._liveState.active=!0,sa.registerEventListeners(i,n)}))}},{key:"initScenes",value:function(){var t=this;this.state.elements.forEach((function(e){var n=e.scene;sa.registerEventListeners(n,t)}))}},{key:"getElementMap",value:function(){return{texts:[],menus:[],images:[]}}},{key:"removeElements",value:function(t){var e=this.state.elements.findIndex((function(e){return e.scene===t}));return-1===e||this.state.elements.splice(e,1),this}},{key:"_getLastSceneIfNot",value:function(t){var e=t||this.getLastScene();if(!e||!this.sceneExists(e))throw new Error('Scene not found, please call "scene.activate()" first.');return e}},{key:"anyEvent",value:function(t,e,n){for(var r,o=this,i=arguments.length,a=new Array(i>3?i-3:0),s=3;s<i;s++)a[s-3]=arguments[s];(r=e.events).any.apply(r,[t].concat(a)).then(n).then((function(){o.stage.next()}))}},{key:"createWaitableAction",value:function(t,e){return{action:t,onClick:function(t){e&&e(t)}}}}])}();function Su(t){var e,n,r="";if("string"==typeof t||"number"==typeof t)r+=t;else if("object"==typeof t)if(Array.isArray(t)){var o=t.length;for(e=0;e<o;e++)t[e]&&(n=Su(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}_u.EventTypes={"event:state.ready":"event:state.ready","event:state.end":"event:state.end","event:state.player.skip":"event:state.player.skip","event:state.preload.unmount":"event:state.preload.unmount","event:state.preload.loaded":"event:state.preload.loaded","event:state.player.flush":"event:state.player.flush"};const ku=function(){for(var t,e,n=0,r="",o=arguments.length;n<o;n++)(t=arguments[n])&&(e=Su(t))&&(r&&(r+=" "),r+=e);return r};var xu=o(12),Au=o.n(xu);function Tu(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Eu(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Eu(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Eu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ou(t){return Ou="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ou(t)}function Pu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ju(r.key),r)}}function ju(t){var e=function(t,e){if("object"!=Ou(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ou(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ou(e)?e:e+""}var Cu=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state={width:0,height:0,minWidth:800,minHeight:450,paused:!1},this.events=new m,this.lockers=[],this.updater=null}return function(t,e,n){return e&&Pu(t.prototype,e),n&&Pu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"update",value:function(e,n){this.state.width=e,this.state.height=n,this.events.emit(t.EventTypes["event:aspectRatio.update"],e,n)}},{key:"updateMin",value:function(t,e){this.state.minWidth=t,this.state.minHeight=e}},{key:"lock",value:function(){var t=Symbol();return this.lockers.push(t),t}},{key:"unlock",value:function(t){if(t&&!this.lockers.includes(t))throw new Error("Locker not found");return this.lockers=this.lockers.filter((function(e){return e!==t})),this.triggerUpdate(),null}},{key:"isLocked",value:function(){return!!this.lockers.length}},{key:"getStyle",value:function(){return{width:"".concat(this.state.width,"px"),height:"".concat(this.state.height,"px")}}},{key:"setUpdate",value:function(t){this.updater=t}},{key:"pause",value:function(){this.state.paused=!0,this.events.emit(t.EventTypes["event:aspectRatio.pause"])}},{key:"resume",value:function(){this.state.paused=!1,this.events.emit(t.EventTypes["event:aspectRatio.resume"])}},{key:"onUpdate",value:function(e){var n=this;return this.events.on(t.EventTypes["event:aspectRatio.update"],e),function(){n.events.off(t.EventTypes["event:aspectRatio.update"],e)}}},{key:"triggerUpdate",value:function(){this.updater&&this.updater()}}])}();Cu.EventTypes={"event:aspectRatio.update":"event:aspectRatio.update","event:aspectRatio.pause":"event:aspectRatio.pause","event:aspectRatio.resume":"event:aspectRatio.resume"};var Iu=(0,xu.createContext)(null);function Lu(t){var e=t.children,n=Tu((0,xu.useState)(new Cu),1)[0];return Au().createElement(Iu.Provider,{value:{ratio:n}},e)}function Mu(){var t=(0,xu.useContext)(Iu);if(!Iu||!t)throw new Error("useRatio must be used within a RatioProvider");var e=Tu((0,xu.useReducer)((function(t){return t+1}),0),2)[1],n=t.ratio;return(0,xu.useEffect)((function(){return n.onUpdate((function(){e()}))}),[]),t}function Nu(){return Nu=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Nu.apply(null,arguments)}function Ru(t){var e=t.children,n=t.className,r=t.props,o=t.ref,i=Mu().ratio,a=i.getStyle();return Au().createElement("div",{className:ku("inset-0 flex items-center justify-center",n),style:{width:"100%",height:"100%",minWidth:"".concat(i.state.minWidth,"px"),minHeight:"".concat(i.state.minHeight,"px")}},Au().createElement("div",Nu({style:Object.assign(Object.assign({},a),{position:"relative"})},r||{},{ref:o}),e))}function Fu(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Vu(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Vu(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Vu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}const Du=function(t){var e=t.text,n=t.speed,r=t.onComplete,o=t.className,i=Fu((0,xu.useState)(""),2),a=i[0],s=i[1],u=Fu((0,xu.useState)(0),2),c=u[0],l=u[1];return(0,xu.useEffect)((function(){if(c<e.length){if(" "!==e[c]){var t=setTimeout((function(){s((function(t){return t+e[c]})),l((function(t){return t+1}))}),n);return function(){return clearTimeout(t)}}s((function(t){return t+" "})),l((function(t){return t+1}))}else r&&r()}),[c,e,n,r]),Au().createElement("span",{className:o},a)};function Bu(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Gu(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Gu(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Gu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var Uu=Au().createContext(null);function Hu(t){var e=t.children,n=t.game,r=new nc({}),o=Bu((0,xu.useState)(n||r),2),i=o[0],a=o[1];return Au().createElement(Uu.Provider,{value:{game:i,setGame:a}},e)}function $u(){var t=(0,xu.useContext)(Uu);if(!t)throw new Error("useGame must be used within a GameProvider");return t}function zu(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Wu(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wu(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Wu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function qu(t){var e,n=t.action,r=t.onClick,o=t.useTypeEffect,i=void 0===o||o,a=t.className,s=t.state,u=n.sentence,c=n.character,l=zu((0,xu.useState)(0),2),f=l[0],p=l[1],d=zu((0,xu.useState)(!1),2),h=d[0],y=d[1],m=$u().game,g=function(){p((function(t){return t+1})),f===u.text.length-1&&y(!0)};return(0,xu.useEffect)((function(){if(window){var t=function(t){m.config.elements.say.nextKey.includes(t.key)&&(h?r&&r():y(!0))};return window.addEventListener("keyup",t),function(){window.removeEventListener("keyup",t)}}console.warn("Failed to add event listener, window is not available\nat Say.tsx: onElementClick")}),[h]),(0,xu.useEffect)((function(){var t=s.events.onEvents([{type:_u.EventTypes["event:state.player.skip"],listener:s.events.on(_u.EventTypes["event:state.player.skip"],(function(){s.logger.log("NarraLeaf-React: Say","Skipped"),h?r&&r():y(!0)}))}]);return function(){t.cancel()}})),Au().createElement(Ru,{className:"absolute"},u.state.display&&(c&&c.config.mode!==Ba.Modes.adv?Au().createElement(Au().Fragment,null," "):Au().createElement("div",{className:ku("absolute flex items-center justify-center bottom-0 w-[calc(100%-40px)] h-[calc(33%-40px)] m-4 bg-white",m.config.elementStyles.say.container,a),onClick:function(){h?r&&r():y(!0)}},Au().createElement("div",{className:ku("absolute top-0 left-0 p-1.25 rounded-br-md m-4",m.config.elementStyles.say.nameText)},(null===(e=u.character)||void 0===e?void 0:e.name)||""),Au().createElement("div",{className:ku("text-center max-w-[80%] mx-auto",m.config.elementStyles.say.textContainer)},u.text.map((function(t,e){var n=t.config.color||u.config.color||Da.defaultColor;return h?Au().createElement("span",{key:e,style:{color:"string"==typeof n?n:v(n)},className:ku(m.config.elementStyles.say.textSpan)},t.text):e>f?null:Au().createElement("span",{key:e,style:{color:v(n)},className:ku(m.config.elementStyles.say.textSpan)},i?Au().createElement(Du,{text:t.text,onComplete:e===f?g:void 0,speed:m.config.elements.say.textInterval,className:ku(m.config.elementStyles.say.textSpan)}):t.text)}))))))}function Yu(t){var e=t.sentence,n=t.className;return Au().createElement(Au().Fragment,null,e.text.map((function(t,r){var o=t.config.color||e.config.color||Da.defaultColor;return Au().createElement("span",{key:r,style:{color:v(o)},className:n},t.text)})))}var Xu,Ku={say:qu,menu:function(t){var e=t.prompt,n=t.choices,r=t.afterChoose,o=t.state,i=$u().game,a=i.config.elements.say.use;return Au().createElement(Au().Fragment,null,Au().createElement(Ru,{className:"absolute"},Au().createElement("div",{className:"absolute flex flex-col items-center justify-center min-w-full w-full h-full"},e&&Au().createElement(a,{state:o,action:{sentence:e,character:null},useTypeEffect:!1,className:"z-10"}))),Au().createElement(Ru,{className:"absolute"},Au().createElement("div",{className:ku("absolute flex flex-col items-center justify-center min-w-full w-full h-full",i.config.elementStyles.menu.container)},Au().createElement("div",{className:"p-4 rounded-lg w-full z-20"},Au().createElement("div",{className:"flex flex-col items-center mt-4 w-full"},n.map((function(t,e){return Au().createElement("button",{key:e,className:ku("bg-white text-black p-2 mt-2 w-1/2",i.config.elementStyles.menu.choiceButton),onClick:function(){return function(t){r(t)}(t)}},Au().createElement(Yu,{key:e,sentence:t.prompt,className:ku(i.config.elementStyles.menu.choiceButtonText)}))})))))))}};function Zu(t){return Zu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zu(t)}function Qu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ju(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ec(r.key),r)}}function tc(t,e,n){return e&&Ju(t.prototype,e),n&&Ju(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function ec(t){var e=function(t,e){if("object"!=Zu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Zu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Zu(e)?e:e+""}!function(t){t.game="game"}(Xu||(Xu={}));var nc=function(){return tc((function t(e){Qu(this,t),this.liveGame=null,this.config=d(t.DefaultConfig,e)}),[{key:"useComponent",value:function(t,e){if(!Object.keys(Ku).includes(t))throw new Error("Invalid key ".concat(t));if("function"!=typeof e)throw new Error("Invalid component for key ".concat(t));return this.config.elements[t].use=e,this}},{key:"getLiveGame",value:function(){if(!this.liveGame){var t=this.createLiveGame();return this.liveGame=t,t}return this.liveGame}},{key:"createLiveGame",value:function(){return new rc(this)}}])}();nc.defaultSettings={volume:1},nc.ComponentTypes={say:"say",menu:"menu"},nc.DefaultConfig={player:{contentContainerId:"__narraleaf_content",aspectRatio:16/9,minWidth:800,minHeight:450,width:"100%",height:"100%",skipKey:["Control"],skipInterval:100},elements:{say:{nextKey:[" "],textInterval:50,use:Ku.say},img:{slowLoadWarning:!0,slowLoadThreshold:2e3},menu:{use:Ku.menu}},elementStyles:{say:{container:"",nameText:"",textContainer:"",textSpan:""},menu:{container:"",choiceButton:"",choiceButtonText:""}},app:{debug:!1,logger:{log:!1,info:!1,warn:!0,error:!0,debug:!1,trace:!1}}},nc.GameSettingsNamespace=Xu;var rc=function(){function t(e){Qu(this,t),this.currentSavedGame=null,this.story=null,this.lockedAwaiting=null,this.gameState=void 0,this._lockedCount=0,this.currentAction=null,this.game=e,this.storable=new hu,this.initNamespaces()}return tc(t,[{key:"initNamespaces",value:function(){return this.storable.clear().addNamespace(new du(t.GameSpacesKey.game,t.DefaultNamespaces.game)),this}},{key:"getStorable",value:function(){return this.storable}},{key:"loadStory",value:function(t){return this.story=t.constructStory(),this}},{key:"serialize",value:function(){var t,e,n;if(!this.gameState)throw new Error("No game state");var r=this.gameState,o=this.story;if(!o)throw new Error("No story loaded");var i=this.storable.toData(),a=r.toData(),s=(null===(t=this.getCurrentAction())||void 0===t?void 0:t.getId())||null,u=o.getAllElementStates();return{name:(null===(e=this.currentSavedGame)||void 0===e?void 0:e.name)||"",meta:{created:(null===(n=this.currentSavedGame)||void 0===n?void 0:n.meta.created)||Date.now(),updated:Date.now()},game:{store:i,stage:a,currentAction:s,elementStates:u}}}},{key:"deserialize",value:function(t){var e;if(!this.gameState)throw new Error("No game state");var n=this.gameState,r=this.story;if(!r)throw new Error("No story loaded");this.reset({gameState:n}),n.stage.forceUpdate();var o=new Map,i=new Map,a=t.game,s=a.store,u=a.stage,c=a.elementStates,l=a.currentAction;if(r.forEachChild((null===(e=r.entryScene)||void 0===e?void 0:e.sceneRoot)||[],(function(t){o.set(t.getId(),t),i.set(t.callee.getId(),t.callee)})),this.storable.load(s),c.forEach((function(t){var e=t.id,r=t.data;n.logger.debug("restore element",e);var o=i.get(e);if(!o)throw new Error("Element not found, id: "+e+"\nNarraLeaf cannot find the element with the id from the saved game");o.reset(),o.fromData(r)})),this.currentSavedGame=t,n.loadData(u,i),l){var f=o.get(l);if(!f)throw new Error("Action not found, id: "+l+"\nNarraLeaf cannot find the action with the id from the saved game");this.currentAction=f}n.stage.forceUpdate(),n.stage.next()}},{key:"newGame",value:function(){var t,e,n;if(!this.gameState)throw new Error("No game state");var r=this.gameState;this.reset({gameState:r}),this.initNamespaces();var o=this.getNewSavedGame();o.name="NewGame-"+Date.now(),this.currentSavedGame=o;var i=null===(t=this.story)||void 0===t?void 0:t.getAllElementMap((null===(n=null===(e=this.story)||void 0===e?void 0:e.entryScene)||void 0===n?void 0:n.sceneRoot)||[]);return i?i.forEach((function(t){r.logger.debug("reset element",t),t.reset()})):r.logger.warn("No elements found"),r.stage.forceUpdate(),r.stage.next(),this}},{key:"reset",value:function(t){var e,n,r=t.gameState;this.lockedAwaiting&&this.lockedAwaiting.abort(),this.currentAction=(null===(n=null===(e=this.story)||void 0===e?void 0:e.entryScene)||void 0===n?void 0:n.sceneRoot)||null,this.lockedAwaiting=null,this.currentSavedGame=null,r.forceReset()}},{key:"getCurrentAction",value:function(){return this.currentAction}},{key:"setCurrentAction",value:function(t){return this.currentAction=t,this}},{key:"next",value:function(t){var e,n;if(!this.story)throw new Error("No story loaded");if(this.lockedAwaiting){if(!this.lockedAwaiting.solved){if(this._lockedCount++,this._lockedCount>1e3)throw new Error("Locked awaiting");return this.lockedAwaiting}var r=this.lockedAwaiting.result;return this.currentAction=(null===(e=null==r?void 0:r.node)||void 0===e?void 0:e.action)||null,t.logger.debug("next action",r),this.lockedAwaiting=null,r||null}if(!this.currentAction)return t.events.emit(_u.EventTypes["event:state.end"]),t.logger.warn("LiveGame","No current action"),null;var o=this.currentAction.executeAction(t);return h.isAwaitable(o)?(this.lockedAwaiting=o,o):(t.logger.debug("next action",o),this._lockedCount=0,this.currentAction=(null===(n=o.node)||void 0===n?void 0:n.action)||null,o)}},{key:"abortAwaiting",value:function(){var t;if(this.lockedAwaiting){var e=this.lockedAwaiting.abort();this.currentAction=(null===(t=null==e?void 0:e.node)||void 0===t?void 0:t.action)||null,this.lockedAwaiting=null}}},{key:"executeAction",value:function(t,e){var n,r=e.executeAction(t);return h.isAwaitable(r)?r:(null===(n=null==r?void 0:r.node)||void 0===n?void 0:n.action)||null}},{key:"setGameState",value:function(t){return this.gameState=t,this}},{key:"getGameState",value:function(){return this.gameState}},{key:"getNewSavedGame",value:function(){var t,e,n;return{name:"",meta:{created:Date.now(),updated:Date.now()},game:{store:{},stage:{scenes:[]},elementStates:[],currentAction:(null===(n=null===(e=null===(t=this.story)||void 0===t?void 0:t.entryScene)||void 0===e?void 0:e.sceneRoot)||void 0===n?void 0:n.getId())||null}}}}])}();rc.DefaultNamespaces={game:{}},rc.GameSpacesKey={game:"game"};var oc=o(72),ic=o.n(oc),ac=o(825),sc=o.n(ac),uc=o(659),cc=o.n(uc),lc=o(56),fc=o.n(lc),pc=o(540),dc=o.n(pc),hc=o(113),yc=o.n(hc),vc=o(587),mc={};mc.styleTagTransform=yc(),mc.setAttributes=fc(),mc.insert=cc().bind(null,"head"),mc.domAPI=sc(),mc.insertStyleElement=dc();ic()(vc.A,mc);vc.A&&vc.A.locals&&vc.A.locals;var gc=o(848);const bc=(0,xu.createContext)({strict:!1});function wc(t){for(const e in t)vo[e]={...vo[e],...t[e]}}function _c({children:t,features:e,strict:n=!1}){const[,r]=(0,xu.useState)(!Sc(e)),o=(0,xu.useRef)(void 0);if(!Sc(e)){const{renderer:t,...n}=e;o.current=t,wc(n)}return(0,xu.useEffect)((()=>{Sc(e)&&e().then((({renderer:t,...e})=>{wc(e),o.current=t,r(!0)}))}),[]),(0,gc.jsx)(bc.Provider,{value:{renderer:o.current,strict:n},children:t})}function Sc(t){return"function"==typeof t}function kc(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}function xc(t,e,n={}){var r;const o=$r(t,e,"exit"===n.type?null===(r=t.presenceContext)||void 0===r?void 0:r.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=o||{};n.transitionOverride&&(i=n.transitionOverride);const a=o?()=>Promise.all(to(t,o,n)):()=>Promise.resolve(),s=t.variantChildren&&t.variantChildren.size?(r=0)=>{const{delayChildren:o=0,staggerChildren:a,staggerDirection:s}=i;return function(t,e,n=0,r=0,o=1,i){const a=[],s=(t.variantChildren.size-1)*r,u=1===o?(t=0)=>t*r:(t=0)=>s-t*r;return Array.from(t.variantChildren).sort(Ac).forEach(((t,r)=>{t.notify("AnimationStart",e),a.push(xc(t,e,{...i,delay:n+u(r)}).then((()=>t.notify("AnimationComplete",e))))})),Promise.all(a)}(t,e,o+r,a,s,n)}:()=>Promise.resolve(),{when:u}=i;if(u){const[t,e]="beforeChildren"===u?[a,s]:[s,a];return t().then((()=>e()))}return Promise.all([a(),s(n.delay)])}function Ac(t,e){return t.sortNodePosition(e)}const Tc=[...lo].reverse(),Ec=lo.length;function Oc(t){return e=>Promise.all(e.map((({animation:e,options:n})=>function(t,e,n={}){let r;if(t.notify("AnimationStart",e),Array.isArray(e)){const o=e.map((e=>xc(t,e,n)));r=Promise.all(o)}else if("string"==typeof e)r=xc(t,e,n);else{const o="function"==typeof e?$r(t,e,n.custom):e;r=Promise.all(to(t,o,n))}return r.then((()=>{t.notify("AnimationComplete",e)}))}(t,e,n))))}function Pc(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!kc(e,t)}function jc(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Cc(){return{animate:jc(!0),whileInView:jc(),whileHover:jc(),whileTap:jc(),whileDrag:jc(),whileFocus:jc(),exit:jc()}}class Ic{constructor(t){this.isMounted=!1,this.node=t}update(){}}let Lc=0;const Mc={animation:{Feature:class extends Ic{constructor(t){super(t),t.animationState||(t.animationState=function(t){let e=Oc(t),n=Cc(),r=!0;const o=e=>(n,r)=>{var o;const i=$r(t,r,"exit"===e?null===(o=t.presenceContext)||void 0===o?void 0:o.custom:void 0);if(i){const{transition:t,transitionEnd:e,...r}=i;n={...n,...r,...e}}return n};function i(i){const a=t.getProps(),s=t.getVariantContext(!0)||{},u=[],c=new Set;let l={},f=1/0;for(let e=0;e<Ec;e++){const p=Tc[e],d=n[p],h=void 0!==a[p]?a[p]:s[p],y=co(h),v=p===i?d.isActive:null;!1===v&&(f=e);let m=h===s[p]&&h!==a[p]&&y;if(m&&r&&t.manuallyAnimateOnMount&&(m=!1),d.protectedKeys={...l},!d.isActive&&null===v||!h&&!d.prevProp||uo(h)||"boolean"==typeof h)continue;let g=Pc(d.prevProp,h)||p===i&&d.isActive&&!m&&y||e>f&&y,b=!1;const w=Array.isArray(h)?h:[h];let _=w.reduce(o(p),{});!1===v&&(_={});const{prevResolvedValues:S={}}=d,k={...S,..._},x=e=>{g=!0,c.has(e)&&(b=!0,c.delete(e)),d.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in k){const e=_[t],n=S[t];if(l.hasOwnProperty(t))continue;let r=!1;r=Lr(e)&&Lr(n)?!kc(e,n):e!==n,r?null!=e?x(t):c.add(t):void 0!==e&&c.has(t)?x(t):d.protectedKeys[t]=!0}d.prevProp=h,d.prevResolvedValues=_,d.isActive&&(l={...l,..._}),r&&t.blockInitialAnimation&&(g=!1),!g||m&&!b||u.push(...w.map((t=>({animation:t,options:{type:p}}))))}if(c.size){const e={};c.forEach((n=>{const r=t.getBaseTarget(n),o=t.getValue(n);o&&(o.liveStyle=!0),e[n]=null!=r?r:null})),u.push({animation:e})}let p=Boolean(u.length);return!r||!1!==a.initial&&a.initial!==a.animate||t.manuallyAnimateOnMount||(p=!1),r=!1,p?e(u):Promise.resolve()}return{animateChanges:i,setActive:function(e,r){var o;if(n[e].isActive===r)return Promise.resolve();null===(o=t.variantChildren)||void 0===o||o.forEach((t=>{var n;return null===(n=t.animationState)||void 0===n?void 0:n.setActive(e,r)})),n[e].isActive=r;const a=i(e);for(const t in n)n[t].protectedKeys={};return a},setAnimateFunction:function(n){e=n(t)},getState:()=>n,reset:()=>{n=Cc(),r=!0}}}(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();uo(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:e}=this.node.prevProps||{};t!==e&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),null===(t=this.unmountControls)||void 0===t||t.call(this)}}},exit:{Feature:class extends Ic{constructor(){super(...arguments),this.id=Lc++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:e}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===n)return;const r=this.node.animationState.setActive("exit",!t);e&&!t&&r.then((()=>e(this.id)))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}}};function Nc(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function Rc(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const Fc=t=>e=>(t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary)(e)&&t(e,Rc(e));function Vc(t,e,n,r){return Nc(t,e,Fc(n),r)}function Dc(t){let e=null;return()=>{const n=()=>{e=null};return null===e&&(e=t,n)}}const Bc=Dc("dragHorizontal"),Gc=Dc("dragVertical");function Uc(){const t=function(t){let e=!1;if("y"===t)e=Gc();else if("x"===t)e=Bc();else{const t=Bc(),n=Gc();t&&n?e=()=>{t(),n()}:(t&&t(),n&&n())}return e}(!0);return!t||(t(),!1)}function Hc(t,e){const n=e?"pointerenter":"pointerleave",r=e?"onHoverStart":"onHoverEnd";return Vc(t.current,n,((n,o)=>{if("touch"===n.pointerType||Uc())return;const i=t.getProps();t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",e);const a=i[r];a&&jt.postRender((()=>a(n,o)))}),{passive:!t.getProps()[r]})}const $c=(t,e)=>!!e&&(t===e||$c(t,e.parentElement));function zc(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,Rc(n))}const Wc=new WeakMap,qc=new WeakMap,Yc=t=>{const e=Wc.get(t.target);e&&e(t)},Xc=t=>{t.forEach(Yc)};function Kc(t,e,n){const r=function({root:t,...e}){const n=t||document;qc.has(n)||qc.set(n,{});const r=qc.get(n),o=JSON.stringify(e);return r[o]||(r[o]=new IntersectionObserver(Xc,{root:t,...e})),r[o]}(e);return Wc.set(t,n),r.observe(t),()=>{Wc.delete(t),r.unobserve(t)}}const Zc={some:0,all:1};const Qc={inView:{Feature:class extends Ic{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:e,margin:n,amount:r="some",once:o}=t,i={root:e?e.current:void 0,rootMargin:n,threshold:"number"==typeof r?r:Zc[r]};return Kc(this.node.current,i,(t=>{const{isIntersecting:e}=t;if(this.isInView===e)return;if(this.isInView=e,o&&!e&&this.hasEnteredView)return;e&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",e);const{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),i=e?n:r;i&&i(t)}))}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:t,prevProps:e}=this.node;["amount","margin","root"].some(function({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}(t,e))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends Ic{constructor(){super(...arguments),this.removeStartListeners=_t,this.removeEndListeners=_t,this.removeAccessibleListeners=_t,this.startPointerPress=(t,e)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),r=Vc(window,"pointerup",((t,e)=>{if(!this.checkPressEnd())return;const{onTap:n,onTapCancel:r,globalTapTarget:o}=this.node.getProps(),i=o||$c(this.node.current,t.target)?n:r;i&&jt.update((()=>i(t,e)))}),{passive:!(n.onTap||n.onPointerUp)}),o=Vc(window,"pointercancel",((t,e)=>this.cancelPress(t,e)),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=Zn(r,o),this.startPress(t,e)},this.startAccessiblePress=()=>{const t=Nc(this.node.current,"keydown",(t=>{if("Enter"!==t.key||this.isPressing)return;this.removeEndListeners(),this.removeEndListeners=Nc(this.node.current,"keyup",(t=>{"Enter"===t.key&&this.checkPressEnd()&&zc("up",((t,e)=>{const{onTap:n}=this.node.getProps();n&&jt.postRender((()=>n(t,e)))}))})),zc("down",((t,e)=>{this.startPress(t,e)}))})),e=Nc(this.node.current,"blur",(()=>{this.isPressing&&zc("cancel",((t,e)=>this.cancelPress(t,e)))}));this.removeAccessibleListeners=Zn(t,e)}}startPress(t,e){this.isPressing=!0;const{onTapStart:n,whileTap:r}=this.node.getProps();r&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&jt.postRender((()=>n(t,e)))}checkPressEnd(){this.removeEndListeners(),this.isPressing=!1;return this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!Uc()}cancelPress(t,e){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&jt.postRender((()=>n(t,e)))}mount(){const t=this.node.getProps(),e=Vc(t.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),n=Nc(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Zn(e,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}},focus:{Feature:class extends Ic{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch(e){t=!0}t&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Zn(Nc(this.node.current,"focus",(()=>this.onFocus())),Nc(this.node.current,"blur",(()=>this.onBlur())))}unmount(){}}},hover:{Feature:class extends Ic{mount(){this.unmount=Zn(Hc(this.node,!0),Hc(this.node,!1))}unmount(){}}}},Jc=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function tl(t){return"string"==typeof t&&!t.includes("-")&&!!(Jc.indexOf(t)>-1||/[A-Z]/u.test(t))}const el={renderer:(t,e)=>tl(t)?new No(e):new Fo(e,{allowProjection:t!==xu.Fragment}),...Mc,...Qc};function nl(t){var e=t.children;return Au().createElement(_c,{features:el,strict:!0},e)}function rl(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return ol(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ol(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ol(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function il(t){var e=t.children,n=t.className,r=rl((0,xu.useState)({}),2),o=r[0],i=r[1],a=Mu().ratio,s=$u().game,u=rl((0,xu.useReducer)((function(t){return t+1}),0),2)[1],c=s.config.player.minWidth,l=s.config.player.minHeight;return(0,xu.useEffect)((function(){var t,e=function(){if(a.isLocked())console.warn("Ratio is locked, skipping update");else{var t=document.getElementById(s.config.player.contentContainerId);if(t){var e,n,r=t.clientWidth,o=t.clientHeight,f=s.config.player.aspectRatio;r/o>f?(e=o*f,n=o):(e=r,n=r/f),e<c&&(e=c),n<l&&(n=l),i({width:"".concat(e,"px"),height:"".concat(n,"px"),margin:"auto",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",display:"flex",alignItems:"center",justifyContent:"center"}),a.update(e,n),a.updateMin(c,l),u()}}};a.setUpdate(e);var n=function(){e(),clearTimeout(t),a.pause(),t=setTimeout((function(){a.resume()}),100)};return e(),window.addEventListener("resize",n),function(){window.removeEventListener("resize",n),clearTimeout(t)}}),[a]),Au().createElement("div",{id:s.config.player.contentContainerId,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"}},Au().createElement("div",{className:ku(n),style:o},e))}var al={start:"start",update:"update",end:"end"};function sl(t){var e=t.children,n=Mu().ratio,r=$u().game,o=(0,xu.useRef)(null);return(0,xu.useEffect)((function(){if(!o.current)throw new Error("Content container not found")}),[r.config.player.contentContainerId]),Au().createElement(Au().Fragment,null,Au().createElement("div",{ref:o,className:ku("absolute inset-0 flex items-center justify-center bg-cover bg-center overflow-hidden"),style:Object.assign({},n.getStyle())},e))}function ul(t){return ul="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ul(t)}function cl(){return cl=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},cl.apply(null,arguments)}function ll(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ll=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",d="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==ul(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function T(e,n,r){var o=p;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:d,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(ul(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function fl(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return pl(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pl(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var dl=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};function hl(t){var e=this,n=t.scene,r=t.props,o=t.state,i=(0,xu.useRef)(null),a=$u().game,s=fl((0,xu.useState)(null),2),u=s[0],c=s[1],l=fl((0,xu.useState)([]),2)[1],f=fl((0,xu.useState)(null),2),p=f[0],h=f[1],y=fl((0,xu.useState)({}),2),v=y[0],m=y[1];function g(){n.events.emit(Us.EventTypes["event:scene.imageLoaded"])}function b(t){if(p&&p.getControl()&&(console.warn("processing transform not completed"),p.getControl().complete(),p.setControl(null)),!i.current)throw new Error("scope not ready");t instanceof hi?Object.assign(i.current.style,t.propToCSS(o,n.backgroundImage.state)):Object.assign(i.current.style,t)}(0,xu.useEffect)((function(){var t=n.events.onEvents([{type:Us.EventTypes["event:scene.applyTransition"],listener:n.events.on(Us.EventTypes["event:scene.applyTransition"],(function(t){return c(t),t?new Promise((function(e){var n=t.events.onEvents([{type:al.update,listener:t.events.on(al.update,(function(t){l(t)}))},{type:al.end,listener:t.events.on(al.end,(function(){c(null),o.logger.debug("scene background transition end",t)}))},{type:al.start,listener:t.events.on(al.start,(function(){o.logger.debug("scene background transition start",t)}))}]);t.start((function(){n.cancel(),e()}))})):(o.logger.warn("transition not set"),Promise.resolve())}))},{type:Us.EventTypes["event:scene.applyTransform"],listener:n.events.on(Us.EventTypes["event:scene.applyTransform"],(function(t){return dl(e,void 0,void 0,ll().mark((function e(){return ll().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return b(t.propToCSS(o,n.backgroundImage.state)),h(t),e.next=4,t.animate({scope:i,image:n.backgroundImage},o,n.backgroundImage.state,(function(e){n.backgroundImage.state=d(n.backgroundImage.state,e),m({style:t.propToCSS(o,n.backgroundImage.state)}),h(null)}));case 4:case"end":return e.stop()}}),e)})))}))},{type:Us.EventTypes["event:scene.initTransform"],listener:n.events.on(Us.EventTypes["event:scene.initTransform"],(function(t){return dl(e,void 0,void 0,ll().mark((function e(){return ll().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o.logger.debug("init transform",t),e.next=3,t.animate({scope:i,image:n.backgroundImage},o,n.backgroundImage.state,(function(t){n.backgroundImage.state=d(n.backgroundImage.state,t)}));case 3:case"end":return e.stop()}}),e)})))}))}]);return function(){t.cancel()}}),[]),(0,xu.useEffect)((function(){b(n.backgroundImage.state)}),[]),(0,xu.useEffect)((function(){var t=o.events.onEvents([{type:_u.EventTypes["event:state.player.skip"],listener:o.events.on(_u.EventTypes["event:state.player.skip"],(function(){p&&p.getControl()&&(p.getControl().complete(),p.setControl(null))}))}]);return function(){t.cancel()}}),[p]);var w,_="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",S={src:_,style:Object.assign({opacity:0},a.config.app.debug?{border:"1px solid red"}:{})};return Au().createElement("div",null,u?u.toElementProps().map((function(t,e,n){var o=d(S,r,v,t);return Au().createElement(sl,{key:e},Au().createElement("img",cl({alt:o.alt},o,{onLoad:g,src:o.src||_,ref:e===n.length-1?i:void 0,className:"absolute"})))})):(w=d(S,r,{style:new hi([]).propToCSS(o,n.backgroundImage.state)},v),Au().createElement(sl,null,Au().createElement("img",cl({alt:w.alt},w,{onLoad:g,ref:i,src:w.src||_,className:"absolute"})))))}function yl(t){return yl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yl(t)}function vl(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */vl=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",d="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==yl(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function T(e,n,r){var o=p;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:d,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(yl(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function ml(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return gl(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gl(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function gl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var bl=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};function wl(t){var e=t.scene,n=t.state,r=t.children,o=t.className,i=Mu().ratio,a=ml((0,xu.useState)((function(){return e.state.backgroundMusic})),2),s=a[0],u=a[1],c=ml((0,xu.useState)(null),2),l=c[0],f=c[1],p=ml((0,xu.useState)(null),2),d=p[0],h=p[1];function y(t,e){return bl(this,void 0,void 0,vl().mark((function n(){var r;return vl().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(t.$getHowl()&&t.$getHowl().playing(t.$getToken())){n.next=2;break}return n.abrupt("return",Promise.resolve());case 2:return r=t.$getHowl().volume(t.$getToken()),n.next=5,new Promise((function(n){t.$getHowl().fade(r,0,e,t.$getToken()),h((function(){return n})),f(setTimeout((function(){t.$getHowl().stop(),t.$getHowl().volume(r),t.$setToken(null),n(),h(null)}),e))}));case 5:return n.abrupt("return",n.sent);case 6:case"end":return n.stop()}}),n)})))}return(0,xu.useEffect)((function(){var t=[{type:"event:scene.setBackgroundMusic",listener:e.events.on(Us.EventTypes["event:scene.setBackgroundMusic"],(function(t,e){(function(t,e){var n,r,o,i,a,c;return bl(this,void 0,void 0,vl().mark((function p(){var v,m;return vl().wrap((function(p){for(;;)switch(p.prev=p.next){case 0:if(l&&(clearTimeout(l),f(null),d&&(d(),h(null))),m=t,!(v=s)){p.next=12;break}if(!e){p.next=9;break}return p.next=7,y(v,e);case 7:p.next=12;break;case 9:null===(n=v.$getHowl())||void 0===n||n.stop(),null===(r=v.$getHowl())||void 0===r||r.volume(0),v.$setToken(null);case 12:if(m){p.next=14;break}return p.abrupt("return");case 14:null===(o=m.$getHowl())||void 0===o||o.volume(0),m.$setToken(null===(i=m.$getHowl())||void 0===i?void 0:i.play(m.$getToken()||void 0)),e?null===(a=m.$getHowl())||void 0===a||a.fade(0,m.config.volume,e,m.$getToken()):null===(c=m.$getHowl())||void 0===c||c.volume(m.config.volume,m.$getToken()),u(m);case 18:case"end":return p.stop()}}),p)})))})(t,e).then()}))},{type:"event:scene.preUnmount",listener:e.events.on(Us.EventTypes["event:scene.preUnmount"],(function(){l&&(clearTimeout(l),d&&d()),s&&y(s,e.state.backgroundMusicFade).then()}))}];return function(){t.forEach((function(t){var n=t.type,r=t.listener;e.events.off(n,r)}))}}),[]),(0,xu.useEffect)((function(){return e.events.emit(Us.EventTypes["event:scene.mount"]),function(){e.events.emit(Us.EventTypes["event:scene.unmount"])}}),[]),Au().createElement("div",{className:o},Au().createElement(hl,{scene:e,props:{width:i.state.width,height:i.state.height,src:Aa.backgroundToSrc(e.state.background)},state:n}),r)}function _l(t){if("undefined"==typeof Proxy)return t;const e=new Map;return new Proxy(((...e)=>t(...e)),{get:(n,r)=>"create"===r?t:(e.has(r)||e.set(r,t(r)),e.get(r))})}const Sl=(0,xu.createContext)({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),kl=(0,xu.createContext)({}),xl=(0,xu.createContext)(null),Al=io?xu.useLayoutEffect:xu.useEffect,{schedule:Tl,cancel:El}=Pt(queueMicrotask,!1);function Ol(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}const Pl=(0,xu.createContext)({});let jl=!1;function Cl(t,e,n,r,o){var i;const{visualElement:a}=(0,xu.useContext)(kl),s=(0,xu.useContext)(bc),u=(0,xu.useContext)(xl),c=(0,xu.useContext)(Sl).reducedMotion,l=(0,xu.useRef)();r=r||s.renderer,!l.current&&r&&(l.current=r(t,{visualState:e,parent:a,props:n,presenceContext:u,blockInitialAnimation:!!u&&!1===u.initial,reducedMotionConfig:c}));const f=l.current,p=(0,xu.useContext)(Pl);!f||f.projection||!o||"html"!==f.type&&"svg"!==f.type||function(t,e,n,r){const{layoutId:o,layout:i,drag:a,dragConstraints:s,layoutScroll:u,layoutRoot:c}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Ll(t.parent)),t.projection.setOptions({layoutId:o,layout:i,alwaysMeasureLayout:Boolean(a)||s&&Ol(s),visualElement:t,animationType:"string"==typeof i?i:"both",initialPromotionConfig:r,layoutScroll:u,layoutRoot:c})}(l.current,n,o,p),(0,xu.useInsertionEffect)((()=>{f&&f.update(n,u)}));const d=n[qr],h=(0,xu.useRef)(Boolean(d)&&!window.MotionHandoffIsComplete&&(null===(i=window.MotionHasOptimisedAnimation)||void 0===i?void 0:i.call(window,d)));return Al((()=>{f&&(f.updateFeatures(),Tl.render(f.render),h.current&&f.animationState&&f.animationState.animateChanges())})),(0,xu.useEffect)((()=>{f&&(!h.current&&f.animationState&&f.animationState.animateChanges(),h.current=!1,jl||(jl=!0,queueMicrotask(Il)))})),f}function Il(){window.MotionHandoffIsComplete=!0}function Ll(t){if(t)return!1!==t.options.allowProjection?t.projection:Ll(t.parent)}function Ml(t,e,n){return(0,xu.useCallback)((r=>{r&&t.mount&&t.mount(r),e&&(r?e.mount(r):e.unmount()),n&&("function"==typeof n?n(r):Ol(n)&&(n.current=r))}),[e])}function Nl(t){const{initial:e,animate:n}=function(t,e){if(po(t)){const{initial:e,animate:n}=t;return{initial:!1===e||co(e)?e:void 0,animate:co(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,(0,xu.useContext)(kl));return(0,xu.useMemo)((()=>({initial:e,animate:n})),[Rl(e),Rl(n)])}function Rl(t){return Array.isArray(t)?t.join(" "):t}const Fl=(0,xu.createContext)({}),Vl=Symbol.for("motionComponentSymbol");function Dl({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:r,Component:o}){t&&wc(t);const i=(0,xu.forwardRef)((function(t,i){let a;const s={...(0,xu.useContext)(Sl),...t,layoutId:Bl(t)},{isStatic:u}=s,c=Nl(t),l=r(t,u);if(!u&&io){!function(){(0,xu.useContext)(bc).strict;0}();const t=function(t){const{drag:e,layout:n}=vo;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:(null==e?void 0:e.isEnabled(t))||(null==n?void 0:n.isEnabled(t))?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}(s);a=t.MeasureLayout,c.visualElement=Cl(o,l,s,e,t.ProjectionNode)}return(0,gc.jsxs)(kl.Provider,{value:c,children:[a&&c.visualElement?(0,gc.jsx)(a,{visualElement:c.visualElement,...s}):null,n(o,t,Ml(l,c.visualElement,i),l,u,c.visualElement)]})}));return i[Vl]=o,i}function Bl({layoutId:t}){const e=(0,xu.useContext)(Fl).id;return e&&void 0!==t?e+"-"+t:t}function Gl(t){const e=Zr(t)?t.get():t;return Mr(e)?e.toValue():e}const Ul=t=>(e,n)=>{const r=(0,xu.useContext)(kl),o=(0,xu.useContext)(xl),i=()=>function({applyWillChange:t=!1,scrapeMotionValuesFromProps:e,createRenderState:n,onMount:r},o,i,a,s){const u={latestValues:zl(o,i,a,!s&&t,e),renderState:n()};return r&&(u.mount=t=>r(o,t,u)),u}(t,e,r,o,n);return n?i():function(t){const e=(0,xu.useRef)(null);return null===e.current&&(e.current=t()),e.current}(i)};function Hl(t,e){const n=Xr(e);n&&Rr(t,n)}function $l(t,e,n){const r=Array.isArray(e)?e:[e];for(let e=0;e<r.length;e++){const o=Hr(t,r[e]);if(o){const{transitionEnd:t,transition:e,...r}=o;n(r,t)}}}function zl(t,e,n,r,o){var i;const a={},s=[],u=r&&void 0===(null===(i=t.style)||void 0===i?void 0:i.willChange),c=o(t,{});for(const t in c)a[t]=Gl(c[t]);let{initial:l,animate:f}=t;const p=po(t),d=ho(t);e&&d&&!p&&!1!==t.inherit&&(void 0===l&&(l=e.initial),void 0===f&&(f=e.animate));let h=!!n&&!1===n.initial;h=h||!1===l;const y=h?f:l;return y&&"boolean"!=typeof y&&!uo(y)&&$l(t,y,((t,e)=>{for(const e in t){let n=t[e];if(Array.isArray(n)){n=n[h?n.length-1:0]}null!==n&&(a[e]=n)}for(const t in e)a[t]=e[t]})),u&&(f&&!1!==l&&!uo(f)&&$l(t,f,(t=>{for(const e in t)Hl(s,e)})),s.length&&(a.willChange=s.join(","))),a}const Wl=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),ql=()=>({...Wl(),attrs:{}}),Yl={useVisualState:Ul({scrapeMotionValuesFromProps:oo,createRenderState:ql,onMount:(t,e,{renderState:n,latestValues:r})=>{jt.read((()=>{try{n.dimensions="function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch(t){n.dimensions={x:0,y:0,width:0,height:0}}})),jt.render((()=>{jo(n,r,Mo(e.tagName),t.transformTemplate),Lo(e,n)}))}})},Xl={useVisualState:Ul({applyWillChange:!0,scrapeMotionValuesFromProps:ro,createRenderState:Wl})};function Kl(t,e,n){for(const r in e)Zr(e[r])||no(r,n)||(t[r]=e[r])}function Zl(t,e){const n={};return Kl(n,t.style||{},t),Object.assign(n,function({transformTemplate:t},e){return(0,xu.useMemo)((()=>{const n=Wl();return To(n,e,t),Object.assign({},n.vars,n.style)}),[e])}(t,e)),n}function Ql(t,e){const n={},r=Zl(t,e);return t.drag&&!1!==t.dragListener&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=!0===t.drag?"none":"pan-"+("x"===t.drag?"y":"x")),void 0===t.tabIndex&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const Jl=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function tf(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Jl.has(t)}let ef=t=>!tf(t);try{(nf=require("@emotion/is-prop-valid").default)&&(ef=t=>t.startsWith("on")?!tf(t):nf(t))}catch(V){}var nf;function rf(t,e,n,r){const o=(0,xu.useMemo)((()=>{const n=ql();return jo(n,e,Mo(r),t.transformTemplate),{...n.attrs,style:{...n.style}}}),[e]);if(t.style){const e={};Kl(e,t.style,t),o.style={...e,...o.style}}return o}function of(t=!1){return(e,n,r,{latestValues:o},i)=>{const a=(tl(e)?rf:Ql)(n,o,i,e),s=function(t,e,n){const r={};for(const o in t)"values"===o&&"object"==typeof t.values||(ef(o)||!0===n&&tf(o)||!e&&!tf(o)||t.draggable&&o.startsWith("onDrag"))&&(r[o]=t[o]);return r}(n,"string"==typeof e,t),u=e!==xu.Fragment?{...s,...a,ref:r}:{},{children:c}=n,l=(0,xu.useMemo)((()=>Zr(c)?c.get():c),[c]);return(0,xu.createElement)(e,{...u,children:l})}}function af(t,e){return function(n,{forwardMotionProps:r}={forwardMotionProps:!1}){return Dl({...tl(n)?Yl:Xl,preloadedFeatures:t,useRender:of(r),createVisualElement:e,Component:n})}}const sf=_l(af());function uf(t){return uf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},uf(t)}function cf(){return cf=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},cf.apply(null,arguments)}function lf(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */lf=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",d="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==uf(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function T(e,n,r){var o=p;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:d,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(uf(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function ff(t){return function(t){if(Array.isArray(t))return hf(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||df(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pf(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||df(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function df(t,e){if(t){if("string"==typeof t)return hf(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hf(t,e):void 0}}function hf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var yf=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};function vf(t){var e=this,n=t.image,r=t.state,o=t.onAnimationEnd,i=(0,xu.useRef)(null),a=pf((0,xu.useState)(null),2),s=a[0],u=a[1],c=pf((0,xu.useState)({style:{}}),2),l=c[0],f=c[1],p=pf((0,xu.useState)(null),2),h=p[0],y=p[1],v=pf((0,xu.useState)([]),2)[1],m=pf((0,xu.useState)(0),2),g=m[0],b=m[1],w=$u().game;(0,xu.useEffect)((function(){n.setScope(i),n.events.emit(ji.EventTypes["event:image.mount"]);var t=n.events.onEvents([].concat(ff([ji.EventTypes["event:image.show"],ji.EventTypes["event:image.hide"],ji.EventTypes["event:image.applyTransform"]].map((function(t){return{type:t,listener:n.events.on(t,(function(t){return yf(e,void 0,void 0,lf().mark((function e(){return lf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i.current){e.next=2;break}throw new Error("scope not ready");case 2:return S(t.propToCSS(r,n.state)),u(t),r.logger.debug("transform",t,t.propToCSS(r,n.state)),e.next=7,t.animate({scope:i,image:n},r,n.state,(function(e){n.state=d(n.state,e),f({style:t.propToCSS(r,n.state)}),u(null),r.logger.debug("transform end",t,t.propToCSS(r,n.state),n.state),o&&o()}));case 7:return e.abrupt("return",!0);case 8:case"end":return e.stop()}}),e)})))}))}}))),[{type:ji.EventTypes["event:image.init"],listener:n.events.on(ji.EventTypes["event:image.init"],(function(){return yf(e,void 0,void 0,lf().mark((function t(){return lf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.toTransform().animate({scope:i,image:n},r,n.state,(function(t){n.state=d(n.state,t),f({style:n.toTransform().propToCSS(r,n.state)})}));case 2:case"end":return t.stop()}}),t)})))}))}])),a=n.events.onEvents([{type:ji.EventTypes["event:image.applyTransition"],listener:n.events.on(ji.EventTypes["event:image.applyTransition"],(function(t){return t&&t.controller&&(t.controller.complete(),r.logger.warn("processing transform not completed")),y(t),t?new Promise((function(e){var n=t.events.onEvents([{type:al.update,listener:t.events.on(al.update,(function(t){v(t)}))},{type:al.end,listener:t.events.on(al.end,(function(){y(null),r.logger.debug("image transition end",t)}))},{type:al.start,listener:t.events.on(al.start,(function(){r.logger.debug("image transition start",t)}))}]);t.start((function(){n.cancel(),e()}))})):(r.logger.warn("transition not set"),Promise.resolve())}))},{type:ji.EventTypes["event:image.flushComponent"],listener:n.events.on(ji.EventTypes["event:image.flushComponent"],(function(){return yf(e,void 0,void 0,lf().mark((function t(){return lf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",!0);case 1:case"end":return t.stop()}}),t)})))}))}]);return S(n.toTransform().propToCSS(r,n.state)),n.events.emit(ji.EventTypes["event:image.ready"],i),function(){t.cancel(),a.cancel(),n.events.emit(ji.EventTypes["event:image.unmount"])}}),[]),(0,xu.useEffect)((function(){b(performance.now())}),[]),(0,xu.useEffect)((function(){var t=r.events.onEvents([{type:_u.EventTypes["event:state.player.skip"],listener:r.events.on(_u.EventTypes["event:state.player.skip"],(function(){s&&s.getControl()&&(s.getControl().complete(),s.setControl(null),r.logger.debug("transform skip")),h&&h.controller&&(h.controller.complete(),y(null),r.logger.debug("transition skip"))}))}]);return function(){t.cancel()}}),[h,s]);var _=function(){var t=performance.now()-g,e=w.config.elements.img.slowLoadThreshold;t>e&&w.config.elements.img.slowLoadWarning&&r.logger.warn("NarraLeaf-React","Image took ".concat(t,"ms to load, which exceeds the threshold of ").concat(e,"ms. ")+"Consider enable cache for the image, so Preloader can preload it before it's used. To disable this warning, set `elements.img.slowLoadWarning` to false in the game config.")};function S(t){if(s&&s.getControl()&&(console.warn("processing transform not completed"),s.getControl().complete(),s.setControl(null)),!i.current)throw new Error("scope not ready");t instanceof hi?Object.assign(i.current.style,t.propToCSS(r,n.state)):Object.assign(i.current.style,t)}var k={src:Aa.staticImageDataToSrc(n.state.src),style:Object.assign({},w.config.app.debug?{border:"1px solid red"}:{})};return Au().createElement(Ru,{className:"absolute overflow-hidden"},Au().createElement(sf.div,cf({layout:!0,ref:function(t){return i.current=t},className:"absolute"},d({style:{opacity:0}},l)),h?Au().createElement(Au().Fragment,null,h.toElementProps().map((function(t,e,n){var r=d(k,t,{style:{transform:"translate(0%, -50%)"}});return Au().createElement(sf.img,cf({className:"absolute",key:e===n.length-1?"last":e,alt:r.alt},r,{onLoad:_,layout:!0}))}))):Au().createElement(sf.img,cf({alt:"image",key:"last"},d(k,{}),{onLoad:_,layout:!0})),(n.events.emit(ji.EventTypes["event:image.flush"]),null)))}function mf(t){return mf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mf(t)}function gf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,bf(r.key),r)}}function bf(t){var e=function(t,e){if("object"!=mf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=mf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==mf(e)?e:e+""}var wf=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.preloaded=[],this.events=new m}return function(t,e,n){return e&&gf(t.prototype,e),n&&gf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"add",value:function(e){return this.has(this.getSrc(e))||(this.preloaded.push(e),this.events.emit(t.EventTypes["event:preloaded.add"],e),this.events.emit(t.EventTypes["event:preloaded.change"])),this}},{key:"get",value:function(t){var e=this;return this.preloaded.find((function(n){return e.getSrc(n)===t}))}},{key:"has",value:function(t){var e=this;return Array.isArray(t)?t.every((function(t){return e.has(t)})):this.preloaded.some((function(n){return e.getSrc(n)===t}))}},{key:"remove",value:function(e){var n=this;if(Array.isArray(e)){var r=e.map((function(t){return n.getSrc(t)}));return this.preloaded=this.preloaded.filter((function(t){return!r.includes(n.getSrc(t))})),this}var o=this.getSrc(e);return this.preloaded=this.preloaded.filter((function(t){return n.getSrc(t)!==o})),this.events.emit(t.EventTypes["event:preloaded.remove"],e),this.events.emit(t.EventTypes["event:preloaded.change"]),this}},{key:"clear",value:function(){return this.preloaded=[],this}},{key:"getSrc",value:function(t){return"string"==typeof t?t:"image"===t.type?Aa.srcToString(t.src.state.src):"video"===t.type?t.src:"audio"===t.type?t.src.getSrc():""}}])}();function _f(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Sf(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Sf(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Sf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}wf.EventTypes={"event:preloaded.add":"event:preloaded.add","event:preloaded.remove":"event:preloaded.remove","event:preloaded.change":"event:preloaded.change","event:preloaded.mount":"event:preloaded.mount","event:preloaded.ready":"event:preloaded.ready"};var kf=(0,xu.createContext)(null);function xf(t){var e=t.children,n=_f((0,xu.useState)(new wf),1)[0];return Au().createElement(Au().Fragment,null,Au().createElement(kf.Provider,{value:{preloaded:n}},e))}function Af(){if(!kf)throw new Error("usePreloaded must be used within a PreloadedProvider");return(0,xu.useContext)(kf)}function Tf(t){return function(t){if(Array.isArray(t))return Ef(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Ef(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ef(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ef(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Of(t){var e=t.state,n=Af().preloaded,r=e.getLastScene();return(0,xu.useEffect)((function(){var t,r;if("undefined"!=typeof window){var o=null===(t=e.getLastScene())||void 0===t?void 0:t.srcManager,i=(null===(r=e.getLastScene())||void 0===r?void 0:r.srcManager.future)||[],a=[].concat(Tf(o?o.src:[]),Tf(i.map((function(t){return t.src})).flat(2))),s={image:new Set,audio:new Set,video:new Set};a.forEach((function(t){t.type===Cs.SrcTypes.image?s.image.add(t.src):t.type===Cs.SrcTypes.audio?s.audio.add(t.src):t.type===Cs.SrcTypes.video&&s.video.add(t.src)})),e.logger.debug("Preloading",s,i),n.preloaded=n.preloaded.filter((function(t){if(t.type===Cs.SrcTypes.audio){var e=s[t.type].has(t.src);return e||(e=Array.from(s[t.type]).some((function(e){return n.getSrc(t)===n.getSrc(e.config.src)}))),e}if(t.type===Cs.SrcTypes.image)return s[t.type].has(t.src);var r=n.getSrc(t);return s[t.type].has(r)}));var u=[];return s.image.forEach((function(t){var r=new Image;r.src=Aa.srcToString(t.state.src),r.onload=function(){e.logger.debug("Image loaded",t.state.src)},u.push(r),n.add({type:"image",src:t})})),Promise.all([]).then((function(){e.logger.log("Preloaded","Preloaded ".concat(s.image.size," images")),n.events.emit(wf.EventTypes["event:preloaded.ready"]),e.events.emit(_u.EventTypes["event:state.preload.loaded"])})),s.audio.forEach((function(t){t.$getHowl()||t.$setHowl(new(e.getHowl())({src:t.config.src,loop:t.config.loop,volume:t.config.volume,autoplay:!1,preload:!0}))})),n.events.emit(wf.EventTypes["event:preloaded.mount"]),function(){u.forEach((function(t){t.onload=null})),e.events.emit(_u.EventTypes["event:state.preload.unmount"]),e.logger.debug("Preload unmounted")}}console.warn("Window is not supported in this environment")}),[r]),null}function Pf(t){var e=t.state,n=$u().game;return(0,xu.useEffect)((function(){if(window){var t,r,o,i=(t=function(t){n.config.player.skipKey.includes(t.key)&&e.events.emit(_u.EventTypes["event:state.player.skip"])},r=n.config.player.skipInterval,o=0,function(){var e=Date.now();if(!(e-o<r))return o=e,t.apply(void 0,arguments)});return window.addEventListener("keydown",i),function(){window.removeEventListener("keydown",i)}}e.logger.warn("NarraLeaf-React: Announcer","Cannot listen to window events")}),[]),Au().createElement(Au().Fragment,null)}var jf=o(33);function Cf(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return If(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?If(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function If(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Lf(t,e){return t.handle(e)}function Mf(t){var e=t.story,n=t.width,r=t.height,o=t.className,i=t.onReady,a=t.onEnd,s=Cf((0,xu.useReducer)((function(t){return t+1}),0),2)[1],u=$u().game,c=Cf((0,xu.useReducer)(Lf,new _u(u,{update:s,forceUpdate:function(){l.logger.warn("Player","force update"),(0,jf.flushSync)((function(){s()}))},next:y,dispatch:function(t){return f(t)}})),2),l=c[0],f=c[1],p=u.config.elements.say.use,d=u.config.elements.menu.use;function y(){for(var t=!1;!t;){var e=u.getLiveGame().next(l);if(!e)break;if(h.isAwaitable(e)){t=!0;break}f(e)}l.stage.update()}(0,xu.useEffect)((function(){return u.getLiveGame().setGameState(l).loadStory(e),function(){u.getLiveGame().setGameState(void 0)}}),[u]),(0,xu.useEffect)((function(){var t=!1,e=Promise.resolve().then((function(){t=!0,i&&i({game:u,gameState:l,liveGame:u.getLiveGame(),storable:u.getLiveGame().getStorable()});var e=l.getLastScene(),n=[];e?n.push({type:"event:scene.mount",listener:e.events.once("event:scene.mount",(function(){l.stage.next()}))}):l.stage.next();var r=l.events.onEvents([{type:_u.EventTypes["event:state.end"],listener:function(){a&&a({game:u,gameState:l,liveGame:u.getLiveGame(),storable:u.getLiveGame().getStorable()})}}]),o=l.events.onEvents([{type:_u.EventTypes["event:state.player.skip"],listener:function(){u.getLiveGame().abortAwaiting(),y()}}]);return l.stage.update(),function(){e&&n.forEach((function(t){e.events.off(t.type,t.listener)})),r.cancel(),o.cancel()}}));return function(){t&&e.then((function(t){return t()}))}}),[]),l.events.emit(_u.EventTypes["event:state.player.flush"]);var v=n||u.config.player.width,m=r||u.config.player.height;return Au().createElement(nl,null,Au().createElement("div",{style:{width:"number"==typeof v?"".concat(v,"px"):v,height:"number"==typeof m?"".concat(m,"px"):m},className:ku(o,"__narraleaf_content-player")},Au().createElement(il,{className:ku("flex-grow overflow-auto")},Au().createElement(Ru,{className:"relative"},Au().createElement(Of,{state:l}),Au().createElement(Nf,{onLoaded:function(){l.stage.update(),e&&y()},state:l},Au().createElement(Pf,{state:l}),l.getSceneElements().map((function(t){var e=t.scene,n=t.ele;return Au().createElement(wl,{key:"scene-"+e.getId(),state:l,scene:e},n.images.map((function(t){return Au().createElement(vf,{key:"image-"+t.getId(),image:t,state:l})})),n.texts.map((function(t){var e=t.action,n=t.onClick;return Au().createElement(p,{state:l,key:"say-"+e.id,action:e,onClick:function(){n(),y()}})})),n.menus.map((function(t,e){return Au().createElement("div",{key:"menu-"+e},Au().createElement(d,{state:l,prompt:t.action.prompt,choices:t.action.choices,afterChoose:function(e){t.onClick(e),y()}}))})))})))))))}function Nf(t){var e=t.children,n=t.onLoaded,r=t.state,o=Af().preloaded,i=Cf((0,xu.useState)(!1),2),a=i[0],s=i[1];return(0,xu.useEffect)((function(){var t=o.events.on(wf.EventTypes["event:preloaded.ready"],(function(){s(!0),n()})),e=r.events.on(_u.EventTypes["event:state.preload.unmount"],(function(){s(!1)}));return function(){o.events.off(wf.EventTypes["event:preloaded.ready"],t),r.events.off(_u.EventTypes["event:state.preload.unmount"],e)}}),[a]),Au().createElement(Au().Fragment,null,a?e:null)}function Rf(t){var e=t.children,n=t.game;return Au().createElement(Au().Fragment,null,Au().createElement(Lu,null,Au().createElement(Hu,{game:n},Au().createElement(xf,null,e))))}function Ff(t){return Ff="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ff(t)}function Vf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Df(r.key),r)}}function Df(t){var e=function(t,e){if("object"!=Ff(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ff(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ff(e)?e:e+""}var Bf=function(){return function(t,e,n){return e&&Vf(t.prototype,e),n&&Vf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.events=new m}),[{key:"start",value:function(t){throw new Error("Method not implemented.")}},{key:"toElementProps",value:function(){throw new Error("Method not implemented.")}},{key:"setSrc",value:function(t){throw new Error("Method not implemented.")}},{key:"requestAnimation",value:function(t,e,n){var r=this,o=t.start,i=t.end,a=t.duration,s=e.onComplete,u=e.onUpdate;return this.events.emit(al.start,null),this.controller=ei(o,i,Object.assign({duration:a/1e3,onUpdate:function(t){u&&u(t),r.events.emit(al.update,r.toElementProps())},onComplete:function(){r.controller=void 0,r.events.emit(al.end,null),s&&s()}},n)),this.controller}},{key:"copy",value:function(){throw new Error("Method not implemented.")}}])}();function Gf(t){return Gf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gf(t)}function Uf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Hf(r.key),r)}}function Hf(t){var e=function(t,e){if("object"!=Gf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Gf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Gf(e)?e:e+""}function $f(t,e,n){return e=Wf(e),function(t,e){if(e&&("object"==Gf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,zf()?Reflect.construct(e,n||[],Wf(t).constructor):e.apply(t,n))}function zf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(zf=function(){return!!t})()}function Wf(t){return Wf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wf(t)}function qf(t,e){return qf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},qf(t,e)}var Yf=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,r=arguments.length>1?arguments[1]:void 0;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=$f(this,e)).state={opacity:1},t.duration=n,r&&(t.src="string"==typeof r?r:r instanceof Us?Aa.backgroundToSrc(r.config.background):Aa.staticImageDataToSrc(r)),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&qf(t,e)}(e,t),function(t,e,n){return e&&Uf(t.prototype,e),n&&Uf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){this.src=t}},{key:"start",value:function(t){var n=this;this.state.opacity=e.Frames[0],this.requestAnimation({start:e.Frames[0],end:e.Frames[1],duration:this.duration},{onComplete:function(){t&&t(),n.state.opacity=e.Frames[1]},onUpdate:function(t){n.state.opacity=t}})}},{key:"toElementProps",value:function(){return[{style:{opacity:1}},{style:{opacity:this.state.opacity},src:this.src}]}},{key:"copy",value:function(){return new e(this.duration,this.src)}}])}(Bf);function Xf(t){return Xf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xf(t)}function Kf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Zf(r.key),r)}}function Zf(t){var e=function(t,e){if("object"!=Xf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Xf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Xf(e)?e:e+""}function Qf(t,e,n){return e=tp(e),function(t,e){if(e&&("object"==Xf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Jf()?Reflect.construct(e,n||[],tp(t).constructor):e.apply(t,n))}function Jf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Jf=function(){return!!t})()}function tp(t){return tp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},tp(t)}function ep(t,e){return ep=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ep(t,e)}Yf.Frames=[0,1];var np=function(t){function e(t,n){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=arguments.length>3?arguments[3]:void 0;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(r=Qf(this,e)).state={opacity:0,transform:""},r.duration=o,r.direction=t,r.offset=n,i&&(r.src="string"==typeof i?i:i instanceof Us?Aa.backgroundToSrc(i.config.background):Aa.staticImageDataToSrc(i)),r.__stack=g(),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ep(t,e)}(e,t),function(t,e,n){return e&&Kf(t.prototype,e),n&&Kf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){this.src=t}},{key:"start",value:function(t){var e=this;if(!this.src)throw new Error("src is required, but not provided\nat:\n"+this.__stack);this.state.opacity=0,this.state.transform=this.getInitialTransform(),this.requestAnimation({start:0,end:1,duration:this.duration},{onComplete:t,onUpdate:function(t){e.state.opacity=t,e.state.transform=e.getTransform(t)}})}},{key:"toElementProps",value:function(){return[{style:{opacity:1}},{style:{opacity:this.state.opacity,transform:this.state.transform},src:this.src}]}},{key:"copy",value:function(){return new e(this.direction,this.offset,this.duration,this.src)}},{key:"getInitialTransform",value:function(){switch(this.direction){case"left":return"translateX(-".concat(this.offset,"px)");case"right":return"translateX(".concat(this.offset,"px)");case"top":return"translateY(-".concat(this.offset,"px)");case"bottom":return"translateY(".concat(this.offset,"px)");default:return""}}},{key:"getTransform",value:function(t){switch(this.direction){case"left":return"translateX(".concat((1-t)*-this.offset,"px)");case"right":return"translateX(".concat((1-t)*this.offset,"px)");case"top":return"translateY(".concat((1-t)*-this.offset,"px)");case"bottom":return"translateY(".concat((1-t)*this.offset,"px)");default:return""}}}])}(Bf);function rp(t){return rp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rp(t)}function op(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ip(r.key),r)}}function ip(t){var e=function(t,e){if("object"!=rp(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=rp(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==rp(e)?e:e+""}function ap(t,e,n){return e=up(e),function(t,e){if(e&&("object"==rp(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,sp()?Reflect.construct(e,n||[],up(t).constructor):e.apply(t,n))}function sp(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(sp=function(){return!!t})()}function up(t){return up=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},up(t)}function cp(t,e){return cp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},cp(t,e)}var lp=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,r=arguments.length>1?arguments[1]:void 0;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=ap(this,e)).state={opacity:0},t.duration=n,r&&(t.src="string"==typeof r?r:r instanceof Us?Aa.backgroundToSrc(r.config.background):Aa.staticImageDataToSrc(r)),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&cp(t,e)}(e,t),function(t,e,n){return e&&op(t.prototype,e),n&&op(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){this.src=t}},{key:"start",value:function(t){var n=this;this.state.opacity=e.Frames[0],this.requestAnimation({start:e.Frames[0],end:e.Frames[1],duration:this.duration},{onComplete:function(){n.state.opacity=e.Frames[1],t&&t()},onUpdate:function(t){n.state.opacity=t}})}},{key:"toElementProps",value:function(){return[{style:{opacity:this.state.opacity}},{style:{opacity:1-this.state.opacity},src:this.src}]}},{key:"copy",value:function(){return new e(this.duration,this.src)}}])}(Bf);lp.Frames=[1,0]})(),i})()));