narraleaf-react 0.0.2 → 0.0.3

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")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.NarraleafReact=e(require("react")):t.NarraleafReact=e(t.React)}(this,(t=>(()=>{var e={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%;\n}\n@media (min-width: 640px) {\n\n .container {\n max-width: 640px;\n }\n}\n@media (min-width: 768px) {\n\n .container {\n max-width: 768px;\n }\n}\n@media (min-width: 1024px) {\n\n .container {\n max-width: 1024px;\n }\n}\n@media (min-width: 1280px) {\n\n .container {\n max-width: 1280px;\n }\n}\n@media (min-width: 1536px) {\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.m-4 {\n margin: 1rem;\n}\n.mx-auto {\n margin-left: auto;\n margin-right: auto;\n}\n.mt-2 {\n margin-top: 0.5rem;\n}\n.mt-4 {\n margin-top: 1rem;\n}\n.flex {\n display: flex;\n}\n.hidden {\n display: none;\n}\n.h-\\[calc\\(33\\%-40px\\)\\] {\n height: calc(33% - 40px);\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.max-w-\\[80\\%\\] {\n max-width: 80%;\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-center {\n align-items: center;\n}\n.justify-center {\n justify-content: center;\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\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.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-center {\n text-align: center;\n}\n.text-black {\n --tw-text-opacity: 1;\n color: rgb(0 0 0 / 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.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;\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}\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%;\n}\n@media (min-width: 640px) {\n\n .container {\n max-width: 640px;\n }\n}\n@media (min-width: 768px) {\n\n .container {\n max-width: 768px;\n }\n}\n@media (min-width: 1024px) {\n\n .container {\n max-width: 1024px;\n }\n}\n@media (min-width: 1280px) {\n\n .container {\n max-width: 1280px;\n }\n}\n@media (min-width: 1536px) {\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.m-4 {\n margin: 1rem;\n}\n.mx-auto {\n margin-left: auto;\n margin-right: auto;\n}\n.mt-2 {\n margin-top: 0.5rem;\n}\n.mt-4 {\n margin-top: 1rem;\n}\n.flex {\n display: flex;\n}\n.hidden {\n display: none;\n}\n.h-\\[calc\\(33\\%-40px\\)\\] {\n height: calc(33% - 40px);\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.max-w-\\[80\\%\\] {\n max-width: 80%;\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-center {\n align-items: center;\n}\n.justify-center {\n justify-content: center;\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\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.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-center {\n text-align: center;\n}\n.text-black {\n --tw-text-opacity: 1;\n color: rgb(0 0 0 / 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.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;\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
@@ -7,7 +7,7 @@
7
7
  * goldfirestudios.com
8
8
  *
9
9
  * MIT License
10
- */!function(){"use strict";var o=function(){this.init()};o.prototype={init:function(){var t=this||i;return t._counter=1e3,t._html5AudioPool=[],t.html5PoolSize=10,t._codecs={},t._howls=[],t._muted=!1,t._volume=1,t._canPlayEvent="canplaythrough",t._navigator="undefined"!=typeof window&&window.navigator?window.navigator:null,t.masterGain=null,t.noAudio=!1,t.usingWebAudio=!0,t.autoSuspend=!0,t.ctx=null,t.autoUnlock=!0,t._setup(),t},volume:function(t){var e=this||i;if(t=parseFloat(t),e.ctx||p(),void 0!==t&&t>=0&&t<=1){if(e._volume=t,e._muted)return e;e.usingWebAudio&&e.masterGain.gain.setValueAtTime(t,i.ctx.currentTime);for(var n=0;n<e._howls.length;n++)if(!e._howls[n]._webAudio)for(var r=e._howls[n]._getSoundIds(),o=0;o<r.length;o++){var a=e._howls[n]._soundById(r[o]);a&&a._node&&(a._node.volume=a._volume*t)}return e}return e._volume},mute:function(t){var e=this||i;e.ctx||p(),e._muted=t,e.usingWebAudio&&e.masterGain.gain.setValueAtTime(t?0:e._volume,i.ctx.currentTime);for(var n=0;n<e._howls.length;n++)if(!e._howls[n]._webAudio)for(var r=e._howls[n]._getSoundIds(),o=0;o<r.length;o++){var a=e._howls[n]._soundById(r[o]);a&&a._node&&(a._node.muted=!!t||a._muted)}return e},stop:function(){for(var t=this||i,e=0;e<t._howls.length;e++)t._howls[e].stop();return t},unload:function(){for(var t=this||i,e=t._howls.length-1;e>=0;e--)t._howls[e].unload();return t.usingWebAudio&&t.ctx&&void 0!==t.ctx.close&&(t.ctx.close(),t.ctx=null,p()),t},codecs:function(t){return(this||i)._codecs[t.replace(/^x-/,"")]},_setup:function(){var t=this||i;if(t.state=t.ctx&&t.ctx.state||"suspended",t._autoSuspend(),!t.usingWebAudio)if("undefined"!=typeof Audio)try{void 0===(new Audio).oncanplaythrough&&(t._canPlayEvent="canplay")}catch(e){t.noAudio=!0}else t.noAudio=!0;try{(new Audio).muted&&(t.noAudio=!0)}catch(t){}return t.noAudio||t._setupCodecs(),t},_setupCodecs:function(){var t=this||i,e=null;try{e="undefined"!=typeof Audio?new Audio:null}catch(e){return t}if(!e||"function"!=typeof e.canPlayType)return t;var n=e.canPlayType("audio/mpeg;").replace(/^no$/,""),r=t._navigator?t._navigator.userAgent:"",o=r.match(/OPR\/(\d+)/g),a=o&&parseInt(o[0].split("/")[1],10)<33,s=-1!==r.indexOf("Safari")&&-1===r.indexOf("Chrome"),u=r.match(/Version\/(.*?) /),c=s&&u&&parseInt(u[1],10)<15;return t._codecs={mp3:!(a||!n&&!e.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!n,opus:!!e.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(e.canPlayType('audio/wav; codecs="1"')||e.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!e.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!e.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(e.canPlayType("audio/x-m4a;")||e.canPlayType("audio/m4a;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(e.canPlayType("audio/x-m4b;")||e.canPlayType("audio/m4b;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(e.canPlayType("audio/x-mp4;")||e.canPlayType("audio/mp4;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(c||!e.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(c||!e.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!e.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(e.canPlayType("audio/x-flac;")||e.canPlayType("audio/flac;")).replace(/^no$/,"")},t},_unlockAudio:function(){var t=this||i;if(!t._audioUnlocked&&t.ctx){t._audioUnlocked=!1,t.autoUnlock=!1,t._mobileUnloaded||44100===t.ctx.sampleRate||(t._mobileUnloaded=!0,t.unload()),t._scratchBuffer=t.ctx.createBuffer(1,1,22050);var e=function(n){for(;t._html5AudioPool.length<t.html5PoolSize;)try{var r=new Audio;r._unlocked=!0,t._releaseHtml5Audio(r)}catch(n){t.noAudio=!0;break}for(var o=0;o<t._howls.length;o++)if(!t._howls[o]._webAudio)for(var i=t._howls[o]._getSoundIds(),a=0;a<i.length;a++){var s=t._howls[o]._soundById(i[a]);s&&s._node&&!s._node._unlocked&&(s._node._unlocked=!0,s._node.load())}t._autoResume();var u=t.ctx.createBufferSource();u.buffer=t._scratchBuffer,u.connect(t.ctx.destination),void 0===u.start?u.noteOn(0):u.start(0),"function"==typeof t.ctx.resume&&t.ctx.resume(),u.onended=function(){u.disconnect(0),t._audioUnlocked=!0,document.removeEventListener("touchstart",e,!0),document.removeEventListener("touchend",e,!0),document.removeEventListener("click",e,!0),document.removeEventListener("keydown",e,!0);for(var n=0;n<t._howls.length;n++)t._howls[n]._emit("unlock")}};return document.addEventListener("touchstart",e,!0),document.addEventListener("touchend",e,!0),document.addEventListener("click",e,!0),document.addEventListener("keydown",e,!0),t}},_obtainHtml5Audio:function(){var t=this||i;if(t._html5AudioPool.length)return t._html5AudioPool.pop();var e=(new Audio).play();return e&&"undefined"!=typeof Promise&&(e instanceof Promise||"function"==typeof e.then)&&e.catch((function(){console.warn("HTML5 Audio pool exhausted, returning potentially locked audio object.")})),new Audio},_releaseHtml5Audio:function(t){var e=this||i;return t._unlocked&&e._html5AudioPool.push(t),e},_autoSuspend:function(){var t=this;if(t.autoSuspend&&t.ctx&&void 0!==t.ctx.suspend&&i.usingWebAudio){for(var e=0;e<t._howls.length;e++)if(t._howls[e]._webAudio)for(var n=0;n<t._howls[e]._sounds.length;n++)if(!t._howls[e]._sounds[n]._paused)return t;return t._suspendTimer&&clearTimeout(t._suspendTimer),t._suspendTimer=setTimeout((function(){if(t.autoSuspend){t._suspendTimer=null,t.state="suspending";var e=function(){t.state="suspended",t._resumeAfterSuspend&&(delete t._resumeAfterSuspend,t._autoResume())};t.ctx.suspend().then(e,e)}}),3e4),t}},_autoResume:function(){var t=this;if(t.ctx&&void 0!==t.ctx.resume&&i.usingWebAudio)return"running"===t.state&&"interrupted"!==t.ctx.state&&t._suspendTimer?(clearTimeout(t._suspendTimer),t._suspendTimer=null):"suspended"===t.state||"running"===t.state&&"interrupted"===t.ctx.state?(t.ctx.resume().then((function(){t.state="running";for(var e=0;e<t._howls.length;e++)t._howls[e]._emit("resume")})),t._suspendTimer&&(clearTimeout(t._suspendTimer),t._suspendTimer=null)):"suspending"===t.state&&(t._resumeAfterSuspend=!0),t}};var i=new o,a=function(t){t.src&&0!==t.src.length?this.init(t):console.error("An array of source files must be passed with any new Howl.")};a.prototype={init:function(t){var e=this;return i.ctx||p(),e._autoplay=t.autoplay||!1,e._format="string"!=typeof t.format?t.format:[t.format],e._html5=t.html5||!1,e._muted=t.mute||!1,e._loop=t.loop||!1,e._pool=t.pool||5,e._preload="boolean"!=typeof t.preload&&"metadata"!==t.preload||t.preload,e._rate=t.rate||1,e._sprite=t.sprite||{},e._src="string"!=typeof t.src?t.src:[t.src],e._volume=void 0!==t.volume?t.volume:1,e._xhr={method:t.xhr&&t.xhr.method?t.xhr.method:"GET",headers:t.xhr&&t.xhr.headers?t.xhr.headers:null,withCredentials:!(!t.xhr||!t.xhr.withCredentials)&&t.xhr.withCredentials},e._duration=0,e._state="unloaded",e._sounds=[],e._endTimers={},e._queue=[],e._playLock=!1,e._onend=t.onend?[{fn:t.onend}]:[],e._onfade=t.onfade?[{fn:t.onfade}]:[],e._onload=t.onload?[{fn:t.onload}]:[],e._onloaderror=t.onloaderror?[{fn:t.onloaderror}]:[],e._onplayerror=t.onplayerror?[{fn:t.onplayerror}]:[],e._onpause=t.onpause?[{fn:t.onpause}]:[],e._onplay=t.onplay?[{fn:t.onplay}]:[],e._onstop=t.onstop?[{fn:t.onstop}]:[],e._onmute=t.onmute?[{fn:t.onmute}]:[],e._onvolume=t.onvolume?[{fn:t.onvolume}]:[],e._onrate=t.onrate?[{fn:t.onrate}]:[],e._onseek=t.onseek?[{fn:t.onseek}]:[],e._onunlock=t.onunlock?[{fn:t.onunlock}]:[],e._onresume=[],e._webAudio=i.usingWebAudio&&!e._html5,void 0!==i.ctx&&i.ctx&&i.autoUnlock&&i._unlockAudio(),i._howls.push(e),e._autoplay&&e._queue.push({event:"play",action:function(){e.play()}}),e._preload&&"none"!==e._preload&&e.load(),e},load:function(){var t=this,e=null;if(i.noAudio)t._emit("loaderror",null,"No audio support.");else{"string"==typeof t._src&&(t._src=[t._src]);for(var n=0;n<t._src.length;n++){var r,o;if(t._format&&t._format[n])r=t._format[n];else{if("string"!=typeof(o=t._src[n])){t._emit("loaderror",null,"Non-string found in selected audio sources - ignoring.");continue}(r=/^data:audio\/([^;,]+);/i.exec(o))||(r=/\.([^.]+)$/.exec(o.split("?",1)[0])),r&&(r=r[1].toLowerCase())}if(r||console.warn('No file extension was found. Consider using the "format" property or specify an extension.'),r&&i.codecs(r)){e=t._src[n];break}}if(e)return t._src=e,t._state="loading","https:"===window.location.protocol&&"http:"===e.slice(0,5)&&(t._html5=!0,t._webAudio=!1),new s(t),t._webAudio&&c(t),t;t._emit("loaderror",null,"No codec support for selected audio sources.")}},play:function(t,e){var n=this,r=null;if("number"==typeof t)r=t,t=null;else{if("string"==typeof t&&"loaded"===n._state&&!n._sprite[t])return null;if(void 0===t&&(t="__default",!n._playLock)){for(var o=0,a=0;a<n._sounds.length;a++)n._sounds[a]._paused&&!n._sounds[a]._ended&&(o++,r=n._sounds[a]._id);1===o?t=null:r=null}}var s=r?n._soundById(r):n._inactiveSound();if(!s)return null;if(r&&!t&&(t=s._sprite||"__default"),"loaded"!==n._state){s._sprite=t,s._ended=!1;var u=s._id;return n._queue.push({event:"play",action:function(){n.play(u)}}),u}if(r&&!s._paused)return e||n._loadQueue("play"),s._id;n._webAudio&&i._autoResume();var c=Math.max(0,s._seek>0?s._seek:n._sprite[t][0]/1e3),l=Math.max(0,(n._sprite[t][0]+n._sprite[t][1])/1e3-c),f=1e3*l/Math.abs(s._rate),d=n._sprite[t][0]/1e3,p=(n._sprite[t][0]+n._sprite[t][1])/1e3;s._sprite=t,s._ended=!1;var h=function(){s._paused=!1,s._seek=c,s._start=d,s._stop=p,s._loop=!(!s._loop&&!n._sprite[t][2])};if(!(c>=p)){var y=s._node;if(n._webAudio){var v=function(){n._playLock=!1,h(),n._refreshBuffer(s);var t=s._muted||n._muted?0:s._volume;y.gain.setValueAtTime(t,i.ctx.currentTime),s._playStart=i.ctx.currentTime,void 0===y.bufferSource.start?s._loop?y.bufferSource.noteGrainOn(0,c,86400):y.bufferSource.noteGrainOn(0,c,l):s._loop?y.bufferSource.start(0,c,86400):y.bufferSource.start(0,c,l),f!==1/0&&(n._endTimers[s._id]=setTimeout(n._ended.bind(n,s),f)),e||setTimeout((function(){n._emit("play",s._id),n._loadQueue()}),0)};"running"===i.state&&"interrupted"!==i.ctx.state?v():(n._playLock=!0,n.once("resume",v),n._clearTimer(s._id))}else{var m=function(){y.currentTime=c,y.muted=s._muted||n._muted||i._muted||y.muted,y.volume=s._volume*i.volume(),y.playbackRate=s._rate;try{var r=y.play();if(r&&"undefined"!=typeof Promise&&(r instanceof Promise||"function"==typeof r.then)?(n._playLock=!0,h(),r.then((function(){n._playLock=!1,y._unlocked=!0,e?n._loadQueue():n._emit("play",s._id)})).catch((function(){n._playLock=!1,n._emit("playerror",s._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),s._ended=!0,s._paused=!0}))):e||(n._playLock=!1,h(),n._emit("play",s._id)),y.playbackRate=s._rate,y.paused)return void n._emit("playerror",s._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");"__default"!==t||s._loop?n._endTimers[s._id]=setTimeout(n._ended.bind(n,s),f):(n._endTimers[s._id]=function(){n._ended(s),y.removeEventListener("ended",n._endTimers[s._id],!1)},y.addEventListener("ended",n._endTimers[s._id],!1))}catch(t){n._emit("playerror",s._id,t)}};"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===y.src&&(y.src=n._src,y.load());var g=window&&window.ejecta||!y.readyState&&i._navigator.isCocoonJS;if(y.readyState>=3||g)m();else{n._playLock=!0,n._state="loading";var b=function(){n._state="loaded",m(),y.removeEventListener(i._canPlayEvent,b,!1)};y.addEventListener(i._canPlayEvent,b,!1),n._clearTimer(s._id)}}return s._id}n._ended(s)},pause:function(t){var e=this;if("loaded"!==e._state||e._playLock)return e._queue.push({event:"pause",action:function(){e.pause(t)}}),e;for(var n=e._getSoundIds(t),r=0;r<n.length;r++){e._clearTimer(n[r]);var o=e._soundById(n[r]);if(o&&!o._paused&&(o._seek=e.seek(n[r]),o._rateSeek=0,o._paused=!0,e._stopFade(n[r]),o._node))if(e._webAudio){if(!o._node.bufferSource)continue;void 0===o._node.bufferSource.stop?o._node.bufferSource.noteOff(0):o._node.bufferSource.stop(0),e._cleanBuffer(o._node)}else isNaN(o._node.duration)&&o._node.duration!==1/0||o._node.pause();arguments[1]||e._emit("pause",o?o._id:null)}return e},stop:function(t,e){var n=this;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"stop",action:function(){n.stop(t)}}),n;for(var r=n._getSoundIds(t),o=0;o<r.length;o++){n._clearTimer(r[o]);var i=n._soundById(r[o]);i&&(i._seek=i._start||0,i._rateSeek=0,i._paused=!0,i._ended=!0,n._stopFade(r[o]),i._node&&(n._webAudio?i._node.bufferSource&&(void 0===i._node.bufferSource.stop?i._node.bufferSource.noteOff(0):i._node.bufferSource.stop(0),n._cleanBuffer(i._node)):isNaN(i._node.duration)&&i._node.duration!==1/0||(i._node.currentTime=i._start||0,i._node.pause(),i._node.duration===1/0&&n._clearSound(i._node))),e||n._emit("stop",i._id))}return n},mute:function(t,e){var n=this;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"mute",action:function(){n.mute(t,e)}}),n;if(void 0===e){if("boolean"!=typeof t)return n._muted;n._muted=t}for(var r=n._getSoundIds(e),o=0;o<r.length;o++){var a=n._soundById(r[o]);a&&(a._muted=t,a._interval&&n._stopFade(a._id),n._webAudio&&a._node?a._node.gain.setValueAtTime(t?0:a._volume,i.ctx.currentTime):a._node&&(a._node.muted=!!i._muted||t),n._emit("mute",a._id))}return n},volume:function(){var t,e,n,r=this,o=arguments;if(0===o.length)return r._volume;if(1===o.length||2===o.length&&void 0===o[1]?r._getSoundIds().indexOf(o[0])>=0?e=parseInt(o[0],10):t=parseFloat(o[0]):o.length>=2&&(t=parseFloat(o[0]),e=parseInt(o[1],10)),!(void 0!==t&&t>=0&&t<=1))return(n=e?r._soundById(e):r._sounds[0])?n._volume:0;if("loaded"!==r._state||r._playLock)return r._queue.push({event:"volume",action:function(){r.volume.apply(r,o)}}),r;void 0===e&&(r._volume=t),e=r._getSoundIds(e);for(var a=0;a<e.length;a++)(n=r._soundById(e[a]))&&(n._volume=t,o[2]||r._stopFade(e[a]),r._webAudio&&n._node&&!n._muted?n._node.gain.setValueAtTime(t,i.ctx.currentTime):n._node&&!n._muted&&(n._node.volume=t*i.volume()),r._emit("volume",n._id));return r},fade:function(t,e,n,r){var o=this;if("loaded"!==o._state||o._playLock)return o._queue.push({event:"fade",action:function(){o.fade(t,e,n,r)}}),o;t=Math.min(Math.max(0,parseFloat(t)),1),e=Math.min(Math.max(0,parseFloat(e)),1),n=parseFloat(n),o.volume(t,r);for(var a=o._getSoundIds(r),s=0;s<a.length;s++){var u=o._soundById(a[s]);if(u){if(r||o._stopFade(a[s]),o._webAudio&&!u._muted){var c=i.ctx.currentTime,l=c+n/1e3;u._volume=t,u._node.gain.setValueAtTime(t,c),u._node.gain.linearRampToValueAtTime(e,l)}o._startFadeInterval(u,t,e,n,a[s],void 0===r)}}return o},_startFadeInterval:function(t,e,n,r,o,i){var a=this,s=e,u=n-e,c=Math.abs(u/.01),l=Math.max(4,c>0?r/c:r),f=Date.now();t._fadeTo=n,t._interval=setInterval((function(){var o=(Date.now()-f)/r;f=Date.now(),s+=u*o,s=Math.round(100*s)/100,s=u<0?Math.max(n,s):Math.min(n,s),a._webAudio?t._volume=s:a.volume(s,t._id,!0),i&&(a._volume=s),(n<e&&s<=n||n>e&&s>=n)&&(clearInterval(t._interval),t._interval=null,t._fadeTo=null,a.volume(n,t._id),a._emit("fade",t._id))}),l)},_stopFade:function(t){var e=this,n=e._soundById(t);return n&&n._interval&&(e._webAudio&&n._node.gain.cancelScheduledValues(i.ctx.currentTime),clearInterval(n._interval),n._interval=null,e.volume(n._fadeTo,t),n._fadeTo=null,e._emit("fade",t)),e},loop:function(){var t,e,n,r=this,o=arguments;if(0===o.length)return r._loop;if(1===o.length){if("boolean"!=typeof o[0])return!!(n=r._soundById(parseInt(o[0],10)))&&n._loop;t=o[0],r._loop=t}else 2===o.length&&(t=o[0],e=parseInt(o[1],10));for(var i=r._getSoundIds(e),a=0;a<i.length;a++)(n=r._soundById(i[a]))&&(n._loop=t,r._webAudio&&n._node&&n._node.bufferSource&&(n._node.bufferSource.loop=t,t&&(n._node.bufferSource.loopStart=n._start||0,n._node.bufferSource.loopEnd=n._stop,r.playing(i[a])&&(r.pause(i[a],!0),r.play(i[a],!0)))));return r},rate:function(){var t,e,n,r=this,o=arguments;if(0===o.length)e=r._sounds[0]._id;else if(1===o.length){r._getSoundIds().indexOf(o[0])>=0?e=parseInt(o[0],10):t=parseFloat(o[0])}else 2===o.length&&(t=parseFloat(o[0]),e=parseInt(o[1],10));if("number"!=typeof t)return(n=r._soundById(e))?n._rate:r._rate;if("loaded"!==r._state||r._playLock)return r._queue.push({event:"rate",action:function(){r.rate.apply(r,o)}}),r;void 0===e&&(r._rate=t),e=r._getSoundIds(e);for(var a=0;a<e.length;a++)if(n=r._soundById(e[a])){r.playing(e[a])&&(n._rateSeek=r.seek(e[a]),n._playStart=r._webAudio?i.ctx.currentTime:n._playStart),n._rate=t,r._webAudio&&n._node&&n._node.bufferSource?n._node.bufferSource.playbackRate.setValueAtTime(t,i.ctx.currentTime):n._node&&(n._node.playbackRate=t);var s=r.seek(e[a]),u=1e3*((r._sprite[n._sprite][0]+r._sprite[n._sprite][1])/1e3-s)/Math.abs(n._rate);!r._endTimers[e[a]]&&n._paused||(r._clearTimer(e[a]),r._endTimers[e[a]]=setTimeout(r._ended.bind(r,n),u)),r._emit("rate",n._id)}return r},seek:function(){var t,e,n=this,r=arguments;if(0===r.length)n._sounds.length&&(e=n._sounds[0]._id);else if(1===r.length){n._getSoundIds().indexOf(r[0])>=0?e=parseInt(r[0],10):n._sounds.length&&(e=n._sounds[0]._id,t=parseFloat(r[0]))}else 2===r.length&&(t=parseFloat(r[0]),e=parseInt(r[1],10));if(void 0===e)return 0;if("number"==typeof t&&("loaded"!==n._state||n._playLock))return n._queue.push({event:"seek",action:function(){n.seek.apply(n,r)}}),n;var o=n._soundById(e);if(o){if(!("number"==typeof t&&t>=0)){if(n._webAudio){var a=n.playing(e)?i.ctx.currentTime-o._playStart:0,s=o._rateSeek?o._rateSeek-o._seek:0;return o._seek+(s+a*Math.abs(o._rate))}return o._node.currentTime}var u=n.playing(e);u&&n.pause(e,!0),o._seek=t,o._ended=!1,n._clearTimer(e),n._webAudio||!o._node||isNaN(o._node.duration)||(o._node.currentTime=t);var c=function(){u&&n.play(e,!0),n._emit("seek",e)};if(u&&!n._webAudio){var l=function(){n._playLock?setTimeout(l,0):c()};setTimeout(l,0)}else c()}return n},playing:function(t){var e=this;if("number"==typeof t){var n=e._soundById(t);return!!n&&!n._paused}for(var r=0;r<e._sounds.length;r++)if(!e._sounds[r]._paused)return!0;return!1},duration:function(t){var e=this,n=e._duration,r=e._soundById(t);return r&&(n=e._sprite[r._sprite][1]/1e3),n},state:function(){return this._state},unload:function(){for(var t=this,e=t._sounds,n=0;n<e.length;n++)e[n]._paused||t.stop(e[n]._id),t._webAudio||(t._clearSound(e[n]._node),e[n]._node.removeEventListener("error",e[n]._errorFn,!1),e[n]._node.removeEventListener(i._canPlayEvent,e[n]._loadFn,!1),e[n]._node.removeEventListener("ended",e[n]._endFn,!1),i._releaseHtml5Audio(e[n]._node)),delete e[n]._node,t._clearTimer(e[n]._id);var r=i._howls.indexOf(t);r>=0&&i._howls.splice(r,1);var o=!0;for(n=0;n<i._howls.length;n++)if(i._howls[n]._src===t._src||t._src.indexOf(i._howls[n]._src)>=0){o=!1;break}return u&&o&&delete u[t._src],i.noAudio=!1,t._state="unloaded",t._sounds=[],t=null,null},on:function(t,e,n,r){var o=this["_on"+t];return"function"==typeof e&&o.push(r?{id:n,fn:e,once:r}:{id:n,fn:e}),this},off:function(t,e,n){var r=this,o=r["_on"+t],i=0;if("number"==typeof e&&(n=e,e=null),e||n)for(i=0;i<o.length;i++){var a=n===o[i].id;if(e===o[i].fn&&a||!e&&a){o.splice(i,1);break}}else if(t)r["_on"+t]=[];else{var s=Object.keys(r);for(i=0;i<s.length;i++)0===s[i].indexOf("_on")&&Array.isArray(r[s[i]])&&(r[s[i]]=[])}return r},once:function(t,e,n){return this.on(t,e,n,1),this},_emit:function(t,e,n){for(var r=this,o=r["_on"+t],i=o.length-1;i>=0;i--)o[i].id&&o[i].id!==e&&"load"!==t||(setTimeout(function(t){t.call(this,e,n)}.bind(r,o[i].fn),0),o[i].once&&r.off(t,o[i].fn,o[i].id));return r._loadQueue(t),r},_loadQueue:function(t){var e=this;if(e._queue.length>0){var n=e._queue[0];n.event===t&&(e._queue.shift(),e._loadQueue()),t||n.action()}return e},_ended:function(t){var e=this,n=t._sprite;if(!e._webAudio&&t._node&&!t._node.paused&&!t._node.ended&&t._node.currentTime<t._stop)return setTimeout(e._ended.bind(e,t),100),e;var r=!(!t._loop&&!e._sprite[n][2]);if(e._emit("end",t._id),!e._webAudio&&r&&e.stop(t._id,!0).play(t._id),e._webAudio&&r){e._emit("play",t._id),t._seek=t._start||0,t._rateSeek=0,t._playStart=i.ctx.currentTime;var o=1e3*(t._stop-t._start)/Math.abs(t._rate);e._endTimers[t._id]=setTimeout(e._ended.bind(e,t),o)}return e._webAudio&&!r&&(t._paused=!0,t._ended=!0,t._seek=t._start||0,t._rateSeek=0,e._clearTimer(t._id),e._cleanBuffer(t._node),i._autoSuspend()),e._webAudio||r||e.stop(t._id,!0),e},_clearTimer:function(t){var e=this;if(e._endTimers[t]){if("function"!=typeof e._endTimers[t])clearTimeout(e._endTimers[t]);else{var n=e._soundById(t);n&&n._node&&n._node.removeEventListener("ended",e._endTimers[t],!1)}delete e._endTimers[t]}return e},_soundById:function(t){for(var e=this,n=0;n<e._sounds.length;n++)if(t===e._sounds[n]._id)return e._sounds[n];return null},_inactiveSound:function(){var t=this;t._drain();for(var e=0;e<t._sounds.length;e++)if(t._sounds[e]._ended)return t._sounds[e].reset();return new s(t)},_drain:function(){var t=this,e=t._pool,n=0,r=0;if(!(t._sounds.length<e)){for(r=0;r<t._sounds.length;r++)t._sounds[r]._ended&&n++;for(r=t._sounds.length-1;r>=0;r--){if(n<=e)return;t._sounds[r]._ended&&(t._webAudio&&t._sounds[r]._node&&t._sounds[r]._node.disconnect(0),t._sounds.splice(r,1),n--)}}},_getSoundIds:function(t){if(void 0===t){for(var e=[],n=0;n<this._sounds.length;n++)e.push(this._sounds[n]._id);return e}return[t]},_refreshBuffer:function(t){return t._node.bufferSource=i.ctx.createBufferSource(),t._node.bufferSource.buffer=u[this._src],t._panner?t._node.bufferSource.connect(t._panner):t._node.bufferSource.connect(t._node),t._node.bufferSource.loop=t._loop,t._loop&&(t._node.bufferSource.loopStart=t._start||0,t._node.bufferSource.loopEnd=t._stop||0),t._node.bufferSource.playbackRate.setValueAtTime(t._rate,i.ctx.currentTime),this},_cleanBuffer:function(t){var e=i._navigator&&i._navigator.vendor.indexOf("Apple")>=0;if(!t.bufferSource)return this;if(i._scratchBuffer&&t.bufferSource&&(t.bufferSource.onended=null,t.bufferSource.disconnect(0),e))try{t.bufferSource.buffer=i._scratchBuffer}catch(t){}return t.bufferSource=null,this},_clearSound:function(t){/MSIE |Trident\//.test(i._navigator&&i._navigator.userAgent)||(t.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var s=function(t){this._parent=t,this.init()};s.prototype={init:function(){var t=this,e=t._parent;return t._muted=e._muted,t._loop=e._loop,t._volume=e._volume,t._rate=e._rate,t._seek=0,t._paused=!0,t._ended=!0,t._sprite="__default",t._id=++i._counter,e._sounds.push(t),t.create(),t},create:function(){var t=this,e=t._parent,n=i._muted||t._muted||t._parent._muted?0:t._volume;return e._webAudio?(t._node=void 0===i.ctx.createGain?i.ctx.createGainNode():i.ctx.createGain(),t._node.gain.setValueAtTime(n,i.ctx.currentTime),t._node.paused=!0,t._node.connect(i.masterGain)):i.noAudio||(t._node=i._obtainHtml5Audio(),t._errorFn=t._errorListener.bind(t),t._node.addEventListener("error",t._errorFn,!1),t._loadFn=t._loadListener.bind(t),t._node.addEventListener(i._canPlayEvent,t._loadFn,!1),t._endFn=t._endListener.bind(t),t._node.addEventListener("ended",t._endFn,!1),t._node.src=e._src,t._node.preload=!0===e._preload?"auto":e._preload,t._node.volume=n*i.volume(),t._node.load()),t},reset:function(){var t=this,e=t._parent;return t._muted=e._muted,t._loop=e._loop,t._volume=e._volume,t._rate=e._rate,t._seek=0,t._rateSeek=0,t._paused=!0,t._ended=!0,t._sprite="__default",t._id=++i._counter,t},_errorListener:function(){var t=this;t._parent._emit("loaderror",t._id,t._node.error?t._node.error.code:0),t._node.removeEventListener("error",t._errorFn,!1)},_loadListener:function(){var t=this,e=t._parent;e._duration=Math.ceil(10*t._node.duration)/10,0===Object.keys(e._sprite).length&&(e._sprite={__default:[0,1e3*e._duration]}),"loaded"!==e._state&&(e._state="loaded",e._emit("load"),e._loadQueue()),t._node.removeEventListener(i._canPlayEvent,t._loadFn,!1)},_endListener:function(){var t=this,e=t._parent;e._duration===1/0&&(e._duration=Math.ceil(10*t._node.duration)/10,e._sprite.__default[1]===1/0&&(e._sprite.__default[1]=1e3*e._duration),e._ended(t)),t._node.removeEventListener("ended",t._endFn,!1)}};var u={},c=function(t){var e=t._src;if(u[e])return t._duration=u[e].duration,void d(t);if(/^data:[^;]+;base64,/.test(e)){for(var n=atob(e.split(",")[1]),r=new Uint8Array(n.length),o=0;o<n.length;++o)r[o]=n.charCodeAt(o);f(r.buffer,t)}else{var i=new XMLHttpRequest;i.open(t._xhr.method,e,!0),i.withCredentials=t._xhr.withCredentials,i.responseType="arraybuffer",t._xhr.headers&&Object.keys(t._xhr.headers).forEach((function(e){i.setRequestHeader(e,t._xhr.headers[e])})),i.onload=function(){var e=(i.status+"")[0];"0"===e||"2"===e||"3"===e?f(i.response,t):t._emit("loaderror",null,"Failed loading audio file with status: "+i.status+".")},i.onerror=function(){t._webAudio&&(t._html5=!0,t._webAudio=!1,t._sounds=[],delete u[e],t.load())},l(i)}},l=function(t){try{t.send()}catch(e){t.onerror()}},f=function(t,e){var n=function(){e._emit("loaderror",null,"Decoding audio data failed.")},r=function(t){t&&e._sounds.length>0?(u[e._src]=t,d(e,t)):n()};"undefined"!=typeof Promise&&1===i.ctx.decodeAudioData.length?i.ctx.decodeAudioData(t).then(r).catch(n):i.ctx.decodeAudioData(t,r,n)},d=function(t,e){e&&!t._duration&&(t._duration=e.duration),0===Object.keys(t._sprite).length&&(t._sprite={__default:[0,1e3*t._duration]}),"loaded"!==t._state&&(t._state="loaded",t._emit("load"),t._loadQueue())},p=function(){if(i.usingWebAudio){try{"undefined"!=typeof AudioContext?i.ctx=new AudioContext:"undefined"!=typeof webkitAudioContext?i.ctx=new webkitAudioContext:i.usingWebAudio=!1}catch(t){i.usingWebAudio=!1}i.ctx||(i.usingWebAudio=!1);var t=/iP(hone|od|ad)/.test(i._navigator&&i._navigator.platform),e=i._navigator&&i._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),n=e?parseInt(e[1],10):null;if(t&&n&&n<9){var r=/safari/.test(i._navigator&&i._navigator.userAgent.toLowerCase());i._navigator&&!r&&(i.usingWebAudio=!1)}i.usingWebAudio&&(i.masterGain=void 0===i.ctx.createGain?i.ctx.createGainNode():i.ctx.createGain(),i.masterGain.gain.setValueAtTime(i._muted?0:i._volume,i.ctx.currentTime),i.masterGain.connect(i.ctx.destination)),i._setup()}};void 0===(r=function(){return{Howler:i,Howl:a}}.apply(e,[]))||(t.exports=r),e.Howler=i,e.Howl=a,void 0!==n.g?(n.g.HowlerGlobal=o,n.g.Howler=i,n.g.Howl=a,n.g.Sound=s):"undefined"!=typeof window&&(window.HowlerGlobal=o,window.Howler=i,window.Howl=a,window.Sound=s)}(),
10
+ */!function(){"use strict";var o=function(){this.init()};o.prototype={init:function(){var t=this||i;return t._counter=1e3,t._html5AudioPool=[],t.html5PoolSize=10,t._codecs={},t._howls=[],t._muted=!1,t._volume=1,t._canPlayEvent="canplaythrough",t._navigator="undefined"!=typeof window&&window.navigator?window.navigator:null,t.masterGain=null,t.noAudio=!1,t.usingWebAudio=!0,t.autoSuspend=!0,t.ctx=null,t.autoUnlock=!0,t._setup(),t},volume:function(t){var e=this||i;if(t=parseFloat(t),e.ctx||d(),void 0!==t&&t>=0&&t<=1){if(e._volume=t,e._muted)return e;e.usingWebAudio&&e.masterGain.gain.setValueAtTime(t,i.ctx.currentTime);for(var n=0;n<e._howls.length;n++)if(!e._howls[n]._webAudio)for(var r=e._howls[n]._getSoundIds(),o=0;o<r.length;o++){var a=e._howls[n]._soundById(r[o]);a&&a._node&&(a._node.volume=a._volume*t)}return e}return e._volume},mute:function(t){var e=this||i;e.ctx||d(),e._muted=t,e.usingWebAudio&&e.masterGain.gain.setValueAtTime(t?0:e._volume,i.ctx.currentTime);for(var n=0;n<e._howls.length;n++)if(!e._howls[n]._webAudio)for(var r=e._howls[n]._getSoundIds(),o=0;o<r.length;o++){var a=e._howls[n]._soundById(r[o]);a&&a._node&&(a._node.muted=!!t||a._muted)}return e},stop:function(){for(var t=this||i,e=0;e<t._howls.length;e++)t._howls[e].stop();return t},unload:function(){for(var t=this||i,e=t._howls.length-1;e>=0;e--)t._howls[e].unload();return t.usingWebAudio&&t.ctx&&void 0!==t.ctx.close&&(t.ctx.close(),t.ctx=null,d()),t},codecs:function(t){return(this||i)._codecs[t.replace(/^x-/,"")]},_setup:function(){var t=this||i;if(t.state=t.ctx&&t.ctx.state||"suspended",t._autoSuspend(),!t.usingWebAudio)if("undefined"!=typeof Audio)try{void 0===(new Audio).oncanplaythrough&&(t._canPlayEvent="canplay")}catch(e){t.noAudio=!0}else t.noAudio=!0;try{(new Audio).muted&&(t.noAudio=!0)}catch(t){}return t.noAudio||t._setupCodecs(),t},_setupCodecs:function(){var t=this||i,e=null;try{e="undefined"!=typeof Audio?new Audio:null}catch(e){return t}if(!e||"function"!=typeof e.canPlayType)return t;var n=e.canPlayType("audio/mpeg;").replace(/^no$/,""),r=t._navigator?t._navigator.userAgent:"",o=r.match(/OPR\/(\d+)/g),a=o&&parseInt(o[0].split("/")[1],10)<33,s=-1!==r.indexOf("Safari")&&-1===r.indexOf("Chrome"),u=r.match(/Version\/(.*?) /),c=s&&u&&parseInt(u[1],10)<15;return t._codecs={mp3:!(a||!n&&!e.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!n,opus:!!e.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(e.canPlayType('audio/wav; codecs="1"')||e.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!e.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!e.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(e.canPlayType("audio/x-m4a;")||e.canPlayType("audio/m4a;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(e.canPlayType("audio/x-m4b;")||e.canPlayType("audio/m4b;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(e.canPlayType("audio/x-mp4;")||e.canPlayType("audio/mp4;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(c||!e.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(c||!e.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!e.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(e.canPlayType("audio/x-flac;")||e.canPlayType("audio/flac;")).replace(/^no$/,"")},t},_unlockAudio:function(){var t=this||i;if(!t._audioUnlocked&&t.ctx){t._audioUnlocked=!1,t.autoUnlock=!1,t._mobileUnloaded||44100===t.ctx.sampleRate||(t._mobileUnloaded=!0,t.unload()),t._scratchBuffer=t.ctx.createBuffer(1,1,22050);var e=function(n){for(;t._html5AudioPool.length<t.html5PoolSize;)try{var r=new Audio;r._unlocked=!0,t._releaseHtml5Audio(r)}catch(n){t.noAudio=!0;break}for(var o=0;o<t._howls.length;o++)if(!t._howls[o]._webAudio)for(var i=t._howls[o]._getSoundIds(),a=0;a<i.length;a++){var s=t._howls[o]._soundById(i[a]);s&&s._node&&!s._node._unlocked&&(s._node._unlocked=!0,s._node.load())}t._autoResume();var u=t.ctx.createBufferSource();u.buffer=t._scratchBuffer,u.connect(t.ctx.destination),void 0===u.start?u.noteOn(0):u.start(0),"function"==typeof t.ctx.resume&&t.ctx.resume(),u.onended=function(){u.disconnect(0),t._audioUnlocked=!0,document.removeEventListener("touchstart",e,!0),document.removeEventListener("touchend",e,!0),document.removeEventListener("click",e,!0),document.removeEventListener("keydown",e,!0);for(var n=0;n<t._howls.length;n++)t._howls[n]._emit("unlock")}};return document.addEventListener("touchstart",e,!0),document.addEventListener("touchend",e,!0),document.addEventListener("click",e,!0),document.addEventListener("keydown",e,!0),t}},_obtainHtml5Audio:function(){var t=this||i;if(t._html5AudioPool.length)return t._html5AudioPool.pop();var e=(new Audio).play();return e&&"undefined"!=typeof Promise&&(e instanceof Promise||"function"==typeof e.then)&&e.catch((function(){console.warn("HTML5 Audio pool exhausted, returning potentially locked audio object.")})),new Audio},_releaseHtml5Audio:function(t){var e=this||i;return t._unlocked&&e._html5AudioPool.push(t),e},_autoSuspend:function(){var t=this;if(t.autoSuspend&&t.ctx&&void 0!==t.ctx.suspend&&i.usingWebAudio){for(var e=0;e<t._howls.length;e++)if(t._howls[e]._webAudio)for(var n=0;n<t._howls[e]._sounds.length;n++)if(!t._howls[e]._sounds[n]._paused)return t;return t._suspendTimer&&clearTimeout(t._suspendTimer),t._suspendTimer=setTimeout((function(){if(t.autoSuspend){t._suspendTimer=null,t.state="suspending";var e=function(){t.state="suspended",t._resumeAfterSuspend&&(delete t._resumeAfterSuspend,t._autoResume())};t.ctx.suspend().then(e,e)}}),3e4),t}},_autoResume:function(){var t=this;if(t.ctx&&void 0!==t.ctx.resume&&i.usingWebAudio)return"running"===t.state&&"interrupted"!==t.ctx.state&&t._suspendTimer?(clearTimeout(t._suspendTimer),t._suspendTimer=null):"suspended"===t.state||"running"===t.state&&"interrupted"===t.ctx.state?(t.ctx.resume().then((function(){t.state="running";for(var e=0;e<t._howls.length;e++)t._howls[e]._emit("resume")})),t._suspendTimer&&(clearTimeout(t._suspendTimer),t._suspendTimer=null)):"suspending"===t.state&&(t._resumeAfterSuspend=!0),t}};var i=new o,a=function(t){t.src&&0!==t.src.length?this.init(t):console.error("An array of source files must be passed with any new Howl.")};a.prototype={init:function(t){var e=this;return i.ctx||d(),e._autoplay=t.autoplay||!1,e._format="string"!=typeof t.format?t.format:[t.format],e._html5=t.html5||!1,e._muted=t.mute||!1,e._loop=t.loop||!1,e._pool=t.pool||5,e._preload="boolean"!=typeof t.preload&&"metadata"!==t.preload||t.preload,e._rate=t.rate||1,e._sprite=t.sprite||{},e._src="string"!=typeof t.src?t.src:[t.src],e._volume=void 0!==t.volume?t.volume:1,e._xhr={method:t.xhr&&t.xhr.method?t.xhr.method:"GET",headers:t.xhr&&t.xhr.headers?t.xhr.headers:null,withCredentials:!(!t.xhr||!t.xhr.withCredentials)&&t.xhr.withCredentials},e._duration=0,e._state="unloaded",e._sounds=[],e._endTimers={},e._queue=[],e._playLock=!1,e._onend=t.onend?[{fn:t.onend}]:[],e._onfade=t.onfade?[{fn:t.onfade}]:[],e._onload=t.onload?[{fn:t.onload}]:[],e._onloaderror=t.onloaderror?[{fn:t.onloaderror}]:[],e._onplayerror=t.onplayerror?[{fn:t.onplayerror}]:[],e._onpause=t.onpause?[{fn:t.onpause}]:[],e._onplay=t.onplay?[{fn:t.onplay}]:[],e._onstop=t.onstop?[{fn:t.onstop}]:[],e._onmute=t.onmute?[{fn:t.onmute}]:[],e._onvolume=t.onvolume?[{fn:t.onvolume}]:[],e._onrate=t.onrate?[{fn:t.onrate}]:[],e._onseek=t.onseek?[{fn:t.onseek}]:[],e._onunlock=t.onunlock?[{fn:t.onunlock}]:[],e._onresume=[],e._webAudio=i.usingWebAudio&&!e._html5,void 0!==i.ctx&&i.ctx&&i.autoUnlock&&i._unlockAudio(),i._howls.push(e),e._autoplay&&e._queue.push({event:"play",action:function(){e.play()}}),e._preload&&"none"!==e._preload&&e.load(),e},load:function(){var t=this,e=null;if(i.noAudio)t._emit("loaderror",null,"No audio support.");else{"string"==typeof t._src&&(t._src=[t._src]);for(var n=0;n<t._src.length;n++){var r,o;if(t._format&&t._format[n])r=t._format[n];else{if("string"!=typeof(o=t._src[n])){t._emit("loaderror",null,"Non-string found in selected audio sources - ignoring.");continue}(r=/^data:audio\/([^;,]+);/i.exec(o))||(r=/\.([^.]+)$/.exec(o.split("?",1)[0])),r&&(r=r[1].toLowerCase())}if(r||console.warn('No file extension was found. Consider using the "format" property or specify an extension.'),r&&i.codecs(r)){e=t._src[n];break}}if(e)return t._src=e,t._state="loading","https:"===window.location.protocol&&"http:"===e.slice(0,5)&&(t._html5=!0,t._webAudio=!1),new s(t),t._webAudio&&c(t),t;t._emit("loaderror",null,"No codec support for selected audio sources.")}},play:function(t,e){var n=this,r=null;if("number"==typeof t)r=t,t=null;else{if("string"==typeof t&&"loaded"===n._state&&!n._sprite[t])return null;if(void 0===t&&(t="__default",!n._playLock)){for(var o=0,a=0;a<n._sounds.length;a++)n._sounds[a]._paused&&!n._sounds[a]._ended&&(o++,r=n._sounds[a]._id);1===o?t=null:r=null}}var s=r?n._soundById(r):n._inactiveSound();if(!s)return null;if(r&&!t&&(t=s._sprite||"__default"),"loaded"!==n._state){s._sprite=t,s._ended=!1;var u=s._id;return n._queue.push({event:"play",action:function(){n.play(u)}}),u}if(r&&!s._paused)return e||n._loadQueue("play"),s._id;n._webAudio&&i._autoResume();var c=Math.max(0,s._seek>0?s._seek:n._sprite[t][0]/1e3),l=Math.max(0,(n._sprite[t][0]+n._sprite[t][1])/1e3-c),f=1e3*l/Math.abs(s._rate),p=n._sprite[t][0]/1e3,d=(n._sprite[t][0]+n._sprite[t][1])/1e3;s._sprite=t,s._ended=!1;var h=function(){s._paused=!1,s._seek=c,s._start=p,s._stop=d,s._loop=!(!s._loop&&!n._sprite[t][2])};if(!(c>=d)){var y=s._node;if(n._webAudio){var v=function(){n._playLock=!1,h(),n._refreshBuffer(s);var t=s._muted||n._muted?0:s._volume;y.gain.setValueAtTime(t,i.ctx.currentTime),s._playStart=i.ctx.currentTime,void 0===y.bufferSource.start?s._loop?y.bufferSource.noteGrainOn(0,c,86400):y.bufferSource.noteGrainOn(0,c,l):s._loop?y.bufferSource.start(0,c,86400):y.bufferSource.start(0,c,l),f!==1/0&&(n._endTimers[s._id]=setTimeout(n._ended.bind(n,s),f)),e||setTimeout((function(){n._emit("play",s._id),n._loadQueue()}),0)};"running"===i.state&&"interrupted"!==i.ctx.state?v():(n._playLock=!0,n.once("resume",v),n._clearTimer(s._id))}else{var m=function(){y.currentTime=c,y.muted=s._muted||n._muted||i._muted||y.muted,y.volume=s._volume*i.volume(),y.playbackRate=s._rate;try{var r=y.play();if(r&&"undefined"!=typeof Promise&&(r instanceof Promise||"function"==typeof r.then)?(n._playLock=!0,h(),r.then((function(){n._playLock=!1,y._unlocked=!0,e?n._loadQueue():n._emit("play",s._id)})).catch((function(){n._playLock=!1,n._emit("playerror",s._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),s._ended=!0,s._paused=!0}))):e||(n._playLock=!1,h(),n._emit("play",s._id)),y.playbackRate=s._rate,y.paused)return void n._emit("playerror",s._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");"__default"!==t||s._loop?n._endTimers[s._id]=setTimeout(n._ended.bind(n,s),f):(n._endTimers[s._id]=function(){n._ended(s),y.removeEventListener("ended",n._endTimers[s._id],!1)},y.addEventListener("ended",n._endTimers[s._id],!1))}catch(t){n._emit("playerror",s._id,t)}};"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===y.src&&(y.src=n._src,y.load());var g=window&&window.ejecta||!y.readyState&&i._navigator.isCocoonJS;if(y.readyState>=3||g)m();else{n._playLock=!0,n._state="loading";var b=function(){n._state="loaded",m(),y.removeEventListener(i._canPlayEvent,b,!1)};y.addEventListener(i._canPlayEvent,b,!1),n._clearTimer(s._id)}}return s._id}n._ended(s)},pause:function(t){var e=this;if("loaded"!==e._state||e._playLock)return e._queue.push({event:"pause",action:function(){e.pause(t)}}),e;for(var n=e._getSoundIds(t),r=0;r<n.length;r++){e._clearTimer(n[r]);var o=e._soundById(n[r]);if(o&&!o._paused&&(o._seek=e.seek(n[r]),o._rateSeek=0,o._paused=!0,e._stopFade(n[r]),o._node))if(e._webAudio){if(!o._node.bufferSource)continue;void 0===o._node.bufferSource.stop?o._node.bufferSource.noteOff(0):o._node.bufferSource.stop(0),e._cleanBuffer(o._node)}else isNaN(o._node.duration)&&o._node.duration!==1/0||o._node.pause();arguments[1]||e._emit("pause",o?o._id:null)}return e},stop:function(t,e){var n=this;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"stop",action:function(){n.stop(t)}}),n;for(var r=n._getSoundIds(t),o=0;o<r.length;o++){n._clearTimer(r[o]);var i=n._soundById(r[o]);i&&(i._seek=i._start||0,i._rateSeek=0,i._paused=!0,i._ended=!0,n._stopFade(r[o]),i._node&&(n._webAudio?i._node.bufferSource&&(void 0===i._node.bufferSource.stop?i._node.bufferSource.noteOff(0):i._node.bufferSource.stop(0),n._cleanBuffer(i._node)):isNaN(i._node.duration)&&i._node.duration!==1/0||(i._node.currentTime=i._start||0,i._node.pause(),i._node.duration===1/0&&n._clearSound(i._node))),e||n._emit("stop",i._id))}return n},mute:function(t,e){var n=this;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"mute",action:function(){n.mute(t,e)}}),n;if(void 0===e){if("boolean"!=typeof t)return n._muted;n._muted=t}for(var r=n._getSoundIds(e),o=0;o<r.length;o++){var a=n._soundById(r[o]);a&&(a._muted=t,a._interval&&n._stopFade(a._id),n._webAudio&&a._node?a._node.gain.setValueAtTime(t?0:a._volume,i.ctx.currentTime):a._node&&(a._node.muted=!!i._muted||t),n._emit("mute",a._id))}return n},volume:function(){var t,e,n,r=this,o=arguments;if(0===o.length)return r._volume;if(1===o.length||2===o.length&&void 0===o[1]?r._getSoundIds().indexOf(o[0])>=0?e=parseInt(o[0],10):t=parseFloat(o[0]):o.length>=2&&(t=parseFloat(o[0]),e=parseInt(o[1],10)),!(void 0!==t&&t>=0&&t<=1))return(n=e?r._soundById(e):r._sounds[0])?n._volume:0;if("loaded"!==r._state||r._playLock)return r._queue.push({event:"volume",action:function(){r.volume.apply(r,o)}}),r;void 0===e&&(r._volume=t),e=r._getSoundIds(e);for(var a=0;a<e.length;a++)(n=r._soundById(e[a]))&&(n._volume=t,o[2]||r._stopFade(e[a]),r._webAudio&&n._node&&!n._muted?n._node.gain.setValueAtTime(t,i.ctx.currentTime):n._node&&!n._muted&&(n._node.volume=t*i.volume()),r._emit("volume",n._id));return r},fade:function(t,e,n,r){var o=this;if("loaded"!==o._state||o._playLock)return o._queue.push({event:"fade",action:function(){o.fade(t,e,n,r)}}),o;t=Math.min(Math.max(0,parseFloat(t)),1),e=Math.min(Math.max(0,parseFloat(e)),1),n=parseFloat(n),o.volume(t,r);for(var a=o._getSoundIds(r),s=0;s<a.length;s++){var u=o._soundById(a[s]);if(u){if(r||o._stopFade(a[s]),o._webAudio&&!u._muted){var c=i.ctx.currentTime,l=c+n/1e3;u._volume=t,u._node.gain.setValueAtTime(t,c),u._node.gain.linearRampToValueAtTime(e,l)}o._startFadeInterval(u,t,e,n,a[s],void 0===r)}}return o},_startFadeInterval:function(t,e,n,r,o,i){var a=this,s=e,u=n-e,c=Math.abs(u/.01),l=Math.max(4,c>0?r/c:r),f=Date.now();t._fadeTo=n,t._interval=setInterval((function(){var o=(Date.now()-f)/r;f=Date.now(),s+=u*o,s=Math.round(100*s)/100,s=u<0?Math.max(n,s):Math.min(n,s),a._webAudio?t._volume=s:a.volume(s,t._id,!0),i&&(a._volume=s),(n<e&&s<=n||n>e&&s>=n)&&(clearInterval(t._interval),t._interval=null,t._fadeTo=null,a.volume(n,t._id),a._emit("fade",t._id))}),l)},_stopFade:function(t){var e=this,n=e._soundById(t);return n&&n._interval&&(e._webAudio&&n._node.gain.cancelScheduledValues(i.ctx.currentTime),clearInterval(n._interval),n._interval=null,e.volume(n._fadeTo,t),n._fadeTo=null,e._emit("fade",t)),e},loop:function(){var t,e,n,r=this,o=arguments;if(0===o.length)return r._loop;if(1===o.length){if("boolean"!=typeof o[0])return!!(n=r._soundById(parseInt(o[0],10)))&&n._loop;t=o[0],r._loop=t}else 2===o.length&&(t=o[0],e=parseInt(o[1],10));for(var i=r._getSoundIds(e),a=0;a<i.length;a++)(n=r._soundById(i[a]))&&(n._loop=t,r._webAudio&&n._node&&n._node.bufferSource&&(n._node.bufferSource.loop=t,t&&(n._node.bufferSource.loopStart=n._start||0,n._node.bufferSource.loopEnd=n._stop,r.playing(i[a])&&(r.pause(i[a],!0),r.play(i[a],!0)))));return r},rate:function(){var t,e,n,r=this,o=arguments;if(0===o.length)e=r._sounds[0]._id;else if(1===o.length){r._getSoundIds().indexOf(o[0])>=0?e=parseInt(o[0],10):t=parseFloat(o[0])}else 2===o.length&&(t=parseFloat(o[0]),e=parseInt(o[1],10));if("number"!=typeof t)return(n=r._soundById(e))?n._rate:r._rate;if("loaded"!==r._state||r._playLock)return r._queue.push({event:"rate",action:function(){r.rate.apply(r,o)}}),r;void 0===e&&(r._rate=t),e=r._getSoundIds(e);for(var a=0;a<e.length;a++)if(n=r._soundById(e[a])){r.playing(e[a])&&(n._rateSeek=r.seek(e[a]),n._playStart=r._webAudio?i.ctx.currentTime:n._playStart),n._rate=t,r._webAudio&&n._node&&n._node.bufferSource?n._node.bufferSource.playbackRate.setValueAtTime(t,i.ctx.currentTime):n._node&&(n._node.playbackRate=t);var s=r.seek(e[a]),u=1e3*((r._sprite[n._sprite][0]+r._sprite[n._sprite][1])/1e3-s)/Math.abs(n._rate);!r._endTimers[e[a]]&&n._paused||(r._clearTimer(e[a]),r._endTimers[e[a]]=setTimeout(r._ended.bind(r,n),u)),r._emit("rate",n._id)}return r},seek:function(){var t,e,n=this,r=arguments;if(0===r.length)n._sounds.length&&(e=n._sounds[0]._id);else if(1===r.length){n._getSoundIds().indexOf(r[0])>=0?e=parseInt(r[0],10):n._sounds.length&&(e=n._sounds[0]._id,t=parseFloat(r[0]))}else 2===r.length&&(t=parseFloat(r[0]),e=parseInt(r[1],10));if(void 0===e)return 0;if("number"==typeof t&&("loaded"!==n._state||n._playLock))return n._queue.push({event:"seek",action:function(){n.seek.apply(n,r)}}),n;var o=n._soundById(e);if(o){if(!("number"==typeof t&&t>=0)){if(n._webAudio){var a=n.playing(e)?i.ctx.currentTime-o._playStart:0,s=o._rateSeek?o._rateSeek-o._seek:0;return o._seek+(s+a*Math.abs(o._rate))}return o._node.currentTime}var u=n.playing(e);u&&n.pause(e,!0),o._seek=t,o._ended=!1,n._clearTimer(e),n._webAudio||!o._node||isNaN(o._node.duration)||(o._node.currentTime=t);var c=function(){u&&n.play(e,!0),n._emit("seek",e)};if(u&&!n._webAudio){var l=function(){n._playLock?setTimeout(l,0):c()};setTimeout(l,0)}else c()}return n},playing:function(t){var e=this;if("number"==typeof t){var n=e._soundById(t);return!!n&&!n._paused}for(var r=0;r<e._sounds.length;r++)if(!e._sounds[r]._paused)return!0;return!1},duration:function(t){var e=this,n=e._duration,r=e._soundById(t);return r&&(n=e._sprite[r._sprite][1]/1e3),n},state:function(){return this._state},unload:function(){for(var t=this,e=t._sounds,n=0;n<e.length;n++)e[n]._paused||t.stop(e[n]._id),t._webAudio||(t._clearSound(e[n]._node),e[n]._node.removeEventListener("error",e[n]._errorFn,!1),e[n]._node.removeEventListener(i._canPlayEvent,e[n]._loadFn,!1),e[n]._node.removeEventListener("ended",e[n]._endFn,!1),i._releaseHtml5Audio(e[n]._node)),delete e[n]._node,t._clearTimer(e[n]._id);var r=i._howls.indexOf(t);r>=0&&i._howls.splice(r,1);var o=!0;for(n=0;n<i._howls.length;n++)if(i._howls[n]._src===t._src||t._src.indexOf(i._howls[n]._src)>=0){o=!1;break}return u&&o&&delete u[t._src],i.noAudio=!1,t._state="unloaded",t._sounds=[],t=null,null},on:function(t,e,n,r){var o=this["_on"+t];return"function"==typeof e&&o.push(r?{id:n,fn:e,once:r}:{id:n,fn:e}),this},off:function(t,e,n){var r=this,o=r["_on"+t],i=0;if("number"==typeof e&&(n=e,e=null),e||n)for(i=0;i<o.length;i++){var a=n===o[i].id;if(e===o[i].fn&&a||!e&&a){o.splice(i,1);break}}else if(t)r["_on"+t]=[];else{var s=Object.keys(r);for(i=0;i<s.length;i++)0===s[i].indexOf("_on")&&Array.isArray(r[s[i]])&&(r[s[i]]=[])}return r},once:function(t,e,n){return this.on(t,e,n,1),this},_emit:function(t,e,n){for(var r=this,o=r["_on"+t],i=o.length-1;i>=0;i--)o[i].id&&o[i].id!==e&&"load"!==t||(setTimeout(function(t){t.call(this,e,n)}.bind(r,o[i].fn),0),o[i].once&&r.off(t,o[i].fn,o[i].id));return r._loadQueue(t),r},_loadQueue:function(t){var e=this;if(e._queue.length>0){var n=e._queue[0];n.event===t&&(e._queue.shift(),e._loadQueue()),t||n.action()}return e},_ended:function(t){var e=this,n=t._sprite;if(!e._webAudio&&t._node&&!t._node.paused&&!t._node.ended&&t._node.currentTime<t._stop)return setTimeout(e._ended.bind(e,t),100),e;var r=!(!t._loop&&!e._sprite[n][2]);if(e._emit("end",t._id),!e._webAudio&&r&&e.stop(t._id,!0).play(t._id),e._webAudio&&r){e._emit("play",t._id),t._seek=t._start||0,t._rateSeek=0,t._playStart=i.ctx.currentTime;var o=1e3*(t._stop-t._start)/Math.abs(t._rate);e._endTimers[t._id]=setTimeout(e._ended.bind(e,t),o)}return e._webAudio&&!r&&(t._paused=!0,t._ended=!0,t._seek=t._start||0,t._rateSeek=0,e._clearTimer(t._id),e._cleanBuffer(t._node),i._autoSuspend()),e._webAudio||r||e.stop(t._id,!0),e},_clearTimer:function(t){var e=this;if(e._endTimers[t]){if("function"!=typeof e._endTimers[t])clearTimeout(e._endTimers[t]);else{var n=e._soundById(t);n&&n._node&&n._node.removeEventListener("ended",e._endTimers[t],!1)}delete e._endTimers[t]}return e},_soundById:function(t){for(var e=this,n=0;n<e._sounds.length;n++)if(t===e._sounds[n]._id)return e._sounds[n];return null},_inactiveSound:function(){var t=this;t._drain();for(var e=0;e<t._sounds.length;e++)if(t._sounds[e]._ended)return t._sounds[e].reset();return new s(t)},_drain:function(){var t=this,e=t._pool,n=0,r=0;if(!(t._sounds.length<e)){for(r=0;r<t._sounds.length;r++)t._sounds[r]._ended&&n++;for(r=t._sounds.length-1;r>=0;r--){if(n<=e)return;t._sounds[r]._ended&&(t._webAudio&&t._sounds[r]._node&&t._sounds[r]._node.disconnect(0),t._sounds.splice(r,1),n--)}}},_getSoundIds:function(t){if(void 0===t){for(var e=[],n=0;n<this._sounds.length;n++)e.push(this._sounds[n]._id);return e}return[t]},_refreshBuffer:function(t){return t._node.bufferSource=i.ctx.createBufferSource(),t._node.bufferSource.buffer=u[this._src],t._panner?t._node.bufferSource.connect(t._panner):t._node.bufferSource.connect(t._node),t._node.bufferSource.loop=t._loop,t._loop&&(t._node.bufferSource.loopStart=t._start||0,t._node.bufferSource.loopEnd=t._stop||0),t._node.bufferSource.playbackRate.setValueAtTime(t._rate,i.ctx.currentTime),this},_cleanBuffer:function(t){var e=i._navigator&&i._navigator.vendor.indexOf("Apple")>=0;if(!t.bufferSource)return this;if(i._scratchBuffer&&t.bufferSource&&(t.bufferSource.onended=null,t.bufferSource.disconnect(0),e))try{t.bufferSource.buffer=i._scratchBuffer}catch(t){}return t.bufferSource=null,this},_clearSound:function(t){/MSIE |Trident\//.test(i._navigator&&i._navigator.userAgent)||(t.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var s=function(t){this._parent=t,this.init()};s.prototype={init:function(){var t=this,e=t._parent;return t._muted=e._muted,t._loop=e._loop,t._volume=e._volume,t._rate=e._rate,t._seek=0,t._paused=!0,t._ended=!0,t._sprite="__default",t._id=++i._counter,e._sounds.push(t),t.create(),t},create:function(){var t=this,e=t._parent,n=i._muted||t._muted||t._parent._muted?0:t._volume;return e._webAudio?(t._node=void 0===i.ctx.createGain?i.ctx.createGainNode():i.ctx.createGain(),t._node.gain.setValueAtTime(n,i.ctx.currentTime),t._node.paused=!0,t._node.connect(i.masterGain)):i.noAudio||(t._node=i._obtainHtml5Audio(),t._errorFn=t._errorListener.bind(t),t._node.addEventListener("error",t._errorFn,!1),t._loadFn=t._loadListener.bind(t),t._node.addEventListener(i._canPlayEvent,t._loadFn,!1),t._endFn=t._endListener.bind(t),t._node.addEventListener("ended",t._endFn,!1),t._node.src=e._src,t._node.preload=!0===e._preload?"auto":e._preload,t._node.volume=n*i.volume(),t._node.load()),t},reset:function(){var t=this,e=t._parent;return t._muted=e._muted,t._loop=e._loop,t._volume=e._volume,t._rate=e._rate,t._seek=0,t._rateSeek=0,t._paused=!0,t._ended=!0,t._sprite="__default",t._id=++i._counter,t},_errorListener:function(){var t=this;t._parent._emit("loaderror",t._id,t._node.error?t._node.error.code:0),t._node.removeEventListener("error",t._errorFn,!1)},_loadListener:function(){var t=this,e=t._parent;e._duration=Math.ceil(10*t._node.duration)/10,0===Object.keys(e._sprite).length&&(e._sprite={__default:[0,1e3*e._duration]}),"loaded"!==e._state&&(e._state="loaded",e._emit("load"),e._loadQueue()),t._node.removeEventListener(i._canPlayEvent,t._loadFn,!1)},_endListener:function(){var t=this,e=t._parent;e._duration===1/0&&(e._duration=Math.ceil(10*t._node.duration)/10,e._sprite.__default[1]===1/0&&(e._sprite.__default[1]=1e3*e._duration),e._ended(t)),t._node.removeEventListener("ended",t._endFn,!1)}};var u={},c=function(t){var e=t._src;if(u[e])return t._duration=u[e].duration,void p(t);if(/^data:[^;]+;base64,/.test(e)){for(var n=atob(e.split(",")[1]),r=new Uint8Array(n.length),o=0;o<n.length;++o)r[o]=n.charCodeAt(o);f(r.buffer,t)}else{var i=new XMLHttpRequest;i.open(t._xhr.method,e,!0),i.withCredentials=t._xhr.withCredentials,i.responseType="arraybuffer",t._xhr.headers&&Object.keys(t._xhr.headers).forEach((function(e){i.setRequestHeader(e,t._xhr.headers[e])})),i.onload=function(){var e=(i.status+"")[0];"0"===e||"2"===e||"3"===e?f(i.response,t):t._emit("loaderror",null,"Failed loading audio file with status: "+i.status+".")},i.onerror=function(){t._webAudio&&(t._html5=!0,t._webAudio=!1,t._sounds=[],delete u[e],t.load())},l(i)}},l=function(t){try{t.send()}catch(e){t.onerror()}},f=function(t,e){var n=function(){e._emit("loaderror",null,"Decoding audio data failed.")},r=function(t){t&&e._sounds.length>0?(u[e._src]=t,p(e,t)):n()};"undefined"!=typeof Promise&&1===i.ctx.decodeAudioData.length?i.ctx.decodeAudioData(t).then(r).catch(n):i.ctx.decodeAudioData(t,r,n)},p=function(t,e){e&&!t._duration&&(t._duration=e.duration),0===Object.keys(t._sprite).length&&(t._sprite={__default:[0,1e3*t._duration]}),"loaded"!==t._state&&(t._state="loaded",t._emit("load"),t._loadQueue())},d=function(){if(i.usingWebAudio){try{"undefined"!=typeof AudioContext?i.ctx=new AudioContext:"undefined"!=typeof webkitAudioContext?i.ctx=new webkitAudioContext:i.usingWebAudio=!1}catch(t){i.usingWebAudio=!1}i.ctx||(i.usingWebAudio=!1);var t=/iP(hone|od|ad)/.test(i._navigator&&i._navigator.platform),e=i._navigator&&i._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),n=e?parseInt(e[1],10):null;if(t&&n&&n<9){var r=/safari/.test(i._navigator&&i._navigator.userAgent.toLowerCase());i._navigator&&!r&&(i.usingWebAudio=!1)}i.usingWebAudio&&(i.masterGain=void 0===i.ctx.createGain?i.ctx.createGainNode():i.ctx.createGain(),i.masterGain.gain.setValueAtTime(i._muted?0:i._volume,i.ctx.currentTime),i.masterGain.connect(i.ctx.destination)),i._setup()}};void 0===(r=function(){return{Howler:i,Howl:a}}.apply(e,[]))||(t.exports=r),e.Howler=i,e.Howl=a,void 0!==n.g?(n.g.HowlerGlobal=o,n.g.Howler=i,n.g.Howl=a,n.g.Sound=s):"undefined"!=typeof window&&(window.HowlerGlobal=o,window.Howler=i,window.Howl=a,window.Sound=s)}(),
11
11
  /*!
12
12
  * Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported.
13
13
  *
@@ -28,4 +28,4 @@ function(){"use strict";var t;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.p
28
28
  *
29
29
  * This source code is licensed under the MIT license found in the
30
30
  * LICENSE file in the root directory of this source tree.
31
- */function c(t,e,n){var r,i={},c=null,l=null;for(r in void 0!==n&&(c=""+n),void 0!==e.key&&(c=""+e.key),void 0!==e.ref&&(l=e.ref),e)a.call(e,r)&&!u.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps)void 0===i[r]&&(i[r]=e[r]);return{$$typeof:o,type:t,key:c,ref:l,props:i,_owner:s.current}}e.jsx=c,e.jsxs=c},848:(t,e,n)=>{"use strict";t.exports=n(20)},72:t=>{"use strict";var e=[];function n(t){for(var n=-1,r=0;r<e.length;r++)if(e[r].identifier===t){n=r;break}return n}function r(t,r){for(var i={},a=[],s=0;s<t.length;s++){var u=t[s],c=r.base?u[0]+r.base:u[0],l=i[c]||0,f="".concat(c," ").concat(l);i[c]=l+1;var d=n(f),p={css:u[1],media:u[2],sourceMap:u[3],supports:u[4],layer:u[5]};if(-1!==d)e[d].references++,e[d].updater(p);else{var h=o(p,r);r.byIndex=s,e.splice(s,0,{identifier:f,updater:h,references:1})}a.push(f)}return a}function o(t,e){var n=e.domAPI(e);n.update(t);return function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,o){var i=r(t=t||[],o=o||{});return function(t){t=t||[];for(var a=0;a<i.length;a++){var s=n(i[a]);e[s].references--}for(var u=r(t,o),c=0;c<i.length;c++){var l=n(i[c]);0===e[l].references&&(e[l].updater(),e.splice(l,1))}i=u}}},659:t=>{"use strict";var e={};t.exports=function(t,n){var r=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},540:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},56:(t,e,n)=>{"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},825:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),e.styleTagTransform(r,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},113:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},12:e=>{"use strict";e.exports=t}},n={};function r(t){var o=n[t];if(void 0!==o)return o.exports;var i=n[t]={id:t,exports:{}};return e[t](i,i.exports,r),i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nc=void 0;var o={};return(()=>{"use strict";function t(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */t=function(){return n};var e,n={},r=Object.prototype,o=r.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(e){l=function(t,e,n){return t[e]=n}}function d(t,e,n,r){var o=e&&e.prototype instanceof b?e:b,a=Object.create(o.prototype),s=new I(r||[]);return i(a,"_invoke",{value:O(t,n,s)}),a}function p(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}n.wrap=d;var h="suspendedStart",y="suspendedYield",v="executing",m="completed",g={};function b(){}function w(){}function _(){}var S={};l(S,s,(function(){return this}));var k=Object.getPrototypeOf,x=k&&k(k(L([])));x&&x!==r&&o.call(x,s)&&(S=x);var A=_.prototype=b.prototype=Object.create(S);function T(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(r,i,a,s){var u=p(t[r],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==f(l)&&o.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var r;i(this,"_invoke",{value:function(t,o){function i(){return new e((function(e,r){n(t,o,e,r)}))}return r=r?r.then(i,i):i()}})}function O(t,n,r){var o=h;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=P(s,r);if(u){if(u===g)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=v;var c=p(t,n,r);if("normal"===c.type){if(o=r.done?m:y,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=m,r.method="throw",r.arg=c.arg)}}}function P(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,P(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=p(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[s];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function n(){for(;++r<t.length;)if(o.call(t,r))return n.value=t[r],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(f(t)+" is not iterable")}return w.prototype=_,i(A,"constructor",{value:_,configurable:!0}),i(_,"constructor",{value:w,configurable:!0}),w.displayName=l(_,c,"GeneratorFunction"),n.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,l(t,c,"GeneratorFunction")),t.prototype=Object.create(A),t},n.awrap=function(t){return{__await:t}},T(E.prototype),l(E.prototype,u,(function(){return this})),n.AsyncIterator=E,n.async=function(t,e,r,o,i){void 0===i&&(i=Promise);var a=new E(d(t,e,r,o),i);return n.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},T(A),l(A,c,"Generator"),l(A,s,(function(){return this})),l(A,"toString",(function(){return"[object Generator]"})),n.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},n.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(C),!t)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(r,o){return s.type="throw",s.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),c=o.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;C(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},n}function e(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=c(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,s(r.key),r)}}function a(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t){var e=function(t,e){if("object"!=f(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==f(e)?e:e+""}function u(t){return function(t){if(Array.isArray(t))return l(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||c(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(t,e){if(t){if("string"==typeof t)return l(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(t,e):void 0}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}r.r(o),r.d(o,{Align:()=>De,Base:()=>Wf,Character:()=>Xt,ColoredSentence:()=>Jt,CommonPosition:()=>Fe,CommonPositionType:()=>Ae,Condition:()=>Zs,Control:()=>iu,Coord2D:()=>Ve,Dissolve:()=>vd,Fade:()=>td,FadeIn:()=>ud,Game:()=>de,GameProviders:()=>Uf,GameState:()=>G,Image:()=>Ga,Isolated:()=>et,Lambda:()=>Ks,LiveGame:()=>pe,Menu:()=>pu,Namespace:()=>j,Player:()=>Bf,Say:()=>Qt,Scene:()=>Yu,Script:()=>nc,Sentence:()=>Wt,Sound:()=>Iu,SoundType:()=>ku,Storable:()=>C,Story:()=>lc,Transform:()=>La,Utils:()=>Ns,Word:()=>qt,useGame:()=>ct});var d=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 p(t,e){var n=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r={},o=function(t,e,n){return"object"!==f(e)||null===e||Array.isArray(e)||"object"!==f(n)||null===n||Array.isArray(n)?Array.isArray(e)&&Array.isArray(n)?e.map((function(t,e){return"object"===f(t)&&null!==t&&!Array.isArray(t)&&n[e]?p(t,n[e]):t})):void 0===n?e:n:e.constructor!==Object||n.constructor!==Object?n||e:p(e,n)};for(var i in t)n(t,i)&&(r[i]=o(0,t[i],e[i]));for(var a in e)n(e,a)&&!n(r,a)&&("object"===f(e[a])&&null!==e[a]&&e[a].constructor===Object?r[a]=p({},e[a]):r[a]=e[a]);for(var s=arguments.length,c=new Array(s>2?s-2:0),l=2;l<s;l++)c[l-2]=arguments[l];if(c.length){var d=c[0],h=c.slice(1);return p.apply(void 0,[r,d].concat(u(h)))}return r}var h=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t},r=arguments.length>1?arguments[1]:void 0;n(this,t),this.solved=!1,this.listeners=[],this.receiver=e,this.skipController=r}return a(t,[{key:"registerSkipController",value:function(t){return this.skipController=t,this}},{key:"resolve",value:function(t){if(!this.solved){this.result=this.receiver(t),this.solved=!0,this.skipController&&this.skipController.cancel();var n,r=e(this.listeners);try{for(r.s();!(n=r.n()).done;){(0,n.value)(this.result)}}catch(t){r.e(t)}finally{r.f()}}}},{key:"then",value:function(t){this.result?t(this.result):this.listeners.push(t)}},{key:"abort",value:function(){return this.skipController?this.skipController.abort():this.result}}],[{key:"isAwaitable",value:function(e){return e instanceof t}}])}();function y(t){var n=new WeakSet;return function t(r){if(null===r||"object"!==f(r))return r;if(!n.has(r)){if(n.add(r),Array.isArray(r)){var o,i=[],a=e(r);try{for(a.s();!(o=a.n()).done;){var s=o.value;i.push(t(s))}}catch(t){a.e(t)}finally{a.f()}return i}var u={};for(var c in r)Object.prototype.hasOwnProperty.call(r,c)&&(u[c]=t(r[c]));return u}}(t)}function v(t){return"string"==typeof t?t:"#".concat((t.r||0).toString(16).padStart(2,"0")).concat((t.g||0).toString(16).padStart(2,"0")).concat((t.b||0).toString(16).padStart(2,"0")).concat(void 0===t.a?"":t.a.toString(16).padStart(2,"0"))}var m=function(){return a((function t(){n(this,t),this.events={}}),[{key:"on",value:function(t,e){return this.events[t]||(this.events[t]=[]),this.events[t].push(e),this.emit("event:EventDispatcher.register",t,e),e}},{key:"onEvents",value:function(t){var e=this,n=t.map((function(t){var n=t.type,r=t.listener;return{type:n,listener:r,cancel:function(){e.off(n,r)}}}));return{tokens:n,cancel:function(){n.forEach((function(t){return t.cancel()}))}}}},{key:"off",value:function(t,e){this.events[t]&&(this.events[t]=this.events[t].filter((function(t){return t!==e})))}},{key:"emit",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];this.events[t]&&this.events[t].forEach((function(t){t.apply(void 0,n)}))}},{key:"once",value:function(t,e){var n=this,r=function(){e.apply(void 0,arguments),n.off(t,r)};return this.on(t,r)}},{key:"any",value:function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return d(this,void 0,void 0,t().mark((function r(){var i,a,s,u,c,l=this;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.events[n]||(this.events[n]=[]),i=[],a=e(this.events[n]);try{for(a.s();!(s=a.n()).done;)u=s.value,(c=u.apply(void 0,o))&&"object"===f(c)&&"function"==typeof c.then&&i.push(c)}catch(t){a.e(t)}finally{a.f()}if(this.events[n]=this.events[n].filter((function(t){return!i.includes(t)})),0!==i.length){t.next=7;break}return t.abrupt("return",new Promise((function(t){var e=l.on("event:EventDispatcher.register",(function(r,i){if(r===n){l.off(r,e);var a=null==i?void 0:i.apply(void 0,o);a&&a.then?a.then(t):t(a)}}))})));case 7:return t.next=9,Promise.all(i);case 9:return t.abrupt("return",void 0);case 10:case"end":return t.stop()}}),r,this)})))}},{key:"reset",value:function(){this.events={}}}])}();function g(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(new Error).stack;return n?n.split("\n").slice(t+1,-e).join("\n").trim():""}function b(t){return new Promise((function(e){return setTimeout(e,t)}))}function w(t,e){if(t===e)return!0;if("object"!==f(t)||"object"!==f(e)||null===t||null===e)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(var o=0,i=n;o<i.length;o++){var a=i[o];if(!r.includes(a)||!w(t[a],e[a]))return!1}return!0}var _=function(){return a((function t(e,r){n(this,t),this.game=e,this.prefix=r}),[{key:"log",value:function(t){if(this.game.config.app.logger.log){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).log.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"info",value:function(t){if(this.game.config.app.logger.info){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).info.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"warn",value:function(t){if(this.game.config.app.logger.warn){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).warn.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"error",value:function(t){if(this.game.config.app.logger.error){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).error.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"debug",value:function(t){if(this.game.config.app.logger.debug){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).debug.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"trace",value:function(t){if(this.game.config.app.logger.trace){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];console.trace(this._log.apply(this,[t].concat(n)))}}},{key:"_log",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return 0===n.length?[this.prefix||"",t]:["".concat(this.prefix||""," [").concat(t,"]")].concat(n)}}])}(),S=function(){return a((function t(e){n(this,t),this.abortHandler=e,this.events=new m,this.aborted=!1}),[{key:"abort",value:function(){return this.aborted||(this.aborted=!0,this.result=this.abortHandler.apply(this,arguments)),this.result}},{key:"isAborted",value:function(){return this.aborted}},{key:"cancel",value:function(){this.aborted=!0}}])}();function k(t){return k="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},k(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 A(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?A(t,e):void 0}}(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 A(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function T(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function E(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 O(t,e,n){return e&&E(t.prototype,e),n&&E(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function P(t){var e=function(t,e){if("object"!=k(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=k(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==k(e)?e:e+""}S.EventTypes={"event:skipController.abort":"event:skipController.abort"};var j=function(){function t(e,n,r){T(this,t),this.name=e,this.key=r||e,this.content=p({},n)}return O(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=x(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=x(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(k(e))||(e instanceof Date||(null==e||(Array.isArray(e)?e.every(t.isSerializable):"object"===k(e)&&(Object.getPrototypeOf(e)===Object.prototype&&Object.values(e).every(t.isSerializable)))))}}])}(),C=function(){return O((function t(){T(this,t),this.namespaces={}}),[{key:"addNamespace",value:function(t){return 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=x(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=x(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")}}])}();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 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,M(r.key),r)}}function M(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 N=r(196);function R(t){return R="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},R(t)}function F(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)||function(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}}(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 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 D(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,B(r.key),r)}}function B(t){var e=function(t,e){if("object"!=R(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=R(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==R(e)?e:e+""}var G=function(){return function(t,e,n){return e&&D(t.prototype,e),n&&D(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state={sounds:[],srcManagers:[],elements:[]},this.currentHandling=null,this.stage=n,this.game=e,this.events=new m,this.logger=new _(e,"NarraLeaf-React")}),[{key:"findElementByScene",value:function(t){return this.state.elements.find((function(e){return e.scene===t}))||null}},{key:"findElementByImage",value:function(t){return this.state.elements.find((function(e){return e.ele.images.includes(t)}))||null}},{key:"addScene",value:function(t){return this.sceneExists(t)||this.state.elements.push({scene:t,ele:this.getElementMap()}),this}},{key:"popScene",value:function(){var t=this.state.elements.pop();return t?(this.removeElements(t.scene),this):this}},{key:"removeScene",value:function(t){return this.removeElements(t),this}},{key:"getSceneElements",value:function(){return this.state.elements}},{key:"getLastScene",value:function(){var t;return(null===(t=this.state.elements[this.state.elements.length-1])||void 0===t?void 0:t.scene)||null}},{key:"sceneExists",value:function(t){return t?this.state.elements.some((function(e){return e.scene===t})):!!this.getLastScene()}},{key:"handle",value:function(t){return this.currentHandling===t||(this.currentHandling=t,t.type),this}},{key:"createText",value:function(t,e,n,r){var o,i=null===(o=this.findElementByScene(this._getLastSceneIfNot(r)))||void 0===o?void 0:o.ele.texts;if(!i)throw new Error("Scene not found");var a=this.createWaitableAction({character:e.character,sentence:e,id:t},(function(){i.splice(i.indexOf(a),1),n&&n()}));i.push(a)}},{key:"createMenu",value:function(t,e,n){var r;if(!t.choices.length)throw new Error("Menu must have at least one choice");var o=null===(r=this.findElementByScene(this._getLastSceneIfNot(n)))||void 0===r?void 0:r.ele.menus;if(!o)throw new Error("Scene not found");var i=this.createWaitableAction(t,(function(t){o.splice(o.indexOf(i),1),e&&e(t)}));o.push(i)}},{key:"createImage",value:function(t,e){var n=this._getLastSceneIfNot(e),r=this.findElementByScene(n);return r?(r.ele.images.push(t),this):this}},{key:"disposeImage",value:function(t,e){var n,r=this._getLastSceneIfNot(e),o=null===(n=this.findElementByScene(r))||void 0===n?void 0:n.ele.images;if(!o)throw new Error("Scene not found");var i=o.indexOf(t);if(-1===i)throw new Error("Image not found");return o.splice(i,1),this}},{key:"forceReset",value:function(){var t=this;this.state.elements.forEach((function(e){var n=e.scene;t.offSrcManager(n.srcManager),n._liveState.active=!1,n.events.reset()}))}},{key:"playSound",value:function(t,e){var n=t.play(),r=[t.once("end",o.bind(this)),t.once("stop",o.bind(this))];function o(){e&&e(),r.forEach((function(t){return t.off()})),this.stage.next()}return n}},{key:"getHowl",value:function(){return N.Howl}},{key:"animateImage",value:function(t,e,n,r){return this.anyEvent.apply(this,[t,e,r].concat(F(n)))}},{key:"registerSrcManager",value:function(t){return this.state.srcManagers.push(t),this}},{key:"offSrcManager",value:function(t){return this.state.srcManagers=this.state.srcManagers.filter((function(e){return e!==t})),this}},{key:"getStorable",value:function(){return this.game.getLiveGame().getStorable()}},{key:"toData",value:function(){return{scenes:this.state.elements.map((function(t){return{sceneId:t.scene.getId(),elements:{images:t.ele.images.map((function(t){return t.getId()}))}}}))}}},{key:"loadData",value:function(t,e){var n=this;if(this.state.elements=[],!this.game.getLiveGame().story)throw new Error("No story loaded");t.scenes.forEach((function(t){var r=t.sceneId,o=t.elements,i=e.get(r);if(!i)throw new Error("Scene not found, id: "+r+"\nNarraLeaf cannot find the element with the id from the saved game");var a={scene:i,ele:{images:o.images.map((function(t){if(!e.has(t))throw new Error("Image not found, id: "+t+"\nNarraLeaf cannot find the element with the id from the saved game");return e.get(t)})),menus:[],texts:[]}};n.state.elements.push(a),n.state.srcManagers.push(a.scene.srcManager)}))}},{key:"getElementMap",value:function(){return{texts:[],menus:[],images:[]}}},{key:"removeElements",value:function(t){var e=this.state.elements.findIndex((function(e){return e.scene===t}));return-1===e||this.state.elements.splice(e,1),this}},{key:"_getLastSceneIfNot",value:function(t){var e=t||this.getLastScene();if(!e||!this.sceneExists(e))throw new Error('Scene not found, please call "scene.activate()" first.');return e}},{key:"anyEvent",value:function(t,e,n){for(var r,o=this,i=arguments.length,a=new Array(i>3?i-3:0),s=3;s<i;s++)a[s-3]=arguments[s];(r=e.events).any.apply(r,[t].concat(a)).then(n).then((function(){o.stage.next()}))}},{key:"createWaitableAction",value:function(t,e){return{action:t,onClick:function(t){e&&e(t)}}}}])}();function U(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=U(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}G.EventTypes={"event:state.ready":"event:state.ready","event:state.end":"event:state.end","event:state.player.skip":"event:state.player.skip"};const H=function(){for(var t,e,n=0,r="",o=arguments.length;n<o;n++)(t=arguments[n])&&(e=U(t))&&(r&&(r+=" "),r+=e);return r};var $=r(12),z=r.n($);function W(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 Y(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)?Y(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 Y(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 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){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,K(r.key),r)}}function K(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+""}var Z=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state={width:0,height:0,minWidth:800,minHeight:450,paused:!1},this.events=new m,this.lockers=[],this.updater=null}return function(t,e,n){return e&&X(t.prototype,e),n&&X(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"update",value:function(e,n){this.state.width=e,this.state.height=n,this.events.emit(t.EventTypes["event:aspectRatio.update"],e,n)}},{key:"updateMin",value:function(t,e){this.state.minWidth=t,this.state.minHeight=e}},{key:"lock",value:function(){var t=Symbol();return this.lockers.push(t),t}},{key:"unlock",value:function(t){if(t&&!this.lockers.includes(t))throw new Error("Locker not found");return this.lockers=this.lockers.filter((function(e){return e!==t})),this.triggerUpdate(),null}},{key:"isLocked",value:function(){return!!this.lockers.length}},{key:"getStyle",value:function(){return{width:"".concat(this.state.width,"px"),height:"".concat(this.state.height,"px")}}},{key:"setUpdate",value:function(t){this.updater=t}},{key:"pause",value:function(){this.state.paused=!0,this.events.emit(t.EventTypes["event:aspectRatio.pause"])}},{key:"resume",value:function(){this.state.paused=!1,this.events.emit(t.EventTypes["event:aspectRatio.resume"])}},{key:"onUpdate",value:function(e){var n=this;return this.events.on(t.EventTypes["event:aspectRatio.update"],e),function(){n.events.off(t.EventTypes["event:aspectRatio.update"],e)}}},{key:"triggerUpdate",value:function(){this.updater&&this.updater()}}])}();Z.EventTypes={"event:aspectRatio.update":"event:aspectRatio.update","event:aspectRatio.pause":"event:aspectRatio.pause","event:aspectRatio.resume":"event:aspectRatio.resume"};var Q=(0,$.createContext)(null);function J(t){var e=t.children,n=W((0,$.useState)(new Z),1)[0];return z().createElement(Q.Provider,{value:{ratio:n}},e)}function tt(){var t=(0,$.useContext)(Q);if(!Q||!t)throw new Error("useRatio must be used within a RatioProvider");var e=W((0,$.useReducer)((function(t){return t+1}),0),2)[1],n=t.ratio;return(0,$.useEffect)((function(){return n.onUpdate((function(){e()}))}),[]),t}function et(t){var e=t.children,n=t.className,r=tt().ratio,o=r.getStyle();return z().createElement("div",{className:H("inset-0 flex items-center justify-center",n),style:{width:"100%",height:"100%",minWidth:"".concat(r.state.minWidth,"px"),minHeight:"".concat(r.state.minHeight,"px")}},z().createElement("div",{style:Object.assign(Object.assign({},o),{position:"relative"})},e))}function nt(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 rt(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)?rt(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 rt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}const ot=function(t){var e=t.text,n=t.speed,r=t.onComplete,o=t.className,i=nt((0,$.useState)(""),2),a=i[0],s=i[1],u=nt((0,$.useState)(0),2),c=u[0],l=u[1];return(0,$.useEffect)((function(){if(c<e.length){if(" "!==e[c]){var t=setTimeout((function(){s((function(t){return t+e[c]})),l((function(t){return t+1}))}),n);return function(){return clearTimeout(t)}}s((function(t){return t+" "})),l((function(t){return t+1}))}else r&&r()}),[c,e,n,r]),z().createElement("span",{className:o},a)};function it(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 at(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)?at(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 at(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 st=z().createContext(null);function ut(t){var e=t.children,n=t.game,r=new de({}),o=it((0,$.useState)(n||r),2),i=o[0],a=o[1];return z().createElement(st.Provider,{value:{game:i,setGame:a}},e)}function ct(){var t=(0,$.useContext)(st);if(!t)throw new Error("useGame must be used within a GameProvider");return t}function lt(t){return lt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lt(t)}function ft(t,e){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,dt(r.key),r)}}function dt(t){var e=function(t,e){if("object"!=lt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=lt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==lt(e)?e:e+""}var pt,ht=function(){return function(t,e,n){return e&&ft(t.prototype,e),n&&ft(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}}])}();function yt(t){return yt="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},yt(t)}function vt(t){return function(t){if(Array.isArray(t))return mt(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 mt(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)?mt(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 mt(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 gt(t,e,n){return e=wt(e),function(t,e){if(e&&("object"==yt(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,bt()?Reflect.construct(e,n||[],wt(t).constructor):e.apply(t,n))}function bt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(bt=function(){return!!t})()}function wt(t){return wt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wt(t)}function _t(t,e){return _t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_t(t,e)}function St(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function kt(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,At(r.key),r)}}function xt(t,e,n){return e&&kt(t.prototype,e),n&&kt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function At(t){var e=function(t,e){if("object"!=yt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=yt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==yt(e)?e:e+""}var Tt=Symbol("_Chained"),Et=function(){function t(e){St(this,t),this[pt]=!0,this.__actions=[],this.__self=e}return xt(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:"isChained",value:function(t){return t&&t[Tt]}},{key:"toActions",value:function(e){return e.flat(2).map((function(e){return t.isChained(e)?e.fromChained(e):e})).flat(3)}}])}();pt=Tt;var Ot=function(t){function e(){return St(this,e),gt(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&&_t(t,e)}(e,t),xt(e,[{key:"chain",value:function(t){var e=Et.isChained(this)?this:this.proxy(this,new Et(this));if(!t)return e;var n=Array.isArray(t)?t:[t];return e.push.apply(e,vt(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}}])}(ht);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 jt(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"!=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+""}function It(t,e,n){return e=Mt(e),function(t,e){if(e&&("object"==Pt(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,Lt()?Reflect.construct(e,n||[],Mt(t).constructor):e.apply(t,n))}function Lt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Lt=function(){return!!t})()}function Mt(t){return Mt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Mt(t)}function Nt(t,e){return Nt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Nt(t,e)}var Rt=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),It(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&&Nt(t,e)}(e,t),function(t,e,n){return e&&jt(t.prototype,e),n&&jt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"toData",value:function(){return null}},{key:"fromData",value:function(t){return this}},{key:"fromChained",value:function(t){return t.getActions()}}])}(Ot);function Ft(t){return Ft="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},Ft(t)}function Vt(t,e,n){return e=Bt(e),function(t,e){if(e&&("object"==Ft(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,Dt()?Reflect.construct(e,n||[],Bt(t).constructor):e.apply(t,n))}function Dt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Dt=function(){return!!t})()}function Bt(t){return Bt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Bt(t)}function Gt(t,e){return Gt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Gt(t,e)}function Ut(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ht(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,zt(r.key),r)}}function $t(t,e,n){return e&&Ht(t.prototype,e),n&&Ht(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function zt(t){var e=function(t,e){if("object"!=Ft(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ft(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ft(e)?e:e+""}var Wt=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ut(this,t),this.character=e,this.text=this.format(n),this.config=p(t.defaultConfig,r),this.id=de.getIdManager().getStringId(),this.state=y(t.defaultState)}return $t(t,[{key:"format",value:function(t){var e=[];if(Array.isArray(t))for(var n=0;n<t.length;n++)qt.isWord(t[n])?e.push(t[n]):e.push(new qt(t[n]));else e.push(qt.isWord(t)?t:new qt(t));return e}},{key:"toData",value:function(){return w(this.state,t.defaultState)?null:{state:y(this.state)}}},{key:"fromData",value:function(t){return this.state=p(this.state,t),this}},{key:"toString",value:function(){return this.text.map((function(t){return t.text})).join("")}}],[{key:"isSentence",value:function(e){return e instanceof t}},{key:"toSentence",value:function(e){return t.isSentence(e)?e:new t(null,e)}}])}();Wt.defaultConfig={color:"#000",pause:!0,voice:null},Wt.defaultState={display:!0};var Yt,qt=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ut(this,t),this.text=e,this.config=p(t.defaultConfig,n)}return $t(t,null,[{key:"isWord",value:function(e){return e instanceof t}}])}();qt.defaultConfig={},qt.defaultColor="#000",function(t){t.adv="adv",t.nvl="nvl"}(Yt||(Yt={}));var Xt=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Ut(this,e),(n=Vt(this,e)).name=t,n.config=p({},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&&Gt(t,e)}(e,t),$t(e,[{key:"say",value:function(t){var e=Array.isArray(t)?new Wt(this,t,{}):Wt.isSentence(t)?t:new Wt(this,t,{}),n=new vs(this.chain(),vs.ActionTypes.say,new Ee(de.getIdManager().getStringId()).setContent(e));return this.chain(n)}}])}(Rt);function Kt(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 Zt(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)?Zt(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 Zt(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 Qt(t){var e,n=t.action,r=t.onClick,o=t.useTypeEffect,i=void 0===o||o,a=t.className,s=t.state,u=n.sentence,c=n.character,l=Kt((0,$.useState)(0),2),f=l[0],d=l[1],p=Kt((0,$.useState)(!1),2),h=p[0],y=p[1],m=ct().game,g=function(){d((function(t){return t+1})),f===u.text.length-1&&y(!0)};return(0,$.useEffect)((function(){if(window){var t=function(t){m.config.elements.say.nextKey.includes(t.key)&&(h?r&&r():y(!0))};return window.addEventListener("keyup",t),function(){window.removeEventListener("keyup",t)}}console.warn("Failed to add event listener, window is not available\nat Say.tsx: onElementClick")}),[h]),(0,$.useEffect)((function(){var t=s.events.onEvents([{type:G.EventTypes["event:state.player.skip"],listener:s.events.on(G.EventTypes["event:state.player.skip"],(function(){s.logger.log("NarraLeaf-React: Say","Skipped"),y(!0),r&&r()}))}]);return function(){t.cancel()}})),z().createElement(et,{className:"absolute"},u.state.display&&(c&&c.config.mode!==Xt.Modes.adv?z().createElement(z().Fragment,null," "):z().createElement("div",{className:H("absolute flex items-center justify-center bottom-0 w-[calc(100%-40px)] h-[calc(33%-40px)] m-4 bg-white",m.config.elementStyles.say.container,a),onClick:function(){h?r&&r():y(!0)}},z().createElement("div",{className:H("absolute top-0 left-0 p-1.25 rounded-br-md m-4",m.config.elementStyles.say.nameText)},(null===(e=u.character)||void 0===e?void 0:e.name)||""),z().createElement("div",{className:H("text-center max-w-[80%] mx-auto",m.config.elementStyles.say.textContainer)},u.text.map((function(t,e){var n=t.config.color||u.config.color||qt.defaultColor;return h?z().createElement("span",{key:e,style:{color:"string"==typeof n?n:v(n)},className:H(m.config.elementStyles.say.textSpan)},t.text):e>f?null:z().createElement("span",{key:e,style:{color:v(n)},className:H(m.config.elementStyles.say.textSpan)},i?z().createElement(ot,{text:t.text,onComplete:e===f?g:void 0,speed:m.config.elements.say.textInterval,className:H(m.config.elementStyles.say.textSpan)}):t.text)}))))))}function Jt(t){var e=t.sentence,n=t.className;return z().createElement(z().Fragment,null,e.text.map((function(t,r){var o=t.config.color||e.config.color||qt.defaultColor;return z().createElement("span",{key:r,style:{color:v(o)},className:n},t.text)})))}Xt.Modes=Yt,Xt.defaultConfig={mode:Yt.adv};var te={say:Qt,menu:function(t){var e=t.prompt,n=t.choices,r=t.afterChoose,o=t.state,i=ct().game,a=i.config.elements.say.use;return z().createElement(z().Fragment,null,z().createElement(et,{className:"absolute"},z().createElement("div",{className:"absolute flex flex-col items-center justify-center min-w-full w-full h-full"},e&&z().createElement(a,{state:o,action:{sentence:e,character:null},useTypeEffect:!1,className:"z-10"}))),z().createElement(et,{className:"absolute"},z().createElement("div",{className:H("absolute flex flex-col items-center justify-center min-w-full w-full h-full",i.config.elementStyles.menu.container)},z().createElement("div",{className:"p-4 rounded-lg w-full z-20"},z().createElement("div",{className:"flex flex-col items-center mt-4 w-full"},n.map((function(t,e){return z().createElement("button",{key:e,className:H("bg-white text-black p-2 mt-2 w-1/2",i.config.elementStyles.menu.choiceButton),onClick:function(){return function(t){r(t)}(t)}},z().createElement(Jt,{key:e,sentence:t.prompt,className:H(i.config.elementStyles.menu.choiceButtonText)}))})))))))}};function ee(t){return ee="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},ee(t)}function ne(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function re(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,ie(r.key),r)}}function oe(t,e,n){return e&&re(t.prototype,e),n&&re(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function ie(t){var e=function(t,e){if("object"!=ee(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ee(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ee(e)?e:e+""}function ae(t,e,n){return e=ue(e),function(t,e){if(e&&("object"==ee(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,se()?Reflect.construct(e,n||[],ue(t).constructor):e.apply(t,n))}function se(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(se=function(){return!!t})()}function ue(t){return ue=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ue(t)}function ce(t,e){return ce=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ce(t,e)}var le,fe=function(t){function e(){var t;return ne(this,e),(t=ae(this,e,arguments)).id=0,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&&ce(t,e)}(e,t),oe(e,[{key:"getId",value:function(){return this.id++}},{key:"getStringId",value:function(){return(this.id++).toString()}},{key:"prefix",value:function(t,e){return t+(arguments.length>2&&void 0!==arguments[2]?arguments[2]:":")+e}}])}(function(){var t=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return function(t,e,n){return e&&L(t.prototype,e),n&&L(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,null,[{key:"getInstance",value:function(){return t._instance||(t._instance=new this),t._instance}}])}();return t._instance=null,t}());!function(t){t.game="game"}(le||(le={}));var de=function(){return oe((function t(e){ne(this,t),this.liveGame=null,this.config=p(t.DefaultConfig,e)}),[{key:"useComponent",value:function(t,e){if(!Object.keys(te).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 pe(this)}}],[{key:"getIdManager",value:function(){return fe.getInstance()}}])}();de.defaultSettings={volume:1},de.ComponentTypes={say:"say",menu:"menu"},de.DefaultConfig={version:"v0.0.0",player:{contentContainerId:"__narraleaf_content",aspectRatio:16/9,minWidth:800,minHeight:450,width:"100%",height:"100%",skipKey:["Control"],skipInterval:100},elements:{say:{nextKey:[" "],textInterval:50,use:te.say},img:{slowLoadWarning:!0,slowLoadThreshold:2e3},menu:{use:te.menu}},elementStyles:{say:{container:"",nameText:"",textContainer:"",textSpan:""},menu:{container:"",choiceButton:"",choiceButtonText:""}},app:{debug:!1,logger:{log:!1,info:!1,warn:!0,error:!0,debug:!1,trace:!1}}},de.GameSettingsNamespace=le;var pe=function(){function t(e){ne(this,t),this.currentSavedGame=null,this.story=null,this.lockedAwaiting=null,this._lockedCount=0,this.currentAction=null,this.game=e,this.storable=new C,this.initNamespaces()}return oe(t,[{key:"initNamespaces",value:function(){return this.storable.addNamespace(new j(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:"newGame",value:function(){var t,e;this.initNamespaces(),this.currentAction=(null===(e=null===(t=this.story)||void 0===t?void 0:t.entryScene)||void 0===e?void 0:e.sceneRoot)||null;var n=this.getNewSavedGame();return n.name="NewGame-"+Date.now(),this.currentSavedGame=n,this}},{key:"deserialize",value:function(t,e){var n,r=e.gameState,o=this.story;if(!o)throw new Error("No story loaded");this.reset({gameState:r});var i=new Map,a=new Map,s=t.game,u=s.store,c=s.stage,l=s.elementStates,f=s.currentAction;if(o.forEachChild((null===(n=o.entryScene)||void 0===n?void 0:n.sceneRoot)||[],(function(t){i.set(t.getId(),t),a.set(t.callee.getId(),t.callee)})),this.storable.load(u),l.forEach((function(t){var e=t.id,n=t.data,r=a.get(e);if(!r)throw new Error("Element not found, id: "+e+"\nNarraLeaf cannot find the element with the id from the saved game");r.fromData(n)})),this.currentSavedGame=t,r.loadData(c,a),f){var d=i.get(f);if(!d)throw new Error("Action not found, id: "+f+"\nNarraLeaf cannot find the action with the id from the saved game");this.currentAction=d}}},{key:"reset",value:function(t){var e,n,r=t.gameState;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:"serialize",value:function(t){var e,n,r,o=t.gameState,i=this.story;if(!i)throw new Error("No story loaded");var a=this.storable.toData(),s=o.toData(),u=(null===(e=this.getCurrentAction())||void 0===e?void 0:e.getId())||null,c=i.getAllElementStates();return{name:(null===(n=this.currentSavedGame)||void 0===n?void 0:n.name)||"",meta:{created:(null===(r=this.currentSavedGame)||void 0===r?void 0:r.meta.created)||Date.now(),updated:Date.now()},game:{store:a,stage:s,currentAction:u,elementStates:c}}}},{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,r;if(!this.story)throw new Error("No story loaded");if(this.lockedAwaiting){if(!this.lockedAwaiting.solved){if(this._lockedCount++,this._lockedCount>1e3)throw new Error("Locked awaiting");return this.lockedAwaiting}var o=this.lockedAwaiting.result;return this.currentAction=(null===(e=null==o?void 0:o.node)||void 0===e?void 0:e.action)||null,t.logger.debug("next action",o),this.lockedAwaiting=null,o||null}if(!this.currentAction)return t.events.emit(G.EventTypes["event:state.end"]),t.logger.warn("LiveGame","No current action"),null;var i=this.currentAction.executeAction(t);return h.isAwaitable(i)?(this.lockedAwaiting=i,i):(t.logger.debug("next action",i),this._lockedCount=0,this.currentAction=(null===(r=null===(n=i.node)||void 0===n?void 0:n.getChild())||void 0===r?void 0:r.action)||null,i)}},{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,o=e.executeAction(t);return h.isAwaitable(o)?o:(null===(r=null===(n=null==o?void 0:o.node)||void 0===n?void 0:n.getChild())||void 0===r?void 0:r.action)||null}},{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}}}}])}();pe.DefaultNamespaces={game:{}},pe.GameSpacesKey={game:"game"};function he(t){return he="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},he(t)}function ye(t,e,n){return e=me(e),function(t,e){if(e&&("object"==he(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){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&&be(t,e)}function be(t,e){return be=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},be(t,e)}function we(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _e(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,ke(r.key),r)}}function Se(t,e,n){return e&&_e(t.prototype,e),n&&_e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function ke(t){var e=function(t,e){if("object"!=he(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=he(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==he(e)?e:e+""}var xe;!function(t){t.TreeNode="TreeNode",t.ContentNode="ContentNode"}(xe||(xe={}));var Ae,Te=function(){return Se((function t(e,n){we(this,t),this.id=e,this.type=n,this.content=void 0}),[{key:"setContent",value:function(t){return this.content=t,this}},{key:"getContent",value:function(){return this.content}}])}(),Ee=function(t){function e(t,n,r,o){var i;return we(this,e),(i=ye(this,e,[de.getIdManager().prefix("node",t,"-"),xe.ContentNode])).child=o||null,i.parent=r||null,i.action=n||null,i}return ge(e,t),Se(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:"setInitChild",value:function(t){return this.initChild=t,this.setChild(t)}},{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()}}])}(Te),Oe={center:"center",left:"left",right:"right"};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 je(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ce(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,Me(r.key),r)}}function Ie(t,e,n){return e&&Ce(t.prototype,e),n&&Ce(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Le(t,e,n){return(e=Me(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Me(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(t){t.Left="left",t.Center="center",t.Right="right"}(Ae||(Ae={}));var Ne=Le(Le(Le({},Ae.Left,"33.33%"),Ae.Center,"50%"),Ae.Right,"66.66%"),Re=function(){function t(){je(this,t)}return Ie(t,null,[{key:"isUnknown",value:function(e){return e===t.Unknown}},{key:"wrap",value:function(t){return Object.assign({left:"auto",top:"auto",right:"auto",bottom:"auto"},t)}},{key:"D2PositionToCSS",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.calc(t.y,t.yoffset),o=this.calc(t.x,t.xoffset),i=n?{bottom:r}:{top:r},a=e?{right:o}:{left:o};return this.wrap(Object.assign(Object.assign({},i),a))}},{key:"calc",value:function(e,n){if(!e||t.isUnknown(e))return"auto";if(void 0===n||t.isUnknown(n))return"".concat(e);var r="number"==typeof e?"".concat(e,"px"):e;return"calc(".concat(r," + ").concat(n,"px)")}},{key:"toCoord2D",value:function(t){if(Fe.isCommonPositionType(t))return Ve.fromCommonPosition(t);if(Ve.isCoord2DPosition(t))return t;if(De.isAlignPosition(t))return Ve.fromAlignPosition(t);if("object"===Pe(t)&&["x","y","xoffset","yoffset"].some((function(e){return e in t})))return new Ve(t);throw new Error("Invalid position type")}},{key:"mergePosition",value:function(t,e){var n=this.toCoord2D(t),r=this.toCoord2D(e);return Ve.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(Ae).includes(t)}},{key:"isRawCoord2DPosition",value:function(t){return"object"===Pe(t)&&("x"in t||"y"in t||"xoffset"in t||"yoffset"in t)}},{key:"isRawAlignPosition",value:function(t){return"object"===Pe(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 Fe||t instanceof Ve||t instanceof De}},{key:"rawPositionToCoord2D",value:function(t){if(this.isRawCommonPositionType(t))return Ve.fromCommonPosition(new Fe(t));if(this.isRawCoord2DPosition(t))return new Ve(t);if(this.isRawAlignPosition(t))return Ve.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")}}])}();Re.Unknown=Symbol("Unknown");var Fe=function(){function t(e){je(this,t),this.position=e}return Ie(t,[{key:"toCSS",value:function(){return{x:Ne[this.position],y:"50%",xoffset:0,yoffset:0}}}],[{key:"isCommonPositionType",value:function(e){return e instanceof t}}])}();Fe.Positions=Ae;var Ve=function(){function t(e,n){je(this,t),"object"===Pe(e)?(this.x=e.x||Re.Unknown,this.y=e.y||Re.Unknown,this.xoffset=e.xoffset||Re.Unknown,this.yoffset=e.yoffset||Re.Unknown):(this.x=e||Re.Unknown,this.y=n||Re.Unknown,this.xoffset=Re.Unknown,this.yoffset=Re.Unknown)}return Ie(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:Ne[e.position],y:"50%"})}},{key:"fromAlignPosition",value:function(e){return new t({x:Re.isUnknown(e.xalign)?Re.Unknown:"".concat(100*e.xalign,"%"),y:Re.isUnknown(e.yalign)?Re.Unknown:"".concat(100*e.yalign,"%"),xoffset:e.xoffset,yoffset:e.yoffset})}},{key:"merge",value:function(e,n){return new t({x:Re.isUnknown(n.x)?e.x:n.x,y:Re.isUnknown(n.y)?e.y:n.y,xoffset:Re.isUnknown(n.xoffset)?e.xoffset:n.xoffset,yoffset:Re.isUnknown(n.yoffset)?e.yoffset:n.yoffset})}}])}(),De=function(){function t(e,n){je(this,t),"object"===Pe(e)?(this.xalign=e.xalign||Re.Unknown,this.yalign=e.yalign||Re.Unknown,this.xoffset=e.xoffset||Re.Unknown,this.yoffset=e.yoffset||Re.Unknown):(this.xalign=e||Re.Unknown,this.yalign=n||Re.Unknown,this.xoffset=Re.Unknown,this.yoffset=Re.Unknown)}return Ie(t,[{key:"toCSS",value:function(){return{x:Re.isUnknown(this.xalign)?this.xalign:"".concat(100*this.xalign,"%"),y:Re.isUnknown(this.yalign)?this.yalign:"".concat(100*this.yalign,"%"),xoffset:this.xoffset,yoffset:this.yoffset}}}],[{key:"isAlignPosition",value:function(e){return e instanceof t}}])}();const Be=t=>t;let Ge=Be,Ue=Be;function He(t,e,n){var r;if("string"==typeof t){let o=document;e&&(Ue(Boolean(e.current),"Scope provided, but no element detected."),o=e.current),n?(null!==(r=n[t])&&void 0!==r||(n[t]=o.querySelectorAll(t)),t=n[t]):t=o.querySelectorAll(t)}else t instanceof Element&&(t=[t]);return Array.from(t||[])}const $e=new WeakMap,ze=!1,We=!1;const Ye=["read","resolveKeyframes","update","preRender","render","postRender"];function qe(t,e){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=Ye.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:d}=a,p=()=>{const i=We?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),d.process(o),o.isProcessing=!1,n&&e&&(r=!1,t(p))};return{schedule:Ye.reduce(((e,i)=>{const s=a[i];return e[i]=(e,i=!1,a=!1)=>(n||(n=!0,r=!0,o.isProcessing||t(p)),s.schedule(e,i,a)),e}),{}),cancel:t=>{for(let e=0;e<Ye.length;e++)a[Ye[e]].cancel(t)},state:o,steps:a}}const{schedule:Xe,cancel:Ke,state:Ze,steps:Qe}=qe("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:Be,!0);function Je(t){let e;return()=>(void 0===e&&(e=t()),e)}const tn=Je((()=>void 0!==window.ScrollTimeline));class en{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}then(t,e){return Promise.all(this.animations).then(t).catch(e)}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t){const e=this.animations.map((e=>{if(!tn()||!e.attachTimeline)return e.pause(),function(t,e){let n;const r=()=>{const{currentTime:r}=e,o=(null===r?0:r.value)/100;n!==o&&t(o),n=o};return Xe.update(r,!0),()=>Ke(r)}((t=>{e.time=e.duration*t}),t);e.attachTimeline(t)}));return()=>{e.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;e<this.animations.length;e++)t=Math.max(t,this.animations[e].duration);return t}runAll(t){this.animations.forEach((e=>e[t]()))}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const nn=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],rn=new Set(nn),on=t=>1e3*t,an=t=>t/1e3,sn={type:"spring",stiffness:500,damping:25,restSpeed:10},un={type:"keyframes",duration:.8},cn={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},ln=(t,{keyframes:e})=>e.length>2?un:rn.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:sn:cn;function fn(t,e){return t[e]||t.default||t}const dn=!1,pn=t=>null!==t;function hn(t,{repeat:e,repeatType:n="loop"},r){const o=t.filter(pn),i=e&&"loop"!==n&&e%2==1?0:o.length-1;return i&&void 0!==r?r:o[i]}const yn=t=>/^0[^.\s]+$/u.test(t);const vn=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),mn=t=>e=>"string"==typeof e&&e.startsWith(t),gn=mn("--"),bn=mn("var(--"),wn=t=>!!bn(t)&&_n.test(t.split("/*")[0].trim()),_n=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Sn=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function kn(t,e,n=1){Ue(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=Sn.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 vn(t)?parseFloat(t):t}return wn(o)?kn(o,e,n+1):o}const xn=(t,e,n)=>n>e?e:n<t?t:n,An={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},Tn={...An,transform:t=>xn(0,1,t)},En={...An,default:1},On=t=>Math.round(1e5*t)/1e5,Pn=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,jn=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,Cn=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;function In(t){return"string"==typeof t}const Ln=t=>({test:e=>In(e)&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),Mn=Ln("deg"),Nn=Ln("%"),Rn=Ln("px"),Fn=Ln("vh"),Vn=Ln("vw"),Dn={...Nn,parse:t=>Nn.parse(t)/100,transform:t=>Nn.transform(100*t)},Bn=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),Gn=t=>t===An||t===Rn,Un=(t,e)=>parseFloat(t.split(", ")[e]),Hn=(t,e)=>(n,{transform:r})=>{if("none"===r||!r)return 0;const o=r.match(/^matrix3d\((.+)\)$/u);if(o)return Un(o[1],e);{const e=r.match(/^matrix\((.+)\)$/u);return e?Un(e[1],t):0}},$n=new Set(["x","y","z"]),zn=nn.filter((t=>!$n.has(t)));const Wn={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:Hn(4,13),y:Hn(5,14)};Wn.translateX=Wn.x,Wn.translateY=Wn.y;const Yn=t=>e=>e.test(t),qn=[An,Rn,Nn,Mn,Vn,Fn,{test:t=>"auto"===t,parse:t=>t}],Xn=t=>qn.find(Yn(t)),Kn=new Set;let Zn=!1,Qn=!1;function Jn(){if(Qn){const t=Array.from(Kn).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 zn.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)}))}Qn=!1,Zn=!1,Kn.forEach((t=>t.complete())),Kn.clear()}function tr(){Kn.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(Qn=!0)}))}class er{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?(Kn.add(this),Zn||(Zn=!0,Xe.read(tr),Xe.resolveKeyframes(Jn))):(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),Kn.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Kn.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const nr=(t,e)=>n=>Boolean(In(n)&&Cn.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),rr=(t,e,n)=>r=>{if(!In(r))return r;const[o,i,a,s]=r.match(Pn);return{[t]:parseFloat(o),[e]:parseFloat(i),[n]:parseFloat(a),alpha:void 0!==s?parseFloat(s):1}},or={...An,transform:t=>Math.round((t=>xn(0,255,t))(t))},ir={test:nr("rgb","red"),parse:rr("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+or.transform(t)+", "+or.transform(e)+", "+or.transform(n)+", "+On(Tn.transform(r))+")"};const ar={test:nr("#"),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:ir.transform},sr={test:nr("hsl","hue"),parse:rr("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+Nn.transform(On(e))+", "+Nn.transform(On(n))+", "+On(Tn.transform(r))+")"},ur={test:t=>ir.test(t)||ar.test(t)||sr.test(t),parse:t=>ir.test(t)?ir.parse(t):sr.test(t)?sr.parse(t):ar.parse(t),transform:t=>In(t)?t:t.hasOwnProperty("red")?ir.transform(t):sr.transform(t)};const cr="number",lr="color",fr="var",dr="var(",pr="${}",hr=/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 yr(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},o=[];let i=0;const a=e.replace(hr,(t=>(ur.test(t)?(r.color.push(i),o.push(lr),n.push(ur.parse(t))):t.startsWith(dr)?(r.var.push(i),o.push(fr),n.push(t)):(r.number.push(i),o.push(cr),n.push(parseFloat(t))),++i,pr))).split(pr);return{values:n,split:a,indexes:r,types:o}}function vr(t){return yr(t).values}function mr(t){const{split:e,types:n}=yr(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===cr?On(t[i]):e===lr?ur.transform(t[i]):t[i]}return o}}const gr=t=>"number"==typeof t?0:t;const br={test:function(t){var e,n;return isNaN(t)&&In(t)&&((null===(e=t.match(Pn))||void 0===e?void 0:e.length)||0)+((null===(n=t.match(jn))||void 0===n?void 0:n.length)||0)>0},parse:vr,createTransformer:mr,getAnimatableNone:function(t){const e=vr(t);return mr(t)(e.map(gr))}},wr=new Set(["brightness","contrast","saturate","opacity"]);function _r(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[r]=n.match(Pn)||[];if(!r)return t;const o=n.replace(r,"");let i=wr.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+o+")"}const Sr=/\b([a-z-]*)\(.*?\)/gu,kr={...br,getAnimatableNone:t=>{const e=t.match(Sr);return e?e.map(_r).join(" "):t}},xr={...An,transform:Math.round},Ar={borderWidth:Rn,borderTopWidth:Rn,borderRightWidth:Rn,borderBottomWidth:Rn,borderLeftWidth:Rn,borderRadius:Rn,radius:Rn,borderTopLeftRadius:Rn,borderTopRightRadius:Rn,borderBottomRightRadius:Rn,borderBottomLeftRadius:Rn,width:Rn,maxWidth:Rn,height:Rn,maxHeight:Rn,size:Rn,top:Rn,right:Rn,bottom:Rn,left:Rn,padding:Rn,paddingTop:Rn,paddingRight:Rn,paddingBottom:Rn,paddingLeft:Rn,margin:Rn,marginTop:Rn,marginRight:Rn,marginBottom:Rn,marginLeft:Rn,rotate:Mn,rotateX:Mn,rotateY:Mn,rotateZ:Mn,scale:En,scaleX:En,scaleY:En,scaleZ:En,skew:Mn,skewX:Mn,skewY:Mn,distance:Rn,translateX:Rn,translateY:Rn,translateZ:Rn,x:Rn,y:Rn,z:Rn,perspective:Rn,transformPerspective:Rn,opacity:Tn,originX:Dn,originY:Dn,originZ:Rn,zIndex:xr,backgroundPositionX:Rn,backgroundPositionY:Rn,fillOpacity:Tn,strokeOpacity:Tn,numOctaves:xr},Tr={...Ar,color:ur,backgroundColor:ur,outlineColor:ur,fill:ur,stroke:ur,borderColor:ur,borderTopColor:ur,borderRightColor:ur,borderBottomColor:ur,borderLeftColor:ur,filter:kr,WebkitFilter:kr},Er=t=>Tr[t];function Or(t,e){let n=Er(t);return n!==kr&&(n=br),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Pr=new Set(["auto","none","0"]);class jr extends er{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(),wn(r))){const o=kn(r,e.current);void 0!==o&&(t[n]=o),n===t.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!Bn.has(n)||2!==t.length)return;const[r,o]=t,i=Xn(r),a=Xn(o);if(i!==a)if(Gn(i)&&Gn(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||yn(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&&!Pr.has(e)&&yr(e).values.length&&(r=t[o]),o++}if(r&&n)for(const o of e)t[o]=Or(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=Wn[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]=Wn[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 Cr;function Ir(){Cr=void 0}const Lr={now:()=>(void 0===Cr&&Lr.set(Ze.isProcessing||We?Ze.timestamp:performance.now()),Cr),set:t=>{Cr=t,queueMicrotask(Ir)}},Mr=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!br.test(t)&&"0"!==t||t.startsWith("url(")));class Nr{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=Lr.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||(tr(),Jn()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=Lr.now(),this.hasAttemptedResolve=!0;const{name:n,type:r,velocity:o,delay:i,onComplete:a,onUpdate:s,isGenerator:u}=this.options;if(!u&&!function(t,e,n,r){const o=t[0];if(null===o)return!1;if("display"===e||"visibility"===e)return!0;const i=t[t.length-1],a=Mr(o,e),s=Mr(i,e);return Ge(a===s,`You are trying to animate ${e} from "${o}" to "${i}". ${o} is not an animatable value - to enable this animation set ${o} to a value animatable to ${i} via the \`style\` property.`),!(!a||!s)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}(t)||"spring"===n&&r)}(t,n,r,o)){if(dn||!i)return null==s||s(hn(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 Rr(t,e){return e?t*(1e3/e):0}const Fr=5;function Vr(t,e,n){const r=Math.max(e-Fr,0);return Rr(n-t(r),e-r)}const Dr=.001,Br=.01,Gr=10,Ur=.05,Hr=1;function $r({duration:t=800,bounce:e=.25,velocity:n=0,mass:r=1}){let o,i;Ge(t<=on(Gr),"Spring duration must be 10 seconds or less");let a=1-e;a=xn(Ur,Hr,a),t=xn(Br,Gr,an(t)),a<1?(o=e=>{const r=e*a,o=r*t,i=r-n,s=Wr(e,a),u=Math.exp(-o);return Dr-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=Wr(Math.pow(e,2),a);return(-o(e)+Dr>0?-1:1)*((i-s)*u)/c}):(o=e=>Math.exp(-e*t)*((e-n)*t+1)-Dr,i=e=>Math.exp(-e*t)*(t*t*(n-e)));const s=function(t,e,n){let r=n;for(let n=1;n<zr;n++)r-=t(r)/e(r);return r}(o,i,5/t);if(t=on(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 zr=12;function Wr(t,e){return t*Math.sqrt(1-e*e)}const Yr=["duration","bounce"],qr=["stiffness","damping","mass"];function Xr(t,e){return e.some((e=>void 0!==t[e]))}function Kr({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:d}=function(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!Xr(t,qr)&&Xr(t,Yr)){const n=$r(t);e={...e,...n,mass:1},e.isResolvedFromDuration=!0}return e}({...r,velocity:-an(r.velocity||0)}),p=f||0,h=u/(2*Math.sqrt(s*c)),y=i-o,v=an(Math.sqrt(s/c)),m=Math.abs(y)<5;let g;if(n||(n=m?.01:2),e||(e=m?.005:.5),h<1){const t=Wr(v,h);g=e=>{const n=Math.exp(-h*v*e);return i-n*((p+h*v*y)/t*Math.sin(t*e)+y*Math.cos(t*e))}}else if(1===h)g=t=>i-Math.exp(-v*t)*(y+(p+v*y)*t);else{const t=v*Math.sqrt(h*h-1);g=e=>{const n=Math.exp(-h*v*e),r=Math.min(t*e,300);return i-n*((p+h*v*y)*Math.sinh(r)+t*y*Math.cosh(r))/t}}return{calculatedDuration:d&&l||null,next:t=>{const r=g(t);if(d)a.done=t>=l;else{let o=0;h<1&&(o=0===t?on(p):Vr(g,t,r));const s=Math.abs(o)<=n,u=Math.abs(i-r)<=e;a.done=s&&u}return a.value=a.done?i:r,a}}}function Zr({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],d={done:!1,value:f},p=t=>void 0===s?u:void 0===u||Math.abs(s-t)<Math.abs(u-t)?s:u;let h=n*e;const y=f+h,v=void 0===a?y:a(y);v!==y&&(h=v-f);const m=t=>-h*Math.exp(-t/r),g=t=>v+m(t),b=t=>{const e=m(t),n=g(t);d.done=Math.abs(e)<=c,d.value=d.done?v:n};let w,_;const S=t=>{var e;(e=d.value,void 0!==s&&e<s||void 0!==u&&e>u)&&(w=t,_=Kr({keyframes:[d.value,p(d.value)],velocity:Vr(g,t,d.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),d)}}}const Qr=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Jr=1e-7,to=12;function eo(t,e,n,r){if(t===e&&n===r)return Be;const o=e=>function(t,e,n,r,o){let i,a,s=0;do{a=e+(n-e)/2,i=Qr(a,r,o)-t,i>0?n=a:e=a}while(Math.abs(i)>Jr&&++s<to);return a}(e,0,1,t,n);return t=>0===t||1===t?t:Qr(o(t),e,r)}const no=eo(.42,0,1,1),ro=eo(0,0,.58,1),oo=eo(.42,0,.58,1),io=t=>Array.isArray(t)&&"number"!=typeof t[0],ao=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,so=t=>e=>1-t(1-e),uo=t=>1-Math.sin(Math.acos(t)),co=so(uo),lo=ao(uo),fo=eo(.33,1.53,.69,.99),po=so(fo),ho={linear:Be,easeIn:no,easeInOut:oo,easeOut:ro,circIn:uo,circInOut:lo,circOut:co,backIn:po,backInOut:ao(po),backOut:fo,anticipate:t=>(t*=2)<1?.5*po(t):.5*(2-Math.pow(2,-10*(t-1)))},yo=t=>{if(Array.isArray(t)){Ue(4===t.length,"Cubic bezier arrays must contain four numerical values.");const[e,n,r,o]=t;return eo(e,n,r,o)}return"string"==typeof t?(Ue(void 0!==ho[t],`Invalid easing type '${t}'`),ho[t]):t},vo=(t,e)=>n=>e(t(n)),mo=(...t)=>t.reduce(vo),go=(t,e,n)=>{const r=e-t;return 0===r?1:(n-t)/r},bo=(t,e,n)=>t+(e-t)*n;function wo(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 _o(t,e){return n=>n>0?e:t}const So=(t,e,n)=>{const r=t*t,o=n*(e*e-r)+r;return o<0?0:Math.sqrt(o)},ko=[ar,ir,sr];function xo(t){const e=(n=t,ko.find((t=>t.test(n))));var n;if(Ge(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===sr&&(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=wo(s,r,t+1/3),i=wo(s,r,t),a=wo(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 Ao=(t,e)=>{const n=xo(t),r=xo(e);if(!n||!r)return _o(t,e);const o={...n};return t=>(o.red=So(n.red,r.red,t),o.green=So(n.green,r.green,t),o.blue=So(n.blue,r.blue,t),o.alpha=bo(n.alpha,r.alpha,t),ir.transform(o))},To=new Set(["none","hidden"]);function Eo(t,e){return n=>bo(t,e,n)}function Oo(t){return"number"==typeof t?Eo:"string"==typeof t?wn(t)?_o:ur.test(t)?Ao:Co:Array.isArray(t)?Po:"object"==typeof t?ur.test(t)?Ao:jo:_o}function Po(t,e){const n=[...t],r=n.length,o=t.map(((t,n)=>Oo(t)(t,e[n])));return t=>{for(let e=0;e<r;e++)n[e]=o[e](t);return n}}function jo(t,e){const n={...t,...e},r={};for(const o in n)void 0!==t[o]&&void 0!==e[o]&&(r[o]=Oo(t[o])(t[o],e[o]));return t=>{for(const e in r)n[e]=r[e](t);return n}}const Co=(t,e)=>{const n=br.createTransformer(e),r=yr(t),o=yr(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?To.has(t)&&!o.values.length||To.has(e)&&!r.values.length?function(t,e){return To.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):mo(Po(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):(Ge(!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.`),_o(t,e))};function Io(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return bo(t,e,n);return Oo(t)(t,e)}function Lo(t,e,{clamp:n=!0,ease:r,mixer:o}={}){const i=t.length;if(Ue(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||Io,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]||Be:e;i=mo(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=go(t[n],t[n+1],e);return a[n](r)};return n?e=>u(xn(t[0],t[i-1],e)):u}function Mo(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const o=go(0,e,r);t.push(bo(n,1,o))}}function No(t){const e=[0];return Mo(e,t.length-1),e}function Ro({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const o=io(r)?r.map(yo):yo(r),i={done:!1,value:e[0]},a=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:No(e),t),s=Lo(a,e,{ease:Array.isArray(o)?o:(u=e,c=o,u.map((()=>c||oo)).splice(0,u.length-1))});var u,c;return{calculatedDuration:t,next:e=>(i.value=s(e),i.done=e>=t,i)}}const Fo=2e4;function Vo(t){let e=0;let n=t.next(e);for(;!n.done&&e<Fo;)e+=50,n=t.next(e);return e>=Fo?1/0:e}const Do=t=>{const e=({timestamp:e})=>t(e);return{start:()=>Xe.update(e,!0),stop:()=>Ke(e),now:()=>Ze.isProcessing?Ze.timestamp:Lr.now()}},Bo={decay:Zr,inertia:Zr,tween:Ro,keyframes:Ro,spring:Kr},Go=t=>t/100;class Uo extends Nr{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)||er;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=Bo[e]||Ro;let s,u;a!==Ro&&"number"!=typeof t[0]&&(s=mo(Go,Io(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=Vo(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:d,repeatType:p,repeatDelay:h,onUpdate:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-c/this.speed,this.startTime)),e?this.currentTime=t:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const v=this.currentTime-f*(this.speed>=0?1:-1),m=this.speed>=0?v<0:v>c;this.currentTime=Math.max(v,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=c);let g=this.currentTime,b=o;if(d){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,d+1);Boolean(e%2)&&("reverse"===p?(n=1-n,h&&(n-=h/l)):"mirror"===p&&(b=i)),g=xn(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=hn(s,this.options,r)),y&&y(w.value),S&&this.finish(),w}get duration(){const{resolved:t}=this;return t?an(t.calculatedDuration):0}get time(){return an(this.currentTime)}set time(t){t=on(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=an(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=Do,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 Ho=new Set(["opacity","clipPath","filter","transform"]),$o=t=>Array.isArray(t)&&"number"==typeof t[0];function zo(t){return Boolean(!t||"string"==typeof t&&t in Yo||$o(t)||Array.isArray(t)&&t.every(zo))}const Wo=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,Yo={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Wo([0,.65,.55,1]),circOut:Wo([.55,0,1,.45]),backIn:Wo([.31,.01,.66,-.59]),backOut:Wo([.33,1.53,.69,.99])};function qo(t){return Xo(t)||Yo.easeOut}function Xo(t){return t?$o(t)?Wo(t):Array.isArray(t)?t.map(qo):Yo[t]:void 0}const Ko=Je((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));class Zo extends Nr{constructor(t){super(t);const{name:e,motionValue:n,element:r,keyframes:o}=this.options;this.resolver=new jr(o,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}initPlayback(t,e){var n;let{duration:r=300,times:o,ease:i,type:a,motionValue:s,name:u,startTime:c}=this.options;if(!(null===(n=s.owner)||void 0===n?void 0:n.current))return!1;if(function(t){return"spring"===t.type||!zo(t.ease)}(this.options)){const{onComplete:e,onUpdate:n,motionValue:s,element:u,...c}=this.options,l=function(t,e){const n=new Uo({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const o=[];let i=0;for(;!r.done&&i<2e4;)r=n.sample(i),o.push(r.value),i+=10;return{times:void 0,keyframes:o,duration:i-10,ease:"linear"}}(t,c);1===(t=l.keyframes).length&&(t[1]=t[0]),r=l.duration,o=l.times,i=l.ease,a="keyframes"}const l=function(t,e,n,{delay:r=0,duration:o=300,repeat:i=0,repeatType:a="loop",ease:s,times:u}={}){const c={[e]:n};u&&(c.offset=u);const l=Xo(s);return Array.isArray(l)&&(c.easing=l),t.animate(c,{delay:r,duration:o,easing:Array.isArray(l)?"linear":l,fill:"both",iterations:i+1,direction:"reverse"===a?"alternate":"normal"})}(s.owner.current,u,t,{...this.options,duration:r,times:o,ease:i});return l.startTime=null!=c?c:this.calcStartTime(),this.pendingTimeline?(l.timeline=this.pendingTimeline,this.pendingTimeline=void 0):l.onfinish=()=>{const{onComplete:n}=this.options;s.set(hn(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 an(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return an(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.currentTime=on(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 Be;const{animation:n}=e;n.timeline=t,n.onfinish=null}else this.pendingTimeline=t;return Be}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 Uo({...c,keyframes:n,duration:r,type:o,ease:i,times:a,isGenerator:!0}),f=on(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 Ko()&&n&&Ho.has(n)&&e&&e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate&&!r&&"mirror"!==o&&0!==i&&"inertia"!==a}}const Qo=(t,e,n,r={},o,i,a)=>s=>{const u=fn(r,t)||{},c=u.delay||r.delay||0;let{elapsed:l=0}=r;l-=on(c);let f={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...u,delay:-l,onUpdate:t=>{e.set(t),u.onUpdate&&u.onUpdate(t)},onComplete:()=>{s(),u.onComplete&&u.onComplete(),a&&a()},onStop:a,name:t,motionValue:e,element:i?void 0:o};(function({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:o,repeat:i,repeatType:a,repeatDelay:s,from:u,elapsed:c,...l}){return!!Object.keys(l).length})(u)||(f={...f,...ln(t,f)}),f.duration&&(f.duration=on(f.duration)),f.repeatDelay&&(f.repeatDelay=on(f.repeatDelay)),void 0!==f.from&&(f.keyframes[0]=f.from);let d=!1;if((!1===f.type||0===f.duration&&!f.repeatDelay)&&(f.duration=0,0===f.delay&&(d=!0)),(dn||ze)&&(d=!0,f.duration=0,f.delay=0),d&&!i&&void 0!==e.get()){const t=hn(f.keyframes,u);if(void 0!==t)return Xe.update((()=>{f.onUpdate(t),f.onComplete()})),new en([])}return!i&&Zo.supports(f)?new Zo(f):new Uo(f)},Jo=t=>Array.isArray(t),ti=t=>Boolean(t&&"object"==typeof t&&t.mix&&t.toValue),ei=t=>Jo(t)?t[t.length-1]||0:t;function ni(t,e){-1===t.indexOf(e)&&t.push(e)}function ri(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class oi{constructor(){this.subscriptions=[]}add(t){return ni(this.subscriptions,t),()=>ri(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 ii={current:void 0};class ai{constructor(t,e={}){this.version="11.5.4",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=Lr.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=Lr.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 oi);const n=this.events[t].add(e);return"change"===t?()=>{n(),Xe.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 ii.current&&ii.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=Lr.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return Rr(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 si(t,e){return new ai(t,e)}function ui(t){const e=[{},{}];return null==t||t.values.forEach(((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()})),e}function ci(t,e,n,r){if("function"==typeof e){const[o,i]=ui(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]=ui(r);e=e(void 0!==n?n:t.custom,o,i)}return e}function li(t,e,n){const r=t.getProps();return ci(r,e,void 0!==n?n:r.custom,t)}function fi(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,si(n))}const di=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),pi="data-"+di("framerAppearId");function hi(t){return t.props[pi]}function yi(t){return rn.has(t)?"transform":Ho.has(t)?di(t):void 0}class vi extends ai{constructor(){super(...arguments),this.output=[],this.counts=new Map}add(t){const e=yi(t);if(!e)return;const n=this.counts.get(e)||0;this.counts.set(e,n+1),0===n&&(this.output.push(e),this.update());let r=!1;return()=>{if(r)return;r=!0;const t=this.counts.get(e)-1;this.counts.set(e,t),0===t&&(ri(this.output,e),this.update())}}update(){this.set(this.output.length?this.output.join(", "):"auto")}}const mi=t=>Boolean(t&&t.getVelocity);function gi(t,e){var n;if(!t.applyWillChange)return;let r=t.getValue("willChange");return r||(null===(n=t.props.style)||void 0===n?void 0:n.willChange)||(r=new vi("auto"),t.addValue("willChange",r)),o=r,Boolean(mi(o)&&o.add)?r.add(e):void 0;var o}function bi({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,r}function wi(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&&bi(l,e))continue;const s={delay:n,...fn(a||{},e)};let f=!1;if(window.MotionHandoffAnimation){const n=hi(t);if(n){const t=window.MotionHandoffAnimation(n,e,Xe);null!==t&&(s.startTime=t,f=!0)}}r.start(Qo(e,r,o,t.shouldReduceMotion&&rn.has(e)?{type:!1}:s,t,f,gi(t,e)));const d=r.animation;d&&c.push(d)}return s&&Promise.all(c).then((()=>{Xe.update((()=>{s&&function(t,e){const n=li(t,e);let{transitionEnd:r={},transition:o={},...i}=n||{};i={...i,...r};for(const e in i)fi(t,e,ei(i[e]))}(t,s)}))})),c}const _i={};function Si(t,{layout:e,layoutId:n}){return rn.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!_i[t]||"opacity"===t)}function ki(t,e,n){var r;const{style:o}=t,i={};for(const a in o)(mi(o[a])||e.style&&mi(e.style[a])||Si(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 xi(t,e,n){const r=ki(t,e,n);for(const n in t)if(mi(t[n])||mi(e[n])){r[-1!==nn.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=t[n]}return r}const Ai="undefined"!=typeof window,Ti={current:null},Ei={current:!1};function Oi(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function Pi(t){return"string"==typeof t||Array.isArray(t)}const ji=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Ci=["initial",...ji];function Ii(t){return Oi(t.animate)||Ci.some((e=>Pi(t[e])))}function Li(t){return Boolean(Ii(t)||t.variants)}const Mi={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"]},Ni={};for(const t in Mi)Ni[t]={isEnabled:e=>Mi[t].some((t=>!!e[t]))};const Ri=[...qn,ur,br],Fi=()=>({x:{min:0,max:0},y:{min:0,max:0}}),Vi=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],Di=Ci.length;class Bi{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=er,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.isRenderScheduled=!1,this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.isRenderScheduled=!1,this.scheduleRender=()=>{this.isRenderScheduled||(this.isRenderScheduled=!0,Xe.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=Ii(e),this.isVariantNode=Li(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]&&mi(e)&&e.set(s[t],!1)}}mount(t){this.current=t,$e.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))),Ei.current||function(){if(Ei.current=!0,Ai)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Ti.current=t.matches;t.addListener(e),e()}else Ti.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||Ti.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){$e.delete(this.current),this.projection&&this.projection.unmount(),Ke(this.notifyUpdate),Ke(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=rn.has(t),r=e.on("change",(e=>{this.latestValues[t]=e,this.props.onUpdate&&Xe.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 Ni){const e=Ni[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<Vi.length;e++){const n=Vi[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(mi(o))t.addValue(r,o);else if(mi(i))t.addValue(r,si(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,si(void 0!==e?e:o,{owner:t}))}}for(const r in n)void 0===e[r]&&t.removeValue(r);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}getVariantContext(t=!1){if(t)return this.parent?this.parent.getVariantContext():void 0;if(!this.isControllingVariants){const t=this.parent&&this.parent.getVariantContext()||{};return void 0!==this.props.initial&&(t.initial=this.props.initial),t}const e={};for(let t=0;t<Di;t++){const n=Ci[t],r=this.props[n];(Pi(r)||!1===r)&&(e[n]=r)}return e}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){const n=this.values.get(t);e!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return void 0===n&&void 0!==e&&(n=si(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&&(vn(r)||yn(r))?r=parseFloat(r):(o=r,!Ri.find(Yn(o))&&br.test(e)&&(r=Or(t,e))),this.setBaseTarget(t,mi(r)?r.get():r)),mi(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=ci(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||mi(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 oi),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class Gi extends Bi{constructor(){super(...arguments),this.KeyframeResolver=jr}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 Ui=(t,e)=>e&&"number"==typeof t?e.transform(t):t,Hi={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},$i=nn.length;function zi(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(rn.has(t))a=!0;else if(gn(t))o[t]=n;else{const e=Ui(n,Ar[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<$i;i++){const a=nn[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=Ui(s,Ar[a]);u||(o=!1,r+=`${Hi[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 Wi(t,e,n){return"string"==typeof t?t:Rn.transform(e+n*t)}const Yi={offset:"stroke-dashoffset",array:"stroke-dasharray"},qi={offset:"strokeDashoffset",array:"strokeDasharray"};function Xi(t,{attrX:e,attrY:n,attrScale:r,originX:o,originY:i,pathLength:a,pathSpacing:s=1,pathOffset:u=0,...c},l,f){if(zi(t,c,f),l)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:d,style:p,dimensions:h}=t;d.transform&&(h&&(p.transform=d.transform),delete d.transform),h&&(void 0!==o||void 0!==i||p.transform)&&(p.transformOrigin=function(t,e,n){return`${Wi(e,t.x,t.width)} ${Wi(n,t.y,t.height)}`}(h,void 0!==o?o:.5,void 0!==i?i:.5)),void 0!==e&&(d.x=e),void 0!==n&&(d.y=n),void 0!==r&&(d.scale=r),void 0!==a&&function(t,e,n=1,r=0,o=!0){t.pathLength=1;const i=o?Yi:qi;t[i.offset]=Rn.transform(-r);const a=Rn.transform(e),s=Rn.transform(n);t[i.array]=`${a} ${s}`}(d,a,s,u,!1)}const Ki=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 Zi(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 Qi(t,e,n,r){Zi(t,e,void 0,r);for(const n in e.attrs)t.setAttribute(Ki.has(n)?n:di(n),e.attrs[n])}const Ji=t=>"string"==typeof t&&"svg"===t.toLowerCase();class ta extends Gi{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Fi}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(rn.has(e)){const t=Er(e);return t&&t.default||0}return e=Ki.has(e)?e:di(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return xi(t,e,n)}build(t,e,n){Xi(t,e,this.isSVGTag,n.transformTemplate)}renderInstance(t,e,n,r){Qi(t,e,0,r)}mount(t){this.isSVGTag=Ji(t.tagName),super.mount(t)}}function ea(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 na extends Gi{constructor(){super(...arguments),this.type="html",this.applyWillChange=!0,this.renderInstance=Zi}readValueFromInstance(t,e){if(rn.has(e)){const t=Er(e);return t&&t.default||0}{const r=(n=t,window.getComputedStyle(n)),o=(gn(e)?r.getPropertyValue(e):r[e])||0;return"string"==typeof o?o.trim():o}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return ea(t,e)}build(t,e,n){zi(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return ki(t,e,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;mi(t)&&(this.childSubscription=t.on("change",(t=>{this.current&&(this.current.textContent=`${t}`)})))}}function ra(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 ta(e):new na(e);n.mount(t),$e.set(t,n)}function oa(t,e,n){const r=mi(t)?t:si(t);return r.start(Qo("",r,e,n)),r.animation}function ia(t,e=100){const n=Kr({keyframes:[0,e],...t}),r=Math.min(Vo(n),Fo);return{type:"keyframes",ease:t=>n.next(r*t).value/e,duration:an(r)}}function aa(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 sa=(t,e,n)=>{const r=e-t;return((n-t)%r+r)%r+t};function ua(t,e){return io(t)?t[sa(0,t.length,e)]:t}function ca(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&&(ri(t,o),r--)}}(t,o,i);for(let a=0;a<e.length;a++)t.push({value:e[a],at:bo(o,i,r[a]),easing:ua(n,a)})}function la(t,e){return t.at===e.at?null===t.value?1:null===e.value?-1:0:t.at-e.at}const fa="easeInOut";function da(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function pa(t,e){return e[t]||(e[t]=[]),e[t]}function ha(t){return Array.isArray(t)?t:[t]}function ya(t,e){return t[e]?{...t,...t[e]}:{...t}}const va=t=>"number"==typeof t,ma=t=>t.every(va);function ga(t,e,n,r){const o=He(t,r),i=o.length;Ue(Boolean(i),"No valid element provided.");const a=[];for(let t=0;t<i;t++){const r=o[t];$e.has(r)||ra(r);const s=$e.get(r),u={...n};"function"==typeof u.delay&&(u.delay=u.delay(t,i)),a.push(...wi(s,{...e,transition:u},{}))}return new en(a)}function ba(t,e,n){const r=[],o=function(t,{defaultTransition:e={},...n}={},r){const o=e.duration||.3,i=new Map,a=new Map,s={},u=new Map;let c=0,l=0,f=0;for(let n=0;n<t.length;n++){const i=t[n];if("string"==typeof i){u.set(i,l);continue}if(!Array.isArray(i)){u.set(i.name,aa(l,i.at,c,u));continue}let[d,p,h={}]=i;void 0!==h.at&&(l=aa(l,h.at,c,u));let y=0;const v=(t,n,r,i=0,a=0)=>{const s=ha(t),{delay:u=0,times:c=No(s),type:d="keyframes",...p}=n;let{ease:h=e.ease||"easeOut",duration:v}=n;const m="function"==typeof u?u(i,a):u,g=s.length;if(g<=2&&"spring"===d){let t=100;if(2===g&&ma(s)){const e=s[1]-s[0];t=Math.abs(e)}const e={...p};void 0!==v&&(e.duration=on(v));const n=ia(e,t);h=n.ease,v=n.duration}null!=v||(v=o);const b=l+m,w=b+v;1===c.length&&0===c[0]&&(c[1]=1);const _=c.length-s.length;_>0&&Mo(c,_),1===s.length&&s.unshift(null),ca(r,s,h,c,b,w),y=Math.max(m+v,y),f=Math.max(w,f)};if(mi(d))v(p,h,pa("default",da(d,a)));else{const t=He(d,r,s),e=t.length;for(let n=0;n<e;n++){const r=da(t[n],a);for(const t in p)v(p[t],ya(h,t),pa(t,r),n,e)}}c=l,l+=y}return a.forEach(((t,r)=>{for(const o in t){const a=t[o];a.sort(la);const s=[],u=[],c=[];for(let t=0;t<a.length;t++){const{at:e,value:n,easing:r}=a[t];s.push(n),u.push(go(0,f,e)),c.push(r||"easeOut")}0!==u[0]&&(u.unshift(0),s.unshift(s[0]),c.unshift(fa)),1!==u[u.length-1]&&(u.push(1),s.push(null)),i.has(r)||i.set(r,{keyframes:{},transition:{}});const l=i.get(r);l.keyframes[o]=s,l.transition[o]={...e,duration:f,ease:c,times:u,...n}}})),i}(t,e,n);return o.forEach((({keyframes:t,transition:e},n)=>{let o;o=mi(n)?oa(n,t.default,e.default):ga(n,t,e),r.push(o)})),new en(r)}const wa=function(t,e,n){let r;var o;return o=t,r=Array.isArray(o)&&Array.isArray(o[0])?ba(t,e,_a):function(t){return"object"==typeof t&&!Array.isArray(t)}(e)?ga(t,e,n,_a):oa(t,e,n),_a&&_a.animations.push(r),r};var _a;function Sa(t){return Sa="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},Sa(t)}function ka(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ka=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",p="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==Sa(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=d;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===d)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(Sa(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function xa(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Ta(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 Aa(t){return function(t){if(Array.isArray(t))return Ea(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Ta(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 Ta(t,e){if(t){if("string"==typeof t)return Ea(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)?Ea(t,e):void 0}}function Ea(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 Oa(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,ja(r.key),r)}}function Pa(t,e,n){return(e=ja(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ja(t){var e=function(t,e){if("object"!=Sa(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Sa(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Sa(e)?e:e+""}var Ca=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Ia=Pa(Pa(Pa({},Oe.left,"25.33%"),Oe.center,"50%"),Oe.right,"75.66%"),La=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,Aa(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&&Oa(t.prototype,e),n&&Oa(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"animate",value:function(e,n,r,o){var i=e.scope,a=e.overwrites;return Ca(this,void 0,void 0,ka().mark((function e(){var s,u=this;return ka().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=p(r,{}),e.abrupt("return",new Promise((function(e){Ca(u,void 0,void 0,ka().mark((function r(){var u,c,l,f,d=this;return ka().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:this.sequenceOptions.sync||(e(),o&&o(s)),u=0;case 2:if(!(u<this.sequenceOptions.repeat)){r.next=22;break}c=xa(this.sequences),r.prev=4,f=ka().mark((function e(){var r,o,u,c,f,h;return ka().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=l.value,o=r.props,u=r.options,c=p({},d.propToCSS(n,s)),i.current){e.next=4;break}throw new Error("No scope found when animating.");case 4:if(f=i.current,Object.assign(f.style,c),s=t.mergeState(s,o),h=wa(f,d.propToCSS(n,s,a),d.optionsToFramerMotionOptions(u)||{}),d.setControl(h),!1!==(null==u?void 0:u.sync)){e.next=13;break}h.then((function(){Object.assign(f.style,d.propToCSS(n,s,a)),d.setControl(null)})),e.next=17;break;case 13:return e.next=15,new Promise((function(t){return h.then((function(){return t()}))}));case 15:Object.assign(f.style,d.propToCSS(n,s,a)),d.setControl(null);case 17:case"end":return e.stop()}}),e)})),c.s();case 7:if((l=c.n()).done){r.next=11;break}return r.delegateYield(f(),"t0",9);case 9:r.next=7;break;case 11:r.next=16;break;case 13:r.prev=13,r.t1=r.catch(4),c.e(r.t1);case 16:return r.prev=16,c.f(),r.finish(16);case 19:u++,r.next=2;break;case 22:return r.next=24,b(2);case 24:this.setControl(null),this.sequenceOptions.sync&&(e(),o&&o(s));case 26:case"end":return r.stop()}}),r,this,[[4,13,16,19]])})))})));case 2:case"end":return e.stop()}}),e)})))}},{key:"repeat",value:function(t){return this.sequenceOptions.repeat*=t,this}},{key:"overwrite",value:function(t,e){return this.transformers[t]=e,this}},{key:"propToCSS",value:function(e,n,r){var o,i=(null===(o=e.getLastScene())||void 0===o?void 0:o.config)||{},a=i.invertY,s=i.invertX,u={position:function(e){return t.positionToCSS(e,a,s)},backgroundColor:function(e){return t.backgroundToCSS(e)},backgroundOpacity:function(t){return{opacity:t}},opacity:function(t){return{opacity:t}},scale:function(){return"scale"in n?{width:"".concat(100*n.scale,"%")}:{}},rotation:function(){return{}},display:function(){return{}},src:function(){return{}}},c={};for(var l in c.transform=this.propToCSSTransform(e,n),this.transformers.transform&&Object.assign(c,this.transformers.transform(n)),r&&r.transform&&Object.assign(c,r.transform(n)),n)Object.prototype.hasOwnProperty.call(n,l)&&(r&&r[l]?Object.assign(c,r[l](n[l])):this.transformers[l]?Object.assign(c,this.transformers[l](n[l])):u[l]&&Object.assign(c,u[l](n[l])));return c}},{key:"optionsToFramerMotionOptions",value:function(t){if(!t)return t;var e=t.duration;return{duration:e?e/1e3:0,ease:t.ease}}},{key:"propToCSSTransform",value:function(t,e){var n;if(!t.getLastScene())throw new Error('No scene found in state, make sure you called "scene.activate()" before this method.');var r=(null===(n=t.getLastScene())||void 0===n?void 0:n.config)||{},o=r.invertY,i=r.invertX;return["translate(".concat(i?"":"-","50%, ").concat(o?"":"-","50%)"),void 0!==e.rotation&&"rotate(".concat(e.rotation,"deg)")].filter(Boolean).join(" ")}},{key:"setControl",value:function(t){return this.control=t,this}},{key:"getControl",value:function(){return this.control}},{key:"copy",value:function(){return new t(this.sequences,this.sequenceOptions)}}],[{key:"isPosition",value:function(t){return Fe.isCommonPositionType(t)||Ve.isCoord2DPosition(t)||De.isAlignPosition(t)}},{key:"positionToCSS",value:function(t,e,n){return Re.D2PositionToCSS(t.toCSS(),n,e)}},{key:"backgroundToCSS",value:function(t){return null==t?{}:Ns.isStaticImageData(t)?{backgroundImage:"url(".concat(t.src,")")}:"string"==typeof t?{backgroundColor:t}:["r","g","b"].every((function(e){return e in t}))?{backgroundColor:v(t)}:{backgroundImage:"url("+t.url+")"}}},{key:"mergePosition",value:function(t,e){if(!t&&!e)throw new Error("No position found.");return t&&e?Re.mergePosition(Re.tryParsePosition(t),Re.tryParsePosition(e)):Re.toCoord2D(Re.tryParsePosition(t||e))}},{key:"mergeState",value:function(t,e){var n=this.mergePosition(t.position,e.position);return Object.assign(Object.assign({},p(t,e)),{position:n})}}])}();function Ma(t){return Ma="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},Ma(t)}function Na(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ra(r.key),r)}}function Ra(t){var e=function(t,e){if("object"!=Ma(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ma(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ma(e)?e:e+""}function Fa(t,e,n){return e=Da(e),function(t,e){if(e&&("object"==Ma(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,Va()?Reflect.construct(e,n||[],Da(t).constructor):e.apply(t,n))}function Va(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Va=function(){return!!t})()}function Da(t){return Da=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Da(t)}function Ba(t,e){return Ba=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ba(t,e)}La.defaultSequenceOptions={sync:!0,repeat:1},La.defaultOptions={duration:0,ease:"linear"},La.CommonImagePositionMap=Ia;var Ga=function(t){function e(t,n){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(r=Fa(this,e)).events=new m,r.ref=void 0,"string"==typeof t?(r.name=t,r.config=p(e.defaultConfig,n||{}),r.config.position&&(r.config.position=Re.tryParsePosition(r.config.position))):(r.name="",r.config=p(e.defaultConfig,t),r.config.position&&(r.config.position=Re.tryParsePosition(r.config.position))),r.state=p({},r.config),r.checkConfig(),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ba(t,e)}(e,t),function(t,e,n){return e&&Na(t.prototype,e),n&&Na(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"dispose",value:function(){return this._dispose()}},{key:"init",value:function(){return this.chain(this._init())}},{key:"checkConfig",value:function(){if(!this.config.src)throw new Error("Image src is required");if(!La.isPosition(this.config.position))throw new Error("Invalid position\nPosition must be one of CommonImagePosition, Align, Coord2D");return this}},{key:"setSrc",value:function(t,e){var n=this.chain();if(e){var r=e.copy();r.setSrc(Ns.srcToString(t)),n._transitionSrc(r)}var o=new gs(this.chain(),gs.ActionTypes.setSrc,new Ee(de.getIdManager().getStringId()).setContent(["string"==typeof t?t:Ns.staticImageDataToSrc(t)]));return n.chain(o)}},{key:"applyTransform",value:function(t){var e=new gs(this.chain(),gs.ActionTypes.applyTransform,new Ee(de.getIdManager().getStringId()).setContent([void 0,t,g()]));return this.chain(e)}},{key:"show",value:function(t){var e=t instanceof La?t:new La([{props:{opacity:1},options:t||{}}]),n=new gs(this.chain(),gs.ActionTypes.show,new Ee(de.getIdManager().getStringId()).setContent([void 0,e]));return this.chain(n)}},{key:"hide",value:function(t){var e=new gs(this.chain(),gs.ActionTypes.hide,new Ee(de.getIdManager().getStringId()).setContent([void 0,t instanceof La?t:new La([{props:{opacity:0},options:t||{}}])]));return this.chain(e)}},{key:"toTransform",value:function(){return new La(this.state,{duration:0})}},{key:"setScope",value:function(t){return this.ref=t,this}},{key:"getScope",value:function(){return this.ref}},{key:"copy",value:function(){return new e(this.name,this.config)}},{key:"toData",value:function(){return this.state.disposed||w(this.state,this.config)?null:{state:p({},e.serializeImageState(this.state))}}},{key:"fromData",value:function(t){return this.state=p(this.state,e.deserializeImageState(t.state)),this}},{key:"_$setDispose",value:function(){return this.state.disposed=!0,this}},{key:"_setTransition",value:function(t){return this.chain(new gs(this.chain(),gs.ActionTypes.setTransition,new Ee(de.getIdManager().getStringId()).setContent([t])))}},{key:"_applyTransition",value:function(t){return this.chain(new gs(this.chain(),"image:applyTransition",new Ee(de.getIdManager().getStringId()).setContent([t])))}},{key:"_init",value:function(t){return new gs(this.chain(),gs.ActionTypes.init,new Ee(de.getIdManager().getStringId()).setContent([t]))}},{key:"_transitionSrc",value:function(t){var e=t.copy();return this._setTransition(e)._applyTransition(e),this}},{key:"_dispose",value:function(){return this.chain(new gs(this.chain(),gs.ActionTypes.dispose,new Ee(de.getIdManager().getStringId())))}}],[{key:"serializeImageState",value:function(t){var e={position:function(t){return Re.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 Re.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}}])}(Rt);function Ua(t){return Ua="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},Ua(t)}function Ha(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,$a(r.key),r)}}function $a(t){var e=function(t,e){if("object"!=Ua(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ua(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ua(e)?e:e+""}Ga.EventTypes={"event:image.show":"event:image.show","event:image.hide":"event:image.hide","event:image.init":"event:image.init","event:image.applyTransform":"event:image.applyTransform","event:image.mount":"event:image.mount","event:image.unmount":"event:image.unmount","event:image.ready":"event:image.ready","event:image.elementLoaded":"event:image.elementLoaded","event:image.setTransition":"event:image.setTransition"},Ga.defaultConfig={src:"",display:!1,position:new Fe(Ae.Center),scale:1,rotation:0,opacity:0},Ga.ImagePosition=Oe;var za=function(){return function(t,e,n){return e&&Ha(t.prototype,e),n&&Ha(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e,n,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.callee=e,this.type=n,this.contentNode=r,this.__stack=g(),this._id=""}),[{key:"executeAction",value:function(t){return{type:this.type,node:this.contentNode}}},{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]:[]}}])}();za.ActionTypes={action:"action"};var Wa={say:"character:say",action:"character:action"},Ya={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"},qa={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"},Xa={action:"sound:action",play:"sound:play",stop:"sound:stop",fade:"sound:fade",setVolume:"sound:setVolume",setRate:"sound:setRate",pause:"sound:pause",resume:"sound:resume"},Ka={action:"control:action",do:"control:do",doAsync:"control:doAsync",any:"control:any",all:"control:all",allAsync:"control:allAsync",repeat:"control:repeat"};function Za(t){return Za="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},Za(t)}function Qa(t){return function(t){if(Array.isArray(t))return ns(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||es(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(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Ja=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",p="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==Za(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=d;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===d)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(Za(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function ts(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)||es(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 es(t,e){if(t){if("string"==typeof t)return ns(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)?ns(t,e):void 0}}function ns(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 rs(t,e,n,r){var o=os(fs(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function os(){return os="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}},os.apply(null,arguments)}function is(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}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,us(r.key),r)}}function ss(t,e,n){return e&&as(t.prototype,e),n&&as(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function us(t){var e=function(t,e){if("object"!=Za(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Za(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Za(e)?e:e+""}function cs(t,e,n){return e=fs(e),function(t,e){if(e&&("object"==Za(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,ls()?Reflect.construct(e,n||[],fs(t).constructor):e.apply(t,n))}function ls(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ls=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){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)}function ps(t,e){return ps=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ps(t,e)}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())}))},ys=function(t){function e(t,n,r){var o;return is(this,e),(o=cs(this,e,[t,n,r])).callee=t.getSelf(),o.contentNode.action=o,o}return ds(e,t),ss(e,[{key:"unknownType",value:function(){throw new Error("Unknown action type: "+this.type)}}])}(za),vs=function(t){function e(){return is(this,e),cs(this,e,arguments)}return ds(e,t),ss(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===Wa.say){var r=new h((function(t){return t})).registerSkipController(new S((function(){return{type:n.type,node:n.contentNode.getChild()}}))),o=this.contentNode.getContent();return t.createText(this.contentNode.id,o,(function(){r.resolve({type:n.type,node:n.contentNode.getChild()})})),r}return rs(e,"executeAction",this,3)([t])}}])}(ys);vs.ActionTypes=Wa;var ms=function(t){function e(){return is(this,e),cs(this,e,arguments)}return ds(e,t),ss(e,[{key:"executeAction",value:function(t){var n,r=this;if(this.type===Ya.action)return rs(e,"executeAction",this,3)([t]);if(this.type===Ya.setBackground)return this.callee.state.background=this.contentNode.getContent()[0],rs(e,"executeAction",this,3)([t]);if(this.type===Ya.sleep){var o=new h((function(t){return t})),i=this.contentNode.getContent();return new Promise((function(t){"number"==typeof i?setTimeout((function(){t()}),i):h.isAwaitable(i)?i.then(t):null==i||i.then(t)})).then((function(){o.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),o}if(this.type===Ya.applyTransition){var a=(new h).registerSkipController(new S((function(){return t.logger.info("NarraLeaf-React: Background Transition","Skipped"),{type:r.type,node:r.contentNode.getChild()}}))),s=this.contentNode.getContent()[0];return this.callee.events.any("event:scene.applyTransition",s).then((function(){a.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),a}if(this.type===Ya.init){if(this.callee._liveState.active)return rs(e,"executeAction",this,3)([t]);this.callee._liveState.active=!0;var u=new h((function(t){return t}));return t.registerSrcManager(this.callee.srcManager).addScene(this.callee),this.callee.events.once("event:scene.unmount",(function(){t.offSrcManager(r.callee.srcManager)})),this.callee.events.once("event:scene.mount",(function(){r.callee.state.backgroundMusic&&(Ss.initSound(t,r.callee.state.backgroundMusic),r.callee.events.emit("event:scene.setBackgroundMusic",r.callee.state.backgroundMusic,r.callee.config.backgroundMusicFade))})),this.callee.events.once("event:scene.imageLoaded",(function(){var e=r.callee.getInitTransform();r.callee.events.any("event:scene.initTransform",e).then((function(){u.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()}))})),u}if(this.type===Ya.exit){this.callee._liveState.active=!1,t.offSrcManager(this.callee.srcManager).removeScene(this.callee);var c=new h((function(t){return t}));return this.callee.events.once("event:scene.unmount",(function(){c.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),c}if(this.type===Ya.jumpTo){var l=this.contentNode.getContent()[0],f=this.contentNode,d=(null===(n=l.sceneRoot)||void 0===n?void 0:n.contentNode)||null;return d&&f.addChild(d),rs(e,"executeAction",this,3)([t])}if(this.type===Ya.setBackgroundMusic){var p=ts(this.contentNode.getContent(),2),y=p[0],v=p[1];return this.callee.events.emit("event:scene.setBackgroundMusic",y,v||0),rs(e,"executeAction",this,3)([t])}if(this.type===Ya.preUnmount)return this.callee.events.emit("event:scene.preUnmount"),rs(e,"executeAction",this,3)([t]);if(this.type===Ya.applyTransform){var m=ts(this.contentNode.getContent(),1)[0],g=new h((function(t){return t})).registerSkipController(new S((function(){return{type:r.type,node:r.contentNode.getChild()}})));return this.callee.events.any("event:scene.applyTransform",m).then((function(){g.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),g}throw new Error("Unknown scene action type: "+this.type)}},{key:"getFutureActions",value:function(){var t,e,n;if(this.type===Ya.jumpTo){var r=null===(e=null===(t=this.contentNode.getContent()[0])||void 0===t?void 0:t.sceneRoot)||void 0===e?void 0:e.contentNode;return(null==r?void 0:r.action)?[r.action]:[]}var o=null===(n=this.contentNode.getChild())||void 0===n?void 0:n.action;return o?[o]:[]}}])}(ys);ms.ActionTypes=Ya,(function(t){function e(){return is(this,e),cs(this,e,arguments)}return ds(e,t),ss(e)}(ys)).ActionTypes={action:"story:action"};var gs=function(t){function e(){return is(this,e),cs(this,e,arguments)}return ds(e,t),ss(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===qa.init){var r=t.findElementByImage(this.callee);r&&t.disposeImage(this.callee,r.scene);var o=this.contentNode.getContent()[0];t.createImage(this.callee,o);var i=new h((function(t){return t}));return this.callee.events.once("event:image.mount",(function(){return hs(n,void 0,void 0,Ja().mark((function e(){var n;return Ja().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(n=this.callee.getScope())||void 0===n?void 0:n.current){e.next=3;break}return e.next=3,this.callee.events.any(Ga.EventTypes["event:image.elementLoaded"]);case 3:return e.next=5,this.callee.events.any("event:image.init");case 5:i.resolve({type:this.type,node:this.contentNode.getChild()}),t.stage.next();case 7:case"end":return e.stop()}}),e,this)})))})),i}if(this.type===qa.setSrc)return this.callee.state.src=this.contentNode.getContent()[0],t.stage.forceUpdate(),rs(e,"executeAction",this,3)([t]);if([qa.show,qa.hide,qa.applyTransform].includes(this.type)){var a=new h((function(t){return t})).registerSkipController(new S((function(){return n.type===qa.hide&&(n.callee.state.display=!1),{type:n.type,node:n.contentNode.getChild()}}))),s=this.contentNode.getContent()[1];return this.type===qa.show&&(this.callee.state.display=!0,t.stage.forceUpdate()),t.animateImage(Ga.EventTypes["event:image.applyTransform"],this.callee,[s],(function(){var t;n.type===qa.hide&&(n.callee.state.display=!1),a.resolve({type:n.type,node:null===(t=n.contentNode)||void 0===t?void 0:t.getChild()})})),a}if(this.type===qa.dispose)return t.disposeImage(this.callee),this.callee._$setDispose(),rs(e,"executeAction",this,3)([t]);if(this.type===qa.setTransition)return this.callee.events.emit("event:image.setTransition",this.contentNode.getContent()[0]),rs(e,"executeAction",this,3)([t]);if(this.type===qa.applyTransition){var u=new h((function(t){return t})).registerSkipController(new S((function(){return n.type===qa.hide&&(n.callee.state.display=!1),{type:n.type,node:n.contentNode.getChild()}})));return this.contentNode.getContent()[0].start((function(){u.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),u}throw rs(e,"unknownType",this,3)([])}}])}(ys);gs.ActionTypes=qa;var bs=function(t){function e(){return is(this,e),cs(this,e,arguments)}return ds(e,t),ss(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}}},{key:"getFutureActions",value:function(){return[].concat(Qa(this.callee._getFutureActions()),Qa(rs(e,"getFutureActions",this,3)([])))}}])}(ys);bs.ActionTypes={action:"condition:action"};var ws=function(t){function e(){return is(this,e),cs(this,e,arguments)}return ds(e,t),ss(e,[{key:"executeAction",value:function(t){return this.contentNode.getContent().execute({gameState:t}),{type:this.type,node:this.contentNode}}}])}(ys);ws.ActionTypes={action:"script:action"};var _s=function(t){function e(){return is(this,e),cs(this,e,arguments)}return ds(e,t),ss(e,[{key:"executeAction",value:function(t){var e=this,n=new h((function(t){return t})),r=this.contentNode.getContent();return t.createMenu(r,(function(r){var o,i,a=(null===(o=t.game.getLiveGame().getCurrentAction())||void 0===o?void 0:o.contentNode.getChild())||null;a&&(null===(i=r.action[r.action.length-1])||void 0===i||i.contentNode.addChild(a)),n.resolve({type:e.type,node:r.action[0].contentNode})})),n}},{key:"getFutureActions",value:function(){var t=this.contentNode.getContent();return[].concat(Qa(this.callee._getFutureActions(t.choices)),Qa(rs(e,"getFutureActions",this,3)([])))}}])}(ys);_s.ActionTypes={action:"menu:action"};var Ss=function(t){function e(){return is(this,e),cs(this,e,arguments)}return ds(e,t),ss(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===Xa.play){if(e.initSound(t,this.callee),!this.callee.$getHowl())throw new Error("Howl is not initialized");if(this.callee.config.sync&&!this.callee.config.loop){var r=new h((function(t){return t})),o=t.playSound(this.callee.$getHowl(),(function(){var t;n.callee.$stop(),r.resolve({type:n.type,node:null===(t=n.contentNode)||void 0===t?void 0:t.getChild()})}));return this.callee.$setToken(o),r}var i=t.playSound(this.callee.$getHowl(),(function(){n.callee.$stop()}));return this.callee.$setToken(i),rs(e,"executeAction",this,3)([t])}if(this.type===Xa.stop)return this.callee.$getHowl()&&(this.callee.$getHowl().stop(),this.callee.$stop()),rs(e,"executeAction",this,3)([t]);if(this.type===Xa.fade){var a=ts(this.contentNode.getContent(),1)[0],s=a.start,u=a.end,c=a.duration;if(this.callee.$getHowl()){var l=void 0===s?this.callee.$getHowl().volume():s;this.callee.$getHowl().fade(l,u,c,this.callee.$getToken())}return rs(e,"executeAction",this,3)([t])}if(this.type===Xa.setVolume){var f=ts(this.contentNode.getContent(),1)[0];return this.callee.$getHowl()&&this.callee.$getHowl().volume(f,this.callee.$getToken()),rs(e,"executeAction",this,3)([t])}if(this.type===Xa.setRate){var d=ts(this.contentNode.getContent(),1)[0];return this.callee.$getHowl()&&this.callee.$getHowl().rate(d,this.callee.$getToken()),rs(e,"executeAction",this,3)([t])}if(this.type===Xa.pause)return this.callee.$getHowl()&&this.callee.$getHowl().pause(this.callee.$getToken()),rs(e,"executeAction",this,3)([t]);if(this.type===Xa.resume)return this.callee.$getHowl()&&this.callee.$getHowl().play(this.callee.$getToken()),rs(e,"executeAction",this,3)([t]);throw rs(e,"unknownType",this,3)([])}}],[{key:"initSound",value:function(t,e){e.$getHowl()||e.$setHowl(new(t.getHowl())(e.getHowlOptions()))}}])}(ys);Ss.ActionTypes=Xa;var ks=function(t){function e(){return is(this,e),cs(this,e,arguments)}return ds(e,t),ss(e,[{key:"executeAllActions",value:function(t,e){return hs(this,void 0,void 0,Ja().mark((function n(){var r,o,i;return Ja().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:r=!1,o=e,i=Ja().mark((function e(){var n,r,i;return Ja().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.game.getLiveGame().executeAction(t,o)){e.next=3;break}return e.abrupt("return",0);case 3:if(!h.isAwaitable(n)){e.next=15;break}return e.next=6,new Promise((function(t){n.then((function(e){return t(n.result)}))}));case 6:if(r=e.sent,!(i=r.node)){e.next=12;break}o=i.action,e.next=13;break;case 12:return e.abrupt("return",0);case 13:e.next=16;break;case 15:o=n;case 16: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 hs(this,void 0,void 0,Ja().mark((function n(){var r,o,i;return Ja().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=t.game.getLiveGame().executeAction(t,e),!h.isAwaitable(r)){n.next=9;break}return n.next=4,new Promise((function(t){r.then((function(e){return t(r.result)}))}));case 4:return o=n.sent,i=o.node,n.abrupt("return",i);case 9:return n.abrupt("return",r);case 10:case"end":return n.stop()}}),n)})))}},{key:"execute",value:function(t,n,r){var o=this;return r.length>0?(this.executeAllActions(t,r[0]).then((function(){n.resolve({type:o.type,node:o.contentNode.getChild()})})),n):rs(e,"executeAction",this,3)([t])}},{key:"executeAction",value:function(t){var n,r,o=this,i=ts(this.contentNode.getContent(),1)[0];if(this.type===Ka.do){var a=null===(n=i[0])||void 0===n?void 0:n.contentNode,s=null===(r=i[i.length-1])||void 0===r?void 0:r.contentNode,u=this.contentNode.getChild();return null==s||s.addChild(u),this.contentNode.addChild(a||null),rs(e,"executeAction",this,3)([t])}if(this.type===Ka.doAsync)return hs(o,void 0,void 0,Ja().mark((function e(){return Ja().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i.length>0)){e.next=3;break}return e.next=3,this.executeAllActions(t,i[0]);case 3:case"end":return e.stop()}}),e,this)}))),rs(e,"executeAction",this,3)([t]);if(this.type===Ka.any){var c=new h((function(t){return t})),l=i.map((function(e){return o.executeSingleAction(t,e)}));return Promise.any(l).then((function(){c.resolve({type:o.type,node:o.contentNode.getChild()})})),c}if(this.type===Ka.all){var f=new h((function(t){return t}));return this.execute(t,f,i)}if(this.type===Ka.allAsync)return hs(o,void 0,void 0,Ja().mark((function e(){return Ja().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i.length>0)){e.next=3;break}return e.next=3,this.executeAllActions(t,i[0]);case 3:case"end":return e.stop()}}),e,this)}))),rs(e,"executeAction",this,3)([t]);if(this.type===Ka.repeat){var d=ts(this.contentNode.getContent(),2),p=d[0],y=d[1];return hs(o,void 0,void 0,Ja().mark((function e(){var n;return Ja().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=0;case 1:if(!(n<y)){e.next=8;break}if(!(p.length>0)){e.next=5;break}return e.next=5,this.executeAllActions(t,p[0]);case 5:n++,e.next=1;break;case 8:case"end":return e.stop()}}),e,this)}))),rs(e,"executeAction",this,3)([t])}throw new Error("Unknown control action type: "+this.type)}},{key:"getFutureActions",value:function(){var t=this.contentNode.getContent()[0],n=rs(e,"getFutureActions",this,3)([]);return[].concat(Qa(t),Qa(n))}}])}(ys);function xs(t){return xs="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},xs(t)}function As(t,e,n){return e=js(e),function(t,e){if(e&&("object"==xs(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,Os()?Reflect.construct(e,n||[],js(t).constructor):e.apply(t,n))}function Ts(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)}function Es(t){var e="function"==typeof Map?new Map:void 0;return Es=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(Os())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var o=new(t.bind.apply(t,r));return n&&Ps(o,n.prototype),o}(t,arguments,js(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Ps(n,t)},Es(t)}function Os(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Os=function(){return!!t})()}function Ps(t,e){return Ps=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ps(t,e)}function js(t){return js=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},js(t)}function Cs(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}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,Ms(r.key),r)}}function Ls(t,e,n){return e&&Is(t.prototype,e),n&&Is(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ms(t){var e=function(t,e){if("object"!=xs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=xs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==xs(e)?e:e+""}ks.ActionTypes=Ka;var Ns=function(){function t(){Cs(this,t)}return Ls(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://")}}])}(),Rs=function(t){function e(t,n){return Cs(this,e),As(this,e,[t,{info:n},"NarraLeafReact-StaticScriptWarning"])}return Ts(e,t),Ls(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 Cs(this,e),(r=As(this,e,[t])).props=n,r.name=o,r}return Ts(e,t),Ls(e,null,[{key:"isUseError",value:function(t){return t instanceof e}}])}(Es(Error))),Fs=function(){return Ls((function t(e){Cs(this,t),this.scene=e}),[{key:"run",value:function(){if(!this.scene.sceneRoot)return null;var t=new Map,e=new Map,n=[],r=new Set,o=this.scene.getAllChildren(this.scene.sceneRoot);if(!o.length)return null;for(n.push(o[0]);n.length;){var i=n.shift();this.checkAction(i,{imageStates:t,scenes:e},r);var a=i.contentNode.getChild();a&&a.action&&n.push(a.action)}return t}},{key:"checkAction",value:function(t,e,n){var r=e.imageStates,o=e.scenes;if(t instanceof gs)r.has(t.callee)||r.set(t.callee,{isDisposed:!1,usedExternalSrc:!1}),this.checkImage(r.get(t.callee),t);else if(t instanceof ms){var i=t.callee;if(o.has(i.name)){if(o.get(i.name)!==i){var a="Scene with name: ".concat(i.name," is duplicated\nScene: ").concat(i.name,"\n\nAt: ").concat(t.__stack);throw new Rs(a)}}else o.set(i.name,i);if(t.type===Ya.jumpTo){var s=t.contentNode.getContent()[0];if(n.has(s))return;n.add(s)}}}},{key:"checkImage",value:function(t,e){if(e.type===qa.dispose){if(t.isDisposed){var n="Image is disposed multiple times before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new Rs(n)}t.isDisposed=!0}else if([qa.init,qa.show,qa.hide,qa.applyTransform,qa.applyTransition].includes(e.type)){if(t.isDisposed){var r="Image is disposed before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new Rs(r)}}else if(e.type===qa.setSrc){var o=e.contentNode.getContent()[0];Ns.isExternalSrc(o)&&(t.usedExternalSrc=!0)}}}])}();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 Ds(t){return function(t){if(Array.isArray(t))return Gs(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Bs(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 Bs(t,e){if(t){if("string"==typeof t)return Gs(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)?Gs(t,e):void 0}}function Gs(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 Us(t,e,n){return e=$s(e),function(t,e){if(e&&("object"==Vs(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,Hs()?Reflect.construct(e,n||[],$s(t).constructor):e.apply(t,n))}function Hs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Hs=function(){return!!t})()}function $s(t){return $s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$s(t)}function zs(t,e){return zs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},zs(t,e)}function Ws(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ys(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,Xs(r.key),r)}}function qs(t,e,n){return e&&Ys(t.prototype,e),n&&Ys(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Xs(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+""}var Ks=function(){return qs((function t(e){Ws(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()}}}])}(),Zs=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Ws(this,e),(t=Us(this,e)).conditions={If:{condition:null,action:null},ElseIf:[],Else:{action:null}},t.config=p(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&&zs(t,e)}(e,t),qs(e,[{key:"If",value:function(t,e){if(this.conditions.If.condition)throw new Rs("IF condition already set\nYou are trying to set multiple IF conditions for the same condition");if(this.conditions.ElseIf.length)throw new Rs("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 Rs("ELSE condition already set\nYou are trying to set an IF condition after an ELSE condition");return this.conditions.If.condition=t instanceof Ks?t:new Ks(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 Rs("IF condition not set\nYou are trying to set an ELSE-IF condition without an IF condition");if(this.conditions.Else.action)throw new Rs("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 Ks?t:new Ks(t),action:this.construct(Array.isArray(e)?e:[e])}),this.chain()}},{key:"Else",value:function(t){if(!this.conditions.If.condition)throw new Rs("IF condition not set\nYou are trying to set an ELSE condition without an IF condition");if(this.conditions.Else.action)throw new Rs("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=Bs(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(bs,[this,bs.ActionTypes.action,new Ee(de.getIdManager().getStringId()).setContent(t.conditions)])]}},{key:"construct",value:function(t,e,n){for(var r,o=Et.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.setInitChild(s),i===o.length-1&&e&&a.setInitChild(e),0===i&&n&&n.setInitChild(a)}return o}},{key:"_getFutureActions",value:function(){return Et.toActions([].concat(Ds(this.conditions.If.action||[]),Ds(this.conditions.ElseIf.flatMap((function(t){return t.action||[]}))),Ds(this.conditions.Else.action||[])))}}],[{key:"getInitialState",value:function(){return{If:{condition:null,action:null},ElseIf:[],Else:{action:null}}}}])}(Rt);function Qs(t){return Qs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qs(t)}function Js(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,tu(r.key),r)}}function tu(t){var e=function(t,e){if("object"!=Qs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Qs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Qs(e)?e:e+""}function eu(t,e,n){return e=ru(e),function(t,e){if(e&&("object"==Qs(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,nu()?Reflect.construct(e,n||[],ru(t).constructor):e.apply(t,n))}function nu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(nu=function(){return!!t})()}function ru(t){return ru=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ru(t)}function ou(t,e){return ou=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ou(t,e)}Zs.defaultConfig={};var iu=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),eu(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&&ou(t,e)}(e,t),function(t,e,n){return e&&Js(t.prototype,e),n&&Js(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"do",value:function(t){return this.push(ks.ActionTypes.do,t)}},{key:"doAsync",value:function(t){return this.push(ks.ActionTypes.doAsync,t)}},{key:"any",value:function(t){return this.push(ks.ActionTypes.any,t)}},{key:"all",value:function(t){return this.push(ks.ActionTypes.all,t)}},{key:"allAsync",value:function(t){return this.push(ks.ActionTypes.allAsync,t)}},{key:"repeat",value:function(t,e){return this.push(ks.ActionTypes.repeat,e,t)}},{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.setInitChild(r.contentNode))}return t}},{key:"push",value:function(t,e){for(var n=Et.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 ks(this.chain(),t,new Ee(de.getIdManager().getStringId()).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)}}])}(Rt);function au(t){return au="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},au(t)}function su(t,e){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,uu(r.key),r)}}function uu(t){var e=function(t,e){if("object"!=au(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=au(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==au(e)?e:e+""}function cu(t,e,n){return e=fu(e),function(t,e){if(e&&("object"==au(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,lu()?Reflect.construct(e,n||[],fu(t).constructor):e.apply(t,n))}function lu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(lu=function(){return!!t})()}function fu(t){return fu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},fu(t)}function du(t,e){return du=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},du(t,e)}var pu=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=cu(this,e)).choices=[],n.prompt=Wt.isSentence(t)?t:new Wt(null,t),n.config=p(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&&du(t,e)}(e,t),function(t,e,n){return e&&su(t.prototype,e),n&&su(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"choose",value:function(t,e){var n=this.chain();return Wt.isSentence(t)&&e||(qt.isWord(t)||Array.isArray(t)||"string"==typeof t)&&e?n.choices.push({prompt:Wt.toSentence(t),action:Et.toActions(e)}):"object"===au(t)&&"prompt"in t&&"action"in t?n.choices.push({prompt:Wt.toSentence(t.prompt),action:Et.toActions(t.action)}):console.warn("No valid choice added to menu, ",{arg0:t,arg1:e}),n}},{key:"fromChained",value:function(t){return[new _s(this.chain(),_s.ActionTypes.action,new Ee(de.getIdManager().getStringId()).setContent({prompt:this.prompt,choices:t.constructChoices()}))]}},{key:"construct",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.setInitChild(a),o===this.choices.length-1&&e&&i.setInitChild(e),0===o&&n&&n.setInitChild(i)}return t}},{key:"_getFutureActions",value:function(t){return t.map((function(t){return t.action})).flat(2)}},{key:"constructChoices",value:function(){var t=this;return this.choices.map((function(e){return{action:t.construct(e.action),prompt:e.prompt}}))}}])}(Rt);function hu(t){return hu="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},hu(t)}function yu(t){return function(t){if(Array.isArray(t))return vu(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 vu(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vu(t,e):void 0}}(t)||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 vu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function mu(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,gu(r.key),r)}}function gu(t){var e=function(t,e){if("object"!=hu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=hu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==hu(e)?e:e+""}function bu(t,e,n){return e=_u(e),function(t,e){if(e&&("object"==hu(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,wu()?Reflect.construct(e,n||[],_u(t).constructor):e.apply(t,n))}function wu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(wu=function(){return!!t})()}function _u(t){return _u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_u(t)}function Su(t,e){return Su=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Su(t,e)}pu.defaultConfig={},pu.targetAction=_s;var ku,xu=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),bu(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&&Su(t,e)}(e,t),function(t,e,n){return e&&mu(t.prototype,e),n&&mu(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,yu(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,yu(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.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:"fromData",value:function(t){return this}},{key:"construct",value:function(t,e){for(var n,r=0;r<t.length;r++){var o=t[r];0===r&&e?e.setInitChild(o.contentNode):r>0&&(null===(n=t[r-1].contentNode)||void 0===n||n.setInitChild(o.contentNode))}return t.length?t[0].contentNode:null}}])}(Ot);function Au(t){return Au="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Au(t)}function 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"!=Au(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Au(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Au(e)?e:e+""}function Ou(t,e,n){return e=ju(e),function(t,e){if(e&&("object"==Au(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,Pu()?Reflect.construct(e,n||[],ju(t).constructor):e.apply(t,n))}function Pu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Pu=function(){return!!t})()}function ju(t){return ju=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ju(t)}function Cu(t,e){return Cu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Cu(t,e)}!function(t){t.soundEffect="soundEffect",t.music="music",t.voice="voice",t.backgroundMusic="backgroundMusic"}(ku||(ku={}));var Iu=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=Ou(this,e)).state={playing:null,token:null},t.config=p(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&&Cu(t,e)}(e,t),function(t,e,n){return e&&Tu(t.prototype,e),n&&Tu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"play",value:function(){if(this.config.type===ku.backgroundMusic)throw new Error("Background music cannot be played directly");return this.pushAction(Ss.ActionTypes.play,[void 0])}},{key:"stop",value:function(){if(this.config.type===ku.backgroundMusic)throw new Error("Background music cannot be stopped directly");return this.pushAction(Ss.ActionTypes.stop,[void 0])}},{key:"fade",value:function(t,e,n){if(this.config.type===ku.backgroundMusic)throw new Error("Background music cannot be faded directly");return this.pushAction(Ss.ActionTypes.fade,[{start:t,end:e,duration:n}])}},{key:"setVolume",value:function(t){return this.pushAction(Ss.ActionTypes.setVolume,[t])}},{key:"setRate",value:function(t){return this.pushAction(Ss.ActionTypes.setRate,[t])}},{key:"pause",value:function(t){return void 0!==t?this.fade(void 0,0,t):this.pushAction(Ss.ActionTypes.pause,[void 0])}},{key:"resume",value:function(t){return void 0!==t?this.fade(0,this.config.volume,t):this.pushAction(Ss.ActionTypes.resume,[void 0])}},{key:"getHowlOptions",value:function(){return{src:this.config.src,loop:this.config.loop,volume:this.config.volume,html5:this.config.streaming,autoplay:!1}}},{key:"getSrc",value:function(){return this.config.src}},{key:"$setToken",value:function(t){this.state.token=t}},{key:"$getToken",value:function(){return this.state.token}},{key:"$setHowl",value:function(t){this.state.playing=t}},{key:"$getHowl",value:function(){return this.state.playing}},{key:"$stop",value:function(){this.$setToken(null),this.$setHowl(null)}},{key:"toData",value:function(){return w(this.config,e.defaultConfig)?null:{config:y(this.config)}}},{key:"fromData",value:function(t){return this.config=p(this.config,t.config),this}},{key:"pushAction",value:function(t,e){return this.chain(new Ss(this.chain(),t,new Ee(de.getIdManager().getStringId()).setContent(e)))}}])}(Rt);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 Mu(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"!=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+""}Iu.defaultConfig={src:"",sync:!1,loop:!1,volume:1};var Ru=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&&Mu(t.prototype,e),n&&Mu(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 Iu){if(this.isSrcRegistered(t.getSrc()))return this;this.src.push({type:"audio",src:t})}else if(t instanceof Ga||Ns.isStaticImageData(t)){if(t instanceof Ga){if(this.isSrcRegistered(Ns.srcToString(t.state.src)))return this}else if(this.isSrcRegistered(Ns.srcToString(t.src)))return this;this.src.push({type:"image",src:t instanceof Ga?t:new Ga("",{src:Ns.staticImageDataToSrc(t)})})}else if("object"===Lu(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 Iu?e:new Iu({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 Iu?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===Ns.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 Fu(t){return Fu="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},Fu(t)}function Vu(t){return function(t){if(Array.isArray(t))return Du(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 Du(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)?Du(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 Du(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Bu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Gu(r.key),r)}}function Gu(t){var e=function(t,e){if("object"!=Fu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Fu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Fu(e)?e:e+""}function Uu(t,e,n){return e=zu(e),function(t,e){if(e&&("object"==Fu(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||[],zu(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 $u(){return $u="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}},$u.apply(null,arguments)}function zu(t){return zu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},zu(t)}function Wu(t,e){return Wu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Wu(t,e)}Ru.SrcTypes={image:"image",video:"video",audio:"audio"};var Yu=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.defaultConfig;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=Uu(this,e)).srcManager=new Ru,n.events=new m,n._liveState={active:!1},n.id=t,n.name=t,n.config=p(e.defaultConfig,r),n.state=p(e.defaultState,n.config),n.backgroundImageState={position:new Fe(Ae.Center)},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&&Wu(t,e)}(e,t),function(t,e,n){return e&&Bu(t.prototype,e),n&&Bu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"activate",value:function(){return this.chain(this._init(this))}},{key:"deactivate",value:function(){return this.chain(this._exit())}},{key:"setBackground",value:function(t,e){if(e){var n=e.copy();n.setSrc(Ns.backgroundToSrc(t)),this._transitionSceneBackground(void 0,n)}return this.chain(new ms(this.chain(),"scene:setBackground",new Ee(de.getIdManager().getStringId()).setContent([t])))}},{key:"applyTransform",value:function(t){return this.chain(new ms(this.chain(),"scene:applyTransform",new Ee(de.getIdManager().getStringId()).setContent([t])))}},{key:"jumpTo",value:function(t,e){var n=e||{};return this.chain(new ms(this.chain(),"scene:preUnmount",new Ee(de.getIdManager().getStringId()).setContent([])))._transitionToScene(t,n.transition).chain(t._init()).chain(this._exit())._jumpTo(t)}},{key:"sleep",value:function(t){return this.chain(new ms(this.chain(),"scene:sleep",new Ee(de.getIdManager().getStringId()).setContent(t)))}},{key:"setBackgroundMusic",value:function(t,e){return this.chain(new ms(this.chain(),Ya.setBackgroundMusic,new Ee(de.getIdManager().getStringId()).setContent([t,e])))}},{key:"toData",value:function(){var t;return{state:Object.assign(Object.assign({},y(this.state)),{backgroundMusic:null===(t=this.state.backgroundMusic)||void 0===t?void 0:t.toData(),background:this.state.background}),backgroundImageState:Ga.serializeImageState(this.backgroundImageState)}}},{key:"fromData",value:function(t){return this.state=p(this.state,t.state),t.state.backgroundMusic&&(this.state.backgroundMusic=(new Iu).fromData(t.state.backgroundMusic),this.state.background=t.state.background),t.backgroundImageState&&(this.backgroundImageState=Ga.deserializeImageState(t.backgroundImageState)),this}},{key:"getInitTransform",value:function(){return new La([{props:Object.assign(Object.assign({},this.backgroundImageState),{opacity:1}),options:{duration:0}}])}},{key:"action",value:function(t){var n=(Array.isArray(t)?t.flat(2):t(this).flat(2)).map((function(t){return Et.isChained(t)?t.fromChained(t):t})).flat(2),r=this.getAllChildrenElements(n).filter((function(t){return t instanceof Ga&&!Et.isChained(t)})),o=[this._init(this)].concat(Vu(r.map((function(t){return t._init()}))),Vu(n)),i=function(t,e,n,r){var o=$u(zu(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"construct",this,3)([o]),a=new Ee(de.getIdManager().getStringId(),void 0,void 0,i||void 0).setContent(this);return null==i||i.setParent(a),this.sceneRoot=new ms(this.chain(),"scene:action",a),this}},{key:"registerSrc",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Set;if(this.sceneRoot){var n=new Set,r=[this.sceneRoot],o=new Set;for(Ns.backgroundToSrc(this.config.background)&&this.srcManager.register(new Ga({src:Ns.backgroundToSrc(this.config.background)}));r.length;){var i=r.shift();if(i instanceof ms){if(i.type===Ya.jumpTo){var a=i,s=a.contentNode.getContent()[0];if(n.has(a)||e.has(s))continue;n.add(a),o.add(s),e.add(s)}else if(i.type===Ya.setBackground){var u=i.contentNode.getContent()[0];this.srcManager.register(new Ga({src:Ns.backgroundToSrc(u)}))}}else if(i instanceof gs){var c=i;if(this.srcManager.register(c.callee),i.type===qa.setSrc){var l=i.contentNode.getContent()[0];this.srcManager.register(new Ga({src:l}))}}else if(i instanceof Ss)this.srcManager.register(i.callee);else if(i instanceof ks){var f=i.getFutureActions();r.push.apply(r,Vu(f))}r.push.apply(r,Vu(i.getFutureActions()))}o.forEach((function(n){n.registerSrc(e),t.srcManager.registerFuture(n.srcManager)}))}}},{key:"assignActionId",value:function(){this.getAllChildren(this.sceneRoot||[]).forEach((function(t,e){t.setId("action-".concat(e))}))}},{key:"assignElementId",value:function(){this.getAllChildrenElements(this.sceneRoot||[]).forEach((function(t,e){t.setId("element-".concat(e))}))}},{key:"_applyTransition",value:function(t){return this.chain(new ms(this.chain(),"scene:applyTransition",new Ee(de.getIdManager().getStringId()).setContent([t])))}},{key:"_transitionSceneBackground",value:function(t,e){return this._transitionToScene(t,e)}},{key:"_jumpTo",value:function(t){return this.chain(new ms(this.chain(),"scene:jumpTo",new Ee(de.getIdManager().getStringId()).setContent([t])))}},{key:"_exit",value:function(){return new ms(this.chain(),"scene:exit",new Ee(de.getIdManager().getStringId()).setContent([]))}},{key:"_transitionToScene",value:function(t,e){var n=this.chain();if(e){var r=e.copy();t&&r.setSrc(Ns.backgroundToSrc(t.state.background)),n._applyTransition(r)}return n}},{key:"_init",value:function(){return new ms((arguments.length>0&&void 0!==arguments[0]?arguments[0]:this).chain(),"scene:init",new Ee(de.getIdManager().getStringId()).setContent([]))}}])}(xu);function qu(t){return qu="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},qu(t)}function Xu(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,Ku(r.key),r)}}function Ku(t){var e=function(t,e){if("object"!=qu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=qu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==qu(e)?e:e+""}function Zu(t,e,n){return e=tc(e),Qu(t,Ju()?Reflect.construct(e,n||[],tc(t).constructor):e.apply(t,n))}function Qu(t,e){if(e&&("object"==qu(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 Ju(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ju=function(){return!!t})()}function tc(t){return tc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},tc(t)}function ec(t,e){return ec=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ec(t,e)}Yu.EventTypes={"event:scene.applyTransition":"event:scene.applyTransition","event:scene.remove":"event:scene.remove","event:scene.load":"event:scene.load","event:scene.unload":"event:scene.unload","event:scene.mount":"event:scene.mount","event:scene.unmount":"event:scene.unmount","event:scene.preUnmount":"event:scene.preUnmount","event:scene.imageLoaded":"event:scene.imageLoaded","event:scene.initTransform":"event:scene.initTransform","event:scene.setBackgroundMusic":"event:scene.setBackgroundMusic","event:scene.applyTransform":"event:scene.applyTransform"},Yu.defaultConfig={background:null,invertY:!1,invertX:!1,backgroundMusic:null,backgroundMusicFade:0},Yu.defaultState={};var nc=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=Zu(this,e)).handler=t,Qu(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&&ec(t,e)}(e,t),function(t,e,n){return e&&Xu(t.prototype,e),n&&Xu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"execute",value:function(t){var e=t.gameState;this.handler(this.getCtx({gameState:e}))}},{key:"getCtx",value:function(t){var e=t.gameState;return{gameState:e,game:e.game,liveGame:e.game.getLiveGame(),storable:e.game.getLiveGame().getStorable()}}},{key:"fromChained",value:function(t){return[new ws(this.chain(),ws.ActionTypes.action,new Ee(de.getIdManager().getStringId()).setContent(t))]}}])}(Rt);function rc(t){return rc="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},rc(t)}function oc(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,ic(r.key),r)}}function ic(t){var e=function(t,e){if("object"!=rc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=rc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==rc(e)?e:e+""}function ac(t,e,n){return e=uc(e),function(t,e){if(e&&("object"==rc(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,sc()?Reflect.construct(e,n||[],uc(t).constructor):e.apply(t,n))}function sc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(sc=function(){return!!t})()}function uc(t){return uc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},uc(t)}function cc(t,e){return cc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},cc(t,e)}var lc=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=ac(this,e)).entryScene=null,n.id=de.getIdManager().getStringId(),n.name=t,n.config=p(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&&cc(t,e)}(e,t),function(t,e,n){return e&&oc(t.prototype,e),n&&oc(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 Fs(t).run()}}])}(xu);lc.defaultConfig={};var fc=r(72),dc=r.n(fc),pc=r(825),hc=r.n(pc),yc=r(659),vc=r.n(yc),mc=r(56),gc=r.n(mc),bc=r(540),wc=r.n(bc),_c=r(113),Sc=r.n(_c),kc=r(587),xc={};xc.styleTagTransform=Sc(),xc.setAttributes=gc(),xc.insert=vc().bind(null,"head"),xc.domAPI=hc(),xc.insertStyleElement=wc();dc()(kc.A,xc);kc.A&&kc.A.locals&&kc.A.locals;var Ac=r(848);const Tc=(0,$.createContext)({strict:!1});function Ec(t){for(const e in t)Ni[e]={...Ni[e],...t[e]}}function Oc({children:t,features:e,strict:n=!1}){const[,r]=(0,$.useState)(!Pc(e)),o=(0,$.useRef)(void 0);if(!Pc(e)){const{renderer:t,...n}=e;o.current=t,Ec(n)}return(0,$.useEffect)((()=>{Pc(e)&&e().then((({renderer:t,...e})=>{Ec(e),o.current=t,r(!0)}))}),[]),(0,Ac.jsx)(Tc.Provider,{value:{renderer:o.current,strict:n},children:t})}function Pc(t){return"function"==typeof t}function jc(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 Cc(t,e,n={}){var r;const o=li(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(wi(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(Ic).forEach(((t,r)=>{t.notify("AnimationStart",e),a.push(Cc(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 Ic(t,e){return t.sortNodePosition(e)}const Lc=[...ji].reverse(),Mc=ji.length;function Nc(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=>Cc(t,e,n)));r=Promise.all(o)}else if("string"==typeof e)r=Cc(t,e,n);else{const o="function"==typeof e?li(t,e,n.custom):e;r=Promise.all(wi(t,o,n))}return r.then((()=>{t.notify("AnimationComplete",e)}))}(t,e,n))))}function Rc(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!jc(e,t)}function Fc(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Vc(){return{animate:Fc(!0),whileInView:Fc(),whileHover:Fc(),whileTap:Fc(),whileDrag:Fc(),whileFocus:Fc(),exit:Fc()}}class Dc{constructor(t){this.isMounted=!1,this.node=t}update(){}}let Bc=0;const Gc={animation:{Feature:class extends Dc{constructor(t){super(t),t.animationState||(t.animationState=function(t){let e=Nc(t),n=Vc(),r=!0;const o=e=>(n,r)=>{var o;const i=li(t,r,"exit"===e?null===(o=t.presenceContext)||void 0===o?void 0:o.custom:void 0);if(i){const{transition:t,transitionEnd:e,...r}=i;n={...n,...r,...e}}return n};function i(i){const a=t.getProps(),s=t.getVariantContext(!0)||{},u=[],c=new Set;let l={},f=1/0;for(let e=0;e<Mc;e++){const d=Lc[e],p=n[d],h=void 0!==a[d]?a[d]:s[d],y=Pi(h),v=d===i?p.isActive:null;!1===v&&(f=e);let m=h===s[d]&&h!==a[d]&&y;if(m&&r&&t.manuallyAnimateOnMount&&(m=!1),p.protectedKeys={...l},!p.isActive&&null===v||!h&&!p.prevProp||Oi(h)||"boolean"==typeof h)continue;let g=Rc(p.prevProp,h)||d===i&&p.isActive&&!m&&y||e>f&&y,b=!1;const w=Array.isArray(h)?h:[h];let _=w.reduce(o(d),{});!1===v&&(_={});const{prevResolvedValues:S={}}=p,k={...S,..._},x=e=>{g=!0,c.has(e)&&(b=!0,c.delete(e)),p.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in k){const e=_[t],n=S[t];if(l.hasOwnProperty(t))continue;let r=!1;r=Jo(e)&&Jo(n)?!jc(e,n):e!==n,r?null!=e?x(t):c.add(t):void 0!==e&&c.has(t)?x(t):p.protectedKeys[t]=!0}p.prevProp=h,p.prevResolvedValues=_,p.isActive&&(l={...l,..._}),r&&t.blockInitialAnimation&&(g=!1),!g||m&&!b||u.push(...w.map((t=>({animation:t,options:{type:d}}))))}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 d=Boolean(u.length);return!r||!1!==a.initial&&a.initial!==a.animate||t.manuallyAnimateOnMount||(d=!1),r=!1,d?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=Vc(),r=!0}}}(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Oi(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 Dc{constructor(){super(...arguments),this.id=Bc++}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 Uc(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function Hc(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const $c=t=>e=>(t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary)(e)&&t(e,Hc(e));function zc(t,e,n,r){return Uc(t,e,$c(n),r)}function Wc(t){let e=null;return()=>{const n=()=>{e=null};return null===e&&(e=t,n)}}const Yc=Wc("dragHorizontal"),qc=Wc("dragVertical");function Xc(){const t=function(t){let e=!1;if("y"===t)e=qc();else if("x"===t)e=Yc();else{const t=Yc(),n=qc();t&&n?e=()=>{t(),n()}:(t&&t(),n&&n())}return e}(!0);return!t||(t(),!1)}function Kc(t,e){const n=e?"pointerenter":"pointerleave",r=e?"onHoverStart":"onHoverEnd";return zc(t.current,n,((n,o)=>{if("touch"===n.pointerType||Xc())return;const i=t.getProps();t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",e);const a=i[r];a&&Xe.postRender((()=>a(n,o)))}),{passive:!t.getProps()[r]})}const Zc=(t,e)=>!!e&&(t===e||Zc(t,e.parentElement));function Qc(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,Hc(n))}const Jc=new WeakMap,tl=new WeakMap,el=t=>{const e=Jc.get(t.target);e&&e(t)},nl=t=>{t.forEach(el)};function rl(t,e,n){const r=function({root:t,...e}){const n=t||document;tl.has(n)||tl.set(n,{});const r=tl.get(n),o=JSON.stringify(e);return r[o]||(r[o]=new IntersectionObserver(nl,{root:t,...e})),r[o]}(e);return Jc.set(t,n),r.observe(t),()=>{Jc.delete(t),r.unobserve(t)}}const ol={some:0,all:1};const il={inView:{Feature:class extends Dc{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:ol[r]};return rl(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 Dc{constructor(){super(...arguments),this.removeStartListeners=Be,this.removeEndListeners=Be,this.removeAccessibleListeners=Be,this.startPointerPress=(t,e)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),r=zc(window,"pointerup",((t,e)=>{if(!this.checkPressEnd())return;const{onTap:n,onTapCancel:r,globalTapTarget:o}=this.node.getProps(),i=o||Zc(this.node.current,t.target)?n:r;i&&Xe.update((()=>i(t,e)))}),{passive:!(n.onTap||n.onPointerUp)}),o=zc(window,"pointercancel",((t,e)=>this.cancelPress(t,e)),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=mo(r,o),this.startPress(t,e)},this.startAccessiblePress=()=>{const t=Uc(this.node.current,"keydown",(t=>{if("Enter"!==t.key||this.isPressing)return;this.removeEndListeners(),this.removeEndListeners=Uc(this.node.current,"keyup",(t=>{"Enter"===t.key&&this.checkPressEnd()&&Qc("up",((t,e)=>{const{onTap:n}=this.node.getProps();n&&Xe.postRender((()=>n(t,e)))}))})),Qc("down",((t,e)=>{this.startPress(t,e)}))})),e=Uc(this.node.current,"blur",(()=>{this.isPressing&&Qc("cancel",((t,e)=>this.cancelPress(t,e)))}));this.removeAccessibleListeners=mo(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&&Xe.postRender((()=>n(t,e)))}checkPressEnd(){this.removeEndListeners(),this.isPressing=!1;return this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!Xc()}cancelPress(t,e){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&Xe.postRender((()=>n(t,e)))}mount(){const t=this.node.getProps(),e=zc(t.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),n=Uc(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=mo(e,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}},focus:{Feature:class extends Dc{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=mo(Uc(this.node.current,"focus",(()=>this.onFocus())),Uc(this.node.current,"blur",(()=>this.onBlur())))}unmount(){}}},hover:{Feature:class extends Dc{mount(){this.unmount=mo(Kc(this.node,!0),Kc(this.node,!1))}unmount(){}}}},al=["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 sl(t){return"string"==typeof t&&!t.includes("-")&&!!(al.indexOf(t)>-1||/[A-Z]/u.test(t))}const ul={renderer:(t,e)=>sl(t)?new ta(e):new na(e,{allowProjection:t!==$.Fragment}),...Gc,...il};function cl(t){var e=t.children;return z().createElement(Oc,{features:ul,strict:!0},e)}function ll(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 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}}(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 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 dl(t){var e=t.children,n=t.className,r=ll((0,$.useState)({}),2),o=r[0],i=r[1],a=tt().ratio,s=ct().game,u=ll((0,$.useReducer)((function(t){return t+1}),0),2)[1],c=s.config.player.minWidth,l=s.config.player.minHeight;return(0,$.useEffect)((function(){var t,e=function(){if(a.isLocked())console.warn("Ratio is locked, skipping update");else{var t=document.getElementById(s.config.player.contentContainerId);if(t){var e,n,r=t.clientWidth,o=t.clientHeight,f=s.config.player.aspectRatio;r/o>f?(e=o*f,n=o):(e=r,n=r/f),e<c&&(e=c),n<l&&(n=l),i({width:"".concat(e,"px"),height:"".concat(n,"px"),margin:"auto",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",display:"flex",alignItems:"center",justifyContent:"center"}),a.update(e,n),a.updateMin(c,l),u()}}};a.setUpdate(e);var n=function(){e(),clearTimeout(t),a.pause(),t=setTimeout((function(){a.resume()}),100)};return e(),window.addEventListener("resize",n),function(){window.removeEventListener("resize",n),clearTimeout(t)}}),[a]),z().createElement("div",{id:s.config.player.contentContainerId,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"}},z().createElement("div",{className:H(n),style:o},e))}var pl={start:"start",update:"update",end:"end"};function hl(t){var e=t.children,n=tt().ratio,r=ct().game,o=(0,$.useRef)(null);return(0,$.useEffect)((function(){if(!o.current)throw new Error("Content container not found")}),[r.config.player.contentContainerId]),z().createElement(z().Fragment,null,z().createElement("div",{ref:o,className:H("absolute inset-0 flex items-center justify-center bg-cover bg-center overflow-hidden"),style:Object.assign({},n.getStyle())},e))}function yl(t){return yl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yl(t)}function vl(){return vl=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},vl.apply(null,arguments)}function ml(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ml=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",p="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==yl(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function T(e,n,r){var o=d;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===d)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(yl(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function gl(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 bl(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)?bl(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 bl(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 wl=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 _l(t){var e=this,n=t.scene,r=t.props,o=t.state,i=(0,$.useRef)(null),a=ct().game,s=gl((0,$.useState)(null),2),u=s[0],c=s[1],l=gl((0,$.useState)([]),2)[1],f=gl((0,$.useState)(null),2),d=f[0],h=f[1],y=gl((0,$.useState)({}),2),v=y[0],m=y[1];function g(){n.events.emit(Yu.EventTypes["event:scene.imageLoaded"])}function b(t){if(d&&d.getControl()&&(console.warn("processing transform not completed"),d.getControl().complete(),d.setControl(null)),!i.current)throw new Error("scope not ready");t instanceof La?Object.assign(i.current.style,t.propToCSS(o,n.backgroundImageState)):Object.assign(i.current.style,t)}(0,$.useEffect)((function(){var t=n.events.onEvents([{type:Yu.EventTypes["event:scene.applyTransition"],listener:n.events.on(Yu.EventTypes["event:scene.applyTransition"],(function(t){return c(t),t?new Promise((function(e){var n=t.events.onEvents([{type:pl.update,listener:t.events.on(pl.update,(function(t){l(t)}))},{type:pl.end,listener:t.events.on(pl.end,(function(){c(null),e(),o.logger.debug("transition end",u)}))},{type:pl.start,listener:t.events.on(pl.start,(function(){o.logger.debug("transition start",u)}))}]);t.start((function(){n.cancel(),e()}))})):(o.logger.warn("transition not set"),Promise.resolve())}))},{type:Yu.EventTypes["event:scene.applyTransform"],listener:n.events.on(Yu.EventTypes["event:scene.applyTransform"],(function(t){return wl(e,void 0,void 0,ml().mark((function e(){return ml().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return b(t.propToCSS(o,n.backgroundImageState)),h(t),e.next=4,t.animate({scope:i},o,n.backgroundImageState,(function(e){n.backgroundImageState=p(n.backgroundImageState,e),m({style:t.propToCSS(o,n.backgroundImageState)}),h(null)}));case 4:case"end":return e.stop()}}),e)})))}))},{type:Yu.EventTypes["event:scene.initTransform"],listener:n.events.on(Yu.EventTypes["event:scene.initTransform"],(function(t){return wl(e,void 0,void 0,ml().mark((function e(){return ml().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o.logger.debug("init transform",t),e.next=3,t.animate({scope:i},o,n.backgroundImageState,(function(t){n.backgroundImageState=p(n.backgroundImageState,t)}));case 3:case"end":return e.stop()}}),e)})))}))}]);return function(){t.cancel()}}),[n]),(0,$.useEffect)((function(){b(n.backgroundImageState)}),[]),(0,$.useEffect)((function(){var t=o.events.onEvents([{type:G.EventTypes["event:state.player.skip"],listener:o.events.on(G.EventTypes["event:state.player.skip"],(function(){d&&d.getControl()&&(d.getControl().complete(),d.setControl(null))}))}]);return function(){t.cancel()}}),[d]);var w,_="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",S={src:_,style:Object.assign({opacity:0},a.config.app.debug?{border:"1px solid red"}:{})};return z().createElement("div",null,u?u.toElementProps().map((function(t,e,n){var o=p(S,r,v,t);return z().createElement(hl,{key:e},z().createElement("img",vl({alt:o.alt},o,{onLoad:g,src:o.src||_,ref:e===n.length-1?i:void 0,className:"absolute"})))})):(w=p(S,r,v),z().createElement(hl,null,z().createElement("img",vl({alt:w.alt},w,{onLoad:g,ref:i,src:w.src||_,className:"absolute"})))))}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 kl(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */kl=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",p="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==Sl(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=d;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===d)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(Sl(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function xl(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 Al(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)?Al(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 Al(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 Tl=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 El(t){var e=t.scene,n=t.state,r=t.children,o=t.className,i=tt().ratio,a=xl((0,$.useState)((function(){return e.state.backgroundMusic})),2),s=a[0],u=a[1],c=xl((0,$.useState)(null),2),l=c[0],f=c[1],d=xl((0,$.useState)(null),2),p=d[0],h=d[1];function y(t,e){return Tl(this,void 0,void 0,kl().mark((function n(){var r;return kl().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(t.$getHowl()&&t.$getHowl().playing(t.$getToken())){n.next=2;break}return n.abrupt("return",Promise.resolve());case 2:return r=t.$getHowl().volume(t.$getToken()),n.next=5,new Promise((function(n){t.$getHowl().fade(r,0,e,t.$getToken()),h((function(){return n})),f(setTimeout((function(){t.$getHowl().stop(),t.$getHowl().volume(r),t.$setToken(null),n(),h(null)}),e))}));case 5:return n.abrupt("return",n.sent);case 6:case"end":return n.stop()}}),n)})))}return(0,$.useEffect)((function(){var t=[{type:"event:scene.setBackgroundMusic",listener:e.events.on(Yu.EventTypes["event:scene.setBackgroundMusic"],(function(t,e){(function(t,e){var n,r,o,i,a,c;return Tl(this,void 0,void 0,kl().mark((function d(){var v,m;return kl().wrap((function(d){for(;;)switch(d.prev=d.next){case 0:if(l&&(clearTimeout(l),f(null),p&&(p(),h(null))),m=t,!(v=s)){d.next=12;break}if(!e){d.next=9;break}return d.next=7,y(v,e);case 7:d.next=12;break;case 9:null===(n=v.$getHowl())||void 0===n||n.stop(),null===(r=v.$getHowl())||void 0===r||r.volume(0),v.$setToken(null);case 12:if(m){d.next=14;break}return d.abrupt("return");case 14:null===(o=m.$getHowl())||void 0===o||o.volume(0),m.$setToken(null===(i=m.$getHowl())||void 0===i?void 0:i.play(m.$getToken()||void 0)),e?null===(a=m.$getHowl())||void 0===a||a.fade(0,m.config.volume,e,m.$getToken()):null===(c=m.$getHowl())||void 0===c||c.volume(m.config.volume,m.$getToken()),u(m);case 18:case"end":return d.stop()}}),d)})))})(t,e).then()}))},{type:"event:scene.preUnmount",listener:e.events.on(Yu.EventTypes["event:scene.preUnmount"],(function(){l&&(clearTimeout(l),p&&p()),s&&y(s,e.state.backgroundMusicFade).then()}))}];return function(){t.forEach((function(t){var n=t.type,r=t.listener;e.events.off(n,r)}))}}),[]),(0,$.useEffect)((function(){return e.events.emit(Yu.EventTypes["event:scene.mount"]),function(){e.events.emit(Yu.EventTypes["event:scene.unmount"])}}),[]),z().createElement("div",{className:o},z().createElement(_l,{scene:e,props:{width:i.state.width,height:i.state.height,src:Ns.backgroundToSrc(e.state.background)},state:n}),r)}function Ol(t){if("undefined"==typeof Proxy)return t;const e=new Map;return new Proxy(((...e)=>t(...e)),{get:(n,r)=>"create"===r?t:(e.has(r)||e.set(r,t(r)),e.get(r))})}const Pl=(0,$.createContext)({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),jl=(0,$.createContext)({}),Cl=(0,$.createContext)(null),Il=Ai?$.useLayoutEffect:$.useEffect,{schedule:Ll,cancel:Ml}=qe(queueMicrotask,!1);function Nl(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}const Rl=(0,$.createContext)({});let Fl=!1;function Vl(t,e,n,r,o){var i;const{visualElement:a}=(0,$.useContext)(jl),s=(0,$.useContext)(Tc),u=(0,$.useContext)(Cl),c=(0,$.useContext)(Pl).reducedMotion,l=(0,$.useRef)();r=r||s.renderer,!l.current&&r&&(l.current=r(t,{visualState:e,parent:a,props:n,presenceContext:u,blockInitialAnimation:!!u&&!1===u.initial,reducedMotionConfig:c}));const f=l.current,d=(0,$.useContext)(Rl);!f||f.projection||!o||"html"!==f.type&&"svg"!==f.type||function(t,e,n,r){const{layoutId:o,layout:i,drag:a,dragConstraints:s,layoutScroll:u,layoutRoot:c}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Bl(t.parent)),t.projection.setOptions({layoutId:o,layout:i,alwaysMeasureLayout:Boolean(a)||s&&Nl(s),visualElement:t,animationType:"string"==typeof i?i:"both",initialPromotionConfig:r,layoutScroll:u,layoutRoot:c})}(l.current,n,o,d),(0,$.useInsertionEffect)((()=>{f&&f.update(n,u)}));const p=n[pi],h=(0,$.useRef)(Boolean(p)&&!window.MotionHandoffIsComplete&&(null===(i=window.MotionHasOptimisedAnimation)||void 0===i?void 0:i.call(window,p)));return Il((()=>{f&&(f.updateFeatures(),Ll.render(f.render),h.current&&f.animationState&&f.animationState.animateChanges())})),(0,$.useEffect)((()=>{f&&(!h.current&&f.animationState&&f.animationState.animateChanges(),h.current=!1,Fl||(Fl=!0,queueMicrotask(Dl)))})),f}function Dl(){window.MotionHandoffIsComplete=!0}function Bl(t){if(t)return!1!==t.options.allowProjection?t.projection:Bl(t.parent)}function Gl(t,e,n){return(0,$.useCallback)((r=>{r&&t.mount&&t.mount(r),e&&(r?e.mount(r):e.unmount()),n&&("function"==typeof n?n(r):Nl(n)&&(n.current=r))}),[e])}function Ul(t){const{initial:e,animate:n}=function(t,e){if(Ii(t)){const{initial:e,animate:n}=t;return{initial:!1===e||Pi(e)?e:void 0,animate:Pi(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,(0,$.useContext)(jl));return(0,$.useMemo)((()=>({initial:e,animate:n})),[Hl(e),Hl(n)])}function Hl(t){return Array.isArray(t)?t.join(" "):t}const $l=(0,$.createContext)({}),zl=Symbol.for("motionComponentSymbol");function Wl({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:r,Component:o}){t&&Ec(t);const i=(0,$.forwardRef)((function(t,i){let a;const s={...(0,$.useContext)(Pl),...t,layoutId:Yl(t)},{isStatic:u}=s,c=Ul(t),l=r(t,u);if(!u&&Ai){!function(){(0,$.useContext)(Tc).strict;0}();const t=function(t){const{drag:e,layout:n}=Ni;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=Vl(o,l,s,e,t.ProjectionNode)}return(0,Ac.jsxs)(jl.Provider,{value:c,children:[a&&c.visualElement?(0,Ac.jsx)(a,{visualElement:c.visualElement,...s}):null,n(o,t,Gl(l,c.visualElement,i),l,u,c.visualElement)]})}));return i[zl]=o,i}function Yl({layoutId:t}){const e=(0,$.useContext)($l).id;return e&&void 0!==t?e+"-"+t:t}function ql(t){const e=mi(t)?t.get():t;return ti(e)?e.toValue():e}const Xl=t=>(e,n)=>{const r=(0,$.useContext)(jl),o=(0,$.useContext)(Cl),i=()=>function({applyWillChange:t=!1,scrapeMotionValuesFromProps:e,createRenderState:n,onMount:r},o,i,a,s){const u={latestValues:Ql(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,$.useRef)(null);return null===e.current&&(e.current=t()),e.current}(i)};function Kl(t,e){const n=yi(e);n&&ni(t,n)}function Zl(t,e,n){const r=Array.isArray(e)?e:[e];for(let e=0;e<r.length;e++){const o=ci(t,r[e]);if(o){const{transitionEnd:t,transition:e,...r}=o;n(r,t)}}}function Ql(t,e,n,r,o){var i;const a={},s=[],u=r&&void 0===(null===(i=t.style)||void 0===i?void 0:i.willChange),c=o(t,{});for(const t in c)a[t]=ql(c[t]);let{initial:l,animate:f}=t;const d=Ii(t),p=Li(t);e&&p&&!d&&!1!==t.inherit&&(void 0===l&&(l=e.initial),void 0===f&&(f=e.animate));let h=!!n&&!1===n.initial;h=h||!1===l;const y=h?f:l;return y&&"boolean"!=typeof y&&!Oi(y)&&Zl(t,y,((t,e)=>{for(const e in t){let n=t[e];if(Array.isArray(n)){n=n[h?n.length-1:0]}null!==n&&(a[e]=n)}for(const t in e)a[t]=e[t]})),u&&(f&&!1!==l&&!Oi(f)&&Zl(t,f,(t=>{for(const e in t)Kl(s,e)})),s.length&&(a.willChange=s.join(","))),a}const Jl=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),tf=()=>({...Jl(),attrs:{}}),ef={useVisualState:Xl({scrapeMotionValuesFromProps:xi,createRenderState:tf,onMount:(t,e,{renderState:n,latestValues:r})=>{Xe.read((()=>{try{n.dimensions="function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch(t){n.dimensions={x:0,y:0,width:0,height:0}}})),Xe.render((()=>{Xi(n,r,Ji(e.tagName),t.transformTemplate),Qi(e,n)}))}})},nf={useVisualState:Xl({applyWillChange:!0,scrapeMotionValuesFromProps:ki,createRenderState:Jl})};function rf(t,e,n){for(const r in e)mi(e[r])||Si(r,n)||(t[r]=e[r])}function of(t,e){const n={};return rf(n,t.style||{},t),Object.assign(n,function({transformTemplate:t},e){return(0,$.useMemo)((()=>{const n=Jl();return zi(n,e,t),Object.assign({},n.vars,n.style)}),[e])}(t,e)),n}function af(t,e){const n={},r=of(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 sf=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 uf(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||sf.has(t)}let cf=t=>!uf(t);try{(lf=require("@emotion/is-prop-valid").default)&&(cf=t=>t.startsWith("on")?!uf(t):lf(t))}catch(pt){}var lf;function ff(t,e,n,r){const o=(0,$.useMemo)((()=>{const n=tf();return Xi(n,e,Ji(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 df(t=!1){return(e,n,r,{latestValues:o},i)=>{const a=(sl(e)?ff:af)(n,o,i,e),s=function(t,e,n){const r={};for(const o in t)"values"===o&&"object"==typeof t.values||(cf(o)||!0===n&&uf(o)||!e&&!uf(o)||t.draggable&&o.startsWith("onDrag"))&&(r[o]=t[o]);return r}(n,"string"==typeof e,t),u=e!==$.Fragment?{...s,...a,ref:r}:{},{children:c}=n,l=(0,$.useMemo)((()=>mi(c)?c.get():c),[c]);return(0,$.createElement)(e,{...u,children:l})}}function pf(t,e){return function(n,{forwardMotionProps:r}={forwardMotionProps:!1}){return Wl({...sl(n)?ef:nf,preloadedFeatures:t,useRender:df(r),createVisualElement:e,Component:n})}}const hf=Ol(pf());function yf(t){return yf="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},yf(t)}function vf(){return vf=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},vf.apply(null,arguments)}function mf(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */mf=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",p="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==yf(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=d;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===d)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(yf(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function gf(t){return function(t){if(Array.isArray(t))return _f(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||wf(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 bf(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)||wf(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 wf(t,e){if(t){if("string"==typeof t)return _f(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)?_f(t,e):void 0}}function _f(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 Sf=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 kf(t){var e=this,n=t.image,r=t.state,o=t.onAnimationEnd,i=(0,$.useRef)(null),a=bf((0,$.useState)(null),2),s=a[0],u=a[1],c=bf((0,$.useState)({style:{}}),2),l=c[0],f=c[1],d=bf((0,$.useState)(null),2),h=d[0],y=d[1],v=bf((0,$.useState)([]),2)[1],m=bf((0,$.useState)(0),2),g=m[0],b=m[1],w=ct().game;(0,$.useEffect)((function(){n.setScope(i),n.events.emit(Ga.EventTypes["event:image.mount"]);var t=n.events.onEvents([].concat(gf([Ga.EventTypes["event:image.show"],Ga.EventTypes["event:image.hide"],Ga.EventTypes["event:image.applyTransform"]].map((function(t){return{type:t,listener:n.events.on(t,(function(t){return Sf(e,void 0,void 0,mf().mark((function e(){return mf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return S(t.propToCSS(r,n.state)),u(t),r.logger.debug("transform",t,t.propToCSS(r,n.state)),e.next=5,t.animate({scope:i},r,n.state,(function(e){n.state=p(n.state,e),f({style:t.propToCSS(r,n.state)}),o&&o(),u(null)}));case 5:return e.abrupt("return",!0);case 6:case"end":return e.stop()}}),e)})))}))}}))),[{type:Ga.EventTypes["event:image.init"],listener:n.events.on(Ga.EventTypes["event:image.init"],(function(){return Sf(e,void 0,void 0,mf().mark((function t(){return mf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.toTransform().animate({scope:i},r,n.state,(function(t){n.state=p(n.state,t),f({style:n.toTransform().propToCSS(r,n.state)})}));case 2:case"end":return t.stop()}}),t)})))}))}]));return S(n.toTransform().propToCSS(r,n.state)),n.events.emit(Ga.EventTypes["event:image.ready"],i),function(){t.cancel(),n.events.emit(Ga.EventTypes["event:image.unmount"])}}),[]),(0,$.useEffect)((function(){var t=n.events.onEvents([{type:Ga.EventTypes["event:image.setTransition"],listener:n.events.on(Ga.EventTypes["event:image.setTransition"],(function(t){y(t)}))}]);return function(){t.cancel()}}),[h,n]),(0,$.useEffect)((function(){var t=h?h.events.onEvents([{type:pl.update,listener:h.events.on(pl.update,(function(t){v(t)}))},{type:pl.end,listener:h.events.on(pl.end,(function(){y(null)}))}]):null;return function(){var e;null===(e=null==t?void 0:t.cancel)||void 0===e||e.call(t)}}),[h]),(0,$.useEffect)((function(){b(performance.now())}),[]),(0,$.useEffect)((function(){var t=r.events.onEvents([{type:G.EventTypes["event:state.player.skip"],listener:r.events.on(G.EventTypes["event:state.player.skip"],(function(){s&&s.getControl()&&(s.getControl().complete(),s.setControl(null),r.logger.debug("transform skip")),h&&h.controller&&(h.controller.complete(),y(null),r.logger.debug("transition skip"))}))}]);return function(){t.cancel()}}),[h,s]);var _=function(){var t=performance.now()-g,e=w.config.elements.img.slowLoadThreshold;t>e&&w.config.elements.img.slowLoadWarning&&r.logger.warn("NarraLeaf-React","Image took ".concat(t,"ms to load, which exceeds the threshold of ").concat(e,"ms. ")+"Consider enable cache for the image, so Preloader can preload it before it's used. To disable this warning, set `elements.img.slowLoadWarning` to false in the game config.")};function S(t){if(s&&s.getControl()&&(console.warn("processing transform not completed"),s.getControl().complete(),s.setControl(null)),!i.current)throw new Error("scope not ready");t instanceof La?Object.assign(i.current.style,t.propToCSS(r,n.state)):Object.assign(i.current.style,t)}var k={className:"absolute",src:Ns.staticImageDataToSrc(n.state.src),style:Object.assign({opacity:0},w.config.app.debug?{border:"1px solid red"}:{})};return z().createElement(et,{className:"absolute overflow-hidden"},h?h.toElementProps().map((function(t,e,n){var r=p(k,l,t);return z().createElement(hf.img,vf({key:e,alt:r.alt},r,{ref:e===n.length-1?i:void 0,onLoad:_,layout:!0}))})):z().createElement(hf.img,vf({ref:i,alt:"image"},p(k,l),{onLoad:_})))}function xf(t){return xf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xf(t)}function Af(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,Tf(r.key),r)}}function Tf(t){var e=function(t,e){if("object"!=xf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=xf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==xf(e)?e:e+""}var Ef=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.preloaded=[],this.events=new m}return function(t,e,n){return e&&Af(t.prototype,e),n&&Af(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?Ns.srcToString(t.src.state.src):"video"===t.type?t.src:"audio"===t.type?t.src.getSrc():""}}])}();function Of(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 Pf(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)?Pf(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 Pf(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}Ef.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 jf=(0,$.createContext)(null);function Cf(t){var e=t.children,n=Of((0,$.useState)(new Ef),1)[0];return z().createElement(z().Fragment,null,z().createElement(jf.Provider,{value:{preloaded:n}},e))}function If(){if(!jf)throw new Error("usePreloaded must be used within a PreloadedProvider");return(0,$.useContext)(jf)}function Lf(t){return function(t){if(Array.isArray(t))return Mf(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 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)||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 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}function Nf(t){var e=t.state,n=t.srcManager,r=If().preloaded;return(0,$.useEffect)((function(){var t,o;if("undefined"!=typeof window){var i=null===(t=e.getLastScene())||void 0===t?void 0:t.srcManager,a=(null===(o=e.getLastScene())||void 0===o?void 0:o.srcManager.future)||[],s=[].concat(Lf(n.src),Lf(i?i.src:[]),Lf(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===Ru.SrcTypes.image?u.image.add(t.src):t.type===Ru.SrcTypes.audio?u.audio.add(t.src):t.type===Ru.SrcTypes.video&&u.video.add(t.src)})),e.logger.debug("Preloading",u,a),r.preloaded=r.preloaded.filter((function(t){if(t.type===Ru.SrcTypes.audio){var e=u[t.type].has(t.src);return e||(e=Array.from(u[t.type]).some((function(e){return r.getSrc(t)===r.getSrc(e.config.src)}))),e}if(t.type===Ru.SrcTypes.image)return u[t.type].has(t.src);var n=r.getSrc(t);return u[t.type].has(n)}));var c=[];return u.image.forEach((function(t){var n=new Image;n.src=Ns.srcToString(t.state.src),n.onload=function(){e.logger.debug("Image loaded",t.state.src)},c.push(n),r.add({type:"image",src:t})})),Promise.all([]).then((function(){e.logger.log("Preloaded","Preloaded ".concat(u.image.size," images")),r.events.emit(Ef.EventTypes["event:preloaded.ready"])})),u.audio.forEach((function(t){t.$getHowl()||t.$setHowl(new(e.getHowl())({src:t.config.src,loop:t.config.loop,volume:t.config.volume,autoplay:!1,preload:!0}))})),r.events.emit(Ef.EventTypes["event:preloaded.mount"]),function(){c.forEach((function(t){t.onload=null}))}}console.warn("Window is not supported in this environment")}),[e]),null}function Rf(t){var e=t.state,n=ct().game;return(0,$.useEffect)((function(){if(window){var t,r,o,i=(t=function(t){n.config.player.skipKey.includes(t.key)&&e.events.emit(G.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")}),[]),z().createElement(z().Fragment,null)}function Ff(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 Vf(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)?Vf(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 Vf(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 Df(t,e){return t.handle(e)}function Bf(t){var e=t.story,n=t.width,r=t.height,o=t.className,i=t.onReady,a=t.onEnd,s=Ff((0,$.useReducer)((function(t){return t+1}),0),2)[1],u=ct().game,c=Ff((0,$.useReducer)(Df,new G(u,{forceUpdate:function(){s()},next:y,dispatch:function(t){return f(t)}})),2),l=c[0],f=c[1],d=u.config.elements.say.use,p=u.config.elements.menu.use;function y(){for(var t=!1;!t;){var e=u.getLiveGame().next(l);if(!e)break;if(h.isAwaitable(e)){t=!0;break}f(e)}l.stage.forceUpdate()}(0,$.useEffect)((function(){e&&u.getLiveGame().loadStory(e)}),[e,u]),(0,$.useEffect)((function(){i&&i({game:u,state:l});var t=l.getLastScene(),e=[];t?e.push({type:"event:scene.mount",listener:t.events.once("event:scene.mount",(function(){l.stage.next()}))}):l.stage.next();var n=l.events.onEvents([{type:G.EventTypes["event:state.end"],listener:function(){a&&a({game:u,state:l})}}]),r=l.events.onEvents([{type:G.EventTypes["event:state.player.skip"],listener:function(){u.getLiveGame().abortAwaiting(),y()}}]);return l.stage.forceUpdate(),function(){t&&e.forEach((function(e){t.events.off(e.type,e.listener)})),n.cancel(),r.cancel()}}),[]);var v=n||u.config.player.width,m=r||u.config.player.height;return z().createElement(cl,null,z().createElement("div",{style:{width:"number"==typeof v?"".concat(v,"px"):v,height:"number"==typeof m?"".concat(m,"px"):m},className:H(o,"__narraleaf_content-player")},z().createElement(dl,{className:H("flex-grow overflow-auto")},z().createElement(et,{className:"relative"},l.state.srcManagers.map((function(t,e){return z().createElement(Nf,{key:e,state:l,srcManager:t})})),z().createElement(Gf,{onLoaded:function(){l.stage.forceUpdate(),e&&y()}},z().createElement(Rf,{state:l}),l.getSceneElements().map((function(t){var e=t.scene,n=t.ele;return z().createElement(El,{key:"scene-"+e.id,state:l,scene:e},n.images.map((function(t){return z().createElement(kf,{key:"image-"+t.getId(),image:t,state:l})})),n.texts.map((function(t){var e=t.action,n=t.onClick;return z().createElement(d,{state:l,key:"say-"+e.id,action:e,onClick:function(){n(),y()}})})),n.menus.map((function(t,e){return z().createElement("div",{key:"menu-"+e},z().createElement(p,{state:l,prompt:t.action.prompt,choices:t.action.choices,afterChoose:function(e){t.onClick(e),y()}}))})))})))))))}function Gf(t){var e=t.children,n=t.onLoaded,r=If().preloaded,o=Ff((0,$.useState)(!1),2),i=o[0],a=o[1];return(0,$.useEffect)((function(){var t=r.events.on(Ef.EventTypes["event:preloaded.ready"],(function(){a(!0),n()}));return function(){r.events.off(Ef.EventTypes["event:preloaded.ready"],t)}}),[i]),z().createElement(z().Fragment,null,i?e:null)}function Uf(t){var e=t.children,n=t.game;return z().createElement(z().Fragment,null,z().createElement(J,null,z().createElement(ut,{game:n},z().createElement(Cf,null,e))))}function Hf(t){return Hf="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},Hf(t)}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,zf(r.key),r)}}function zf(t){var e=function(t,e){if("object"!=Hf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Hf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Hf(e)?e:e+""}var Wf=function(){return function(t,e,n){return e&&$f(t.prototype,e),n&&$f(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.events=new m}),[{key:"start",value:function(t){throw new Error("Method not implemented.")}},{key:"toElementProps",value:function(){throw new Error("Method not implemented.")}},{key:"setSrc",value:function(t){throw new Error("Method not implemented.")}},{key:"requestAnimation",value:function(t,e,n){var r=this,o=t.start,i=t.end,a=t.duration,s=e.onComplete,u=e.onUpdate;return this.events.emit(pl.start,null),this.controller=wa(o,i,Object.assign({duration:a/1e3,onUpdate:function(t){u&&u(t),r.events.emit(pl.update,r.toElementProps())},onComplete:function(){r.events.emit(pl.end,null),s&&s(),r.controller=void 0}},n)),this.controller}},{key:"copy",value:function(){throw new Error("Method not implemented.")}}])}();function Yf(t){return Yf="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},Yf(t)}function qf(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,Xf(r.key),r)}}function Xf(t){var e=function(t,e){if("object"!=Yf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Yf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Yf(e)?e:e+""}function Kf(t,e,n){return e=Qf(e),function(t,e){if(e&&("object"==Yf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Zf()?Reflect.construct(e,n||[],Qf(t).constructor):e.apply(t,n))}function Zf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Zf=function(){return!!t})()}function Qf(t){return Qf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Qf(t)}function Jf(t,e){return Jf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Jf(t,e)}var td=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=Kf(this,e)).state={opacity:1},t.duration=n,r&&(t.src="string"==typeof r?r:r instanceof Yu?Ns.backgroundToSrc(r.config.background):Ns.staticImageDataToSrc(r)),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Jf(t,e)}(e,t),function(t,e,n){return e&&qf(t.prototype,e),n&&qf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){this.src=t}},{key:"start",value:function(t){var n=this;this.state.opacity=e.Frames[0],this.requestAnimation({start:e.Frames[0],end:e.Frames[1],duration:this.duration},{onComplete:t,onUpdate:function(t){n.state.opacity=t}})}},{key:"toElementProps",value:function(){return[{},{style:{opacity:this.state.opacity},src:this.src}]}},{key:"copy",value:function(){return new e(this.duration,this.src)}}])}(Wf);function ed(t){return ed="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},ed(t)}function nd(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,rd(r.key),r)}}function rd(t){var e=function(t,e){if("object"!=ed(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ed(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ed(e)?e:e+""}function od(t,e,n){return e=ad(e),function(t,e){if(e&&("object"==ed(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,id()?Reflect.construct(e,n||[],ad(t).constructor):e.apply(t,n))}function id(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(id=function(){return!!t})()}function ad(t){return ad=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ad(t)}function sd(t,e){return sd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},sd(t,e)}td.Frames=[0,1];var ud=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=od(this,e)).state={opacity:0,transform:""},r.duration=o,r.direction=t,r.offset=n,i&&(r.src="string"==typeof i?i:i instanceof Yu?Ns.backgroundToSrc(i.config.background):Ns.staticImageDataToSrc(i)),r.__stack=g(),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&sd(t,e)}(e,t),function(t,e,n){return e&&nd(t.prototype,e),n&&nd(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){this.src=t}},{key:"start",value:function(t){var e=this;if(!this.src)throw new Error("src is required, but not provided\nat:\n"+this.__stack);this.state.opacity=0,this.state.transform=this.getInitialTransform(),this.requestAnimation({start:0,end:1,duration:this.duration},{onComplete:t,onUpdate:function(t){e.state.opacity=t,e.state.transform=e.getTransform(t)}})}},{key:"toElementProps",value:function(){return[{},{style:{opacity:this.state.opacity,transform:this.state.transform},src:this.src}]}},{key:"copy",value:function(){return new e(this.direction,this.offset,this.duration,this.src)}},{key:"getInitialTransform",value:function(){switch(this.direction){case"left":return"translateX(-".concat(this.offset,"px)");case"right":return"translateX(".concat(this.offset,"px)");case"top":return"translateY(-".concat(this.offset,"px)");case"bottom":return"translateY(".concat(this.offset,"px)");default:return""}}},{key:"getTransform",value:function(t){switch(this.direction){case"left":return"translateX(".concat((1-t)*-this.offset,"px)");case"right":return"translateX(".concat((1-t)*this.offset,"px)");case"top":return"translateY(".concat((1-t)*-this.offset,"px)");case"bottom":return"translateY(".concat((1-t)*this.offset,"px)");default:return""}}}])}(Wf);function cd(t){return cd="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},cd(t)}function ld(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,fd(r.key),r)}}function fd(t){var e=function(t,e){if("object"!=cd(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=cd(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==cd(e)?e:e+""}function dd(t,e,n){return e=hd(e),function(t,e){if(e&&("object"==cd(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,pd()?Reflect.construct(e,n||[],hd(t).constructor):e.apply(t,n))}function pd(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(pd=function(){return!!t})()}function hd(t){return hd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},hd(t)}function yd(t,e){return yd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},yd(t,e)}var vd=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=dd(this,e)).state={opacity:0},t.duration=n,r&&(t.src="string"==typeof r?r:r instanceof Yu?Ns.backgroundToSrc(r.config.background):Ns.staticImageDataToSrc(r)),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&yd(t,e)}(e,t),function(t,e,n){return e&&ld(t.prototype,e),n&&ld(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){this.src=t}},{key:"start",value:function(t){var n=this;this.state.opacity=e.Frames[0],this.requestAnimation({start:e.Frames[0],end:e.Frames[1],duration:this.duration},{onComplete:t,onUpdate:function(t){n.state.opacity=t}})}},{key:"toElementProps",value:function(){return[{style:{opacity:this.state.opacity}},{style:{opacity:1-this.state.opacity},src:this.src}]}},{key:"copy",value:function(){return new e(this.duration,this.src)}}])}(Wf);vd.Frames=[1,0]})(),o})()));
31
+ */function c(t,e,n){var r,i={},c=null,l=null;for(r in void 0!==n&&(c=""+n),void 0!==e.key&&(c=""+e.key),void 0!==e.ref&&(l=e.ref),e)a.call(e,r)&&!u.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps)void 0===i[r]&&(i[r]=e[r]);return{$$typeof:o,type:t,key:c,ref:l,props:i,_owner:s.current}}e.jsx=c,e.jsxs=c},848:(t,e,n)=>{"use strict";t.exports=n(20)},72:t=>{"use strict";var e=[];function n(t){for(var n=-1,r=0;r<e.length;r++)if(e[r].identifier===t){n=r;break}return n}function r(t,r){for(var i={},a=[],s=0;s<t.length;s++){var u=t[s],c=r.base?u[0]+r.base:u[0],l=i[c]||0,f="".concat(c," ").concat(l);i[c]=l+1;var p=n(f),d={css:u[1],media:u[2],sourceMap:u[3],supports:u[4],layer:u[5]};if(-1!==p)e[p].references++,e[p].updater(d);else{var h=o(d,r);r.byIndex=s,e.splice(s,0,{identifier:f,updater:h,references:1})}a.push(f)}return a}function o(t,e){var n=e.domAPI(e);n.update(t);return function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,o){var i=r(t=t||[],o=o||{});return function(t){t=t||[];for(var a=0;a<i.length;a++){var s=n(i[a]);e[s].references--}for(var u=r(t,o),c=0;c<i.length;c++){var l=n(i[c]);0===e[l].references&&(e[l].updater(),e.splice(l,1))}i=u}}},659:t=>{"use strict";var e={};t.exports=function(t,n){var r=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},540:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},56:(t,e,n)=>{"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},825:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),e.styleTagTransform(r,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},113:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},12:e=>{"use strict";e.exports=t},33:t=>{"use strict";t.exports=e}},r={};function o(t){var e=r[t];if(void 0!==e)return e.exports;var i=r[t]={id:t,exports:{}};return n[t](i,i.exports,o),i.exports}o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.nc=void 0;var i={};return(()=>{"use strict";function t(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */t=function(){return n};var e,n={},r=Object.prototype,o=r.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(e){l=function(t,e,n){return t[e]=n}}function p(t,e,n,r){var o=e&&e.prototype instanceof b?e:b,a=Object.create(o.prototype),s=new I(r||[]);return i(a,"_invoke",{value:O(t,n,s)}),a}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}n.wrap=p;var h="suspendedStart",y="suspendedYield",v="executing",m="completed",g={};function b(){}function w(){}function _(){}var S={};l(S,s,(function(){return this}));var k=Object.getPrototypeOf,x=k&&k(k(L([])));x&&x!==r&&o.call(x,s)&&(S=x);var A=_.prototype=b.prototype=Object.create(S);function T(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(r,i,a,s){var u=d(t[r],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==f(l)&&o.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var r;i(this,"_invoke",{value:function(t,o){function i(){return new e((function(e,r){n(t,o,e,r)}))}return r=r?r.then(i,i):i()}})}function O(t,n,r){var o=h;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=P(s,r);if(u){if(u===g)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=v;var c=d(t,n,r);if("normal"===c.type){if(o=r.done?m:y,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=m,r.method="throw",r.arg=c.arg)}}}function P(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,P(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=d(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[s];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function n(){for(;++r<t.length;)if(o.call(t,r))return n.value=t[r],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(f(t)+" is not iterable")}return w.prototype=_,i(A,"constructor",{value:_,configurable:!0}),i(_,"constructor",{value:w,configurable:!0}),w.displayName=l(_,c,"GeneratorFunction"),n.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,l(t,c,"GeneratorFunction")),t.prototype=Object.create(A),t},n.awrap=function(t){return{__await:t}},T(E.prototype),l(E.prototype,u,(function(){return this})),n.AsyncIterator=E,n.async=function(t,e,r,o,i){void 0===i&&(i=Promise);var a=new E(p(t,e,r,o),i);return n.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},T(A),l(A,c,"Generator"),l(A,s,(function(){return this})),l(A,"toString",(function(){return"[object Generator]"})),n.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},n.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(C),!t)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(r,o){return s.type="throw",s.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),c=o.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;C(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},n}function e(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=c(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,s(r.key),r)}}function a(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t){var e=function(t,e){if("object"!=f(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==f(e)?e:e+""}function u(t){return function(t){if(Array.isArray(t))return l(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||c(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(t,e){if(t){if("string"==typeof t)return l(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(t,e):void 0}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}o.r(i),o.d(i,{Align:()=>wt,Base:()=>Vf,Character:()=>Ca,ColoredSentence:()=>Wu,CommonPosition:()=>gt,CommonPositionType:()=>st,Condition:()=>za,Control:()=>Ja,Coord2D:()=>bt,Dissolve:()=>up,Fade:()=>Wf,FadeIn:()=>tp,Game:()=>tc,GameProviders:()=>Mf,GameState:()=>wu,Image:()=>Si,Isolated:()=>Mu,Lambda:()=>Ua,LiveGame:()=>ec,Menu:()=>ss,Namespace:()=>pu,Player:()=>If,Say:()=>zu,Scene:()=>Gs,Script:()=>Ks,Sentence:()=>Oa,Sound:()=>Ts,SoundType:()=>ms,Storable:()=>du,Story:()=>ou,Transform:()=>hi,Utils:()=>va,Word:()=>ja,useGame:()=>Hu});var p=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};function d(t,e){var n=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r={},o=function(t,e,n){return"object"!==f(e)||null===e||Array.isArray(e)||"object"!==f(n)||null===n||Array.isArray(n)?Array.isArray(e)&&Array.isArray(n)?e.map((function(t,e){return"object"===f(t)&&null!==t&&!Array.isArray(t)&&n[e]?d(t,n[e]):t})):void 0===n?e:n:e.constructor!==Object||n.constructor!==Object?n||e:d(e,n)};for(var i in t)n(t,i)&&(r[i]=o(0,t[i],e[i]));for(var a in e)n(e,a)&&!n(r,a)&&("object"===f(e[a])&&null!==e[a]&&e[a].constructor===Object?r[a]=d({},e[a]):r[a]=e[a]);for(var s=arguments.length,c=new Array(s>2?s-2:0),l=2;l<s;l++)c[l-2]=arguments[l];if(c.length){var p=c[0],h=c.slice(1);return d.apply(void 0,[r,p].concat(u(h)))}return r}var h=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t},r=arguments.length>1?arguments[1]:void 0;n(this,t),this.solved=!1,this.listeners=[],this.receiver=e,this.skipController=r}return a(t,[{key:"registerSkipController",value:function(t){return this.skipController=t,this}},{key:"resolve",value:function(t){if(!this.solved){this.result=this.receiver(t),this.solved=!0,this.skipController&&this.skipController.cancel();var n,r=e(this.listeners);try{for(r.s();!(n=r.n()).done;){(0,n.value)(this.result)}}catch(t){r.e(t)}finally{r.f()}}}},{key:"then",value:function(t){this.result?t(this.result):this.listeners.push(t)}},{key:"abort",value:function(){return this.skipController?this.skipController.abort():this.result}}],[{key:"isAwaitable",value:function(e){return e instanceof t}}])}();function y(t){var n=new WeakSet;return function t(r){if(null===r||"object"!==f(r))return r;if(!n.has(r)){if(n.add(r),Array.isArray(r)){var o,i=[],a=e(r);try{for(a.s();!(o=a.n()).done;){var s=o.value;i.push(t(s))}}catch(t){a.e(t)}finally{a.f()}return i}var u={};for(var c in r)Object.prototype.hasOwnProperty.call(r,c)&&(u[c]=t(r[c]));return u}}(t)}function v(t){return"string"==typeof t?t:"#".concat((t.r||0).toString(16).padStart(2,"0")).concat((t.g||0).toString(16).padStart(2,"0")).concat((t.b||0).toString(16).padStart(2,"0")).concat(void 0===t.a?"":t.a.toString(16).padStart(2,"0"))}var m=function(){return a((function t(){n(this,t),this.events={}}),[{key:"on",value:function(t,e){return this.events[t]||(this.events[t]=[]),this.events[t].push(e),this.emit("event:EventDispatcher.register",t,e),e}},{key:"onEvents",value:function(t){var e=this,n=t.map((function(t){var n=t.type,r=t.listener;return{type:n,listener:r,cancel:function(){e.off(n,r)}}}));return{tokens:n,cancel:function(){n.forEach((function(t){return t.cancel()}))}}}},{key:"off",value:function(t,e){this.events[t]&&(this.events[t]=this.events[t].filter((function(t){return t!==e})))}},{key:"emit",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];this.events[t]&&this.events[t].forEach((function(t){t.apply(void 0,n)}))}},{key:"once",value:function(t,e){var n=this,r=function(){e.apply(void 0,arguments),n.off(t,r)};return this.on(t,r)}},{key:"any",value:function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return p(this,void 0,void 0,t().mark((function r(){var i,a,s,u,c,l=this;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.events[n]||(this.events[n]=[]),i=[],a=e(this.events[n]);try{for(a.s();!(s=a.n()).done;)u=s.value,(c=u.apply(void 0,o))&&"object"===f(c)&&"function"==typeof c.then&&i.push(c)}catch(t){a.e(t)}finally{a.f()}if(this.events[n]=this.events[n].filter((function(t){return!i.includes(t)})),0!==i.length){t.next=7;break}return t.abrupt("return",new Promise((function(t){var e=l.on("event:EventDispatcher.register",(function(r,i){if(r===n){l.off(r,e);var a=null==i?void 0:i.apply(void 0,o);a&&a.then?a.then(t):t(a)}}))})));case 7:return t.next=9,Promise.all(i);case 9:return t.abrupt("return",void 0);case 10:case"end":return t.stop()}}),r,this)})))}},{key:"clear",value:function(){this.events={}}}])}();function g(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(new Error).stack;return n?n.split("\n").slice(t+1,-e).join("\n").trim():""}function b(t){return new Promise((function(e){return setTimeout(e,t)}))}function w(t,e){if(t===e)return!0;if("object"!==f(t)||"object"!==f(e)||null===t||null===e)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(var o=0,i=n;o<i.length;o++){var a=i[o];if(!r.includes(a)||!w(t[a],e[a]))return!1}return!0}var _,S=function(){return a((function t(e,r){n(this,t),this.game=e,this.prefix=r}),[{key:"log",value:function(t){if(this.game.config.app.logger.log){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).log.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"info",value:function(t){if(this.game.config.app.logger.info){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).info.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"warn",value:function(t){if(this.game.config.app.logger.warn){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).warn.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"error",value:function(t){if(this.game.config.app.logger.error){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).error.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"debug",value:function(t){if(this.game.config.app.logger.debug){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).debug.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"trace",value:function(t){if(this.game.config.app.logger.trace){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];console.trace(this._log.apply(this,[t].concat(n)))}}},{key:"_log",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return 0===n.length?[this.prefix||"",t]:["".concat(this.prefix||""," [").concat(t,"]")].concat(n)}}])}(),k=function(){return a((function t(e){n(this,t),this.abortHandler=e,this.events=new m,this.aborted=!1}),[{key:"abort",value:function(){return this.aborted||(this.aborted=!0,this.result=this.abortHandler.apply(this,arguments)),this.result}},{key:"isAborted",value:function(){return this.aborted}},{key:"cancel",value:function(){this.aborted=!0}}])}();function x(t){return x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},x(t)}function A(t,e,n){return e=E(e),function(t,e){if(e&&("object"==x(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,T()?Reflect.construct(e,n||[],E(t).constructor):e.apply(t,n))}function T(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(T=function(){return!!t})()}function E(t){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},E(t)}function O(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&P(t,e)}function P(t,e){return P=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},P(t,e)}function j(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function C(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,L(r.key),r)}}function I(t,e,n){return e&&C(t.prototype,e),n&&C(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function L(t){var e=function(t,e){if("object"!=x(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=x(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==x(e)?e:e+""}k.EventTypes={"event:skipController.abort":"event:skipController.abort"},function(t){t.TreeNode="TreeNode",t.ContentNode="ContentNode"}(_||(_={}));var M=function(t){function e(t,n,r){var o;return j(this,e),(o=A(this,e,[_.ContentNode])).child=r||null,o.parent=n||null,o.action=t||null,o}return O(e,t),I(e,[{key:"setParent",value:function(t){if(t===this)throw new Error("Cannot set parent to itself");return this.parent=t,this}},{key:"setChild",value:function(t){if(t===this)throw new Error("Cannot set child to itself");return this.child=t,t&&t.parent!==this&&t.remove().setParent(this),this}},{key:"getChild",value:function(){return this.child||null}},{key:"getParent",value:function(){return this.parent||null}},{key:"setInitChild",value:function(t){return this.initChild=t,this.setChild(t)}},{key:"addChild",value:function(t){return this.setChild(t),this}},{key:"removeChild",value:function(t){return t&&this.child===t?(this.child=null,t.setParent(null)):t||(this.child=null),this}},{key:"remove",value:function(){var t;return null===(t=this.parent)||void 0===t||t.removeChild(this),this}},{key:"hasChild",value:function(){return!!this.child}}],[{key:"forEachParent",value:function(t,e){for(var n=new Set,r=t;r&&!n.has(r);)n.add(r),e(r),r=r.getParent()}},{key:"forEachChild",value:function(t,e){for(var n=new Set,r=t;r&&!n.has(r);)n.add(r),e(r),r=r.getChild()}}])}(function(){return I((function t(e){j(this,t),this.type=e,this.content=void 0}),[{key:"setContent",value:function(t){return this.content=t,this}},{key:"getContent",value:function(){return this.content}}])}());function N(t){return N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},N(t)}function R(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,F(r.key),r)}}function F(t){var e=function(t,e){if("object"!=N(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=N(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==N(e)?e:e+""}var V,D=function(){return function(t,e,n){return e&&R(t.prototype,e),n&&R(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.id=""}),[{key:"setId",value:function(t){this.id=t}},{key:"getId",value:function(){return this.id}},{key:"reset",value:function(){}}])}();function B(t){return B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},B(t)}function G(t){return function(t){if(Array.isArray(t))return H(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 H(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)?H(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 H(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 $(t,e,n){return e=z(e),function(t,e){if(e&&("object"==B(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,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)}function q(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Y(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,K(r.key),r)}}function X(t,e,n){return e&&Y(t.prototype,e),n&&Y(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function K(t){var e=function(t,e){if("object"!=B(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=B(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==B(e)?e:e+""}var Z=Symbol("_Chained"),Q=function(){function t(e){q(this,t),this[V]=!0,this.__actions=[],this.__self=e}return X(t,[{key:"push",value:function(){var t;(t=this.__actions).push.apply(t,arguments)}},{key:"getActions",value:function(){return this.__actions}},{key:"getSelf",value:function(){return this.__self}}],[{key:"isChained",value:function(t){return t&&t[Z]}},{key:"toActions",value:function(e){return e.flat(2).map((function(e){return t.isChained(e)?e.fromChained(e):e})).flat(3)}}])}();V=Z;var J=function(t){function e(){return q(this,e),$(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&W(t,e)}(e,t),X(e,[{key:"chain",value:function(t){var e=Q.isChained(this)?this:this.proxy(this,new Q(this));if(!t)return e;var n=Array.isArray(t)?t:[t];return e.push.apply(e,G(n)),e}},{key:"proxy",value:function(t,e){var n=new Proxy(t,{get:function(t,r){if(r in e)return e[r];var o=t[r];return"function"==typeof o?o.bind(n):o},set:function(t,e,n){return t[e]=n,!0}});return n}}])}(D);function tt(t){return tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tt(t)}function et(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,nt(r.key),r)}}function nt(t){var e=function(t,e){if("object"!=tt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=tt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==tt(e)?e:e+""}function rt(t,e,n){return e=it(e),function(t,e){if(e&&("object"==tt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ot()?Reflect.construct(e,n||[],it(t).constructor):e.apply(t,n))}function ot(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ot=function(){return!!t})()}function it(t){return it=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},it(t)}function at(t,e){return at=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},at(t,e)}var st,ut=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),rt(this,e)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&at(t,e)}(e,t),function(t,e,n){return e&&et(t.prototype,e),n&&et(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"toData",value:function(){return null}},{key:"fromData",value:function(t){return this}},{key:"fromChained",value:function(t){return t.getActions()}}])}(J),ct={center:"center",left:"left",right:"right"};function lt(t){return lt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lt(t)}function ft(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function pt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,yt(r.key),r)}}function dt(t,e,n){return e&&pt(t.prototype,e),n&&pt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function ht(t,e,n){return(e=yt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function yt(t){var e=function(t,e){if("object"!=lt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=lt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==lt(e)?e:e+""}!function(t){t.Left="left",t.Center="center",t.Right="right"}(st||(st={}));var vt=ht(ht(ht({},st.Left,"33.33%"),st.Center,"50%"),st.Right,"66.66%"),mt=function(){function t(){ft(this,t)}return dt(t,null,[{key:"isUnknown",value:function(e){return e===t.Unknown}},{key:"wrap",value:function(t){return Object.assign({left:"auto",top:"auto",right:"auto",bottom:"auto"},t)}},{key:"D2PositionToCSS",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.calc(t.y,t.yoffset),o=this.calc(t.x,t.xoffset),i=n?{bottom:r}:{top:r},a=e?{right:o}:{left:o};return this.wrap(Object.assign(Object.assign({},i),a))}},{key:"calc",value:function(e,n){if(!e||t.isUnknown(e))return"auto";if(void 0===n||t.isUnknown(n))return"".concat(e);var r="number"==typeof e?"".concat(e,"px"):e;return"calc(".concat(r," + ").concat(n,"px)")}},{key:"toCoord2D",value:function(t){if(gt.isCommonPositionType(t))return bt.fromCommonPosition(t);if(bt.isCoord2DPosition(t))return t;if(wt.isAlignPosition(t))return bt.fromAlignPosition(t);if("object"===lt(t)&&["x","y","xoffset","yoffset"].some((function(e){return e in t})))return new bt(t);throw new Error("Invalid position type")}},{key:"mergePosition",value:function(t,e){var n=this.toCoord2D(t),r=this.toCoord2D(e);return bt.merge(n,r)}},{key:"serializePosition",value:function(e){var n=this.toCoord2D(e);return{x:t.isUnknown(n.x)?0:n.x,y:t.isUnknown(n.y)?0:n.y,xoffset:t.isUnknown(n.xoffset)?0:n.xoffset,yoffset:t.isUnknown(n.yoffset)?0:n.yoffset}}},{key:"isRawCommonPositionType",value:function(t){return Object.values(st).includes(t)}},{key:"isRawCoord2DPosition",value:function(t){return"object"===lt(t)&&("x"in t||"y"in t||"xoffset"in t||"yoffset"in t)}},{key:"isRawAlignPosition",value:function(t){return"object"===lt(t)&&("xalign"in t||"yalign"in t||"xoffset"in t||"yoffset"in t)}},{key:"isRawPosition",value:function(t){return this.isRawCommonPositionType(t)||this.isRawCoord2DPosition(t)||this.isRawAlignPosition(t)}},{key:"isPosition",value:function(t){return t instanceof gt||t instanceof bt||t instanceof wt}},{key:"rawPositionToCoord2D",value:function(t){if(this.isRawCommonPositionType(t))return bt.fromCommonPosition(new gt(t));if(this.isRawCoord2DPosition(t))return new bt(t);if(this.isRawAlignPosition(t))return bt.fromAlignPosition(t);throw new Error("Invalid position type")}},{key:"tryParsePosition",value:function(t){if(this.isPosition(t))return t;if(this.isRawPosition(t))return this.rawPositionToCoord2D(t);throw new Error("Invalid position type")}}])}();mt.Unknown=Symbol("Unknown");var gt=function(){function t(e){ft(this,t),this.position=e}return dt(t,[{key:"toCSS",value:function(){return{x:vt[this.position],y:"50%",xoffset:0,yoffset:0}}}],[{key:"isCommonPositionType",value:function(e){return e instanceof t}}])}();gt.Positions=st;var bt=function(){function t(e,n){ft(this,t),"object"===lt(e)?(this.x=e.x||mt.Unknown,this.y=e.y||mt.Unknown,this.xoffset=e.xoffset||mt.Unknown,this.yoffset=e.yoffset||mt.Unknown):(this.x=e||mt.Unknown,this.y=n||mt.Unknown,this.xoffset=mt.Unknown,this.yoffset=mt.Unknown)}return dt(t,[{key:"toCSS",value:function(){return{x:this.x,y:this.y,xoffset:this.xoffset,yoffset:this.yoffset}}}],[{key:"isCoord2DPosition",value:function(e){return e instanceof t}},{key:"fromCommonPosition",value:function(e){return new t({x:vt[e.position],y:"50%"})}},{key:"fromAlignPosition",value:function(e){return new t({x:mt.isUnknown(e.xalign)?mt.Unknown:"".concat(100*e.xalign,"%"),y:mt.isUnknown(e.yalign)?mt.Unknown:"".concat(100*e.yalign,"%"),xoffset:e.xoffset,yoffset:e.yoffset})}},{key:"merge",value:function(e,n){return new t({x:mt.isUnknown(n.x)?e.x:n.x,y:mt.isUnknown(n.y)?e.y:n.y,xoffset:mt.isUnknown(n.xoffset)?e.xoffset:n.xoffset,yoffset:mt.isUnknown(n.yoffset)?e.yoffset:n.yoffset})}}])}(),wt=function(){function t(e,n){ft(this,t),"object"===lt(e)?(this.xalign=e.xalign||mt.Unknown,this.yalign=e.yalign||mt.Unknown,this.xoffset=e.xoffset||mt.Unknown,this.yoffset=e.yoffset||mt.Unknown):(this.xalign=e||mt.Unknown,this.yalign=n||mt.Unknown,this.xoffset=mt.Unknown,this.yoffset=mt.Unknown)}return dt(t,[{key:"toCSS",value:function(){return{x:mt.isUnknown(this.xalign)?this.xalign:"".concat(100*this.xalign,"%"),y:mt.isUnknown(this.yalign)?this.yalign:"".concat(100*this.yalign,"%"),xoffset:this.xoffset,yoffset:this.yoffset}}}],[{key:"isAlignPosition",value:function(e){return e instanceof t}}])}();const _t=t=>t;let St=_t,kt=_t;function xt(t,e,n){var r;if("string"==typeof t){let o=document;e&&(kt(Boolean(e.current),"Scope provided, but no element detected."),o=e.current),n?(null!==(r=n[t])&&void 0!==r||(n[t]=o.querySelectorAll(t)),t=n[t]):t=o.querySelectorAll(t)}else t instanceof Element&&(t=[t]);return Array.from(t||[])}const At=new WeakMap,Tt=!1,Et=!1;const Ot=["read","resolveKeyframes","update","preRender","render","postRender"];function Pt(t,e){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=Ot.reduce(((t,e)=>(t[e]=function(t){let e=new Set,n=new Set,r=!1,o=!1;const i=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function s(e){i.has(e)&&(u.schedule(e),t()),e(a)}const u={schedule:(t,o=!1,a=!1)=>{const s=a&&r?e:n;return o&&i.add(t),s.has(t)||s.add(t),t},cancel:t=>{n.delete(t),i.delete(t)},process:t=>{a=t,r?o=!0:(r=!0,[e,n]=[n,e],n.clear(),e.forEach(s),r=!1,o&&(o=!1,u.process(t)))}};return u}(i),t)),{}),{read:s,resolveKeyframes:u,update:c,preRender:l,render:f,postRender:p}=a,d=()=>{const i=Et?o.timestamp:performance.now();n=!1,o.delta=r?1e3/60:Math.max(Math.min(i-o.timestamp,40),1),o.timestamp=i,o.isProcessing=!0,s.process(o),u.process(o),c.process(o),l.process(o),f.process(o),p.process(o),o.isProcessing=!1,n&&e&&(r=!1,t(d))};return{schedule:Ot.reduce(((e,i)=>{const s=a[i];return e[i]=(e,i=!1,a=!1)=>(n||(n=!0,r=!0,o.isProcessing||t(d)),s.schedule(e,i,a)),e}),{}),cancel:t=>{for(let e=0;e<Ot.length;e++)a[Ot[e]].cancel(t)},state:o,steps:a}}const{schedule:jt,cancel:Ct,state:It,steps:Lt}=Pt("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:_t,!0);function Mt(t){let e;return()=>(void 0===e&&(e=t()),e)}const Nt=Mt((()=>void 0!==window.ScrollTimeline));class Rt{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}then(t,e){return Promise.all(this.animations).then(t).catch(e)}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t){const e=this.animations.map((e=>{if(!Nt()||!e.attachTimeline)return e.pause(),function(t,e){let n;const r=()=>{const{currentTime:r}=e,o=(null===r?0:r.value)/100;n!==o&&t(o),n=o};return jt.update(r,!0),()=>Ct(r)}((t=>{e.time=e.duration*t}),t);e.attachTimeline(t)}));return()=>{e.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;e<this.animations.length;e++)t=Math.max(t,this.animations[e].duration);return t}runAll(t){this.animations.forEach((e=>e[t]()))}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const Ft=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Vt=new Set(Ft),Dt=t=>1e3*t,Bt=t=>t/1e3,Gt={type:"spring",stiffness:500,damping:25,restSpeed:10},Ht={type:"keyframes",duration:.8},$t={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Ut=(t,{keyframes:e})=>e.length>2?Ht:Vt.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:Gt:$t;function zt(t,e){return t[e]||t.default||t}const Wt=!1,qt=t=>null!==t;function Yt(t,{repeat:e,repeatType:n="loop"},r){const o=t.filter(qt),i=e&&"loop"!==n&&e%2==1?0:o.length-1;return i&&void 0!==r?r:o[i]}const Xt=t=>/^0[^.\s]+$/u.test(t);const Kt=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),Zt=t=>e=>"string"==typeof e&&e.startsWith(t),Qt=Zt("--"),Jt=Zt("var(--"),te=t=>!!Jt(t)&&ee.test(t.split("/*")[0].trim()),ee=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,ne=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function re(t,e,n=1){kt(n<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[r,o]=function(t){const e=ne.exec(t);if(!e)return[,];const[,n,r,o]=e;return[`--${null!=n?n:r}`,o]}(t);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const t=i.trim();return Kt(t)?parseFloat(t):t}return te(o)?re(o,e,n+1):o}const oe=(t,e,n)=>n>e?e:n<t?t:n,ie={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},ae={...ie,transform:t=>oe(0,1,t)},se={...ie,default:1},ue=t=>Math.round(1e5*t)/1e5,ce=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,le=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,fe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;function pe(t){return"string"==typeof t}const de=t=>({test:e=>pe(e)&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),he=de("deg"),ye=de("%"),ve=de("px"),me=de("vh"),ge=de("vw"),be={...ye,parse:t=>ye.parse(t)/100,transform:t=>ye.transform(100*t)},we=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),_e=t=>t===ie||t===ve,Se=(t,e)=>parseFloat(t.split(", ")[e]),ke=(t,e)=>(n,{transform:r})=>{if("none"===r||!r)return 0;const o=r.match(/^matrix3d\((.+)\)$/u);if(o)return Se(o[1],e);{const e=r.match(/^matrix\((.+)\)$/u);return e?Se(e[1],t):0}},xe=new Set(["x","y","z"]),Ae=Ft.filter((t=>!xe.has(t)));const Te={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:ke(4,13),y:ke(5,14)};Te.translateX=Te.x,Te.translateY=Te.y;const Ee=t=>e=>e.test(t),Oe=[ie,ve,ye,he,ge,me,{test:t=>"auto"===t,parse:t=>t}],Pe=t=>Oe.find(Ee(t)),je=new Set;let Ce=!1,Ie=!1;function Le(){if(Ie){const t=Array.from(je).filter((t=>t.needsMeasurement)),e=new Set(t.map((t=>t.element))),n=new Map;e.forEach((t=>{const e=function(t){const e=[];return Ae.forEach((n=>{const r=t.getValue(n);void 0!==r&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))})),e}(t);e.length&&(n.set(t,e),t.render())})),t.forEach((t=>t.measureInitialState())),e.forEach((t=>{t.render();const e=n.get(t);e&&e.forEach((([e,n])=>{var r;null===(r=t.getValue(e))||void 0===r||r.set(n)}))})),t.forEach((t=>t.measureEndState())),t.forEach((t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)}))}Ie=!1,Ce=!1,je.forEach((t=>t.complete())),je.clear()}function Me(){je.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(Ie=!0)}))}class Ne{constructor(t,e,n,r,o,i=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=r,this.element=o,this.isAsync=i}scheduleResolve(){this.isScheduled=!0,this.isAsync?(je.add(this),Ce||(Ce=!0,jt.read(Me),jt.resolveKeyframes(Le))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:r}=this;for(let o=0;o<t.length;o++)if(null===t[o])if(0===o){const o=null==r?void 0:r.get(),i=t[t.length-1];if(void 0!==o)t[0]=o;else if(n&&e){const r=n.readValue(e,i);null!=r&&(t[0]=r)}void 0===t[0]&&(t[0]=i),r&&void 0===o&&r.set(t[0])}else t[o]=t[o-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),je.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,je.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const Re=(t,e)=>n=>Boolean(pe(n)&&fe.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),Fe=(t,e,n)=>r=>{if(!pe(r))return r;const[o,i,a,s]=r.match(ce);return{[t]:parseFloat(o),[e]:parseFloat(i),[n]:parseFloat(a),alpha:void 0!==s?parseFloat(s):1}},Ve={...ie,transform:t=>Math.round((t=>oe(0,255,t))(t))},De={test:Re("rgb","red"),parse:Fe("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+Ve.transform(t)+", "+Ve.transform(e)+", "+Ve.transform(n)+", "+ue(ae.transform(r))+")"};const Be={test:Re("#"),parse:function(t){let e="",n="",r="",o="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),o=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),o=t.substring(4,5),e+=e,n+=n,r+=r,o+=o),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}},transform:De.transform},Ge={test:Re("hsl","hue"),parse:Fe("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+ye.transform(ue(e))+", "+ye.transform(ue(n))+", "+ue(ae.transform(r))+")"},He={test:t=>De.test(t)||Be.test(t)||Ge.test(t),parse:t=>De.test(t)?De.parse(t):Ge.test(t)?Ge.parse(t):Be.parse(t),transform:t=>pe(t)?t:t.hasOwnProperty("red")?De.transform(t):Ge.transform(t)};const $e="number",Ue="color",ze="var",We="var(",qe="${}",Ye=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Xe(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},o=[];let i=0;const a=e.replace(Ye,(t=>(He.test(t)?(r.color.push(i),o.push(Ue),n.push(He.parse(t))):t.startsWith(We)?(r.var.push(i),o.push(ze),n.push(t)):(r.number.push(i),o.push($e),n.push(parseFloat(t))),++i,qe))).split(qe);return{values:n,split:a,indexes:r,types:o}}function Ke(t){return Xe(t).values}function Ze(t){const{split:e,types:n}=Xe(t),r=e.length;return t=>{let o="";for(let i=0;i<r;i++)if(o+=e[i],void 0!==t[i]){const e=n[i];o+=e===$e?ue(t[i]):e===Ue?He.transform(t[i]):t[i]}return o}}const Qe=t=>"number"==typeof t?0:t;const Je={test:function(t){var e,n;return isNaN(t)&&pe(t)&&((null===(e=t.match(ce))||void 0===e?void 0:e.length)||0)+((null===(n=t.match(le))||void 0===n?void 0:n.length)||0)>0},parse:Ke,createTransformer:Ze,getAnimatableNone:function(t){const e=Ke(t);return Ze(t)(e.map(Qe))}},tn=new Set(["brightness","contrast","saturate","opacity"]);function en(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[r]=n.match(ce)||[];if(!r)return t;const o=n.replace(r,"");let i=tn.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+o+")"}const nn=/\b([a-z-]*)\(.*?\)/gu,rn={...Je,getAnimatableNone:t=>{const e=t.match(nn);return e?e.map(en).join(" "):t}},on={...ie,transform:Math.round},an={borderWidth:ve,borderTopWidth:ve,borderRightWidth:ve,borderBottomWidth:ve,borderLeftWidth:ve,borderRadius:ve,radius:ve,borderTopLeftRadius:ve,borderTopRightRadius:ve,borderBottomRightRadius:ve,borderBottomLeftRadius:ve,width:ve,maxWidth:ve,height:ve,maxHeight:ve,size:ve,top:ve,right:ve,bottom:ve,left:ve,padding:ve,paddingTop:ve,paddingRight:ve,paddingBottom:ve,paddingLeft:ve,margin:ve,marginTop:ve,marginRight:ve,marginBottom:ve,marginLeft:ve,rotate:he,rotateX:he,rotateY:he,rotateZ:he,scale:se,scaleX:se,scaleY:se,scaleZ:se,skew:he,skewX:he,skewY:he,distance:ve,translateX:ve,translateY:ve,translateZ:ve,x:ve,y:ve,z:ve,perspective:ve,transformPerspective:ve,opacity:ae,originX:be,originY:be,originZ:ve,zIndex:on,backgroundPositionX:ve,backgroundPositionY:ve,fillOpacity:ae,strokeOpacity:ae,numOctaves:on},sn={...an,color:He,backgroundColor:He,outlineColor:He,fill:He,stroke:He,borderColor:He,borderTopColor:He,borderRightColor:He,borderBottomColor:He,borderLeftColor:He,filter:rn,WebkitFilter:rn},un=t=>sn[t];function cn(t,e){let n=un(t);return n!==rn&&(n=Je),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const ln=new Set(["auto","none","0"]);class fn extends Ne{constructor(t,e,n,r,o){super(t,e,n,r,o,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:n}=this;if(!e||!e.current)return;super.readKeyframes();for(let n=0;n<t.length;n++){let r=t[n];if("string"==typeof r&&(r=r.trim(),te(r))){const o=re(r,e.current);void 0!==o&&(t[n]=o),n===t.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!we.has(n)||2!==t.length)return;const[r,o]=t,i=Pe(r),a=Pe(o);if(i!==a)if(_e(i)&&_e(a))for(let e=0;e<t.length;e++){const n=t[e];"string"==typeof n&&(t[e]=parseFloat(n))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,n=[];for(let e=0;e<t.length;e++)("number"==typeof(r=t[e])?0===r:null===r||"none"===r||"0"===r||Xt(r))&&n.push(e);var r;n.length&&function(t,e,n){let r,o=0;for(;o<t.length&&!r;){const e=t[o];"string"==typeof e&&!ln.has(e)&&Xe(e).values.length&&(r=t[o]),o++}if(r&&n)for(const o of e)t[o]=cn(n,r)}(t,n,e)}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:n}=this;if(!t||!t.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Te[n](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const r=e[e.length-1];void 0!==r&&t.getValue(n,r).jump(r,!1)}measureEndState(){var t;const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const o=e.getValue(n);o&&o.jump(this.measuredOrigin,!1);const i=r.length-1,a=r[i];r[i]=Te[n](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==a&&void 0===this.finalKeyframe&&(this.finalKeyframe=a),(null===(t=this.removedTransforms)||void 0===t?void 0:t.length)&&this.removedTransforms.forEach((([t,n])=>{e.getValue(t).set(n)})),this.resolveNoneKeyframes()}}let pn;function dn(){pn=void 0}const hn={now:()=>(void 0===pn&&hn.set(It.isProcessing||Et?It.timestamp:performance.now()),pn),set:t=>{pn=t,queueMicrotask(dn)}},yn=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!Je.test(t)&&"0"!==t||t.startsWith("url(")));class vn{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:r=0,repeatDelay:o=0,repeatType:i="loop",...a}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=hn.now(),this.options={autoplay:t,delay:e,type:n,repeat:r,repeatDelay:o,repeatType:i,...a},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt}get resolved(){return this._resolved||this.hasAttemptedResolve||(Me(),Le()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=hn.now(),this.hasAttemptedResolve=!0;const{name:n,type:r,velocity:o,delay:i,onComplete:a,onUpdate:s,isGenerator:u}=this.options;if(!u&&!function(t,e,n,r){const o=t[0];if(null===o)return!1;if("display"===e||"visibility"===e)return!0;const i=t[t.length-1],a=yn(o,e),s=yn(i,e);return St(a===s,`You are trying to animate ${e} from "${o}" to "${i}". ${o} is not an animatable value - to enable this animation set ${o} to a value animatable to ${i} via the \`style\` property.`),!(!a||!s)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}(t)||"spring"===n&&r)}(t,n,r,o)){if(Wt||!i)return null==s||s(Yt(t,this.options,e)),null==a||a(),void this.resolveFinishedPromise();this.options.duration=0}const c=this.initPlayback(t,e);!1!==c&&(this._resolved={keyframes:t,finalKeyframe:e,...c},this.onPostResolved())}onPostResolved(){}then(t,e){return this.currentFinishedPromise.then(t,e)}updateFinishedPromise(){this.currentFinishedPromise=new Promise((t=>{this.resolveFinishedPromise=t}))}}function mn(t,e){return e?t*(1e3/e):0}const gn=5;function bn(t,e,n){const r=Math.max(e-gn,0);return mn(n-t(r),e-r)}const wn=.001,_n=.01,Sn=10,kn=.05,xn=1;function An({duration:t=800,bounce:e=.25,velocity:n=0,mass:r=1}){let o,i;St(t<=Dt(Sn),"Spring duration must be 10 seconds or less");let a=1-e;a=oe(kn,xn,a),t=oe(_n,Sn,Bt(t)),a<1?(o=e=>{const r=e*a,o=r*t,i=r-n,s=En(e,a),u=Math.exp(-o);return wn-i/s*u},i=e=>{const r=e*a*t,i=r*n+n,s=Math.pow(a,2)*Math.pow(e,2)*t,u=Math.exp(-r),c=En(Math.pow(e,2),a);return(-o(e)+wn>0?-1:1)*((i-s)*u)/c}):(o=e=>Math.exp(-e*t)*((e-n)*t+1)-wn,i=e=>Math.exp(-e*t)*(t*t*(n-e)));const s=function(t,e,n){let r=n;for(let n=1;n<Tn;n++)r-=t(r)/e(r);return r}(o,i,5/t);if(t=Dt(t),isNaN(s))return{stiffness:100,damping:10,duration:t};{const e=Math.pow(s,2)*r;return{stiffness:e,damping:2*a*Math.sqrt(r*e),duration:t}}}const Tn=12;function En(t,e){return t*Math.sqrt(1-e*e)}const On=["duration","bounce"],Pn=["stiffness","damping","mass"];function jn(t,e){return e.some((e=>void 0!==t[e]))}function Cn({keyframes:t,restDelta:e,restSpeed:n,...r}){const o=t[0],i=t[t.length-1],a={done:!1,value:o},{stiffness:s,damping:u,mass:c,duration:l,velocity:f,isResolvedFromDuration:p}=function(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!jn(t,Pn)&&jn(t,On)){const n=An(t);e={...e,...n,mass:1},e.isResolvedFromDuration=!0}return e}({...r,velocity:-Bt(r.velocity||0)}),d=f||0,h=u/(2*Math.sqrt(s*c)),y=i-o,v=Bt(Math.sqrt(s/c)),m=Math.abs(y)<5;let g;if(n||(n=m?.01:2),e||(e=m?.005:.5),h<1){const t=En(v,h);g=e=>{const n=Math.exp(-h*v*e);return i-n*((d+h*v*y)/t*Math.sin(t*e)+y*Math.cos(t*e))}}else if(1===h)g=t=>i-Math.exp(-v*t)*(y+(d+v*y)*t);else{const t=v*Math.sqrt(h*h-1);g=e=>{const n=Math.exp(-h*v*e),r=Math.min(t*e,300);return i-n*((d+h*v*y)*Math.sinh(r)+t*y*Math.cosh(r))/t}}return{calculatedDuration:p&&l||null,next:t=>{const r=g(t);if(p)a.done=t>=l;else{let o=0;h<1&&(o=0===t?Dt(d):bn(g,t,r));const s=Math.abs(o)<=n,u=Math.abs(i-r)<=e;a.done=s&&u}return a.value=a.done?i:r,a}}}function In({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:i=500,modifyTarget:a,min:s,max:u,restDelta:c=.5,restSpeed:l}){const f=t[0],p={done:!1,value:f},d=t=>void 0===s?u:void 0===u||Math.abs(s-t)<Math.abs(u-t)?s:u;let h=n*e;const y=f+h,v=void 0===a?y:a(y);v!==y&&(h=v-f);const m=t=>-h*Math.exp(-t/r),g=t=>v+m(t),b=t=>{const e=m(t),n=g(t);p.done=Math.abs(e)<=c,p.value=p.done?v:n};let w,_;const S=t=>{var e;(e=p.value,void 0!==s&&e<s||void 0!==u&&e>u)&&(w=t,_=Cn({keyframes:[p.value,d(p.value)],velocity:bn(g,t,p.value),damping:o,stiffness:i,restDelta:c,restSpeed:l}))};return S(0),{calculatedDuration:null,next:t=>{let e=!1;return _||void 0!==w||(e=!0,b(t),S(t)),void 0!==w&&t>=w?_.next(t-w):(!e&&b(t),p)}}}const Ln=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Mn=1e-7,Nn=12;function Rn(t,e,n,r){if(t===e&&n===r)return _t;const o=e=>function(t,e,n,r,o){let i,a,s=0;do{a=e+(n-e)/2,i=Ln(a,r,o)-t,i>0?n=a:e=a}while(Math.abs(i)>Mn&&++s<Nn);return a}(e,0,1,t,n);return t=>0===t||1===t?t:Ln(o(t),e,r)}const Fn=Rn(.42,0,1,1),Vn=Rn(0,0,.58,1),Dn=Rn(.42,0,.58,1),Bn=t=>Array.isArray(t)&&"number"!=typeof t[0],Gn=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Hn=t=>e=>1-t(1-e),$n=t=>1-Math.sin(Math.acos(t)),Un=Hn($n),zn=Gn($n),Wn=Rn(.33,1.53,.69,.99),qn=Hn(Wn),Yn={linear:_t,easeIn:Fn,easeInOut:Dn,easeOut:Vn,circIn:$n,circInOut:zn,circOut:Un,backIn:qn,backInOut:Gn(qn),backOut:Wn,anticipate:t=>(t*=2)<1?.5*qn(t):.5*(2-Math.pow(2,-10*(t-1)))},Xn=t=>{if(Array.isArray(t)){kt(4===t.length,"Cubic bezier arrays must contain four numerical values.");const[e,n,r,o]=t;return Rn(e,n,r,o)}return"string"==typeof t?(kt(void 0!==Yn[t],`Invalid easing type '${t}'`),Yn[t]):t},Kn=(t,e)=>n=>e(t(n)),Zn=(...t)=>t.reduce(Kn),Qn=(t,e,n)=>{const r=e-t;return 0===r?1:(n-t)/r},Jn=(t,e,n)=>t+(e-t)*n;function tr(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function er(t,e){return n=>n>0?e:t}const nr=(t,e,n)=>{const r=t*t,o=n*(e*e-r)+r;return o<0?0:Math.sqrt(o)},rr=[Be,De,Ge];function or(t){const e=(n=t,rr.find((t=>t.test(n))));var n;if(St(Boolean(e),`'${t}' is not an animatable color. Use the equivalent color code instead.`),!Boolean(e))return!1;let r=e.parse(t);return e===Ge&&(r=function({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,n/=100;let o=0,i=0,a=0;if(e/=100){const r=n<.5?n*(1+e):n+e-n*e,s=2*n-r;o=tr(s,r,t+1/3),i=tr(s,r,t),a=tr(s,r,t-1/3)}else o=i=a=n;return{red:Math.round(255*o),green:Math.round(255*i),blue:Math.round(255*a),alpha:r}}(r)),r}const ir=(t,e)=>{const n=or(t),r=or(e);if(!n||!r)return er(t,e);const o={...n};return t=>(o.red=nr(n.red,r.red,t),o.green=nr(n.green,r.green,t),o.blue=nr(n.blue,r.blue,t),o.alpha=Jn(n.alpha,r.alpha,t),De.transform(o))},ar=new Set(["none","hidden"]);function sr(t,e){return n=>Jn(t,e,n)}function ur(t){return"number"==typeof t?sr:"string"==typeof t?te(t)?er:He.test(t)?ir:fr:Array.isArray(t)?cr:"object"==typeof t?He.test(t)?ir:lr:er}function cr(t,e){const n=[...t],r=n.length,o=t.map(((t,n)=>ur(t)(t,e[n])));return t=>{for(let e=0;e<r;e++)n[e]=o[e](t);return n}}function lr(t,e){const n={...t,...e},r={};for(const o in n)void 0!==t[o]&&void 0!==e[o]&&(r[o]=ur(t[o])(t[o],e[o]));return t=>{for(const e in r)n[e]=r[e](t);return n}}const fr=(t,e)=>{const n=Je.createTransformer(e),r=Xe(t),o=Xe(e);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?ar.has(t)&&!o.values.length||ar.has(e)&&!r.values.length?function(t,e){return ar.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):Zn(cr(function(t,e){var n;const r=[],o={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const a=e.types[i],s=t.indexes[a][o[a]],u=null!==(n=t.values[s])&&void 0!==n?n:0;r[i]=u,o[a]++}return r}(r,o),o.values),n):(St(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),er(t,e))};function pr(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return Jn(t,e,n);return ur(t)(t,e)}function dr(t,e,{clamp:n=!0,ease:r,mixer:o}={}){const i=t.length;if(kt(i===e.length,"Both input and output ranges must be the same length"),1===i)return()=>e[0];if(2===i&&t[0]===t[1])return()=>e[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const a=function(t,e,n){const r=[],o=n||pr,i=t.length-1;for(let n=0;n<i;n++){let i=o(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]||_t:e;i=Zn(t,i)}r.push(i)}return r}(e,r,o),s=a.length,u=e=>{let n=0;if(s>1)for(;n<t.length-2&&!(e<t[n+1]);n++);const r=Qn(t[n],t[n+1],e);return a[n](r)};return n?e=>u(oe(t[0],t[i-1],e)):u}function hr(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const o=Qn(0,e,r);t.push(Jn(n,1,o))}}function yr(t){const e=[0];return hr(e,t.length-1),e}function vr({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const o=Bn(r)?r.map(Xn):Xn(r),i={done:!1,value:e[0]},a=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:yr(e),t),s=dr(a,e,{ease:Array.isArray(o)?o:(u=e,c=o,u.map((()=>c||Dn)).splice(0,u.length-1))});var u,c;return{calculatedDuration:t,next:e=>(i.value=s(e),i.done=e>=t,i)}}const mr=2e4;function gr(t){let e=0;let n=t.next(e);for(;!n.done&&e<mr;)e+=50,n=t.next(e);return e>=mr?1/0:e}const br=t=>{const e=({timestamp:e})=>t(e);return{start:()=>jt.update(e,!0),stop:()=>Ct(e),now:()=>It.isProcessing?It.timestamp:hn.now()}},wr={decay:In,inertia:In,tween:vr,keyframes:vr,spring:Cn},_r=t=>t/100;class Sr extends vn{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.teardown();const{onStop:t}=this.options;t&&t()};const{name:e,motionValue:n,element:r,keyframes:o}=this.options,i=(null==r?void 0:r.KeyframeResolver)||Ne;this.resolver=new i(o,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}initPlayback(t){const{type:e="keyframes",repeat:n=0,repeatDelay:r=0,repeatType:o,velocity:i=0}=this.options,a=wr[e]||vr;let s,u;a!==vr&&"number"!=typeof t[0]&&(s=Zn(_r,pr(t[0],t[1])),t=[0,100]);const c=a({...this.options,keyframes:t});"mirror"===o&&(u=a({...this.options,keyframes:[...t].reverse(),velocity:-i})),null===c.calculatedDuration&&(c.calculatedDuration=gr(c));const{calculatedDuration:l}=c,f=l+r;return{generator:c,mirroredGenerator:u,mapPercentToKeyframes:s,calculatedDuration:l,resolvedDuration:f,totalDuration:f*(n+1)-r}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),"paused"!==this.pendingPlayState&&t?this.state=this.pendingPlayState:this.pause()}tick(t,e=!1){const{resolved:n}=this;if(!n){const{keyframes:t}=this.options;return{done:!0,value:t[t.length-1]}}const{finalKeyframe:r,generator:o,mirroredGenerator:i,mapPercentToKeyframes:a,keyframes:s,calculatedDuration:u,totalDuration:c,resolvedDuration:l}=n;if(null===this.startTime)return o.next(0);const{delay:f,repeat:p,repeatType:d,repeatDelay:h,onUpdate:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-c/this.speed,this.startTime)),e?this.currentTime=t:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const v=this.currentTime-f*(this.speed>=0?1:-1),m=this.speed>=0?v<0:v>c;this.currentTime=Math.max(v,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=c);let g=this.currentTime,b=o;if(p){const t=Math.min(this.currentTime,c)/l;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,p+1);Boolean(e%2)&&("reverse"===d?(n=1-n,h&&(n-=h/l)):"mirror"===d&&(b=i)),g=oe(0,1,n)*l}const w=m?{done:!1,value:s[0]}:b.next(g);a&&(w.value=a(w.value));let{done:_}=w;m||null===u||(_=this.speed>=0?this.currentTime>=c:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&_);return S&&void 0!==r&&(w.value=Yt(s,this.options,r)),y&&y(w.value),S&&this.finish(),w}get duration(){const{resolved:t}=this;return t?Bt(t.calculatedDuration):0}get time(){return Bt(this.currentTime)}set time(t){t=Dt(t),this.currentTime=t,null!==this.holdTime||0===this.speed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=Bt(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=br,onPlay:e,startTime:n}=this.options;this.driver||(this.driver=t((t=>this.tick(t)))),e&&e();const r=this.driver.now();null!==this.holdTime?this.startTime=r-this.holdTime:this.startTime?"finished"===this.state&&(this.startTime=r):this.startTime=null!=n?n:this.calcStartTime(),"finished"===this.state&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;this._resolved?(this.state="paused",this.holdTime=null!==(t=this.currentTime)&&void 0!==t?t:0):this.pendingPlayState="paused"}complete(){"running"!==this.state&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){null!==this.cancelTime&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const kr=new Set(["opacity","clipPath","filter","transform"]),xr=t=>Array.isArray(t)&&"number"==typeof t[0];function Ar(t){return Boolean(!t||"string"==typeof t&&t in Er||xr(t)||Array.isArray(t)&&t.every(Ar))}const Tr=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,Er={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Tr([0,.65,.55,1]),circOut:Tr([.55,0,1,.45]),backIn:Tr([.31,.01,.66,-.59]),backOut:Tr([.33,1.53,.69,.99])};function Or(t){return Pr(t)||Er.easeOut}function Pr(t){return t?xr(t)?Tr(t):Array.isArray(t)?t.map(Or):Er[t]:void 0}const jr=Mt((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));class Cr extends vn{constructor(t){super(t);const{name:e,motionValue:n,element:r,keyframes:o}=this.options;this.resolver=new fn(o,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}initPlayback(t,e){var n;let{duration:r=300,times:o,ease:i,type:a,motionValue:s,name:u,startTime:c}=this.options;if(!(null===(n=s.owner)||void 0===n?void 0:n.current))return!1;if(function(t){return"spring"===t.type||!Ar(t.ease)}(this.options)){const{onComplete:e,onUpdate:n,motionValue:s,element:u,...c}=this.options,l=function(t,e){const n=new Sr({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const o=[];let i=0;for(;!r.done&&i<2e4;)r=n.sample(i),o.push(r.value),i+=10;return{times:void 0,keyframes:o,duration:i-10,ease:"linear"}}(t,c);1===(t=l.keyframes).length&&(t[1]=t[0]),r=l.duration,o=l.times,i=l.ease,a="keyframes"}const l=function(t,e,n,{delay:r=0,duration:o=300,repeat:i=0,repeatType:a="loop",ease:s,times:u}={}){const c={[e]:n};u&&(c.offset=u);const l=Pr(s);return Array.isArray(l)&&(c.easing=l),t.animate(c,{delay:r,duration:o,easing:Array.isArray(l)?"linear":l,fill:"both",iterations:i+1,direction:"reverse"===a?"alternate":"normal"})}(s.owner.current,u,t,{...this.options,duration:r,times:o,ease:i});return l.startTime=null!=c?c:this.calcStartTime(),this.pendingTimeline?(l.timeline=this.pendingTimeline,this.pendingTimeline=void 0):l.onfinish=()=>{const{onComplete:n}=this.options;s.set(Yt(t,this.options,e)),n&&n(),this.cancel(),this.resolveFinishedPromise()},{animation:l,duration:r,times:o,type:a,ease:i,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:e}=t;return Bt(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return Bt(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.currentTime=Dt(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:e}=t;return e.playbackRate}set speed(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:e}=t;return e.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:e}=t;return e.startTime}attachTimeline(t){if(this._resolved){const{resolved:e}=this;if(!e)return _t;const{animation:n}=e;n.timeline=t,n.onfinish=null}else this.pendingTimeline=t;return _t}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:e}=t;"finished"===e.playState&&this.updateFinishedPromise(),e.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:e}=t;e.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:e,keyframes:n,duration:r,type:o,ease:i,times:a}=t;if("idle"===e.playState||"finished"===e.playState)return;if(this.time){const{motionValue:t,onUpdate:e,onComplete:s,element:u,...c}=this.options,l=new Sr({...c,keyframes:n,duration:r,type:o,ease:i,times:a,isGenerator:!0}),f=Dt(this.time);t.setWithVelocity(l.sample(f-10).value,l.sample(f).value,10)}const{onStop:s}=this.options;s&&s(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:e,name:n,repeatDelay:r,repeatType:o,damping:i,type:a}=t;return jr()&&n&&kr.has(n)&&e&&e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate&&!r&&"mirror"!==o&&0!==i&&"inertia"!==a}}const Ir=(t,e,n,r={},o,i,a)=>s=>{const u=zt(r,t)||{},c=u.delay||r.delay||0;let{elapsed:l=0}=r;l-=Dt(c);let f={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...u,delay:-l,onUpdate:t=>{e.set(t),u.onUpdate&&u.onUpdate(t)},onComplete:()=>{s(),u.onComplete&&u.onComplete(),a&&a()},onStop:a,name:t,motionValue:e,element:i?void 0:o};(function({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:o,repeat:i,repeatType:a,repeatDelay:s,from:u,elapsed:c,...l}){return!!Object.keys(l).length})(u)||(f={...f,...Ut(t,f)}),f.duration&&(f.duration=Dt(f.duration)),f.repeatDelay&&(f.repeatDelay=Dt(f.repeatDelay)),void 0!==f.from&&(f.keyframes[0]=f.from);let p=!1;if((!1===f.type||0===f.duration&&!f.repeatDelay)&&(f.duration=0,0===f.delay&&(p=!0)),(Wt||Tt)&&(p=!0,f.duration=0,f.delay=0),p&&!i&&void 0!==e.get()){const t=Yt(f.keyframes,u);if(void 0!==t)return jt.update((()=>{f.onUpdate(t),f.onComplete()})),new Rt([])}return!i&&Cr.supports(f)?new Cr(f):new Sr(f)},Lr=t=>Array.isArray(t),Mr=t=>Boolean(t&&"object"==typeof t&&t.mix&&t.toValue),Nr=t=>Lr(t)?t[t.length-1]||0:t;function Rr(t,e){-1===t.indexOf(e)&&t.push(e)}function Fr(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class Vr{constructor(){this.subscriptions=[]}add(t){return Rr(this.subscriptions,t),()=>Fr(this.subscriptions,t)}notify(t,e,n){const r=this.subscriptions.length;if(r)if(1===r)this.subscriptions[0](t,e,n);else for(let o=0;o<r;o++){const r=this.subscriptions[o];r&&r(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Dr={current:void 0};class Br{constructor(t,e={}){this.version="11.5.4",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=hn.now();this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),e&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=hn.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new Vr);const n=this.events[t].add(e);return"change"===t?()=>{n(),jt.read((()=>{this.events.change.getSize()||this.stop()}))}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}setWithVelocity(t,e,n){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return Dr.current&&Dr.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=hn.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return mn(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise((e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()})).then((()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()}))}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Gr(t,e){return new Br(t,e)}function Hr(t){const e=[{},{}];return null==t||t.values.forEach(((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()})),e}function $r(t,e,n,r){if("function"==typeof e){const[o,i]=Hr(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]=Hr(r);e=e(void 0!==n?n:t.custom,o,i)}return e}function Ur(t,e,n){const r=t.getProps();return $r(r,e,void 0!==n?n:r.custom,t)}function zr(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Gr(n))}const Wr=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),qr="data-"+Wr("framerAppearId");function Yr(t){return t.props[qr]}function Xr(t){return Vt.has(t)?"transform":kr.has(t)?Wr(t):void 0}class Kr extends Br{constructor(){super(...arguments),this.output=[],this.counts=new Map}add(t){const e=Xr(t);if(!e)return;const n=this.counts.get(e)||0;this.counts.set(e,n+1),0===n&&(this.output.push(e),this.update());let r=!1;return()=>{if(r)return;r=!0;const t=this.counts.get(e)-1;this.counts.set(e,t),0===t&&(Fr(this.output,e),this.update())}}update(){this.set(this.output.length?this.output.join(", "):"auto")}}const Zr=t=>Boolean(t&&t.getVelocity);function Qr(t,e){var n;if(!t.applyWillChange)return;let r=t.getValue("willChange");return r||(null===(n=t.props.style)||void 0===n?void 0:n.willChange)||(r=new Kr("auto"),t.addValue("willChange",r)),o=r,Boolean(Zr(o)&&o.add)?r.add(e):void 0;var o}function Jr({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,r}function to(t,e,{delay:n=0,transitionOverride:r,type:o}={}){var i;let{transition:a=t.getDefaultTransition(),transitionEnd:s,...u}=e;r&&(a=r);const c=[],l=o&&t.animationState&&t.animationState.getState()[o];for(const e in u){const r=t.getValue(e,null!==(i=t.latestValues[e])&&void 0!==i?i:null),o=u[e];if(void 0===o||l&&Jr(l,e))continue;const s={delay:n,...zt(a||{},e)};let f=!1;if(window.MotionHandoffAnimation){const n=Yr(t);if(n){const t=window.MotionHandoffAnimation(n,e,jt);null!==t&&(s.startTime=t,f=!0)}}r.start(Ir(e,r,o,t.shouldReduceMotion&&Vt.has(e)?{type:!1}:s,t,f,Qr(t,e)));const p=r.animation;p&&c.push(p)}return s&&Promise.all(c).then((()=>{jt.update((()=>{s&&function(t,e){const n=Ur(t,e);let{transitionEnd:r={},transition:o={},...i}=n||{};i={...i,...r};for(const e in i)zr(t,e,Nr(i[e]))}(t,s)}))})),c}const eo={};function no(t,{layout:e,layoutId:n}){return Vt.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!eo[t]||"opacity"===t)}function ro(t,e,n){var r;const{style:o}=t,i={};for(const a in o)(Zr(o[a])||e.style&&Zr(e.style[a])||no(a,t)||void 0!==(null===(r=null==n?void 0:n.getValue(a))||void 0===r?void 0:r.liveStyle))&&(i[a]=o[a]);return n&&o&&"string"==typeof o.willChange&&(n.applyWillChange=!1),i}function oo(t,e,n){const r=ro(t,e,n);for(const n in t)if(Zr(t[n])||Zr(e[n])){r[-1!==Ft.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=t[n]}return r}const io="undefined"!=typeof window,ao={current:null},so={current:!1};function uo(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function co(t){return"string"==typeof t||Array.isArray(t)}const lo=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],fo=["initial",...lo];function po(t){return uo(t.animate)||fo.some((e=>co(t[e])))}function ho(t){return Boolean(po(t)||t.variants)}const yo={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},vo={};for(const t in yo)vo[t]={isEnabled:e=>yo[t].some((t=>!!e[t]))};const mo=[...Oe,He,Je],go=()=>({x:{min:0,max:0},y:{min:0,max:0}}),bo=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],wo=fo.length;class _o{scrapeMotionValuesFromProps(t,e,n){return{}}constructor({parent:t,props:e,presenceContext:n,reducedMotionConfig:r,blockInitialAnimation:o,visualState:i},a={}){this.applyWillChange=!1,this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Ne,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.isRenderScheduled=!1,this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.isRenderScheduled=!1,this.scheduleRender=()=>{this.isRenderScheduled||(this.isRenderScheduled=!0,jt.render(this.render,!1,!0))};const{latestValues:s,renderState:u}=i;this.latestValues=s,this.baseTarget={...s},this.initialValues=e.initial?{...s}:{},this.renderState=u,this.parent=t,this.props=e,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=r,this.options=a,this.blockInitialAnimation=Boolean(o),this.isControllingVariants=po(e),this.isVariantNode=ho(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:c,...l}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in l){const e=l[t];void 0!==s[t]&&Zr(e)&&e.set(s[t],!1)}}mount(t){this.current=t,At.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach(((t,e)=>this.bindToMotionValue(e,t))),so.current||function(){if(so.current=!0,io)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>ao.current=t.matches;t.addListener(e),e()}else ao.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||ao.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){At.delete(this.current),this.projection&&this.projection.unmount(),Ct(this.notifyUpdate),Ct(this.render),this.valueSubscriptions.forEach((t=>t())),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}bindToMotionValue(t,e){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const n=Vt.has(t),r=e.on("change",(e=>{this.latestValues[t]=e,this.props.onUpdate&&jt.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)})),o=e.on("renderRequest",this.scheduleRender);let i;window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,(()=>{r(),o(),i&&i(),e.owner&&e.stop()}))}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in vo){const e=vo[t];if(!e)continue;const{isEnabled:n,Feature:r}=e;if(!this.features[t]&&r&&n(this.props)&&(this.features[t]=new r(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<bo.length;e++){const n=bo[e];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);const r=t["on"+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=function(t,e,n){for(const r in e){const o=e[r],i=n[r];if(Zr(o))t.addValue(r,o);else if(Zr(i))t.addValue(r,Gr(o,{owner:t}));else if(i!==o)if(t.hasValue(r)){const e=t.getValue(r);!0===e.liveStyle?e.jump(o):e.hasAnimated||e.set(o)}else{const e=t.getStaticValue(r);t.addValue(r,Gr(void 0!==e?e:o,{owner:t}))}}for(const r in n)void 0===e[r]&&t.removeValue(r);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}getVariantContext(t=!1){if(t)return this.parent?this.parent.getVariantContext():void 0;if(!this.isControllingVariants){const t=this.parent&&this.parent.getVariantContext()||{};return void 0!==this.props.initial&&(t.initial=this.props.initial),t}const e={};for(let t=0;t<wo;t++){const n=fo[t],r=this.props[n];(co(r)||!1===r)&&(e[n]=r)}return e}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){const n=this.values.get(t);e!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return void 0===n&&void 0!==e&&(n=Gr(null===e?void 0:e,{owner:this}),this.addValue(t,n)),n}readValue(t,e){var n;let r=void 0===this.latestValues[t]&&this.current?null!==(n=this.getBaseTargetFromProps(this.props,t))&&void 0!==n?n:this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];var o;return null!=r&&("string"==typeof r&&(Kt(r)||Xt(r))?r=parseFloat(r):(o=r,!mo.find(Ee(o))&&Je.test(e)&&(r=cn(t,e))),this.setBaseTarget(t,Zr(r)?r.get():r)),Zr(r)?r.get():r}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){var e;const{initial:n}=this.props;let r;if("string"==typeof n||"object"==typeof n){const o=$r(this.props,n,null===(e=this.presenceContext)||void 0===e?void 0:e.custom);o&&(r=o[t])}if(n&&void 0!==r)return r;const o=this.getBaseTargetFromProps(this.props,t);return void 0===o||Zr(o)?void 0!==this.initialValues[t]&&void 0===r?void 0:this.baseTarget[t]:o}on(t,e){return this.events[t]||(this.events[t]=new Vr),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class So extends _o{constructor(){super(...arguments),this.KeyframeResolver=fn}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){return t.style?t.style[e]:void 0}removeValueFromRenderState(t,{vars:e,style:n}){delete e[t],delete n[t]}}const ko=(t,e)=>e&&"number"==typeof t?e.transform(t):t,xo={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Ao=Ft.length;function To(t,e,n){const{style:r,vars:o,transformOrigin:i}=t;let a=!1,s=!1;for(const t in e){const n=e[t];if(Vt.has(t))a=!0;else if(Qt(t))o[t]=n;else{const e=ko(n,an[t]);t.startsWith("origin")?(s=!0,i[t]=e):r[t]=e}}if(e.transform||(a||n?r.transform=function(t,e,n){let r="",o=!0;for(let i=0;i<Ao;i++){const a=Ft[i],s=t[a];if(void 0===s)continue;let u=!0;if(u="number"==typeof s?s===(a.startsWith("scale")?1:0):0===parseFloat(s),!u||n){const t=ko(s,an[a]);u||(o=!1,r+=`${xo[a]||a}(${t}) `),n&&(e[a]=t)}}return r=r.trim(),n?r=n(e,o?"":r):o&&(r="none"),r}(e,t.transform,n):r.transform&&(r.transform="none")),s){const{originX:t="50%",originY:e="50%",originZ:n=0}=i;r.transformOrigin=`${t} ${e} ${n}`}}function Eo(t,e,n){return"string"==typeof t?t:ve.transform(e+n*t)}const Oo={offset:"stroke-dashoffset",array:"stroke-dasharray"},Po={offset:"strokeDashoffset",array:"strokeDasharray"};function jo(t,{attrX:e,attrY:n,attrScale:r,originX:o,originY:i,pathLength:a,pathSpacing:s=1,pathOffset:u=0,...c},l,f){if(To(t,c,f),l)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:p,style:d,dimensions:h}=t;p.transform&&(h&&(d.transform=p.transform),delete p.transform),h&&(void 0!==o||void 0!==i||d.transform)&&(d.transformOrigin=function(t,e,n){return`${Eo(e,t.x,t.width)} ${Eo(n,t.y,t.height)}`}(h,void 0!==o?o:.5,void 0!==i?i:.5)),void 0!==e&&(p.x=e),void 0!==n&&(p.y=n),void 0!==r&&(p.scale=r),void 0!==a&&function(t,e,n=1,r=0,o=!0){t.pathLength=1;const i=o?Oo:Po;t[i.offset]=ve.transform(-r);const a=ve.transform(e),s=ve.transform(n);t[i.array]=`${a} ${s}`}(p,a,s,u,!1)}const Co=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Io(t,{style:e,vars:n},r,o){Object.assign(t.style,e,o&&o.getProjectionStyles(r));for(const e in n)t.style.setProperty(e,n[e])}function Lo(t,e,n,r){Io(t,e,void 0,r);for(const n in e.attrs)t.setAttribute(Co.has(n)?n:Wr(n),e.attrs[n])}const Mo=t=>"string"==typeof t&&"svg"===t.toLowerCase();class No extends So{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=go}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(Vt.has(e)){const t=un(e);return t&&t.default||0}return e=Co.has(e)?e:Wr(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return oo(t,e,n)}build(t,e,n){jo(t,e,this.isSVGTag,n.transformTemplate)}renderInstance(t,e,n,r){Lo(t,e,0,r)}mount(t){this.isSVGTag=Mo(t.tagName),super.mount(t)}}function Ro(t,e){return function({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}(t.getBoundingClientRect(),e))}class Fo extends So{constructor(){super(...arguments),this.type="html",this.applyWillChange=!0,this.renderInstance=Io}readValueFromInstance(t,e){if(Vt.has(e)){const t=un(e);return t&&t.default||0}{const r=(n=t,window.getComputedStyle(n)),o=(Qt(e)?r.getPropertyValue(e):r[e])||0;return"string"==typeof o?o.trim():o}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return Ro(t,e)}build(t,e,n){To(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return ro(t,e,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Zr(t)&&(this.childSubscription=t.on("change",(t=>{this.current&&(this.current.textContent=`${t}`)})))}}function Vo(t){const e={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=function(t){return t instanceof SVGElement&&"svg"!==t.tagName}(t)?new No(e):new Fo(e);n.mount(t),At.set(t,n)}function Do(t,e,n){const r=Zr(t)?t:Gr(t);return r.start(Ir("",r,e,n)),r.animation}function Bo(t,e=100){const n=Cn({keyframes:[0,e],...t}),r=Math.min(gr(n),mr);return{type:"keyframes",ease:t=>n.next(r*t).value/e,duration:Bt(r)}}function Go(t,e,n,r){var o;return"number"==typeof e?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(o=r.get(e))&&void 0!==o?o:t}const Ho=(t,e,n)=>{const r=e-t;return((n-t)%r+r)%r+t};function $o(t,e){return Bn(t)?t[Ho(0,t.length,e)]:t}function Uo(t,e,n,r,o,i){!function(t,e,n){for(let r=0;r<t.length;r++){const o=t[r];o.at>e&&o.at<n&&(Fr(t,o),r--)}}(t,o,i);for(let a=0;a<e.length;a++)t.push({value:e[a],at:Jn(o,i,r[a]),easing:$o(n,a)})}function zo(t,e){return t.at===e.at?null===t.value?1:null===e.value?-1:0:t.at-e.at}const Wo="easeInOut";function qo(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function Yo(t,e){return e[t]||(e[t]=[]),e[t]}function Xo(t){return Array.isArray(t)?t:[t]}function Ko(t,e){return t[e]?{...t,...t[e]}:{...t}}const Zo=t=>"number"==typeof t,Qo=t=>t.every(Zo);function Jo(t,e,n,r){const o=xt(t,r),i=o.length;kt(Boolean(i),"No valid element provided.");const a=[];for(let t=0;t<i;t++){const r=o[t];At.has(r)||Vo(r);const s=At.get(r),u={...n};"function"==typeof u.delay&&(u.delay=u.delay(t,i)),a.push(...to(s,{...e,transition:u},{}))}return new Rt(a)}function ti(t,e,n){const r=[],o=function(t,{defaultTransition:e={},...n}={},r){const o=e.duration||.3,i=new Map,a=new Map,s={},u=new Map;let c=0,l=0,f=0;for(let n=0;n<t.length;n++){const i=t[n];if("string"==typeof i){u.set(i,l);continue}if(!Array.isArray(i)){u.set(i.name,Go(l,i.at,c,u));continue}let[p,d,h={}]=i;void 0!==h.at&&(l=Go(l,h.at,c,u));let y=0;const v=(t,n,r,i=0,a=0)=>{const s=Xo(t),{delay:u=0,times:c=yr(s),type:p="keyframes",...d}=n;let{ease:h=e.ease||"easeOut",duration:v}=n;const m="function"==typeof u?u(i,a):u,g=s.length;if(g<=2&&"spring"===p){let t=100;if(2===g&&Qo(s)){const e=s[1]-s[0];t=Math.abs(e)}const e={...d};void 0!==v&&(e.duration=Dt(v));const n=Bo(e,t);h=n.ease,v=n.duration}null!=v||(v=o);const b=l+m,w=b+v;1===c.length&&0===c[0]&&(c[1]=1);const _=c.length-s.length;_>0&&hr(c,_),1===s.length&&s.unshift(null),Uo(r,s,h,c,b,w),y=Math.max(m+v,y),f=Math.max(w,f)};if(Zr(p))v(d,h,Yo("default",qo(p,a)));else{const t=xt(p,r,s),e=t.length;for(let n=0;n<e;n++){const r=qo(t[n],a);for(const t in d)v(d[t],Ko(h,t),Yo(t,r),n,e)}}c=l,l+=y}return a.forEach(((t,r)=>{for(const o in t){const a=t[o];a.sort(zo);const s=[],u=[],c=[];for(let t=0;t<a.length;t++){const{at:e,value:n,easing:r}=a[t];s.push(n),u.push(Qn(0,f,e)),c.push(r||"easeOut")}0!==u[0]&&(u.unshift(0),s.unshift(s[0]),c.unshift(Wo)),1!==u[u.length-1]&&(u.push(1),s.push(null)),i.has(r)||i.set(r,{keyframes:{},transition:{}});const l=i.get(r);l.keyframes[o]=s,l.transition[o]={...e,duration:f,ease:c,times:u,...n}}})),i}(t,e,n);return o.forEach((({keyframes:t,transition:e},n)=>{let o;o=Zr(n)?Do(n,t.default,e.default):Jo(n,t,e),r.push(o)})),new Rt(r)}const ei=function(t,e,n){let r;var o;return o=t,r=Array.isArray(o)&&Array.isArray(o[0])?ti(t,e,ni):function(t){return"object"==typeof t&&!Array.isArray(t)}(e)?Jo(t,e,n,ni):Do(t,e,n),ni&&ni.animations.push(r),r};var ni;function ri(t){return ri="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ri(t)}function oi(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */oi=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",d="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==ri(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function T(e,n,r){var o=p;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:d,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(ri(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function ii(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=si(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function ai(t){return function(t){if(Array.isArray(t))return ui(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||si(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function si(t,e){if(t){if("string"==typeof t)return ui(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ui(t,e):void 0}}function ui(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ci(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,fi(r.key),r)}}function li(t,e,n){return(e=fi(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function fi(t){var e=function(t,e){if("object"!=ri(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ri(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ri(e)?e:e+""}var pi=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},di=li(li(li({},ct.left,"25.33%"),ct.center,"50%"),ct.right,"75.66%"),hi=function(){function t(e,n){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.sequences=[],this.control=null,this.transformers={},Array.isArray(e)){var r;(r=this.sequences).push.apply(r,ai(e)),this.sequenceOptions=Object.assign({},t.defaultSequenceOptions,n||{})}else{var o=e,i=n||t.defaultOptions;this.sequences.push({props:o,options:i||{}}),this.sequenceOptions=Object.assign({},t.defaultSequenceOptions)}}return function(t,e,n){return e&&ci(t.prototype,e),n&&ci(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"animate",value:function(e,n,r,o){var i=e.scope,a=e.overwrites;return pi(this,void 0,void 0,oi().mark((function e(){var s,u=this;return oi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=d(r,{}),e.abrupt("return",new Promise((function(e){pi(u,void 0,void 0,oi().mark((function r(){var u,c,l,f,p=this;return oi().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:this.sequenceOptions.sync||(e(),o&&o(s)),u=0;case 2:if(!(u<this.sequenceOptions.repeat)){r.next=22;break}c=ii(this.sequences),r.prev=4,f=oi().mark((function e(){var r,o,u,c,f,h;return oi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=l.value,o=r.props,u=r.options,c=d({},p.propToCSS(n,s)),i.current){e.next=4;break}throw new Error("No scope found when animating.");case 4:if(f=i.current,Object.assign(f.style,c),s=t.mergeState(s,o),h=ei(f,p.propToCSS(n,s,a),p.optionsToFramerMotionOptions(u)||{}),p.setControl(h),!1!==(null==u?void 0:u.sync)){e.next=13;break}h.then((function(){Object.assign(f.style,p.propToCSS(n,s,a)),p.setControl(null)})),e.next=17;break;case 13:return e.next=15,new Promise((function(t){return h.then((function(){return t()}))}));case 15:Object.assign(f.style,p.propToCSS(n,s,a)),p.setControl(null);case 17:case"end":return e.stop()}}),e)})),c.s();case 7:if((l=c.n()).done){r.next=11;break}return r.delegateYield(f(),"t0",9);case 9:r.next=7;break;case 11:r.next=16;break;case 13:r.prev=13,r.t1=r.catch(4),c.e(r.t1);case 16:return r.prev=16,c.f(),r.finish(16);case 19:u++,r.next=2;break;case 22:return r.next=24,b(2);case 24:this.setControl(null),this.sequenceOptions.sync&&(e(),o&&o(s));case 26:case"end":return r.stop()}}),r,this,[[4,13,16,19]])})))})));case 2:case"end":return e.stop()}}),e)})))}},{key:"repeat",value:function(t){return this.sequenceOptions.repeat*=t,this}},{key:"overwrite",value:function(t,e){return this.transformers[t]=e,this}},{key:"propToCSS",value:function(e,n,r){var o,i=(null===(o=e.getLastScene())||void 0===o?void 0:o.config)||{},a=i.invertY,s=i.invertX,u={position:function(e){return t.positionToCSS(e,a,s)},backgroundColor:function(e){return t.backgroundToCSS(e)},backgroundOpacity:function(t){return{opacity:t}},opacity:function(t){return{opacity:t}},scale:function(){return"scale"in n?{width:"".concat(100*n.scale,"%")}:{}},rotation:function(){return{}},display:function(){return{}},src:function(){return{}}},c={};for(var l in c.transform=this.propToCSSTransform(e,n),this.transformers.transform&&Object.assign(c,this.transformers.transform(n)),r&&r.transform&&Object.assign(c,r.transform(n)),n)Object.prototype.hasOwnProperty.call(n,l)&&(r&&r[l]?Object.assign(c,r[l](n[l])):this.transformers[l]?Object.assign(c,this.transformers[l](n[l])):u[l]&&Object.assign(c,u[l](n[l])));return c}},{key:"optionsToFramerMotionOptions",value:function(t){if(!t)return t;var e=t.duration;return{duration:e?e/1e3:0,ease:t.ease}}},{key:"propToCSSTransform",value:function(t,e){var n;if(!t.getLastScene())throw new Error('No scene found in state, make sure you called "scene.activate()" before this method.');var r=(null===(n=t.getLastScene())||void 0===n?void 0:n.config)||{},o=r.invertY,i=r.invertX;return["translate(".concat(i?"":"-","50%, ").concat(o?"":"-","50%)"),void 0!==e.rotation&&"rotate(".concat(e.rotation,"deg)")].filter(Boolean).join(" ")}},{key:"setControl",value:function(t){return this.control=t,this}},{key:"getControl",value:function(){return this.control}},{key:"copy",value:function(){return new t(this.sequences,this.sequenceOptions)}}],[{key:"isPosition",value:function(t){return gt.isCommonPositionType(t)||bt.isCoord2DPosition(t)||wt.isAlignPosition(t)}},{key:"positionToCSS",value:function(t,e,n){return mt.D2PositionToCSS(t.toCSS(),n,e)}},{key:"backgroundToCSS",value:function(t){return null==t?{}:va.isStaticImageData(t)?{backgroundImage:"url(".concat(t.src,")")}:"string"==typeof t?{backgroundColor:t}:["r","g","b"].every((function(e){return e in t}))?{backgroundColor:v(t)}:{backgroundImage:"url("+t.url+")"}}},{key:"mergePosition",value:function(t,e){if(!t&&!e)throw new Error("No position found.");return t&&e?mt.mergePosition(mt.tryParsePosition(t),mt.tryParsePosition(e)):mt.toCoord2D(mt.tryParsePosition(t||e))}},{key:"mergeState",value:function(t,e){var n=this.mergePosition(t.position,e.position);return Object.assign(Object.assign({},d(t,e)),{position:n})}}])}();function yi(t){return yi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yi(t)}function vi(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,mi(r.key),r)}}function mi(t){var e=function(t,e){if("object"!=yi(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=yi(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==yi(e)?e:e+""}function gi(t,e,n){return e=wi(e),function(t,e){if(e&&("object"==yi(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,bi()?Reflect.construct(e,n||[],wi(t).constructor):e.apply(t,n))}function bi(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(bi=function(){return!!t})()}function wi(t){return wi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wi(t)}function _i(t,e){return _i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_i(t,e)}hi.defaultSequenceOptions={sync:!0,repeat:1},hi.defaultOptions={duration:0,ease:"linear"},hi.CommonImagePositionMap=di;var Si=function(t){function e(t,n){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(r=gi(this,e)).events=new m,r.ref=void 0,"string"==typeof t?(r.name=t,r.config=d(e.defaultConfig,n||{}),r.config.position&&(r.config.position=mt.tryParsePosition(r.config.position))):(r.name="",r.config=d(e.defaultConfig,t),r.config.position&&(r.config.position=mt.tryParsePosition(r.config.position))),r.state=d({},r.config),r.checkConfig(),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_i(t,e)}(e,t),function(t,e,n){return e&&vi(t.prototype,e),n&&vi(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"dispose",value:function(){return this._dispose()}},{key:"init",value:function(){return this.chain(this._init())}},{key:"checkConfig",value:function(){if(!this.config.src)throw new Error("Image src is required");if(!hi.isPosition(this.config.position))throw new Error("Invalid position\nPosition must be one of CommonImagePosition, Align, Coord2D");return this}},{key:"setSrc",value:function(t,e){var n=this.chain();if(e){var r=e.copy();r.setSrc(va.srcToString(t)),n._transitionSrc(r)}var o=new Ji(this.chain(),Ji.ActionTypes.setSrc,(new M).setContent(["string"==typeof t?t:va.staticImageDataToSrc(t)]));return n.chain(o)}},{key:"applyTransform",value:function(t){var e=new Ji(this.chain(),Ji.ActionTypes.applyTransform,(new M).setContent([void 0,t,g()]));return this.chain(e)}},{key:"show",value:function(t){var e=t instanceof hi?t:new hi([{props:{opacity:1},options:t||{}}]),n=new Ji(this.chain(),Ji.ActionTypes.show,(new M).setContent([void 0,e]));return this.chain(n)}},{key:"hide",value:function(t){var e=new Ji(this.chain(),Ji.ActionTypes.hide,(new M).setContent([void 0,t instanceof hi?t:new hi([{props:{opacity:0},options:t||{}}])]));return this.chain(e)}},{key:"toTransform",value:function(){return new hi(this.state,{duration:0})}},{key:"setScope",value:function(t){return this.ref=t,this}},{key:"getScope",value:function(){return this.ref}},{key:"copy",value:function(){return new e(this.name,this.config)}},{key:"toData",value:function(){return this.state.disposed||w(this.state,this.config)?null:{state:d({},e.serializeImageState(this.state))}}},{key:"fromData",value:function(t){return this.state=d(this.state,e.deserializeImageState(t.state)),this}},{key:"_$setDispose",value:function(){return this.state.disposed=!0,this}},{key:"_setTransition",value:function(t){return this.chain(new Ji(this.chain(),Ji.ActionTypes.setTransition,(new M).setContent([t])))}},{key:"_applyTransition",value:function(t){return this.chain(new Ji(this.chain(),"image:applyTransition",(new M).setContent([t])))}},{key:"_init",value:function(t){return new Ji(this.chain(),Ji.ActionTypes.init,(new M).setContent([t]))}},{key:"reset",value:function(){this.state=d({},this.config)}},{key:"_transitionSrc",value:function(t){var e=t.copy();return this._setTransition(e)._applyTransition(e),this}},{key:"_dispose",value:function(){return this.chain(new Ji(this.chain(),Ji.ActionTypes.dispose,new M))}}],[{key:"serializeImageState",value:function(t){var e={position:function(t){return mt.serializePosition(t)}},n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=e[r]?e[r](t[r]):t[r]);return n}},{key:"deserializeImageState",value:function(t){var e={position:function(t){return mt.toCoord2D(t)}},n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=e[r]?e[r](t[r]):t[r]);return n}}])}(ut);function ki(t){return ki="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ki(t)}function xi(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ai(r.key),r)}}function Ai(t){var e=function(t,e){if("object"!=ki(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ki(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ki(e)?e:e+""}Si.EventTypes={"event:image.show":"event:image.show","event:image.hide":"event:image.hide","event:image.init":"event:image.init","event:image.applyTransform":"event:image.applyTransform","event:image.mount":"event:image.mount","event:image.unmount":"event:image.unmount","event:image.ready":"event:image.ready","event:image.elementLoaded":"event:image.elementLoaded","event:image.setTransition":"event:image.setTransition"},Si.defaultConfig={src:"",display:!1,position:new gt(st.Center),scale:1,rotation:0,opacity:0},Si.ImagePosition=ct;var Ti=function(){return function(t,e,n){return e&&xi(t.prototype,e),n&&xi(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e,n,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.callee=e,this.type=n,this.contentNode=r,this.__stack=g(),this._id=""}),[{key:"executeAction",value:function(t){return{type:this.type,node:this.contentNode}}},{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]:[]}}])}();Ti.ActionTypes={action:"action"};var Ei={say:"character:say",action:"character:action"},Oi={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"},Pi={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"},ji={action:"sound:action",play:"sound:play",stop:"sound:stop",fade:"sound:fade",setVolume:"sound:setVolume",setRate:"sound:setRate",pause:"sound:pause",resume:"sound:resume"},Ci={action:"control:action",do:"control:do",doAsync:"control:doAsync",any:"control:any",all:"control:all",allAsync:"control:allAsync",repeat:"control:repeat"};function Ii(t){return Ii="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},Ii(t)}function Li(t){return function(t){if(Array.isArray(t))return Fi(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Ri(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 Mi(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Mi=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",d="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==Ii(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function T(e,n,r){var o=p;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:d,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(Ii(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function Ni(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)||Ri(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 Ri(t,e){if(t){if("string"==typeof t)return Fi(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)?Fi(t,e):void 0}}function Fi(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 Vi(t,e,n,r){var o=Di(Wi(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function Di(){return Di="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Wi(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}},Di.apply(null,arguments)}function Bi(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Gi(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,$i(r.key),r)}}function Hi(t,e,n){return e&&Gi(t.prototype,e),n&&Gi(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function $i(t){var e=function(t,e){if("object"!=Ii(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ii(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ii(e)?e:e+""}function Ui(t,e,n){return e=Wi(e),function(t,e){if(e&&("object"==Ii(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,zi()?Reflect.construct(e,n||[],Wi(t).constructor):e.apply(t,n))}function zi(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(zi=function(){return!!t})()}function Wi(t){return Wi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wi(t)}function qi(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&&Yi(t,e)}function Yi(t,e){return Yi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Yi(t,e)}var Xi=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())}))},Ki=function(t){function e(t,n,r){var o;return Bi(this,e),(o=Ui(this,e,[t,n,r])).callee=t.getSelf(),o.contentNode.action=o,o}return qi(e,t),Hi(e,[{key:"unknownType",value:function(){throw new Error("Unknown action type: "+this.type)}}])}(Ti),Zi=function(t){function e(){return Bi(this,e),Ui(this,e,arguments)}return qi(e,t),Hi(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===Ei.say){var r=new h((function(t){return t})).registerSkipController(new k((function(){return{type:n.type,node:n.contentNode.getChild()}}))),o=this.contentNode.getContent();return t.createText(this.getId(),o,(function(){r.resolve({type:n.type,node:n.contentNode.getChild()})})),r}return Vi(e,"executeAction",this,3)([t])}}])}(Ki);Zi.ActionTypes=Ei;var Qi=function(t){function e(){return Bi(this,e),Ui(this,e,arguments)}return qi(e,t),Hi(e,[{key:"executeAction",value:function(t){var n,r=this;if(this.type===Oi.action)return Vi(e,"executeAction",this,3)([t]);if(this.type===Oi.setBackground)return this.callee.state.background=this.contentNode.getContent()[0],Vi(e,"executeAction",this,3)([t]);if(this.type===Oi.sleep){var o=new h((function(t){return t})),i=this.contentNode.getContent();return new Promise((function(t){"number"==typeof i?setTimeout((function(){t()}),i):h.isAwaitable(i)?i.then(t):null==i||i.then(t)})).then((function(){o.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),o}if(this.type===Oi.applyTransition){var a=(new h).registerSkipController(new k((function(){return t.logger.info("NarraLeaf-React: Background Transition","Skipped"),{type:r.type,node:r.contentNode.getChild()}}))),s=this.contentNode.getContent()[0];return this.callee.events.any("event:scene.applyTransition",s).then((function(){a.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),a}if(this.type===Oi.init){if(this.callee._liveState.active)return Vi(e,"executeAction",this,3)([t]);this.callee._liveState.active=!0;var u=new h((function(t){return t}));return t.registerSrcManager(this.callee.srcManager).addScene(this.callee),this.callee.events.once("event:scene.unmount",(function(){t.offSrcManager(r.callee.srcManager)})),this.callee.events.once("event:scene.mount",(function(){r.callee.state.backgroundMusic&&(ra.initSound(t,r.callee.state.backgroundMusic),r.callee.events.emit("event:scene.setBackgroundMusic",r.callee.state.backgroundMusic,r.callee.config.backgroundMusicFade))})),this.callee.events.once("event:scene.imageLoaded",(function(){var e=r.callee.getInitTransform();r.callee.events.any("event:scene.initTransform",e).then((function(){u.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()}))})),u}if(this.type===Oi.exit){this.callee._liveState.active=!1,t.offSrcManager(this.callee.srcManager).removeScene(this.callee);var c=new h((function(t){return t}));return this.callee.events.once("event:scene.unmount",(function(){c.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),c}if(this.type===Oi.jumpTo){var l=this.contentNode.getContent()[0],f=this.contentNode,p=(null===(n=l.sceneRoot)||void 0===n?void 0:n.contentNode)||null;return p&&f.addChild(p),Vi(e,"executeAction",this,3)([t])}if(this.type===Oi.setBackgroundMusic){var d=Ni(this.contentNode.getContent(),2),y=d[0],v=d[1];return this.callee.events.emit("event:scene.setBackgroundMusic",y,v||0),Vi(e,"executeAction",this,3)([t])}if(this.type===Oi.preUnmount)return this.callee.events.emit("event:scene.preUnmount"),Vi(e,"executeAction",this,3)([t]);if(this.type===Oi.applyTransform){var m=Ni(this.contentNode.getContent(),1)[0],g=new h((function(t){return t})).registerSkipController(new k((function(){return{type:r.type,node:r.contentNode.getChild()}})));return this.callee.events.any("event:scene.applyTransform",m).then((function(){g.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),g}throw new Error("Unknown scene action type: "+this.type)}},{key:"getFutureActions",value:function(){var t,e,n;if(this.type===Oi.jumpTo){var r=null===(e=null===(t=this.contentNode.getContent()[0])||void 0===t?void 0:t.sceneRoot)||void 0===e?void 0:e.contentNode;return(null==r?void 0:r.action)?[r.action]:[]}var o=null===(n=this.contentNode.getChild())||void 0===n?void 0:n.action;return o?[o]:[]}}])}(Ki);Qi.ActionTypes=Oi,(function(t){function e(){return Bi(this,e),Ui(this,e,arguments)}return qi(e,t),Hi(e)}(Ki)).ActionTypes={action:"story:action"};var Ji=function(t){function e(){return Bi(this,e),Ui(this,e,arguments)}return qi(e,t),Hi(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===Pi.init){var r=t.findElementByImage(this.callee);r&&t.disposeImage(this.callee,r.scene);var o=this.contentNode.getContent()[0];t.createImage(this.callee,o);var i=new h((function(t){return t}));return this.callee.events.once("event:image.mount",(function(){return Xi(n,void 0,void 0,Mi().mark((function e(){var n;return Mi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(n=this.callee.getScope())||void 0===n?void 0:n.current){e.next=3;break}return e.next=3,this.callee.events.any(Si.EventTypes["event:image.elementLoaded"]);case 3:return e.next=5,this.callee.events.any("event:image.init");case 5:i.resolve({type:this.type,node:this.contentNode.getChild()}),t.stage.next();case 7:case"end":return e.stop()}}),e,this)})))})),i}if(this.type===Pi.setSrc)return this.callee.state.src=this.contentNode.getContent()[0],t.stage.update(),Vi(e,"executeAction",this,3)([t]);if([Pi.show,Pi.hide,Pi.applyTransform].includes(this.type)){var a=new h((function(t){return t})).registerSkipController(new k((function(){return n.type===Pi.hide&&(n.callee.state.display=!1),{type:n.type,node:n.contentNode.getChild()}}))),s=this.contentNode.getContent()[1];return this.type===Pi.show&&(this.callee.state.display=!0,t.stage.update()),t.animateImage(Si.EventTypes["event:image.applyTransform"],this.callee,[s],(function(){var t;n.type===Pi.hide&&(n.callee.state.display=!1),a.resolve({type:n.type,node:null===(t=n.contentNode)||void 0===t?void 0:t.getChild()})})),a}if(this.type===Pi.dispose)return t.disposeImage(this.callee),this.callee._$setDispose(),Vi(e,"executeAction",this,3)([t]);if(this.type===Pi.setTransition)return this.callee.events.emit("event:image.setTransition",this.contentNode.getContent()[0]),Vi(e,"executeAction",this,3)([t]);if(this.type===Pi.applyTransition){var u=new h((function(t){return t})).registerSkipController(new k((function(){return n.type===Pi.hide&&(n.callee.state.display=!1),{type:n.type,node:n.contentNode.getChild()}})));return this.contentNode.getContent()[0].start((function(){u.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),u}throw Vi(e,"unknownType",this,3)([])}}])}(Ki);Ji.ActionTypes=Pi;var ta=function(t){function e(){return Bi(this,e),Ui(this,e,arguments)}return qi(e,t),Hi(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}}},{key:"getFutureActions",value:function(){return[].concat(Li(this.callee._getFutureActions()),Li(Vi(e,"getFutureActions",this,3)([])))}}])}(Ki);ta.ActionTypes={action:"condition:action"};var ea=function(t){function e(){return Bi(this,e),Ui(this,e,arguments)}return qi(e,t),Hi(e,[{key:"executeAction",value:function(t){return this.contentNode.getContent().execute({gameState:t}),{type:this.type,node:this.contentNode}}}])}(Ki);ea.ActionTypes={action:"script:action"};var na=function(t){function e(){return Bi(this,e),Ui(this,e,arguments)}return qi(e,t),Hi(e,[{key:"executeAction",value:function(t){var e=this,n=new h((function(t){return t})),r=this.contentNode.getContent();return t.createMenu(r,(function(r){var o,i,a=(null===(o=t.game.getLiveGame().getCurrentAction())||void 0===o?void 0:o.contentNode.getChild())||null;a&&(null===(i=r.action[r.action.length-1])||void 0===i||i.contentNode.addChild(a)),n.resolve({type:e.type,node:r.action[0].contentNode})})),n}},{key:"getFutureActions",value:function(){var t=this.contentNode.getContent();return[].concat(Li(this.callee._getFutureActions(t.choices)),Li(Vi(e,"getFutureActions",this,3)([])))}}])}(Ki);na.ActionTypes={action:"menu:action"};var ra=function(t){function e(){return Bi(this,e),Ui(this,e,arguments)}return qi(e,t),Hi(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===ji.play){if(e.initSound(t,this.callee),!this.callee.$getHowl())throw new Error("Howl is not initialized");if(this.callee.config.sync&&!this.callee.config.loop){var r=new h((function(t){return t})),o=t.playSound(this.callee.$getHowl(),(function(){var t;n.callee.$stop(),r.resolve({type:n.type,node:null===(t=n.contentNode)||void 0===t?void 0:t.getChild()})}));return this.callee.$setToken(o),r}var i=t.playSound(this.callee.$getHowl(),(function(){n.callee.$stop()}));return this.callee.$setToken(i),Vi(e,"executeAction",this,3)([t])}if(this.type===ji.stop)return this.callee.$getHowl()&&(this.callee.$getHowl().stop(),this.callee.$stop()),Vi(e,"executeAction",this,3)([t]);if(this.type===ji.fade){var a=Ni(this.contentNode.getContent(),1)[0],s=a.start,u=a.end,c=a.duration;if(this.callee.$getHowl()){var l=void 0===s?this.callee.$getHowl().volume():s;this.callee.$getHowl().fade(l,u,c,this.callee.$getToken())}return Vi(e,"executeAction",this,3)([t])}if(this.type===ji.setVolume){var f=Ni(this.contentNode.getContent(),1)[0];return this.callee.$getHowl()&&this.callee.$getHowl().volume(f,this.callee.$getToken()),Vi(e,"executeAction",this,3)([t])}if(this.type===ji.setRate){var p=Ni(this.contentNode.getContent(),1)[0];return this.callee.$getHowl()&&this.callee.$getHowl().rate(p,this.callee.$getToken()),Vi(e,"executeAction",this,3)([t])}if(this.type===ji.pause)return this.callee.$getHowl()&&this.callee.$getHowl().pause(this.callee.$getToken()),Vi(e,"executeAction",this,3)([t]);if(this.type===ji.resume)return this.callee.$getHowl()&&this.callee.$getHowl().play(this.callee.$getToken()),Vi(e,"executeAction",this,3)([t]);throw Vi(e,"unknownType",this,3)([])}}],[{key:"initSound",value:function(t,e){e.$getHowl()||e.$setHowl(new(t.getHowl())(e.getHowlOptions()))}}])}(Ki);ra.ActionTypes=ji;var oa=function(t){function e(){return Bi(this,e),Ui(this,e,arguments)}return qi(e,t),Hi(e,[{key:"executeAllActions",value:function(t,e){return Xi(this,void 0,void 0,Mi().mark((function n(){var r,o,i;return Mi().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:r=!1,o=e,i=Mi().mark((function e(){var n,r,i;return Mi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.game.getLiveGame().executeAction(t,o)){e.next=3;break}return e.abrupt("return",0);case 3:if(!h.isAwaitable(n)){e.next=15;break}return e.next=6,new Promise((function(t){n.then((function(e){return t(n.result)}))}));case 6:if(r=e.sent,!(i=r.node)){e.next=12;break}o=i.action,e.next=13;break;case 12:return e.abrupt("return",0);case 13:e.next=16;break;case 15:o=n;case 16: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 Xi(this,void 0,void 0,Mi().mark((function n(){var r,o,i;return Mi().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=t.game.getLiveGame().executeAction(t,e),!h.isAwaitable(r)){n.next=9;break}return n.next=4,new Promise((function(t){r.then((function(e){return t(r.result)}))}));case 4:return o=n.sent,i=o.node,n.abrupt("return",i);case 9:return n.abrupt("return",r);case 10:case"end":return n.stop()}}),n)})))}},{key:"execute",value:function(t,n,r){var o=this;return r.length>0?(this.executeAllActions(t,r[0]).then((function(){n.resolve({type:o.type,node:o.contentNode.getChild()})})),n):Vi(e,"executeAction",this,3)([t])}},{key:"executeAction",value:function(t){var n,r,o=this,i=Ni(this.contentNode.getContent(),1)[0];if(this.type===Ci.do){var a=null===(n=i[0])||void 0===n?void 0:n.contentNode,s=null===(r=i[i.length-1])||void 0===r?void 0:r.contentNode,u=this.contentNode.getChild();return null==s||s.addChild(u),this.contentNode.addChild(a||null),Vi(e,"executeAction",this,3)([t])}if(this.type===Ci.doAsync)return Xi(o,void 0,void 0,Mi().mark((function e(){return Mi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i.length>0)){e.next=3;break}return e.next=3,this.executeAllActions(t,i[0]);case 3:case"end":return e.stop()}}),e,this)}))),Vi(e,"executeAction",this,3)([t]);if(this.type===Ci.any){var c=new h((function(t){return t})),l=i.map((function(e){return o.executeSingleAction(t,e)}));return Promise.any(l).then((function(){c.resolve({type:o.type,node:o.contentNode.getChild()})})),c}if(this.type===Ci.all){var f=new h((function(t){return t}));return this.execute(t,f,i)}if(this.type===Ci.allAsync)return Xi(o,void 0,void 0,Mi().mark((function e(){return Mi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i.length>0)){e.next=3;break}return e.next=3,this.executeAllActions(t,i[0]);case 3:case"end":return e.stop()}}),e,this)}))),Vi(e,"executeAction",this,3)([t]);if(this.type===Ci.repeat){var p=Ni(this.contentNode.getContent(),2),d=p[0],y=p[1];return Xi(o,void 0,void 0,Mi().mark((function e(){var n;return Mi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=0;case 1:if(!(n<y)){e.next=8;break}if(!(d.length>0)){e.next=5;break}return e.next=5,this.executeAllActions(t,d[0]);case 5:n++,e.next=1;break;case 8:case"end":return e.stop()}}),e,this)}))),Vi(e,"executeAction",this,3)([t])}throw new Error("Unknown control action type: "+this.type)}},{key:"getFutureActions",value:function(){var t=this.contentNode.getContent()[0],n=Vi(e,"getFutureActions",this,3)([]);return[].concat(Li(t),Li(n))}}])}(Ki);function ia(t){return ia="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},ia(t)}function aa(t,e,n){return e=fa(e),function(t,e){if(e&&("object"==ia(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,ca()?Reflect.construct(e,n||[],fa(t).constructor):e.apply(t,n))}function sa(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&&la(t,e)}function ua(t){var e="function"==typeof Map?new Map:void 0;return ua=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(ca())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var o=new(t.bind.apply(t,r));return n&&la(o,n.prototype),o}(t,arguments,fa(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),la(n,t)},ua(t)}function ca(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ca=function(){return!!t})()}function la(t,e){return la=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},la(t,e)}function fa(t){return fa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},fa(t)}function pa(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}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,ya(r.key),r)}}function ha(t,e,n){return e&&da(t.prototype,e),n&&da(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function ya(t){var e=function(t,e){if("object"!=ia(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ia(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ia(e)?e:e+""}oa.ActionTypes=Ci;var va=function(){function t(){pa(this,t)}return ha(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://")}}])}(),ma=function(t){function e(t,n){return pa(this,e),aa(this,e,[t,{info:n},"NarraLeafReact-StaticScriptWarning"])}return sa(e,t),ha(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 pa(this,e),(r=aa(this,e,[t])).props=n,r.name=o,r}return sa(e,t),ha(e,null,[{key:"isUseError",value:function(t){return t instanceof e}}])}(ua(Error))),ga=function(){return ha((function t(e){pa(this,t),this.scene=e}),[{key:"run",value:function(){if(!this.scene.sceneRoot)return null;var t=new Map,e=new Map,n=[],r=new Set,o=this.scene.getAllChildren(this.scene.sceneRoot);if(!o.length)return null;for(n.push(o[0]);n.length;){var i=n.shift();this.checkAction(i,{imageStates:t,scenes:e},r);var a=i.contentNode.getChild();a&&a.action&&n.push(a.action)}return t}},{key:"checkAction",value:function(t,e,n){var r=e.imageStates,o=e.scenes;if(t instanceof Ji)r.has(t.callee)||r.set(t.callee,{isDisposed:!1,usedExternalSrc:!1}),this.checkImage(r.get(t.callee),t);else if(t instanceof Qi){var i=t.callee;if(o.has(i.name)){if(o.get(i.name)!==i){var a="Scene with name: ".concat(i.name," is duplicated\nScene: ").concat(i.name,"\n\nAt: ").concat(t.__stack);throw new ma(a)}}else o.set(i.name,i);if(t.type===Oi.jumpTo){var s=t.contentNode.getContent()[0];if(n.has(s))return;n.add(s)}}}},{key:"checkImage",value:function(t,e){if(e.type===Pi.dispose){if(t.isDisposed){var n="Image is disposed multiple times before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new ma(n)}t.isDisposed=!0}else if([Pi.init,Pi.show,Pi.hide,Pi.applyTransform,Pi.applyTransition].includes(e.type)){if(t.isDisposed){var r="Image is disposed before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new ma(r)}}else if(e.type===Pi.setSrc){var o=e.contentNode.getContent()[0];va.isExternalSrc(o)&&(t.usedExternalSrc=!0)}}}])}();function ba(t){return ba="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},ba(t)}function wa(t,e,n){return e=Sa(e),function(t,e){if(e&&("object"==ba(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,_a()?Reflect.construct(e,n||[],Sa(t).constructor):e.apply(t,n))}function _a(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(_a=function(){return!!t})()}function Sa(t){return Sa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Sa(t)}function ka(t,e){return ka=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ka(t,e)}function xa(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Aa(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,Ea(r.key),r)}}function Ta(t,e,n){return e&&Aa(t.prototype,e),n&&Aa(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ea(t){var e=function(t,e){if("object"!=ba(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ba(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ba(e)?e:e+""}var Oa=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};xa(this,t),this.character=e,this.text=this.format(n),this.config=d(t.defaultConfig,r),this.state=y(t.defaultState)}return Ta(t,[{key:"format",value:function(t){var e=[];if(Array.isArray(t))for(var n=0;n<t.length;n++)ja.isWord(t[n])?e.push(t[n]):e.push(new ja(t[n]));else e.push(ja.isWord(t)?t:new ja(t));return e}},{key:"toData",value:function(){return w(this.state,t.defaultState)?null:{state:y(this.state)}}},{key:"fromData",value:function(t){return this.state=d(this.state,t),this}},{key:"toString",value:function(){return this.text.map((function(t){return t.text})).join("")}}],[{key:"isSentence",value:function(e){return e instanceof t}},{key:"toSentence",value:function(e){return t.isSentence(e)?e:new t(null,e)}}])}();Oa.defaultConfig={color:"#000",pause:!0,voice:null},Oa.defaultState={display:!0};var Pa,ja=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};xa(this,t),this.text=e,this.config=d(t.defaultConfig,n)}return Ta(t,null,[{key:"isWord",value:function(e){return e instanceof t}}])}();ja.defaultConfig={},ja.defaultColor="#000",function(t){t.adv="adv",t.nvl="nvl"}(Pa||(Pa={}));var Ca=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return xa(this,e),(n=wa(this,e)).name=t,n.config=d({},e.defaultConfig,r),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ka(t,e)}(e,t),Ta(e,[{key:"say",value:function(t){var e=Array.isArray(t)?new Oa(this,t,{}):Oa.isSentence(t)?t:new Oa(this,t,{}),n=new Zi(this.chain(),Zi.ActionTypes.say,(new M).setContent(e));return this.chain(n)}}])}(ut);function Ia(t){return Ia="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},Ia(t)}function La(t){return function(t){if(Array.isArray(t))return Na(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Ma(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 Ma(t,e){if(t){if("string"==typeof t)return Na(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)?Na(t,e):void 0}}function Na(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 Ra(t,e,n){return e=Va(e),function(t,e){if(e&&("object"==Ia(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,Fa()?Reflect.construct(e,n||[],Va(t).constructor):e.apply(t,n))}function Fa(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Fa=function(){return!!t})()}function Va(t){return Va=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Va(t)}function Da(t,e){return Da=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Da(t,e)}function Ba(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ga(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,$a(r.key),r)}}function Ha(t,e,n){return e&&Ga(t.prototype,e),n&&Ga(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function $a(t){var e=function(t,e){if("object"!=Ia(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ia(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ia(e)?e:e+""}Ca.Modes=Pa,Ca.defaultConfig={mode:Pa.adv};var Ua=function(){return Ha((function t(e){Ba(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()}}}])}(),za=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Ba(this,e),(t=Ra(this,e)).conditions={If:{condition:null,action:null},ElseIf:[],Else:{action:null}},t.config=d(e.defaultConfig,n),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Da(t,e)}(e,t),Ha(e,[{key:"If",value:function(t,e){if(this.conditions.If.condition)throw new ma("IF condition already set\nYou are trying to set multiple IF conditions for the same condition");if(this.conditions.ElseIf.length)throw new ma("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 ma("ELSE condition already set\nYou are trying to set an IF condition after an ELSE condition");return this.conditions.If.condition=t instanceof Ua?t:new Ua(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 ma("IF condition not set\nYou are trying to set an ELSE-IF condition without an IF condition");if(this.conditions.Else.action)throw new ma("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 Ua?t:new Ua(t),action:this.construct(Array.isArray(e)?e:[e])}),this.chain()}},{key:"Else",value:function(t){if(!this.conditions.If.condition)throw new ma("IF condition not set\nYou are trying to set an ELSE condition without an IF condition");if(this.conditions.Else.action)throw new ma("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=Ma(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(ta,[this,ta.ActionTypes.action,(new M).setContent(t.conditions)])]}},{key:"construct",value:function(t,e,n){for(var r,o=Q.toActions(t),i=0;i<o.length;i++){var a=o[i].contentNode,s=null===(r=o[i+1])||void 0===r?void 0:r.contentNode;s&&a.setInitChild(s),i===o.length-1&&e&&a.setInitChild(e),0===i&&n&&n.setInitChild(a)}return o}},{key:"_getFutureActions",value:function(){return Q.toActions([].concat(La(this.conditions.If.action||[]),La(this.conditions.ElseIf.flatMap((function(t){return t.action||[]}))),La(this.conditions.Else.action||[])))}}],[{key:"getInitialState",value:function(){return{If:{condition:null,action:null},ElseIf:[],Else:{action:null}}}}])}(ut);function Wa(t){return Wa="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},Wa(t)}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,Ya(r.key),r)}}function Ya(t){var e=function(t,e){if("object"!=Wa(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Wa(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Wa(e)?e:e+""}function Xa(t,e,n){return e=Za(e),function(t,e){if(e&&("object"==Wa(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,Ka()?Reflect.construct(e,n||[],Za(t).constructor):e.apply(t,n))}function Ka(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ka=function(){return!!t})()}function Za(t){return Za=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Za(t)}function Qa(t,e){return Qa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Qa(t,e)}za.defaultConfig={};var Ja=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Xa(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&&Qa(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:"do",value:function(t){return this.push(oa.ActionTypes.do,t)}},{key:"doAsync",value:function(t){return this.push(oa.ActionTypes.doAsync,t)}},{key:"any",value:function(t){return this.push(oa.ActionTypes.any,t)}},{key:"all",value:function(t){return this.push(oa.ActionTypes.all,t)}},{key:"allAsync",value:function(t){return this.push(oa.ActionTypes.allAsync,t)}},{key:"repeat",value:function(t,e){return this.push(oa.ActionTypes.repeat,e,t)}},{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.setInitChild(r.contentNode))}return t}},{key:"push",value:function(t,e){for(var n=Q.toActions(e),r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];var a=new oa(this.chain(),t,(new M).setContent([this.construct(n)].concat(o)));return this.chain(a)}}],[{key:"do",value:function(t){return(new e).do(t)}},{key:"doAsync",value:function(t){return(new e).doAsync(t)}},{key:"any",value:function(t){return(new e).any(t)}},{key:"all",value:function(t){return(new e).all(t)}},{key:"allAsync",value:function(t){return(new e).allAsync(t)}},{key:"repeat",value:function(t,n){return(new e).repeat(t,n)}}])}(ut);function ts(t){return ts="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},ts(t)}function es(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"!=ts(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ts(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ts(e)?e:e+""}function rs(t,e,n){return e=is(e),function(t,e){if(e&&("object"==ts(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,os()?Reflect.construct(e,n||[],is(t).constructor):e.apply(t,n))}function os(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(os=function(){return!!t})()}function is(t){return is=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},is(t)}function as(t,e){return as=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},as(t,e)}var ss=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=rs(this,e)).choices=[],n.prompt=Oa.isSentence(t)?t:new Oa(null,t),n.config=d(e.defaultConfig,r),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&as(t,e)}(e,t),function(t,e,n){return e&&es(t.prototype,e),n&&es(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"choose",value:function(t,e){var n=this.chain();return Oa.isSentence(t)&&e||(ja.isWord(t)||Array.isArray(t)||"string"==typeof t)&&e?n.choices.push({prompt:Oa.toSentence(t),action:Q.toActions(e)}):"object"===ts(t)&&"prompt"in t&&"action"in t?n.choices.push({prompt:Oa.toSentence(t.prompt),action:Q.toActions(t.action)}):console.warn("No valid choice added to menu, ",{arg0:t,arg1:e}),n}},{key:"fromChained",value:function(t){return[new na(this.chain(),na.ActionTypes.action,(new M).setContent({prompt:this.prompt,choices:t.constructChoices()}))]}},{key:"_getFutureActions",value:function(t){return t.map((function(t){return t.action})).flat(2)}},{key:"construct",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.setInitChild(a),o===this.choices.length-1&&e&&i.setInitChild(e),0===o&&n&&n.setInitChild(i)}return t}},{key:"constructChoices",value:function(){var t=this;return this.choices.map((function(e){return{action:t.construct(e.action),prompt:e.prompt}}))}}])}(ut);function us(t){return us="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},us(t)}function cs(t){return function(t){if(Array.isArray(t))return ls(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 ls(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)?ls(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 ls(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 fs(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,ps(r.key),r)}}function ps(t){var e=function(t,e){if("object"!=us(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=us(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==us(e)?e:e+""}function ds(t,e,n){return e=ys(e),function(t,e){if(e&&("object"==us(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,hs()?Reflect.construct(e,n||[],ys(t).constructor):e.apply(t,n))}function hs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(hs=function(){return!!t})()}function ys(t){return ys=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ys(t)}function vs(t,e){return vs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},vs(t,e)}ss.defaultConfig={},ss.targetAction=na;var ms,gs=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ds(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&&vs(t,e)}(e,t),function(t,e,n){return e&&fs(t.prototype,e),n&&fs(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,cs(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,cs(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.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:"fromData",value:function(t){return this}},{key:"construct",value:function(t,e){for(var n,r=0;r<t.length;r++){var o=t[r];0===r&&e?e.setInitChild(o.contentNode):r>0&&(null===(n=t[r-1].contentNode)||void 0===n||n.setInitChild(o.contentNode))}return t.length?t[0].contentNode:null}}])}(J);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 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,_s(r.key),r)}}function _s(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+""}function Ss(t,e,n){return e=xs(e),function(t,e){if(e&&("object"==bs(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,ks()?Reflect.construct(e,n||[],xs(t).constructor):e.apply(t,n))}function ks(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ks=function(){return!!t})()}function xs(t){return xs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},xs(t)}function As(t,e){return As=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},As(t,e)}!function(t){t.soundEffect="soundEffect",t.music="music",t.voice="voice",t.backgroundMusic="backgroundMusic"}(ms||(ms={}));var Ts=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=Ss(this,e)).state={playing:null,token:null},t.config=d(e.defaultConfig,n),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&As(t,e)}(e,t),function(t,e,n){return e&&ws(t.prototype,e),n&&ws(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"play",value:function(){if(this.config.type===ms.backgroundMusic)throw new Error("Background music cannot be played directly");return this.pushAction(ra.ActionTypes.play,[void 0])}},{key:"stop",value:function(){if(this.config.type===ms.backgroundMusic)throw new Error("Background music cannot be stopped directly");return this.pushAction(ra.ActionTypes.stop,[void 0])}},{key:"fade",value:function(t,e,n){if(this.config.type===ms.backgroundMusic)throw new Error("Background music cannot be faded directly");return this.pushAction(ra.ActionTypes.fade,[{start:t,end:e,duration:n}])}},{key:"setVolume",value:function(t){return this.pushAction(ra.ActionTypes.setVolume,[t])}},{key:"setRate",value:function(t){return this.pushAction(ra.ActionTypes.setRate,[t])}},{key:"pause",value:function(t){return void 0!==t?this.fade(void 0,0,t):this.pushAction(ra.ActionTypes.pause,[void 0])}},{key:"resume",value:function(t){return void 0!==t?this.fade(0,this.config.volume,t):this.pushAction(ra.ActionTypes.resume,[void 0])}},{key:"getHowlOptions",value:function(){return{src:this.config.src,loop:this.config.loop,volume:this.config.volume,html5:this.config.streaming,autoplay:!1}}},{key:"getSrc",value:function(){return this.config.src}},{key:"$setToken",value:function(t){this.state.token=t}},{key:"$getToken",value:function(){return this.state.token}},{key:"$setHowl",value:function(t){this.state.playing=t}},{key:"$getHowl",value:function(){return this.state.playing}},{key:"$stop",value:function(){this.$setToken(null),this.$setHowl(null)}},{key:"toData",value:function(){return w(this.config,e.defaultConfig)?null:{config:y(this.config)}}},{key:"fromData",value:function(t){return this.config=d(this.config,t.config),this}},{key:"reset",value:function(){var t;null===(t=this.state.playing)||void 0===t||t.stop(),this.state.playing=null,this.state.token=null}},{key:"pushAction",value:function(t,e){return this.chain(new ra(this.chain(),t,(new M).setContent(e)))}}])}(ut);function Es(t){return Es="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Es(t)}function Os(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,Ps(r.key),r)}}function Ps(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+""}Ts.defaultConfig={src:"",sync:!1,loop:!1,volume:1};var js=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&&Os(t.prototype,e),n&&Os(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 Ts){if(this.isSrcRegistered(t.getSrc()))return this;this.src.push({type:"audio",src:t})}else if(t instanceof Si||va.isStaticImageData(t)){if(t instanceof Si){if(this.isSrcRegistered(va.srcToString(t.state.src)))return this}else if(this.isSrcRegistered(va.srcToString(t.src)))return this;this.src.push({type:"image",src:t instanceof Si?t:new Si("",{src:va.staticImageDataToSrc(t)})})}else if("object"===Es(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 Ts?e:new Ts({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 Ts?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===va.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 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 Is(t){return function(t){if(Array.isArray(t))return Ls(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 Ls(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)?Ls(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 Ls(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 Ms(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"!=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 Rs(t,e,n){return e=Ds(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,Fs()?Reflect.construct(e,n||[],Ds(t).constructor):e.apply(t,n))}function Fs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Fs=function(){return!!t})()}function Vs(){return Vs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Ds(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}},Vs.apply(null,arguments)}function Ds(t){return Ds=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ds(t)}function Bs(t,e){return Bs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Bs(t,e)}js.SrcTypes={image:"image",video:"video",audio:"audio"};var Gs=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.defaultConfig;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=Rs(this,e)).srcManager=new js,n.events=new m,n._liveState={active:!1},n.name=t,n.config=d(e.defaultConfig,r),n.state=d(e.defaultState,n.config),n.backgroundImageState={position:new gt(st.Center),opacity:1},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&&Bs(t,e)}(e,t),function(t,e,n){return e&&Ms(t.prototype,e),n&&Ms(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"activate",value:function(){return this.chain(this._init(this))}},{key:"deactivate",value:function(){return this.chain(this._exit())}},{key:"setBackground",value:function(t,e){var n=this.chain();if(e){var r=e.copy();r.setSrc(va.backgroundToSrc(t)),n._transitionToScene(void 0,r,t)}return n.chain(new Qi(n,"scene:setBackground",(new M).setContent([t])))}},{key:"applyTransform",value:function(t){return this.chain(new Qi(this.chain(),"scene:applyTransform",(new M).setContent([t])))}},{key:"jumpTo",value:function(t,e){var n=e||{};return this.chain(new Qi(this.chain(),"scene:preUnmount",(new M).setContent([])))._transitionToScene(t,n.transition).chain(t._init()).chain(this._exit())._jumpTo(t)}},{key:"sleep",value:function(t){return this.chain(new Qi(this.chain(),"scene:sleep",(new M).setContent(t)))}},{key:"setBackgroundMusic",value:function(t,e){return this.chain(new Qi(this.chain(),Oi.setBackgroundMusic,(new M).setContent([t,e])))}},{key:"toData",value:function(){var t;return{state:Object.assign(Object.assign({},y(this.state)),{backgroundMusic:null===(t=this.state.backgroundMusic)||void 0===t?void 0:t.toData(),background:this.state.background}),backgroundImageState:Si.serializeImageState(this.backgroundImageState)}}},{key:"fromData",value:function(t){return this.state=d(this.state,t.state),t.state.backgroundMusic&&(this.state.backgroundMusic=(new Ts).fromData(t.state.backgroundMusic),this.state.background=t.state.background),t.backgroundImageState&&(this.backgroundImageState=Si.deserializeImageState(t.backgroundImageState)),this}},{key:"getInitTransform",value:function(){return new hi([{props:Object.assign(Object.assign({},this.backgroundImageState),{opacity:1}),options:{duration:0}}])}},{key:"action",value:function(t){var n=(Array.isArray(t)?t.flat(2):t(this).flat(2)).map((function(t){return Q.isChained(t)?t.fromChained(t):t})).flat(2),r=this.getAllChildrenElements(n).filter((function(t){return t instanceof Si&&!Q.isChained(t)})),o=[this._init(this)].concat(Is(r.map((function(t){return t._init()}))),Is(n)),i=function(t,e,n,r){var o=Vs(Ds(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"construct",this,3)([o]),a=new M(void 0,void 0,i||void 0).setContent(this);return null==i||i.setParent(a),this.sceneRoot=new Qi(this.chain(),"scene:action",a),this}},{key:"registerSrc",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Set;if(this.sceneRoot){var n=new Set,r=[this.sceneRoot],o=new Set;for(va.backgroundToSrc(this.config.background)&&this.srcManager.register(new Si({src:va.backgroundToSrc(this.config.background)}));r.length;){var i=r.shift();if(i instanceof Qi){if(i.type===Oi.jumpTo){var a=i,s=a.contentNode.getContent()[0];if(n.has(a)||e.has(s))continue;n.add(a),o.add(s),e.add(s)}else if(i.type===Oi.setBackground){var u=i.contentNode.getContent()[0];this.srcManager.register(new Si({src:va.backgroundToSrc(u)}))}}else if(i instanceof Ji){var c=i;if(this.srcManager.register(c.callee),i.type===Pi.setSrc){var l=i.contentNode.getContent()[0];this.srcManager.register(new Si({src:l}))}}else if(i instanceof ra)this.srcManager.register(i.callee);else if(i instanceof oa){var f=i.getFutureActions();r.push.apply(r,Is(f))}r.push.apply(r,Is(i.getFutureActions()))}o.forEach((function(n){n.registerSrc(e),t.srcManager.registerFuture(n.srcManager)}))}}},{key:"assignActionId",value:function(){this.getAllChildren(this.sceneRoot||[]).forEach((function(t,e){t.setId("action-".concat(e))}))}},{key:"assignElementId",value:function(){this.getAllChildrenElements(this.sceneRoot||[]).forEach((function(t,e){t.setId("element-".concat(e))}))}},{key:"reset",value:function(){this.state=d(e.defaultState,this.config),this.backgroundImageState={position:new gt(st.Center),opacity:1}}},{key:"_applyTransition",value:function(t){return this.chain(new Qi(this.chain(),"scene:applyTransition",(new M).setContent([t])))}},{key:"_jumpTo",value:function(t){return this.chain(new Qi(this.chain(),"scene:jumpTo",(new M).setContent([t])))}},{key:"_exit",value:function(){return new Qi(this.chain(),"scene:exit",(new M).setContent([]))}},{key:"_transitionToScene",value:function(t,e,n){var r=this.chain();if(e){var o=e.copy();t&&o.setSrc(va.backgroundToSrc(t.state.background)),n&&o.setSrc(va.backgroundToSrc(n)),r._applyTransition(o)}return r}},{key:"_init",value:function(){return new Qi((arguments.length>0&&void 0!==arguments[0]?arguments[0]:this).chain(),"scene:init",(new M).setContent([]))}}])}(gs);function Hs(t){return Hs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hs(t)}function $s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Us(r.key),r)}}function Us(t){var e=function(t,e){if("object"!=Hs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Hs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Hs(e)?e:e+""}function zs(t,e,n){return e=Ys(e),Ws(t,qs()?Reflect.construct(e,n||[],Ys(t).constructor):e.apply(t,n))}function Ws(t,e){if(e&&("object"==Hs(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function qs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(qs=function(){return!!t})()}function Ys(t){return Ys=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ys(t)}function Xs(t,e){return Xs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Xs(t,e)}Gs.EventTypes={"event:scene.applyTransition":"event:scene.applyTransition","event:scene.remove":"event:scene.remove","event:scene.load":"event:scene.load","event:scene.unload":"event:scene.unload","event:scene.mount":"event:scene.mount","event:scene.unmount":"event:scene.unmount","event:scene.preUnmount":"event:scene.preUnmount","event:scene.imageLoaded":"event:scene.imageLoaded","event:scene.initTransform":"event:scene.initTransform","event:scene.setBackgroundMusic":"event:scene.setBackgroundMusic","event:scene.applyTransform":"event:scene.applyTransform"},Gs.defaultConfig={background:null,invertY:!1,invertX:!1,backgroundMusic:null,backgroundMusicFade:0},Gs.defaultState={};var Ks=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=zs(this,e)).handler=t,Ws(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&&Xs(t,e)}(e,t),function(t,e,n){return e&&$s(t.prototype,e),n&&$s(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"execute",value:function(t){var e=t.gameState;this.handler(this.getCtx({gameState:e}))}},{key:"getCtx",value:function(t){var e=t.gameState;return{gameState:e,game:e.game,liveGame:e.game.getLiveGame(),storable:e.game.getLiveGame().getStorable()}}},{key:"fromChained",value:function(t){return[new ea(this.chain(),ea.ActionTypes.action,(new M).setContent(t))]}}])}(ut);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 Qs(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Js(r.key),r)}}function Js(t){var e=function(t,e){if("object"!=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+""}function tu(t,e,n){return e=nu(e),function(t,e){if(e&&("object"==Zs(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,eu()?Reflect.construct(e,n||[],nu(t).constructor):e.apply(t,n))}function eu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(eu=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)}var ou=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=tu(this,e)).entryScene=null,n.name=t,n.config=d(e.defaultConfig,r),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ru(t,e)}(e,t),function(t,e,n){return e&&Qs(t.prototype,e),n&&Qs(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 ga(t).run()}}])}(gs);function iu(t){return iu="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},iu(t)}function au(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 su(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)?su(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 su(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 uu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function cu(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 lu(t,e,n){return e&&cu(t.prototype,e),n&&cu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function fu(t){var e=function(t,e){if("object"!=iu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=iu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==iu(e)?e:e+""}ou.defaultConfig={};var pu=function(){function t(e,n,r){uu(this,t),this.name=e,this.key=r||e,this.content=d({},n)}return lu(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=au(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=au(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(iu(e))||(e instanceof Date||(null==e||(Array.isArray(e)?e.every(t.isSerializable):"object"===iu(e)&&(Object.getPrototypeOf(e)===Object.prototype&&Object.values(e).every(t.isSerializable)))))}}])}(),du=function(){return lu((function t(){uu(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=au(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=au(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}}])}(),hu=o(196);function yu(t){return yu="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},yu(t)}function vu(t){return function(t){if(Array.isArray(t))return mu(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 mu(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)?mu(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 mu(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 gu(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 bu(t){var e=function(t,e){if("object"!=yu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=yu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==yu(e)?e:e+""}var wu=function(){return function(t,e,n){return e&&gu(t.prototype,e),n&&gu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state={sounds:[],srcManagers:[],elements:[]},this.currentHandling=null,this.stage=n,this.game=e,this.events=new m,this.logger=new S(e,"NarraLeaf-React")}),[{key:"findElementByScene",value:function(t){return this.state.elements.find((function(e){return e.scene===t}))||null}},{key:"findElementByImage",value:function(t){return this.state.elements.find((function(e){return e.ele.images.includes(t)}))||null}},{key:"addScene",value:function(t){return this.sceneExists(t)||this.state.elements.push({scene:t,ele:this.getElementMap()}),this}},{key:"popScene",value:function(){var t=this.state.elements.pop();return t?(this.removeElements(t.scene),this):this}},{key:"removeScene",value:function(t){return this.removeElements(t),this}},{key:"getSceneElements",value:function(){return this.state.elements}},{key:"getLastScene",value:function(){var t;return(null===(t=this.state.elements[this.state.elements.length-1])||void 0===t?void 0:t.scene)||null}},{key:"sceneExists",value:function(t){return t?this.state.elements.some((function(e){return e.scene===t})):!!this.getLastScene()}},{key:"handle",value:function(t){return this.currentHandling===t||(this.currentHandling=t,t.type),this}},{key:"createText",value:function(t,e,n,r){var o,i=null===(o=this.findElementByScene(this._getLastSceneIfNot(r)))||void 0===o?void 0:o.ele.texts;if(!i)throw new Error("Scene not found");var a=this.createWaitableAction({character:e.character,sentence:e,id:t},(function(){i.splice(i.indexOf(a),1),n&&n()}));i.push(a)}},{key:"createMenu",value:function(t,e,n){var r;if(!t.choices.length)throw new Error("Menu must have at least one choice");var o=null===(r=this.findElementByScene(this._getLastSceneIfNot(n)))||void 0===r?void 0:r.ele.menus;if(!o)throw new Error("Scene not found");var i=this.createWaitableAction(t,(function(t){o.splice(o.indexOf(i),1),e&&e(t)}));o.push(i)}},{key:"createImage",value:function(t,e){var n=this._getLastSceneIfNot(e),r=this.findElementByScene(n);return r?(r.ele.images.push(t),this):this}},{key:"disposeImage",value:function(t,e){var n,r=this._getLastSceneIfNot(e),o=null===(n=this.findElementByScene(r))||void 0===n?void 0:n.ele.images;if(!o)throw new Error("Scene not found");var i=o.indexOf(t);if(-1===i)throw new Error("Image not found");return o.splice(i,1),this}},{key:"forceReset",value:function(){var t=this;this.state.elements.forEach((function(e){var n=e.scene;t.offSrcManager(n.srcManager),n._liveState.active=!1,n.events.clear()})),this.state.elements=[],this.state.srcManagers=[]}},{key:"playSound",value:function(t,e){var n=t.play(),r=[t.once("end",o.bind(this)),t.once("stop",o.bind(this))];function o(){e&&e(),r.forEach((function(t){return t.off()})),this.stage.next()}return n}},{key:"getHowl",value:function(){return hu.Howl}},{key:"animateImage",value:function(t,e,n,r){return this.anyEvent.apply(this,[t,e,r].concat(vu(n)))}},{key:"registerSrcManager",value:function(t){return this.state.srcManagers.push(t),this}},{key:"offSrcManager",value:function(t){return this.state.srcManagers=this.state.srcManagers.filter((function(e){return e!==t})),this}},{key:"getStorable",value:function(){return this.game.getLiveGame().getStorable()}},{key:"toData",value:function(){return{scenes:this.state.elements.map((function(t){return{sceneId:t.scene.getId(),elements:{images:t.ele.images.map((function(t){return t.getId()}))}}}))}}},{key:"loadData",value:function(t,e){var n=this;if(this.state.elements=[],!this.game.getLiveGame().story)throw new Error("No story loaded");t.scenes.forEach((function(t){var r=t.sceneId,o=t.elements,i=e.get(r);if(!i)throw new Error("Scene not found, id: "+r+"\nNarraLeaf cannot find the element with the id from the saved game");var a={scene:i,ele:{images:o.images.map((function(t){if(!e.has(t))throw new Error("Image not found, id: "+t+"\nNarraLeaf cannot find the element with the id from the saved game");return e.get(t)})),menus:[],texts:[]}};n.state.elements.push(a),n.state.srcManagers.push(a.scene.srcManager)}))}},{key:"getElementMap",value:function(){return{texts:[],menus:[],images:[]}}},{key:"removeElements",value:function(t){var e=this.state.elements.findIndex((function(e){return e.scene===t}));return-1===e||this.state.elements.splice(e,1),this}},{key:"_getLastSceneIfNot",value:function(t){var e=t||this.getLastScene();if(!e||!this.sceneExists(e))throw new Error('Scene not found, please call "scene.activate()" first.');return e}},{key:"anyEvent",value:function(t,e,n){for(var r,o=this,i=arguments.length,a=new Array(i>3?i-3:0),s=3;s<i;s++)a[s-3]=arguments[s];(r=e.events).any.apply(r,[t].concat(a)).then(n).then((function(){o.stage.next()}))}},{key:"createWaitableAction",value:function(t,e){return{action:t,onClick:function(t){e&&e(t)}}}}])}();function _u(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=_u(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}wu.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"};const Su=function(){for(var t,e,n=0,r="",o=arguments.length;n<o;n++)(t=arguments[n])&&(e=_u(t))&&(r&&(r+=" "),r+=e);return r};var ku=o(12),xu=o.n(ku);function Au(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 Tu(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)?Tu(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 Tu(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 Eu(t){return Eu="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},Eu(t)}function Ou(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"!=Eu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Eu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Eu(e)?e:e+""}var ju=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state={width:0,height:0,minWidth:800,minHeight:450,paused:!1},this.events=new m,this.lockers=[],this.updater=null}return function(t,e,n){return e&&Ou(t.prototype,e),n&&Ou(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"update",value:function(e,n){this.state.width=e,this.state.height=n,this.events.emit(t.EventTypes["event:aspectRatio.update"],e,n)}},{key:"updateMin",value:function(t,e){this.state.minWidth=t,this.state.minHeight=e}},{key:"lock",value:function(){var t=Symbol();return this.lockers.push(t),t}},{key:"unlock",value:function(t){if(t&&!this.lockers.includes(t))throw new Error("Locker not found");return this.lockers=this.lockers.filter((function(e){return e!==t})),this.triggerUpdate(),null}},{key:"isLocked",value:function(){return!!this.lockers.length}},{key:"getStyle",value:function(){return{width:"".concat(this.state.width,"px"),height:"".concat(this.state.height,"px")}}},{key:"setUpdate",value:function(t){this.updater=t}},{key:"pause",value:function(){this.state.paused=!0,this.events.emit(t.EventTypes["event:aspectRatio.pause"])}},{key:"resume",value:function(){this.state.paused=!1,this.events.emit(t.EventTypes["event:aspectRatio.resume"])}},{key:"onUpdate",value:function(e){var n=this;return this.events.on(t.EventTypes["event:aspectRatio.update"],e),function(){n.events.off(t.EventTypes["event:aspectRatio.update"],e)}}},{key:"triggerUpdate",value:function(){this.updater&&this.updater()}}])}();ju.EventTypes={"event:aspectRatio.update":"event:aspectRatio.update","event:aspectRatio.pause":"event:aspectRatio.pause","event:aspectRatio.resume":"event:aspectRatio.resume"};var Cu=(0,ku.createContext)(null);function Iu(t){var e=t.children,n=Au((0,ku.useState)(new ju),1)[0];return xu().createElement(Cu.Provider,{value:{ratio:n}},e)}function Lu(){var t=(0,ku.useContext)(Cu);if(!Cu||!t)throw new Error("useRatio must be used within a RatioProvider");var e=Au((0,ku.useReducer)((function(t){return t+1}),0),2)[1],n=t.ratio;return(0,ku.useEffect)((function(){return n.onUpdate((function(){e()}))}),[]),t}function Mu(t){var e=t.children,n=t.className,r=Lu().ratio,o=r.getStyle();return xu().createElement("div",{className:Su("inset-0 flex items-center justify-center",n),style:{width:"100%",height:"100%",minWidth:"".concat(r.state.minWidth,"px"),minHeight:"".concat(r.state.minHeight,"px")}},xu().createElement("div",{style:Object.assign(Object.assign({},o),{position:"relative"})},e))}function Nu(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 Ru(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)?Ru(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 Ru(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}const Fu=function(t){var e=t.text,n=t.speed,r=t.onComplete,o=t.className,i=Nu((0,ku.useState)(""),2),a=i[0],s=i[1],u=Nu((0,ku.useState)(0),2),c=u[0],l=u[1];return(0,ku.useEffect)((function(){if(c<e.length){if(" "!==e[c]){var t=setTimeout((function(){s((function(t){return t+e[c]})),l((function(t){return t+1}))}),n);return function(){return clearTimeout(t)}}s((function(t){return t+" "})),l((function(t){return t+1}))}else r&&r()}),[c,e,n,r]),xu().createElement("span",{className:o},a)};function Vu(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 Du(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)?Du(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 Du(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 Bu=xu().createContext(null);function Gu(t){var e=t.children,n=t.game,r=new tc({}),o=Vu((0,ku.useState)(n||r),2),i=o[0],a=o[1];return xu().createElement(Bu.Provider,{value:{game:i,setGame:a}},e)}function Hu(){var t=(0,ku.useContext)(Bu);if(!t)throw new Error("useGame must be used within a GameProvider");return t}function $u(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Uu(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Uu(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Uu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function zu(t){var e,n=t.action,r=t.onClick,o=t.useTypeEffect,i=void 0===o||o,a=t.className,s=t.state,u=n.sentence,c=n.character,l=$u((0,ku.useState)(0),2),f=l[0],p=l[1],d=$u((0,ku.useState)(!1),2),h=d[0],y=d[1],m=Hu().game,g=function(){p((function(t){return t+1})),f===u.text.length-1&&y(!0)};return(0,ku.useEffect)((function(){if(window){var t=function(t){m.config.elements.say.nextKey.includes(t.key)&&(h?r&&r():y(!0))};return window.addEventListener("keyup",t),function(){window.removeEventListener("keyup",t)}}console.warn("Failed to add event listener, window is not available\nat Say.tsx: onElementClick")}),[h]),(0,ku.useEffect)((function(){var t=s.events.onEvents([{type:wu.EventTypes["event:state.player.skip"],listener:s.events.on(wu.EventTypes["event:state.player.skip"],(function(){s.logger.log("NarraLeaf-React: Say","Skipped"),y(!0),r&&r()}))}]);return function(){t.cancel()}})),xu().createElement(Mu,{className:"absolute"},u.state.display&&(c&&c.config.mode!==Ca.Modes.adv?xu().createElement(xu().Fragment,null," "):xu().createElement("div",{className:Su("absolute flex items-center justify-center bottom-0 w-[calc(100%-40px)] h-[calc(33%-40px)] m-4 bg-white",m.config.elementStyles.say.container,a),onClick:function(){h?r&&r():y(!0)}},xu().createElement("div",{className:Su("absolute top-0 left-0 p-1.25 rounded-br-md m-4",m.config.elementStyles.say.nameText)},(null===(e=u.character)||void 0===e?void 0:e.name)||""),xu().createElement("div",{className:Su("text-center max-w-[80%] mx-auto",m.config.elementStyles.say.textContainer)},u.text.map((function(t,e){var n=t.config.color||u.config.color||ja.defaultColor;return h?xu().createElement("span",{key:e,style:{color:"string"==typeof n?n:v(n)},className:Su(m.config.elementStyles.say.textSpan)},t.text):e>f?null:xu().createElement("span",{key:e,style:{color:v(n)},className:Su(m.config.elementStyles.say.textSpan)},i?xu().createElement(Fu,{text:t.text,onComplete:e===f?g:void 0,speed:m.config.elements.say.textInterval,className:Su(m.config.elementStyles.say.textSpan)}):t.text)}))))))}function Wu(t){var e=t.sentence,n=t.className;return xu().createElement(xu().Fragment,null,e.text.map((function(t,r){var o=t.config.color||e.config.color||ja.defaultColor;return xu().createElement("span",{key:r,style:{color:v(o)},className:n},t.text)})))}var qu,Yu={say:zu,menu:function(t){var e=t.prompt,n=t.choices,r=t.afterChoose,o=t.state,i=Hu().game,a=i.config.elements.say.use;return xu().createElement(xu().Fragment,null,xu().createElement(Mu,{className:"absolute"},xu().createElement("div",{className:"absolute flex flex-col items-center justify-center min-w-full w-full h-full"},e&&xu().createElement(a,{state:o,action:{sentence:e,character:null},useTypeEffect:!1,className:"z-10"}))),xu().createElement(Mu,{className:"absolute"},xu().createElement("div",{className:Su("absolute flex flex-col items-center justify-center min-w-full w-full h-full",i.config.elementStyles.menu.container)},xu().createElement("div",{className:"p-4 rounded-lg w-full z-20"},xu().createElement("div",{className:"flex flex-col items-center mt-4 w-full"},n.map((function(t,e){return xu().createElement("button",{key:e,className:Su("bg-white text-black p-2 mt-2 w-1/2",i.config.elementStyles.menu.choiceButton),onClick:function(){return function(t){r(t)}(t)}},xu().createElement(Wu,{key:e,sentence:t.prompt,className:Su(i.config.elementStyles.menu.choiceButtonText)}))})))))))}};function Xu(t){return Xu="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},Xu(t)}function Ku(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Zu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ju(r.key),r)}}function Qu(t,e,n){return e&&Zu(t.prototype,e),n&&Zu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ju(t){var e=function(t,e){if("object"!=Xu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Xu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Xu(e)?e:e+""}!function(t){t.game="game"}(qu||(qu={}));var tc=function(){return Qu((function t(e){Ku(this,t),this.liveGame=null,this.config=d(t.DefaultConfig,e)}),[{key:"useComponent",value:function(t,e){if(!Object.keys(Yu).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 ec(this)}}])}();tc.defaultSettings={volume:1},tc.ComponentTypes={say:"say",menu:"menu"},tc.DefaultConfig={player:{contentContainerId:"__narraleaf_content",aspectRatio:16/9,minWidth:800,minHeight:450,width:"100%",height:"100%",skipKey:["Control"],skipInterval:100},elements:{say:{nextKey:[" "],textInterval:50,use:Yu.say},img:{slowLoadWarning:!0,slowLoadThreshold:2e3},menu:{use:Yu.menu}},elementStyles:{say:{container:"",nameText:"",textContainer:"",textSpan:""},menu:{container:"",choiceButton:"",choiceButtonText:""}},app:{debug:!1,logger:{log:!1,info:!1,warn:!0,error:!0,debug:!1,trace:!1}}},tc.GameSettingsNamespace=qu;var ec=function(){function t(e){Ku(this,t),this.currentSavedGame=null,this.story=null,this.lockedAwaiting=null,this._lockedCount=0,this.currentAction=null,this.game=e,this.storable=new du,this.initNamespaces()}return Qu(t,[{key:"initNamespaces",value:function(){return this.storable.clear().addNamespace(new pu(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:"newGame",value:function(t){var e,n,r,o=t.gameState;this.reset({gameState:o}),this.initNamespaces();var i=this.getNewSavedGame();i.name="NewGame-"+Date.now(),this.currentSavedGame=i;var a=null===(e=this.story)||void 0===e?void 0:e.getAllElementMap((null===(r=null===(n=this.story)||void 0===n?void 0:n.entryScene)||void 0===r?void 0:r.sceneRoot)||[]);return a&&Object.values(a).forEach((function(t){t.reset()})),o.stage.forceUpdate(),o.stage.next(),this}},{key:"deserialize",value:function(t,e){var n,r=e.gameState,o=this.story;if(!o)throw new Error("No story loaded");this.reset({gameState:r});var i=new Map,a=new Map,s=t.game,u=s.store,c=s.stage,l=s.elementStates,f=s.currentAction;if(o.forEachChild((null===(n=o.entryScene)||void 0===n?void 0:n.sceneRoot)||[],(function(t){i.set(t.getId(),t),a.set(t.callee.getId(),t.callee)})),this.storable.load(u),l.forEach((function(t){var e=t.id,n=t.data,r=a.get(e);if(!r)throw new Error("Element not found, id: "+e+"\nNarraLeaf cannot find the element with the id from the saved game");r.fromData(n)})),this.currentSavedGame=t,r.loadData(c,a),f){var p=i.get(f);if(!p)throw new Error("Action not found, id: "+f+"\nNarraLeaf cannot find the action with the id from the saved game");this.currentAction=p}}},{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(),r.stage.update()}},{key:"serialize",value:function(t){var e,n,r,o=t.gameState,i=this.story;if(!i)throw new Error("No story loaded");var a=this.storable.toData(),s=o.toData(),u=(null===(e=this.getCurrentAction())||void 0===e?void 0:e.getId())||null,c=i.getAllElementStates();return{name:(null===(n=this.currentSavedGame)||void 0===n?void 0:n.name)||"",meta:{created:(null===(r=this.currentSavedGame)||void 0===r?void 0:r.meta.created)||Date.now(),updated:Date.now()},game:{store:a,stage:s,currentAction:u,elementStates:c}}}},{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,r;if(!this.story)throw new Error("No story loaded");if(this.lockedAwaiting){if(!this.lockedAwaiting.solved){if(this._lockedCount++,this._lockedCount>1e3)throw new Error("Locked awaiting");return this.lockedAwaiting}var o=this.lockedAwaiting.result;return this.currentAction=(null===(e=null==o?void 0:o.node)||void 0===e?void 0:e.action)||null,t.logger.debug("next action",o),this.lockedAwaiting=null,o||null}if(!this.currentAction)return t.events.emit(wu.EventTypes["event:state.end"]),t.logger.warn("LiveGame","No current action"),null;var i=this.currentAction.executeAction(t);return h.isAwaitable(i)?(this.lockedAwaiting=i,i):(t.logger.debug("next action",i),this._lockedCount=0,this.currentAction=(null===(r=null===(n=i.node)||void 0===n?void 0:n.getChild())||void 0===r?void 0:r.action)||null,i)}},{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,o=e.executeAction(t);return h.isAwaitable(o)?o:(null===(r=null===(n=null==o?void 0:o.node)||void 0===n?void 0:n.getChild())||void 0===r?void 0:r.action)||null}},{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}}}}])}();ec.DefaultNamespaces={game:{}},ec.GameSpacesKey={game:"game"};var nc=o(72),rc=o.n(nc),oc=o(825),ic=o.n(oc),ac=o(659),sc=o.n(ac),uc=o(56),cc=o.n(uc),lc=o(540),fc=o.n(lc),pc=o(113),dc=o.n(pc),hc=o(587),yc={};yc.styleTagTransform=dc(),yc.setAttributes=cc(),yc.insert=sc().bind(null,"head"),yc.domAPI=ic(),yc.insertStyleElement=fc();rc()(hc.A,yc);hc.A&&hc.A.locals&&hc.A.locals;var vc=o(848);const mc=(0,ku.createContext)({strict:!1});function gc(t){for(const e in t)vo[e]={...vo[e],...t[e]}}function bc({children:t,features:e,strict:n=!1}){const[,r]=(0,ku.useState)(!wc(e)),o=(0,ku.useRef)(void 0);if(!wc(e)){const{renderer:t,...n}=e;o.current=t,gc(n)}return(0,ku.useEffect)((()=>{wc(e)&&e().then((({renderer:t,...e})=>{gc(e),o.current=t,r(!0)}))}),[]),(0,vc.jsx)(mc.Provider,{value:{renderer:o.current,strict:n},children:t})}function wc(t){return"function"==typeof t}function _c(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 Sc(t,e,n={}){var r;const o=Ur(t,e,"exit"===n.type?null===(r=t.presenceContext)||void 0===r?void 0:r.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=o||{};n.transitionOverride&&(i=n.transitionOverride);const a=o?()=>Promise.all(to(t,o,n)):()=>Promise.resolve(),s=t.variantChildren&&t.variantChildren.size?(r=0)=>{const{delayChildren:o=0,staggerChildren:a,staggerDirection:s}=i;return function(t,e,n=0,r=0,o=1,i){const a=[],s=(t.variantChildren.size-1)*r,u=1===o?(t=0)=>t*r:(t=0)=>s-t*r;return Array.from(t.variantChildren).sort(kc).forEach(((t,r)=>{t.notify("AnimationStart",e),a.push(Sc(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 kc(t,e){return t.sortNodePosition(e)}const xc=[...lo].reverse(),Ac=lo.length;function Tc(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=>Sc(t,e,n)));r=Promise.all(o)}else if("string"==typeof e)r=Sc(t,e,n);else{const o="function"==typeof e?Ur(t,e,n.custom):e;r=Promise.all(to(t,o,n))}return r.then((()=>{t.notify("AnimationComplete",e)}))}(t,e,n))))}function Ec(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!_c(e,t)}function Oc(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Pc(){return{animate:Oc(!0),whileInView:Oc(),whileHover:Oc(),whileTap:Oc(),whileDrag:Oc(),whileFocus:Oc(),exit:Oc()}}class jc{constructor(t){this.isMounted=!1,this.node=t}update(){}}let Cc=0;const Ic={animation:{Feature:class extends jc{constructor(t){super(t),t.animationState||(t.animationState=function(t){let e=Tc(t),n=Pc(),r=!0;const o=e=>(n,r)=>{var o;const i=Ur(t,r,"exit"===e?null===(o=t.presenceContext)||void 0===o?void 0:o.custom:void 0);if(i){const{transition:t,transitionEnd:e,...r}=i;n={...n,...r,...e}}return n};function i(i){const a=t.getProps(),s=t.getVariantContext(!0)||{},u=[],c=new Set;let l={},f=1/0;for(let e=0;e<Ac;e++){const p=xc[e],d=n[p],h=void 0!==a[p]?a[p]:s[p],y=co(h),v=p===i?d.isActive:null;!1===v&&(f=e);let m=h===s[p]&&h!==a[p]&&y;if(m&&r&&t.manuallyAnimateOnMount&&(m=!1),d.protectedKeys={...l},!d.isActive&&null===v||!h&&!d.prevProp||uo(h)||"boolean"==typeof h)continue;let g=Ec(d.prevProp,h)||p===i&&d.isActive&&!m&&y||e>f&&y,b=!1;const w=Array.isArray(h)?h:[h];let _=w.reduce(o(p),{});!1===v&&(_={});const{prevResolvedValues:S={}}=d,k={...S,..._},x=e=>{g=!0,c.has(e)&&(b=!0,c.delete(e)),d.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in k){const e=_[t],n=S[t];if(l.hasOwnProperty(t))continue;let r=!1;r=Lr(e)&&Lr(n)?!_c(e,n):e!==n,r?null!=e?x(t):c.add(t):void 0!==e&&c.has(t)?x(t):d.protectedKeys[t]=!0}d.prevProp=h,d.prevResolvedValues=_,d.isActive&&(l={...l,..._}),r&&t.blockInitialAnimation&&(g=!1),!g||m&&!b||u.push(...w.map((t=>({animation:t,options:{type:p}}))))}if(c.size){const e={};c.forEach((n=>{const r=t.getBaseTarget(n),o=t.getValue(n);o&&(o.liveStyle=!0),e[n]=null!=r?r:null})),u.push({animation:e})}let p=Boolean(u.length);return!r||!1!==a.initial&&a.initial!==a.animate||t.manuallyAnimateOnMount||(p=!1),r=!1,p?e(u):Promise.resolve()}return{animateChanges:i,setActive:function(e,r){var o;if(n[e].isActive===r)return Promise.resolve();null===(o=t.variantChildren)||void 0===o||o.forEach((t=>{var n;return null===(n=t.animationState)||void 0===n?void 0:n.setActive(e,r)})),n[e].isActive=r;const a=i(e);for(const t in n)n[t].protectedKeys={};return a},setAnimateFunction:function(n){e=n(t)},getState:()=>n,reset:()=>{n=Pc(),r=!0}}}(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();uo(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:e}=this.node.prevProps||{};t!==e&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),null===(t=this.unmountControls)||void 0===t||t.call(this)}}},exit:{Feature:class extends jc{constructor(){super(...arguments),this.id=Cc++}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 Lc(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function Mc(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const Nc=t=>e=>(t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary)(e)&&t(e,Mc(e));function Rc(t,e,n,r){return Lc(t,e,Nc(n),r)}function Fc(t){let e=null;return()=>{const n=()=>{e=null};return null===e&&(e=t,n)}}const Vc=Fc("dragHorizontal"),Dc=Fc("dragVertical");function Bc(){const t=function(t){let e=!1;if("y"===t)e=Dc();else if("x"===t)e=Vc();else{const t=Vc(),n=Dc();t&&n?e=()=>{t(),n()}:(t&&t(),n&&n())}return e}(!0);return!t||(t(),!1)}function Gc(t,e){const n=e?"pointerenter":"pointerleave",r=e?"onHoverStart":"onHoverEnd";return Rc(t.current,n,((n,o)=>{if("touch"===n.pointerType||Bc())return;const i=t.getProps();t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",e);const a=i[r];a&&jt.postRender((()=>a(n,o)))}),{passive:!t.getProps()[r]})}const Hc=(t,e)=>!!e&&(t===e||Hc(t,e.parentElement));function $c(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,Mc(n))}const Uc=new WeakMap,zc=new WeakMap,Wc=t=>{const e=Uc.get(t.target);e&&e(t)},qc=t=>{t.forEach(Wc)};function Yc(t,e,n){const r=function({root:t,...e}){const n=t||document;zc.has(n)||zc.set(n,{});const r=zc.get(n),o=JSON.stringify(e);return r[o]||(r[o]=new IntersectionObserver(qc,{root:t,...e})),r[o]}(e);return Uc.set(t,n),r.observe(t),()=>{Uc.delete(t),r.unobserve(t)}}const Xc={some:0,all:1};const Kc={inView:{Feature:class extends jc{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:Xc[r]};return Yc(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 jc{constructor(){super(...arguments),this.removeStartListeners=_t,this.removeEndListeners=_t,this.removeAccessibleListeners=_t,this.startPointerPress=(t,e)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),r=Rc(window,"pointerup",((t,e)=>{if(!this.checkPressEnd())return;const{onTap:n,onTapCancel:r,globalTapTarget:o}=this.node.getProps(),i=o||Hc(this.node.current,t.target)?n:r;i&&jt.update((()=>i(t,e)))}),{passive:!(n.onTap||n.onPointerUp)}),o=Rc(window,"pointercancel",((t,e)=>this.cancelPress(t,e)),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=Zn(r,o),this.startPress(t,e)},this.startAccessiblePress=()=>{const t=Lc(this.node.current,"keydown",(t=>{if("Enter"!==t.key||this.isPressing)return;this.removeEndListeners(),this.removeEndListeners=Lc(this.node.current,"keyup",(t=>{"Enter"===t.key&&this.checkPressEnd()&&$c("up",((t,e)=>{const{onTap:n}=this.node.getProps();n&&jt.postRender((()=>n(t,e)))}))})),$c("down",((t,e)=>{this.startPress(t,e)}))})),e=Lc(this.node.current,"blur",(()=>{this.isPressing&&$c("cancel",((t,e)=>this.cancelPress(t,e)))}));this.removeAccessibleListeners=Zn(t,e)}}startPress(t,e){this.isPressing=!0;const{onTapStart:n,whileTap:r}=this.node.getProps();r&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&jt.postRender((()=>n(t,e)))}checkPressEnd(){this.removeEndListeners(),this.isPressing=!1;return this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!Bc()}cancelPress(t,e){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&jt.postRender((()=>n(t,e)))}mount(){const t=this.node.getProps(),e=Rc(t.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),n=Lc(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Zn(e,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}},focus:{Feature:class extends jc{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch(e){t=!0}t&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Zn(Lc(this.node.current,"focus",(()=>this.onFocus())),Lc(this.node.current,"blur",(()=>this.onBlur())))}unmount(){}}},hover:{Feature:class extends jc{mount(){this.unmount=Zn(Gc(this.node,!0),Gc(this.node,!1))}unmount(){}}}},Zc=["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 Qc(t){return"string"==typeof t&&!t.includes("-")&&!!(Zc.indexOf(t)>-1||/[A-Z]/u.test(t))}const Jc={renderer:(t,e)=>Qc(t)?new No(e):new Fo(e,{allowProjection:t!==ku.Fragment}),...Ic,...Kc};function tl(t){var e=t.children;return xu().createElement(bc,{features:Jc,strict:!0},e)}function el(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 nl(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)?nl(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 nl(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 rl(t){var e=t.children,n=t.className,r=el((0,ku.useState)({}),2),o=r[0],i=r[1],a=Lu().ratio,s=Hu().game,u=el((0,ku.useReducer)((function(t){return t+1}),0),2)[1],c=s.config.player.minWidth,l=s.config.player.minHeight;return(0,ku.useEffect)((function(){var t,e=function(){if(a.isLocked())console.warn("Ratio is locked, skipping update");else{var t=document.getElementById(s.config.player.contentContainerId);if(t){var e,n,r=t.clientWidth,o=t.clientHeight,f=s.config.player.aspectRatio;r/o>f?(e=o*f,n=o):(e=r,n=r/f),e<c&&(e=c),n<l&&(n=l),i({width:"".concat(e,"px"),height:"".concat(n,"px"),margin:"auto",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",display:"flex",alignItems:"center",justifyContent:"center"}),a.update(e,n),a.updateMin(c,l),u()}}};a.setUpdate(e);var n=function(){e(),clearTimeout(t),a.pause(),t=setTimeout((function(){a.resume()}),100)};return e(),window.addEventListener("resize",n),function(){window.removeEventListener("resize",n),clearTimeout(t)}}),[a]),xu().createElement("div",{id:s.config.player.contentContainerId,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"}},xu().createElement("div",{className:Su(n),style:o},e))}var ol={start:"start",update:"update",end:"end"};function il(t){var e=t.children,n=Lu().ratio,r=Hu().game,o=(0,ku.useRef)(null);return(0,ku.useEffect)((function(){if(!o.current)throw new Error("Content container not found")}),[r.config.player.contentContainerId]),xu().createElement(xu().Fragment,null,xu().createElement("div",{ref:o,className:Su("absolute inset-0 flex items-center justify-center bg-cover bg-center overflow-hidden"),style:Object.assign({},n.getStyle())},e))}function al(t){return al="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},al(t)}function sl(){return sl=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},sl.apply(null,arguments)}function ul(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ul=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",d="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==al(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function T(e,n,r){var o=p;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:d,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(al(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function cl(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 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}}(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 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}var fl=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 pl(t){var e=this,n=t.scene,r=t.props,o=t.state,i=(0,ku.useRef)(null),a=Hu().game,s=cl((0,ku.useState)(null),2),u=s[0],c=s[1],l=cl((0,ku.useState)([]),2)[1],f=cl((0,ku.useState)(null),2),p=f[0],h=f[1],y=cl((0,ku.useState)({}),2),v=y[0],m=y[1];function g(){n.events.emit(Gs.EventTypes["event:scene.imageLoaded"])}function b(t){if(p&&p.getControl()&&(console.warn("processing transform not completed"),p.getControl().complete(),p.setControl(null)),!i.current)throw new Error("scope not ready");t instanceof hi?Object.assign(i.current.style,t.propToCSS(o,n.backgroundImageState)):Object.assign(i.current.style,t)}(0,ku.useEffect)((function(){var t=n.events.onEvents([{type:Gs.EventTypes["event:scene.applyTransition"],listener:n.events.on(Gs.EventTypes["event:scene.applyTransition"],(function(t){return c(t),t?new Promise((function(e){var n=t.events.onEvents([{type:ol.update,listener:t.events.on(ol.update,(function(t){l(t)}))},{type:ol.end,listener:t.events.on(ol.end,(function(){c(null),e(),o.logger.debug("transition end",t)}))},{type:ol.start,listener:t.events.on(ol.start,(function(){o.logger.debug("transition start",t)}))}]);t.start((function(){n.cancel(),e()}))})):(o.logger.warn("transition not set"),Promise.resolve())}))},{type:Gs.EventTypes["event:scene.applyTransform"],listener:n.events.on(Gs.EventTypes["event:scene.applyTransform"],(function(t){return fl(e,void 0,void 0,ul().mark((function e(){return ul().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return b(t.propToCSS(o,n.backgroundImageState)),h(t),e.next=4,t.animate({scope:i},o,n.backgroundImageState,(function(e){n.backgroundImageState=d(n.backgroundImageState,e),m({style:t.propToCSS(o,n.backgroundImageState)}),h(null)}));case 4:case"end":return e.stop()}}),e)})))}))},{type:Gs.EventTypes["event:scene.initTransform"],listener:n.events.on(Gs.EventTypes["event:scene.initTransform"],(function(t){return fl(e,void 0,void 0,ul().mark((function e(){return ul().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o.logger.debug("init transform",t),e.next=3,t.animate({scope:i},o,n.backgroundImageState,(function(t){n.backgroundImageState=d(n.backgroundImageState,t)}));case 3:case"end":return e.stop()}}),e)})))}))}]);return function(){t.cancel()}}),[n]),(0,ku.useEffect)((function(){b(n.backgroundImageState)}),[]),(0,ku.useEffect)((function(){var t=o.events.onEvents([{type:wu.EventTypes["event:state.player.skip"],listener:o.events.on(wu.EventTypes["event:state.player.skip"],(function(){p&&p.getControl()&&(p.getControl().complete(),p.setControl(null))}))}]);return function(){t.cancel()}}),[p]);var w,_="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",S={src:_,style:Object.assign({opacity:0},a.config.app.debug?{border:"1px solid red"}:{})};return xu().createElement("div",null,u?u.toElementProps().map((function(t,e,n){var o=d(S,r,v,t);return xu().createElement(il,{key:e},xu().createElement("img",sl({alt:o.alt},o,{onLoad:g,src:o.src||_,ref:e===n.length-1?i:void 0,className:"absolute"})))})):(w=d(S,r,{style:new hi([]).propToCSS(o,n.backgroundImageState)},v),xu().createElement(il,null,xu().createElement("img",sl({alt:w.alt},w,{onLoad:g,ref:i,src:w.src||_,className:"absolute"})))))}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 hl(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */hl=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",d="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==dl(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function T(e,n,r){var o=p;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:d,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(dl(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function 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 vl(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)?vl(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 vl(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 ml=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 gl(t){var e=t.scene,n=t.state,r=t.children,o=t.className,i=Lu().ratio,a=yl((0,ku.useState)((function(){return e.state.backgroundMusic})),2),s=a[0],u=a[1],c=yl((0,ku.useState)(null),2),l=c[0],f=c[1],p=yl((0,ku.useState)(null),2),d=p[0],h=p[1];function y(t,e){return ml(this,void 0,void 0,hl().mark((function n(){var r;return hl().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(t.$getHowl()&&t.$getHowl().playing(t.$getToken())){n.next=2;break}return n.abrupt("return",Promise.resolve());case 2:return r=t.$getHowl().volume(t.$getToken()),n.next=5,new Promise((function(n){t.$getHowl().fade(r,0,e,t.$getToken()),h((function(){return n})),f(setTimeout((function(){t.$getHowl().stop(),t.$getHowl().volume(r),t.$setToken(null),n(),h(null)}),e))}));case 5:return n.abrupt("return",n.sent);case 6:case"end":return n.stop()}}),n)})))}return(0,ku.useEffect)((function(){var t=[{type:"event:scene.setBackgroundMusic",listener:e.events.on(Gs.EventTypes["event:scene.setBackgroundMusic"],(function(t,e){(function(t,e){var n,r,o,i,a,c;return ml(this,void 0,void 0,hl().mark((function p(){var v,m;return hl().wrap((function(p){for(;;)switch(p.prev=p.next){case 0:if(l&&(clearTimeout(l),f(null),d&&(d(),h(null))),m=t,!(v=s)){p.next=12;break}if(!e){p.next=9;break}return p.next=7,y(v,e);case 7:p.next=12;break;case 9:null===(n=v.$getHowl())||void 0===n||n.stop(),null===(r=v.$getHowl())||void 0===r||r.volume(0),v.$setToken(null);case 12:if(m){p.next=14;break}return p.abrupt("return");case 14:null===(o=m.$getHowl())||void 0===o||o.volume(0),m.$setToken(null===(i=m.$getHowl())||void 0===i?void 0:i.play(m.$getToken()||void 0)),e?null===(a=m.$getHowl())||void 0===a||a.fade(0,m.config.volume,e,m.$getToken()):null===(c=m.$getHowl())||void 0===c||c.volume(m.config.volume,m.$getToken()),u(m);case 18:case"end":return p.stop()}}),p)})))})(t,e).then()}))},{type:"event:scene.preUnmount",listener:e.events.on(Gs.EventTypes["event:scene.preUnmount"],(function(){l&&(clearTimeout(l),d&&d()),s&&y(s,e.state.backgroundMusicFade).then()}))}];return function(){t.forEach((function(t){var n=t.type,r=t.listener;e.events.off(n,r)}))}}),[]),(0,ku.useEffect)((function(){return e.events.emit(Gs.EventTypes["event:scene.mount"]),function(){e.events.emit(Gs.EventTypes["event:scene.unmount"])}}),[]),xu().createElement("div",{className:o},xu().createElement(pl,{scene:e,props:{width:i.state.width,height:i.state.height,src:va.backgroundToSrc(e.state.background)},state:n}),r)}function bl(t){if("undefined"==typeof Proxy)return t;const e=new Map;return new Proxy(((...e)=>t(...e)),{get:(n,r)=>"create"===r?t:(e.has(r)||e.set(r,t(r)),e.get(r))})}const wl=(0,ku.createContext)({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),_l=(0,ku.createContext)({}),Sl=(0,ku.createContext)(null),kl=io?ku.useLayoutEffect:ku.useEffect,{schedule:xl,cancel:Al}=Pt(queueMicrotask,!1);function Tl(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}const El=(0,ku.createContext)({});let Ol=!1;function Pl(t,e,n,r,o){var i;const{visualElement:a}=(0,ku.useContext)(_l),s=(0,ku.useContext)(mc),u=(0,ku.useContext)(Sl),c=(0,ku.useContext)(wl).reducedMotion,l=(0,ku.useRef)();r=r||s.renderer,!l.current&&r&&(l.current=r(t,{visualState:e,parent:a,props:n,presenceContext:u,blockInitialAnimation:!!u&&!1===u.initial,reducedMotionConfig:c}));const f=l.current,p=(0,ku.useContext)(El);!f||f.projection||!o||"html"!==f.type&&"svg"!==f.type||function(t,e,n,r){const{layoutId:o,layout:i,drag:a,dragConstraints:s,layoutScroll:u,layoutRoot:c}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Cl(t.parent)),t.projection.setOptions({layoutId:o,layout:i,alwaysMeasureLayout:Boolean(a)||s&&Tl(s),visualElement:t,animationType:"string"==typeof i?i:"both",initialPromotionConfig:r,layoutScroll:u,layoutRoot:c})}(l.current,n,o,p),(0,ku.useInsertionEffect)((()=>{f&&f.update(n,u)}));const d=n[qr],h=(0,ku.useRef)(Boolean(d)&&!window.MotionHandoffIsComplete&&(null===(i=window.MotionHasOptimisedAnimation)||void 0===i?void 0:i.call(window,d)));return kl((()=>{f&&(f.updateFeatures(),xl.render(f.render),h.current&&f.animationState&&f.animationState.animateChanges())})),(0,ku.useEffect)((()=>{f&&(!h.current&&f.animationState&&f.animationState.animateChanges(),h.current=!1,Ol||(Ol=!0,queueMicrotask(jl)))})),f}function jl(){window.MotionHandoffIsComplete=!0}function Cl(t){if(t)return!1!==t.options.allowProjection?t.projection:Cl(t.parent)}function Il(t,e,n){return(0,ku.useCallback)((r=>{r&&t.mount&&t.mount(r),e&&(r?e.mount(r):e.unmount()),n&&("function"==typeof n?n(r):Tl(n)&&(n.current=r))}),[e])}function Ll(t){const{initial:e,animate:n}=function(t,e){if(po(t)){const{initial:e,animate:n}=t;return{initial:!1===e||co(e)?e:void 0,animate:co(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,(0,ku.useContext)(_l));return(0,ku.useMemo)((()=>({initial:e,animate:n})),[Ml(e),Ml(n)])}function Ml(t){return Array.isArray(t)?t.join(" "):t}const Nl=(0,ku.createContext)({}),Rl=Symbol.for("motionComponentSymbol");function Fl({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:r,Component:o}){t&&gc(t);const i=(0,ku.forwardRef)((function(t,i){let a;const s={...(0,ku.useContext)(wl),...t,layoutId:Vl(t)},{isStatic:u}=s,c=Ll(t),l=r(t,u);if(!u&&io){!function(){(0,ku.useContext)(mc).strict;0}();const t=function(t){const{drag:e,layout:n}=vo;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:(null==e?void 0:e.isEnabled(t))||(null==n?void 0:n.isEnabled(t))?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}(s);a=t.MeasureLayout,c.visualElement=Pl(o,l,s,e,t.ProjectionNode)}return(0,vc.jsxs)(_l.Provider,{value:c,children:[a&&c.visualElement?(0,vc.jsx)(a,{visualElement:c.visualElement,...s}):null,n(o,t,Il(l,c.visualElement,i),l,u,c.visualElement)]})}));return i[Rl]=o,i}function Vl({layoutId:t}){const e=(0,ku.useContext)(Nl).id;return e&&void 0!==t?e+"-"+t:t}function Dl(t){const e=Zr(t)?t.get():t;return Mr(e)?e.toValue():e}const Bl=t=>(e,n)=>{const r=(0,ku.useContext)(_l),o=(0,ku.useContext)(Sl),i=()=>function({applyWillChange:t=!1,scrapeMotionValuesFromProps:e,createRenderState:n,onMount:r},o,i,a,s){const u={latestValues:$l(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,ku.useRef)(null);return null===e.current&&(e.current=t()),e.current}(i)};function Gl(t,e){const n=Xr(e);n&&Rr(t,n)}function Hl(t,e,n){const r=Array.isArray(e)?e:[e];for(let e=0;e<r.length;e++){const o=$r(t,r[e]);if(o){const{transitionEnd:t,transition:e,...r}=o;n(r,t)}}}function $l(t,e,n,r,o){var i;const a={},s=[],u=r&&void 0===(null===(i=t.style)||void 0===i?void 0:i.willChange),c=o(t,{});for(const t in c)a[t]=Dl(c[t]);let{initial:l,animate:f}=t;const p=po(t),d=ho(t);e&&d&&!p&&!1!==t.inherit&&(void 0===l&&(l=e.initial),void 0===f&&(f=e.animate));let h=!!n&&!1===n.initial;h=h||!1===l;const y=h?f:l;return y&&"boolean"!=typeof y&&!uo(y)&&Hl(t,y,((t,e)=>{for(const e in t){let n=t[e];if(Array.isArray(n)){n=n[h?n.length-1:0]}null!==n&&(a[e]=n)}for(const t in e)a[t]=e[t]})),u&&(f&&!1!==l&&!uo(f)&&Hl(t,f,(t=>{for(const e in t)Gl(s,e)})),s.length&&(a.willChange=s.join(","))),a}const Ul=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),zl=()=>({...Ul(),attrs:{}}),Wl={useVisualState:Bl({scrapeMotionValuesFromProps:oo,createRenderState:zl,onMount:(t,e,{renderState:n,latestValues:r})=>{jt.read((()=>{try{n.dimensions="function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch(t){n.dimensions={x:0,y:0,width:0,height:0}}})),jt.render((()=>{jo(n,r,Mo(e.tagName),t.transformTemplate),Lo(e,n)}))}})},ql={useVisualState:Bl({applyWillChange:!0,scrapeMotionValuesFromProps:ro,createRenderState:Ul})};function Yl(t,e,n){for(const r in e)Zr(e[r])||no(r,n)||(t[r]=e[r])}function Xl(t,e){const n={};return Yl(n,t.style||{},t),Object.assign(n,function({transformTemplate:t},e){return(0,ku.useMemo)((()=>{const n=Ul();return To(n,e,t),Object.assign({},n.vars,n.style)}),[e])}(t,e)),n}function Kl(t,e){const n={},r=Xl(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 Zl=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 Ql(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Zl.has(t)}let Jl=t=>!Ql(t);try{(tf=require("@emotion/is-prop-valid").default)&&(Jl=t=>t.startsWith("on")?!Ql(t):tf(t))}catch(V){}var tf;function ef(t,e,n,r){const o=(0,ku.useMemo)((()=>{const n=zl();return jo(n,e,Mo(r),t.transformTemplate),{...n.attrs,style:{...n.style}}}),[e]);if(t.style){const e={};Yl(e,t.style,t),o.style={...e,...o.style}}return o}function nf(t=!1){return(e,n,r,{latestValues:o},i)=>{const a=(Qc(e)?ef:Kl)(n,o,i,e),s=function(t,e,n){const r={};for(const o in t)"values"===o&&"object"==typeof t.values||(Jl(o)||!0===n&&Ql(o)||!e&&!Ql(o)||t.draggable&&o.startsWith("onDrag"))&&(r[o]=t[o]);return r}(n,"string"==typeof e,t),u=e!==ku.Fragment?{...s,...a,ref:r}:{},{children:c}=n,l=(0,ku.useMemo)((()=>Zr(c)?c.get():c),[c]);return(0,ku.createElement)(e,{...u,children:l})}}function rf(t,e){return function(n,{forwardMotionProps:r}={forwardMotionProps:!1}){return Fl({...Qc(n)?Wl:ql,preloadedFeatures:t,useRender:nf(r),createVisualElement:e,Component:n})}}const of=bl(rf());function af(t){return af="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},af(t)}function sf(){return sf=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},sf.apply(null,arguments)}function uf(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */uf=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",d="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==af(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function T(e,n,r){var o=p;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:d,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(af(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function cf(t){return function(t){if(Array.isArray(t))return pf(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ff(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 lf(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)||ff(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 ff(t,e){if(t){if("string"==typeof t)return pf(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)?pf(t,e):void 0}}function pf(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 df=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 hf(t){var e=this,n=t.image,r=t.state,o=t.onAnimationEnd,i=(0,ku.useRef)(null),a=lf((0,ku.useState)(null),2),s=a[0],u=a[1],c=lf((0,ku.useState)({style:{}}),2),l=c[0],f=c[1],p=lf((0,ku.useState)(null),2),h=p[0],y=p[1],v=lf((0,ku.useState)([]),2)[1],m=lf((0,ku.useState)(0),2),g=m[0],b=m[1],w=Hu().game;(0,ku.useEffect)((function(){n.setScope(i),n.events.emit(Si.EventTypes["event:image.mount"]);var t=n.events.onEvents([].concat(cf([Si.EventTypes["event:image.show"],Si.EventTypes["event:image.hide"],Si.EventTypes["event:image.applyTransform"]].map((function(t){return{type:t,listener:n.events.on(t,(function(t){return df(e,void 0,void 0,uf().mark((function e(){return uf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return S(t.propToCSS(r,n.state)),u(t),r.logger.debug("transform",t,t.propToCSS(r,n.state)),e.next=5,t.animate({scope:i},r,n.state,(function(e){n.state=d(n.state,e),f({style:t.propToCSS(r,n.state)}),o&&o(),u(null)}));case 5:return e.abrupt("return",!0);case 6:case"end":return e.stop()}}),e)})))}))}}))),[{type:Si.EventTypes["event:image.init"],listener:n.events.on(Si.EventTypes["event:image.init"],(function(){return df(e,void 0,void 0,uf().mark((function t(){return uf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.toTransform().animate({scope:i},r,n.state,(function(t){n.state=d(n.state,t),f({style:n.toTransform().propToCSS(r,n.state)})}));case 2:case"end":return t.stop()}}),t)})))}))}]));return S(n.toTransform().propToCSS(r,n.state)),n.events.emit(Si.EventTypes["event:image.ready"],i),function(){t.cancel(),n.events.emit(Si.EventTypes["event:image.unmount"])}}),[]),(0,ku.useEffect)((function(){var t=n.events.onEvents([{type:Si.EventTypes["event:image.setTransition"],listener:n.events.on(Si.EventTypes["event:image.setTransition"],(function(t){y(t)}))}]);return function(){t.cancel()}}),[h,n]),(0,ku.useEffect)((function(){var t=h?h.events.onEvents([{type:ol.update,listener:h.events.on(ol.update,(function(t){v(t)}))},{type:ol.end,listener:h.events.on(ol.end,(function(){y(null)}))}]):null;return function(){var e;null===(e=null==t?void 0:t.cancel)||void 0===e||e.call(t)}}),[h]),(0,ku.useEffect)((function(){b(performance.now())}),[]),(0,ku.useEffect)((function(){var t=r.events.onEvents([{type:wu.EventTypes["event:state.player.skip"],listener:r.events.on(wu.EventTypes["event:state.player.skip"],(function(){s&&s.getControl()&&(s.getControl().complete(),s.setControl(null),r.logger.debug("transform skip")),h&&h.controller&&(h.controller.complete(),y(null),r.logger.debug("transition skip"))}))}]);return function(){t.cancel()}}),[h,s]);var _=function(){var t=performance.now()-g,e=w.config.elements.img.slowLoadThreshold;t>e&&w.config.elements.img.slowLoadWarning&&r.logger.warn("NarraLeaf-React","Image took ".concat(t,"ms to load, which exceeds the threshold of ").concat(e,"ms. ")+"Consider enable cache for the image, so Preloader can preload it before it's used. To disable this warning, set `elements.img.slowLoadWarning` to false in the game config.")};function S(t){if(s&&s.getControl()&&(console.warn("processing transform not completed"),s.getControl().complete(),s.setControl(null)),!i.current)throw new Error("scope not ready");t instanceof hi?Object.assign(i.current.style,t.propToCSS(r,n.state)):Object.assign(i.current.style,t)}var k={className:"absolute",src:va.staticImageDataToSrc(n.state.src),style:Object.assign({opacity:0},w.config.app.debug?{border:"1px solid red"}:{})};return xu().createElement(Mu,{className:"absolute overflow-hidden"},h?h.toElementProps().map((function(t,e,n){var r=d(k,l,t);return xu().createElement(of.img,sf({key:e,alt:r.alt},r,{ref:e===n.length-1?i:void 0,onLoad:_,layout:!0}))})):xu().createElement(of.img,sf({ref:i,alt:"image"},d(k,l),{onLoad:_})))}function yf(t){return yf="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},yf(t)}function vf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,mf(r.key),r)}}function mf(t){var e=function(t,e){if("object"!=yf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=yf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==yf(e)?e:e+""}var gf=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.preloaded=[],this.events=new m}return function(t,e,n){return e&&vf(t.prototype,e),n&&vf(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?va.srcToString(t.src.state.src):"video"===t.type?t.src:"audio"===t.type?t.src.getSrc():""}}])}();function bf(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 wf(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)?wf(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 wf(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}gf.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 _f=(0,ku.createContext)(null);function Sf(t){var e=t.children,n=bf((0,ku.useState)(new gf),1)[0];return xu().createElement(xu().Fragment,null,xu().createElement(_f.Provider,{value:{preloaded:n}},e))}function kf(){if(!_f)throw new Error("usePreloaded must be used within a PreloadedProvider");return(0,ku.useContext)(_f)}function xf(t){return function(t){if(Array.isArray(t))return Af(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 Af(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)?Af(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 Af(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 Tf(t){var e=t.state,n=t.srcManager,r=kf().preloaded;return(0,ku.useEffect)((function(){var t,o;if("undefined"!=typeof window){var i=null===(t=e.getLastScene())||void 0===t?void 0:t.srcManager,a=(null===(o=e.getLastScene())||void 0===o?void 0:o.srcManager.future)||[],s=[].concat(xf(n.src),xf(i?i.src:[]),xf(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===js.SrcTypes.image?u.image.add(t.src):t.type===js.SrcTypes.audio?u.audio.add(t.src):t.type===js.SrcTypes.video&&u.video.add(t.src)})),e.logger.debug("Preloading",u,a),r.preloaded=r.preloaded.filter((function(t){if(t.type===js.SrcTypes.audio){var e=u[t.type].has(t.src);return e||(e=Array.from(u[t.type]).some((function(e){return r.getSrc(t)===r.getSrc(e.config.src)}))),e}if(t.type===js.SrcTypes.image)return u[t.type].has(t.src);var n=r.getSrc(t);return u[t.type].has(n)}));var c=[];return u.image.forEach((function(t){var n=new Image;n.src=va.srcToString(t.state.src),n.onload=function(){e.logger.debug("Image loaded",t.state.src)},c.push(n),r.add({type:"image",src:t})})),Promise.all([]).then((function(){e.logger.log("Preloaded","Preloaded ".concat(u.image.size," images")),r.events.emit(gf.EventTypes["event:preloaded.ready"])})),u.audio.forEach((function(t){t.$getHowl()||t.$setHowl(new(e.getHowl())({src:t.config.src,loop:t.config.loop,volume:t.config.volume,autoplay:!1,preload:!0}))})),r.events.emit(gf.EventTypes["event:preloaded.mount"]),function(){c.forEach((function(t){t.onload=null})),e.events.emit(wu.EventTypes["event:state.preload.unmount"]),e.logger.debug("Preload unmounted")}}console.warn("Window is not supported in this environment")}),[e]),null}function Ef(t){var e=t.state,n=Hu().game;return(0,ku.useEffect)((function(){if(window){var t,r,o,i=(t=function(t){n.config.player.skipKey.includes(t.key)&&e.events.emit(wu.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")}),[]),xu().createElement(xu().Fragment,null)}var Of=o(33);function Pf(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return jf(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)?jf(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 jf(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 Cf(t,e){return t.handle(e)}function If(t){var e=t.story,n=t.width,r=t.height,o=t.className,i=t.onReady,a=t.onEnd,s=Pf((0,ku.useReducer)((function(t){return t+1}),0),2)[1],u=Hu().game,c=Pf((0,ku.useReducer)(Cf,new wu(u,{update:s,forceUpdate:function(){(0,Of.flushSync)((function(){s()}))},next:y,dispatch:function(t){return f(t)}})),2),l=c[0],f=c[1],p=u.config.elements.say.use,d=u.config.elements.menu.use;function y(){for(var t=!1;!t;){var e=u.getLiveGame().next(l);if(!e)break;if(h.isAwaitable(e)){t=!0;break}f(e)}l.stage.update()}(0,ku.useEffect)((function(){u.getLiveGame().loadStory(e)}),[u]),(0,ku.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:wu.EventTypes["event:state.end"],listener:function(){a&&a({game:u,gameState:l,liveGame:u.getLiveGame(),storable:u.getLiveGame().getStorable()})}}]),o=l.events.onEvents([{type:wu.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()}))}}),[]);var v=n||u.config.player.width,m=r||u.config.player.height;return xu().createElement(tl,null,xu().createElement("div",{style:{width:"number"==typeof v?"".concat(v,"px"):v,height:"number"==typeof m?"".concat(m,"px"):m},className:Su(o,"__narraleaf_content-player")},xu().createElement(rl,{className:Su("flex-grow overflow-auto")},xu().createElement(Mu,{className:"relative"},l.state.srcManagers.map((function(t,e){return xu().createElement(Tf,{key:e,state:l,srcManager:t})})),xu().createElement(Lf,{onLoaded:function(){l.stage.update(),e&&y()}},xu().createElement(Ef,{state:l}),l.getSceneElements().map((function(t){var e=t.scene,n=t.ele;return xu().createElement(gl,{key:"scene-"+e.getId(),state:l,scene:e},n.images.map((function(t){return xu().createElement(hf,{key:"image-"+t.getId(),image:t,state:l})})),n.texts.map((function(t){var e=t.action,n=t.onClick;return xu().createElement(p,{state:l,key:"say-"+e.id,action:e,onClick:function(){n(),y()}})})),n.menus.map((function(t,e){return xu().createElement("div",{key:"menu-"+e},xu().createElement(d,{state:l,prompt:t.action.prompt,choices:t.action.choices,afterChoose:function(e){t.onClick(e),y()}}))})))})))))))}function Lf(t){var e=t.children,n=t.onLoaded,r=kf().preloaded,o=Pf((0,ku.useState)(!1),2),i=o[0],a=o[1];return(0,ku.useEffect)((function(){var t=r.events.on(gf.EventTypes["event:preloaded.ready"],(function(){a(!0),n()}));return function(){r.events.off(gf.EventTypes["event:preloaded.ready"],t)}}),[i]),xu().createElement(xu().Fragment,null,i?e:null)}function Mf(t){var e=t.children,n=t.game;return xu().createElement(xu().Fragment,null,xu().createElement(Iu,null,xu().createElement(Gu,{game:n},xu().createElement(Sf,null,e))))}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,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,Ff(r.key),r)}}function Ff(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 Vf=function(){return function(t,e,n){return e&&Rf(t.prototype,e),n&&Rf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.events=new m}),[{key:"start",value:function(t){throw new Error("Method not implemented.")}},{key:"toElementProps",value:function(){throw new Error("Method not implemented.")}},{key:"setSrc",value:function(t){throw new Error("Method not implemented.")}},{key:"requestAnimation",value:function(t,e,n){var r=this,o=t.start,i=t.end,a=t.duration,s=e.onComplete,u=e.onUpdate;return this.events.emit(ol.start,null),this.controller=ei(o,i,Object.assign({duration:a/1e3,onUpdate:function(t){u&&u(t),r.events.emit(ol.update,r.toElementProps())},onComplete:function(){r.events.emit(ol.end,null),s&&s(),r.controller=void 0}},n)),this.controller}},{key:"copy",value:function(){throw new Error("Method not implemented.")}}])}();function Df(t){return Df="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},Df(t)}function Bf(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,Gf(r.key),r)}}function Gf(t){var e=function(t,e){if("object"!=Df(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Df(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Df(e)?e:e+""}function Hf(t,e,n){return e=Uf(e),function(t,e){if(e&&("object"==Df(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,$f()?Reflect.construct(e,n||[],Uf(t).constructor):e.apply(t,n))}function $f(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return($f=function(){return!!t})()}function Uf(t){return Uf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Uf(t)}function zf(t,e){return zf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},zf(t,e)}var Wf=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=Hf(this,e)).state={opacity:1},t.duration=n,r&&(t.src="string"==typeof r?r:r instanceof Gs?va.backgroundToSrc(r.config.background):va.staticImageDataToSrc(r)),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&zf(t,e)}(e,t),function(t,e,n){return e&&Bf(t.prototype,e),n&&Bf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){this.src=t}},{key:"start",value:function(t){var n=this;this.state.opacity=e.Frames[0],this.requestAnimation({start:e.Frames[0],end:e.Frames[1],duration:this.duration},{onComplete:t,onUpdate:function(t){n.state.opacity=t}})}},{key:"toElementProps",value:function(){return[{style:{opacity:1}},{style:{opacity:this.state.opacity},src:this.src}]}},{key:"copy",value:function(){return new e(this.duration,this.src)}}])}(Vf);function qf(t){return qf="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},qf(t)}function Yf(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,Xf(r.key),r)}}function Xf(t){var e=function(t,e){if("object"!=qf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=qf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==qf(e)?e:e+""}function Kf(t,e,n){return e=Qf(e),function(t,e){if(e&&("object"==qf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Zf()?Reflect.construct(e,n||[],Qf(t).constructor):e.apply(t,n))}function Zf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Zf=function(){return!!t})()}function Qf(t){return Qf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Qf(t)}function Jf(t,e){return Jf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Jf(t,e)}Wf.Frames=[0,1];var tp=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=Kf(this,e)).state={opacity:0,transform:""},r.duration=o,r.direction=t,r.offset=n,i&&(r.src="string"==typeof i?i:i instanceof Gs?va.backgroundToSrc(i.config.background):va.staticImageDataToSrc(i)),r.__stack=g(),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Jf(t,e)}(e,t),function(t,e,n){return e&&Yf(t.prototype,e),n&&Yf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){this.src=t}},{key:"start",value:function(t){var e=this;if(!this.src)throw new Error("src is required, but not provided\nat:\n"+this.__stack);this.state.opacity=0,this.state.transform=this.getInitialTransform(),this.requestAnimation({start:0,end:1,duration:this.duration},{onComplete:t,onUpdate:function(t){e.state.opacity=t,e.state.transform=e.getTransform(t)}})}},{key:"toElementProps",value:function(){return[{style:{opacity:1}},{style:{opacity:this.state.opacity,transform:this.state.transform},src:this.src}]}},{key:"copy",value:function(){return new e(this.direction,this.offset,this.duration,this.src)}},{key:"getInitialTransform",value:function(){switch(this.direction){case"left":return"translateX(-".concat(this.offset,"px)");case"right":return"translateX(".concat(this.offset,"px)");case"top":return"translateY(-".concat(this.offset,"px)");case"bottom":return"translateY(".concat(this.offset,"px)");default:return""}}},{key:"getTransform",value:function(t){switch(this.direction){case"left":return"translateX(".concat((1-t)*-this.offset,"px)");case"right":return"translateX(".concat((1-t)*this.offset,"px)");case"top":return"translateY(".concat((1-t)*-this.offset,"px)");case"bottom":return"translateY(".concat((1-t)*this.offset,"px)");default:return""}}}])}(Vf);function ep(t){return ep="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},ep(t)}function np(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,rp(r.key),r)}}function rp(t){var e=function(t,e){if("object"!=ep(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ep(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ep(e)?e:e+""}function op(t,e,n){return e=ap(e),function(t,e){if(e&&("object"==ep(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,ip()?Reflect.construct(e,n||[],ap(t).constructor):e.apply(t,n))}function ip(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ip=function(){return!!t})()}function ap(t){return ap=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ap(t)}function sp(t,e){return sp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},sp(t,e)}var up=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=op(this,e)).state={opacity:0},t.duration=n,r&&(t.src="string"==typeof r?r:r instanceof Gs?va.backgroundToSrc(r.config.background):va.staticImageDataToSrc(r)),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&sp(t,e)}(e,t),function(t,e,n){return e&&np(t.prototype,e),n&&np(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){this.src=t}},{key:"start",value:function(t){var n=this;this.state.opacity=e.Frames[0],this.requestAnimation({start:e.Frames[0],end:e.Frames[1],duration:this.duration},{onComplete:t,onUpdate:function(t){n.state.opacity=t}})}},{key:"toElementProps",value:function(){return[{style:{opacity:this.state.opacity}},{style:{opacity:1-this.state.opacity},src:this.src}]}},{key:"copy",value:function(){return new e(this.duration,this.src)}}])}(Vf);up.Frames=[1,0]})(),i})()));