narraleaf-react 0.1.1 → 0.1.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"),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.pointer-events-none {\n pointer-events: none;\n}\n.static {\n position: static;\n}\n.absolute {\n position: absolute;\n}\n.relative {\n position: relative;\n}\n.inset-0 {\n inset: 0px;\n}\n.bottom-0 {\n bottom: 0px;\n}\n.z-10 {\n z-index: 10;\n}\n.z-20 {\n z-index: 20;\n}\n.m-4 {\n margin: 1rem;\n}\n.mt-2 {\n margin-top: 0.5rem;\n}\n.mt-4 {\n margin-top: 1rem;\n}\n.block {\n display: block;\n}\n.inline-block {\n display: inline-block;\n}\n.flex {\n display: flex;\n}\n.hidden {\n display: none;\n}\n.h-full {\n height: 100%;\n}\n.min-h-\\[calc\\(33\\%-40px\\)\\] {\n min-height: calc(33% - 40px);\n}\n.w-1\\/2 {\n width: 50%;\n}\n.w-\\[calc\\(100\\%-40px\\)\\] {\n width: calc(100% - 40px);\n}\n.w-full {\n width: 100%;\n}\n.min-w-full {\n min-width: 100%;\n}\n.flex-grow {\n flex-grow: 1;\n}\n.transform {\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.resize {\n resize: both;\n}\n.flex-col {\n flex-direction: column;\n}\n.items-start {\n align-items: flex-start;\n}\n.items-center {\n align-items: center;\n}\n.justify-center {\n justify-content: center;\n}\n.justify-between {\n justify-content: space-between;\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.whitespace-pre {\n white-space: pre;\n}\n.whitespace-pre-wrap {\n white-space: pre-wrap;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.rounded-lg {\n border-radius: 0.5rem;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.rounded-br-md {\n border-bottom-right-radius: 0.375rem;\n}\n.border {\n border-width: 1px;\n}\n.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.align-bottom {\n vertical-align: bottom;\n}\n.font-bold {\n font-weight: 700;\n}\n.italic {\n font-style: italic;\n}\n.text-black {\n --tw-text-opacity: 1;\n color: rgb(0 0 0 / var(--tw-text-opacity));\n}\n.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 !important;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter !important;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter !important;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important;\n transition-duration: 150ms !important;\n}\n.transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n.__narraleaf_content-player * {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n\n.__narraleaf_content-player img {\n pointer-events: none;\n -webkit-user-drag: none;\n -webkit-user-select: none;\n}\n",""]);const s=a},314:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",r=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),r&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),r&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,r,o,i){"string"==typeof t&&(t=[[null,t,void 0]]);var a={};if(r)for(var s=0;s<this.length;s++){var u=this[s][0];null!=u&&(a[u]=!0)}for(var c=0;c<t.length;c++){var l=[].concat(t[c]);r&&a[l[0]]||(void 0!==i&&(void 0===l[5]||(l[1]="@layer".concat(l[5].length>0?" ".concat(l[5]):""," {").concat(l[1],"}")),l[5]=i),n&&(l[2]?(l[1]="@media ".concat(l[2]," {").concat(l[1],"}"),l[2]=n):l[2]=n),o&&(l[4]?(l[1]="@supports (".concat(l[4],") {").concat(l[1],"}"),l[4]=o):l[4]="".concat(o)),e.push(l))}},e}},601:t=>{"use strict";t.exports=function(t){return t[1]}},196:(t,e,n)=>{var r;
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],e):"object"==typeof exports?exports.NarraleafReact=e(require("react"),require("react-dom")):t.NarraleafReact=e(t.React,t.ReactDOM)}(this,((t,e)=>(()=>{var n={587:(t,e,n)=>{"use strict";n.d(e,{A:()=>s});var r=n(601),o=n.n(r),i=n(314),a=n.n(i)()(o());a.push([t.id,"/*\n! tailwindcss v3.4.11 | MIT License | https://tailwindcss.com\n*//*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n*/\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: #e5e7eb; /* 2 */\n}\n\n::before,\n::after {\n --tw-content: '';\n}\n\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user's configured `sans` font-family by default.\n5. Use the user's configured `sans` font-feature-settings by default.\n6. Use the user's configured `sans` font-variation-settings by default.\n7. Disable tap highlights on iOS\n*/\n\nhtml,\n:host {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n -moz-tab-size: 4; /* 3 */\n -o-tab-size: 4;\n tab-size: 4; /* 3 */\n font-family: ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"; /* 4 */\n font-feature-settings: normal; /* 5 */\n font-variation-settings: normal; /* 6 */\n -webkit-tap-highlight-color: transparent; /* 7 */\n}\n\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n margin: 0; /* 1 */\n line-height: inherit; /* 2 */\n}\n\n/*\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n3. Ensure horizontal rules are visible by default.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n/*\nRemove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\nReset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n1. Use the user's configured `mono` font-family by default.\n2. Use the user's configured `mono` font-feature-settings by default.\n3. Use the user's configured `mono` font-variation-settings by default.\n4. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace; /* 1 */\n font-feature-settings: normal; /* 2 */\n font-variation-settings: normal; /* 3 */\n font-size: 1em; /* 4 */\n}\n\n/*\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\nPrevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-feature-settings: inherit; /* 1 */\n font-variation-settings: inherit; /* 1 */\n font-size: 100%; /* 1 */\n font-weight: inherit; /* 1 */\n line-height: inherit; /* 1 */\n letter-spacing: inherit; /* 1 */\n color: inherit; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 3 */\n}\n\n/*\nRemove the inheritance of text transform in Edge and Firefox.\n*/\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Remove default button styles.\n*/\n\nbutton,\ninput:where([type='button']),\ninput:where([type='reset']),\ninput:where([type='submit']) {\n -webkit-appearance: button; /* 1 */\n background-color: transparent; /* 2 */\n background-image: none; /* 2 */\n}\n\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n outline: auto;\n}\n\n/*\nRemove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type='search'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/*\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to `inherit` in Safari.\n*/\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\nRemoves the default spacing and border for appropriate elements.\n*/\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol,\nul,\nmenu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n/*\nReset default styling for dialogs.\n*/\ndialog {\n padding: 0;\n}\n\n/*\nPrevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user's configured gray 400 color.\n*/\n\ninput::-moz-placeholder, textarea::-moz-placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\ninput::placeholder,\ntextarea::placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\n/*\nSet the default cursor for buttons.\n*/\n\nbutton,\n[role=\"button\"] {\n cursor: pointer;\n}\n\n/*\nMake sure disabled buttons don't get the pointer cursor.\n*/\n:disabled {\n cursor: default;\n}\n\n/*\n1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/* Make elements with the HTML hidden attribute stay hidden by default */\n[hidden] {\n display: none;\n}\n\n*, ::before, ::after {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n --tw-contain-size: ;\n --tw-contain-layout: ;\n --tw-contain-paint: ;\n --tw-contain-style: ;\n}\n\n::backdrop {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n --tw-contain-size: ;\n --tw-contain-layout: ;\n --tw-contain-paint: ;\n --tw-contain-style: ;\n}\n.container {\n width: 100%;\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.mt-2 {\n margin-top: 0.5rem;\n}\n.mt-4 {\n margin-top: 1rem;\n}\n.block {\n display: block;\n}\n.inline-block {\n display: inline-block;\n}\n.flex {\n display: flex;\n}\n.hidden {\n display: none;\n}\n.h-full {\n height: 100%;\n}\n.w-1\\/2 {\n width: 50%;\n}\n.w-\\[calc\\(100\\%-40px\\)\\] {\n width: calc(100% - 40px);\n}\n.w-full {\n width: 100%;\n}\n.min-w-full {\n min-width: 100%;\n}\n.flex-grow {\n flex-grow: 1;\n}\n.transform {\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.resize {\n resize: both;\n}\n.flex-col {\n flex-direction: column;\n}\n.items-start {\n align-items: flex-start;\n}\n.items-center {\n align-items: center;\n}\n.justify-center {\n justify-content: center;\n}\n.justify-between {\n justify-content: space-between;\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.whitespace-pre {\n white-space: pre;\n}\n.whitespace-pre-wrap {\n white-space: pre-wrap;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.rounded-lg {\n border-radius: 0.5rem;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.rounded-br-md {\n border-bottom-right-radius: 0.375rem;\n}\n.border {\n border-width: 1px;\n}\n.border-2 {\n border-width: 2px;\n}\n.border-black {\n --tw-border-opacity: 1;\n border-color: rgb(0 0 0 / var(--tw-border-opacity));\n}\n.bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity));\n}\n.bg-cover {\n background-size: cover;\n}\n.bg-center {\n background-position: center;\n}\n.p-2 {\n padding: 0.5rem;\n}\n.p-4 {\n padding: 1rem;\n}\n.text-left {\n text-align: left;\n}\n.text-center {\n text-align: center;\n}\n.align-bottom {\n vertical-align: bottom;\n}\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.font-bold {\n font-weight: 700;\n}\n.italic {\n font-style: italic;\n}\n.text-black {\n --tw-text-opacity: 1;\n color: rgb(0 0 0 / var(--tw-text-opacity));\n}\n.text-red-700 {\n --tw-text-opacity: 1;\n color: rgb(185 28 28 / var(--tw-text-opacity));\n}\n.shadow-md {\n --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);\n --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.filter {\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n.\\!transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter !important;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter !important;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter !important;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important;\n transition-duration: 150ms !important;\n}\n.transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n.__narraleaf_content-player * {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n\n.__narraleaf_content-player img {\n pointer-events: none;\n -webkit-user-drag: none;\n -webkit-user-select: none;\n}\n",""]);const s=a},314:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",r=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),r&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),r&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,r,o,i){"string"==typeof t&&(t=[[null,t,void 0]]);var a={};if(r)for(var s=0;s<this.length;s++){var u=this[s][0];null!=u&&(a[u]=!0)}for(var c=0;c<t.length;c++){var l=[].concat(t[c]);r&&a[l[0]]||(void 0!==i&&(void 0===l[5]||(l[1]="@layer".concat(l[5].length>0?" ".concat(l[5]):""," {").concat(l[1],"}")),l[5]=i),n&&(l[2]?(l[1]="@media ".concat(l[2]," {").concat(l[1],"}"),l[2]=n):l[2]=n),o&&(l[4]?(l[1]="@supports (".concat(l[4],") {").concat(l[1],"}"),l[4]=o):l[4]="".concat(o)),e.push(l))}},e}},601:t=>{"use strict";t.exports=function(t){return t[1]}},196:(t,e,n)=>{var r;
2
2
  /*!
3
3
  * howler.js v2.2.4
4
4
  * howlerjs.com
@@ -28,4 +28,4 @@ function(){"use strict";var t;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.p
28
28
  *
29
29
  * This source code is licensed under the MIT license found in the
30
30
  * LICENSE file in the root directory of this source tree.
31
- */function c(t,e,n){var r,i={},c=null,l=null;for(r in void 0!==n&&(c=""+n),void 0!==e.key&&(c=""+e.key),void 0!==e.ref&&(l=e.ref),e)a.call(e,r)&&!u.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps)void 0===i[r]&&(i[r]=e[r]);return{$$typeof:o,type:t,key:c,ref:l,props:i,_owner:s.current}}e.jsx=c,e.jsxs=c},387:(t,e,n)=>{"use strict";t.exports=n(73)},12:e=>{"use strict";e.exports=t},33:t=>{"use strict";t.exports=e}},r={};function o(t){var e=r[t];if(void 0!==e)return e.exports;var i=r[t]={id:t,exports:{}};return n[t](i,i.exports,o),i.exports}o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.nc=void 0;var i={};return(()=>{"use strict";o.r(i),o.d(i,{Align:()=>Pe,BaseImageTransition:()=>Rc,BaseTextTransition:()=>Mc,BaseTransition:()=>Nc,Character:()=>uu,CommonPosition:()=>Te,CommonPositionType:()=>he,Condition:()=>Lu,Control:()=>Va,Coord2D:()=>Ee,Dissolve:()=>ry,Fade:()=>Gh,FadeIn:()=>Xh,Game:()=>Vf,GameProviders:()=>Lh,GameState:()=>ef,Image:()=>qa,Isolated:()=>mf,Lambda:()=>Iu,LiveGame:()=>Gf,Menu:()=>Qu,Namespace:()=>Hl,Pause:()=>Ns,Player:()=>Ch,Say:()=>Tf,Scene:()=>ll,Script:()=>El,Sentence:()=>Hs,Sound:()=>js,SoundType:()=>ws,Storable:()=>Wl,Story:()=>Ml,Text:()=>Qc,Transform:()=>Ia,Utils:()=>bs,Word:()=>Ds,useGame:()=>If});var t={say:"character:say",action:"character:action",setName:"character:setName"},e={action:"scene:action",setBackground:"scene:setBackground",sleep:"scene:sleep",setTransition:"scene:setTransition",applyTransition:"scene:applyTransition",init:"scene:init",exit:"scene:exit",jumpTo:"scene:jumpTo",setBackgroundMusic:"scene:setBackgroundMusic",preUnmount:"scene:preUnmount",applyTransform:"scene:applyTransform"},n={action:"image:action",setSrc:"image:setSrc",setPosition:"image:setPosition",show:"image:show",hide:"image:hide",applyTransform:"image:applyTransform",init:"image:init",dispose:"image:dispose",setTransition:"image:setTransition",applyTransition:"image:applyTransition",flush:"image:flush"},r={action:"sound:action",play:"sound:play",stop:"sound:stop",fade:"sound:fade",setVolume:"sound:setVolume",setRate:"sound:setRate",pause:"sound:pause",resume:"sound:resume"},a={action:"control:action",do:"control:do",doAsync:"control:doAsync",any:"control:any",all:"control:all",allAsync:"control:allAsync",repeat:"control:repeat",sleep:"control:sleep"},s={action:"text:action",setText:"text:setText",show:"text:show",hide:"text:hide",applyTransform:"text:applyTransform",init:"text:init",applyTransition:"text:applyTransition",setFontSize:"text:setFontSize"};function u(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */u=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var i=e&&e.prototype instanceof b?e:b,a=Object.create(i.prototype),s=new I(r||[]);return o(a,"_invoke",{value:E(t,n,s)}),a}function p(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var d="suspendedStart",h="suspendedYield",y="executing",v="completed",g={};function b(){}function w(){}function _(){}var S={};l(S,a,(function(){return this}));var k=Object.getPrototypeOf,x=k&&k(k(L([])));x&&x!==n&&r.call(x,a)&&(S=x);var A=_.prototype=b.prototype=Object.create(S);function O(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function T(t,e){function n(o,i,a,s){var u=p(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==m(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function E(e,n,r){var o=d;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=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===d)throw o=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=y;var c=p(e,n,r);if("normal"===c.type){if(o=r.done?v:h,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=v,r.method="throw",r.arg=c.arg)}}}function P(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,P(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=p(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function 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(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(m(e)+" is not iterable")}return w.prototype=_,o(A,"constructor",{value:_,configurable:!0}),o(_,"constructor",{value:w,configurable:!0}),w.displayName=l(_,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,l(t,c,"GeneratorFunction")),t.prototype=Object.create(A),t},e.awrap=function(t){return{__await:t}},O(T.prototype),l(T.prototype,s,(function(){return this})),e.AsyncIterator=T,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new T(f(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(A),l(A,c,"Generator"),l(A,a,(function(){return this})),l(A,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=L,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(C),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;C(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:L(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function c(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=y(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,d(r.key),r)}}function p(t,e,n){return e&&f(t.prototype,e),n&&f(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function d(t){var e=function(t,e){if("object"!=m(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=m(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==m(e)?e:e+""}function h(t){return function(t){if(Array.isArray(t))return v(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||y(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(t,e){if(t){if("string"==typeof t)return v(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(t,e):void 0}}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function m(t){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},m(t)}var g=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};function b(t,e){var n=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r={},o=function(t,e,n){return"object"!==m(e)||null===e||Array.isArray(e)||"object"!==m(n)||null===n||Array.isArray(n)?Array.isArray(e)&&Array.isArray(n)?e.map((function(t,e){return"object"===m(t)&&null!==t&&!Array.isArray(t)&&n[e]?b(t,n[e]):t})):void 0===n?e:n:e.constructor!==Object||n.constructor!==Object?n||e:b(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"===m(e[a])&&null!==e[a]&&e[a].constructor===Object?r[a]=b({},e[a]):r[a]=e[a]);for(var s=arguments.length,u=new Array(s>2?s-2:0),c=2;c<s;c++)u[c-2]=arguments[c];if(u.length){var l=u[0],f=u.slice(1);return b.apply(void 0,[r,l].concat(h(f)))}return r}var w=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t},n=arguments.length>1?arguments[1]:void 0;l(this,t),this.solved=!1,this.listeners=[],this.receiver=e,this.skipController=n}return p(t,[{key:"registerSkipController",value:function(t){return this.skipController=t,this}},{key:"resolve",value:function(t){if(!this.solved){this.result=this.receiver(t),this.solved=!0,this.skipController&&this.skipController.cancel();var e,n=c(this.listeners);try{for(n.s();!(e=n.n()).done;){(0,e.value)(this.result)}}catch(t){n.e(t)}finally{n.f()}}}},{key:"then",value:function(t){this.result?t(this.result):this.listeners.push(t)}},{key:"abort",value:function(){return this.skipController?this.skipController.abort():this.result}}],[{key:"isAwaitable",value:function(e){return e instanceof t}}])}();function _(t){var e=new WeakSet;return function t(n){if(null===n||"object"!==m(n))return n;if(!e.has(n)){if(e.add(n),Array.isArray(n)){var r,o=[],i=c(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;o.push(t(a))}}catch(t){i.e(t)}finally{i.f()}return o}var s={};for(var u in n)Object.prototype.hasOwnProperty.call(n,u)&&(s[u]=t(n[u]));return s}}(t)}function S(t){return"string"==typeof t?t:"#".concat((t.r||0).toString(16).padStart(2,"0")).concat((t.g||0).toString(16).padStart(2,"0")).concat((t.b||0).toString(16).padStart(2,"0")).concat(void 0===t.a?"":t.a.toString(16).padStart(2,"0"))}w.nothing=function(t){return t};var k=function(){return p((function t(){l(this,t),this.events={}}),[{key:"on",value:function(t,e){return this.events[t]||(this.events[t]=[]),this.events[t].push(e),this.emit("event:EventDispatcher.register",t,e),e}},{key:"onEvents",value:function(t){var e=this,n=t.map((function(t){var n=t.type,r=t.listener;return{type:n,listener:r,cancel:function(){e.off(n,r)}}}));return{tokens:n,cancel:function(){n.forEach((function(t){return t.cancel()}))}}}},{key:"off",value:function(t,e){this.events[t]&&(this.events[t]=this.events[t].filter((function(t){return t!==e})))}},{key:"emit",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];this.events[t]&&this.events[t].forEach((function(t){t.apply(void 0,n)}))}},{key:"once",value:function(t,e){var n=this,r=function(){e.apply(void 0,arguments),n.off(t,r)};return this.on(t,r)}},{key:"any",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return g(this,void 0,void 0,u().mark((function e(){var r,o,i,a,s,l=this;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.events[t]||(this.events[t]=[]),r=[],o=c(this.events[t]);try{for(o.s();!(i=o.n()).done;)a=i.value,(s=a.apply(void 0,n))&&"object"===m(s)&&"function"==typeof s.then&&r.push(s)}catch(t){o.e(t)}finally{o.f()}if(this.events[t]=this.events[t].filter((function(t){return!r.includes(t)})),0!==r.length){e.next=7;break}return e.abrupt("return",new Promise((function(e){var r=l.on("event:EventDispatcher.register",(function(o,i){if(o===t){l.off(o,r);var a=null==i?void 0:i.apply(void 0,n);a&&a.then?a.then(e):e(a)}}))})));case 7:return e.next=9,Promise.all(r);case 9:return e.abrupt("return",void 0);case 10:case"end":return e.stop()}}),e,this)})))}},{key:"clear",value:function(){this.events={}}}])}();function x(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(new Error).stack;return n?n.split("\n").slice(t+1,-e).join("\n").trim():""}function A(t){return new Promise((function(e){return setTimeout(e,t)}))}function O(t,e){if(t===e)return!0;if("object"!==m(t)||"object"!==m(e)||null===t||null===e)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(var o=0,i=n;o<i.length;o++){var a=i[o];if(!r.includes(a)||!O(t[a],e[a]))return!1}return!0}var T=function(){return p((function t(e,n){l(this,t),this.game=e,this.prefix=n}),[{key:"log",value:function(t){if(this.game.config.app.logger.log){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).log.apply(e,h(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,h(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,h(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,h(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,h(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)}}])}(),E=function(){return p((function t(e){l(this,t),this.abortHandler=e,this.events=new k,this.aborted=!1}),[{key:"abort",value:function(){return this.aborted||(this.aborted=!0,this.result=this.abortHandler.apply(this,arguments)),this.result}},{key:"isAborted",value:function(){return this.aborted}},{key:"cancel",value:function(){this.aborted=!0}}])}();E.EventTypes={"event:skipController.abort":"event:skipController.abort"};var P=function(){return p((function t(){l(this,t),this.locked=!1,this.listeners=[],this.unlockListeners=[]}),[{key:"lock",value:function(){return this.locked=!0,this}},{key:"unlock",value:function(){this.locked=!1;var t,e=c(this.listeners);try{for(e.s();!(t=e.n()).done;){(0,t.value)()}}catch(t){e.e(t)}finally{e.f()}var n,r=c(this.unlockListeners);try{for(r.s();!(n=r.n()).done;){(0,n.value)()}}catch(t){r.e(t)}finally{r.f()}return this.listeners=[],this}},{key:"onUnlock",value:function(t){return this.unlockListeners.push(t),t}},{key:"offUnlock",value:function(t){this.unlockListeners=this.unlockListeners.filter((function(e){return e!==t}))}},{key:"nextUnlock",value:function(){return g(this,void 0,void 0,u().mark((function t(){var e=this;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.locked){t.next=2;break}return t.abrupt("return");case 2:return t.abrupt("return",new Promise((function(t){e.listeners.push(t)})));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"isLocked",value:function(){return this.locked}}])}(),j=function(){return p((function t(){l(this,t),this.locks=[]}),[{key:"unlock",value:function(t){return t.unlock(),this.off(t),t}},{key:"register",value:function(t){var e=t||new P;return this.locks.push(e),e}},{key:"off",value:function(t){this.locks=this.locks.filter((function(e){return e!==t}))}},{key:"nextUnlock",value:function(){return g(this,void 0,void 0,u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.locks.map((function(t){return t.nextUnlock()})),t.abrupt("return",Promise.all(e));case 2:case"end":return t.stop()}}),t,this)})))}},{key:"isLocked",value:function(){return this.locks.some((function(t){return t.isLocked()}))}}])}();function C(t){return C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},C(t)}function 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,L(r.key),r)}}function L(t){var e=function(t,e){if("object"!=C(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=C(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==C(e)?e:e+""}var N=function(){return function(t,e,n){return e&&I(t.prototype,e),n&&I(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e,n,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.callee=e,this.type=n,this.contentNode=r,this.__stack=x(),this._id=""}),[{key:"executeAction",value:function(t){return{type:this.type,node:this.contentNode.getChild()}}},{key:"getId",value:function(){return this._id}},{key:"setId",value:function(t){this._id=t}},{key:"getFutureActions",value:function(){var t=this.contentNode.getChild();return t&&t.action?[t.action]:[]}}])}();function 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 M(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"!=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+""}function D(t,e,n){return e=V(e),function(t,e){if(e&&("object"==R(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,B()?Reflect.construct(e,n||[],V(t).constructor):e.apply(t,n))}function B(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(B=function(){return!!t})()}function V(t){return V=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},V(t)}function G(t,e){return G=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},G(t,e)}N.ActionTypes={action:"action"};var U=function(t){function e(t,n,r){var o;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(o=D(this,e,[t,n,r])).callee=t.getSelf(),o.contentNode.action=o,o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&G(t,e)}(e,t),function(t,e,n){return e&&M(t.prototype,e),n&&M(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"unknownType",value:function(){throw new Error("Unknown action type: "+this.type)}}])}(N);function z(t){return z="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},z(t)}function H(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 W(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)?W(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 W(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){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Y(r.key),r)}}function Y(t){var e=function(t,e){if("object"!=z(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=z(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==z(e)?e:e+""}function q(t,e,n){return e=Q(e),function(t,e){if(e&&("object"==z(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,X()?Reflect.construct(e,n||[],Q(t).constructor):e.apply(t,n))}function X(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(X=function(){return!!t})()}function K(t,e,n,r){var o=Z(Q(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function Z(){return Z="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Q(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}},Z.apply(null,arguments)}function Q(t){return Q=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Q(t)}function J(t,e){return J=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},J(t,e)}var tt=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),q(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&J(t,e)}(e,t),function(t,e,n){return e&&$(t.prototype,e),n&&$(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===r.play){if(e.initSound(t,this.callee),!this.callee.getPlaying())throw new Error("Howl is not initialized");if(this.callee.config.sync&&!this.callee.config.loop){var o=new w((function(t){return t}));return t.playSound(this.callee,(function(){var e;t.stopSound(n.callee),o.resolve({type:n.type,node:null===(e=n.contentNode)||void 0===e?void 0:e.getChild()})})),o}return t.playSound(this.callee,(function(){t.stopSound(n.callee)})),K(e,"executeAction",this,3)([t])}if(this.type===r.stop)return t.stopSound(this.callee),K(e,"executeAction",this,3)([t]);if(this.type===r.fade){var i=H(this.contentNode.getContent(),1)[0],a=i.start,s=i.end,u=i.duration;if(this.callee.getPlaying()){var c=void 0===a?this.callee.getPlaying().volume():a;this.callee.getPlaying().fade(c,s,u,this.callee.getToken())}return K(e,"executeAction",this,3)([t])}if(this.type===r.setVolume){var l=H(this.contentNode.getContent(),1)[0];return this.callee.getPlaying()&&this.callee.getPlaying().volume(l,this.callee.getToken()),K(e,"executeAction",this,3)([t])}if(this.type===r.setRate){var f=H(this.contentNode.getContent(),1)[0];return this.callee.getPlaying()&&this.callee.getPlaying().rate(f,this.callee.getToken()),K(e,"executeAction",this,3)([t])}if(this.type===r.pause)return this.callee.getPlaying()&&this.callee.getPlaying().pause(this.callee.getToken()),K(e,"executeAction",this,3)([t]);if(this.type===r.resume)return this.callee.getPlaying()&&this.callee.getPlaying().play(this.callee.getToken()),K(e,"executeAction",this,3)([t]);throw K(e,"unknownType",this,3)([])}}],[{key:"initSound",value:function(t,e){e.getPlaying()||e.setPlaying(new(t.getHowl())(e.getHowlOptions()))}}])}(U);function et(t){return et="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},et(t)}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}function ot(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,it(r.key),r)}}function it(t){var e=function(t,e){if("object"!=et(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=et(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==et(e)?e:e+""}function at(t,e,n){return e=lt(e),function(t,e){if(e&&("object"==et(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,st()?Reflect.construct(e,n||[],lt(t).constructor):e.apply(t,n))}function st(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(st=function(){return!!t})()}function ut(t,e,n,r){var o=ct(lt(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function ct(){return ct="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=lt(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}},ct.apply(null,arguments)}function lt(t){return lt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},lt(t)}function ft(t,e){return ft=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ft(t,e)}tt.ActionTypes=r;var pt,dt=function(t){function n(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),at(this,n,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ft(t,e)}(n,t),function(t,e,n){return e&&ot(t.prototype,e),n&&ot(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"executeAction",value:function(t){var r,o=this;if(this.type===e.action)return ut(n,"executeAction",this,3)([t]);if(this.type===e.setBackground)return this.callee.state.background=this.contentNode.getContent()[0],ut(n,"executeAction",this,3)([t]);if(this.type===e.sleep){var i=new w((function(t){return t})),a=this.contentNode.getContent();return new Promise((function(t){"number"==typeof a?setTimeout((function(){t()}),a):w.isAwaitable(a)?a.then(t):null==a||a.then(t)})).then((function(){i.resolve({type:o.type,node:o.contentNode.getChild()}),t.stage.next()})),i}if(this.type===e.applyTransition){var s=(new w).registerSkipController(new E((function(){return t.logger.info("NarraLeaf-React: Background Transition","Skipped"),{type:o.type,node:o.contentNode.getChild()}}))),u=this.contentNode.getContent()[0];return this.callee.events.any("event:displayable.applyTransition",u).then((function(){s.resolve({type:o.type,node:o.contentNode.getChild()}),t.stage.next()})),s}if(this.type===e.init){var c=new w((function(t){return t}));return n.handleSceneInit(this,t,c)}if(this.type===e.exit){t.offSrcManager(this.callee.srcManager).removeScene(this.callee);var l=new w((function(t){return t}));return this.callee.events.once("event:scene.unmount",(function(){l.resolve({type:o.type,node:o.contentNode.getChild()}),t.stage.next()})),l}if(this.type===e.jumpTo){var f=this.contentNode.getContent()[0],p=this.contentNode,d=(null===(r=f.sceneRoot)||void 0===r?void 0:r.contentNode)||null;return d&&p.addChild(d),ut(n,"executeAction",this,3)([t])}if(this.type===e.setBackgroundMusic){var h=nt(this.contentNode.getContent(),2),y=h[0],v=h[1];return this.callee.events.emit("event:scene.setBackgroundMusic",y,v||0),ut(n,"executeAction",this,3)([t])}if(this.type===e.preUnmount)return this.callee.events.emit("event:scene.preUnmount"),ut(n,"executeAction",this,3)([t]);if(this.type===e.applyTransform){var m=nt(this.contentNode.getContent(),1)[0],g=new w((function(t){return t})).registerSkipController(new E((function(){return{type:o.type,node:o.contentNode.getChild()}})));return this.callee.events.any("event:displayable.applyTransform",m).then((function(){g.resolve({type:o.type,node:o.contentNode.getChild()}),t.stage.next()})),g}throw new Error("Unknown scene action type: "+this.type)}},{key:"getFutureActions",value:function(){var t,n,r;if(this.type===e.jumpTo){var o=null===(n=null===(t=this.contentNode.getContent()[0])||void 0===t?void 0:t.sceneRoot)||void 0===n?void 0:n.contentNode;return(null==o?void 0:o.action)?[o.action]:[]}var i=null===(r=this.contentNode.getChild())||void 0===r?void 0:r.action;return i?[i]:[]}}],[{key:"handleSceneInit",value:function(t,e,r){return e.isSceneActive(t.callee)?{type:t.type,node:t.contentNode.getChild()}:(e.registerSrcManager(t.callee.srcManager).addScene(t.callee),n.registerEventListeners(t.callee,e,(function(){r.resolve({type:t.type,node:t.contentNode.getChild()}),e.stage.next()})),r)}},{key:"registerEventListeners",value:function(t,e,n){t.events.once("event:scene.unmount",(function(){e.offSrcManager(t.srcManager)})),t.events.once("event:scene.mount",(function(){t.state.backgroundMusic&&(tt.initSound(e,t.state.backgroundMusic),t.events.emit("event:scene.setBackgroundMusic",t.state.backgroundMusic,t.config.backgroundMusicFade))})),t.events.any("event:displayable.init").then((function(){n&&n()}))}}])}(U);function ht(t){return ht="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},ht(t)}function yt(t,e,n){return e=mt(e),function(t,e){if(e&&("object"==ht(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,vt()?Reflect.construct(e,n||[],mt(t).constructor):e.apply(t,n))}function vt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(vt=function(){return!!t})()}function mt(t){return mt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},mt(t)}function gt(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&&bt(t,e)}function bt(t,e){return bt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},bt(t,e)}function wt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _t(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,kt(r.key),r)}}function St(t,e,n){return e&&_t(t.prototype,e),n&&_t(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function kt(t){var e=function(t,e){if("object"!=ht(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ht(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ht(e)?e:e+""}dt.ActionTypes=e,function(t){t.TreeNode="TreeNode",t.ContentNode="ContentNode"}(pt||(pt={}));var xt=function(t){function e(t,n,r){var o;return wt(this,e),(o=yt(this,e,[pt.ContentNode])).child=r||null,o.parent=n||null,o.action=t||null,o}return gt(e,t),St(e,[{key:"setParent",value:function(t){if(t===this)throw new Error("Cannot set parent to itself");return this.parent=t,this}},{key:"setChild",value:function(t){if(t===this)throw new Error("Cannot set child to itself");return this.child=t,t&&t.parent!==this&&t.remove().setParent(this),this}},{key:"getChild",value:function(){return this.child||null}},{key:"getParent",value:function(){return this.parent||null}},{key:"addChild",value:function(t){return this.setChild(t),this}},{key:"removeChild",value:function(t){return t&&this.child===t?(this.child=null,t.setParent(null)):t||(this.child=null),this}},{key:"remove",value:function(){var t;return null===(t=this.parent)||void 0===t||t.removeChild(this),this}},{key:"hasChild",value:function(){return!!this.child}}],[{key:"forEachParent",value:function(t,e){for(var n=new Set,r=t;r&&!n.has(r);)n.add(r),e(r),r=r.getParent()}},{key:"forEachChild",value:function(t,e){for(var n=new Set,r=t;r&&!n.has(r);)n.add(r),e(r),r=r.getChild()}}])}(function(){return St((function t(e){wt(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 At(t){return At="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},At(t)}function Ot(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Tt(r.key),r)}}function Tt(t){var e=function(t,e){if("object"!=At(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=At(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==At(e)?e:e+""}var Et=function(){return function(t,e,n){return e&&Ot(t.prototype,e),n&&Ot(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.id=""}),[{key:"setId",value:function(t){this.id=t}},{key:"getId",value:function(){return this.id}},{key:"reset",value:function(){}},{key:"fromData",value:function(t){return this}},{key:"construct",value:function(t){for(var e,n=0;n<t.length;n++){var r=t[n];0!==n&&(null===(e=t[n-1])||void 0===e||e.contentNode.setChild(r.contentNode))}return t}}])}();function 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){return function(t){if(Array.isArray(t))return Nt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Lt(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 Ct(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Lt(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 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)||Lt(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 Lt(t,e){if(t){if("string"==typeof t)return Nt(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)?Nt(t,e):void 0}}function Nt(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 Rt(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Rt=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:O(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",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"==Pt(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,n,r){var o=p;return function(i,a){if(o===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=T(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 T(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,T(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 E(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(E,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(Pt(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 Mt(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,Ft(r.key),r)}}function Ft(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 Dt(t,e,n){return e=Ut(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,Bt()?Reflect.construct(e,n||[],Ut(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 Vt(t,e,n,r){var o=Gt(Ut(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function Gt(){return Gt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Ut(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}},Gt.apply(null,arguments)}function Ut(t){return Ut=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ut(t)}function zt(t,e){return zt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},zt(t,e)}var Ht,Wt=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())}))},$t=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Dt(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&&zt(t,e)}(e,t),function(t,e,n){return e&&Mt(t.prototype,e),n&&Mt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAllActions",value:function(t,e){return Wt(this,void 0,void 0,Rt().mark((function n(){var r,o,i;return Rt().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:r=!1,o=e,i=Rt().mark((function e(){var n,r,i;return Rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.game.getLiveGame().executeAction(t,o),t.logger.debug("Control - Next Action",n),n){e.next=4;break}return e.abrupt("return",0);case 4:if(!w.isAwaitable(n)){e.next=16;break}return e.next=7,new Promise((function(t){n.then((function(e){return t(n.result)}))}));case 7:if(r=e.sent,!(i=r.node)){e.next=13;break}o=i.action,e.next=14;break;case 13:return e.abrupt("return",0);case 14:e.next=17;break;case 16:o=n;case 17:case"end":return e.stop()}}),e)}));case 3:if(r||!o){n.next=10;break}return n.delegateYield(i(),"t0",5);case 5:if(0!==n.t0){n.next=8;break}return n.abrupt("break",10);case 8:n.next=3;break;case 10:case"end":return n.stop()}}),n)})))}},{key:"executeSingleAction",value:function(t,e){return Wt(this,void 0,void 0,Rt().mark((function n(){var r,o,i;return Rt().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=t.game.getLiveGame().executeAction(t,e),!w.isAwaitable(r)){n.next=9;break}return n.next=4,new Promise((function(t){r.then((function(e){return t(r.result)}))}));case 4:return o=n.sent,i=o.node,n.abrupt("return",i);case 9:return n.abrupt("return",r);case 10:case"end":return n.stop()}}),n)})))}},{key:"execute",value:function(t,n,r){var o=this;return r.length>0?(this.executeAllActions(t,r[0]).then((function(){n.resolve({type:o.type,node:o.contentNode.getChild()}),t.stage.next()})),n):Vt(e,"executeAction",this,3)([t])}},{key:"executeAction",value:function(t){var n=this,r=It(this.contentNode.getContent(),1)[0];if(this.type===a.do){var o=new w((function(t){return t}));return this.execute(t,o,r)}if(this.type===a.doAsync)return Wt(n,void 0,void 0,Rt().mark((function e(){return Rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r.length>0)){e.next=3;break}return e.next=3,this.executeAllActions(t,r[0]);case 3:case"end":return e.stop()}}),e,this)}))),Vt(e,"executeAction",this,3)([t]);if(this.type===a.any){var i=new w((function(t){return t})),s=r.map((function(e){return n.executeSingleAction(t,e)}));return Promise.any(s).then((function(){i.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),i}if(this.type===a.all){var u=new w((function(t){return t}));return Wt(n,void 0,void 0,Rt().mark((function e(){var n=this;return Rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(r.map((function(e){return n.executeSingleAction(t,e)})));case 2:u.resolve({type:this.type,node:this.contentNode.getChild()}),t.stage.next();case 4:case"end":return e.stop()}}),e,this)}))),u}if(this.type===a.allAsync)return Wt(n,void 0,void 0,Rt().mark((function e(){var n,o,i;return Rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=Ct(r);try{for(n.s();!(o=n.n()).done;)i=o.value,this.executeSingleAction(t,i).then((function(t){}))}catch(t){n.e(t)}finally{n.f()}case 2:case"end":return e.stop()}}),e,this)}))),Vt(e,"executeAction",this,3)([t]);if(this.type===a.repeat){var c=It(this.contentNode.getContent(),2),l=c[0],f=c[1],p=new w((function(t){return t}));return Wt(n,void 0,void 0,Rt().mark((function e(){var n;return Rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=0;case 1:if(!(n<f)){e.next=8;break}if(!(l.length>0)){e.next=5;break}return e.next=5,this.executeAllActions(t,l[0]);case 5:n++,e.next=1;break;case 8:p.resolve({type:this.type,node:this.contentNode.getChild()}),t.stage.next();case 10:case"end":return e.stop()}}),e,this)}))),p}if(this.type===a.sleep){var d=new w((function(t){return t})),h=It(this.contentNode.getContent(),2)[1];return new Promise((function(t){"number"==typeof h?setTimeout((function(){t()}),h):w.isAwaitable(h)?h.then(t):null==h||h.then(t)})).then((function(){d.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),d}throw new Error("Unknown control action type: "+this.type)}},{key:"getFutureActions",value:function(){var t=this.contentNode.getContent()[0],n=Vt(e,"getFutureActions",this,3)([]);return[].concat(jt(t),jt(n))}}])}(U);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 qt(t){return function(t){if(Array.isArray(t))return Xt(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 Xt(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)?Xt(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 Xt(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 Kt(t,e,n){return e=Qt(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,Zt()?Reflect.construct(e,n||[],Qt(t).constructor):e.apply(t,n))}function Zt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Zt=function(){return!!t})()}function Qt(t){return Qt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Qt(t)}function Jt(t,e){return Jt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Jt(t,e)}function te(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ee(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,re(r.key),r)}}function ne(t,e,n){return e&&ee(t.prototype,e),n&&ee(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function re(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+""}$t.ActionTypes=a;var oe=Symbol("_Chained"),ie=function(){function t(e){te(this,t),this[Ht]=!0,this.__actions=[],this.__self=e}return ne(t,[{key:"push",value:function(){var t;(t=this.__actions).push.apply(t,arguments)}},{key:"getActions",value:function(){return this.__actions}},{key:"getSelf",value:function(){return this.__self}},{key:"newChain",value:function(){return this.getSelf().chain()}}],[{key:"isChained",value:function(t){return t&&t[oe]}},{key:"toActions",value:function(e){return e.flat(2).map((function(e){return t.isChained(e)?e.fromChained(e):e})).flat(3)}}])}();Ht=oe;var ae=function(t){function e(){return te(this,e),Kt(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&&Jt(t,e)}(e,t),ne(e,[{key:"chain",value:function(t){var e=ie.isChained(this)?this:this.proxy(this,new ie(this));if(!t)return e;var n=Array.isArray(t)?t:[t];return e.push.apply(e,qt(n)),e}},{key:"proxy",value:function(t,e){var n=new Proxy(t,{get:function(t,r){if(r in e)return e[r];var o=t[r];return"function"==typeof o?o.bind(n):o},set:function(t,e,n){return t[e]=n,!0}});return n}},{key:"combineActions",value:function(t,e){var n=e(this.chain().newChain()),r=new $t(t.chain(),$t.ActionTypes.do,(new xt).setContent([this.construct(ie.toActions([n]))]));return this.chain(r)}}])}(Et);function se(t){return se="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},se(t)}function ue(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,ce(r.key),r)}}function ce(t){var e=function(t,e){if("object"!=se(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=se(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==se(e)?e:e+""}function le(t,e,n){return e=pe(e),function(t,e){if(e&&("object"==se(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,fe()?Reflect.construct(e,n||[],pe(t).constructor):e.apply(t,n))}function fe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(fe=function(){return!!t})()}function pe(t){return pe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},pe(t)}function de(t,e){return de=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},de(t,e)}var he,ye=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),le(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&&de(t,e)}(e,t),function(t,e,n){return e&&ue(t.prototype,e),n&&ue(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"toData",value:function(){return null}},{key:"fromChained",value:function(t){return t.getActions()}}])}(ae),ve="center",me="left",ge="right";function be(t){return be="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},be(t)}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,xe(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,e,n){return(e=xe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function xe(t){var e=function(t,e){if("object"!=be(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=be(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==be(e)?e:e+""}!function(t){t.Left="left",t.Center="center",t.Right="right"}(he||(he={}));var Ae=ke(ke(ke({},he.Left,"33.33%"),he.Center,"50%"),he.Right,"66.66%"),Oe=function(){function t(){we(this,t)}return Se(t,null,[{key:"isUnknown",value:function(e){return e===t.Unknown}},{key:"wrap",value:function(t){return Object.assign({left:"auto",top:"auto",right:"auto",bottom:"auto"},t)}},{key:"D2PositionToCSS",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.calc(t.y,t.yoffset),o=this.calc(t.x,t.xoffset),i=n?{bottom:r}:{top:r},a=e?{right:o}:{left:o};return this.wrap(Object.assign(Object.assign({},i),a))}},{key:"calc",value:function(e,n){if(!e||t.isUnknown(e))return"auto";if(void 0===n||t.isUnknown(n))return"calc(".concat(e," + 0px)");var r="number"==typeof e?"".concat(e,"px"):e;return"calc(".concat(r," + (").concat(n,"px))")}},{key:"toCoord2D",value:function(t){if(Te.isCommonPositionType(t))return Ee.fromCommonPosition(t);if(Ee.isCoord2DPosition(t))return t;if(Pe.isAlignPosition(t))return Ee.fromAlignPosition(t);if("object"===be(t)&&["x","y","xoffset","yoffset"].some((function(e){return e in t})))return new Ee(t);throw new Error("Invalid position type")}},{key:"orUnknown",value:function(e){return t.isUnknown(e)||void 0===e?t.Unknown:e}},{key:"mergePosition",value:function(t,e){var n=this.toCoord2D(t),r=this.toCoord2D(e);return Ee.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(he).includes(t)}},{key:"isRawCoord2DPosition",value:function(t){return"object"===be(t)&&("x"in t||"y"in t||"xoffset"in t||"yoffset"in t)}},{key:"isRawAlignPosition",value:function(t){return"object"===be(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 Te||t instanceof Ee||t instanceof Pe}},{key:"rawPositionToCoord2D",value:function(t){if(this.isRawCommonPositionType(t))return Ee.fromCommonPosition(new Te(t));if(this.isRawCoord2DPosition(t))return new Ee(t);if(this.isRawAlignPosition(t))return Ee.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")}}])}();Oe.Unknown=Symbol("Unknown");var Te=function(){function t(e){we(this,t),this.position=e}return Se(t,[{key:"toCSS",value:function(){return{x:Ae[this.position],y:"50%",xoffset:0,yoffset:0}}}],[{key:"isCommonPositionType",value:function(e){return e instanceof t}}])}();Te.Positions=he;var Ee=function(){function t(e,n){we(this,t),"object"===be(e)?(this.x=Oe.orUnknown(e.x),this.y=Oe.orUnknown(e.y),this.xoffset=Oe.orUnknown(e.xoffset),this.yoffset=Oe.orUnknown(e.yoffset)):(this.x=Oe.orUnknown(e),this.y=Oe.orUnknown(n),this.xoffset=Oe.Unknown,this.yoffset=Oe.Unknown)}return Se(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:Ae[e.position],y:"50%"})}},{key:"fromAlignPosition",value:function(e){return new t({x:Oe.isUnknown(e.xalign)?Oe.Unknown:"".concat(100*e.xalign,"%"),y:Oe.isUnknown(e.yalign)?Oe.Unknown:"".concat(100*e.yalign,"%"),xoffset:e.xoffset,yoffset:e.yoffset})}},{key:"merge",value:function(e,n){return new t({x:Oe.isUnknown(n.x)?e.x:n.x,y:Oe.isUnknown(n.y)?e.y:n.y,xoffset:Oe.isUnknown(n.xoffset)?e.xoffset:n.xoffset,yoffset:Oe.isUnknown(n.yoffset)?e.yoffset:n.yoffset})}}])}(),Pe=function(){function t(e,n){we(this,t),"object"===be(e)?(this.xalign=Oe.orUnknown(e.xalign),this.yalign=Oe.orUnknown(e.yalign),this.xoffset=Oe.orUnknown(e.xoffset),this.yoffset=Oe.orUnknown(e.yoffset)):(this.xalign=Oe.orUnknown(e),this.yalign=Oe.orUnknown(n),this.xoffset=Oe.Unknown,this.yoffset=Oe.Unknown)}return Se(t,[{key:"toCSS",value:function(){return{x:Oe.isUnknown(this.xalign)?this.xalign:"".concat(100*this.xalign,"%"),y:Oe.isUnknown(this.yalign)?this.yalign:"".concat(100*this.yalign,"%"),xoffset:this.xoffset,yoffset:this.yoffset}}}],[{key:"isAlignPosition",value:function(e){return e instanceof t}}])}();function je(t){let e;return()=>(void 0===e&&(e=t()),e)}const Ce=je((()=>void 0!==window.ScrollTimeline));class Ie{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}then(t,e){return Promise.all(this.animations).then(t).catch(e)}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t,e){const n=this.animations.map((n=>Ce()&&n.attachTimeline?n.attachTimeline(t):e(n)));return()=>{n.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;e<this.animations.length;e++)t=Math.max(t,this.animations[e].duration);return t}runAll(t){this.animations.forEach((e=>e[t]()))}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const Le=t=>1e3*t,Ne=t=>t/1e3;function Re(t,e){return e?t*(1e3/e):0}const Me=5;function Fe(t,e,n){const r=Math.max(e-Me,0);return Re(n-t(r),e-r)}const De=t=>t;let Be=De,Ve=De;const Ge=(t,e,n)=>n>e?e:n<t?t:n,Ue=.001,ze=.01,He=10,We=.05,$e=1;function Ye({duration:t=800,bounce:e=.25,velocity:n=0,mass:r=1}){let o,i;Be(t<=Le(He),"Spring duration must be 10 seconds or less");let a=1-e;a=Ge(We,$e,a),t=Ge(ze,He,Ne(t)),a<1?(o=e=>{const r=e*a,o=r*t,i=r-n,s=Xe(e,a),u=Math.exp(-o);return Ue-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=Xe(Math.pow(e,2),a);return(-o(e)+Ue>0?-1:1)*((i-s)*u)/c}):(o=e=>Math.exp(-e*t)*((e-n)*t+1)-Ue,i=e=>Math.exp(-e*t)*(t*t*(n-e)));const s=function(t,e,n){let r=n;for(let n=1;n<qe;n++)r-=t(r)/e(r);return r}(o,i,5/t);if(t=Le(t),isNaN(s))return{stiffness:100,damping:10,duration:t};{const e=Math.pow(s,2)*r;return{stiffness:e,damping:2*a*Math.sqrt(r*e),duration:t}}}const qe=12;function Xe(t,e){return t*Math.sqrt(1-e*e)}const Ke=["duration","bounce"],Ze=["stiffness","damping","mass"];function Qe(t,e){return e.some((e=>void 0!==t[e]))}function Je({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(!Qe(t,Ze)&&Qe(t,Ke)){const n=Ye(t);e={...e,...n,mass:1},e.isResolvedFromDuration=!0}return e}({...r,velocity:-Ne(r.velocity||0)}),d=f||0,h=u/(2*Math.sqrt(s*c)),y=i-o,v=Ne(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=Xe(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?Le(d):Fe(g,t,r));const s=Math.abs(o)<=n,u=Math.abs(i-r)<=e;a.done=s&&u}return a.value=a.done?i:r,a}}}const tn=2e4;function en(t){let e=0;let n=t.next(e);for(;!n.done&&e<tn;)e+=50,n=t.next(e);return e>=tn?1/0:e}function nn(t,e=100,n){const r=n({...t,keyframes:[0,e]}),o=Math.min(en(r),tn);return{type:"keyframes",ease:t=>r.next(o*t).value/e,duration:Ne(o)}}const rn=(t,e,n)=>t+(e-t)*n,on=(t,e,n)=>{const r=e-t;return 0===r?1:(n-t)/r};function an(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const o=on(0,e,r);t.push(rn(n,1,o))}}function sn(t){const e=[0];return an(e,t.length-1),e}const un=t=>Boolean(t&&t.getVelocity);function cn(t){return"object"==typeof t&&!Array.isArray(t)}function ln(t,e,n,r){return"string"==typeof t&&cn(e)?function(t,e,n){var r;if("string"==typeof t){let o=document;e&&(Ve(Boolean(e.current),"Scope provided, but no element detected."),o=e.current),n?(null!==(r=n[t])&&void 0!==r||(n[t]=o.querySelectorAll(t)),t=n[t]):t=o.querySelectorAll(t)}else t instanceof Element&&(t=[t]);return Array.from(t||[])}(t,n,r):t instanceof NodeList?Array.from(t):Array.isArray(t)?t:[t]}function fn(t){return"function"==typeof t}function pn(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 dn=(t,e,n)=>{const r=e-t;return((n-t)%r+r)%r+t},hn=t=>Array.isArray(t)&&"number"!=typeof t[0];function yn(t,e){return hn(t)?t[dn(0,t.length,e)]:t}function vn(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}function mn(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&&(vn(t,o),r--)}}(t,o,i);for(let a=0;a<e.length;a++)t.push({value:e[a],at:rn(o,i,r[a]),easing:yn(n,a)})}function gn(t,e){return t.at===e.at?null===t.value?1:null===e.value?-1:0:t.at-e.at}const bn="easeInOut";function wn(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function _n(t,e){return e[t]||(e[t]=[]),e[t]}function Sn(t){return Array.isArray(t)?t:[t]}function kn(t,e){return t&&t[e]?{...t,...t[e]}:{...t}}const xn=t=>"number"==typeof t,An=t=>t.every(xn),On=new WeakMap,Tn=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],En=new Set(Tn),Pn={type:"spring",stiffness:500,damping:25,restSpeed:10},jn={type:"keyframes",duration:.8},Cn={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},In=(t,{keyframes:e})=>e.length>2?jn:En.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:Pn:Cn;function Ln(t,e){return t?t[e]||t.default||t:void 0}const Nn=!1,Rn=!1,Mn=!1,Fn=t=>null!==t;function Dn(t,{repeat:e,repeatType:n="loop"},r){const o=t.filter(Fn),i=e&&"loop"!==n&&e%2==1?0:o.length-1;return i&&void 0!==r?r:o[i]}const Bn=["read","resolveKeyframes","update","preRender","render","postRender"];function Vn(t,e){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=Bn.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=Rn?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:Bn.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<Bn.length;e++)a[Bn[e]].cancel(t)},state:o,steps:a}}const{schedule:Gn,cancel:Un,state:zn,steps:Hn}=Vn("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:De,!0),Wn=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,$n=1e-7,Yn=12;function qn(t,e,n,r){if(t===e&&n===r)return De;const o=e=>function(t,e,n,r,o){let i,a,s=0;do{a=e+(n-e)/2,i=Wn(a,r,o)-t,i>0?n=a:e=a}while(Math.abs(i)>$n&&++s<Yn);return a}(e,0,1,t,n);return t=>0===t||1===t?t:Wn(o(t),e,r)}const Xn=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Kn=t=>e=>1-t(1-e),Zn=qn(.33,1.53,.69,.99),Qn=Kn(Zn),Jn=Xn(Qn),tr=t=>(t*=2)<1?.5*Qn(t):.5*(2-Math.pow(2,-10*(t-1))),er=t=>1-Math.sin(Math.acos(t)),nr=Kn(er),rr=Xn(er),or=t=>/^0[^.\s]+$/u.test(t);const ir=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),ar=t=>e=>"string"==typeof e&&e.startsWith(t),sr=ar("--"),ur=ar("var(--"),cr=t=>!!ur(t)&&lr.test(t.split("/*")[0].trim()),lr=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,fr=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function pr(t,e,n=1){Ve(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=fr.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 ir(t)?parseFloat(t):t}return cr(o)?pr(o,e,n+1):o}const dr={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},hr={...dr,transform:t=>Ge(0,1,t)},yr={...dr,default:1},vr=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),mr=vr("deg"),gr=vr("%"),br=vr("px"),wr=vr("vh"),_r=vr("vw"),Sr={...gr,parse:t=>gr.parse(t)/100,transform:t=>gr.transform(100*t)},kr=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),xr=t=>t===dr||t===br,Ar=(t,e)=>parseFloat(t.split(", ")[e]),Or=(t,e)=>(n,{transform:r})=>{if("none"===r||!r)return 0;const o=r.match(/^matrix3d\((.+)\)$/u);if(o)return Ar(o[1],e);{const e=r.match(/^matrix\((.+)\)$/u);return e?Ar(e[1],t):0}},Tr=new Set(["x","y","z"]),Er=Tn.filter((t=>!Tr.has(t)));const Pr={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:Or(4,13),y:Or(5,14)};Pr.translateX=Pr.x,Pr.translateY=Pr.y;const jr=t=>e=>e.test(t),Cr=[dr,br,gr,mr,_r,wr,{test:t=>"auto"===t,parse:t=>t}],Ir=t=>Cr.find(jr(t)),Lr=new Set;let Nr=!1,Rr=!1;function Mr(){if(Rr){const t=Array.from(Lr).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 Er.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)}))}Rr=!1,Nr=!1,Lr.forEach((t=>t.complete())),Lr.clear()}function Fr(){Lr.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(Rr=!0)}))}class Dr{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?(Lr.add(this),Nr||(Nr=!0,Gn.read(Fr),Gn.resolveKeyframes(Mr))):(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),Lr.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Lr.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const Br=t=>Math.round(1e5*t)/1e5,Vr=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const Gr=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Ur=(t,e)=>n=>Boolean("string"==typeof n&&Gr.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),zr=(t,e,n)=>r=>{if("string"!=typeof r)return r;const[o,i,a,s]=r.match(Vr);return{[t]:parseFloat(o),[e]:parseFloat(i),[n]:parseFloat(a),alpha:void 0!==s?parseFloat(s):1}},Hr={...dr,transform:t=>Math.round((t=>Ge(0,255,t))(t))},Wr={test:Ur("rgb","red"),parse:zr("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+Hr.transform(t)+", "+Hr.transform(e)+", "+Hr.transform(n)+", "+Br(hr.transform(r))+")"};const $r={test:Ur("#"),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:Wr.transform},Yr={test:Ur("hsl","hue"),parse:zr("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+gr.transform(Br(e))+", "+gr.transform(Br(n))+", "+Br(hr.transform(r))+")"},qr={test:t=>Wr.test(t)||$r.test(t)||Yr.test(t),parse:t=>Wr.test(t)?Wr.parse(t):Yr.test(t)?Yr.parse(t):$r.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?Wr.transform(t):Yr.transform(t)},Xr=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const Kr="number",Zr="color",Qr="var",Jr="var(",to="${}",eo=/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 no(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},o=[];let i=0;const a=e.replace(eo,(t=>(qr.test(t)?(r.color.push(i),o.push(Zr),n.push(qr.parse(t))):t.startsWith(Jr)?(r.var.push(i),o.push(Qr),n.push(t)):(r.number.push(i),o.push(Kr),n.push(parseFloat(t))),++i,to))).split(to);return{values:n,split:a,indexes:r,types:o}}function ro(t){return no(t).values}function oo(t){const{split:e,types:n}=no(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===Kr?Br(t[i]):e===Zr?qr.transform(t[i]):t[i]}return o}}const io=t=>"number"==typeof t?0:t;const ao={test:function(t){var e,n;return isNaN(t)&&"string"==typeof t&&((null===(e=t.match(Vr))||void 0===e?void 0:e.length)||0)+((null===(n=t.match(Xr))||void 0===n?void 0:n.length)||0)>0},parse:ro,createTransformer:oo,getAnimatableNone:function(t){const e=ro(t);return oo(t)(e.map(io))}},so=new Set(["brightness","contrast","saturate","opacity"]);function uo(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[r]=n.match(Vr)||[];if(!r)return t;const o=n.replace(r,"");let i=so.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+o+")"}const co=/\b([a-z-]*)\(.*?\)/gu,lo={...ao,getAnimatableNone:t=>{const e=t.match(co);return e?e.map(uo).join(" "):t}},fo={borderWidth:br,borderTopWidth:br,borderRightWidth:br,borderBottomWidth:br,borderLeftWidth:br,borderRadius:br,radius:br,borderTopLeftRadius:br,borderTopRightRadius:br,borderBottomRightRadius:br,borderBottomLeftRadius:br,width:br,maxWidth:br,height:br,maxHeight:br,top:br,right:br,bottom:br,left:br,padding:br,paddingTop:br,paddingRight:br,paddingBottom:br,paddingLeft:br,margin:br,marginTop:br,marginRight:br,marginBottom:br,marginLeft:br,backgroundPositionX:br,backgroundPositionY:br},po={rotate:mr,rotateX:mr,rotateY:mr,rotateZ:mr,scale:yr,scaleX:yr,scaleY:yr,scaleZ:yr,skew:mr,skewX:mr,skewY:mr,distance:br,translateX:br,translateY:br,translateZ:br,x:br,y:br,z:br,perspective:br,transformPerspective:br,opacity:hr,originX:Sr,originY:Sr,originZ:br},ho={...dr,transform:Math.round},yo={...fo,...po,zIndex:ho,size:br,fillOpacity:hr,strokeOpacity:hr,numOctaves:ho},vo={...yo,color:qr,backgroundColor:qr,outlineColor:qr,fill:qr,stroke:qr,borderColor:qr,borderTopColor:qr,borderRightColor:qr,borderBottomColor:qr,borderLeftColor:qr,filter:lo,WebkitFilter:lo},mo=t=>vo[t];function go(t,e){let n=mo(t);return n!==lo&&(n=ao),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const bo=new Set(["auto","none","0"]);class wo extends Dr{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(),cr(r))){const o=pr(r,e.current);void 0!==o&&(t[n]=o),n===t.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!kr.has(n)||2!==t.length)return;const[r,o]=t,i=Ir(r),a=Ir(o);if(i!==a)if(xr(i)&&xr(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||or(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&&!bo.has(e)&&no(e).values.length&&(r=t[o]),o++}if(r&&n)for(const o of e)t[o]=go(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=Pr[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]=Pr[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 _o;function So(){_o=void 0}const ko={now:()=>(void 0===_o&&ko.set(zn.isProcessing||Rn?zn.timestamp:performance.now()),_o),set:t=>{_o=t,queueMicrotask(So)}},xo=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!ao.test(t)&&"0"!==t||t.startsWith("url(")));function Ao(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=xo(o,e),s=xo(i,e);return Be(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||fn(n))&&r)}class Oo{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=ko.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||(Fr(),Mr()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=ko.now(),this.hasAttemptedResolve=!0;const{name:n,type:r,velocity:o,delay:i,onComplete:a,onUpdate:s,isGenerator:u}=this.options;if(!u&&!Ao(t,n,r,o)){if(Mn||!i)return null==s||s(Dn(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 To({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,_=Je({keyframes:[p.value,d(p.value)],velocity:Fe(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 Eo=qn(.42,0,1,1),Po=qn(0,0,.58,1),jo=qn(.42,0,.58,1),Co=t=>Array.isArray(t)&&"number"==typeof t[0],Io={linear:De,easeIn:Eo,easeInOut:jo,easeOut:Po,circIn:er,circInOut:rr,circOut:nr,backIn:Qn,backInOut:Jn,backOut:Zn,anticipate:tr},Lo=t=>{if(Co(t)){Ve(4===t.length,"Cubic bezier arrays must contain four numerical values.");const[e,n,r,o]=t;return qn(e,n,r,o)}return"string"==typeof t?(Ve(void 0!==Io[t],`Invalid easing type '${t}'`),Io[t]):t},No=(t,e)=>n=>e(t(n)),Ro=(...t)=>t.reduce(No);function Mo(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 Fo(t,e){return n=>n>0?e:t}const Do=(t,e,n)=>{const r=t*t,o=n*(e*e-r)+r;return o<0?0:Math.sqrt(o)},Bo=[$r,Wr,Yr];function Vo(t){const e=(n=t,Bo.find((t=>t.test(n))));var n;if(Be(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===Yr&&(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=Mo(s,r,t+1/3),i=Mo(s,r,t),a=Mo(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 Go=(t,e)=>{const n=Vo(t),r=Vo(e);if(!n||!r)return Fo(t,e);const o={...n};return t=>(o.red=Do(n.red,r.red,t),o.green=Do(n.green,r.green,t),o.blue=Do(n.blue,r.blue,t),o.alpha=rn(n.alpha,r.alpha,t),Wr.transform(o))},Uo=new Set(["none","hidden"]);function zo(t,e){return n=>rn(t,e,n)}function Ho(t){return"number"==typeof t?zo:"string"==typeof t?cr(t)?Fo:qr.test(t)?Go:Yo:Array.isArray(t)?Wo:"object"==typeof t?qr.test(t)?Go:$o:Fo}function Wo(t,e){const n=[...t],r=n.length,o=t.map(((t,n)=>Ho(t)(t,e[n])));return t=>{for(let e=0;e<r;e++)n[e]=o[e](t);return n}}function $o(t,e){const n={...t,...e},r={};for(const o in n)void 0!==t[o]&&void 0!==e[o]&&(r[o]=Ho(t[o])(t[o],e[o]));return t=>{for(const e in r)n[e]=r[e](t);return n}}const Yo=(t,e)=>{const n=ao.createTransformer(e),r=no(t),o=no(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?Uo.has(t)&&!o.values.length||Uo.has(e)&&!r.values.length?function(t,e){return Uo.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):Ro(Wo(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):(Be(!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.`),Fo(t,e))};function qo(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return rn(t,e,n);return Ho(t)(t,e)}function Xo(t,e,{clamp:n=!0,ease:r,mixer:o}={}){const i=t.length;if(Ve(i===e.length,"Both input and output ranges must be the same length"),1===i)return()=>e[0];if(2===i&&t[0]===t[1])return()=>e[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const a=function(t,e,n){const r=[],o=n||qo,i=t.length-1;for(let n=0;n<i;n++){let i=o(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]||De:e;i=Ro(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=on(t[n],t[n+1],e);return a[n](r)};return n?e=>u(Ge(t[0],t[i-1],e)):u}function Ko({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const o=hn(r)?r.map(Lo):Lo(r),i={done:!1,value:e[0]},a=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:sn(e),t),s=Xo(a,e,{ease:Array.isArray(o)?o:(u=e,c=o,u.map((()=>c||jo)).splice(0,u.length-1))});var u,c;return{calculatedDuration:t,next:e=>(i.value=s(e),i.done=e>=t,i)}}const Zo=t=>{const e=({timestamp:e})=>t(e);return{start:()=>Gn.update(e,!0),stop:()=>Un(e),now:()=>zn.isProcessing?zn.timestamp:ko.now()}},Qo={decay:To,inertia:To,tween:Ko,keyframes:Ko,spring:Je},Jo=t=>t/100;class ti extends Oo{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)||Dr;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=fn(e)?e:Qo[e]||Ko;let s,u;a!==Ko&&"number"!=typeof t[0]&&(s=Ro(Jo,qo(t[0],t[1])),t=[0,100]);const c=a({...this.options,keyframes:t});"mirror"===o&&(u=a({...this.options,keyframes:[...t].reverse(),velocity:-i})),null===c.calculatedDuration&&(c.calculatedDuration=en(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=Ge(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=Dn(s,this.options,r)),y&&y(w.value),S&&this.finish(),w}get duration(){const{resolved:t}=this;return t?Ne(t.calculatedDuration):0}get time(){return Ne(this.currentTime)}set time(t){t=Le(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=Ne(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=Zo,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 ei=new Set(["opacity","clipPath","filter","transform"]),ni=(t,e)=>{let n="";const r=Math.max(Math.round(e/10),2);for(let e=0;e<r;e++)n+=t(on(0,r-1,e))+", ";return`linear(${n.substring(0,n.length-2)})`},ri={linearEasing:void 0};function oi(t,e){const n=je(t);return()=>{var t;return null!==(t=ri[e])&&void 0!==t?t:n()}}const ii=oi((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing");function ai(t){return Boolean("function"==typeof t&&ii()||!t||"string"==typeof t&&(t in ui||ii())||Co(t)||Array.isArray(t)&&t.every(ai))}const si=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,ui={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:si([0,.65,.55,1]),circOut:si([.55,0,1,.45]),backIn:si([.31,.01,.66,-.59]),backOut:si([.33,1.53,.69,.99])};function ci(t,e){return t?"function"==typeof t&&ii()?ni(t,e):Co(t)?si(t):Array.isArray(t)?t.map((t=>ci(t,e)||ui.easeOut)):ui[t]:void 0}function li(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=ci(s,o);return Array.isArray(l)&&(c.easing=l),t.animate(c,{delay:r,duration:o,easing:Array.isArray(l)?"linear":l,fill:"both",iterations:i+1,direction:"reverse"===a?"alternate":"normal"})}function fi(t,e){t.timeline=e,t.onfinish=null}const pi=je((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));const di={anticipate:tr,backInOut:Jn,circInOut:rr};class hi extends Oo{constructor(t){super(t);const{name:e,motionValue:n,element:r,keyframes:o}=this.options;this.resolver=new wo(o,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}initPlayback(t,e){var n;let{duration:r=300,times:o,ease:i,type:a,motionValue:s,name:u,startTime:c}=this.options;if(!(null===(n=s.owner)||void 0===n?void 0:n.current))return!1;if("string"==typeof i&&ii()&&i in di&&(i=di[i]),function(t){return fn(t.type)||"spring"===t.type||!ai(t.ease)}(this.options)){const{onComplete:e,onUpdate:n,motionValue:s,element:u,...c}=this.options,l=function(t,e){const n=new ti({...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=li(s.owner.current,u,t,{...this.options,duration:r,times:o,ease:i});return l.startTime=null!=c?c:this.calcStartTime(),this.pendingTimeline?(fi(l,this.pendingTimeline),this.pendingTimeline=void 0):l.onfinish=()=>{const{onComplete:n}=this.options;s.set(Dn(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 Ne(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return Ne(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.currentTime=Le(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 De;const{animation:n}=e;fi(n,t)}else this.pendingTimeline=t;return De}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 ti({...c,keyframes:n,duration:r,type:o,ease:i,times:a,isGenerator:!0}),f=Le(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 pi()&&n&&ei.has(n)&&e&&e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate&&!r&&"mirror"!==o&&0!==i&&"inertia"!==a}}const yi=(t,e,n,r={},o,i)=>a=>{const s=Ln(r,t)||{},u=s.delay||r.delay||0;let{elapsed:c=0}=r;c-=Le(u);let l={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...s,delay:-c,onUpdate:t=>{e.set(t),s.onUpdate&&s.onUpdate(t)},onComplete:()=>{a(),s.onComplete&&s.onComplete()},name:t,motionValue:e,element:i?void 0:o};(function({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:o,repeat:i,repeatType:a,repeatDelay:s,from:u,elapsed:c,...l}){return!!Object.keys(l).length})(s)||(l={...l,...In(t,l)}),l.duration&&(l.duration=Le(l.duration)),l.repeatDelay&&(l.repeatDelay=Le(l.repeatDelay)),void 0!==l.from&&(l.keyframes[0]=l.from);let f=!1;if((!1===l.type||0===l.duration&&!l.repeatDelay)&&(l.duration=0,0===l.delay&&(f=!0)),(Mn||Nn)&&(f=!0,l.duration=0,l.delay=0),f&&!i&&void 0!==e.get()){const t=Dn(l.keyframes,s);if(void 0!==t)return Gn.update((()=>{l.onUpdate(t),l.onComplete()})),new Ie([])}return!i&&hi.supports(l)?new hi(l):new ti(l)},vi=t=>Array.isArray(t),mi=t=>Boolean(t&&"object"==typeof t&&t.mix&&t.toValue),gi=t=>vi(t)?t[t.length-1]||0:t;class bi{constructor(){this.subscriptions=[]}add(t){var e,n;return e=this.subscriptions,n=t,-1===e.indexOf(n)&&e.push(n),()=>vn(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 wi={current:void 0};class _i{constructor(t,e={}){this.version="11.11.9",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=ko.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=ko.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 bi);const n=this.events[t].add(e);return"change"===t?()=>{n(),Gn.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 wi.current&&wi.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=ko.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return Re(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 _i(t,e)}function ki(t){const e=[{},{}];return null==t||t.values.forEach(((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()})),e}function xi(t,e,n,r){if("function"==typeof e){const[o,i]=ki(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]=ki(r);e=e(void 0!==n?n:t.custom,o,i)}return e}function Ai(t,e,n){const r=t.getProps();return xi(r,e,void 0!==n?n:r.custom,t)}function Oi(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Si(n))}const Ti=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Ei="data-"+Ti("framerAppearId");function Pi(t){return t.props[Ei]}function ji(t,e){if(!t.applyWillChange)return;const n=t.getValue("willChange");return r=n,Boolean(un(r)&&r.add)?n.add(e):void 0;var r}function Ci({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,r}function Ii(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&&Ci(l,e))continue;const s={delay:n,...Ln(a||{},e)};let f=!1;if(window.MotionHandoffAnimation){const n=Pi(t);if(n){const t=window.MotionHandoffAnimation(n,e,Gn);null!==t&&(s.startTime=t,f=!0)}}ji(t,e),r.start(yi(e,r,o,t.shouldReduceMotion&&En.has(e)?{type:!1}:s,t,f));const p=r.animation;p&&c.push(p)}return s&&Promise.all(c).then((()=>{Gn.update((()=>{s&&function(t,e){const n=Ai(t,e);let{transitionEnd:r={},transition:o={},...i}=n||{};i={...i,...r};for(const e in i)Oi(t,e,gi(i[e]))}(t,s)}))})),c}const Li={};function Ni(t,{layout:e,layoutId:n}){return En.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!Li[t]||"opacity"===t)}function Ri(t,e,n){var r;const{style:o}=t,i={};for(const a in o)(un(o[a])||e.style&&un(e.style[a])||Ni(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 Mi(t,e,n){const r=Ri(t,e,n);for(const n in t)if(un(t[n])||un(e[n])){r[-1!==Tn.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=t[n]}return r}const Fi="undefined"!=typeof window,Di={current:null},Bi={current:!1};function Vi(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function Gi(t){return"string"==typeof t||Array.isArray(t)}const Ui=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],zi=["initial",...Ui];function Hi(t){return Vi(t.animate)||zi.some((e=>Gi(t[e])))}function Wi(t){return Boolean(Hi(t)||t.variants)}const $i={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"]},Yi={};for(const t in $i)Yi[t]={isEnabled:e=>$i[t].some((t=>!!e[t]))};const qi=[...Cr,qr,ao],Xi=()=>({x:{min:0,max:0},y:{min:0,max:0}}),Ki=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Zi{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=Dr,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=ko.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,Gn.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=Hi(e),this.isVariantNode=Wi(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]&&un(e)&&e.set(s[t],!1)}}mount(t){this.current=t,On.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))),Bi.current||function(){if(Bi.current=!0,Fi)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Di.current=t.matches;t.addListener(e),e()}else Di.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||Di.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){On.delete(this.current),this.projection&&this.projection.unmount(),Un(this.notifyUpdate),Un(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=En.has(t),r=e.on("change",(e=>{this.latestValues[t]=e,this.props.onUpdate&&Gn.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 Yi){const e=Yi[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<Ki.length;e++){const n=Ki[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(un(o))t.addValue(r,o);else if(un(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}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&&(ir(r)||or(r))?r=parseFloat(r):(o=r,!qi.find(jr(o))&&ao.test(e)&&(r=go(t,e))),this.setBaseTarget(t,un(r)?r.get():r)),un(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=xi(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||un(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 bi),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class Qi extends Zi{constructor(){super(...arguments),this.KeyframeResolver=wo}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 Ji=(t,e)=>e&&"number"==typeof t?e.transform(t):t,ta={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},ea=Tn.length;function na(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(En.has(t))a=!0;else if(sr(t))o[t]=n;else{const e=Ji(n,yo[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<ea;i++){const a=Tn[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=Ji(s,yo[a]);u||(o=!1,r+=`${ta[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 ra(t,e,n){return"string"==typeof t?t:br.transform(e+n*t)}const oa={offset:"stroke-dashoffset",array:"stroke-dasharray"},ia={offset:"strokeDashoffset",array:"strokeDasharray"};function aa(t,{attrX:e,attrY:n,attrScale:r,originX:o,originY:i,pathLength:a,pathSpacing:s=1,pathOffset:u=0,...c},l,f){if(na(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`${ra(e,t.x,t.width)} ${ra(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?oa:ia;t[i.offset]=br.transform(-r);const a=br.transform(e),s=br.transform(n);t[i.array]=`${a} ${s}`}(p,a,s,u,!1)}const sa=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 ua(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 ca(t,e,n,r){ua(t,e,void 0,r);for(const n in e.attrs)t.setAttribute(sa.has(n)?n:Ti(n),e.attrs[n])}const la=t=>"string"==typeof t&&"svg"===t.toLowerCase();class fa extends Qi{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Xi}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(En.has(e)){const t=mo(e);return t&&t.default||0}return e=sa.has(e)?e:Ti(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return Mi(t,e,n)}build(t,e,n){aa(t,e,this.isSVGTag,n.transformTemplate)}renderInstance(t,e,n,r){ca(t,e,0,r)}mount(t){this.isSVGTag=la(t.tagName),super.mount(t)}}function pa(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 da extends Qi{constructor(){super(...arguments),this.type="html",this.applyWillChange=!0,this.renderInstance=ua}readValueFromInstance(t,e){if(En.has(e)){const t=mo(e);return t&&t.default||0}{const r=(n=t,window.getComputedStyle(n)),o=(sr(e)?r.getPropertyValue(e):r[e])||0;return"string"==typeof o?o.trim():o}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return pa(t,e)}build(t,e,n){na(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return Ri(t,e,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;un(t)&&(this.childSubscription=t.on("change",(t=>{this.current&&(this.current.textContent=`${t}`)})))}}class ha extends Zi{constructor(){super(...arguments),this.type="object"}readValueFromInstance(t,e){if(function(t,e){return t in e}(e,t)){const n=t[e];if("string"==typeof n||"number"==typeof n)return n}}getBaseTargetFromProps(){}removeValueFromRenderState(t,e){delete e.output[t]}measureInstanceViewportBox(){return{x:{min:0,max:0},y:{min:0,max:0}}}build(t,e){Object.assign(t.output,e)}renderInstance(t,{output:e}){Object.assign(t,e)}sortInstanceNodePosition(){return 0}}function ya(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 fa(e):new da(e);n.mount(t),On.set(t,n)}function va(t){const e=new ha({presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}});e.mount(t),On.set(t,e)}function ma(t,e,n,r){const o=[];if(function(t,e){return un(t)||"number"==typeof t||"string"==typeof t&&!cn(e)}(t,e))o.push(function(t,e,n){const r=un(t)?t:Si(t);return r.start(yi("",r,e,n)),r.animation}(t,cn(e)&&e.default||e,n&&n.default||n));else{const i=ln(t,e,r),a=i.length;Ve(Boolean(a),"No valid elements provided.");for(let t=0;t<a;t++){const r=i[t],s=r instanceof Element?ya:va;On.has(r)||s(r);const u=On.get(r),c={...n};"delay"in c&&"function"==typeof c.delay&&(c.delay=c.delay(t,a)),o.push(...Ii(u,{...e,transition:c},{}))}}return o}function ga(t,e,n){const r=[],o=function(t,{defaultTransition:e={},...n}={},r,o){const i=e.duration||.3,a=new Map,s=new Map,u={},c=new Map;let l=0,f=0,p=0;for(let n=0;n<t.length;n++){const a=t[n];if("string"==typeof a){c.set(a,f);continue}if(!Array.isArray(a)){c.set(a.name,pn(f,a.at,l,c));continue}let[d,h,y={}]=a;void 0!==y.at&&(f=pn(f,y.at,l,c));let v=0;const m=(t,n,r,a=0,s=0)=>{const u=Sn(t),{delay:c=0,times:l=sn(u),type:d="keyframes",...h}=n;let{ease:y=e.ease||"easeOut",duration:m}=n;const g="function"==typeof c?c(a,s):c,b=u.length,w=fn(d)?d:null==o?void 0:o[d];if(b<=2&&w){let t=100;if(2===b&&An(u)){const e=u[1]-u[0];t=Math.abs(e)}const e={...h};void 0!==m&&(e.duration=Le(m));const n=nn(e,t,w);y=n.ease,m=n.duration}null!=m||(m=i);const _=f+g,S=_+m;1===l.length&&0===l[0]&&(l[1]=1);const k=l.length-u.length;k>0&&an(l,k),1===u.length&&u.unshift(null),mn(r,u,y,l,_,S),v=Math.max(g+m,v),p=Math.max(S,p)};if(un(d))m(h,y,_n("default",wn(d,s)));else{const t=ln(d,h,r,u),e=t.length;for(let n=0;n<e;n++){const r=wn(t[n],s);for(const t in h)m(h[t],kn(y,t),_n(t,r),n,e)}}l=f,f+=v}return s.forEach(((t,r)=>{for(const o in t){const i=t[o];i.sort(gn);const s=[],u=[],c=[];for(let t=0;t<i.length;t++){const{at:e,value:n,easing:r}=i[t];s.push(n),u.push(on(0,p,e)),c.push(r||"easeOut")}0!==u[0]&&(u.unshift(0),s.unshift(s[0]),c.unshift(bn)),1!==u[u.length-1]&&(u.push(1),s.push(null)),a.has(r)||a.set(r,{keyframes:{},transition:{}});const l=a.get(r);l.keyframes[o]=s,l.transition[o]={...e,duration:p,ease:c,times:u,...n}}})),a}(t,e,n,{spring:Je});return o.forEach((({keyframes:t,transition:e},n)=>{r.push(...ma(n,t,e))})),r}const ba=function(t,e,n){let r=[];var o;o=t,r=Array.isArray(o)&&Array.isArray(o[0])?ga(t,e,wa):ma(t,e,n,wa);const i=new Ie(r);return wa&&wa.animations.push(i),i};var wa;function _a(t){return _a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_a(t)}function Sa(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Sa=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:O(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",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"==_a(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,n,r){var o=p;return function(i,a){if(o===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=T(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 T(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,T(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 E(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(E,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(_a(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 ka(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Aa(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 xa(t){return function(t){if(Array.isArray(t))return Oa(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Aa(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 Aa(t,e){if(t){if("string"==typeof t)return Oa(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)?Oa(t,e):void 0}}function Oa(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 Ta(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,Pa(r.key),r)}}function Ea(t,e,n){return(e=Pa(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Pa(t){var e=function(t,e){if("object"!=_a(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=_a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==_a(e)?e:e+""}var ja=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())}))},Ca=Ea(Ea(Ea({},me,"25.33%"),ve,"50%"),ge,"75.66%"),Ia=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,xa(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&&Ta(t.prototype,e),n&&Ta(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"animate",value:function(e,n,r){var o=e.scope,i=e.overwrites,a=e.target;return ja(this,void 0,void 0,Sa().mark((function e(){var s=this;return Sa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){ja(s,void 0,void 0,Sa().mark((function s(){var u,c,l,f,p=this;return Sa().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:this.sequenceOptions.sync||e(),u=0;case 2:if(!(u<this.sequenceOptions.repeat)){s.next=22;break}c=ka(this.sequences),s.prev=4,f=Sa().mark((function e(){var r,s,u,c,f,d;return Sa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=l.value,s=r.props,u=r.options,c=b({},p.propToCSS(n,a.state)),o.current){e.next=4;break}throw new Error("No scope found when animating.");case 4:if(f=o.current,Object.assign(f.style,c),a.state=t.mergeState(a.state,s),d=ba(f,p.propToCSS(n,a.state,i),p.optionsToFramerMotionOptions(u)||{}),p.setControl(d),n.logger.debug("Animating",p.propToCSS(n,a.state,i)),!1!==(null==u?void 0:u.sync)){e.next=14;break}d.then((function(){Object.assign(f.style,p.propToCSS(n,a.state,i)),p.setControl(null)})),e.next=18;break;case 14:return e.next=16,new Promise((function(t){return d.then((function(){return t()}))}));case 16:Object.assign(f.style,p.propToCSS(n,a.state,i)),p.setControl(null);case 18:case"end":return e.stop()}}),e)})),c.s();case 7:if((l=c.n()).done){s.next=11;break}return s.delegateYield(f(),"t0",9);case 9:s.next=7;break;case 11:s.next=16;break;case 13:s.prev=13,s.t1=s.catch(4),c.e(s.t1);case 16:return s.prev=16,c.f(),s.finish(16);case 19:u++,s.next=2;break;case 22:return s.next=24,A(2);case 24:this.setControl(null),e(),r&&r(a.state);case 27:case"end":return s.stop()}}),s,this,[[4,13,16,19]])})))})));case 1:case"end":return e.stop()}}),e)})))}},{key:"repeat",value:function(t){return this.sequenceOptions.repeat*=t,this}},{key:"overwrite",value:function(t,e){return this.transformers[t]=e,this}},{key:"propToCSS",value:function(e,n,r){var o,i=(null===(o=e.getLastScene())||void 0===o?void 0:o.config)||{},a=i.invertY,s=i.invertX,u={position:function(e){return t.positionToCSS(e,a,s)},backgroundColor:function(e){return t.backgroundToCSS(e)},backgroundOpacity:function(t){return{opacity:t}},opacity:function(t){return{opacity:t}},scale:function(){return{}},rotation:function(){return{}},display:function(){return{}},src:function(){return{}},fontSize:function(t){return{fontSize:t}},fontColor:function(t){return"string"==typeof t?{color:t}:{color:S(t)}}},c={};for(var l in c.transform=t.propToCSSTransform(e,n),this.transformers.transform&&Object.assign(c,this.transformers.transform(n)),r&&r.transform&&Object.assign(c,r.transform(n)),n)Object.prototype.hasOwnProperty.call(n,l)&&(r&&r[l]?Object.assign(c,r[l](n[l])):this.transformers[l]?Object.assign(c,this.transformers[l](n[l])):u[l]&&Object.assign(c,u[l](n[l])));return c}},{key:"optionsToFramerMotionOptions",value:function(t){if(!t)return t;var e=t.duration;return{duration:e?e/1e3:0,ease:t.ease}}},{key:"setControl",value:function(t){return this.control=t,this}},{key:"getControl",value:function(){return this.control}},{key:"copy",value:function(){return new t(this.sequences,this.sequenceOptions)}}],[{key:"isPosition",value:function(t){return Te.isCommonPositionType(t)||Ee.isCoord2DPosition(t)||Pe.isAlignPosition(t)}},{key:"positionToCSS",value:function(t,e,n){return t?Oe.isRawPosition(t)?Oe.D2PositionToCSS(Oe.rawPositionToCoord2D(t),n,e):Oe.D2PositionToCSS(t.toCSS(),n,e):{}}},{key:"backgroundToCSS",value:function(t){return null==t?{}:bs.isStaticImageData(t)?{backgroundImage:"url(".concat(t.src,")")}:"string"==typeof t?{backgroundColor:t}:["r","g","b"].every((function(e){return e in t}))?{backgroundColor:S(t)}:{backgroundImage:"url("+t.url+")"}}},{key:"mergePosition",value:function(t,e){if(!t&&!e)throw new Error("No position found.");return t&&e?Oe.mergePosition(Oe.tryParsePosition(t),Oe.tryParsePosition(e)):Oe.toCoord2D(Oe.tryParsePosition(t||e))}},{key:"mergeState",value:function(t,e){var n=this.mergePosition(t.position,e.position);return Object.assign(Object.assign({},b(t,e)),{position:n})}},{key:"propToCSSTransform",value:function(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t.getLastScene())throw new Error('No scene found in state, make sure you called "scene.activate()" before this method.');var o=(null===(n=t.getLastScene())||void 0===n?void 0:n.config)||{},i=o.invertY,a=o.invertX;return["translate(".concat(r[0]||(a?"":"-")+"50%",", ").concat(r[1]||(i?"":"-")+"50%",")"),void 0!==e.rotation&&"rotate(".concat(e.rotation,"deg)"),void 0!==e.scale&&"scale(".concat(e.scale,")")].filter(Boolean).join(" ")}}])}();function La(t){return La="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},La(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"!=La(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=La(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==La(e)?e:e+""}function Ma(t,e,n){return e=Da(e),function(t,e){if(e&&("object"==La(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||[],Da(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 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)}Ia.defaultSequenceOptions={sync:!0,repeat:1},Ia.defaultOptions={duration:0,ease:"linear"},Ia.CommonImagePositionMap=Ca;var Va=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Ma(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&&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:"do",value:function(t){return this.push($t.ActionTypes.do,t)}},{key:"doAsync",value:function(t){return this.push($t.ActionTypes.doAsync,t)}},{key:"any",value:function(t){return this.push($t.ActionTypes.any,t)}},{key:"all",value:function(t){return this.push($t.ActionTypes.all,t)}},{key:"allAsync",value:function(t){return this.push($t.ActionTypes.allAsync,t)}},{key:"repeat",value:function(t,e){return this.push($t.ActionTypes.repeat,e,t)}},{key:"sleep",value:function(t){return this.push($t.ActionTypes.sleep,[],t)}},{key:"push",value:function(t,e){for(var n=ie.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 $t(this.chain(),t,(new xt).setContent([this.construct(n)].concat(o)));return this.chain(a)}}],[{key:"do",value:function(t){return(new e).do(t)}},{key:"doAsync",value:function(t){return(new e).doAsync(t)}},{key:"any",value:function(t){return(new e).any(t)}},{key:"all",value:function(t){return(new e).all(t)}},{key:"allAsync",value:function(t){return(new e).allAsync(t)}},{key:"repeat",value:function(t,n){return(new e).repeat(t,n)}},{key:"sleep",value:function(t){return(new e).sleep(t)}}])}(ye);function Ga(t){return Ga="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ga(t)}function Ua(t,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,za(r.key),r)}}function za(t){var e=function(t,e){if("object"!=Ga(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ga(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ga(e)?e:e+""}function Ha(t,e,n){return e=$a(e),function(t,e){if(e&&("object"==Ga(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Wa()?Reflect.construct(e,n||[],$a(t).constructor):e.apply(t,n))}function Wa(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Wa=function(){return!!t})()}function $a(t){return $a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$a(t)}function Ya(t,e){return Ya=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ya(t,e)}var qa=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=Ha(this,e)).events=new k,r.ref=void 0,"string"==typeof t?(r.name=t,r.config=b(e.defaultConfig,n||{}),r.config.position&&(r.config.position=Oe.tryParsePosition(r.config.position))):(r.name="",r.config=b(e.defaultConfig,t),r.config.position&&(r.config.position=Oe.tryParsePosition(r.config.position))),r.state=b({},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&&Ya(t,e)}(e,t),function(t,e,n){return e&&Ua(t.prototype,e),n&&Ua(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(!Ia.isPosition(this.config.position))throw new Error("Invalid position\nPosition must be one of CommonImagePosition, Align, Coord2D");return this}},{key:"setSrc",value:function(t,e){var n=this;return this.combineActions(new Va,(function(r){if(e){var o=e.copy();o.setSrc(bs.srcToString(t)),r._transitionSrc(o)}var i=new as(r,as.ActionTypes.setSrc,(new xt).setContent(["string"==typeof t?t:bs.staticImageDataToSrc(t)]));return r.chain(i).chain(n._flush())}))}},{key:"applyTransform",value:function(t){var e=this;return this.combineActions(new Va,(function(n){var r=new as(n,as.ActionTypes.applyTransform,(new xt).setContent([void 0,t.copy(),x()]));return n.chain(r).chain(e._flush())}))}},{key:"show",value:function(t){var e=this,n=t instanceof Ia?t.copy():new Ia([{props:{opacity:1},options:t||{}}]);return this.combineActions(new Va,(function(t){var r=new as(t,as.ActionTypes.show,(new xt).setContent([void 0,n]));return t.chain(r).chain(e._flush())}))}},{key:"hide",value:function(t){var e=this;return this.combineActions(new Va,(function(n){var r=new as(n,as.ActionTypes.hide,(new xt).setContent([void 0,t instanceof Ia?t.copy():new Ia([{props:{opacity:0},options:t||{}}])]));return n.chain(r).chain(e._flush())}))}},{key:"toTransform",value:function(){return new Ia(this.state,{duration:0})}},{key:"setScope",value:function(t){return this.ref=t,this}},{key:"getScope",value:function(){return this.ref}},{key:"copy",value:function(){return new e(this.name,this.config)}},{key:"toData",value:function(){return this.state.disposed||O(this.state,this.config)?null:{state:b({},e.serializeImageState(this.state))}}},{key:"fromData",value:function(t){return this.state=b(this.state,e.deserializeImageState(t.state)),this}},{key:"_$setDispose",value:function(){return this.state.disposed=!0,this}},{key:"_applyTransition",value:function(t){return this.chain(new as(this.chain(),"image:applyTransition",(new xt).setContent([t])))}},{key:"_init",value:function(t){return new as(this.chain(),as.ActionTypes.init,(new xt).setContent([t]))}},{key:"_flush",value:function(){return new as(this.chain(),as.ActionTypes.flush,new xt)}},{key:"reset",value:function(){this.state=b({},this.config)}},{key:"toDisplayableTransform",value:function(){return new Ia(this.state,{duration:0})}},{key:"_transitionSrc",value:function(t){var e=t.copy();return this._applyTransition(e),this}},{key:"_dispose",value:function(){return this.chain(new as(this.chain(),as.ActionTypes.dispose,new xt))}}],[{key:"serializeImageState",value:function(t){var e={position:function(t){return Oe.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 Oe.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}}])}(ye);function Xa(t){return Xa="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},Xa(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:O(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",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"==Xa(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,n,r){var o=p;return function(i,a){if(o===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=T(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 T(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,T(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 E(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(E,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(Xa(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 Za(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Qa(r.key),r)}}function Qa(t){var e=function(t,e){if("object"!=Xa(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Xa(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Xa(e)?e:e+""}function Ja(t,e,n){return e=rs(e),function(t,e){if(e&&("object"==Xa(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,ts()?Reflect.construct(e,n||[],rs(t).constructor):e.apply(t,n))}function ts(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ts=function(){return!!t})()}function es(t,e,n,r){var o=ns(rs(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function ns(){return ns="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=rs(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}},ns.apply(null,arguments)}function rs(t){return rs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},rs(t)}function os(t,e){return os=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},os(t,e)}qa.EventTypes={"event:image.init":"event:image.init","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.flush":"event:image.flush","event:image.flushComponent":"event:image.flushComponent","event:displayable.applyTransition":"event:displayable.applyTransition","event:displayable.applyTransform":"event:displayable.applyTransform","event:displayable.init":"event:displayable.init"},qa.defaultConfig={src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",display:!1,position:new Te(he.Center),scale:1,rotation:0,opacity:0};var is=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())}))},as=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Ja(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&&os(t,e)}(e,t),function(t,e,n){return e&&Za(t.prototype,e),n&&Za(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var r=this;if(this.type===n.init){var o=t.findElementByImage(this.callee);o&&t.disposeImage(this.callee,o.scene);var i=this.contentNode.getContent()[0];t.createImage(this.callee,i);var a=new w((function(t){return t}));return is(r,void 0,void 0,Ka().mark((function e(){return Ka().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.callee.events.any("event:displayable.init");case 2:a.resolve({type:this.type,node:this.contentNode.getChild()}),t.stage.next();case 4:case"end":return e.stop()}}),e,this)}))),a}if(this.type===n.setSrc)return this.callee.state.src=this.contentNode.getContent()[0],t.logger.debug("Image - Set Src",this.callee.state.src),t.stage.update(),es(e,"executeAction",this,3)([t]);if([n.show,n.hide,n.applyTransform].includes(this.type)){var s=new w((function(t){return t})).registerSkipController(new E((function(){return r.type===n.hide&&(r.callee.state.display=!1),es(e,"executeAction",r,3)([t])}))),u=this.contentNode.getContent()[1];return this.type===n.show&&(this.callee.state.display=!0,t.stage.update()),t.animateImage(qa.EventTypes["event:displayable.applyTransform"],this.callee,[u],(function(){var t;r.type===n.hide&&(r.callee.state.display=!1),s.resolve({type:r.type,node:null===(t=r.contentNode)||void 0===t?void 0:t.getChild()})})),s}if(this.type===n.dispose)return t.disposeImage(this.callee),this.callee._$setDispose(),es(e,"executeAction",this,3)([t]);if(this.type===n.applyTransition){var c=new w((function(t){return t})).registerSkipController(new E((function(){return r.type===n.hide&&(r.callee.state.display=!1),{type:r.type,node:r.contentNode.getChild()}}))),l=this.contentNode.getContent()[0];return this.callee.events.any("event:displayable.applyTransition",l).then((function(){c.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),c}if(this.type===n.flush)return es(e,"executeAction",this,3)([t]);throw es(e,"unknownType",this,3)([])}}])}(U);function ss(t,e,n){return e=ps(e),function(t,e){if(e&&("object"==ds(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||[],ps(t).constructor):e.apply(t,n))}function us(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&fs(t,e)}function cs(t){var e="function"==typeof Map?new Map:void 0;return cs=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(ls())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var o=new(t.bind.apply(t,r));return n&&fs(o,n.prototype),o}(t,arguments,ps(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),fs(n,t)},cs(t)}function ls(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ls=function(){return!!t})()}function fs(t,e){return fs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},fs(t,e)}function ps(t){return ps=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ps(t)}function ds(t){return ds="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},ds(t)}function hs(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,ms(r.key),r)}}function vs(t,e,n){return e&&ys(t.prototype,e),n&&ys(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function ms(t){var e=function(t,e){if("object"!=ds(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ds(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ds(e)?e:e+""}as.ActionTypes=n;var gs=function(){function t(e,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;hs(this,t),this.r=e,this.g=n,this.b=r,this.a=o}return vs(t,[{key:"toString",value:function(){return"rgba(".concat(this.r,", ").concat(this.g,", ").concat(this.b,", ").concat(this.a,")")}},{key:"toHex",value:function(){return"#"+this.r.toString(16)+this.g.toString(16)+this.b.toString(16)}},{key:"toImageColor",value:function(){return{r:this.r,g:this.g,b:this.b,a:this.a}}}],[{key:"isHexString",value:function(t){return"string"==typeof t&&/^#[0-9A-F]{6}$/i.test(t)}},{key:"fromHex",value:function(e){var n=e.slice(1);return new t(parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16),8===n.length?parseInt(n.slice(6,8),16)/255:1)}}])}(),bs=function(){function t(){hs(this,t)}return vs(t,null,[{key:"srcToString",value:function(t){return"string"==typeof t?t:t.src}},{key:"staticImageDataToSrc",value:function(t){return"string"==typeof t?t:t.src}},{key:"isStaticImageData",value:function(t){return void 0!==(null==t?void 0:t.src)}},{key:"backgroundToSrc",value:function(e){return t.isStaticImageData(e)?e.src:(null==e?void 0:e.url)||null}},{key:"isExternalSrc",value:function(t){return t.startsWith("http://")||t.startsWith("https://")}},{key:"isImageSrc",value:function(e){return"string"==typeof e&&!this.isHexString(e)||t.isStaticImageData(e)}},{key:"isImageColor",value:function(e){return t.isHexString(e)||t.isPlainColor(e)}},{key:"isPlainColor",value:function(t){return t&&("string"==typeof t||"object"===ds(t)&&"r"in t&&"g"in t&&"b"in t)}},{key:"isHexString",value:function(t){return"string"==typeof t&&/^#([0-9A-F]{6}|[0-9A-F]{3})$/i.test(t)}},{key:"toBackgroundSrc",value:function(t){return"string"==typeof t?t:t.src}},{key:"toHex",value:function(t){return S(t)}}])}();bs.RGBColor=gs;var ws,_s=function(t){function e(t,n){return hs(this,e),ss(this,e,[t,{info:n},"NarraLeafReact-StaticScriptWarning"])}return us(e,t),vs(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 hs(this,e),(r=ss(this,e,[t])).props=n,r.name=o,r}return us(e,t),vs(e,null,[{key:"isUseError",value:function(t){return t instanceof e}}])}(cs(Error))),Ss=function(){return vs((function t(e){hs(this,t),this.scene=e}),[{key:"run",value:function(){if(!this.scene.sceneRoot)return null;var t=new Map,e=new Map,n=[],r=new Set,o=this.scene.getAllChildren(this.scene.sceneRoot);if(!o.length)return null;for(n.push(o[0]);n.length;){var i=n.shift();this.checkAction(i,{imageStates:t,scenes:e},r);var a=i.contentNode.getChild();a&&a.action&&n.push(a.action)}return t}},{key:"checkAction",value:function(t,n,r){var o=n.imageStates,i=n.scenes;if(t instanceof as)o.has(t.callee)||o.set(t.callee,{isDisposed:!1,usedExternalSrc:!1}),this.checkImage(o.get(t.callee),t);else if(t instanceof dt){var a=t.callee;if(i.has(a.name)){if(i.get(a.name)!==a){var s="Scene with name: ".concat(a.name," is duplicated\nScene: ").concat(a.name,"\n\nAt: ").concat(t.__stack);throw new _s(s)}}else i.set(a.name,a);if(t.type===e.jumpTo){var u=t.contentNode.getContent()[0];if(r.has(u))return;r.add(u)}}}},{key:"checkImage",value:function(t,e){if(e.type===n.dispose){if(t.isDisposed){var r="Image is disposed multiple times before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new _s(r)}t.isDisposed=!0}else if([n.init,n.show,n.hide,n.applyTransform,n.applyTransition].includes(e.type)){if(t.isDisposed){var o="Image is disposed before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new _s(o)}}else if(e.type===n.setSrc){var i=e.contentNode.getContent()[0];bs.isExternalSrc(i)&&(t.usedExternalSrc=!0)}}}])}();function ks(t){return ks="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},ks(t)}function xs(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,As(r.key),r)}}function As(t){var e=function(t,e){if("object"!=ks(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ks(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ks(e)?e:e+""}function Os(t,e,n){return e=Es(e),function(t,e){if(e&&("object"==ks(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,Ts()?Reflect.construct(e,n||[],Es(t).constructor):e.apply(t,n))}function Ts(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ts=function(){return!!t})()}function Es(t){return Es=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Es(t)}function Ps(t,e){return Ps=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ps(t,e)}!function(t){t.soundEffect="soundEffect",t.music="music",t.voice="voice",t.backgroundMusic="backgroundMusic"}(ws||(ws={}));var js=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=Os(this,e)).state={playing:null,token:null},t.config=b(e.defaultConfig,"string"==typeof n?{src:n}:n),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ps(t,e)}(e,t),function(t,e,n){return e&&xs(t.prototype,e),n&&xs(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"play",value:function(){if(this.config.type===ws.backgroundMusic)throw new Error("Background music cannot be played directly");return this.pushAction(tt.ActionTypes.play,[void 0])}},{key:"stop",value:function(){if(this.config.type===ws.backgroundMusic)throw new Error("Background music cannot be stopped directly");return this.pushAction(tt.ActionTypes.stop,[void 0])}},{key:"fade",value:function(t,e,n){if(this.config.type===ws.backgroundMusic)throw new Error("Background music cannot be faded directly");return this.pushAction(tt.ActionTypes.fade,[{start:t,end:e,duration:n}])}},{key:"setVolume",value:function(t){return this.pushAction(tt.ActionTypes.setVolume,[t])}},{key:"setRate",value:function(t){return this.pushAction(tt.ActionTypes.setRate,[t])}},{key:"pause",value:function(t){return void 0!==t?this.fade(void 0,0,t):this.pushAction(tt.ActionTypes.pause,[void 0])}},{key:"resume",value:function(t){return void 0!==t?this.fade(0,this.config.volume,t):this.pushAction(tt.ActionTypes.resume,[void 0])}},{key:"getHowlOptions",value:function(t){return Object.assign({src:this.config.src,loop:this.config.loop,volume:this.config.volume,html5:this.config.streaming,autoplay:!1},t||{})}},{key:"getSrc",value:function(){return this.config.src}},{key:"getToken",value:function(){return this.state.token||void 0}},{key:"getPlaying",value:function(){return this.state.playing}},{key:"setToken",value:function(t){this.state.token=void 0===t?null:t}},{key:"setPlaying",value:function(t){return this.state.playing=t,this}},{key:"toData",value:function(){return O(this.config,e.defaultConfig)?null:{config:_(this.config)}}},{key:"fromData",value:function(t){return this.config=b(this.config,t.config),this}},{key:"reset",value:function(){var t;null===(t=this.state.playing)||void 0===t||t.stop(),this.state.playing=null,this.state.token=null}},{key:"pushAction",value:function(t,e){return this.chain(new tt(this.chain(),t,(new xt).setContent(e)))}}],[{key:"toSoundSrc",value:function(t){return null==t?null:"string"==typeof t?t:t.getSrc()}},{key:"toSound",value:function(t){return null==t?null:"string"==typeof t?new e({src:t}):t}}])}(ye);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,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,Ls(r.key),r)}}function Ls(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+""}js.defaultConfig={src:"",sync:!1,loop:!1,volume:1};var Ns=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e}return function(t,e,n){return e&&Is(t.prototype,e),n&&Is(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,null,[{key:"from",value:function(e){return t.isPauseConstructor(e)?new t:e}},{key:"wait",value:function(e){return new t({duration:e})}},{key:"isPause",value:function(e){return this.isPauseConstructor(e)||e instanceof t}},{key:"isPauseConstructor",value:function(e){return e===t}}])}();function Rs(t){return Rs="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},Rs(t)}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,Fs(r.key),r)}}function Fs(t){var e=function(t,e){if("object"!=Rs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Rs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Rs(e)?e:e+""}var Ds=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.text=e,this.config=b(t.defaultConfig,n)}return function(t,e,n){return e&&Ms(t.prototype,e),n&&Ms(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"evaluate",value:function(e){var n=this;if(Ns.isPause(this.text))return[this];if("function"==typeof this.text){var r=this.text(e);return Array.isArray(r)?r.map((function(r){return t.isWord(r)?r.inherit(n.config).evaluate(e):new t(r,n.config)})).flat():t.isWord(r)?r.inherit(this.config).evaluate(e):[new t(r,this.config)]}return[this]}},{key:"inherit",value:function(t){return this.config.color=this.config.color||t.color,this.config.italic=this.config.italic||t.italic,this.config.bold=this.config.bold||t.bold,this}}],[{key:"isWord",value:function(e){return e instanceof t}}])}();function Bs(t){return Bs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bs(t)}function Vs(t){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)||function(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}}(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 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){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,zs(r.key),r)}}function zs(t){var e=function(t,e){if("object"!=Bs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Bs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Bs(e)?e:e+""}Ds.defaultConfig={},Ds.defaultColor="#000";var Hs=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.text=t.format(e),this.config=b(t.defaultConfig,Object.assign(Object.assign({},n),{voice:js.toSound(n.voice)})),this.state=_(t.defaultState)}return function(t,e,n){return e&&Us(t.prototype,e),n&&Us(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"toData",value:function(){return O(this.state,t.defaultState)?null:{state:_(this.state)}}},{key:"fromData",value:function(t){return this.state=b(this.state,t),this}},{key:"toString",value:function(){return this.text.map((function(t){return t.text})).join("")}},{key:"setCharacter",value:function(t){return this.config.character=t,this}},{key:"evaluate",value:function(e){for(var n=[],r=0;r<this.text.length;r++){var o=this.text[r].evaluate(e);n.push.apply(n,Vs(t.formatStaticWord(o)))}return n}},{key:"copy",value:function(){return new t(Vs(this.text),this.config)}}],[{key:"isSentence",value:function(e){return e instanceof t}},{key:"toSentence",value:function(e){return t.isSentence(e)?e:new t(e)}},{key:"format",value:function(t){var e=[];if(Array.isArray(t))for(var n=0;n<t.length;n++)e.push(this.formatWord(t[n]));else e.push(this.formatWord(t));return e}},{key:"formatWord",value:function(t){return Ds.isWord(t)?t:new Ds(t)}},{key:"formatStaticWord",value:function(t,e){var n=this;return Array.isArray(t)?t.map((function(t){return n.formatStaticWord(t,e)})).flat(2):[Ds.isWord(t)?t:new Ds(t,e)]}}])}();function Ws(t){return Ws="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ws(t)}function $s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ys(r.key),r)}}function Ys(t){var e=function(t,e){if("object"!=Ws(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ws(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ws(e)?e:e+""}function qs(t,e,n){return e=Qs(e),function(t,e){if(e&&("object"==Ws(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Xs()?Reflect.construct(e,n||[],Qs(t).constructor):e.apply(t,n))}function Xs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Xs=function(){return!!t})()}function Ks(t,e,n,r){var o=Zs(Qs(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function Zs(){return Zs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Qs(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}},Zs.apply(null,arguments)}function Qs(t){return Qs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Qs(t)}function Js(t,e){return Js=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Js(t,e)}Hs.defaultConfig={color:"#000",pause:!0,voice:null,character:null},Hs.defaultState={display:!0};var tu=function(e){function n(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),qs(this,n,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Js(t,e)}(n,e),function(t,e,n){return e&&$s(t.prototype,e),n&&$s(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"executeAction",value:function(e){var r=this;if(this.type===t.say){var o=new w((function(t){return t})).registerSkipController(new E((function(){return{type:r.type,node:r.contentNode.getChild()}}))),i=this.contentNode.getContent(),a=i.config.voice;return a&&(tt.initSound(e,a),e.playSound(a,(function(){e.stopSound(a)}))),e.createText(this.getId(),i,(function(){a&&e.stopSound(a),o.resolve({type:r.type,node:r.contentNode.getChild()})})),o}if(this.type===t.setName)return this.callee.state.name=this.contentNode.getContent()[0],Ks(n,"executeAction",this,3)([e]);throw Ks(n,"unknownType",this,3)([])}}])}(U);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 nu(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,ru(r.key),r)}}function ru(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+""}function ou(t,e,n){return e=au(e),function(t,e){if(e&&("object"==eu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,iu()?Reflect.construct(e,n||[],au(t).constructor):e.apply(t,n))}function iu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(iu=function(){return!!t})()}function au(t){return au=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},au(t)}function su(t,e){return su=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},su(t,e)}tu.ActionTypes=t;var uu=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=ou(this,e)).config=b(e.defaultConfig,r),n.state={name:t||""},n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&su(t,e)}(e,t),function(t,e,n){return e&&nu(t.prototype,e),n&&nu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"say",value:function(t,e){var n=Array.isArray(t)?new Hs(t,Object.assign(Object.assign({},e||{}),{character:this})):(Hs.isSentence(t)?t:new Hs(t,Object.assign(Object.assign({},e||{}),{character:this}))).copy();n.setCharacter(this);var r=new tu(this.chain(),tu.ActionTypes.say,(new xt).setContent(n));return this.chain(r)}},{key:"setName",value:function(t){var e=new tu(this.chain(),tu.ActionTypes.setName,(new xt).setContent([t]));return this.chain(e)}}])}(ye);function cu(t){return cu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cu(t)}function lu(t){return function(t){if(Array.isArray(t))return fu(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 fu(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)?fu(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 fu(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 pu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,du(r.key),r)}}function du(t){var e=function(t,e){if("object"!=cu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=cu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==cu(e)?e:e+""}function hu(t,e,n){return e=mu(e),function(t,e){if(e&&("object"==cu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,yu()?Reflect.construct(e,n||[],mu(t).constructor):e.apply(t,n))}function yu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(yu=function(){return!!t})()}function vu(){return vu="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=mu(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}},vu.apply(null,arguments)}function mu(t){return mu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},mu(t)}function gu(t,e){return gu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},gu(t,e)}uu.defaultConfig={color:"#000"};var bu=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),hu(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&&gu(t,e)}(e,t),function(t,e,n){return e&&pu(t.prototype,e),n&&pu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var e,n,r=this.callee.evaluate(this.contentNode.getContent(),{gameState:t});return null===(e=null==r?void 0:r[r.length-1])||void 0===e||e.contentNode.addChild(this.contentNode.getChild()),this.contentNode.addChild((null===(n=null==r?void 0:r[0])||void 0===n?void 0:n.contentNode)||null),{type:this.type,node:this.contentNode.getChild()}}},{key:"getFutureActions",value:function(){return[].concat(lu(this.callee._getFutureActions()),lu(function(t,e,n,r){var o=vu(mu(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"getFutureActions",this,3)([])))}}])}(U);function wu(t){return wu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wu(t)}function _u(t){return function(t){if(Array.isArray(t))return ku(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Su(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 Su(t,e){if(t){if("string"==typeof t)return ku(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)?ku(t,e):void 0}}function ku(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 xu(t,e,n){return e=Ou(e),function(t,e){if(e&&("object"==wu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Au()?Reflect.construct(e,n||[],Ou(t).constructor):e.apply(t,n))}function Au(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Au=function(){return!!t})()}function Ou(t){return Ou=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ou(t)}function Tu(t,e){return Tu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Tu(t,e)}function Eu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Pu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Cu(r.key),r)}}function ju(t,e,n){return e&&Pu(t.prototype,e),n&&Pu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Cu(t){var e=function(t,e){if("object"!=wu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=wu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==wu(e)?e:e+""}bu.ActionTypes={action:"condition:action"};var Iu=function(){return ju((function t(e){Eu(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()}}}])}(),Lu=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Eu(this,e),(t=xu(this,e)).conditions={If:{condition:null,action:null},ElseIf:[],Else:{action:null}},t.config=b(e.defaultConfig,n),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Tu(t,e)}(e,t),ju(e,[{key:"If",value:function(t,e){if(this.conditions.If.condition)throw new _s("IF condition already set\nYou are trying to set multiple IF conditions for the same condition");if(this.conditions.ElseIf.length)throw new _s("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 _s("ELSE condition already set\nYou are trying to set an IF condition after an ELSE condition");return this.conditions.If.condition=t instanceof Iu?t:new Iu(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 _s("IF condition not set\nYou are trying to set an ELSE-IF condition without an IF condition");if(this.conditions.Else.action)throw new _s("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 Iu?t:new Iu(t),action:this.construct(Array.isArray(e)?e:[e])}),this.chain()}},{key:"Else",value:function(t){if(!this.conditions.If.condition)throw new _s("IF condition not set\nYou are trying to set an ELSE condition without an IF condition");if(this.conditions.Else.action)throw new _s("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=Su(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(bu,[this,bu.ActionTypes.action,(new xt).setContent(t.conditions)])]}},{key:"construct",value:function(t,e,n){for(var r,o=ie.toActions(t),i=0;i<o.length;i++){var a=o[i].contentNode,s=null===(r=o[i+1])||void 0===r?void 0:r.contentNode;s&&a.setChild(s),i===o.length-1&&e&&a.setChild(e),0===i&&n&&n.setChild(a)}return o}},{key:"_getFutureActions",value:function(){return ie.toActions([].concat(_u(this.conditions.If.action||[]),_u(this.conditions.ElseIf.flatMap((function(t){return t.action||[]}))),_u(this.conditions.Else.action||[])))}}],[{key:"getInitialState",value:function(){return{If:{condition:null,action:null},ElseIf:[],Else:{action:null}}}}])}(ye);function Nu(t){return Nu="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},Nu(t)}function Ru(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 Fu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Du(r.key),r)}}function Du(t){var e=function(t,e){if("object"!=Nu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Nu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Nu(e)?e:e+""}function Bu(t,e,n){return e=Uu(e),function(t,e){if(e&&("object"==Nu(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,Vu()?Reflect.construct(e,n||[],Uu(t).constructor):e.apply(t,n))}function Vu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Vu=function(){return!!t})()}function Gu(){return Gu="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Uu(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}},Gu.apply(null,arguments)}function Uu(t){return Uu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Uu(t)}function zu(t,e){return zu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},zu(t,e)}Lu.defaultConfig={};var Hu=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,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&zu(t,e)}(e,t),function(t,e,n){return e&&Fu(t.prototype,e),n&&Fu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var e=this,n=new w((function(t){return t})),r=this.contentNode.getContent();return t.createMenu(r,(function(r){var o,i,a=(null===(o=t.game.getLiveGame().getCurrentAction())||void 0===o?void 0:o.contentNode.getChild())||null;a&&(null===(i=r.action[r.action.length-1])||void 0===i||i.contentNode.addChild(a)),n.resolve({type:e.type,node:r.action[0].contentNode})})),n}},{key:"getFutureActions",value:function(){var t=this.contentNode.getContent();return[].concat(Ru(this.callee._getFutureActions(t.choices)),Ru(function(t,e,n,r){var o=Gu(Uu(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"getFutureActions",this,3)([])))}}])}(U);function Wu(t){return Wu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wu(t)}function $u(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Yu(r.key),r)}}function Yu(t){var e=function(t,e){if("object"!=Wu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Wu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Wu(e)?e:e+""}function qu(t,e,n){return e=Ku(e),function(t,e){if(e&&("object"==Wu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Xu()?Reflect.construct(e,n||[],Ku(t).constructor):e.apply(t,n))}function Xu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Xu=function(){return!!t})()}function Ku(t){return Ku=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ku(t)}function Zu(t,e){return Zu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Zu(t,e)}Hu.ActionTypes={action:"menu:action"};var Qu=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=qu(this,e)).choices=[],n.prompt=Hs.isSentence(t)?t:new Hs(t),n.config=b(e.defaultConfig,r),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Zu(t,e)}(e,t),function(t,e,n){return e&&$u(t.prototype,e),n&&$u(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"choose",value:function(t,e){var n=this.chain();return Hs.isSentence(t)&&e||(Ds.isWord(t)||Array.isArray(t)||"string"==typeof t)&&e?n.choices.push({prompt:Hs.toSentence(t),action:ie.toActions(e)}):"object"===Wu(t)&&"prompt"in t&&"action"in t?n.choices.push({prompt:Hs.toSentence(t.prompt),action:ie.toActions(t.action)}):console.warn("No valid choice added to menu, ",{arg0:t,arg1:e}),n}},{key:"fromChained",value:function(t){return[new Hu(this.chain(),Hu.ActionTypes.action,(new xt).setContent({prompt:this.prompt,choices:t.constructChoices()}))]}},{key:"_getFutureActions",value:function(t){return t.map((function(t){return t.action})).flat(2)}},{key:"constructNodes",value:function(t,e,n){for(var r,o=0;o<t.length;o++){var i=t[o].contentNode,a=null===(r=t[o+1])||void 0===r?void 0:r.contentNode;a&&i.setChild(a),o===this.choices.length-1&&e&&i.setChild(e),0===o&&n&&n.setChild(i)}return t}},{key:"constructChoices",value:function(){var t=this;return this.choices.map((function(e){return{action:t.constructNodes(e.action),prompt:e.prompt}}))}}])}(ye);function Ju(t){return Ju="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ju(t)}function tc(t){return function(t){if(Array.isArray(t))return ec(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 ec(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)?ec(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 ec(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 nc(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,rc(r.key),r)}}function rc(t){var e=function(t,e){if("object"!=Ju(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ju(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ju(e)?e:e+""}function oc(t,e,n){return e=ac(e),function(t,e){if(e&&("object"==Ju(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ic()?Reflect.construct(e,n||[],ac(t).constructor):e.apply(t,n))}function ic(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ic=function(){return!!t})()}function ac(t){return ac=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ac(t)}function sc(t,e){return sc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},sc(t,e)}Qu.defaultConfig={},Qu.targetAction=Hu;var uc=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),oc(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&&sc(t,e)}(e,t),function(t,e,n){return e&&nc(t.prototype,e),n&&nc(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,tc(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,tc(i))}}}},{key:"getAllChildren",value:function(t){var e=[];return this.forEachChild(t,(function(t){return e.push(t)})),e}},{key:"getAllChildrenMap",value:function(t){var e=new Map;return this.forEachChild(t,(function(t){return e.set(t.getId(),t)})),e}},{key:"getAllElementMap",value:function(t){var e=new Map;return this.forEachChild(t,(function(t){return e.set(t.callee.getId(),t.callee)})),e}},{key:"getAllChildrenElements",value:function(t){return Array.from(new Set(this.getAllChildren(t).map((function(t){return t.callee}))))}},{key:"toData",value:function(){return null}},{key:"constructNodes",value:function(t,e){for(var n,r=0;r<t.length;r++){var o=t[r];0===r&&e?e.setChild(o.contentNode):r>0&&(null===(n=t[r-1].contentNode)||void 0===n||n.setChild(o.contentNode))}return t.length?t[0].contentNode:null}}])}(ae);function cc(t){return cc="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},cc(t)}function lc(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,fc(r.key),r)}}function fc(t){var e=function(t,e){if("object"!=cc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=cc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==cc(e)?e:e+""}var pc=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&&lc(t.prototype,e),n&&lc(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 js){if(this.isSrcRegistered(t.getSrc()))return this;this.src.push({type:"audio",src:t})}else if(t instanceof qa||bs.isStaticImageData(t)){if(t instanceof qa){if(this.isSrcRegistered(bs.srcToString(t.state.src)))return this}else if(this.isSrcRegistered(bs.srcToString(t.src)))return this;this.src.push({type:"image",src:t instanceof qa?t:new qa("",{src:bs.staticImageDataToSrc(t)})})}else if("object"===cc(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 js?e:new js({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 js?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===bs.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 dc(t){return dc="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},dc(t)}function hc(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,yc(r.key),r)}}function yc(t){var e=function(t,e){if("object"!=dc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=dc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==dc(e)?e:e+""}function vc(t,e,n){return e=wc(e),function(t,e){if(e&&("object"==dc(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,mc()?Reflect.construct(e,n||[],wc(t).constructor):e.apply(t,n))}function mc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(mc=function(){return!!t})()}function gc(t,e,n,r){var o=bc(wc(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function bc(){return bc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=wc(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}},bc.apply(null,arguments)}function wc(t){return wc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wc(t)}function _c(t,e){return _c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_c(t,e)}pc.SrcTypes={image:"image",video:"video",audio:"audio"};var Sc=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),vc(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&&_c(t,e)}(e,t),function(t,e,n){return e&&hc(t.prototype,e),n&&hc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===s.init){var r=t.findElementByDisplayable(this.callee);r&&t.disposeDisplayable(this.callee,r.scene);var o=this.contentNode.getContent()[0];t.createDisplayable(this.callee,o);var i=new w((function(t){return t}));return this.callee.events.any("event:displayable.init").then((function(){i.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),i}if([s.show,s.hide,s.applyTransform].includes(this.type)){var a=new w((function(t){return t})).registerSkipController(new E((function(){return n.type===s.hide&&(n.callee.state.display=!1),gc(e,"executeAction",n,3)([t])}))),u=this.contentNode.getContent()[0];return this.type===s.show&&(this.callee.state.display=!0,t.stage.update()),t.animateText(Qc.EventTypes["event:displayable.applyTransform"],this.callee,[u],(function(){n.type===s.hide&&(n.callee.state.display=!1),a.resolve(gc(e,"executeAction",n,3)([t]))})),a}if(this.type===s.setText)return this.callee.state.text=this.contentNode.getContent()[0],gc(e,"executeAction",this,3)([t]);if(this.type===s.setFontSize){this.callee.state.fontSize=this.contentNode.getContent()[0];var c=new Ia([],{duration:0}),l=new w;return t.animateText(Qc.EventTypes["event:displayable.applyTransform"],this.callee,[c],(function(){l.resolve(gc(e,"executeAction",n,3)([t]))})),l}if(this.type===s.applyTransition){var f=(new w).registerSkipController(new E((function(){return t.logger.info("NarraLeaf-React: Text Transition","Skipped"),{type:n.type,node:n.contentNode.getChild()}}))),p=this.contentNode.getContent()[0];return this.callee.events.any("event:displayable.applyTransition",p).then((function(){f.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),f}throw gc(e,"unknownType",this,3)([])}}])}(U);Sc.ActionTypes=s;var kc={start:"start",update:"update",end:"end"};function xc(t){return xc="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},xc(t)}function Ac(t,e,n){return e=Tc(e),function(t,e){if(e&&("object"==xc(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Oc()?Reflect.construct(e,n||[],Tc(t).constructor):e.apply(t,n))}function Oc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Oc=function(){return!!t})()}function Tc(t){return Tc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Tc(t)}function Ec(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Pc(t,e)}function Pc(t,e){return Pc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Pc(t,e)}function jc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Cc(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,Lc(r.key),r)}}function Ic(t,e,n){return e&&Cc(t.prototype,e),n&&Cc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Lc(t){var e=function(t,e){if("object"!=xc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=xc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==xc(e)?e:e+""}var Nc=function(){return Ic((function t(){jc(this,t),this.events=new k}),[{key:"start",value:function(t){throw new Error("Method not implemented.")}},{key:"toElementProps",value:function(){throw new Error("Method not implemented.")}},{key:"copy",value:function(){throw new Error("Method not implemented.")}},{key:"requestAnimation",value:function(t,e,n){var r=this,o=t.start,i=t.end,a=t.duration,s=e.onComplete,u=e.onUpdate;return this.events.emit(kc.start,null),this.controller=ba(o,i,Object.assign({duration:a/1e3,onUpdate:function(t){u&&u(t),r.events.emit(kc.update,r.toElementProps())},onComplete:function(){r.controller=void 0,r.events.emit(kc.end,null),s&&s()}},n)),this.controller}}])}(),Rc=function(t){function e(){return jc(this,e),Ac(this,e,arguments)}return Ec(e,t),Ic(e,[{key:"setSrc",value:function(t){throw new Error("Method not implemented.")}},{key:"copy",value:function(){throw new Error("Method not implemented.")}}])}(Nc),Mc=function(t){function e(){return jc(this,e),Ac(this,e,arguments)}return Ec(e,t),Ic(e,[{key:"copy",value:function(){throw new Error("Method not implemented.")}}])}(Nc);function Fc(t){return Fc="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},Fc(t)}function Dc(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Bc(r.key),r)}}function Bc(t){var e=function(t,e){if("object"!=Fc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Fc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Fc(e)?e:e+""}function Vc(t,e,n){return e=Uc(e),function(t,e){if(e&&("object"==Fc(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,Gc()?Reflect.construct(e,n||[],Uc(t).constructor):e.apply(t,n))}function Gc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Gc=function(){return!!t})()}function Uc(t){return Uc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Uc(t)}function zc(t,e){return zc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},zc(t,e)}var Hc=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=Vc(this,e)).state={fontSize:0},r.startValue=t,r.endValue=n,r.duration=o,r.easing=i,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&zc(t,e)}(e,t),function(t,e,n){return e&&Dc(t.prototype,e),n&&Dc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"start",value:function(t){var e=this;this.state.fontSize=this.startValue,this.requestAnimation({start:this.startValue,end:this.endValue,duration:this.duration},{onComplete:function(){e.state.fontSize=e.endValue,t&&t()},onUpdate:function(t){e.state.fontSize=t}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{fontSize:this.state.fontSize}}]}},{key:"copy",value:function(){return new e(this.startValue,this.endValue,this.duration,this.easing)}}])}(Mc);function Wc(t){return Wc="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},Wc(t)}function $c(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Yc(r.key),r)}}function Yc(t){var e=function(t,e){if("object"!=Wc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Wc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Wc(e)?e:e+""}function qc(t,e,n){return e=Kc(e),function(t,e){if(e&&("object"==Wc(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Xc()?Reflect.construct(e,n||[],Kc(t).constructor):e.apply(t,n))}function Xc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Xc=function(){return!!t})()}function Kc(t){return Kc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Kc(t)}function Zc(t,e){return Zc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Zc(t,e)}Hc.Frames=[1,0];var Qc=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=qc(this,e)).events=new k,n.config="string"==typeof t?b({},e.defaultConfig,r,{text:t}):b({},e.defaultConfig,t),n.state=b({},n.config),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Zc(t,e)}(e,t),function(t,e,n){return e&&$c(t.prototype,e),n&&$c(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"applyTransform",value:function(t){var e=this.chain(),n=new Sc(e,Sc.ActionTypes.applyTransform,(new xt).setContent([t.copy()]));return e.chain(n)}},{key:"applyTransition",value:function(t){var e=this.chain(),n=this._applyTransition(e,t);return e.chain(n)}},{key:"show",value:function(t){var e=this.chain(),n=t instanceof Ia?t.copy():new Ia([{props:{opacity:1},options:t||{}}]),r=new Sc(e,Sc.ActionTypes.show,(new xt).setContent([n]));return e.chain(r)}},{key:"hide",value:function(t){var e=this.chain(),n=t instanceof Ia?t.copy():new Ia([{props:{opacity:1},options:t||{}}]),r=new Sc(e,Sc.ActionTypes.hide,(new xt).setContent([n]));return e.chain(r)}},{key:"setText",value:function(t){var e=this.chain(),n=new Sc(e,Sc.ActionTypes.setText,(new xt).setContent([t]));return e.chain(n)}},{key:"setFontSize",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0;return this.combineActions(new Va,(function(o){if(n){var i=new Hc(e.state.fontSize,t,n,r);o.chain(e._applyTransition(o,i))}var a=new Sc(o,Sc.ActionTypes.setFontSize,(new xt).setContent([t]));return o.chain(a)}))}},{key:"toData",value:function(){return{state:b({},qa.serializeImageState(this.state))}}},{key:"fromData",value:function(t){return this.state=b({},qa.deserializeImageState(t.state)),this}},{key:"toTransform",value:function(){return new Ia(this.state,{duration:0})}},{key:"toDisplayableTransform",value:function(){return new Ia(this.state,{duration:0})}},{key:"_init",value:function(t){return new Sc(this.chain(),Sc.ActionTypes.init,(new xt).setContent([t]))}},{key:"_applyTransition",value:function(t,e){return new Sc(t,Sc.ActionTypes.applyTransition,(new xt).setContent([e]))}}])}(ye);function Jc(t){return Jc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jc(t)}function tl(t){return function(t){if(Array.isArray(t))return el(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 el(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)?el(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 el(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 nl(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,rl(r.key),r)}}function rl(t){var e=function(t,e){if("object"!=Jc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Jc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Jc(e)?e:e+""}function ol(t,e,n){return e=sl(e),function(t,e){if(e&&("object"==Jc(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,il()?Reflect.construct(e,n||[],sl(t).constructor):e.apply(t,n))}function il(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(il=function(){return!!t})()}function al(){return al="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=sl(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},al.apply(null,arguments)}function sl(t){return sl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},sl(t)}function ul(t,e){return ul=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ul(t,e)}Qc.EventTypes={"event:text.show":"event:text.show","event:text.hide":"event:text.hide","event:displayable.applyTransition":"event:displayable.applyTransition","event:displayable.applyTransform":"event:displayable.applyTransform","event:displayable.init":"event:displayable.init"},Qc.defaultConfig={position:new Te(Te.Positions.Center),scale:1,rotation:0,opacity:0,alignX:"center",alignY:"center",fontSize:16,fontColor:"#000000",display:!1,text:""};var cl=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n},ll=function(t){function r(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.defaultConfig;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),(e=ol(this,r)).srcManager=new pc,e.events=new k,e.name=t;var o=b(r.defaultConfig,n),i=o.background,a=cl(o,["background"]);return e.config=Object.assign(Object.assign({},a),{backgroundImage:new qa({opacity:1}),background:i||null}),e.state=b(e.config,{}),e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ul(t,e)}(r,t),function(t,e,n){return e&&nl(t.prototype,e),n&&nl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(r,[{key:"toBackground",value:function(t){if(bs.isImageSrc(t)||bs.isImageColor(t))return t;if(t instanceof gs)return t.toImageColor();throw new Error("Invalid background type")}},{key:"activate",value:function(){return this.chain(this._init(this))}},{key:"deactivate",value:function(){return this.chain(this._exit())}},{key:"setBackground",value:function(t,e){var n=this;return this.combineActions(new Va,(function(r){if(e){var o=e.copy();o.setSrc(n.toBackground(t)),r._transitionToScene(void 0,o,n.toBackground(t))}return r.chain(new dt(r,"scene:setBackground",(new xt).setContent([t])))}))}},{key:"applyTransform",value:function(t){return this.chain(new dt(this.chain(),"scene:applyTransform",(new xt).setContent([t.copy()])))}},{key:"jumpTo",value:function(t,e){var n=this;return this.combineActions(new Va,(function(r){var o=e||{};return r.chain(new dt(r,"scene:preUnmount",(new xt).setContent([])))._transitionToScene(t,o.transition).chain(t._init()).chain(n._exit())._jumpTo(t)}))}},{key:"sleep",value:function(t){return this.chain(new dt(this.chain(),"scene:sleep",(new xt).setContent(t)))}},{key:"setBackgroundMusic",value:function(t,n){return this.chain(new dt(this.chain(),e.setBackgroundMusic,(new xt).setContent([t,n])))}},{key:"toData",value:function(){var t;return{state:Object.assign(Object.assign({},_(this.state)),{backgroundMusic:null===(t=this.state.backgroundMusic)||void 0===t?void 0:t.toData(),background:this.state.background}),backgroundImageState:this.state.backgroundImage.toData()}}},{key:"fromData",value:function(t){return this.state=b(this.state,t.state),t.state.backgroundMusic&&(this.state.backgroundMusic=(new js).fromData(t.state.backgroundMusic)),t.backgroundImageState&&this.state.backgroundImage.fromData(t.backgroundImageState),this}},{key:"getInitTransform",value:function(){return new Ia([{props:Object.assign(Object.assign({},this.state.backgroundImage.state),{opacity:1}),options:{duration:0}}])}},{key:"action",value:function(t){var e=(Array.isArray(t)?t.flat(2):t(this).flat(2)).map((function(t){return ie.isChained(t)?t.fromChained(t):t})).flat(2),n=[],o=[];this.getAllChildrenElements(e).forEach((function(t){ie.isChained(t)||(t instanceof qa?n.push(t):t instanceof Qc&&o.push(t))}));var i=[this._init(this)].concat(tl(n.map((function(t){return t._init()}))),tl(o.map((function(t){return t._init()}))),tl(e)),a=function(t,e,n,r){var o=al(sl(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(r,"constructNodes",this,3)([i]),s=new xt(void 0,void 0,a||void 0).setContent(this);return null==a||a.setParent(s),this.sceneRoot=new dt(this.chain(),"scene:action",s),this}},{key:"registerSrc",value:function(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Set;if(this.sceneRoot){var o=new Set,i=new Set,a=[this.sceneRoot],s=new Set;for(bs.isImageSrc(this.config.background)&&this.srcManager.register(new qa({src:bs.toBackgroundSrc(this.config.background)}));a.length;){var u=a.shift();if(!o.has(u)){if(o.add(u),u instanceof dt){if(u.type===e.jumpTo){var c=u,l=c.contentNode.getContent()[0];if(i.has(c)||r.has(l))continue;i.add(c),s.add(l),r.add(l)}}else if(u instanceof as){var f=u;if(this.srcManager.register(f.callee),u.type===n.setSrc){var p=u.contentNode.getContent()[0];this.srcManager.register(new qa({src:p}))}}else if(u instanceof tt)this.srcManager.register(u.callee);else if(u instanceof $t){var d=u.getFutureActions();a.push.apply(a,tl(d))}a.push.apply(a,tl(u.getFutureActions()))}}s.forEach((function(e){e.registerSrc(r),t.srcManager.registerFuture(e.srcManager)}))}}},{key:"assignActionId",value:function(){this.getAllChildren(this.sceneRoot||[]).forEach((function(t,e){t.setId("action-".concat(e))}))}},{key:"assignElementId",value:function(){this.getAllChildrenElements(this.sceneRoot||[]).forEach((function(t,e){t.setId("element-".concat(e))}))}},{key:"reset",value:function(){this.state=b(r.defaultState,this.config),this.state.backgroundImage.reset()}},{key:"toDisplayableTransform",value:function(){return this.state.backgroundImage.toDisplayableTransform()}},{key:"_applyTransition",value:function(t){return this.chain(new dt(this.chain(),"scene:applyTransition",(new xt).setContent([t])))}},{key:"_jumpTo",value:function(t){return this.chain(new dt(this.chain(),"scene:jumpTo",(new xt).setContent([t])))}},{key:"_exit",value:function(){return new dt(this.chain(),"scene:exit",(new xt).setContent([]))}},{key:"_transitionToScene",value:function(t,e,n){var r=this.chain();if(e){var o=e.copy();t&&t.config.background&&o.setSrc(t.config.background),n&&o.setSrc(n),r._applyTransition(o)}return r}},{key:"_init",value:function(){return new dt((arguments.length>0&&void 0!==arguments[0]?arguments[0]:this).chain(),"scene:init",(new xt).setContent([]))}}])}(uc);function fl(t){return fl="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},fl(t)}function pl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,dl(r.key),r)}}function dl(t){var e=function(t,e){if("object"!=fl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=fl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==fl(e)?e:e+""}function hl(t,e,n){return e=ml(e),function(t,e){if(e&&("object"==fl(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,yl()?Reflect.construct(e,n||[],ml(t).constructor):e.apply(t,n))}function yl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(yl=function(){return!!t})()}function vl(){return vl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=ml(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},vl.apply(null,arguments)}function ml(t){return ml=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ml(t)}function gl(t,e){return gl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},gl(t,e)}ll.EventTypes={"event:scene.remove":"event:scene.remove","event:scene.load":"event:scene.load","event:scene.unload":"event:scene.unload","event:scene.mount":"event:scene.mount","event:scene.unmount":"event:scene.unmount","event:scene.preUnmount":"event:scene.preUnmount","event:scene.imageLoaded":"event:scene.imageLoaded","event:scene.setBackgroundMusic":"event:scene.setBackgroundMusic","event:displayable.applyTransition":"event:displayable.applyTransition","event:displayable.applyTransform":"event:displayable.applyTransform","event:displayable.init":"event:displayable.init"},ll.defaultConfig={invertY:!1,invertX:!1,backgroundMusic:null,backgroundMusicFade:0},ll.defaultState={};var bl=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),hl(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&&gl(t,e)}(e,t),function(t,e,n){return e&&pl(t.prototype,e),n&&pl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){return this.contentNode.getContent().execute({gameState:t}),function(t,e,n,r){var o=vl(ml(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"executeAction",this,3)([t])}}])}(U);function wl(t){return wl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wl(t)}function _l(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Sl(r.key),r)}}function Sl(t){var e=function(t,e){if("object"!=wl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=wl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==wl(e)?e:e+""}function kl(t,e,n){return e=Ol(e),xl(t,Al()?Reflect.construct(e,n||[],Ol(t).constructor):e.apply(t,n))}function xl(t,e){if(e&&("object"==wl(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Al(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Al=function(){return!!t})()}function Ol(t){return Ol=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ol(t)}function Tl(t,e){return Tl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Tl(t,e)}bl.ActionTypes={action:"script:action"};var El=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=kl(this,e)).handler=t,xl(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&&Tl(t,e)}(e,t),function(t,e,n){return e&&_l(t.prototype,e),n&&_l(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"execute",value:function(t){var n=t.gameState;this.handler(e.getCtx({gameState:n}))}},{key:"fromChained",value:function(t){return[new bl(this.chain(),bl.ActionTypes.action,(new xt).setContent(t))]}}],[{key:"getCtx",value:function(t){var e=t.gameState;return{gameState:e,game:e.game,liveGame:e.game.getLiveGame(),storable:e.game.getLiveGame().getStorable()}}}])}(ye);function Pl(t){return Pl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pl(t)}function jl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Cl(r.key),r)}}function Cl(t){var e=function(t,e){if("object"!=Pl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Pl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Pl(e)?e:e+""}function Il(t,e,n){return e=Nl(e),function(t,e){if(e&&("object"==Pl(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ll()?Reflect.construct(e,n||[],Nl(t).constructor):e.apply(t,n))}function Ll(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ll=function(){return!!t})()}function Nl(t){return Nl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Nl(t)}function Rl(t,e){return Rl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Rl(t,e)}var Ml=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=Il(this,e)).entryScene=null,n.name=t,n.config=b(e.defaultConfig,r),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Rl(t,e)}(e,t),function(t,e,n){return e&&jl(t.prototype,e),n&&jl(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 Ss(t).run()}}])}(uc);function Fl(t){return Fl="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},Fl(t)}function Dl(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}function Vl(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Gl(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,zl(r.key),r)}}function Ul(t,e,n){return e&&Gl(t.prototype,e),n&&Gl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function zl(t){var e=function(t,e){if("object"!=Fl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Fl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Fl(e)?e:e+""}Ml.defaultConfig={};var Hl=function(){function t(e,n,r){Vl(this,t),this.name=e,this.key=r||e,this.content=b({},n)}return Ul(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=Dl(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=Dl(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(Fl(e))||(e instanceof Date||(null==e||(Array.isArray(e)?e.every(t.isSerializable):"object"===Fl(e)&&(Object.getPrototypeOf(e)===Object.prototype&&Object.values(e).every(t.isSerializable)))))}}])}(),Wl=function(){return Ul((function t(){Vl(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=Dl(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=Dl(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}}])}(),$l=o(196);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 ql(t){return function(t){if(Array.isArray(t))return Zl(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Kl(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 Xl(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Xl=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:O(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",d="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==Yl(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function O(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=T(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 T(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,T(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 E(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(E,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 Kl(t,e){if(t){if("string"==typeof t)return Zl(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)?Zl(t,e):void 0}}function Zl(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 Ql(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,Jl(r.key),r)}}function Jl(t){var e=function(t,e){if("object"!=Yl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Yl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Yl(e)?e:e+""}var tf=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())}))},ef=function(){return function(t,e,n){return e&&Ql(t.prototype,e),n&&Ql(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state={sounds:[],srcManagers:[],elements:[]},this.currentHandling=null,this.stage=n,this.game=e,this.events=new k,this.logger=new T(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:"findElementByDisplayable",value:function(t){return this.state.elements.find((function(e){return e.ele.displayable.includes(t)}))||null}},{key:"addScene",value:function(t){return this.sceneExists(t)||this.state.elements.push({scene:t,ele:this.getElementMap()}),this}},{key:"popScene",value:function(){var t=this.state.elements.pop();return t?(this.removeElements(t.scene),this):this}},{key:"removeScene",value:function(t){return this.removeElements(t),this}},{key:"getSceneElements",value:function(){return this.state.elements}},{key:"getLastScene",value:function(){var t;return(null===(t=this.state.elements[this.state.elements.length-1])||void 0===t?void 0:t.scene)||null}},{key:"sceneExists",value:function(t){return t?this.state.elements.some((function(e){return e.scene===t})):!!this.getLastScene()}},{key:"isSceneActive",value:function(t){var e,n=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Kl(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}(this.state.elements);try{for(n.s();!(e=n.n()).done;){if(e.value.scene===t)return!0}}catch(t){n.e(t)}finally{n.f()}return!1}},{key:"handle",value:function(t){return this.currentHandling===t||(this.currentHandling=t,t.type),this}},{key:"createText",value:function(t,e,n,r){var o,i=null===(o=this.findElementByScene(this._getLastSceneIfNot(r)))||void 0===o?void 0:o.ele.texts;if(!i)throw new Error("Scene not found");var a=this.createWaitableAction({character:e.config.character,sentence:e,id:t},(function(){i.splice(i.indexOf(a),1),n&&n()}));i.push(a)}},{key:"createMenu",value:function(t,e,n){var r;if(!t.choices.length)throw new Error("Menu must have at least one choice");var o=null===(r=this.findElementByScene(this._getLastSceneIfNot(n)))||void 0===r?void 0:r.ele.menus;if(!o)throw new Error("Scene not found");var i=this.createWaitableAction(t,(function(t){o.splice(o.indexOf(i),1),e&&e(t)}));o.push(i)}},{key:"createImage",value:function(t,e){var n=this._getLastSceneIfNot(e),r=this.findElementByScene(n);return r?(r.ele.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:"createDisplayable",value:function(t,e){var n=this._getLastSceneIfNot(e),r=this.findElementByScene(n);return r?(r.ele.displayable.push(t),this):this}},{key:"disposeDisplayable",value:function(t,e){var n,r=this._getLastSceneIfNot(e),o=null===(n=this.findElementByScene(r))||void 0===n?void 0:n.ele.displayable;if(!o)throw new Error("Scene not found");var i=o.indexOf(t);if(-1===i)throw new Error("Displayables not found");return o.splice(i,1),this}},{key:"forceReset",value:function(){var t=this;this.state.sounds.forEach((function(t){var e;return null===(e=t.getPlaying())||void 0===e?void 0:e.stop()})),this.state.elements.forEach((function(e){var n=e.scene;t.offSrcManager(n.srcManager),t.removeScene(n),n.events.clear()})),this.state.elements=[],this.state.srcManagers=[]}},{key:"initSound",value:function(t,e){return t.getPlaying()||t.setPlaying(new(this.getHowl())(t.getHowlOptions(e))),t}},{key:"playSound",value:function(t,e,n){this.initSound(t,n);var r=t.getPlaying().play(),o=[t.getPlaying().once("end",i.bind(this)),t.getPlaying().once("stop",i.bind(this))];function i(){e&&e(),o.forEach((function(t){return t.off()})),this.state.sounds=this.state.sounds.filter((function(e){return e!==t})),this.stage.next()}return this.state.sounds.push(t),t.state.token=r,r}},{key:"stopSound",value:function(t){var e,n;return(null===(e=t.state.playing)||void 0===e?void 0:e.playing(t.getToken()))&&(null===(n=t.state.playing)||void 0===n||n.stop(t.getToken())),t.setPlaying(null).setToken(null),t}},{key:"transitionSound",value:function(t,e,n){return tf(this,void 0,void 0,Xl().mark((function r(){var o;return Xl().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!t){r.next=5;break}if(!n){r.next=4;break}return r.next=4,this.fadeSound(t,0,n);case 4:this.stopSound(t);case 5:if(!e){r.next=12;break}if(o=e.config.volume,this.playSound(e,void 0,{volume:0}),!n){r.next=11;break}return r.next=11,this.fadeSound(e,o,n);case 11:e.getPlaying().volume(o,e.getToken());case 12:case"end":return r.stop()}}),r,this)})))}},{key:"fadeSound",value:function(t,e,n){var r,o;return tf(this,void 0,void 0,Xl().mark((function i(){var a;return Xl().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return a=null===(r=t.getPlaying())||void 0===r?void 0:r.volume(t.getToken()),null===(o=t.getPlaying())||void 0===o||o.fade(a,e,n,t.getToken()),i.next=4,A(n);case 4:return i.abrupt("return",void 0);case 5:case"end":return i.stop()}}),i)})))}},{key:"getHowl",value:function(){return $l.Howl}},{key:"animateImage",value:function(t,e,n,r){return this.anyEvent.apply(this,[t,e,r].concat(ql(n)))}},{key:"animateText",value:function(t,e,n,r){return this.anyEvent.apply(this,[t,e,r].concat(ql(n)))}},{key:"registerSrcManager",value:function(t){return this.state.srcManagers.push(t),this}},{key:"offSrcManager",value:function(t){return this.state.srcManagers=this.state.srcManagers.filter((function(e){return e!==t})),this}},{key:"getStorable",value:function(){return this.game.getLiveGame().getStorable()}},{key:"dispose",value:function(){this.forceReset()}},{key:"toData",value:function(){return{scenes:this.state.elements.map((function(t){return{sceneId:t.scene.getId(),elements:{images:t.ele.images.map((function(t){return t.getId()}))}}}))}}},{key:"loadData",value:function(t,e){var n=this;if(this.state.elements=[],!this.game.getLiveGame().story)throw new Error("No story loaded");t.scenes.forEach((function(t){var r=t.sceneId,o=t.elements;n.logger.debug("Loading scene: "+r);var i=e.get(r);if(!i)throw new Error("Scene not found, id: "+r+"\nNarraLeaf cannot find the element with the id from the saved game");var a={scene:i,ele:{images:o.images.map((function(t){if(!e.has(t))throw new Error("Image not found, id: "+t+"\nNarraLeaf cannot find the element with the id from the saved game");return e.get(t)})),menus:[],texts:[],displayable:[]}};n.state.elements.push(a),n.registerSrcManager(i.srcManager),dt.registerEventListeners(i,n)}))}},{key:"initScenes",value:function(){var t=this;this.state.elements.forEach((function(e){var n=e.scene;dt.registerEventListeners(n,t)}))}},{key:"getElementMap",value:function(){return{texts:[],menus:[],images:[],displayable:[]}}},{key:"removeElements",value:function(t){var e=this.state.elements.findIndex((function(e){return e.scene===t}));return-1===e||this.state.elements.splice(e,1),this}},{key:"_getLastSceneIfNot",value:function(t){var e=t||this.getLastScene();if(!e||!this.sceneExists(e))throw new Error('Scene not found, please call "scene.activate()" first.');return e}},{key:"anyEvent",value:function(t,e,n){for(var r,o=this,i=arguments.length,a=new Array(i>3?i-3:0),s=3;s<i;s++)a[s-3]=arguments[s];(r=e.events).any.apply(r,[t].concat(a)).then(n).then((function(){o.stage.next()}))}},{key:"createWaitableAction",value:function(t,e){return{action:t,onClick:function(t){e&&e(t)}}}}])}();function nf(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=nf(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}ef.EventTypes={"event:state.ready":"event:state.ready","event:state.end":"event:state.end","event:state.player.skip":"event:state.player.skip","event:state.preload.unmount":"event:state.preload.unmount","event:state.preload.loaded":"event:state.preload.loaded","event:state.player.flush":"event:state.player.flush"};const rf=function(){for(var t,e,n=0,r="",o=arguments.length;n<o;n++)(t=arguments[n])&&(e=nf(t))&&(r&&(r+=" "),r+=e);return r};var of=o(12),af=o.n(of);function sf(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 uf(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)?uf(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 uf(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){return cf="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},cf(t)}function lf(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"!=cf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=cf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==cf(e)?e:e+""}var pf=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 k,this.lockers=[],this.updater=null}return function(t,e,n){return e&&lf(t.prototype,e),n&&lf(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()}}])}();pf.EventTypes={"event:aspectRatio.update":"event:aspectRatio.update","event:aspectRatio.pause":"event:aspectRatio.pause","event:aspectRatio.resume":"event:aspectRatio.resume"};var df=(0,of.createContext)(null);function hf(t){var e=t.children,n=sf((0,of.useState)((function(){return new pf})),1)[0];return af().createElement(df.Provider,{value:{ratio:n}},e)}function yf(){var t=(0,of.useContext)(df);if(!df||!t)throw new Error("useRatio must be used within a RatioProvider");var e=sf((0,of.useReducer)((function(t){return t+1}),0),2)[1],n=t.ratio;return(0,of.useEffect)((function(){return n.onUpdate((function(){e()}))}),[]),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(t){var e=t.children,n=t.className,r=t.props,o=t.ref,i=yf().ratio,a=i.getStyle();return af().createElement("div",{className:rf("inset-0 flex items-center justify-center",n),style:{width:"100%",height:"100%",minWidth:"".concat(i.state.minWidth,"px"),minHeight:"".concat(i.state.minHeight,"px")}},af().createElement("div",vf({style:Object.assign(Object.assign({},a),{position:"relative",overflow:"hidden"})},r||{},{ref:o}),e))}function gf(t){return gf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gf(t)}function bf(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */bf=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:O(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",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"==gf(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,n,r){var o=p;return function(i,a){if(o===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=T(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 T(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,T(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 E(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(E,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(gf(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 wf(t){return function(t){if(Array.isArray(t))return kf(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Sf(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 _f(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||Sf(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Sf(t,e){if(t){if("string"==typeof t)return kf(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)?kf(t,e):void 0}}function kf(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 xf(t){var e=bf().mark(R),n=t.sentence,r=t.gameState,o=t.useTypeEffect,i=void 0===o||o,a=t.onCompleted,s=t.finished,u=t.count,c=t.className,l=_f((0,of.useState)(!1),2),f=l[0],p=l[1],d=(0,of.useMemo)((function(){return n.evaluate(El.getCtx({gameState:r}))}),[]),h=r.game,y=_f((0,of.useState)([]),2),v=y[0],m=y[1],g=(0,of.useRef)(R(d)),b=(0,of.useRef)(null),w=(0,of.useRef)(null),_=_f((0,of.useState)(0),2),k=_[0],x=_[1],A=_f((0,of.useReducer)((function(t){return t+1}),0),2)[1],O=_f((0,of.useState)(new Set),2),T=O[0],E=O[1],P=_f((0,of.useState)(!1),2),j=P[0],C=P[1];function I(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];w.current&&(clearTimeout(w.current),w.current=null);for(var e=!1;!e;){var n=g.current.next(),o=n.done,i=n.value;if(o)p(!0),a&&(r.logger.info("Say","Completed",o,i),a()),e=!0;else if(Ns.isPause(i)){if(t)continue;N(Ns.from(i)),e=!0}else L(i)}}function L(t){m((function(e){if("\n"!==t&&T.has(t))return e;E((function(e){return new Set(e).add(t)}));var n=e[e.length-1];return n&&"\n"!==n&&"\n"!==t&&n.tag===t.tag?[].concat(wf(e.slice(0,-1)),[{text:n.text+t.text,config:t.config,tag:t.tag,tag2:t.tag2}]):[].concat(wf(e),[t])}))}function N(t){r.logger.info("Say","Paused",t),t.config.duration?b.current=setTimeout((function(){b.current=null,x((function(t){return t+1}))}),t.config.duration):C(!0)}function R(t){var n,r,o,i,a;return bf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=wf(t),r=0;case 2:if(!(r<n.length)){e.next=24;break}if(o=n[r],!Ns.isPause(o.text)){e.next=8;break}return e.next=7,Ns.from(o.text);case 7:return e.abrupt("continue",21);case 8:i=0;case 9:if(!(i<o.text.length)){e.next=21;break}if("\n"!==(a=o.text[i])){e.next=16;break}return e.next=14,"\n";case 14:e.next=18;break;case 16:return e.next=18,{text:a,config:o.config,tag:r,tag2:i};case 18:i++,e.next=9;break;case 21:r++,e.next=2;break;case 24:return e.abrupt("return");case 25:case"end":return e.stop()}}),e)}return(0,of.useEffect)((function(){if(i||I(!0),s&&!f)return b.current&&clearTimeout(b.current),b.current=null,I(!0),void(a&&(r.logger.info("Say","Completed",b.current,s,f),a()));if(f||s||j||b.current)r.logger.debug("Sentence.tsx","locked",f,s,j);else{var t=g.current.next(),e=t.done,n=t.value;if(e)return p(!0),void(a&&(r.logger.info("Say","Completed",e,n),a()));Ns.isPause(n)?N(Ns.from(n)):(L(n),A(),w.current=setTimeout((function(){x((function(t){return t+1}))}),h.config.elements.say.textInterval))}}),[k,s,j]),(0,of.useEffect)((function(){if(u&&!b.current){if(j)return C(!1),void x((function(t){return t+1}));I(),x((function(t){return t+1}))}}),[u]),af().createElement("div",{className:rf("whitespace-pre-wrap",h.config.elementStyles.say.textContainerClassName,{"font-bold":n.config.bold,italic:n.config.italic},c),style:{fontFamily:n.config.fontFamily||h.config.elementStyles.say.fontFamily,fontSize:n.config.fontSize||h.config.elementStyles.say.fontSize}},v.map((function(t,e){return"\n"===t?af().createElement("br",{key:e}):af().createElement("span",{key:e,style:Object.assign({color:S(t.config.color||n.config.color||Ds.defaultColor),fontFamily:t.config.fontFamily,fontSize:t.config.fontSize},h.config.app.debug?{border:"1px dashed red"}:{}),className:rf(h.config.elementStyles.say.textSpanClassName,"whitespace-pre inline-block",{"font-bold":t.config.bold,italic:t.config.italic},t.config.className)},t.config.ruby?af().createElement("ruby",{className:"align-bottom inline-block"},af().createElement("rt",{className:"block text-center"},t.config.ruby),t.text):t.text)})))}function Af(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 Of(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)?Of(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 Of(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,n=t.action,r=t.onClick,o=t.useTypeEffect,i=void 0===o||o,a=t.className,s=t.state,u=n.sentence,c=Af((0,of.useState)(!1),2),l=c[0],f=c[1],p=s.game,d=Af((0,of.useState)(0),2),h=d[0],y=d[1];return(0,of.useEffect)((function(){if(window){var t=function(t){p.config.elements.say.nextKey.includes(t.key)&&(l?r&&r():y((function(t){return t+1})))};return window.addEventListener("keyup",t),function(){window.removeEventListener("keyup",t)}}console.warn("Failed to add event listener, window is not available\nat Say.tsx: onElementClick")}),[l]),(0,of.useEffect)((function(){var t=s.events.onEvents([{type:ef.EventTypes["event:state.player.skip"],listener:s.events.on(ef.EventTypes["event:state.player.skip"],(function(){s.logger.log("NarraLeaf-React: Say","Skipped"),l?r&&r():f(!0)}))}]);return function(){t.cancel()}})),af().createElement(mf,{className:"absolute"},u.state.display&&af().createElement("div",{className:rf("absolute bottom-0 w-[calc(100%-40px)] min-h-[calc(33%-40px)] m-4 bg-white flex flex-col items-start justify-between",p.config.elementStyles.say.containerClassName,a),onClick:function(){l?r&&r():y((function(t){return t+1}))}},af().createElement("div",{className:rf("rounded-br-md",p.config.elementStyles.say.nameTextClassName)},null===(e=u.config.character)||void 0===e?void 0:e.state.name),af().createElement(xf,{sentence:u,gameState:s,finished:l,useTypeEffect:i,onCompleted:function(){f(!0)},count:h}),af().createElement("div",null)))}function Ef(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}var jf=af().createContext(null);function Cf(t){var e=t.children,n=t.game,r=new Vf({}),o=Ef((0,of.useState)(n||r),2),i=o[0],a=o[1];return af().createElement(jf.Provider,{value:{game:i,setGame:a}},e)}function If(){var t=(0,of.useContext)(jf);if(!t)throw new Error("useGame must be used within a GameProvider");return t}var Lf,Nf={say:Tf,menu:function(t){var e=t.prompt,n=t.choices,r=t.afterChoose,o=t.state,i=If().game,a=i.config.elements.say.use;return af().createElement(af().Fragment,null,af().createElement(mf,{className:"absolute"},af().createElement("div",{className:"absolute flex flex-col items-center justify-center min-w-full w-full h-full"},e&&af().createElement(a,{state:o,action:{sentence:e,character:null},useTypeEffect:!1,className:"z-10"}))),af().createElement(mf,{className:"absolute"},af().createElement("div",{className:rf("absolute flex flex-col items-center justify-center min-w-full w-full h-full",i.config.elementStyles.menu.containerClassName)},af().createElement("div",{className:"p-4 rounded-lg w-full z-20"},af().createElement("div",{className:"flex flex-col items-center mt-4 w-full"},n.map((function(t,e){return af().createElement("button",{key:e,className:rf("bg-white text-black p-2 mt-2 w-1/2",i.config.elementStyles.menu.choiceButtonClassName),onClick:function(){return function(t){r(t)}(t)}},af().createElement(xf,{sentence:t.prompt,gameState:o,useTypeEffect:!1,className:rf(i.config.elementStyles.menu.choiceButtonTextClassName)}))})))))))}};function Rf(t){return Rf="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},Rf(t)}function Mf(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ff(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Bf(r.key),r)}}function Df(t,e,n){return e&&Ff(t.prototype,e),n&&Ff(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Bf(t){var e=function(t,e){if("object"!=Rf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Rf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Rf(e)?e:e+""}!function(t){t.game="game"}(Lf||(Lf={}));var Vf=function(){return Df((function t(e){Mf(this,t),this.liveGame=null,this.config=b(t.DefaultConfig,e)}),[{key:"useComponent",value:function(t,e){if(!Object.keys(Nf).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 Gf(this)}}])}();Vf.defaultSettings={volume:1},Vf.ComponentTypes={say:"say",menu:"menu"},Vf.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:Nf.say},img:{slowLoadWarning:!0,slowLoadThreshold:2e3,allowSkipTransform:!0,allowSkipTransition:!0},menu:{use:Nf.menu},background:{allowSkipTransform:!0,allowSkipTransition:!1},text:{allowSkipTransform:!0,allowSkipTransition:!0}},elementStyles:{say:{containerClassName:"",nameTextClassName:"",textContainerClassName:"",textSpanClassName:"",rubyClassName:""},menu:{containerClassName:"",choiceButtonClassName:"",choiceButtonTextClassName:""}},app:{debug:!1,logger:{log:!1,info:!1,warn:!0,error:!0,debug:!1,trace:!1}}},Vf.GameSettingsNamespace=Lf;var Gf=function(){function t(e){Mf(this,t),this.gameLock=new j,this.currentSavedGame=null,this.story=null,this.lockedAwaiting=null,this.gameState=void 0,this._lockedCount=0,this.currentAction=null,this._nextLock=new P,this.game=e,this.storable=new Wl,this.initNamespaces()}return Df(t,[{key:"initNamespaces",value:function(){return this.storable.clear().addNamespace(new Hl(t.GameSpacesKey.game,t.DefaultNamespaces.game)),this}},{key:"getStorable",value:function(){return this.storable}},{key:"loadStory",value:function(t){return this.story=t.constructStory(),this}},{key:"serialize",value:function(){var t,e,n;if(!this.gameState)throw new Error("No game state");var r=this.gameState,o=this.story;if(!o)throw new Error("No story loaded");var i=this.storable.toData(),a=r.toData(),s=(null===(t=this.getCurrentAction())||void 0===t?void 0:t.getId())||null,u=o.getAllElementStates();return{name:(null===(e=this.currentSavedGame)||void 0===e?void 0:e.name)||"",meta:{created:(null===(n=this.currentSavedGame)||void 0===n?void 0:n.meta.created)||Date.now(),updated:Date.now()},game:{store:i,stage:a,currentAction:s,elementStates:u}}}},{key:"deserialize",value:function(t){var e;if(!this.gameState)throw new Error("No game state");var n=this.gameState,r=this.story;if(!r)throw new Error("No story loaded");this.reset({gameState:n}),n.stage.forceUpdate();var o=new Map,i=new Map,a=t.game,s=a.store,u=a.stage,c=a.elementStates,l=a.currentAction;if(r.forEachChild((null===(e=r.entryScene)||void 0===e?void 0:e.sceneRoot)||[],(function(t){o.set(t.getId(),t),i.set(t.callee.getId(),t.callee)})),this.storable.load(s),c.forEach((function(t){var e=t.id,r=t.data;n.logger.debug("restore element",e);var o=i.get(e);if(!o)throw new Error("Element not found, id: "+e+"\nNarraLeaf cannot find the element with the id from the saved game");o.reset(),o.fromData(r)})),this.currentSavedGame=t,n.loadData(u,i),l){var f=o.get(l);if(!f)throw new Error("Action not found, id: "+l+"\nNarraLeaf cannot find the action with the id from the saved game");this.currentAction=f}n.stage.forceUpdate(),n.stage.next()}},{key:"newGame",value:function(){var t,e,n;if(!this.gameState)throw new Error("No game state");var r=this.gameState;this.reset({gameState:r}),this.initNamespaces();var o=this.getNewSavedGame();o.name="NewGame-"+Date.now(),this.currentSavedGame=o;var i=null===(t=this.story)||void 0===t?void 0:t.getAllElementMap((null===(n=null===(e=this.story)||void 0===e?void 0:e.entryScene)||void 0===n?void 0:n.sceneRoot)||[]);return i?i.forEach((function(t){r.logger.debug("reset element",t),t.reset()})):r.logger.warn("No elements found"),r.stage.forceUpdate(),r.stage.next(),this}},{key:"reset",value:function(t){var e,n,r=t.gameState;this.lockedAwaiting&&this.lockedAwaiting.abort(),this.currentAction=(null===(n=null===(e=this.story)||void 0===e?void 0:e.entryScene)||void 0===n?void 0:n.sceneRoot)||null,this.lockedAwaiting=null,this.currentSavedGame=null,r.forceReset()}},{key:"getCurrentAction",value:function(){return this.currentAction}},{key:"setCurrentAction",value:function(t){return this.currentAction=t,this}},{key:"next",value:function(t){var e,n;if(this._nextLock.isLocked())return null;if(this._nextLock.lock(),this.gameLock.isLocked())return this.gameLock;if(!this.story)throw new Error("No story loaded");if(this.lockedAwaiting){if(!this.lockedAwaiting.solved){if(this._lockedCount++,this._lockedCount>1e3)throw new Error("Locked awaiting");return this._nextLock.unlock(),this.lockedAwaiting}var r=this.lockedAwaiting.result;return this.currentAction=(null===(e=null==r?void 0:r.node)||void 0===e?void 0:e.action)||null,t.logger.debug("next action",r),this.lockedAwaiting=null,this._nextLock.unlock(),r||null}if(!this.currentAction)return t.events.emit(ef.EventTypes["event:state.end"]),t.logger.warn("LiveGame","No current action"),this._nextLock.unlock(),null;var o=this.currentAction.executeAction(t);return w.isAwaitable(o)?(this.lockedAwaiting=o,this._nextLock.unlock(),o):(t.logger.debug("next action",o),this._lockedCount=0,this.currentAction=(null===(n=o.node)||void 0===n?void 0:n.action)||null,this._nextLock.unlock(),o)}},{key:"abortAwaiting",value:function(){var t;if(this.lockedAwaiting){var e=this.lockedAwaiting.abort();this.currentAction=(null===(t=null==e?void 0:e.node)||void 0===t?void 0:t.action)||null,this.lockedAwaiting=null}}},{key:"executeAction",value:function(t,e){var n,r=e.executeAction(t);return w.isAwaitable(r)?r:(null===(n=null==r?void 0:r.node)||void 0===n?void 0:n.action)||null}},{key:"setGameState",value:function(t){return this.gameState=t,this}},{key:"getGameState",value:function(){return this.gameState}},{key:"getNewSavedGame",value:function(){var t,e,n;return{name:"",meta:{created:Date.now(),updated:Date.now()},game:{store:{},stage:{scenes:[]},elementStates:[],currentAction:(null===(n=null===(e=null===(t=this.story)||void 0===t?void 0:t.entryScene)||void 0===e?void 0:e.sceneRoot)||void 0===n?void 0:n.getId())||null}}}}])}();Gf.DefaultNamespaces={game:{}},Gf.GameSpacesKey={game:"game"};var Uf=o(72),zf=o.n(Uf),Hf=o(825),Wf=o.n(Hf),$f=o(659),Yf=o.n($f),qf=o(56),Xf=o.n(qf),Kf=o(540),Zf=o.n(Kf),Qf=o(113),Jf=o.n(Qf),tp=o(587),ep={};ep.styleTagTransform=Jf(),ep.setAttributes=Xf(),ep.insert=Yf().bind(null,"head"),ep.domAPI=Wf(),ep.insertStyleElement=Zf();zf()(tp.A,ep);tp.A&&tp.A.locals&&tp.A.locals;var np=o(387);const rp=(0,of.createContext)({strict:!1});function op(t){for(const e in t)Yi[e]={...Yi[e],...t[e]}}function ip({children:t,features:e,strict:n=!1}){const[,r]=(0,of.useState)(!ap(e)),o=(0,of.useRef)(void 0);if(!ap(e)){const{renderer:t,...n}=e;o.current=t,op(n)}return(0,of.useEffect)((()=>{ap(e)&&e().then((({renderer:t,...e})=>{op(e),o.current=t,r(!0)}))}),[]),(0,np.jsx)(rp.Provider,{value:{renderer:o.current,strict:n},children:t})}function ap(t){return"function"==typeof t}function sp(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 up(t,e,n={}){var r;const o=Ai(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(Ii(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(cp).forEach(((t,r)=>{t.notify("AnimationStart",e),a.push(up(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 cp(t,e){return t.sortNodePosition(e)}const lp=zi.length;function fp(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&fp(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let n=0;n<lp;n++){const r=zi[n],o=t.props[r];(Gi(o)||!1===o)&&(e[r]=o)}return e}const pp=[...Ui].reverse(),dp=Ui.length;function hp(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=>up(t,e,n)));r=Promise.all(o)}else if("string"==typeof e)r=up(t,e,n);else{const o="function"==typeof e?Ai(t,e,n.custom):e;r=Promise.all(Ii(t,o,n))}return r.then((()=>{t.notify("AnimationComplete",e)}))}(t,e,n))))}function yp(t){let e=hp(t),n=gp(),r=!0;const o=e=>(n,r)=>{var o;const i=Ai(t,r,"exit"===e?null===(o=t.presenceContext)||void 0===o?void 0:o.custom:void 0);if(i){const{transition:t,transitionEnd:e,...r}=i;n={...n,...r,...e}}return n};function i(i){const{props:a}=t,s=fp(t.parent)||{},u=[],c=new Set;let l={},f=1/0;for(let e=0;e<dp;e++){const p=pp[e],d=n[p],h=void 0!==a[p]?a[p]:s[p],y=Gi(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||Vi(h)||"boolean"==typeof h)continue;const g=vp(d.prevProp,h);let b=g||p===i&&d.isActive&&!m&&y||e>f&&y,w=!1;const _=Array.isArray(h)?h:[h];let S=_.reduce(o(p),{});!1===v&&(S={});const{prevResolvedValues:k={}}=d,x={...k,...S},A=e=>{b=!0,c.has(e)&&(w=!0,c.delete(e)),d.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in x){const e=S[t],n=k[t];if(l.hasOwnProperty(t))continue;let r=!1;r=vi(e)&&vi(n)?!sp(e,n):e!==n,r?null!=e?A(t):c.add(t):void 0!==e&&c.has(t)?A(t):d.protectedKeys[t]=!0}d.prevProp=h,d.prevResolvedValues=S,d.isActive&&(l={...l,...S}),r&&t.blockInitialAnimation&&(b=!1);b&&(!(m&&g)||w)&&u.push(..._.map((t=>({animation:t,options:{type:p}}))))}if(c.size){const e={};c.forEach((n=>{const r=t.getBaseTarget(n),o=t.getValue(n);o&&(o.liveStyle=!0),e[n]=null!=r?r:null})),u.push({animation:e})}let p=Boolean(u.length);return!r||!1!==a.initial&&a.initial!==a.animate||t.manuallyAnimateOnMount||(p=!1),r=!1,p?e(u):Promise.resolve()}return{animateChanges:i,setActive:function(e,r){var o;if(n[e].isActive===r)return Promise.resolve();null===(o=t.variantChildren)||void 0===o||o.forEach((t=>{var n;return null===(n=t.animationState)||void 0===n?void 0:n.setActive(e,r)})),n[e].isActive=r;const a=i(e);for(const t in n)n[t].protectedKeys={};return a},setAnimateFunction:function(n){e=n(t)},getState:()=>n,reset:()=>{n=gp(),r=!0}}}function vp(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!sp(e,t)}function mp(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function gp(){return{animate:mp(!0),whileInView:mp(),whileHover:mp(),whileTap:mp(),whileDrag:mp(),whileFocus:mp(),exit:mp()}}class bp{constructor(t){this.isMounted=!1,this.node=t}update(){}}let wp=0;const _p={animation:{Feature:class extends bp{constructor(t){super(t),t.animationState||(t.animationState=yp(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Vi(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 bp{constructor(){super(...arguments),this.id=wp++}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 Sp(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function kp(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const xp=t=>e=>(t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary)(e)&&t(e,kp(e));function Ap(t,e,n,r){return Sp(t,e,xp(n),r)}function Op(t){let e=null;return()=>{const n=()=>{e=null};return null===e&&(e=t,n)}}const Tp=Op("dragHorizontal"),Ep=Op("dragVertical");function Pp(){const t=function(t){let e=!1;if("y"===t)e=Ep();else if("x"===t)e=Tp();else{const t=Tp(),n=Ep();t&&n?e=()=>{t(),n()}:(t&&t(),n&&n())}return e}(!0);return!t||(t(),!1)}function jp(t,e){const n=e?"pointerenter":"pointerleave",r=e?"onHoverStart":"onHoverEnd";return Ap(t.current,n,((n,o)=>{if("touch"===n.pointerType||Pp())return;const i=t.getProps();t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",e);const a=i[r];a&&Gn.postRender((()=>a(n,o)))}),{passive:!t.getProps()[r]})}const Cp=(t,e)=>!!e&&(t===e||Cp(t,e.parentElement));function Ip(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,kp(n))}const Lp=new WeakMap,Np=new WeakMap,Rp=t=>{const e=Lp.get(t.target);e&&e(t)},Mp=t=>{t.forEach(Rp)};function Fp(t,e,n){const r=function({root:t,...e}){const n=t||document;Np.has(n)||Np.set(n,{});const r=Np.get(n),o=JSON.stringify(e);return r[o]||(r[o]=new IntersectionObserver(Mp,{root:t,...e})),r[o]}(e);return Lp.set(t,n),r.observe(t),()=>{Lp.delete(t),r.unobserve(t)}}const Dp={some:0,all:1};const Bp={inView:{Feature:class extends bp{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:Dp[r]};return Fp(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 bp{constructor(){super(...arguments),this.removeStartListeners=De,this.removeEndListeners=De,this.removeAccessibleListeners=De,this.startPointerPress=(t,e)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),r=Ap(window,"pointerup",((t,e)=>{if(!this.checkPressEnd())return;const{onTap:n,onTapCancel:r,globalTapTarget:o}=this.node.getProps(),i=o||Cp(this.node.current,t.target)?n:r;i&&Gn.update((()=>i(t,e)))}),{passive:!(n.onTap||n.onPointerUp)}),o=Ap(window,"pointercancel",((t,e)=>this.cancelPress(t,e)),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=Ro(r,o),this.startPress(t,e)},this.startAccessiblePress=()=>{const t=Sp(this.node.current,"keydown",(t=>{if("Enter"!==t.key||this.isPressing)return;this.removeEndListeners(),this.removeEndListeners=Sp(this.node.current,"keyup",(t=>{"Enter"===t.key&&this.checkPressEnd()&&Ip("up",((t,e)=>{const{onTap:n}=this.node.getProps();n&&Gn.postRender((()=>n(t,e)))}))})),Ip("down",((t,e)=>{this.startPress(t,e)}))})),e=Sp(this.node.current,"blur",(()=>{this.isPressing&&Ip("cancel",((t,e)=>this.cancelPress(t,e)))}));this.removeAccessibleListeners=Ro(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&&Gn.postRender((()=>n(t,e)))}checkPressEnd(){this.removeEndListeners(),this.isPressing=!1;return this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!Pp()}cancelPress(t,e){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&Gn.postRender((()=>n(t,e)))}mount(){const t=this.node.getProps(),e=Ap(t.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),n=Sp(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Ro(e,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}},focus:{Feature:class extends bp{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=Ro(Sp(this.node.current,"focus",(()=>this.onFocus())),Sp(this.node.current,"blur",(()=>this.onBlur())))}unmount(){}}},hover:{Feature:class extends bp{mount(){this.unmount=Ro(jp(this.node,!0),jp(this.node,!1))}unmount(){}}}},Vp=["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 Gp(t){return"string"==typeof t&&!t.includes("-")&&!!(Vp.indexOf(t)>-1||/[A-Z]/u.test(t))}const Up={renderer:(t,e)=>Gp(t)?new fa(e):new da(e,{allowProjection:t!==of.Fragment}),..._p,...Bp};function zp(t){var e=t.children;return af().createElement(ip,{features:Up,strict:!0},e)}function Hp(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 Wp(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)?Wp(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 Wp(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 $p(t){var e=t.children,n=t.className,r=Hp((0,of.useState)({}),2),o=r[0],i=r[1],a=yf().ratio,s=If().game,u=Hp((0,of.useReducer)((function(t){return t+1}),0),2)[1],c=s.config.player.minWidth,l=s.config.player.minHeight;return(0,of.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]),af().createElement("div",{id:s.config.player.contentContainerId,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"}},af().createElement("div",{className:rf(n),style:o},e))}function Yp(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 qp=(0,of.createContext)({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),Xp=(0,of.createContext)({}),Kp=(0,of.createContext)(null),Zp=Fi?of.useLayoutEffect:of.useEffect,{schedule:Qp,cancel:Jp}=Vn(queueMicrotask,!1);function td(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}const ed=(0,of.createContext)({});function nd(t,e,n,r,o){var i,a;const{visualElement:s}=(0,of.useContext)(Xp),u=(0,of.useContext)(rp),c=(0,of.useContext)(Kp),l=(0,of.useContext)(qp).reducedMotion,f=(0,of.useRef)();r=r||u.renderer,!f.current&&r&&(f.current=r(t,{visualState:e,parent:s,props:n,presenceContext:c,blockInitialAnimation:!!c&&!1===c.initial,reducedMotionConfig:l}));const p=f.current,d=(0,of.useContext)(ed);!p||p.projection||!o||"html"!==p.type&&"svg"!==p.type||function(t,e,n,r){const{layoutId:o,layout:i,drag:a,dragConstraints:s,layoutScroll:u,layoutRoot:c}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:rd(t.parent)),t.projection.setOptions({layoutId:o,layout:i,alwaysMeasureLayout:Boolean(a)||s&&td(s),visualElement:t,animationType:"string"==typeof i?i:"both",initialPromotionConfig:r,layoutScroll:u,layoutRoot:c})}(f.current,n,o,d),(0,of.useInsertionEffect)((()=>{p&&p.update(n,c)}));const h=n[Ei],y=(0,of.useRef)(Boolean(h)&&!(null===(i=window.MotionHandoffIsComplete)||void 0===i?void 0:i.call(window,h))&&(null===(a=window.MotionHasOptimisedAnimation)||void 0===a?void 0:a.call(window,h)));return Zp((()=>{p&&(window.MotionIsMounted=!0,p.updateFeatures(),Qp.render(p.render),y.current&&p.animationState&&p.animationState.animateChanges())})),(0,of.useEffect)((()=>{p&&(!y.current&&p.animationState&&p.animationState.animateChanges(),y.current&&(queueMicrotask((()=>{var t;null===(t=window.MotionHandoffMarkAsComplete)||void 0===t||t.call(window,h)})),y.current=!1))})),p}function rd(t){if(t)return!1!==t.options.allowProjection?t.projection:rd(t.parent)}function od(t,e,n){return(0,of.useCallback)((r=>{r&&t.mount&&t.mount(r),e&&(r?e.mount(r):e.unmount()),n&&("function"==typeof n?n(r):td(n)&&(n.current=r))}),[e])}function id(t){const{initial:e,animate:n}=function(t,e){if(Hi(t)){const{initial:e,animate:n}=t;return{initial:!1===e||Gi(e)?e:void 0,animate:Gi(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,(0,of.useContext)(Xp));return(0,of.useMemo)((()=>({initial:e,animate:n})),[ad(e),ad(n)])}function ad(t){return Array.isArray(t)?t.join(" "):t}const sd=(0,of.createContext)({}),ud=Symbol.for("motionComponentSymbol");function cd({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:r,Component:o}){t&&op(t);const i=(0,of.forwardRef)((function(t,i){let a;const s={...(0,of.useContext)(qp),...t,layoutId:ld(t)},{isStatic:u}=s,c=id(t),l=r(t,u);if(!u&&Fi){!function(){(0,of.useContext)(rp).strict;0}();const t=function(t){const{drag:e,layout:n}=Yi;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=nd(o,l,s,e,t.ProjectionNode)}return(0,np.jsxs)(Xp.Provider,{value:c,children:[a&&c.visualElement?(0,np.jsx)(a,{visualElement:c.visualElement,...s}):null,n(o,t,od(l,c.visualElement,i),l,u,c.visualElement)]})}));return i[ud]=o,i}function ld({layoutId:t}){const e=(0,of.useContext)(sd).id;return e&&void 0!==t?e+"-"+t:t}function fd(t){const e=un(t)?t.get():t;return mi(e)?e.toValue():e}function pd(t){return En.has(t)?"transform":ei.has(t)?Ti(t):void 0}const dd=t=>(e,n)=>{const r=(0,of.useContext)(Xp),o=(0,of.useContext)(Kp),i=()=>function({applyWillChange:t=!1,scrapeMotionValuesFromProps:e,createRenderState:n,onMount:r},o,i,a,s){const u={latestValues:yd(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,of.useRef)(null);return null===e.current&&(e.current=t()),e.current}(i)};function hd(t,e,n){const r=Array.isArray(e)?e:[e];for(let e=0;e<r.length;e++){const o=xi(t,r[e]);if(o){const{transitionEnd:t,transition:e,...r}=o;n(r,t)}}}function yd(t,e,n,r,o){var i;const a={},s=new Set,u=r&&void 0===(null===(i=t.style)||void 0===i?void 0:i.willChange),c=o(t,{});for(const t in c)a[t]=fd(c[t]);let{initial:l,animate:f}=t;const p=Hi(t),d=Wi(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&&!Vi(y)&&hd(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&&!Vi(f)&&hd(t,f,(t=>{for(const e in t){const t=pd(e);t&&s.add(t)}})),s.size&&(a.willChange=Array.from(s).join(","))),a}const vd=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),md=()=>({...vd(),attrs:{}}),gd={useVisualState:dd({scrapeMotionValuesFromProps:Mi,createRenderState:md,onMount:(t,e,{renderState:n,latestValues:r})=>{Gn.read((()=>{try{n.dimensions="function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch(t){n.dimensions={x:0,y:0,width:0,height:0}}})),Gn.render((()=>{aa(n,r,la(e.tagName),t.transformTemplate),ca(e,n)}))}})},bd={useVisualState:dd({applyWillChange:!0,scrapeMotionValuesFromProps:Ri,createRenderState:vd})};function wd(t,e,n){for(const r in e)un(e[r])||Ni(r,n)||(t[r]=e[r])}function _d(t,e){const n={};return wd(n,t.style||{},t),Object.assign(n,function({transformTemplate:t},e){return(0,of.useMemo)((()=>{const n=vd();return na(n,e,t),Object.assign({},n.vars,n.style)}),[e])}(t,e)),n}function Sd(t,e){const n={},r=_d(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 kd=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 xd(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||kd.has(t)}let Ad=t=>!xd(t);try{(Od=require("@emotion/is-prop-valid").default)&&(Ad=t=>t.startsWith("on")?!xd(t):Od(t))}catch(Ht){}var Od;function Td(t,e,n,r){const o=(0,of.useMemo)((()=>{const n=md();return aa(n,e,la(r),t.transformTemplate),{...n.attrs,style:{...n.style}}}),[e]);if(t.style){const e={};wd(e,t.style,t),o.style={...e,...o.style}}return o}function Ed(t=!1){return(e,n,r,{latestValues:o},i)=>{const a=(Gp(e)?Td:Sd)(n,o,i,e),s=function(t,e,n){const r={};for(const o in t)"values"===o&&"object"==typeof t.values||(Ad(o)||!0===n&&xd(o)||!e&&!xd(o)||t.draggable&&o.startsWith("onDrag"))&&(r[o]=t[o]);return r}(n,"string"==typeof e,t),u=e!==of.Fragment?{...s,...a,ref:r}:{},{children:c}=n,l=(0,of.useMemo)((()=>un(c)?c.get():c),[c]);return(0,of.createElement)(e,{...u,children:l})}}function Pd(t,e){return function(n,{forwardMotionProps:r}={forwardMotionProps:!1}){return cd({...Gp(n)?gd:bd,preloadedFeatures:t,useRender:Ed(r),createVisualElement:e,Component:n})}}const jd=Yp(Pd());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 Id(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Id=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:O(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",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"==Cd(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,n,r){var o=p;return function(i,a){if(o===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=T(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 T(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,T(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 E(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(E,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(Cd(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 Ld(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Nd(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Nd(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Nd(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var Rd=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};function Md(t){var e=this,n=t.state,r=t.displayable,o=t.child,i=r.element,a=r.state,s=void 0===a?i:a,u=(0,of.useRef)(null),c=Ld((0,of.useState)(null),2),l=c[0],f=c[1],p=Ld((0,of.useState)([]),2)[1],d=Ld((0,of.useState)(null),2),h=d[0],y=d[1],v=Ld((0,of.useState)({}),2),m=v[0],g=v[1];function w(t){if(h&&h.getControl()&&(n.logger.warn("Displayable Animation","processing transform not completed"),h.getControl().complete(),h.setControl(null)),!u.current)throw new Error("scope not ready");t instanceof Ia?Object.assign(u.current.style,t.propToCSS(n,s.state,r.transformOverwrites)):Object.assign(u.current.style,t)}function _(t){return f(t),t?new Promise((function(e){var r=t.events.onEvents([{type:kc.update,listener:t.events.on(kc.update,(function(t){p(t)}))},{type:kc.end,listener:t.events.on(kc.end,(function(){f(null),n.logger.debug("scene background transition end",t)}))},{type:kc.start,listener:t.events.on(kc.start,(function(){n.logger.debug("scene background transition start",t)}))}]);t.start((function(){r.cancel(),e()}))})):(n.logger.warn("transition not set"),Promise.resolve())}function S(t){return Rd(this,void 0,void 0,Id().mark((function e(){return Id().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return w(t.propToCSS(n,s.state,r.transformOverwrites)),y(t),e.next=4,t.animate({scope:u,target:s,overwrites:r.transformOverwrites},n,(function(e){s.state=b(s.state,e),g({style:t.propToCSS(n,s.state,r.transformOverwrites)}),y(null)}));case 4:case"end":return e.stop()}}),e)})))}return(0,of.useEffect)((function(){var t="event:displayable.applyTransition",o="event:displayable.applyTransform",a="event:displayable.init",c=i.events.onEvents([{type:t,listener:i.events.on(t,_)},{type:o,listener:i.events.on(o,S)},{type:a,listener:i.events.on(a,(function(){return Rd(e,void 0,void 0,Id().mark((function t(){var e;return Id().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=i.toDisplayableTransform(),n.logger.debug("init transform",e),t.next=4,e.animate({scope:u,target:s,overwrites:r.transformOverwrites},n,(function(t){s.state=b(s.state,t)}));case 4:case"end":return t.stop()}}),t)})))}))}]);return function(){c.cancel()}}),[]),(0,of.useEffect)((function(){if(!u.current)throw new Error("Scope not ready. Using element: ".concat(i.constructor.name))}),[]),(0,of.useEffect)((function(){var t=n.events.onEvents([{type:ef.EventTypes["event:state.player.skip"],listener:n.events.on(ef.EventTypes["event:state.player.skip"],(function(){r.skipTransform&&h&&h.getControl()&&(h.getControl().complete(),h.setControl(null),n.logger.debug("transform skip")),r.skipTransition&&l&&l.controller&&(l.controller.complete(),f(null),n.logger.debug("transition skip"))}))}]);return function(){t.cancel()}}),[l,h]),af().createElement(af().Fragment,null,o({transformRef:u,transition:l,transform:h,transformProps:m,state:n}))}function Fd(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 Dd(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)?Dd(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 Dd(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 Bd(){return Bd=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},Bd.apply(null,arguments)}function Vd(t){var e=t.scene,n=t.props,r=t.state;return af().createElement(Md,{displayable:{element:e,skipTransform:r.game.config.elements.background.allowSkipTransform,skipTransition:r.game.config.elements.background.allowSkipTransition},child:function(t){return af().createElement(Gd,Bd({},t,{scene:e,props:n}))},state:r})}function Gd(t){var e=t.transformRef,n=t.transformProps,r=t.transition,o=t.state,i=t.scene,a=t.props,s=yf().ratio,u=Fd(af().useState(!1),2),c=u[0],l=u[1];function f(){c||(l(!0),i.events.emit(ll.EventTypes["event:scene.imageLoaded"]),o.logger.debug("BackgroundTransition","Image loaded",i))}var p,d="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/wcAAgAB9sWFXTkAAAAASUVORK5CYII=",h={src:d,style:Object.assign({},o.game.config.app.debug?{border:"1px solid red"}:{})};return af().createElement("div",null,af().createElement(jd.div,Bd({layout:!0,ref:e,className:"absolute inset-0 flex items-center justify-center bg-cover bg-center overflow-hidden"},b({style:Object.assign({},s.getStyle())},n)),r?r.toElementProps().map((function(t,e){var n=b(h,a,t);return af().createElement("img",Bd({alt:n.alt},n,{onLoad:f,src:n.src?n.src:d,className:"absolute",key:e}))})):(p=b(h,a),af().createElement("img",Bd({key:"last",alt:p.alt},p,{onLoad:f,src:p.src||d,className:"absolute"})))))}function Ud(t){return Ud="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ud(t)}function zd(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */zd=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:O(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",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"==Ud(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,n,r){var o=p;return function(i,a){if(o===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=T(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 T(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,T(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 E(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(E,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(Ud(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 Hd(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 Wd(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wd(t,e):void 0}}(t,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 Wd(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}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 Yd(t){var e=t.scene,n=t.state,r=t.children,o=t.className,i=yf().ratio,a=Hd((0,of.useState)((function(){return e.state.backgroundMusic})),2),s=a[0],u=a[1];return(0,of.useEffect)((function(){var t=[{type:"event:scene.setBackgroundMusic",listener:e.events.on(ll.EventTypes["event:scene.setBackgroundMusic"],(function(t,e){(function(t,e){return $d(this,void 0,void 0,zd().mark((function r(){var o,i;return zd().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return o=s,i=t,r.next=4,n.transitionSound(o,i,e);case 4:if(i){r.next=6;break}return r.abrupt("return");case 6:u(i);case 7:case"end":return r.stop()}}),r)})))})(t,e).then()}))},{type:"event:scene.preUnmount",listener:e.events.on(ll.EventTypes["event:scene.preUnmount"],(function(){s&&function(t,e){return $d(this,void 0,void 0,zd().mark((function r(){return zd().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,n.fadeSound(t,0,e);case 2:n.stopSound(t);case 3:case"end":return r.stop()}}),r)})))}(s,e.state.backgroundMusicFade).then()}))}];return function(){t.forEach((function(t){var n=t.type,r=t.listener;e.events.off(n,r)}))}}),[]),(0,of.useEffect)((function(){return e.events.emit(ll.EventTypes["event:scene.mount"]),function(){e.events.emit(ll.EventTypes["event:scene.unmount"])}}),[]),af().createElement("div",{className:o},af().createElement(Vd,{scene:e,props:{width:i.state.width,height:i.state.height,src:bs.isImageSrc(e.state.background)?bs.srcToString(e.state.background):void 0,style:{backgroundColor:bs.isImageColor(e.state.background)?bs.toHex(e.state.background):void 0}},state:n}),r)}function qd(){return qd=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},qd.apply(null,arguments)}function Xd(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 Kd(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)?Kd(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 Kd(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 Zd(t){var e=t.image,n=t.state,r=Xd((0,of.useState)(0),2),o=r[0],i=r[1],a=If().game;(0,of.useEffect)((function(){i(performance.now())}),[]);var s=function(){var t=performance.now()-o,e=a.config.elements.img.slowLoadThreshold;t>e&&a.config.elements.img.slowLoadWarning&&n.logger.warn("NarraLeaf-React","Image took ".concat(t,"ms to load, which exceeds the threshold of ").concat(e,"ms. ")+"Consider enable cache for the image, so Preloader can preload it before it's used. To disable this warning, set `elements.img.slowLoadWarning` to false in the game config.")};return af().createElement(Md,{displayable:{element:e,skipTransition:n.game.config.elements.img.allowSkipTransition,skipTransform:n.game.config.elements.img.allowSkipTransform,transformOverwrites:{scale:function(){return{}}}},child:function(t){return af().createElement(Qd,qd({},t,{image:e,handleLoad:s}))},state:n})}function Qd(t){var e=t.transition,n=t.transformProps,r=t.transformRef,o=t.state,i=t.image,a=t.handleLoad,s={src:bs.staticImageDataToSrc(i.state.src),style:Object.assign(Object.assign({},o.game.config.app.debug?{border:"1px solid red"}:{}),{transformOrigin:"center"})},u=[{style:{display:"block",position:"unset"}},{style:{top:"50%",left:"50%",transform:"translate(-50%, -50%)"}}];return af().createElement("div",null,af().createElement(jd.div,qd({layout:!0,ref:r,className:"absolute"},b({style:{opacity:0,border:o.game.config.app.debug?"1px dashed yellow":void 0}},n,{style:{display:"inline-block"}})),e?af().createElement(af().Fragment,null,e.toElementProps().map((function(t,e,n){var r=b(s,t,{style:{}},u[e]||{});return af().createElement(jd.img,qd({className:"absolute",key:e===n.length-1?"last":e,alt:r.alt},r,{onLoad:a,layout:!0}))}))):af().createElement(jd.img,qd({alt:"image",key:"last"},b(s,{style:{}}),{onLoad:a,layout:!0})),(i.events.emit(qa.EventTypes["event:image.flush"]),null)))}function Jd(t){return Jd="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},Jd(t)}function th(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,eh(r.key),r)}}function eh(t){var e=function(t,e){if("object"!=Jd(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Jd(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Jd(e)?e:e+""}var nh=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.preloaded=[],this.events=new k}return function(t,e,n){return e&&th(t.prototype,e),n&&th(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?bs.srcToString(t.src.state.src):"video"===t.type?t.src:"audio"===t.type?t.src.getSrc():""}}])}();function rh(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 oh(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)?oh(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 oh(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}nh.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 ih=(0,of.createContext)(null);function ah(t){var e=t.children,n=rh((0,of.useState)(new nh),1)[0];return af().createElement(af().Fragment,null,af().createElement(ih.Provider,{value:{preloaded:n}},e))}function sh(){if(!ih)throw new Error("usePreloaded must be used within a PreloadedProvider");return(0,of.useContext)(ih)}function uh(t){return function(t){if(Array.isArray(t))return ch(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 ch(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)?ch(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 ch(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 lh(t){var e=t.state,n=sh().preloaded,r=e.getLastScene();return(0,of.useEffect)((function(){var t,r;if("undefined"!=typeof window){var o=null===(t=e.getLastScene())||void 0===t?void 0:t.srcManager,i=(null===(r=e.getLastScene())||void 0===r?void 0:r.srcManager.future)||[],a=[].concat(uh(o?o.src:[]),uh(i.map((function(t){return t.src})).flat(2))),s={image:new Set,audio:new Set,video:new Set};a.forEach((function(t){t.type===pc.SrcTypes.image?s.image.add(t.src):t.type===pc.SrcTypes.audio?s.audio.add(t.src):t.type===pc.SrcTypes.video&&s.video.add(t.src)})),e.logger.debug("Preloading",s,i),n.preloaded=n.preloaded.filter((function(t){if(t.type===pc.SrcTypes.audio){var e=s[t.type].has(t.src);return e||(e=Array.from(s[t.type]).some((function(e){return n.getSrc(t)===n.getSrc(e.config.src)}))),e}if(t.type===pc.SrcTypes.image)return s[t.type].has(t.src);var r=n.getSrc(t);return s[t.type].has(r)}));var u=[];return s.image.forEach((function(t){var r=new Image;r.src=bs.srcToString(t.state.src),r.onload=function(){e.logger.debug("Image loaded",t.state.src)},u.push(r),n.add({type:"image",src:t})})),Promise.all([]).then((function(){e.logger.log("Preloaded","Preloaded ".concat(s.image.size," images")),n.events.emit(nh.EventTypes["event:preloaded.ready"]),e.events.emit(ef.EventTypes["event:state.preload.loaded"])})),s.audio.forEach((function(t){t.getPlaying()||t.setPlaying(new(e.getHowl())({src:t.config.src,loop:t.config.loop,volume:t.config.volume,autoplay:!1,preload:!0}))})),n.events.emit(nh.EventTypes["event:preloaded.mount"]),function(){u.forEach((function(t){t.onload=null})),e.events.emit(ef.EventTypes["event:state.preload.unmount"]),e.logger.debug("Preload unmounted")}}console.warn("Window is not supported in this environment")}),[r]),null}function fh(t){var e=t.state,n=If().game;return(0,of.useEffect)((function(){if(window){var t,r,o,i=(t=function(t){n.config.player.skipKey.includes(t.key)&&e.events.emit(ef.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")}),[]),af().createElement(af().Fragment,null)}var ph=o(33);function dh(){return dh=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},dh.apply(null,arguments)}function hh(t){var e=t.state,n=t.text,r={scale:function(t){return{width:"fit-content"}},transform:function(t){return{transform:Ia.propToCSSTransform(e,t,["left"===n.config.alignX?"0%":"right"===n.config.alignX?"-100%":void 0,"top"===n.config.alignY?"100%":"bottom"===n.config.alignY?"0%":void 0])}}};return af().createElement(Md,{displayable:{element:n,skipTransform:e.game.config.elements.text.allowSkipTransform,skipTransition:e.game.config.elements.text.allowSkipTransition,transformOverwrites:r},child:function(t){return af().createElement(yh,dh({},t,{text:n}))},state:e})}function yh(t){var e=t.transformRef,n=t.transformProps,r=t.transition,o=t.state,i=t.text,a={style:Object.assign(Object.assign({width:"fit-content"},o.game.config.app.debug?{border:"1px solid red"}:{}),{whiteSpace:"nowrap"})},s=rf(i.config.className);return af().createElement(mf,{className:"absolute overflow-hidden pointer-events-none"},af().createElement(jd.div,dh({layout:!0,ref:e,className:"absolute"},b({style:{opacity:0}},n,{style:{width:"fit-content"}})),r?r.toElementProps().map((function(t,e){var r=b(a,n,t);return af().createElement(jd.span,dh({key:e,layout:!0},r,{className:s}),af().createElement("span",null,i.state.text))})):af().createElement(jd.div,dh({key:"last"},b(a,{style:{width:"fit-content"}}),{layout:!0}),af().createElement("span",{className:s},i.state.text))))}function vh(t){var e=t.state,n=t.displayable;return af().createElement(af().Fragment,null,n.map((function(t){var n;if(t instanceof Qc)return af().createElement(hh,{state:e,text:t,key:"text-"+t.getId()});throw new Error("Unsupported displayable type: "+((null===(n=null==t?void 0:t.constructor)||void 0===n?void 0:n.name)||t))})))}var mh=o(556),gh=o.n(mh);function bh(t){var e=t.error,n=t.errorInfo;return If().game.config.app.debug?af().createElement("div",null,af().createElement("h1",null,"It is my fault, NarraLeaf-React cannot initialize the player correctly."),af().createElement("p",null,"Message: ",e.message),af().createElement("pre",null,"Error Stack: ",e.stack),af().createElement("pre",null,"Component Stack: ",n.componentStack),af().createElement("pre",null,"Digest: ",n.digest)):af().createElement("div",null,af().createElement("h1",null,"The game cannot initialize the player correctly."),af().createElement("p",null,"Please contact the game developer for further assistance."))}function wh(t){return wh="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},wh(t)}function _h(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,Sh(r.key),r)}}function Sh(t){var e=function(t,e){if("object"!=wh(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=wh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==wh(e)?e:e+""}function kh(t,e,n){return e=Ah(e),function(t,e){if(e&&("object"==wh(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,xh()?Reflect.construct(e,n||[],Ah(t).constructor):e.apply(t,n))}function xh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(xh=function(){return!!t})()}function Ah(t){return Ah=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ah(t)}function Oh(t,e){return Oh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Oh(t,e)}var Th=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=kh(this,e,arguments)).state={hasError:!1,error:null,errorInfo:null},t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Oh(t,e)}(e,t),function(t,e,n){return e&&_h(t.prototype,e),n&&_h(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"componentDidCatch",value:function(t,e){this.setState({error:t,errorInfo:e}),console.error(t,e)}},{key:"render",value:function(){return this.state.hasError?af().createElement(bh,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}],[{key:"getDerivedStateFromError",value:function(t){return{hasError:!0,error:t,errorInfo:null}}}])}(af().Component);function Eh(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 Ph(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)?Ph(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 Ph(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 jh(t,e){return t.handle(e)}function Ch(t){var e=t.story,n=t.width,r=t.height,o=t.className,i=t.onReady,a=t.onEnd,s=Eh((0,of.useReducer)((function(t){return t+1}),0),2)[1],u=If().game,c=Eh((0,of.useReducer)(jh,new ef(u,{update:s,forceUpdate:function(){l.logger.warn("Player","force update"),(0,ph.flushSync)((function(){s()}))},next:h,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 h(){for(var t=!1;!t;){var e=u.getLiveGame().next(l);if(!e)break;if(w.isAwaitable(e)){t=!0;break}if(e instanceof j){e.nextUnlock().then((function(){h()})),t=!0;break}f(e)}l.stage.update()}(0,of.useEffect)((function(){return u.getLiveGame().setGameState(l).loadStory(e),function(){u.getLiveGame().setGameState(void 0)}}),[u]),(0,of.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:ef.EventTypes["event:state.end"],listener:function(){a&&a({game:u,gameState:l,liveGame:u.getLiveGame(),storable:u.getLiveGame().getStorable()})}}]),o=l.events.onEvents([{type:ef.EventTypes["event:state.player.skip"],listener:function(){u.getLiveGame().abortAwaiting(),h()}}]);return l.stage.update(),function(){e&&n.forEach((function(t){e.events.off(t.type,t.listener)})),r.cancel(),o.cancel()}}));return function(){t&&e.then((function(t){return t()}))}}),[]),l.events.emit(ef.EventTypes["event:state.player.flush"]);var y=n||u.config.player.width,v=r||u.config.player.height;return af().createElement(Th,null,af().createElement(zp,null,af().createElement("div",{style:{width:"number"==typeof y?"".concat(y,"px"):y,height:"number"==typeof v?"".concat(v,"px"):v},className:rf(o,"__narraleaf_content-player")},af().createElement($p,{className:rf("flex-grow overflow-auto")},af().createElement(mf,{className:"relative"},af().createElement(lh,{state:l}),af().createElement(Ih,{onLoaded:function(){l.stage.update(),e&&h()},state:l},af().createElement(fh,{state:l}),l.getSceneElements().map((function(t){var e=t.scene,n=t.ele;return af().createElement(Yd,{key:"scene-"+e.getId(),state:l,scene:e},n.images.map((function(t){return af().createElement(Zd,{key:"image-"+t.getId(),image:t,state:l})})),af().createElement(vh,{state:l,displayable:n.displayable}),n.texts.map((function(t){var e=t.action,n=t.onClick;return af().createElement(p,{state:l,key:"say-"+e.id,action:e,onClick:function(){n(),h()}})})),n.menus.map((function(t,e){return af().createElement("div",{key:"menu-"+e},af().createElement(d,{state:l,prompt:t.action.prompt,choices:t.action.choices,afterChoose:function(e){t.onClick(e),h()}}))})))}))))))))}function Ih(t){var e=t.children,n=t.onLoaded,r=t.state,o=sh().preloaded,i=Eh((0,of.useState)(!1),2),a=i[0],s=i[1];return(0,of.useEffect)((function(){var t=o.events.on(nh.EventTypes["event:preloaded.ready"],(function(){s(!0),n()})),e=r.events.on(ef.EventTypes["event:state.preload.unmount"],(function(){s(!1)}));return function(){o.events.off(nh.EventTypes["event:preloaded.ready"],t),r.events.off(ef.EventTypes["event:state.preload.unmount"],e)}}),[a]),af().createElement(af().Fragment,null,a?e:null)}function Lh(t){var e=t.children,n=t.game;return af().createElement(af().Fragment,null,af().createElement(hf,null,af().createElement(Cf,{game:n},af().createElement(ah,null,e))))}function Nh(t){return Nh="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},Nh(t)}function Rh(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,Mh(r.key),r)}}function Mh(t){var e=function(t,e){if("object"!=Nh(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Nh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Nh(e)?e:e+""}function Fh(t,e,n){return e=Bh(e),function(t,e){if(e&&("object"==Nh(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,Dh()?Reflect.construct(e,n||[],Bh(t).constructor):e.apply(t,n))}function Dh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Dh=function(){return!!t})()}function Bh(t){return Bh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Bh(t)}function Vh(t,e){return Vh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Vh(t,e)}Th.propTypes={children:gh().node.isRequired};var Gh=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=Fh(this,e)).state={opacity:1},t.duration=n,t.easing=r,t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Vh(t,e)}(e,t),function(t,e,n){return e&&Rh(t.prototype,e),n&&Rh(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){return this.src=t,this}},{key:"start",value:function(t){var n=this;this.state.opacity=e.Frames[0],this.requestAnimation({start:e.Frames[0],end:e.Frames[1],duration:this.duration},{onComplete:function(){t&&t(),n.state.opacity=e.Frames[1]},onUpdate:function(t){n.state.opacity=t}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{opacity:1}},{style:{opacity:this.state.opacity,backgroundColor:bs.isImageColor(this.src)?S(this.src):""},src:bs.isImageSrc(this.src)?bs.srcToString(this.src):""}]}},{key:"copy",value:function(){return new e(this.duration,this.easing).setSrc(this.src)}}])}(Rc);function Uh(t){return Uh="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},Uh(t)}function zh(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,Hh(r.key),r)}}function Hh(t){var e=function(t,e){if("object"!=Uh(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Uh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Uh(e)?e:e+""}function Wh(t,e,n){return e=Yh(e),function(t,e){if(e&&("object"==Uh(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,$h()?Reflect.construct(e,n||[],Yh(t).constructor):e.apply(t,n))}function $h(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return($h=function(){return!!t})()}function Yh(t){return Yh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Yh(t)}function qh(t,e){return qh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},qh(t,e)}Gh.Frames=[0,1];var Xh=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=Wh(this,e)).state={opacity:0,transform:""},r.duration=o,r.direction=t,r.offset=n,r.easing=i,r.__stack=x(),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&qh(t,e)}(e,t),function(t,e,n){return e&&zh(t.prototype,e),n&&zh(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){return this.src=t,this}},{key:"start",value:function(t){var e=this;if(!this.src)throw new Error("src is required, but not provided\nat:\n"+this.__stack);this.state.opacity=0,this.state.transform=this.getInitialTransform(),this.requestAnimation({start:0,end:1,duration:this.duration},{onComplete:t,onUpdate:function(t){e.state.opacity=t,e.state.transform=e.getTransform(t)}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{opacity:1}},{style:{opacity:this.state.opacity,transform:this.state.transform,backgroundColor:bs.isImageColor(this.src)?S(this.src):""},src:bs.isImageSrc(this.src)?bs.srcToString(this.src):""}]}},{key:"copy",value:function(){return new e(this.direction,this.offset,this.duration,this.easing).setSrc(this.src)}},{key:"getInitialTransform",value:function(){switch(this.direction){case"left":return"translateX(-".concat(this.offset,"px)");case"right":return"translateX(".concat(this.offset,"px)");case"top":return"translateY(-".concat(this.offset,"px)");case"bottom":return"translateY(".concat(this.offset,"px)");default:return""}}},{key:"getTransform",value:function(t){switch(this.direction){case"left":return"translateX(".concat((1-t)*-this.offset,"px)");case"right":return"translateX(".concat((1-t)*this.offset,"px)");case"top":return"translateY(".concat((1-t)*-this.offset,"px)");case"bottom":return"translateY(".concat((1-t)*this.offset,"px)");default:return""}}}])}(Rc);function Kh(t){return Kh="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},Kh(t)}function Zh(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,Qh(r.key),r)}}function Qh(t){var e=function(t,e){if("object"!=Kh(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Kh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Kh(e)?e:e+""}function Jh(t,e,n){return e=ey(e),function(t,e){if(e&&("object"==Kh(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,ty()?Reflect.construct(e,n||[],ey(t).constructor):e.apply(t,n))}function ty(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ty=function(){return!!t})()}function ey(t){return ey=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ey(t)}function ny(t,e){return ny=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ny(t,e)}var ry=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=Jh(this,e)).state={opacity:0},t.duration=n,t.easing=r,t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ny(t,e)}(e,t),function(t,e,n){return e&&Zh(t.prototype,e),n&&Zh(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){return this.src=t,this}},{key:"start",value:function(t){var n=this;this.state.opacity=e.Frames[0],this.requestAnimation({start:e.Frames[0],end:e.Frames[1],duration:this.duration},{onComplete:function(){n.state.opacity=e.Frames[1],t&&t()},onUpdate:function(t){n.state.opacity=t}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{opacity:this.state.opacity}},{style:{opacity:1-this.state.opacity,backgroundColor:bs.isImageColor(this.src)?S(this.src):""},src:bs.isImageSrc(this.src)?bs.srcToString(this.src):""}]}},{key:"copy",value:function(){return new e(this.duration,this.easing).setSrc(this.src)}}])}(Rc);ry.Frames=[1,0]})(),i})()));
31
+ */function c(t,e,n){var r,i={},c=null,l=null;for(r in void 0!==n&&(c=""+n),void 0!==e.key&&(c=""+e.key),void 0!==e.ref&&(l=e.ref),e)a.call(e,r)&&!u.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps)void 0===i[r]&&(i[r]=e[r]);return{$$typeof:o,type:t,key:c,ref:l,props:i,_owner:s.current}}e.jsx=c,e.jsxs=c},387:(t,e,n)=>{"use strict";t.exports=n(73)},12:e=>{"use strict";e.exports=t},33:t=>{"use strict";t.exports=e}},r={};function o(t){var e=r[t];if(void 0!==e)return e.exports;var i=r[t]={id:t,exports:{}};return n[t](i,i.exports,o),i.exports}o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.nc=void 0;var i={};return(()=>{"use strict";o.r(i),o.d(i,{Align:()=>Pe,BaseImageTransition:()=>Mc,BaseTextTransition:()=>Fc,BaseTransition:()=>Rc,Character:()=>cu,CommonPosition:()=>Te,CommonPositionType:()=>ye,Condition:()=>Nu,Control:()=>Ga,Coord2D:()=>je,Dissolve:()=>yy,Fade:()=>Jh,FadeIn:()=>sy,Game:()=>Fp,GameProviders:()=>Wh,GameState:()=>nf,Image:()=>Xa,Isolated:()=>jp,Lambda:()=>Lu,LiveGame:()=>Dp,Menu:()=>Ju,Namespace:()=>Wl,Pause:()=>Rs,Player:()=>zh,Say:()=>Ep,Scene:()=>fl,Script:()=>jl,Sentence:()=>Ws,Sound:()=>Cs,SoundType:()=>_s,Storable:()=>$l,Story:()=>Fl,Text:()=>Jc,Transform:()=>La,Utils:()=>ws,Word:()=>Bs,useGame:()=>pf});var t={say:"character:say",action:"character:action",setName:"character:setName"},e={action:"scene:action",setBackground:"scene:setBackground",sleep:"scene:sleep",setTransition:"scene:setTransition",applyTransition:"scene:applyTransition",init:"scene:init",exit:"scene:exit",jumpTo:"scene:jumpTo",setBackgroundMusic:"scene:setBackgroundMusic",preUnmount:"scene:preUnmount",applyTransform:"scene:applyTransform"},n={action:"image:action",setSrc:"image:setSrc",setPosition:"image:setPosition",show:"image:show",hide:"image:hide",applyTransform:"image:applyTransform",init:"image:init",dispose:"image:dispose",setTransition:"image:setTransition",applyTransition:"image:applyTransition",flush:"image:flush"},r={action:"sound:action",play:"sound:play",stop:"sound:stop",fade:"sound:fade",setVolume:"sound:setVolume",setRate:"sound:setRate",pause:"sound:pause",resume:"sound:resume"},a={action:"control:action",do:"control:do",doAsync:"control:doAsync",any:"control:any",all:"control:all",allAsync:"control:allAsync",repeat:"control:repeat",sleep:"control:sleep"},s={action:"text:action",setText:"text:setText",show:"text:show",hide:"text:hide",applyTransform:"text:applyTransform",init:"text:init",applyTransition:"text:applyTransition",setFontSize:"text:setFontSize"};function u(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */u=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var i=e&&e.prototype instanceof b?e:b,a=Object.create(i.prototype),s=new I(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function p(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var d="suspendedStart",h="suspendedYield",y="executing",v="completed",g={};function b(){}function w(){}function _(){}var S={};l(S,a,(function(){return this}));var k=Object.getPrototypeOf,x=k&&k(k(L([])));x&&x!==n&&r.call(x,a)&&(S=x);var A=_.prototype=b.prototype=Object.create(S);function O(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(o,i,a,s){var u=p(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==m(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function T(e,n,r){var o=d;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=j(s,r);if(u){if(u===g)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===d)throw o=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=y;var c=p(e,n,r);if("normal"===c.type){if(o=r.done?v:h,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=v,r.method="throw",r.arg=c.arg)}}}function j(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,j(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=p(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function L(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(m(e)+" is not iterable")}return w.prototype=_,o(A,"constructor",{value:_,configurable:!0}),o(_,"constructor",{value:w,configurable:!0}),w.displayName=l(_,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,l(t,c,"GeneratorFunction")),t.prototype=Object.create(A),t},e.awrap=function(t){return{__await:t}},O(E.prototype),l(E.prototype,s,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new E(f(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(A),l(A,c,"Generator"),l(A,a,(function(){return this})),l(A,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=L,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(C),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;C(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:L(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function c(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=y(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,d(r.key),r)}}function p(t,e,n){return e&&f(t.prototype,e),n&&f(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function d(t){var e=function(t,e){if("object"!=m(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=m(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==m(e)?e:e+""}function h(t){return function(t){if(Array.isArray(t))return v(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||y(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(t,e){if(t){if("string"==typeof t)return v(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(t,e):void 0}}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function m(t){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},m(t)}var g=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};function b(t,e){var n=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r={},o=function(t,e,n){return"object"!==m(e)||null===e||Array.isArray(e)||"object"!==m(n)||null===n||Array.isArray(n)?Array.isArray(e)&&Array.isArray(n)?e.map((function(t,e){return"object"===m(t)&&null!==t&&!Array.isArray(t)&&n[e]?b(t,n[e]):t})):void 0===n?e:n:e.constructor!==Object||n.constructor!==Object?n||e:b(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"===m(e[a])&&null!==e[a]&&e[a].constructor===Object?r[a]=b({},e[a]):r[a]=e[a]);for(var s=arguments.length,u=new Array(s>2?s-2:0),c=2;c<s;c++)u[c-2]=arguments[c];if(u.length){var l=u[0],f=u.slice(1);return b.apply(void 0,[r,l].concat(h(f)))}return r}var w=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t},n=arguments.length>1?arguments[1]:void 0;l(this,t),this.solved=!1,this.listeners=[],this.receiver=e,this.skipController=n}return p(t,[{key:"registerSkipController",value:function(t){return this.skipController=t,this}},{key:"resolve",value:function(t){if(!this.solved){this.result=this.receiver(t),this.solved=!0,this.skipController&&this.skipController.cancel();var e,n=c(this.listeners);try{for(n.s();!(e=n.n()).done;){(0,e.value)(this.result)}}catch(t){n.e(t)}finally{n.f()}}}},{key:"then",value:function(t){this.result?t(this.result):this.listeners.push(t)}},{key:"abort",value:function(){return this.skipController?this.skipController.abort():this.result}}],[{key:"isAwaitable",value:function(e){return e instanceof t}}])}();function _(t){var e=new WeakSet;return function t(n){if(null===n||"object"!==m(n))return n;if(!e.has(n)){if(e.add(n),Array.isArray(n)){var r,o=[],i=c(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;o.push(t(a))}}catch(t){i.e(t)}finally{i.f()}return o}var s={};for(var u in n)Object.prototype.hasOwnProperty.call(n,u)&&(s[u]=t(n[u]));return s}}(t)}function S(t){return"string"==typeof t?t:"#".concat((t.r||0).toString(16).padStart(2,"0")).concat((t.g||0).toString(16).padStart(2,"0")).concat((t.b||0).toString(16).padStart(2,"0")).concat(void 0===t.a?"":t.a.toString(16).padStart(2,"0"))}w.nothing=function(t){return t};var k=function(){return p((function t(){l(this,t),this.events={}}),[{key:"on",value:function(t,e){return this.events[t]||(this.events[t]=[]),this.events[t].push(e),this.emit("event:EventDispatcher.register",t,e),e}},{key:"onEvents",value:function(t){var e=this,n=t.map((function(t){var n=t.type,r=t.listener;return{type:n,listener:r,cancel:function(){e.off(n,r)}}}));return{tokens:n,cancel:function(){n.forEach((function(t){return t.cancel()}))}}}},{key:"off",value:function(t,e){this.events[t]&&(this.events[t]=this.events[t].filter((function(t){return t!==e})))}},{key:"emit",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];this.events[t]&&this.events[t].forEach((function(t){t.apply(void 0,n)}))}},{key:"once",value:function(t,e){var n=this,r=function(){e.apply(void 0,arguments),n.off(t,r)};return this.on(t,r)}},{key:"any",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return g(this,void 0,void 0,u().mark((function e(){var r,o,i,a,s,l=this;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.events[t]||(this.events[t]=[]),r=[],o=c(this.events[t]);try{for(o.s();!(i=o.n()).done;)a=i.value,(s=a.apply(void 0,n))&&"object"===m(s)&&"function"==typeof s.then&&r.push(s)}catch(t){o.e(t)}finally{o.f()}if(this.events[t]=this.events[t].filter((function(t){return!r.includes(t)})),0!==r.length){e.next=7;break}return e.abrupt("return",new Promise((function(e){var r=l.on("event:EventDispatcher.register",(function(o,i){if(o===t){l.off(o,r);var a=null==i?void 0:i.apply(void 0,n);a&&a.then?a.then(e):e(a)}}))})));case 7:return e.next=9,Promise.all(r);case 9:return e.abrupt("return",void 0);case 10:case"end":return e.stop()}}),e,this)})))}},{key:"clear",value:function(){this.events={}}}])}();function x(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(new Error).stack;return n?n.split("\n").slice(t+1,-e).join("\n").trim():""}function A(t){return new Promise((function(e){return setTimeout(e,t)}))}function O(t,e){if(t===e)return!0;if("object"!==m(t)||"object"!==m(e)||null===t||null===e)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(var o=0,i=n;o<i.length;o++){var a=i[o];if(!r.includes(a)||!O(t[a],e[a]))return!1}return!0}var E=function(){return p((function t(e,n){l(this,t),this.game=e,this.prefix=n}),[{key:"log",value:function(t){if(this.game.config.app.logger.log){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).log.apply(e,h(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,h(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,h(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,h(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,h(this._log.apply(this,[t].concat(r))))}}},{key:"trace",value:function(t){if(this.game.config.app.logger.trace){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];console.trace(this._log.apply(this,[t].concat(n)))}}},{key:"_log",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return 0===n.length?[this.prefix||"",t]:["".concat(this.prefix||""," [").concat(t,"]")].concat(n)}}])}(),T=function(){return p((function t(e){l(this,t),this.abortHandler=e,this.events=new k,this.aborted=!1}),[{key:"abort",value:function(){return this.aborted||(this.aborted=!0,this.result=this.abortHandler.apply(this,arguments)),this.result}},{key:"isAborted",value:function(){return this.aborted}},{key:"cancel",value:function(){this.aborted=!0}}])}();T.EventTypes={"event:skipController.abort":"event:skipController.abort"};var j=function(){return p((function t(){l(this,t),this.locked=!1,this.listeners=[],this.unlockListeners=[]}),[{key:"lock",value:function(){return this.locked=!0,this}},{key:"unlock",value:function(){this.locked=!1;var t,e=c(this.listeners);try{for(e.s();!(t=e.n()).done;){(0,t.value)()}}catch(t){e.e(t)}finally{e.f()}var n,r=c(this.unlockListeners);try{for(r.s();!(n=r.n()).done;){(0,n.value)()}}catch(t){r.e(t)}finally{r.f()}return this.listeners=[],this}},{key:"onUnlock",value:function(t){return this.unlockListeners.push(t),t}},{key:"offUnlock",value:function(t){this.unlockListeners=this.unlockListeners.filter((function(e){return e!==t}))}},{key:"nextUnlock",value:function(){return g(this,void 0,void 0,u().mark((function t(){var e=this;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.locked){t.next=2;break}return t.abrupt("return");case 2:return t.abrupt("return",new Promise((function(t){e.listeners.push(t)})));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"isLocked",value:function(){return this.locked}}])}(),P=function(){return p((function t(){l(this,t),this.locks=[]}),[{key:"unlock",value:function(t){return t.unlock(),this.off(t),t}},{key:"register",value:function(t){var e=t||new j;return this.locks.push(e),e}},{key:"off",value:function(t){this.locks=this.locks.filter((function(e){return e!==t}))}},{key:"nextUnlock",value:function(){return g(this,void 0,void 0,u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.locks.map((function(t){return t.nextUnlock()})),t.abrupt("return",Promise.all(e));case 2:case"end":return t.stop()}}),t,this)})))}},{key:"isLocked",value:function(){return this.locks.some((function(t){return t.isLocked()}))}}])}();function C(t,e){return t?e:arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}}function 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,N(r.key),r)}}function N(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 R=function(){return function(t,e,n){return e&&L(t.prototype,e),n&&L(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e,n,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.callee=e,this.type=n,this.contentNode=r,this.__stack=x(),this._id=""}),[{key:"executeAction",value:function(t){return{type:this.type,node:this.contentNode.getChild()}}},{key:"getId",value:function(){return this._id}},{key:"setId",value:function(t){this._id=t}},{key:"getFutureActions",value:function(){var t=this.contentNode.getChild();return t&&t.action?[t.action]:[]}}])}();function M(t){return M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},M(t)}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,D(r.key),r)}}function D(t){var e=function(t,e){if("object"!=M(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=M(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==M(e)?e:e+""}function B(t,e,n){return e=G(e),function(t,e){if(e&&("object"==M(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,V()?Reflect.construct(e,n||[],G(t).constructor):e.apply(t,n))}function V(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(V=function(){return!!t})()}function G(t){return G=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},G(t)}function U(t,e){return U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},U(t,e)}R.ActionTypes={action:"action"};var z=function(t){function e(t,n,r){var o;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(o=B(this,e,[t,n,r])).callee=t.getSelf(),o.contentNode.action=o,o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&U(t,e)}(e,t),function(t,e,n){return e&&F(t.prototype,e),n&&F(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"unknownType",value:function(){throw new Error("Unknown action type: "+this.type)}}])}(R);function H(t){return H="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},H(t)}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 $(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)?$(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 $(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 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,q(r.key),r)}}function q(t){var e=function(t,e){if("object"!=H(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=H(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==H(e)?e:e+""}function X(t,e,n){return e=J(e),function(t,e){if(e&&("object"==H(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,K()?Reflect.construct(e,n||[],J(t).constructor):e.apply(t,n))}function K(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(K=function(){return!!t})()}function Z(t,e,n,r){var o=Q(J(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function Q(){return Q="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=J(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}},Q.apply(null,arguments)}function J(t){return J=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},J(t)}function tt(t,e){return tt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},tt(t,e)}var et=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),X(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&&tt(t,e)}(e,t),function(t,e,n){return e&&Y(t.prototype,e),n&&Y(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===r.play){if(e.initSound(t,this.callee),!this.callee.getPlaying())throw new Error("Howl is not initialized");if(this.callee.config.sync&&!this.callee.config.loop){var o=new w((function(t){return t}));return t.playSound(this.callee,(function(){var e;t.stopSound(n.callee),o.resolve({type:n.type,node:null===(e=n.contentNode)||void 0===e?void 0:e.getChild()})})),o}return t.playSound(this.callee,(function(){t.stopSound(n.callee)})),Z(e,"executeAction",this,3)([t])}if(this.type===r.stop)return t.stopSound(this.callee),Z(e,"executeAction",this,3)([t]);if(this.type===r.fade){var i=W(this.contentNode.getContent(),1)[0],a=i.start,s=i.end,u=i.duration;if(this.callee.getPlaying()){var c=void 0===a?this.callee.getPlaying().volume():a;this.callee.getPlaying().fade(c,s,u,this.callee.getToken())}return Z(e,"executeAction",this,3)([t])}if(this.type===r.setVolume){var l=W(this.contentNode.getContent(),1)[0];return this.callee.getPlaying()&&this.callee.getPlaying().volume(l,this.callee.getToken()),Z(e,"executeAction",this,3)([t])}if(this.type===r.setRate){var f=W(this.contentNode.getContent(),1)[0];return this.callee.getPlaying()&&this.callee.getPlaying().rate(f,this.callee.getToken()),Z(e,"executeAction",this,3)([t])}if(this.type===r.pause)return this.callee.getPlaying()&&this.callee.getPlaying().pause(this.callee.getToken()),Z(e,"executeAction",this,3)([t]);if(this.type===r.resume)return this.callee.getPlaying()&&this.callee.getPlaying().play(this.callee.getToken()),Z(e,"executeAction",this,3)([t]);throw Z(e,"unknownType",this,3)([])}}],[{key:"initSound",value:function(t,e){e.getPlaying()||e.setPlaying(new(t.getHowl())(e.getHowlOptions()))}}])}(z);function nt(t){return nt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nt(t)}function rt(t,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 ot(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)?ot(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 ot(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 it(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 at(t){var e=function(t,e){if("object"!=nt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=nt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==nt(e)?e:e+""}function st(t,e,n){return e=ft(e),function(t,e){if(e&&("object"==nt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ut()?Reflect.construct(e,n||[],ft(t).constructor):e.apply(t,n))}function ut(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ut=function(){return!!t})()}function ct(t,e,n,r){var o=lt(ft(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function lt(){return lt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=ft(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}},lt.apply(null,arguments)}function ft(t){return ft=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ft(t)}function pt(t,e){return pt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},pt(t,e)}et.ActionTypes=r;var dt,ht=function(t){function n(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),st(this,n,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&pt(t,e)}(n,t),function(t,e,n){return e&&it(t.prototype,e),n&&it(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"executeAction",value:function(t){var r,o=this;if(this.type===e.action)return ct(n,"executeAction",this,3)([t]);if(this.type===e.setBackground)return this.callee.state.background=this.contentNode.getContent()[0],ct(n,"executeAction",this,3)([t]);if(this.type===e.sleep){var i=new w((function(t){return t})),a=this.contentNode.getContent();return new Promise((function(t){"number"==typeof a?setTimeout((function(){t()}),a):w.isAwaitable(a)?a.then(t):null==a||a.then(t)})).then((function(){i.resolve({type:o.type,node:o.contentNode.getChild()}),t.stage.next()})),i}if(this.type===e.applyTransition){var s=(new w).registerSkipController(new T((function(){return t.logger.info("NarraLeaf-React: Background Transition","Skipped"),{type:o.type,node:o.contentNode.getChild()}}))),u=this.contentNode.getContent()[0];return this.callee.events.any("event:displayable.applyTransition",u).then((function(){s.resolve({type:o.type,node:o.contentNode.getChild()}),t.stage.next()})),s}if(this.type===e.init){var c=new w((function(t){return t}));return n.handleSceneInit(this,t,c)}if(this.type===e.exit){t.offSrcManager(this.callee.srcManager).removeScene(this.callee);var l=new w((function(t){return t}));return this.callee.events.once("event:scene.unmount",(function(){l.resolve({type:o.type,node:o.contentNode.getChild()}),t.stage.next()})),l}if(this.type===e.jumpTo){var f=this.contentNode.getContent()[0],p=this.contentNode,d=(null===(r=f.sceneRoot)||void 0===r?void 0:r.contentNode)||null;return d&&p.addChild(d),ct(n,"executeAction",this,3)([t])}if(this.type===e.setBackgroundMusic){var h=rt(this.contentNode.getContent(),2),y=h[0],v=h[1];return this.callee.events.emit("event:scene.setBackgroundMusic",y,v||0),ct(n,"executeAction",this,3)([t])}if(this.type===e.preUnmount)return this.callee.events.emit("event:scene.preUnmount"),ct(n,"executeAction",this,3)([t]);if(this.type===e.applyTransform){var m=rt(this.contentNode.getContent(),1)[0],g=new w((function(t){return t})).registerSkipController(new T((function(){return{type:o.type,node:o.contentNode.getChild()}})));return this.callee.events.any("event:displayable.applyTransform",m).then((function(){g.resolve({type:o.type,node:o.contentNode.getChild()}),t.stage.next()})),g}throw new Error("Unknown scene action type: "+this.type)}},{key:"getFutureActions",value:function(){var t,n,r;if(this.type===e.jumpTo){var o=null===(n=null===(t=this.contentNode.getContent()[0])||void 0===t?void 0:t.sceneRoot)||void 0===n?void 0:n.contentNode;return(null==o?void 0:o.action)?[o.action]:[]}var i=null===(r=this.contentNode.getChild())||void 0===r?void 0:r.action;return i?[i]:[]}}],[{key:"handleSceneInit",value:function(t,e,r){return e.isSceneActive(t.callee)?{type:t.type,node:t.contentNode.getChild()}:(e.registerSrcManager(t.callee.srcManager).addScene(t.callee),n.registerEventListeners(t.callee,e,(function(){r.resolve({type:t.type,node:t.contentNode.getChild()}),e.stage.next()})),r)}},{key:"registerEventListeners",value:function(t,e,n){t.events.once("event:scene.unmount",(function(){e.offSrcManager(t.srcManager)})),t.events.once("event:scene.mount",(function(){t.state.backgroundMusic&&(et.initSound(e,t.state.backgroundMusic),t.events.emit("event:scene.setBackgroundMusic",t.state.backgroundMusic,t.config.backgroundMusicFade))})),t.events.any("event:displayable.init").then((function(){n&&n()}))}}])}(z);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,e,n){return e=gt(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,mt()?Reflect.construct(e,n||[],gt(t).constructor):e.apply(t,n))}function mt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(mt=function(){return!!t})()}function gt(t){return gt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},gt(t)}function bt(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&&wt(t,e)}function wt(t,e){return wt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},wt(t,e)}function _t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function St(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,xt(r.key),r)}}function kt(t,e,n){return e&&St(t.prototype,e),n&&St(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function xt(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+""}ht.ActionTypes=e,function(t){t.TreeNode="TreeNode",t.ContentNode="ContentNode"}(dt||(dt={}));var At=function(t){function e(t,n,r){var o;return _t(this,e),(o=vt(this,e,[dt.ContentNode])).child=r||null,o.parent=n||null,o.action=t||null,o}return bt(e,t),kt(e,[{key:"setParent",value:function(t){if(t===this)throw new Error("Cannot set parent to itself");return this.parent=t,this}},{key:"setChild",value:function(t){if(t===this)throw new Error("Cannot set child to itself");return this.child=t,t&&t.parent!==this&&t.remove().setParent(this),this}},{key:"getChild",value:function(){return this.child||null}},{key:"getParent",value:function(){return this.parent||null}},{key:"addChild",value:function(t){return this.setChild(t),this}},{key:"removeChild",value:function(t){return t&&this.child===t?(this.child=null,t.setParent(null)):t||(this.child=null),this}},{key:"remove",value:function(){var t;return null===(t=this.parent)||void 0===t||t.removeChild(this),this}},{key:"hasChild",value:function(){return!!this.child}}],[{key:"forEachParent",value:function(t,e){for(var n=new Set,r=t;r&&!n.has(r);)n.add(r),e(r),r=r.getParent()}},{key:"forEachChild",value:function(t,e){for(var n=new Set,r=t;r&&!n.has(r);)n.add(r),e(r),r=r.getChild()}}])}(function(){return kt((function t(e){_t(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 Ot(t){return Ot="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},Ot(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,Tt(r.key),r)}}function Tt(t){var e=function(t,e){if("object"!=Ot(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ot(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ot(e)?e:e+""}var jt=function(){return function(t,e,n){return e&&Et(t.prototype,e),n&&Et(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.id=""}),[{key:"setId",value:function(t){this.id=t}},{key:"getId",value:function(){return this.id}},{key:"reset",value:function(){}},{key:"fromData",value:function(t){return this}},{key:"construct",value:function(t){for(var e,n=0;n<t.length;n++){var r=t[n];0!==n&&(null===(e=t[n-1])||void 0===e||e.contentNode.setChild(r.contentNode))}return t}}])}();function Pt(t){return Pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pt(t)}function Ct(t){return function(t){if(Array.isArray(t))return Rt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Nt(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 It(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Nt(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 Lt(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)||Nt(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 Nt(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}}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}function Mt(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Mt=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new P(r||[]);return o(a,"_invoke",{value:O(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",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"==Pt(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,n,r){var o=p;return function(i,a){if(o===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 T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(Pt(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),j(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;j(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function 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"!=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 Bt(t,e,n){return e=zt(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,Vt()?Reflect.construct(e,n||[],zt(t).constructor):e.apply(t,n))}function Vt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Vt=function(){return!!t})()}function Gt(t,e,n,r){var o=Ut(zt(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function Ut(){return Ut="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=zt(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}},Ut.apply(null,arguments)}function zt(t){return zt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},zt(t)}function Ht(t,e){return Ht=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ht(t,e)}var Wt,$t=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())}))},Yt=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Bt(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&&Ht(t,e)}(e,t),function(t,e,n){return e&&Ft(t.prototype,e),n&&Ft(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAllActions",value:function(t,e){return $t(this,void 0,void 0,Mt().mark((function n(){var r,o,i;return Mt().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:r=!1,o=e,i=Mt().mark((function e(){var n,r,i;return Mt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.game.getLiveGame().executeAction(t,o),t.logger.debug("Control - Next Action",n),n){e.next=4;break}return e.abrupt("return",0);case 4:if(!w.isAwaitable(n)){e.next=16;break}return e.next=7,new Promise((function(t){n.then((function(e){return t(n.result)}))}));case 7:if(r=e.sent,!(i=r.node)){e.next=13;break}o=i.action,e.next=14;break;case 13:return e.abrupt("return",0);case 14:e.next=17;break;case 16:o=n;case 17:case"end":return e.stop()}}),e)}));case 3:if(r||!o){n.next=10;break}return n.delegateYield(i(),"t0",5);case 5:if(0!==n.t0){n.next=8;break}return n.abrupt("break",10);case 8:n.next=3;break;case 10:case"end":return n.stop()}}),n)})))}},{key:"executeSingleAction",value:function(t,e){return $t(this,void 0,void 0,Mt().mark((function n(){var r,o,i;return Mt().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=t.game.getLiveGame().executeAction(t,e),!w.isAwaitable(r)){n.next=9;break}return n.next=4,new Promise((function(t){r.then((function(e){return t(r.result)}))}));case 4:return o=n.sent,i=o.node,n.abrupt("return",i);case 9:return n.abrupt("return",r);case 10:case"end":return n.stop()}}),n)})))}},{key:"execute",value:function(t,n,r){var o=this;return r.length>0?(this.executeAllActions(t,r[0]).then((function(){n.resolve({type:o.type,node:o.contentNode.getChild()}),t.stage.next()})),n):Gt(e,"executeAction",this,3)([t])}},{key:"executeAction",value:function(t){var n=this,r=Lt(this.contentNode.getContent(),1)[0];if(this.type===a.do){var o=new w((function(t){return t}));return this.execute(t,o,r)}if(this.type===a.doAsync)return $t(n,void 0,void 0,Mt().mark((function e(){return Mt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r.length>0)){e.next=3;break}return e.next=3,this.executeAllActions(t,r[0]);case 3:case"end":return e.stop()}}),e,this)}))),Gt(e,"executeAction",this,3)([t]);if(this.type===a.any){var i=new w((function(t){return t})),s=r.map((function(e){return n.executeSingleAction(t,e)}));return Promise.any(s).then((function(){i.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),i}if(this.type===a.all){var u=new w((function(t){return t}));return $t(n,void 0,void 0,Mt().mark((function e(){var n=this;return Mt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(r.map((function(e){return n.executeSingleAction(t,e)})));case 2:u.resolve({type:this.type,node:this.contentNode.getChild()}),t.stage.next();case 4:case"end":return e.stop()}}),e,this)}))),u}if(this.type===a.allAsync)return $t(n,void 0,void 0,Mt().mark((function e(){var n,o,i;return Mt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=It(r);try{for(n.s();!(o=n.n()).done;)i=o.value,this.executeSingleAction(t,i).then((function(t){}))}catch(t){n.e(t)}finally{n.f()}case 2:case"end":return e.stop()}}),e,this)}))),Gt(e,"executeAction",this,3)([t]);if(this.type===a.repeat){var c=Lt(this.contentNode.getContent(),2),l=c[0],f=c[1],p=new w((function(t){return t}));return $t(n,void 0,void 0,Mt().mark((function e(){var n;return Mt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=0;case 1:if(!(n<f)){e.next=8;break}if(!(l.length>0)){e.next=5;break}return e.next=5,this.executeAllActions(t,l[0]);case 5:n++,e.next=1;break;case 8:p.resolve({type:this.type,node:this.contentNode.getChild()}),t.stage.next();case 10:case"end":return e.stop()}}),e,this)}))),p}if(this.type===a.sleep){var d=new w((function(t){return t})),h=Lt(this.contentNode.getContent(),2)[1];return new Promise((function(t){"number"==typeof h?setTimeout((function(){t()}),h):w.isAwaitable(h)?h.then(t):null==h||h.then(t)})).then((function(){d.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),d}throw new Error("Unknown control action type: "+this.type)}},{key:"getFutureActions",value:function(){var t=this.contentNode.getContent()[0],n=Gt(e,"getFutureActions",this,3)([]);return[].concat(Ct(t),Ct(n))}}])}(z);function qt(t){return qt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qt(t)}function Xt(t){return function(t){if(Array.isArray(t))return Kt(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 Kt(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)?Kt(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 Kt(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 Zt(t,e,n){return e=Jt(e),function(t,e){if(e&&("object"==qt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Qt()?Reflect.construct(e,n||[],Jt(t).constructor):e.apply(t,n))}function Qt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Qt=function(){return!!t})()}function Jt(t){return Jt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Jt(t)}function te(t,e){return te=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},te(t,e)}function ee(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ne(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,oe(r.key),r)}}function re(t,e,n){return e&&ne(t.prototype,e),n&&ne(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function oe(t){var e=function(t,e){if("object"!=qt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=qt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==qt(e)?e:e+""}Yt.ActionTypes=a;var ie=Symbol("_Chained"),ae=function(){function t(e){ee(this,t),this[Wt]=!0,this.__actions=[],this.__self=e}return re(t,[{key:"push",value:function(){var t;(t=this.__actions).push.apply(t,arguments)}},{key:"getActions",value:function(){return this.__actions}},{key:"getSelf",value:function(){return this.__self}},{key:"newChain",value:function(){return this.getSelf().chain()}}],[{key:"isChained",value:function(t){return t&&t[ie]}},{key:"toActions",value:function(e){return e.flat(2).map((function(e){return t.isChained(e)?e.fromChained(e):e})).flat(3)}}])}();Wt=ie;var se=function(t){function e(){return ee(this,e),Zt(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&&te(t,e)}(e,t),re(e,[{key:"chain",value:function(t){var e=ae.isChained(this)?this:this.proxy(this,new ae(this));if(!t)return e;var n=Array.isArray(t)?t:[t];return e.push.apply(e,Xt(n)),e}},{key:"proxy",value:function(t,e){var n=new Proxy(t,{get:function(t,r){if(r in e)return e[r];var o=t[r];return"function"==typeof o?o.bind(n):o},set:function(t,e,n){return t[e]=n,!0}});return n}},{key:"combineActions",value:function(t,e){var n=e(this.chain().newChain()),r=new Yt(t.chain(),Yt.ActionTypes.do,(new At).setContent([this.construct(ae.toActions([n]))]));return this.chain(r)}}])}(jt);function ue(t){return ue="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},ue(t)}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,le(r.key),r)}}function le(t){var e=function(t,e){if("object"!=ue(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ue(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ue(e)?e:e+""}function fe(t,e,n){return e=de(e),function(t,e){if(e&&("object"==ue(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,pe()?Reflect.construct(e,n||[],de(t).constructor):e.apply(t,n))}function pe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(pe=function(){return!!t})()}function de(t){return de=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},de(t)}function he(t,e){return he=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},he(t,e)}var ye,ve=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),fe(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&&he(t,e)}(e,t),function(t,e,n){return e&&ce(t.prototype,e),n&&ce(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"toData",value:function(){return null}},{key:"fromChained",value:function(t){return t.getActions()}}])}(se),me="center",ge="left",be="right";function we(t){return we="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},we(t)}function _e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Se(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,Ae(r.key),r)}}function ke(t,e,n){return e&&Se(t.prototype,e),n&&Se(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function xe(t,e,n){return(e=Ae(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ae(t){var e=function(t,e){if("object"!=we(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=we(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==we(e)?e:e+""}!function(t){t.Left="left",t.Center="center",t.Right="right"}(ye||(ye={}));var Oe=xe(xe(xe({},ye.Left,"33.33%"),ye.Center,"50%"),ye.Right,"66.66%"),Ee=function(){function t(){_e(this,t)}return ke(t,null,[{key:"isUnknown",value:function(e){return e===t.Unknown}},{key:"wrap",value:function(t){return Object.assign({left:"auto",top:"auto",right:"auto",bottom:"auto"},t)}},{key:"D2PositionToCSS",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.calc(t.y,t.yoffset),o=this.calc(t.x,t.xoffset),i=n?{bottom:r}:{top:r},a=e?{right:o}:{left:o};return this.wrap(Object.assign(Object.assign({},i),a))}},{key:"calc",value:function(e,n){if(!e||t.isUnknown(e))return"auto";if(void 0===n||t.isUnknown(n))return"calc(".concat(e," + 0px)");var r="number"==typeof e?"".concat(e,"px"):e;return"calc(".concat(r," + (").concat(n,"px))")}},{key:"toCoord2D",value:function(t){if(Te.isCommonPositionType(t))return je.fromCommonPosition(t);if(je.isCoord2DPosition(t))return t;if(Pe.isAlignPosition(t))return je.fromAlignPosition(t);if("object"===we(t)&&["x","y","xoffset","yoffset"].some((function(e){return e in t})))return new je(t);throw new Error("Invalid position type")}},{key:"orUnknown",value:function(e){return t.isUnknown(e)||void 0===e?t.Unknown:e}},{key:"mergePosition",value:function(t,e){var n=this.toCoord2D(t),r=this.toCoord2D(e);return je.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(ye).includes(t)}},{key:"isRawCoord2DPosition",value:function(t){return"object"===we(t)&&("x"in t||"y"in t||"xoffset"in t||"yoffset"in t)}},{key:"isRawAlignPosition",value:function(t){return"object"===we(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 Te||t instanceof je||t instanceof Pe}},{key:"rawPositionToCoord2D",value:function(t){if(this.isRawCommonPositionType(t))return je.fromCommonPosition(new Te(t));if(this.isRawCoord2DPosition(t))return new je(t);if(this.isRawAlignPosition(t))return je.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")}}])}();Ee.Unknown=Symbol("Unknown");var Te=function(){function t(e){_e(this,t),this.position=e}return ke(t,[{key:"toCSS",value:function(){return{x:Oe[this.position],y:"50%",xoffset:0,yoffset:0}}}],[{key:"isCommonPositionType",value:function(e){return e instanceof t}}])}();Te.Positions=ye;var je=function(){function t(e,n){_e(this,t),"object"===we(e)?(this.x=Ee.orUnknown(e.x),this.y=Ee.orUnknown(e.y),this.xoffset=Ee.orUnknown(e.xoffset),this.yoffset=Ee.orUnknown(e.yoffset)):(this.x=Ee.orUnknown(e),this.y=Ee.orUnknown(n),this.xoffset=Ee.Unknown,this.yoffset=Ee.Unknown)}return ke(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:Oe[e.position],y:"50%"})}},{key:"fromAlignPosition",value:function(e){return new t({x:Ee.isUnknown(e.xalign)?Ee.Unknown:"".concat(100*e.xalign,"%"),y:Ee.isUnknown(e.yalign)?Ee.Unknown:"".concat(100*e.yalign,"%"),xoffset:e.xoffset,yoffset:e.yoffset})}},{key:"merge",value:function(e,n){return new t({x:Ee.isUnknown(n.x)?e.x:n.x,y:Ee.isUnknown(n.y)?e.y:n.y,xoffset:Ee.isUnknown(n.xoffset)?e.xoffset:n.xoffset,yoffset:Ee.isUnknown(n.yoffset)?e.yoffset:n.yoffset})}}])}(),Pe=function(){function t(e,n){_e(this,t),"object"===we(e)?(this.xalign=Ee.orUnknown(e.xalign),this.yalign=Ee.orUnknown(e.yalign),this.xoffset=Ee.orUnknown(e.xoffset),this.yoffset=Ee.orUnknown(e.yoffset)):(this.xalign=Ee.orUnknown(e),this.yalign=Ee.orUnknown(n),this.xoffset=Ee.Unknown,this.yoffset=Ee.Unknown)}return ke(t,[{key:"toCSS",value:function(){return{x:Ee.isUnknown(this.xalign)?this.xalign:"".concat(100*this.xalign,"%"),y:Ee.isUnknown(this.yalign)?this.yalign:"".concat(100*this.yalign,"%"),xoffset:this.xoffset,yoffset:this.yoffset}}}],[{key:"isAlignPosition",value:function(e){return e instanceof t}}])}();function Ce(t){let e;return()=>(void 0===e&&(e=t()),e)}const Ie=Ce((()=>void 0!==window.ScrollTimeline));class Le{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}then(t,e){return Promise.all(this.animations).then(t).catch(e)}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t,e){const n=this.animations.map((n=>Ie()&&n.attachTimeline?n.attachTimeline(t):e(n)));return()=>{n.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;e<this.animations.length;e++)t=Math.max(t,this.animations[e].duration);return t}runAll(t){this.animations.forEach((e=>e[t]()))}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const Ne=t=>1e3*t,Re=t=>t/1e3;function Me(t,e){return e?t*(1e3/e):0}const Fe=5;function De(t,e,n){const r=Math.max(e-Fe,0);return Me(n-t(r),e-r)}const Be=t=>t;let Ve=Be,Ge=Be;const Ue=(t,e,n)=>n>e?e:n<t?t:n,ze=.001,He=.01,We=10,$e=.05,Ye=1;function qe({duration:t=800,bounce:e=.25,velocity:n=0,mass:r=1}){let o,i;Ve(t<=Ne(We),"Spring duration must be 10 seconds or less");let a=1-e;a=Ue($e,Ye,a),t=Ue(He,We,Re(t)),a<1?(o=e=>{const r=e*a,o=r*t,i=r-n,s=Ke(e,a),u=Math.exp(-o);return ze-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=Ke(Math.pow(e,2),a);return(-o(e)+ze>0?-1:1)*((i-s)*u)/c}):(o=e=>Math.exp(-e*t)*((e-n)*t+1)-ze,i=e=>Math.exp(-e*t)*(t*t*(n-e)));const s=function(t,e,n){let r=n;for(let n=1;n<Xe;n++)r-=t(r)/e(r);return r}(o,i,5/t);if(t=Ne(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 Xe=12;function Ke(t,e){return t*Math.sqrt(1-e*e)}const Ze=["duration","bounce"],Qe=["stiffness","damping","mass"];function Je(t,e){return e.some((e=>void 0!==t[e]))}function tn({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(!Je(t,Qe)&&Je(t,Ze)){const n=qe(t);e={...e,...n,mass:1},e.isResolvedFromDuration=!0}return e}({...r,velocity:-Re(r.velocity||0)}),d=f||0,h=u/(2*Math.sqrt(s*c)),y=i-o,v=Re(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=Ke(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?Ne(d):De(g,t,r));const s=Math.abs(o)<=n,u=Math.abs(i-r)<=e;a.done=s&&u}return a.value=a.done?i:r,a}}}const en=2e4;function nn(t){let e=0;let n=t.next(e);for(;!n.done&&e<en;)e+=50,n=t.next(e);return e>=en?1/0:e}function rn(t,e=100,n){const r=n({...t,keyframes:[0,e]}),o=Math.min(nn(r),en);return{type:"keyframes",ease:t=>r.next(o*t).value/e,duration:Re(o)}}const on=(t,e,n)=>t+(e-t)*n,an=(t,e,n)=>{const r=e-t;return 0===r?1:(n-t)/r};function sn(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const o=an(0,e,r);t.push(on(n,1,o))}}function un(t){const e=[0];return sn(e,t.length-1),e}const cn=t=>Boolean(t&&t.getVelocity);function ln(t){return"object"==typeof t&&!Array.isArray(t)}function fn(t,e,n,r){return"string"==typeof t&&ln(e)?function(t,e,n){var r;if("string"==typeof t){let o=document;e&&(Ge(Boolean(e.current),"Scope provided, but no element detected."),o=e.current),n?(null!==(r=n[t])&&void 0!==r||(n[t]=o.querySelectorAll(t)),t=n[t]):t=o.querySelectorAll(t)}else t instanceof Element&&(t=[t]);return Array.from(t||[])}(t,n,r):t instanceof NodeList?Array.from(t):Array.isArray(t)?t:[t]}function pn(t){return"function"==typeof t}function dn(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 hn=(t,e,n)=>{const r=e-t;return((n-t)%r+r)%r+t},yn=t=>Array.isArray(t)&&"number"!=typeof t[0];function vn(t,e){return yn(t)?t[hn(0,t.length,e)]:t}function mn(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}function gn(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&&(mn(t,o),r--)}}(t,o,i);for(let a=0;a<e.length;a++)t.push({value:e[a],at:on(o,i,r[a]),easing:vn(n,a)})}function bn(t,e){return t.at===e.at?null===t.value?1:null===e.value?-1:0:t.at-e.at}const wn="easeInOut";function _n(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function Sn(t,e){return e[t]||(e[t]=[]),e[t]}function kn(t){return Array.isArray(t)?t:[t]}function xn(t,e){return t&&t[e]?{...t,...t[e]}:{...t}}const An=t=>"number"==typeof t,On=t=>t.every(An),En=new WeakMap,Tn=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],jn=new Set(Tn),Pn={type:"spring",stiffness:500,damping:25,restSpeed:10},Cn={type:"keyframes",duration:.8},In={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Ln=(t,{keyframes:e})=>e.length>2?Cn:jn.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:Pn:In;function Nn(t,e){return t?t[e]||t.default||t:void 0}const Rn=!1,Mn=!1,Fn=!1,Dn=t=>null!==t;function Bn(t,{repeat:e,repeatType:n="loop"},r){const o=t.filter(Dn),i=e&&"loop"!==n&&e%2==1?0:o.length-1;return i&&void 0!==r?r:o[i]}const Vn=["read","resolveKeyframes","update","preRender","render","postRender"];function Gn(t,e){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=Vn.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=Mn?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:Vn.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<Vn.length;e++)a[Vn[e]].cancel(t)},state:o,steps:a}}const{schedule:Un,cancel:zn,state:Hn,steps:Wn}=Gn("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:Be,!0),$n=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Yn=1e-7,qn=12;function Xn(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=$n(a,r,o)-t,i>0?n=a:e=a}while(Math.abs(i)>Yn&&++s<qn);return a}(e,0,1,t,n);return t=>0===t||1===t?t:$n(o(t),e,r)}const Kn=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Zn=t=>e=>1-t(1-e),Qn=Xn(.33,1.53,.69,.99),Jn=Zn(Qn),tr=Kn(Jn),er=t=>(t*=2)<1?.5*Jn(t):.5*(2-Math.pow(2,-10*(t-1))),nr=t=>1-Math.sin(Math.acos(t)),rr=Zn(nr),or=Kn(nr),ir=t=>/^0[^.\s]+$/u.test(t);const ar=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),sr=t=>e=>"string"==typeof e&&e.startsWith(t),ur=sr("--"),cr=sr("var(--"),lr=t=>!!cr(t)&&fr.test(t.split("/*")[0].trim()),fr=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,pr=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function dr(t,e,n=1){Ge(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=pr.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 ar(t)?parseFloat(t):t}return lr(o)?dr(o,e,n+1):o}const hr={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},yr={...hr,transform:t=>Ue(0,1,t)},vr={...hr,default:1},mr=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),gr=mr("deg"),br=mr("%"),wr=mr("px"),_r=mr("vh"),Sr=mr("vw"),kr={...br,parse:t=>br.parse(t)/100,transform:t=>br.transform(100*t)},xr=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),Ar=t=>t===hr||t===wr,Or=(t,e)=>parseFloat(t.split(", ")[e]),Er=(t,e)=>(n,{transform:r})=>{if("none"===r||!r)return 0;const o=r.match(/^matrix3d\((.+)\)$/u);if(o)return Or(o[1],e);{const e=r.match(/^matrix\((.+)\)$/u);return e?Or(e[1],t):0}},Tr=new Set(["x","y","z"]),jr=Tn.filter((t=>!Tr.has(t)));const Pr={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:Er(4,13),y:Er(5,14)};Pr.translateX=Pr.x,Pr.translateY=Pr.y;const Cr=t=>e=>e.test(t),Ir=[hr,wr,br,gr,Sr,_r,{test:t=>"auto"===t,parse:t=>t}],Lr=t=>Ir.find(Cr(t)),Nr=new Set;let Rr=!1,Mr=!1;function Fr(){if(Mr){const t=Array.from(Nr).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 jr.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)}))}Mr=!1,Rr=!1,Nr.forEach((t=>t.complete())),Nr.clear()}function Dr(){Nr.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(Mr=!0)}))}class Br{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?(Nr.add(this),Rr||(Rr=!0,Un.read(Dr),Un.resolveKeyframes(Fr))):(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),Nr.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Nr.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const Vr=t=>Math.round(1e5*t)/1e5,Gr=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const Ur=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,zr=(t,e)=>n=>Boolean("string"==typeof n&&Ur.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),Hr=(t,e,n)=>r=>{if("string"!=typeof r)return r;const[o,i,a,s]=r.match(Gr);return{[t]:parseFloat(o),[e]:parseFloat(i),[n]:parseFloat(a),alpha:void 0!==s?parseFloat(s):1}},Wr={...hr,transform:t=>Math.round((t=>Ue(0,255,t))(t))},$r={test:zr("rgb","red"),parse:Hr("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+Wr.transform(t)+", "+Wr.transform(e)+", "+Wr.transform(n)+", "+Vr(yr.transform(r))+")"};const Yr={test:zr("#"),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:$r.transform},qr={test:zr("hsl","hue"),parse:Hr("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+br.transform(Vr(e))+", "+br.transform(Vr(n))+", "+Vr(yr.transform(r))+")"},Xr={test:t=>$r.test(t)||Yr.test(t)||qr.test(t),parse:t=>$r.test(t)?$r.parse(t):qr.test(t)?qr.parse(t):Yr.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?$r.transform(t):qr.transform(t)},Kr=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const Zr="number",Qr="color",Jr="var",to="var(",eo="${}",no=/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 ro(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},o=[];let i=0;const a=e.replace(no,(t=>(Xr.test(t)?(r.color.push(i),o.push(Qr),n.push(Xr.parse(t))):t.startsWith(to)?(r.var.push(i),o.push(Jr),n.push(t)):(r.number.push(i),o.push(Zr),n.push(parseFloat(t))),++i,eo))).split(eo);return{values:n,split:a,indexes:r,types:o}}function oo(t){return ro(t).values}function io(t){const{split:e,types:n}=ro(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===Zr?Vr(t[i]):e===Qr?Xr.transform(t[i]):t[i]}return o}}const ao=t=>"number"==typeof t?0:t;const so={test:function(t){var e,n;return isNaN(t)&&"string"==typeof t&&((null===(e=t.match(Gr))||void 0===e?void 0:e.length)||0)+((null===(n=t.match(Kr))||void 0===n?void 0:n.length)||0)>0},parse:oo,createTransformer:io,getAnimatableNone:function(t){const e=oo(t);return io(t)(e.map(ao))}},uo=new Set(["brightness","contrast","saturate","opacity"]);function co(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[r]=n.match(Gr)||[];if(!r)return t;const o=n.replace(r,"");let i=uo.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+o+")"}const lo=/\b([a-z-]*)\(.*?\)/gu,fo={...so,getAnimatableNone:t=>{const e=t.match(lo);return e?e.map(co).join(" "):t}},po={borderWidth:wr,borderTopWidth:wr,borderRightWidth:wr,borderBottomWidth:wr,borderLeftWidth:wr,borderRadius:wr,radius:wr,borderTopLeftRadius:wr,borderTopRightRadius:wr,borderBottomRightRadius:wr,borderBottomLeftRadius:wr,width:wr,maxWidth:wr,height:wr,maxHeight:wr,top:wr,right:wr,bottom:wr,left:wr,padding:wr,paddingTop:wr,paddingRight:wr,paddingBottom:wr,paddingLeft:wr,margin:wr,marginTop:wr,marginRight:wr,marginBottom:wr,marginLeft:wr,backgroundPositionX:wr,backgroundPositionY:wr},ho={rotate:gr,rotateX:gr,rotateY:gr,rotateZ:gr,scale:vr,scaleX:vr,scaleY:vr,scaleZ:vr,skew:gr,skewX:gr,skewY:gr,distance:wr,translateX:wr,translateY:wr,translateZ:wr,x:wr,y:wr,z:wr,perspective:wr,transformPerspective:wr,opacity:yr,originX:kr,originY:kr,originZ:wr},yo={...hr,transform:Math.round},vo={...po,...ho,zIndex:yo,size:wr,fillOpacity:yr,strokeOpacity:yr,numOctaves:yo},mo={...vo,color:Xr,backgroundColor:Xr,outlineColor:Xr,fill:Xr,stroke:Xr,borderColor:Xr,borderTopColor:Xr,borderRightColor:Xr,borderBottomColor:Xr,borderLeftColor:Xr,filter:fo,WebkitFilter:fo},go=t=>mo[t];function bo(t,e){let n=go(t);return n!==fo&&(n=so),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const wo=new Set(["auto","none","0"]);class _o extends Br{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(),lr(r))){const o=dr(r,e.current);void 0!==o&&(t[n]=o),n===t.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!xr.has(n)||2!==t.length)return;const[r,o]=t,i=Lr(r),a=Lr(o);if(i!==a)if(Ar(i)&&Ar(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||ir(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&&!wo.has(e)&&ro(e).values.length&&(r=t[o]),o++}if(r&&n)for(const o of e)t[o]=bo(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=Pr[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]=Pr[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 So;function ko(){So=void 0}const xo={now:()=>(void 0===So&&xo.set(Hn.isProcessing||Mn?Hn.timestamp:performance.now()),So),set:t=>{So=t,queueMicrotask(ko)}},Ao=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!so.test(t)&&"0"!==t||t.startsWith("url(")));function Oo(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=Ao(o,e),s=Ao(i,e);return Ve(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||pn(n))&&r)}class Eo{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=xo.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||(Dr(),Fr()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=xo.now(),this.hasAttemptedResolve=!0;const{name:n,type:r,velocity:o,delay:i,onComplete:a,onUpdate:s,isGenerator:u}=this.options;if(!u&&!Oo(t,n,r,o)){if(Fn||!i)return null==s||s(Bn(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 To({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,_=tn({keyframes:[p.value,d(p.value)],velocity:De(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 jo=Xn(.42,0,1,1),Po=Xn(0,0,.58,1),Co=Xn(.42,0,.58,1),Io=t=>Array.isArray(t)&&"number"==typeof t[0],Lo={linear:Be,easeIn:jo,easeInOut:Co,easeOut:Po,circIn:nr,circInOut:or,circOut:rr,backIn:Jn,backInOut:tr,backOut:Qn,anticipate:er},No=t=>{if(Io(t)){Ge(4===t.length,"Cubic bezier arrays must contain four numerical values.");const[e,n,r,o]=t;return Xn(e,n,r,o)}return"string"==typeof t?(Ge(void 0!==Lo[t],`Invalid easing type '${t}'`),Lo[t]):t},Ro=(t,e)=>n=>e(t(n)),Mo=(...t)=>t.reduce(Ro);function Fo(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 Do(t,e){return n=>n>0?e:t}const Bo=(t,e,n)=>{const r=t*t,o=n*(e*e-r)+r;return o<0?0:Math.sqrt(o)},Vo=[Yr,$r,qr];function Go(t){const e=(n=t,Vo.find((t=>t.test(n))));var n;if(Ve(Boolean(e),`'${t}' is not an animatable color. Use the equivalent color code instead.`),!Boolean(e))return!1;let r=e.parse(t);return e===qr&&(r=function({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,n/=100;let o=0,i=0,a=0;if(e/=100){const r=n<.5?n*(1+e):n+e-n*e,s=2*n-r;o=Fo(s,r,t+1/3),i=Fo(s,r,t),a=Fo(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 Uo=(t,e)=>{const n=Go(t),r=Go(e);if(!n||!r)return Do(t,e);const o={...n};return t=>(o.red=Bo(n.red,r.red,t),o.green=Bo(n.green,r.green,t),o.blue=Bo(n.blue,r.blue,t),o.alpha=on(n.alpha,r.alpha,t),$r.transform(o))},zo=new Set(["none","hidden"]);function Ho(t,e){return n=>on(t,e,n)}function Wo(t){return"number"==typeof t?Ho:"string"==typeof t?lr(t)?Do:Xr.test(t)?Uo:qo:Array.isArray(t)?$o:"object"==typeof t?Xr.test(t)?Uo:Yo:Do}function $o(t,e){const n=[...t],r=n.length,o=t.map(((t,n)=>Wo(t)(t,e[n])));return t=>{for(let e=0;e<r;e++)n[e]=o[e](t);return n}}function Yo(t,e){const n={...t,...e},r={};for(const o in n)void 0!==t[o]&&void 0!==e[o]&&(r[o]=Wo(t[o])(t[o],e[o]));return t=>{for(const e in r)n[e]=r[e](t);return n}}const qo=(t,e)=>{const n=so.createTransformer(e),r=ro(t),o=ro(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?zo.has(t)&&!o.values.length||zo.has(e)&&!r.values.length?function(t,e){return zo.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):Mo($o(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):(Ve(!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.`),Do(t,e))};function Xo(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return on(t,e,n);return Wo(t)(t,e)}function Ko(t,e,{clamp:n=!0,ease:r,mixer:o}={}){const i=t.length;if(Ge(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||Xo,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=an(t[n],t[n+1],e);return a[n](r)};return n?e=>u(Ue(t[0],t[i-1],e)):u}function Zo({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const o=yn(r)?r.map(No):No(r),i={done:!1,value:e[0]},a=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:un(e),t),s=Ko(a,e,{ease:Array.isArray(o)?o:(u=e,c=o,u.map((()=>c||Co)).splice(0,u.length-1))});var u,c;return{calculatedDuration:t,next:e=>(i.value=s(e),i.done=e>=t,i)}}const Qo=t=>{const e=({timestamp:e})=>t(e);return{start:()=>Un.update(e,!0),stop:()=>zn(e),now:()=>Hn.isProcessing?Hn.timestamp:xo.now()}},Jo={decay:To,inertia:To,tween:Zo,keyframes:Zo,spring:tn},ti=t=>t/100;class ei extends Eo{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)||Br;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=pn(e)?e:Jo[e]||Zo;let s,u;a!==Zo&&"number"!=typeof t[0]&&(s=Mo(ti,Xo(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=nn(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=Ue(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=Bn(s,this.options,r)),y&&y(w.value),S&&this.finish(),w}get duration(){const{resolved:t}=this;return t?Re(t.calculatedDuration):0}get time(){return Re(this.currentTime)}set time(t){t=Ne(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=Re(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=Qo,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 ni=new Set(["opacity","clipPath","filter","transform"]),ri=(t,e)=>{let n="";const r=Math.max(Math.round(e/10),2);for(let e=0;e<r;e++)n+=t(an(0,r-1,e))+", ";return`linear(${n.substring(0,n.length-2)})`},oi={linearEasing:void 0};function ii(t,e){const n=Ce(t);return()=>{var t;return null!==(t=oi[e])&&void 0!==t?t:n()}}const ai=ii((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing");function si(t){return Boolean("function"==typeof t&&ai()||!t||"string"==typeof t&&(t in ci||ai())||Io(t)||Array.isArray(t)&&t.every(si))}const ui=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,ci={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ui([0,.65,.55,1]),circOut:ui([.55,0,1,.45]),backIn:ui([.31,.01,.66,-.59]),backOut:ui([.33,1.53,.69,.99])};function li(t,e){return t?"function"==typeof t&&ai()?ri(t,e):Io(t)?ui(t):Array.isArray(t)?t.map((t=>li(t,e)||ci.easeOut)):ci[t]:void 0}function fi(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=li(s,o);return Array.isArray(l)&&(c.easing=l),t.animate(c,{delay:r,duration:o,easing:Array.isArray(l)?"linear":l,fill:"both",iterations:i+1,direction:"reverse"===a?"alternate":"normal"})}function pi(t,e){t.timeline=e,t.onfinish=null}const di=Ce((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));const hi={anticipate:er,backInOut:tr,circInOut:or};class yi extends Eo{constructor(t){super(t);const{name:e,motionValue:n,element:r,keyframes:o}=this.options;this.resolver=new _o(o,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}initPlayback(t,e){var n;let{duration:r=300,times:o,ease:i,type:a,motionValue:s,name:u,startTime:c}=this.options;if(!(null===(n=s.owner)||void 0===n?void 0:n.current))return!1;if("string"==typeof i&&ai()&&i in hi&&(i=hi[i]),function(t){return pn(t.type)||"spring"===t.type||!si(t.ease)}(this.options)){const{onComplete:e,onUpdate:n,motionValue:s,element:u,...c}=this.options,l=function(t,e){const n=new ei({...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=fi(s.owner.current,u,t,{...this.options,duration:r,times:o,ease:i});return l.startTime=null!=c?c:this.calcStartTime(),this.pendingTimeline?(pi(l,this.pendingTimeline),this.pendingTimeline=void 0):l.onfinish=()=>{const{onComplete:n}=this.options;s.set(Bn(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 Re(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return Re(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.currentTime=Ne(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;pi(n,t)}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 ei({...c,keyframes:n,duration:r,type:o,ease:i,times:a,isGenerator:!0}),f=Ne(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 di()&&n&&ni.has(n)&&e&&e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate&&!r&&"mirror"!==o&&0!==i&&"inertia"!==a}}const vi=(t,e,n,r={},o,i)=>a=>{const s=Nn(r,t)||{},u=s.delay||r.delay||0;let{elapsed:c=0}=r;c-=Ne(u);let l={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...s,delay:-c,onUpdate:t=>{e.set(t),s.onUpdate&&s.onUpdate(t)},onComplete:()=>{a(),s.onComplete&&s.onComplete()},name:t,motionValue:e,element:i?void 0:o};(function({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:o,repeat:i,repeatType:a,repeatDelay:s,from:u,elapsed:c,...l}){return!!Object.keys(l).length})(s)||(l={...l,...Ln(t,l)}),l.duration&&(l.duration=Ne(l.duration)),l.repeatDelay&&(l.repeatDelay=Ne(l.repeatDelay)),void 0!==l.from&&(l.keyframes[0]=l.from);let f=!1;if((!1===l.type||0===l.duration&&!l.repeatDelay)&&(l.duration=0,0===l.delay&&(f=!0)),(Fn||Rn)&&(f=!0,l.duration=0,l.delay=0),f&&!i&&void 0!==e.get()){const t=Bn(l.keyframes,s);if(void 0!==t)return Un.update((()=>{l.onUpdate(t),l.onComplete()})),new Le([])}return!i&&yi.supports(l)?new yi(l):new ei(l)},mi=t=>Array.isArray(t),gi=t=>Boolean(t&&"object"==typeof t&&t.mix&&t.toValue),bi=t=>mi(t)?t[t.length-1]||0:t;class wi{constructor(){this.subscriptions=[]}add(t){var e,n;return e=this.subscriptions,n=t,-1===e.indexOf(n)&&e.push(n),()=>mn(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 _i={current:void 0};class Si{constructor(t,e={}){this.version="11.11.9",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=xo.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=xo.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 wi);const n=this.events[t].add(e);return"change"===t?()=>{n(),Un.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 _i.current&&_i.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=xo.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return Me(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 ki(t,e){return new Si(t,e)}function xi(t){const e=[{},{}];return null==t||t.values.forEach(((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()})),e}function Ai(t,e,n,r){if("function"==typeof e){const[o,i]=xi(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]=xi(r);e=e(void 0!==n?n:t.custom,o,i)}return e}function Oi(t,e,n){const r=t.getProps();return Ai(r,e,void 0!==n?n:r.custom,t)}function Ei(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,ki(n))}const Ti=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),ji="data-"+Ti("framerAppearId");function Pi(t){return t.props[ji]}function Ci(t,e){if(!t.applyWillChange)return;const n=t.getValue("willChange");return r=n,Boolean(cn(r)&&r.add)?n.add(e):void 0;var r}function Ii({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,r}function Li(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&&Ii(l,e))continue;const s={delay:n,...Nn(a||{},e)};let f=!1;if(window.MotionHandoffAnimation){const n=Pi(t);if(n){const t=window.MotionHandoffAnimation(n,e,Un);null!==t&&(s.startTime=t,f=!0)}}Ci(t,e),r.start(vi(e,r,o,t.shouldReduceMotion&&jn.has(e)?{type:!1}:s,t,f));const p=r.animation;p&&c.push(p)}return s&&Promise.all(c).then((()=>{Un.update((()=>{s&&function(t,e){const n=Oi(t,e);let{transitionEnd:r={},transition:o={},...i}=n||{};i={...i,...r};for(const e in i)Ei(t,e,bi(i[e]))}(t,s)}))})),c}const Ni={};function Ri(t,{layout:e,layoutId:n}){return jn.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!Ni[t]||"opacity"===t)}function Mi(t,e,n){var r;const{style:o}=t,i={};for(const a in o)(cn(o[a])||e.style&&cn(e.style[a])||Ri(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 Fi(t,e,n){const r=Mi(t,e,n);for(const n in t)if(cn(t[n])||cn(e[n])){r[-1!==Tn.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=t[n]}return r}const Di="undefined"!=typeof window,Bi={current:null},Vi={current:!1};function Gi(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function Ui(t){return"string"==typeof t||Array.isArray(t)}const zi=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Hi=["initial",...zi];function Wi(t){return Gi(t.animate)||Hi.some((e=>Ui(t[e])))}function $i(t){return Boolean(Wi(t)||t.variants)}const Yi={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},qi={};for(const t in Yi)qi[t]={isEnabled:e=>Yi[t].some((t=>!!e[t]))};const Xi=[...Ir,Xr,so],Ki=()=>({x:{min:0,max:0},y:{min:0,max:0}}),Zi=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Qi{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=Br,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=xo.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,Un.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=Wi(e),this.isVariantNode=$i(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]&&cn(e)&&e.set(s[t],!1)}}mount(t){this.current=t,En.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))),Vi.current||function(){if(Vi.current=!0,Di)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Bi.current=t.matches;t.addListener(e),e()}else Bi.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||Bi.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){En.delete(this.current),this.projection&&this.projection.unmount(),zn(this.notifyUpdate),zn(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=jn.has(t),r=e.on("change",(e=>{this.latestValues[t]=e,this.props.onUpdate&&Un.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)})),o=e.on("renderRequest",this.scheduleRender);let i;window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,(()=>{r(),o(),i&&i(),e.owner&&e.stop()}))}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in qi){const e=qi[t];if(!e)continue;const{isEnabled:n,Feature:r}=e;if(!this.features[t]&&r&&n(this.props)&&(this.features[t]=new r(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<Zi.length;e++){const n=Zi[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(cn(o))t.addValue(r,o);else if(cn(i))t.addValue(r,ki(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,ki(void 0!==e?e:o,{owner:t}))}}for(const r in n)void 0===e[r]&&t.removeValue(r);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){const n=this.values.get(t);e!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return void 0===n&&void 0!==e&&(n=ki(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&&(ar(r)||ir(r))?r=parseFloat(r):(o=r,!Xi.find(Cr(o))&&so.test(e)&&(r=bo(t,e))),this.setBaseTarget(t,cn(r)?r.get():r)),cn(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=Ai(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||cn(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 wi),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class Ji extends Qi{constructor(){super(...arguments),this.KeyframeResolver=_o}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 ta=(t,e)=>e&&"number"==typeof t?e.transform(t):t,ea={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},na=Tn.length;function ra(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(jn.has(t))a=!0;else if(ur(t))o[t]=n;else{const e=ta(n,vo[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<na;i++){const a=Tn[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=ta(s,vo[a]);u||(o=!1,r+=`${ea[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 oa(t,e,n){return"string"==typeof t?t:wr.transform(e+n*t)}const ia={offset:"stroke-dashoffset",array:"stroke-dasharray"},aa={offset:"strokeDashoffset",array:"strokeDasharray"};function sa(t,{attrX:e,attrY:n,attrScale:r,originX:o,originY:i,pathLength:a,pathSpacing:s=1,pathOffset:u=0,...c},l,f){if(ra(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`${oa(e,t.x,t.width)} ${oa(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?ia:aa;t[i.offset]=wr.transform(-r);const a=wr.transform(e),s=wr.transform(n);t[i.array]=`${a} ${s}`}(p,a,s,u,!1)}const ua=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 ca(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 la(t,e,n,r){ca(t,e,void 0,r);for(const n in e.attrs)t.setAttribute(ua.has(n)?n:Ti(n),e.attrs[n])}const fa=t=>"string"==typeof t&&"svg"===t.toLowerCase();class pa extends Ji{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ki}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(jn.has(e)){const t=go(e);return t&&t.default||0}return e=ua.has(e)?e:Ti(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return Fi(t,e,n)}build(t,e,n){sa(t,e,this.isSVGTag,n.transformTemplate)}renderInstance(t,e,n,r){la(t,e,0,r)}mount(t){this.isSVGTag=fa(t.tagName),super.mount(t)}}function da(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 ha extends Ji{constructor(){super(...arguments),this.type="html",this.applyWillChange=!0,this.renderInstance=ca}readValueFromInstance(t,e){if(jn.has(e)){const t=go(e);return t&&t.default||0}{const r=(n=t,window.getComputedStyle(n)),o=(ur(e)?r.getPropertyValue(e):r[e])||0;return"string"==typeof o?o.trim():o}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return da(t,e)}build(t,e,n){ra(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return Mi(t,e,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;cn(t)&&(this.childSubscription=t.on("change",(t=>{this.current&&(this.current.textContent=`${t}`)})))}}class ya extends Qi{constructor(){super(...arguments),this.type="object"}readValueFromInstance(t,e){if(function(t,e){return t in e}(e,t)){const n=t[e];if("string"==typeof n||"number"==typeof n)return n}}getBaseTargetFromProps(){}removeValueFromRenderState(t,e){delete e.output[t]}measureInstanceViewportBox(){return{x:{min:0,max:0},y:{min:0,max:0}}}build(t,e){Object.assign(t.output,e)}renderInstance(t,{output:e}){Object.assign(t,e)}sortInstanceNodePosition(){return 0}}function va(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 pa(e):new ha(e);n.mount(t),En.set(t,n)}function ma(t){const e=new ya({presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}});e.mount(t),En.set(t,e)}function ga(t,e,n,r){const o=[];if(function(t,e){return cn(t)||"number"==typeof t||"string"==typeof t&&!ln(e)}(t,e))o.push(function(t,e,n){const r=cn(t)?t:ki(t);return r.start(vi("",r,e,n)),r.animation}(t,ln(e)&&e.default||e,n&&n.default||n));else{const i=fn(t,e,r),a=i.length;Ge(Boolean(a),"No valid elements provided.");for(let t=0;t<a;t++){const r=i[t],s=r instanceof Element?va:ma;En.has(r)||s(r);const u=En.get(r),c={...n};"delay"in c&&"function"==typeof c.delay&&(c.delay=c.delay(t,a)),o.push(...Li(u,{...e,transition:c},{}))}}return o}function ba(t,e,n){const r=[],o=function(t,{defaultTransition:e={},...n}={},r,o){const i=e.duration||.3,a=new Map,s=new Map,u={},c=new Map;let l=0,f=0,p=0;for(let n=0;n<t.length;n++){const a=t[n];if("string"==typeof a){c.set(a,f);continue}if(!Array.isArray(a)){c.set(a.name,dn(f,a.at,l,c));continue}let[d,h,y={}]=a;void 0!==y.at&&(f=dn(f,y.at,l,c));let v=0;const m=(t,n,r,a=0,s=0)=>{const u=kn(t),{delay:c=0,times:l=un(u),type:d="keyframes",...h}=n;let{ease:y=e.ease||"easeOut",duration:m}=n;const g="function"==typeof c?c(a,s):c,b=u.length,w=pn(d)?d:null==o?void 0:o[d];if(b<=2&&w){let t=100;if(2===b&&On(u)){const e=u[1]-u[0];t=Math.abs(e)}const e={...h};void 0!==m&&(e.duration=Ne(m));const n=rn(e,t,w);y=n.ease,m=n.duration}null!=m||(m=i);const _=f+g,S=_+m;1===l.length&&0===l[0]&&(l[1]=1);const k=l.length-u.length;k>0&&sn(l,k),1===u.length&&u.unshift(null),gn(r,u,y,l,_,S),v=Math.max(g+m,v),p=Math.max(S,p)};if(cn(d))m(h,y,Sn("default",_n(d,s)));else{const t=fn(d,h,r,u),e=t.length;for(let n=0;n<e;n++){const r=_n(t[n],s);for(const t in h)m(h[t],xn(y,t),Sn(t,r),n,e)}}l=f,f+=v}return s.forEach(((t,r)=>{for(const o in t){const i=t[o];i.sort(bn);const s=[],u=[],c=[];for(let t=0;t<i.length;t++){const{at:e,value:n,easing:r}=i[t];s.push(n),u.push(an(0,p,e)),c.push(r||"easeOut")}0!==u[0]&&(u.unshift(0),s.unshift(s[0]),c.unshift(wn)),1!==u[u.length-1]&&(u.push(1),s.push(null)),a.has(r)||a.set(r,{keyframes:{},transition:{}});const l=a.get(r);l.keyframes[o]=s,l.transition[o]={...e,duration:p,ease:c,times:u,...n}}})),a}(t,e,n,{spring:tn});return o.forEach((({keyframes:t,transition:e},n)=>{r.push(...ga(n,t,e))})),r}const wa=function(t,e,n){let r=[];var o;o=t,r=Array.isArray(o)&&Array.isArray(o[0])?ba(t,e,_a):ga(t,e,n,_a);const i=new Le(r);return _a&&_a.animations.push(i),i};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 P(r||[]);return o(a,"_invoke",{value:O(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",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"==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 O(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 T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(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,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),j(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;j(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function xa(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Oa(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)||Oa(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 Oa(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 Ta(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,Pa(r.key),r)}}function ja(t,e,n){return(e=Pa(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Pa(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=ja(ja(ja({},ge,"25.33%"),me,"50%"),be,"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&&Ta(t.prototype,e),n&&Ta(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"animate",value:function(e,n,r){var o=e.scope,i=e.overwrites,a=e.target;return Ca(this,void 0,void 0,ka().mark((function e(){var s=this;return ka().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){Ca(s,void 0,void 0,ka().mark((function s(){var u,c,l,f,p=this;return ka().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:this.sequenceOptions.sync||e(),u=0;case 2:if(!(u<this.sequenceOptions.repeat)){s.next=22;break}c=xa(this.sequences),s.prev=4,f=ka().mark((function e(){var r,s,u,c,f,d;return ka().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=l.value,s=r.props,u=r.options,c=b({},p.propToCSS(n,a.state)),o.current){e.next=4;break}throw new Error("No scope found when animating.");case 4:if(f=o.current,Object.assign(f.style,c),a.state=t.mergeState(a.state,s),d=wa(f,p.propToCSS(n,a.state,i),p.optionsToFramerMotionOptions(u)||{}),p.setControl(d),n.logger.debug("Animating",p.propToCSS(n,a.state,i)),!1!==(null==u?void 0:u.sync)){e.next=14;break}d.then((function(){Object.assign(f.style,p.propToCSS(n,a.state,i)),p.setControl(null)})),e.next=18;break;case 14:return e.next=16,new Promise((function(t){return d.then((function(){return t()}))}));case 16:Object.assign(f.style,p.propToCSS(n,a.state,i)),p.setControl(null);case 18:case"end":return e.stop()}}),e)})),c.s();case 7:if((l=c.n()).done){s.next=11;break}return s.delegateYield(f(),"t0",9);case 9:s.next=7;break;case 11:s.next=16;break;case 13:s.prev=13,s.t1=s.catch(4),c.e(s.t1);case 16:return s.prev=16,c.f(),s.finish(16);case 19:u++,s.next=2;break;case 22:return s.next=24,A(2);case 24:this.setControl(null),e(),r&&r(a.state);case 27:case"end":return s.stop()}}),s,this,[[4,13,16,19]])})))})));case 1:case"end":return e.stop()}}),e)})))}},{key:"repeat",value:function(t){return this.sequenceOptions.repeat*=t,this}},{key:"overwrite",value:function(t,e){return this.transformers[t]=e,this}},{key:"propToCSS",value:function(e,n,r){var o,i=(null===(o=e.getLastScene())||void 0===o?void 0:o.config)||{},a=i.invertY,s=i.invertX,u={position:function(e){return t.positionToCSS(e,a,s)},backgroundColor:function(e){return t.backgroundToCSS(e)},backgroundOpacity:function(t){return{opacity:t}},opacity:function(t){return{opacity:t}},scale:function(){return{}},rotation:function(){return{}},display:function(){return{}},src:function(){return{}},fontColor:function(t){return"string"==typeof t?{color:t}:{color:S(t)}}},c={};for(var l in c.transform=t.propToCSSTransform(e,n),this.transformers.transform&&Object.assign(c,this.transformers.transform(n)),r&&r.transform&&Object.assign(c,r.transform(n)),n)Object.prototype.hasOwnProperty.call(n,l)&&(r&&r[l]?Object.assign(c,r[l](n[l])):this.transformers[l]?Object.assign(c,this.transformers[l](n[l])):u[l]&&Object.assign(c,u[l](n[l])));return c}},{key:"optionsToFramerMotionOptions",value:function(t){if(!t)return t;var e=t.duration;return{duration:e?e/1e3:0,ease:t.ease}}},{key:"setControl",value:function(t){return this.control=t,this}},{key:"getControl",value:function(){return this.control}},{key:"copy",value:function(){return new t(this.sequences,this.sequenceOptions)}}],[{key:"isPosition",value:function(t){return Te.isCommonPositionType(t)||je.isCoord2DPosition(t)||Pe.isAlignPosition(t)}},{key:"positionToCSS",value:function(t,e,n){return t?Ee.isRawPosition(t)?Ee.D2PositionToCSS(Ee.rawPositionToCoord2D(t),n,e):Ee.D2PositionToCSS(t.toCSS(),n,e):{}}},{key:"backgroundToCSS",value:function(t){return null==t?{}:ws.isStaticImageData(t)?{backgroundImage:"url(".concat(t.src,")")}:"string"==typeof t?{backgroundColor:t}:["r","g","b"].every((function(e){return e in t}))?{backgroundColor:S(t)}:{backgroundImage:"url("+t.url+")"}}},{key:"mergePosition",value:function(t,e){if(!t&&!e)throw new Error("No position found.");return t&&e?Ee.mergePosition(Ee.tryParsePosition(t),Ee.tryParsePosition(e)):Ee.toCoord2D(Ee.tryParsePosition(t||e))}},{key:"mergeState",value:function(t,e){var n=this.mergePosition(t.position,e.position);return Object.assign(Object.assign({},b(t,e)),{position:n})}},{key:"propToCSSTransform",value:function(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.translate,i=void 0===o?[]:o,a=r.scale,s=void 0===a?1:a;if(!t.getLastScene())throw new Error('No scene found in state, make sure you called "scene.activate()" before this method.');var u=void 0!==e.scale?e.scale:1,c=(null===(n=t.getLastScene())||void 0===n?void 0:n.config)||{},l=c.invertY,f=c.invertX;return["translate(".concat(i[0]||(f?"":"-")+"50%",", ").concat(i[1]||(l?"":"-")+"50%",")"),void 0!==e.rotation&&"rotate(".concat(e.rotation,"deg)"),"scale(".concat(u*s,")")].filter(Boolean).join(" ")}}])}();function Na(t){return Na="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},Na(t)}function Ra(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,Ma(r.key),r)}}function Ma(t){var e=function(t,e){if("object"!=Na(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Na(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Na(e)?e:e+""}function Fa(t,e,n){return e=Ba(e),function(t,e){if(e&&("object"==Na(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,Da()?Reflect.construct(e,n||[],Ba(t).constructor):e.apply(t,n))}function Da(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Da=function(){return!!t})()}function Ba(t){return Ba=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ba(t)}function Va(t,e){return Va=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Va(t,e)}La.defaultSequenceOptions={sync:!0,repeat:1},La.defaultOptions={duration:0,ease:"linear"},La.CommonImagePositionMap=Ia;var Ga=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Fa(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&&Va(t,e)}(e,t),function(t,e,n){return e&&Ra(t.prototype,e),n&&Ra(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"do",value:function(t){return this.push(Yt.ActionTypes.do,t)}},{key:"doAsync",value:function(t){return this.push(Yt.ActionTypes.doAsync,t)}},{key:"any",value:function(t){return this.push(Yt.ActionTypes.any,t)}},{key:"all",value:function(t){return this.push(Yt.ActionTypes.all,t)}},{key:"allAsync",value:function(t){return this.push(Yt.ActionTypes.allAsync,t)}},{key:"repeat",value:function(t,e){return this.push(Yt.ActionTypes.repeat,e,t)}},{key:"sleep",value:function(t){return this.push(Yt.ActionTypes.sleep,[],t)}},{key:"push",value:function(t,e){for(var n=ae.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 Yt(this.chain(),t,(new At).setContent([this.construct(n)].concat(o)));return this.chain(a)}}],[{key:"do",value:function(t){return(new e).do(t)}},{key:"doAsync",value:function(t){return(new e).doAsync(t)}},{key:"any",value:function(t){return(new e).any(t)}},{key:"all",value:function(t){return(new e).all(t)}},{key:"allAsync",value:function(t){return(new e).allAsync(t)}},{key:"repeat",value:function(t,n){return(new e).repeat(t,n)}},{key:"sleep",value:function(t){return(new e).sleep(t)}}])}(ve);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 za(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,Ha(r.key),r)}}function Ha(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+""}function Wa(t,e,n){return e=Ya(e),function(t,e){if(e&&("object"==Ua(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||[],Ya(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 Ya(t){return Ya=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ya(t)}function qa(t,e){return qa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},qa(t,e)}var Xa=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=Wa(this,e)).events=new k,r.ref=void 0,"string"==typeof t?(r.name=t,r.config=b(e.defaultConfig,n||{}),r.config.position&&(r.config.position=Ee.tryParsePosition(r.config.position))):(r.name="",r.config=b(e.defaultConfig,t),r.config.position&&(r.config.position=Ee.tryParsePosition(r.config.position))),r.state=b({},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&&qa(t,e)}(e,t),function(t,e,n){return e&&za(t.prototype,e),n&&za(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;return this.combineActions(new Ga,(function(r){if(e){var o=e.copy();o.setSrc(ws.srcToString(t)),r._transitionSrc(o)}var i=new ss(r,ss.ActionTypes.setSrc,(new At).setContent(["string"==typeof t?t:ws.staticImageDataToSrc(t)]));return r.chain(i).chain(n._flush())}))}},{key:"applyTransform",value:function(t){var e=this;return this.combineActions(new Ga,(function(n){var r=new ss(n,ss.ActionTypes.applyTransform,(new At).setContent([void 0,t.copy(),x()]));return n.chain(r).chain(e._flush())}))}},{key:"show",value:function(t){var e=this,n=t instanceof La?t.copy():new La([{props:{opacity:1},options:t||{}}]);return this.combineActions(new Ga,(function(t){var r=new ss(t,ss.ActionTypes.show,(new At).setContent([void 0,n]));return t.chain(r).chain(e._flush())}))}},{key:"hide",value:function(t){var e=this;return this.combineActions(new Ga,(function(n){var r=new ss(n,ss.ActionTypes.hide,(new At).setContent([void 0,t instanceof La?t.copy():new La([{props:{opacity:0},options:t||{}}])]));return n.chain(r).chain(e._flush())}))}},{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||O(this.state,this.config)?null:{state:b({},e.serializeImageState(this.state))}}},{key:"fromData",value:function(t){return this.state=b(this.state,e.deserializeImageState(t.state)),this}},{key:"_$setDispose",value:function(){return this.state.disposed=!0,this}},{key:"_applyTransition",value:function(t){return this.chain(new ss(this.chain(),"image:applyTransition",(new At).setContent([t])))}},{key:"_init",value:function(t){return new ss(this.chain(),ss.ActionTypes.init,(new At).setContent([t]))}},{key:"_flush",value:function(){return new ss(this.chain(),ss.ActionTypes.flush,new At)}},{key:"reset",value:function(){this.state=b({},this.config)}},{key:"toDisplayableTransform",value:function(){return new La(this.state,{duration:0})}},{key:"_transitionSrc",value:function(t){var e=t.copy();return this._applyTransition(e),this}},{key:"_dispose",value:function(){return this.chain(new ss(this.chain(),ss.ActionTypes.dispose,new At))}}],[{key:"serializeImageState",value:function(t){var e={position:function(t){return Ee.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 Ee.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}}])}(ve);function Ka(t){return Ka="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},Ka(t)}function Za(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Za=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new P(r||[]);return o(a,"_invoke",{value:O(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",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"==Ka(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,n,r){var o=p;return function(i,a){if(o===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 T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(Ka(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),j(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;j(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function 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,Ja(r.key),r)}}function Ja(t){var e=function(t,e){if("object"!=Ka(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ka(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ka(e)?e:e+""}function ts(t,e,n){return e=os(e),function(t,e){if(e&&("object"==Ka(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,es()?Reflect.construct(e,n||[],os(t).constructor):e.apply(t,n))}function es(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(es=function(){return!!t})()}function ns(t,e,n,r){var o=rs(os(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function rs(){return rs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=os(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}},rs.apply(null,arguments)}function os(t){return os=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},os(t)}function is(t,e){return is=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},is(t,e)}Xa.EventTypes={"event:image.init":"event:image.init","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.flush":"event:image.flush","event:image.flushComponent":"event:image.flushComponent","event:displayable.applyTransition":"event:displayable.applyTransition","event:displayable.applyTransform":"event:displayable.applyTransform","event:displayable.init":"event:displayable.init"},Xa.defaultConfig={src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",display:!1,position:new Te(ye.Center),scale:1,rotation:0,opacity:0};var as=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())}))},ss=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ts(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&&is(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:"executeAction",value:function(t){var r=this;if(this.type===n.init){var o=t.findElementByImage(this.callee);o&&t.disposeImage(this.callee,o.scene);var i=this.contentNode.getContent()[0];t.createImage(this.callee,i);var a=new w((function(t){return t}));return as(r,void 0,void 0,Za().mark((function e(){return Za().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.callee.events.any("event:displayable.init");case 2:a.resolve({type:this.type,node:this.contentNode.getChild()}),t.stage.next();case 4:case"end":return e.stop()}}),e,this)}))),a}if(this.type===n.setSrc)return this.callee.state.src=this.contentNode.getContent()[0],t.logger.debug("Image - Set Src",this.callee.state.src),t.stage.update(),ns(e,"executeAction",this,3)([t]);if([n.show,n.hide,n.applyTransform].includes(this.type)){var s=new w((function(t){return t})).registerSkipController(new T((function(){return r.type===n.hide&&(r.callee.state.display=!1),ns(e,"executeAction",r,3)([t])}))),u=this.contentNode.getContent()[1];return this.type===n.show&&(this.callee.state.display=!0,t.stage.update()),t.animateImage(Xa.EventTypes["event:displayable.applyTransform"],this.callee,[u],(function(){var t;r.type===n.hide&&(r.callee.state.display=!1),s.resolve({type:r.type,node:null===(t=r.contentNode)||void 0===t?void 0:t.getChild()})})),s}if(this.type===n.dispose)return t.disposeImage(this.callee),this.callee._$setDispose(),ns(e,"executeAction",this,3)([t]);if(this.type===n.applyTransition){var c=new w((function(t){return t})).registerSkipController(new T((function(){return r.type===n.hide&&(r.callee.state.display=!1),{type:r.type,node:r.contentNode.getChild()}}))),l=this.contentNode.getContent()[0];return this.callee.events.any("event:displayable.applyTransition",l).then((function(){c.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),c}if(this.type===n.flush)return ns(e,"executeAction",this,3)([t]);throw ns(e,"unknownType",this,3)([])}}])}(z);function us(t,e,n){return e=ds(e),function(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)}(t,fs()?Reflect.construct(e,n||[],ds(t).constructor):e.apply(t,n))}function cs(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 ls(t){var e="function"==typeof Map?new Map:void 0;return ls=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(fs())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,ds(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ps(n,t)},ls(t)}function fs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(fs=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 ds(t){return ds=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ds(t)}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 ys(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function vs(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,gs(r.key),r)}}function ms(t,e,n){return e&&vs(t.prototype,e),n&&vs(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function gs(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+""}ss.ActionTypes=n;var bs=function(){function t(e,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;ys(this,t),this.r=e,this.g=n,this.b=r,this.a=o}return ms(t,[{key:"toString",value:function(){return"rgba(".concat(this.r,", ").concat(this.g,", ").concat(this.b,", ").concat(this.a,")")}},{key:"toHex",value:function(){return"#"+this.r.toString(16)+this.g.toString(16)+this.b.toString(16)}},{key:"toImageColor",value:function(){return{r:this.r,g:this.g,b:this.b,a:this.a}}}],[{key:"isHexString",value:function(t){return"string"==typeof t&&/^#[0-9A-F]{6}$/i.test(t)}},{key:"fromHex",value:function(e){var n=e.slice(1);return new t(parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16),8===n.length?parseInt(n.slice(6,8),16)/255:1)}}])}(),ws=function(){function t(){ys(this,t)}return ms(t,null,[{key:"srcToString",value:function(t){return"string"==typeof t?t:t.src}},{key:"staticImageDataToSrc",value:function(t){return"string"==typeof t?t:t.src}},{key:"isStaticImageData",value:function(t){return void 0!==(null==t?void 0:t.src)}},{key:"backgroundToSrc",value:function(e){return t.isStaticImageData(e)?e.src:(null==e?void 0:e.url)||null}},{key:"isExternalSrc",value:function(t){return t.startsWith("http://")||t.startsWith("https://")}},{key:"isImageSrc",value:function(e){return"string"==typeof e&&!this.isHexString(e)||t.isStaticImageData(e)}},{key:"isImageColor",value:function(e){return t.isHexString(e)||t.isPlainColor(e)}},{key:"isPlainColor",value:function(t){return t&&("string"==typeof t||"object"===hs(t)&&"r"in t&&"g"in t&&"b"in t)}},{key:"isHexString",value:function(t){return"string"==typeof t&&/^#([0-9A-F]{6}|[0-9A-F]{3})$/i.test(t)}},{key:"toBackgroundSrc",value:function(t){return"string"==typeof t?t:t.src}},{key:"toHex",value:function(t){return S(t)}}])}();ws.RGBColor=bs;var _s,Ss=function(t){function e(t,n){return ys(this,e),us(this,e,[t,{info:n},"NarraLeafReact-StaticScriptWarning"])}return cs(e,t),ms(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 ys(this,e),(r=us(this,e,[t])).props=n,r.name=o,r}return cs(e,t),ms(e,null,[{key:"isUseError",value:function(t){return t instanceof e}}])}(ls(Error))),ks=function(){return ms((function t(e){ys(this,t),this.scene=e}),[{key:"run",value:function(){if(!this.scene.sceneRoot)return null;var t=new Map,e=new Map,n=[],r=new Set,o=this.scene.getAllChildren(this.scene.sceneRoot);if(!o.length)return null;for(n.push(o[0]);n.length;){var i=n.shift();this.checkAction(i,{imageStates:t,scenes:e},r);var a=i.contentNode.getChild();a&&a.action&&n.push(a.action)}return t}},{key:"checkAction",value:function(t,n,r){var o=n.imageStates,i=n.scenes;if(t instanceof ss)o.has(t.callee)||o.set(t.callee,{isDisposed:!1,usedExternalSrc:!1}),this.checkImage(o.get(t.callee),t);else if(t instanceof ht){var a=t.callee;if(i.has(a.name)){if(i.get(a.name)!==a){var s="Scene with name: ".concat(a.name," is duplicated\nScene: ").concat(a.name,"\n\nAt: ").concat(t.__stack);throw new Ss(s)}}else i.set(a.name,a);if(t.type===e.jumpTo){var u=t.contentNode.getContent()[0];if(r.has(u))return;r.add(u)}}}},{key:"checkImage",value:function(t,e){if(e.type===n.dispose){if(t.isDisposed){var r="Image is disposed multiple times before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new Ss(r)}t.isDisposed=!0}else if([n.init,n.show,n.hide,n.applyTransform,n.applyTransition].includes(e.type)){if(t.isDisposed){var o="Image is disposed before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new Ss(o)}}else if(e.type===n.setSrc){var i=e.contentNode.getContent()[0];ws.isExternalSrc(i)&&(t.usedExternalSrc=!0)}}}])}();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){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Os(r.key),r)}}function Os(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+""}function Es(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,Ts()?Reflect.construct(e,n||[],js(t).constructor):e.apply(t,n))}function Ts(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ts=function(){return!!t})()}function js(t){return js=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},js(t)}function Ps(t,e){return Ps=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ps(t,e)}!function(t){t.soundEffect="soundEffect",t.music="music",t.voice="voice",t.backgroundMusic="backgroundMusic"}(_s||(_s={}));var Cs=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=Es(this,e)).state={playing:null,token:null},t.config=b(e.defaultConfig,"string"==typeof n?{src:n}:n),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ps(t,e)}(e,t),function(t,e,n){return e&&As(t.prototype,e),n&&As(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"play",value:function(){if(this.config.type===_s.backgroundMusic)throw new Error("Background music cannot be played directly");return this.pushAction(et.ActionTypes.play,[void 0])}},{key:"stop",value:function(){if(this.config.type===_s.backgroundMusic)throw new Error("Background music cannot be stopped directly");return this.pushAction(et.ActionTypes.stop,[void 0])}},{key:"fade",value:function(t,e,n){if(this.config.type===_s.backgroundMusic)throw new Error("Background music cannot be faded directly");return this.pushAction(et.ActionTypes.fade,[{start:t,end:e,duration:n}])}},{key:"setVolume",value:function(t){return this.pushAction(et.ActionTypes.setVolume,[t])}},{key:"setRate",value:function(t){return this.pushAction(et.ActionTypes.setRate,[t])}},{key:"pause",value:function(t){return void 0!==t?this.fade(void 0,0,t):this.pushAction(et.ActionTypes.pause,[void 0])}},{key:"resume",value:function(t){return void 0!==t?this.fade(0,this.config.volume,t):this.pushAction(et.ActionTypes.resume,[void 0])}},{key:"getHowlOptions",value:function(t){return Object.assign({src:this.config.src,loop:this.config.loop,volume:this.config.volume,html5:this.config.streaming,autoplay:!1},t||{})}},{key:"getSrc",value:function(){return this.config.src}},{key:"getToken",value:function(){return this.state.token||void 0}},{key:"getPlaying",value:function(){return this.state.playing}},{key:"setToken",value:function(t){this.state.token=void 0===t?null:t}},{key:"setPlaying",value:function(t){return this.state.playing=t,this}},{key:"toData",value:function(){return O(this.config,e.defaultConfig)?null:{config:_(this.config)}}},{key:"fromData",value:function(t){return this.config=b(this.config,t.config),this}},{key:"reset",value:function(){var t;null===(t=this.state.playing)||void 0===t||t.stop(),this.state.playing=null,this.state.token=null}},{key:"pushAction",value:function(t,e){return this.chain(new et(this.chain(),t,(new At).setContent(e)))}}],[{key:"toSoundSrc",value:function(t){return null==t?null:"string"==typeof t?t:t.getSrc()}},{key:"toSound",value:function(t){return null==t?null:"string"==typeof t?new e({src:t}):t}}])}(ve);function Is(t){return Is="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Is(t)}function Ls(t,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"!=Is(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Is(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Is(e)?e:e+""}Cs.defaultConfig={src:"",sync:!1,loop:!1,volume:1};var Rs=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e}return function(t,e,n){return e&&Ls(t.prototype,e),n&&Ls(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,null,[{key:"from",value:function(e){return t.isPauseConstructor(e)?new t:e}},{key:"wait",value:function(e){return new t({duration:e})}},{key:"isPause",value:function(e){return this.isPauseConstructor(e)||e instanceof t}},{key:"isPauseConstructor",value:function(e){return e===t}}])}();function Ms(t){return Ms="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},Ms(t)}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,Ds(r.key),r)}}function Ds(t){var e=function(t,e){if("object"!=Ms(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ms(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ms(e)?e:e+""}var Bs=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.text=e,this.config=b(t.defaultConfig,n)}return function(t,e,n){return e&&Fs(t.prototype,e),n&&Fs(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"evaluate",value:function(e){var n=this;if(Rs.isPause(this.text))return[this];if("function"==typeof this.text){var r=this.text(e);return Array.isArray(r)?r.map((function(r){return t.isWord(r)?r.inherit(n.config).evaluate(e):new t(r,n.config)})).flat():t.isWord(r)?r.inherit(this.config).evaluate(e):[new t(r,this.config)]}return[this]}},{key:"inherit",value:function(t){return this.config.color=this.config.color||t.color,this.config.italic=this.config.italic||t.italic,this.config.bold=this.config.bold||t.bold,this}}],[{key:"isWord",value:function(e){return e instanceof t}}])}();function Vs(t){return Vs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vs(t)}function Gs(t){return function(t){if(Array.isArray(t))return Us(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 Us(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)?Us(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 Us(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function zs(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Hs(r.key),r)}}function Hs(t){var e=function(t,e){if("object"!=Vs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Vs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Vs(e)?e:e+""}Bs.defaultConfig={},Bs.defaultColor="#000";var Ws=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.text=t.format(e),this.config=b(t.defaultConfig,Object.assign(Object.assign({},n),{voice:Cs.toSound(n.voice)})),this.state=_(t.defaultState)}return function(t,e,n){return e&&zs(t.prototype,e),n&&zs(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"toData",value:function(){return O(this.state,t.defaultState)?null:{state:_(this.state)}}},{key:"fromData",value:function(t){return this.state=b(this.state,t),this}},{key:"toString",value:function(){return this.text.map((function(t){return t.text})).join("")}},{key:"setCharacter",value:function(t){return this.config.character=t,this}},{key:"evaluate",value:function(e){for(var n=[],r=0;r<this.text.length;r++){var o=this.text[r].evaluate(e);n.push.apply(n,Gs(t.formatStaticWord(o)))}return n}},{key:"copy",value:function(){return new t(Gs(this.text),this.config)}}],[{key:"isSentence",value:function(e){return e instanceof t}},{key:"toSentence",value:function(e){return t.isSentence(e)?e:new t(e)}},{key:"format",value:function(t){var e=[];if(Array.isArray(t))for(var n=0;n<t.length;n++)e.push(this.formatWord(t[n]));else e.push(this.formatWord(t));return e}},{key:"formatWord",value:function(t){return Bs.isWord(t)?t:new Bs(t)}},{key:"formatStaticWord",value:function(t,e){var n=this;return Array.isArray(t)?t.map((function(t){return n.formatStaticWord(t,e)})).flat(2):[Bs.isWord(t)?t:new Bs(t,e)]}}])}();function $s(t){return $s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$s(t)}function 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,qs(r.key),r)}}function qs(t){var e=function(t,e){if("object"!=$s(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=$s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==$s(e)?e:e+""}function Xs(t,e,n){return e=Js(e),function(t,e){if(e&&("object"==$s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ks()?Reflect.construct(e,n||[],Js(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 Zs(t,e,n,r){var o=Qs(Js(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function Qs(){return Qs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Js(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}},Qs.apply(null,arguments)}function Js(t){return Js=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Js(t)}function tu(t,e){return tu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},tu(t,e)}Ws.defaultConfig={color:"#000",pause:!0,voice:null,character:null},Ws.defaultState={display:!0};var eu=function(e){function n(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),Xs(this,n,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&tu(t,e)}(n,e),function(t,e,n){return e&&Ys(t.prototype,e),n&&Ys(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"executeAction",value:function(e){var r=this;if(this.type===t.say){var o=new w((function(t){return t})).registerSkipController(new T((function(){return{type:r.type,node:r.contentNode.getChild()}}))),i=this.contentNode.getContent(),a=i.config.voice;return a&&(et.initSound(e,a),e.playSound(a,(function(){e.stopSound(a)}))),e.createText(this.getId(),i,(function(){a&&e.stopSound(a),o.resolve({type:r.type,node:r.contentNode.getChild()})})),o}if(this.type===t.setName)return this.callee.state.name=this.contentNode.getContent()[0],Zs(n,"executeAction",this,3)([e]);throw Zs(n,"unknownType",this,3)([])}}])}(z);function nu(t){return nu="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},nu(t)}function ru(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,ou(r.key),r)}}function ou(t){var e=function(t,e){if("object"!=nu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=nu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==nu(e)?e:e+""}function iu(t,e,n){return e=su(e),function(t,e){if(e&&("object"==nu(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,au()?Reflect.construct(e,n||[],su(t).constructor):e.apply(t,n))}function au(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(au=function(){return!!t})()}function su(t){return su=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},su(t)}function uu(t,e){return uu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},uu(t,e)}eu.ActionTypes=t;var cu=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=iu(this,e)).config=b(e.defaultConfig,r),n.state={name:t||""},n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&uu(t,e)}(e,t),function(t,e,n){return e&&ru(t.prototype,e),n&&ru(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"say",value:function(t,e){var n=Array.isArray(t)?new Ws(t,Object.assign(Object.assign({},e||{}),{character:this})):(Ws.isSentence(t)?t:new Ws(t,Object.assign(Object.assign({},e||{}),{character:this}))).copy();n.setCharacter(this);var r=new eu(this.chain(),eu.ActionTypes.say,(new At).setContent(n));return this.chain(r)}},{key:"setName",value:function(t){var e=new eu(this.chain(),eu.ActionTypes.setName,(new At).setContent([t]));return this.chain(e)}}])}(ve);function lu(t){return lu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lu(t)}function fu(t){return function(t){if(Array.isArray(t))return pu(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 pu(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)?pu(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 pu(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 du(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,hu(r.key),r)}}function hu(t){var e=function(t,e){if("object"!=lu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=lu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==lu(e)?e:e+""}function yu(t,e,n){return e=gu(e),function(t,e){if(e&&("object"==lu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,vu()?Reflect.construct(e,n||[],gu(t).constructor):e.apply(t,n))}function vu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(vu=function(){return!!t})()}function mu(){return mu="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=gu(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}},mu.apply(null,arguments)}function gu(t){return gu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},gu(t)}function bu(t,e){return bu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},bu(t,e)}cu.defaultConfig={color:"#000"};var wu=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),yu(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&bu(t,e)}(e,t),function(t,e,n){return e&&du(t.prototype,e),n&&du(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var e,n,r=this.callee.evaluate(this.contentNode.getContent(),{gameState:t});return null===(e=null==r?void 0:r[r.length-1])||void 0===e||e.contentNode.addChild(this.contentNode.getChild()),this.contentNode.addChild((null===(n=null==r?void 0:r[0])||void 0===n?void 0:n.contentNode)||null),{type:this.type,node:this.contentNode.getChild()}}},{key:"getFutureActions",value:function(){return[].concat(fu(this.callee._getFutureActions()),fu(function(t,e,n,r){var o=mu(gu(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"getFutureActions",this,3)([])))}}])}(z);function _u(t){return _u="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},_u(t)}function Su(t){return function(t){if(Array.isArray(t))return xu(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ku(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 ku(t,e){if(t){if("string"==typeof t)return xu(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)?xu(t,e):void 0}}function xu(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 Au(t,e,n){return e=Eu(e),function(t,e){if(e&&("object"==_u(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ou()?Reflect.construct(e,n||[],Eu(t).constructor):e.apply(t,n))}function Ou(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ou=function(){return!!t})()}function Eu(t){return Eu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Eu(t)}function Tu(t,e){return Tu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Tu(t,e)}function ju(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Pu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Iu(r.key),r)}}function Cu(t,e,n){return e&&Pu(t.prototype,e),n&&Pu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Iu(t){var e=function(t,e){if("object"!=_u(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=_u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==_u(e)?e:e+""}wu.ActionTypes={action:"condition:action"};var Lu=function(){return Cu((function t(e){ju(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()}}}])}(),Nu=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return ju(this,e),(t=Au(this,e)).conditions={If:{condition:null,action:null},ElseIf:[],Else:{action:null}},t.config=b(e.defaultConfig,n),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Tu(t,e)}(e,t),Cu(e,[{key:"If",value:function(t,e){if(this.conditions.If.condition)throw new Ss("IF condition already set\nYou are trying to set multiple IF conditions for the same condition");if(this.conditions.ElseIf.length)throw new Ss("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 Ss("ELSE condition already set\nYou are trying to set an IF condition after an ELSE condition");return this.conditions.If.condition=t instanceof Lu?t:new Lu(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 Ss("IF condition not set\nYou are trying to set an ELSE-IF condition without an IF condition");if(this.conditions.Else.action)throw new Ss("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 Lu?t:new Lu(t),action:this.construct(Array.isArray(e)?e:[e])}),this.chain()}},{key:"Else",value:function(t){if(!this.conditions.If.condition)throw new Ss("IF condition not set\nYou are trying to set an ELSE condition without an IF condition");if(this.conditions.Else.action)throw new Ss("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=ku(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(wu,[this,wu.ActionTypes.action,(new At).setContent(t.conditions)])]}},{key:"construct",value:function(t,e,n){for(var r,o=ae.toActions(t),i=0;i<o.length;i++){var a=o[i].contentNode,s=null===(r=o[i+1])||void 0===r?void 0:r.contentNode;s&&a.setChild(s),i===o.length-1&&e&&a.setChild(e),0===i&&n&&n.setChild(a)}return o}},{key:"_getFutureActions",value:function(){return ae.toActions([].concat(Su(this.conditions.If.action||[]),Su(this.conditions.ElseIf.flatMap((function(t){return t.action||[]}))),Su(this.conditions.Else.action||[])))}}],[{key:"getInitialState",value:function(){return{If:{condition:null,action:null},ElseIf:[],Else:{action:null}}}}])}(ve);function Ru(t){return Ru="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},Ru(t)}function Mu(t){return function(t){if(Array.isArray(t))return Fu(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 Fu(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)?Fu(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 Fu(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 Du(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Bu(r.key),r)}}function Bu(t){var e=function(t,e){if("object"!=Ru(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ru(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ru(e)?e:e+""}function Vu(t,e,n){return e=zu(e),function(t,e){if(e&&("object"==Ru(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,Gu()?Reflect.construct(e,n||[],zu(t).constructor):e.apply(t,n))}function Gu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Gu=function(){return!!t})()}function Uu(){return Uu="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}},Uu.apply(null,arguments)}function zu(t){return zu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},zu(t)}function Hu(t,e){return Hu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Hu(t,e)}Nu.defaultConfig={};var Wu=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Vu(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&&Hu(t,e)}(e,t),function(t,e,n){return e&&Du(t.prototype,e),n&&Du(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var e=this,n=new w((function(t){return t})),r=this.contentNode.getContent();return t.createMenu(r,(function(r){var o,i,a=(null===(o=t.game.getLiveGame().getCurrentAction())||void 0===o?void 0:o.contentNode.getChild())||null;a&&(null===(i=r.action[r.action.length-1])||void 0===i||i.contentNode.addChild(a)),n.resolve({type:e.type,node:r.action[0].contentNode})})),n}},{key:"getFutureActions",value:function(){var t=this.contentNode.getContent();return[].concat(Mu(this.callee._getFutureActions(t.choices)),Mu(function(t,e,n,r){var o=Uu(zu(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"getFutureActions",this,3)([])))}}])}(z);function $u(t){return $u="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},$u(t)}function Yu(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,qu(r.key),r)}}function qu(t){var e=function(t,e){if("object"!=$u(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=$u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==$u(e)?e:e+""}function Xu(t,e,n){return e=Zu(e),function(t,e){if(e&&("object"==$u(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ku()?Reflect.construct(e,n||[],Zu(t).constructor):e.apply(t,n))}function Ku(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ku=function(){return!!t})()}function Zu(t){return Zu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Zu(t)}function Qu(t,e){return Qu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Qu(t,e)}Wu.ActionTypes={action:"menu:action"};var Ju=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=Xu(this,e)).choices=[],n.prompt=Ws.isSentence(t)?t:new Ws(t),n.config=b(e.defaultConfig,r),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Qu(t,e)}(e,t),function(t,e,n){return e&&Yu(t.prototype,e),n&&Yu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"choose",value:function(t,e){var n=this.chain();return Ws.isSentence(t)&&e||(Bs.isWord(t)||Array.isArray(t)||"string"==typeof t)&&e?n.choices.push({prompt:Ws.toSentence(t),action:ae.toActions(e)}):"object"===$u(t)&&"prompt"in t&&"action"in t?n.choices.push({prompt:Ws.toSentence(t.prompt),action:ae.toActions(t.action)}):console.warn("No valid choice added to menu, ",{arg0:t,arg1:e}),n}},{key:"fromChained",value:function(t){return[new Wu(this.chain(),Wu.ActionTypes.action,(new At).setContent({prompt:this.prompt,choices:t.constructChoices()}))]}},{key:"_getFutureActions",value:function(t){return t.map((function(t){return t.action})).flat(2)}},{key:"constructNodes",value:function(t,e,n){for(var r,o=0;o<t.length;o++){var i=t[o].contentNode,a=null===(r=t[o+1])||void 0===r?void 0:r.contentNode;a&&i.setChild(a),o===this.choices.length-1&&e&&i.setChild(e),0===o&&n&&n.setChild(i)}return t}},{key:"constructChoices",value:function(){var t=this;return this.choices.map((function(e){return{action:t.constructNodes(e.action),prompt:e.prompt}}))}}])}(ve);function tc(t){return tc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tc(t)}function ec(t){return function(t){if(Array.isArray(t))return nc(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 nc(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)?nc(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 nc(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 rc(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,oc(r.key),r)}}function oc(t){var e=function(t,e){if("object"!=tc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=tc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==tc(e)?e:e+""}function ic(t,e,n){return e=sc(e),function(t,e){if(e&&("object"==tc(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ac()?Reflect.construct(e,n||[],sc(t).constructor):e.apply(t,n))}function ac(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ac=function(){return!!t})()}function sc(t){return sc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},sc(t)}function uc(t,e){return uc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},uc(t,e)}Ju.defaultConfig={},Ju.targetAction=Wu;var cc=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ic(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&&uc(t,e)}(e,t),function(t,e,n){return e&&rc(t.prototype,e),n&&rc(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,ec(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,ec(i))}}}},{key:"getAllChildren",value:function(t){var e=[];return this.forEachChild(t,(function(t){return e.push(t)})),e}},{key:"getAllChildrenMap",value:function(t){var e=new Map;return this.forEachChild(t,(function(t){return e.set(t.getId(),t)})),e}},{key:"getAllElementMap",value:function(t){var e=new Map;return this.forEachChild(t,(function(t){return e.set(t.callee.getId(),t.callee)})),e}},{key:"getAllChildrenElements",value:function(t){return Array.from(new Set(this.getAllChildren(t).map((function(t){return t.callee}))))}},{key:"toData",value:function(){return null}},{key:"constructNodes",value:function(t,e){for(var n,r=0;r<t.length;r++){var o=t[r];0===r&&e?e.setChild(o.contentNode):r>0&&(null===(n=t[r-1].contentNode)||void 0===n||n.setChild(o.contentNode))}return t.length?t[0].contentNode:null}}])}(se);function lc(t){return lc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lc(t)}function fc(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,pc(r.key),r)}}function pc(t){var e=function(t,e){if("object"!=lc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=lc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==lc(e)?e:e+""}var dc=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&&fc(t.prototype,e),n&&fc(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 Cs){if(this.isSrcRegistered(t.getSrc()))return this;this.src.push({type:"audio",src:t})}else if(t instanceof Xa||ws.isStaticImageData(t)){if(t instanceof Xa){if(this.isSrcRegistered(ws.srcToString(t.state.src)))return this}else if(this.isSrcRegistered(ws.srcToString(t.src)))return this;this.src.push({type:"image",src:t instanceof Xa?t:new Xa("",{src:ws.staticImageDataToSrc(t)})})}else if("object"===lc(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 Cs?e:new Cs({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 Cs?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===ws.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 hc(t){return hc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hc(t)}function yc(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,vc(r.key),r)}}function vc(t){var e=function(t,e){if("object"!=hc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=hc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==hc(e)?e:e+""}function mc(t,e,n){return e=_c(e),function(t,e){if(e&&("object"==hc(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,gc()?Reflect.construct(e,n||[],_c(t).constructor):e.apply(t,n))}function gc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(gc=function(){return!!t})()}function bc(t,e,n,r){var o=wc(_c(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function wc(){return wc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=_c(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}},wc.apply(null,arguments)}function _c(t){return _c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_c(t)}function Sc(t,e){return Sc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Sc(t,e)}dc.SrcTypes={image:"image",video:"video",audio:"audio"};var kc=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),mc(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&&Sc(t,e)}(e,t),function(t,e,n){return e&&yc(t.prototype,e),n&&yc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===s.init){var r=t.findElementByDisplayable(this.callee);r&&t.disposeDisplayable(this.callee,r.scene);var o=this.contentNode.getContent()[0];t.createDisplayable(this.callee,o);var i=new w((function(t){return t}));return this.callee.events.any("event:displayable.init").then((function(){i.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),i}if([s.show,s.hide,s.applyTransform].includes(this.type)){var a=new w((function(t){return t})).registerSkipController(new T((function(){return n.type===s.hide&&(n.callee.state.display=!1),bc(e,"executeAction",n,3)([t])}))),u=this.contentNode.getContent()[0];return this.type===s.show&&(this.callee.state.display=!0,t.stage.update()),t.animateText(Jc.EventTypes["event:displayable.applyTransform"],this.callee,[u],(function(){n.type===s.hide&&(n.callee.state.display=!1),a.resolve(bc(e,"executeAction",n,3)([t]))})),a}if(this.type===s.setText)return this.callee.state.text=this.contentNode.getContent()[0],bc(e,"executeAction",this,3)([t]);if(this.type===s.setFontSize){this.callee.state.fontSize=this.contentNode.getContent()[0];var c=new La([],{duration:0}),l=new w;return t.animateText(Jc.EventTypes["event:displayable.applyTransform"],this.callee,[c],(function(){l.resolve(bc(e,"executeAction",n,3)([t]))})),l}if(this.type===s.applyTransition){var f=(new w).registerSkipController(new T((function(){return t.logger.info("NarraLeaf-React: Text Transition","Skipped"),{type:n.type,node:n.contentNode.getChild()}}))),p=this.contentNode.getContent()[0];return this.callee.events.any("event:displayable.applyTransition",p).then((function(){f.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),f}throw bc(e,"unknownType",this,3)([])}}])}(z);kc.ActionTypes=s;var xc={start:"start",update:"update",end:"end"};function Ac(t){return Ac="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},Ac(t)}function Oc(t,e,n){return e=Tc(e),function(t,e){if(e&&("object"==Ac(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,Ec()?Reflect.construct(e,n||[],Tc(t).constructor):e.apply(t,n))}function Ec(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ec=function(){return!!t})()}function Tc(t){return Tc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Tc(t)}function jc(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Pc(t,e)}function Pc(t,e){return Pc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Pc(t,e)}function Cc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ic(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Nc(r.key),r)}}function Lc(t,e,n){return e&&Ic(t.prototype,e),n&&Ic(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Nc(t){var e=function(t,e){if("object"!=Ac(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ac(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ac(e)?e:e+""}var Rc=function(){return Lc((function t(){Cc(this,t),this.events=new k}),[{key:"start",value:function(t){throw new Error("Method not implemented.")}},{key:"toElementProps",value:function(){throw new Error("Method not implemented.")}},{key:"copy",value:function(){throw new Error("Method not implemented.")}},{key:"requestAnimation",value:function(t,e,n){var r=this,o=t.start,i=t.end,a=t.duration,s=e.onComplete,u=e.onUpdate;return this.events.emit(xc.start,null),this.controller=wa(o,i,Object.assign({duration:a/1e3,onUpdate:function(t){u&&u(t),r.events.emit(xc.update,r.toElementProps())},onComplete:function(){r.controller=void 0,r.events.emit(xc.end,null),s&&s()}},n)),this.controller}}])}(),Mc=function(t){function e(){return Cc(this,e),Oc(this,e,arguments)}return jc(e,t),Lc(e,[{key:"setSrc",value:function(t){throw new Error("Method not implemented.")}},{key:"copy",value:function(){throw new Error("Method not implemented.")}}])}(Rc),Fc=function(t){function e(){return Cc(this,e),Oc(this,e,arguments)}return jc(e,t),Lc(e,[{key:"copy",value:function(){throw new Error("Method not implemented.")}}])}(Rc);function Dc(t){return Dc="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},Dc(t)}function Bc(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Vc(r.key),r)}}function Vc(t){var e=function(t,e){if("object"!=Dc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Dc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Dc(e)?e:e+""}function Gc(t,e,n){return e=zc(e),function(t,e){if(e&&("object"==Dc(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,Uc()?Reflect.construct(e,n||[],zc(t).constructor):e.apply(t,n))}function Uc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Uc=function(){return!!t})()}function zc(t){return zc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},zc(t)}function Hc(t,e){return Hc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Hc(t,e)}var Wc=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=Gc(this,e)).state={fontSize:0},r.startValue=t,r.endValue=n,r.duration=o,r.easing=i,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Hc(t,e)}(e,t),function(t,e,n){return e&&Bc(t.prototype,e),n&&Bc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"start",value:function(t){var e=this;this.state.fontSize=this.startValue,this.requestAnimation({start:this.startValue,end:this.endValue,duration:this.duration},{onComplete:function(){e.state.fontSize=e.endValue,t&&t()},onUpdate:function(t){e.state.fontSize=t}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{fontSize:this.state.fontSize}}]}},{key:"copy",value:function(){return new e(this.startValue,this.endValue,this.duration,this.easing)}}])}(Fc);function $c(t){return $c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$c(t)}function Yc(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,qc(r.key),r)}}function qc(t){var e=function(t,e){if("object"!=$c(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=$c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==$c(e)?e:e+""}function Xc(t,e,n){return e=Zc(e),function(t,e){if(e&&("object"==$c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Kc()?Reflect.construct(e,n||[],Zc(t).constructor):e.apply(t,n))}function Kc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Kc=function(){return!!t})()}function Zc(t){return Zc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Zc(t)}function Qc(t,e){return Qc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Qc(t,e)}Wc.Frames=[1,0];var Jc=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=Xc(this,e)).events=new k,n.config="string"==typeof t?b({},e.defaultConfig,r,{text:t}):b({},e.defaultConfig,t),n.state=b({},n.config),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Qc(t,e)}(e,t),function(t,e,n){return e&&Yc(t.prototype,e),n&&Yc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"applyTransform",value:function(t){var e=this.chain(),n=new kc(e,kc.ActionTypes.applyTransform,(new At).setContent([t.copy()]));return e.chain(n)}},{key:"applyTransition",value:function(t){var e=this.chain(),n=this._applyTransition(e,t);return e.chain(n)}},{key:"show",value:function(t){var e=this.chain(),n=t instanceof La?t.copy():new La([{props:{opacity:1},options:t||{}}]),r=new kc(e,kc.ActionTypes.show,(new At).setContent([n]));return e.chain(r)}},{key:"hide",value:function(t){var e=this.chain(),n=t instanceof La?t.copy():new La([{props:{opacity:1},options:t||{}}]),r=new kc(e,kc.ActionTypes.hide,(new At).setContent([n]));return e.chain(r)}},{key:"setText",value:function(t){var e=this.chain(),n=new kc(e,kc.ActionTypes.setText,(new At).setContent([t]));return e.chain(n)}},{key:"setFontSize",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0;return this.combineActions(new Ga,(function(o){if(n){var i=new Wc(e.state.fontSize,t,n,r);o.chain(e._applyTransition(o,i))}var a=new kc(o,kc.ActionTypes.setFontSize,(new At).setContent([t]));return o.chain(a)}))}},{key:"toData",value:function(){return{state:b({},Xa.serializeImageState(this.state))}}},{key:"fromData",value:function(t){return this.state=b({},Xa.deserializeImageState(t.state)),this}},{key:"toTransform",value:function(){return new La(this.state,{duration:0})}},{key:"toDisplayableTransform",value:function(){return new La(this.state,{duration:0})}},{key:"_init",value:function(t){return new kc(this.chain(),kc.ActionTypes.init,(new At).setContent([t]))}},{key:"_applyTransition",value:function(t,e){return new kc(t,kc.ActionTypes.applyTransition,(new At).setContent([e]))}}])}(ve);function tl(t){return tl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tl(t)}function el(t){return function(t){if(Array.isArray(t))return nl(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 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)||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 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,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,ol(r.key),r)}}function ol(t){var e=function(t,e){if("object"!=tl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=tl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==tl(e)?e:e+""}function il(t,e,n){return e=ul(e),function(t,e){if(e&&("object"==tl(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,al()?Reflect.construct(e,n||[],ul(t).constructor):e.apply(t,n))}function al(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(al=function(){return!!t})()}function sl(){return sl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=ul(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}},sl.apply(null,arguments)}function ul(t){return ul=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ul(t)}function cl(t,e){return cl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},cl(t,e)}Jc.EventTypes={"event:text.show":"event:text.show","event:text.hide":"event:text.hide","event:displayable.applyTransition":"event:displayable.applyTransition","event:displayable.applyTransform":"event:displayable.applyTransform","event:displayable.init":"event:displayable.init"},Jc.defaultConfig={position:new Te(Te.Positions.Center),scale:1,rotation:0,opacity:0,alignX:"center",alignY:"center",fontSize:16,fontColor:"#000000",display:!1,text:""};var ll=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n},fl=function(t){function r(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.defaultConfig;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),(e=il(this,r)).srcManager=new dc,e.events=new k,e.name=t;var o=b(r.defaultConfig,n),i=o.background,a=ll(o,["background"]);return e.config=Object.assign(Object.assign({},a),{backgroundImage:new Xa({opacity:1}),background:i||null}),e.state=b(e.config,{}),e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&cl(t,e)}(r,t),function(t,e,n){return e&&rl(t.prototype,e),n&&rl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(r,[{key:"toBackground",value:function(t){if(ws.isImageSrc(t)||ws.isImageColor(t))return t;if(t instanceof bs)return t.toImageColor();throw new Error("Invalid background type")}},{key:"activate",value:function(){return this.chain(this._init(this))}},{key:"deactivate",value:function(){return this.chain(this._exit())}},{key:"setBackground",value:function(t,e){var n=this;return this.combineActions(new Ga,(function(r){if(e){var o=e.copy();o.setSrc(n.toBackground(t)),r._transitionToScene(void 0,o,n.toBackground(t))}return r.chain(new ht(r,"scene:setBackground",(new At).setContent([t])))}))}},{key:"applyTransform",value:function(t){return this.chain(new ht(this.chain(),"scene:applyTransform",(new At).setContent([t.copy()])))}},{key:"jumpTo",value:function(t,e){var n=this;return this.combineActions(new Ga,(function(r){var o=e||{};return r.chain(new ht(r,"scene:preUnmount",(new At).setContent([])))._transitionToScene(t,o.transition).chain(t._init()).chain(n._exit())._jumpTo(t)}))}},{key:"sleep",value:function(t){return this.chain(new ht(this.chain(),"scene:sleep",(new At).setContent(t)))}},{key:"setBackgroundMusic",value:function(t,n){return this.chain(new ht(this.chain(),e.setBackgroundMusic,(new At).setContent([t,n])))}},{key:"toData",value:function(){var t;return{state:Object.assign(Object.assign({},_(this.state)),{backgroundMusic:null===(t=this.state.backgroundMusic)||void 0===t?void 0:t.toData(),background:this.state.background}),backgroundImageState:this.state.backgroundImage.toData()}}},{key:"fromData",value:function(t){return this.state=b(this.state,t.state),t.state.backgroundMusic&&(this.state.backgroundMusic=(new Cs).fromData(t.state.backgroundMusic)),t.backgroundImageState&&this.state.backgroundImage.fromData(t.backgroundImageState),this}},{key:"getInitTransform",value:function(){return new La([{props:Object.assign(Object.assign({},this.state.backgroundImage.state),{opacity:1}),options:{duration:0}}])}},{key:"action",value:function(t){var e=(Array.isArray(t)?t.flat(2):t(this).flat(2)).map((function(t){return ae.isChained(t)?t.fromChained(t):t})).flat(2),n=[],o=[];this.getAllChildrenElements(e).forEach((function(t){ae.isChained(t)||(t instanceof Xa?n.push(t):t instanceof Jc&&o.push(t))}));var i=[this._init(this)].concat(el(n.map((function(t){return t._init()}))),el(o.map((function(t){return t._init()}))),el(e)),a=function(t,e,n,r){var o=sl(ul(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(r,"constructNodes",this,3)([i]),s=new At(void 0,void 0,a||void 0).setContent(this);return null==a||a.setParent(s),this.sceneRoot=new ht(this.chain(),"scene:action",s),this}},{key:"registerSrc",value:function(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Set;if(this.sceneRoot){var o=new Set,i=new Set,a=[this.sceneRoot],s=new Set;for(ws.isImageSrc(this.config.background)&&this.srcManager.register(new Xa({src:ws.toBackgroundSrc(this.config.background)}));a.length;){var u=a.shift();if(!o.has(u)){if(o.add(u),u instanceof ht){if(u.type===e.jumpTo){var c=u,l=c.contentNode.getContent()[0];if(i.has(c)||r.has(l))continue;i.add(c),s.add(l),r.add(l)}}else if(u instanceof ss){var f=u;if(this.srcManager.register(f.callee),u.type===n.setSrc){var p=u.contentNode.getContent()[0];this.srcManager.register(new Xa({src:p}))}}else if(u instanceof et)this.srcManager.register(u.callee);else if(u instanceof Yt){var d=u.getFutureActions();a.push.apply(a,el(d))}a.push.apply(a,el(u.getFutureActions()))}}s.forEach((function(e){e.registerSrc(r),t.srcManager.registerFuture(e.srcManager)}))}}},{key:"assignActionId",value:function(){this.getAllChildren(this.sceneRoot||[]).forEach((function(t,e){t.setId("action-".concat(e))}))}},{key:"assignElementId",value:function(){this.getAllChildrenElements(this.sceneRoot||[]).forEach((function(t,e){t.setId("element-".concat(e))}))}},{key:"reset",value:function(){this.state=b(r.defaultState,this.config),this.state.backgroundImage.reset()}},{key:"toDisplayableTransform",value:function(){return this.state.backgroundImage.toDisplayableTransform()}},{key:"_applyTransition",value:function(t){return this.chain(new ht(this.chain(),"scene:applyTransition",(new At).setContent([t])))}},{key:"_jumpTo",value:function(t){return this.chain(new ht(this.chain(),"scene:jumpTo",(new At).setContent([t])))}},{key:"_exit",value:function(){return new ht(this.chain(),"scene:exit",(new At).setContent([]))}},{key:"_transitionToScene",value:function(t,e,n){var r=this.chain();if(e){var o=e.copy();t&&t.config.background&&o.setSrc(t.config.background),n&&o.setSrc(n),r._applyTransition(o)}return r}},{key:"_init",value:function(){return new ht((arguments.length>0&&void 0!==arguments[0]?arguments[0]:this).chain(),"scene:init",(new At).setContent([]))}}])}(cc);function pl(t){return pl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pl(t)}function dl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,hl(r.key),r)}}function hl(t){var e=function(t,e){if("object"!=pl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=pl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==pl(e)?e:e+""}function yl(t,e,n){return e=gl(e),function(t,e){if(e&&("object"==pl(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,vl()?Reflect.construct(e,n||[],gl(t).constructor):e.apply(t,n))}function vl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(vl=function(){return!!t})()}function ml(){return ml="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=gl(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}},ml.apply(null,arguments)}function gl(t){return gl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},gl(t)}function bl(t,e){return bl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},bl(t,e)}fl.EventTypes={"event:scene.remove":"event:scene.remove","event:scene.load":"event:scene.load","event:scene.unload":"event:scene.unload","event:scene.mount":"event:scene.mount","event:scene.unmount":"event:scene.unmount","event:scene.preUnmount":"event:scene.preUnmount","event:scene.imageLoaded":"event:scene.imageLoaded","event:scene.setBackgroundMusic":"event:scene.setBackgroundMusic","event:displayable.applyTransition":"event:displayable.applyTransition","event:displayable.applyTransform":"event:displayable.applyTransform","event:displayable.init":"event:displayable.init"},fl.defaultConfig={invertY:!1,invertX:!1,backgroundMusic:null,backgroundMusicFade:0},fl.defaultState={};var wl=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),yl(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&&bl(t,e)}(e,t),function(t,e,n){return e&&dl(t.prototype,e),n&&dl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){return this.contentNode.getContent().execute({gameState:t}),function(t,e,n,r){var o=ml(gl(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"executeAction",this,3)([t])}}])}(z);function _l(t){return _l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_l(t)}function Sl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,kl(r.key),r)}}function kl(t){var e=function(t,e){if("object"!=_l(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=_l(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==_l(e)?e:e+""}function xl(t,e,n){return e=El(e),Al(t,Ol()?Reflect.construct(e,n||[],El(t).constructor):e.apply(t,n))}function Al(t,e){if(e&&("object"==_l(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Ol(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ol=function(){return!!t})()}function El(t){return El=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},El(t)}function Tl(t,e){return Tl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Tl(t,e)}wl.ActionTypes={action:"script:action"};var jl=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=xl(this,e)).handler=t,Al(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&&Tl(t,e)}(e,t),function(t,e,n){return e&&Sl(t.prototype,e),n&&Sl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"execute",value:function(t){var n=t.gameState;this.handler(e.getCtx({gameState:n}))}},{key:"fromChained",value:function(t){return[new wl(this.chain(),wl.ActionTypes.action,(new At).setContent(t))]}}],[{key:"getCtx",value:function(t){var e=t.gameState;return{gameState:e,game:e.game,liveGame:e.game.getLiveGame(),storable:e.game.getLiveGame().getStorable()}}}])}(ve);function Pl(t){return Pl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pl(t)}function Cl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Il(r.key),r)}}function Il(t){var e=function(t,e){if("object"!=Pl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Pl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Pl(e)?e:e+""}function Ll(t,e,n){return e=Rl(e),function(t,e){if(e&&("object"==Pl(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Nl()?Reflect.construct(e,n||[],Rl(t).constructor):e.apply(t,n))}function Nl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Nl=function(){return!!t})()}function Rl(t){return Rl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Rl(t)}function Ml(t,e){return Ml=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ml(t,e)}var Fl=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=Ll(this,e)).entryScene=null,n.name=t,n.config=b(e.defaultConfig,r),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ml(t,e)}(e,t),function(t,e,n){return e&&Cl(t.prototype,e),n&&Cl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"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 ks(t).run()}}])}(cc);function Dl(t){return Dl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dl(t)}function Bl(t,e){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}function Gl(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ul(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Hl(r.key),r)}}function zl(t,e,n){return e&&Ul(t.prototype,e),n&&Ul(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Hl(t){var e=function(t,e){if("object"!=Dl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Dl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Dl(e)?e:e+""}Fl.defaultConfig={};var Wl=function(){function t(e,n,r){Gl(this,t),this.name=e,this.key=r||e,this.content=b({},n)}return zl(t,[{key:"set",value:function(e,n){return t.isSerializable(n)?(this.content[e]=n,this):(console.warn('Value "'.concat(n,'" in key "').concat(String(e),'" is not serializable, and will not be set\nat namespace "').concat(this.name,'"')),this.content[e]=n,this)}},{key:"get",value:function(t){return this.content[t]}},{key:"toData",value:function(){return this.serialize()}},{key:"load",value:function(t){t?this.content=t:console.warn("No data to load")}},{key:"serialize",value:function(){var t=this,e={};return Object.entries(this.content).forEach((function(n){var r=Bl(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=Bl(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(Dl(e))||(e instanceof Date||(null==e||(Array.isArray(e)?e.every(t.isSerializable):"object"===Dl(e)&&(Object.getPrototypeOf(e)===Object.prototype&&Object.values(e).every(t.isSerializable)))))}}])}(),$l=function(){return zl((function t(){Gl(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=Bl(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=Bl(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}}])}(),Yl=o(196);function ql(t){return ql="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},ql(t)}function Xl(t){return function(t){if(Array.isArray(t))return Ql(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Zl(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 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 P(r||[]);return o(a,"_invoke",{value:O(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",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"==ql(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,n,r){var o=p;return function(i,a){if(o===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 T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(ql(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),j(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;j(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function Zl(t,e){if(t){if("string"==typeof t)return Ql(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ql(t,e):void 0}}function Ql(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Jl(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"!=ql(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ql(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ql(e)?e:e+""}var ef=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())}))},nf=function(){return function(t,e,n){return e&&Jl(t.prototype,e),n&&Jl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state={sounds:[],srcManagers:[],elements:[]},this.currentHandling=null,this.stage=n,this.game=e,this.events=new k,this.logger=new E(e,"NarraLeaf-React")}),[{key:"findElementByScene",value:function(t){return this.state.elements.find((function(e){return e.scene===t}))||null}},{key:"findElementByImage",value:function(t){return this.state.elements.find((function(e){return e.ele.images.includes(t)}))||null}},{key:"findElementByDisplayable",value:function(t){return this.state.elements.find((function(e){return e.ele.displayable.includes(t)}))||null}},{key:"addScene",value:function(t){return this.sceneExists(t)||this.state.elements.push({scene:t,ele:this.getElementMap()}),this}},{key:"popScene",value:function(){var t=this.state.elements.pop();return t?(this.removeElements(t.scene),this):this}},{key:"removeScene",value:function(t){return this.removeElements(t),this}},{key:"getSceneElements",value:function(){return this.state.elements}},{key:"getLastScene",value:function(){var t;return(null===(t=this.state.elements[this.state.elements.length-1])||void 0===t?void 0:t.scene)||null}},{key:"sceneExists",value:function(t){return t?this.state.elements.some((function(e){return e.scene===t})):!!this.getLastScene()}},{key:"isSceneActive",value:function(t){var e,n=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Zl(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}(this.state.elements);try{for(n.s();!(e=n.n()).done;){if(e.value.scene===t)return!0}}catch(t){n.e(t)}finally{n.f()}return!1}},{key:"handle",value:function(t){return this.currentHandling===t||(this.currentHandling=t,t.type),this}},{key:"createText",value:function(t,e,n,r){var o,i=null===(o=this.findElementByScene(this._getLastSceneIfNot(r)))||void 0===o?void 0:o.ele.texts;if(!i)throw new Error("Scene not found");var a=this.createWaitableAction({character:e.config.character,sentence:e,id:t},(function(){i.splice(i.indexOf(a),1),n&&n()}));i.push(a)}},{key:"createMenu",value:function(t,e,n){var r;if(!t.choices.length)throw new Error("Menu must have at least one choice");var o=null===(r=this.findElementByScene(this._getLastSceneIfNot(n)))||void 0===r?void 0:r.ele.menus;if(!o)throw new Error("Scene not found");var i=this.createWaitableAction(t,(function(t){o.splice(o.indexOf(i),1),e&&e(t)}));o.push(i)}},{key:"createImage",value:function(t,e){var n=this._getLastSceneIfNot(e),r=this.findElementByScene(n);return r?(r.ele.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:"createDisplayable",value:function(t,e){var n=this._getLastSceneIfNot(e),r=this.findElementByScene(n);return r?(r.ele.displayable.push(t),this):this}},{key:"disposeDisplayable",value:function(t,e){var n,r=this._getLastSceneIfNot(e),o=null===(n=this.findElementByScene(r))||void 0===n?void 0:n.ele.displayable;if(!o)throw new Error("Scene not found");var i=o.indexOf(t);if(-1===i)throw new Error("Displayables not found");return o.splice(i,1),this}},{key:"forceReset",value:function(){var t=this;this.state.sounds.forEach((function(t){var e;return null===(e=t.getPlaying())||void 0===e?void 0:e.stop()})),this.state.elements.forEach((function(e){var n=e.scene;t.offSrcManager(n.srcManager),t.removeScene(n),n.events.clear()})),this.state.elements=[],this.state.srcManagers=[]}},{key:"initSound",value:function(t,e){return t.getPlaying()||t.setPlaying(new(this.getHowl())(t.getHowlOptions(e))),t}},{key:"playSound",value:function(t,e,n){this.initSound(t,n);var r=t.getPlaying().play(),o=[t.getPlaying().once("end",i.bind(this)),t.getPlaying().once("stop",i.bind(this))];function i(){e&&e(),o.forEach((function(t){return t.off()})),this.state.sounds=this.state.sounds.filter((function(e){return e!==t})),this.stage.next()}return this.state.sounds.push(t),t.state.token=r,r}},{key:"stopSound",value:function(t){var e,n;return(null===(e=t.state.playing)||void 0===e?void 0:e.playing(t.getToken()))&&(null===(n=t.state.playing)||void 0===n||n.stop(t.getToken())),t.setPlaying(null).setToken(null),t}},{key:"transitionSound",value:function(t,e,n){return ef(this,void 0,void 0,Kl().mark((function r(){var o;return Kl().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!t){r.next=5;break}if(!n){r.next=4;break}return r.next=4,this.fadeSound(t,0,n);case 4:this.stopSound(t);case 5:if(!e){r.next=12;break}if(o=e.config.volume,this.playSound(e,void 0,{volume:0}),!n){r.next=11;break}return r.next=11,this.fadeSound(e,o,n);case 11:e.getPlaying().volume(o,e.getToken());case 12:case"end":return r.stop()}}),r,this)})))}},{key:"fadeSound",value:function(t,e,n){var r,o;return ef(this,void 0,void 0,Kl().mark((function i(){var a;return Kl().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return a=null===(r=t.getPlaying())||void 0===r?void 0:r.volume(t.getToken()),null===(o=t.getPlaying())||void 0===o||o.fade(a,e,n,t.getToken()),i.next=4,A(n);case 4:return i.abrupt("return",void 0);case 5:case"end":return i.stop()}}),i)})))}},{key:"getHowl",value:function(){return Yl.Howl}},{key:"animateImage",value:function(t,e,n,r){return this.anyEvent.apply(this,[t,e,r].concat(Xl(n)))}},{key:"animateText",value:function(t,e,n,r){return this.anyEvent.apply(this,[t,e,r].concat(Xl(n)))}},{key:"registerSrcManager",value:function(t){return this.state.srcManagers.push(t),this}},{key:"offSrcManager",value:function(t){return this.state.srcManagers=this.state.srcManagers.filter((function(e){return e!==t})),this}},{key:"getStorable",value:function(){return this.game.getLiveGame().getStorable()}},{key:"dispose",value:function(){this.forceReset()}},{key:"toData",value:function(){return{scenes:this.state.elements.map((function(t){return{sceneId:t.scene.getId(),elements:{images:t.ele.images.map((function(t){return t.getId()}))}}}))}}},{key:"loadData",value:function(t,e){var n=this;if(this.state.elements=[],!this.game.getLiveGame().story)throw new Error("No story loaded");t.scenes.forEach((function(t){var r=t.sceneId,o=t.elements;n.logger.debug("Loading scene: "+r);var i=e.get(r);if(!i)throw new Error("Scene not found, id: "+r+"\nNarraLeaf cannot find the element with the id from the saved game");var a={scene:i,ele:{images:o.images.map((function(t){if(!e.has(t))throw new Error("Image not found, id: "+t+"\nNarraLeaf cannot find the element with the id from the saved game");return e.get(t)})),menus:[],texts:[],displayable:[]}};n.state.elements.push(a),n.registerSrcManager(i.srcManager),ht.registerEventListeners(i,n)}))}},{key:"initScenes",value:function(){var t=this;this.state.elements.forEach((function(e){var n=e.scene;ht.registerEventListeners(n,t)}))}},{key:"getElementMap",value:function(){return{texts:[],menus:[],images:[],displayable:[]}}},{key:"removeElements",value:function(t){var e=this.state.elements.findIndex((function(e){return e.scene===t}));return-1===e||this.state.elements.splice(e,1),this}},{key:"_getLastSceneIfNot",value:function(t){var e=t||this.getLastScene();if(!e||!this.sceneExists(e))throw new Error('Scene not found, please call "scene.activate()" first.');return e}},{key:"anyEvent",value:function(t,e,n){for(var r,o=this,i=arguments.length,a=new Array(i>3?i-3:0),s=3;s<i;s++)a[s-3]=arguments[s];(r=e.events).any.apply(r,[t].concat(a)).then(n).then((function(){o.stage.next()}))}},{key:"createWaitableAction",value:function(t,e){return{action:t,onClick:function(t){e&&e(t)}}}}])}();function rf(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=rf(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}nf.EventTypes={"event:state.ready":"event:state.ready","event:state.end":"event:state.end","event:state.player.skip":"event:state.player.skip","event:state.preload.unmount":"event:state.preload.unmount","event:state.preload.loaded":"event:state.preload.loaded","event:state.player.flush":"event:state.player.flush"};const of=function(){for(var t,e,n=0,r="",o=arguments.length;n<o;n++)(t=arguments[n])&&(e=rf(t))&&(r&&(r+=" "),r+=e);return r};var af=o(12),sf=o.n(af);function uf(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 cf(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)?cf(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 cf(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 lf=sf().createContext(null);function ff(t){var e=t.children,n=t.game,r=new Fp({}),o=uf((0,af.useState)(n||r),2),i=o[0],a=o[1];return sf().createElement(lf.Provider,{value:{game:i,setGame:a}},e)}function pf(){var t=(0,af.useContext)(lf);if(!t)throw new Error("useGame must be used within a GameProvider");return t}function df(t){if("undefined"==typeof Proxy)return t;const e=new Map;return new Proxy(((...e)=>t(...e)),{get:(n,r)=>"create"===r?t:(e.has(r)||e.set(r,t(r)),e.get(r))})}var hf=o(387);const yf=(0,af.createContext)({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),vf=(0,af.createContext)({}),mf=(0,af.createContext)(null),gf=Di?af.useLayoutEffect:af.useEffect,bf=(0,af.createContext)({strict:!1}),{schedule:wf,cancel:_f}=Gn(queueMicrotask,!1);function Sf(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}const kf=(0,af.createContext)({});function xf(t,e,n,r,o){var i,a;const{visualElement:s}=(0,af.useContext)(vf),u=(0,af.useContext)(bf),c=(0,af.useContext)(mf),l=(0,af.useContext)(yf).reducedMotion,f=(0,af.useRef)();r=r||u.renderer,!f.current&&r&&(f.current=r(t,{visualState:e,parent:s,props:n,presenceContext:c,blockInitialAnimation:!!c&&!1===c.initial,reducedMotionConfig:l}));const p=f.current,d=(0,af.useContext)(kf);!p||p.projection||!o||"html"!==p.type&&"svg"!==p.type||function(t,e,n,r){const{layoutId:o,layout:i,drag:a,dragConstraints:s,layoutScroll:u,layoutRoot:c}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Af(t.parent)),t.projection.setOptions({layoutId:o,layout:i,alwaysMeasureLayout:Boolean(a)||s&&Sf(s),visualElement:t,animationType:"string"==typeof i?i:"both",initialPromotionConfig:r,layoutScroll:u,layoutRoot:c})}(f.current,n,o,d),(0,af.useInsertionEffect)((()=>{p&&p.update(n,c)}));const h=n[ji],y=(0,af.useRef)(Boolean(h)&&!(null===(i=window.MotionHandoffIsComplete)||void 0===i?void 0:i.call(window,h))&&(null===(a=window.MotionHasOptimisedAnimation)||void 0===a?void 0:a.call(window,h)));return gf((()=>{p&&(window.MotionIsMounted=!0,p.updateFeatures(),wf.render(p.render),y.current&&p.animationState&&p.animationState.animateChanges())})),(0,af.useEffect)((()=>{p&&(!y.current&&p.animationState&&p.animationState.animateChanges(),y.current&&(queueMicrotask((()=>{var t;null===(t=window.MotionHandoffMarkAsComplete)||void 0===t||t.call(window,h)})),y.current=!1))})),p}function Af(t){if(t)return!1!==t.options.allowProjection?t.projection:Af(t.parent)}function Of(t,e,n){return(0,af.useCallback)((r=>{r&&t.mount&&t.mount(r),e&&(r?e.mount(r):e.unmount()),n&&("function"==typeof n?n(r):Sf(n)&&(n.current=r))}),[e])}function Ef(t){const{initial:e,animate:n}=function(t,e){if(Wi(t)){const{initial:e,animate:n}=t;return{initial:!1===e||Ui(e)?e:void 0,animate:Ui(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,(0,af.useContext)(vf));return(0,af.useMemo)((()=>({initial:e,animate:n})),[Tf(e),Tf(n)])}function Tf(t){return Array.isArray(t)?t.join(" "):t}function jf(t){for(const e in t)qi[e]={...qi[e],...t[e]}}const Pf=(0,af.createContext)({}),Cf=Symbol.for("motionComponentSymbol");function If({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:r,Component:o}){t&&jf(t);const i=(0,af.forwardRef)((function(t,i){let a;const s={...(0,af.useContext)(yf),...t,layoutId:Lf(t)},{isStatic:u}=s,c=Ef(t),l=r(t,u);if(!u&&Di){!function(){(0,af.useContext)(bf).strict;0}();const t=function(t){const{drag:e,layout:n}=qi;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:(null==e?void 0:e.isEnabled(t))||(null==n?void 0:n.isEnabled(t))?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}(s);a=t.MeasureLayout,c.visualElement=xf(o,l,s,e,t.ProjectionNode)}return(0,hf.jsxs)(vf.Provider,{value:c,children:[a&&c.visualElement?(0,hf.jsx)(a,{visualElement:c.visualElement,...s}):null,n(o,t,Of(l,c.visualElement,i),l,u,c.visualElement)]})}));return i[Cf]=o,i}function Lf({layoutId:t}){const e=(0,af.useContext)(Pf).id;return e&&void 0!==t?e+"-"+t:t}const Nf=["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 Rf(t){return"string"==typeof t&&!t.includes("-")&&!!(Nf.indexOf(t)>-1||/[A-Z]/u.test(t))}function Mf(t){const e=cn(t)?t.get():t;return gi(e)?e.toValue():e}function Ff(t){return jn.has(t)?"transform":ni.has(t)?Ti(t):void 0}const Df=t=>(e,n)=>{const r=(0,af.useContext)(vf),o=(0,af.useContext)(mf),i=()=>function({applyWillChange:t=!1,scrapeMotionValuesFromProps:e,createRenderState:n,onMount:r},o,i,a,s){const u={latestValues:Vf(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,af.useRef)(null);return null===e.current&&(e.current=t()),e.current}(i)};function Bf(t,e,n){const r=Array.isArray(e)?e:[e];for(let e=0;e<r.length;e++){const o=Ai(t,r[e]);if(o){const{transitionEnd:t,transition:e,...r}=o;n(r,t)}}}function Vf(t,e,n,r,o){var i;const a={},s=new Set,u=r&&void 0===(null===(i=t.style)||void 0===i?void 0:i.willChange),c=o(t,{});for(const t in c)a[t]=Mf(c[t]);let{initial:l,animate:f}=t;const p=Wi(t),d=$i(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&&!Gi(y)&&Bf(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&&!Gi(f)&&Bf(t,f,(t=>{for(const e in t){const t=Ff(e);t&&s.add(t)}})),s.size&&(a.willChange=Array.from(s).join(","))),a}const Gf=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Uf=()=>({...Gf(),attrs:{}}),zf={useVisualState:Df({scrapeMotionValuesFromProps:Fi,createRenderState:Uf,onMount:(t,e,{renderState:n,latestValues:r})=>{Un.read((()=>{try{n.dimensions="function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch(t){n.dimensions={x:0,y:0,width:0,height:0}}})),Un.render((()=>{sa(n,r,fa(e.tagName),t.transformTemplate),la(e,n)}))}})},Hf={useVisualState:Df({applyWillChange:!0,scrapeMotionValuesFromProps:Mi,createRenderState:Gf})};function Wf(t,e,n){for(const r in e)cn(e[r])||Ri(r,n)||(t[r]=e[r])}function $f(t,e){const n={};return Wf(n,t.style||{},t),Object.assign(n,function({transformTemplate:t},e){return(0,af.useMemo)((()=>{const n=Gf();return ra(n,e,t),Object.assign({},n.vars,n.style)}),[e])}(t,e)),n}function Yf(t,e){const n={},r=$f(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 qf=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 Xf(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||qf.has(t)}let Kf=t=>!Xf(t);try{(Zf=require("@emotion/is-prop-valid").default)&&(Kf=t=>t.startsWith("on")?!Xf(t):Zf(t))}catch(Wt){}var Zf;function Qf(t,e,n,r){const o=(0,af.useMemo)((()=>{const n=Uf();return sa(n,e,fa(r),t.transformTemplate),{...n.attrs,style:{...n.style}}}),[e]);if(t.style){const e={};Wf(e,t.style,t),o.style={...e,...o.style}}return o}function Jf(t=!1){return(e,n,r,{latestValues:o},i)=>{const a=(Rf(e)?Qf:Yf)(n,o,i,e),s=function(t,e,n){const r={};for(const o in t)"values"===o&&"object"==typeof t.values||(Kf(o)||!0===n&&Xf(o)||!e&&!Xf(o)||t.draggable&&o.startsWith("onDrag"))&&(r[o]=t[o]);return r}(n,"string"==typeof e,t),u=e!==af.Fragment?{...s,...a,ref:r}:{},{children:c}=n,l=(0,af.useMemo)((()=>cn(c)?c.get():c),[c]);return(0,af.createElement)(e,{...u,children:l})}}function tp(t,e){return function(n,{forwardMotionProps:r}={forwardMotionProps:!1}){return If({...Rf(n)?zf:Hf,preloadedFeatures:t,useRender:Jf(r),createVisualElement:e,Component:n})}}const ep=df(tp());function np(){return np=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},np.apply(null,arguments)}function rp(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 op(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?op(t,e):void 0}}(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 op(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var ip=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n};function ap(t){var e=t.children,n=t.border,r=void 0===n?"solid":n,o=t.color,i=void 0===o?"red":o,a=t.tag,s=t.borderWidth,u=void 0===s?1:s,c=t.as,l=void 0===c?"div":c,f=t.Ref,p=ip(t,["children","border","color","tag","borderWidth","as","Ref"]),d=pf().game,h=rp((0,af.useState)(!1),2),y=h[0],v=h[1];if(!d.config.app.inspector)return sf().createElement(l,np({},p,{ref:f}),e);var m=Object.assign(Object.assign({},p),{onMouseEnter:function(){return v(!0)},onMouseLeave:function(){return v(!1)},style:Object.assign(Object.assign({},p.style||{}),{border:"".concat(r," ").concat(u,"px ").concat(i),zIndex:y?1e3:"auto"})});return sf().createElement(l,np({},m,{ref:f}),a&&y&&sf().createElement("span",{className:"absolute top-0 left-0 bg-white text-black border-2 border-black text-sm"},a),e)}function sp(t){var e=t.border,n=void 0===e?"solid":e,r=t.color,o=void 0===r?"red":r,i=t.tag,a=t.borderWidth,s=void 0===a?1:a,u=t.as,c=void 0===u?"img":u,l=ip(t,["border","color","tag","borderWidth","as"]),f=pf().game,p=rp((0,af.useState)(!1),2),d=p[0],h=p[1];if(!f.config.app.inspector)return sf().createElement(c,l);var y=Object.assign(Object.assign({},l),{onMouseEnter:function(){return h(!0)},onMouseLeave:function(){return h(!1)},style:Object.assign(Object.assign({},l.style||{}),{border:"".concat(n," ").concat(s,"px ").concat(o),zIndex:d?1e3:"auto"})});return sf().createElement("div",null,sf().createElement(c,y),i&&d&&sf().createElement("span",{className:"absolute top-0 left-0 bg-white text-black border-2 border-black"},i))}const up={Div:function(t){return sf().createElement(ap,np({},t,{as:"div"}))},Span:function(t){return sf().createElement(ap,np({},t,{as:"span"}))},Button:function(t){return sf().createElement(ap,np({},t,{as:"button"}))},Img:function(t){return sf().createElement(sp,np({},t,{as:"img"}))},mDiv:function(t){return sf().createElement(ap,np({},t,{as:ep.div,Ref:t.Ref}))}};function cp(t){return cp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cp(t)}function lp(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */lp=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new P(r||[]);return o(a,"_invoke",{value:O(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",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"==cp(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,n,r){var o=p;return function(i,a){if(o===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 T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(cp(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),j(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;j(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function fp(t){return function(t){if(Array.isArray(t))return hp(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||dp(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 pp(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)||dp(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 dp(t,e){if(t){if("string"==typeof t)return hp(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)?hp(t,e):void 0}}function hp(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 yp(t){var e=lp().mark(R),n=t.sentence,r=t.gameState,o=t.useTypeEffect,i=void 0===o||o,a=t.onCompleted,s=t.finished,u=t.count,c=t.className,l=pp((0,af.useState)(!1),2),f=l[0],p=l[1],d=(0,af.useMemo)((function(){return n.evaluate(jl.getCtx({gameState:r}))}),[]),h=r.game,y=pp((0,af.useState)([]),2),v=y[0],m=y[1],g=(0,af.useRef)(R(d)),b=(0,af.useRef)(null),w=(0,af.useRef)(null),_=pp((0,af.useState)(0),2),k=_[0],x=_[1],A=pp((0,af.useReducer)((function(t){return t+1}),0),2)[1],O=pp((0,af.useState)(new Set),2),E=O[0],T=O[1],j=pp((0,af.useState)(!1),2),P=j[0],C=j[1];function I(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];w.current&&(clearTimeout(w.current),w.current=null);for(var e=!1;!e;){var n=g.current.next(),o=n.done,i=n.value;if(o)p(!0),a&&(r.logger.info("Say","Completed",o,i),a()),e=!0;else if(Rs.isPause(i)){if(t)continue;N(Rs.from(i)),e=!0}else L(i)}}function L(t){m((function(e){if("\n"!==t&&E.has(t))return e;T((function(e){return new Set(e).add(t)}));var n=e[e.length-1];return n&&"\n"!==n&&"\n"!==t&&n.tag===t.tag?[].concat(fp(e.slice(0,-1)),[{text:n.text+t.text,config:t.config,tag:t.tag,tag2:t.tag2}]):[].concat(fp(e),[t])}))}function N(t){r.logger.info("Say","Paused",t),t.config.duration?b.current=setTimeout((function(){b.current=null,x((function(t){return t+1}))}),t.config.duration):C(!0)}function R(t){var n,r,o,i,a;return lp().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=fp(t),r=0;case 2:if(!(r<n.length)){e.next=24;break}if(o=n[r],!Rs.isPause(o.text)){e.next=8;break}return e.next=7,Rs.from(o.text);case 7:return e.abrupt("continue",21);case 8:i=0;case 9:if(!(i<o.text.length)){e.next=21;break}if("\n"!==(a=o.text[i])){e.next=16;break}return e.next=14,"\n";case 14:e.next=18;break;case 16:return e.next=18,{text:a,config:o.config,tag:r,tag2:i};case 18:i++,e.next=9;break;case 21:r++,e.next=2;break;case 24:return e.abrupt("return");case 25:case"end":return e.stop()}}),e)}return(0,af.useEffect)((function(){if(i||I(!0),s&&!f)return b.current&&clearTimeout(b.current),b.current=null,I(!0),void(a&&(r.logger.info("Say","Completed",b.current,s,f),a()));if(f||s||P||b.current)r.logger.debug("Sentence.tsx","locked",f,s,P);else{var t=g.current.next(),e=t.done,n=t.value;if(e)return p(!0),void(a&&(r.logger.info("Say","Completed",e,n),a()));Rs.isPause(n)?N(Rs.from(n)):(L(n),A(),w.current=setTimeout((function(){x((function(t){return t+1}))}),h.config.elements.say.textInterval))}}),[k,s,P]),(0,af.useEffect)((function(){if(u&&!b.current){if(P)return C(!1),void x((function(t){return t+1}));I(),x((function(t){return t+1}))}}),[u]),sf().createElement("div",{className:of("whitespace-pre-wrap",h.config.elementStyles.say.textContainerClassName,{"font-bold":n.config.bold,italic:n.config.italic},c),style:{fontFamily:n.config.fontFamily||h.config.elementStyles.say.fontFamily,fontSize:n.config.fontSize||h.config.elementStyles.say.fontSize}},v.map((function(t,e){return"\n"===t?sf().createElement("br",{key:e}):sf().createElement(up.Span,{tag:"say.word.".concat(e),key:e,style:Object.assign({color:S(t.config.color||n.config.color||Bs.defaultColor),fontFamily:t.config.fontFamily,fontSize:t.config.fontSize},h.config.app.debug?{border:"1px dashed red"}:{}),className:of(h.config.elementStyles.say.textSpanClassName,"whitespace-pre inline-block",{"font-bold":t.config.bold,italic:t.config.italic},t.config.className)},t.config.ruby?sf().createElement("ruby",{className:"align-bottom inline-block"},sf().createElement("rt",{className:"block text-center"},t.config.ruby),t.text):t.text)})))}function vp(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 mp(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)?mp(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 mp(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 gp(t){return gp="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},gp(t)}function bp(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,wp(r.key),r)}}function wp(t){var e=function(t,e){if("object"!=gp(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=gp(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==gp(e)?e:e+""}var _p=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state={width:0,height:0,minWidth:800,minHeight:450,paused:!1,scale:0},this.events=new k,this.lockers=[],this.updater=null}return function(t,e,n){return e&&bp(t.prototype,e),n&&bp(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"update",value:function(e,n,r){this.state.width=e,this.state.height=n,this.state.scale=r,this.events.emit(t.EventTypes["event:aspectRatio.update"],e,n)}},{key:"updateMin",value:function(t,e){this.state.minWidth=t,this.state.minHeight=e}},{key:"lock",value:function(){var t=Symbol();return this.lockers.push(t),t}},{key:"unlock",value:function(t){if(t&&!this.lockers.includes(t))throw new Error("Locker not found");return this.lockers=this.lockers.filter((function(e){return e!==t})),this.triggerUpdate(),null}},{key:"isLocked",value:function(){return!!this.lockers.length}},{key:"getStyle",value:function(){return{width:"".concat(this.state.width,"px"),height:"".concat(this.state.height,"px")}}},{key:"setUpdate",value:function(t){this.updater=t}},{key:"pause",value:function(){this.state.paused=!0,this.events.emit(t.EventTypes["event:aspectRatio.pause"])}},{key:"resume",value:function(){this.state.paused=!1,this.events.emit(t.EventTypes["event:aspectRatio.resume"])}},{key:"onUpdate",value:function(e){var n=this;return this.events.on(t.EventTypes["event:aspectRatio.update"],e),function(){n.events.off(t.EventTypes["event:aspectRatio.update"],e)}}},{key:"triggerUpdate",value:function(){this.updater&&this.updater()}}])}();_p.EventTypes={"event:aspectRatio.update":"event:aspectRatio.update","event:aspectRatio.pause":"event:aspectRatio.pause","event:aspectRatio.resume":"event:aspectRatio.resume"};var Sp=(0,af.createContext)(null);function kp(t){var e=t.children,n=vp((0,af.useState)((function(){return new _p})),1)[0];return sf().createElement(Sp.Provider,{value:{ratio:n}},e)}function xp(){var t=(0,af.useContext)(Sp);if(!Sp||!t)throw new Error("useRatio must be used within a RatioProvider");var e=vp((0,af.useReducer)((function(t){return t+1}),0),2)[1],n=t.ratio;return(0,af.useEffect)((function(){return n.onUpdate((function(){e()}))}),[]),t}function Ap(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Op(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Op(t,e):void 0}}(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 Op(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ep(t){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=Ap((0,af.useState)(!1),2),l=c[0],f=c[1],p=s.game,d=Ap((0,af.useState)(0),2),h=d[0],y=d[1],v=xp().ratio;return(0,af.useEffect)((function(){if(window){var t=function(t){p.config.elements.say.nextKey.includes(t.key)&&(l?r&&r():y((function(t){return t+1})))};return window.addEventListener("keyup",t),function(){window.removeEventListener("keyup",t)}}console.warn("Failed to add event listener, window is not available\nat Say.tsx: onElementClick")}),[l]),(0,af.useEffect)((function(){var t=s.events.onEvents([{type:nf.EventTypes["event:state.player.skip"],listener:s.events.on(nf.EventTypes["event:state.player.skip"],(function(){s.logger.log("NarraLeaf-React: Say","Skipped"),l?r&&r():f(!0)}))}]);return function(){t.cancel()}})),sf().createElement("div",null,u.state.display&&sf().createElement(up.Div,{tag:"say.aspectScaleContainer",color:"blue",border:"dashed",className:of("absolute bottom-0 w-[calc(100%-40px)]",a),onClick:function(){l?r&&r():y((function(t){return t+1}))},style:Object.assign({},C(p.config.elements.say.useAspectScale,{width:p.config.elements.text.width,height:p.config.elements.text.height}))},sf().createElement(up.Div,{tag:"say.containerClassName",className:of(p.config.elementStyles.say.containerClassName),style:Object.assign({},C(p.config.elements.say.useAspectScale,{transform:"scale(".concat(v.state.scale,")"),transformOrigin:"bottom left",width:"100%",height:"100%"}))},sf().createElement("div",{className:of("bg-white flex flex-col items-start justify-between",p.config.elementStyles.say.contentContainerClassName,"w-full h-full")},sf().createElement(up.Div,{tag:"say.nameTextClassName",className:of("rounded-br-md text-black",p.config.elementStyles.say.nameTextClassName)},null===(e=u.config.character)||void 0===e?void 0:e.state.name),sf().createElement(yp,{sentence:u,gameState:s,finished:l,useTypeEffect:i,onCompleted:function(){f(!0)},count:h}),sf().createElement("div",null)))))}function Tp(){return Tp=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},Tp.apply(null,arguments)}function jp(t){var e=t.children,n=t.className,r=t.props,o=t.ref,i=xp().ratio,a=i.getStyle();return sf().createElement("div",{className:of("inset-0 flex items-center justify-center",n),style:{width:"100%",height:"100%",minWidth:"".concat(i.state.minWidth,"px"),minHeight:"".concat(i.state.minHeight,"px")}},sf().createElement("div",Tp({style:Object.assign(Object.assign({},a),{position:"relative",overflow:"hidden"})},r||{},{ref:o}),e))}var Pp,Cp={say:Ep,menu:function(t){var e=t.prompt,n=t.choices,r=t.afterChoose,o=t.state,i=pf().game,a=xp().ratio,s=i.config.elements.say.use;return sf().createElement(sf().Fragment,null,sf().createElement(jp,{className:"absolute"},e&&sf().createElement(s,{state:o,action:{sentence:e,character:null},useTypeEffect:!1,className:"z-10"})),sf().createElement(up.Div,{color:"green",border:"dashed",className:of("absolute"),style:{width:"".concat(i.config.player.width,"px"),height:"".concat(i.config.player.height,"px")}},sf().createElement(up.Div,{tag:"menu.aspectScaleContainer",style:{transform:"scale(".concat(a.state.scale,")"),transformOrigin:"left top"},className:of("w-full h-full")},sf().createElement(up.Div,{tag:"menu.containerClassName",className:of("absolute flex flex-col items-center justify-center min-w-full w-full h-full",i.config.elementStyles.menu.containerClassName)},sf().createElement("div",{className:"p-4 rounded-lg w-full z-20"},sf().createElement("div",{className:"flex flex-col items-center mt-4 w-full"},n.map((function(t,e){return sf().createElement(up.Button,{tag:"menu.choiceButtonClassName."+e,key:e,className:of("bg-white text-black p-2 mt-2 w-1/2",i.config.elementStyles.menu.choiceButtonClassName),onClick:function(){return function(t){r(t)}(t)}},sf().createElement(yp,{sentence:t.prompt,gameState:o,useTypeEffect:!1,className:of(i.config.elementStyles.menu.choiceButtonTextClassName)}))}))))))))}};function Ip(t){return Ip="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},Ip(t)}function Lp(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}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,Mp(r.key),r)}}function Rp(t,e,n){return e&&Np(t.prototype,e),n&&Np(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Mp(t){var e=function(t,e){if("object"!=Ip(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ip(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ip(e)?e:e+""}!function(t){t.game="game"}(Pp||(Pp={}));var Fp=function(){return Rp((function t(e){Lp(this,t),this.liveGame=null,this.config=b(t.DefaultConfig,e)}),[{key:"useComponent",value:function(t,e){if(!Object.keys(Cp).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 Dp(this)}}])}();Fp.defaultSettings={volume:1},Fp.ComponentTypes={say:"say",menu:"menu"},Fp.DefaultConfig={player:{contentContainerId:"__narraleaf_content",aspectRatio:16/9,minWidth:800,minHeight:450,width:1920,height:1080,skipKey:["Control"],skipInterval:100,ratioUpdateInterval:50},elements:{say:{nextKey:[" "],textInterval:50,use:Cp.say,useAspectScale:!0},img:{slowLoadWarning:!0,slowLoadThreshold:2e3,allowSkipTransform:!0,allowSkipTransition:!0},menu:{use:Cp.menu},background:{allowSkipTransform:!0,allowSkipTransition:!1},text:{allowSkipTransform:!0,allowSkipTransition:!0,width:1920,height:216}},elementStyles:{say:{contentContainerClassName:"",containerClassName:"",nameTextClassName:"",textContainerClassName:"",textSpanClassName:"",rubyClassName:""},menu:{containerClassName:"",choiceButtonClassName:"",choiceButtonTextClassName:""}},app:{debug:!1,logger:{log:!1,info:!1,warn:!0,error:!0,debug:!1,trace:!1},inspector:!1}},Fp.GameSettingsNamespace=Pp;var Dp=function(){function t(e){Lp(this,t),this.gameLock=new P,this.currentSavedGame=null,this.story=null,this.lockedAwaiting=null,this.gameState=void 0,this._lockedCount=0,this.currentAction=null,this._nextLock=new j,this.game=e,this.storable=new $l,this.initNamespaces()}return Rp(t,[{key:"initNamespaces",value:function(){return this.storable.clear().addNamespace(new Wl(t.GameSpacesKey.game,t.DefaultNamespaces.game)),this}},{key:"getStorable",value:function(){return this.storable}},{key:"loadStory",value:function(t){return this.story=t.constructStory(),this}},{key:"serialize",value:function(){var t,e,n;if(!this.gameState)throw new Error("No game state");var r=this.gameState,o=this.story;if(!o)throw new Error("No story loaded");var i=this.storable.toData(),a=r.toData(),s=(null===(t=this.getCurrentAction())||void 0===t?void 0:t.getId())||null,u=o.getAllElementStates();return{name:(null===(e=this.currentSavedGame)||void 0===e?void 0:e.name)||"",meta:{created:(null===(n=this.currentSavedGame)||void 0===n?void 0:n.meta.created)||Date.now(),updated:Date.now()},game:{store:i,stage:a,currentAction:s,elementStates:u}}}},{key:"deserialize",value:function(t){var e;if(!this.gameState)throw new Error("No game state");var n=this.gameState,r=this.story;if(!r)throw new Error("No story loaded");this.reset({gameState:n}),n.stage.forceUpdate();var o=new Map,i=new Map,a=t.game,s=a.store,u=a.stage,c=a.elementStates,l=a.currentAction;if(r.forEachChild((null===(e=r.entryScene)||void 0===e?void 0:e.sceneRoot)||[],(function(t){o.set(t.getId(),t),i.set(t.callee.getId(),t.callee)})),this.storable.load(s),c.forEach((function(t){var e=t.id,r=t.data;n.logger.debug("restore element",e);var o=i.get(e);if(!o)throw new Error("Element not found, id: "+e+"\nNarraLeaf cannot find the element with the id from the saved game");o.reset(),o.fromData(r)})),this.currentSavedGame=t,n.loadData(u,i),l){var f=o.get(l);if(!f)throw new Error("Action not found, id: "+l+"\nNarraLeaf cannot find the action with the id from the saved game");this.currentAction=f}n.stage.forceUpdate(),n.stage.next()}},{key:"newGame",value:function(){var t,e,n;if(!this.gameState)throw new Error("No game state");var r=this.gameState;this.reset({gameState:r}),this.initNamespaces();var o=this.getNewSavedGame();o.name="NewGame-"+Date.now(),this.currentSavedGame=o;var i=null===(t=this.story)||void 0===t?void 0:t.getAllElementMap((null===(n=null===(e=this.story)||void 0===e?void 0:e.entryScene)||void 0===n?void 0:n.sceneRoot)||[]);return i?i.forEach((function(t){r.logger.debug("reset element",t),t.reset()})):r.logger.warn("No elements found"),r.stage.forceUpdate(),r.stage.next(),this}},{key:"reset",value:function(t){var e,n,r=t.gameState;this.lockedAwaiting&&this.lockedAwaiting.abort(),this.currentAction=(null===(n=null===(e=this.story)||void 0===e?void 0:e.entryScene)||void 0===n?void 0:n.sceneRoot)||null,this.lockedAwaiting=null,this.currentSavedGame=null,r.forceReset()}},{key:"getCurrentAction",value:function(){return this.currentAction}},{key:"setCurrentAction",value:function(t){return this.currentAction=t,this}},{key:"next",value:function(t){var e,n;if(this._nextLock.isLocked())return null;if(this._nextLock.lock(),this.gameLock.isLocked())return this.gameLock;if(!this.story)throw new Error("No story loaded");if(this.lockedAwaiting){if(!this.lockedAwaiting.solved){if(this._lockedCount++,this._lockedCount>1e3)throw new Error("LiveGame locked: dead cycle detected\nPlease refresh the page");return this._nextLock.unlock(),this.lockedAwaiting}var r=this.lockedAwaiting.result;return this.currentAction=(null===(e=null==r?void 0:r.node)||void 0===e?void 0:e.action)||null,t.logger.debug("next action",r),this.lockedAwaiting=null,this._nextLock.unlock(),r||null}if(!this.currentAction)return t.events.emit(nf.EventTypes["event:state.end"]),t.logger.warn("LiveGame","No current action"),this._nextLock.unlock(),null;var o=this.currentAction.executeAction(t);return w.isAwaitable(o)?(this.lockedAwaiting=o,this._nextLock.unlock(),o):(t.logger.debug("next action",o),this._lockedCount=0,this.currentAction=(null===(n=o.node)||void 0===n?void 0:n.action)||null,this._nextLock.unlock(),o)}},{key:"abortAwaiting",value:function(){var t;if(this.lockedAwaiting){var e=this.lockedAwaiting.abort();this.currentAction=(null===(t=null==e?void 0:e.node)||void 0===t?void 0:t.action)||null,this.lockedAwaiting=null}}},{key:"executeAction",value:function(t,e){var n,r=e.executeAction(t);return w.isAwaitable(r)?r:(null===(n=null==r?void 0:r.node)||void 0===n?void 0:n.action)||null}},{key:"setGameState",value:function(t){return this.gameState=t,this}},{key:"getGameState",value:function(){return this.gameState}},{key:"getNewSavedGame",value:function(){var t,e,n;return{name:"",meta:{created:Date.now(),updated:Date.now()},game:{store:{},stage:{scenes:[]},elementStates:[],currentAction:(null===(n=null===(e=null===(t=this.story)||void 0===t?void 0:t.entryScene)||void 0===e?void 0:e.sceneRoot)||void 0===n?void 0:n.getId())||null}}}}])}();Dp.DefaultNamespaces={game:{}},Dp.GameSpacesKey={game:"game"};var Bp=o(72),Vp=o.n(Bp),Gp=o(825),Up=o.n(Gp),zp=o(659),Hp=o.n(zp),Wp=o(56),$p=o.n(Wp),Yp=o(540),qp=o.n(Yp),Xp=o(113),Kp=o.n(Xp),Zp=o(587),Qp={};Qp.styleTagTransform=Kp(),Qp.setAttributes=$p(),Qp.insert=Hp().bind(null,"head"),Qp.domAPI=Up(),Qp.insertStyleElement=qp();Vp()(Zp.A,Qp);Zp.A&&Zp.A.locals&&Zp.A.locals;function Jp({children:t,features:e,strict:n=!1}){const[,r]=(0,af.useState)(!td(e)),o=(0,af.useRef)(void 0);if(!td(e)){const{renderer:t,...n}=e;o.current=t,jf(n)}return(0,af.useEffect)((()=>{td(e)&&e().then((({renderer:t,...e})=>{jf(e),o.current=t,r(!0)}))}),[]),(0,hf.jsx)(bf.Provider,{value:{renderer:o.current,strict:n},children:t})}function td(t){return"function"==typeof t}function ed(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 nd(t,e,n={}){var r;const o=Oi(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(Li(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(rd).forEach(((t,r)=>{t.notify("AnimationStart",e),a.push(nd(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 rd(t,e){return t.sortNodePosition(e)}const od=Hi.length;function id(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&id(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let n=0;n<od;n++){const r=Hi[n],o=t.props[r];(Ui(o)||!1===o)&&(e[r]=o)}return e}const ad=[...zi].reverse(),sd=zi.length;function ud(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=>nd(t,e,n)));r=Promise.all(o)}else if("string"==typeof e)r=nd(t,e,n);else{const o="function"==typeof e?Oi(t,e,n.custom):e;r=Promise.all(Li(t,o,n))}return r.then((()=>{t.notify("AnimationComplete",e)}))}(t,e,n))))}function cd(t){let e=ud(t),n=pd(),r=!0;const o=e=>(n,r)=>{var o;const i=Oi(t,r,"exit"===e?null===(o=t.presenceContext)||void 0===o?void 0:o.custom:void 0);if(i){const{transition:t,transitionEnd:e,...r}=i;n={...n,...r,...e}}return n};function i(i){const{props:a}=t,s=id(t.parent)||{},u=[],c=new Set;let l={},f=1/0;for(let e=0;e<sd;e++){const p=ad[e],d=n[p],h=void 0!==a[p]?a[p]:s[p],y=Ui(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||Gi(h)||"boolean"==typeof h)continue;const g=ld(d.prevProp,h);let b=g||p===i&&d.isActive&&!m&&y||e>f&&y,w=!1;const _=Array.isArray(h)?h:[h];let S=_.reduce(o(p),{});!1===v&&(S={});const{prevResolvedValues:k={}}=d,x={...k,...S},A=e=>{b=!0,c.has(e)&&(w=!0,c.delete(e)),d.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in x){const e=S[t],n=k[t];if(l.hasOwnProperty(t))continue;let r=!1;r=mi(e)&&mi(n)?!ed(e,n):e!==n,r?null!=e?A(t):c.add(t):void 0!==e&&c.has(t)?A(t):d.protectedKeys[t]=!0}d.prevProp=h,d.prevResolvedValues=S,d.isActive&&(l={...l,...S}),r&&t.blockInitialAnimation&&(b=!1);b&&(!(m&&g)||w)&&u.push(..._.map((t=>({animation:t,options:{type:p}}))))}if(c.size){const e={};c.forEach((n=>{const r=t.getBaseTarget(n),o=t.getValue(n);o&&(o.liveStyle=!0),e[n]=null!=r?r:null})),u.push({animation:e})}let p=Boolean(u.length);return!r||!1!==a.initial&&a.initial!==a.animate||t.manuallyAnimateOnMount||(p=!1),r=!1,p?e(u):Promise.resolve()}return{animateChanges:i,setActive:function(e,r){var o;if(n[e].isActive===r)return Promise.resolve();null===(o=t.variantChildren)||void 0===o||o.forEach((t=>{var n;return null===(n=t.animationState)||void 0===n?void 0:n.setActive(e,r)})),n[e].isActive=r;const a=i(e);for(const t in n)n[t].protectedKeys={};return a},setAnimateFunction:function(n){e=n(t)},getState:()=>n,reset:()=>{n=pd(),r=!0}}}function ld(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!ed(e,t)}function fd(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function pd(){return{animate:fd(!0),whileInView:fd(),whileHover:fd(),whileTap:fd(),whileDrag:fd(),whileFocus:fd(),exit:fd()}}class dd{constructor(t){this.isMounted=!1,this.node=t}update(){}}let hd=0;const yd={animation:{Feature:class extends dd{constructor(t){super(t),t.animationState||(t.animationState=cd(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Gi(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 dd{constructor(){super(...arguments),this.id=hd++}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 vd(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function md(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const gd=t=>e=>(t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary)(e)&&t(e,md(e));function bd(t,e,n,r){return vd(t,e,gd(n),r)}function wd(t){let e=null;return()=>{const n=()=>{e=null};return null===e&&(e=t,n)}}const _d=wd("dragHorizontal"),Sd=wd("dragVertical");function kd(){const t=function(t){let e=!1;if("y"===t)e=Sd();else if("x"===t)e=_d();else{const t=_d(),n=Sd();t&&n?e=()=>{t(),n()}:(t&&t(),n&&n())}return e}(!0);return!t||(t(),!1)}function xd(t,e){const n=e?"pointerenter":"pointerleave",r=e?"onHoverStart":"onHoverEnd";return bd(t.current,n,((n,o)=>{if("touch"===n.pointerType||kd())return;const i=t.getProps();t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",e);const a=i[r];a&&Un.postRender((()=>a(n,o)))}),{passive:!t.getProps()[r]})}const Ad=(t,e)=>!!e&&(t===e||Ad(t,e.parentElement));function Od(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,md(n))}const Ed=new WeakMap,Td=new WeakMap,jd=t=>{const e=Ed.get(t.target);e&&e(t)},Pd=t=>{t.forEach(jd)};function Cd(t,e,n){const r=function({root:t,...e}){const n=t||document;Td.has(n)||Td.set(n,{});const r=Td.get(n),o=JSON.stringify(e);return r[o]||(r[o]=new IntersectionObserver(Pd,{root:t,...e})),r[o]}(e);return Ed.set(t,n),r.observe(t),()=>{Ed.delete(t),r.unobserve(t)}}const Id={some:0,all:1};const Ld={inView:{Feature:class extends dd{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:Id[r]};return Cd(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 dd{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=bd(window,"pointerup",((t,e)=>{if(!this.checkPressEnd())return;const{onTap:n,onTapCancel:r,globalTapTarget:o}=this.node.getProps(),i=o||Ad(this.node.current,t.target)?n:r;i&&Un.update((()=>i(t,e)))}),{passive:!(n.onTap||n.onPointerUp)}),o=bd(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=vd(this.node.current,"keydown",(t=>{if("Enter"!==t.key||this.isPressing)return;this.removeEndListeners(),this.removeEndListeners=vd(this.node.current,"keyup",(t=>{"Enter"===t.key&&this.checkPressEnd()&&Od("up",((t,e)=>{const{onTap:n}=this.node.getProps();n&&Un.postRender((()=>n(t,e)))}))})),Od("down",((t,e)=>{this.startPress(t,e)}))})),e=vd(this.node.current,"blur",(()=>{this.isPressing&&Od("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&&Un.postRender((()=>n(t,e)))}checkPressEnd(){this.removeEndListeners(),this.isPressing=!1;return this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!kd()}cancelPress(t,e){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&Un.postRender((()=>n(t,e)))}mount(){const t=this.node.getProps(),e=bd(t.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),n=vd(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Mo(e,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}},focus:{Feature:class extends dd{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(vd(this.node.current,"focus",(()=>this.onFocus())),vd(this.node.current,"blur",(()=>this.onBlur())))}unmount(){}}},hover:{Feature:class extends dd{mount(){this.unmount=Mo(xd(this.node,!0),xd(this.node,!1))}unmount(){}}}},Nd={renderer:(t,e)=>Rf(t)?new pa(e):new ha(e,{allowProjection:t!==af.Fragment}),...yd,...Ld};function Rd(t){var e=t.children;return sf().createElement(Jp,{features:Nd,strict:!0},e)}function Md(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 Fd(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)?Fd(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 Fd(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 Dd(t){var e=t.children,n=t.className,r=Md((0,af.useState)({}),2),o=r[0],i=r[1],a=xp().ratio,s=pf().game,u=Md((0,af.useReducer)((function(t){return t+1}),0),2)[1],c=s.config.player.minWidth,l=s.config.player.minHeight;return(0,af.useEffect)((function(){var t,e=function(){if(a.isLocked())console.warn("NarraLeaf-React: Ratio is locked, skipping update");else{var t=document.getElementById(s.config.player.contentContainerId);if(t){var e,n,r=t.clientWidth,o=t.clientHeight,f=s.config.player.aspectRatio;r/o>f?(e=o*f,n=o):(e=r,n=r/f),e<c&&(e=c),n<l&&(n=l),i({width:"".concat(e,"px"),height:"".concat(n,"px"),margin:"auto",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",display:"flex",alignItems:"center",justifyContent:"center"});var p=e/s.config.player.width;a.update(e,n,p),a.updateMin(c,l),u()}}};a.setUpdate(e);var n,r,o,f=(n=function(){e(),clearTimeout(t),a.pause(),t=setTimeout((function(){a.resume()}),100)},r=s.config.player.ratioUpdateInterval,o=null,function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];o&&clearTimeout(o),o=setTimeout((function(){n.apply(void 0,e)}),r)});return e(),window.addEventListener("resize",f),function(){window.removeEventListener("resize",f),clearTimeout(t)}}),[a]),sf().createElement("div",{id:s.config.player.contentContainerId,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"}},sf().createElement("div",{className:of(n),style:o},e))}function Bd(t){return Bd="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},Bd(t)}function Vd(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Vd=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new P(r||[]);return o(a,"_invoke",{value:O(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",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"==Bd(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,n,r){var o=p;return function(i,a){if(o===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 T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(Bd(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),j(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;j(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function Gd(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 Ud(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)?Ud(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 Ud(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 zd=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 Hd(t){var e=this,n=t.state,r=t.displayable,o=t.child,i=r.element,a=r.state,s=void 0===a?i:a,u=(0,af.useRef)(null),c=Gd((0,af.useState)(null),2),l=c[0],f=c[1],p=Gd((0,af.useState)([]),2)[1],d=Gd((0,af.useState)(null),2),h=d[0],y=d[1],v=Gd((0,af.useState)({}),2),m=v[0],g=v[1];function w(t){if(h&&h.getControl()&&(n.logger.warn("Displayable Animation","processing transform not completed"),h.getControl().complete(),h.setControl(null)),!u.current)throw new Error("scope not ready");t instanceof La?Object.assign(u.current.style,t.propToCSS(n,s.state,r.transformOverwrites)):Object.assign(u.current.style,t)}function _(t){return f(t),t?new Promise((function(e){var r=t.events.onEvents([{type:xc.update,listener:t.events.on(xc.update,(function(t){p(t)}))},{type:xc.end,listener:t.events.on(xc.end,(function(){f(null),n.logger.debug("scene background transition end",t)}))},{type:xc.start,listener:t.events.on(xc.start,(function(){n.logger.debug("scene background transition start",t)}))}]);t.start((function(){r.cancel(),e()}))})):(n.logger.warn("transition not set"),Promise.resolve())}function S(t){return zd(this,void 0,void 0,Vd().mark((function e(){return Vd().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return w(t.propToCSS(n,s.state,r.transformOverwrites)),y(t),e.next=4,t.animate({scope:u,target:s,overwrites:r.transformOverwrites},n,(function(e){s.state=b(s.state,e),g({style:t.propToCSS(n,s.state,r.transformOverwrites)}),y(null)}));case 4:case"end":return e.stop()}}),e)})))}return(0,af.useEffect)((function(){var t="event:displayable.applyTransition",o="event:displayable.applyTransform",a="event:displayable.init",c=i.events.onEvents([{type:t,listener:i.events.on(t,_)},{type:o,listener:i.events.on(o,S)},{type:a,listener:i.events.on(a,(function(){return zd(e,void 0,void 0,Vd().mark((function t(){var e;return Vd().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=i.toDisplayableTransform(),n.logger.debug("init transform",e),t.next=4,e.animate({scope:u,target:s,overwrites:r.transformOverwrites},n,(function(t){s.state=b(s.state,t)}));case 4:case"end":return t.stop()}}),t)})))}))}]);return function(){c.cancel()}}),[]),(0,af.useEffect)((function(){if(!u.current)throw new Error("Scope not ready. Using element: ".concat(i.constructor.name))}),[]),(0,af.useEffect)((function(){var t=n.events.onEvents([{type:nf.EventTypes["event:state.player.skip"],listener:n.events.on(nf.EventTypes["event:state.player.skip"],(function(){r.skipTransform&&h&&h.getControl()&&(h.getControl().complete(),h.setControl(null),n.logger.debug("transform skip")),r.skipTransition&&l&&l.controller&&(l.controller.complete(),f(null),n.logger.debug("transition skip"))}))}]);return function(){t.cancel()}}),[l,h]),sf().createElement(sf().Fragment,null,o({transformRef:u,transition:l,transform:h,transformProps:m,state:n}))}function Wd(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return $d(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$d(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $d(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Yd(){return Yd=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},Yd.apply(null,arguments)}function qd(t){var e=t.scene,n=t.props,r=t.state;return sf().createElement(Hd,{displayable:{element:e,skipTransform:r.game.config.elements.background.allowSkipTransform,skipTransition:r.game.config.elements.background.allowSkipTransition},child:function(t){return sf().createElement(Xd,Yd({},t,{scene:e,props:n}))},state:r})}function Xd(t){var e=t.transformRef,n=t.transformProps,r=t.transition,o=t.state,i=t.scene,a=t.props,s=xp().ratio,u=Wd(sf().useState(!1),2),c=u[0],l=u[1];function f(){c||(l(!0),i.events.emit(fl.EventTypes["event:scene.imageLoaded"]),o.logger.debug("BackgroundTransition","Image loaded",i))}var p,d="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/wcAAgAB9sWFXTkAAAAASUVORK5CYII=",h={src:d,style:Object.assign({},o.game.config.app.debug?{border:"1px solid red"}:{})};return sf().createElement("div",null,sf().createElement(ep.div,Yd({layout:!0,ref:e,className:"absolute inset-0 flex items-center justify-center bg-cover bg-center overflow-hidden"},b({style:Object.assign({},s.getStyle())},n)),r?r.toElementProps().map((function(t,e){var n=b(h,a,t);return sf().createElement("img",Yd({alt:n.alt},n,{onLoad:f,src:n.src?n.src:d,className:"absolute",key:e}))})):(p=b(h,a),sf().createElement("img",Yd({key:"last",alt:p.alt},p,{onLoad:f,src:p.src||d,className:"absolute"})))))}function Kd(t){return Kd="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},Kd(t)}function Zd(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Zd=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new P(r||[]);return o(a,"_invoke",{value:O(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",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"==Kd(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,n,r){var o=p;return function(i,a){if(o===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 T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(Kd(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),j(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;j(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function Qd(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Jd(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Jd(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Jd(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var th=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 eh(t){var e=t.scene,n=t.state,r=t.children,o=t.className,i=xp().ratio,a=Qd((0,af.useState)((function(){return e.state.backgroundMusic})),2),s=a[0],u=a[1];return(0,af.useEffect)((function(){var t=[{type:"event:scene.setBackgroundMusic",listener:e.events.on(fl.EventTypes["event:scene.setBackgroundMusic"],(function(t,e){(function(t,e){return th(this,void 0,void 0,Zd().mark((function r(){var o,i;return Zd().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return o=s,i=t,r.next=4,n.transitionSound(o,i,e);case 4:if(i){r.next=6;break}return r.abrupt("return");case 6:u(i);case 7:case"end":return r.stop()}}),r)})))})(t,e).then()}))},{type:"event:scene.preUnmount",listener:e.events.on(fl.EventTypes["event:scene.preUnmount"],(function(){s&&function(t,e){return th(this,void 0,void 0,Zd().mark((function r(){return Zd().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,n.fadeSound(t,0,e);case 2:n.stopSound(t);case 3:case"end":return r.stop()}}),r)})))}(s,e.state.backgroundMusicFade).then()}))}];return function(){t.forEach((function(t){var n=t.type,r=t.listener;e.events.off(n,r)}))}}),[]),(0,af.useEffect)((function(){return e.events.emit(fl.EventTypes["event:scene.mount"]),function(){e.events.emit(fl.EventTypes["event:scene.unmount"])}}),[]),sf().createElement("div",{className:o},sf().createElement(qd,{scene:e,props:{width:i.state.width,height:i.state.height,src:ws.isImageSrc(e.state.background)?ws.srcToString(e.state.background):void 0,style:{backgroundColor:ws.isImageColor(e.state.background)?ws.toHex(e.state.background):void 0}},state:n}),r)}function nh(){return nh=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},nh.apply(null,arguments)}function rh(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 oh(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)?oh(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 oh(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 ih(t){var e=t.props,n=t.onLoad,r=t.id,o=t.Ref,i=(0,af.useRef)(null),a=xp().ratio,s=rh(sf().useState(0),2),u=s[0],c=s[1];function l(){var t=o||i;t.current&&c(t.current.naturalWidth*a.state.scale)}return(0,af.useEffect)((function(){return l(),a.onUpdate(l)}),[e.src]),(0,af.useEffect)((function(){l()}),[e,r]),sf().createElement("img",nh({ref:o||i},e,{onLoad:n,width:u,alt:e.alt}))}function ah(){return ah=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},ah.apply(null,arguments)}function sh(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 uh(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)?uh(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 uh(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 ch(t){var e=t.image,n=t.state,r=sh((0,af.useState)(0),2),o=r[0],i=r[1],a=pf().game;(0,af.useEffect)((function(){i(performance.now())}),[]);var s=function(){var t=performance.now()-o,e=a.config.elements.img.slowLoadThreshold;t>e&&a.config.elements.img.slowLoadWarning&&n.logger.warn("NarraLeaf-React","Image took ".concat(t,"ms to load, which exceeds the threshold of ").concat(e,"ms. ")+"Consider enable cache for the image, so Preloader can preload it before it's used. To disable this warning, set `elements.img.slowLoadWarning` to false in the game config.")};return sf().createElement(Hd,{displayable:{element:e,skipTransition:n.game.config.elements.img.allowSkipTransition,skipTransform:n.game.config.elements.img.allowSkipTransform,transformOverwrites:{}},child:function(t){return sf().createElement(lh,ah({},t,{image:e,handleLoad:s}))},state:n})}function lh(t){var e=t.transition,n=t.transformProps,r=t.transformRef,o=t.state,i=t.image,a=t.handleLoad,s=xp().ratio,u=(0,af.useRef)(null),c={src:ws.staticImageDataToSrc(i.state.src),style:Object.assign(Object.assign({},o.game.config.app.debug?{border:"1px solid red"}:{}),{transformOrigin:"center"})},l=[{style:{display:"block",position:"unset"}},{style:{top:"50%",left:"50%",transform:"translate(-50%, -50%)",maxWidth:"none"}}];return sf().createElement("div",null,sf().createElement(up.mDiv,ah({tag:"image.aspectScaleContainer",color:"green",border:"dashed",layout:!0,Ref:r,className:"absolute"},b({style:{opacity:0}},n,{style:{display:"inline-block",width:u.current?"".concat(u.current.naturalWidth*s.state.scale,"px"):"auto",height:u.current?"".concat(u.current.naturalHeight*s.state.scale,"px"):"auto"}})),sf().createElement(sf().Fragment,null,(e?e.toElementProps():[{}]).map((function(t,e){var n=b(c,t,l[e]||{});return sf().createElement(ih,{key:e,props:Object.assign({className:"absolute"},n),id:n.src,onLoad:a,Ref:0===e?u:void 0})}))),(i.events.emit(Xa.EventTypes["event:image.flush"]),null)))}function fh(t){return fh="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},fh(t)}function ph(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,dh(r.key),r)}}function dh(t){var e=function(t,e){if("object"!=fh(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=fh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==fh(e)?e:e+""}var hh=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.preloaded=[],this.events=new k}return function(t,e,n){return e&&ph(t.prototype,e),n&&ph(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?ws.srcToString(t.src.state.src):"video"===t.type?t.src:"audio"===t.type?t.src.getSrc():""}}])}();function yh(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 vh(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)?vh(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 vh(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}hh.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 mh=(0,af.createContext)(null);function gh(t){var e=t.children,n=yh((0,af.useState)(new hh),1)[0];return sf().createElement(sf().Fragment,null,sf().createElement(mh.Provider,{value:{preloaded:n}},e))}function bh(){if(!mh)throw new Error("usePreloaded must be used within a PreloadedProvider");return(0,af.useContext)(mh)}function wh(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 Sh(t){var e=t.state,n=bh().preloaded,r=e.getLastScene(),o=(0,af.useRef)(0);return(0,af.useEffect)((function(){var t,r;if("undefined"!=typeof window){window.performance&&(o.current=performance.now());var i=null===(t=e.getLastScene())||void 0===t?void 0:t.srcManager,a=(null===(r=e.getLastScene())||void 0===r?void 0:r.srcManager.future)||[],s=[].concat(wh(i?i.src:[]),wh(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===dc.SrcTypes.image?u.image.add(t.src):t.type===dc.SrcTypes.audio?u.audio.add(t.src):t.type===dc.SrcTypes.video&&u.video.add(t.src)})),e.logger.debug("Preloading",u,a),n.preloaded=n.preloaded.filter((function(t){if(t.type===dc.SrcTypes.audio){var e=u[t.type].has(t.src);return e||(e=Array.from(u[t.type]).some((function(e){return n.getSrc(t)===n.getSrc(e.config.src)}))),e}if(t.type===dc.SrcTypes.image)return u[t.type].has(t.src);var r=n.getSrc(t);return u[t.type].has(r)}));var c=[];return u.image.forEach((function(t){var r=new Image;r.src=ws.srcToString(t.state.src),r.onload=function(){e.logger.debug("Image loaded",t.state.src)},c.push(r),n.add({type:"image",src:t})})),Promise.all([]).then((function(){if(e.logger.log("Preloaded","Preloaded ".concat(u.image.size," images")),n.events.emit(hh.EventTypes["event:preloaded.ready"]),e.events.emit(nf.EventTypes["event:state.preload.loaded"]),window.performance){var t=performance.now()-o.current;e.logger.info("Preload","Preloaded ".concat(u.image.size," images in ").concat(t,"ms"))}})),u.audio.forEach((function(t){t.getPlaying()||t.setPlaying(new(e.getHowl())({src:t.config.src,loop:t.config.loop,volume:t.config.volume,autoplay:!1,preload:!0}))})),n.events.emit(hh.EventTypes["event:preloaded.mount"]),function(){c.forEach((function(t){t.onload=null})),e.events.emit(nf.EventTypes["event:state.preload.unmount"]),e.logger.debug("Preload unmounted")}}console.warn("Window is not supported in this environment")}),[r]),null}function kh(t){var e=t.state,n=pf().game;return(0,af.useEffect)((function(){if(window){var t,r,o,i=(t=function(t){n.config.player.skipKey.includes(t.key)&&e.events.emit(nf.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")}),[]),sf().createElement(sf().Fragment,null)}var xh=o(33);function Ah(){return Ah=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},Ah.apply(null,arguments)}function Oh(t){var e=t.state,n=t.text,r={scale:function(t){return{width:"fit-content"}},transform:function(t){return{transform:La.propToCSSTransform(e,t,{translate:["left"===n.config.alignX?"0%":"right"===n.config.alignX?"-100%":void 0,"top"===n.config.alignY?"100%":"bottom"===n.config.alignY?"0%":void 0]})}}};return sf().createElement(Hd,{displayable:{element:n,skipTransform:e.game.config.elements.text.allowSkipTransform,skipTransition:e.game.config.elements.text.allowSkipTransition,transformOverwrites:r},child:function(t){return sf().createElement(Eh,Ah({},t,{text:n}))},state:e})}function Eh(t){var e=t.transformRef,n=t.transformProps,r=t.transition,o=t.text,i=xp().ratio,a={style:{width:"fit-content",whiteSpace:"nowrap",fontSize:o.state.fontSize}},s=[{}],u=of(o.config.className);return sf().createElement(up.Div,null,sf().createElement(up.mDiv,Ah({tag:"text.container",color:"green",border:"dashed",layout:!0,Ref:e,className:"absolute"},b({style:{opacity:0}},n,{style:{width:"fit-content"}})),r?r.toElementProps().map((function(t,e){var n=b(a,t,{style:{transform:"scale(".concat(i.state.scale,")"),transformOrigin:"".concat(o.config.alignX," ").concat(o.config.alignY)}},s[e]||{});return sf().createElement(up.Span,Ah({tag:"text.transition."+e,key:e},n,{className:u}),sf().createElement("span",null,o.state.text))})):sf().createElement(up.Div,Ah({tag:"text.transition.last",color:"green",border:"dashed",key:"last"},b(a,{style:{width:"fit-content",transform:"scale(".concat(i.state.scale,")"),transformOrigin:"".concat(o.config.alignX," ").concat(o.config.alignY)}})),sf().createElement(up.Span,{className:u},o.state.text))))}function Th(t){var e=t.state,n=t.displayable;return sf().createElement(sf().Fragment,null,n.map((function(t){var n;if(t instanceof Jc)return sf().createElement(Oh,{state:e,text:t,key:"text-"+t.getId()});throw new Error("Unsupported displayable type: "+((null===(n=null==t?void 0:t.constructor)||void 0===n?void 0:n.name)||t))})))}var jh=o(556),Ph=o.n(jh);function Ch(t){var e=t.error,n=t.errorInfo;return pf().game.config.app.debug?sf().createElement("div",{className:"text-left"},sf().createElement("h1",null,"It is my fault, NarraLeaf-React cannot initialize the player correctly."),sf().createElement("p",{className:"text-red-700"},"Message: ",e.message),sf().createElement("pre",null,"Error Stack: ",null==e?void 0:e.stack),sf().createElement("pre",null,"Component Stack: ",null==n?void 0:n.componentStack),sf().createElement("pre",null,"Digest: ",null==n?void 0:n.digest)):sf().createElement("div",null,sf().createElement("h1",null,"The game cannot initialize the player correctly."),sf().createElement("p",null,"Please contact the game developer for further assistance."))}function Ih(t){return Ih="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},Ih(t)}function Lh(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,Nh(r.key),r)}}function Nh(t){var e=function(t,e){if("object"!=Ih(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ih(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ih(e)?e:e+""}function Rh(t,e,n){return e=Fh(e),function(t,e){if(e&&("object"==Ih(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,Mh()?Reflect.construct(e,n||[],Fh(t).constructor):e.apply(t,n))}function Mh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Mh=function(){return!!t})()}function Fh(t){return Fh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Fh(t)}function Dh(t,e){return Dh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Dh(t,e)}var Bh=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=Rh(this,e,arguments)).state={hasError:!1,error:null,errorInfo:null},t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Dh(t,e)}(e,t),function(t,e,n){return e&&Lh(t.prototype,e),n&&Lh(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"componentDidCatch",value:function(t,e){this.setState({error:t,errorInfo:e}),console.error(t,e)}},{key:"render",value:function(){return this.state.hasError?sf().createElement(Ch,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}],[{key:"getDerivedStateFromError",value:function(t){return{hasError:!0,error:t,errorInfo:null}}}])}(sf().Component);function Vh(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 Gh(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)?Gh(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 Gh(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 Uh(t,e){return t.handle(e)}function zh(t){var e=t.story,n=t.width,r=t.height,o=t.className,i=t.onReady,a=t.onEnd,s=Vh((0,af.useReducer)((function(t){return t+1}),0),2)[1],u=pf().game,c=Vh((0,af.useReducer)(Uh,new nf(u,{update:s,forceUpdate:function(){l.logger.warn("Player","force update"),(0,xh.flushSync)((function(){s()}))},next:h,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 h(){for(var t=!1;!t;){var e=u.getLiveGame().next(l);if(!e)break;if(w.isAwaitable(e)){t=!0;break}if(e instanceof P){e.nextUnlock().then((function(){h()})),t=!0;break}f(e)}l.stage.update()}(0,af.useEffect)((function(){return u.getLiveGame().setGameState(l).loadStory(e),function(){u.getLiveGame().setGameState(void 0)}}),[u]),(0,af.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:nf.EventTypes["event:state.end"],listener:function(){a&&a({game:u,gameState:l,liveGame:u.getLiveGame(),storable:u.getLiveGame().getStorable()})}}]),o=l.events.onEvents([{type:nf.EventTypes["event:state.player.skip"],listener:function(){u.getLiveGame().abortAwaiting(),h()}}]);return l.stage.update(),function(){e&&n.forEach((function(t){e.events.off(t.type,t.listener)})),r.cancel(),o.cancel()}}));return function(){t&&e.then((function(t){return t()}))}}),[]),l.events.emit(nf.EventTypes["event:state.player.flush"]);var y=n||u.config.player.width,v=r||u.config.player.height;return sf().createElement(Bh,null,sf().createElement(Rd,null,sf().createElement("div",{style:{width:"number"==typeof y?"".concat(y,"px"):y,height:"number"==typeof v?"".concat(v,"px"):v},className:of(o,"__narraleaf_content-player")},sf().createElement(Dd,{className:of("flex-grow overflow-auto")},sf().createElement(jp,{className:"relative"},sf().createElement(Sh,{state:l}),sf().createElement(Hh,{onLoaded:function(){l.stage.update(),e&&h()},state:l},sf().createElement(kh,{state:l}),l.getSceneElements().map((function(t){var e=t.scene,n=t.ele;return sf().createElement(eh,{key:"scene-"+e.getId(),state:l,scene:e},n.images.map((function(t){return sf().createElement(ch,{key:"image-"+t.getId(),image:t,state:l})})),sf().createElement(Th,{state:l,displayable:n.displayable}),n.texts.map((function(t){var e=t.action,n=t.onClick;return sf().createElement(p,{state:l,key:"say-"+e.id,action:e,onClick:function(){n(),h()}})})),n.menus.map((function(t,e){return sf().createElement("div",{key:"menu-"+e},sf().createElement(d,{state:l,prompt:t.action.prompt,choices:t.action.choices,afterChoose:function(e){t.onClick(e),h()}}))})))}))))))))}function Hh(t){var e=t.children,n=t.onLoaded,r=t.state,o=bh().preloaded,i=Vh((0,af.useState)(!1),2),a=i[0],s=i[1];return(0,af.useEffect)((function(){var t=o.events.on(hh.EventTypes["event:preloaded.ready"],(function(){s(!0),n()})),e=r.events.on(nf.EventTypes["event:state.preload.unmount"],(function(){s(!1)}));return function(){o.events.off(hh.EventTypes["event:preloaded.ready"],t),r.events.off(nf.EventTypes["event:state.preload.unmount"],e)}}),[a]),sf().createElement(sf().Fragment,null,a?e:null)}function Wh(t){var e=t.children,n=t.game;return sf().createElement(sf().Fragment,null,sf().createElement(kp,null,sf().createElement(ff,{game:n},sf().createElement(gh,null,e))))}function $h(t){return $h="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},$h(t)}function Yh(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,qh(r.key),r)}}function qh(t){var e=function(t,e){if("object"!=$h(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=$h(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==$h(e)?e:e+""}function Xh(t,e,n){return e=Zh(e),function(t,e){if(e&&("object"==$h(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,Kh()?Reflect.construct(e,n||[],Zh(t).constructor):e.apply(t,n))}function Kh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Kh=function(){return!!t})()}function Zh(t){return Zh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Zh(t)}function Qh(t,e){return Qh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Qh(t,e)}Bh.propTypes={children:Ph().node.isRequired};var Jh=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=Xh(this,e)).state={opacity:1},t.duration=n,t.easing=r,t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Qh(t,e)}(e,t),function(t,e,n){return e&&Yh(t.prototype,e),n&&Yh(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){return this.src=t,this}},{key:"start",value:function(t){var n=this;this.state.opacity=e.Frames[0],this.requestAnimation({start:e.Frames[0],end:e.Frames[1],duration:this.duration},{onComplete:function(){t&&t(),n.state.opacity=e.Frames[1]},onUpdate:function(t){n.state.opacity=t}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{opacity:1}},{style:{opacity:this.state.opacity,backgroundColor:ws.isImageColor(this.src)?S(this.src):""},src:ws.isImageSrc(this.src)?ws.srcToString(this.src):""}]}},{key:"copy",value:function(){return new e(this.duration,this.easing).setSrc(this.src)}}])}(Mc);function ty(t){return ty="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},ty(t)}function ey(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,ny(r.key),r)}}function ny(t){var e=function(t,e){if("object"!=ty(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ty(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ty(e)?e:e+""}function ry(t,e,n){return e=iy(e),function(t,e){if(e&&("object"==ty(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,oy()?Reflect.construct(e,n||[],iy(t).constructor):e.apply(t,n))}function oy(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(oy=function(){return!!t})()}function iy(t){return iy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},iy(t)}function ay(t,e){return ay=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ay(t,e)}Jh.Frames=[0,1];var sy=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=ry(this,e)).state={opacity:0,transform:""},r.duration=o,r.direction=t,r.offset=n,r.easing=i,r.__stack=x(),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ay(t,e)}(e,t),function(t,e,n){return e&&ey(t.prototype,e),n&&ey(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){return this.src=t,this}},{key:"start",value:function(t){var e=this;if(!this.src)throw new Error("src is required, but not provided\nat:\n"+this.__stack);this.state.opacity=0,this.state.transform=this.getInitialTransform(),this.requestAnimation({start:0,end:1,duration:this.duration},{onComplete:t,onUpdate:function(t){e.state.opacity=t,e.state.transform=e.getTransform(t)}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{opacity:1}},{style:{opacity:this.state.opacity,transform:this.state.transform,backgroundColor:ws.isImageColor(this.src)?S(this.src):""},src:ws.isImageSrc(this.src)?ws.srcToString(this.src):""}]}},{key:"copy",value:function(){return new e(this.direction,this.offset,this.duration,this.easing).setSrc(this.src)}},{key:"getInitialTransform",value:function(){switch(this.direction){case"left":return"translateX(-".concat(this.offset,"px)");case"right":return"translateX(".concat(this.offset,"px)");case"top":return"translateY(-".concat(this.offset,"px)");case"bottom":return"translateY(".concat(this.offset,"px)");default:return""}}},{key:"getTransform",value:function(t){switch(this.direction){case"left":return"translateX(".concat((1-t)*-this.offset,"px)");case"right":return"translateX(".concat((1-t)*this.offset,"px)");case"top":return"translateY(".concat((1-t)*-this.offset,"px)");case"bottom":return"translateY(".concat((1-t)*this.offset,"px)");default:return""}}}])}(Mc);function uy(t){return uy="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},uy(t)}function cy(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,ly(r.key),r)}}function ly(t){var e=function(t,e){if("object"!=uy(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=uy(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==uy(e)?e:e+""}function fy(t,e,n){return e=dy(e),function(t,e){if(e&&("object"==uy(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,py()?Reflect.construct(e,n||[],dy(t).constructor):e.apply(t,n))}function py(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(py=function(){return!!t})()}function dy(t){return dy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},dy(t)}function hy(t,e){return hy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},hy(t,e)}var yy=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=fy(this,e)).state={opacity:0},t.duration=n,t.easing=r,t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&hy(t,e)}(e,t),function(t,e,n){return e&&cy(t.prototype,e),n&&cy(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){return this.src=t,this}},{key:"start",value:function(t){var n=this;this.state.opacity=e.Frames[0],this.requestAnimation({start:e.Frames[0],end:e.Frames[1],duration:this.duration},{onComplete:function(){n.state.opacity=e.Frames[1],t&&t()},onUpdate:function(t){n.state.opacity=t}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{opacity:this.state.opacity}},{style:{opacity:1-this.state.opacity,backgroundColor:ws.isImageColor(this.src)?S(this.src):""},src:ws.isImageSrc(this.src)?ws.srcToString(this.src):""}]}},{key:"copy",value:function(){return new e(this.duration,this.easing).setSrc(this.src)}}])}(Mc);yy.Frames=[1,0]})(),i})()));