narraleaf-react 0.1.5 → 0.1.7

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.
package/dist/main.js CHANGED
@@ -1,4 +1,4 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],e):"object"==typeof exports?exports.NarraleafReact=e(require("react"),require("react-dom")):t.NarraleafReact=e(t.React,t.ReactDOM)}(this,((t,e)=>(()=>{var n={587:(t,e,n)=>{"use strict";n.d(e,{A:()=>s});var r=n(601),o=n.n(r),i=n(314),a=n.n(i)()(o());a.push([t.id,"/*\n! tailwindcss v3.4.11 | MIT License | https://tailwindcss.com\n*//*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n*/\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: #e5e7eb; /* 2 */\n}\n\n::before,\n::after {\n --tw-content: '';\n}\n\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user's configured `sans` font-family by default.\n5. Use the user's configured `sans` font-feature-settings by default.\n6. Use the user's configured `sans` font-variation-settings by default.\n7. Disable tap highlights on iOS\n*/\n\nhtml,\n:host {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n -moz-tab-size: 4; /* 3 */\n -o-tab-size: 4;\n tab-size: 4; /* 3 */\n font-family: ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"; /* 4 */\n font-feature-settings: normal; /* 5 */\n font-variation-settings: normal; /* 6 */\n -webkit-tap-highlight-color: transparent; /* 7 */\n}\n\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n margin: 0; /* 1 */\n line-height: inherit; /* 2 */\n}\n\n/*\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n3. Ensure horizontal rules are visible by default.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n/*\nRemove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\nReset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n1. Use the user's configured `mono` font-family by default.\n2. Use the user's configured `mono` font-feature-settings by default.\n3. Use the user's configured `mono` font-variation-settings by default.\n4. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace; /* 1 */\n font-feature-settings: normal; /* 2 */\n font-variation-settings: normal; /* 3 */\n font-size: 1em; /* 4 */\n}\n\n/*\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\nPrevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-feature-settings: inherit; /* 1 */\n font-variation-settings: inherit; /* 1 */\n font-size: 100%; /* 1 */\n font-weight: inherit; /* 1 */\n line-height: inherit; /* 1 */\n letter-spacing: inherit; /* 1 */\n color: inherit; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 3 */\n}\n\n/*\nRemove the inheritance of text transform in Edge and Firefox.\n*/\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Remove default button styles.\n*/\n\nbutton,\ninput:where([type='button']),\ninput:where([type='reset']),\ninput:where([type='submit']) {\n -webkit-appearance: button; /* 1 */\n background-color: transparent; /* 2 */\n background-image: none; /* 2 */\n}\n\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n outline: auto;\n}\n\n/*\nRemove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type='search'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/*\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to `inherit` in Safari.\n*/\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\nRemoves the default spacing and border for appropriate elements.\n*/\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol,\nul,\nmenu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n/*\nReset default styling for dialogs.\n*/\ndialog {\n padding: 0;\n}\n\n/*\nPrevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user's configured gray 400 color.\n*/\n\ninput::-moz-placeholder, textarea::-moz-placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\ninput::placeholder,\ntextarea::placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\n/*\nSet the default cursor for buttons.\n*/\n\nbutton,\n[role=\"button\"] {\n cursor: pointer;\n}\n\n/*\nMake sure disabled buttons don't get the pointer cursor.\n*/\n:disabled {\n cursor: default;\n}\n\n/*\n1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/* Make elements with the HTML hidden attribute stay hidden by default */\n[hidden] {\n display: none;\n}\n\n*, ::before, ::after {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n --tw-contain-size: ;\n --tw-contain-layout: ;\n --tw-contain-paint: ;\n --tw-contain-style: ;\n}\n\n::backdrop {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n --tw-contain-size: ;\n --tw-contain-layout: ;\n --tw-contain-paint: ;\n --tw-contain-style: ;\n}\n.\\!container {\n width: 100% !important;\n}\n.container {\n width: 100%;\n}\n@media (min-width: 640px) {\n\n .\\!container {\n max-width: 640px !important;\n }\n\n .container {\n max-width: 640px;\n }\n}\n@media (min-width: 768px) {\n\n .\\!container {\n max-width: 768px !important;\n }\n\n .container {\n max-width: 768px;\n }\n}\n@media (min-width: 1024px) {\n\n .\\!container {\n max-width: 1024px !important;\n }\n\n .container {\n max-width: 1024px;\n }\n}\n@media (min-width: 1280px) {\n\n .\\!container {\n max-width: 1280px !important;\n }\n\n .container {\n max-width: 1280px;\n }\n}\n@media (min-width: 1536px) {\n\n .\\!container {\n max-width: 1536px !important;\n }\n\n .container {\n max-width: 1536px;\n }\n}\n.static {\n position: static;\n}\n.absolute {\n position: absolute;\n}\n.relative {\n position: relative;\n}\n.inset-0 {\n inset: 0px;\n}\n.bottom-0 {\n bottom: 0px;\n}\n.left-0 {\n left: 0px;\n}\n.top-0 {\n top: 0px;\n}\n.z-10 {\n z-index: 10;\n}\n.z-20 {\n z-index: 20;\n}\n.mt-2 {\n margin-top: 0.5rem;\n}\n.mt-4 {\n margin-top: 1rem;\n}\n.block {\n display: block;\n}\n.inline-block {\n display: inline-block;\n}\n.flex {\n display: flex;\n}\n.hidden {\n display: none;\n}\n.h-full {\n height: 100%;\n}\n.w-1\\/2 {\n width: 50%;\n}\n.w-\\[calc\\(100\\%-40px\\)\\] {\n width: calc(100% - 40px);\n}\n.w-full {\n width: 100%;\n}\n.min-w-full {\n min-width: 100%;\n}\n.flex-grow {\n flex-grow: 1;\n}\n.transform {\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.resize {\n resize: both;\n}\n.flex-col {\n flex-direction: column;\n}\n.items-start {\n align-items: flex-start;\n}\n.items-center {\n align-items: center;\n}\n.justify-center {\n justify-content: center;\n}\n.justify-between {\n justify-content: space-between;\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.whitespace-pre {\n white-space: pre;\n}\n.whitespace-pre-wrap {\n white-space: pre-wrap;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.rounded-lg {\n border-radius: 0.5rem;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.rounded-br-md {\n border-bottom-right-radius: 0.375rem;\n}\n.border {\n border-width: 1px;\n}\n.border-2 {\n border-width: 2px;\n}\n.border-black {\n --tw-border-opacity: 1;\n border-color: rgb(0 0 0 / var(--tw-border-opacity));\n}\n.bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity));\n}\n.bg-cover {\n background-size: cover;\n}\n.bg-center {\n background-position: center;\n}\n.p-2 {\n padding: 0.5rem;\n}\n.p-4 {\n padding: 1rem;\n}\n.text-left {\n text-align: left;\n}\n.text-center {\n text-align: center;\n}\n.align-bottom {\n vertical-align: bottom;\n}\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.font-bold {\n font-weight: 700;\n}\n.italic {\n font-style: italic;\n}\n.text-black {\n --tw-text-opacity: 1;\n color: rgb(0 0 0 / var(--tw-text-opacity));\n}\n.text-red-700 {\n --tw-text-opacity: 1;\n color: rgb(185 28 28 / var(--tw-text-opacity));\n}\n.shadow-md {\n --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);\n --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.outline {\n outline-style: solid;\n}\n.filter {\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n.\\!transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter !important;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter !important;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter !important;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important;\n transition-duration: 150ms !important;\n}\n.transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n.__narraleaf_content-player * {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n\n.__narraleaf_content-player img {\n pointer-events: none;\n -webkit-user-drag: none;\n -webkit-user-select: none;\n}\n",""]);const s=a},314:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",r=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),r&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),r&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,r,o,i){"string"==typeof t&&(t=[[null,t,void 0]]);var a={};if(r)for(var s=0;s<this.length;s++){var u=this[s][0];null!=u&&(a[u]=!0)}for(var c=0;c<t.length;c++){var l=[].concat(t[c]);r&&a[l[0]]||(void 0!==i&&(void 0===l[5]||(l[1]="@layer".concat(l[5].length>0?" ".concat(l[5]):""," {").concat(l[1],"}")),l[5]=i),n&&(l[2]?(l[1]="@media ".concat(l[2]," {").concat(l[1],"}"),l[2]=n):l[2]=n),o&&(l[4]?(l[1]="@supports (".concat(l[4],") {").concat(l[1],"}"),l[4]=o):l[4]="".concat(o)),e.push(l))}},e}},601:t=>{"use strict";t.exports=function(t){return t[1]}},196:(t,e,n)=>{var r;
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],e):"object"==typeof exports?exports.NarraleafReact=e(require("react"),require("react-dom")):t.NarraleafReact=e(t.React,t.ReactDOM)}(this,((t,e)=>(()=>{var n={587:(t,e,n)=>{"use strict";n.d(e,{A:()=>s});var r=n(601),o=n.n(r),i=n(314),a=n.n(i)()(o());a.push([t.id,"/*\n! tailwindcss v3.4.11 | MIT License | https://tailwindcss.com\n*//*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n*/\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: #e5e7eb; /* 2 */\n}\n\n::before,\n::after {\n --tw-content: '';\n}\n\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user's configured `sans` font-family by default.\n5. Use the user's configured `sans` font-feature-settings by default.\n6. Use the user's configured `sans` font-variation-settings by default.\n7. Disable tap highlights on iOS\n*/\n\nhtml,\n:host {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n -moz-tab-size: 4; /* 3 */\n -o-tab-size: 4;\n tab-size: 4; /* 3 */\n font-family: ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"; /* 4 */\n font-feature-settings: normal; /* 5 */\n font-variation-settings: normal; /* 6 */\n -webkit-tap-highlight-color: transparent; /* 7 */\n}\n\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n margin: 0; /* 1 */\n line-height: inherit; /* 2 */\n}\n\n/*\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n3. Ensure horizontal rules are visible by default.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n/*\nRemove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\nReset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n1. Use the user's configured `mono` font-family by default.\n2. Use the user's configured `mono` font-feature-settings by default.\n3. Use the user's configured `mono` font-variation-settings by default.\n4. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace; /* 1 */\n font-feature-settings: normal; /* 2 */\n font-variation-settings: normal; /* 3 */\n font-size: 1em; /* 4 */\n}\n\n/*\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\nPrevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-feature-settings: inherit; /* 1 */\n font-variation-settings: inherit; /* 1 */\n font-size: 100%; /* 1 */\n font-weight: inherit; /* 1 */\n line-height: inherit; /* 1 */\n letter-spacing: inherit; /* 1 */\n color: inherit; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 3 */\n}\n\n/*\nRemove the inheritance of text transform in Edge and Firefox.\n*/\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Remove default button styles.\n*/\n\nbutton,\ninput:where([type='button']),\ninput:where([type='reset']),\ninput:where([type='submit']) {\n -webkit-appearance: button; /* 1 */\n background-color: transparent; /* 2 */\n background-image: none; /* 2 */\n}\n\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n outline: auto;\n}\n\n/*\nRemove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type='search'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/*\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to `inherit` in Safari.\n*/\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\nRemoves the default spacing and border for appropriate elements.\n*/\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol,\nul,\nmenu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n/*\nReset default styling for dialogs.\n*/\ndialog {\n padding: 0;\n}\n\n/*\nPrevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user's configured gray 400 color.\n*/\n\ninput::-moz-placeholder, textarea::-moz-placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\ninput::placeholder,\ntextarea::placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\n/*\nSet the default cursor for buttons.\n*/\n\nbutton,\n[role=\"button\"] {\n cursor: pointer;\n}\n\n/*\nMake sure disabled buttons don't get the pointer cursor.\n*/\n:disabled {\n cursor: default;\n}\n\n/*\n1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/* Make elements with the HTML hidden attribute stay hidden by default */\n[hidden] {\n display: none;\n}\n\n*, ::before, ::after {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n --tw-contain-size: ;\n --tw-contain-layout: ;\n --tw-contain-paint: ;\n --tw-contain-style: ;\n}\n\n::backdrop {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n --tw-contain-size: ;\n --tw-contain-layout: ;\n --tw-contain-paint: ;\n --tw-contain-style: ;\n}\n.\\!container {\n width: 100% !important;\n}\n.container {\n width: 100%;\n}\n@media (min-width: 640px) {\n\n .\\!container {\n max-width: 640px !important;\n }\n\n .container {\n max-width: 640px;\n }\n}\n@media (min-width: 768px) {\n\n .\\!container {\n max-width: 768px !important;\n }\n\n .container {\n max-width: 768px;\n }\n}\n@media (min-width: 1024px) {\n\n .\\!container {\n max-width: 1024px !important;\n }\n\n .container {\n max-width: 1024px;\n }\n}\n@media (min-width: 1280px) {\n\n .\\!container {\n max-width: 1280px !important;\n }\n\n .container {\n max-width: 1280px;\n }\n}\n@media (min-width: 1536px) {\n\n .\\!container {\n max-width: 1536px !important;\n }\n\n .container {\n max-width: 1536px;\n }\n}\n.pointer-events-none {\n pointer-events: none;\n}\n.static {\n position: static;\n}\n.absolute {\n position: absolute;\n}\n.relative {\n position: relative;\n}\n.inset-0 {\n inset: 0px;\n}\n.bottom-0 {\n bottom: 0px;\n}\n.left-0 {\n left: 0px;\n}\n.top-0 {\n top: 0px;\n}\n.z-10 {\n z-index: 10;\n}\n.z-20 {\n z-index: 20;\n}\n.mt-2 {\n margin-top: 0.5rem;\n}\n.mt-4 {\n margin-top: 1rem;\n}\n.block {\n display: block;\n}\n.inline-block {\n display: inline-block;\n}\n.flex {\n display: flex;\n}\n.hidden {\n display: none;\n}\n.h-full {\n height: 100%;\n}\n.w-1\\/2 {\n width: 50%;\n}\n.w-\\[calc\\(100\\%-40px\\)\\] {\n width: calc(100% - 40px);\n}\n.w-full {\n width: 100%;\n}\n.min-w-full {\n min-width: 100%;\n}\n.flex-grow {\n flex-grow: 1;\n}\n.transform {\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.resize {\n resize: both;\n}\n.flex-row {\n flex-direction: row;\n}\n.flex-col {\n flex-direction: column;\n}\n.items-start {\n align-items: flex-start;\n}\n.items-end {\n align-items: flex-end;\n}\n.items-center {\n align-items: center;\n}\n.justify-start {\n justify-content: flex-start;\n}\n.justify-end {\n justify-content: flex-end;\n}\n.justify-center {\n justify-content: center;\n}\n.justify-between {\n justify-content: space-between;\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.whitespace-pre {\n white-space: pre;\n}\n.whitespace-pre-wrap {\n white-space: pre-wrap;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.rounded-lg {\n border-radius: 0.5rem;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.rounded-br-md {\n border-bottom-right-radius: 0.375rem;\n}\n.border {\n border-width: 1px;\n}\n.border-2 {\n border-width: 2px;\n}\n.border-black {\n --tw-border-opacity: 1;\n border-color: rgb(0 0 0 / var(--tw-border-opacity));\n}\n.bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity));\n}\n.bg-cover {\n background-size: cover;\n}\n.bg-center {\n background-position: center;\n}\n.p-2 {\n padding: 0.5rem;\n}\n.p-4 {\n padding: 1rem;\n}\n.text-left {\n text-align: left;\n}\n.text-center {\n text-align: center;\n}\n.align-bottom {\n vertical-align: bottom;\n}\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.font-bold {\n font-weight: 700;\n}\n.italic {\n font-style: italic;\n}\n.text-black {\n --tw-text-opacity: 1;\n color: rgb(0 0 0 / var(--tw-text-opacity));\n}\n.text-red-700 {\n --tw-text-opacity: 1;\n color: rgb(185 28 28 / var(--tw-text-opacity));\n}\n.shadow-md {\n --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);\n --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.outline {\n outline-style: solid;\n}\n.filter {\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n.\\!transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter !important;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter !important;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter !important;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important;\n transition-duration: 150ms !important;\n}\n.transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n.__narraleaf_content-player * {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n\n.__narraleaf_content-player img {\n pointer-events: none;\n -webkit-user-drag: none;\n -webkit-user-select: none;\n}\n",""]);const s=a},314:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",r=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),r&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),r&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,r,o,i){"string"==typeof t&&(t=[[null,t,void 0]]);var a={};if(r)for(var s=0;s<this.length;s++){var u=this[s][0];null!=u&&(a[u]=!0)}for(var c=0;c<t.length;c++){var l=[].concat(t[c]);r&&a[l[0]]||(void 0!==i&&(void 0===l[5]||(l[1]="@layer".concat(l[5].length>0?" ".concat(l[5]):""," {").concat(l[1],"}")),l[5]=i),n&&(l[2]?(l[1]="@media ".concat(l[2]," {").concat(l[1],"}"),l[2]=n):l[2]=n),o&&(l[4]?(l[1]="@supports (".concat(l[4],") {").concat(l[1],"}"),l[4]=o):l[4]="".concat(o)),e.push(l))}},e}},601:t=>{"use strict";t.exports=function(t){return t[1]}},196:(t,e,n)=>{var r;
2
2
  /*!
3
3
  * howler.js v2.2.4
4
4
  * howlerjs.com
@@ -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},387:(t,e,n)=>{"use strict";t.exports=n(73)},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";o.r(i),o.d(i,{Align:()=>Ie,BaseImageTransition:()=>zc,BaseTextTransition:()=>Wc,BaseTransition:()=>Uc,Character:()=>vu,CommonPosition:()=>Ce,CommonPositionType:()=>ge,Condition:()=>Gu,Control:()=>Wa,Coord2D:()=>Le,Dissolve:()=>Oy,Fade:()=>ly,FadeIn:()=>gy,Game:()=>Hp,GameProviders:()=>ny,GameState:()=>ff,Image:()=>ts,Isolated:()=>Fp,Lambda:()=>Vu,LiveGame:()=>$p,Menu:()=>ac,Namespace:()=>Jl,Pause:()=>Us,Player:()=>ty,Say:()=>Rp,Scene:()=>bl,Script:()=>Fl,Sentence:()=>Qs,Sound:()=>Ds,SoundType:()=>Ts,Storable:()=>tf,Story:()=>Hl,Text:()=>al,Transform:()=>Ma,Utils:()=>Es,Word:()=>$s,useGame:()=>wf});var t={say:"character:say",action:"character:action",setName:"character:setName"},e={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"},n={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",initWearable:"image:initWearable"},r={action:"sound:action",play:"sound:play",stop:"sound:stop",fade:"sound:fade",setVolume:"sound:setVolume",setRate:"sound:setRate",pause:"sound:pause",resume:"sound:resume"},a={action:"control:action",do:"control:do",doAsync:"control:doAsync",any:"control:any",all:"control:all",allAsync:"control:allAsync",repeat:"control:repeat",sleep:"control:sleep"},s={action:"text:action",setText:"text:setText",show:"text:show",hide:"text:hide",applyTransform:"text:applyTransform",init:"text:init",applyTransition:"text:applyTransition",setFontSize:"text:setFontSize"};function u(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */u=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",c=i.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(t){l=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var i=e&&e.prototype instanceof b?e:b,a=Object.create(i.prototype),s=new L(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function p(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var h="suspendedStart",d="suspendedYield",y="executing",v="completed",g={};function b(){}function w(){}function _(){}var S={};l(S,a,(function(){return this}));var k=Object.getPrototypeOf,x=k&&k(k(I([])));x&&x!==n&&r.call(x,a)&&(S=x);var A=_.prototype=b.prototype=Object.create(S);function O(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(o,i,a,s){var u=p(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==m(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=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){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=j(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=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=y;var c=p(e,n,r);if("normal"===c.type){if(o=r.done?v:d,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=v,r.method="throw",r.arg=c.arg)}}}function j(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,j(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=p(o,e.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[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function P(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 L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function I(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(m(e)+" is not iterable")}return w.prototype=_,o(A,"constructor",{value:_,configurable:!0}),o(_,"constructor",{value:w,configurable:!0}),w.displayName=l(_,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,l(t,c,"GeneratorFunction")),t.prototype=Object.create(A),t},e.awrap=function(t){return{__await:t}},O(E.prototype),l(E.prototype,s,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new E(f(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(A),l(A,c,"Generator"),l(A,a,(function(){return this})),l(A,"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=I,L.prototype={constructor:L,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(C),!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,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(e,n,r){return this.delegate={iterator:I(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function c(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=y(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 l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function f(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,h(r.key),r)}}function p(t,e,n){return e&&f(t.prototype,e),n&&f(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function h(t){var e=function(t,e){if("object"!=m(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=m(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==m(e)?e:e+""}function d(t){return function(t){if(Array.isArray(t))return v(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||y(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 y(t,e){if(t){if("string"==typeof t)return v(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)?v(t,e):void 0}}function v(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 m(t){return m="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},m(t)}var g=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 b(t,e){var n,r,o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i={};for(var a in t)o(t,a)&&(i[a]=(n=t[a],r=e[a],"object"!==m(n)||null===n||Array.isArray(n)||"object"!==m(r)||null===r||Array.isArray(r)?Array.isArray(n)&&Array.isArray(r)?r&&r.length>0?d(r):d(n):void 0===n&&Array.isArray(r)?d(r):void 0===r?Array.isArray(n)?d(n):n:Array.isArray(r)?d(r):r:n.constructor!==Object||r.constructor!==Object?r||n:b(n,r)));for(var s in e)o(e,s)&&!o(i,s)&&("object"===m(e[s])&&null!==e[s]&&e[s].constructor===Object?i[s]=b({},e[s]):i[s]=e[s]);for(var u=arguments.length,c=new Array(u>2?u-2:0),l=2;l<u;l++)c[l-2]=arguments[l];if(c.length){var f=c[0],p=c.slice(1);return b.apply(void 0,[i,f].concat(d(p)))}return i}var w=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t},n=arguments.length>1?arguments[1]:void 0;l(this,t),this.solved=!1,this.listeners=[],this.receiver=e,this.skipController=n}return p(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 e,n=c(this.listeners);try{for(n.s();!(e=n.n()).done;){(0,e.value)(this.result)}}catch(t){n.e(t)}finally{n.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 _(t){var e=new WeakSet;return function t(n){if(null===n||"object"!==m(n))return n;if(!e.has(n)){if(e.add(n),Array.isArray(n)){var r,o=[],i=c(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;o.push(t(a))}}catch(t){i.e(t)}finally{i.f()}return o}var s={};for(var u in n)Object.prototype.hasOwnProperty.call(n,u)&&(s[u]=t(n[u]));return s}}(t)}function S(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"))}w.nothing=function(t){return t};var k=function(){return p((function t(){l(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(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 g(this,void 0,void 0,u().mark((function e(){var r,o,i,a,s,l,f=this;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.events[t]||(this.events[t]=[]),r=[],o=!1,i=c(this.events[t]);try{for(i.s();!(a=i.n()).done;)s=a.value,(l=s.apply(void 0,n))&&"object"===m(l)&&"function"==typeof l.then?r.push(l):o=!0}catch(t){i.e(t)}finally{i.f()}if(!o){e.next=7;break}return e.abrupt("return",void 0);case 7:if(this.events[t]=this.events[t].filter((function(t){return!r.includes(t)})),0!==r.length){e.next=10;break}return e.abrupt("return",new Promise((function(e){var r=f.on("event:EventDispatcher.register",(function(o,i){if(o===t){f.off(o,r);var a=null==i?void 0:i.apply(void 0,n);a&&a.then?a.then(e):e(a)}}))})));case 10:return e.next=12,Promise.all(r);case 12:return e.abrupt("return",void 0);case 13:case"end":return e.stop()}}),e,this)})))}},{key:"clear",value:function(){this.events={}}}])}();function x(){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 A(t){return new Promise((function(e){return setTimeout(e,t)}))}function O(t,e){if(t===e)return!0;if("object"!==m(t)||"object"!==m(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)||!O(t[a],e[a]))return!1}return!0}var E=function(){return p((function t(e,n){l(this,t),this.game=e,this.prefix=n}),[{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,d(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,d(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,d(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,d(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,d(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)}}])}(),T=function(){return p((function t(e){l(this,t),this.abortHandler=e,this.events=new k,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}}])}();T.EventTypes={"event:skipController.abort":"event:skipController.abort"};var j=function(){return p((function t(){l(this,t),this.locked=!1,this.listeners=[],this.unlockListeners=[]}),[{key:"lock",value:function(){return this.locked=!0,this}},{key:"unlock",value:function(){this.locked=!1;var t,e=c(this.listeners);try{for(e.s();!(t=e.n()).done;){(0,t.value)()}}catch(t){e.e(t)}finally{e.f()}var n,r=c(this.unlockListeners);try{for(r.s();!(n=r.n()).done;){(0,n.value)()}}catch(t){r.e(t)}finally{r.f()}return this.listeners=[],this}},{key:"onUnlock",value:function(t){return this.unlockListeners.push(t),t}},{key:"offUnlock",value:function(t){this.unlockListeners=this.unlockListeners.filter((function(e){return e!==t}))}},{key:"nextUnlock",value:function(){return g(this,void 0,void 0,u().mark((function t(){var e=this;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.locked){t.next=2;break}return t.abrupt("return");case 2:return t.abrupt("return",new Promise((function(t){e.listeners.push(t)})));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"isLocked",value:function(){return this.locked}}])}(),P=function(){return p((function t(){l(this,t),this.locks=[]}),[{key:"unlock",value:function(t){return t.unlock(),this.off(t),t}},{key:"register",value:function(t){var e=t||new j;return this.locks.push(e),e}},{key:"off",value:function(t){this.locks=this.locks.filter((function(e){return e!==t}))}},{key:"nextUnlock",value:function(){return g(this,void 0,void 0,u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.locks.map((function(t){return t.nextUnlock()})),t.abrupt("return",Promise.all(e));case 2:case"end":return t.stop()}}),t,this)})))}},{key:"isLocked",value:function(){return this.locks.some((function(t){return t.isLocked()}))}}])}();function C(t,e){return t?e:arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}}function L(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(t){return void 0!==t};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&r in e&&n(t[r],r)&&e[r](t[r],r)}function I(t){return I="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},I(t)}function N(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,R(r.key),r)}}function R(t){var e=function(t,e){if("object"!=I(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=I(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==I(e)?e:e+""}var M=function(){return function(t,e,n){return e&&N(t.prototype,e),n&&N(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=x(),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]:[]}}])}();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)}function D(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */D=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 P(r||[]);return o(a,"_invoke",{value:O(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",h="suspendedYield",d="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"==F(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(F(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 B(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,V(r.key),r)}}function V(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 G(t,e,n){return e=z(e),function(t,e){if(e&&("object"==F(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,U()?Reflect.construct(e,n||[],z(t).constructor):e.apply(t,n))}function U(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(U=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)}M.ActionTypes={action:"action"};var H=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(t){function e(t,n,r){var o;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(o=G(this,e,[t,n,r])).callee=t.getSelf(),o.contentNode.action=o,o}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),function(t,e,n){return e&&B(t.prototype,e),n&&B(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"unknownType",value:function(){throw new Error("Unknown action type: "+this.type)}},{key:"resolveAwaitable",value:function(t,e){var n=this,r=e||new w((function(t){return t}));return H(n,void 0,void 0,D().mark((function e(){return D().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t(r.resolve.bind(r),r);case 2:case"end":return e.stop()}}),e)}))),r}}])}(M);function Y(t){return Y="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},Y(t)}function q(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 X(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)?X(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 X(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 K(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,Z(r.key),r)}}function Z(t){var e=function(t,e){if("object"!=Y(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Y(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Y(e)?e:e+""}function Q(t,e,n){return e=nt(e),function(t,e){if(e&&("object"==Y(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,J()?Reflect.construct(e,n||[],nt(t).constructor):e.apply(t,n))}function J(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(J=function(){return!!t})()}function tt(t,e,n,r){var o=et(nt(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function et(){return et="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=nt(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}},et.apply(null,arguments)}function nt(t){return nt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},nt(t)}function rt(t,e){return rt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},rt(t,e)}var ot=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Q(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&&rt(t,e)}(e,t),function(t,e,n){return e&&K(t.prototype,e),n&&K(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===r.play){if(e.initSound(t,this.callee),!this.callee.getPlaying())throw new Error("Howl is not initialized");if(this.callee.config.sync&&!this.callee.config.loop){var o=new w((function(t){return t}));return t.playSound(this.callee,(function(){var e;t.stopSound(n.callee),o.resolve({type:n.type,node:null===(e=n.contentNode)||void 0===e?void 0:e.getChild()})})),o}return t.playSound(this.callee,(function(){t.stopSound(n.callee)})),tt(e,"executeAction",this,3)([t])}if(this.type===r.stop)return t.stopSound(this.callee),tt(e,"executeAction",this,3)([t]);if(this.type===r.fade){var i=q(this.contentNode.getContent(),1)[0],a=i.start,s=i.end,u=i.duration;if(this.callee.getPlaying()){var c=void 0===a?this.callee.getPlaying().volume():a;this.callee.getPlaying().fade(c,s,u,this.callee.getToken())}return tt(e,"executeAction",this,3)([t])}if(this.type===r.setVolume){var l=q(this.contentNode.getContent(),1)[0];return this.callee.getPlaying()&&this.callee.getPlaying().volume(l,this.callee.getToken()),tt(e,"executeAction",this,3)([t])}if(this.type===r.setRate){var f=q(this.contentNode.getContent(),1)[0];return this.callee.getPlaying()&&this.callee.getPlaying().rate(f,this.callee.getToken()),tt(e,"executeAction",this,3)([t])}if(this.type===r.pause)return this.callee.getPlaying()&&this.callee.getPlaying().pause(this.callee.getToken()),tt(e,"executeAction",this,3)([t]);if(this.type===r.resume)return this.callee.getPlaying()&&this.callee.getPlaying().play(this.callee.getToken()),tt(e,"executeAction",this,3)([t]);throw tt(e,"unknownType",this,3)([])}}],[{key:"initSound",value:function(t,e){e.getPlaying()||e.setPlaying(new(t.getHowl())(e.getHowlOptions()))}}])}($);function it(t){return it="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},it(t)}function at(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 st(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)?st(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 st(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 ut(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,ct(r.key),r)}}function ct(t){var e=function(t,e){if("object"!=it(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=it(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==it(e)?e:e+""}function lt(t,e,n){return e=dt(e),function(t,e){if(e&&("object"==it(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,ft()?Reflect.construct(e,n||[],dt(t).constructor):e.apply(t,n))}function ft(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ft=function(){return!!t})()}function pt(t,e,n,r){var o=ht(dt(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function ht(){return ht="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=dt(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}},ht.apply(null,arguments)}function dt(t){return dt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},dt(t)}function yt(t,e){return yt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},yt(t,e)}ot.ActionTypes=r;var vt,mt=function(t){function n(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),lt(this,n,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&&yt(t,e)}(n,t),function(t,e,n){return e&&ut(t.prototype,e),n&&ut(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"executeAction",value:function(t){var r,o=this;if(this.type===e.action)return pt(n,"executeAction",this,3)([t]);if(this.type===e.setBackground)return this.callee.state.background=this.contentNode.getContent()[0],pt(n,"executeAction",this,3)([t]);if(this.type===e.sleep){var i=new w((function(t){return t})),a=this.contentNode.getContent();return new Promise((function(t){"number"==typeof a?setTimeout((function(){t()}),a):w.isAwaitable(a)?a.then(t):null==a||a.then(t)})).then((function(){i.resolve({type:o.type,node:o.contentNode.getChild()}),t.stage.next()})),i}if(this.type===e.applyTransition){var s=(new w).registerSkipController(new T((function(){return t.logger.info("NarraLeaf-React: Background Transition","Skipped"),{type:o.type,node:o.contentNode.getChild()}}))),u=this.contentNode.getContent()[0];return this.callee.events.any("event:displayable.applyTransition",u).then((function(){s.resolve({type:o.type,node:o.contentNode.getChild()}),t.stage.next()})),s}if(this.type===e.init){var c=new w((function(t){return t}));return n.handleSceneInit(this,t,c)}if(this.type===e.exit){t.offSrcManager(this.callee.srcManager).removeScene(this.callee);var l=new w((function(t){return t}));return this.callee.events.once("event:scene.unmount",(function(){l.resolve({type:o.type,node:o.contentNode.getChild()}),t.stage.next()})),l}if(this.type===e.jumpTo){var f=this.contentNode.getContent()[0],p=this.contentNode,h=(null===(r=f.sceneRoot)||void 0===r?void 0:r.contentNode)||null;return h&&p.addChild(h),pt(n,"executeAction",this,3)([t])}if(this.type===e.setBackgroundMusic){var d=at(this.contentNode.getContent(),2),y=d[0],v=d[1];return this.callee.events.emit("event:scene.setBackgroundMusic",y,v||0),pt(n,"executeAction",this,3)([t])}if(this.type===e.preUnmount)return this.callee.events.emit("event:scene.preUnmount"),pt(n,"executeAction",this,3)([t]);if(this.type===e.applyTransform){var m=at(this.contentNode.getContent(),1)[0],g=new w((function(t){return t})).registerSkipController(new T((function(){return{type:o.type,node:o.contentNode.getChild()}})));return this.callee.events.any("event:displayable.applyTransform",m).then((function(){g.resolve({type:o.type,node:o.contentNode.getChild()}),t.stage.next()})),g}throw new Error("Unknown scene action type: "+this.type)}},{key:"getFutureActions",value:function(){var t,n,r;if(this.type===e.jumpTo){var o=null===(n=null===(t=this.contentNode.getContent()[0])||void 0===t?void 0:t.sceneRoot)||void 0===n?void 0:n.contentNode;return(null==o?void 0:o.action)?[o.action]:[]}var i=null===(r=this.contentNode.getChild())||void 0===r?void 0:r.action;return i?[i]:[]}}],[{key:"handleSceneInit",value:function(t,e,r){return e.isSceneActive(t.callee)?{type:t.type,node:t.contentNode.getChild()}:(e.registerSrcManager(t.callee.srcManager).addScene(t.callee),n.registerEventListeners(t.callee,e,(function(){r.resolve({type:t.type,node:t.contentNode.getChild()}),e.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&&(ot.initSound(e,t.state.backgroundMusic),t.events.emit("event:scene.setBackgroundMusic",t.state.backgroundMusic,t.config.backgroundMusicFade))})),t.events.any("event:displayable.init").then((function(){n&&n()}))}}])}($);function gt(t){return gt="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},gt(t)}function bt(t,e,n){return e=_t(e),function(t,e){if(e&&("object"==gt(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,wt()?Reflect.construct(e,n||[],_t(t).constructor):e.apply(t,n))}function wt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(wt=function(){return!!t})()}function _t(t){return _t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_t(t)}function St(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&&kt(t,e)}function kt(t,e){return kt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},kt(t,e)}function xt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function At(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,Et(r.key),r)}}function Ot(t,e,n){return e&&At(t.prototype,e),n&&At(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Et(t){var e=function(t,e){if("object"!=gt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=gt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==gt(e)?e:e+""}mt.ActionTypes=e,function(t){t.TreeNode="TreeNode",t.ContentNode="ContentNode"}(vt||(vt={}));var Tt=function(t){function e(t,n,r){var o;return xt(this,e),(o=bt(this,e,[vt.ContentNode])).child=r||null,o.parent=n||null,o.action=t||null,o}return St(e,t),Ot(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 Ot((function t(e){xt(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 jt(t){return jt="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},jt(t)}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,Ct(r.key),r)}}function Ct(t){var e=function(t,e){if("object"!=jt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=jt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==jt(e)?e:e+""}var Lt=function(){return function(t,e,n){return e&&Pt(t.prototype,e),n&&Pt(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 It(t){return It="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},It(t)}function Nt(t){return function(t){if(Array.isArray(t))return Dt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Ft(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 Rt(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Ft(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 Mt(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)||Ft(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 Ft(t,e){if(t){if("string"==typeof t)return Dt(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)?Dt(t,e):void 0}}function Dt(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 Bt(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Bt=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 P(r||[]);return o(a,"_invoke",{value:O(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",h="suspendedYield",d="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"==It(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(It(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 Vt(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,Gt(r.key),r)}}function Gt(t){var e=function(t,e){if("object"!=It(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=It(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==It(e)?e:e+""}function Ut(t,e,n){return e=$t(e),function(t,e){if(e&&("object"==It(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,zt()?Reflect.construct(e,n||[],$t(t).constructor):e.apply(t,n))}function zt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(zt=function(){return!!t})()}function Wt(t,e,n,r){var o=Ht($t(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function Ht(){return Ht="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=$t(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}},Ht.apply(null,arguments)}function $t(t){return $t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$t(t)}function Yt(t,e){return Yt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Yt(t,e)}var qt,Xt=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())}))},Kt=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Ut(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&&Yt(t,e)}(e,t),function(t,e,n){return e&&Vt(t.prototype,e),n&&Vt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAllActions",value:function(t,e){return Xt(this,void 0,void 0,Bt().mark((function n(){var r,o,i;return Bt().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:r=!1,o=e,i=Bt().mark((function e(){var n,r,i;return Bt().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(!w.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 Xt(this,void 0,void 0,Bt().mark((function n(){var r,o,i;return Bt().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=t.game.getLiveGame().executeAction(t,e),!w.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):Wt(e,"executeAction",this,3)([t])}},{key:"executeAction",value:function(t){var n=this,r=Mt(this.contentNode.getContent(),1)[0];if(this.type===a.do){var o=new w((function(t){return t}));return this.execute(t,o,r)}if(this.type===a.doAsync)return Xt(n,void 0,void 0,Bt().mark((function e(){return Bt().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)}))),Wt(e,"executeAction",this,3)([t]);if(this.type===a.any){var i=new w((function(t){return t})),s=r.map((function(e){return n.executeSingleAction(t,e)}));return Promise.any(s).then((function(){i.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),i}if(this.type===a.all){var u=new w((function(t){return t}));return Xt(n,void 0,void 0,Bt().mark((function e(){var n=this;return Bt().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:u.resolve({type:this.type,node:this.contentNode.getChild()}),t.stage.next();case 4:case"end":return e.stop()}}),e,this)}))),u}if(this.type===a.allAsync)return Xt(n,void 0,void 0,Bt().mark((function e(){var n,o,i;return Bt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=Rt(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)}))),Wt(e,"executeAction",this,3)([t]);if(this.type===a.repeat){var c=Mt(this.contentNode.getContent(),2),l=c[0],f=c[1],p=new w((function(t){return t}));return Xt(n,void 0,void 0,Bt().mark((function e(){var n;return Bt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=0;case 1:if(!(n<f)){e.next=8;break}if(!(l.length>0)){e.next=5;break}return e.next=5,this.executeAllActions(t,l[0]);case 5:n++,e.next=1;break;case 8:p.resolve({type:this.type,node:this.contentNode.getChild()}),t.stage.next();case 10:case"end":return e.stop()}}),e,this)}))),p}if(this.type===a.sleep){var h=new w((function(t){return t})),d=Mt(this.contentNode.getContent(),2)[1];return new Promise((function(t){"number"==typeof d?setTimeout((function(){t()}),d):w.isAwaitable(d)?d.then(t):null==d||d.then(t)})).then((function(){h.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),h}throw new Error("Unknown control action type: "+this.type)}},{key:"getFutureActions",value:function(){var t=this.contentNode.getContent()[0],n=Wt(e,"getFutureActions",this,3)([]);return[].concat(Nt(t),Nt(n))}}])}($);function Zt(t){return Zt="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},Zt(t)}function Qt(t){return function(t){if(Array.isArray(t))return Jt(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 Jt(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)?Jt(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 Jt(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 te(t,e,n){return e=ne(e),function(t,e){if(e&&("object"==Zt(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,ee()?Reflect.construct(e,n||[],ne(t).constructor):e.apply(t,n))}function ee(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ee=function(){return!!t})()}function ne(t){return ne=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ne(t)}function re(t,e){return re=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},re(t,e)}function oe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ie(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,se(r.key),r)}}function ae(t,e,n){return e&&ie(t.prototype,e),n&&ie(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function se(t){var e=function(t,e){if("object"!=Zt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Zt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Zt(e)?e:e+""}Kt.ActionTypes=a;var ue=Symbol("_Chained"),ce=function(){function t(e){oe(this,t),this[qt]=!0,this.__actions=[],this.__self=e}return ae(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[ue]}},{key:"toActions",value:function(e){return e.flat(2).map((function(e){return t.isChained(e)?e.fromChained(e):e})).flat(3)}}])}();qt=ue;var le=function(t){function e(){return oe(this,e),te(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&&re(t,e)}(e,t),ae(e,[{key:"chain",value:function(t){var e=ce.isChained(this)?this:this.proxy(this,new ce(this));if(!t)return e;var n=Array.isArray(t)?t:[t];return e.push.apply(e,Qt(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 Kt(t.chain(),Kt.ActionTypes.do,(new Tt).setContent([this.construct(ce.toActions([n]))]));return this.chain(r)}}])}(Lt);function fe(t){return fe="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},fe(t)}function pe(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,he(r.key),r)}}function he(t){var e=function(t,e){if("object"!=fe(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=fe(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==fe(e)?e:e+""}function de(t,e,n){return e=ve(e),function(t,e){if(e&&("object"==fe(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,ye()?Reflect.construct(e,n||[],ve(t).constructor):e.apply(t,n))}function ye(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ye=function(){return!!t})()}function ve(t){return ve=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ve(t)}function me(t,e){return me=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},me(t,e)}var ge,be=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),de(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&&me(t,e)}(e,t),function(t,e,n){return e&&pe(t.prototype,e),n&&pe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"toData",value:function(){return null}},{key:"fromChained",value:function(t){return t.getActions()}}])}(le),we="center",_e="left",Se="right";function ke(t){return ke="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},ke(t)}function xe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ae(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,Te(r.key),r)}}function Oe(t,e,n){return e&&Ae(t.prototype,e),n&&Ae(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ee(t,e,n){return(e=Te(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Te(t){var e=function(t,e){if("object"!=ke(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ke(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ke(e)?e:e+""}!function(t){t.Left="left",t.Center="center",t.Right="right"}(ge||(ge={}));var je=Ee(Ee(Ee({},ge.Left,"33.33%"),ge.Center,"50%"),ge.Right,"66.66%"),Pe=function(){function t(){xe(this,t)}return Oe(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(Ce.isCommonPositionType(t))return Le.fromCommonPosition(t);if(Le.isCoord2DPosition(t))return t;if(Ie.isAlignPosition(t))return Le.fromAlignPosition(t);if("object"===ke(t)&&["x","y","xoffset","yoffset"].some((function(e){return e in t})))return new Le(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 Le.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(ge).includes(t)}},{key:"isRawCoord2DPosition",value:function(t){return"object"===ke(t)&&("x"in t||"y"in t||"xoffset"in t||"yoffset"in t)}},{key:"isRawAlignPosition",value:function(t){return"object"===ke(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 Ce||t instanceof Le||t instanceof Ie}},{key:"rawPositionToCoord2D",value:function(t){if(this.isRawCommonPositionType(t))return Le.fromCommonPosition(new Ce(t));if(this.isRawCoord2DPosition(t))return new Le(t);if(this.isRawAlignPosition(t))return Le.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")}}])}();Pe.Unknown=Symbol("Unknown");var Ce=function(){function t(e){xe(this,t),this.position=e}return Oe(t,[{key:"toCSS",value:function(){return{x:je[this.position],y:"50%",xoffset:0,yoffset:0}}}],[{key:"isCommonPositionType",value:function(e){return e instanceof t}}])}();Ce.Positions=ge;var Le=function(){function t(e,n){xe(this,t),"object"===ke(e)?(this.x=Pe.orUnknown(e.x),this.y=Pe.orUnknown(e.y),this.xoffset=Pe.orUnknown(e.xoffset),this.yoffset=Pe.orUnknown(e.yoffset)):(this.x=Pe.orUnknown(e),this.y=Pe.orUnknown(n),this.xoffset=Pe.Unknown,this.yoffset=Pe.Unknown)}return Oe(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:je[e.position],y:"50%"})}},{key:"fromAlignPosition",value:function(e){return new t({x:Pe.isUnknown(e.xalign)?Pe.Unknown:"".concat(100*e.xalign,"%"),y:Pe.isUnknown(e.yalign)?Pe.Unknown:"".concat(100*e.yalign,"%"),xoffset:e.xoffset,yoffset:e.yoffset})}},{key:"merge",value:function(e,n){return new t({x:Pe.isUnknown(n.x)?e.x:n.x,y:Pe.isUnknown(n.y)?e.y:n.y,xoffset:Pe.isUnknown(n.xoffset)?e.xoffset:n.xoffset,yoffset:Pe.isUnknown(n.yoffset)?e.yoffset:n.yoffset})}}])}(),Ie=function(){function t(e,n){xe(this,t),"object"===ke(e)?(this.xalign=Pe.orUnknown(e.xalign),this.yalign=Pe.orUnknown(e.yalign),this.xoffset=Pe.orUnknown(e.xoffset),this.yoffset=Pe.orUnknown(e.yoffset)):(this.xalign=Pe.orUnknown(e),this.yalign=Pe.orUnknown(n),this.xoffset=Pe.Unknown,this.yoffset=Pe.Unknown)}return Oe(t,[{key:"toCSS",value:function(){return{x:Pe.isUnknown(this.xalign)?this.xalign:"".concat(100*this.xalign,"%"),y:Pe.isUnknown(this.yalign)?this.yalign:"".concat(100*this.yalign,"%"),xoffset:this.xoffset,yoffset:this.yoffset}}}],[{key:"isAlignPosition",value:function(e){return e instanceof t}}])}();function Ne(t){let e;return()=>(void 0===e&&(e=t()),e)}const Re=Ne((()=>void 0!==window.ScrollTimeline));class Me{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,e){const n=this.animations.map((n=>Re()&&n.attachTimeline?n.attachTimeline(t):e(n)));return()=>{n.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 Fe=t=>1e3*t,De=t=>t/1e3;function Be(t,e){return e?t*(1e3/e):0}const Ve=5;function Ge(t,e,n){const r=Math.max(e-Ve,0);return Be(n-t(r),e-r)}const Ue=t=>t;let ze=Ue,We=Ue;const He=(t,e,n)=>n>e?e:n<t?t:n,$e=.001,Ye=.01,qe=10,Xe=.05,Ke=1;function Ze({duration:t=800,bounce:e=.25,velocity:n=0,mass:r=1}){let o,i;ze(t<=Fe(qe),"Spring duration must be 10 seconds or less");let a=1-e;a=He(Xe,Ke,a),t=He(Ye,qe,De(t)),a<1?(o=e=>{const r=e*a,o=r*t,i=r-n,s=Je(e,a),u=Math.exp(-o);return $e-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=Je(Math.pow(e,2),a);return(-o(e)+$e>0?-1:1)*((i-s)*u)/c}):(o=e=>Math.exp(-e*t)*((e-n)*t+1)-$e,i=e=>Math.exp(-e*t)*(t*t*(n-e)));const s=function(t,e,n){let r=n;for(let n=1;n<Qe;n++)r-=t(r)/e(r);return r}(o,i,5/t);if(t=Fe(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 Qe=12;function Je(t,e){return t*Math.sqrt(1-e*e)}const tn=["duration","bounce"],en=["stiffness","damping","mass"];function nn(t,e){return e.some((e=>void 0!==t[e]))}function rn({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(!nn(t,en)&&nn(t,tn)){const n=Ze(t);e={...e,...n,mass:1},e.isResolvedFromDuration=!0}return e}({...r,velocity:-De(r.velocity||0)}),h=f||0,d=u/(2*Math.sqrt(s*c)),y=i-o,v=De(Math.sqrt(s/c)),m=Math.abs(y)<5;let g;if(n||(n=m?.01:2),e||(e=m?.005:.5),d<1){const t=Je(v,d);g=e=>{const n=Math.exp(-d*v*e);return i-n*((h+d*v*y)/t*Math.sin(t*e)+y*Math.cos(t*e))}}else if(1===d)g=t=>i-Math.exp(-v*t)*(y+(h+v*y)*t);else{const t=v*Math.sqrt(d*d-1);g=e=>{const n=Math.exp(-d*v*e),r=Math.min(t*e,300);return i-n*((h+d*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;d<1&&(o=0===t?Fe(h):Ge(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}}}const on=2e4;function an(t){let e=0;let n=t.next(e);for(;!n.done&&e<on;)e+=50,n=t.next(e);return e>=on?1/0:e}function sn(t,e=100,n){const r=n({...t,keyframes:[0,e]}),o=Math.min(an(r),on);return{type:"keyframes",ease:t=>r.next(o*t).value/e,duration:De(o)}}const un=(t,e,n)=>t+(e-t)*n,cn=(t,e,n)=>{const r=e-t;return 0===r?1:(n-t)/r};function ln(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const o=cn(0,e,r);t.push(un(n,1,o))}}function fn(t){const e=[0];return ln(e,t.length-1),e}const pn=t=>Boolean(t&&t.getVelocity);function hn(t){return"object"==typeof t&&!Array.isArray(t)}function dn(t,e,n,r){return"string"==typeof t&&hn(e)?function(t,e,n){var r;if("string"==typeof t){let o=document;e&&(We(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||[])}(t,n,r):t instanceof NodeList?Array.from(t):Array.isArray(t)?t:[t]}function yn(t){return"function"==typeof t}function vn(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 mn=(t,e,n)=>{const r=e-t;return((n-t)%r+r)%r+t},gn=t=>Array.isArray(t)&&"number"!=typeof t[0];function bn(t,e){return gn(t)?t[mn(0,t.length,e)]:t}function wn(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}function _n(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&&(wn(t,o),r--)}}(t,o,i);for(let a=0;a<e.length;a++)t.push({value:e[a],at:un(o,i,r[a]),easing:bn(n,a)})}function Sn(t,e){return t.at===e.at?null===t.value?1:null===e.value?-1:0:t.at-e.at}const kn="easeInOut";function xn(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function An(t,e){return e[t]||(e[t]=[]),e[t]}function On(t){return Array.isArray(t)?t:[t]}function En(t,e){return t&&t[e]?{...t,...t[e]}:{...t}}const Tn=t=>"number"==typeof t,jn=t=>t.every(Tn),Pn=new WeakMap,Cn=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ln=new Set(Cn),In={type:"spring",stiffness:500,damping:25,restSpeed:10},Nn={type:"keyframes",duration:.8},Rn={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Mn=(t,{keyframes:e})=>e.length>2?Nn:Ln.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:In:Rn;function Fn(t,e){return t?t[e]||t.default||t:void 0}const Dn=!1,Bn=!1,Vn=!1,Gn=t=>null!==t;function Un(t,{repeat:e,repeatType:n="loop"},r){const o=t.filter(Gn),i=e&&"loop"!==n&&e%2==1?0:o.length-1;return i&&void 0!==r?r:o[i]}const zn=["read","resolveKeyframes","update","preRender","render","postRender"];function Wn(t,e){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=zn.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,h=()=>{const i=Bn?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(h))};return{schedule:zn.reduce(((e,i)=>{const s=a[i];return e[i]=(e,i=!1,a=!1)=>(n||(n=!0,r=!0,o.isProcessing||t(h)),s.schedule(e,i,a)),e}),{}),cancel:t=>{for(let e=0;e<zn.length;e++)a[zn[e]].cancel(t)},state:o,steps:a}}const{schedule:Hn,cancel:$n,state:Yn,steps:qn}=Wn("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:Ue,!0),Xn=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Kn=1e-7,Zn=12;function Qn(t,e,n,r){if(t===e&&n===r)return Ue;const o=e=>function(t,e,n,r,o){let i,a,s=0;do{a=e+(n-e)/2,i=Xn(a,r,o)-t,i>0?n=a:e=a}while(Math.abs(i)>Kn&&++s<Zn);return a}(e,0,1,t,n);return t=>0===t||1===t?t:Xn(o(t),e,r)}const Jn=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,tr=t=>e=>1-t(1-e),er=Qn(.33,1.53,.69,.99),nr=tr(er),rr=Jn(nr),or=t=>(t*=2)<1?.5*nr(t):.5*(2-Math.pow(2,-10*(t-1))),ir=t=>1-Math.sin(Math.acos(t)),ar=tr(ir),sr=Jn(ir),ur=t=>/^0[^.\s]+$/u.test(t);const cr=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),lr=t=>e=>"string"==typeof e&&e.startsWith(t),fr=lr("--"),pr=lr("var(--"),hr=t=>!!pr(t)&&dr.test(t.split("/*")[0].trim()),dr=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,yr=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function vr(t,e,n=1){We(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=yr.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 cr(t)?parseFloat(t):t}return hr(o)?vr(o,e,n+1):o}const mr={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},gr={...mr,transform:t=>He(0,1,t)},br={...mr,default:1},wr=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),_r=wr("deg"),Sr=wr("%"),kr=wr("px"),xr=wr("vh"),Ar=wr("vw"),Or={...Sr,parse:t=>Sr.parse(t)/100,transform:t=>Sr.transform(100*t)},Er=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),Tr=t=>t===mr||t===kr,jr=(t,e)=>parseFloat(t.split(", ")[e]),Pr=(t,e)=>(n,{transform:r})=>{if("none"===r||!r)return 0;const o=r.match(/^matrix3d\((.+)\)$/u);if(o)return jr(o[1],e);{const e=r.match(/^matrix\((.+)\)$/u);return e?jr(e[1],t):0}},Cr=new Set(["x","y","z"]),Lr=Cn.filter((t=>!Cr.has(t)));const Ir={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:Pr(4,13),y:Pr(5,14)};Ir.translateX=Ir.x,Ir.translateY=Ir.y;const Nr=t=>e=>e.test(t),Rr=[mr,kr,Sr,_r,Ar,xr,{test:t=>"auto"===t,parse:t=>t}],Mr=t=>Rr.find(Nr(t)),Fr=new Set;let Dr=!1,Br=!1;function Vr(){if(Br){const t=Array.from(Fr).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 Lr.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)}))}Br=!1,Dr=!1,Fr.forEach((t=>t.complete())),Fr.clear()}function Gr(){Fr.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(Br=!0)}))}class Ur{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?(Fr.add(this),Dr||(Dr=!0,Hn.read(Gr),Hn.resolveKeyframes(Vr))):(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),Fr.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Fr.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const zr=t=>Math.round(1e5*t)/1e5,Wr=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const Hr=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,$r=(t,e)=>n=>Boolean("string"==typeof n&&Hr.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),Yr=(t,e,n)=>r=>{if("string"!=typeof r)return r;const[o,i,a,s]=r.match(Wr);return{[t]:parseFloat(o),[e]:parseFloat(i),[n]:parseFloat(a),alpha:void 0!==s?parseFloat(s):1}},qr={...mr,transform:t=>Math.round((t=>He(0,255,t))(t))},Xr={test:$r("rgb","red"),parse:Yr("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+qr.transform(t)+", "+qr.transform(e)+", "+qr.transform(n)+", "+zr(gr.transform(r))+")"};const Kr={test:$r("#"),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:Xr.transform},Zr={test:$r("hsl","hue"),parse:Yr("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+Sr.transform(zr(e))+", "+Sr.transform(zr(n))+", "+zr(gr.transform(r))+")"},Qr={test:t=>Xr.test(t)||Kr.test(t)||Zr.test(t),parse:t=>Xr.test(t)?Xr.parse(t):Zr.test(t)?Zr.parse(t):Kr.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?Xr.transform(t):Zr.transform(t)},Jr=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const to="number",eo="color",no="var",ro="var(",oo="${}",io=/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 ao(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},o=[];let i=0;const a=e.replace(io,(t=>(Qr.test(t)?(r.color.push(i),o.push(eo),n.push(Qr.parse(t))):t.startsWith(ro)?(r.var.push(i),o.push(no),n.push(t)):(r.number.push(i),o.push(to),n.push(parseFloat(t))),++i,oo))).split(oo);return{values:n,split:a,indexes:r,types:o}}function so(t){return ao(t).values}function uo(t){const{split:e,types:n}=ao(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===to?zr(t[i]):e===eo?Qr.transform(t[i]):t[i]}return o}}const co=t=>"number"==typeof t?0:t;const lo={test:function(t){var e,n;return isNaN(t)&&"string"==typeof t&&((null===(e=t.match(Wr))||void 0===e?void 0:e.length)||0)+((null===(n=t.match(Jr))||void 0===n?void 0:n.length)||0)>0},parse:so,createTransformer:uo,getAnimatableNone:function(t){const e=so(t);return uo(t)(e.map(co))}},fo=new Set(["brightness","contrast","saturate","opacity"]);function po(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[r]=n.match(Wr)||[];if(!r)return t;const o=n.replace(r,"");let i=fo.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+o+")"}const ho=/\b([a-z-]*)\(.*?\)/gu,yo={...lo,getAnimatableNone:t=>{const e=t.match(ho);return e?e.map(po).join(" "):t}},vo={borderWidth:kr,borderTopWidth:kr,borderRightWidth:kr,borderBottomWidth:kr,borderLeftWidth:kr,borderRadius:kr,radius:kr,borderTopLeftRadius:kr,borderTopRightRadius:kr,borderBottomRightRadius:kr,borderBottomLeftRadius:kr,width:kr,maxWidth:kr,height:kr,maxHeight:kr,top:kr,right:kr,bottom:kr,left:kr,padding:kr,paddingTop:kr,paddingRight:kr,paddingBottom:kr,paddingLeft:kr,margin:kr,marginTop:kr,marginRight:kr,marginBottom:kr,marginLeft:kr,backgroundPositionX:kr,backgroundPositionY:kr},mo={rotate:_r,rotateX:_r,rotateY:_r,rotateZ:_r,scale:br,scaleX:br,scaleY:br,scaleZ:br,skew:_r,skewX:_r,skewY:_r,distance:kr,translateX:kr,translateY:kr,translateZ:kr,x:kr,y:kr,z:kr,perspective:kr,transformPerspective:kr,opacity:gr,originX:Or,originY:Or,originZ:kr},go={...mr,transform:Math.round},bo={...vo,...mo,zIndex:go,size:kr,fillOpacity:gr,strokeOpacity:gr,numOctaves:go},wo={...bo,color:Qr,backgroundColor:Qr,outlineColor:Qr,fill:Qr,stroke:Qr,borderColor:Qr,borderTopColor:Qr,borderRightColor:Qr,borderBottomColor:Qr,borderLeftColor:Qr,filter:yo,WebkitFilter:yo},_o=t=>wo[t];function So(t,e){let n=_o(t);return n!==yo&&(n=lo),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const ko=new Set(["auto","none","0"]);class xo extends Ur{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(),hr(r))){const o=vr(r,e.current);void 0!==o&&(t[n]=o),n===t.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!Er.has(n)||2!==t.length)return;const[r,o]=t,i=Mr(r),a=Mr(o);if(i!==a)if(Tr(i)&&Tr(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||ur(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&&!ko.has(e)&&ao(e).values.length&&(r=t[o]),o++}if(r&&n)for(const o of e)t[o]=So(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=Ir[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]=Ir[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 Ao;function Oo(){Ao=void 0}const Eo={now:()=>(void 0===Ao&&Eo.set(Yn.isProcessing||Bn?Yn.timestamp:performance.now()),Ao),set:t=>{Ao=t,queueMicrotask(Oo)}},To=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!lo.test(t)&&"0"!==t||t.startsWith("url(")));function jo(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=To(o,e),s=To(i,e);return ze(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||yn(n))&&r)}class Po{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=Eo.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||(Gr(),Vr()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=Eo.now(),this.hasAttemptedResolve=!0;const{name:n,type:r,velocity:o,delay:i,onComplete:a,onUpdate:s,isGenerator:u}=this.options;if(!u&&!jo(t,n,r,o)){if(Vn||!i)return null==s||s(Un(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 Co({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},h=t=>void 0===s?u:void 0===u||Math.abs(s-t)<Math.abs(u-t)?s:u;let d=n*e;const y=f+d,v=void 0===a?y:a(y);v!==y&&(d=v-f);const m=t=>-d*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,_=rn({keyframes:[p.value,h(p.value)],velocity:Ge(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 Lo=Qn(.42,0,1,1),Io=Qn(0,0,.58,1),No=Qn(.42,0,.58,1),Ro=t=>Array.isArray(t)&&"number"==typeof t[0],Mo={linear:Ue,easeIn:Lo,easeInOut:No,easeOut:Io,circIn:ir,circInOut:sr,circOut:ar,backIn:nr,backInOut:rr,backOut:er,anticipate:or},Fo=t=>{if(Ro(t)){We(4===t.length,"Cubic bezier arrays must contain four numerical values.");const[e,n,r,o]=t;return Qn(e,n,r,o)}return"string"==typeof t?(We(void 0!==Mo[t],`Invalid easing type '${t}'`),Mo[t]):t},Do=(t,e)=>n=>e(t(n)),Bo=(...t)=>t.reduce(Do);function Vo(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 Go(t,e){return n=>n>0?e:t}const Uo=(t,e,n)=>{const r=t*t,o=n*(e*e-r)+r;return o<0?0:Math.sqrt(o)},zo=[Kr,Xr,Zr];function Wo(t){const e=(n=t,zo.find((t=>t.test(n))));var n;if(ze(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===Zr&&(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=Vo(s,r,t+1/3),i=Vo(s,r,t),a=Vo(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 Ho=(t,e)=>{const n=Wo(t),r=Wo(e);if(!n||!r)return Go(t,e);const o={...n};return t=>(o.red=Uo(n.red,r.red,t),o.green=Uo(n.green,r.green,t),o.blue=Uo(n.blue,r.blue,t),o.alpha=un(n.alpha,r.alpha,t),Xr.transform(o))},$o=new Set(["none","hidden"]);function Yo(t,e){return n=>un(t,e,n)}function qo(t){return"number"==typeof t?Yo:"string"==typeof t?hr(t)?Go:Qr.test(t)?Ho:Zo:Array.isArray(t)?Xo:"object"==typeof t?Qr.test(t)?Ho:Ko:Go}function Xo(t,e){const n=[...t],r=n.length,o=t.map(((t,n)=>qo(t)(t,e[n])));return t=>{for(let e=0;e<r;e++)n[e]=o[e](t);return n}}function Ko(t,e){const n={...t,...e},r={};for(const o in n)void 0!==t[o]&&void 0!==e[o]&&(r[o]=qo(t[o])(t[o],e[o]));return t=>{for(const e in r)n[e]=r[e](t);return n}}const Zo=(t,e)=>{const n=lo.createTransformer(e),r=ao(t),o=ao(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?$o.has(t)&&!o.values.length||$o.has(e)&&!r.values.length?function(t,e){return $o.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):Bo(Xo(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):(ze(!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.`),Go(t,e))};function Qo(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return un(t,e,n);return qo(t)(t,e)}function Jo(t,e,{clamp:n=!0,ease:r,mixer:o}={}){const i=t.length;if(We(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||Qo,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]||Ue:e;i=Bo(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=cn(t[n],t[n+1],e);return a[n](r)};return n?e=>u(He(t[0],t[i-1],e)):u}function ti({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const o=gn(r)?r.map(Fo):Fo(r),i={done:!1,value:e[0]},a=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:fn(e),t),s=Jo(a,e,{ease:Array.isArray(o)?o:(u=e,c=o,u.map((()=>c||No)).splice(0,u.length-1))});var u,c;return{calculatedDuration:t,next:e=>(i.value=s(e),i.done=e>=t,i)}}const ei=t=>{const e=({timestamp:e})=>t(e);return{start:()=>Hn.update(e,!0),stop:()=>$n(e),now:()=>Yn.isProcessing?Yn.timestamp:Eo.now()}},ni={decay:Co,inertia:Co,tween:ti,keyframes:ti,spring:rn},ri=t=>t/100;class oi extends Po{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)||Ur;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=yn(e)?e:ni[e]||ti;let s,u;a!==ti&&"number"!=typeof t[0]&&(s=Bo(ri,Qo(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=an(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:h,repeatDelay:d,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"===h?(n=1-n,d&&(n-=d/l)):"mirror"===h&&(b=i)),g=He(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=Un(s,this.options,r)),y&&y(w.value),S&&this.finish(),w}get duration(){const{resolved:t}=this;return t?De(t.calculatedDuration):0}get time(){return De(this.currentTime)}set time(t){t=Fe(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=De(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=ei,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 ii=new Set(["opacity","clipPath","filter","transform"]),ai=(t,e)=>{let n="";const r=Math.max(Math.round(e/10),2);for(let e=0;e<r;e++)n+=t(cn(0,r-1,e))+", ";return`linear(${n.substring(0,n.length-2)})`},si={linearEasing:void 0};function ui(t,e){const n=Ne(t);return()=>{var t;return null!==(t=si[e])&&void 0!==t?t:n()}}const ci=ui((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing");function li(t){return Boolean("function"==typeof t&&ci()||!t||"string"==typeof t&&(t in pi||ci())||Ro(t)||Array.isArray(t)&&t.every(li))}const fi=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,pi={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:fi([0,.65,.55,1]),circOut:fi([.55,0,1,.45]),backIn:fi([.31,.01,.66,-.59]),backOut:fi([.33,1.53,.69,.99])};function hi(t,e){return t?"function"==typeof t&&ci()?ai(t,e):Ro(t)?fi(t):Array.isArray(t)?t.map((t=>hi(t,e)||pi.easeOut)):pi[t]:void 0}function di(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=hi(s,o);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"})}function yi(t,e){t.timeline=e,t.onfinish=null}const vi=Ne((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));const mi={anticipate:or,backInOut:rr,circInOut:sr};class gi extends Po{constructor(t){super(t);const{name:e,motionValue:n,element:r,keyframes:o}=this.options;this.resolver=new xo(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("string"==typeof i&&ci()&&i in mi&&(i=mi[i]),function(t){return yn(t.type)||"spring"===t.type||!li(t.ease)}(this.options)){const{onComplete:e,onUpdate:n,motionValue:s,element:u,...c}=this.options,l=function(t,e){const n=new oi({...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=di(s.owner.current,u,t,{...this.options,duration:r,times:o,ease:i});return l.startTime=null!=c?c:this.calcStartTime(),this.pendingTimeline?(yi(l,this.pendingTimeline),this.pendingTimeline=void 0):l.onfinish=()=>{const{onComplete:n}=this.options;s.set(Un(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 De(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return De(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.currentTime=Fe(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 Ue;const{animation:n}=e;yi(n,t)}else this.pendingTimeline=t;return Ue}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 oi({...c,keyframes:n,duration:r,type:o,ease:i,times:a,isGenerator:!0}),f=Fe(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 vi()&&n&&ii.has(n)&&e&&e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate&&!r&&"mirror"!==o&&0!==i&&"inertia"!==a}}const bi=(t,e,n,r={},o,i)=>a=>{const s=Fn(r,t)||{},u=s.delay||r.delay||0;let{elapsed:c=0}=r;c-=Fe(u);let l={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...s,delay:-c,onUpdate:t=>{e.set(t),s.onUpdate&&s.onUpdate(t)},onComplete:()=>{a(),s.onComplete&&s.onComplete()},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})(s)||(l={...l,...Mn(t,l)}),l.duration&&(l.duration=Fe(l.duration)),l.repeatDelay&&(l.repeatDelay=Fe(l.repeatDelay)),void 0!==l.from&&(l.keyframes[0]=l.from);let f=!1;if((!1===l.type||0===l.duration&&!l.repeatDelay)&&(l.duration=0,0===l.delay&&(f=!0)),(Vn||Dn)&&(f=!0,l.duration=0,l.delay=0),f&&!i&&void 0!==e.get()){const t=Un(l.keyframes,s);if(void 0!==t)return Hn.update((()=>{l.onUpdate(t),l.onComplete()})),new Me([])}return!i&&gi.supports(l)?new gi(l):new oi(l)},wi=t=>Array.isArray(t),_i=t=>Boolean(t&&"object"==typeof t&&t.mix&&t.toValue),Si=t=>wi(t)?t[t.length-1]||0:t;class ki{constructor(){this.subscriptions=[]}add(t){var e,n;return e=this.subscriptions,n=t,-1===e.indexOf(n)&&e.push(n),()=>wn(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 xi={current:void 0};class Ai{constructor(t,e={}){this.version="11.11.9",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=Eo.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=Eo.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 ki);const n=this.events[t].add(e);return"change"===t?()=>{n(),Hn.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 xi.current&&xi.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=Eo.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return Be(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 Oi(t,e){return new Ai(t,e)}function Ei(t){const e=[{},{}];return null==t||t.values.forEach(((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()})),e}function Ti(t,e,n,r){if("function"==typeof e){const[o,i]=Ei(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]=Ei(r);e=e(void 0!==n?n:t.custom,o,i)}return e}function ji(t,e,n){const r=t.getProps();return Ti(r,e,void 0!==n?n:r.custom,t)}function Pi(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Oi(n))}const Ci=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Li="data-"+Ci("framerAppearId");function Ii(t){return t.props[Li]}function Ni(t,e){if(!t.applyWillChange)return;const n=t.getValue("willChange");return r=n,Boolean(pn(r)&&r.add)?n.add(e):void 0;var r}function Ri({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,r}function Mi(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&&Ri(l,e))continue;const s={delay:n,...Fn(a||{},e)};let f=!1;if(window.MotionHandoffAnimation){const n=Ii(t);if(n){const t=window.MotionHandoffAnimation(n,e,Hn);null!==t&&(s.startTime=t,f=!0)}}Ni(t,e),r.start(bi(e,r,o,t.shouldReduceMotion&&Ln.has(e)?{type:!1}:s,t,f));const p=r.animation;p&&c.push(p)}return s&&Promise.all(c).then((()=>{Hn.update((()=>{s&&function(t,e){const n=ji(t,e);let{transitionEnd:r={},transition:o={},...i}=n||{};i={...i,...r};for(const e in i)Pi(t,e,Si(i[e]))}(t,s)}))})),c}const Fi={};function Di(t,{layout:e,layoutId:n}){return Ln.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!Fi[t]||"opacity"===t)}function Bi(t,e,n){var r;const{style:o}=t,i={};for(const a in o)(pn(o[a])||e.style&&pn(e.style[a])||Di(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 Vi(t,e,n){const r=Bi(t,e,n);for(const n in t)if(pn(t[n])||pn(e[n])){r[-1!==Cn.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=t[n]}return r}const Gi="undefined"!=typeof window,Ui={current:null},zi={current:!1};function Wi(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function Hi(t){return"string"==typeof t||Array.isArray(t)}const $i=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Yi=["initial",...$i];function qi(t){return Wi(t.animate)||Yi.some((e=>Hi(t[e])))}function Xi(t){return Boolean(qi(t)||t.variants)}const Ki={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"]},Zi={};for(const t in Ki)Zi[t]={isEnabled:e=>Ki[t].some((t=>!!e[t]))};const Qi=[...Rr,Qr,lo],Ji=()=>({x:{min:0,max:0},y:{min:0,max:0}}),ta=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class ea{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=Ur,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=Eo.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,Hn.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=qi(e),this.isVariantNode=Xi(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]&&pn(e)&&e.set(s[t],!1)}}mount(t){this.current=t,Pn.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))),zi.current||function(){if(zi.current=!0,Gi)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Ui.current=t.matches;t.addListener(e),e()}else Ui.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||Ui.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Pn.delete(this.current),this.projection&&this.projection.unmount(),$n(this.notifyUpdate),$n(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=Ln.has(t),r=e.on("change",(e=>{this.latestValues[t]=e,this.props.onUpdate&&Hn.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 Zi){const e=Zi[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<ta.length;e++){const n=ta[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(pn(o))t.addValue(r,o);else if(pn(i))t.addValue(r,Oi(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,Oi(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}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=Oi(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&&(cr(r)||ur(r))?r=parseFloat(r):(o=r,!Qi.find(Nr(o))&&lo.test(e)&&(r=So(t,e))),this.setBaseTarget(t,pn(r)?r.get():r)),pn(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=Ti(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||pn(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 ki),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class na extends ea{constructor(){super(...arguments),this.KeyframeResolver=xo}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 ra=(t,e)=>e&&"number"==typeof t?e.transform(t):t,oa={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},ia=Cn.length;function aa(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(Ln.has(t))a=!0;else if(fr(t))o[t]=n;else{const e=ra(n,bo[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<ia;i++){const a=Cn[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=ra(s,bo[a]);u||(o=!1,r+=`${oa[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 sa(t,e,n){return"string"==typeof t?t:kr.transform(e+n*t)}const ua={offset:"stroke-dashoffset",array:"stroke-dasharray"},ca={offset:"strokeDashoffset",array:"strokeDasharray"};function la(t,{attrX:e,attrY:n,attrScale:r,originX:o,originY:i,pathLength:a,pathSpacing:s=1,pathOffset:u=0,...c},l,f){if(aa(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:h,dimensions:d}=t;p.transform&&(d&&(h.transform=p.transform),delete p.transform),d&&(void 0!==o||void 0!==i||h.transform)&&(h.transformOrigin=function(t,e,n){return`${sa(e,t.x,t.width)} ${sa(n,t.y,t.height)}`}(d,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?ua:ca;t[i.offset]=kr.transform(-r);const a=kr.transform(e),s=kr.transform(n);t[i.array]=`${a} ${s}`}(p,a,s,u,!1)}const fa=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 pa(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 ha(t,e,n,r){pa(t,e,void 0,r);for(const n in e.attrs)t.setAttribute(fa.has(n)?n:Ci(n),e.attrs[n])}const da=t=>"string"==typeof t&&"svg"===t.toLowerCase();class ya extends na{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ji}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(Ln.has(e)){const t=_o(e);return t&&t.default||0}return e=fa.has(e)?e:Ci(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return Vi(t,e,n)}build(t,e,n){la(t,e,this.isSVGTag,n.transformTemplate)}renderInstance(t,e,n,r){ha(t,e,0,r)}mount(t){this.isSVGTag=da(t.tagName),super.mount(t)}}function va(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 ma extends na{constructor(){super(...arguments),this.type="html",this.applyWillChange=!0,this.renderInstance=pa}readValueFromInstance(t,e){if(Ln.has(e)){const t=_o(e);return t&&t.default||0}{const r=(n=t,window.getComputedStyle(n)),o=(fr(e)?r.getPropertyValue(e):r[e])||0;return"string"==typeof o?o.trim():o}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return va(t,e)}build(t,e,n){aa(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return Bi(t,e,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;pn(t)&&(this.childSubscription=t.on("change",(t=>{this.current&&(this.current.textContent=`${t}`)})))}}class ga extends ea{constructor(){super(...arguments),this.type="object"}readValueFromInstance(t,e){if(function(t,e){return t in e}(e,t)){const n=t[e];if("string"==typeof n||"number"==typeof n)return n}}getBaseTargetFromProps(){}removeValueFromRenderState(t,e){delete e.output[t]}measureInstanceViewportBox(){return{x:{min:0,max:0},y:{min:0,max:0}}}build(t,e){Object.assign(t.output,e)}renderInstance(t,{output:e}){Object.assign(t,e)}sortInstanceNodePosition(){return 0}}function ba(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 ya(e):new ma(e);n.mount(t),Pn.set(t,n)}function wa(t){const e=new ga({presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}});e.mount(t),Pn.set(t,e)}function _a(t,e,n,r){const o=[];if(function(t,e){return pn(t)||"number"==typeof t||"string"==typeof t&&!hn(e)}(t,e))o.push(function(t,e,n){const r=pn(t)?t:Oi(t);return r.start(bi("",r,e,n)),r.animation}(t,hn(e)&&e.default||e,n&&n.default||n));else{const i=dn(t,e,r),a=i.length;We(Boolean(a),"No valid elements provided.");for(let t=0;t<a;t++){const r=i[t],s=r instanceof Element?ba:wa;Pn.has(r)||s(r);const u=Pn.get(r),c={...n};"delay"in c&&"function"==typeof c.delay&&(c.delay=c.delay(t,a)),o.push(...Mi(u,{...e,transition:c},{}))}}return o}function Sa(t,e,n){const r=[],o=function(t,{defaultTransition:e={},...n}={},r,o){const i=e.duration||.3,a=new Map,s=new Map,u={},c=new Map;let l=0,f=0,p=0;for(let n=0;n<t.length;n++){const a=t[n];if("string"==typeof a){c.set(a,f);continue}if(!Array.isArray(a)){c.set(a.name,vn(f,a.at,l,c));continue}let[h,d,y={}]=a;void 0!==y.at&&(f=vn(f,y.at,l,c));let v=0;const m=(t,n,r,a=0,s=0)=>{const u=On(t),{delay:c=0,times:l=fn(u),type:h="keyframes",...d}=n;let{ease:y=e.ease||"easeOut",duration:m}=n;const g="function"==typeof c?c(a,s):c,b=u.length,w=yn(h)?h:null==o?void 0:o[h];if(b<=2&&w){let t=100;if(2===b&&jn(u)){const e=u[1]-u[0];t=Math.abs(e)}const e={...d};void 0!==m&&(e.duration=Fe(m));const n=sn(e,t,w);y=n.ease,m=n.duration}null!=m||(m=i);const _=f+g,S=_+m;1===l.length&&0===l[0]&&(l[1]=1);const k=l.length-u.length;k>0&&ln(l,k),1===u.length&&u.unshift(null),_n(r,u,y,l,_,S),v=Math.max(g+m,v),p=Math.max(S,p)};if(pn(h))m(d,y,An("default",xn(h,s)));else{const t=dn(h,d,r,u),e=t.length;for(let n=0;n<e;n++){const r=xn(t[n],s);for(const t in d)m(d[t],En(y,t),An(t,r),n,e)}}l=f,f+=v}return s.forEach(((t,r)=>{for(const o in t){const i=t[o];i.sort(Sn);const s=[],u=[],c=[];for(let t=0;t<i.length;t++){const{at:e,value:n,easing:r}=i[t];s.push(n),u.push(cn(0,p,e)),c.push(r||"easeOut")}0!==u[0]&&(u.unshift(0),s.unshift(s[0]),c.unshift(kn)),1!==u[u.length-1]&&(u.push(1),s.push(null)),a.has(r)||a.set(r,{keyframes:{},transition:{}});const l=a.get(r);l.keyframes[o]=s,l.transition[o]={...e,duration:p,ease:c,times:u,...n}}})),a}(t,e,n,{spring:rn});return o.forEach((({keyframes:t,transition:e},n)=>{r.push(..._a(n,t,e))})),r}const ka=function(t,e,n){let r=[];var o;o=t,r=Array.isArray(o)&&Array.isArray(o[0])?Sa(t,e,xa):_a(t,e,n,xa);const i=new Me(r);return xa&&xa.animations.push(i),i};var xa;function Aa(t){return Aa="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},Aa(t)}function Oa(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Oa=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 P(r||[]);return o(a,"_invoke",{value:O(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",h="suspendedYield",d="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"==Aa(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(Aa(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 Ea(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=ja(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 Ta(t){return function(t){if(Array.isArray(t))return Pa(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ja(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 ja(t,e){if(t){if("string"==typeof t)return Pa(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)?Pa(t,e):void 0}}function Pa(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 Ca(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,Ia(r.key),r)}}function La(t,e,n){return(e=Ia(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ia(t){var e=function(t,e){if("object"!=Aa(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Aa(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Aa(e)?e:e+""}var Na=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())}))},Ra=La(La(La({},_e,"25.33%"),we,"50%"),Se,"75.66%"),Ma=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,Ta(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&&Ca(t.prototype,e),n&&Ca(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"animate",value:function(e,n,r){var o=e.scope,i=e.overwrites,a=e.target;return Na(this,void 0,void 0,Oa().mark((function e(){var s=this;return Oa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){Na(s,void 0,void 0,Oa().mark((function s(){var u,c,l,f,p=this;return Oa().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:this.sequenceOptions.sync||e(),u=0;case 2:if(!(u<this.sequenceOptions.repeat)){s.next=22;break}c=Ea(this.sequences),s.prev=4,f=Oa().mark((function e(){var r,s,u,c,f,h;return Oa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=l.value,s=r.props,u=r.options,c=b({},p.propToCSS(n,a.state)),o.current){e.next=4;break}throw new Error("No scope found when animating.");case 4:if(f=o.current,Object.assign(f.style,c),a.state=t.mergeState(a.state,s),h=ka(f,p.propToCSS(n,a.state,i),p.optionsToFramerMotionOptions(u)||{}),p.setControl(h),n.logger.debug("Animating",p.propToCSS(n,a.state,i)),!1!==(null==u?void 0:u.sync)){e.next=14;break}h.then((function(){Object.assign(f.style,p.propToCSS(n,a.state,i)),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,a.state,i)),p.setControl(null);case 18:case"end":return e.stop()}}),e)})),c.s();case 7:if((l=c.n()).done){s.next=11;break}return s.delegateYield(f(),"t0",9);case 9:s.next=7;break;case 11:s.next=16;break;case 13:s.prev=13,s.t1=s.catch(4),c.e(s.t1);case 16:return s.prev=16,c.f(),s.finish(16);case 19:u++,s.next=2;break;case 22:return s.next=24,A(2);case 24:this.setControl(null),e(),r&&r(a.state);case 27:case"end":return s.stop()}}),s,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{}},rotation:function(){return{}},display:function(){return{}},src:function(){return{}},fontColor:function(t){return"string"==typeof t?{color:t}:{color:S(t)}}},c={};for(var l in c.transform=t.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:"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 Ce.isCommonPositionType(t)||Le.isCoord2DPosition(t)||Ie.isAlignPosition(t)}},{key:"positionToCSS",value:function(t,e,n){return t?Pe.isRawPosition(t)?Pe.D2PositionToCSS(Pe.rawPositionToCoord2D(t),n,e):Pe.D2PositionToCSS(t.toCSS(),n,e):{}}},{key:"backgroundToCSS",value:function(t){return null==t?{}:Es.isStaticImageData(t)?{backgroundImage:"url(".concat(t.src,")")}:"string"==typeof t?{backgroundColor:t}:["r","g","b"].every((function(e){return e in t}))?{backgroundColor:S(t)}:{backgroundImage:"url("+t.url+")"}}},{key:"mergePosition",value:function(t,e){if(!t&&!e)throw new Error("No position found.");return t&&e?Pe.mergePosition(Pe.tryParsePosition(t),Pe.tryParsePosition(e)):Pe.toCoord2D(Pe.tryParsePosition(t||e))}},{key:"mergeState",value:function(t,e){var n=this.mergePosition(t.position,e.position);return Object.assign(Object.assign({},b(t,e)),{position:n})}},{key:"propToCSSTransform",value:function(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.translate,i=void 0===o?[]:o,a=r.scale,s=void 0===a?1:a;if(!t.getLastScene())throw new Error('No scene found in state, make sure you called "scene.activate()" before this method.');var u=void 0!==e.scale?e.scale:1,c=(null===(n=t.getLastScene())||void 0===n?void 0:n.config)||{},l=c.invertY,f=c.invertX;return["translate(".concat(i[0]||(f?"":"-")+"50%",", ").concat(i[1]||(l?"":"-")+"50%",")"),void 0!==e.rotation&&"rotate(".concat(e.rotation,"deg)"),"scale(".concat(u*s,")")].filter(Boolean).join(" ")}}])}();function Fa(t){return Fa="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},Fa(t)}function Da(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,Ba(r.key),r)}}function Ba(t){var e=function(t,e){if("object"!=Fa(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Fa(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Fa(e)?e:e+""}function Va(t,e,n){return e=Ua(e),function(t,e){if(e&&("object"==Fa(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||[],Ua(t).constructor):e.apply(t,n))}function Ga(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ga=function(){return!!t})()}function Ua(t){return Ua=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ua(t)}function za(t,e){return za=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},za(t,e)}Ma.defaultSequenceOptions={sync:!0,repeat:1},Ma.defaultOptions={duration:0,ease:"linear"},Ma.CommonImagePositionMap=Ra;var Wa=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Va(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&&za(t,e)}(e,t),function(t,e,n){return e&&Da(t.prototype,e),n&&Da(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"do",value:function(t){return this.push(Kt.ActionTypes.do,t)}},{key:"doAsync",value:function(t){return this.push(Kt.ActionTypes.doAsync,t)}},{key:"any",value:function(t){return this.push(Kt.ActionTypes.any,t)}},{key:"all",value:function(t){return this.push(Kt.ActionTypes.all,t)}},{key:"allAsync",value:function(t){return this.push(Kt.ActionTypes.allAsync,t)}},{key:"repeat",value:function(t,e){return this.push(Kt.ActionTypes.repeat,e,t)}},{key:"sleep",value:function(t){return this.push(Kt.ActionTypes.sleep,[],t)}},{key:"push",value:function(t,e){for(var n=ce.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 Kt(this.chain(),t,(new Tt).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)}},{key:"sleep",value:function(t){return(new e).sleep(t)}}])}(be);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 $a(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Ya(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)?Ya(t,e):void 0}}(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 Ya(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 qa(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 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+""}function Ka(t,e,n){return e=Qa(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,Za()?Reflect.construct(e,n||[],Qa(t).constructor):e.apply(t,n))}function Za(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Za=function(){return!!t})()}function Qa(t){return Qa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Qa(t)}function Ja(t,e){return Ja=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ja(t,e)}var ts=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},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=Ka(this,e)).events=new k,t.ref=void 0,"string"==typeof n?(t.name=n,t.config=b(e.defaultConfig,r||{}),t.config.position&&(t.config.position=Pe.tryParsePosition(t.config.position))):(t.name="",t.config=b(e.defaultConfig,n),t.config.position&&(t.config.position=Pe.tryParsePosition(t.config.position))),t.state=b({},t.config),t.checkConfig(t.config),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&&Ja(t,e)}(e,t),function(t,e,n){return e&&qa(t.prototype,e),n&&qa(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(t){if(!Ma.isPosition(t.position))throw new Error("Invalid position\nPosition must be one of CommonImagePosition, Align, Coord2D");var e,n=$a(t.wearables);try{for(n.s();!(e=n.n()).done;){var r=e.value;if(!r.config.isWearable)throw new Error("Invalid wearable\nWearable must be an Image with isWearable set to true\nIt seems like you are trying to add a non-wearable image to wearables\nImage below violates the rule:\n"+JSON.stringify(r.config))}}catch(t){n.e(t)}finally{n.f()}return this}},{key:"setSrc",value:function(t,e){var n=this;return this.combineActions(new Wa,(function(r){if(e){var o=e.copy();o.setSrc(Es.srcToString(t)),r._transitionSrc(o)}var i=new ds(r,ds.ActionTypes.setSrc,(new Tt).setContent(["string"==typeof t?t:Es.staticImageDataToSrc(t)]));return r.chain(i).chain(n._flush())}))}},{key:"applyTransform",value:function(t){var e=this;return this.combineActions(new Wa,(function(n){var r=new ds(n,ds.ActionTypes.applyTransform,(new Tt).setContent([void 0,t.copy(),x()]));return n.chain(r).chain(e._flush())}))}},{key:"show",value:function(t){var e=this,n=t instanceof Ma?t.copy():new Ma([{props:{opacity:1},options:t||{}}]);return this.combineActions(new Wa,(function(t){var r=new ds(t,ds.ActionTypes.show,(new Tt).setContent([void 0,n]));return t.chain(r).chain(e._flush())}))}},{key:"hide",value:function(t){var e=this;return this.combineActions(new Wa,(function(n){var r=new ds(n,ds.ActionTypes.hide,(new Tt).setContent([void 0,t instanceof Ma?t.copy():new Ma([{props:{opacity:0},options:t||{}}])]));return n.chain(r).chain(e._flush())}))}},{key:"addWearable",value:function(t){var e,n=$a(Array.isArray(t)?t:[t]);try{for(n.s();!(e=n.n()).done;){var r=e.value;this.config.wearables.push(r),r.config.isWearable=!0}}catch(t){n.e(t)}finally{n.f()}return this}},{key:"bindWearable",value:function(t){return t.addWearable(this),this}},{key:"toTransform",value:function(){return new Ma(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||O(this.state,this.config)?null:{state:b({},e.serializeImageState(this.state))}}},{key:"fromData",value:function(t){return this.state=b(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 ds(this.chain(),"image:applyTransition",(new Tt).setContent([t])))}},{key:"_init",value:function(t){return new ds(this.chain(),ds.ActionTypes.init,(new Tt).setContent([t]))}},{key:"_initWearable",value:function(t){return new ds(this.chain(),ds.ActionTypes.initWearable,(new Tt).setContent([t]))}},{key:"_flush",value:function(){return new ds(this.chain(),ds.ActionTypes.flush,new Tt)}},{key:"reset",value:function(){this.state=b({},this.config)}},{key:"toDisplayableTransform",value:function(){return new Ma(this.state,{duration:0})}},{key:"getTransformState",value:function(){return{position:this.state.position,scale:this.state.scale,rotation:this.state.rotation,opacity:this.state.opacity,display:this.state.display}}},{key:"_transitionSrc",value:function(t){var e=t.copy();return this._applyTransition(e),this}},{key:"_dispose",value:function(){return this.chain(new ds(this.chain(),ds.ActionTypes.dispose,new Tt))}}],[{key:"serializeImageState",value:function(t){var e={position:function(t){return Pe.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 Pe.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}}])}(be);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){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 rs(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)?rs(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 rs(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 os(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */os=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 P(r||[]);return o(a,"_invoke",{value:O(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",h="suspendedYield",d="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"==es(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(es(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 is(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,as(r.key),r)}}function as(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 ss(t,e,n){return e=fs(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,us()?Reflect.construct(e,n||[],fs(t).constructor):e.apply(t,n))}function us(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(us=function(){return!!t})()}function cs(t,e,n,r){var o=ls(fs(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function ls(){return ls="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=fs(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}},ls.apply(null,arguments)}function fs(t){return fs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},fs(t)}function ps(t,e){return ps=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ps(t,e)}ts.EventTypes={"event:displayable.applyTransition":"event:displayable.applyTransition","event:displayable.applyTransform":"event:displayable.applyTransform","event:displayable.init":"event:displayable.init","event:wearable.create":"event:wearable.create"},ts.defaultConfig={src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",display:!1,position:new Ce(ge.Center),scale:1,rotation:0,opacity:0,isWearable:!1,wearables:[]};var hs=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())}))},ds=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ss(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&&ps(t,e)}(e,t),function(t,e,n){return e&&is(t.prototype,e),n&&is(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var r=this,o=Object.create(null,{executeAction:{get:function(){return cs(e,"executeAction",r,1)}},unknownType:{get:function(){return cs(e,"unknownType",r,1)}}});if(this.type===n.init){if(this.callee.config.isWearable)throw new Error("Cannot init wearable image with init action\nIt seems like you are trying to init a wearable image with an init action, or use this wearable image without parent.");var i=t.findElementByDisplayable(this.callee);i&&t.disposeImage(this.callee,i.scene);var a=this.contentNode.getContent()[0];return t.createImage(this.callee,a),this.resolveAwaitable((function(e){return hs(r,void 0,void 0,os().mark((function n(){return os().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.callee.events.any("event:displayable.init");case 2:e(o.executeAction.call(this,t)),t.stage.next();case 4:case"end":return n.stop()}}),n,this)})))}))}if(this.type===n.initWearable){var s=ns(this.contentNode.getContent(),1)[0];return this.resolveAwaitable((function(e){return hs(r,void 0,void 0,os().mark((function n(){return os().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.callee.events.any("event:wearable.create",s);case 2:return n.next=4,s.events.any("event:displayable.init");case 4:e(o.executeAction.call(this,t)),t.stage.next();case 6:case"end":return n.stop()}}),n,this)})))}))}if(this.type===n.setSrc)return this.callee.state.src=this.contentNode.getContent()[0],t.logger.debug("Image - Set Src",this.callee.state.src),t.stage.update(),o.executeAction.call(this,t);if([n.show,n.hide,n.applyTransform].includes(this.type)){var u=new w((function(t){return t})).registerSkipController(new T((function(){return r.type===n.hide&&(r.callee.state.display=!1),o.executeAction.call(r,t)}))),c=this.contentNode.getContent()[1];return this.type===n.show&&(this.callee.state.display=!0,t.stage.update()),t.animateImage(ts.EventTypes["event:displayable.applyTransform"],this.callee,[c],(function(){var t;r.type===n.hide&&(r.callee.state.display=!1),u.resolve({type:r.type,node:null===(t=r.contentNode)||void 0===t?void 0:t.getChild()})})),u}if(this.type===n.dispose)return t.disposeImage(this.callee),this.callee._$setDispose(),o.executeAction.call(this,t);if(this.type===n.applyTransition){var l=new w((function(t){return t})).registerSkipController(new T((function(){return r.type===n.hide&&(r.callee.state.display=!1),{type:r.type,node:r.contentNode.getChild()}}))),f=this.contentNode.getContent()[0];return this.callee.events.any("event:displayable.applyTransition",f).then((function(){l.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),l}if(this.type===n.flush)return o.executeAction.call(this,t);throw o.unknownType.call(this)}}])}($);function ys(t,e,n){return e=ws(e),function(t,e){if(e&&("object"==_s(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,gs()?Reflect.construct(e,n||[],ws(t).constructor):e.apply(t,n))}function vs(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&&bs(t,e)}function ms(t){var e="function"==typeof Map?new Map:void 0;return ms=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(gs())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var o=new(t.bind.apply(t,r));return n&&bs(o,n.prototype),o}(t,arguments,ws(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),bs(n,t)},ms(t)}function gs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(gs=function(){return!!t})()}function bs(t,e){return bs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},bs(t,e)}function ws(t){return ws=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ws(t)}function _s(t){return _s="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},_s(t)}function Ss(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ks(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,As(r.key),r)}}function xs(t,e,n){return e&&ks(t.prototype,e),n&&ks(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function As(t){var e=function(t,e){if("object"!=_s(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=_s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==_s(e)?e:e+""}ds.ActionTypes=n;var Os=function(){function t(e,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;Ss(this,t),this.r=e,this.g=n,this.b=r,this.a=o}return xs(t,[{key:"toString",value:function(){return"rgba(".concat(this.r,", ").concat(this.g,", ").concat(this.b,", ").concat(this.a,")")}},{key:"toHex",value:function(){return"#"+this.r.toString(16)+this.g.toString(16)+this.b.toString(16)}},{key:"toImageColor",value:function(){return{r:this.r,g:this.g,b:this.b,a:this.a}}}],[{key:"isHexString",value:function(t){return"string"==typeof t&&/^#[0-9A-F]{6}$/i.test(t)}},{key:"fromHex",value:function(e){var n=e.slice(1);return new t(parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16),8===n.length?parseInt(n.slice(6,8),16)/255:1)}}])}(),Es=function(){function t(){Ss(this,t)}return xs(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://")}},{key:"isImageSrc",value:function(e){return"string"==typeof e&&!this.isHexString(e)||t.isStaticImageData(e)}},{key:"isImageColor",value:function(e){return t.isHexString(e)||t.isPlainColor(e)}},{key:"isPlainColor",value:function(t){return t&&("string"==typeof t||"object"===_s(t)&&"r"in t&&"g"in t&&"b"in t)}},{key:"isHexString",value:function(t){return"string"==typeof t&&/^#([0-9A-F]{6}|[0-9A-F]{3})$/i.test(t)}},{key:"toBackgroundSrc",value:function(t){return"string"==typeof t?t:t.src}},{key:"toHex",value:function(t){return S(t)}}])}();Es.RGBColor=Os;var Ts,js=function(t){function e(t,n){return Ss(this,e),ys(this,e,[t,{info:n},"NarraLeafReact-StaticScriptWarning"])}return vs(e,t),xs(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 Ss(this,e),(r=ys(this,e,[t])).props=n,r.name=o,r}return vs(e,t),xs(e,null,[{key:"isUseError",value:function(t){return t instanceof e}}])}(ms(Error))),Ps=function(){return xs((function t(e){Ss(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,n,r){var o=n.imageStates,i=n.scenes;if(t instanceof ds)o.has(t.callee)||o.set(t.callee,{isDisposed:!1,usedExternalSrc:!1}),this.checkImage(o.get(t.callee),t);else if(t instanceof mt){var a=t.callee;if(i.has(a.name)){if(i.get(a.name)!==a){var s="Scene with name: ".concat(a.name," is duplicated\nScene: ").concat(a.name,"\n\nAt: ").concat(t.__stack);throw new js(s)}}else i.set(a.name,a);if(t.type===e.jumpTo){var u=t.contentNode.getContent()[0];if(r.has(u))return;r.add(u)}}}},{key:"checkImage",value:function(t,e){if(e.type===n.dispose){if(t.isDisposed){var r="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 js(r)}t.isDisposed=!0}else if([n.init,n.show,n.hide,n.applyTransform,n.applyTransition].includes(e.type)){if(t.isDisposed){var o="Image is disposed before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new js(o)}}else if(e.type===n.setSrc){var i=e.contentNode.getContent()[0];Es.isExternalSrc(i)&&(t.usedExternalSrc=!0)}}}])}();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,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,Is(r.key),r)}}function Is(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 Ns(t,e,n){return e=Ms(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,Rs()?Reflect.construct(e,n||[],Ms(t).constructor):e.apply(t,n))}function Rs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Rs=function(){return!!t})()}function Ms(t){return Ms=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ms(t)}function Fs(t,e){return Fs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Fs(t,e)}!function(t){t.soundEffect="soundEffect",t.music="music",t.voice="voice",t.backgroundMusic="backgroundMusic"}(Ts||(Ts={}));var Ds=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=Ns(this,e)).state={playing:null,token:null},t.config=b(e.defaultConfig,"string"==typeof n?{src:n}: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&&Fs(t,e)}(e,t),function(t,e,n){return e&&Ls(t.prototype,e),n&&Ls(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"play",value:function(){if(this.config.type===Ts.backgroundMusic)throw new Error("Background music cannot be played directly");return this.pushAction(ot.ActionTypes.play,[void 0])}},{key:"stop",value:function(){if(this.config.type===Ts.backgroundMusic)throw new Error("Background music cannot be stopped directly");return this.pushAction(ot.ActionTypes.stop,[void 0])}},{key:"fade",value:function(t,e,n){if(this.config.type===Ts.backgroundMusic)throw new Error("Background music cannot be faded directly");return this.pushAction(ot.ActionTypes.fade,[{start:t,end:e,duration:n}])}},{key:"setVolume",value:function(t){return this.pushAction(ot.ActionTypes.setVolume,[t])}},{key:"setRate",value:function(t){return this.pushAction(ot.ActionTypes.setRate,[t])}},{key:"pause",value:function(t){return void 0!==t?this.fade(void 0,0,t):this.pushAction(ot.ActionTypes.pause,[void 0])}},{key:"resume",value:function(t){return void 0!==t?this.fade(0,this.config.volume,t):this.pushAction(ot.ActionTypes.resume,[void 0])}},{key:"getHowlOptions",value:function(t){return Object.assign({src:this.config.src,loop:this.config.loop,volume:this.config.volume,html5:this.config.streaming,autoplay:!1},t||{})}},{key:"getSrc",value:function(){return this.config.src}},{key:"getToken",value:function(){return this.state.token||void 0}},{key:"getPlaying",value:function(){return this.state.playing}},{key:"setToken",value:function(t){this.state.token=void 0===t?null:t}},{key:"setPlaying",value:function(t){return this.state.playing=t,this}},{key:"toData",value:function(){return O(this.config,e.defaultConfig)?null:{config:_(this.config)}}},{key:"fromData",value:function(t){return this.config=b(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 ot(this.chain(),t,(new Tt).setContent(e)))}}],[{key:"toSoundSrc",value:function(t){return null==t?null:"string"==typeof t?t:t.getSrc()}},{key:"toSound",value:function(t){return null==t?null:"string"==typeof t?new e({src:t}):t}}])}(be);function Bs(t){return Bs="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},Bs(t)}function Vs(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,Gs(r.key),r)}}function Gs(t){var e=function(t,e){if("object"!=Bs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Bs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Bs(e)?e:e+""}Ds.defaultConfig={src:"",sync:!1,loop:!1,volume:1};var Us=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e}return function(t,e,n){return e&&Vs(t.prototype,e),n&&Vs(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,null,[{key:"from",value:function(e){return t.isPauseConstructor(e)?new t:e}},{key:"wait",value:function(e){return new t({duration:e})}},{key:"isPause",value:function(e){return this.isPauseConstructor(e)||e instanceof t}},{key:"isPauseConstructor",value:function(e){return e===t}}])}();function zs(t){return zs="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},zs(t)}function Ws(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,Hs(r.key),r)}}function Hs(t){var e=function(t,e){if("object"!=zs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=zs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==zs(e)?e:e+""}var $s=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.text=e,this.config=b(t.defaultConfig,n)}return function(t,e,n){return e&&Ws(t.prototype,e),n&&Ws(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"evaluate",value:function(e){var n=this;if(Us.isPause(this.text))return[this];if("function"==typeof this.text){var r=this.text(e);return Array.isArray(r)?r.map((function(r){return t.isWord(r)?r.inherit(n.config).evaluate(e):new t(r,n.config)})).flat():t.isWord(r)?r.inherit(this.config).evaluate(e):[new t(r,this.config)]}return[this]}},{key:"inherit",value:function(t){return this.config.color=this.config.color||t.color,this.config.italic=this.config.italic||t.italic,this.config.bold=this.config.bold||t.bold,this}}],[{key:"isWord",value:function(e){return e instanceof t}}])}();function Ys(t){return Ys="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},Ys(t)}function qs(t){return function(t){if(Array.isArray(t))return Xs(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 Xs(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)?Xs(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 Xs(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 Ks(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"!=Ys(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ys(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ys(e)?e:e+""}$s.defaultConfig={},$s.defaultColor="#000";var Qs=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.text=t.format(e),this.config=b(t.defaultConfig,Object.assign(Object.assign({},n),{voice:Ds.toSound(n.voice)})),this.state=_(t.defaultState)}return function(t,e,n){return e&&Ks(t.prototype,e),n&&Ks(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"toData",value:function(){return O(this.state,t.defaultState)?null:{state:_(this.state)}}},{key:"fromData",value:function(t){return this.state=b(this.state,t),this}},{key:"toString",value:function(){return this.text.map((function(t){return t.text})).join("")}},{key:"setCharacter",value:function(t){return this.config.character=t,this}},{key:"evaluate",value:function(e){for(var n=[],r=0;r<this.text.length;r++){var o=this.text[r].evaluate(e);n.push.apply(n,qs(t.formatStaticWord(o)))}return n}},{key:"copy",value:function(){return new t(qs(this.text),this.config)}}],[{key:"isSentence",value:function(e){return e instanceof t}},{key:"toSentence",value:function(e){return t.isSentence(e)?e:new t(e)}},{key:"format",value:function(t){var e=[];if(Array.isArray(t))for(var n=0;n<t.length;n++)e.push(this.formatWord(t[n]));else e.push(this.formatWord(t));return e}},{key:"formatWord",value:function(t){return $s.isWord(t)?t:new $s(t)}},{key:"formatStaticWord",value:function(t,e){var n=this;return Array.isArray(t)?t.map((function(t){return n.formatStaticWord(t,e)})).flat(2):[$s.isWord(t)?t:new $s(t,e)]}}])}();function Js(t){return Js="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},Js(t)}function tu(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,eu(r.key),r)}}function eu(t){var e=function(t,e){if("object"!=Js(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Js(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Js(e)?e:e+""}function nu(t,e,n){return e=au(e),function(t,e){if(e&&("object"==Js(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,ru()?Reflect.construct(e,n||[],au(t).constructor):e.apply(t,n))}function ru(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ru=function(){return!!t})()}function ou(t,e,n,r){var o=iu(au(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function iu(){return iu="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=au(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}},iu.apply(null,arguments)}function au(t){return au=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},au(t)}function su(t,e){return su=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},su(t,e)}Qs.defaultConfig={color:"#000",pause:!0,voice:null,character:null},Qs.defaultState={display:!0};var uu=function(e){function n(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),nu(this,n,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&&su(t,e)}(n,e),function(t,e,n){return e&&tu(t.prototype,e),n&&tu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"executeAction",value:function(e){var r=this;if(this.type===t.say){var o=new w((function(t){return t})).registerSkipController(new T((function(){return{type:r.type,node:r.contentNode.getChild()}}))),i=this.contentNode.getContent(),a=i.config.voice;return a&&(ot.initSound(e,a),e.playSound(a,(function(){e.stopSound(a)}))),e.createText(this.getId(),i,(function(){a&&e.stopSound(a),o.resolve({type:r.type,node:r.contentNode.getChild()})})),o}if(this.type===t.setName)return this.callee.state.name=this.contentNode.getContent()[0],ou(n,"executeAction",this,3)([e]);throw ou(n,"unknownType",this,3)([])}}])}($);function cu(t){return cu="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},cu(t)}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,fu(r.key),r)}}function fu(t){var e=function(t,e){if("object"!=cu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=cu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==cu(e)?e:e+""}function pu(t,e,n){return e=du(e),function(t,e){if(e&&("object"==cu(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,hu()?Reflect.construct(e,n||[],du(t).constructor):e.apply(t,n))}function hu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(hu=function(){return!!t})()}function du(t){return du=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},du(t)}function yu(t,e){return yu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},yu(t,e)}uu.ActionTypes=t;var vu=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=pu(this,e)).config=b(e.defaultConfig,r),n.state={name:t||""},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&&yu(t,e)}(e,t),function(t,e,n){return e&&lu(t.prototype,e),n&&lu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"say",value:function(t,e){var n=Array.isArray(t)?new Qs(t,Object.assign(Object.assign({},e||{}),{character:this})):(Qs.isSentence(t)?t:new Qs(t,Object.assign(Object.assign({},e||{}),{character:this}))).copy();n.setCharacter(this);var r=new uu(this.chain(),uu.ActionTypes.say,(new Tt).setContent(n));return this.chain(r)}},{key:"setName",value:function(t){var e=new uu(this.chain(),uu.ActionTypes.setName,(new Tt).setContent([t]));return this.chain(e)}}])}(be);function mu(t){return mu="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},mu(t)}function gu(t){return function(t){if(Array.isArray(t))return bu(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 bu(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)?bu(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 bu(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 wu(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,_u(r.key),r)}}function _u(t){var e=function(t,e){if("object"!=mu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=mu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==mu(e)?e:e+""}function Su(t,e,n){return e=Au(e),function(t,e){if(e&&("object"==mu(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,ku()?Reflect.construct(e,n||[],Au(t).constructor):e.apply(t,n))}function ku(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ku=function(){return!!t})()}function xu(){return xu="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Au(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}},xu.apply(null,arguments)}function Au(t){return Au=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Au(t)}function Ou(t,e){return Ou=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ou(t,e)}vu.defaultConfig={color:"#000"};var Eu=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Su(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&&Ou(t,e)}(e,t),function(t,e,n){return e&&wu(t.prototype,e),n&&wu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(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(gu(this.callee._getFutureActions()),gu(function(t,e,n,r){var o=xu(Au(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"getFutureActions",this,3)([])))}}])}($);function Tu(t){return Tu="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},Tu(t)}function ju(t){return function(t){if(Array.isArray(t))return Cu(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Pu(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 Pu(t,e){if(t){if("string"==typeof t)return Cu(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)?Cu(t,e):void 0}}function Cu(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 Lu(t,e,n){return e=Nu(e),function(t,e){if(e&&("object"==Tu(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,Iu()?Reflect.construct(e,n||[],Nu(t).constructor):e.apply(t,n))}function Iu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Iu=function(){return!!t})()}function Nu(t){return Nu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Nu(t)}function Ru(t,e){return Ru=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ru(t,e)}function Mu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Fu(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,Bu(r.key),r)}}function Du(t,e,n){return e&&Fu(t.prototype,e),n&&Fu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Bu(t){var e=function(t,e){if("object"!=Tu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Tu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Tu(e)?e:e+""}Eu.ActionTypes={action:"condition:action"};var Vu=function(){return Du((function t(e){Mu(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()}}}])}(),Gu=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Mu(this,e),(t=Lu(this,e)).conditions={If:{condition:null,action:null},ElseIf:[],Else:{action:null}},t.config=b(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&&Ru(t,e)}(e,t),Du(e,[{key:"If",value:function(t,e){if(this.conditions.If.condition)throw new js("IF condition already set\nYou are trying to set multiple IF conditions for the same condition");if(this.conditions.ElseIf.length)throw new js("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 js("ELSE condition already set\nYou are trying to set an IF condition after an ELSE condition");return this.conditions.If.condition=t instanceof Vu?t:new Vu(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 js("IF condition not set\nYou are trying to set an ELSE-IF condition without an IF condition");if(this.conditions.Else.action)throw new js("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 Vu?t:new Vu(t),action:this.construct(Array.isArray(e)?e:[e])}),this.chain()}},{key:"Else",value:function(t){if(!this.conditions.If.condition)throw new js("IF condition not set\nYou are trying to set an ELSE condition without an IF condition");if(this.conditions.Else.action)throw new js("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=Pu(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(Eu,[this,Eu.ActionTypes.action,(new Tt).setContent(t.conditions)])]}},{key:"construct",value:function(t,e,n){for(var r,o=ce.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 ce.toActions([].concat(ju(this.conditions.If.action||[]),ju(this.conditions.ElseIf.flatMap((function(t){return t.action||[]}))),ju(this.conditions.Else.action||[])))}}],[{key:"getInitialState",value:function(){return{If:{condition:null,action:null},ElseIf:[],Else:{action:null}}}}])}(be);function Uu(t){return Uu="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},Uu(t)}function zu(t){return function(t){if(Array.isArray(t))return Wu(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 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)||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 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 Hu(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,$u(r.key),r)}}function $u(t){var e=function(t,e){if("object"!=Uu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Uu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Uu(e)?e:e+""}function Yu(t,e,n){return e=Ku(e),function(t,e){if(e&&("object"==Uu(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,qu()?Reflect.construct(e,n||[],Ku(t).constructor):e.apply(t,n))}function qu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(qu=function(){return!!t})()}function Xu(){return Xu="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Ku(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}},Xu.apply(null,arguments)}function Ku(t){return Ku=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ku(t)}function Zu(t,e){return Zu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Zu(t,e)}Gu.defaultConfig={};var Qu=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Yu(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&&Zu(t,e)}(e,t),function(t,e,n){return e&&Hu(t.prototype,e),n&&Hu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var e=this,n=new w((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(zu(this.callee._getFutureActions(t.choices)),zu(function(t,e,n,r){var o=Xu(Ku(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"getFutureActions",this,3)([])))}}])}($);function Ju(t){return Ju="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},Ju(t)}function tc(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 ec(t){var e=function(t,e){if("object"!=Ju(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ju(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ju(e)?e:e+""}function nc(t,e,n){return e=oc(e),function(t,e){if(e&&("object"==Ju(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,rc()?Reflect.construct(e,n||[],oc(t).constructor):e.apply(t,n))}function rc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(rc=function(){return!!t})()}function oc(t){return oc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},oc(t)}function ic(t,e){return ic=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ic(t,e)}Qu.ActionTypes={action:"menu:action"};var ac=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=nc(this,e)).choices=[],n.prompt=Qs.isSentence(t)?t:new Qs(t),n.config=b(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&&ic(t,e)}(e,t),function(t,e,n){return e&&tc(t.prototype,e),n&&tc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"choose",value:function(t,e){var n=this.chain();return Qs.isSentence(t)&&e||($s.isWord(t)||Array.isArray(t)||"string"==typeof t)&&e?n.choices.push({prompt:Qs.toSentence(t),action:ce.toActions(e)}):"object"===Ju(t)&&"prompt"in t&&"action"in t?n.choices.push({prompt:Qs.toSentence(t.prompt),action:ce.toActions(t.action)}):console.warn("No valid choice added to menu, ",{arg0:t,arg1:e}),n}},{key:"fromChained",value:function(t){return[new Qu(this.chain(),Qu.ActionTypes.action,(new Tt).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}}))}}])}(be);function sc(t){return sc="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},sc(t)}function uc(t){return function(t){if(Array.isArray(t))return cc(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 cc(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)?cc(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 cc(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 lc(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,fc(r.key),r)}}function fc(t){var e=function(t,e){if("object"!=sc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=sc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==sc(e)?e:e+""}function pc(t,e,n){return e=dc(e),function(t,e){if(e&&("object"==sc(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,hc()?Reflect.construct(e,n||[],dc(t).constructor):e.apply(t,n))}function hc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(hc=function(){return!!t})()}function dc(t){return dc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},dc(t)}function yc(t,e){return yc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},yc(t,e)}ac.defaultConfig={},ac.targetAction=Qu;var vc=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),pc(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&&yc(t,e)}(e,t),function(t,e,n){return e&&lc(t.prototype,e),n&&lc(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,uc(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,uc(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}}])}(le);function mc(t){return mc="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},mc(t)}function gc(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,bc(r.key),r)}}function bc(t){var e=function(t,e){if("object"!=mc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=mc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==mc(e)?e:e+""}var wc=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&&gc(t.prototype,e),n&&gc(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 Ds){if(this.isSrcRegistered(t.getSrc()))return this;this.src.push({type:"audio",src:t})}else if(t instanceof ts||Es.isStaticImageData(t)){if(t instanceof ts){if(this.isSrcRegistered(Es.srcToString(t.state.src)))return this}else if(this.isSrcRegistered(Es.srcToString(t.src)))return this;this.src.push({type:"image",src:t instanceof ts?t:new ts("",{src:Es.staticImageDataToSrc(t)})})}else if("object"===mc(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 Ds?e:new Ds({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 Ds?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===Es.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 _c(t){return _c="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},_c(t)}function Sc(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,kc(r.key),r)}}function kc(t){var e=function(t,e){if("object"!=_c(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=_c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==_c(e)?e:e+""}function xc(t,e,n){return e=Tc(e),function(t,e){if(e&&("object"==_c(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,Ac()?Reflect.construct(e,n||[],Tc(t).constructor):e.apply(t,n))}function Ac(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ac=function(){return!!t})()}function Oc(t,e,n,r){var o=Ec(Tc(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function Ec(){return Ec="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Tc(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}},Ec.apply(null,arguments)}function Tc(t){return Tc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Tc(t)}function jc(t,e){return jc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},jc(t,e)}wc.SrcTypes={image:"image",video:"video",audio:"audio"};var Pc=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),xc(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&&jc(t,e)}(e,t),function(t,e,n){return e&&Sc(t.prototype,e),n&&Sc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===s.init){var r=t.findElementByDisplayable(this.callee);r&&t.disposeDisplayable(this.callee,r.scene);var o=this.contentNode.getContent()[0];t.createDisplayable(this.callee,o);var i=new w((function(t){return t}));return this.callee.events.any("event:displayable.init").then((function(){i.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),i}if([s.show,s.hide,s.applyTransform].includes(this.type)){var a=new w((function(t){return t})).registerSkipController(new T((function(){return n.type===s.hide&&(n.callee.state.display=!1),Oc(e,"executeAction",n,3)([t])}))),u=this.contentNode.getContent()[0];return this.type===s.show&&(this.callee.state.display=!0,t.stage.update()),t.animateText(al.EventTypes["event:displayable.applyTransform"],this.callee,[u],(function(){n.type===s.hide&&(n.callee.state.display=!1),a.resolve(Oc(e,"executeAction",n,3)([t]))})),a}if(this.type===s.setText)return this.callee.state.text=this.contentNode.getContent()[0],Oc(e,"executeAction",this,3)([t]);if(this.type===s.setFontSize){this.callee.state.fontSize=this.contentNode.getContent()[0];var c=new Ma([],{duration:0}),l=new w;return t.animateText(al.EventTypes["event:displayable.applyTransform"],this.callee,[c],(function(){l.resolve(Oc(e,"executeAction",n,3)([t]))})),l}if(this.type===s.applyTransition){var f=(new w).registerSkipController(new T((function(){return t.logger.info("NarraLeaf-React: Text Transition","Skipped"),{type:n.type,node:n.contentNode.getChild()}}))),p=this.contentNode.getContent()[0];return this.callee.events.any("event:displayable.applyTransition",p).then((function(){f.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),f}throw Oc(e,"unknownType",this,3)([])}}])}($);Pc.ActionTypes=s;var Cc={start:"start",update:"update",end:"end"};function Lc(t){return Lc="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},Lc(t)}function Ic(t,e,n){return e=Rc(e),function(t,e){if(e&&("object"==Lc(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,Nc()?Reflect.construct(e,n||[],Rc(t).constructor):e.apply(t,n))}function Nc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Nc=function(){return!!t})()}function Rc(t){return Rc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Rc(t)}function Mc(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&&Fc(t,e)}function Fc(t,e){return Fc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Fc(t,e)}function Dc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Bc(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,Gc(r.key),r)}}function Vc(t,e,n){return e&&Bc(t.prototype,e),n&&Bc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Gc(t){var e=function(t,e){if("object"!=Lc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Lc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Lc(e)?e:e+""}var Uc=function(){return Vc((function t(){Dc(this,t),this.events=new k}),[{key:"start",value:function(t){throw new Error("Method not implemented.")}},{key:"toElementProps",value:function(){throw new Error("Method not implemented.")}},{key:"copy",value:function(){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(Cc.start,null),this.controller=ka(o,i,Object.assign({duration:a/1e3,onUpdate:function(t){u&&u(t),r.events.emit(Cc.update,r.toElementProps())},onComplete:function(){r.controller=void 0,r.events.emit(Cc.end,null),s&&s()}},n)),this.controller}}])}(),zc=function(t){function e(){return Dc(this,e),Ic(this,e,arguments)}return Mc(e,t),Vc(e,[{key:"setSrc",value:function(t){throw new Error("Method not implemented.")}},{key:"copy",value:function(){throw new Error("Method not implemented.")}}])}(Uc),Wc=function(t){function e(){return Dc(this,e),Ic(this,e,arguments)}return Mc(e,t),Vc(e,[{key:"copy",value:function(){throw new Error("Method not implemented.")}}])}(Uc);function Hc(t){return Hc="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},Hc(t)}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,Yc(r.key),r)}}function Yc(t){var e=function(t,e){if("object"!=Hc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Hc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Hc(e)?e:e+""}function qc(t,e,n){return e=Kc(e),function(t,e){if(e&&("object"==Hc(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,Xc()?Reflect.construct(e,n||[],Kc(t).constructor):e.apply(t,n))}function Xc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Xc=function(){return!!t})()}function Kc(t){return Kc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Kc(t)}function Zc(t,e){return Zc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Zc(t,e)}var Qc=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=qc(this,e)).state={fontSize:0},r.startValue=t,r.endValue=n,r.duration=o,r.easing=i,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&&Zc(t,e)}(e,t),function(t,e,n){return e&&$c(t.prototype,e),n&&$c(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"start",value:function(t){var e=this;this.state.fontSize=this.startValue,this.requestAnimation({start:this.startValue,end:this.endValue,duration:this.duration},{onComplete:function(){e.state.fontSize=e.endValue,t&&t()},onUpdate:function(t){e.state.fontSize=t}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{fontSize:this.state.fontSize}}]}},{key:"copy",value:function(){return new e(this.startValue,this.endValue,this.duration,this.easing)}}])}(Wc);function Jc(t){return Jc="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},Jc(t)}function tl(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,el(r.key),r)}}function el(t){var e=function(t,e){if("object"!=Jc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Jc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Jc(e)?e:e+""}function nl(t,e,n){return e=ol(e),function(t,e){if(e&&("object"==Jc(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,rl()?Reflect.construct(e,n||[],ol(t).constructor):e.apply(t,n))}function rl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(rl=function(){return!!t})()}function ol(t){return ol=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ol(t)}function il(t,e){return il=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},il(t,e)}Qc.Frames=[1,0];var al=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=nl(this,e)).events=new k,n.config="string"==typeof t?b({},e.defaultConfig,r,{text:t}):b({},e.defaultConfig,t),n.state=b({},n.config),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&&il(t,e)}(e,t),function(t,e,n){return e&&tl(t.prototype,e),n&&tl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"applyTransform",value:function(t){var e=this.chain(),n=new Pc(e,Pc.ActionTypes.applyTransform,(new Tt).setContent([t.copy()]));return e.chain(n)}},{key:"applyTransition",value:function(t){var e=this.chain(),n=this._applyTransition(e,t);return e.chain(n)}},{key:"show",value:function(t){var e=this.chain(),n=t instanceof Ma?t.copy():new Ma([{props:{opacity:1},options:t||{}}]),r=new Pc(e,Pc.ActionTypes.show,(new Tt).setContent([n]));return e.chain(r)}},{key:"hide",value:function(t){var e=this.chain(),n=t instanceof Ma?t.copy():new Ma([{props:{opacity:1},options:t||{}}]),r=new Pc(e,Pc.ActionTypes.hide,(new Tt).setContent([n]));return e.chain(r)}},{key:"setText",value:function(t){var e=this.chain(),n=new Pc(e,Pc.ActionTypes.setText,(new Tt).setContent([t]));return e.chain(n)}},{key:"setFontSize",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0;return this.combineActions(new Wa,(function(o){if(n){var i=new Qc(e.state.fontSize,t,n,r);o.chain(e._applyTransition(o,i))}var a=new Pc(o,Pc.ActionTypes.setFontSize,(new Tt).setContent([t]));return o.chain(a)}))}},{key:"toData",value:function(){return{state:b({},ts.serializeImageState(this.state))}}},{key:"fromData",value:function(t){return this.state=b({},ts.deserializeImageState(t.state)),this}},{key:"toTransform",value:function(){return new Ma(this.state,{duration:0})}},{key:"toDisplayableTransform",value:function(){return new Ma(this.state,{duration:0})}},{key:"_init",value:function(t){return new Pc(this.chain(),Pc.ActionTypes.init,(new Tt).setContent([t]))}},{key:"_applyTransition",value:function(t,e){return new Pc(t,Pc.ActionTypes.applyTransition,(new Tt).setContent([e]))}}])}(be);function sl(t){return sl="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},sl(t)}function ul(t){return function(t){if(Array.isArray(t))return ll(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||cl(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 cl(t,e){if(t){if("string"==typeof t)return ll(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)?ll(t,e):void 0}}function ll(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 fl(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,pl(r.key),r)}}function pl(t){var e=function(t,e){if("object"!=sl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=sl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==sl(e)?e:e+""}function hl(t,e,n){return e=vl(e),function(t,e){if(e&&("object"==sl(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,dl()?Reflect.construct(e,n||[],vl(t).constructor):e.apply(t,n))}function dl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(dl=function(){return!!t})()}function yl(){return yl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=vl(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}},yl.apply(null,arguments)}function vl(t){return vl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vl(t)}function ml(t,e){return ml=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ml(t,e)}al.EventTypes={"event:text.show":"event:text.show","event:text.hide":"event:text.hide","event:displayable.applyTransition":"event:displayable.applyTransition","event:displayable.applyTransform":"event:displayable.applyTransform","event:displayable.init":"event:displayable.init"},al.defaultConfig={position:new Ce(Ce.Positions.Center),scale:1,rotation:0,opacity:0,alignX:"center",alignY:"center",fontSize:16,fontColor:"#000000",display:!1,text:""};var gl=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n},bl=function(t){function r(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.defaultConfig;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),(e=hl(this,r)).srcManager=new wc,e.events=new k,e.name=t;var o=b(r.defaultConfig,n),i=o.background,a=gl(o,["background"]);return e.config=Object.assign(Object.assign({},a),{backgroundImage:new ts({opacity:1}),background:i||null}),e.state=b(e.config,{}),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&&ml(t,e)}(r,t),function(t,e,n){return e&&fl(t.prototype,e),n&&fl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(r,[{key:"toBackground",value:function(t){if(Es.isImageSrc(t)||Es.isImageColor(t))return t;if(t instanceof Os)return t.toImageColor();throw new Error("Invalid background type")}},{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){var n=this;return this.combineActions(new Wa,(function(r){if(e){var o=e.copy();o.setSrc(n.toBackground(t)),r._transitionToScene(void 0,o,n.toBackground(t))}return r.chain(new mt(r,"scene:setBackground",(new Tt).setContent([t])))}))}},{key:"applyTransform",value:function(t){return this.chain(new mt(this.chain(),"scene:applyTransform",(new Tt).setContent([t.copy()])))}},{key:"jumpTo",value:function(t,e){var n=this;return this.combineActions(new Wa,(function(r){var o=e||{};return r.chain(new mt(r,"scene:preUnmount",(new Tt).setContent([])))._transitionToScene(t,o.transition).chain(t._init()).chain(n._exit())._jumpTo(t)}))}},{key:"sleep",value:function(t){return this.chain(new mt(this.chain(),"scene:sleep",(new Tt).setContent(t)))}},{key:"setBackgroundMusic",value:function(t,n){return this.chain(new mt(this.chain(),e.setBackgroundMusic,(new Tt).setContent([t,n])))}},{key:"toData",value:function(){var t;return{state:Object.assign(Object.assign({},_(this.state)),{backgroundMusic:null===(t=this.state.backgroundMusic)||void 0===t?void 0:t.toData(),background:this.state.background}),backgroundImageState:this.state.backgroundImage.toData()}}},{key:"fromData",value:function(t){var e=this;return L(t,{state:function(t){L(t,{backgroundMusic:function(t){t&&(e.state.backgroundMusic=(new Ds).fromData(t))},background:function(t){t&&(e.state.background=t)}})},backgroundImageState:function(t){t&&(e.state.backgroundImage=(new ts).fromData(t))}}),this}},{key:"getInitTransform",value:function(){return new Ma([{props:Object.assign(Object.assign({},this.state.backgroundImage.state),{opacity:1}),options:{duration:0}}])}},{key:"action",value:function(t){var e=(Array.isArray(t)?t.flat(2):t(this).flat(2)).map((function(t){return ce.isChained(t)?t.fromChained(t):t})).flat(2),n=[],o=[];this.getAllChildrenElements(e).forEach((function(t){ce.isChained(t)||(t instanceof ts?n.push(t):t instanceof al&&o.push(t))}));var i=[],a=[],s=new Map;n.forEach((function(t){var e;t.config.isWearable?a.push(t):i.push(t);var n,r=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=cl(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.config.wearables);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(s.get(o)&&s.get(o)!==t)throw new Error("Wearable image cannot be used multiple times\nYou may bind the same wearable image to multiple parent images\nParent Conflict: "+(null===(e=s.get(o))||void 0===e?void 0:e.getId())+"\nCurrent Parent: "+t.getId());s.set(o,t)}}catch(t){r.e(t)}finally{r.f()}}));var u=[this._init(this)].concat(ul(i.map((function(t){return t._init()}))),ul(a.map((function(t){if(!s.has(t))throw new Error("Wearable image must have a parent image");return s.get(t)._initWearable(t)}))),ul(o.map((function(t){return t._init()}))),ul(e)),c=function(t,e,n,r){var o=yl(vl(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(r,"constructNodes",this,3)([u]),l=new Tt(void 0,void 0,c||void 0).setContent(this);return null==c||c.setParent(l),this.sceneRoot=new mt(this.chain(),"scene:action",l),this}},{key:"registerSrc",value:function(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Set;if(this.sceneRoot){var o=new Set,i=new Set,a=[this.sceneRoot],s=new Set;for(Es.isImageSrc(this.config.background)&&this.srcManager.register(new ts({src:Es.toBackgroundSrc(this.config.background)}));a.length;){var u=a.shift();if(!o.has(u)){if(o.add(u),u instanceof mt){if(u.type===e.jumpTo){var c=u,l=c.contentNode.getContent()[0];if(i.has(c)||r.has(l))continue;i.add(c),s.add(l),r.add(l)}else if(u.type===e.setBackground){var f=u.contentNode.getContent()[0],p=Es.backgroundToSrc(f);p&&this.srcManager.register(new ts({src:p}))}}else if(u instanceof ds){var h=u;if(this.srcManager.register(h.callee),u.type===n.setSrc){var d=u.contentNode.getContent()[0];this.srcManager.register(new ts({src:d}))}else if(u.type===n.initWearable){var y=u.contentNode.getContent()[0];this.srcManager.register(y)}}else if(u instanceof ot)this.srcManager.register(u.callee);else if(u instanceof Kt){var v=u.getFutureActions();a.push.apply(a,ul(v))}a.push.apply(a,ul(u.getFutureActions()))}}s.forEach((function(e){e.registerSrc(r),t.srcManager.registerFuture(e.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=b(r.defaultState,this.config),this.state.backgroundImage.reset()}},{key:"toDisplayableTransform",value:function(){return this.state.backgroundImage.toDisplayableTransform()}},{key:"_applyTransition",value:function(t){return this.chain(new mt(this.chain(),"scene:applyTransition",(new Tt).setContent([t])))}},{key:"_jumpTo",value:function(t){return this.chain(new mt(this.chain(),"scene:jumpTo",(new Tt).setContent([t])))}},{key:"_exit",value:function(){return new mt(this.chain(),"scene:exit",(new Tt).setContent([]))}},{key:"_transitionToScene",value:function(t,e,n){var r=this.chain();if(e){var o=e.copy();t&&t.config.background&&o.setSrc(t.config.background),n&&o.setSrc(n),r._applyTransition(o)}return r}},{key:"_init",value:function(){return new mt((arguments.length>0&&void 0!==arguments[0]?arguments[0]:this).chain(),"scene:init",(new Tt).setContent([]))}}])}(vc);function wl(t){return wl="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},wl(t)}function _l(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,Sl(r.key),r)}}function Sl(t){var e=function(t,e){if("object"!=wl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=wl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==wl(e)?e:e+""}function kl(t,e,n){return e=Ol(e),function(t,e){if(e&&("object"==wl(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,xl()?Reflect.construct(e,n||[],Ol(t).constructor):e.apply(t,n))}function xl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(xl=function(){return!!t})()}function Al(){return Al="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Ol(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}},Al.apply(null,arguments)}function Ol(t){return Ol=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ol(t)}function El(t,e){return El=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},El(t,e)}bl.EventTypes={"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.setBackgroundMusic":"event:scene.setBackgroundMusic","event:displayable.applyTransition":"event:displayable.applyTransition","event:displayable.applyTransform":"event:displayable.applyTransform","event:displayable.init":"event:displayable.init"},bl.defaultConfig={invertY:!1,invertX:!1,backgroundMusic:null,backgroundMusicFade:0},bl.defaultState={};var Tl=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),kl(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&&El(t,e)}(e,t),function(t,e,n){return e&&_l(t.prototype,e),n&&_l(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){return this.contentNode.getContent().execute({gameState:t}),function(t,e,n,r){var o=Al(Ol(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"executeAction",this,3)([t])}}])}($);function jl(t){return jl="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},jl(t)}function Pl(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,Cl(r.key),r)}}function Cl(t){var e=function(t,e){if("object"!=jl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=jl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==jl(e)?e:e+""}function Ll(t,e,n){return e=Rl(e),Il(t,Nl()?Reflect.construct(e,n||[],Rl(t).constructor):e.apply(t,n))}function Il(t,e){if(e&&("object"==jl(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 Nl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Nl=function(){return!!t})()}function Rl(t){return Rl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Rl(t)}function Ml(t,e){return Ml=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ml(t,e)}Tl.ActionTypes={action:"script:action"};var Fl=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=Ll(this,e)).handler=t,Il(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&&Ml(t,e)}(e,t),function(t,e,n){return e&&Pl(t.prototype,e),n&&Pl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"execute",value:function(t){var n=t.gameState;this.handler(e.getCtx({gameState:n}))}},{key:"fromChained",value:function(t){return[new Tl(this.chain(),Tl.ActionTypes.action,(new Tt).setContent(t))]}}],[{key:"getCtx",value:function(t){var e=t.gameState;return{gameState:e,game:e.game,liveGame:e.game.getLiveGame(),storable:e.game.getLiveGame().getStorable()}}}])}(be);function Dl(t){return Dl="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},Dl(t)}function Bl(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,Vl(r.key),r)}}function Vl(t){var e=function(t,e){if("object"!=Dl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Dl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Dl(e)?e:e+""}function Gl(t,e,n){return e=zl(e),function(t,e){if(e&&("object"==Dl(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,Ul()?Reflect.construct(e,n||[],zl(t).constructor):e.apply(t,n))}function Ul(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ul=function(){return!!t})()}function zl(t){return zl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},zl(t)}function Wl(t,e){return Wl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Wl(t,e)}var Hl=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=Gl(this,e)).entryScene=null,n.name=t,n.config=b(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&&Wl(t,e)}(e,t),function(t,e,n){return e&&Bl(t.prototype,e),n&&Bl(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 Ps(t).run()}}])}(vc);function $l(t){return $l="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},$l(t)}function Yl(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 ql(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)?ql(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 ql(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 Xl(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Kl(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,Ql(r.key),r)}}function Zl(t,e,n){return e&&Kl(t.prototype,e),n&&Kl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ql(t){var e=function(t,e){if("object"!=$l(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=$l(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==$l(e)?e:e+""}Hl.defaultConfig={};var Jl=function(){function t(e,n,r){Xl(this,t),this.name=e,this.key=r||e,this.content=b({},n)}return Zl(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=Yl(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=Yl(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($l(e))||(e instanceof Date||(null==e||(Array.isArray(e)?e.every(t.isSerializable):"object"===$l(e)&&(Object.getPrototypeOf(e)===Object.prototype&&Object.values(e).every(t.isSerializable)))))}}])}(),tf=function(){return Zl((function t(){Xl(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=Yl(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=Yl(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}}])}(),ef=o(196);function nf(t){return nf="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},nf(t)}function rf(t){return function(t){if(Array.isArray(t))return sf(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||af(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 of(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */of=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 P(r||[]);return o(a,"_invoke",{value:O(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",h="suspendedYield",d="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"==nf(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(nf(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 af(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}}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}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,cf(r.key),r)}}function cf(t){var e=function(t,e){if("object"!=nf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=nf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==nf(e)?e:e+""}var lf=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())}))},ff=function(){return function(t,e,n){return e&&uf(t.prototype,e),n&&uf(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 k,this.logger=new E(e,"NarraLeaf-React")}),[{key:"findElementByScene",value:function(t){return this.state.elements.find((function(e){return e.scene===t}))||null}},{key:"findElementByDisplayable",value:function(t){return this.state.elements.find((function(e){return e.ele.displayable.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:"isSceneActive",value:function(t){var e,n=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=af(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}}}}(this.state.elements);try{for(n.s();!(e=n.n()).done;){if(e.value.scene===t)return!0}}catch(t){n.e(t)}finally{n.f()}return!1}},{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.config.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.displayable.push(t),this):this}},{key:"createWearable",value:function(t,e){return t.events.any(ts.EventTypes["event:wearable.create"],e)}},{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.displayable;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:"createDisplayable",value:function(t,e){var n=this._getLastSceneIfNot(e),r=this.findElementByScene(n);return r?(r.ele.displayable.push(t),this):this}},{key:"disposeDisplayable",value:function(t,e){var n,r=this._getLastSceneIfNot(e),o=null===(n=this.findElementByScene(r))||void 0===n?void 0:n.ele.displayable;if(!o)throw new Error("Scene not found");var i=o.indexOf(t);if(-1===i)throw new Error("Displayables not found");return o.splice(i,1),this}},{key:"forceReset",value:function(){var t=this;this.state.sounds.forEach((function(t){var e;return null===(e=t.getPlaying())||void 0===e?void 0:e.stop()})),this.state.elements.forEach((function(e){var n=e.scene;t.offSrcManager(n.srcManager),t.removeScene(n),n.events.clear()})),this.state.elements=[],this.state.srcManagers=[]}},{key:"initSound",value:function(t,e){return t.getPlaying()||t.setPlaying(new(this.getHowl())(t.getHowlOptions(e))),t}},{key:"playSound",value:function(t,e,n){this.initSound(t,n);var r=t.getPlaying().play(),o=[t.getPlaying().once("end",i.bind(this)),t.getPlaying().once("stop",i.bind(this))];function i(){e&&e(),o.forEach((function(t){return t.off()})),this.state.sounds=this.state.sounds.filter((function(e){return e!==t})),this.stage.next()}return this.state.sounds.push(t),t.state.token=r,r}},{key:"stopSound",value:function(t){var e,n;return(null===(e=t.state.playing)||void 0===e?void 0:e.playing(t.getToken()))&&(null===(n=t.state.playing)||void 0===n||n.stop(t.getToken())),t.setPlaying(null).setToken(null),t}},{key:"transitionSound",value:function(t,e,n){return lf(this,void 0,void 0,of().mark((function r(){var o;return of().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!t){r.next=5;break}if(!n){r.next=4;break}return r.next=4,this.fadeSound(t,0,n);case 4:this.stopSound(t);case 5:if(!e){r.next=12;break}if(o=e.config.volume,this.playSound(e,void 0,{volume:0}),!n){r.next=11;break}return r.next=11,this.fadeSound(e,o,n);case 11:e.getPlaying().volume(o,e.getToken());case 12:case"end":return r.stop()}}),r,this)})))}},{key:"fadeSound",value:function(t,e,n){var r,o;return lf(this,void 0,void 0,of().mark((function i(){var a;return of().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return a=null===(r=t.getPlaying())||void 0===r?void 0:r.volume(t.getToken()),null===(o=t.getPlaying())||void 0===o||o.fade(a,e,n,t.getToken()),i.next=4,A(n);case 4:return i.abrupt("return",void 0);case 5:case"end":return i.stop()}}),i)})))}},{key:"getHowl",value:function(){return ef.Howl}},{key:"animateImage",value:function(t,e,n,r){return this.anyEvent.apply(this,[t,e,r].concat(rf(n)))}},{key:"animateText",value:function(t,e,n,r){return this.anyEvent.apply(this,[t,e,r].concat(rf(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:"dispose",value:function(){this.forceReset()}},{key:"toData",value:function(){return{scenes:this.state.elements.map((function(t){return{sceneId:t.scene.getId(),elements:{displayable:t.ele.displayable.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:{menus:[],texts:[],displayable:o.displayable.map((function(t){if(!e.has(t))throw new Error("Displayable not found, id: "+t+"\nNarraLeaf cannot find the element with the id from the saved game\nThis may be caused by the damage of the saved game file or the change of the story file");return e.get(t)}))}};n.state.elements.push(a),n.registerSrcManager(i.srcManager),mt.registerEventListeners(i,n)}))}},{key:"initScenes",value:function(){var t=this;this.state.elements.forEach((function(e){var n=e.scene;mt.registerEventListeners(n,t)}))}},{key:"getElementMap",value:function(){return{texts:[],menus:[],displayable:[]}}},{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 pf(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=pf(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}ff.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 hf=function(){for(var t,e,n=0,r="",o=arguments.length;n<o;n++)(t=arguments[n])&&(e=pf(t))&&(r&&(r+=" "),r+=e);return r};var df=o(12),yf=o.n(df);function vf(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 mf(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)?mf(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 mf(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 gf=yf().createContext(null);function bf(t){var e=t.children,n=t.game,r=new Hp({}),o=vf((0,df.useState)(n||r),2),i=o[0],a=o[1];return yf().createElement(gf.Provider,{value:{game:i,setGame:a}},e)}function wf(){var t=(0,df.useContext)(gf);if(!t)throw new Error("useGame must be used within a GameProvider");return t}function _f(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))})}var Sf=o(387);const kf=(0,df.createContext)({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),xf=(0,df.createContext)({}),Af=(0,df.createContext)(null),Of=Gi?df.useLayoutEffect:df.useEffect,Ef=(0,df.createContext)({strict:!1}),{schedule:Tf,cancel:jf}=Wn(queueMicrotask,!1);function Pf(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}const Cf=(0,df.createContext)({});function Lf(t,e,n,r,o){var i,a;const{visualElement:s}=(0,df.useContext)(xf),u=(0,df.useContext)(Ef),c=(0,df.useContext)(Af),l=(0,df.useContext)(kf).reducedMotion,f=(0,df.useRef)();r=r||u.renderer,!f.current&&r&&(f.current=r(t,{visualState:e,parent:s,props:n,presenceContext:c,blockInitialAnimation:!!c&&!1===c.initial,reducedMotionConfig:l}));const p=f.current,h=(0,df.useContext)(Cf);!p||p.projection||!o||"html"!==p.type&&"svg"!==p.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:If(t.parent)),t.projection.setOptions({layoutId:o,layout:i,alwaysMeasureLayout:Boolean(a)||s&&Pf(s),visualElement:t,animationType:"string"==typeof i?i:"both",initialPromotionConfig:r,layoutScroll:u,layoutRoot:c})}(f.current,n,o,h),(0,df.useInsertionEffect)((()=>{p&&p.update(n,c)}));const d=n[Li],y=(0,df.useRef)(Boolean(d)&&!(null===(i=window.MotionHandoffIsComplete)||void 0===i?void 0:i.call(window,d))&&(null===(a=window.MotionHasOptimisedAnimation)||void 0===a?void 0:a.call(window,d)));return Of((()=>{p&&(window.MotionIsMounted=!0,p.updateFeatures(),Tf.render(p.render),y.current&&p.animationState&&p.animationState.animateChanges())})),(0,df.useEffect)((()=>{p&&(!y.current&&p.animationState&&p.animationState.animateChanges(),y.current&&(queueMicrotask((()=>{var t;null===(t=window.MotionHandoffMarkAsComplete)||void 0===t||t.call(window,d)})),y.current=!1))})),p}function If(t){if(t)return!1!==t.options.allowProjection?t.projection:If(t.parent)}function Nf(t,e,n){return(0,df.useCallback)((r=>{r&&t.mount&&t.mount(r),e&&(r?e.mount(r):e.unmount()),n&&("function"==typeof n?n(r):Pf(n)&&(n.current=r))}),[e])}function Rf(t){const{initial:e,animate:n}=function(t,e){if(qi(t)){const{initial:e,animate:n}=t;return{initial:!1===e||Hi(e)?e:void 0,animate:Hi(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,(0,df.useContext)(xf));return(0,df.useMemo)((()=>({initial:e,animate:n})),[Mf(e),Mf(n)])}function Mf(t){return Array.isArray(t)?t.join(" "):t}function Ff(t){for(const e in t)Zi[e]={...Zi[e],...t[e]}}const Df=(0,df.createContext)({}),Bf=Symbol.for("motionComponentSymbol");function Vf({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:r,Component:o}){t&&Ff(t);const i=(0,df.forwardRef)((function(t,i){let a;const s={...(0,df.useContext)(kf),...t,layoutId:Gf(t)},{isStatic:u}=s,c=Rf(t),l=r(t,u);if(!u&&Gi){!function(){(0,df.useContext)(Ef).strict;0}();const t=function(t){const{drag:e,layout:n}=Zi;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=Lf(o,l,s,e,t.ProjectionNode)}return(0,Sf.jsxs)(xf.Provider,{value:c,children:[a&&c.visualElement?(0,Sf.jsx)(a,{visualElement:c.visualElement,...s}):null,n(o,t,Nf(l,c.visualElement,i),l,u,c.visualElement)]})}));return i[Bf]=o,i}function Gf({layoutId:t}){const e=(0,df.useContext)(Df).id;return e&&void 0!==t?e+"-"+t:t}const Uf=["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 zf(t){return"string"==typeof t&&!t.includes("-")&&!!(Uf.indexOf(t)>-1||/[A-Z]/u.test(t))}function Wf(t){const e=pn(t)?t.get():t;return _i(e)?e.toValue():e}function Hf(t){return Ln.has(t)?"transform":ii.has(t)?Ci(t):void 0}const $f=t=>(e,n)=>{const r=(0,df.useContext)(xf),o=(0,df.useContext)(Af),i=()=>function({applyWillChange:t=!1,scrapeMotionValuesFromProps:e,createRenderState:n,onMount:r},o,i,a,s){const u={latestValues:qf(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,df.useRef)(null);return null===e.current&&(e.current=t()),e.current}(i)};function Yf(t,e,n){const r=Array.isArray(e)?e:[e];for(let e=0;e<r.length;e++){const o=Ti(t,r[e]);if(o){const{transitionEnd:t,transition:e,...r}=o;n(r,t)}}}function qf(t,e,n,r,o){var i;const a={},s=new Set,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]=Wf(c[t]);let{initial:l,animate:f}=t;const p=qi(t),h=Xi(t);e&&h&&!p&&!1!==t.inherit&&(void 0===l&&(l=e.initial),void 0===f&&(f=e.animate));let d=!!n&&!1===n.initial;d=d||!1===l;const y=d?f:l;return y&&"boolean"!=typeof y&&!Wi(y)&&Yf(t,y,((t,e)=>{for(const e in t){let n=t[e];if(Array.isArray(n)){n=n[d?n.length-1:0]}null!==n&&(a[e]=n)}for(const t in e)a[t]=e[t]})),u&&(f&&!1!==l&&!Wi(f)&&Yf(t,f,(t=>{for(const e in t){const t=Hf(e);t&&s.add(t)}})),s.size&&(a.willChange=Array.from(s).join(","))),a}const Xf=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Kf=()=>({...Xf(),attrs:{}}),Zf={useVisualState:$f({scrapeMotionValuesFromProps:Vi,createRenderState:Kf,onMount:(t,e,{renderState:n,latestValues:r})=>{Hn.read((()=>{try{n.dimensions="function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch(t){n.dimensions={x:0,y:0,width:0,height:0}}})),Hn.render((()=>{la(n,r,da(e.tagName),t.transformTemplate),ha(e,n)}))}})},Qf={useVisualState:$f({applyWillChange:!0,scrapeMotionValuesFromProps:Bi,createRenderState:Xf})};function Jf(t,e,n){for(const r in e)pn(e[r])||Di(r,n)||(t[r]=e[r])}function tp(t,e){const n={};return Jf(n,t.style||{},t),Object.assign(n,function({transformTemplate:t},e){return(0,df.useMemo)((()=>{const n=Xf();return aa(n,e,t),Object.assign({},n.vars,n.style)}),[e])}(t,e)),n}function ep(t,e){const n={},r=tp(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 np=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 rp(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||np.has(t)}let op=t=>!rp(t);try{(ip=require("@emotion/is-prop-valid").default)&&(op=t=>t.startsWith("on")?!rp(t):ip(t))}catch(qt){}var ip;function ap(t,e,n,r){const o=(0,df.useMemo)((()=>{const n=Kf();return la(n,e,da(r),t.transformTemplate),{...n.attrs,style:{...n.style}}}),[e]);if(t.style){const e={};Jf(e,t.style,t),o.style={...e,...o.style}}return o}function sp(t=!1){return(e,n,r,{latestValues:o},i)=>{const a=(zf(e)?ap:ep)(n,o,i,e),s=function(t,e,n){const r={};for(const o in t)"values"===o&&"object"==typeof t.values||(op(o)||!0===n&&rp(o)||!e&&!rp(o)||t.draggable&&o.startsWith("onDrag"))&&(r[o]=t[o]);return r}(n,"string"==typeof e,t),u=e!==df.Fragment?{...s,...a,ref:r}:{},{children:c}=n,l=(0,df.useMemo)((()=>pn(c)?c.get():c),[c]);return(0,df.createElement)(e,{...u,children:l})}}function up(t,e){return function(n,{forwardMotionProps:r}={forwardMotionProps:!1}){return Vf({...zf(n)?Zf:Qf,preloadedFeatures:t,useRender:sp(r),createVisualElement:e,Component:n})}}const cp=_f(up());function lp(){return lp=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},lp.apply(null,arguments)}function fp(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 pp(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)?pp(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 pp(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 hp=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n};function dp(t){var e=t.children,n=t.border,r=void 0===n?"solid":n,o=t.color,i=void 0===o?"red":o,a=t.tag,s=t.borderWidth,u=void 0===s?1:s,c=t.as,l=void 0===c?"div":c,f=t.Ref,p=hp(t,["children","border","color","tag","borderWidth","as","Ref"]),h=wf().game,d=fp((0,df.useState)(!1),2),y=d[0],v=d[1];if(!h.config.app.inspector)return yf().createElement(l,lp({},p,{ref:f}),e);var m=Object.assign(Object.assign({},p),{onMouseEnter:function(){return v(!0)},onMouseLeave:function(){return v(!1)},style:Object.assign(Object.assign({},p.style||{}),{outline:"".concat(u,"px ").concat(r," ").concat(i),zIndex:y?1e3:"auto"})});return yf().createElement(l,lp({},m,{ref:f}),a&&y&&yf().createElement("span",{className:"absolute top-0 left-0 bg-white text-black border-2 border-black text-sm"},a),e)}function yp(t){var e=t.border,n=void 0===e?"solid":e,r=t.color,o=void 0===r?"red":r,i=t.tag,a=t.borderWidth,s=void 0===a?1:a,u=t.as,c=void 0===u?"img":u,l=hp(t,["border","color","tag","borderWidth","as"]),f=wf().game,p=fp((0,df.useState)(!1),2),h=p[0],d=p[1];if(!f.config.app.inspector)return yf().createElement(c,l);var y=Object.assign(Object.assign({},l),{onMouseEnter:function(){return d(!0)},onMouseLeave:function(){return d(!1)},style:Object.assign(Object.assign({},l.style||{}),{outline:"".concat(n," ").concat(s,"px ").concat(o),zIndex:h?1e3:"auto"})});return yf().createElement("div",null,yf().createElement(c,y),i&&h&&yf().createElement("span",{className:"absolute top-0 left-0 bg-white text-black border-2 border-black"},i))}const vp={Div:function(t){return yf().createElement(dp,lp({},t,{as:"div"}))},Span:function(t){return yf().createElement(dp,lp({},t,{as:"span"}))},Button:function(t){return yf().createElement(dp,lp({},t,{as:"button"}))},Img:function(t){return yf().createElement(yp,lp({},t,{as:"img"}))},mDiv:function(t){return yf().createElement(dp,lp({},t,{as:cp.div,Ref:t.Ref}))}};function mp(t){return mp="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},mp(t)}function gp(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */gp=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 P(r||[]);return o(a,"_invoke",{value:O(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",h="suspendedYield",d="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"==mp(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(mp(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 bp(t){return function(t){if(Array.isArray(t))return Sp(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||_p(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 wp(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)||_p(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 _p(t,e){if(t){if("string"==typeof t)return Sp(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)?Sp(t,e):void 0}}function Sp(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 kp(t){var e=gp().mark(R),n=t.sentence,r=t.gameState,o=t.useTypeEffect,i=void 0===o||o,a=t.onCompleted,s=t.finished,u=t.count,c=t.className,l=wp((0,df.useState)(!1),2),f=l[0],p=l[1],h=(0,df.useMemo)((function(){return n.evaluate(Fl.getCtx({gameState:r}))}),[]),d=r.game,y=wp((0,df.useState)([]),2),v=y[0],m=y[1],g=(0,df.useRef)(R(h)),b=(0,df.useRef)(null),w=(0,df.useRef)(null),_=wp((0,df.useState)(0),2),k=_[0],x=_[1],A=wp((0,df.useReducer)((function(t){return t+1}),0),2)[1],O=wp((0,df.useState)(new Set),2),E=O[0],T=O[1],j=wp((0,df.useState)(!1),2),P=j[0],C=j[1];function L(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];w.current&&(clearTimeout(w.current),w.current=null);for(var e=!1;!e;){var n=g.current.next(),o=n.done,i=n.value;if(o)p(!0),a&&(r.logger.info("Say","Completed",o,i),a()),e=!0;else if(Us.isPause(i)){if(t)continue;N(Us.from(i)),e=!0}else I(i)}}function I(t){m((function(e){if("\n"!==t&&E.has(t))return e;T((function(e){return new Set(e).add(t)}));var n=e[e.length-1];return n&&"\n"!==n&&"\n"!==t&&n.tag===t.tag?[].concat(bp(e.slice(0,-1)),[{text:n.text+t.text,config:t.config,tag:t.tag,tag2:t.tag2}]):[].concat(bp(e),[t])}))}function N(t){r.logger.info("Say","Paused",t),t.config.duration?b.current=setTimeout((function(){b.current=null,x((function(t){return t+1}))}),t.config.duration):C(!0)}function R(t){var n,r,o,i,a;return gp().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=bp(t),r=0;case 2:if(!(r<n.length)){e.next=24;break}if(o=n[r],!Us.isPause(o.text)){e.next=8;break}return e.next=7,Us.from(o.text);case 7:return e.abrupt("continue",21);case 8:i=0;case 9:if(!(i<o.text.length)){e.next=21;break}if("\n"!==(a=o.text[i])){e.next=16;break}return e.next=14,"\n";case 14:e.next=18;break;case 16:return e.next=18,{text:a,config:o.config,tag:r,tag2:i};case 18:i++,e.next=9;break;case 21:r++,e.next=2;break;case 24:return e.abrupt("return");case 25:case"end":return e.stop()}}),e)}return(0,df.useEffect)((function(){if(i||L(!0),s&&!f)return b.current&&clearTimeout(b.current),b.current=null,L(!0),void(a&&(r.logger.info("Say","Completed",b.current,s,f),a()));if(f||s||P||b.current)r.logger.debug("Sentence.tsx","locked",f,s,P);else{var t=g.current.next(),e=t.done,n=t.value;if(e)return p(!0),void(a&&(r.logger.info("Say","Completed",e,n),a()));Us.isPause(n)?N(Us.from(n)):(I(n),A(),w.current=setTimeout((function(){x((function(t){return t+1}))}),d.config.elements.say.textInterval))}}),[k,s,P]),(0,df.useEffect)((function(){if(u&&!b.current){if(P)return C(!1),void x((function(t){return t+1}));L(),x((function(t){return t+1}))}}),[u]),yf().createElement("div",{className:hf("whitespace-pre-wrap",d.config.elementStyles.say.textContainerClassName,{"font-bold":n.config.bold,italic:n.config.italic},c),style:{fontFamily:n.config.fontFamily||d.config.elementStyles.say.fontFamily,fontSize:n.config.fontSize||d.config.elementStyles.say.fontSize}},v.map((function(t,e){return"\n"===t?yf().createElement("br",{key:e}):yf().createElement(vp.Span,{tag:"say.word.".concat(e),key:e,style:Object.assign({color:S(t.config.color||n.config.color||$s.defaultColor),fontFamily:t.config.fontFamily,fontSize:t.config.fontSize},d.config.app.debug?{outline:"1px dashed red"}:{}),className:hf(d.config.elementStyles.say.textSpanClassName,"whitespace-pre inline-block",{"font-bold":t.config.bold,italic:t.config.italic},t.config.className)},t.config.ruby?yf().createElement("ruby",{className:"align-bottom inline-block"},yf().createElement("rt",{className:"block text-center"},t.config.ruby),t.text):t.text)})))}function xp(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 Ap(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)?Ap(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 Ap(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 Op(t){return Op="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},Op(t)}function Ep(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,Tp(r.key),r)}}function Tp(t){var e=function(t,e){if("object"!=Op(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Op(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Op(e)?e:e+""}var jp=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,scale:0},this.events=new k,this.lockers=[],this.updater=null}return function(t,e,n){return e&&Ep(t.prototype,e),n&&Ep(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"update",value:function(e,n,r){this.state.width=e,this.state.height=n,this.state.scale=r,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:"requestUpdate",value:function(){this.events.emit(t.EventTypes["event:aspectRatio.requestUpdate"])}},{key:"onRequestedUpdate",value:function(e){var n=this;return this.events.on(t.EventTypes["event:aspectRatio.requestUpdate"],e),function(){n.events.off(t.EventTypes["event:aspectRatio.requestUpdate"],e)}}},{key:"triggerUpdate",value:function(){this.updater&&this.updater()}}])}();jp.EventTypes={"event:aspectRatio.update":"event:aspectRatio.update","event:aspectRatio.pause":"event:aspectRatio.pause","event:aspectRatio.resume":"event:aspectRatio.resume","event:aspectRatio.requestUpdate":"event:aspectRatio.requestUpdate"};var Pp=(0,df.createContext)(null);function Cp(t){var e=t.children,n=xp((0,df.useState)((function(){return new jp})),1)[0];return yf().createElement(Pp.Provider,{value:{ratio:n}},e)}function Lp(){var t=(0,df.useContext)(Pp);if(!Pp||!t)throw new Error("useRatio must be used within a RatioProvider");var e=xp((0,df.useReducer)((function(t){return t+1}),0),2)[1],n=t.ratio;return(0,df.useEffect)((function(){return n.onUpdate((function(){e()}))}),[]),t}function Ip(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 Np(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)?Np(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 Np(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 Rp(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=Ip((0,df.useState)(!1),2),l=c[0],f=c[1],p=s.game,h=Ip((0,df.useState)(0),2),d=h[0],y=h[1],v=Lp().ratio;return(0,df.useEffect)((function(){if(window){var t=function(t){p.config.elements.say.nextKey.includes(t.key)&&(l?r&&r():y((function(t){return t+1})))};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")}),[l]),(0,df.useEffect)((function(){var t=s.events.onEvents([{type:ff.EventTypes["event:state.player.skip"],listener:s.events.on(ff.EventTypes["event:state.player.skip"],(function(){s.logger.log("NarraLeaf-React: Say","Skipped"),l?r&&r():f(!0)}))}]);return function(){t.cancel()}})),yf().createElement("div",null,u.state.display&&yf().createElement(vp.Div,{tag:"say.aspectScaleContainer",color:"blue",border:"dashed",className:hf("absolute bottom-0 w-[calc(100%-40px)]",a),onClick:function(){l?r&&r():y((function(t){return t+1}))},style:Object.assign({},C(p.config.elements.say.useAspectScale,{width:p.config.elements.text.width,height:p.config.elements.text.height}))},yf().createElement(vp.Div,{tag:"say.containerClassName",className:hf(p.config.elementStyles.say.containerClassName),style:Object.assign({},C(p.config.elements.say.useAspectScale,{transform:"scale(".concat(v.state.scale,")"),transformOrigin:"bottom left",width:"100%",height:"100%"}))},yf().createElement("div",{className:hf("bg-white flex flex-col items-start justify-between",p.config.elementStyles.say.contentContainerClassName,"w-full h-full")},yf().createElement(vp.Div,{tag:"say.nameTextClassName",className:hf("rounded-br-md text-black",p.config.elementStyles.say.nameTextClassName)},null===(e=u.config.character)||void 0===e?void 0:e.state.name),yf().createElement(kp,{sentence:u,gameState:s,finished:l,useTypeEffect:i,onCompleted:function(){f(!0)},count:d}),yf().createElement("div",null)))))}function Mp(){return Mp=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},Mp.apply(null,arguments)}function Fp(t){var e=t.children,n=t.className,r=t.props,o=t.ref,i=Lp().ratio,a=i.getStyle();return yf().createElement("div",{className:hf("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")}},yf().createElement("div",Mp({style:Object.assign(Object.assign({},a),{position:"relative",overflow:"hidden"})},r||{},{ref:o}),e))}var Dp,Bp={say:Rp,menu:function(t){var e=t.prompt,n=t.choices,r=t.afterChoose,o=t.state,i=wf().game,a=Lp().ratio,s=i.config.elements.say.use;return yf().createElement(yf().Fragment,null,yf().createElement(Fp,{className:"absolute"},e&&yf().createElement(s,{state:o,action:{sentence:e,character:null},useTypeEffect:!1,className:"z-10"})),yf().createElement(vp.Div,{color:"green",border:"dashed",className:hf("absolute"),style:{width:"".concat(i.config.player.width,"px"),height:"".concat(i.config.player.height,"px")}},yf().createElement(vp.Div,{tag:"menu.aspectScaleContainer",style:{transform:"scale(".concat(a.state.scale,")"),transformOrigin:"left top"},className:hf("w-full h-full")},yf().createElement(vp.Div,{tag:"menu.containerClassName",className:hf("absolute flex flex-col items-center justify-center min-w-full w-full h-full",i.config.elementStyles.menu.containerClassName)},yf().createElement("div",{className:"p-4 rounded-lg w-full z-20"},yf().createElement("div",{className:"flex flex-col items-center mt-4 w-full"},n.map((function(t,e){return yf().createElement(vp.Button,{tag:"menu.choiceButtonClassName."+e,key:e,className:hf("bg-white text-black p-2 mt-2 w-1/2",i.config.elementStyles.menu.choiceButtonClassName),onClick:function(){return function(t){r(t)}(t)}},yf().createElement(kp,{sentence:t.prompt,gameState:o,useTypeEffect:!1,className:hf(i.config.elementStyles.menu.choiceButtonTextClassName)}))}))))))))}};function Vp(t){return Vp="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},Vp(t)}function Gp(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Up(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,Wp(r.key),r)}}function zp(t,e,n){return e&&Up(t.prototype,e),n&&Up(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Wp(t){var e=function(t,e){if("object"!=Vp(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Vp(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Vp(e)?e:e+""}!function(t){t.game="game"}(Dp||(Dp={}));var Hp=function(){return zp((function t(e){Gp(this,t),this.liveGame=null,this.config=b(t.DefaultConfig,e)}),[{key:"useComponent",value:function(t,e){if(!Object.keys(Bp).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 $p(this)}}])}();Hp.defaultSettings={volume:1},Hp.ComponentTypes={say:"say",menu:"menu"},Hp.DefaultConfig={player:{contentContainerId:"__narraleaf_content",aspectRatio:16/9,minWidth:800,minHeight:450,width:1920,height:1080,skipKey:["Control"],skipInterval:100,ratioUpdateInterval:50},elements:{say:{nextKey:[" "],textInterval:50,use:Bp.say,useAspectScale:!0},img:{slowLoadWarning:!0,slowLoadThreshold:2e3,allowSkipTransform:!0,allowSkipTransition:!0},menu:{use:Bp.menu},background:{allowSkipTransform:!0,allowSkipTransition:!1},text:{allowSkipTransform:!0,allowSkipTransition:!0,width:1920,height:216}},elementStyles:{say:{contentContainerClassName:"",containerClassName:"",nameTextClassName:"",textContainerClassName:"",textSpanClassName:"",rubyClassName:""},menu:{containerClassName:"",choiceButtonClassName:"",choiceButtonTextClassName:""}},app:{debug:!1,logger:{log:!1,info:!1,warn:!0,error:!0,debug:!1,trace:!1},inspector:!1}},Hp.GameSettingsNamespace=Dp;var $p=function(){function t(e){Gp(this,t),this.gameLock=new P,this.currentSavedGame=null,this.story=null,this.lockedAwaiting=null,this.gameState=void 0,this._lockedCount=0,this.currentAction=null,this._nextLock=new j,this.game=e,this.storable=new tf,this.initNamespaces()}return zp(t,[{key:"initNamespaces",value:function(){return this.storable.clear().addNamespace(new Jl(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._nextLock.isLocked())return null;if(this._nextLock.lock(),this.gameLock.isLocked())return this.gameLock;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("LiveGame locked: dead cycle detected\nPlease refresh the page");return this._nextLock.unlock(),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,this._nextLock.unlock(),r||null}if(!this.currentAction)return t.events.emit(ff.EventTypes["event:state.end"]),t.logger.warn("LiveGame","No current action"),this._nextLock.unlock(),null;var o=this.currentAction.executeAction(t);return w.isAwaitable(o)?(this.lockedAwaiting=o,this._nextLock.unlock(),o):(t.logger.debug("next action",o),this._lockedCount=0,this.currentAction=(null===(n=o.node)||void 0===n?void 0:n.action)||null,this._nextLock.unlock(),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 w.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}}}}])}();$p.DefaultNamespaces={game:{}},$p.GameSpacesKey={game:"game"};var Yp=o(72),qp=o.n(Yp),Xp=o(825),Kp=o.n(Xp),Zp=o(659),Qp=o.n(Zp),Jp=o(56),th=o.n(Jp),eh=o(540),nh=o.n(eh),rh=o(113),oh=o.n(rh),ih=o(587),ah={};ah.styleTagTransform=oh(),ah.setAttributes=th(),ah.insert=Qp().bind(null,"head"),ah.domAPI=Kp(),ah.insertStyleElement=nh();qp()(ih.A,ah);ih.A&&ih.A.locals&&ih.A.locals;function sh({children:t,features:e,strict:n=!1}){const[,r]=(0,df.useState)(!uh(e)),o=(0,df.useRef)(void 0);if(!uh(e)){const{renderer:t,...n}=e;o.current=t,Ff(n)}return(0,df.useEffect)((()=>{uh(e)&&e().then((({renderer:t,...e})=>{Ff(e),o.current=t,r(!0)}))}),[]),(0,Sf.jsx)(Ef.Provider,{value:{renderer:o.current,strict:n},children:t})}function uh(t){return"function"==typeof t}function ch(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 lh(t,e,n={}){var r;const o=ji(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(Mi(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(fh).forEach(((t,r)=>{t.notify("AnimationStart",e),a.push(lh(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 fh(t,e){return t.sortNodePosition(e)}const ph=Yi.length;function hh(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&hh(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let n=0;n<ph;n++){const r=Yi[n],o=t.props[r];(Hi(o)||!1===o)&&(e[r]=o)}return e}const dh=[...$i].reverse(),yh=$i.length;function vh(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=>lh(t,e,n)));r=Promise.all(o)}else if("string"==typeof e)r=lh(t,e,n);else{const o="function"==typeof e?ji(t,e,n.custom):e;r=Promise.all(Mi(t,o,n))}return r.then((()=>{t.notify("AnimationComplete",e)}))}(t,e,n))))}function mh(t){let e=vh(t),n=wh(),r=!0;const o=e=>(n,r)=>{var o;const i=ji(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{props:a}=t,s=hh(t.parent)||{},u=[],c=new Set;let l={},f=1/0;for(let e=0;e<yh;e++){const p=dh[e],h=n[p],d=void 0!==a[p]?a[p]:s[p],y=Hi(d),v=p===i?h.isActive:null;!1===v&&(f=e);let m=d===s[p]&&d!==a[p]&&y;if(m&&r&&t.manuallyAnimateOnMount&&(m=!1),h.protectedKeys={...l},!h.isActive&&null===v||!d&&!h.prevProp||Wi(d)||"boolean"==typeof d)continue;const g=gh(h.prevProp,d);let b=g||p===i&&h.isActive&&!m&&y||e>f&&y,w=!1;const _=Array.isArray(d)?d:[d];let S=_.reduce(o(p),{});!1===v&&(S={});const{prevResolvedValues:k={}}=h,x={...k,...S},A=e=>{b=!0,c.has(e)&&(w=!0,c.delete(e)),h.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in x){const e=S[t],n=k[t];if(l.hasOwnProperty(t))continue;let r=!1;r=wi(e)&&wi(n)?!ch(e,n):e!==n,r?null!=e?A(t):c.add(t):void 0!==e&&c.has(t)?A(t):h.protectedKeys[t]=!0}h.prevProp=d,h.prevResolvedValues=S,h.isActive&&(l={...l,...S}),r&&t.blockInitialAnimation&&(b=!1);b&&(!(m&&g)||w)&&u.push(..._.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=wh(),r=!0}}}function gh(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!ch(e,t)}function bh(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function wh(){return{animate:bh(!0),whileInView:bh(),whileHover:bh(),whileTap:bh(),whileDrag:bh(),whileFocus:bh(),exit:bh()}}class _h{constructor(t){this.isMounted=!1,this.node=t}update(){}}let Sh=0;const kh={animation:{Feature:class extends _h{constructor(t){super(t),t.animationState||(t.animationState=mh(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Wi(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 _h{constructor(){super(...arguments),this.id=Sh++}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 xh(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function Ah(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const Oh=t=>e=>(t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary)(e)&&t(e,Ah(e));function Eh(t,e,n,r){return xh(t,e,Oh(n),r)}function Th(t){let e=null;return()=>{const n=()=>{e=null};return null===e&&(e=t,n)}}const jh=Th("dragHorizontal"),Ph=Th("dragVertical");function Ch(){const t=function(t){let e=!1;if("y"===t)e=Ph();else if("x"===t)e=jh();else{const t=jh(),n=Ph();t&&n?e=()=>{t(),n()}:(t&&t(),n&&n())}return e}(!0);return!t||(t(),!1)}function Lh(t,e){const n=e?"pointerenter":"pointerleave",r=e?"onHoverStart":"onHoverEnd";return Eh(t.current,n,((n,o)=>{if("touch"===n.pointerType||Ch())return;const i=t.getProps();t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",e);const a=i[r];a&&Hn.postRender((()=>a(n,o)))}),{passive:!t.getProps()[r]})}const Ih=(t,e)=>!!e&&(t===e||Ih(t,e.parentElement));function Nh(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,Ah(n))}const Rh=new WeakMap,Mh=new WeakMap,Fh=t=>{const e=Rh.get(t.target);e&&e(t)},Dh=t=>{t.forEach(Fh)};function Bh(t,e,n){const r=function({root:t,...e}){const n=t||document;Mh.has(n)||Mh.set(n,{});const r=Mh.get(n),o=JSON.stringify(e);return r[o]||(r[o]=new IntersectionObserver(Dh,{root:t,...e})),r[o]}(e);return Rh.set(t,n),r.observe(t),()=>{Rh.delete(t),r.unobserve(t)}}const Vh={some:0,all:1};const Gh={inView:{Feature:class extends _h{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:Vh[r]};return Bh(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 _h{constructor(){super(...arguments),this.removeStartListeners=Ue,this.removeEndListeners=Ue,this.removeAccessibleListeners=Ue,this.startPointerPress=(t,e)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),r=Eh(window,"pointerup",((t,e)=>{if(!this.checkPressEnd())return;const{onTap:n,onTapCancel:r,globalTapTarget:o}=this.node.getProps(),i=o||Ih(this.node.current,t.target)?n:r;i&&Hn.update((()=>i(t,e)))}),{passive:!(n.onTap||n.onPointerUp)}),o=Eh(window,"pointercancel",((t,e)=>this.cancelPress(t,e)),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=Bo(r,o),this.startPress(t,e)},this.startAccessiblePress=()=>{const t=xh(this.node.current,"keydown",(t=>{if("Enter"!==t.key||this.isPressing)return;this.removeEndListeners(),this.removeEndListeners=xh(this.node.current,"keyup",(t=>{"Enter"===t.key&&this.checkPressEnd()&&Nh("up",((t,e)=>{const{onTap:n}=this.node.getProps();n&&Hn.postRender((()=>n(t,e)))}))})),Nh("down",((t,e)=>{this.startPress(t,e)}))})),e=xh(this.node.current,"blur",(()=>{this.isPressing&&Nh("cancel",((t,e)=>this.cancelPress(t,e)))}));this.removeAccessibleListeners=Bo(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&&Hn.postRender((()=>n(t,e)))}checkPressEnd(){this.removeEndListeners(),this.isPressing=!1;return this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!Ch()}cancelPress(t,e){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&Hn.postRender((()=>n(t,e)))}mount(){const t=this.node.getProps(),e=Eh(t.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),n=xh(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Bo(e,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}},focus:{Feature:class extends _h{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=Bo(xh(this.node.current,"focus",(()=>this.onFocus())),xh(this.node.current,"blur",(()=>this.onBlur())))}unmount(){}}},hover:{Feature:class extends _h{mount(){this.unmount=Bo(Lh(this.node,!0),Lh(this.node,!1))}unmount(){}}}},Uh={renderer:(t,e)=>zf(t)?new ya(e):new ma(e,{allowProjection:t!==df.Fragment}),...kh,...Gh};function zh(t){var e=t.children;return yf().createElement(sh,{features:Uh,strict:!0},e)}function Wh(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 Hh(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)?Hh(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 Hh(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){var e=t.children,n=t.className,r=Wh((0,df.useState)({}),2),o=r[0],i=r[1],a=Lp().ratio,s=wf().game,u=Wh((0,df.useReducer)((function(t){return t+1}),0),2)[1],c=s.config.player.minWidth,l=s.config.player.minHeight;return(0,df.useEffect)((function(){var t,e=function(){if(a.isLocked())console.warn("NarraLeaf-React: 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"});var p=e/s.config.player.width;a.update(e,n,p),a.updateMin(c,l),u()}}};a.setUpdate(e);var n,r,o,f=(n=function(){e(),clearTimeout(t),a.pause(),t=setTimeout((function(){a.resume()}),100)},r=s.config.player.ratioUpdateInterval,o=null,function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];o&&clearTimeout(o),o=setTimeout((function(){n.apply(void 0,e)}),r)});f(),window.addEventListener("resize",f);var p=a.onRequestedUpdate(f);return function(){window.removeEventListener("resize",f),clearTimeout(t),p()}}),[a]),yf().createElement("div",{id:s.config.player.contentContainerId,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"}},yf().createElement("div",{className:hf(n),style:o},e))}function Yh(t){return Yh="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},Yh(t)}function qh(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */qh=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 P(r||[]);return o(a,"_invoke",{value:O(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",h="suspendedYield",d="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"==Yh(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(Yh(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 Xh(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 Kh(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)?Kh(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 Kh(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 Zh=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 Qh(t){var e=this,n=t.state,r=t.displayable,o=t.child,i=r.element,a=r.state,s=void 0===a?i:a,u=(0,df.useRef)(null),c=Xh((0,df.useState)(null),2),l=c[0],f=c[1],p=Xh((0,df.useState)([]),2)[1],h=Xh((0,df.useState)(null),2),d=h[0],y=h[1],v=Xh((0,df.useState)({}),2),m=v[0],g=v[1];function w(t){if(d&&d.getControl()&&(n.logger.warn("Displayable Animation","processing transform not completed"),d.getControl().complete(),d.setControl(null)),!u.current)throw new Error("scope not ready");t instanceof Ma?Object.assign(u.current.style,t.propToCSS(n,s.state,r.transformOverwrites)):Object.assign(u.current.style,t)}function _(t){return f(t),t?new Promise((function(e){var r=t.events.onEvents([{type:Cc.update,listener:t.events.on(Cc.update,(function(t){p(t)}))},{type:Cc.end,listener:t.events.on(Cc.end,(function(){f(null),n.logger.debug("scene background transition end",t)}))},{type:Cc.start,listener:t.events.on(Cc.start,(function(){n.logger.debug("scene background transition start",t)}))}]);t.start((function(){r.cancel(),e()}))})):(n.logger.warn("transition not set"),Promise.resolve())}function S(t){return Zh(this,void 0,void 0,qh().mark((function e(){return qh().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return w(t.propToCSS(n,s.state,r.transformOverwrites)),y(t),e.next=4,t.animate({scope:u,target:s,overwrites:r.transformOverwrites},n,(function(e){s.state=b(s.state,e),g({style:t.propToCSS(n,s.state,r.transformOverwrites)}),y(null)}));case 4:case"end":return e.stop()}}),e)})))}return(0,df.useEffect)((function(){var t="event:displayable.applyTransition",o="event:displayable.applyTransform",a="event:displayable.init",c=i.events.onEvents([{type:t,listener:i.events.on(t,_)},{type:o,listener:i.events.on(o,S)},{type:a,listener:i.events.on(a,(function(){return Zh(e,void 0,void 0,qh().mark((function t(){var e;return qh().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=i.toDisplayableTransform(),n.logger.debug("init transform",e),t.next=4,e.animate({scope:u,target:s,overwrites:r.transformOverwrites},n,(function(t){s.state=b(s.state,t)}));case 4:case"end":return t.stop()}}),t)})))}))}]);return function(){c.cancel()}}),[]),(0,df.useEffect)((function(){if(!u.current)throw new Error("Scope not ready. Using element: ".concat(i.constructor.name))}),[]),(0,df.useEffect)((function(){var t=n.events.onEvents([{type:ff.EventTypes["event:state.player.skip"],listener:n.events.on(ff.EventTypes["event:state.player.skip"],(function(){r.skipTransform&&d&&d.getControl()&&(d.getControl().complete(),d.setControl(null),n.logger.debug("transform skip")),r.skipTransition&&l&&l.controller&&(l.controller.complete(),f(null),n.logger.debug("transition skip"))}))}]);return function(){t.cancel()}}),[l,d]),yf().createElement(yf().Fragment,null,o({transformRef:u,transition:l,transform:d,transformProps:m,state:n}))}function Jh(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 td(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)?td(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 td(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 ed(){return ed=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},ed.apply(null,arguments)}function nd(t){var e=t.scene,n=t.props,r=t.state;return yf().createElement(Qh,{displayable:{element:e,skipTransform:r.game.config.elements.background.allowSkipTransform,skipTransition:r.game.config.elements.background.allowSkipTransition},child:function(t){return yf().createElement(rd,ed({},t,{scene:e,props:n}))},state:r})}function rd(t){var e=t.transformRef,n=t.transformProps,r=t.transition,o=t.state,i=t.scene,a=t.props,s=Lp().ratio,u=Jh(yf().useState(!1),2),c=u[0],l=u[1];function f(){c||(l(!0),i.events.emit(bl.EventTypes["event:scene.imageLoaded"]),o.logger.debug("BackgroundTransition","Image loaded",i))}var p,h="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/wcAAgAB9sWFXTkAAAAASUVORK5CYII=",d={src:h,style:Object.assign({},o.game.config.app.debug?{outline:"1px solid red"}:{})};return yf().createElement("div",null,yf().createElement(cp.div,ed({layout:!0,ref:e,className:"absolute inset-0 flex items-center justify-center bg-cover bg-center overflow-hidden"},b({style:Object.assign({},s.getStyle())},n)),r?r.toElementProps().map((function(t,e){var n=b(d,a,t);return yf().createElement("img",ed({alt:n.alt},n,{onLoad:f,src:n.src?n.src:h,className:"absolute",key:e}))})):(p=b(d,a),yf().createElement("img",ed({key:"last",alt:p.alt},p,{onLoad:f,src:p.src||h,className:"absolute"})))))}function od(t){return od="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},od(t)}function id(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */id=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 P(r||[]);return o(a,"_invoke",{value:O(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",h="suspendedYield",d="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"==od(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(od(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 ad(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 sd(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)?sd(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 sd(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 ud=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 cd(t){var e=t.scene,n=t.state,r=t.children,o=t.className,i=Lp().ratio,a=ad((0,df.useState)((function(){return e.state.backgroundMusic})),2),s=a[0],u=a[1];return(0,df.useEffect)((function(){var t=[{type:"event:scene.setBackgroundMusic",listener:e.events.on(bl.EventTypes["event:scene.setBackgroundMusic"],(function(t,e){(function(t,e){return ud(this,void 0,void 0,id().mark((function r(){var o,i;return id().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return o=s,i=t,r.next=4,n.transitionSound(o,i,e);case 4:if(i){r.next=6;break}return r.abrupt("return");case 6:u(i);case 7:case"end":return r.stop()}}),r)})))})(t,e).then()}))},{type:"event:scene.preUnmount",listener:e.events.on(bl.EventTypes["event:scene.preUnmount"],(function(){s&&function(t,e){return ud(this,void 0,void 0,id().mark((function r(){return id().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,n.fadeSound(t,0,e);case 2:n.stopSound(t);case 3:case"end":return r.stop()}}),r)})))}(s,e.state.backgroundMusicFade).then()}))}];return function(){t.forEach((function(t){var n=t.type,r=t.listener;e.events.off(n,r)}))}}),[]),(0,df.useEffect)((function(){return e.events.emit(bl.EventTypes["event:scene.mount"]),function(){e.events.emit(bl.EventTypes["event:scene.unmount"])}}),[]),yf().createElement("div",{className:o},yf().createElement(nd,{scene:e,props:{width:i.state.width,height:i.state.height,src:Es.isImageSrc(e.state.background)?Es.srcToString(e.state.background):void 0,style:{backgroundColor:Es.isImageColor(e.state.background)?Es.toHex(e.state.background):void 0}},state:n}),r)}function ld(t){return ld="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},ld(t)}function fd(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,pd(r.key),r)}}function pd(t){var e=function(t,e){if("object"!=ld(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ld(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ld(e)?e:e+""}var hd=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 k}return function(t,e,n){return e&&fd(t.prototype,e),n&&fd(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?Es.srcToString(t.src.state.src):"video"===t.type?t.src:"audio"===t.type?t.src.getSrc():""}}])}();function dd(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 yd(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)?yd(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 yd(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}hd.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 vd=(0,df.createContext)(null);function md(t){var e=t.children,n=dd((0,df.useState)(new hd),1)[0];return yf().createElement(yf().Fragment,null,yf().createElement(vd.Provider,{value:{preloaded:n}},e))}function gd(){if(!vd)throw new Error("usePreloaded must be used within a PreloadedProvider");return(0,df.useContext)(vd)}function bd(t){return function(t){if(Array.isArray(t))return wd(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 wd(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)?wd(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 wd(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 _d(t){var e=t.state,n=gd().preloaded,r=e.getLastScene(),o=(0,df.useRef)(0);return(0,df.useEffect)((function(){var t,r;if("undefined"!=typeof window){window.performance&&(o.current=performance.now());var i=null===(t=e.getLastScene())||void 0===t?void 0:t.srcManager,a=(null===(r=e.getLastScene())||void 0===r?void 0:r.srcManager.future)||[],s=[].concat(bd(i?i.src:[]),bd(a.map((function(t){return t.src})).flat(2))),u={image:new Set,audio:new Set,video:new Set};s.forEach((function(t){t.type===wc.SrcTypes.image?u.image.add(t.src):t.type===wc.SrcTypes.audio?u.audio.add(t.src):t.type===wc.SrcTypes.video&&u.video.add(t.src)})),e.logger.debug("Preloading",u,a),n.preloaded=n.preloaded.filter((function(t){if(t.type===wc.SrcTypes.audio){var e=u[t.type].has(t.src);return e||(e=Array.from(u[t.type]).some((function(e){return n.getSrc(t)===n.getSrc(e.config.src)}))),e}if(t.type===wc.SrcTypes.image)return u[t.type].has(t.src);var r=n.getSrc(t);return u[t.type].has(r)}));var c=[];return u.image.forEach((function(t){var r=new Image;r.src=Es.srcToString(t.state.src),r.onload=function(){e.logger.debug("Image loaded",t.state.src)},c.push(r),n.add({type:"image",src:t})})),Promise.all([]).then((function(){if(e.logger.log("Preloaded","Preloaded ".concat(u.image.size," images")),n.events.emit(hd.EventTypes["event:preloaded.ready"]),e.events.emit(ff.EventTypes["event:state.preload.loaded"]),window.performance){var t=performance.now()-o.current;e.logger.info("Preload","Preloaded ".concat(u.image.size," images in ").concat(t,"ms"))}})),u.audio.forEach((function(t){t.getPlaying()||t.setPlaying(new(e.getHowl())({src:t.config.src,loop:t.config.loop,volume:t.config.volume,autoplay:!1,preload:!0}))})),n.events.emit(hd.EventTypes["event:preloaded.mount"]),function(){c.forEach((function(t){t.onload=null})),e.events.emit(ff.EventTypes["event:state.preload.unmount"]),e.logger.debug("Preload unmounted")}}console.warn("Window is not supported in this environment")}),[r]),null}function Sd(t){var e=t.state,n=wf().game;return(0,df.useEffect)((function(){if(window){var t,r,o,i=(t=function(t){n.config.player.skipKey.includes(t.key)&&e.events.emit(ff.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")}),[]),yf().createElement(yf().Fragment,null)}var kd=o(33);function xd(){return xd=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},xd.apply(null,arguments)}function Ad(t){var e=t.state,n=t.text,r={scale:function(t){return{width:"fit-content"}},transform:function(t){return{transform:Ma.propToCSSTransform(e,t,{translate:["left"===n.config.alignX?"0%":"right"===n.config.alignX?"-100%":void 0,"top"===n.config.alignY?"100%":"bottom"===n.config.alignY?"0%":void 0]})}}};return yf().createElement(Qh,{displayable:{element:n,skipTransform:e.game.config.elements.text.allowSkipTransform,skipTransition:e.game.config.elements.text.allowSkipTransition,transformOverwrites:r},child:function(t){return yf().createElement(Od,xd({},t,{text:n}))},state:e})}function Od(t){var e=t.transformRef,n=t.transformProps,r=t.transition,o=t.text,i=Lp().ratio,a={style:{width:"fit-content",whiteSpace:"nowrap",fontSize:o.state.fontSize}},s=[{}],u=hf(o.config.className);return yf().createElement(vp.Div,null,yf().createElement(vp.mDiv,xd({tag:"text.container",color:"green",border:"dashed",layout:!0,Ref:e,className:"absolute"},b({style:{opacity:0}},n,{style:{width:"fit-content"}})),r?r.toElementProps().map((function(t,e){var n=b(a,t,{style:{transform:"scale(".concat(i.state.scale,")"),transformOrigin:"".concat(o.config.alignX," ").concat(o.config.alignY)}},s[e]||{});return yf().createElement(vp.Span,xd({tag:"text.transition."+e,key:e},n,{className:u}),yf().createElement("span",null,o.state.text))})):yf().createElement(vp.Div,xd({tag:"text.transition.last",color:"green",border:"dashed",key:"last"},b(a,{style:{width:"fit-content",transform:"scale(".concat(i.state.scale,")"),transformOrigin:"".concat(o.config.alignX," ").concat(o.config.alignY)}})),yf().createElement(vp.Span,{className:u},o.state.text))))}function Ed(){return Ed=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},Ed.apply(null,arguments)}function Td(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 jd(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)?jd(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 jd(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 Pd(t){var e=t.props,n=t.onLoad,r=t.id,o=t.Ref,i=(0,df.useRef)(null),a=Lp().ratio,s=Td(yf().useState(0),2),u=s[0],c=s[1];function l(){var t=o||i;t.current&&c(t.current.naturalWidth*a.state.scale)}return(0,df.useEffect)((function(){return l(),a.onUpdate(l)}),[e.src]),(0,df.useEffect)((function(){l()}),[e,r]),yf().createElement("img",Ed({ref:o||i},e,{onLoad:n,width:u,alt:e.alt}))}function Cd(t){return function(t){if(Array.isArray(t))return Rd(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Nd(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 Ld(){return Ld=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},Ld.apply(null,arguments)}function Id(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)||Nd(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 Nd(t,e){if(t){if("string"==typeof t)return Rd(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)?Rd(t,e):void 0}}function Rd(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 Md(t){var e=t.image,n=t.state,r=Id((0,df.useState)(0),2),o=r[0],i=r[1],a=wf().game;(0,df.useEffect)((function(){i(performance.now())}),[]);var s=function(){var t=performance.now()-o,e=a.config.elements.img.slowLoadThreshold;t>e&&a.config.elements.img.slowLoadWarning&&n.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.")};return yf().createElement(Qh,{displayable:{element:e,skipTransition:n.game.config.elements.img.allowSkipTransition,skipTransform:n.game.config.elements.img.allowSkipTransform,transformOverwrites:{}},child:function(t){return yf().createElement(Fd,Ld({},t,{image:e,handleLoad:s}))},state:n})}function Fd(t){var e=t.transition,n=t.transformProps,r=t.transformRef,o=t.state,i=t.image,a=t.handleLoad,s=Lp().ratio,u=(0,df.useRef)(null),c=Id((0,df.useState)([]),2),l=c[0],f=c[1],p={src:Es.staticImageDataToSrc(i.state.src),style:Object.assign(Object.assign({},o.game.config.app.debug?{outline:"1px solid red"}:{}),{transformOrigin:"center"})},h=[{style:{display:"block",position:"unset"}},{style:{top:"50%",left:"50%",transform:"translate(-50%, -50%)",maxWidth:"none"}}];return(0,df.useEffect)((function(){var t=i.events.onEvents([{type:ts.EventTypes["event:wearable.create"],listener:i.events.on(ts.EventTypes["event:wearable.create"],(function(t){f((function(e){return[].concat(Cd(e),[t])}))}))}]);return function(){t.cancel()}}),[]),yf().createElement("div",null,yf().createElement(vp.mDiv,Ld({tag:"image.aspectScaleContainer",color:"green",border:"dashed",layout:!0,Ref:r,className:"absolute"},b({style:{opacity:0}},n,{style:{display:"inline-block",width:u.current?"".concat(u.current.naturalWidth*s.state.scale,"px"):"auto",height:u.current?"".concat(u.current.naturalHeight*s.state.scale,"px"):"auto"}})),yf().createElement(yf().Fragment,null,(e?e.toElementProps():[{}]).map((function(t,e){var n=b(p,t,h[e]||{});return yf().createElement(Pd,{key:e,props:Object.assign({className:"absolute"},n),id:n.src,onLoad:a,Ref:0===e?u:void 0})}))),yf().createElement("div",{className:hf("w-full h-full top-0 left-0 absolute")},l.map((function(t){return yf().createElement("div",{className:hf("w-full h-full relative"),key:"wearable-"+t.getId()},yf().createElement(Md,{image:t,state:o}))})))))}function Dd(t){var e=t.state,n=t.displayable;return yf().createElement(yf().Fragment,null,n.map((function(t){var n;if(t instanceof al)return yf().createElement(Ad,{state:e,text:t,key:"text-"+t.getId()});if(t instanceof ts)return yf().createElement(Md,{state:e,image:t,key:"image-"+t.getId()});throw new Error("Unsupported displayable type: "+((null===(n=null==t?void 0:t.constructor)||void 0===n?void 0:n.name)||t))})))}var Bd=o(556),Vd=o.n(Bd);function Gd(t){var e=t.error,n=t.errorInfo;return wf().game.config.app.debug?yf().createElement("div",{className:"text-left"},yf().createElement("h1",null,"It is my fault, NarraLeaf-React cannot initialize the player correctly."),yf().createElement("p",{className:"text-red-700"},"Message: ",e.message),yf().createElement("pre",null,"Error Stack: ",null==e?void 0:e.stack),yf().createElement("pre",null,"Component Stack: ",null==n?void 0:n.componentStack),yf().createElement("pre",null,"Digest: ",null==n?void 0:n.digest)):yf().createElement("div",null,yf().createElement("h1",null,"The game cannot initialize the player correctly."),yf().createElement("p",null,"Please contact the game developer for further assistance."))}function Ud(t){return Ud="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},Ud(t)}function zd(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,Wd(r.key),r)}}function Wd(t){var e=function(t,e){if("object"!=Ud(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ud(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ud(e)?e:e+""}function Hd(t,e,n){return e=Yd(e),function(t,e){if(e&&("object"==Ud(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,$d()?Reflect.construct(e,n||[],Yd(t).constructor):e.apply(t,n))}function $d(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return($d=function(){return!!t})()}function Yd(t){return Yd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Yd(t)}function qd(t,e){return qd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},qd(t,e)}var Xd=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=Hd(this,e,arguments)).state={hasError:!1,error:null,errorInfo:null},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&&qd(t,e)}(e,t),function(t,e,n){return e&&zd(t.prototype,e),n&&zd(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"componentDidCatch",value:function(t,e){this.setState({error:t,errorInfo:e}),console.error(t,e)}},{key:"render",value:function(){return this.state.hasError?yf().createElement(Gd,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}],[{key:"getDerivedStateFromError",value:function(t){return{hasError:!0,error:t,errorInfo:null}}}])}(yf().Component);function Kd(t){var e=t.containerRef,n=Lp().ratio;return(0,df.useEffect)((function(){var t=e.current;if(t){var r=new ResizeObserver((function(){n.requestUpdate()}));return r.observe(t),function(){r.disconnect()}}}),[e.current]),null}function Zd(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 Qd(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)?Qd(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 Qd(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 Jd(t,e){return t.handle(e)}function ty(t){var e=t.story,n=t.width,r=t.height,o=t.className,i=t.onReady,a=t.onEnd,s=Zd((0,df.useReducer)((function(t){return t+1}),0),2)[1],u=wf().game,c=Zd((0,df.useReducer)(Jd,new ff(u,{update:s,forceUpdate:function(){l.logger.warn("Player","force update"),(0,kd.flushSync)((function(){s()}))},next:y,dispatch:function(t){return f(t)}})),2),l=c[0],f=c[1],p=yf().createRef(),h=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(w.isAwaitable(e)){t=!0;break}if(e instanceof P){e.nextUnlock().then((function(){y()})),t=!0;break}f(e)}l.stage.update()}(0,df.useEffect)((function(){return u.getLiveGame().setGameState(l).loadStory(e),function(){u.getLiveGame().setGameState(void 0)}}),[u]),(0,df.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:ff.EventTypes["event:state.end"],listener:function(){a&&a({game:u,gameState:l,liveGame:u.getLiveGame(),storable:u.getLiveGame().getStorable()})}}]),o=l.events.onEvents([{type:ff.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(ff.EventTypes["event:state.player.flush"]);var v=n||u.config.player.width,m=r||u.config.player.height;return yf().createElement(Xd,null,yf().createElement(zh,null,yf().createElement("div",{style:{width:"number"==typeof v?"".concat(v,"px"):v,height:"number"==typeof m?"".concat(m,"px"):m},className:hf(o,"__narraleaf_content-player"),ref:p},yf().createElement($h,{className:hf("flex-grow overflow-auto")},yf().createElement(Kd,{containerRef:p}),yf().createElement(Fp,{className:"relative"},yf().createElement(_d,{state:l}),yf().createElement(ey,{onLoaded:function(){l.stage.update(),e&&y()},state:l},yf().createElement(Sd,{state:l}),l.getSceneElements().map((function(t){var e=t.scene,n=t.ele;return yf().createElement(cd,{key:"scene-"+e.getId(),state:l,scene:e},yf().createElement(Dd,{state:l,displayable:n.displayable}),n.texts.map((function(t){var e=t.action,n=t.onClick;return yf().createElement(h,{state:l,key:"say-"+e.id,action:e,onClick:function(){n(),y()}})})),n.menus.map((function(t,e){return yf().createElement("div",{key:"menu-"+e},yf().createElement(d,{state:l,prompt:t.action.prompt,choices:t.action.choices,afterChoose:function(e){t.onClick(e),y()}}))})))}))))))))}function ey(t){var e=t.children,n=t.onLoaded,r=t.state,o=gd().preloaded,i=Zd((0,df.useState)(!1),2),a=i[0],s=i[1];return(0,df.useEffect)((function(){var t=o.events.on(hd.EventTypes["event:preloaded.ready"],(function(){s(!0),n()})),e=r.events.on(ff.EventTypes["event:state.preload.unmount"],(function(){s(!1)}));return function(){o.events.off(hd.EventTypes["event:preloaded.ready"],t),r.events.off(ff.EventTypes["event:state.preload.unmount"],e)}}),[a]),yf().createElement(yf().Fragment,null,a?e:null)}function ny(t){var e=t.children,n=t.game;return yf().createElement(yf().Fragment,null,yf().createElement(Cp,null,yf().createElement(bf,{game:n},yf().createElement(md,null,e))))}function ry(t){return ry="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},ry(t)}function oy(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,iy(r.key),r)}}function iy(t){var e=function(t,e){if("object"!=ry(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ry(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ry(e)?e:e+""}function ay(t,e,n){return e=uy(e),function(t,e){if(e&&("object"==ry(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,sy()?Reflect.construct(e,n||[],uy(t).constructor):e.apply(t,n))}function sy(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(sy=function(){return!!t})()}function uy(t){return uy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},uy(t)}function cy(t,e){return cy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},cy(t,e)}Xd.propTypes={children:Vd().node.isRequired};var ly=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=ay(this,e)).state={opacity:1},t.duration=n,t.easing=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&&cy(t,e)}(e,t),function(t,e,n){return e&&oy(t.prototype,e),n&&oy(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){return this.src=t,this}},{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}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{opacity:1}},{style:{opacity:this.state.opacity,backgroundColor:Es.isImageColor(this.src)?S(this.src):""},src:Es.isImageSrc(this.src)?Es.srcToString(this.src):""}]}},{key:"copy",value:function(){return new e(this.duration,this.easing).setSrc(this.src)}}])}(zc);function fy(t){return fy="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},fy(t)}function py(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,hy(r.key),r)}}function hy(t){var e=function(t,e){if("object"!=fy(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=fy(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==fy(e)?e:e+""}function dy(t,e,n){return e=vy(e),function(t,e){if(e&&("object"==fy(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,yy()?Reflect.construct(e,n||[],vy(t).constructor):e.apply(t,n))}function yy(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(yy=function(){return!!t})()}function vy(t){return vy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vy(t)}function my(t,e){return my=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},my(t,e)}ly.Frames=[0,1];var gy=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=dy(this,e)).state={opacity:0,transform:""},r.duration=o,r.direction=t,r.offset=n,r.easing=i,r.__stack=x(),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&&my(t,e)}(e,t),function(t,e,n){return e&&py(t.prototype,e),n&&py(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){return this.src=t,this}},{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)}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{opacity:1}},{style:{opacity:this.state.opacity,transform:this.state.transform,backgroundColor:Es.isImageColor(this.src)?S(this.src):""},src:Es.isImageSrc(this.src)?Es.srcToString(this.src):""}]}},{key:"copy",value:function(){return new e(this.direction,this.offset,this.duration,this.easing).setSrc(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""}}}])}(zc);function by(t){return by="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},by(t)}function wy(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,_y(r.key),r)}}function _y(t){var e=function(t,e){if("object"!=by(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=by(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==by(e)?e:e+""}function Sy(t,e,n){return e=xy(e),function(t,e){if(e&&("object"==by(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,ky()?Reflect.construct(e,n||[],xy(t).constructor):e.apply(t,n))}function ky(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ky=function(){return!!t})()}function xy(t){return xy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},xy(t)}function Ay(t,e){return Ay=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ay(t,e)}var Oy=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=Sy(this,e)).state={opacity:0},t.duration=n,t.easing=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&&Ay(t,e)}(e,t),function(t,e,n){return e&&wy(t.prototype,e),n&&wy(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){return this.src=t,this}},{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}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{opacity:this.state.opacity}},{style:{opacity:1-this.state.opacity,backgroundColor:Es.isImageColor(this.src)?S(this.src):""},src:Es.isImageSrc(this.src)?Es.srcToString(this.src):""}]}},{key:"copy",value:function(){return new e(this.duration,this.easing).setSrc(this.src)}}])}(zc);Oy.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},387:(t,e,n)=>{"use strict";t.exports=n(73)},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";o.r(i),o.d(i,{Align:()=>Ne,BaseImageTransition:()=>zc,BaseTextTransition:()=>Hc,BaseTransition:()=>Wc,Bottom:()=>hy,Center:()=>py,Character:()=>mu,CommonPosition:()=>Le,CommonPositionType:()=>be,Condition:()=>Uu,Control:()=>Ha,Coord2D:()=>Ie,Dissolve:()=>zy,Fade:()=>Ty,FadeIn:()=>My,Game:()=>Qp,GameProviders:()=>uy,GameState:()=>Pp,HBox:()=>wy,Image:()=>es,Isolated:()=>bp,Lambda:()=>Gu,LiveGame:()=>Wp,Menu:()=>sc,Namespace:()=>Dp,Pause:()=>Ws,Player:()=>ay,Say:()=>mp,Scene:()=>wl,Script:()=>Dl,Sentence:()=>Js,Sound:()=>Bs,SoundType:()=>js,Storable:()=>Bp,Story:()=>$l,Text:()=>sl,Top:()=>fy,Transform:()=>Fa,Utils:()=>Ts,VBox:()=>by,Word:()=>Ys,useGame:()=>ef});var t={say:"character:say",action:"character:action",setName:"character:setName"},e={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"},n={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",initWearable:"image:initWearable"},r={action:"sound:action",play:"sound:play",stop:"sound:stop",fade:"sound:fade",setVolume:"sound:setVolume",setRate:"sound:setRate",pause:"sound:pause",resume:"sound:resume"},a={action:"control:action",do:"control:do",doAsync:"control:doAsync",any:"control:any",all:"control:all",allAsync:"control:allAsync",repeat:"control:repeat",sleep:"control:sleep"},s={action:"text:action",setText:"text:setText",show:"text:show",hide:"text:hide",applyTransform:"text:applyTransform",init:"text:init",applyTransition:"text:applyTransition",setFontSize:"text:setFontSize"};function u(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */u=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",c=i.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(t){l=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var i=e&&e.prototype instanceof b?e:b,a=Object.create(i.prototype),s=new L(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function p(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var h="suspendedStart",d="suspendedYield",y="executing",v="completed",g={};function b(){}function w(){}function _(){}var S={};l(S,a,(function(){return this}));var k=Object.getPrototypeOf,x=k&&k(k(I([])));x&&x!==n&&r.call(x,a)&&(S=x);var A=_.prototype=b.prototype=Object.create(S);function O(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(o,i,a,s){var u=p(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==m(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=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){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=j(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=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=y;var c=p(e,n,r);if("normal"===c.type){if(o=r.done?v:d,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=v,r.method="throw",r.arg=c.arg)}}}function j(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,j(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=p(o,e.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[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function P(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 L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function I(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(m(e)+" is not iterable")}return w.prototype=_,o(A,"constructor",{value:_,configurable:!0}),o(_,"constructor",{value:w,configurable:!0}),w.displayName=l(_,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,l(t,c,"GeneratorFunction")),t.prototype=Object.create(A),t},e.awrap=function(t){return{__await:t}},O(E.prototype),l(E.prototype,s,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new E(f(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(A),l(A,c,"Generator"),l(A,a,(function(){return this})),l(A,"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=I,L.prototype={constructor:L,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(C),!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,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(e,n,r){return this.delegate={iterator:I(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function c(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=y(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 l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function f(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,h(r.key),r)}}function p(t,e,n){return e&&f(t.prototype,e),n&&f(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function h(t){var e=function(t,e){if("object"!=m(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=m(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==m(e)?e:e+""}function d(t){return function(t){if(Array.isArray(t))return v(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||y(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 y(t,e){if(t){if("string"==typeof t)return v(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)?v(t,e):void 0}}function v(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 m(t){return m="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},m(t)}var g=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 b(t,e){var n,r,o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i={};for(var a in t)o(t,a)&&(i[a]=(n=t[a],r=e[a],"object"!==m(n)||null===n||Array.isArray(n)||"object"!==m(r)||null===r||Array.isArray(r)?Array.isArray(n)&&Array.isArray(r)?r&&r.length>0?d(r):d(n):void 0===n&&Array.isArray(r)?d(r):void 0===r?Array.isArray(n)?d(n):n:Array.isArray(r)?d(r):r:n.constructor!==Object||r.constructor!==Object?r||n:b(n,r)));for(var s in e)o(e,s)&&!o(i,s)&&("object"===m(e[s])&&null!==e[s]&&e[s].constructor===Object?i[s]=b({},e[s]):i[s]=e[s]);for(var u=arguments.length,c=new Array(u>2?u-2:0),l=2;l<u;l++)c[l-2]=arguments[l];if(c.length){var f=c[0],p=c.slice(1);return b.apply(void 0,[i,f].concat(d(p)))}return i}var w=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t},n=arguments.length>1?arguments[1]:void 0;l(this,t),this.solved=!1,this.listeners=[],this.receiver=e,this.skipController=n}return p(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 e,n=c(this.listeners);try{for(n.s();!(e=n.n()).done;){(0,e.value)(this.result)}}catch(t){n.e(t)}finally{n.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 _(t){var e=new WeakSet;return function t(n){if(null===n||"object"!==m(n))return n;if(!e.has(n)){if(e.add(n),Array.isArray(n)){var r,o=[],i=c(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;o.push(t(a))}}catch(t){i.e(t)}finally{i.f()}return o}var s={};for(var u in n)Object.prototype.hasOwnProperty.call(n,u)&&(s[u]=t(n[u]));return s}}(t)}function S(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"))}w.nothing=function(t){return t};var k=function(){return p((function t(){l(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(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 g(this,void 0,void 0,u().mark((function e(){var r,o,i,a,s,l,f=this;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.events[t]||(this.events[t]=[]),r=[],o=!1,i=c(this.events[t]);try{for(i.s();!(a=i.n()).done;)s=a.value,(l=s.apply(void 0,n))&&"object"===m(l)&&"function"==typeof l.then?r.push(l):o=!0}catch(t){i.e(t)}finally{i.f()}if(!o){e.next=7;break}return e.abrupt("return",void 0);case 7:if(this.events[t]=this.events[t].filter((function(t){return!r.includes(t)})),0!==r.length){e.next=10;break}return e.abrupt("return",new Promise((function(e){var r=f.on("event:EventDispatcher.register",(function(o,i){if(o===t){f.off(o,r);var a=null==i?void 0:i.apply(void 0,n);a&&a.then?a.then(e):e(a)}}))})));case 10:return e.next=12,Promise.all(r);case 12:return e.abrupt("return",void 0);case 13:case"end":return e.stop()}}),e,this)})))}},{key:"clear",value:function(){this.events={}}}])}();function x(){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 A(t){return new Promise((function(e){return setTimeout(e,t)}))}function O(t,e){if(t===e)return!0;if("object"!==m(t)||"object"!==m(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)||!O(t[a],e[a]))return!1}return!0}var E=function(){return p((function t(e,n){l(this,t),this.game=e,this.prefix=n}),[{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,d(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,d(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,d(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,d(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,d(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)}}])}(),T=function(){return p((function t(e){l(this,t),this.abortHandler=e,this.events=new k,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}}])}();T.EventTypes={"event:skipController.abort":"event:skipController.abort"};var j=function(){return p((function t(){l(this,t),this.locked=!1,this.listeners=[],this.unlockListeners=[]}),[{key:"lock",value:function(){return this.locked=!0,this}},{key:"unlock",value:function(){this.locked=!1;var t,e=c(this.listeners);try{for(e.s();!(t=e.n()).done;){(0,t.value)()}}catch(t){e.e(t)}finally{e.f()}var n,r=c(this.unlockListeners);try{for(r.s();!(n=r.n()).done;){(0,n.value)()}}catch(t){r.e(t)}finally{r.f()}return this.listeners=[],this}},{key:"onUnlock",value:function(t){return this.unlockListeners.push(t),t}},{key:"offUnlock",value:function(t){this.unlockListeners=this.unlockListeners.filter((function(e){return e!==t}))}},{key:"nextUnlock",value:function(){return g(this,void 0,void 0,u().mark((function t(){var e=this;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.locked){t.next=2;break}return t.abrupt("return");case 2:return t.abrupt("return",new Promise((function(t){e.listeners.push(t)})));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"isLocked",value:function(){return this.locked}}])}(),P=function(){return p((function t(){l(this,t),this.locks=[]}),[{key:"unlock",value:function(t){return t.unlock(),this.off(t),t}},{key:"register",value:function(t){var e=t||new j;return this.locks.push(e),e}},{key:"off",value:function(t){this.locks=this.locks.filter((function(e){return e!==t}))}},{key:"nextUnlock",value:function(){return g(this,void 0,void 0,u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.locks.map((function(t){return t.nextUnlock()})),t.abrupt("return",Promise.all(e));case 2:case"end":return t.stop()}}),t,this)})))}},{key:"isLocked",value:function(){return this.locks.some((function(t){return t.isLocked()}))}}])}();function C(t,e){return t?e:arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}}function L(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(t){return void 0!==t};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&r in e&&n(t[r],r)&&e[r](t[r],r)}var I=function(){return p((function t(){l(this,t),this.taskToken=null}),[{key:"scheduleTask",value:function(t,e){this.taskToken&&this.taskToken.cancel();var n=!1,r=setTimeout((function(){n||t()}),e);return this.taskToken={cancel:function(){clearTimeout(r),n=!0},isCancelled:function(){return n}},this.taskToken}},{key:"cancelTask",value:function(){return this.taskToken&&(this.taskToken.cancel(),this.taskToken=null),this}}])}();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,M(r.key),r)}}function M(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 F=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(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=x(),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]:[]}}])}();function D(t){return D="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},D(t)}function B(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */B=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 P(r||[]);return o(a,"_invoke",{value:O(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",h="suspendedYield",d="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"==D(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(D(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 V(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,G(r.key),r)}}function G(t){var e=function(t,e){if("object"!=D(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=D(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==D(e)?e:e+""}function U(t,e,n){return e=z(e),function(t,e){if(e&&("object"==D(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,W()?Reflect.construct(e,n||[],z(t).constructor):e.apply(t,n))}function W(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(W=function(){return!!t})()}function z(t){return z=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},z(t)}function H(t,e){return H=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},H(t,e)}F.ActionTypes={action:"action"};var $=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())}))},Y=function(t){function e(t,n,r){var o;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(o=U(this,e,[t,n,r])).callee=t.getSelf(),o.contentNode.action=o,o}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&&H(t,e)}(e,t),function(t,e,n){return e&&V(t.prototype,e),n&&V(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"unknownType",value:function(){throw new Error("Unknown action type: "+this.type)}},{key:"resolveAwaitable",value:function(t,e){var n=this,r=e||new w((function(t){return t}));return $(n,void 0,void 0,B().mark((function e(){return B().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t(r.resolve.bind(r),r);case 2:case"end":return e.stop()}}),e)}))),r}}])}(F);function q(t){return q="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},q(t)}function X(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 K(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)?K(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 K(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 Z(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,Q(r.key),r)}}function Q(t){var e=function(t,e){if("object"!=q(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=q(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==q(e)?e:e+""}function J(t,e,n){return e=rt(e),function(t,e){if(e&&("object"==q(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,tt()?Reflect.construct(e,n||[],rt(t).constructor):e.apply(t,n))}function tt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(tt=function(){return!!t})()}function et(t,e,n,r){var o=nt(rt(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function nt(){return nt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=rt(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}},nt.apply(null,arguments)}function rt(t){return rt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},rt(t)}function ot(t,e){return ot=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ot(t,e)}var it=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),J(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&&ot(t,e)}(e,t),function(t,e,n){return e&&Z(t.prototype,e),n&&Z(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===r.play){if(e.initSound(t,this.callee),!this.callee.getPlaying())throw new Error("Howl is not initialized");if(this.callee.config.sync&&!this.callee.config.loop){var o=new w((function(t){return t}));return t.playSound(this.callee,(function(){var e;t.stopSound(n.callee),o.resolve({type:n.type,node:null===(e=n.contentNode)||void 0===e?void 0:e.getChild()})})),o}return t.playSound(this.callee,(function(){t.stopSound(n.callee)})),et(e,"executeAction",this,3)([t])}if(this.type===r.stop)return t.stopSound(this.callee),et(e,"executeAction",this,3)([t]);if(this.type===r.fade){var i=X(this.contentNode.getContent(),1)[0],a=i.start,s=i.end,u=i.duration;if(this.callee.getPlaying()){var c=void 0===a?this.callee.getPlaying().volume():a;this.callee.getPlaying().fade(c,s,u,this.callee.getToken())}return et(e,"executeAction",this,3)([t])}if(this.type===r.setVolume){var l=X(this.contentNode.getContent(),1)[0];return this.callee.getPlaying()&&this.callee.getPlaying().volume(l,this.callee.getToken()),et(e,"executeAction",this,3)([t])}if(this.type===r.setRate){var f=X(this.contentNode.getContent(),1)[0];return this.callee.getPlaying()&&this.callee.getPlaying().rate(f,this.callee.getToken()),et(e,"executeAction",this,3)([t])}if(this.type===r.pause)return this.callee.getPlaying()&&this.callee.getPlaying().pause(this.callee.getToken()),et(e,"executeAction",this,3)([t]);if(this.type===r.resume)return this.callee.getPlaying()&&this.callee.getPlaying().play(this.callee.getToken()),et(e,"executeAction",this,3)([t]);throw et(e,"unknownType",this,3)([])}}],[{key:"initSound",value:function(t,e){e.getPlaying()||e.setPlaying(new(t.getHowl())(e.getHowlOptions()))}}])}(Y);function at(t){return at="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},at(t)}function st(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 ut(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)?ut(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 ut(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 ct(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,lt(r.key),r)}}function lt(t){var e=function(t,e){if("object"!=at(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=at(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==at(e)?e:e+""}function ft(t,e,n){return e=yt(e),function(t,e){if(e&&("object"==at(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,pt()?Reflect.construct(e,n||[],yt(t).constructor):e.apply(t,n))}function pt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(pt=function(){return!!t})()}function ht(t,e,n,r){var o=dt(yt(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function dt(){return dt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=yt(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}},dt.apply(null,arguments)}function yt(t){return yt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},yt(t)}function vt(t,e){return vt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},vt(t,e)}it.ActionTypes=r;var mt,gt=function(t){function n(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),ft(this,n,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&&vt(t,e)}(n,t),function(t,e,n){return e&&ct(t.prototype,e),n&&ct(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"executeAction",value:function(t){var r,o=this;if(this.type===e.action)return ht(n,"executeAction",this,3)([t]);if(this.type===e.setBackground)return this.callee.state.background=this.contentNode.getContent()[0],ht(n,"executeAction",this,3)([t]);if(this.type===e.sleep){var i=new w((function(t){return t})),a=this.contentNode.getContent();return new Promise((function(t){"number"==typeof a?setTimeout((function(){t()}),a):w.isAwaitable(a)?a.then(t):null==a||a.then(t)})).then((function(){i.resolve({type:o.type,node:o.contentNode.getChild()}),t.stage.next()})),i}if(this.type===e.applyTransition){var s=(new w).registerSkipController(new T((function(){return t.logger.info("NarraLeaf-React: Background Transition","Skipped"),{type:o.type,node:o.contentNode.getChild()}}))),u=this.contentNode.getContent()[0];return this.callee.events.any("event:displayable.applyTransition",u).then((function(){s.resolve({type:o.type,node:o.contentNode.getChild()}),t.stage.next()})),s}if(this.type===e.init){var c=new w((function(t){return t}));return n.handleSceneInit(this,t,c)}if(this.type===e.exit){t.offSrcManager(this.callee.srcManager).removeScene(this.callee);var l=new w((function(t){return t}));return this.callee.events.once("event:scene.unmount",(function(){l.resolve({type:o.type,node:o.contentNode.getChild()}),t.stage.next()})),l}if(this.type===e.jumpTo){var f=this.contentNode.getContent()[0],p=this.contentNode,h=(null===(r=f.sceneRoot)||void 0===r?void 0:r.contentNode)||null;return h&&p.addChild(h),ht(n,"executeAction",this,3)([t])}if(this.type===e.setBackgroundMusic){var d=st(this.contentNode.getContent(),2),y=d[0],v=d[1];return this.callee.events.emit("event:scene.setBackgroundMusic",y,v||0),ht(n,"executeAction",this,3)([t])}if(this.type===e.preUnmount)return this.callee.events.emit("event:scene.preUnmount"),ht(n,"executeAction",this,3)([t]);if(this.type===e.applyTransform){var m=st(this.contentNode.getContent(),1)[0],g=new w((function(t){return t})).registerSkipController(new T((function(){return{type:o.type,node:o.contentNode.getChild()}})));return this.callee.events.any("event:displayable.applyTransform",m).then((function(){g.resolve({type:o.type,node:o.contentNode.getChild()}),t.stage.next()})),g}throw new Error("Unknown scene action type: "+this.type)}},{key:"getFutureActions",value:function(){var t,n,r;if(this.type===e.jumpTo){var o=null===(n=null===(t=this.contentNode.getContent()[0])||void 0===t?void 0:t.sceneRoot)||void 0===n?void 0:n.contentNode;return(null==o?void 0:o.action)?[o.action]:[]}var i=null===(r=this.contentNode.getChild())||void 0===r?void 0:r.action;return i?[i]:[]}}],[{key:"handleSceneInit",value:function(t,e,r){return e.isSceneActive(t.callee)?{type:t.type,node:t.contentNode.getChild()}:(e.registerSrcManager(t.callee.srcManager).addScene(t.callee),n.registerEventListeners(t.callee,e,(function(){r.resolve({type:t.type,node:t.contentNode.getChild()}),e.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&&(it.initSound(e,t.state.backgroundMusic),t.events.emit("event:scene.setBackgroundMusic",t.state.backgroundMusic,t.config.backgroundMusicFade))})),t.events.any("event:displayable.init").then((function(){n&&n()}))}}])}(Y);function bt(t){return bt="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},bt(t)}function wt(t,e,n){return e=St(e),function(t,e){if(e&&("object"==bt(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||[],St(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 St(t){return St=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},St(t)}function kt(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&&xt(t,e)}function xt(t,e){return xt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},xt(t,e)}function At(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ot(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,Tt(r.key),r)}}function Et(t,e,n){return e&&Ot(t.prototype,e),n&&Ot(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Tt(t){var e=function(t,e){if("object"!=bt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=bt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==bt(e)?e:e+""}gt.ActionTypes=e,function(t){t.TreeNode="TreeNode",t.ContentNode="ContentNode"}(mt||(mt={}));var jt=function(t){function e(t,n,r){var o;return At(this,e),(o=wt(this,e,[mt.ContentNode])).child=r||null,o.parent=n||null,o.action=t||null,o}return kt(e,t),Et(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 Et((function t(e){At(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 Pt(t){return Pt="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},Pt(t)}function Ct(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,Lt(r.key),r)}}function Lt(t){var e=function(t,e){if("object"!=Pt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Pt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Pt(e)?e:e+""}var It=function(){return function(t,e,n){return e&&Ct(t.prototype,e),n&&Ct(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 Nt(t){return Nt="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},Nt(t)}function Rt(t){return function(t){if(Array.isArray(t))return Bt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Dt(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 Mt(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Dt(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 Ft(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)||Dt(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 Dt(t,e){if(t){if("string"==typeof t)return Bt(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)?Bt(t,e):void 0}}function Bt(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 Vt(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Vt=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 P(r||[]);return o(a,"_invoke",{value:O(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",h="suspendedYield",d="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"==Nt(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(Nt(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 Gt(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,Ut(r.key),r)}}function Ut(t){var e=function(t,e){if("object"!=Nt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Nt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Nt(e)?e:e+""}function Wt(t,e,n){return e=Yt(e),function(t,e){if(e&&("object"==Nt(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,zt()?Reflect.construct(e,n||[],Yt(t).constructor):e.apply(t,n))}function zt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(zt=function(){return!!t})()}function Ht(t,e,n,r){var o=$t(Yt(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function $t(){return $t="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Yt(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}},$t.apply(null,arguments)}function Yt(t){return Yt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Yt(t)}function qt(t,e){return qt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},qt(t,e)}var Xt,Kt=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())}))},Zt=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Wt(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&&qt(t,e)}(e,t),function(t,e,n){return e&&Gt(t.prototype,e),n&&Gt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAllActions",value:function(t,e){return Kt(this,void 0,void 0,Vt().mark((function n(){var r,o,i;return Vt().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:r=!1,o=e,i=Vt().mark((function e(){var n,r,i;return Vt().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(!w.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 Kt(this,void 0,void 0,Vt().mark((function n(){var r,o,i;return Vt().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=t.game.getLiveGame().executeAction(t,e),!w.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):Ht(e,"executeAction",this,3)([t])}},{key:"executeAction",value:function(t){var n=this,r=Ft(this.contentNode.getContent(),1)[0];if(this.type===a.do){var o=new w((function(t){return t}));return this.execute(t,o,r)}if(this.type===a.doAsync)return Kt(n,void 0,void 0,Vt().mark((function e(){return Vt().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)}))),Ht(e,"executeAction",this,3)([t]);if(this.type===a.any){var i=new w((function(t){return t})),s=r.map((function(e){return n.executeSingleAction(t,e)}));return Promise.any(s).then((function(){i.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),i}if(this.type===a.all){var u=new w((function(t){return t}));return Kt(n,void 0,void 0,Vt().mark((function e(){var n=this;return Vt().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:u.resolve({type:this.type,node:this.contentNode.getChild()}),t.stage.next();case 4:case"end":return e.stop()}}),e,this)}))),u}if(this.type===a.allAsync)return Kt(n,void 0,void 0,Vt().mark((function e(){var n,o,i;return Vt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=Mt(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)}))),Ht(e,"executeAction",this,3)([t]);if(this.type===a.repeat){var c=Ft(this.contentNode.getContent(),2),l=c[0],f=c[1],p=new w((function(t){return t}));return Kt(n,void 0,void 0,Vt().mark((function e(){var n;return Vt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=0;case 1:if(!(n<f)){e.next=8;break}if(!(l.length>0)){e.next=5;break}return e.next=5,this.executeAllActions(t,l[0]);case 5:n++,e.next=1;break;case 8:p.resolve({type:this.type,node:this.contentNode.getChild()}),t.stage.next();case 10:case"end":return e.stop()}}),e,this)}))),p}if(this.type===a.sleep){var h=new w((function(t){return t})),d=Ft(this.contentNode.getContent(),2)[1];return new Promise((function(t){"number"==typeof d?setTimeout((function(){t()}),d):w.isAwaitable(d)?d.then(t):null==d||d.then(t)})).then((function(){h.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),h}throw new Error("Unknown control action type: "+this.type)}},{key:"getFutureActions",value:function(){var t=this.contentNode.getContent()[0],n=Ht(e,"getFutureActions",this,3)([]);return[].concat(Rt(t),Rt(n))}}])}(Y);function Qt(t){return Qt="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},Qt(t)}function Jt(t){return function(t){if(Array.isArray(t))return te(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 te(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)?te(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 te(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 ee(t,e,n){return e=re(e),function(t,e){if(e&&("object"==Qt(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,ne()?Reflect.construct(e,n||[],re(t).constructor):e.apply(t,n))}function ne(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ne=function(){return!!t})()}function re(t){return re=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},re(t)}function oe(t,e){return oe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},oe(t,e)}function ie(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ae(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,ue(r.key),r)}}function se(t,e,n){return e&&ae(t.prototype,e),n&&ae(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function ue(t){var e=function(t,e){if("object"!=Qt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Qt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Qt(e)?e:e+""}Zt.ActionTypes=a;var ce=Symbol("_Chained"),le=function(){function t(e){ie(this,t),this[Xt]=!0,this.__actions=[],this.__self=e}return se(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[ce]}},{key:"toActions",value:function(e){return e.flat(2).map((function(e){return t.isChained(e)?e.fromChained(e):e})).flat(3)}}])}();Xt=ce;var fe=function(t){function e(){return ie(this,e),ee(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&&oe(t,e)}(e,t),se(e,[{key:"chain",value:function(t){var e=le.isChained(this)?this:this.proxy(this,new le(this));if(!t)return e;var n=Array.isArray(t)?t:[t];return e.push.apply(e,Jt(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 Zt(t.chain(),Zt.ActionTypes.do,(new jt).setContent([this.construct(le.toActions([n]))]));return this.chain(r)}}])}(It);function pe(t){return pe="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},pe(t)}function he(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,de(r.key),r)}}function de(t){var e=function(t,e){if("object"!=pe(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=pe(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==pe(e)?e:e+""}function ye(t,e,n){return e=me(e),function(t,e){if(e&&("object"==pe(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,ve()?Reflect.construct(e,n||[],me(t).constructor):e.apply(t,n))}function ve(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ve=function(){return!!t})()}function me(t){return me=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},me(t)}function ge(t,e){return ge=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ge(t,e)}var be,we=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ye(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&&ge(t,e)}(e,t),function(t,e,n){return e&&he(t.prototype,e),n&&he(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"toData",value:function(){return null}},{key:"fromChained",value:function(t){return t.getActions()}}])}(fe),_e="center",Se="left",ke="right";function xe(t){return xe="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},xe(t)}function Ae(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Oe(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,je(r.key),r)}}function Ee(t,e,n){return e&&Oe(t.prototype,e),n&&Oe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Te(t,e,n){return(e=je(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function je(t){var e=function(t,e){if("object"!=xe(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=xe(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==xe(e)?e:e+""}!function(t){t.Left="left",t.Center="center",t.Right="right"}(be||(be={}));var Pe=Te(Te(Te({},be.Left,"33.33%"),be.Center,"50%"),be.Right,"66.66%"),Ce=function(){function t(){Ae(this,t)}return Ee(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(Le.isCommonPositionType(t))return Ie.fromCommonPosition(t);if(Ie.isCoord2DPosition(t))return t;if(Ne.isAlignPosition(t))return Ie.fromAlignPosition(t);if("object"===xe(t)&&["x","y","xoffset","yoffset"].some((function(e){return e in t})))return new Ie(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 Ie.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(be).includes(t)}},{key:"isRawCoord2DPosition",value:function(t){return"object"===xe(t)&&("x"in t||"y"in t||"xoffset"in t||"yoffset"in t)}},{key:"isRawAlignPosition",value:function(t){return"object"===xe(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 Le||t instanceof Ie||t instanceof Ne}},{key:"rawPositionToCoord2D",value:function(t){if(this.isRawCommonPositionType(t))return Ie.fromCommonPosition(new Le(t));if(this.isRawCoord2DPosition(t))return new Ie(t);if(this.isRawAlignPosition(t))return Ie.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")}}])}();Ce.Unknown=Symbol("Unknown");var Le=function(){function t(e){Ae(this,t),this.position=e}return Ee(t,[{key:"toCSS",value:function(){return{x:Pe[this.position],y:"50%",xoffset:0,yoffset:0}}}],[{key:"isCommonPositionType",value:function(e){return e instanceof t}}])}();Le.Positions=be;var Ie=function(){function t(e,n){Ae(this,t),"object"===xe(e)?(this.x=Ce.orUnknown(e.x),this.y=Ce.orUnknown(e.y),this.xoffset=Ce.orUnknown(e.xoffset),this.yoffset=Ce.orUnknown(e.yoffset)):(this.x=Ce.orUnknown(e),this.y=Ce.orUnknown(n),this.xoffset=Ce.Unknown,this.yoffset=Ce.Unknown)}return Ee(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:Pe[e.position],y:"50%"})}},{key:"fromAlignPosition",value:function(e){return new t({x:Ce.isUnknown(e.xalign)?Ce.Unknown:"".concat(100*e.xalign,"%"),y:Ce.isUnknown(e.yalign)?Ce.Unknown:"".concat(100*e.yalign,"%"),xoffset:e.xoffset,yoffset:e.yoffset})}},{key:"merge",value:function(e,n){return new t({x:Ce.isUnknown(n.x)?e.x:n.x,y:Ce.isUnknown(n.y)?e.y:n.y,xoffset:Ce.isUnknown(n.xoffset)?e.xoffset:n.xoffset,yoffset:Ce.isUnknown(n.yoffset)?e.yoffset:n.yoffset})}}])}(),Ne=function(){function t(e,n){Ae(this,t),"object"===xe(e)?(this.xalign=Ce.orUnknown(e.xalign),this.yalign=Ce.orUnknown(e.yalign),this.xoffset=Ce.orUnknown(e.xoffset),this.yoffset=Ce.orUnknown(e.yoffset)):(this.xalign=Ce.orUnknown(e),this.yalign=Ce.orUnknown(n),this.xoffset=Ce.Unknown,this.yoffset=Ce.Unknown)}return Ee(t,[{key:"toCSS",value:function(){return{x:Ce.isUnknown(this.xalign)?this.xalign:"".concat(100*this.xalign,"%"),y:Ce.isUnknown(this.yalign)?this.yalign:"".concat(100*this.yalign,"%"),xoffset:this.xoffset,yoffset:this.yoffset}}}],[{key:"isAlignPosition",value:function(e){return e instanceof t}}])}();function Re(t){let e;return()=>(void 0===e&&(e=t()),e)}const Me=Re((()=>void 0!==window.ScrollTimeline));class Fe{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,e){const n=this.animations.map((n=>Me()&&n.attachTimeline?n.attachTimeline(t):e(n)));return()=>{n.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 De=t=>1e3*t,Be=t=>t/1e3;function Ve(t,e){return e?t*(1e3/e):0}const Ge=5;function Ue(t,e,n){const r=Math.max(e-Ge,0);return Ve(n-t(r),e-r)}const We=t=>t;let ze=We,He=We;const $e=(t,e,n)=>n>e?e:n<t?t:n,Ye=.001,qe=.01,Xe=10,Ke=.05,Ze=1;function Qe({duration:t=800,bounce:e=.25,velocity:n=0,mass:r=1}){let o,i;ze(t<=De(Xe),"Spring duration must be 10 seconds or less");let a=1-e;a=$e(Ke,Ze,a),t=$e(qe,Xe,Be(t)),a<1?(o=e=>{const r=e*a,o=r*t,i=r-n,s=tn(e,a),u=Math.exp(-o);return Ye-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=tn(Math.pow(e,2),a);return(-o(e)+Ye>0?-1:1)*((i-s)*u)/c}):(o=e=>Math.exp(-e*t)*((e-n)*t+1)-Ye,i=e=>Math.exp(-e*t)*(t*t*(n-e)));const s=function(t,e,n){let r=n;for(let n=1;n<Je;n++)r-=t(r)/e(r);return r}(o,i,5/t);if(t=De(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 Je=12;function tn(t,e){return t*Math.sqrt(1-e*e)}const en=["duration","bounce"],nn=["stiffness","damping","mass"];function rn(t,e){return e.some((e=>void 0!==t[e]))}function on({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(!rn(t,nn)&&rn(t,en)){const n=Qe(t);e={...e,...n,mass:1},e.isResolvedFromDuration=!0}return e}({...r,velocity:-Be(r.velocity||0)}),h=f||0,d=u/(2*Math.sqrt(s*c)),y=i-o,v=Be(Math.sqrt(s/c)),m=Math.abs(y)<5;let g;if(n||(n=m?.01:2),e||(e=m?.005:.5),d<1){const t=tn(v,d);g=e=>{const n=Math.exp(-d*v*e);return i-n*((h+d*v*y)/t*Math.sin(t*e)+y*Math.cos(t*e))}}else if(1===d)g=t=>i-Math.exp(-v*t)*(y+(h+v*y)*t);else{const t=v*Math.sqrt(d*d-1);g=e=>{const n=Math.exp(-d*v*e),r=Math.min(t*e,300);return i-n*((h+d*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;d<1&&(o=0===t?De(h):Ue(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}}}const an=2e4;function sn(t){let e=0;let n=t.next(e);for(;!n.done&&e<an;)e+=50,n=t.next(e);return e>=an?1/0:e}function un(t,e=100,n){const r=n({...t,keyframes:[0,e]}),o=Math.min(sn(r),an);return{type:"keyframes",ease:t=>r.next(o*t).value/e,duration:Be(o)}}const cn=(t,e,n)=>t+(e-t)*n,ln=(t,e,n)=>{const r=e-t;return 0===r?1:(n-t)/r};function fn(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const o=ln(0,e,r);t.push(cn(n,1,o))}}function pn(t){const e=[0];return fn(e,t.length-1),e}const hn=t=>Boolean(t&&t.getVelocity);function dn(t){return"object"==typeof t&&!Array.isArray(t)}function yn(t,e,n,r){return"string"==typeof t&&dn(e)?function(t,e,n){var r;if("string"==typeof t){let o=document;e&&(He(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||[])}(t,n,r):t instanceof NodeList?Array.from(t):Array.isArray(t)?t:[t]}function vn(t){return"function"==typeof t}function mn(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 gn=(t,e,n)=>{const r=e-t;return((n-t)%r+r)%r+t},bn=t=>Array.isArray(t)&&"number"!=typeof t[0];function wn(t,e){return bn(t)?t[gn(0,t.length,e)]:t}function _n(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}function Sn(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&&(_n(t,o),r--)}}(t,o,i);for(let a=0;a<e.length;a++)t.push({value:e[a],at:cn(o,i,r[a]),easing:wn(n,a)})}function kn(t,e){return t.at===e.at?null===t.value?1:null===e.value?-1:0:t.at-e.at}const xn="easeInOut";function An(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function On(t,e){return e[t]||(e[t]=[]),e[t]}function En(t){return Array.isArray(t)?t:[t]}function Tn(t,e){return t&&t[e]?{...t,...t[e]}:{...t}}const jn=t=>"number"==typeof t,Pn=t=>t.every(jn),Cn=new WeakMap,Ln=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],In=new Set(Ln),Nn={type:"spring",stiffness:500,damping:25,restSpeed:10},Rn={type:"keyframes",duration:.8},Mn={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Fn=(t,{keyframes:e})=>e.length>2?Rn:In.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:Nn:Mn;function Dn(t,e){return t?t[e]||t.default||t:void 0}const Bn=!1,Vn=!1,Gn=!1,Un=t=>null!==t;function Wn(t,{repeat:e,repeatType:n="loop"},r){const o=t.filter(Un),i=e&&"loop"!==n&&e%2==1?0:o.length-1;return i&&void 0!==r?r:o[i]}const zn=["read","resolveKeyframes","update","preRender","render","postRender"];function Hn(t,e){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=zn.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,h=()=>{const i=Vn?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(h))};return{schedule:zn.reduce(((e,i)=>{const s=a[i];return e[i]=(e,i=!1,a=!1)=>(n||(n=!0,r=!0,o.isProcessing||t(h)),s.schedule(e,i,a)),e}),{}),cancel:t=>{for(let e=0;e<zn.length;e++)a[zn[e]].cancel(t)},state:o,steps:a}}const{schedule:$n,cancel:Yn,state:qn,steps:Xn}=Hn("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:We,!0),Kn=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Zn=1e-7,Qn=12;function Jn(t,e,n,r){if(t===e&&n===r)return We;const o=e=>function(t,e,n,r,o){let i,a,s=0;do{a=e+(n-e)/2,i=Kn(a,r,o)-t,i>0?n=a:e=a}while(Math.abs(i)>Zn&&++s<Qn);return a}(e,0,1,t,n);return t=>0===t||1===t?t:Kn(o(t),e,r)}const tr=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,er=t=>e=>1-t(1-e),nr=Jn(.33,1.53,.69,.99),rr=er(nr),or=tr(rr),ir=t=>(t*=2)<1?.5*rr(t):.5*(2-Math.pow(2,-10*(t-1))),ar=t=>1-Math.sin(Math.acos(t)),sr=er(ar),ur=tr(ar),cr=t=>/^0[^.\s]+$/u.test(t);const lr=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),fr=t=>e=>"string"==typeof e&&e.startsWith(t),pr=fr("--"),hr=fr("var(--"),dr=t=>!!hr(t)&&yr.test(t.split("/*")[0].trim()),yr=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,vr=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function mr(t,e,n=1){He(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=vr.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 lr(t)?parseFloat(t):t}return dr(o)?mr(o,e,n+1):o}const gr={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},br={...gr,transform:t=>$e(0,1,t)},wr={...gr,default:1},_r=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),Sr=_r("deg"),kr=_r("%"),xr=_r("px"),Ar=_r("vh"),Or=_r("vw"),Er={...kr,parse:t=>kr.parse(t)/100,transform:t=>kr.transform(100*t)},Tr=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),jr=t=>t===gr||t===xr,Pr=(t,e)=>parseFloat(t.split(", ")[e]),Cr=(t,e)=>(n,{transform:r})=>{if("none"===r||!r)return 0;const o=r.match(/^matrix3d\((.+)\)$/u);if(o)return Pr(o[1],e);{const e=r.match(/^matrix\((.+)\)$/u);return e?Pr(e[1],t):0}},Lr=new Set(["x","y","z"]),Ir=Ln.filter((t=>!Lr.has(t)));const Nr={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:Cr(4,13),y:Cr(5,14)};Nr.translateX=Nr.x,Nr.translateY=Nr.y;const Rr=t=>e=>e.test(t),Mr=[gr,xr,kr,Sr,Or,Ar,{test:t=>"auto"===t,parse:t=>t}],Fr=t=>Mr.find(Rr(t)),Dr=new Set;let Br=!1,Vr=!1;function Gr(){if(Vr){const t=Array.from(Dr).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 Ir.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)}))}Vr=!1,Br=!1,Dr.forEach((t=>t.complete())),Dr.clear()}function Ur(){Dr.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(Vr=!0)}))}class Wr{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?(Dr.add(this),Br||(Br=!0,$n.read(Ur),$n.resolveKeyframes(Gr))):(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),Dr.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Dr.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const zr=t=>Math.round(1e5*t)/1e5,Hr=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const $r=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Yr=(t,e)=>n=>Boolean("string"==typeof n&&$r.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),qr=(t,e,n)=>r=>{if("string"!=typeof r)return r;const[o,i,a,s]=r.match(Hr);return{[t]:parseFloat(o),[e]:parseFloat(i),[n]:parseFloat(a),alpha:void 0!==s?parseFloat(s):1}},Xr={...gr,transform:t=>Math.round((t=>$e(0,255,t))(t))},Kr={test:Yr("rgb","red"),parse:qr("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+Xr.transform(t)+", "+Xr.transform(e)+", "+Xr.transform(n)+", "+zr(br.transform(r))+")"};const Zr={test:Yr("#"),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:Kr.transform},Qr={test:Yr("hsl","hue"),parse:qr("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+kr.transform(zr(e))+", "+kr.transform(zr(n))+", "+zr(br.transform(r))+")"},Jr={test:t=>Kr.test(t)||Zr.test(t)||Qr.test(t),parse:t=>Kr.test(t)?Kr.parse(t):Qr.test(t)?Qr.parse(t):Zr.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?Kr.transform(t):Qr.transform(t)},to=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const eo="number",no="color",ro="var",oo="var(",io="${}",ao=/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 so(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},o=[];let i=0;const a=e.replace(ao,(t=>(Jr.test(t)?(r.color.push(i),o.push(no),n.push(Jr.parse(t))):t.startsWith(oo)?(r.var.push(i),o.push(ro),n.push(t)):(r.number.push(i),o.push(eo),n.push(parseFloat(t))),++i,io))).split(io);return{values:n,split:a,indexes:r,types:o}}function uo(t){return so(t).values}function co(t){const{split:e,types:n}=so(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===eo?zr(t[i]):e===no?Jr.transform(t[i]):t[i]}return o}}const lo=t=>"number"==typeof t?0:t;const fo={test:function(t){var e,n;return isNaN(t)&&"string"==typeof t&&((null===(e=t.match(Hr))||void 0===e?void 0:e.length)||0)+((null===(n=t.match(to))||void 0===n?void 0:n.length)||0)>0},parse:uo,createTransformer:co,getAnimatableNone:function(t){const e=uo(t);return co(t)(e.map(lo))}},po=new Set(["brightness","contrast","saturate","opacity"]);function ho(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[r]=n.match(Hr)||[];if(!r)return t;const o=n.replace(r,"");let i=po.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+o+")"}const yo=/\b([a-z-]*)\(.*?\)/gu,vo={...fo,getAnimatableNone:t=>{const e=t.match(yo);return e?e.map(ho).join(" "):t}},mo={borderWidth:xr,borderTopWidth:xr,borderRightWidth:xr,borderBottomWidth:xr,borderLeftWidth:xr,borderRadius:xr,radius:xr,borderTopLeftRadius:xr,borderTopRightRadius:xr,borderBottomRightRadius:xr,borderBottomLeftRadius:xr,width:xr,maxWidth:xr,height:xr,maxHeight:xr,top:xr,right:xr,bottom:xr,left:xr,padding:xr,paddingTop:xr,paddingRight:xr,paddingBottom:xr,paddingLeft:xr,margin:xr,marginTop:xr,marginRight:xr,marginBottom:xr,marginLeft:xr,backgroundPositionX:xr,backgroundPositionY:xr},go={rotate:Sr,rotateX:Sr,rotateY:Sr,rotateZ:Sr,scale:wr,scaleX:wr,scaleY:wr,scaleZ:wr,skew:Sr,skewX:Sr,skewY:Sr,distance:xr,translateX:xr,translateY:xr,translateZ:xr,x:xr,y:xr,z:xr,perspective:xr,transformPerspective:xr,opacity:br,originX:Er,originY:Er,originZ:xr},bo={...gr,transform:Math.round},wo={...mo,...go,zIndex:bo,size:xr,fillOpacity:br,strokeOpacity:br,numOctaves:bo},_o={...wo,color:Jr,backgroundColor:Jr,outlineColor:Jr,fill:Jr,stroke:Jr,borderColor:Jr,borderTopColor:Jr,borderRightColor:Jr,borderBottomColor:Jr,borderLeftColor:Jr,filter:vo,WebkitFilter:vo},So=t=>_o[t];function ko(t,e){let n=So(t);return n!==vo&&(n=fo),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const xo=new Set(["auto","none","0"]);class Ao extends Wr{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(),dr(r))){const o=mr(r,e.current);void 0!==o&&(t[n]=o),n===t.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!Tr.has(n)||2!==t.length)return;const[r,o]=t,i=Fr(r),a=Fr(o);if(i!==a)if(jr(i)&&jr(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||cr(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&&!xo.has(e)&&so(e).values.length&&(r=t[o]),o++}if(r&&n)for(const o of e)t[o]=ko(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=Nr[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]=Nr[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 Oo;function Eo(){Oo=void 0}const To={now:()=>(void 0===Oo&&To.set(qn.isProcessing||Vn?qn.timestamp:performance.now()),Oo),set:t=>{Oo=t,queueMicrotask(Eo)}},jo=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!fo.test(t)&&"0"!==t||t.startsWith("url(")));function Po(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=jo(o,e),s=jo(i,e);return ze(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||vn(n))&&r)}class Co{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=To.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||(Ur(),Gr()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=To.now(),this.hasAttemptedResolve=!0;const{name:n,type:r,velocity:o,delay:i,onComplete:a,onUpdate:s,isGenerator:u}=this.options;if(!u&&!Po(t,n,r,o)){if(Gn||!i)return null==s||s(Wn(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 Lo({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},h=t=>void 0===s?u:void 0===u||Math.abs(s-t)<Math.abs(u-t)?s:u;let d=n*e;const y=f+d,v=void 0===a?y:a(y);v!==y&&(d=v-f);const m=t=>-d*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,_=on({keyframes:[p.value,h(p.value)],velocity:Ue(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 Io=Jn(.42,0,1,1),No=Jn(0,0,.58,1),Ro=Jn(.42,0,.58,1),Mo=t=>Array.isArray(t)&&"number"==typeof t[0],Fo={linear:We,easeIn:Io,easeInOut:Ro,easeOut:No,circIn:ar,circInOut:ur,circOut:sr,backIn:rr,backInOut:or,backOut:nr,anticipate:ir},Do=t=>{if(Mo(t)){He(4===t.length,"Cubic bezier arrays must contain four numerical values.");const[e,n,r,o]=t;return Jn(e,n,r,o)}return"string"==typeof t?(He(void 0!==Fo[t],`Invalid easing type '${t}'`),Fo[t]):t},Bo=(t,e)=>n=>e(t(n)),Vo=(...t)=>t.reduce(Bo);function Go(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 Uo(t,e){return n=>n>0?e:t}const Wo=(t,e,n)=>{const r=t*t,o=n*(e*e-r)+r;return o<0?0:Math.sqrt(o)},zo=[Zr,Kr,Qr];function Ho(t){const e=(n=t,zo.find((t=>t.test(n))));var n;if(ze(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===Qr&&(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=Go(s,r,t+1/3),i=Go(s,r,t),a=Go(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 $o=(t,e)=>{const n=Ho(t),r=Ho(e);if(!n||!r)return Uo(t,e);const o={...n};return t=>(o.red=Wo(n.red,r.red,t),o.green=Wo(n.green,r.green,t),o.blue=Wo(n.blue,r.blue,t),o.alpha=cn(n.alpha,r.alpha,t),Kr.transform(o))},Yo=new Set(["none","hidden"]);function qo(t,e){return n=>cn(t,e,n)}function Xo(t){return"number"==typeof t?qo:"string"==typeof t?dr(t)?Uo:Jr.test(t)?$o:Qo:Array.isArray(t)?Ko:"object"==typeof t?Jr.test(t)?$o:Zo:Uo}function Ko(t,e){const n=[...t],r=n.length,o=t.map(((t,n)=>Xo(t)(t,e[n])));return t=>{for(let e=0;e<r;e++)n[e]=o[e](t);return n}}function Zo(t,e){const n={...t,...e},r={};for(const o in n)void 0!==t[o]&&void 0!==e[o]&&(r[o]=Xo(t[o])(t[o],e[o]));return t=>{for(const e in r)n[e]=r[e](t);return n}}const Qo=(t,e)=>{const n=fo.createTransformer(e),r=so(t),o=so(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?Yo.has(t)&&!o.values.length||Yo.has(e)&&!r.values.length?function(t,e){return Yo.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):Vo(Ko(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):(ze(!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.`),Uo(t,e))};function Jo(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return cn(t,e,n);return Xo(t)(t,e)}function ti(t,e,{clamp:n=!0,ease:r,mixer:o}={}){const i=t.length;if(He(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||Jo,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]||We:e;i=Vo(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=ln(t[n],t[n+1],e);return a[n](r)};return n?e=>u($e(t[0],t[i-1],e)):u}function ei({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const o=bn(r)?r.map(Do):Do(r),i={done:!1,value:e[0]},a=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:pn(e),t),s=ti(a,e,{ease:Array.isArray(o)?o:(u=e,c=o,u.map((()=>c||Ro)).splice(0,u.length-1))});var u,c;return{calculatedDuration:t,next:e=>(i.value=s(e),i.done=e>=t,i)}}const ni=t=>{const e=({timestamp:e})=>t(e);return{start:()=>$n.update(e,!0),stop:()=>Yn(e),now:()=>qn.isProcessing?qn.timestamp:To.now()}},ri={decay:Lo,inertia:Lo,tween:ei,keyframes:ei,spring:on},oi=t=>t/100;class ii extends Co{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)||Wr;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=vn(e)?e:ri[e]||ei;let s,u;a!==ei&&"number"!=typeof t[0]&&(s=Vo(oi,Jo(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=sn(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:h,repeatDelay:d,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"===h?(n=1-n,d&&(n-=d/l)):"mirror"===h&&(b=i)),g=$e(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=Wn(s,this.options,r)),y&&y(w.value),S&&this.finish(),w}get duration(){const{resolved:t}=this;return t?Be(t.calculatedDuration):0}get time(){return Be(this.currentTime)}set time(t){t=De(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=Be(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=ni,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 ai=new Set(["opacity","clipPath","filter","transform"]),si=(t,e)=>{let n="";const r=Math.max(Math.round(e/10),2);for(let e=0;e<r;e++)n+=t(ln(0,r-1,e))+", ";return`linear(${n.substring(0,n.length-2)})`},ui={linearEasing:void 0};function ci(t,e){const n=Re(t);return()=>{var t;return null!==(t=ui[e])&&void 0!==t?t:n()}}const li=ci((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing");function fi(t){return Boolean("function"==typeof t&&li()||!t||"string"==typeof t&&(t in hi||li())||Mo(t)||Array.isArray(t)&&t.every(fi))}const pi=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,hi={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:pi([0,.65,.55,1]),circOut:pi([.55,0,1,.45]),backIn:pi([.31,.01,.66,-.59]),backOut:pi([.33,1.53,.69,.99])};function di(t,e){return t?"function"==typeof t&&li()?si(t,e):Mo(t)?pi(t):Array.isArray(t)?t.map((t=>di(t,e)||hi.easeOut)):hi[t]:void 0}function yi(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=di(s,o);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"})}function vi(t,e){t.timeline=e,t.onfinish=null}const mi=Re((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));const gi={anticipate:ir,backInOut:or,circInOut:ur};class bi extends Co{constructor(t){super(t);const{name:e,motionValue:n,element:r,keyframes:o}=this.options;this.resolver=new Ao(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("string"==typeof i&&li()&&i in gi&&(i=gi[i]),function(t){return vn(t.type)||"spring"===t.type||!fi(t.ease)}(this.options)){const{onComplete:e,onUpdate:n,motionValue:s,element:u,...c}=this.options,l=function(t,e){const n=new ii({...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=yi(s.owner.current,u,t,{...this.options,duration:r,times:o,ease:i});return l.startTime=null!=c?c:this.calcStartTime(),this.pendingTimeline?(vi(l,this.pendingTimeline),this.pendingTimeline=void 0):l.onfinish=()=>{const{onComplete:n}=this.options;s.set(Wn(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 Be(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return Be(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.currentTime=De(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 We;const{animation:n}=e;vi(n,t)}else this.pendingTimeline=t;return We}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 ii({...c,keyframes:n,duration:r,type:o,ease:i,times:a,isGenerator:!0}),f=De(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 mi()&&n&&ai.has(n)&&e&&e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate&&!r&&"mirror"!==o&&0!==i&&"inertia"!==a}}const wi=(t,e,n,r={},o,i)=>a=>{const s=Dn(r,t)||{},u=s.delay||r.delay||0;let{elapsed:c=0}=r;c-=De(u);let l={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...s,delay:-c,onUpdate:t=>{e.set(t),s.onUpdate&&s.onUpdate(t)},onComplete:()=>{a(),s.onComplete&&s.onComplete()},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})(s)||(l={...l,...Fn(t,l)}),l.duration&&(l.duration=De(l.duration)),l.repeatDelay&&(l.repeatDelay=De(l.repeatDelay)),void 0!==l.from&&(l.keyframes[0]=l.from);let f=!1;if((!1===l.type||0===l.duration&&!l.repeatDelay)&&(l.duration=0,0===l.delay&&(f=!0)),(Gn||Bn)&&(f=!0,l.duration=0,l.delay=0),f&&!i&&void 0!==e.get()){const t=Wn(l.keyframes,s);if(void 0!==t)return $n.update((()=>{l.onUpdate(t),l.onComplete()})),new Fe([])}return!i&&bi.supports(l)?new bi(l):new ii(l)},_i=t=>Array.isArray(t),Si=t=>Boolean(t&&"object"==typeof t&&t.mix&&t.toValue),ki=t=>_i(t)?t[t.length-1]||0:t;class xi{constructor(){this.subscriptions=[]}add(t){var e,n;return e=this.subscriptions,n=t,-1===e.indexOf(n)&&e.push(n),()=>_n(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 Ai={current:void 0};class Oi{constructor(t,e={}){this.version="11.11.9",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=To.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=To.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 xi);const n=this.events[t].add(e);return"change"===t?()=>{n(),$n.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 Ai.current&&Ai.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=To.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return Ve(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 Ei(t,e){return new Oi(t,e)}function Ti(t){const e=[{},{}];return null==t||t.values.forEach(((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()})),e}function ji(t,e,n,r){if("function"==typeof e){const[o,i]=Ti(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]=Ti(r);e=e(void 0!==n?n:t.custom,o,i)}return e}function Pi(t,e,n){const r=t.getProps();return ji(r,e,void 0!==n?n:r.custom,t)}function Ci(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Ei(n))}const Li=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Ii="data-"+Li("framerAppearId");function Ni(t){return t.props[Ii]}function Ri(t,e){if(!t.applyWillChange)return;const n=t.getValue("willChange");return r=n,Boolean(hn(r)&&r.add)?n.add(e):void 0;var r}function Mi({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,r}function Fi(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&&Mi(l,e))continue;const s={delay:n,...Dn(a||{},e)};let f=!1;if(window.MotionHandoffAnimation){const n=Ni(t);if(n){const t=window.MotionHandoffAnimation(n,e,$n);null!==t&&(s.startTime=t,f=!0)}}Ri(t,e),r.start(wi(e,r,o,t.shouldReduceMotion&&In.has(e)?{type:!1}:s,t,f));const p=r.animation;p&&c.push(p)}return s&&Promise.all(c).then((()=>{$n.update((()=>{s&&function(t,e){const n=Pi(t,e);let{transitionEnd:r={},transition:o={},...i}=n||{};i={...i,...r};for(const e in i)Ci(t,e,ki(i[e]))}(t,s)}))})),c}const Di={};function Bi(t,{layout:e,layoutId:n}){return In.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!Di[t]||"opacity"===t)}function Vi(t,e,n){var r;const{style:o}=t,i={};for(const a in o)(hn(o[a])||e.style&&hn(e.style[a])||Bi(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 Gi(t,e,n){const r=Vi(t,e,n);for(const n in t)if(hn(t[n])||hn(e[n])){r[-1!==Ln.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=t[n]}return r}const Ui="undefined"!=typeof window,Wi={current:null},zi={current:!1};function Hi(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function $i(t){return"string"==typeof t||Array.isArray(t)}const Yi=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],qi=["initial",...Yi];function Xi(t){return Hi(t.animate)||qi.some((e=>$i(t[e])))}function Ki(t){return Boolean(Xi(t)||t.variants)}const Zi={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"]},Qi={};for(const t in Zi)Qi[t]={isEnabled:e=>Zi[t].some((t=>!!e[t]))};const Ji=[...Mr,Jr,fo],ta=()=>({x:{min:0,max:0},y:{min:0,max:0}}),ea=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class na{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=Wr,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=To.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,$n.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=Xi(e),this.isVariantNode=Ki(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]&&hn(e)&&e.set(s[t],!1)}}mount(t){this.current=t,Cn.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))),zi.current||function(){if(zi.current=!0,Ui)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Wi.current=t.matches;t.addListener(e),e()}else Wi.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||Wi.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Cn.delete(this.current),this.projection&&this.projection.unmount(),Yn(this.notifyUpdate),Yn(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=In.has(t),r=e.on("change",(e=>{this.latestValues[t]=e,this.props.onUpdate&&$n.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 Qi){const e=Qi[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<ea.length;e++){const n=ea[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(hn(o))t.addValue(r,o);else if(hn(i))t.addValue(r,Ei(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,Ei(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}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=Ei(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&&(lr(r)||cr(r))?r=parseFloat(r):(o=r,!Ji.find(Rr(o))&&fo.test(e)&&(r=ko(t,e))),this.setBaseTarget(t,hn(r)?r.get():r)),hn(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=ji(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||hn(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 xi),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class ra extends na{constructor(){super(...arguments),this.KeyframeResolver=Ao}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 oa=(t,e)=>e&&"number"==typeof t?e.transform(t):t,ia={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},aa=Ln.length;function sa(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(In.has(t))a=!0;else if(pr(t))o[t]=n;else{const e=oa(n,wo[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<aa;i++){const a=Ln[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=oa(s,wo[a]);u||(o=!1,r+=`${ia[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 ua(t,e,n){return"string"==typeof t?t:xr.transform(e+n*t)}const ca={offset:"stroke-dashoffset",array:"stroke-dasharray"},la={offset:"strokeDashoffset",array:"strokeDasharray"};function fa(t,{attrX:e,attrY:n,attrScale:r,originX:o,originY:i,pathLength:a,pathSpacing:s=1,pathOffset:u=0,...c},l,f){if(sa(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:h,dimensions:d}=t;p.transform&&(d&&(h.transform=p.transform),delete p.transform),d&&(void 0!==o||void 0!==i||h.transform)&&(h.transformOrigin=function(t,e,n){return`${ua(e,t.x,t.width)} ${ua(n,t.y,t.height)}`}(d,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?ca:la;t[i.offset]=xr.transform(-r);const a=xr.transform(e),s=xr.transform(n);t[i.array]=`${a} ${s}`}(p,a,s,u,!1)}const pa=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 ha(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 da(t,e,n,r){ha(t,e,void 0,r);for(const n in e.attrs)t.setAttribute(pa.has(n)?n:Li(n),e.attrs[n])}const ya=t=>"string"==typeof t&&"svg"===t.toLowerCase();class va extends ra{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ta}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(In.has(e)){const t=So(e);return t&&t.default||0}return e=pa.has(e)?e:Li(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return Gi(t,e,n)}build(t,e,n){fa(t,e,this.isSVGTag,n.transformTemplate)}renderInstance(t,e,n,r){da(t,e,0,r)}mount(t){this.isSVGTag=ya(t.tagName),super.mount(t)}}function ma(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 ga extends ra{constructor(){super(...arguments),this.type="html",this.applyWillChange=!0,this.renderInstance=ha}readValueFromInstance(t,e){if(In.has(e)){const t=So(e);return t&&t.default||0}{const r=(n=t,window.getComputedStyle(n)),o=(pr(e)?r.getPropertyValue(e):r[e])||0;return"string"==typeof o?o.trim():o}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return ma(t,e)}build(t,e,n){sa(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return Vi(t,e,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;hn(t)&&(this.childSubscription=t.on("change",(t=>{this.current&&(this.current.textContent=`${t}`)})))}}class ba extends na{constructor(){super(...arguments),this.type="object"}readValueFromInstance(t,e){if(function(t,e){return t in e}(e,t)){const n=t[e];if("string"==typeof n||"number"==typeof n)return n}}getBaseTargetFromProps(){}removeValueFromRenderState(t,e){delete e.output[t]}measureInstanceViewportBox(){return{x:{min:0,max:0},y:{min:0,max:0}}}build(t,e){Object.assign(t.output,e)}renderInstance(t,{output:e}){Object.assign(t,e)}sortInstanceNodePosition(){return 0}}function wa(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 va(e):new ga(e);n.mount(t),Cn.set(t,n)}function _a(t){const e=new ba({presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}});e.mount(t),Cn.set(t,e)}function Sa(t,e,n,r){const o=[];if(function(t,e){return hn(t)||"number"==typeof t||"string"==typeof t&&!dn(e)}(t,e))o.push(function(t,e,n){const r=hn(t)?t:Ei(t);return r.start(wi("",r,e,n)),r.animation}(t,dn(e)&&e.default||e,n&&n.default||n));else{const i=yn(t,e,r),a=i.length;He(Boolean(a),"No valid elements provided.");for(let t=0;t<a;t++){const r=i[t],s=r instanceof Element?wa:_a;Cn.has(r)||s(r);const u=Cn.get(r),c={...n};"delay"in c&&"function"==typeof c.delay&&(c.delay=c.delay(t,a)),o.push(...Fi(u,{...e,transition:c},{}))}}return o}function ka(t,e,n){const r=[],o=function(t,{defaultTransition:e={},...n}={},r,o){const i=e.duration||.3,a=new Map,s=new Map,u={},c=new Map;let l=0,f=0,p=0;for(let n=0;n<t.length;n++){const a=t[n];if("string"==typeof a){c.set(a,f);continue}if(!Array.isArray(a)){c.set(a.name,mn(f,a.at,l,c));continue}let[h,d,y={}]=a;void 0!==y.at&&(f=mn(f,y.at,l,c));let v=0;const m=(t,n,r,a=0,s=0)=>{const u=En(t),{delay:c=0,times:l=pn(u),type:h="keyframes",...d}=n;let{ease:y=e.ease||"easeOut",duration:m}=n;const g="function"==typeof c?c(a,s):c,b=u.length,w=vn(h)?h:null==o?void 0:o[h];if(b<=2&&w){let t=100;if(2===b&&Pn(u)){const e=u[1]-u[0];t=Math.abs(e)}const e={...d};void 0!==m&&(e.duration=De(m));const n=un(e,t,w);y=n.ease,m=n.duration}null!=m||(m=i);const _=f+g,S=_+m;1===l.length&&0===l[0]&&(l[1]=1);const k=l.length-u.length;k>0&&fn(l,k),1===u.length&&u.unshift(null),Sn(r,u,y,l,_,S),v=Math.max(g+m,v),p=Math.max(S,p)};if(hn(h))m(d,y,On("default",An(h,s)));else{const t=yn(h,d,r,u),e=t.length;for(let n=0;n<e;n++){const r=An(t[n],s);for(const t in d)m(d[t],Tn(y,t),On(t,r),n,e)}}l=f,f+=v}return s.forEach(((t,r)=>{for(const o in t){const i=t[o];i.sort(kn);const s=[],u=[],c=[];for(let t=0;t<i.length;t++){const{at:e,value:n,easing:r}=i[t];s.push(n),u.push(ln(0,p,e)),c.push(r||"easeOut")}0!==u[0]&&(u.unshift(0),s.unshift(s[0]),c.unshift(xn)),1!==u[u.length-1]&&(u.push(1),s.push(null)),a.has(r)||a.set(r,{keyframes:{},transition:{}});const l=a.get(r);l.keyframes[o]=s,l.transition[o]={...e,duration:p,ease:c,times:u,...n}}})),a}(t,e,n,{spring:on});return o.forEach((({keyframes:t,transition:e},n)=>{r.push(...Sa(n,t,e))})),r}const xa=function(t,e,n){let r=[];var o;o=t,r=Array.isArray(o)&&Array.isArray(o[0])?ka(t,e,Aa):Sa(t,e,n,Aa);const i=new Fe(r);return Aa&&Aa.animations.push(i),i};var Aa;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 Ea(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Ea=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 P(r||[]);return o(a,"_invoke",{value:O(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",h="suspendedYield",d="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"==Oa(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(Oa(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 Ta(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Pa(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 ja(t){return function(t){if(Array.isArray(t))return Ca(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Pa(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 Pa(t,e){if(t){if("string"==typeof t)return Ca(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)?Ca(t,e):void 0}}function Ca(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 La(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,Na(r.key),r)}}function Ia(t,e,n){return(e=Na(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Na(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 Ra=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())}))},Ma=Ia(Ia(Ia({},Se,"25.33%"),_e,"50%"),ke,"75.66%"),Fa=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,ja(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&&La(t.prototype,e),n&&La(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"animate",value:function(e,n,r){var o=e.scope,i=e.overwrites,a=e.target;return Ra(this,void 0,void 0,Ea().mark((function e(){var s=this;return Ea().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){Ra(s,void 0,void 0,Ea().mark((function s(){var u,c,l,f,p=this;return Ea().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:this.sequenceOptions.sync||e(),u=0;case 2:if(!(u<this.sequenceOptions.repeat)){s.next=22;break}c=Ta(this.sequences),s.prev=4,f=Ea().mark((function e(){var r,s,u,c,f,h;return Ea().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=l.value,s=r.props,u=r.options,c=b({},p.propToCSS(n,a.state)),o.current){e.next=4;break}throw new Error("No scope found when animating.");case 4:if(f=o.current,Object.assign(f.style,c),a.state=t.mergeState(a.state,s),h=xa(f,p.propToCSS(n,a.state,i),p.optionsToFramerMotionOptions(u)||{}),p.setControl(h),n.logger.debug("Animating",p.propToCSS(n,a.state,i)),!1!==(null==u?void 0:u.sync)){e.next=14;break}h.then((function(){Object.assign(f.style,p.propToCSS(n,a.state,i)),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,a.state,i)),p.setControl(null);case 18:case"end":return e.stop()}}),e)})),c.s();case 7:if((l=c.n()).done){s.next=11;break}return s.delegateYield(f(),"t0",9);case 9:s.next=7;break;case 11:s.next=16;break;case 13:s.prev=13,s.t1=s.catch(4),c.e(s.t1);case 16:return s.prev=16,c.f(),s.finish(16);case 19:u++,s.next=2;break;case 22:return s.next=24,A(2);case 24:this.setControl(null),e(),r&&r(a.state);case 27:case"end":return s.stop()}}),s,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{}},rotation:function(){return{}},display:function(){return{}},src:function(){return{}},fontColor:function(t){return"string"==typeof t?{color:t}:{color:S(t)}}},c={};for(var l in c.transform=t.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:"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 Le.isCommonPositionType(t)||Ie.isCoord2DPosition(t)||Ne.isAlignPosition(t)}},{key:"positionToCSS",value:function(t,e,n){return t?Ce.isRawPosition(t)?Ce.D2PositionToCSS(Ce.rawPositionToCoord2D(t),n,e):Ce.D2PositionToCSS(t.toCSS(),n,e):{}}},{key:"backgroundToCSS",value:function(t){return null==t?{}:Ts.isStaticImageData(t)?{backgroundImage:"url(".concat(t.src,")")}:"string"==typeof t?{backgroundColor:t}:["r","g","b"].every((function(e){return e in t}))?{backgroundColor:S(t)}:{backgroundImage:"url("+t.url+")"}}},{key:"mergePosition",value:function(t,e){if(!t&&!e)throw new Error("No position found.");return t&&e?Ce.mergePosition(Ce.tryParsePosition(t),Ce.tryParsePosition(e)):Ce.toCoord2D(Ce.tryParsePosition(t||e))}},{key:"mergeState",value:function(t,e){var n=this.mergePosition(t.position,e.position);return Object.assign(Object.assign({},b(t,e)),{position:n})}},{key:"propToCSSTransform",value:function(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.translate,i=void 0===o?[]:o,a=r.scale,s=void 0===a?1:a;if(!t.getLastScene())throw new Error('No scene found in state, make sure you called "scene.activate()" before this method.');var u=void 0!==e.scale?e.scale:1,c=(null===(n=t.getLastScene())||void 0===n?void 0:n.config)||{},l=c.invertY,f=c.invertX;return["translate(".concat(i[0]||(f?"":"-")+"50%",", ").concat(i[1]||(l?"":"-")+"50%",")"),void 0!==e.rotation&&"rotate(".concat(e.rotation,"deg)"),"scale(".concat(u*s,")")].filter(Boolean).join(" ")}}])}();function Da(t){return Da="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},Da(t)}function Ba(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,Va(r.key),r)}}function Va(t){var e=function(t,e){if("object"!=Da(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Da(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Da(e)?e:e+""}function Ga(t,e,n){return e=Wa(e),function(t,e){if(e&&("object"==Da(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,Ua()?Reflect.construct(e,n||[],Wa(t).constructor):e.apply(t,n))}function Ua(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ua=function(){return!!t})()}function Wa(t){return Wa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wa(t)}function za(t,e){return za=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},za(t,e)}Fa.defaultSequenceOptions={sync:!0,repeat:1},Fa.defaultOptions={duration:0,ease:"linear"},Fa.CommonImagePositionMap=Ma;var Ha=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Ga(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&&za(t,e)}(e,t),function(t,e,n){return e&&Ba(t.prototype,e),n&&Ba(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"do",value:function(t){return this.push(Zt.ActionTypes.do,t)}},{key:"doAsync",value:function(t){return this.push(Zt.ActionTypes.doAsync,t)}},{key:"any",value:function(t){return this.push(Zt.ActionTypes.any,t)}},{key:"all",value:function(t){return this.push(Zt.ActionTypes.all,t)}},{key:"allAsync",value:function(t){return this.push(Zt.ActionTypes.allAsync,t)}},{key:"repeat",value:function(t,e){return this.push(Zt.ActionTypes.repeat,e,t)}},{key:"sleep",value:function(t){return this.push(Zt.ActionTypes.sleep,[],t)}},{key:"push",value:function(t,e){for(var n=le.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 Zt(this.chain(),t,(new jt).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)}},{key:"sleep",value:function(t){return(new e).sleep(t)}}])}(we);function $a(t){return $a="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},$a(t)}function Ya(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return qa(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)?qa(t,e):void 0}}(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 qa(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 Xa(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,Ka(r.key),r)}}function Ka(t){var e=function(t,e){if("object"!=$a(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=$a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==$a(e)?e:e+""}function Za(t,e,n){return e=Ja(e),function(t,e){if(e&&("object"==$a(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,Qa()?Reflect.construct(e,n||[],Ja(t).constructor):e.apply(t,n))}function Qa(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Qa=function(){return!!t})()}function Ja(t){return Ja=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ja(t)}function ts(t,e){return ts=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ts(t,e)}var es=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},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=Za(this,e)).events=new k,t.ref=void 0,"string"==typeof n?(t.name=n,t.config=b(e.defaultConfig,r||{}),t.config.position&&(t.config.position=Ce.tryParsePosition(t.config.position))):(t.name="",t.config=b(e.defaultConfig,n),t.config.position&&(t.config.position=Ce.tryParsePosition(t.config.position))),t.state=b({},t.config),t.checkConfig(t.config),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&&Xa(t.prototype,e),n&&Xa(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(t){if(!Fa.isPosition(t.position))throw new Error("Invalid position\nPosition must be one of CommonImagePosition, Align, Coord2D");var e,n=Ya(t.wearables);try{for(n.s();!(e=n.n()).done;){var r=e.value;if(!r.config.isWearable)throw new Error("Invalid wearable\nWearable must be an Image with isWearable set to true\nIt seems like you are trying to add a non-wearable image to wearables\nImage below violates the rule:\n"+JSON.stringify(r.config))}}catch(t){n.e(t)}finally{n.f()}return this}},{key:"setSrc",value:function(t,e){var n=this;return this.combineActions(new Ha,(function(r){if(e){var o=e.copy();o.setSrc(Ts.srcToString(t)),r._transitionSrc(o)}var i=new ys(r,ys.ActionTypes.setSrc,(new jt).setContent(["string"==typeof t?t:Ts.staticImageDataToSrc(t)]));return r.chain(i).chain(n._flush())}))}},{key:"applyTransform",value:function(t){var e=this;return this.combineActions(new Ha,(function(n){var r=new ys(n,ys.ActionTypes.applyTransform,(new jt).setContent([void 0,t.copy(),x()]));return n.chain(r).chain(e._flush())}))}},{key:"show",value:function(t){var e=this,n=t instanceof Fa?t.copy():new Fa([{props:{opacity:1},options:t||{}}]);return this.combineActions(new Ha,(function(t){var r=new ys(t,ys.ActionTypes.show,(new jt).setContent([void 0,n]));return t.chain(r).chain(e._flush())}))}},{key:"hide",value:function(t){var e=this;return this.combineActions(new Ha,(function(n){var r=new ys(n,ys.ActionTypes.hide,(new jt).setContent([void 0,t instanceof Fa?t.copy():new Fa([{props:{opacity:0},options:t||{}}])]));return n.chain(r).chain(e._flush())}))}},{key:"addWearable",value:function(t){var e,n=Ya(Array.isArray(t)?t:[t]);try{for(n.s();!(e=n.n()).done;){var r=e.value;this.config.wearables.push(r),r.config.isWearable=!0}}catch(t){n.e(t)}finally{n.f()}return this}},{key:"bindWearable",value:function(t){return t.addWearable(this),this}},{key:"toTransform",value:function(){return new Fa(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||O(this.state,this.config)?null:{state:b({},e.serializeImageState(this.state))}}},{key:"fromData",value:function(t){return this.state=b(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 ys(this.chain(),"image:applyTransition",(new jt).setContent([t])))}},{key:"_init",value:function(t){return new ys(this.chain(),ys.ActionTypes.init,(new jt).setContent([t]))}},{key:"_initWearable",value:function(t){return new ys(this.chain(),ys.ActionTypes.initWearable,(new jt).setContent([t]))}},{key:"_flush",value:function(){return new ys(this.chain(),ys.ActionTypes.flush,new jt)}},{key:"reset",value:function(){this.state=b({},this.config)}},{key:"toDisplayableTransform",value:function(){return new Fa(this.state,{duration:0})}},{key:"getTransformState",value:function(){return{position:this.state.position,scale:this.state.scale,rotation:this.state.rotation,opacity:this.state.opacity,display:this.state.display}}},{key:"_transitionSrc",value:function(t){var e=t.copy();return this._applyTransition(e),this}},{key:"_dispose",value:function(){return this.chain(new ys(this.chain(),ys.ActionTypes.dispose,new jt))}}],[{key:"serializeImageState",value:function(t){var e={position:function(t){return Ce.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 Ce.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}}])}(we);function ns(t){return ns="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},ns(t)}function rs(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 os(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)?os(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 os(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 is(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */is=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 P(r||[]);return o(a,"_invoke",{value:O(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",h="suspendedYield",d="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"==ns(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(ns(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 as(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"!=ns(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ns(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ns(e)?e:e+""}function us(t,e,n){return e=ps(e),function(t,e){if(e&&("object"==ns(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,cs()?Reflect.construct(e,n||[],ps(t).constructor):e.apply(t,n))}function cs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(cs=function(){return!!t})()}function ls(t,e,n,r){var o=fs(ps(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function fs(){return fs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=ps(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}},fs.apply(null,arguments)}function ps(t){return ps=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ps(t)}function hs(t,e){return hs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},hs(t,e)}es.EventTypes={"event:displayable.applyTransition":"event:displayable.applyTransition","event:displayable.applyTransform":"event:displayable.applyTransform","event:displayable.init":"event:displayable.init","event:wearable.create":"event:wearable.create"},es.defaultConfig={src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",display:!1,position:new Le(be.Center),scale:1,rotation:0,opacity:0,isWearable:!1,wearables:[]};var ds=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())}))},ys=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),us(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&&hs(t,e)}(e,t),function(t,e,n){return e&&as(t.prototype,e),n&&as(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var r=this,o=Object.create(null,{executeAction:{get:function(){return ls(e,"executeAction",r,1)}},unknownType:{get:function(){return ls(e,"unknownType",r,1)}}});if(this.type===n.init){if(this.callee.config.isWearable)throw new Error("Cannot init wearable image with init action\nIt seems like you are trying to init a wearable image with an init action, or use this wearable image without parent.");var i=t.findElementByDisplayable(this.callee);i&&t.disposeImage(this.callee,i.scene);var a=this.contentNode.getContent()[0];return t.createImage(this.callee,a),this.resolveAwaitable((function(e){return ds(r,void 0,void 0,is().mark((function n(){return is().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.callee.events.any("event:displayable.init");case 2:e(o.executeAction.call(this,t)),t.stage.next();case 4:case"end":return n.stop()}}),n,this)})))}))}if(this.type===n.initWearable){var s=rs(this.contentNode.getContent(),1)[0];return this.resolveAwaitable((function(e){return ds(r,void 0,void 0,is().mark((function n(){return is().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.callee.events.any("event:wearable.create",s);case 2:return n.next=4,s.events.any("event:displayable.init");case 4:e(o.executeAction.call(this,t)),t.stage.next();case 6:case"end":return n.stop()}}),n,this)})))}))}if(this.type===n.setSrc)return this.callee.state.src=this.contentNode.getContent()[0],t.logger.debug("Image - Set Src",this.callee.state.src),t.stage.update(),o.executeAction.call(this,t);if([n.show,n.hide,n.applyTransform].includes(this.type)){var u=new w((function(t){return t})).registerSkipController(new T((function(){return r.type===n.hide&&(r.callee.state.display=!1),o.executeAction.call(r,t)}))),c=this.contentNode.getContent()[1];return this.type===n.show&&(this.callee.state.display=!0,t.stage.update()),t.animateImage(es.EventTypes["event:displayable.applyTransform"],this.callee,[c],(function(){var t;r.type===n.hide&&(r.callee.state.display=!1),u.resolve({type:r.type,node:null===(t=r.contentNode)||void 0===t?void 0:t.getChild()})})),u}if(this.type===n.dispose)return t.disposeImage(this.callee),this.callee._$setDispose(),o.executeAction.call(this,t);if(this.type===n.applyTransition){var l=new w((function(t){return t})).registerSkipController(new T((function(){return r.type===n.hide&&(r.callee.state.display=!1),{type:r.type,node:r.contentNode.getChild()}}))),f=this.contentNode.getContent()[0];return this.callee.events.any("event:displayable.applyTransition",f).then((function(){l.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),l}if(this.type===n.flush)return o.executeAction.call(this,t);throw o.unknownType.call(this)}}])}(Y);function vs(t,e,n){return e=_s(e),function(t,e){if(e&&("object"==Ss(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,bs()?Reflect.construct(e,n||[],_s(t).constructor):e.apply(t,n))}function ms(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&&ws(t,e)}function gs(t){var e="function"==typeof Map?new Map:void 0;return gs=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(bs())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var o=new(t.bind.apply(t,r));return n&&ws(o,n.prototype),o}(t,arguments,_s(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ws(n,t)},gs(t)}function bs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(bs=function(){return!!t})()}function ws(t,e){return ws=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ws(t,e)}function _s(t){return _s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_s(t)}function Ss(t){return Ss="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},Ss(t)}function ks(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function xs(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,Os(r.key),r)}}function As(t,e,n){return e&&xs(t.prototype,e),n&&xs(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Os(t){var e=function(t,e){if("object"!=Ss(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ss(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ss(e)?e:e+""}ys.ActionTypes=n;var Es=function(){function t(e,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;ks(this,t),this.r=e,this.g=n,this.b=r,this.a=o}return As(t,[{key:"toString",value:function(){return"rgba(".concat(this.r,", ").concat(this.g,", ").concat(this.b,", ").concat(this.a,")")}},{key:"toHex",value:function(){return"#"+this.r.toString(16)+this.g.toString(16)+this.b.toString(16)}},{key:"toImageColor",value:function(){return{r:this.r,g:this.g,b:this.b,a:this.a}}}],[{key:"isHexString",value:function(t){return"string"==typeof t&&/^#[0-9A-F]{6}$/i.test(t)}},{key:"fromHex",value:function(e){var n=e.slice(1);return new t(parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16),8===n.length?parseInt(n.slice(6,8),16)/255:1)}}])}(),Ts=function(){function t(){ks(this,t)}return As(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://")}},{key:"isImageSrc",value:function(e){return"string"==typeof e&&!this.isHexString(e)||t.isStaticImageData(e)}},{key:"isImageColor",value:function(e){return t.isHexString(e)||t.isPlainColor(e)}},{key:"isPlainColor",value:function(t){return t&&("string"==typeof t||"object"===Ss(t)&&"r"in t&&"g"in t&&"b"in t)}},{key:"isHexString",value:function(t){return"string"==typeof t&&/^#([0-9A-F]{6}|[0-9A-F]{3})$/i.test(t)}},{key:"toBackgroundSrc",value:function(t){return"string"==typeof t?t:t.src}},{key:"toHex",value:function(t){return S(t)}}])}();Ts.RGBColor=Es;var js,Ps=function(t){function e(t,n){return ks(this,e),vs(this,e,[t,{info:n},"NarraLeafReact-StaticScriptWarning"])}return ms(e,t),As(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 ks(this,e),(r=vs(this,e,[t])).props=n,r.name=o,r}return ms(e,t),As(e,null,[{key:"isUseError",value:function(t){return t instanceof e}}])}(gs(Error))),Cs=function(){return As((function t(e){ks(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,n,r){var o=n.imageStates,i=n.scenes;if(t instanceof ys)o.has(t.callee)||o.set(t.callee,{isDisposed:!1,usedExternalSrc:!1}),this.checkImage(o.get(t.callee),t);else if(t instanceof gt){var a=t.callee;if(i.has(a.name)){if(i.get(a.name)!==a){var s="Scene with name: ".concat(a.name," is duplicated\nScene: ").concat(a.name,"\n\nAt: ").concat(t.__stack);throw new Ps(s)}}else i.set(a.name,a);if(t.type===e.jumpTo){var u=t.contentNode.getContent()[0];if(r.has(u))return;r.add(u)}}}},{key:"checkImage",value:function(t,e){if(e.type===n.dispose){if(t.isDisposed){var r="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 Ps(r)}t.isDisposed=!0}else if([n.init,n.show,n.hide,n.applyTransform,n.applyTransition].includes(e.type)){if(t.isDisposed){var o="Image is disposed before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new Ps(o)}}else if(e.type===n.setSrc){var i=e.contentNode.getContent()[0];Ts.isExternalSrc(i)&&(t.usedExternalSrc=!0)}}}])}();function Ls(t){return Ls="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},Ls(t)}function Is(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,Ns(r.key),r)}}function Ns(t){var e=function(t,e){if("object"!=Ls(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ls(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ls(e)?e:e+""}function Rs(t,e,n){return e=Fs(e),function(t,e){if(e&&("object"==Ls(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,Ms()?Reflect.construct(e,n||[],Fs(t).constructor):e.apply(t,n))}function Ms(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ms=function(){return!!t})()}function Fs(t){return Fs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Fs(t)}function Ds(t,e){return Ds=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ds(t,e)}!function(t){t.soundEffect="soundEffect",t.music="music",t.voice="voice",t.backgroundMusic="backgroundMusic"}(js||(js={}));var Bs=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=Rs(this,e)).state={playing:null,token:null},t.config=b(e.defaultConfig,"string"==typeof n?{src:n}: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&&Ds(t,e)}(e,t),function(t,e,n){return e&&Is(t.prototype,e),n&&Is(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"play",value:function(){if(this.config.type===js.backgroundMusic)throw new Error("Background music cannot be played directly");return this.pushAction(it.ActionTypes.play,[void 0])}},{key:"stop",value:function(){if(this.config.type===js.backgroundMusic)throw new Error("Background music cannot be stopped directly");return this.pushAction(it.ActionTypes.stop,[void 0])}},{key:"fade",value:function(t,e,n){if(this.config.type===js.backgroundMusic)throw new Error("Background music cannot be faded directly");return this.pushAction(it.ActionTypes.fade,[{start:t,end:e,duration:n}])}},{key:"setVolume",value:function(t){return this.pushAction(it.ActionTypes.setVolume,[t])}},{key:"setRate",value:function(t){return this.pushAction(it.ActionTypes.setRate,[t])}},{key:"pause",value:function(t){return void 0!==t?this.fade(void 0,0,t):this.pushAction(it.ActionTypes.pause,[void 0])}},{key:"resume",value:function(t){return void 0!==t?this.fade(0,this.config.volume,t):this.pushAction(it.ActionTypes.resume,[void 0])}},{key:"getHowlOptions",value:function(t){return Object.assign({src:this.config.src,loop:this.config.loop,volume:this.config.volume,html5:this.config.streaming,autoplay:!1},t||{})}},{key:"getSrc",value:function(){return this.config.src}},{key:"getToken",value:function(){return this.state.token||void 0}},{key:"getPlaying",value:function(){return this.state.playing}},{key:"setToken",value:function(t){this.state.token=void 0===t?null:t}},{key:"setPlaying",value:function(t){return this.state.playing=t,this}},{key:"toData",value:function(){return O(this.config,e.defaultConfig)?null:{config:_(this.config)}}},{key:"fromData",value:function(t){return this.config=b(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 it(this.chain(),t,(new jt).setContent(e)))}}],[{key:"toSoundSrc",value:function(t){return null==t?null:"string"==typeof t?t:t.getSrc()}},{key:"toSound",value:function(t){return null==t?null:"string"==typeof t?new e({src:t}):t}}])}(we);function Vs(t){return Vs="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},Vs(t)}function Gs(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,Us(r.key),r)}}function Us(t){var e=function(t,e){if("object"!=Vs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Vs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Vs(e)?e:e+""}Bs.defaultConfig={src:"",sync:!1,loop:!1,volume:1};var Ws=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e}return function(t,e,n){return e&&Gs(t.prototype,e),n&&Gs(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,null,[{key:"from",value:function(e){return t.isPauseConstructor(e)?new t:e}},{key:"wait",value:function(e){return new t({duration:e})}},{key:"isPause",value:function(e){return this.isPauseConstructor(e)||e instanceof t}},{key:"isPauseConstructor",value:function(e){return e===t}}])}();function zs(t){return zs="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},zs(t)}function Hs(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 $s(t){var e=function(t,e){if("object"!=zs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=zs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==zs(e)?e:e+""}var Ys=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.text=e,this.config=b(t.defaultConfig,n)}return function(t,e,n){return e&&Hs(t.prototype,e),n&&Hs(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"evaluate",value:function(e){var n=this;if(Ws.isPause(this.text))return[this];if("function"==typeof this.text){var r=this.text(e);return Array.isArray(r)?r.map((function(r){return t.isWord(r)?r.inherit(n.config).evaluate(e):new t(r,n.config)})).flat():t.isWord(r)?r.inherit(this.config).evaluate(e):[new t(r,this.config)]}return[this]}},{key:"inherit",value:function(t){return this.config.color=this.config.color||t.color,this.config.italic=this.config.italic||t.italic,this.config.bold=this.config.bold||t.bold,this}},{key:"copy",value:function(){return new t(this.text,this.config)}}],[{key:"isWord",value:function(e){return e instanceof t}},{key:"color",value:function(e,n){return t.isWord(e)?e.copy().inherit({color:n}):new t(e,{color:n})}},{key:"bold",value:function(e){return t.isWord(e)?e.copy().inherit({bold:!0}):new t(e,{bold:!0})}},{key:"italic",value:function(e){return t.isWord(e)?e.copy().inherit({italic:!0}):new t(e,{italic:!0})}}])}();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 Xs(t){return function(t){if(Array.isArray(t))return Ks(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 Ks(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)?Ks(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 Ks(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 Zs(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,Qs(r.key),r)}}function Qs(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+""}Ys.defaultConfig={},Ys.defaultColor="#000";var Js=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.text=t.format(e),this.config=b(t.defaultConfig,Object.assign(Object.assign({},n),{voice:Bs.toSound(n.voice)})),this.state=_(t.defaultState)}return function(t,e,n){return e&&Zs(t.prototype,e),n&&Zs(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"toData",value:function(){return O(this.state,t.defaultState)?null:{state:_(this.state)}}},{key:"fromData",value:function(t){return this.state=b(this.state,t),this}},{key:"toString",value:function(){return this.text.map((function(t){return t.text})).join("")}},{key:"setCharacter",value:function(t){return this.config.character=t,this}},{key:"evaluate",value:function(e){for(var n=[],r=0;r<this.text.length;r++){var o=this.text[r].evaluate(e);n.push.apply(n,Xs(t.formatStaticWord(o)))}return n}},{key:"copy",value:function(){return new t(Xs(this.text),this.config)}}],[{key:"isSentence",value:function(e){return e instanceof t}},{key:"toSentence",value:function(e){return t.isSentence(e)?e:new t(e)}},{key:"format",value:function(t){var e=[];if(Array.isArray(t))for(var n=0;n<t.length;n++)e.push(this.formatWord(t[n]));else e.push(this.formatWord(t));return e}},{key:"formatWord",value:function(t){return Ys.isWord(t)?t:new Ys(t)}},{key:"formatStaticWord",value:function(t,e){var n=this;return Array.isArray(t)?t.map((function(t){return n.formatStaticWord(t,e)})).flat(2):[Ys.isWord(t)?t:new Ys(t,e)]}},{key:"isSentencePrompt",value:function(e){return Array.isArray(e)?e.every(t.isSingleWord):t.isSingleWord(e)}},{key:"isSingleWord",value:function(t){return"string"==typeof t||Ys.isWord(t)||Ws.isPause(t)||"function"==typeof t}}])}();function tu(t){return tu="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},tu(t)}function eu(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,nu(r.key),r)}}function nu(t){var e=function(t,e){if("object"!=tu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=tu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==tu(e)?e:e+""}function ru(t,e,n){return e=su(e),function(t,e){if(e&&("object"==tu(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,ou()?Reflect.construct(e,n||[],su(t).constructor):e.apply(t,n))}function ou(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ou=function(){return!!t})()}function iu(t,e,n,r){var o=au(su(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function au(){return au="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=su(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}},au.apply(null,arguments)}function su(t){return su=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},su(t)}function uu(t,e){return uu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},uu(t,e)}Js.defaultConfig={color:"#000",pause:!0,voice:null,character:null},Js.defaultState={display:!0};var cu=function(e){function n(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),ru(this,n,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&&uu(t,e)}(n,e),function(t,e,n){return e&&eu(t.prototype,e),n&&eu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"executeAction",value:function(e){var r=this;if(this.type===t.say){var o=new w((function(t){return t})).registerSkipController(new T((function(){return{type:r.type,node:r.contentNode.getChild()}}))),i=this.contentNode.getContent(),a=i.config.voice;return a&&(it.initSound(e,a),e.playSound(a,(function(){e.stopSound(a)}))),e.createText(this.getId(),i,(function(){a&&e.stopSound(a),o.resolve({type:r.type,node:r.contentNode.getChild()})})),o}if(this.type===t.setName)return this.callee.state.name=this.contentNode.getContent()[0],iu(n,"executeAction",this,3)([e]);throw iu(n,"unknownType",this,3)([])}}])}(Y);function lu(t){return lu="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},lu(t)}function fu(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 pu(t){var e=function(t,e){if("object"!=lu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=lu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==lu(e)?e:e+""}function hu(t,e,n){return e=yu(e),function(t,e){if(e&&("object"==lu(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,du()?Reflect.construct(e,n||[],yu(t).constructor):e.apply(t,n))}function du(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(du=function(){return!!t})()}function yu(t){return yu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},yu(t)}function vu(t,e){return vu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},vu(t,e)}cu.ActionTypes=t;var mu=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=hu(this,e)).config=b(e.defaultConfig,r),n.state={name:t||""},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&&vu(t,e)}(e,t),function(t,e,n){return e&&fu(t.prototype,e),n&&fu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"say",value:function(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];if(Array.isArray(t)&&t.every((function(t){return"string"==typeof t}))&&[e].concat(r).length>0&&[e].concat(r).every((function(t){return Js.isSingleWord(t)}))){var i=t,a=Js.format([e].concat(r)),s=new Js(function(t,e){for(var n=[],r=0;r<Math.max(t.length,e.length);r++)r<t.length&&n.push(t[r]),r<e.length&&n.push(e[r]);return n}(i,a),{character:this}),u=new cu(this.chain(),cu.ActionTypes.say,(new jt).setContent(s));return this.chain(u)}var c=e||{},l=t,f=Array.isArray(l)?new Js(l,Object.assign(Object.assign({},c),{character:this})):(Js.isSentence(l)?l:new Js(l,Object.assign(Object.assign({},c),{character:this}))).copy();f.setCharacter(this);var p=new cu(this.chain(),cu.ActionTypes.say,(new jt).setContent(f));return this.chain(p)}},{key:"setName",value:function(t){var e=new cu(this.chain(),cu.ActionTypes.setName,(new jt).setContent([t]));return this.chain(e)}}])}(we);function gu(t){return gu="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},gu(t)}function bu(t){return function(t){if(Array.isArray(t))return wu(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 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)||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 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 _u(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,Su(r.key),r)}}function Su(t){var e=function(t,e){if("object"!=gu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=gu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==gu(e)?e:e+""}function ku(t,e,n){return e=Ou(e),function(t,e){if(e&&("object"==gu(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,xu()?Reflect.construct(e,n||[],Ou(t).constructor):e.apply(t,n))}function xu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(xu=function(){return!!t})()}function Au(){return Au="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Ou(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}},Au.apply(null,arguments)}function Ou(t){return Ou=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ou(t)}function Eu(t,e){return Eu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Eu(t,e)}mu.defaultConfig={color:"#000"};var Tu=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ku(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&&Eu(t,e)}(e,t),function(t,e,n){return e&&_u(t.prototype,e),n&&_u(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(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(bu(this.callee._getFutureActions()),bu(function(t,e,n,r){var o=Au(Ou(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"getFutureActions",this,3)([])))}}])}(Y);function ju(t){return ju="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},ju(t)}function Pu(t){return function(t){if(Array.isArray(t))return Lu(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Cu(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 Cu(t,e){if(t){if("string"==typeof t)return Lu(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)?Lu(t,e):void 0}}function Lu(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 Iu(t,e,n){return e=Ru(e),function(t,e){if(e&&("object"==ju(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 Mu(t,e){return Mu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Mu(t,e)}function Fu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Du(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,Vu(r.key),r)}}function Bu(t,e,n){return e&&Du(t.prototype,e),n&&Du(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Vu(t){var e=function(t,e){if("object"!=ju(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ju(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ju(e)?e:e+""}Tu.ActionTypes={action:"condition:action"};var Gu=function(){return Bu((function t(e){Fu(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()}}}])}(),Uu=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Fu(this,e),(t=Iu(this,e)).conditions={If:{condition:null,action:null},ElseIf:[],Else:{action:null}},t.config=b(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&&Mu(t,e)}(e,t),Bu(e,[{key:"If",value:function(t,e){if(this.conditions.If.condition)throw new Ps("IF condition already set\nYou are trying to set multiple IF conditions for the same condition");if(this.conditions.ElseIf.length)throw new Ps("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 Ps("ELSE condition already set\nYou are trying to set an IF condition after an ELSE condition");return this.conditions.If.condition=t instanceof Gu?t:new Gu(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 Ps("IF condition not set\nYou are trying to set an ELSE-IF condition without an IF condition");if(this.conditions.Else.action)throw new Ps("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 Gu?t:new Gu(t),action:this.construct(Array.isArray(e)?e:[e])}),this.chain()}},{key:"Else",value:function(t){if(!this.conditions.If.condition)throw new Ps("IF condition not set\nYou are trying to set an ELSE condition without an IF condition");if(this.conditions.Else.action)throw new Ps("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=Cu(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(Tu,[this,Tu.ActionTypes.action,(new jt).setContent(t.conditions)])]}},{key:"construct",value:function(t,e,n){for(var r,o=le.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 le.toActions([].concat(Pu(this.conditions.If.action||[]),Pu(this.conditions.ElseIf.flatMap((function(t){return t.action||[]}))),Pu(this.conditions.Else.action||[])))}}],[{key:"getInitialState",value:function(){return{If:{condition:null,action:null},ElseIf:[],Else:{action:null}}}}])}(we);function Wu(t){return Wu="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},Wu(t)}function zu(t){return function(t){if(Array.isArray(t))return Hu(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 Hu(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)?Hu(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 Hu(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 $u(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,Yu(r.key),r)}}function Yu(t){var e=function(t,e){if("object"!=Wu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Wu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Wu(e)?e:e+""}function qu(t,e,n){return e=Zu(e),function(t,e){if(e&&("object"==Wu(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,Xu()?Reflect.construct(e,n||[],Zu(t).constructor):e.apply(t,n))}function Xu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Xu=function(){return!!t})()}function Ku(){return Ku="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Zu(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}},Ku.apply(null,arguments)}function Zu(t){return Zu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Zu(t)}function Qu(t,e){return Qu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Qu(t,e)}Uu.defaultConfig={};var Ju=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),qu(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&&Qu(t,e)}(e,t),function(t,e,n){return e&&$u(t.prototype,e),n&&$u(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var e=this,n=new w((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(zu(this.callee._getFutureActions(t.choices)),zu(function(t,e,n,r){var o=Ku(Zu(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"getFutureActions",this,3)([])))}}])}(Y);function tc(t){return tc="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},tc(t)}function ec(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,nc(r.key),r)}}function nc(t){var e=function(t,e){if("object"!=tc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=tc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==tc(e)?e:e+""}function rc(t,e,n){return e=ic(e),function(t,e){if(e&&("object"==tc(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,oc()?Reflect.construct(e,n||[],ic(t).constructor):e.apply(t,n))}function oc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(oc=function(){return!!t})()}function ic(t){return ic=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ic(t)}function ac(t,e){return ac=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ac(t,e)}Ju.ActionTypes={action:"menu:action"};var sc=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=rc(this,e)).choices=[],n.prompt=Js.isSentence(t)?t:new Js(t),n.config=b(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&&ac(t,e)}(e,t),function(t,e,n){return e&&ec(t.prototype,e),n&&ec(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"choose",value:function(t,e){var n=this.chain();return Js.isSentence(t)&&e||(Ys.isWord(t)||Array.isArray(t)||"string"==typeof t)&&e?n.choices.push({prompt:Js.toSentence(t),action:le.toActions(e)}):"object"===tc(t)&&"prompt"in t&&"action"in t?n.choices.push({prompt:Js.toSentence(t.prompt),action:le.toActions(t.action)}):console.warn("No valid choice added to menu, ",{arg0:t,arg1:e}),n}},{key:"fromChained",value:function(t){return[new Ju(this.chain(),Ju.ActionTypes.action,(new jt).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}}))}}])}(we);function uc(t){return uc="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},uc(t)}function cc(t){return function(t){if(Array.isArray(t))return lc(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 lc(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)?lc(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 lc(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 fc(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,pc(r.key),r)}}function pc(t){var e=function(t,e){if("object"!=uc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=uc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==uc(e)?e:e+""}function hc(t,e,n){return e=yc(e),function(t,e){if(e&&("object"==uc(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,dc()?Reflect.construct(e,n||[],yc(t).constructor):e.apply(t,n))}function dc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(dc=function(){return!!t})()}function yc(t){return yc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},yc(t)}function vc(t,e){return vc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},vc(t,e)}sc.defaultConfig={},sc.targetAction=Ju;var mc=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),hc(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&&vc(t,e)}(e,t),function(t,e,n){return e&&fc(t.prototype,e),n&&fc(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,cc(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,cc(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}}])}(fe);function gc(t){return gc="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},gc(t)}function bc(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,wc(r.key),r)}}function wc(t){var e=function(t,e){if("object"!=gc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=gc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==gc(e)?e:e+""}var _c=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&&bc(t.prototype,e),n&&bc(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 Bs){if(this.isSrcRegistered(t.getSrc()))return this;this.src.push({type:"audio",src:t})}else if(t instanceof es||Ts.isStaticImageData(t)){if(t instanceof es){if(this.isSrcRegistered(Ts.srcToString(t.state.src)))return this}else if(this.isSrcRegistered(Ts.srcToString(t.src)))return this;this.src.push({type:"image",src:t instanceof es?t:new es("",{src:Ts.staticImageDataToSrc(t)})})}else if("object"===gc(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 Bs?e:new Bs({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 Bs?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===Ts.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 Sc(t){return Sc="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},Sc(t)}function kc(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,xc(r.key),r)}}function xc(t){var e=function(t,e){if("object"!=Sc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Sc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Sc(e)?e:e+""}function Ac(t,e,n){return e=jc(e),function(t,e){if(e&&("object"==Sc(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,Oc()?Reflect.construct(e,n||[],jc(t).constructor):e.apply(t,n))}function Oc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Oc=function(){return!!t})()}function Ec(t,e,n,r){var o=Tc(jc(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function Tc(){return Tc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=jc(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}},Tc.apply(null,arguments)}function jc(t){return jc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},jc(t)}function Pc(t,e){return Pc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Pc(t,e)}_c.SrcTypes={image:"image",video:"video",audio:"audio"};var Cc=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Ac(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&&Pc(t,e)}(e,t),function(t,e,n){return e&&kc(t.prototype,e),n&&kc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===s.init){var r=t.findElementByDisplayable(this.callee);r&&t.disposeDisplayable(this.callee,r.scene);var o=this.contentNode.getContent()[0];t.createDisplayable(this.callee,o);var i=new w((function(t){return t}));return this.callee.events.any("event:displayable.init").then((function(){i.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),i}if([s.show,s.hide,s.applyTransform].includes(this.type)){var a=new w((function(t){return t})).registerSkipController(new T((function(){return n.type===s.hide&&(n.callee.state.display=!1),Ec(e,"executeAction",n,3)([t])}))),u=this.contentNode.getContent()[0];return this.type===s.show&&(this.callee.state.display=!0,t.stage.update()),t.animateText(sl.EventTypes["event:displayable.applyTransform"],this.callee,[u],(function(){n.type===s.hide&&(n.callee.state.display=!1),a.resolve(Ec(e,"executeAction",n,3)([t]))})),a}if(this.type===s.setText)return this.callee.state.text=this.contentNode.getContent()[0],Ec(e,"executeAction",this,3)([t]);if(this.type===s.setFontSize){this.callee.state.fontSize=this.contentNode.getContent()[0];var c=new Fa([],{duration:0}),l=new w;return t.animateText(sl.EventTypes["event:displayable.applyTransform"],this.callee,[c],(function(){l.resolve(Ec(e,"executeAction",n,3)([t]))})),l}if(this.type===s.applyTransition){var f=(new w).registerSkipController(new T((function(){return t.logger.info("NarraLeaf-React: Text Transition","Skipped"),{type:n.type,node:n.contentNode.getChild()}}))),p=this.contentNode.getContent()[0];return this.callee.events.any("event:displayable.applyTransition",p).then((function(){f.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),f}throw Ec(e,"unknownType",this,3)([])}}])}(Y);Cc.ActionTypes=s;var Lc={start:"start",update:"update",end:"end"};function Ic(t){return Ic="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},Ic(t)}function Nc(t,e,n){return e=Mc(e),function(t,e){if(e&&("object"==Ic(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,Rc()?Reflect.construct(e,n||[],Mc(t).constructor):e.apply(t,n))}function Rc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Rc=function(){return!!t})()}function Mc(t){return Mc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Mc(t)}function Fc(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&&Dc(t,e)}function Dc(t,e){return Dc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Dc(t,e)}function Bc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Vc(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,Uc(r.key),r)}}function Gc(t,e,n){return e&&Vc(t.prototype,e),n&&Vc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Uc(t){var e=function(t,e){if("object"!=Ic(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ic(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ic(e)?e:e+""}var Wc=function(){return Gc((function t(){Bc(this,t),this.events=new k}),[{key:"start",value:function(t){throw new Error("Method not implemented.")}},{key:"toElementProps",value:function(){throw new Error("Method not implemented.")}},{key:"copy",value:function(){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(Lc.start,null),this.controller=xa(o,i,Object.assign({duration:a/1e3,onUpdate:function(t){u&&u(t),r.events.emit(Lc.update,r.toElementProps())},onComplete:function(){r.controller=void 0,r.events.emit(Lc.end,null),s&&s()}},n)),this.controller}}])}(),zc=function(t){function e(){return Bc(this,e),Nc(this,e,arguments)}return Fc(e,t),Gc(e,[{key:"setSrc",value:function(t){throw new Error("Method not implemented.")}},{key:"copy",value:function(){throw new Error("Method not implemented.")}}])}(Wc),Hc=function(t){function e(){return Bc(this,e),Nc(this,e,arguments)}return Fc(e,t),Gc(e,[{key:"copy",value:function(){throw new Error("Method not implemented.")}}])}(Wc);function $c(t){return $c="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},$c(t)}function Yc(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,qc(r.key),r)}}function qc(t){var e=function(t,e){if("object"!=$c(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=$c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==$c(e)?e:e+""}function Xc(t,e,n){return e=Zc(e),function(t,e){if(e&&("object"==$c(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,Kc()?Reflect.construct(e,n||[],Zc(t).constructor):e.apply(t,n))}function Kc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Kc=function(){return!!t})()}function Zc(t){return Zc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Zc(t)}function Qc(t,e){return Qc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Qc(t,e)}var Jc=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=Xc(this,e)).state={fontSize:0},r.startValue=t,r.endValue=n,r.duration=o,r.easing=i,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&&Qc(t,e)}(e,t),function(t,e,n){return e&&Yc(t.prototype,e),n&&Yc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"start",value:function(t){var e=this;this.state.fontSize=this.startValue,this.requestAnimation({start:this.startValue,end:this.endValue,duration:this.duration},{onComplete:function(){e.state.fontSize=e.endValue,t&&t()},onUpdate:function(t){e.state.fontSize=t}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{fontSize:this.state.fontSize}}]}},{key:"copy",value:function(){return new e(this.startValue,this.endValue,this.duration,this.easing)}}])}(Hc);function tl(t){return tl="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},tl(t)}function el(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,nl(r.key),r)}}function nl(t){var e=function(t,e){if("object"!=tl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=tl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==tl(e)?e:e+""}function rl(t,e,n){return e=il(e),function(t,e){if(e&&("object"==tl(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,ol()?Reflect.construct(e,n||[],il(t).constructor):e.apply(t,n))}function ol(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ol=function(){return!!t})()}function il(t){return il=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},il(t)}function al(t,e){return al=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},al(t,e)}Jc.Frames=[1,0];var sl=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=rl(this,e)).events=new k,n.config="string"==typeof t?b({},e.defaultConfig,r,{text:t}):b({},e.defaultConfig,t),n.state=b({},n.config),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&&al(t,e)}(e,t),function(t,e,n){return e&&el(t.prototype,e),n&&el(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"applyTransform",value:function(t){var e=this.chain(),n=new Cc(e,Cc.ActionTypes.applyTransform,(new jt).setContent([t.copy()]));return e.chain(n)}},{key:"applyTransition",value:function(t){var e=this.chain(),n=this._applyTransition(e,t);return e.chain(n)}},{key:"show",value:function(t){var e=this.chain(),n=t instanceof Fa?t.copy():new Fa([{props:{opacity:1},options:t||{}}]),r=new Cc(e,Cc.ActionTypes.show,(new jt).setContent([n]));return e.chain(r)}},{key:"hide",value:function(t){var e=this.chain(),n=t instanceof Fa?t.copy():new Fa([{props:{opacity:1},options:t||{}}]),r=new Cc(e,Cc.ActionTypes.hide,(new jt).setContent([n]));return e.chain(r)}},{key:"setText",value:function(t){var e=this.chain(),n=new Cc(e,Cc.ActionTypes.setText,(new jt).setContent([t]));return e.chain(n)}},{key:"setFontSize",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0;return this.combineActions(new Ha,(function(o){if(n){var i=new Jc(e.state.fontSize,t,n,r);o.chain(e._applyTransition(o,i))}var a=new Cc(o,Cc.ActionTypes.setFontSize,(new jt).setContent([t]));return o.chain(a)}))}},{key:"toData",value:function(){return{state:b({},es.serializeImageState(this.state))}}},{key:"fromData",value:function(t){return this.state=b({},es.deserializeImageState(t.state)),this}},{key:"toTransform",value:function(){return new Fa(this.state,{duration:0})}},{key:"toDisplayableTransform",value:function(){return new Fa(this.state,{duration:0})}},{key:"_init",value:function(t){return new Cc(this.chain(),Cc.ActionTypes.init,(new jt).setContent([t]))}},{key:"_applyTransition",value:function(t,e){return new Cc(t,Cc.ActionTypes.applyTransition,(new jt).setContent([e]))}}])}(we);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(t){return function(t){if(Array.isArray(t))return fl(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ll(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 ll(t,e){if(t){if("string"==typeof t)return fl(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)?fl(t,e):void 0}}function fl(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 pl(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,hl(r.key),r)}}function hl(t){var e=function(t,e){if("object"!=ul(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ul(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ul(e)?e:e+""}function dl(t,e,n){return e=ml(e),function(t,e){if(e&&("object"==ul(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,yl()?Reflect.construct(e,n||[],ml(t).constructor):e.apply(t,n))}function yl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(yl=function(){return!!t})()}function vl(){return vl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=ml(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}},vl.apply(null,arguments)}function ml(t){return ml=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ml(t)}function gl(t,e){return gl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},gl(t,e)}sl.EventTypes={"event:text.show":"event:text.show","event:text.hide":"event:text.hide","event:displayable.applyTransition":"event:displayable.applyTransition","event:displayable.applyTransform":"event:displayable.applyTransform","event:displayable.init":"event:displayable.init"},sl.defaultConfig={position:new Le(Le.Positions.Center),scale:1,rotation:0,opacity:0,alignX:"center",alignY:"center",fontSize:16,fontColor:"#000000",display:!1,text:""};var bl=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n},wl=function(t){function r(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.defaultConfig;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),(e=dl(this,r)).srcManager=new _c,e.events=new k,e.name=t;var o=b(r.defaultConfig,n),i=o.background,a=bl(o,["background"]);return e.config=Object.assign(Object.assign({},a),{backgroundImage:new es({opacity:1}),background:i||null}),e.state=b(e.config,{}),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&&gl(t,e)}(r,t),function(t,e,n){return e&&pl(t.prototype,e),n&&pl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(r,[{key:"toBackground",value:function(t){if(Ts.isImageSrc(t)||Ts.isImageColor(t))return t;if(t instanceof Es)return t.toImageColor();throw new Error("Invalid background type")}},{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){var n=this;return this.combineActions(new Ha,(function(r){if(e){var o=e.copy();o.setSrc(n.toBackground(t)),r._transitionToScene(void 0,o,n.toBackground(t))}return r.chain(new gt(r,"scene:setBackground",(new jt).setContent([t])))}))}},{key:"applyTransform",value:function(t){return this.chain(new gt(this.chain(),"scene:applyTransform",(new jt).setContent([t.copy()])))}},{key:"jumpTo",value:function(t,e){var n=this;return this.combineActions(new Ha,(function(r){var o=e||{};return r.chain(new gt(r,"scene:preUnmount",(new jt).setContent([])))._transitionToScene(t,o.transition).chain(t._init()).chain(n._exit())._jumpTo(t)}))}},{key:"sleep",value:function(t){return this.chain(new gt(this.chain(),"scene:sleep",(new jt).setContent(t)))}},{key:"setBackgroundMusic",value:function(t,n){return this.chain(new gt(this.chain(),e.setBackgroundMusic,(new jt).setContent([t,n])))}},{key:"toData",value:function(){var t;return{state:Object.assign(Object.assign({},_(this.state)),{backgroundMusic:null===(t=this.state.backgroundMusic)||void 0===t?void 0:t.toData(),background:this.state.background}),backgroundImageState:this.state.backgroundImage.toData()}}},{key:"fromData",value:function(t){var e=this;return L(t,{state:function(t){L(t,{backgroundMusic:function(t){t&&(e.state.backgroundMusic=(new Bs).fromData(t))},background:function(t){t&&(e.state.background=t)}})},backgroundImageState:function(t){t&&(e.state.backgroundImage=(new es).fromData(t))}}),this}},{key:"getInitTransform",value:function(){return new Fa([{props:Object.assign(Object.assign({},this.state.backgroundImage.state),{opacity:1}),options:{duration:0}}])}},{key:"action",value:function(t){var e=(Array.isArray(t)?t.flat(2):t(this).flat(2)).map((function(t){return le.isChained(t)?t.fromChained(t):t})).flat(2),n=[],o=[];this.getAllChildrenElements(e).forEach((function(t){le.isChained(t)||(t instanceof es?n.push(t):t instanceof sl&&o.push(t))}));var i=[],a=[],s=new Map;n.forEach((function(t){var e;t.config.isWearable?a.push(t):i.push(t);var n,r=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=ll(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.config.wearables);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(s.get(o)&&s.get(o)!==t)throw new Error("Wearable image cannot be used multiple times\nYou may bind the same wearable image to multiple parent images\nParent Conflict: "+(null===(e=s.get(o))||void 0===e?void 0:e.getId())+"\nCurrent Parent: "+t.getId());s.set(o,t)}}catch(t){r.e(t)}finally{r.f()}}));var u=[this._init(this)].concat(cl(i.map((function(t){return t._init()}))),cl(a.map((function(t){if(!s.has(t))throw new Error("Wearable image must have a parent image");return s.get(t)._initWearable(t)}))),cl(o.map((function(t){return t._init()}))),cl(e)),c=function(t,e,n,r){var o=vl(ml(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(r,"constructNodes",this,3)([u]),l=new jt(void 0,void 0,c||void 0).setContent(this);return null==c||c.setParent(l),this.sceneRoot=new gt(this.chain(),"scene:action",l),this}},{key:"registerSrc",value:function(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Set;if(this.sceneRoot){var o=new Set,i=new Set,a=[this.sceneRoot],s=new Set;for(Ts.isImageSrc(this.config.background)&&this.srcManager.register(new es({src:Ts.toBackgroundSrc(this.config.background)}));a.length;){var u=a.shift();if(!o.has(u)){if(o.add(u),u instanceof gt){if(u.type===e.jumpTo){var c=u,l=c.contentNode.getContent()[0];if(i.has(c)||r.has(l))continue;i.add(c),s.add(l),r.add(l)}else if(u.type===e.setBackground){var f=u.contentNode.getContent()[0],p=Ts.backgroundToSrc(f);p&&this.srcManager.register(new es({src:p}))}}else if(u instanceof ys){var h=u;if(this.srcManager.register(h.callee),u.type===n.setSrc){var d=u.contentNode.getContent()[0];this.srcManager.register(new es({src:d}))}else if(u.type===n.initWearable){var y=u.contentNode.getContent()[0];this.srcManager.register(y)}}else if(u instanceof it)this.srcManager.register(u.callee);else if(u instanceof Zt){var v=u.getFutureActions();a.push.apply(a,cl(v))}a.push.apply(a,cl(u.getFutureActions()))}}s.forEach((function(e){e.registerSrc(r),t.srcManager.registerFuture(e.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=b(r.defaultState,this.config),this.state.backgroundImage.reset()}},{key:"toDisplayableTransform",value:function(){return this.state.backgroundImage.toDisplayableTransform()}},{key:"_applyTransition",value:function(t){return this.chain(new gt(this.chain(),"scene:applyTransition",(new jt).setContent([t])))}},{key:"_jumpTo",value:function(t){return this.chain(new gt(this.chain(),"scene:jumpTo",(new jt).setContent([t])))}},{key:"_exit",value:function(){return new gt(this.chain(),"scene:exit",(new jt).setContent([]))}},{key:"_transitionToScene",value:function(t,e,n){var r=this.chain();if(e){var o=e.copy();t&&t.config.background&&o.setSrc(t.config.background),n&&o.setSrc(n),r._applyTransition(o)}return r}},{key:"_init",value:function(){return new gt((arguments.length>0&&void 0!==arguments[0]?arguments[0]:this).chain(),"scene:init",(new jt).setContent([]))}}])}(mc);function _l(t){return _l="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},_l(t)}function Sl(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,kl(r.key),r)}}function kl(t){var e=function(t,e){if("object"!=_l(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=_l(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==_l(e)?e:e+""}function xl(t,e,n){return e=El(e),function(t,e){if(e&&("object"==_l(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,Al()?Reflect.construct(e,n||[],El(t).constructor):e.apply(t,n))}function Al(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Al=function(){return!!t})()}function Ol(){return Ol="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=El(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}},Ol.apply(null,arguments)}function El(t){return El=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},El(t)}function Tl(t,e){return Tl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Tl(t,e)}wl.EventTypes={"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.setBackgroundMusic":"event:scene.setBackgroundMusic","event:displayable.applyTransition":"event:displayable.applyTransition","event:displayable.applyTransform":"event:displayable.applyTransform","event:displayable.init":"event:displayable.init"},wl.defaultConfig={invertY:!1,invertX:!1,backgroundMusic:null,backgroundMusicFade:0},wl.defaultState={};var jl=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),xl(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&&Tl(t,e)}(e,t),function(t,e,n){return e&&Sl(t.prototype,e),n&&Sl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){return this.contentNode.getContent().execute({gameState:t}),function(t,e,n,r){var o=Ol(El(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"executeAction",this,3)([t])}}])}(Y);function Pl(t){return Pl="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},Pl(t)}function Cl(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,Ll(r.key),r)}}function Ll(t){var e=function(t,e){if("object"!=Pl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Pl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Pl(e)?e:e+""}function Il(t,e,n){return e=Ml(e),Nl(t,Rl()?Reflect.construct(e,n||[],Ml(t).constructor):e.apply(t,n))}function Nl(t,e){if(e&&("object"==Pl(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 Rl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Rl=function(){return!!t})()}function Ml(t){return Ml=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ml(t)}function Fl(t,e){return Fl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Fl(t,e)}jl.ActionTypes={action:"script:action"};var Dl=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=Il(this,e)).handler=t,Nl(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&&Fl(t,e)}(e,t),function(t,e,n){return e&&Cl(t.prototype,e),n&&Cl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"execute",value:function(t){var n=t.gameState;this.handler(e.getCtx({gameState:n}))}},{key:"fromChained",value:function(t){return[new jl(this.chain(),jl.ActionTypes.action,(new jt).setContent(t))]}}],[{key:"getCtx",value:function(t){var e=t.gameState;return{gameState:e,game:e.game,liveGame:e.game.getLiveGame(),storable:e.game.getLiveGame().getStorable()}}}])}(we);function Bl(t){return Bl="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},Bl(t)}function Vl(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,Gl(r.key),r)}}function Gl(t){var e=function(t,e){if("object"!=Bl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Bl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Bl(e)?e:e+""}function Ul(t,e,n){return e=zl(e),function(t,e){if(e&&("object"==Bl(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,Wl()?Reflect.construct(e,n||[],zl(t).constructor):e.apply(t,n))}function Wl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Wl=function(){return!!t})()}function zl(t){return zl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},zl(t)}function Hl(t,e){return Hl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Hl(t,e)}var $l=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=Ul(this,e)).entryScene=null,n.name=t,n.config=b(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&&Hl(t,e)}(e,t),function(t,e,n){return e&&Vl(t.prototype,e),n&&Vl(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 Cs(t).run()}}])}(mc);function Yl(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=Yl(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}$l.defaultConfig={};const ql=function(){for(var t,e,n=0,r="",o=arguments.length;n<o;n++)(t=arguments[n])&&(e=Yl(t))&&(r&&(r+=" "),r+=e);return r};var Xl=o(12),Kl=o.n(Xl);function Zl(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 Ql(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)?Ql(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 Ql(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 Jl=Kl().createContext(null);function tf(t){var e=t.children,n=t.game,r=new Qp({}),o=Zl((0,Xl.useState)(n||r),2),i=o[0],a=o[1];return Kl().createElement(Jl.Provider,{value:{game:i,setGame:a}},e)}function ef(){var t=(0,Xl.useContext)(Jl);if(!t)throw new Error("useGame must be used within a GameProvider");return t}function nf(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))})}var rf=o(387);const of=(0,Xl.createContext)({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),af=(0,Xl.createContext)({}),sf=(0,Xl.createContext)(null),uf=Ui?Xl.useLayoutEffect:Xl.useEffect,cf=(0,Xl.createContext)({strict:!1}),{schedule:lf,cancel:ff}=Hn(queueMicrotask,!1);function pf(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}const hf=(0,Xl.createContext)({});function df(t,e,n,r,o){var i,a;const{visualElement:s}=(0,Xl.useContext)(af),u=(0,Xl.useContext)(cf),c=(0,Xl.useContext)(sf),l=(0,Xl.useContext)(of).reducedMotion,f=(0,Xl.useRef)();r=r||u.renderer,!f.current&&r&&(f.current=r(t,{visualState:e,parent:s,props:n,presenceContext:c,blockInitialAnimation:!!c&&!1===c.initial,reducedMotionConfig:l}));const p=f.current,h=(0,Xl.useContext)(hf);!p||p.projection||!o||"html"!==p.type&&"svg"!==p.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:yf(t.parent)),t.projection.setOptions({layoutId:o,layout:i,alwaysMeasureLayout:Boolean(a)||s&&pf(s),visualElement:t,animationType:"string"==typeof i?i:"both",initialPromotionConfig:r,layoutScroll:u,layoutRoot:c})}(f.current,n,o,h),(0,Xl.useInsertionEffect)((()=>{p&&p.update(n,c)}));const d=n[Ii],y=(0,Xl.useRef)(Boolean(d)&&!(null===(i=window.MotionHandoffIsComplete)||void 0===i?void 0:i.call(window,d))&&(null===(a=window.MotionHasOptimisedAnimation)||void 0===a?void 0:a.call(window,d)));return uf((()=>{p&&(window.MotionIsMounted=!0,p.updateFeatures(),lf.render(p.render),y.current&&p.animationState&&p.animationState.animateChanges())})),(0,Xl.useEffect)((()=>{p&&(!y.current&&p.animationState&&p.animationState.animateChanges(),y.current&&(queueMicrotask((()=>{var t;null===(t=window.MotionHandoffMarkAsComplete)||void 0===t||t.call(window,d)})),y.current=!1))})),p}function yf(t){if(t)return!1!==t.options.allowProjection?t.projection:yf(t.parent)}function vf(t,e,n){return(0,Xl.useCallback)((r=>{r&&t.mount&&t.mount(r),e&&(r?e.mount(r):e.unmount()),n&&("function"==typeof n?n(r):pf(n)&&(n.current=r))}),[e])}function mf(t){const{initial:e,animate:n}=function(t,e){if(Xi(t)){const{initial:e,animate:n}=t;return{initial:!1===e||$i(e)?e:void 0,animate:$i(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,(0,Xl.useContext)(af));return(0,Xl.useMemo)((()=>({initial:e,animate:n})),[gf(e),gf(n)])}function gf(t){return Array.isArray(t)?t.join(" "):t}function bf(t){for(const e in t)Qi[e]={...Qi[e],...t[e]}}const wf=(0,Xl.createContext)({}),_f=Symbol.for("motionComponentSymbol");function Sf({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:r,Component:o}){t&&bf(t);const i=(0,Xl.forwardRef)((function(t,i){let a;const s={...(0,Xl.useContext)(of),...t,layoutId:kf(t)},{isStatic:u}=s,c=mf(t),l=r(t,u);if(!u&&Ui){!function(){(0,Xl.useContext)(cf).strict;0}();const t=function(t){const{drag:e,layout:n}=Qi;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=df(o,l,s,e,t.ProjectionNode)}return(0,rf.jsxs)(af.Provider,{value:c,children:[a&&c.visualElement?(0,rf.jsx)(a,{visualElement:c.visualElement,...s}):null,n(o,t,vf(l,c.visualElement,i),l,u,c.visualElement)]})}));return i[_f]=o,i}function kf({layoutId:t}){const e=(0,Xl.useContext)(wf).id;return e&&void 0!==t?e+"-"+t:t}const xf=["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 Af(t){return"string"==typeof t&&!t.includes("-")&&!!(xf.indexOf(t)>-1||/[A-Z]/u.test(t))}function Of(t){const e=hn(t)?t.get():t;return Si(e)?e.toValue():e}function Ef(t){return In.has(t)?"transform":ai.has(t)?Li(t):void 0}const Tf=t=>(e,n)=>{const r=(0,Xl.useContext)(af),o=(0,Xl.useContext)(sf),i=()=>function({applyWillChange:t=!1,scrapeMotionValuesFromProps:e,createRenderState:n,onMount:r},o,i,a,s){const u={latestValues:Pf(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,Xl.useRef)(null);return null===e.current&&(e.current=t()),e.current}(i)};function jf(t,e,n){const r=Array.isArray(e)?e:[e];for(let e=0;e<r.length;e++){const o=ji(t,r[e]);if(o){const{transitionEnd:t,transition:e,...r}=o;n(r,t)}}}function Pf(t,e,n,r,o){var i;const a={},s=new Set,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]=Of(c[t]);let{initial:l,animate:f}=t;const p=Xi(t),h=Ki(t);e&&h&&!p&&!1!==t.inherit&&(void 0===l&&(l=e.initial),void 0===f&&(f=e.animate));let d=!!n&&!1===n.initial;d=d||!1===l;const y=d?f:l;return y&&"boolean"!=typeof y&&!Hi(y)&&jf(t,y,((t,e)=>{for(const e in t){let n=t[e];if(Array.isArray(n)){n=n[d?n.length-1:0]}null!==n&&(a[e]=n)}for(const t in e)a[t]=e[t]})),u&&(f&&!1!==l&&!Hi(f)&&jf(t,f,(t=>{for(const e in t){const t=Ef(e);t&&s.add(t)}})),s.size&&(a.willChange=Array.from(s).join(","))),a}const Cf=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Lf=()=>({...Cf(),attrs:{}}),If={useVisualState:Tf({scrapeMotionValuesFromProps:Gi,createRenderState:Lf,onMount:(t,e,{renderState:n,latestValues:r})=>{$n.read((()=>{try{n.dimensions="function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch(t){n.dimensions={x:0,y:0,width:0,height:0}}})),$n.render((()=>{fa(n,r,ya(e.tagName),t.transformTemplate),da(e,n)}))}})},Nf={useVisualState:Tf({applyWillChange:!0,scrapeMotionValuesFromProps:Vi,createRenderState:Cf})};function Rf(t,e,n){for(const r in e)hn(e[r])||Bi(r,n)||(t[r]=e[r])}function Mf(t,e){const n={};return Rf(n,t.style||{},t),Object.assign(n,function({transformTemplate:t},e){return(0,Xl.useMemo)((()=>{const n=Cf();return sa(n,e,t),Object.assign({},n.vars,n.style)}),[e])}(t,e)),n}function Ff(t,e){const n={},r=Mf(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 Df=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 Bf(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Df.has(t)}let Vf=t=>!Bf(t);try{(Gf=require("@emotion/is-prop-valid").default)&&(Vf=t=>t.startsWith("on")?!Bf(t):Gf(t))}catch(Xt){}var Gf;function Uf(t,e,n,r){const o=(0,Xl.useMemo)((()=>{const n=Lf();return fa(n,e,ya(r),t.transformTemplate),{...n.attrs,style:{...n.style}}}),[e]);if(t.style){const e={};Rf(e,t.style,t),o.style={...e,...o.style}}return o}function Wf(t=!1){return(e,n,r,{latestValues:o},i)=>{const a=(Af(e)?Uf:Ff)(n,o,i,e),s=function(t,e,n){const r={};for(const o in t)"values"===o&&"object"==typeof t.values||(Vf(o)||!0===n&&Bf(o)||!e&&!Bf(o)||t.draggable&&o.startsWith("onDrag"))&&(r[o]=t[o]);return r}(n,"string"==typeof e,t),u=e!==Xl.Fragment?{...s,...a,ref:r}:{},{children:c}=n,l=(0,Xl.useMemo)((()=>hn(c)?c.get():c),[c]);return(0,Xl.createElement)(e,{...u,children:l})}}function zf(t,e){return function(n,{forwardMotionProps:r}={forwardMotionProps:!1}){return Sf({...Af(n)?If:Nf,preloadedFeatures:t,useRender:Wf(r),createVisualElement:e,Component:n})}}const Hf=nf(zf());function $f(){return $f=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},$f.apply(null,arguments)}function Yf(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 qf(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)?qf(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 qf(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 Xf=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n};function Kf(t){var e=t.children,n=t.border,r=void 0===n?"solid":n,o=t.color,i=void 0===o?"red":o,a=t.tag,s=t.borderWidth,u=void 0===s?1:s,c=t.as,l=void 0===c?"div":c,f=t.Ref,p=Xf(t,["children","border","color","tag","borderWidth","as","Ref"]),h=ef().game,d=Yf((0,Xl.useState)(!1),2),y=d[0],v=d[1];if(!h.config.app.inspector)return Kl().createElement(l,$f({},p,{ref:f}),e);var m=Object.assign(Object.assign({},p),{onMouseEnter:function(){return v(!0)},onMouseLeave:function(){return v(!1)},style:Object.assign(Object.assign({},p.style||{}),{outline:"".concat(u,"px ").concat(r," ").concat(i),zIndex:y?1e3:"auto"})});return Kl().createElement(l,$f({},m,{ref:f}),a&&y&&Kl().createElement("span",{className:"absolute top-0 left-0 bg-white text-black border-2 border-black text-sm"},a),e)}function Zf(t){var e=t.border,n=void 0===e?"solid":e,r=t.color,o=void 0===r?"red":r,i=t.tag,a=t.borderWidth,s=void 0===a?1:a,u=t.as,c=void 0===u?"img":u,l=Xf(t,["border","color","tag","borderWidth","as"]),f=ef().game,p=Yf((0,Xl.useState)(!1),2),h=p[0],d=p[1];if(!f.config.app.inspector)return Kl().createElement(c,l);var y=Object.assign(Object.assign({},l),{onMouseEnter:function(){return d(!0)},onMouseLeave:function(){return d(!1)},style:Object.assign(Object.assign({},l.style||{}),{outline:"".concat(n," ").concat(s,"px ").concat(o),zIndex:h?1e3:"auto"})});return Kl().createElement("div",null,Kl().createElement(c,y),i&&h&&Kl().createElement("span",{className:"absolute top-0 left-0 bg-white text-black border-2 border-black"},i))}const Qf={Div:function(t){return Kl().createElement(Kf,$f({},t,{as:"div"}))},Span:function(t){return Kl().createElement(Kf,$f({},t,{as:"span"}))},Button:function(t){return Kl().createElement(Kf,$f({},t,{as:"button"}))},Img:function(t){return Kl().createElement(Zf,$f({},t,{as:"img"}))},mDiv:function(t){return Kl().createElement(Kf,$f({},t,{as:Hf.div,Ref:t.Ref}))}};function Jf(t){return Jf="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},Jf(t)}function tp(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */tp=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 P(r||[]);return o(a,"_invoke",{value:O(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",h="suspendedYield",d="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"==Jf(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(Jf(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 ep(t){return function(t){if(Array.isArray(t))return op(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||rp(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 np(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)||rp(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 rp(t,e){if(t){if("string"==typeof t)return op(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)?op(t,e):void 0}}function op(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 ip(t){var e=tp().mark(R),n=t.sentence,r=t.gameState,o=t.useTypeEffect,i=void 0===o||o,a=t.onCompleted,s=t.finished,u=t.count,c=t.className,l=np((0,Xl.useState)(!1),2),f=l[0],p=l[1],h=(0,Xl.useMemo)((function(){return n.evaluate(Dl.getCtx({gameState:r}))}),[]),d=r.game,y=np((0,Xl.useState)([]),2),v=y[0],m=y[1],g=(0,Xl.useRef)(R(h)),b=(0,Xl.useRef)(null),w=(0,Xl.useRef)(null),_=np((0,Xl.useState)(0),2),k=_[0],x=_[1],A=np((0,Xl.useReducer)((function(t){return t+1}),0),2)[1],O=np((0,Xl.useState)(new Set),2),E=O[0],T=O[1],j=np((0,Xl.useState)(!1),2),P=j[0],C=j[1];function L(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];w.current&&(clearTimeout(w.current),w.current=null);for(var e=!1;!e;){var n=g.current.next(),o=n.done,i=n.value;if(o)p(!0),a&&(r.logger.info("Say","Completed",o,i),a()),e=!0;else if(Ws.isPause(i)){if(t)continue;N(Ws.from(i)),e=!0}else I(i)}}function I(t){m((function(e){if("\n"!==t&&E.has(t))return e;T((function(e){return new Set(e).add(t)}));var n=e[e.length-1];return n&&"\n"!==n&&"\n"!==t&&n.tag===t.tag?[].concat(ep(e.slice(0,-1)),[{text:n.text+t.text,config:t.config,tag:t.tag,tag2:t.tag2}]):[].concat(ep(e),[t])}))}function N(t){r.logger.info("Say","Paused",t),t.config.duration?b.current=setTimeout((function(){b.current=null,x((function(t){return t+1}))}),t.config.duration):C(!0)}function R(t){var n,r,o,i,a;return tp().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=ep(t),r=0;case 2:if(!(r<n.length)){e.next=24;break}if(o=n[r],!Ws.isPause(o.text)){e.next=8;break}return e.next=7,Ws.from(o.text);case 7:return e.abrupt("continue",21);case 8:i=0;case 9:if(!(i<o.text.length)){e.next=21;break}if("\n"!==(a=o.text[i])){e.next=16;break}return e.next=14,"\n";case 14:e.next=18;break;case 16:return e.next=18,{text:a,config:o.config,tag:r,tag2:i};case 18:i++,e.next=9;break;case 21:r++,e.next=2;break;case 24:return e.abrupt("return");case 25:case"end":return e.stop()}}),e)}return(0,Xl.useEffect)((function(){if(i||L(!0),s&&!f)return b.current&&clearTimeout(b.current),b.current=null,L(!0),void(a&&(r.logger.info("Say","Completed",b.current,s,f),a()));if(f||s||P||b.current)r.logger.debug("Sentence.tsx","locked",f,s,P);else{var t=g.current.next(),e=t.done,n=t.value;if(e)return p(!0),void(a&&(r.logger.info("Say","Completed",e,n),a()));Ws.isPause(n)?N(Ws.from(n)):(I(n),A(),w.current=setTimeout((function(){x((function(t){return t+1}))}),d.config.elements.say.textInterval))}}),[k,s,P]),(0,Xl.useEffect)((function(){if(u&&!b.current){if(P)return C(!1),void x((function(t){return t+1}));L(),x((function(t){return t+1}))}}),[u]),Kl().createElement("div",{className:ql("whitespace-pre-wrap",d.config.elementStyles.say.textContainerClassName,{"font-bold":n.config.bold,italic:n.config.italic},c),style:{fontFamily:n.config.fontFamily||d.config.elementStyles.say.fontFamily,fontSize:n.config.fontSize||d.config.elementStyles.say.fontSize}},v.map((function(t,e){return"\n"===t?Kl().createElement("br",{key:e}):Kl().createElement(Qf.Span,{tag:"say.word.".concat(e),key:e,style:Object.assign({color:S(t.config.color||n.config.color||Ys.defaultColor),fontFamily:t.config.fontFamily,fontSize:t.config.fontSize},d.config.app.debug?{outline:"1px dashed red"}:{}),className:ql(d.config.elementStyles.say.textSpanClassName,"whitespace-pre inline-block",{"font-bold":t.config.bold,italic:t.config.italic},t.config.className)},t.config.ruby?Kl().createElement("ruby",{className:"align-bottom inline-block"},Kl().createElement("rt",{className:"block text-center"},t.config.ruby),t.text):t.text)})))}function ap(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 sp(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)?sp(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 sp(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 up(t){return up="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},up(t)}function cp(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,lp(r.key),r)}}function lp(t){var e=function(t,e){if("object"!=up(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=up(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==up(e)?e:e+""}var fp=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,scale:0},this.events=new k,this.lockers=[],this.updater=null}return function(t,e,n){return e&&cp(t.prototype,e),n&&cp(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"update",value:function(e,n,r){this.state.width=e,this.state.height=n,this.state.scale=r,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:"requestUpdate",value:function(){this.events.emit(t.EventTypes["event:aspectRatio.requestUpdate"])}},{key:"onRequestedUpdate",value:function(e){var n=this;return this.events.on(t.EventTypes["event:aspectRatio.requestUpdate"],e),function(){n.events.off(t.EventTypes["event:aspectRatio.requestUpdate"],e)}}},{key:"triggerUpdate",value:function(){this.updater&&this.updater()}}])}();fp.EventTypes={"event:aspectRatio.update":"event:aspectRatio.update","event:aspectRatio.pause":"event:aspectRatio.pause","event:aspectRatio.resume":"event:aspectRatio.resume","event:aspectRatio.requestUpdate":"event:aspectRatio.requestUpdate"};var pp=(0,Xl.createContext)(null);function hp(t){var e=t.children,n=ap((0,Xl.useState)((function(){return new fp})),1)[0];return Kl().createElement(pp.Provider,{value:{ratio:n}},e)}function dp(){var t=(0,Xl.useContext)(pp);if(!pp||!t)throw new Error("useRatio must be used within a RatioProvider");var e=ap((0,Xl.useReducer)((function(t){return t+1}),0),2)[1],n=t.ratio;return(0,Xl.useEffect)((function(){return n.onUpdate((function(){e()}))}),[]),t}function yp(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 vp(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)?vp(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 vp(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 mp(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=yp((0,Xl.useState)(!1),2),l=c[0],f=c[1],p=s.game,h=yp((0,Xl.useState)(0),2),d=h[0],y=h[1],v=dp().ratio,m=yp((0,Xl.useState)(new I),1)[0];function g(){p.preference.getPreference(Qp.Preferences.autoForward)&&m.cancelTask().scheduleTask((function(){r&&r()}),p.config.elements.say.autoForwardDelay)}return(0,Xl.useEffect)((function(){if(window){var t=function(t){p.config.elements.say.nextKey.includes(t.key)&&(l?r&&r():y((function(t){return t+1})))};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")}),[l]),(0,Xl.useEffect)((function(){var t=s.events.onEvents([{type:Pp.EventTypes["event:state.player.skip"],listener:s.events.on(Pp.EventTypes["event:state.player.skip"],(function(){s.logger.log("NarraLeaf-React: Say","Skipped"),l?r&&r():f(!0)}))}]);return function(){t.cancel()}}),[l]),(0,Xl.useEffect)((function(){var t=p.preference.onPreferenceChange(Qp.Preferences.autoForward,(function(t){t&&l?g():m.cancelTask()}));return function(){t.cancel()}}),[l]),(0,Xl.useEffect)((function(){return function(){m.cancelTask()}}),[]),Kl().createElement("div",null,u.state.display&&Kl().createElement(Qf.Div,{tag:"say.aspectScaleContainer",color:"blue",border:"dashed",className:ql("absolute bottom-0 w-[calc(100%-40px)]",a),onClick:function(){l?(r&&r(),g()):y((function(t){return t+1}))},style:Object.assign({},C(p.config.elements.say.useAspectScale,{width:p.config.elements.text.width,height:p.config.elements.text.height}))},Kl().createElement(Qf.Div,{tag:"say.containerClassName",className:ql(p.config.elementStyles.say.containerClassName),style:Object.assign({},C(p.config.elements.say.useAspectScale,{transform:"scale(".concat(v.state.scale,")"),transformOrigin:"bottom left",width:"100%",height:"100%"}))},Kl().createElement("div",{className:ql("bg-white flex flex-col items-start justify-between",p.config.elementStyles.say.contentContainerClassName,"w-full h-full")},Kl().createElement(Qf.Div,{tag:"say.nameTextClassName",className:ql("rounded-br-md text-black",p.config.elementStyles.say.nameTextClassName)},null===(e=u.config.character)||void 0===e?void 0:e.state.name),Kl().createElement(ip,{sentence:u,gameState:s,finished:l,useTypeEffect:i,onCompleted:function(){f(!0),g()},count:d}),Kl().createElement("div",null)))))}function gp(){return gp=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},gp.apply(null,arguments)}function bp(t){var e=t.children,n=t.className,r=t.props,o=t.style,i=dp().ratio,a=i.getStyle();return Kl().createElement("div",{className:ql("inset-0",n),style:{width:"100%",height:"100%",minWidth:"".concat(i.state.minWidth,"px"),minHeight:"".concat(i.state.minHeight,"px")}},Kl().createElement("div",gp({style:Object.assign(Object.assign(Object.assign(Object.assign({},a),{position:"relative",overflow:"hidden"}),(null==r?void 0:r.style)||{}),o||{})},r||{}),e))}var wp={say:mp,menu:function(t){var e=t.prompt,n=t.choices,r=t.afterChoose,o=t.state,i=ef().game,a=dp().ratio,s=i.config.elements.say.use;return Kl().createElement(Kl().Fragment,null,Kl().createElement(bp,{className:"absolute"},e&&Kl().createElement(s,{state:o,action:{sentence:e,character:null},useTypeEffect:!1,className:"z-10"})),Kl().createElement(Qf.Div,{color:"green",border:"dashed",className:ql("absolute"),style:{width:"".concat(i.config.player.width,"px"),height:"".concat(i.config.player.height,"px")}},Kl().createElement(Qf.Div,{tag:"menu.aspectScaleContainer",style:{transform:"scale(".concat(a.state.scale,")"),transformOrigin:"left top"},className:ql("w-full h-full")},Kl().createElement(Qf.Div,{tag:"menu.containerClassName",className:ql("absolute flex flex-col items-center justify-center min-w-full w-full h-full",i.config.elementStyles.menu.containerClassName)},Kl().createElement("div",{className:"p-4 rounded-lg w-full z-20"},Kl().createElement("div",{className:"flex flex-col items-center mt-4 w-full"},n.map((function(t,e){return Kl().createElement(Qf.Button,{tag:"menu.choiceButtonClassName."+e,key:e,className:ql("bg-white text-black p-2 mt-2 w-1/2",i.config.elementStyles.menu.choiceButtonClassName),onClick:function(){return function(t){r(t)}(t)}},Kl().createElement(ip,{sentence:t.prompt,gameState:o,useTypeEffect:!1,className:ql(i.config.elementStyles.menu.choiceButtonTextClassName)}))}))))))))}},_p=o(196);function Sp(t){return Sp="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},Sp(t)}function kp(t){return function(t){if(Array.isArray(t))return Op(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Ap(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 xp(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */xp=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 P(r||[]);return o(a,"_invoke",{value:O(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",h="suspendedYield",d="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"==Sp(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(Sp(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 Ap(t,e){if(t){if("string"==typeof t)return Op(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)?Op(t,e):void 0}}function Op(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 Ep(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,Tp(r.key),r)}}function Tp(t){var e=function(t,e){if("object"!=Sp(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Sp(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Sp(e)?e:e+""}var jp=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())}))},Pp=function(){return function(t,e,n){return e&&Ep(t.prototype,e),n&&Ep(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 k,this.logger=new E(e,"NarraLeaf-React")}),[{key:"findElementByScene",value:function(t){return this.state.elements.find((function(e){return e.scene===t}))||null}},{key:"findElementByDisplayable",value:function(t){return this.state.elements.find((function(e){return e.ele.displayable.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:"isSceneActive",value:function(t){var e,n=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Ap(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}}}}(this.state.elements);try{for(n.s();!(e=n.n()).done;){if(e.value.scene===t)return!0}}catch(t){n.e(t)}finally{n.f()}return!1}},{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.config.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.displayable.push(t),this):this}},{key:"createWearable",value:function(t,e){return t.events.any(es.EventTypes["event:wearable.create"],e)}},{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.displayable;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:"createDisplayable",value:function(t,e){var n=this._getLastSceneIfNot(e),r=this.findElementByScene(n);return r?(r.ele.displayable.push(t),this):this}},{key:"disposeDisplayable",value:function(t,e){var n,r=this._getLastSceneIfNot(e),o=null===(n=this.findElementByScene(r))||void 0===n?void 0:n.ele.displayable;if(!o)throw new Error("Scene not found");var i=o.indexOf(t);if(-1===i)throw new Error("Displayables not found");return o.splice(i,1),this}},{key:"forceReset",value:function(){var t=this;this.state.sounds.forEach((function(t){var e;return null===(e=t.getPlaying())||void 0===e?void 0:e.stop()})),this.state.elements.forEach((function(e){var n=e.scene;t.offSrcManager(n.srcManager),t.removeScene(n),n.events.clear()})),this.state.elements=[],this.state.srcManagers=[]}},{key:"initSound",value:function(t,e){return t.getPlaying()||t.setPlaying(new(this.getHowl())(t.getHowlOptions(e))),t}},{key:"playSound",value:function(t,e,n){this.initSound(t,n);var r=t.getPlaying().play(),o=[t.getPlaying().once("end",i.bind(this)),t.getPlaying().once("stop",i.bind(this))];function i(){e&&e(),o.forEach((function(t){return t.off()})),this.state.sounds=this.state.sounds.filter((function(e){return e!==t})),this.stage.next()}return this.state.sounds.push(t),t.state.token=r,r}},{key:"stopSound",value:function(t){var e,n;return(null===(e=t.state.playing)||void 0===e?void 0:e.playing(t.getToken()))&&(null===(n=t.state.playing)||void 0===n||n.stop(t.getToken())),t.setPlaying(null).setToken(null),t}},{key:"transitionSound",value:function(t,e,n){return jp(this,void 0,void 0,xp().mark((function r(){var o;return xp().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!t){r.next=5;break}if(!n){r.next=4;break}return r.next=4,this.fadeSound(t,0,n);case 4:this.stopSound(t);case 5:if(!e){r.next=12;break}if(o=e.config.volume,this.playSound(e,void 0,{volume:0}),!n){r.next=11;break}return r.next=11,this.fadeSound(e,o,n);case 11:e.getPlaying().volume(o,e.getToken());case 12:case"end":return r.stop()}}),r,this)})))}},{key:"fadeSound",value:function(t,e,n){var r,o;return jp(this,void 0,void 0,xp().mark((function i(){var a;return xp().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return a=null===(r=t.getPlaying())||void 0===r?void 0:r.volume(t.getToken()),null===(o=t.getPlaying())||void 0===o||o.fade(a,e,n,t.getToken()),i.next=4,A(n);case 4:return i.abrupt("return",void 0);case 5:case"end":return i.stop()}}),i)})))}},{key:"getHowl",value:function(){return _p.Howl}},{key:"animateImage",value:function(t,e,n,r){return this.anyEvent.apply(this,[t,e,r].concat(kp(n)))}},{key:"animateText",value:function(t,e,n,r){return this.anyEvent.apply(this,[t,e,r].concat(kp(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:"dispose",value:function(){this.forceReset()}},{key:"toData",value:function(){return{scenes:this.state.elements.map((function(t){return{sceneId:t.scene.getId(),elements:{displayable:t.ele.displayable.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:{menus:[],texts:[],displayable:o.displayable.map((function(t){if(!e.has(t))throw new Error("Displayable not found, id: "+t+"\nNarraLeaf cannot find the element with the id from the saved game\nThis may be caused by the damage of the saved game file or the change of the story file");return e.get(t)}))}};n.state.elements.push(a),n.registerSrcManager(i.srcManager),gt.registerEventListeners(i,n)}))}},{key:"initScenes",value:function(){var t=this;this.state.elements.forEach((function(e){var n=e.scene;gt.registerEventListeners(n,t)}))}},{key:"getElementMap",value:function(){return{texts:[],menus:[],displayable:[]}}},{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 Cp(t){return Cp="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},Cp(t)}function Lp(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 Ip(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)?Ip(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 Ip(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 Np(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Rp(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,Fp(r.key),r)}}function Mp(t,e,n){return e&&Rp(t.prototype,e),n&&Rp(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Fp(t){var e=function(t,e){if("object"!=Cp(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Cp(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Cp(e)?e:e+""}Pp.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"};var Dp=function(){function t(e,n,r){Np(this,t),this.name=e,this.key=r||e,this.content=b({},n)}return Mp(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=Lp(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=Lp(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(Cp(e))||(e instanceof Date||(null==e||(Array.isArray(e)?e.every(t.isSerializable):"object"===Cp(e)&&(Object.getPrototypeOf(e)===Object.prototype&&Object.values(e).every(t.isSerializable)))))}}])}(),Bp=function(){return Mp((function t(){Np(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=Lp(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=Lp(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}}])}();function Vp(t){return Vp="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},Vp(t)}function Gp(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,Up(r.key),r)}}function Up(t){var e=function(t,e){if("object"!=Vp(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Vp(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Vp(e)?e:e+""}var Wp=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.gameLock=new P,this.currentSavedGame=null,this.story=null,this.lockedAwaiting=null,this.gameState=void 0,this._lockedCount=0,this.currentAction=null,this._nextLock=new j,this.game=e,this.storable=new Bp,this.initNamespaces()}return function(t,e,n){return e&&Gp(t.prototype,e),n&&Gp(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"initNamespaces",value:function(){return this.storable.clear().addNamespace(new Dp(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._nextLock.isLocked())return null;if(this._nextLock.lock(),this.gameLock.isLocked())return this.gameLock;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("LiveGame locked: dead cycle detected\nPlease refresh the page");return this._nextLock.unlock(),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,this._nextLock.unlock(),r||null}if(!this.currentAction)return t.events.emit(Pp.EventTypes["event:state.end"]),t.logger.warn("LiveGame","No current action"),this._nextLock.unlock(),null;var o=this.currentAction.executeAction(t);return w.isAwaitable(o)?(this.lockedAwaiting=o,this._nextLock.unlock(),o):(t.logger.debug("next action",o),this._lockedCount=0,this.currentAction=(null===(n=o.node)||void 0===n?void 0:n.action)||null,this._nextLock.unlock(),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 w.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}}}}])}();function zp(t){return zp="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},zp(t)}function Hp(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,$p(r.key),r)}}function $p(t){var e=function(t,e){if("object"!=zp(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=zp(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==zp(e)?e:e+""}Wp.DefaultNamespaces={game:{}},Wp.GameSpacesKey={game:"game"};var Yp,qp=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.settings=e,this.events=new k}return function(t,e,n){return e&&Hp(t.prototype,e),n&&Hp(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"setPreference",value:function(e,n){this.settings[e]=n,this.events.emit(t.EventTypes["event:game.preference.change"],e,n)}},{key:"getPreference",value:function(t){return this.settings[t]}},{key:"getPreferences",value:function(){return this.settings}},{key:"onPreferenceChange",value:function(e,n){var r=this,o=this.events.on(t.EventTypes["event:game.preference.change"],(function(t,r){"string"==typeof e?e===t&&n&&n(r):e(t,r)}));return{cancel:function(){return r.events.off(t.EventTypes["event:game.preference.change"],o)}}}},{key:"importPreferences",value:function(t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&this.setPreference(e,t[e])}},{key:"exportPreferences",value:function(){var t={};for(var e in this.settings)Object.prototype.hasOwnProperty.call(this.settings,e)&&(t[e]=this.settings[e]);return t}}])}();function Xp(t){return Xp="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},Xp(t)}function Kp(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,Zp(r.key),r)}}function Zp(t){var e=function(t,e){if("object"!=Xp(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Xp(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Xp(e)?e:e+""}qp.EventTypes={"event:game.preference.change":"event:game.preference.change"},function(t){t.game="game"}(Yp||(Yp={}));var Qp=function(){return function(t,e,n){return e&&Kp(t.prototype,e),n&&Kp(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.liveGame=null,this.preference=new qp(t.DefaultPreference),this.config=b(t.DefaultConfig,e)}),[{key:"useComponent",value:function(t,e){if(!Object.keys(wp).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 Wp(this)}}])}();Qp.defaultSettings={volume:1},Qp.ComponentTypes={say:"say",menu:"menu"},Qp.DefaultPreference={autoForward:!1,skip:!0},Qp.Preferences={autoForward:"autoForward",skip:"skip"},Qp.DefaultConfig={player:{contentContainerId:"__narraleaf_content",aspectRatio:16/9,minWidth:800,minHeight:450,width:1920,height:1080,skipKey:["Control"],skipInterval:100,ratioUpdateInterval:50},elements:{say:{nextKey:[" "],textInterval:50,use:wp.say,useAspectScale:!0,autoForwardDelay:3e3},img:{slowLoadWarning:!0,slowLoadThreshold:2e3,allowSkipTransform:!0,allowSkipTransition:!0},menu:{use:wp.menu},background:{allowSkipTransform:!0,allowSkipTransition:!1},text:{allowSkipTransform:!0,allowSkipTransition:!0,width:1920,height:216}},elementStyles:{say:{contentContainerClassName:"",containerClassName:"",nameTextClassName:"",textContainerClassName:"",textSpanClassName:"",rubyClassName:""},menu:{containerClassName:"",choiceButtonClassName:"",choiceButtonTextClassName:""}},app:{debug:!1,logger:{log:!1,info:!1,warn:!0,error:!0,debug:!1,trace:!1},inspector:!1}},Qp.GameSettingsNamespace=Yp;var Jp=o(72),th=o.n(Jp),eh=o(825),nh=o.n(eh),rh=o(659),oh=o.n(rh),ih=o(56),ah=o.n(ih),sh=o(540),uh=o.n(sh),ch=o(113),lh=o.n(ch),fh=o(587),ph={};ph.styleTagTransform=lh(),ph.setAttributes=ah(),ph.insert=oh().bind(null,"head"),ph.domAPI=nh(),ph.insertStyleElement=uh();th()(fh.A,ph);fh.A&&fh.A.locals&&fh.A.locals;function hh({children:t,features:e,strict:n=!1}){const[,r]=(0,Xl.useState)(!dh(e)),o=(0,Xl.useRef)(void 0);if(!dh(e)){const{renderer:t,...n}=e;o.current=t,bf(n)}return(0,Xl.useEffect)((()=>{dh(e)&&e().then((({renderer:t,...e})=>{bf(e),o.current=t,r(!0)}))}),[]),(0,rf.jsx)(cf.Provider,{value:{renderer:o.current,strict:n},children:t})}function dh(t){return"function"==typeof t}function yh(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 vh(t,e,n={}){var r;const o=Pi(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(Fi(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(mh).forEach(((t,r)=>{t.notify("AnimationStart",e),a.push(vh(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 mh(t,e){return t.sortNodePosition(e)}const gh=qi.length;function bh(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&bh(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let n=0;n<gh;n++){const r=qi[n],o=t.props[r];($i(o)||!1===o)&&(e[r]=o)}return e}const wh=[...Yi].reverse(),_h=Yi.length;function Sh(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=>vh(t,e,n)));r=Promise.all(o)}else if("string"==typeof e)r=vh(t,e,n);else{const o="function"==typeof e?Pi(t,e,n.custom):e;r=Promise.all(Fi(t,o,n))}return r.then((()=>{t.notify("AnimationComplete",e)}))}(t,e,n))))}function kh(t){let e=Sh(t),n=Oh(),r=!0;const o=e=>(n,r)=>{var o;const i=Pi(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{props:a}=t,s=bh(t.parent)||{},u=[],c=new Set;let l={},f=1/0;for(let e=0;e<_h;e++){const p=wh[e],h=n[p],d=void 0!==a[p]?a[p]:s[p],y=$i(d),v=p===i?h.isActive:null;!1===v&&(f=e);let m=d===s[p]&&d!==a[p]&&y;if(m&&r&&t.manuallyAnimateOnMount&&(m=!1),h.protectedKeys={...l},!h.isActive&&null===v||!d&&!h.prevProp||Hi(d)||"boolean"==typeof d)continue;const g=xh(h.prevProp,d);let b=g||p===i&&h.isActive&&!m&&y||e>f&&y,w=!1;const _=Array.isArray(d)?d:[d];let S=_.reduce(o(p),{});!1===v&&(S={});const{prevResolvedValues:k={}}=h,x={...k,...S},A=e=>{b=!0,c.has(e)&&(w=!0,c.delete(e)),h.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in x){const e=S[t],n=k[t];if(l.hasOwnProperty(t))continue;let r=!1;r=_i(e)&&_i(n)?!yh(e,n):e!==n,r?null!=e?A(t):c.add(t):void 0!==e&&c.has(t)?A(t):h.protectedKeys[t]=!0}h.prevProp=d,h.prevResolvedValues=S,h.isActive&&(l={...l,...S}),r&&t.blockInitialAnimation&&(b=!1);b&&(!(m&&g)||w)&&u.push(..._.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=Oh(),r=!0}}}function xh(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!yh(e,t)}function Ah(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Oh(){return{animate:Ah(!0),whileInView:Ah(),whileHover:Ah(),whileTap:Ah(),whileDrag:Ah(),whileFocus:Ah(),exit:Ah()}}class Eh{constructor(t){this.isMounted=!1,this.node=t}update(){}}let Th=0;const jh={animation:{Feature:class extends Eh{constructor(t){super(t),t.animationState||(t.animationState=kh(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Hi(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 Eh{constructor(){super(...arguments),this.id=Th++}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 Ph(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function Ch(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const Lh=t=>e=>(t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary)(e)&&t(e,Ch(e));function Ih(t,e,n,r){return Ph(t,e,Lh(n),r)}function Nh(t){let e=null;return()=>{const n=()=>{e=null};return null===e&&(e=t,n)}}const Rh=Nh("dragHorizontal"),Mh=Nh("dragVertical");function Fh(){const t=function(t){let e=!1;if("y"===t)e=Mh();else if("x"===t)e=Rh();else{const t=Rh(),n=Mh();t&&n?e=()=>{t(),n()}:(t&&t(),n&&n())}return e}(!0);return!t||(t(),!1)}function Dh(t,e){const n=e?"pointerenter":"pointerleave",r=e?"onHoverStart":"onHoverEnd";return Ih(t.current,n,((n,o)=>{if("touch"===n.pointerType||Fh())return;const i=t.getProps();t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",e);const a=i[r];a&&$n.postRender((()=>a(n,o)))}),{passive:!t.getProps()[r]})}const Bh=(t,e)=>!!e&&(t===e||Bh(t,e.parentElement));function Vh(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,Ch(n))}const Gh=new WeakMap,Uh=new WeakMap,Wh=t=>{const e=Gh.get(t.target);e&&e(t)},zh=t=>{t.forEach(Wh)};function Hh(t,e,n){const r=function({root:t,...e}){const n=t||document;Uh.has(n)||Uh.set(n,{});const r=Uh.get(n),o=JSON.stringify(e);return r[o]||(r[o]=new IntersectionObserver(zh,{root:t,...e})),r[o]}(e);return Gh.set(t,n),r.observe(t),()=>{Gh.delete(t),r.unobserve(t)}}const $h={some:0,all:1};const Yh={inView:{Feature:class extends Eh{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:$h[r]};return Hh(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 Eh{constructor(){super(...arguments),this.removeStartListeners=We,this.removeEndListeners=We,this.removeAccessibleListeners=We,this.startPointerPress=(t,e)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),r=Ih(window,"pointerup",((t,e)=>{if(!this.checkPressEnd())return;const{onTap:n,onTapCancel:r,globalTapTarget:o}=this.node.getProps(),i=o||Bh(this.node.current,t.target)?n:r;i&&$n.update((()=>i(t,e)))}),{passive:!(n.onTap||n.onPointerUp)}),o=Ih(window,"pointercancel",((t,e)=>this.cancelPress(t,e)),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=Vo(r,o),this.startPress(t,e)},this.startAccessiblePress=()=>{const t=Ph(this.node.current,"keydown",(t=>{if("Enter"!==t.key||this.isPressing)return;this.removeEndListeners(),this.removeEndListeners=Ph(this.node.current,"keyup",(t=>{"Enter"===t.key&&this.checkPressEnd()&&Vh("up",((t,e)=>{const{onTap:n}=this.node.getProps();n&&$n.postRender((()=>n(t,e)))}))})),Vh("down",((t,e)=>{this.startPress(t,e)}))})),e=Ph(this.node.current,"blur",(()=>{this.isPressing&&Vh("cancel",((t,e)=>this.cancelPress(t,e)))}));this.removeAccessibleListeners=Vo(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&&$n.postRender((()=>n(t,e)))}checkPressEnd(){this.removeEndListeners(),this.isPressing=!1;return this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!Fh()}cancelPress(t,e){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&$n.postRender((()=>n(t,e)))}mount(){const t=this.node.getProps(),e=Ih(t.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),n=Ph(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Vo(e,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}},focus:{Feature:class extends Eh{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=Vo(Ph(this.node.current,"focus",(()=>this.onFocus())),Ph(this.node.current,"blur",(()=>this.onBlur())))}unmount(){}}},hover:{Feature:class extends Eh{mount(){this.unmount=Vo(Dh(this.node,!0),Dh(this.node,!1))}unmount(){}}}},qh={renderer:(t,e)=>Af(t)?new va(e):new ga(e,{allowProjection:t!==Xl.Fragment}),...jh,...Yh};function Xh(t){var e=t.children;return Kl().createElement(hh,{features:qh,strict:!0},e)}function Kh(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 Zh(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)?Zh(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 Zh(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 Qh(t){var e=t.children,n=t.className,r=Kh((0,Xl.useState)({}),2),o=r[0],i=r[1],a=dp().ratio,s=ef().game,u=Kh((0,Xl.useReducer)((function(t){return t+1}),0),2)[1],c=s.config.player.minWidth,l=s.config.player.minHeight;return(0,Xl.useEffect)((function(){var t,e=function(){if(a.isLocked())console.warn("NarraLeaf-React: 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"});var p=e/s.config.player.width;a.update(e,n,p),a.updateMin(c,l),u()}}};a.setUpdate(e);var n,r,o,f=(n=function(){e(),clearTimeout(t),a.pause(),t=setTimeout((function(){a.resume()}),100)},r=s.config.player.ratioUpdateInterval,o=null,function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];o&&clearTimeout(o),o=setTimeout((function(){n.apply(void 0,e)}),r)});f(),window.addEventListener("resize",f);var p=a.onRequestedUpdate(f);return function(){window.removeEventListener("resize",f),clearTimeout(t),p()}}),[a]),Kl().createElement("div",{id:s.config.player.contentContainerId,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"}},Kl().createElement("div",{className:ql(n),style:o},e))}function Jh(t){return Jh="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},Jh(t)}function td(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */td=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 P(r||[]);return o(a,"_invoke",{value:O(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",h="suspendedYield",d="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"==Jh(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(Jh(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 ed(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 nd(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)?nd(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 nd(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 rd=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 od(t){var e=this,n=t.state,r=t.displayable,o=t.child,i=r.element,a=r.state,s=void 0===a?i:a,u=(0,Xl.useRef)(null),c=ed((0,Xl.useState)(null),2),l=c[0],f=c[1],p=ed((0,Xl.useState)([]),2)[1],h=ed((0,Xl.useState)(null),2),d=h[0],y=h[1],v=ed((0,Xl.useState)({}),2),m=v[0],g=v[1];function w(t){if(d&&d.getControl()&&(n.logger.warn("Displayable Animation","processing transform not completed"),d.getControl().complete(),d.setControl(null)),!u.current)throw new Error("scope not ready");t instanceof Fa?Object.assign(u.current.style,t.propToCSS(n,s.state,r.transformOverwrites)):Object.assign(u.current.style,t)}function _(t){return f(t),t?new Promise((function(e){var r=t.events.onEvents([{type:Lc.update,listener:t.events.on(Lc.update,(function(t){p(t)}))},{type:Lc.end,listener:t.events.on(Lc.end,(function(){f(null),n.logger.debug("scene background transition end",t)}))},{type:Lc.start,listener:t.events.on(Lc.start,(function(){n.logger.debug("scene background transition start",t)}))}]);t.start((function(){r.cancel(),e()}))})):(n.logger.warn("transition not set"),Promise.resolve())}function S(t){return rd(this,void 0,void 0,td().mark((function e(){return td().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return w(t.propToCSS(n,s.state,r.transformOverwrites)),y(t),e.next=4,t.animate({scope:u,target:s,overwrites:r.transformOverwrites},n,(function(e){s.state=b(s.state,e),g({style:t.propToCSS(n,s.state,r.transformOverwrites)}),y(null)}));case 4:case"end":return e.stop()}}),e)})))}return(0,Xl.useEffect)((function(){var t="event:displayable.applyTransition",o="event:displayable.applyTransform",a="event:displayable.init",c=i.events.onEvents([{type:t,listener:i.events.on(t,_)},{type:o,listener:i.events.on(o,S)},{type:a,listener:i.events.on(a,(function(){return rd(e,void 0,void 0,td().mark((function t(){var e;return td().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=i.toDisplayableTransform(),n.logger.debug("init transform",e),t.next=4,e.animate({scope:u,target:s,overwrites:r.transformOverwrites},n,(function(t){s.state=b(s.state,t)}));case 4:case"end":return t.stop()}}),t)})))}))}]);return function(){c.cancel()}}),[]),(0,Xl.useEffect)((function(){if(!u.current)throw new Error("Scope not ready. Using element: ".concat(i.constructor.name))}),[]),(0,Xl.useEffect)((function(){var t=n.events.onEvents([{type:Pp.EventTypes["event:state.player.skip"],listener:n.events.on(Pp.EventTypes["event:state.player.skip"],(function(){r.skipTransform&&d&&d.getControl()&&(d.getControl().complete(),d.setControl(null),n.logger.debug("transform skip")),r.skipTransition&&l&&l.controller&&(l.controller.complete(),f(null),n.logger.debug("transition skip"))}))}]);return function(){t.cancel()}}),[l,d]),Kl().createElement(Kl().Fragment,null,o({transformRef:u,transition:l,transform:d,transformProps:m,state:n}))}function id(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 ad(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)?ad(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 ad(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 sd(){return sd=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},sd.apply(null,arguments)}function ud(t){var e=t.scene,n=t.props,r=t.state;return Kl().createElement(od,{displayable:{element:e,skipTransform:r.game.config.elements.background.allowSkipTransform,skipTransition:r.game.config.elements.background.allowSkipTransition},child:function(t){return Kl().createElement(cd,sd({},t,{scene:e,props:n}))},state:r})}function cd(t){var e=t.transformRef,n=t.transformProps,r=t.transition,o=t.state,i=t.scene,a=t.props,s=dp().ratio,u=id(Kl().useState(!1),2),c=u[0],l=u[1];function f(){c||(l(!0),i.events.emit(wl.EventTypes["event:scene.imageLoaded"]),o.logger.debug("BackgroundTransition","Image loaded",i))}var p,h="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/wcAAgAB9sWFXTkAAAAASUVORK5CYII=",d={src:h,style:Object.assign({},o.game.config.app.debug?{outline:"1px solid red"}:{})};return Kl().createElement("div",null,Kl().createElement(Hf.div,sd({layout:!0,ref:e,className:"absolute inset-0 flex items-center justify-center bg-cover bg-center overflow-hidden"},b({style:Object.assign({},s.getStyle())},n)),r?r.toElementProps().map((function(t,e){var n=b(d,a,t);return Kl().createElement("img",sd({alt:n.alt},n,{onLoad:f,src:n.src?n.src:h,className:"absolute",key:e}))})):(p=b(d,a),Kl().createElement("img",sd({key:"last",alt:p.alt},p,{onLoad:f,src:p.src||h,className:"absolute"})))))}function ld(t){return ld="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},ld(t)}function fd(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */fd=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 P(r||[]);return o(a,"_invoke",{value:O(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",h="suspendedYield",d="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"==ld(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(ld(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 pd(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 hd(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)?hd(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 hd(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 dd=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 yd(t){var e=t.scene,n=t.state,r=t.children,o=t.className,i=dp().ratio,a=pd((0,Xl.useState)((function(){return e.state.backgroundMusic})),2),s=a[0],u=a[1];return(0,Xl.useEffect)((function(){var t=[{type:"event:scene.setBackgroundMusic",listener:e.events.on(wl.EventTypes["event:scene.setBackgroundMusic"],(function(t,e){(function(t,e){return dd(this,void 0,void 0,fd().mark((function r(){var o,i;return fd().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return o=s,i=t,r.next=4,n.transitionSound(o,i,e);case 4:if(i){r.next=6;break}return r.abrupt("return");case 6:u(i);case 7:case"end":return r.stop()}}),r)})))})(t,e).then()}))},{type:"event:scene.preUnmount",listener:e.events.on(wl.EventTypes["event:scene.preUnmount"],(function(){s&&function(t,e){return dd(this,void 0,void 0,fd().mark((function r(){return fd().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,n.fadeSound(t,0,e);case 2:n.stopSound(t);case 3:case"end":return r.stop()}}),r)})))}(s,e.state.backgroundMusicFade).then()}))}];return function(){t.forEach((function(t){var n=t.type,r=t.listener;e.events.off(n,r)}))}}),[]),(0,Xl.useEffect)((function(){return e.events.emit(wl.EventTypes["event:scene.mount"]),function(){e.events.emit(wl.EventTypes["event:scene.unmount"])}}),[]),Kl().createElement("div",{className:o},Kl().createElement(ud,{scene:e,props:{width:i.state.width,height:i.state.height,src:Ts.isImageSrc(e.state.background)?Ts.srcToString(e.state.background):void 0,style:{backgroundColor:Ts.isImageColor(e.state.background)?Ts.toHex(e.state.background):void 0}},state:n}),r)}function vd(t){return vd="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},vd(t)}function md(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,gd(r.key),r)}}function gd(t){var e=function(t,e){if("object"!=vd(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=vd(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==vd(e)?e:e+""}var bd=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 k}return function(t,e,n){return e&&md(t.prototype,e),n&&md(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?Ts.srcToString(t.src.state.src):"video"===t.type?t.src:"audio"===t.type?t.src.getSrc():""}}])}();function wd(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 _d(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)?_d(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 _d(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}bd.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 Sd=(0,Xl.createContext)(null);function kd(t){var e=t.children,n=wd((0,Xl.useState)(new bd),1)[0];return Kl().createElement(Kl().Fragment,null,Kl().createElement(Sd.Provider,{value:{preloaded:n}},e))}function xd(){if(!Sd)throw new Error("usePreloaded must be used within a PreloadedProvider");return(0,Xl.useContext)(Sd)}function Ad(t){return function(t){if(Array.isArray(t))return Od(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 Od(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)?Od(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 Od(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 Ed(t){var e=t.state,n=xd().preloaded,r=e.getLastScene(),o=(0,Xl.useRef)(0);return(0,Xl.useEffect)((function(){var t,r;if("undefined"!=typeof window){window.performance&&(o.current=performance.now());var i=null===(t=e.getLastScene())||void 0===t?void 0:t.srcManager,a=(null===(r=e.getLastScene())||void 0===r?void 0:r.srcManager.future)||[],s=[].concat(Ad(i?i.src:[]),Ad(a.map((function(t){return t.src})).flat(2))),u={image:new Set,audio:new Set,video:new Set};s.forEach((function(t){t.type===_c.SrcTypes.image?u.image.add(t.src):t.type===_c.SrcTypes.audio?u.audio.add(t.src):t.type===_c.SrcTypes.video&&u.video.add(t.src)})),e.logger.debug("Preloading",u,a),n.preloaded=n.preloaded.filter((function(t){if(t.type===_c.SrcTypes.audio){var e=u[t.type].has(t.src);return e||(e=Array.from(u[t.type]).some((function(e){return n.getSrc(t)===n.getSrc(e.config.src)}))),e}if(t.type===_c.SrcTypes.image)return u[t.type].has(t.src);var r=n.getSrc(t);return u[t.type].has(r)}));var c=[];return u.image.forEach((function(t){var r=new Image;r.src=Ts.srcToString(t.state.src),r.onload=function(){e.logger.debug("Image loaded",t.state.src)},c.push(r),n.add({type:"image",src:t})})),Promise.all([]).then((function(){if(e.logger.log("Preloaded","Preloaded ".concat(u.image.size," images")),n.events.emit(bd.EventTypes["event:preloaded.ready"]),e.events.emit(Pp.EventTypes["event:state.preload.loaded"]),window.performance){var t=performance.now()-o.current;e.logger.info("Preload","Preloaded ".concat(u.image.size," images in ").concat(t,"ms"))}})),u.audio.forEach((function(t){t.getPlaying()||t.setPlaying(new(e.getHowl())({src:t.config.src,loop:t.config.loop,volume:t.config.volume,autoplay:!1,preload:!0}))})),n.events.emit(bd.EventTypes["event:preloaded.mount"]),function(){c.forEach((function(t){t.onload=null})),e.events.emit(Pp.EventTypes["event:state.preload.unmount"]),e.logger.debug("Preload unmounted")}}console.warn("Window is not supported in this environment")}),[r]),null}function Td(t){var e=t.state,n=ef().game;return(0,Xl.useEffect)((function(){if(window){var t,r,o,i=(t=function(t){n.config.player.skipKey.includes(t.key)&&n.preference.getPreference(Qp.Preferences.skip)&&e.events.emit(Pp.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\nThis component must be rendered in a browser environment")}),[]),Kl().createElement(Kl().Fragment,null)}var jd=o(33);function Pd(){return Pd=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},Pd.apply(null,arguments)}function Cd(t){var e=t.state,n=t.text,r={scale:function(t){return{width:"fit-content"}},transform:function(t){return{transform:Fa.propToCSSTransform(e,t,{translate:["left"===n.config.alignX?"0%":"right"===n.config.alignX?"-100%":void 0,"top"===n.config.alignY?"100%":"bottom"===n.config.alignY?"0%":void 0]})}}};return Kl().createElement(od,{displayable:{element:n,skipTransform:e.game.config.elements.text.allowSkipTransform,skipTransition:e.game.config.elements.text.allowSkipTransition,transformOverwrites:r},child:function(t){return Kl().createElement(Ld,Pd({},t,{text:n}))},state:e})}function Ld(t){var e=t.transformRef,n=t.transformProps,r=t.transition,o=t.text,i=dp().ratio,a={style:{width:"fit-content",whiteSpace:"nowrap",fontSize:o.state.fontSize}},s=[{}],u=ql(o.config.className);return Kl().createElement(Qf.Div,null,Kl().createElement(Qf.mDiv,Pd({tag:"text.container",color:"green",border:"dashed",layout:!0,Ref:e,className:"absolute"},b({style:{opacity:0}},n,{style:{width:"fit-content"}})),r?r.toElementProps().map((function(t,e){var n=b(a,t,{style:{transform:"scale(".concat(i.state.scale,")"),transformOrigin:"".concat(o.config.alignX," ").concat(o.config.alignY)}},s[e]||{});return Kl().createElement(Qf.Span,Pd({tag:"text.transition."+e,key:e},n,{className:u}),Kl().createElement("span",null,o.state.text))})):Kl().createElement(Qf.Div,Pd({tag:"text.transition.last",color:"green",border:"dashed",key:"last"},b(a,{style:{width:"fit-content",transform:"scale(".concat(i.state.scale,")"),transformOrigin:"".concat(o.config.alignX," ").concat(o.config.alignY)}})),Kl().createElement(Qf.Span,{className:u},o.state.text))))}function Id(){return Id=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},Id.apply(null,arguments)}function Nd(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 Rd(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)?Rd(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 Rd(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 Md(t){var e=t.props,n=t.onLoad,r=t.id,o=t.Ref,i=(0,Xl.useRef)(null),a=dp().ratio,s=Nd(Kl().useState(0),2),u=s[0],c=s[1];function l(){var t=o||i;t.current&&c(t.current.naturalWidth*a.state.scale)}return(0,Xl.useEffect)((function(){return l(),a.onUpdate(l)}),[e.src]),(0,Xl.useEffect)((function(){l()}),[e,r]),Kl().createElement("img",Id({ref:o||i},e,{onLoad:n,width:u,alt:e.alt}))}function Fd(t){return function(t){if(Array.isArray(t))return Gd(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Vd(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 Dd(){return Dd=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},Dd.apply(null,arguments)}function Bd(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)||Vd(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 Vd(t,e){if(t){if("string"==typeof t)return Gd(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)?Gd(t,e):void 0}}function Gd(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 Ud(t){var e=t.image,n=t.state,r=Bd((0,Xl.useState)(0),2),o=r[0],i=r[1],a=ef().game;(0,Xl.useEffect)((function(){i(performance.now())}),[]);var s=function(){var t=performance.now()-o,e=a.config.elements.img.slowLoadThreshold;t>e&&a.config.elements.img.slowLoadWarning&&n.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.")};return Kl().createElement(od,{displayable:{element:e,skipTransition:n.game.config.elements.img.allowSkipTransition,skipTransform:n.game.config.elements.img.allowSkipTransform,transformOverwrites:{}},child:function(t){return Kl().createElement(Wd,Dd({},t,{image:e,handleLoad:s}))},state:n})}function Wd(t){var e=t.transition,n=t.transformProps,r=t.transformRef,o=t.state,i=t.image,a=t.handleLoad,s=dp().ratio,u=(0,Xl.useRef)(null),c=Bd((0,Xl.useState)([]),2),l=c[0],f=c[1],p={src:Ts.staticImageDataToSrc(i.state.src),style:Object.assign(Object.assign({},o.game.config.app.debug?{outline:"1px solid red"}:{}),{transformOrigin:"center"})},h=[{style:{display:"block",position:"unset"}},{style:{top:"50%",left:"50%",transform:"translate(-50%, -50%)",maxWidth:"none"}}];return(0,Xl.useEffect)((function(){var t=i.events.onEvents([{type:es.EventTypes["event:wearable.create"],listener:i.events.on(es.EventTypes["event:wearable.create"],(function(t){f((function(e){return[].concat(Fd(e),[t])}))}))}]);return function(){t.cancel()}}),[]),Kl().createElement("div",null,Kl().createElement(Qf.mDiv,Dd({tag:"image.aspectScaleContainer",color:"green",border:"dashed",layout:!0,Ref:r,className:"absolute"},b({style:{opacity:0}},n,{style:{display:"inline-block",width:u.current?"".concat(u.current.naturalWidth*s.state.scale,"px"):"auto",height:u.current?"".concat(u.current.naturalHeight*s.state.scale,"px"):"auto"}})),Kl().createElement(Kl().Fragment,null,(e?e.toElementProps():[{}]).map((function(t,e){var n=b(p,t,h[e]||{});return Kl().createElement(Md,{key:e,props:Object.assign({className:"absolute"},n),id:n.src,onLoad:a,Ref:0===e?u:void 0})}))),Kl().createElement("div",{className:ql("w-full h-full top-0 left-0 absolute")},l.map((function(t){return Kl().createElement("div",{className:ql("w-full h-full relative"),key:"wearable-"+t.getId()},Kl().createElement(Ud,{image:t,state:o}))})))))}function zd(t){var e=t.state,n=t.displayable;return Kl().createElement(Kl().Fragment,null,n.map((function(t){var n;if(t instanceof sl)return Kl().createElement(Cd,{state:e,text:t,key:"text-"+t.getId()});if(t instanceof es)return Kl().createElement(Ud,{state:e,image:t,key:"image-"+t.getId()});throw new Error("Unsupported displayable type: "+((null===(n=null==t?void 0:t.constructor)||void 0===n?void 0:n.name)||t))})))}var Hd=o(556),$d=o.n(Hd);function Yd(t){var e=t.error,n=t.errorInfo;return ef().game.config.app.debug?Kl().createElement("div",{className:"text-left"},Kl().createElement("h1",null,"It is my fault, NarraLeaf-React cannot initialize the player correctly."),Kl().createElement("p",{className:"text-red-700"},"Message: ",e.message),Kl().createElement("pre",null,"Error Stack: ",null==e?void 0:e.stack),Kl().createElement("pre",null,"Component Stack: ",null==n?void 0:n.componentStack),Kl().createElement("pre",null,"Digest: ",null==n?void 0:n.digest)):Kl().createElement("div",null,Kl().createElement("h1",null,"The game cannot initialize the player correctly."),Kl().createElement("p",null,"Please contact the game developer for further assistance."))}function qd(t){return qd="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},qd(t)}function Xd(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,Kd(r.key),r)}}function Kd(t){var e=function(t,e){if("object"!=qd(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=qd(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==qd(e)?e:e+""}function Zd(t,e,n){return e=Jd(e),function(t,e){if(e&&("object"==qd(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,Qd()?Reflect.construct(e,n||[],Jd(t).constructor):e.apply(t,n))}function Qd(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Qd=function(){return!!t})()}function Jd(t){return Jd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Jd(t)}function ty(t,e){return ty=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ty(t,e)}var ey=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=Zd(this,e,arguments)).state={hasError:!1,error:null,errorInfo:null},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&&ty(t,e)}(e,t),function(t,e,n){return e&&Xd(t.prototype,e),n&&Xd(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"componentDidCatch",value:function(t,e){this.setState({error:t,errorInfo:e}),console.error(t,e)}},{key:"render",value:function(){return this.state.hasError?Kl().createElement(Yd,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}],[{key:"getDerivedStateFromError",value:function(t){return{hasError:!0,error:t,errorInfo:null}}}])}(Kl().Component);function ny(t){var e=t.containerRef,n=dp().ratio;return(0,Xl.useEffect)((function(){var t=e.current;if(t){var r=new ResizeObserver((function(){n.requestUpdate()}));return r.observe(t),function(){r.disconnect()}}}),[e.current]),null}function ry(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 oy(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)?oy(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 oy(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 iy(t,e){return t.handle(e)}function ay(t){var e=t.story,n=t.width,r=t.height,o=t.className,i=t.onReady,a=t.onEnd,s=t.children,u=ry((0,Xl.useReducer)((function(t){return t+1}),0),2)[1],c=ef().game,l=ry((0,Xl.useReducer)(iy,new Pp(c,{update:u,forceUpdate:function(){f.logger.warn("Player","force update"),(0,jd.flushSync)((function(){u()}))},next:v,dispatch:function(t){return p(t)}})),2),f=l[0],p=l[1],h=Kl().createRef(),d=c.config.elements.say.use,y=c.config.elements.menu.use;function v(){for(var t=!1;!t;){var e=c.getLiveGame().next(f);if(!e)break;if(w.isAwaitable(e)){t=!0;break}if(e instanceof P){e.nextUnlock().then((function(){v()})),t=!0;break}p(e)}f.stage.update()}(0,Xl.useEffect)((function(){return c.getLiveGame().setGameState(f).loadStory(e),function(){c.getLiveGame().setGameState(void 0)}}),[c]),(0,Xl.useEffect)((function(){var t=!1,e=Promise.resolve().then((function(){t=!0,i&&i({game:c,gameState:f,liveGame:c.getLiveGame(),storable:c.getLiveGame().getStorable()});var e=f.getLastScene(),n=[];e?n.push({type:"event:scene.mount",listener:e.events.once("event:scene.mount",(function(){f.stage.next()}))}):f.stage.next();var r=f.events.onEvents([{type:Pp.EventTypes["event:state.end"],listener:function(){a&&a({game:c,gameState:f,liveGame:c.getLiveGame(),storable:c.getLiveGame().getStorable()})}}]),o=f.events.onEvents([{type:Pp.EventTypes["event:state.player.skip"],listener:function(){c.getLiveGame().abortAwaiting(),v()}}]);return f.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()}))}}),[]),f.events.emit(Pp.EventTypes["event:state.player.flush"]);var m=n||c.config.player.width,g=r||c.config.player.height;return Kl().createElement(ey,null,Kl().createElement(Xh,null,Kl().createElement("div",{style:{width:"number"==typeof m?"".concat(m,"px"):m,height:"number"==typeof g?"".concat(g,"px"):g},className:ql(o,"__narraleaf_content-player"),ref:h},Kl().createElement(Qh,{className:ql("flex-grow overflow-auto")},Kl().createElement(ny,{containerRef:h}),Kl().createElement(bp,null,Kl().createElement(Ed,{state:f}),Kl().createElement(sy,{onLoaded:function(){f.stage.update(),e&&v()},state:f},Kl().createElement(Td,{state:f}),f.getSceneElements().map((function(t){var e=t.scene,n=t.ele;return Kl().createElement(yd,{key:"scene-"+e.getId(),state:f,scene:e},Kl().createElement(zd,{state:f,displayable:n.displayable}),n.texts.map((function(t){var e=t.action,n=t.onClick;return Kl().createElement(d,{state:f,key:"say-"+e.id,action:e,onClick:function(){n(),v()}})})),n.menus.map((function(t,e){return Kl().createElement("div",{key:"menu-"+e},Kl().createElement(y,{state:f,prompt:t.action.prompt,choices:t.action.choices,afterChoose:function(e){t.onClick(e),v()}}))})))}))),s)))))}function sy(t){var e=t.children,n=t.onLoaded,r=t.state,o=xd().preloaded,i=ry((0,Xl.useState)(!1),2),a=i[0],s=i[1];return(0,Xl.useEffect)((function(){var t=o.events.on(bd.EventTypes["event:preloaded.ready"],(function(){s(!0),n()})),e=r.events.on(Pp.EventTypes["event:state.preload.unmount"],(function(){s(!1)}));return function(){o.events.off(bd.EventTypes["event:preloaded.ready"],t),r.events.off(Pp.EventTypes["event:state.preload.unmount"],e)}}),[a]),Kl().createElement(Kl().Fragment,null,a?e:null)}function uy(t){var e=t.children,n=t.game;return Kl().createElement(Kl().Fragment,null,Kl().createElement(hp,null,Kl().createElement(tf,{game:n},Kl().createElement(kd,null,e))))}function cy(){return cy=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},cy.apply(null,arguments)}function ly(t){var e=t.alignX,n=void 0===e?"center":e,r=t.alignY,o=void 0===r?"center":r,i=t.children,a=t.width,s=t.height,u=t.className,c=dp().ratio,l="left"===n?"justify-start":"right"===n?"justify-end":"justify-center",f="top"===o?"items-start":"bottom"===o?"items-end":"items-center";return Kl().createElement(bp,{className:ql("flex absolute",l,f,u,"pointer-events-none"),style:{width:a,height:s,transform:"scale(".concat(c.state.scale,")"),transformOrigin:"".concat(n," ").concat(o),pointerEvents:"all"}},i)}ey.propTypes={children:$d().node.isRequired};var fy={Left:function(t){return Kl().createElement(ly,cy({},t,{alignX:"left",alignY:"top"}))},Center:function(t){return Kl().createElement(ly,cy({},t,{alignX:"center",alignY:"top"}))},Right:function(t){return Kl().createElement(ly,cy({},t,{alignX:"right",alignY:"top"}))}},py={Left:function(t){return Kl().createElement(ly,cy({},t,{alignX:"left",alignY:"center"}))},Center:function(t){return Kl().createElement(ly,cy({},t,{alignX:"center",alignY:"center"}))},Right:function(t){return Kl().createElement(ly,cy({},t,{alignX:"right",alignY:"center"}))}},hy={Left:function(t){return Kl().createElement(ly,cy({},t,{alignX:"left",alignY:"bottom"}))},Center:function(t){return Kl().createElement(ly,cy({},t,{alignX:"center",alignY:"bottom"}))},Right:function(t){return Kl().createElement(ly,cy({},t,{alignX:"right",alignY:"bottom"}))}};function dy(){return dy=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},dy.apply(null,arguments)}var yy=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n},vy={className:$d().string},my={children:$d().node};function gy(t,e){var n=(0,Xl.forwardRef)((function(t,n){var r=t.children,o=t.className,i=yy(t,["children","className"]);return e(Object.assign({children:r,className:o,$ref:n},i))}));return n.displayName=t,n.propTypes=Object.assign(Object.assign({},vy),my),n}var by=gy("VBox",(function(t){var e=t.children,n=t.className,r=t.$ref,o=yy(t,["children","className","$ref"]);return Kl().createElement("div",dy({ref:r,className:ql("flex flex-col",n)},o),e)})),wy=gy("HBox",(function(t){var e=t.children,n=t.className,r=t.$ref,o=yy(t,["children","className","$ref"]);return Kl().createElement("div",dy({ref:r,className:ql("flex flex-row",n)},o),e)}));function _y(t){return _y="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},_y(t)}function Sy(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,ky(r.key),r)}}function ky(t){var e=function(t,e){if("object"!=_y(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=_y(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==_y(e)?e:e+""}function xy(t,e,n){return e=Oy(e),function(t,e){if(e&&("object"==_y(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,Ay()?Reflect.construct(e,n||[],Oy(t).constructor):e.apply(t,n))}function Ay(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ay=function(){return!!t})()}function Oy(t){return Oy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Oy(t)}function Ey(t,e){return Ey=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ey(t,e)}var Ty=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=xy(this,e)).state={opacity:1},t.duration=n,t.easing=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&&Ey(t,e)}(e,t),function(t,e,n){return e&&Sy(t.prototype,e),n&&Sy(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){return this.src=t,this}},{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}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{opacity:1}},{style:{opacity:this.state.opacity,backgroundColor:Ts.isImageColor(this.src)?S(this.src):""},src:Ts.isImageSrc(this.src)?Ts.srcToString(this.src):""}]}},{key:"copy",value:function(){return new e(this.duration,this.easing).setSrc(this.src)}}])}(zc);function jy(t){return jy="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},jy(t)}function Py(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,Cy(r.key),r)}}function Cy(t){var e=function(t,e){if("object"!=jy(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=jy(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==jy(e)?e:e+""}function Ly(t,e,n){return e=Ny(e),function(t,e){if(e&&("object"==jy(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,Iy()?Reflect.construct(e,n||[],Ny(t).constructor):e.apply(t,n))}function Iy(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Iy=function(){return!!t})()}function Ny(t){return Ny=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ny(t)}function Ry(t,e){return Ry=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ry(t,e)}Ty.Frames=[0,1];var My=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=Ly(this,e)).state={opacity:0,transform:""},r.duration=o,r.direction=t,r.offset=n,r.easing=i,r.__stack=x(),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&&Ry(t,e)}(e,t),function(t,e,n){return e&&Py(t.prototype,e),n&&Py(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){return this.src=t,this}},{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)}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{opacity:1}},{style:{opacity:this.state.opacity,transform:this.state.transform,backgroundColor:Ts.isImageColor(this.src)?S(this.src):""},src:Ts.isImageSrc(this.src)?Ts.srcToString(this.src):""}]}},{key:"copy",value:function(){return new e(this.direction,this.offset,this.duration,this.easing).setSrc(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""}}}])}(zc);function Fy(t){return Fy="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},Fy(t)}function Dy(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,By(r.key),r)}}function By(t){var e=function(t,e){if("object"!=Fy(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Fy(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Fy(e)?e:e+""}function Vy(t,e,n){return e=Uy(e),function(t,e){if(e&&("object"==Fy(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,Gy()?Reflect.construct(e,n||[],Uy(t).constructor):e.apply(t,n))}function Gy(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Gy=function(){return!!t})()}function Uy(t){return Uy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Uy(t)}function Wy(t,e){return Wy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Wy(t,e)}var zy=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=Vy(this,e)).state={opacity:0},t.duration=n,t.easing=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&&Wy(t,e)}(e,t),function(t,e,n){return e&&Dy(t.prototype,e),n&&Dy(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){return this.src=t,this}},{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}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{opacity:this.state.opacity}},{style:{opacity:1-this.state.opacity,backgroundColor:Ts.isImageColor(this.src)?S(this.src):""},src:Ts.isImageSrc(this.src)?Ts.srcToString(this.src):""}]}},{key:"copy",value:function(){return new e(this.duration,this.easing).setSrc(this.src)}}])}(zc);zy.Frames=[1,0]})(),i})()));