@ekolabs/eko-gallery-react 4.0.9-devops-main-1164319.0 → 4.0.9-devops-main-1168767.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,4 +11,4 @@
11
11
  object-assign
12
12
  (c) Sindre Sorhus
13
13
  @license MIT
14
- */var ue=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;var i=Object.getOwnPropertyNames(t).map((function(e){return t[e]}));if("0123456789"!==i.join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,i,r=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),o=1;o<arguments.length;o++){for(var s in n=Object(arguments[o]))le.call(n,s)&&(r[s]=n[s]);if(ae){i=ae(n);for(var a=0;a<i.length;a++)ce.call(n,i[a])&&(r[i[a]]=n[i[a]])}}return r},de="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",he=Function.call.bind(Object.prototype.hasOwnProperty),fe=function(){};if("production"!==process.env.NODE_ENV){var pe=de,me={},ve=he;fe=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function ge(e,t,n,i,r){if("production"!==process.env.NODE_ENV)for(var o in e)if(ve(e,o)){var s;try{if("function"!=typeof e[o]){var a=Error((i||"React class")+": "+n+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw a.name="Invariant Violation",a}s=e[o](t,o,i,n,null,pe)}catch(e){s=e}if(!s||s instanceof Error||fe((i||"React class")+": type specification of "+n+" `"+o+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof s+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),s instanceof Error&&!(s.message in me)){me[s.message]=!0;var l=r?r():"";fe("Failed "+n+" type: "+s.message+(null!=l?l:""))}}}ge.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(me={})};var ye=ge,be=function(){};function ke(){return null}"production"!==process.env.NODE_ENV&&(be=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}});var we=function(e,t){var n="function"==typeof Symbol&&Symbol.iterator,i="@@iterator";var r="<<anonymous>>",o={array:c("array"),bigint:c("bigint"),bool:c("boolean"),func:c("function"),number:c("number"),object:c("object"),string:c("string"),symbol:c("symbol"),any:l(ke),arrayOf:function(e){return l((function(t,n,i,r,o){if("function"!=typeof e)return new a("Property `"+o+"` of component `"+i+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s))return new a("Invalid "+r+" `"+o+"` of type `"+h(s)+"` supplied to `"+i+"`, expected an array.");for(var l=0;l<s.length;l++){var c=e(s,l,i,r,o+"["+l+"]",de);if(c instanceof Error)return c}return null}))},element:l((function(t,n,i,r,o){var s=t[n];return e(s)?null:new a("Invalid "+r+" `"+o+"` of type `"+h(s)+"` supplied to `"+i+"`, expected a single ReactElement.")})),elementType:l((function(e,t,n,i,r){var o=e[t];return se.isValidElementType(o)?null:new a("Invalid "+i+" `"+r+"` of type `"+h(o)+"` supplied to `"+n+"`, expected a single ReactElement type.")})),instanceOf:function(e){return l((function(t,n,i,o,s){if(!(t[n]instanceof e)){var l=e.name||r;return new a("Invalid "+o+" `"+s+"` of type `"+(((c=t[n]).constructor&&c.constructor.name?c.constructor.name:r)+"` supplied to `")+i+"`, expected instance of `"+l+"`.")}var c;return null}))},node:l((function(e,t,n,i,r){return d(e[t])?null:new a("Invalid "+i+" `"+r+"` supplied to `"+n+"`, expected a ReactNode.")})),objectOf:function(e){return l((function(t,n,i,r,o){if("function"!=typeof e)return new a("Property `"+o+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var s=t[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected an object.");for(var c in s)if(he(s,c)){var u=e(s,c,i,r,o+"."+c,de);if(u instanceof Error)return u}return null}))},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&be(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),ke;return l((function(t,n,i,r,o){for(var l=t[n],c=0;c<e.length;c++)if(s(l,e[c]))return null;var u=JSON.stringify(e,(function(e,t){return"symbol"===f(t)?String(t):t}));return new a("Invalid "+r+" `"+o+"` of value `"+String(l)+"` supplied to `"+i+"`, expected one of "+u+".")}))},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&be("Invalid argument supplied to oneOfType, expected an instance of array."),ke;for(var t=0;t<e.length;t++){var n=e[t];if("function"!=typeof n)return be("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+p(n)+" at index "+t+"."),ke}return l((function(t,n,i,r,o){for(var s=[],l=0;l<e.length;l++){var c=(0,e[l])(t,n,i,r,o,de);if(null==c)return null;c.data&&he(c.data,"expectedType")&&s.push(c.data.expectedType)}return new a("Invalid "+r+" `"+o+"` supplied to `"+i+"`"+(s.length>0?", expected one of type ["+s.join(", ")+"]":"")+".")}))},shape:function(e){return l((function(t,n,i,r,o){var s=t[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected `object`.");for(var c in e){var d=e[c];if("function"!=typeof d)return u(i,r,o,c,f(d));var p=d(s,c,i,r,o+"."+c,de);if(p)return p}return null}))},exact:function(e){return l((function(t,n,i,r,o){var s=t[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected `object`.");var c=ue({},t[n],e);for(var d in c){var p=e[d];if(he(e,d)&&"function"!=typeof p)return u(i,r,o,d,f(p));if(!p)return new a("Invalid "+r+" `"+o+"` key `"+d+"` supplied to `"+i+"`.\nBad object: "+JSON.stringify(t[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var m=p(s,d,i,r,o+"."+d,de);if(m)return m}return null}))}};function s(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function a(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function l(e){if("production"!==process.env.NODE_ENV)var n={},i=0;function o(o,s,l,c,u,d,h){if(c=c||r,d=d||l,h!==de){if(t){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var p=c+":"+l;!n[p]&&i<3&&(be("You are manually calling a React.PropTypes validation function for the `"+d+"` prop on `"+c+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),n[p]=!0,i++)}}return null==s[l]?o?null===s[l]?new a("The "+u+" `"+d+"` is marked as required in `"+c+"`, but its value is `null`."):new a("The "+u+" `"+d+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:e(s,l,c,u,d)}var s=o.bind(null,!1);return s.isRequired=o.bind(null,!0),s}function c(e){return l((function(t,n,i,r,o,s){var l=t[n];return h(l)!==e?new a("Invalid "+r+" `"+o+"` of type `"+f(l)+"` supplied to `"+i+"`, expected `"+e+"`.",{expectedType:e}):null}))}function u(e,t,n,i,r){return new a((e||"React class")+": "+t+" type `"+n+"."+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+r+"`.")}function d(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(d);if(null===t||e(t))return!0;var r=function(e){var t=e&&(n&&e[n]||e[i]);if("function"==typeof t)return t}(t);if(!r)return!1;var o,s=r.call(t);if(r!==t.entries){for(;!(o=s.next()).done;)if(!d(o.value))return!1}else for(;!(o=s.next()).done;){var a=o.value;if(a&&!d(a[1]))return!1}return!0;default:return!1}}function h(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function f(e){if(null==e)return""+e;var t=h(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function p(e){var t=f(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return a.prototype=Error.prototype,o.checkPropTypes=ye,o.resetWarningCache=ye.resetWarningCache,o.PropTypes=o,o};function xe(){}function _e(){}_e.resetWarningCache=xe;var Te=D((function(e){if("production"!==process.env.NODE_ENV){var t=se;e.exports=we(t.isElement,!0)}else e.exports=function(){function e(e,t,n,i,r,o){if(o!==de){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:_e,resetWarningCache:xe};return n.PropTypes=n,n}()}));const Ie=/https?:\/\/(.*?\.)?eko.com/,Ee={"eko.project.interaction":"interaction","eko.project.swipe":"swipe"};let Se=null,Ae=null,Ne=[];function Me(e){return t=>{var n;if(!Ie.test(t.origin)||"eko.embedapi"!==(null===(n=t.data)||void 0===n?void 0:n.source))return;const i=t.data,r=Ee[i.type];r&&(e?e(r,i.data):Ne.push({type:r,data:i.data}))}}"undefined"!=typeof window&&(Ae=Me(null),window.addEventListener("message",Ae));var Fe={subscribe:function(e){"function"==typeof e?Se?console.warn("[eko-gallery-react] Ignoring events subscribe since already subscribed"):(Se=e,Ae=Me(e),window.addEventListener("message",Ae),function(e){Ne.forEach((t=>{e(t.type,t.data)})),Ne=[]}(e)):console.warn("[eko-gallery-react] Ignoring events subscribe since a callback function was not provided as argument")},unsubscribe:function(){Ae?(window.removeEventListener("message",Ae),Ae=null,Se=null,Ne=[]):console.warn("[eko-gallery-react] Ignoring events unsubscribe since not subscribed")},send:function(e,t){Se?Se(e,t):Ne.push({type:e,data:t})}};const Ce=({index:t,activeIndex:n,setActiveIndex:i,item:r,src:o,navItemRefs:s,itemIcon:a})=>{var l,c;const u=null==r||null===(l=r.media)||void 0===l?void 0:l.srcset,d=null==r||null===(c=r.media)||void 0===c?void 0:c.sizes,h=!o&&(null==r?void 0:r.label),f=u?o:function(e,t=200){if(!e)return null;try{let n=e;e.includes("assets.eko.com")&&e.includes("/raw/")&&(n=e.replace("/raw/","/image/"));const i=new URL(n);return i.searchParams.set("width",t),i.href}catch(t){return e}}(o,150);let p=["addons-container",h?"full-thumb-label":""].join(" ").trim();return e.createElement("li",{className:"eko-nav-item","aria-current":n===t,onClick:function(){i(t),function(e){S.track("gallery.interaction",{elementid:`thumbnail-${e}`,interactiontype:"click"}),Fe.send("interaction",{elementid:`thumbnail-${e}`,interactiontype:"click"})}(t)},ref:s.current[t]},e.createElement("button",{type:"button","aria-label":`Go to item ${t}`},!h&&e.createElement("img",{src:f,srcSet:u,sizes:d,alt:null==r?void 0:r.name,loading:"eager",fetchPriority:"high"}),e.createElement("div",{className:p},(null==r?void 0:r.stepsIndication)&&e.createElement("div",{className:"step-indicator"},e.createElement("span",null),e.createElement("span",null),e.createElement("span",null)),(null==r?void 0:r.label)&&e.createElement("div",{className:"thumb-label"},null==r?void 0:r.label)),a&&e.createElement("div",{className:"item-icon"},e.createElement("span",{style:{backgroundImage:`url(${a})`}}))))};Ce.propTypes={index:Te.number,activeIndex:Te.number,setActiveIndex:Te.func.isRequired,item:Te.object.isRequired,src:Te.string,navItemRefs:Te.object.isRequired,itemIcon:Te.string};const Oe=({layout:t,nav:n,isVerticalNav:i,showPrevArrow:r,showNextArrow:o})=>{var s,a,l,c,u;const d=e.useRef(null),h=e.useRef(null),f="arrows"===(null==t||null===(s=t.mobile)||void 0===s||null===(s=s.config)||void 0===s||null===(s=s.navPagination)||void 0===s?void 0:s.type)?"eko-mobile-arrows":"",p="arrows"===(null!==(a=null==t||null===(l=t.desktop)||void 0===l||null===(l=l.config)||void 0===l||null===(l=l.navPagination)||void 0===l?void 0:l.type)&&void 0!==a?a:"arrows")?"eko-desktop-arrows":"",m=f||p,v=i?null==n||null===(c=n.current)||void 0===c?void 0:c.scrollHeight:null==n||null===(u=n.current)||void 0===u?void 0:u.scrollWidth;function g(e){const t=i?n.current.clientHeight:n.current.clientWidth,r=function(e,t){const n=i?t.scrollTop:t.scrollLeft;return Math.max(-n,Math.min(v-e-n,e))}("next"===e?t:-t,n.current);return{top:i?r:0,left:i?0:r,behavior:"smooth"}}function y(e){var t,i,r;const o=g(e),s="next"===e?null==h||null===(t=h.current)||void 0===t?void 0:t.id:null==d||null===(i=d.current)||void 0===i?void 0:i.id;var a,l;window.EkoAnalytics("track","gallery.interaction",{elementid:s,interactiontype:"click"}),null==n||null===(r=n.current)||void 0===r||r.scrollBy(o),a=s,l="click",S.track("gallery.interaction",{elementId:a,interactiontype:l}),Fe.send("interaction",{elementId:a,interactiontype:l})}return e.createElement(e.Fragment,null,m&&e.createElement(e.Fragment,null,e.createElement("button",R({type:"button","aria-label":"Go to previous item","aria-hidden":r?"false":"true",onClick:()=>y("prev"),ref:d,id:"eko-nav-prev-arrow",className:`eko-nav-arrow eko-prev-nav-button ${f} ${p} ${r?"":"eko-hidden-nav-button"}`},r?{}:{tabIndex:"-1"}),e.createElement("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M5.56127 9.52817C5.28966 9.22635 5.28966 8.77361 5.56127 8.502L10.39 3.67331C10.6918 3.37157 11.1445 3.37157 11.4161 3.67331C11.7179 3.94492 11.7179 4.39766 11.4161 4.66927L7.10044 8.98487L11.4161 13.3307C11.7179 13.6023 11.7179 14.055 11.4161 14.3266C11.1445 14.6285 10.6918 14.6285 10.4202 14.3266L5.56127 9.52817Z",fill:"black"}))),e.createElement("button",R({type:"button","aria-label":"Go to next item","aria-hidden":o?"false":"true",onClick:()=>y("next"),ref:h,className:`eko-nav-arrow eko-next-nav-button ${f} ${p} ${o?"":"eko-hidden-nav-button"}`,id:"eko-nav-next-arrow"},o?{}:{tabIndex:"-1"}),e.createElement("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M12.4387 8.47185C12.7103 8.77367 12.7103 9.22641 12.4387 9.49802L7.61003 14.3267C7.30821 14.6284 6.85547 14.6284 6.58386 14.3267C6.28212 14.0551 6.28212 13.6024 6.58386 13.3308L10.8996 9.01515L6.58386 4.66933C6.28212 4.39772 6.28212 3.94499 6.58386 3.67338C6.85547 3.37155 7.30821 3.37155 7.57982 3.67338L12.4387 8.47185Z",fill:"black"})))))};function Pe(e,t,n){let i;return function(){const n=this,r=arguments;clearTimeout(i),i=setTimeout((function(){i=null,e.apply(n,r)}),t)}}Oe.propTypes={layout:Te.object.isRequired,nav:Te.object.isRequired,isVerticalNav:Te.bool.isRequired,showPrevArrow:Te.bool.isRequired,showNextArrow:Te.bool.isRequired};const Re=({items:t,setActiveIndex:n,activeIndex:i,layout:r,carouselMounted:o,forceMobile:s})=>{const l=e.useRef(null),c=e.useRef(null),u=e.useRef([]),d=3,[h,f]=e.useState(null),[p,m]=e.useState(!1),[v,g]=e.useState(0),[y,b]=e.useState(!1),[k,w]=e.useState(!1);function x(){var e;const t=s||window.innerWidth<768?"mobile":"desktop",n=(null==r||null===(e=r[t])||void 0===e||null===(e=e.config)||void 0===e?void 0:e.orientation)||("desktop"===t?"left":"bottom");m("left"===n||"right"===n);const i=c.current.parentNode,a=o?".eko-smart-gallery-container iframe":".eko-carousel",l=i.querySelector(a);setTimeout((()=>{g(l.clientHeight)}),0)}function _(){var e,t;const n=s||a()?"mobile":"desktop",i=null!==(e=null==r||null===(t=r[n])||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.navPagination)||void 0===t?void 0:t.scrollThreshold)&&void 0!==e?e:d;!function(e=d){var t,n;const i=l.current;if(!i)return;const o="none"!==(null==r||null===(t=r.desktop)||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.navPagination)||void 0===t?void 0:t.type),c=(u=null==r||null===(n=r.mobile)||void 0===n||null===(n=n.config)||void 0===n||null===(n=n.navPagination)||void 0===n?void 0:n.type,"mask"===u||"arrows"===u);var u;if((s||a())&&!c)return void i.style.setProperty("-webkit-mask","none");if(!a()&&!o)return void i.style.setProperty("-webkit-mask","none");const h=i.scrollHeight-i.clientHeight,f=i.scrollTop>e?"85%":"100%",m=i.scrollTop<=h-e?"15%":"0%",v=i.scrollWidth-i.clientWidth,g=i.scrollLeft>e?"15%":"0%",y=i.scrollLeft<=v-e?"85%":"100%";p?i.style.setProperty("-webkit-mask",`linear-gradient(0deg,#0000,#000 ${m} ${f},#0000)`):i.style.setProperty("-webkit-mask",`linear-gradient(90deg,#0000,#000 ${g} ${y},#0000)`)}(i),function(e=d){var t,n,i,r,o,s;const a=p?null==l||null===(t=l.current)||void 0===t?void 0:t.scrollTop:null==l||null===(n=l.current)||void 0===n?void 0:n.scrollLeft,c=p?null==l||null===(i=l.current)||void 0===i?void 0:i.clientHeight:null==l||null===(r=l.current)||void 0===r?void 0:r.clientWidth,u=p?null==l||null===(o=l.current)||void 0===o?void 0:o.scrollHeight:null==l||null===(s=l.current)||void 0===s?void 0:s.scrollWidth;u-e<c?(b(!1),w(!1)):a<=e?(b(!1),w(!0)):a+c>u-e?(b(!0),w(!1)):a+e>0&&a<u-e&&(b(!0),w(!0))}(i)}u.current=null==t?void 0:t.map(((t,n)=>{var i,r;return null!==(i=null==u||null===(r=u.current)||void 0===r?void 0:r[n])&&void 0!==i?i:e.createRef()}));const T=Pe((e=>{var t;t=e,S.track("gallery.interaction",{elementid:"nav",interactiontype:t}),Fe.send("interaction",{elementid:"nav",interactiontype:t})}),200);const I=e.useCallback((e=>{n({index:e,step:0,source:"nav"})}),[]);return e.useEffect((()=>{var e;f(null===(e=u.current)||void 0===e?void 0:e[i])}),[i]),e.useEffect((()=>{if(null!=h&&h.current&&null!=l&&l.current){const e=h.current,t=l.current.clientWidth/2,n=e.clientWidth/2,i=l.current.clientHeight/2,r=e.clientHeight/2;l.current.scrollTo({left:e.offsetLeft-t+n,top:e.offsetTop-i+r,behavior:"smooth"})}}),[h]),e.useEffect((()=>{x()}),[]),e.useEffect((()=>(window.addEventListener("resize",x),()=>{window.removeEventListener("resize",x)})),[c,o,s]),e.useEffect((()=>{g(0),x()}),[t,c,o,s]),e.useEffect((()=>{_();const e=new ResizeObserver(_);return e.observe(l.current),()=>{e.disconnect()}}),[t,s,p]),e.createElement("div",{className:"eko-nav-container",ref:c,style:{opacity:v>0?1:0,height:""+(v&&p?v+"px":"auto")}},e.createElement(Oe,{layout:r,nav:l,isVerticalNav:p,showPrevArrow:y,showNextArrow:k}),e.createElement("ul",{className:`eko-nav eko-mobile-nav-selected-${null!==(E=null==r||null===(A=r.mobile)||void 0===A||null===(A=A.config)||void 0===A?void 0:A.navItemsSelectedType)&&void 0!==E?E:"underline"} eko-desktop-nav-selected-${null!==(N=null==r||null===(M=r.desktop)||void 0===M||null===(M=M.config)||void 0===M?void 0:M.navItemsSelectedType)&&void 0!==N?N:"underline"}`,ref:l,onScroll:function(){_()},onWheel:function(){T("wheel")},onTouchMove:function(){T("swipe")}},null==t?void 0:t.map(((t,n)=>{var r;const o=(null==t||null===(r=t.media)||void 0===r?void 0:r.url)||(null==t?void 0:t.media)||"";return e.createElement(Ce,{key:o+n,index:n,activeIndex:i,setActiveIndex:I,item:t,src:o,navItemRefs:u,itemIcon:null==t?void 0:t.icon})}))));var E,A,N,M};Re.propTypes={items:Te.array.isRequired,activeIndex:Te.number,setActiveIndex:Te.func.isRequired,layout:Te.object,carouselMounted:Te.bool,forceMobile:Te.bool};function De(){S.track("gallery.cover.displayed"),Fe.send("gallerycoverdisplayed")}function Le(e){if(!e)return e;try{const t=new URL(e);return t.host.includes("assets.eko.com")&&t.pathname.startsWith("/image")&&!t.searchParams.has("width")?(t.pathname.endsWith(".png")&&(t.pathname=t.pathname.replace(/\.png$/,".webp")),t.searchParams.set("width",1920),t.toString()):e}catch(t){return e}}const Be=({item:t,src:n,srcset:i,sizes:r,isCoverElement:o})=>{const s=e.useRef(null);return e.useEffect((()=>{var e;if(o){if(null===(e=s.current)||void 0===e||!e.complete)return s.current.addEventListener("load",De,{once:!0}),()=>{var e;null===(e=s.current)||void 0===e||e.removeEventListener("load",De,{once:!0})};De()}}),[]),e.createElement("img",{ref:s,src:Le(n),srcSet:i,sizes:r,alt:t.name,fetchPriority:o?"high":"auto",loading:o?"eager":"lazy",style:{width:"100%",height:"100%"}})};Be.propTypes={item:Te.object.isRequired,src:Te.string,srcset:Te.string,sizes:Te.string,isCoverElement:Te.bool};const ze=Pe((e=>{var t;t=e,S.track("gallery.interaction",{elementid:"carousel",interactiontype:t}),Fe.send("interaction",{elementid:"carousel",interactiontype:t})}),200);function We(){ze("wheel")}const $e=e.forwardRef((({items:t,setActiveIndex:n,activeIndex:i,showSmartLoaders:r},o)=>{const s=e.useRef(null),a=e.useRef([]);a.current=null==t?void 0:t.map(((t,n)=>{var i,r;return null!==(i=null==a||null===(r=a.current)||void 0===r?void 0:r[n])&&void 0!==i?i:e.createRef()}));const[l,c]=e.useState(),[u,d]=e.useState(),h=e.useRef(i),f=e.useRef(!1);function p(){const e=function(e){const t=e.scrollLeft,n=e.scrollWidth-e.clientWidth;return 0===t?0:t>n?100:t/n*100}(s.current)*(null==t?void 0:t.length)/100,i=Math.min(Math.trunc(e),(null==t?void 0:t.length)-1),r=h.current;"nav"!==r.source&&"external-nav"!==r.source?(f.current&&i!==r.index&&(f.current=!1),f.current||(i>(null==t?void 0:t.length)-1?n({index:(null==t?void 0:t.length)-1,source:"carousel"}):n({index:i,source:"carousel"}))):i===r.index?f.current=!0:f.current&&i!==r.index&&(f.current=!1,n({index:i,source:"carousel"}))}return e.useImperativeHandle(o,(()=>({prev:()=>{n({index:Math.max(0,h.current.index-1),source:"carousel"})},next:()=>{n({index:Math.min((null==t?void 0:t.length)-1,h.current.index+1),source:"carousel"})}}))),e.useEffect((()=>{const e=s.current;if(e)return e.addEventListener("scroll",p),()=>{e.removeEventListener("scroll",p)}}),[t]),e.useEffect((()=>{var e;let t=null===(e=a.current)||void 0===e?void 0:e[i.index];if(t&&("nav"===i.source||"external-nav"===i.source)){const e=t.current,n=s.current.clientWidth/2,i=(null==e?void 0:e.clientWidth)/2,r=(null==e?void 0:e.offsetLeft)-n+i;s.current.scrollTo({left:r,behavior:"smooth"})}}),[i]),e.useEffect((()=>{h.current=i,"nav"!==i.source&&"external-nav"!==i.source||(f.current=!1)}),[i]),e.createElement("ul",{className:"eko-carousel",ref:s,onScroll:p,onWheel:We,onTouchMove:function(e){d(e.targetTouches[0].clientX)},onTouchStart:function(e){c(e.targetTouches[0].clientX),d(null)},onTouchEnd:function(){u&&l&&(l-u>75||l-u<-75)&&ze("swipe")}},null==t?void 0:t.map(((t,n)=>{const i=(null==t?void 0:t.cover)||(null==t?void 0:t.media),o=(null==i?void 0:i.url)||i;return e.createElement("li",{className:"eko-carousel-item",key:o+n,ref:a.current[n]},e.createElement(Be,{item:t,src:o,srcset:null==i?void 0:i.srcset,sizes:null==i?void 0:i.sizes,isCoverElement:0===n}),r&&"image"!==t.type&&e.createElement("div",{className:"eko-smart-loading"},e.createElement("div",null),e.createElement("p",null,"Loading video experience")))})))}));function je(e){var t;return function(e){var t;return"eko.block.event"===(null==e||null===(t=e.data)||void 0===t?void 0:t.type)}(e)&&"GalleryBlock"===(null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.blockType)}$e.propTypes={items:Te.array.isRequired,setActiveIndex:Te.func.isRequired,activeIndex:Te.object,showSmartLoaders:Te.bool},$e.displayName="CarouselLoop";const Ue="eko.project.invoke",qe="eko.block.invoke";function Ve(e,t,n){var i;null!=e&&e.contentWindow&&(null==e||null===(i=e.contentWindow)||void 0===i||i.postMessage({target:"eko.embedapi",type:t,data:n},"*"))}function Ge(e){return`#variantId=${encodeURIComponent(e)}`}const He=e.forwardRef((({config:t,instanceId:n,setActiveItem:i,activeItem:r,variantId:o,smartGalleryLoaded:s,onLoad:l,forceMobile:c},u)=>{var d,h,f;const p=null!==(d=null===(h=t.options)||void 0===h?void 0:h.galleryEnv)&&void 0!==d?d:"",m=null===(f=t.__autoGenerated)||void 0===f||null===(f=f.publishItem)||void 0===f?void 0:f.id,v=function(e={}){let t="";return Object.entries(e).forEach((([e,n])=>{t+=`&${e}=${n}`})),t}(null==t?void 0:t.qp),g=function(e,t,n){return`https://${e}play.eko.com/embed?${n?`id=${n}`:`piid=${t}`}&nocover=true&galleryBlockMode=gallery&eko_pixel=true`}(p,m,n),y=e.useRef(null),b=e.useRef(null),k=e.useRef(!1),[w,x]=e.useState(Ge(o||"ekonovar")),[_,T]=e.useState(g+v+w);let I;function E(){S.track("gallery.project.display"),l(),Fe.send("galleryloaded")}return e.useImperativeHandle(u,(()=>({prev:()=>{Ve(null==b?void 0:b.current,qe,{action:"onPrevModule"})},next:()=>{Ve(null==b?void 0:b.current,qe,{action:"onNextModule"})}}))),e.useEffect((()=>{k.current?Ve(null==b?void 0:b.current,Ue,{action:"updateVariant",args:{id:o}}):x(Ge(o))}),[o]),e.useEffect((()=>{Ve(null==b?void 0:b.current,qe,{action:"updateActiveModule",args:{activeItemIndex:null==r?void 0:r.index,activeModuleIndex:null==r?void 0:r.step}})}),[r]),e.useEffect((()=>{function e(e){if((function(e){var t;return"eko.project.blockstart"===(null==e||null===(t=e.data)||void 0===t?void 0:t.type)}(e)||function(e){var t,n;return"eko.project.started"===(null==e||null===(t=e.data)||void 0===t?void 0:t.type)&&(null==e||null===(n=e.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.started)}(e))&&!k.current)return t=e.data.data.blockType,k.current=!0,void("GalleryBlock"===t?Ve(null==b?void 0:b.current,qe,{action:"updateActiveModule",args:{activeItemIndex:null==r?void 0:r.index,activeModuleIndex:null==r?void 0:r.step}}):E());var t;if(k.current){if(function(e){var t;return je(e)&&"activeModuleChanged"===(null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.name)}(e))return void function(e){const t=e.data.data.data.activeItemIndex,n=e.data.data.data.activeModuleIndex;t===(null==r?void 0:r.index)&&n===(null==r?void 0:r.step)||i({index:t,step:n,source:"carousel"})}(e);(function(e){var t;return je(e)&&"activeModuleChangeDone"===(null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.name)})(e)&&!s&&E()}}return I=c||a()?"mobile":"desktop",function(e,t={}){window.addEventListener("message",e,t)}(e),()=>{!function(e,t={}){window.removeEventListener("message",e,t)}(e)}}),[r]),e.useEffect((()=>{k.current||Ve(null==b?void 0:b.current,Ue,{action:"queryProjectStarted"})}),[r,s]),e.useEffect((()=>{k.current=!1}),[t]),e.useEffect((()=>{T(g+v+w)}),[w]),e.createElement("div",{className:"eko-smart-gallery-container "+(s?"":"eko-project-not-ready"),ref:y,"data-type":"smart-gallery","data-qp":v,"data-variant":o,"data-device":I},e.createElement("iframe",{allow:"autoplay; fullscreen",title:"eko gallery",src:_,style:{border:0},ref:b}))}));He.propTypes={config:Te.object.isRequired,instanceId:Te.string,setActiveItem:Te.func.isRequired,activeItem:Te.object.isRequired,variantId:Te.string,smartGalleryLoaded:Te.bool,onLoad:Te.func,forceMobile:Te.bool},He.displayName="SmartGallery";const Ke=()=>e.createElement("style",{suppressHydrationWarning:!0},'.eko-gallery {\n --accentColorEko: #000;\n --primaryColorEko: #000;\n --backgroundColorEko: #25D7A2;\n --navItemsBackgroundColorEko: transparent;\n --navItemsBannerBackgroundColorEko: #EEEEEE;\n --carouselItemsBackgroundColorEko: transparent;\n --carouselInteractiveCoverBackgroundColorEko: transparent;\n --galleryGapEkoMobile: 12px;\n --galleryGapEkoDesktop: 12px;\n --galleryPaddingEkoMobile: 0;\n --galleryPaddingEkoDesktop: 0;\n --galleryMaxWidthEkoMobile: 100%;\n --galleryMaxWidthEkoDesktop: 900px;\n --galleryTransition: .8s cubic-bezier(.35, 0, 0, 1) 1.5s;\n --navBarPaddingEkoMobile: 0 0 0 20px;\n --navBarPaddingEkoDesktop: 0;\n --navItemsWidthEkoMobile: 80px;\n --navItemsWidthEkoDesktop: 80px;\n --navItemsHeightEkoMobile: 80px;\n --navItemsHeightEkoDesktop: 80px;\n --navItemsGapEkoMobile: 14px;\n --navItemsGapEkoDesktop: 14px;\n --navItemsRadiusEkoMobile: 8px;\n --navItemsRadiusEkoDesktop: 8px;\n --navItemsSelectedMarginEkoMobile: 3px;\n --navItemsSelectedMarginEkoDesktop: 3px;\n --navItemsSelectedThicknessEkoMobile: 3px;\n --navItemsSelectedThicknessEkoDesktop: 3px;\n --navItemsSelectedUnderlineRadiusEkoMobile: 100px;\n --navItemsSelectedUnderlineRadiusEkoDesktop: 100px;\n --navItemsObjectFitEkoMobile: cover;\n --navItemsObjectFitEkoDesktop: cover;\n --navMediaBadgeSizeEkoMobile: 22px;\n --navMediaBadgeSizeEkoDesktop: 22px;\n --navMediaBadgeMarginTopEkoMobile: 4px;\n --navMediaBadgeMarginTopEkoDesktop: 4px;\n --navMediaBadgeMarginRightEkoMobile: 4px;\n --navMediaBadgeMarginRightEkoDesktop: 4px;\n --carouselItemsAspectRatioEkoMobile: 1 / 1;\n --carouselItemsAspectRatioEkoDesktop: 1 / 1;\n --carouselItemsRadiusEkoMobile: 0px;\n --carouselItemsRadiusEkoDesktop: 12px;\n --carouselItemsObjectFitEkoMobile: cover;\n --carouselItemsObjectFitEkoDesktop: cover;\n --navBannerFontSizeEkoMobile: 12px;\n --navBannerFontSizeEkoDesktop: 12px;\n --navBannerFontLineHeightEkoMobile: 120%;\n --navBannerFontLineHeightEkoDesktop: 120%;\n --navBannerFontFamilyEkoMobile: inherit;\n --navBannerFontFamilyEkoDesktop: inherit;\n --navBannerFontWeightEkoMobile: 400;\n --navBannerFontWeightEkoDesktop: 400;\n --outerWidth: 0\n}\n\n.eko-gallery * {\n box-sizing: border-box\n}\n\n.eko-gallery ul,\n.eko-gallery li {\n padding: 0;\n text-indent: 0;\n list-style-type: none;\n font-size: 0;\n margin: 0\n}\n\n.eko-gallery button {\n border: none;\n padding: 0\n}\n\n.eko-gallery .eko-hidden {\n display: none !important\n}\n\n.eko-gallery .eko-not-visible {\n visibility: hidden !important\n}\n\n.eko-hidden-variant {\n display: none !important\n}\n\n.eko-sr-only {\n width: 1px;\n height: 1px;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n margin: -1px;\n padding: 0;\n position: absolute;\n overflow: hidden\n}\n\n.eko-sticky-top {\n position: sticky;\n top: 0\n}\n\n.eko-gallery .eko-nav {\n height: 100%;\n display: flex;\n align-items: start;\n align-self: start;\n flex-shrink: 0;\n scrollbar-width: none;\n -ms-overflow-style: none\n}\n\n.eko-gallery .eko-nav li {\n font-size: 0;\n position: relative;\n display: flex;\n flex-shrink: 0;\n justify-content: center;\n -webkit-box-pack: center;\n cursor: pointer\n}\n\n.eko-gallery .eko-nav li button {\n position: relative;\n background-color: transparent;\n border-radius: 0;\n line-height: 0;\n overflow: hidden;\n cursor: pointer\n}\n\n.eko-gallery .eko-nav li button img {\n background-color: var(--navItemsBackgroundColorEko);\n pointer-events: none\n}\n\n.eko-gallery .eko-nav li button .item-icon {\n position: absolute;\n top: 0;\n right: 0;\n width: 32px;\n height: 32px;\n transform: scale(.25);\n transform-origin: top right\n}\n\n.eko-gallery .eko-nav li button .item-icon span {\n display: block;\n width: 400%;\n height: 400%;\n position: absolute;\n top: 0;\n right: 0;\n background-position: top right;\n background-repeat: no-repeat;\n background-size: contain\n}\n\n.eko-gallery .eko-nav li .addons-container {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n display: flex;\n flex-direction: column;\n font-size: 10px;\n line-height: 100%\n}\n\n.eko-gallery .eko-nav li .addons-container .thumb-label {\n width: 100%;\n background: var(--navItemsBannerBackgroundColorEko);\n padding: 4px;\n text-align: center;\n text-wrap: balance;\n color: var(--primaryColorEko)\n}\n\n.eko-gallery .eko-nav li .addons-container .step-indicator {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: center;\n gap: 5px;\n padding: 6px\n}\n\n.eko-gallery .eko-nav li .addons-container .step-indicator span {\n width: 5px;\n height: 5px;\n border-radius: 100px;\n background: #fff;\n box-shadow: 0 0 3px #00000094\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label {\n position: relative\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label .step-indicator {\n position: absolute;\n bottom: 0\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label .thumb-label {\n align-content: center\n}\n\n.eko-gallery .eko-nav::-webkit-scrollbar {\n display: none\n}\n\n.eko-nav-container {\n display: flex\n}\n\n.eko-nav-container:has(.eko-nav.eko-not-visible) .eko-nav-arrow {\n display: none\n}\n\n.eko-nav-container {\n position: relative;\n opacity: 0;\n transition: opacity .15s ease-in\n}\n\n.eko-nav-container .eko-nav-arrow {\n width: 28px;\n height: 28px;\n position: absolute;\n display: none;\n justify-content: center;\n align-items: center;\n border-radius: 28px;\n background-color: #fff;\n box-shadow: 0 0 6px #0000001f;\n z-index: 1;\n bottom: 50%;\n opacity: 1;\n transition: opacity .15s ease-in;\n transform: translateY(50%);\n cursor: pointer\n}\n\n.eko-nav-container .eko-nav-arrow.eko-prev-nav-button svg,\n.eko-nav-container .eko-nav-arrow.eko-next-nav-button svg {\n padding: 1px\n}\n\n.eko-nav-container .eko-nav-arrow.eko-prev-nav-button {\n left: 8px\n}\n\n.eko-nav-container .eko-nav-arrow.eko-next-nav-button {\n right: 8px\n}\n\n.eko-nav-container .eko-nav-arrow.eko-hidden-nav-button {\n opacity: 0;\n pointer-events: none\n}\n\n.eko-gallery .eko-nav {\n gap: var(--navItemsGapEkoMobile);\n padding: var(--navBarPaddingEkoMobile)\n}\n\n.eko-gallery .eko-nav li button img {\n width: var(--navItemsWidthEkoMobile);\n height: var(--navItemsHeightEkoMobile);\n object-fit: var(--navItemsObjectFitEkoMobile)\n}\n\n.eko-gallery .eko-nav li .addons-container .thumb-label {\n font-family: var(--navBannerFontFamilyEkoMobile);\n font-size: var(--navBannerFontSizeEkoMobile);\n line-height: var(--navBannerFontLineHeightEkoMobile);\n font-weight: var(--navBannerFontWeightEkoMobile)\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label .thumb-label {\n width: var(--navItemsWidthEkoMobile);\n height: var(--navItemsHeightEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-underline li {\n padding-bottom: calc(var(--navItemsSelectedThicknessEkoMobile) + var(--navItemsSelectedMarginEkoMobile))\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-underline li button {\n border-radius: var(--navItemsRadiusEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-underline li[aria-current=true]:after {\n content: "";\n width: 100%;\n height: var(--navItemsSelectedThicknessEkoMobile);\n border-radius: var(--navItemsSelectedUnderlineRadiusEkoMobile);\n background-color: var(--accentColorEko);\n display: block;\n position: absolute;\n bottom: 0;\n left: 0\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-outline li {\n padding: var(--navItemsSelectedMarginEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-outline li button {\n border-radius: var(--navItemsRadiusEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-outline li[aria-current=true] {\n border-radius: calc(var(--navItemsRadiusEkoMobile) + var(--navItemsSelectedMarginEkoMobile));\n box-shadow: 0 0 0 var(--navItemsSelectedThicknessEkoMobile) var(--accentColorEko)\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery .eko-nav {\n gap: var(--navItemsGapEkoDesktop);\n padding: var(--navBarPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li button img {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop);\n object-fit: var(--navItemsObjectFitEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .addons-container .thumb-label {\n font-family: var(--navBannerFontFamilyEkoDesktop);\n font-size: var(--navBannerFontSizeEkoDesktop);\n line-height: var(--navBannerFontLineHeightEkoDesktop);\n font-weight: var(--navBannerFontWeightEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .addons-container.full-thumb-label .thumb-label {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li {\n border-radius: 0;\n padding: 0;\n padding-bottom: calc(var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop))\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true] {\n box-shadow: none\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true]:after {\n content: "";\n width: 100%;\n height: var(--navItemsSelectedThicknessEkoDesktop);\n border-radius: var(--navItemsSelectedUnderlineRadiusEkoDesktop);\n background-color: var(--accentColorEko);\n display: block;\n position: absolute;\n bottom: 0;\n left: 0\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li {\n padding: var(--navItemsSelectedMarginEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true] {\n border-radius: calc(var(--navItemsRadiusEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop));\n box-shadow: 0 0 0 var(--navItemsSelectedThicknessEkoDesktop) var(--accentColorEko)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true]:after {\n content: none\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container .eko-nav-arrow {\n width: 30px;\n height: 30px\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container .eko-nav-arrow.eko-desktop-arrows {\n display: flex\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container:has(.eko-desktop-nav-selected-underline) .eko-nav-arrow.eko-desktop-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop)) / 2))\n }\n}\n\n@media screen and (max-width: 767px) {\n .eko-gallery.eko-liquid-gallery .eko-nav-arrow.eko-mobile-arrows {\n display: flex\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container:has(.eko-mobile-nav-selected-underline) .eko-nav-arrow.eko-mobile-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoMobile) + var(--navItemsSelectedMarginEkoMobile)) / 2))\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav {\n gap: var(--navItemsGapEkoDesktop);\n padding: var(--navBarPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li button img {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop);\n object-fit: var(--navItemsObjectFitEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .addons-container .thumb-label {\n font-family: var(--navBannerFontFamilyEkoDesktop);\n font-size: var(--navBannerFontSizeEkoDesktop);\n line-height: var(--navBannerFontLineHeightEkoDesktop);\n font-weight: var(--navBannerFontWeightEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .addons-container.full-thumb-label .thumb-label {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li {\n border-radius: 0;\n padding: 0;\n padding-bottom: calc(var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop))\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true] {\n box-shadow: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true]:after {\n content: "";\n width: 100%;\n height: var(--navItemsSelectedThicknessEkoDesktop);\n border-radius: var(--navItemsSelectedUnderlineRadiusEkoDesktop);\n background-color: var(--accentColorEko);\n display: block;\n position: absolute;\n bottom: 0;\n left: 0\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li {\n padding: var(--navItemsSelectedMarginEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true] {\n border-radius: calc(var(--navItemsRadiusEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop));\n box-shadow: 0 0 0 var(--navItemsSelectedThicknessEkoDesktop) var(--accentColorEko)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true]:after {\n content: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav-container .eko-nav-arrow {\n width: 30px;\n height: 30px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav-container .eko-nav-arrow.eko-desktop-arrows {\n display: flex\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav-container:has(.eko-desktop-nav-selected-underline) .eko-nav-arrow.eko-desktop-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop)) / 2))\n }\n}\n\n@media screen and (max-width: 767px) {\n .eko-gallery.eko-react-gallery.eko-mobile .eko-nav-arrow.eko-mobile-arrows {\n display: flex\n }\n\n .eko-gallery.eko-react-gallery.eko-mobile .eko-nav-container:has(.eko-mobile-nav-selected-underline) .eko-nav-arrow.eko-mobile-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoMobile) + var(--navItemsSelectedMarginEkoMobile)) / 2))\n }\n}\n\n.eko-media-badge {\n display: none;\n width: var(--navMediaBadgeSizeEkoMobile);\n height: var(--navMediaBadgeSizeEkoMobile);\n background: #fff;\n align-items: center;\n justify-content: center;\n border-radius: 100%;\n box-shadow: 0 0 4px #00000014;\n place-content: center;\n position: absolute;\n top: var(--navMediaBadgeMarginTopEkoMobile);\n right: var(--navMediaBadgeMarginRightEkoMobile)\n}\n\n.eko-media-badge svg {\n width: 100%;\n height: 100%\n}\n\n.eko-media-badge svg path {\n fill: #000\n}\n\n.eko-nav li .eko-media-badge-mobile {\n display: flex\n}\n\nsvg.interactiveThumb {\n position: absolute;\n top: 3px;\n right: -2.5px;\n width: 100%;\n height: 100%\n}\n\nsvg.interactiveThumb.hand {\n animation: handAnim 2.5s linear infinite\n}\n\nsvg.interactiveThumb.beam {\n animation: beamAnim 2.5s linear infinite;\n transform-origin: 26% 40%;\n top: 0\n}\n\n@keyframes handAnim {\n 0% {\n transform: translateY(0)\n }\n\n 3% {\n transform: translateY(-4px)\n }\n\n 15% {\n transform: translateY(0)\n }\n\n to {\n transform: translateY(0)\n }\n}\n\n@keyframes beamAnim {\n 0% {\n transform: scale(1);\n opacity: 0\n }\n\n 5% {\n transform: scale(1.1);\n opacity: 1\n }\n\n 30% {\n transform: scale(1.4);\n opacity: 0\n }\n\n to {\n transform: scale(1.4);\n opacity: 0\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery .eko-media-badge {\n width: var(--navMediaBadgeSizeEkoDesktop);\n height: var(--navMediaBadgeSizeEkoDesktop);\n top: var(--navMediaBadgeMarginTopEkoDesktop);\n right: var(--navMediaBadgeMarginRightEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .eko-media-badge-mobile {\n display: none\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .eko-media-badge-desktop {\n display: flex\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-media-badge {\n width: var(--navMediaBadgeSizeEkoDesktop);\n height: var(--navMediaBadgeSizeEkoDesktop);\n top: var(--navMediaBadgeMarginTopEkoDesktop);\n right: var(--navMediaBadgeMarginRightEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .eko-media-badge-mobile {\n display: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .eko-media-badge-desktop {\n display: flex\n }\n}\n\n.eko-loading-animation {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow: hidden;\n pointer-events: none\n}\n\n.eko-loading-animation.eko-show-loading-animation .eko-animated-bar {\n opacity: .6\n}\n\n.eko-loading-animation.eko-show-loading-animation .eko-animated-bar .eko-animated-bar-inner {\n animation: eko-loading-bar-inner-animation 2s infinite\n}\n\n.eko-loading-animation.eko-show-loading-text .eko-loading-text {\n opacity: 1\n}\n\n.eko-loading-animation .eko-animated-bar {\n width: 100%;\n height: 4px;\n background-color: #e8e8e8b2;\n opacity: 0;\n transition: opacity .5s;\n position: relative\n}\n\n.eko-loading-animation .eko-animated-bar .eko-animated-bar-inner {\n width: 150px;\n height: 100%;\n transform: translate(-150px);\n background-color: var(--accentColorEko, #4d484b);\n display: block;\n position: absolute\n}\n\n.eko-loading-animation .eko-loading-text {\n position: absolute;\n top: 10px;\n left: 50%;\n transform: translate(-50%);\n color: #656565;\n font-size: 12px;\n font-family: Bogle-Medium, sans-serif;\n font-weight: 500;\n opacity: 0;\n align-items: center;\n display: flex;\n gap: 2px;\n transition: opacity .5s\n}\n\n.eko-loading-animation .eko-loading-text-icon {\n opacity: 60%\n}\n\n.eko-loading-animation .eko-loading-text-icon svg {\n transform: translate(2px, 2px)\n}\n\n.eko-loading-animation .eko-loading-text-icon path {\n fill: var(--accentColorEko, #4d484b)\n}\n\n.eko-loading-animation.eko-hide-icon .eko-loading-text-icon {\n display: none\n}\n\n@keyframes eko-loading-bar-inner-animation {\n 0% {\n left: -350px\n }\n\n to {\n left: calc(100% + 350px)\n }\n}\n\n.eko-smart-loading {\n position: absolute;\n top: 8px;\n left: 50%;\n transform: translate(-50%);\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px\n}\n\n.eko-smart-loading div {\n position: relative;\n width: 158px;\n height: 3px;\n background-color: #dcdcdc;\n overflow: hidden;\n opacity: 0;\n animation: eko-smart-loading-show-animation .2s linear forwards 1s\n}\n\n.eko-smart-loading div:after {\n content: "";\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background-color: #878787;\n animation: eko-smart-loading-animation 2.5s ease-in-out infinite\n}\n\n.eko-smart-loading p {\n font-size: 11px;\n line-height: 120%;\n font-weight: 500;\n color: #6b6b6b;\n text-shadow: 0 0 2px white;\n opacity: 0;\n animation: eko-smart-loading-show-animation .2s linear forwards 3s\n}\n\n@keyframes eko-smart-loading-animation {\n 0% {\n transform: translate(-100%)\n }\n\n to {\n transform: translate(100%)\n }\n}\n\n@keyframes eko-smart-loading-show-animation {\n 0% {\n opacity: 0\n }\n\n to {\n opacity: 100%\n }\n}\n\n@media screen and (min-width: 450px) {\n .eko-gallery.eko-liquid-gallery .eko-loading-animation .eko-animated-bar {\n height: 6px\n }\n\n .eko-gallery.eko-liquid-gallery .eko-loading-animation .eko-loading-text {\n font-size: 16px;\n top: 12px\n }\n\n .eko-gallery.eko-liquid-gallery .eko-loading-animation .eko-loading-text-icon {\n transform: rotate(180deg)\n }\n}\n\n@media screen and (min-width: 450px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-loading-animation .eko-animated-bar {\n height: 6px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-loading-animation .eko-loading-text {\n font-size: 16px;\n top: 12px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-loading-animation .eko-loading-text-icon {\n transform: rotate(180deg)\n }\n}\n\n.eko-carousel {\n width: 100%;\n white-space: nowrap;\n overflow-x: auto;\n overflow-y: hidden;\n scroll-snap-type: x mandatory;\n overscroll-behavior-x: contain;\n align-self: start;\n align-items: start;\n display: flex;\n gap: 10px;\n scrollbar-width: none;\n -ms-overflow-style: none\n}\n\n.eko-carousel li {\n width: 100%;\n display: inline-block;\n position: relative;\n align-items: start;\n overflow: hidden;\n scroll-snap-align: center;\n scroll-snap-stop: always;\n flex-shrink: 0\n}\n\n.eko-carousel li img.eko-cover-image {\n position: relative;\n pointer-events: none;\n transition: opacity .5s;\n z-index: 1;\n width: 100%;\n height: 100%;\n background-color: var(--carouselInteractiveCoverBackgroundColorEko)\n}\n\n.eko-carousel li iframe {\n position: absolute;\n border: none;\n top: 0;\n left: 0\n}\n\n.eko-carousel li img,\n.eko-carousel li video {\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n min-width: 0;\n background-color: var(--carouselItemsBackgroundColorEko)\n}\n\n.eko-carousel li[data-type=videoembed],\n.eko-carousel li[data-type=video] {\n cursor: pointer\n}\n\n.eko-carousel::-webkit-scrollbar {\n display: none\n}\n\n.eko-carousel:has(.zoomed) {\n overflow: hidden\n}\n\n.eko-carousel li {\n border-radius: var(--carouselItemsRadiusEkoMobile)\n}\n\n.eko-carousel li img.eko-desktop-cover-image {\n display: none\n}\n\n.eko-carousel li img.eko-mobile-cover-image {\n display: inline\n}\n\n.eko-carousel li img,\n.eko-carousel li video {\n aspect-ratio: var(--carouselItemsAspectRatioEkoMobile);\n object-fit: var(--carouselItemsObjectFitEkoMobile)\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery .eko-carousel li {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-carousel li img,\n .eko-gallery.eko-liquid-gallery .eko-carousel li video {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop);\n object-fit: var(--carouselItemsObjectFitEkoDesktop)\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-carousel li {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-carousel li img,\n .eko-gallery.eko-react-gallery.eko-desktop .eko-carousel li video {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop);\n object-fit: var(--carouselItemsObjectFitEkoDesktop)\n }\n}\n\n.eko-gallery.eko-mobile-embed-layout .eko-nav-container {\n display: none\n}\n\n.eko-gallery.eko-mobile-embed-layout .eko-carousel {\n overflow-x: hidden\n}\n\n.eko-gallery.eko-mobile-embed-layout .eko-mobile-carousel-scroll {\n overflow-x: auto\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery.eko-desktop-embed-layout .eko-nav-container {\n display: none\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-embed-layout .eko-carousel {\n overflow-x: hidden\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-embed-layout .eko-carousel.eko-desktop-carousel-scroll {\n overflow-x: auto\n }\n\n .eko-gallery.eko-liquid-gallery.eko-mobile-embed-layout.eko-desktop-nav-layout .eko-nav-container {\n display: flex\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-embed-layout .eko-nav-container {\n display: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-embed-layout .eko-carousel {\n overflow-x: hidden\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-embed-layout .eko-carousel.eko-desktop-carousel-scroll {\n overflow-x: auto\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-mobile-embed-layout.eko-desktop-nav-layout .eko-nav-container {\n display: flex\n }\n}\n\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-bottom .eko-nav,\n.eko-gallery.eko-desktop-nav-layout.eko-desktop-nav-bottom .eko-nav,\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-top .eko-nav,\n.eko-gallery.eko-desktop-nav-layout.eko-desktop-nav-top .eko-nav {\n flex-direction: row;\n overflow-x: auto;\n overflow-y: hidden;\n max-width: 100%;\n margin: auto\n}\n\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-bottom {\n flex-direction: column-reverse\n}\n\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-top {\n flex-direction: column\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-bottom {\n flex-direction: column-reverse\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-top {\n flex-direction: column\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-bottom {\n flex-direction: column-reverse\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-top {\n flex-direction: column\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right {\n flex-direction: row-reverse\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left {\n flex-direction: row\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav {\n display: flex;\n flex-direction: column;\n justify-content: start;\n overflow-x: hidden;\n overflow-y: auto;\n gap: var(--navItemsGapEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container {\n display: flex;\n flex-shrink: 0\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button {\n top: 4px;\n left: auto\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n bottom: 4px\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n right: 50%;\n transform: translate(50%)\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg {\n transform: rotate(90deg)\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout .eko-carousel {\n align-self: start\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right {\n flex-direction: row-reverse\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left {\n flex-direction: row\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav {\n display: flex;\n flex-direction: column;\n justify-content: start;\n overflow-x: hidden;\n overflow-y: auto;\n gap: var(--navItemsGapEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container {\n display: flex;\n flex-shrink: 0\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button {\n top: 4px;\n left: auto\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n bottom: 4px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n right: 50%;\n transform: translate(50%)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg {\n transform: rotate(90deg)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout .eko-carousel {\n align-self: start\n }\n}\n\n.eko-gallery .eko-introButton {\n cursor: pointer;\n white-space: nowrap;\n pointer-events: auto;\n position: absolute;\n bottom: 100px;\n left: 50%;\n transform: translate(-50%);\n padding: 15px 20px\n}\n\n.eko-gallery .eko-introButton .eko-handContainer {\n display: none\n}\n\n.eko-gallery {\n position: relative;\n overflow: hidden;\n display: flex;\n flex-direction: row;\n justify-content: start;\n margin-inline-start: calc(-1 * var(--outerWidth));\n margin-inline-end: calc(-1 * var(--outerWidth));\n padding: var(--galleryPaddingEkoMobile);\n margin: auto;\n max-width: var(--galleryMaxWidthEkoMobile);\n transition: height var(--galleryTransition, .8s cubic-bezier(.35, 0, 0, 1) 1.5s), padding 0s;\n gap: var(--galleryGapEkoMobile)\n}\n\n.eko-gallery .eko-smart-gallery-container {\n border-radius: var(--carouselItemsRadiusEkoMobile);\n overflow: hidden;\n flex: 1;\n display: flex;\n height: fit-content\n}\n\n.eko-gallery .eko-smart-gallery-container iframe {\n width: 100%;\n aspect-ratio: var(--carouselItemsAspectRatioEkoMobile)\n}\n\n.eko-gallery .eko-smart-gallery-container.eko-project-not-ready {\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n opacity: 0;\n pointer-events: none;\n touch-action: none\n}\n\n.eko-gallery .eko-smart-gallery-container.eko-project-not-ready iframe {\n pointer-events: none;\n touch-action: none\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery {\n max-width: var(--galleryMaxWidthEkoDesktop);\n gap: var(--galleryGapEkoDesktop);\n padding: var(--galleryPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-smart-gallery-container {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-smart-gallery-container iframe {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop)\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop {\n max-width: var(--galleryMaxWidthEkoDesktop);\n gap: var(--galleryGapEkoDesktop);\n padding: var(--galleryPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-smart-gallery-container {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-smart-gallery-container iframe {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop)\n }\n}'),Xe=({layout:t,style:n})=>{let i={};return function(e={}){Object.keys(e).forEach((t=>{i[`--${t}Eko`]=e[t]}))}(n),function(e){var t,n;const r=(null==e||null===(t=e.desktop)||void 0===t?void 0:t.config)||{},o=(null==e||null===(n=e.mobile)||void 0===n?void 0:n.config)||{};Object.keys(r).forEach((e=>{"string"==typeof r[e]&&(i[`--${e}EkoDesktop`]=r[e])})),Object.keys(o).forEach((e=>{"string"==typeof o[e]&&(i[`--${e}EkoMobile`]=o[e])}))}(t),e.createElement("style",{key:{layout:t,style:n}},`.eko-gallery {${Object.keys(i).map((e=>`${e}: ${i[e]};`)).join("\n")}}`)};Xe.propTypes={layout:Te.object,style:Te.object},u("experiment");const Ye=({activeVariantId:t,activeElementId:n,hasInteractive:i,experiments:r,publishItem:o})=>{const s="gallery",a=e.useRef(t),l=e.useRef(n),c=e.useRef(i),u=e.useRef(r),d=e.useRef(o);e.useEffect((()=>{a.current=t,l.current=n,c.current=i,u.current=r,d.current=o}),[t,n,i,r,o]);const h={publishItemPacker:{tag:s,schema:"iglu:com.helloeko/publishitem/jsonschema/1-0-0",match:/.*/,getData:function(){const e=d.current;if(e){const t={};return null!=e&&e.id&&(t.id=e.id),null!=e&&e.productId&&(t.productid=e.productId),e.salesChannelId&&(t.saleschannelid=e.salesChannelId),null!=e&&e.salesChannelName&&(t.saleschannelname=e.salesChannelName),e.salesChannelType&&(t.saleschanneltype=e.salesChannelType),t.id?t:void 0}}},galleryInteractionPacker:{tag:s,schema:"iglu:com.helloeko/gallery_interaction/jsonschema/1-0-0",match:"gallery.interaction",getData:function({elementid:e,interactiontype:t}){return{elementid:String(e),interactiontype:t}}},galleryPacker:{tag:s,schema:"iglu:com.helloeko/gallery/jsonschema/1-0-2",match:/^gallery.*/,getData:function(){var e;return{activeitemid:l.current.toString(),activevariantid:a.current,hasinteractive:c.current,version:(null===(e=window.eko)||void 0===e||null===(e=e.gallery)||void 0===e?void 0:e.version)||""}}},activeVariantIdPacker:{tag:s,schema:"iglu:com.helloeko/variant/jsonschema/1-0-1",match:/.*/,getData:function(){if(a.current)return{id:a.current}}},experimentPacker:{tag:s,schema:"iglu:com.helloeko/experiment/jsonschema/1-0-3",match:/.*/,getData:function(){var e;let t=function(e){let t=null;if(e){const n=Math.floor(Date.now()/1e3);for(const i of e){if("deliverable"!==i.type)return;const e=Math.floor(new Date(i.startDate).getTime()/1e3),r=Math.floor(new Date(i.endDate).getTime()/1e3);!0===i.active&&n>e&&n<r&&(t=i)}}return t}(u.current);if(!t)return;let n={experimentid:t.id||"",experimentvariant:t.chosen||"pending decision",experimenttype:t.type||""},i=null===(e=t.targetDevice)||void 0===e?void 0:e.toLowerCase();return"mobile"!==i&&"notmobile"!==i||(n.experimenttargeting={device:i}),n}}};return e.useEffect((()=>(Object.values(h).forEach((e=>{window.EkoAnalytics("registerContextPacker",e)})),()=>{window.EkoAnalytics("reset",s)})),[]),null};Ye.propTypes={activeVariantId:Te.string,activeElementId:Te.number,hasInteractive:Te.bool,experiments:Te.array,publishItem:Te.object};const Qe=({variantId:t,activeItem:n,hasInteractive:i,activeIndex:r,experiments:o,publishItem:s})=>{const a=e.useRef(!0);return e.useEffect((()=>{a.current||t&&S.track("gallery.variant.change")}),[t]),e.useEffect((()=>{a.current||S.track("gallery.element.change",{activeIndex:r})}),[r]),e.useEffect((()=>{a.current||n&&null!=s&&s.id&&S.track("gallery.asset.view",{publishitemid:s.id,type:n.type,name:n.name})}),[n]),e.useEffect((()=>{a.current=!1}),[]),e.createElement(Ye,{activeVariantId:t||"ekonovar",activeElementId:r,hasInteractive:i,experiments:o,publishItem:s})};Qe.propTypes={variantId:Te.string,activeItem:Te.object,hasInteractive:Te.bool,activeIndex:Te.number,experiments:Te.array,publishItem:Te.object};const Je="eko-gallery-react";function Ze(e,t){var n,i,r;const o=(null==e||null===(n=e.variantMap)||void 0===n?void 0:n[t])||"ekonovar";return(null==e||null===(i=e.items)||void 0===i?void 0:i.find((e=>(null==e?void 0:e.variantId)===o)))||(null==e||null===(r=e.items)||void 0===r?void 0:r[0])}"undefined"!=typeof window&&(window.EkoAnalytics||(console.log("EkoAnalytics is not defined, initializing a no-op function..."),window.EkoAnalytics=()=>{}));const et=e.forwardRef((({className:t,config:n,instanceId:i,variantId:r,activeItem:o={index:0,step:0},onEvent:s,forceMobile:a},l)=>{var c,u,d,h,f,p;const m=null!==(c=null===(u=n.options)||void 0===u?void 0:u.loadingTimeout)&&void 0!==c?c:12,v=null===(d=null===(h=n.options)||void 0===h?void 0:h.showCoverLoadAnimation)||void 0===d||d,[g,y]=e.useState(Ze(n,r)),[b,k]=e.useState({index:o.index,step:o.step,source:"external-nav"}),[w,x]=e.useState(!1),[_,T]=e.useState(!1),[I,E]=e.useState("eko-desktop"),A=e.useRef(!1),N=e.useRef(!1),M=e.useRef(o),F=e.useRef(null),C=e.useRef(r);function O(){const e=a||window.innerWidth<768?"eko-mobile":"eko-desktop";E(e)}return N.current||(Fe.send("galleryinit"),N.current=!0),e.useEffect((()=>{const e=C.current!==r;C.current=r,y(Ze(n,r)),e&&!A.current&&k({index:0,step:0,source:"external-nav"})}),[n,r]),e.useEffect((()=>{if(s)return Fe.subscribe(s),()=>{Fe.unsubscribe()}}),[s]),e.useEffect((()=>{A.current=_}),[_]),e.useEffect((()=>{x(!1),T(!1);const e=setTimeout((()=>{A.current||(x(!0),S.track("gallery.load.timeout"))}),1e3*m);return()=>{clearTimeout(e)}}),[n]),e.useEffect((()=>{O()}),[a]),e.useEffect((()=>(window.addEventListener("resize",O),O(),()=>{window.removeEventListener("resize",O)})),[a]),e.useEffect((()=>(window.EkoAnalytics("trackElementVisibility",F.current,Je),()=>{window.EkoAnalytics("stopTrackingElementVisibility",Je)})),[]),e.useEffect((()=>{!("carousel"===(null==b?void 0:b.source)||"nav"===(null==b?void 0:b.source))||(null==b?void 0:b.index)===o.index&&(null==b?void 0:b.step)===o.step||Fe.send("activeitemchanged",{index:null==b?void 0:b.index,step:null==b?void 0:b.step})}),[b,o]),e.useEffect((()=>{M.current.index===o.index&&M.current.step===o.step||(M.current=o,k({index:o.index,step:o.step,source:"external-nav"}))}),[o]),e.createElement(e.Fragment,null,e.createElement(Ke,null),e.createElement(Xe,{layout:n.layout,style:n.style,forceMobile:a}),e.createElement(Qe,{variantId:r,activeItem:null==g||null===(f=g.items)||void 0===f?void 0:f[b.index],activeIndex:b.index,hasInteractive:_,experiments:n.experiments,publishItem:null==n||null===(p=n.__autoGenerated)||void 0===p?void 0:p.publishItem}),e.createElement("section",{className:`${`eko-gallery eko-react-gallery ${function(e){let t="";return["mobile","desktop"].forEach((n=>{var i,r;const o=null!==(i=null==e||null===(r=e[n])||void 0===r?void 0:r.type)&&void 0!==i?i:"nav";if(t+=`eko-${n}-${o}-layout `,"nav"===o){var s;const i="desktop"===n,r=(null==e||null===(s=e[n])||void 0===s||null===(s=s.config)||void 0===s?void 0:s.orientation)||(i?"left":"bottom");t+=`eko-${n}-nav-${r} `}})),t}(n.layout)} ${null!=t?t:""}`.trim()} ${I}`,"aria-controls":"main-content",ref:F},e.createElement(Re,{items:(null==g?void 0:g.items)||[],setActiveIndex:k,activeIndex:b.index,layout:n.layout,carouselMounted:_,forceMobile:a}),!_&&e.createElement($e,{ref:l,items:(null==g?void 0:g.items)||[],setActiveIndex:k,activeIndex:{index:b.index,source:null==b?void 0:b.source},showSmartLoaders:!w&&v}),!w&&e.createElement(He,{ref:l,config:n,instanceId:i,activeItem:b,setActiveItem:k,variantId:null==g?void 0:g.variantId,smartGalleryLoaded:_,forceMobile:a,onLoad:function(){T(!0)}})))}));et.propTypes={className:Te.string,config:Te.object.isRequired,instanceId:Te.string,variantId:Te.string,activeItem:Te.object,onEvent:Te.func,forceMobile:Te.bool,onPrev:Te.func,onNext:Te.func},et.displayName="EkoGallery";var tt=e.memo(et);const nt=u("gallery-react");const it=e.forwardRef(((t,n)=>{var i;e.useEffect((()=>(nt.setDataStorage("gallery-react",{config:t.config}),window.eko=window.eko||{},window.eko.config=t.config,window.eko.gallery={version:"devops-main/4.0.8"},()=>{window.eko.config=void 0})),[t.config]);const{children:r,...o}=t;return void 0!==t.config?e.createElement(tt,R({ref:n},o,{key:null===(i=t.config.__autoGenerated)||void 0===i||null===(i=i.publishItem)||void 0===i?void 0:i.id})):r}));it.propTypes={className:Te.string,config:Te.object,variantId:Te.string,onEvent:Te.func,instanceId:Te.string,children:Te.node},it.displayName="EkoGalleryWrapper";var rt,ot,st,at,lt,ct,ut,dt,ht,ft,pt,mt,vt,gt,yt,bt,kt,wt,xt,_t,Tt,It,Et,St,At,Nt,Mt,Ft,Ct,Ot,Pt,Rt,Dt,Lt,Bt,zt,Wt,$t,jt,Ut,qt,Vt,Gt,Ht,Kt,Xt,Yt,Qt,Jt,Zt,en,tn,nn=e.memo(it);const rn=1,on=2,sn=4,an=8,ln=16,cn=1,un=4,dn=8,hn=16,fn="[",pn="[!",mn="]",vn={},gn=Symbol(),yn=Symbol("filename"),bn="http://www.w3.org/1999/xhtml",kn="@attach",wn=!0;var xn=Array.isArray,_n=Array.prototype.indexOf,Tn=Array.from,In=Object.defineProperty,En=Object.getOwnPropertyDescriptor,Sn=Object.getOwnPropertyDescriptors,An=Object.prototype,Nn=Array.prototype,Mn=Object.getPrototypeOf,Fn=Object.isExtensible;function Cn(){var e,t;return{promise:new Promise(((n,i)=>{e=n,t=i})),resolve:e,reject:t}}const On=2,Pn=4,Rn=8,Dn=1<<24,Ln=16,Bn=32,zn=64,Wn=128,$n=512,jn=1024,Un=2048,qn=4096,Vn=8192,Gn=16384,Hn=32768,Kn=65536,Xn=1<<17,Yn=1<<18,Qn=1<<19,Jn=1<<20,Zn=1<<25,ei=32768,ti=1<<21,ni=1<<22,ii=1<<23,ri=Symbol("$state"),oi=Symbol("legacy props"),si=Symbol(""),ai=Symbol("proxy path"),li=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},ci=3,ui=8;function di(e){{const t=new Error(`lifecycle_outside_component\n\`${e}(...)\` can only be used during component initialisation\nhttps://svelte.dev/e/lifecycle_outside_component`);throw t.name="Svelte error",t}}var hi="font-weight: bold",fi="font-weight: normal";function pi(e){console.warn("%c[svelte] hydration_mismatch\n%cHydration failed because the initial UI does not match what was rendered on the server\nhttps://svelte.dev/e/hydration_mismatch",hi,fi)}function mi(e){console.warn(`%c[svelte] state_proxy_equality_mismatch\n%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${e}\` will produce unexpected results\nhttps://svelte.dev/e/state_proxy_equality_mismatch`,hi,fi)}let vi,gi=!1;function yi(e){gi=e}function bi(e){if(null===e)throw pi(),vn;return vi=e}function ki(){return bi(Ro(vi))}function wi(e){if(gi){if(null!==Ro(vi))throw pi(),vn;vi=e}}function xi(e=!0){for(var t=0,n=vi;;){if(n.nodeType===ui){var i=n.data;if(i===mn){if(0===t)return n;t-=1}else i!==fn&&i!==pn||(t+=1)}var r=Ro(n);e&&n.remove(),n=r}}function _i(e){if(!e||e.nodeType!==ui)throw pi(),vn;return e.data}function Ti(e){return e===this.v}function Ii(e){return t=e,n=this.v,!(t!=t?n==n:t!==n||null!==t&&"object"==typeof t||"function"==typeof t);var t,n}let Ei=!1;function Si(e,t){return e.label=t,Ai(e.v,t),e}function Ai(e,t){var n;return null==e||null===(n=e[ai])||void 0===n||n.call(e,t),e}function Ni(e){const t=new Error,n=function(){const e=Error.stackTraceLimit;Error.stackTraceLimit=1/0;const t=(new Error).stack;if(Error.stackTraceLimit=e,!t)return[];const n=t.split("\n"),i=[];for(let e=0;e<n.length;e++){const t=n[e],r=t.replaceAll("\\","/");if("Error"!==t.trim()){if(t.includes("validate_each_keys"))return[];r.includes("svelte/src/internal")||r.includes("node_modules/.vite")||i.push(t)}}return i}();return 0===n.length?null:(n.unshift("\n"),In(t,"stack",{value:n.join("\n")}),In(t,"name",{value:e}),t)}let Mi=null;function Fi(e){Mi=e}let Ci=null;function Oi(e){Ci=e}let Pi=null;function Ri(e){Pi=e}function Di(e){return zi("getContext").get(e)}function Li(e,t=!1,n){Mi={p:Mi,i:!1,c:null,e:null,s:e,x:null,l:null},Mi.function=n,Pi=n}function Bi(e){var t,n,i=Mi,r=i.e;if(null!==r)for(var o of(i.e=null,r))Ko(o);return i.i=!0,Mi=i.p,Pi=null!==(t=null===(n=Mi)||void 0===n?void 0:n.function)&&void 0!==t?t:null,{}}function zi(e){var t,n;return null===Mi&&di(e),null!==(n=(t=Mi).c)&&void 0!==n?n:t.c=new Map(function(e){let t=e.p;for(;null!==t;){const e=t.c;if(null!==e)return e;t=t.p}return null}(Mi)||void 0)}let Wi=[];function $i(){var e=Wi;Wi=[],function(e){for(var t=0;t<e.length;t++)e[t]()}(e)}function ji(e){if(0===Wi.length&&!or){var t=Wi;queueMicrotask((()=>{t===Wi&&$i()}))}Wi.push(e)}function Ui(){for(;Wi.length>0;)$i()}const qi=new WeakMap;function Vi(e){var t=gs;if(null===t)return ps.f|=ii,e;if(e instanceof Error&&!qi.has(e)&&qi.set(e,function(e,t){var n,i;const r=En(e,"message");if(r&&!r.configurable)return;var o=No?" ":"\t",s=`\n${o}in ${(null===(n=t.fn)||void 0===n?void 0:n.name)||"<unknown>"}`,a=t.ctx;for(;null!==a;){var l;s+=`\n${o}in ${null===(l=a.function)||void 0===l?void 0:l[yn].split("/").pop()}`,a=a.p}return{message:e.message+`\n${s}\n`,stack:null===(i=e.stack)||void 0===i?void 0:i.split("\n").filter((e=>!e.includes("svelte/src/internal"))).join("\n")}}(e,t)),t.f&Hn)Gi(e,t);else{if(!(t.f&Wn))throw!t.parent&&e instanceof Error&&Hi(e),e;t.b.error(e)}}function Gi(e,t){for(;null!==t;){if(t.f&Wn)try{return void t.b.error(e)}catch(t){e=t}t=t.parent}throw e instanceof Error&&Hi(e),e}function Hi(e){const t=qi.get(e);t&&(In(e,"message",{value:t.message}),In(e,"stack",{value:t.stack}))}const Ki=-7169;function Xi(e,t){e.f=e.f&Ki|t}function Yi(e){e.f&$n||null===e.deps?Xi(e,jn):Xi(e,qn)}function Qi(e){if(null!==e)for(const t of e)t.f&On&&t.f&ei&&(t.f^=ei,Qi(t.deps))}function Ji(e,t,n){e.f&Un?t.add(e):e.f&qn&&n.add(e),Qi(e.deps),Xi(e,jn)}const Zi=new Set;let er=null,tr=null,nr=[],ir=null,rr=!1,or=!1;var sr=new WeakMap,ar=new WeakMap,lr=new WeakMap,cr=new WeakMap,ur=new WeakMap,dr=new WeakMap,hr=new WeakMap,fr=new WeakSet;class pr{constructor(){O(this,fr),P(this,"committed",!1),P(this,"current",new Map),P(this,"previous",new Map),F(this,sr,new Set),F(this,ar,new Set),F(this,lr,0),F(this,cr,0),F(this,ur,null),F(this,dr,new Set),F(this,hr,new Set),P(this,"skipped_effects",new Set),P(this,"is_fork",!1)}is_deferred(){return this.is_fork||M(cr,this)>0}process(e){nr=[],this.apply();var t,n=[],i=[];for(const t of e)A(fr,this,mr).call(this,t,n,i);(this.is_fork||A(fr,this,gr).call(this),this.is_deferred())?(A(fr,this,vr).call(this,i),A(fr,this,vr).call(this,n)):(er=null,xr(i),xr(n),null===(t=M(ur,this))||void 0===t||t.resolve());tr=null}capture(e,t){var n;(t===gn||this.previous.has(e)||this.previous.set(e,t),e.f&ii)||(this.current.set(e,e.v),null===(n=tr)||void 0===n||n.set(e,e.v))}activate(){er=this,this.apply()}deactivate(){er===this&&(er=null,tr=null)}flush(){if(this.activate(),nr.length>0){if(br(),null!==er&&er!==this)return}else 0===M(lr,this)&&this.process([]);this.deactivate()}discard(){for(const e of M(ar,this))e(this);M(ar,this).clear()}increment(e){C(lr,this,M(lr,this)+1),e&&C(cr,this,M(cr,this)+1)}decrement(e){C(lr,this,M(lr,this)-1),e&&C(cr,this,M(cr,this)-1),this.revive()}revive(){for(const e of M(dr,this))M(hr,this).delete(e),Xi(e,Un),Ir(e);for(const e of M(hr,this))Xi(e,qn),Ir(e);this.flush()}oncommit(e){M(sr,this).add(e)}ondiscard(e){M(ar,this).add(e)}settled(){var e;return(null!==(e=M(ur,this))&&void 0!==e?e:C(ur,this,Cn())).promise}static ensure(){if(null===er){const e=er=new pr;Zi.add(er),or||pr.enqueue((()=>{er===e&&e.flush()}))}return er}static enqueue(e){ji(e)}apply(){}}function mr(e,t,n){e.f^=jn;for(var i=e.first,r=null;null!==i;){var o=i.f,s=!!(o&(Bn|zn));if(!(s&&!!(o&jn)||!!(o&Vn)||this.skipped_effects.has(i))&&null!==i.fn){s?i.f^=jn:null!==r&&o&(Pn|Rn|Dn)?r.b.defer_effect(i):o&Pn?t.push(i):Ns(i)&&(o&Ln&&M(dr,this).add(i),Ps(i));var a=i.first;if(null!==a){i=a;continue}}var l=i.parent;for(i=i.next;null===i&&null!==l;)l===r&&(r=null),i=l.next,l=l.parent}}function vr(e){for(var t=0;t<e.length;t+=1)Ji(e[t],M(dr,this),M(hr,this))}function gr(){if(0===M(cr,this)){for(const e of M(sr,this))e();M(sr,this).clear()}0===M(lr,this)&&A(fr,this,yr).call(this)}function yr(){if(Zi.size>1){this.previous.clear();var e=tr,t=!0;for(const e of Zi){if(e===this){t=!1;continue}const i=[];for(const[n,r]of this.current){if(e.current.has(n)){if(!t||r===e.current.get(n))continue;e.current.set(n,r)}i.push(n)}if(0===i.length)continue;const r=[...e.current.keys()].filter((e=>!this.current.has(e)));if(r.length>0){var n=nr;nr=[];const t=new Set,o=new Map;for(const e of i)_r(e,r,t,o);if(nr.length>0){er=e,e.apply();for(const t of nr)A(fr,e,mr).call(e,t,[],[]);e.deactivate()}nr=n}}er=null,tr=e}this.committed=!0,Zi.delete(this)}function br(){var e=us;rr=!0;var t=new Set;try{var n=0;for(ds(!0);nr.length>0;){var i=pr.ensure();if(n++>1e3){if(wn){var r=new Map;for(const e of i.current.keys())for(const[t,n]of null!==(o=e.updated)&&void 0!==o?o:[]){var o,s=r.get(t);s||(s={error:n.error,count:0},r.set(t,s)),s.count+=n.count}for(const e of r.values())e.error&&console.error(e.error)}kr()}if(i.process(nr),uo.clear(),wn)for(const e of i.current.keys())t.add(e)}}finally{rr=!1,ds(e),ir=null;for(const e of t)e.updated=null}}function kr(){try{!function(){{const e=new Error("effect_update_depth_exceeded\nMaximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state\nhttps://svelte.dev/e/effect_update_depth_exceeded");throw e.name="Svelte error",e}}()}catch(e){In(e,"stack",{value:""}),Gi(e,ir)}}let wr=null;function xr(e){var t=e.length;if(0!==t){for(var n=0;n<t;){var i,r=e[n++];if(!(r.f&(Gn|Vn))&&Ns(r))if(wr=new Set,Ps(r),null===r.deps&&null===r.first&&null===r.nodes&&(null===r.teardown&&null===r.ac?rs(r):r.fn=null),(null===(i=wr)||void 0===i?void 0:i.size)>0){uo.clear();for(const e of wr){if(e.f&(Gn|Vn))continue;const t=[e];let n=e.parent;for(;null!==n;)wr.has(n)&&(wr.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){const n=t[e];n.f&(Gn|Vn)||Ps(n)}}wr.clear()}}wr=null}}function _r(e,t,n,i){if(!n.has(e)&&(n.add(e),null!==e.reactions))for(const r of e.reactions){const e=r.f;e&On?_r(r,t,n,i):e&(ni|Ln)&&!(e&Un)&&Tr(r,t,i)&&(Xi(r,Un),Ir(r))}}function Tr(e,t,n){const i=n.get(e);if(void 0!==i)return i;if(null!==e.deps)for(const i of e.deps){if(t.includes(i))return!0;if(i.f&On&&Tr(i,t,n))return n.set(i,!0),!0}return n.set(e,!1),!1}function Ir(e){for(var t=ir=e;null!==t.parent;){var n=(t=t.parent).f;if(rr&&t===gs&&n&Ln&&!(n&Yn))return;if(n&(zn|Bn)){if(!(n&jn))return;t.f^=jn}}nr.push(t)}var Er=Kn|Qn|Wn;var Sr=new WeakMap,Ar=new WeakMap,Nr=new WeakMap,Mr=new WeakMap,Fr=new WeakMap,Cr=new WeakMap,Or=new WeakMap,Pr=new WeakMap,Rr=new WeakMap,Dr=new WeakMap,Lr=new WeakMap,Br=new WeakMap,zr=new WeakMap,Wr=new WeakMap,$r=new WeakMap,jr=new WeakMap,Ur=new WeakMap,qr=new WeakSet;class Vr{constructor(e,t,n){O(this,qr),P(this,"parent",void 0),P(this,"is_pending",!1),F(this,Sr,void 0),F(this,Ar,gi?vi:null),F(this,Nr,void 0),F(this,Mr,void 0),F(this,Fr,void 0),F(this,Cr,null),F(this,Or,null),F(this,Pr,null),F(this,Rr,null),F(this,Dr,null),F(this,Lr,0),F(this,Br,0),F(this,zr,!1),F(this,Wr,new Set),F(this,$r,new Set),F(this,jr,null),F(this,Ur,function(e){let t,n=0,i=po(0);return Si(i,"createSubscriber version"),()=>{Vo()&&(Ds(i),Yo((()=>(0===n&&(t=zs((()=>e((()=>ko(i)))))),n+=1,()=>{ji((()=>{var e;n-=1,0===n&&(null===(e=t)||void 0===e||e(),t=void 0,ko(i))}))}))))}}((()=>(C(jr,this,po(M(Lr,this))),Si(M(jr,this),"$effect.pending()"),()=>{C(jr,this,null)})))),C(Sr,this,e),C(Nr,this,t),C(Mr,this,n),this.parent=gs.b,this.is_pending=!!M(Nr,this).pending,C(Fr,this,Jo((()=>{if(gs.b=this,gi){const e=M(Ar,this);ki();e.nodeType===ui&&e.data===pn?A(qr,this,Hr).call(this):(A(qr,this,Gr).call(this),0===M(Br,this)&&(this.is_pending=!1))}else{var e=A(qr,this,Kr).call(this);try{C(Cr,this,es((()=>n(e))))}catch(e){this.error(e)}M(Br,this)>0?A(qr,this,Yr).call(this):this.is_pending=!1}return()=>{var e;null===(e=M(Dr,this))||void 0===e||e.remove()}}),Er)),gi&&C(Sr,this,vi)}defer_effect(e){Ji(e,M(Wr,this),M($r,this))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!M(Nr,this).pending}update_pending_count(e){A(qr,this,Qr).call(this,e),C(Lr,this,M(Lr,this)+e),M(jr,this)&&yo(M(jr,this),M(Lr,this))}get_effect_pending(){return M(Ur,this).call(this),Ds(M(jr,this))}error(e){var t=M(Nr,this).onerror;let n=M(Nr,this).failed;if(M(zr,this)||!t&&!n)throw e;M(Cr,this)&&(is(M(Cr,this)),C(Cr,this,null)),M(Or,this)&&(is(M(Or,this)),C(Or,this,null)),M(Pr,this)&&(is(M(Pr,this)),C(Pr,this,null)),gi&&(bi(M(Ar,this)),function(e=1){if(gi){for(var t=e,n=vi;t--;)n=Ro(n);vi=n}}(),bi(xi()));var i=!1,r=!1;const o=()=>{i?console.warn("%c[svelte] svelte_boundary_reset_noop\n%cA `<svelte:boundary>` `reset` function only resets the boundary the first time it is called\nhttps://svelte.dev/e/svelte_boundary_reset_noop",hi,fi):(i=!0,r&&function(){{const e=new Error("svelte_boundary_reset_onerror\nA `<svelte:boundary>` `reset` function cannot be called while an error is still being handled\nhttps://svelte.dev/e/svelte_boundary_reset_onerror");throw e.name="Svelte error",e}}(),pr.ensure(),C(Lr,this,0),null!==M(Pr,this)&&os(M(Pr,this),(()=>{C(Pr,this,null)})),this.is_pending=this.has_pending_snippet(),C(Cr,this,A(qr,this,Xr).call(this,(()=>(C(zr,this,!1),es((()=>M(Mr,this).call(this,M(Sr,this)))))))),M(Br,this)>0?A(qr,this,Yr).call(this):this.is_pending=!1)};var s=ps;try{vs(null),r=!0,null==t||t(e,o),r=!1}catch(e){Gi(e,M(Fr,this)&&M(Fr,this).parent)}finally{vs(s)}n&&ji((()=>{C(Pr,this,A(qr,this,Xr).call(this,(()=>{pr.ensure(),C(zr,this,!0);try{return es((()=>{n(M(Sr,this),(()=>e),(()=>o))}))}catch(e){return Gi(e,M(Fr,this).parent),null}finally{C(zr,this,!1)}})))}))}}function Gr(){try{C(Cr,this,es((()=>M(Mr,this).call(this,M(Sr,this)))))}catch(e){this.error(e)}}function Hr(){const e=M(Nr,this).pending;e&&(C(Or,this,es((()=>e(M(Sr,this))))),pr.enqueue((()=>{var e=A(qr,this,Kr).call(this);C(Cr,this,A(qr,this,Xr).call(this,(()=>(pr.ensure(),es((()=>M(Mr,this).call(this,e))))))),M(Br,this)>0?A(qr,this,Yr).call(this):(os(M(Or,this),(()=>{C(Or,this,null)})),this.is_pending=!1)})))}function Kr(){var e=M(Sr,this);return this.is_pending&&(C(Dr,this,Oo()),M(Sr,this).before(M(Dr,this)),e=M(Dr,this)),e}function Xr(e){var t=gs,n=ps,i=Mi;ys(M(Fr,this)),vs(M(Fr,this)),Fi(M(Fr,this).ctx);try{return e()}catch(e){return Vi(e),null}finally{ys(t),vs(n),Fi(i)}}function Yr(){const e=M(Nr,this).pending;null!==M(Cr,this)&&(C(Rr,this,document.createDocumentFragment()),M(Rr,this).append(M(Dr,this)),cs(M(Cr,this),M(Rr,this))),null===M(Or,this)&&C(Or,this,es((()=>e(M(Sr,this)))))}function Qr(e){var t;if(this.has_pending_snippet()){if(C(Br,this,M(Br,this)+e),0===M(Br,this)){this.is_pending=!1;for(const e of M(Wr,this))Xi(e,Un),Ir(e);for(const e of M($r,this))Xi(e,qn),Ir(e);M(Wr,this).clear(),M($r,this).clear(),M(Or,this)&&os(M(Or,this),(()=>{C(Or,this,null)})),M(Rr,this)&&(M(Sr,this).before(M(Rr,this)),C(Rr,this,null))}}else this.parent&&A(qr,t=this.parent,Qr).call(t,e)}function Jr(e,t,n,i){const r=to;if(0!==n.length||0!==e.length){var o,s,a,l,c,u=er,d=gs,h=(o=gs,s=ps,a=Mi,l=er,c=Ci,function(e=!0){ys(o),vs(s),Fi(a),e&&(null==l||l.activate()),Oi(c)});e.length>0?Promise.all(e).then((()=>{h();try{return f()}finally{null==u||u.deactivate(),Zr()}})):f()}else i(t.map(r));function f(){Promise.all(n.map((e=>no(e)))).then((e=>{h();try{i([...t.map(r),...e])}catch(e){d.f&Gn||Gi(e,d)}null==u||u.deactivate(),Zr()})).catch((e=>{Gi(e,d)}))}}function Zr(){ys(null),vs(null),Fi(null),Oi(null)}const eo=new Set;function to(e){var t=On|Un,n=null!==ps&&ps.f&On?ps:null;null!==gs&&(gs.f|=Qn);return{ctx:Mi,deps:null,effects:null,equals:Ti,f:t,fn:e,reactions:null,rv:0,v:gn,wv:0,parent:null!=n?n:gs,ac:null}}function no(e,t,n){let i=gs;null===i&&function(){{const e=new Error("async_derived_orphan\nCannot create a `$derived(...)` with an `await` expression outside of an effect tree\nhttps://svelte.dev/e/async_derived_orphan");throw e.name="Svelte error",e}}();var r=i.b,o=void 0,s=po(gn);s.label=t;var a=!ps,l=new Map;return function(e){qo(ni|Qn,e,!0)}((()=>{var t=Cn();o=t.promise;try{Promise.resolve(e()).then(t.resolve,t.reject).then((()=>{n===er&&n.committed&&n.deactivate(),Zr()}))}catch(e){t.reject(e),Zr()}var n=er;if(a){var i,c=r.is_rendered();r.update_pending_count(1),n.increment(c),null===(i=l.get(n))||void 0===i||i.reject(li),l.delete(n),l.set(n,t)}const u=(e,t=void 0)=>{if(n.activate(),t)t!==li&&(s.f|=ii,yo(s,t));else{s.f&ii&&(s.f^=ii),yo(s,e);for(const[e,t]of l){if(l.delete(e),e===n)break;t.reject(li)}}a&&(r.update_pending_count(-1),n.decrement(c))};t.promise.then(u,(e=>u(null,e||"unknown")))})),Go((()=>{for(const e of l.values())e.reject(li)})),s.f|=ni,new Promise((e=>{!function t(n){function i(){n===o?e(s):t(o)}n.then(i,i)}(o)}))}function io(e){const t=to(e);return ks(t),t}function ro(e){const t=to(e);return t.equals=Ii,t}function oo(e){var t=e.effects;if(null!==t){e.effects=null;for(var n=0;n<t.length;n+=1)is(t[n])}}let so=[];function ao(e){var t,n=gs;ys(function(e){for(var t=e.parent;null!==t;){if(!(t.f&On))return t.f&Gn?null:t;t=t.parent}return null}(e));{let i=co;ho(new Set);try{so.includes(e)&&function(){{const e=new Error("derived_references_self\nA derived value cannot reference itself recursively\nhttps://svelte.dev/e/derived_references_self");throw e.name="Svelte error",e}}(),so.push(e),e.f&=~ei,oo(e),t=Fs(e)}finally{ys(n),ho(i),so.pop()}}return t}function lo(e){var t,n,i=ao(e);if(!e.equals(i)&&(e.wv=As(),(null===(t=er)||void 0===t||!t.is_fork||null===e.deps)&&(e.v=i,null===e.deps)))return void Xi(e,jn);hs||(null!==tr?(Vo()||null!==(n=er)&&void 0!==n&&n.is_fork)&&tr.set(e,i):Yi(e))}let co=new Set;const uo=new Map;function ho(e){co=e}let fo=!1;function po(e,t){return{f:0,v:e,reactions:null,equals:Ti,rv:0,wv:0}}function mo(e,t){const n=po(e);return ks(n),n}function vo(e,t=!1,n=!0){const i=po(e);return t||(i.equals=Ii),i}function go(e,t,n=!1){var i;null!==ps&&(!ms||ps.f&Xn)&&ps.f&(On|Ln|ni|Xn)&&(null===(i=bs)||void 0===i||!i.includes(e))&&function(){{const e=new Error("state_unsafe_mutation\nUpdating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw e.name="Svelte error",e}}();let r=n?_o(t):t;return Ai(r,e.label),yo(e,r)}function yo(e,t){if(!e.equals(t)){var n=e.v;hs?uo.set(e,t):uo.set(e,n),e.v=t;var i=pr.ensure();if(i.capture(e,n),null!==gs){var r,o,s;null!==(r=e.updated)&&void 0!==r||(e.updated=new Map);const t=(null!==(o=null===(s=e.updated.get(""))||void 0===s?void 0:s.count)&&void 0!==o?o:0)+1;if(e.updated.set("",{error:null,count:t}),t>5){const t=Ni("updated at");if(null!==t){let n=e.updated.get(t.stack);n||(n={error:t,count:0},e.updated.set(t.stack,n)),n.count++}}}if(null!==gs&&(e.set_during_effect=!0),e.f&On){const t=e;e.f&Un&&ao(t),Yi(t)}e.wv=As(),wo(e,Un),null!==gs&&gs.f&jn&&!(gs.f&(Bn|zn))&&(null===_s?function(e){_s=e}([e]):_s.push(e)),!i.is_fork&&co.size>0&&!fo&&bo()}return t}function bo(){fo=!1;var e=us;ds(!0);const t=Array.from(co);try{for(const e of t)e.f&jn&&Xi(e,qn),Ns(e)&&Ps(e)}finally{ds(e)}co.clear()}function ko(e){go(e,e.v+1)}function wo(e,t){var n=e.reactions;if(null!==n)for(var i=n.length,r=0;r<i;r++){var o=n[r],s=o.f;if(s&Xn)co.add(o);else{var a=!(s&Un);if(a&&Xi(o,t),s&On){var l,c=o;null===(l=tr)||void 0===l||l.delete(c),s&ei||(s&$n&&(o.f|=ei),wo(c,qn))}else a&&(s&Ln&&null!==wr&&wr.add(o),Ir(o))}}}const xo=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function _o(e){if("object"!=typeof e||null===e||ri in e)return e;const t=Mn(e);if(t!==An&&t!==Nn)return e;var n=new Map,i=xn(e),r=mo(0),o=Es,s=e=>{if(Es===o)return e();var t=ps,n=Es;vs(null),Ss(o);var i=e();return vs(t),Ss(n),i};i&&(n.set("length",mo(e.length)),e=new Proxy(e,{get(e,t,n){var i=Reflect.get(e,t,n);return Eo.has(t)?function(...e){fo=!0;var t=i.apply(this,e);return bo(),t}:i}}));var a="";let l=!1;function c(e){if(!l){l=!0,Si(r,`${a=e} version`);for(const[e,t]of n)Si(t,To(a,e));l=!1}}return new Proxy(e,{defineProperty(e,t,i){"value"in i&&!1!==i.configurable&&!1!==i.enumerable&&!1!==i.writable||function(){{const e=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw e.name="Svelte error",e}}();var r=n.get(t);return void 0===r?r=s((()=>{var e=mo(i.value);return n.set(t,e),"string"==typeof t&&Si(e,To(a,t)),e})):go(r,i.value,!0),!0},deleteProperty(e,t){var i=n.get(t);if(void 0===i){if(t in e){const e=s((()=>mo(gn)));n.set(t,e),ko(r),Si(e,To(a,t))}}else go(i,gn),ko(r);return!0},get(t,i,r){var o;if(i===ri)return e;if(i===ai)return c;var l=n.get(i),u=i in t;if(void 0===l&&(!u||null!==(o=En(t,i))&&void 0!==o&&o.writable)&&(l=s((()=>{var e=mo(_o(u?t[i]:gn));return Si(e,To(a,i)),e})),n.set(i,l)),void 0!==l){var d=Ds(l);return d===gn?void 0:d}return Reflect.get(t,i,r)},getOwnPropertyDescriptor(e,t){var i=Reflect.getOwnPropertyDescriptor(e,t);if(i&&"value"in i){var r=n.get(t);r&&(i.value=Ds(r))}else if(void 0===i){var o=n.get(t),s=null==o?void 0:o.v;if(void 0!==o&&s!==gn)return{enumerable:!0,configurable:!0,value:s,writable:!0}}return i},has(e,t){var i;if(t===ri)return!0;var r=n.get(t),o=void 0!==r&&r.v!==gn||Reflect.has(e,t);if((void 0!==r||null!==gs&&(!o||null!==(i=En(e,t))&&void 0!==i&&i.writable))&&(void 0===r&&(r=s((()=>{var n=mo(o?_o(e[t]):gn);return Si(n,To(a,t)),n})),n.set(t,r)),Ds(r)===gn))return!1;return o},set(e,t,o,l){var c,u=n.get(t),d=t in e;if(i&&"length"===t)for(var h=o;h<u.v;h+=1){var f=n.get(h+"");void 0!==f?go(f,gn):h in e&&(f=s((()=>mo(gn))),n.set(h+"",f),Si(f,To(a,h)))}void 0===u?(!d||null!==(c=En(e,t))&&void 0!==c&&c.writable)&&(Si(u=s((()=>mo(void 0))),To(a,t)),go(u,_o(o)),n.set(t,u)):(d=u.v!==gn,go(u,s((()=>_o(o)))));var p=Reflect.getOwnPropertyDescriptor(e,t);if(null!=p&&p.set&&p.set.call(l,o),!d){if(i&&"string"==typeof t){var m=n.get("length"),v=Number(t);Number.isInteger(v)&&v>=m.v&&go(m,v+1)}ko(r)}return!0},ownKeys(e){Ds(r);var t=Reflect.ownKeys(e).filter((e=>{var t=n.get(e);return void 0===t||t.v!==gn}));for(var[i,o]of n)o.v===gn||i in e||t.push(i);return t},setPrototypeOf(){!function(){{const e=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw e.name="Svelte error",e}}()}})}function To(e,t){var n;return"symbol"==typeof t?`${e}[Symbol(${null!==(n=t.description)&&void 0!==n?n:""})]`:xo.test(t)?`${e}.${t}`:/^\d+$/.test(t)?`${e}[${t}]`:`${e}['${t}']`}function Io(e){try{if(null!==e&&"object"==typeof e&&ri in e)return e[ri]}catch{}return e}const Eo=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function So(e,t,n=!0){try{e===t!=(Io(e)===Io(t))&&mi(n?"===":"!==")}catch{}return e===t===n}var Ao,No,Mo,Fo;function Co(){if(void 0===Ao){Ao=window,No=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;Mo=En(t,"firstChild").get,Fo=En(t,"nextSibling").get,Fn(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),Fn(n)&&(n.__t=void 0),e.__svelte_meta=null,function(){const e=Array.prototype,t=Array.__svelte_cleanup;t&&t();const{indexOf:n,lastIndexOf:i,includes:r}=e;e.indexOf=function(e,t){const i=n.call(this,e,t);if(-1===i)for(let n=null!=t?t:0;n<this.length;n+=1)if(Io(this[n])===e){mi("array.indexOf(...)");break}return i},e.lastIndexOf=function(e,t){const n=i.call(this,e,null!=t?t:this.length-1);if(-1===n)for(let n=0;n<=(null!=t?t:this.length-1);n+=1)if(Io(this[n])===e){mi("array.lastIndexOf(...)");break}return n},e.includes=function(e,t){const n=r.call(this,e,t);if(!n)for(let t=0;t<this.length;t+=1)if(Io(this[t])===e){mi("array.includes(...)");break}return n},Array.__svelte_cleanup=()=>{e.indexOf=n,e.lastIndexOf=i,e.includes=r}}()}}function Oo(e=""){return document.createTextNode(e)}function Po(e){return Mo.call(e)}function Ro(e){return Fo.call(e)}function Do(e,t){if(!gi)return Po(e);var n=Po(vi);if(null===n)n=vi.appendChild(Oo());else if(t&&n.nodeType!==ci){var i,r=Oo();return null===(i=n)||void 0===i||i.before(r),bi(r),r}return bi(n),n}function Lo(e,t=!1){var n;if(!gi){var i=Po(e);return i instanceof Comment&&""===i.data?Ro(i):i}if(t&&(null===(n=vi)||void 0===n?void 0:n.nodeType)!==ci){var r,o=Oo();return null===(r=vi)||void 0===r||r.before(o),bi(o),o}return vi}function Bo(e,t=1,n=!1){var i;let r=gi?vi:e;for(var o;t--;)o=r,r=Ro(r);if(!gi)return r;if(n&&(null===(i=r)||void 0===i?void 0:i.nodeType)!==ci){var s,a=Oo();if(null===r)null===(s=o)||void 0===s||s.after(a);else r.before(a);return bi(a),a}return bi(r),r}function zo(e){e.textContent=""}function Wo(e,t){if(t){const t=document.body;e.autofocus=!0,ji((()=>{document.activeElement===t&&e.focus()}))}}let $o=!1;function jo(e){var t=ps,n=gs;vs(null),ys(null);try{return e()}finally{vs(t),ys(n)}}function Uo(e){null===gs&&(null===ps&&function(e){{const t=new Error(`effect_orphan\n\`${e}\` can only be used inside an effect (e.g. during component initialisation)\nhttps://svelte.dev/e/effect_orphan`);throw t.name="Svelte error",t}}(e),function(){{const e=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw e.name="Svelte error",e}}()),hs&&function(e){{const t=new Error(`effect_in_teardown\n\`${e}\` cannot be used inside an effect cleanup function\nhttps://svelte.dev/e/effect_in_teardown`);throw t.name="Svelte error",t}}(e)}function qo(e,t,n){for(var i=gs;null!==i&&i.f&Xn;)i=i.parent;null!==i&&i.f&Vn&&(e|=Vn);var r={ctx:Mi,deps:null,nodes:null,f:e|Un|$n,first:null,fn:t,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,wv:0,ac:null};if(r.component_function=Pi,n)try{Ps(r),r.f|=Hn}catch(e){throw is(r),e}else null!==t&&Ir(r);var o=r;if(!n||null!==o.deps||null!==o.teardown||null!==o.nodes||o.first!==o.last||o.f&Qn||(o=o.first,e&Ln&&e&Kn&&null!==o&&(o.f|=Kn)),null!==o&&(o.parent=i,null!==i&&function(e,t){var n=t.last;null===n?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}(o,i),null!==ps&&ps.f&On&&!(e&zn))){var s,a=ps;(null!==(s=a.effects)&&void 0!==s?s:a.effects=[]).push(o)}return r}function Vo(){return null!==ps&&!ms}function Go(e){const t=qo(Rn,null,!1);return Xi(t,jn),t.teardown=e,t}function Ho(e){Uo("$effect"),In(e,"name",{value:"$effect"});var t=gs.f;if(!!(ps||!(t&Bn)||t&Hn))return Ko(e);var n,i=Mi;(null!==(n=i.e)&&void 0!==n?n:i.e=[]).push(e)}function Ko(e){return qo(Pn|Jn,e,!1)}function Xo(e){return qo(Pn,e,!1)}function Yo(e,t=0){return qo(Rn|t,e,!0)}function Qo(e,t=[],n=[],i=[]){Jr(i,t,n,(t=>{qo(Rn,(()=>e(...t.map(Ds))),!0)}))}function Jo(e,t=0){var n=qo(Ln|t,e,!0);return n.dev_stack=Ci,n}function Zo(e,t=0){var n=qo(Dn|t,e,!0);return n.dev_stack=Ci,n}function es(e){return qo(Bn|Qn,e,!0)}function ts(e){var t=e.teardown;if(null!==t){const e=hs,n=ps;fs(!0),vs(null);try{t.call(null)}finally{fs(e),vs(n)}}}function ns(e,t=!1){var n=e.first;for(e.first=e.last=null;null!==n;){const e=n.ac;null!==e&&jo((()=>{e.abort(li)}));var i=n.next;n.f&zn?n.parent=null:is(n,t),n=i}}function is(e,t=!0){var n=!1;(t||e.f&Yn)&&null!==e.nodes&&null!==e.nodes.end&&(!function(e,t){for(;null!==e;){var n=e===t?null:Ro(e);e.remove(),e=n}}(e.nodes.start,e.nodes.end),n=!0),ns(e,t&&!n),Os(e,0),Xi(e,Gn);var i=e.nodes&&e.nodes.t;if(null!==i)for(const e of i)e.stop();ts(e);var r=e.parent;null!==r&&null!==r.first&&rs(e),e.component_function=null,e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=null}function rs(e){var t=e.parent,n=e.prev,i=e.next;null!==n&&(n.next=i),null!==i&&(i.prev=n),null!==t&&(t.first===e&&(t.first=i),t.last===e&&(t.last=n))}function os(e,t,n=!0){var i=[];ss(e,i,!0);var r=()=>{n&&is(e),t&&t()},o=i.length;if(o>0){var s=()=>--o||r();for(var a of i)a.out(s)}else r()}function ss(e,t,n){if(!(e.f&Vn)){e.f^=Vn;var i=e.nodes&&e.nodes.t;if(null!==i)for(const e of i)(e.is_global||n)&&t.push(e);for(var r=e.first;null!==r;){var o=r.next;ss(r,t,!!(!!(r.f&Kn)||!!(r.f&Bn)&&!!(e.f&Ln))&&n),r=o}}}function as(e){ls(e,!0)}function ls(e,t){if(e.f&Vn){e.f^=Vn,e.f&jn||(Xi(e,Un),Ir(e));for(var n=e.first;null!==n;){var i=n.next;ls(n,!!(!!(n.f&Kn)||!!(n.f&Bn))&&t),n=i}var r=e.nodes&&e.nodes.t;if(null!==r)for(const e of r)(e.is_global||t)&&e.in()}}function cs(e,t){if(e.nodes)for(var n=e.nodes.start,i=e.nodes.end;null!==n;){var r=n===i?null:Ro(n);t.append(n),n=r}}let us=!1;function ds(e){us=e}let hs=!1;function fs(e){hs=e}let ps=null,ms=!1;function vs(e){ps=e}let gs=null;function ys(e){gs=e}let bs=null;function ks(e){null!==ps&&(null===bs?bs=[e]:bs.push(e))}let ws=null,xs=0,_s=null;let Ts=1,Is=0,Es=Is;function Ss(e){Es=e}function As(){return++Ts}function Ns(e){var t=e.f;if(t&Un)return!0;if(t&On&&(e.f&=~ei),t&qn){for(var n=e.deps,i=n.length,r=0;r<i;r++){var o=n[r];if(Ns(o)&&lo(o),o.wv>e.wv)return!0}t&$n&&null===tr&&Xi(e,jn)}return!1}function Ms(e,t,n=!0){var i,r=e.reactions;if(null!==r&&(null===(i=bs)||void 0===i||!i.includes(e)))for(var o=0;o<r.length;o++){var s=r[o];s.f&On?Ms(s,t,!1):t===s&&(n?Xi(s,Un):s.f&jn&&Xi(s,qn),Ir(s))}}function Fs(e){var t=ws,n=xs,i=_s,r=ps,o=bs,s=Mi,a=ms,l=Es,c=e.f;ws=null,xs=0,_s=null,ps=c&(Bn|zn)?null:e,bs=null,Fi(e.ctx),ms=!1,Es=++Is,null!==e.ac&&(jo((()=>{e.ac.abort(li)})),e.ac=null);try{e.f|=ti;var u=(0,e.fn)(),d=e.deps;if(null!==ws){var h;if(Os(e,xs),null!==d&&xs>0)for(d.length=xs+ws.length,h=0;h<ws.length;h++)d[xs+h]=ws[h];else e.deps=d=ws;if(Vo()&&e.f&$n)for(h=xs;h<d.length;h++){var f,p;(null!==(p=(f=d[h]).reactions)&&void 0!==p?p:f.reactions=[]).push(e)}}else null!==d&&xs<d.length&&(Os(e,xs),d.length=xs);if(!(null===_s||ms||null===d||e.f&(On|qn|Un)))for(h=0;h<_s.length;h++)Ms(_s[h],e);return null!==r&&r!==e&&(Is++,null!==_s&&(null===i?i=_s:i.push(..._s))),e.f&ii&&(e.f^=ii),u}catch(e){return Vi(e)}finally{e.f^=ti,ws=t,xs=n,_s=i,ps=r,bs=o,Fi(s),ms=a,Es=l}}function Cs(e,t){let n=t.reactions;if(null!==n){var i=_n.call(n,e);if(-1!==i){var r=n.length-1;0===r?n=t.reactions=null:(n[i]=n[r],n.pop())}}if(null===n&&t.f&On&&(null===ws||!ws.includes(t))){var o=t;o.f&$n&&(o.f^=$n,o.f&=~ei),Yi(o),oo(o),Os(o,0)}}function Os(e,t){var n=e.deps;if(null!==n)for(var i=t;i<n.length;i++)Cs(e,n[i])}function Ps(e){var t=e.f;if(!(t&Gn)){Xi(e,jn);var n=gs,i=us;gs=e,us=!0;var r,o=Pi;Ri(e.component_function);var s=Ci;Oi(null!==(r=e.dev_stack)&&void 0!==r?r:Ci);try{t&(Ln|Dn)?function(e){for(var t=e.first;null!==t;){var n=t.next;t.f&Bn||is(t),t=n}}(e):ns(e),ts(e);var a=Fs(e);e.teardown="function"==typeof a?a:null,e.wv=Ts,wn&&Ei&&e.f&Un&&e.deps}finally{us=i,gs=n,Ri(o),Oi(s)}}}async function Rs(){await Promise.resolve(),function(){var e=or;or=!0;try{for(;;){var t;if(Ui(),0===nr.length&&(null===(t=er)||void 0===t||t.flush(),0===nr.length))return void(ir=null);br()}}finally{or=e}}()}function Ds(e){var t,n,i=!!(e.f&On);if(null!==ps&&!ms&&!(null!==gs&&!!(gs.f&Gn)||null!==(n=bs)&&void 0!==n&&n.includes(e))){var r=ps.deps;if(ps.f&ti)e.rv<Is&&(e.rv=Is,null===ws&&null!==r&&r[xs]===e?xs++:null===ws?ws=[e]:ws.includes(e)||ws.push(e));else{var o,s;(null!==(s=(o=ps).deps)&&void 0!==s?s:o.deps=[]).push(e);var a=e.reactions;null===a?e.reactions=[ps]:a.includes(ps)||a.push(ps)}}if(eo.delete(e),hs&&uo.has(e))return uo.get(e);if(i){var l=e;if(hs){var c=l.v;return(l.f&jn||null===l.reactions)&&!Bs(l)||(c=ao(l)),uo.set(l,c),c}var u=!(l.f&$n)&&!ms&&null!==ps&&(us||!!(ps.f&$n)),d=null===l.deps;Ns(l)&&(u&&(l.f|=$n),lo(l)),u&&!d&&Ls(l)}if(null!==(t=tr)&&void 0!==t&&t.has(e))return tr.get(e);if(e.f&ii)throw e.v;return e.v}function Ls(e){if(null!==e.deps){e.f|=$n;for(const n of e.deps){var t;(null!==(t=n.reactions)&&void 0!==t?t:n.reactions=[]).push(e),n.f&On&&!(n.f&$n)&&Ls(n)}}}function Bs(e){if(e.v===gn)return!0;if(null===e.deps)return!1;for(const t of e.deps){if(uo.has(t))return!0;if(t.f&On&&Bs(t))return!0}return!1}function zs(e){var t=ms;try{return ms=!0,e()}finally{ms=t}}const Ws=new Set,$s=new Set;function js(e,t,n,i={}){function r(e){if(i.capture||Gs.call(t,e),!e.cancelBubble)return jo((()=>null==n?void 0:n.call(this,e)))}return e.startsWith("pointer")||e.startsWith("touch")||"wheel"===e?ji((()=>{t.addEventListener(e,r,i)})):t.addEventListener(e,r,i),r}function Us(e,t,n,i,r){var o={capture:i,passive:r},s=js(e,t,n,o);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Go((()=>{t.removeEventListener(e,s,o)}))}function qs(e){for(var t=0;t<e.length;t++)Ws.add(e[t]);for(var n of $s)n(e)}let Vs=null;function Gs(e){var t,n=this,i=n.ownerDocument,r=e.type,o=(null===(t=e.composedPath)||void 0===t?void 0:t.call(e))||[],s=o[0]||e.target;Vs=e;var a=0,l=Vs===e&&e.__root;if(l){var c=o.indexOf(l);if(-1!==c&&(n===document||n===window))return void(e.__root=n);var u=o.indexOf(n);if(-1===u)return;c<=u&&(a=c)}if((s=o[a]||e.target)!==n){In(e,"currentTarget",{configurable:!0,get:()=>s||i});var d=ps,h=gs;vs(null),ys(null);try{for(var f,p=[];null!==s;){var m=s.assignedSlot||s.parentNode||s.host||null;try{var v=s["__"+r];null==v||s.disabled&&e.target!==s||v.call(s,e)}catch(e){f?p.push(e):f=e}if(e.cancelBubble||m===n||null===m)break;s=m}if(f){for(let e of p)queueMicrotask((()=>{throw e}));throw f}}finally{e.__root=n,delete e.currentTarget,vs(d),ys(h)}}}function Hs(e,t){var n=gs;null===n.nodes&&(n.nodes={start:e,end:t,a:null,t:null})}function Ks(e,t){var n,i=!!(1&t),r=!!(2&t),o=!e.startsWith("<!>");return()=>{if(gi)return Hs(vi,null),vi;var t,s;void 0===n&&(t=o?e:"<!>"+e,(s=document.createElement("template")).innerHTML=t.replaceAll("<!>","\x3c!----\x3e"),n=s.content,i||(n=Po(n)));var a=r||No?document.importNode(n,!0):n.cloneNode(!0);i?Hs(Po(a),a.lastChild):Hs(a,a);return a}}function Xs(){if(gi)return Hs(vi,null),vi;var e=document.createDocumentFragment(),t=document.createComment(""),n=Oo();return e.append(t,n),Hs(t,n),e}function Ys(e,t){if(gi){var n=gs;return n.f&Hn&&null!==n.nodes.end||(n.nodes.end=vi),void ki()}null!==e&&e.before(t)}function Qs(e){return e.endsWith("capture")&&"gotpointercapture"!==e&&"lostpointercapture"!==e}const Js=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function Zs(e){return Js.includes(e)}const ea={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function ta(e){var t;return e=e.toLowerCase(),null!==(t=ea[e])&&void 0!==t?t:e}const na=["touchstart","touchmove"];function ia(e,t){var n,i=null==t?"":"object"==typeof t?t+"":t;i!==(null!==(n=e.__t)&&void 0!==n?n:e.__t=e.nodeValue)&&(e.__t=i,e.nodeValue=i+"")}function ra(e,t){return aa(e,t)}function oa(e,t){var n;Co(),t.intro=null!==(n=t.intro)&&void 0!==n&&n;const i=t.target,r=gi,o=vi;try{for(var s=Po(i);s&&(s.nodeType!==ui||s.data!==fn);)s=Ro(s);if(!s)throw vn;yi(!0),bi(s);const n=aa(e,{...t,anchor:s});return yi(!1),n}catch(n){if(n instanceof Error&&n.message.split("\n").some((e=>e.startsWith("https://svelte.dev/e/"))))throw n;return n!==vn&&console.warn("Failed to hydrate: ",n),!1===t.recover&&function(){{const e=new Error("hydration_failed\nFailed to hydrate the application\nhttps://svelte.dev/e/hydration_failed");throw e.name="Svelte error",e}}(),Co(),zo(i),yi(!1),ra(e,t)}finally{yi(r),bi(o)}}const sa=new Map;function aa(e,{target:t,anchor:n,props:i={},events:r,context:o,intro:s=!0}){Co();var a=new Set,l=e=>{for(var n=0;n<e.length;n++){var i=e[n];if(!a.has(i)){a.add(i);var r=(s=i,na.includes(s));t.addEventListener(i,Gs,{passive:r});var o=sa.get(i);void 0===o?(document.addEventListener(i,Gs,{passive:r}),sa.set(i,1)):sa.set(i,o+1)}}var s};l(Tn(Ws)),$s.add(l);var c=void 0,u=function(e){pr.ensure();const t=qo(zn|Qn,e,!0);return(e={})=>new Promise((n=>{e.outro?os(t,(()=>{is(t),n(void 0)})):(is(t),n(void 0))}))}((()=>{var s=null!=n?n:t.appendChild(Oo());return function(e,t,n){new Vr(e,t,n)}(s,{pending:()=>{}},(t=>{o&&(Li({}),Mi.c=o);if(r&&(i.$$events=r),gi&&Hs(t,null),c=e(t,i)||{},gi&&(gs.nodes.end=vi,null===vi||vi.nodeType!==ui||vi.data!==mn))throw pi(),vn;o&&Bi()})),()=>{for(var e of a){t.removeEventListener(e,Gs);var i=sa.get(e);0==--i?(document.removeEventListener(e,Gs),sa.delete(e)):sa.set(e,i)}var r;($s.delete(l),s!==n)&&(null===(r=s.parentNode)||void 0===r||r.removeChild(s))}}));return la.set(c,u),c}let la=new WeakMap;function ca(e,t){const n=la.get(e);return n?(la.delete(e),n(t)):(ri in e?console.warn("%c[svelte] state_proxy_unmount\n%cTried to unmount a state proxy, rather than a component\nhttps://svelte.dev/e/state_proxy_unmount",hi,fi):console.warn("%c[svelte] lifecycle_double_unmount\n%cTried to unmount a component that was not mounted\nhttps://svelte.dev/e/lifecycle_double_unmount",hi,fi),Promise.resolve())}class ua{anchor;#e=new Map;#t=new Map;#n=new Map;#i=new Set;#r=!0;constructor(e,t=!0){this.anchor=e,this.#r=t}#o=()=>{var e=er;if(this.#e.has(e)){var t=this.#e.get(e),n=this.#t.get(t);if(n)as(n),this.#i.delete(t);else{var i=this.#n.get(t);i&&(this.#t.set(t,i.effect),this.#n.delete(t),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),n=i.effect)}for(const[t,n]of this.#e){if(this.#e.delete(t),t===e)break;const i=this.#n.get(n);i&&(is(i.effect),this.#n.delete(n))}for(const[e,i]of this.#t){if(e===t||this.#i.has(e))continue;const r=()=>{if(Array.from(this.#e.values()).includes(e)){var t=document.createDocumentFragment();cs(i,t),t.append(Oo()),this.#n.set(e,{effect:i,fragment:t})}else is(i);this.#i.delete(e),this.#t.delete(e)};this.#r||!n?(this.#i.add(e),os(i,r,!1)):r()}}};#s=e=>{this.#e.delete(e);const t=Array.from(this.#e.values());for(const[e,n]of this.#n)t.includes(e)||(is(n.effect),this.#n.delete(e))};ensure(e,t){var n=er;!t||this.#t.has(e)||this.#n.has(e)||this.#t.set(e,es((()=>t(this.anchor)))),this.#e.set(n,e),gi&&(this.anchor=vi),this.#o()}}{let e=function(e){if(!(e in globalThis)){let t;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(void 0!==t)return t;!function(e){{const t=new Error(`rune_outside_svelte\nThe \`${e}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files\nhttps://svelte.dev/e/rune_outside_svelte`);throw t.name="Svelte error",t}}(e)},set:e=>{t=e}})}};e("$state"),e("$effect"),e("$derived"),e("$inspect"),e("$props"),e("$bindable")}var da,ha=new Map;function fa(e,t,n=!1){gi&&ki();var i=new ua(e);function r(t,n){if(gi){if(t===(_i(e)===pn)){var r=xi();return bi(r),i.anchor=r,yi(!1),i.ensure(t,n),void yi(!0)}}i.ensure(t,n)}Jo((()=>{var e=!1;t(((t,n=!0)=>{e=!0,r(n,t)})),e||r(!1,null)}),n?Kn:0)}function pa(e,t){return t}function ma(e,t=!0){for(var n=0;n<e.length;n++)is(e[n],t)}function va(e,t,n,i,r,o=null){var s=e,a=new Map;if(!!(t&sn)){var l=e;s=gi?bi(Po(l)):l.appendChild(Oo())}gi&&ki();var c,u=null,d=ro((()=>{var e=n();return xn(e)?e:null==e?[]:Tn(e)})),h=!0;function f(){m.fallback=u,function(e,t,n,i,r){var o,s,a,l,c,u=!!(i&an),d=t.length,h=e.items,f=e.effect.first,p=null,m=[],v=[];if(u)for(c=0;c<d;c+=1){var g,y;if(a=r(t[c],c),!((l=h.get(a).e).f&Zn))null===(g=l.nodes)||void 0===g||null===(g=g.a)||void 0===g||g.measure(),(null!==(y=s)&&void 0!==y?y:s=new Set).add(l)}for(c=0;c<d;c+=1){if(a=r(t[c],c),l=h.get(a).e,null!==e.outrogroups)for(const t of e.outrogroups)t.pending.delete(l),t.done.delete(l);if(l.f&Zn){if(l.f^=Zn,l!==f){var b=p?p.next:f;l===e.effect.last&&(e.effect.last=l.prev),l.prev&&(l.prev.next=l.next),l.next&&(l.next.prev=l.prev),ba(e,p,l),ba(e,l,b),ya(l,b,n),m=[],v=[],f=(p=l).next;continue}ya(l,null,n)}var k,w;if(l.f&Vn)if(as(l),u)null===(k=l.nodes)||void 0===k||null===(k=k.a)||void 0===k||k.unfix(),(null!==(w=s)&&void 0!==w?w:s=new Set).delete(l);if(l!==f){if(void 0!==o&&o.has(l)){if(m.length<v.length){var x,_=v[0];p=_.prev;var T=m[0],I=m[m.length-1];for(x=0;x<m.length;x+=1)ya(m[x],_,n);for(x=0;x<v.length;x+=1)o.delete(v[x]);ba(e,T.prev,I.next),ba(e,p,T),ba(e,I,_),f=_,p=I,c-=1,m=[],v=[]}else o.delete(l),ya(l,f,n),ba(e,l.prev,l.next),ba(e,l,null===p?e.effect.first:p.next),ba(e,p,l),p=l;continue}for(m=[],v=[];null!==f&&f!==l;){var E;(null!==(E=o)&&void 0!==E?E:o=new Set).add(f),v.push(f),f=f.next}if(null===f)continue}l.f&Zn||m.push(l),p=l,f=l.next}if(null!==e.outrogroups){for(const t of e.outrogroups){var S;if(0===t.pending.size)ma(Tn(t.done)),null===(S=e.outrogroups)||void 0===S||S.delete(t)}0===e.outrogroups.size&&(e.outrogroups=null)}if(null!==f||void 0!==o){var A=[];if(void 0!==o)for(l of o)l.f&Vn||A.push(l);for(;null!==f;)f.f&Vn||f===e.fallback||A.push(f),f=f.next;var N=A.length;if(N>0){var M=i&sn&&0===d?n:null;if(u){for(c=0;c<N;c+=1){var F;null===(F=A[c].nodes)||void 0===F||null===(F=F.a)||void 0===F||F.measure()}for(c=0;c<N;c+=1){var C;null===(C=A[c].nodes)||void 0===C||null===(C=C.a)||void 0===C||C.fix()}}!function(e,t,n){for(var i,r=t.length,o=t.length,s=0;s<r;s++){let n=t[s];os(n,(()=>{if(i){if(i.pending.delete(n),i.done.add(n),0===i.pending.size){var t=e.outrogroups;ma(Tn(i.done)),t.delete(i),0===t.size&&(e.outrogroups=null)}}else o-=1}),!1)}if(0===o){var a=null!==n;if(a){var l=n,c=l.parentNode;zo(c),c.append(l),e.items.clear()}ma(t,!a)}else{var u;i={pending:new Set(t),done:new Set},(null!==(u=e.outrogroups)&&void 0!==u?u:e.outrogroups=new Set).add(i)}}(e,A,M)}}u&&ji((()=>{if(void 0!==s)for(l of s){var e;null===(e=l.nodes)||void 0===e||null===(e=e.a)||void 0===e||e.apply()}}))}(m,c,s,t,i),null!==u&&(0===c.length?u.f&Zn?(u.f^=Zn,ya(u,null,s)):as(u):os(u,(()=>{u=null})))}var p=Jo((()=>{var e=(c=Ds(d)).length;let l=!1;gi&&(_i(s)===pn!==(0===e)&&(bi(s=xi()),yi(!1),l=!0));for(var p=new Set,m=0;m<e;m+=1){gi&&vi.nodeType===ui&&vi.data===mn&&(s=vi,l=!0,yi(!1));var v,g=c[m],y=i(g,m),b=h?null:a.get(y);if(b)b.v&&yo(b.v,g),b.i&&yo(b.i,m);else b=ga(a,h?s:null!==(v=da)&&void 0!==v?v:da=Oo(),g,y,m,r,t,n),h||(b.e.f|=Zn),a.set(y,b);p.add(y)}0===e&&o&&!u&&(h?u=es((()=>o(s))):(u=es((()=>{var e;return o(null!==(e=da)&&void 0!==e?e:da=Oo())}))).f|=Zn),gi&&e>0&&bi(xi()),h||f(),l&&yi(!0),Ds(d)})),m={effect:p,items:a,outrogroups:null,fallback:u};h=!1,gi&&(s=vi)}function ga(e,t,n,i,r,o,s,a){var l=s&rn?s&ln?po(n):vo(n,!1,!1):null,c=s&on?po(r):null;return l&&(l.trace=()=>{var e;a()[null!==(e=null==c?void 0:c.v)&&void 0!==e?e:r]}),{v:l,i:c,e:es((()=>(o(t,null!=l?l:n,null!=c?c:r,a),()=>{e.delete(i)})))}}function ya(e,t,n){if(e.nodes)for(var i=e.nodes.start,r=e.nodes.end,o=!t||t.f&Zn?n:t.nodes.start;null!==i;){var s=Ro(i);if(o.before(i),i===r)return;i=s}}function ba(e,t,n){null===t?e.effect.first=n:t.next=n,null===n?e.effect.last=t:n.prev=t}function ka(e,t){Xo((()=>{var n,i=e.getRootNode(),r=i.host?i:null!==(n=i.head)&&void 0!==n?n:i.ownerDocument.head;if(!r.querySelector("#"+t.hash)){const e=document.createElement("style");e.id=t.hash,e.textContent=t.code,r.appendChild(e),function(e,t){var n=ha.get(e);n||(n=new Set,ha.set(e,n)),n.add(t)}(t.hash,e)}}))}function wa(e,t){var n,i=void 0;Zo((()=>{i!==(i=t())&&(n&&(is(n),n=null),i&&(n=es((()=>{Xo((()=>i(e)))}))))}))}function xa(e){var t,n,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=xa(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function _a(e){return"object"==typeof e?function(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=xa(e))&&(i&&(i+=" "),i+=t);return i}(e):null!=e?e:""}const Ta=[..." \t\n\r\f \v\ufeff"];function Ia(e,t=!1){var n=t?" !important;":";",i="";for(var r in e){var o=e[r];null!=o&&""!==o&&(i+=" "+r+": "+o+n)}return i}function Ea(e){return"-"!==e[0]||"-"!==e[1]?e.toLowerCase():e}function Sa(e,t,n,i,r,o){var s=e.__className;if(gi||s!==n||void 0===s){var a=function(e,t,n){var i=null==e?"":""+e;if(t&&(i=i?i+" "+t:t),n)for(var r in n)if(n[r])i=i?i+" "+r:r;else if(i.length)for(var o=r.length,s=0;(s=i.indexOf(r,s))>=0;){var a=s+o;0!==s&&!Ta.includes(i[s-1])||a!==i.length&&!Ta.includes(i[a])?s=a:i=(0===s?"":i.substring(0,s))+i.substring(a+1)}return""===i?null:i}(n,i,o);gi&&a===e.getAttribute("class")||(null==a?e.removeAttribute("class"):t?e.className=a:e.setAttribute("class",a)),e.__className=n}else if(o&&r!==o)for(var l in o){var c=!!o[l];null!=r&&c===!!r[l]||e.classList.toggle(l,c)}return o}function Aa(e,t={},n,i){for(var r in n){var o=n[r];t[r]!==o&&(null==n[r]?e.style.removeProperty(r):e.style.setProperty(r,o,i))}}function Na(e,t,n,i){var r=e.__style;if(gi||r!==t){var o=function(e,t){if(t){var n,i,r="";if(Array.isArray(t)?(n=t[0],i=t[1]):n=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var o=!1,s=0,a=!1,l=[];n&&l.push(...Object.keys(n).map(Ea)),i&&l.push(...Object.keys(i).map(Ea));var c=0,u=-1;const t=e.length;for(var d=0;d<t;d++){var h=e[d];if(a?"/"===h&&"*"===e[d-1]&&(a=!1):o?o===h&&(o=!1):"/"===h&&"*"===e[d+1]?a=!0:'"'===h||"'"===h?o=h:"("===h?s++:")"===h&&s--,!a&&!1===o&&0===s)if(":"===h&&-1===u)u=d;else if(";"===h||d===t-1){if(-1!==u){var f=Ea(e.substring(c,u).trim());l.includes(f)||(";"!==h&&d++,r+=" "+e.substring(c,d).trim()+";")}c=d+1,u=-1}}}return n&&(r+=Ia(n)),i&&(r+=Ia(i,!0)),""===(r=r.trim())?null:r}return null==e?null:String(e)}(t,i);gi&&o===e.getAttribute("style")||(null==o?e.removeAttribute("style"):e.style.cssText=o),e.__style=t}else i&&(Array.isArray(i)?(Aa(e,null==n?void 0:n[0],i[0]),Aa(e,null==n?void 0:n[1],i[1],"important")):Aa(e,n,i));return i}function Ma(e,t,n=!1){if(e.multiple){if(null==t)return;if(!xn(t))return void console.warn("%c[svelte] select_multiple_invalid_value\n%cThe `value` property of a `<select multiple>` element should be an array, but it received a non-array value. The selection will be kept as is.\nhttps://svelte.dev/e/select_multiple_invalid_value",hi,fi);for(var i of e.options)i.selected=t.includes(Fa(i))}else{for(i of e.options){var r=Fa(i);if(o=r,s=t,Object.is(Io(o),Io(s)))return void(i.selected=!0)}var o,s;n&&void 0===t||(e.selectedIndex=-1)}}function Fa(e){return"__value"in e?e.__value:e.value}const Ca=Symbol("class"),Oa=Symbol("style"),Pa=Symbol("is custom element"),Ra=Symbol("is html");function Da(e){if(gi){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute("value")){var n=e.value;Ba(e,"value",null),e.value=n}if(e.hasAttribute("checked")){var i=e.checked;Ba(e,"checked",null),e.checked=i}}};e.__on_r=n,ji(n),$o||($o=!0,document.addEventListener("reset",(e=>{Promise.resolve().then((()=>{if(!e.defaultPrevented)for(const n of e.target.elements){var t;null===(t=n.__on_r)||void 0===t||t.call(n)}}))}),{capture:!0}))}}function La(e,t){t?e.hasAttribute("selected")||e.setAttribute("selected",""):e.removeAttribute("selected")}function Ba(e,t,n,i){var r=Wa(e);gi&&(r[t]=e.getAttribute(t),"src"===t||"srcset"===t||"href"===t&&"LINK"===e.nodeName)?i||function(e,t,n){var i;if("srcset"===t&&function(e,t){var n=qa(e.srcset),i=qa(t);return i.length===n.length&&i.every((([e,t],i)=>t===n[i][1]&&(Ua(n[i][0],e)||Ua(e,n[i][0]))))}(e,n))return;if(Ua(null!==(i=e.getAttribute(t))&&void 0!==i?i:"",n))return;!function(e,t,n){console.warn(`%c[svelte] hydration_attribute_changed\n%cThe \`${e}\` attribute on \`${t}\` changed its value between server and client renders. The client value, \`${n}\`, will be ignored in favour of the server value\nhttps://svelte.dev/e/hydration_attribute_changed`,hi,fi)}(t,e.outerHTML.replace(e.innerHTML,e.innerHTML&&"..."),String(n))}(e,t,null!=n?n:""):r[t]!==(r[t]=n)&&("loading"===t&&(e[si]=n),null==n?e.removeAttribute(t):"string"!=typeof n&&ja(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function za(e,t,n=[],i=[],r=[],o,s=!1,a=!1){Jr(r,n,i,(n=>{var i=void 0,r={},l="SELECT"===e.nodeName,c=!1;if(Zo((()=>{var u=t(...n.map(Ds)),d=function(e,t,n,i,r=!1,o=!1){if(gi&&r&&"INPUT"===e.tagName){var s=e;("checkbox"===s.type?"defaultChecked":"defaultValue")in n||Da(s)}var a=Wa(e),l=a[Pa],c=!a[Ra];let u=gi&&l;u&&yi(!1);var d,h=t||{},f="OPTION"===e.tagName;for(var p in t)p in n||(n[p]=null);n.class?n.class=_a(n.class):n.class=null,n[Oa]&&(null!==(d=n.style)&&void 0!==d||(n.style=null));var m=ja(e);for(const r in n){let s=n[r];if(f&&"value"===r&&null==s)e.value=e.__value="",h[r]=s;else if("class"!==r)if("style"!==r){var v=h[r];if(s!==v||void 0===s&&e.hasAttribute(r)){h[r]=s;var g=r[0]+r[1];if("$$"!==g)if("on"===g){const t={},n="$$"+r;let i=r.slice(2);var y=Zs(i);if(Qs(i)&&(i=i.slice(0,-7),t.capture=!0),!y&&v){if(null!=s)continue;e.removeEventListener(i,h[n],t),h[n]=null}if(null!=s)if(y)e[`__${i}`]=s,qs([i]);else{let o=function(e){h[r].call(this,e)};h[n]=js(i,e,o,t)}else y&&(e[`__${i}`]=void 0)}else if("style"===r)Ba(e,r,s);else if("autofocus"===r)Wo(e,Boolean(s));else if(l||"__value"!==r&&("value"!==r||null==s))if("selected"===r&&f)La(e,s);else{var b=r;c||(b=ta(b));var k="defaultValue"===b||"defaultChecked"===b;if(null!=s||l||k)k||m.includes(b)&&(l||"string"!=typeof s)?(e[b]=s,b in a&&(a[b]=gn)):"function"!=typeof s&&Ba(e,b,s,o);else if(a[r]=null,"value"===b||"checked"===b){let n=e;const i=void 0===t;if("value"===b){let e=n.defaultValue;n.removeAttribute(b),n.defaultValue=e,n.value=n.__value=i?e:null}else{let e=n.defaultChecked;n.removeAttribute(b),n.defaultChecked=e,n.checked=!!i&&e}}else e.removeAttribute(r)}else e.value=e.__value=s}}else Na(e,s,null==t?void 0:t[Oa],n[Oa]),h[r]=s,h[Oa]=n[Oa];else Sa(e,"http://www.w3.org/1999/xhtml"===e.namespaceURI,s,i,null==t?void 0:t[Ca],n[Ca]),h[r]=s,h[Ca]=n[Ca]}return u&&yi(!0),h}(e,i,u,o,s,a);c&&l&&"value"in u&&Ma(e,u.value);for(let e of Object.getOwnPropertySymbols(r))u[e]||is(r[e]);for(let t of Object.getOwnPropertySymbols(u)){var h=u[t];t.description!==kn||i&&h===i[t]||(r[t]&&is(r[t]),r[t]=es((()=>wa(e,(()=>h))))),d[t]=h}i=d})),l){var u=e;Xo((()=>{Ma(u,i.value,!0),function(e){var t=new MutationObserver((()=>{Ma(e,e.__value)}));t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Go((()=>{t.disconnect()}))}(u)}))}c=!0}))}function Wa(e){var t;return null!==(t=e.__attributes)&&void 0!==t?t:e.__attributes={[Pa]:e.nodeName.includes("-"),[Ra]:e.namespaceURI===bn}}var $a=new Map;function ja(e){var t,n=e.getAttribute("is")||e.nodeName,i=$a.get(n);if(i)return i;$a.set(n,i=[]);for(var r=e,o=Element.prototype;o!==r;){for(var s in t=Sn(r))t[s].set&&i.push(s);r=Mn(r)}return i}function Ua(e,t){return e===t||new URL(e,document.baseURI).href===new URL(t,document.baseURI).href}function qa(e){return e.split(",").map((e=>e.trim().split(" ").filter(Boolean)))}function Va(e,t){return e===t||(null==e?void 0:e[ri])===t}function Ga(e={},t,n,i){return Xo((()=>{var i,r;return Yo((()=>{i=r,r=[],zs((()=>{e!==n(...r)&&(t(e,...r),i&&Va(n(...i),e)&&t(null,...i))}))})),()=>{ji((()=>{r&&Va(n(...r),e)&&t(null,...r)}))}})),e}let Ha=!1;function Ka(e,t,n,i){var r,o,s=!!(n&dn),a=!!(n&hn),l=i,c=!0,u=()=>(c&&(c=!1,l=a?zs(i):i),l);if(s){var d,h,f=ri in e||oi in e;r=null!==(d=null===(h=En(e,t))||void 0===h?void 0:h.set)&&void 0!==d?d:f&&t in e?n=>e[t]=n:void 0}var p,m=!1;if(s?[o,m]=function(e){var t=Ha;try{return Ha=!1,[e(),Ha]}finally{Ha=t}}((()=>e[t])):o=e[t],void 0===o&&void 0!==i&&(o=u(),r&&(!function(e){{const t=new Error(`props_invalid_value\nCannot do \`bind:${e}={undefined}\` when \`${e}\` has a fallback value\nhttps://svelte.dev/e/props_invalid_value`);throw t.name="Svelte error",t}}(t),r(o))),p=()=>{var n=e[t];return void 0===n?u():(c=!0,n)},!(n&un))return p;if(r){var v=e.$$legacy;return function(e,t){return arguments.length>0?((!t||v||m)&&r(t?p():e),e):p()}}var g=!1,y=(n&cn?to:ro)((()=>(g=!1,p())));y.label=t,s&&Ds(y);var b=gs;return function(e,t){if(arguments.length>0){const n=t?Ds(y):s?_o(e):e;return go(y,n),g=!0,void 0!==l&&(l=n),e}return hs&&g||b.f&Gn?y.v:Ds(y)}}var Xa,Ya,Qa,Ja;"undefined"!=typeof window&&(null!==(Ya=(Xa=null!==(Ja=(Qa=window).__svelte)&&void 0!==Ja?Ja:Qa.__svelte={}).v)&&void 0!==Ya?Ya:Xa.v=new Set).add("5");function Za(e,{include:t,exclude:n}={}){const i=e=>{const i=t=>"string"==typeof t?e===t:t.test(e);return t?t.some(i):!n||!n.some(i)};for(const[t,n]of(e=>{const t=new Set;do{for(const n of Reflect.ownKeys(e))t.add([e,n])}while((e=Reflect.getPrototypeOf(e))&&e!==Object.prototype);return t})(e.constructor.prototype)){if("constructor"===n||!i(n))continue;const r=Reflect.getOwnPropertyDescriptor(t,n);r&&"function"==typeof r.value&&(e[n]=e[n].bind(e))}return e}function el(e,t){e.getNodesAtTime(0)[0].once("nodestart",t)}class tl{constructor({position:e,gallery:t,config:n}){this.config=n,this.position=e,this.gallery=t,this.name=n.name;const{variantId:i,itemIndex:r,moduleIndex:o}=e;this.id=`${n.itemType}_${i}_${r}_${o}`,Za(this)}#a=Si(mo(_o({})),"BaseModule.#state");#l=Si(mo(null),"BaseModule.#cover");#c=Si(mo(!1),"BaseModule.#showCover");#u=Si(mo(null),"BaseModule.#Component");id;player;position;config;timeline;moduleEndListener;hasDuration=!1;coverAssets=[];get state(){return Ds(this.#a)}set state(e){go(this.#a,e,!0)}get cover(){return Ds(this.#l)}set cover(e){go(this.#l,e)}get showCover(){return Ds(this.#c)}set showCover(e){go(this.#c,e,!0)}get Component(){return Ds(this.#u)}set Component(e){go(this.#u,e)}emitModuleEnd(){var e;null===(e=this.moduleEndListener)||void 0===e||e.call(this)}start(e){this.player=e}setPosition(){this.gallery.state.playingModulePosition=this.position}play(){this.gallery.track("moduleview"),el(this.timeline,(()=>{this.setPosition()})),this.player.switchTimeline(this.timeline)}get duration(){return this.hasDuration?this.timeline.placements.reduce(((e,t)=>e+this.player.getNode(t.nodeId).duration),0):0}}function nl(e,t,n){var i,r,o;const s=(null==t||null===(i=t.entity)||void 0===i?void 0:i.entityId)||(null==t?void 0:t.assetId),a=null!==(r=null==t||null===(o=t.entity)||void 0===o?void 0:o.entityRevision)&&void 0!==r?r:null==t?void 0:t.assetRevision;return n.addNode({id:e,manifestRef:{type:"assets-delivery-service",assetId:s,assetRevision:a,availableEncodeProfiles:t.availableEncodeProfiles}})}var il=Ks('<h3 class="text-box-title svelte-wejicf"> </h3>'),rl=Ks('<span class="text-box-title svelte-wejicf"> </span>'),ol=Ks('<span class="text-box-description minimized-description svelte-wejicf"> </span>'),sl=Ks('<span class="read-more-cta svelte-wejicf" aria-hidden="true">Read more</span>'),al=Ks('<button class="expand-description-button svelte-wejicf" aria-expanded="false" aria-controls="expanded-text-content" aria-label="Expand feature description"><!> <!></button>'),ll=Ks('<button aria-expanded="true" aria-label="Collapse feature description" data-elementid="textbox-expand" data-elementtype="textbox" data-elementname="Read less" data-interactiontype="module-ui" class="svelte-wejicf">Read less</button>'),cl=Ks('<section aria-label="Feature description" aria-live="polite"><div class="text-wrapper svelte-wejicf"><div class="expanded-text-content svelte-wejicf"><!> <p class="text-box-description svelte-wejicf"> </p></div> <!></div> <!></section>');const ul={hash:"svelte-wejicf",code:".step-description-container.svelte-wejicf {width:100%;position:absolute;bottom:0;display:flex;justify-content:space-between;gap:8px;box-sizing:border-box;font-size:12px;font-weight:400;font-style:normal;line-height:16px;letter-spacing:0px;overflow:hidden;pointer-events:none;background:linear-gradient(\n rgba(255, 255, 255, 0) 0%,\n rgba(255, 255, 255, 0.9) 27.79%,\n rgba(255, 255, 255, 0.95) 100%\n );&.expanded {flex-direction:column;justify-content:flex-start;}&:not(.expanded) {button:where(.svelte-wejicf) {line-height:16px;}}}.expanded-text-content.svelte-wejicf:not([hidden]) {display:flex;flex-direction:column;gap:8px;}button.svelte-wejicf {background:none;border:none;padding:0;cursor:pointer;line-height:18px;gap:8px;letter-spacing:0%;color:#014FD3;font-size:12px;font-weight:500;flex-shrink:0;text-align:left;font-family:inherit;pointer-events:auto;}h3.svelte-wejicf, p.svelte-wejicf, span.svelte-wejicf {color:#030303;}.text-wrapper.svelte-wejicf {width:100%;}.text-box-title.svelte-wejicf {margin:0;font-weight:500;font-size:12px;}.text-box-description.svelte-wejicf {margin:0;text-align:left;font-weight:400;}.minimized-description.svelte-wejicf {overflow:hidden;line-clamp:1;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;font-weight:400;}.expand-description-button.svelte-wejicf {width:100%;display:flex;justify-content:space-between;gap:6px;flex-wrap:nowrap;.read-more-cta:where(.svelte-wejicf) {color:#014FD3;flex-shrink:0;}}"};function dl(e,t){Li(t,!0),ka(e,ul);let n=Ka(t,"textBox",3,null),i=Ka(t,"isMobile",3,!1),r=mo(!1),o=mo(null),s=mo(!1),a=io((()=>{var e;return(null===(e=n())||void 0===e?void 0:e.title)||""})),l=io((()=>{var e;return(null===(e=n())||void 0===e?void 0:e.description)||""})),c=io((()=>i()?16:18)),u=io((()=>i()?12:16));function d(){Ds(o)&&go(s,Ds(o).scrollWidth>Ds(o).clientWidth||Ds(o).scrollHeight>Ds(o).clientHeight,!0)}Ho((()=>{Ds(o)&&d()}));var h=Xs();Us("resize",Ao,d);var f=Lo(h),p=e=>{var n=cl(),d=Do(n),h=Do(d),f=Do(h),p=e=>{var t=il(),n=Do(t,!0);wi(t),Qo((()=>ia(n,Ds(a)))),Ys(e,t)};fa(f,(e=>{i()&&e(p)}));var m=Bo(f,2),v=Do(m,!0);wi(m),wi(h);var g=Bo(h,2),y=e=>{var n=al(),u=io((()=>t.gallery.interaction((()=>go(r,!0)),{elementid:"textbox-expand",elementtype:"textbox",elementname:"Read more",interactiontype:"module-ui"})));n.__click=function(...e){var t;null===(t=Ds(u))||void 0===t||t.apply(this,e)};var d=Do(n),h=e=>{var t=rl(),n=Do(t,!0);wi(t),Qo((()=>ia(n,Ds(a)))),Ys(e,t)},f=e=>{var t=ol(),n=Do(t,!0);wi(t),Ga(t,(e=>go(o,e)),(()=>Ds(o))),Qo((()=>ia(n,Ds(l)))),Ys(e,t)};fa(d,(e=>{i()&&Ds(a)?e(h):e(f,!1)}));var p=Bo(d,2),m=e=>{Ys(e,sl())};fa(p,(e=>{(i()||!i()&&Ds(s))&&e(m)})),wi(n),Qo((()=>Na(n,`line-height: ${Ds(c)}px;`))),Ys(e,n)};fa(g,(e=>{Ds(r)||e(y)})),wi(d);var b=Bo(d,2),k=e=>{var n=ll(),o=io((()=>t.gallery.interaction((()=>go(r,!1)))));n.__click=function(...e){var t;null===(t=Ds(o))||void 0===t||t.apply(this,e)},Qo((()=>Na(n,`margin-bottom: ${!i()&&Ds(r)?"8px":"0px"};\n line-height: ${Ds(u)}px;`))),Ys(e,n)};fa(b,(e=>{Ds(r)&&e(k)})),wi(n),Qo((()=>{Sa(n,1,"step-description-container "+(Ds(r)?"expanded":""),"svelte-wejicf"),Na(n,`padding: ${i()?"8px 16px":"16px 16px 64px 16px"};`),Na(h,`line-height: ${Ds(c)}px;`),Ba(h,"hidden",!Ds(r)),ia(v,Ds(l))})),Ys(e,n)};fa(f,(e=>{(Ds(a)||Ds(l))&&e(p)})),Ys(e,h),Bi()}function hl(e,t){const n=io((()=>t.state.textBox));dl(e,{get textBox(){return Ds(n)},get isMobile(){return t.isMobile},get gallery(){return t.gallery}})}qs(["click"]);var fl=Ks('<div class="toggle-option-container svelte-16pmvvn"><button data-elementtype="toggle" data-interactiontype="module-ui"> </button></div>'),pl=Ks('<div class="toggle-container svelte-16pmvvn"><div></div></div> <!>',1);const ml={hash:"svelte-16pmvvn",code:".eko-gallery-app {--toggleModule_gap: 8px;--toggleModule_padding: 10px 58px 0 0;--toggleModule_options_padding: 0;--toggleModule_options_height: auto;--toggleModule_options_width: 100%;--toggleModule_options_gap: 8px;--toggleModule_button_backgroundColor: #FFFFFF;--toggleModule_button_padding: 8px 12px;--toggleModule_button_boxShadow: 0px 2px 8px 2px rgba(0, 0, 0, 0.07);--toggleModule_button_text_fontFamily: var(--fontName);--toggleModule_button_text_fontSize: 12px;--toggleModule_button_text_fontWeight: 400;--toggleModule_button_text_fontStyle: normal;--toggleModule_button_text_lineHeight: 16px;--toggleModule_button_text_letterSpacing: -0.2px;--toggleModule_button_text_color: #000;--toggleModule_button_border_radius: 100px;--toggleModule_title_fontFamily: var(--fontName);--toggleModule_title_fontSize: 13px;--toggleModule_title_fontWeight: 400;--toggleModule_title_fontStyle: normal;--toggleModule_title_lineHeight: 120%;--toggleModule_title_letterSpacing: 0;--toggleModule_title_color: #666;--toggleModule_title_textAlignment: center;--toggleModule_note_fontFamily: var(--fontName);--toggleModule_note_fontSize: 12px;--toggleModule_note_fontWeight: 400;--toggleModule_note_fontStyle: normal;--toggleModule_note_lineHeight: 120%;--toggleModule_note_letterSpacing: 0;--toggleModule_note_color: #888;--toggleModule_note_topMargin: 4px;}.toggle-container.svelte-16pmvvn {position:absolute;top:0;padding:var(--toggleModule_padding);width:100%;display:flex;flex-direction:column;align-items:center;gap:var(--toggleModule_gap);pointer-events:auto;box-sizing:border-box;}.toggle-options.svelte-16pmvvn {width:var(--toggleModule_options_width);height:var(--toggleModule_options_height);padding:var(--toggleModule_options_padding);gap:var(--toggleModule_options_gap);display:flex;justify-content:end;margin:0;}.toggle-option-container.svelte-16pmvvn {position:relative;min-width:0;}.toggle-option-button.svelte-16pmvvn {border-radius:var(--toggleModule_button_borderRadius);font-family:var(--toggleModule_button_text_fontFamily);font-size:var(--toggleModule_button_text_fontSize);font-weight:var(--toggleModule_button_text_fontWeight);font-style:var(--toggleModule_button_text_fontStyle);line-height:var(--toggleModule_button_text_lineHeight);letter-spacing:var(--toggleModule_button_text_letterSpacing);color:var(--toggleModule_button_text_color);padding:var(--toggleModule_button_padding);border:#E4E5E8 solid 1px;background:#FBFBFB;display:flex;width:100%;height:100%;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;cursor:pointer;position:relative;transition:all 0.3s ease-in-out;animation-duration:0.5s;animation-timing-function:cubic-bezier(0.36, 0, 0, 1);animation-fill-mode:both;animation-delay:calc(var(--button-index) * 90ms);\n animation-name: svelte-16pmvvn-button-back-appear-anim;transform-origin:bottom center;border-radius:var(--toggleModule_button_border_radius);}.toggle-option-button.selected.svelte-16pmvvn {box-shadow:none;color:#FFFFFF;background:#014FD3;border-color:#014FD3;}.toggle-option-button.svelte-16pmvvn:hover:not(.selected) {background:#F3F4F6;}.toggle-option-button.svelte-16pmvvn:active:not(.selected) {background:#E4E5E8;}.toggle-option-button.svelte-16pmvvn:focus {outline-offset:4px;outline-width:2px;}\n\n@keyframes svelte-16pmvvn-button-back-appear-anim {\n from {\n transform: scale(0);\n }\n to {\n transform: scale(1);\n }\n}\n@keyframes svelte-16pmvvn-optionNoteIn {\n 0% {\n opacity: 0;\n translate: -50% -5px;\n }\n 100% {\n opacity: 1;\n translate: -50% var(--toggleModule_note_topMargin);\n }\n}"};function vl(e,t){Li(t,!0),ka(e,ml);const n=io((()=>t.state.options)),i=io((()=>t.state.currentOptionIndex)),r=io((()=>t.state.onOptionClicked)),o=io((()=>t.state.textBox));var s=pl(),a=Lo(s),l=Do(a);va(l,21,(()=>Ds(n)),pa,((e,n,o)=>{var s=fl();Na(s,`--button-index: ${o};`);var a=Do(s);let l;var c=io((()=>t.gallery.interaction((()=>Ds(r)(o)))));a.__click=function(...e){var t;null===(t=Ds(c))||void 0===t||t.apply(this,e)},Ba(a,"data-elementid",`${o+1}`);var u=Do(a,!0);wi(a),wi(s),Qo((()=>{l=Sa(a,1,"toggle-option-button svelte-16pmvvn",null,l,{selected:Ds(i)===o}),Ba(a,"data-elementname",Ds(n).label),ia(u,Ds(n).label)})),Ys(e,s)})),wi(l),wi(a);var c=Bo(a,2),u=e=>{dl(e,{get textBox(){return Ds(o)},get isMobile(){return t.isMobile},get gallery(){return t.gallery}})};fa(c,(e=>{Ds(o)&&e(u)})),Qo((()=>{var e;return Sa(l,1,`toggle-options selected-${null!==(e=Ds(i))&&void 0!==e?e:""}`,"svelte-16pmvvn")})),Ys(e,s),Bi()}qs(["click"]);var gl=new WeakSet;function yl(e){var t,n;e!==this.state.currentOptionIndex&&(this.state.currentOptionIndex=e,this.state.textBox=this.config.options[e].textBox,this.cover=this.coverAssets[e],this.synced?this.switchTo(e):(this.timeline=null===(t=this.timelines)||void 0===t?void 0:t[e],this.showCover=!0,el(this.timeline,(()=>{this.showCover=!1})),null===(n=this.player)||void 0===n||n.switchTimeline(this.timeline)))}const bl=(e,t,n)=>n>t?t:n<e?e:n;function kl(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}let wl=()=>{},xl=()=>{};function _l(e){let t;return()=>(void 0===t&&(t=e()),t)}"undefined"!=typeof process&&"production"!==(null===(rt=process.env)||void 0===rt?void 0:rt.NODE_ENV)&&(wl=(e,t,n)=>{e||"undefined"==typeof console||console.warn(kl(t,n))},xl=(e,t,n)=>{if(!e)throw new Error(kl(t,n))});const Tl=e=>e,Il=e=>1e3*e,El=e=>e/1e3;const Sl=e=>Array.isArray(e)&&"number"==typeof e[0],Al=(e,t,n=10)=>{let i="";const r=Math.max(Math.round(t/n),2);for(let t=0;t<r;t++)i+=Math.round(1e4*e(t/(r-1)))/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},Nl=2e4;function Ml(e){let t=0;let n=e.next(t);for(;!n.done&&t<Nl;)t+=50,n=e.next(t);return t>=Nl?1/0:t}const Fl=5;const Cl={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Ol=.001;function Pl({duration:e=Cl.duration,bounce:t=Cl.bounce,velocity:n=Cl.velocity,mass:i=Cl.mass}){let r,o;wl(e<=Il(Cl.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let s=1-t;s=bl(Cl.minDamping,Cl.maxDamping,s),e=bl(Cl.minDuration,Cl.maxDuration,El(e)),s<1?(r=t=>{const i=t*s,r=i*e,o=i-n,a=Dl(t,s),l=Math.exp(-r);return Ol-o/a*l},o=t=>{const i=t*s*e,o=i*n+n,a=Math.pow(s,2)*Math.pow(t,2)*e,l=Math.exp(-i),c=Dl(Math.pow(t,2),s);return(-r(t)+Ol>0?-1:1)*((o-a)*l)/c}):(r=t=>Math.exp(-t*e)*((t-n)*e+1)-Ol,o=t=>Math.exp(-t*e)*(e*e*(n-t)));const a=function(e,t,n){let i=n;for(let n=1;n<Rl;n++)i-=e(i)/t(i);return i}(r,o,5/e);if(e=Il(e),isNaN(a))return{stiffness:Cl.stiffness,damping:Cl.damping,duration:e};{const t=Math.pow(a,2)*i;return{stiffness:t,damping:2*s*Math.sqrt(i*t),duration:e}}}const Rl=12;function Dl(e,t){return e*Math.sqrt(1-t*t)}const Ll=["duration","bounce"],Bl=["stiffness","damping","mass"];function zl(e,t){return t.some((t=>void 0!==e[t]))}function Wl(e=Cl.visualDuration,t=Cl.bounce){const n="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:i,restDelta:r}=n;const o=n.keyframes[0],s=n.keyframes[n.keyframes.length-1],a={done:!1,value:o},{stiffness:l,damping:c,mass:u,duration:d,velocity:h,isResolvedFromDuration:f}=function(e){let t={velocity:Cl.velocity,stiffness:Cl.stiffness,damping:Cl.damping,mass:Cl.mass,isResolvedFromDuration:!1,...e};if(!zl(e,Bl)&&zl(e,Ll))if(e.visualDuration){const n=e.visualDuration,i=2*Math.PI/(1.2*n),r=i*i,o=2*bl(.05,1,1-(e.bounce||0))*Math.sqrt(r);t={...t,mass:Cl.mass,stiffness:r,damping:o}}else{const n=Pl(e);t={...t,...n,mass:Cl.mass},t.isResolvedFromDuration=!0}return t}({...n,velocity:-El(n.velocity||0)}),p=h||0,m=c/(2*Math.sqrt(l*u)),v=s-o,g=El(Math.sqrt(l/u)),y=Math.abs(v)<5;let b;if(i||(i=y?Cl.restSpeed.granular:Cl.restSpeed.default),r||(r=y?Cl.restDelta.granular:Cl.restDelta.default),m<1){const e=Dl(g,m);b=t=>{const n=Math.exp(-m*g*t);return s-n*((p+m*g*v)/e*Math.sin(e*t)+v*Math.cos(e*t))}}else if(1===m)b=e=>s-Math.exp(-g*e)*(v+(p+g*v)*e);else{const e=g*Math.sqrt(m*m-1);b=t=>{const n=Math.exp(-m*g*t),i=Math.min(e*t,300);return s-n*((p+m*g*v)*Math.sinh(i)+e*v*Math.cosh(i))/e}}const k={calculatedDuration:f&&d||null,next:e=>{const t=b(e);if(f)a.done=e>=d;else{let n=0===e?p:0;m<1&&(n=0===e?Il(p):function(e,t,n){const i=Math.max(t-Fl,0);return r=n-e(i),(o=t-i)?r*(1e3/o):0;var r,o}(b,e,t));const o=Math.abs(n)<=i,l=Math.abs(s-t)<=r;a.done=o&&l}return a.value=a.done?s:t,a},toString:()=>{const e=Math.min(Ml(k),Nl),t=Al((t=>k.next(e*t).value),e,30);return e+"ms "+t},toTransition:()=>{}};return k}Wl.applyToOptions=e=>{const t=function(e,t=100,n){const i=n({...e,keyframes:[0,t]}),r=Math.min(Ml(i),Nl);return{type:"keyframes",ease:e=>i.next(r*e).value/t,duration:El(r)}}(e,100,Wl);return e.ease=t.ease,e.duration=Il(t.duration),e.type="keyframes",e};const $l=e=>null!==e;class jl{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise((e=>{this.resolve=e}))}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}}function Ul(e){for(let n=1;n<e.length;n++){var t;null!==(t=e[n])&&void 0!==t||(e[n]=e[n-1])}}const ql=e=>e.startsWith("--");const Vl=_l((()=>void 0!==window.ScrollTimeline)),Gl={};function Hl(e,t){const n=_l(e);return()=>{var e;return null!==(e=Gl[t])&&void 0!==e?e:n()}}const Kl=Hl((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0}),"linearEasing"),Xl=([e,t,n,i])=>`cubic-bezier(${e}, ${t}, ${n}, ${i})`,Yl={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Xl([0,.65,.55,1]),circOut:Xl([.55,0,1,.45]),backIn:Xl([.31,.01,.66,-.59]),backOut:Xl([.33,1.53,.69,.99])};function Ql(e,t){return e?"function"==typeof e?Kl()?Al(e,t):"ease-out":Sl(e)?Xl(e):Array.isArray(e)?e.map((e=>Ql(e,t)||Yl.easeOut)):Yl[e]:void 0}function Jl(e,t,n,{delay:i=0,duration:r=300,repeat:o=0,repeatType:s="loop",ease:a="easeOut",times:l}={},c=void 0){const u={[t]:n};l&&(u.offset=l);const d=Ql(a,r);Array.isArray(d)&&(u.easing=d);const h={delay:i,duration:r,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:o+1,direction:"reverse"===s?"alternate":"normal"};c&&(h.pseudoElement=c);return e.animate(u,h)}class Zl extends jl{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:n,keyframes:i,pseudoElement:r,allowFlatten:o=!1,finalKeyframe:s,onComplete:a}=e;this.isPseudoElement=Boolean(r),this.allowFlatten=o,this.options=e,xl("string"!=typeof e.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:e,...t}){return function(e){return"function"==typeof e&&"applyToOptions"in e}(e)&&Kl()?e.applyToOptions(t):(null!==(n=t.duration)&&void 0!==n||(t.duration=300),null!==(i=t.ease)&&void 0!==i||(t.ease="easeOut"),t);var n,i}(e);this.animation=Jl(t,n,i,l,r),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!r){const e=function(e,{repeat:t,repeatType:n="loop"},i,r=1){const o=e.filter($l),s=r<0||t&&"loop"!==n&&t%2==1?0:o.length-1;return s&&void 0!==i?i:o[s]}(i,this.options,s,this.speed);this.updateMotionValue?this.updateMotionValue(e):function(e,t,n){ql(t)?e.style.setProperty(t,n):e.style[t]=n}(t,n,e),this.animation.cancel()}null==a||a(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,t;null===(e=(t=this.animation).finish)||void 0===e||e.call(t)}cancel(){try{this.animation.cancel()}catch(e){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;"idle"!==e&&"finished"!==e&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var e,t;this.isPseudoElement||(null===(e=(t=this.animation).commitStyles)||void 0===e||e.call(t))}get duration(){var e,t;const n=(null===(e=this.animation.effect)||void 0===e||null===(t=e.getComputedTiming)||void 0===t?void 0:t.call(e).duration)||0;return El(Number(n))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+El(e)}get time(){return El(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Il(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){var e;return null!==(e=this.manualStartTime)&&void 0!==e?e:Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){var n;this.allowFlatten&&(null===(n=this.animation.effect)||void 0===n||n.updateTiming({easing:"linear"}));return this.animation.onfinish=null,e&&Vl()?(this.animation.timeline=e,Tl):t(this)}}class ec{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map((e=>e.finished)))}getAll(e){return this.animations[0][e]}setAll(e,t){for(let n=0;n<this.animations.length;n++)this.animations[n][e]=t}attachTimeline(e){const t=this.animations.map((t=>t.attachTimeline(e)));return()=>{t.forEach(((e,t)=>{e&&e(),this.animations[t].stop()}))}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return tc(this.animations,"duration")}get iterationDuration(){return tc(this.animations,"iterationDuration")}runAll(e){this.animations.forEach((t=>t[e]()))}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function tc(e,t){let n=0;for(let i=0;i<e.length;i++){const r=e[i][t];null!==r&&r>n&&(n=r)}return n}class nc extends ec{then(e,t){return this.finished.finally(e).then((()=>{}))}}const ic=new WeakMap,rc=(e,t="")=>`${e}:${t}`;function oc(e){const t=ic.get(e)||new Map;return ic.set(e,t),t}function sc(e,t){var n,i;return null!==(n=null!==(i=null==e?void 0:e[t])&&void 0!==i?i:null==e?void 0:e.default)&&void 0!==n?n:e}const ac=new Set(["borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","width","maxWidth","height","maxHeight","top","right","bottom","left","inset","insetBlock","insetBlockStart","insetBlockEnd","insetInline","insetInlineStart","insetInlineEnd","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingBlock","paddingBlockStart","paddingBlockEnd","paddingInline","paddingInlineStart","paddingInlineEnd","margin","marginTop","marginRight","marginBottom","marginLeft","marginBlock","marginBlockStart","marginBlockEnd","marginInline","marginInlineStart","marginInlineEnd","fontSize","backgroundPositionX","backgroundPositionY"]);function lc(e,t){for(let n=0;n<e.length;n++)"number"==typeof e[n]&&ac.has(t)&&(e[n]=e[n]+"px")}function cc(e,t){const n=window.getComputedStyle(e);return ql(t)?n.getPropertyValue(t):n[t]}function uc(e,t,n,i){if(null==e)return[];const r=function(e){if(null==e)return[];if(e instanceof EventTarget)return[e];if("string"==typeof e){const t=document.querySelectorAll(e);return t?Array.from(t):[]}return Array.from(e).filter((e=>null!=e))}(e),o=r.length;xl(Boolean(o),"No valid elements provided.","no-valid-elements");const s=[];for(let e=0;e<o;e++){const i=r[e],a={...n};"function"==typeof a.delay&&(a.delay=a.delay(e,o));for(const e in t){let n=t[e];Array.isArray(n)||(n=[n]);const r={...sc(a,e)};r.duration&&(r.duration=Il(r.duration)),r.delay&&(r.delay=Il(r.delay));const o=oc(i),l=rc(e,r.pseudoElement||""),c=o.get(l);c&&c.stop(),s.push({map:o,key:l,unresolvedKeyframes:n,options:{...r,element:i,name:e,allowFlatten:!a.type&&!a.ease}})}}for(let e=0;e<s.length;e++){const{unresolvedKeyframes:t,options:n}=s[e],{element:i,name:r,pseudoElement:o}=n;o||null!==t[0]||(t[0]=cc(i,r)),Ul(t),lc(t,r),!o&&t.length<2&&t.unshift(cc(i,r)),n.keyframes=t}const a=[];for(let e=0;e<s.length;e++){const{map:t,key:n,options:i}=s[e],r=new Zl(i);t.set(n,r),r.finished.finally((()=>t.delete(n))),a.push(r)}return a}const dc=(()=>function(e,t,n){return new nc(uc(e,t,n))})();var hc=Ks('<button class="svelte-16kucsb"><div class="svelte-16kucsb"> </div></button>'),fc=Ks('<div class="tryIt-container svelte-16kucsb"><!></div>');const pc={hash:"svelte-16kucsb",code:".eko-gallery-app {--tryItModule_justifyContent: center;--tryItModule_alignItems: flex-end;--tryItModule_padding: 16px 20px 48px 20px;--tryItModule_button_padding: 16px 32px;--tryItModule_button_textAlign: center;--tryItModule_button_borderRadius: 100px;--tryItModule_button_border: 0;--tryItModule_button_boxShadow: 0 4px 24px 2px rgba(0, 0, 0, 0.12);--tryItModule_button_background: #FFFFFF;--tryItModule_button_text_fontFamily: var(--fontName);--tryItModule_button_text_fontSize: 18px;--tryItModule_button_text_color: #222;--tryItModule_button_text_weight: 500;--tryItModule_button_text_lineHeight: 120%;--tryItModule_button_text_letterSpacing: -0.1px;}.tryIt-container.svelte-16kucsb {position:relative;padding:var(--tryItModule_padding);width:100%;height:100%;box-sizing:border-box;display:flex;justify-content:var(--tryItModule_justifyContent);align-items:var(--tryItModule_alignItems);}.tryIt-container.svelte-16kucsb button:where(.svelte-16kucsb) {padding:var(--tryItModule_button_padding);text-align:var(--tryItModule_button_textAlign);border-radius:var(--tryItModule_button_borderRadius);border:var(--tryItModule_button_border);background:var(--tryItModule_button_background);box-shadow:var(--tryItModule_button_boxShadow);font-family:var(--tryItModule_button_text_fontFamily);font-size:var(--tryItModule_button_text_fontSize);color:var(--tryItModule_button_text_color);font-weight:var(--tryItModule_button_text_weight);line-height:var(--tryItModule_button_text_lineHeight);letter-spacing:var(--tryItModule_button_text_letterSpacing);cursor:pointer;opacity:0;overflow:hidden;}.tryIt-container.svelte-16kucsb button:where(.svelte-16kucsb) div:where(.svelte-16kucsb) {opacity:0;}"};function mc(e,t){Li(t,!0),ka(e,pc);const n=io((()=>t.state.ctaText)),i=io((()=>t.state.animationConfig)),r=io((()=>t.state.showCta)),o=io((()=>t.state.onCtaClick));let s=null,a=null,l=mo(!1),c=!1;function u(){c&&dc(s,{transform:"scale(1.05)"},{type:Wl,mass:1.5,stiffness:400,damping:30})}function d(){c&&dc(s,{transform:"scale(1)"},{type:Wl,mass:1.5,stiffness:400,damping:30})}function h(){c&&dc(s,{transform:"scale(0.95)"},{type:Wl,mass:1,stiffness:600,damping:30})}Ho((()=>{const{mass:e,stiffness:t,damping:n,delay:o}=Ds(i);let u;return Ds(r)&&(u=setTimeout((async()=>{go(l,!0),u=null,dc(s,{transform:["translateY(40px) scale(0, 0.2)","translateY(0) scale(1, 1)"],opacity:1},{type:Wl,mass:e,stiffness:t,damping:n}),await dc(a,{transform:["translateY(20px) scale(0.8)","translateY(0) scale(1)"],opacity:1},{type:Wl,mass:e,stiffness:t,damping:n,delay:.15}),c=!0}),o)),()=>{u&&clearTimeout(u)}}));var f=fc(),p=Do(f),m=e=>{var t=hc();t.__mousedown=h,t.__touchstart=h,t.__click=function(...e){var t;null===(t=Ds(o))||void 0===t||t.apply(this,e)};var i=Do(t),r=Do(i,!0);wi(i),Ga(i,(e=>a=e),(()=>a)),wi(t),Ga(t,(e=>s=e),(()=>s)),Qo((()=>{Na(t,"pointer-events: "+(Ds(l)?"auto":"none")),ia(r,Ds(n))})),Us("mouseenter",t,u),Us("mouseleave",t,d),Ys(e,t)};fa(p,(e=>{Ds(r)&&e(m)})),wi(f),Ys(e,f),Bi()}qs(["mousedown","touchstart","click"]);var vc=new WeakSet;function gc(){this.mainTimeline?this.player.switchTimeline(this.mainTimeline):this.emitModuleEnd(),this.state.showCta=!1}const yc={videoModule:class extends tl{constructor({config:e,...t}){var n;super({...t,config:e}),this.Component=hl,this.hasDuration=!e.loop,Za(this),this.coverAssets.push(null!==(n=e.intro)&&void 0!==n?n:e.video),this.cover=this.coverAssets[0],this.state={textBox:e.textBox}}start(e){super.start(e),this.timeline=e.createTimeline();const t=this.config;t.intro&&this.timeline.placeOnTimeline(nl(`${this.id}_intro`,t.intro,e),"end");const n=nl(this.id,t.video,e);this.timeline.placeOnTimeline(n,"end",{loop:t.loop}),t.loop||n.on("nodeend",this.emitModuleEnd)}},toggleModule:class extends tl{constructor({config:e,...t}){super({...t,config:e}),O(this,gl),this.Component=vl,this.synced=e.sync,this.switchTo=()=>{},Za(this),this.coverAssets=e.options.map((e=>{var t;return null!==(t=e.intro)&&void 0!==t?t:e.video})),this.cover=this.coverAssets[0],this.state={options:e.options.map((e=>({label:e.label,note:e.note}))),currentOptionIndex:0,onOptionClicked:A(gl,this,yl).bind(this),textBox:e.options[0].textBox}}start(e){super.start(e),this.synced?(this.timeline=e.createTimeline(),this.config.options.forEach(((t,n)=>{this.timeline.placeOnTimeline(nl(`${this.id}_option_${n}`,t.video,e),0,{loop:!0})})),this.timeline.placeRenderNodeOnTimeline("switch",0,1/0,{params:{switchCrossfadeSeconds:.25,initSwitching:({switchTo:e})=>{this.switchTo=e,e(this.state.currentOptionIndex,{crossfadeSeconds:0})}}})):(this.timelines=this.config.options.map(((t,n)=>{const i=e.createTimeline();return t.intro&&i.placeOnTimeline(nl(`${this.id}_option_${n}_intro`,t.intro,e),"end"),i.placeOnTimeline(nl(`${this.id}_option_${n}`,t.video,e),"end",{loop:!0}),i})),this.timeline=this.timelines[this.state.currentOptionIndex])}},tryItModule:class extends tl{constructor({config:e,...t}){var n;super({...t,config:e}),O(this,vc),Za(this);const{introVideo:i}=e;this.coverAssets.push(null!==(n=i.intro)&&void 0!==n?n:i.loop),this.cover=this.coverAssets[0],this.state={ctaText:e.ctaText,animationConfig:e.animationConfig,showCta:!0,onCtaClick:A(vc,this,gc).bind(this)}}start(e){super.start(e),this.Component=mc,this.timeline=e.createTimeline();const{introVideo:t,mainVideo:n}=this.config;if(t.intro&&this.timeline.placeOnTimeline(nl(`${this.id}_intro_intro`,t.intro,e)),this.timeline.placeOnTimeline(nl(`${this.id}_intro_loop`,t.loop,e),"end",{loop:!0}),n){this.mainTimeline=e.createTimeline(),n.intro&&this.mainTimeline.placeOnTimeline(nl(`${this.id}_main_intro`,n.intro,e));const t=nl(`${this.id}_main_loop`,n.loop,e);this.mainTimeline.placeOnTimeline(t,"end",{loop:!0})}}play(){this.state.showCta=!0,super.play()}}};class bc{#d=Si(mo({}),"GalleryState.#variants");#h=Si(mo("ekonovar"),"GalleryState.#activeVariant");#f=Si(mo(0),"GalleryState.#activeItemIndex");#p=Si(mo(0),"GalleryState.#activeModuleIndex");#m=Si(mo(_o({itemIndex:0,moduleIndex:0})),"GalleryState.#playingModulePosition");#v=Si(io((()=>{var e;return null===(e=Ds(this.#d))||void 0===e?void 0:e[Ds(this.#h)]})),"GalleryState.#currentItemsList");#g=Si(io((()=>{var e;return null===(e=Ds(this.#v))||void 0===e?void 0:e[Ds(this.#f)]})),"GalleryState.#currentItem");#y=Si(io((()=>{var e,t;return Ds(this.#b)?null===(t=Ds(this.#v))||void 0===t?void 0:t[Ds(this.#m).itemIndex].modules[Ds(this.#m).moduleIndex]:null===(e=Ds(this.#g))||void 0===e?void 0:e.modules[Ds(this.#p)]})),"GalleryState.#currentModule");#k=Si(io((()=>{var e;return(null===(e=Ds(this.#v))||void 0===e?void 0:e.flatMap((e=>e.modules)))||[]})),"GalleryState.#currentModulesList");#w=Si(mo(!1),"GalleryState.#playerLoaded");#x=Si(mo(!1),"GalleryState.#paused");#b=Si(mo(!1),"GalleryState.#startedPlaying");#_=Si(io((()=>!(So(Ds(this.#m).itemIndex,this.activeItemIndex)&&So(Ds(this.#m).moduleIndex,this.activeModuleIndex)))),"GalleryState.#seeking");set variants(e){go(this.#d,e)}set activeVariant(e){go(this.#h,e,!0)}set activeItemIndex(e){go(this.#f,e,!0)}set activeModuleIndex(e){go(this.#p,e,!0)}set playingModulePosition(e){go(this.#m,e,!0)}set playerLoaded(e){go(this.#w,e,!0)}set paused(e){go(this.#x,e,!0)}set startedPlaying(e){go(this.#b,e,!0)}get variants(){return Ds(this.#d)}get activeVariant(){return Ds(this.#h)}get activeItemIndex(){return Ds(this.#f)}get activeModuleIndex(){return Ds(this.#p)}get playingModulePosition(){return Ds(this.#m)}get currentItemsList(){return Ds(this.#v)}get currentItem(){return Ds(this.#g)}get currentModule(){return Ds(this.#y)}get playerLoaded(){return Ds(this.#w)}get paused(){return Ds(this.#x)}get startedPlaying(){return Ds(this.#b)}get seeking(){return Ds(this.#_)}get currentModulesList(){return Ds(this.#k)}}const kc={assetsDeliveryBase:"https://{{env}}assets.eko.com"};const wc=2,xc=5,_c=["activeItemIndex","activeModuleIndex","paused","startedPlaying"],Tc=["version","selectItem","selectItemAndStep","next","prev","subscribe"];var Ic=new WeakMap,Ec=new WeakMap,Sc=new WeakMap,Ac=new WeakMap,Nc=new WeakMap,Mc=new WeakSet;class Fc{constructor(e){var t,n,i,r,o;O(this,Mc),F(this,Ic,void 0),F(this,Ec,void 0),F(this,Sc,void 0),F(this,Ac,void 0),F(this,Nc,void 0),P(this,"public",void 0),P(this,"version","0.0.11"),Za(this),C(Ic,this,(null===(t=crypto)||void 0===t||null===(n=t.randomUUID)||void 0===n?void 0:n.call(t))||`eko-gallery-${Date.now()}`),C(Ac,this,e),C(Ec,this,new bc(null==e||null===(i=e.options)||void 0===i?void 0:i.galleryEnv)),C(Nc,this,((e="")=>(So(e,"production")&&(e=""),Object.fromEntries(Object.entries(kc).map((([t,n])=>[t,n.replaceAll("{{env}}",e)])))))(null==e||null===(r=e.options)||void 0===r?void 0:r.galleryEnv)),C(Sc,this,[]);const s=null==e||null===(o=e.instance)||void 0===o||null===(o=o.data)||void 0===o||null===(o=o.blocks)||void 0===o||null===(o=o.blocksArr)||void 0===o||null===(o=o.find((e=>So(e.blockType,"GalleryBlock"))))||void 0===o?void 0:o.config;var a;s?(A(Mc,this,Cc).call(this,s.items),A(Mc,this,Oc).call(this,s.items),function(e,t){function n(t){window.EkoAnalytics("registerContextPacker",{tag:e,...t})}function i(t){return function(...n){return n.pop()!==e?null:t(...n)}}"undefined"!=typeof window&&window.EkoAnalytics&&(n({schema:"iglu:com.helloeko/gallery-app/jsonschema/1-0-0",match:/.*/,getData:i((()=>{var e,n,i,r,o;const s=null===(e=t.currentItem)||void 0===e?void 0:e.modules[t.activeModuleIndex];return{itemid:(null===(n=t.currentItem)||void 0===n?void 0:n.id)||"",itemindex:t.activeItemIndex,totalitems:(null===(i=t.currentItemsList)||void 0===i?void 0:i.length)||0,itemname:(null===(r=t.currentItem)||void 0===r?void 0:r.name)||"",moduleid:(null==s?void 0:s.id)||"",modulename:(null==s?void 0:s.name)||"",moduletype:(null==s?void 0:s.config.itemType)||"",moduleindex:t.activeModuleIndex,totalmodules:(null===(o=t.currentItem)||void 0===o?void 0:o.modules.length)||0,version:"0.0.11"}}))}),n({schema:"iglu:com.helloeko/implementation_interactions/jsonschema/1-0-6",match:"interaction",getData:i((e=>e))}))}(M(Ic,this),M(Ec,this))):console.warn("[eko-gallery-app] Gallery initiated without an instance, results will be empty"),this.public=(a=this,Tc.reduce(((e,t)=>{if(!(t in a))throw new Error(`[eko-gallery-app] Public API member "${t}" does not exist on GalleryLogic`);const n=a[t];return e[t]=So(typeof n,"function")?n.bind(a):n,e}),{}))}dispose(){var e,t;So(typeof window,"undefined",!1)&&(null===(e=(t=window).EkoAnalytics)||void 0===e||e.call(t,"reset",M(Ic,this)))}start(e){M(Ec,this).playerLoaded=!0,M(Sc,this).forEach((t=>{t.start(e)})),C(Sc,this,null),A(Mc,this,Pc).call(this,e),M(Ec,this).currentModule.play()}selectItem(e){const t=M(Ec,this);So(e,t.activeItemIndex)||(t.activeItemIndex=e,t.activeModuleIndex=0)}selectItemAndStep(e,t){const n=M(Ec,this);So(e,n.activeItemIndex)&&So(t,n.activeModuleIndex)||(n.activeItemIndex=e,n.activeModuleIndex=t)}next(){A(Mc,this,Dc).call(this)}prev(){const e=M(Ec,this);if(e.activeModuleIndex=e.activeModuleIndex-1,!e.currentItem.modules[e.activeModuleIndex])if(e.currentItemsList[e.activeItemIndex-1]){e.activeItemIndex=e.activeItemIndex-1;const t=e.currentItemsList[e.activeItemIndex];e.activeModuleIndex=t.modules.length-1}else e.activeModuleIndex=e.activeModuleIndex+1}subscribe(e){const t=M(Ec,this);return function(e){pr.ensure();const t=qo(zn|Qn,e,!0);return()=>{is(t)}}((()=>{Ho((()=>{const n=_c.reduce(((e,n)=>(e[n]=t[n],e)),{});e(n)}))}))}getCoverUrl(e,t){var n,i,r,o;const s=(null==e||null===(n=e.entity)||void 0===n?void 0:n.entityId)||(null==e?void 0:e.assetId),a=null!==(i=null==e||null===(r=e.entity)||void 0===r?void 0:r.entityRevision)&&void 0!==i?i:null==e?void 0:e.assetRevision;if(!s)throw new Error(`[getCoverUrl] No assetId found in assetConfig: ${JSON.stringify(e||{},null,2)}`);if(!a&&So(a,0,!1))throw new Error(`[getCoverUrl] No assetRevision found for asset ${s}.`);let l;return null!==(o=M(Ac,this))&&void 0!==o&&null!==(o=o.coverAssetsMap)&&void 0!==o&&o[s]?(l=new URL(M(Ac,this).coverAssetsMap[s]),/^[a-z0-9]*assets.eko.com$/.test(l.host)&&t&&(l.pathname=l.pathname.replace(".png",".webp"))):(l=new URL(`${M(Nc,this).assetsDeliveryBase}/image/${s}/${a}?startOffset=0`),l.pathname+=t?".webp":".png"),t&&l.searchParams.set("width",t),l.href}track(e,...t){var n,i;So(typeof window,"undefined",!1)&&(null===(n=(i=window).EkoAnalytics)||void 0===n||n.call(i,"track",e,...t,M(Ic,this)))}interaction(e,t){const n=M(Ic,this);return i=>{if(So(typeof window,"undefined",!1)){var r,o,s,a;const e=null==i||null===(r=i.target)||void 0===r?void 0:r.dataset;let l;null!=i&&null!==(o=i.detail)&&void 0!==o&&o.direction&&(So(i.detail.direction,"left")?l="swipe_next":So(i.detail.direction,"right")&&(l="swipe_prev"));const c={elementid:(null==e?void 0:e.elementid)||(null==t?void 0:t.elementid)||"",elementtype:(null==e?void 0:e.elementtype)||(null==t?void 0:t.elementtype)||"",elementname:(null==e?void 0:e.elementname)||(null==t?void 0:t.elementname)||"",interactiontype:l||(null==e?void 0:e.interactiontype)||(null==t?void 0:t.interactiontype)||""};null===(s=(a=window).EkoAnalytics)||void 0===s||s.call(a,"track","interaction",c,n)}e(i)}}get uuid(){return M(Ic,this)}get state(){return M(Ec,this)}get urls(){return M(Nc,this)}}function Cc(e){const t={};for(let n of e)for(let e of Object.keys(n.variants||{}))t[e]=[];t.ekonovar=[],M(Ec,this).variants=t}function Oc(e){const t=(e=[],t)=>{const n=[];for(let[i,r]of e.entries()){if(!yc[r.itemType])throw new Error(`Unknown module type ${r.itemType}`);const e=new yc[r.itemType]({position:{...t,moduleIndex:i},config:r,gallery:this});e.moduleEndListener=A(Mc,this,Rc).bind(this),n.push(e)}return n};for(const[i,r]of e.entries())if(So(r.itemType,"galleryItemV2")){const{modules:e,...o}=r;for(const[s,a]of Object.entries(M(Ec,this).variants)){var n;if(null===(n=r.variants)||void 0===n?void 0:n[s])console.log("NO IMPLEMENTED");else{const n={...o};n.modules=t(e,{variantId:s,itemIndex:i}),C(Sc,this,[...M(Sc,this),...n.modules]),a.push(n)}}}}function Pc(e){for(const[,t]of Object.entries(M(Ec,this).variants))for(const[n,i]of t.entries()){const r=i.modules,o=t.filter((e=>So(e,i,!1))).map((e=>e.modules[0]));for(const[i,s]of r.entries()){let a=r[i+1];a||(a=t[(n+1)%t.length].modules[0]);const l=a.timeline.getNodesAtTime(0)[0],c=o.filter((e=>So(e,a,!1))).map((e=>e.timeline.getNodesAtTime(0)[0])),u=[{nodeId:l.id,weight:wc},...c.map((e=>({nodeId:e.id,weight:xc})))];for(const t of s.timeline.placements){e.getNode(t.nodeId).setChildren(u)}}}}function Rc(){const e=M(Ec,this),t=e.currentItem.modules;t.length>1&&So(e.activeModuleIndex,t.length-1)?e.activeModuleIndex=0:A(Mc,this,Dc).call(this)}function Dc(){const e=M(Ec,this);e.activeModuleIndex=e.activeModuleIndex+1,e.currentItem.modules[e.activeModuleIndex]||(e.currentItemsList[e.activeItemIndex+1]?(e.activeItemIndex=e.activeItemIndex+1,e.activeModuleIndex=0):e.activeModuleIndex=e.activeModuleIndex-1)}var Lc=Ks('<button><span class="svelte-er27y2"> </span></button>'),Bc=Ks('<div class="nav-buttons-container svelte-er27y2"><div class="nav-buttons svelte-er27y2"></div></div>');const zc={hash:"svelte-er27y2",code:".eko-gallery-app {--nav_gap: 10px;--nav_padding: 12px 16px;--nav_bgColor: #FFFFFF;--nav_justifyContent: center;--nav_button_width: fit-content;--nav_button_bgColor: #FFFFFF;--nav_button_borderRadius: 100px;--nav_button_paddingTop: 8px;--nav_button_paddingBottom: var(--nav_button_paddingTop);--nav_button_paddingLeft: 12px;--nav_button_paddingRight: var(--nav_button_paddingLeft);--nav_button_boxShadow: 0 0 0 1px #E7E7E7;--nav_button_gap: 2px;--nav_button_selected_boxShadow: 0 0 0 1px #000000;--nav_button_selected_bgColor: var(--nav_button_bgColor);--nav_button_text_color: #000000;--nav_button_text_fontSize: 14px;--nav_button_text_fontWeight: 500;--nav_button_text_fontFamily: var(--fontName);--nav_button_text_lineHeight: 120%;--nav_button_text_letterSpacing: 0px;--nav_button_text_align: center;--nav_button_selected_text_color: var(--nav_button_text_color);--nav_button_selected_text_fontWeight: var(--nav_button_text_fontWeight);--nav_button_image_borderRadius: calc(var(--nav_button_borderRadius) - var(--nav_button_paddingTop));--nav_arrow_color: var(--secondaryColor);--nav_arrow_bgColor: var(--primaryColor);--nav_arrow_padding: 9px;--nav_arrow_size: 28px;--nav_arrow_boxShadow: 0 0 8px 0 rgba(0, 0, 0, 0.3);}.nav-buttons-container.svelte-er27y2 {width:100%;background-color:var(--nav_bgColor);height:var(--buttonsContainerHeight);display:flex;box-sizing:border-box;text-align:center;justify-content:var(--nav_justifyContent);align-items:center;position:relative;flex-shrink:0;}.nav-buttons-container.svelte-er27y2 :where(.svelte-er27y2) {touch-action:auto;}.nav-buttons.svelte-er27y2 {display:flex;margin:0;gap:var(--nav_gap);height:100%;align-items:center;padding:var(--nav_padding);box-sizing:border-box;overflow-x:auto;scrollbar-width:none;max-width:100%;width:fit-content;overflow-y:hidden;overscroll-behavior-y:none;}.nav-button.svelte-er27y2 {display:flex;outline:none;flex-shrink:0;height:100%;width:var(--nav_button_width);border:none;cursor:pointer;align-items:center;gap:var(--nav_button_gap);background-color:var(--nav_button_bgColor);border-radius:var(--nav_button_borderRadius);\n /* eslint-disable-next-line max-len */padding:var(--nav_button_paddingTop) var(--nav_button_paddingRight) var(--nav_button_paddingBottom) var(--nav_button_paddingLeft);box-shadow:var(--nav_button_boxShadow);}.nav-button.svelte-er27y2 span:where(.svelte-er27y2) {flex:1 0 0;transition:color 0.2s ease-in-out;color:var(--nav_button_text_color);font-weight:var(--nav_button_text_fontWeight);font-size:var(--nav_button_text_fontSize);font-family:var(--nav_button_text_fontFamily);line-height:var(--nav_button_text_lineHeight);letter-spacing:var(--nav_button_text_letterSpacing);text-align:var(--nav_button_text_align);}.nav-button.selected.svelte-er27y2 {background-color:var(--nav_button_selected_bgColor);box-shadow:var(--nav_button_selected_boxShadow);}.nav-button.selected.svelte-er27y2 span:where(.svelte-er27y2) {color:var(--nav_button_selected_text_color);font-weight:var(--nav_button_selected_text_fontWeight);}"};qs(["click"]);const Wc="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20320%20512'%3e%3cpath%20d='M310.6%20233.4c12.5%2012.5%2012.5%2032.8%200%2045.3l-192%20192c-12.5%2012.5-32.8%2012.5-45.3%200s-12.5-32.8%200-45.3L242.7%20256%2073.4%2086.6c-12.5-12.5-12.5-32.8%200-45.3s32.8-12.5%2045.3%200l192%20192z'/%3e%3c/svg%3e";var $c=Ks('<button><img class="svelte-1al44kl"/></button>');const jc={hash:"svelte-1al44kl",code:'.nav-button.svelte-1al44kl {height:30px;width:30px;border-radius:100%;background-color:transparent;padding:9px;box-sizing:border-box;display:flex;align-items:center;justify-content:center;pointer-events:auto;border:0;opacity:100%;cursor:pointer;transition-property:background-color, box-shadow, opacity;position:relative;}.nav-button.prev.svelte-1al44kl {transform:rotate(180deg);}.nav-button.hidden.svelte-1al44kl {opacity:0;pointer-events:none;}.nav-button.svelte-1al44kl::before {content:"";position:absolute;top:-8px;right:-8px;bottom:-8px;left:-8px;}.nav-button.svelte-1al44kl img:where(.svelte-1al44kl) {height:100%;}'};function Uc(e,t){ka(e,jc);const n=Ka(t,"hidden",3,!1);var i=$c();let r;i.__click=function(...e){var n;null===(n=t.onClick)||void 0===n||n.apply(this,e)};var o=Do(i);wi(i),Qo((()=>{var e;r=Sa(i,1,`nav-button ${null!==(e=t.type)&&void 0!==e?e:""}`,"svelte-1al44kl",r,{hidden:n()}),Ba(i,"aria-label",t.type),Ba(o,"src",Wc),Ba(o,"alt",t.type)})),Ys(e,i)}qs(["click"]);var qc=Ks('<button data-elementtype="step-indicator" data-interactiontype="navigation"><span class="svelte-1mxltt0"> </span></button>'),Vc=Ks('<div class="steps-indicator-container svelte-1mxltt0"><button aria-label="Scroll to previous steps"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="svelte-1mxltt0"><path d="M12.8333 16.6668C12.68 16.6668 12.5266 16.5935 12.4266 16.4601L9.42663 12.2935C9.36482 12.2081 9.33154 12.1055 9.33154 12.0001C9.33154 11.8948 9.36482 11.7921 9.42663 11.7068L12.4266 7.54012C12.4651 7.48671 12.5138 7.44142 12.5698 7.40682C12.6259 7.37222 12.6882 7.349 12.7532 7.33848C12.8182 7.32795 12.8846 7.33033 12.9487 7.34549C13.0128 7.36064 13.0732 7.38826 13.1266 7.42678C13.18 7.46531 13.2253 7.51397 13.2599 7.56999C13.2945 7.62602 13.3177 7.68831 13.3283 7.75331C13.3388 7.81831 13.3364 7.88475 13.3213 7.94883C13.3061 8.01291 13.2785 8.07338 13.24 8.12678L10.4466 12.0001L13.2333 15.8735C13.2864 15.9479 13.3181 16.0355 13.3251 16.1267C13.332 16.2179 13.314 16.3092 13.2728 16.3909C13.2316 16.4725 13.1689 16.5414 13.0915 16.59C13.014 16.6386 12.9247 16.6652 12.8333 16.6668Z" fill="#030303" class="svelte-1mxltt0"></path></svg></button> <div role="group" aria-roledescription="Sequence navigation buttons"></div> <button aria-label="Scroll to next steps"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="svelte-1mxltt0"><path d="M11.1668 16.6666C11.0668 16.6666 10.9601 16.6333 10.8734 16.5733C10.8199 16.5348 10.7746 16.4862 10.7399 16.4302C10.7053 16.3741 10.682 16.3118 10.6715 16.2468C10.6609 16.1818 10.6634 16.1153 10.6786 16.0512C10.6938 15.9871 10.7215 15.9266 10.7601 15.8733L13.5534 11.9999L10.7601 8.12661C10.6001 7.89994 10.6468 7.59328 10.8734 7.42661C11.1001 7.26661 11.4068 7.31994 11.5734 7.53994L14.5734 11.7066C14.7001 11.8799 14.7001 12.1133 14.5734 12.2933L11.5734 16.4599C11.4734 16.5933 11.3201 16.6666 11.1668 16.6666Z" fill="#030303" class="svelte-1mxltt0"></path></svg></button></div>');const Gc={hash:"svelte-1mxltt0",code:'.steps-indicator-container.svelte-1mxltt0 {width:calc(100% - 16px);position:absolute;bottom:12px;left:8px;animation-duration:0.75s;animation-timing-function:cubic-bezier(0.36, 0, 0, 1);animation-fill-mode:both;animation-delay:0.15s;\n animation-name: svelte-1mxltt0-gallery-steps-appear-anim;}.steps-indicator.svelte-1mxltt0 {--stepSize: 6px;--stepPadding: 7px;padding:4px 4px;margin:0 16px;display:flex;gap:8px;align-items:center;overflow-x:auto;pointer-events:all;scrollbar-width:none;}.steps-indicator.fade-right.svelte-1mxltt0 {mask-image:linear-gradient(to right, black calc(100% - 20px), transparent);}.steps-indicator.fade-left.svelte-1mxltt0 {mask-image:linear-gradient(to left, black calc(100% - 20px), transparent);}.steps-indicator.fade-left.fade-right.svelte-1mxltt0 {mask-image:linear-gradient(to right, transparent, black 20px, black calc(100% - 20px), transparent);}.steps-indicator.with-duration.svelte-1mxltt0 .step-button:where(.svelte-1mxltt0) span:where(.svelte-1mxltt0) {position:relative;overflow:hidden;}.steps-indicator.with-duration.svelte-1mxltt0 .step-button:where(.svelte-1mxltt0) span:where(.svelte-1mxltt0):after {transition:0.3s ease-in-out;transition-property:opacity, width;}.step-button.svelte-1mxltt0 {padding:8px 12px;border:#E4E5E8 solid 1px;background-color:#FBFBFB;cursor:pointer;pointer-events:all;flex-shrink:0;border-radius:100px;font-size:12px;font-weight:500;line-height:16px;color:#030303;transition:all 0.3s ease-in-out;outline-color:#3191fc;}.step-button.active.svelte-1mxltt0 {background-color:#014FD3;color:#FFFFFF;box-shadow:none;border-color:#014FD3;}.step-button.active.svelte-1mxltt0:after {opacity:100%;\n animation: svelte-1mxltt0-stepDurationAnimation var(--stepDuration) linear forwards;animation-play-state:running;}.step-button.svelte-1mxltt0:hover:not(.active) {background:#F3F4F6;}.step-button.svelte-1mxltt0:active:not(.active) {background:#E4E5E8;}.step-button.svelte-1mxltt0:focus {outline-offset:4px;outline-width:2px;}.step-button.svelte-1mxltt0 span:where(.svelte-1mxltt0) {display:block;box-sizing:border-box;pointer-events:none;white-space:nowrap;}.step-button.svelte-1mxltt0 span:where(.svelte-1mxltt0):after {content:"";background-color:rgba(0, 0, 0, 0.6);position:absolute;border-radius:var(--stepSize);width:0;height:100%;top:0;left:-100%;opacity:0;transform:translateX(0);animation-play-state:paused;}.step-arrow.svelte-1mxltt0 {width:34px;height:34px;position:absolute;z-index:10;bottom:4px;border:1px solid #C4C8CF;border-radius:50%;background-color:#FFFFFF;box-shadow:0 2px 3px 0 rgba(0, 0, 0, 0.05);box-sizing:border-box;display:flex;align-items:center;justify-content:center;pointer-events:none;cursor:pointer;opacity:0;}.step-arrow.svelte-1mxltt0:hover {background:#F6F6F7;}.step-arrow.svelte-1mxltt0:active {background:#E4E5E8;}.step-arrow-prev.svelte-1mxltt0 {left:3px;transform:translateX(-100%);\n animation: svelte-1mxltt0-arrow-left-disappear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}.step-arrow-prev.visible.svelte-1mxltt0 {pointer-events:auto;\n animation: svelte-1mxltt0-arrow-left-appear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}.step-arrow-next.svelte-1mxltt0 {right:3px;transform:translateX(100%);\n animation: svelte-1mxltt0-arrow-right-disappear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}.step-arrow-next.visible.svelte-1mxltt0 {pointer-events:auto;\n animation: svelte-1mxltt0-arrow-right-appear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}\n\n@keyframes svelte-1mxltt0-gallery-steps-appear-anim {\n from {\n opacity: 0;\n transform: translate(0, 10px);\n }\n to {\n opacity: 1;\n transform: translate(0, 0);\n }\n}\n@keyframes svelte-1mxltt0-gallery-steps-disappear-anim {\n from {\n opacity: 1;\n transform: translate(0, 0);\n }\n to {\n opacity: 0;\n transform: translate(0, 10px);\n }\n}\n@keyframes svelte-1mxltt0-arrow-left-appear {\n from {\n opacity: 0;\n transform: translateX(-100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n@keyframes svelte-1mxltt0-arrow-left-disappear {\n from {\n opacity: 1;\n transform: translateX(0);\n }\n to {\n opacity: 0;\n transform: translateX(-100%);\n }\n}\n@keyframes svelte-1mxltt0-arrow-right-appear {\n from {\n opacity: 0;\n transform: translateX(100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n@keyframes svelte-1mxltt0-arrow-right-disappear {\n from {\n opacity: 1;\n transform: translateX(0);\n }\n to {\n opacity: 0;\n transform: translateX(100%);\n }\n}\n@keyframes svelte-1mxltt0-stepDurationAnimation {\n 0% {\n transform: translateX(0);\n }\n 100% {\n transform: translateX(100%);\n }\n}'};function Hc(e,t){Li(t,!0),ka(e,Gc);const n=16,i=32;let r=Ka(t,"gallery",7),o=mo(null),s=mo(null),a=mo(!1),l=mo(!1);const c=io((()=>{let e=[];return e=r().state.currentItem.modules.map(((e,t)=>({index:t,type:t===r().state.activeModuleIndex?"active":"",name:e.name}))),e}));function u(){Ds(o)&&(go(a,Ds(o).scrollLeft>0),go(l,Ds(o).scrollLeft+Ds(o).clientWidth<Ds(o).scrollWidth-0))}function d(e){Ds(o).scrollBy({left:e,behavior:"smooth"})}function h(e,t){const r=e.getBoundingClientRect(),o=t.getBoundingClientRect(),s=n+i;o.left<r.left+i?d(o.left-r.left-s):o.right>r.right-i&&d(o.right-r.right+s)}function f(){const e=Array.from(Ds(o).querySelectorAll(".step-button")).find((e=>{const t=e.getBoundingClientRect(),n=Ds(o).getBoundingClientRect();return t.left>n.left+i}));if(e){const t=e.previousElementSibling;t&&h(Ds(o),t)}}function p(){const e=Array.from(Ds(o).querySelectorAll(".step-button")).reverse().find((e=>{const t=e.getBoundingClientRect(),n=Ds(o).getBoundingClientRect();return t.right<n.right-i}));if(e){const t=e.nextElementSibling;t&&h(Ds(o),t)}}Ho((()=>{if(Ds(o)){u();const e=Ds(o).querySelector(".step-button.active");e&&go(s,e,!0);const t=new MutationObserver((()=>{const e=Ds(o).querySelector(".step-button.active");e&&go(s,e,!0)}));t.observe(Ds(o),{attributes:!0,attributeFilter:["class"],subtree:!0});const n=new ResizeObserver((()=>{u()}));return n.observe(Ds(o)),()=>{t.disconnect(),n.disconnect()}}})),Ho((()=>{Ds(c),Ds(o)&&Rs().then(u)})),Ho((()=>{Ds(s)&&Ds(o)&&h(Ds(o),Ds(s))}));var m=Xs();Us("resize",Ao,u),function(e,t,n){gi&&ki();var i=new ua(e);Jo((()=>{var e=t();i.ensure(e,n)}))}(Lo(m),(()=>r().state.activeItemIndex),(e=>{var t=Vc(),n=Do(t);let i;n.__click=f;var s=Bo(n,2);let d;va(s,21,(()=>Ds(c)),pa,((e,t)=>{var n=qc();let i;var s=io((()=>r().interaction((e=>{return n=e.currentTarget,i=Ds(t).index,r().state.activeModuleIndex=i,void h(Ds(o),n);var n,i}))));n.__click=function(...e){var t;null===(t=Ds(s))||void 0===t||t.apply(this,e)};var a=Do(n),l=Do(a,!0);wi(a),wi(n),Qo((()=>{i=Sa(n,1,"step-button svelte-1mxltt0",null,i,{active:"active"===Ds(t).type}),Ba(n,"aria-label",`Go to step $${Ds(t).index+1}`),Ba(n,"data-elementid",`${Ds(t).index+1}`),Ba(n,"data-elementname",Ds(t).name),ia(l,Ds(t).name)})),Ys(e,n)})),wi(s),Ga(s,(e=>go(o,e)),(()=>Ds(o)));var m=Bo(s,2);let v;m.__click=p,wi(t),Qo((()=>{var e;i=Sa(n,1,"step-arrow step-arrow-prev svelte-1mxltt0",null,i,{visible:Ds(a)}),d=Sa(s,1,"steps-indicator svelte-1mxltt0",null,d,{"with-duration":r().state.currentModule.hasDuration,paused:r().state.paused,"fade-left":Ds(a),"fade-right":Ds(l)}),Na(s,`--stepDuration: ${null!==(e=r().state.currentModule.duration)&&void 0!==e?e:""}s`),v=Sa(m,1,"step-arrow step-arrow-next svelte-1mxltt0",null,v,{visible:Ds(l)})})),Us("scroll",s,u),Ys(e,t)})),Ys(e,m),Bi()}qs(["click"]);const Kc="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3.01318%203.42005C3.01318%202.06672%204.50652%201.26672%205.66652%201.90672C6.82652%202.54672%2014.0732%206.48672%2014.0732%206.48672C15.2865%207.15339%2015.2865%208.86005%2014.0732%209.52005L5.66652%2014.1001C4.50652%2014.7334%203.01318%2013.9401%203.01318%2012.5801V3.42005ZM3.98652%2012.5801C3.98652%2013.1334%204.63318%2013.5467%205.19985%2013.2401L13.6065%208.66005C14.1399%208.36672%2014.1465%207.63339%2013.6065%207.34005C13.0665%207.04672%205.19985%202.76005%205.19985%202.76005C4.63985%202.44672%203.98652%202.86005%203.98652%203.42005V12.5801Z'%20fill='%23030303'/%3e%3c/svg%3e",Xc="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M10.8332%2014C10.5598%2014%2010.3332%2013.7733%2010.3332%2013.5V2.5C10.3332%202.22667%2010.5598%202%2010.8332%202C11.1065%202%2011.3332%202.22667%2011.3332%202.5V13.5C11.3332%2013.7733%2011.1065%2014%2010.8332%2014ZM5.1665%2014C4.89317%2014%204.6665%2013.7733%204.6665%2013.5V2.5C4.6665%202.22667%204.89317%202%205.1665%202C5.43984%202%205.6665%202.22667%205.6665%202.5V13.5C5.6665%2013.7733%205.43984%2014%205.1665%2014Z'%20fill='%23030303'/%3e%3c/svg%3e";var Yc=Ks('<img alt="Play" class="svelte-a3r6re"/>'),Qc=Ks('<img alt="Pause" class="svelte-a3r6re"/>'),Jc=Ks('<button class="pause-button svelte-a3r6re"><!></button>');const Zc={hash:"svelte-a3r6re",code:".pause-button.svelte-a3r6re {position:absolute;top:10px;right:10px;background:#FFFFFF;border-radius:100%;border:1px #C4C8CF solid;padding:0;width:32px;height:32px;display:flex;justify-content:center;align-items:center;pointer-events:auto;transition:background 0.2s ease-in-out;cursor:pointer;outline-color:#3191fc;}.pause-button.svelte-a3r6re:hover {background:#F6F6F7;}.pause-button.svelte-a3r6re:active {background:#E4E5E8;}.pause-button.svelte-a3r6re:focus {outline-offset:8px;outline-width:2px;}.pause-button.svelte-a3r6re img:where(.svelte-a3r6re) {width:16px;height:16px;pointer-events:none;}"};qs(["click"]);const eu=300,tu=60,nu="none";function iu(e,t,n){return e.addEventListener(t,n),()=>e.removeEventListener(t,n)}function ru(e,t,n){const{x:i,y:r}=function(e,t){const n=e.getBoundingClientRect();return{x:Math.round(t.clientX-n.left),y:Math.round(t.clientY-n.top)}}(e,t);return{event:t,pointersCount:n.length,target:t.target,x:i,y:r,attachmentNode:e}}function ou(e,t,n,i,r){const o=ru(e,n,i);return e.dispatchEvent(new CustomEvent(`${t}${r}`,{detail:o})),o}function su(){let e=[],t=()=>{},n=[];return{setPointerControls:(i,r,o,s,a,l=nu,c=[])=>{var u;if(r.style.touchAction=(u=l,Array.isArray(u)?u:[u]).join(" "),n=c,n.forEach((t=>{var n;null===(n=t.onInit)||void 0===n||n.call(t,e)})),!e.length){let l=function(t){e.push(t);const l=ou(r,i,t,e,"down");function c(t){const o=e.length;e=function(e,t){return t.filter((t=>So(e.pointerId,t.pointerId,!1)))}(t,e);if(o>e.length){e.length||(u(),d(),h(),f());const o=ou(r,i,t,e,"up");null==a||a(e,t),setTimeout((()=>{n.forEach((t=>{var n;null===(n=t.onUp)||void 0===n||n.call(t,o,e)}))}))}}null==s||s(e,t),setTimeout((()=>{n.forEach((t=>{var n;null===(n=t.onDown)||void 0===n||n.call(t,l,e)}))}));const u=iu(r,"pointermove",(t=>{e=e.map((e=>So(t.pointerId,e.pointerId)?t:e));const s=ou(r,i,t,e,"move");null==o||o(e,t),n.forEach((t=>{var n;null===(n=t.onMove)||void 0===n||n.call(t,s,e)}))})),d=iu(r,"lostpointercapture",(e=>{c(e)})),h=iu(r,"pointerup",(e=>{c(e)})),f=iu(r,"pointerleave",(e=>{c(e)}))};t=iu(r,"pointerdown",l)}return{destroy:()=>{e.length||(t(),n.forEach((e=>{var t;null===(t=e.onDestroy)||void 0===t||t.call(e)})))}}}}}const au="@attach";function lu(){return Symbol(au)}const cu="swipe";function uu(e,t,n,i=!1){const{setPointerControls:r}=su(),o=i?cu:lu();return{...n,[`on${cu}`]:e,[o]:e=>{const{onDown:n,onUp:i,parameters:o}=function(e,t){const n={timeframe:eu,minSwipeDistance:tu,touchAction:nu,composed:!1,...t};let i,r,o,s;function a(e,t){r=t.clientX,o=t.clientY,i=Date.now(),So(e.length,1)&&(s=t.target)}function l(t,a){if(So(a.type,"pointerup")&&So(t.length,0)&&Date.now()-i<n.timeframe){const t=a.clientX-r,i=a.clientY-o,l=Math.abs(t),c=Math.abs(i);let u=null;l>=2*c&&l>n.minSwipeDistance?u=t>0?"right":"left":c>=2*l&&c>n.minSwipeDistance&&(u=i>0?"bottom":"top"),u&&e.dispatchEvent(new CustomEvent(cu,{detail:{direction:u,target:s,pointerType:a.pointerType}}))}}return{onDown:a,onUp:l,parameters:n}}(e,null==t?void 0:t());return r(cu,e,null,n,i,o.touchAction,o.plugins).destroy}}}const du="tap";function hu(e,t,n,i=!1){const{setPointerControls:r}=su(),o=i?du:lu();return{...n,[`on${du}`]:e,[o]:e=>{const{onDown:n,onUp:i,parameters:o}=function(e,t){const n={timeframe:eu,composed:!1,touchAction:"auto",...t};let i,r,o;function s(t,s){if(Math.abs(s.clientX-r)<4&&Math.abs(s.clientY-o)<4&&Date.now()-i<n.timeframe){const t=e.getBoundingClientRect(),n=Math.round(s.clientX-t.left),i=Math.round(s.clientY-t.top);e.dispatchEvent(new CustomEvent(du,{detail:{x:n,y:i,target:s.target,pointerType:s.pointerType}}))}}function a(e,t){r=t.clientX,o=t.clientY,i=Date.now()}return{onDown:a,onUp:s,parameters:n}}(e,null==t?void 0:t());return r(du,e,null,n,i,o.touchAction,o.plugins).destroy}}}const fu=e=>{const t="#00ff00",n=1e6,i=4;let r,o,s,a=null,l=!1,c=Date.now();const u={x:void 0,y:void 0};function d(){const t=e.fadeTime,n=Date.now(),i=n-c;i>t/20&&(a&&o&&s&&r&&(s.drawImage(r,0,0),a.clearRect(0,0,r.width,r.height),a.globalAlpha=1-3*i/t,a.drawImage(o,0,0),a.globalAlpha=1,s.clearRect(0,0,r.width,r.height)),c=n),l&&requestAnimationFrame(d)}function h(e){u.x=e.x,u.y=e.y}function f(){a&&o&&r&&(a.canvas.width=window.innerWidth,a.canvas.height=window.innerHeight,o.width=r.width,o.height=r.height)}function p(t){var i;m(),r=window.document.createElement("canvas"),r.id="svelte-gestures-highlight-plugin",a=r.getContext("2d"),r.style.cssText=`\ndisplay: block; \nwidth: 100dvw;\nheight: 100dvh;\ntop: 0;\nleft: 0;\nposition: fixed;\npointer-events: none;\nz-index: ${null!==(i=e.zIndex)&&void 0!==i?i:n};\n`,window.document.body.appendChild(r),window.addEventListener("resize",f),t&&h(t.event),o=document.createElement("canvas"),f(),s=o.getContext("2d"),l=!0,d()}function m(){var e;l=!1,null===(e=window.document.getElementById("svelte-gestures-highlight-plugin"))||void 0===e||e.remove(),window.removeEventListener("resize",f)}return{onMove:n=>{var r,o,s;r=n.event,a&&(a.beginPath(),a.lineWidth=null!==(o=e.lineWidth)&&void 0!==o?o:i,a.lineCap="round",a.strokeStyle=null!==(s=e.color)&&void 0!==s?s:t,So(u.x,void 0,!1)&&So(u.y,void 0,!1)?(a.moveTo(u.x,u.y),h(r),a.lineTo(u.x,u.y)):h(r),a.stroke())},onDown:e=>{p(e)},onUp:(e,t)=>{So(t.length,0)&&m()},onDestroy:m,onInit:e=>{e.length&&(u.x=void 0,u.y=void 0,p())}}};var pu=Ks("<div></div>"),mu=Ks("<div></div>");const vu={hash:"svelte-1fv6njc",code:".swiper.svelte-1fv6njc {position:absolute;top:0;left:0;pointer-events:auto;width:100%;height:100%;}"};var gu=Ks("<img/>"),yu=Ks('<div class="ui-container svelte-1rvgxfc"><!></div>'),bu=Ks('<div class="cover-container svelte-1rvgxfc"><!> <!> <!></div>'),ku=Ks('<div class="covers-container svelte-1rvgxfc" style="scroll-behavior: auto;"></div>');const wu={hash:"svelte-1rvgxfc",code:".covers-container.svelte-1rvgxfc {position:absolute;top:0;left:0;bottom:0;right:0;overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory;display:flex;gap:0.5px;}.covers-container.svelte-1rvgxfc::-webkit-scrollbar {display:none;}.cover-container.svelte-1rvgxfc {position:relative;display:flex;width:100%;height:100%;flex-shrink:0;scroll-snap-align:center;user-select:none;justify-content:center;align-items:center;}.cover-image.svelte-1rvgxfc {width:var(--videoWidth);height:var(--videoHeight);aspect-ratio:var(--videoAspect);object-fit:cover;pointer-events:none;background:#ffffff;}.cover-image.hidden.svelte-1rvgxfc {opacity:0;}.cover-image.hidden.force-show.svelte-1rvgxfc {opacity:1;background:transparent;}.ui-container.svelte-1rvgxfc {position:absolute;top:0;left:0;bottom:0;right:0;pointer-events:none;}"};function xu(e,t){Li(t,!0),ka(e,wu);const n=[375,768,1024,1400,1920];let i,r=Ka(t,"scrollOffset",15),o=Ka(t,"isMobile",3,!1),s=Ka(t,"gallery",7),a=io((()=>s().state.playingModulePosition)),l=null,c=null,u=io((()=>s().state.startedPlaying)),d=io((()=>s().state.currentModulesList)),h=io((()=>Ds(d).findIndex((e=>p(s().state.playingModulePosition,e.position))))),f=!1;function p(e,t){return e.itemIndex===t.itemIndex&&e.moduleIndex===t.moduleIndex}function m(e){const t=e.scrollLeft,n=e.scrollWidth-e.clientWidth;return 0===t?0:t>n?100:t/n*100}function v(e){var t;o()&&e.preventDefault();const{target:n}=e,u=m(n),f=(null===(t=Ds(d))||void 0===t?void 0:t.length)||1,v=100/(f-1||1),g=Math.round(u/v);let y=Math.min(g,f-1);const b=Ds(d)[y],k={itemIndex:s().state.activeItemIndex,moduleIndex:s().state.activeModuleIndex};if(!l){const e=i.children[Ds(h)],t=i.getBoundingClientRect(),n=e.getBoundingClientRect();r(n.x-t.x)}c&&clearTimeout(c),c=setTimeout((()=>{const e=m(n);Math.abs(e-g*v)<.25&&async function(){s().state.seeking&&(s().state.playerLoaded?s().state.currentItemsList[s().state.activeItemIndex].modules[s().state.activeModuleIndex].play():s().state.playingModulePosition=Ds(a),r(0))}()}),l?0:150),null!==l||p(b.position,k)?null!==l&&p(b.position,l)&&(l=null):(s().state.activeItemIndex=b.position.itemIndex,s().state.activeModuleIndex=b.position.moduleIndex),go(a,b.position)}function g(){f||(s().track("coverdisplay"),f=!0)}Ho((()=>{const{activeItemIndex:e,activeModuleIndex:t}=s().state;e===Ds(a).itemIndex&&t===Ds(a).moduleIndex||zs((()=>{var n,r;const o=Ds(d).findIndex((n=>{const{itemIndex:i,moduleIndex:r}=n.position;return e===i&&t===r}));l=(null===(n=Ds(d)[o])||void 0===n?void 0:n.position)||null;const s=null===(r=i)||void 0===r||null===(r=r.children)||void 0===r?void 0:r[o];if(!i||!s)return;const a=i.getBoundingClientRect(),c=s.getBoundingClientRect();let u=i.scrollLeft+(c.left-a.left);const h=Math.max(0,i.scrollWidth-i.clientWidth);u=Math.max(0,Math.min(h,u)),i.scrollTo({left:u,behavior:"auto"})}))})),Ho((()=>{Ds(u)&&zs((()=>{s().track("projectstartedplaying")}))}));var y=Xs(),b=Lo(y),k=e=>{var r=ku();va(r,23,(()=>Ds(d)),(e=>e.id),((e,i,r)=>{var a=bu(),l=Do(a),c=e=>{var t=gu();let o;Qo((e=>{o=Sa(t,1,"cover-image svelte-1rvgxfc",null,o,{hidden:Ds(u)&&Ds(r)===Ds(h),"force-show":Ds(i).showCover}),Ba(t,"src",e),Ba(t,"alt",Ds(i).name),Ba(t,"fetchpriority",0===Ds(r)?"high":"auto")}),[()=>s().getCoverUrl(Ds(i).cover,n[n.length-1])]),Us("load",t,(function(...e){var t;null===(t=0===Ds(r)?g:()=>{})||void 0===t||t.apply(this,e)})),function(e){if(!gi)return;e.removeAttribute("onload"),e.removeAttribute("onerror");const t=e.__e;void 0!==t&&(e.__e=void 0,queueMicrotask((()=>{e.isConnected&&e.dispatchEvent(t)})))}(t),Ys(e,t)};fa(l,(e=>{e(c)}));var d=Bo(l,2);!function(e,t){Li(t,!0),ka(e,vu);const n={color:"#e3e3e3",fadeTime:300,lineWidth:8},i=uu(t.gallery.interaction((e=>{const{direction:n}=e.detail;var i;if("left"===n)null===(i=t.gallery)||void 0===i||i.next(),t.onEvent("swipe",[-1,0]);else if("right"===n){var r;null===(r=t.gallery)||void 0===r||r.prev(),t.onEvent("swipe",[1,0])}}),{elementid:"swiper"}),(()=>({touchAction:"pan-y",plugins:t.debug?[fu(n)]:[]}))),r=hu((function(e){const{x:n,y:i}=e.detail;t.onEvent("click",{x:n,y:i})}),(()=>({touchAction:"pan-y"})));var o=Xs(),s=Lo(o),a=e=>{var t=pu();za(t,(()=>({...i,...r,class:"swiper"})),void 0,void 0,void 0,"svelte-1fv6njc"),Ys(e,t)},l=e=>{var t=mu();za(t,(()=>({...r,class:"swiper"})),void 0,void 0,void 0,"svelte-1fv6njc"),Ys(e,t)};fa(s,(e=>{t.isMobile?e(a):e(l,!1)})),Ys(e,o),Bi()}(d,{get gallery(){return s()},get debug(){return t.debug},get isMobile(){return o()},get onEvent(){return t.onEvent}});var f=Bo(d,2),p=e=>{var t=yu();!function(e,t,n){gi&&ki();var i=new ua(e);Jo((()=>{var e,r=null!==(e=t())&&void 0!==e?e:null;i.ensure(r,r&&(e=>n(e,r)))}),Kn)}(Do(t),(()=>Ds(i).Component),((e,t)=>{t(e,{get state(){return Ds(i).state},get gallery(){return s()},get isMobile(){return o()}})})),wi(t),Ys(e,t)};fa(f,(e=>{var t;null!==(t=Ds(i))&&void 0!==t&&t.Component&&e(p)})),wi(a),Ys(e,a)})),wi(r),Ga(r,(e=>i=e),(()=>i)),Us("scroll",r,v),Ys(e,r)};fa(b,(e=>{Ds(d)&&e(k)})),Ys(e,y),Bi()}const _u="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};let Tu;function Iu(){const e=_u&&_u.navigator&&(_u.navigator.userAgent||_u.navigator.platform||_u.navigator.vendor)||"";if(Tu&&Tu.ua===e)return Tu;const t=e.toLowerCase(),n=t.includes("android"),i=t.includes("iphone")||t.includes("ipad")||t.includes("ipod")||t.includes("ios"),r=n||i||t.includes("mobile");return Tu={ua:e,isMobile:r},Tu}var Eu,Su;"undefined"!=typeof window&&(window.addEventListener("pageshow",(function(e){e.persisted&&setTimeout((function(){window.location.reload()}),10)}),!1),null===(Eu=(Su=window).EkoAnalytics)||void 0===Eu||Eu.call(Su,"track","init"));var Au=Ks('<div class="paging-buttons svelte-1n46o8q"><!> <!></div>'),Nu=Ks('<div style="position: absolute; top: 0; left: 0; width: 100%;"></div>'),Mu=Ks("<!> <!>",1),Fu=Ks('<div class="player-container svelte-1n46o8q"><div class="player-div swipable svelte-1n46o8q"></div> <!> <!> <!> <!></div> <!>',1),Cu=Ks('<div class="eko-gallery-app svelte-1n46o8q"><!></div>');const Ou={hash:"svelte-1n46o8q",code:'.eko-gallery-app.svelte-1n46o8q {position:relative;width:100%;height:100%;display:flex;flex-direction:column;box-sizing:border-box;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;}.eko-gallery-app.svelte-1n46o8q:hover .paging-buttons:where(.svelte-1n46o8q) .nav-button {background-color:#FFFFFF;box-shadow:0 0 8px 0 rgba(0, 0, 0, 0.12);}.eko-gallery-app.svelte-1n46o8q * {box-sizing:border-box;touch-action:pan-y;font-family:"Human BBY Digital", sans-serif;}.player-container.svelte-1n46o8q {position:relative;flex:1;width:100%;pointer-events:none;overflow:hidden;border-radius:16px;display:flex;align-items:center;justify-content:center;}.player-div.svelte-1n46o8q {position:absolute;width:var(--videoWidth);height:var(--videoHeight);aspect-ratio:var(--videoAspect);}.swipable.svelte-1n46o8q {will-change:transform;transform:translate3d(var(--uiTranformX, 0), 0, 0);}.paging-buttons.svelte-1n46o8q {position:absolute;top:0;left:0;bottom:0;right:0;display:flex;justify-content:space-between;align-items:center;pointer-events:none;padding:0 12px;}.paging-buttons.svelte-1n46o8q .nav-button {transition:0.2s ease-in-out;box-shadow:none;}.paging-buttons.svelte-1n46o8q .nav-button img {opacity:0.6;}'};function Pu(e,t){Li(t,!0),ka(e,Ou);const n=Ka(t,"config",19,(()=>({}))),i=Ka(t,"forceMobile",3,!1),r=Ka(t,"videoAspectRatio",3,"unset"),o=Ka(t,"onGalleryReady",3,(()=>{})),s=Ka(t,"onEvent",3,(()=>{}));let a,l=!1,c=mo(new Fc(n())),u=mo(null),d=io((()=>i()||Iu().isMobile)),h=mo(0),f=mo(void 0),p=mo(!0),m=mo(_o({width:"100%",height:"100%"}));var v,g,y;function b(){const e={AssetsDeliveryService:{assetsDeliveryServiceUrl:Ds(c).urls.assetsDeliveryBase},Tracker:{tag:Ds(c).uuid}};go(u,new t.EkoPlayer(a,function(e,...t){function n(e){return"[object Object]"===Object.prototype.toString.call(e)}function i(e,t){if(Array.isArray(t)){Array.isArray(e)||(e=Array.isArray(e)?e.slice():[]);const r=Math.max(e.length,t.length);for(let o=0;o<r;o++){const r=e[o],s=t[o];null!=s&&(n(r)&&n(s)?e[o]=i({...r},s):Array.isArray(r)&&Array.isArray(s)?e[o]=i(r.slice(),s):n(s)?e[o]=i({},s):Array.isArray(s)?e[o]=i([],s):e[o]=s)}return e}if(n(t)){n(e)||(e={});for(const r of Object.keys(t)){const o=e[r],s=t[r];n(o)&&n(s)?e[r]=i({...o},s):Array.isArray(o)&&Array.isArray(s)?e[r]=i(o.slice(),s):n(s)?e[r]=i({},s):Array.isArray(s)?e[r]=i([],s):void 0!==s&&(e[r]=s)}return e}return t}for(const n of t)null!==n&&i(e,n);return e}({},t.playerOptions,e))),Ds(u).on("playing",(()=>{Ds(c).state.paused=!1})),Ds(u).on("pause",(()=>{Ds(c).state.paused=!0})),Ds(u).once("playing",(()=>{Ds(c).state.startedPlaying=!0,s()("galleryloaded")}))}function k(e){var t;null===(t=Ds(c))||void 0===t||t.selectItem(e)}function w(){var e;null===(e=Ds(c))||void 0===e||e.next()}function x(){var e;null===(e=Ds(c))||void 0===e||e.prev()}function _(){Ds(u).paused?Ds(u).play():Ds(u).pause()}function T(){return`--uiTranformX: ${Ds(h)}px;--videoAspect: ${r()};--videoWidth: ${Ds(m).width};--videoHeight: ${Ds(m).height};`}v="state",g=()=>Ds(c).state,zi("setContext").set(v,g),y=()=>(o()(Ds(c).public),n()&&t.EkoPlayer&&(b(),Ds(c).start(Ds(u))),()=>{var e;null===(e=Ds(u))||void 0===e||e.dispose(),Ds(c).dispose()}),null===Mi&&di("onMount"),Ho((()=>{const e=zs(y);if("function"==typeof e)return e})),Ho((()=>{n()&&t.EkoPlayer&&(l?zs((()=>{var e;Ds(c).dispose(),go(c,new Fc(n())),null===(e=Ds(u))||void 0===e||e.dispose(),go(p,!1),Rs().then((()=>(go(p,!0),Rs()))).then((()=>{o()(Ds(c).public),b(),Ds(c).start(Ds(u))}))})):l=!0)})),Ho((()=>{Ds(f)&&Ds(u)&&Ds(u).loadDebugOverlay({containerElement:Ds(f)})})),Ho((()=>{if("unset"!==r()&&r().includes("/")){const[e,t]=r().split("/").map((e=>Number(e)));isNaN(e)||isNaN(t)||go(m,e>t?{width:"100%",height:"auto"}:{width:"auto",height:"100%"},!0)}else go(m,{width:"100%",height:"100%"},!0)}));var I=Cu(),E=Do(I),S=e=>{var n=Fu(),i=Lo(n),r=Do(i);Ga(r,(e=>a=e),(()=>a));var o=Bo(r,2);xu(o,{get isMobile(){return Ds(d)},get gallery(){return Ds(c)},get debug(){return t.debug},get onEvent(){return s()},get scrollOffset(){return Ds(h)},set scrollOffset(e){go(h,e,!0)}});var l=Bo(o,2),u=e=>{var t=Au(),n=Do(t);Uc(n,{type:"prev",onClick:x}),Uc(Bo(n,2),{type:"next",onClick:w}),wi(t),Ys(e,t)};fa(l,(e=>{Ds(d)||t.hideNav||e(u)}));var p=Bo(l,2),m=e=>{Hc(e,{get gallery(){return Ds(c)}})};fa(p,(e=>{var t;!Ds(d)&&(null===(t=Ds(c).state.currentItem)||void 0===t?void 0:t.modules.length)>1&&e(m)}));var v=Bo(p,2),g=e=>{var n=Mu(),i=Lo(n);!function(e,t){Li(t,!0),ka(e,Zc);const n=Di("state");var i=Jc();i.__click=function(...e){var n;null===(n=t.onPauseClick)||void 0===n||n.apply(this,e)};var r=Do(i),o=e=>{var t=Yc();Qo((()=>Ba(t,"src",Kc))),Ys(e,t)},s=e=>{var t=Qc();Qo((()=>Ba(t,"src",Xc))),Ys(e,t)};fa(r,(e=>{n().paused?e(o):e(s,!1)})),wi(i),Qo((e=>Ba(i,"aria-label",e)),[()=>n().paused?"Play":"Pause"]),Ys(e,i),Bi()}(i,{onPauseClick:_});var r=Bo(i,2),o=e=>{var t=Nu();Ga(t,(e=>go(f,e)),(()=>Ds(f))),Ys(e,t)};fa(r,(e=>{t.debug&&e(o)})),Ys(e,n)};fa(v,(e=>{Ds(c).state.startedPlaying&&e(g)})),wi(i);var y=Bo(i,2),b=e=>{!function(e,t){Li(t,!0),ka(e,zc);let n=Ka(t,"onNavItemClick",3,(()=>{}));const i=Di("state");var r=Bc(),o=Do(r);va(o,23,(()=>i().currentItemsList),(e=>e.id),((e,t,r)=>{var o=Lc();let s;o.__click=()=>n()(Ds(r));var a=Do(o),l=Do(a,!0);wi(a),wi(o),Qo((e=>{s=Sa(o,1,"nav-button svelte-er27y2",null,s,e),ia(l,Ds(t).name)}),[()=>({selected:Ds(r)===i().activeItemIndex})]),Ys(e,o)})),wi(o),wi(r),Ys(e,r),Bi()}(e,{onNavItemClick:k})};fa(y,(e=>{t.hideNav||e(b)})),Qo((e=>Na(i,e)),[T]),Ys(e,n)};fa(E,(e=>{n()&&Ds(p)&&e(S)})),wi(I),Ys(e,I),Bi()}function Ru(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Du,Lu,Bu,zu,Wu={exports:{}},$u=Ru((Du||(Du=1,Bu=Wu.exports,zu=function(){var e=function(){},t="undefined",n=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],r={},o=null;function s(e,t){var n=e[t];if("function"==typeof n.bind)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch(t){return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function a(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function l(){for(var n=this.getLevel(),r=0;r<i.length;r++){var o=i[r];this[o]=r<n?e:this.methodFactory(o,n,this.name)}if(this.log=this.debug,typeof console===t&&n<this.levels.SILENT)return"No console available for logging"}function c(e){return function(){typeof console!==t&&(l.call(this),this[e].apply(this,arguments))}}function u(i,r,o){return"debug"===(l=i)&&(l="log"),typeof console!==t&&("trace"===l&&n?a:void 0!==console[l]?s(console,l):void 0!==console.log?s(console,"log"):e)||c.apply(this,arguments);var l}function d(e,n){var s,a,c,d=this,h="loglevel";function f(){var e;if(typeof window!==t&&h){try{e=window.localStorage[h]}catch(e){}if(typeof e===t)try{var n=window.document.cookie,i=encodeURIComponent(h),r=n.indexOf(i+"=");-1!==r&&(e=/^([^;]+)/.exec(n.slice(r+i.length+1))[1])}catch(e){}return void 0===d.levels[e]&&(e=void 0),e}}function p(e){var t=e;if("string"==typeof t&&void 0!==d.levels[t.toUpperCase()]&&(t=d.levels[t.toUpperCase()]),"number"==typeof t&&t>=0&&t<=d.levels.SILENT)return t;throw new TypeError("log.setLevel() called with invalid level: "+e)}"string"==typeof e?h+=":"+e:"symbol"==typeof e&&(h=void 0),d.name=e,d.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},d.methodFactory=n||u,d.getLevel=function(){return null!=c?c:null!=a?a:s},d.setLevel=function(e,n){return c=p(e),!1!==n&&function(e){var n=(i[e]||"silent").toUpperCase();if(typeof window!==t&&h){try{return void(window.localStorage[h]=n)}catch(e){}try{window.document.cookie=encodeURIComponent(h)+"="+n+";"}catch(e){}}}(c),l.call(d)},d.setDefaultLevel=function(e){a=p(e),f()||d.setLevel(e,!1)},d.resetLevel=function(){c=null,function(){if(typeof window!==t&&h){try{window.localStorage.removeItem(h)}catch(e){}try{window.document.cookie=encodeURIComponent(h)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(e){}}}(),l.call(d)},d.enableAll=function(e){d.setLevel(d.levels.TRACE,e)},d.disableAll=function(e){d.setLevel(d.levels.SILENT,e)},d.rebuild=function(){if(o!==d&&(s=p(o.getLevel())),l.call(d),o===d)for(var e in r)r[e].rebuild()},s=p(o?o.getLevel():"WARN");var m=f();null!=m&&(c=p(m)),l.call(d)}(o=new d).getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=r[e];return t||(t=r[e]=new d(e,o.methodFactory)),t};var h=typeof window!==t?window.log:void 0;return o.noConflict=function(){return typeof window!==t&&window.log===o&&(window.log=h),o},o.getLoggers=function(){return r},o.default=o,o},(Lu=Wu).exports?Lu.exports=zu():Bu.log=zu()),Wu.exports));const ju=()=>{},Uu=["trace","log","debug","info","warn","error","getLevel","setLevel"],qu=["trace","debug","info","warn","error","silent"],Vu={TRACE:"color: white; background-color: magenta;",DEBUG:"color: black; background-color: turquoise;",INFO:"color: white; background-color: green;",WARN:"color: black; background-color: yellow;",ERROR:"color: white; background-color: red;"},Gu="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global;let Hu={level:"trace",appName:""},Ku=[];const Xu="object"==typeof Gu&&Gu.performance&&"function"==typeof Gu.performance.now?Gu.performance.now.bind(Gu.performance):Date.now.bind(Date),Yu=e=>e&&"string"==typeof e?e.toLowerCase().trim():"",Qu=(()=>{try{const e=new URLSearchParams(document.location.search),t=[].concat(e.getAll("log")).concat(e.getAll("ekolog")).concat(e.getAll("ekologger")).join(",").split(",");if(0===t.length)return{};let n={};return t.forEach((e=>{const[t,i]=e.split(":");n[Yu(t)]=Yu(i)||"trace"})),n}catch(e){return{}}})(),Ju=(e,t="")=>{const n=Yu(e),i=$u.getLogger(n);if(i.__ekologger)return i.__ekologger;t||Qu[n]||Qu["*"]||(i.__noExplicitLevel=!0);const r=i.methodFactory;i.methodFactory=(t,n,i)=>{const o=r(t,n,i),s=t.toUpperCase();return(...t)=>{o(`[${((e,t=3)=>(Xu()/1e3).toFixed(t))()}] %c[${s}] ${Hu.appName?`[${Hu.appName}] `:""}[${e}]`,Vu[s],...t)}},t=Qu[n]||Qu["*"]||t||Hu.level,i.setLevel(t,!1);const o=(...e)=>i.log(...e);return Uu.forEach((e=>{o[e]=(...t)=>(Ku.forEach((n=>{n[e](...t)})),i[e](...t))})),i.__ekologger=o,o};Ju.setDefaults=({appName:e="",level:t})=>{e&&"string"==typeof e&&(Hu.appName=e),(t=Yu(t))&&qu.includes(t)&&(Hu.level=t,Object.values($u.getLoggers()).filter((e=>e.__noExplicitLevel)).forEach((e=>e.setLevel(Hu.level,!1))))},Ju.installDriver=e=>{const t={...Uu.reduce(((t,n)=>(t[n]="function"==typeof(null==e?void 0:e[n])?e[n]:ju,t)),{})};Ku.push(t)};let Zu=class{#T=new Map;on(e,t){if("function"!=typeof t)return this;const n=this.#T.get(e)||new Set;return n.add(t),this.#T.set(e,n),this}once(e,t){if("function"!=typeof t)return this;const n=(...i)=>(this.off(e,n),t(...i));return this.on(e,n)}off(e,t){if(!e)return this.#T.clear(),this;const n=this.#T.get(e);return n?t?(n.delete(t),0===n.size&&this.#T.delete(e),this):(this.#T.delete(e),this):this}trigger(e,...t){const n=this.#T.get(e);return n?(n.forEach((e=>e(...t))),this):this}};function ed(e){return"[object Object]"===Object.prototype.toString.call(e)}function td(e,...t){const n=ed(e)?{...e}:{};return t.forEach((e=>{ed(e)&&Object.keys(e).forEach((t=>{const i=e[t],r=n[t];ed(i)&&ed(r)?n[t]=td(r,i):Array.isArray(i)?n[t]=i.slice():n[t]=i}))})),n}function nd(e){if("string"==typeof e)return`'${e}'`;if(Array.isArray(e))return`[${e.map((e=>nd(e))).join(", ")}]`;if(ed(e))try{return JSON.stringify(e)}catch(e){return"[object Object]"}return null===e?"null":void 0===e?"undefined":String(e)}function id(e){return Array.from(e).map((e=>nd(e))).join(", ")}var rd=new WeakSet;let od=class extends Zu{constructor(...e){super(),O(this,rd);const t=e.length?e[e.length-1]:void 0,n=this.name;if(!n||"string"!=typeof n)throw new Error("Extending classes must implement get name() returning a string.");this.log=Ju(n,this.loglevel);const i=ed(this.defaults)?this.defaults:{},r=ed(t)&&ed(t[n])?t[n]:{};this.settings=td({},i,r),A(rd,this,sd).call(this),A(rd,this,ad).call(this)}get name(){throw new Error("BaseModuleClass requires a name getter.")}get loglevel(){return"warn"}get defaults(){return{}}get methodsExcludedFromAutoLog(){return new Set(["constructor","on","off","once","trigger","#wrapMethodsForLogging"])}dispose(){this._disposed||(this._disposed=!0,"function"==typeof this._lifecycleCleanup&&(this._lifecycleCleanup(),this._lifecycleCleanup=null),"function"==typeof this.onDispose&&this.onDispose())}onDispose(){}};function sd(){const e=new Set,t=this.methodsExcludedFromAutoLog;let n=Object.getPrototypeOf(this);for(;n&&n!==Object.prototype;){const i=Object.getOwnPropertyNames(n);for(let r=0;r<i.length;r+=1){const o=i[r];if("constructor"===o||o.startsWith("#"))continue;if(e.has(o))continue;const s=Object.getOwnPropertyDescriptor(n,o);if(!s||"function"!=typeof s.value)continue;const a=s.value.bind(this),l=!t.has(o);this[o]=l?(...e)=>(this.log&&"function"==typeof this.log.debug&&this.log.debug(`${this.name}.${o}(${id(e)})`),a(...e)):a,e.add(o)}n=Object.getPrototypeOf(n)}}function ad(){if("undefined"==typeof window||"function"!=typeof window.addEventListener)return;const e=()=>{try{"function"==typeof this.dispose&&this.dispose()}catch(e){this.log&&"function"==typeof this.log.error&&this.log.error("dispose failed",e)}};window.addEventListener("pagehide",e),window.addEventListener("beforeunload",e),this._lifecycleCleanup=()=>{window.removeEventListener("pagehide",e),window.removeEventListener("beforeunload",e)}}const ld="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};function cd(e){return Boolean(e)&&"object"==typeof e&&1===e.nodeType&&"function"==typeof e.appendChild}let ud=class extends od{#I;#E;#S;get defaults(){return{style:{width:"100%",height:"100%"},contextAttributes:{alpha:!1,depth:!1,stencil:!1,antialias:!1,preserveDrawingBuffer:!1,powerPreference:"low-power"}}}constructor(...e){var t,n;super(...e);const[i]=e,r=function(e,t=(null==ld?void 0:ld.document)){if(cd(e))return e;const n="string"==typeof e?e:null;if(!n||!t||"function"!=typeof t.querySelector)return null;const i=t.querySelector(n);return cd(i)?i:null}(i);if(!r)throw new Error("Canvas requires a valid mount target (HTMLElement or selector string).");this.#I=r;const o=null==ld?void 0:ld.document;if(!o||"function"!=typeof o.createElement)throw new Error("Canvas requires document.createElement.");var s,a;this.#E=o.createElement("canvas"),s=this.#E,a=null===(t=this.settings)||void 0===t?void 0:t.style,s&&a&&"object"==typeof a&&!Array.isArray(a)&&Object.keys(a).forEach((e=>{const t=a[e];null!=t&&(s.style[e]=String(t))})),this.#I.appendChild(this.#E);const l=null===(n=this.settings)||void 0===n?void 0:n.contextAttributes,c=l&&"object"==typeof l&&!Array.isArray(l)?l:void 0;if(this.#S=this.#E.getContext("webgl2",c),!this.#S)throw new Error("Canvas WebGL2 context is not available.")}get name(){return"Canvas"}get element(){return this.#E}get gl(){return this.#S}onDispose(){this.#E&&this.#E.parentNode&&this.#E.parentNode.removeChild(this.#E),this.#S=null,this.#E=null,this.#I=null}};var dd=new WeakMap,hd=new WeakMap,fd=new WeakMap,pd=new WeakMap,md=new WeakMap,vd=new WeakMap,gd=new WeakSet;let yd=class extends od{get name(){return"ContainerSize"}get containerWidth(){return M(hd,this)}get containerHeight(){return M(fd,this)}get width(){return M(hd,this)}get height(){return M(fd,this)}constructor(...e){super(...e),O(this,gd),F(this,dd,void 0),F(this,hd,0),F(this,fd,0),F(this,pd,null),F(this,md,null),F(this,vd,null);const[t]=e;var n;C(dd,this,(n=t)&&n.element&&cd(n.element)?n.element:cd(n)?n:null),M(dd,this)&&(A(gd,this,kd).call(this,!0),A(gd,this,bd).call(this))}onDispose(){M(pd,this)&&"function"==typeof M(pd,this).disconnect&&M(pd,this).disconnect(),C(pd,this,null),M(vd,this)&&"function"==typeof(null==ld?void 0:ld.removeEventListener)&&ld.removeEventListener("resize",M(vd,this)),C(vd,this,null),M(md,this)&&((null==ld?void 0:ld.clearInterval)||clearInterval)(M(md,this)),C(md,this,null),C(dd,this,null)}};function bd(){if(!M(dd,this))return;const e=null==ld?void 0:ld.ResizeObserver;if("function"==typeof e)return C(pd,this,new e((()=>A(gd,this,kd).call(this)))),void M(pd,this).observe(M(dd,this));C(vd,this,(()=>A(gd,this,kd).call(this))),"function"==typeof(null==ld?void 0:ld.addEventListener)&&ld.addEventListener("resize",M(vd,this));const t=(null==ld?void 0:ld.setInterval)||setInterval;C(md,this,t((()=>A(gd,this,kd).call(this)),250))}function kd(e=!1){if(!M(dd,this))return;const{width:t,height:n}=function(e){const t=Number(null==e?void 0:e.clientWidth),n=Number(null==e?void 0:e.clientHeight);return{width:Number.isFinite(t)&&t>0?Math.round(t):0,height:Number.isFinite(n)&&n>0?Math.round(n):0}}(M(dd,this));(e||t!==M(hd,this)||n!==M(fd,this))&&(C(hd,this,t),C(fd,this,n),this.trigger("containerresize",{width:t,height:n}))}var wd={VIDEO_SOURCE_PREFIX:"__SRC_VID:",TEXTURE_SOURCE_PREFIX:"__SRC_TEXTURE:",PREVIOUS_OUTPUT_PREFIX:"__PREVIOUS:",SAVED_FRAME_PREFIX:"__SAVED_FRAME:",SYSTEM_NODES:{FILTERS:{RENDER_TO_CANVAS:"__default"},TAGS:{ATOM:"atom",FILTER:"filter",COMPOSITE_FILTER:"composite",TRANSITION_FILTER:"transition"}},MESSAGES:{UPDATE_OPTIONS:"update_options"}};let xd=class{constructor(e,t){this.canvasSource=e,this.startRendering=t,this.gl=null,this.glOptions=null}init(e,t,n){this.glOptions=n||{};const i=this.initCanvas(this.canvasSource,e,t);return this.initWebgl(i,this.glOptions)}initCanvas(){throw new Error("implement on concrete class")}getContextConfig(e={}){if(!e||"object"!=typeof e)return{contextType:"webgl",contextAttributes:void 0};const{contextType:t,contextAttributes:n,__shaderGraph:i,...r}=e;return{contextType:t||"webgl",contextAttributes:Object.prototype.hasOwnProperty.call(e,"contextAttributes")?n:r}}initWebgl(e,t={}){const{contextType:n,contextAttributes:i}=this.getContextConfig(t),r=e.getContext(n,i);if(!r)throw new Error(`Browser doesn't support ${n}`);return r.enable(r.BLEND),r.disable(r.DEPTH_TEST),r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),r}isStartRendering(){return this.startRendering}};var _d,Td={exports:{}},Id=(_d||(_d=1,function(e){var t=Object.prototype.hasOwnProperty,n="~";function i(){}function r(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,i,o,s){if("function"!=typeof i)throw new TypeError("The listener must be a function");var a=new r(i,o||e,s),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function a(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),a.prototype.eventNames=function(){var e,i,r=[];if(0===this._eventsCount)return r;for(i in e=this._events)t.call(e,i)&&r.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},a.prototype.listeners=function(e){var t=n?n+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,o=i.length,s=new Array(o);r<o;r++)s[r]=i[r].fn;return s},a.prototype.listenerCount=function(e){var t=n?n+e:e,i=this._events[t];return i?i.fn?1:i.length:0},a.prototype.emit=function(e,t,i,r,o,s){var a=n?n+e:e;if(!this._events[a])return!1;var l,c,u=this._events[a],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,i),!0;case 4:return u.fn.call(u.context,t,i,r),!0;case 5:return u.fn.call(u.context,t,i,r,o),!0;case 6:return u.fn.call(u.context,t,i,r,o,s),!0}for(c=1,l=new Array(d-1);c<d;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var h,f=u.length;for(c=0;c<f;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),d){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,i);break;case 4:u[c].fn.call(u[c].context,t,i,r);break;default:if(!l)for(h=1,l=new Array(d-1);h<d;h++)l[h-1]=arguments[h];u[c].fn.apply(u[c].context,l)}}return!0},a.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},a.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},a.prototype.removeListener=function(e,t,i,r){var o=n?n+e:e;if(!this._events[o])return this;if(!t)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==t||r&&!a.once||i&&a.context!==i||s(this,o);else{for(var l=0,c=[],u=a.length;l<u;l++)(a[l].fn!==t||r&&!a[l].once||i&&a[l].context!==i)&&c.push(a[l]);c.length?this._events[o]=1===c.length?c[0]:c:s(this,o)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,e.exports=a}(Td)),Td.exports),Ed=Ru(Id);let Sd=class extends xd{constructor(e){super(e,!0),this.setSrcVidTracksFn=null,this.shouldUpdateTexture=!0,this.onPlayerSeeking=this.onPlayerSeeking.bind(this),this.onPlayerSeeked=this.onPlayerSeeked.bind(this),this.onPlayerNodeStart=this.onPlayerNodeStart.bind(this),this.oncePlayerPlaying=this.oncePlayerPlaying.bind(this);const t=new Ed;this.on=t.on.bind(t),this.off=t.off.bind(t),this.once=t.once.bind(t),this.trigger=t.emit.bind(t)}onPlayerSeeking(){this.shouldUpdateTexture=!1}onPlayerSeeked(){this.shouldUpdateTexture=!0}onPlayerNodeStart(){this.shouldUpdateTexture=!0,"function"==typeof this.player.canvas.drawFrame&&this.player.canvas.drawFrame(),this.trigger("forcerender")}oncePlayerPlaying(){this.onPlayerNodeStart()}addPlayerListeners(){this.player&&(this.player.on("seeking",this.onPlayerSeeking),this.player.on("seeked",this.onPlayerSeeked),this.player.on("nodestart",this.onPlayerNodeStart),this.player.once("playing",this.oncePlayerPlaying))}removePlayerListeners(){this.player&&(this.player.off("seeking",this.onPlayerSeeking),this.player.off("seeked",this.onPlayerSeeked),this.player.off("nodestart",this.onPlayerNodeStart),this.player.off("playing",this.oncePlayerPlaying))}initCanvas(e,t,n){var i;this.player=e,this.setSrcVidTracksFn=t;const{contextType:r,contextAttributes:o}=this.getContextConfig(this.glOptions),s=!1!==(null===(i=this.glOptions)||void 0===i||null===(i=i.__shaderGraph)||void 0===i?void 0:i.forwardContextAttributes);const a={contextType:r};s&&void 0!==o&&(a.contextAttributes=o),e.initPlugin("canvas",a);const l={drawFrame:this.canvasDrawFrameFn.bind(this),resize:n,contextType:r,offscreenVideoCanvasEnabled:!1,viewportModeEnabled:!0,fps:0};return s&&void 0!==o&&(l.contextAttributes=o),e.canvas.init(l),e.paused&&0===e.currentTime&&(this.shouldUpdateTexture=!1),this.addPlayerListeners(),e.canvas.canvas}canvasDrawFrameFn(e,t,n){var i;this.setSrcVidTracksFn&&this.shouldUpdateTexture&&e&&t&&n&&(n.videoWidth||n.displayWidth)&&(n.videoHeight||n.displayHeight)&&(!(i=n)||"boolean"!=typeof i.isDataLoaded||i&&i.isDataLoaded&&(void 0===i.isFrameTextureReady||i.isFrameTextureReady))&&this.setSrcVidTracksFn(n)}async recover(){if(this.player&&this.player.paused)return new Promise((e=>{this.player.once("seeked",(()=>{this.shouldUpdateTexture=!0,e()})),this.player.currentTime=this.player.currentTime}))}dispose(){this.player&&(this.player.canvas&&"function"==typeof this.player.canvas.dispose&&this.player.canvas.dispose(),this.removePlayerListeners(),this.player=null)}},Ad=class extends xd{constructor(e){super(e,!1)}initCanvas(e,t){const n=function(){const e=document.querySelector("video");e&&e.videoHeight&&t(e),requestAnimationFrame(n)};return requestAnimationFrame(n),document.getElementById(e)}},Nd=class extends xd{constructor(e){super(e,!1)}initCanvas({src:e,dest:t},n,i){const r="string"==typeof t?document.querySelector(t):t,o="undefined"!=typeof HTMLVideoElement&&e instanceof HTMLVideoElement,s=()=>{this.isDisposed||(e&&e.videoHeight&&n(e),requestAnimationFrame(s))};return o?requestAnimationFrame(s):"function"==typeof e?e(n,i):n(e),r}dispose(){this.isDisposed=!0}};var Md=function(e){let t;return t="string"==typeof e?new Ad(e):e&&e.src&&e.dest?new Nd(e):new Sd(e),t};function Fd(e){return Array.isArray(e)||(e=[e]),e}let Cd=class{constructor(e){this.store=e?{...e.get()}:{}}reset(){this.store={}}get(e){if(!e)return this.store;const t=(e=Fd(e)).reduce(((e,t)=>{const n=this.store[t];return e.push(n),e}),[]);return 1===t.length?t[0]:t}set(e,t){if(e=Fd(e),t=Fd(t),e.length!==t.length)throw new Error(`cant set values ${t} to keys ${e}, length did not match`);e.forEach(((e,n)=>{this.store[e]=t[n]}))}},Od=class{constructor(e,t,n,i){this.gl=i.gl,this.unit=e,this.bindPoint=t,this.height=1080,this.width=1920,this.textureObject=n.object,this.textureObjectInfo=n,this.isStatic=!1,n.needRefresh&&this.setParameters()}getUnit(){return this.unit}getObject(){return this.textureObject}bind(){this.gl.bindTexture(this.bindPoint,this.textureObject)}fill(){throw new Error("impl in concrete class")}setParameters(){this.bind(),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR)}active(){this.gl.activeTexture(this.gl.TEXTURE0+this.getUnit())}beforeUse(){this.active(),this.bind()}dispose(){this.gl.deleteTexture(this.textureObject)}setHeight(e){this.height=e}setWidth(e){this.width=e}getHeight(){if(!this.height)throw new Error(`texture ${this.unit} no height init `);return this.height}getWidth(){if(!this.width)throw new Error(`texture ${this.unit} no width init `);return this.width}};const Pd=Ju("frame","warn");let Rd=!1;if("undefined"!=typeof window&&window.InterludePlayer){let e=window.InterludePlayer.environment,t=e.isAffectedBySafari17SeekBug,n=e.ua.includes("WMT1H")&&e.ua.includes("iOS/17");Rd=t||n}function Dd(e,t){const n=e.gl;var i;n.texImage2D(e.bindPoint,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t),e.__hasAllocated=!0,i=e,Number.isFinite(i.width)&&Number.isFinite(i.height)&&(i.actualWidth=i.width,i.actualHeight=i.height,i.textureObjectInfo&&(i.textureObjectInfo.allocatedWidth=i.width,i.textureObjectInfo.allocatedHeight=i.height))}let Ld=class extends Od{fill(e){if(Rd&&(e.paused||"undefined"!=typeof document&&"hidden"===document.visibilityState))return;if(e.__closed)return;this.bind();const t=function(e,t){let n=!e.__hasAllocated;return t?(t.width===e.width&&t.height===e.height||(n=!0),e.width=t.width,e.height=t.height,n):n}(this,function(e){if(!e)return;const t=[[e.displayWidth,e.displayHeight],[e.codedWidth,e.codedHeight],[e.videoWidth,e.videoHeight],[e.naturalWidth,e.naturalHeight],[e.width,e.height]];for(let e=0;e<t.length;e+=1){const[n,i]=t[e],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}(e)),n=performance.now();!function(e,t,n){const i=e.gl,r=function(e){if("undefined"!=typeof HTMLVideoElement&&e instanceof HTMLVideoElement)return!0;const t="object"==typeof window?window:"object"==typeof self?self:null,n=t&&t.VideoFrame;return"function"==typeof n&&e instanceof n}(t);r&&(e.__useSubImage=!1),n||!1===e.__useSubImage||r?Dd(e,t):(i.texSubImage2D(e.bindPoint,0,0,0,i.RGBA,i.UNSIGNED_BYTE,t),void 0===e.__useSubImage&&(i.getError()!==i.NO_ERROR?(e.__useSubImage=!1,Dd(e,t)):e.__useSubImage=!0))}(this,e,t);const i=(performance.now()-n)/1e3;i>=.1&&Pd.warn(`[fill] texImage2D() took ${i.toFixed(3)} seconds to execute.`),"function"==typeof e.close&&!0!==e.__keepOpen&&(e.close(),e.__closed=!0)}},Bd=class extends Od{constructor(e,t,n){super(...arguments),n.needRefresh&&(this.fill(null),n.needRefresh=!1)}fill(e){if(this.bind(),e&&e.tagName&&"IMG"===e.tagName){const t=Number(e.naturalWidth||e.width),n=Number(e.naturalHeight||e.height);this.gl.texImage2D(this.bindPoint,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),Number.isFinite(t)&&Number.isFinite(n)&&(this.actualWidth=t,this.actualHeight=n,this.textureObjectInfo&&(this.textureObjectInfo.allocatedWidth=t,this.textureObjectInfo.allocatedHeight=n))}else{const t=this.gl.canvas.width,n=this.gl.canvas.height;this.gl.texImage2D(this.bindPoint,0,this.gl.RGBA,t,n,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),Number.isFinite(t)&&Number.isFinite(n)&&(this.actualWidth=t,this.actualHeight=n,this.textureObjectInfo&&(this.textureObjectInfo.allocatedWidth=t,this.textureObjectInfo.allocatedHeight=n))}}};var zd=function(e,t,n,i,r){let o;switch(e){case"frame":o=new Ld(t,n,i,r);break;case"pixel":o=new Bd(t,n,i,r);break;default:throw new Error(`cant recognize type ${e}`)}return o};let Wd=class{constructor(e){return this.gl=e.gl,this.textureObjectPool=[],this.textureUnitsPool=new Set(Array(20).keys()),this.activeTextures=e.activeTextures instanceof Set?e.activeTextures:new Set,{createTexture:this.createTexture.bind(this),releaseTexture:this.releaseTexture.bind(this),refreshTextureObjects:this.refreshTextureObjects.bind(this),refreshActiveTextures:this.refreshActiveTextures.bind(this)}}getTextureObject(){return this.textureObjectPool.pop()||{object:this.gl.createTexture(),needRefresh:!0}}getTextureUnit(){const e=this.textureUnitsPool.values(),t=Math.min.apply(null,[...e]);return this.textureUnitsPool.delete(t),t}createTexture(e){const t=e&&e.type||{},n=this.gl.TEXTURE_2D,i=this.getTextureUnit(),r=this.getTextureObject(),o=zd(t,i,n,r,{gl:this.gl});return this.activeTextures.add(o),o}releaseTexture(e){this.textureUnitsPool.has(e.getUnit())||(this.textureObjectPool.push({object:e.getObject(),needRefresh:!1}),this.textureUnitsPool.add(e.getUnit())),this.activeTextures.delete(e)}refreshTextureObjects(){this.textureObjectPool.forEach((e=>{e.needRefresh=!0}))}refreshActiveTextures(){const e=new Set;this.activeTextures.forEach((t=>{if(!t||"function"!=typeof t.getUnit)return;e.add(t.getUnit());const n={object:this.gl.createTexture(),needRefresh:!0};t.gl=this.gl,t.textureObjectInfo=n,t.textureObject=n.object,t.__hasAllocated=!1,t.__useSubImage=void 0,t.actualWidth=null,t.actualHeight=null,"function"==typeof t.setParameters&&t.setParameters()})),this.textureObjectPool=[],this.textureUnitsPool=new Set(Array(20).keys()),e.forEach((e=>{this.textureUnitsPool.delete(e)}))}};const $d=wd.VIDEO_SOURCE_PREFIX,jd=wd.TEXTURE_SOURCE_PREFIX,Ud=wd.PREVIOUS_OUTPUT_PREFIX,qd=wd.SAVED_FRAME_PREFIX;function Vd(e,t,n){e.set(`${$d}${n}`,t)}function Gd(e,t,n){e.set(`${Ud}${n}`,t)}function Hd(e,t,n){e.set(`${qd}${n}`,t)}let Kd=class{constructor(e){return this.gl=e.gl,this.glSource=e.glSource,this.textureManager=e.textureManager,this.capturedFramesManager=e.capturedFramesManager,{setVideoSources:this.setVideoSources.bind(this),setTextureSource:this.setTextureSource.bind(this),getInput:this.getInput.bind(this),getPrevOutput:this.getPrevOutput.bind(this),setOutputs:this.setOutputs.bind(this),disposeTextures:this.disposeTextures.bind(this),disposeAllStore:this.disposeAllStore.bind(this)}}setVideoSources(e){for(const[t,n]of Object.entries(this.capturedFramesManager.getCurrentFrames()))Vd(e,n,t),Gd(e,n,t);for(const[t,n]of Object.entries(this.capturedFramesManager.getSavedFrames()))Hd(e,n,t)}setTextureSource(e,t,n){e.set(`${jd}${n}`,t)}getInput(e,t){return e.get(t)}getPrevOutput(e,t){return t=Number.isInteger(t)?t:0,e.get(`${Ud}${t}`)}setOutputs(e,t=[],n=[]){if(Array.isArray(n)||(n=[n]),t.length>n.length)throw new Error(`output ids ${t.length} is bigger then supplied outputs ${n.length}`);n.forEach(((t,n)=>{Gd(e,t,n)})),t.forEach(((t,i)=>{e.set(t,n[i])}))}disposeTextures(e,t){const n=t.getUnit();e.forEach((e=>{const t=e.getUnit();this.capturedFramesManager.isReservedUnit(t)||n===t||this.textureManager.releaseTexture(e)}))}disposeAllStore(e){const t=new Set;Object.values(e.get()).forEach((e=>{const n=e.getUnit();this.capturedFramesManager.isReservedUnit(n)||t.has(n)||e.isStatic||(this.textureManager.releaseTexture(e),t.add(n))}))}},Xd=class{constructor(e){this.context=e}bind(){throw new Error("impl in concrete")}},Yd=100,Qd=100;function Jd(e,t){Yd=e,Qd=t}let Zd=class extends Xd{bind(e){var t,n;this.context.gl.bindFramebuffer(this.context.gl.FRAMEBUFFER,null);const i=null===(t=this.context.gl)||void 0===t||null===(t=t.canvas)||void 0===t?void 0:t.width,r=null===(n=this.context.gl)||void 0===n||null===(n=n.canvas)||void 0===n?void 0:n.height;return Number.isFinite(i)&&Number.isFinite(r)&&i>0&&r>0&&(this.context.gl.viewport(0,0,i,r),Jd(i,r)),e}},eh=class extends Xd{bind(e){Array.isArray(e)||(e=[e]),this.context.gl.bindFramebuffer(this.context.gl.FRAMEBUFFER,this.context.frameBufferObject);const t=this.context.textureManager.createTexture({type:"pixel"}),n=this.context.gl.COLOR_ATTACHMENT0;if(this.context.gl.framebufferTexture2D(this.context.gl.FRAMEBUFFER,n,this.context.gl.TEXTURE_2D,t.textureObject,0),this.context.gl.clear(this.context.gl.COLOR_BUFFER_BIT),!1!==this.context.useCanvasSizedFilterTargets){var i,r;const e=null===(i=this.context.gl)||void 0===i||null===(i=i.canvas)||void 0===i?void 0:i.width,n=null===(r=this.context.gl)||void 0===r||null===(r=r.canvas)||void 0===r?void 0:r.height;Number.isFinite(e)&&e>0&&t.setWidth(e),Number.isFinite(n)&&n>0&&t.setHeight(n);const o=t.textureObjectInfo,s=null==o?void 0:o.allocatedWidth,a=null==o?void 0:o.allocatedHeight;Number.isFinite(e)&&Number.isFinite(n)&&(s!==e||a!==n)&&"function"==typeof t.fill&&t.fill(null)}else e[0]&&(t.setHeight(e[0].getHeight()),t.setWidth(e[0].getWidth()));return t}},th=class{constructor(e){this.gl=e.gl,this.textureManager=e.textureManager,this.useCanvasSizedFilterTargets=e.useCanvasSizedFilterTargets,this.bufferIndex=0,this.frameBufferObjectsPool=[this.gl.createFramebuffer(),this.gl.createFramebuffer(),this.gl.createFramebuffer()]}getFrameBufferObject(){const e=this.frameBufferObjectsPool[this.bufferIndex];return this.bufferIndex=this.bufferIndex++%this.frameBufferObjectsPool.length,e}create(e){let t;return t=e===wd.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS?new Zd({gl:this.gl}):new eh({gl:this.gl,textureManager:this.textureManager,frameBufferObject:this.getFrameBufferObject(),useCanvasSizedFilterTargets:this.useCanvasSizedFilterTargets}),t}};function nh(e,t,n){const i=t===e.VERTEX_SHADER?"vertex":"fragment";var r;r=e,Boolean(r)&&("undefined"!=typeof WebGL2RenderingContext&&r instanceof WebGL2RenderingContext||"function"==typeof r.createVertexArray)&&(n=function(e="",t){if("string"!=typeof e||!e||function(e=""){return"string"==typeof e&&e.includes("#version 300 es")}(e))return e;let n=e;if("vertex"===t&&(n=n.replace(/\battribute\b/g,"in"),n=n.replace(/\bvarying\b/g,"out")),"fragment"===t&&(n=n.replace(/\bvarying\b/g,"in"),n=n.replace(/\bgl_FragColor\b/g,"fragColor")),n=n.replace(/\btexture2D\b/g,"texture"),n=`#version 300 es\n${n}`,"fragment"===t&&n.includes("fragColor")&&!/\bout\s+vec4\s+fragColor\s*;/.test(n)){const e=n.split("\n");let t=1;for(let n=1;n<e.length;n+=1)if(e[n].trim().startsWith("precision ")){t=n+1;break}e.splice(t,0,"out vec4 fragColor;"),n=e.join("\n")}return n}(n,i));const o=e.createShader(t);if(!o)throw new Error(`Failed to create ${i} shader`);if(e.shaderSource(o,n),e.compileShader(o),e.getShaderParameter(o,e.COMPILE_STATUS))return o;const s=e.getShaderInfoLog(o);throw e.deleteShader(o),new Error(s)}var ih=function(e,t){return nh(e,e.VERTEX_SHADER,t)},rh=function(e,t){return nh(e,e.FRAGMENT_SHADER,t)};const oh={position_3d:0,texture_coordinate_2d:1};var sh=function(e,t,n){const i=e.createProgram();if(e.attachShader(i,t),e.attachShader(i,n),Object.entries(oh).forEach((([t,n])=>{e.bindAttribLocation(i,n,t)})),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS))return i;const r=e.getProgramInfoLog(i);throw e.deleteProgram(i),new Error(r)},ah=[-1,-1,1,1,-1,1,-1,1,1,1,1,1],lh=[0,1,2,2,1,3],ch=[0,0,1,0,0,1,1,1];const uh=96,dh=[new Float32Array(new ArrayBuffer(uh)),new Float32Array(new ArrayBuffer(uh)),new Float32Array(new ArrayBuffer(uh)),new Float32Array(new ArrayBuffer(uh)),new Float32Array(new ArrayBuffer(uh)),new Float32Array(new ArrayBuffer(uh))],hh=[new Int16Array(6),new Int16Array(6),new Int16Array(6)];let fh=class{constructor(e,t,n){return this.gl=n.gl,this.program=n.program,this.bindPoint=t,this.location=this.gl.getAttribLocation(this.program,e),this.buffer=this.gl.createBuffer(),this.floatBufferCounter=0,this.unit16BufferCounter=0,{fillBuffer:this.fillBuffer.bind(this),bindBuffer:this.bindBuffer.bind(this),setPointer:this.setPointer.bind(this),dispose:this.dispose.bind(this)}}enable(){this.gl.enableVertexAttribArray(this.location)}bindBuffer(){this.gl.bindBuffer(this.bindPoint,this.buffer)}getBuffer(){let e;switch(this.bindPoint){case this.gl.ARRAY_BUFFER:e=dh[this.floatBufferCounter],this.floatBufferCounter=this.floatBufferCounter++%dh.length;break;case this.gl.ELEMENT_ARRAY_BUFFER:e=hh[this.unit16BufferCounter],this.unit16BufferCounter=this.unit16BufferCounter++%hh.length;break;default:throw new Error("cant get buffer for this bind point: ",this.bindPoint)}return e}fillBuffer(e){this.bindBuffer();const t=this.getBuffer();t.set(e,0),this.gl.bufferData(this.bindPoint,t,this.gl.STATIC_DRAW)}getPointerData(){throw new Error("you should impl this function")}setPointer(){this.bindBuffer(),this.enable();const e=this.getPointerData();this.gl.vertexAttribPointer(this.location,e.size,e.type,e.normalize,e.stride,e.offset)}dispose(){this.gl.deleteBuffer(this.buffer)}};const ph={position_3d:class extends fh{getPointerData(){return{size:3,type:this.gl.FLOAT,normalize:!1,stride:0,offset:0}}},position_indexes:class extends fh{setPointer(){}getPointerData(){}enable(){}},texture_coordinate_2d:class extends fh{getPointerData(){return{size:2,type:this.gl.FLOAT,normalize:!0,stride:0,offset:0}}}};var mh=function(e,t,n){const i=ph[e];if(!i)throw new Error(`${e} is not a attribute name,choose from list: ${Object.keys(ph)}`);return new i(e,t,n)};let vh=class{constructor(e,t){this.gl=t.gl,this.program=t.program,this.location=this.gl.getUniformLocation(this.program,e)}compute(){return this}set(){return this}},gh=class extends vh{set(e){this.gl.uniform1fv(this.location,e)}},yh=class extends vh{set(e){e&&(e.beforeUse(),this.gl.uniform1i(this.location,e.getUnit()))}};const bh="first_texture_dimensions",kh="viewport_dimensions",wh="time",xh={RUNTIME_OPTIONS:"runtimeOptions[0]",STATIC_OPTIONS:"staticOptions[0]",FIRST_TEXTURE:"first_texture",SECOND_TEXTURE:"second_texture",FIRST_MATRIX:"first_mat4"},_h={[xh.FIRST_TEXTURE]:yh,[xh.SECOND_TEXTURE]:yh,[xh.FIRST_MATRIX]:class extends vh{set(e){this.gl.uniformMatrix4fv(this.location,!1,e)}},[xh.STATIC_OPTIONS]:gh,[xh.RUNTIME_OPTIONS]:gh};var Th=function(e,t){const n=_h[e];if(!n)throw new Error(`${e} is not a attribute name,choose from list: ${Object.keys(_h)}`);return new n(e,t)},Ih=function(e,t){let n=(Date.now()-e||0)/(t||1);return n=Number.parseFloat(n).toFixed(7),n=Math.min(1,n),n};const Eh="position_3d",Sh="position_indexes",Ah="texture_coordinate_2d";let Nh=class e{constructor(e,t,n,i){this.type=e,this.gl=i.gl,this.frameBuffer=i.frameBufferFactory.create(e),this.rebindAttributesOnProgramSwitch=!1!==i.rebindAttributesOnProgramSwitch,this.vertexShader=ih(this.gl,t.vertex),this.fragmentShader=rh(this.gl,t.fragment),this.program=sh(this.gl,this.vertexShader,this.fragmentShader);const r={gl:this.gl,program:this.program};this.attributes=function(e,t){const n={};return e=e||[],(e=[{id:Eh,bindPoint:t.gl.ARRAY_BUFFER},{id:Sh,bindPoint:t.gl.ELEMENT_ARRAY_BUFFER},{id:Ah,bindPoint:t.gl.ARRAY_BUFFER}].concat(e)).forEach((e=>{const i=e.id;n[i]=mh(i,e.bindPoint,t)})),n}(n.attributes,r),this.uniforms=function(e,t){const n={};return(e=e||[]).forEach((e=>{const i=e.id;n[i]=Th(i,t)})),n}(n.uniforms,r),this.gl.useProgram(this.program),i.__handleAttributesInitedOnce||(this.handleAttributes(),i.__handleAttributesInitedOnce=!0),this.handleStaticUniforms(i.options)}static getFilterType(){throw new Error("impl in concrete class")}static getInputsCount(){throw new Error(`impl in concrete class ${this.getFilterType()}`)}static getInitialOptions(){throw new Error(`impl in concrete class ${this.getFilterType()}`)}static getUniformInfo(t){let n=[{id:xh.RUNTIME_OPTIONS},{id:xh.STATIC_OPTIONS}];return(t.getUniformList||e.getUniformList)().forEach((e=>{Object.values(xh).includes(e)&&n.push({id:e})})),n}handleRuntimeUniforms(t,n){const{inputTextures:i,viewportDimensions:r}=t;let o=Array.isArray(i)?i:[i],s=[];(this.constructor.getUniformList||e.getUniformList)().forEach((e=>{switch(e){case xh.FIRST_TEXTURE:this.uniforms[xh.FIRST_TEXTURE].set(o[0]);break;case xh.SECOND_TEXTURE:this.uniforms[xh.SECOND_TEXTURE].set(o[1]);break;case bh:s=[...s,o[0].getWidth(),o[0].getHeight()];break;case kh:s=[...s,r.width,r.height];break;case wh:{const e=Ih(n.startTime,n.duration);s=[...s,e];break}}})),s.length>0&&this.uniforms[xh.RUNTIME_OPTIONS].set(s)}static getUniformList(){return[xh.FIRST_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(){}handleAttributes(){this.attributes[Eh].fillBuffer(ah),this.attributes[Eh].setPointer(),this.attributes[Sh].fillBuffer(lh),this.attributes[Ah].fillBuffer(ch),this.attributes[Ah].setPointer()}disposeAttributes(){Object.values(this.attributes).forEach((e=>{e.dispose()}))}render(e,t){const n=this.frameBuffer.bind(e);let i={width:Yd,height:Qd};return this.gl.useProgram(this.program),this.rebindAttributesOnProgramSwitch&&this.gl.__shaderGraphLastProgram!==this.program&&(this.handleAttributes(),this.gl.__shaderGraphLastProgram=this.program),this.handleRuntimeUniforms({inputTextures:e,viewportDimensions:i},t),this.draw(),n}draw(){const e=this.gl.TRIANGLES,t=this.gl.UNSIGNED_SHORT;this.gl.drawElements(e,6,t,0)}updateStaticUniforms(e){this.gl.useProgram(this.program),this.handleStaticUniforms(e)}dispose(){this.gl.detachShader(this.program,this.vertexShader),this.gl.deleteShader(this.vertexShader),this.gl.detachShader(this.program,this.fragmentShader),this.gl.deleteShader(this.fragmentShader),this.gl.deleteProgram(this.program)}};var Mh,Fh="undefined"!=typeof Float32Array?Float32Array:Array;function Ch(){var e=new Fh(3);return Fh!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Oh(e,t,n){var i=new Fh(3);return i[0]=e,i[1]=t,i[2]=n,i}function Ph(){var e=new Fh(4);return Fh!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}Ch(),function(){var e;e=new Fh(4),Fh!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0)}(),Ch(),Oh(1,0,0),Oh(0,1,0),Ph(),Ph(),Mh=new Fh(9),Fh!=Float32Array&&(Mh[1]=0,Mh[2]=0,Mh[3]=0,Mh[5]=0,Mh[6]=0,Mh[7]=0),Mh[0]=1,Mh[4]=1,Mh[8]=1;class Rh extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Rh)};super(Rh.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[2];\n\nvarying vec2 blur_texture_coordinate_2d[11];\n\n\nvoid main() {\n vec2 normalize_poistion = vec2(position_3d.xy);\n gl_Position = vec4(normalize_poistion, 1, 1);\n\n float texture_width = runtimeOptions[0];\n float pixel_width = 1.0 / texture_width;\n\n \n for(int i=-5; i<5; ++i){\n float current_i = float(i);\n blur_texture_coordinate_2d[i+5] = texture_coordinate_2d + vec2(pixel_width * current_i, 0.0); \n }\n}\n",fragment:"\nprecision lowp float;\n\nuniform sampler2D first_texture;\n\nvarying vec2 blur_texture_coordinate_2d[11];\n\nvoid main() {\n vec4 out_colour = vec4(0.0);\n\tout_colour += texture2D(first_texture, blur_texture_coordinate_2d[0]) * 0.0093;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[1]) * 0.028002;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[2]) * 0.065984;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[3]) * 0.121703;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[4]) * 0.175713;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[5]) * 0.198596;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[6]) * 0.175713;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[7]) * 0.121703;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[8]) * 0.065984;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[9]) * 0.028002;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[10]) * 0.0093;\n \n \n gl_FragColor = out_colour;\n}"},t,e)}static getFilterType(){return"horizontalBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[xh.FIRST_TEXTURE,bh]}}class Dh extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Dh)};super(Dh.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[2];\n\nvarying vec2 blur_texture_coordinate_2d[11];\n\n\nvoid main() {\n vec2 normalize_poistion = vec2(position_3d.xy);\n gl_Position = vec4(normalize_poistion, 1, 1);\n\n float texture_width = runtimeOptions[1];\n float pixel_height = 1.0 / texture_width;\n\n for(int i=-5; i<5; ++i){\n float current_i = float(i);\n blur_texture_coordinate_2d[i+5] = texture_coordinate_2d + vec2( 0.0, pixel_height * current_i);\n }\n}\n",fragment:"\nprecision lowp float;\n\nuniform sampler2D first_texture;\n\nvarying vec2 blur_texture_coordinate_2d[11];\n\nvoid main() {\n vec4 out_colour = vec4(0.0);\n\tout_colour += texture2D(first_texture, blur_texture_coordinate_2d[0]) * 0.0093;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[1]) * 0.028002;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[2]) * 0.065984;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[3]) * 0.121703;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[4]) * 0.175713;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[5]) * 0.198596;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[6]) * 0.175713;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[7]) * 0.121703;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[8]) * 0.065984;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[9]) * 0.028002;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[10]) * 0.0093;\n \n \n gl_FragColor = out_colour;\n}"},t,e)}static getFilterType(){return"verticalBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[xh.FIRST_TEXTURE,bh]}}class Lh extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Lh)};super(Lh.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float staticOptions[3];\nuniform float runtimeOptions[4];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nconst float Depth = 3.;\nconst float Samples = 8.;\nfloat OffsetDist = staticOptions[0];\n\nvec2 srcDims = vec2(runtimeOptions[0], runtimeOptions[1]);\nvec2 vpDims = vec2(runtimeOptions[2], runtimeOptions[3]);\nvec2 iResolution = vpDims;\n\n\n#define TAU 6.28318530718\n\nvec4 RadialBlur(vec2 fragCoord, float radius) {\n if (radius <= 0.) {\n return texture2D(first_texture, fragCoord/iResolution.xy);\n }\n\n vec2 offset;\n float angle = 0.;\n vec4 color = vec4(0.);\n\n for(float angle = 0.; angle < TAU; angle += (TAU/Samples)) {\n offset = vec2(cos(angle), sin(angle)) * radius;\n color += texture2D(first_texture, (fragCoord + offset)/iResolution.xy);\n }\n\n return color/Samples;\n\n}\n\nvec4 FastBlur(vec2 fragCoord) {\n\n vec4 color;\n vec2 offset;\n float fib = 2.;\n float fibTotal = 0.;\n\n for(float i = 1.; i <= Depth; ++i) {\n fib += i;\n color += RadialBlur(fragCoord, i * OffsetDist)/ fib;\n fibTotal += 1./fib;\n }\n\n return color/fibTotal;\n\n}\n\n// based on https://www.shadertoy.com/view/3ljBDd\nvoid main() {\n// vec2 fragCoords = (vec2(current_texture_coordinate_2d) + 1.0) / 2.0 * vpDims;\n vec2 fragCoords = vec2(current_texture_coordinate_2d) * vpDims;\n gl_FragColor = FastBlur(fragCoords);\n}"},t,e)}static getFilterType(){return"fastBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[xh.FIRST_TEXTURE,bh,kh]}handleStaticUniforms(e){var t;const n=(null!==(t=Number.parseFloat(e.offsetDist))&&void 0!==t?t:4).toFixed(3);this.uniforms[xh.STATIC_OPTIONS].set([n])}}class Bh extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Bh)};super(Bh.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float staticOptions[2];\nuniform float runtimeOptions[4];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvec2 vpDims = vec2(runtimeOptions[2], runtimeOptions[3]);\n\n// A simple directional blur that doesn't brighten the image, based on https://www.shadertoy.com/view/WdSXWD\n// and https://www.shadertoy.com/view/NltSD4\n\nvec4 dirBlur() {\n float angle = staticOptions[0];\n float strength = staticOptions[1];\n if (strength == 0.0){\n return texture2D(first_texture, current_texture_coordinate_2d);\n }\n\n vec2 uv = current_texture_coordinate_2d;\n\n float r = radians(angle);\n vec2 direction = vec2(sin(r), cos(r));\n\n vec2 strengthDirection = strength * direction;\n vec3 acc = vec3(0);\n for(float i = -1.0; i <= 1.0; i += (2.0 / 50.0)) {\n acc += texture2D(first_texture, uv - vec2(strengthDirection.x * i, strengthDirection.y * i)).rgb * (2.0 / 50.0) * .5;\n }\n\n return vec4(acc, 1.0);\n\n}\n\nvoid main() {\n gl_FragColor = dirBlur();\n}"},t,e)}static getFilterType(){return"directionalBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[xh.FIRST_TEXTURE,bh,kh]}handleStaticUniforms(e){var t,n;const i=(null!==(t=Number.parseFloat(e.angle))&&void 0!==t?t:90).toFixed(3),r=(null!==(n=Number.parseFloat(e.strength))&&void 0!==n?n:.1).toFixed(3);this.uniforms[xh.STATIC_OPTIONS].set([i,r])}}class zh extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(zh)};super(zh.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n \n current_texture_coordinate_2d = texture_coordinate_2d;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform float staticOptions[1];\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 texture = texture2D(first_texture, current_texture_coordinate_2d);\n float opacity = texture.w - (1.0 - staticOptions[0]);\n gl_FragColor = vec4((texture.xyz) , opacity);\n}"},t,e)}static getFilterType(){return"opacity"}static getInputsCount(){return 1}static getInitialOptions(){return{power:1}}getOptionsDisplay(){return[{properties:["power"],type:"slider",minValue:0,maxValue:1,step:.001}]}handleStaticUniforms(e){const t=Number.parseFloat(e.power).toFixed(7);this.uniforms[xh.STATIC_OPTIONS].set([t])}}class Wh extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Wh)};super(Wh.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform sampler2D second_texture;\n\nuniform float staticOptions[7];\nuniform float runtimeOptions[2];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\n\nfloat roundedBoxSDF(vec2 point, vec2 center, vec2 area, float radius) {\n return length(max(abs(point - center) - area + radius, 0.0)) - radius;\n}\n\nfloat boxSDF(vec2 point, vec2 center, vec2 area){\n vec2 d = abs(point - center) - area;\n return length(max(d,vec2(0)));\n}\n\n\nvoid main() {\n float type = staticOptions[0];\n vec2 aspectRatio = vec2(runtimeOptions[0]/runtimeOptions[1], 1.0);\n\n\n vec2 center = vec2(staticOptions[1], staticOptions[2]) * aspectRatio;\n vec2 area = max(vec2(staticOptions[3], staticOptions[4]) * aspectRatio, 0.0); \n float radius = staticOptions[5];\n\n vec2 SDF_PositionCoordinate2d = vec2(\n current_position_coordinate_2d.x,\n current_position_coordinate_2d.y * -1.0\n ) * aspectRatio;\n\n vec4 color1 = texture2D(first_texture, current_texture_coordinate_2d);\n vec4 color2 = texture2D(second_texture, current_texture_coordinate_2d);\n\n float dist;\n vec4 color;\n if(type == 0.0){\n dist = boxSDF(SDF_PositionCoordinate2d, center, area);\n color = (dist > 0.0) ? color2: color1;\n } else {\n dist = roundedBoxSDF(SDF_PositionCoordinate2d, center, area, radius);\n color = (dist > 0.0) ? color2: color1;\n color = mix( color, color2, 1.0-smoothstep(0.0,0.0025,abs(dist)));\n }\n \n gl_FragColor = color;\n}"},t,e)}static getFilterType(){return"shapeCompositeMask"}static getInputsCount(){return 2}static getInitialOptions(){return{type:"box",center:{x:0,y:0},area:{width:0,height:0},radius:.01,edgeSoftness:0}}getOptionsDisplay(){return[{properties:["center","x"],type:"slider",minValue:-1,maxValue:1,step:.001},{properties:["center","y"],type:"slider",minValue:-1,maxValue:1,step:.001},{properties:["area","width"],type:"slider",minValue:-2,maxValue:2,step:.001},{properties:["area","height"],type:"slider",minValue:-2,maxValue:2,step:.001},{properties:["radius"],type:"slider",minValue:-2,maxValue:2,step:.001},{properties:["edgeSoftness"],type:"slider",minValue:-2,maxValue:2,step:.001}]}static getUniformList(){return[xh.FIRST_TEXTURE,bh,xh.SECOND_TEXTURE]}handleStaticUniforms(e){let t;switch(e.type){case"box":t=0;break;case"rounded":t=1;break;default:throw new Error("cant recognize shape composite mask type")}const n=Number.parseFloat(e.center.x).toFixed(7);let i=Number.parseFloat(e.center.y).toFixed(7);i+=0;const r=Number.parseFloat(e.area.width).toFixed(7),o=Number.parseFloat(e.area.height).toFixed(7),s=Number.parseFloat(e.radius).toFixed(7),a=Number.parseFloat(e.edgeSoftness).toFixed(7);this.uniforms[xh.STATIC_OPTIONS].set([t,n,i,r,o,s,a])}}class $h extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo($h)};super($h.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform sampler2D second_texture;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 fgColor = texture2D(first_texture, current_texture_coordinate_2d);\n vec4 bgColor = texture2D(second_texture, current_texture_coordinate_2d);\n gl_FragColor = vec4(\n mix(bgColor.xyz, fgColor.xyz, fgColor.w),\n 1.0\n );\n // vec4 fgColor = texture2D(textures[1], current_texture_coordinate_2d);\n // if(fgColor.w > 0.0){\n // gl_FragColor = vec4(1.0,0,0,1);\n // }else{\n // gl_FragColor = vec4(1.0,1.0,0,1);\n // }\n \n \n}"},t,e)}static getFilterType(){return"shapeComposite"}static getInputsCount(){return 2}static getInitialOptions(){return{}}static getUniformList(){return[xh.FIRST_TEXTURE,xh.SECOND_TEXTURE]}}class jh extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(jh)};super(jh.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform sampler2D second_texture;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n // Look it up in the LUT\n vec4 textureColor = texture2D(first_texture, current_texture_coordinate_2d);\n\n mediump float blueColor = textureColor.b * 63.0;\n\n mediump vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0);\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n\n mediump vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0);\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n\n highp vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);\n\n\n highp vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);\n\n lowp vec4 newColor1 = texture2D(second_texture, texPos1);\n lowp vec4 newColor2 = texture2D(second_texture, texPos2);\n\n lowp vec4 color = mix(newColor1, newColor2, fract(blueColor));\n\n gl_FragColor = color;\n\n // debug\n// if (current_texture_coordinate_2d.x < 0.5) {\n// // Left half: show original\n// gl_FragColor = textureColor;\n// } else {\n// gl_FragColor = color;\n// }\n}\n"},t,e)}static getFilterType(){return"lut"}static getInputsCount(){return 2}static getInitialOptions(){return{}}static getUniformList(){return[xh.FIRST_TEXTURE,xh.SECOND_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(e){const t=Number.parseFloat(e.lutSize).toFixed(1);this.uniforms[xh.STATIC_OPTIONS].set([t])}}var Uh="attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",qh='precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\n\n// a 256 * 4 length array with values for the master, r, g and b curve respectively\n// Temporarily changed length to 256 to avoid the following error on some machines:\n// "Implementation limit of 4096 (e.g., number of built-in plus user defined active uniforms components) exceeded, fragment shader uses 4100 total uniforms."\nuniform float staticOptions[256];\n\n\n// implementation of round (doesn\'t exist in webgl)\nint round(float val){\n return int(floor(val + 0.5));\n}\n\n// no dynamic array indexes in webgl\n// see https://stackoverflow.com/questions/30585265/what-can-i-use-as-an-array-index-in-glsl-in-webgl\nfloat getCurveValue(float pixelValue){\n float v;\n for (int k = 0; k < 256; k++) {\n if (k == round(pixelValue * 255.0)){\n v = float(staticOptions[k]) / 255.0;\n }\n }\n return v;\n}\n\nvec3 masterCurve(vec4 color){\n float r = getCurveValue(color.r);\n float g = getCurveValue(color.g);\n float b = getCurveValue(color.b);\n// for (int k = 0; k < 256; ++k) {\n// if (k == int(color.g) * 256){\n// g = float(staticOptions[k]) / 256.0;\n// }\n// }\n// for (int k = 0; k < 256; ++k) {\n// if (k == int(color.b) * 256){\n// b = float(staticOptions[k]) / 256.0;\n// }\n// }\n return vec3(r,g,b);\n}\n\n//vec3 redCurve(vec3 color){\n// int offset = 256;\n// return vec3(staticOptions[int(int(color.r) + offset)], color.g, color.b);\n//}\n//\n//vec3 greenCurve(vec3 color){\n// int offset = 256 * 2;\n// return vec3(color.r, staticOptions[int(int(color.g) + offset)], color.b);\n//}\n//\n//vec3 blueCurve(vec3 color){\n// int offset = 256 * 3;\n// return vec3(color.r, color.g, staticOptions[int(int(color.b) + offset)]);\n//}\n\nvoid main() {\n// vec4 textureColor = texture2D(first_texture, current_texture_coordinate_2d);\n// vec3 afterMaster = masterCurve(textureColor);\n// vec3 afterRed = redCurve(afterMaster);\n// vec3 afterGreen = greenCurve(afterRed);\n// vec3 afterBlue = blueCurve(afterGreen);\n// vec4 finalColor = vec4(afterBlue, textureColor.a);\n\n vec4 textureColor = texture2D(first_texture, current_texture_coordinate_2d);\n vec3 afterMaster = masterCurve(textureColor);\n vec4 finalColor = vec4(afterMaster, textureColor.a);\n\n gl_FragColor = finalColor;\n}\n';const{abs:Vh,cos:Gh,sin:Hh,acos:Kh,atan2:Xh,sqrt:Yh,pow:Qh}=Math;function Jh(e){return e<0?-Qh(-e,1/3):Qh(e,1/3)}const Zh=Math.PI,ef=2*Zh,tf=Zh/2,nf=Number.MAX_SAFE_INTEGER||9007199254740991,rf=Number.MIN_SAFE_INTEGER||-9007199254740991,of={x:0,y:0,z:0},sf={Tvalues:[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Cvalues:[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],arcfn:function(e,t){const n=t(e);let i=n.x*n.x+n.y*n.y;return void 0!==n.z&&(i+=n.z*n.z),Yh(i)},compute:function(e,t,n){if(0===e)return t[0].t=0,t[0];const i=t.length-1;if(1===e)return t[i].t=1,t[i];const r=1-e;let o=t;if(0===i)return t[0].t=e,t[0];if(1===i){const t={x:r*o[0].x+e*o[1].x,y:r*o[0].y+e*o[1].y,t:e};return n&&(t.z=r*o[0].z+e*o[1].z),t}if(i<4){let t,s,a,l=r*r,c=e*e,u=0;2===i?(o=[o[0],o[1],o[2],of],t=l,s=r*e*2,a=c):3===i&&(t=l*r,s=l*e*3,a=r*c*3,u=e*c);const d={x:t*o[0].x+s*o[1].x+a*o[2].x+u*o[3].x,y:t*o[0].y+s*o[1].y+a*o[2].y+u*o[3].y,t:e};return n&&(d.z=t*o[0].z+s*o[1].z+a*o[2].z+u*o[3].z),d}const s=JSON.parse(JSON.stringify(t));for(;s.length>1;){for(let t=0;t<s.length-1;t++)s[t]={x:s[t].x+(s[t+1].x-s[t].x)*e,y:s[t].y+(s[t+1].y-s[t].y)*e},void 0!==s[t].z&&(s[t].z=s[t].z+(s[t+1].z-s[t].z)*e);s.splice(s.length-1,1)}return s[0].t=e,s[0]},computeWithRatios:function(e,t,n,i){const r=1-e,o=n,s=t;let a,l=o[0],c=o[1],u=o[2],d=o[3];return l*=r,c*=e,2===s.length?(a=l+c,{x:(l*s[0].x+c*s[1].x)/a,y:(l*s[0].y+c*s[1].y)/a,z:!!i&&(l*s[0].z+c*s[1].z)/a,t:e}):(l*=r,c*=2*r,u*=e*e,3===s.length?(a=l+c+u,{x:(l*s[0].x+c*s[1].x+u*s[2].x)/a,y:(l*s[0].y+c*s[1].y+u*s[2].y)/a,z:!!i&&(l*s[0].z+c*s[1].z+u*s[2].z)/a,t:e}):(l*=r,c*=1.5*r,u*=3*r,d*=e*e*e,4===s.length?(a=l+c+u+d,{x:(l*s[0].x+c*s[1].x+u*s[2].x+d*s[3].x)/a,y:(l*s[0].y+c*s[1].y+u*s[2].y+d*s[3].y)/a,z:!!i&&(l*s[0].z+c*s[1].z+u*s[2].z+d*s[3].z)/a,t:e}):void 0))},derive:function(e,t){const n=[];for(let i=e,r=i.length,o=r-1;r>1;r--,o--){const e=[];for(let n,r=0;r<o;r++)n={x:o*(i[r+1].x-i[r].x),y:o*(i[r+1].y-i[r].y)},t&&(n.z=o*(i[r+1].z-i[r].z)),e.push(n);n.push(e),i=e}return n},between:function(e,t,n){return t<=e&&e<=n||sf.approximately(e,t)||sf.approximately(e,n)},approximately:function(e,t,n){return Vh(e-t)<=(n||1e-6)},length:function(e){const t=sf.Tvalues.length;let n=0;for(let i,r=0;r<t;r++)i=.5*sf.Tvalues[r]+.5,n+=sf.Cvalues[r]*sf.arcfn(i,e);return.5*n},map:function(e,t,n,i,r){return i+(e-t)/(n-t)*(r-i)},lerp:function(e,t,n){const i={x:t.x+e*(n.x-t.x),y:t.y+e*(n.y-t.y)};return void 0!==t.z&&void 0!==n.z&&(i.z=t.z+e*(n.z-t.z)),i},pointToString:function(e){let t=e.x+"/"+e.y;return void 0!==e.z&&(t+="/"+e.z),t},pointsToString:function(e){return"["+e.map(sf.pointToString).join(", ")+"]"},copy:function(e){return JSON.parse(JSON.stringify(e))},angle:function(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=n.x-e.x,s=n.y-e.y;return Xh(i*s-r*o,i*o+r*s)},round:function(e,t){const n=""+e,i=n.indexOf(".");return parseFloat(n.substring(0,i+1+t))},dist:function(e,t){const n=e.x-t.x,i=e.y-t.y;return Yh(n*n+i*i)},closest:function(e,t){let n,i,r=Qh(2,63);return e.forEach((function(e,o){i=sf.dist(t,e),i<r&&(r=i,n=o)})),{mdist:r,mpos:n}},abcratio:function(e,t){if(2!==t&&3!==t)return!1;if(void 0===e)e=.5;else if(0===e||1===e)return e;const n=Qh(e,t)+Qh(1-e,t);return Vh((n-1)/n)},projectionratio:function(e,t){if(2!==t&&3!==t)return!1;if(void 0===e)e=.5;else if(0===e||1===e)return e;const n=Qh(1-e,t);return n/(Qh(e,t)+n)},lli8:function(e,t,n,i,r,o,s,a){const l=(e-n)*(o-a)-(t-i)*(r-s);return 0!=l&&{x:((e*i-t*n)*(r-s)-(e-n)*(r*a-o*s))/l,y:((e*i-t*n)*(o-a)-(t-i)*(r*a-o*s))/l}},lli4:function(e,t,n,i){const r=e.x,o=e.y,s=t.x,a=t.y,l=n.x,c=n.y,u=i.x,d=i.y;return sf.lli8(r,o,s,a,l,c,u,d)},lli:function(e,t){return sf.lli4(e,e.c,t,t.c)},makeline:function(e,t){return new vf(e.x,e.y,(e.x+t.x)/2,(e.y+t.y)/2,t.x,t.y)},findbbox:function(e){let t=nf,n=nf,i=rf,r=rf;return e.forEach((function(e){const o=e.bbox();t>o.x.min&&(t=o.x.min),n>o.y.min&&(n=o.y.min),i<o.x.max&&(i=o.x.max),r<o.y.max&&(r=o.y.max)})),{x:{min:t,mid:(t+i)/2,max:i,size:i-t},y:{min:n,mid:(n+r)/2,max:r,size:r-n}}},shapeintersections:function(e,t,n,i,r){if(!sf.bboxoverlap(t,i))return[];const o=[],s=[e.startcap,e.forward,e.back,e.endcap],a=[n.startcap,n.forward,n.back,n.endcap];return s.forEach((function(t){t.virtual||a.forEach((function(i){if(i.virtual)return;const s=t.intersects(i,r);s.length>0&&(s.c1=t,s.c2=i,s.s1=e,s.s2=n,o.push(s))}))})),o},makeshape:function(e,t,n){const i=t.points.length,r=e.points.length,o=sf.makeline(t.points[i-1],e.points[0]),s=sf.makeline(e.points[r-1],t.points[0]),a={startcap:o,forward:e,back:t,endcap:s,bbox:sf.findbbox([o,e,t,s]),intersections:function(e){return sf.shapeintersections(a,a.bbox,e,e.bbox,n)}};return a},getminmax:function(e,t,n){if(!n)return{min:0,max:0};let i,r,o=nf,s=rf;-1===n.indexOf(0)&&(n=[0].concat(n)),-1===n.indexOf(1)&&n.push(1);for(let a=0,l=n.length;a<l;a++)i=n[a],r=e.get(i),r[t]<o&&(o=r[t]),r[t]>s&&(s=r[t]);return{min:o,mid:(o+s)/2,max:s,size:s-o}},align:function(e,t){const n=t.p1.x,i=t.p1.y,r=-Xh(t.p2.y-i,t.p2.x-n);return e.map((function(e){return{x:(e.x-n)*Gh(r)-(e.y-i)*Hh(r),y:(e.x-n)*Hh(r)+(e.y-i)*Gh(r)}}))},roots:function(e,t){t=t||{p1:{x:0,y:0},p2:{x:1,y:0}};const n=e.length-1,i=sf.align(e,t),r=function(e){return 0<=e&&e<=1};if(2===n){const e=i[0].y,t=i[1].y,n=i[2].y,o=e-2*t+n;if(0!==o){const i=-Yh(t*t-e*n),s=-e+t;return[-(i+s)/o,-(-i+s)/o].filter(r)}return t!==n&&0===o?[(2*t-n)/(2*t-2*n)].filter(r):[]}const o=i[0].y,s=i[1].y,a=i[2].y;let l=3*s-o-3*a+i[3].y,c=3*o-6*s+3*a,u=-3*o+3*s,d=o;if(sf.approximately(l,0)){if(sf.approximately(c,0))return sf.approximately(u,0)?[]:[-d/u].filter(r);const e=Yh(u*u-4*c*d),t=2*c;return[(e-u)/t,(-u-e)/t].filter(r)}c/=l,u/=l,d/=l;const h=(3*u-c*c)/3,f=h/3,p=(2*c*c*c-9*c*u+27*d)/27,m=p/2,v=m*m+f*f*f;let g,y,b,k,w;if(v<0){const e=-h/3,t=Yh(e*e*e),n=-p/(2*t),i=Kh(n<-1?-1:n>1?1:n),o=2*Jh(t);return b=o*Gh(i/3)-c/3,k=o*Gh((i+ef)/3)-c/3,w=o*Gh((i+2*ef)/3)-c/3,[b,k,w].filter(r)}if(0===v)return g=m<0?Jh(-m):-Jh(m),b=2*g-c/3,k=-g-c/3,[b,k].filter(r);{const e=Yh(v);return g=Jh(-m+e),y=Jh(m+e),[g-y-c/3].filter(r)}},droots:function(e){if(3===e.length){const t=e[0],n=e[1],i=e[2],r=t-2*n+i;if(0!==r){const e=-Yh(n*n-t*i),o=-t+n;return[-(e+o)/r,-(-e+o)/r]}return n!==i&&0===r?[(2*n-i)/(2*(n-i))]:[]}if(2===e.length){const t=e[0],n=e[1];return t!==n?[t/(t-n)]:[]}return[]},curvature:function(e,t,n,i,r){let o,s,a,l,c=0,u=0;const d=sf.compute(e,t),h=sf.compute(e,n),f=d.x*d.x+d.y*d.y;if(i?(o=Yh(Qh(d.y*h.z-h.y*d.z,2)+Qh(d.z*h.x-h.z*d.x,2)+Qh(d.x*h.y-h.x*d.y,2)),s=Qh(f+d.z*d.z,1.5)):(o=d.x*h.y-d.y*h.x,s=Qh(f,1.5)),0===o||0===s)return{k:0,r:0};if(c=o/s,u=s/o,!r){const r=sf.curvature(e-.001,t,n,i,!0).k,o=sf.curvature(e+.001,t,n,i,!0).k;l=(o-c+(c-r))/2,a=(Vh(o-c)+Vh(c-r))/2}return{k:c,r:u,dk:l,adk:a}},inflections:function(e){if(e.length<4)return[];const t=sf.align(e,{p1:e[0],p2:e.slice(-1)[0]}),n=t[2].x*t[1].y,i=t[3].x*t[1].y,r=t[1].x*t[2].y,o=18*(-3*n+2*i+3*r-t[3].x*t[2].y),s=18*(3*n-i-3*r),a=18*(r-n);if(sf.approximately(o,0)){if(!sf.approximately(s,0)){let e=-a/s;if(0<=e&&e<=1)return[e]}return[]}const l=2*o;if(sf.approximately(l,0))return[];const c=s*s-4*o*a;if(c<0)return[];const u=Math.sqrt(c);return[(u-s)/l,-(s+u)/l].filter((function(e){return 0<=e&&e<=1}))},bboxoverlap:function(e,t){const n=["x","y"],i=n.length;for(let r,o,s,a,l=0;l<i;l++)if(r=n[l],o=e[r].mid,s=t[r].mid,a=(e[r].size+t[r].size)/2,Vh(o-s)>=a)return!1;return!0},expandbox:function(e,t){t.x.min<e.x.min&&(e.x.min=t.x.min),t.y.min<e.y.min&&(e.y.min=t.y.min),t.z&&t.z.min<e.z.min&&(e.z.min=t.z.min),t.x.max>e.x.max&&(e.x.max=t.x.max),t.y.max>e.y.max&&(e.y.max=t.y.max),t.z&&t.z.max>e.z.max&&(e.z.max=t.z.max),e.x.mid=(e.x.min+e.x.max)/2,e.y.mid=(e.y.min+e.y.max)/2,e.z&&(e.z.mid=(e.z.min+e.z.max)/2),e.x.size=e.x.max-e.x.min,e.y.size=e.y.max-e.y.min,e.z&&(e.z.size=e.z.max-e.z.min)},pairiteration:function(e,t,n){const i=e.bbox(),r=t.bbox(),o=1e5,s=n||.5;if(i.x.size+i.y.size<s&&r.x.size+r.y.size<s)return[(o*(e._t1+e._t2)/2|0)/o+"/"+(o*(t._t1+t._t2)/2|0)/o];let a=e.split(.5),l=t.split(.5),c=[{left:a.left,right:l.left},{left:a.left,right:l.right},{left:a.right,right:l.right},{left:a.right,right:l.left}];c=c.filter((function(e){return sf.bboxoverlap(e.left.bbox(),e.right.bbox())}));let u=[];return 0===c.length||(c.forEach((function(e){u=u.concat(sf.pairiteration(e.left,e.right,s))})),u=u.filter((function(e,t){return u.indexOf(e)===t}))),u},getccenter:function(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=n.x-t.x,s=n.y-t.y,a=i*Gh(tf)-r*Hh(tf),l=i*Hh(tf)+r*Gh(tf),c=o*Gh(tf)-s*Hh(tf),u=o*Hh(tf)+s*Gh(tf),d=(e.x+t.x)/2,h=(e.y+t.y)/2,f=(t.x+n.x)/2,p=(t.y+n.y)/2,m=d+a,v=h+l,g=f+c,y=p+u,b=sf.lli8(d,h,m,v,f,p,g,y),k=sf.dist(b,e);let w,x=Xh(e.y-b.y,e.x-b.x),_=Xh(t.y-b.y,t.x-b.x),T=Xh(n.y-b.y,n.x-b.x);return x<T?((x>_||_>T)&&(x+=ef),x>T&&(w=T,T=x,x=w)):T<_&&_<x?(w=T,T=x,x=w):T+=ef,b.s=x,b.e=T,b.r=k,b},numberSort:function(e,t){return e-t}};class af{constructor(e){this.curves=[],this._3d=!1,e&&(this.curves=e,this._3d=this.curves[0]._3d)}valueOf(){return this.toString()}toString(){return"["+this.curves.map((function(e){return sf.pointsToString(e.points)})).join(", ")+"]"}addCurve(e){this.curves.push(e),this._3d=this._3d||e._3d}length(){return this.curves.map((function(e){return e.length()})).reduce((function(e,t){return e+t}))}curve(e){return this.curves[e]}bbox(){const e=this.curves;for(var t=e[0].bbox(),n=1;n<e.length;n++)sf.expandbox(t,e[n].bbox());return t}offset(e){const t=[];return this.curves.forEach((function(n){t.push(...n.offset(e))})),new af(t)}}const{abs:lf,min:cf,max:uf,cos:df,sin:hf,acos:ff,sqrt:pf}=Math,mf=Math.PI;let vf=class e{constructor(e){let t=e&&e.forEach?e:Array.from(arguments).slice(),n=!1;if("object"==typeof t[0]){n=t.length;const e=[];t.forEach((function(t){["x","y","z"].forEach((function(n){void 0!==t[n]&&e.push(t[n])}))})),t=e}let i=!1;const r=t.length;if(n){if(n>4){if(1!==arguments.length)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");i=!0}}else if(6!==r&&8!==r&&9!==r&&12!==r&&1!==arguments.length)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");const o=this._3d=!i&&(9===r||12===r)||e&&e[0]&&void 0!==e[0].z,s=this.points=[];for(let e=0,n=o?3:2;e<r;e+=n){var a={x:t[e],y:t[e+1]};o&&(a.z=t[e+2]),s.push(a)}const l=this.order=s.length-1,c=this.dims=["x","y"];o&&c.push("z"),this.dimlen=c.length;const u=sf.align(s,{p1:s[0],p2:s[l]}),d=sf.dist(s[0],s[l]);this._linear=u.reduce(((e,t)=>e+lf(t.y)),0)<d/50,this._lut=[],this._t1=0,this._t2=1,this.update()}static quadraticFromPoints(t,n,i,r){if(void 0===r&&(r=.5),0===r)return new e(n,n,i);if(1===r)return new e(t,n,n);const o=e.getABC(2,t,n,i,r);return new e(t,o.A,i)}static cubicFromPoints(t,n,i,r,o){void 0===r&&(r=.5);const s=e.getABC(3,t,n,i,r);void 0===o&&(o=sf.dist(n,s.C));const a=o*(1-r)/r,l=sf.dist(t,i),c=(i.x-t.x)/l,u=(i.y-t.y)/l,d=o*c,h=o*u,f=a*c,p=a*u,m=n.x-d,v=n.y-h,g=n.x+f,y=n.y+p,b=s.A,k=b.x+(m-b.x)/(1-r),w=b.y+(v-b.y)/(1-r),x=b.x+(g-b.x)/r,_=b.y+(y-b.y)/r,T={x:t.x+(k-t.x)/r,y:t.y+(w-t.y)/r},I={x:i.x+(x-i.x)/(1-r),y:i.y+(_-i.y)/(1-r)};return new e(t,T,I,i)}static getUtils(){return sf}getUtils(){return e.getUtils()}static get PolyBezier(){return af}valueOf(){return this.toString()}toString(){return sf.pointsToString(this.points)}toSVG(){if(this._3d)return!1;const e=this.points,t=["M",e[0].x,e[0].y,2===this.order?"Q":"C"];for(let n=1,i=e.length;n<i;n++)t.push(e[n].x),t.push(e[n].y);return t.join(" ")}setRatios(e){if(e.length!==this.points.length)throw new Error("incorrect number of ratio values");this.ratios=e,this._lut=[]}verify(){const e=this.coordDigest();e!==this._print&&(this._print=e,this.update())}coordDigest(){return this.points.map((function(e,t){return""+t+e.x+e.y+(e.z?e.z:0)})).join("")}update(){this._lut=[],this.dpoints=sf.derive(this.points,this._3d),this.computedirection()}computedirection(){const e=this.points,t=sf.angle(e[0],e[this.order],e[1]);this.clockwise=t>0}length(){return sf.length(this.derivative.bind(this))}static getABC(e=2,t,n,i,r=.5){const o=sf.projectionratio(r,e),s=1-o,a={x:o*t.x+s*i.x,y:o*t.y+s*i.y},l=sf.abcratio(r,e);return{A:{x:n.x+(n.x-a.x)/l,y:n.y+(n.y-a.y)/l},B:n,C:a,S:t,E:i}}getABC(t,n){n=n||this.get(t);let i=this.points[0],r=this.points[this.order];return e.getABC(this.order,i,n,r,t)}getLUT(e){if(this.verify(),e=e||100,this._lut.length===e+1)return this._lut;this._lut=[],e++,this._lut=[];for(let t,n,i=0;i<e;i++)n=i/(e-1),t=this.compute(n),t.t=n,this._lut.push(t);return this._lut}on(e,n){n=n||5;const i=this.getLUT(),r=[];for(let t,o=0,s=0;o<i.length;o++)t=i[o],sf.dist(t,e)<n&&(r.push(t),s+=o/i.length);return!!r.length&&(t/=r.length)}project(e){const t=this.getLUT(),n=t.length-1,i=sf.closest(t,e),r=i.mpos,o=(r-1)/n,s=(r+1)/n,a=.1/n;let l,c=i.mdist,u=o,d=u;c+=1;for(let t;u<s+a;u+=a)l=this.compute(u),t=sf.dist(e,l),t<c&&(c=t,d=u);return d=d<0?0:d>1?1:d,l=this.compute(d),l.t=d,l.d=c,l}get(e){return this.compute(e)}point(e){return this.points[e]}compute(e){return this.ratios?sf.computeWithRatios(e,this.points,this.ratios,this._3d):sf.compute(e,this.points,this._3d,this.ratios)}raise(){const t=this.points,n=[t[0]],i=t.length;for(let e,r,o=1;o<i;o++)e=t[o],r=t[o-1],n[o]={x:(i-o)/i*e.x+o/i*r.x,y:(i-o)/i*e.y+o/i*r.y};return n[i]=t[i-1],new e(n)}derivative(e){return sf.compute(e,this.dpoints[0],this._3d)}dderivative(e){return sf.compute(e,this.dpoints[1],this._3d)}align(){let t=this.points;return new e(sf.align(t,{p1:t[0],p2:t[t.length-1]}))}curvature(e){return sf.curvature(e,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return sf.inflections(this.points)}normal(e){return this._3d?this.__normal3(e):this.__normal2(e)}__normal2(e){const t=this.derivative(e),n=pf(t.x*t.x+t.y*t.y);return{t:e,x:-t.y/n,y:t.x/n}}__normal3(e){const t=this.derivative(e),n=this.derivative(e+.01),i=pf(t.x*t.x+t.y*t.y+t.z*t.z),r=pf(n.x*n.x+n.y*n.y+n.z*n.z);t.x/=i,t.y/=i,t.z/=i,n.x/=r,n.y/=r,n.z/=r;const o={x:n.y*t.z-n.z*t.y,y:n.z*t.x-n.x*t.z,z:n.x*t.y-n.y*t.x},s=pf(o.x*o.x+o.y*o.y+o.z*o.z);o.x/=s,o.y/=s,o.z/=s;const a=[o.x*o.x,o.x*o.y-o.z,o.x*o.z+o.y,o.x*o.y+o.z,o.y*o.y,o.y*o.z-o.x,o.x*o.z-o.y,o.y*o.z+o.x,o.z*o.z];return{t:e,x:a[0]*t.x+a[1]*t.y+a[2]*t.z,y:a[3]*t.x+a[4]*t.y+a[5]*t.z,z:a[6]*t.x+a[7]*t.y+a[8]*t.z}}hull(e){let t=this.points,n=[],i=[],r=0;for(i[r++]=t[0],i[r++]=t[1],i[r++]=t[2],3===this.order&&(i[r++]=t[3]);t.length>1;){n=[];for(let o,s=0,a=t.length-1;s<a;s++)o=sf.lerp(e,t[s],t[s+1]),i[r++]=o,n.push(o);t=n}return i}split(t,n){if(0===t&&n)return this.split(n).left;if(1===n)return this.split(t).right;const i=this.hull(t),r={left:2===this.order?new e([i[0],i[3],i[5]]):new e([i[0],i[4],i[7],i[9]]),right:2===this.order?new e([i[5],i[4],i[2]]):new e([i[9],i[8],i[6],i[3]]),span:i};return r.left._t1=sf.map(0,0,1,this._t1,this._t2),r.left._t2=sf.map(t,0,1,this._t1,this._t2),r.right._t1=sf.map(t,0,1,this._t1,this._t2),r.right._t2=sf.map(1,0,1,this._t1,this._t2),n?(n=sf.map(n,t,1,0,1),r.right.split(n).left):r}extrema(){const e={};let t=[];return this.dims.forEach(function(n){let i=function(e){return e[n]},r=this.dpoints[0].map(i);e[n]=sf.droots(r),3===this.order&&(r=this.dpoints[1].map(i),e[n]=e[n].concat(sf.droots(r))),e[n]=e[n].filter((function(e){return e>=0&&e<=1})),t=t.concat(e[n].sort(sf.numberSort))}.bind(this)),e.values=t.sort(sf.numberSort).filter((function(e,n){return t.indexOf(e)===n})),e}bbox(){const e=this.extrema(),t={};return this.dims.forEach(function(n){t[n]=sf.getminmax(this,n,e[n])}.bind(this)),t}overlaps(e){const t=this.bbox(),n=e.bbox();return sf.bboxoverlap(t,n)}offset(t,n){if(void 0!==n){const e=this.get(t),i=this.normal(t),r={c:e,n:i,x:e.x+i.x*n,y:e.y+i.y*n};return this._3d&&(r.z=e.z+i.z*n),r}if(this._linear){const n=this.normal(0),i=this.points.map((function(e){const i={x:e.x+t*n.x,y:e.y+t*n.y};return e.z&&n.z&&(i.z=e.z+t*n.z),i}));return[new e(i)]}return this.reduce().map((function(e){return e._linear?e.offset(t)[0]:e.scale(t)}))}simple(){if(3===this.order){const e=sf.angle(this.points[0],this.points[3],this.points[1]),t=sf.angle(this.points[0],this.points[3],this.points[2]);if(e>0&&t<0||e<0&&t>0)return!1}const e=this.normal(0),t=this.normal(1);let n=e.x*t.x+e.y*t.y;return this._3d&&(n+=e.z*t.z),lf(ff(n))<mf/3}reduce(){let e,t,n=0,i=0,r=.01,o=[],s=[],a=this.extrema().values;for(-1===a.indexOf(0)&&(a=[0].concat(a)),-1===a.indexOf(1)&&a.push(1),n=a[0],e=1;e<a.length;e++)i=a[e],t=this.split(n,i),t._t1=n,t._t2=i,o.push(t),n=i;return o.forEach((function(e){for(n=0,i=0;i<=1;)for(i=n+r;i<=1.01;i+=r)if(t=e.split(n,i),!t.simple()){if(i-=r,lf(n-i)<r)return[];t=e.split(n,i),t._t1=sf.map(n,0,1,e._t1,e._t2),t._t2=sf.map(i,0,1,e._t1,e._t2),s.push(t),n=i;break}n<1&&(t=e.split(n,1),t._t1=sf.map(n,0,1,e._t1,e._t2),t._t2=e._t2,s.push(t))})),s}translate(t,n,i){i="number"==typeof i?i:n;const r=this.order;let o=this.points.map(((e,t)=>(1-t/r)*n+t/r*i));return new e(this.points.map(((e,n)=>({x:e.x+t.x*o[n],y:e.y+t.y*o[n]}))))}scale(t){const n=this.order;let i=!1;if("function"==typeof t&&(i=t),i&&2===n)return this.raise().scale(i);const r=this.clockwise,o=this.points;if(this._linear)return this.translate(this.normal(0),i?i(0):t,i?i(1):t);const s=i?i(0):t,a=i?i(1):t,l=[this.offset(0,10),this.offset(1,10)],c=[],u=sf.lli4(l[0],l[0].c,l[1],l[1].c);if(!u)throw new Error("cannot scale this curve. Try reducing it first.");return[0,1].forEach((function(e){const t=c[e*n]=sf.copy(o[e*n]);t.x+=(e?a:s)*l[e].n.x,t.y+=(e?a:s)*l[e].n.y})),i?([0,1].forEach((function(e){if(2!==n||!e){var s=o[e+1],a={x:s.x-u.x,y:s.y-u.y},l=i?i((e+1)/n):t;i&&!r&&(l=-l);var d=pf(a.x*a.x+a.y*a.y);a.x/=d,a.y/=d,c[e+1]={x:s.x+l*a.x,y:s.y+l*a.y}}})),new e(c)):([0,1].forEach((e=>{if(2===n&&e)return;const t=c[e*n],i=this.derivative(e),r={x:t.x+i.x,y:t.y+i.y};c[e+1]=sf.lli4(t,r,u,o[e+1])})),new e(c))}outline(t,n,i,r){if(n=void 0===n?t:n,this._linear){const o=this.normal(0),s=this.points[0],a=this.points[this.points.length-1];let l,c,u;void 0===i&&(i=t,r=n),l={x:s.x+o.x*t,y:s.y+o.y*t},u={x:a.x+o.x*i,y:a.y+o.y*i},c={x:(l.x+u.x)/2,y:(l.y+u.y)/2};const d=[l,c,u];l={x:s.x-o.x*n,y:s.y-o.y*n},u={x:a.x-o.x*r,y:a.y-o.y*r},c={x:(l.x+u.x)/2,y:(l.y+u.y)/2};const h=[u,c,l],f=sf.makeline(h[2],d[0]),p=sf.makeline(d[2],h[0]),m=[f,new e(d),p,new e(h)];return new af(m)}const o=this.reduce(),s=o.length,a=[];let l,c=[],u=0,d=this.length();const h=void 0!==i&&void 0!==r;function f(e,t,n,i,r){return function(o){const s=i/n,a=(i+r)/n,l=t-e;return sf.map(o,0,1,e+s*l,e+a*l)}}o.forEach((function(e){const o=e.length();h?(a.push(e.scale(f(t,i,d,u,o))),c.push(e.scale(f(-n,-r,d,u,o)))):(a.push(e.scale(t)),c.push(e.scale(-n))),u+=o})),c=c.map((function(e){return l=e.points,l[3]?e.points=[l[3],l[2],l[1],l[0]]:e.points=[l[2],l[1],l[0]],e})).reverse();const p=a[0].points[0],m=a[s-1].points[a[s-1].points.length-1],v=c[s-1].points[c[s-1].points.length-1],g=c[0].points[0],y=sf.makeline(v,p),b=sf.makeline(m,g),k=[y].concat(a).concat([b]).concat(c);return new af(k)}outlineshapes(e,t,n){t=t||e;const i=this.outline(e,t).curves,r=[];for(let e=1,t=i.length;e<t/2;e++){const o=sf.makeshape(i[e],i[t-e],n);o.startcap.virtual=e>1,o.endcap.virtual=e<t/2-1,r.push(o)}return r}intersects(t,n){return t?t.p1&&t.p2?this.lineIntersects(t):(t instanceof e&&(t=t.reduce()),this.curveintersects(this.reduce(),t,n)):this.selfintersects(n)}lineIntersects(e){const t=cf(e.p1.x,e.p2.x),n=cf(e.p1.y,e.p2.y),i=uf(e.p1.x,e.p2.x),r=uf(e.p1.y,e.p2.y);return sf.roots(this.points,e).filter((e=>{var o=this.get(e);return sf.between(o.x,t,i)&&sf.between(o.y,n,r)}))}selfintersects(e){const t=this.reduce(),n=t.length-2,i=[];for(let r,o,s,a=0;a<n;a++)o=t.slice(a,a+1),s=t.slice(a+2),r=this.curveintersects(o,s,e),i.push(...r);return i}curveintersects(e,t,n){const i=[];e.forEach((function(e){t.forEach((function(t){e.overlaps(t)&&i.push({left:e,right:t})}))}));let r=[];return i.forEach((function(e){const t=sf.pairiteration(e.left,e.right,n);t.length>0&&(r=r.concat(t))})),r}arcs(e){return e=e||.5,this._iterate(e,[])}_error(e,t,n,i){const r=(i-n)/4,o=this.get(n+r),s=this.get(i-r),a=sf.dist(e,t),l=sf.dist(e,o),c=sf.dist(e,s);return lf(l-a)+lf(c-a)}_iterate(e,t){let n,i=0,r=1;do{n=0,r=1;let o,s,a,l,c,u=this.get(i),d=!1,h=!1,f=r,p=1;do{if(h=d,l=a,f=(i+r)/2,o=this.get(f),s=this.get(r),a=sf.getccenter(u,o,s),a.interval={start:i,end:r},d=this._error(a,u,i,r)<=e,c=h&&!d,c||(p=r),d){if(r>=1){if(a.interval.end=p=1,l=a,r>1){let e={x:a.x+a.r*df(a.e),y:a.y+a.r*hf(a.e)};a.e+=sf.angle({x:a.x,y:a.y},e,this.get(1))}break}r+=(r-i)/2}else r=f}while(!c&&n++<100);if(n>=100)break;l=l||a,t.push(l),i=p}while(r<1);return t}};var gf={pointsToCurve:function(e,t){let n=1/t;if(0===e.length){let e=[];for(let i=0;i<t;i++){let t=i*n;e.push({x:t,y:.5})}return e}if(1===e.length){let i=e[0].y,r=[{x:0,y:i}];for(let e=0;e<t;e++){let t=e*n+n;r.push({x:t,y:i})}return r}let i=[],r=e[0],o=e[e.length-1],s=new vf({x:o.x-1,y:o.y},{x:o.x-1+(r.x-(o.x-1))/2,y:o.y},{x:r.x-(r.x-(o.x-1))/2,y:r.y},r),a=new vf(o,{x:o.x+(r.x+1-o.x)/2,y:o.y},{x:r.x+1-(r.x+1-o.x)/2,y:r.y},{x:r.x+1,y:r.y});for(let t=0;t<e.length-1;t++){let n=e[t],r=e[t+1],o={x:n.x+(r.x-n.x)/2,y:n.y},s={x:r.x-(r.x-n.x)/2,y:r.y},a=new vf(n,o,s,r);i.push(a)}i.unshift(s),i.push(a);let l=[s.get(s.intersects({p1:{x:0,y:0},p2:{x:0,y:1}})[0])];for(let e=0;e<t;e++){let t,r=e*n+n;i.every((e=>{let n=e.intersects({p1:{x:r,y:0},p2:{x:r,y:1}});return!(n.length>0&&(t=e.get(n[0]),l.push(t),1))}))}return l}};class yf{constructor(e,t){this.xs=e,this.ys=t,this.ks=this.getNaturalKs(new Float64Array(this.xs.length))}getNaturalKs(e){const t=this.xs.length-1,n=function(e,t){const n=[];for(let i=0;i<e;i++)n.push(new Float64Array(t));return n}(t+1,t+2);for(let e=1;e<t;e++)n[e][e-1]=1/(this.xs[e]-this.xs[e-1]),n[e][e]=2*(1/(this.xs[e]-this.xs[e-1])+1/(this.xs[e+1]-this.xs[e])),n[e][e+1]=1/(this.xs[e+1]-this.xs[e]),n[e][t+1]=3*((this.ys[e]-this.ys[e-1])/((this.xs[e]-this.xs[e-1])*(this.xs[e]-this.xs[e-1]))+(this.ys[e+1]-this.ys[e])/((this.xs[e+1]-this.xs[e])*(this.xs[e+1]-this.xs[e])));return n[0][0]=2/(this.xs[1]-this.xs[0]),n[0][1]=1/(this.xs[1]-this.xs[0]),n[0][t+1]=3*(this.ys[1]-this.ys[0])/((this.xs[1]-this.xs[0])*(this.xs[1]-this.xs[0])),n[t][t-1]=1/(this.xs[t]-this.xs[t-1]),n[t][t]=2/(this.xs[t]-this.xs[t-1]),n[t][t+1]=3*(this.ys[t]-this.ys[t-1])/((this.xs[t]-this.xs[t-1])*(this.xs[t]-this.xs[t-1])),function(e,t){const n=e.length;let i=0,r=0;for(;i<n&&r<=n;){let t=0,o=-1/0;for(let s=i;s<n;s++){const n=Math.abs(e[s][r]);n>o&&(t=s,o=n)}if(0===e[t][r])r++;else{bf(e,i,t);for(let t=i+1;t<n;t++){const o=e[t][r]/e[i][r];e[t][r]=0;for(let s=r+1;s<=n;s++)e[t][s]-=e[i][s]*o}i++,r++}}for(let i=n-1;i>=0;i--){var o=0;e[i][i]&&(o=e[i][n]/e[i][i]),t[i]=o;for(let t=i-1;t>=0;t--)e[t][n]-=e[t][i]*o,e[t][i]=0}return t}(n,e)}getIndexBefore(e){let t=0,n=this.xs.length,i=0;for(;t<n;)i=Math.floor((t+n)/2),this.xs[i]<e&&i!==t?t=i:n=this.xs[i]>=e&&i!==n?i:t;return t===this.xs.length-1?this.xs.length-1:t+1}at(e){let t=this.getIndexBefore(e);const n=(e-this.xs[t-1])/(this.xs[t]-this.xs[t-1]),i=this.ks[t-1]*(this.xs[t]-this.xs[t-1])-(this.ys[t]-this.ys[t-1]),r=-this.ks[t]*(this.xs[t]-this.xs[t-1])+(this.ys[t]-this.ys[t-1]);return(1-n)*this.ys[t-1]+n*this.ys[t]+n*(1-n)*(i*(1-n)+r*n)}}function bf(e,t,n){let i=e[t];e[t]=e[n],e[n]=i}function kf(e,t,n){const i=n[0],r=n[n.length-1];if(e<i.x)return i.y;if(e>r.x)return r.y;const o=t.at(e);return Math.max(0,Math.min(o,1))}var wf={pointsToCurve:function(e,t){if(!Array.isArray(e)||!e.every((e=>"object"==typeof e&&"number"==typeof e.x&&"number"==typeof e.y&&e.x>=0&&e.x<=1&&e.y>=0&&e.y<=1)))throw new Error("[pointsToCurve] Invalid points. Expected array of objects with x and y in [0, 1] range.");if(!("number"==typeof t&&t>=1))throw new Error(`[pointsToCurve] Invalid resolution: ${t}. Expected integer >= 1.`);const n=e.map((e=>e.x)),i=e.map((e=>e.y)),r=new yf(n,i);let o=[];for(let n=0;n<t;n++)o.push(kf(n/(t-1),r,e));return o}};function xf(e,t=256,n={}){return"bezier"===n.type?gf.pointsToCurve(e,t,n):wf.pointsToCurve(e,t)}const _f=[];for(let e=0;e<256;e++)_f[e]=e;class Tf extends Nh{constructor(e){const t={vertex:Uh,fragment:qh},n={uniforms:Nh.getUniformInfo(Tf)};super(Tf.getFilterType(),t,n,e)}static getFilterType(){return"curves"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=[];var n;t=[...e.master||e.points||e.masterPoints?e.master||(n=e.points||e.masterPoints,xf(n,256).map((e=>255*e))):_f],this.uniforms[xh.STATIC_OPTIONS].set(t)}}function If(e,t,n){if("number"!=typeof e||e<0||e>255)throw new Error(`[levels] Invalid black point: ${e}. Expected integer between 0 and 255`);if("number"!=typeof t||t<0||t>255)throw new Error(`[levels] Invalid white point: ${t}. Expected integer between 0 and 255`);if("number"!=typeof n||n<.01||n>9.99)throw new Error(`[levels] Invalid gamma: ${n}. Expected float between 0.01 and 9.99`);if(e>t)throw new Error(`[levels] Invalid black and white points: ${e}, ${t}. Expected black <= white`);let i=[];for(let r=0;r<256;r++){let o;o=r<=e?0:r>=t?255:255*Math.pow((r-e)/(t-e),1/n),i[r]=o}return i}class Ef extends Nh{constructor(e){const t={vertex:Uh,fragment:qh},n={uniforms:Nh.getUniformInfo(Ef)};super(Ef.getFilterType(),t,n,e)}static getFilterType(){return"levels"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=[...If(e.black,e.white,e.gamma)];this.uniforms[xh.STATIC_OPTIONS].set(t)}}const Sf=360,Af=[];for(let e=0;e<Sf;e++)Af[e]=e;class Nf extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Nf)};super(Nf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\n\n// a 360 length array with values for the hue curve\n// this represents a lookup table from a hue value to another hue value\nuniform float staticOptions[360];\n\n// implementation of round (doesn't exist in webgl)\nint round(float val){\n return int(floor(val + 0.5));\n}\n\n// glsl mod doesn't work with negative numbers so\n// this is a safer version that lets us play with negatives > -1.0\nfloat safeMod(float val){\n return mod(val + 1.0, 1.0);\n}\n\n// no dynamic array indexes in webgl\n// see https://stackoverflow.com/questions/30585265/what-can-i-use-as-an-array-index-in-glsl-in-webgl\nfloat getCurveValue(float pixelValue){\n float v;\n for (int k = 0; k < 360; k++) {\n if (k == round(pixelValue * 359.0)){\n v = float(staticOptions[k]) / 359.0;\n }\n }\n return v;\n}\n\n// function source https://www.shadertoy.com/view/4dKcWK\nconst float EPSILON = 1e-10;\n\nvec3 HUEtoRGB(in float hue) {\n // Hue [0..1] to RGB [0..1]\n // See http://www.chilliant.com/rgb2hsv.html\n vec3 rgb = abs(hue * 6. - vec3(3, 2, 4)) * vec3(1, -1, -1) + vec3(-1, 2, 2);\n return clamp(rgb, 0., 1.);\n}\n\nvec3 RGBtoHCV(in vec3 rgb) {\n // RGB [0..1] to Hue-Chroma-Value [0..1]\n // Based on work by Sam Hocevar and Emil Persson\n vec4 p = (rgb.g < rgb.b) ? vec4(rgb.bg, -1., 2. / 3.) : vec4(rgb.gb, 0., -1. / 3.);\n vec4 q = (rgb.r < p.x) ? vec4(p.xyw, rgb.r) : vec4(rgb.r, p.yzx);\n float c = q.x - min(q.w, q.y);\n float h = abs((q.w - q.y) / (6. * c + EPSILON) + q.z);\n return vec3(h, c, q.x);\n}\n\nvec3 HSVtoRGB(in vec3 hsv) {\n // Hue-Saturation-Value [0..1] to RGB [0..1]\n vec3 rgb = HUEtoRGB(hsv.x);\n return ((rgb - 1.) * hsv.y + 1.) * hsv.z;\n}\n\nvec3 HSLtoRGB(in vec3 hsl) {\n // Hue-Saturation-Lightness [0..1] to RGB [0..1]\n vec3 rgb = HUEtoRGB(hsl.x);\n float c = (1. - abs(2. * hsl.z - 1.)) * hsl.y;\n return (rgb - 0.5) * c + hsl.z;\n}\n\nvec3 RGBtoHSV(in vec3 rgb) {\n // RGB [0..1] to Hue-Saturation-Value [0..1]\n vec3 hcv = RGBtoHCV(rgb);\n float s = hcv.y / (hcv.z + EPSILON);\n return vec3(hcv.x, s, hcv.z);\n}\n\nvec3 RGBtoHSL(in vec3 rgb) {\n // RGB [0..1] to Hue-Saturation-Lightness [0..1]\n vec3 hcv = RGBtoHCV(rgb);\n float z = hcv.z - hcv.y * 0.5;\n float s = hcv.y / (1. - abs(z * 2. - 1.) + EPSILON);\n return vec3(hcv.x, s, z);\n}\n\nvoid main() {\n vec4 textureColor = texture2D(first_texture, current_texture_coordinate_2d);\n vec3 inHSL = RGBtoHSL(textureColor.rgb);\n // in the UI hue 0 is cyan and 180 is red\n float shiftedHue = getCurveValue(mod(inHSL.x + 0.5, 1.0));\n vec3 inRGB = HSLtoRGB(vec3(shiftedHue, inHSL.y, inHSL.z));\n\n vec4 finalColor = vec4(inRGB, textureColor.a);\n\n // During the rgb-to-hsl-to-rgb conversion total whites gets clipped on OSX for some reason\n // make sure to retain absolute white (since it has no chroma component)\n if (textureColor.r == 1.0 && textureColor.g == 1.0 && textureColor.b == 1.0){\n finalColor.rgb = vec3(1.0, 1.0, 1.0);\n }\n\n gl_FragColor = finalColor;\n}\n"},t,e)}static getFilterType(){return"hue"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=e.points&&function(e){return xf(e,Sf,{type:"bezier"}).map((e=>{return t=e,((Math.round(t.x*Sf)+180)%Sf+(1-t.y-.5)*Sf+Sf)%Sf;var t}))}(e.points)||Af;this.uniforms[xh.STATIC_OPTIONS].set(t)}}class Mf extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Mf)};super(Mf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\nuniform float staticOptions[2];\n\n//CIE L*a*b* (CIELAB, L* for lightness, a* from green to red, b* from blue to yellow)\n//Source: https://gist.github.com/mattatz/44f081cac87e2f7c8980 (HLSL)\nvec3 rgb2xyz(vec3 c){\n vec3 tmp=vec3(\n (c.r>.04045)?pow((c.r+.055)/1.055,2.4):c.r/12.92,\n (c.g>.04045)?pow((c.g+.055)/1.055,2.4):c.g/12.92,\n (c.b>.04045)?pow((c.b+.055)/1.055,2.4):c.b/12.92\n );\n mat3 mat=mat3(\n .4124,.3576,.1805,\n .2126,.7152,.0722,\n .0193,.1192,.9505\n );\n return 100.*(tmp*mat);\n}\nvec3 xyz2lab(vec3 c){\n vec3 n=c/vec3(95.047,100.,108.883),\n v=vec3(\n (n.x>.008856)?pow(n.x,1./3.):(7.787*n.x)+(16./116.),\n (n.y>.008856)?pow(n.y,1./3.):(7.787*n.y)+(16./116.),\n (n.z>.008856)?pow(n.z,1./3.):(7.787*n.z)+(16./116.)\n );\n return vec3((116.*v.y)-16.,500.*(v.x-v.y),200.*(v.y-v.z));\n}\nvec3 rgb2lab(vec3 c){\n vec3 lab=xyz2lab(rgb2xyz(c));\n return vec3(lab.x/100.,.5+.5*(lab.y/127.),.5+.5*(lab.z/127.));\n}\nvec3 lab2xyz(vec3 c){\n float fy=(c.x+16.)/116.,\n fx=c.y/500.+fy,\n fz=fy-c.z/200.;\n return vec3(\n 95.047*((fx>.206897)?fx*fx*fx:(fx-16./116.)/7.787),\n 100. *((fy>.206897)?fy*fy*fy:(fy-16./116.)/7.787),\n 108.883*((fz>.206897)?fz*fz*fz:(fz-16./116.)/7.787)\n );\n}\nvec3 xyz2rgb(vec3 c){\n mat3 mat=mat3(\n 3.2406,-1.5372,-.4986,\n -.9689, 1.8758, .0415,\n .0557, -.2040,1.0570\n );\n vec3 v=(c/100.0)*mat,\n r=vec3(\n (v.r>.0031308)?((1.055*pow(v.r,(1./2.4)))-.055):12.92*v.r,\n (v.g>.0031308)?((1.055*pow(v.g,(1./2.4)))-.055):12.92*v.g,\n (v.b>.0031308)?((1.055*pow(v.b,(1./2.4)))-.055):12.92*v.b\n );\n return r;\n}\nvec3 lab2rgb(vec3 c){return xyz2rgb(lab2xyz(vec3(100.*c.x,2.*127.*(c.y-.5),2.*127.*(c.z-.5))));}\n\n\nfloat handleMix(float x){\n return pow(x * 2.0 - 1.0, 2.0);\n}\n\nvoid main() {\n vec3 inColor = texture2D(first_texture, current_texture_coordinate_2d).rgb;\n// inColor = vec3(148.0 / 255.0, 99.0 / 255.0, 95.0 / 255.0); // debug\n\n vec3 inLab = rgb2lab(inColor);\n vec3 inRGB ;\n\n// vec2 tempTint = vec2(staticOptions[1], -staticOptions[0]);\n\n// inLab.yz += (tempTint.xy); // * 0.3; // damping of effect\n\n // lab range is 0 to 1, input is -128 to 127\n // lab chromacity zero is 0.5, 0.5 so convert between the ranges\n // y is a, z is b\n inLab.y -= (-staticOptions[1] + 128.0) / 255.0 - 0.5;\n inLab.z -= (staticOptions[0] + 128.0) / 255.0 - 0.5;\n\n inRGB = lab2rgb(inLab);\n\n\n // vec3 mixed = mix(inRGB, inColor, handleMix(inLab.x)); // mid tones\n // vec3 mixed = mix(inRGB, inColor, inLab.x); // only high tones\n vec3 mixed = mix(inRGB, inColor, 0.0); // no mix\n\n gl_FragColor = vec4(mixed,1.0);\n}\n"},t,e)}static getFilterType(){return"whiteBalance"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=e.temperature?e.temperature:0,n=e.tint?e.tint:0;this.uniforms[xh.STATIC_OPTIONS].set([t,n])}}class Ff extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Ff)};super(Ff.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\nuniform float staticOptions[4];\n\n// algorithm from here\n// https://github.com/CeeJayDK/SweetFX/blob/master/Shaders/Vibrance.fx\n\nvoid main() {\n float percentAmount = staticOptions[0];\n float redBalance = staticOptions[1];\n float greenBalance = staticOptions[2];\n float blueBalance = staticOptions[3];\n\n vec3 color = texture2D(first_texture, current_texture_coordinate_2d).rgb;\n vec3 coefLuma = vec3(0.212656, 0.715158, 0.072186);\n\n float luma = dot(coefLuma, color);\n\n float max_color = max(color.r, max(color.g, color.b)); // Find the strongest color\n float min_color = min(color.r, min(color.g, color.b)); // Find the weakest color\n\n float color_saturation = max_color - min_color; // The difference between the two is the saturation\n\n // Extrapolate between luma and original by 1 + (1-saturation) - current\n vec3 coeffVibrance = vec3(redBalance, greenBalance, blueBalance) * percentAmount;\n\n color.r = mix(luma, color.r, 1.0 + (coeffVibrance.r * (1.0 - (sign(coeffVibrance.r) * color_saturation))));\n color.g = mix(luma, color.g, 1.0 + (coeffVibrance.g * (1.0 - (sign(coeffVibrance.g) * color_saturation))));\n color.b = mix(luma, color.b, 1.0 + (coeffVibrance.b * (1.0 - (sign(coeffVibrance.b) * color_saturation))));\n\n\n gl_FragColor = vec4(color, 1.0);\n\n}\n"},t,e)}static getFilterType(){return"vibrance"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=e.amount?e.amount/100*2:0,n=null===e.redBalance?1:e.redBalance,i=null===e.greenBalance?1:e.greenBalance,r=null===e.blueBalance?1:e.blueBalance;this.uniforms[xh.STATIC_OPTIONS].set([t,n,i,r])}}class Cf extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Cf)};super(Cf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\nuniform float staticOptions[1];\n\n// algorithm from here\n// https://github.com/minus34/cesium1/blob/master/Cesium/Shaders/Builtin/Functions/saturation.glsl\n\n/**\n * Adjusts the saturation of a color.\n *\n * @name czm_saturation\n * @glslFunction\n *\n * @param {vec3} rgb The color.\n * @param {float} adjustment The amount to adjust the saturation of the color.\n *\n * @returns {float} The color with the saturation adjusted.\n *\n * @example\n * vec3 greyScale = czm_saturation(color, 0.0);\n * vec3 doubleSaturation = czm_saturation(color, 2.0);\n */\nvec3 czm_saturation(vec3 rgb, float adjustment)\n{\n // Algorithm from Chapter 16 of OpenGL Shading Language\n const vec3 W = vec3(0.2125, 0.7154, 0.0721);\n vec3 intensity = vec3(dot(rgb, W));\n return mix(intensity, rgb, adjustment);\n}\n\n\nvoid main() {\n float amount = staticOptions[0];\n vec3 color = texture2D(first_texture, current_texture_coordinate_2d).rgb;\n gl_FragColor = vec4(czm_saturation(color, amount), 1.0);\n}\n"},t,e)}static getFilterType(){return"saturation"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=null===e.amount?1:e.amount;this.uniforms[xh.STATIC_OPTIONS].set([t])}}class Of extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Of)};super(Of.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float staticOptions[12];\nuniform float runtimeOptions[4];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\n\nfloat roundedBoxSDF(vec2 CenterPosition, vec2 Size, float Radius) {\n return length(max(abs(CenterPosition)-Size+Radius,0.0))-Radius;\n}\n\nvoid main() {\n vec2 srcAR = vec2(runtimeOptions[0]/runtimeOptions[1], 1.0);\n // custom aspect ratio (other than the default 1920/1080)\n // useful for example when doing crop on crop\n if (staticOptions[10] > 0.0) { //\n srcAR.x = staticOptions[10];\n }\n vec2 srcCenter = vec2(staticOptions[0], staticOptions[1]);\n vec2 srcDims = vec2(staticOptions[2], staticOptions[3]);\n vec2 srcTL = vec2(srcCenter.x - srcDims[0] / 2.0, srcCenter.y - srcDims[1] / 2.0); // top left point\n\n vec2 srcDims_AR = srcDims * srcAR;\n vec2 srcTL_AR = srcTL * srcAR;\n\n vec2 vpDims = vec2(runtimeOptions[2], runtimeOptions[3]);\n vec2 vpAR = vec2(vpDims[0]/vpDims[1], 1.0);\n\n vec2 tgtCenter = vec2(staticOptions[4], staticOptions[5]);\n vec2 tgtDims = vec2(staticOptions[6], staticOptions[7]);\n vec2 tgtTL = vec2(tgtCenter.x - tgtDims[0] / 2.0, tgtCenter.y - tgtDims[1] / 2.0);\n\n vec2 tgtDims_AR = tgtDims * vpAR;\n vec2 tgtTL_AR = tgtTL * vpAR;\n\n vec2 pos_AR = current_texture_coordinate_2d * vpAR;\n\n float ratioW = tgtDims_AR[0] / srcDims_AR[0];\n float ratioH = tgtDims_AR[1] / srcDims_AR[1];\n\n float ratio;\n\n // the type of crop fit. 0 - contain, 1 - fill, 3 - stretch\n float fitType = staticOptions[8];\n\n if (fitType == 0.0){\n ratio = ratioW > ratioH ? ratioW : ratioH;\n vec2 tgtDims_OLD_AR = tgtDims_AR;\n tgtDims_AR = srcDims_AR * ratio;\n tgtTL_AR = tgtTL_AR - (tgtDims_AR - tgtDims_OLD_AR) / 2.0;\n } else if (fitType == 1.0){\n ratio = ratioW < ratioH ? ratioW : ratioH;\n vec2 tgtDims_OLD_AR = tgtDims_AR;\n tgtDims_AR = srcDims_AR * ratio;\n tgtTL_AR = tgtTL_AR + (tgtDims_OLD_AR - tgtDims_AR) / 2.0;\n }\n\n vec2 final_pos_AR = (pos_AR - tgtTL_AR) / tgtDims_AR * srcDims_AR + srcTL_AR;\n\n // transform coords back from AR into 0 to 1 range\n vec2 pos = final_pos_AR / srcAR;\n\n // How soft the edges should be . Higher values could be used to simulate a drop shadow.\n float edgeSoftness = staticOptions[11];\n\n // The radius of the corners in pixels\n float radius = staticOptions[9];\n\n float tightDistance = roundedBoxSDF((current_texture_coordinate_2d - tgtCenter) , tgtDims_AR / vpAR / 2.0, 0.0);\n// float distance = roundedBoxSDF((current_texture_coordinate_2d - tgtCenter) * vpAR, tgtDims * vpAR / 2.0, 0.01);\n float distance = roundedBoxSDF((current_texture_coordinate_2d - tgtCenter) * vpDims, (tgtDims * vpDims) / 2.0, radius);\n\n // Smooth the result (free antialiasing).\n float smoothedAlpha = 1.0 - smoothstep(0.0, edgeSoftness * 2.0, distance);\n\n // Return the resultant shape.\n vec4 textureColor = texture2D(first_texture, pos);\n vec4 quadColor = vec4(textureColor.xyz, smoothedAlpha);\n\n // Apply a drop shadow effect.\n// float shadowSoftness = 0.0;\n// vec2 shadowOffset = vec2(0.0, 0.0);\n// float shadowDistance = roundedBoxSDF(pos + shadowOffset, tgtDims_AR / 2.0, radius);\n// float shadowAlpha = 1.0 - smoothstep(-shadowSoftness, shadowSoftness, shadowDistance);\n// vec4 shadowColor = vec4(0.4, 0.4, 0.4, 1.0);\n // gl_FragColor = mix(quadColor, shadowColor, shadowAlpha - smoothedAlpha);\n\n\n // pillarboxing\n if (tightDistance > 0.0 && distance <= 0.0){\n gl_FragColor = vec4(0, 0, 0, 1.0);\n } else {\n gl_FragColor = quadColor;\n }\n\n // debug\n // gl_FragColor = texture2D(first_texture, pos);\n\n}"},t,e)}static getFilterType(){return"crop"}static getInputsCount(){return 1}static getInitialOptions(){return{source:{center:{x:.5,y:.5},width:1,height:1},target:{center:{x:.5,y:.5},width:1,height:1},fitType:"fill",cornerRadius:10,edgeSoftness:0}}getOptionsDisplay(){return[]}static getUniformList(){return[xh.FIRST_TEXTURE,bh,kh]}handleStaticUniforms(e){let t={...Of.getInitialOptions(),...e};const n=Number.parseFloat(t.source.center.x).toFixed(5),i=Number.parseFloat(t.source.center.y).toFixed(5),r=Number.parseFloat(t.source.width).toFixed(5),o=Number.parseFloat(t.source.height).toFixed(5),s=Number.parseFloat(t.target.center.x).toFixed(5),a=Number.parseFloat(t.target.center.y).toFixed(5),l=Number.parseFloat(t.target.width).toFixed(5),c=Number.parseFloat(t.target.height).toFixed(5),u=Number.parseFloat(t.edgeSoftness).toFixed(5),d=t.source.aspectRatio?Number.parseFloat(t.source.aspectRatio).toFixed(5):0;let h;h="fill"===t.fitType?0:"contain"===t.fitType?1:2;const f=Number.parseFloat(t.cornerRadius).toFixed(5);this.uniforms[xh.STATIC_OPTIONS].set([n,i,r,o,s,a,l,c,h,f,d,u])}}class Pf extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Pf)};super(Pf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float staticOptions[4];\nuniform float runtimeOptions[2];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\n\nvoid main() {\n // this is the the texture from the prev shader\n vec4 texture = texture2D(first_texture, current_texture_coordinate_2d);\n vec4 color = vec4(staticOptions[0], staticOptions[1], staticOptions[2], 1.0);\n vec4 blended = mix(texture, color, staticOptions[3]);\n gl_FragColor = blended;\n}"},t,e)}static getFilterType(){return"solid"}static getInputsCount(){return 1}static getInitialOptions(){return{color:{r:.33,g:.66,b:.99,a:1}}}getOptionsDisplay(){return[{properties:["color","r"],type:"slider",minValue:0,maxValue:1,step:.001},{properties:["color","g"],type:"slider",minValue:0,maxValue:1,step:.001},{properties:["color","b"],type:"slider",minValue:0,maxValue:1,step:.001}]}handleStaticUniforms(e){var t;const n=Number.parseFloat(e.color.r).toFixed(5),i=Number.parseFloat(e.color.g).toFixed(5),r=Number.parseFloat(e.color.b).toFixed(5),o=(null!==(t=Number.parseFloat(e.color.a))&&void 0!==t?t:1).toFixed(5);this.uniforms[xh.STATIC_OPTIONS].set([n,i,r,o])}}class Rf extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Rf)};super(Rf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float runtimeOptions[1];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\n\nvoid main() {\n vec4 textureColor = texture2D(first_texture, current_texture_coordinate_2d);\n gl_FragColor = vec4(textureColor.rgb, 1.0);\n}\n"},t,e)}static getFilterType(){return"solidImage"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}}class Df extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Df)};super(Df.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_position = vec4(position_3d.xyz, 1);\n gl_Position = normalize_position;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\n\n//CIE L*a*b* (CIELAB, L* for lightness, a* from green to red, b* from blue to yellow)\n//Source: https://gist.github.com/mattatz/44f081cac87e2f7c8980 (HLSL)\nvec3 rgb2xyz(vec3 c){\n vec3 tmp=vec3(\n (c.r>.04045)?pow((c.r+.055)/1.055,2.4):c.r/12.92,\n (c.g>.04045)?pow((c.g+.055)/1.055,2.4):c.g/12.92,\n (c.b>.04045)?pow((c.b+.055)/1.055,2.4):c.b/12.92\n );\n mat3 mat=mat3(\n .4124,.3576,.1805,\n .2126,.7152,.0722,\n .0193,.1192,.9505\n );\n return 100.*(tmp*mat);\n}\nvec3 xyz2lab(vec3 c){\n vec3 n=c/vec3(95.047,100.,108.883),\n v=vec3(\n (n.x>.008856)?pow(n.x,1./3.):(7.787*n.x)+(16./116.),\n (n.y>.008856)?pow(n.y,1./3.):(7.787*n.y)+(16./116.),\n (n.z>.008856)?pow(n.z,1./3.):(7.787*n.z)+(16./116.)\n );\n return vec3((116.*v.y)-16.,500.*(v.x-v.y),200.*(v.y-v.z));\n}\nvec3 rgb2lab(vec3 c){\n vec3 lab=xyz2lab(rgb2xyz(c));\n return vec3(lab.x/100.,.5+.5*(lab.y/127.),.5+.5*(lab.z/127.));\n}\n\nvoid main() {\n vec3 inColor = texture2D(first_texture, current_texture_coordinate_2d).rgb;\n vec3 inLab = rgb2lab(inColor);\n gl_FragColor = vec4(inLab, 1.0);\n}\n"},t,e)}static getFilterType(){return"lab"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=e.temperature?e.temperature:0,n=e.tint?e.tint:0;this.uniforms[xh.STATIC_OPTIONS].set([t,n])}}class Lf extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Lf)};super(Lf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n} ",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\nuniform float staticOptions[1];\n\nvoid main() {\n float exposureStops = staticOptions[0];\n vec3 color = texture2D(first_texture, current_texture_coordinate_2d).rgb;\n \n // Convert exposure stops to multiplier: pow(2.0, stops)\n float multiplier = pow(2.0, exposureStops);\n \n // Apply exposure adjustment\n vec3 exposedColor = color * multiplier;\n \n gl_FragColor = vec4(exposedColor, 1.0);\n} "},t,e)}static getFilterType(){return"exposure"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=null===e.exposure?0:e.exposure;this.uniforms[xh.STATIC_OPTIONS].set([t])}}var Bf,zf,Wf,$f,jf,Uf,qf,Vf;function Gf(){if($f)return Wf;$f=1;const e=zf?Bf:(zf=1,Bf={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}),t={};for(const n of Object.keys(e))t[e[n]]=n;const n={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};Wf=n;for(const e of Object.keys(n)){if(!("channels"in n[e]))throw new Error("missing channels property: "+e);if(!("labels"in n[e]))throw new Error("missing channel labels property: "+e);if(n[e].labels.length!==n[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:i}=n[e];delete n[e].channels,delete n[e].labels,Object.defineProperty(n[e],"channels",{value:t}),Object.defineProperty(n[e],"labels",{value:i})}function i(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}return n.rgb.hsl=function(e){const t=e[0]/255,n=e[1]/255,i=e[2]/255,r=Math.min(t,n,i),o=Math.max(t,n,i),s=o-r;let a,l;o===r?a=0:t===o?a=(n-i)/s:n===o?a=2+(i-t)/s:i===o&&(a=4+(t-n)/s),a=Math.min(60*a,360),a<0&&(a+=360);const c=(r+o)/2;return l=o===r?0:c<=.5?s/(o+r):s/(2-o-r),[a,100*l,100*c]},n.rgb.hsv=function(e){let t,n,i,r,o;const s=e[0]/255,a=e[1]/255,l=e[2]/255,c=Math.max(s,a,l),u=c-Math.min(s,a,l),d=function(e){return(c-e)/6/u+.5};return 0===u?(r=0,o=0):(o=u/c,t=d(s),n=d(a),i=d(l),s===c?r=i-n:a===c?r=1/3+t-i:l===c&&(r=2/3+n-t),r<0?r+=1:r>1&&(r-=1)),[360*r,100*o,100*c]},n.rgb.hwb=function(e){const t=e[0],i=e[1];let r=e[2];const o=n.rgb.hsl(e)[0],s=1/255*Math.min(t,Math.min(i,r));return r=1-1/255*Math.max(t,Math.max(i,r)),[o,100*s,100*r]},n.rgb.cmyk=function(e){const t=e[0]/255,n=e[1]/255,i=e[2]/255,r=Math.min(1-t,1-n,1-i);return[100*((1-t-r)/(1-r)||0),100*((1-n-r)/(1-r)||0),100*((1-i-r)/(1-r)||0),100*r]},n.rgb.keyword=function(n){const r=t[n];if(r)return r;let o,s=1/0;for(const t of Object.keys(e)){const r=i(n,e[t]);r<s&&(s=r,o=t)}return o},n.keyword.rgb=function(t){return e[t]},n.rgb.xyz=function(e){let t=e[0]/255,n=e[1]/255,i=e[2]/255;return t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92,[100*(.4124*t+.3576*n+.1805*i),100*(.2126*t+.7152*n+.0722*i),100*(.0193*t+.1192*n+.9505*i)]},n.rgb.lab=function(e){const t=n.rgb.xyz(e);let i=t[0],r=t[1],o=t[2];return i/=95.047,r/=100,o/=108.883,i=i>.008856?i**(1/3):7.787*i+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,o=o>.008856?o**(1/3):7.787*o+16/116,[116*r-16,500*(i-r),200*(r-o)]},n.hsl.rgb=function(e){const t=e[0]/360,n=e[1]/100,i=e[2]/100;let r,o,s;if(0===n)return s=255*i,[s,s,s];r=i<.5?i*(1+n):i+n-i*n;const a=2*i-r,l=[0,0,0];for(let e=0;e<3;e++)o=t+1/3*-(e-1),o<0&&o++,o>1&&o--,s=6*o<1?a+6*(r-a)*o:2*o<1?r:3*o<2?a+(r-a)*(2/3-o)*6:a,l[e]=255*s;return l},n.hsl.hsv=function(e){const t=e[0];let n=e[1]/100,i=e[2]/100,r=n;const o=Math.max(i,.01);return i*=2,n*=i<=1?i:2-i,r*=o<=1?o:2-o,[t,100*(0===i?2*r/(o+r):2*n/(i+n)),(i+n)/2*100]},n.hsv.rgb=function(e){const t=e[0]/60,n=e[1]/100;let i=e[2]/100;const r=Math.floor(t)%6,o=t-Math.floor(t),s=255*i*(1-n),a=255*i*(1-n*o),l=255*i*(1-n*(1-o));switch(i*=255,r){case 0:return[i,l,s];case 1:return[a,i,s];case 2:return[s,i,l];case 3:return[s,a,i];case 4:return[l,s,i];case 5:return[i,s,a]}},n.hsv.hsl=function(e){const t=e[0],n=e[1]/100,i=e[2]/100,r=Math.max(i,.01);let o,s;s=(2-n)*i;const a=(2-n)*r;return o=n*r,o/=a<=1?a:2-a,o=o||0,s/=2,[t,100*o,100*s]},n.hwb.rgb=function(e){const t=e[0]/360;let n=e[1]/100,i=e[2]/100;const r=n+i;let o;r>1&&(n/=r,i/=r);const s=Math.floor(6*t),a=1-i;o=6*t-s,1&s&&(o=1-o);const l=n+o*(a-n);let c,u,d;switch(s){default:case 6:case 0:c=a,u=l,d=n;break;case 1:c=l,u=a,d=n;break;case 2:c=n,u=a,d=l;break;case 3:c=n,u=l,d=a;break;case 4:c=l,u=n,d=a;break;case 5:c=a,u=n,d=l}return[255*c,255*u,255*d]},n.cmyk.rgb=function(e){const t=e[0]/100,n=e[1]/100,i=e[2]/100,r=e[3]/100;return[255*(1-Math.min(1,t*(1-r)+r)),255*(1-Math.min(1,n*(1-r)+r)),255*(1-Math.min(1,i*(1-r)+r))]},n.xyz.rgb=function(e){const t=e[0]/100,n=e[1]/100,i=e[2]/100;let r,o,s;return r=3.2406*t+-1.5372*n+-.4986*i,o=-.9689*t+1.8758*n+.0415*i,s=.0557*t+-.204*n+1.057*i,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,r=Math.min(Math.max(0,r),1),o=Math.min(Math.max(0,o),1),s=Math.min(Math.max(0,s),1),[255*r,255*o,255*s]},n.xyz.lab=function(e){let t=e[0],n=e[1],i=e[2];return t/=95.047,n/=100,i/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,[116*n-16,500*(t-n),200*(n-i)]},n.lab.xyz=function(e){let t,n,i;n=(e[0]+16)/116,t=e[1]/500+n,i=n-e[2]/200;const r=n**3,o=t**3,s=i**3;return n=r>.008856?r:(n-16/116)/7.787,t=o>.008856?o:(t-16/116)/7.787,i=s>.008856?s:(i-16/116)/7.787,t*=95.047,n*=100,i*=108.883,[t,n,i]},n.lab.lch=function(e){const t=e[0],n=e[1],i=e[2];let r;return r=360*Math.atan2(i,n)/2/Math.PI,r<0&&(r+=360),[t,Math.sqrt(n*n+i*i),r]},n.lch.lab=function(e){const t=e[0],n=e[1],i=e[2]/360*2*Math.PI;return[t,n*Math.cos(i),n*Math.sin(i)]},n.rgb.ansi16=function(e,t=null){const[i,r,o]=e;let s=null===t?n.rgb.hsv(e)[2]:t;if(s=Math.round(s/50),0===s)return 30;let a=30+(Math.round(o/255)<<2|Math.round(r/255)<<1|Math.round(i/255));return 2===s&&(a+=60),a},n.hsv.ansi16=function(e){return n.rgb.ansi16(n.hsv.rgb(e),e[2])},n.rgb.ansi256=function(e){const t=e[0],n=e[1],i=e[2];return t===n&&n===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(i/255*5)},n.ansi16.rgb=function(e){let t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];const n=.5*(1+~~(e>50));return[(1&t)*n*255,(t>>1&1)*n*255,(t>>2&1)*n*255]},n.ansi256.rgb=function(e){if(e>=232){const t=10*(e-232)+8;return[t,t,t]}let t;return e-=16,[Math.floor(e/36)/5*255,Math.floor((t=e%36)/6)/5*255,t%6/5*255]},n.rgb.hex=function(e){const t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},n.hex.rgb=function(e){const t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let n=t[0];3===t[0].length&&(n=n.split("").map((e=>e+e)).join(""));const i=parseInt(n,16);return[i>>16&255,i>>8&255,255&i]},n.rgb.hcg=function(e){const t=e[0]/255,n=e[1]/255,i=e[2]/255,r=Math.max(Math.max(t,n),i),o=Math.min(Math.min(t,n),i),s=r-o;let a,l;return a=s<1?o/(1-s):0,l=s<=0?0:r===t?(n-i)/s%6:r===n?2+(i-t)/s:4+(t-n)/s,l/=6,l%=1,[360*l,100*s,100*a]},n.hsl.hcg=function(e){const t=e[1]/100,n=e[2]/100,i=n<.5?2*t*n:2*t*(1-n);let r=0;return i<1&&(r=(n-.5*i)/(1-i)),[e[0],100*i,100*r]},n.hsv.hcg=function(e){const t=e[1]/100,n=e[2]/100,i=t*n;let r=0;return i<1&&(r=(n-i)/(1-i)),[e[0],100*i,100*r]},n.hcg.rgb=function(e){const t=e[0]/360,n=e[1]/100,i=e[2]/100;if(0===n)return[255*i,255*i,255*i];const r=[0,0,0],o=t%1*6,s=o%1,a=1-s;let l=0;switch(Math.floor(o)){case 0:r[0]=1,r[1]=s,r[2]=0;break;case 1:r[0]=a,r[1]=1,r[2]=0;break;case 2:r[0]=0,r[1]=1,r[2]=s;break;case 3:r[0]=0,r[1]=a,r[2]=1;break;case 4:r[0]=s,r[1]=0,r[2]=1;break;default:r[0]=1,r[1]=0,r[2]=a}return l=(1-n)*i,[255*(n*r[0]+l),255*(n*r[1]+l),255*(n*r[2]+l)]},n.hcg.hsv=function(e){const t=e[1]/100,n=t+e[2]/100*(1-t);let i=0;return n>0&&(i=t/n),[e[0],100*i,100*n]},n.hcg.hsl=function(e){const t=e[1]/100,n=e[2]/100*(1-t)+.5*t;let i=0;return n>0&&n<.5?i=t/(2*n):n>=.5&&n<1&&(i=t/(2*(1-n))),[e[0],100*i,100*n]},n.hcg.hwb=function(e){const t=e[1]/100,n=t+e[2]/100*(1-t);return[e[0],100*(n-t),100*(1-n)]},n.hwb.hcg=function(e){const t=e[1]/100,n=1-e[2]/100,i=n-t;let r=0;return i<1&&(r=(n-i)/(1-i)),[e[0],100*i,100*r]},n.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},n.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},n.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},n.gray.hsl=function(e){return[0,0,e[0]]},n.gray.hsv=n.gray.hsl,n.gray.hwb=function(e){return[0,100,e[0]]},n.gray.cmyk=function(e){return[0,0,0,e[0]]},n.gray.lab=function(e){return[e[0],0,0]},n.gray.hex=function(e){const t=255&Math.round(e[0]/100*255),n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(n.length)+n},n.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]},Wf}function Hf(){if(Uf)return jf;Uf=1;const e=Gf();function t(e,t){return function(n){return t(e(n))}}function n(n,i){const r=[i[n].parent,n];let o=e[i[n].parent][n],s=i[n].parent;for(;i[s].parent;)r.unshift(i[s].parent),o=t(e[i[s].parent][s],o),s=i[s].parent;return o.conversion=r,o}return jf=function(t){const i=function(t){const n=function(){const t={},n=Object.keys(e);for(let e=n.length,i=0;i<e;i++)t[n[i]]={distance:-1,parent:null};return t}(),i=[t];for(n[t].distance=0;i.length;){const t=i.pop(),r=Object.keys(e[t]);for(let e=r.length,o=0;o<e;o++){const e=r[o],s=n[e];-1===s.distance&&(s.distance=n[t].distance+1,s.parent=t,i.unshift(e))}}return n}(t),r={},o=Object.keys(i);for(let e=o.length,t=0;t<e;t++){const e=o[t];null!==i[e].parent&&(r[e]=n(e,i))}return r}}var Kf=function(){if(Vf)return qf;Vf=1;const e=Gf(),t=Hf(),n={};return Object.keys(e).forEach((i=>{n[i]={},Object.defineProperty(n[i],"channels",{value:e[i].channels}),Object.defineProperty(n[i],"labels",{value:e[i].labels});const r=t(i);Object.keys(r).forEach((e=>{const t=r[e];n[i][e]=function(e){const t=function(...t){const n=t[0];if(null==n)return n;n.length>1&&(t=n);const i=e(t);if("object"==typeof i)for(let e=i.length,t=0;t<e;t++)i[t]=Math.round(i[t]);return i};return"conversion"in e&&(t.conversion=e.conversion),t}(t),n[i][e].raw=function(e){const t=function(...t){const n=t[0];return null==n?n:(n.length>1&&(t=n),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(t)}))})),qf=n}(),Xf=Ru(Kf);class Yf extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Yf)};super(Yf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform float staticOptions[3];\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 blend = texture2D(first_texture, current_texture_coordinate_2d);\n \n vec3 blendRGB = blend.rgb;\n vec3 baseRGB = vec3(staticOptions[0], staticOptions[1], staticOptions[2]);\n \n vec3 limit = step(0.5, blendRGB);\n vec3 mixedRGB = mix(2.0 * baseRGB * blendRGB, 1.0 - 2.0 * (1.0 - baseRGB) * (1.0 - blendRGB), limit);\n \n gl_FragColor = vec4((mixedRGB * blend.a) + ((1.0 - blend.a) * baseRGB), 1);\n}"},t,e)}static getFilterType(){return"hardLight"}static getInputsCount(){return 1}static getInitialOptions(){return{color:"4b0082"}}getOptionsDisplay(){return[{properties:["color"],type:"colorPicker"}]}handleStaticUniforms(e){const t=Xf.hex.rgb(e.color).map((e=>e/255));this.uniforms[xh.STATIC_OPTIONS].set([t[0],t[1],t[2]])}}class Qf extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Qf)};super(Qf.getFilterType(),{vertex:"precision lowp float;\n\nattribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[1];\nuniform float staticOptions[6];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float exposure_value;\n\n\nfloat getCurrentBeizerProgress(vec2 p1, vec2 p2, float t){\n vec2 p0 = vec2(0,0);\n vec2 p3 = vec2(1,1);\n \n vec2 E = mix(p0, p1, t);\n vec2 F = mix(p1, p2, t);\n vec2 G = mix(p2, p3, t);\n\n vec2 H = mix(E, F, t);\n vec2 I = mix(F, G, t);\n\n vec2 P = mix(H, I, t);\n\n return P.y;\n}\n\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n \n // transfrom logic // \n // normalized time range from 0 to 1\n float current_time = runtimeOptions[0];\n float current_power_progress = getCurrentBeizerProgress(\n vec2(staticOptions[2], staticOptions[3]),\n vec2(staticOptions[4], staticOptions[5]),\n current_time\n );\n \n current_texture_coordinate_2d = texture_coordinate_2d;\n exposure_value = mix(staticOptions[0], staticOptions[1], current_power_progress);\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float exposure_value;\n\nvoid main() {\n vec4 texture = texture2D(first_texture, current_texture_coordinate_2d);\n gl_FragColor = vec4((texture.xyz) * (1.0 + exposure_value) , texture.w);\n}\n\n"},t,e)}static getFilterType(){return"exposureTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{properties:{power:{form:0,to:0,ease:[0,0,1,1]}}}}handleStaticUniforms(e){const t=e.properties.power;this.uniforms[xh.STATIC_OPTIONS].set([t.from,t.to,...t.ease])}static getUniformList(){return[xh.FIRST_TEXTURE,wh]}}class Jf extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Jf)};super(Jf.getFilterType(),{vertex:"precision lowp float;\n\nattribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[1];\nuniform float staticOptions[6];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float dipToBlack_value;\n\n\nfloat getCurrentBeizerProgress(vec2 p1, vec2 p2, float t){\n vec2 p0 = vec2(0,0);\n vec2 p3 = vec2(1,1);\n \n vec2 E = mix(p0, p1, t);\n vec2 F = mix(p1, p2, t);\n vec2 G = mix(p2, p3, t);\n\n vec2 H = mix(E, F, t);\n vec2 I = mix(F, G, t);\n\n vec2 P = mix(H, I, t);\n\n return P.y;\n}\n\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n \n // transfrom logic // \n // normalized time range from 0 to 1\n float current_time = runtimeOptions[0];\n float current_power_progress = getCurrentBeizerProgress(\n vec2(staticOptions[2], staticOptions[3]),\n vec2(staticOptions[4], staticOptions[5]),\n current_time\n );\n \n current_texture_coordinate_2d = texture_coordinate_2d;\n dipToBlack_value = mix(staticOptions[0], staticOptions[1], current_power_progress);\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float dipToBlack_value;\n\nvoid main() {\n vec4 texture = texture2D(first_texture, current_texture_coordinate_2d);\n gl_FragColor = vec4(texture.xyz - dipToBlack_value, texture.w);\n}"},t,e)}static getFilterType(){return"dipToBlackTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{}}handleStaticUniforms(e){const t=e.properties.power;this.uniforms[xh.STATIC_OPTIONS].set([t.from,t.to,...t.ease])}static getUniformList(){return[xh.FIRST_TEXTURE,wh]}}class Zf extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Zf)};super(Zf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[1];\nuniform float staticOptions[16];\n\nvarying vec2 current_texture_coordinate_2d;\n\nfloat getCurrentBeizerProgress(vec2 p1, vec2 p2, float t){\n vec2 p0 = vec2(0,0);\n vec2 p3 = vec2(1,1);\n \n vec2 E = mix(p0, p1, t);\n vec2 F = mix(p1, p2, t);\n vec2 G = mix(p2, p3, t);\n\n vec2 H = mix(E, F, t);\n vec2 I = mix(F, G, t);\n\n vec2 P = mix(H, I, t);\n\n return P.y;\n}\n\n\nvoid main() {\n // time range from 0 to 1\n float current_time = runtimeOptions[0];\n\n // scale X\n float current_scale_x_progress = getCurrentBeizerProgress(\n vec2(staticOptions[4],staticOptions[5]),\n vec2(staticOptions[6],staticOptions[7]),\n current_time\n );\n float currnet_scale_x_value = mix(staticOptions[0], staticOptions[1], current_scale_x_progress);\n\n // scale Y\n float current_scale_y_progress = getCurrentBeizerProgress(\n vec2(staticOptions[4],staticOptions[5]),\n vec2(staticOptions[6],staticOptions[7]),\n current_time\n );\n float currnet_scale_y_value = mix(staticOptions[2], staticOptions[3], current_scale_y_progress);\n\n // translate x\n float current_translate_x_progress = getCurrentBeizerProgress(\n vec2(staticOptions[12],staticOptions[13]),\n vec2(staticOptions[14],staticOptions[15]),\n current_time\n );\n \n float currnet_translate_x_value = mix(staticOptions[8], staticOptions[9], current_translate_x_progress); \n\n // translate y\n float current_translate_y_progress = getCurrentBeizerProgress(\n vec2(staticOptions[12],staticOptions[13]),\n vec2(staticOptions[14],staticOptions[15]),\n current_time\n );\n float currnet_translate_y_value = mix(staticOptions[10], staticOptions[11], current_translate_y_progress); \n\n // See Default vertex shader, we normalize y axis to be -y\n // because of webgl texture coordinates\n currnet_translate_y_value = currnet_translate_y_value * -1.0;\n\n // create matries\n mat4 scaleMatrix;\n scaleMatrix[0] = vec4(currnet_scale_x_value, 0, 0, 0); \n scaleMatrix[1] = vec4(0, currnet_scale_y_value, 0, 0); \n scaleMatrix[2] = vec4(0, 0, 1, 0); \n scaleMatrix[3] = vec4(0, 0, 0, 1); \n\n mat4 translateMatrix;\n translateMatrix[0] = vec4(1, 0, 0, 0); \n translateMatrix[1] = vec4(0, 1, 0, 0); \n translateMatrix[2] = vec4(0, 0, 1, 0); \n translateMatrix[3] = vec4(currnet_translate_x_value, currnet_translate_y_value, 0, 1); \n\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = translateMatrix * scaleMatrix * normalize_poistion;\n // gl_Position = translateMatrix * scaleMatrix * normalize_poistion;\n \n \n current_texture_coordinate_2d = texture_coordinate_2d;\n \n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n gl_FragColor = texture2D(first_texture, current_texture_coordinate_2d);\n}"},t,e)}static getFilterType(){return"transformTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{}}handleStaticUniforms(e){const t=e.properties.scale||{},n=e.properties.translate||{};t.ease=t.ease||[0,0,1,1],n.ease=n.ease||[0,0,1,1],this.uniforms[xh.STATIC_OPTIONS].set([t.from&&t.from.x||1,t.to&&t.to.x||1,t.from&&t.from.y||1,t.to&&t.to.y||1,...t.ease,n.from&&n.from.x||0,n.to&&n.to.x||0,n.from&&n.from.y||0,n.to&&n.to.y||0,...n.ease])}static getUniformList(){return[xh.FIRST_TEXTURE,wh]}}class ep extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(ep)};super(ep.getFilterType(),{vertex:"precision lowp float;\n\nattribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float staticOptions[8];\nuniform float runtimeOptions[3];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float current_power_value;\n\nfloat getCurrentBeizerProgress(vec2 p1, vec2 p2, float t){\n vec2 p0 = vec2(0,0);\n vec2 p3 = vec2(1,1);\n \n vec2 E = mix(p0, p1, t);\n vec2 F = mix(p1, p2, t);\n vec2 G = mix(p2, p3, t);\n\n vec2 H = mix(E, F, t);\n vec2 I = mix(F, G, t);\n\n vec2 P = mix(H, I, t);\n\n return P.y;\n}\n\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n float current_time = runtimeOptions[0];\n float current_power_progress = getCurrentBeizerProgress(\n vec2(staticOptions[2],staticOptions[3]),\n vec2(staticOptions[4],staticOptions[5]),\n current_time\n );\n \n // varing\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_power_value = mix(staticOptions[0], staticOptions[1], current_power_progress);\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform float staticOptions[8];\nuniform float runtimeOptions[3];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float current_power_value;\n\nconst int samples = 12; //multiple of 2\n\nvoid main() {\n vec2 pixel = vec2(1.0/runtimeOptions[1], 1.0/runtimeOptions[2]);\n vec2 direction = vec2(staticOptions[6], staticOptions[7]);\n \n vec4 color = vec4(0.0); \n\n for (int i=1; i<=samples/2; i++) {\n vec2 motion = float(i) * current_power_value / float(samples / 2) * direction * pixel;\n \n color += texture2D(\n first_texture,\n current_texture_coordinate_2d + motion);\n\n color += texture2D(\n first_texture,\n current_texture_coordinate_2d - motion);\n }\n\t\n color = color/float(samples);\n\n \n gl_FragColor = color;\n // gl_FragColor = vec4(0,1,0,1);\n \n}"},t,e)}static getFilterType(){return"motionBlurTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{}}handleStaticUniforms(e){const t=e.properties.power||{from:0,to:0},n=e.properties.direction||{x:0,y:0};t.ease=t.ease||[0,0,1,1],this.uniforms[xh.STATIC_OPTIONS].set([t.from,t.to,...t.ease,n.x,n.y])}static getUniformList(){return[xh.FIRST_TEXTURE,wh,bh]}}class tp extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(tp)};super(tp.getFilterType(),{vertex:"precision lowp float;\n\nattribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[1];\nuniform float staticOptions[9];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float current_power_value;\n\nfloat getCurrentBeizerProgress(vec2 p1, vec2 p2, float t){\n vec2 p0 = vec2(0,0);\n vec2 p3 = vec2(1,1);\n \n vec2 E = mix(p0, p1, t);\n vec2 F = mix(p1, p2, t);\n vec2 G = mix(p2, p3, t);\n\n vec2 H = mix(E, F, t);\n vec2 I = mix(F, G, t);\n\n vec2 P = mix(H, I, t);\n\n return P.y;\n}\n\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n float current_time = runtimeOptions[0];\n float current_power_progress = getCurrentBeizerProgress(\n vec2(staticOptions[2],staticOptions[3]),\n vec2(staticOptions[4],staticOptions[5]),\n current_time\n );\n \n // varing\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_power_value = mix(staticOptions[0], staticOptions[1], current_power_progress);\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform float staticOptions[9];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float current_power_value;\n\nvoid main() {\n vec4 texture = texture2D(first_texture, current_texture_coordinate_2d);\n vec4 fadeColor = vec4(staticOptions[6], staticOptions[7], staticOptions[8], 1.0) ;\n gl_FragColor = mix(texture,fadeColor, current_power_value);\n}"},t,e)}static getFilterType(){return"fadeToColorTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{properties:{power:{form:0,to:0,ease:[0,0,1,1]},color:"#FFFFFF"}}}handleStaticUniforms(e){const t=e.properties.power||{from:0,to:0};t.ease=t.ease||[0,0,1,1];const n=e.properties.color,i=Xf.hex.rgb(n).map((e=>e/255));this.uniforms[xh.STATIC_OPTIONS].set([t.from,t.to,...t.ease,i[0],i[1],i[2]])}static getUniformList(){return[xh.FIRST_TEXTURE,wh]}}var np=Object.freeze({__proto__:null,Crop:Of,Curves:Tf,Default:class e extends Nh{constructor(t){const n={uniforms:Nh.getUniformInfo(e)};super(e.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n // we need to flip y poisiton bacause webgl display the canvas\n // with 0,0 being the bottom left corner \n // insted of the traditional top left\n float flip_y_position = position_3d.y * (-1.0);\n vec4 normalize_poistion = vec4(position_3d.x, flip_y_position, position_3d.z, 1);\n \n gl_Position = normalize_poistion;\n \n current_texture_coordinate_2d = texture_coordinate_2d;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n gl_FragColor = texture2D(first_texture, current_texture_coordinate_2d);\n}"},n,t)}static getFilterType(){return"__default"}static getInputsCount(){return 1}static getInitialOptions(){return{}}},DipToBlackTransition:Jf,DirectionalBlur:Bh,Exposure:Lf,ExposureTransition:Qf,FadeToColorTransition:tp,FastBlur:Lh,HardLight:Yf,HorizontalBlur:Rh,Hue:Nf,Lab:Df,Levels:Ef,Lut:jh,MotionBlurTransition:ep,Opacity:zh,Saturation:Cf,ShapeComposite:$h,ShapeCompositeMask:Wh,Solid:Pf,SolidImage:Rf,Transform:class e extends Nh{constructor(t){const n={uniforms:Nh.getUniformInfo(e)};super(e.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform mat4 first_mat4;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xy, 1, 1);\n\n gl_Position = first_mat4 * normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n gl_FragColor = texture2D(first_texture, current_texture_coordinate_2d);\n // gl_FragColor = vec4(256,0,0,1);\n}"},n,t)}static getFilterType(){return"transform"}static getInputsCount(){return 1}static getInitialOptions(){return{translate:{x:0,y:0},scale:{x:1,y:1},rotate:0}}getOptionsDisplay(){return[{properties:["translate","x"],type:"slider",minValue:-2,maxValue:2,step:.001,initialValue:e.getInitialOptions().translate.x},{properties:["translate","y"],type:"slider",minValue:-2,maxValue:2,step:.001,initialValue:e.getInitialOptions().translate.y},{properties:["scale","x"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:e.getInitialOptions().scale.x},{properties:["scale","y"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:e.getInitialOptions().scale.y},{properties:["rotate"],type:"slider",minValue:-360,maxValue:360,step:1,initialValue:e.getInitialOptions().rotate}]}static getUniformList(){return[xh.FIRST_TEXTURE,xh.FIRST_MATRIX]}handleStaticUniforms(e){if(!e||!e.translate||!e.scale)throw new Error(`bad options object for Transform filter, check ${e}`);const t=Number.parseFloat(e.translate.x).toFixed(7),n=-1*Number.parseFloat(e.translate.y).toFixed(7),i=Number.parseFloat(e.scale.x).toFixed(7),r=Number.parseFloat(e.scale.y).toFixed(7),o=e.rotate||0;var s;this.transformMatrix=function(e,t,n,i){var r=t[0],o=t[1],s=t[2],a=t[3],l=r+r,c=o+o,u=s+s,d=r*l,h=r*c,f=r*u,p=o*c,m=o*u,v=s*u,g=a*l,y=a*c,b=a*u,k=i[0],w=i[1],x=i[2];return e[0]=(1-(p+v))*k,e[1]=(h+b)*k,e[2]=(f-y)*k,e[3]=0,e[4]=(h-b)*w,e[5]=(1-(d+v))*w,e[6]=(m+g)*w,e[7]=0,e[8]=(f+y)*x,e[9]=(m-g)*x,e[10]=(1-(d+p))*x,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}((s=new Fh(16),Fh!=Float32Array&&(s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[11]=0,s[12]=0,s[13]=0,s[14]=0),s[0]=1,s[5]=1,s[10]=1,s[15]=1,s),function(e,t,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"zyx",o=Math.PI/360;t*=o,i*=o,n*=o;var s=Math.sin(t),a=Math.cos(t),l=Math.sin(n),c=Math.cos(n),u=Math.sin(i),d=Math.cos(i);switch(r){case"xyz":e[0]=s*c*d+a*l*u,e[1]=a*l*d-s*c*u,e[2]=a*c*u+s*l*d,e[3]=a*c*d-s*l*u;break;case"xzy":e[0]=s*c*d-a*l*u,e[1]=a*l*d-s*c*u,e[2]=a*c*u+s*l*d,e[3]=a*c*d+s*l*u;break;case"yxz":e[0]=s*c*d+a*l*u,e[1]=a*l*d-s*c*u,e[2]=a*c*u-s*l*d,e[3]=a*c*d+s*l*u;break;case"yzx":e[0]=s*c*d+a*l*u,e[1]=a*l*d+s*c*u,e[2]=a*c*u-s*l*d,e[3]=a*c*d-s*l*u;break;case"zxy":e[0]=s*c*d-a*l*u,e[1]=a*l*d+s*c*u,e[2]=a*c*u+s*l*d,e[3]=a*c*d-s*l*u;break;case"zyx":e[0]=s*c*d-a*l*u,e[1]=a*l*d+s*c*u,e[2]=a*c*u-s*l*d,e[3]=a*c*d+s*l*u;break;default:throw new Error("Unknown angle order "+r)}return e}(Ph(),0,0,o),Oh(t,n,0),Oh(i,r,1)),this.uniforms[xh.FIRST_MATRIX].set(this.transformMatrix)}},TransformTransition:Zf,VerticalBlur:Dh,Vibrance:Ff,WhiteBalance:Mf});const ip=Object.values(np).reduce(((e,t)=>(e[t.getFilterType()]=t,e)),{});class rp{constructor(e){this.context=e}static getFilterClass(e){return ip[e]}getFilterIds(){return Object.keys(this.filterTypeToInstanceMap)}create(e,t){this.context={...this.context,options:t.options};const n=new ip[e](this.context);if(!n)throw new Error(`${e} is not a atom filter, atomFilter list: `,this.getFilterIds());return n}}const op=wd.PREVIOUS_OUTPUT_PREFIX,sp=Object.values(np).reduce(((e,t)=>(e[t.getFilterType()]={type:t.getFilterType(),options:t.getInitialOptions(),inputs:[...Array(t.getInputsCount())].map(((e,t)=>`${op}${t}`)),outputs:[]},e)),{});var ap,lp,cp=function(){if(lp)return ap;lp=1;var e=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&(n=e,!("[object RegExp]"===(i=Object.prototype.toString.call(n))||"[object Date]"===i||n.$$typeof===t));var n,i},t="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(e,t){return!1!==t.clone&&t.isMergeableObject(e)?s((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function i(e,t,i){return e.concat(t).map((function(e){return n(e,i)}))}function r(e){return Object.keys(e).concat((t=e,Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter((function(e){return Object.propertyIsEnumerable.call(t,e)})):[]));var t}function o(e,t){try{return t in e}catch(e){return!1}}function s(t,a,l){(l=l||{}).arrayMerge=l.arrayMerge||i,l.isMergeableObject=l.isMergeableObject||e,l.cloneUnlessOtherwiseSpecified=n;var c=Array.isArray(a);return c===Array.isArray(t)?c?l.arrayMerge(t,a,l):function(e,t,i){var a={};return i.isMergeableObject(e)&&r(e).forEach((function(t){a[t]=n(e[t],i)})),r(t).forEach((function(r){var l,c;o(l=e,c=r)&&(!Object.hasOwnProperty.call(l,c)||!Object.propertyIsEnumerable.call(l,c))||(o(e,r)&&i.isMergeableObject(t[r])?a[r]=function(e,t){if(!t.customMerge)return s;var n=t.customMerge(e);return"function"==typeof n?n:s}(r,i)(e[r],t[r],i):a[r]=n(t[r],i))})),a}(t,a,l):n(a,l)}return s.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return s(e,n,t)}),{})},ap=s}(),up=Ru(cp),dp=function(e,t){return up(e,t,{arrayMerge:(e,t)=>t})};const hp=wd.MESSAGES.UPDATE_OPTIONS;let fp=class{constructor(e,t){this.eventEmitter=new Ed,this.type=e,this.inputs=t.inputs,this.outputs=t.outputs,this.options=t.options}render(){throw new Error("concrete class should implement")}_updateOptions(){throw new Error("concrete class should implement")}updateOptions(e){this._updateOptions(e),this.eventEmitter.emit(hp,this.options)}updateInputs(e){e&&(this.inputs.length===e.length&&this.inputs.every(((t,n)=>t===e[n]))||(this.inputs=[...e]))}getEventEmitter(){return this.eventEmitter}getType(){return this.type}getInputs(){return this.inputs}getOutputs(){return this.outputs}getOptions(){return this.options}getInfo(){return{inputs:this.inputs,outputs:this.outputs,options:this.options}}getOptionsDisplay(){return this.filter.getOptionsDisplay()}dispose(){throw new Error("concrete class should implement")}};class pp extends fp{constructor(e,t,n){super(...arguments),this.filter=n.filterFactory.create(this.type,{options:this.options})}render(e){const t=e.ioStore,n=e.graphIOManager,i=this.getInputs(),r=this.getOutputs(),o=t.get(i),s=this.filter.render(o,this.options);return n.setOutputs(t,r,s),s}_updateOptions(e){this.options=dp(this.options,e),this.filter.updateStaticUniforms(this.options)}dispose(){this.filter.dispose()}}const mp=wd.MESSAGES.UPDATE_OPTIONS;let vp=class extends pp{constructor(e,t,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}baseNodeUpdateOptions(e){this.options=dp(this.options,e),this.filter.updateStaticUniforms(this.options)}registerListeners(){this.baseNode.getEventEmitter().on(mp,this.baseNodeUpdateOptions,this)}dispose(){this.filter.dispose(),this.baseNode.getEventEmitter().off(mp,this.baseNodeUpdateOptions,this)}};function gp(e){return null!==e&&"object"==typeof e}function yp(e){if(!gp(e)||(t=e,Array.isArray(t)))return e;var t;const n=Object.keys(e).sort(),i={};return n.forEach((t=>{i[t]=yp(e[t])})),i}function bp(e,t){return null!=e&&e.id&&null!=t&&t.id?e.type===t.type&&e.id===t.id:e.type===t.type}function kp(e,t){const n=[];e.forEach(((e,i)=>{const r=(o=e,t.findIndex((e=>function(e,t){const n=JSON.parse(JSON.stringify(e));return r=JSON.parse(JSON.stringify(t)),gp(i=n)&&gp(r)?JSON.stringify(yp(i))===JSON.stringify(yp(r)):!(!Number.isNaN(i)||!Number.isNaN(r))||i===r;var i,r}(o,e))));var o;if(-1!==r)return void n.push({type:"take",index:r});const s=(a=e,l=i,(c=t)&&c[l]&&bp(a,c[l])?l:c.findIndex((e=>bp(a,e))));var a,l,c;-1===s?n.push({type:"create",newGraphIndex:i}):n.push({type:"update",currentGraphIndex:s,newGraphIndex:i})}));const i=n.reduce(((e,t)=>("take"===t.type?e.push(t.index):"update"===t.type&&e.push(t.currentGraphIndex),e)),[]);return t.reduce(((e,t,n)=>(i.includes(n)||e.push(n),e)),[]).forEach((e=>{n.push({type:"dispose",currentGraphIndex:e})})),n}function wp(e,t,n,i){const r=[];return e.forEach((e=>{switch(e.type){case"take":r.push(n[e.index]);break;case"update":const o=t[e.newGraphIndex].options,s=n[e.currentGraphIndex];s.updateInputs(t[e.newGraphIndex].inputs),s.updateOptions(o),r.push(s);break;case"create":const a=Op.create(t[e.newGraphIndex],i);r.push(a);break;case"dispose":n[e.currentGraphIndex].dispose();break;default:throw new Error("cant apply action type: ",e.type)}})),r}var xp=function(e,t,n,i){const r=e.graph,o=t.graph;if(!(o&&r&&Array.isArray(o)&&Array.isArray(r)))throw new Error("cant apply new composite options",e);return wp(kp(r,o),r,n,i)};class _p extends fp{constructor(e,t,n){super(...arguments),this.context=n,this.nodes=this.createNodes(this.options)}createNodes(e){if(!e||!e.graph)throw new Error("cant create composite node, please supply info.options.graph");return e.graph.map((e=>Op.create(e,this.context)))}render(e){const t=e.ioStore,n=e.graphIOManager;let i=n.getPrevOutput(t);const r=this.outputs;if(this.nodes.length){const e=new Cd(t),r=[];this.nodes.forEach(((t,o)=>{const s={ioStore:e,graphIOManager:n};i=t.render(s),o!==this.nodes.length-1&&r.push(i)})),n.disposeTextures(r,i)}return n.setOutputs(t,r,i),i}getOptionsDisplay(){return[]}_updateOptions(e){this.nodes=xp(e,this.options,this.nodes,this.context),this.options=e}dispose(){this.nodes.forEach((e=>{e.dispose()}))}}const Tp=wd.MESSAGES.UPDATE_OPTIONS;class Ip extends _p{constructor(e,t,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}registerListeners(){this.baseNode.getEventEmitter().on(Tp,this.updateOptions,this)}dispose(){this.nodes.forEach((e=>{e.dispose()})),this.baseNode.getEventEmitter().off(Tp,this.updateOptions,this)}}const Ep=wd.SYSTEM_NODES.TAGS.ATOM,Sp=wd.SYSTEM_NODES.TAGS.FILTER,Ap=wd.SYSTEM_NODES.TAGS.COMPOSITE_FILTER,Np=wd.SYSTEM_NODES.TAGS.TRANSITION_FILTER,Mp=wd.PREVIOUS_OUTPUT_PREFIX,Fp=Object.keys(sp);function Cp(e,t){const n=(i=e.type,sp[i]);var i;return e=dp(n,e),new pp(e.type,e,t)}var Op={create:function(e,t){let n;switch(function(e){let t;return n=e,t=Fp.includes(n)?Ep:e===Ap?Ap:e===Np?Np:Sp,t;var n}((e=JSON.parse(JSON.stringify(e))).type)){case Ep:n=Cp(e,t);break;case Sp:n=function(e,t){const n=function(e,t){const n=t.get(e);if(!n)throw new Error(`no base node, cant resolve type: ${e}`);return n}(e.type,t.nodeStore),i=n.getType(),r=n.getInfo();let o;return e=dp(r,e),t={...t,baseNode:n},o=i===Ap?new Ip(i,e,t):new vp(i,e,t),o}(e,t);break;case Ap:n=function(e,t){const n=e.type;return e=dp({inputs:[`${Mp}0`]},e),new _p(n,e,t)}(e,t);break;case Np:n=function(e,t){const n=e.options.filter;if(!n)throw new Error(`transition filter should supply base filter ${n}`);return e.type=`${n}Transition`,Cp(e,t)}(e,t);break;default:throw new Error("cant create node",e.type)}return n}};const Pp=wd.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS;var Rp=function(e){const t={[Pp]:sp[Pp]};for(const[n,i]of Object.entries(t)){const t=Op.create(i,e);e.nodeStore.set(n,t)}},Dp=function(e,t){for(const[n,i]of Object.entries(e)){const e=Op.create(i,t);t.nodeStore.set(n,e)}};const Lp=wd.CAPTURED_FRAME_PREFIX;class Bp{constructor(e){return this.textureManager=e.textureManager,this.currentFrameTextures={0:this.textureManager.createTexture({type:"frame"})},this.saveInNextFrameTextures=[],this.savedFramesTextures={},this.reservedUnits=new Set([this.currentFrameTextures[0].getUnit()]),{capture:this.capture.bind(this),createCaptureId:this.createCaptureId.bind(this),releaseCaptureId:this.releaseCaptureId.bind(this),getCurrentFrames:this.getCurrentFrames.bind(this),getSavedFrames:this.getSavedFrames.bind(this),isReservedUnit:this.isReservedUnit.bind(this)}}updateCurrentFrame(e,t){t=t||0,this.currentFrameTextures[t].fill(e)}saveFrame(e){0!==this.saveInNextFrameTextures.length&&(this.saveInNextFrameTextures.forEach((t=>{t.fill(e)})),this.saveInNextFrameTextures=[])}capture(e,t){(e.videoHeight>150||e.displayHeight>150)&&(this.updateCurrentFrame(e,t),this.saveFrame(e))}createCaptureId(){const e=this.textureManager.createTexture({type:"frame"});this.saveInNextFrameTextures.push(e);const t=e.getUnit(),n=`${Lp}${t}`;return this.savedFramesTextures[n]=e,this.reservedUnits.add(t),n}releaseCaptureId(e){if("string"!=typeof e)throw new Error("capture id should be string");delete this.saveInNextFrameTextures[e];const t=e.split(":")[1];this.reservedUnits.delete(parseInt(t,10))}getCurrentFrames(){return this.currentFrameTextures}getSavedFrames(){return this.savedFramesTextures}isReservedUnit(e){return this.reservedUnits.has(e)}}const zp=Ju("ShaderGraphApplication","warn"),Wp=wd.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS,$p=Object.freeze({useCanvasSizedFilterTargets:!1,rebindAttributesOnProgramSwitch:!0,forwardContextAttributes:!0});function jp(e={}){const t=null==e?void 0:e.performanceToggles;return t&&"object"==typeof t?{...$p,...t}:{...$p}}class Up{constructor(e,t={}){return this.glSource=e,this.config=t,this.performanceToggles=jp(t),this.isContextLost=!1,this.isRecovering=!1,this.isDisposed=!1,this.pendingNodeOptionUpdates=new Map,this.doInit(e,t)}doInit(e,t){this.source=Md(e),this.performanceToggles=jp(t),this.isDisposed=!1,this.render=this.render.bind(this),this.resizeCanvasSize=this.resizeCanvasSize.bind(this),this.setSrcVidTracks=this.setSrcVidTracks.bind(this),this.onWebGLContextLost=this.onWebGLContextLost.bind(this),this.onForceRender=this.onForceRender.bind(this),this.resizeCanvasSize._shouldPreventDefault=!0;const n=function(e={},t=$p){const n=null!=e&&e.glOptions&&"object"==typeof e.glOptions?{...e.glOptions}:{},i=n.__shaderGraph&&"object"==typeof n.__shaderGraph?n.__shaderGraph:{};return{...n,__shaderGraph:{...i,forwardContextAttributes:!1!==t.forwardContextAttributes}}}(t,this.performanceToggles);return this.gl=this.source.init(this.setSrcVidTracks,this.resizeCanvasSize,n),this.addCanvasListeners(),this.addSourceListeners(),"undefined"!=typeof window&&(window.ekoShaderGraph=this),this.selectedRenderNode=null,this.activeTextures=this.activeTextures||new Set,this.textureManager=new Wd({gl:this.gl,activeTextures:this.activeTextures}),this.capturedFramesManager=new Bp({textureManager:this.textureManager}),this.graphIOManager=new Kd({glSource:e,gl:this.gl,textureManager:this.textureManager,capturedFramesManager:this.capturedFramesManager}),this.frameBufferFactory=new th({gl:this.gl,textureManager:this.textureManager,useCanvasSizedFilterTargets:this.performanceToggles.useCanvasSizedFilterTargets}),this.filterFactory=new rp({gl:this.gl,frameBufferFactory:this.frameBufferFactory,rebindAttributesOnProgramSwitch:this.performanceToggles.rebindAttributesOnProgramSwitch}),this.nodeStore=new Cd,this.ioStore=new Cd,Rp({nodeStore:this.nodeStore,filterFactory:this.filterFactory}),this.addClientNodes(t.nodes,this.isRecovering),t.userWillCallRender||(this.rafId=requestAnimationFrame(this.render)),this.dirtyCanvasSize=!0,{getNodes:this.getNodes.bind(this),addNodes:this.addClientNodes.bind(this),selectNode:this.selectNode.bind(this),addTexture:this.addTexture.bind(this),releaseTexture:this.releaseTexture.bind(this),captureTexture:this.captureTexture.bind(this),disposeTexture:this.disposeTexture.bind(this),updateOptions:this.updateOptions.bind(this),render:this.render,dispose:this.dispose.bind(this)}}getNodes(){return zp.debug("[getNodes]"),this.nodeStore.get()}addClientNodes(e,t=!1){if(zp.debug("[addClientNodes]",e),e&&!t&&(this.addClientNodeInvocations=this.addClientNodeInvocations||[],this.addClientNodeInvocations.push(e)),!t&&this.isContextUnavailable())return;e=e||{};const n=JSON.parse(JSON.stringify(e));Dp(n,{nodeStore:this.nodeStore,filterFactory:this.filterFactory})}addTexture(e,t,n){if(zp.debug("[addTexture]",e,t,n),this.isContextUnavailable())return null;let i=this.textureManager.createTexture({type:t});return i.isStatic=!0,e&&i.fill(e),this.graphIOManager.setTextureSource(this.ioStore,i,n),i}releaseTexture(e){zp.debug("[releaseTexture]",e),this.isContextUnavailable()||this.textureManager.releaseTexture(e)}selectNode(e){if(zp.debug("[selectNode]",e),!this.isContextUnavailable())return this.nodeStore.get(e)||zp.warn("Missing render node",e),void(this.selectedRenderNodeId=e);this.selectedRenderNodeId=e}captureTexture(){return zp.debug("[captureTexture]"),this.isContextUnavailable()?null:this.capturedFramesManager.createCaptureId()}disposeTexture(e){return zp.debug("[disposeTexture]",e),this.isContextUnavailable()||"string"!=typeof e?null:this.capturedFramesManager.releaseCaptureId(e)}setSrcVidTracks(e){this.isContextUnavailable()||this.capturedFramesManager&&this.capturedFramesManager.capture(e)}resizeCanvasSize(e,t,n,i){this.dirtyCanvasSize={width:n,height:i}}isContextUnavailable(){return!!this.isDisposed||!(!this.isRecovering&&!this.isContextLost)||!(!this.gl||"function"!=typeof this.gl.isContextLost)&&this.gl.isContextLost()}queueNodeOptionUpdate(e,t){e&&t&&"object"==typeof t&&(this.pendingNodeOptionUpdates||(this.pendingNodeOptionUpdates=new Map),this.pendingNodeOptionUpdates.set(e,t))}applyPendingNodeOptionUpdates(e=!1){if(!this.pendingNodeOptionUpdates||!this.pendingNodeOptionUpdates.size)return;const t=Array.from(this.pendingNodeOptionUpdates.entries());this.pendingNodeOptionUpdates.clear(),t.forEach((([t,n])=>{try{if(e){const e=this.nodeStore.get(t);if(!e||"function"!=typeof e.updateOptions)return void this.queueNodeOptionUpdate(t,n);try{e.updateOptions(n)}catch(e){zp.error("Failed to apply pending node options",t,e),this.queueNodeOptionUpdate(t,n)}return}this.updateOptions(t,n)}catch(e){zp.error("Failed to apply pending node options",t,e)}}))}render(e={}){var t,n;const{noRaf:i=!1}=e;if(this.isContextUnavailable())return;if(this.dirtyCanvasSize){let{width:e=this.gl.canvas.width,height:t=this.gl.canvas.height}=this.dirtyCanvasSize;Jd(e,t),this.gl.canvas.width=e,this.gl.canvas.height=t,this.textureManager.refreshTextureObjects(),this.gl.viewport(0,0,e,t),this.dirtyCanvasSize=!1}const r=null===(t=this.gl)||void 0===t||null===(t=t.canvas)||void 0===t?void 0:t.width,o=null===(n=this.gl)||void 0===n||null===(n=n.canvas)||void 0===n?void 0:n.height;Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0&&(Jd(r,o),this.gl.viewport(0,0,r,o)),this.graphIOManager.setVideoSources(this.ioStore);let s={ioStore:this.ioStore,graphIOManager:this.graphIOManager};this.renderSelectedNode(s),this.config.onPreRenderToScreen&&this.config.onPreRenderToScreen(),this.renderToCanvas(s),this.config.onPostRenderToScreen&&this.config.onPostRenderToScreen(),this.graphIOManager.disposeAllStore(this.ioStore),s=null,!i&&!this.config.userWillCallRender&&(this.rafId=requestAnimationFrame(this.render))}renderSelectedNode(e){if(!this.selectedRenderNodeId)return;const t=this.nodeStore.get(this.selectedRenderNodeId);t&&"function"==typeof t.render?t.render(e):(zp.warn("Missing selected render node",this.selectedRenderNodeId),this.selectedRenderNodeId=null)}renderToCanvas(e){const t=this.nodeStore.get(Wp);t&&"function"==typeof t.render?t.render(e):zp.warn("Missing render-to-canvas node")}updateOptions(e,t){if(zp.debug("[updateOptions]",e,t),this.isContextUnavailable())return void this.queueNodeOptionUpdate(e,t);const n=this.nodeStore.get(e);if(n&&"function"==typeof n.updateOptions)try{n.updateOptions(t)}catch(n){zp.error("Failed to update node options",e,n),this.queueNodeOptionUpdate(e,t)}else this.queueNodeOptionUpdate(e,t)}addSourceListeners(){var e;"function"==typeof(null===(e=this.source)||void 0===e?void 0:e.on)&&this.source.on("forcerender",this.onForceRender)}removeSourceListeners(){var e;"function"==typeof(null===(e=this.source)||void 0===e?void 0:e.off)&&this.source.off("forcerender",this.onForceRender)}addCanvasListeners(){var e;(null==this||null===(e=this.gl)||void 0===e?void 0:e.canvas)&&(this.config.noWebGLContextLostRecovery||this.gl.canvas.addEventListener("webglcontextlost",this.onWebGLContextLost))}removeCanvasListeners(){var e;(null==this||null===(e=this.gl)||void 0===e?void 0:e.canvas)&&this.gl.canvas.removeEventListener("webglcontextlost",this.onWebGLContextLost)}getNodesOptions(){const e=this.getNodes();let t={};return Object.keys(e).filter((e=>"__default"!==e)).forEach((n=>{t[n]=e[n].options})),t}getDocumentVisibilityPromise(){return new Promise((e=>{"visible"===document.visibilityState&&e();const t=()=>{"visible"===document.visibilityState&&(document.removeEventListener("visibilitychange",t),e())};document.addEventListener("visibilitychange",t)}))}onForceRender(){zp.info("[onForceRender]"),this.render({noRaf:!0})}async onWebGLContextLost(e){if(e&&"function"==typeof e.preventDefault&&e.preventDefault(),this.isDisposed||this.isRecovering)return;this.isContextLost=!0,this.isRecovering=!0;const t=this.getNodesOptions(),n=this.addClientNodeInvocations,i=this.selectedRenderNodeId;cancelAnimationFrame(this.rafId),zp.warn("WebGL context lost - attempting to recover");const r=async()=>{if(this.isDisposed)this.isRecovering=!1;else try{var e;if(await this.getDocumentVisibilityPromise(),this.isDisposed)return void(this.isRecovering=!1);if(this.gl&&"function"==typeof this.gl.isContextLost&&this.gl.isContextLost())return void setTimeout(r,200);this.dispose(!1),this.doInit(this.glSource,this.config),this.textureManager&&"function"==typeof this.textureManager.refreshActiveTextures&&this.textureManager.refreshActiveTextures(),n&&n.length&&n.forEach((e=>{zp.debug("Re-adding client nodes",e),this.addClientNodes(e,!0)})),Object.entries(t).forEach((([e,t])=>{zp.debug("Re-applying node options",e,t);const n=this.nodeStore.get(e);n&&"function"==typeof n.updateOptions&&n.updateOptions(t)})),i&&(this.selectedRenderNodeId=i),this.applyPendingNodeOptionUpdates(!0);const o="function"==typeof(null===(e=this.source)||void 0===e?void 0:e.recover);o&&(zp.debug("Recovering glSource (i.e. seeking/resetting player)"),await this.source.recover()),this.isContextLost=!1,this.isRecovering=!1,o&&this.render()}catch(e){zp.error("Failed to recover WebGL context, retrying",e),setTimeout(r,200)}};await r()}dispose(e=!0){if(this.selectedRenderNode=null,e&&(this.isDisposed=!0,this.isRecovering=!1,this.isContextLost=!1),this.source&&(this.removeSourceListeners(),"function"==typeof this.source.dispose&&this.source.dispose()),this.gl){this.removeCanvasListeners();const t=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS);for(let e=0;e<t;++e)this.gl.activeTexture(this.gl.TEXTURE0+e),this.gl.bindTexture(this.gl.TEXTURE_2D,null),this.gl.bindTexture(this.gl.TEXTURE_CUBE_MAP,null);if(this.gl.bindBuffer(this.gl.ARRAY_BUFFER,null),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,null),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null),this.gl.bindTexture(this.gl.TEXTURE_2D,null),this.gl.bindRenderbuffer(this.gl.RENDERBUFFER,null),e)try{this.gl.getExtension("WEBGL_lose_context").loseContext()}catch(e){console.error(e)}}this.selectedRenderNodeId=null,e&&delete this.addClientNodeInvocations}}class qp{constructor(e={}){this.options=e}get type(){return"stage"}getSignature(){return this.type}build({inputs:e=[]}={}){return{graph:[],outputs:e,signature:this.getSignature()}}}function Vp(e={}){const t={source:{center:{x:.5,y:.5},width:1,height:1},target:{center:{x:.5,y:.5},width:1,height:1},fitType:"fill",cornerRadius:0,edgeSoftness:0},n={...t.source,...e.source||{}},i={...t.target,...e.target||{}};return{...t,...e,source:n,target:i}}class Gp extends qp{get type(){return"retarget"}getSignature(){var e;const t=Array.isArray(null===(e=this.options)||void 0===e?void 0:e.frames)?this.options.frames:[];return`${this.type}:${t.length}`}build({inputs:e=[],stageIndex:t=0}={}){var n;const i=Array.isArray(null===(n=this.options)||void 0===n?void 0:n.frames)?this.options.frames:[];if(!i.length)return{graph:[],outputs:e,signature:this.getSignature()};const r=[],o=[];for(let n=0;n<e.length;n+=1){const s=e[n],a=i[n];if(!a){o.push(s);continue}const l=`retarget-${t}-${n}`;r.push({id:l,type:"crop",inputs:[s],outputs:[l],options:Vp(a)}),o.push(l)}return{graph:r,outputs:o,signature:this.getSignature()}}}class Hp{#A=new Map;constructor(){this.register("retarget",Gp)}register(e,t){e&&"function"==typeof t&&this.#A.set(e,t)}create(e={}){const t="string"==typeof(null==e?void 0:e.type)?e.type:null;if(!t)return null;const n=this.#A.get(t);return n?new n((null==e?void 0:e.options)||{}):null}}class Kp{constructor(e={}){this.params=e}static get panAndScanTarget(){return"pre"}static buildDefaultLayoutGraph(e=[]){const t=e[0]||"__SRC_TEXTURE:0";return{type:"default",signature:`default:${e.length}`,isDynamic:!1,graph:[{type:"opacity",inputs:[t],options:{power:1}}]}}static prepareRenderFrames({frames:e}={}){return Array.isArray(e)?e:[]}static getRenderTiming({timing:e}={}){return e&&"object"==typeof e?e:{}}static resetRenderState(e){}render(e){}}class Xp extends Kp{#N=null;#M=null;static get type(){return"default"}static get aliases(){return["DefaultRenderNode","default"]}static get requiresFrameCadence(){return!1}static buildLayoutGraph({inputs:e=[]}={}){return super.buildDefaultLayoutGraph(e)}static prepareRenderFrames({frames:e}={}){const t=Array.isArray(e)?e:[];if(t.length<=1)return t;const n=t[t.length-1];return n?[n]:t}render(e){var t;const n=(null==e||null===(t=e.visualFramesAvailable)||void 0===t?void 0:t.frames)||[];if(!n.length)return;const i=null==e?void 0:e.shaderGraph,r=null==e?void 0:e.shaderGraphNodeIds;if(!i||"function"!=typeof i.updateOptions||"function"!=typeof i.selectNode)return;const o=null==r?void 0:r.default;if(o)try{const e=n.map(((e,t)=>e?`__SRC_TEXTURE:${t}`:null)).filter(Boolean),t=Xp.buildLayoutGraph({inputs:e}),r=t.signature;this.#N!==r&&(i.updateOptions(o,{graph:t.graph}),this.#N=r),this.#M!==o&&(i.selectNode(o),this.#M=o),i.render({noRaf:!0})}catch(e){}}}var Yp=new WeakMap,Qp=new WeakMap,Jp=new WeakSet;class Zp extends Kp{constructor(...e){super(...e),O(this,Jp),F(this,Yp,null),F(this,Qp,null)}static get type(){return"side-by-side"}static get aliases(){return["SideBySideRenderNode","side-by-side","sidebyside"]}static get requiresFrameCadence(){return!1}static get panAndScanTarget(){return"skip"}static buildLayoutGraph({inputs:e=[]}={}){const t=e.length;if(t<=1)return super.buildDefaultLayoutGraph(e);const n=1/t,i=[],r=e.map(((e,t)=>{const r=(t+.5)*n,o=`slice-${t}`;return i.push({id:`side-by-side-crop-${t}`,type:"crop",inputs:[e],outputs:[o],options:{source:{center:{x:.5,y:.5},width:1,height:1},target:{center:{x:r,y:.5},width:n,height:1},fitType:"fill",cornerRadius:0,edgeSoftness:0}}),o}));let o=r[0];for(let e=1;e<t;e+=1){const t=(e+.5)*n*2-1;i.push({id:`side-by-side-mask-${e}`,type:"shapeCompositeMask",inputs:[r[e],o],outputs:["accum"],options:{type:"box",center:{x:t,y:0},area:{width:n,height:1},radius:0,edgeSoftness:0}}),o="accum"}return{type:Zp.type,signature:`${Zp.type}:${e.length}`,isDynamic:!1,graph:i}}static prepareRenderFrames({frames:e,state:t}={}){const n=Array.isArray(e)?e:[],i=t&&"object"==typeof t?t:{},r=Array.isArray(i.frames)?i.frames:[];if(!n.length&&!r.length)return i.frames=[],i!==t&&t&&"object"==typeof t&&Object.assign(t,i),[];const o=Math.max(n.length,r.length,2),s=Array.from({length:o}),a=n[0]||r[0];for(let e=0;e<o;e+=1)s[e]=n[e]||r[e]||a;return i.frames=s,i!==t&&t&&"object"==typeof t&&Object.assign(t,i),s}static resetRenderState(e){e&&"object"==typeof e&&(e.frames=null)}render(e){var t;const n=(null==e||null===(t=e.visualFramesAvailable)||void 0===t?void 0:t.frames)||[];if(!n.length)return;const i=null==e?void 0:e.shaderGraph,r=null==e?void 0:e.shaderGraphNodeIds;if(!i||"function"!=typeof i.updateOptions||"function"!=typeof i.selectNode)return;const o=null==r?void 0:r.sideBySide;if(o){if(1===n.length){const e=null==r?void 0:r.default;try{A(Jp,this,em).call(this,i,e)}catch(e){}return}try{A(Jp,this,tm).call(this,i,o,n)}catch(e){}}}}function em(e,t){if(!t)return;const n=ot.buildLayoutGraph({inputs:["__SRC_TEXTURE:0"]}),i=n.signature;M(Yp,this)!==i&&(e.updateOptions(t,{graph:n.graph}),C(Yp,this,i)),M(Qp,this)!==t&&(e.selectNode(t),C(Qp,this,t)),e.render({noRaf:!0})}function tm(e,t,n){const i=Array.isArray(n)?n.length:0;if(!t||!i||i<2)return;const r=n.map(((e,t)=>e?`__SRC_TEXTURE:${t}`:null)).filter(Boolean),o=ot.buildLayoutGraph({inputs:r}),s=o.signature;M(Yp,this)!==s&&(e.updateOptions(t,{graph:o.graph}),C(Yp,this,s)),M(Qp,this)!==t&&(e.selectNode(t),C(Qp,this,t)),e.render({noRaf:!0})}function nm(e){const t=Number(e);return Number.isFinite(t)?t<=0?0:t>=1?1:t:0}ot=Zp;class im extends Kp{#N=null;#M=null;#F=null;static get type(){return"cross-fade"}static get aliases(){return["CrossFadeRenderNode","cross-fade","crossfade"]}static get requiresFrameCadence(){return!0}static get panAndScanTarget(){return"pre"}static buildLayoutGraph({inputs:e=[],normalizedTime:t}={}){if(e.length<2)return super.buildDefaultLayoutGraph(e);const n=nm(t),i=[{type:"opacity",inputs:[e[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",e[0]],options:{}}];return{type:im.type,signature:`${im.type}:${e.length}`,isDynamic:!0,graph:i}}static prepareRenderFrames({frames:e,timelineTime:t,active:n}={}){let i=(Array.isArray(e)?e:[]).slice(0,2);if(i.length<2)return i;const r=Number.isFinite(null==n?void 0:n.duration)&&n.duration>0?n.duration:void 0,o=Number.isFinite(null==n?void 0:n.offset)?n.offset:void 0;if(!Number.isFinite(t)||!Number.isFinite(r)||!Number.isFinite(o))return i;const s=nm((t-o)/r);return s<=0?[i[0]]:s>=1?[i[1]]:i}render(e){var t;const n=(null==e||null===(t=e.visualFramesAvailable)||void 0===t?void 0:t.frames)||[];if(!n.length)return;const i=null==e?void 0:e.shaderGraph,r=null==e?void 0:e.shaderGraphNodeIds;if(!i||"function"!=typeof i.updateOptions||"function"!=typeof i.selectNode)return;if(n.length<2){const e=null==r?void 0:r.default;if(!e)return;try{const t="default";if(this.#N!==t){const n=im.buildLayoutGraph({inputs:["__SRC_TEXTURE:0"]});i.updateOptions(e,{graph:n.graph}),this.#N=t}this.#M!==e&&(i.selectNode(e),this.#M=e),i.render({noRaf:!0})}catch(e){}return}const o=null==r?void 0:r.crossFade;if(o)try{const t=["__SRC_TEXTURE:0","__SRC_TEXTURE:1"],n=im.buildLayoutGraph({inputs:t,normalizedTime:null==e?void 0:e.renderNodeNormalizedTime}),r=n.signature,s=Number(null==e?void 0:e.renderNodeNormalizedTime),a=Number.isFinite(s)?s:0;this.#N===r&&this.#F===a||(i.updateOptions(o,{graph:n.graph}),this.#N=r,this.#F=a),this.#M!==o&&(i.selectNode(o),this.#M=o),i.render({noRaf:!0})}catch(e){}}}function rm(e,t,n={}){if("number"==typeof(null==e?void 0:e.nodeDurationOverride)&&Number.isFinite(e.nodeDurationOverride))return e.nodeDurationOverride;const i="function"==typeof(null==n?void 0:n.getNode)?n.getNode:t&&"function"==typeof t.get?e=>t.get(e):null;if(!i)return;const r=i(null==e?void 0:e.nodeId);if(!r)return;const o=r.duration;if("number"!=typeof o||Number.isNaN(o)||!Number.isFinite(o))return;const s="string"!=typeof r.state||"ready"===r.state;if(!0!==(null==n?void 0:n.allowUnready)&&!s)return;if(!(!0!==(null==n?void 0:n.allowUnready)||s||o>0))return;let a=0;"number"==typeof e.nodeOffsetOverride&&Number.isFinite(e.nodeOffsetOverride)&&(a=e.nodeOffsetOverride);const l=o-a;return l>0?l:0}function om(e){return!(!e||!0===e.offsetPending)&&Number.isFinite(e.offset)}function sm(e){return om(e)?e.offset:void 0}function am(e,t,n,i={}){if(!e)return!1;const r=sm(e);if(!Number.isFinite(r))return!1;const o=rm(e,n,i);return Number.isFinite(o)?t>=r&&t<r+o:t>=r}function lm(e=[]){if(!Array.isArray(e))return e;const t=[],n=[];return e.forEach((e=>{om(e)?t.push(e):n.push(e)})),t.sort(((e,t)=>e.offset-t.offset)),e.splice(0,e.length,...t,...n),e}function cm(e=[],t={}){if(!Array.isArray(e)||!e.length)return{updated:!1,resolvedPlacements:[]};const n="function"==typeof t.getPlacementDuration?t.getPlacementDuration:()=>{},i="function"==typeof t.snapPlacementOffset?t.snapPlacementOffset:e=>e,r="function"==typeof t.onResolvedPlacement?t.onResolvedPlacement:null,o=new Map,s=[];if(e.forEach((e=>{null!=e&&e.placementId&&o.set(e.placementId,e),!0===(null==e?void 0:e.offsetPending)&&s.push(e)})),!s.length)return{updated:!1,resolvedPlacements:[]};let a=!1;const l=[];let c=s,u=!0;for(;c.length&&u;){u=!1;const e=[];for(let t=0;t<c.length;t+=1){const s=c[t],d=null==s?void 0:s.offsetAnchorPlacementId;if(!d){e.push(s);continue}const h=o.get(d);if(!h||!0===h.offsetPending){e.push(s);continue}const f=sm(h);if(!Number.isFinite(f)){e.push(s);continue}let p;if("start"===s.offsetAnchorEdge)p=i(f,s);else{const t=n(h);if(!(t>0)){e.push(s);continue}const r=f+t-(Number.isFinite(s.offsetEndSeconds)?s.offsetEndSeconds:0);if(!Number.isFinite(r)){e.push(s);continue}const o=i(r,s);p=!0===s.offsetAnchorIsReference?Math.max(o,r):o}Number.isFinite(p)?(s.offset=p,s.offsetPending=!1,s.offsetAnchorPlacementId=void 0,s.offsetAnchorEdge=void 0,s.offsetAnchorIsReference=void 0,r&&r(s,h,p),l.push(s),a=!0,u=!0):e.push(s)}c=e}return a&&!1!==t.sortPlacements&&lm(e),{updated:a,resolvedPlacements:l}}function um(e){const t=Number(e);return Number.isFinite(t)?t:0}function dm(e,t={}){const n=function(e){const t=Number(e);return Number.isFinite(t)&&t<0?Math.abs(t):0}(e),i=Number.isFinite(null==t?void 0:t.offsetEndSeconds)?t.offsetEndSeconds:n;var r;return{wantsEndOffset:"end"===(r=e)||null==r||n>0||!0===(null==t?void 0:t.offsetPending),endOffsetSeconds:i,endOffsetFromAtSeconds:n}}function hm(e){if("string"!=typeof e)return null;const t=e.trim();if(!t||"end"===t)return null;const n=Number(t);if(Number.isFinite(n))return null;const i=t.split("@"),r=i[0]?i[0].trim():"";if(!r)return null;if(1===i.length)return{placementId:r,anchor:"start"};if(2!==i.length)return null;const o=i[1]?i[1].trim().toLowerCase():"";return"start"!==o&&"end"!==o?null:{placementId:r,anchor:o}}function fm(e=[],t,n,i){if(Array.isArray(e))for(let r=0;r<e.length;r+=1){const o=e[r],s="number"==typeof(null==o?void 0:o.offset)?o.offset:0;if(t<s+("number"==typeof(null==o?void 0:o.duration)&&Number.isFinite(o.duration)?o.duration:Number.POSITIVE_INFINITY)&&s<n)throw new Error(i)}}function pm(e){const t=Number(e);return Number.isFinite(t)&&t>0?t:0}function mm(e){return(null==e?void 0:e.id)||(null==e?void 0:e.nodeId)||null}function vm(e,t){return Array.isArray(e)&&t?e.findIndex((e=>mm(e)===t)):-1}function gm(e,t,n){const i=function(e,t,n){if(!Array.isArray(t)||0===t.length)return null;const i=t.length;if(null==e||"next"===e){const e=vm(t,n);return e>=0?(e+1)%i:0}if("prev"===e){const e=vm(t,n);return e>=0?(e-1+i)%i:i-1}const r=Number(e);return Number.isInteger(r)&&r>=0&&r<i?r:null}(e,t,n);return Number.isInteger(i)?mm(t[i]):null}function ym(e,t,n,i){const r=function(e,t){if(!Array.isArray(e)||e.length<=1)return e||[];const n=function(e){const t=[],n=new Set;return Array.isArray(e)?(e.forEach((e=>{const i=null==e?void 0:e.placementId;i&&!n.has(i)&&(n.add(i),t.push(i))})),t):t}(t);if(!n.length)return e;const i=new Map;e.forEach((e=>{const t=null==e?void 0:e.placementId;t&&!i.has(t)&&i.set(t,e)}));const r=[],o=new Set;return n.forEach((e=>{const t=i.get(e);t&&!o.has(e)&&(o.add(e),r.push(t))})),e.forEach((e=>{const t=null==e?void 0:e.placementId;t&&!o.has(t)&&(o.add(t),r.push(e))})),r}(function(e,t){const n=function(e){const t=Number(null==e?void 0:e.offset),n=Number(null==e?void 0:e.duration),i=n===Number.POSITIVE_INFINITY,r=Number.isFinite(n)&&n>0||i;return Number.isFinite(t)&&r?{start:t,end:i?Number.POSITIVE_INFINITY:t+n}:null}(t);if(!n||!e||!Array.isArray(e.placements))return[];const i=function(e,t){const n=Number(null==e||null===(t=e.settings)||void 0===t?void 0:t.snapToFps);return!Number.isFinite(n)||n<=0?0:.5/n}(e),r=e.placements.filter((t=>{const r=function(e,t){const n=sm(e);if(!Number.isFinite(n))return null;const i="function"==typeof(null==t?void 0:t.getPlacementDuration)?t.getPlacementDuration(e):void 0;return{start:n,end:Number.isFinite(i)&&i>=0?n+i:Number.POSITIVE_INFINITY}}(t,e);return!!r&&r.start<n.end&&r.end>n.start+i}));return r.sort(((e,t)=>sm(e)-sm(t))),r}(t,n),i),o=function(e,t){const n=[],i=new Set;return Array.isArray(e)?(e.forEach((e=>{const r=null==e?void 0:e.nodeId;if(!r||i.has(r))return;const o="function"==typeof(null==t?void 0:t.getNode)?t.getNode(r):null;if(o){const e="object"==typeof o&&null!==o?o.id||o.nodeId?o:{...o,id:r}:{id:r};n.push(e),i.add(r)}})),n):n}(r,t),s=function(e){const t=new Map;return e.forEach((e=>{const n=null==e?void 0:e.placementId,i=null==e?void 0:e.nodeId;n&&i&&(t.has(i)||t.set(i,[]),t.get(i).push(n))})),t}(r),a=Array.isArray(e.nodes)?e.nodes:[];return a.splice(0,a.length,...o),e.nodes=a,e.placements=r,e.nodePlacementMap=s,{nodes:a,placements:r,nodePlacementMap:s}}function bm(e,t,n){if(!Array.isArray(e))return null;if(t){const n=e.find((e=>(null==e?void 0:e.placementId)===t));if(n)return n}return n&&e.find((e=>(null==e?void 0:e.nodeId)===n))||null}function km(e,t){if(!t||!Array.isArray(e))return null;const n=e.find((e=>(null==e?void 0:e.placementId)===t));return(null==n?void 0:n.nodeId)||null}function wm(e,t,n){if(!e||!t)return null;const i=t.get(e);if(!Array.isArray(i)||!i.length)return null;for(let t=0;t<i.length;t+=1){const r=i[t];if(bm(n,r,e))return r}return null}function xm(e){e.initialized=!1,e.activeRenderPlacementId=null,e.nodes=[],e.placements=[],e.nodePlacementMap=null,e.selectedPlacementId=null,e.previousPlacementId=null,e.pendingSwitch=null,e.switchStartTime=null,e.switchDuration=0,e.switchNormalizedTime=void 0,e.switchTo=null,e.countOfConcurrentChannels=null}class _m extends Kp{static get type(){return"switching"}static get aliases(){return["SwitchingRenderNode","switching","switch"]}static get requiresFrameCadence(){return!0}static get panAndScanTarget(){return"pre"}static buildLayoutGraph({inputs:e=[],normalizedTime:t}={}){if(e.length<2)return super.buildDefaultLayoutGraph(e);const n=nm(t),i=[{type:"opacity",inputs:[e[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",e[0]],options:{}}];return{type:_m.type,signature:`${_m.type}:${e.length}`,isDynamic:!0,graph:i}}static getRenderTiming({timing:e,state:t}={}){const n=e&&"object"==typeof e?e:{},i=Number(null==t?void 0:t.switchNormalizedTime);return Number.isFinite(i)?{...n,normalizedTime:nm(i)}:n}static prepareRenderFrames({frames:e,timelineTime:t,timeline:n,active:i,renderNodeParams:r,state:o}={}){const s=Array.isArray(e)?e:[],a=o&&"object"==typeof o?o:{},l=null==i?void 0:i.renderPlacementId;l&&a.activeRenderPlacementId!==l&&(xm(a),a.activeRenderPlacementId=l);const c=null==r?void 0:r.initSwitching,u=ym(a,n,i,s),d=(f=s,Array.isArray(f)?f.length:0),h=a.countOfConcurrentChannels;var f;if(a.countOfConcurrentChannels=d,"function"==typeof c&&(a.switchTo||(a.switchTo=(e,t)=>{const n=km(a.placements,a.selectedPlacementId),i=gm(e,a.nodes,n);if(!i)return;const r={nodeId:i};t&&Object.prototype.hasOwnProperty.call(t,"crossfadeSeconds")&&void 0!==t.crossfadeSeconds&&(r.crossfadeSeconds=t.crossfadeSeconds),a.pendingSwitch=r}),!a.initialized||h!==d)){a.initialized=!0,a.countOfConcurrentChannels=d;try{c({nodes:u.nodes,countOfConcurrentChannels:d,switchTo:a.switchTo})}catch(f){}}if(!a.selectedPlacementId){const e=Number(null==r?void 0:r.initialChannelIndex),t=gm(Number.isInteger(e)&&e>=0?e:0,a.nodes,null);let n=null;if(t&&(n=wm(t,a.nodePlacementMap,s),!n&&a.nodePlacementMap)){const e=a.nodePlacementMap.get(t);Array.isArray(e)&&e.length&&(n=e[0])}a.selectedPlacementId=n||function(e,t){if(Array.isArray(t))for(let i=0;i<t.length;i+=1){var n;const r=null===(n=t[i])||void 0===n?void 0:n.placementId;if(r&&bm(e,r))return r}const i=Array.isArray(e)?e.find((e=>null==e?void 0:e.placementId)):null;return i?i.placementId:null}(s,a.placements)}if(a.pendingSwitch&&Number.isFinite(t)){const e=wm(a.pendingSwitch.nodeId,a.nodePlacementMap,s);if(e){const n=a.selectedPlacementId;a.previousPlacementId=n&&n!==e?n:null,a.selectedPlacementId=e;const i=Object.prototype.hasOwnProperty.call(a.pendingSwitch,"crossfadeSeconds"),o=pm(a.pendingSwitch.crossfadeSeconds),s=pm(null==r?void 0:r.switchCrossfadeSeconds),l=i?o:s;a.switchDuration=l,l>0?a.switchStartTime=t:(a.switchStartTime=null,a.previousPlacementId=null)}a.pendingSwitch=null}let p;if(Number.isFinite(a.switchStartTime)&&a.switchDuration>0&&Number.isFinite(t)){const e=t-a.switchStartTime;e>=a.switchDuration?(a.switchStartTime=null,a.switchDuration=0,a.previousPlacementId=null):e>=0&&(p=nm(e/a.switchDuration))}a.switchNormalizedTime=Number.isFinite(p)?p:void 0;const m=km(a.placements,a.selectedPlacementId),v=bm(s,a.selectedPlacementId,m)||s[0];let g=null;if(Number.isFinite(a.switchNormalizedTime)&&a.previousPlacementId){const e=km(a.placements,a.previousPlacementId),t=km(a.placements,a.selectedPlacementId),n=bm(s,a.previousPlacementId,e),i=bm(s,a.selectedPlacementId,t);n&&i&&(g=[n,i])}return g||(g=v?[v]:s),g}static resetRenderState(e){e&&"object"==typeof e&&xm(e)}}const Tm=[Xp,Zp,im,_m],Im=new Map;function Em(e){if("string"!=typeof e)return null;const t=e.trim();return t?t.toLowerCase():null}function Sm(e){const t=Em(e);return t&&Im.get(t)||null}function Am(e){return Sm(e)||Xp}Tm.forEach((e=>function(e){(function(e){const t=Array.isArray(e.aliases)?e.aliases:[],n=e.type;return(n?[n,...t]:t.slice()).filter((e=>"string"==typeof e&&e.trim().length))})(e).forEach((t=>{const n=Em(t);n&&Im.set(n,e)}))}(e)));class Nm{static get defaultType(){return Xp.type||"default"}static getRenderNodeClass(e){return Sm(e)}static normalizeType(e){const t=Sm(e);return t?t.type:null}static doesRenderNodeTypeRequireFrameCadence(e){const t=Sm(e);return!!t&&!0===t.requiresFrameCadence}static buildLayoutGraph({type:e,inputs:t=[],normalizedTime:n}={}){const i=Am(e);return i&&"function"==typeof i.buildLayoutGraph?i.buildLayoutGraph({inputs:t,normalizedTime:n}):Xp.buildLayoutGraph({inputs:t,normalizedTime:n})}static getPanAndScanTarget(e){const t=Am(e);return"post"===(n=null==t?void 0:t.panAndScanTarget)||"skip"===n?n:"pre";var n}static prepareRenderFrames({type:e,frames:t,timelineTime:n,timeline:i,active:r,renderNodeParams:o,state:s}={}){const a=Am(e);if(a&&"function"==typeof a.prepareRenderFrames){const e=a.prepareRenderFrames({frames:t,timelineTime:n,timeline:i,active:r,renderNodeParams:o,state:s});if(Array.isArray(e))return e}return Array.isArray(t)?t:[]}static getRenderTiming({type:e,timing:t,timelineTime:n,active:i,renderNodeParams:r,state:o}={}){const s=Am(e),a=t&&"object"==typeof t?t:{};if(s&&"function"==typeof s.getRenderTiming){const e=s.getRenderTiming({timing:a,timelineTime:n,active:i,renderNodeParams:r,state:o});if(e&&"object"==typeof e)return{...a,...e}}return a}static resetRenderState(e,t){const n=Am(e);n&&"function"==typeof n.resetRenderState&&n.resetRenderState(t)}static resetAllRenderStates(e){e&&"function"==typeof e.forEach&&e.forEach(((e,t)=>{Nm.resetRenderState(t,e)}))}create(e,t){return e&&"function"==typeof e.render?e:new(Am(e))(t)}}function Mm(e){return Array.isArray(e)?e.filter((e=>e&&"string"==typeof e.type)):[]}function Fm(e,t){return e&&"function"==typeof e.getSignature?e.getSignature():(null==t?void 0:t.type)||"stage"}class Cm{#C;constructor(e){this.#C=e||new Hp}build(e={}){const t=(Array.isArray(null==e?void 0:e.frames)?e.frames:[]).length,n=Array.from({length:t},((e,t)=>`__SRC_TEXTURE:${t}`)),i=Nm.normalizeType(null==e?void 0:e.layoutType)||Nm.defaultType,r=null==e?void 0:e.normalizedTime,o=Mm(null==e?void 0:e.preStages),s=Mm(null==e?void 0:e.postStages),a=[],l=[`layout:${i}`,`inputs:${t}`];let c=n;o.forEach(((t,n)=>{const i=this.#C.create(t);if(!i)return;const r=i.build({inputs:c,stageIndex:n,context:e});Array.isArray(null==r?void 0:r.graph)&&r.graph.length&&a.push(...r.graph),Array.isArray(null==r?void 0:r.outputs)&&r.outputs.length&&(c=r.outputs),l.push(Fm(i,t))}));const u=Nm.buildLayoutGraph({type:i,inputs:c,normalizedTime:r}),d=!(null==u||!u.isDynamic);Array.isArray(null==u?void 0:u.graph)&&u.graph.length&&a.push(...u.graph),l.push((null==u?void 0:u.signature)||`${i}:${c.length}`);let h="__PREVIOUS:0";return s.forEach(((t,n)=>{const i=this.#C.create(t);if(!i)return;const r=i.build({inputs:[h],stageIndex:n,context:e});Array.isArray(null==r?void 0:r.graph)&&r.graph.length&&a.push(...r.graph),h=Array.isArray(null==r?void 0:r.outputs)&&r.outputs.length?r.outputs[0]:"__PREVIOUS:0",l.push(Fm(i,t))})),{graph:a,signature:l.join("|"),isDynamic:d}}}const Om=[0,0,1,1],Pm="zoomInExposure",Rm=["transform","exposure","fadeToColor","dipToBlack"],Dm={zoomInExposure:{filters:{fadeToColor:{duration:150,ease:[1,0,1,0],power:{from:0,to:1},color:"#ffffff"},exposure:!1,transform:{duration:150,ease:[0,.5,.5,1],scale:{from:{x:1,y:1},to:{x:1.1,y:1.1}},translate:{from:{x:0,y:0},to:{x:0,y:0}}}},reverseFilters:{fadeToColor:{duration:700,ease:[0,1,0,1]},exposure:!1,transform:{duration:700,ease:[0,1,0,1]}}},dipToBlack:{filters:{transform:{duration:250,ease:[0,.5,.5,1],scale:{from:{x:1,y:1},to:{x:1.05,y:1.05}},translate:{from:{x:0,y:0},to:{x:0,y:0}}},dipToBlack:{duration:250,ease:[0,.5,.5,1],power:{from:0,to:1}}},reverseFilters:{dipToBlack:{duration:800,ease:[0,1,0,1]}}}};function Lm(e,t=0){const n=Number(e);return Number.isFinite(n)?n:t}function Bm(e,t=Om){return Array.isArray(e)&&e.length>=4?e:t}function zm(e){return"string"==typeof e&&e.trim()?e.trim():"#ffffff"}function Wm(e,t){const n=null==e?void 0:e[t];return!1===n||null==n?null:ed(n)?n:{}}function $m(e={}){let t=0;return Rm.forEach((n=>{const i=Wm(e,n);if(!i)return;const r=Lm(null==i?void 0:i.duration);r>t&&(t=r)})),t}function jm(e,t,n,i,r){const o=[];return Rm.forEach((s=>{const a=Wm(e,s);if(!a)return;const l=function(e,t,n){const i=Lm(null==e?void 0:e.duration);return Number.isFinite(n)&&n>0?i>0&&t>0?i*t:n:i}(a,n,i),c=function(e,t,n,i,r){const o={type:"transition",inputs:["__PREVIOUS:0"],options:{filter:e,startTime:n,duration:i,properties:{}}};if("transform"===e){var s,a,l,c;const e=Bm(null==t?void 0:t.ease),n=(null==t||null===(s=t.scale)||void 0===s?void 0:s.from)||{x:1,y:1},i=(null==t||null===(a=t.scale)||void 0===a?void 0:a.to)||{x:1,y:1},r=(null==t||null===(l=t.translate)||void 0===l?void 0:l.from)||{x:0,y:0},u=(null==t||null===(c=t.translate)||void 0===c?void 0:c.to)||{x:0,y:0};return o.options.properties.scale={from:n,to:i,ease:e},o.options.properties.translate={from:r,to:u,ease:e},o}if("fadeToColor"===e){const e=Bm(null==t?void 0:t.ease),n=(null==t?void 0:t.power)||{from:0,to:1};return o.options.properties.power={from:Lm(null==n?void 0:n.from,0),to:Lm(null==n?void 0:n.to,1),ease:e},o.options.properties.color=zm((null==t?void 0:t.color)||r),o}if("exposure"===e||"dipToBlack"===e){const e=Bm(null==t?void 0:t.ease),n=(null==t?void 0:t.power)||{from:0,to:1};return o.options.properties.power={from:Lm(null==n?void 0:n.from,0),to:Lm(null==n?void 0:n.to,1),ease:e},o}return null}(s,a,t,l,r);c&&o.push(c)})),o}function Um(e=[]){const t=e.map((e=>{const t=JSON.parse(JSON.stringify(e));return null!=t&&t.options&&(t.options.startTime=0),t}));return JSON.stringify(t)}class qm{#O=null;start(e={}){const t=null==e?void 0:e.shaderGraph;if(!t||"function"!=typeof t.captureTexture)return null;const{baseFilters:n,reverseFilters:i}=function(e={}){const t=function(e={}){if(ed(null==e?void 0:e.transition))return e.transition;if("string"==typeof(null==e?void 0:e.transition))return Dm[e.transition]||Dm[Pm];if(ed(null==e?void 0:e.filters)||ed(null==e?void 0:e.reverseFilters))return{filters:e.filters||{},reverseFilters:e.reverseFilters||{}};if("string"==typeof(null==e?void 0:e.filter)){const t=Lm(e.duration)>0?1e3*e.duration:500;return{filters:{[e.filter]:{duration:t,power:{from:0,to:1}}},reverseFilters:{}}}return Dm[Pm]}(e),n=td({},(null==t?void 0:t.filters)||{},ed(null==e?void 0:e.filters)?e.filters:{}),i=function(e={}){const t={};return Object.keys(e).forEach((n=>{const i=e[n];if(!1===i)return void(t[n]=!1);const r=JSON.parse(JSON.stringify(ed(i)?i:{}));Object.values(r).forEach((e=>function(e){if(e&&"object"==typeof e&&"from"in e&&"to"in e){const t=e.from;e.from=e.to,e.to=t}}(e))),t[n]=r})),t}(n),r=td({},(null==t?void 0:t.reverseFilters)||{},ed(null==e?void 0:e.reverseFilters)?e.reverseFilters:{});return{baseFilters:n,reverseFilters:td({},i,r)}}(e),r=Lm(null==e?void 0:e.duration),o=r>0?1e3*r:null,s=$m(n),a=$m(i),l=o&&s>0?o/s:1,c=o&&a>0?o/a:1,u=o||s||500,d=o||a||u,h=zm(null==e?void 0:e.color),f=t.captureTexture(),p=Date.now(),m=jm(n,p,l,o,h);return this.#O={phase:"out",startTime:p,outDurationMs:u,inDurationMs:d,color:h,captureId:f,baseFilters:n,reverseFilters:i,outScale:l,inScale:c,durationOverrideMs:o,outGraph:m,outSignature:Um(m),inGraph:null,inSignature:null},{captureId:f,outDurationMs:u,inDurationMs:d}}beginIncoming(){if(!this.#O)return;const e=Date.now(),t=jm(this.#O.reverseFilters,e,this.#O.inScale,this.#O.durationOverrideMs,this.#O.color);this.#O={...this.#O,phase:"in",startTime:e,inGraph:t,inSignature:Um(t)}}reset(e){var t;e&&"function"==typeof e.disposeTexture&&null!==(t=this.#O)&&void 0!==t&&t.captureId&&e.disposeTexture(this.#O.captureId),this.#O=null}getState(){return this.#O}buildOutgoingGraph(){const e=this.#O;return e&&"out"===e.phase&&Array.isArray(e.outGraph)&&e.outGraph.length?{signature:`transition:out:${e.outSignature||""}`,forceUpdate:!1,graph:e.outGraph}:null}buildIncomingGraph(){const e=this.#O;return e&&"in"===e.phase&&Array.isArray(e.inGraph)&&e.inGraph.length?{signature:`transition:in:${e.inSignature||""}`,forceUpdate:!1,graph:e.inGraph}:null}}let Vm;const Gm=[/firefox\/(\d+)/,/edg\/(\d+)/,/opr\/(\d+)/,/chrome\/(\d+)/];function Hm(){const e=ld&&ld.navigator&&(ld.navigator.userAgent||ld.navigator.platform||ld.navigator.vendor)||"";if(Vm&&Vm.ua===e)return Vm;const t=e.toLowerCase(),n=t.includes("android"),i=t.includes("iphone")||t.includes("ipad")||t.includes("ipod")||t.includes("ios"),r=n||i||t.includes("mobile"),o=!!e&&!r,s=t.includes("firefox/"),a=function(e=""){for(let t=0;t<Gm.length;t+=1){const n=Gm[t],i=e.match(n);if(!i)continue;const r=Number(i[1]);return Number.isFinite(r)?r:null}if(e.includes("safari/")&&e.includes("version/")){const t=e.match(/version\/(\d+)/);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)?n:null}return null}(t);return Vm={ua:e,lowerUA:t,isAndroid:n,isiOS:i,isMobile:r,isDesktop:o,isFirefox:s,browserMajorVersion:a},Vm}function Km(){return Hm().ua}function Xm(){return Hm().isAndroid}function Ym(){return Hm().isiOS}function Qm(){return Hm().isMobile}function Jm(){return Hm().isDesktop}function Zm(){return Hm().isFirefox}function ev(){return Hm().browserMajorVersion}var tv={getUserAgent:Km,isAndroid:Xm,isiOS:Ym,isMobile:Qm,isDesktop:Jm,isFirefox:Zm,getBrowserMajorVersion:ev},nv=Object.freeze({__proto__:null,default:tv,getBrowserMajorVersion:ev,getUserAgent:Km,isAndroid:Xm,isDesktop:Jm,isFirefox:Zm,isMobile:Qm,isiOS:Ym});const iv=Object.freeze({NODE_ADD:"node:add",NODE_CHILDREN_CHANGED:"node:childrenchanged",NODE_LOADED:"node:loaded",NODE_LOAD_ERROR:"node:loaderror",PLACEMENT_ADDED:"placement:added",RENDER_PLACEMENT_ADDED:"renderplacement:added",TIMELINE_TIME_UPDATE:"timeline:timeupdate",TIMELINE_STATE_CHANGE:"statechange",TIMELINE_SEEKING:"seeking",TIMELINE_SEEKED:"seeked",TIMELINE_RESET:"timeline:reset",TIMELINE_PLAYER_STATE:"player:state",TIMELINE_CUEPOINT:"cuepoint",VISUAL_FRAMES_AVAILABLE:"visualframesavailable",TRACK_BUFFER_UPDATE:"track:bufferupdate",TRACK_READY:"track:ready",TRACK_UNDERFLOW:"track:underflow",CLOCK_TICK:"tick",DECODE_READY:"decode:ready",DECODE_ERROR:"decode:error",DECODER_AUDIO:"decoder:audio",DECODER_FRAME:"decoder:frame",DECODER_INIT:"decoder:init",DECODER_ERROR:"decoder:error",QOE_SCORE:"qoescore",QOE_STATUS:"qoestatus",CONTAINER_RESIZE:"containerresize"});function rv(e,t){const n={};return Number.isFinite(e)&&(n.time=e),"string"==typeof t&&(n.source=t),n}function ov({placementId:e,nodeId:t,trackId:n,segmentId:i,trackType:r,pts:o,duration:s,frame:a,audioBuffer:l}={}){const c={};return e&&(c.placementId=e),t&&(c.nodeId=t),n&&(c.trackId=n),i&&(c.segmentId=i),r&&(c.trackType=r),Number.isFinite(o)&&(c.pts=o),Number.isFinite(s)&&(c.duration=s),a&&(c.frame=a),l&&(c.audioBuffer=l),c}function sv({placementId:e,nodeId:t,trackId:n,segmentId:i,trackType:r,error:o}={}){const s={};return e&&(s.placementId=e),t&&(s.nodeId=t),n&&(s.trackId=n),i&&(s.segmentId=i),r&&(s.trackType=r),o&&(s.error=o),s}const av="Idle",lv="Playing",cv="FirstFramePending",uv="Waiting",dv="Paused",hv="Seeking",fv="Resetting";function pv(e){return Array.isArray(e)?e.filter((e=>e&&"string"==typeof e.type)):[]}function mv(e,t){return!!Array.isArray(e)&&e.some((e=>(null==e?void 0:e.type)===t))}function vv(e){const t=Number(e);return!Number.isFinite(t)||t<=0?null:{type:"retarget",options:{frames:Array.from({length:t},(()=>({fitType:"fill"})))},meta:{source:"panAndScan"}}}function gv(e){return Array.isArray(e)?e.filter((e=>{return!("panAndScan"===(null==(t=e)||null===(n=t.meta)||void 0===n?void 0:n.source));var t,n})):[]}const yv=2073600;function bv(e,t){const n=Number(e);return Number.isFinite(n)&&n>0?n:t}function kv(e,t){if(null==e)return t;const n=Number(e);return Number.isFinite(n)?n:t}var wv=new WeakMap,xv=new WeakMap,_v=new WeakMap,Tv=new WeakMap,Iv=new WeakMap,Ev=new WeakMap,Sv=new WeakMap,Av=new WeakMap,Nv=new WeakMap,Mv=new WeakMap,Fv=new WeakMap,Cv=new WeakMap,Ov=new WeakMap,Pv=new WeakMap,Rv=new WeakMap,Dv=new WeakMap,Lv=new WeakMap,Bv=new WeakMap,zv=new WeakMap,Wv=new WeakMap,$v=new WeakMap,jv=new WeakMap,Uv=new WeakMap,qv=new WeakMap,Vv=new WeakMap,Gv=new WeakMap,Hv=new WeakMap,Kv=new WeakMap,Xv=new WeakMap,Yv=new WeakMap,Qv=new WeakSet;class Jv extends od{static get pipelineNodeId(){return"ekoplayer-render-pipeline"}get defaults(){return{defaultRenderParams:void 0,resourceLimits:{enabled:!0,maxCanvasPixels:yv,maxDevicePixelRatio:0,renderScale:1,transitionMinFrameIntervalMs:33}}}constructor(...e){super(...e),O(this,Qv),F(this,wv,void 0),F(this,xv,void 0),F(this,_v,void 0),F(this,Tv,void 0),F(this,Iv,void 0),F(this,Ev,void 0),F(this,Sv,void 0),F(this,Av,void 0),F(this,Nv,void 0),F(this,Mv,void 0),F(this,Fv,null),F(this,Cv,null),F(this,Ov,void 0),F(this,Pv,void 0),F(this,Rv,void 0),F(this,Dv,[]),F(this,Lv,[]),F(this,Bv,null),F(this,zv,null),F(this,Wv,null),F(this,$v,null),F(this,jv,null),F(this,Uv,null),F(this,qv,new Map),F(this,Vv,null),F(this,Gv,null),F(this,Hv,!1),F(this,Kv,!1),F(this,Xv,[]),F(this,Yv,null);const[t,n,i]=e;C(wv,this,t),C(xv,this,n),C(_v,this,i),M(wv,this)&&"function"==typeof M(wv,this).enableFirstFrameRenderedGate&&M(wv,this).enableFirstFrameRenderedGate(),C(Mv,this,new Cm),C(Ov,this,new qm),C(Pv,this,null),C(Rv,this,null),C(Wv,this,null),C(Tv,this,(e=>A(Qv,this,Fg).call(this,e))),M(wv,this)&&"function"==typeof M(wv,this).on&&(M(wv,this).on(iv.VISUAL_FRAMES_AVAILABLE,M(Tv,this)),C(Iv,this,(()=>{var e,t,n,i;A(Qv,this,ng).call(this),A(Qv,this,Eg).call(this,0),C(Lv,this,[]),C(Bv,this,null),C(Fv,this,null),C(Cv,this,null),A(Qv,this,vg).call(this),C(Vv,this,null);(null===(e=M(Ov,this))||void 0===e||null===(t=e.getState)||void 0===t?void 0:t.call(e))||null===(n=M(Ov,this))||void 0===n||null===(i=n.reset)||void 0===i||i.call(n,M(Pv,this))})),M(wv,this).on(iv.TIMELINE_SEEKING,M(Iv,this)),C(Ev,this,(()=>A(Qv,this,ig).call(this))),M(wv,this).on(iv.TIMELINE_RESET,M(Ev,this)),C(Nv,this,(()=>A(Qv,this,kg).call(this))),M(wv,this).on(iv.TIMELINE_TIME_UPDATE,M(Nv,this)),C(Sv,this,(()=>{A(Qv,this,Cg).call(this)&&M(zv,this)&&A(Qv,this,Fg).call(this,M(zv,this))})),M(wv,this).on(iv.TIMELINE_STATE_CHANGE,M(Sv,this))),C(Av,this,(()=>{C(Bv,this,null),M(zv,this)&&A(Qv,this,Cg).call(this)&&A(Qv,this,Fg).call(this,M(zv,this))})),M(_v,this)&&"function"==typeof M(_v,this).on&&M(_v,this).on(iv.CONTAINER_RESIZE,M(Av,this))}get name(){return"Renderer"}onDispose(){M(wv,this)&&M(Tv,this)&&"function"==typeof M(wv,this).off&&M(wv,this).off(iv.VISUAL_FRAMES_AVAILABLE,M(Tv,this)),M(wv,this)&&M(Iv,this)&&"function"==typeof M(wv,this).off&&M(wv,this).off(iv.TIMELINE_SEEKING,M(Iv,this)),M(wv,this)&&M(Ev,this)&&"function"==typeof M(wv,this).off&&M(wv,this).off(iv.TIMELINE_RESET,M(Ev,this)),M(wv,this)&&M(Nv,this)&&"function"==typeof M(wv,this).off&&M(wv,this).off(iv.TIMELINE_TIME_UPDATE,M(Nv,this)),M(wv,this)&&M(Sv,this)&&"function"==typeof M(wv,this).off&&M(wv,this).off(iv.TIMELINE_STATE_CHANGE,M(Sv,this)),M(_v,this)&&M(Av,this)&&"function"==typeof M(_v,this).off&&M(_v,this).off(iv.CONTAINER_RESIZE,M(Av,this)),A(Qv,this,Zv).call(this),C(Tv,this,null),C(Iv,this,null),C(Ev,this,null),C(Nv,this,null),C(Sv,this,null),C(Av,this,null),C(Mv,this,null),C(Ov,this,null),C(qv,this,null),C(Vv,this,null),C(xv,this,null),C(_v,this,null),C(wv,this,null)}startTransition(e={}){var t;const n=null===(t=M(xv,this))||void 0===t?void 0:t.element;if(!n)return null;if(A(Qv,this,og).call(this,n),!M(Pv,this))return null;const i=M(Ov,this).start({shaderGraph:M(Pv,this),duration:null==e?void 0:e.duration,filter:null==e?void 0:e.filter,color:null==e?void 0:e.color,filters:null==e?void 0:e.filters,reverseFilters:null==e?void 0:e.reverseFilters,transition:null==e?void 0:e.transition});return C(Wv,this,M(zv,this)||null),A(Qv,this,Ag).call(this),i}beginTransitionIn(e={}){var t,n;null!==(t=M(Ov,this))&&void 0!==t&&null!==(n=t.beginIncoming)&&void 0!==n&&n.call(t,e),C(Wv,this,null),A(Qv,this,Ag).call(this)}resetTransition(){var e,t;null!==(e=M(Ov,this))&&void 0!==e&&null!==(t=e.reset)&&void 0!==t&&t.call(e,M(Pv,this)),C(Wv,this,null),A(Qv,this,Ng).call(this)}}function Zv(){if(A(Qv,this,ng).call(this),M(Ov,this)&&"function"==typeof M(Ov,this).reset&&M(Ov,this).reset(M(Pv,this)),A(Qv,this,Eg).call(this,0),M(Pv,this)&&"function"==typeof M(Pv,this).dispose)try{M(Pv,this).dispose()}catch(e){}C(Pv,this,null),C(Rv,this,null),C(Dv,this,[]),C(Lv,this,[]),C(Bv,this,null),C(Fv,this,null),C(Cv,this,null),C(zv,this,null),C(Wv,this,null),A(Qv,this,Ng).call(this),A(Qv,this,vg).call(this),C(Vv,this,null)}function eg(){return{schedule:"function"==typeof ld.requestAnimationFrame?ld.requestAnimationFrame.bind(ld):e=>setTimeout(e,16),cancel:"function"==typeof ld.cancelAnimationFrame?ld.cancelAnimationFrame.bind(ld):clearTimeout}}function tg(e){C(Xv,this,M(Xv,this).filter((t=>t!==e))),M(Xv,this).length||C(Yv,this,null)}function ng(){M(Yv,this)&&M(Xv,this).forEach((e=>M(Yv,this).call(this,e))),C(Xv,this,[]),C(Yv,this,null),C(Kv,this,!1)}function ig(){A(Qv,this,ng).call(this),C(Hv,this,!1)}function rg(){if(M(Hv,this)||M(Kv,this))return;const{schedule:e,cancel:t}=A(Qv,this,eg).call(this);let n;C(Yv,this,t),C(Kv,this,!0),n=e((()=>{let t;A(Qv,this,tg).call(this,n),t=e((()=>{A(Qv,this,tg).call(this,t),C(Kv,this,!1),M(Hv,this)||(C(Hv,this,!0),M(wv,this)&&"function"==typeof M(wv,this).notifyFirstFrameRendered&&M(wv,this).notifyFirstFrameRendered())})),M(Xv,this).push(t)})),M(Xv,this).push(n)}function og(e){if(M(Pv,this)||!e)return;const t=this,n={dest:e,src:(e,n)=>{C(Rv,t,n)}};C(Pv,t,new Up(n,{userWillCallRender:!0,glOptions:{contextType:"webgl2"},performanceToggles:{useCanvasSizedFilterTargets:!0}})),M(Pv,t)&&"function"==typeof M(Pv,t).addNodes&&M(Pv,t).addNodes({[st.pipelineNodeId]:{type:"composite",options:{graph:[]}}})}function sg(){var e;const t=null===(e=this.settings)||void 0===e?void 0:e.resourceLimits;return!t||"object"!=typeof t||Array.isArray(t)?{}:t}function ag(){const e=A(Qv,this,sg).call(this).enabled;return!0===e||!1!==e&&Ym()}function lg(){if(!A(Qv,this,ag).call(this))return 0;const e=kv(A(Qv,this,sg).call(this).transitionMinFrameIntervalMs,33);return Number.isFinite(e)&&e>0?e:0}function cg(e,t,n={}){const i=!0===(null==n?void 0:n.useDevicePixelRatio),r=A(Qv,this,ag).call(this),o=i?bv(null==ld?void 0:ld.devicePixelRatio,1):1;let s=o,a=0;if(r){const e=A(Qv,this,sg).call(this);a=kv(e.maxCanvasPixels,yv);const t=kv(e.maxDevicePixelRatio,0);s=bv(e.renderScale,1)*(t>0?Math.min(o,t):o)}let l=Math.max(1,Math.round(e*s)),c=Math.max(1,Math.round(t*s));if(r&&a>0){const e=l*c;if(e>a){const t=Math.sqrt(a/e);l=Math.max(1,Math.floor(l*t)),c=Math.max(1,Math.floor(c*t))}}return{width:l,height:c}}function ug(e=[],t={}){var n;const i=null===(n=M(xv,this))||void 0===n?void 0:n.element,r=M(Rv,this);if(!i||"function"!=typeof r)return!1;let o=0,s=0;const a=!0===(null==t?void 0:t.useViewportSize);if(a){var l,c,u,d,h,f;const e=Number(null!==(l=null===(c=M(_v,this))||void 0===c?void 0:c.containerWidth)&&void 0!==l?l:null===(u=M(_v,this))||void 0===u?void 0:u.width),t=Number(null!==(d=null===(h=M(_v,this))||void 0===h?void 0:h.containerHeight)&&void 0!==d?d:null===(f=M(_v,this))||void 0===f?void 0:f.height);if(Number.isFinite(e)&&Number.isFinite(t)&&e>0&&t>0)o=Math.round(e),s=Math.round(t);else{const e=Number(i.clientWidth),t=Number(i.clientHeight);Number.isFinite(e)&&Number.isFinite(t)&&e>0&&t>0&&(o=Math.round(e),s=Math.round(t))}}if(!(o>0&&s>0)){if(!Array.isArray(e)||!e.length)return;for(let t=0;t<e.length;t+=1){var p;const n=null===(p=e[t])||void 0===p?void 0:p.frame,i=Number((null==n?void 0:n.displayWidth)||(null==n?void 0:n.codedWidth)||(null==n?void 0:n.videoWidth)||(null==n?void 0:n.naturalWidth)||(null==n?void 0:n.width)),r=Number((null==n?void 0:n.displayHeight)||(null==n?void 0:n.codedHeight)||(null==n?void 0:n.videoHeight)||(null==n?void 0:n.naturalHeight)||(null==n?void 0:n.height));!Number.isFinite(i)||!Number.isFinite(r)||i<=0||r<=0||(i>o&&(o=i),r>s&&(s=r))}}if(!(o>0&&s>0))return!1;const m=A(Qv,this,cg).call(this,o,s,{useDevicePixelRatio:a}),v=m.width,g=m.height,y=M(Bv,this);return!(y&&y.width===v&&y.height===g||(C(Bv,this,{width:v,height:g}),r(null,null,v,g),0))}function dg(e){const t=null==e?void 0:e.nodeId,n=null==e?void 0:e.trackId,i=null==e?void 0:e.segmentId,r=null==e?void 0:e.presentationTime;return t&&n&&i&&Number.isFinite(r)?`${t}:${n}:${i}@${r}`:null}function hg(e,t,n){const i=Number.isFinite(null==e?void 0:e.duration)&&e.duration>0?e.duration:void 0;let r;if(i&&Number.isFinite(null==e?void 0:e.offset)){const n=(t-e.offset)/i;r=n<0?0:n>1?1:n}const o=A(Qv,this,fg).call(this,e),s=A(Qv,this,pg).call(this,o);return Nm.getRenderTiming({type:o,timing:{duration:i,normalizedTime:r},timelineTime:t,active:e,renderNodeParams:n,state:s})}function fg(e){return Nm.normalizeType(null==e?void 0:e.type)||Nm.defaultType}function pg(e){if(!e||!M(qv,this))return null;let t=M(qv,this).get(e);return t||(t={},M(qv,this).set(e,t)),t}function mg(e){if(!e||!M(qv,this))return;const t=M(qv,this).get(e);t&&Nm.resetRenderState(e,t),M(qv,this).delete(e)}function vg(){M(qv,this)&&(Nm.resetAllRenderStates(M(qv,this)),M(qv,this).clear())}function gg(e,t,n,i){const r=A(Qv,this,fg).call(this,e);M(Vv,this)&&M(Vv,this)!==r&&A(Qv,this,mg).call(this,M(Vv,this)),C(Vv,this,r);const o=A(Qv,this,pg).call(this,r);return Nm.prepareRenderFrames({type:r,frames:t,timelineTime:n,timeline:M(wv,this),active:e,renderNodeParams:i,state:o})}function yg(e){var t;return null!=e&&e.params&&"object"==typeof e.params?e.params:!e&&null!==(t=this.settings)&&void 0!==t&&t.defaultRenderParams&&"object"==typeof this.settings.defaultRenderParams?this.settings.defaultRenderParams:{}}function bg(e){return e?String(e.renderPlacementId||e.type||"unknown"):"default"}function kg(){if(!M(wv,this)||!M(zv,this))return;const e=M(wv,this).currentTime,t=M(wv,this).getActiveRenderPlacement(e),n=A(Qv,this,bg).call(this,t);n!==M(Gv,this)&&(C(Gv,this,n),A(Qv,this,Fg).call(this,{...M(zv,this),time:e}))}function wg(e){return!e||"object"!=typeof e||!Object.prototype.hasOwnProperty.call(e,"panAndScan")||!1!==e.panAndScan}function xg(e,t){const n=A(Qv,this,yg).call(this,e),i=null==n?void 0:n.stages;let r=pv(null==i?void 0:i.pre),o=pv(null==i?void 0:i.post);const s=A(Qv,this,wg).call(this,n),a=A(Qv,this,fg).call(this,e),l=mv(r,"retarget")||mv(o,"retarget");if(s&&!l){const e=Nm.getPanAndScanTarget(a);if("pre"===e){const e=vv(Array.isArray(t)?t.length:0);e&&(r=[e,...r])}else if("post"===e){const e=vv(1);e&&(o=[...o,e])}}else s||(r=gv(r),o=gv(o));return{preStages:r,postStages:o,renderNodeParams:n}}function _g(e,t,n,i,r){const o=r||A(Qv,this,hg).call(this,e,n,i),s=A(Qv,this,xg).call(this,e,t);return M(Mv,this).build({layoutType:null==e?void 0:e.type,frames:t,preStages:s.preStages,postStages:s.postStages,normalizedTime:o.normalizedTime,renderNodeDuration:o.duration,renderNodeParams:s.renderNodeParams,timelineTime:n})}function Tg(){var e,t;const n=null===(e=M(Ov,this))||void 0===e||null===(t=e.getState)||void 0===t?void 0:t.call(e);return"out"===(null==n?void 0:n.phase)?M(Ov,this).buildOutgoingGraph():"in"===(null==n?void 0:n.phase)?M(Ov,this).buildIncomingGraph():null}function Ig(e,t,n,i){const r=n||t!==M(Fv,this),o=r||i;return r&&M(Pv,this)&&"function"==typeof M(Pv,this).updateOptions&&(M(Pv,this).updateOptions(st.pipelineNodeId,{graph:e}),C(Fv,this,t)),M(Pv,this)&&"function"==typeof M(Pv,this).selectNode&&M(Cv,this)!==st.pipelineNodeId&&(M(Pv,this).selectNode(st.pipelineNodeId),C(Cv,this,st.pipelineNodeId)),!(!o||!M(Pv,this)||"function"!=typeof M(Pv,this).render||(M(Pv,this).render({noRaf:!0}),0))}function Eg(e){if(!Array.isArray(M(Dv,this))||!M(Dv,this).length)return;const t=Number.isFinite(e)?Math.max(0,e):0;if(!(M(Dv,this).length<=t)){for(let e=t;e<M(Dv,this).length;e+=1){const t=M(Dv,this)[e];if(t&&M(Pv,this)&&"function"==typeof M(Pv,this).releaseTexture)try{M(Pv,this).releaseTexture(t)}catch(e){}}M(Dv,this).length=t,M(Lv,this).length=t}}function Sg(e=[]){if(!M(Pv,this)||"function"!=typeof M(Pv,this).addTexture)return!1;if("function"==typeof M(Pv,this).isContextUnavailable&&M(Pv,this).isContextUnavailable())return!1;if(!Array.isArray(e)||!e.length)return A(Qv,this,Eg).call(this,0),!1;A(Qv,this,Eg).call(this,e.length);let t=!1;for(let i=0;i<e.length;i+=1){var n;M(Dv,this)[i]||"function"!=typeof M(Pv,this).addTexture||(M(Dv,this)[i]=M(Pv,this).addTexture(null,"frame",i));const r=A(Qv,this,dg).call(this,e[i]),o=null===(n=e[i])||void 0===n?void 0:n.frame;if(M(Dv,this)[i]&&o&&(!r||r!==M(Lv,this)[i]))try{M(Dv,this)[i].fill(o),M(Lv,this)[i]=r,t=!0}catch(e){}}return t}function Ag(){if(M($v,this))return;const e="function"==typeof ld.requestAnimationFrame?e=>ld.requestAnimationFrame(e):e=>setTimeout(e,16),t="function"==typeof ld.cancelAnimationFrame?e=>ld.cancelAnimationFrame(e):clearTimeout;C(jv,this,t);const n=()=>{var t,i;if(null!==(t=M(Ov,this))&&void 0!==t&&null!==(i=t.getState)&&void 0!==i&&i.call(t)){if(M(zv,this)){const e=A(Qv,this,lg).call(this),t=Date.now();(!e||!M(Uv,this)||t-M(Uv,this)>=e)&&(C(Uv,this,t),A(Qv,this,Fg).call(this,M(zv,this)))}C($v,this,e(n))}else C($v,this,null)};C($v,this,e(n))}function Ng(){M($v,this)&&M(jv,this)&&M(jv,this).call(this,M($v,this)),C($v,this,null),C(jv,this,null),C(Uv,this,null)}function Mg(e){var t,n;const i=null===(t=M(Ov,this))||void 0===t||null===(n=t.getState)||void 0===n?void 0:n.call(t);return"out"===(null==i?void 0:i.phase)&&M(Wv,this)?M(Wv,this):e}function Fg(e={}){var t,n;const i=null===(t=M(xv,this))||void 0===t?void 0:t.element,r=null===(n=M(xv,this))||void 0===n?void 0:n.gl;if(!i||!r)return;if(e&&C(zv,this,e),!A(Qv,this,Cg).call(this))return;const o=A(Qv,this,Mg).call(this,e),s=Number.isFinite(null==o?void 0:o.time)?o.time:void 0;if(!Number.isFinite(s))return;if(A(Qv,this,og).call(this,i),!M(Pv,this))return;const a=M(wv,this)&&"function"==typeof M(wv,this).getActiveRenderPlacement?M(wv,this).getActiveRenderPlacement(s):void 0,l=A(Qv,this,bg).call(this,a);l!==M(Gv,this)&&C(Gv,this,l);const c=Array.isArray(null==o?void 0:o.frames)?o.frames:[],u=A(Qv,this,yg).call(this,a),d=A(Qv,this,wg).call(this,u),h=A(Qv,this,gg).call(this,a,c,s,u),f=A(Qv,this,hg).call(this,a,s,u),p=A(Qv,this,ug).call(this,h,{useViewportSize:d}),m=A(Qv,this,Sg).call(this,h),v=A(Qv,this,_g).call(this,a,h,s,u,f),g=A(Qv,this,Tg).call(this);let y=v.graph,b=v.signature,k=!!v.isDynamic;g&&Array.isArray(g.graph)&&g.graph.length&&(y=y.concat(g.graph),b=`${b}|${g.signature||"transition"}`,k=k||!!g.forceUpdate);const w=p||m||k||g&&Array.isArray(g.graph)&&g.graph.length;A(Qv,this,Ig).call(this,y,b,k,w)&&h.length&&A(Qv,this,rg).call(this)}function Cg(){var e;const t=null===(e=M(wv,this))||void 0===e?void 0:e.state;return t===av||t===cv||t===lv||t===dv}function Og(e){return"number"==typeof e&&Number.isFinite(e)&&e>0}function Pg(e){return e&&"resource"===e.entryType&&e.transferSize>0&&e.duration>0&&e.responseEnd>=e.requestStart}function Rg(e){return Array.isArray(e)&&0!==e.length?e.reduce(((e,t)=>e+t),0)/e.length:NaN}st=Jv;var Dg=new WeakMap,Lg=new WeakMap,Bg=new WeakMap,zg=new WeakMap,Wg=new WeakSet;class $g extends od{get name(){return"DownloadSpeedGuesstimator"}get defaults(){return{persistentStorage:{key:"ekoDownloadSpeedKbps",ttl:-1},priorities:[["resourceTiming","downlink","persistentValue"],["resourceTiming","downlink"],["resourceTiming","persistentValue","ua"],["resourceTiming","ua","defaultKbps"],["downlink","persistentValue"],["downlink"],["persistentValue"],["connectionType"],["ua"],["defaultKbps"]],defaultKbps:2500,connectionType:{"slow-2g":50,"2g":70,"3g":700,"4g":3500,bluetooth:750,cellular:750,ethernet:3500,wifi:2500,wimax:2500,none:0},ua:{desktop:2500,ios:2500,android:2500}}}constructor(...e){super(...e),O(this,Wg),F(this,Dg,void 0),F(this,Lg,void 0),F(this,Bg,void 0),F(this,zg,void 0),C(Dg,this,!!(ld&&ld.navigator&&ld.navigator.connection)),C(Lg,this,!(!ld||!ld.performance||"function"!=typeof ld.performance.getEntriesByType)),C(Bg,this,A(Wg,this,Ug).call(this)),C(zg,this,A(Wg,this,Kg).call(this))}guesstimate(){const e=A(Wg,this,Yg).call(this);this.log.debug("[guesstimate] Data:",e);const t=A(Wg,this,Xg).call(this,e),n=Og(t)?t:e.defaultKbps;return A(Wg,this,qg).call(this,n),this.log.info(`[guesstimate] Result: ${n} kbps`),n}update(e){Og(e)&&A(Wg,this,qg).call(this,e)}onDispose(){C(Bg,this,void 0),C(zg,this,void 0)}}function jg(){return Math.round(Date.now()/1e3)}function Ug(){try{if(!ld||!ld.localStorage||"function"!=typeof ld.localStorage.getItem)return}catch(e){return}const e=this.settings.persistentStorage.key,t=ld.localStorage.getItem(e);if(t)try{const e=JSON.parse(t),n=this.settings.persistentStorage.ttl,i=A(Wg,this,jg).call(this)-e.timestamp;if("number"==typeof n&&n>=0&&i>n)return null;if(!Og(e.value))return;return e.value}catch(e){return}}function qg(e){if(!Og(e))return;try{if(!ld||!ld.localStorage||"function"!=typeof ld.localStorage.setItem)return}catch(e){return}const t=this.settings.persistentStorage.key,n=JSON.stringify({value:e,timestamp:A(Wg,this,jg).call(this)});try{ld.localStorage.setItem(t,n),C(Bg,this,e)}catch(e){}}function Vg(){return ld&&ld.performance&&"function"==typeof ld.performance.getEntriesByType?Rg(ld.performance.getEntriesByType("resource").filter(Pg).map((e=>8*e.transferSize/e.duration))):NaN}function Gg(){if(!ld||!ld.navigator||!ld.navigator.connection)return NaN;const e=ld.navigator.connection.downlink;return Og(e)?1e3*e:NaN}function Hg(){if(!M(Dg,this))return NaN;const e=ld.navigator.connection,t=e.effectiveType||e.type,n=this.settings.connectionType||{};return t&&Object.prototype.hasOwnProperty.call(n,t)?n[t]:NaN}function Kg(){const e=this.settings.ua||{};return Xm()?e.android:Ym()?e.ios:e.desktop}function Xg(e){const t=Array.isArray(this.settings.priorities)?this.settings.priorities:[];for(let n=0;n<t.length;n+=1){const i=t[n];if(!Array.isArray(i)||0===i.length)continue;const r=i.map((t=>e[t])).filter((e=>Og(e)));if(r.length===i.length)return this.log.debug("[#selectFromPriorities] Selected from priorities:",i,"with values:",r),Rg(r)}return NaN}function Yg(){const e=this.settings.testOverrides||{},t=Og(e.resourceTiming)?e.resourceTiming:A(Wg,this,Vg).call(this),n=Og(e.downlink)?e.downlink:A(Wg,this,Gg).call(this),i=Og(e.persistentValue)?e.persistentValue:M(Bg,this),r=Og(e.connectionType)?e.connectionType:A(Wg,this,Hg).call(this),o=Og(e.ua)?e.ua:M(zg,this);return{defaultKbps:this.settings.defaultKbps,resourceTiming:t,downlink:n,connectionType:r,persistentValue:i,ua:o}}const Qg=new Zu;function Jg(e){return"string"!=typeof e||0===e.length?[]:e.split(".").filter((e=>e.length>0))}function Zg(e){if("string"!=typeof e)return!1;if(0===e.length)return!1;const t=Number(e);return Number.isInteger(t)&&String(t)===e}function ey(e){return null!==e&&"object"==typeof e}function ty(e,t,n){const i=Jg(t);if(0===i.length)return void 0===e?n:e;let r=e;for(let e=0;e<i.length;e+=1){if(null==r)return n;if(r=r[i[e]],void 0===r)return n}return void 0===r?n:r}function ny(e,t,n){if(!ey(e))return e;const i=Jg(t);if(0===i.length)return e;let r=e;for(let e=0;e<i.length;e+=1){const t=i[e];if(e===i.length-1){r[t]=n;break}ey(r[t])||(r[t]=Zg(i[e+1])?[]:{}),r=r[t]}return e}const iy={get:(e,t)=>ld&&ld.eko?ty(ld.eko,e,t):t,set(e,t){if(ld)return ld.eko&&"object"==typeof ld.eko||(ld.eko={}),ny(ld.eko,e,t),ld.eko}},ry=ld&&ld.performance,oy=ry&&"function"==typeof ry.now?()=>ry.now():()=>Date.now();function sy(){return"undefined"==typeof AbortController?null:new AbortController}function ay(){const e=new Error("The operation was aborted");return e.name="AbortError",e.code="ABORT_ERR",e}function ly(e,t){return!(!t||!t.aborted)||!!e&&("AbortError"===e.name||"ABORT_ERR"===e.code||20===e.code)}const cy=2,uy=100,dy=2,hy="runtime.downloadSpeedSamples",fy=Ju("download","warn");function py(e){return new Promise((t=>{setTimeout(t,e)}))}function my(e){return e>=500}function vy(e){if(!e||!e.headers||"function"!=typeof e.headers.get)return 0;const t=e.headers.get("content-length");if(!t)return 0;const n=Number(t);return Number.isNaN(n)||n<0?0:n}function gy(e,t,n,i,r,o){const s={bytes:e,durationMs:t,kbps:t>0?8*e/t:0,startTime:n,endTime:i,url:o};try{let e=iy.get(r);e||(e=[],iy.set(r,e)),e.push(s)}catch(e){}return s}async function yy(e,t={}){const{method:n="GET",headers:i,body:r,retries:o=cy,retryDelay:s=uy,backoffFactor:a=dy,samplesTargetPath:l=hy,fetch:c,loglevel:u="warn",cache:d,signal:h,onProgress:f,returnType:p="default"}=t;fy.setLevel(u);const m=function(e){if(e)return e;if(ld&&"function"==typeof ld.fetch)return ld.fetch.bind(ld);throw new Error("fetch is not available in this environment")}(c);let v=0,g=s;for(;;){if(h&&h.aborted)throw ay();const t=oy();try{const s=await m(e,{method:n,headers:i,body:r,cache:d,mode:"cors",signal:h});if(h&&h.aborted)throw ay();if(!s.ok){if(v<o&&my(s.status)){v+=1,fy.warn(`[${e}] Download attempt #${v} failed with status ${s.status}, retrying in ${g}ms...`),await py(g),g*=a;continue}fy.error(`[${e}] Download attempt #${v} failed with status ${s.status}, no more retries.`);const t=new Error(`Download failed with status ${s.status}`);throw t.status=s.status,t}let c=oy();const u=vy(s),y="arrayBuffer"===p||"bytes"===p,b=y&&"function"==typeof f;let k,w,x,_,T,I=0;if(y&&s.body&&"function"==typeof s.body.getReader&&b){const e=s.body.getReader(),t=[];for(;;){if(h&&h.aborted)throw ay();const{done:n,value:i}=await e.read();if(n)break;if(i&&i.length){const e=oy();Number.isFinite(_)||(_=e),T=e,t.push(i),I+=i.length,f({loaded:I,total:u||void 0,chunk:i})}}k=new Uint8Array(I);let n=0;t.forEach((e=>{k.set(e,n),n+=e.length})),c=oy()}else if(y){const e=await s.arrayBuffer();k=new Uint8Array(e),I=k.length,c=oy()}else"text"===p?(w=await s.text(),c=oy()):"json"===p&&(x=await s.json(),c=oy());if(h&&h.aborted)throw ay();const E=y?k?k.length:I:("text"===p&&"string"==typeof w?w.length:0)||("json"===p&&x?JSON.stringify(x).length:0),S=u||E||0;let A=t,N=c;Number.isFinite(_)&&(A=_,Number.isFinite(T)&&(N=Math.max(T,c))),(!Number.isFinite(A)||!Number.isFinite(N)||N<A)&&(A=t,N=c);const M=Math.max(0,N-A),F=gy(S,M,A,N,l,e);try{Qg.trigger("download:sample",F)}catch(e){}const C={response:s,bytes:S,durationMs:M,kbps:F.kbps,startTime:F.startTime,endTime:F.endTime};if("default"===p)return C;if("arrayBuffer"===p||"bytes"===p){const e=k||new Uint8Array(await s.arrayBuffer());return"arrayBuffer"===p?e.buffer:e}return"text"===p?w:"json"===p?x:C}catch(t){if(ly(t,h))throw"AbortError"===t.name?t:ay();if(!(v<o)||t.status&&!my(t.status))throw fy.error(`[${e}] Download attempt #${v} failed with error ${t}, no more retries.`),t;v+=1,fy.warn(`[${e}] Download attempt #${v} failed with error ${t}, retrying in ${g}ms...`),await py(g),g*=a}}}const by={disabledTracks:{default:["audio"],targetPaths:["NodeRepository.disabledTracks"]},muted:{default:!1,targetPaths:["AudioPlaybackManager.muted"]},volume:{default:1,targetPaths:["AudioPlaybackManager.volume"]},encodeProfile:{default:null,targetPaths:["AssetsDeliveryService.profile"]},forceVideoCodec:{default:void 0,targetPaths:["NodeRepository.forceVideoCodec"]},forceImageFallback:{default:!1,targetPaths:["NodeRepository.forceImageFallback"]},mediaHostRewriteMap:{default:{"storageeko.s3.amazonaws.com":"https://storage.eko.com","studioz-post.s3.amazonaws.com":"https://studioz-post.eko.com"},targetPaths:["NodeRepository.mediaHostRewriteMap"]},playbackRate:{default:1,targetPaths:["PlaybackClock.playbackRate"]},initialKbps:{default:"auto",targetPaths:["DownloadSpeed.initialKbps"]},defaultRenderParams:{default:void 0,targetPaths:["Renderer.defaultRenderParams"]},maxBufferedVideoFrames:{default:24,targetPaths:["Timeline.maxBufferedVideoFrames"]},waitingBufferAheadSeconds:{default:3,targetPaths:["Timeline.waitingBufferAheadSeconds"]},abrStrategy:{default:"auto",targetPaths:["ABRSelector.abrStrategy"]},segmentEvictionEnabled:{default:!0,targetPaths:["SegmentEvictionCoordinator.enabled"]},segmentEvictionBufferBehindSeconds:{default:30,targetPaths:["SegmentEvictionCoordinator.bufferBehindSeconds"]},segmentEvictionBufferAheadSeconds:{default:30,targetPaths:["SegmentEvictionCoordinator.bufferAheadSeconds"]},segmentEvictionMaxRetainedBytes:{default:52428800,targetPaths:["SegmentEvictionCoordinator.maxRetainedBytes"]},autoplay:{default:!0,targetPaths:["Idle.autoplay"]},autoPauseOnVisibilityChange:{default:!0,targetPaths:["DocumentVisibility.autoPauseOnVisibilityChange"]},autoResumeOnVisibilityChange:{default:!0,targetPaths:["DocumentVisibility.autoResumeOnVisibilityChange"]},trackingEnabled:{default:!0,targetPaths:["Tracker.trackingEnabled"]}},ky=Object.freeze(Object.entries(by).reduce(((e,[t,n])=>(Object.prototype.hasOwnProperty.call(n,"default")&&(e[t]=n.default),e)),{})),wy=Ju("config","warn");function xy(e){return ky[e]}var _y=new WeakMap,Ty=new WeakMap,Iy=new WeakMap,Ey=new WeakMap,Sy=new WeakMap,Ay=new WeakSet;class Ny extends od{get name(){return"DownloadSpeed"}get defaults(){return{alpha:.3,maxSamples:30,minBytesPerSample:1024,minDurationMs:5,maxSampleKbpsCap:void 0,ignoreCacheHits:!0,samplesPath:"runtime.downloadSpeedSamples",initialKbps:xy("initialKbps"),probeUrl:void 0,defaultKbps:2500}}constructor(...e){super(...e),O(this,Ay),F(this,_y,void 0),F(this,Ty,void 0),F(this,Iy,void 0),F(this,Ey,void 0),F(this,Sy,void 0),C(Iy,this,[]),C(Ty,this,0),C(_y,this,A(Ay,this,Cy).call(this)),C(Sy,this,sy()),C(Ey,this,(e=>{A(Ay,this,By).call(this,e,"event")})),A(Ay,this,Oy).call(this),Qg.on("download:sample",M(Ey,this)),A(Ay,this,Py).call(this),this.log.debug(`[#constructor] Initial estimate: ${M(_y,this)} kbps`)}getKbps(){return M(_y,this)}addSample(e){A(Ay,this,By).call(this,e,"manual")}reset(){C(Iy,this,[]),C(Ty,this,0),C(_y,this,A(Ay,this,Cy).call(this))}onDispose(){M(Sy,this)&&M(Sy,this).abort(),C(Sy,this,null),Qg.off("download:sample",M(Ey,this)),C(Iy,this,[]),C(Ty,this,0),C(_y,this,void 0),C(Ey,this,null)}}function My(e,t){return!!(this.settings.ignoreCacheHits&&(0===t||e&&"boolean"==typeof e.cached&&e.cached||e&&"number"==typeof e.transferSize&&"number"==typeof e.encodedBodySize&&e.transferSize<=e.encodedBodySize))}function Fy(e){if(!e||"object"!=typeof e)return null;const t=Number(e.bytes),n=Number(e.durationMs);let i=Og(e.kbps)?Number(e.kbps):NaN;return!Og(i)&&n>0&&Og(t)&&(i=8*t/n),Og(i)?t<=this.settings.minBytesPerSample||n<=this.settings.minDurationMs||A(Ay,this,My).call(this,e,t)?null:(Og(this.settings.maxSampleKbpsCap)&&i>this.settings.maxSampleKbpsCap&&(i=this.settings.maxSampleKbpsCap),{...e,bytes:t,durationMs:n,kbps:i}):null}function Cy(){const e=this.settings.initialKbps;if(Og(e))return e;if("auto"===e)try{const e=(new $g).guesstimate();if(Og(e))return e}catch(e){}return this.settings.defaultKbps}function Oy(){const e=iy.get(this.settings.samplesPath,[]);if(!Array.isArray(e)||0===e.length)return;const t=e.slice(-this.settings.maxSamples);for(let e=0;e<t.length;e+=1)A(Ay,this,By).call(this,t[e],"replay",{emit:!1})}async function Py(){if(!this.settings.probeUrl||M(Ty,this)>0)return;const e=M(Sy,this)?M(Sy,this).signal:void 0;if(!e||!e.aborted)try{await yy(this.settings.probeUrl,{cache:"no-store",samplesTargetPath:this.settings.samplesPath,signal:e})}catch(e){}}function Ry(e){return"number"==typeof e.startTime&&"number"==typeof e.endTime&&Number.isFinite(e.startTime)&&Number.isFinite(e.endTime)&&e.startTime>=0&&e.endTime>e.startTime}function Dy(e,t){if(!A(Ay,this,Ry).call(this,e)||!A(Ay,this,Ry).call(this,t))return 0;const n=Math.max(e.startTime,t.startTime);return Math.min(e.endTime,t.endTime)-n}function Ly(e){if(!A(Ay,this,Ry).call(this,e))return e;const t=[];for(let n=0;n<M(Iy,this).length;n+=1){const i=M(Iy,this)[n];A(Ay,this,Ry).call(this,i)&&(A(Ay,this,Dy).call(this,e,i)>0&&t.push(i))}if(0===t.length)return e;C(Iy,this,M(Iy,this).filter((e=>!t.includes(e))));const n=[e,...t],i=n.reduce(((e,t)=>e+(t.bytes||0)),0),r=Math.min(...n.map((e=>e.startTime))),o=Math.max(...n.map((e=>e.endTime))),s=o-r;if(!Og(i)||s<=0)return e;const a={bytes:i,durationMs:s,kbps:8*i/s,startTime:r,endTime:o,url:e.url||t[t.length-1].url};return A(Ay,this,Fy).call(this,a)}function By(e,t,{emit:n=!0}={}){const i=A(Ay,this,Fy).call(this,e);if(!i)return;const r=A(Ay,this,Ly).call(this,i);if(!r)return;C(Ty,this,M(Ty,this)+1),M(Iy,this).push(r),M(Iy,this).length>this.settings.maxSamples&&M(Iy,this).shift();const o=this.defaults.alpha,s="number"==typeof this.settings.alpha?this.settings.alpha:o,a=Og(M(_y,this)),l=a?M(_y,this):r.kbps,c=a||1!==M(Ty,this)?s*r.kbps+(1-s)*l:r.kbps;C(_y,this,c),this.log.debug(`[#ingestSample] Next estimate: ${c} kbps`),n&&this.trigger("download:speed",{kbps:M(_y,this),sample:r,source:t,samplesCount:M(Ty,this)})}class zy{constructor(e={}){const{id:t,url:n,uri:i,mime:r,codecs:o,bandwidth:s,timescale:a,sizeBytes:l,...c}=e;if(!t)throw new Error("Representation requires id");const u=n||i;if(!u)throw new Error("Representation requires url or uri");this.id=t,this.url=u,this.mime=r,this.codecs=o,this.baseCodec=function(e=""){if(!e||"string"!=typeof e)return;const t=e.split(",")[0].trim();if(!t)return;const n=t.match(/^[a-z0-9]+/i);return n?n[0].toLowerCase():void 0}(o),Og(s)&&(this.bandwidth=s),Og(a)&&(this.timescale=a),Og(l)&&(this.sizeBytes=l),Object.assign(this,c)}}class Wy{#P=new Map;#R;#D;#L=0;#B;constructor(e={}){const{id:t,offset:n=0,duration:i=0,isInit:r=!1,representations:o=[]}=e;if(!t)throw new Error("Segment requires id");o.forEach((e=>{if(!e||!e.url&&!e.uri)throw new Error("Segment representation must include uri or url")})),this.id=t,this.offset=n,this.duration=i,this.isInit=!!r,this.originalRepresentations=o.map((e=>e instanceof zy?e:new zy(e))),this.representations=this.originalRepresentations.map((e=>e)),this.appliedFilters=[],this.loadAttempts=0,this.loadError=void 0}setRepresentationBuffer(e,t){e&&t&&this.#P.set(e,t)}setDownloadProgress(e,t){const n=Number(e);Number.isFinite(n)&&n>=0&&(this.#L=Math.max(this.#L,n));const i=Number(t);Number.isFinite(i)&&i>0&&(this.#B=i)}setChosenRepresentation(e){this.#R=e;const t=null==e?void 0:e.id;if(!(this.isInit||!t||this.#P.size<=1))for(const e of this.#P.keys())e!==t&&this.#P.delete(e)}setABRDecisionSnapshot(e){if(!e||"object"!=typeof e)return void(this.#D=void 0);const t={...e};Array.isArray(e.availableRepresentations)&&(t.availableRepresentations=e.availableRepresentations.map((e=>({...e})))),this.#D=t}markLoadAttempt(){const e=Number(this.loadAttempts);this.loadAttempts=Number.isFinite(e)&&e>0?e+1:1,this.loadError=void 0}setLoadError(e){this.loadError=e||new Error("Segment load failed")}getRepresentationBuffer(e){return this.#P.get(e)}get chosenRepresentation(){return this.#R}get abrDecision(){return this.#D}get arrayBuffer(){return this.#R?this.#P.get(this.#R.id):void 0}get retainedByteLength(){let e=0;for(const t of this.#P.values())t&&"number"==typeof t.byteLength&&(e+=t.byteLength);return e}get bufferedRatio(){var e;const t=Og(this.#B)?this.#B:null===(e=this.#R)||void 0===e?void 0:e.sizeBytes;return Og(t)?Math.min(1,Math.max(0,this.#L/t)):this.retainedByteLength>0?1:0}get isLoaded(){return this.retainedByteLength>0}evict(){this.#R=void 0,this.#D=void 0,this.#P.clear(),this.#L=0,this.#B=void 0}}class $y{constructor(e={}){const{timestamp:t,name:n,data:i,isSticky:r=!1}=e;this.timestamp="number"==typeof t?t:0,this.name="string"==typeof n?n:"",this.data=i,this.isSticky="boolean"==typeof r&&r}}function jy(e,t){const n=Number(null==e?void 0:e.offset),i=Number(null==e?void 0:e.duration);if(!t)return{offset:n,duration:i};const r=(null==e?void 0:e.chosenRepresentation)||(Array.isArray(null==e?void 0:e.representations)?e.representations[0]:void 0),o=Number(null==r?void 0:r.segStart),s=Number(null==r?void 0:r.segDuration);return Number.isFinite(o)&&Number.isFinite(s)&&s>0?{offset:o,duration:s}:{offset:n,duration:i}}function Uy(e,t,n={}){if(!Array.isArray(e)||!e.length)return;const i=Number(t);if(!Number.isFinite(i))return;const r=!!n.preferRepresentationTime;let o,s,a=-1/0;for(let t=0;t<e.length;t+=1){const n=e[t];if(!n||n.isInit)continue;o||(o=n);const l=jy(n,r);if(!Number.isFinite(l.offset))continue;const c=Number(l.duration);if(Number.isFinite(c)&&c>0&&i>=l.offset&&i<l.offset+c)return n;l.offset<=i&&l.offset>a&&(a=l.offset,s=n)}return s||o}const qy=new Set(["video","audio","image","cue","data","bbox"]);class Vy{constructor(e={}){const{id:t,type:n,offset:i=0,duration:r,source:o,segments:s=[],cues:a=[]}=e;if(!t)throw new Error("Track requires id");if(!qy.has(n))throw new Error(`Track type must be one of ${Array.from(qy).join("|")}`);this.id=t,this.type=n,this.offset=i,this.duration=Og(r)?r:void 0,this.source=o,"cue"===n?(this._cues=a.map((e=>e instanceof $y?e:new $y(e))),this._segments=[]):(this._segments=s.map((e=>e instanceof Wy?e:new Wy(e))),this._cues=void 0)}get segments(){return this._segments.slice()}get cues(){if("cue"===this.type)return this._cues.slice()}get endTime(){if(Og(this.duration))return this.offset+this.duration;if(!this._segments.length)return;const e=this._segments.reduce(((e,t)=>{const n=Og(t.duration)?t.duration:0;return Math.max(e,t.offset+n)}),this.offset);return e}get buffered(){const e=this._segments.map((e=>({duration:Og(null==e?void 0:e.duration)?e.duration:0,offset:Og(null==e?void 0:e.offset)?e.offset:0,ratio:e&&!e.isInit&&"number"==typeof e.bufferedRatio?e.bufferedRatio:0}))).filter((e=>e.duration>0&&e.ratio>0));if(!e.length)return;const t=e.reduce(((e,t)=>Math.min(e,t.offset)),1/0),n=e.reduce(((e,t)=>{const n=t.offset+t.duration*Math.min(1,t.ratio);return Math.max(e,n)}),0);return!Number.isFinite(t)||!Number.isFinite(n)||n<=t?void 0:{start:t,end:n}}getMediaSegmentAtTime(e,t={}){return Uy(this._segments,e,t)}setSegments(e=[]){if("cue"===this.type)return;const t=Array.isArray(e)?e:[];this._segments=t.map((e=>e instanceof Wy?e:new Wy(e)))}}function Gy(e){return"string"==typeof e?e:e&&"object"==typeof e?e.nodeId||e.nodeIdOrRef||e.id:void 0}function Hy(e){const t=Gy(e);let n=1;if(e&&"object"==typeof e&&Og(e.weight)&&(n=e.weight),!t)throw new Error("Child entry requires a nodeId");return{nodeId:t,weight:n}}function Ky(e){return(Array.isArray(e)?e:[]).map((e=>Hy(e)))}function Xy(e,t=void 0){if("string"==typeof e){const t=e.match(/\d+\.?\d*/);if(t){const e=Number(t[0]);if(Number.isFinite(e))return e}}else if("number"==typeof e&&Number.isFinite(e))return e;return t}function Yy(e,t){if(e){if(e.includes("$Number%")){const n=e.match(/\$Number%0(\d+)d\$/);if(n){const i=Number(n[1]),r=String(t).padStart(i,"0");return e.replace(/\$Number%0\d+d\$/,r)}}return e.replace(/\$Number\$/g,String(t))}}function Qy(e,t){if(t)try{var n;return new URL(t,e||(null==ld||null===(n=ld.location)||void 0===n?void 0:n.href)||void 0).toString()}catch(e){return t}}const Jy=new Map;class Zy{static register(e,t){if(!e||"function"!=typeof t)throw new Error("ManifestFactory.register requires type and parser function");Jy.set(e,t)}static inferType(e={}){const{typeHint:t,url:n,mimeType:i,body:r}=e;return t||function(e=""){const t=function(e=""){return e&&"string"==typeof e?e.split("#")[0].split("?")[0].toLowerCase():""}(e);return t.endsWith(".mpd")?"dash":t.endsWith(".ivd")?"ivd":t.endsWith(".jpg")||t.endsWith(".jpeg")||t.endsWith(".png")||t.endsWith(".webp")||t.endsWith(".gif")||t.endsWith(".avif")?"image":void 0}(n||"")||function(e=""){const t=e.toLowerCase();return t.includes("dash")||t.includes("mpd")||t.includes("xml")?"dash":t.includes("ivd")||t.includes("json")?"ivd":t.includes("image/")?"image":void 0}(i||"")||function(e=""){const t="string"==typeof e?e.trim():"";if(t.startsWith("<")&&t.includes("<MPD"))return"dash";if(t.startsWith("{"))try{const e=JSON.parse(t);if(e&&"object"==typeof e)return"ivd"}catch(e){return}}(r||"")}static parse(e={}){const t=Zy.inferType(e);if(!t||!Jy.has(t))throw new Error("Unsupported manifest type");return Jy.get(t)(e)}}Zy.register("dash",(function(e={}){const{body:t,url:n}=e,i=function(){if(ld&&"function"==typeof ld.DOMParser)return new ld.DOMParser;throw new Error("DOMParser is not available in this environment")}().parseFromString(t||"","application/xml"),r=i.getElementsByTagName("MPD")[0];if(!r)throw new Error("Invalid MPD");const o=i.getElementsByTagName("Period")[0],s=o?Array.from(o.getElementsByTagName("AdaptationSet")):[],a=[];let l=Xy(r.getAttribute("mediaPresentationDuration"));l=Number.isFinite(l)?l:void 0,s.forEach(((e,t)=>{const i=e.getAttribute("mimeType")||"",r=function(e=""){const t=e.toLowerCase();return t.includes("video")?"video":t.includes("audio")?"audio":t.includes("image")?"image":"data"}(i),o=e.getAttribute("id")||`${r}-${t+1}`,s=e.getElementsByTagName("SegmentTemplate")[0],c=Array.from(e.getElementsByTagName("Representation")).map((e=>function(e,t,n){const i=e.getAttribute("id")||e.getAttribute("representationId")||"",r=Xy(e.getAttribute("bandwidth")),o=e.getAttribute("codecs"),s=e.getAttribute("mimeType")||t&&t.getAttribute("mimeType")||n,a=e.getElementsByTagName("SegmentTemplate")[0]||t;return{repId:i,bandwidth:r,codecs:o,mime:s,media:a?a.getAttribute("media"):void 0,initialization:a?a.getAttribute("initialization"):void 0,timescale:Xy(a&&a.getAttribute("timescale"))||Xy(t&&t.getAttribute("timescale"),1)||1,startNumber:Xy(a&&a.getAttribute("startNumber"))||Xy(t&&t.getAttribute("startNumber"),1)||1,timeline:function(e){const t=[],n=e.getElementsByTagName("SegmentTimeline")[0];if(!n)return t;const i=Array.from(n.getElementsByTagName("S"));let r=0;for(let e=0;e<i.length;e+=1){const n=i[e],o=Xy(n.getAttribute("t")),s=Xy(n.getAttribute("d")),a=Xy(n.getAttribute("r"),0);if(!Og(s))continue;Og(o)&&(r=o);const l=a>=0?a:0;for(let e=0;e<=l;e+=1)t.push({start:r,duration:s}),r+=s}return t}(a)}}(e,s,i))),u=c.map((e=>({id:e.repId,url:Qy(n,Yy(e.initialization,e.startNumber)),bandwidth:e.bandwidth,mime:e.mime,codecs:e.codecs,timescale:e.timescale}))).filter((e=>e.url)),d=c.reduce(((e,t)=>{const n=Array.isArray(null==e?void 0:e.timeline)?e.timeline.length:0;return(Array.isArray(null==t?void 0:t.timeline)?t.timeline.length:0)>n?t:e}),c[0]),h=Array.isArray(null==d?void 0:d.timeline)?d.timeline:[],f=h.length,p=[],m=(null==d?void 0:d.timescale)||1;u.length>0&&p.push({id:`init-${o}`,offset:0,duration:0,isInit:!0,representations:u});for(let e=0;e<f;e+=1){const t=h[e];if(!t)continue;const i=c.map((t=>{const i=t.startNumber+e,r=t.timescale||m,o=Array.isArray(t.timeline)?t.timeline[e]:void 0;if(!o)return null;const s=o.start,a=o.duration;return{id:t.repId,url:Qy(n,Yy(t.media,i)),bandwidth:t.bandwidth,mime:t.mime,codecs:t.codecs,timescale:t.timescale,segIndex:e,segStart:s/r,segDuration:a/r}})).filter(Boolean);i.length&&p.push({id:`${o}-seg-${e+1}`,offset:t.start/m,duration:t.duration/m,isInit:!1,representations:i})}a.push({id:o,type:r,offset:0,duration:l,segments:p})}));const c=a[0]?a[0].id:void 0;return{id:n||r.getAttribute("id")||"mpd",mainTrackId:c,tracks:a,duration:l}})),Zy.register("ivd",(function(e={}){var t;const{body:n,url:i}=e;let r;try{r="string"==typeof n?JSON.parse(n):n}catch(e){throw new Error("Invalid IVD manifest")}if(!r||"object"!=typeof r)throw new Error("Invalid IVD manifest");const o=Array.isArray(r.representations)?r.representations:[],s=new Map;o.forEach(((e,t)=>{const n=function(e){const t=(e.mimeType||"").toLowerCase();return t.includes("video")?"video":t.includes("audio")?"audio":"data"}(e),i=Number.isInteger(e.altIndex)?e.altIndex:0,r=`${n}-${i}`,o=(l=t,{id:`${(a=e).format||"unknownformat"}-${a.altIndex||0}-${a.label||l+1}`,url:a.url,mime:a.mimeType,codecs:a.codecs,bandwidth:a.bandwidth||a.audioBandwidth||a.videoBandwidth,sizeBytes:a.contentLength,duration:Og(a.duration)?a.duration:void 0,segIndex:Number.isInteger(a.segIndex)&&a.segIndex>=0?a.segIndex:0});var a,l;s.has(r)||s.set(r,{type:n,altIndex:i,reps:[]}),s.get(r).reps.push(o)}));const a=Array.from(s.values()).map(((e,t)=>{const n=new Map;e.reps.forEach((e=>{const t=Number.isInteger(e.segIndex)?e.segIndex:0;n.has(t)||n.set(t,[]),n.get(t).push(e)}));const i=Array.from(n.keys()).sort(((e,t)=>e-t));let o=0;const s=i.map((i=>{var r;const s=n.get(i)||[],a=(null===(r=s.find((e=>Og(e.duration))))||void 0===r?void 0:r.duration)||0,l={id:`${e.type}-${e.altIndex}-${t+1}-seg-${i+1}`,offset:o,duration:a,isInit:!1,representations:s.map((e=>{const{duration:t,segIndex:n,...i}=e;return i}))};return o+=a,l})),a=s.reduce(((e,t)=>e+(Og(t.duration)?t.duration:0)),0),l=Og(r.duration)?r.duration:a||void 0;return{id:`${e.type}-${e.altIndex}-${t+1}`,type:e.type,offset:0,duration:l,segments:s}})),l=r.mainTrackId||(null===(t=a.find((e=>"video"===e.type)))||void 0===t?void 0:t.id)||a[0]&&a[0].id,c=a.find((e=>e.id===l)),u=(null==c?void 0:c.duration)||void 0;return{id:r.id||i||"ivd",metadata:r.metadata||{},mainTrackId:l,tracks:a,duration:u}})),Zy.register("image",(function(e={}){const t=null==e?void 0:e.url;if(!t||"string"!=typeof t)throw new Error("ImageParser requires url");const n=Og(null==e?void 0:e.duration)?e.duration:30,i=Og(null==e?void 0:e.width)?e.width:void 0,r=Og(null==e?void 0:e.height)?e.height:void 0,o={id:"image-1",url:t,mime:"string"==typeof(null==e?void 0:e.mimeType)?e.mimeType:void 0};Og(i)&&Og(r)&&(o.width=i,o.height=r);const s="image-1";return{id:t,metadata:{},mainTrackId:s,tracks:[{id:s,type:"image",offset:0,duration:n,segments:[{id:"image-1-seg-1",offset:0,duration:n,isInit:!1,representations:[o]}]}],duration:n}}));const eb=["video/mp4"];function tb(e){return eb.includes(e.mime)}var nb={name:"containers",fn:function(e=[]){return e.filter(tb)},isRelevantForTrack:function(e){return"video"===(null==e?void 0:e.type)}};const ib=new(at=new WeakMap,lt=new WeakSet,class extends od{get name(){return"MediaCapabilities"}get defaults(){return{enabled:!0,smoothWeight:10,powerWeight:10,ignoreSmooth:!1,ignorePower:!0,codecBonus:{av01:.2,hvc1:.15,hev1:.15,vp09:.1,avc1:0}}}constructor(...e){super(...e),O(this,lt),F(this,at,void 0),C(at,this,new Map)}onDispose(){M(at,this)&&M(at,this).clear()}async sortRepsCodecs(e=[]){if(!Array.isArray(e)||0===e.length)return[];const t=[],n=new Set;let i=0;e.forEach((e=>{const r=null==e?void 0:e.baseCodec;r&&!n.has(r)&&(n.add(r),t.push({codec:r,rep:e,index:i}),i+=1)}));const r=(await Promise.all(t.map((async e=>{const{score:t}=await A(lt,this,lb).call(this,e.rep);return{...e,score:t}})))).sort(((e,t)=>{const n=t.score-e.score;return 0!==n?n:e.index-t.index}));return this.log.info("[sortRepsCodecs] Sorted entries:",r),r.map((e=>e.codec))}});function rb(){return!!(ld&&ld.navigator&&ld.navigator.mediaCapabilities&&"function"==typeof ld.navigator.mediaCapabilities.decodingInfo)}function ob(e){if(!e||"object"!=typeof e)return void this.log.debug("[#buildConfig] Invalid representation:",e);const t=e.mime||e.mimeType||"",n=function(e="",t=""){const n=e||"",i=t||"";return i?`${n}; codecs="${i}"`:n}(t,e.codecs||"");return function(e=""){return e.toLowerCase().includes("video")}(t)?(this.log.debug("[#buildConfig] Building video config for:",e),{type:"file",video:{contentType:n,width:e.width||1920,height:e.height||1080,bitrate:e.videoBandwidth||e.bandwidth||0,framerate:e.framerate||e.frameRate||24}}):function(e=""){return e.toLowerCase().includes("audio")}(t)?(this.log.debug("[#buildConfig] Building audio config for:",e),{type:"file",audio:{contentType:n,channels:e.channels||2,bitrate:e.audioBandwidth||e.bandwidth||0,samplerate:e.audioSamplingRate||48e3}}):void this.log.debug("[#buildConfig] Unknown mime type:",t)}function sb(e){return e?JSON.stringify(e):"invalid"}async function ab(e){if(!this.settings.enabled||!A(lt,this,rb).call(this)||!e)return this.log.debug("[#queryCapabilities] Not supported, returning false",e),{supported:!1,smooth:!1,powerEfficient:!1};const t=A(lt,this,sb).call(this,e),n=M(at,this).get(t);if(n)return n;let i;try{i=await ld.navigator.mediaCapabilities.decodingInfo(e)}catch(e){i={supported:!1,smooth:!1,powerEfficient:!1}}return this.log.debug("[#queryCapabilities] Config:",e,"\nDecoding info result:",i),M(at,this).set(t,i),i}async function lb(e){if(A(lt,this,ub).call(this,e))return this.log.debug("[#scoreRepresentation] Blocking HEVC on Firefox versions below support threshold",null==e?void 0:e.codecs),{score:-1e3,capability:{supported:!1,smooth:!1,powerEfficient:!1}};const t=A(lt,this,ob).call(this,e),n=await A(lt,this,ab).call(this,t),i=function(e="",t={}){const n=(e||"").toLowerCase();return Object.keys(t).reduce(((e,i)=>n.includes(i.toLowerCase())?t[i]:e),0)}(e.codecs||"",this.settings.codecBonus);let r=0;return n.supported&&(r+=1),!this.settings.ignoreSmooth&&n.smooth&&(r+=this.settings.smoothWeight),!this.settings.ignorePower&&n.powerEfficient&&(r+=this.settings.powerWeight),r+=i,{score:r,capability:n}}function cb(){if(!Zm())return!1;const e=ev();return!Number.isFinite(e)||e<150}function ub(e){if(!A(lt,this,cb).call(this))return!1;const t=function(e=""){const t=String(e||"").toLowerCase(),[n]=t.split(".");return n||""}((null==e?void 0:e.baseCodec)||(null==e?void 0:e.codecs)||"");return"hvc1"===t||"hev1"===t}const db=[],hb=()=>!0;[nb,{name:"force-video-codec",fn:function(e=[],{node:t}={}){const n=function(e){if("string"!=typeof e)return;const t=e.split(",")[0].trim();if(!t)return;const n=t.match(/^[a-z0-9]+/i);return n?n[0].toLowerCase():void 0}(null==t?void 0:t.forceVideoCodec);if(!n)return e;const i=e.filter((e=>(null==e?void 0:e.baseCodec)===n));return i.length?i:e},isRelevantForTrack:function(e){return"video"===(null==e?void 0:e.type)}},{name:"media-capabilities",fn:async function(e=[],{track:t}){if(null==t||!t.preferredCodec){const n=await ib.sortRepsCodecs(e);if(!Array.isArray(n)||0===n.length)return e;t.preferredCodec=n[0]}return e.filter((e=>(null==e?void 0:e.baseCodec)===t.preferredCodec))},isRelevantForTrack:function(e){return"video"===(null==e?void 0:e.type)}}].forEach((({name:e,fn:t,isRelevantForTrack:n})=>{!function(e,t,{isRelevantForTrack:n}={}){if(!e||"function"!=typeof t)throw new Error("registerRepresentationFilter requires a name and function");const i="function"==typeof n?n:hb;db.push({name:e,fn:t,isRelevantForTrack:i})}(e,t,{isRelevantForTrack:n})}));const fb=Ju("Node","warn"),pb={start:0,end:0},mb=.001;function vb(e){if(!Array.isArray(e)||!e.length)return;const t=e.map((e=>{const t=Number(null==e?void 0:e.segStart),n=Number(null==e?void 0:e.segDuration);return!Number.isFinite(t)||!Number.isFinite(n)||n<=0?null:{start:t,duration:n}}));if(t.some((e=>!e)))return;const n=t[0];return t.every((e=>Math.abs(e.start-n.start)<=mb&&Math.abs(e.duration-n.duration)<=mb))?{offset:n.start,duration:n.duration}:void 0}var gb=new WeakMap,yb=new WeakMap,bb=new WeakMap,kb=new WeakMap,wb=new WeakMap,xb=new WeakMap,_b=new WeakMap,Tb=new WeakMap,Ib=new WeakMap,Eb=new WeakMap,Sb=new WeakSet;class Ab extends Zu{constructor(e={},t={}){super(),O(this,Sb),F(this,gb,void 0),F(this,yb,void 0),F(this,bb,void 0),F(this,kb,void 0),F(this,wb,void 0),F(this,xb,void 0),F(this,_b,void 0),F(this,Tb,void 0),F(this,Ib,void 0),F(this,Eb,[]);const{id:n,manifestRef:i,duration:r,width:o,height:s,metadata:a={},children:l=[]}=e;if(!n)throw new Error("Node requires id");if(!i)throw new Error("Node requires manifestRef");this.id=n,this.manifestRef=i,this.metadata=a,this.state="pending",this.error=void 0,this.tracks=[],this.mainTrackId=void 0,this.imageFallbackActive=!1,this.disabledTracks=[],this.disabledTrackTypes=Array.isArray(t.disabledTracks)?t.disabledTracks.filter((e=>"string"==typeof e)):[],this.enabledRepFilters=Array.isArray(t.enabledRepFilters)?t.enabledRepFilters:void 0,this.forceVideoCodec="string"==typeof t.forceVideoCodec&&t.forceVideoCodec.trim()?t.forceVideoCodec.trim():void 0,C(_b,this,!0===t.forceImageFallback),C(gb,this,t.abrSelector),C(yb,this,t.assetsDeliveryService),C(kb,this,Og(r)?r:void 0),C(wb,this,Og(o)?o:void 0),C(xb,this,Og(s)?s:void 0),C(Tb,this,t&&"object"==typeof t.mediaHostRewriteMap?t.mediaHostRewriteMap:void 0),C(Ib,this,Og(t.maxManifestLoadAttempts)?t.maxManifestLoadAttempts:1/0),this.manifestLoadAttempts=0,this.manifestLoadError=void 0,C(Eb,this,Ky(l))}setChildren(e){const t=Ky(e);return A(Sb,this,Gb).call(this,t,{emit:!0})}addChild(e){const t=Hy(e),n=M(Eb,this).slice(),i=n.findIndex((e=>(null==e?void 0:e.nodeId)===t.nodeId));if(i>=0){var r;if((null===(r=n[i])||void 0===r?void 0:r.weight)===t.weight)return this.children;n[i]=t}else n.push(t);return A(Sb,this,Gb).call(this,n,{emit:!0})}removeChild(e){const t=Gy(e);if(!t)return this.children;const n=M(Eb,this).filter((e=>(null==e?void 0:e.nodeId)!==t));return n.length===M(Eb,this).length?this.children:A(Sb,this,Gb).call(this,n,{emit:!0})}async load(e={}){const{loadingMode:t="full",signal:n}=e;fb.info(`[load] [${this.id}] Loading node in '${t}' mode`);try{if(n&&n.aborted)throw ay();"ready"!==this.state&&await this.resolve({signal:n});const e="partial"===t,i=[];this.tracks.forEach((t=>{const n=t.segments||[];if(e){const e=n.find((e=>e.isInit)),r=n.find((e=>!e.isInit));e&&Array.isArray(e.representations)&&!e.isLoaded&&i.push({track:t,segment:e}),r&&Array.isArray(r.representations)&&!r.isLoaded&&i.push({track:t,segment:r})}else n.forEach((e=>{Array.isArray(e.representations)&&!e.isLoaded&&i.push({track:t,segment:e})}))}));const r=i.filter((({segment:e})=>e.isInit)),o=i.filter((({segment:e})=>!e.isInit)),s=o.length?o[0]:void 0,a=r.map((({track:e,segment:t})=>A(Sb,this,jb).call(this,e,t,n))),l=s?A(Sb,this,Ub).call(this,s.segment,s.track,n):Promise.resolve();await Promise.all([...a,l]);const c=s?o.slice(1):o;for(const e of c)await A(Sb,this,Ub).call(this,e.segment,e.track,n);if(n&&n.aborted)throw ay();return this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:t}),this}catch(e){if(ly(e,n))throw e;throw this.trigger("node:loaderror",{nodeId:this.id,node:this,error:e,loadingMode:t}),e}}async loadMediaSegmentsAtOffset(e,t={}){const n=Number(e);if(fb.info(`[loadMediaSegmentsAtOffset] [${this.id}] Loading media segments at offset ${n}`),!Number.isFinite(n))return;const{signal:i}=t;if(i&&i.aborted)throw ay();if("ready"!==this.state&&await this.resolve({signal:i}),"ready"!==this.state)return;const r=[],o=[];if(this.tracks.forEach((e=>{const t=(null==e?void 0:e.segments)||[];if(!Array.isArray(t)||!t.length)return;const s=t.find((e=>(null==e?void 0:e.isInit)&&Array.isArray(null==e?void 0:e.representations)));s&&!s.isLoaded&&r.push(A(Sb,this,jb).call(this,e,s,i)),t.forEach((t=>{if(!t||t.isInit||!Array.isArray(t.representations))return;const i=Number(t.offset);Number.isFinite(i)&&Math.abs(i-n)<=mb&&!t.isLoaded&&o.push({segment:t,track:e})}))})),r.length||o.length){if(await Promise.all(r),o.length&&await Promise.all(o.map((({segment:e,track:t})=>A(Sb,this,Ub).call(this,e,t,i)))),i&&i.aborted)throw ay();this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:"segment-offset",offsetSeconds:n})}}async resolve(e={}){const{signal:t,manifestOverride:n}=e;let i=!0;for(;i;){if(i=!1,"ready"===this.state)return this;if("resolving"===this.state)try{return await M(bb,this)}catch(e){if(!ly(e)||t&&t.aborted)throw e;i=!0;continue}if(t&&t.aborted)throw ay();if(this.hasExceededManifestLoadAttempts()){const e=this.manifestLoadError||new Error("Manifest load retry limit reached");throw this.state="failed",this.error=e,e}const e=A(Sb,this,Rb).call(this);return this.state="resolving",this.error=void 0,C(bb,this,(async()=>{try{const e=await A(Sb,this,qb).call(this,{signal:t,manifestOverride:n});if(t&&t.aborted)throw ay();let i=Zy.parse(e);return i=A(Sb,this,Pb).call(this,i),this.tracks=(i.tracks||[]).map((e=>e instanceof Vy?e:new Vy(e))),this.mainTrackId=i.mainTrackId||this.mainTrackId,this.metadata=i.metadata||this.metadata,A(Sb,this,Kb).call(this),A(Sb,this,Hb).call(this),await A(Sb,this,Vb).call(this),this.state="ready",this}catch(n){if(ly(n,t))throw A(Sb,this,Db).call(this,e),n;throw this.state="failed",this.error=n,n}})()),M(bb,this)}return M(bb,this)}evict(){this.tracks.forEach((e=>{(e.segments||[]).forEach((e=>{e.evict()}))}))}get children(){return M(Eb,this).slice()}set children(e){this.setChildren(e)}get duration(){if(!this.mainTrackId)return 0;const e=this.tracks.find((e=>e.id===this.mainTrackId));return e?Og(e.duration)?e.duration:e.endTime:0}get retainedByteLength(){let e=0;return this.tracks.forEach((t=>{(Array.isArray(t.segments)?t.segments:[]).forEach((t=>{e+=Og(t.retainedByteLength)?t.retainedByteLength:0}))})),e}get buffered(){if("ready"!==this.state)return pb;const e=Array.isArray(this.tracks)?this.tracks.find((e=>(null==e?void 0:e.id)===this.mainTrackId)):void 0,t=this.duration;if(!e||!Og(t))return pb;const n=Array.isArray(this.tracks)?this.tracks.map((e=>{if(!e||void 0===e.buffered)return;const t=e.buffered;return t&&Number.isFinite(t.start)&&Number.isFinite(t.end)?{track:e,range:t}:void 0})).filter(Boolean):[];if(!n.length)return pb;if(n.length===this.tracks.length&&n.every((({track:e,range:t})=>{const n=e.endTime,i=Og(e.offset)?e.offset:0;return Number.isFinite(n)&&t.start<=i&&t.end>=n})))return{start:0,end:t};const i=n.reduce(((e,{range:t})=>Math.min(e,t.end)),1/0);if(!Number.isFinite(i))return pb;const r=Math.min(i,t);return r>0?{start:0,end:r}:pb}get isLoaded(){return"ready"===this.state&&(Array.isArray(this.tracks)?this.tracks:[]).flatMap((e=>Array.isArray(null==e?void 0:e.segments)?e.segments:[])).every((e=>e.isLoaded))}hasExceededManifestLoadAttempts(){if(!Number.isFinite(M(Ib,this))||M(Ib,this)<=0)return!1;if(!this.manifestLoadError)return!1;const e=Number(this.manifestLoadAttempts);return Number.isFinite(e)&&e>=M(Ib,this)}}function Nb(e){return function(e,t){if(!e||"string"!=typeof e)return e;if(!t||"object"!=typeof t)return e;const n=ld&&"function"==typeof ld.URL?ld.URL:"function"==typeof URL?URL:null;if(!n)return e;let i;try{i=new n(e)}catch(t){return e}const r=function(e,t){const n=null==e?void 0:e.hostname,i=null==e?void 0:e.pathname;if("string"!=typeof n||"string"!=typeof i)return e;if(!/^s3(?:[.-][a-z0-9-]+)?\.amazonaws\.com$/i.test(n))return e;const r=i.split("/").filter(Boolean);if(r.length<2)return e;const o=r[0],s=new t(e.toString());return s.hostname=`${o}.${n}`,s.pathname=`/${r.slice(1).join("/")}`,s}(i,n),o=t[r.hostname]?r:i,s=t[o.hostname];if(!s||"string"!=typeof s)return e;let a;try{a=new n(s)}catch(t){return e}return a.protocol&&a.host?(o.protocol=a.protocol,o.host=a.host,o.toString()):e}(e,M(Tb,this))}function Mb(){return M(_b,this)||void 0===ld.VideoDecoder}function Fb(){return this.manifestRef&&"object"==typeof this.manifestRef&&"assets-delivery-service"===this.manifestRef.type}function Cb(e){if(!A(Sb,this,Fb).call(this))return!1;if(!A(Sb,this,Mb).call(this))return!1;const t=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[],n=t.find((t=>(null==t?void 0:t.id)===(null==e?void 0:e.mainTrackId)))||t[0];return"image"!==(null==n?void 0:n.type)}function Ob(e){const t=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[],n=function(e){const t=Number(null==e?void 0:e.duration);if(Number.isFinite(t)&&t>0)return t;const n=Array.isArray(null==e?void 0:e.segments)?e.segments:[];let i=0;return n.forEach((e=>{if(null!=e&&e.isInit)return;const t=Number(null==e?void 0:e.offset),n=Number(null==e?void 0:e.duration);!Number.isFinite(t)||!Number.isFinite(n)||n<=0||(i=Math.max(i,t+n))})),i>0?i:void 0}(t.find((t=>(null==t?void 0:t.id)===(null==e?void 0:e.mainTrackId)))||t[0]);return Og(n)?n:Og(M(kb,this))?M(kb,this):void 0}function Pb(e){if(this.imageFallbackActive=!1,!A(Sb,this,Cb).call(this,e))return e;if(!M(yb,this)||"function"!=typeof M(yb,this).resolveImageOne)return e;const t=M(yb,this).resolveImageOne(this.manifestRef),n=A(Sb,this,Nb).call(this,null==t?void 0:t.url);if(!n)return e;const i={typeHint:"image",url:n,duration:A(Sb,this,Ob).call(this,e),width:M(wb,this),height:M(xb,this)},r=Zy.parse(i);return e&&"object"==typeof e.metadata&&!Array.isArray(e.metadata)&&(r.metadata=e.metadata),this.imageFallbackActive=!0,r}function Rb(){return{state:this.state,error:this.error,tracks:this.tracks,mainTrackId:this.mainTrackId,metadata:this.metadata,imageFallbackActive:this.imageFallbackActive,disabledTracks:this.disabledTracks,manifestRef:this.manifestRef,manifestLoadAttempts:this.manifestLoadAttempts,manifestLoadError:this.manifestLoadError}}function Db(e){e&&(this.state=e.state,this.error=e.error,this.tracks=e.tracks,this.mainTrackId=e.mainTrackId,this.metadata=e.metadata,this.imageFallbackActive=e.imageFallbackActive,this.disabledTracks=e.disabledTracks,this.manifestRef=e.manifestRef,this.manifestLoadAttempts=e.manifestLoadAttempts,this.manifestLoadError=e.manifestLoadError)}function Lb(){const e=Number(this.manifestLoadAttempts);this.manifestLoadAttempts=Number.isFinite(e)&&e>0?e+1:1,this.manifestLoadError=void 0}function Bb(e){this.manifestLoadError=e||new Error("Manifest load failed")}function zb(e){if(!e)return null;const t={loadAttempts:Number(e.loadAttempts),loadError:e.loadError};if("function"==typeof e.markLoadAttempt)return e.markLoadAttempt(),t;const n=Number(e.loadAttempts);return e.loadAttempts=Number.isFinite(n)&&n>0?n+1:1,e.loadError=void 0,t}function Wb(e,t){if(!e||!t)return;const n=Number(t.loadAttempts);e.loadAttempts=Number.isFinite(n)&&n>=0?n:0,e.loadError=t.loadError}function $b(e,t){e&&("function"!=typeof e.setLoadError?e.loadError=t||new Error("Segment load failed"):e.setLoadError(t))}async function jb(e,t,n){const i=A(Sb,this,zb).call(this,t);try{const i=t.representations.map((async i=>{const r=A(Sb,this,Nb).call(this,i.url),o=await yy(r,{returnType:"arrayBuffer",signal:n,onProgress:({loaded:n,total:i,chunk:r})=>{t&&"function"==typeof t.setDownloadProgress&&t.setDownloadProgress(n,i),this.trigger("segment:chunk",{nodeId:this.id,trackId:null==e?void 0:e.id,trackType:null==e?void 0:e.type,segmentId:t.id,isInit:!0,loaded:n,total:i,chunk:r})}}),s=o instanceof ArrayBuffer?o:null==o?void 0:o.arrayBuffer;s&&t.setRepresentationBuffer(i.id,s)}));await Promise.all(i)}catch(e){if(ly(e,n))throw A(Sb,this,Wb).call(this,t,i),e;throw A(Sb,this,$b).call(this,t,e),e}}async function Ub(e,t,n){const i=M(gb,this),r={representations:e.representations,nodeId:this.id,trackId:null==t?void 0:t.id,segmentId:e.id},o=i&&"function"==typeof i.select?i.select(r):void 0,s=e.representations.find((e=>e.id===o))||e.representations[0];if(!s)return;e&&"function"==typeof e.setABRDecisionSnapshot&&e.setABRDecisionSnapshot(r.abrDecision),e.setChosenRepresentation(s);const a=A(Sb,this,zb).call(this,e);try{const i=A(Sb,this,Nb).call(this,s.url),r=await yy(i,{returnType:"arrayBuffer",signal:n,onProgress:({loaded:n,total:i,chunk:r})=>{e&&"function"==typeof e.setDownloadProgress&&e.setDownloadProgress(n,i),this.trigger("segment:chunk",{nodeId:this.id,trackId:null==t?void 0:t.id,trackType:null==t?void 0:t.type,segmentId:e.id,isInit:!1,loaded:n,total:i,chunk:r})}}),o=r instanceof ArrayBuffer?r:null==r?void 0:r.arrayBuffer;o&&(e.setRepresentationBuffer(s.id,o),e.setChosenRepresentation(s))}catch(t){if(ly(t,n))throw A(Sb,this,Wb).call(this,e,a),t;throw A(Sb,this,$b).call(this,e,t),t}}async function qb(e={}){const{signal:t,manifestOverride:n}=e;if(t&&t.aborted)throw ay();A(Sb,this,Lb).call(this);try{let e=this.manifestRef;if(n&&"object"==typeof n){if(A(Sb,this,Fb).call(this)&&"string"==typeof n.encodeProfile&&n.encodeProfile&&(this.manifestRef={...this.manifestRef,encodeProfile:n.encodeProfile},e=this.manifestRef),n.ivd)return{typeHint:"ivd",body:n.ivd};if(n.body){const e=A(Sb,this,Nb).call(this,n.url);return{typeHint:n.typeHint,url:e,mimeType:n.mimeType,body:n.body,duration:M(kb,this),width:M(wb,this),height:M(xb,this)}}"string"==typeof n.url&&n.url&&(e=n)}if(e&&"object"==typeof e&&"assets-delivery-service"===e.type){if(!M(yb,this)||"function"!=typeof M(yb,this).resolveOne)throw new Error("AssetsDeliveryService is required for assets-delivery-service manifestRef");const n=await M(yb,this).resolveOne(e,{signal:t});if(!n)throw new Error("AssetsDeliveryService returned empty result");if("string"==typeof n.encodeProfile&&n.encodeProfile&&(this.manifestRef={...e,encodeProfile:n.encodeProfile}),n.ivd)return{typeHint:"ivd",body:n.ivd};const i=n.typeHint,r=A(Sb,this,Nb).call(this,n.url),o=n.mimeType,s=n.body;if(r||s||o)return{typeHint:i,url:r,mimeType:o,body:s,duration:M(kb,this),width:M(wb,this),height:M(xb,this)};throw new Error("AssetsDeliveryService returned unsupported manifest shape")}if(e&&"object"==typeof e){const t=A(Sb,this,Nb).call(this,e.url),n=e.mimeType;if(e.body)return{url:t,mimeType:n,body:"string"==typeof e.body?e.body:JSON.stringify(e.body)}}if("string"==typeof e||e&&"string"==typeof e.url){const n="string"==typeof e?e:e.url,i=A(Sb,this,Nb).call(this,n),r="object"==typeof e?e.typeHint:void 0,o="object"==typeof e?e.mimeType:void 0;if("image"===Zy.inferType({typeHint:r,url:i,mimeType:o})){const t="object"==typeof e&&Og(e.duration)?e.duration:M(kb,this);return{typeHint:"image",url:i,mimeType:o,duration:t,width:"object"==typeof e&&Og(e.width)?e.width:M(wb,this),height:"object"==typeof e&&Og(e.height)?e.height:M(xb,this)}}const s=await yy(i,{returnType:"default",signal:t});return{url:i,body:s&&s.response&&"function"==typeof s.response.text?await s.response.text():void 0,mimeType:(s&&s.response&&s.response.headers&&"function"==typeof s.response.headers.get&&s.response.headers.get("content-type")?s.response.headers.get("content-type"):void 0)||o}}throw new Error("Node manifestRef is invalid or missing")}catch(e){if(ly(e,t))throw e;throw A(Sb,this,Bb).call(this,e),e}}async function Vb(){const e=db.slice().filter((e=>!this.enabledRepFilters||this.enabledRepFilters.includes(e.name)));if(e.length)for(let t=0;t<this.tracks.length;t+=1){const n=this.tracks[t],i=Array.isArray(n.segments)?n.segments:[],r=[];for(let t=0;t<i.length;t+=1){const o=i[t];if(!Array.isArray(o.representations)){r.push(o);continue}o.appliedFilters=o.appliedFilters||[];let s=o.representations;for(let t=0;t<e.length;t+=1){const{name:i,fn:r,isRelevantForTrack:a}=e[t];if(!a(n))continue;const l=await r(s,{segment:o,track:n,node:this});Array.isArray(l)&&(s=l),o.appliedFilters.push(i)}if(o.representations=s,o.representations.length){if(!o.isInit){const e=vb(o.representations);e&&(o.offset=e.offset,o.duration=e.duration)}r.push(o)}}r.length!==i.length&&n&&"function"==typeof n.setSegments&&n.setSegments(r)}}function Gb(e,{emit:t=!1}={}){return function(e=[],t=[]){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1){const i=e[n],r=t[n];if((null==i?void 0:i.nodeId)!==(null==r?void 0:r.nodeId)||(null==i?void 0:i.weight)!==(null==r?void 0:r.weight))return!1}return!0}(M(Eb,this),e)||(C(Eb,this,e),t&&(n=this)&&"function"==typeof n.trigger&&n.trigger("node:childrenchanged",{nodeId:n.id,node:n,children:Array.isArray(n.children)?n.children:[]})),this.children;var n}function Hb(){var e;const t=Array.isArray(this.disabledTrackTypes)?this.disabledTrackTypes:[];if(!t.length||!Array.isArray(this.tracks)||!this.tracks.length)return void(this.disabledTracks=[]);const n=new Set(t),i=[],r=[];this.tracks.forEach((e=>{e&&n.has(e.type)?r.push(e):e&&i.push(e)})),this.tracks=i,this.disabledTracks=r,this.mainTrackId&&!i.some((e=>e.id===this.mainTrackId))&&(this.mainTrackId=null===(e=i[0])||void 0===e?void 0:e.id)}function Kb(){if(!Array.isArray(this.tracks)||!this.tracks.length)return;const e=this.duration;if(!Og(e))return;const t=[new $y({name:"nodestart",timestamp:0,data:{id:this.id},isSticky:!0}),new $y({name:"nodeend",timestamp:e,data:{id:this.id}})],n=new Vy({id:`${this.id}-auto-cue`,type:"cue",cues:t,offset:0,duration:e});this.tracks.push(n)}var Xb=new WeakMap,Yb=new WeakMap,Qb=new WeakMap,Jb=new WeakMap,Zb=new WeakSet;class ek extends od{constructor(...e){super(...e),O(this,Zb),F(this,Xb,new Map),F(this,Yb,new Map),F(this,Qb,void 0),F(this,Jb,void 0);const[t,n]=e;C(Qb,this,t),C(Jb,this,n)}get name(){return"NodeRepository"}get defaults(){return{enabledRepFilters:["containers","force-video-codec","media-capabilities"],disabledTracks:xy("disabledTracks"),forceVideoCodec:xy("forceVideoCodec"),forceImageFallback:xy("forceImageFallback"),mediaHostRewriteMap:xy("mediaHostRewriteMap"),maxManifestLoadAttempts:3}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"get","list"])}onDispose(){M(Xb,this).forEach(((e,t)=>{const n=M(Yb,this).get(t);n&&e&&"function"==typeof e.off&&e.off(iv.NODE_CHILDREN_CHANGED,n)})),M(Yb,this).clear(),M(Xb,this).clear()}add(e){const t=e instanceof Ab?e:new Ab(e,{enabledRepFilters:this.settings.enabledRepFilters,disabledTracks:this.settings.disabledTracks,forceVideoCodec:this.settings.forceVideoCodec,forceImageFallback:this.settings.forceImageFallback,mediaHostRewriteMap:this.settings.mediaHostRewriteMap,maxManifestLoadAttempts:this.settings.maxManifestLoadAttempts,abrSelector:M(Qb,this),assetsDeliveryService:M(Jb,this)});if(!t.id)throw new Error("NodeRepository.add requires node with id");if(M(Xb,this).has(t.id))throw new Error(`NodeRepository.add: node with id ${t.id} already exists`);return M(Xb,this).set(t.id,t),A(Zb,this,tk).call(this,t),this.trigger(iv.NODE_ADD,{node:t}),t}get(e){const t=(null==e?void 0:e.id)||e;if(!t)throw new Error("NodeRepository.get requires node or id");return M(Xb,this).get(t)}list(){return Array.from(M(Xb,this).values())}}function tk(e){if(!e||"function"!=typeof e.on||!e.id)return;const t=e=>{this.trigger(iv.NODE_CHILDREN_CHANGED,e)};e.on(iv.NODE_CHILDREN_CHANGED,t),M(Yb,this).set(e.id,t)}var nk=new WeakMap,ik=new WeakMap,rk=new WeakSet;class ok extends od{constructor(...e){super(...e),O(this,rk),F(this,nk,void 0),F(this,ik,new Map);const[t]=e;C(nk,this,t)}get name(){return"ABRSelector"}get defaults(){return{safetyMargin:.35,minBufferForUpgrade:5,minBufferCritical:1,hysteresisRatio:1.1,abrStrategy:xy("abrStrategy")}}select(e={}){var t;const{representations:n=[],bufferSeconds:i}=e;if(!Array.isArray(n)||0===n.length)return;const r=M(nk,this)&&"function"==typeof M(nk,this).getKbps?M(nk,this).getKbps():void 0,o=A(rk,this,sk).call(this,n[0]),s=M(ik,this).get(o),a=this.settings.abrStrategy||"auto";this.log.debug(`[select] strategy=${a}, bw=${r}, buffer=${i}, prev=${s}`);const l=n.slice().sort(((e,t)=>A(rk,this,ak).call(this,e.bandwidth)-A(rk,this,ak).call(this,t.bandwidth)));if("bottom"===a){const t=l[0];return A(rk,this,uk).call(this,t,e,{decisionReason:"strategy:bottom",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==t?void 0:t.id}if("top"===a){const t=l[l.length-1];return A(rk,this,uk).call(this,t,e,{decisionReason:"strategy:top",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==t?void 0:t.id}if("random"===a){const t=l[Math.floor(Math.random()*l.length)];return A(rk,this,uk).call(this,t,e,{decisionReason:"strategy:random",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==t?void 0:t.id}const c=Number.isFinite(i)?i:void 0,u=Og(r)?r*this.settings.safetyMargin:void 0;let d="auto:highest-available";if(s&&void 0!==c&&c<this.settings.minBufferCritical){const t=l[0];return this.log.debug("[select] critical buffer -> lowest",e),A(rk,this,uk).call(this,t,e,{decisionReason:"auto:critical-buffer",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:u,bufferSeconds:c}),null==t?void 0:t.id}let h=l[l.length-1];if(void 0!==u){const t=l.filter((e=>A(rk,this,ak).call(this,e.bandwidth)<=u));t.length>0?(h=t[t.length-1],d="auto:highest-under-safe-bandwidth",this.log.debug("[select] under safe bandwidth ->",h.id,e)):(this.log.debug("[select] no rep under safe bandwidth, fallback lowest",e),h=l[0],d="auto:no-rep-under-safe-bandwidth")}if(s&&void 0!==c&&c<this.settings.minBufferForUpgrade){const t=n.find((e=>e.id===s));t&&Og(t.bandwidth)&&Og(h.bandwidth)&&h.bandwidth/t.bandwidth>this.settings.hysteresisRatio&&(h=n.filter((e=>e.bandwidth&&e.bandwidth<=t.bandwidth*this.settings.hysteresisRatio)).sort(((e,t)=>e.bandwidth-t.bandwidth)).pop()||t,d="auto:hysteresis-hold",this.log.debug("[select] hysteresis prevents upgrade; hold",h.id,e))}return A(rk,this,uk).call(this,h,e,{decisionReason:d,trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:u,bufferSeconds:c}),null===(t=h)||void 0===t?void 0:t.id}onDispose(){M(ik,this).clear(),C(nk,this,null)}}function sk(e){var t,n;return(null===(t=e.mime)||void 0===t||null===(n=t.split)||void 0===n||null===(n=n.call(t,"/"))||void 0===n?void 0:n[0])||"unknown"}function ak(e){return Og(e)?e/1e3:0}function lk(e){return Og(e)?e/1e3:void 0}function ck(e,t,n={}){const i=Array.isArray(null==t?void 0:t.representations)?t.representations.map((e=>({id:null==e?void 0:e.id,bandwidthKbps:A(rk,this,lk).call(this,null==e?void 0:e.bandwidth)}))):[];return{timeMs:Date.now(),strategy:this.settings.abrStrategy||"auto",decisionReason:n.decisionReason,nodeId:null==t?void 0:t.nodeId,trackId:null==t?void 0:t.trackId,segmentId:null==t?void 0:t.segmentId,trackType:n.trackType,measuredDownloadSpeedKbps:Number.isFinite(n.measuredDownloadSpeedKbps)?n.measuredDownloadSpeedKbps:void 0,safeBandwidthKbps:Number.isFinite(n.safeBandwidthKbps)?n.safeBandwidthKbps:void 0,bufferSeconds:Number.isFinite(n.bufferSeconds)?n.bufferSeconds:void 0,previousRepresentationId:n.previousRepresentationId,selectedRepresentationId:null==e?void 0:e.id,selectedRepresentationBandwidthKbps:A(rk,this,lk).call(this,null==e?void 0:e.bandwidth),safetyMargin:Number(this.settings.safetyMargin),minBufferForUpgrade:Number(this.settings.minBufferForUpgrade),minBufferCritical:Number(this.settings.minBufferCritical),hysteresisRatio:Number(this.settings.hysteresisRatio),availableRepresentations:i}}function uk(e,t,n={}){if(!e)return;const i=A(rk,this,ck).call(this,e,t,n);t&&"object"==typeof t&&(t.abrDecision=i),this.log.info("[select] Chosen representation:",e,"context:",t,"decision:",i),this.trigger("abr:selection",{representation:e,context:t,strategy:this.settings.abrStrategy,decision:i});const r=A(rk,this,sk).call(this,e);M(ik,this).set(r,e.id)}var dk=new WeakMap,hk=new WeakSet;class fk extends od{constructor(...e){super(...e),O(this,hk),F(this,dk,void 0);const[t]=e;if(C(dk,this,t),!M(dk,this)||"function"!=typeof M(dk,this).list)throw new Error("NodePrioritizer requires a NodeRepository instance")}get name(){return"NodePrioritizer"}get defaults(){return{levelMultiplier:1,priorityMultiplier:.3}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"sortNodes"])}onDispose(){C(dk,this,null)}getPrioritizationSnapshot(e){const t=M(dk,this).list();if(!t.length)return{orderedIds:[],reachableIds:[]};const{levels:n,weights:i}=A(hk,this,pk).call(this,t,e);return{orderedIds:A(hk,this,mk).call(this,t,n,i),reachableIds:Array.from(n.keys())}}sortNodes(e){const{orderedIds:t}=this.getPrioritizationSnapshot(e);return t.length?(this.log.info(`[sortNodes(${e})] Sorted nodes: [${t.join(", ")}]`),t):[]}getReachableNodeIds(e){const{reachableIds:t}=this.getPrioritizationSnapshot(e);return t}}function pk(e,t){const n=new Map;e.forEach((e=>{e&&e.id&&n.set(e.id,e)}));const i=new Map,r=new Map;if(!t||!n.has(t))return{levels:i,weights:r};const o=[{id:t,level:0,priority:1}];for(i.set(t,0),r.set(t,1);o.length;){const{id:e,level:t,priority:s}=o.shift(),a=n.get(e),l=Array.isArray(null==a?void 0:a.children)?a.children:[];for(let e=0;e<l.length;e+=1){const a=l[e],c=(null==a?void 0:a.nodeId)||(null==a?void 0:a.id);if(!c||!n.has(c)||i.has(c))continue;const u=Og(null==a?void 0:a.weight)?a.weight:1,d=Math.max(u,s);i.set(c,t+1),r.set(c,d),o.push({id:c,level:t+1,priority:d})}}return{levels:i,weights:r}}function mk(e,t,n){const i=t.size>0,{levelMultiplier:r,priorityMultiplier:o}=this.settings,s=e.map((e=>{var s;const a=t.has(e.id)?t.get(e.id):i?Number.MAX_SAFE_INTEGER:0,l=Number.isFinite(a)?a:Number.MAX_SAFE_INTEGER,c=null!==(s=n.get(e.id))&&void 0!==s?s:1,u=(Number.isFinite(l)?r*l:Number.MAX_SAFE_INTEGER)+o*c;return{id:e.id,score:u,level:l,priorityWeight:c}}));return s.sort(((e,t)=>e.score!==t.score?e.score-t.score:e.level!==t.level?e.level-t.level:e.priorityWeight!==t.priorityWeight?e.priorityWeight-t.priorityWeight:e.id.localeCompare(t.id))),s.map((e=>e.id))}function vk(e,t){return function(e,t){const n=Array.isArray(e)?e:[];return n.length?t&&n.includes(t)?t:n[0]:t||void 0}(null==e?void 0:e.availableEncodeProfiles,t)}function gk(e,t){const n=e&&"object"==typeof e?{...e}:e;return n&&"object"==typeof n?("string"==typeof t&&t?n.encodeProfile=t:delete n.encodeProfile,n):n}function yk(e){return"string"==typeof e&&e.startsWith("cmaf:")}function bk(e){return"image"===(null==e?void 0:e.assetType)?"image":"ivd"}function kk(e){if(!e||"object"!=typeof e)return e;if(Object.prototype.hasOwnProperty.call(e,"mpd")){const t="string"==typeof e.mpdUrl&&e.mpdUrl||"string"==typeof e.url&&e.url||void 0;return{typeHint:"dash",body:e.mpd,url:t}}return e.ivd||e.url||e.body||e.mimeType||e.typeHint?e:(t=e)&&"object"==typeof t&&Array.isArray(t.representations)?{ivd:e}:e;var t}var wk=new WeakMap,xk=new WeakMap,_k=new WeakSet;class Tk extends od{constructor(...e){super(...e),O(this,_k),F(this,wk,void 0),F(this,xk,void 0);const[,t={}]=e;C(wk,this,"function"==typeof t.fetchFn?t.fetchFn:void 0),C(xk,this,sy())}get name(){return"AssetsDeliveryService"}get defaults(){return{assetsDeliveryServiceUrl:"https://assets.eko.com",profile:xy("encodeProfile"),maxBatchSize:5,imageQueryParams:{startOffset:0,width:1024}}}async resolveOne(e,t={}){var n;const i=await this.resolve([e],t);if(!i.length)return;const r=i[0],o=null==r?void 0:r.manifest,s=null==r||null===(n=r.manifestRef)||void 0===n?void 0:n.encodeProfile;return o&&"object"==typeof o&&"string"==typeof s&&s?{...o,encodeProfile:s}:o}resolveImageOne(e){if(!A(_k,this,Ek).call(this,e))return;const t=vk(e,this.settings.profile),n=function(e,t,n){const i=function(e,t,n){const i=(e||"").replace(/\/$/,""),r=null==n?void 0:n.assetId,o=null==n?void 0:n.assetRevision;if(i&&t&&"string"==typeof r&&"number"==typeof o)return`${i}/${t}/${encodeURIComponent(r)}/${o}`}(e,"image",t);if(!i)return;const r=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return"";const t=new URLSearchParams;return Object.keys(e).forEach((n=>{if("string"!=typeof n||!n)return;const i=e[n];null!=i&&("number"!=typeof i||Number.isFinite(i))&&("string"!=typeof i&&"number"!=typeof i&&"boolean"!=typeof i||t.set(n,String(i)))})),t.toString()}(n);return r?`${i}?${r}`:i}(this.settings.assetsDeliveryServiceUrl||"",e,this.settings.imageQueryParams);if(!n)return;const i={typeHint:"image",url:n};return"string"==typeof t&&t&&(i.encodeProfile=t),i}async resolve(e=[],t={}){const n=(Array.isArray(e)?e:[e]).filter((e=>A(_k,this,Ek).call(this,e)));if(!n.length)return[];const i=A(_k,this,Ik).call(this,t);if(i&&i.aborted)return[];const r=[],o=this.settings.profile;n.forEach((e=>{if("image"!==bk(e))return;const t=this.resolveImageOne(e);t&&t.url&&r.push({manifestRef:gk(e,t.encodeProfile),manifest:{typeHint:"image",url:t.url}})}));const s=n.filter((e=>"image"!==bk(e))).map((e=>function(e,t){const n=vk(e,t);return{ref:e,profile:n,route:yk(n)?"dash":"ivd"}}(e,o))),a=A(_k,this,Ak).call(this,s);for(const{refs:e,route:t}of a){if(i&&i.aborted)return r;const{url:n}=A(_k,this,Nk).call(this,e,t),o=await A(_k,this,Mk).call(this,n,{method:"GET",signal:i});o&&"object"==typeof o&&e.forEach((({ref:e,profile:t})=>{const n=`${e.assetId}:${e.assetRevision}`,i=o[n]||o[e.assetId]||o[e.assetId||n];i&&r.push({manifestRef:gk(e,t),manifest:kk(i)})}))}return r}onDispose(){M(xk,this)&&M(xk,this).abort(),C(xk,this,null),C(wk,this,null)}}function Ik(e){return e&&e.signal?e.signal:M(xk,this)?M(xk,this).signal:void 0}function Ek(e){const t="number"==typeof(null==e?void 0:e.assetRevision)&&Number.isFinite(e.assetRevision)&&e.assetRevision>=0;return e&&"assets-delivery-service"===e.type&&"string"==typeof e.assetId&&t}function Sk(e,t){const n=Number.isFinite(t)&&t>0?t:e.length,i=[];for(let t=0;t<e.length;t+=n)i.push(e.slice(t,t+n));return i}function Ak(e){if(!Array.isArray(e)||!e.length)return[];const t=[];e.forEach((e=>{const n=t[t.length-1];n&&n.route===e.route?n.refs.push(e):t.push({route:e.route,refs:[e]})}));const n=[];return t.forEach((e=>{A(_k,this,Sk).call(this,e.refs,this.settings.maxBatchSize).forEach((t=>{n.push({route:e.route,refs:t})}))})),n}function Nk(e,t="ivd"){const n=e.map((({ref:e,profile:t})=>function(e,t){const n=`${e.assetId}:${e.assetRevision}`;return t?`${n}:${t}`:n}(e,t))),i=new URLSearchParams({assets:n.join(","),type:"data"});return{url:`${(this.settings.assetsDeliveryServiceUrl||"").replace(/\/$/,"")}/${"dash"===t?"dash":"ivd"}?${i.toString()}`}}async function Mk(e,t){return M(wk,this)?M(wk,this).call(this,e,t):await yy(e,{returnType:"json",method:(null==t?void 0:t.method)||"GET",signal:null==t?void 0:t.signal})}function Fk({prioritizer:e,repository:t,startNodeId:n,prioritizedIds:i,pendingIds:r,allowedIds:o,filter:s,fallbackToRepository:a=!0}={}){const l=Array.isArray(i)?i:e&&"function"==typeof e.sortNodes?e.sortNodes(n):[],c=a?(f=t)&&"function"==typeof f.list?f.list().map((e=>null==e?void 0:e.id)).filter(Boolean):[]:[],u=l.length?l:c,d=r?new Set(r):null,h=o?new Set(o):null;var f;return u.filter((e=>{if(!e)return!1;if(d&&d.has(e))return!1;if(h&&!h.has(e))return!1;const n=function(e,t){if(e&&"function"==typeof e.get)return e.get(t)}(t,e);return!(!n||"function"==typeof s&&!s(n,e))}))}const Ck=(ld.requestAnimationFrame||ld.mozRequestAnimationFrame||ld.webkitRequestAnimationFrame||ld.msRequestAnimationFrame||(e=>ld.setTimeout(e,1e3/60))).bind(ld),Ok=(ld.cancelAnimationFrame||ld.mozCancelAnimationFrame||ld.webkitCancelAnimationFrame||ld.msCancelAnimationFrame||(e=>ld.clearTimeout(e))).bind(ld),Pk=Ju("ticker","warn");let Rk,Dk=[],Lk=null,Bk=oy();function zk(){Bk=oy();const e=[];let t,n;for(n=Dk.length-1;n>=0;--n)t=Dk[n],Bk>=t.lastTick+t.interval&&e.push(t);for(n=e.length-1;n>=0;--n)if(t=e[n],!t.stopped){t.lastTick=Bk;try{t.callback()}catch(e){console&&"function"==typeof console.error?console.error(e):Pk.error(e)}}Rk=Ck(zk)}function Wk(){oy()-Bk>=200&&(Ok(Rk),zk())}function $k(e){let t=-1;for(let n=0;n<Dk.length;n+=1)if(Dk[n].callback===e){t=n;break}return t}function jk(e,t=0){if(!e||"function"!=typeof e||"number"!=typeof t||t<0)return void Pk.error("[start] Invalid arguments given to start method.",arguments);const n=$k(e);return-1!==n?(Pk.debug("[start] Callback already exists, overriding interval.",arguments),Dk[n].interval=t,e):(Dk.push({callback:e,interval:t,lastTick:oy()}),1===Dk.length&&(Rk=Ck(zk),Lk||(Lk=ld.setInterval(Wk,1e3))),e)}function Uk(e){const t=$k(e);-1!==t?(Dk[t].stopped=!0,Dk.splice(t,1),Dk.length||(Ok(Rk),ld.clearInterval(Lk),Lk=null)):Pk.debug("[stop] Callback not found, doing nothing.",arguments)}function qk(e){return-1!==$k(e)}function Vk(e,t,n){const i="number"==typeof n?n:(null==n?void 0:n.maxQueueSize)||Number.POSITIVE_INFINITY,r=null!=n&&n.immediatelyFlushFirst?"boolean"==typeof n.immediatelyFlushFirst?n.immediatelyFlushFirst?1:0:Number(n.immediatelyFlushFirst):0;let o=0;if("function"!=typeof e)return void Pk.error("[createThrottler] Bad argument given to createThrottler, first argument must be a function.",arguments);Pk.debug("[createThrottler] Creating a new throttler instance.",arguments);const s=[];function a(){Pk.debug("[onThrottlerTick] Calling callback with "+s.length+" queued items.");const t=s.slice(0);s.length=0,Uk(a),e(t)}const l={push:function(e){Pk.debug("[push] Queuing argument:",e),0===s.length&&jk(a,t),s.push(e),o+=1,(o<=r||s.length>=i)&&a()},flush:function(){Pk.debug("[flush] Flushing queue."),0!==s.length&&a()},dispose:function(){Pk.debug("[dispose] Disposing of throttler.");const e=s.slice(0);return s.length=0,Uk(a),e}};return Object.defineProperty(l,"interval",{enumerable:!0,get:function(){return t},set:function(e){"number"==typeof e&&(t=e)}}),l}function Gk(e,t){if(e&&"function"==typeof e)return e.__tickerThrottler||(e.__tickerThrottler=Vk((function(){e()}),t)),"number"==typeof t&&(e.__tickerThrottler.interval=t),e.__tickerThrottler.push(),e.__tickerThrottler;Pk.error("[scheduleExecution] Bad argument given to scheduleExecution, first argument must be a function.",arguments)}var Hk=new WeakMap,Kk=new WeakMap,Xk=new WeakMap,Yk=new WeakMap,Qk=new WeakMap,Jk=new WeakMap,Zk=new WeakMap,ew=new WeakMap,tw=new WeakMap,nw=new WeakMap,iw=new WeakMap,rw=new WeakMap,ow=new WeakMap,sw=new WeakMap,aw=new WeakMap,lw=new WeakMap,cw=new WeakSet;class uw extends od{constructor(...e){super(...e),O(this,cw),F(this,Hk,void 0),F(this,Kk,void 0),F(this,Xk,void 0),F(this,Yk,void 0),F(this,Qk,[]),F(this,Jk,[]),F(this,Zk,new Set),F(this,ew,new Set),F(this,tw,!1),F(this,nw,void 0),F(this,iw,void 0),F(this,rw,void 0),F(this,ow,void 0),F(this,sw,void 0),F(this,aw,void 0),F(this,lw,void 0);const[t,n,i,r]=e;C(Hk,this,t),C(Kk,this,n),C(Xk,this,i),C(Yk,this,r),C(nw,this,sy());const o=e.length?e[e.length-1]:void 0,s=o&&"object"==typeof o&&Number.isFinite(o.maxConcurrent)?o.maxConcurrent:void 0;Number.isFinite(s)&&(this.settings.maxConcurrent=s),C(lw,this,(()=>A(cw,this,ww).call(this))),A(cw,this,pw).call(this),A(cw,this,fw).call(this)}get name(){return"NodeResolver"}get defaults(){return{maxConcurrent:5}}onDispose(){var e;M(nw,this)&&M(nw,this).abort(),C(nw,this,null),M(Yk,this)&&"function"==typeof M(Yk,this).off&&M(rw,this)&&M(Yk,this).off(iv.PLACEMENT_ADDED,M(rw,this)),M(Yk,this)&&"function"==typeof M(Yk,this).off&&M(aw,this)&&M(Yk,this).off(iv.TIMELINE_RESET,M(aw,this)),M(Hk,this)&&"function"==typeof M(Hk,this).off&&M(ow,this)&&M(Hk,this).off(iv.NODE_ADD,M(ow,this)),M(Hk,this)&&"function"==typeof M(Hk,this).off&&M(sw,this)&&M(Hk,this).off(iv.NODE_CHILDREN_CHANGED,M(sw,this)),C(rw,this,null),C(ow,this,null),C(sw,this,null),C(aw,this,null),C(Qk,this,[]),C(Jk,this,[]),M(Zk,this).clear(),M(ew,this).clear(),C(tw,this,!1),C(iw,this,void 0),null!==(e=M(lw,this))&&void 0!==e&&e.__tickerThrottler&&M(lw,this).__tickerThrottler.dispose(),C(lw,this,null)}}function dw(){return M(nw,this)?M(nw,this).signal:void 0}function hw(){return this._disposed||M(nw,this)&&M(nw,this).signal.aborted}function fw(){M(Yk,this)&&"function"==typeof M(Yk,this).on&&(C(rw,this,(e=>{A(cw,this,vw).call(this,null==e?void 0:e.nodeId)})),M(Yk,this).on(iv.PLACEMENT_ADDED,M(rw,this)),C(aw,this,(()=>A(cw,this,mw).call(this))),M(Yk,this).on(iv.TIMELINE_RESET,M(aw,this))),M(Hk,this)&&"function"==typeof M(Hk,this).on&&(C(ow,this,(({node:e})=>{(null==e?void 0:e.id)&&A(cw,this,vw).call(this,e.id,{fromRepoAdd:!0})})),M(Hk,this).on(iv.NODE_ADD,M(ow,this)),C(sw,this,(()=>{Gk(M(lw,this),100)})),M(Hk,this).on(iv.NODE_CHILDREN_CHANGED,M(sw,this)))}function pw(){const e=M(Yk,this)&&Array.isArray(M(Yk,this).placements)?M(Yk,this).placements:[];e.forEach((e=>A(cw,this,vw).call(this,e.nodeId)));const t=e.length?e[e.length-1]:void 0;t&&t.nodeId&&C(iw,this,t.nodeId)}function mw(){M(nw,this)&&M(nw,this).abort(),C(nw,this,sy()),C(Qk,this,[]),C(Jk,this,[]),M(Zk,this).clear(),C(tw,this,!1),C(iw,this,void 0)}function vw(e,{fromRepoAdd:t=!1}={}){A(cw,this,hw).call(this)||e&&(M(ew,this).has(e)||M(Zk,this).has(e)||(M(Qk,this).push(e),M(iw,this)||t||C(iw,this,e),!M(tw,this)&&t||A(cw,this,gw).call(this)))}function gw(){if(M(tw,this))return void A(cw,this,yw).call(this);if(0===M(Qk,this).length)return;C(tw,this,!0);const e=M(Qk,this).shift();A(cw,this,xw).call(this,e).finally((()=>{A(cw,this,yw).call(this)}))}async function yw(){if(!A(cw,this,hw).call(this))for(M(Qk,this).length||M(Jk,this).length||C(Jk,this,A(cw,this,bw).call(this));M(Zk,this).size<this.settings.maxConcurrent;){const e=this.settings.maxConcurrent-M(Zk,this).size;if(e<=0)break;const t=[];for(;t.length<e&&(M(Qk,this).length||M(Jk,this).length);){let e=M(Qk,this).shift();e||(e=M(Jk,this).shift()),e&&t.push(e)}if(!t.length)break;const n=A(cw,this,_w).call(this,t);n.length&&M(Xk,this)&&"function"==typeof M(Xk,this).resolve&&A(cw,this,Tw).call(this,n).finally((()=>A(cw,this,yw).call(this))),t.filter((e=>!n.find((t=>t.nodeId===e)))).forEach((e=>{A(cw,this,xw).call(this,e).finally((()=>A(cw,this,yw).call(this)))}))}}function bw(){const e=new Set([...M(ew,this),...M(Zk,this),...M(Qk,this)]);return A(cw,this,kw).call(this,e)}function kw(e){const t=M(Yk,this)&&Array.isArray(M(Yk,this).placements)?M(Yk,this).placements:[],n=(t.length?t[t.length-1].nodeId:void 0)||M(iw,this);return Fk({prioritizer:M(Kk,this),repository:M(Hk,this),startNodeId:n,pendingIds:e,fallbackToRepository:!1})}function ww(){A(cw,this,hw).call(this)||(M(tw,this)||0!==M(Qk,this).length)&&(C(Jk,this,A(cw,this,bw).call(this)),M(tw,this)&&A(cw,this,yw).call(this))}async function xw(e,t){if(!e||M(ew,this).has(e)||M(Zk,this).has(e))return;const n=A(cw,this,dw).call(this);if(n&&n.aborted)return;const i=M(Hk,this)&&"function"==typeof M(Hk,this).get?M(Hk,this).get(e):void 0;if(i&&"function"==typeof i.resolve)if("function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts())M(ew,this).add(e);else{M(Zk,this).add(e);try{const r={signal:n};t&&(r.manifestOverride=t),await i.resolve(r),M(ew,this).add(e)}catch(t){if(ly(t,n))return;this.log.warn(`NodeResolver failed to resolve node ${e}: ${(null==t?void 0:t.message)||t}`),"function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts()&&M(ew,this).add(e)}finally{M(Zk,this).delete(e)}}}function _w(e){const t=[];return e.forEach((e=>{const n=M(Hk,this)&&"function"==typeof M(Hk,this).get?M(Hk,this).get(e):void 0;n&&n.manifestRef&&"assets-delivery-service"===n.manifestRef.type&&t.push({nodeId:e,ref:n.manifestRef})})),t}async function Tw(e){const t=A(cw,this,dw).call(this);if(!t||!t.aborted){e.forEach((({nodeId:e})=>M(Zk,this).add(e)));try{const n=e.map((e=>e.ref)),i=await M(Xk,this).resolve(n,{signal:t});e.forEach((({nodeId:e,ref:t})=>{var n;const r=M(Hk,this)&&"function"==typeof M(Hk,this).get?M(Hk,this).get(e):void 0;if(M(Zk,this).delete(e),!r||"function"!=typeof r.resolve)return;const o=Array.isArray(i)?i.find((e=>{const n=null==e?void 0:e.manifestRef;return n&&n.assetId===t.assetId&&n.assetRevision===t.assetRevision})):void 0,s="string"==typeof(null==o||null===(n=o.manifestRef)||void 0===n?void 0:n.encodeProfile)&&o.manifestRef.encodeProfile?o.manifestRef.encodeProfile:void 0,a=o?A(cw,this,Iw).call(this,o.manifest,s):void 0;A(cw,this,xw).call(this,e,a)}))}catch(n){ly(n,t)||this.log.warn(`NodeResolver ADS batch failed: ${(null==n?void 0:n.message)||n}`),e.forEach((({nodeId:e})=>M(Zk,this).delete(e)))}}}function Iw(e,t){if(!e)return;const n="string"==typeof t&&t?t:void 0,i=e=>n&&e&&"object"==typeof e?{...e,encodeProfile:n}:e;return e.ivd?i({typeHint:"ivd",body:e.ivd}):e.url||e.body||e.mimeType?i({typeHint:e.typeHint,url:e.url,mimeType:e.mimeType,body:e.body}):i(e)}const Ew=.001,Sw="priority";function Aw(e){const t=Number(e);return Number.isFinite(t)?t:0}var Nw=new WeakMap,Mw=new WeakMap,Fw=new WeakMap,Cw=new WeakMap,Ow=new WeakMap,Pw=new WeakMap,Rw=new WeakMap,Dw=new WeakMap,Lw=new WeakMap,Bw=new WeakMap,zw=new WeakMap,Ww=new WeakMap,$w=new WeakMap,jw=new WeakMap,Uw=new WeakMap,qw=new WeakMap,Vw=new WeakMap,Gw=new WeakMap,Hw=new WeakMap,Kw=new WeakMap,Xw=new WeakSet;class Yw extends od{constructor(...e){super(...e),O(this,Xw),F(this,Nw,void 0),F(this,Mw,void 0),F(this,Fw,void 0),F(this,Cw,new Map),F(this,Ow,new Map),F(this,Pw,[]),F(this,Rw,new Set),F(this,Dw,new Map),F(this,Lw,!1),F(this,Bw,void 0),F(this,zw,void 0),F(this,Ww,void 0),F(this,$w,void 0),F(this,jw,void 0),F(this,Uw,void 0),F(this,qw,void 0),F(this,Vw,void 0),F(this,Gw,!1),F(this,Hw,[]),F(this,Kw,void 0);const[t,n,i]=e;C(Nw,this,t),C(Mw,this,n),C(Fw,this,i),C(zw,this,sy()),C(Kw,this,(()=>A(Xw,this,Cx).call(this))),A(Xw,this,dx).call(this)}get name(){return"SegmentLoadCoordinator"}get defaults(){return{maxConcurrentLoads:3,maxSegmentLoadAttempts:3}}onDispose(){var e;M(zw,this)&&M(zw,this).abort(),C(zw,this,null),M(Dw,this).size&&M(Dw,this).forEach((e=>{(null==e?void 0:e.controller)&&e.controller.abort()})),M(Dw,this).clear(),M(Fw,this)&&"function"==typeof M(Fw,this).off&&(M(Ww,this)&&M(Fw,this).off(iv.PLACEMENT_ADDED,M(Ww,this)),M(jw,this)&&M(Fw,this).off(iv.TIMELINE_SEEKING,M(jw,this)),M(Uw,this)&&M(Fw,this).off(iv.TIMELINE_SEEKED,M(Uw,this)),M(qw,this)&&M(Fw,this).off(iv.TIMELINE_RESET,M(qw,this))),M(Nw,this)&&"function"==typeof M(Nw,this).off&&M($w,this)&&M(Nw,this).off(iv.NODE_CHILDREN_CHANGED,M($w,this)),M(Vw,this)&&"function"==typeof ld.removeEventListener&&ld.removeEventListener("online",M(Vw,this)),C(Ww,this,null),C($w,this,null),C(jw,this,null),C(Uw,this,null),C(qw,this,null),C(Vw,this,null),M(Cw,this).clear(),M(Ow,this).clear(),C(Pw,this,[]),M(Rw,this).clear(),M(Dw,this).clear(),C(Lw,this,!1),C(Bw,this,void 0),C(Gw,this,!1),C(Hw,this,[]),null!==(e=M(Kw,this))&&void 0!==e&&e.__tickerThrottler&&M(Kw,this).__tickerThrottler.dispose(),C(Kw,this,null)}}function Qw(){return M(zw,this)?M(zw,this).signal:void 0}function Jw(){return this._disposed||M(zw,this)&&M(zw,this).signal.aborted}function Zw(){const e=Number(this.settings.maxSegmentLoadAttempts);return Number.isFinite(e)&&e>0?e:1/0}function ex(e){const t=A(Xw,this,Zw).call(this);if(!Number.isFinite(t)||t===1/0)return!1;if(null==e||!e.loadError)return!1;const n=Number(e.loadAttempts);return Number.isFinite(n)&&n>=t}function tx(e){return!!e&&(!!A(Xw,this,ex).call(this,e)||A(Xw,this,nx).call(this,e))}function nx(e){if(!e)return!1;if("boolean"==typeof e.isLoaded)return e.isLoaded;const t=Number(e.retainedByteLength);return Number.isFinite(t)&&t>0}function ix(e){if(!e||A(Xw,this,nx).call(this,e))return;const t=Number(e.loadAttempts);(Number.isFinite(t)&&t>0||e.loadError)&&("function"==typeof e.evict&&e.evict(),e.loadAttempts=0,e.loadError=void 0)}function rx(e){e&&(e.manifestLoadError&&(e.manifestLoadAttempts=0,e.manifestLoadError=void 0,"failed"===e.state&&(e.state="pending",e.error=void 0)),(Array.isArray(e.tracks)?e.tracks:[]).forEach((e=>{(Array.isArray(null==e?void 0:e.segments)?e.segments:[]).forEach((e=>{A(Xw,this,ix).call(this,e)}))})))}function ox(){(M(Nw,this)&&"function"==typeof M(Nw,this).list?M(Nw,this).list():[]).forEach((e=>{A(Xw,this,rx).call(this,e)}))}function sx(e,{allowSeekKeep:t=!1,segmentOffset:n}={}){const i=sy(),r=i?i.signal:A(Xw,this,Qw).call(this);return e&&M(Dw,this).set(e,{controller:i,allowSeekKeep:!!t,segmentOffset:n}),{signal:r,controller:i}}function ax(e,t,n={}){const i=M(Dw,this).get(e);i&&i.controller===t&&(Object.prototype.hasOwnProperty.call(n,"allowSeekKeep")&&(i.allowSeekKeep=!!n.allowSeekKeep),Object.prototype.hasOwnProperty.call(n,"segmentOffset")&&(i.segmentOffset=n.segmentOffset))}function lx(e,t){const n=M(Dw,this).get(e);n&&(t&&n.controller!==t||M(Dw,this).delete(e))}function cx(e,t){const n=new Set;return(Array.isArray(e)?e:[]).forEach((e=>{const i=null==e?void 0:e.nodeId;if(!i)return;const r=M(Nw,this)&&"function"==typeof M(Nw,this).get?M(Nw,this).get(i):void 0;if(!r)return;const o=A(Xw,this,xx).call(this,r,e,t);Number.isFinite(o)&&n.add(`${i}:${o}`)})),n}function ux(e){M(Dw,this).size&&M(Dw,this).forEach(((t,n)=>{const i=null==t?void 0:t.segmentOffset,r=Number.isFinite(i)?`${n}:${i}`:"";!(null!=t&&t.allowSeekKeep&&r&&e&&e.has(r))&&(null==t?void 0:t.controller)&&t.controller.abort()}))}function dx(){M(Fw,this)&&"function"==typeof M(Fw,this).on&&(C(Ww,this,(e=>{A(Xw,this,gx).call(this,e)})),M(Fw,this).on(iv.PLACEMENT_ADDED,M(Ww,this)),C(jw,this,(e=>A(Xw,this,hx).call(this,e))),M(Fw,this).on(iv.TIMELINE_SEEKING,M(jw,this)),C(Uw,this,(e=>A(Xw,this,fx).call(this,e))),M(Fw,this).on(iv.TIMELINE_SEEKED,M(Uw,this)),C(qw,this,(()=>A(Xw,this,vx).call(this))),M(Fw,this).on(iv.TIMELINE_RESET,M(qw,this))),M(Nw,this)&&"function"==typeof M(Nw,this).on&&(C($w,this,(()=>{Gk(M(Kw,this),100)})),M(Nw,this).on(iv.NODE_CHILDREN_CHANGED,M($w,this))),"function"==typeof ld.addEventListener&&(C(Vw,this,(()=>A(Xw,this,mx).call(this))),ld.addEventListener("online",M(Vw,this)))}function hx(e={}){if(A(Xw,this,Jw).call(this))return;const t=Number(null==e?void 0:e.targetTime);if(!Number.isFinite(t))return;const n=Array.isArray(null==e?void 0:e.placements)?e.placements:[],i=A(Xw,this,cx).call(this,n,t);A(Xw,this,ux).call(this,i),C(Gw,this,!0),C(Hw,this,n.map((e=>{const n=null==e?void 0:e.nodeId;if(n)return{nodeId:n,placement:e,targetTime:t}})).filter(Boolean)),setTimeout((()=>A(Xw,this,bx).call(this)),0)}function fx(e={}){var t;if(A(Xw,this,Jw).call(this))return;C(Gw,this,!1),C(Hw,this,[]);const n=Number.isFinite(null==e?void 0:e.targetTime)?Number(e.targetTime):Number(null===(t=M(Fw,this))||void 0===t?void 0:t.currentTime);A(Xw,this,px).call(this,n),setTimeout((()=>A(Xw,this,bx).call(this)),0)}function px(e){var t;(Array.isArray(null===(t=M(Fw,this))||void 0===t?void 0:t.placements)?M(Fw,this).placements:[]).forEach((t=>{if(!t)return;const n=sm(t);if(Number.isFinite(n)){if(Number.isFinite(e)){if(n>=e)return void A(Xw,this,gx).call(this,t);const i=rm(t,M(Nw,this));return Number.isFinite(i)?void(n+i>e&&A(Xw,this,gx).call(this,t)):void(n<=e&&A(Xw,this,gx).call(this,t))}A(Xw,this,gx).call(this,t)}}))}function mx(){var e;A(Xw,this,Jw).call(this)||(A(Xw,this,ox).call(this),C(Gw,this,!1),C(Hw,this,[]),A(Xw,this,px).call(this,Number(null===(e=M(Fw,this))||void 0===e?void 0:e.currentTime)),C(Pw,this,A(Xw,this,Mx).call(this)),setTimeout((()=>A(Xw,this,bx).call(this)),0))}function vx(){M(zw,this)&&M(zw,this).abort(),C(zw,this,sy()),M(Dw,this).size&&M(Dw,this).forEach((e=>{(null==e?void 0:e.controller)&&e.controller.abort()})),M(Dw,this).clear(),M(Cw,this).clear(),M(Ow,this).clear(),C(Pw,this,[]),M(Rw,this).clear(),C(Lw,this,!1),C(Bw,this,void 0),C(Gw,this,!1),C(Hw,this,[])}function gx(e){if(A(Xw,this,Jw).call(this))return;const t=null==e?void 0:e.nodeId;if(!t)return;const n=M(Cw,this).get(t);if(n){const i=sm(n),r=sm(e);Number.isFinite(i)?Number.isFinite(r)&&r<i&&M(Cw,this).set(t,e):Number.isFinite(r)&&M(Cw,this).set(t,e)}else M(Cw,this).set(t,e);const i=M(Bw,this);C(Bw,this,t),i&&i!==t&&C(Pw,this,[]),M(Lw,this)?setTimeout((()=>A(Xw,this,bx).call(this)),0):A(Xw,this,yx).call(this)}function yx(){M(Lw,this)||M(Cw,this).size&&(C(Lw,this,!0),A(Xw,this,bx).call(this))}async function bx(){if(A(Xw,this,Jw).call(this))return;if(M(Rw,this).size>=this.settings.maxConcurrentLoads)return;if(M(Gw,this))return void(M(Hw,this).length&&A(Xw,this,kx).call(this));const e=A(Xw,this,Ix).call(this);if(e.hasPending)A(Xw,this,Ex).call(this,e);else for(M(Pw,this).length||C(Pw,this,A(Xw,this,Mx).call(this));M(Rw,this).size<this.settings.maxConcurrentLoads&&M(Pw,this).length;){const e=M(Pw,this).shift();A(Xw,this,Ox).call(this,e,"partial").finally((()=>{setTimeout((()=>A(Xw,this,bx).call(this)),0)}))}}function kx(){if(A(Xw,this,Jw).call(this))return;const e=Math.max(0,this.settings.maxConcurrentLoads-M(Rw,this).size);if(!e||!M(Hw,this).length)return;const t=[],n=[];for(let i=0;i<M(Hw,this).length;i+=1){const r=M(Hw,this)[i];(null==r?void 0:r.nodeId)&&(t.length<e&&!M(Rw,this).has(r.nodeId)?t.push(r):n.push(r))}C(Hw,this,n),t.forEach((e=>{A(Xw,this,wx).call(this,e).finally((()=>{setTimeout((()=>A(Xw,this,bx).call(this)),0)}))}))}async function wx(e={}){const t=null==e?void 0:e.nodeId,n=null==e?void 0:e.placement,i=Number(null==e?void 0:e.targetTime);if(!t||!n||!Number.isFinite(i))return;if(M(Rw,this).has(t))return;const{signal:r,controller:o}=A(Xw,this,sx).call(this,t);if(r&&r.aborted)A(Xw,this,lx).call(this,t,o);else{M(Rw,this).add(t);try{const e=M(Nw,this)&&"function"==typeof M(Nw,this).get?M(Nw,this).get(t):void 0;if(!e)return;if("ready"!==e.state&&"function"==typeof e.resolve)try{await e.resolve({signal:r})}catch(e){return}if("ready"!==e.state)return;const s=A(Xw,this,xx).call(this,e,n,i);if(!Number.isFinite(s)){const n=Array.isArray(null==e?void 0:e.tracks)?e.tracks.map((e=>null==e?void 0:e.type)).filter(Boolean):[];return void this.log.debug(`[#loadSeekWork] No seek segment offset for node [${t}] targetTime=${i} mainTrackId=${(null==e?void 0:e.mainTrackId)||"n/a"} trackTypes=[${n.join(",")}]`)}"function"==typeof e.loadMediaSegmentsAtOffset?(this.log.debug(`[#loadSeekWork] Loading seek segment for node [${t}] at offset=${s}`),A(Xw,this,ax).call(this,t,o,{allowSeekKeep:!0,segmentOffset:s}),await e.loadMediaSegmentsAtOffset(s,{signal:r})):"function"==typeof e.load&&await e.load({loadingMode:"partial",signal:r})}catch(e){ly(e,r)||this.log.warn(`[#loadSeekWork] SegmentLoadCoordinator failed to seek-load node ${t}: ${(null==e?void 0:e.message)||e}`)}finally{M(Rw,this).delete(t),A(Xw,this,lx).call(this,t,o)}}}function xx(e,t,n){var i;const r=sm(t);if(!Number.isFinite(r))return;const o=Aw(null==t?void 0:t.nodeOffsetOverride),s=Math.max(0,n-r+o),a=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[];let l;if(null!=e&&e.mainTrackId){const t=a.find((t=>(null==t?void 0:t.id)===e.mainTrackId));"video"!==(null==t?void 0:t.type)&&"image"!==(null==t?void 0:t.type)||(l=t)}if(l||(l=a.find((e=>"video"===(null==e?void 0:e.type)))||a.find((e=>"image"===(null==e?void 0:e.type)))),!l||!Array.isArray(l.segments))return;const c=l.segments.filter((e=>e&&!e.isInit&&Array.isArray(e.representations)));if(!c.length)return;const u=Aw(null===(i=l)||void 0===i?void 0:i.offset),d=Uy(c,Math.max(0,s-u),{preferRepresentationTime:!0}),h=Number(null==d?void 0:d.offset);return Number.isFinite(h)?h:void 0}function _x(e,t,n=(e=>null===(e=M(Fw,this))||void 0===e?void 0:e.currentTime)()){var i;const r=(Array.isArray(null===(i=M(Fw,this))||void 0===i?void 0:i.placements)?M(Fw,this).placements:[]).filter((t=>(null==t?void 0:t.nodeId)===e&&Number.isFinite(sm(t)))).sort(((e,t)=>sm(e)-sm(t)));if(!r.length)return t;const o=Number(n);if(!Number.isFinite(o))return t||r[0];let s,a;for(let e=0;e<r.length;e+=1){const t=r[e],n=sm(t);if(!Number.isFinite(n))continue;const i=rm(t,M(Nw,this)),l=Number.isFinite(i)&&i>=0;(!a&&n>=o-Ew&&(a=t),l)?o+Ew>=n&&o<n+i-Ew&&(s=t):o+Ew>=n&&(s=t)}return s||a||r[r.length-1]}function Tx(e,t){var n;const i=Number(sm(t));if(!Number.isFinite(i))return;const r=rm(t,M(Nw,this)),o=Number.isFinite(r)&&r>=0?i+r:void 0,s=(Array.isArray(null===(n=M(Fw,this))||void 0===n?void 0:n.placements)?M(Fw,this).placements:[]).filter((t=>(null==t?void 0:t.nodeId)===e&&Number.isFinite(sm(t)))).sort(((e,t)=>sm(e)-sm(t)));for(let e=0;e<s.length;e+=1){const t=s[e],n=Number(sm(t));if(Number.isFinite(n)&&!(n<=i+Ew)){if(Number.isFinite(o)&&n>o+Ew)return;return t}}}function Ix(){const e=[];let t=!1,n=1/0;if(M(Cw,this).forEach(((i,r)=>{if(!r||!i)return;const o=M(Ow,this).get(r);if(o)return t=!0,void(n=Math.min(n,Aw(o.timelineStart)));const s=A(Xw,this,Sx).call(this,r,i);s&&(t=!0,n=Math.min(n,Aw(s.timelineStart)),e.push(s))})),!t||!Number.isFinite(n))return{hasPending:!1,waveTime:void 0,startable:[]};const i=e.filter((e=>Aw(e.timelineStart)===n&&!M(Rw,this).has(e.nodeId))).sort(((e,t)=>{const n=Number.isFinite(null==e?void 0:e.timelineStart)?e.timelineStart:Number.POSITIVE_INFINITY,i=Number.isFinite(null==t?void 0:t.timelineStart)?t.timelineStart:Number.POSITIVE_INFINITY;return n!==i?n-i:String(e.nodeId).localeCompare(String(t.nodeId))}));return{hasPending:!0,waveTime:n,startable:i}}function Ex({waveTime:e,startable:t}){const n=Math.max(0,this.settings.maxConcurrentLoads-M(Rw,this).size);n&&t.length&&t.slice(0,n).forEach((t=>{A(Xw,this,Nx).call(this,t,e).finally((()=>{setTimeout((()=>A(Xw,this,bx).call(this)),0)}))}))}function Sx(e,t){var n,i;const r=M(Nw,this)&&"function"==typeof M(Nw,this).get?M(Nw,this).get(e):void 0;if(!r)return;if("function"==typeof r.hasExceededManifestLoadAttempts&&r.hasExceededManifestLoadAttempts())return void M(Cw,this).delete(e);const o=A(Xw,this,_x).call(this,e,t,null===(n=M(Fw,this))||void 0===n?void 0:n.currentTime),s=Number(sm(o)),a=Aw(null===(i=M(Fw,this))||void 0===i?void 0:i.currentTime),l="function"==typeof r.loadMediaSegmentsAtOffset,c="function"==typeof r.load;if(!l&&!c)return void M(Cw,this).delete(e);if(r.isLoaded)return void M(Cw,this).delete(e);if("ready"!==r.state){if(!Number.isFinite(s))return;return{nodeId:e,segmentOffset:0,timelineStart:s}}if(!A(Xw,this,Px).call(this,r))return void M(Cw,this).delete(e);const u=Array.isArray(r.tracks)?r.tracks:[],d=u.some((e=>{const t=(Array.isArray(null==e?void 0:e.segments)?e.segments:[]).find((e=>(null==e?void 0:e.isInit)&&Array.isArray(null==e?void 0:e.representations)));return!!t&&!A(Xw,this,tx).call(this,t)})),h=new Set;u.forEach((e=>{(Array.isArray(null==e?void 0:e.segments)?e.segments:[]).forEach((e=>{if(!e||e.isInit||!Array.isArray(e.representations))return;const t=Number(e.offset);if(Number.isFinite(t)){const e=Math.round(t/Ew)*Ew;h.add(e)}}))}));const f=Array.from(h).sort(((e,t)=>e-t)),p=t=>{const n=Number(sm(t));if(!Number.isFinite(n))return{status:"none"};const i=Aw(null==t?void 0:t.nodeOffsetOverride),o=Math.max(0,a-n+i);let s=0;for(let e=0;e<f.length&&f[e]<=o+Ew;e+=1)s=e;const l=f.slice(s);if(!l.some((e=>A(Xw,this,Ax).call(this,r,e))))return{status:f.slice(0,s).some((e=>A(Xw,this,Ax).call(this,r,e)))?"beforeOnly":"none"};const c=l.find((e=>A(Xw,this,Ax).call(this,r,e))),u=Math.max(0,Aw(c)-i);return{status:"work",work:{nodeId:e,segmentOffset:c,timelineStart:n+u}}},m=p(o);if("work"===m.status)return m.work;if("beforeOnly"!==m.status){if(d&&Number.isFinite(s))return{nodeId:e,segmentOffset:0,timelineStart:s};M(Cw,this).delete(e)}else{const t=A(Xw,this,Tx).call(this,e,o);if(t){const e=p(t);if("work"===e.status)return e.work}}}function Ax(e,t){const n=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[],i=Aw(t);return n.some((e=>(Array.isArray(null==e?void 0:e.segments)?e.segments:[]).some((e=>{if(!e||e.isInit||!Array.isArray(e.representations))return!1;const t=Number(e.offset);return Number.isFinite(t)&&Math.abs(t-i)<=Ew&&!A(Xw,this,tx).call(this,e)}))))}async function Nx(e,t){const n=null==e?void 0:e.nodeId,i=null==e?void 0:e.segmentOffset;if(this.log.debug(`[#loadP0Work] Loading ${Sw} node [${n}] at segmentOffset=${i} wave=${t}`),!n)return;const r=M(Nw,this)&&"function"==typeof M(Nw,this).get?M(Nw,this).get(n):void 0;if(!r)return void M(Cw,this).delete(n);const o="function"==typeof r.loadMediaSegmentsAtOffset&&Number.isFinite(i),{signal:s,controller:a}=A(Xw,this,sx).call(this,n,{allowSeekKeep:o,segmentOffset:i});if(s&&s.aborted)A(Xw,this,lx).call(this,n,a);else{M(Rw,this).add(n),M(Ow,this).set(n,{timelineStart:t,segmentOffset:i});try{"function"==typeof r.loadMediaSegmentsAtOffset?await r.loadMediaSegmentsAtOffset(i,{signal:s}):"function"==typeof r.load&&await r.load({loadingMode:"full",signal:s})}catch(e){if(ly(e,s))return;const t=`[#loadP0Work] SegmentLoadCoordinator failed to load ${Sw} work for node ${n}: ${(null==e?void 0:e.message)||e}`;this.log.warn(t)}finally{this.log.debug(`[#loadP0Work] Finished ${Sw} work for node [${n}]`),M(Ow,this).delete(n),M(Rw,this).delete(n),A(Xw,this,lx).call(this,n,a)}}}function Mx(){const e=new Set([...M(Cw,this).keys(),...M(Rw,this)]),t=A(Xw,this,Fx).call(this),n=Array.isArray(null==t?void 0:t.orderedIds)?t.orderedIds:null,i=Array.isArray(null==t?void 0:t.reachableIds)&&t.reachableIds.length?new Set(t.reachableIds):null,r=e=>!("function"==typeof e.hasExceededManifestLoadAttempts&&e.hasExceededManifestLoadAttempts()||e.isLoaded||"ready"===e.state&&A(Xw,this,Rx).call(this,e));if(i){const t=Fk({prioritizer:M(Mw,this),repository:M(Nw,this),startNodeId:M(Bw,this),prioritizedIds:n,pendingIds:e,allowedIds:i,filter:r});if(t.length)return t}return Fk({prioritizer:M(Mw,this),repository:M(Nw,this),startNodeId:M(Bw,this),prioritizedIds:n,pendingIds:e,filter:r})}function Fx(){return M(Mw,this)&&M(Bw,this)?"function"==typeof M(Mw,this).getPrioritizationSnapshot?M(Mw,this).getPrioritizationSnapshot(M(Bw,this)):{orderedIds:"function"==typeof M(Mw,this).sortNodes?M(Mw,this).sortNodes(M(Bw,this)):[],reachableIds:"function"==typeof M(Mw,this).getReachableNodeIds?M(Mw,this).getReachableNodeIds(M(Bw,this)):[]}:null}function Cx(){A(Xw,this,Jw).call(this)||(M(Lw,this)||M(Cw,this).size)&&(C(Pw,this,A(Xw,this,Mx).call(this)),M(Lw,this)&&!M(Gw,this)&&A(Xw,this,bx).call(this))}async function Ox(e,t){if(this.log.debug(`[#loadNode] Loading node [${e}] in '${t}' mode`),!e)return;const n=M(Nw,this)&&"function"==typeof M(Nw,this).get?M(Nw,this).get(e):void 0;if(!n||"function"!=typeof n.load)return;if("function"==typeof n.hasExceededManifestLoadAttempts&&n.hasExceededManifestLoadAttempts())return;if(n.isLoaded)return void this.log.debug(`[#loadNode] Skipping load for ${e}: already loaded`);const{signal:i,controller:r}=A(Xw,this,sx).call(this,e,{allowSeekKeep:!1});if(i&&i.aborted)A(Xw,this,lx).call(this,e,r);else try{if("ready"!==n.state&&await n.resolve({signal:i}),"ready"!==n.state)return void this.log.debug(`[#loadNode] Skipping load for ${e}: not ready`);if("partial"===t&&A(Xw,this,Rx).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${e}: partial already loaded`);if(!A(Xw,this,Px).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${e}: no loadable tracks`);M(Rw,this).add(e),await n.load({loadingMode:t,signal:i})}catch(t){if(ly(t,i))return;this.log.warn(`[#loadNode] SegmentLoadCoordinator failed to load node ${e}: ${(null==t?void 0:t.message)||t}`)}finally{this.log.debug(`[#loadNode] Finished loading node [${e}]`),M(Rw,this).delete(e),A(Xw,this,lx).call(this,e,r)}}function Px(e){return(Array.isArray(e.tracks)?e.tracks:[]).some((e=>{var t;return null==e||null===(t=e.segments)||void 0===t?void 0:t.length}))}function Rx(e){const t=(Array.isArray(null==e?void 0:e.tracks)?e.tracks:[]).filter((e=>Array.isArray(null==e?void 0:e.segments)&&e.segments.length));return!t.length||t.every((e=>{const t=Array.isArray(null==e?void 0:e.segments)?e.segments:[];if(!t.length)return!0;const n=t.find((e=>null==e?void 0:e.isInit)),i=t.find((e=>e&&!e.isInit));return!(n&&!A(Xw,this,tx).call(this,n)||i&&!A(Xw,this,tx).call(this,i))}))}class Dx extends od{constructor(...e){super(...e),this.track=void 0,this.lastSegment=void 0}get name(){return"BaseDecoder"}configure(e){this.track=e}decode(e){this.lastSegment=e}decodeChunk(e,t){}onDispose(){this.track=void 0,this.lastSegment=void 0}}function Lx(e){if(!e)throw new Error("Assertion failed.")}const Bx=e=>e&&e[e.length-1],zx=e=>{let t=0;for(;0===e.readBits(1)&&t<32;)t++;if(t>=32)throw new Error("Invalid exponential-Golomb code.");return(1<<t)-1+e.readBits(t)},Wx=e=>e.constructor===Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e),$x=e=>e.constructor===DataView?e:ArrayBuffer.isView(e)?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(e),jx=new TextDecoder,Ux=e=>Object.fromEntries(Object.entries(e).map((([e,t])=>[t,e]))),qx={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},Vx=Ux(qx),Gx={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},Hx=Ux(Gx),Kx={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},Xx=Ux(Kx),Yx=e=>[...e].map((e=>e.toString(16).padStart(2,"0"))).join(""),Qx=e=>(e=(e=(e=(e=(e=e>>1&1431655765|(1431655765&e)<<1)>>2&858993459|(858993459&e)<<2)>>4&252645135|(252645135&e)<<4)>>8&16711935|(16711935&e)<<8)>>16&65535|(65535&e)<<16)>>>0,Jx=(e,t,n)=>{let i=0,r=e.length-1,o=-1;for(;i<=r;){const s=i+r>>1,a=n(e[s]);a===t?(o=s,r=s-1):a<t?i=s+1:r=s-1}return o},Zx=(e,t,n)=>{let i=0,r=e.length-1,o=-1;for(;i<=r;){const s=i+(r-i+1)/2|0;n(e[s])<=t?(o=s,i=s+1):r=s-1}return o},e_=()=>{let e,t;return{promise:new Promise(((n,i)=>{e=n,t=i})),resolve:e,reject:t}},t_=(e,t,n)=>e.getUint8(t)<<16|e.getUint8(t+1)<<8|e.getUint8(t+2),n_=(e,t,n)=>Math.max(t,Math.min(n,e)),i_=/^[a-z]{3}$/,r_=1e6*(1+Number.EPSILON);let o_=null;let s_=null;const a_=()=>{if(null!==s_)return s_;if("undefined"==typeof navigator)return null;const e=/\bChrome\/(\d+)/.exec(navigator.userAgent);return e?s_=Number(e[1]):null},l_=e=>"number"==typeof e&&!Number.isNaN(e);class c_{constructor(e,t){if(this.data=e,this.mimeType=t,!(e instanceof Uint8Array))throw new TypeError("data must be a Uint8Array.");if("string"!=typeof t)throw new TypeError("mimeType must be a string.")}}const u_={default:!0,forced:!1,original:!1,commentary:!1,hearingImpaired:!1,visuallyImpaired:!1};class d_{constructor(e){this.bytes=e,this.pos=0}seekToByte(e){this.pos=8*e}readBit(){var e;const t=Math.floor(this.pos/8),n=null!==(e=this.bytes[t])&&void 0!==e?e:0,i=7-(7&this.pos),r=(n&1<<i)>>i;return this.pos++,r}readBits(e){if(1===e)return this.readBit();let t=0;for(let n=0;n<e;n++)t<<=1,t|=this.readBit();return t}writeBits(e,t){const n=this.pos+e;for(let e=this.pos;e<n;e++){const i=Math.floor(e/8);let r=this.bytes[i];const o=7-(7&e);r&=~(1<<o),r|=(t&1<<n-e-1)>>n-e-1<<o,this.bytes[i]=r}this.pos=n}readAlignedByte(){var e;if(this.pos%8!=0)throw new Error("Bitstream is not byte-aligned.");const t=this.pos/8,n=null!==(e=this.bytes[t])&&void 0!==e?e:0;return this.pos+=8,n}skipBits(e){this.pos+=e}getBitsLeft(){return 8*this.bytes.length-this.pos}clone(){const e=new d_(this.bytes);return e.pos=this.pos,e}}const h_=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],f_=[-1,1,2,3,4,5,6,8],p_=e=>{if(!e||e.byteLength<2)throw new TypeError("AAC description must be at least 2 bytes long.");const t=new d_(e);let n=t.readBits(5);31===n&&(n=32+t.readBits(6));const i=t.readBits(4);let r=null;15===i?r=t.readBits(24):i<h_.length&&(r=h_[i]);const o=t.readBits(4);let s=null;return o>=1&&o<=7&&(s=f_[o]),{objectType:n,frequencyIndex:i,sampleRate:r,channelConfiguration:o,numberOfChannels:s}},m_=["pcm-s16","pcm-s16be","pcm-s24","pcm-s24be","pcm-s32","pcm-s32be","pcm-f32","pcm-f32be","pcm-f64","pcm-f64be","pcm-u8","pcm-s8","ulaw","alaw"],v_=[{maxPictureSize:36864,maxBitrate:2e5,level:10},{maxPictureSize:73728,maxBitrate:8e5,level:11},{maxPictureSize:122880,maxBitrate:18e5,level:20},{maxPictureSize:245760,maxBitrate:36e5,level:21},{maxPictureSize:552960,maxBitrate:72e5,level:30},{maxPictureSize:983040,maxBitrate:12e6,level:31},{maxPictureSize:2228224,maxBitrate:18e6,level:40},{maxPictureSize:2228224,maxBitrate:3e7,level:41},{maxPictureSize:8912896,maxBitrate:6e7,level:50},{maxPictureSize:8912896,maxBitrate:12e7,level:51},{maxPictureSize:8912896,maxBitrate:18e7,level:52},{maxPictureSize:35651584,maxBitrate:18e7,level:60},{maxPictureSize:35651584,maxBitrate:24e7,level:61},{maxPictureSize:35651584,maxBitrate:48e7,level:62}],g_=e=>{const{codec:t,codecDescription:n,colorSpace:i,avcCodecInfo:r,hevcCodecInfo:o,vp9CodecInfo:s,av1CodecInfo:a}=e;if("avc"===t){if(Lx(null!==e.avcType),r){const t=new Uint8Array([r.avcProfileIndication,r.profileCompatibility,r.avcLevelIndication]);return`avc${e.avcType}.${Yx(t)}`}if(!n||n.byteLength<4)throw new TypeError("AVC decoder description is not provided or is not at least 4 bytes long.");return`avc${e.avcType}.${Yx(n.subarray(1,4))}`}if("hevc"===t){let e,t,i,r,s,a;if(o)e=o.generalProfileSpace,t=o.generalProfileIdc,i=Qx(o.generalProfileCompatibilityFlags),r=o.generalTierFlag,s=o.generalLevelIdc,a=[...o.generalConstraintIndicatorFlags];else{if(!n||n.byteLength<23)throw new TypeError("HEVC decoder description is not provided or is not at least 23 bytes long.");const o=$x(n),l=o.getUint8(1);e=l>>6&3,t=31&l,i=Qx(o.getUint32(2)),r=l>>5&1,s=o.getUint8(12),a=[];for(let e=0;e<6;e++)a.push(o.getUint8(6+e))}let l="hev1.";for(l+=["","A","B","C"][e]+t,l+=".",l+=i.toString(16).toUpperCase(),l+=".",l+=0===r?"L":"H",l+=s;a.length>0&&0===a[a.length-1];)a.pop();return a.length>0&&(l+=".",l+=a.map((e=>e.toString(16).toUpperCase())).join(".")),l}if("vp8"===t)return"vp8";if("vp9"===t){if(!s){const t=e.width*e.height;let n=Bx(v_).level;for(const e of v_)if(t<=e.maxPictureSize){n=e.level;break}return`vp09.00.${n.toString().padStart(2,"0")}.08`}let t=`vp09.${s.profile.toString().padStart(2,"0")}.${s.level.toString().padStart(2,"0")}.${s.bitDepth.toString().padStart(2,"0")}.${s.chromaSubsampling.toString().padStart(2,"0")}`;return t+=`.${s.colourPrimaries.toString().padStart(2,"0")}.${s.transferCharacteristics.toString().padStart(2,"0")}.${s.matrixCoefficients.toString().padStart(2,"0")}.${s.videoFullRangeFlag.toString().padStart(2,"0")}`,t.endsWith(".01.01.01.01.00")&&(t=t.slice(0,-15)),t}if("av1"===t){if(!a){const t=e.width*e.height;let n=Bx(v_).level;for(const e of v_)if(t<=e.maxPictureSize){n=e.level;break}return`av01.0.${n.toString().padStart(2,"0")}M.08`}const t=a.profile,n=a.level.toString().padStart(2,"0"),r=a.tier?"H":"M",o=a.bitDepth.toString().padStart(2,"0"),s=a.monochrome?"1":"0",l=100*a.chromaSubsamplingX+10*a.chromaSubsamplingY+1*(a.chromaSubsamplingX&&a.chromaSubsamplingY?a.chromaSamplePosition:0),c=null!=i&&i.primaries?qx[i.primaries]:1,u=null!=i&&i.transfer?Gx[i.transfer]:1,d=null!=i&&i.matrix?Kx[i.matrix]:1,h=null!=i&&i.fullRange?1:0;let f=`av01.${t}.${n}${r}.${o}`;return f+=`.${s}.${l.toString().padStart(3,"0")}`,f+=`.${c.toString().padStart(2,"0")}`,f+=`.${u.toString().padStart(2,"0")}`,f+=`.${d.toString().padStart(2,"0")}`,f+=`.${h}`,f.endsWith(".0.110.01.01.01.0")&&(f=f.slice(0,-17)),f}throw new TypeError(`Unhandled codec '${t}'.`)},y_=e=>{const{codec:t,codecDescription:n,aacCodecInfo:i}=e;if("aac"===t){if(!i)throw new TypeError("AAC codec info must be provided.");if(i.isMpeg2)return"mp4a.67";{let e;return e=null!==i.objectType?i.objectType:p_(n).objectType,`mp4a.40.${e}`}}if("mp3"===t)return"mp3";if("opus"===t)return"opus";if("vorbis"===t)return"vorbis";if("flac"===t)return"flac";if("ac3"===t)return"ac-3";if("eac3"===t)return"ec-3";if(t&&m_.includes(t))return t;throw new TypeError(`Unhandled codec '${t}'.`)},b_=/^pcm-([usf])(\d+)+(be)?$/,k_=[48e3,44100,32e3],w_=[24e3,22050,16e3];var x_,__;!function(e){e[e.NON_IDR_SLICE=1]="NON_IDR_SLICE",e[e.SLICE_DPA=2]="SLICE_DPA",e[e.SLICE_DPB=3]="SLICE_DPB",e[e.SLICE_DPC=4]="SLICE_DPC",e[e.IDR=5]="IDR",e[e.SEI=6]="SEI",e[e.SPS=7]="SPS",e[e.PPS=8]="PPS",e[e.AUD=9]="AUD",e[e.SPS_EXT=13]="SPS_EXT"}(x_||(x_={})),function(e){e[e.RASL_N=8]="RASL_N",e[e.RASL_R=9]="RASL_R",e[e.BLA_W_LP=16]="BLA_W_LP",e[e.RSV_IRAP_VCL23=23]="RSV_IRAP_VCL23",e[e.VPS_NUT=32]="VPS_NUT",e[e.SPS_NUT=33]="SPS_NUT",e[e.PPS_NUT=34]="PPS_NUT",e[e.AUD_NUT=35]="AUD_NUT",e[e.PREFIX_SEI_NUT=39]="PREFIX_SEI_NUT",e[e.SUFFIX_SEI_NUT=40]="SUFFIX_SEI_NUT"}(__||(__={}));const T_=function*(e){let t=0,n=-1;for(;t<e.length-2;){const i=e.indexOf(0,t);if(-1===i||i>=e.length-2)break;t=i;let r=0;t+3<e.length&&0===e[t+1]&&0===e[t+2]&&1===e[t+3]?r=4:0===e[t+1]&&1===e[t+2]&&(r=3),0!==r?(-1!==n&&t>n&&(yield{offset:n,length:t-n}),n=t+r,t=n):t++}-1!==n&&n<e.length&&(yield{offset:n,length:e.length-n})},I_=function*(e,t){let n=0;const i=new DataView(e.buffer,e.byteOffset,e.byteLength);for(;n+t<=e.length;){let e;1===t?e=i.getUint8(n):2===t?e=i.getUint16(n,!1):3===t?e=t_(i,n):(Lx(4===t),e=i.getUint32(n,!1)),n+=t,yield{offset:n,length:e},n+=e}},E_=e=>31&e,S_=e=>{const t=[],n=e.length;for(let i=0;i<n;i++)i+2<n&&0===e[i]&&0===e[i+1]&&3===e[i+2]?(t.push(0,0),i+=2):t.push(e[i]);return new Uint8Array(t)},A_=e=>e>>1&63,N_=function*(e){const t=new d_(e),n=()=>{let e=0;for(let n=0;n<8;n++){const i=t.readAlignedByte();if(e|=(127&i)<<7*n,!(128&i))break;if(7===n&&128&i)return null}return e>=2**32-1?null:e};for(;t.getBitsLeft()>=8;){t.skipBits(1);const i=t.readBits(4),r=t.readBits(1),o=t.readBits(1);let s;if(t.skipBits(1),r&&t.skipBits(8),o){const e=n();if(null===e)return;s=e}else s=Math.floor(t.getBitsLeft()/8);Lx(t.pos%8==0),yield{type:i,data:e.subarray(t.pos/8,t.pos/8+s)},t.skipBits(8*s)}};var M_;!function(e){e[e.STREAMINFO=0]="STREAMINFO",e[e.VORBIS_COMMENT=4]="VORBIS_COMMENT",e[e.PICTURE=6]="PICTURE"}(M_||(M_={}));const F_=[2,1,2,3,3,4,4,5];class C_{constructor(e){this.input=e}}const O_=[],P_=[],R_=new Uint8Array(0);class D_{constructor(e,t,n,i,r=-1,o,s){if(this.data=e,this.type=t,this.timestamp=n,this.duration=i,this.sequenceNumber=r,e===R_&&void 0===o)throw new Error("Internal error: byteLength must be explicitly provided when constructing metadata-only packets.");if(void 0===o&&(o=e.byteLength),!(e instanceof Uint8Array))throw new TypeError("data must be a Uint8Array.");if("key"!==t&&"delta"!==t)throw new TypeError('type must be either "key" or "delta".');if(!Number.isFinite(n))throw new TypeError("timestamp must be a number.");if(!Number.isFinite(i)||i<0)throw new TypeError("duration must be a non-negative number.");if(!Number.isFinite(r))throw new TypeError("sequenceNumber must be a number.");if(!Number.isInteger(o)||o<0)throw new TypeError("byteLength must be a non-negative integer.");if(void 0!==s&&("object"!=typeof s||!s))throw new TypeError("sideData, when provided, must be an object.");if(void 0!==(null==s?void 0:s.alpha)&&!(s.alpha instanceof Uint8Array))throw new TypeError("sideData.alpha, when provided, must be a Uint8Array.");if(void 0!==(null==s?void 0:s.alphaByteLength)&&(!Number.isInteger(s.alphaByteLength)||s.alphaByteLength<0))throw new TypeError("sideData.alphaByteLength, when provided, must be a non-negative integer.");this.byteLength=o,this.sideData=null!=s?s:{},this.sideData.alpha&&void 0===this.sideData.alphaByteLength&&(this.sideData.alphaByteLength=this.sideData.alpha.byteLength)}get isMetadataOnly(){return this.data===R_}get microsecondTimestamp(){return Math.trunc(r_*this.timestamp)}get microsecondDuration(){return Math.trunc(r_*this.duration)}toEncodedVideoChunk(){if(this.isMetadataOnly)throw new TypeError("Metadata-only packets cannot be converted to a video chunk.");if("undefined"==typeof EncodedVideoChunk)throw new Error("Your browser does not support EncodedVideoChunk.");return new EncodedVideoChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}alphaToEncodedVideoChunk(e=this.type){if(!this.sideData.alpha)throw new TypeError("This packet does not contain alpha side data.");if(this.isMetadataOnly)throw new TypeError("Metadata-only packets cannot be converted to a video chunk.");if("undefined"==typeof EncodedVideoChunk)throw new Error("Your browser does not support EncodedVideoChunk.");return new EncodedVideoChunk({data:this.sideData.alpha,type:e,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}toEncodedAudioChunk(){if(this.isMetadataOnly)throw new TypeError("Metadata-only packets cannot be converted to an audio chunk.");if("undefined"==typeof EncodedAudioChunk)throw new Error("Your browser does not support EncodedAudioChunk.");return new EncodedAudioChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}static fromEncodedChunk(e,t){var n;if(!(e instanceof EncodedVideoChunk||e instanceof EncodedAudioChunk))throw new TypeError("chunk must be an EncodedVideoChunk or EncodedAudioChunk.");const i=new Uint8Array(e.byteLength);return e.copyTo(i),new D_(i,e.type,e.timestamp/1e6,(null!==(n=e.duration)&&void 0!==n?n:0)/1e6,void 0,void 0,t)}clone(e){var t,n,i,r,o,s;if(void 0!==e&&("object"!=typeof e||null===e))throw new TypeError("options, when provided, must be an object.");if(void 0!==(null==e?void 0:e.data)&&!(e.data instanceof Uint8Array))throw new TypeError("options.data, when provided, must be a Uint8Array.");if(void 0!==(null==e?void 0:e.type)&&"key"!==e.type&&"delta"!==e.type)throw new TypeError('options.type, when provided, must be either "key" or "delta".');if(void 0!==(null==e?void 0:e.timestamp)&&!Number.isFinite(e.timestamp))throw new TypeError("options.timestamp, when provided, must be a number.");if(void 0!==(null==e?void 0:e.duration)&&!Number.isFinite(e.duration))throw new TypeError("options.duration, when provided, must be a number.");if(void 0!==(null==e?void 0:e.sequenceNumber)&&!Number.isFinite(e.sequenceNumber))throw new TypeError("options.sequenceNumber, when provided, must be a number.");if(void 0!==(null==e?void 0:e.sideData)&&("object"!=typeof e.sideData||null===e.sideData))throw new TypeError("options.sideData, when provided, must be an object.");return new D_(null!==(t=null==e?void 0:e.data)&&void 0!==t?t:this.data,null!==(n=null==e?void 0:e.type)&&void 0!==n?n:this.type,null!==(i=null==e?void 0:e.timestamp)&&void 0!==i?i:this.timestamp,null!==(r=null==e?void 0:e.duration)&&void 0!==r?r:this.duration,null!==(o=null==e?void 0:e.sequenceNumber)&&void 0!==o?o:this.sequenceNumber,this.byteLength,null!==(s=null==e?void 0:e.sideData)&&void 0!==s?s:this.sideData)}}const L_=e=>{if(!e||"object"!=typeof e)throw new TypeError("options must be an object.");if(void 0!==e.metadataOnly&&"boolean"!=typeof e.metadataOnly)throw new TypeError("options.metadataOnly, when defined, must be a boolean.");if(void 0!==e.verifyKeyPackets&&"boolean"!=typeof e.verifyKeyPackets)throw new TypeError("options.verifyKeyPackets, when defined, must be a boolean.");if(e.verifyKeyPackets&&e.metadataOnly)throw new TypeError("options.verifyKeyPackets and options.metadataOnly cannot be enabled together.")},B_=e=>{if(!l_(e))throw new TypeError("timestamp must be a number.")},z_=(e,t,n)=>n.verifyKeyPackets?t.then((async t=>{if(!t||"delta"===t.type)return t;const n=await e.determinePacketType(t);return n&&(t.type=n),t})):t;class W_{constructor(e){if(!(e instanceof $_))throw new TypeError("track must be an InputTrack.");this._track=e}getFirstPacket(e={}){if(L_(e),this._track.input._disposed)throw new fT;return z_(this._track,this._track._backing.getFirstPacket(e),e)}async getFirstKeyPacket(e={}){L_(e);const t=await this.getFirstPacket(e);return t?"key"===t.type?t:this.getNextKeyPacket(t,e):null}getPacket(e,t={}){if(B_(e),L_(t),this._track.input._disposed)throw new fT;return z_(this._track,this._track._backing.getPacket(e,t),t)}getNextPacket(e,t={}){if(!(e instanceof D_))throw new TypeError("packet must be an EncodedPacket.");if(L_(t),this._track.input._disposed)throw new fT;return z_(this._track,this._track._backing.getNextPacket(e,t),t)}async getKeyPacket(e,t={}){if(B_(e),L_(t),this._track.input._disposed)throw new fT;if(!t.verifyKeyPackets)return this._track._backing.getKeyPacket(e,t);const n=await this._track._backing.getKeyPacket(e,t);return n?(Lx("key"===n.type),"delta"===await this._track.determinePacketType(n)?this.getKeyPacket(n.timestamp-1/this._track.timeResolution,t):n):n}async getNextKeyPacket(e,t={}){if(!(e instanceof D_))throw new TypeError("packet must be an EncodedPacket.");if(L_(t),this._track.input._disposed)throw new fT;if(!t.verifyKeyPackets)return this._track._backing.getNextKeyPacket(e,t);const n=await this._track._backing.getNextKeyPacket(e,t);return n?(Lx("key"===n.type),"delta"===await this._track.determinePacketType(n)?this.getNextKeyPacket(n,t):n):n}packets(e,t,n={}){if(void 0!==e&&!(e instanceof D_))throw new TypeError("startPacket must be an EncodedPacket.");if(void 0!==e&&e.isMetadataOnly&&(null==n||!n.metadataOnly))throw new TypeError("startPacket can only be metadata-only if options.metadataOnly is enabled.");if(void 0!==t&&!(t instanceof D_))throw new TypeError("endPacket must be an EncodedPacket.");if(L_(n),this._track.input._disposed)throw new fT;const i=[];let{promise:r,resolve:o}=e_(),{promise:s,resolve:a}=e_(),l=!1,c=!1,u=null;const d=[];(async()=>{let u=null!=e?e:await this.getFirstPacket(n);for(;u&&!c&&!this._track.input._disposed&&!(t&&u.sequenceNumber>=(null==t?void 0:t.sequenceNumber));)i.length>Math.max(2,d.length)?(({promise:s,resolve:a}=e_()),await s):(i.push(u),o(),({promise:r,resolve:o}=e_()),u=await this.getNextPacket(u,n));l=!0,o()})().catch((e=>{u||(u=e,o())}));const h=this._track;return{async next(){for(;;){if(h.input._disposed)throw new fT;if(c)return{value:void 0,done:!0};if(u)throw u;if(i.length>0){const e=i.shift(),t=performance.now();for(d.push(t);d.length>0&&t-d[0]>=1e3;)d.shift();return a(),{value:e,done:!1}}if(l)return{value:void 0,done:!0};await r}},return:async()=>(c=!0,a(),o(),{value:void 0,done:!0}),async throw(e){throw e},[Symbol.asyncIterator](){return this}}}}class $_{constructor(e,t){this.input=e,this._backing=t}isVideoTrack(){return this instanceof j_}isAudioTrack(){return this instanceof U_}get id(){return this._backing.getId()}get number(){return this._backing.getNumber()}get internalCodecId(){return this._backing.getInternalCodecId()}get languageCode(){return this._backing.getLanguageCode()}get name(){return this._backing.getName()}get timeResolution(){return this._backing.getTimeResolution()}get disposition(){return this._backing.getDisposition()}getFirstTimestamp(){return this._backing.getFirstTimestamp()}computeDuration(){return this._backing.computeDuration()}async computePacketStats(e=1/0){const t=new W_(this);let n=1/0,i=-1/0,r=0,o=0;for await(const s of t.packets(void 0,void 0,{metadataOnly:!0})){if(r>=e&&s.timestamp>=i)break;n=Math.min(n,s.timestamp),i=Math.max(i,s.timestamp+s.duration),r++,o+=s.byteLength}return{packetCount:r,averagePacketRate:r?Number((r/(i-n)).toPrecision(16)):0,averageBitrate:r?Number((8*o/(i-n)).toPrecision(16)):0}}}class j_ extends $_{constructor(e,t){super(e,t),this._backing=t,this.pixelAspectRatio=(e=>{Lx(0!==e.den);let t=Math.abs(e.num),n=Math.abs(e.den);for(;0!==n;){const e=t%n;t=n,n=e}const i=t||1;return{num:e.num/i,den:e.den/i}})({num:this._backing.getSquarePixelWidth()*this._backing.getCodedHeight(),den:this._backing.getSquarePixelHeight()*this._backing.getCodedWidth()})}get type(){return"video"}get codec(){return this._backing.getCodec()}get codedWidth(){return this._backing.getCodedWidth()}get codedHeight(){return this._backing.getCodedHeight()}get rotation(){return this._backing.getRotation()}get squarePixelWidth(){return this._backing.getSquarePixelWidth()}get squarePixelHeight(){return this._backing.getSquarePixelHeight()}get displayWidth(){return this._backing.getRotation()%180==0?this.squarePixelWidth:this.squarePixelHeight}get displayHeight(){return this._backing.getRotation()%180==0?this.squarePixelHeight:this.squarePixelWidth}getColorSpace(){return this._backing.getColorSpace()}async hasHighDynamicRange(){const e=await this._backing.getColorSpace();return"bt2020"===e.primaries||"smpte432"===e.primaries||"pg"===e.transfer||"hlg"===e.transfer||"bt2020-ncl"===e.matrix}canBeTransparent(){return this._backing.canBeTransparent()}getDecoderConfig(){return this._backing.getDecoderConfig()}async getCodecParameterString(){var e;const t=await this._backing.getDecoderConfig();return null!==(e=null==t?void 0:t.codec)&&void 0!==e?e:null}async canDecode(){try{const e=await this._backing.getDecoderConfig();if(!e)return!1;const t=this._backing.getCodec();return Lx(null!==t),O_.some((n=>n.supports(t,e)))?!0:"undefined"!=typeof VideoDecoder&&!0===(await VideoDecoder.isConfigSupported(e)).supported}catch(e){return console.error("Error during decodability check:",e),!1}}async determinePacketType(e){if(!(e instanceof D_))throw new TypeError("packet must be an EncodedPacket.");if(e.isMetadataOnly)throw new TypeError("packet must not be metadata-only to determine its type.");if(null===this.codec)return null;const t=await this.getDecoderConfig();return Lx(t),((e,t,n)=>{switch(e){case"avc":for(const e of((e,t)=>{if(t.description){const n=3&Wx(t.description)[4];return I_(e,n+1)}return T_(e)})(n,t)){const t=n[e.offset],r=E_(t);if(r>=x_.NON_IDR_SLICE&&r<=x_.SLICE_DPC)return"delta";if(r===x_.IDR)return"key";if(r===x_.SEI&&(i=void 0,!(null!==o_?o_:o_=!("undefined"==typeof navigator||(null===(i=navigator.vendor)||void 0===i||!i.includes("Google Inc"))&&!/Chrome/.test(navigator.userAgent)))||a_()>=144)){const t=n.subarray(e.offset,e.offset+e.length),i=S_(t);let r=1;do{let e=0;for(;;){const t=i[r++];if(void 0===t)break;if(e+=t,t<255)break}let t=0;for(;;){const e=i[r++];if(void 0===e)break;if(t+=e,e<255)break}if(6===e){const e=new d_(i);e.pos=8*r;const t=zx(e),n=e.readBits(1);if(0===t&&1===n)return"key"}r+=t}while(r<i.length-1)}}return"delta";case"hevc":for(const e of((e,t)=>{if(t.description){const n=3&Wx(t.description)[21];return I_(e,n+1)}return T_(e)})(n,t)){const t=A_(n[e.offset]);if(t<__.BLA_W_LP)return"delta";if(t<=__.RSV_IRAP_VCL23)return"key"}return"delta";case"vp8":return 1&n[0]?"delta":"key";case"vp9":{const e=new d_(n);if(2!==e.readBits(2))return null;const t=e.readBits(1);return 3===(e.readBits(1)<<1)+t&&e.skipBits(1),e.readBits(1)?null:0===e.readBits(1)?"key":"delta"}case"av1":{let e=!1;for(const{type:t,data:i}of N_(n))if(1===t){const t=new d_(i);t.skipBits(4),e=!!t.readBits(1)}else if(3===t||6===t||7===t){if(e)return"key";const t=new d_(i);return t.readBits(1)?null:0===t.readBits(2)?"key":"delta"}return null}default:(e=>{throw new Error(`Unexpected value: ${e}`)})(e),Lx(!1)}var i})(this.codec,t,e.data)}}class U_ extends $_{constructor(e,t){super(e,t),this._backing=t}get type(){return"audio"}get codec(){return this._backing.getCodec()}get numberOfChannels(){return this._backing.getNumberOfChannels()}get sampleRate(){return this._backing.getSampleRate()}getDecoderConfig(){return this._backing.getDecoderConfig()}async getCodecParameterString(){var e;const t=await this._backing.getDecoderConfig();return null!==(e=null==t?void 0:t.codec)&&void 0!==e?e:null}async canDecode(){try{const e=await this._backing.getDecoderConfig();if(!e)return!1;const t=this._backing.getCodec();return Lx(null!==t),P_.some((n=>n.supports(t,e)))?!0:!!e.codec.startsWith("pcm-")||"undefined"!=typeof AudioDecoder&&!0===(await AudioDecoder.isConfigSupported(e)).supported}catch(e){return console.error("Error during decodability check:",e),!1}}async determinePacketType(e){if(!(e instanceof D_))throw new TypeError("packet must be an EncodedPacket.");return null===this.codec?null:"key"}}const q_=e=>{let t=xT(e);const n=ST(e,4);let i=8;1===t&&(t=TT(e),i=16);const r=t-i;return r<0?null:{name:n,totalSize:t,headerSize:i,contentSize:r}},V_=e=>_T(e)/65536,G_=e=>_T(e)/1073741824,H_=e=>{let t=0;for(let n=0;n<4;n++){t<<=7;const n=yT(e);if(t|=127&n,!(128&n))break}return t},K_=e=>{let t=bT(e);return e.skip(2),t=Math.min(t,e.remainingLength),jx.decode(gT(e,t))},X_=e=>{const t=q_(e);if(!t||"data"!==t.name)return null;if(e.remainingLength<8)return null;const n=xT(e);e.skip(4);const i=gT(e,t.contentSize-8);switch(n){case 1:return jx.decode(i);case 2:return new TextDecoder("utf-16be").decode(i);case 13:return new c_(i,"image/jpeg");case 14:return new c_(i,"image/png");case 27:return new c_(i,"image/bmp");default:return i}};class Y_ extends C_{constructor(e){super(e),this.moovSlice=null,this.currentTrack=null,this.tracks=[],this.metadataPromise=null,this.movieTimescale=-1,this.movieDurationInTimescale=-1,this.isQuickTime=!1,this.metadataTags={},this.currentMetadataKeys=null,this.isFragmented=!1,this.fragmentTrackDefaults=[],this.currentFragment=null,this.lastReadFragment=null,this.reader=e._reader}async computeDuration(){const e=await this.getTracks(),t=await Promise.all(e.map((e=>e.computeDuration())));return Math.max(0,...t)}async getTracks(){return await this.readMetadata(),this.tracks.map((e=>e.inputTrack))}async getMimeType(){await this.readMetadata();const e=await Promise.all(this.tracks.map((e=>e.inputTrack.getCodecParameterString())));return(e=>{let t=(e.hasVideo?"video/":e.hasAudio?"audio/":"application/")+(e.isQuickTime?"quicktime":"mp4");return e.codecStrings.length>0&&(t+=`; codecs="${[...new Set(e.codecStrings)].join(", ")}"`),t})({isQuickTime:this.isQuickTime,hasVideo:this.tracks.some((e=>{var t;return"video"===(null===(t=e.info)||void 0===t?void 0:t.type)})),hasAudio:this.tracks.some((e=>{var t;return"audio"===(null===(t=e.info)||void 0===t?void 0:t.type)})),codecStrings:e.filter(Boolean)})}async getMetadataTags(){return await this.readMetadata(),this.metadataTags}readMetadata(){var e;return null!==(e=this.metadataPromise)&&void 0!==e?e:this.metadataPromise=(async()=>{let e=0;for(;;){let t=this.reader.requestSliceRange(e,8,16);if(t instanceof Promise&&(t=await t),!t)break;const n=e,i=q_(t);if(!i)break;if("ftyp"===i.name){const e=ST(t,4);this.isQuickTime="qt "===e}else if("moov"===i.name){let e=this.reader.requestSlice(t.filePos,i.contentSize);if(e instanceof Promise&&(e=await e),!e)break;this.moovSlice=e,this.readContiguousBoxes(this.moovSlice),this.tracks.sort(((e,t)=>Number(t.disposition.default)-Number(e.disposition.default)));for(const e of this.tracks){const t=e.editListPreviousSegmentDurations/this.movieTimescale;e.editListOffset-=Math.round(t*e.timescale)}break}e=n+i.totalSize}if(this.isFragmented&&null!==this.reader.fileSize){let e=this.reader.requestSlice(this.reader.fileSize-4,4);e instanceof Promise&&(e=await e),Lx(e);const t=xT(e),n=this.reader.fileSize-t;if(n>=0&&n<=this.reader.fileSize-16){let e=this.reader.requestSliceRange(n,8,16);if(e instanceof Promise&&(e=await e),e){const t=q_(e);if(t&&"mfra"===t.name){let n=this.reader.requestSlice(e.filePos,t.contentSize);n instanceof Promise&&(n=await n),n&&this.readContiguousBoxes(n)}}}}})()}getSampleTableForTrack(e){var t;if(e.sampleTable)return e.sampleTable;const n={sampleTimingEntries:[],sampleCompositionTimeOffsets:[],sampleSizes:[],keySampleIndices:null,chunkOffsets:[],sampleToChunk:[],presentationTimestamps:null,presentationTimestampIndexMap:null};e.sampleTable=n,Lx(this.moovSlice);const i=this.moovSlice.slice(e.sampleTableByteOffset);if(this.currentTrack=e,this.traverseBox(i),this.currentTrack=null,"audio"===(null===(t=e.info)||void 0===t?void 0:t.type)&&e.info.codec&&m_.includes(e.info.codec)&&0===n.sampleCompositionTimeOffsets.length){var r;Lx("audio"===(null===(r=e.info)||void 0===r?void 0:r.type));const t=(e=>{if(Lx(m_.includes(e)),"ulaw"===e)return{dataType:"ulaw",sampleSize:1,littleEndian:!0,silentValue:255};if("alaw"===e)return{dataType:"alaw",sampleSize:1,littleEndian:!0,silentValue:213};const t=b_.exec(e);let n;return Lx(t),n="u"===t[1]?"unsigned":"s"===t[1]?"signed":"float",{dataType:n,sampleSize:Number(t[2])/8,littleEndian:"be"!==t[3],silentValue:"pcm-u8"===e?128:0}})(e.info.codec),i=[],o=[];for(let r=0;r<n.sampleToChunk.length;r++){const s=n.sampleToChunk[r],a=n.sampleToChunk[r+1],l=(a?a.startChunkIndex:n.chunkOffsets.length)-s.startChunkIndex;for(let r=0;r<l;r++){const a=s.startSampleIndex+r*s.samplesPerChunk,l=a+s.samplesPerChunk,c=Zx(n.sampleTimingEntries,a,(e=>e.startIndex)),u=n.sampleTimingEntries[c],d=Zx(n.sampleTimingEntries,l,(e=>e.startIndex)),h=n.sampleTimingEntries[d],f=u.startDecodeTimestamp+(a-u.startIndex)*u.delta,p=h.startDecodeTimestamp+(l-h.startIndex)*h.delta-f,m=Bx(i);m&&m.delta===p?m.count++:i.push({startIndex:s.startChunkIndex+r,startDecodeTimestamp:f,count:1,delta:p});const v=s.samplesPerChunk*t.sampleSize*e.info.numberOfChannels;o.push(v)}s.startSampleIndex=s.startChunkIndex,s.samplesPerChunk=1}n.sampleTimingEntries=i,n.sampleSizes=o}if(n.sampleCompositionTimeOffsets.length>0){n.presentationTimestamps=[];for(const e of n.sampleTimingEntries)for(let t=0;t<e.count;t++)n.presentationTimestamps.push({presentationTimestamp:e.startDecodeTimestamp+t*e.delta,sampleIndex:e.startIndex+t});for(const e of n.sampleCompositionTimeOffsets)for(let t=0;t<e.count;t++){const i=e.startIndex+t,r=n.presentationTimestamps[i];r&&(r.presentationTimestamp+=e.offset)}n.presentationTimestamps.sort(((e,t)=>e.presentationTimestamp-t.presentationTimestamp)),n.presentationTimestampIndexMap=Array(n.presentationTimestamps.length).fill(-1);for(let e=0;e<n.presentationTimestamps.length;e++)n.presentationTimestampIndexMap[n.presentationTimestamps[e].sampleIndex]=e}return n}async readFragment(e){var t;if((null===(t=this.lastReadFragment)||void 0===t?void 0:t.moofOffset)===e)return this.lastReadFragment;let n=this.reader.requestSliceRange(e,8,16);n instanceof Promise&&(n=await n),Lx(n);const i=q_(n);Lx("moof"===(null==i?void 0:i.name));let r=this.reader.requestSlice(e,i.totalSize);r instanceof Promise&&(r=await r),Lx(r),this.traverseBox(r);const o=this.lastReadFragment;Lx(o&&o.moofOffset===e);for(const[,e]of o.trackData){const t=e.track,{fragmentPositionCache:n}=t;if(!e.startTimestampIsFinal){const i=t.fragmentLookupTable.find((e=>e.moofOffset===o.moofOffset));if(i)rT(e,i.timestamp);else{const t=Zx(n,o.moofOffset-1,(e=>e.moofOffset));if(-1!==t){const i=n[t];rT(e,i.endTimestamp)}}e.startTimestampIsFinal=!0}const i=Zx(n,e.startTimestamp,(e=>e.startTimestamp));-1!==i&&n[i].moofOffset===o.moofOffset||n.splice(i+1,0,{moofOffset:o.moofOffset,startTimestamp:e.startTimestamp,endTimestamp:e.endTimestamp})}return o}readContiguousBoxes(e){const t=e.filePos;for(;e.filePos-t<=e.length-8&&this.traverseBox(e););}*iterateContiguousBoxes(e){const t=e.filePos;for(;e.filePos-t<=e.length-8;){const t=e.filePos,n=q_(e);if(!n)break;yield{boxInfo:n,slice:e},e.filePos=t+n.totalSize}}traverseBox(e){var t,n,i,r,o,s,a,l,c,u,d,h,f,p,m,v,g,y,b,k,w,x,_,T,I,E,S,A,N,M,F,C,O,P,R,D;const L=e.filePos,B=q_(e);if(!B)return!1;const z=e.filePos,W=L+B.totalSize;switch(B.name){case"mdia":case"minf":case"dinf":case"mfra":case"edts":case"wave":this.readContiguousBoxes(e.slice(z,B.contentSize));break;case"mvhd":{const t=yT(e);e.skip(3),1===t?(e.skip(16),this.movieTimescale=xT(e),this.movieDurationInTimescale=TT(e)):(e.skip(8),this.movieTimescale=xT(e),this.movieDurationInTimescale=xT(e))}break;case"trak":{const t={id:-1,demuxer:this,inputTrack:null,disposition:{...u_},info:null,timescale:-1,durationInMovieTimescale:-1,durationInMediaTimescale:-1,rotation:0,internalCodecId:null,name:null,languageCode:"und",sampleTableByteOffset:-1,sampleTable:null,fragmentLookupTable:[],currentFragmentState:null,fragmentPositionCache:[],editListPreviousSegmentDurations:0,editListOffset:0};if(this.currentTrack=t,this.readContiguousBoxes(e.slice(z,B.contentSize)),-1!==t.id&&-1!==t.timescale&&null!==t.info)if("video"===t.info.type&&-1!==t.info.width){const e=t;t.inputTrack=new j_(this.input,new J_(e)),this.tracks.push(t)}else if("audio"===t.info.type&&-1!==t.info.numberOfChannels){const e=t;t.inputTrack=new U_(this.input,new Z_(e)),this.tracks.push(t)}this.currentTrack=null}break;case"tkhd":{const t=this.currentTrack;if(!t)break;const n=yT(e),i=!!(1&kT(e));if(t.disposition.default=i,0===n)e.skip(8),t.id=xT(e),e.skip(4),t.durationInMovieTimescale=xT(e);else{if(1!==n)throw new Error(`Incorrect track header version ${n}.`);e.skip(16),t.id=xT(e),e.skip(4),t.durationInMovieTimescale=TT(e)}e.skip(16);const r=[V_(e),V_(e),G_(e),V_(e),V_(e),G_(e),V_(e),V_(e),G_(e)],o=(e=>{const t=(e%360+360)%360;if(0===t||90===t||180===t||270===t)return t;throw new Error(`Invalid rotation ${e}.`)})((Ce=oT(r),90*Math.round(Ce/90)));Lx(0===o||90===o||180===o||270===o),t.rotation=o}break;case"elst":{const t=this.currentTrack;if(!t)break;const n=yT(e);e.skip(3);let i=!1,r=0;const o=xT(e);for(let s=0;s<o;s++){const o=1===n?TT(e):xT(e),s=1===n?IT(e):_T(e),a=V_(e);if(0!==o){if(i){console.warn("Unsupported edit list: multiple edits are not currently supported. Only using first edit.");break}if(-1!==s){if(1!==a){console.warn("Unsupported edit list entry: media rate must be 1.");break}t.editListPreviousSegmentDurations=r,t.editListOffset=s,i=!0}else r+=o}}}break;case"mdhd":{const t=this.currentTrack;if(!t)break;const n=yT(e);e.skip(3),0===n?(e.skip(8),t.timescale=xT(e),t.durationInMediaTimescale=xT(e)):1===n&&(e.skip(16),t.timescale=xT(e),t.durationInMediaTimescale=TT(e));let i=bT(e);if(i>0){t.languageCode="";for(let e=0;e<3;e++)t.languageCode=String.fromCharCode(96+(31&i))+t.languageCode,i>>=5;Fe=t.languageCode,i_.test(Fe)||(t.languageCode="und")}}break;case"hdlr":{const t=this.currentTrack;if(!t)break;e.skip(8);const n=ST(e,4);"vide"===n?t.info={type:"video",width:-1,height:-1,squarePixelWidth:-1,squarePixelHeight:-1,codec:null,codecDescription:null,colorSpace:null,avcType:null,avcCodecInfo:null,hevcCodecInfo:null,vp9CodecInfo:null,av1CodecInfo:null}:"soun"===n&&(t.info={type:"audio",numberOfChannels:-1,sampleRate:-1,codec:null,codecDescription:null,aacCodecInfo:null})}break;case"stbl":{const t=this.currentTrack;if(!t)break;t.sampleTableByteOffset=L,this.readContiguousBoxes(e.slice(z,B.contentSize))}break;case"stsd":{const t=this.currentTrack;if(!t)break;if(null===t.info||t.sampleTable)break;const n=yT(e);e.skip(3);const i=xT(e);for(let r=0;r<i;r++){const i=e.filePos,r=q_(e);if(!r)break;t.internalCodecId=r.name;const o=r.name.toLowerCase();if("video"===t.info.type)"avc1"===o||"avc3"===o?(t.info.codec="avc",t.info.avcType="avc1"===o?1:3):"hvc1"===o||"hev1"===o?t.info.codec="hevc":"vp08"===o?t.info.codec="vp8":"vp09"===o?t.info.codec="vp9":"av01"===o?t.info.codec="av1":console.warn(`Unsupported video codec (sample entry type '${r.name}').`),e.skip(24),t.info.width=bT(e),t.info.height=bT(e),t.info.squarePixelWidth=t.info.width,t.info.squarePixelHeight=t.info.height,e.skip(50),this.readContiguousBoxes(e.slice(e.filePos,i+r.totalSize-e.filePos));else{"mp4a"===o||("opus"===o?t.info.codec="opus":"flac"===o?t.info.codec="flac":"twos"===o||"sowt"===o||"raw "===o||"in24"===o||"in32"===o||"fl32"===o||"fl64"===o||"lpcm"===o||"ipcm"===o||"fpcm"===o||("ulaw"===o?t.info.codec="ulaw":"alaw"===o?t.info.codec="alaw":"ac-3"===o?t.info.codec="ac3":"ec-3"===o?t.info.codec="eac3":console.warn(`Unsupported audio codec (sample entry type '${r.name}').`))),e.skip(8);const s=bT(e);e.skip(6);let a=bT(e),l=bT(e);e.skip(4);let c=xT(e)/65536;if(0===n&&s>0)if(1===s)e.skip(4),l=8*xT(e),e.skip(8);else if(2===s){e.skip(4),c=ET(e),a=xT(e),e.skip(4),l=xT(e);const n=xT(e);if(e.skip(8),"lpcm"===o){const e=l+7>>3,i=Boolean(1&n),r=Boolean(2&n),o=4&n?-1:0;l>0&&l<=64&&(i?32===l&&(t.info.codec=r?"pcm-f32be":"pcm-f32"):o&1<<e-1?1===e?t.info.codec="pcm-s8":2===e?t.info.codec=r?"pcm-s16be":"pcm-s16":3===e?t.info.codec=r?"pcm-s24be":"pcm-s24":4===e&&(t.info.codec=r?"pcm-s32be":"pcm-s32"):1===e&&(t.info.codec="pcm-u8")),null===t.info.codec&&console.warn("Unsupported PCM format.")}}"opus"===t.info.codec&&(c=48e3),t.info.numberOfChannels=a,t.info.sampleRate=c,"twos"===o?8===l?t.info.codec="pcm-s8":16===l?t.info.codec="pcm-s16be":(console.warn(`Unsupported sample size ${l} for codec 'twos'.`),t.info.codec=null):"sowt"===o?8===l?t.info.codec="pcm-s8":16===l?t.info.codec="pcm-s16":(console.warn(`Unsupported sample size ${l} for codec 'sowt'.`),t.info.codec=null):"raw "===o?t.info.codec="pcm-u8":"in24"===o?t.info.codec="pcm-s24be":"in32"===o?t.info.codec="pcm-s32be":"fl32"===o?t.info.codec="pcm-f32be":"fl64"===o?t.info.codec="pcm-f64be":"ipcm"===o?t.info.codec="pcm-s16be":"fpcm"===o&&(t.info.codec="pcm-f32be"),this.readContiguousBoxes(e.slice(e.filePos,i+r.totalSize-e.filePos))}}}break;case"avcC":{const t=this.currentTrack;if(!t)break;Lx(t.info),t.info.codecDescription=gT(e,B.contentSize)}break;case"hvcC":{const t=this.currentTrack;if(!t)break;Lx(t.info),t.info.codecDescription=gT(e,B.contentSize)}break;case"vpcC":{var $;const t=this.currentTrack;if(!t)break;Lx("video"===(null===($=t.info)||void 0===$?void 0:$.type)),e.skip(4);const n=yT(e),i=yT(e),r=yT(e),o=r>>4,s=r>>1&7,a=1&r,l=yT(e),c=yT(e),u=yT(e);t.info.vp9CodecInfo={profile:n,level:i,bitDepth:o,chromaSubsampling:s,videoFullRangeFlag:a,colourPrimaries:l,transferCharacteristics:c,matrixCoefficients:u}}break;case"av1C":{var j;const t=this.currentTrack;if(!t)break;Lx("video"===(null===(j=t.info)||void 0===j?void 0:j.type)),e.skip(1);const n=yT(e),i=n>>5,r=31&n,o=yT(e),s=o>>7,a=o>>6&1,l=o>>4&1,c=o>>3&1,u=o>>2&1,d=3&o,h=2===i&&a?o>>5&1?12:10:a?10:8;t.info.av1CodecInfo={profile:i,level:r,tier:s,bitDepth:h,monochrome:l,chromaSubsamplingX:c,chromaSubsamplingY:u,chromaSamplePosition:d}}break;case"colr":{var U;const t=this.currentTrack;if(!t)break;if(Lx("video"===(null===(U=t.info)||void 0===U?void 0:U.type)),"nclx"!==ST(e,4))break;const n=bT(e),i=bT(e),r=bT(e),o=Boolean(128&yT(e));t.info.colorSpace={primaries:Vx[n],transfer:Hx[i],matrix:Xx[r],fullRange:o}}break;case"pasp":{var q;const t=this.currentTrack;if(!t)break;Lx("video"===(null===(q=t.info)||void 0===q?void 0:q.type));const n=xT(e),i=xT(e);n>i?t.info.squarePixelWidth=Math.round(t.info.width*n/i):t.info.squarePixelHeight=Math.round(t.info.height*i/n)}break;case"esds":{var V;const t=this.currentTrack;if(!t)break;Lx("audio"===(null===(V=t.info)||void 0===V?void 0:V.type)),e.skip(4),Lx(3===yT(e)),H_(e),e.skip(2);const n=yT(e),i=!!(64&n),r=!!(32&n);if(!!(128&n)&&e.skip(2),i){const t=yT(e);e.skip(t)}r&&e.skip(2),Lx(4===yT(e));const o=H_(e),s=e.filePos,a=yT(e);if(64===a||103===a?(t.info.codec="aac",t.info.aacCodecInfo={isMpeg2:103===a,objectType:null}):105===a||107===a?t.info.codec="mp3":221===a?t.info.codec="vorbis":console.warn(`Unsupported audio codec (objectTypeIndication ${a}) - discarding track.`),e.skip(12),o>e.filePos-s){Lx(5===yT(e));const n=H_(e);if(t.info.codecDescription=gT(e,n),"aac"===t.info.codec){const e=p_(t.info.codecDescription);null!==e.numberOfChannels&&(t.info.numberOfChannels=e.numberOfChannels),null!==e.sampleRate&&(t.info.sampleRate=e.sampleRate)}}}break;case"enda":{var G;const t=this.currentTrack;if(!t)break;Lx("audio"===(null===(G=t.info)||void 0===G?void 0:G.type)),255&bT(e)&&("pcm-s16be"===t.info.codec?t.info.codec="pcm-s16":"pcm-s24be"===t.info.codec?t.info.codec="pcm-s24":"pcm-s32be"===t.info.codec?t.info.codec="pcm-s32":"pcm-f32be"===t.info.codec?t.info.codec="pcm-f32":"pcm-f64be"===t.info.codec&&(t.info.codec="pcm-f64"))}break;case"pcmC":{var H;const t=this.currentTrack;if(!t)break;Lx("audio"===(null===(H=t.info)||void 0===H?void 0:H.type)),e.skip(4);const n=yT(e),i=Boolean(1&n),r=yT(e);"pcm-s16be"===t.info.codec?i?16===r?t.info.codec="pcm-s16":24===r?t.info.codec="pcm-s24":32===r?t.info.codec="pcm-s32":(console.warn(`Invalid ipcm sample size ${r}.`),t.info.codec=null):16===r?t.info.codec="pcm-s16be":24===r?t.info.codec="pcm-s24be":32===r?t.info.codec="pcm-s32be":(console.warn(`Invalid ipcm sample size ${r}.`),t.info.codec=null):"pcm-f32be"===t.info.codec&&(i?32===r?t.info.codec="pcm-f32":64===r?t.info.codec="pcm-f64":(console.warn(`Invalid fpcm sample size ${r}.`),t.info.codec=null):32===r?t.info.codec="pcm-f32be":64===r?t.info.codec="pcm-f64be":(console.warn(`Invalid fpcm sample size ${r}.`),t.info.codec=null));break}case"dOps":{var K;const t=this.currentTrack;if(!t)break;Lx("audio"===(null===(K=t.info)||void 0===K?void 0:K.type)),e.skip(1);const n=yT(e),i=bT(e),r=xT(e),o=wT(e),s=yT(e);let a;a=0!==s?gT(e,2+n):new Uint8Array(0);const l=new Uint8Array(19+a.byteLength),c=new DataView(l.buffer);c.setUint32(0,1332770163,!1),c.setUint32(4,1214603620,!1),c.setUint8(8,1),c.setUint8(9,n),c.setUint16(10,i,!0),c.setUint32(12,r,!0),c.setInt16(16,o,!0),c.setUint8(18,s),l.set(a,19),t.info.codecDescription=l,t.info.numberOfChannels=n}break;case"dfLa":{var X;const t=this.currentTrack;if(!t)break;Lx("audio"===(null===(X=t.info)||void 0===X?void 0:X.type)),e.skip(4);const n=127,i=128,r=e.filePos;for(;e.filePos<W;){const r=yT(e),o=kT(e);if((r&n)===M_.STREAMINFO){e.skip(10);const n=xT(e),i=n>>>12,r=1+(n>>9&7);t.info.sampleRate=i,t.info.numberOfChannels=r,e.skip(20)}else e.skip(o);if(r&i)break}const o=e.filePos;e.filePos=r;const s=gT(e,o-r),a=new Uint8Array(4+s.byteLength);new DataView(a.buffer).setUint32(0,1716281667,!1),a.set(s,4),t.info.codecDescription=a}break;case"dac3":{var Y;const t=this.currentTrack;if(!t)break;Lx("audio"===(null===(Y=t.info)||void 0===Y?void 0:Y.type));const n=gT(e,3),i=new d_(n),r=i.readBits(2);i.skipBits(8);const o=i.readBits(3),s=i.readBits(1);r<3&&(t.info.sampleRate=k_[r]),t.info.numberOfChannels=F_[o]+s}break;case"dec3":{var Q;const t=this.currentTrack;if(!t)break;Lx("audio"===(null===(Q=t.info)||void 0===Q?void 0:Q.type));const n=(e=>{if(e.length<2)return null;const t=new d_(e),n=t.readBits(13),i=t.readBits(3),r=[];for(let n=0;n<=i&&!(Math.ceil(t.pos/8)+3>e.length);n++){const e=t.readBits(2),n=t.readBits(5);t.skipBits(1),t.skipBits(1);const i=t.readBits(3),o=t.readBits(3),s=t.readBits(1);t.skipBits(3);const a=t.readBits(4);let l=0;a>0?l=t.readBits(9):t.skipBits(1),r.push({fscod:e,fscod2:null,bsid:n,bsmod:i,acmod:o,lfeon:s,numDepSub:a,chanLoc:l})}return 0===r.length?null:{dataRate:n,substreams:r}})(gT(e,B.contentSize));if(!n){console.warn("Invalid dec3 box contents, ignoring.");break}const i=(e=>{const t=e.substreams[0];return Lx(t),t.fscod<3?k_[t.fscod]:null!==t.fscod2&&t.fscod2<3?w_[t.fscod2]:null})(n);null!==i&&(t.info.sampleRate=i),t.info.numberOfChannels=(e=>{const t=e.substreams[0];Lx(t);let n=F_[t.acmod]+t.lfeon;if(t.numDepSub>0){const e=[2,2,1,1,2,2,2,1,1];for(let i=0;i<9;i++)t.chanLoc&1<<8-i&&(n+=e[i])}return n})(n)}break;case"stts":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4);const n=xT(e);let i=0,r=0;for(let o=0;o<n;o++){const n=xT(e),o=xT(e);t.sampleTable.sampleTimingEntries.push({startIndex:i,startDecodeTimestamp:r,count:n,delta:o}),i+=n,r+=n*o}}break;case"ctts":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4);const n=xT(e);let i=0;for(let r=0;r<n;r++){const n=xT(e),r=_T(e);t.sampleTable.sampleCompositionTimeOffsets.push({startIndex:i,count:n,offset:r}),i+=n}}break;case"stsz":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4);const n=xT(e),i=xT(e);if(0===n)for(let n=0;n<i;n++){const n=xT(e);t.sampleTable.sampleSizes.push(n)}else t.sampleTable.sampleSizes.push(n)}break;case"stz2":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4),e.skip(3);const n=yT(e),i=xT(e),r=gT(e,Math.ceil(i*n/8)),o=new d_(r);for(let e=0;e<i;e++){const e=o.readBits(n);t.sampleTable.sampleSizes.push(e)}}break;case"stss":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4),t.sampleTable.keySampleIndices=[];const n=xT(e);for(let i=0;i<n;i++){const n=xT(e)-1;t.sampleTable.keySampleIndices.push(n)}0!==t.sampleTable.keySampleIndices[0]&&t.sampleTable.keySampleIndices.unshift(0)}break;case"stsc":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4);const n=xT(e);for(let i=0;i<n;i++){const n=xT(e)-1,i=xT(e),r=xT(e);t.sampleTable.sampleToChunk.push({startSampleIndex:-1,startChunkIndex:n,samplesPerChunk:i,sampleDescriptionIndex:r})}let i=0;for(let e=0;e<t.sampleTable.sampleToChunk.length;e++)t.sampleTable.sampleToChunk[e].startSampleIndex=i,e<t.sampleTable.sampleToChunk.length-1&&(i+=(t.sampleTable.sampleToChunk[e+1].startChunkIndex-t.sampleTable.sampleToChunk[e].startChunkIndex)*t.sampleTable.sampleToChunk[e].samplesPerChunk)}break;case"stco":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4);const n=xT(e);for(let i=0;i<n;i++){const n=xT(e);t.sampleTable.chunkOffsets.push(n)}}break;case"co64":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4);const n=xT(e);for(let i=0;i<n;i++){const n=TT(e);t.sampleTable.chunkOffsets.push(n)}}break;case"mvex":this.isFragmented=!0,this.readContiguousBoxes(e.slice(z,B.contentSize));break;case"mehd":{const t=yT(e);e.skip(3);const n=1===t?TT(e):xT(e);this.movieDurationInTimescale=n}break;case"trex":{e.skip(4);const t=xT(e),n=xT(e),i=xT(e),r=xT(e),o=xT(e);this.fragmentTrackDefaults.push({trackId:t,defaultSampleDescriptionIndex:n,defaultSampleDuration:i,defaultSampleSize:r,defaultSampleFlags:o})}break;case"tfra":{const t=yT(e);e.skip(3);const n=xT(e),i=this.tracks.find((e=>e.id===n));if(!i)break;const r=xT(e),o=(12&r)>>2,s=3&r,a=[yT,bT,kT,xT],l=a[(48&r)>>4],c=a[o],u=a[s],d=xT(e);for(let n=0;n<d;n++){const n=1===t?TT(e):xT(e),r=1===t?TT(e):xT(e);l(e),c(e),u(e),i.fragmentLookupTable.push({timestamp:n,moofOffset:r})}i.fragmentLookupTable.sort(((e,t)=>e.timestamp-t.timestamp));for(let e=0;e<i.fragmentLookupTable.length-1;e++){const t=i.fragmentLookupTable[e],n=i.fragmentLookupTable[e+1];t.timestamp===n.timestamp&&(i.fragmentLookupTable.splice(e+1,1),e--)}}break;case"moof":this.currentFragment={moofOffset:L,moofSize:B.totalSize,implicitBaseDataOffset:L,trackData:new Map},this.readContiguousBoxes(e.slice(z,B.contentSize)),this.lastReadFragment=this.currentFragment,this.currentFragment=null;break;case"traf":if(Lx(this.currentFragment),this.readContiguousBoxes(e.slice(z,B.contentSize)),this.currentTrack){const e=this.currentFragment.trackData.get(this.currentTrack.id);if(e){const{currentFragmentState:t}=this.currentTrack;Lx(t),null!==t.startTimestamp&&(rT(e,t.startTimestamp),e.startTimestampIsFinal=!0)}this.currentTrack.currentFragmentState=null,this.currentTrack=null}break;case"tfhd":{var J,Z,ee,te;Lx(this.currentFragment),e.skip(1);const t=kT(e),n=Boolean(1&t),i=Boolean(2&t),r=Boolean(8&t),o=Boolean(16&t),s=Boolean(32&t),a=Boolean(65536&t),l=Boolean(131072&t),c=xT(e),u=this.tracks.find((e=>e.id===c));if(!u)break;const d=this.fragmentTrackDefaults.find((e=>e.trackId===c));this.currentTrack=u,u.currentFragmentState={baseDataOffset:this.currentFragment.implicitBaseDataOffset,sampleDescriptionIndex:null!==(J=null==d?void 0:d.defaultSampleDescriptionIndex)&&void 0!==J?J:null,defaultSampleDuration:null!==(Z=null==d?void 0:d.defaultSampleDuration)&&void 0!==Z?Z:null,defaultSampleSize:null!==(ee=null==d?void 0:d.defaultSampleSize)&&void 0!==ee?ee:null,defaultSampleFlags:null!==(te=null==d?void 0:d.defaultSampleFlags)&&void 0!==te?te:null,startTimestamp:null},n?u.currentFragmentState.baseDataOffset=TT(e):l&&(u.currentFragmentState.baseDataOffset=this.currentFragment.moofOffset),i&&(u.currentFragmentState.sampleDescriptionIndex=xT(e)),r&&(u.currentFragmentState.defaultSampleDuration=xT(e)),o&&(u.currentFragmentState.defaultSampleSize=xT(e)),s&&(u.currentFragmentState.defaultSampleFlags=xT(e)),a&&(u.currentFragmentState.defaultSampleDuration=0)}break;case"tfdt":{const t=this.currentTrack;if(!t)break;Lx(t.currentFragmentState);const n=yT(e);e.skip(3);const i=0===n?xT(e):TT(e);t.currentFragmentState.startTimestamp=i}break;case"trun":{const t=this.currentTrack;if(!t)break;if(Lx(this.currentFragment),Lx(t.currentFragmentState),this.currentFragment.trackData.has(t.id)){console.warn("Can't have two trun boxes for the same track in one fragment. Ignoring...");break}const n=yT(e),i=kT(e),r=Boolean(1&i),o=Boolean(4&i),s=Boolean(256&i),a=Boolean(512&i),l=Boolean(1024&i),c=Boolean(2048&i),u=xT(e);let d=t.currentFragmentState.baseDataOffset;r&&(d+=_T(e));let h=null;o&&(h=xT(e));let f=d;if(0===u){this.currentFragment.implicitBaseDataOffset=f;break}let p=0;const m={track:t,startTimestamp:0,endTimestamp:0,firstKeyFrameTimestamp:null,samples:[],presentationTimestamps:[],startTimestampIsFinal:!1};this.currentFragment.trackData.set(t.id,m);for(let i=0;i<u;i++){let r,o,u;s?r=xT(e):(Lx(null!==t.currentFragmentState.defaultSampleDuration),r=t.currentFragmentState.defaultSampleDuration),a?o=xT(e):(Lx(null!==t.currentFragmentState.defaultSampleSize),o=t.currentFragmentState.defaultSampleSize),l?u=xT(e):(Lx(null!==t.currentFragmentState.defaultSampleFlags),u=t.currentFragmentState.defaultSampleFlags),0===i&&null!==h&&(u=h);let d=0;c&&(d=0===n?xT(e):_T(e));const v=!(65536&u);m.samples.push({presentationTimestamp:p+d,duration:r,byteOffset:f,byteSize:o,isKeyFrame:v}),f+=o,p+=r}m.presentationTimestamps=m.samples.map(((e,t)=>({presentationTimestamp:e.presentationTimestamp,sampleIndex:t}))).sort(((e,t)=>e.presentationTimestamp-t.presentationTimestamp));for(let e=0;e<m.presentationTimestamps.length;e++){const t=m.presentationTimestamps[e],n=m.samples[t.sampleIndex];if(null===m.firstKeyFrameTimestamp&&n.isKeyFrame&&(m.firstKeyFrameTimestamp=n.presentationTimestamp),e<m.presentationTimestamps.length-1){const i=m.presentationTimestamps[e+1];n.duration=i.presentationTimestamp-t.presentationTimestamp}}const v=m.samples[m.presentationTimestamps[0].sampleIndex],g=m.samples[Bx(m.presentationTimestamps).sampleIndex];m.startTimestamp=v.presentationTimestamp,m.endTimestamp=g.presentationTimestamp+g.duration,this.currentFragment.implicitBaseDataOffset=f}break;case"udta":{const g=this.iterateContiguousBoxes(e.slice(z,B.contentSize));for(const{boxInfo:e,slice:y}of g){if("meta"!==e.name&&!this.currentTrack){var ne,ie,re,oe,se,ae,le,ce;const t=y.filePos;null!==(ie=(ne=this.metadataTags).raw)&&void 0!==ie||(ne.raw={}),"©"===e.name[0]?null!==(se=(re=this.metadataTags.raw)[oe=e.name])&&void 0!==se||(re[oe]=K_(y)):null!==(ce=(ae=this.metadataTags.raw)[le=e.name])&&void 0!==ce||(ae[le]=gT(y,e.contentSize)),y.filePos=t}switch(e.name){case"meta":y.skip(-e.headerSize),this.traverseBox(y);break;case"©nam":case"name":this.currentTrack?this.currentTrack.name=jx.decode(gT(y,e.contentSize)):null!==(n=(t=this.metadataTags).title)&&void 0!==n||(t.title=K_(y));break;case"©des":this.currentTrack||null!==(r=(i=this.metadataTags).description)&&void 0!==r||(i.description=K_(y));break;case"©ART":this.currentTrack||null!==(s=(o=this.metadataTags).artist)&&void 0!==s||(o.artist=K_(y));break;case"©alb":this.currentTrack||null!==(l=(a=this.metadataTags).album)&&void 0!==l||(a.album=K_(y));break;case"albr":this.currentTrack||null!==(u=(c=this.metadataTags).albumArtist)&&void 0!==u||(c.albumArtist=K_(y));break;case"©gen":this.currentTrack||null!==(h=(d=this.metadataTags).genre)&&void 0!==h||(d.genre=K_(y));break;case"©day":if(!this.currentTrack){var ue,de;const e=new Date(K_(y));Number.isNaN(e.getTime())||null!==(de=(ue=this.metadataTags).date)&&void 0!==de||(ue.date=e)}break;case"©cmt":this.currentTrack||null!==(p=(f=this.metadataTags).comment)&&void 0!==p||(f.comment=K_(y));break;case"©lyr":this.currentTrack||null!==(v=(m=this.metadataTags).lyrics)&&void 0!==v||(m.lyrics=K_(y))}}}break;case"meta":{if(this.currentTrack)break;const t=0!==xT(e);this.currentMetadataKeys=new Map,t?this.readContiguousBoxes(e.slice(z,B.contentSize)):this.readContiguousBoxes(e.slice(z+4,B.contentSize-4)),this.currentMetadataKeys=null}break;case"keys":{if(!this.currentMetadataKeys)break;e.skip(4);const t=xT(e);for(let n=0;n<t;n++){const t=xT(e);e.skip(4);const i=jx.decode(gT(e,t-8));this.currentMetadataKeys.set(n+1,i)}}break;case"ilst":{if(!this.currentMetadataKeys)break;const t=this.iterateContiguousBoxes(e.slice(z,B.contentSize));for(const{boxInfo:e,slice:n}of t){var he,fe,pe,me,ve;let t=e.name;const i=(t.charCodeAt(0)<<24)+(t.charCodeAt(1)<<16)+(t.charCodeAt(2)<<8)+t.charCodeAt(3);this.currentMetadataKeys.has(i)&&(t=this.currentMetadataKeys.get(i));const r=X_(n);switch(null!==(fe=(he=this.metadataTags).raw)&&void 0!==fe||(he.raw={}),null!==(ve=(pe=this.metadataTags.raw)[me=t])&&void 0!==ve||(pe[me]=r),t){case"©nam":case"titl":case"com.apple.quicktime.title":case"title":"string"==typeof r&&(null!==(y=(g=this.metadataTags).title)&&void 0!==y||(g.title=r));break;case"©des":case"desc":case"dscp":case"com.apple.quicktime.description":case"description":"string"==typeof r&&(null!==(k=(b=this.metadataTags).description)&&void 0!==k||(b.description=r));break;case"©ART":case"com.apple.quicktime.artist":case"artist":"string"==typeof r&&(null!==(x=(w=this.metadataTags).artist)&&void 0!==x||(w.artist=r));break;case"©alb":case"albm":case"com.apple.quicktime.album":case"album":"string"==typeof r&&(null!==(T=(_=this.metadataTags).album)&&void 0!==T||(_.album=r));break;case"aART":case"album_artist":"string"==typeof r&&(null!==(E=(I=this.metadataTags).albumArtist)&&void 0!==E||(I.albumArtist=r));break;case"©cmt":case"com.apple.quicktime.comment":case"comment":"string"==typeof r&&(null!==(A=(S=this.metadataTags).comment)&&void 0!==A||(S.comment=r));break;case"©gen":case"gnre":case"com.apple.quicktime.genre":case"genre":"string"==typeof r&&(null!==(M=(N=this.metadataTags).genre)&&void 0!==M||(N.genre=r));break;case"©lyr":case"lyrics":"string"==typeof r&&(null!==(C=(F=this.metadataTags).lyrics)&&void 0!==C||(F.lyrics=r));break;case"©day":case"rldt":case"com.apple.quicktime.creationdate":case"date":if("string"==typeof r){var ge,ye;const e=new Date(r);Number.isNaN(e.getTime())||null!==(ye=(ge=this.metadataTags).date)&&void 0!==ye||(ge.date=e)}break;case"covr":case"com.apple.quicktime.artwork":r instanceof c_?(null!==(P=(O=this.metadataTags).images)&&void 0!==P||(O.images=[]),this.metadataTags.images.push({data:r.data,kind:"coverFront",mimeType:r.mimeType})):r instanceof Uint8Array&&(null!==(D=(R=this.metadataTags).images)&&void 0!==D||(R.images=[]),this.metadataTags.images.push({data:r,kind:"coverFront",mimeType:"image/*"}));break;case"track":if("string"==typeof r){var be,ke,we,xe;const e=r.split("/"),t=Number.parseInt(e[0],10),n=e[1]&&Number.parseInt(e[1],10);Number.isInteger(t)&&t>0&&(null!==(ke=(be=this.metadataTags).trackNumber)&&void 0!==ke||(be.trackNumber=t)),n&&Number.isInteger(n)&&n>0&&(null!==(xe=(we=this.metadataTags).tracksTotal)&&void 0!==xe||(we.tracksTotal=n))}break;case"trkn":if(r instanceof Uint8Array&&r.length>=6){var _e,Te,Ie,Ee;const e=$x(r),t=e.getUint16(2,!1),n=e.getUint16(4,!1);t>0&&(null!==(Te=(_e=this.metadataTags).trackNumber)&&void 0!==Te||(_e.trackNumber=t)),n>0&&(null!==(Ee=(Ie=this.metadataTags).tracksTotal)&&void 0!==Ee||(Ie.tracksTotal=n))}break;case"disc":case"disk":if(r instanceof Uint8Array&&r.length>=6){var Se,Ae,Ne,Me;const e=$x(r),t=e.getUint16(2,!1),n=e.getUint16(4,!1);t>0&&(null!==(Ae=(Se=this.metadataTags).discNumber)&&void 0!==Ae||(Se.discNumber=t)),n>0&&(null!==(Me=(Ne=this.metadataTags).discsTotal)&&void 0!==Me||(Ne.discsTotal=n))}}}}}var Fe,Ce;return e.filePos=W,!0}}class Q_{constructor(e){this.internalTrack=e,this.packetToSampleIndex=new WeakMap,this.packetToFragmentLocation=new WeakMap}getId(){return this.internalTrack.id}getNumber(){const e=this.internalTrack.demuxer,t=this.internalTrack.inputTrack.type;let n=0;for(const i of e.tracks)if(i.inputTrack.type===t&&n++,i===this.internalTrack)break;return n}getCodec(){throw new Error("Not implemented on base class.")}getInternalCodecId(){return this.internalTrack.internalCodecId}getName(){return this.internalTrack.name}getLanguageCode(){return this.internalTrack.languageCode}getTimeResolution(){return this.internalTrack.timescale}getDisposition(){return this.internalTrack.disposition}async computeDuration(){var e,t;const n=await this.getPacket(1/0,{metadataOnly:!0});return(null!==(e=null==n?void 0:n.timestamp)&&void 0!==e?e:0)+(null!==(t=null==n?void 0:n.duration)&&void 0!==t?t:0)}async getFirstTimestamp(){var e;const t=await this.getFirstPacket({metadataOnly:!0});return null!==(e=null==t?void 0:t.timestamp)&&void 0!==e?e:0}async getFirstPacket(e){const t=await this.fetchPacketForSampleIndex(0,e);return t||!this.internalTrack.demuxer.isFragmented?t:this.performFragmentedLookup(null,(e=>e.trackData.get(this.internalTrack.id)?{sampleIndex:0,correctSampleFound:!0}:{sampleIndex:-1,correctSampleFound:!1}),-1/0,1/0,e)}mapTimestampIntoTimescale(e){return(e=>{const t=Math.round(e);return Math.abs(e/t-1)<10*Number.EPSILON?t:e})(e*this.internalTrack.timescale)+this.internalTrack.editListOffset}async getPacket(e,t){const n=this.mapTimestampIntoTimescale(e),i=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),r=eT(i,n),o=await this.fetchPacketForSampleIndex(r,t);return sT(i)&&this.internalTrack.demuxer.isFragmented?this.performFragmentedLookup(null,(e=>{const t=e.trackData.get(this.internalTrack.id);if(!t)return{sampleIndex:-1,correctSampleFound:!1};const i=Zx(t.presentationTimestamps,n,(e=>e.presentationTimestamp));return{sampleIndex:-1!==i?t.presentationTimestamps[i].sampleIndex:-1,correctSampleFound:-1!==i&&n<t.endTimestamp}}),n,n,t):o}async getNextPacket(e,t){const n=this.packetToSampleIndex.get(e);if(void 0!==n)return this.fetchPacketForSampleIndex(n+1,t);const i=this.packetToFragmentLocation.get(e);if(void 0===i)throw new Error("Packet was not created from this track.");return this.performFragmentedLookup(i.fragment,(e=>{if(e===i.fragment){const t=e.trackData.get(this.internalTrack.id);if(i.sampleIndex+1<t.samples.length)return{sampleIndex:i.sampleIndex+1,correctSampleFound:!0}}else if(e.trackData.get(this.internalTrack.id))return{sampleIndex:0,correctSampleFound:!0};return{sampleIndex:-1,correctSampleFound:!1}}),-1/0,1/0,t)}async getKeyPacket(e,t){const n=this.mapTimestampIntoTimescale(e),i=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),r=tT(i,n),o=await this.fetchPacketForSampleIndex(r,t);return sT(i)&&this.internalTrack.demuxer.isFragmented?this.performFragmentedLookup(null,(e=>{const t=e.trackData.get(this.internalTrack.id);if(!t)return{sampleIndex:-1,correctSampleFound:!1};const i=((e,t)=>{for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1})(t.presentationTimestamps,(e=>t.samples[e.sampleIndex].isKeyFrame&&e.presentationTimestamp<=n));return{sampleIndex:-1!==i?t.presentationTimestamps[i].sampleIndex:-1,correctSampleFound:-1!==i&&n<t.endTimestamp}}),n,n,t):o}async getNextKeyPacket(e,t){const n=this.packetToSampleIndex.get(e);if(void 0!==n){const e=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),i=iT(e,n);return this.fetchPacketForSampleIndex(i,t)}const i=this.packetToFragmentLocation.get(e);if(void 0===i)throw new Error("Packet was not created from this track.");return this.performFragmentedLookup(i.fragment,(e=>{if(e===i.fragment){const t=e.trackData.get(this.internalTrack.id).samples.findIndex(((e,t)=>e.isKeyFrame&&t>i.sampleIndex));if(-1!==t)return{sampleIndex:t,correctSampleFound:!0}}else{const t=e.trackData.get(this.internalTrack.id);if(t&&null!==t.firstKeyFrameTimestamp){const e=t.samples.findIndex((e=>e.isKeyFrame));return Lx(-1!==e),{sampleIndex:e,correctSampleFound:!0}}}return{sampleIndex:-1,correctSampleFound:!1}}),-1/0,1/0,t)}async fetchPacketForSampleIndex(e,t){if(-1===e)return null;const n=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),i=nT(n,e);if(!i)return null;let r;if(t.metadataOnly)r=R_;else{let e=this.internalTrack.demuxer.reader.requestSlice(i.sampleOffset,i.sampleSize);e instanceof Promise&&(e=await e),Lx(e),r=gT(e,i.sampleSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new D_(r,i.isKeyFrame?"key":"delta",o,s,e,i.sampleSize);return this.packetToSampleIndex.set(a,e),a}async fetchPacketInFragment(e,t,n){if(-1===t)return null;const i=e.trackData.get(this.internalTrack.id).samples[t];let r;if(Lx(i),n.metadataOnly)r=R_;else{let e=this.internalTrack.demuxer.reader.requestSlice(i.byteOffset,i.byteSize);e instanceof Promise&&(e=await e),Lx(e),r=gT(e,i.byteSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new D_(r,i.isKeyFrame?"key":"delta",o,s,e.moofOffset+t,i.byteSize);return this.packetToFragmentLocation.set(a,{fragment:e,sampleIndex:t}),a}async performFragmentedLookup(e,t,n,i,r){var o,s;const a=this.internalTrack.demuxer;let l=null,c=null,u=-1;if(e){const{sampleIndex:n,correctSampleFound:i}=t(e);if(i)return this.fetchPacketInFragment(e,n,r);-1!==n&&(c=e,u=n)}const d=Zx(this.internalTrack.fragmentLookupTable,n,(e=>e.timestamp)),h=-1!==d?this.internalTrack.fragmentLookupTable[d]:null,f=Zx(this.internalTrack.fragmentPositionCache,n,(e=>e.startTimestamp)),p=-1!==f?this.internalTrack.fragmentPositionCache[f]:null,m=Math.max(null!==(o=null==h?void 0:h.moofOffset)&&void 0!==o?o:0,null!==(s=null==p?void 0:p.moofOffset)&&void 0!==s?s:0)||null;let v;for(e?null===m||e.moofOffset>=m?(v=e.moofOffset+e.moofSize,l=e):v=m:v=null!=m?m:0;;){if(l){const e=l.trackData.get(this.internalTrack.id);if(e&&e.startTimestamp>i)break}let e=a.reader.requestSliceRange(v,8,16);if(e instanceof Promise&&(e=await e),!e)break;const n=v,o=q_(e);if(!o)break;if("moof"===o.name){l=await a.readFragment(n);const{sampleIndex:e,correctSampleFound:i}=t(l);if(i)return this.fetchPacketInFragment(l,e,r);-1!==e&&(c=l,u=e)}v=n+o.totalSize}if(h&&(!c||c.moofOffset<h.moofOffset)){var g;const e=this.internalTrack.fragmentLookupTable[d-1];Lx(!e||e.timestamp<h.timestamp);const n=null!==(g=null==e?void 0:e.timestamp)&&void 0!==g?g:-1/0;return this.performFragmentedLookup(null,t,n,i,r)}return c?this.fetchPacketInFragment(c,u,r):null}}class J_ extends Q_{constructor(e){super(e),this.decoderConfigPromise=null,this.internalTrack=e}getCodec(){return this.internalTrack.info.codec}getCodedWidth(){return this.internalTrack.info.width}getCodedHeight(){return this.internalTrack.info.height}getSquarePixelWidth(){return this.internalTrack.info.squarePixelWidth}getSquarePixelHeight(){return this.internalTrack.info.squarePixelHeight}getRotation(){return this.internalTrack.rotation}async getColorSpace(){var e,t,n,i;return{primaries:null===(e=this.internalTrack.info.colorSpace)||void 0===e?void 0:e.primaries,transfer:null===(t=this.internalTrack.info.colorSpace)||void 0===t?void 0:t.transfer,matrix:null===(n=this.internalTrack.info.colorSpace)||void 0===n?void 0:n.matrix,fullRange:null===(i=this.internalTrack.info.colorSpace)||void 0===i?void 0:i.fullRange}}async canBeTransparent(){return!1}async getDecoderConfig(){var e;return this.internalTrack.info.codec?null!==(e=this.decoderConfigPromise)&&void 0!==e?e:this.decoderConfigPromise=(async(e,t)=>{if("vp9"!==this.internalTrack.info.codec||this.internalTrack.info.vp9CodecInfo){if("av1"===this.internalTrack.info.codec&&!this.internalTrack.info.av1CodecInfo){const e=await this.getFirstPacket({});this.internalTrack.info.av1CodecInfo=e&&(e=>{for(const{type:t,data:n}of N_(e)){if(1!==t)continue;const e=new d_(n),i=e.readBits(3);e.readBits(1);const r=e.readBits(1);let o=0,s=0,a=0;if(r)o=e.readBits(5);else{if(e.readBits(1)&&(e.skipBits(32),e.skipBits(32),e.readBits(1)))return null;const t=e.readBits(1);t&&(a=e.readBits(5),e.skipBits(32),e.skipBits(5),e.skipBits(5));const n=e.readBits(5);for(let i=0;i<=n;i++){e.skipBits(12);const n=e.readBits(5);if(0===i&&(o=n),n>7){const t=e.readBits(1);0===i&&(s=t)}if(t&&e.readBits(1)){const t=a+1;e.skipBits(t),e.skipBits(t),e.skipBits(1)}e.readBits(1)&&e.skipBits(4)}}const l=e.readBits(4),c=e.readBits(4),u=l+1;e.skipBits(u);const d=c+1;e.skipBits(d);let h=0;if(h=r?0:e.readBits(1),h&&(e.skipBits(4),e.skipBits(3)),e.skipBits(1),e.skipBits(1),e.skipBits(1),!r){e.skipBits(1),e.skipBits(1),e.skipBits(1),e.skipBits(1);const t=e.readBits(1);t&&(e.skipBits(1),e.skipBits(1));let n=0;n=e.readBits(1)?2:e.readBits(1),n>0&&(e.readBits(1)||e.skipBits(1)),t&&e.skipBits(3)}e.skipBits(1),e.skipBits(1),e.skipBits(1);const f=e.readBits(1);let p=8;2===i&&f?p=e.readBits(1)?12:10:i<=2&&(p=f?10:8);let m=0;1!==i&&(m=e.readBits(1));let v=1,g=1,y=0;return m||(0===i?(v=1,g=1):1===i?(v=0,g=0):12===p&&(v=e.readBits(1),v&&(g=e.readBits(1))),v&&g&&(y=e.readBits(2))),{profile:i,level:o,tier:s,bitDepth:p,monochrome:m,chromaSubsamplingX:v,chromaSubsamplingY:g,chromaSamplePosition:y}}return null})(e.data)}}else{const e=await this.getFirstPacket({});this.internalTrack.info.vp9CodecInfo=e&&(e=>{const t=new d_(e);if(2!==t.readBits(2))return null;const n=t.readBits(1),i=(t.readBits(1)<<1)+n;if(3===i&&t.skipBits(1),1===t.readBits(1))return null;if(0!==t.readBits(1))return null;if(t.skipBits(2),4817730!==t.readBits(24))return null;let r=8;i>=2&&(r=t.readBits(1)?12:10);const o=t.readBits(3);let s=0,a=0;if(7!==o)if(a=t.readBits(1),1===i||3===i){const e=t.readBits(1),n=t.readBits(1);s=e||n?e&&!n?2:1:3,t.skipBits(1)}else s=1;else s=3,a=1;const l=(t.readBits(16)+1)*(t.readBits(16)+1);let c=Bx(v_).level;for(const e of v_)if(l<=e.maxPictureSize){c=e.level;break}return{profile:i,level:c,bitDepth:r,chromaSubsampling:s,videoFullRangeFlag:a,colourPrimaries:2===o?1:1===o?6:2,transferCharacteristics:2===o?1:1===o?6:2,matrixCoefficients:7===o?0:2===o?1:1===o?6:2}})(e.data)}return{codec:g_(this.internalTrack.info),codedWidth:this.internalTrack.info.width,codedHeight:this.internalTrack.info.height,displayAspectWidth:this.internalTrack.info.squarePixelWidth,displayAspectHeight:this.internalTrack.info.squarePixelHeight,description:null!==(e=this.internalTrack.info.codecDescription)&&void 0!==e?e:void 0,colorSpace:null!==(t=this.internalTrack.info.colorSpace)&&void 0!==t?t:void 0}})():null}}class Z_ extends Q_{constructor(e){super(e),this.decoderConfig=null,this.internalTrack=e}getCodec(){return this.internalTrack.info.codec}getNumberOfChannels(){return this.internalTrack.info.numberOfChannels}getSampleRate(){return this.internalTrack.info.sampleRate}async getDecoderConfig(){var e,t;return this.internalTrack.info.codec?null!==(e=this.decoderConfig)&&void 0!==e?e:this.decoderConfig={codec:y_(this.internalTrack.info),numberOfChannels:this.internalTrack.info.numberOfChannels,sampleRate:this.internalTrack.info.sampleRate,description:null!==(t=this.internalTrack.info.codecDescription)&&void 0!==t?t:void 0}:null}}const eT=(e,t)=>{if(e.presentationTimestamps){const n=Zx(e.presentationTimestamps,t,(e=>e.presentationTimestamp));return-1===n?-1:e.presentationTimestamps[n].sampleIndex}{const n=Zx(e.sampleTimingEntries,t,(e=>e.startDecodeTimestamp));if(-1===n)return-1;const i=e.sampleTimingEntries[n];return i.startIndex+Math.min(Math.floor((t-i.startDecodeTimestamp)/i.delta),i.count-1)}},tT=(e,t)=>{if(!e.keySampleIndices)return eT(e,t);if(e.presentationTimestamps){const n=Zx(e.presentationTimestamps,t,(e=>e.presentationTimestamp));if(-1===n)return-1;for(let t=n;t>=0;t--){const n=e.presentationTimestamps[t].sampleIndex;if(-1!==Jx(e.keySampleIndices,n,(e=>e)))return n}return-1}{var n;const i=eT(e,t),r=Zx(e.keySampleIndices,i,(e=>e));return null!==(n=e.keySampleIndices[r])&&void 0!==n?n:-1}},nT=(e,t)=>{const n=Zx(e.sampleTimingEntries,t,(e=>e.startIndex)),i=e.sampleTimingEntries[n];if(!i||i.startIndex+i.count<=t)return null;let r=i.startDecodeTimestamp+(t-i.startIndex)*i.delta;const o=Zx(e.sampleCompositionTimeOffsets,t,(e=>e.startIndex)),s=e.sampleCompositionTimeOffsets[o];s&&t-s.startIndex<s.count&&(r+=s.offset);const a=e.sampleSizes[Math.min(t,e.sampleSizes.length-1)],l=Zx(e.sampleToChunk,t,(e=>e.startSampleIndex)),c=e.sampleToChunk[l];Lx(c);const u=c.startChunkIndex+Math.floor((t-c.startSampleIndex)/c.samplesPerChunk),d=e.chunkOffsets[u],h=c.startSampleIndex+(u-c.startChunkIndex)*c.samplesPerChunk;let f=0,p=d;if(1===e.sampleSizes.length)p+=a*(t-h),f+=a*c.samplesPerChunk;else for(let n=h;n<h+c.samplesPerChunk;n++){const i=e.sampleSizes[n];n<t&&(p+=i),f+=i}let m=i.delta;if(e.presentationTimestamps){const n=e.presentationTimestampIndexMap[t];Lx(void 0!==n),n<e.presentationTimestamps.length-1&&(m=e.presentationTimestamps[n+1].presentationTimestamp-r)}return{presentationTimestamp:r,duration:m,sampleOffset:p,sampleSize:a,chunkOffset:d,chunkSize:f,isKeyFrame:!e.keySampleIndices||-1!==Jx(e.keySampleIndices,t,(e=>e))}},iT=(e,t)=>{var n;if(!e.keySampleIndices)return t+1;const i=Zx(e.keySampleIndices,t,(e=>e));return null!==(n=e.keySampleIndices[i+1])&&void 0!==n?n:-1},rT=(e,t)=>{e.startTimestamp+=t,e.endTimestamp+=t;for(const n of e.samples)n.presentationTimestamp+=t;for(const n of e.presentationTimestamps)n.presentationTimestamp+=t},oT=e=>{const[t,,,n]=e,i=Math.hypot(t,n),r=t/i,o=n/i,s=-Math.atan2(o,r)*(180/Math.PI);return Number.isFinite(s)?s:0},sT=e=>0===e.sampleSizes.length;class aT{}class lT extends aT{async _getMajorBrand(e){let t=e._reader.requestSlice(0,12);return t instanceof Promise&&(t=await t),t?(t.skip(4),"ftyp"!==ST(t,4)?null:ST(t,4)):null}_createDemuxer(e){return new Y_(e)}}const cT=new class extends lT{async _canReadInput(e){const t=await this._getMajorBrand(e);return!!t&&"qt "!==t}get name(){return"MP4"}get mimeType(){return"video/mp4"}};class uT{constructor(){this._disposed=!1,this._sizePromise=null,this.onread=null}async getSizeOrNull(){var e;if(this._disposed)throw new fT;return null!==(e=this._sizePromise)&&void 0!==e?e:this._sizePromise=Promise.resolve(this._retrieveSize())}async getSize(){if(this._disposed)throw new fT;const e=await this.getSizeOrNull();if(null===e)throw new Error("Cannot determine the size of an unsized source.");return e}}class dT extends uT{constructor(e,t={}){var n;if(!(e instanceof ReadableStream))throw new TypeError("stream must be a ReadableStream.");if(!t||"object"!=typeof t)throw new TypeError("options must be an object.");if(void 0!==t.maxCacheSize&&(!l_(t.maxCacheSize)||t.maxCacheSize<0))throw new TypeError("options.maxCacheSize, when provided, must be a non-negative number.");super(),this._reader=null,this._cache=[],this._pendingSlices=[],this._currentIndex=0,this._targetIndex=0,this._maxRequestedIndex=0,this._endIndex=null,this._pulling=!1,this._stream=e,this._maxCacheSize=null!==(n=t.maxCacheSize)&&void 0!==n?n:16777216}_retrieveSize(){return this._endIndex}_read(e,t){if(null!==this._endIndex&&t>this._endIndex)return null;this._maxRequestedIndex=Math.max(this._maxRequestedIndex,t);const n=Zx(this._cache,e,(e=>e.start)),i=-1!==n?this._cache[n]:null;if(i&&i.start<=e&&t<=i.end)return{bytes:i.bytes,view:i.view,offset:i.start};let r=e;const o=new Uint8Array(t-e);if(-1!==n)for(let i=n;i<this._cache.length;i++){const n=this._cache[i];if(n.start>=t)break;const s=Math.max(e,n.start);s>r&&this._throwDueToCacheMiss();const a=Math.min(t,n.end);s<a&&(o.set(n.bytes.subarray(s-n.start,a-n.start),s-e),r=a)}if(r===t)return{bytes:o,view:$x(o),offset:e};this._currentIndex>r&&this._throwDueToCacheMiss();const{promise:s,resolve:a,reject:l}=e_();return this._pendingSlices.push({start:e,end:t,bytes:o,resolve:a,reject:l}),this._targetIndex=Math.max(this._targetIndex,t),this._pulling||(this._pulling=!0,this._pull().catch((e=>{if(this._pulling=!1,!(this._pendingSlices.length>0))throw e;this._pendingSlices.forEach((t=>t.reject(e))),this._pendingSlices.length=0}))),s}_throwDueToCacheMiss(){throw new Error("Read is before the cached region. With ReadableStreamSource, you must access the data more sequentially or increase the size of its cache.")}async _pull(){for(null!==(e=this._reader)&&void 0!==e||(this._reader=this._stream.getReader());this._currentIndex<this._targetIndex&&!this._disposed;){var e;const{done:t,value:n}=await this._reader.read();if(t){for(const e of this._pendingSlices)e.resolve(null);this._pendingSlices.length=0,this._endIndex=this._currentIndex;break}const i=this._currentIndex,r=this._currentIndex+n.byteLength;for(let e=0;e<this._pendingSlices.length;e++){const t=this._pendingSlices[e],o=Math.max(i,t.start),s=Math.min(r,t.end);o<s&&(t.bytes.set(n.subarray(o-i,s-i),o-t.start),s===t.end&&(t.resolve({bytes:t.bytes,view:$x(t.bytes),offset:t.start}),this._pendingSlices.splice(e,1),e--))}for(this._cache.push({start:i,end:r,bytes:n,view:$x(n),age:0});this._cache.length>0;){const e=this._cache[0];if(this._maxRequestedIndex-e.end<=this._maxCacheSize)break;this._cache.shift()}this._currentIndex+=n.byteLength}this._pulling=!1}_dispose(){this._pendingSlices.length=0,this._cache.length=0}}null!==(ct=Symbol.dispose)&&void 0!==ct||(Symbol.dispose=Symbol("Symbol.dispose"));class hT{get disposed(){return this._disposed}constructor(e){if(this._demuxerPromise=null,this._format=null,this._disposed=!1,!e||"object"!=typeof e)throw new TypeError("options must be an object.");if(!Array.isArray(e.formats)||e.formats.some((e=>!(e instanceof aT))))throw new TypeError("options.formats must be an array of InputFormat.");if(!(e.source instanceof uT))throw new TypeError("options.source must be a Source.");if(e.source._disposed)throw new Error("options.source must not be disposed.");this._formats=e.formats,this._source=e.source,this._reader=new pT(e.source)}_getDemuxer(){var e;return null!==(e=this._demuxerPromise)&&void 0!==e?e:this._demuxerPromise=(async()=>{this._reader.fileSize=await this._source.getSizeOrNull();for(const e of this._formats)if(await e._canReadInput(this))return this._format=e,e._createDemuxer(this);throw new Error("Input has an unsupported or unrecognizable format.")})()}get source(){return this._source}async getFormat(){return await this._getDemuxer(),Lx(this._format),this._format}async computeDuration(){return(await this._getDemuxer()).computeDuration()}async getFirstTimestamp(){const e=await this.getTracks();if(0===e.length)return 0;const t=await Promise.all(e.map((e=>e.getFirstTimestamp())));return Math.min(...t)}async getTracks(){return(await this._getDemuxer()).getTracks()}async getVideoTracks(){return(await this.getTracks()).filter((e=>e.isVideoTrack()))}async getAudioTracks(){return(await this.getTracks()).filter((e=>e.isAudioTrack()))}async getPrimaryVideoTrack(){var e;return null!==(e=(await this.getTracks()).find((e=>e.isVideoTrack())))&&void 0!==e?e:null}async getPrimaryAudioTrack(){var e;return null!==(e=(await this.getTracks()).find((e=>e.isAudioTrack())))&&void 0!==e?e:null}async getMimeType(){return(await this._getDemuxer()).getMimeType()}async getMetadataTags(){return(await this._getDemuxer()).getMetadataTags()}dispose(){this._disposed||(this._disposed=!0,this._source._disposed=!0,this._source._dispose())}[Symbol.dispose](){this.dispose()}}class fT extends Error{constructor(e="Input has been disposed."){super(e),this.name="InputDisposedError"}}class pT{constructor(e){this.source=e}requestSlice(e,t){if(this.source._disposed)throw new fT;if(e<0)return null;if(null!==this.fileSize&&e+t>this.fileSize)return null;const n=e+t,i=this.source._read(e,n);return i instanceof Promise?i.then((t=>t?new mT(t.bytes,t.view,t.offset,e,n):null)):i?new mT(i.bytes,i.view,i.offset,e,n):null}requestSliceRange(e,t,n){if(this.source._disposed)throw new fT;if(e<0)return null;if(null!==this.fileSize)return this.requestSlice(e,n_(this.fileSize-e,t,n));{const i=this.requestSlice(e,n),r=i=>{if(i)return i;const r=i=>(Lx(null!==i),this.requestSlice(e,n_(i-e,t,n))),o=this.source._retrieveSize();return o instanceof Promise?o.then(r):r(o)};return i instanceof Promise?i.then(r):r(i)}}}class mT{constructor(e,t,n,i,r){this.bytes=e,this.view=t,this.offset=n,this.start=i,this.end=r,this.bufferPos=i-n}static tempFromBytes(e){return new mT(e,$x(e),0,0,e.length)}get length(){return this.end-this.start}get filePos(){return this.offset+this.bufferPos}set filePos(e){this.bufferPos=e-this.offset}get remainingLength(){return Math.max(this.end-this.filePos,0)}skip(e){this.bufferPos+=e}slice(e,t=this.end-e){if(e<this.start||e+t>this.end)throw new RangeError("Slicing outside of original slice.");return new mT(this.bytes,this.view,this.offset,e,e+t)}}const vT=(e,t)=>{if(e.filePos<e.start||e.filePos+t>e.end)throw new RangeError(`Tried reading [${e.filePos}, ${e.filePos+t}), but slice is [${e.start}, ${e.end}). This is likely an internal error, please report it alongside the file that caused it.`)},gT=(e,t)=>{vT(e,t);const n=e.bytes.subarray(e.bufferPos,e.bufferPos+t);return e.bufferPos+=t,n},yT=e=>(vT(e,1),e.view.getUint8(e.bufferPos++)),bT=e=>{vT(e,2);const t=e.view.getUint16(e.bufferPos,!1);return e.bufferPos+=2,t},kT=e=>{vT(e,3);const t=t_(e.view,e.bufferPos);return e.bufferPos+=3,t},wT=e=>{vT(e,2);const t=e.view.getInt16(e.bufferPos,!1);return e.bufferPos+=2,t},xT=e=>{vT(e,4);const t=e.view.getUint32(e.bufferPos,!1);return e.bufferPos+=4,t},_T=e=>{vT(e,4);const t=e.view.getInt32(e.bufferPos,!1);return e.bufferPos+=4,t},TT=e=>4294967296*xT(e)+xT(e),IT=e=>4294967296*_T(e)+xT(e),ET=e=>{vT(e,8);const t=e.view.getFloat64(e.bufferPos,!1);return e.bufferPos+=8,t},ST=(e,t)=>{vT(e,t);let n="";for(let i=0;i<t;i++)n+=String.fromCharCode(e.bytes[e.bufferPos++]);return n};var AT=new WeakMap,NT=new WeakMap,MT=new WeakMap,FT=new WeakMap,CT=new WeakMap,OT=new WeakMap,PT=new WeakMap,RT=new WeakMap,DT=new WeakMap,LT=new WeakMap,BT=new WeakMap,zT=new WeakMap,WT=new WeakMap,$T=new WeakMap,jT=new WeakMap,UT=new WeakSet;class qT extends od{constructor(...e){super(...e),O(this,UT),F(this,AT,null),F(this,NT,null),F(this,MT,null),F(this,FT,null),F(this,CT,!1),F(this,OT,!1),F(this,PT,!1),F(this,RT,!1),F(this,DT,void 0),F(this,LT,null),F(this,BT,null),F(this,zT,!1),F(this,WT,!1),F(this,$T,null),F(this,jT,!1)}get name(){return"FMP4Demuxer"}get defaults(){return{}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"pushChunk","endOfStream"])}pushChunk(e,t={}){if(M(PT,this)||M(RT,this))return;const n=e instanceof Uint8Array?e:new Uint8Array(e),i=!!t.isInit;C(LT,this,A(UT,this,YT).call(this,n,t,i)),i&&(C(DT,this,n),C(BT,this,null),this.trigger("demux:init",{data:n})),A(UT,this,XT).call(this);try{var r;const e=null===(r=M(AT,this))||void 0===r?void 0:r.write(n);e&&"function"==typeof e.catch&&e.catch((e=>{A(UT,this,QT).call(this,e)}))}catch(e){if(M(PT,this)||A(UT,this,VT).call(this,e))return;return this.log.warn("[FMP4Demuxer] mediabunny demux failed",e),void A(UT,this,QT).call(this,e)}const o=A(UT,this,eI).call(this);o&&"function"==typeof o.catch&&o.catch((e=>{A(UT,this,QT).call(this,e)}))}endOfStream(){if(M(RT,this))return;if(M(zT,this))return;let e;C(zT,this,!0),C(WT,this,!1),C(jT,this,!1);try{var t;e=null===(t=M(AT,this))||void 0===t?void 0:t.close()}catch(t){e=Promise.resolve()}let n=!1;A(UT,this,HT).call(this),C($T,this,setTimeout((()=>{C($T,this,null),n||M(WT,this)||M(RT,this)||A(UT,this,KT).call(this)}),20)),Promise.resolve(e).catch((()=>{})).finally((()=>{n=!0,A(UT,this,HT).call(this),A(UT,this,KT).call(this)}))}onDispose(){super.onDispose(),C(RT,this,!0);try{var e,t;null===(e=M(MT,this))||void 0===e||null===(t=e.close)||void 0===t||t.call(e)}catch(e){}this.endOfStream();try{var n,i;null===(n=M(NT,this))||void 0===n||null===(i=n.dispose)||void 0===i||i.call(n)}catch(e){}C(MT,this,null),C(NT,this,null),C(PT,this,!1),C(LT,this,null),C(FT,this,null),C(CT,this,!1),C(OT,this,!1),C(zT,this,!1),C(WT,this,!1),C(jT,this,!1),A(UT,this,HT).call(this)}}function VT(e){return!!M(RT,this)&&(!e||("InputDisposedError"===(null==e?void 0:e.name)||("string"==typeof(null==e?void 0:e.message)?e.message:"").includes("Input has been disposed")))}function GT(){try{var e,t;const n=null===(e=M(AT,this))||void 0===e||null===(t=e.close)||void 0===t?void 0:t.call(e);n&&"function"==typeof n.catch&&n.catch((()=>{}))}catch(e){}C(AT,this,null)}function HT(){null!==M($T,this)&&(clearTimeout(M($T,this)),C($T,this,null))}function KT(){if(M(WT,this)||M(RT,this)||M(PT,this))return;if(C(WT,this,!0),M(OT,this))return void C(jT,this,!0);C(jT,this,!1);const e=A(UT,this,eI).call(this);e&&"function"==typeof e.catch&&e.catch((e=>{A(UT,this,QT).call(this,e)}))}function XT(){if(M(NT,this)&&M(AT,this))return;const e=ld.TransformStream;if(void 0===e)throw new Error("TransformStream is not available in this environment");const{readable:t,writable:n}=new e;C(AT,this,n.getWriter()),C(NT,this,new hT({source:new dT(t),formats:[cT]})),C(CT,this,!1)}function YT(e,t,n){const i={isInit:n,byteLength:(null==e?void 0:e.byteLength)||0};return"number"==typeof t.loaded&&(i.loaded=t.loaded),"number"==typeof t.total&&(i.total=t.total),"number"==typeof t.pts&&(i.pts=t.pts),"number"==typeof t.dts&&(i.dts=t.dts),"number"==typeof t.duration&&(i.duration=t.duration),"boolean"==typeof t.isKey&&(i.isKey=t.isKey),i}function QT(e){if(M(PT,this)||A(UT,this,VT).call(this,e))return;if(A(UT,this,ZT).call(this,e))return void C(CT,this,!1);C(PT,this,!0),A(UT,this,GT).call(this);try{var t,n;null===(t=M(MT,this))||void 0===t||null===(n=t.close)||void 0===n||n.call(t)}catch(e){}C(MT,this,null);try{var i,r;null===(i=M(NT,this))||void 0===i||null===(r=i.dispose)||void 0===r||r.call(i)}catch(e){}C(NT,this,null);const o={error:e,recoverable:!1,severity:"fatal",streamClosed:M(zT,this),streamFinalized:M(WT,this)};M(LT,this)&&(o.context={...M(LT,this)}),this.trigger("demux:error",o)}function JT(e){if(!e)return!1;const t="string"==typeof(null==e?void 0:e.message)?e.message:"";return!!t&&(t.includes("unsupported or unrecognizable format")||t.includes("No supported tracks found"))}function ZT(e){return!!A(UT,this,JT).call(this,e)&&(!M(WT,this)||M(jT,this))}async function eI(){if(!(M(RT,this)||M(PT,this)||M(CT,this)||M(OT,this))){C(OT,this,!0);try{A(UT,this,XT).call(this);const e=await M(NT,this).getPrimaryVideoTrack(),t=e?null:await M(NT,this).getPrimaryAudioTrack(),n=e||t;if(!n)throw new Error("No supported tracks found in MP4");const i=await n.getDecoderConfig(),r=await n.getCodecParameterString(),o=await M(NT,this).getMimeType();this.trigger("demux:init",{...M(DT,this)?{data:M(DT,this)}:{},decoderConfig:i,codec:r,mimeType:o}),C(MT,this,new W_(n)),C(CT,this,!0),C(FT,this,(async()=>{try{for await(const e of M(MT,this).packets()){if(M(RT,this))break;const t="number"==typeof e.timestamp?e.timestamp:0;null===M(BT,this)&&C(BT,this,t);let n=t-M(BT,this);n<0&&(n=0),this.trigger("demux:sample",{data:e.data,pts:n,dts:n,duration:e.duration,isKey:"key"===e.type})}this.trigger("demux:complete")}catch(e){A(UT,this,QT).call(this,e)}})())}catch(e){if(A(UT,this,ZT).call(this,e))return;throw e}finally{C(OT,this,!1),!M(jT,this)||M(PT,this)||M(RT,this)||A(UT,this,KT).call(this)}}}const tI=1e6,nI=24e3/1001,iI={primaries:"bt709",transfer:"bt709",matrix:"bt709",fullRange:!0},rI=new Uint8Array;function oI(e){return e?e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):rI:rI}let sI=null;const aI={video:(ut=new WeakMap,dt=new WeakMap,ht=new WeakMap,ft=new WeakMap,pt=new WeakMap,mt=new WeakMap,vt=new WeakMap,gt=new WeakMap,yt=new WeakMap,bt=new WeakMap,kt=new WeakMap,wt=new WeakMap,xt=new WeakMap,_t=new WeakMap,Tt=new WeakMap,It=new WeakMap,Et=new WeakMap,St=new WeakMap,At=new WeakMap,Nt=new WeakMap,Mt=new WeakMap,Ft=new WeakMap,Ct=new WeakMap,Ot=new WeakMap,Pt=new WeakMap,Rt=new WeakMap,Dt=new WeakMap,Lt=new WeakMap,Bt=new WeakMap,zt=new WeakMap,Wt=new WeakMap,$t=new WeakMap,jt=new WeakMap,Ut=new WeakMap,qt=new WeakSet,class extends Dx{get name(){return"WebCodecsSegmentDecoder"}get defaults(){return{decodedHorizonSeconds:1,maxDecodedFrames:24,maxDecodeQueueSize:4,av1ColorSpaceOverrideEnabled:!0,convertFramesToBitmapsOnAndroid:!0,androidFixEndOfSegmentDelta:.2}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"decodeChunk"])}constructor(...e){super(...e),O(this,qt),F(this,ut,void 0),F(this,dt,[]),F(this,ht,void 0),F(this,ft,void 0),F(this,pt,void 0),F(this,mt,void 0),F(this,vt,[]),F(this,gt,void 0),F(this,yt,new Map),F(this,bt,!0),F(this,kt,!1),F(this,wt,!1),F(this,xt,!1),F(this,_t,void 0),F(this,Tt,!1),F(this,It,!1),F(this,Et,0),F(this,St,void 0),F(this,At,void 0),F(this,Nt,{}),F(this,Mt,void 0),F(this,Ft,0),F(this,Ct,null),F(this,Ot,!1),F(this,Pt,null),F(this,Rt,void 0),F(this,Dt,0),F(this,Lt,0),F(this,Bt,0),F(this,zt,0),F(this,Wt,!1),F(this,$t,!1),F(this,jt,.2),F(this,Ut,Promise.resolve()),C(ht,this,this.settings.decodedHorizonSeconds||1),C(ft,this,A(qt,this,JI).call(this,this.settings.maxDecodedFrames)),C(pt,this,A(qt,this,eE).call(this,this.settings.maxDecodeQueueSize)),C(Wt,this,Xm()),C($t,this,A(qt,this,qI).call(this,this.settings.convertFramesToBitmapsOnAndroid)),C(jt,this,A(qt,this,VI).call(this,this.settings.androidFixEndOfSegmentDelta)),C(mt,this,(()=>0)),C(gt,this,(()=>A(qt,this,PI).call(this)));const t=this.settings.demuxerOptions?{FMP4Demuxer:this.settings.demuxerOptions}:{};C(ut,this,new qT(t)),M(ut,this).on("demux:init",(e=>A(qt,this,TI).call(this,e))),M(ut,this).on("demux:sample",(e=>A(qt,this,II).call(this,e))),M(ut,this).on("demux:complete",(()=>A(qt,this,EI).call(this))),M(ut,this).on("demux:error",(e=>A(qt,this,fI).call(this,e)))}setCurrentTimeProvider(e){"function"==typeof e&&C(mt,this,e)}setTimeOffsetSeconds(e){const t=Number(e);C(Ft,this,Number.isFinite(t)?t:0)}setSeekTargetTimeSeconds(e){const t=Number(e);C(Ct,this,Number.isFinite(t)?t:null),C(Ot,this,!1),C(Pt,this,null)}endOfStream(){M(ut,this)&&"function"==typeof M(ut,this).endOfStream&&M(ut,this).endOfStream()}configure(e){super.configure(e),C(Nt,this,{codec:A(qt,this,oE).call(this,e),width:(null==e?void 0:e.codedWidth)||(null==e?void 0:e.width),height:(null==e?void 0:e.codedHeight)||(null==e?void 0:e.height)}),C(St,this,M(Nt,this).codec)}setSegment(e){this.lastSegment=e,A(qt,this,kI).call(this)}setNodeId(e){C(Rt,this,e)}decode(e){this.setSegment(e);const t=null==e?void 0:e.arrayBuffer;t&&M(ut,this).pushChunk(t,{isInit:!(null==e||!e.isInit)})}async decodeChunk(e,t={}){await M(ut,this).pushChunk(e,{isInit:!!t.isInit,pts:"number"==typeof t.pts?t.pts:void 0,dts:"number"==typeof t.dts?t.dts:void 0,duration:"number"==typeof t.duration?t.duration:void 0,isKey:!!t.isKey,loaded:"number"==typeof t.loaded?t.loaded:void 0,total:"number"==typeof t.total?t.total:void 0})}get decodedFrames(){return M(dt,this).slice()}onDispose(){if(super.onDispose(),A(qt,this,LI).call(this),M(ut,this)&&"function"==typeof M(ut,this).dispose&&M(ut,this).dispose(),C(dt,this,[]),C(vt,this,[]),M(yt,this).clear(),C(Pt,this,null),M(_t,this)&&"function"==typeof M(_t,this).close)try{M(_t,this).close()}catch(e){}C(_t,this,null),C(Tt,this,!1),C(At,this,null),C(St,this,null),C(Rt,this,null),C(Ut,this,Promise.resolve()),A(qt,this,kI).call(this)}}),audio:(Vt=new WeakMap,Gt=new WeakMap,Ht=new WeakMap,Kt=new WeakMap,Xt=new WeakMap,Yt=new WeakMap,Qt=new WeakMap,Jt=new WeakSet,class extends Dx{constructor(...e){super(...e),O(this,Jt),F(this,Vt,void 0),F(this,Gt,[]),F(this,Ht,0),F(this,Kt,!1),F(this,Xt,!1),F(this,Yt,void 0),F(this,Qt,0)}get name(){return"WebAudioDecoder"}setSegment(e){C(Yt,this,e)}setTimeOffsetSeconds(e){const t=Number(e);C(Qt,this,Number.isFinite(t)?t:0)}decode(e){if(this.lastSegment=e,!e)return;if(e.isInit)return void C(Vt,this,oI(e.arrayBuffer));const t=e.arrayBuffer;t&&A(Jt,this,uI).call(this,oI(t),!0)}decodeChunk(e,t={}){if(!e)return;if(t.isInit)return void C(Vt,this,oI(e));const n=oI(e);if(!n.length)return;M(Gt,this).push(n),C(Ht,this,M(Ht,this)+n.length);const i=Number(t.loaded),r=Number(t.total);Number.isFinite(i)&&Number.isFinite(r)&&r>0&&i>=r&&A(Jt,this,lI).call(this)}endOfStream(){A(Jt,this,lI).call(this)}onDispose(){super.onDispose(),C(Vt,this,void 0),C(Gt,this,[]),C(Ht,this,0),C(Kt,this,!1),C(Xt,this,!1),C(Yt,this,void 0)}}),image:class extends Dx{#z;#W=0;#$=[];#j=0;#U;get name(){return"ImageDecoder"}setSegment(e){this.#z=e}setTimeOffsetSeconds(e){const t=Number(e);this.#W=Number.isFinite(t)?t:0}decode(e){super.decode(e),e&&(this.#z=e);const t=null==e?void 0:e.arrayBuffer;t instanceof ArrayBuffer&&(this.#$=[new Uint8Array(t)],this.#j=t.byteLength,this.endOfStream())}decodeChunk(e,t={}){if(null!=t&&t.isInit)return;const n=function(e){if(e)return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):ArrayBuffer.isView(e)&&e.buffer?new Uint8Array(e.buffer):void 0}(e);n&&n.length&&(this.#$.push(n),this.#j+=n.length)}async endOfStream(){var e,t,n;if(this.#U)return;if(!(this.#$.length&&this.#j>0))return;const i=new Uint8Array(this.#j);let r=0;for(let e=0;e<this.#$.length;e+=1){const t=this.#$[e];i.set(t,r),r+=t.length}const o=null===(e=this.#z)||void 0===e?void 0:e.chosenRepresentation,s=(null==o?void 0:o.mime)||(null===(t=this.track)||void 0===t?void 0:t.mimeType)||(null===(n=this.track)||void 0===n?void 0:n.mime)||function(e){if(e instanceof Uint8Array&&!(e.byteLength<4))return e.byteLength>=8&&137===e[0]&&80===e[1]&&78===e[2]&&71===e[3]&&13===e[4]&&10===e[5]&&26===e[6]&&10===e[7]?"image/png":255===e[0]&&216===e[1]&&255===e[2]?"image/jpeg":e.byteLength>=6&&71===e[0]&&73===e[1]&&70===e[2]&&56===e[3]?"image/gif":e.byteLength>=12&&82===e[0]&&73===e[1]&&70===e[2]&&70===e[3]&&87===e[8]&&69===e[9]&&66===e[10]&&80===e[11]?"image/webp":void 0}(i);try{var a,l;const e=await async function(e,t){const n=function(e,t){if(!(e&&e.byteLength>0))return;if("function"!=typeof ld.Blob)return;const n="string"==typeof t?t:"";return new ld.Blob([e],n?{type:n}:void 0)}(e,t);if(!n)throw new Error("Image decode requires Blob support");let i;if("function"==typeof ld.Image&&ld.URL&&"function"==typeof ld.URL.createObjectURL&&"function"==typeof ld.URL.revokeObjectURL){const e=ld.URL.createObjectURL(n);try{const t=new ld.Image;return await new Promise(((n,i)=>{t.onload=()=>n(),t.onerror=e=>i(e||new Error("Image decode failed")),t.src=e})),t}catch(e){i=e}finally{ld.URL.revokeObjectURL(e)}}if("function"==typeof ld.createImageBitmap)try{return ld.createImageBitmap(n)}catch(e){i=e}if(i)throw i;throw new Error("No supported image decode mechanism")}(i,s);this.#U=e;const t=function(e){if(!e)return;const t=[[e.naturalWidth,e.naturalHeight],[e.width,e.height],[e.displayWidth,e.displayHeight],[e.videoWidth,e.videoHeight],[e.codedWidth,e.codedHeight]];for(let e=0;e<t.length;e+=1){const[n,i]=t[e],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}(e);t&&o&&(Og(o.width)||(o.width=t.width),Og(o.height)||(o.height=t.height)),this.trigger("decoder:frame",{pts:this.#W,duration:Og(null===(a=this.#z)||void 0===a?void 0:a.duration)?this.#z.duration:null===(l=this.track)||void 0===l?void 0:l.duration,frame:e})}catch(e){this.trigger("decoder:error",{error:e})}}onDispose(){if(super.onDispose(),this.#U&&"function"==typeof this.#U.close)try{this.#U.close()}catch(e){}this.#U=null,this.#$=[],this.#j=0,this.#z=null}}};function lI(){if(M(Kt,this)||M(Xt,this))return;if(!M(Ht,this))return;const e=A(Jt,this,cI).call(this);e.length&&A(Jt,this,uI).call(this,e,!1)}function cI(){const e=M(Vt,this),t=e?e.length:0,n=t+M(Ht,this);if(!n)return rI;const i=new Uint8Array(n);let r=0;t&&(i.set(e,r),r+=t);for(let e=0;e<M(Gt,this).length;e+=1){const t=M(Gt,this)[e];t&&t.length&&(i.set(t,r),r+=t.length)}return i}function uI(e,t){if(M(Kt,this)||M(Xt,this))return;const n=t?A(Jt,this,dI).call(this,e):e;if(!n||!n.length)return;const i=function(){if(sI)return sI;const e=ld.AudioContext||ld.webkitAudioContext;return e?(sI=new e,sI):null}();if(!i||"function"!=typeof i.decodeAudioData)return void this.trigger("decoder:error",{error:new Error("AudioContext is not available")});const r=n.buffer.slice(0);C(Xt,this,!0),new Promise(((e,t)=>{const n=i.decodeAudioData(r,e,t);n&&"function"==typeof n.then&&n.then(e).catch(t)})).then((e=>{var t;C(Kt,this,!0);const n=Number.isFinite(null==e?void 0:e.duration)?e.duration:Number(null===(t=M(Yt,this))||void 0===t?void 0:t.duration)||void 0;this.trigger("decoder:audio",{audioBuffer:e,pts:M(Qt,this),duration:n})})).catch((e=>{this.trigger("decoder:error",{error:e})})).finally((()=>{C(Gt,this,[]),C(Ht,this,0),C(Xt,this,!1)}))}function dI(e){const t=M(Vt,this);if(!t||!t.length)return e;const n=t.length+e.length,i=new Uint8Array(n);return i.set(t,0),i.set(e,t.length),i}function hI(e,t){var n,i,r,o,s;const a=null!=e&&e.context&&"object"==typeof e.context?e.context:void 0;return{error:t,errorName:null==t?void 0:t.name,errorMessage:"string"==typeof(null==t?void 0:t.message)?t.message:void 0,nodeId:M(Rt,this),trackId:null===(n=this.track)||void 0===n?void 0:n.id,trackType:null===(i=this.track)||void 0===i?void 0:i.type,codec:(null===(r=M(Nt,this))||void 0===r?void 0:r.codec)||M(St,this),segmentId:null===(o=this.lastSegment)||void 0===o?void 0:o.id,segmentIsInit:!(null===(s=this.lastSegment)||void 0===s||!s.isInit),chunkContext:a}}function fI(e){const t=(null==e?void 0:e.error)||e,n=A(qt,this,hI).call(this,e,t);if(A(qt,this,pI).call(this,e,t))return this.log.warn("[onDemuxError] recoverable demux error",n),void A(qt,this,EI).call(this);const i=A(qt,this,_I).call(this,e),r=A(qt,this,mI).call(this,i);if(i&&0===i.missingFrames)return this.log.warn(`[onDemuxError] ignoring demux error (no missing frames)${r}`,{...n,missingFrameStats:i}),void A(qt,this,EI).call(this);let o=n;i&&(o={...n,missingFrameStats:i}),this.log.warn(`[onDemuxError] demux error${r}`,o),this.trigger("decoder:error",e)}function pI(e,t){if("boolean"==typeof(null==e?void 0:e.recoverable))return e.recoverable;const n="string"==typeof(null==e?void 0:e.severity)?e.severity:"";if(n)return"recoverable"===n||"transient"===n;const i="string"==typeof(null==t?void 0:t.message)?t.message:"";return!!i&&(i.includes("unsupported or unrecognizable format")||i.includes("No supported tracks found"))}function mI(e){return e?` expectedFrames=${A(qt,this,vI).call(this,e.expectedFrames)} demuxedFrames=${A(qt,this,vI).call(this,e.demuxedFrames)} missingFrames=${A(qt,this,vI).call(this,e.missingFrames)}`:""}function vI(e){if(null==e)return"unknown";const t=Number(e);return Number.isFinite(t)?String(t):"unknown"}function gI(e,t={}){return{expectedFrames:null,demuxedFrames:M(Dt,this),missingFrames:null,reason:e,...t}}function yI(e){const t=Number(e);return Number.isFinite(t)?t:null}function bI(e){var t,n;const i=(null==e?void 0:e.context)||{},r=Number(i.loaded),o=Number(i.total);if(!Number.isFinite(o)||o<=0||!Number.isFinite(r)||r<o)return null;if(null!==(t=this.lastSegment)&&void 0!==t&&t.isInit)return null;const s=Number(null===(n=this.lastSegment)||void 0===n?void 0:n.duration);if(!Number.isFinite(s)||s<=0)return A(qt,this,gI).call(this,"segment_duration_unavailable",{segmentDurationSeconds:A(qt,this,yI).call(this,s),demuxedCoverageSeconds:M(zt,this),frameDurationSeconds:null});const a=A(qt,this,xI).call(this);if(!Number.isFinite(a)||a<=0){const e=Math.max(1,Math.round(s*nI));return{expectedFrames:e,demuxedFrames:M(Dt,this),missingFrames:Math.max(0,e-M(Dt,this)),reason:"fallback_fps",fallbackFps:nI,segmentDurationSeconds:s,demuxedCoverageSeconds:M(zt,this),frameDurationSeconds:A(qt,this,yI).call(this,a)}}const l=Math.min(.5*a,.02),c=Math.max(0,s-M(zt,this)),u=c<=l?0:c,d=Math.max(1,Math.floor((s+l)/a)),h=Math.max(0,d-M(Dt,this)),f=u>0?Math.ceil(u/a):0;return{expectedFrames:d,demuxedFrames:M(Dt,this),missingFrames:Math.max(h,f),segmentDurationSeconds:s,demuxedCoverageSeconds:M(zt,this),frameDurationSeconds:a}}function kI(){C(Dt,this,0),C(Lt,this,0),C(Bt,this,0),C(zt,this,0)}function wI(e){C(Dt,this,M(Dt,this)+1);const t=Number(null==e?void 0:e.pts),n=Number(null==e?void 0:e.duration);if(Number.isFinite(n)&&n>0&&(C(Lt,this,M(Lt,this)+n),C(Bt,this,M(Bt,this)+1)),!Number.isFinite(t))return;const i=Number.isFinite(n)&&n>0?t+n:t;Number.isFinite(i)&&i>M(zt,this)&&C(zt,this,i)}function xI(){return M(Bt,this)>0?M(Lt,this)/M(Bt,this):M(Dt,this)>0&&M(zt,this)>0?M(zt,this)/M(Dt,this):null}function _I(e){return A(qt,this,bI).call(this,e)}function TI(e){(null==e?void 0:e.data)instanceof Uint8Array&&(C(At,this,e.data.buffer),A(qt,this,zI).call(this)),null!=e&&e.decoderConfig&&(C(Mt,this,e.decoderConfig),C(St,this,e.decoderConfig.codec||M(St,this)),A(qt,this,zI).call(this)),this.trigger("decoder:init",e)}function II(e){A(qt,this,wI).call(this,e),M(vt,this).push(e),A(qt,this,PI).call(this)}function EI(){C(kt,this,!0),A(qt,this,$I).call(this)}function SI(e){const t="number"==typeof(null==e?void 0:e.pts)?e.pts:void 0;if(Number.isFinite(t))return M(Ft,this)+t}function AI(e){return M(vt,this).some((t=>{const n=A(qt,this,SI).call(this,t);return Number.isFinite(n)&&n>=e}))}function NI(e){let t=-1,n=null;for(let i=0;i<M(vt,this).length;i+=1){const r=M(vt,this)[i],o=A(qt,this,SI).call(this,r);Number.isFinite(o)&&(null==r?void 0:r.isKey)&&o<=e&&(t=i,n=o)}return{chosenIndex:t,chosenPtsSeconds:n}}function MI(e){let t=-1,n=null;for(let i=0;i<M(vt,this).length;i+=1){const r=M(vt,this)[i],o=A(qt,this,SI).call(this,r);if(Number.isFinite(o)&&null!=r&&r.isKey&&(t=i,n=o,o>=e))break}return{chosenIndex:t,chosenPtsSeconds:n}}function FI(e){const t=e+M(ht,this),n=M(Ct,this);if(!Number.isFinite(n))return t;const i=Number.isFinite(M(Pt,this))?M(Pt,this):null;if(Number.isFinite(i))return Math.max(t,i);const{chosenPtsSeconds:r}=A(qt,this,MI).call(this,n);return Number.isFinite(r)?Math.max(t,r):t}function CI(e){const t=M(Ct,this);Number.isFinite(t)&&Number.isFinite(e)&&e>=t&&(C(Ct,this,null),C(Pt,this,null))}function OI(){const e=M(Ct,this);if(!Number.isFinite(e)||M(Ot,this))return!0;if(!A(qt,this,AI).call(this,e)&&!M(kt,this))return!1;const t=A(qt,this,NI).call(this,e);let n=t;if(-1===t.chosenIndex&&(n=A(qt,this,MI).call(this,e)),n.chosenIndex>0){const e=`[#maybeAlignToSeekKeyframe] Dropping ${n.chosenIndex} samples before keyframe @ ${n.chosenPtsSeconds}`;this.log.debug(e),M(vt,this).splice(0,n.chosenIndex)}return C(bt,this,!0),Number.isFinite(n.chosenPtsSeconds)&&C(Pt,this,n.chosenPtsSeconds),C(Ot,this,!0),!0}function PI(){const e=M(mt,this)?M(mt,this).call(this):0,t=A(qt,this,FI).call(this,e);if(A(qt,this,YI).call(this,e),A(qt,this,QI).call(this),!A(qt,this,OI).call(this))return void A(qt,this,DI).call(this);const n=void 0!==ld.VideoDecoder&&void 0!==ld.EncodedVideoChunk;for(n&&!M(Tt,this)&&M(Mt,this)&&A(qt,this,zI).call(this);M(vt,this).length&&!A(qt,this,ZI).call(this)&&!(n&&M(_t,this)&&A(qt,this,tE).call(this));){const e=M(vt,this)[0],i="number"==typeof(null==e?void 0:e.pts)?e.pts:0,r=M(Ft,this)+i;if(r>t)break;if(null!=e&&e.raw)M(vt,this).shift(),A(qt,this,RI).call(this,e);else{if(n){if(!M(Tt,this)||!M(_t,this))break;if(M(bt,this)&&!e.isKey){M(vt,this).shift();continue}M(vt,this).shift();const t=Math.max(0,Math.round(r*tI));M(yt,this).set(t,!!e.isKey);try{const n=new ld.EncodedVideoChunk({type:e.isKey?"key":"delta",timestamp:t,duration:e.duration?Math.round(e.duration*tI):void 0,data:e.data instanceof Uint8Array?e.data:new Uint8Array(e.data)});M(_t,this).decode(n),e.isKey&&C(bt,this,!1);continue}catch(e){M(yt,this).delete(t);const n="string"==typeof(null==e?void 0:e.message)?e.message:"";if("DataError"===(null==e?void 0:e.name)&&n.includes("key frame")){C(bt,this,!0);continue}this.log.warn("[#drainDecodeQueue] decode failed, falling back to placeholder",e)}}M(vt,this).shift(),A(qt,this,RI).call(this,e)}}A(qt,this,$I).call(this),A(qt,this,DI).call(this)}function RI(e){const t=M(mt,this)?M(mt,this).call(this):0,n=A(qt,this,FI).call(this,t),i=M(Ft,this)+("number"==typeof e.pts?e.pts:0);if(i<t||i>n)return;A(qt,this,YI).call(this,t);const r={pts:i,duration:e.duration,data:e.data,isKey:e.isKey};M(dt,this).push(r),A(qt,this,QI).call(this),this.trigger("decoder:frame",r),A(qt,this,CI).call(this,i)}function DI(){if(M(vt,this).length>0&&void 0!==ld.VideoDecoder){if(qk(M(gt,this)))return;jk(M(gt,this),50)}else A(qt,this,LI).call(this)}function LI(){M(gt,this)&&qk(M(gt,this))&&Uk(M(gt,this))}function BI(){return null!=ld&&ld.performance&&"function"==typeof ld.performance.now?ld.performance.now():Date.now()}function zI(){if(M(Tt,this))return;if(void 0===ld.VideoDecoder)return;if(!M(Mt,this))return;if(M(It,this)&&A(qt,this,BI).call(this)<M(Et,this))return;const e=A(qt,this,WI).call(this);try{C(_t,this,new ld.VideoDecoder({output:e=>A(qt,this,UI).call(this,e),error:e=>A(qt,this,jI).call(this,e)})),M(_t,this).configure(e),C(Tt,this,!0),C(bt,this,!0),C(It,this,!1),C(Et,this,0),A(qt,this,PI).call(this)}catch(e){this.log.warn("[#maybeConfigureDecoder] configure failed, falling back to placeholder decode",e),C(_t,this,null),C(Tt,this,!1),C(Mt,this,null)}}function WI(){const e={...M(Mt,this)};return A(qt,this,iE).call(this,e)&&M(Nt,this).codec?e.codec=M(Nt,this).codec:!e.codec&&M(St,this)&&(e.codec=M(St,this)),M(At,this)&&!e.description&&(e.description=M(At,this)),M(Nt,this).width&&!e.codedWidth&&(e.codedWidth=M(Nt,this).width),M(Nt,this).height&&!e.codedHeight&&(e.codedHeight=M(Nt,this).height),A(qt,this,rE).call(this,e),e}function $I(){void 0!==ld.VideoDecoder&&void 0!==ld.EncodedVideoChunk&&(M(It,this)||!M(kt,this)||M(xt,this)||M(wt,this)||M(Tt,this)&&M(_t,this)&&"function"==typeof M(_t,this).flush&&(M(vt,this).length||(C(wt,this,!0),Promise.resolve().then((()=>M(_t,this).flush())).then((()=>{C(xt,this,!0),C(bt,this,!0)})).catch((e=>{"AbortError"!==(null==e?void 0:e.name)&&this.log.warn("[#maybeFlushDecoder] flush failed",e)})).finally((()=>{C(wt,this,!1)})))))}function jI(e){if(this.log.warn("[#handleDecoderError] decoder error",e),this.trigger("decoder:error",{error:e}),M(_t,this)&&"function"==typeof M(_t,this).close)try{M(_t,this).close()}catch(e){}C(_t,this,null),C(Tt,this,!1),C(wt,this,!1),C(xt,this,!1),C(bt,this,!0),M(yt,this).clear(),C(It,this,!0),C(Et,this,A(qt,this,BI).call(this)+1e3)}function UI(e){C(Ut,this,M(Ut,this).then((()=>{var t;if(!this._disposed)return A(qt,this,XI).call(this,e);null===(t=e.close)||void 0===t||t.call(e)})).catch((t=>{this.log.warn("[#enqueueDecodedFrame] failed processing decoded frame",t);try{var n;null===(n=e.close)||void 0===n||n.call(e)}catch(e){}})))}function qI(e){return"boolean"!=typeof e||e}function VI(e){const t=Number(e);return!Number.isFinite(t)||t<0?.2:t}function GI(){return!!M($t,this)&&"function"==typeof ld.createImageBitmap&&M(Wt,this)}function HI(e){var t;const n=Number(null===(t=this.lastSegment)||void 0===t?void 0:t.duration);if(!Number.isFinite(n)||n<=0)return!1;if(!Number.isFinite(e))return!1;const i=Number(M(Ft,this));return!!Number.isFinite(i)&&e>=i+n-M(jt,this)}async function KI(e,t){try{var n;const i=A(qt,this,HI).call(this,t),r=await ld.createImageBitmap(e,{premultiplyAlpha:i?"none":"default"});return null!==(n=e.close)&&void 0!==n&&n.call(e),r}catch(t){return this.log.debug("[#maybeConvertFrameToBitmap] createImageBitmap failed",t),e}}async function XI(e){var t,n;let i=e;if(this._disposed)return void(null===(t=(n=i).close)||void 0===t||t.call(n));const r="number"==typeof e.timestamp?e.timestamp:void 0,o="number"==typeof e.timestamp?e.timestamp/tI:M(mt,this)?M(mt,this).call(this):0,s="number"==typeof e.duration?e.duration/tI:void 0;let a;void 0!==r&&(a=M(yt,this).get(r),M(yt,this).delete(r));try{var l,c,u,d;let t=M(mt,this)?M(mt,this).call(this):0,n=A(qt,this,FI).call(this,t);if(o<t||o>n)return void(null===(l=(c=i).close)||void 0===l||l.call(c));if(A(qt,this,GI).call(this)){var h,f,p,m;if(i=await A(qt,this,KI).call(this,e,o),this._disposed)return void(null===(h=(f=i).close)||void 0===h||h.call(f));if(t=M(mt,this)?M(mt,this).call(this):0,n=A(qt,this,FI).call(this,t),o<t||o>n)return void(null===(p=(m=i).close)||void 0===p||p.call(m))}if(A(qt,this,YI).call(this,t),this._disposed)return void(null===(u=(d=i).close)||void 0===u||u.call(d));const r={frame:i,pts:o,duration:s,isKey:void 0!==a&&a};M(dt,this).push(r),A(qt,this,QI).call(this),this.trigger("decoder:frame",r),A(qt,this,CI).call(this,o),this.log.debug(`[#handleDecodedFrame] [${M(Nt,this).codec}] Decoded frame:`,r)}catch(e){this.log.warn(`[#handleDecodedFrame] [${M(Nt,this).codec}] Failed to handle decoded frame`,e);try{var v,g;null===(v=(g=i).close)||void 0===v||v.call(g)}catch(e){}}}function YI(e){const t=A(qt,this,FI).call(this,e),n=[];M(dt,this).forEach((i=>{var r;const o=null!==(r=null==i?void 0:i.pts)&&void 0!==r?r:0;o<e||o>t||n.push(i)})),C(dt,this,n)}function QI(){const e=M(ft,this);if(!Number.isFinite(e)||e<=0)return;if(M(dt,this).length<=e)return;const t=M(dt,this).length-e;M(dt,this).splice(0,t)}function JI(e){const t=Number(e);return!Number.isFinite(t)||t<=0?0:Math.floor(t)}function ZI(){const e=M(ft,this);return!(!Number.isFinite(e)||e<=0)&&M(dt,this).length>=e}function eE(e){const t=Number(e);return!Number.isFinite(t)||t<=0?0:Math.floor(t)}function tE(){var e;const t=M(pt,this);if(!Number.isFinite(t)||t<=0)return!1;const n=Number(null===(e=M(_t,this))||void 0===e?void 0:e.decodeQueueSize);return!!Number.isFinite(n)&&n>=t}function nE(e){return"string"==typeof e&&e.toLowerCase().startsWith("av01")}function iE(e){var t;return!1!==this.settings.av1ColorSpaceOverrideEnabled&&A(qt,this,nE).call(this,(null===(t=M(Nt,this))||void 0===t?void 0:t.codec)||(null==e?void 0:e.codec))}function rE(e){A(qt,this,iE).call(this,e)&&(e.colorSpace={...iI})}function oE(e){if(e&&Array.isArray(e.segments))for(let t=0;t<e.segments.length;t+=1){const n=e.segments[t];if(!Array.isArray(null==n?void 0:n.representations))continue;const i=n.chosenRepresentation||n.representations[0];if(null!=i&&i.codecs)return i.codecs;if(null!=i&&i.mime)return i.mime}}class sE extends od{#q;get name(){return"DecoderFactory"}constructor(...e){super(...e);const t=e.length?e[e.length-1]:void 0;this.#q=t&&"object"==typeof t&&!Array.isArray(t)?t:{}}create(e,t=this.#q){if(!e||!e.type)return new Dx(t);const n=aI[e.type];return n?(this.log.debug(`[#create] [${e.type}] Creating decoder:`,n),new n(t)):new Dx(t)}}class aE{#V;#G;#H;#K;constructor(e={}){this.#V=e.getActiveRenderPlacement,this.#G=e.getPlacementsActiveAtTime,this.#H=e.ensureDecodedForPlacementAtTime;const t=Number(e.lookaheadSeconds);this.#K=Number.isFinite(t)&&t>=0?t:1}handleTimeUpdate(e={}){const t=Number(null==e?void 0:e.time);if(!Number.isFinite(t))return;if("function"!=typeof this.#H)return;const n="function"==typeof this.#G?this.#G:()=>[],i=n(t),r=new Set;i.forEach((e=>{null!=e&&e.placementId&&r.add(e.placementId),this.#H(e,t)}));const o=this.#K;if(!(o>0))return;const s=t+o;n(s).forEach((e=>{const t=null==e?void 0:e.placementId;t&&!r.has(t)&&this.#H(e,s)}))}dispose(){}}class lE{#X;#Y;#Q;#J;#Z;#ee;constructor(e={}){this.#X=e.getNode,this.#Y=e.getPlacementState,this.#Q=e.getDecodeTracks,this.#J=e.getSegmentIdForTrackAtTime,this.#Z=e.decodeLoadedMediaSegment,this.#ee=e.decodeLoadedMediaSegmentsAfter}ensureDecodedForPlacementAtTime(e,t){if(!e||!Number.isFinite(t))return;const n=null==e?void 0:e.placementId,i=null==e?void 0:e.nodeId;if(!n||!i)return;const r="function"==typeof this.#X?this.#X(i):void 0;if(!r)return;const o="function"==typeof this.#Y?this.#Y(n):void 0,s=null==o?void 0:o.trackStates;s&&"function"==typeof s.get&&("function"==typeof this.#Q?this.#Q(r).filter((e=>"video"===(null==e?void 0:e.type)||"image"===(null==e?void 0:e.type)||"audio"===(null==e?void 0:e.type))):[]).forEach((n=>{var i;const r=s.get(n.id);if(!r)return;const o="function"==typeof this.#J?this.#J(n,e,t):null;if(!o)return;const a=null==n||null===(i=n.segments)||void 0===i?void 0:i.find((e=>(null==e?void 0:e.id)===o));a&&!a.isInit&&a.retainedByteLength>0&&a.arrayBuffer&&(r.segmentDecoders&&"function"==typeof r.segmentDecoders.has&&r.segmentDecoders.has(o)||"function"!=typeof this.#Z||this.#Z(e,n,a),"video"===(null==n?void 0:n.type)&&"function"==typeof this.#ee&&this.#ee(e,n,a))}))}dispose(){}}const cE=new Set(["video","audio","image"]);function uE(e){const t=Number(e);return Number.isFinite(t)?t:0}var dE=new WeakMap,hE=new WeakMap,fE=new WeakMap,pE=new WeakMap,mE=new WeakMap,vE=new WeakMap,gE=new WeakMap,yE=new WeakMap,bE=new WeakMap,kE=new WeakMap,wE=new WeakMap,xE=new WeakMap,_E=new WeakMap,TE=new WeakMap,IE=new WeakMap,EE=new WeakMap,SE=new WeakMap,AE=new WeakMap,NE=new WeakMap,ME=new WeakSet;class FE extends od{constructor(...e){super(...e),O(this,ME),F(this,dE,void 0),F(this,hE,void 0),F(this,fE,void 0),F(this,pE,void 0),F(this,mE,void 0),F(this,vE,void 0),F(this,gE,void 0),F(this,yE,void 0),F(this,bE,void 0),F(this,kE,void 0),F(this,wE,void 0),F(this,xE,new Map),F(this,_E,new Map),F(this,TE,new Map),F(this,IE,new Map),F(this,EE,new Set),F(this,SE,0),F(this,AE,!1),F(this,NE,null);const[t,n,i]=e;C(dE,this,t),C(hE,this,n),C(fE,this,i||new sE),C(pE,this,new lE({getNode:e=>A(ME,this,nS).call(this,e),getPlacementState:e=>M(xE,this).get(e),getDecodeTracks:e=>A(ME,this,QE).call(this,e),getSegmentIdForTrackAtTime:(e,t,n)=>A(ME,this,zE).call(this,e,t,n),decodeLoadedMediaSegment:(e,t,n)=>{A(ME,this,xS).call(this,e,t,n)},decodeLoadedMediaSegmentsAfter:(e,t,n)=>{A(ME,this,pS).call(this,e,t,n)}})),C(mE,this,new aE({getActiveRenderPlacement:e=>{var t,n;return null===(t=M(hE,this))||void 0===t||null===(n=t.getActiveRenderPlacement)||void 0===n?void 0:n.call(t,e)},getPlacementsActiveAtTime:e=>{var t,n;return(null===(t=M(hE,this))||void 0===t||null===(n=t.getPlacementsActiveAtTime)||void 0===n?void 0:n.call(t,e))||[]},ensureDecodedForPlacementAtTime:(e,t)=>{var n,i;null===(n=M(pE,this))||void 0===n||null===(i=n.ensureDecodedForPlacementAtTime)||void 0===i||i.call(n,e,t)}})),A(ME,this,CE).call(this),A(ME,this,KE).call(this)}get name(){return"DecodeCoordinator"}onDispose(){var e,t;M(hE,this)&&"function"==typeof M(hE,this).off&&M(vE,this)&&M(hE,this).off(iv.PLACEMENT_ADDED,M(vE,this)),M(hE,this)&&"function"==typeof M(hE,this).off&&M(gE,this)&&M(hE,this).off(iv.TIMELINE_SEEKING,M(gE,this)),M(hE,this)&&"function"==typeof M(hE,this).off&&M(yE,this)&&M(hE,this).off(iv.TIMELINE_SEEKED,M(yE,this)),M(hE,this)&&"function"==typeof M(hE,this).off&&M(bE,this)&&M(hE,this).off(iv.TIMELINE_TIME_UPDATE,M(bE,this)),M(hE,this)&&"function"==typeof M(hE,this).off&&M(kE,this)&&M(hE,this).off(iv.TIMELINE_RESET,M(kE,this)),A(ME,this,OE).call(this),C(vE,this,null),C(gE,this,null),C(yE,this,null),C(bE,this,null),C(kE,this,null),null!==(e=M(pE,this))&&void 0!==e&&null!==(t=e.dispose)&&void 0!==t&&t.call(e),C(pE,this,null),M(mE,this)&&"function"==typeof M(mE,this).dispose&&M(mE,this).dispose(),C(mE,this,null),M(_E,this).forEach(((e,t)=>{const n=A(ME,this,nS).call(this,t);n&&"function"==typeof n.off&&n.off("node:loaded",e)})),M(_E,this).clear(),M(TE,this).forEach(((e,t)=>{const n=A(ME,this,nS).call(this,t);n&&"function"==typeof n.off&&n.off("segment:chunk",e)})),M(TE,this).clear(),M(IE,this).clear(),M(EE,this).clear(),A(ME,this,qE).call(this),M(xE,this).forEach((({trackStates:e})=>{e&&e.forEach((e=>{A(ME,this,sS).call(this,e)}))})),M(xE,this).clear()}}function CE(){M(hE,this)&&"function"==typeof M(hE,this).on&&(C(vE,this,(e=>{A(ME,this,XE).call(this,e)})),M(hE,this).on(iv.PLACEMENT_ADDED,M(vE,this)),C(gE,this,(e=>A(ME,this,PE).call(this,e))),M(hE,this).on(iv.TIMELINE_SEEKING,M(gE,this)),C(yE,this,(()=>A(ME,this,RE).call(this))),M(hE,this).on(iv.TIMELINE_SEEKED,M(yE,this)),C(bE,this,(e=>A(ME,this,DE).call(this,e))),M(hE,this).on(iv.TIMELINE_TIME_UPDATE,M(bE,this)),C(kE,this,(()=>A(ME,this,LE).call(this))),M(hE,this).on(iv.TIMELINE_RESET,M(kE,this))),(null==ld?void 0:ld.document)&&"function"==typeof ld.document.addEventListener&&(C(wE,this,(()=>{A(ME,this,VE).call(this)})),ld.document.addEventListener("visibilitychange",M(wE,this)))}function OE(){M(wE,this)&&null!=ld&&ld.document&&"function"==typeof ld.document.removeEventListener&&ld.document.removeEventListener("visibilitychange",M(wE,this)),C(wE,this,null)}function PE(e={}){const t=Number(null==e?void 0:e.targetTime);Number.isFinite(t)&&(M(xE,this).forEach((e=>{const n=null==e?void 0:e.trackStates;n&&n.forEach((n=>{var i;const r=null==n||null===(i=n.track)||void 0===i?void 0:i.type;"video"!==r&&"image"!==r&&"audio"!==r||(A(ME,this,BE).call(this,n,null==e?void 0:e.placement,t),n.seekSegmentId=null)}))})),(Array.isArray(null==e?void 0:e.placements)?e.placements:[]).forEach((e=>{const n=null==e?void 0:e.placementId,i=null==e?void 0:e.nodeId;if(!n||!i)return;const r=M(xE,this).get(n);if(!r||!r.trackStates)return;const o=A(ME,this,nS).call(this,i);o&&(r.trackStates.forEach((n=>{const i=null==n?void 0:n.track;!i||"video"!==i.type&&"image"!==i.type&&"audio"!==i.type||A(ME,this,BE).call(this,n,r.placement||e,t)})),A(ME,this,fS).call(this,r.placement||e,o))})))}function RE(){M(xE,this).forEach((e=>{const t=null==e?void 0:e.trackStates;t&&t.forEach((e=>{var t;const n=null==e||null===(t=e.track)||void 0===t?void 0:t.type;"video"!==n&&"image"!==n&&"audio"!==n||(e.seekSegmentId=null)}))}))}function DE(e={}){var t,n;A(ME,this,hS).call(this,null==e?void 0:e.time),null!==(t=M(mE,this))&&void 0!==t&&null!==(n=t.handleTimeUpdate)&&void 0!==n&&n.call(t,e),A(ME,this,VE).call(this),A(ME,this,aS).call(this,null==e?void 0:e.time)}function LE(){M(_E,this).forEach(((e,t)=>{const n=A(ME,this,nS).call(this,t);n&&"function"==typeof n.off&&n.off("node:loaded",e)})),M(_E,this).clear(),M(TE,this).forEach(((e,t)=>{const n=A(ME,this,nS).call(this,t);n&&"function"==typeof n.off&&n.off("segment:chunk",e)})),M(TE,this).clear(),M(IE,this).clear(),M(EE,this).clear(),M(xE,this).forEach((({trackStates:e})=>{e&&e.forEach((e=>{const t=null==e?void 0:e.segmentDecoders;t&&t.forEach((e=>{e&&"function"==typeof e.dispose&&e.dispose()}))}))})),M(xE,this).clear()}function BE(e,t,n){e&&(A(ME,this,sS).call(this,e),e.seekSegmentId=A(ME,this,zE).call(this,e.track,t,n))}function zE(e,t,n){if(!e||!t||!Array.isArray(e.segments))return null;const i=sm(t);if(!Number.isFinite(i))return null;const r=uE(null==t?void 0:t.nodeOffsetOverride),o=Math.max(0,n-i+r),s=uE(null==e?void 0:e.offset),a=Math.max(0,o-s),l="function"==typeof e.getMediaSegmentAtTime?e.getMediaSegmentAtTime(a,{preferRepresentationTime:!0}):Uy(e.segments,a,{preferRepresentationTime:!0});return(null==l?void 0:l.id)||null}function WE(e){if(!e)return!1;const t=null==e?void 0:e.name;if("QuotaExceededError"===t)return!0;if("EncodingError"===t)return!0;const n="string"==typeof(null==e?void 0:e.message)?e.message:"";return!!n.includes("Decoder failure")||!!n.includes("Codec reclaimed due to inactivity")||!("OperationError"!==t||!n.includes("initialize after flush"))}function $E(){const e=null==ld?void 0:ld.document;return!e||"string"!=typeof e.visibilityState||"visible"===e.visibilityState}function jE(){var e;const t=M(hE,this);if(!t||"number"!=typeof t.currentTime)return!1;if(t.state===hv)return!1;const n=Date.now();if(n<M(SE,this))return!1;const i=t.currentTime;if(!Number.isFinite(i))return!1;const r="function"==typeof t.getPlacementsActiveAtTime?t.getPlacementsActiveAtTime(i):[],o=Number(null==t||null===(e=t.settings)||void 0===e?void 0:e.snapToFps),s=Number.isFinite(o)&&o>0?1/o:1/60;let a;if(Array.isArray(r)&&r.length)a=i+s;else if(a=A(ME,this,UE).call(this,i),!Number.isFinite(a))return!1;return C(SE,this,n+1500),this.log.warn("[DecodeCoordinator] attempting decoder recovery seek"),t.currentTime=a,!0}function UE(e){var t;const n=M(hE,this);if(!n)return null;const i=Array.isArray(n.placements)?n.placements:[];if(!i.length)return null;const r=Number(e);if(!Number.isFinite(r))return null;const o=Number(null==n||null===(t=n.settings)||void 0===t?void 0:t.snapToFps),s=Number.isFinite(o)&&o>0?1/o:1/60;let a=Number.NEGATIVE_INFINITY,l=null,c=Number.NEGATIVE_INFINITY,u=null,d=null;return i.forEach((e=>{const t=sm(e);if(!Number.isFinite(t))return;(!Number.isFinite(d)||t<d)&&(d=t);const n=rm(e,M(dE,this)),i=Number.isFinite(n),o=i?t+n:t;(o>t||!i)&&((o>a||!Number.isFinite(a)&&Number.isFinite(o))&&(a=o,l=t),o<=r&&o>c&&(c=o,u=i?Math.max(t,o-s):t))})),Number.isFinite(l)&&Number.isFinite(a)&&r>=a-s?l:Number.isFinite(u)?u:Number.isFinite(d)?d:null}function qE(){C(AE,this,!1),C(NE,this,null)}function VE(){M(AE,this)&&A(ME,this,$E).call(this)&&A(ME,this,jE).call(this)}function GE(e){if(!A(ME,this,WE).call(this,e))return;const t=M(hE,this);t&&"number"==typeof t.currentTime&&(C(AE,this,!0),C(NE,this,e),A(ME,this,$E).call(this)&&A(ME,this,jE).call(this))}function HE(e){var t;return!!e&&(Array.isArray(null===(t=M(hE,this))||void 0===t?void 0:t.placements)?M(hE,this).placements:[]).includes(e)}function KE(e){var t;(Array.isArray(null===(t=M(hE,this))||void 0===t?void 0:t.placements)?[...M(hE,this).placements]:[]).filter((t=>"function"!=typeof e||e(t))).sort(((e,t)=>{const n=sm(e),i=sm(t);return(Number.isFinite(n)?n:Number.POSITIVE_INFINITY)-(Number.isFinite(i)?i:Number.POSITIVE_INFINITY)})).forEach((e=>{A(ME,this,XE).call(this,e)}))}async function XE(e){if(!e||!e.placementId||M(xE,this).has(e.placementId))return;if(!A(ME,this,HE).call(this,e))return;const t=e.nodeId;if(!t||!M(dE,this)||"function"!=typeof M(dE,this).get)return;const n=A(ME,this,nS).call(this,t);if(n){if(n.state&&"ready"!==n.state){if("function"==typeof n.resolve)try{await n.resolve()}catch(n){if(!A(ME,this,HE).call(this,e))return;return void this.log.warn(`[#processPlacement] Failed to resolve node ${t}`,n)}if(!A(ME,this,HE).call(this,e))return;if("ready"!==n.state)return}if(A(ME,this,dS).call(this,e))return A(ME,this,uS).call(this,e,n),void M(EE,this).add(e.placementId);A(ME,this,cS).call(this,e,n)}}function YE(e){return A(ME,this,QE).call(this,e).every((e=>A(ME,this,lS).call(this,e)))}function QE(e){return(Array.isArray(null==e?void 0:e.tracks)?e.tracks:[]).filter((e=>cE.has(null==e?void 0:e.type)))}function JE(e){if(!e||!e.id||"function"!=typeof e.on)return;if(M(_E,this).has(e.id))return;const t=()=>{A(ME,this,mS).call(this,e.id)};e.on("node:loaded",t),M(_E,this).set(e.id,t)}function ZE(e){if(!e||!e.id||"function"!=typeof e.on)return;if(M(TE,this).has(e.id))return;const t=e=>A(ME,this,vS).call(this,e);e.on("segment:chunk",t),M(TE,this).set(e.id,t)}function eS(e,t){if(!e||!t)return;const n=M(IE,this).get(e)||new Set;n.add(t),M(IE,this).set(e,n)}function tS(e){return M(IE,this).get(e)||new Set}function nS(e){if(e&&M(dE,this)&&"function"==typeof M(dE,this).get)return M(dE,this).get(e)}function iS(e){if(!e)return;const t=e.fullBufferRetryTimer;null!=t&&("function"==typeof(null==ld?void 0:ld.clearTimeout)?ld.clearTimeout.bind(ld):clearTimeout)(t),e.fullBufferRetryTimer=null,e.fullBufferDecodeScheduled=!1,e.fullBufferRetryAttempts=0}function rS(e){const t=null==e?void 0:e.segmentStates;t&&"function"==typeof t.forEach&&t.forEach((e=>{A(ME,this,iS).call(this,e)}))}function oS(e,t,n,i){var r,o;if(!(e&&t&&n&&i))return!1;const s=M(xE,this).get(e),a=null==s||null===(r=s.trackStates)||void 0===r?void 0:r.get(t);return(null==a||null===(o=a.segmentStates)||void 0===o?void 0:o.get(n))===i}function sS(e){if(!e)return;A(ME,this,rS).call(this,e);const t=e.segmentDecoders;t&&"function"==typeof t.forEach&&(t.forEach((e=>{if(e&&"function"==typeof e.dispose)try{e.dispose()}catch(e){}})),"function"==typeof t.clear&&t.clear()),e.segmentStates&&"function"==typeof e.segmentStates.clear&&e.segmentStates.clear(),e.ready=!1,e.seekSegmentId=null}function aS(e){const t=uE(e);if(!Number.isFinite(t))return;const n=t-2;Number.isFinite(n)&&M(xE,this).forEach((e=>{const t=null==e?void 0:e.placement;if(!t)return;const i=sm(t),r=rm(t,M(dE,this),{allowUnready:!0});if(!Number.isFinite(i)||!Number.isFinite(r))return;const o=i+r;if(!Number.isFinite(o)||o>n)return;const s=null==e?void 0:e.trackStates;s&&"function"==typeof s.forEach&&s.forEach((e=>{var t;const n=null==e||null===(t=e.track)||void 0===t?void 0:t.type;"video"!==n&&"image"!==n&&"audio"!==n||A(ME,this,sS).call(this,e)}))}))}function lS(e){if(!e||!Array.isArray(e.segments))return!1;const t=e.segments.find((e=>null==e?void 0:e.isInit));if(t&&!(t.retainedByteLength>0))return!1;const n=e.segments.find((e=>e&&!e.isInit));return!n||n.retainedByteLength>0}function cS(e,t){if(this.log.debug(`[#startDecode] [${e.placementId}] [${t.id}] Starting decode`),A(ME,this,uS).call(this,e,t)){if(A(ME,this,eS).call(this,t.id,e.placementId),!A(ME,this,YE).call(this,t))return A(ME,this,JE).call(this,t),void A(ME,this,ZE).call(this,t);A(ME,this,fS).call(this,e,t),A(ME,this,ZE).call(this,t)}}function uS(e,t){if(!e||!e.placementId||!t)return;const n=M(xE,this).get(e.placementId);if(n)return n.placement=e,n;const i=A(ME,this,QE).call(this,t),r=new Map;i.forEach((n=>{try{const e=n.segments.some((e=>null==e?void 0:e.isInit));r.set(n.id,{hasInit:e,track:n,ready:!1,segmentDecoders:new Map,segmentStates:new Map})}catch(i){this.trigger(iv.DECODE_ERROR,sv({placementId:e.placementId,nodeId:t.id,trackId:null==n?void 0:n.id,trackType:null==n?void 0:n.type,error:i}))}}));const o={trackStates:r,nodeId:t.id,placement:e};return M(xE,this).set(e.placementId,o),o}function dS(e){var t;const n=sm(e),i=uE(null===(t=M(hE,this))||void 0===t?void 0:t.currentTime);return!Number.isFinite(n)||!!Number.isFinite(i)&&n-i>2}function hS(e){if(!M(EE,this).size)return;const t=uE(e);if(!Number.isFinite(t))return;const n=[];M(EE,this).forEach((e=>{const i=M(xE,this).get(e),r=null==i?void 0:i.placement;if(!r)return void n.push(e);const o=sm(r);Number.isFinite(o)&&o-t<=2&&n.push(e)})),n.forEach((e=>{M(EE,this).delete(e);const t=M(xE,this).get(e),n=null==t?void 0:t.placement;if(!n)return;const i=A(ME,this,nS).call(this,n.nodeId);i&&A(ME,this,cS).call(this,n,i)}))}function fS(e,t){const n=M(xE,this).get(e.placementId);n&&A(ME,this,QE).call(this,t).forEach((i=>{const r=n.trackStates.get(i.id);if(r&&!r.ready)try{let n;if(r.seekSegmentId&&(n=i.segments.find((e=>e&&!e.isInit&&e.id===r.seekSegmentId&&e.retainedByteLength>0)),!n))return;if(n||(n=i.segments.find((e=>e&&!e.isInit&&e.retainedByteLength>0))),!n)return;A(ME,this,xS).call(this,e,i,n),r.seekSegmentId&&"video"===(null==i?void 0:i.type)&&A(ME,this,pS).call(this,e,i,n),r.ready=!0,this.trigger(iv.DECODE_READY,ov({placementId:e.placementId,nodeId:t.id,trackId:i.id,trackType:i.type}))}catch(n){this.trigger(iv.DECODE_ERROR,sv({placementId:e.placementId,nodeId:t.id,trackId:null==i?void 0:i.id,trackType:null==i?void 0:i.type,error:n}))}}))}function pS(e,t,n){var i;if(!(e&&t&&n&&Array.isArray(t.segments)))return;const r=null==e?void 0:e.placementId,o=r?M(xE,this).get(r):void 0,s=null==o||null===(i=o.trackStates)||void 0===i?void 0:i.get(t.id),a=null==s?void 0:s.segmentDecoders;if(!a||"function"!=typeof a.has)return;const l=t.segments,c=l.findIndex((e=>(null==e?void 0:e.id)===n.id));if(c<0)return;let u=0;for(let n=c+1;n<l.length;n+=1){const i=l[n];if(!i||i.isInit)continue;if(a.has(i.id))continue;if(!(i.retainedByteLength>0))break;const r=i.arrayBuffer;if(!r||"number"!=typeof r.byteLength||r.byteLength<=0)break;if(A(ME,this,xS).call(this,e,t,i),u+=1,u>=2)break}}function mS(e){const t=A(ME,this,nS).call(this,e);t&&A(ME,this,YE).call(this,t)&&A(ME,this,tS).call(this,e).forEach((e=>{const n=M(xE,this).get(e);A(ME,this,fS).call(this,(null==n?void 0:n.placement)||{placementId:e},t)}))}function vS(e){e&&e.nodeId&&e.trackId&&e.chunk&&A(ME,this,tS).call(this,e.nodeId).forEach((t=>A(ME,this,gS).call(this,t,e)))}function gS(e,t){const n=M(xE,this).get(e);if(!n)return;const i=n.trackStates.get(t.trackId);if(i)try{var r,o;if(t.isInit)return;const s=i.track,a=null==s||null===(r=s.segments)||void 0===r?void 0:r.find((e=>(null==e?void 0:e.id)===t.segmentId));if(!a||a.isInit)return;if("image"===(null==s?void 0:s.type))return void(!i.ready&&a.retainedByteLength>0&&A(ME,this,xS).call(this,n.placement,s,a)&&(i.ready=!0,this.trigger(iv.DECODE_READY,ov({placementId:e,nodeId:t.nodeId,trackId:t.trackId,trackType:t.trackType}))));if((null===(o=M(hE,this))||void 0===o?void 0:o.state)===hv&&i.seekSegmentId&&("video"===(null==s?void 0:s.type)||"audio"===(null==s?void 0:s.type))&&a.id!==i.seekSegmentId)return;const l=a.id,c=i.segmentStates.get(l)||{initSent:!1,pendingChunks:[],ended:!1,firstChunkObserved:!1,missedSegmentPrefix:!1,fullBufferDecodeScheduled:!1,fullBufferRetryTimer:null,fullBufferRetryAttempts:0};i.segmentStates.set(l,c);const u=A(ME,this,kS).call(this,n.placement,s,a);if(!u||"function"!=typeof u.decodeChunk)return;if(i.hasInit&&!c.initSent){const e=A(ME,this,wS).call(this,s,a);if(!e)return void c.pendingChunks.push({chunk:t.chunk,loaded:t.loaded,total:t.total});u.decodeChunk(e,{isInit:!0}),c.initSent=!0,c.pendingChunks.length&&(c.pendingChunks.forEach((e=>{u.decodeChunk(e.chunk,{isInit:!1,loaded:e.loaded,total:e.total})})),c.pendingChunks=[])}const d="number"==typeof t.loaded&&"number"==typeof t.total&&t.total>0&&t.loaded>=t.total;A(ME,this,yS).call(this,c,t)?d&&!c.ended&&A(ME,this,bS).call(this,n.placement,s,a,c):(u.decodeChunk(t.chunk,{isInit:!1,loaded:t.loaded,total:t.total}),d&&!c.ended&&"function"==typeof u.endOfStream&&(c.ended=!0,u.endOfStream())),i.ready||(i.ready=!0,this.trigger(iv.DECODE_READY,ov({placementId:e,nodeId:t.nodeId,trackId:t.trackId,trackType:t.trackType})))}catch(n){this.trigger(iv.DECODE_ERROR,sv({placementId:e,nodeId:t.nodeId,trackId:t.trackId,trackType:t.trackType,error:n}))}}function yS(e,t){var n;if(!e||e.missedSegmentPrefix)return!(null==e||!e.missedSegmentPrefix);if(e.firstChunkObserved)return!1;e.firstChunkObserved=!0;const i=Number(null==t?void 0:t.loaded),r=Number(null==t||null===(n=t.chunk)||void 0===n?void 0:n.byteLength);return!(!Number.isFinite(i)||!Number.isFinite(r)||r<=0)&&(e.missedSegmentPrefix=i>r,e.missedSegmentPrefix)}function bS(e,t,n,i){if(!e||!t||!n||!i||i.fullBufferDecodeScheduled)return;const r=null==e?void 0:e.placementId,o=null==t?void 0:t.id,s=null==n?void 0:n.id;if(!r||!o||!s)return;const a="function"==typeof(null==ld?void 0:ld.setTimeout)?ld.setTimeout.bind(ld):setTimeout;i.fullBufferDecodeScheduled=!0,i.fullBufferRetryAttempts=0;const l=()=>{if(!A(ME,this,oS).call(this,r,o,s,i)||i.ended)return void A(ME,this,iS).call(this,i);if(A(ME,this,xS).call(this,e,t,n))return void A(ME,this,iS).call(this,i);i.fullBufferRetryAttempts+=1;const c=i.fullBufferRetryAttempts<=8?0:50;i.fullBufferRetryTimer=a((()=>{l()}),c)};i.fullBufferRetryTimer=a((()=>{l()}),0)}function kS(e,t,n){var i,r;const o=null==e?void 0:e.placementId;if(!o||!t||!n)return;const s=M(xE,this).get(o),a=null==s||null===(i=s.trackStates)||void 0===i?void 0:i.get(t.id);if(!a)return;const l=a.segmentDecoders.get(n.id);if(l)return l;const c=M(fE,this).create(t);if(c&&"function"==typeof c.configure&&c.configure(t),c&&"function"==typeof c.setNodeId&&c.setNodeId(null==e?void 0:e.nodeId),c&&"function"==typeof c.setSegment&&c.setSegment(n),c&&"function"==typeof c.setCurrentTimeProvider&&c.setCurrentTimeProvider((()=>{var e;return"number"==typeof(null===(e=M(hE,this))||void 0===e?void 0:e.currentTime)?M(hE,this).currentTime:0})),c&&"function"==typeof c.setTimeOffsetSeconds){var u,d;const i=sm(e),r=uE(null==t?void 0:t.offset),o=uE(null!==(u=null==n||null===(d=n.chosenRepresentation)||void 0===d?void 0:d.segStart)&&void 0!==u?u:null==n?void 0:n.offset);Number.isFinite(i)&&c.setTimeOffsetSeconds(i+r+o)}return c&&"function"==typeof c.setSeekTargetTimeSeconds&&(null===(r=M(hE,this))||void 0===r?void 0:r.state)===hv&&"video"===(null==t?void 0:t.type)&&c.setSeekTargetTimeSeconds(M(hE,this).currentTime),c&&"function"==typeof c.on&&(c.on(iv.DECODER_FRAME,(i=>{i&&(!M(AE,this)||"video"!==(null==t?void 0:t.type)&&"image"!==(null==t?void 0:t.type)||(C(AE,this,!1),C(NE,this,null)),M(hE,this)&&"function"==typeof M(hE,this).notifyDecodedFrame&&(i.frame||i.data)&&M(hE,this).notifyDecodedFrame({placementId:o,nodeId:null==e?void 0:e.nodeId,trackId:null==t?void 0:t.id,trackType:null==t?void 0:t.type,segmentId:null==n?void 0:n.id,pts:i.pts,duration:i.duration,frame:i.frame,data:i.data}))})),c.on(iv.DECODER_AUDIO,(i=>{i&&i.audioBuffer&&this.trigger(iv.DECODER_AUDIO,ov({placementId:o,nodeId:null==e?void 0:e.nodeId,trackId:null==t?void 0:t.id,trackType:null==t?void 0:t.type,segmentId:null==n?void 0:n.id,pts:i.pts,duration:i.duration,audioBuffer:i.audioBuffer}))})),c.on(iv.DECODER_ERROR,(i=>{const r=(null==i?void 0:i.error)||i;this.trigger(iv.DECODER_ERROR,sv({placementId:o,nodeId:null==e?void 0:e.nodeId,trackId:null==t?void 0:t.id,trackType:null==t?void 0:t.type,segmentId:null==n?void 0:n.id,error:r})),A(ME,this,GE).call(this,r)}))),a.segmentDecoders.set(n.id,c),c}function wS(e,t){var n,i;if(!e||!t||!Array.isArray(e.segments))return;const r=e.segments.find((e=>null==e?void 0:e.isInit));if(!r||"function"!=typeof r.getRepresentationBuffer)return;const o=(null==t||null===(n=t.chosenRepresentation)||void 0===n?void 0:n.id)||(null==t||null===(i=t.representations)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.id);if(!o)return;const s=r.getRepresentationBuffer(o);return s?s instanceof Uint8Array?s:new Uint8Array(s):void 0}function xS(e,t,n){var i;if(!e||!t||!n)return!1;const r=e.placementId,o=M(xE,this).get(r),s=null==o||null===(i=o.trackStates)||void 0===i?void 0:i.get(t.id);if(!s)return!1;const a=A(ME,this,kS).call(this,e,t,n);if(!a||"function"!=typeof a.decodeChunk)return!1;const l=s.segmentStates.get(n.id)||{initSent:!1,pendingChunks:[],ended:!1,firstChunkObserved:!1,missedSegmentPrefix:!1,fullBufferDecodeScheduled:!1,fullBufferRetryTimer:null,fullBufferRetryAttempts:0};if(s.segmentStates.set(n.id,l),l.ended)return A(ME,this,iS).call(this,l),!0;if(s.hasInit&&!l.initSent){const e=A(ME,this,wS).call(this,t,n);if(!e)return!1;a.decodeChunk(e,{isInit:!0}),l.initSent=!0}const c=n.arrayBuffer;return!(!c||"number"!=typeof c.byteLength||c.byteLength<=0||(a.decodeChunk(new Uint8Array(c),{isInit:!1,loaded:c.byteLength,total:c.byteLength}),l.ended||"function"!=typeof a.endOfStream||(l.ended=!0,a.endOfStream()),A(ME,this,iS).call(this,l),0))}const _S=1e-6;var TS=new WeakMap,IS=new WeakMap,ES=new WeakMap,SS=new WeakMap,AS=new WeakMap,NS=new WeakMap,MS=new WeakMap,FS=new WeakMap,CS=new WeakSet;class OS extends od{get name(){return"TransitionManager"}get defaults(){return{durationSeconds:.5}}constructor(e,t,n){super(n),O(this,CS),F(this,TS,void 0),F(this,IS,void 0),F(this,ES,null),F(this,SS,null),F(this,AS,null),F(this,NS,0),F(this,MS,[]),F(this,FS,null),C(TS,this,e),C(IS,this,t),M(TS,this)&&"function"==typeof M(TS,this).on&&(C(FS,this,(()=>A(CS,this,jS).call(this))),M(TS,this).on(iv.TIMELINE_RESET,M(FS,this)))}transitionTo(e,t={}){const n=Number(e);if(!Number.isFinite(n))throw new Error("TransitionManager.transitionTo requires a numeric time");A(CS,this,jS).call(this);const i=A(CS,this,PS).call(this),r=A(CS,this,BS).call(this,n,t);return r?A(CS,this,zS).call(this,n,t,i,r):Promise.resolve()}onDispose(){M(TS,this)&&"function"==typeof M(TS,this).off&&M(FS,this)&&M(TS,this).off(iv.TIMELINE_RESET,M(FS,this)),C(FS,this,null),A(CS,this,jS).call(this),C(IS,this,null),C(TS,this,null)}}function PS(){return C(NS,this,M(NS,this)+1),M(NS,this)}function RS(e={}){var t;const n=Number(null==e?void 0:e.duration),i=Number(null===(t=this.settings)||void 0===t?void 0:t.durationSeconds);return Number.isFinite(n)?n:i}function DS(e={},t){return{duration:t,filter:null==e?void 0:e.filter,color:null==e?void 0:e.color,filters:null==e?void 0:e.filters,reverseFilters:null==e?void 0:e.reverseFilters,transition:null==e?void 0:e.transition}}function LS(e,t){const n=1e3*e,i=Number.isFinite(Number(null==t?void 0:t.outDurationMs))&&t.outDurationMs>0?t.outDurationMs:n;return{outDurationMs:i,inDurationMs:Number.isFinite(Number(null==t?void 0:t.inDurationMs))&&t.inDurationMs>0?t.inDurationMs:i}}function BS(e,t={}){var n;const i=M(IS,this),r=A(CS,this,RS).call(this,t);if(!i||"function"!=typeof i.startTransition)return M(TS,this).currentTime=e,null;if(!(r>0))return M(TS,this).currentTime=e,null!==(n=i.resetTransition)&&void 0!==n&&n.call(i),null;const o=A(CS,this,DS).call(this,t,r);"function"==typeof(null==t?void 0:t.onTransitionInStart)&&t.onTransitionInStart();const s=i.startTransition(o),{outDurationMs:a,inDurationMs:l}=A(CS,this,LS).call(this,r,s);return{renderer:i,transitionOptions:o,outDurationMs:a,inDurationMs:l,shouldWaitForFrames:!1!==(null==t?void 0:t.waitForVisualFrames)}}function zS(e,t={},n,i){const{renderer:r,transitionOptions:o,outDurationMs:s,inDurationMs:a,shouldWaitForFrames:l}=i,c=A(CS,this,HS).call(this,e,t,n),u=l?A(CS,this,KS).call(this,e,n):Promise.resolve();let d=!1,h=!1,f=!1,p=!l;const m=()=>{var e;A(CS,this,US).call(this,n)&&!f&&d&&h&&p&&(f=!0,"function"==typeof(null==t?void 0:t.onTransitionInEnd)&&t.onTransitionInEnd(),"function"==typeof(null==t?void 0:t.onTransitionOutStart)&&t.onTransitionOutStart(),null!==(e=r.beginTransitionIn)&&void 0!==e&&e.call(r,o),C(SS,this,setTimeout((()=>{var e;A(CS,this,US).call(this,n)&&(null!==(e=r.resetTransition)&&void 0!==e&&e.call(r),"function"==typeof(null==t?void 0:t.onTransitionOutEnd)&&t.onTransitionOutEnd(),A(CS,this,WS).call(this))}),a)))};return C(ES,this,setTimeout((()=>{d=!0,m()}),s)),c.then((()=>{h=!0,m()})).catch((()=>{var e;A(CS,this,US).call(this,n)&&(null!==(e=r.resetTransition)&&void 0!==e&&e.call(r),A(CS,this,WS).call(this))})),u.then((()=>{p=!0,m()})).catch((()=>{p=!0,m()})),M(TS,this).currentTime=e,new Promise((e=>{C(AS,this,e)}))}function WS(){const e=M(AS,this);C(AS,this,null),A(CS,this,$S).call(this),A(CS,this,GS).call(this),e&&e()}function $S(){M(ES,this)&&clearTimeout(M(ES,this)),M(SS,this)&&clearTimeout(M(SS,this)),C(ES,this,null),C(SS,this,null)}function jS(){var e,t;M(IS,this)&&null!==(e=(t=M(IS,this)).resetTransition)&&void 0!==e&&e.call(t),A(CS,this,$S).call(this),A(CS,this,GS).call(this),M(AS,this)&&(M(AS,this).call(this),C(AS,this,null))}function US(e){return M(NS,this)===e}function qS(e,t){M(TS,this)&&"function"==typeof M(TS,this).on&&(M(TS,this).on(e,t),M(MS,this).push({eventName:e,handler:t}))}function VS(e,t){M(TS,this)&&"function"==typeof M(TS,this).off&&(M(TS,this).off(e,t),C(MS,this,M(MS,this).filter((n=>n.eventName!==e||n.handler!==t))))}function GS(){M(TS,this)&&"function"==typeof M(TS,this).off?(M(MS,this).forEach((e=>{M(TS,this).off(e.eventName,e.handler)})),C(MS,this,[])):C(MS,this,[])}function HS(e,t,n){const i=null==t?void 0:t.transitionOutPromise;if(i&&"function"==typeof i.then)return i;if("function"==typeof i)try{const e=i();if(e&&"function"==typeof e.then)return e}catch(e){return Promise.resolve()}if(!M(TS,this)||"function"!=typeof M(TS,this).on)return Promise.resolve();const r=A(CS,this,XS).call(this);return new Promise((t=>{let i=!1;const o=r?iv.TIMELINE_SEEKED:"nodestart";let s,a;const l=()=>{A(CS,this,VS).call(this,iv.TIMELINE_SEEKING,s),A(CS,this,VS).call(this,o,a),t()};s=(t={})=>{A(CS,this,US).call(this,n)?A(CS,this,YS).call(this,t,e)&&(i=!0):l()},a=(t={})=>{A(CS,this,US).call(this,n)?(o!==iv.TIMELINE_SEEKED||A(CS,this,YS).call(this,t,e))&&(o===iv.TIMELINE_SEEKED||i)&&l():l()},A(CS,this,qS).call(this,iv.TIMELINE_SEEKING,s),A(CS,this,qS).call(this,o,a)}))}function KS(e,t){if(!M(TS,this)||"function"!=typeof M(TS,this).on)return Promise.resolve();const n=Number(e);return new Promise((e=>{const i=(r={})=>{if(!A(CS,this,US).call(this,t))return A(CS,this,VS).call(this,iv.VISUAL_FRAMES_AVAILABLE,i),void e();const o=Number(null==r?void 0:r.time);Number.isFinite(n)&&Number.isFinite(o)&&o+_S<n||(Array.isArray(null==r?void 0:r.frames)?r.frames:[]).length&&(A(CS,this,VS).call(this,iv.VISUAL_FRAMES_AVAILABLE,i),e())};A(CS,this,qS).call(this,iv.VISUAL_FRAMES_AVAILABLE,i)}))}function XS(){var e,t;const n=null===(e=M(TS,this))||void 0===e?void 0:e.state;if(n===dv||n===av)return!0;const i=null===(t=M(TS,this))||void 0===t?void 0:t.placements;return!Array.isArray(i)||0===i.length}function YS(e,t){const n=Number(null==e?void 0:e.targetTime);return!Number.isFinite(n)||Math.abs(n-t)<_S}function QS(e,t=0){const n=Number(e);return Number.isFinite(n)?n:t}var JS=new WeakMap,ZS=new WeakMap,eA=new WeakMap,tA=new WeakMap,nA=new WeakMap,iA=new WeakMap,rA=new WeakMap,oA=new WeakMap,sA=new WeakMap,aA=new WeakMap,lA=new WeakMap,cA=new WeakMap,uA=new WeakMap,dA=new WeakMap,hA=new WeakSet;class fA extends od{get name(){return"AudioPlaybackManager"}get defaults(){return{muted:!1,volume:1,lookaheadSeconds:1}}constructor(e,t,n){super(n),O(this,hA),F(this,JS,void 0),F(this,ZS,void 0),F(this,eA,null),F(this,tA,null),F(this,nA,[]),F(this,iA,new Set),F(this,rA,new Map),F(this,oA,!1),F(this,sA,1),F(this,aA,!0),F(this,lA,null),F(this,cA,null),F(this,uA,null),F(this,dA,null),C(JS,this,e),C(ZS,this,t),C(oA,this,!!this.settings.muted),C(sA,this,nm(this.settings.volume));const i=Array.isArray(null==n?void 0:n.disabledTracks)?n.disabledTracks:[];C(aA,this,!i.includes("audio")),A(hA,this,pA).call(this)}get muted(){return M(oA,this)}set muted(e){C(oA,this,!!e),A(hA,this,IA).call(this)}get volume(){return M(sA,this)}set volume(e){C(sA,this,nm(e)),A(hA,this,IA).call(this)}handleDecodedAudio(e={}){if(!M(aA,this))return;const t=null==e?void 0:e.audioBuffer,n=null==e?void 0:e.placementId,i=null==e?void 0:e.segmentId,r=QS(null==e?void 0:e.pts,null);if(!(t&&n&&i&&Number.isFinite(r)))return;const o=Number.isFinite(null==e?void 0:e.duration)?e.duration:t.duration,s=`${n}:${i}`;M(iA,this).has(s)||(M(nA,this).push({key:s,placementId:n,pts:r,duration:o,audioBuffer:t}),M(nA,this).sort(((e,t)=>e.pts-t.pts)),A(hA,this,bA).call(this))}onDispose(){A(hA,this,mA).call(this),A(hA,this,_A).call(this,!0),M(eA,this)&&"function"==typeof M(eA,this).close&&M(eA,this).close(),C(eA,this,null),C(tA,this,null),C(JS,this,null),C(ZS,this,null)}}function pA(){M(JS,this)&&"function"==typeof M(JS,this).on&&(C(lA,this,(e=>A(hA,this,vA).call(this,e))),M(JS,this).on(iv.TIMELINE_TIME_UPDATE,M(lA,this)),C(cA,this,(e=>A(hA,this,gA).call(this,e))),M(JS,this).on(iv.TIMELINE_STATE_CHANGE,M(cA,this)),C(dA,this,(()=>A(hA,this,yA).call(this))),M(JS,this).on(iv.TIMELINE_RESET,M(dA,this))),M(ZS,this)&&"function"==typeof M(ZS,this).on&&(C(uA,this,(e=>this.handleDecodedAudio(e))),M(ZS,this).on(iv.DECODER_AUDIO,M(uA,this)))}function mA(){M(JS,this)&&"function"==typeof M(JS,this).off&&(M(lA,this)&&M(JS,this).off(iv.TIMELINE_TIME_UPDATE,M(lA,this)),M(cA,this)&&M(JS,this).off(iv.TIMELINE_STATE_CHANGE,M(cA,this)),M(dA,this)&&M(JS,this).off(iv.TIMELINE_RESET,M(dA,this))),M(ZS,this)&&"function"==typeof M(ZS,this).off&&M(uA,this)&&M(ZS,this).off(iv.DECODER_AUDIO,M(uA,this)),C(lA,this,null),C(cA,this,null),C(uA,this,null),C(dA,this,null)}function vA(){A(hA,this,bA).call(this)}function gA(e={}){const t=null==e?void 0:e.to;if(t)return t===lv?(A(hA,this,EA).call(this),void A(hA,this,bA).call(this)):void(t!==dv&&t!==uv?t!==hv&&t!==fv||A(hA,this,yA).call(this):A(hA,this,SA).call(this))}function yA(){A(hA,this,SA).call(this),A(hA,this,_A).call(this,!0),C(nA,this,[])}function bA(){if(!M(aA,this)||!M(JS,this))return;if(M(JS,this).state!==lv)return;const e=A(hA,this,TA).call(this);if(!e)return;const t=QS(M(JS,this).currentTime,0),n=t+Math.max(0,QS(this.settings.lookaheadSeconds,1)),i=[];for(let r=0;r<M(nA,this).length;r+=1){const o=M(nA,this)[r];o&&(o.pts>n?i.push(o):A(hA,this,kA).call(this,o)&&A(hA,this,xA).call(this,o,e,t))}C(nA,this,i)}function kA(e){if(!e||!M(JS,this))return!1;const t=A(hA,this,wA).call(this,e.pts);return!(!t||t!==e.placementId)}function wA(e){if(!M(JS,this)||"function"!=typeof M(JS,this).getPlacementsActiveAtTime)return null;const t=M(JS,this).getPlacementsActiveAtTime(e);if(!Array.isArray(t)||!t.length)return null;const n=t.find((e=>null==e?void 0:e.placementId));return n?n.placementId:null}function xA(e,t,n){const i=e.key;if(M(iA,this).has(i))return;const r=e.audioBuffer;if(!r)return;const o=Number.isFinite(e.duration)?e.duration:r.duration,s=e.pts;if(!Number.isFinite(s))return;const a=n-s;if(Number.isFinite(o)&&o>0&&a>=o)return;const l=t.createBufferSource();l.buffer=r,l.connect(M(tA,this));let c=t.currentTime,u=0;a>0?u=a:a<0&&(c=t.currentTime+Math.abs(a));try{l.start(c,u)}catch(e){return void this.log.warn("[AudioPlaybackManager] Failed to start audio buffer",e)}M(iA,this).add(i),M(rA,this).set(i,l),l.onended=()=>{M(rA,this).delete(i)}}function _A(e){M(rA,this).forEach(((e,t)=>{if(e&&"function"==typeof e.stop)try{e.stop()}catch(e){}M(rA,this).delete(t)})),e&&M(iA,this).clear()}function TA(){if(M(eA,this))return M(eA,this);const e=ld.AudioContext||ld.webkitAudioContext;if(!e)return this.log.warn("[AudioPlaybackManager] AudioContext is not available."),null;try{return C(eA,this,new e),C(tA,this,M(eA,this).createGain()),M(tA,this).connect(M(eA,this).destination),A(hA,this,IA).call(this),M(eA,this)}catch(e){return this.log.warn("[AudioPlaybackManager] Failed to initialize AudioContext",e),C(eA,this,null),C(tA,this,null),null}}function IA(){if(!M(tA,this))return;const e=M(oA,this)?0:M(sA,this);M(tA,this).gain.value=e}function EA(){M(eA,this)&&"function"==typeof M(eA,this).resume&&"suspended"===M(eA,this).state&&M(eA,this).resume().catch((()=>{}))}function SA(){M(eA,this)&&"function"==typeof M(eA,this).suspend&&"running"===M(eA,this).state&&M(eA,this).suspend().catch((()=>{}))}var AA=new WeakMap,NA=new WeakMap,MA=new WeakMap,FA=new WeakMap,CA=new WeakMap,OA=new WeakSet;class PA extends od{constructor(...e){super(...e),O(this,OA),F(this,AA,void 0),F(this,NA,void 0),F(this,MA,void 0),F(this,FA,void 0),F(this,CA,void 0),C(AA,this,A(OA,this,DA).call(this,this.settings.currentTime)),C(NA,this,A(OA,this,LA).call(this,this.settings.playbackRate)),C(MA,this,null),C(FA,this,!1),C(CA,this,A(OA,this,RA).bind(this))}get name(){return"PlaybackClock"}get defaults(){return{currentTime:0,playbackRate:xy("playbackRate")}}get currentTime(){return M(AA,this)}get playbackRate(){return M(NA,this)}set playbackRate(e){C(NA,this,A(OA,this,LA).call(this,e))}play(){M(FA,this)||(C(FA,this,!0),C(MA,this,oy()),jk(M(CA,this),0))}pause(){M(FA,this)&&(C(FA,this,!1),Uk(M(CA,this)))}seek(e){C(AA,this,A(OA,this,DA).call(this,e)),C(MA,this,oy())}reset(){this.pause(),C(AA,this,0),C(MA,this,null)}onDispose(){this.pause(),C(CA,this,null)}}function RA(){const e=oy();if(null===M(MA,this))return C(MA,this,e),void this.trigger(iv.CLOCK_TICK,{currentTime:M(AA,this)});const t=e-M(MA,this);C(MA,this,e);const n=t/1e3;C(AA,this,M(AA,this)+n*M(NA,this)),this.trigger(iv.CLOCK_TICK,{currentTime:M(AA,this)})}function DA(e){return"number"!=typeof e||Number.isNaN(e)||!Number.isFinite(e)||e<0?0:e}function LA(e){return"number"!=typeof e||Number.isNaN(e)||!Number.isFinite(e)||e<=0?M(NA,this)||1:e}var BA=new WeakMap,zA=new WeakSet;class WA extends od{constructor(...e){super(...e),O(this,zA),F(this,BA,new Map)}get name(){return"TrackBuffers"}get defaults(){return{}}refreshNode(e){if(!e||!Array.isArray(e.tracks))return;const t=e.id,n=M(BA,this).get(t)||new Map;M(BA,this).set(t,n),e.tracks.forEach((e=>{const i=null==e?void 0:e.type;if(!i)return;const r=e.buffered,o=n.get(i),s=!!o&&o.ready,a=(l=r)&&Number.isFinite(l.start)&&Number.isFinite(l.end)&&l.end>l.start;var l,c,u;u=r,!(c=null==o?void 0:o.range)&&!u||c&&u&&c.start===u.start&&c.end===u.end?o&&o.ready!==a&&n.set(i,{range:r,ready:a}):(n.set(i,{range:r,ready:a}),this.trigger(iv.TRACK_BUFFER_UPDATE,{nodeId:t,trackType:i,range:r})),!s&&a?this.trigger(iv.TRACK_READY,{nodeId:t,trackType:i,range:r}):s&&!a&&this.trigger(iv.TRACK_UNDERFLOW,{nodeId:t,trackType:i,range:r})}))}getTrackRange(e,t){const n=M(BA,this).get(e),i=null==n?void 0:n.get(t);return null==i?void 0:i.range}computeBuffered(e=[],t=0,n){if(!n||"function"!=typeof n.get)return;const i=Number.isFinite(t)?t:0;let r,o,s=!1;for(let t=0;t<e.length;t+=1){const a=A(zA,this,jA).call(this,n,e[t],i);if(!a||a.end<=i)continue;if(void 0===r){r=a.start,o=a.end,s=a.full;continue}const l=a.start<=o,c=s&&a.full;if(!l&&!c)break;o=Math.max(o,a.end),s=a.full}return void 0===r||void 0===o?{start:0,end:0}:{start:r,end:o}}get buffered(){return M(BA,this)}reset(){M(BA,this).clear()}onDispose(){M(BA,this).clear(),"function"==typeof this.off&&this.off()}}function $A(e,t=0){const n=Array.isArray(null==e?void 0:e.segments)?e.segments:[],i=[];for(let e=0;e<n.length;e+=1){const t=n[e];if(!t||t.isInit)continue;const r=Number(t.duration),o=Number(t.offset),s=Number(t.bufferedRatio);if(!Number.isFinite(r)||r<=0||!Number.isFinite(o)||s<=0)continue;const a=o+r*Math.min(1,s);!Number.isFinite(a)||a<=o||i.push({start:o,end:a})}if(!i.length)return;i.sort(((e,t)=>e.start-t.start));const r=[i[0]];for(let e=1;e<i.length;e+=1){const t=i[e],n=r[r.length-1];t.start<=n.end+.001?n.end=Math.max(n.end,t.end):r.push({...t})}const o=Number.isFinite(t)?t:0;for(let e=0;e<r.length;e+=1){const t=r[e];if(t.end>o+.001)return t}}function jA(e,t,n=0){var i,r;const o=sm(t);if(!Number.isFinite(o))return;const s=e.get(t.nodeId);if(!s)return;const a=Array.isArray(s.tracks)?s.tracks:[];if(!a.length){const e=s.buffered;if(!e||!Number.isFinite(e.start)||!Number.isFinite(e.end))return;return A(zA,this,UA).call(this,s,e,o,t)}const l=s.mainTrackId,c=Number.isFinite(t.nodeOffsetOverride)?t.nodeOffsetOverride:0,u=Math.max(0,n-o+c);let d;l&&(d=a.find((e=>(null==e?void 0:e.id)===l))),(null===(i=d)||void 0===i?void 0:i.type)||(d=a.find((e=>null==e?void 0:e.type)));const h=A(zA,this,$A).call(this,d,u)||(null===(r=d)||void 0===r?void 0:r.buffered);return h&&Number.isFinite(h.start)&&Number.isFinite(h.end)?A(zA,this,UA).call(this,s,h,o,t):void 0}function UA(e,t,n,i){const r=Number.isFinite(i.nodeOffsetOverride)?i.nodeOffsetOverride:0;let o=t.start-r+n,s=t.end-r+n;const a=e.duration,l=Number.isFinite(i.nodeDurationOverride)?i.nodeDurationOverride:a;if(Number.isFinite(l)){const e=n+l;s=Math.min(s,e);const t=o<=n&&s>=e;if(o=Math.max(o,n),!(s>o))return;return{start:o,end:s,full:t}}if(o=Math.max(o,n),s>o)return{start:o,end:s,full:!1}}class qA{constructor(e={}){const{placementId:t,nodeId:n,offset:i,offsetPending:r=!1,offsetAnchorPlacementId:o,offsetEndSeconds:s,offsetAnchorEdge:a,offsetAnchorIsReference:l,nodeOffsetOverride:c,nodeDurationOverride:u,loop:d=!1,loopRootPlacementId:h,loopRootOffset:f}=e;if(!t)throw new Error("Placement requires placementId");if(!n)throw new Error("Placement requires nodeId");this.placementId=t,this.nodeId=n;const p=Number.isFinite(i)?i:0;this.offsetPending=!0===r,this.offsetAnchorPlacementId=o,this.offsetAnchorEdge=a,this.offsetAnchorIsReference=l,this.offsetEndSeconds=Number.isFinite(s)?s:void 0,this.offset=this.offsetPending?void 0:p,this.nodeOffsetOverride=c,this.nodeDurationOverride=u,this.loop=!0===d,this.loopRootPlacementId=h,this.loopRootOffset=f}}class VA extends od{constructor(e,t){super(t),this.timeline=e}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"handleDecodedFrame","handleClockTick","handleMainTrackBufferUpdate"])}enter(){}exit(){}play(){this.timeline.transitionTo(lv)}pause(){this.timeline.transitionTo(dv)}wait(){this.timeline.transitionTo(uv)}reset(){this.timeline.transitionTo(fv)}seek(e){this.timeline.transitionTo(hv,{targetTime:e,returnState:this.timeline.state})}getCurrentTime(){return this.timeline.currentTime}emitPlayerStateEvent(e,t={}){if(!e||!this.timeline||"function"!=typeof this.timeline.trigger)return;const n=Number.isFinite(null==t?void 0:t.time)?t.time:this.getCurrentTime(),i={...t,event:e};Number.isFinite(n)&&(i.time=n),this.timeline.trigger("player:state",i)}get buffered(){return this.timeline.computeBuffered(this.timeline.currentTime)}handleMainTrackUnderflow(e){this.wait()}handleMainTrackReady(e){const t=this.timeline.getLastStableState()||dv;this.timeline.transitionTo(t)}handleMainTrackBufferUpdate(e){}handleDecodedFrame(e){}handleClockTick(e){}onDispose(){this.timeline=null}}const GA=24e3/1001;function HA(e,t=(null==e?void 0:e.currentTime)){return Number.isFinite(t)?t:Number.isFinite(null==e?void 0:e.currentTime)?e.currentTime:0}function KA(e){var t;const n=Number(null==e||null===(t=e.settings)||void 0===t?void 0:t.snapToFps);return Number.isFinite(n)&&n>0?.5/n:.001}function XA(e){var t;const n=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[];let i;if(null!=e&&e.mainTrackId){const t=n.find((t=>(null==t?void 0:t.id)===e.mainTrackId));i=null==t?void 0:t.type}if(i||(i=null===(t=n.find((e=>null==e?void 0:e.type)))||void 0===t?void 0:t.type),"video"===i||"audio"===i||"image"===i)return i}function YA(e){const t=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[];if(t.length){if(null!=e&&e.mainTrackId){const n=t.find((t=>(null==t?void 0:t.id)===e.mainTrackId));if("video"===(null==n?void 0:n.type)||"image"===(null==n?void 0:n.type))return n}return t.find((e=>"video"===(null==e?void 0:e.type)||"image"===(null==e?void 0:e.type)))}}function QA(e,t,n,i,r){var o,s;const a="function"==typeof(null==e?void 0:e.getDecodedVisualBuffer)?e.getDecodedVisualBuffer(t,n):void 0;if(!a)return"function"==typeof(null==e?void 0:e.hasDecodedFirstFrame)&&e.hasDecodedFirstFrame(t,i);const l=Array.isArray(a.frames)?a.frames:[];let c,u=Number.isFinite(null===(o=a.current)||void 0===o?void 0:o.presentationTime)?a.current:void 0;for(let e=0;e<l.length;e+=1){const t=l[e],n=Number(null==t?void 0:t.presentationTime);if(Number.isFinite(n)){if(!(n<=r)){c=n;break}u=t}}const d=Number(null===(s=u)||void 0===s?void 0:s.presentationTime);if(!Number.isFinite(d)||d>r)return!1;const h=function(e,t,n,i){const r=Number(null==n?void 0:n.duration);if(Number.isFinite(r)&&r>0)return t+r;const o=function(e,t){const n=Number(null==e||null===(t=e.settings)||void 0===t?void 0:t.snapToFps);return 2/(Number.isFinite(n)&&n>0?n:GA)}(e),s=Number.isFinite(i)&&i>t?i-t:o;return t+Math.min(s,o)}(e,d,u,c);return!!Number.isFinite(h)&&r<=h+KA(e)}function JA(e,t=(null==e?void 0:e.currentTime)){const n=HA(e,t),i="function"==typeof(null==e?void 0:e.getPlacementsActiveAtTime)?e.getPlacementsActiveAtTime(n):[];if(!i.length)return!1;for(let t=0;t<i.length;t+=1){const n=i[t],r=null==n?void 0:n.placementId;if(!r)return!0;const o="function"==typeof(null==e?void 0:e.getNode)?e.getNode(n.nodeId):void 0;if(!o)return!0;const s=XA(o);if(!s)return!0;if(!e.hasDecodedFirstFrame(r,s))return!0}return!1}function ZA(e,t=(null==e?void 0:e.currentTime)){return JA(e,t)||function(e,t=(null==e?void 0:e.currentTime)){const n=HA(e,t),i="function"==typeof(null==e?void 0:e.getPlacementsActiveAtTime)?e.getPlacementsActiveAtTime(n):[];if(!i.length)return!1;for(let t=0;t<i.length;t+=1){const r=i[t],o=null==r?void 0:r.placementId;if(!o)return!0;const s="function"==typeof(null==e?void 0:e.getNode)?e.getNode(r.nodeId):void 0;if(!s)return!0;const a=YA(s);if(null!=a&&a.id&&!QA(e,o,a.id,a.type,n))return!0}return!1}(e,t)}function eN(e,t=(null==e?void 0:e.currentTime)){if("function"!=typeof(null==e?void 0:e.computeBuffered))return!1;const n=HA(e,t),i=e.computeBuffered(n),r=Number(null==i?void 0:i.start),o=Number(null==i?void 0:i.end);if(!Number.isFinite(r)||!Number.isFinite(o)||o<=r)return!1;const s=KA(e);if(!(r<=n+s))return!1;return o-n>=function(e,t){const n=Number(null==e||null===(t=e.settings)||void 0===t?void 0:t.waitingBufferAheadSeconds);return!Number.isFinite(n)||n<0?3:n}(e)-s||function(e,t,n,i){const r=function(e){const t=Array.isArray(null==e?void 0:e.placements)?e.placements:[];let n;for(let i=0;i<t.length;i+=1){const r=t[i],o=sm(r);if(!Number.isFinite(o))continue;const s="function"==typeof(null==e?void 0:e.getPlacementDuration)?e.getPlacementDuration(r):void 0;if(!Number.isFinite(s))continue;const a=o+s;Number.isFinite(a)&&(!Number.isFinite(n)||a>n)&&(n=a)}return n}(e);return!!Number.isFinite(r)&&(t>=r-i||n>=r-i)}(e,n,o,s)}const tN={[av]:class extends VA{get name(){return av}get defaults(){return{autoplay:xy("autoplay")}}enter(){this.timeline.recordStableState(dv),this.timeline.stopPlaybackClock()}play(){const e=ZA(this.timeline),t=e?uv:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:t}),e)return this.timeline.recordStableState(lv),void this.timeline.transitionTo(uv);this.timeline.transitionTo(t)}pause(){}handleDecodedFrame(e){if(!0!==this.settings.autoplay)return;if(!Array.isArray(this.timeline.placements)||!this.timeline.placements.length)return;if(ZA(this.timeline))return;const t=this.timeline.getPlaybackStartState();this.log.info("[handleDecodedFrame] Autoplay enabled, starting playback!"),this.emitPlayerStateEvent("play",{from:this.timeline.state,to:t}),this.timeline.transitionTo(t)}},[cv]:class extends VA{get name(){return cv}enter(e={}){const{from:t,to:n}=e;this.timeline.recordStableState(lv),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("canplay",{from:t,to:n})}play(){}pause(){this.timeline.transitionTo(dv)}},[lv]:class extends VA{get name(){return lv}enter(e={}){const{from:t,to:n,fromFirstFramePending:i}=e;this.timeline.recordStableState(lv),this.timeline.startPlaybackClock(),!0!==i&&this.emitPlayerStateEvent("canplay",{from:t,to:n}),this.emitPlayerStateEvent("playing",{from:t,to:n})}play(){}pause(){this.timeline.transitionTo(dv)}handleClockTick(e){const t=this.timeline.currentTime;ZA(this.timeline,t)&&(this.timeline.recordStableState(lv),this.timeline.transitionTo(uv))}},[uv]:(Zt=new WeakMap,en=new WeakMap,tn=new WeakSet,class extends VA{constructor(...e){super(...e),O(this,tn),F(this,Zt,void 0),F(this,en,null)}get name(){return uv}enter(e={}){const{from:t,to:n}=e;this.timeline.stopPlaybackClock(),A(tn,this,nN).call(this),A(tn,this,rN).call(this),this.emitPlayerStateEvent("waiting",{from:t,to:n}),A(tn,this,aN).call(this)}exit(){A(tn,this,iN).call(this),A(tn,this,oN).call(this)}play(){this.timeline.recordStableState(lv);const e=A(tn,this,sN).call(this),t=e?uv:this.timeline.getPlaybackStartState();this.emitPlayerStateEvent("play",{from:this.timeline.state,to:t}),e||this.timeline.transitionTo(t)}pause(){this.timeline.transitionTo(dv)}handleMainTrackReady(e){const t=this.timeline.getLastStableState()||dv;t!==lv?this.timeline.transitionTo(t):A(tn,this,aN).call(this)}handleDecodedFrame(e){A(tn,this,aN).call(this)}handleMainTrackBufferUpdate(e){A(tn,this,aN).call(this)}}),[dv]:class extends VA{get name(){return dv}enter(e={}){const{from:t,to:n}=e;this.timeline.recordStableState(dv),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("pause",{from:t,to:n})}play(){const e=ZA(this.timeline),t=e?uv:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:t}),e)return this.timeline.recordStableState(lv),void this.timeline.transitionTo(uv);this.timeline.transitionTo(t)}pause(){}},[hv]:class extends VA{get name(){return hv}enter(e={}){const{targetTime:t,returnState:n}=e;if(this.timeline&&"function"==typeof this.timeline.stopPlaybackClock&&this.timeline.stopPlaybackClock(),this.timeline&&"function"==typeof this.timeline.startSeeking)return void this.timeline.startSeeking(t,n);this.timeline.updateTime(t);const i=n===lv||n===cv,r=i&&"function"==typeof this.timeline.getPlaybackStartState?this.timeline.getPlaybackStartState(t):i?lv:dv;this.timeline.transitionTo(r,{fromSeeking:!0})}play(){var e;if(this.timeline&&"function"==typeof this.timeline.setSeekReturnState)return void this.timeline.setSeekReturnState(lv);const t="function"==typeof(null===(e=this.timeline)||void 0===e?void 0:e.getPlaybackStartState)?this.timeline.getPlaybackStartState():lv;this.timeline.transitionTo(t)}pause(){this.timeline&&"function"==typeof this.timeline.setSeekReturnState?this.timeline.setSeekReturnState(dv):this.timeline.transitionTo(dv)}handleDecodedFrame(e){this.timeline&&"function"==typeof this.timeline.maybeCompleteSeek&&this.timeline.maybeCompleteSeek(e)}},[fv]:class extends VA{get name(){return fv}enter(){this.timeline.resetClock(),this.timeline.transitionTo(av,{fromReset:!0})}play(){}pause(){}get buffered(){return{start:0,end:0}}}};function nN(){var e;const t=null===(e=this.timeline)||void 0===e?void 0:e.trackBuffers;t&&"function"==typeof t.on&&(C(Zt,this,(e=>this.handleMainTrackBufferUpdate(e))),t.on(iv.TRACK_BUFFER_UPDATE,M(Zt,this)))}function iN(){var e;const t=null===(e=this.timeline)||void 0===e?void 0:e.trackBuffers;M(Zt,this)&&t&&"function"==typeof t.off?(t.off(iv.TRACK_BUFFER_UPDATE,M(Zt,this)),C(Zt,this,null)):C(Zt,this,null)}function rN(){if(null!==M(en,this))return;const e="function"==typeof(null==ld?void 0:ld.setInterval)?ld.setInterval.bind(ld):setInterval;C(en,this,e((()=>{var e;(null===(e=this.timeline)||void 0===e?void 0:e.state)===uv&&A(tn,this,aN).call(this)}),200))}function oN(){null!==M(en,this)&&(("function"==typeof(null==ld?void 0:ld.clearInterval)?ld.clearInterval.bind(ld):clearInterval)(M(en,this)),C(en,this,null))}function sN(e=(e=>null===(e=this.timeline)||void 0===e?void 0:e.currentTime)()){return function(e,t=(null==e?void 0:e.currentTime),n={}){return!!JA(e,t)||!0===n.skipBufferResume||!eN(e,t)}(this.timeline,e)}function aN(e=(e=>null===(e=this.timeline)||void 0===e?void 0:e.currentTime)()){return(this.timeline.getLastStableState()||dv)===lv&&!A(tn,this,sN).call(this,e)&&(this.timeline.transitionTo(this.timeline.getPlaybackStartState(e)),!0)}function lN(e){return e&&("string"!=typeof e.state||"ready"===e.state)}function cN(e){return(Array.isArray(null==e?void 0:e.tracks)?e.tracks:[]).some((e=>"video"===(null==e?void 0:e.type)))}function uN(e){return(Array.isArray(null==e?void 0:e.tracks)?e.tracks:[]).some((e=>"video"===(null==e?void 0:e.type)||"image"===(null==e?void 0:e.type)))}function dN(e){return e===lv||e===cv}var hN=new WeakMap,fN=new WeakMap,pN=new WeakMap,mN=new WeakMap,vN=new WeakMap,gN=new WeakMap,yN=new WeakMap,bN=new WeakMap,kN=new WeakMap,wN=new WeakMap,xN=new WeakMap,_N=new WeakMap,TN=new WeakMap,IN=new WeakMap,EN=new WeakSet;class SN{constructor(e={}){O(this,EN),F(this,hN,void 0),F(this,fN,void 0),F(this,pN,void 0),F(this,mN,void 0),F(this,vN,void 0),F(this,gN,void 0),F(this,yN,void 0),F(this,bN,void 0),F(this,kN,void 0),F(this,wN,null),F(this,xN,dv),F(this,_N,[]),F(this,TN,new Set),F(this,IN,new Map),C(hN,this,e.getState),C(fN,this,e.getNode),C(pN,this,e.getPlacementsActiveAtTime),C(mN,this,e.getLastStableState),C(vN,this,e.getPlaybackStartState),C(gN,this,e.clearVisualFrameBuffers),C(yN,this,e.updateTime),C(bN,this,e.transitionTo),C(kN,this,e.trigger)}start(e,t){const n=Number(e);if(!Number.isFinite(n))return;let i=t;i===hv?i=M(xN,this):i===uv&&"function"==typeof M(mN,this)&&(i=M(mN,this).call(this)),C(xN,this,dN(i)?lv:dv),C(wN,this,n),M(TN,this).clear(),M(IN,this).clear(),C(_N,this,"function"==typeof M(pN,this)?M(pN,this).call(this,n):[]),"function"==typeof M(gN,this)&&M(gN,this).call(this),"function"==typeof M(yN,this)&&M(yN,this).call(this,n,{source:"seek"}),"function"==typeof M(kN,this)&&M(kN,this).call(this,iv.TIMELINE_SEEKING,{targetTime:n,placements:M(_N,this).slice()}),this.maybeComplete()}setReturnState(e){C(xN,this,dN(e)?lv:dv)}maybeComplete(e){if(("function"==typeof M(hN,this)?M(hN,this).call(this):void 0)!==hv)return;const t=M(wN,this);if(!Number.isFinite(t))return;const n=null==e?void 0:e.trackType,i=null==e?void 0:e.placementId;if(i&&"video"===n){const n=Number(null==e?void 0:e.pts);if(Number.isFinite(n)&&n>=t){M(TN,this).add(i);const e=M(IN,this).get(i);(!Number.isFinite(e)||n<e)&&M(IN,this).set(i,n)}}else i&&"image"===n&&function(e,t){const n=Number(null==e?void 0:e.pts),i=Number(null==e?void 0:e.duration);return!Number.isFinite(n)||(Number.isFinite(i)&&i>0?t>=n&&t<n+i:t>=n)}(e,t)&&M(TN,this).add(i);const r=Array.isArray(M(_N,this))?M(_N,this):[];if(r.length){if("function"==typeof M(fN,this)){for(let e=0;e<r.length;e+=1){const t=r[e],n=null==t?void 0:t.placementId;if(!n)return;const i=M(fN,this).call(this,t.nodeId);if(!lN(i))return;if(uN(i)&&!M(TN,this).has(n))return}A(EN,this,AN).call(this,t,r)}}else A(EN,this,AN).call(this,t,[])}dispose(){C(_N,this,[]),M(TN,this).clear(),M(IN,this).clear(),C(wN,this,null)}}function AN(e,t){const n=A(EN,this,NN).call(this,e,t);if("function"==typeof M(yN,this)&&M(yN,this).call(this,n,{source:"seek"}),C(wN,this,null),C(_N,this,[]),M(TN,this).clear(),M(IN,this).clear(),"function"==typeof M(kN,this)&&M(kN,this).call(this,iv.TIMELINE_SEEKED,{targetTime:e,placements:Array.isArray(t)?t.slice():[]}),"function"==typeof M(bN,this)){const e=M(xN,this)===lv&&"function"==typeof M(vN,this)?M(vN,this).call(this,n):M(xN,this);M(bN,this).call(this,e,{fromSeeking:!0})}}function NN(e,t){const n=Number(e);if(!Number.isFinite(n))return e;if(!Array.isArray(t)||!t.length||"function"!=typeof M(fN,this))return n;let i=n;for(let e=0;e<t.length;e+=1){const n=t[e],r=null==n?void 0:n.placementId;if(!r)continue;if(!cN(M(fN,this).call(this,n.nodeId)))continue;const o=M(IN,this).get(r);Number.isFinite(o)&&o>i&&(i=o)}return i}function MN(e){if(e&&"function"==typeof e.close)try{e.close()}catch(e){}}function FN(e){if(!e)return;const t=Array.isArray(null==e?void 0:e.frames)?e.frames:[],n=null==e?void 0:e.current;(n?[n,...t]:t).forEach((e=>MN(null==e?void 0:e.frame)))}function CN(e){return sm(e)}function ON(e){return Number.isFinite(null==e?void 0:e.loopRootOffset)?e.loopRootOffset:CN(e)}function PN(e,t){return"string"==typeof(null==e?void 0:e.loopRootPlacementId)&&e.loopRootPlacementId?e.loopRootPlacementId:t}function RN(e){if("string"!=typeof e)return Number.NaN;const t=e.match(/(\d+)/);return t?Number(t[1]):Number.NaN}function DN(e){if(!e)return;const t=[[e.displayWidth,e.displayHeight],[e.codedWidth,e.codedHeight],[e.videoWidth,e.videoHeight],[e.naturalWidth,e.naturalHeight],[e.width,e.height]];for(let e=0;e<t.length;e+=1){const[n,i]=t[e],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}const LN=1e-6;function BN(e){return e&&("string"!=typeof e.state||"ready"===e.state)}function zN(e){const t=Number(e);return Number.isFinite(t)?t:0}function WN(e){return(Array.isArray(null==e?void 0:e.tracks)?e.tracks:[]).filter((e=>"cue"===(null==e?void 0:e.type)&&Array.isArray(null==e?void 0:e.cues)))}function $N(e){return e&&"cue"===e.type&&Array.isArray(e.cues)?e.cues:[]}var jN=new WeakMap,UN=new WeakMap,qN=new WeakMap,VN=new WeakMap,GN=new WeakMap,HN=new WeakMap,KN=new WeakMap,XN=new WeakMap,YN=new WeakSet;class QN{constructor(e={}){O(this,YN),F(this,jN,void 0),F(this,UN,void 0),F(this,qN,void 0),F(this,VN,void 0),F(this,GN,void 0),F(this,HN,void 0),F(this,KN,-1e-6),F(this,XN,null),C(jN,this,e.getPlacements),C(UN,this,e.getPlacementsActiveAtTime),C(qN,this,e.getPlacementDuration),C(VN,this,e.getNode),C(GN,this,e.triggerTimeline),C(HN,this,e.triggerNode)}handleSeeking(e,t){const n=zN(e);C(XN,this,n)}handleSeeked(e){const t=zN(e),n=M(XN,this);C(XN,this,null),Number.isFinite(n)?(A(YN,this,ZN).call(this,n,t),C(KN,this,t)):C(KN,this,t)}handleTimeUpdate(e,t={}){const n=zN(e),i=M(KN,this);!0===(null==t?void 0:t.isSeeking)?C(KN,this,n):Number.isFinite(i)?n<=i?n<i&&C(KN,this,n-LN):(A(YN,this,JN).call(this,i,n),C(KN,this,n)):C(KN,this,n)}dispose(){C(XN,this,null),C(KN,this,-1e-6)}}function JN(e,t){const n="function"==typeof M(jN,this)?M(jN,this).call(this):[];A(YN,this,eM).call(this,n,e,t,{onlySticky:!1})}function ZN(e,t){if("function"!=typeof M(UN,this))return;const n=M(UN,this).call(this,t);A(YN,this,eM).call(this,n,e,t,{onlySticky:!0})}function eM(e,t,n,i={}){if("function"!=typeof M(VN,this)||"function"!=typeof M(GN,this))return;if(!Array.isArray(e)||!e.length)return;const r=!0===i.onlySticky,o=[];for(let i=0;i<e.length;i+=1){const s=e[i],a=null==s?void 0:s.placementId,l=null==s?void 0:s.nodeId;if(!a||!l)continue;const c=M(VN,this).call(this,l);if(!BN(c))continue;const u=WN(c);if(!u.length)continue;const d=sm(s);if(!Number.isFinite(d))continue;const h=Number.isFinite(null==s?void 0:s.nodeOffsetOverride)?s.nodeOffsetOverride:0,f="function"==typeof M(qN,this)?M(qN,this).call(this,s):void 0,p="number"==typeof f&&Number.isFinite(f)?d+f:Number.POSITIVE_INFINITY,m=r?d-LN:t;for(let e=0;e<u.length;e+=1){const t=$N(u[e]);for(let i=0;i<t.length;i+=1){const s=t[i],c=zN(null==s?void 0:s.timestamp),u=d+Math.max(0,c-h);u<=p&&(r&&!0!==(null==s?void 0:s.isSticky)||u>m&&u<=n&&"string"==typeof(null==s?void 0:s.name)&&s.name&&o.push({time:u,placementOffset:d,placementId:a,nodeId:l,cuepoint:s,trackIndex:e,cueIndex:i}))}}}o.length&&(o.sort(((e,t)=>e.time!==t.time?e.time-t.time:e.placementOffset!==t.placementOffset?e.placementOffset-t.placementOffset:e.placementId!==t.placementId?e.placementId<t.placementId?-1:1:e.trackIndex!==t.trackIndex?e.trackIndex-t.trackIndex:e.cueIndex-t.cueIndex)),o.forEach((e=>{const t=e.cuepoint,n={time:e.time,nodeId:e.nodeId,placementId:e.placementId,cuepoint:t};M(GN,this).call(this,"cuepoint",n),M(GN,this).call(this,t.name,n),"function"==typeof M(HN,this)&&(M(HN,this).call(this,e.nodeId,"cuepoint",n),M(HN,this).call(this,e.nodeId,t.name,n))})))}class tM{#te;#ne=0;#ie=new Set;constructor(e){this.#te="string"==typeof e?e:""}claim(e){if(e)return this.#ie.add(e),e;let t;do{t=`${this.#te}${++this.#ne}`}while(this.#ie.has(t));return this.#ie.add(t),t}reset(){this.#ne=0,this.#ie.clear()}}const nM=24e3/1001;function iM(e){var t;const n=null==e?void 0:e.frame;if(!n||!0===n.__closed||!0===n.closed)return 0;if("function"==typeof n.allocationSize)try{const e=Number(n.allocationSize());if(Number.isFinite(e)&&e>0)return e}catch(e){}const i=Number(null==n?void 0:n.byteLength);if(Number.isFinite(i)&&i>0)return i;const r=Number(null==n||null===(t=n.data)||void 0===t?void 0:t.byteLength);if(Number.isFinite(r)&&r>0)return r;const o=function(e,t){const n=Number(null==e?void 0:e.width),i=Number(null==e?void 0:e.height);return Number.isFinite(n)&&Number.isFinite(i)&&n>0&&i>0?{width:n,height:i}:DN(t)}(e,n),s=Number(null==o?void 0:o.width),a=Number(null==o?void 0:o.height);return Number.isFinite(s)&&Number.isFinite(a)&&s>0&&a>0?s*a*4:0}var rM=new WeakMap,oM=new WeakMap,sM=new WeakMap,aM=new WeakMap,lM=new WeakMap,cM=new WeakMap,uM=new WeakMap,dM=new WeakMap,hM=new WeakMap,fM=new WeakMap,pM=new WeakMap,mM=new WeakMap,vM=new WeakMap,gM=new WeakMap,yM=new WeakMap,bM=new WeakMap,kM=new WeakMap,wM=new WeakMap,xM=new WeakMap,_M=new WeakMap,TM=new WeakMap,IM=new WeakMap,EM=new WeakMap,SM=new WeakMap,AM=new WeakMap,NM=new WeakMap,MM=new WeakMap,FM=new WeakMap,CM=new WeakMap,OM=new WeakMap,PM=new WeakMap,RM=new WeakMap,DM=new WeakMap,LM=new WeakSet;class BM extends od{constructor(...e){super(...e),O(this,LM),F(this,rM,void 0),F(this,oM,void 0),F(this,sM,void 0),F(this,aM,void 0),F(this,lM,void 0),F(this,cM,!1),F(this,uM,[]),F(this,dM,new tM("placement-")),F(this,hM,[]),F(this,fM,new tM("renderplacement-")),F(this,pM,void 0),F(this,mM,void 0),F(this,vM,void 0),F(this,gM,!1),F(this,yM,new Set),F(this,bM,new Set),F(this,kM,new Map),F(this,wM,[]),F(this,xM,0),F(this,_M,new Set),F(this,TM,new Set),F(this,IM,Number.NEGATIVE_INFINITY),F(this,EM,[]),F(this,SM,Number.NEGATIVE_INFINITY),F(this,AM,0),F(this,NM,void 0),F(this,MM,void 0),F(this,FM,new Map),F(this,CM,null),F(this,OM,void 0),F(this,PM,void 0),F(this,RM,void 0),F(this,DM,void 0);const[t,n={}]=e;C(rM,this,t),C(NM,this,n),C(lM,this,new PA(n)),C(pM,this,new WA(n)),C(aM,this,dv),A(LM,this,XM).call(this),A(LM,this,YM).call(this),C(OM,this,new SN({getState:()=>this.state,getNode:e=>M(rM,this)&&"function"==typeof M(rM,this).get?M(rM,this).get(e):void 0,getPlacementsActiveAtTime:e=>A(LM,this,NF).call(this,e,{endEpsilonSeconds:A(LM,this,BF).call(this)}),getLastStableState:()=>this.getLastStableState(),getPlaybackStartState:e=>this.getPlaybackStartState(e),clearVisualFrameBuffers:()=>A(LM,this,SF).call(this),updateTime:(e,t)=>this.updateTime(e,t),transitionTo:(e,t)=>this.transitionTo(e,t),trigger:(e,t)=>this.trigger(e,t)})),C(PM,this,new QN({getPlacements:()=>M(uM,this).slice(),getPlacementsActiveAtTime:e=>A(LM,this,NF).call(this,e),getPlacementDuration:e=>A(LM,this,uF).call(this,e),getNode:e=>M(rM,this)&&"function"==typeof M(rM,this).get?M(rM,this).get(e):void 0,triggerTimeline:(e,t)=>this.trigger(e,t),triggerNode:(e,t,n)=>{const i=M(rM,this)&&"function"==typeof M(rM,this).get?M(rM,this).get(e):void 0;i&&"function"==typeof i.trigger&&i.trigger(t,n)}})),C(RM,this,(()=>{var e,t;null===(e=M(PM,this))||void 0===e||null===(t=e.handleSeeked)||void 0===t||t.call(e,this.currentTime)})),this.on(iv.TIMELINE_SEEKED,M(RM,this)),C(DM,this,(e=>A(LM,this,iF).call(this,e))),this.on("nodestart",M(DM,this)),this.transitionTo(av)}get name(){return"Timeline"}get defaults(){return{snapToFps:nM,maxBufferedVideoFrames:24}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"computeBuffered","notifyDecodedFrame","getDecodedFrameStats","getActiveRenderPlacement","maybeCompleteSeek","getPlacementsActiveAtTime","hasDecodedFirstFrame","getDecodedVisualBuffer","getPlacementDuration","getNode"])}transitionTo(e,t={}){const n=M(sM,this),i=function(e,t,n={}){const i=tN[e];return i?new i(t,n):null}(e,this,M(NM,this)),r=t&&"object"==typeof t&&!Array.isArray(t)?{...t,from:n,to:e}:{from:n,to:e};i?(M(oM,this)&&"function"==typeof M(oM,this).exit&&M(oM,this).exit(),C(oM,this,i),C(sM,this,e),"function"==typeof i.enter&&i.enter(r),this.trigger(iv.TIMELINE_STATE_CHANGE,{from:n,to:e,options:t})):this.log.warn(`Unknown state "${e}"`)}recordStableState(e){C(aM,this,e)}getLastStableState(){return M(aM,this)}enableFirstFrameRenderedGate(){C(cM,this,!0)}getPlaybackStartState(e=this.currentTime){return this.shouldWaitForFirstRenderedFrame(e)?cv:lv}shouldWaitForFirstRenderedFrame(e=this.currentTime){if(!M(cM,this)||M(gM,this))return!1;const t=Number.isFinite(e)?e:this.currentTime,n=A(LM,this,NF).call(this,t);return Array.isArray(n)&&n.length>0}notifyFirstFrameRendered(){M(gM,this)||(C(gM,this,!0),this.state===cv&&this.transitionTo(lv,{fromFirstFramePending:!0}))}get state(){return M(sM,this)}get paused(){return M(sM,this)===av||M(sM,this)===dv}get currentTime(){return M(lM,this).currentTime}set currentTime(e){M(oM,this).seek(e)}get playbackRate(){return M(lM,this).playbackRate}set playbackRate(e){M(lM,this).playbackRate=e}play(){M(oM,this).play()}pause(){M(oM,this).pause()}reset(){M(oM,this).reset()}seekToPlacement(e){if(!e)throw new Error("Timeline.seekToPlacement requires placement id");A(LM,this,sF).call(this);const t=A(LM,this,PF).call(this,e);if(!t)throw new Error("Timeline.seekToPlacement requires placement id");const n=sm(t);if(!Number.isFinite(n))throw new Error("Timeline.seekToPlacement requires resolved placement offset");return this.currentTime=n,n}updateTime(e,t={}){var n,i;A(LM,this,sF).call(this),A(LM,this,aF).call(this),M(lM,this).seek(e),A(LM,this,AF).call(this,this.currentTime),A(LM,this,MF).call(this);const r="string"==typeof(null==t?void 0:t.source)?t.source:"set";null!==(n=M(PM,this))&&void 0!==n&&null!==(i=n.handleTimeUpdate)&&void 0!==i&&i.call(n,this.currentTime,{isSeeking:this.state===hv}),A(LM,this,rF).call(this,this.currentTime),A(LM,this,xF).call(this,this.currentTime),this.trigger(iv.TIMELINE_TIME_UPDATE,rv(this.currentTime,r))}startSeeking(e,t){var n,i;null!==(n=M(PM,this))&&void 0!==n&&null!==(i=n.handleSeeking)&&void 0!==i&&i.call(n,this.currentTime,e),M(OM,this)&&"function"==typeof M(OM,this).start&&M(OM,this).start(e,t)}setSeekReturnState(e){M(OM,this)&&"function"==typeof M(OM,this).setReturnState&&M(OM,this).setReturnState(e)}maybeCompleteSeek(e){M(OM,this)&&"function"==typeof M(OM,this).maybeComplete&&M(OM,this).maybeComplete(e)}startPlaybackClock(){M(lM,this).play()}stopPlaybackClock(){M(lM,this).pause()}resetClock(){var e,t;M(lM,this).reset(),null===(e=M(PM,this))||void 0===e||null===(t=e.dispose)||void 0===t||t.call(e)}applyTimelineDefinition(e={}){const t=Array.isArray(null==e?void 0:e.placements)?e.placements:[],n=Array.isArray(null==e?void 0:e.renderPlacements)?e.renderPlacements:[];A(LM,this,zM).call(this),A(LM,this,WM).call(this,t),A(LM,this,$M).call(this,n),this.currentTime=0}placeOnTimeline(e,t,n={}){const i=e&&"object"==typeof e?e.id:e;if(!i)throw new Error("Timeline.placeOnTimeline requires node id");const r=M(dM,this).claim(n.placementId),o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=hm(t);if("string"==typeof t&&t.includes("@")&&!a)throw new Error("Timeline.placeOnTimeline requires valid placement reference");const{wantsEndOffset:l,endOffsetSeconds:c}=a?{wantsEndOffset:!1}:dm(t,n);let u,d,h,f=!1;const p=null!==a;if(A(LM,this,sF).call(this),a){const e=M(uM,this).find((e=>(null==e?void 0:e.placementId)===a.placementId));if(!e)throw new Error("Timeline.placeOnTimeline requires valid placement reference");d=e.placementId,h=a.anchor;const t=sm(e);if("start"===a.anchor)Number.isFinite(t)?u=A(LM,this,dF).call(this,t,{nodeOffsetOverride:o}):f=!0;else{const n=A(LM,this,uF).call(this,e);if(Number.isFinite(t)&&n>0){const e=t+n,i=A(LM,this,dF).call(this,e,{nodeOffsetOverride:o});u=Math.max(i,e)}else f=!0}}else if(l){const e=n.offsetAnchorPlacementId?M(uM,this).find((e=>(null==e?void 0:e.placementId)===n.offsetAnchorPlacementId)):M(uM,this).length?M(uM,this)[M(uM,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==e?void 0:e.placementId),d){const t=sm(e),n=A(LM,this,uF).call(this,e);Number.isFinite(t)&&n>0?u=A(LM,this,dF).call(this,t+n-c,{nodeOffsetOverride:o}):(f=!0,h="end")}else u=A(LM,this,dF).call(this,-c,{nodeOffsetOverride:o})}else u=um(t),u=A(LM,this,dF).call(this,u,{...n,nodeOffsetOverride:o});const m=!0===n.loop?n.loopRootPlacementId||r:void 0,v=!0===n.loop&&Number.isFinite(n.loopRootOffset)?n.loopRootOffset:!0===n.loop?u:void 0,g=l?c:a&&"end"===a.anchor?0:void 0,y=new qA({placementId:r,nodeId:i,offset:u,offsetPending:f,offsetAnchorPlacementId:f?d:void 0,offsetAnchorEdge:f?h:void 0,offsetAnchorIsReference:f?p:void 0,offsetEndSeconds:g,nodeOffsetOverride:o,nodeDurationOverride:s,loop:!0===n.loop,loopRootPlacementId:m,loopRootOffset:v});if(M(uM,this).push(y),lm(M(uM,this)),A(LM,this,kF).call(this,y),A(LM,this,yF).call(this),f&&d){const e=M(uM,this).find((e=>(null==e?void 0:e.placementId)===d));A(LM,this,fF).call(this,null==e?void 0:e.nodeId)}return this.trigger(iv.PLACEMENT_ADDED,y),r}placeRenderNodeOnTimeline(e,t,n,i={}){const r="string"==typeof e?e:null==e?void 0:e.type;if(!r||"string"!=typeof r)throw new Error("Timeline.placeRenderNodeOnTimeline requires render node type");const o=A(LM,this,hF).call(this,t,i),s=o.offset,a=!0===o.offsetPending,l=o.offsetAnchorPlacementId,c=o.offsetAnchorEdge,u=o.offsetAnchorIsReference,d=M(fM,this).claim(i.renderPlacementId),h=Number(n),f=h===Number.POSITIVE_INFINITY,p=Number.isFinite(h)&&h>0||f?h:void 0;if(!p)throw new Error("Timeline.placeRenderNodeOnTimeline requires a positive duration (seconds) or Infinity as 3rd argument");const m=i.params&&"object"==typeof i.params?i.params:void 0,v={renderPlacementId:d,type:r,offset:s,offsetPending:a,offsetAnchorPlacementId:l,offsetAnchorEdge:c,offsetAnchorIsReference:u,duration:p,params:m};if(!a){const e=s,t=s+p;fm(M(hM,this),e,t,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements")}if(M(hM,this).push(v),lm(M(hM,this)),a&&l){const e=M(uM,this).find((e=>(null==e?void 0:e.placementId)===l));A(LM,this,fF).call(this,null==e?void 0:e.nodeId)}return this.trigger(iv.RENDER_PLACEMENT_ADDED,v),d}get placements(){return M(uM,this).slice()}getPlacementsActiveAtTime(e){return A(LM,this,NF).call(this,e)}getNodesAtTime(e){const t=A(LM,this,RF).call(this,e);if(!Number.isFinite(t))return[];const n=A(LM,this,NF).call(this,t),i=[];return n.forEach((e=>{const t=this.getNode(null==e?void 0:e.nodeId);t&&i.push(t)})),i}getPlacementDuration(e){return A(LM,this,uF).call(this,e)}getNode(e){if(M(rM,this)&&"function"==typeof M(rM,this).get)return M(rM,this).get(e)}get renderPlacements(){return M(hM,this).slice()}get placementsAhead(){const e=this.currentTime;return M(uM,this).filter((t=>{const n=sm(t);if(!Number.isFinite(n))return!1;const i=A(LM,this,uF).call(this,t);return"number"==typeof i?n+i>e:n>=e}))}get buffered(){return M(oM,this)?M(oM,this).buffered:{start:0,end:0}}get trackBuffers(){return M(pM,this)}onDispose(){A(LM,this,HM).call(this),M(bM,this)&&M(bM,this).clear(),M(PM,this)&&"function"==typeof M(PM,this).dispose&&M(PM,this).dispose(),C(PM,this,null),A(LM,this,GM).call(this),A(LM,this,KM).call(this),M(OM,this)&&"function"==typeof M(OM,this).dispose&&M(OM,this).dispose(),C(OM,this,null),M(lM,this)&&"function"==typeof M(lM,this).dispose&&(M(MM,this)&&"function"==typeof M(lM,this).off&&(M(lM,this).off("tick",M(MM,this)),C(MM,this,null)),M(lM,this).dispose(),C(lM,this,null)),A(LM,this,vF).call(this),C(oM,this,null),C(sM,this,null),C(uM,this,[]),C(hM,this,[]),A(LM,this,gF).call(this),A(LM,this,yF).call(this),M(FM,this).clear(),C(CM,this,null)}notifyDecodedFrame(e={}){const t=null==e?void 0:e.placementId,n=null==e?void 0:e.trackType;if(!t||!n)return;const i=`${t}:${n}`;M(yM,this).add(i),A(LM,this,EF).call(this,e),A(LM,this,MF).call(this),M(oM,this)&&"function"==typeof M(oM,this).handleDecodedFrame&&M(oM,this).handleDecodedFrame(e)}getDecodedFrameStats(){return function(e){const t={totalBytes:0,frames:0,available:!1};if(!e||"function"!=typeof e.values)return t;for(const n of e.values()){const e=[];null!=n&&n.current&&e.push(n.current),Array.isArray(null==n?void 0:n.frames)&&e.push(...n.frames),e.forEach((e=>{const n=null==e?void 0:e.frame;if(!n||!0===n.__closed||!0===n.closed)return;t.frames+=1;const i=iM(e);Number.isFinite(i)&&i>0&&(t.totalBytes+=i)}))}return t.available=!0,t}(M(FM,this))}hasDecodedFirstFrame(e,t){return!(!e||!t)&&M(yM,this).has(`${e}:${t}`)}getDecodedVisualBuffer(e,t){if(e&&t)return M(FM,this).get(`${e}:${t}`)}computeBuffered(e){const t=M(rM,this);if(t&&"function"==typeof t.get)return M(pM,this).computeBuffered(M(uM,this),e,t)}getActiveRenderPlacement(e=this.currentTime){const t=Number.isFinite(e)?e:this.currentTime,n=Array.isArray(M(hM,this))?M(hM,this):[];if(!n.length)return;let i;for(let e=0;e<n.length;e+=1){const r=n[e];if(!0===(null==r?void 0:r.offsetPending))continue;const o="number"==typeof r.offset?r.offset:void 0;if(!Number.isFinite(o))continue;const s=r.duration;("number"==typeof s&&Number.isFinite(s)&&s>0?t>=o&&t<o+s:t>=o)&&(i=r)}return i}}function zM(){C(gM,this,!1),this.trigger(iv.TIMELINE_RESET,{reason:"switch"}),A(LM,this,SF).call(this),M(pM,this)&&"function"==typeof M(pM,this).reset&&M(pM,this).reset(),M(bM,this)&&M(bM,this).clear(),C(uM,this,[]),C(hM,this,[]),A(LM,this,gF).call(this),A(LM,this,yF).call(this),M(dM,this).reset(),M(fM,this).reset()}function WM(e=[]){for(let t=0;t<e.length;t+=1){const n=e[t];if(!n||!n.nodeId)continue;const i=A(LM,this,jM).call(this,n),r=A(LM,this,qM).call(this,n);this.placeOnTimeline(n.nodeId,r,i)}}function $M(e=[]){for(let t=0;t<e.length;t+=1){const n=e[t];if(!n||!n.type)continue;const i=A(LM,this,UM).call(this,n),r=A(LM,this,VM).call(this,n);this.placeRenderNodeOnTimeline(n.type,r,n.duration,i)}}function jM(e){const t={};return e.placementId&&(t.placementId=e.placementId),Number.isFinite(e.nodeOffsetOverride)&&(t.nodeOffsetOverride=e.nodeOffsetOverride),Number.isFinite(e.nodeDurationOverride)&&(t.nodeDurationOverride=e.nodeDurationOverride),!0===e.offsetPending&&(t.offsetPending=!0,e.offsetAnchorPlacementId&&(t.offsetAnchorPlacementId=e.offsetAnchorPlacementId),e.offsetAnchorEdge&&(t.offsetAnchorEdge=e.offsetAnchorEdge)),Number.isFinite(e.offsetEndSeconds)&&(t.offsetEndSeconds=e.offsetEndSeconds),!0===e.loop&&(t.loop=!0),e.loopRootPlacementId&&(t.loopRootPlacementId=e.loopRootPlacementId),Number.isFinite(e.loopRootOffset)&&(t.loopRootOffset=e.loopRootOffset),t}function UM(e){const t={};return e.renderPlacementId&&(t.renderPlacementId=e.renderPlacementId),e.params&&"object"==typeof e.params&&(t.params=e.params),t}function qM(e){if(!0===e.offsetPending&&e.offsetAnchorPlacementId&&e.offsetAnchorEdge){if(!0===e.offsetAnchorIsReference)return`${e.offsetAnchorPlacementId}@${e.offsetAnchorEdge}`;if("end"===e.offsetAnchorEdge)return Number.isFinite(e.offsetEndSeconds)&&e.offsetEndSeconds>0?-e.offsetEndSeconds:"end"}return"string"==typeof e.offset||Number.isFinite(e.offset)?e.offset:0}function VM(e){return!0===e.offsetPending&&e.offsetAnchorPlacementId&&e.offsetAnchorEdge&&!0===e.offsetAnchorIsReference?`${e.offsetAnchorPlacementId}@${e.offsetAnchorEdge}`:"string"==typeof e.offset||Number.isFinite(e.offset)?e.offset:0}function GM(){M(oM,this)&&"function"==typeof M(oM,this).exit&&M(oM,this).exit()}function HM(){M(RM,this)&&"function"==typeof this.off&&(this.off(iv.TIMELINE_SEEKED,M(RM,this)),C(RM,this,null)),M(DM,this)&&"function"==typeof this.off&&(this.off("nodestart",M(DM,this)),C(DM,this,null))}function KM(){M(pM,this)&&(M(mM,this)&&(M(pM,this).off("track:underflow",M(mM,this)),C(mM,this,null)),M(vM,this)&&(M(pM,this).off("track:ready",M(vM,this)),C(vM,this,null)),"function"==typeof M(pM,this).dispose&&M(pM,this).dispose(),C(pM,this,null))}function XM(){M(pM,this)&&"function"==typeof M(pM,this).on&&(C(mM,this,(e=>A(LM,this,JM).call(this,e))),C(vM,this,(e=>A(LM,this,ZM).call(this,e))),M(pM,this).on(iv.TRACK_UNDERFLOW,M(mM,this)),M(pM,this).on(iv.TRACK_READY,M(vM,this)))}function YM(){M(lM,this)&&"function"==typeof M(lM,this).on&&(C(MM,this,(e=>A(LM,this,QM).call(this,e))),M(lM,this).on(iv.CLOCK_TICK,M(MM,this)))}function QM(e){var t,n;A(LM,this,sF).call(this),A(LM,this,MF).call(this),null!==(t=M(PM,this))&&void 0!==t&&null!==(n=t.handleTimeUpdate)&&void 0!==n&&n.call(t,this.currentTime,{isSeeking:!1}),A(LM,this,rF).call(this,this.currentTime),this.trigger(iv.TIMELINE_TIME_UPDATE,rv(this.currentTime,"clock")),M(oM,this)&&"function"==typeof M(oM,this).handleClockTick&&M(oM,this).handleClockTick(e)}function JM(e){A(LM,this,sF).call(this);const t=A(LM,this,eF).call(this);t&&(null==e?void 0:e.trackType)===t.trackType&&(M(oM,this)&&"function"==typeof M(oM,this).handleMainTrackUnderflow?M(oM,this).handleMainTrackUnderflow(e):this.transitionTo(uv))}function ZM(e){if(A(LM,this,sF).call(this),this.state!==uv)return;const t=A(LM,this,eF).call(this);if(!t)return;if((null==e?void 0:e.trackType)!==t.trackType)return;if(M(oM,this)&&"function"==typeof M(oM,this).handleMainTrackReady)return void M(oM,this).handleMainTrackReady(e);const n=this.getLastStableState()||dv;this.transitionTo(n)}function eF(e=this.currentTime){const t=A(LM,this,nF).call(this,e);if(!t)return;const n=M(rM,this)&&"function"==typeof M(rM,this).get?M(rM,this).get(t.nodeId):void 0;if(!n)return;const i=A(LM,this,tF).call(this,n);return i?{placement:t,trackType:i}:void 0}function tF(e){var t;const n=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[];let i;if(null!=e&&e.mainTrackId){const t=n.find((t=>(null==t?void 0:t.id)===e.mainTrackId));i=null==t?void 0:t.type}if(i||(i=null===(t=n.find((e=>null==e?void 0:e.type)))||void 0===t?void 0:t.type),"video"===i||"audio"===i||"image"===i)return i}function nF(e=this.currentTime){const t=M(uM,this)||[];let n;for(let i=0;i<t.length;i+=1){const r=t[i],o=sm(r);if(!Number.isFinite(o))continue;const s=A(LM,this,uF).call(this,r);if(Number.isFinite(s)){if(e>=o&&e<o+s)return r}else if(e<=o)return r;!n&&e<o&&(n=r)}return n}function iF(e={}){if(this.state!==lv)return;const t=null==e?void 0:e.placementId;if(!t)return;const n=A(LM,this,PF).call(this,t);n&&A(LM,this,oF).call(this,n)}function rF(e=this.currentTime){if(this.state!==lv)return;const t=A(LM,this,NF).call(this,e);Array.isArray(t)&&t.length&&t.forEach((e=>A(LM,this,oF).call(this,e)))}function oF(e){const t=null==e?void 0:e.placementId;if(!t)return;if(M(bM,this).has(t))return;if(!e||!0!==e.loop)return;if(!e.nodeId)return;const n=A(LM,this,uF).call(this,e);if(!Number.isFinite(n)||n<=0)return;const i=sm(e);if(!Number.isFinite(i))return;const r=i+n;if(!Number.isFinite(r))return;const o=e.loopRootPlacementId||e.placementId,s=Number.isFinite(e.loopRootOffset)?e.loopRootOffset:i;M(bM,this).add(t),this.placeOnTimeline(e.nodeId,r,{nodeOffsetOverride:e.nodeOffsetOverride,nodeDurationOverride:e.nodeDurationOverride,loop:!0,loopRootPlacementId:o,loopRootOffset:s})}function sF(){const e=cm(M(uM,this),{getPlacementDuration:e=>A(LM,this,uF).call(this,e),snapPlacementOffset:(e,t)=>A(LM,this,dF).call(this,e,{nodeOffsetOverride:null==t?void 0:t.nodeOffsetOverride}),onResolvedPlacement:(e,t)=>{!0!==e.loop||Number.isFinite(e.loopRootOffset)||(e.loopRootOffset=e.offset),A(LM,this,pF).call(this,null==t?void 0:t.nodeId)}});return e.updated&&(A(LM,this,yF).call(this),e.resolvedPlacements.forEach((e=>{A(LM,this,kF).call(this,e),this.trigger(iv.PLACEMENT_ADDED,e)}))),e.updated}function aF(){if(!M(hM,this).length||!M(uM,this).length)return!1;const e=new Map;M(uM,this).forEach((t=>{(null==t?void 0:t.placementId)&&e.set(t.placementId,t)}));const t=M(hM,this).filter((e=>!0===(null==e?void 0:e.offsetPending)));if(!t.length)return!1;let n=!1;const i=[];for(let r=0;r<t.length;r+=1){const o=t[r];A(LM,this,lF).call(this,o,e)&&(n=!0,i.push(o))}return n&&(lm(M(hM,this)),i.forEach((e=>{this.trigger(iv.RENDER_PLACEMENT_ADDED,e)}))),n}function lF(e,t){const n=null==e?void 0:e.offsetAnchorPlacementId,i=null==e?void 0:e.offsetAnchorEdge;if(!n||!i)return!1;const r=t.get(n);if(!r||!0===r.offsetPending)return!1;const o=A(LM,this,cF).call(this,r,e);if(!Number.isFinite(o))return!1;e.offset=o,e.offsetPending=!1,e.offsetAnchorPlacementId=void 0,e.offsetAnchorEdge=void 0,e.offsetAnchorIsReference=void 0;const s=e.offset,a=e.offset+e.duration;return fm(M(hM,this).filter((t=>t!==e&&!0!==(null==t?void 0:t.offsetPending))),s,a,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements"),A(LM,this,pF).call(this,null==r?void 0:r.nodeId),!0}function cF(e,t){const n=sm(e);if(!Number.isFinite(n))return;if("start"===t.offsetAnchorEdge)return A(LM,this,dF).call(this,n);const i=A(LM,this,uF).call(this,e);if(!(i>0))return;const r=n+i;if(!Number.isFinite(r))return;const o=A(LM,this,dF).call(this,r);return!0===t.offsetAnchorIsReference?Math.max(o,r):o}function uF(e){return rm(e,M(rM,this))}function dF(e,t={}){var n;return function(e,t={},n){const i=Number(n);if(!(i>0))return e;const r=Number(e);if(!Number.isFinite(r))return e;const o=Number.isFinite(null==t?void 0:t.nodeOffsetOverride)?t.nodeOffsetOverride:0,s=r-o;return Math.round(s*i)/i+o}(e,t,null===(n=this.settings)||void 0===n?void 0:n.snapToFps)}function hF(e,t={}){const n=hm(e);if("string"==typeof e&&e.includes("@")&&!n)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");if(!n){const n=um(e);return{offset:A(LM,this,dF).call(this,n,t)}}const i=M(uM,this).find((e=>(null==e?void 0:e.placementId)===n.placementId));if(!i)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");const r=sm(i);if("start"===n.anchor)return Number.isFinite(r)?{offset:A(LM,this,dF).call(this,r,t)}:{offset:void 0,offsetPending:!0,offsetAnchorPlacementId:i.placementId,offsetAnchorEdge:"start",offsetAnchorIsReference:!0};const o=A(LM,this,uF).call(this,i);if(!(Number.isFinite(r)&&o>0))return{offset:void 0,offsetPending:!0,offsetAnchorPlacementId:i.placementId,offsetAnchorEdge:"end",offsetAnchorIsReference:!0};const s=r+o,a=A(LM,this,dF).call(this,s,t);return{offset:Math.max(a,s)}}function fF(e){if(!e||!M(rM,this)||"function"!=typeof M(rM,this).get)return;if(M(kM,this).has(e))return;let t;try{t=M(rM,this).get(e)}catch(e){return}if(!t||"function"!=typeof t.on)return;if("ready"===t.state&&t.duration>0)return void this.updateTime(this.currentTime);const n=()=>{this.updateTime(this.currentTime),A(LM,this,pF).call(this,e)};t.on(iv.NODE_LOADED,n),M(kM,this).set(e,n)}function pF(e){if(!e)return;if(A(LM,this,mF).call(this,e))return;const t=M(kM,this).get(e);if(!t)return;let n;try{n=M(rM,this).get(e)}catch(e){n=null}n&&"function"==typeof n.off&&n.off(iv.NODE_LOADED,t),M(kM,this).delete(e)}function mF(e){if(!e)return!1;const t=new Map;M(uM,this).forEach((e=>{(null==e?void 0:e.placementId)&&t.set(e.placementId,e)}));const n=n=>{if(null==n||!n.offsetPending||null==n||!n.offsetAnchorPlacementId)return!1;const i=t.get(n.offsetAnchorPlacementId);return(null==i?void 0:i.nodeId)===e};return!!M(uM,this).some((e=>n(e)))||!!M(hM,this).some((e=>n(e)))}function vF(){M(kM,this).size&&M(rM,this)?(M(kM,this).forEach(((e,t)=>{let n;try{n=M(rM,this).get(t)}catch(e){n=null}n&&"function"==typeof n.off&&n.off(iv.NODE_LOADED,e)})),M(kM,this).clear()):M(kM,this).clear()}function gF(){C(wM,this,[]),C(xM,this,0),M(_M,this).clear(),M(TM,this).clear(),C(IM,this,Number.NEGATIVE_INFINITY)}function yF(){C(EM,this,[]),C(AM,this,0),C(SM,this,Number.NEGATIVE_INFINITY)}function bF(e,t){const n=M(wM,this),i={placementId:e,endTime:t};if(!n.length||t>=n[n.length-1].endTime)return void n.push(i);const r=n.findIndex((e=>t<e.endTime)),o=-1===r?n.length:r;n.splice(o,0,i),o<M(xM,this)&&C(xM,this,M(xM,this)+1)}function kF(e){const t=null==e?void 0:e.placementId;if(!t||M(_M,this).has(t))return;const n=sm(e),i=A(LM,this,uF).call(this,e);if(!Number.isFinite(n)||!Number.isFinite(i)||i<0)return void M(TM,this).add(t);const r=n+i;Number.isFinite(r)&&(M(_M,this).add(t),M(TM,this).delete(t),A(LM,this,bF).call(this,t,r))}function wF(){M(TM,this).size&&Array.from(M(TM,this)).forEach((e=>{const t=A(LM,this,PF).call(this,e);t?A(LM,this,kF).call(this,t):M(TM,this).delete(e)}))}function xF(e){const t=Number(e);if(!Number.isFinite(t))return;if(t<M(IM,this))return void C(IM,this,t);if(C(IM,this,t),A(LM,this,wF).call(this),!M(wM,this).length)return;const n=new Set;let i=M(xM,this);for(;i<M(wM,this).length;){const e=M(wM,this)[i];if(!e||!Number.isFinite(e.endTime)||e.endTime>t)break;e.placementId&&n.add(e.placementId),i+=1}i!==M(xM,this)&&(C(xM,this,i),n.size&&(A(LM,this,IF).call(this,n),A(LM,this,_F).call(this,n)))}function _F(e){if(e&&e.size)for(const t of M(yM,this)){const n=t.split(":")[0];e.has(n)&&M(yM,this).delete(t)}}function TF(e){const t=Array.isArray(null==e?void 0:e.frames)?e.frames:[],n=null==e?void 0:e.current;(n?[n,...t]:t).forEach((e=>{const t=null==e?void 0:e.frame;if(t&&"function"==typeof t.close)try{t.close()}catch(e){}}))}function IF(e){if(e&&e.size)for(const[t,n]of M(FM,this).entries())e.has(null==n?void 0:n.placementId)&&(A(LM,this,TF).call(this,n),M(FM,this).delete(t))}function EF(e={}){var t;const n=null==e?void 0:e.placementId,i=null==e?void 0:e.nodeId,r=null==e?void 0:e.trackId,o=null==e?void 0:e.segmentId,s=null==e?void 0:e.trackType;if(!(n&&i&&r&&o))return;if("video"!==s&&"image"!==s)return;const a=(null==e?void 0:e.frame)||(null==e?void 0:e.data);if(!a)return;"video"===s&&"object"==typeof a&&"function"==typeof a.close&&(a.__keepOpen=!0);const l=DN(a),c=Number.isFinite(null==l?void 0:l.width)?l.width:void 0,u=Number.isFinite(null==l?void 0:l.height)?l.height:void 0,d=Number.isFinite(null==e?void 0:e.pts)?e.pts:void 0;if(!Number.isFinite(d))return;const h=Number.isFinite(null==e?void 0:e.duration)?e.duration:void 0,f=`${n}:${r}`,p=M(FM,this).get(f),m=p||{placementId:n,nodeId:i,trackId:r,trackType:s,frames:[],current:void 0},v={placementId:n,nodeId:i,trackId:r,segmentId:o,frame:a,width:c,height:u,presentationTime:d,duration:h},g=m.frames,y=g.length?g[g.length-1]:void 0;if(!y||y.presentationTime<=v.presentationTime)g.push(v);else{let e=g.findIndex((e=>e.presentationTime>v.presentationTime));-1===e&&(e=g.length),g.splice(e,0,v)}const b=Number(null===(t=this.settings)||void 0===t?void 0:t.maxBufferedVideoFrames);if("video"===s&&Number.isFinite(b)&&b>0&&g.length>b){const e=g.length-b;for(let t=0;t<e;t+=1){const e=g.pop(),t=null==e?void 0:e.frame;if(t&&"function"==typeof t.close)try{t.close()}catch(e){}}}p||M(FM,this).set(f,m)}function SF(){for(const e of M(FM,this).values())A(LM,this,TF).call(this,e);M(FM,this).clear(),C(CM,this,null),M(yM,this).clear()}function AF(e){const t=Number.isFinite(e)?e:this.currentTime;if(!Number.isFinite(t))return;t<M(SM,this)&&(C(EM,this,[]),C(AM,this,0));const n=Array.isArray(M(uM,this))?M(uM,this):[],i=[],r=new Set;M(EM,this).forEach((e=>{A(LM,this,zF).call(this,e,t)&&(i.push(e),(null==e?void 0:e.placementId)&&r.add(e.placementId))}));let o=M(AM,this);for(;o<n.length;){const e=n[o],s=sm(e);if(!Number.isFinite(s))break;if(s>t)break;if(A(LM,this,zF).call(this,e,t)){const t=null==e?void 0:e.placementId;t&&r.has(t)||(i.push(e),t&&r.add(t))}o+=1}C(EM,this,i),C(AM,this,o),C(SM,this,t)}function NF(e,t={}){const n=Number.isFinite(e)?e:this.currentTime,i=Number.isFinite(null==t?void 0:t.endEpsilonSeconds)?t.endEpsilonSeconds:0;return 0===i&&n===this.currentTime&&n===M(SM,this)?M(EM,this).slice():(Array.isArray(M(uM,this))?M(uM,this):[]).filter((e=>A(LM,this,zF).call(this,e,n,i)))}function MF(){const e=this.currentTime,t=A(LM,this,CF).call(this,e);if(!t.length)return void C(CM,this,null);const n=this.getActiveRenderPlacement(e),i=A(LM,this,OF).call(this,t,n);(i!==M(CM,this)||A(LM,this,FF).call(this,e,n))&&(C(CM,this,i),this.trigger(iv.VISUAL_FRAMES_AVAILABLE,{time:e,frames:t}))}function FF(e,t){const n=t||this.getActiveRenderPlacement(e);if(!n)return!1;if(!Nm.doesRenderNodeTypeRequireFrameCadence(null==n?void 0:n.type))return!1;const i=n.duration;return"number"==typeof i&&i>0}function CF(e){return function(e={}){const t=e.buffers,n=e.time,i=e.getPlacementById,r=e.isPlacementActiveAtTime,o=e.getPlacementDuration,s=[];if(!t||"function"!=typeof t.entries)return[];const a=[];for(const[e,c]of t.entries()){const t=null==c?void 0:c.placementId,u="function"==typeof i?i(t):void 0;if(!u){FN(c),a.push(e);continue}if("function"==typeof r&&!r(u,n)){const t=CN(u),i="function"==typeof o?o(u):void 0;Number.isFinite(i)&&Number.isFinite(t)&&n>=t+i&&(FN(c),a.push(e));continue}const d=Array.isArray(null==c?void 0:c.frames)?c.frames:[];for(;d.length&&Number.isFinite(null===(l=d[0])||void 0===l?void 0:l.presentationTime)&&d[0].presentationTime<=n;){var l;const e=c.current,t=d.shift();c.current=t,e&&e!==t&&MN(null==e?void 0:e.frame)}if(!c.current)continue;const h={placementId:t,nodeId:c.current.nodeId,trackId:c.current.trackId,segmentId:c.current.segmentId,frame:c.current.frame,width:c.current.width,height:c.current.height,presentationTime:c.current.presentationTime,duration:c.current.duration};s.push({frame:h,placementId:t,placementOffset:CN(u),placementSortOffset:ON(u),placementSortId:PN(u,t)})}return a.forEach((e=>{t.delete(e)})),s.sort(((e,t)=>{const n=Number.isFinite(null==e?void 0:e.placementSortOffset)?e.placementSortOffset:Number.isFinite(null==e?void 0:e.placementOffset)?e.placementOffset:0,i=Number.isFinite(null==t?void 0:t.placementSortOffset)?t.placementSortOffset:Number.isFinite(null==t?void 0:t.placementOffset)?t.placementOffset:0;if(n!==i)return n-i;const r=(null==e?void 0:e.placementSortId)||(null==e?void 0:e.placementId),o=(null==t?void 0:t.placementSortId)||(null==t?void 0:t.placementId),s=RN(r),a=RN(o);return Number.isFinite(s)&&Number.isFinite(a)&&s!==a?s-a:r&&o&&r!==o?r<o?-1:1:function(e,t){const n=(null==e?void 0:e.frame)||{},i=(null==t?void 0:t.frame)||{};return n.trackId!==i.trackId?n.trackId<i.trackId?-1:1:n.nodeId!==i.nodeId?n.nodeId<i.nodeId?-1:1:n.segmentId!==i.segmentId?n.segmentId<i.segmentId?-1:1:("number"==typeof n.presentationTime?n.presentationTime:0)-("number"==typeof i.presentationTime?i.presentationTime:0)}(e,t)})),s.map((e=>e.frame))}({buffers:M(FM,this),time:e,getPlacementById:e=>A(LM,this,PF).call(this,e),isPlacementActiveAtTime:(e,t)=>A(LM,this,zF).call(this,e,t),getPlacementDuration:e=>A(LM,this,uF).call(this,e)})}function OF(e,t){return`${t?`render:${t.renderPlacementId||t.type||"unknown"}`:"render:default"}|${e.map((e=>`${e.nodeId}:${e.trackId}:${e.segmentId}@${e.presentationTime}`)).join("|")}`}function PF(e){if(e)return(M(uM,this)||[]).find((t=>(null==t?void 0:t.placementId)===e))}function RF(e){if("end"===e){const e=A(LM,this,DF).call(this);if(!Number.isFinite(e))return;const t=A(LM,this,LF).call(this);return Math.max(0,e-Math.min(e,t))}const t=Number(e);return Number.isFinite(t)?t:0}function DF(){let e;return(Array.isArray(M(uM,this))?M(uM,this):[]).forEach((t=>{const n=sm(t);if(!Number.isFinite(n))return;const i=A(LM,this,uF).call(this,t);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(e)||r>e)&&(e=r)})),e}function LF(){const e=A(LM,this,BF).call(this);return e>0?e:.001}function BF(){var e;const t=Number(null===(e=this.settings)||void 0===e?void 0:e.snapToFps);return!Number.isFinite(t)||t<=0?0:.5/t}function zF(e,t,n=0){if(!am(e,t,M(rM,this)))return!1;const i=Number(n);if(!Number.isFinite(i)||i<=0)return!0;const r=A(LM,this,uF).call(this,e);if(!Number.isFinite(r))return!0;const o=sm(e);return!Number.isFinite(o)||t<o+r-i}var WF=new WeakMap,$F=new WeakMap,jF=new WeakMap,UF=new WeakMap,qF=new WeakMap,VF=new WeakMap,GF=new WeakMap,HF=new WeakMap,KF=new WeakMap,XF=new WeakMap,YF=new WeakMap,QF=new WeakMap,JF=new WeakMap,ZF=new WeakMap,eC=new WeakMap,tC=new WeakMap,nC=new WeakMap,iC=new WeakSet;class rC extends od{get name(){return"QoE"}get defaults(){return{calcScoreInterval:1,streamQualityWeight:.8,fpsWeight:.2,fpsMathFuncType:"quad",bestFpsMobile:27,bestFpsDesktop:57,waitingMultiplier:1,statusFloors:{excellent:.98,good:.85,fair:.7,poor:0,alert:0},alertStatusCeil:.3,fpsGracePeriod:2,windowSeconds:30}}constructor(...e){super(...e),O(this,iC),F(this,WF,void 0),F(this,$F,void 0),F(this,jF,1),F(this,UF,1),F(this,qF,1),F(this,VF,""),F(this,GF,0),F(this,HF,[]),F(this,KF,null),F(this,XF,void 0),F(this,YF,[]),F(this,QF,null),F(this,JF,null),F(this,ZF,0),F(this,eC,0),F(this,tC,0),F(this,nC,void 0);const[t]=e;C(WF,this,t),C(ZF,this,oy()),C(nC,this,A(iC,this,oC).call(this)),A(iC,this,sC).call(this),A(iC,this,aC).call(this),A(iC,this,hC).call(this),A(iC,this,uC).call(this)}get publicAPI(){return M(nC,this)}calcScore(){A(iC,this,wC).call(this)}onDispose(){M(WF,this)&&M($F,this)&&"function"==typeof M(WF,this).off&&M(WF,this).off(iv.TIMELINE_PLAYER_STATE,M($F,this)),C($F,this,null),A(iC,this,dC).call(this),A(iC,this,fC).call(this),C(WF,this,null),C(YF,this,[]),C(HF,this,[]),C(nC,this,null)}}function oC(){const e=this;return{get score(){return M(jF,e)},get status(){return M(VF,e)},get streamQualityScore(){return M(UF,e)},get fpsScore(){return M(qF,e)},get browserFps(){return M(GF,e)},get waitingSeconds(){return M(eC,e)/1e3},get playingSeconds(){return M(tC,e)/1e3}}}function sC(){Number(this.settings.streamQualityWeight)+Number(this.settings.fpsWeight)!==1&&(this.log.warn("QoE weights must sum to 1; resetting to legacy defaults."),this.settings.streamQualityWeight=.8,this.settings.fpsWeight=.2)}function aC(){M(WF,this)&&"function"==typeof M(WF,this).on&&(C($F,this,(e=>A(iC,this,lC).call(this,e))),M(WF,this).on(iv.TIMELINE_PLAYER_STATE,M($F,this)))}function lC(e={}){const t="string"==typeof(null==e?void 0:e.event)?e.event:"";"playing"!==t?"waiting"!==t?"pause"!==t&&"seeking"!==t&&"seeked"!==t&&"reset"!==t||A(iC,this,cC).call(this,null):A(iC,this,cC).call(this,"waiting"):A(iC,this,cC).call(this,"playing")}function cC(e){if(e===M(QF,this))return;const t=oy();M(QF,this)&&Number.isFinite(M(JF,this))&&M(YF,this).push({state:M(QF,this),startMs:M(JF,this),endMs:t}),C(QF,this,e),C(JF,this,e?t:null),A(iC,this,vC).call(this,t)}function uC(){const e=Number(this.settings.calcScoreInterval);!Number.isFinite(e)||e<=0||(C(XF,this,(()=>A(iC,this,wC).call(this))),jk(M(XF,this),1e3*e))}function dC(){M(XF,this)&&Uk(M(XF,this)),C(XF,this,null)}function hC(){if("function"!=typeof Ck)return;const e=()=>{if(this._disposed)return;const t=oy();C(GF,this,A(iC,this,pC).call(this,M(HF,this),t)),C(KF,this,Ck(e))};C(KF,this,Ck(e))}function fC(){M(KF,this)&&"function"==typeof Ok&&Ok(M(KF,this)),C(KF,this,null)}function pC(e,t){const n=A(iC,this,mC).call(this);for(e.push(t);e.length&&t-e[0]>n;)e.shift();if(e.length<2)return 0;const i=e[e.length-1]-e[0];return i<=0?0:1e3*(e.length-1)/i}function mC(){const e=Number(this.settings.windowSeconds);return!Number.isFinite(e)||e<=0?3e4:1e3*e}function vC(e){const t=e-A(iC,this,mC).call(this);for(;M(YF,this).length&&M(YF,this)[0].endMs<=t;)M(YF,this).shift()}function gC(e){const t=e-A(iC,this,mC).call(this);let n=0,i=0;const r=(r,o,s)=>{const a=Math.max(o,t),l=Math.min(s,e);l<=a||("waiting"===r?n+=l-a:"playing"===r&&(i+=l-a))};return M(YF,this).forEach((e=>{r(e.state,e.startMs,e.endMs)})),M(QF,this)&&Number.isFinite(M(JF,this))&&r(M(QF,this),M(JF,this),e),C(eC,this,n),C(tC,this,i),{waitingMs:n,playingMs:i}}function yC(e,t){if(e<=0)return 1;if(e>t)return 0;const n=t||1;return nm(1-e*this.settings.waitingMultiplier/n)}function bC(){if(oy()-M(ZF,this)<=1e3*this.settings.fpsGracePeriod)return 1;const e=Number(M(GF,this)),t=tv.isDesktop()?this.settings.bestFpsDesktop:this.settings.bestFpsMobile,n=nm(t>0?e/t:0);return"quad"===this.settings.fpsMathFuncType?n*n:n}function kC(e,t){const n=this.settings.statusFloors||{};let i="";return e>=n.excellent?i="excellent":e>=n.good?i="good":e>=n.fair?i="fair":(i="poor",e<=this.settings.alertStatusCeil&&t>0&&(i="alert")),i}function wC(){const e=oy(),{waitingMs:t,playingMs:n}=A(iC,this,gC).call(this,e),i=A(iC,this,yC).call(this,t,n),r=A(iC,this,bC).call(this),o=nm(i*this.settings.streamQualityWeight+r*this.settings.fpsWeight);o!==M(jF,this)&&(C(jF,this,o),this.trigger(iv.QOE_SCORE,o)),C(UF,this,i),C(qF,this,r);const s=A(iC,this,kC).call(this,o,t);s!==M(VF,this)&&(C(VF,this,s),this.trigger(iv.QOE_STATUS,s))}function xC(e,t=0){const n=Number(e);return Number.isFinite(n)?n:t}function _C(e){const t=Number(e);return!Number.isFinite(t)||t<0?0:t}var TC=new WeakMap,IC=new WeakMap,EC=new WeakMap,SC=new WeakMap,AC=new WeakSet;class NC extends od{get name(){return"SegmentEvictionCoordinator"}get defaults(){return{enabled:xy("segmentEvictionEnabled"),bufferBehindSeconds:xy("segmentEvictionBufferBehindSeconds"),bufferAheadSeconds:xy("segmentEvictionBufferAheadSeconds"),maxRetainedBytes:xy("segmentEvictionMaxRetainedBytes")}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"evictAtTime"])}constructor(e,t,n={}){super(n),O(this,AC),F(this,TC,void 0),F(this,IC,void 0),F(this,EC,void 0),F(this,SC,void 0),C(TC,this,e),C(IC,this,t),C(EC,this,(e=>A(AC,this,MC).call(this,e))),C(SC,this,(e=>A(AC,this,FC).call(this,e))),M(TC,this)&&"function"==typeof M(TC,this).on&&(M(TC,this).on(iv.TIMELINE_TIME_UPDATE,M(EC,this)),M(TC,this).on(iv.TIMELINE_SEEKED,M(SC,this)))}onDispose(){M(TC,this)&&"function"==typeof M(TC,this).off&&(M(TC,this).off(iv.TIMELINE_TIME_UPDATE,M(EC,this)),M(TC,this).off(iv.TIMELINE_SEEKED,M(SC,this))),C(TC,this,null),C(IC,this,null),C(EC,this,null),C(SC,this,null)}evictAtTime(e){if(!0!==this.settings.enabled)return;const t=Number(e);if(!Number.isFinite(t))return;const n=_C(this.settings.bufferBehindSeconds),i=_C(this.settings.bufferAheadSeconds),r=t-n,o=t+i,s=A(AC,this,CC).call(this);if(!s.length)return;const a=Number(this.settings.maxRetainedBytes);if(Number.isFinite(a)&&a>0&&A(AC,this,OC).call(this,s)<=a)return;const l=new Map;s.forEach((e=>{const t=null==e?void 0:e.nodeId;if(!t)return;const n=sm(e);if(!Number.isFinite(n))return;const i=l.get(t)||[];i.push(e),l.set(t,i)})),l.size&&l.forEach(((e,t)=>{const n=A(AC,this,PC).call(this,t);if(!n)return;const i=e.filter((e=>A(AC,this,RC).call(this,e,r,o)));i.length?A(AC,this,DC).call(this,n,i,r,o):"function"==typeof n.evict&&n.evict()}))}}function MC(e){var t,n;if(!0!==this.settings.enabled)return;if((null===(t=M(TC,this))||void 0===t?void 0:t.state)===hv)return;const i=Number(null==e?void 0:e.time),r=Number.isFinite(i)?i:Number(null===(n=M(TC,this))||void 0===n?void 0:n.currentTime);this.evictAtTime(r)}function FC(e){var t;if(!0!==this.settings.enabled)return;const n=Number(null==e?void 0:e.targetTime),i=Number.isFinite(n)?n:Number(null===(t=M(TC,this))||void 0===t?void 0:t.currentTime);this.evictAtTime(i)}function CC(){var e;const t=null===(e=M(TC,this))||void 0===e?void 0:e.placements;return Array.isArray(t)?t:[]}function OC(e){if(!Array.isArray(e)||!e.length)return 0;const t=new Set;let n=0;return e.forEach((e=>{const i=null==e?void 0:e.nodeId;if(!i||t.has(i))return;t.add(i);const r=A(AC,this,PC).call(this,i),o=Number(null==r?void 0:r.retainedByteLength);Og(o)?n+=o:(Array.isArray(null==r?void 0:r.tracks)?r.tracks:[]).forEach((e=>{(Array.isArray(null==e?void 0:e.segments)?e.segments:[]).forEach((e=>{Og(null==e?void 0:e.retainedByteLength)&&(n+=e.retainedByteLength)}))}))})),n}function PC(e){if(M(IC,this)&&"function"==typeof M(IC,this).get)return M(IC,this).get(e)}function RC(e,t,n){const i=sm(e);if(!Number.isFinite(i))return!1;const r=rm(e,M(IC,this));return(Number.isFinite(r)?i+r:Number.POSITIVE_INFINITY)>t&&i<n}function DC(e,t,n,i){const r=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[];r.length&&r.forEach((e=>{const r=Array.isArray(null==e?void 0:e.segments)?e.segments:[],o=xC(null==e?void 0:e.offset,0);r.forEach((e=>{if(!e||!Og(null==(r=e)?void 0:r.retainedByteLength))return;var r;if(e.isInit)return;let s=!1;for(let r=0;r<t.length;r+=1){const a=t[r],l=sm(a);if(!Number.isFinite(l))continue;const c=xC(null==a?void 0:a.nodeOffsetOverride,0),u=xC(null==e?void 0:e.offset,NaN);if(!Number.isFinite(u))continue;const d=xC(null==e?void 0:e.duration,0),h=l+o+u-c,f=h+(d>0?d:0),p=rm(a,M(IC,this)),m=Number.isFinite(p)?l+p:Number.POSITIVE_INFINITY;if(!(f<=l||h>=m||f<=n||h>=i)){s=!0;break}}s||e.evict()}))}))}var LC=new WeakMap,BC=new WeakMap,zC=new WeakMap,WC=new WeakSet;let $C=class extends od{get name(){return"DocumentVisibility"}get defaults(){return{autoPauseOnVisibilityChange:!0,autoResumeOnVisibilityChange:!0}}constructor(e,t={}){super(t),O(this,WC),F(this,LC,void 0),F(this,BC,null),F(this,zC,!1),C(LC,this,e),A(WC,this,jC).call(this)}onDispose(){A(WC,this,UC).call(this),C(LC,this,null),C(zC,this,!1)}};function jC(){const e=null==ld?void 0:ld.document;e&&"function"==typeof e.addEventListener&&(C(BC,this,(()=>A(WC,this,qC).call(this))),e.addEventListener("visibilitychange",M(BC,this)))}function UC(){const e=null==ld?void 0:ld.document;M(BC,this)&&e&&"function"==typeof e.removeEventListener&&e.removeEventListener("visibilitychange",M(BC,this)),C(BC,this,null)}function qC(){const e=null==ld?void 0:ld.document,t=null==e?void 0:e.visibilityState;"string"==typeof t&&("hidden"!==t?"visible"===t&&A(WC,this,GC).call(this):A(WC,this,VC).call(this))}function VC(){var e;(null===(e=this.settings)||void 0===e?void 0:e.autoPauseOnVisibilityChange)&&M(LC,this)&&"function"==typeof M(LC,this).pause&&(M(LC,this).state===lv?(this.log.info("[#handleHidden] Pausing timeline due to document visibility change"),M(LC,this).pause(),C(zC,this,!0)):C(zC,this,!1))}function GC(){var e;M(zC,this)&&(null===(e=this.settings)||void 0===e?void 0:e.autoResumeOnVisibilityChange)&&M(LC,this)&&"function"==typeof M(LC,this).play&&(M(LC,this).state!==lv?(this.log.info("[#handleVisible] Resuming timeline due to document visibility change"),M(LC,this).play(),C(zC,this,!1)):C(zC,this,!1))}const HC=[{event:"canplay",once:!0,trackAs:"canplay"},{event:"playing",once:!0,trackAs:"startedplaying"},"play","playing","waiting","pause","seeking","seeked","nodestart","nodeend"];function KC(e,t=0){return Number.isFinite(e)?e:t}function XC(e){const t=null==e?void 0:e.exposedPlayerAPI;return t&&"object"==typeof t?t:e}const YC=[function(e){return{schema:"iglu:com.helloeko/player/jsonschema/1-0-7",match:/^.*$/,getData:()=>{var t,n,i;const r=function(e){const t=null==e?void 0:e.exposedPlayerAPI;return t&&"object"==typeof t?t:e}(e);return{playerversion:"string"==typeof(null==r?void 0:r.version)?r.version:"0.0.0",isautoplay:!(null==r||null===(t=r.options)||void 0===t||!t.autoplay),playerqoe:KC(null==r||null===(n=r.qoe)||void 0===n?void 0:n.score),playerqoestatus:"string"==typeof(null==r||null===(i=r.qoe)||void 0===i?void 0:i.status)?r.qoe.status:"",ismuted:!(null==r||!r.muted),playervolume:KC(null==r?void 0:r.volume),playercontainerwidth:KC(null==r?void 0:r.containerWidth),playercontainerheight:KC(null==r?void 0:r.containerHeight)}}}},function(e){return{schema:"iglu:com.helloeko/currentnode/jsonschema/1-0-2",match:/^.*$/,getData:()=>{var t;const n=XC(e),i=function(e){const t=XC(e);if(!t||"function"!=typeof t.getNodesAtTime)return null;const n=Number.isFinite(t.currentTime)?t.currentTime:0,i=t.getNodesAtTime(n);return Array.isArray(i)&&0!==i.length&&i[0]||null}(e);return{currentnodeid:"string"==typeof(null==i?void 0:i.id)?i.id:"",currentnodetime:Number.isFinite(null==n?void 0:n.currentTime)?n.currentTime:0,currentnodeduration:Number.isFinite(null==i?void 0:i.duration)?i.duration:0,currentnodeprofile:"string"==typeof(null==i||null===(t=i.metadata)||void 0===t?void 0:t.profile)?i.metadata.profile:""}}}},function(e){let t=0,n=0;const i=()=>{t||(t=Date.now(),n=0)},r=()=>{t&&!n&&(n=Date.now())};return e&&"function"==typeof e.on&&(e.on("seeking",i),e.on("seeked",r)),{schema:"iglu:com.helloeko/seeked/jsonschema/1-0-0",match:"seeked",getData:()=>{r();const e=t&&n&&n>=t?(n-t)/1e3:0;return t=0,n=0,{seekduration:e}},dispose:()=>{e&&"function"==typeof e.off&&(e.off("seeking",i),e.off("seeked",r))}}},function(){return{schema:"iglu:com.helloeko/environment/jsonschema/1-0-0",match:/^.*$/,getData:()=>{var e;const t=null==ld||null===(e=ld.eko)||void 0===e||null===(e=e.environment)||void 0===e?void 0:e.embeddingApp;return t?{embeddingapp:t}:{}}}}],QC=Object.freeze({once:!1,trackAs:""});var JC=new WeakMap,ZC=new WeakMap,eO=new WeakMap,tO=new WeakMap,nO=new WeakMap,iO=new WeakMap,rO=new WeakSet;class oO extends od{get name(){return"Tracker"}get defaults(){return{tag:null,trackingEnabled:xy("trackingEnabled"),defaultForwarders:HC,defaultContextPackers:YC}}constructor(e,t={}){var n,i;super(t),O(this,rO),F(this,JC,void 0),F(this,ZC,new Map),F(this,eO,[]),F(this,tO,!1),F(this,nO,void 0),F(this,iO,void 0),C(iO,this,!this.settings.tag),C(nO,this,this.settings.tag||(null===(n=crypto)||void 0===n||null===(i=n.randomUUID)||void 0===i?void 0:i.call(n))||`eko-player-${Date.now()}`),C(JC,this,e),A(rO,this,hO).call(this),A(rO,this,aO).call(this)}track(e,...t){if(!this.settings.trackingEnabled)return;if("string"!=typeof e||!e)return void this.log.warn("[track] Expected event to be a non-empty string.");const n=A(rO,this,pO).call(this);n&&n("track",e,...t,M(nO,this))}registerContextPacker(e){if(!e||"object"!=typeof e)return void this.log.warn("[registerContextPacker] Expected a packer object.");const t={tag:M(nO,this),schema:e.schema,match:e.match,getData:A(rO,this,sO).call(this,e.getData)};if("string"!=typeof t.schema||!t.schema)return void this.log.warn('[registerContextPacker] Expected "schema" to be a non-empty string.');if("function"!=typeof t.getData)return void this.log.warn('[registerContextPacker] Expected "getData" to be a function.');if(!this.settings.trackingEnabled)return;const n=A(rO,this,pO).call(this);n&&n("registerContextPacker",t)}onDispose(){if(A(rO,this,dO).call(this),A(rO,this,fO).call(this),C(JC,this,null),M(iO,this)){const e=A(rO,this,pO).call(this);e&&(e("reset",M(nO,this)),C(nO,this,null))}}}function sO(e){return"function"!=typeof e?null:(...t)=>t.pop()!==M(nO,this)?null:e(...t)}function aO(){(Array.isArray(this.settings.defaultForwarders)?this.settings.defaultForwarders:[]).forEach((e=>A(rO,this,lO).call(this,e)))}function lO(e){const t=A(rO,this,cO).call(this,e);if(!t)return void this.log.warn("[#addEventForwarder] Invalid forwarder input.",e);const n=M(JC,this);if(!n||"function"!=typeof n.on)return;const i=A(rO,this,uO).call(this,t);if(M(ZC,this).has(i))return;const r=(...e)=>{t.once&&n&&"function"==typeof n.off&&n.off(t.event,r);const i=t.trackAs||t.event;this.track(i,...e)};n.on(t.event,r),M(ZC,this).set(i,{event:t.event,listener:r})}function cO(e){return"string"==typeof e&&e?{event:e,...QC}:e&&"object"==typeof e&&"string"==typeof e.event&&e.event?{event:e.event,once:!!e.once,trackAs:"string"==typeof e.trackAs?e.trackAs:""}:null}function uO({event:e,once:t,trackAs:n}){return`${e}:${t}:${n}`}function dO(){const e=M(JC,this);e&&"function"==typeof e.off&&M(ZC,this).forEach((({event:t,listener:n})=>{e.off(t,n)})),M(ZC,this).clear()}function hO(){(Array.isArray(this.settings.defaultContextPackers)?this.settings.defaultContextPackers:[]).forEach((e=>{if("function"!=typeof e)return;const t=e(M(JC,this),this);t&&"object"==typeof t&&("function"==typeof t.dispose&&M(eO,this).push(t.dispose),t.disabled||this.registerContextPacker({schema:t.schema,match:t.match,getData:t.getData}))}))}function fO(){M(eO,this).forEach((e=>{try{e()}catch(e){this.log.warn("[#teardownContextPackers] Failed disposing context packer.",e)}})),C(eO,this,[])}function pO(){const e=null==ld?void 0:ld.EkoAnalytics;return"function"==typeof e?e:(A(rO,this,mO).call(this),null)}function mO(){this.settings.trackingEnabled&&!M(tO,this)&&(this.log.warn("EkoAnalytics not found on window."),C(tO,this,!0))}class vO{#E;#re;#oe;#se;#ae;#le;#ce;#ue;#de;#he;#fe;#pe;#me;#ve;#ge;#ye;#be;#ke;#we;constructor(e,t={},n=null){this.#E=new ud(e,t),this.#re=new yd(this.#E,t),this.#oe=new Tk(t),this.#se=new Ny(t),this.#ae=new ok(this.#se,t),this.#le=new ek(this.#ae,this.#oe,t),this.#ce=new fk(this.#le,t),this.#ue=new BM(this.#le,t),this.#de=new $C(this.#ue,t),this.#ke=new NC(this.#ue,this.#le,t),this.#he=new uw(this.#le,this.#ce,this.#oe,this.#ue,t),this.#fe=new Yw(this.#le,this.#ce,this.#ue,t),this.#pe=new sE(t),this.#me=new FE(this.#le,this.#ue,this.#pe,t),this.#ge=new rC(this.#ue,t),this.#we=new oO(n,t);const i=t&&"object"==typeof t?t.adapters:null,r=i&&"object"==typeof i&&"function"==typeof i.renderAdapterFactory?i.renderAdapterFactory:null,o=i&&"object"==typeof i&&"function"==typeof i.audioAdapterFactory?i.audioAdapterFactory:null;this.#ye=r?r({timeline:this.#ue,canvas:this.#E,containerSize:this.#re,options:t}):new Jv(this.#ue,this.#E,this.#re,t),this.#ve=o?o({timeline:this.#ue,decodeCoordinator:this.#me,options:t}):new fA(this.#ue,this.#me,t),this.#be=new OS(this.#ue,this.#ye,t)}get canvas(){return this.#E}get containerSize(){return this.#re}get assetsDeliveryService(){return this.#oe}get downloadSpeed(){return this.#se}get abrSelector(){return this.#ae}get nodeRepository(){return this.#le}get nodePrioritizer(){return this.#ce}get timeline(){return this.#ue}get documentVisibility(){return this.#de}get nodeResolver(){return this.#he}get segmentLoadCoordinator(){return this.#fe}get decoderFactory(){return this.#pe}get parsingManager(){return this.#me}get audioAdapter(){return this.#ve}get audioPlaybackManager(){return this.#ve}get qoe(){return this.#ge}get renderAdapter(){return this.#ye}get renderer(){return this.#ye}get transitionManager(){return this.#be}get tracker(){return this.#we}dispose(){[this.#we,this.#ue,this.#de,this.#fe,this.#he,this.#ce,this.#le,this.#oe,this.#ae,this.#se,this.#me,this.#pe,this.#ve,this.#ge,this.#ye,this.#be,this.#ke,this.#re,this.#E].forEach((e=>{e&&"function"==typeof e.dispose&&e.dispose()})),this.#ue=null,this.#de=null,this.#fe=null,this.#he=null,this.#ce=null,this.#le=null,this.#oe=null,this.#ae=null,this.#se=null,this.#me=null,this.#pe=null,this.#ve=null,this.#ge=null,this.#ye=null,this.#be=null,this.#ke=null,this.#E=null,this.#we=null}}const gO="devops-main.1164319";var yO={isPlainObject:ed,deepMerge:td,get:ty,set:ny,ekoGlobalStore:iy,download:yy,isPositiveNumber:Og,clamp01:nm,root:ld,now:oy,getFrameDimensions:DN,useragent:nv,requestAnimationFrame:Ck,cancelAnimationFrame:Ok,start:jk,stop:Uk,isTicking:qk,predicator:function(e,t){const n=t||{};if("function"!=typeof e)return void Pk.error("[predicator] Bad argument given to predicator, first argument must be a function.",arguments);if(e.apply())return Pk.debug("[predicator] Invoking onFulfilled immediately."),void("function"==typeof n.onFulfilled&&n.onFulfilled.call(null,0));const i=n.timeout||1e4,r=n.interval,o=oy();let s,a,l,c,u;c=function(){e.apply()&&l()},l=function(){Uk(c),ld.clearTimeout(s),u=oy()-o,Pk.debug("[predicator] Invoking onFulfilled after "+u+" ms."),"function"==typeof n.onFulfilled&&n.onFulfilled.call(null,u)},a=function(){Uk(c),u=oy()-o,Pk.debug("[predicator] Invoking onTimeout after "+u+" ms."),"function"==typeof n.onTimeout&&n.onTimeout.call(null,u)},s=ld.setTimeout(a,i),jk(c,r)},createThrottler:Vk,scheduleExecution:Gk},bO=new WeakMap,kO=new WeakMap,wO=new WeakMap,xO=new WeakMap,_O=new WeakMap,TO=new WeakMap,IO=new WeakMap,EO=new WeakSet;class SO{constructor(e){O(this,EO),F(this,bO,[]),F(this,kO,[]),F(this,wO,new tM("placement-")),F(this,xO,new tM("renderplacement-")),F(this,_O,void 0),F(this,TO,new Map),F(this,IO,void 0),C(_O,this,e),C(IO,this,{allowUnready:!0,getNode:e=>A(EO,this,AO).call(this,e)})}get placements(){return M(bO,this).slice()}get renderPlacements(){return M(kO,this).slice()}getNodesAtTime(e){A(EO,this,NO).call(this);const t=A(EO,this,FO).call(this,e);if(!Number.isFinite(t))return[];const n=M(bO,this).filter((e=>am(e,t,null,M(IO,this)))),i=[];return n.forEach((e=>{const t=A(EO,this,AO).call(this,null==e?void 0:e.nodeId);t&&i.push(t)})),i}placeOnTimeline(e,t,n={}){const i=e&&"object"==typeof e?e:null,r=i?i.id:e;if(!r)throw new Error("TimelineDefinition.placeOnTimeline requires node id");i&&M(TO,this).set(r,i);const o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=hm(t);if("string"==typeof t&&t.includes("@")&&!a)throw new Error("TimelineDefinition.placeOnTimeline requires valid placement reference");const{wantsEndOffset:l,endOffsetSeconds:c}=a?{wantsEndOffset:!1}:dm(t,n);let u,d,h,f=!1;const p=null!==a;if(a){const e=M(bO,this).find((e=>(null==e?void 0:e.placementId)===a.placementId));if(!e)throw new Error("TimelineDefinition.placeOnTimeline requires valid placement reference");d=e.placementId,h=a.anchor;const t=sm(e);if("start"===a.anchor)Number.isFinite(t)?u=t:f=!0;else{const n=A(EO,this,MO).call(this,e);Number.isFinite(t)&&n>0?u=t+n:f=!0}}else if(l){const e=n.offsetAnchorPlacementId?M(bO,this).find((e=>(null==e?void 0:e.placementId)===n.offsetAnchorPlacementId)):M(bO,this).length?M(bO,this)[M(bO,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==e?void 0:e.placementId),d){const t=sm(e),n=A(EO,this,MO).call(this,e);Number.isFinite(t)&&n>0?u=t+n-c:(f=!0,h="end")}else u=-c}else u=um(t);const m=M(wO,this).claim(n.placementId),v={placementId:m,nodeId:r,offset:u,offsetPending:f,offsetAnchorPlacementId:f?d:void 0,offsetAnchorEdge:f?h:void 0,offsetAnchorIsReference:f?p:void 0,offsetEndSeconds:l?c:a&&"end"===a.anchor?0:void 0,nodeOffsetOverride:o,nodeDurationOverride:s,loop:!0===n.loop};return M(bO,this).push(v),lm(M(bO,this)),m}placeRenderNodeOnTimeline(e,t,n,i={}){const r="string"==typeof e?e:null==e?void 0:e.type;if(!r||"string"!=typeof r)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires render node type");let o,s,a,l=!1;const c=hm(t);if("string"==typeof t&&t.includes("@")&&!c)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires valid placement reference");const u=null!==c;if(c){const e=M(bO,this).find((e=>(null==e?void 0:e.placementId)===c.placementId));if(!e)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires valid placement reference");s=e.placementId,a=c.anchor;const t=sm(e);if("start"===c.anchor)Number.isFinite(t)?o=t:l=!0;else{const n=A(EO,this,MO).call(this,e);Number.isFinite(t)&&Number.isFinite(n)?o=t+n:l=!0}}else o=um(t);const d=M(xO,this).claim(i.renderPlacementId),h=Number(n),f=h===Number.POSITIVE_INFINITY,p=Number.isFinite(h)&&h>0||f?h:void 0;if(!p)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires a positive duration (seconds) or Infinity as 3rd argument");const m={renderPlacementId:d,type:r,offset:o,offsetPending:l,offsetAnchorPlacementId:l?s:void 0,offsetAnchorEdge:l?a:void 0,offsetAnchorIsReference:l?u:void 0,duration:p,params:i.params&&"object"==typeof i.params?i.params:void 0};if(!l){const e=o,t=o+p;fm(M(kO,this),e,t,"TimelineDefinition.placeRenderNodeOnTimeline does not allow overlapping render nodes")}return M(kO,this).push(m),lm(M(kO,this)),d}}function AO(e){if(e)return M(_O,this)&&"function"==typeof M(_O,this).get?M(_O,this).get(e):M(TO,this).get(e)}function NO(){return cm(M(bO,this),{getPlacementDuration:e=>A(EO,this,MO).call(this,e)}).updated}function MO(e){return rm(e,null,M(IO,this))}function FO(e){if("end"===e){const e=A(EO,this,CO).call(this);if(!Number.isFinite(e))return;return Math.max(0,e-Math.min(e,.001))}const t=Number(e);return Number.isFinite(t)?t:0}function CO(){let e;return M(bO,this).forEach((t=>{const n=sm(t);if(!Number.isFinite(n))return;const i=A(EO,this,MO).call(this,t);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(e)||r>e)&&(e=r)})),e}const OO=new Set(["canplay","play","playing","waiting","pause","seeking","seeked"]);var PO=new WeakMap,RO=new WeakMap,DO=new WeakMap,LO=new WeakMap,BO=new WeakMap,zO=new WeakMap,WO=new WeakMap,$O=new WeakMap,jO=new WeakMap,UO=new WeakMap,qO=new WeakMap,VO=new WeakMap,GO=new WeakMap,HO=new WeakMap,KO=new WeakMap,XO=new WeakMap,YO=new WeakMap,QO=new WeakMap,JO=new WeakMap,ZO=new WeakMap,eP=new WeakMap,tP=new WeakMap,nP=new WeakMap,iP=new WeakMap,rP=new WeakMap,oP=new WeakSet;class sP extends od{get name(){return"EkoPlayer"}get exposedPlayerAPI(){return M(LO,this)}constructor(e,t={}){const{options:n,publicOptions:i}=function(e={}){const t=td({},ky,e);Object.entries(by).forEach((([e,{targetPaths:n}])=>{void 0!==t[e]&&n.forEach((n=>{void 0===ty(t,n)&&ny(t,n,t[e])}))}));const n=function(e){const t={};return Object.keys(by).forEach((n=>{Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})),Object.freeze(t)}(t);return wy.info("Processed options:",t),wy.info("Public options:",n),{options:t,publicOptions:n}}(t);return super(n),O(this,oP),F(this,PO,void 0),F(this,RO,void 0),F(this,DO,void 0),F(this,LO,void 0),F(this,BO,void 0),F(this,zO,void 0),F(this,WO,void 0),F(this,$O,void 0),F(this,jO,void 0),F(this,UO,void 0),F(this,qO,void 0),F(this,VO,void 0),F(this,GO,void 0),F(this,HO,void 0),F(this,KO,void 0),F(this,XO,void 0),F(this,YO,void 0),F(this,QO,void 0),F(this,JO,void 0),F(this,ZO,void 0),F(this,eP,void 0),F(this,tP,void 0),F(this,nP,void 0),F(this,iP,void 0),F(this,rP,0),C(DO,this,i),this.log.info("Initializing EkoPlayer with options:",i),C(VO,this,new vO(e,n,this)),A(oP,this,vP).call(this,M(VO,this)),C(KO,this,(e=>A(oP,this,aP).call(this,e))),M(RO,this)&&"function"==typeof M(RO,this).on&&M(RO,this).on(iv.TIMELINE_CUEPOINT,M(KO,this)),C(XO,this,null),C(QO,this,(e=>A(oP,this,lP).call(this,e))),C(JO,this,(e=>{const t=e&&"object"==typeof e?e:{};A(oP,this,lP).call(this,{...t,event:"seeking"})})),C(ZO,this,(e=>{const t=e&&"object"==typeof e?e:{};A(oP,this,lP).call(this,{...t,event:"seeked"})})),M(RO,this)&&"function"==typeof M(RO,this).on&&(M(RO,this).on(iv.TIMELINE_PLAYER_STATE,M(QO,this)),M(RO,this).on(iv.TIMELINE_SEEKING,M(JO,this)),M(RO,this).on(iv.TIMELINE_SEEKED,M(ZO,this))),C(nP,this,(e=>{const t=e&&"object"==typeof e?e:{};this.trigger(iv.CONTAINER_RESIZE,t)})),M(GO,this)&&"function"==typeof M(GO,this).on&&M(GO,this).on(iv.CONTAINER_RESIZE,M(nP,this)),A(oP,this,hP).call(this),A(oP,this,dP).call(this),C(LO,this,A(oP,this,mP).call(this)),M(LO,this)}onDispose(){M(RO,this)&&"function"==typeof M(RO,this).off&&M(KO,this)&&M(RO,this).off(iv.TIMELINE_CUEPOINT,M(KO,this)),C(KO,this,null),M(RO,this)&&"function"==typeof M(RO,this).off&&(M(QO,this)&&M(RO,this).off(iv.TIMELINE_PLAYER_STATE,M(QO,this)),M(JO,this)&&M(RO,this).off(iv.TIMELINE_SEEKING,M(JO,this)),M(ZO,this)&&M(RO,this).off(iv.TIMELINE_SEEKED,M(ZO,this))),C(QO,this,null),C(JO,this,null),C(ZO,this,null),C(XO,this,null),M(GO,this)&&"function"==typeof M(GO,this).off&&M(nP,this)&&M(GO,this).off(iv.CONTAINER_RESIZE,M(nP,this)),C(nP,this,null),M(qO,this)&&"function"==typeof M(qO,this).off&&(M(eP,this)&&M(qO,this).off("qoescore",M(eP,this)),M(tP,this)&&M(qO,this).off("qoestatus",M(tP,this))),C(eP,this,null),C(tP,this,null),M(UO,this)&&"function"==typeof M(UO,this).off&&M(iP,this)&&M(UO,this).off(iv.DECODER_ERROR,M(iP,this)),C(iP,this,null),C(rP,this,0),M(HO,this)&&"function"==typeof M(HO,this).dispose&&M(HO,this).dispose(),C(HO,this,null),M(VO,this)&&"function"==typeof M(VO,this).dispose&&M(VO,this).dispose(),C(RO,this,null),C(PO,this,null),C(zO,this,null),C(WO,this,null),C($O,this,null),C(jO,this,null),C(UO,this,null),C(qO,this,null),C(GO,this,null),C(BO,this,null),C(LO,this,null),C(VO,this,null)}}function aP(e={}){var t;this.trigger(iv.TIMELINE_CUEPOINT,e);const n="string"==typeof(null==e||null===(t=e.cuepoint)||void 0===t?void 0:t.name)?e.cuepoint.name:"";n&&this.trigger(n,e)}function lP(e={}){const t="string"==typeof(null==e?void 0:e.event)?e.event:"";if(!OO.has(t))return;if("playing"!==t||Number.isFinite(M(YO,this))||(C(YO,this,oy()),this.log.info(`[#handlePlayerStateEvent] Playback started @ ${(M(YO,this)/1e3).toFixed(3)}s (${Date.now()})`)),M(XO,this)===t)return;C(XO,this,t);const n=Number.isFinite(null==e?void 0:e.time)?e.time:M(RO,this)&&Number.isFinite(M(RO,this).currentTime)?M(RO,this).currentTime:0,i={};Number.isFinite(n)&&(i.time=n),"string"==typeof(null==e?void 0:e.from)&&(i.from=e.from),"string"==typeof(null==e?void 0:e.to)&&(i.to=e.to),Number.isFinite(null==e?void 0:e.targetTime)&&(i.targetTime=e.targetTime),Array.isArray(null==e?void 0:e.placements)&&(i.placements=e.placements.slice()),this.trigger(t,i)}function cP(){return new SO(M(PO,this))}function uP(e){if(!e||"object"!=typeof e)throw new Error("EkoPlayer.switchTimeline requires a timeline definition");if(!M(RO,this)||"function"!=typeof M(RO,this).applyTimelineDefinition)throw new Error("EkoPlayer.switchTimeline requires an active timeline");M(RO,this).applyTimelineDefinition(e),"function"==typeof M(RO,this).play&&M(RO,this).play()}function dP(){M(qO,this)&&"function"==typeof M(qO,this).on&&(C(eP,this,(e=>{this.trigger(iv.QOE_SCORE,e)})),C(tP,this,(e=>{this.trigger(iv.QOE_STATUS,e)})),M(qO,this).on(iv.QOE_SCORE,M(eP,this)),M(qO,this).on(iv.QOE_STATUS,M(tP,this)))}function hP(){M(UO,this)&&"function"==typeof M(UO,this).on&&(C(iP,this,(e=>{const t=e&&"object"==typeof e?e:{error:e};this.trigger(iv.DECODER_ERROR,t),A(oP,this,fP).call(this,t)})),M(UO,this).on(iv.DECODER_ERROR,M(iP,this)))}function fP(e={}){var t;const n=M(RO,this);if(!n||"number"!=typeof n.currentTime)return;const i=Date.now();if(i<M(rP,this))return;const r=Number(n.currentTime);if(!Number.isFinite(r))return;const o=Number(null==n||null===(t=n.settings)||void 0===t?void 0:t.snapToFps),s=Number.isFinite(o)&&o>0?1/o:1/60;C(rP,this,i+1500),this.log.warn("[#attemptDecoderRecoverySeek] decoder:error received, attempting seek recovery",null==e?void 0:e.error),n.currentTime=r+s}async function pP(e={}){var t;if(M(HO,this))return M(HO,this);const n=e&&"object"==typeof e&&!Array.isArray(e)?{...e}:{},i=M(BO,this)&&M(BO,this).element?M(BO,this).element:null;if(!i)throw new Error("Debug overlay requires an initialized player canvas and mount element.");const r=function({canvasElement:e,containerElement:t}={}){const n=e&&e.parentNode?e.parentNode:null;if(null==t)return n;const i=function(e,t=(null==ld?void 0:ld.document)){if(cd(e))return e;if("string"!=typeof e)return null;let n=e.trim();if("#"===n.charAt(0)&&(n=n.slice(1)),!n||!t||"function"!=typeof t.getElementById)return null;const i=t.getElementById(n);return cd(i)?i:null}(t,e&&e.ownerDocument?e.ownerDocument:null);if(i)return i;if("string"==typeof t){const e=t.trim(),n="#"===e.charAt(0)?e.slice(1):e;if(!n)throw new Error("Debug overlay containerElement id cannot be empty.");throw new Error(`Debug overlay containerElement id "${n}" was not found.`)}throw new Error("Debug overlay containerElement must be an element id string or DOM element.")}({canvasElement:i,containerElement:n.containerElement});if(!r)throw new Error("Debug overlay requires an initialized player canvas and mount element.");Object.prototype.hasOwnProperty.call(n,"containerElement")&&delete n.containerElement;const o=await Promise.resolve().then((function(){return yD})),s=(null==o?void 0:o.createDebugOverlay)||(null==o?void 0:o.default);if("function"!=typeof s)throw new Error("Debug overlay bundle does not export createDebugOverlay().");return n.publicOptions=M(DO,this),n.playerVersion=gO,C(HO,this,s({mountElement:r,canvasElement:i,timeline:M(RO,this),assetsDeliveryServiceUrl:null===(t=M(VO,this))||void 0===t||null===(t=t.assetsDeliveryService)||void 0===t||null===(t=t.settings)||void 0===t?void 0:t.assetsDeliveryServiceUrl,getNode:e=>M(PO,this)&&"function"==typeof M(PO,this).get?M(PO,this).get(e):void 0,listNodes:()=>M(PO,this)&&"function"==typeof M(PO,this).list?M(PO,this).list():[],downloadSpeed:M(VO,this)?M(VO,this).downloadSpeed:void 0,downloadEvents:Qg,qoe:M(qO,this)?M(qO,this).publicAPI:void 0,qoeEvents:this,options:n,playbackStartedAtMs:M(YO,this)})),M(HO,this)}function mP(){const e=this;return{createTimeline:()=>A(oP,e,cP).call(e),switchTimeline:t=>A(oP,e,uP).call(e,t),play:M(RO,this).play,pause:M(RO,this).pause,reset:M(RO,this).reset,placeOnTimeline:M(RO,this).placeOnTimeline,placeRenderNodeOnTimeline:M(RO,this).placeRenderNodeOnTimeline,addNode:M(PO,this).add,getNode:M(PO,this).get,listNodes:M(PO,this).list,getNodesAtTime:t=>M(RO,e).getNodesAtTime(t),dispose:this.dispose,on:e.on,off:e.off,once:e.once,trigger:e.trigger,transitionTo:(t,n)=>M(WO,e).transitionTo(t,n),track:(t,...n)=>{if(M(jO,e)&&"function"==typeof M(jO,e).track)return M(jO,e).track(t,...n)},seekToPlacement:t=>M(RO,e).seekToPlacement(t),get currentTime(){return M(RO,e).currentTime},set currentTime(t){M(RO,e).currentTime=t},get buffered(){return M(RO,e).buffered},get options(){return M(DO,e)},get containerWidth(){return M(GO,e)?M(GO,e).containerWidth:0},get containerHeight(){return M(GO,e)?M(GO,e).containerHeight:0},get playbackRate(){return M(RO,e).playbackRate},set playbackRate(t){M(RO,e).playbackRate=t},get paused(){return!!M(RO,e)&&!0===M(RO,e).paused},get muted(){return!!M($O,e)&&M($O,e).muted},set muted(t){M($O,e)&&(M($O,e).muted=t)},get volume(){return M($O,e)?M($O,e).volume:1},set volume(t){M($O,e)&&(M($O,e).volume=t)},get qoe(){return M(qO,e)?M(qO,e).publicAPI:void 0},get utils(){return yO},get version(){return gO},loadDebugOverlay:(...t)=>A(oP,e,pP).call(e,...t)}}function vP(e){e&&(C(BO,this,e.canvas),C(PO,this,e.nodeRepository),C(RO,this,e.timeline),C($O,this,e.audioAdapter||e.audioPlaybackManager),C(jO,this,e.tracker),C(UO,this,e.parsingManager),C(qO,this,e.qoe),C(zO,this,e.renderAdapter||e.renderer),C(WO,this,e.transitionManager),C(GO,this,e.containerSize))}class gP{constructor({target:e,props:t}){if(!e)throw new Error("`options.target` is required");go(this.#xe,t,!0),this.#xe.v.EkoPlayer=sP;const n=e.hasChildNodes()?oa:ra;this.#_e=n(Pu,{target:e,props:this.#xe.v})}#_e;#xe=Si(mo(_o({})),"EkoGallery.#props");destroy(e){if(this.#_e)return ca(this.#_e,e)}get props(){return Ds(this.#xe)}}const yP=u("gallery-react");const bP=e.forwardRef(((t,n)=>{const{config:i,debug:r,ssrHtml:o,activeItem:s={index:0,step:0},forceMobile:a,videoAspectRatio:l,onEvent:c=()=>{}}=t,u=e.useRef(null),d=e.useRef({}),h=function(e){return void 0!==e}(i),f=e.useRef(s),p=e.useRef(o);d.current.initEventSent||(c("galleryinit"),d.current.initEventSent=!0);const m=e.useCallback((e=>{d.current.state=e,e.activeItemIndex===f.current.index&&e.activeModuleIndex===f.current.step||c("activeitemchanged",{index:e.activeItemIndex,step:e.activeModuleIndex})}),[]),v=e.useCallback((e=>{d.current.API=e,0===f.current.index&&0===f.current.step||e.selectItemAndStep(f.current.index,f.current.step),d.current.unsubscribe&&d.current.unsubscribe(),d.current.unsubscribe=e.subscribe(m)}),[]),g=e.useCallback(((e,t)=>{c(e,t)}),[c]);return e.useEffect((()=>(yP.setDataStorage("gallery-react",{config:i}),window.eko=window.eko||{},window.eko.config=i,window.eko.gallery={version:"devops-main/4.0.8"},()=>{window.eko.config=void 0})),[i]),e.useImperativeHandle(n,(()=>({prev:()=>{var e;null===(e=d.current.API)||void 0===e||e.prev()},next:()=>{var e;null===(e=d.current.API)||void 0===e||e.next()}}))),e.useEffect((()=>{if(null==u||!u.current)return;const e=u.current;return d.current.app=new gP({target:e,props:{config:i,forceMobile:a,videoAspectRatio:l,hideNav:!0,onGalleryReady:v,onEvent:g}}),()=>{var e;null===(e=d.current.app)||void 0===e||e.destroy()}}),[]),e.useEffect((()=>{d.current.app&&(d.current.app.props.config=i)}),[i]),e.useEffect((()=>{d.current.app&&(d.current.app.props.debug=r,d.current.app.props.forceMobile=a,d.current.app.props.videoAspectRatio=l,d.current.app.props.onEvent=g)}),[r,a,l,g]),e.useEffect((()=>{f.current=s,d.current.state&&(d.current.state.activeItemIndex===s.index&&d.current.state.activeModuleIndex===s.step||d.current.API.selectItemAndStep(s.index,s.step))}),[s]),h?e.createElement("div",R({style:{position:"relative",width:"100%",height:"100%"},ref:u},p.current?{dangerouslySetInnerHTML:{__html:p.current}}:{})):t.children}));bP.propTypes={className:Te.string,config:Te.object,variantId:Te.string,onEvent:Te.func,ssrHtml:Te.string,videoAspectRatio:Te.string,debug:Te.bool,activeItem:Te.shape({index:Te.number,step:Te.number}),forceMobile:Te.bool,instanceId:Te.string,children:Te.node},bP.displayName="EkoGallerySvelte";const kP=n("v2"),wP=n("v1"),xP="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{},_P=xP&&xP.performance,TP=_P&&"function"==typeof _P.now?()=>_P.now():()=>Date.now(),IP=Object.freeze({NODE_ADD:"node:add",NODE_CHILDREN_CHANGED:"node:childrenchanged",NODE_LOADED:"node:loaded",NODE_LOAD_ERROR:"node:loaderror",PLACEMENT_ADDED:"placement:added",RENDER_PLACEMENT_ADDED:"renderplacement:added",TIMELINE_TIME_UPDATE:"timeline:timeupdate",TIMELINE_STATE_CHANGE:"statechange",TIMELINE_SEEKING:"seeking",TIMELINE_SEEKED:"seeked",TIMELINE_RESET:"timeline:reset",TIMELINE_PLAYER_STATE:"player:state",TIMELINE_CUEPOINT:"cuepoint",VISUAL_FRAMES_AVAILABLE:"visualframesavailable",TRACK_BUFFER_UPDATE:"track:bufferupdate",TRACK_READY:"track:ready",TRACK_UNDERFLOW:"track:underflow",CLOCK_TICK:"tick",DECODE_READY:"decode:ready",DECODE_ERROR:"decode:error",DECODER_AUDIO:"decoder:audio",DECODER_FRAME:"decoder:frame",DECODER_INIT:"decoder:init",DECODER_ERROR:"decoder:error",QOE_SCORE:"qoescore",QOE_STATUS:"qoestatus",CONTAINER_RESIZE:"containerresize"}),EP=["ui-monospace,","SFMono-Regular,","Menlo,","Monaco,","Consolas,",'"Liberation Mono",','"Courier New",',"monospace"].join(" "),SP=`11px ${EP}`,AP=`12px ${EP}`;function NP(e){return"number"==typeof e&&Number.isFinite(e)}function MP(e){return NP(e)&&e>0}function FP(e){return NP(e)?Math.min(1,Math.max(0,e)):0}function CP(e,t=3){return NP(e)?e.toFixed(t):String(e)}function OP(e,t){const n=Number(e),i=Number(t);return!Number.isFinite(n)||!Number.isFinite(i)||n<=0||i<=0?"n/a":`${Math.round(n)}x${Math.round(i)}`}var PP=new WeakMap,RP=new WeakMap,DP=new WeakMap,LP=new WeakMap,BP=new WeakMap,zP=new WeakMap,WP=new WeakMap,$P=new WeakSet;class jP{constructor({width:e=220,height:t=48,windowMs:n=6e4,maxValue:i=60,autoScale:r=!1,formatValue:o}={}){O(this,$P),F(this,PP,void 0),F(this,RP,void 0),F(this,DP,[]),F(this,LP,void 0),F(this,BP,void 0),F(this,zP,void 0),F(this,WP,void 0);const s=null==xP?void 0:xP.document;if(!s||"function"!=typeof s.createElement)throw new Error("Debug overlay graph requires document.createElement.");C(PP,this,s.createElement("canvas")),M(PP,this).width=e,M(PP,this).height=t,M(PP,this).style.width=`${e}px`,M(PP,this).style.height=`${t}px`,M(PP,this).style.borderRadius="6px",M(PP,this).style.background="#111",C(RP,this,M(PP,this).getContext("2d")),C(LP,this,n),C(BP,this,i),C(zP,this,!!r),C(WP,this,"function"==typeof o?o:null)}get element(){return M(PP,this)}push(e,t){if(M(PP,this)&&M(RP,this)&&Number.isFinite(e)&&Number.isFinite(t)){for(M(DP,this).push({t:t,v:e});M(DP,this).length&&t-M(DP,this)[0].t>M(LP,this);)M(DP,this).shift();A($P,this,UP).call(this)}}dispose(){C(DP,this,[]),C(RP,this,null),C(PP,this,null)}}function UP(){const e=M(RP,this),t=M(PP,this);if(!e||!t)return;const n=t.width,i=t.height;if(!n||!i)return;if(e.clearRect(0,0,n,i),e.fillStyle="#111",e.fillRect(0,0,n,i),!M(DP,this).length)return;const r=M(DP,this)[0].t;if(!(M(DP,this)[M(DP,this).length-1].t>r))return;const o=M(zP,this)?M(DP,this).reduce(((e,t)=>t.v>e?t.v:e),0):M(BP,this),s=o>0?o:M(BP,this);e.strokeStyle="#0f0",e.lineWidth=2,e.beginPath();for(let t=0;t<M(DP,this).length;t+=1){const o=M(DP,this)[t],a=(o.t-r)/M(LP,this)*n,l=i-(s>0?Math.min(1,Math.max(0,o.v/s)):0)*i;0===t?e.moveTo(a,l):e.lineTo(a,l)}e.stroke();const a=M(DP,this).length?M(DP,this)[M(DP,this).length-1]:null,l=Number.isFinite(null==a?void 0:a.v)?a.v:null;if(null===l)return;const c=M(WP,this)?M(WP,this).call(this,l):l.toFixed(1);if("string"!=typeof c||!c)return;e.font=SP,e.textAlign="right",e.textBaseline="top";const u=e.measureText(c),d=Math.ceil(u.width)+8,h=n-d-2;e.fillStyle="rgba(0,0,0,0.55)",e.fillRect(h,2,d,14),e.fillStyle="#fff",e.fillText(c,n-2-4,4)}const qP=new Intl.NumberFormat("en-US");function VP(e,t){const n=(null==e?void 0:e.trackId)||"",i=(null==t?void 0:t.trackId)||"";if(n!==i)return n<i?-1:1;const r=(null==e?void 0:e.nodeId)||"",o=(null==t?void 0:t.nodeId)||"";if(r!==o)return r<o?-1:1;const s=(null==e?void 0:e.segmentId)||"",a=(null==t?void 0:t.segmentId)||"";return s!==a?s<a?-1:1:("number"==typeof(null==e?void 0:e.presentationTime)?e.presentationTime:0)-("number"==typeof(null==t?void 0:t.presentationTime)?t.presentationTime:0)}function GP(e,t){for(e.push(t);e.length&&t-e[0]>1e3;)e.shift();if(e.length<2)return 0;const n=e[e.length-1]-e[0];return n<=0?0:1e3*(e.length-1)/n}function HP(e,t){if("function"!=typeof e||!t)return;const n=e(t.nodeId),i=null==n?void 0:n.tracks;if(!Array.isArray(i))return;const r=i.find((e=>(null==e?void 0:e.id)===t.trackId)),o=null==r?void 0:r.segments;return Array.isArray(o)?o.find((e=>(null==e?void 0:e.id)===t.segmentId)):void 0}function KP(e,t){var n;const i=HP(e,t);return(null==i?void 0:i.abrDecision)||(null==i||null===(n=i.chosenRepresentation)||void 0===n?void 0:n.abrDecision)}function XP(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"n/a":`${qP.format(Math.round(t))}kbps`}function YP(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"n/a":`${qP.format(Math.round(t/1e3))}kbps`}function QP(e,t=3){const n=Number(e);return Number.isFinite(n)?n.toLocaleString("en-US",{minimumFractionDigits:t,maximumFractionDigits:t}):String(e)}function JP(e,t){var n;if("function"!=typeof e||!t)return;const i=e(t.nodeId),r=null==i||null===(n=i.manifestRef)||void 0===n?void 0:n.encodeProfile;return"string"==typeof r&&r?r:void 0}function ZP(e,t){if("function"!=typeof e||!t)return;const n=e(t.nodeId);return!0===(null==n?void 0:n.imageFallbackActive)?"image":void 0}function eR(e,t){const n=function(e){if(!e)return;const t=[[e.displayWidth,e.displayHeight],[e.codedWidth,e.codedHeight],[e.videoWidth,e.videoHeight],[e.naturalWidth,e.naturalHeight],[e.width,e.height]];for(let e=0;e<t.length;e+=1){const[n,i]=t[e],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}(null==t?void 0:t.frame)||{},i=Number.isFinite(null==t?void 0:t.width)?t.width:n.width,r=Number.isFinite(null==t?void 0:t.height)?t.height:n.height,o=function(e,t,n){return null===(n=HP(e,t))||void 0===n?void 0:n.chosenRepresentation}(e,t);if(!o)return NP(i)&&NP(r)?{width:i,height:r}:null;const s=o.width||o.codedWidth||i,a=o.height||o.codedHeight||r;return{id:o.id,codecs:o.codecs,mime:o.mime,bandwidth:o.bandwidth,width:s,height:a}}function tR(e){const t=Number(e);if(Number.isFinite(t)&&!(t<=0))return t/1e3}function nR(e,t){const n=Number(null==e?void 0:e.bandwidthKbps),i=Number(null==t?void 0:t.bandwidthKbps),r=Number.isFinite(n)&&n>0,o=Number.isFinite(i)&&i>0;if(r&&o&&n!==i)return n-i;if(r!==o)return r?-1:1;const s=(null==e?void 0:e.id)||"",a=(null==t?void 0:t.id)||"";return s===a?0:s<a?-1:1}function iR(e,t,n,i){const r=[];if(Array.isArray(null==i?void 0:i.availableRepresentations)&&i.availableRepresentations.forEach((e=>{const t="string"==typeof(null==e?void 0:e.id)&&e.id?e.id:void 0;if(!t)return;const n=Number(null==e?void 0:e.bandwidthKbps);r.push({id:t,bandwidthKbps:Number.isFinite(n)&&n>0?n:void 0})})),!r.length){const n=HP(e,t);(Array.isArray(null==n?void 0:n.representations)?n.representations:[]).forEach((e=>{const t="string"==typeof(null==e?void 0:e.id)&&e.id?e.id:void 0;t&&r.push({id:t,bandwidthKbps:tR(null==e?void 0:e.bandwidth)})}))}!r.length&&(null==n?void 0:n.id)&&r.push({id:n.id,bandwidthKbps:tR(n.bandwidth)});const o=new Map;return r.forEach((e=>{const t=null==e?void 0:e.id;t&&!o.has(t)&&o.set(t,e)})),Array.from(o.values()).sort(nR)}const rR=1024,oR=1048576,sR=1073741824;function aR(e){return NP(e)?e>=1e3?`${CP(e/1e3,1)} Mbps`:`${CP(e,1)} kbps`:"n/a"}function lR({downloadSpeed:e,downloadEvents:t}={}){const n=xP.document,i="function"==typeof(null==e?void 0:e.getKbps)?e.getKbps():void 0;let r=0;const{metricsRow:o,setInitial:s,setTotal:a}=function(e){const t=e.createElement("div");t.style.display="grid",t.style.gridTemplateColumns="1fr 1fr",t.style.gap="8px",t.style.font=AP;const n=e.createElement("div"),i=e.createElement("div");return t.appendChild(n),t.appendChild(i),{metricsRow:t,setInitial:e=>{n.textContent=`initial=${aR(e)}`},setTotal:e=>{var t;i.textContent="total="+(NP(t=e)?t<rR?`${Math.round(t)} B`:t<oR?`${CP(t/rR,1)} KB`:t<sR?`${CP(t/oR,2)} MB`:`${CP(t/sR,2)} GB`:"n/a")}}}(n),{graphWrap:l,speedGraph:c}=function(e,t){const n=e.createElement("div");n.style.marginTop="10px";const i=e.createElement("div");i.textContent="download speed",i.style.font=SP,i.style.opacity="0.9";const r=NP(t)&&t>0?t:1,o=new jP({autoScale:!0,maxValue:r,formatValue:aR});return n.appendChild(i),n.appendChild(o.element),{graphWrap:n,speedGraph:o}}(n,i);s(i),a(r);const u=e=>{const t=Number(null==e?void 0:e.kbps);Number.isFinite(t)&&c.push(t,null!=xP&&xP.performance&&"function"==typeof xP.performance.now?xP.performance.now():Date.now())},d=e=>{const t=Number(null==e?void 0:e.bytes);Number.isFinite(t)&&(r+=t,a(r))};return e&&"function"==typeof e.on&&e.on("download:speed",u),t&&"function"==typeof t.on&&t.on("download:sample",d),{id:"downloads",title:"Downloads",render:e=>{e.appendChild(o),e.appendChild(l)},dispose:()=>{e&&"function"==typeof e.off&&e.off("download:speed",u),t&&"function"==typeof t.off&&t.off("download:sample",d),c.dispose()}}}function cR(e){return NP(e)?CP(e,3):"n/a"}function uR(){return null!=xP&&xP.performance&&"function"==typeof xP.performance.now?xP.performance.now():Date.now()}var dR,hR,fR,pR={exports:{}},mR=(dR||(dR=1,hR=pR,function(e,t){hR.exports?hR.exports=t():e.log=t()}(pR.exports,(function(){var e=function(){},t="undefined",n=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],r={},o=null;function s(e,t){var n=e[t];if("function"==typeof n.bind)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch(t){return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function a(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function l(){for(var n=this.getLevel(),r=0;r<i.length;r++){var o=i[r];this[o]=r<n?e:this.methodFactory(o,n,this.name)}if(this.log=this.debug,typeof console===t&&n<this.levels.SILENT)return"No console available for logging"}function c(e){return function(){typeof console!==t&&(l.call(this),this[e].apply(this,arguments))}}function u(i,r,o){return"debug"===(l=i)&&(l="log"),typeof console!==t&&("trace"===l&&n?a:void 0!==console[l]?s(console,l):void 0!==console.log?s(console,"log"):e)||c.apply(this,arguments);var l}function d(e,n){var s,a,c,d=this,h="loglevel";function f(){var e;if(typeof window!==t&&h){try{e=window.localStorage[h]}catch(e){}if(typeof e===t)try{var n=window.document.cookie,i=encodeURIComponent(h),r=n.indexOf(i+"=");-1!==r&&(e=/^([^;]+)/.exec(n.slice(r+i.length+1))[1])}catch(e){}return void 0===d.levels[e]&&(e=void 0),e}}function p(e){var t=e;if("string"==typeof t&&void 0!==d.levels[t.toUpperCase()]&&(t=d.levels[t.toUpperCase()]),"number"==typeof t&&t>=0&&t<=d.levels.SILENT)return t;throw new TypeError("log.setLevel() called with invalid level: "+e)}"string"==typeof e?h+=":"+e:"symbol"==typeof e&&(h=void 0),d.name=e,d.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},d.methodFactory=n||u,d.getLevel=function(){return null!=c?c:null!=a?a:s},d.setLevel=function(e,n){return c=p(e),!1!==n&&function(e){var n=(i[e]||"silent").toUpperCase();if(typeof window!==t&&h){try{return void(window.localStorage[h]=n)}catch(e){}try{window.document.cookie=encodeURIComponent(h)+"="+n+";"}catch(e){}}}(c),l.call(d)},d.setDefaultLevel=function(e){a=p(e),f()||d.setLevel(e,!1)},d.resetLevel=function(){c=null,function(){if(typeof window!==t&&h){try{window.localStorage.removeItem(h)}catch(e){}try{window.document.cookie=encodeURIComponent(h)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(e){}}}(),l.call(d)},d.enableAll=function(e){d.setLevel(d.levels.TRACE,e)},d.disableAll=function(e){d.setLevel(d.levels.SILENT,e)},d.rebuild=function(){if(o!==d&&(s=p(o.getLevel())),l.call(d),o===d)for(var e in r)r[e].rebuild()},s=p(o?o.getLevel():"WARN");var m=f();null!=m&&(c=p(m)),l.call(d)}(o=new d).getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=r[e];return t||(t=r[e]=new d(e,o.methodFactory)),t};var h=typeof window!==t?window.log:void 0;return o.noConflict=function(){return typeof window!==t&&window.log===o&&(window.log=h),o},o.getLoggers=function(){return r},o.default=o,o}))),pR.exports),vR=(fR=mR)&&fR.__esModule&&Object.prototype.hasOwnProperty.call(fR,"default")?fR.default:fR;const gR=()=>{},yR=["trace","log","debug","info","warn","error","getLevel","setLevel"],bR=["trace","debug","info","warn","error","silent"],kR={TRACE:"color: white; background-color: magenta;",DEBUG:"color: black; background-color: turquoise;",INFO:"color: white; background-color: green;",WARN:"color: black; background-color: yellow;",ERROR:"color: white; background-color: red;"},wR="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global;let xR={level:"trace",appName:""},_R=[];const TR="object"==typeof wR&&wR.performance&&"function"==typeof wR.performance.now?wR.performance.now.bind(wR.performance):Date.now.bind(Date),IR=e=>e&&"string"==typeof e?e.toLowerCase().trim():"",ER=(()=>{try{const e=new URLSearchParams(document.location.search),t=[].concat(e.getAll("log")).concat(e.getAll("ekolog")).concat(e.getAll("ekologger")).join(",").split(",");if(0===t.length)return{};let n={};return t.forEach((e=>{const[t,i]=e.split(":");n[IR(t)]=IR(i)||"trace"})),n}catch(e){return{}}})(),SR=(e,t="")=>{const n=IR(e),i=vR.getLogger(n);if(i.__ekologger)return i.__ekologger;t||ER[n]||ER["*"]||(i.__noExplicitLevel=!0);const r=i.methodFactory;i.methodFactory=(t,n,i)=>{const o=r(t,n,i),s=t.toUpperCase();return(...t)=>{o(`[${((e,t=3)=>(TR()/1e3).toFixed(t))()}] %c[${s}] ${xR.appName?`[${xR.appName}] `:""}[${e}]`,kR[s],...t)}},t=ER[n]||ER["*"]||t||xR.level,i.setLevel(t,!1);const o=(...e)=>i.log(...e);return yR.forEach((e=>{o[e]=(...t)=>(_R.forEach((n=>{n[e](...t)})),i[e](...t))})),i.__ekologger=o,o};SR.setDefaults=({appName:e="",level:t})=>{e&&"string"==typeof e&&(xR.appName=e),(t=IR(t))&&bR.includes(t)&&(xR.level=t,Object.values(vR.getLoggers()).filter((e=>e.__noExplicitLevel)).forEach((e=>e.setLevel(xR.level,!1))))},SR.installDriver=e=>{const t={...yR.reduce(((t,n)=>(t[n]="function"==typeof(null==e?void 0:e[n])?e[n]:gR,t)),{})};_R.push(t)},SR("download","warn");Object.freeze(Object.entries({disabledTracks:{default:["audio"],targetPaths:["NodeRepository.disabledTracks"]},muted:{default:!1,targetPaths:["AudioPlaybackManager.muted"]},volume:{default:1,targetPaths:["AudioPlaybackManager.volume"]},encodeProfile:{default:null,targetPaths:["AssetsDeliveryService.profile"]},forceVideoCodec:{default:void 0,targetPaths:["NodeRepository.forceVideoCodec"]},forceImageFallback:{default:!1,targetPaths:["NodeRepository.forceImageFallback"]},mediaHostRewriteMap:{default:{"storageeko.s3.amazonaws.com":"https://storage.eko.com","studioz-post.s3.amazonaws.com":"https://studioz-post.eko.com"},targetPaths:["NodeRepository.mediaHostRewriteMap"]},playbackRate:{default:1,targetPaths:["PlaybackClock.playbackRate"]},initialKbps:{default:"auto",targetPaths:["DownloadSpeed.initialKbps"]},defaultRenderParams:{default:void 0,targetPaths:["Renderer.defaultRenderParams"]},maxBufferedVideoFrames:{default:24,targetPaths:["Timeline.maxBufferedVideoFrames"]},waitingBufferAheadSeconds:{default:3,targetPaths:["Timeline.waitingBufferAheadSeconds"]},abrStrategy:{default:"auto",targetPaths:["ABRSelector.abrStrategy"]},segmentEvictionEnabled:{default:!0,targetPaths:["SegmentEvictionCoordinator.enabled"]},segmentEvictionBufferBehindSeconds:{default:30,targetPaths:["SegmentEvictionCoordinator.bufferBehindSeconds"]},segmentEvictionBufferAheadSeconds:{default:30,targetPaths:["SegmentEvictionCoordinator.bufferAheadSeconds"]},segmentEvictionMaxRetainedBytes:{default:52428800,targetPaths:["SegmentEvictionCoordinator.maxRetainedBytes"]},autoplay:{default:!0,targetPaths:["Idle.autoplay"]},autoPauseOnVisibilityChange:{default:!0,targetPaths:["DocumentVisibility.autoPauseOnVisibilityChange"]},autoResumeOnVisibilityChange:{default:!0,targetPaths:["DocumentVisibility.autoResumeOnVisibilityChange"]},trackingEnabled:{default:!0,targetPaths:["Tracker.trackingEnabled"]}}).reduce(((e,[t,n])=>(Object.prototype.hasOwnProperty.call(n,"default")&&(e[t]=n.default),e)),{})),SR("config","warn");const AR=18,NR="rgba(83,170,255,0.9)",MR={pending:"rgba(255,255,255,0.55)",resolving:"rgba(255,200,87,0.9)",ready:"rgba(102,214,141,0.9)",failed:"rgba(255,92,92,0.9)",missing:"rgba(160,160,160,0.9)"},FR={border:"1px solid rgba(102,214,141,0.28)",background:"rgba(102,214,141,0.16)",color:"rgba(167,240,185,1)"},CR={border:"1px solid rgba(255,200,87,0.3)",background:"rgba(255,200,87,0.16)",color:"rgba(255,227,171,1)"},OR="noop",PR="seek",RR="copy-node-id",DR="copy-node-context",LR="copy-source-video-url",BR=[{value:OR,label:"NOOP"},{value:PR,label:"Seek"},{value:RR,label:"Copy Node ID"},{value:DR,label:"Copy Node Context"},{value:LR,label:"Copy Source Video URL"}],zR=["type","url","mimeType","assetId","assetRevision","encodeProfile","duration","width","height"],WR=["id","url","mime","codecs","baseCodec","bandwidth","timescale","sizeBytes","width","height","frameRate","segStart","segDuration"];function $R(e,t){if(MP(null==e?void 0:e.nodeDurationOverride))return e.nodeDurationOverride;if("function"!=typeof t)return null;const n=t(null==e?void 0:e.nodeId),i=null==n?void 0:n.duration;return MP(i)?i:null}function jR(e){const t=Number(null==e?void 0:e.duration);return t===Number.POSITIVE_INFINITY?Number.POSITIVE_INFINITY:MP(t)?t:null}function UR(e){return e===Number.POSITIVE_INFINITY}function qR(e){return NP(e)?String(e):""}function VR(e,t=[]){return t.reduce(((t,n)=>(void 0!==(null==e?void 0:e[n])&&(t[n]=e[n]),t)),{})}function GR(e){const t=BR.find((t=>t.value===e));return t?t.value:OR}function HR(e){return e?"string"==typeof(null==e?void 0:e.message)&&e.message?e.message:"string"==typeof e&&e?e:null:null}function KR(e){return e&&NP(e.start)&&NP(e.end)?{start:e.start,end:e.end}:null}function XR(e){return e?VR(e,WR):null}function YR(e,t){const n="string"==typeof(null==e?void 0:e.nodeId)?e.nodeId:"",i="function"==typeof t&&n?t(n):null,r=function(e){return e?"string"==typeof e?e:VR(e,zR):null}(null==i?void 0:i.manifestRef),o=r&&"object"==typeof r?r.assetId:void 0,s={placement:{placementId:"string"==typeof(null==e?void 0:e.placementId)?e.placementId:void 0,nodeId:n||void 0,offset:NP(null==e?void 0:e.offset)?e.offset:void 0,duration:$R(e,t),offsetPending:!0===(null==e?void 0:e.offsetPending),nodeOffsetOverride:NP(null==e?void 0:e.nodeOffsetOverride)?e.nodeOffsetOverride:void 0,nodeDurationOverride:NP(null==e?void 0:e.nodeDurationOverride)?e.nodeDurationOverride:void 0},node:i?{id:i.id||n||void 0,state:"string"==typeof i.state?i.state:void 0,duration:NP(i.duration)?i.duration:null,mainTrackId:"string"==typeof i.mainTrackId?i.mainTrackId:void 0,assetId:"string"==typeof o?o:void 0,manifestRef:r,buffered:KR(i.buffered),imageFallbackActive:!0===i.imageFallbackActive,retainedByteLength:NP(i.retainedByteLength)?i.retainedByteLength:0,children:Array.isArray(i.children)?i.children.map((e=>({nodeId:"string"==typeof(null==e?void 0:e.nodeId)?e.nodeId:void 0,weight:NP(null==e?void 0:e.weight)?e.weight:void 0}))):[],tracks:Array.isArray(i.tracks)?i.tracks.map((e=>function(e){return e?{id:e.id,type:e.type,offset:NP(e.offset)?e.offset:0,duration:NP(e.duration)?e.duration:null,endTime:NP(e.endTime)?e.endTime:null,buffered:KR(e.buffered),segments:Array.isArray(e.segments)?e.segments.map((e=>function(e){if(!e)return null;const t={id:e.id,isInit:!0===e.isInit,offset:NP(e.offset)?e.offset:0,duration:NP(e.duration)?e.duration:0,bufferedRatio:NP(e.bufferedRatio)?e.bufferedRatio:0,retainedByteLength:NP(e.retainedByteLength)?e.retainedByteLength:0,isLoaded:!0===e.isLoaded,loadAttempts:NP(Number(e.loadAttempts))?Number(e.loadAttempts):0,appliedFilters:Array.isArray(e.appliedFilters)?e.appliedFilters.slice():[],chosenRepresentation:XR(e.chosenRepresentation),representations:Array.isArray(e.representations)?e.representations.map((e=>XR(e))).filter(Boolean):[]},n=HR(e.loadError);return n&&(t.loadError=n),t}(e))).filter(Boolean):[]}:null}(e))).filter(Boolean):[]}:null};if(i){const e=Number(i.manifestLoadAttempts);NP(e)&&e>0&&(s.node.manifestLoadAttempts=e);const t=HR(i.manifestLoadError);t&&(s.node.manifestLoadError=t);const n=HR(i.error);n&&(s.node.error=n)}return s}function QR(e=[],t=[],n){const i=function(e=[],t){return Array.isArray(e)&&e.length?e.map((e=>e?["string"==typeof e.placementId?e.placementId:"","string"==typeof e.nodeId?e.nodeId:"",qR(e.offset),qR($R(e,t)),!0===e.offsetPending?"1":"0",qR(e.nodeOffsetOverride),qR(e.nodeDurationOverride)].join("|"):"null")).join(";"):""}(e,n);return`${i}::${function(e=[]){return Array.isArray(e)&&e.length?e.map((e=>{if(!e)return"null";const t="string"==typeof e.renderPlacementId?e.renderPlacementId:"",n="string"==typeof e.type?e.type:"",i=qR(e.offset),r=jR(e);return[t,n,i,r===Number.POSITIVE_INFINITY?"inf":qR(r),!0===e.offsetPending?"1":"0"].join("|")})).join(";"):""}(t)}`}function JR(e=[],t){if(!Array.isArray(e)||!e.length)return!1;for(let n=0;n<e.length;n+=1){const i=e[n];if(!i||!0===i.offsetPending)continue;if(MP(i.nodeDurationOverride))continue;if("function"!=typeof t)return!0;const r=t(i.nodeId);if(!MP(null==r?void 0:r.duration))return!0}return!1}function ZR(e=[]){return!(!Array.isArray(e)||!e.length)&&e.some((e=>!0===(null==e?void 0:e.offsetPending)))}function eD(e=[],t=[]){return ZR(e)||ZR(t)}function tD(e,t=[],n){if(!e||!Array.isArray(t)||!t.length)return;const i=e.querySelector('[data-segment-boundary="true"]');t.forEach((t=>{if(!t||!NP(t.startRatio)||!NP(t.endRatio))return;const r=FP(t.startRatio),o=FP(t.endRatio);if(!(o>r))return;const s=xP.document.createElement("div");s.dataset.bufferedSegment="true",s.style.position="absolute",s.style.top="0",s.style.bottom="0",s.style.left=100*r+"%",s.style.width=100*(o-r)+"%",s.style.background=n,s.style.opacity="0.8",s.style.pointerEvents="none",s.style.zIndex="0",i?e.insertBefore(s,i):e.appendChild(s)}))}function nD(e,t){if(!e)return;const n=e.querySelector('[data-active-highlight="true"]');if(!t)return void(n&&n.remove());if(n)return;const i=xP.document.createElement("div");i.dataset.activeHighlight="true",i.style.position="absolute",i.style.top="0",i.style.bottom="0",i.style.left="0",i.style.right="0",i.style.border="1px solid rgba(255,255,255,0.9)",i.style.borderRadius="4px",i.style.pointerEvents="none",i.style.zIndex="1",e.appendChild(i)}function iD({timeline:e,getNode:t,assetsDeliveryServiceUrl:n}={}){const i=null==xP?void 0:xP.document;if(!i||"function"!=typeof i.createElement)throw new Error("Debug overlay timeline tab requires document.createElement.");const r=i.createElement("div");r.style.display="flex",r.style.flexDirection="column",r.style.gap="8px",r.style.position="relative";const o=i.createElement("div");o.style.position="absolute",o.style.display="none",o.style.pointerEvents="none",o.style.zIndex="2",o.style.padding="4px 6px",o.style.borderRadius="6px",o.style.background="rgba(0,0,0,0.8)",o.style.border="1px solid rgba(255,255,255,0.2)",o.style.color="#fff",o.style.font=SP,o.style.maxWidth="220px",o.style.whiteSpace="nowrap",o.style.overflow="hidden",o.style.textOverflow="ellipsis";const s=i.createElement("div");s.dataset.timelineHoverDetails="true",s.style.position="absolute",s.style.display="none",s.style.pointerEvents="none",s.style.zIndex="3",s.style.padding="6px 8px",s.style.borderRadius="8px",s.style.background="rgba(0,0,0,0.85)",s.style.border="1px solid rgba(255,255,255,0.25)",s.style.color="#fff",s.style.font=SP,s.style.maxWidth="260px",s.style.flexDirection="column",s.style.gap="6px";const a=i.createElement("div");a.style.font=AP,a.style.opacity="0.95";const l=i.createElement("div");l.style.font=SP,l.style.opacity="0.7",l.style.textTransform="uppercase",l.style.marginTop="4px";const c=i.createElement("div");c.style.display="flex",c.style.flexDirection="column",c.style.gap="4px",s.appendChild(a),s.appendChild(l),s.appendChild(c);const u=i.createElement("div");u.style.display="flex",u.style.justifyContent="space-between",u.style.alignItems="center";const d=i.createElement("div");d.style.display="flex",d.style.alignItems="baseline",d.style.gap="10px";const h=i.createElement("div");h.style.font=AP,h.style.opacity="0.9";const f=i.createElement("div");f.style.font=SP,f.style.opacity="0.65",d.appendChild(h),d.appendChild(f);const p=i.createElement("label");p.style.display="inline-flex",p.style.alignItems="center",p.style.gap="6px",p.style.font=SP;const m=i.createElement("span");m.textContent="Click action";const v=i.createElement("select");v.style.font=SP,v.style.background="rgba(255,255,255,0.08)",v.style.color="#fff",v.style.border="1px solid rgba(255,255,255,0.2)",v.style.borderRadius="4px",v.style.padding="2px 6px",v.style.minHeight="24px",v.style.cursor="pointer",BR.forEach((e=>{const t=i.createElement("option");t.value=e.value,t.textContent=e.label,v.appendChild(t)})),v.value=OR;const g=i.createElement("div");g.dataset.timelineCopyStatus="true",g.setAttribute("role","status"),g.setAttribute("aria-live","polite"),g.style.display="none",g.style.position="absolute",g.style.right="0",g.style.bottom="calc(100% + 4px)",g.style.alignItems="center",g.style.padding="1px 6px",g.style.borderRadius="999px",g.style.border=FR.border,g.style.background=FR.background,g.style.color=FR.color,g.style.font=SP,g.style.whiteSpace="nowrap",g.style.pointerEvents="none",g.style.zIndex="4",g.style.opacity="0",g.style.transform="translateY(2px)",g.style.transition=["opacity 180ms ease","transform 180ms ease"].join(", "),p.appendChild(m),p.appendChild(v);const y=i.createElement("div");y.style.display="flex",y.style.alignItems="center",y.style.position="relative",y.style.flexShrink="0",y.appendChild(g),y.appendChild(p),u.appendChild(d),u.appendChild(y);const b=i.createElement("div");function k(e,t,{alignTop:n=!1}={}){const r=i.createElement("div");r.style.display="grid",r.style.gridTemplateColumns="64px 1fr",r.style.alignItems=n?"start":"center",r.style.gap="8px";const o=i.createElement("div");o.textContent=e,o.style.font=SP,o.style.opacity="0.8",n&&(o.style.paddingTop="2px");const s=i.createElement("div");s.style.position="relative",s.style.borderRadius="6px",s.style.background="rgba(255,255,255,0.08)",s.style.overflow="hidden",t&&(s.dataset.timelineLane=t);const a=i.createElement("div");return a.style.position="absolute",a.style.top="0",a.style.bottom="0",a.style.width="2px",a.style.background="rgba(255,255,255,0.8)",s.appendChild(a),r.appendChild(o),r.appendChild(s),b.appendChild(r),{track:s,indicator:a}}b.style.display="grid",b.style.gridTemplateRows="auto auto",b.style.gap="8px",r.appendChild(u),r.appendChild(b),r.appendChild(o),r.appendChild(s);const w=k("Nodes","nodes",{alignTop:!0}),x=k("Render","render");let _=[],T=[],I=0,E=OR,S=1;const A=new Map,N=new Map,M=new Map,F=new Map;let C=new Set,O=null,P=!1,R="",D=!1,L=0,B=0,z=null,W=null,$=null;function j(e){for(;e.childNodes.length>1;)e.removeChild(e.lastChild)}function U(){z&&(clearTimeout(z),z=null)}function q(){W&&(((null==xP?void 0:xP.clearTimeout)||clearTimeout)(W),W=null)}function V(){$&&(((null==xP?void 0:xP.clearTimeout)||clearTimeout)($),$=null)}function G(){g.style.display="none",g.style.opacity="0",g.style.transform="translateY(2px)",g.textContent=""}function H(){return!!D||!!e&&(Array.isArray(e.placements)||Array.isArray(e.renderPlacements))}function K(){if(!e)return!1;const t=Array.isArray(e.placements),n=Array.isArray(e.renderPlacements);if(!t&&!n)return!1;const i=t?e.placements:[],r=n?e.renderPlacements:[];return(i.length!==L||r.length!==B)&&(de(i,r),!0)}function X(){if(!D)return!1;const e=QR(_,T,t);return e!==R&&(R=e,ae(),ue(),!0)}function Y(){H()?z=function({shouldSchedule:e,isScheduled:t,intervalMs:n,onTick:i}){return t?null:setTimeout(i,n)}({shouldSchedule:!0,isScheduled:!!z,intervalMs:D?100:250,onTick:()=>{z=null,H()&&(K()||X()||Y())}}):U()}function Q(e,t){const n=t>0?I/t:0;e.style.left=100*FP(n)+"%",e.style.transform="translateX(-1px)"}function J(){o.style.display="none"}function Z(){q(),V(),G()}function ee(e,{tone:t="success"}={}){if(!e)return void Z();q(),V(),function(e="success"){const t=function(e="success"){return"warning"===e?CR:FR}(e);g.style.border=t.border,g.style.background=t.background,g.style.color=t.color}(t),g.textContent=e,g.style.display="inline-flex",g.style.opacity="0",g.style.transform="translateY(2px)","function"==typeof g.getBoundingClientRect&&g.getBoundingClientRect(),g.style.opacity="1",g.style.transform="translateY(0)";const n=(null==xP?void 0:xP.setTimeout)||setTimeout;W=n((()=>{W=null,function(){q(),V(),g.style.opacity="0",g.style.transform="translateY(-2px)";const e=(null==xP?void 0:xP.setTimeout)||setTimeout;$=e((()=>{$=null,G()}),180)}()}),1800)}function te(e,t){if(!e)return void J();o.textContent=e,o.style.display="block";const n=r.getBoundingClientRect(),i=o.getBoundingClientRect(),s=((null==t?void 0:t.clientX)||0)-n.left+12,a=((null==t?void 0:t.clientY)||0)-n.top+12,l=n.width-i.width-8,c=n.height-i.height-8,u=Math.max(8,Math.min(s,l)),d=Math.max(8,Math.min(a,c));o.style.left=`${u}px`,o.style.top=`${d}px`}function ne(){s.style.display="none"}function ie(e,n){const o="function"==typeof t&&e?t(e):null,u=Array.isArray(null==o?void 0:o.children)?o.children:[];if(!u.length)return void ne();if(a.textContent=e,l.textContent="children",function(){for(;c.firstChild;)c.removeChild(c.firstChild)}(),u.forEach((e=>{e&&e.nodeId&&c.appendChild(function(e){const n=i.createElement("div");n.style.display="grid",n.style.gridTemplateColumns="10px 1fr auto auto",n.style.alignItems="center",n.style.gap="6px";const r="string"==typeof(null==e?void 0:e.nodeId)?e.nodeId:"",o=MP(null==e?void 0:e.weight)?e.weight:1,s=function(e){if(!e||"function"!=typeof t)return"missing";const n=t(e);if(!n)return"missing";const i="string"==typeof n.state?n.state.trim().toLowerCase():"";return"pending"===i||"resolving"===i||"ready"===i||"failed"===i?i:"pending"}(r);n.dataset.childId=r,n.dataset.childStatus=s;const a=i.createElement("span");a.dataset.statusIndicator=s,a.style.width="8px",a.style.height="8px",a.style.borderRadius="999px",a.style.background=MR[s]||MR.pending,a.style.display="inline-block";const l=i.createElement("span");l.textContent=r||"unknown",l.style.overflow="hidden",l.style.textOverflow="ellipsis",l.style.whiteSpace="nowrap";const c=i.createElement("span");c.textContent=`w=${CP(o,0)}`,c.style.opacity="0.8";const u=i.createElement("span");return u.textContent=s,u.style.opacity="0.75",n.appendChild(a),n.appendChild(l),n.appendChild(c),n.appendChild(u),n}(e))})),!c.childNodes.length)return void ne();s.style.display="flex";const d=r.getBoundingClientRect(),h=s.getBoundingClientRect(),f=((null==n?void 0:n.clientX)||0)-d.left+12,p=((null==n?void 0:n.clientY)||0)-d.top+12,m=d.width-h.width-8,v=d.height-h.height-8,g=Math.max(8,Math.min(f,m)),y=Math.max(8,Math.min(p,v));s.style.left=`${g}px`,s.style.top=`${y}px`}function re(){const t=I;if(e&&"function"==typeof e.getPlacementsActiveAtTime){const n=e.getPlacementsActiveAtTime(t),i=new Set(n.map((e=>null==e?void 0:e.placementId)).filter((e=>"string"==typeof e&&e.length)));C.forEach((e=>{i.has(e)||nD(M.get(e),!1)})),i.forEach((e=>{C.has(e)||nD(M.get(e),!0)})),C=i}else w.track.querySelectorAll('[data-timeline-item="nodes"]').forEach((e=>{const n="true"===e.dataset.hasDuration,i=Number(e.dataset.start),r=Number(e.dataset.end);nD(e,n&&NP(t)&&t>=i&&t<r)}));if(e&&"function"==typeof e.getActiveRenderPlacement){const n=e.getActiveRenderPlacement(t),i=null==n?void 0:n.renderPlacementId;O&&O!==i&&nD(F.get(O),!1),i&&O!==i&&nD(F.get(i),!0),O=i||null}else x.track.querySelectorAll('[data-timeline-item="render"]').forEach((e=>{const n="true"===e.dataset.hasDuration,i=Number(e.dataset.start),r=Number(e.dataset.end);nD(e,n&&NP(t)&&t>=i&&t<r)}))}function oe(e){const n=$R(e,t);if(!MP(n)||"function"!=typeof t)return{boundaries:[],buffered:[]};const i=t(null==e?void 0:e.nodeId),r=function(e){const t=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[];if(!t.length)return null;if(null!=e&&e.mainTrackId){const n=t.find((t=>(null==t?void 0:t.id)===e.mainTrackId));if(n)return n}return t.find((e=>Array.isArray(null==e?void 0:e.segments)&&e.segments.length))||null}(i);if(!r)return{boundaries:[],buffered:[]};const o=e=>{if(!e)return 0;const t=Number(null==e?void 0:e.bufferedRatio);if(Number.isFinite(t))return FP(t);const n=Number(null==e?void 0:e.retainedByteLength);if(!MP(n))return 0;const i=null==e?void 0:e.chosenRepresentation,r=MP(null==i?void 0:i.sizeBytes)?i.sizeBytes:null;return MP(r)?FP(n/r):1},s=Array.isArray(r.segments)?r.segments:[],a=NP(null==r?void 0:r.offset)?r.offset:0,l=NP(null==e?void 0:e.nodeOffsetOverride)?e.nodeOffsetOverride:0;if(!s.length){const e=null==i?void 0:i.buffered,t=NP(null==e?void 0:e.start)?e.start-l:0,r=NP(null==e?void 0:e.end)?e.end-l:0,o=Math.max(0,t),s=Math.min(n,r);return s>o?{boundaries:[],buffered:[{startRatio:o/n,endRatio:s/n}]}:{boundaries:[],buffered:[]}}if("image"===(null==r?void 0:r.type)){const e=s.find((e=>e&&!e.isInit))||s[0],t=e?o(e):0;return t>0?{boundaries:[],buffered:[{startRatio:0,endRatio:FP(t)}]}:{boundaries:[],buffered:[]}}return function(e,t,n,i,r){const o=[],s=[];let a=0;return e.forEach((e=>{if(null!=e&&e.isInit)return;NP(null==e?void 0:e.offset)&&(a=e.offset);const l=a;if(!NP(l))return;const c=NP(null==e?void 0:e.duration)?e.duration:0,u=n+l-i,d=n+(l+c)-i;u>0&&u<t&&o.push(u/t);const h="function"==typeof r?r(e):0;if(c>0&&d>0&&u<t&&h>0){const e=Math.max(0,u),n=Math.min(t,d);if(n>e){const i=e+(n-e)*FP(h);s.push({startRatio:e/t,endRatio:i/t})}}c>0&&(NP(null==e?void 0:e.offset)?a=e.offset+c:a+=c)})),{boundaries:o,buffered:s}}(s,n,a,l,o)}function se(){const e=Array.isArray(_)?_:[],t=new Map(e.map((e=>[null==e?void 0:e.placementId,e])));for(const[e,n]of M.entries()){if(!e)continue;const i=t.get(e);i&&(n.querySelectorAll('[data-buffered-segment="true"]').forEach((e=>e.remove())),tD(n,oe(i).buffered,NR))}}function ae(){const e=new Set(_.map((e=>null==e?void 0:e.nodeId)).filter((e=>"string"==typeof e&&e.length)));e.forEach((e=>{if(N.has(e))return;const n="function"==typeof t?t(e):null;if(!n||"function"!=typeof n.on)return;const i=e=>function(e={}){if(!e||e.isInit)return;const t=null==e?void 0:e.nodeId,n=null==e?void 0:e.segmentId,i=Number(null==e?void 0:e.loaded),r=Number(null==e?void 0:e.total);if(!t||!n||!NP(i))return;const o=`${t}:${n}`,s=A.get(o)||{},a={loaded:Math.max(NP(s.loaded)?s.loaded:0,i),total:MP(r)?r:s.total};A.set(o,a),function(){if(P)return;P=!0;const e=null==xP?void 0:xP.requestAnimationFrame;"function"!=typeof e?((null==xP?void 0:xP.setTimeout)||setTimeout)((()=>{P=!1,se()}),0):e((()=>{P=!1,se()}))}()}(e);n.on("segment:chunk",i),N.set(e,{node:n,handler:i})}));for(const[t,n]of N.entries())e.has(t)||(null!=n&&n.node&&"function"==typeof n.node.off&&n.node.off("segment:chunk",n.handler),N.delete(t))}function le({track:e,color:t,start:n,duration:r,startTime:o,durationSeconds:s,segmentRatios:a,bufferedSegments:l,placementId:c,nodeId:u,label:d,rowIndex:h=0,rowHeight:f=18,rowGap:p=0,laneId:m,isClickable:v,isActive:g,tooltip:y,hoverDetailsNodeId:b,showLabel:k,onClick:w}){const x=i.createElement("div");!function(e,t){e.style.position="absolute",e.style.borderRadius="4px",e.style.background=t,e.style.opacity="0.9",e.style.font=SP,e.style.color="#fff",e.style.display="flex",e.style.alignItems="center",e.style.whiteSpace="nowrap",e.style.overflow="hidden",e.style.textOverflow="ellipsis"}(x,t),function(e,{startRatio:t,durationRatio:n,rowIndex:i=0,rowHeight:r=18,rowGap:o=0}={}){const s=i*(r+o)+2,a=Math.max(1,r-4);e.style.top=`${s}px`,e.style.height=`${a}px`;const l=FP(t);if(MP(n)){const t=Math.max(0,Math.min(n,1-l));return e.style.left=100*l+"%",e.style.width=100*t+"%",void(e.style.padding="0 4px")}e.style.left=100*l+"%",e.style.width="2px",e.style.padding="0"}(x,{startRatio:n,durationRatio:r,rowIndex:h,rowHeight:f,rowGap:p}),function(e,{laneId:t,label:n,isClickable:i,shouldShowLabel:r,onClick:o}={}){if(t&&(e.dataset.timelineItem=t),r&&n){const t=xP.document.createElement("span");t.textContent=n,t.style.position="relative",t.style.zIndex="2",t.style.pointerEvents="none",e.appendChild(t)}i&&(e.style.cursor="pointer"),"function"==typeof o&&e.addEventListener("click",o)}(x,{laneId:m,label:d,isClickable:v,shouldShowLabel:"boolean"==typeof k?k:MP(r),onClick:w}),y&&(x.title=y),NP(o)&&(x.dataset.start=String(o)),MP(s)||UR(s)?(x.dataset.end=String(o+s),x.dataset.hasDuration="true"):(x.dataset.end="",x.dataset.hasDuration="false"),c&&(x.dataset.placementId=c),u&&(x.dataset.nodeId=u),x.style.pointerEvents="auto",tD(x,l,NR),function(e,t=[]){e&&Array.isArray(t)&&t.length&&t.forEach((t=>{if(!NP(t)||t<=0||t>=1)return;const n=xP.document.createElement("div");n.dataset.segmentBoundary="true",n.style.position="absolute",n.style.top="2px",n.style.bottom="2px",n.style.width="1px",n.style.left=100*FP(t)+"%",n.style.transform="translateX(-0.5px)",n.style.background="rgba(255,255,255,0.35)",n.style.pointerEvents="none",n.style.zIndex="1",e.appendChild(n)}))}(x,a),nD(x,g),y&&(x.addEventListener("mouseenter",(e=>te(y,e))),x.addEventListener("mousemove",(e=>te(y,e))),x.addEventListener("mouseleave",J)),b&&(x.addEventListener("mouseenter",(e=>ie(b,e))),x.addEventListener("mousemove",(e=>ie(b,e))),x.addEventListener("mouseleave",ne)),e.appendChild(x),"nodes"===m&&c?M.set(c,x):"render"===m&&c&&F.set(c,x)}async function ce({event:i,placement:r,rangeEnd:o,track:s}){const a=GR(E);if(a===OR)return;if(a===PR)return void function(t,n,i){if(!e)return;if(!MP(n)||!i)return;const r="function"==typeof i.getBoundingClientRect?i.getBoundingClientRect():null,o=MP(null==r?void 0:r.width)?r.width:i.clientWidth;if(!MP(o))return;const s=NP(null==r?void 0:r.left)?r.left:0,a=FP(((NP(null==t?void 0:t.clientX)?t.clientX:0)-s)/o)*n;NP(a)&&(e.currentTime=a)}(i,o,s);const l="string"==typeof(null==r?void 0:r.nodeId)?r.nodeId:"",c="function"==typeof t&&l?t(l):null,u=a===RR?l:a===DR?JSON.stringify(YR(r,t),null,2):function(e,t){return function(e,t){return function(e,t,n){const i=(e||"").replace(/\/$/,""),r=null==n?void 0:n.assetId,o=null==n?void 0:n.assetRevision;if(i&&"string"==typeof r&&"number"==typeof o)return`${i}/raw/${encodeURIComponent(r)}/${o}`}(e,0,t)}(t,null==e?void 0:e.manifestRef)}(c,n),d=a===RR?"Copied node ID":a===DR?"Copied node context":"Copied source video URL";if(u)try{await async function(e,t){const n=null==xP||null===(t=xP.navigator)||void 0===t?void 0:t.clipboard;if(!n||"function"!=typeof n.writeText)throw new Error("Clipboard API unavailable.");await n.writeText(e)}(u),ee(d)}catch(e){}else a===LR&&ee("Source video URL unavailable",{tone:"warning"})}function ue(){const n=function(){let e=0;const n=Array.isArray(_)?_:[],i=Array.isArray(T)?T.filter((e=>!0!==(null==e?void 0:e.offsetPending))):[];return n.forEach((n=>{if(!0===(null==n?void 0:n.offsetPending))return;const i=NP(null==n?void 0:n.offset)?n.offset:void 0;if(!NP(i))return;const r=$R(n,t);e=MP(r)?Math.max(e,i+r):Math.max(e,i)})),i.forEach((t=>{const n=NP(null==t?void 0:t.offset)?t.offset:0,i=jR(t);e=MP(i)?Math.max(e,n+i):Math.max(e,n)})),MP(e)?e:1}();S=n,h.textContent=`t=${CP(I)}s`,f.textContent=`range=0-${CP(n)}s`,J(),ne(),j(w.track),j(x.track),M.clear(),F.clear(),C=new Set,O=null,P=!1;const i=Array.isArray(_)?_:[],r=Array.isArray(T)?T:[],o=function(n){const i=(Array.isArray(n)?n.slice():[]).map((e=>{if(!0===(null==e?void 0:e.offsetPending))return null;const n=NP(null==e?void 0:e.offset)?e.offset:void 0;if(!NP(n))return null;const i=$R(e,t);return{placement:e,offset:n,duration:i,end:MP(i)?n+i:n,rowIndex:0}})).filter(Boolean).sort(((e,t)=>{var n,i,r,o;const s=e.offset-t.offset;if(0!==s)return s;const a="string"==typeof(null===(n=e.placement)||void 0===n?void 0:n.nodeId)?e.placement.nodeId:"",l="string"==typeof(null===(i=t.placement)||void 0===i?void 0:i.nodeId)?t.placement.nodeId:"";if(a!==l)return a.localeCompare(l);const c="string"==typeof(null===(r=e.placement)||void 0===r?void 0:r.placementId)?e.placement.placementId:"",u="string"==typeof(null===(o=t.placement)||void 0===o?void 0:o.placementId)?t.placement.placementId:"";return c.localeCompare(u)})),r=[],o=function(e,t){const n=Number(null==e||null===(t=e.settings)||void 0===t?void 0:t.snapToFps);return!Number.isFinite(n)||n<=0?0:.5/n}(e);return i.forEach((e=>{const t=e.offset,n=NP(e.end)?e.end:t;let i=-1;for(let e=0;e<r.length;e+=1)if(r[e]<=t+o){i=e;break}-1===i?(i=r.length,r.push(n)):r[i]=Math.max(r[i],n),e.rowIndex=i})),{items:i,rowCount:Math.max(1,r.length)}}(i);var s;!function(e){const t=e.rowCount*AR+4*(e.rowCount-1);w.track.style.height=`${t}px`,x.track.style.height="18px",w.track.style.cursor="default",w.track.style.pointerEvents="auto",x.track.style.pointerEvents="auto"}(o),function(e,t){e.items.forEach((e=>{const n=e.placement,i=e.offset,r=e.duration,o=(null==n?void 0:n.nodeId)||(null==n?void 0:n.placementId)||"node",s=!!NP(I)&&I>=i&&(!MP(r)||I<i+r),a=oe(n),l=GR(E)!==OR;le({track:w.track,color:"rgba(255,255,255,0.16)",start:FP(i/t),duration:MP(r)?FP(r/t):null,startTime:i,durationSeconds:r,segmentRatios:a.boundaries,bufferedSegments:a.buffered,placementId:null==n?void 0:n.placementId,nodeId:null==n?void 0:n.nodeId,label:o,rowIndex:e.rowIndex,rowHeight:AR,rowGap:4,laneId:"nodes",isClickable:l,isActive:s,tooltip:(null==n?void 0:n.nodeId)||(null==n?void 0:n.placementId),hoverDetailsNodeId:null==n?void 0:n.nodeId,onClick:l?e=>{ce({event:e,placement:n,rangeEnd:t,track:w.track})}:void 0})}))}(o,n),s=n,r.forEach((e=>{const t=NP(null==e?void 0:e.offset)?e.offset:void 0;if(!NP(t))return;const n=jR(e),i=UR(n),r=(null==e?void 0:e.type)||(null==e?void 0:e.renderPlacementId)||"render",o=function(e){const t="string"==typeof e?e.trim().toLowerCase():"";return"switch"===t||"switching"===t||"switchingrendernode"===t}(null==e?void 0:e.type),a=o?()=>{"function"==typeof(null==xP?void 0:xP.switchTo)&&xP.switchTo("next")}:void 0;let l=!1;NP(I)&&(i?l=I>=t:MP(n)&&(l=I>=t&&I<t+n));const c=i&&MP(s)?FP((s-t)/s):MP(n)?FP(n/s):null;le({track:x.track,color:"rgba(248,162,62,0.9)",start:FP(t/s),duration:c,startTime:t,durationSeconds:n,label:r,placementId:null==e?void 0:e.renderPlacementId,rowIndex:0,rowHeight:AR,rowGap:0,laneId:"render",isClickable:!!o,isActive:l,tooltip:(null==e?void 0:e.type)||(null==e?void 0:e.renderPlacementId),showLabel:MP(n)||i,onClick:a})})),Q(w.indicator,n),Q(x.indicator,n),re(),se(),D=eD(_,T)||JR(_,t),R=D?QR(_,T,t):"",L=Array.isArray(_)?_.length:0,B=Array.isArray(T)?T.length:0,Y()}function de(e,n){_=Array.isArray(e)?e.slice():[],T=Array.isArray(n)?n.slice():[],D=eD(_,T)||JR(_,t),ae(),ue()}return v.addEventListener("change",(()=>{E=GR(v.value),v.value=E,ue()})),{id:"timeline",title:"Timeline",render:e=>{e.appendChild(r),ue()},updatePlacements:de,updateTime:function(e){if(I=NP(e)?e:I,K())return;if(D&&X())return;const t=S;NP(t)&&(h.textContent=`t=${CP(I)}s`,f.textContent=`range=0-${CP(t)}s`,Q(w.indicator,t),Q(x.indicator,t),re())},refresh:()=>ue(),dispose:()=>{U(),Z();for(const e of N.values())(null==e?void 0:e.node)&&"function"==typeof e.node.off&&e.node.off("segment:chunk",e.handler);N.clear(),A.clear()}}}const rD=1024,oD=1048576,sD=1073741824;function aD(e){return NP(e)?e<rD?`${Math.round(e)} B`:e<oD?`${CP(e/rD,1)} KB`:e<sD?`${CP(e/oD,2)} MB`:`${CP(e/sD,2)} GB`:"n/a"}const lD="ekoplayer-debug-overlay";var cD=new WeakMap,uD=new WeakMap,dD=new WeakMap,hD=new WeakMap,fD=new WeakSet;class pD{constructor({tabBarEl:e,contentEl:t}){O(this,fD),F(this,cD,[]),F(this,uD,void 0),F(this,dD,void 0),F(this,hD,void 0),C(dD,this,e),C(hD,this,t)}registerTab(e){e&&"string"==typeof e.id&&"string"==typeof e.title&&"function"==typeof e.render&&(M(cD,this).some((t=>t.id===e.id))||(M(cD,this).push(e),A(fD,this,mD).call(this),M(uD,this)||this.selectTab(e.id)))}selectTab(e){M(cD,this).find((t=>t.id===e))&&(C(uD,this,e),A(fD,this,mD).call(this),A(fD,this,vD).call(this))}dispose(){M(dD,this)&&(M(dD,this).innerHTML=""),M(hD,this)&&(M(hD,this).innerHTML=""),C(cD,this,[]),C(dD,this,null),C(hD,this,null)}}function mD(){const e=M(dD,this);e&&(e.innerHTML="",M(cD,this).forEach((t=>{const n=xP.document.createElement("button");n.type="button",n.textContent=t.title,n.style.cursor="pointer",n.style.padding="6px 10px",n.style.borderRadius="6px",n.style.border="1px solid rgba(255,255,255,0.2)",n.style.background=t.id===M(uD,this)?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.2)",n.style.color="#fff",n.style.font=AP,n.addEventListener("click",(()=>this.selectTab(t.id))),e.appendChild(n)})))}function vD(){const e=M(hD,this);if(!e)return;e.innerHTML="";const t=M(cD,this).find((e=>e.id===M(uD,this)));t&&t.render(e)}function gD({mountElement:e,canvasElement:t,timeline:n,assetsDeliveryServiceUrl:i,getNode:r,listNodes:o,downloadSpeed:s,downloadEvents:a,qoe:l,qoeEvents:c,options:u={},playbackStartedAtMs:d,playerVersion:h}={}){if(!e)throw new Error("Debug overlay requires mountElement.");if(!n||"function"!=typeof n.on)throw new Error("Debug overlay requires a Timeline with .on/.off.");!function(e){if(!e||!e.style)return;const t=null==xP?void 0:xP.window,n=t&&"function"==typeof t.getComputedStyle?t.getComputedStyle(e):null,i=n?n.position:e.style.position;i&&"static"!==i||(e.style.position="relative")}(e);const f=xP.document.getElementById(lD);f&&f.parentNode&&f.parentNode.removeChild(f);const p=function({mountElement:e,playerVersion:t}){const n=null==xP?void 0:xP.document;if(!n||"function"!=typeof n.createElement)throw new Error("Debug overlay requires document.createElement.");const i=n.createElement("div");i.id=lD,i.style.position="absolute",i.style.inset="0",i.style.zIndex="999999",i.style.pointerEvents="none";const r=n.createElement("div");r.style.position="absolute",r.style.top="8px",r.style.left="8px",r.style.width="460px",r.style.maxWidth="calc(100% - 16px)",r.style.background="rgba(0,0,0,0.65)",r.style.border="1px solid rgba(255,255,255,0.18)",r.style.borderRadius="10px",r.style.padding="10px",r.style.color="#fff",r.style.pointerEvents="auto",r.style.backdropFilter="blur(6px)";const o=n.createElement("div");o.style.display="flex",o.style.justifyContent="space-between",o.style.alignItems="center",o.style.gap="10px";const s=n.createElement("div");s.textContent="EkoPlayer Debug",s.style.font="600 13px ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial";const a=n.createElement("button");a.type="button",a.textContent="Hide",a.style.cursor="pointer",a.style.padding="6px 10px",a.style.borderRadius="8px",a.style.border="1px solid rgba(255,255,255,0.2)",a.style.background="rgba(0,0,0,0.2)",a.style.color="#fff",o.appendChild(s),o.appendChild(a);const l=n.createElement("div");l.style.display="flex",l.style.gap="8px",l.style.marginTop="10px";const c=n.createElement("div");c.style.marginTop="10px";const u=n.createElement("div");u.style.marginTop="10px",u.style.font=SP,u.style.display="flex",u.style.justifyContent="space-between",u.style.alignItems="center",u.style.gap="10px";const d=n.createElement("div");d.style.color="rgba(140, 224, 255, 0.9)",d.textContent="Playback started @ --";const h=n.createElement("div");h.style.opacity="0.7",h.style.marginLeft="auto",h.textContent=t?`version ${t}`:"version n/a",u.appendChild(d),u.appendChild(h);const f=n.createElement("button");return f.type="button",f.textContent="Debug",f.style.position="absolute",f.style.top="8px",f.style.left="8px",f.style.cursor="pointer",f.style.padding="6px 10px",f.style.borderRadius="10px",f.style.border="1px solid rgba(255,255,255,0.25)",f.style.background="rgba(0,0,0,0.55)",f.style.color="#fff",f.style.pointerEvents="auto",f.style.display="none",r.appendChild(o),r.appendChild(l),r.appendChild(c),r.appendChild(u),i.appendChild(r),i.appendChild(f),e.appendChild(i),{overlayRoot:i,panel:r,tabBar:l,content:c,hideBtn:a,showBtn:f,footerPlayback:d}}({mountElement:e,playerVersion:h||(null==u?void 0:u.playerVersion)}),m=new pD({tabBarEl:p.tabBar,contentEl:p.content});let v=!0;function g(){v=!1,p.panel.style.display="none",p.showBtn.style.display="inline-block"}function y(){v=!0,p.panel.style.display="block",p.showBtn.style.display="none"}p.hideBtn.addEventListener("click",g),p.showBtn.addEventListener("click",y);const b=iD({timeline:n,getNode:r,assetsDeliveryServiceUrl:i}),k=function({getNode:e}){const t=xP.document,n=t.createElement("pre");n.style.margin="0",n.style.whiteSpace="pre-wrap",n.style.font=AP,n.style.lineHeight="1.35";const i=t.createElement("div");i.style.display="flex",i.style.flexDirection="column",i.style.gap="8px",i.style.marginTop="6px";const r=t.createElement("div");r.style.display="flex",r.style.gap="10px",r.style.marginTop="10px",r.style.alignItems="center",r.style.flexWrap="wrap";const o=new jP({maxValue:60}),s=new jP({maxValue:60}),a=t.createElement("div"),l=t.createElement("div");l.textContent="browserfps",l.style.font=SP,l.style.opacity="0.9",a.appendChild(l),a.appendChild(o.element);const c=t.createElement("div"),u=t.createElement("div");return u.textContent="fps",u.style.font=l.style.font,u.style.opacity="0.9",c.appendChild(u),c.appendChild(s.element),r.appendChild(a),r.appendChild(c),{id:"frames",title:"Frames",render:e=>{e.appendChild(n),e.appendChild(i),e.appendChild(r)},pushBrowserFps:(e,t)=>o.push(e,t),pushVisualFps:(e,t)=>s.push(e,t),updateInfo:function({time:r,entries:o}){const s=Array.isArray(o)?o.slice().sort(VP):[];if(!s.length)return n.textContent="",void(i.innerHTML="");n.textContent=`t=${QP(r)}s tracks=${s.length}`,i.innerHTML="";for(let n=0;n<s.length;n+=1){const r=s[n],o=eR(e,r),a=(null==o?void 0:o.id)||"n/a",l=(null==o?void 0:o.codecs)||(null==o?void 0:o.mime)||"n/a",c=YP(null==o?void 0:o.bandwidth),u=OP(null==o?void 0:o.width,null==o?void 0:o.height),d=JP(e,r)||"n/a",h=ZP(e,r),f=h?` fallback=${h}`:"",p=KP(e,r),m=(null==p?void 0:p.strategy)||"n/a",v=(null==p?void 0:p.decisionReason)||"n/a",g=XP(null==p?void 0:p.measuredDownloadSpeedKbps),y=XP(null==p?void 0:p.safeBandwidthKbps),b=t.createElement("div");b.style.display="flex",b.style.flexDirection="column",b.style.gap="2px";const k=t.createElement("pre");k.style.margin="0",k.style.whiteSpace="pre-wrap",k.style.font=AP,k.style.lineHeight="1.35",k.textContent=[`${(null==r?void 0:r.nodeId)||"?"} ${(null==r?void 0:r.trackId)||"?"} ${(null==r?void 0:r.segmentId)||"?"} pts=${QP(null==r?void 0:r.presentationTime)}s`,`rep=${a} encodeProfile=${d}${f} res=${u} codec=${l} repBW=${c}`,`abr=strategy:${m} reason:${v} measuredBW:${g} safeBW:${y}`].join("\n"),b.appendChild(k);const w=(null==p?void 0:p.selectedRepresentationId)||(null==o?void 0:o.id),x=iR(e,r,o,p);if(x.length){const e=t.createElement("div");e.style.display="flex",e.style.alignItems="center",e.dataset.abrLadderRow="true",e.dataset.trackId=(null==r?void 0:r.trackId)||"",e.dataset.segmentId=(null==r?void 0:r.segmentId)||"";const n=t.createElement("div");n.style.display="inline-flex",n.style.alignItems="center",n.style.gap="2px",n.dataset.abrLadder="true",x.forEach((e=>{const i=t.createElement("span"),r=!!w&&e.id===w;i.dataset.abrLadderBlock="true",i.dataset.repId=e.id||"",i.dataset.selected=r?"true":"false",i.style.display="inline-block",i.style.width="10px",i.style.height="8px",i.style.borderRadius="2px",i.style.border="1px solid rgba(255,255,255,0.35)",i.style.background=r?"rgba(74, 222, 128, 0.95)":"rgba(156, 163, 175, 0.55)",i.title=`${e.id||"?"} ${XP(e.bandwidthKbps)}`,n.appendChild(i)})),e.appendChild(n),b.appendChild(e)}i.appendChild(b)}},dispose:()=>{o.dispose(),s.dispose()}}}({getNode:r}),w=lR({downloadSpeed:s,downloadEvents:a}),x=function({qoe:e,qoeEvents:t}={}){const n=null==xP?void 0:xP.document;if(!n||"function"!=typeof n.createElement)throw new Error("Debug overlay QoE tab requires document.createElement.");const i=n.createElement("pre");i.style.margin="0",i.style.whiteSpace="pre-wrap",i.style.font=AP;const{graphWrap:r,graph:o}=function(e){const t=e.createElement("div");t.style.marginTop="10px";const n=e.createElement("div");n.textContent="qoe score",n.style.font=SP,n.style.opacity="0.9";const i=new jP({maxValue:1,windowMs:3e4,formatValue:e=>cR(e)});return t.appendChild(n),t.appendChild(i.element),{graphWrap:t,graph:i}}(n);let s=null;const a=()=>{i.textContent=function(e){if(!e)return"QoE unavailable";const t="string"==typeof e.status?e.status:"n/a";return[`score=${cR(e.score)}`,`status=${t}`,`streamQualityScore=${cR(e.streamQualityScore)}`,`fpsScore=${cR(e.fpsScore)}`,`browserFps=${cR(e.browserFps)}`,`waitingSeconds=${cR(e.waitingSeconds)}`,`playingSeconds=${cR(e.playingSeconds)}`].join("\n")}(e)},l=()=>{if(!e)return;const t=Number(e.score);Number.isFinite(t)&&o.push(t,uR())},c=e=>{const t=Number(e);Number.isFinite(t)&&o.push(t,uR()),a()},u=()=>{a()};if(a(),l(),t&&"function"==typeof t.on&&(t.on("qoescore",c),t.on("qoestatus",u)),e){const e="function"==typeof(null==xP?void 0:xP.setInterval)?xP.setInterval:setInterval;s=e((()=>{l(),a()}),1e3)}return{id:"qoe",title:"QoE",render:e=>{e.appendChild(i),e.appendChild(r)},dispose:()=>{t&&"function"==typeof t.off&&(t.off("qoescore",c),t.off("qoestatus",u)),s&&(("function"==typeof(null==xP?void 0:xP.clearInterval)?xP.clearInterval:clearInterval)(s),s=null),o.dispose()}}}({qoe:l,qoeEvents:c}),_=function({timeline:e,getNode:t,listNodes:n,options:i}={}){const r=null==xP?void 0:xP.document;if(!r||"function"!=typeof r.createElement)throw new Error("Debug overlay Memory tab requires document.createElement.");const o=r.createElement("pre");o.style.margin="0",o.style.whiteSpace="pre-wrap",o.style.font=AP;const s=r.createElement("div");s.textContent="nodes",s.style.marginTop="10px",s.style.font=SP,s.style.opacity="0.9";const a=r.createElement("pre");a.style.margin="6px 0 0 0",a.style.whiteSpace="pre-wrap",a.style.font=AP;let l=null;const c=()=>{const r=function({timeline:e,getNode:t,listNodes:n}){const i=[];let r=0;if("function"==typeof n){let e;try{e=n()}catch(t){e=null}if(Array.isArray(e))return e.forEach((e=>{const t=null==e?void 0:e.id;if("string"!=typeof t||!t.length)return;const n=Number(null==e?void 0:e.retainedByteLength);Number.isFinite(n)&&(r+=n,i.push({nodeId:t,bytes:n}))})),i.sort(((e,t)=>t.bytes-e.bytes)),{totalBytes:r,nodes:i,available:!0}}if(!e||"function"!=typeof t)return{totalBytes:0,nodes:[],available:!1};const o=Array.isArray(e.placements)?e.placements:[];return new Set(o.map((e=>null==e?void 0:e.nodeId)).filter((e=>"string"==typeof e&&e.length))).forEach((e=>{const n=t(e),o=Number(null==n?void 0:n.retainedByteLength);Number.isFinite(o)&&(r+=o,i.push({nodeId:e,bytes:o}))})),i.sort(((e,t)=>t.bytes-e.bytes)),{totalBytes:r,nodes:i,available:!0}}({timeline:e,getNode:t,listNodes:n}),s=function({timeline:e}){if(!e||"function"!=typeof e.getDecodedFrameStats)return{totalBytes:0,frames:0,available:!1};try{const t=e.getDecodedFrameStats(),n=Number(null==t?void 0:t.totalBytes),i=Number(null==t?void 0:t.frames);return{totalBytes:Number.isFinite(n)?n:0,frames:Number.isFinite(i)?i:0,available:!1!==(null==t?void 0:t.available)}}catch(e){return{totalBytes:0,frames:0,available:!1}}}({timeline:e}),l=function(e,t,n,i){const r=Number(null!==(n=null==e||null===(i=e.publicOptions)||void 0===i?void 0:i.segmentEvictionMaxRetainedBytes)&&void 0!==n?n:null==e?void 0:e.segmentEvictionMaxRetainedBytes),o=NP(r)&&r>=0,s=o?aD(r):"n/a";return{active:o&&NP(t)&&t>r,thresholdLabel:s}}(i,r.available?r.totalBytes:NaN),c=l.active?"on":"off",u=s.available?aD(s.totalBytes):"n/a",d=s.available?s.frames:"n/a";if(!r.available)return o.textContent=[`decoded=${u} decodedFrames=${d}`,`retained=n/a eviction=${c} threshold=${l.thresholdLabel}`].join("\n"),void(a.textContent="");if(o.textContent=[`decoded=${u} decodedFrames=${d}`,[`retained=${aD(r.totalBytes)}`,`nodes=${r.nodes.length}`,`eviction=${c}`,`threshold=${l.thresholdLabel}`].join(" ")].join("\n"),!r.nodes.length)return void(a.textContent="none");const h=r.nodes.slice(0,8).map((e=>`${e.nodeId}: ${aD(e.bytes)}`));a.textContent=h.join("\n")};c();const u="function"==typeof(null==xP?void 0:xP.setInterval)?xP.setInterval:setInterval;return l=u(c,1e3),{id:"memory",title:"Memory",render:e=>{e.appendChild(o),e.appendChild(s),e.appendChild(a)},refresh:c,dispose:()=>{l&&(("function"==typeof(null==xP?void 0:xP.clearInterval)?xP.clearInterval:clearInterval)(l),l=null)}}}({timeline:n,getNode:r,listNodes:o,options:u});m.registerTab(b),m.registerTab(k),m.registerTab(w),m.registerTab(x),m.registerTab(_),m.registerTab(function({options:e}={}){const t=null==xP?void 0:xP.document;if(!t||"function"!=typeof t.createElement)throw new Error("Debug overlay options tab requires document.createElement.");const n=t.createElement("pre");n.style.margin="0",n.style.font=AP,n.style.whiteSpace="pre-wrap",n.style.wordBreak="break-word";const i=null==e?void 0:e.publicOptions,r=i&&"object"==typeof i?Object.keys(i):[];if(r.length){const e=r.map((e=>`${e}=${function(e){if(null===e)return"null";if(void 0===e)return"undefined";const t=typeof e;if("string"===t)return e;if("number"===t||"boolean"===t)return String(e);try{return JSON.stringify(e)}catch(t){return String(e)}}(i[e])}`));n.textContent=e.join("\n")}else n.textContent="publicOptions unavailable";return{id:"options",title:"Options",render:e=>{e.appendChild(n)}}}({options:u}));const T=[],I=[];let E=0,S=0,A=null,N=!1,M=0,F=null;function C(e){const t=Number(e);Number.isFinite(t)&&(t-M<250||(M=t,k.pushBrowserFps(E,t),k.pushVisualFps(S,t)))}xP.window&&"function"==typeof xP.window.requestAnimationFrame&&(A=xP.window.requestAnimationFrame((function e(t){N||(E=GP(T,t),C(t),A=xP.window.requestAnimationFrame(e))})));const O=(e={})=>{if(N||!v)return;const t=Array.isArray(e.frames)?e.frames:[];if(!t.length)return void(F=null);const n=null!=xP&&xP.performance&&"function"==typeof xP.performance.now?xP.performance.now():Date.now(),i=t.map((e=>`${null==e?void 0:e.nodeId}:${null==e?void 0:e.trackId}:${null==e?void 0:e.segmentId}@${null==e?void 0:e.presentationTime}`)).join("|");i!==F&&(S=GP(I,n),F=i),k.updateInfo({time:e.time,entries:t}),C(n)};let P=Number.isFinite(d)?d:void 0;if(Number.isFinite(P)&&p.footerPlayback){const e=P/1e3;p.footerPlayback.textContent=`Playback started @ ${CP(e)}s`}const R=(e={})=>{if(!N&&void 0===P&&"playing"===(null==e?void 0:e.event)&&(P=TP(),p.footerPlayback)){const e=P/1e3;p.footerPlayback.textContent=`Playback started @ ${CP(e)}s`}},D=()=>{const e=Array.isArray(null==n?void 0:n.placements)?n.placements:[],t=Array.isArray(null==n?void 0:n.renderPlacements)?n.renderPlacements:[];b.updatePlacements(e,t)},L=(e={})=>{if(N)return;const t=Number.isFinite(null==e?void 0:e.time)?e.time:null==n?void 0:n.currentTime;b.updateTime(t),_&&"function"==typeof _.refresh&&_.refresh()},B=()=>{N||D()},z=()=>{N||D()},W=null==n?void 0:n.trackBuffers,$=()=>{N||("function"==typeof b.refresh?b.refresh():D(),_&&"function"==typeof _.refresh&&_.refresh())};return n.on(IP.VISUAL_FRAMES_AVAILABLE,O),n.on(IP.TIMELINE_TIME_UPDATE,L),n.on(IP.PLACEMENT_ADDED,B),n.on(IP.RENDER_PLACEMENT_ADDED,z),n.on(IP.TIMELINE_PLAYER_STATE,R),W&&"function"==typeof W.on&&W.on("track:bufferupdate",$),D(),b.updateTime(null==n?void 0:n.currentTime),{show:y,hide:g,dispose:function(){N||(N=!0,A&&xP.window&&"function"==typeof xP.window.cancelAnimationFrame&&xP.window.cancelAnimationFrame(A),A=null,n&&"function"==typeof n.off&&(n.off(IP.VISUAL_FRAMES_AVAILABLE,O),n.off(IP.TIMELINE_TIME_UPDATE,L),n.off(IP.PLACEMENT_ADDED,B),n.off(IP.RENDER_PLACEMENT_ADDED,z),n.off(IP.TIMELINE_PLAYER_STATE,R)),W&&"function"==typeof W.off&&W.off("track:bufferupdate",$),k&&"function"==typeof k.dispose&&k.dispose(),b&&"function"==typeof b.dispose&&b.dispose(),w&&"function"==typeof w.dispose&&w.dispose(),x&&"function"==typeof x.dispose&&x.dispose(),_&&"function"==typeof _.dispose&&_.dispose(),m.dispose(),p.overlayRoot&&p.overlayRoot.parentNode&&p.overlayRoot.parentNode.removeChild(p.overlayRoot))},registerTab:function(e){m.registerTab(e)},selectTab:function(e){m.selectTab(e)}}}var yD=Object.freeze({__proto__:null,createDebugOverlay:gD,default:gD});exports.EkoGallery=bP,exports.EkoGalleryLegacy=nn,exports.ekoWebPixel=S,exports.getEkoAnalyticsSnippet=function(e){return`if (!window.EkoAnalytics) {\n !function () {\n var t, a, e, s, n;\n 'undefined' == typeof window || window.EkoAnalytics || (t = window, a = 'EkoAnalytics', e = document, s = 'script', t[a] || (t[a] = function () {\n t[a].f ? (t[a].q.push(arguments), t[a].ts.push(Date.now())) : t[a].apply(t, arguments);\n }, t[a].f = !0, t[a].q = t[a].q || [], t[a].ts = t[a].ts || [], t[a].t = Number(new Date), t[a].sa = [], t[a].cb = [], t[a].init = function (ids) {\n t[a].id = ids;\n }, t[a].childRequestIdsCallback = function (e) {\n e.data && 'ea-ids-request' === e.data.type && t[a].sa.push(e.source);\n }, t.addEventListener('message', t[a].childRequestIdsCallback)));\n }();\n\n window.EkoAnalytics.cb.push(() => {\n let setCookie = (key, value, additionalProperties = '') => {\n let hostname = window.location.hostname;\n let domain = hostname;\n \n let parts = hostname.split('.');\n if (parts.length > 2) {\n domain = parts.slice(-2).join('.');\n }\n\n // "samesite=lax" is needed for cross-site situations (like NZXT getting checkout url attributes from lambda).\n window.document.cookie = \`\${key}=\${value}; domain=.\${domain}; path=/; secure; samesite=lax; \${additionalProperties}\`;\n };\n\n setCookie('easid', encodeURIComponent(window.EkoAnalytics('getSid')));\n setCookie('eauid', encodeURIComponent(window.EkoAnalytics('getUid')), 'max-age=2147483647');\n });\n\n window.EkoAnalytics('configure', {\n snowplow: {\n options: {\n appId: 'ekoGalleryReactV4',\n },\n },\n ekoEnv: '${e?"production":"development"}',\n env: 'website',\n });\n window.EkoAnalytics('track', 'PageView');\n }`},exports.getEkoProductConfigUrl=kP,exports.getEkoProductConfigUrlLegacy=wP;
14
+ */var ue=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;var i=Object.getOwnPropertyNames(t).map((function(e){return t[e]}));if("0123456789"!==i.join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,i,r=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),o=1;o<arguments.length;o++){for(var s in n=Object(arguments[o]))le.call(n,s)&&(r[s]=n[s]);if(ae){i=ae(n);for(var a=0;a<i.length;a++)ce.call(n,i[a])&&(r[i[a]]=n[i[a]])}}return r},de="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",he=Function.call.bind(Object.prototype.hasOwnProperty),fe=function(){};if("production"!==process.env.NODE_ENV){var pe=de,me={},ve=he;fe=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function ge(e,t,n,i,r){if("production"!==process.env.NODE_ENV)for(var o in e)if(ve(e,o)){var s;try{if("function"!=typeof e[o]){var a=Error((i||"React class")+": "+n+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw a.name="Invariant Violation",a}s=e[o](t,o,i,n,null,pe)}catch(e){s=e}if(!s||s instanceof Error||fe((i||"React class")+": type specification of "+n+" `"+o+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof s+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),s instanceof Error&&!(s.message in me)){me[s.message]=!0;var l=r?r():"";fe("Failed "+n+" type: "+s.message+(null!=l?l:""))}}}ge.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(me={})};var ye=ge,be=function(){};function ke(){return null}"production"!==process.env.NODE_ENV&&(be=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}});var we=function(e,t){var n="function"==typeof Symbol&&Symbol.iterator,i="@@iterator";var r="<<anonymous>>",o={array:c("array"),bigint:c("bigint"),bool:c("boolean"),func:c("function"),number:c("number"),object:c("object"),string:c("string"),symbol:c("symbol"),any:l(ke),arrayOf:function(e){return l((function(t,n,i,r,o){if("function"!=typeof e)return new a("Property `"+o+"` of component `"+i+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s))return new a("Invalid "+r+" `"+o+"` of type `"+h(s)+"` supplied to `"+i+"`, expected an array.");for(var l=0;l<s.length;l++){var c=e(s,l,i,r,o+"["+l+"]",de);if(c instanceof Error)return c}return null}))},element:l((function(t,n,i,r,o){var s=t[n];return e(s)?null:new a("Invalid "+r+" `"+o+"` of type `"+h(s)+"` supplied to `"+i+"`, expected a single ReactElement.")})),elementType:l((function(e,t,n,i,r){var o=e[t];return se.isValidElementType(o)?null:new a("Invalid "+i+" `"+r+"` of type `"+h(o)+"` supplied to `"+n+"`, expected a single ReactElement type.")})),instanceOf:function(e){return l((function(t,n,i,o,s){if(!(t[n]instanceof e)){var l=e.name||r;return new a("Invalid "+o+" `"+s+"` of type `"+(((c=t[n]).constructor&&c.constructor.name?c.constructor.name:r)+"` supplied to `")+i+"`, expected instance of `"+l+"`.")}var c;return null}))},node:l((function(e,t,n,i,r){return d(e[t])?null:new a("Invalid "+i+" `"+r+"` supplied to `"+n+"`, expected a ReactNode.")})),objectOf:function(e){return l((function(t,n,i,r,o){if("function"!=typeof e)return new a("Property `"+o+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var s=t[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected an object.");for(var c in s)if(he(s,c)){var u=e(s,c,i,r,o+"."+c,de);if(u instanceof Error)return u}return null}))},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&be(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),ke;return l((function(t,n,i,r,o){for(var l=t[n],c=0;c<e.length;c++)if(s(l,e[c]))return null;var u=JSON.stringify(e,(function(e,t){return"symbol"===f(t)?String(t):t}));return new a("Invalid "+r+" `"+o+"` of value `"+String(l)+"` supplied to `"+i+"`, expected one of "+u+".")}))},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&be("Invalid argument supplied to oneOfType, expected an instance of array."),ke;for(var t=0;t<e.length;t++){var n=e[t];if("function"!=typeof n)return be("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+p(n)+" at index "+t+"."),ke}return l((function(t,n,i,r,o){for(var s=[],l=0;l<e.length;l++){var c=(0,e[l])(t,n,i,r,o,de);if(null==c)return null;c.data&&he(c.data,"expectedType")&&s.push(c.data.expectedType)}return new a("Invalid "+r+" `"+o+"` supplied to `"+i+"`"+(s.length>0?", expected one of type ["+s.join(", ")+"]":"")+".")}))},shape:function(e){return l((function(t,n,i,r,o){var s=t[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected `object`.");for(var c in e){var d=e[c];if("function"!=typeof d)return u(i,r,o,c,f(d));var p=d(s,c,i,r,o+"."+c,de);if(p)return p}return null}))},exact:function(e){return l((function(t,n,i,r,o){var s=t[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected `object`.");var c=ue({},t[n],e);for(var d in c){var p=e[d];if(he(e,d)&&"function"!=typeof p)return u(i,r,o,d,f(p));if(!p)return new a("Invalid "+r+" `"+o+"` key `"+d+"` supplied to `"+i+"`.\nBad object: "+JSON.stringify(t[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var m=p(s,d,i,r,o+"."+d,de);if(m)return m}return null}))}};function s(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function a(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function l(e){if("production"!==process.env.NODE_ENV)var n={},i=0;function o(o,s,l,c,u,d,h){if(c=c||r,d=d||l,h!==de){if(t){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var p=c+":"+l;!n[p]&&i<3&&(be("You are manually calling a React.PropTypes validation function for the `"+d+"` prop on `"+c+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),n[p]=!0,i++)}}return null==s[l]?o?null===s[l]?new a("The "+u+" `"+d+"` is marked as required in `"+c+"`, but its value is `null`."):new a("The "+u+" `"+d+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:e(s,l,c,u,d)}var s=o.bind(null,!1);return s.isRequired=o.bind(null,!0),s}function c(e){return l((function(t,n,i,r,o,s){var l=t[n];return h(l)!==e?new a("Invalid "+r+" `"+o+"` of type `"+f(l)+"` supplied to `"+i+"`, expected `"+e+"`.",{expectedType:e}):null}))}function u(e,t,n,i,r){return new a((e||"React class")+": "+t+" type `"+n+"."+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+r+"`.")}function d(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(d);if(null===t||e(t))return!0;var r=function(e){var t=e&&(n&&e[n]||e[i]);if("function"==typeof t)return t}(t);if(!r)return!1;var o,s=r.call(t);if(r!==t.entries){for(;!(o=s.next()).done;)if(!d(o.value))return!1}else for(;!(o=s.next()).done;){var a=o.value;if(a&&!d(a[1]))return!1}return!0;default:return!1}}function h(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function f(e){if(null==e)return""+e;var t=h(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function p(e){var t=f(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return a.prototype=Error.prototype,o.checkPropTypes=ye,o.resetWarningCache=ye.resetWarningCache,o.PropTypes=o,o};function xe(){}function _e(){}_e.resetWarningCache=xe;var Te=D((function(e){if("production"!==process.env.NODE_ENV){var t=se;e.exports=we(t.isElement,!0)}else e.exports=function(){function e(e,t,n,i,r,o){if(o!==de){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:_e,resetWarningCache:xe};return n.PropTypes=n,n}()}));const Ie=/https?:\/\/(.*?\.)?eko.com/,Ee={"eko.project.interaction":"interaction","eko.project.swipe":"swipe"};let Se=null,Ae=null,Ne=[];function Me(e){return t=>{var n;if(!Ie.test(t.origin)||"eko.embedapi"!==(null===(n=t.data)||void 0===n?void 0:n.source))return;const i=t.data,r=Ee[i.type];r&&(e?e(r,i.data):Ne.push({type:r,data:i.data}))}}"undefined"!=typeof window&&(Ae=Me(null),window.addEventListener("message",Ae));var Fe={subscribe:function(e){"function"==typeof e?Se?console.warn("[eko-gallery-react] Ignoring events subscribe since already subscribed"):(Se=e,Ae=Me(e),window.addEventListener("message",Ae),function(e){Ne.forEach((t=>{e(t.type,t.data)})),Ne=[]}(e)):console.warn("[eko-gallery-react] Ignoring events subscribe since a callback function was not provided as argument")},unsubscribe:function(){Ae?(window.removeEventListener("message",Ae),Ae=null,Se=null,Ne=[]):console.warn("[eko-gallery-react] Ignoring events unsubscribe since not subscribed")},send:function(e,t){Se?Se(e,t):Ne.push({type:e,data:t})}};const Ce=({index:t,activeIndex:n,setActiveIndex:i,item:r,src:o,navItemRefs:s,itemIcon:a})=>{var l,c;const u=null==r||null===(l=r.media)||void 0===l?void 0:l.srcset,d=null==r||null===(c=r.media)||void 0===c?void 0:c.sizes,h=!o&&(null==r?void 0:r.label),f=u?o:function(e,t=200){if(!e)return null;try{let n=e;e.includes("assets.eko.com")&&e.includes("/raw/")&&(n=e.replace("/raw/","/image/"));const i=new URL(n);return i.searchParams.set("width",t),i.href}catch(t){return e}}(o,150);let p=["addons-container",h?"full-thumb-label":""].join(" ").trim();return e.createElement("li",{className:"eko-nav-item","aria-current":n===t,onClick:function(){i(t),function(e){S.track("gallery.interaction",{elementid:`thumbnail-${e}`,interactiontype:"click"}),Fe.send("interaction",{elementid:`thumbnail-${e}`,interactiontype:"click"})}(t)},ref:s.current[t]},e.createElement("button",{type:"button","aria-label":`Go to item ${t}`},!h&&e.createElement("img",{src:f,srcSet:u,sizes:d,alt:null==r?void 0:r.name,loading:"eager",fetchPriority:"high"}),e.createElement("div",{className:p},(null==r?void 0:r.stepsIndication)&&e.createElement("div",{className:"step-indicator"},e.createElement("span",null),e.createElement("span",null),e.createElement("span",null)),(null==r?void 0:r.label)&&e.createElement("div",{className:"thumb-label"},null==r?void 0:r.label)),a&&e.createElement("div",{className:"item-icon"},e.createElement("span",{style:{backgroundImage:`url(${a})`}}))))};Ce.propTypes={index:Te.number,activeIndex:Te.number,setActiveIndex:Te.func.isRequired,item:Te.object.isRequired,src:Te.string,navItemRefs:Te.object.isRequired,itemIcon:Te.string};const Oe=({layout:t,nav:n,isVerticalNav:i,showPrevArrow:r,showNextArrow:o})=>{var s,a,l,c,u;const d=e.useRef(null),h=e.useRef(null),f="arrows"===(null==t||null===(s=t.mobile)||void 0===s||null===(s=s.config)||void 0===s||null===(s=s.navPagination)||void 0===s?void 0:s.type)?"eko-mobile-arrows":"",p="arrows"===(null!==(a=null==t||null===(l=t.desktop)||void 0===l||null===(l=l.config)||void 0===l||null===(l=l.navPagination)||void 0===l?void 0:l.type)&&void 0!==a?a:"arrows")?"eko-desktop-arrows":"",m=f||p,v=i?null==n||null===(c=n.current)||void 0===c?void 0:c.scrollHeight:null==n||null===(u=n.current)||void 0===u?void 0:u.scrollWidth;function g(e){const t=i?n.current.clientHeight:n.current.clientWidth,r=function(e,t){const n=i?t.scrollTop:t.scrollLeft;return Math.max(-n,Math.min(v-e-n,e))}("next"===e?t:-t,n.current);return{top:i?r:0,left:i?0:r,behavior:"smooth"}}function y(e){var t,i,r;const o=g(e),s="next"===e?null==h||null===(t=h.current)||void 0===t?void 0:t.id:null==d||null===(i=d.current)||void 0===i?void 0:i.id;var a,l;window.EkoAnalytics("track","gallery.interaction",{elementid:s,interactiontype:"click"}),null==n||null===(r=n.current)||void 0===r||r.scrollBy(o),a=s,l="click",S.track("gallery.interaction",{elementId:a,interactiontype:l}),Fe.send("interaction",{elementId:a,interactiontype:l})}return e.createElement(e.Fragment,null,m&&e.createElement(e.Fragment,null,e.createElement("button",R({type:"button","aria-label":"Go to previous item","aria-hidden":r?"false":"true",onClick:()=>y("prev"),ref:d,id:"eko-nav-prev-arrow",className:`eko-nav-arrow eko-prev-nav-button ${f} ${p} ${r?"":"eko-hidden-nav-button"}`},r?{}:{tabIndex:"-1"}),e.createElement("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M5.56127 9.52817C5.28966 9.22635 5.28966 8.77361 5.56127 8.502L10.39 3.67331C10.6918 3.37157 11.1445 3.37157 11.4161 3.67331C11.7179 3.94492 11.7179 4.39766 11.4161 4.66927L7.10044 8.98487L11.4161 13.3307C11.7179 13.6023 11.7179 14.055 11.4161 14.3266C11.1445 14.6285 10.6918 14.6285 10.4202 14.3266L5.56127 9.52817Z",fill:"black"}))),e.createElement("button",R({type:"button","aria-label":"Go to next item","aria-hidden":o?"false":"true",onClick:()=>y("next"),ref:h,className:`eko-nav-arrow eko-next-nav-button ${f} ${p} ${o?"":"eko-hidden-nav-button"}`,id:"eko-nav-next-arrow"},o?{}:{tabIndex:"-1"}),e.createElement("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M12.4387 8.47185C12.7103 8.77367 12.7103 9.22641 12.4387 9.49802L7.61003 14.3267C7.30821 14.6284 6.85547 14.6284 6.58386 14.3267C6.28212 14.0551 6.28212 13.6024 6.58386 13.3308L10.8996 9.01515L6.58386 4.66933C6.28212 4.39772 6.28212 3.94499 6.58386 3.67338C6.85547 3.37155 7.30821 3.37155 7.57982 3.67338L12.4387 8.47185Z",fill:"black"})))))};function Pe(e,t,n){let i;return function(){const n=this,r=arguments;clearTimeout(i),i=setTimeout((function(){i=null,e.apply(n,r)}),t)}}Oe.propTypes={layout:Te.object.isRequired,nav:Te.object.isRequired,isVerticalNav:Te.bool.isRequired,showPrevArrow:Te.bool.isRequired,showNextArrow:Te.bool.isRequired};const Re=({items:t,setActiveIndex:n,activeIndex:i,layout:r,carouselMounted:o,forceMobile:s})=>{const l=e.useRef(null),c=e.useRef(null),u=e.useRef([]),d=3,[h,f]=e.useState(null),[p,m]=e.useState(!1),[v,g]=e.useState(0),[y,b]=e.useState(!1),[k,w]=e.useState(!1);function x(){var e;const t=s||window.innerWidth<768?"mobile":"desktop",n=(null==r||null===(e=r[t])||void 0===e||null===(e=e.config)||void 0===e?void 0:e.orientation)||("desktop"===t?"left":"bottom");m("left"===n||"right"===n);const i=c.current.parentNode,a=o?".eko-smart-gallery-container iframe":".eko-carousel",l=i.querySelector(a);setTimeout((()=>{g(l.clientHeight)}),0)}function _(){var e,t;const n=s||a()?"mobile":"desktop",i=null!==(e=null==r||null===(t=r[n])||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.navPagination)||void 0===t?void 0:t.scrollThreshold)&&void 0!==e?e:d;!function(e=d){var t,n;const i=l.current;if(!i)return;const o="none"!==(null==r||null===(t=r.desktop)||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.navPagination)||void 0===t?void 0:t.type),c=(u=null==r||null===(n=r.mobile)||void 0===n||null===(n=n.config)||void 0===n||null===(n=n.navPagination)||void 0===n?void 0:n.type,"mask"===u||"arrows"===u);var u;if((s||a())&&!c)return void i.style.setProperty("-webkit-mask","none");if(!a()&&!o)return void i.style.setProperty("-webkit-mask","none");const h=i.scrollHeight-i.clientHeight,f=i.scrollTop>e?"85%":"100%",m=i.scrollTop<=h-e?"15%":"0%",v=i.scrollWidth-i.clientWidth,g=i.scrollLeft>e?"15%":"0%",y=i.scrollLeft<=v-e?"85%":"100%";p?i.style.setProperty("-webkit-mask",`linear-gradient(0deg,#0000,#000 ${m} ${f},#0000)`):i.style.setProperty("-webkit-mask",`linear-gradient(90deg,#0000,#000 ${g} ${y},#0000)`)}(i),function(e=d){var t,n,i,r,o,s;const a=p?null==l||null===(t=l.current)||void 0===t?void 0:t.scrollTop:null==l||null===(n=l.current)||void 0===n?void 0:n.scrollLeft,c=p?null==l||null===(i=l.current)||void 0===i?void 0:i.clientHeight:null==l||null===(r=l.current)||void 0===r?void 0:r.clientWidth,u=p?null==l||null===(o=l.current)||void 0===o?void 0:o.scrollHeight:null==l||null===(s=l.current)||void 0===s?void 0:s.scrollWidth;u-e<c?(b(!1),w(!1)):a<=e?(b(!1),w(!0)):a+c>u-e?(b(!0),w(!1)):a+e>0&&a<u-e&&(b(!0),w(!0))}(i)}u.current=null==t?void 0:t.map(((t,n)=>{var i,r;return null!==(i=null==u||null===(r=u.current)||void 0===r?void 0:r[n])&&void 0!==i?i:e.createRef()}));const T=Pe((e=>{var t;t=e,S.track("gallery.interaction",{elementid:"nav",interactiontype:t}),Fe.send("interaction",{elementid:"nav",interactiontype:t})}),200);const I=e.useCallback((e=>{n({index:e,step:0,source:"nav"})}),[]);return e.useEffect((()=>{var e;f(null===(e=u.current)||void 0===e?void 0:e[i])}),[i]),e.useEffect((()=>{if(null!=h&&h.current&&null!=l&&l.current){const e=h.current,t=l.current.clientWidth/2,n=e.clientWidth/2,i=l.current.clientHeight/2,r=e.clientHeight/2;l.current.scrollTo({left:e.offsetLeft-t+n,top:e.offsetTop-i+r,behavior:"smooth"})}}),[h]),e.useEffect((()=>{x()}),[]),e.useEffect((()=>(window.addEventListener("resize",x),()=>{window.removeEventListener("resize",x)})),[c,o,s]),e.useEffect((()=>{g(0),x()}),[t,c,o,s]),e.useEffect((()=>{_();const e=new ResizeObserver(_);return e.observe(l.current),()=>{e.disconnect()}}),[t,s,p]),e.createElement("div",{className:"eko-nav-container",ref:c,style:{opacity:v>0?1:0,height:""+(v&&p?v+"px":"auto")}},e.createElement(Oe,{layout:r,nav:l,isVerticalNav:p,showPrevArrow:y,showNextArrow:k}),e.createElement("ul",{className:`eko-nav eko-mobile-nav-selected-${null!==(E=null==r||null===(A=r.mobile)||void 0===A||null===(A=A.config)||void 0===A?void 0:A.navItemsSelectedType)&&void 0!==E?E:"underline"} eko-desktop-nav-selected-${null!==(N=null==r||null===(M=r.desktop)||void 0===M||null===(M=M.config)||void 0===M?void 0:M.navItemsSelectedType)&&void 0!==N?N:"underline"}`,ref:l,onScroll:function(){_()},onWheel:function(){T("wheel")},onTouchMove:function(){T("swipe")}},null==t?void 0:t.map(((t,n)=>{var r;const o=(null==t||null===(r=t.media)||void 0===r?void 0:r.url)||(null==t?void 0:t.media)||"";return e.createElement(Ce,{key:o+n,index:n,activeIndex:i,setActiveIndex:I,item:t,src:o,navItemRefs:u,itemIcon:null==t?void 0:t.icon})}))));var E,A,N,M};Re.propTypes={items:Te.array.isRequired,activeIndex:Te.number,setActiveIndex:Te.func.isRequired,layout:Te.object,carouselMounted:Te.bool,forceMobile:Te.bool};function De(){S.track("gallery.cover.displayed"),Fe.send("gallerycoverdisplayed")}function Le(e){if(!e)return e;try{const t=new URL(e);return t.host.includes("assets.eko.com")&&t.pathname.startsWith("/image")&&!t.searchParams.has("width")?(t.pathname.endsWith(".png")&&(t.pathname=t.pathname.replace(/\.png$/,".webp")),t.searchParams.set("width",1920),t.toString()):e}catch(t){return e}}const Be=({item:t,src:n,srcset:i,sizes:r,isCoverElement:o})=>{const s=e.useRef(null);return e.useEffect((()=>{var e;if(o){if(null===(e=s.current)||void 0===e||!e.complete)return s.current.addEventListener("load",De,{once:!0}),()=>{var e;null===(e=s.current)||void 0===e||e.removeEventListener("load",De,{once:!0})};De()}}),[]),e.createElement("img",{ref:s,src:Le(n),srcSet:i,sizes:r,alt:t.name,fetchPriority:o?"high":"auto",loading:o?"eager":"lazy",style:{width:"100%",height:"100%"}})};Be.propTypes={item:Te.object.isRequired,src:Te.string,srcset:Te.string,sizes:Te.string,isCoverElement:Te.bool};const ze=Pe((e=>{var t;t=e,S.track("gallery.interaction",{elementid:"carousel",interactiontype:t}),Fe.send("interaction",{elementid:"carousel",interactiontype:t})}),200);function We(){ze("wheel")}const $e=e.forwardRef((({items:t,setActiveIndex:n,activeIndex:i,showSmartLoaders:r},o)=>{const s=e.useRef(null),a=e.useRef([]);a.current=null==t?void 0:t.map(((t,n)=>{var i,r;return null!==(i=null==a||null===(r=a.current)||void 0===r?void 0:r[n])&&void 0!==i?i:e.createRef()}));const[l,c]=e.useState(),[u,d]=e.useState(),h=e.useRef(i),f=e.useRef(!1);function p(){const e=function(e){const t=e.scrollLeft,n=e.scrollWidth-e.clientWidth;return 0===t?0:t>n?100:t/n*100}(s.current)*(null==t?void 0:t.length)/100,i=Math.min(Math.trunc(e),(null==t?void 0:t.length)-1),r=h.current;"nav"!==r.source&&"external-nav"!==r.source?(f.current&&i!==r.index&&(f.current=!1),f.current||(i>(null==t?void 0:t.length)-1?n({index:(null==t?void 0:t.length)-1,source:"carousel"}):n({index:i,source:"carousel"}))):i===r.index?f.current=!0:f.current&&i!==r.index&&(f.current=!1,n({index:i,source:"carousel"}))}return e.useImperativeHandle(o,(()=>({prev:()=>{n({index:Math.max(0,h.current.index-1),source:"carousel"})},next:()=>{n({index:Math.min((null==t?void 0:t.length)-1,h.current.index+1),source:"carousel"})}}))),e.useEffect((()=>{const e=s.current;if(e)return e.addEventListener("scroll",p),()=>{e.removeEventListener("scroll",p)}}),[t]),e.useEffect((()=>{var e;let t=null===(e=a.current)||void 0===e?void 0:e[i.index];if(t&&("nav"===i.source||"external-nav"===i.source)){const e=t.current,n=s.current.clientWidth/2,i=(null==e?void 0:e.clientWidth)/2,r=(null==e?void 0:e.offsetLeft)-n+i;s.current.scrollTo({left:r,behavior:"smooth"})}}),[i]),e.useEffect((()=>{h.current=i,"nav"!==i.source&&"external-nav"!==i.source||(f.current=!1)}),[i]),e.createElement("ul",{className:"eko-carousel",ref:s,onScroll:p,onWheel:We,onTouchMove:function(e){d(e.targetTouches[0].clientX)},onTouchStart:function(e){c(e.targetTouches[0].clientX),d(null)},onTouchEnd:function(){u&&l&&(l-u>75||l-u<-75)&&ze("swipe")}},null==t?void 0:t.map(((t,n)=>{const i=(null==t?void 0:t.cover)||(null==t?void 0:t.media),o=(null==i?void 0:i.url)||i;return e.createElement("li",{className:"eko-carousel-item",key:o+n,ref:a.current[n]},e.createElement(Be,{item:t,src:o,srcset:null==i?void 0:i.srcset,sizes:null==i?void 0:i.sizes,isCoverElement:0===n}),r&&"image"!==t.type&&e.createElement("div",{className:"eko-smart-loading"},e.createElement("div",null),e.createElement("p",null,"Loading video experience")))})))}));function je(e){var t;return function(e){var t;return"eko.block.event"===(null==e||null===(t=e.data)||void 0===t?void 0:t.type)}(e)&&"GalleryBlock"===(null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.blockType)}$e.propTypes={items:Te.array.isRequired,setActiveIndex:Te.func.isRequired,activeIndex:Te.object,showSmartLoaders:Te.bool},$e.displayName="CarouselLoop";const Ue="eko.project.invoke",qe="eko.block.invoke";function Ve(e,t,n){var i;null!=e&&e.contentWindow&&(null==e||null===(i=e.contentWindow)||void 0===i||i.postMessage({target:"eko.embedapi",type:t,data:n},"*"))}function Ge(e){return`#variantId=${encodeURIComponent(e)}`}const He=e.forwardRef((({config:t,instanceId:n,setActiveItem:i,activeItem:r,variantId:o,smartGalleryLoaded:s,onLoad:l,forceMobile:c},u)=>{var d,h,f;const p=null!==(d=null===(h=t.options)||void 0===h?void 0:h.galleryEnv)&&void 0!==d?d:"",m=null===(f=t.__autoGenerated)||void 0===f||null===(f=f.publishItem)||void 0===f?void 0:f.id,v=function(e={}){let t="";return Object.entries(e).forEach((([e,n])=>{t+=`&${e}=${n}`})),t}(null==t?void 0:t.qp),g=function(e,t,n){return`https://${e}play.eko.com/embed?${n?`id=${n}`:`piid=${t}`}&nocover=true&galleryBlockMode=gallery&eko_pixel=true`}(p,m,n),y=e.useRef(null),b=e.useRef(null),k=e.useRef(!1),[w,x]=e.useState(Ge(o||"ekonovar")),[_,T]=e.useState(g+v+w);let I;function E(){S.track("gallery.project.display"),l(),Fe.send("galleryloaded")}return e.useImperativeHandle(u,(()=>({prev:()=>{Ve(null==b?void 0:b.current,qe,{action:"onPrevModule"})},next:()=>{Ve(null==b?void 0:b.current,qe,{action:"onNextModule"})}}))),e.useEffect((()=>{k.current?Ve(null==b?void 0:b.current,Ue,{action:"updateVariant",args:{id:o}}):x(Ge(o))}),[o]),e.useEffect((()=>{Ve(null==b?void 0:b.current,qe,{action:"updateActiveModule",args:{activeItemIndex:null==r?void 0:r.index,activeModuleIndex:null==r?void 0:r.step}})}),[r]),e.useEffect((()=>{function e(e){if((function(e){var t;return"eko.project.blockstart"===(null==e||null===(t=e.data)||void 0===t?void 0:t.type)}(e)||function(e){var t,n;return"eko.project.started"===(null==e||null===(t=e.data)||void 0===t?void 0:t.type)&&(null==e||null===(n=e.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.started)}(e))&&!k.current)return t=e.data.data.blockType,k.current=!0,void("GalleryBlock"===t?Ve(null==b?void 0:b.current,qe,{action:"updateActiveModule",args:{activeItemIndex:null==r?void 0:r.index,activeModuleIndex:null==r?void 0:r.step}}):E());var t;if(k.current){if(function(e){var t;return je(e)&&"activeModuleChanged"===(null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.name)}(e))return void function(e){const t=e.data.data.data.activeItemIndex,n=e.data.data.data.activeModuleIndex;t===(null==r?void 0:r.index)&&n===(null==r?void 0:r.step)||i({index:t,step:n,source:"carousel"})}(e);(function(e){var t;return je(e)&&"activeModuleChangeDone"===(null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.name)})(e)&&!s&&E()}}return I=c||a()?"mobile":"desktop",function(e,t={}){window.addEventListener("message",e,t)}(e),()=>{!function(e,t={}){window.removeEventListener("message",e,t)}(e)}}),[r]),e.useEffect((()=>{k.current||Ve(null==b?void 0:b.current,Ue,{action:"queryProjectStarted"})}),[r,s]),e.useEffect((()=>{k.current=!1}),[t]),e.useEffect((()=>{T(g+v+w)}),[w]),e.createElement("div",{className:"eko-smart-gallery-container "+(s?"":"eko-project-not-ready"),ref:y,"data-type":"smart-gallery","data-qp":v,"data-variant":o,"data-device":I},e.createElement("iframe",{allow:"autoplay; fullscreen",title:"eko gallery",src:_,style:{border:0},ref:b}))}));He.propTypes={config:Te.object.isRequired,instanceId:Te.string,setActiveItem:Te.func.isRequired,activeItem:Te.object.isRequired,variantId:Te.string,smartGalleryLoaded:Te.bool,onLoad:Te.func,forceMobile:Te.bool},He.displayName="SmartGallery";const Ke=()=>e.createElement("style",{suppressHydrationWarning:!0},'.eko-gallery {\n --accentColorEko: #000;\n --primaryColorEko: #000;\n --backgroundColorEko: #25D7A2;\n --navItemsBackgroundColorEko: transparent;\n --navItemsBannerBackgroundColorEko: #EEEEEE;\n --carouselItemsBackgroundColorEko: transparent;\n --carouselInteractiveCoverBackgroundColorEko: transparent;\n --galleryGapEkoMobile: 12px;\n --galleryGapEkoDesktop: 12px;\n --galleryPaddingEkoMobile: 0;\n --galleryPaddingEkoDesktop: 0;\n --galleryMaxWidthEkoMobile: 100%;\n --galleryMaxWidthEkoDesktop: 900px;\n --galleryTransition: .8s cubic-bezier(.35, 0, 0, 1) 1.5s;\n --navBarPaddingEkoMobile: 0 0 0 20px;\n --navBarPaddingEkoDesktop: 0;\n --navItemsWidthEkoMobile: 80px;\n --navItemsWidthEkoDesktop: 80px;\n --navItemsHeightEkoMobile: 80px;\n --navItemsHeightEkoDesktop: 80px;\n --navItemsGapEkoMobile: 14px;\n --navItemsGapEkoDesktop: 14px;\n --navItemsRadiusEkoMobile: 8px;\n --navItemsRadiusEkoDesktop: 8px;\n --navItemsSelectedMarginEkoMobile: 3px;\n --navItemsSelectedMarginEkoDesktop: 3px;\n --navItemsSelectedThicknessEkoMobile: 3px;\n --navItemsSelectedThicknessEkoDesktop: 3px;\n --navItemsSelectedUnderlineRadiusEkoMobile: 100px;\n --navItemsSelectedUnderlineRadiusEkoDesktop: 100px;\n --navItemsObjectFitEkoMobile: cover;\n --navItemsObjectFitEkoDesktop: cover;\n --navMediaBadgeSizeEkoMobile: 22px;\n --navMediaBadgeSizeEkoDesktop: 22px;\n --navMediaBadgeMarginTopEkoMobile: 4px;\n --navMediaBadgeMarginTopEkoDesktop: 4px;\n --navMediaBadgeMarginRightEkoMobile: 4px;\n --navMediaBadgeMarginRightEkoDesktop: 4px;\n --carouselItemsAspectRatioEkoMobile: 1 / 1;\n --carouselItemsAspectRatioEkoDesktop: 1 / 1;\n --carouselItemsRadiusEkoMobile: 0px;\n --carouselItemsRadiusEkoDesktop: 12px;\n --carouselItemsObjectFitEkoMobile: cover;\n --carouselItemsObjectFitEkoDesktop: cover;\n --navBannerFontSizeEkoMobile: 12px;\n --navBannerFontSizeEkoDesktop: 12px;\n --navBannerFontLineHeightEkoMobile: 120%;\n --navBannerFontLineHeightEkoDesktop: 120%;\n --navBannerFontFamilyEkoMobile: inherit;\n --navBannerFontFamilyEkoDesktop: inherit;\n --navBannerFontWeightEkoMobile: 400;\n --navBannerFontWeightEkoDesktop: 400;\n --outerWidth: 0\n}\n\n.eko-gallery * {\n box-sizing: border-box\n}\n\n.eko-gallery ul,\n.eko-gallery li {\n padding: 0;\n text-indent: 0;\n list-style-type: none;\n font-size: 0;\n margin: 0\n}\n\n.eko-gallery button {\n border: none;\n padding: 0\n}\n\n.eko-gallery .eko-hidden {\n display: none !important\n}\n\n.eko-gallery .eko-not-visible {\n visibility: hidden !important\n}\n\n.eko-hidden-variant {\n display: none !important\n}\n\n.eko-sr-only {\n width: 1px;\n height: 1px;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n margin: -1px;\n padding: 0;\n position: absolute;\n overflow: hidden\n}\n\n.eko-sticky-top {\n position: sticky;\n top: 0\n}\n\n.eko-gallery .eko-nav {\n height: 100%;\n display: flex;\n align-items: start;\n align-self: start;\n flex-shrink: 0;\n scrollbar-width: none;\n -ms-overflow-style: none\n}\n\n.eko-gallery .eko-nav li {\n font-size: 0;\n position: relative;\n display: flex;\n flex-shrink: 0;\n justify-content: center;\n -webkit-box-pack: center;\n cursor: pointer\n}\n\n.eko-gallery .eko-nav li button {\n position: relative;\n background-color: transparent;\n border-radius: 0;\n line-height: 0;\n overflow: hidden;\n cursor: pointer\n}\n\n.eko-gallery .eko-nav li button img {\n background-color: var(--navItemsBackgroundColorEko);\n pointer-events: none\n}\n\n.eko-gallery .eko-nav li button .item-icon {\n position: absolute;\n top: 0;\n right: 0;\n width: 32px;\n height: 32px;\n transform: scale(.25);\n transform-origin: top right\n}\n\n.eko-gallery .eko-nav li button .item-icon span {\n display: block;\n width: 400%;\n height: 400%;\n position: absolute;\n top: 0;\n right: 0;\n background-position: top right;\n background-repeat: no-repeat;\n background-size: contain\n}\n\n.eko-gallery .eko-nav li .addons-container {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n display: flex;\n flex-direction: column;\n font-size: 10px;\n line-height: 100%\n}\n\n.eko-gallery .eko-nav li .addons-container .thumb-label {\n width: 100%;\n background: var(--navItemsBannerBackgroundColorEko);\n padding: 4px;\n text-align: center;\n text-wrap: balance;\n color: var(--primaryColorEko)\n}\n\n.eko-gallery .eko-nav li .addons-container .step-indicator {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: center;\n gap: 5px;\n padding: 6px\n}\n\n.eko-gallery .eko-nav li .addons-container .step-indicator span {\n width: 5px;\n height: 5px;\n border-radius: 100px;\n background: #fff;\n box-shadow: 0 0 3px #00000094\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label {\n position: relative\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label .step-indicator {\n position: absolute;\n bottom: 0\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label .thumb-label {\n align-content: center\n}\n\n.eko-gallery .eko-nav::-webkit-scrollbar {\n display: none\n}\n\n.eko-nav-container {\n display: flex\n}\n\n.eko-nav-container:has(.eko-nav.eko-not-visible) .eko-nav-arrow {\n display: none\n}\n\n.eko-nav-container {\n position: relative;\n opacity: 0;\n transition: opacity .15s ease-in\n}\n\n.eko-nav-container .eko-nav-arrow {\n width: 28px;\n height: 28px;\n position: absolute;\n display: none;\n justify-content: center;\n align-items: center;\n border-radius: 28px;\n background-color: #fff;\n box-shadow: 0 0 6px #0000001f;\n z-index: 1;\n bottom: 50%;\n opacity: 1;\n transition: opacity .15s ease-in;\n transform: translateY(50%);\n cursor: pointer\n}\n\n.eko-nav-container .eko-nav-arrow.eko-prev-nav-button svg,\n.eko-nav-container .eko-nav-arrow.eko-next-nav-button svg {\n padding: 1px\n}\n\n.eko-nav-container .eko-nav-arrow.eko-prev-nav-button {\n left: 8px\n}\n\n.eko-nav-container .eko-nav-arrow.eko-next-nav-button {\n right: 8px\n}\n\n.eko-nav-container .eko-nav-arrow.eko-hidden-nav-button {\n opacity: 0;\n pointer-events: none\n}\n\n.eko-gallery .eko-nav {\n gap: var(--navItemsGapEkoMobile);\n padding: var(--navBarPaddingEkoMobile)\n}\n\n.eko-gallery .eko-nav li button img {\n width: var(--navItemsWidthEkoMobile);\n height: var(--navItemsHeightEkoMobile);\n object-fit: var(--navItemsObjectFitEkoMobile)\n}\n\n.eko-gallery .eko-nav li .addons-container .thumb-label {\n font-family: var(--navBannerFontFamilyEkoMobile);\n font-size: var(--navBannerFontSizeEkoMobile);\n line-height: var(--navBannerFontLineHeightEkoMobile);\n font-weight: var(--navBannerFontWeightEkoMobile)\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label .thumb-label {\n width: var(--navItemsWidthEkoMobile);\n height: var(--navItemsHeightEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-underline li {\n padding-bottom: calc(var(--navItemsSelectedThicknessEkoMobile) + var(--navItemsSelectedMarginEkoMobile))\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-underline li button {\n border-radius: var(--navItemsRadiusEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-underline li[aria-current=true]:after {\n content: "";\n width: 100%;\n height: var(--navItemsSelectedThicknessEkoMobile);\n border-radius: var(--navItemsSelectedUnderlineRadiusEkoMobile);\n background-color: var(--accentColorEko);\n display: block;\n position: absolute;\n bottom: 0;\n left: 0\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-outline li {\n padding: var(--navItemsSelectedMarginEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-outline li button {\n border-radius: var(--navItemsRadiusEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-outline li[aria-current=true] {\n border-radius: calc(var(--navItemsRadiusEkoMobile) + var(--navItemsSelectedMarginEkoMobile));\n box-shadow: 0 0 0 var(--navItemsSelectedThicknessEkoMobile) var(--accentColorEko)\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery .eko-nav {\n gap: var(--navItemsGapEkoDesktop);\n padding: var(--navBarPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li button img {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop);\n object-fit: var(--navItemsObjectFitEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .addons-container .thumb-label {\n font-family: var(--navBannerFontFamilyEkoDesktop);\n font-size: var(--navBannerFontSizeEkoDesktop);\n line-height: var(--navBannerFontLineHeightEkoDesktop);\n font-weight: var(--navBannerFontWeightEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .addons-container.full-thumb-label .thumb-label {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li {\n border-radius: 0;\n padding: 0;\n padding-bottom: calc(var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop))\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true] {\n box-shadow: none\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true]:after {\n content: "";\n width: 100%;\n height: var(--navItemsSelectedThicknessEkoDesktop);\n border-radius: var(--navItemsSelectedUnderlineRadiusEkoDesktop);\n background-color: var(--accentColorEko);\n display: block;\n position: absolute;\n bottom: 0;\n left: 0\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li {\n padding: var(--navItemsSelectedMarginEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true] {\n border-radius: calc(var(--navItemsRadiusEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop));\n box-shadow: 0 0 0 var(--navItemsSelectedThicknessEkoDesktop) var(--accentColorEko)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true]:after {\n content: none\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container .eko-nav-arrow {\n width: 30px;\n height: 30px\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container .eko-nav-arrow.eko-desktop-arrows {\n display: flex\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container:has(.eko-desktop-nav-selected-underline) .eko-nav-arrow.eko-desktop-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop)) / 2))\n }\n}\n\n@media screen and (max-width: 767px) {\n .eko-gallery.eko-liquid-gallery .eko-nav-arrow.eko-mobile-arrows {\n display: flex\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container:has(.eko-mobile-nav-selected-underline) .eko-nav-arrow.eko-mobile-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoMobile) + var(--navItemsSelectedMarginEkoMobile)) / 2))\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav {\n gap: var(--navItemsGapEkoDesktop);\n padding: var(--navBarPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li button img {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop);\n object-fit: var(--navItemsObjectFitEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .addons-container .thumb-label {\n font-family: var(--navBannerFontFamilyEkoDesktop);\n font-size: var(--navBannerFontSizeEkoDesktop);\n line-height: var(--navBannerFontLineHeightEkoDesktop);\n font-weight: var(--navBannerFontWeightEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .addons-container.full-thumb-label .thumb-label {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li {\n border-radius: 0;\n padding: 0;\n padding-bottom: calc(var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop))\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true] {\n box-shadow: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true]:after {\n content: "";\n width: 100%;\n height: var(--navItemsSelectedThicknessEkoDesktop);\n border-radius: var(--navItemsSelectedUnderlineRadiusEkoDesktop);\n background-color: var(--accentColorEko);\n display: block;\n position: absolute;\n bottom: 0;\n left: 0\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li {\n padding: var(--navItemsSelectedMarginEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true] {\n border-radius: calc(var(--navItemsRadiusEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop));\n box-shadow: 0 0 0 var(--navItemsSelectedThicknessEkoDesktop) var(--accentColorEko)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true]:after {\n content: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav-container .eko-nav-arrow {\n width: 30px;\n height: 30px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav-container .eko-nav-arrow.eko-desktop-arrows {\n display: flex\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav-container:has(.eko-desktop-nav-selected-underline) .eko-nav-arrow.eko-desktop-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop)) / 2))\n }\n}\n\n@media screen and (max-width: 767px) {\n .eko-gallery.eko-react-gallery.eko-mobile .eko-nav-arrow.eko-mobile-arrows {\n display: flex\n }\n\n .eko-gallery.eko-react-gallery.eko-mobile .eko-nav-container:has(.eko-mobile-nav-selected-underline) .eko-nav-arrow.eko-mobile-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoMobile) + var(--navItemsSelectedMarginEkoMobile)) / 2))\n }\n}\n\n.eko-media-badge {\n display: none;\n width: var(--navMediaBadgeSizeEkoMobile);\n height: var(--navMediaBadgeSizeEkoMobile);\n background: #fff;\n align-items: center;\n justify-content: center;\n border-radius: 100%;\n box-shadow: 0 0 4px #00000014;\n place-content: center;\n position: absolute;\n top: var(--navMediaBadgeMarginTopEkoMobile);\n right: var(--navMediaBadgeMarginRightEkoMobile)\n}\n\n.eko-media-badge svg {\n width: 100%;\n height: 100%\n}\n\n.eko-media-badge svg path {\n fill: #000\n}\n\n.eko-nav li .eko-media-badge-mobile {\n display: flex\n}\n\nsvg.interactiveThumb {\n position: absolute;\n top: 3px;\n right: -2.5px;\n width: 100%;\n height: 100%\n}\n\nsvg.interactiveThumb.hand {\n animation: handAnim 2.5s linear infinite\n}\n\nsvg.interactiveThumb.beam {\n animation: beamAnim 2.5s linear infinite;\n transform-origin: 26% 40%;\n top: 0\n}\n\n@keyframes handAnim {\n 0% {\n transform: translateY(0)\n }\n\n 3% {\n transform: translateY(-4px)\n }\n\n 15% {\n transform: translateY(0)\n }\n\n to {\n transform: translateY(0)\n }\n}\n\n@keyframes beamAnim {\n 0% {\n transform: scale(1);\n opacity: 0\n }\n\n 5% {\n transform: scale(1.1);\n opacity: 1\n }\n\n 30% {\n transform: scale(1.4);\n opacity: 0\n }\n\n to {\n transform: scale(1.4);\n opacity: 0\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery .eko-media-badge {\n width: var(--navMediaBadgeSizeEkoDesktop);\n height: var(--navMediaBadgeSizeEkoDesktop);\n top: var(--navMediaBadgeMarginTopEkoDesktop);\n right: var(--navMediaBadgeMarginRightEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .eko-media-badge-mobile {\n display: none\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .eko-media-badge-desktop {\n display: flex\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-media-badge {\n width: var(--navMediaBadgeSizeEkoDesktop);\n height: var(--navMediaBadgeSizeEkoDesktop);\n top: var(--navMediaBadgeMarginTopEkoDesktop);\n right: var(--navMediaBadgeMarginRightEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .eko-media-badge-mobile {\n display: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .eko-media-badge-desktop {\n display: flex\n }\n}\n\n.eko-loading-animation {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow: hidden;\n pointer-events: none\n}\n\n.eko-loading-animation.eko-show-loading-animation .eko-animated-bar {\n opacity: .6\n}\n\n.eko-loading-animation.eko-show-loading-animation .eko-animated-bar .eko-animated-bar-inner {\n animation: eko-loading-bar-inner-animation 2s infinite\n}\n\n.eko-loading-animation.eko-show-loading-text .eko-loading-text {\n opacity: 1\n}\n\n.eko-loading-animation .eko-animated-bar {\n width: 100%;\n height: 4px;\n background-color: #e8e8e8b2;\n opacity: 0;\n transition: opacity .5s;\n position: relative\n}\n\n.eko-loading-animation .eko-animated-bar .eko-animated-bar-inner {\n width: 150px;\n height: 100%;\n transform: translate(-150px);\n background-color: var(--accentColorEko, #4d484b);\n display: block;\n position: absolute\n}\n\n.eko-loading-animation .eko-loading-text {\n position: absolute;\n top: 10px;\n left: 50%;\n transform: translate(-50%);\n color: #656565;\n font-size: 12px;\n font-family: Bogle-Medium, sans-serif;\n font-weight: 500;\n opacity: 0;\n align-items: center;\n display: flex;\n gap: 2px;\n transition: opacity .5s\n}\n\n.eko-loading-animation .eko-loading-text-icon {\n opacity: 60%\n}\n\n.eko-loading-animation .eko-loading-text-icon svg {\n transform: translate(2px, 2px)\n}\n\n.eko-loading-animation .eko-loading-text-icon path {\n fill: var(--accentColorEko, #4d484b)\n}\n\n.eko-loading-animation.eko-hide-icon .eko-loading-text-icon {\n display: none\n}\n\n@keyframes eko-loading-bar-inner-animation {\n 0% {\n left: -350px\n }\n\n to {\n left: calc(100% + 350px)\n }\n}\n\n.eko-smart-loading {\n position: absolute;\n top: 8px;\n left: 50%;\n transform: translate(-50%);\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px\n}\n\n.eko-smart-loading div {\n position: relative;\n width: 158px;\n height: 3px;\n background-color: #dcdcdc;\n overflow: hidden;\n opacity: 0;\n animation: eko-smart-loading-show-animation .2s linear forwards 1s\n}\n\n.eko-smart-loading div:after {\n content: "";\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background-color: #878787;\n animation: eko-smart-loading-animation 2.5s ease-in-out infinite\n}\n\n.eko-smart-loading p {\n font-size: 11px;\n line-height: 120%;\n font-weight: 500;\n color: #6b6b6b;\n text-shadow: 0 0 2px white;\n opacity: 0;\n animation: eko-smart-loading-show-animation .2s linear forwards 3s\n}\n\n@keyframes eko-smart-loading-animation {\n 0% {\n transform: translate(-100%)\n }\n\n to {\n transform: translate(100%)\n }\n}\n\n@keyframes eko-smart-loading-show-animation {\n 0% {\n opacity: 0\n }\n\n to {\n opacity: 100%\n }\n}\n\n@media screen and (min-width: 450px) {\n .eko-gallery.eko-liquid-gallery .eko-loading-animation .eko-animated-bar {\n height: 6px\n }\n\n .eko-gallery.eko-liquid-gallery .eko-loading-animation .eko-loading-text {\n font-size: 16px;\n top: 12px\n }\n\n .eko-gallery.eko-liquid-gallery .eko-loading-animation .eko-loading-text-icon {\n transform: rotate(180deg)\n }\n}\n\n@media screen and (min-width: 450px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-loading-animation .eko-animated-bar {\n height: 6px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-loading-animation .eko-loading-text {\n font-size: 16px;\n top: 12px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-loading-animation .eko-loading-text-icon {\n transform: rotate(180deg)\n }\n}\n\n.eko-carousel {\n width: 100%;\n white-space: nowrap;\n overflow-x: auto;\n overflow-y: hidden;\n scroll-snap-type: x mandatory;\n overscroll-behavior-x: contain;\n align-self: start;\n align-items: start;\n display: flex;\n gap: 10px;\n scrollbar-width: none;\n -ms-overflow-style: none\n}\n\n.eko-carousel li {\n width: 100%;\n display: inline-block;\n position: relative;\n align-items: start;\n overflow: hidden;\n scroll-snap-align: center;\n scroll-snap-stop: always;\n flex-shrink: 0\n}\n\n.eko-carousel li img.eko-cover-image {\n position: relative;\n pointer-events: none;\n transition: opacity .5s;\n z-index: 1;\n width: 100%;\n height: 100%;\n background-color: var(--carouselInteractiveCoverBackgroundColorEko)\n}\n\n.eko-carousel li iframe {\n position: absolute;\n border: none;\n top: 0;\n left: 0\n}\n\n.eko-carousel li img,\n.eko-carousel li video {\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n min-width: 0;\n background-color: var(--carouselItemsBackgroundColorEko)\n}\n\n.eko-carousel li[data-type=videoembed],\n.eko-carousel li[data-type=video] {\n cursor: pointer\n}\n\n.eko-carousel::-webkit-scrollbar {\n display: none\n}\n\n.eko-carousel:has(.zoomed) {\n overflow: hidden\n}\n\n.eko-carousel li {\n border-radius: var(--carouselItemsRadiusEkoMobile)\n}\n\n.eko-carousel li img.eko-desktop-cover-image {\n display: none\n}\n\n.eko-carousel li img.eko-mobile-cover-image {\n display: inline\n}\n\n.eko-carousel li img,\n.eko-carousel li video {\n aspect-ratio: var(--carouselItemsAspectRatioEkoMobile);\n object-fit: var(--carouselItemsObjectFitEkoMobile)\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery .eko-carousel li {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-carousel li img,\n .eko-gallery.eko-liquid-gallery .eko-carousel li video {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop);\n object-fit: var(--carouselItemsObjectFitEkoDesktop)\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-carousel li {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-carousel li img,\n .eko-gallery.eko-react-gallery.eko-desktop .eko-carousel li video {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop);\n object-fit: var(--carouselItemsObjectFitEkoDesktop)\n }\n}\n\n.eko-gallery.eko-mobile-embed-layout .eko-nav-container {\n display: none\n}\n\n.eko-gallery.eko-mobile-embed-layout .eko-carousel {\n overflow-x: hidden\n}\n\n.eko-gallery.eko-mobile-embed-layout .eko-mobile-carousel-scroll {\n overflow-x: auto\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery.eko-desktop-embed-layout .eko-nav-container {\n display: none\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-embed-layout .eko-carousel {\n overflow-x: hidden\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-embed-layout .eko-carousel.eko-desktop-carousel-scroll {\n overflow-x: auto\n }\n\n .eko-gallery.eko-liquid-gallery.eko-mobile-embed-layout.eko-desktop-nav-layout .eko-nav-container {\n display: flex\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-embed-layout .eko-nav-container {\n display: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-embed-layout .eko-carousel {\n overflow-x: hidden\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-embed-layout .eko-carousel.eko-desktop-carousel-scroll {\n overflow-x: auto\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-mobile-embed-layout.eko-desktop-nav-layout .eko-nav-container {\n display: flex\n }\n}\n\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-bottom .eko-nav,\n.eko-gallery.eko-desktop-nav-layout.eko-desktop-nav-bottom .eko-nav,\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-top .eko-nav,\n.eko-gallery.eko-desktop-nav-layout.eko-desktop-nav-top .eko-nav {\n flex-direction: row;\n overflow-x: auto;\n overflow-y: hidden;\n max-width: 100%;\n margin: auto\n}\n\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-bottom {\n flex-direction: column-reverse\n}\n\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-top {\n flex-direction: column\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-bottom {\n flex-direction: column-reverse\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-top {\n flex-direction: column\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-bottom {\n flex-direction: column-reverse\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-top {\n flex-direction: column\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right {\n flex-direction: row-reverse\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left {\n flex-direction: row\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav {\n display: flex;\n flex-direction: column;\n justify-content: start;\n overflow-x: hidden;\n overflow-y: auto;\n gap: var(--navItemsGapEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container {\n display: flex;\n flex-shrink: 0\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button {\n top: 4px;\n left: auto\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n bottom: 4px\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n right: 50%;\n transform: translate(50%)\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg {\n transform: rotate(90deg)\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout .eko-carousel {\n align-self: start\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right {\n flex-direction: row-reverse\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left {\n flex-direction: row\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav {\n display: flex;\n flex-direction: column;\n justify-content: start;\n overflow-x: hidden;\n overflow-y: auto;\n gap: var(--navItemsGapEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container {\n display: flex;\n flex-shrink: 0\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button {\n top: 4px;\n left: auto\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n bottom: 4px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n right: 50%;\n transform: translate(50%)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg {\n transform: rotate(90deg)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout .eko-carousel {\n align-self: start\n }\n}\n\n.eko-gallery .eko-introButton {\n cursor: pointer;\n white-space: nowrap;\n pointer-events: auto;\n position: absolute;\n bottom: 100px;\n left: 50%;\n transform: translate(-50%);\n padding: 15px 20px\n}\n\n.eko-gallery .eko-introButton .eko-handContainer {\n display: none\n}\n\n.eko-gallery {\n position: relative;\n overflow: hidden;\n display: flex;\n flex-direction: row;\n justify-content: start;\n margin-inline-start: calc(-1 * var(--outerWidth));\n margin-inline-end: calc(-1 * var(--outerWidth));\n padding: var(--galleryPaddingEkoMobile);\n margin: auto;\n max-width: var(--galleryMaxWidthEkoMobile);\n transition: height var(--galleryTransition, .8s cubic-bezier(.35, 0, 0, 1) 1.5s), padding 0s;\n gap: var(--galleryGapEkoMobile)\n}\n\n.eko-gallery .eko-smart-gallery-container {\n border-radius: var(--carouselItemsRadiusEkoMobile);\n overflow: hidden;\n flex: 1;\n display: flex;\n height: fit-content\n}\n\n.eko-gallery .eko-smart-gallery-container iframe {\n width: 100%;\n aspect-ratio: var(--carouselItemsAspectRatioEkoMobile)\n}\n\n.eko-gallery .eko-smart-gallery-container.eko-project-not-ready {\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n opacity: 0;\n pointer-events: none;\n touch-action: none\n}\n\n.eko-gallery .eko-smart-gallery-container.eko-project-not-ready iframe {\n pointer-events: none;\n touch-action: none\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery {\n max-width: var(--galleryMaxWidthEkoDesktop);\n gap: var(--galleryGapEkoDesktop);\n padding: var(--galleryPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-smart-gallery-container {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-smart-gallery-container iframe {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop)\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop {\n max-width: var(--galleryMaxWidthEkoDesktop);\n gap: var(--galleryGapEkoDesktop);\n padding: var(--galleryPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-smart-gallery-container {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-smart-gallery-container iframe {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop)\n }\n}'),Xe=({layout:t,style:n})=>{let i={};return function(e={}){Object.keys(e).forEach((t=>{i[`--${t}Eko`]=e[t]}))}(n),function(e){var t,n;const r=(null==e||null===(t=e.desktop)||void 0===t?void 0:t.config)||{},o=(null==e||null===(n=e.mobile)||void 0===n?void 0:n.config)||{};Object.keys(r).forEach((e=>{"string"==typeof r[e]&&(i[`--${e}EkoDesktop`]=r[e])})),Object.keys(o).forEach((e=>{"string"==typeof o[e]&&(i[`--${e}EkoMobile`]=o[e])}))}(t),e.createElement("style",{key:{layout:t,style:n}},`.eko-gallery {${Object.keys(i).map((e=>`${e}: ${i[e]};`)).join("\n")}}`)};Xe.propTypes={layout:Te.object,style:Te.object},u("experiment");const Ye=({activeVariantId:t,activeElementId:n,hasInteractive:i,experiments:r,publishItem:o})=>{const s="gallery",a=e.useRef(t),l=e.useRef(n),c=e.useRef(i),u=e.useRef(r),d=e.useRef(o);e.useEffect((()=>{a.current=t,l.current=n,c.current=i,u.current=r,d.current=o}),[t,n,i,r,o]);const h={publishItemPacker:{tag:s,schema:"iglu:com.helloeko/publishitem/jsonschema/1-0-0",match:/.*/,getData:function(){const e=d.current;if(e){const t={};return null!=e&&e.id&&(t.id=e.id),null!=e&&e.productId&&(t.productid=e.productId),e.salesChannelId&&(t.saleschannelid=e.salesChannelId),null!=e&&e.salesChannelName&&(t.saleschannelname=e.salesChannelName),e.salesChannelType&&(t.saleschanneltype=e.salesChannelType),t.id?t:void 0}}},galleryInteractionPacker:{tag:s,schema:"iglu:com.helloeko/gallery_interaction/jsonschema/1-0-0",match:"gallery.interaction",getData:function({elementid:e,interactiontype:t}){return{elementid:String(e),interactiontype:t}}},galleryPacker:{tag:s,schema:"iglu:com.helloeko/gallery/jsonschema/1-0-2",match:/^gallery.*/,getData:function(){var e;return{activeitemid:l.current.toString(),activevariantid:a.current,hasinteractive:c.current,version:(null===(e=window.eko)||void 0===e||null===(e=e.gallery)||void 0===e?void 0:e.version)||""}}},activeVariantIdPacker:{tag:s,schema:"iglu:com.helloeko/variant/jsonschema/1-0-1",match:/.*/,getData:function(){if(a.current)return{id:a.current}}},experimentPacker:{tag:s,schema:"iglu:com.helloeko/experiment/jsonschema/1-0-3",match:/.*/,getData:function(){var e;let t=function(e){let t=null;if(e){const n=Math.floor(Date.now()/1e3);for(const i of e){if("deliverable"!==i.type)return;const e=Math.floor(new Date(i.startDate).getTime()/1e3),r=Math.floor(new Date(i.endDate).getTime()/1e3);!0===i.active&&n>e&&n<r&&(t=i)}}return t}(u.current);if(!t)return;let n={experimentid:t.id||"",experimentvariant:t.chosen||"pending decision",experimenttype:t.type||""},i=null===(e=t.targetDevice)||void 0===e?void 0:e.toLowerCase();return"mobile"!==i&&"notmobile"!==i||(n.experimenttargeting={device:i}),n}}};return e.useEffect((()=>(Object.values(h).forEach((e=>{window.EkoAnalytics("registerContextPacker",e)})),()=>{window.EkoAnalytics("reset",s)})),[]),null};Ye.propTypes={activeVariantId:Te.string,activeElementId:Te.number,hasInteractive:Te.bool,experiments:Te.array,publishItem:Te.object};const Qe=({variantId:t,activeItem:n,hasInteractive:i,activeIndex:r,experiments:o,publishItem:s})=>{const a=e.useRef(!0);return e.useEffect((()=>{a.current||t&&S.track("gallery.variant.change")}),[t]),e.useEffect((()=>{a.current||S.track("gallery.element.change",{activeIndex:r})}),[r]),e.useEffect((()=>{a.current||n&&null!=s&&s.id&&S.track("gallery.asset.view",{publishitemid:s.id,type:n.type,name:n.name})}),[n]),e.useEffect((()=>{a.current=!1}),[]),e.createElement(Ye,{activeVariantId:t||"ekonovar",activeElementId:r,hasInteractive:i,experiments:o,publishItem:s})};Qe.propTypes={variantId:Te.string,activeItem:Te.object,hasInteractive:Te.bool,activeIndex:Te.number,experiments:Te.array,publishItem:Te.object};const Je="eko-gallery-react";function Ze(e,t){var n,i,r;const o=(null==e||null===(n=e.variantMap)||void 0===n?void 0:n[t])||"ekonovar";return(null==e||null===(i=e.items)||void 0===i?void 0:i.find((e=>(null==e?void 0:e.variantId)===o)))||(null==e||null===(r=e.items)||void 0===r?void 0:r[0])}"undefined"!=typeof window&&(window.EkoAnalytics||(console.log("EkoAnalytics is not defined, initializing a no-op function..."),window.EkoAnalytics=()=>{}));const et=e.forwardRef((({className:t,config:n,instanceId:i,variantId:r,activeItem:o={index:0,step:0},onEvent:s,forceMobile:a},l)=>{var c,u,d,h,f,p;const m=null!==(c=null===(u=n.options)||void 0===u?void 0:u.loadingTimeout)&&void 0!==c?c:12,v=null===(d=null===(h=n.options)||void 0===h?void 0:h.showCoverLoadAnimation)||void 0===d||d,[g,y]=e.useState(Ze(n,r)),[b,k]=e.useState({index:o.index,step:o.step,source:"external-nav"}),[w,x]=e.useState(!1),[_,T]=e.useState(!1),[I,E]=e.useState("eko-desktop"),A=e.useRef(!1),N=e.useRef(!1),M=e.useRef(o),F=e.useRef(null),C=e.useRef(r);function O(){const e=a||window.innerWidth<768?"eko-mobile":"eko-desktop";E(e)}return N.current||(Fe.send("galleryinit"),N.current=!0),e.useEffect((()=>{const e=C.current!==r;C.current=r,y(Ze(n,r)),e&&!A.current&&k({index:0,step:0,source:"external-nav"})}),[n,r]),e.useEffect((()=>{if(s)return Fe.subscribe(s),()=>{Fe.unsubscribe()}}),[s]),e.useEffect((()=>{A.current=_}),[_]),e.useEffect((()=>{x(!1),T(!1);const e=setTimeout((()=>{A.current||(x(!0),S.track("gallery.load.timeout"))}),1e3*m);return()=>{clearTimeout(e)}}),[n]),e.useEffect((()=>{O()}),[a]),e.useEffect((()=>(window.addEventListener("resize",O),O(),()=>{window.removeEventListener("resize",O)})),[a]),e.useEffect((()=>(window.EkoAnalytics("trackElementVisibility",F.current,Je),()=>{window.EkoAnalytics("stopTrackingElementVisibility",Je)})),[]),e.useEffect((()=>{!("carousel"===(null==b?void 0:b.source)||"nav"===(null==b?void 0:b.source))||(null==b?void 0:b.index)===o.index&&(null==b?void 0:b.step)===o.step||Fe.send("activeitemchanged",{index:null==b?void 0:b.index,step:null==b?void 0:b.step})}),[b,o]),e.useEffect((()=>{M.current.index===o.index&&M.current.step===o.step||(M.current=o,k({index:o.index,step:o.step,source:"external-nav"}))}),[o]),e.createElement(e.Fragment,null,e.createElement(Ke,null),e.createElement(Xe,{layout:n.layout,style:n.style,forceMobile:a}),e.createElement(Qe,{variantId:r,activeItem:null==g||null===(f=g.items)||void 0===f?void 0:f[b.index],activeIndex:b.index,hasInteractive:_,experiments:n.experiments,publishItem:null==n||null===(p=n.__autoGenerated)||void 0===p?void 0:p.publishItem}),e.createElement("section",{className:`${`eko-gallery eko-react-gallery ${function(e){let t="";return["mobile","desktop"].forEach((n=>{var i,r;const o=null!==(i=null==e||null===(r=e[n])||void 0===r?void 0:r.type)&&void 0!==i?i:"nav";if(t+=`eko-${n}-${o}-layout `,"nav"===o){var s;const i="desktop"===n,r=(null==e||null===(s=e[n])||void 0===s||null===(s=s.config)||void 0===s?void 0:s.orientation)||(i?"left":"bottom");t+=`eko-${n}-nav-${r} `}})),t}(n.layout)} ${null!=t?t:""}`.trim()} ${I}`,"aria-controls":"main-content",ref:F},e.createElement(Re,{items:(null==g?void 0:g.items)||[],setActiveIndex:k,activeIndex:b.index,layout:n.layout,carouselMounted:_,forceMobile:a}),!_&&e.createElement($e,{ref:l,items:(null==g?void 0:g.items)||[],setActiveIndex:k,activeIndex:{index:b.index,source:null==b?void 0:b.source},showSmartLoaders:!w&&v}),!w&&e.createElement(He,{ref:l,config:n,instanceId:i,activeItem:b,setActiveItem:k,variantId:null==g?void 0:g.variantId,smartGalleryLoaded:_,forceMobile:a,onLoad:function(){T(!0)}})))}));et.propTypes={className:Te.string,config:Te.object.isRequired,instanceId:Te.string,variantId:Te.string,activeItem:Te.object,onEvent:Te.func,forceMobile:Te.bool,onPrev:Te.func,onNext:Te.func},et.displayName="EkoGallery";var tt=e.memo(et);const nt=u("gallery-react");const it=e.forwardRef(((t,n)=>{var i;e.useEffect((()=>(nt.setDataStorage("gallery-react",{config:t.config}),window.eko=window.eko||{},window.eko.config=t.config,window.eko.gallery={version:"devops-main/4.0.8"},()=>{window.eko.config=void 0})),[t.config]);const{children:r,...o}=t;return void 0!==t.config?e.createElement(tt,R({ref:n},o,{key:null===(i=t.config.__autoGenerated)||void 0===i||null===(i=i.publishItem)||void 0===i?void 0:i.id})):r}));it.propTypes={className:Te.string,config:Te.object,variantId:Te.string,onEvent:Te.func,instanceId:Te.string,children:Te.node},it.displayName="EkoGalleryWrapper";var rt,ot,st,at,lt,ct,ut,dt,ht,ft,pt,mt,vt,gt,yt,bt,kt,wt,xt,_t,Tt,It,Et,St,At,Nt,Mt,Ft,Ct,Ot,Pt,Rt,Dt,Lt,Bt,zt,Wt,$t,jt,Ut,qt,Vt,Gt,Ht,Kt,Xt,Yt,Qt,Jt,Zt,en,tn,nn=e.memo(it);const rn=1,on=2,sn=4,an=8,ln=16,cn=1,un=4,dn=8,hn=16,fn="[",pn="[!",mn="]",vn={},gn=Symbol(),yn=Symbol("filename"),bn="http://www.w3.org/1999/xhtml",kn="@attach",wn=!0;var xn=Array.isArray,_n=Array.prototype.indexOf,Tn=Array.from,In=Object.defineProperty,En=Object.getOwnPropertyDescriptor,Sn=Object.getOwnPropertyDescriptors,An=Object.prototype,Nn=Array.prototype,Mn=Object.getPrototypeOf,Fn=Object.isExtensible;function Cn(){var e,t;return{promise:new Promise(((n,i)=>{e=n,t=i})),resolve:e,reject:t}}const On=2,Pn=4,Rn=8,Dn=1<<24,Ln=16,Bn=32,zn=64,Wn=128,$n=512,jn=1024,Un=2048,qn=4096,Vn=8192,Gn=16384,Hn=32768,Kn=65536,Xn=1<<17,Yn=1<<18,Qn=1<<19,Jn=1<<20,Zn=1<<25,ei=32768,ti=1<<21,ni=1<<22,ii=1<<23,ri=Symbol("$state"),oi=Symbol("legacy props"),si=Symbol(""),ai=Symbol("proxy path"),li=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},ci=3,ui=8;function di(e){{const t=new Error(`lifecycle_outside_component\n\`${e}(...)\` can only be used during component initialisation\nhttps://svelte.dev/e/lifecycle_outside_component`);throw t.name="Svelte error",t}}var hi="font-weight: bold",fi="font-weight: normal";function pi(e){console.warn("%c[svelte] hydration_mismatch\n%cHydration failed because the initial UI does not match what was rendered on the server\nhttps://svelte.dev/e/hydration_mismatch",hi,fi)}function mi(e){console.warn(`%c[svelte] state_proxy_equality_mismatch\n%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${e}\` will produce unexpected results\nhttps://svelte.dev/e/state_proxy_equality_mismatch`,hi,fi)}let vi,gi=!1;function yi(e){gi=e}function bi(e){if(null===e)throw pi(),vn;return vi=e}function ki(){return bi(Ro(vi))}function wi(e){if(gi){if(null!==Ro(vi))throw pi(),vn;vi=e}}function xi(e=!0){for(var t=0,n=vi;;){if(n.nodeType===ui){var i=n.data;if(i===mn){if(0===t)return n;t-=1}else i!==fn&&i!==pn||(t+=1)}var r=Ro(n);e&&n.remove(),n=r}}function _i(e){if(!e||e.nodeType!==ui)throw pi(),vn;return e.data}function Ti(e){return e===this.v}function Ii(e){return t=e,n=this.v,!(t!=t?n==n:t!==n||null!==t&&"object"==typeof t||"function"==typeof t);var t,n}let Ei=!1;function Si(e,t){return e.label=t,Ai(e.v,t),e}function Ai(e,t){var n;return null==e||null===(n=e[ai])||void 0===n||n.call(e,t),e}function Ni(e){const t=new Error,n=function(){const e=Error.stackTraceLimit;Error.stackTraceLimit=1/0;const t=(new Error).stack;if(Error.stackTraceLimit=e,!t)return[];const n=t.split("\n"),i=[];for(let e=0;e<n.length;e++){const t=n[e],r=t.replaceAll("\\","/");if("Error"!==t.trim()){if(t.includes("validate_each_keys"))return[];r.includes("svelte/src/internal")||r.includes("node_modules/.vite")||i.push(t)}}return i}();return 0===n.length?null:(n.unshift("\n"),In(t,"stack",{value:n.join("\n")}),In(t,"name",{value:e}),t)}let Mi=null;function Fi(e){Mi=e}let Ci=null;function Oi(e){Ci=e}let Pi=null;function Ri(e){Pi=e}function Di(e){return zi("getContext").get(e)}function Li(e,t=!1,n){Mi={p:Mi,i:!1,c:null,e:null,s:e,x:null,l:null},Mi.function=n,Pi=n}function Bi(e){var t,n,i=Mi,r=i.e;if(null!==r)for(var o of(i.e=null,r))Ko(o);return i.i=!0,Mi=i.p,Pi=null!==(t=null===(n=Mi)||void 0===n?void 0:n.function)&&void 0!==t?t:null,{}}function zi(e){var t,n;return null===Mi&&di(e),null!==(n=(t=Mi).c)&&void 0!==n?n:t.c=new Map(function(e){let t=e.p;for(;null!==t;){const e=t.c;if(null!==e)return e;t=t.p}return null}(Mi)||void 0)}let Wi=[];function $i(){var e=Wi;Wi=[],function(e){for(var t=0;t<e.length;t++)e[t]()}(e)}function ji(e){if(0===Wi.length&&!or){var t=Wi;queueMicrotask((()=>{t===Wi&&$i()}))}Wi.push(e)}function Ui(){for(;Wi.length>0;)$i()}const qi=new WeakMap;function Vi(e){var t=gs;if(null===t)return ps.f|=ii,e;if(e instanceof Error&&!qi.has(e)&&qi.set(e,function(e,t){var n,i;const r=En(e,"message");if(r&&!r.configurable)return;var o=No?" ":"\t",s=`\n${o}in ${(null===(n=t.fn)||void 0===n?void 0:n.name)||"<unknown>"}`,a=t.ctx;for(;null!==a;){var l;s+=`\n${o}in ${null===(l=a.function)||void 0===l?void 0:l[yn].split("/").pop()}`,a=a.p}return{message:e.message+`\n${s}\n`,stack:null===(i=e.stack)||void 0===i?void 0:i.split("\n").filter((e=>!e.includes("svelte/src/internal"))).join("\n")}}(e,t)),t.f&Hn)Gi(e,t);else{if(!(t.f&Wn))throw!t.parent&&e instanceof Error&&Hi(e),e;t.b.error(e)}}function Gi(e,t){for(;null!==t;){if(t.f&Wn)try{return void t.b.error(e)}catch(t){e=t}t=t.parent}throw e instanceof Error&&Hi(e),e}function Hi(e){const t=qi.get(e);t&&(In(e,"message",{value:t.message}),In(e,"stack",{value:t.stack}))}const Ki=-7169;function Xi(e,t){e.f=e.f&Ki|t}function Yi(e){e.f&$n||null===e.deps?Xi(e,jn):Xi(e,qn)}function Qi(e){if(null!==e)for(const t of e)t.f&On&&t.f&ei&&(t.f^=ei,Qi(t.deps))}function Ji(e,t,n){e.f&Un?t.add(e):e.f&qn&&n.add(e),Qi(e.deps),Xi(e,jn)}const Zi=new Set;let er=null,tr=null,nr=[],ir=null,rr=!1,or=!1;var sr=new WeakMap,ar=new WeakMap,lr=new WeakMap,cr=new WeakMap,ur=new WeakMap,dr=new WeakMap,hr=new WeakMap,fr=new WeakSet;class pr{constructor(){O(this,fr),P(this,"committed",!1),P(this,"current",new Map),P(this,"previous",new Map),F(this,sr,new Set),F(this,ar,new Set),F(this,lr,0),F(this,cr,0),F(this,ur,null),F(this,dr,new Set),F(this,hr,new Set),P(this,"skipped_effects",new Set),P(this,"is_fork",!1)}is_deferred(){return this.is_fork||M(cr,this)>0}process(e){nr=[],this.apply();var t,n=[],i=[];for(const t of e)A(fr,this,mr).call(this,t,n,i);(this.is_fork||A(fr,this,gr).call(this),this.is_deferred())?(A(fr,this,vr).call(this,i),A(fr,this,vr).call(this,n)):(er=null,xr(i),xr(n),null===(t=M(ur,this))||void 0===t||t.resolve());tr=null}capture(e,t){var n;(t===gn||this.previous.has(e)||this.previous.set(e,t),e.f&ii)||(this.current.set(e,e.v),null===(n=tr)||void 0===n||n.set(e,e.v))}activate(){er=this,this.apply()}deactivate(){er===this&&(er=null,tr=null)}flush(){if(this.activate(),nr.length>0){if(br(),null!==er&&er!==this)return}else 0===M(lr,this)&&this.process([]);this.deactivate()}discard(){for(const e of M(ar,this))e(this);M(ar,this).clear()}increment(e){C(lr,this,M(lr,this)+1),e&&C(cr,this,M(cr,this)+1)}decrement(e){C(lr,this,M(lr,this)-1),e&&C(cr,this,M(cr,this)-1),this.revive()}revive(){for(const e of M(dr,this))M(hr,this).delete(e),Xi(e,Un),Ir(e);for(const e of M(hr,this))Xi(e,qn),Ir(e);this.flush()}oncommit(e){M(sr,this).add(e)}ondiscard(e){M(ar,this).add(e)}settled(){var e;return(null!==(e=M(ur,this))&&void 0!==e?e:C(ur,this,Cn())).promise}static ensure(){if(null===er){const e=er=new pr;Zi.add(er),or||pr.enqueue((()=>{er===e&&e.flush()}))}return er}static enqueue(e){ji(e)}apply(){}}function mr(e,t,n){e.f^=jn;for(var i=e.first,r=null;null!==i;){var o=i.f,s=!!(o&(Bn|zn));if(!(s&&!!(o&jn)||!!(o&Vn)||this.skipped_effects.has(i))&&null!==i.fn){s?i.f^=jn:null!==r&&o&(Pn|Rn|Dn)?r.b.defer_effect(i):o&Pn?t.push(i):Ns(i)&&(o&Ln&&M(dr,this).add(i),Ps(i));var a=i.first;if(null!==a){i=a;continue}}var l=i.parent;for(i=i.next;null===i&&null!==l;)l===r&&(r=null),i=l.next,l=l.parent}}function vr(e){for(var t=0;t<e.length;t+=1)Ji(e[t],M(dr,this),M(hr,this))}function gr(){if(0===M(cr,this)){for(const e of M(sr,this))e();M(sr,this).clear()}0===M(lr,this)&&A(fr,this,yr).call(this)}function yr(){if(Zi.size>1){this.previous.clear();var e=tr,t=!0;for(const e of Zi){if(e===this){t=!1;continue}const i=[];for(const[n,r]of this.current){if(e.current.has(n)){if(!t||r===e.current.get(n))continue;e.current.set(n,r)}i.push(n)}if(0===i.length)continue;const r=[...e.current.keys()].filter((e=>!this.current.has(e)));if(r.length>0){var n=nr;nr=[];const t=new Set,o=new Map;for(const e of i)_r(e,r,t,o);if(nr.length>0){er=e,e.apply();for(const t of nr)A(fr,e,mr).call(e,t,[],[]);e.deactivate()}nr=n}}er=null,tr=e}this.committed=!0,Zi.delete(this)}function br(){var e=us;rr=!0;var t=new Set;try{var n=0;for(ds(!0);nr.length>0;){var i=pr.ensure();if(n++>1e3){if(wn){var r=new Map;for(const e of i.current.keys())for(const[t,n]of null!==(o=e.updated)&&void 0!==o?o:[]){var o,s=r.get(t);s||(s={error:n.error,count:0},r.set(t,s)),s.count+=n.count}for(const e of r.values())e.error&&console.error(e.error)}kr()}if(i.process(nr),uo.clear(),wn)for(const e of i.current.keys())t.add(e)}}finally{rr=!1,ds(e),ir=null;for(const e of t)e.updated=null}}function kr(){try{!function(){{const e=new Error("effect_update_depth_exceeded\nMaximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state\nhttps://svelte.dev/e/effect_update_depth_exceeded");throw e.name="Svelte error",e}}()}catch(e){In(e,"stack",{value:""}),Gi(e,ir)}}let wr=null;function xr(e){var t=e.length;if(0!==t){for(var n=0;n<t;){var i,r=e[n++];if(!(r.f&(Gn|Vn))&&Ns(r))if(wr=new Set,Ps(r),null===r.deps&&null===r.first&&null===r.nodes&&(null===r.teardown&&null===r.ac?rs(r):r.fn=null),(null===(i=wr)||void 0===i?void 0:i.size)>0){uo.clear();for(const e of wr){if(e.f&(Gn|Vn))continue;const t=[e];let n=e.parent;for(;null!==n;)wr.has(n)&&(wr.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){const n=t[e];n.f&(Gn|Vn)||Ps(n)}}wr.clear()}}wr=null}}function _r(e,t,n,i){if(!n.has(e)&&(n.add(e),null!==e.reactions))for(const r of e.reactions){const e=r.f;e&On?_r(r,t,n,i):e&(ni|Ln)&&!(e&Un)&&Tr(r,t,i)&&(Xi(r,Un),Ir(r))}}function Tr(e,t,n){const i=n.get(e);if(void 0!==i)return i;if(null!==e.deps)for(const i of e.deps){if(t.includes(i))return!0;if(i.f&On&&Tr(i,t,n))return n.set(i,!0),!0}return n.set(e,!1),!1}function Ir(e){for(var t=ir=e;null!==t.parent;){var n=(t=t.parent).f;if(rr&&t===gs&&n&Ln&&!(n&Yn))return;if(n&(zn|Bn)){if(!(n&jn))return;t.f^=jn}}nr.push(t)}var Er=Kn|Qn|Wn;var Sr=new WeakMap,Ar=new WeakMap,Nr=new WeakMap,Mr=new WeakMap,Fr=new WeakMap,Cr=new WeakMap,Or=new WeakMap,Pr=new WeakMap,Rr=new WeakMap,Dr=new WeakMap,Lr=new WeakMap,Br=new WeakMap,zr=new WeakMap,Wr=new WeakMap,$r=new WeakMap,jr=new WeakMap,Ur=new WeakMap,qr=new WeakSet;class Vr{constructor(e,t,n){O(this,qr),P(this,"parent",void 0),P(this,"is_pending",!1),F(this,Sr,void 0),F(this,Ar,gi?vi:null),F(this,Nr,void 0),F(this,Mr,void 0),F(this,Fr,void 0),F(this,Cr,null),F(this,Or,null),F(this,Pr,null),F(this,Rr,null),F(this,Dr,null),F(this,Lr,0),F(this,Br,0),F(this,zr,!1),F(this,Wr,new Set),F(this,$r,new Set),F(this,jr,null),F(this,Ur,function(e){let t,n=0,i=po(0);return Si(i,"createSubscriber version"),()=>{Vo()&&(Ds(i),Yo((()=>(0===n&&(t=zs((()=>e((()=>ko(i)))))),n+=1,()=>{ji((()=>{var e;n-=1,0===n&&(null===(e=t)||void 0===e||e(),t=void 0,ko(i))}))}))))}}((()=>(C(jr,this,po(M(Lr,this))),Si(M(jr,this),"$effect.pending()"),()=>{C(jr,this,null)})))),C(Sr,this,e),C(Nr,this,t),C(Mr,this,n),this.parent=gs.b,this.is_pending=!!M(Nr,this).pending,C(Fr,this,Jo((()=>{if(gs.b=this,gi){const e=M(Ar,this);ki();e.nodeType===ui&&e.data===pn?A(qr,this,Hr).call(this):(A(qr,this,Gr).call(this),0===M(Br,this)&&(this.is_pending=!1))}else{var e=A(qr,this,Kr).call(this);try{C(Cr,this,es((()=>n(e))))}catch(e){this.error(e)}M(Br,this)>0?A(qr,this,Yr).call(this):this.is_pending=!1}return()=>{var e;null===(e=M(Dr,this))||void 0===e||e.remove()}}),Er)),gi&&C(Sr,this,vi)}defer_effect(e){Ji(e,M(Wr,this),M($r,this))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!M(Nr,this).pending}update_pending_count(e){A(qr,this,Qr).call(this,e),C(Lr,this,M(Lr,this)+e),M(jr,this)&&yo(M(jr,this),M(Lr,this))}get_effect_pending(){return M(Ur,this).call(this),Ds(M(jr,this))}error(e){var t=M(Nr,this).onerror;let n=M(Nr,this).failed;if(M(zr,this)||!t&&!n)throw e;M(Cr,this)&&(is(M(Cr,this)),C(Cr,this,null)),M(Or,this)&&(is(M(Or,this)),C(Or,this,null)),M(Pr,this)&&(is(M(Pr,this)),C(Pr,this,null)),gi&&(bi(M(Ar,this)),function(e=1){if(gi){for(var t=e,n=vi;t--;)n=Ro(n);vi=n}}(),bi(xi()));var i=!1,r=!1;const o=()=>{i?console.warn("%c[svelte] svelte_boundary_reset_noop\n%cA `<svelte:boundary>` `reset` function only resets the boundary the first time it is called\nhttps://svelte.dev/e/svelte_boundary_reset_noop",hi,fi):(i=!0,r&&function(){{const e=new Error("svelte_boundary_reset_onerror\nA `<svelte:boundary>` `reset` function cannot be called while an error is still being handled\nhttps://svelte.dev/e/svelte_boundary_reset_onerror");throw e.name="Svelte error",e}}(),pr.ensure(),C(Lr,this,0),null!==M(Pr,this)&&os(M(Pr,this),(()=>{C(Pr,this,null)})),this.is_pending=this.has_pending_snippet(),C(Cr,this,A(qr,this,Xr).call(this,(()=>(C(zr,this,!1),es((()=>M(Mr,this).call(this,M(Sr,this)))))))),M(Br,this)>0?A(qr,this,Yr).call(this):this.is_pending=!1)};var s=ps;try{vs(null),r=!0,null==t||t(e,o),r=!1}catch(e){Gi(e,M(Fr,this)&&M(Fr,this).parent)}finally{vs(s)}n&&ji((()=>{C(Pr,this,A(qr,this,Xr).call(this,(()=>{pr.ensure(),C(zr,this,!0);try{return es((()=>{n(M(Sr,this),(()=>e),(()=>o))}))}catch(e){return Gi(e,M(Fr,this).parent),null}finally{C(zr,this,!1)}})))}))}}function Gr(){try{C(Cr,this,es((()=>M(Mr,this).call(this,M(Sr,this)))))}catch(e){this.error(e)}}function Hr(){const e=M(Nr,this).pending;e&&(C(Or,this,es((()=>e(M(Sr,this))))),pr.enqueue((()=>{var e=A(qr,this,Kr).call(this);C(Cr,this,A(qr,this,Xr).call(this,(()=>(pr.ensure(),es((()=>M(Mr,this).call(this,e))))))),M(Br,this)>0?A(qr,this,Yr).call(this):(os(M(Or,this),(()=>{C(Or,this,null)})),this.is_pending=!1)})))}function Kr(){var e=M(Sr,this);return this.is_pending&&(C(Dr,this,Oo()),M(Sr,this).before(M(Dr,this)),e=M(Dr,this)),e}function Xr(e){var t=gs,n=ps,i=Mi;ys(M(Fr,this)),vs(M(Fr,this)),Fi(M(Fr,this).ctx);try{return e()}catch(e){return Vi(e),null}finally{ys(t),vs(n),Fi(i)}}function Yr(){const e=M(Nr,this).pending;null!==M(Cr,this)&&(C(Rr,this,document.createDocumentFragment()),M(Rr,this).append(M(Dr,this)),cs(M(Cr,this),M(Rr,this))),null===M(Or,this)&&C(Or,this,es((()=>e(M(Sr,this)))))}function Qr(e){var t;if(this.has_pending_snippet()){if(C(Br,this,M(Br,this)+e),0===M(Br,this)){this.is_pending=!1;for(const e of M(Wr,this))Xi(e,Un),Ir(e);for(const e of M($r,this))Xi(e,qn),Ir(e);M(Wr,this).clear(),M($r,this).clear(),M(Or,this)&&os(M(Or,this),(()=>{C(Or,this,null)})),M(Rr,this)&&(M(Sr,this).before(M(Rr,this)),C(Rr,this,null))}}else this.parent&&A(qr,t=this.parent,Qr).call(t,e)}function Jr(e,t,n,i){const r=to;if(0!==n.length||0!==e.length){var o,s,a,l,c,u=er,d=gs,h=(o=gs,s=ps,a=Mi,l=er,c=Ci,function(e=!0){ys(o),vs(s),Fi(a),e&&(null==l||l.activate()),Oi(c)});e.length>0?Promise.all(e).then((()=>{h();try{return f()}finally{null==u||u.deactivate(),Zr()}})):f()}else i(t.map(r));function f(){Promise.all(n.map((e=>no(e)))).then((e=>{h();try{i([...t.map(r),...e])}catch(e){d.f&Gn||Gi(e,d)}null==u||u.deactivate(),Zr()})).catch((e=>{Gi(e,d)}))}}function Zr(){ys(null),vs(null),Fi(null),Oi(null)}const eo=new Set;function to(e){var t=On|Un,n=null!==ps&&ps.f&On?ps:null;null!==gs&&(gs.f|=Qn);return{ctx:Mi,deps:null,effects:null,equals:Ti,f:t,fn:e,reactions:null,rv:0,v:gn,wv:0,parent:null!=n?n:gs,ac:null}}function no(e,t,n){let i=gs;null===i&&function(){{const e=new Error("async_derived_orphan\nCannot create a `$derived(...)` with an `await` expression outside of an effect tree\nhttps://svelte.dev/e/async_derived_orphan");throw e.name="Svelte error",e}}();var r=i.b,o=void 0,s=po(gn);s.label=t;var a=!ps,l=new Map;return function(e){qo(ni|Qn,e,!0)}((()=>{var t=Cn();o=t.promise;try{Promise.resolve(e()).then(t.resolve,t.reject).then((()=>{n===er&&n.committed&&n.deactivate(),Zr()}))}catch(e){t.reject(e),Zr()}var n=er;if(a){var i,c=r.is_rendered();r.update_pending_count(1),n.increment(c),null===(i=l.get(n))||void 0===i||i.reject(li),l.delete(n),l.set(n,t)}const u=(e,t=void 0)=>{if(n.activate(),t)t!==li&&(s.f|=ii,yo(s,t));else{s.f&ii&&(s.f^=ii),yo(s,e);for(const[e,t]of l){if(l.delete(e),e===n)break;t.reject(li)}}a&&(r.update_pending_count(-1),n.decrement(c))};t.promise.then(u,(e=>u(null,e||"unknown")))})),Go((()=>{for(const e of l.values())e.reject(li)})),s.f|=ni,new Promise((e=>{!function t(n){function i(){n===o?e(s):t(o)}n.then(i,i)}(o)}))}function io(e){const t=to(e);return ks(t),t}function ro(e){const t=to(e);return t.equals=Ii,t}function oo(e){var t=e.effects;if(null!==t){e.effects=null;for(var n=0;n<t.length;n+=1)is(t[n])}}let so=[];function ao(e){var t,n=gs;ys(function(e){for(var t=e.parent;null!==t;){if(!(t.f&On))return t.f&Gn?null:t;t=t.parent}return null}(e));{let i=co;ho(new Set);try{so.includes(e)&&function(){{const e=new Error("derived_references_self\nA derived value cannot reference itself recursively\nhttps://svelte.dev/e/derived_references_self");throw e.name="Svelte error",e}}(),so.push(e),e.f&=~ei,oo(e),t=Fs(e)}finally{ys(n),ho(i),so.pop()}}return t}function lo(e){var t,n,i=ao(e);if(!e.equals(i)&&(e.wv=As(),(null===(t=er)||void 0===t||!t.is_fork||null===e.deps)&&(e.v=i,null===e.deps)))return void Xi(e,jn);hs||(null!==tr?(Vo()||null!==(n=er)&&void 0!==n&&n.is_fork)&&tr.set(e,i):Yi(e))}let co=new Set;const uo=new Map;function ho(e){co=e}let fo=!1;function po(e,t){return{f:0,v:e,reactions:null,equals:Ti,rv:0,wv:0}}function mo(e,t){const n=po(e);return ks(n),n}function vo(e,t=!1,n=!0){const i=po(e);return t||(i.equals=Ii),i}function go(e,t,n=!1){var i;null!==ps&&(!ms||ps.f&Xn)&&ps.f&(On|Ln|ni|Xn)&&(null===(i=bs)||void 0===i||!i.includes(e))&&function(){{const e=new Error("state_unsafe_mutation\nUpdating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw e.name="Svelte error",e}}();let r=n?_o(t):t;return Ai(r,e.label),yo(e,r)}function yo(e,t){if(!e.equals(t)){var n=e.v;hs?uo.set(e,t):uo.set(e,n),e.v=t;var i=pr.ensure();if(i.capture(e,n),null!==gs){var r,o,s;null!==(r=e.updated)&&void 0!==r||(e.updated=new Map);const t=(null!==(o=null===(s=e.updated.get(""))||void 0===s?void 0:s.count)&&void 0!==o?o:0)+1;if(e.updated.set("",{error:null,count:t}),t>5){const t=Ni("updated at");if(null!==t){let n=e.updated.get(t.stack);n||(n={error:t,count:0},e.updated.set(t.stack,n)),n.count++}}}if(null!==gs&&(e.set_during_effect=!0),e.f&On){const t=e;e.f&Un&&ao(t),Yi(t)}e.wv=As(),wo(e,Un),null!==gs&&gs.f&jn&&!(gs.f&(Bn|zn))&&(null===_s?function(e){_s=e}([e]):_s.push(e)),!i.is_fork&&co.size>0&&!fo&&bo()}return t}function bo(){fo=!1;var e=us;ds(!0);const t=Array.from(co);try{for(const e of t)e.f&jn&&Xi(e,qn),Ns(e)&&Ps(e)}finally{ds(e)}co.clear()}function ko(e){go(e,e.v+1)}function wo(e,t){var n=e.reactions;if(null!==n)for(var i=n.length,r=0;r<i;r++){var o=n[r],s=o.f;if(s&Xn)co.add(o);else{var a=!(s&Un);if(a&&Xi(o,t),s&On){var l,c=o;null===(l=tr)||void 0===l||l.delete(c),s&ei||(s&$n&&(o.f|=ei),wo(c,qn))}else a&&(s&Ln&&null!==wr&&wr.add(o),Ir(o))}}}const xo=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function _o(e){if("object"!=typeof e||null===e||ri in e)return e;const t=Mn(e);if(t!==An&&t!==Nn)return e;var n=new Map,i=xn(e),r=mo(0),o=Es,s=e=>{if(Es===o)return e();var t=ps,n=Es;vs(null),Ss(o);var i=e();return vs(t),Ss(n),i};i&&(n.set("length",mo(e.length)),e=new Proxy(e,{get(e,t,n){var i=Reflect.get(e,t,n);return Eo.has(t)?function(...e){fo=!0;var t=i.apply(this,e);return bo(),t}:i}}));var a="";let l=!1;function c(e){if(!l){l=!0,Si(r,`${a=e} version`);for(const[e,t]of n)Si(t,To(a,e));l=!1}}return new Proxy(e,{defineProperty(e,t,i){"value"in i&&!1!==i.configurable&&!1!==i.enumerable&&!1!==i.writable||function(){{const e=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw e.name="Svelte error",e}}();var r=n.get(t);return void 0===r?r=s((()=>{var e=mo(i.value);return n.set(t,e),"string"==typeof t&&Si(e,To(a,t)),e})):go(r,i.value,!0),!0},deleteProperty(e,t){var i=n.get(t);if(void 0===i){if(t in e){const e=s((()=>mo(gn)));n.set(t,e),ko(r),Si(e,To(a,t))}}else go(i,gn),ko(r);return!0},get(t,i,r){var o;if(i===ri)return e;if(i===ai)return c;var l=n.get(i),u=i in t;if(void 0===l&&(!u||null!==(o=En(t,i))&&void 0!==o&&o.writable)&&(l=s((()=>{var e=mo(_o(u?t[i]:gn));return Si(e,To(a,i)),e})),n.set(i,l)),void 0!==l){var d=Ds(l);return d===gn?void 0:d}return Reflect.get(t,i,r)},getOwnPropertyDescriptor(e,t){var i=Reflect.getOwnPropertyDescriptor(e,t);if(i&&"value"in i){var r=n.get(t);r&&(i.value=Ds(r))}else if(void 0===i){var o=n.get(t),s=null==o?void 0:o.v;if(void 0!==o&&s!==gn)return{enumerable:!0,configurable:!0,value:s,writable:!0}}return i},has(e,t){var i;if(t===ri)return!0;var r=n.get(t),o=void 0!==r&&r.v!==gn||Reflect.has(e,t);if((void 0!==r||null!==gs&&(!o||null!==(i=En(e,t))&&void 0!==i&&i.writable))&&(void 0===r&&(r=s((()=>{var n=mo(o?_o(e[t]):gn);return Si(n,To(a,t)),n})),n.set(t,r)),Ds(r)===gn))return!1;return o},set(e,t,o,l){var c,u=n.get(t),d=t in e;if(i&&"length"===t)for(var h=o;h<u.v;h+=1){var f=n.get(h+"");void 0!==f?go(f,gn):h in e&&(f=s((()=>mo(gn))),n.set(h+"",f),Si(f,To(a,h)))}void 0===u?(!d||null!==(c=En(e,t))&&void 0!==c&&c.writable)&&(Si(u=s((()=>mo(void 0))),To(a,t)),go(u,_o(o)),n.set(t,u)):(d=u.v!==gn,go(u,s((()=>_o(o)))));var p=Reflect.getOwnPropertyDescriptor(e,t);if(null!=p&&p.set&&p.set.call(l,o),!d){if(i&&"string"==typeof t){var m=n.get("length"),v=Number(t);Number.isInteger(v)&&v>=m.v&&go(m,v+1)}ko(r)}return!0},ownKeys(e){Ds(r);var t=Reflect.ownKeys(e).filter((e=>{var t=n.get(e);return void 0===t||t.v!==gn}));for(var[i,o]of n)o.v===gn||i in e||t.push(i);return t},setPrototypeOf(){!function(){{const e=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw e.name="Svelte error",e}}()}})}function To(e,t){var n;return"symbol"==typeof t?`${e}[Symbol(${null!==(n=t.description)&&void 0!==n?n:""})]`:xo.test(t)?`${e}.${t}`:/^\d+$/.test(t)?`${e}[${t}]`:`${e}['${t}']`}function Io(e){try{if(null!==e&&"object"==typeof e&&ri in e)return e[ri]}catch{}return e}const Eo=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function So(e,t,n=!0){try{e===t!=(Io(e)===Io(t))&&mi(n?"===":"!==")}catch{}return e===t===n}var Ao,No,Mo,Fo;function Co(){if(void 0===Ao){Ao=window,No=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;Mo=En(t,"firstChild").get,Fo=En(t,"nextSibling").get,Fn(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),Fn(n)&&(n.__t=void 0),e.__svelte_meta=null,function(){const e=Array.prototype,t=Array.__svelte_cleanup;t&&t();const{indexOf:n,lastIndexOf:i,includes:r}=e;e.indexOf=function(e,t){const i=n.call(this,e,t);if(-1===i)for(let n=null!=t?t:0;n<this.length;n+=1)if(Io(this[n])===e){mi("array.indexOf(...)");break}return i},e.lastIndexOf=function(e,t){const n=i.call(this,e,null!=t?t:this.length-1);if(-1===n)for(let n=0;n<=(null!=t?t:this.length-1);n+=1)if(Io(this[n])===e){mi("array.lastIndexOf(...)");break}return n},e.includes=function(e,t){const n=r.call(this,e,t);if(!n)for(let t=0;t<this.length;t+=1)if(Io(this[t])===e){mi("array.includes(...)");break}return n},Array.__svelte_cleanup=()=>{e.indexOf=n,e.lastIndexOf=i,e.includes=r}}()}}function Oo(e=""){return document.createTextNode(e)}function Po(e){return Mo.call(e)}function Ro(e){return Fo.call(e)}function Do(e,t){if(!gi)return Po(e);var n=Po(vi);if(null===n)n=vi.appendChild(Oo());else if(t&&n.nodeType!==ci){var i,r=Oo();return null===(i=n)||void 0===i||i.before(r),bi(r),r}return bi(n),n}function Lo(e,t=!1){var n;if(!gi){var i=Po(e);return i instanceof Comment&&""===i.data?Ro(i):i}if(t&&(null===(n=vi)||void 0===n?void 0:n.nodeType)!==ci){var r,o=Oo();return null===(r=vi)||void 0===r||r.before(o),bi(o),o}return vi}function Bo(e,t=1,n=!1){var i;let r=gi?vi:e;for(var o;t--;)o=r,r=Ro(r);if(!gi)return r;if(n&&(null===(i=r)||void 0===i?void 0:i.nodeType)!==ci){var s,a=Oo();if(null===r)null===(s=o)||void 0===s||s.after(a);else r.before(a);return bi(a),a}return bi(r),r}function zo(e){e.textContent=""}function Wo(e,t){if(t){const t=document.body;e.autofocus=!0,ji((()=>{document.activeElement===t&&e.focus()}))}}let $o=!1;function jo(e){var t=ps,n=gs;vs(null),ys(null);try{return e()}finally{vs(t),ys(n)}}function Uo(e){null===gs&&(null===ps&&function(e){{const t=new Error(`effect_orphan\n\`${e}\` can only be used inside an effect (e.g. during component initialisation)\nhttps://svelte.dev/e/effect_orphan`);throw t.name="Svelte error",t}}(e),function(){{const e=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw e.name="Svelte error",e}}()),hs&&function(e){{const t=new Error(`effect_in_teardown\n\`${e}\` cannot be used inside an effect cleanup function\nhttps://svelte.dev/e/effect_in_teardown`);throw t.name="Svelte error",t}}(e)}function qo(e,t,n){for(var i=gs;null!==i&&i.f&Xn;)i=i.parent;null!==i&&i.f&Vn&&(e|=Vn);var r={ctx:Mi,deps:null,nodes:null,f:e|Un|$n,first:null,fn:t,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,wv:0,ac:null};if(r.component_function=Pi,n)try{Ps(r),r.f|=Hn}catch(e){throw is(r),e}else null!==t&&Ir(r);var o=r;if(!n||null!==o.deps||null!==o.teardown||null!==o.nodes||o.first!==o.last||o.f&Qn||(o=o.first,e&Ln&&e&Kn&&null!==o&&(o.f|=Kn)),null!==o&&(o.parent=i,null!==i&&function(e,t){var n=t.last;null===n?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}(o,i),null!==ps&&ps.f&On&&!(e&zn))){var s,a=ps;(null!==(s=a.effects)&&void 0!==s?s:a.effects=[]).push(o)}return r}function Vo(){return null!==ps&&!ms}function Go(e){const t=qo(Rn,null,!1);return Xi(t,jn),t.teardown=e,t}function Ho(e){Uo("$effect"),In(e,"name",{value:"$effect"});var t=gs.f;if(!!(ps||!(t&Bn)||t&Hn))return Ko(e);var n,i=Mi;(null!==(n=i.e)&&void 0!==n?n:i.e=[]).push(e)}function Ko(e){return qo(Pn|Jn,e,!1)}function Xo(e){return qo(Pn,e,!1)}function Yo(e,t=0){return qo(Rn|t,e,!0)}function Qo(e,t=[],n=[],i=[]){Jr(i,t,n,(t=>{qo(Rn,(()=>e(...t.map(Ds))),!0)}))}function Jo(e,t=0){var n=qo(Ln|t,e,!0);return n.dev_stack=Ci,n}function Zo(e,t=0){var n=qo(Dn|t,e,!0);return n.dev_stack=Ci,n}function es(e){return qo(Bn|Qn,e,!0)}function ts(e){var t=e.teardown;if(null!==t){const e=hs,n=ps;fs(!0),vs(null);try{t.call(null)}finally{fs(e),vs(n)}}}function ns(e,t=!1){var n=e.first;for(e.first=e.last=null;null!==n;){const e=n.ac;null!==e&&jo((()=>{e.abort(li)}));var i=n.next;n.f&zn?n.parent=null:is(n,t),n=i}}function is(e,t=!0){var n=!1;(t||e.f&Yn)&&null!==e.nodes&&null!==e.nodes.end&&(!function(e,t){for(;null!==e;){var n=e===t?null:Ro(e);e.remove(),e=n}}(e.nodes.start,e.nodes.end),n=!0),ns(e,t&&!n),Os(e,0),Xi(e,Gn);var i=e.nodes&&e.nodes.t;if(null!==i)for(const e of i)e.stop();ts(e);var r=e.parent;null!==r&&null!==r.first&&rs(e),e.component_function=null,e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=null}function rs(e){var t=e.parent,n=e.prev,i=e.next;null!==n&&(n.next=i),null!==i&&(i.prev=n),null!==t&&(t.first===e&&(t.first=i),t.last===e&&(t.last=n))}function os(e,t,n=!0){var i=[];ss(e,i,!0);var r=()=>{n&&is(e),t&&t()},o=i.length;if(o>0){var s=()=>--o||r();for(var a of i)a.out(s)}else r()}function ss(e,t,n){if(!(e.f&Vn)){e.f^=Vn;var i=e.nodes&&e.nodes.t;if(null!==i)for(const e of i)(e.is_global||n)&&t.push(e);for(var r=e.first;null!==r;){var o=r.next;ss(r,t,!!(!!(r.f&Kn)||!!(r.f&Bn)&&!!(e.f&Ln))&&n),r=o}}}function as(e){ls(e,!0)}function ls(e,t){if(e.f&Vn){e.f^=Vn,e.f&jn||(Xi(e,Un),Ir(e));for(var n=e.first;null!==n;){var i=n.next;ls(n,!!(!!(n.f&Kn)||!!(n.f&Bn))&&t),n=i}var r=e.nodes&&e.nodes.t;if(null!==r)for(const e of r)(e.is_global||t)&&e.in()}}function cs(e,t){if(e.nodes)for(var n=e.nodes.start,i=e.nodes.end;null!==n;){var r=n===i?null:Ro(n);t.append(n),n=r}}let us=!1;function ds(e){us=e}let hs=!1;function fs(e){hs=e}let ps=null,ms=!1;function vs(e){ps=e}let gs=null;function ys(e){gs=e}let bs=null;function ks(e){null!==ps&&(null===bs?bs=[e]:bs.push(e))}let ws=null,xs=0,_s=null;let Ts=1,Is=0,Es=Is;function Ss(e){Es=e}function As(){return++Ts}function Ns(e){var t=e.f;if(t&Un)return!0;if(t&On&&(e.f&=~ei),t&qn){for(var n=e.deps,i=n.length,r=0;r<i;r++){var o=n[r];if(Ns(o)&&lo(o),o.wv>e.wv)return!0}t&$n&&null===tr&&Xi(e,jn)}return!1}function Ms(e,t,n=!0){var i,r=e.reactions;if(null!==r&&(null===(i=bs)||void 0===i||!i.includes(e)))for(var o=0;o<r.length;o++){var s=r[o];s.f&On?Ms(s,t,!1):t===s&&(n?Xi(s,Un):s.f&jn&&Xi(s,qn),Ir(s))}}function Fs(e){var t=ws,n=xs,i=_s,r=ps,o=bs,s=Mi,a=ms,l=Es,c=e.f;ws=null,xs=0,_s=null,ps=c&(Bn|zn)?null:e,bs=null,Fi(e.ctx),ms=!1,Es=++Is,null!==e.ac&&(jo((()=>{e.ac.abort(li)})),e.ac=null);try{e.f|=ti;var u=(0,e.fn)(),d=e.deps;if(null!==ws){var h;if(Os(e,xs),null!==d&&xs>0)for(d.length=xs+ws.length,h=0;h<ws.length;h++)d[xs+h]=ws[h];else e.deps=d=ws;if(Vo()&&e.f&$n)for(h=xs;h<d.length;h++){var f,p;(null!==(p=(f=d[h]).reactions)&&void 0!==p?p:f.reactions=[]).push(e)}}else null!==d&&xs<d.length&&(Os(e,xs),d.length=xs);if(!(null===_s||ms||null===d||e.f&(On|qn|Un)))for(h=0;h<_s.length;h++)Ms(_s[h],e);return null!==r&&r!==e&&(Is++,null!==_s&&(null===i?i=_s:i.push(..._s))),e.f&ii&&(e.f^=ii),u}catch(e){return Vi(e)}finally{e.f^=ti,ws=t,xs=n,_s=i,ps=r,bs=o,Fi(s),ms=a,Es=l}}function Cs(e,t){let n=t.reactions;if(null!==n){var i=_n.call(n,e);if(-1!==i){var r=n.length-1;0===r?n=t.reactions=null:(n[i]=n[r],n.pop())}}if(null===n&&t.f&On&&(null===ws||!ws.includes(t))){var o=t;o.f&$n&&(o.f^=$n,o.f&=~ei),Yi(o),oo(o),Os(o,0)}}function Os(e,t){var n=e.deps;if(null!==n)for(var i=t;i<n.length;i++)Cs(e,n[i])}function Ps(e){var t=e.f;if(!(t&Gn)){Xi(e,jn);var n=gs,i=us;gs=e,us=!0;var r,o=Pi;Ri(e.component_function);var s=Ci;Oi(null!==(r=e.dev_stack)&&void 0!==r?r:Ci);try{t&(Ln|Dn)?function(e){for(var t=e.first;null!==t;){var n=t.next;t.f&Bn||is(t),t=n}}(e):ns(e),ts(e);var a=Fs(e);e.teardown="function"==typeof a?a:null,e.wv=Ts,wn&&Ei&&e.f&Un&&e.deps}finally{us=i,gs=n,Ri(o),Oi(s)}}}async function Rs(){await Promise.resolve(),function(){var e=or;or=!0;try{for(;;){var t;if(Ui(),0===nr.length&&(null===(t=er)||void 0===t||t.flush(),0===nr.length))return void(ir=null);br()}}finally{or=e}}()}function Ds(e){var t,n,i=!!(e.f&On);if(null!==ps&&!ms&&!(null!==gs&&!!(gs.f&Gn)||null!==(n=bs)&&void 0!==n&&n.includes(e))){var r=ps.deps;if(ps.f&ti)e.rv<Is&&(e.rv=Is,null===ws&&null!==r&&r[xs]===e?xs++:null===ws?ws=[e]:ws.includes(e)||ws.push(e));else{var o,s;(null!==(s=(o=ps).deps)&&void 0!==s?s:o.deps=[]).push(e);var a=e.reactions;null===a?e.reactions=[ps]:a.includes(ps)||a.push(ps)}}if(eo.delete(e),hs&&uo.has(e))return uo.get(e);if(i){var l=e;if(hs){var c=l.v;return(l.f&jn||null===l.reactions)&&!Bs(l)||(c=ao(l)),uo.set(l,c),c}var u=!(l.f&$n)&&!ms&&null!==ps&&(us||!!(ps.f&$n)),d=null===l.deps;Ns(l)&&(u&&(l.f|=$n),lo(l)),u&&!d&&Ls(l)}if(null!==(t=tr)&&void 0!==t&&t.has(e))return tr.get(e);if(e.f&ii)throw e.v;return e.v}function Ls(e){if(null!==e.deps){e.f|=$n;for(const n of e.deps){var t;(null!==(t=n.reactions)&&void 0!==t?t:n.reactions=[]).push(e),n.f&On&&!(n.f&$n)&&Ls(n)}}}function Bs(e){if(e.v===gn)return!0;if(null===e.deps)return!1;for(const t of e.deps){if(uo.has(t))return!0;if(t.f&On&&Bs(t))return!0}return!1}function zs(e){var t=ms;try{return ms=!0,e()}finally{ms=t}}const Ws=new Set,$s=new Set;function js(e,t,n,i={}){function r(e){if(i.capture||Gs.call(t,e),!e.cancelBubble)return jo((()=>null==n?void 0:n.call(this,e)))}return e.startsWith("pointer")||e.startsWith("touch")||"wheel"===e?ji((()=>{t.addEventListener(e,r,i)})):t.addEventListener(e,r,i),r}function Us(e,t,n,i,r){var o={capture:i,passive:r},s=js(e,t,n,o);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Go((()=>{t.removeEventListener(e,s,o)}))}function qs(e){for(var t=0;t<e.length;t++)Ws.add(e[t]);for(var n of $s)n(e)}let Vs=null;function Gs(e){var t,n=this,i=n.ownerDocument,r=e.type,o=(null===(t=e.composedPath)||void 0===t?void 0:t.call(e))||[],s=o[0]||e.target;Vs=e;var a=0,l=Vs===e&&e.__root;if(l){var c=o.indexOf(l);if(-1!==c&&(n===document||n===window))return void(e.__root=n);var u=o.indexOf(n);if(-1===u)return;c<=u&&(a=c)}if((s=o[a]||e.target)!==n){In(e,"currentTarget",{configurable:!0,get:()=>s||i});var d=ps,h=gs;vs(null),ys(null);try{for(var f,p=[];null!==s;){var m=s.assignedSlot||s.parentNode||s.host||null;try{var v=s["__"+r];null==v||s.disabled&&e.target!==s||v.call(s,e)}catch(e){f?p.push(e):f=e}if(e.cancelBubble||m===n||null===m)break;s=m}if(f){for(let e of p)queueMicrotask((()=>{throw e}));throw f}}finally{e.__root=n,delete e.currentTarget,vs(d),ys(h)}}}function Hs(e,t){var n=gs;null===n.nodes&&(n.nodes={start:e,end:t,a:null,t:null})}function Ks(e,t){var n,i=!!(1&t),r=!!(2&t),o=!e.startsWith("<!>");return()=>{if(gi)return Hs(vi,null),vi;var t,s;void 0===n&&(t=o?e:"<!>"+e,(s=document.createElement("template")).innerHTML=t.replaceAll("<!>","\x3c!----\x3e"),n=s.content,i||(n=Po(n)));var a=r||No?document.importNode(n,!0):n.cloneNode(!0);i?Hs(Po(a),a.lastChild):Hs(a,a);return a}}function Xs(){if(gi)return Hs(vi,null),vi;var e=document.createDocumentFragment(),t=document.createComment(""),n=Oo();return e.append(t,n),Hs(t,n),e}function Ys(e,t){if(gi){var n=gs;return n.f&Hn&&null!==n.nodes.end||(n.nodes.end=vi),void ki()}null!==e&&e.before(t)}function Qs(e){return e.endsWith("capture")&&"gotpointercapture"!==e&&"lostpointercapture"!==e}const Js=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function Zs(e){return Js.includes(e)}const ea={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function ta(e){var t;return e=e.toLowerCase(),null!==(t=ea[e])&&void 0!==t?t:e}const na=["touchstart","touchmove"];function ia(e,t){var n,i=null==t?"":"object"==typeof t?t+"":t;i!==(null!==(n=e.__t)&&void 0!==n?n:e.__t=e.nodeValue)&&(e.__t=i,e.nodeValue=i+"")}function ra(e,t){return aa(e,t)}function oa(e,t){var n;Co(),t.intro=null!==(n=t.intro)&&void 0!==n&&n;const i=t.target,r=gi,o=vi;try{for(var s=Po(i);s&&(s.nodeType!==ui||s.data!==fn);)s=Ro(s);if(!s)throw vn;yi(!0),bi(s);const n=aa(e,{...t,anchor:s});return yi(!1),n}catch(n){if(n instanceof Error&&n.message.split("\n").some((e=>e.startsWith("https://svelte.dev/e/"))))throw n;return n!==vn&&console.warn("Failed to hydrate: ",n),!1===t.recover&&function(){{const e=new Error("hydration_failed\nFailed to hydrate the application\nhttps://svelte.dev/e/hydration_failed");throw e.name="Svelte error",e}}(),Co(),zo(i),yi(!1),ra(e,t)}finally{yi(r),bi(o)}}const sa=new Map;function aa(e,{target:t,anchor:n,props:i={},events:r,context:o,intro:s=!0}){Co();var a=new Set,l=e=>{for(var n=0;n<e.length;n++){var i=e[n];if(!a.has(i)){a.add(i);var r=(s=i,na.includes(s));t.addEventListener(i,Gs,{passive:r});var o=sa.get(i);void 0===o?(document.addEventListener(i,Gs,{passive:r}),sa.set(i,1)):sa.set(i,o+1)}}var s};l(Tn(Ws)),$s.add(l);var c=void 0,u=function(e){pr.ensure();const t=qo(zn|Qn,e,!0);return(e={})=>new Promise((n=>{e.outro?os(t,(()=>{is(t),n(void 0)})):(is(t),n(void 0))}))}((()=>{var s=null!=n?n:t.appendChild(Oo());return function(e,t,n){new Vr(e,t,n)}(s,{pending:()=>{}},(t=>{o&&(Li({}),Mi.c=o);if(r&&(i.$$events=r),gi&&Hs(t,null),c=e(t,i)||{},gi&&(gs.nodes.end=vi,null===vi||vi.nodeType!==ui||vi.data!==mn))throw pi(),vn;o&&Bi()})),()=>{for(var e of a){t.removeEventListener(e,Gs);var i=sa.get(e);0==--i?(document.removeEventListener(e,Gs),sa.delete(e)):sa.set(e,i)}var r;($s.delete(l),s!==n)&&(null===(r=s.parentNode)||void 0===r||r.removeChild(s))}}));return la.set(c,u),c}let la=new WeakMap;function ca(e,t){const n=la.get(e);return n?(la.delete(e),n(t)):(ri in e?console.warn("%c[svelte] state_proxy_unmount\n%cTried to unmount a state proxy, rather than a component\nhttps://svelte.dev/e/state_proxy_unmount",hi,fi):console.warn("%c[svelte] lifecycle_double_unmount\n%cTried to unmount a component that was not mounted\nhttps://svelte.dev/e/lifecycle_double_unmount",hi,fi),Promise.resolve())}class ua{anchor;#e=new Map;#t=new Map;#n=new Map;#i=new Set;#r=!0;constructor(e,t=!0){this.anchor=e,this.#r=t}#o=()=>{var e=er;if(this.#e.has(e)){var t=this.#e.get(e),n=this.#t.get(t);if(n)as(n),this.#i.delete(t);else{var i=this.#n.get(t);i&&(this.#t.set(t,i.effect),this.#n.delete(t),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),n=i.effect)}for(const[t,n]of this.#e){if(this.#e.delete(t),t===e)break;const i=this.#n.get(n);i&&(is(i.effect),this.#n.delete(n))}for(const[e,i]of this.#t){if(e===t||this.#i.has(e))continue;const r=()=>{if(Array.from(this.#e.values()).includes(e)){var t=document.createDocumentFragment();cs(i,t),t.append(Oo()),this.#n.set(e,{effect:i,fragment:t})}else is(i);this.#i.delete(e),this.#t.delete(e)};this.#r||!n?(this.#i.add(e),os(i,r,!1)):r()}}};#s=e=>{this.#e.delete(e);const t=Array.from(this.#e.values());for(const[e,n]of this.#n)t.includes(e)||(is(n.effect),this.#n.delete(e))};ensure(e,t){var n=er;!t||this.#t.has(e)||this.#n.has(e)||this.#t.set(e,es((()=>t(this.anchor)))),this.#e.set(n,e),gi&&(this.anchor=vi),this.#o()}}{let e=function(e){if(!(e in globalThis)){let t;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(void 0!==t)return t;!function(e){{const t=new Error(`rune_outside_svelte\nThe \`${e}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files\nhttps://svelte.dev/e/rune_outside_svelte`);throw t.name="Svelte error",t}}(e)},set:e=>{t=e}})}};e("$state"),e("$effect"),e("$derived"),e("$inspect"),e("$props"),e("$bindable")}var da,ha=new Map;function fa(e,t,n=!1){gi&&ki();var i=new ua(e);function r(t,n){if(gi){if(t===(_i(e)===pn)){var r=xi();return bi(r),i.anchor=r,yi(!1),i.ensure(t,n),void yi(!0)}}i.ensure(t,n)}Jo((()=>{var e=!1;t(((t,n=!0)=>{e=!0,r(n,t)})),e||r(!1,null)}),n?Kn:0)}function pa(e,t){return t}function ma(e,t=!0){for(var n=0;n<e.length;n++)is(e[n],t)}function va(e,t,n,i,r,o=null){var s=e,a=new Map;if(!!(t&sn)){var l=e;s=gi?bi(Po(l)):l.appendChild(Oo())}gi&&ki();var c,u=null,d=ro((()=>{var e=n();return xn(e)?e:null==e?[]:Tn(e)})),h=!0;function f(){m.fallback=u,function(e,t,n,i,r){var o,s,a,l,c,u=!!(i&an),d=t.length,h=e.items,f=e.effect.first,p=null,m=[],v=[];if(u)for(c=0;c<d;c+=1){var g,y;if(a=r(t[c],c),!((l=h.get(a).e).f&Zn))null===(g=l.nodes)||void 0===g||null===(g=g.a)||void 0===g||g.measure(),(null!==(y=s)&&void 0!==y?y:s=new Set).add(l)}for(c=0;c<d;c+=1){if(a=r(t[c],c),l=h.get(a).e,null!==e.outrogroups)for(const t of e.outrogroups)t.pending.delete(l),t.done.delete(l);if(l.f&Zn){if(l.f^=Zn,l!==f){var b=p?p.next:f;l===e.effect.last&&(e.effect.last=l.prev),l.prev&&(l.prev.next=l.next),l.next&&(l.next.prev=l.prev),ba(e,p,l),ba(e,l,b),ya(l,b,n),m=[],v=[],f=(p=l).next;continue}ya(l,null,n)}var k,w;if(l.f&Vn)if(as(l),u)null===(k=l.nodes)||void 0===k||null===(k=k.a)||void 0===k||k.unfix(),(null!==(w=s)&&void 0!==w?w:s=new Set).delete(l);if(l!==f){if(void 0!==o&&o.has(l)){if(m.length<v.length){var x,_=v[0];p=_.prev;var T=m[0],I=m[m.length-1];for(x=0;x<m.length;x+=1)ya(m[x],_,n);for(x=0;x<v.length;x+=1)o.delete(v[x]);ba(e,T.prev,I.next),ba(e,p,T),ba(e,I,_),f=_,p=I,c-=1,m=[],v=[]}else o.delete(l),ya(l,f,n),ba(e,l.prev,l.next),ba(e,l,null===p?e.effect.first:p.next),ba(e,p,l),p=l;continue}for(m=[],v=[];null!==f&&f!==l;){var E;(null!==(E=o)&&void 0!==E?E:o=new Set).add(f),v.push(f),f=f.next}if(null===f)continue}l.f&Zn||m.push(l),p=l,f=l.next}if(null!==e.outrogroups){for(const t of e.outrogroups){var S;if(0===t.pending.size)ma(Tn(t.done)),null===(S=e.outrogroups)||void 0===S||S.delete(t)}0===e.outrogroups.size&&(e.outrogroups=null)}if(null!==f||void 0!==o){var A=[];if(void 0!==o)for(l of o)l.f&Vn||A.push(l);for(;null!==f;)f.f&Vn||f===e.fallback||A.push(f),f=f.next;var N=A.length;if(N>0){var M=i&sn&&0===d?n:null;if(u){for(c=0;c<N;c+=1){var F;null===(F=A[c].nodes)||void 0===F||null===(F=F.a)||void 0===F||F.measure()}for(c=0;c<N;c+=1){var C;null===(C=A[c].nodes)||void 0===C||null===(C=C.a)||void 0===C||C.fix()}}!function(e,t,n){for(var i,r=t.length,o=t.length,s=0;s<r;s++){let n=t[s];os(n,(()=>{if(i){if(i.pending.delete(n),i.done.add(n),0===i.pending.size){var t=e.outrogroups;ma(Tn(i.done)),t.delete(i),0===t.size&&(e.outrogroups=null)}}else o-=1}),!1)}if(0===o){var a=null!==n;if(a){var l=n,c=l.parentNode;zo(c),c.append(l),e.items.clear()}ma(t,!a)}else{var u;i={pending:new Set(t),done:new Set},(null!==(u=e.outrogroups)&&void 0!==u?u:e.outrogroups=new Set).add(i)}}(e,A,M)}}u&&ji((()=>{if(void 0!==s)for(l of s){var e;null===(e=l.nodes)||void 0===e||null===(e=e.a)||void 0===e||e.apply()}}))}(m,c,s,t,i),null!==u&&(0===c.length?u.f&Zn?(u.f^=Zn,ya(u,null,s)):as(u):os(u,(()=>{u=null})))}var p=Jo((()=>{var e=(c=Ds(d)).length;let l=!1;gi&&(_i(s)===pn!==(0===e)&&(bi(s=xi()),yi(!1),l=!0));for(var p=new Set,m=0;m<e;m+=1){gi&&vi.nodeType===ui&&vi.data===mn&&(s=vi,l=!0,yi(!1));var v,g=c[m],y=i(g,m),b=h?null:a.get(y);if(b)b.v&&yo(b.v,g),b.i&&yo(b.i,m);else b=ga(a,h?s:null!==(v=da)&&void 0!==v?v:da=Oo(),g,y,m,r,t,n),h||(b.e.f|=Zn),a.set(y,b);p.add(y)}0===e&&o&&!u&&(h?u=es((()=>o(s))):(u=es((()=>{var e;return o(null!==(e=da)&&void 0!==e?e:da=Oo())}))).f|=Zn),gi&&e>0&&bi(xi()),h||f(),l&&yi(!0),Ds(d)})),m={effect:p,items:a,outrogroups:null,fallback:u};h=!1,gi&&(s=vi)}function ga(e,t,n,i,r,o,s,a){var l=s&rn?s&ln?po(n):vo(n,!1,!1):null,c=s&on?po(r):null;return l&&(l.trace=()=>{var e;a()[null!==(e=null==c?void 0:c.v)&&void 0!==e?e:r]}),{v:l,i:c,e:es((()=>(o(t,null!=l?l:n,null!=c?c:r,a),()=>{e.delete(i)})))}}function ya(e,t,n){if(e.nodes)for(var i=e.nodes.start,r=e.nodes.end,o=!t||t.f&Zn?n:t.nodes.start;null!==i;){var s=Ro(i);if(o.before(i),i===r)return;i=s}}function ba(e,t,n){null===t?e.effect.first=n:t.next=n,null===n?e.effect.last=t:n.prev=t}function ka(e,t){Xo((()=>{var n,i=e.getRootNode(),r=i.host?i:null!==(n=i.head)&&void 0!==n?n:i.ownerDocument.head;if(!r.querySelector("#"+t.hash)){const e=document.createElement("style");e.id=t.hash,e.textContent=t.code,r.appendChild(e),function(e,t){var n=ha.get(e);n||(n=new Set,ha.set(e,n)),n.add(t)}(t.hash,e)}}))}function wa(e,t){var n,i=void 0;Zo((()=>{i!==(i=t())&&(n&&(is(n),n=null),i&&(n=es((()=>{Xo((()=>i(e)))}))))}))}function xa(e){var t,n,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=xa(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function _a(e){return"object"==typeof e?function(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=xa(e))&&(i&&(i+=" "),i+=t);return i}(e):null!=e?e:""}const Ta=[..." \t\n\r\f \v\ufeff"];function Ia(e,t=!1){var n=t?" !important;":";",i="";for(var r in e){var o=e[r];null!=o&&""!==o&&(i+=" "+r+": "+o+n)}return i}function Ea(e){return"-"!==e[0]||"-"!==e[1]?e.toLowerCase():e}function Sa(e,t,n,i,r,o){var s=e.__className;if(gi||s!==n||void 0===s){var a=function(e,t,n){var i=null==e?"":""+e;if(t&&(i=i?i+" "+t:t),n)for(var r in n)if(n[r])i=i?i+" "+r:r;else if(i.length)for(var o=r.length,s=0;(s=i.indexOf(r,s))>=0;){var a=s+o;0!==s&&!Ta.includes(i[s-1])||a!==i.length&&!Ta.includes(i[a])?s=a:i=(0===s?"":i.substring(0,s))+i.substring(a+1)}return""===i?null:i}(n,i,o);gi&&a===e.getAttribute("class")||(null==a?e.removeAttribute("class"):t?e.className=a:e.setAttribute("class",a)),e.__className=n}else if(o&&r!==o)for(var l in o){var c=!!o[l];null!=r&&c===!!r[l]||e.classList.toggle(l,c)}return o}function Aa(e,t={},n,i){for(var r in n){var o=n[r];t[r]!==o&&(null==n[r]?e.style.removeProperty(r):e.style.setProperty(r,o,i))}}function Na(e,t,n,i){var r=e.__style;if(gi||r!==t){var o=function(e,t){if(t){var n,i,r="";if(Array.isArray(t)?(n=t[0],i=t[1]):n=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var o=!1,s=0,a=!1,l=[];n&&l.push(...Object.keys(n).map(Ea)),i&&l.push(...Object.keys(i).map(Ea));var c=0,u=-1;const t=e.length;for(var d=0;d<t;d++){var h=e[d];if(a?"/"===h&&"*"===e[d-1]&&(a=!1):o?o===h&&(o=!1):"/"===h&&"*"===e[d+1]?a=!0:'"'===h||"'"===h?o=h:"("===h?s++:")"===h&&s--,!a&&!1===o&&0===s)if(":"===h&&-1===u)u=d;else if(";"===h||d===t-1){if(-1!==u){var f=Ea(e.substring(c,u).trim());l.includes(f)||(";"!==h&&d++,r+=" "+e.substring(c,d).trim()+";")}c=d+1,u=-1}}}return n&&(r+=Ia(n)),i&&(r+=Ia(i,!0)),""===(r=r.trim())?null:r}return null==e?null:String(e)}(t,i);gi&&o===e.getAttribute("style")||(null==o?e.removeAttribute("style"):e.style.cssText=o),e.__style=t}else i&&(Array.isArray(i)?(Aa(e,null==n?void 0:n[0],i[0]),Aa(e,null==n?void 0:n[1],i[1],"important")):Aa(e,n,i));return i}function Ma(e,t,n=!1){if(e.multiple){if(null==t)return;if(!xn(t))return void console.warn("%c[svelte] select_multiple_invalid_value\n%cThe `value` property of a `<select multiple>` element should be an array, but it received a non-array value. The selection will be kept as is.\nhttps://svelte.dev/e/select_multiple_invalid_value",hi,fi);for(var i of e.options)i.selected=t.includes(Fa(i))}else{for(i of e.options){var r=Fa(i);if(o=r,s=t,Object.is(Io(o),Io(s)))return void(i.selected=!0)}var o,s;n&&void 0===t||(e.selectedIndex=-1)}}function Fa(e){return"__value"in e?e.__value:e.value}const Ca=Symbol("class"),Oa=Symbol("style"),Pa=Symbol("is custom element"),Ra=Symbol("is html");function Da(e){if(gi){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute("value")){var n=e.value;Ba(e,"value",null),e.value=n}if(e.hasAttribute("checked")){var i=e.checked;Ba(e,"checked",null),e.checked=i}}};e.__on_r=n,ji(n),$o||($o=!0,document.addEventListener("reset",(e=>{Promise.resolve().then((()=>{if(!e.defaultPrevented)for(const n of e.target.elements){var t;null===(t=n.__on_r)||void 0===t||t.call(n)}}))}),{capture:!0}))}}function La(e,t){t?e.hasAttribute("selected")||e.setAttribute("selected",""):e.removeAttribute("selected")}function Ba(e,t,n,i){var r=Wa(e);gi&&(r[t]=e.getAttribute(t),"src"===t||"srcset"===t||"href"===t&&"LINK"===e.nodeName)?i||function(e,t,n){var i;if("srcset"===t&&function(e,t){var n=qa(e.srcset),i=qa(t);return i.length===n.length&&i.every((([e,t],i)=>t===n[i][1]&&(Ua(n[i][0],e)||Ua(e,n[i][0]))))}(e,n))return;if(Ua(null!==(i=e.getAttribute(t))&&void 0!==i?i:"",n))return;!function(e,t,n){console.warn(`%c[svelte] hydration_attribute_changed\n%cThe \`${e}\` attribute on \`${t}\` changed its value between server and client renders. The client value, \`${n}\`, will be ignored in favour of the server value\nhttps://svelte.dev/e/hydration_attribute_changed`,hi,fi)}(t,e.outerHTML.replace(e.innerHTML,e.innerHTML&&"..."),String(n))}(e,t,null!=n?n:""):r[t]!==(r[t]=n)&&("loading"===t&&(e[si]=n),null==n?e.removeAttribute(t):"string"!=typeof n&&ja(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function za(e,t,n=[],i=[],r=[],o,s=!1,a=!1){Jr(r,n,i,(n=>{var i=void 0,r={},l="SELECT"===e.nodeName,c=!1;if(Zo((()=>{var u=t(...n.map(Ds)),d=function(e,t,n,i,r=!1,o=!1){if(gi&&r&&"INPUT"===e.tagName){var s=e;("checkbox"===s.type?"defaultChecked":"defaultValue")in n||Da(s)}var a=Wa(e),l=a[Pa],c=!a[Ra];let u=gi&&l;u&&yi(!1);var d,h=t||{},f="OPTION"===e.tagName;for(var p in t)p in n||(n[p]=null);n.class?n.class=_a(n.class):n.class=null,n[Oa]&&(null!==(d=n.style)&&void 0!==d||(n.style=null));var m=ja(e);for(const r in n){let s=n[r];if(f&&"value"===r&&null==s)e.value=e.__value="",h[r]=s;else if("class"!==r)if("style"!==r){var v=h[r];if(s!==v||void 0===s&&e.hasAttribute(r)){h[r]=s;var g=r[0]+r[1];if("$$"!==g)if("on"===g){const t={},n="$$"+r;let i=r.slice(2);var y=Zs(i);if(Qs(i)&&(i=i.slice(0,-7),t.capture=!0),!y&&v){if(null!=s)continue;e.removeEventListener(i,h[n],t),h[n]=null}if(null!=s)if(y)e[`__${i}`]=s,qs([i]);else{let o=function(e){h[r].call(this,e)};h[n]=js(i,e,o,t)}else y&&(e[`__${i}`]=void 0)}else if("style"===r)Ba(e,r,s);else if("autofocus"===r)Wo(e,Boolean(s));else if(l||"__value"!==r&&("value"!==r||null==s))if("selected"===r&&f)La(e,s);else{var b=r;c||(b=ta(b));var k="defaultValue"===b||"defaultChecked"===b;if(null!=s||l||k)k||m.includes(b)&&(l||"string"!=typeof s)?(e[b]=s,b in a&&(a[b]=gn)):"function"!=typeof s&&Ba(e,b,s,o);else if(a[r]=null,"value"===b||"checked"===b){let n=e;const i=void 0===t;if("value"===b){let e=n.defaultValue;n.removeAttribute(b),n.defaultValue=e,n.value=n.__value=i?e:null}else{let e=n.defaultChecked;n.removeAttribute(b),n.defaultChecked=e,n.checked=!!i&&e}}else e.removeAttribute(r)}else e.value=e.__value=s}}else Na(e,s,null==t?void 0:t[Oa],n[Oa]),h[r]=s,h[Oa]=n[Oa];else Sa(e,"http://www.w3.org/1999/xhtml"===e.namespaceURI,s,i,null==t?void 0:t[Ca],n[Ca]),h[r]=s,h[Ca]=n[Ca]}return u&&yi(!0),h}(e,i,u,o,s,a);c&&l&&"value"in u&&Ma(e,u.value);for(let e of Object.getOwnPropertySymbols(r))u[e]||is(r[e]);for(let t of Object.getOwnPropertySymbols(u)){var h=u[t];t.description!==kn||i&&h===i[t]||(r[t]&&is(r[t]),r[t]=es((()=>wa(e,(()=>h))))),d[t]=h}i=d})),l){var u=e;Xo((()=>{Ma(u,i.value,!0),function(e){var t=new MutationObserver((()=>{Ma(e,e.__value)}));t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Go((()=>{t.disconnect()}))}(u)}))}c=!0}))}function Wa(e){var t;return null!==(t=e.__attributes)&&void 0!==t?t:e.__attributes={[Pa]:e.nodeName.includes("-"),[Ra]:e.namespaceURI===bn}}var $a=new Map;function ja(e){var t,n=e.getAttribute("is")||e.nodeName,i=$a.get(n);if(i)return i;$a.set(n,i=[]);for(var r=e,o=Element.prototype;o!==r;){for(var s in t=Sn(r))t[s].set&&i.push(s);r=Mn(r)}return i}function Ua(e,t){return e===t||new URL(e,document.baseURI).href===new URL(t,document.baseURI).href}function qa(e){return e.split(",").map((e=>e.trim().split(" ").filter(Boolean)))}function Va(e,t){return e===t||(null==e?void 0:e[ri])===t}function Ga(e={},t,n,i){return Xo((()=>{var i,r;return Yo((()=>{i=r,r=[],zs((()=>{e!==n(...r)&&(t(e,...r),i&&Va(n(...i),e)&&t(null,...i))}))})),()=>{ji((()=>{r&&Va(n(...r),e)&&t(null,...r)}))}})),e}let Ha=!1;function Ka(e,t,n,i){var r,o,s=!!(n&dn),a=!!(n&hn),l=i,c=!0,u=()=>(c&&(c=!1,l=a?zs(i):i),l);if(s){var d,h,f=ri in e||oi in e;r=null!==(d=null===(h=En(e,t))||void 0===h?void 0:h.set)&&void 0!==d?d:f&&t in e?n=>e[t]=n:void 0}var p,m=!1;if(s?[o,m]=function(e){var t=Ha;try{return Ha=!1,[e(),Ha]}finally{Ha=t}}((()=>e[t])):o=e[t],void 0===o&&void 0!==i&&(o=u(),r&&(!function(e){{const t=new Error(`props_invalid_value\nCannot do \`bind:${e}={undefined}\` when \`${e}\` has a fallback value\nhttps://svelte.dev/e/props_invalid_value`);throw t.name="Svelte error",t}}(t),r(o))),p=()=>{var n=e[t];return void 0===n?u():(c=!0,n)},!(n&un))return p;if(r){var v=e.$$legacy;return function(e,t){return arguments.length>0?((!t||v||m)&&r(t?p():e),e):p()}}var g=!1,y=(n&cn?to:ro)((()=>(g=!1,p())));y.label=t,s&&Ds(y);var b=gs;return function(e,t){if(arguments.length>0){const n=t?Ds(y):s?_o(e):e;return go(y,n),g=!0,void 0!==l&&(l=n),e}return hs&&g||b.f&Gn?y.v:Ds(y)}}var Xa,Ya,Qa,Ja;"undefined"!=typeof window&&(null!==(Ya=(Xa=null!==(Ja=(Qa=window).__svelte)&&void 0!==Ja?Ja:Qa.__svelte={}).v)&&void 0!==Ya?Ya:Xa.v=new Set).add("5");function Za(e,{include:t,exclude:n}={}){const i=e=>{const i=t=>"string"==typeof t?e===t:t.test(e);return t?t.some(i):!n||!n.some(i)};for(const[t,n]of(e=>{const t=new Set;do{for(const n of Reflect.ownKeys(e))t.add([e,n])}while((e=Reflect.getPrototypeOf(e))&&e!==Object.prototype);return t})(e.constructor.prototype)){if("constructor"===n||!i(n))continue;const r=Reflect.getOwnPropertyDescriptor(t,n);r&&"function"==typeof r.value&&(e[n]=e[n].bind(e))}return e}function el(e,t){e.getNodesAtTime(0)[0].once("nodestart",t)}class tl{constructor({position:e,gallery:t,config:n}){this.config=n,this.position=e,this.gallery=t,this.name=n.name;const{variantId:i,itemIndex:r,moduleIndex:o}=e;this.id=`${n.itemType}_${i}_${r}_${o}`,Za(this)}#a=Si(mo(_o({})),"BaseModule.#state");#l=Si(mo(null),"BaseModule.#cover");#c=Si(mo(!1),"BaseModule.#showCover");#u=Si(mo(null),"BaseModule.#Component");id;player;position;config;timeline;moduleEndListener;hasDuration=!1;coverAssets=[];get state(){return Ds(this.#a)}set state(e){go(this.#a,e,!0)}get cover(){return Ds(this.#l)}set cover(e){go(this.#l,e)}get showCover(){return Ds(this.#c)}set showCover(e){go(this.#c,e,!0)}get Component(){return Ds(this.#u)}set Component(e){go(this.#u,e)}emitModuleEnd(){var e;null===(e=this.moduleEndListener)||void 0===e||e.call(this)}start(e){this.player=e}setPosition(){this.gallery.state.playingModulePosition=this.position}play(){this.gallery.track("moduleview"),el(this.timeline,(()=>{this.setPosition()})),this.player.switchTimeline(this.timeline)}get duration(){return this.hasDuration?this.timeline.placements.reduce(((e,t)=>e+this.player.getNode(t.nodeId).duration),0):0}}function nl(e,t,n){var i,r,o;const s=(null==t||null===(i=t.entity)||void 0===i?void 0:i.entityId)||(null==t?void 0:t.assetId),a=null!==(r=null==t||null===(o=t.entity)||void 0===o?void 0:o.entityRevision)&&void 0!==r?r:null==t?void 0:t.assetRevision;return n.addNode({id:e,manifestRef:{type:"assets-delivery-service",assetId:s,assetRevision:a,availableEncodeProfiles:t.availableEncodeProfiles}})}var il=Ks('<h3 class="text-box-title svelte-wejicf"> </h3>'),rl=Ks('<span class="text-box-title svelte-wejicf"> </span>'),ol=Ks('<span class="text-box-description minimized-description svelte-wejicf"> </span>'),sl=Ks('<span class="read-more-cta svelte-wejicf" aria-hidden="true">Read more</span>'),al=Ks('<button class="expand-description-button svelte-wejicf" aria-expanded="false" aria-controls="expanded-text-content" aria-label="Expand feature description"><!> <!></button>'),ll=Ks('<button aria-expanded="true" aria-label="Collapse feature description" data-elementid="textbox-expand" data-elementtype="textbox" data-elementname="Read less" data-interactiontype="module-ui" class="svelte-wejicf">Read less</button>'),cl=Ks('<section aria-label="Feature description" aria-live="polite"><div class="text-wrapper svelte-wejicf"><div class="expanded-text-content svelte-wejicf"><!> <p class="text-box-description svelte-wejicf"> </p></div> <!></div> <!></section>');const ul={hash:"svelte-wejicf",code:".step-description-container.svelte-wejicf {width:100%;position:absolute;bottom:0;display:flex;justify-content:space-between;gap:8px;box-sizing:border-box;font-size:12px;font-weight:400;font-style:normal;line-height:16px;letter-spacing:0px;overflow:hidden;pointer-events:none;background:linear-gradient(\n rgba(255, 255, 255, 0) 0%,\n rgba(255, 255, 255, 0.9) 27.79%,\n rgba(255, 255, 255, 0.95) 100%\n );&.expanded {flex-direction:column;justify-content:flex-start;}&:not(.expanded) {button:where(.svelte-wejicf) {line-height:16px;}}}.expanded-text-content.svelte-wejicf:not([hidden]) {display:flex;flex-direction:column;gap:8px;}button.svelte-wejicf {background:none;border:none;padding:0;cursor:pointer;line-height:18px;gap:8px;letter-spacing:0%;color:#014FD3;font-size:12px;font-weight:500;flex-shrink:0;text-align:left;font-family:inherit;pointer-events:auto;}h3.svelte-wejicf, p.svelte-wejicf, span.svelte-wejicf {color:#030303;}.text-wrapper.svelte-wejicf {width:100%;}.text-box-title.svelte-wejicf {margin:0;font-weight:500;font-size:12px;}.text-box-description.svelte-wejicf {margin:0;text-align:left;font-weight:400;}.minimized-description.svelte-wejicf {overflow:hidden;line-clamp:1;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;font-weight:400;}.expand-description-button.svelte-wejicf {width:100%;display:flex;justify-content:space-between;gap:6px;flex-wrap:nowrap;.read-more-cta:where(.svelte-wejicf) {color:#014FD3;flex-shrink:0;}}"};function dl(e,t){Li(t,!0),ka(e,ul);let n=Ka(t,"textBox",3,null),i=Ka(t,"isMobile",3,!1),r=mo(!1),o=mo(null),s=mo(!1),a=io((()=>{var e;return(null===(e=n())||void 0===e?void 0:e.title)||""})),l=io((()=>{var e;return(null===(e=n())||void 0===e?void 0:e.description)||""})),c=io((()=>i()?16:18)),u=io((()=>i()?12:16));function d(){Ds(o)&&go(s,Ds(o).scrollWidth>Ds(o).clientWidth||Ds(o).scrollHeight>Ds(o).clientHeight,!0)}Ho((()=>{Ds(o)&&d()}));var h=Xs();Us("resize",Ao,d);var f=Lo(h),p=e=>{var n=cl(),d=Do(n),h=Do(d),f=Do(h),p=e=>{var t=il(),n=Do(t,!0);wi(t),Qo((()=>ia(n,Ds(a)))),Ys(e,t)};fa(f,(e=>{i()&&e(p)}));var m=Bo(f,2),v=Do(m,!0);wi(m),wi(h);var g=Bo(h,2),y=e=>{var n=al(),u=io((()=>t.gallery.interaction((()=>go(r,!0)),{elementid:"textbox-expand",elementtype:"textbox",elementname:"Read more",interactiontype:"module-ui"})));n.__click=function(...e){var t;null===(t=Ds(u))||void 0===t||t.apply(this,e)};var d=Do(n),h=e=>{var t=rl(),n=Do(t,!0);wi(t),Qo((()=>ia(n,Ds(a)))),Ys(e,t)},f=e=>{var t=ol(),n=Do(t,!0);wi(t),Ga(t,(e=>go(o,e)),(()=>Ds(o))),Qo((()=>ia(n,Ds(l)))),Ys(e,t)};fa(d,(e=>{i()&&Ds(a)?e(h):e(f,!1)}));var p=Bo(d,2),m=e=>{Ys(e,sl())};fa(p,(e=>{(i()||!i()&&Ds(s))&&e(m)})),wi(n),Qo((()=>Na(n,`line-height: ${Ds(c)}px;`))),Ys(e,n)};fa(g,(e=>{Ds(r)||e(y)})),wi(d);var b=Bo(d,2),k=e=>{var n=ll(),o=io((()=>t.gallery.interaction((()=>go(r,!1)))));n.__click=function(...e){var t;null===(t=Ds(o))||void 0===t||t.apply(this,e)},Qo((()=>Na(n,`margin-bottom: ${!i()&&Ds(r)?"8px":"0px"};\n line-height: ${Ds(u)}px;`))),Ys(e,n)};fa(b,(e=>{Ds(r)&&e(k)})),wi(n),Qo((()=>{Sa(n,1,"step-description-container "+(Ds(r)?"expanded":""),"svelte-wejicf"),Na(n,`padding: ${i()?"8px 16px":"16px 16px 64px 16px"};`),Na(h,`line-height: ${Ds(c)}px;`),Ba(h,"hidden",!Ds(r)),ia(v,Ds(l))})),Ys(e,n)};fa(f,(e=>{(Ds(a)||Ds(l))&&e(p)})),Ys(e,h),Bi()}function hl(e,t){const n=io((()=>t.state.textBox));dl(e,{get textBox(){return Ds(n)},get isMobile(){return t.isMobile},get gallery(){return t.gallery}})}qs(["click"]);var fl=Ks('<div class="toggle-option-container svelte-16pmvvn"><button data-elementtype="toggle" data-interactiontype="module-ui"> </button></div>'),pl=Ks('<div class="toggle-container svelte-16pmvvn"><div></div></div> <!>',1);const ml={hash:"svelte-16pmvvn",code:".eko-gallery-app {--toggleModule_gap: 8px;--toggleModule_padding: 10px 58px 0 0;--toggleModule_options_padding: 0;--toggleModule_options_height: auto;--toggleModule_options_width: 100%;--toggleModule_options_gap: 8px;--toggleModule_button_backgroundColor: #FFFFFF;--toggleModule_button_padding: 8px 12px;--toggleModule_button_boxShadow: 0px 2px 8px 2px rgba(0, 0, 0, 0.07);--toggleModule_button_text_fontFamily: var(--fontName);--toggleModule_button_text_fontSize: 12px;--toggleModule_button_text_fontWeight: 400;--toggleModule_button_text_fontStyle: normal;--toggleModule_button_text_lineHeight: 16px;--toggleModule_button_text_letterSpacing: -0.2px;--toggleModule_button_text_color: #000;--toggleModule_button_border_radius: 100px;--toggleModule_title_fontFamily: var(--fontName);--toggleModule_title_fontSize: 13px;--toggleModule_title_fontWeight: 400;--toggleModule_title_fontStyle: normal;--toggleModule_title_lineHeight: 120%;--toggleModule_title_letterSpacing: 0;--toggleModule_title_color: #666;--toggleModule_title_textAlignment: center;--toggleModule_note_fontFamily: var(--fontName);--toggleModule_note_fontSize: 12px;--toggleModule_note_fontWeight: 400;--toggleModule_note_fontStyle: normal;--toggleModule_note_lineHeight: 120%;--toggleModule_note_letterSpacing: 0;--toggleModule_note_color: #888;--toggleModule_note_topMargin: 4px;}.toggle-container.svelte-16pmvvn {position:absolute;top:0;padding:var(--toggleModule_padding);width:100%;display:flex;flex-direction:column;align-items:center;gap:var(--toggleModule_gap);pointer-events:auto;box-sizing:border-box;}.toggle-options.svelte-16pmvvn {width:var(--toggleModule_options_width);height:var(--toggleModule_options_height);padding:var(--toggleModule_options_padding);gap:var(--toggleModule_options_gap);display:flex;justify-content:end;margin:0;}.toggle-option-container.svelte-16pmvvn {position:relative;min-width:0;}.toggle-option-button.svelte-16pmvvn {border-radius:var(--toggleModule_button_borderRadius);font-family:var(--toggleModule_button_text_fontFamily);font-size:var(--toggleModule_button_text_fontSize);font-weight:var(--toggleModule_button_text_fontWeight);font-style:var(--toggleModule_button_text_fontStyle);line-height:var(--toggleModule_button_text_lineHeight);letter-spacing:var(--toggleModule_button_text_letterSpacing);color:var(--toggleModule_button_text_color);padding:var(--toggleModule_button_padding);border:#E4E5E8 solid 1px;background:#FBFBFB;display:flex;width:100%;height:100%;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;cursor:pointer;position:relative;transition:all 0.3s ease-in-out;animation-duration:0.5s;animation-timing-function:cubic-bezier(0.36, 0, 0, 1);animation-fill-mode:both;animation-delay:calc(var(--button-index) * 90ms);\n animation-name: svelte-16pmvvn-button-back-appear-anim;transform-origin:bottom center;border-radius:var(--toggleModule_button_border_radius);}.toggle-option-button.selected.svelte-16pmvvn {box-shadow:none;color:#FFFFFF;background:#014FD3;border-color:#014FD3;}.toggle-option-button.svelte-16pmvvn:hover:not(.selected) {background:#F3F4F6;}.toggle-option-button.svelte-16pmvvn:active:not(.selected) {background:#E4E5E8;}.toggle-option-button.svelte-16pmvvn:focus {outline-offset:4px;outline-width:2px;}\n\n@keyframes svelte-16pmvvn-button-back-appear-anim {\n from {\n transform: scale(0);\n }\n to {\n transform: scale(1);\n }\n}\n@keyframes svelte-16pmvvn-optionNoteIn {\n 0% {\n opacity: 0;\n translate: -50% -5px;\n }\n 100% {\n opacity: 1;\n translate: -50% var(--toggleModule_note_topMargin);\n }\n}"};function vl(e,t){Li(t,!0),ka(e,ml);const n=io((()=>t.state.options)),i=io((()=>t.state.currentOptionIndex)),r=io((()=>t.state.onOptionClicked)),o=io((()=>t.state.textBox));var s=pl(),a=Lo(s),l=Do(a);va(l,21,(()=>Ds(n)),pa,((e,n,o)=>{var s=fl();Na(s,`--button-index: ${o};`);var a=Do(s);let l;var c=io((()=>t.gallery.interaction((()=>Ds(r)(o)))));a.__click=function(...e){var t;null===(t=Ds(c))||void 0===t||t.apply(this,e)},Ba(a,"data-elementid",`${o+1}`);var u=Do(a,!0);wi(a),wi(s),Qo((()=>{l=Sa(a,1,"toggle-option-button svelte-16pmvvn",null,l,{selected:Ds(i)===o}),Ba(a,"data-elementname",Ds(n).label),ia(u,Ds(n).label)})),Ys(e,s)})),wi(l),wi(a);var c=Bo(a,2),u=e=>{dl(e,{get textBox(){return Ds(o)},get isMobile(){return t.isMobile},get gallery(){return t.gallery}})};fa(c,(e=>{Ds(o)&&e(u)})),Qo((()=>{var e;return Sa(l,1,`toggle-options selected-${null!==(e=Ds(i))&&void 0!==e?e:""}`,"svelte-16pmvvn")})),Ys(e,s),Bi()}qs(["click"]);var gl=new WeakSet;function yl(e){var t,n;e!==this.state.currentOptionIndex&&(this.state.currentOptionIndex=e,this.state.textBox=this.config.options[e].textBox,this.cover=this.coverAssets[e],this.synced?this.switchTo(e):(this.timeline=null===(t=this.timelines)||void 0===t?void 0:t[e],this.showCover=!0,el(this.timeline,(()=>{this.showCover=!1})),null===(n=this.player)||void 0===n||n.switchTimeline(this.timeline)))}const bl=(e,t,n)=>n>t?t:n<e?e:n;function kl(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}let wl=()=>{},xl=()=>{};function _l(e){let t;return()=>(void 0===t&&(t=e()),t)}"undefined"!=typeof process&&"production"!==(null===(rt=process.env)||void 0===rt?void 0:rt.NODE_ENV)&&(wl=(e,t,n)=>{e||"undefined"==typeof console||console.warn(kl(t,n))},xl=(e,t,n)=>{if(!e)throw new Error(kl(t,n))});const Tl=e=>e,Il=e=>1e3*e,El=e=>e/1e3;const Sl=e=>Array.isArray(e)&&"number"==typeof e[0],Al=(e,t,n=10)=>{let i="";const r=Math.max(Math.round(t/n),2);for(let t=0;t<r;t++)i+=Math.round(1e4*e(t/(r-1)))/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},Nl=2e4;function Ml(e){let t=0;let n=e.next(t);for(;!n.done&&t<Nl;)t+=50,n=e.next(t);return t>=Nl?1/0:t}const Fl=5;const Cl={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Ol=.001;function Pl({duration:e=Cl.duration,bounce:t=Cl.bounce,velocity:n=Cl.velocity,mass:i=Cl.mass}){let r,o;wl(e<=Il(Cl.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let s=1-t;s=bl(Cl.minDamping,Cl.maxDamping,s),e=bl(Cl.minDuration,Cl.maxDuration,El(e)),s<1?(r=t=>{const i=t*s,r=i*e,o=i-n,a=Dl(t,s),l=Math.exp(-r);return Ol-o/a*l},o=t=>{const i=t*s*e,o=i*n+n,a=Math.pow(s,2)*Math.pow(t,2)*e,l=Math.exp(-i),c=Dl(Math.pow(t,2),s);return(-r(t)+Ol>0?-1:1)*((o-a)*l)/c}):(r=t=>Math.exp(-t*e)*((t-n)*e+1)-Ol,o=t=>Math.exp(-t*e)*(e*e*(n-t)));const a=function(e,t,n){let i=n;for(let n=1;n<Rl;n++)i-=e(i)/t(i);return i}(r,o,5/e);if(e=Il(e),isNaN(a))return{stiffness:Cl.stiffness,damping:Cl.damping,duration:e};{const t=Math.pow(a,2)*i;return{stiffness:t,damping:2*s*Math.sqrt(i*t),duration:e}}}const Rl=12;function Dl(e,t){return e*Math.sqrt(1-t*t)}const Ll=["duration","bounce"],Bl=["stiffness","damping","mass"];function zl(e,t){return t.some((t=>void 0!==e[t]))}function Wl(e=Cl.visualDuration,t=Cl.bounce){const n="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:i,restDelta:r}=n;const o=n.keyframes[0],s=n.keyframes[n.keyframes.length-1],a={done:!1,value:o},{stiffness:l,damping:c,mass:u,duration:d,velocity:h,isResolvedFromDuration:f}=function(e){let t={velocity:Cl.velocity,stiffness:Cl.stiffness,damping:Cl.damping,mass:Cl.mass,isResolvedFromDuration:!1,...e};if(!zl(e,Bl)&&zl(e,Ll))if(e.visualDuration){const n=e.visualDuration,i=2*Math.PI/(1.2*n),r=i*i,o=2*bl(.05,1,1-(e.bounce||0))*Math.sqrt(r);t={...t,mass:Cl.mass,stiffness:r,damping:o}}else{const n=Pl(e);t={...t,...n,mass:Cl.mass},t.isResolvedFromDuration=!0}return t}({...n,velocity:-El(n.velocity||0)}),p=h||0,m=c/(2*Math.sqrt(l*u)),v=s-o,g=El(Math.sqrt(l/u)),y=Math.abs(v)<5;let b;if(i||(i=y?Cl.restSpeed.granular:Cl.restSpeed.default),r||(r=y?Cl.restDelta.granular:Cl.restDelta.default),m<1){const e=Dl(g,m);b=t=>{const n=Math.exp(-m*g*t);return s-n*((p+m*g*v)/e*Math.sin(e*t)+v*Math.cos(e*t))}}else if(1===m)b=e=>s-Math.exp(-g*e)*(v+(p+g*v)*e);else{const e=g*Math.sqrt(m*m-1);b=t=>{const n=Math.exp(-m*g*t),i=Math.min(e*t,300);return s-n*((p+m*g*v)*Math.sinh(i)+e*v*Math.cosh(i))/e}}const k={calculatedDuration:f&&d||null,next:e=>{const t=b(e);if(f)a.done=e>=d;else{let n=0===e?p:0;m<1&&(n=0===e?Il(p):function(e,t,n){const i=Math.max(t-Fl,0);return r=n-e(i),(o=t-i)?r*(1e3/o):0;var r,o}(b,e,t));const o=Math.abs(n)<=i,l=Math.abs(s-t)<=r;a.done=o&&l}return a.value=a.done?s:t,a},toString:()=>{const e=Math.min(Ml(k),Nl),t=Al((t=>k.next(e*t).value),e,30);return e+"ms "+t},toTransition:()=>{}};return k}Wl.applyToOptions=e=>{const t=function(e,t=100,n){const i=n({...e,keyframes:[0,t]}),r=Math.min(Ml(i),Nl);return{type:"keyframes",ease:e=>i.next(r*e).value/t,duration:El(r)}}(e,100,Wl);return e.ease=t.ease,e.duration=Il(t.duration),e.type="keyframes",e};const $l=e=>null!==e;class jl{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise((e=>{this.resolve=e}))}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}}function Ul(e){for(let n=1;n<e.length;n++){var t;null!==(t=e[n])&&void 0!==t||(e[n]=e[n-1])}}const ql=e=>e.startsWith("--");const Vl=_l((()=>void 0!==window.ScrollTimeline)),Gl={};function Hl(e,t){const n=_l(e);return()=>{var e;return null!==(e=Gl[t])&&void 0!==e?e:n()}}const Kl=Hl((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0}),"linearEasing"),Xl=([e,t,n,i])=>`cubic-bezier(${e}, ${t}, ${n}, ${i})`,Yl={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Xl([0,.65,.55,1]),circOut:Xl([.55,0,1,.45]),backIn:Xl([.31,.01,.66,-.59]),backOut:Xl([.33,1.53,.69,.99])};function Ql(e,t){return e?"function"==typeof e?Kl()?Al(e,t):"ease-out":Sl(e)?Xl(e):Array.isArray(e)?e.map((e=>Ql(e,t)||Yl.easeOut)):Yl[e]:void 0}function Jl(e,t,n,{delay:i=0,duration:r=300,repeat:o=0,repeatType:s="loop",ease:a="easeOut",times:l}={},c=void 0){const u={[t]:n};l&&(u.offset=l);const d=Ql(a,r);Array.isArray(d)&&(u.easing=d);const h={delay:i,duration:r,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:o+1,direction:"reverse"===s?"alternate":"normal"};c&&(h.pseudoElement=c);return e.animate(u,h)}class Zl extends jl{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:n,keyframes:i,pseudoElement:r,allowFlatten:o=!1,finalKeyframe:s,onComplete:a}=e;this.isPseudoElement=Boolean(r),this.allowFlatten=o,this.options=e,xl("string"!=typeof e.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:e,...t}){return function(e){return"function"==typeof e&&"applyToOptions"in e}(e)&&Kl()?e.applyToOptions(t):(null!==(n=t.duration)&&void 0!==n||(t.duration=300),null!==(i=t.ease)&&void 0!==i||(t.ease="easeOut"),t);var n,i}(e);this.animation=Jl(t,n,i,l,r),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!r){const e=function(e,{repeat:t,repeatType:n="loop"},i,r=1){const o=e.filter($l),s=r<0||t&&"loop"!==n&&t%2==1?0:o.length-1;return s&&void 0!==i?i:o[s]}(i,this.options,s,this.speed);this.updateMotionValue?this.updateMotionValue(e):function(e,t,n){ql(t)?e.style.setProperty(t,n):e.style[t]=n}(t,n,e),this.animation.cancel()}null==a||a(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,t;null===(e=(t=this.animation).finish)||void 0===e||e.call(t)}cancel(){try{this.animation.cancel()}catch(e){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;"idle"!==e&&"finished"!==e&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var e,t;this.isPseudoElement||(null===(e=(t=this.animation).commitStyles)||void 0===e||e.call(t))}get duration(){var e,t;const n=(null===(e=this.animation.effect)||void 0===e||null===(t=e.getComputedTiming)||void 0===t?void 0:t.call(e).duration)||0;return El(Number(n))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+El(e)}get time(){return El(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Il(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){var e;return null!==(e=this.manualStartTime)&&void 0!==e?e:Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){var n;this.allowFlatten&&(null===(n=this.animation.effect)||void 0===n||n.updateTiming({easing:"linear"}));return this.animation.onfinish=null,e&&Vl()?(this.animation.timeline=e,Tl):t(this)}}class ec{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map((e=>e.finished)))}getAll(e){return this.animations[0][e]}setAll(e,t){for(let n=0;n<this.animations.length;n++)this.animations[n][e]=t}attachTimeline(e){const t=this.animations.map((t=>t.attachTimeline(e)));return()=>{t.forEach(((e,t)=>{e&&e(),this.animations[t].stop()}))}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return tc(this.animations,"duration")}get iterationDuration(){return tc(this.animations,"iterationDuration")}runAll(e){this.animations.forEach((t=>t[e]()))}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function tc(e,t){let n=0;for(let i=0;i<e.length;i++){const r=e[i][t];null!==r&&r>n&&(n=r)}return n}class nc extends ec{then(e,t){return this.finished.finally(e).then((()=>{}))}}const ic=new WeakMap,rc=(e,t="")=>`${e}:${t}`;function oc(e){const t=ic.get(e)||new Map;return ic.set(e,t),t}function sc(e,t){var n,i;return null!==(n=null!==(i=null==e?void 0:e[t])&&void 0!==i?i:null==e?void 0:e.default)&&void 0!==n?n:e}const ac=new Set(["borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","width","maxWidth","height","maxHeight","top","right","bottom","left","inset","insetBlock","insetBlockStart","insetBlockEnd","insetInline","insetInlineStart","insetInlineEnd","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingBlock","paddingBlockStart","paddingBlockEnd","paddingInline","paddingInlineStart","paddingInlineEnd","margin","marginTop","marginRight","marginBottom","marginLeft","marginBlock","marginBlockStart","marginBlockEnd","marginInline","marginInlineStart","marginInlineEnd","fontSize","backgroundPositionX","backgroundPositionY"]);function lc(e,t){for(let n=0;n<e.length;n++)"number"==typeof e[n]&&ac.has(t)&&(e[n]=e[n]+"px")}function cc(e,t){const n=window.getComputedStyle(e);return ql(t)?n.getPropertyValue(t):n[t]}function uc(e,t,n,i){if(null==e)return[];const r=function(e){if(null==e)return[];if(e instanceof EventTarget)return[e];if("string"==typeof e){const t=document.querySelectorAll(e);return t?Array.from(t):[]}return Array.from(e).filter((e=>null!=e))}(e),o=r.length;xl(Boolean(o),"No valid elements provided.","no-valid-elements");const s=[];for(let e=0;e<o;e++){const i=r[e],a={...n};"function"==typeof a.delay&&(a.delay=a.delay(e,o));for(const e in t){let n=t[e];Array.isArray(n)||(n=[n]);const r={...sc(a,e)};r.duration&&(r.duration=Il(r.duration)),r.delay&&(r.delay=Il(r.delay));const o=oc(i),l=rc(e,r.pseudoElement||""),c=o.get(l);c&&c.stop(),s.push({map:o,key:l,unresolvedKeyframes:n,options:{...r,element:i,name:e,allowFlatten:!a.type&&!a.ease}})}}for(let e=0;e<s.length;e++){const{unresolvedKeyframes:t,options:n}=s[e],{element:i,name:r,pseudoElement:o}=n;o||null!==t[0]||(t[0]=cc(i,r)),Ul(t),lc(t,r),!o&&t.length<2&&t.unshift(cc(i,r)),n.keyframes=t}const a=[];for(let e=0;e<s.length;e++){const{map:t,key:n,options:i}=s[e],r=new Zl(i);t.set(n,r),r.finished.finally((()=>t.delete(n))),a.push(r)}return a}const dc=(()=>function(e,t,n){return new nc(uc(e,t,n))})();var hc=Ks('<button class="svelte-16kucsb"><div class="svelte-16kucsb"> </div></button>'),fc=Ks('<div class="tryIt-container svelte-16kucsb"><!></div>');const pc={hash:"svelte-16kucsb",code:".eko-gallery-app {--tryItModule_justifyContent: center;--tryItModule_alignItems: flex-end;--tryItModule_padding: 16px 20px 48px 20px;--tryItModule_button_padding: 16px 32px;--tryItModule_button_textAlign: center;--tryItModule_button_borderRadius: 100px;--tryItModule_button_border: 0;--tryItModule_button_boxShadow: 0 4px 24px 2px rgba(0, 0, 0, 0.12);--tryItModule_button_background: #FFFFFF;--tryItModule_button_text_fontFamily: var(--fontName);--tryItModule_button_text_fontSize: 18px;--tryItModule_button_text_color: #222;--tryItModule_button_text_weight: 500;--tryItModule_button_text_lineHeight: 120%;--tryItModule_button_text_letterSpacing: -0.1px;}.tryIt-container.svelte-16kucsb {position:relative;padding:var(--tryItModule_padding);width:100%;height:100%;box-sizing:border-box;display:flex;justify-content:var(--tryItModule_justifyContent);align-items:var(--tryItModule_alignItems);}.tryIt-container.svelte-16kucsb button:where(.svelte-16kucsb) {padding:var(--tryItModule_button_padding);text-align:var(--tryItModule_button_textAlign);border-radius:var(--tryItModule_button_borderRadius);border:var(--tryItModule_button_border);background:var(--tryItModule_button_background);box-shadow:var(--tryItModule_button_boxShadow);font-family:var(--tryItModule_button_text_fontFamily);font-size:var(--tryItModule_button_text_fontSize);color:var(--tryItModule_button_text_color);font-weight:var(--tryItModule_button_text_weight);line-height:var(--tryItModule_button_text_lineHeight);letter-spacing:var(--tryItModule_button_text_letterSpacing);cursor:pointer;opacity:0;overflow:hidden;}.tryIt-container.svelte-16kucsb button:where(.svelte-16kucsb) div:where(.svelte-16kucsb) {opacity:0;}"};function mc(e,t){Li(t,!0),ka(e,pc);const n=io((()=>t.state.ctaText)),i=io((()=>t.state.animationConfig)),r=io((()=>t.state.showCta)),o=io((()=>t.state.onCtaClick));let s=null,a=null,l=mo(!1),c=!1;function u(){c&&dc(s,{transform:"scale(1.05)"},{type:Wl,mass:1.5,stiffness:400,damping:30})}function d(){c&&dc(s,{transform:"scale(1)"},{type:Wl,mass:1.5,stiffness:400,damping:30})}function h(){c&&dc(s,{transform:"scale(0.95)"},{type:Wl,mass:1,stiffness:600,damping:30})}Ho((()=>{const{mass:e,stiffness:t,damping:n,delay:o}=Ds(i);let u;return Ds(r)&&(u=setTimeout((async()=>{go(l,!0),u=null,dc(s,{transform:["translateY(40px) scale(0, 0.2)","translateY(0) scale(1, 1)"],opacity:1},{type:Wl,mass:e,stiffness:t,damping:n}),await dc(a,{transform:["translateY(20px) scale(0.8)","translateY(0) scale(1)"],opacity:1},{type:Wl,mass:e,stiffness:t,damping:n,delay:.15}),c=!0}),o)),()=>{u&&clearTimeout(u)}}));var f=fc(),p=Do(f),m=e=>{var t=hc();t.__mousedown=h,t.__touchstart=h,t.__click=function(...e){var t;null===(t=Ds(o))||void 0===t||t.apply(this,e)};var i=Do(t),r=Do(i,!0);wi(i),Ga(i,(e=>a=e),(()=>a)),wi(t),Ga(t,(e=>s=e),(()=>s)),Qo((()=>{Na(t,"pointer-events: "+(Ds(l)?"auto":"none")),ia(r,Ds(n))})),Us("mouseenter",t,u),Us("mouseleave",t,d),Ys(e,t)};fa(p,(e=>{Ds(r)&&e(m)})),wi(f),Ys(e,f),Bi()}qs(["mousedown","touchstart","click"]);var vc=new WeakSet;function gc(){this.mainTimeline?this.player.switchTimeline(this.mainTimeline):this.emitModuleEnd(),this.state.showCta=!1}const yc={videoModule:class extends tl{constructor({config:e,...t}){var n;super({...t,config:e}),this.Component=hl,this.hasDuration=!e.loop,Za(this),this.coverAssets.push(null!==(n=e.intro)&&void 0!==n?n:e.video),this.cover=this.coverAssets[0],this.state={textBox:e.textBox}}start(e){super.start(e),this.timeline=e.createTimeline();const t=this.config;t.intro&&this.timeline.placeOnTimeline(nl(`${this.id}_intro`,t.intro,e),"end");const n=nl(this.id,t.video,e);this.timeline.placeOnTimeline(n,"end",{loop:t.loop}),t.loop||n.on("nodeend",this.emitModuleEnd)}},toggleModule:class extends tl{constructor({config:e,...t}){super({...t,config:e}),O(this,gl),this.Component=vl,this.synced=e.sync,this.switchTo=()=>{},Za(this),this.coverAssets=e.options.map((e=>{var t;return null!==(t=e.intro)&&void 0!==t?t:e.video})),this.cover=this.coverAssets[0],this.state={options:e.options.map((e=>({label:e.label,note:e.note}))),currentOptionIndex:0,onOptionClicked:A(gl,this,yl).bind(this),textBox:e.options[0].textBox}}start(e){super.start(e),this.synced?(this.timeline=e.createTimeline(),this.config.options.forEach(((t,n)=>{this.timeline.placeOnTimeline(nl(`${this.id}_option_${n}`,t.video,e),0,{loop:!0})})),this.timeline.placeRenderNodeOnTimeline("switch",0,1/0,{params:{switchCrossfadeSeconds:.25,initSwitching:({switchTo:e})=>{this.switchTo=e,e(this.state.currentOptionIndex,{crossfadeSeconds:0})}}})):(this.timelines=this.config.options.map(((t,n)=>{const i=e.createTimeline();return t.intro&&i.placeOnTimeline(nl(`${this.id}_option_${n}_intro`,t.intro,e),"end"),i.placeOnTimeline(nl(`${this.id}_option_${n}`,t.video,e),"end",{loop:!0}),i})),this.timeline=this.timelines[this.state.currentOptionIndex])}},tryItModule:class extends tl{constructor({config:e,...t}){var n;super({...t,config:e}),O(this,vc),Za(this);const{introVideo:i}=e;this.coverAssets.push(null!==(n=i.intro)&&void 0!==n?n:i.loop),this.cover=this.coverAssets[0],this.state={ctaText:e.ctaText,animationConfig:e.animationConfig,showCta:!0,onCtaClick:A(vc,this,gc).bind(this)}}start(e){super.start(e),this.Component=mc,this.timeline=e.createTimeline();const{introVideo:t,mainVideo:n}=this.config;if(t.intro&&this.timeline.placeOnTimeline(nl(`${this.id}_intro_intro`,t.intro,e)),this.timeline.placeOnTimeline(nl(`${this.id}_intro_loop`,t.loop,e),"end",{loop:!0}),n){this.mainTimeline=e.createTimeline(),n.intro&&this.mainTimeline.placeOnTimeline(nl(`${this.id}_main_intro`,n.intro,e));const t=nl(`${this.id}_main_loop`,n.loop,e);this.mainTimeline.placeOnTimeline(t,"end",{loop:!0})}}play(){this.state.showCta=!0,super.play()}}};class bc{#d=Si(mo({}),"GalleryState.#variants");#h=Si(mo("ekonovar"),"GalleryState.#activeVariant");#f=Si(mo(0),"GalleryState.#activeItemIndex");#p=Si(mo(0),"GalleryState.#activeModuleIndex");#m=Si(mo(_o({itemIndex:0,moduleIndex:0})),"GalleryState.#playingModulePosition");#v=Si(io((()=>{var e;return null===(e=Ds(this.#d))||void 0===e?void 0:e[Ds(this.#h)]})),"GalleryState.#currentItemsList");#g=Si(io((()=>{var e;return null===(e=Ds(this.#v))||void 0===e?void 0:e[Ds(this.#f)]})),"GalleryState.#currentItem");#y=Si(io((()=>{var e,t;return Ds(this.#b)?null===(t=Ds(this.#v))||void 0===t?void 0:t[Ds(this.#m).itemIndex].modules[Ds(this.#m).moduleIndex]:null===(e=Ds(this.#g))||void 0===e?void 0:e.modules[Ds(this.#p)]})),"GalleryState.#currentModule");#k=Si(io((()=>{var e;return(null===(e=Ds(this.#v))||void 0===e?void 0:e.flatMap((e=>e.modules)))||[]})),"GalleryState.#currentModulesList");#w=Si(mo(!1),"GalleryState.#playerLoaded");#x=Si(mo(!1),"GalleryState.#paused");#b=Si(mo(!1),"GalleryState.#startedPlaying");#_=Si(io((()=>!(So(Ds(this.#m).itemIndex,this.activeItemIndex)&&So(Ds(this.#m).moduleIndex,this.activeModuleIndex)))),"GalleryState.#seeking");set variants(e){go(this.#d,e)}set activeVariant(e){go(this.#h,e,!0)}set activeItemIndex(e){go(this.#f,e,!0)}set activeModuleIndex(e){go(this.#p,e,!0)}set playingModulePosition(e){go(this.#m,e,!0)}set playerLoaded(e){go(this.#w,e,!0)}set paused(e){go(this.#x,e,!0)}set startedPlaying(e){go(this.#b,e,!0)}get variants(){return Ds(this.#d)}get activeVariant(){return Ds(this.#h)}get activeItemIndex(){return Ds(this.#f)}get activeModuleIndex(){return Ds(this.#p)}get playingModulePosition(){return Ds(this.#m)}get currentItemsList(){return Ds(this.#v)}get currentItem(){return Ds(this.#g)}get currentModule(){return Ds(this.#y)}get playerLoaded(){return Ds(this.#w)}get paused(){return Ds(this.#x)}get startedPlaying(){return Ds(this.#b)}get seeking(){return Ds(this.#_)}get currentModulesList(){return Ds(this.#k)}}const kc={assetsDeliveryBase:"https://{{env}}assets.eko.com"};const wc=2,xc=5,_c=["activeItemIndex","activeModuleIndex","paused","startedPlaying"],Tc=["version","selectItem","selectItemAndStep","next","prev","subscribe"];var Ic=new WeakMap,Ec=new WeakMap,Sc=new WeakMap,Ac=new WeakMap,Nc=new WeakMap,Mc=new WeakSet;class Fc{constructor(e){var t,n,i,r,o;O(this,Mc),F(this,Ic,void 0),F(this,Ec,void 0),F(this,Sc,void 0),F(this,Ac,void 0),F(this,Nc,void 0),P(this,"public",void 0),P(this,"version","0.0.11"),Za(this),C(Ic,this,(null===(t=crypto)||void 0===t||null===(n=t.randomUUID)||void 0===n?void 0:n.call(t))||`eko-gallery-${Date.now()}`),C(Ac,this,e),C(Ec,this,new bc(null==e||null===(i=e.options)||void 0===i?void 0:i.galleryEnv)),C(Nc,this,((e="")=>(So(e,"production")&&(e=""),Object.fromEntries(Object.entries(kc).map((([t,n])=>[t,n.replaceAll("{{env}}",e)])))))(null==e||null===(r=e.options)||void 0===r?void 0:r.galleryEnv)),C(Sc,this,[]);const s=null==e||null===(o=e.instance)||void 0===o||null===(o=o.data)||void 0===o||null===(o=o.blocks)||void 0===o||null===(o=o.blocksArr)||void 0===o||null===(o=o.find((e=>So(e.blockType,"GalleryBlock"))))||void 0===o?void 0:o.config;var a;s?(A(Mc,this,Cc).call(this,s.items),A(Mc,this,Oc).call(this,s.items),function(e,t){function n(t){window.EkoAnalytics("registerContextPacker",{tag:e,...t})}function i(t){return function(...n){return n.pop()!==e?null:t(...n)}}"undefined"!=typeof window&&window.EkoAnalytics&&(n({schema:"iglu:com.helloeko/gallery-app/jsonschema/1-0-0",match:/.*/,getData:i((()=>{var e,n,i,r,o;const s=null===(e=t.currentItem)||void 0===e?void 0:e.modules[t.activeModuleIndex];return{itemid:(null===(n=t.currentItem)||void 0===n?void 0:n.id)||"",itemindex:t.activeItemIndex,totalitems:(null===(i=t.currentItemsList)||void 0===i?void 0:i.length)||0,itemname:(null===(r=t.currentItem)||void 0===r?void 0:r.name)||"",moduleid:(null==s?void 0:s.id)||"",modulename:(null==s?void 0:s.name)||"",moduletype:(null==s?void 0:s.config.itemType)||"",moduleindex:t.activeModuleIndex,totalmodules:(null===(o=t.currentItem)||void 0===o?void 0:o.modules.length)||0,version:"0.0.11"}}))}),n({schema:"iglu:com.helloeko/implementation_interactions/jsonschema/1-0-6",match:"interaction",getData:i((e=>e))}))}(M(Ic,this),M(Ec,this))):console.warn("[eko-gallery-app] Gallery initiated without an instance, results will be empty"),this.public=(a=this,Tc.reduce(((e,t)=>{if(!(t in a))throw new Error(`[eko-gallery-app] Public API member "${t}" does not exist on GalleryLogic`);const n=a[t];return e[t]=So(typeof n,"function")?n.bind(a):n,e}),{}))}dispose(){var e,t;So(typeof window,"undefined",!1)&&(null===(e=(t=window).EkoAnalytics)||void 0===e||e.call(t,"reset",M(Ic,this)))}start(e){M(Ec,this).playerLoaded=!0,M(Sc,this).forEach((t=>{t.start(e)})),C(Sc,this,null),A(Mc,this,Pc).call(this,e),M(Ec,this).currentModule.play()}selectItem(e){const t=M(Ec,this);So(e,t.activeItemIndex)||(t.activeItemIndex=e,t.activeModuleIndex=0)}selectItemAndStep(e,t){const n=M(Ec,this);So(e,n.activeItemIndex)&&So(t,n.activeModuleIndex)||(n.activeItemIndex=e,n.activeModuleIndex=t)}next(){A(Mc,this,Dc).call(this)}prev(){const e=M(Ec,this);if(e.activeModuleIndex=e.activeModuleIndex-1,!e.currentItem.modules[e.activeModuleIndex])if(e.currentItemsList[e.activeItemIndex-1]){e.activeItemIndex=e.activeItemIndex-1;const t=e.currentItemsList[e.activeItemIndex];e.activeModuleIndex=t.modules.length-1}else e.activeModuleIndex=e.activeModuleIndex+1}subscribe(e){const t=M(Ec,this);return function(e){pr.ensure();const t=qo(zn|Qn,e,!0);return()=>{is(t)}}((()=>{Ho((()=>{const n=_c.reduce(((e,n)=>(e[n]=t[n],e)),{});e(n)}))}))}getCoverUrl(e,t){var n,i,r,o;const s=(null==e||null===(n=e.entity)||void 0===n?void 0:n.entityId)||(null==e?void 0:e.assetId),a=null!==(i=null==e||null===(r=e.entity)||void 0===r?void 0:r.entityRevision)&&void 0!==i?i:null==e?void 0:e.assetRevision;if(!s)throw new Error(`[getCoverUrl] No assetId found in assetConfig: ${JSON.stringify(e||{},null,2)}`);if(!a&&So(a,0,!1))throw new Error(`[getCoverUrl] No assetRevision found for asset ${s}.`);let l;return null!==(o=M(Ac,this))&&void 0!==o&&null!==(o=o.coverAssetsMap)&&void 0!==o&&o[s]?(l=new URL(M(Ac,this).coverAssetsMap[s]),/^[a-z0-9]*assets.eko.com$/.test(l.host)&&t&&(l.pathname=l.pathname.replace(".png",".webp"))):(l=new URL(`${M(Nc,this).assetsDeliveryBase}/image/${s}/${a}?startOffset=0`),l.pathname+=t?".webp":".png"),t&&l.searchParams.set("width",t),l.href}track(e,...t){var n,i;So(typeof window,"undefined",!1)&&(null===(n=(i=window).EkoAnalytics)||void 0===n||n.call(i,"track",e,...t,M(Ic,this)))}interaction(e,t){const n=M(Ic,this);return i=>{if(So(typeof window,"undefined",!1)){var r,o,s,a;const e=null==i||null===(r=i.target)||void 0===r?void 0:r.dataset;let l;null!=i&&null!==(o=i.detail)&&void 0!==o&&o.direction&&(So(i.detail.direction,"left")?l="swipe_next":So(i.detail.direction,"right")&&(l="swipe_prev"));const c={elementid:(null==e?void 0:e.elementid)||(null==t?void 0:t.elementid)||"",elementtype:(null==e?void 0:e.elementtype)||(null==t?void 0:t.elementtype)||"",elementname:(null==e?void 0:e.elementname)||(null==t?void 0:t.elementname)||"",interactiontype:l||(null==e?void 0:e.interactiontype)||(null==t?void 0:t.interactiontype)||""};null===(s=(a=window).EkoAnalytics)||void 0===s||s.call(a,"track","interaction",c,n)}e(i)}}get uuid(){return M(Ic,this)}get state(){return M(Ec,this)}get urls(){return M(Nc,this)}}function Cc(e){const t={};for(let n of e)for(let e of Object.keys(n.variants||{}))t[e]=[];t.ekonovar=[],M(Ec,this).variants=t}function Oc(e){const t=(e=[],t)=>{const n=[];for(let[i,r]of e.entries()){if(!yc[r.itemType])throw new Error(`Unknown module type ${r.itemType}`);const e=new yc[r.itemType]({position:{...t,moduleIndex:i},config:r,gallery:this});e.moduleEndListener=A(Mc,this,Rc).bind(this),n.push(e)}return n};for(const[i,r]of e.entries())if(So(r.itemType,"galleryItemV2")){const{modules:e,...o}=r;for(const[s,a]of Object.entries(M(Ec,this).variants)){var n;if(null===(n=r.variants)||void 0===n?void 0:n[s])console.log("NO IMPLEMENTED");else{const n={...o};n.modules=t(e,{variantId:s,itemIndex:i}),C(Sc,this,[...M(Sc,this),...n.modules]),a.push(n)}}}}function Pc(e){for(const[,t]of Object.entries(M(Ec,this).variants))for(const[n,i]of t.entries()){const r=i.modules,o=t.filter((e=>So(e,i,!1))).map((e=>e.modules[0]));for(const[i,s]of r.entries()){let a=r[i+1];a||(a=t[(n+1)%t.length].modules[0]);const l=a.timeline.getNodesAtTime(0)[0],c=o.filter((e=>So(e,a,!1))).map((e=>e.timeline.getNodesAtTime(0)[0])),u=[{nodeId:l.id,weight:wc},...c.map((e=>({nodeId:e.id,weight:xc})))];for(const t of s.timeline.placements){e.getNode(t.nodeId).setChildren(u)}}}}function Rc(){const e=M(Ec,this),t=e.currentItem.modules;t.length>1&&So(e.activeModuleIndex,t.length-1)?e.activeModuleIndex=0:A(Mc,this,Dc).call(this)}function Dc(){const e=M(Ec,this);e.activeModuleIndex=e.activeModuleIndex+1,e.currentItem.modules[e.activeModuleIndex]||(e.currentItemsList[e.activeItemIndex+1]?(e.activeItemIndex=e.activeItemIndex+1,e.activeModuleIndex=0):e.activeModuleIndex=e.activeModuleIndex-1)}var Lc=Ks('<button><span class="svelte-er27y2"> </span></button>'),Bc=Ks('<div class="nav-buttons-container svelte-er27y2"><div class="nav-buttons svelte-er27y2"></div></div>');const zc={hash:"svelte-er27y2",code:".eko-gallery-app {--nav_gap: 10px;--nav_padding: 12px 16px;--nav_bgColor: #FFFFFF;--nav_justifyContent: center;--nav_button_width: fit-content;--nav_button_bgColor: #FFFFFF;--nav_button_borderRadius: 100px;--nav_button_paddingTop: 8px;--nav_button_paddingBottom: var(--nav_button_paddingTop);--nav_button_paddingLeft: 12px;--nav_button_paddingRight: var(--nav_button_paddingLeft);--nav_button_boxShadow: 0 0 0 1px #E7E7E7;--nav_button_gap: 2px;--nav_button_selected_boxShadow: 0 0 0 1px #000000;--nav_button_selected_bgColor: var(--nav_button_bgColor);--nav_button_text_color: #000000;--nav_button_text_fontSize: 14px;--nav_button_text_fontWeight: 500;--nav_button_text_fontFamily: var(--fontName);--nav_button_text_lineHeight: 120%;--nav_button_text_letterSpacing: 0px;--nav_button_text_align: center;--nav_button_selected_text_color: var(--nav_button_text_color);--nav_button_selected_text_fontWeight: var(--nav_button_text_fontWeight);--nav_button_image_borderRadius: calc(var(--nav_button_borderRadius) - var(--nav_button_paddingTop));--nav_arrow_color: var(--secondaryColor);--nav_arrow_bgColor: var(--primaryColor);--nav_arrow_padding: 9px;--nav_arrow_size: 28px;--nav_arrow_boxShadow: 0 0 8px 0 rgba(0, 0, 0, 0.3);}.nav-buttons-container.svelte-er27y2 {width:100%;background-color:var(--nav_bgColor);height:var(--buttonsContainerHeight);display:flex;box-sizing:border-box;text-align:center;justify-content:var(--nav_justifyContent);align-items:center;position:relative;flex-shrink:0;}.nav-buttons-container.svelte-er27y2 :where(.svelte-er27y2) {touch-action:auto;}.nav-buttons.svelte-er27y2 {display:flex;margin:0;gap:var(--nav_gap);height:100%;align-items:center;padding:var(--nav_padding);box-sizing:border-box;overflow-x:auto;scrollbar-width:none;max-width:100%;width:fit-content;overflow-y:hidden;overscroll-behavior-y:none;}.nav-button.svelte-er27y2 {display:flex;outline:none;flex-shrink:0;height:100%;width:var(--nav_button_width);border:none;cursor:pointer;align-items:center;gap:var(--nav_button_gap);background-color:var(--nav_button_bgColor);border-radius:var(--nav_button_borderRadius);\n /* eslint-disable-next-line max-len */padding:var(--nav_button_paddingTop) var(--nav_button_paddingRight) var(--nav_button_paddingBottom) var(--nav_button_paddingLeft);box-shadow:var(--nav_button_boxShadow);}.nav-button.svelte-er27y2 span:where(.svelte-er27y2) {flex:1 0 0;transition:color 0.2s ease-in-out;color:var(--nav_button_text_color);font-weight:var(--nav_button_text_fontWeight);font-size:var(--nav_button_text_fontSize);font-family:var(--nav_button_text_fontFamily);line-height:var(--nav_button_text_lineHeight);letter-spacing:var(--nav_button_text_letterSpacing);text-align:var(--nav_button_text_align);}.nav-button.selected.svelte-er27y2 {background-color:var(--nav_button_selected_bgColor);box-shadow:var(--nav_button_selected_boxShadow);}.nav-button.selected.svelte-er27y2 span:where(.svelte-er27y2) {color:var(--nav_button_selected_text_color);font-weight:var(--nav_button_selected_text_fontWeight);}"};qs(["click"]);const Wc="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20320%20512'%3e%3cpath%20d='M310.6%20233.4c12.5%2012.5%2012.5%2032.8%200%2045.3l-192%20192c-12.5%2012.5-32.8%2012.5-45.3%200s-12.5-32.8%200-45.3L242.7%20256%2073.4%2086.6c-12.5-12.5-12.5-32.8%200-45.3s32.8-12.5%2045.3%200l192%20192z'/%3e%3c/svg%3e";var $c=Ks('<button><img class="svelte-1al44kl"/></button>');const jc={hash:"svelte-1al44kl",code:'.nav-button.svelte-1al44kl {height:30px;width:30px;border-radius:100%;background-color:transparent;padding:9px;box-sizing:border-box;display:flex;align-items:center;justify-content:center;pointer-events:auto;border:0;opacity:100%;cursor:pointer;transition-property:background-color, box-shadow, opacity;position:relative;}.nav-button.prev.svelte-1al44kl {transform:rotate(180deg);}.nav-button.hidden.svelte-1al44kl {opacity:0;pointer-events:none;}.nav-button.svelte-1al44kl::before {content:"";position:absolute;top:-8px;right:-8px;bottom:-8px;left:-8px;}.nav-button.svelte-1al44kl img:where(.svelte-1al44kl) {height:100%;}'};function Uc(e,t){ka(e,jc);const n=Ka(t,"hidden",3,!1);var i=$c();let r;i.__click=function(...e){var n;null===(n=t.onClick)||void 0===n||n.apply(this,e)};var o=Do(i);wi(i),Qo((()=>{var e;r=Sa(i,1,`nav-button ${null!==(e=t.type)&&void 0!==e?e:""}`,"svelte-1al44kl",r,{hidden:n()}),Ba(i,"aria-label",t.type),Ba(o,"src",Wc),Ba(o,"alt",t.type)})),Ys(e,i)}qs(["click"]);var qc=Ks('<button data-elementtype="step-indicator" data-interactiontype="navigation"><span class="svelte-1mxltt0"> </span></button>'),Vc=Ks('<div class="steps-indicator-container svelte-1mxltt0"><button aria-label="Scroll to previous steps"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="svelte-1mxltt0"><path d="M12.8333 16.6668C12.68 16.6668 12.5266 16.5935 12.4266 16.4601L9.42663 12.2935C9.36482 12.2081 9.33154 12.1055 9.33154 12.0001C9.33154 11.8948 9.36482 11.7921 9.42663 11.7068L12.4266 7.54012C12.4651 7.48671 12.5138 7.44142 12.5698 7.40682C12.6259 7.37222 12.6882 7.349 12.7532 7.33848C12.8182 7.32795 12.8846 7.33033 12.9487 7.34549C13.0128 7.36064 13.0732 7.38826 13.1266 7.42678C13.18 7.46531 13.2253 7.51397 13.2599 7.56999C13.2945 7.62602 13.3177 7.68831 13.3283 7.75331C13.3388 7.81831 13.3364 7.88475 13.3213 7.94883C13.3061 8.01291 13.2785 8.07338 13.24 8.12678L10.4466 12.0001L13.2333 15.8735C13.2864 15.9479 13.3181 16.0355 13.3251 16.1267C13.332 16.2179 13.314 16.3092 13.2728 16.3909C13.2316 16.4725 13.1689 16.5414 13.0915 16.59C13.014 16.6386 12.9247 16.6652 12.8333 16.6668Z" fill="#030303" class="svelte-1mxltt0"></path></svg></button> <div role="group" aria-roledescription="Sequence navigation buttons"></div> <button aria-label="Scroll to next steps"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="svelte-1mxltt0"><path d="M11.1668 16.6666C11.0668 16.6666 10.9601 16.6333 10.8734 16.5733C10.8199 16.5348 10.7746 16.4862 10.7399 16.4302C10.7053 16.3741 10.682 16.3118 10.6715 16.2468C10.6609 16.1818 10.6634 16.1153 10.6786 16.0512C10.6938 15.9871 10.7215 15.9266 10.7601 15.8733L13.5534 11.9999L10.7601 8.12661C10.6001 7.89994 10.6468 7.59328 10.8734 7.42661C11.1001 7.26661 11.4068 7.31994 11.5734 7.53994L14.5734 11.7066C14.7001 11.8799 14.7001 12.1133 14.5734 12.2933L11.5734 16.4599C11.4734 16.5933 11.3201 16.6666 11.1668 16.6666Z" fill="#030303" class="svelte-1mxltt0"></path></svg></button></div>');const Gc={hash:"svelte-1mxltt0",code:'.steps-indicator-container.svelte-1mxltt0 {width:calc(100% - 16px);position:absolute;bottom:12px;left:8px;animation-duration:0.75s;animation-timing-function:cubic-bezier(0.36, 0, 0, 1);animation-fill-mode:both;animation-delay:0.15s;\n animation-name: svelte-1mxltt0-gallery-steps-appear-anim;}.steps-indicator.svelte-1mxltt0 {--stepSize: 6px;--stepPadding: 7px;padding:4px 4px;margin:0 16px;display:flex;gap:8px;align-items:center;overflow-x:auto;pointer-events:all;scrollbar-width:none;}.steps-indicator.fade-right.svelte-1mxltt0 {mask-image:linear-gradient(to right, black calc(100% - 20px), transparent);}.steps-indicator.fade-left.svelte-1mxltt0 {mask-image:linear-gradient(to left, black calc(100% - 20px), transparent);}.steps-indicator.fade-left.fade-right.svelte-1mxltt0 {mask-image:linear-gradient(to right, transparent, black 20px, black calc(100% - 20px), transparent);}.steps-indicator.with-duration.svelte-1mxltt0 .step-button:where(.svelte-1mxltt0) span:where(.svelte-1mxltt0) {position:relative;overflow:hidden;}.steps-indicator.with-duration.svelte-1mxltt0 .step-button:where(.svelte-1mxltt0) span:where(.svelte-1mxltt0):after {transition:0.3s ease-in-out;transition-property:opacity, width;}.step-button.svelte-1mxltt0 {padding:8px 12px;border:#E4E5E8 solid 1px;background-color:#FBFBFB;cursor:pointer;pointer-events:all;flex-shrink:0;border-radius:100px;font-size:12px;font-weight:500;line-height:16px;color:#030303;transition:all 0.3s ease-in-out;outline-color:#3191fc;}.step-button.active.svelte-1mxltt0 {background-color:#014FD3;color:#FFFFFF;box-shadow:none;border-color:#014FD3;}.step-button.active.svelte-1mxltt0:after {opacity:100%;\n animation: svelte-1mxltt0-stepDurationAnimation var(--stepDuration) linear forwards;animation-play-state:running;}.step-button.svelte-1mxltt0:hover:not(.active) {background:#F3F4F6;}.step-button.svelte-1mxltt0:active:not(.active) {background:#E4E5E8;}.step-button.svelte-1mxltt0:focus {outline-offset:4px;outline-width:2px;}.step-button.svelte-1mxltt0 span:where(.svelte-1mxltt0) {display:block;box-sizing:border-box;pointer-events:none;white-space:nowrap;}.step-button.svelte-1mxltt0 span:where(.svelte-1mxltt0):after {content:"";background-color:rgba(0, 0, 0, 0.6);position:absolute;border-radius:var(--stepSize);width:0;height:100%;top:0;left:-100%;opacity:0;transform:translateX(0);animation-play-state:paused;}.step-arrow.svelte-1mxltt0 {width:34px;height:34px;position:absolute;z-index:10;bottom:4px;border:1px solid #C4C8CF;border-radius:50%;background-color:#FFFFFF;box-shadow:0 2px 3px 0 rgba(0, 0, 0, 0.05);box-sizing:border-box;display:flex;align-items:center;justify-content:center;pointer-events:none;cursor:pointer;opacity:0;}.step-arrow.svelte-1mxltt0:hover {background:#F6F6F7;}.step-arrow.svelte-1mxltt0:active {background:#E4E5E8;}.step-arrow-prev.svelte-1mxltt0 {left:3px;transform:translateX(-100%);\n animation: svelte-1mxltt0-arrow-left-disappear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}.step-arrow-prev.visible.svelte-1mxltt0 {pointer-events:auto;\n animation: svelte-1mxltt0-arrow-left-appear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}.step-arrow-next.svelte-1mxltt0 {right:3px;transform:translateX(100%);\n animation: svelte-1mxltt0-arrow-right-disappear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}.step-arrow-next.visible.svelte-1mxltt0 {pointer-events:auto;\n animation: svelte-1mxltt0-arrow-right-appear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}\n\n@keyframes svelte-1mxltt0-gallery-steps-appear-anim {\n from {\n opacity: 0;\n transform: translate(0, 10px);\n }\n to {\n opacity: 1;\n transform: translate(0, 0);\n }\n}\n@keyframes svelte-1mxltt0-gallery-steps-disappear-anim {\n from {\n opacity: 1;\n transform: translate(0, 0);\n }\n to {\n opacity: 0;\n transform: translate(0, 10px);\n }\n}\n@keyframes svelte-1mxltt0-arrow-left-appear {\n from {\n opacity: 0;\n transform: translateX(-100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n@keyframes svelte-1mxltt0-arrow-left-disappear {\n from {\n opacity: 1;\n transform: translateX(0);\n }\n to {\n opacity: 0;\n transform: translateX(-100%);\n }\n}\n@keyframes svelte-1mxltt0-arrow-right-appear {\n from {\n opacity: 0;\n transform: translateX(100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n@keyframes svelte-1mxltt0-arrow-right-disappear {\n from {\n opacity: 1;\n transform: translateX(0);\n }\n to {\n opacity: 0;\n transform: translateX(100%);\n }\n}\n@keyframes svelte-1mxltt0-stepDurationAnimation {\n 0% {\n transform: translateX(0);\n }\n 100% {\n transform: translateX(100%);\n }\n}'};function Hc(e,t){Li(t,!0),ka(e,Gc);const n=16,i=32;let r=Ka(t,"gallery",7),o=mo(null),s=mo(null),a=mo(!1),l=mo(!1);const c=io((()=>{let e=[];return e=r().state.currentItem.modules.map(((e,t)=>({index:t,type:t===r().state.activeModuleIndex?"active":"",name:e.name}))),e}));function u(){Ds(o)&&(go(a,Ds(o).scrollLeft>0),go(l,Ds(o).scrollLeft+Ds(o).clientWidth<Ds(o).scrollWidth-0))}function d(e){Ds(o).scrollBy({left:e,behavior:"smooth"})}function h(e,t){const r=e.getBoundingClientRect(),o=t.getBoundingClientRect(),s=n+i;o.left<r.left+i?d(o.left-r.left-s):o.right>r.right-i&&d(o.right-r.right+s)}function f(){const e=Array.from(Ds(o).querySelectorAll(".step-button")).find((e=>{const t=e.getBoundingClientRect(),n=Ds(o).getBoundingClientRect();return t.left>n.left+i}));if(e){const t=e.previousElementSibling;t&&h(Ds(o),t)}}function p(){const e=Array.from(Ds(o).querySelectorAll(".step-button")).reverse().find((e=>{const t=e.getBoundingClientRect(),n=Ds(o).getBoundingClientRect();return t.right<n.right-i}));if(e){const t=e.nextElementSibling;t&&h(Ds(o),t)}}Ho((()=>{if(Ds(o)){u();const e=Ds(o).querySelector(".step-button.active");e&&go(s,e,!0);const t=new MutationObserver((()=>{const e=Ds(o).querySelector(".step-button.active");e&&go(s,e,!0)}));t.observe(Ds(o),{attributes:!0,attributeFilter:["class"],subtree:!0});const n=new ResizeObserver((()=>{u()}));return n.observe(Ds(o)),()=>{t.disconnect(),n.disconnect()}}})),Ho((()=>{Ds(c),Ds(o)&&Rs().then(u)})),Ho((()=>{Ds(s)&&Ds(o)&&h(Ds(o),Ds(s))}));var m=Xs();Us("resize",Ao,u),function(e,t,n){gi&&ki();var i=new ua(e);Jo((()=>{var e=t();i.ensure(e,n)}))}(Lo(m),(()=>r().state.activeItemIndex),(e=>{var t=Vc(),n=Do(t);let i;n.__click=f;var s=Bo(n,2);let d;va(s,21,(()=>Ds(c)),pa,((e,t)=>{var n=qc();let i;var s=io((()=>r().interaction((e=>{return n=e.currentTarget,i=Ds(t).index,r().state.activeModuleIndex=i,void h(Ds(o),n);var n,i}))));n.__click=function(...e){var t;null===(t=Ds(s))||void 0===t||t.apply(this,e)};var a=Do(n),l=Do(a,!0);wi(a),wi(n),Qo((()=>{i=Sa(n,1,"step-button svelte-1mxltt0",null,i,{active:"active"===Ds(t).type}),Ba(n,"aria-label",`Go to step $${Ds(t).index+1}`),Ba(n,"data-elementid",`${Ds(t).index+1}`),Ba(n,"data-elementname",Ds(t).name),ia(l,Ds(t).name)})),Ys(e,n)})),wi(s),Ga(s,(e=>go(o,e)),(()=>Ds(o)));var m=Bo(s,2);let v;m.__click=p,wi(t),Qo((()=>{var e;i=Sa(n,1,"step-arrow step-arrow-prev svelte-1mxltt0",null,i,{visible:Ds(a)}),d=Sa(s,1,"steps-indicator svelte-1mxltt0",null,d,{"with-duration":r().state.currentModule.hasDuration,paused:r().state.paused,"fade-left":Ds(a),"fade-right":Ds(l)}),Na(s,`--stepDuration: ${null!==(e=r().state.currentModule.duration)&&void 0!==e?e:""}s`),v=Sa(m,1,"step-arrow step-arrow-next svelte-1mxltt0",null,v,{visible:Ds(l)})})),Us("scroll",s,u),Ys(e,t)})),Ys(e,m),Bi()}qs(["click"]);const Kc="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3.01318%203.42005C3.01318%202.06672%204.50652%201.26672%205.66652%201.90672C6.82652%202.54672%2014.0732%206.48672%2014.0732%206.48672C15.2865%207.15339%2015.2865%208.86005%2014.0732%209.52005L5.66652%2014.1001C4.50652%2014.7334%203.01318%2013.9401%203.01318%2012.5801V3.42005ZM3.98652%2012.5801C3.98652%2013.1334%204.63318%2013.5467%205.19985%2013.2401L13.6065%208.66005C14.1399%208.36672%2014.1465%207.63339%2013.6065%207.34005C13.0665%207.04672%205.19985%202.76005%205.19985%202.76005C4.63985%202.44672%203.98652%202.86005%203.98652%203.42005V12.5801Z'%20fill='%23030303'/%3e%3c/svg%3e",Xc="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M10.8332%2014C10.5598%2014%2010.3332%2013.7733%2010.3332%2013.5V2.5C10.3332%202.22667%2010.5598%202%2010.8332%202C11.1065%202%2011.3332%202.22667%2011.3332%202.5V13.5C11.3332%2013.7733%2011.1065%2014%2010.8332%2014ZM5.1665%2014C4.89317%2014%204.6665%2013.7733%204.6665%2013.5V2.5C4.6665%202.22667%204.89317%202%205.1665%202C5.43984%202%205.6665%202.22667%205.6665%202.5V13.5C5.6665%2013.7733%205.43984%2014%205.1665%2014Z'%20fill='%23030303'/%3e%3c/svg%3e";var Yc=Ks('<img alt="Play" class="svelte-a3r6re"/>'),Qc=Ks('<img alt="Pause" class="svelte-a3r6re"/>'),Jc=Ks('<button class="pause-button svelte-a3r6re"><!></button>');const Zc={hash:"svelte-a3r6re",code:".pause-button.svelte-a3r6re {position:absolute;top:10px;right:10px;background:#FFFFFF;border-radius:100%;border:1px #C4C8CF solid;padding:0;width:32px;height:32px;display:flex;justify-content:center;align-items:center;pointer-events:auto;transition:background 0.2s ease-in-out;cursor:pointer;outline-color:#3191fc;}.pause-button.svelte-a3r6re:hover {background:#F6F6F7;}.pause-button.svelte-a3r6re:active {background:#E4E5E8;}.pause-button.svelte-a3r6re:focus {outline-offset:8px;outline-width:2px;}.pause-button.svelte-a3r6re img:where(.svelte-a3r6re) {width:16px;height:16px;pointer-events:none;}"};qs(["click"]);const eu=300,tu=60,nu="none";function iu(e,t,n){return e.addEventListener(t,n),()=>e.removeEventListener(t,n)}function ru(e,t,n){const{x:i,y:r}=function(e,t){const n=e.getBoundingClientRect();return{x:Math.round(t.clientX-n.left),y:Math.round(t.clientY-n.top)}}(e,t);return{event:t,pointersCount:n.length,target:t.target,x:i,y:r,attachmentNode:e}}function ou(e,t,n,i,r){const o=ru(e,n,i);return e.dispatchEvent(new CustomEvent(`${t}${r}`,{detail:o})),o}function su(){let e=[],t=()=>{},n=[];return{setPointerControls:(i,r,o,s,a,l=nu,c=[])=>{var u;if(r.style.touchAction=(u=l,Array.isArray(u)?u:[u]).join(" "),n=c,n.forEach((t=>{var n;null===(n=t.onInit)||void 0===n||n.call(t,e)})),!e.length){let l=function(t){e.push(t);const l=ou(r,i,t,e,"down");function c(t){const o=e.length;e=function(e,t){return t.filter((t=>So(e.pointerId,t.pointerId,!1)))}(t,e);if(o>e.length){e.length||(u(),d(),h(),f());const o=ou(r,i,t,e,"up");null==a||a(e,t),setTimeout((()=>{n.forEach((t=>{var n;null===(n=t.onUp)||void 0===n||n.call(t,o,e)}))}))}}null==s||s(e,t),setTimeout((()=>{n.forEach((t=>{var n;null===(n=t.onDown)||void 0===n||n.call(t,l,e)}))}));const u=iu(r,"pointermove",(t=>{e=e.map((e=>So(t.pointerId,e.pointerId)?t:e));const s=ou(r,i,t,e,"move");null==o||o(e,t),n.forEach((t=>{var n;null===(n=t.onMove)||void 0===n||n.call(t,s,e)}))})),d=iu(r,"lostpointercapture",(e=>{c(e)})),h=iu(r,"pointerup",(e=>{c(e)})),f=iu(r,"pointerleave",(e=>{c(e)}))};t=iu(r,"pointerdown",l)}return{destroy:()=>{e.length||(t(),n.forEach((e=>{var t;null===(t=e.onDestroy)||void 0===t||t.call(e)})))}}}}}const au="@attach";function lu(){return Symbol(au)}const cu="swipe";function uu(e,t,n,i=!1){const{setPointerControls:r}=su(),o=i?cu:lu();return{...n,[`on${cu}`]:e,[o]:e=>{const{onDown:n,onUp:i,parameters:o}=function(e,t){const n={timeframe:eu,minSwipeDistance:tu,touchAction:nu,composed:!1,...t};let i,r,o,s;function a(e,t){r=t.clientX,o=t.clientY,i=Date.now(),So(e.length,1)&&(s=t.target)}function l(t,a){if(So(a.type,"pointerup")&&So(t.length,0)&&Date.now()-i<n.timeframe){const t=a.clientX-r,i=a.clientY-o,l=Math.abs(t),c=Math.abs(i);let u=null;l>=2*c&&l>n.minSwipeDistance?u=t>0?"right":"left":c>=2*l&&c>n.minSwipeDistance&&(u=i>0?"bottom":"top"),u&&e.dispatchEvent(new CustomEvent(cu,{detail:{direction:u,target:s,pointerType:a.pointerType}}))}}return{onDown:a,onUp:l,parameters:n}}(e,null==t?void 0:t());return r(cu,e,null,n,i,o.touchAction,o.plugins).destroy}}}const du="tap";function hu(e,t,n,i=!1){const{setPointerControls:r}=su(),o=i?du:lu();return{...n,[`on${du}`]:e,[o]:e=>{const{onDown:n,onUp:i,parameters:o}=function(e,t){const n={timeframe:eu,composed:!1,touchAction:"auto",...t};let i,r,o;function s(t,s){if(Math.abs(s.clientX-r)<4&&Math.abs(s.clientY-o)<4&&Date.now()-i<n.timeframe){const t=e.getBoundingClientRect(),n=Math.round(s.clientX-t.left),i=Math.round(s.clientY-t.top);e.dispatchEvent(new CustomEvent(du,{detail:{x:n,y:i,target:s.target,pointerType:s.pointerType}}))}}function a(e,t){r=t.clientX,o=t.clientY,i=Date.now()}return{onDown:a,onUp:s,parameters:n}}(e,null==t?void 0:t());return r(du,e,null,n,i,o.touchAction,o.plugins).destroy}}}const fu=e=>{const t="#00ff00",n=1e6,i=4;let r,o,s,a=null,l=!1,c=Date.now();const u={x:void 0,y:void 0};function d(){const t=e.fadeTime,n=Date.now(),i=n-c;i>t/20&&(a&&o&&s&&r&&(s.drawImage(r,0,0),a.clearRect(0,0,r.width,r.height),a.globalAlpha=1-3*i/t,a.drawImage(o,0,0),a.globalAlpha=1,s.clearRect(0,0,r.width,r.height)),c=n),l&&requestAnimationFrame(d)}function h(e){u.x=e.x,u.y=e.y}function f(){a&&o&&r&&(a.canvas.width=window.innerWidth,a.canvas.height=window.innerHeight,o.width=r.width,o.height=r.height)}function p(t){var i;m(),r=window.document.createElement("canvas"),r.id="svelte-gestures-highlight-plugin",a=r.getContext("2d"),r.style.cssText=`\ndisplay: block; \nwidth: 100dvw;\nheight: 100dvh;\ntop: 0;\nleft: 0;\nposition: fixed;\npointer-events: none;\nz-index: ${null!==(i=e.zIndex)&&void 0!==i?i:n};\n`,window.document.body.appendChild(r),window.addEventListener("resize",f),t&&h(t.event),o=document.createElement("canvas"),f(),s=o.getContext("2d"),l=!0,d()}function m(){var e;l=!1,null===(e=window.document.getElementById("svelte-gestures-highlight-plugin"))||void 0===e||e.remove(),window.removeEventListener("resize",f)}return{onMove:n=>{var r,o,s;r=n.event,a&&(a.beginPath(),a.lineWidth=null!==(o=e.lineWidth)&&void 0!==o?o:i,a.lineCap="round",a.strokeStyle=null!==(s=e.color)&&void 0!==s?s:t,So(u.x,void 0,!1)&&So(u.y,void 0,!1)?(a.moveTo(u.x,u.y),h(r),a.lineTo(u.x,u.y)):h(r),a.stroke())},onDown:e=>{p(e)},onUp:(e,t)=>{So(t.length,0)&&m()},onDestroy:m,onInit:e=>{e.length&&(u.x=void 0,u.y=void 0,p())}}};var pu=Ks("<div></div>"),mu=Ks("<div></div>");const vu={hash:"svelte-1fv6njc",code:".swiper.svelte-1fv6njc {position:absolute;top:0;left:0;pointer-events:auto;width:100%;height:100%;}"};var gu=Ks("<img/>"),yu=Ks('<div class="ui-container svelte-1rvgxfc"><!></div>'),bu=Ks('<div class="cover-container svelte-1rvgxfc"><!> <!> <!></div>'),ku=Ks('<div class="covers-container svelte-1rvgxfc" style="scroll-behavior: auto;"></div>');const wu={hash:"svelte-1rvgxfc",code:".covers-container.svelte-1rvgxfc {position:absolute;top:0;left:0;bottom:0;right:0;overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory;display:flex;gap:0.5px;}.covers-container.svelte-1rvgxfc::-webkit-scrollbar {display:none;}.cover-container.svelte-1rvgxfc {position:relative;display:flex;width:100%;height:100%;flex-shrink:0;scroll-snap-align:center;user-select:none;justify-content:center;align-items:center;}.cover-image.svelte-1rvgxfc {width:var(--videoWidth);height:var(--videoHeight);aspect-ratio:var(--videoAspect);object-fit:cover;pointer-events:none;background:#ffffff;}.cover-image.hidden.svelte-1rvgxfc {opacity:0;}.cover-image.hidden.force-show.svelte-1rvgxfc {opacity:1;background:transparent;}.ui-container.svelte-1rvgxfc {position:absolute;top:0;left:0;bottom:0;right:0;pointer-events:none;}"};function xu(e,t){Li(t,!0),ka(e,wu);const n=[375,768,1024,1400,1920];let i,r=Ka(t,"scrollOffset",15),o=Ka(t,"isMobile",3,!1),s=Ka(t,"gallery",7),a=io((()=>s().state.playingModulePosition)),l=null,c=null,u=io((()=>s().state.startedPlaying)),d=io((()=>s().state.currentModulesList)),h=io((()=>Ds(d).findIndex((e=>p(s().state.playingModulePosition,e.position))))),f=!1;function p(e,t){return e.itemIndex===t.itemIndex&&e.moduleIndex===t.moduleIndex}function m(e){const t=e.scrollLeft,n=e.scrollWidth-e.clientWidth;return 0===t?0:t>n?100:t/n*100}function v(e){var t;o()&&e.preventDefault();const{target:n}=e,u=m(n),f=(null===(t=Ds(d))||void 0===t?void 0:t.length)||1,v=100/(f-1||1),g=Math.round(u/v);let y=Math.min(g,f-1);const b=Ds(d)[y],k={itemIndex:s().state.activeItemIndex,moduleIndex:s().state.activeModuleIndex};if(!l){const e=i.children[Ds(h)],t=i.getBoundingClientRect(),n=e.getBoundingClientRect();r(n.x-t.x)}c&&clearTimeout(c),c=setTimeout((()=>{const e=m(n);Math.abs(e-g*v)<.25&&async function(){s().state.seeking&&(s().state.playerLoaded?s().state.currentItemsList[s().state.activeItemIndex].modules[s().state.activeModuleIndex].play():s().state.playingModulePosition=Ds(a),r(0))}()}),l?0:150),null!==l||p(b.position,k)?null!==l&&p(b.position,l)&&(l=null):(s().state.activeItemIndex=b.position.itemIndex,s().state.activeModuleIndex=b.position.moduleIndex),go(a,b.position)}function g(){f||(s().track("coverdisplay"),f=!0)}Ho((()=>{const{activeItemIndex:e,activeModuleIndex:t}=s().state;e===Ds(a).itemIndex&&t===Ds(a).moduleIndex||zs((()=>{var n,r;const o=Ds(d).findIndex((n=>{const{itemIndex:i,moduleIndex:r}=n.position;return e===i&&t===r}));l=(null===(n=Ds(d)[o])||void 0===n?void 0:n.position)||null;const s=null===(r=i)||void 0===r||null===(r=r.children)||void 0===r?void 0:r[o];if(!i||!s)return;const a=i.getBoundingClientRect(),c=s.getBoundingClientRect();let u=i.scrollLeft+(c.left-a.left);const h=Math.max(0,i.scrollWidth-i.clientWidth);u=Math.max(0,Math.min(h,u)),i.scrollTo({left:u,behavior:"auto"})}))})),Ho((()=>{Ds(u)&&zs((()=>{s().track("projectstartedplaying")}))}));var y=Xs(),b=Lo(y),k=e=>{var r=ku();va(r,23,(()=>Ds(d)),(e=>e.id),((e,i,r)=>{var a=bu(),l=Do(a),c=e=>{var t=gu();let o;Qo((e=>{o=Sa(t,1,"cover-image svelte-1rvgxfc",null,o,{hidden:Ds(u)&&Ds(r)===Ds(h),"force-show":Ds(i).showCover}),Ba(t,"src",e),Ba(t,"alt",Ds(i).name),Ba(t,"fetchpriority",0===Ds(r)?"high":"auto")}),[()=>s().getCoverUrl(Ds(i).cover,n[n.length-1])]),Us("load",t,(function(...e){var t;null===(t=0===Ds(r)?g:()=>{})||void 0===t||t.apply(this,e)})),function(e){if(!gi)return;e.removeAttribute("onload"),e.removeAttribute("onerror");const t=e.__e;void 0!==t&&(e.__e=void 0,queueMicrotask((()=>{e.isConnected&&e.dispatchEvent(t)})))}(t),Ys(e,t)};fa(l,(e=>{e(c)}));var d=Bo(l,2);!function(e,t){Li(t,!0),ka(e,vu);const n={color:"#e3e3e3",fadeTime:300,lineWidth:8},i=uu(t.gallery.interaction((e=>{const{direction:n}=e.detail;var i;if("left"===n)null===(i=t.gallery)||void 0===i||i.next(),t.onEvent("swipe",[-1,0]);else if("right"===n){var r;null===(r=t.gallery)||void 0===r||r.prev(),t.onEvent("swipe",[1,0])}}),{elementid:"swiper"}),(()=>({touchAction:"pan-y",plugins:t.debug?[fu(n)]:[]}))),r=hu((function(e){const{x:n,y:i}=e.detail;t.onEvent("click",{x:n,y:i})}),(()=>({touchAction:"pan-y"})));var o=Xs(),s=Lo(o),a=e=>{var t=pu();za(t,(()=>({...i,...r,class:"swiper"})),void 0,void 0,void 0,"svelte-1fv6njc"),Ys(e,t)},l=e=>{var t=mu();za(t,(()=>({...r,class:"swiper"})),void 0,void 0,void 0,"svelte-1fv6njc"),Ys(e,t)};fa(s,(e=>{t.isMobile?e(a):e(l,!1)})),Ys(e,o),Bi()}(d,{get gallery(){return s()},get debug(){return t.debug},get isMobile(){return o()},get onEvent(){return t.onEvent}});var f=Bo(d,2),p=e=>{var t=yu();!function(e,t,n){gi&&ki();var i=new ua(e);Jo((()=>{var e,r=null!==(e=t())&&void 0!==e?e:null;i.ensure(r,r&&(e=>n(e,r)))}),Kn)}(Do(t),(()=>Ds(i).Component),((e,t)=>{t(e,{get state(){return Ds(i).state},get gallery(){return s()},get isMobile(){return o()}})})),wi(t),Ys(e,t)};fa(f,(e=>{var t;null!==(t=Ds(i))&&void 0!==t&&t.Component&&e(p)})),wi(a),Ys(e,a)})),wi(r),Ga(r,(e=>i=e),(()=>i)),Us("scroll",r,v),Ys(e,r)};fa(b,(e=>{Ds(d)&&e(k)})),Ys(e,y),Bi()}const _u="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};let Tu;function Iu(){const e=_u&&_u.navigator&&(_u.navigator.userAgent||_u.navigator.platform||_u.navigator.vendor)||"";if(Tu&&Tu.ua===e)return Tu;const t=e.toLowerCase(),n=t.includes("android"),i=t.includes("iphone")||t.includes("ipad")||t.includes("ipod")||t.includes("ios"),r=n||i||t.includes("mobile");return Tu={ua:e,isMobile:r},Tu}var Eu,Su;"undefined"!=typeof window&&(window.addEventListener("pageshow",(function(e){e.persisted&&setTimeout((function(){window.location.reload()}),10)}),!1),null===(Eu=(Su=window).EkoAnalytics)||void 0===Eu||Eu.call(Su,"track","init"));var Au=Ks('<div class="paging-buttons svelte-1n46o8q"><!> <!></div>'),Nu=Ks('<div style="position: absolute; top: 0; left: 0; width: 100%;"></div>'),Mu=Ks("<!> <!>",1),Fu=Ks('<div class="player-container svelte-1n46o8q"><div class="player-div swipable svelte-1n46o8q"></div> <!> <!> <!> <!></div> <!>',1),Cu=Ks('<div class="eko-gallery-app svelte-1n46o8q"><!></div>');const Ou={hash:"svelte-1n46o8q",code:'.eko-gallery-app.svelte-1n46o8q {position:relative;width:100%;height:100%;display:flex;flex-direction:column;box-sizing:border-box;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;}.eko-gallery-app.svelte-1n46o8q:hover .paging-buttons:where(.svelte-1n46o8q) .nav-button {background-color:#FFFFFF;box-shadow:0 0 8px 0 rgba(0, 0, 0, 0.12);}.eko-gallery-app.svelte-1n46o8q * {box-sizing:border-box;touch-action:pan-y;font-family:"Human BBY Digital", sans-serif;}.player-container.svelte-1n46o8q {position:relative;flex:1;width:100%;pointer-events:none;overflow:hidden;border-radius:16px;display:flex;align-items:center;justify-content:center;}.player-div.svelte-1n46o8q {position:absolute;width:var(--videoWidth);height:var(--videoHeight);aspect-ratio:var(--videoAspect);}.swipable.svelte-1n46o8q {will-change:transform;transform:translate3d(var(--uiTranformX, 0), 0, 0);}.paging-buttons.svelte-1n46o8q {position:absolute;top:0;left:0;bottom:0;right:0;display:flex;justify-content:space-between;align-items:center;pointer-events:none;padding:0 12px;}.paging-buttons.svelte-1n46o8q .nav-button {transition:0.2s ease-in-out;box-shadow:none;}.paging-buttons.svelte-1n46o8q .nav-button img {opacity:0.6;}'};function Pu(e,t){Li(t,!0),ka(e,Ou);const n=Ka(t,"config",19,(()=>({}))),i=Ka(t,"forceMobile",3,!1),r=Ka(t,"videoAspectRatio",3,"unset"),o=Ka(t,"onGalleryReady",3,(()=>{})),s=Ka(t,"onEvent",3,(()=>{}));let a,l=!1,c=mo(new Fc(n())),u=mo(null),d=io((()=>i()||Iu().isMobile)),h=mo(0),f=mo(void 0),p=mo(!0),m=mo(_o({width:"100%",height:"100%"}));var v,g,y;function b(){const e={AssetsDeliveryService:{assetsDeliveryServiceUrl:Ds(c).urls.assetsDeliveryBase},Tracker:{tag:Ds(c).uuid}};go(u,new t.EkoPlayer(a,function(e,...t){function n(e){return"[object Object]"===Object.prototype.toString.call(e)}function i(e,t){if(Array.isArray(t)){Array.isArray(e)||(e=Array.isArray(e)?e.slice():[]);const r=Math.max(e.length,t.length);for(let o=0;o<r;o++){const r=e[o],s=t[o];null!=s&&(n(r)&&n(s)?e[o]=i({...r},s):Array.isArray(r)&&Array.isArray(s)?e[o]=i(r.slice(),s):n(s)?e[o]=i({},s):Array.isArray(s)?e[o]=i([],s):e[o]=s)}return e}if(n(t)){n(e)||(e={});for(const r of Object.keys(t)){const o=e[r],s=t[r];n(o)&&n(s)?e[r]=i({...o},s):Array.isArray(o)&&Array.isArray(s)?e[r]=i(o.slice(),s):n(s)?e[r]=i({},s):Array.isArray(s)?e[r]=i([],s):void 0!==s&&(e[r]=s)}return e}return t}for(const n of t)null!==n&&i(e,n);return e}({},t.playerOptions,e))),Ds(u).on("playing",(()=>{Ds(c).state.paused=!1})),Ds(u).on("pause",(()=>{Ds(c).state.paused=!0})),Ds(u).once("playing",(()=>{Ds(c).state.startedPlaying=!0,s()("galleryloaded")}))}function k(e){var t;null===(t=Ds(c))||void 0===t||t.selectItem(e)}function w(){var e;null===(e=Ds(c))||void 0===e||e.next()}function x(){var e;null===(e=Ds(c))||void 0===e||e.prev()}function _(){Ds(u).paused?Ds(u).play():Ds(u).pause()}function T(){return`--uiTranformX: ${Ds(h)}px;--videoAspect: ${r()};--videoWidth: ${Ds(m).width};--videoHeight: ${Ds(m).height};`}v="state",g=()=>Ds(c).state,zi("setContext").set(v,g),y=()=>(o()(Ds(c).public),n()&&t.EkoPlayer&&(b(),Ds(c).start(Ds(u))),()=>{var e;null===(e=Ds(u))||void 0===e||e.dispose(),Ds(c).dispose()}),null===Mi&&di("onMount"),Ho((()=>{const e=zs(y);if("function"==typeof e)return e})),Ho((()=>{n()&&t.EkoPlayer&&(l?zs((()=>{var e;Ds(c).dispose(),go(c,new Fc(n())),null===(e=Ds(u))||void 0===e||e.dispose(),go(p,!1),Rs().then((()=>(go(p,!0),Rs()))).then((()=>{o()(Ds(c).public),b(),Ds(c).start(Ds(u))}))})):l=!0)})),Ho((()=>{Ds(f)&&Ds(u)&&Ds(u).loadDebugOverlay({containerElement:Ds(f)})})),Ho((()=>{if("unset"!==r()&&r().includes("/")){const[e,t]=r().split("/").map((e=>Number(e)));isNaN(e)||isNaN(t)||go(m,e>t?{width:"100%",height:"auto"}:{width:"auto",height:"100%"},!0)}else go(m,{width:"100%",height:"100%"},!0)}));var I=Cu(),E=Do(I),S=e=>{var n=Fu(),i=Lo(n),r=Do(i);Ga(r,(e=>a=e),(()=>a));var o=Bo(r,2);xu(o,{get isMobile(){return Ds(d)},get gallery(){return Ds(c)},get debug(){return t.debug},get onEvent(){return s()},get scrollOffset(){return Ds(h)},set scrollOffset(e){go(h,e,!0)}});var l=Bo(o,2),u=e=>{var t=Au(),n=Do(t);Uc(n,{type:"prev",onClick:x}),Uc(Bo(n,2),{type:"next",onClick:w}),wi(t),Ys(e,t)};fa(l,(e=>{Ds(d)||t.hideNav||e(u)}));var p=Bo(l,2),m=e=>{Hc(e,{get gallery(){return Ds(c)}})};fa(p,(e=>{var t;!Ds(d)&&(null===(t=Ds(c).state.currentItem)||void 0===t?void 0:t.modules.length)>1&&e(m)}));var v=Bo(p,2),g=e=>{var n=Mu(),i=Lo(n);!function(e,t){Li(t,!0),ka(e,Zc);const n=Di("state");var i=Jc();i.__click=function(...e){var n;null===(n=t.onPauseClick)||void 0===n||n.apply(this,e)};var r=Do(i),o=e=>{var t=Yc();Qo((()=>Ba(t,"src",Kc))),Ys(e,t)},s=e=>{var t=Qc();Qo((()=>Ba(t,"src",Xc))),Ys(e,t)};fa(r,(e=>{n().paused?e(o):e(s,!1)})),wi(i),Qo((e=>Ba(i,"aria-label",e)),[()=>n().paused?"Play":"Pause"]),Ys(e,i),Bi()}(i,{onPauseClick:_});var r=Bo(i,2),o=e=>{var t=Nu();Ga(t,(e=>go(f,e)),(()=>Ds(f))),Ys(e,t)};fa(r,(e=>{t.debug&&e(o)})),Ys(e,n)};fa(v,(e=>{Ds(c).state.startedPlaying&&e(g)})),wi(i);var y=Bo(i,2),b=e=>{!function(e,t){Li(t,!0),ka(e,zc);let n=Ka(t,"onNavItemClick",3,(()=>{}));const i=Di("state");var r=Bc(),o=Do(r);va(o,23,(()=>i().currentItemsList),(e=>e.id),((e,t,r)=>{var o=Lc();let s;o.__click=()=>n()(Ds(r));var a=Do(o),l=Do(a,!0);wi(a),wi(o),Qo((e=>{s=Sa(o,1,"nav-button svelte-er27y2",null,s,e),ia(l,Ds(t).name)}),[()=>({selected:Ds(r)===i().activeItemIndex})]),Ys(e,o)})),wi(o),wi(r),Ys(e,r),Bi()}(e,{onNavItemClick:k})};fa(y,(e=>{t.hideNav||e(b)})),Qo((e=>Na(i,e)),[T]),Ys(e,n)};fa(E,(e=>{n()&&Ds(p)&&e(S)})),wi(I),Ys(e,I),Bi()}function Ru(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Du,Lu,Bu,zu,Wu={exports:{}},$u=Ru((Du||(Du=1,Bu=Wu.exports,zu=function(){var e=function(){},t="undefined",n=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],r={},o=null;function s(e,t){var n=e[t];if("function"==typeof n.bind)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch(t){return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function a(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function l(){for(var n=this.getLevel(),r=0;r<i.length;r++){var o=i[r];this[o]=r<n?e:this.methodFactory(o,n,this.name)}if(this.log=this.debug,typeof console===t&&n<this.levels.SILENT)return"No console available for logging"}function c(e){return function(){typeof console!==t&&(l.call(this),this[e].apply(this,arguments))}}function u(i,r,o){return"debug"===(l=i)&&(l="log"),typeof console!==t&&("trace"===l&&n?a:void 0!==console[l]?s(console,l):void 0!==console.log?s(console,"log"):e)||c.apply(this,arguments);var l}function d(e,n){var s,a,c,d=this,h="loglevel";function f(){var e;if(typeof window!==t&&h){try{e=window.localStorage[h]}catch(e){}if(typeof e===t)try{var n=window.document.cookie,i=encodeURIComponent(h),r=n.indexOf(i+"=");-1!==r&&(e=/^([^;]+)/.exec(n.slice(r+i.length+1))[1])}catch(e){}return void 0===d.levels[e]&&(e=void 0),e}}function p(e){var t=e;if("string"==typeof t&&void 0!==d.levels[t.toUpperCase()]&&(t=d.levels[t.toUpperCase()]),"number"==typeof t&&t>=0&&t<=d.levels.SILENT)return t;throw new TypeError("log.setLevel() called with invalid level: "+e)}"string"==typeof e?h+=":"+e:"symbol"==typeof e&&(h=void 0),d.name=e,d.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},d.methodFactory=n||u,d.getLevel=function(){return null!=c?c:null!=a?a:s},d.setLevel=function(e,n){return c=p(e),!1!==n&&function(e){var n=(i[e]||"silent").toUpperCase();if(typeof window!==t&&h){try{return void(window.localStorage[h]=n)}catch(e){}try{window.document.cookie=encodeURIComponent(h)+"="+n+";"}catch(e){}}}(c),l.call(d)},d.setDefaultLevel=function(e){a=p(e),f()||d.setLevel(e,!1)},d.resetLevel=function(){c=null,function(){if(typeof window!==t&&h){try{window.localStorage.removeItem(h)}catch(e){}try{window.document.cookie=encodeURIComponent(h)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(e){}}}(),l.call(d)},d.enableAll=function(e){d.setLevel(d.levels.TRACE,e)},d.disableAll=function(e){d.setLevel(d.levels.SILENT,e)},d.rebuild=function(){if(o!==d&&(s=p(o.getLevel())),l.call(d),o===d)for(var e in r)r[e].rebuild()},s=p(o?o.getLevel():"WARN");var m=f();null!=m&&(c=p(m)),l.call(d)}(o=new d).getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=r[e];return t||(t=r[e]=new d(e,o.methodFactory)),t};var h=typeof window!==t?window.log:void 0;return o.noConflict=function(){return typeof window!==t&&window.log===o&&(window.log=h),o},o.getLoggers=function(){return r},o.default=o,o},(Lu=Wu).exports?Lu.exports=zu():Bu.log=zu()),Wu.exports));const ju=()=>{},Uu=["trace","log","debug","info","warn","error","getLevel","setLevel"],qu=["trace","debug","info","warn","error","silent"],Vu={TRACE:"color: white; background-color: magenta;",DEBUG:"color: black; background-color: turquoise;",INFO:"color: white; background-color: green;",WARN:"color: black; background-color: yellow;",ERROR:"color: white; background-color: red;"},Gu="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global;let Hu={level:"trace",appName:""},Ku=[];const Xu="object"==typeof Gu&&Gu.performance&&"function"==typeof Gu.performance.now?Gu.performance.now.bind(Gu.performance):Date.now.bind(Date),Yu=e=>e&&"string"==typeof e?e.toLowerCase().trim():"",Qu=(()=>{try{const e=new URLSearchParams(document.location.search),t=[].concat(e.getAll("log")).concat(e.getAll("ekolog")).concat(e.getAll("ekologger")).join(",").split(",");if(0===t.length)return{};let n={};return t.forEach((e=>{const[t,i]=e.split(":");n[Yu(t)]=Yu(i)||"trace"})),n}catch(e){return{}}})(),Ju=(e,t="")=>{const n=Yu(e),i=$u.getLogger(n);if(i.__ekologger)return i.__ekologger;t||Qu[n]||Qu["*"]||(i.__noExplicitLevel=!0);const r=i.methodFactory;i.methodFactory=(t,n,i)=>{const o=r(t,n,i),s=t.toUpperCase();return(...t)=>{o(`[${((e,t=3)=>(Xu()/1e3).toFixed(t))()}] %c[${s}] ${Hu.appName?`[${Hu.appName}] `:""}[${e}]`,Vu[s],...t)}},t=Qu[n]||Qu["*"]||t||Hu.level,i.setLevel(t,!1);const o=(...e)=>i.log(...e);return Uu.forEach((e=>{o[e]=(...t)=>(Ku.forEach((n=>{n[e](...t)})),i[e](...t))})),i.__ekologger=o,o};Ju.setDefaults=({appName:e="",level:t})=>{e&&"string"==typeof e&&(Hu.appName=e),(t=Yu(t))&&qu.includes(t)&&(Hu.level=t,Object.values($u.getLoggers()).filter((e=>e.__noExplicitLevel)).forEach((e=>e.setLevel(Hu.level,!1))))},Ju.installDriver=e=>{const t={...Uu.reduce(((t,n)=>(t[n]="function"==typeof(null==e?void 0:e[n])?e[n]:ju,t)),{})};Ku.push(t)};let Zu=class{#T=new Map;on(e,t){if("function"!=typeof t)return this;const n=this.#T.get(e)||new Set;return n.add(t),this.#T.set(e,n),this}once(e,t){if("function"!=typeof t)return this;const n=(...i)=>(this.off(e,n),t(...i));return this.on(e,n)}off(e,t){if(!e)return this.#T.clear(),this;const n=this.#T.get(e);return n?t?(n.delete(t),0===n.size&&this.#T.delete(e),this):(this.#T.delete(e),this):this}trigger(e,...t){const n=this.#T.get(e);return n?(n.forEach((e=>e(...t))),this):this}};function ed(e){return"[object Object]"===Object.prototype.toString.call(e)}function td(e,...t){const n=ed(e)?{...e}:{};return t.forEach((e=>{ed(e)&&Object.keys(e).forEach((t=>{const i=e[t],r=n[t];ed(i)&&ed(r)?n[t]=td(r,i):Array.isArray(i)?n[t]=i.slice():n[t]=i}))})),n}function nd(e){if("string"==typeof e)return`'${e}'`;if(Array.isArray(e))return`[${e.map((e=>nd(e))).join(", ")}]`;if(ed(e))try{return JSON.stringify(e)}catch(e){return"[object Object]"}return null===e?"null":void 0===e?"undefined":String(e)}function id(e){return Array.from(e).map((e=>nd(e))).join(", ")}var rd=new WeakSet;let od=class extends Zu{constructor(...e){super(),O(this,rd);const t=e.length?e[e.length-1]:void 0,n=this.name;if(!n||"string"!=typeof n)throw new Error("Extending classes must implement get name() returning a string.");this.log=Ju(n,this.loglevel);const i=ed(this.defaults)?this.defaults:{},r=ed(t)&&ed(t[n])?t[n]:{};this.settings=td({},i,r),A(rd,this,sd).call(this),A(rd,this,ad).call(this)}get name(){throw new Error("BaseModuleClass requires a name getter.")}get loglevel(){return"warn"}get defaults(){return{}}get methodsExcludedFromAutoLog(){return new Set(["constructor","on","off","once","trigger","#wrapMethodsForLogging"])}dispose(){this._disposed||(this._disposed=!0,"function"==typeof this._lifecycleCleanup&&(this._lifecycleCleanup(),this._lifecycleCleanup=null),"function"==typeof this.onDispose&&this.onDispose())}onDispose(){}};function sd(){const e=new Set,t=this.methodsExcludedFromAutoLog;let n=Object.getPrototypeOf(this);for(;n&&n!==Object.prototype;){const i=Object.getOwnPropertyNames(n);for(let r=0;r<i.length;r+=1){const o=i[r];if("constructor"===o||o.startsWith("#"))continue;if(e.has(o))continue;const s=Object.getOwnPropertyDescriptor(n,o);if(!s||"function"!=typeof s.value)continue;const a=s.value.bind(this),l=!t.has(o);this[o]=l?(...e)=>(this.log&&"function"==typeof this.log.debug&&this.log.debug(`${this.name}.${o}(${id(e)})`),a(...e)):a,e.add(o)}n=Object.getPrototypeOf(n)}}function ad(){if("undefined"==typeof window||"function"!=typeof window.addEventListener)return;const e=()=>{try{"function"==typeof this.dispose&&this.dispose()}catch(e){this.log&&"function"==typeof this.log.error&&this.log.error("dispose failed",e)}};window.addEventListener("pagehide",e),window.addEventListener("beforeunload",e),this._lifecycleCleanup=()=>{window.removeEventListener("pagehide",e),window.removeEventListener("beforeunload",e)}}const ld="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};function cd(e){return Boolean(e)&&"object"==typeof e&&1===e.nodeType&&"function"==typeof e.appendChild}let ud=class extends od{#I;#E;#S;get defaults(){return{style:{width:"100%",height:"100%"},contextAttributes:{alpha:!1,depth:!1,stencil:!1,antialias:!1,preserveDrawingBuffer:!1,powerPreference:"low-power"}}}constructor(...e){var t,n;super(...e);const[i]=e,r=function(e,t=(null==ld?void 0:ld.document)){if(cd(e))return e;const n="string"==typeof e?e:null;if(!n||!t||"function"!=typeof t.querySelector)return null;const i=t.querySelector(n);return cd(i)?i:null}(i);if(!r)throw new Error("Canvas requires a valid mount target (HTMLElement or selector string).");this.#I=r;const o=null==ld?void 0:ld.document;if(!o||"function"!=typeof o.createElement)throw new Error("Canvas requires document.createElement.");var s,a;this.#E=o.createElement("canvas"),s=this.#E,a=null===(t=this.settings)||void 0===t?void 0:t.style,s&&a&&"object"==typeof a&&!Array.isArray(a)&&Object.keys(a).forEach((e=>{const t=a[e];null!=t&&(s.style[e]=String(t))})),this.#I.appendChild(this.#E);const l=null===(n=this.settings)||void 0===n?void 0:n.contextAttributes,c=l&&"object"==typeof l&&!Array.isArray(l)?l:void 0;if(this.#S=this.#E.getContext("webgl2",c),!this.#S)throw new Error("Canvas WebGL2 context is not available.")}get name(){return"Canvas"}get element(){return this.#E}get gl(){return this.#S}onDispose(){this.#E&&this.#E.parentNode&&this.#E.parentNode.removeChild(this.#E),this.#S=null,this.#E=null,this.#I=null}};var dd=new WeakMap,hd=new WeakMap,fd=new WeakMap,pd=new WeakMap,md=new WeakMap,vd=new WeakMap,gd=new WeakSet;let yd=class extends od{get name(){return"ContainerSize"}get containerWidth(){return M(hd,this)}get containerHeight(){return M(fd,this)}get width(){return M(hd,this)}get height(){return M(fd,this)}constructor(...e){super(...e),O(this,gd),F(this,dd,void 0),F(this,hd,0),F(this,fd,0),F(this,pd,null),F(this,md,null),F(this,vd,null);const[t]=e;var n;C(dd,this,(n=t)&&n.element&&cd(n.element)?n.element:cd(n)?n:null),M(dd,this)&&(A(gd,this,kd).call(this,!0),A(gd,this,bd).call(this))}onDispose(){M(pd,this)&&"function"==typeof M(pd,this).disconnect&&M(pd,this).disconnect(),C(pd,this,null),M(vd,this)&&"function"==typeof(null==ld?void 0:ld.removeEventListener)&&ld.removeEventListener("resize",M(vd,this)),C(vd,this,null),M(md,this)&&((null==ld?void 0:ld.clearInterval)||clearInterval)(M(md,this)),C(md,this,null),C(dd,this,null)}};function bd(){if(!M(dd,this))return;const e=null==ld?void 0:ld.ResizeObserver;if("function"==typeof e)return C(pd,this,new e((()=>A(gd,this,kd).call(this)))),void M(pd,this).observe(M(dd,this));C(vd,this,(()=>A(gd,this,kd).call(this))),"function"==typeof(null==ld?void 0:ld.addEventListener)&&ld.addEventListener("resize",M(vd,this));const t=(null==ld?void 0:ld.setInterval)||setInterval;C(md,this,t((()=>A(gd,this,kd).call(this)),250))}function kd(e=!1){if(!M(dd,this))return;const{width:t,height:n}=function(e){const t=Number(null==e?void 0:e.clientWidth),n=Number(null==e?void 0:e.clientHeight);return{width:Number.isFinite(t)&&t>0?Math.round(t):0,height:Number.isFinite(n)&&n>0?Math.round(n):0}}(M(dd,this));(e||t!==M(hd,this)||n!==M(fd,this))&&(C(hd,this,t),C(fd,this,n),this.trigger("containerresize",{width:t,height:n}))}var wd={VIDEO_SOURCE_PREFIX:"__SRC_VID:",TEXTURE_SOURCE_PREFIX:"__SRC_TEXTURE:",PREVIOUS_OUTPUT_PREFIX:"__PREVIOUS:",SAVED_FRAME_PREFIX:"__SAVED_FRAME:",SYSTEM_NODES:{FILTERS:{RENDER_TO_CANVAS:"__default"},TAGS:{ATOM:"atom",FILTER:"filter",COMPOSITE_FILTER:"composite",TRANSITION_FILTER:"transition"}},MESSAGES:{UPDATE_OPTIONS:"update_options"}};let xd=class{constructor(e,t){this.canvasSource=e,this.startRendering=t,this.gl=null,this.glOptions=null}init(e,t,n){this.glOptions=n||{};const i=this.initCanvas(this.canvasSource,e,t);return this.initWebgl(i,this.glOptions)}initCanvas(){throw new Error("implement on concrete class")}getContextConfig(e={}){if(!e||"object"!=typeof e)return{contextType:"webgl",contextAttributes:void 0};const{contextType:t,contextAttributes:n,__shaderGraph:i,...r}=e;return{contextType:t||"webgl",contextAttributes:Object.prototype.hasOwnProperty.call(e,"contextAttributes")?n:r}}initWebgl(e,t={}){const{contextType:n,contextAttributes:i}=this.getContextConfig(t),r=e.getContext(n,i);if(!r)throw new Error(`Browser doesn't support ${n}`);return r.enable(r.BLEND),r.disable(r.DEPTH_TEST),r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),r}isStartRendering(){return this.startRendering}};var _d,Td={exports:{}},Id=(_d||(_d=1,function(e){var t=Object.prototype.hasOwnProperty,n="~";function i(){}function r(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,i,o,s){if("function"!=typeof i)throw new TypeError("The listener must be a function");var a=new r(i,o||e,s),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function a(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),a.prototype.eventNames=function(){var e,i,r=[];if(0===this._eventsCount)return r;for(i in e=this._events)t.call(e,i)&&r.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},a.prototype.listeners=function(e){var t=n?n+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,o=i.length,s=new Array(o);r<o;r++)s[r]=i[r].fn;return s},a.prototype.listenerCount=function(e){var t=n?n+e:e,i=this._events[t];return i?i.fn?1:i.length:0},a.prototype.emit=function(e,t,i,r,o,s){var a=n?n+e:e;if(!this._events[a])return!1;var l,c,u=this._events[a],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,i),!0;case 4:return u.fn.call(u.context,t,i,r),!0;case 5:return u.fn.call(u.context,t,i,r,o),!0;case 6:return u.fn.call(u.context,t,i,r,o,s),!0}for(c=1,l=new Array(d-1);c<d;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var h,f=u.length;for(c=0;c<f;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),d){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,i);break;case 4:u[c].fn.call(u[c].context,t,i,r);break;default:if(!l)for(h=1,l=new Array(d-1);h<d;h++)l[h-1]=arguments[h];u[c].fn.apply(u[c].context,l)}}return!0},a.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},a.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},a.prototype.removeListener=function(e,t,i,r){var o=n?n+e:e;if(!this._events[o])return this;if(!t)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==t||r&&!a.once||i&&a.context!==i||s(this,o);else{for(var l=0,c=[],u=a.length;l<u;l++)(a[l].fn!==t||r&&!a[l].once||i&&a[l].context!==i)&&c.push(a[l]);c.length?this._events[o]=1===c.length?c[0]:c:s(this,o)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,e.exports=a}(Td)),Td.exports),Ed=Ru(Id);let Sd=class extends xd{constructor(e){super(e,!0),this.setSrcVidTracksFn=null,this.shouldUpdateTexture=!0,this.onPlayerSeeking=this.onPlayerSeeking.bind(this),this.onPlayerSeeked=this.onPlayerSeeked.bind(this),this.onPlayerNodeStart=this.onPlayerNodeStart.bind(this),this.oncePlayerPlaying=this.oncePlayerPlaying.bind(this);const t=new Ed;this.on=t.on.bind(t),this.off=t.off.bind(t),this.once=t.once.bind(t),this.trigger=t.emit.bind(t)}onPlayerSeeking(){this.shouldUpdateTexture=!1}onPlayerSeeked(){this.shouldUpdateTexture=!0}onPlayerNodeStart(){this.shouldUpdateTexture=!0,"function"==typeof this.player.canvas.drawFrame&&this.player.canvas.drawFrame(),this.trigger("forcerender")}oncePlayerPlaying(){this.onPlayerNodeStart()}addPlayerListeners(){this.player&&(this.player.on("seeking",this.onPlayerSeeking),this.player.on("seeked",this.onPlayerSeeked),this.player.on("nodestart",this.onPlayerNodeStart),this.player.once("playing",this.oncePlayerPlaying))}removePlayerListeners(){this.player&&(this.player.off("seeking",this.onPlayerSeeking),this.player.off("seeked",this.onPlayerSeeked),this.player.off("nodestart",this.onPlayerNodeStart),this.player.off("playing",this.oncePlayerPlaying))}initCanvas(e,t,n){var i;this.player=e,this.setSrcVidTracksFn=t;const{contextType:r,contextAttributes:o}=this.getContextConfig(this.glOptions),s=!1!==(null===(i=this.glOptions)||void 0===i||null===(i=i.__shaderGraph)||void 0===i?void 0:i.forwardContextAttributes);const a={contextType:r};s&&void 0!==o&&(a.contextAttributes=o),e.initPlugin("canvas",a);const l={drawFrame:this.canvasDrawFrameFn.bind(this),resize:n,contextType:r,offscreenVideoCanvasEnabled:!1,viewportModeEnabled:!0,fps:0};return s&&void 0!==o&&(l.contextAttributes=o),e.canvas.init(l),e.paused&&0===e.currentTime&&(this.shouldUpdateTexture=!1),this.addPlayerListeners(),e.canvas.canvas}canvasDrawFrameFn(e,t,n){var i;this.setSrcVidTracksFn&&this.shouldUpdateTexture&&e&&t&&n&&(n.videoWidth||n.displayWidth)&&(n.videoHeight||n.displayHeight)&&(!(i=n)||"boolean"!=typeof i.isDataLoaded||i&&i.isDataLoaded&&(void 0===i.isFrameTextureReady||i.isFrameTextureReady))&&this.setSrcVidTracksFn(n)}async recover(){if(this.player&&this.player.paused)return new Promise((e=>{this.player.once("seeked",(()=>{this.shouldUpdateTexture=!0,e()})),this.player.currentTime=this.player.currentTime}))}dispose(){this.player&&(this.player.canvas&&"function"==typeof this.player.canvas.dispose&&this.player.canvas.dispose(),this.removePlayerListeners(),this.player=null)}},Ad=class extends xd{constructor(e){super(e,!1)}initCanvas(e,t){const n=function(){const e=document.querySelector("video");e&&e.videoHeight&&t(e),requestAnimationFrame(n)};return requestAnimationFrame(n),document.getElementById(e)}},Nd=class extends xd{constructor(e){super(e,!1)}initCanvas({src:e,dest:t},n,i){const r="string"==typeof t?document.querySelector(t):t,o="undefined"!=typeof HTMLVideoElement&&e instanceof HTMLVideoElement,s=()=>{this.isDisposed||(e&&e.videoHeight&&n(e),requestAnimationFrame(s))};return o?requestAnimationFrame(s):"function"==typeof e?e(n,i):n(e),r}dispose(){this.isDisposed=!0}};var Md=function(e){let t;return t="string"==typeof e?new Ad(e):e&&e.src&&e.dest?new Nd(e):new Sd(e),t};function Fd(e){return Array.isArray(e)||(e=[e]),e}let Cd=class{constructor(e){this.store=e?{...e.get()}:{}}reset(){this.store={}}get(e){if(!e)return this.store;const t=(e=Fd(e)).reduce(((e,t)=>{const n=this.store[t];return e.push(n),e}),[]);return 1===t.length?t[0]:t}set(e,t){if(e=Fd(e),t=Fd(t),e.length!==t.length)throw new Error(`cant set values ${t} to keys ${e}, length did not match`);e.forEach(((e,n)=>{this.store[e]=t[n]}))}},Od=class{constructor(e,t,n,i){this.gl=i.gl,this.unit=e,this.bindPoint=t,this.height=1080,this.width=1920,this.textureObject=n.object,this.textureObjectInfo=n,this.isStatic=!1,n.needRefresh&&this.setParameters()}getUnit(){return this.unit}getObject(){return this.textureObject}bind(){this.gl.bindTexture(this.bindPoint,this.textureObject)}fill(){throw new Error("impl in concrete class")}setParameters(){this.bind(),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR)}active(){this.gl.activeTexture(this.gl.TEXTURE0+this.getUnit())}beforeUse(){this.active(),this.bind()}dispose(){this.gl.deleteTexture(this.textureObject)}setHeight(e){this.height=e}setWidth(e){this.width=e}getHeight(){if(!this.height)throw new Error(`texture ${this.unit} no height init `);return this.height}getWidth(){if(!this.width)throw new Error(`texture ${this.unit} no width init `);return this.width}};const Pd=Ju("frame","warn");let Rd=!1;if("undefined"!=typeof window&&window.InterludePlayer){let e=window.InterludePlayer.environment,t=e.isAffectedBySafari17SeekBug,n=e.ua.includes("WMT1H")&&e.ua.includes("iOS/17");Rd=t||n}function Dd(e,t){const n=e.gl;var i;n.texImage2D(e.bindPoint,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t),e.__hasAllocated=!0,i=e,Number.isFinite(i.width)&&Number.isFinite(i.height)&&(i.actualWidth=i.width,i.actualHeight=i.height,i.textureObjectInfo&&(i.textureObjectInfo.allocatedWidth=i.width,i.textureObjectInfo.allocatedHeight=i.height))}let Ld=class extends Od{fill(e){if(Rd&&(e.paused||"undefined"!=typeof document&&"hidden"===document.visibilityState))return;if(e.__closed)return;this.bind();const t=function(e,t){let n=!e.__hasAllocated;return t?(t.width===e.width&&t.height===e.height||(n=!0),e.width=t.width,e.height=t.height,n):n}(this,function(e){if(!e)return;const t=[[e.displayWidth,e.displayHeight],[e.codedWidth,e.codedHeight],[e.videoWidth,e.videoHeight],[e.naturalWidth,e.naturalHeight],[e.width,e.height]];for(let e=0;e<t.length;e+=1){const[n,i]=t[e],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}(e)),n=performance.now();!function(e,t,n){const i=e.gl,r=function(e){if("undefined"!=typeof HTMLVideoElement&&e instanceof HTMLVideoElement)return!0;const t="object"==typeof window?window:"object"==typeof self?self:null,n=t&&t.VideoFrame;return"function"==typeof n&&e instanceof n}(t);r&&(e.__useSubImage=!1),n||!1===e.__useSubImage||r?Dd(e,t):(i.texSubImage2D(e.bindPoint,0,0,0,i.RGBA,i.UNSIGNED_BYTE,t),void 0===e.__useSubImage&&(i.getError()!==i.NO_ERROR?(e.__useSubImage=!1,Dd(e,t)):e.__useSubImage=!0))}(this,e,t);const i=(performance.now()-n)/1e3;i>=.1&&Pd.warn(`[fill] texImage2D() took ${i.toFixed(3)} seconds to execute.`),"function"==typeof e.close&&!0!==e.__keepOpen&&(e.close(),e.__closed=!0)}},Bd=class extends Od{constructor(e,t,n){super(...arguments),n.needRefresh&&(this.fill(null),n.needRefresh=!1)}fill(e){if(this.bind(),e&&e.tagName&&"IMG"===e.tagName){const t=Number(e.naturalWidth||e.width),n=Number(e.naturalHeight||e.height);this.gl.texImage2D(this.bindPoint,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),Number.isFinite(t)&&Number.isFinite(n)&&(this.actualWidth=t,this.actualHeight=n,this.textureObjectInfo&&(this.textureObjectInfo.allocatedWidth=t,this.textureObjectInfo.allocatedHeight=n))}else{const t=this.gl.canvas.width,n=this.gl.canvas.height;this.gl.texImage2D(this.bindPoint,0,this.gl.RGBA,t,n,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),Number.isFinite(t)&&Number.isFinite(n)&&(this.actualWidth=t,this.actualHeight=n,this.textureObjectInfo&&(this.textureObjectInfo.allocatedWidth=t,this.textureObjectInfo.allocatedHeight=n))}}};var zd=function(e,t,n,i,r){let o;switch(e){case"frame":o=new Ld(t,n,i,r);break;case"pixel":o=new Bd(t,n,i,r);break;default:throw new Error(`cant recognize type ${e}`)}return o};let Wd=class{constructor(e){return this.gl=e.gl,this.textureObjectPool=[],this.textureUnitsPool=new Set(Array(20).keys()),this.activeTextures=e.activeTextures instanceof Set?e.activeTextures:new Set,{createTexture:this.createTexture.bind(this),releaseTexture:this.releaseTexture.bind(this),refreshTextureObjects:this.refreshTextureObjects.bind(this),refreshActiveTextures:this.refreshActiveTextures.bind(this)}}getTextureObject(){return this.textureObjectPool.pop()||{object:this.gl.createTexture(),needRefresh:!0}}getTextureUnit(){const e=this.textureUnitsPool.values(),t=Math.min.apply(null,[...e]);return this.textureUnitsPool.delete(t),t}createTexture(e){const t=e&&e.type||{},n=this.gl.TEXTURE_2D,i=this.getTextureUnit(),r=this.getTextureObject(),o=zd(t,i,n,r,{gl:this.gl});return this.activeTextures.add(o),o}releaseTexture(e){this.textureUnitsPool.has(e.getUnit())||(this.textureObjectPool.push({object:e.getObject(),needRefresh:!1}),this.textureUnitsPool.add(e.getUnit())),this.activeTextures.delete(e)}refreshTextureObjects(){this.textureObjectPool.forEach((e=>{e.needRefresh=!0}))}refreshActiveTextures(){const e=new Set;this.activeTextures.forEach((t=>{if(!t||"function"!=typeof t.getUnit)return;e.add(t.getUnit());const n={object:this.gl.createTexture(),needRefresh:!0};t.gl=this.gl,t.textureObjectInfo=n,t.textureObject=n.object,t.__hasAllocated=!1,t.__useSubImage=void 0,t.actualWidth=null,t.actualHeight=null,"function"==typeof t.setParameters&&t.setParameters()})),this.textureObjectPool=[],this.textureUnitsPool=new Set(Array(20).keys()),e.forEach((e=>{this.textureUnitsPool.delete(e)}))}};const $d=wd.VIDEO_SOURCE_PREFIX,jd=wd.TEXTURE_SOURCE_PREFIX,Ud=wd.PREVIOUS_OUTPUT_PREFIX,qd=wd.SAVED_FRAME_PREFIX;function Vd(e,t,n){e.set(`${$d}${n}`,t)}function Gd(e,t,n){e.set(`${Ud}${n}`,t)}function Hd(e,t,n){e.set(`${qd}${n}`,t)}let Kd=class{constructor(e){return this.gl=e.gl,this.glSource=e.glSource,this.textureManager=e.textureManager,this.capturedFramesManager=e.capturedFramesManager,{setVideoSources:this.setVideoSources.bind(this),setTextureSource:this.setTextureSource.bind(this),getInput:this.getInput.bind(this),getPrevOutput:this.getPrevOutput.bind(this),setOutputs:this.setOutputs.bind(this),disposeTextures:this.disposeTextures.bind(this),disposeAllStore:this.disposeAllStore.bind(this)}}setVideoSources(e){for(const[t,n]of Object.entries(this.capturedFramesManager.getCurrentFrames()))Vd(e,n,t),Gd(e,n,t);for(const[t,n]of Object.entries(this.capturedFramesManager.getSavedFrames()))Hd(e,n,t)}setTextureSource(e,t,n){e.set(`${jd}${n}`,t)}getInput(e,t){return e.get(t)}getPrevOutput(e,t){return t=Number.isInteger(t)?t:0,e.get(`${Ud}${t}`)}setOutputs(e,t=[],n=[]){if(Array.isArray(n)||(n=[n]),t.length>n.length)throw new Error(`output ids ${t.length} is bigger then supplied outputs ${n.length}`);n.forEach(((t,n)=>{Gd(e,t,n)})),t.forEach(((t,i)=>{e.set(t,n[i])}))}disposeTextures(e,t){const n=t.getUnit();e.forEach((e=>{const t=e.getUnit();this.capturedFramesManager.isReservedUnit(t)||n===t||this.textureManager.releaseTexture(e)}))}disposeAllStore(e){const t=new Set;Object.values(e.get()).forEach((e=>{const n=e.getUnit();this.capturedFramesManager.isReservedUnit(n)||t.has(n)||e.isStatic||(this.textureManager.releaseTexture(e),t.add(n))}))}},Xd=class{constructor(e){this.context=e}bind(){throw new Error("impl in concrete")}},Yd=100,Qd=100;function Jd(e,t){Yd=e,Qd=t}let Zd=class extends Xd{bind(e){var t,n;this.context.gl.bindFramebuffer(this.context.gl.FRAMEBUFFER,null);const i=null===(t=this.context.gl)||void 0===t||null===(t=t.canvas)||void 0===t?void 0:t.width,r=null===(n=this.context.gl)||void 0===n||null===(n=n.canvas)||void 0===n?void 0:n.height;return Number.isFinite(i)&&Number.isFinite(r)&&i>0&&r>0&&(this.context.gl.viewport(0,0,i,r),Jd(i,r)),e}},eh=class extends Xd{bind(e){Array.isArray(e)||(e=[e]),this.context.gl.bindFramebuffer(this.context.gl.FRAMEBUFFER,this.context.frameBufferObject);const t=this.context.textureManager.createTexture({type:"pixel"}),n=this.context.gl.COLOR_ATTACHMENT0;if(this.context.gl.framebufferTexture2D(this.context.gl.FRAMEBUFFER,n,this.context.gl.TEXTURE_2D,t.textureObject,0),this.context.gl.clear(this.context.gl.COLOR_BUFFER_BIT),!1!==this.context.useCanvasSizedFilterTargets){var i,r;const e=null===(i=this.context.gl)||void 0===i||null===(i=i.canvas)||void 0===i?void 0:i.width,n=null===(r=this.context.gl)||void 0===r||null===(r=r.canvas)||void 0===r?void 0:r.height;Number.isFinite(e)&&e>0&&t.setWidth(e),Number.isFinite(n)&&n>0&&t.setHeight(n);const o=t.textureObjectInfo,s=null==o?void 0:o.allocatedWidth,a=null==o?void 0:o.allocatedHeight;Number.isFinite(e)&&Number.isFinite(n)&&(s!==e||a!==n)&&"function"==typeof t.fill&&t.fill(null)}else e[0]&&(t.setHeight(e[0].getHeight()),t.setWidth(e[0].getWidth()));return t}},th=class{constructor(e){this.gl=e.gl,this.textureManager=e.textureManager,this.useCanvasSizedFilterTargets=e.useCanvasSizedFilterTargets,this.bufferIndex=0,this.frameBufferObjectsPool=[this.gl.createFramebuffer(),this.gl.createFramebuffer(),this.gl.createFramebuffer()]}getFrameBufferObject(){const e=this.frameBufferObjectsPool[this.bufferIndex];return this.bufferIndex=this.bufferIndex++%this.frameBufferObjectsPool.length,e}create(e){let t;return t=e===wd.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS?new Zd({gl:this.gl}):new eh({gl:this.gl,textureManager:this.textureManager,frameBufferObject:this.getFrameBufferObject(),useCanvasSizedFilterTargets:this.useCanvasSizedFilterTargets}),t}};function nh(e,t,n){const i=t===e.VERTEX_SHADER?"vertex":"fragment";var r;r=e,Boolean(r)&&("undefined"!=typeof WebGL2RenderingContext&&r instanceof WebGL2RenderingContext||"function"==typeof r.createVertexArray)&&(n=function(e="",t){if("string"!=typeof e||!e||function(e=""){return"string"==typeof e&&e.includes("#version 300 es")}(e))return e;let n=e;if("vertex"===t&&(n=n.replace(/\battribute\b/g,"in"),n=n.replace(/\bvarying\b/g,"out")),"fragment"===t&&(n=n.replace(/\bvarying\b/g,"in"),n=n.replace(/\bgl_FragColor\b/g,"fragColor")),n=n.replace(/\btexture2D\b/g,"texture"),n=`#version 300 es\n${n}`,"fragment"===t&&n.includes("fragColor")&&!/\bout\s+vec4\s+fragColor\s*;/.test(n)){const e=n.split("\n");let t=1;for(let n=1;n<e.length;n+=1)if(e[n].trim().startsWith("precision ")){t=n+1;break}e.splice(t,0,"out vec4 fragColor;"),n=e.join("\n")}return n}(n,i));const o=e.createShader(t);if(!o)throw new Error(`Failed to create ${i} shader`);if(e.shaderSource(o,n),e.compileShader(o),e.getShaderParameter(o,e.COMPILE_STATUS))return o;const s=e.getShaderInfoLog(o);throw e.deleteShader(o),new Error(s)}var ih=function(e,t){return nh(e,e.VERTEX_SHADER,t)},rh=function(e,t){return nh(e,e.FRAGMENT_SHADER,t)};const oh={position_3d:0,texture_coordinate_2d:1};var sh=function(e,t,n){const i=e.createProgram();if(e.attachShader(i,t),e.attachShader(i,n),Object.entries(oh).forEach((([t,n])=>{e.bindAttribLocation(i,n,t)})),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS))return i;const r=e.getProgramInfoLog(i);throw e.deleteProgram(i),new Error(r)},ah=[-1,-1,1,1,-1,1,-1,1,1,1,1,1],lh=[0,1,2,2,1,3],ch=[0,0,1,0,0,1,1,1];const uh=96,dh=[new Float32Array(new ArrayBuffer(uh)),new Float32Array(new ArrayBuffer(uh)),new Float32Array(new ArrayBuffer(uh)),new Float32Array(new ArrayBuffer(uh)),new Float32Array(new ArrayBuffer(uh)),new Float32Array(new ArrayBuffer(uh))],hh=[new Int16Array(6),new Int16Array(6),new Int16Array(6)];let fh=class{constructor(e,t,n){return this.gl=n.gl,this.program=n.program,this.bindPoint=t,this.location=this.gl.getAttribLocation(this.program,e),this.buffer=this.gl.createBuffer(),this.floatBufferCounter=0,this.unit16BufferCounter=0,{fillBuffer:this.fillBuffer.bind(this),bindBuffer:this.bindBuffer.bind(this),setPointer:this.setPointer.bind(this),dispose:this.dispose.bind(this)}}enable(){this.gl.enableVertexAttribArray(this.location)}bindBuffer(){this.gl.bindBuffer(this.bindPoint,this.buffer)}getBuffer(){let e;switch(this.bindPoint){case this.gl.ARRAY_BUFFER:e=dh[this.floatBufferCounter],this.floatBufferCounter=this.floatBufferCounter++%dh.length;break;case this.gl.ELEMENT_ARRAY_BUFFER:e=hh[this.unit16BufferCounter],this.unit16BufferCounter=this.unit16BufferCounter++%hh.length;break;default:throw new Error("cant get buffer for this bind point: ",this.bindPoint)}return e}fillBuffer(e){this.bindBuffer();const t=this.getBuffer();t.set(e,0),this.gl.bufferData(this.bindPoint,t,this.gl.STATIC_DRAW)}getPointerData(){throw new Error("you should impl this function")}setPointer(){this.bindBuffer(),this.enable();const e=this.getPointerData();this.gl.vertexAttribPointer(this.location,e.size,e.type,e.normalize,e.stride,e.offset)}dispose(){this.gl.deleteBuffer(this.buffer)}};const ph={position_3d:class extends fh{getPointerData(){return{size:3,type:this.gl.FLOAT,normalize:!1,stride:0,offset:0}}},position_indexes:class extends fh{setPointer(){}getPointerData(){}enable(){}},texture_coordinate_2d:class extends fh{getPointerData(){return{size:2,type:this.gl.FLOAT,normalize:!0,stride:0,offset:0}}}};var mh=function(e,t,n){const i=ph[e];if(!i)throw new Error(`${e} is not a attribute name,choose from list: ${Object.keys(ph)}`);return new i(e,t,n)};let vh=class{constructor(e,t){this.gl=t.gl,this.program=t.program,this.location=this.gl.getUniformLocation(this.program,e)}compute(){return this}set(){return this}},gh=class extends vh{set(e){this.gl.uniform1fv(this.location,e)}},yh=class extends vh{set(e){e&&(e.beforeUse(),this.gl.uniform1i(this.location,e.getUnit()))}};const bh="first_texture_dimensions",kh="viewport_dimensions",wh="time",xh={RUNTIME_OPTIONS:"runtimeOptions[0]",STATIC_OPTIONS:"staticOptions[0]",FIRST_TEXTURE:"first_texture",SECOND_TEXTURE:"second_texture",FIRST_MATRIX:"first_mat4"},_h={[xh.FIRST_TEXTURE]:yh,[xh.SECOND_TEXTURE]:yh,[xh.FIRST_MATRIX]:class extends vh{set(e){this.gl.uniformMatrix4fv(this.location,!1,e)}},[xh.STATIC_OPTIONS]:gh,[xh.RUNTIME_OPTIONS]:gh};var Th=function(e,t){const n=_h[e];if(!n)throw new Error(`${e} is not a attribute name,choose from list: ${Object.keys(_h)}`);return new n(e,t)},Ih=function(e,t){let n=(Date.now()-e||0)/(t||1);return n=Number.parseFloat(n).toFixed(7),n=Math.min(1,n),n};const Eh="position_3d",Sh="position_indexes",Ah="texture_coordinate_2d";let Nh=class e{constructor(e,t,n,i){this.type=e,this.gl=i.gl,this.frameBuffer=i.frameBufferFactory.create(e),this.rebindAttributesOnProgramSwitch=!1!==i.rebindAttributesOnProgramSwitch,this.vertexShader=ih(this.gl,t.vertex),this.fragmentShader=rh(this.gl,t.fragment),this.program=sh(this.gl,this.vertexShader,this.fragmentShader);const r={gl:this.gl,program:this.program};this.attributes=function(e,t){const n={};return e=e||[],(e=[{id:Eh,bindPoint:t.gl.ARRAY_BUFFER},{id:Sh,bindPoint:t.gl.ELEMENT_ARRAY_BUFFER},{id:Ah,bindPoint:t.gl.ARRAY_BUFFER}].concat(e)).forEach((e=>{const i=e.id;n[i]=mh(i,e.bindPoint,t)})),n}(n.attributes,r),this.uniforms=function(e,t){const n={};return(e=e||[]).forEach((e=>{const i=e.id;n[i]=Th(i,t)})),n}(n.uniforms,r),this.gl.useProgram(this.program),i.__handleAttributesInitedOnce||(this.handleAttributes(),i.__handleAttributesInitedOnce=!0),this.handleStaticUniforms(i.options)}static getFilterType(){throw new Error("impl in concrete class")}static getInputsCount(){throw new Error(`impl in concrete class ${this.getFilterType()}`)}static getInitialOptions(){throw new Error(`impl in concrete class ${this.getFilterType()}`)}static getUniformInfo(t){let n=[{id:xh.RUNTIME_OPTIONS},{id:xh.STATIC_OPTIONS}];return(t.getUniformList||e.getUniformList)().forEach((e=>{Object.values(xh).includes(e)&&n.push({id:e})})),n}handleRuntimeUniforms(t,n){const{inputTextures:i,viewportDimensions:r}=t;let o=Array.isArray(i)?i:[i],s=[];(this.constructor.getUniformList||e.getUniformList)().forEach((e=>{switch(e){case xh.FIRST_TEXTURE:this.uniforms[xh.FIRST_TEXTURE].set(o[0]);break;case xh.SECOND_TEXTURE:this.uniforms[xh.SECOND_TEXTURE].set(o[1]);break;case bh:s=[...s,o[0].getWidth(),o[0].getHeight()];break;case kh:s=[...s,r.width,r.height];break;case wh:{const e=Ih(n.startTime,n.duration);s=[...s,e];break}}})),s.length>0&&this.uniforms[xh.RUNTIME_OPTIONS].set(s)}static getUniformList(){return[xh.FIRST_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(){}handleAttributes(){this.attributes[Eh].fillBuffer(ah),this.attributes[Eh].setPointer(),this.attributes[Sh].fillBuffer(lh),this.attributes[Ah].fillBuffer(ch),this.attributes[Ah].setPointer()}disposeAttributes(){Object.values(this.attributes).forEach((e=>{e.dispose()}))}render(e,t){const n=this.frameBuffer.bind(e);let i={width:Yd,height:Qd};return this.gl.useProgram(this.program),this.rebindAttributesOnProgramSwitch&&this.gl.__shaderGraphLastProgram!==this.program&&(this.handleAttributes(),this.gl.__shaderGraphLastProgram=this.program),this.handleRuntimeUniforms({inputTextures:e,viewportDimensions:i},t),this.draw(),n}draw(){const e=this.gl.TRIANGLES,t=this.gl.UNSIGNED_SHORT;this.gl.drawElements(e,6,t,0)}updateStaticUniforms(e){this.gl.useProgram(this.program),this.handleStaticUniforms(e)}dispose(){this.gl.detachShader(this.program,this.vertexShader),this.gl.deleteShader(this.vertexShader),this.gl.detachShader(this.program,this.fragmentShader),this.gl.deleteShader(this.fragmentShader),this.gl.deleteProgram(this.program)}};var Mh,Fh="undefined"!=typeof Float32Array?Float32Array:Array;function Ch(){var e=new Fh(3);return Fh!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Oh(e,t,n){var i=new Fh(3);return i[0]=e,i[1]=t,i[2]=n,i}function Ph(){var e=new Fh(4);return Fh!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}Ch(),function(){var e;e=new Fh(4),Fh!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0)}(),Ch(),Oh(1,0,0),Oh(0,1,0),Ph(),Ph(),Mh=new Fh(9),Fh!=Float32Array&&(Mh[1]=0,Mh[2]=0,Mh[3]=0,Mh[5]=0,Mh[6]=0,Mh[7]=0),Mh[0]=1,Mh[4]=1,Mh[8]=1;class Rh extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Rh)};super(Rh.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[2];\n\nvarying vec2 blur_texture_coordinate_2d[11];\n\n\nvoid main() {\n vec2 normalize_poistion = vec2(position_3d.xy);\n gl_Position = vec4(normalize_poistion, 1, 1);\n\n float texture_width = runtimeOptions[0];\n float pixel_width = 1.0 / texture_width;\n\n \n for(int i=-5; i<5; ++i){\n float current_i = float(i);\n blur_texture_coordinate_2d[i+5] = texture_coordinate_2d + vec2(pixel_width * current_i, 0.0); \n }\n}\n",fragment:"\nprecision lowp float;\n\nuniform sampler2D first_texture;\n\nvarying vec2 blur_texture_coordinate_2d[11];\n\nvoid main() {\n vec4 out_colour = vec4(0.0);\n\tout_colour += texture2D(first_texture, blur_texture_coordinate_2d[0]) * 0.0093;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[1]) * 0.028002;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[2]) * 0.065984;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[3]) * 0.121703;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[4]) * 0.175713;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[5]) * 0.198596;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[6]) * 0.175713;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[7]) * 0.121703;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[8]) * 0.065984;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[9]) * 0.028002;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[10]) * 0.0093;\n \n \n gl_FragColor = out_colour;\n}"},t,e)}static getFilterType(){return"horizontalBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[xh.FIRST_TEXTURE,bh]}}class Dh extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Dh)};super(Dh.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[2];\n\nvarying vec2 blur_texture_coordinate_2d[11];\n\n\nvoid main() {\n vec2 normalize_poistion = vec2(position_3d.xy);\n gl_Position = vec4(normalize_poistion, 1, 1);\n\n float texture_width = runtimeOptions[1];\n float pixel_height = 1.0 / texture_width;\n\n for(int i=-5; i<5; ++i){\n float current_i = float(i);\n blur_texture_coordinate_2d[i+5] = texture_coordinate_2d + vec2( 0.0, pixel_height * current_i);\n }\n}\n",fragment:"\nprecision lowp float;\n\nuniform sampler2D first_texture;\n\nvarying vec2 blur_texture_coordinate_2d[11];\n\nvoid main() {\n vec4 out_colour = vec4(0.0);\n\tout_colour += texture2D(first_texture, blur_texture_coordinate_2d[0]) * 0.0093;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[1]) * 0.028002;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[2]) * 0.065984;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[3]) * 0.121703;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[4]) * 0.175713;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[5]) * 0.198596;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[6]) * 0.175713;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[7]) * 0.121703;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[8]) * 0.065984;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[9]) * 0.028002;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[10]) * 0.0093;\n \n \n gl_FragColor = out_colour;\n}"},t,e)}static getFilterType(){return"verticalBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[xh.FIRST_TEXTURE,bh]}}class Lh extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Lh)};super(Lh.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float staticOptions[3];\nuniform float runtimeOptions[4];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nconst float Depth = 3.;\nconst float Samples = 8.;\nfloat OffsetDist = staticOptions[0];\n\nvec2 srcDims = vec2(runtimeOptions[0], runtimeOptions[1]);\nvec2 vpDims = vec2(runtimeOptions[2], runtimeOptions[3]);\nvec2 iResolution = vpDims;\n\n\n#define TAU 6.28318530718\n\nvec4 RadialBlur(vec2 fragCoord, float radius) {\n if (radius <= 0.) {\n return texture2D(first_texture, fragCoord/iResolution.xy);\n }\n\n vec2 offset;\n float angle = 0.;\n vec4 color = vec4(0.);\n\n for(float angle = 0.; angle < TAU; angle += (TAU/Samples)) {\n offset = vec2(cos(angle), sin(angle)) * radius;\n color += texture2D(first_texture, (fragCoord + offset)/iResolution.xy);\n }\n\n return color/Samples;\n\n}\n\nvec4 FastBlur(vec2 fragCoord) {\n\n vec4 color;\n vec2 offset;\n float fib = 2.;\n float fibTotal = 0.;\n\n for(float i = 1.; i <= Depth; ++i) {\n fib += i;\n color += RadialBlur(fragCoord, i * OffsetDist)/ fib;\n fibTotal += 1./fib;\n }\n\n return color/fibTotal;\n\n}\n\n// based on https://www.shadertoy.com/view/3ljBDd\nvoid main() {\n// vec2 fragCoords = (vec2(current_texture_coordinate_2d) + 1.0) / 2.0 * vpDims;\n vec2 fragCoords = vec2(current_texture_coordinate_2d) * vpDims;\n gl_FragColor = FastBlur(fragCoords);\n}"},t,e)}static getFilterType(){return"fastBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[xh.FIRST_TEXTURE,bh,kh]}handleStaticUniforms(e){var t;const n=(null!==(t=Number.parseFloat(e.offsetDist))&&void 0!==t?t:4).toFixed(3);this.uniforms[xh.STATIC_OPTIONS].set([n])}}class Bh extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Bh)};super(Bh.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float staticOptions[2];\nuniform float runtimeOptions[4];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvec2 vpDims = vec2(runtimeOptions[2], runtimeOptions[3]);\n\n// A simple directional blur that doesn't brighten the image, based on https://www.shadertoy.com/view/WdSXWD\n// and https://www.shadertoy.com/view/NltSD4\n\nvec4 dirBlur() {\n float angle = staticOptions[0];\n float strength = staticOptions[1];\n if (strength == 0.0){\n return texture2D(first_texture, current_texture_coordinate_2d);\n }\n\n vec2 uv = current_texture_coordinate_2d;\n\n float r = radians(angle);\n vec2 direction = vec2(sin(r), cos(r));\n\n vec2 strengthDirection = strength * direction;\n vec3 acc = vec3(0);\n for(float i = -1.0; i <= 1.0; i += (2.0 / 50.0)) {\n acc += texture2D(first_texture, uv - vec2(strengthDirection.x * i, strengthDirection.y * i)).rgb * (2.0 / 50.0) * .5;\n }\n\n return vec4(acc, 1.0);\n\n}\n\nvoid main() {\n gl_FragColor = dirBlur();\n}"},t,e)}static getFilterType(){return"directionalBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[xh.FIRST_TEXTURE,bh,kh]}handleStaticUniforms(e){var t,n;const i=(null!==(t=Number.parseFloat(e.angle))&&void 0!==t?t:90).toFixed(3),r=(null!==(n=Number.parseFloat(e.strength))&&void 0!==n?n:.1).toFixed(3);this.uniforms[xh.STATIC_OPTIONS].set([i,r])}}class zh extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(zh)};super(zh.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n \n current_texture_coordinate_2d = texture_coordinate_2d;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform float staticOptions[1];\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 texture = texture2D(first_texture, current_texture_coordinate_2d);\n float opacity = texture.w - (1.0 - staticOptions[0]);\n gl_FragColor = vec4((texture.xyz) , opacity);\n}"},t,e)}static getFilterType(){return"opacity"}static getInputsCount(){return 1}static getInitialOptions(){return{power:1}}getOptionsDisplay(){return[{properties:["power"],type:"slider",minValue:0,maxValue:1,step:.001}]}handleStaticUniforms(e){const t=Number.parseFloat(e.power).toFixed(7);this.uniforms[xh.STATIC_OPTIONS].set([t])}}class Wh extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Wh)};super(Wh.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform sampler2D second_texture;\n\nuniform float staticOptions[7];\nuniform float runtimeOptions[2];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\n\nfloat roundedBoxSDF(vec2 point, vec2 center, vec2 area, float radius) {\n return length(max(abs(point - center) - area + radius, 0.0)) - radius;\n}\n\nfloat boxSDF(vec2 point, vec2 center, vec2 area){\n vec2 d = abs(point - center) - area;\n return length(max(d,vec2(0)));\n}\n\n\nvoid main() {\n float type = staticOptions[0];\n vec2 aspectRatio = vec2(runtimeOptions[0]/runtimeOptions[1], 1.0);\n\n\n vec2 center = vec2(staticOptions[1], staticOptions[2]) * aspectRatio;\n vec2 area = max(vec2(staticOptions[3], staticOptions[4]) * aspectRatio, 0.0); \n float radius = staticOptions[5];\n\n vec2 SDF_PositionCoordinate2d = vec2(\n current_position_coordinate_2d.x,\n current_position_coordinate_2d.y * -1.0\n ) * aspectRatio;\n\n vec4 color1 = texture2D(first_texture, current_texture_coordinate_2d);\n vec4 color2 = texture2D(second_texture, current_texture_coordinate_2d);\n\n float dist;\n vec4 color;\n if(type == 0.0){\n dist = boxSDF(SDF_PositionCoordinate2d, center, area);\n color = (dist > 0.0) ? color2: color1;\n } else {\n dist = roundedBoxSDF(SDF_PositionCoordinate2d, center, area, radius);\n color = (dist > 0.0) ? color2: color1;\n color = mix( color, color2, 1.0-smoothstep(0.0,0.0025,abs(dist)));\n }\n \n gl_FragColor = color;\n}"},t,e)}static getFilterType(){return"shapeCompositeMask"}static getInputsCount(){return 2}static getInitialOptions(){return{type:"box",center:{x:0,y:0},area:{width:0,height:0},radius:.01,edgeSoftness:0}}getOptionsDisplay(){return[{properties:["center","x"],type:"slider",minValue:-1,maxValue:1,step:.001},{properties:["center","y"],type:"slider",minValue:-1,maxValue:1,step:.001},{properties:["area","width"],type:"slider",minValue:-2,maxValue:2,step:.001},{properties:["area","height"],type:"slider",minValue:-2,maxValue:2,step:.001},{properties:["radius"],type:"slider",minValue:-2,maxValue:2,step:.001},{properties:["edgeSoftness"],type:"slider",minValue:-2,maxValue:2,step:.001}]}static getUniformList(){return[xh.FIRST_TEXTURE,bh,xh.SECOND_TEXTURE]}handleStaticUniforms(e){let t;switch(e.type){case"box":t=0;break;case"rounded":t=1;break;default:throw new Error("cant recognize shape composite mask type")}const n=Number.parseFloat(e.center.x).toFixed(7);let i=Number.parseFloat(e.center.y).toFixed(7);i+=0;const r=Number.parseFloat(e.area.width).toFixed(7),o=Number.parseFloat(e.area.height).toFixed(7),s=Number.parseFloat(e.radius).toFixed(7),a=Number.parseFloat(e.edgeSoftness).toFixed(7);this.uniforms[xh.STATIC_OPTIONS].set([t,n,i,r,o,s,a])}}class $h extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo($h)};super($h.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform sampler2D second_texture;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 fgColor = texture2D(first_texture, current_texture_coordinate_2d);\n vec4 bgColor = texture2D(second_texture, current_texture_coordinate_2d);\n gl_FragColor = vec4(\n mix(bgColor.xyz, fgColor.xyz, fgColor.w),\n 1.0\n );\n // vec4 fgColor = texture2D(textures[1], current_texture_coordinate_2d);\n // if(fgColor.w > 0.0){\n // gl_FragColor = vec4(1.0,0,0,1);\n // }else{\n // gl_FragColor = vec4(1.0,1.0,0,1);\n // }\n \n \n}"},t,e)}static getFilterType(){return"shapeComposite"}static getInputsCount(){return 2}static getInitialOptions(){return{}}static getUniformList(){return[xh.FIRST_TEXTURE,xh.SECOND_TEXTURE]}}class jh extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(jh)};super(jh.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform sampler2D second_texture;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n // Look it up in the LUT\n vec4 textureColor = texture2D(first_texture, current_texture_coordinate_2d);\n\n mediump float blueColor = textureColor.b * 63.0;\n\n mediump vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0);\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n\n mediump vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0);\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n\n highp vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);\n\n\n highp vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);\n\n lowp vec4 newColor1 = texture2D(second_texture, texPos1);\n lowp vec4 newColor2 = texture2D(second_texture, texPos2);\n\n lowp vec4 color = mix(newColor1, newColor2, fract(blueColor));\n\n gl_FragColor = color;\n\n // debug\n// if (current_texture_coordinate_2d.x < 0.5) {\n// // Left half: show original\n// gl_FragColor = textureColor;\n// } else {\n// gl_FragColor = color;\n// }\n}\n"},t,e)}static getFilterType(){return"lut"}static getInputsCount(){return 2}static getInitialOptions(){return{}}static getUniformList(){return[xh.FIRST_TEXTURE,xh.SECOND_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(e){const t=Number.parseFloat(e.lutSize).toFixed(1);this.uniforms[xh.STATIC_OPTIONS].set([t])}}var Uh="attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",qh='precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\n\n// a 256 * 4 length array with values for the master, r, g and b curve respectively\n// Temporarily changed length to 256 to avoid the following error on some machines:\n// "Implementation limit of 4096 (e.g., number of built-in plus user defined active uniforms components) exceeded, fragment shader uses 4100 total uniforms."\nuniform float staticOptions[256];\n\n\n// implementation of round (doesn\'t exist in webgl)\nint round(float val){\n return int(floor(val + 0.5));\n}\n\n// no dynamic array indexes in webgl\n// see https://stackoverflow.com/questions/30585265/what-can-i-use-as-an-array-index-in-glsl-in-webgl\nfloat getCurveValue(float pixelValue){\n float v;\n for (int k = 0; k < 256; k++) {\n if (k == round(pixelValue * 255.0)){\n v = float(staticOptions[k]) / 255.0;\n }\n }\n return v;\n}\n\nvec3 masterCurve(vec4 color){\n float r = getCurveValue(color.r);\n float g = getCurveValue(color.g);\n float b = getCurveValue(color.b);\n// for (int k = 0; k < 256; ++k) {\n// if (k == int(color.g) * 256){\n// g = float(staticOptions[k]) / 256.0;\n// }\n// }\n// for (int k = 0; k < 256; ++k) {\n// if (k == int(color.b) * 256){\n// b = float(staticOptions[k]) / 256.0;\n// }\n// }\n return vec3(r,g,b);\n}\n\n//vec3 redCurve(vec3 color){\n// int offset = 256;\n// return vec3(staticOptions[int(int(color.r) + offset)], color.g, color.b);\n//}\n//\n//vec3 greenCurve(vec3 color){\n// int offset = 256 * 2;\n// return vec3(color.r, staticOptions[int(int(color.g) + offset)], color.b);\n//}\n//\n//vec3 blueCurve(vec3 color){\n// int offset = 256 * 3;\n// return vec3(color.r, color.g, staticOptions[int(int(color.b) + offset)]);\n//}\n\nvoid main() {\n// vec4 textureColor = texture2D(first_texture, current_texture_coordinate_2d);\n// vec3 afterMaster = masterCurve(textureColor);\n// vec3 afterRed = redCurve(afterMaster);\n// vec3 afterGreen = greenCurve(afterRed);\n// vec3 afterBlue = blueCurve(afterGreen);\n// vec4 finalColor = vec4(afterBlue, textureColor.a);\n\n vec4 textureColor = texture2D(first_texture, current_texture_coordinate_2d);\n vec3 afterMaster = masterCurve(textureColor);\n vec4 finalColor = vec4(afterMaster, textureColor.a);\n\n gl_FragColor = finalColor;\n}\n';const{abs:Vh,cos:Gh,sin:Hh,acos:Kh,atan2:Xh,sqrt:Yh,pow:Qh}=Math;function Jh(e){return e<0?-Qh(-e,1/3):Qh(e,1/3)}const Zh=Math.PI,ef=2*Zh,tf=Zh/2,nf=Number.MAX_SAFE_INTEGER||9007199254740991,rf=Number.MIN_SAFE_INTEGER||-9007199254740991,of={x:0,y:0,z:0},sf={Tvalues:[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Cvalues:[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],arcfn:function(e,t){const n=t(e);let i=n.x*n.x+n.y*n.y;return void 0!==n.z&&(i+=n.z*n.z),Yh(i)},compute:function(e,t,n){if(0===e)return t[0].t=0,t[0];const i=t.length-1;if(1===e)return t[i].t=1,t[i];const r=1-e;let o=t;if(0===i)return t[0].t=e,t[0];if(1===i){const t={x:r*o[0].x+e*o[1].x,y:r*o[0].y+e*o[1].y,t:e};return n&&(t.z=r*o[0].z+e*o[1].z),t}if(i<4){let t,s,a,l=r*r,c=e*e,u=0;2===i?(o=[o[0],o[1],o[2],of],t=l,s=r*e*2,a=c):3===i&&(t=l*r,s=l*e*3,a=r*c*3,u=e*c);const d={x:t*o[0].x+s*o[1].x+a*o[2].x+u*o[3].x,y:t*o[0].y+s*o[1].y+a*o[2].y+u*o[3].y,t:e};return n&&(d.z=t*o[0].z+s*o[1].z+a*o[2].z+u*o[3].z),d}const s=JSON.parse(JSON.stringify(t));for(;s.length>1;){for(let t=0;t<s.length-1;t++)s[t]={x:s[t].x+(s[t+1].x-s[t].x)*e,y:s[t].y+(s[t+1].y-s[t].y)*e},void 0!==s[t].z&&(s[t].z=s[t].z+(s[t+1].z-s[t].z)*e);s.splice(s.length-1,1)}return s[0].t=e,s[0]},computeWithRatios:function(e,t,n,i){const r=1-e,o=n,s=t;let a,l=o[0],c=o[1],u=o[2],d=o[3];return l*=r,c*=e,2===s.length?(a=l+c,{x:(l*s[0].x+c*s[1].x)/a,y:(l*s[0].y+c*s[1].y)/a,z:!!i&&(l*s[0].z+c*s[1].z)/a,t:e}):(l*=r,c*=2*r,u*=e*e,3===s.length?(a=l+c+u,{x:(l*s[0].x+c*s[1].x+u*s[2].x)/a,y:(l*s[0].y+c*s[1].y+u*s[2].y)/a,z:!!i&&(l*s[0].z+c*s[1].z+u*s[2].z)/a,t:e}):(l*=r,c*=1.5*r,u*=3*r,d*=e*e*e,4===s.length?(a=l+c+u+d,{x:(l*s[0].x+c*s[1].x+u*s[2].x+d*s[3].x)/a,y:(l*s[0].y+c*s[1].y+u*s[2].y+d*s[3].y)/a,z:!!i&&(l*s[0].z+c*s[1].z+u*s[2].z+d*s[3].z)/a,t:e}):void 0))},derive:function(e,t){const n=[];for(let i=e,r=i.length,o=r-1;r>1;r--,o--){const e=[];for(let n,r=0;r<o;r++)n={x:o*(i[r+1].x-i[r].x),y:o*(i[r+1].y-i[r].y)},t&&(n.z=o*(i[r+1].z-i[r].z)),e.push(n);n.push(e),i=e}return n},between:function(e,t,n){return t<=e&&e<=n||sf.approximately(e,t)||sf.approximately(e,n)},approximately:function(e,t,n){return Vh(e-t)<=(n||1e-6)},length:function(e){const t=sf.Tvalues.length;let n=0;for(let i,r=0;r<t;r++)i=.5*sf.Tvalues[r]+.5,n+=sf.Cvalues[r]*sf.arcfn(i,e);return.5*n},map:function(e,t,n,i,r){return i+(e-t)/(n-t)*(r-i)},lerp:function(e,t,n){const i={x:t.x+e*(n.x-t.x),y:t.y+e*(n.y-t.y)};return void 0!==t.z&&void 0!==n.z&&(i.z=t.z+e*(n.z-t.z)),i},pointToString:function(e){let t=e.x+"/"+e.y;return void 0!==e.z&&(t+="/"+e.z),t},pointsToString:function(e){return"["+e.map(sf.pointToString).join(", ")+"]"},copy:function(e){return JSON.parse(JSON.stringify(e))},angle:function(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=n.x-e.x,s=n.y-e.y;return Xh(i*s-r*o,i*o+r*s)},round:function(e,t){const n=""+e,i=n.indexOf(".");return parseFloat(n.substring(0,i+1+t))},dist:function(e,t){const n=e.x-t.x,i=e.y-t.y;return Yh(n*n+i*i)},closest:function(e,t){let n,i,r=Qh(2,63);return e.forEach((function(e,o){i=sf.dist(t,e),i<r&&(r=i,n=o)})),{mdist:r,mpos:n}},abcratio:function(e,t){if(2!==t&&3!==t)return!1;if(void 0===e)e=.5;else if(0===e||1===e)return e;const n=Qh(e,t)+Qh(1-e,t);return Vh((n-1)/n)},projectionratio:function(e,t){if(2!==t&&3!==t)return!1;if(void 0===e)e=.5;else if(0===e||1===e)return e;const n=Qh(1-e,t);return n/(Qh(e,t)+n)},lli8:function(e,t,n,i,r,o,s,a){const l=(e-n)*(o-a)-(t-i)*(r-s);return 0!=l&&{x:((e*i-t*n)*(r-s)-(e-n)*(r*a-o*s))/l,y:((e*i-t*n)*(o-a)-(t-i)*(r*a-o*s))/l}},lli4:function(e,t,n,i){const r=e.x,o=e.y,s=t.x,a=t.y,l=n.x,c=n.y,u=i.x,d=i.y;return sf.lli8(r,o,s,a,l,c,u,d)},lli:function(e,t){return sf.lli4(e,e.c,t,t.c)},makeline:function(e,t){return new vf(e.x,e.y,(e.x+t.x)/2,(e.y+t.y)/2,t.x,t.y)},findbbox:function(e){let t=nf,n=nf,i=rf,r=rf;return e.forEach((function(e){const o=e.bbox();t>o.x.min&&(t=o.x.min),n>o.y.min&&(n=o.y.min),i<o.x.max&&(i=o.x.max),r<o.y.max&&(r=o.y.max)})),{x:{min:t,mid:(t+i)/2,max:i,size:i-t},y:{min:n,mid:(n+r)/2,max:r,size:r-n}}},shapeintersections:function(e,t,n,i,r){if(!sf.bboxoverlap(t,i))return[];const o=[],s=[e.startcap,e.forward,e.back,e.endcap],a=[n.startcap,n.forward,n.back,n.endcap];return s.forEach((function(t){t.virtual||a.forEach((function(i){if(i.virtual)return;const s=t.intersects(i,r);s.length>0&&(s.c1=t,s.c2=i,s.s1=e,s.s2=n,o.push(s))}))})),o},makeshape:function(e,t,n){const i=t.points.length,r=e.points.length,o=sf.makeline(t.points[i-1],e.points[0]),s=sf.makeline(e.points[r-1],t.points[0]),a={startcap:o,forward:e,back:t,endcap:s,bbox:sf.findbbox([o,e,t,s]),intersections:function(e){return sf.shapeintersections(a,a.bbox,e,e.bbox,n)}};return a},getminmax:function(e,t,n){if(!n)return{min:0,max:0};let i,r,o=nf,s=rf;-1===n.indexOf(0)&&(n=[0].concat(n)),-1===n.indexOf(1)&&n.push(1);for(let a=0,l=n.length;a<l;a++)i=n[a],r=e.get(i),r[t]<o&&(o=r[t]),r[t]>s&&(s=r[t]);return{min:o,mid:(o+s)/2,max:s,size:s-o}},align:function(e,t){const n=t.p1.x,i=t.p1.y,r=-Xh(t.p2.y-i,t.p2.x-n);return e.map((function(e){return{x:(e.x-n)*Gh(r)-(e.y-i)*Hh(r),y:(e.x-n)*Hh(r)+(e.y-i)*Gh(r)}}))},roots:function(e,t){t=t||{p1:{x:0,y:0},p2:{x:1,y:0}};const n=e.length-1,i=sf.align(e,t),r=function(e){return 0<=e&&e<=1};if(2===n){const e=i[0].y,t=i[1].y,n=i[2].y,o=e-2*t+n;if(0!==o){const i=-Yh(t*t-e*n),s=-e+t;return[-(i+s)/o,-(-i+s)/o].filter(r)}return t!==n&&0===o?[(2*t-n)/(2*t-2*n)].filter(r):[]}const o=i[0].y,s=i[1].y,a=i[2].y;let l=3*s-o-3*a+i[3].y,c=3*o-6*s+3*a,u=-3*o+3*s,d=o;if(sf.approximately(l,0)){if(sf.approximately(c,0))return sf.approximately(u,0)?[]:[-d/u].filter(r);const e=Yh(u*u-4*c*d),t=2*c;return[(e-u)/t,(-u-e)/t].filter(r)}c/=l,u/=l,d/=l;const h=(3*u-c*c)/3,f=h/3,p=(2*c*c*c-9*c*u+27*d)/27,m=p/2,v=m*m+f*f*f;let g,y,b,k,w;if(v<0){const e=-h/3,t=Yh(e*e*e),n=-p/(2*t),i=Kh(n<-1?-1:n>1?1:n),o=2*Jh(t);return b=o*Gh(i/3)-c/3,k=o*Gh((i+ef)/3)-c/3,w=o*Gh((i+2*ef)/3)-c/3,[b,k,w].filter(r)}if(0===v)return g=m<0?Jh(-m):-Jh(m),b=2*g-c/3,k=-g-c/3,[b,k].filter(r);{const e=Yh(v);return g=Jh(-m+e),y=Jh(m+e),[g-y-c/3].filter(r)}},droots:function(e){if(3===e.length){const t=e[0],n=e[1],i=e[2],r=t-2*n+i;if(0!==r){const e=-Yh(n*n-t*i),o=-t+n;return[-(e+o)/r,-(-e+o)/r]}return n!==i&&0===r?[(2*n-i)/(2*(n-i))]:[]}if(2===e.length){const t=e[0],n=e[1];return t!==n?[t/(t-n)]:[]}return[]},curvature:function(e,t,n,i,r){let o,s,a,l,c=0,u=0;const d=sf.compute(e,t),h=sf.compute(e,n),f=d.x*d.x+d.y*d.y;if(i?(o=Yh(Qh(d.y*h.z-h.y*d.z,2)+Qh(d.z*h.x-h.z*d.x,2)+Qh(d.x*h.y-h.x*d.y,2)),s=Qh(f+d.z*d.z,1.5)):(o=d.x*h.y-d.y*h.x,s=Qh(f,1.5)),0===o||0===s)return{k:0,r:0};if(c=o/s,u=s/o,!r){const r=sf.curvature(e-.001,t,n,i,!0).k,o=sf.curvature(e+.001,t,n,i,!0).k;l=(o-c+(c-r))/2,a=(Vh(o-c)+Vh(c-r))/2}return{k:c,r:u,dk:l,adk:a}},inflections:function(e){if(e.length<4)return[];const t=sf.align(e,{p1:e[0],p2:e.slice(-1)[0]}),n=t[2].x*t[1].y,i=t[3].x*t[1].y,r=t[1].x*t[2].y,o=18*(-3*n+2*i+3*r-t[3].x*t[2].y),s=18*(3*n-i-3*r),a=18*(r-n);if(sf.approximately(o,0)){if(!sf.approximately(s,0)){let e=-a/s;if(0<=e&&e<=1)return[e]}return[]}const l=2*o;if(sf.approximately(l,0))return[];const c=s*s-4*o*a;if(c<0)return[];const u=Math.sqrt(c);return[(u-s)/l,-(s+u)/l].filter((function(e){return 0<=e&&e<=1}))},bboxoverlap:function(e,t){const n=["x","y"],i=n.length;for(let r,o,s,a,l=0;l<i;l++)if(r=n[l],o=e[r].mid,s=t[r].mid,a=(e[r].size+t[r].size)/2,Vh(o-s)>=a)return!1;return!0},expandbox:function(e,t){t.x.min<e.x.min&&(e.x.min=t.x.min),t.y.min<e.y.min&&(e.y.min=t.y.min),t.z&&t.z.min<e.z.min&&(e.z.min=t.z.min),t.x.max>e.x.max&&(e.x.max=t.x.max),t.y.max>e.y.max&&(e.y.max=t.y.max),t.z&&t.z.max>e.z.max&&(e.z.max=t.z.max),e.x.mid=(e.x.min+e.x.max)/2,e.y.mid=(e.y.min+e.y.max)/2,e.z&&(e.z.mid=(e.z.min+e.z.max)/2),e.x.size=e.x.max-e.x.min,e.y.size=e.y.max-e.y.min,e.z&&(e.z.size=e.z.max-e.z.min)},pairiteration:function(e,t,n){const i=e.bbox(),r=t.bbox(),o=1e5,s=n||.5;if(i.x.size+i.y.size<s&&r.x.size+r.y.size<s)return[(o*(e._t1+e._t2)/2|0)/o+"/"+(o*(t._t1+t._t2)/2|0)/o];let a=e.split(.5),l=t.split(.5),c=[{left:a.left,right:l.left},{left:a.left,right:l.right},{left:a.right,right:l.right},{left:a.right,right:l.left}];c=c.filter((function(e){return sf.bboxoverlap(e.left.bbox(),e.right.bbox())}));let u=[];return 0===c.length||(c.forEach((function(e){u=u.concat(sf.pairiteration(e.left,e.right,s))})),u=u.filter((function(e,t){return u.indexOf(e)===t}))),u},getccenter:function(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=n.x-t.x,s=n.y-t.y,a=i*Gh(tf)-r*Hh(tf),l=i*Hh(tf)+r*Gh(tf),c=o*Gh(tf)-s*Hh(tf),u=o*Hh(tf)+s*Gh(tf),d=(e.x+t.x)/2,h=(e.y+t.y)/2,f=(t.x+n.x)/2,p=(t.y+n.y)/2,m=d+a,v=h+l,g=f+c,y=p+u,b=sf.lli8(d,h,m,v,f,p,g,y),k=sf.dist(b,e);let w,x=Xh(e.y-b.y,e.x-b.x),_=Xh(t.y-b.y,t.x-b.x),T=Xh(n.y-b.y,n.x-b.x);return x<T?((x>_||_>T)&&(x+=ef),x>T&&(w=T,T=x,x=w)):T<_&&_<x?(w=T,T=x,x=w):T+=ef,b.s=x,b.e=T,b.r=k,b},numberSort:function(e,t){return e-t}};class af{constructor(e){this.curves=[],this._3d=!1,e&&(this.curves=e,this._3d=this.curves[0]._3d)}valueOf(){return this.toString()}toString(){return"["+this.curves.map((function(e){return sf.pointsToString(e.points)})).join(", ")+"]"}addCurve(e){this.curves.push(e),this._3d=this._3d||e._3d}length(){return this.curves.map((function(e){return e.length()})).reduce((function(e,t){return e+t}))}curve(e){return this.curves[e]}bbox(){const e=this.curves;for(var t=e[0].bbox(),n=1;n<e.length;n++)sf.expandbox(t,e[n].bbox());return t}offset(e){const t=[];return this.curves.forEach((function(n){t.push(...n.offset(e))})),new af(t)}}const{abs:lf,min:cf,max:uf,cos:df,sin:hf,acos:ff,sqrt:pf}=Math,mf=Math.PI;let vf=class e{constructor(e){let t=e&&e.forEach?e:Array.from(arguments).slice(),n=!1;if("object"==typeof t[0]){n=t.length;const e=[];t.forEach((function(t){["x","y","z"].forEach((function(n){void 0!==t[n]&&e.push(t[n])}))})),t=e}let i=!1;const r=t.length;if(n){if(n>4){if(1!==arguments.length)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");i=!0}}else if(6!==r&&8!==r&&9!==r&&12!==r&&1!==arguments.length)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");const o=this._3d=!i&&(9===r||12===r)||e&&e[0]&&void 0!==e[0].z,s=this.points=[];for(let e=0,n=o?3:2;e<r;e+=n){var a={x:t[e],y:t[e+1]};o&&(a.z=t[e+2]),s.push(a)}const l=this.order=s.length-1,c=this.dims=["x","y"];o&&c.push("z"),this.dimlen=c.length;const u=sf.align(s,{p1:s[0],p2:s[l]}),d=sf.dist(s[0],s[l]);this._linear=u.reduce(((e,t)=>e+lf(t.y)),0)<d/50,this._lut=[],this._t1=0,this._t2=1,this.update()}static quadraticFromPoints(t,n,i,r){if(void 0===r&&(r=.5),0===r)return new e(n,n,i);if(1===r)return new e(t,n,n);const o=e.getABC(2,t,n,i,r);return new e(t,o.A,i)}static cubicFromPoints(t,n,i,r,o){void 0===r&&(r=.5);const s=e.getABC(3,t,n,i,r);void 0===o&&(o=sf.dist(n,s.C));const a=o*(1-r)/r,l=sf.dist(t,i),c=(i.x-t.x)/l,u=(i.y-t.y)/l,d=o*c,h=o*u,f=a*c,p=a*u,m=n.x-d,v=n.y-h,g=n.x+f,y=n.y+p,b=s.A,k=b.x+(m-b.x)/(1-r),w=b.y+(v-b.y)/(1-r),x=b.x+(g-b.x)/r,_=b.y+(y-b.y)/r,T={x:t.x+(k-t.x)/r,y:t.y+(w-t.y)/r},I={x:i.x+(x-i.x)/(1-r),y:i.y+(_-i.y)/(1-r)};return new e(t,T,I,i)}static getUtils(){return sf}getUtils(){return e.getUtils()}static get PolyBezier(){return af}valueOf(){return this.toString()}toString(){return sf.pointsToString(this.points)}toSVG(){if(this._3d)return!1;const e=this.points,t=["M",e[0].x,e[0].y,2===this.order?"Q":"C"];for(let n=1,i=e.length;n<i;n++)t.push(e[n].x),t.push(e[n].y);return t.join(" ")}setRatios(e){if(e.length!==this.points.length)throw new Error("incorrect number of ratio values");this.ratios=e,this._lut=[]}verify(){const e=this.coordDigest();e!==this._print&&(this._print=e,this.update())}coordDigest(){return this.points.map((function(e,t){return""+t+e.x+e.y+(e.z?e.z:0)})).join("")}update(){this._lut=[],this.dpoints=sf.derive(this.points,this._3d),this.computedirection()}computedirection(){const e=this.points,t=sf.angle(e[0],e[this.order],e[1]);this.clockwise=t>0}length(){return sf.length(this.derivative.bind(this))}static getABC(e=2,t,n,i,r=.5){const o=sf.projectionratio(r,e),s=1-o,a={x:o*t.x+s*i.x,y:o*t.y+s*i.y},l=sf.abcratio(r,e);return{A:{x:n.x+(n.x-a.x)/l,y:n.y+(n.y-a.y)/l},B:n,C:a,S:t,E:i}}getABC(t,n){n=n||this.get(t);let i=this.points[0],r=this.points[this.order];return e.getABC(this.order,i,n,r,t)}getLUT(e){if(this.verify(),e=e||100,this._lut.length===e+1)return this._lut;this._lut=[],e++,this._lut=[];for(let t,n,i=0;i<e;i++)n=i/(e-1),t=this.compute(n),t.t=n,this._lut.push(t);return this._lut}on(e,n){n=n||5;const i=this.getLUT(),r=[];for(let t,o=0,s=0;o<i.length;o++)t=i[o],sf.dist(t,e)<n&&(r.push(t),s+=o/i.length);return!!r.length&&(t/=r.length)}project(e){const t=this.getLUT(),n=t.length-1,i=sf.closest(t,e),r=i.mpos,o=(r-1)/n,s=(r+1)/n,a=.1/n;let l,c=i.mdist,u=o,d=u;c+=1;for(let t;u<s+a;u+=a)l=this.compute(u),t=sf.dist(e,l),t<c&&(c=t,d=u);return d=d<0?0:d>1?1:d,l=this.compute(d),l.t=d,l.d=c,l}get(e){return this.compute(e)}point(e){return this.points[e]}compute(e){return this.ratios?sf.computeWithRatios(e,this.points,this.ratios,this._3d):sf.compute(e,this.points,this._3d,this.ratios)}raise(){const t=this.points,n=[t[0]],i=t.length;for(let e,r,o=1;o<i;o++)e=t[o],r=t[o-1],n[o]={x:(i-o)/i*e.x+o/i*r.x,y:(i-o)/i*e.y+o/i*r.y};return n[i]=t[i-1],new e(n)}derivative(e){return sf.compute(e,this.dpoints[0],this._3d)}dderivative(e){return sf.compute(e,this.dpoints[1],this._3d)}align(){let t=this.points;return new e(sf.align(t,{p1:t[0],p2:t[t.length-1]}))}curvature(e){return sf.curvature(e,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return sf.inflections(this.points)}normal(e){return this._3d?this.__normal3(e):this.__normal2(e)}__normal2(e){const t=this.derivative(e),n=pf(t.x*t.x+t.y*t.y);return{t:e,x:-t.y/n,y:t.x/n}}__normal3(e){const t=this.derivative(e),n=this.derivative(e+.01),i=pf(t.x*t.x+t.y*t.y+t.z*t.z),r=pf(n.x*n.x+n.y*n.y+n.z*n.z);t.x/=i,t.y/=i,t.z/=i,n.x/=r,n.y/=r,n.z/=r;const o={x:n.y*t.z-n.z*t.y,y:n.z*t.x-n.x*t.z,z:n.x*t.y-n.y*t.x},s=pf(o.x*o.x+o.y*o.y+o.z*o.z);o.x/=s,o.y/=s,o.z/=s;const a=[o.x*o.x,o.x*o.y-o.z,o.x*o.z+o.y,o.x*o.y+o.z,o.y*o.y,o.y*o.z-o.x,o.x*o.z-o.y,o.y*o.z+o.x,o.z*o.z];return{t:e,x:a[0]*t.x+a[1]*t.y+a[2]*t.z,y:a[3]*t.x+a[4]*t.y+a[5]*t.z,z:a[6]*t.x+a[7]*t.y+a[8]*t.z}}hull(e){let t=this.points,n=[],i=[],r=0;for(i[r++]=t[0],i[r++]=t[1],i[r++]=t[2],3===this.order&&(i[r++]=t[3]);t.length>1;){n=[];for(let o,s=0,a=t.length-1;s<a;s++)o=sf.lerp(e,t[s],t[s+1]),i[r++]=o,n.push(o);t=n}return i}split(t,n){if(0===t&&n)return this.split(n).left;if(1===n)return this.split(t).right;const i=this.hull(t),r={left:2===this.order?new e([i[0],i[3],i[5]]):new e([i[0],i[4],i[7],i[9]]),right:2===this.order?new e([i[5],i[4],i[2]]):new e([i[9],i[8],i[6],i[3]]),span:i};return r.left._t1=sf.map(0,0,1,this._t1,this._t2),r.left._t2=sf.map(t,0,1,this._t1,this._t2),r.right._t1=sf.map(t,0,1,this._t1,this._t2),r.right._t2=sf.map(1,0,1,this._t1,this._t2),n?(n=sf.map(n,t,1,0,1),r.right.split(n).left):r}extrema(){const e={};let t=[];return this.dims.forEach(function(n){let i=function(e){return e[n]},r=this.dpoints[0].map(i);e[n]=sf.droots(r),3===this.order&&(r=this.dpoints[1].map(i),e[n]=e[n].concat(sf.droots(r))),e[n]=e[n].filter((function(e){return e>=0&&e<=1})),t=t.concat(e[n].sort(sf.numberSort))}.bind(this)),e.values=t.sort(sf.numberSort).filter((function(e,n){return t.indexOf(e)===n})),e}bbox(){const e=this.extrema(),t={};return this.dims.forEach(function(n){t[n]=sf.getminmax(this,n,e[n])}.bind(this)),t}overlaps(e){const t=this.bbox(),n=e.bbox();return sf.bboxoverlap(t,n)}offset(t,n){if(void 0!==n){const e=this.get(t),i=this.normal(t),r={c:e,n:i,x:e.x+i.x*n,y:e.y+i.y*n};return this._3d&&(r.z=e.z+i.z*n),r}if(this._linear){const n=this.normal(0),i=this.points.map((function(e){const i={x:e.x+t*n.x,y:e.y+t*n.y};return e.z&&n.z&&(i.z=e.z+t*n.z),i}));return[new e(i)]}return this.reduce().map((function(e){return e._linear?e.offset(t)[0]:e.scale(t)}))}simple(){if(3===this.order){const e=sf.angle(this.points[0],this.points[3],this.points[1]),t=sf.angle(this.points[0],this.points[3],this.points[2]);if(e>0&&t<0||e<0&&t>0)return!1}const e=this.normal(0),t=this.normal(1);let n=e.x*t.x+e.y*t.y;return this._3d&&(n+=e.z*t.z),lf(ff(n))<mf/3}reduce(){let e,t,n=0,i=0,r=.01,o=[],s=[],a=this.extrema().values;for(-1===a.indexOf(0)&&(a=[0].concat(a)),-1===a.indexOf(1)&&a.push(1),n=a[0],e=1;e<a.length;e++)i=a[e],t=this.split(n,i),t._t1=n,t._t2=i,o.push(t),n=i;return o.forEach((function(e){for(n=0,i=0;i<=1;)for(i=n+r;i<=1.01;i+=r)if(t=e.split(n,i),!t.simple()){if(i-=r,lf(n-i)<r)return[];t=e.split(n,i),t._t1=sf.map(n,0,1,e._t1,e._t2),t._t2=sf.map(i,0,1,e._t1,e._t2),s.push(t),n=i;break}n<1&&(t=e.split(n,1),t._t1=sf.map(n,0,1,e._t1,e._t2),t._t2=e._t2,s.push(t))})),s}translate(t,n,i){i="number"==typeof i?i:n;const r=this.order;let o=this.points.map(((e,t)=>(1-t/r)*n+t/r*i));return new e(this.points.map(((e,n)=>({x:e.x+t.x*o[n],y:e.y+t.y*o[n]}))))}scale(t){const n=this.order;let i=!1;if("function"==typeof t&&(i=t),i&&2===n)return this.raise().scale(i);const r=this.clockwise,o=this.points;if(this._linear)return this.translate(this.normal(0),i?i(0):t,i?i(1):t);const s=i?i(0):t,a=i?i(1):t,l=[this.offset(0,10),this.offset(1,10)],c=[],u=sf.lli4(l[0],l[0].c,l[1],l[1].c);if(!u)throw new Error("cannot scale this curve. Try reducing it first.");return[0,1].forEach((function(e){const t=c[e*n]=sf.copy(o[e*n]);t.x+=(e?a:s)*l[e].n.x,t.y+=(e?a:s)*l[e].n.y})),i?([0,1].forEach((function(e){if(2!==n||!e){var s=o[e+1],a={x:s.x-u.x,y:s.y-u.y},l=i?i((e+1)/n):t;i&&!r&&(l=-l);var d=pf(a.x*a.x+a.y*a.y);a.x/=d,a.y/=d,c[e+1]={x:s.x+l*a.x,y:s.y+l*a.y}}})),new e(c)):([0,1].forEach((e=>{if(2===n&&e)return;const t=c[e*n],i=this.derivative(e),r={x:t.x+i.x,y:t.y+i.y};c[e+1]=sf.lli4(t,r,u,o[e+1])})),new e(c))}outline(t,n,i,r){if(n=void 0===n?t:n,this._linear){const o=this.normal(0),s=this.points[0],a=this.points[this.points.length-1];let l,c,u;void 0===i&&(i=t,r=n),l={x:s.x+o.x*t,y:s.y+o.y*t},u={x:a.x+o.x*i,y:a.y+o.y*i},c={x:(l.x+u.x)/2,y:(l.y+u.y)/2};const d=[l,c,u];l={x:s.x-o.x*n,y:s.y-o.y*n},u={x:a.x-o.x*r,y:a.y-o.y*r},c={x:(l.x+u.x)/2,y:(l.y+u.y)/2};const h=[u,c,l],f=sf.makeline(h[2],d[0]),p=sf.makeline(d[2],h[0]),m=[f,new e(d),p,new e(h)];return new af(m)}const o=this.reduce(),s=o.length,a=[];let l,c=[],u=0,d=this.length();const h=void 0!==i&&void 0!==r;function f(e,t,n,i,r){return function(o){const s=i/n,a=(i+r)/n,l=t-e;return sf.map(o,0,1,e+s*l,e+a*l)}}o.forEach((function(e){const o=e.length();h?(a.push(e.scale(f(t,i,d,u,o))),c.push(e.scale(f(-n,-r,d,u,o)))):(a.push(e.scale(t)),c.push(e.scale(-n))),u+=o})),c=c.map((function(e){return l=e.points,l[3]?e.points=[l[3],l[2],l[1],l[0]]:e.points=[l[2],l[1],l[0]],e})).reverse();const p=a[0].points[0],m=a[s-1].points[a[s-1].points.length-1],v=c[s-1].points[c[s-1].points.length-1],g=c[0].points[0],y=sf.makeline(v,p),b=sf.makeline(m,g),k=[y].concat(a).concat([b]).concat(c);return new af(k)}outlineshapes(e,t,n){t=t||e;const i=this.outline(e,t).curves,r=[];for(let e=1,t=i.length;e<t/2;e++){const o=sf.makeshape(i[e],i[t-e],n);o.startcap.virtual=e>1,o.endcap.virtual=e<t/2-1,r.push(o)}return r}intersects(t,n){return t?t.p1&&t.p2?this.lineIntersects(t):(t instanceof e&&(t=t.reduce()),this.curveintersects(this.reduce(),t,n)):this.selfintersects(n)}lineIntersects(e){const t=cf(e.p1.x,e.p2.x),n=cf(e.p1.y,e.p2.y),i=uf(e.p1.x,e.p2.x),r=uf(e.p1.y,e.p2.y);return sf.roots(this.points,e).filter((e=>{var o=this.get(e);return sf.between(o.x,t,i)&&sf.between(o.y,n,r)}))}selfintersects(e){const t=this.reduce(),n=t.length-2,i=[];for(let r,o,s,a=0;a<n;a++)o=t.slice(a,a+1),s=t.slice(a+2),r=this.curveintersects(o,s,e),i.push(...r);return i}curveintersects(e,t,n){const i=[];e.forEach((function(e){t.forEach((function(t){e.overlaps(t)&&i.push({left:e,right:t})}))}));let r=[];return i.forEach((function(e){const t=sf.pairiteration(e.left,e.right,n);t.length>0&&(r=r.concat(t))})),r}arcs(e){return e=e||.5,this._iterate(e,[])}_error(e,t,n,i){const r=(i-n)/4,o=this.get(n+r),s=this.get(i-r),a=sf.dist(e,t),l=sf.dist(e,o),c=sf.dist(e,s);return lf(l-a)+lf(c-a)}_iterate(e,t){let n,i=0,r=1;do{n=0,r=1;let o,s,a,l,c,u=this.get(i),d=!1,h=!1,f=r,p=1;do{if(h=d,l=a,f=(i+r)/2,o=this.get(f),s=this.get(r),a=sf.getccenter(u,o,s),a.interval={start:i,end:r},d=this._error(a,u,i,r)<=e,c=h&&!d,c||(p=r),d){if(r>=1){if(a.interval.end=p=1,l=a,r>1){let e={x:a.x+a.r*df(a.e),y:a.y+a.r*hf(a.e)};a.e+=sf.angle({x:a.x,y:a.y},e,this.get(1))}break}r+=(r-i)/2}else r=f}while(!c&&n++<100);if(n>=100)break;l=l||a,t.push(l),i=p}while(r<1);return t}};var gf={pointsToCurve:function(e,t){let n=1/t;if(0===e.length){let e=[];for(let i=0;i<t;i++){let t=i*n;e.push({x:t,y:.5})}return e}if(1===e.length){let i=e[0].y,r=[{x:0,y:i}];for(let e=0;e<t;e++){let t=e*n+n;r.push({x:t,y:i})}return r}let i=[],r=e[0],o=e[e.length-1],s=new vf({x:o.x-1,y:o.y},{x:o.x-1+(r.x-(o.x-1))/2,y:o.y},{x:r.x-(r.x-(o.x-1))/2,y:r.y},r),a=new vf(o,{x:o.x+(r.x+1-o.x)/2,y:o.y},{x:r.x+1-(r.x+1-o.x)/2,y:r.y},{x:r.x+1,y:r.y});for(let t=0;t<e.length-1;t++){let n=e[t],r=e[t+1],o={x:n.x+(r.x-n.x)/2,y:n.y},s={x:r.x-(r.x-n.x)/2,y:r.y},a=new vf(n,o,s,r);i.push(a)}i.unshift(s),i.push(a);let l=[s.get(s.intersects({p1:{x:0,y:0},p2:{x:0,y:1}})[0])];for(let e=0;e<t;e++){let t,r=e*n+n;i.every((e=>{let n=e.intersects({p1:{x:r,y:0},p2:{x:r,y:1}});return!(n.length>0&&(t=e.get(n[0]),l.push(t),1))}))}return l}};class yf{constructor(e,t){this.xs=e,this.ys=t,this.ks=this.getNaturalKs(new Float64Array(this.xs.length))}getNaturalKs(e){const t=this.xs.length-1,n=function(e,t){const n=[];for(let i=0;i<e;i++)n.push(new Float64Array(t));return n}(t+1,t+2);for(let e=1;e<t;e++)n[e][e-1]=1/(this.xs[e]-this.xs[e-1]),n[e][e]=2*(1/(this.xs[e]-this.xs[e-1])+1/(this.xs[e+1]-this.xs[e])),n[e][e+1]=1/(this.xs[e+1]-this.xs[e]),n[e][t+1]=3*((this.ys[e]-this.ys[e-1])/((this.xs[e]-this.xs[e-1])*(this.xs[e]-this.xs[e-1]))+(this.ys[e+1]-this.ys[e])/((this.xs[e+1]-this.xs[e])*(this.xs[e+1]-this.xs[e])));return n[0][0]=2/(this.xs[1]-this.xs[0]),n[0][1]=1/(this.xs[1]-this.xs[0]),n[0][t+1]=3*(this.ys[1]-this.ys[0])/((this.xs[1]-this.xs[0])*(this.xs[1]-this.xs[0])),n[t][t-1]=1/(this.xs[t]-this.xs[t-1]),n[t][t]=2/(this.xs[t]-this.xs[t-1]),n[t][t+1]=3*(this.ys[t]-this.ys[t-1])/((this.xs[t]-this.xs[t-1])*(this.xs[t]-this.xs[t-1])),function(e,t){const n=e.length;let i=0,r=0;for(;i<n&&r<=n;){let t=0,o=-1/0;for(let s=i;s<n;s++){const n=Math.abs(e[s][r]);n>o&&(t=s,o=n)}if(0===e[t][r])r++;else{bf(e,i,t);for(let t=i+1;t<n;t++){const o=e[t][r]/e[i][r];e[t][r]=0;for(let s=r+1;s<=n;s++)e[t][s]-=e[i][s]*o}i++,r++}}for(let i=n-1;i>=0;i--){var o=0;e[i][i]&&(o=e[i][n]/e[i][i]),t[i]=o;for(let t=i-1;t>=0;t--)e[t][n]-=e[t][i]*o,e[t][i]=0}return t}(n,e)}getIndexBefore(e){let t=0,n=this.xs.length,i=0;for(;t<n;)i=Math.floor((t+n)/2),this.xs[i]<e&&i!==t?t=i:n=this.xs[i]>=e&&i!==n?i:t;return t===this.xs.length-1?this.xs.length-1:t+1}at(e){let t=this.getIndexBefore(e);const n=(e-this.xs[t-1])/(this.xs[t]-this.xs[t-1]),i=this.ks[t-1]*(this.xs[t]-this.xs[t-1])-(this.ys[t]-this.ys[t-1]),r=-this.ks[t]*(this.xs[t]-this.xs[t-1])+(this.ys[t]-this.ys[t-1]);return(1-n)*this.ys[t-1]+n*this.ys[t]+n*(1-n)*(i*(1-n)+r*n)}}function bf(e,t,n){let i=e[t];e[t]=e[n],e[n]=i}function kf(e,t,n){const i=n[0],r=n[n.length-1];if(e<i.x)return i.y;if(e>r.x)return r.y;const o=t.at(e);return Math.max(0,Math.min(o,1))}var wf={pointsToCurve:function(e,t){if(!Array.isArray(e)||!e.every((e=>"object"==typeof e&&"number"==typeof e.x&&"number"==typeof e.y&&e.x>=0&&e.x<=1&&e.y>=0&&e.y<=1)))throw new Error("[pointsToCurve] Invalid points. Expected array of objects with x and y in [0, 1] range.");if(!("number"==typeof t&&t>=1))throw new Error(`[pointsToCurve] Invalid resolution: ${t}. Expected integer >= 1.`);const n=e.map((e=>e.x)),i=e.map((e=>e.y)),r=new yf(n,i);let o=[];for(let n=0;n<t;n++)o.push(kf(n/(t-1),r,e));return o}};function xf(e,t=256,n={}){return"bezier"===n.type?gf.pointsToCurve(e,t,n):wf.pointsToCurve(e,t)}const _f=[];for(let e=0;e<256;e++)_f[e]=e;class Tf extends Nh{constructor(e){const t={vertex:Uh,fragment:qh},n={uniforms:Nh.getUniformInfo(Tf)};super(Tf.getFilterType(),t,n,e)}static getFilterType(){return"curves"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=[];var n;t=[...e.master||e.points||e.masterPoints?e.master||(n=e.points||e.masterPoints,xf(n,256).map((e=>255*e))):_f],this.uniforms[xh.STATIC_OPTIONS].set(t)}}function If(e,t,n){if("number"!=typeof e||e<0||e>255)throw new Error(`[levels] Invalid black point: ${e}. Expected integer between 0 and 255`);if("number"!=typeof t||t<0||t>255)throw new Error(`[levels] Invalid white point: ${t}. Expected integer between 0 and 255`);if("number"!=typeof n||n<.01||n>9.99)throw new Error(`[levels] Invalid gamma: ${n}. Expected float between 0.01 and 9.99`);if(e>t)throw new Error(`[levels] Invalid black and white points: ${e}, ${t}. Expected black <= white`);let i=[];for(let r=0;r<256;r++){let o;o=r<=e?0:r>=t?255:255*Math.pow((r-e)/(t-e),1/n),i[r]=o}return i}class Ef extends Nh{constructor(e){const t={vertex:Uh,fragment:qh},n={uniforms:Nh.getUniformInfo(Ef)};super(Ef.getFilterType(),t,n,e)}static getFilterType(){return"levels"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=[...If(e.black,e.white,e.gamma)];this.uniforms[xh.STATIC_OPTIONS].set(t)}}const Sf=360,Af=[];for(let e=0;e<Sf;e++)Af[e]=e;class Nf extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Nf)};super(Nf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\n\n// a 360 length array with values for the hue curve\n// this represents a lookup table from a hue value to another hue value\nuniform float staticOptions[360];\n\n// implementation of round (doesn't exist in webgl)\nint round(float val){\n return int(floor(val + 0.5));\n}\n\n// glsl mod doesn't work with negative numbers so\n// this is a safer version that lets us play with negatives > -1.0\nfloat safeMod(float val){\n return mod(val + 1.0, 1.0);\n}\n\n// no dynamic array indexes in webgl\n// see https://stackoverflow.com/questions/30585265/what-can-i-use-as-an-array-index-in-glsl-in-webgl\nfloat getCurveValue(float pixelValue){\n float v;\n for (int k = 0; k < 360; k++) {\n if (k == round(pixelValue * 359.0)){\n v = float(staticOptions[k]) / 359.0;\n }\n }\n return v;\n}\n\n// function source https://www.shadertoy.com/view/4dKcWK\nconst float EPSILON = 1e-10;\n\nvec3 HUEtoRGB(in float hue) {\n // Hue [0..1] to RGB [0..1]\n // See http://www.chilliant.com/rgb2hsv.html\n vec3 rgb = abs(hue * 6. - vec3(3, 2, 4)) * vec3(1, -1, -1) + vec3(-1, 2, 2);\n return clamp(rgb, 0., 1.);\n}\n\nvec3 RGBtoHCV(in vec3 rgb) {\n // RGB [0..1] to Hue-Chroma-Value [0..1]\n // Based on work by Sam Hocevar and Emil Persson\n vec4 p = (rgb.g < rgb.b) ? vec4(rgb.bg, -1., 2. / 3.) : vec4(rgb.gb, 0., -1. / 3.);\n vec4 q = (rgb.r < p.x) ? vec4(p.xyw, rgb.r) : vec4(rgb.r, p.yzx);\n float c = q.x - min(q.w, q.y);\n float h = abs((q.w - q.y) / (6. * c + EPSILON) + q.z);\n return vec3(h, c, q.x);\n}\n\nvec3 HSVtoRGB(in vec3 hsv) {\n // Hue-Saturation-Value [0..1] to RGB [0..1]\n vec3 rgb = HUEtoRGB(hsv.x);\n return ((rgb - 1.) * hsv.y + 1.) * hsv.z;\n}\n\nvec3 HSLtoRGB(in vec3 hsl) {\n // Hue-Saturation-Lightness [0..1] to RGB [0..1]\n vec3 rgb = HUEtoRGB(hsl.x);\n float c = (1. - abs(2. * hsl.z - 1.)) * hsl.y;\n return (rgb - 0.5) * c + hsl.z;\n}\n\nvec3 RGBtoHSV(in vec3 rgb) {\n // RGB [0..1] to Hue-Saturation-Value [0..1]\n vec3 hcv = RGBtoHCV(rgb);\n float s = hcv.y / (hcv.z + EPSILON);\n return vec3(hcv.x, s, hcv.z);\n}\n\nvec3 RGBtoHSL(in vec3 rgb) {\n // RGB [0..1] to Hue-Saturation-Lightness [0..1]\n vec3 hcv = RGBtoHCV(rgb);\n float z = hcv.z - hcv.y * 0.5;\n float s = hcv.y / (1. - abs(z * 2. - 1.) + EPSILON);\n return vec3(hcv.x, s, z);\n}\n\nvoid main() {\n vec4 textureColor = texture2D(first_texture, current_texture_coordinate_2d);\n vec3 inHSL = RGBtoHSL(textureColor.rgb);\n // in the UI hue 0 is cyan and 180 is red\n float shiftedHue = getCurveValue(mod(inHSL.x + 0.5, 1.0));\n vec3 inRGB = HSLtoRGB(vec3(shiftedHue, inHSL.y, inHSL.z));\n\n vec4 finalColor = vec4(inRGB, textureColor.a);\n\n // During the rgb-to-hsl-to-rgb conversion total whites gets clipped on OSX for some reason\n // make sure to retain absolute white (since it has no chroma component)\n if (textureColor.r == 1.0 && textureColor.g == 1.0 && textureColor.b == 1.0){\n finalColor.rgb = vec3(1.0, 1.0, 1.0);\n }\n\n gl_FragColor = finalColor;\n}\n"},t,e)}static getFilterType(){return"hue"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=e.points&&function(e){return xf(e,Sf,{type:"bezier"}).map((e=>{return t=e,((Math.round(t.x*Sf)+180)%Sf+(1-t.y-.5)*Sf+Sf)%Sf;var t}))}(e.points)||Af;this.uniforms[xh.STATIC_OPTIONS].set(t)}}class Mf extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Mf)};super(Mf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\nuniform float staticOptions[2];\n\n//CIE L*a*b* (CIELAB, L* for lightness, a* from green to red, b* from blue to yellow)\n//Source: https://gist.github.com/mattatz/44f081cac87e2f7c8980 (HLSL)\nvec3 rgb2xyz(vec3 c){\n vec3 tmp=vec3(\n (c.r>.04045)?pow((c.r+.055)/1.055,2.4):c.r/12.92,\n (c.g>.04045)?pow((c.g+.055)/1.055,2.4):c.g/12.92,\n (c.b>.04045)?pow((c.b+.055)/1.055,2.4):c.b/12.92\n );\n mat3 mat=mat3(\n .4124,.3576,.1805,\n .2126,.7152,.0722,\n .0193,.1192,.9505\n );\n return 100.*(tmp*mat);\n}\nvec3 xyz2lab(vec3 c){\n vec3 n=c/vec3(95.047,100.,108.883),\n v=vec3(\n (n.x>.008856)?pow(n.x,1./3.):(7.787*n.x)+(16./116.),\n (n.y>.008856)?pow(n.y,1./3.):(7.787*n.y)+(16./116.),\n (n.z>.008856)?pow(n.z,1./3.):(7.787*n.z)+(16./116.)\n );\n return vec3((116.*v.y)-16.,500.*(v.x-v.y),200.*(v.y-v.z));\n}\nvec3 rgb2lab(vec3 c){\n vec3 lab=xyz2lab(rgb2xyz(c));\n return vec3(lab.x/100.,.5+.5*(lab.y/127.),.5+.5*(lab.z/127.));\n}\nvec3 lab2xyz(vec3 c){\n float fy=(c.x+16.)/116.,\n fx=c.y/500.+fy,\n fz=fy-c.z/200.;\n return vec3(\n 95.047*((fx>.206897)?fx*fx*fx:(fx-16./116.)/7.787),\n 100. *((fy>.206897)?fy*fy*fy:(fy-16./116.)/7.787),\n 108.883*((fz>.206897)?fz*fz*fz:(fz-16./116.)/7.787)\n );\n}\nvec3 xyz2rgb(vec3 c){\n mat3 mat=mat3(\n 3.2406,-1.5372,-.4986,\n -.9689, 1.8758, .0415,\n .0557, -.2040,1.0570\n );\n vec3 v=(c/100.0)*mat,\n r=vec3(\n (v.r>.0031308)?((1.055*pow(v.r,(1./2.4)))-.055):12.92*v.r,\n (v.g>.0031308)?((1.055*pow(v.g,(1./2.4)))-.055):12.92*v.g,\n (v.b>.0031308)?((1.055*pow(v.b,(1./2.4)))-.055):12.92*v.b\n );\n return r;\n}\nvec3 lab2rgb(vec3 c){return xyz2rgb(lab2xyz(vec3(100.*c.x,2.*127.*(c.y-.5),2.*127.*(c.z-.5))));}\n\n\nfloat handleMix(float x){\n return pow(x * 2.0 - 1.0, 2.0);\n}\n\nvoid main() {\n vec3 inColor = texture2D(first_texture, current_texture_coordinate_2d).rgb;\n// inColor = vec3(148.0 / 255.0, 99.0 / 255.0, 95.0 / 255.0); // debug\n\n vec3 inLab = rgb2lab(inColor);\n vec3 inRGB ;\n\n// vec2 tempTint = vec2(staticOptions[1], -staticOptions[0]);\n\n// inLab.yz += (tempTint.xy); // * 0.3; // damping of effect\n\n // lab range is 0 to 1, input is -128 to 127\n // lab chromacity zero is 0.5, 0.5 so convert between the ranges\n // y is a, z is b\n inLab.y -= (-staticOptions[1] + 128.0) / 255.0 - 0.5;\n inLab.z -= (staticOptions[0] + 128.0) / 255.0 - 0.5;\n\n inRGB = lab2rgb(inLab);\n\n\n // vec3 mixed = mix(inRGB, inColor, handleMix(inLab.x)); // mid tones\n // vec3 mixed = mix(inRGB, inColor, inLab.x); // only high tones\n vec3 mixed = mix(inRGB, inColor, 0.0); // no mix\n\n gl_FragColor = vec4(mixed,1.0);\n}\n"},t,e)}static getFilterType(){return"whiteBalance"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=e.temperature?e.temperature:0,n=e.tint?e.tint:0;this.uniforms[xh.STATIC_OPTIONS].set([t,n])}}class Ff extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Ff)};super(Ff.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\nuniform float staticOptions[4];\n\n// algorithm from here\n// https://github.com/CeeJayDK/SweetFX/blob/master/Shaders/Vibrance.fx\n\nvoid main() {\n float percentAmount = staticOptions[0];\n float redBalance = staticOptions[1];\n float greenBalance = staticOptions[2];\n float blueBalance = staticOptions[3];\n\n vec3 color = texture2D(first_texture, current_texture_coordinate_2d).rgb;\n vec3 coefLuma = vec3(0.212656, 0.715158, 0.072186);\n\n float luma = dot(coefLuma, color);\n\n float max_color = max(color.r, max(color.g, color.b)); // Find the strongest color\n float min_color = min(color.r, min(color.g, color.b)); // Find the weakest color\n\n float color_saturation = max_color - min_color; // The difference between the two is the saturation\n\n // Extrapolate between luma and original by 1 + (1-saturation) - current\n vec3 coeffVibrance = vec3(redBalance, greenBalance, blueBalance) * percentAmount;\n\n color.r = mix(luma, color.r, 1.0 + (coeffVibrance.r * (1.0 - (sign(coeffVibrance.r) * color_saturation))));\n color.g = mix(luma, color.g, 1.0 + (coeffVibrance.g * (1.0 - (sign(coeffVibrance.g) * color_saturation))));\n color.b = mix(luma, color.b, 1.0 + (coeffVibrance.b * (1.0 - (sign(coeffVibrance.b) * color_saturation))));\n\n\n gl_FragColor = vec4(color, 1.0);\n\n}\n"},t,e)}static getFilterType(){return"vibrance"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=e.amount?e.amount/100*2:0,n=null===e.redBalance?1:e.redBalance,i=null===e.greenBalance?1:e.greenBalance,r=null===e.blueBalance?1:e.blueBalance;this.uniforms[xh.STATIC_OPTIONS].set([t,n,i,r])}}class Cf extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Cf)};super(Cf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\nuniform float staticOptions[1];\n\n// algorithm from here\n// https://github.com/minus34/cesium1/blob/master/Cesium/Shaders/Builtin/Functions/saturation.glsl\n\n/**\n * Adjusts the saturation of a color.\n *\n * @name czm_saturation\n * @glslFunction\n *\n * @param {vec3} rgb The color.\n * @param {float} adjustment The amount to adjust the saturation of the color.\n *\n * @returns {float} The color with the saturation adjusted.\n *\n * @example\n * vec3 greyScale = czm_saturation(color, 0.0);\n * vec3 doubleSaturation = czm_saturation(color, 2.0);\n */\nvec3 czm_saturation(vec3 rgb, float adjustment)\n{\n // Algorithm from Chapter 16 of OpenGL Shading Language\n const vec3 W = vec3(0.2125, 0.7154, 0.0721);\n vec3 intensity = vec3(dot(rgb, W));\n return mix(intensity, rgb, adjustment);\n}\n\n\nvoid main() {\n float amount = staticOptions[0];\n vec3 color = texture2D(first_texture, current_texture_coordinate_2d).rgb;\n gl_FragColor = vec4(czm_saturation(color, amount), 1.0);\n}\n"},t,e)}static getFilterType(){return"saturation"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=null===e.amount?1:e.amount;this.uniforms[xh.STATIC_OPTIONS].set([t])}}class Of extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Of)};super(Of.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float staticOptions[12];\nuniform float runtimeOptions[4];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\n\nfloat roundedBoxSDF(vec2 CenterPosition, vec2 Size, float Radius) {\n return length(max(abs(CenterPosition)-Size+Radius,0.0))-Radius;\n}\n\nvoid main() {\n vec2 srcAR = vec2(runtimeOptions[0]/runtimeOptions[1], 1.0);\n // custom aspect ratio (other than the default 1920/1080)\n // useful for example when doing crop on crop\n if (staticOptions[10] > 0.0) { //\n srcAR.x = staticOptions[10];\n }\n vec2 srcCenter = vec2(staticOptions[0], staticOptions[1]);\n vec2 srcDims = vec2(staticOptions[2], staticOptions[3]);\n vec2 srcTL = vec2(srcCenter.x - srcDims[0] / 2.0, srcCenter.y - srcDims[1] / 2.0); // top left point\n\n vec2 srcDims_AR = srcDims * srcAR;\n vec2 srcTL_AR = srcTL * srcAR;\n\n vec2 vpDims = vec2(runtimeOptions[2], runtimeOptions[3]);\n vec2 vpAR = vec2(vpDims[0]/vpDims[1], 1.0);\n\n vec2 tgtCenter = vec2(staticOptions[4], staticOptions[5]);\n vec2 tgtDims = vec2(staticOptions[6], staticOptions[7]);\n vec2 tgtTL = vec2(tgtCenter.x - tgtDims[0] / 2.0, tgtCenter.y - tgtDims[1] / 2.0);\n\n vec2 tgtDims_AR = tgtDims * vpAR;\n vec2 tgtTL_AR = tgtTL * vpAR;\n\n vec2 pos_AR = current_texture_coordinate_2d * vpAR;\n\n float ratioW = tgtDims_AR[0] / srcDims_AR[0];\n float ratioH = tgtDims_AR[1] / srcDims_AR[1];\n\n float ratio;\n\n // the type of crop fit. 0 - contain, 1 - fill, 3 - stretch\n float fitType = staticOptions[8];\n\n if (fitType == 0.0){\n ratio = ratioW > ratioH ? ratioW : ratioH;\n vec2 tgtDims_OLD_AR = tgtDims_AR;\n tgtDims_AR = srcDims_AR * ratio;\n tgtTL_AR = tgtTL_AR - (tgtDims_AR - tgtDims_OLD_AR) / 2.0;\n } else if (fitType == 1.0){\n ratio = ratioW < ratioH ? ratioW : ratioH;\n vec2 tgtDims_OLD_AR = tgtDims_AR;\n tgtDims_AR = srcDims_AR * ratio;\n tgtTL_AR = tgtTL_AR + (tgtDims_OLD_AR - tgtDims_AR) / 2.0;\n }\n\n vec2 final_pos_AR = (pos_AR - tgtTL_AR) / tgtDims_AR * srcDims_AR + srcTL_AR;\n\n // transform coords back from AR into 0 to 1 range\n vec2 pos = final_pos_AR / srcAR;\n\n // How soft the edges should be . Higher values could be used to simulate a drop shadow.\n float edgeSoftness = staticOptions[11];\n\n // The radius of the corners in pixels\n float radius = staticOptions[9];\n\n float tightDistance = roundedBoxSDF((current_texture_coordinate_2d - tgtCenter) , tgtDims_AR / vpAR / 2.0, 0.0);\n// float distance = roundedBoxSDF((current_texture_coordinate_2d - tgtCenter) * vpAR, tgtDims * vpAR / 2.0, 0.01);\n float distance = roundedBoxSDF((current_texture_coordinate_2d - tgtCenter) * vpDims, (tgtDims * vpDims) / 2.0, radius);\n\n // Smooth the result (free antialiasing).\n float smoothedAlpha = 1.0 - smoothstep(0.0, edgeSoftness * 2.0, distance);\n\n // Return the resultant shape.\n vec4 textureColor = texture2D(first_texture, pos);\n vec4 quadColor = vec4(textureColor.xyz, smoothedAlpha);\n\n // Apply a drop shadow effect.\n// float shadowSoftness = 0.0;\n// vec2 shadowOffset = vec2(0.0, 0.0);\n// float shadowDistance = roundedBoxSDF(pos + shadowOffset, tgtDims_AR / 2.0, radius);\n// float shadowAlpha = 1.0 - smoothstep(-shadowSoftness, shadowSoftness, shadowDistance);\n// vec4 shadowColor = vec4(0.4, 0.4, 0.4, 1.0);\n // gl_FragColor = mix(quadColor, shadowColor, shadowAlpha - smoothedAlpha);\n\n\n // pillarboxing\n if (tightDistance > 0.0 && distance <= 0.0){\n gl_FragColor = vec4(0, 0, 0, 1.0);\n } else {\n gl_FragColor = quadColor;\n }\n\n // debug\n // gl_FragColor = texture2D(first_texture, pos);\n\n}"},t,e)}static getFilterType(){return"crop"}static getInputsCount(){return 1}static getInitialOptions(){return{source:{center:{x:.5,y:.5},width:1,height:1},target:{center:{x:.5,y:.5},width:1,height:1},fitType:"fill",cornerRadius:10,edgeSoftness:0}}getOptionsDisplay(){return[]}static getUniformList(){return[xh.FIRST_TEXTURE,bh,kh]}handleStaticUniforms(e){let t={...Of.getInitialOptions(),...e};const n=Number.parseFloat(t.source.center.x).toFixed(5),i=Number.parseFloat(t.source.center.y).toFixed(5),r=Number.parseFloat(t.source.width).toFixed(5),o=Number.parseFloat(t.source.height).toFixed(5),s=Number.parseFloat(t.target.center.x).toFixed(5),a=Number.parseFloat(t.target.center.y).toFixed(5),l=Number.parseFloat(t.target.width).toFixed(5),c=Number.parseFloat(t.target.height).toFixed(5),u=Number.parseFloat(t.edgeSoftness).toFixed(5),d=t.source.aspectRatio?Number.parseFloat(t.source.aspectRatio).toFixed(5):0;let h;h="fill"===t.fitType?0:"contain"===t.fitType?1:2;const f=Number.parseFloat(t.cornerRadius).toFixed(5);this.uniforms[xh.STATIC_OPTIONS].set([n,i,r,o,s,a,l,c,h,f,d,u])}}class Pf extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Pf)};super(Pf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float staticOptions[4];\nuniform float runtimeOptions[2];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\n\nvoid main() {\n // this is the the texture from the prev shader\n vec4 texture = texture2D(first_texture, current_texture_coordinate_2d);\n vec4 color = vec4(staticOptions[0], staticOptions[1], staticOptions[2], 1.0);\n vec4 blended = mix(texture, color, staticOptions[3]);\n gl_FragColor = blended;\n}"},t,e)}static getFilterType(){return"solid"}static getInputsCount(){return 1}static getInitialOptions(){return{color:{r:.33,g:.66,b:.99,a:1}}}getOptionsDisplay(){return[{properties:["color","r"],type:"slider",minValue:0,maxValue:1,step:.001},{properties:["color","g"],type:"slider",minValue:0,maxValue:1,step:.001},{properties:["color","b"],type:"slider",minValue:0,maxValue:1,step:.001}]}handleStaticUniforms(e){var t;const n=Number.parseFloat(e.color.r).toFixed(5),i=Number.parseFloat(e.color.g).toFixed(5),r=Number.parseFloat(e.color.b).toFixed(5),o=(null!==(t=Number.parseFloat(e.color.a))&&void 0!==t?t:1).toFixed(5);this.uniforms[xh.STATIC_OPTIONS].set([n,i,r,o])}}class Rf extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Rf)};super(Rf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float runtimeOptions[1];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\n\nvoid main() {\n vec4 textureColor = texture2D(first_texture, current_texture_coordinate_2d);\n gl_FragColor = vec4(textureColor.rgb, 1.0);\n}\n"},t,e)}static getFilterType(){return"solidImage"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}}class Df extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Df)};super(Df.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_position = vec4(position_3d.xyz, 1);\n gl_Position = normalize_position;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\n\n//CIE L*a*b* (CIELAB, L* for lightness, a* from green to red, b* from blue to yellow)\n//Source: https://gist.github.com/mattatz/44f081cac87e2f7c8980 (HLSL)\nvec3 rgb2xyz(vec3 c){\n vec3 tmp=vec3(\n (c.r>.04045)?pow((c.r+.055)/1.055,2.4):c.r/12.92,\n (c.g>.04045)?pow((c.g+.055)/1.055,2.4):c.g/12.92,\n (c.b>.04045)?pow((c.b+.055)/1.055,2.4):c.b/12.92\n );\n mat3 mat=mat3(\n .4124,.3576,.1805,\n .2126,.7152,.0722,\n .0193,.1192,.9505\n );\n return 100.*(tmp*mat);\n}\nvec3 xyz2lab(vec3 c){\n vec3 n=c/vec3(95.047,100.,108.883),\n v=vec3(\n (n.x>.008856)?pow(n.x,1./3.):(7.787*n.x)+(16./116.),\n (n.y>.008856)?pow(n.y,1./3.):(7.787*n.y)+(16./116.),\n (n.z>.008856)?pow(n.z,1./3.):(7.787*n.z)+(16./116.)\n );\n return vec3((116.*v.y)-16.,500.*(v.x-v.y),200.*(v.y-v.z));\n}\nvec3 rgb2lab(vec3 c){\n vec3 lab=xyz2lab(rgb2xyz(c));\n return vec3(lab.x/100.,.5+.5*(lab.y/127.),.5+.5*(lab.z/127.));\n}\n\nvoid main() {\n vec3 inColor = texture2D(first_texture, current_texture_coordinate_2d).rgb;\n vec3 inLab = rgb2lab(inColor);\n gl_FragColor = vec4(inLab, 1.0);\n}\n"},t,e)}static getFilterType(){return"lab"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=e.temperature?e.temperature:0,n=e.tint?e.tint:0;this.uniforms[xh.STATIC_OPTIONS].set([t,n])}}class Lf extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Lf)};super(Lf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n} ",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\nuniform float staticOptions[1];\n\nvoid main() {\n float exposureStops = staticOptions[0];\n vec3 color = texture2D(first_texture, current_texture_coordinate_2d).rgb;\n \n // Convert exposure stops to multiplier: pow(2.0, stops)\n float multiplier = pow(2.0, exposureStops);\n \n // Apply exposure adjustment\n vec3 exposedColor = color * multiplier;\n \n gl_FragColor = vec4(exposedColor, 1.0);\n} "},t,e)}static getFilterType(){return"exposure"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=null===e.exposure?0:e.exposure;this.uniforms[xh.STATIC_OPTIONS].set([t])}}var Bf,zf,Wf,$f,jf,Uf,qf,Vf;function Gf(){if($f)return Wf;$f=1;const e=zf?Bf:(zf=1,Bf={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}),t={};for(const n of Object.keys(e))t[e[n]]=n;const n={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};Wf=n;for(const e of Object.keys(n)){if(!("channels"in n[e]))throw new Error("missing channels property: "+e);if(!("labels"in n[e]))throw new Error("missing channel labels property: "+e);if(n[e].labels.length!==n[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:i}=n[e];delete n[e].channels,delete n[e].labels,Object.defineProperty(n[e],"channels",{value:t}),Object.defineProperty(n[e],"labels",{value:i})}function i(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}return n.rgb.hsl=function(e){const t=e[0]/255,n=e[1]/255,i=e[2]/255,r=Math.min(t,n,i),o=Math.max(t,n,i),s=o-r;let a,l;o===r?a=0:t===o?a=(n-i)/s:n===o?a=2+(i-t)/s:i===o&&(a=4+(t-n)/s),a=Math.min(60*a,360),a<0&&(a+=360);const c=(r+o)/2;return l=o===r?0:c<=.5?s/(o+r):s/(2-o-r),[a,100*l,100*c]},n.rgb.hsv=function(e){let t,n,i,r,o;const s=e[0]/255,a=e[1]/255,l=e[2]/255,c=Math.max(s,a,l),u=c-Math.min(s,a,l),d=function(e){return(c-e)/6/u+.5};return 0===u?(r=0,o=0):(o=u/c,t=d(s),n=d(a),i=d(l),s===c?r=i-n:a===c?r=1/3+t-i:l===c&&(r=2/3+n-t),r<0?r+=1:r>1&&(r-=1)),[360*r,100*o,100*c]},n.rgb.hwb=function(e){const t=e[0],i=e[1];let r=e[2];const o=n.rgb.hsl(e)[0],s=1/255*Math.min(t,Math.min(i,r));return r=1-1/255*Math.max(t,Math.max(i,r)),[o,100*s,100*r]},n.rgb.cmyk=function(e){const t=e[0]/255,n=e[1]/255,i=e[2]/255,r=Math.min(1-t,1-n,1-i);return[100*((1-t-r)/(1-r)||0),100*((1-n-r)/(1-r)||0),100*((1-i-r)/(1-r)||0),100*r]},n.rgb.keyword=function(n){const r=t[n];if(r)return r;let o,s=1/0;for(const t of Object.keys(e)){const r=i(n,e[t]);r<s&&(s=r,o=t)}return o},n.keyword.rgb=function(t){return e[t]},n.rgb.xyz=function(e){let t=e[0]/255,n=e[1]/255,i=e[2]/255;return t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92,[100*(.4124*t+.3576*n+.1805*i),100*(.2126*t+.7152*n+.0722*i),100*(.0193*t+.1192*n+.9505*i)]},n.rgb.lab=function(e){const t=n.rgb.xyz(e);let i=t[0],r=t[1],o=t[2];return i/=95.047,r/=100,o/=108.883,i=i>.008856?i**(1/3):7.787*i+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,o=o>.008856?o**(1/3):7.787*o+16/116,[116*r-16,500*(i-r),200*(r-o)]},n.hsl.rgb=function(e){const t=e[0]/360,n=e[1]/100,i=e[2]/100;let r,o,s;if(0===n)return s=255*i,[s,s,s];r=i<.5?i*(1+n):i+n-i*n;const a=2*i-r,l=[0,0,0];for(let e=0;e<3;e++)o=t+1/3*-(e-1),o<0&&o++,o>1&&o--,s=6*o<1?a+6*(r-a)*o:2*o<1?r:3*o<2?a+(r-a)*(2/3-o)*6:a,l[e]=255*s;return l},n.hsl.hsv=function(e){const t=e[0];let n=e[1]/100,i=e[2]/100,r=n;const o=Math.max(i,.01);return i*=2,n*=i<=1?i:2-i,r*=o<=1?o:2-o,[t,100*(0===i?2*r/(o+r):2*n/(i+n)),(i+n)/2*100]},n.hsv.rgb=function(e){const t=e[0]/60,n=e[1]/100;let i=e[2]/100;const r=Math.floor(t)%6,o=t-Math.floor(t),s=255*i*(1-n),a=255*i*(1-n*o),l=255*i*(1-n*(1-o));switch(i*=255,r){case 0:return[i,l,s];case 1:return[a,i,s];case 2:return[s,i,l];case 3:return[s,a,i];case 4:return[l,s,i];case 5:return[i,s,a]}},n.hsv.hsl=function(e){const t=e[0],n=e[1]/100,i=e[2]/100,r=Math.max(i,.01);let o,s;s=(2-n)*i;const a=(2-n)*r;return o=n*r,o/=a<=1?a:2-a,o=o||0,s/=2,[t,100*o,100*s]},n.hwb.rgb=function(e){const t=e[0]/360;let n=e[1]/100,i=e[2]/100;const r=n+i;let o;r>1&&(n/=r,i/=r);const s=Math.floor(6*t),a=1-i;o=6*t-s,1&s&&(o=1-o);const l=n+o*(a-n);let c,u,d;switch(s){default:case 6:case 0:c=a,u=l,d=n;break;case 1:c=l,u=a,d=n;break;case 2:c=n,u=a,d=l;break;case 3:c=n,u=l,d=a;break;case 4:c=l,u=n,d=a;break;case 5:c=a,u=n,d=l}return[255*c,255*u,255*d]},n.cmyk.rgb=function(e){const t=e[0]/100,n=e[1]/100,i=e[2]/100,r=e[3]/100;return[255*(1-Math.min(1,t*(1-r)+r)),255*(1-Math.min(1,n*(1-r)+r)),255*(1-Math.min(1,i*(1-r)+r))]},n.xyz.rgb=function(e){const t=e[0]/100,n=e[1]/100,i=e[2]/100;let r,o,s;return r=3.2406*t+-1.5372*n+-.4986*i,o=-.9689*t+1.8758*n+.0415*i,s=.0557*t+-.204*n+1.057*i,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,r=Math.min(Math.max(0,r),1),o=Math.min(Math.max(0,o),1),s=Math.min(Math.max(0,s),1),[255*r,255*o,255*s]},n.xyz.lab=function(e){let t=e[0],n=e[1],i=e[2];return t/=95.047,n/=100,i/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,[116*n-16,500*(t-n),200*(n-i)]},n.lab.xyz=function(e){let t,n,i;n=(e[0]+16)/116,t=e[1]/500+n,i=n-e[2]/200;const r=n**3,o=t**3,s=i**3;return n=r>.008856?r:(n-16/116)/7.787,t=o>.008856?o:(t-16/116)/7.787,i=s>.008856?s:(i-16/116)/7.787,t*=95.047,n*=100,i*=108.883,[t,n,i]},n.lab.lch=function(e){const t=e[0],n=e[1],i=e[2];let r;return r=360*Math.atan2(i,n)/2/Math.PI,r<0&&(r+=360),[t,Math.sqrt(n*n+i*i),r]},n.lch.lab=function(e){const t=e[0],n=e[1],i=e[2]/360*2*Math.PI;return[t,n*Math.cos(i),n*Math.sin(i)]},n.rgb.ansi16=function(e,t=null){const[i,r,o]=e;let s=null===t?n.rgb.hsv(e)[2]:t;if(s=Math.round(s/50),0===s)return 30;let a=30+(Math.round(o/255)<<2|Math.round(r/255)<<1|Math.round(i/255));return 2===s&&(a+=60),a},n.hsv.ansi16=function(e){return n.rgb.ansi16(n.hsv.rgb(e),e[2])},n.rgb.ansi256=function(e){const t=e[0],n=e[1],i=e[2];return t===n&&n===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(i/255*5)},n.ansi16.rgb=function(e){let t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];const n=.5*(1+~~(e>50));return[(1&t)*n*255,(t>>1&1)*n*255,(t>>2&1)*n*255]},n.ansi256.rgb=function(e){if(e>=232){const t=10*(e-232)+8;return[t,t,t]}let t;return e-=16,[Math.floor(e/36)/5*255,Math.floor((t=e%36)/6)/5*255,t%6/5*255]},n.rgb.hex=function(e){const t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},n.hex.rgb=function(e){const t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let n=t[0];3===t[0].length&&(n=n.split("").map((e=>e+e)).join(""));const i=parseInt(n,16);return[i>>16&255,i>>8&255,255&i]},n.rgb.hcg=function(e){const t=e[0]/255,n=e[1]/255,i=e[2]/255,r=Math.max(Math.max(t,n),i),o=Math.min(Math.min(t,n),i),s=r-o;let a,l;return a=s<1?o/(1-s):0,l=s<=0?0:r===t?(n-i)/s%6:r===n?2+(i-t)/s:4+(t-n)/s,l/=6,l%=1,[360*l,100*s,100*a]},n.hsl.hcg=function(e){const t=e[1]/100,n=e[2]/100,i=n<.5?2*t*n:2*t*(1-n);let r=0;return i<1&&(r=(n-.5*i)/(1-i)),[e[0],100*i,100*r]},n.hsv.hcg=function(e){const t=e[1]/100,n=e[2]/100,i=t*n;let r=0;return i<1&&(r=(n-i)/(1-i)),[e[0],100*i,100*r]},n.hcg.rgb=function(e){const t=e[0]/360,n=e[1]/100,i=e[2]/100;if(0===n)return[255*i,255*i,255*i];const r=[0,0,0],o=t%1*6,s=o%1,a=1-s;let l=0;switch(Math.floor(o)){case 0:r[0]=1,r[1]=s,r[2]=0;break;case 1:r[0]=a,r[1]=1,r[2]=0;break;case 2:r[0]=0,r[1]=1,r[2]=s;break;case 3:r[0]=0,r[1]=a,r[2]=1;break;case 4:r[0]=s,r[1]=0,r[2]=1;break;default:r[0]=1,r[1]=0,r[2]=a}return l=(1-n)*i,[255*(n*r[0]+l),255*(n*r[1]+l),255*(n*r[2]+l)]},n.hcg.hsv=function(e){const t=e[1]/100,n=t+e[2]/100*(1-t);let i=0;return n>0&&(i=t/n),[e[0],100*i,100*n]},n.hcg.hsl=function(e){const t=e[1]/100,n=e[2]/100*(1-t)+.5*t;let i=0;return n>0&&n<.5?i=t/(2*n):n>=.5&&n<1&&(i=t/(2*(1-n))),[e[0],100*i,100*n]},n.hcg.hwb=function(e){const t=e[1]/100,n=t+e[2]/100*(1-t);return[e[0],100*(n-t),100*(1-n)]},n.hwb.hcg=function(e){const t=e[1]/100,n=1-e[2]/100,i=n-t;let r=0;return i<1&&(r=(n-i)/(1-i)),[e[0],100*i,100*r]},n.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},n.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},n.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},n.gray.hsl=function(e){return[0,0,e[0]]},n.gray.hsv=n.gray.hsl,n.gray.hwb=function(e){return[0,100,e[0]]},n.gray.cmyk=function(e){return[0,0,0,e[0]]},n.gray.lab=function(e){return[e[0],0,0]},n.gray.hex=function(e){const t=255&Math.round(e[0]/100*255),n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(n.length)+n},n.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]},Wf}function Hf(){if(Uf)return jf;Uf=1;const e=Gf();function t(e,t){return function(n){return t(e(n))}}function n(n,i){const r=[i[n].parent,n];let o=e[i[n].parent][n],s=i[n].parent;for(;i[s].parent;)r.unshift(i[s].parent),o=t(e[i[s].parent][s],o),s=i[s].parent;return o.conversion=r,o}return jf=function(t){const i=function(t){const n=function(){const t={},n=Object.keys(e);for(let e=n.length,i=0;i<e;i++)t[n[i]]={distance:-1,parent:null};return t}(),i=[t];for(n[t].distance=0;i.length;){const t=i.pop(),r=Object.keys(e[t]);for(let e=r.length,o=0;o<e;o++){const e=r[o],s=n[e];-1===s.distance&&(s.distance=n[t].distance+1,s.parent=t,i.unshift(e))}}return n}(t),r={},o=Object.keys(i);for(let e=o.length,t=0;t<e;t++){const e=o[t];null!==i[e].parent&&(r[e]=n(e,i))}return r}}var Kf=function(){if(Vf)return qf;Vf=1;const e=Gf(),t=Hf(),n={};return Object.keys(e).forEach((i=>{n[i]={},Object.defineProperty(n[i],"channels",{value:e[i].channels}),Object.defineProperty(n[i],"labels",{value:e[i].labels});const r=t(i);Object.keys(r).forEach((e=>{const t=r[e];n[i][e]=function(e){const t=function(...t){const n=t[0];if(null==n)return n;n.length>1&&(t=n);const i=e(t);if("object"==typeof i)for(let e=i.length,t=0;t<e;t++)i[t]=Math.round(i[t]);return i};return"conversion"in e&&(t.conversion=e.conversion),t}(t),n[i][e].raw=function(e){const t=function(...t){const n=t[0];return null==n?n:(n.length>1&&(t=n),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(t)}))})),qf=n}(),Xf=Ru(Kf);class Yf extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Yf)};super(Yf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform float staticOptions[3];\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 blend = texture2D(first_texture, current_texture_coordinate_2d);\n \n vec3 blendRGB = blend.rgb;\n vec3 baseRGB = vec3(staticOptions[0], staticOptions[1], staticOptions[2]);\n \n vec3 limit = step(0.5, blendRGB);\n vec3 mixedRGB = mix(2.0 * baseRGB * blendRGB, 1.0 - 2.0 * (1.0 - baseRGB) * (1.0 - blendRGB), limit);\n \n gl_FragColor = vec4((mixedRGB * blend.a) + ((1.0 - blend.a) * baseRGB), 1);\n}"},t,e)}static getFilterType(){return"hardLight"}static getInputsCount(){return 1}static getInitialOptions(){return{color:"4b0082"}}getOptionsDisplay(){return[{properties:["color"],type:"colorPicker"}]}handleStaticUniforms(e){const t=Xf.hex.rgb(e.color).map((e=>e/255));this.uniforms[xh.STATIC_OPTIONS].set([t[0],t[1],t[2]])}}class Qf extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Qf)};super(Qf.getFilterType(),{vertex:"precision lowp float;\n\nattribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[1];\nuniform float staticOptions[6];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float exposure_value;\n\n\nfloat getCurrentBeizerProgress(vec2 p1, vec2 p2, float t){\n vec2 p0 = vec2(0,0);\n vec2 p3 = vec2(1,1);\n \n vec2 E = mix(p0, p1, t);\n vec2 F = mix(p1, p2, t);\n vec2 G = mix(p2, p3, t);\n\n vec2 H = mix(E, F, t);\n vec2 I = mix(F, G, t);\n\n vec2 P = mix(H, I, t);\n\n return P.y;\n}\n\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n \n // transfrom logic // \n // normalized time range from 0 to 1\n float current_time = runtimeOptions[0];\n float current_power_progress = getCurrentBeizerProgress(\n vec2(staticOptions[2], staticOptions[3]),\n vec2(staticOptions[4], staticOptions[5]),\n current_time\n );\n \n current_texture_coordinate_2d = texture_coordinate_2d;\n exposure_value = mix(staticOptions[0], staticOptions[1], current_power_progress);\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float exposure_value;\n\nvoid main() {\n vec4 texture = texture2D(first_texture, current_texture_coordinate_2d);\n gl_FragColor = vec4((texture.xyz) * (1.0 + exposure_value) , texture.w);\n}\n\n"},t,e)}static getFilterType(){return"exposureTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{properties:{power:{form:0,to:0,ease:[0,0,1,1]}}}}handleStaticUniforms(e){const t=e.properties.power;this.uniforms[xh.STATIC_OPTIONS].set([t.from,t.to,...t.ease])}static getUniformList(){return[xh.FIRST_TEXTURE,wh]}}class Jf extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Jf)};super(Jf.getFilterType(),{vertex:"precision lowp float;\n\nattribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[1];\nuniform float staticOptions[6];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float dipToBlack_value;\n\n\nfloat getCurrentBeizerProgress(vec2 p1, vec2 p2, float t){\n vec2 p0 = vec2(0,0);\n vec2 p3 = vec2(1,1);\n \n vec2 E = mix(p0, p1, t);\n vec2 F = mix(p1, p2, t);\n vec2 G = mix(p2, p3, t);\n\n vec2 H = mix(E, F, t);\n vec2 I = mix(F, G, t);\n\n vec2 P = mix(H, I, t);\n\n return P.y;\n}\n\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n \n // transfrom logic // \n // normalized time range from 0 to 1\n float current_time = runtimeOptions[0];\n float current_power_progress = getCurrentBeizerProgress(\n vec2(staticOptions[2], staticOptions[3]),\n vec2(staticOptions[4], staticOptions[5]),\n current_time\n );\n \n current_texture_coordinate_2d = texture_coordinate_2d;\n dipToBlack_value = mix(staticOptions[0], staticOptions[1], current_power_progress);\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float dipToBlack_value;\n\nvoid main() {\n vec4 texture = texture2D(first_texture, current_texture_coordinate_2d);\n gl_FragColor = vec4(texture.xyz - dipToBlack_value, texture.w);\n}"},t,e)}static getFilterType(){return"dipToBlackTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{}}handleStaticUniforms(e){const t=e.properties.power;this.uniforms[xh.STATIC_OPTIONS].set([t.from,t.to,...t.ease])}static getUniformList(){return[xh.FIRST_TEXTURE,wh]}}class Zf extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(Zf)};super(Zf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[1];\nuniform float staticOptions[16];\n\nvarying vec2 current_texture_coordinate_2d;\n\nfloat getCurrentBeizerProgress(vec2 p1, vec2 p2, float t){\n vec2 p0 = vec2(0,0);\n vec2 p3 = vec2(1,1);\n \n vec2 E = mix(p0, p1, t);\n vec2 F = mix(p1, p2, t);\n vec2 G = mix(p2, p3, t);\n\n vec2 H = mix(E, F, t);\n vec2 I = mix(F, G, t);\n\n vec2 P = mix(H, I, t);\n\n return P.y;\n}\n\n\nvoid main() {\n // time range from 0 to 1\n float current_time = runtimeOptions[0];\n\n // scale X\n float current_scale_x_progress = getCurrentBeizerProgress(\n vec2(staticOptions[4],staticOptions[5]),\n vec2(staticOptions[6],staticOptions[7]),\n current_time\n );\n float currnet_scale_x_value = mix(staticOptions[0], staticOptions[1], current_scale_x_progress);\n\n // scale Y\n float current_scale_y_progress = getCurrentBeizerProgress(\n vec2(staticOptions[4],staticOptions[5]),\n vec2(staticOptions[6],staticOptions[7]),\n current_time\n );\n float currnet_scale_y_value = mix(staticOptions[2], staticOptions[3], current_scale_y_progress);\n\n // translate x\n float current_translate_x_progress = getCurrentBeizerProgress(\n vec2(staticOptions[12],staticOptions[13]),\n vec2(staticOptions[14],staticOptions[15]),\n current_time\n );\n \n float currnet_translate_x_value = mix(staticOptions[8], staticOptions[9], current_translate_x_progress); \n\n // translate y\n float current_translate_y_progress = getCurrentBeizerProgress(\n vec2(staticOptions[12],staticOptions[13]),\n vec2(staticOptions[14],staticOptions[15]),\n current_time\n );\n float currnet_translate_y_value = mix(staticOptions[10], staticOptions[11], current_translate_y_progress); \n\n // See Default vertex shader, we normalize y axis to be -y\n // because of webgl texture coordinates\n currnet_translate_y_value = currnet_translate_y_value * -1.0;\n\n // create matries\n mat4 scaleMatrix;\n scaleMatrix[0] = vec4(currnet_scale_x_value, 0, 0, 0); \n scaleMatrix[1] = vec4(0, currnet_scale_y_value, 0, 0); \n scaleMatrix[2] = vec4(0, 0, 1, 0); \n scaleMatrix[3] = vec4(0, 0, 0, 1); \n\n mat4 translateMatrix;\n translateMatrix[0] = vec4(1, 0, 0, 0); \n translateMatrix[1] = vec4(0, 1, 0, 0); \n translateMatrix[2] = vec4(0, 0, 1, 0); \n translateMatrix[3] = vec4(currnet_translate_x_value, currnet_translate_y_value, 0, 1); \n\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = translateMatrix * scaleMatrix * normalize_poistion;\n // gl_Position = translateMatrix * scaleMatrix * normalize_poistion;\n \n \n current_texture_coordinate_2d = texture_coordinate_2d;\n \n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n gl_FragColor = texture2D(first_texture, current_texture_coordinate_2d);\n}"},t,e)}static getFilterType(){return"transformTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{}}handleStaticUniforms(e){const t=e.properties.scale||{},n=e.properties.translate||{};t.ease=t.ease||[0,0,1,1],n.ease=n.ease||[0,0,1,1],this.uniforms[xh.STATIC_OPTIONS].set([t.from&&t.from.x||1,t.to&&t.to.x||1,t.from&&t.from.y||1,t.to&&t.to.y||1,...t.ease,n.from&&n.from.x||0,n.to&&n.to.x||0,n.from&&n.from.y||0,n.to&&n.to.y||0,...n.ease])}static getUniformList(){return[xh.FIRST_TEXTURE,wh]}}class ep extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(ep)};super(ep.getFilterType(),{vertex:"precision lowp float;\n\nattribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float staticOptions[8];\nuniform float runtimeOptions[3];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float current_power_value;\n\nfloat getCurrentBeizerProgress(vec2 p1, vec2 p2, float t){\n vec2 p0 = vec2(0,0);\n vec2 p3 = vec2(1,1);\n \n vec2 E = mix(p0, p1, t);\n vec2 F = mix(p1, p2, t);\n vec2 G = mix(p2, p3, t);\n\n vec2 H = mix(E, F, t);\n vec2 I = mix(F, G, t);\n\n vec2 P = mix(H, I, t);\n\n return P.y;\n}\n\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n float current_time = runtimeOptions[0];\n float current_power_progress = getCurrentBeizerProgress(\n vec2(staticOptions[2],staticOptions[3]),\n vec2(staticOptions[4],staticOptions[5]),\n current_time\n );\n \n // varing\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_power_value = mix(staticOptions[0], staticOptions[1], current_power_progress);\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform float staticOptions[8];\nuniform float runtimeOptions[3];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float current_power_value;\n\nconst int samples = 12; //multiple of 2\n\nvoid main() {\n vec2 pixel = vec2(1.0/runtimeOptions[1], 1.0/runtimeOptions[2]);\n vec2 direction = vec2(staticOptions[6], staticOptions[7]);\n \n vec4 color = vec4(0.0); \n\n for (int i=1; i<=samples/2; i++) {\n vec2 motion = float(i) * current_power_value / float(samples / 2) * direction * pixel;\n \n color += texture2D(\n first_texture,\n current_texture_coordinate_2d + motion);\n\n color += texture2D(\n first_texture,\n current_texture_coordinate_2d - motion);\n }\n\t\n color = color/float(samples);\n\n \n gl_FragColor = color;\n // gl_FragColor = vec4(0,1,0,1);\n \n}"},t,e)}static getFilterType(){return"motionBlurTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{}}handleStaticUniforms(e){const t=e.properties.power||{from:0,to:0},n=e.properties.direction||{x:0,y:0};t.ease=t.ease||[0,0,1,1],this.uniforms[xh.STATIC_OPTIONS].set([t.from,t.to,...t.ease,n.x,n.y])}static getUniformList(){return[xh.FIRST_TEXTURE,wh,bh]}}class tp extends Nh{constructor(e){const t={uniforms:Nh.getUniformInfo(tp)};super(tp.getFilterType(),{vertex:"precision lowp float;\n\nattribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[1];\nuniform float staticOptions[9];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float current_power_value;\n\nfloat getCurrentBeizerProgress(vec2 p1, vec2 p2, float t){\n vec2 p0 = vec2(0,0);\n vec2 p3 = vec2(1,1);\n \n vec2 E = mix(p0, p1, t);\n vec2 F = mix(p1, p2, t);\n vec2 G = mix(p2, p3, t);\n\n vec2 H = mix(E, F, t);\n vec2 I = mix(F, G, t);\n\n vec2 P = mix(H, I, t);\n\n return P.y;\n}\n\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n float current_time = runtimeOptions[0];\n float current_power_progress = getCurrentBeizerProgress(\n vec2(staticOptions[2],staticOptions[3]),\n vec2(staticOptions[4],staticOptions[5]),\n current_time\n );\n \n // varing\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_power_value = mix(staticOptions[0], staticOptions[1], current_power_progress);\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform float staticOptions[9];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float current_power_value;\n\nvoid main() {\n vec4 texture = texture2D(first_texture, current_texture_coordinate_2d);\n vec4 fadeColor = vec4(staticOptions[6], staticOptions[7], staticOptions[8], 1.0) ;\n gl_FragColor = mix(texture,fadeColor, current_power_value);\n}"},t,e)}static getFilterType(){return"fadeToColorTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{properties:{power:{form:0,to:0,ease:[0,0,1,1]},color:"#FFFFFF"}}}handleStaticUniforms(e){const t=e.properties.power||{from:0,to:0};t.ease=t.ease||[0,0,1,1];const n=e.properties.color,i=Xf.hex.rgb(n).map((e=>e/255));this.uniforms[xh.STATIC_OPTIONS].set([t.from,t.to,...t.ease,i[0],i[1],i[2]])}static getUniformList(){return[xh.FIRST_TEXTURE,wh]}}var np=Object.freeze({__proto__:null,Crop:Of,Curves:Tf,Default:class e extends Nh{constructor(t){const n={uniforms:Nh.getUniformInfo(e)};super(e.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n // we need to flip y poisiton bacause webgl display the canvas\n // with 0,0 being the bottom left corner \n // insted of the traditional top left\n float flip_y_position = position_3d.y * (-1.0);\n vec4 normalize_poistion = vec4(position_3d.x, flip_y_position, position_3d.z, 1);\n \n gl_Position = normalize_poistion;\n \n current_texture_coordinate_2d = texture_coordinate_2d;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n gl_FragColor = texture2D(first_texture, current_texture_coordinate_2d);\n}"},n,t)}static getFilterType(){return"__default"}static getInputsCount(){return 1}static getInitialOptions(){return{}}},DipToBlackTransition:Jf,DirectionalBlur:Bh,Exposure:Lf,ExposureTransition:Qf,FadeToColorTransition:tp,FastBlur:Lh,HardLight:Yf,HorizontalBlur:Rh,Hue:Nf,Lab:Df,Levels:Ef,Lut:jh,MotionBlurTransition:ep,Opacity:zh,Saturation:Cf,ShapeComposite:$h,ShapeCompositeMask:Wh,Solid:Pf,SolidImage:Rf,Transform:class e extends Nh{constructor(t){const n={uniforms:Nh.getUniformInfo(e)};super(e.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform mat4 first_mat4;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xy, 1, 1);\n\n gl_Position = first_mat4 * normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n gl_FragColor = texture2D(first_texture, current_texture_coordinate_2d);\n // gl_FragColor = vec4(256,0,0,1);\n}"},n,t)}static getFilterType(){return"transform"}static getInputsCount(){return 1}static getInitialOptions(){return{translate:{x:0,y:0},scale:{x:1,y:1},rotate:0}}getOptionsDisplay(){return[{properties:["translate","x"],type:"slider",minValue:-2,maxValue:2,step:.001,initialValue:e.getInitialOptions().translate.x},{properties:["translate","y"],type:"slider",minValue:-2,maxValue:2,step:.001,initialValue:e.getInitialOptions().translate.y},{properties:["scale","x"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:e.getInitialOptions().scale.x},{properties:["scale","y"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:e.getInitialOptions().scale.y},{properties:["rotate"],type:"slider",minValue:-360,maxValue:360,step:1,initialValue:e.getInitialOptions().rotate}]}static getUniformList(){return[xh.FIRST_TEXTURE,xh.FIRST_MATRIX]}handleStaticUniforms(e){if(!e||!e.translate||!e.scale)throw new Error(`bad options object for Transform filter, check ${e}`);const t=Number.parseFloat(e.translate.x).toFixed(7),n=-1*Number.parseFloat(e.translate.y).toFixed(7),i=Number.parseFloat(e.scale.x).toFixed(7),r=Number.parseFloat(e.scale.y).toFixed(7),o=e.rotate||0;var s;this.transformMatrix=function(e,t,n,i){var r=t[0],o=t[1],s=t[2],a=t[3],l=r+r,c=o+o,u=s+s,d=r*l,h=r*c,f=r*u,p=o*c,m=o*u,v=s*u,g=a*l,y=a*c,b=a*u,k=i[0],w=i[1],x=i[2];return e[0]=(1-(p+v))*k,e[1]=(h+b)*k,e[2]=(f-y)*k,e[3]=0,e[4]=(h-b)*w,e[5]=(1-(d+v))*w,e[6]=(m+g)*w,e[7]=0,e[8]=(f+y)*x,e[9]=(m-g)*x,e[10]=(1-(d+p))*x,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}((s=new Fh(16),Fh!=Float32Array&&(s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[11]=0,s[12]=0,s[13]=0,s[14]=0),s[0]=1,s[5]=1,s[10]=1,s[15]=1,s),function(e,t,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"zyx",o=Math.PI/360;t*=o,i*=o,n*=o;var s=Math.sin(t),a=Math.cos(t),l=Math.sin(n),c=Math.cos(n),u=Math.sin(i),d=Math.cos(i);switch(r){case"xyz":e[0]=s*c*d+a*l*u,e[1]=a*l*d-s*c*u,e[2]=a*c*u+s*l*d,e[3]=a*c*d-s*l*u;break;case"xzy":e[0]=s*c*d-a*l*u,e[1]=a*l*d-s*c*u,e[2]=a*c*u+s*l*d,e[3]=a*c*d+s*l*u;break;case"yxz":e[0]=s*c*d+a*l*u,e[1]=a*l*d-s*c*u,e[2]=a*c*u-s*l*d,e[3]=a*c*d+s*l*u;break;case"yzx":e[0]=s*c*d+a*l*u,e[1]=a*l*d+s*c*u,e[2]=a*c*u-s*l*d,e[3]=a*c*d-s*l*u;break;case"zxy":e[0]=s*c*d-a*l*u,e[1]=a*l*d+s*c*u,e[2]=a*c*u+s*l*d,e[3]=a*c*d-s*l*u;break;case"zyx":e[0]=s*c*d-a*l*u,e[1]=a*l*d+s*c*u,e[2]=a*c*u-s*l*d,e[3]=a*c*d+s*l*u;break;default:throw new Error("Unknown angle order "+r)}return e}(Ph(),0,0,o),Oh(t,n,0),Oh(i,r,1)),this.uniforms[xh.FIRST_MATRIX].set(this.transformMatrix)}},TransformTransition:Zf,VerticalBlur:Dh,Vibrance:Ff,WhiteBalance:Mf});const ip=Object.values(np).reduce(((e,t)=>(e[t.getFilterType()]=t,e)),{});class rp{constructor(e){this.context=e}static getFilterClass(e){return ip[e]}getFilterIds(){return Object.keys(this.filterTypeToInstanceMap)}create(e,t){this.context={...this.context,options:t.options};const n=new ip[e](this.context);if(!n)throw new Error(`${e} is not a atom filter, atomFilter list: `,this.getFilterIds());return n}}const op=wd.PREVIOUS_OUTPUT_PREFIX,sp=Object.values(np).reduce(((e,t)=>(e[t.getFilterType()]={type:t.getFilterType(),options:t.getInitialOptions(),inputs:[...Array(t.getInputsCount())].map(((e,t)=>`${op}${t}`)),outputs:[]},e)),{});var ap,lp,cp=function(){if(lp)return ap;lp=1;var e=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&(n=e,!("[object RegExp]"===(i=Object.prototype.toString.call(n))||"[object Date]"===i||n.$$typeof===t));var n,i},t="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(e,t){return!1!==t.clone&&t.isMergeableObject(e)?s((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function i(e,t,i){return e.concat(t).map((function(e){return n(e,i)}))}function r(e){return Object.keys(e).concat((t=e,Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter((function(e){return Object.propertyIsEnumerable.call(t,e)})):[]));var t}function o(e,t){try{return t in e}catch(e){return!1}}function s(t,a,l){(l=l||{}).arrayMerge=l.arrayMerge||i,l.isMergeableObject=l.isMergeableObject||e,l.cloneUnlessOtherwiseSpecified=n;var c=Array.isArray(a);return c===Array.isArray(t)?c?l.arrayMerge(t,a,l):function(e,t,i){var a={};return i.isMergeableObject(e)&&r(e).forEach((function(t){a[t]=n(e[t],i)})),r(t).forEach((function(r){var l,c;o(l=e,c=r)&&(!Object.hasOwnProperty.call(l,c)||!Object.propertyIsEnumerable.call(l,c))||(o(e,r)&&i.isMergeableObject(t[r])?a[r]=function(e,t){if(!t.customMerge)return s;var n=t.customMerge(e);return"function"==typeof n?n:s}(r,i)(e[r],t[r],i):a[r]=n(t[r],i))})),a}(t,a,l):n(a,l)}return s.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return s(e,n,t)}),{})},ap=s}(),up=Ru(cp),dp=function(e,t){return up(e,t,{arrayMerge:(e,t)=>t})};const hp=wd.MESSAGES.UPDATE_OPTIONS;let fp=class{constructor(e,t){this.eventEmitter=new Ed,this.type=e,this.inputs=t.inputs,this.outputs=t.outputs,this.options=t.options}render(){throw new Error("concrete class should implement")}_updateOptions(){throw new Error("concrete class should implement")}updateOptions(e){this._updateOptions(e),this.eventEmitter.emit(hp,this.options)}updateInputs(e){e&&(this.inputs.length===e.length&&this.inputs.every(((t,n)=>t===e[n]))||(this.inputs=[...e]))}getEventEmitter(){return this.eventEmitter}getType(){return this.type}getInputs(){return this.inputs}getOutputs(){return this.outputs}getOptions(){return this.options}getInfo(){return{inputs:this.inputs,outputs:this.outputs,options:this.options}}getOptionsDisplay(){return this.filter.getOptionsDisplay()}dispose(){throw new Error("concrete class should implement")}};class pp extends fp{constructor(e,t,n){super(...arguments),this.filter=n.filterFactory.create(this.type,{options:this.options})}render(e){const t=e.ioStore,n=e.graphIOManager,i=this.getInputs(),r=this.getOutputs(),o=t.get(i),s=this.filter.render(o,this.options);return n.setOutputs(t,r,s),s}_updateOptions(e){this.options=dp(this.options,e),this.filter.updateStaticUniforms(this.options)}dispose(){this.filter.dispose()}}const mp=wd.MESSAGES.UPDATE_OPTIONS;let vp=class extends pp{constructor(e,t,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}baseNodeUpdateOptions(e){this.options=dp(this.options,e),this.filter.updateStaticUniforms(this.options)}registerListeners(){this.baseNode.getEventEmitter().on(mp,this.baseNodeUpdateOptions,this)}dispose(){this.filter.dispose(),this.baseNode.getEventEmitter().off(mp,this.baseNodeUpdateOptions,this)}};function gp(e){return null!==e&&"object"==typeof e}function yp(e){if(!gp(e)||(t=e,Array.isArray(t)))return e;var t;const n=Object.keys(e).sort(),i={};return n.forEach((t=>{i[t]=yp(e[t])})),i}function bp(e,t){return null!=e&&e.id&&null!=t&&t.id?e.type===t.type&&e.id===t.id:e.type===t.type}function kp(e,t){const n=[];e.forEach(((e,i)=>{const r=(o=e,t.findIndex((e=>function(e,t){const n=JSON.parse(JSON.stringify(e));return r=JSON.parse(JSON.stringify(t)),gp(i=n)&&gp(r)?JSON.stringify(yp(i))===JSON.stringify(yp(r)):!(!Number.isNaN(i)||!Number.isNaN(r))||i===r;var i,r}(o,e))));var o;if(-1!==r)return void n.push({type:"take",index:r});const s=(a=e,l=i,(c=t)&&c[l]&&bp(a,c[l])?l:c.findIndex((e=>bp(a,e))));var a,l,c;-1===s?n.push({type:"create",newGraphIndex:i}):n.push({type:"update",currentGraphIndex:s,newGraphIndex:i})}));const i=n.reduce(((e,t)=>("take"===t.type?e.push(t.index):"update"===t.type&&e.push(t.currentGraphIndex),e)),[]);return t.reduce(((e,t,n)=>(i.includes(n)||e.push(n),e)),[]).forEach((e=>{n.push({type:"dispose",currentGraphIndex:e})})),n}function wp(e,t,n,i){const r=[];return e.forEach((e=>{switch(e.type){case"take":r.push(n[e.index]);break;case"update":const o=t[e.newGraphIndex].options,s=n[e.currentGraphIndex];s.updateInputs(t[e.newGraphIndex].inputs),s.updateOptions(o),r.push(s);break;case"create":const a=Op.create(t[e.newGraphIndex],i);r.push(a);break;case"dispose":n[e.currentGraphIndex].dispose();break;default:throw new Error("cant apply action type: ",e.type)}})),r}var xp=function(e,t,n,i){const r=e.graph,o=t.graph;if(!(o&&r&&Array.isArray(o)&&Array.isArray(r)))throw new Error("cant apply new composite options",e);return wp(kp(r,o),r,n,i)};class _p extends fp{constructor(e,t,n){super(...arguments),this.context=n,this.nodes=this.createNodes(this.options)}createNodes(e){if(!e||!e.graph)throw new Error("cant create composite node, please supply info.options.graph");return e.graph.map((e=>Op.create(e,this.context)))}render(e){const t=e.ioStore,n=e.graphIOManager;let i=n.getPrevOutput(t);const r=this.outputs;if(this.nodes.length){const e=new Cd(t),r=[];this.nodes.forEach(((t,o)=>{const s={ioStore:e,graphIOManager:n};i=t.render(s),o!==this.nodes.length-1&&r.push(i)})),n.disposeTextures(r,i)}return n.setOutputs(t,r,i),i}getOptionsDisplay(){return[]}_updateOptions(e){this.nodes=xp(e,this.options,this.nodes,this.context),this.options=e}dispose(){this.nodes.forEach((e=>{e.dispose()}))}}const Tp=wd.MESSAGES.UPDATE_OPTIONS;class Ip extends _p{constructor(e,t,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}registerListeners(){this.baseNode.getEventEmitter().on(Tp,this.updateOptions,this)}dispose(){this.nodes.forEach((e=>{e.dispose()})),this.baseNode.getEventEmitter().off(Tp,this.updateOptions,this)}}const Ep=wd.SYSTEM_NODES.TAGS.ATOM,Sp=wd.SYSTEM_NODES.TAGS.FILTER,Ap=wd.SYSTEM_NODES.TAGS.COMPOSITE_FILTER,Np=wd.SYSTEM_NODES.TAGS.TRANSITION_FILTER,Mp=wd.PREVIOUS_OUTPUT_PREFIX,Fp=Object.keys(sp);function Cp(e,t){const n=(i=e.type,sp[i]);var i;return e=dp(n,e),new pp(e.type,e,t)}var Op={create:function(e,t){let n;switch(function(e){let t;return n=e,t=Fp.includes(n)?Ep:e===Ap?Ap:e===Np?Np:Sp,t;var n}((e=JSON.parse(JSON.stringify(e))).type)){case Ep:n=Cp(e,t);break;case Sp:n=function(e,t){const n=function(e,t){const n=t.get(e);if(!n)throw new Error(`no base node, cant resolve type: ${e}`);return n}(e.type,t.nodeStore),i=n.getType(),r=n.getInfo();let o;return e=dp(r,e),t={...t,baseNode:n},o=i===Ap?new Ip(i,e,t):new vp(i,e,t),o}(e,t);break;case Ap:n=function(e,t){const n=e.type;return e=dp({inputs:[`${Mp}0`]},e),new _p(n,e,t)}(e,t);break;case Np:n=function(e,t){const n=e.options.filter;if(!n)throw new Error(`transition filter should supply base filter ${n}`);return e.type=`${n}Transition`,Cp(e,t)}(e,t);break;default:throw new Error("cant create node",e.type)}return n}};const Pp=wd.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS;var Rp=function(e){const t={[Pp]:sp[Pp]};for(const[n,i]of Object.entries(t)){const t=Op.create(i,e);e.nodeStore.set(n,t)}},Dp=function(e,t){for(const[n,i]of Object.entries(e)){const e=Op.create(i,t);t.nodeStore.set(n,e)}};const Lp=wd.CAPTURED_FRAME_PREFIX;class Bp{constructor(e){return this.textureManager=e.textureManager,this.currentFrameTextures={0:this.textureManager.createTexture({type:"frame"})},this.saveInNextFrameTextures=[],this.savedFramesTextures={},this.reservedUnits=new Set([this.currentFrameTextures[0].getUnit()]),{capture:this.capture.bind(this),createCaptureId:this.createCaptureId.bind(this),releaseCaptureId:this.releaseCaptureId.bind(this),getCurrentFrames:this.getCurrentFrames.bind(this),getSavedFrames:this.getSavedFrames.bind(this),isReservedUnit:this.isReservedUnit.bind(this)}}updateCurrentFrame(e,t){t=t||0,this.currentFrameTextures[t].fill(e)}saveFrame(e){0!==this.saveInNextFrameTextures.length&&(this.saveInNextFrameTextures.forEach((t=>{t.fill(e)})),this.saveInNextFrameTextures=[])}capture(e,t){(e.videoHeight>150||e.displayHeight>150)&&(this.updateCurrentFrame(e,t),this.saveFrame(e))}createCaptureId(){const e=this.textureManager.createTexture({type:"frame"});this.saveInNextFrameTextures.push(e);const t=e.getUnit(),n=`${Lp}${t}`;return this.savedFramesTextures[n]=e,this.reservedUnits.add(t),n}releaseCaptureId(e){if("string"!=typeof e)throw new Error("capture id should be string");delete this.saveInNextFrameTextures[e];const t=e.split(":")[1];this.reservedUnits.delete(parseInt(t,10))}getCurrentFrames(){return this.currentFrameTextures}getSavedFrames(){return this.savedFramesTextures}isReservedUnit(e){return this.reservedUnits.has(e)}}const zp=Ju("ShaderGraphApplication","warn"),Wp=wd.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS,$p=Object.freeze({useCanvasSizedFilterTargets:!1,rebindAttributesOnProgramSwitch:!0,forwardContextAttributes:!0});function jp(e={}){const t=null==e?void 0:e.performanceToggles;return t&&"object"==typeof t?{...$p,...t}:{...$p}}class Up{constructor(e,t={}){return this.glSource=e,this.config=t,this.performanceToggles=jp(t),this.isContextLost=!1,this.isRecovering=!1,this.isDisposed=!1,this.pendingNodeOptionUpdates=new Map,this.doInit(e,t)}doInit(e,t){this.source=Md(e),this.performanceToggles=jp(t),this.isDisposed=!1,this.render=this.render.bind(this),this.resizeCanvasSize=this.resizeCanvasSize.bind(this),this.setSrcVidTracks=this.setSrcVidTracks.bind(this),this.onWebGLContextLost=this.onWebGLContextLost.bind(this),this.onForceRender=this.onForceRender.bind(this),this.resizeCanvasSize._shouldPreventDefault=!0;const n=function(e={},t=$p){const n=null!=e&&e.glOptions&&"object"==typeof e.glOptions?{...e.glOptions}:{},i=n.__shaderGraph&&"object"==typeof n.__shaderGraph?n.__shaderGraph:{};return{...n,__shaderGraph:{...i,forwardContextAttributes:!1!==t.forwardContextAttributes}}}(t,this.performanceToggles);return this.gl=this.source.init(this.setSrcVidTracks,this.resizeCanvasSize,n),this.addCanvasListeners(),this.addSourceListeners(),"undefined"!=typeof window&&(window.ekoShaderGraph=this),this.selectedRenderNode=null,this.activeTextures=this.activeTextures||new Set,this.textureManager=new Wd({gl:this.gl,activeTextures:this.activeTextures}),this.capturedFramesManager=new Bp({textureManager:this.textureManager}),this.graphIOManager=new Kd({glSource:e,gl:this.gl,textureManager:this.textureManager,capturedFramesManager:this.capturedFramesManager}),this.frameBufferFactory=new th({gl:this.gl,textureManager:this.textureManager,useCanvasSizedFilterTargets:this.performanceToggles.useCanvasSizedFilterTargets}),this.filterFactory=new rp({gl:this.gl,frameBufferFactory:this.frameBufferFactory,rebindAttributesOnProgramSwitch:this.performanceToggles.rebindAttributesOnProgramSwitch}),this.nodeStore=new Cd,this.ioStore=new Cd,Rp({nodeStore:this.nodeStore,filterFactory:this.filterFactory}),this.addClientNodes(t.nodes,this.isRecovering),t.userWillCallRender||(this.rafId=requestAnimationFrame(this.render)),this.dirtyCanvasSize=!0,{getNodes:this.getNodes.bind(this),addNodes:this.addClientNodes.bind(this),selectNode:this.selectNode.bind(this),addTexture:this.addTexture.bind(this),releaseTexture:this.releaseTexture.bind(this),captureTexture:this.captureTexture.bind(this),disposeTexture:this.disposeTexture.bind(this),updateOptions:this.updateOptions.bind(this),render:this.render,dispose:this.dispose.bind(this)}}getNodes(){return zp.debug("[getNodes]"),this.nodeStore.get()}addClientNodes(e,t=!1){if(zp.debug("[addClientNodes]",e),e&&!t&&(this.addClientNodeInvocations=this.addClientNodeInvocations||[],this.addClientNodeInvocations.push(e)),!t&&this.isContextUnavailable())return;e=e||{};const n=JSON.parse(JSON.stringify(e));Dp(n,{nodeStore:this.nodeStore,filterFactory:this.filterFactory})}addTexture(e,t,n){if(zp.debug("[addTexture]",e,t,n),this.isContextUnavailable())return null;let i=this.textureManager.createTexture({type:t});return i.isStatic=!0,e&&i.fill(e),this.graphIOManager.setTextureSource(this.ioStore,i,n),i}releaseTexture(e){zp.debug("[releaseTexture]",e),this.isContextUnavailable()||this.textureManager.releaseTexture(e)}selectNode(e){if(zp.debug("[selectNode]",e),!this.isContextUnavailable())return this.nodeStore.get(e)||zp.warn("Missing render node",e),void(this.selectedRenderNodeId=e);this.selectedRenderNodeId=e}captureTexture(){return zp.debug("[captureTexture]"),this.isContextUnavailable()?null:this.capturedFramesManager.createCaptureId()}disposeTexture(e){return zp.debug("[disposeTexture]",e),this.isContextUnavailable()||"string"!=typeof e?null:this.capturedFramesManager.releaseCaptureId(e)}setSrcVidTracks(e){this.isContextUnavailable()||this.capturedFramesManager&&this.capturedFramesManager.capture(e)}resizeCanvasSize(e,t,n,i){this.dirtyCanvasSize={width:n,height:i}}isContextUnavailable(){return!!this.isDisposed||!(!this.isRecovering&&!this.isContextLost)||!(!this.gl||"function"!=typeof this.gl.isContextLost)&&this.gl.isContextLost()}queueNodeOptionUpdate(e,t){e&&t&&"object"==typeof t&&(this.pendingNodeOptionUpdates||(this.pendingNodeOptionUpdates=new Map),this.pendingNodeOptionUpdates.set(e,t))}applyPendingNodeOptionUpdates(e=!1){if(!this.pendingNodeOptionUpdates||!this.pendingNodeOptionUpdates.size)return;const t=Array.from(this.pendingNodeOptionUpdates.entries());this.pendingNodeOptionUpdates.clear(),t.forEach((([t,n])=>{try{if(e){const e=this.nodeStore.get(t);if(!e||"function"!=typeof e.updateOptions)return void this.queueNodeOptionUpdate(t,n);try{e.updateOptions(n)}catch(e){zp.error("Failed to apply pending node options",t,e),this.queueNodeOptionUpdate(t,n)}return}this.updateOptions(t,n)}catch(e){zp.error("Failed to apply pending node options",t,e)}}))}render(e={}){var t,n;const{noRaf:i=!1}=e;if(this.isContextUnavailable())return;if(this.dirtyCanvasSize){let{width:e=this.gl.canvas.width,height:t=this.gl.canvas.height}=this.dirtyCanvasSize;Jd(e,t),this.gl.canvas.width=e,this.gl.canvas.height=t,this.textureManager.refreshTextureObjects(),this.gl.viewport(0,0,e,t),this.dirtyCanvasSize=!1}const r=null===(t=this.gl)||void 0===t||null===(t=t.canvas)||void 0===t?void 0:t.width,o=null===(n=this.gl)||void 0===n||null===(n=n.canvas)||void 0===n?void 0:n.height;Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0&&(Jd(r,o),this.gl.viewport(0,0,r,o)),this.graphIOManager.setVideoSources(this.ioStore);let s={ioStore:this.ioStore,graphIOManager:this.graphIOManager};this.renderSelectedNode(s),this.config.onPreRenderToScreen&&this.config.onPreRenderToScreen(),this.renderToCanvas(s),this.config.onPostRenderToScreen&&this.config.onPostRenderToScreen(),this.graphIOManager.disposeAllStore(this.ioStore),s=null,!i&&!this.config.userWillCallRender&&(this.rafId=requestAnimationFrame(this.render))}renderSelectedNode(e){if(!this.selectedRenderNodeId)return;const t=this.nodeStore.get(this.selectedRenderNodeId);t&&"function"==typeof t.render?t.render(e):(zp.warn("Missing selected render node",this.selectedRenderNodeId),this.selectedRenderNodeId=null)}renderToCanvas(e){const t=this.nodeStore.get(Wp);t&&"function"==typeof t.render?t.render(e):zp.warn("Missing render-to-canvas node")}updateOptions(e,t){if(zp.debug("[updateOptions]",e,t),this.isContextUnavailable())return void this.queueNodeOptionUpdate(e,t);const n=this.nodeStore.get(e);if(n&&"function"==typeof n.updateOptions)try{n.updateOptions(t)}catch(n){zp.error("Failed to update node options",e,n),this.queueNodeOptionUpdate(e,t)}else this.queueNodeOptionUpdate(e,t)}addSourceListeners(){var e;"function"==typeof(null===(e=this.source)||void 0===e?void 0:e.on)&&this.source.on("forcerender",this.onForceRender)}removeSourceListeners(){var e;"function"==typeof(null===(e=this.source)||void 0===e?void 0:e.off)&&this.source.off("forcerender",this.onForceRender)}addCanvasListeners(){var e;(null==this||null===(e=this.gl)||void 0===e?void 0:e.canvas)&&(this.config.noWebGLContextLostRecovery||this.gl.canvas.addEventListener("webglcontextlost",this.onWebGLContextLost))}removeCanvasListeners(){var e;(null==this||null===(e=this.gl)||void 0===e?void 0:e.canvas)&&this.gl.canvas.removeEventListener("webglcontextlost",this.onWebGLContextLost)}getNodesOptions(){const e=this.getNodes();let t={};return Object.keys(e).filter((e=>"__default"!==e)).forEach((n=>{t[n]=e[n].options})),t}getDocumentVisibilityPromise(){return new Promise((e=>{"visible"===document.visibilityState&&e();const t=()=>{"visible"===document.visibilityState&&(document.removeEventListener("visibilitychange",t),e())};document.addEventListener("visibilitychange",t)}))}onForceRender(){zp.info("[onForceRender]"),this.render({noRaf:!0})}async onWebGLContextLost(e){if(e&&"function"==typeof e.preventDefault&&e.preventDefault(),this.isDisposed||this.isRecovering)return;this.isContextLost=!0,this.isRecovering=!0;const t=this.getNodesOptions(),n=this.addClientNodeInvocations,i=this.selectedRenderNodeId;cancelAnimationFrame(this.rafId),zp.warn("WebGL context lost - attempting to recover");const r=async()=>{if(this.isDisposed)this.isRecovering=!1;else try{var e;if(await this.getDocumentVisibilityPromise(),this.isDisposed)return void(this.isRecovering=!1);if(this.gl&&"function"==typeof this.gl.isContextLost&&this.gl.isContextLost())return void setTimeout(r,200);this.dispose(!1),this.doInit(this.glSource,this.config),this.textureManager&&"function"==typeof this.textureManager.refreshActiveTextures&&this.textureManager.refreshActiveTextures(),n&&n.length&&n.forEach((e=>{zp.debug("Re-adding client nodes",e),this.addClientNodes(e,!0)})),Object.entries(t).forEach((([e,t])=>{zp.debug("Re-applying node options",e,t);const n=this.nodeStore.get(e);n&&"function"==typeof n.updateOptions&&n.updateOptions(t)})),i&&(this.selectedRenderNodeId=i),this.applyPendingNodeOptionUpdates(!0);const o="function"==typeof(null===(e=this.source)||void 0===e?void 0:e.recover);o&&(zp.debug("Recovering glSource (i.e. seeking/resetting player)"),await this.source.recover()),this.isContextLost=!1,this.isRecovering=!1,o&&this.render()}catch(e){zp.error("Failed to recover WebGL context, retrying",e),setTimeout(r,200)}};await r()}dispose(e=!0){if(this.selectedRenderNode=null,e&&(this.isDisposed=!0,this.isRecovering=!1,this.isContextLost=!1),this.source&&(this.removeSourceListeners(),"function"==typeof this.source.dispose&&this.source.dispose()),this.gl){this.removeCanvasListeners();const t=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS);for(let e=0;e<t;++e)this.gl.activeTexture(this.gl.TEXTURE0+e),this.gl.bindTexture(this.gl.TEXTURE_2D,null),this.gl.bindTexture(this.gl.TEXTURE_CUBE_MAP,null);if(this.gl.bindBuffer(this.gl.ARRAY_BUFFER,null),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,null),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null),this.gl.bindTexture(this.gl.TEXTURE_2D,null),this.gl.bindRenderbuffer(this.gl.RENDERBUFFER,null),e)try{this.gl.getExtension("WEBGL_lose_context").loseContext()}catch(e){console.error(e)}}this.selectedRenderNodeId=null,e&&delete this.addClientNodeInvocations}}class qp{constructor(e={}){this.options=e}get type(){return"stage"}getSignature(){return this.type}build({inputs:e=[]}={}){return{graph:[],outputs:e,signature:this.getSignature()}}}function Vp(e={}){const t={source:{center:{x:.5,y:.5},width:1,height:1},target:{center:{x:.5,y:.5},width:1,height:1},fitType:"fill",cornerRadius:0,edgeSoftness:0},n={...t.source,...e.source||{}},i={...t.target,...e.target||{}};return{...t,...e,source:n,target:i}}class Gp extends qp{get type(){return"retarget"}getSignature(){var e;const t=Array.isArray(null===(e=this.options)||void 0===e?void 0:e.frames)?this.options.frames:[];return`${this.type}:${t.length}`}build({inputs:e=[],stageIndex:t=0}={}){var n;const i=Array.isArray(null===(n=this.options)||void 0===n?void 0:n.frames)?this.options.frames:[];if(!i.length)return{graph:[],outputs:e,signature:this.getSignature()};const r=[],o=[];for(let n=0;n<e.length;n+=1){const s=e[n],a=i[n];if(!a){o.push(s);continue}const l=`retarget-${t}-${n}`;r.push({id:l,type:"crop",inputs:[s],outputs:[l],options:Vp(a)}),o.push(l)}return{graph:r,outputs:o,signature:this.getSignature()}}}class Hp{#A=new Map;constructor(){this.register("retarget",Gp)}register(e,t){e&&"function"==typeof t&&this.#A.set(e,t)}create(e={}){const t="string"==typeof(null==e?void 0:e.type)?e.type:null;if(!t)return null;const n=this.#A.get(t);return n?new n((null==e?void 0:e.options)||{}):null}}class Kp{constructor(e={}){this.params=e}static get panAndScanTarget(){return"pre"}static buildDefaultLayoutGraph(e=[]){const t=e[0]||"__SRC_TEXTURE:0";return{type:"default",signature:`default:${e.length}`,isDynamic:!1,graph:[{type:"opacity",inputs:[t],options:{power:1}}]}}static prepareRenderFrames({frames:e}={}){return Array.isArray(e)?e:[]}static getRenderTiming({timing:e}={}){return e&&"object"==typeof e?e:{}}static resetRenderState(e){}render(e){}}class Xp extends Kp{#N=null;#M=null;static get type(){return"default"}static get aliases(){return["DefaultRenderNode","default"]}static get requiresFrameCadence(){return!1}static buildLayoutGraph({inputs:e=[]}={}){return super.buildDefaultLayoutGraph(e)}static prepareRenderFrames({frames:e}={}){const t=Array.isArray(e)?e:[];if(t.length<=1)return t;const n=t[t.length-1];return n?[n]:t}render(e){var t;const n=(null==e||null===(t=e.visualFramesAvailable)||void 0===t?void 0:t.frames)||[];if(!n.length)return;const i=null==e?void 0:e.shaderGraph,r=null==e?void 0:e.shaderGraphNodeIds;if(!i||"function"!=typeof i.updateOptions||"function"!=typeof i.selectNode)return;const o=null==r?void 0:r.default;if(o)try{const e=n.map(((e,t)=>e?`__SRC_TEXTURE:${t}`:null)).filter(Boolean),t=Xp.buildLayoutGraph({inputs:e}),r=t.signature;this.#N!==r&&(i.updateOptions(o,{graph:t.graph}),this.#N=r),this.#M!==o&&(i.selectNode(o),this.#M=o),i.render({noRaf:!0})}catch(e){}}}var Yp=new WeakMap,Qp=new WeakMap,Jp=new WeakSet;class Zp extends Kp{constructor(...e){super(...e),O(this,Jp),F(this,Yp,null),F(this,Qp,null)}static get type(){return"side-by-side"}static get aliases(){return["SideBySideRenderNode","side-by-side","sidebyside"]}static get requiresFrameCadence(){return!1}static get panAndScanTarget(){return"skip"}static buildLayoutGraph({inputs:e=[]}={}){const t=e.length;if(t<=1)return super.buildDefaultLayoutGraph(e);const n=1/t,i=[],r=e.map(((e,t)=>{const r=(t+.5)*n,o=`slice-${t}`;return i.push({id:`side-by-side-crop-${t}`,type:"crop",inputs:[e],outputs:[o],options:{source:{center:{x:.5,y:.5},width:1,height:1},target:{center:{x:r,y:.5},width:n,height:1},fitType:"fill",cornerRadius:0,edgeSoftness:0}}),o}));let o=r[0];for(let e=1;e<t;e+=1){const t=(e+.5)*n*2-1;i.push({id:`side-by-side-mask-${e}`,type:"shapeCompositeMask",inputs:[r[e],o],outputs:["accum"],options:{type:"box",center:{x:t,y:0},area:{width:n,height:1},radius:0,edgeSoftness:0}}),o="accum"}return{type:Zp.type,signature:`${Zp.type}:${e.length}`,isDynamic:!1,graph:i}}static prepareRenderFrames({frames:e,state:t}={}){const n=Array.isArray(e)?e:[],i=t&&"object"==typeof t?t:{},r=Array.isArray(i.frames)?i.frames:[];if(!n.length&&!r.length)return i.frames=[],i!==t&&t&&"object"==typeof t&&Object.assign(t,i),[];const o=Math.max(n.length,r.length,2),s=Array.from({length:o}),a=n[0]||r[0];for(let e=0;e<o;e+=1)s[e]=n[e]||r[e]||a;return i.frames=s,i!==t&&t&&"object"==typeof t&&Object.assign(t,i),s}static resetRenderState(e){e&&"object"==typeof e&&(e.frames=null)}render(e){var t;const n=(null==e||null===(t=e.visualFramesAvailable)||void 0===t?void 0:t.frames)||[];if(!n.length)return;const i=null==e?void 0:e.shaderGraph,r=null==e?void 0:e.shaderGraphNodeIds;if(!i||"function"!=typeof i.updateOptions||"function"!=typeof i.selectNode)return;const o=null==r?void 0:r.sideBySide;if(o){if(1===n.length){const e=null==r?void 0:r.default;try{A(Jp,this,em).call(this,i,e)}catch(e){}return}try{A(Jp,this,tm).call(this,i,o,n)}catch(e){}}}}function em(e,t){if(!t)return;const n=ot.buildLayoutGraph({inputs:["__SRC_TEXTURE:0"]}),i=n.signature;M(Yp,this)!==i&&(e.updateOptions(t,{graph:n.graph}),C(Yp,this,i)),M(Qp,this)!==t&&(e.selectNode(t),C(Qp,this,t)),e.render({noRaf:!0})}function tm(e,t,n){const i=Array.isArray(n)?n.length:0;if(!t||!i||i<2)return;const r=n.map(((e,t)=>e?`__SRC_TEXTURE:${t}`:null)).filter(Boolean),o=ot.buildLayoutGraph({inputs:r}),s=o.signature;M(Yp,this)!==s&&(e.updateOptions(t,{graph:o.graph}),C(Yp,this,s)),M(Qp,this)!==t&&(e.selectNode(t),C(Qp,this,t)),e.render({noRaf:!0})}function nm(e){const t=Number(e);return Number.isFinite(t)?t<=0?0:t>=1?1:t:0}ot=Zp;class im extends Kp{#N=null;#M=null;#F=null;static get type(){return"cross-fade"}static get aliases(){return["CrossFadeRenderNode","cross-fade","crossfade"]}static get requiresFrameCadence(){return!0}static get panAndScanTarget(){return"pre"}static buildLayoutGraph({inputs:e=[],normalizedTime:t}={}){if(e.length<2)return super.buildDefaultLayoutGraph(e);const n=nm(t),i=[{type:"opacity",inputs:[e[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",e[0]],options:{}}];return{type:im.type,signature:`${im.type}:${e.length}`,isDynamic:!0,graph:i}}static prepareRenderFrames({frames:e,timelineTime:t,active:n}={}){let i=(Array.isArray(e)?e:[]).slice(0,2);if(i.length<2)return i;const r=Number.isFinite(null==n?void 0:n.duration)&&n.duration>0?n.duration:void 0,o=Number.isFinite(null==n?void 0:n.offset)?n.offset:void 0;if(!Number.isFinite(t)||!Number.isFinite(r)||!Number.isFinite(o))return i;const s=nm((t-o)/r);return s<=0?[i[0]]:s>=1?[i[1]]:i}render(e){var t;const n=(null==e||null===(t=e.visualFramesAvailable)||void 0===t?void 0:t.frames)||[];if(!n.length)return;const i=null==e?void 0:e.shaderGraph,r=null==e?void 0:e.shaderGraphNodeIds;if(!i||"function"!=typeof i.updateOptions||"function"!=typeof i.selectNode)return;if(n.length<2){const e=null==r?void 0:r.default;if(!e)return;try{const t="default";if(this.#N!==t){const n=im.buildLayoutGraph({inputs:["__SRC_TEXTURE:0"]});i.updateOptions(e,{graph:n.graph}),this.#N=t}this.#M!==e&&(i.selectNode(e),this.#M=e),i.render({noRaf:!0})}catch(e){}return}const o=null==r?void 0:r.crossFade;if(o)try{const t=["__SRC_TEXTURE:0","__SRC_TEXTURE:1"],n=im.buildLayoutGraph({inputs:t,normalizedTime:null==e?void 0:e.renderNodeNormalizedTime}),r=n.signature,s=Number(null==e?void 0:e.renderNodeNormalizedTime),a=Number.isFinite(s)?s:0;this.#N===r&&this.#F===a||(i.updateOptions(o,{graph:n.graph}),this.#N=r,this.#F=a),this.#M!==o&&(i.selectNode(o),this.#M=o),i.render({noRaf:!0})}catch(e){}}}function rm(e,t,n={}){if("number"==typeof(null==e?void 0:e.nodeDurationOverride)&&Number.isFinite(e.nodeDurationOverride))return e.nodeDurationOverride;const i="function"==typeof(null==n?void 0:n.getNode)?n.getNode:t&&"function"==typeof t.get?e=>t.get(e):null;if(!i)return;const r=i(null==e?void 0:e.nodeId);if(!r)return;const o=r.duration;if("number"!=typeof o||Number.isNaN(o)||!Number.isFinite(o))return;const s="string"!=typeof r.state||"ready"===r.state;if(!0!==(null==n?void 0:n.allowUnready)&&!s)return;if(!(!0!==(null==n?void 0:n.allowUnready)||s||o>0))return;let a=0;"number"==typeof e.nodeOffsetOverride&&Number.isFinite(e.nodeOffsetOverride)&&(a=e.nodeOffsetOverride);const l=o-a;return l>0?l:0}function om(e){return!(!e||!0===e.offsetPending)&&Number.isFinite(e.offset)}function sm(e){return om(e)?e.offset:void 0}function am(e,t,n,i={}){if(!e)return!1;const r=sm(e);if(!Number.isFinite(r))return!1;const o=rm(e,n,i);return Number.isFinite(o)?t>=r&&t<r+o:t>=r}function lm(e=[]){if(!Array.isArray(e))return e;const t=[],n=[];return e.forEach((e=>{om(e)?t.push(e):n.push(e)})),t.sort(((e,t)=>e.offset-t.offset)),e.splice(0,e.length,...t,...n),e}function cm(e=[],t={}){if(!Array.isArray(e)||!e.length)return{updated:!1,resolvedPlacements:[]};const n="function"==typeof t.getPlacementDuration?t.getPlacementDuration:()=>{},i="function"==typeof t.snapPlacementOffset?t.snapPlacementOffset:e=>e,r="function"==typeof t.onResolvedPlacement?t.onResolvedPlacement:null,o=new Map,s=[];if(e.forEach((e=>{null!=e&&e.placementId&&o.set(e.placementId,e),!0===(null==e?void 0:e.offsetPending)&&s.push(e)})),!s.length)return{updated:!1,resolvedPlacements:[]};let a=!1;const l=[];let c=s,u=!0;for(;c.length&&u;){u=!1;const e=[];for(let t=0;t<c.length;t+=1){const s=c[t],d=null==s?void 0:s.offsetAnchorPlacementId;if(!d){e.push(s);continue}const h=o.get(d);if(!h||!0===h.offsetPending){e.push(s);continue}const f=sm(h);if(!Number.isFinite(f)){e.push(s);continue}let p;if("start"===s.offsetAnchorEdge)p=i(f,s);else{const t=n(h);if(!(t>0)){e.push(s);continue}const r=f+t-(Number.isFinite(s.offsetEndSeconds)?s.offsetEndSeconds:0);if(!Number.isFinite(r)){e.push(s);continue}const o=i(r,s);p=!0===s.offsetAnchorIsReference?Math.max(o,r):o}Number.isFinite(p)?(s.offset=p,s.offsetPending=!1,s.offsetAnchorPlacementId=void 0,s.offsetAnchorEdge=void 0,s.offsetAnchorIsReference=void 0,r&&r(s,h,p),l.push(s),a=!0,u=!0):e.push(s)}c=e}return a&&!1!==t.sortPlacements&&lm(e),{updated:a,resolvedPlacements:l}}function um(e){const t=Number(e);return Number.isFinite(t)?t:0}function dm(e,t={}){const n=function(e){const t=Number(e);return Number.isFinite(t)&&t<0?Math.abs(t):0}(e),i=Number.isFinite(null==t?void 0:t.offsetEndSeconds)?t.offsetEndSeconds:n;var r;return{wantsEndOffset:"end"===(r=e)||null==r||n>0||!0===(null==t?void 0:t.offsetPending),endOffsetSeconds:i,endOffsetFromAtSeconds:n}}function hm(e){if("string"!=typeof e)return null;const t=e.trim();if(!t||"end"===t)return null;const n=Number(t);if(Number.isFinite(n))return null;const i=t.split("@"),r=i[0]?i[0].trim():"";if(!r)return null;if(1===i.length)return{placementId:r,anchor:"start"};if(2!==i.length)return null;const o=i[1]?i[1].trim().toLowerCase():"";return"start"!==o&&"end"!==o?null:{placementId:r,anchor:o}}function fm(e=[],t,n,i){if(Array.isArray(e))for(let r=0;r<e.length;r+=1){const o=e[r],s="number"==typeof(null==o?void 0:o.offset)?o.offset:0;if(t<s+("number"==typeof(null==o?void 0:o.duration)&&Number.isFinite(o.duration)?o.duration:Number.POSITIVE_INFINITY)&&s<n)throw new Error(i)}}function pm(e){const t=Number(e);return Number.isFinite(t)&&t>0?t:0}function mm(e){return(null==e?void 0:e.id)||(null==e?void 0:e.nodeId)||null}function vm(e,t){return Array.isArray(e)&&t?e.findIndex((e=>mm(e)===t)):-1}function gm(e,t,n){const i=function(e,t,n){if(!Array.isArray(t)||0===t.length)return null;const i=t.length;if(null==e||"next"===e){const e=vm(t,n);return e>=0?(e+1)%i:0}if("prev"===e){const e=vm(t,n);return e>=0?(e-1+i)%i:i-1}const r=Number(e);return Number.isInteger(r)&&r>=0&&r<i?r:null}(e,t,n);return Number.isInteger(i)?mm(t[i]):null}function ym(e,t,n,i){const r=function(e,t){if(!Array.isArray(e)||e.length<=1)return e||[];const n=function(e){const t=[],n=new Set;return Array.isArray(e)?(e.forEach((e=>{const i=null==e?void 0:e.placementId;i&&!n.has(i)&&(n.add(i),t.push(i))})),t):t}(t);if(!n.length)return e;const i=new Map;e.forEach((e=>{const t=null==e?void 0:e.placementId;t&&!i.has(t)&&i.set(t,e)}));const r=[],o=new Set;return n.forEach((e=>{const t=i.get(e);t&&!o.has(e)&&(o.add(e),r.push(t))})),e.forEach((e=>{const t=null==e?void 0:e.placementId;t&&!o.has(t)&&(o.add(t),r.push(e))})),r}(function(e,t){const n=function(e){const t=Number(null==e?void 0:e.offset),n=Number(null==e?void 0:e.duration),i=n===Number.POSITIVE_INFINITY,r=Number.isFinite(n)&&n>0||i;return Number.isFinite(t)&&r?{start:t,end:i?Number.POSITIVE_INFINITY:t+n}:null}(t);if(!n||!e||!Array.isArray(e.placements))return[];const i=function(e,t){const n=Number(null==e||null===(t=e.settings)||void 0===t?void 0:t.snapToFps);return!Number.isFinite(n)||n<=0?0:.5/n}(e),r=e.placements.filter((t=>{const r=function(e,t){const n=sm(e);if(!Number.isFinite(n))return null;const i="function"==typeof(null==t?void 0:t.getPlacementDuration)?t.getPlacementDuration(e):void 0;return{start:n,end:Number.isFinite(i)&&i>=0?n+i:Number.POSITIVE_INFINITY}}(t,e);return!!r&&r.start<n.end&&r.end>n.start+i}));return r.sort(((e,t)=>sm(e)-sm(t))),r}(t,n),i),o=function(e,t){const n=[],i=new Set;return Array.isArray(e)?(e.forEach((e=>{const r=null==e?void 0:e.nodeId;if(!r||i.has(r))return;const o="function"==typeof(null==t?void 0:t.getNode)?t.getNode(r):null;if(o){const e="object"==typeof o&&null!==o?o.id||o.nodeId?o:{...o,id:r}:{id:r};n.push(e),i.add(r)}})),n):n}(r,t),s=function(e){const t=new Map;return e.forEach((e=>{const n=null==e?void 0:e.placementId,i=null==e?void 0:e.nodeId;n&&i&&(t.has(i)||t.set(i,[]),t.get(i).push(n))})),t}(r),a=Array.isArray(e.nodes)?e.nodes:[];return a.splice(0,a.length,...o),e.nodes=a,e.placements=r,e.nodePlacementMap=s,{nodes:a,placements:r,nodePlacementMap:s}}function bm(e,t,n){if(!Array.isArray(e))return null;if(t){const n=e.find((e=>(null==e?void 0:e.placementId)===t));if(n)return n}return n&&e.find((e=>(null==e?void 0:e.nodeId)===n))||null}function km(e,t){if(!t||!Array.isArray(e))return null;const n=e.find((e=>(null==e?void 0:e.placementId)===t));return(null==n?void 0:n.nodeId)||null}function wm(e,t,n){if(!e||!t)return null;const i=t.get(e);if(!Array.isArray(i)||!i.length)return null;for(let t=0;t<i.length;t+=1){const r=i[t];if(bm(n,r,e))return r}return null}function xm(e){e.initialized=!1,e.activeRenderPlacementId=null,e.nodes=[],e.placements=[],e.nodePlacementMap=null,e.selectedPlacementId=null,e.previousPlacementId=null,e.pendingSwitch=null,e.switchStartTime=null,e.switchDuration=0,e.switchNormalizedTime=void 0,e.switchTo=null,e.countOfConcurrentChannels=null}class _m extends Kp{static get type(){return"switching"}static get aliases(){return["SwitchingRenderNode","switching","switch"]}static get requiresFrameCadence(){return!0}static get panAndScanTarget(){return"pre"}static buildLayoutGraph({inputs:e=[],normalizedTime:t}={}){if(e.length<2)return super.buildDefaultLayoutGraph(e);const n=nm(t),i=[{type:"opacity",inputs:[e[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",e[0]],options:{}}];return{type:_m.type,signature:`${_m.type}:${e.length}`,isDynamic:!0,graph:i}}static getRenderTiming({timing:e,state:t}={}){const n=e&&"object"==typeof e?e:{},i=Number(null==t?void 0:t.switchNormalizedTime);return Number.isFinite(i)?{...n,normalizedTime:nm(i)}:n}static prepareRenderFrames({frames:e,timelineTime:t,timeline:n,active:i,renderNodeParams:r,state:o}={}){const s=Array.isArray(e)?e:[],a=o&&"object"==typeof o?o:{},l=null==i?void 0:i.renderPlacementId;l&&a.activeRenderPlacementId!==l&&(xm(a),a.activeRenderPlacementId=l);const c=null==r?void 0:r.initSwitching,u=ym(a,n,i,s),d=(f=s,Array.isArray(f)?f.length:0),h=a.countOfConcurrentChannels;var f;if(a.countOfConcurrentChannels=d,"function"==typeof c&&(a.switchTo||(a.switchTo=(e,t)=>{const n=km(a.placements,a.selectedPlacementId),i=gm(e,a.nodes,n);if(!i)return;const r={nodeId:i};t&&Object.prototype.hasOwnProperty.call(t,"crossfadeSeconds")&&void 0!==t.crossfadeSeconds&&(r.crossfadeSeconds=t.crossfadeSeconds),a.pendingSwitch=r}),!a.initialized||h!==d)){a.initialized=!0,a.countOfConcurrentChannels=d;try{c({nodes:u.nodes,countOfConcurrentChannels:d,switchTo:a.switchTo})}catch(f){}}if(!a.selectedPlacementId){const e=Number(null==r?void 0:r.initialChannelIndex),t=gm(Number.isInteger(e)&&e>=0?e:0,a.nodes,null);let n=null;if(t&&(n=wm(t,a.nodePlacementMap,s),!n&&a.nodePlacementMap)){const e=a.nodePlacementMap.get(t);Array.isArray(e)&&e.length&&(n=e[0])}a.selectedPlacementId=n||function(e,t){if(Array.isArray(t))for(let i=0;i<t.length;i+=1){var n;const r=null===(n=t[i])||void 0===n?void 0:n.placementId;if(r&&bm(e,r))return r}const i=Array.isArray(e)?e.find((e=>null==e?void 0:e.placementId)):null;return i?i.placementId:null}(s,a.placements)}if(a.pendingSwitch&&Number.isFinite(t)){const e=wm(a.pendingSwitch.nodeId,a.nodePlacementMap,s);if(e){const n=a.selectedPlacementId;a.previousPlacementId=n&&n!==e?n:null,a.selectedPlacementId=e;const i=Object.prototype.hasOwnProperty.call(a.pendingSwitch,"crossfadeSeconds"),o=pm(a.pendingSwitch.crossfadeSeconds),s=pm(null==r?void 0:r.switchCrossfadeSeconds),l=i?o:s;a.switchDuration=l,l>0?a.switchStartTime=t:(a.switchStartTime=null,a.previousPlacementId=null)}a.pendingSwitch=null}let p;if(Number.isFinite(a.switchStartTime)&&a.switchDuration>0&&Number.isFinite(t)){const e=t-a.switchStartTime;e>=a.switchDuration?(a.switchStartTime=null,a.switchDuration=0,a.previousPlacementId=null):e>=0&&(p=nm(e/a.switchDuration))}a.switchNormalizedTime=Number.isFinite(p)?p:void 0;const m=km(a.placements,a.selectedPlacementId),v=bm(s,a.selectedPlacementId,m)||s[0];let g=null;if(Number.isFinite(a.switchNormalizedTime)&&a.previousPlacementId){const e=km(a.placements,a.previousPlacementId),t=km(a.placements,a.selectedPlacementId),n=bm(s,a.previousPlacementId,e),i=bm(s,a.selectedPlacementId,t);n&&i&&(g=[n,i])}return g||(g=v?[v]:s),g}static resetRenderState(e){e&&"object"==typeof e&&xm(e)}}const Tm=[Xp,Zp,im,_m],Im=new Map;function Em(e){if("string"!=typeof e)return null;const t=e.trim();return t?t.toLowerCase():null}function Sm(e){const t=Em(e);return t&&Im.get(t)||null}function Am(e){return Sm(e)||Xp}Tm.forEach((e=>function(e){(function(e){const t=Array.isArray(e.aliases)?e.aliases:[],n=e.type;return(n?[n,...t]:t.slice()).filter((e=>"string"==typeof e&&e.trim().length))})(e).forEach((t=>{const n=Em(t);n&&Im.set(n,e)}))}(e)));class Nm{static get defaultType(){return Xp.type||"default"}static getRenderNodeClass(e){return Sm(e)}static normalizeType(e){const t=Sm(e);return t?t.type:null}static doesRenderNodeTypeRequireFrameCadence(e){const t=Sm(e);return!!t&&!0===t.requiresFrameCadence}static buildLayoutGraph({type:e,inputs:t=[],normalizedTime:n}={}){const i=Am(e);return i&&"function"==typeof i.buildLayoutGraph?i.buildLayoutGraph({inputs:t,normalizedTime:n}):Xp.buildLayoutGraph({inputs:t,normalizedTime:n})}static getPanAndScanTarget(e){const t=Am(e);return"post"===(n=null==t?void 0:t.panAndScanTarget)||"skip"===n?n:"pre";var n}static prepareRenderFrames({type:e,frames:t,timelineTime:n,timeline:i,active:r,renderNodeParams:o,state:s}={}){const a=Am(e);if(a&&"function"==typeof a.prepareRenderFrames){const e=a.prepareRenderFrames({frames:t,timelineTime:n,timeline:i,active:r,renderNodeParams:o,state:s});if(Array.isArray(e))return e}return Array.isArray(t)?t:[]}static getRenderTiming({type:e,timing:t,timelineTime:n,active:i,renderNodeParams:r,state:o}={}){const s=Am(e),a=t&&"object"==typeof t?t:{};if(s&&"function"==typeof s.getRenderTiming){const e=s.getRenderTiming({timing:a,timelineTime:n,active:i,renderNodeParams:r,state:o});if(e&&"object"==typeof e)return{...a,...e}}return a}static resetRenderState(e,t){const n=Am(e);n&&"function"==typeof n.resetRenderState&&n.resetRenderState(t)}static resetAllRenderStates(e){e&&"function"==typeof e.forEach&&e.forEach(((e,t)=>{Nm.resetRenderState(t,e)}))}create(e,t){return e&&"function"==typeof e.render?e:new(Am(e))(t)}}function Mm(e){return Array.isArray(e)?e.filter((e=>e&&"string"==typeof e.type)):[]}function Fm(e,t){return e&&"function"==typeof e.getSignature?e.getSignature():(null==t?void 0:t.type)||"stage"}class Cm{#C;constructor(e){this.#C=e||new Hp}build(e={}){const t=(Array.isArray(null==e?void 0:e.frames)?e.frames:[]).length,n=Array.from({length:t},((e,t)=>`__SRC_TEXTURE:${t}`)),i=Nm.normalizeType(null==e?void 0:e.layoutType)||Nm.defaultType,r=null==e?void 0:e.normalizedTime,o=Mm(null==e?void 0:e.preStages),s=Mm(null==e?void 0:e.postStages),a=[],l=[`layout:${i}`,`inputs:${t}`];let c=n;o.forEach(((t,n)=>{const i=this.#C.create(t);if(!i)return;const r=i.build({inputs:c,stageIndex:n,context:e});Array.isArray(null==r?void 0:r.graph)&&r.graph.length&&a.push(...r.graph),Array.isArray(null==r?void 0:r.outputs)&&r.outputs.length&&(c=r.outputs),l.push(Fm(i,t))}));const u=Nm.buildLayoutGraph({type:i,inputs:c,normalizedTime:r}),d=!(null==u||!u.isDynamic);Array.isArray(null==u?void 0:u.graph)&&u.graph.length&&a.push(...u.graph),l.push((null==u?void 0:u.signature)||`${i}:${c.length}`);let h="__PREVIOUS:0";return s.forEach(((t,n)=>{const i=this.#C.create(t);if(!i)return;const r=i.build({inputs:[h],stageIndex:n,context:e});Array.isArray(null==r?void 0:r.graph)&&r.graph.length&&a.push(...r.graph),h=Array.isArray(null==r?void 0:r.outputs)&&r.outputs.length?r.outputs[0]:"__PREVIOUS:0",l.push(Fm(i,t))})),{graph:a,signature:l.join("|"),isDynamic:d}}}const Om=[0,0,1,1],Pm="zoomInExposure",Rm=["transform","exposure","fadeToColor","dipToBlack"],Dm={zoomInExposure:{filters:{fadeToColor:{duration:150,ease:[1,0,1,0],power:{from:0,to:1},color:"#ffffff"},exposure:!1,transform:{duration:150,ease:[0,.5,.5,1],scale:{from:{x:1,y:1},to:{x:1.1,y:1.1}},translate:{from:{x:0,y:0},to:{x:0,y:0}}}},reverseFilters:{fadeToColor:{duration:700,ease:[0,1,0,1]},exposure:!1,transform:{duration:700,ease:[0,1,0,1]}}},dipToBlack:{filters:{transform:{duration:250,ease:[0,.5,.5,1],scale:{from:{x:1,y:1},to:{x:1.05,y:1.05}},translate:{from:{x:0,y:0},to:{x:0,y:0}}},dipToBlack:{duration:250,ease:[0,.5,.5,1],power:{from:0,to:1}}},reverseFilters:{dipToBlack:{duration:800,ease:[0,1,0,1]}}}};function Lm(e,t=0){const n=Number(e);return Number.isFinite(n)?n:t}function Bm(e,t=Om){return Array.isArray(e)&&e.length>=4?e:t}function zm(e){return"string"==typeof e&&e.trim()?e.trim():"#ffffff"}function Wm(e,t){const n=null==e?void 0:e[t];return!1===n||null==n?null:ed(n)?n:{}}function $m(e={}){let t=0;return Rm.forEach((n=>{const i=Wm(e,n);if(!i)return;const r=Lm(null==i?void 0:i.duration);r>t&&(t=r)})),t}function jm(e,t,n,i,r){const o=[];return Rm.forEach((s=>{const a=Wm(e,s);if(!a)return;const l=function(e,t,n){const i=Lm(null==e?void 0:e.duration);return Number.isFinite(n)&&n>0?i>0&&t>0?i*t:n:i}(a,n,i),c=function(e,t,n,i,r){const o={type:"transition",inputs:["__PREVIOUS:0"],options:{filter:e,startTime:n,duration:i,properties:{}}};if("transform"===e){var s,a,l,c;const e=Bm(null==t?void 0:t.ease),n=(null==t||null===(s=t.scale)||void 0===s?void 0:s.from)||{x:1,y:1},i=(null==t||null===(a=t.scale)||void 0===a?void 0:a.to)||{x:1,y:1},r=(null==t||null===(l=t.translate)||void 0===l?void 0:l.from)||{x:0,y:0},u=(null==t||null===(c=t.translate)||void 0===c?void 0:c.to)||{x:0,y:0};return o.options.properties.scale={from:n,to:i,ease:e},o.options.properties.translate={from:r,to:u,ease:e},o}if("fadeToColor"===e){const e=Bm(null==t?void 0:t.ease),n=(null==t?void 0:t.power)||{from:0,to:1};return o.options.properties.power={from:Lm(null==n?void 0:n.from,0),to:Lm(null==n?void 0:n.to,1),ease:e},o.options.properties.color=zm((null==t?void 0:t.color)||r),o}if("exposure"===e||"dipToBlack"===e){const e=Bm(null==t?void 0:t.ease),n=(null==t?void 0:t.power)||{from:0,to:1};return o.options.properties.power={from:Lm(null==n?void 0:n.from,0),to:Lm(null==n?void 0:n.to,1),ease:e},o}return null}(s,a,t,l,r);c&&o.push(c)})),o}function Um(e=[]){const t=e.map((e=>{const t=JSON.parse(JSON.stringify(e));return null!=t&&t.options&&(t.options.startTime=0),t}));return JSON.stringify(t)}class qm{#O=null;start(e={}){const t=null==e?void 0:e.shaderGraph;if(!t||"function"!=typeof t.captureTexture)return null;const{baseFilters:n,reverseFilters:i}=function(e={}){const t=function(e={}){if(ed(null==e?void 0:e.transition))return e.transition;if("string"==typeof(null==e?void 0:e.transition))return Dm[e.transition]||Dm[Pm];if(ed(null==e?void 0:e.filters)||ed(null==e?void 0:e.reverseFilters))return{filters:e.filters||{},reverseFilters:e.reverseFilters||{}};if("string"==typeof(null==e?void 0:e.filter)){const t=Lm(e.duration)>0?1e3*e.duration:500;return{filters:{[e.filter]:{duration:t,power:{from:0,to:1}}},reverseFilters:{}}}return Dm[Pm]}(e),n=td({},(null==t?void 0:t.filters)||{},ed(null==e?void 0:e.filters)?e.filters:{}),i=function(e={}){const t={};return Object.keys(e).forEach((n=>{const i=e[n];if(!1===i)return void(t[n]=!1);const r=JSON.parse(JSON.stringify(ed(i)?i:{}));Object.values(r).forEach((e=>function(e){if(e&&"object"==typeof e&&"from"in e&&"to"in e){const t=e.from;e.from=e.to,e.to=t}}(e))),t[n]=r})),t}(n),r=td({},(null==t?void 0:t.reverseFilters)||{},ed(null==e?void 0:e.reverseFilters)?e.reverseFilters:{});return{baseFilters:n,reverseFilters:td({},i,r)}}(e),r=Lm(null==e?void 0:e.duration),o=r>0?1e3*r:null,s=$m(n),a=$m(i),l=o&&s>0?o/s:1,c=o&&a>0?o/a:1,u=o||s||500,d=o||a||u,h=zm(null==e?void 0:e.color),f=t.captureTexture(),p=Date.now(),m=jm(n,p,l,o,h);return this.#O={phase:"out",startTime:p,outDurationMs:u,inDurationMs:d,color:h,captureId:f,baseFilters:n,reverseFilters:i,outScale:l,inScale:c,durationOverrideMs:o,outGraph:m,outSignature:Um(m),inGraph:null,inSignature:null},{captureId:f,outDurationMs:u,inDurationMs:d}}beginIncoming(){if(!this.#O)return;const e=Date.now(),t=jm(this.#O.reverseFilters,e,this.#O.inScale,this.#O.durationOverrideMs,this.#O.color);this.#O={...this.#O,phase:"in",startTime:e,inGraph:t,inSignature:Um(t)}}reset(e){var t;e&&"function"==typeof e.disposeTexture&&null!==(t=this.#O)&&void 0!==t&&t.captureId&&e.disposeTexture(this.#O.captureId),this.#O=null}getState(){return this.#O}buildOutgoingGraph(){const e=this.#O;return e&&"out"===e.phase&&Array.isArray(e.outGraph)&&e.outGraph.length?{signature:`transition:out:${e.outSignature||""}`,forceUpdate:!1,graph:e.outGraph}:null}buildIncomingGraph(){const e=this.#O;return e&&"in"===e.phase&&Array.isArray(e.inGraph)&&e.inGraph.length?{signature:`transition:in:${e.inSignature||""}`,forceUpdate:!1,graph:e.inGraph}:null}}let Vm;const Gm=[/firefox\/(\d+)/,/edg\/(\d+)/,/opr\/(\d+)/,/chrome\/(\d+)/];function Hm(){const e=ld&&ld.navigator&&(ld.navigator.userAgent||ld.navigator.platform||ld.navigator.vendor)||"";if(Vm&&Vm.ua===e)return Vm;const t=e.toLowerCase(),n=t.includes("android"),i=t.includes("iphone")||t.includes("ipad")||t.includes("ipod")||t.includes("ios"),r=n||i||t.includes("mobile"),o=!!e&&!r,s=t.includes("firefox/"),a=function(e=""){for(let t=0;t<Gm.length;t+=1){const n=Gm[t],i=e.match(n);if(!i)continue;const r=Number(i[1]);return Number.isFinite(r)?r:null}if(e.includes("safari/")&&e.includes("version/")){const t=e.match(/version\/(\d+)/);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)?n:null}return null}(t);return Vm={ua:e,lowerUA:t,isAndroid:n,isiOS:i,isMobile:r,isDesktop:o,isFirefox:s,browserMajorVersion:a},Vm}function Km(){return Hm().ua}function Xm(){return Hm().isAndroid}function Ym(){return Hm().isiOS}function Qm(){return Hm().isMobile}function Jm(){return Hm().isDesktop}function Zm(){return Hm().isFirefox}function ev(){return Hm().browserMajorVersion}var tv={getUserAgent:Km,isAndroid:Xm,isiOS:Ym,isMobile:Qm,isDesktop:Jm,isFirefox:Zm,getBrowserMajorVersion:ev},nv=Object.freeze({__proto__:null,default:tv,getBrowserMajorVersion:ev,getUserAgent:Km,isAndroid:Xm,isDesktop:Jm,isFirefox:Zm,isMobile:Qm,isiOS:Ym});const iv=Object.freeze({NODE_ADD:"node:add",NODE_CHILDREN_CHANGED:"node:childrenchanged",NODE_LOADED:"node:loaded",NODE_LOAD_ERROR:"node:loaderror",PLACEMENT_ADDED:"placement:added",RENDER_PLACEMENT_ADDED:"renderplacement:added",TIMELINE_TIME_UPDATE:"timeline:timeupdate",TIMELINE_STATE_CHANGE:"statechange",TIMELINE_SEEKING:"seeking",TIMELINE_SEEKED:"seeked",TIMELINE_RESET:"timeline:reset",TIMELINE_PLAYER_STATE:"player:state",TIMELINE_CUEPOINT:"cuepoint",VISUAL_FRAMES_AVAILABLE:"visualframesavailable",TRACK_BUFFER_UPDATE:"track:bufferupdate",TRACK_READY:"track:ready",TRACK_UNDERFLOW:"track:underflow",CLOCK_TICK:"tick",DECODE_READY:"decode:ready",DECODE_ERROR:"decode:error",DECODER_AUDIO:"decoder:audio",DECODER_FRAME:"decoder:frame",DECODER_INIT:"decoder:init",DECODER_ERROR:"decoder:error",QOE_SCORE:"qoescore",QOE_STATUS:"qoestatus",CONTAINER_RESIZE:"containerresize"});function rv(e,t){const n={};return Number.isFinite(e)&&(n.time=e),"string"==typeof t&&(n.source=t),n}function ov({placementId:e,nodeId:t,trackId:n,segmentId:i,trackType:r,pts:o,duration:s,frame:a,audioBuffer:l}={}){const c={};return e&&(c.placementId=e),t&&(c.nodeId=t),n&&(c.trackId=n),i&&(c.segmentId=i),r&&(c.trackType=r),Number.isFinite(o)&&(c.pts=o),Number.isFinite(s)&&(c.duration=s),a&&(c.frame=a),l&&(c.audioBuffer=l),c}function sv({placementId:e,nodeId:t,trackId:n,segmentId:i,trackType:r,error:o}={}){const s={};return e&&(s.placementId=e),t&&(s.nodeId=t),n&&(s.trackId=n),i&&(s.segmentId=i),r&&(s.trackType=r),o&&(s.error=o),s}const av="Idle",lv="Playing",cv="FirstFramePending",uv="Waiting",dv="Paused",hv="Seeking",fv="Resetting";function pv(e){return Array.isArray(e)?e.filter((e=>e&&"string"==typeof e.type)):[]}function mv(e,t){return!!Array.isArray(e)&&e.some((e=>(null==e?void 0:e.type)===t))}function vv(e){const t=Number(e);return!Number.isFinite(t)||t<=0?null:{type:"retarget",options:{frames:Array.from({length:t},(()=>({fitType:"fill"})))},meta:{source:"panAndScan"}}}function gv(e){return Array.isArray(e)?e.filter((e=>{return!("panAndScan"===(null==(t=e)||null===(n=t.meta)||void 0===n?void 0:n.source));var t,n})):[]}const yv=2073600;function bv(e,t){const n=Number(e);return Number.isFinite(n)&&n>0?n:t}function kv(e,t){if(null==e)return t;const n=Number(e);return Number.isFinite(n)?n:t}var wv=new WeakMap,xv=new WeakMap,_v=new WeakMap,Tv=new WeakMap,Iv=new WeakMap,Ev=new WeakMap,Sv=new WeakMap,Av=new WeakMap,Nv=new WeakMap,Mv=new WeakMap,Fv=new WeakMap,Cv=new WeakMap,Ov=new WeakMap,Pv=new WeakMap,Rv=new WeakMap,Dv=new WeakMap,Lv=new WeakMap,Bv=new WeakMap,zv=new WeakMap,Wv=new WeakMap,$v=new WeakMap,jv=new WeakMap,Uv=new WeakMap,qv=new WeakMap,Vv=new WeakMap,Gv=new WeakMap,Hv=new WeakMap,Kv=new WeakMap,Xv=new WeakMap,Yv=new WeakMap,Qv=new WeakSet;class Jv extends od{static get pipelineNodeId(){return"ekoplayer-render-pipeline"}get defaults(){return{defaultRenderParams:void 0,resourceLimits:{enabled:!0,maxCanvasPixels:yv,maxDevicePixelRatio:0,renderScale:1,transitionMinFrameIntervalMs:33}}}constructor(...e){super(...e),O(this,Qv),F(this,wv,void 0),F(this,xv,void 0),F(this,_v,void 0),F(this,Tv,void 0),F(this,Iv,void 0),F(this,Ev,void 0),F(this,Sv,void 0),F(this,Av,void 0),F(this,Nv,void 0),F(this,Mv,void 0),F(this,Fv,null),F(this,Cv,null),F(this,Ov,void 0),F(this,Pv,void 0),F(this,Rv,void 0),F(this,Dv,[]),F(this,Lv,[]),F(this,Bv,null),F(this,zv,null),F(this,Wv,null),F(this,$v,null),F(this,jv,null),F(this,Uv,null),F(this,qv,new Map),F(this,Vv,null),F(this,Gv,null),F(this,Hv,!1),F(this,Kv,!1),F(this,Xv,[]),F(this,Yv,null);const[t,n,i]=e;C(wv,this,t),C(xv,this,n),C(_v,this,i),M(wv,this)&&"function"==typeof M(wv,this).enableFirstFrameRenderedGate&&M(wv,this).enableFirstFrameRenderedGate(),C(Mv,this,new Cm),C(Ov,this,new qm),C(Pv,this,null),C(Rv,this,null),C(Wv,this,null),C(Tv,this,(e=>A(Qv,this,Fg).call(this,e))),M(wv,this)&&"function"==typeof M(wv,this).on&&(M(wv,this).on(iv.VISUAL_FRAMES_AVAILABLE,M(Tv,this)),C(Iv,this,(()=>{var e,t,n,i;A(Qv,this,ng).call(this),A(Qv,this,Eg).call(this,0),C(Lv,this,[]),C(Bv,this,null),C(Fv,this,null),C(Cv,this,null),A(Qv,this,vg).call(this),C(Vv,this,null);(null===(e=M(Ov,this))||void 0===e||null===(t=e.getState)||void 0===t?void 0:t.call(e))||null===(n=M(Ov,this))||void 0===n||null===(i=n.reset)||void 0===i||i.call(n,M(Pv,this))})),M(wv,this).on(iv.TIMELINE_SEEKING,M(Iv,this)),C(Ev,this,(()=>A(Qv,this,ig).call(this))),M(wv,this).on(iv.TIMELINE_RESET,M(Ev,this)),C(Nv,this,(()=>A(Qv,this,kg).call(this))),M(wv,this).on(iv.TIMELINE_TIME_UPDATE,M(Nv,this)),C(Sv,this,(()=>{A(Qv,this,Cg).call(this)&&M(zv,this)&&A(Qv,this,Fg).call(this,M(zv,this))})),M(wv,this).on(iv.TIMELINE_STATE_CHANGE,M(Sv,this))),C(Av,this,(()=>{C(Bv,this,null),M(zv,this)&&A(Qv,this,Cg).call(this)&&A(Qv,this,Fg).call(this,M(zv,this))})),M(_v,this)&&"function"==typeof M(_v,this).on&&M(_v,this).on(iv.CONTAINER_RESIZE,M(Av,this))}get name(){return"Renderer"}onDispose(){M(wv,this)&&M(Tv,this)&&"function"==typeof M(wv,this).off&&M(wv,this).off(iv.VISUAL_FRAMES_AVAILABLE,M(Tv,this)),M(wv,this)&&M(Iv,this)&&"function"==typeof M(wv,this).off&&M(wv,this).off(iv.TIMELINE_SEEKING,M(Iv,this)),M(wv,this)&&M(Ev,this)&&"function"==typeof M(wv,this).off&&M(wv,this).off(iv.TIMELINE_RESET,M(Ev,this)),M(wv,this)&&M(Nv,this)&&"function"==typeof M(wv,this).off&&M(wv,this).off(iv.TIMELINE_TIME_UPDATE,M(Nv,this)),M(wv,this)&&M(Sv,this)&&"function"==typeof M(wv,this).off&&M(wv,this).off(iv.TIMELINE_STATE_CHANGE,M(Sv,this)),M(_v,this)&&M(Av,this)&&"function"==typeof M(_v,this).off&&M(_v,this).off(iv.CONTAINER_RESIZE,M(Av,this)),A(Qv,this,Zv).call(this),C(Tv,this,null),C(Iv,this,null),C(Ev,this,null),C(Nv,this,null),C(Sv,this,null),C(Av,this,null),C(Mv,this,null),C(Ov,this,null),C(qv,this,null),C(Vv,this,null),C(xv,this,null),C(_v,this,null),C(wv,this,null)}startTransition(e={}){var t;const n=null===(t=M(xv,this))||void 0===t?void 0:t.element;if(!n)return null;if(A(Qv,this,og).call(this,n),!M(Pv,this))return null;const i=M(Ov,this).start({shaderGraph:M(Pv,this),duration:null==e?void 0:e.duration,filter:null==e?void 0:e.filter,color:null==e?void 0:e.color,filters:null==e?void 0:e.filters,reverseFilters:null==e?void 0:e.reverseFilters,transition:null==e?void 0:e.transition});return C(Wv,this,M(zv,this)||null),A(Qv,this,Ag).call(this),i}beginTransitionIn(e={}){var t,n;null!==(t=M(Ov,this))&&void 0!==t&&null!==(n=t.beginIncoming)&&void 0!==n&&n.call(t,e),C(Wv,this,null),A(Qv,this,Ag).call(this)}resetTransition(){var e,t;null!==(e=M(Ov,this))&&void 0!==e&&null!==(t=e.reset)&&void 0!==t&&t.call(e,M(Pv,this)),C(Wv,this,null),A(Qv,this,Ng).call(this)}}function Zv(){if(A(Qv,this,ng).call(this),M(Ov,this)&&"function"==typeof M(Ov,this).reset&&M(Ov,this).reset(M(Pv,this)),A(Qv,this,Eg).call(this,0),M(Pv,this)&&"function"==typeof M(Pv,this).dispose)try{M(Pv,this).dispose()}catch(e){}C(Pv,this,null),C(Rv,this,null),C(Dv,this,[]),C(Lv,this,[]),C(Bv,this,null),C(Fv,this,null),C(Cv,this,null),C(zv,this,null),C(Wv,this,null),A(Qv,this,Ng).call(this),A(Qv,this,vg).call(this),C(Vv,this,null)}function eg(){return{schedule:"function"==typeof ld.requestAnimationFrame?ld.requestAnimationFrame.bind(ld):e=>setTimeout(e,16),cancel:"function"==typeof ld.cancelAnimationFrame?ld.cancelAnimationFrame.bind(ld):clearTimeout}}function tg(e){C(Xv,this,M(Xv,this).filter((t=>t!==e))),M(Xv,this).length||C(Yv,this,null)}function ng(){M(Yv,this)&&M(Xv,this).forEach((e=>M(Yv,this).call(this,e))),C(Xv,this,[]),C(Yv,this,null),C(Kv,this,!1)}function ig(){A(Qv,this,ng).call(this),C(Hv,this,!1)}function rg(){if(M(Hv,this)||M(Kv,this))return;const{schedule:e,cancel:t}=A(Qv,this,eg).call(this);let n;C(Yv,this,t),C(Kv,this,!0),n=e((()=>{let t;A(Qv,this,tg).call(this,n),t=e((()=>{A(Qv,this,tg).call(this,t),C(Kv,this,!1),M(Hv,this)||(C(Hv,this,!0),M(wv,this)&&"function"==typeof M(wv,this).notifyFirstFrameRendered&&M(wv,this).notifyFirstFrameRendered())})),M(Xv,this).push(t)})),M(Xv,this).push(n)}function og(e){if(M(Pv,this)||!e)return;const t=this,n={dest:e,src:(e,n)=>{C(Rv,t,n)}};C(Pv,t,new Up(n,{userWillCallRender:!0,glOptions:{contextType:"webgl2"},performanceToggles:{useCanvasSizedFilterTargets:!0}})),M(Pv,t)&&"function"==typeof M(Pv,t).addNodes&&M(Pv,t).addNodes({[st.pipelineNodeId]:{type:"composite",options:{graph:[]}}})}function sg(){var e;const t=null===(e=this.settings)||void 0===e?void 0:e.resourceLimits;return!t||"object"!=typeof t||Array.isArray(t)?{}:t}function ag(){const e=A(Qv,this,sg).call(this).enabled;return!0===e||!1!==e&&Ym()}function lg(){if(!A(Qv,this,ag).call(this))return 0;const e=kv(A(Qv,this,sg).call(this).transitionMinFrameIntervalMs,33);return Number.isFinite(e)&&e>0?e:0}function cg(e,t,n={}){const i=!0===(null==n?void 0:n.useDevicePixelRatio),r=A(Qv,this,ag).call(this),o=i?bv(null==ld?void 0:ld.devicePixelRatio,1):1;let s=o,a=0;if(r){const e=A(Qv,this,sg).call(this);a=kv(e.maxCanvasPixels,yv);const t=kv(e.maxDevicePixelRatio,0);s=bv(e.renderScale,1)*(t>0?Math.min(o,t):o)}let l=Math.max(1,Math.round(e*s)),c=Math.max(1,Math.round(t*s));if(r&&a>0){const e=l*c;if(e>a){const t=Math.sqrt(a/e);l=Math.max(1,Math.floor(l*t)),c=Math.max(1,Math.floor(c*t))}}return{width:l,height:c}}function ug(e=[],t={}){var n;const i=null===(n=M(xv,this))||void 0===n?void 0:n.element,r=M(Rv,this);if(!i||"function"!=typeof r)return!1;let o=0,s=0;const a=!0===(null==t?void 0:t.useViewportSize);if(a){var l,c,u,d,h,f;const e=Number(null!==(l=null===(c=M(_v,this))||void 0===c?void 0:c.containerWidth)&&void 0!==l?l:null===(u=M(_v,this))||void 0===u?void 0:u.width),t=Number(null!==(d=null===(h=M(_v,this))||void 0===h?void 0:h.containerHeight)&&void 0!==d?d:null===(f=M(_v,this))||void 0===f?void 0:f.height);if(Number.isFinite(e)&&Number.isFinite(t)&&e>0&&t>0)o=Math.round(e),s=Math.round(t);else{const e=Number(i.clientWidth),t=Number(i.clientHeight);Number.isFinite(e)&&Number.isFinite(t)&&e>0&&t>0&&(o=Math.round(e),s=Math.round(t))}}if(!(o>0&&s>0)){if(!Array.isArray(e)||!e.length)return;for(let t=0;t<e.length;t+=1){var p;const n=null===(p=e[t])||void 0===p?void 0:p.frame,i=Number((null==n?void 0:n.displayWidth)||(null==n?void 0:n.codedWidth)||(null==n?void 0:n.videoWidth)||(null==n?void 0:n.naturalWidth)||(null==n?void 0:n.width)),r=Number((null==n?void 0:n.displayHeight)||(null==n?void 0:n.codedHeight)||(null==n?void 0:n.videoHeight)||(null==n?void 0:n.naturalHeight)||(null==n?void 0:n.height));!Number.isFinite(i)||!Number.isFinite(r)||i<=0||r<=0||(i>o&&(o=i),r>s&&(s=r))}}if(!(o>0&&s>0))return!1;const m=A(Qv,this,cg).call(this,o,s,{useDevicePixelRatio:a}),v=m.width,g=m.height,y=M(Bv,this);return!(y&&y.width===v&&y.height===g||(C(Bv,this,{width:v,height:g}),r(null,null,v,g),0))}function dg(e){const t=null==e?void 0:e.nodeId,n=null==e?void 0:e.trackId,i=null==e?void 0:e.segmentId,r=null==e?void 0:e.presentationTime;return t&&n&&i&&Number.isFinite(r)?`${t}:${n}:${i}@${r}`:null}function hg(e,t,n){const i=Number.isFinite(null==e?void 0:e.duration)&&e.duration>0?e.duration:void 0;let r;if(i&&Number.isFinite(null==e?void 0:e.offset)){const n=(t-e.offset)/i;r=n<0?0:n>1?1:n}const o=A(Qv,this,fg).call(this,e),s=A(Qv,this,pg).call(this,o);return Nm.getRenderTiming({type:o,timing:{duration:i,normalizedTime:r},timelineTime:t,active:e,renderNodeParams:n,state:s})}function fg(e){return Nm.normalizeType(null==e?void 0:e.type)||Nm.defaultType}function pg(e){if(!e||!M(qv,this))return null;let t=M(qv,this).get(e);return t||(t={},M(qv,this).set(e,t)),t}function mg(e){if(!e||!M(qv,this))return;const t=M(qv,this).get(e);t&&Nm.resetRenderState(e,t),M(qv,this).delete(e)}function vg(){M(qv,this)&&(Nm.resetAllRenderStates(M(qv,this)),M(qv,this).clear())}function gg(e,t,n,i){const r=A(Qv,this,fg).call(this,e);M(Vv,this)&&M(Vv,this)!==r&&A(Qv,this,mg).call(this,M(Vv,this)),C(Vv,this,r);const o=A(Qv,this,pg).call(this,r);return Nm.prepareRenderFrames({type:r,frames:t,timelineTime:n,timeline:M(wv,this),active:e,renderNodeParams:i,state:o})}function yg(e){var t;return null!=e&&e.params&&"object"==typeof e.params?e.params:!e&&null!==(t=this.settings)&&void 0!==t&&t.defaultRenderParams&&"object"==typeof this.settings.defaultRenderParams?this.settings.defaultRenderParams:{}}function bg(e){return e?String(e.renderPlacementId||e.type||"unknown"):"default"}function kg(){if(!M(wv,this)||!M(zv,this))return;const e=M(wv,this).currentTime,t=M(wv,this).getActiveRenderPlacement(e),n=A(Qv,this,bg).call(this,t);n!==M(Gv,this)&&(C(Gv,this,n),A(Qv,this,Fg).call(this,{...M(zv,this),time:e}))}function wg(e){return!e||"object"!=typeof e||!Object.prototype.hasOwnProperty.call(e,"panAndScan")||!1!==e.panAndScan}function xg(e,t){const n=A(Qv,this,yg).call(this,e),i=null==n?void 0:n.stages;let r=pv(null==i?void 0:i.pre),o=pv(null==i?void 0:i.post);const s=A(Qv,this,wg).call(this,n),a=A(Qv,this,fg).call(this,e),l=mv(r,"retarget")||mv(o,"retarget");if(s&&!l){const e=Nm.getPanAndScanTarget(a);if("pre"===e){const e=vv(Array.isArray(t)?t.length:0);e&&(r=[e,...r])}else if("post"===e){const e=vv(1);e&&(o=[...o,e])}}else s||(r=gv(r),o=gv(o));return{preStages:r,postStages:o,renderNodeParams:n}}function _g(e,t,n,i,r){const o=r||A(Qv,this,hg).call(this,e,n,i),s=A(Qv,this,xg).call(this,e,t);return M(Mv,this).build({layoutType:null==e?void 0:e.type,frames:t,preStages:s.preStages,postStages:s.postStages,normalizedTime:o.normalizedTime,renderNodeDuration:o.duration,renderNodeParams:s.renderNodeParams,timelineTime:n})}function Tg(){var e,t;const n=null===(e=M(Ov,this))||void 0===e||null===(t=e.getState)||void 0===t?void 0:t.call(e);return"out"===(null==n?void 0:n.phase)?M(Ov,this).buildOutgoingGraph():"in"===(null==n?void 0:n.phase)?M(Ov,this).buildIncomingGraph():null}function Ig(e,t,n,i){const r=n||t!==M(Fv,this),o=r||i;return r&&M(Pv,this)&&"function"==typeof M(Pv,this).updateOptions&&(M(Pv,this).updateOptions(st.pipelineNodeId,{graph:e}),C(Fv,this,t)),M(Pv,this)&&"function"==typeof M(Pv,this).selectNode&&M(Cv,this)!==st.pipelineNodeId&&(M(Pv,this).selectNode(st.pipelineNodeId),C(Cv,this,st.pipelineNodeId)),!(!o||!M(Pv,this)||"function"!=typeof M(Pv,this).render||(M(Pv,this).render({noRaf:!0}),0))}function Eg(e){if(!Array.isArray(M(Dv,this))||!M(Dv,this).length)return;const t=Number.isFinite(e)?Math.max(0,e):0;if(!(M(Dv,this).length<=t)){for(let e=t;e<M(Dv,this).length;e+=1){const t=M(Dv,this)[e];if(t&&M(Pv,this)&&"function"==typeof M(Pv,this).releaseTexture)try{M(Pv,this).releaseTexture(t)}catch(e){}}M(Dv,this).length=t,M(Lv,this).length=t}}function Sg(e=[]){if(!M(Pv,this)||"function"!=typeof M(Pv,this).addTexture)return!1;if("function"==typeof M(Pv,this).isContextUnavailable&&M(Pv,this).isContextUnavailable())return!1;if(!Array.isArray(e)||!e.length)return A(Qv,this,Eg).call(this,0),!1;A(Qv,this,Eg).call(this,e.length);let t=!1;for(let i=0;i<e.length;i+=1){var n;M(Dv,this)[i]||"function"!=typeof M(Pv,this).addTexture||(M(Dv,this)[i]=M(Pv,this).addTexture(null,"frame",i));const r=A(Qv,this,dg).call(this,e[i]),o=null===(n=e[i])||void 0===n?void 0:n.frame;if(M(Dv,this)[i]&&o&&(!r||r!==M(Lv,this)[i]))try{M(Dv,this)[i].fill(o),M(Lv,this)[i]=r,t=!0}catch(e){}}return t}function Ag(){if(M($v,this))return;const e="function"==typeof ld.requestAnimationFrame?e=>ld.requestAnimationFrame(e):e=>setTimeout(e,16),t="function"==typeof ld.cancelAnimationFrame?e=>ld.cancelAnimationFrame(e):clearTimeout;C(jv,this,t);const n=()=>{var t,i;if(null!==(t=M(Ov,this))&&void 0!==t&&null!==(i=t.getState)&&void 0!==i&&i.call(t)){if(M(zv,this)){const e=A(Qv,this,lg).call(this),t=Date.now();(!e||!M(Uv,this)||t-M(Uv,this)>=e)&&(C(Uv,this,t),A(Qv,this,Fg).call(this,M(zv,this)))}C($v,this,e(n))}else C($v,this,null)};C($v,this,e(n))}function Ng(){M($v,this)&&M(jv,this)&&M(jv,this).call(this,M($v,this)),C($v,this,null),C(jv,this,null),C(Uv,this,null)}function Mg(e){var t,n;const i=null===(t=M(Ov,this))||void 0===t||null===(n=t.getState)||void 0===n?void 0:n.call(t);return"out"===(null==i?void 0:i.phase)&&M(Wv,this)?M(Wv,this):e}function Fg(e={}){var t,n;const i=null===(t=M(xv,this))||void 0===t?void 0:t.element,r=null===(n=M(xv,this))||void 0===n?void 0:n.gl;if(!i||!r)return;if(e&&C(zv,this,e),!A(Qv,this,Cg).call(this))return;const o=A(Qv,this,Mg).call(this,e),s=Number.isFinite(null==o?void 0:o.time)?o.time:void 0;if(!Number.isFinite(s))return;if(A(Qv,this,og).call(this,i),!M(Pv,this))return;const a=M(wv,this)&&"function"==typeof M(wv,this).getActiveRenderPlacement?M(wv,this).getActiveRenderPlacement(s):void 0,l=A(Qv,this,bg).call(this,a);l!==M(Gv,this)&&C(Gv,this,l);const c=Array.isArray(null==o?void 0:o.frames)?o.frames:[],u=A(Qv,this,yg).call(this,a),d=A(Qv,this,wg).call(this,u),h=A(Qv,this,gg).call(this,a,c,s,u),f=A(Qv,this,hg).call(this,a,s,u),p=A(Qv,this,ug).call(this,h,{useViewportSize:d}),m=A(Qv,this,Sg).call(this,h),v=A(Qv,this,_g).call(this,a,h,s,u,f),g=A(Qv,this,Tg).call(this);let y=v.graph,b=v.signature,k=!!v.isDynamic;g&&Array.isArray(g.graph)&&g.graph.length&&(y=y.concat(g.graph),b=`${b}|${g.signature||"transition"}`,k=k||!!g.forceUpdate);const w=p||m||k||g&&Array.isArray(g.graph)&&g.graph.length;A(Qv,this,Ig).call(this,y,b,k,w)&&h.length&&A(Qv,this,rg).call(this)}function Cg(){var e;const t=null===(e=M(wv,this))||void 0===e?void 0:e.state;return t===av||t===cv||t===lv||t===dv}function Og(e){return"number"==typeof e&&Number.isFinite(e)&&e>0}function Pg(e){return e&&"resource"===e.entryType&&e.transferSize>0&&e.duration>0&&e.responseEnd>=e.requestStart}function Rg(e){return Array.isArray(e)&&0!==e.length?e.reduce(((e,t)=>e+t),0)/e.length:NaN}st=Jv;var Dg=new WeakMap,Lg=new WeakMap,Bg=new WeakMap,zg=new WeakMap,Wg=new WeakSet;class $g extends od{get name(){return"DownloadSpeedGuesstimator"}get defaults(){return{persistentStorage:{key:"ekoDownloadSpeedKbps",ttl:-1},priorities:[["resourceTiming","downlink","persistentValue"],["resourceTiming","downlink"],["resourceTiming","persistentValue","ua"],["resourceTiming","ua","defaultKbps"],["downlink","persistentValue"],["downlink"],["persistentValue"],["connectionType"],["ua"],["defaultKbps"]],defaultKbps:2500,connectionType:{"slow-2g":50,"2g":70,"3g":700,"4g":3500,bluetooth:750,cellular:750,ethernet:3500,wifi:2500,wimax:2500,none:0},ua:{desktop:2500,ios:2500,android:2500}}}constructor(...e){super(...e),O(this,Wg),F(this,Dg,void 0),F(this,Lg,void 0),F(this,Bg,void 0),F(this,zg,void 0),C(Dg,this,!!(ld&&ld.navigator&&ld.navigator.connection)),C(Lg,this,!(!ld||!ld.performance||"function"!=typeof ld.performance.getEntriesByType)),C(Bg,this,A(Wg,this,Ug).call(this)),C(zg,this,A(Wg,this,Kg).call(this))}guesstimate(){const e=A(Wg,this,Yg).call(this);this.log.debug("[guesstimate] Data:",e);const t=A(Wg,this,Xg).call(this,e),n=Og(t)?t:e.defaultKbps;return A(Wg,this,qg).call(this,n),this.log.info(`[guesstimate] Result: ${n} kbps`),n}update(e){Og(e)&&A(Wg,this,qg).call(this,e)}onDispose(){C(Bg,this,void 0),C(zg,this,void 0)}}function jg(){return Math.round(Date.now()/1e3)}function Ug(){try{if(!ld||!ld.localStorage||"function"!=typeof ld.localStorage.getItem)return}catch(e){return}const e=this.settings.persistentStorage.key,t=ld.localStorage.getItem(e);if(t)try{const e=JSON.parse(t),n=this.settings.persistentStorage.ttl,i=A(Wg,this,jg).call(this)-e.timestamp;if("number"==typeof n&&n>=0&&i>n)return null;if(!Og(e.value))return;return e.value}catch(e){return}}function qg(e){if(!Og(e))return;try{if(!ld||!ld.localStorage||"function"!=typeof ld.localStorage.setItem)return}catch(e){return}const t=this.settings.persistentStorage.key,n=JSON.stringify({value:e,timestamp:A(Wg,this,jg).call(this)});try{ld.localStorage.setItem(t,n),C(Bg,this,e)}catch(e){}}function Vg(){return ld&&ld.performance&&"function"==typeof ld.performance.getEntriesByType?Rg(ld.performance.getEntriesByType("resource").filter(Pg).map((e=>8*e.transferSize/e.duration))):NaN}function Gg(){if(!ld||!ld.navigator||!ld.navigator.connection)return NaN;const e=ld.navigator.connection.downlink;return Og(e)?1e3*e:NaN}function Hg(){if(!M(Dg,this))return NaN;const e=ld.navigator.connection,t=e.effectiveType||e.type,n=this.settings.connectionType||{};return t&&Object.prototype.hasOwnProperty.call(n,t)?n[t]:NaN}function Kg(){const e=this.settings.ua||{};return Xm()?e.android:Ym()?e.ios:e.desktop}function Xg(e){const t=Array.isArray(this.settings.priorities)?this.settings.priorities:[];for(let n=0;n<t.length;n+=1){const i=t[n];if(!Array.isArray(i)||0===i.length)continue;const r=i.map((t=>e[t])).filter((e=>Og(e)));if(r.length===i.length)return this.log.debug("[#selectFromPriorities] Selected from priorities:",i,"with values:",r),Rg(r)}return NaN}function Yg(){const e=this.settings.testOverrides||{},t=Og(e.resourceTiming)?e.resourceTiming:A(Wg,this,Vg).call(this),n=Og(e.downlink)?e.downlink:A(Wg,this,Gg).call(this),i=Og(e.persistentValue)?e.persistentValue:M(Bg,this),r=Og(e.connectionType)?e.connectionType:A(Wg,this,Hg).call(this),o=Og(e.ua)?e.ua:M(zg,this);return{defaultKbps:this.settings.defaultKbps,resourceTiming:t,downlink:n,connectionType:r,persistentValue:i,ua:o}}const Qg=new Zu;function Jg(e){return"string"!=typeof e||0===e.length?[]:e.split(".").filter((e=>e.length>0))}function Zg(e){if("string"!=typeof e)return!1;if(0===e.length)return!1;const t=Number(e);return Number.isInteger(t)&&String(t)===e}function ey(e){return null!==e&&"object"==typeof e}function ty(e,t,n){const i=Jg(t);if(0===i.length)return void 0===e?n:e;let r=e;for(let e=0;e<i.length;e+=1){if(null==r)return n;if(r=r[i[e]],void 0===r)return n}return void 0===r?n:r}function ny(e,t,n){if(!ey(e))return e;const i=Jg(t);if(0===i.length)return e;let r=e;for(let e=0;e<i.length;e+=1){const t=i[e];if(e===i.length-1){r[t]=n;break}ey(r[t])||(r[t]=Zg(i[e+1])?[]:{}),r=r[t]}return e}const iy={get:(e,t)=>ld&&ld.eko?ty(ld.eko,e,t):t,set(e,t){if(ld)return ld.eko&&"object"==typeof ld.eko||(ld.eko={}),ny(ld.eko,e,t),ld.eko}},ry=ld&&ld.performance,oy=ry&&"function"==typeof ry.now?()=>ry.now():()=>Date.now();function sy(){return"undefined"==typeof AbortController?null:new AbortController}function ay(){const e=new Error("The operation was aborted");return e.name="AbortError",e.code="ABORT_ERR",e}function ly(e,t){return!(!t||!t.aborted)||!!e&&("AbortError"===e.name||"ABORT_ERR"===e.code||20===e.code)}const cy=2,uy=100,dy=2,hy="runtime.downloadSpeedSamples",fy=Ju("download","warn");function py(e){return new Promise((t=>{setTimeout(t,e)}))}function my(e){return e>=500}function vy(e){if(!e||!e.headers||"function"!=typeof e.headers.get)return 0;const t=e.headers.get("content-length");if(!t)return 0;const n=Number(t);return Number.isNaN(n)||n<0?0:n}function gy(e,t,n,i,r,o){const s={bytes:e,durationMs:t,kbps:t>0?8*e/t:0,startTime:n,endTime:i,url:o};try{let e=iy.get(r);e||(e=[],iy.set(r,e)),e.push(s)}catch(e){}return s}async function yy(e,t={}){const{method:n="GET",headers:i,body:r,retries:o=cy,retryDelay:s=uy,backoffFactor:a=dy,samplesTargetPath:l=hy,fetch:c,loglevel:u="warn",cache:d,signal:h,onProgress:f,returnType:p="default"}=t;fy.setLevel(u);const m=function(e){if(e)return e;if(ld&&"function"==typeof ld.fetch)return ld.fetch.bind(ld);throw new Error("fetch is not available in this environment")}(c);let v=0,g=s;for(;;){if(h&&h.aborted)throw ay();const t=oy();try{const s=await m(e,{method:n,headers:i,body:r,cache:d,mode:"cors",signal:h});if(h&&h.aborted)throw ay();if(!s.ok){if(v<o&&my(s.status)){v+=1,fy.warn(`[${e}] Download attempt #${v} failed with status ${s.status}, retrying in ${g}ms...`),await py(g),g*=a;continue}fy.error(`[${e}] Download attempt #${v} failed with status ${s.status}, no more retries.`);const t=new Error(`Download failed with status ${s.status}`);throw t.status=s.status,t}let c=oy();const u=vy(s),y="arrayBuffer"===p||"bytes"===p,b=y&&"function"==typeof f;let k,w,x,_,T,I=0;if(y&&s.body&&"function"==typeof s.body.getReader&&b){const e=s.body.getReader(),t=[];for(;;){if(h&&h.aborted)throw ay();const{done:n,value:i}=await e.read();if(n)break;if(i&&i.length){const e=oy();Number.isFinite(_)||(_=e),T=e,t.push(i),I+=i.length,f({loaded:I,total:u||void 0,chunk:i})}}k=new Uint8Array(I);let n=0;t.forEach((e=>{k.set(e,n),n+=e.length})),c=oy()}else if(y){const e=await s.arrayBuffer();k=new Uint8Array(e),I=k.length,c=oy()}else"text"===p?(w=await s.text(),c=oy()):"json"===p&&(x=await s.json(),c=oy());if(h&&h.aborted)throw ay();const E=y?k?k.length:I:("text"===p&&"string"==typeof w?w.length:0)||("json"===p&&x?JSON.stringify(x).length:0),S=u||E||0;let A=t,N=c;Number.isFinite(_)&&(A=_,Number.isFinite(T)&&(N=Math.max(T,c))),(!Number.isFinite(A)||!Number.isFinite(N)||N<A)&&(A=t,N=c);const M=Math.max(0,N-A),F=gy(S,M,A,N,l,e);try{Qg.trigger("download:sample",F)}catch(e){}const C={response:s,bytes:S,durationMs:M,kbps:F.kbps,startTime:F.startTime,endTime:F.endTime};if("default"===p)return C;if("arrayBuffer"===p||"bytes"===p){const e=k||new Uint8Array(await s.arrayBuffer());return"arrayBuffer"===p?e.buffer:e}return"text"===p?w:"json"===p?x:C}catch(t){if(ly(t,h))throw"AbortError"===t.name?t:ay();if(!(v<o)||t.status&&!my(t.status))throw fy.error(`[${e}] Download attempt #${v} failed with error ${t}, no more retries.`),t;v+=1,fy.warn(`[${e}] Download attempt #${v} failed with error ${t}, retrying in ${g}ms...`),await py(g),g*=a}}}const by={disabledTracks:{default:["audio"],targetPaths:["NodeRepository.disabledTracks"]},muted:{default:!1,targetPaths:["AudioPlaybackManager.muted"]},volume:{default:1,targetPaths:["AudioPlaybackManager.volume"]},encodeProfile:{default:null,targetPaths:["AssetsDeliveryService.profile"]},forceVideoCodec:{default:void 0,targetPaths:["NodeRepository.forceVideoCodec"]},forceImageFallback:{default:!1,targetPaths:["NodeRepository.forceImageFallback"]},mediaHostRewriteMap:{default:{"storageeko.s3.amazonaws.com":"https://storage.eko.com","studioz-post.s3.amazonaws.com":"https://studioz-post.eko.com"},targetPaths:["NodeRepository.mediaHostRewriteMap"]},playbackRate:{default:1,targetPaths:["PlaybackClock.playbackRate"]},initialKbps:{default:"auto",targetPaths:["DownloadSpeed.initialKbps"]},defaultRenderParams:{default:void 0,targetPaths:["Renderer.defaultRenderParams"]},maxBufferedVideoFrames:{default:24,targetPaths:["Timeline.maxBufferedVideoFrames"]},waitingBufferAheadSeconds:{default:3,targetPaths:["Timeline.waitingBufferAheadSeconds"]},abrStrategy:{default:"auto",targetPaths:["ABRSelector.abrStrategy"]},segmentEvictionEnabled:{default:!0,targetPaths:["SegmentEvictionCoordinator.enabled"]},segmentEvictionBufferBehindSeconds:{default:30,targetPaths:["SegmentEvictionCoordinator.bufferBehindSeconds"]},segmentEvictionBufferAheadSeconds:{default:30,targetPaths:["SegmentEvictionCoordinator.bufferAheadSeconds"]},segmentEvictionMaxRetainedBytes:{default:52428800,targetPaths:["SegmentEvictionCoordinator.maxRetainedBytes"]},autoplay:{default:!0,targetPaths:["Idle.autoplay"]},autoPauseOnVisibilityChange:{default:!0,targetPaths:["DocumentVisibility.autoPauseOnVisibilityChange"]},autoResumeOnVisibilityChange:{default:!0,targetPaths:["DocumentVisibility.autoResumeOnVisibilityChange"]},trackingEnabled:{default:!0,targetPaths:["Tracker.trackingEnabled"]}},ky=Object.freeze(Object.entries(by).reduce(((e,[t,n])=>(Object.prototype.hasOwnProperty.call(n,"default")&&(e[t]=n.default),e)),{})),wy=Ju("config","warn");function xy(e){return ky[e]}var _y=new WeakMap,Ty=new WeakMap,Iy=new WeakMap,Ey=new WeakMap,Sy=new WeakMap,Ay=new WeakSet;class Ny extends od{get name(){return"DownloadSpeed"}get defaults(){return{alpha:.3,maxSamples:30,minBytesPerSample:1024,minDurationMs:5,maxSampleKbpsCap:void 0,ignoreCacheHits:!0,samplesPath:"runtime.downloadSpeedSamples",initialKbps:xy("initialKbps"),probeUrl:void 0,defaultKbps:2500}}constructor(...e){super(...e),O(this,Ay),F(this,_y,void 0),F(this,Ty,void 0),F(this,Iy,void 0),F(this,Ey,void 0),F(this,Sy,void 0),C(Iy,this,[]),C(Ty,this,0),C(_y,this,A(Ay,this,Cy).call(this)),C(Sy,this,sy()),C(Ey,this,(e=>{A(Ay,this,By).call(this,e,"event")})),A(Ay,this,Oy).call(this),Qg.on("download:sample",M(Ey,this)),A(Ay,this,Py).call(this),this.log.debug(`[#constructor] Initial estimate: ${M(_y,this)} kbps`)}getKbps(){return M(_y,this)}addSample(e){A(Ay,this,By).call(this,e,"manual")}reset(){C(Iy,this,[]),C(Ty,this,0),C(_y,this,A(Ay,this,Cy).call(this))}onDispose(){M(Sy,this)&&M(Sy,this).abort(),C(Sy,this,null),Qg.off("download:sample",M(Ey,this)),C(Iy,this,[]),C(Ty,this,0),C(_y,this,void 0),C(Ey,this,null)}}function My(e,t){return!!(this.settings.ignoreCacheHits&&(0===t||e&&"boolean"==typeof e.cached&&e.cached||e&&"number"==typeof e.transferSize&&"number"==typeof e.encodedBodySize&&e.transferSize<=e.encodedBodySize))}function Fy(e){if(!e||"object"!=typeof e)return null;const t=Number(e.bytes),n=Number(e.durationMs);let i=Og(e.kbps)?Number(e.kbps):NaN;return!Og(i)&&n>0&&Og(t)&&(i=8*t/n),Og(i)?t<=this.settings.minBytesPerSample||n<=this.settings.minDurationMs||A(Ay,this,My).call(this,e,t)?null:(Og(this.settings.maxSampleKbpsCap)&&i>this.settings.maxSampleKbpsCap&&(i=this.settings.maxSampleKbpsCap),{...e,bytes:t,durationMs:n,kbps:i}):null}function Cy(){const e=this.settings.initialKbps;if(Og(e))return e;if("auto"===e)try{const e=(new $g).guesstimate();if(Og(e))return e}catch(e){}return this.settings.defaultKbps}function Oy(){const e=iy.get(this.settings.samplesPath,[]);if(!Array.isArray(e)||0===e.length)return;const t=e.slice(-this.settings.maxSamples);for(let e=0;e<t.length;e+=1)A(Ay,this,By).call(this,t[e],"replay",{emit:!1})}async function Py(){if(!this.settings.probeUrl||M(Ty,this)>0)return;const e=M(Sy,this)?M(Sy,this).signal:void 0;if(!e||!e.aborted)try{await yy(this.settings.probeUrl,{cache:"no-store",samplesTargetPath:this.settings.samplesPath,signal:e})}catch(e){}}function Ry(e){return"number"==typeof e.startTime&&"number"==typeof e.endTime&&Number.isFinite(e.startTime)&&Number.isFinite(e.endTime)&&e.startTime>=0&&e.endTime>e.startTime}function Dy(e,t){if(!A(Ay,this,Ry).call(this,e)||!A(Ay,this,Ry).call(this,t))return 0;const n=Math.max(e.startTime,t.startTime);return Math.min(e.endTime,t.endTime)-n}function Ly(e){if(!A(Ay,this,Ry).call(this,e))return e;const t=[];for(let n=0;n<M(Iy,this).length;n+=1){const i=M(Iy,this)[n];A(Ay,this,Ry).call(this,i)&&(A(Ay,this,Dy).call(this,e,i)>0&&t.push(i))}if(0===t.length)return e;C(Iy,this,M(Iy,this).filter((e=>!t.includes(e))));const n=[e,...t],i=n.reduce(((e,t)=>e+(t.bytes||0)),0),r=Math.min(...n.map((e=>e.startTime))),o=Math.max(...n.map((e=>e.endTime))),s=o-r;if(!Og(i)||s<=0)return e;const a={bytes:i,durationMs:s,kbps:8*i/s,startTime:r,endTime:o,url:e.url||t[t.length-1].url};return A(Ay,this,Fy).call(this,a)}function By(e,t,{emit:n=!0}={}){const i=A(Ay,this,Fy).call(this,e);if(!i)return;const r=A(Ay,this,Ly).call(this,i);if(!r)return;C(Ty,this,M(Ty,this)+1),M(Iy,this).push(r),M(Iy,this).length>this.settings.maxSamples&&M(Iy,this).shift();const o=this.defaults.alpha,s="number"==typeof this.settings.alpha?this.settings.alpha:o,a=Og(M(_y,this)),l=a?M(_y,this):r.kbps,c=a||1!==M(Ty,this)?s*r.kbps+(1-s)*l:r.kbps;C(_y,this,c),this.log.debug(`[#ingestSample] Next estimate: ${c} kbps`),n&&this.trigger("download:speed",{kbps:M(_y,this),sample:r,source:t,samplesCount:M(Ty,this)})}class zy{constructor(e={}){const{id:t,url:n,uri:i,mime:r,codecs:o,bandwidth:s,timescale:a,sizeBytes:l,...c}=e;if(!t)throw new Error("Representation requires id");const u=n||i;if(!u)throw new Error("Representation requires url or uri");this.id=t,this.url=u,this.mime=r,this.codecs=o,this.baseCodec=function(e=""){if(!e||"string"!=typeof e)return;const t=e.split(",")[0].trim();if(!t)return;const n=t.match(/^[a-z0-9]+/i);return n?n[0].toLowerCase():void 0}(o),Og(s)&&(this.bandwidth=s),Og(a)&&(this.timescale=a),Og(l)&&(this.sizeBytes=l),Object.assign(this,c)}}class Wy{#P=new Map;#R;#D;#L=0;#B;constructor(e={}){const{id:t,offset:n=0,duration:i=0,isInit:r=!1,representations:o=[]}=e;if(!t)throw new Error("Segment requires id");o.forEach((e=>{if(!e||!e.url&&!e.uri)throw new Error("Segment representation must include uri or url")})),this.id=t,this.offset=n,this.duration=i,this.isInit=!!r,this.originalRepresentations=o.map((e=>e instanceof zy?e:new zy(e))),this.representations=this.originalRepresentations.map((e=>e)),this.appliedFilters=[],this.loadAttempts=0,this.loadError=void 0}setRepresentationBuffer(e,t){e&&t&&this.#P.set(e,t)}setDownloadProgress(e,t){const n=Number(e);Number.isFinite(n)&&n>=0&&(this.#L=Math.max(this.#L,n));const i=Number(t);Number.isFinite(i)&&i>0&&(this.#B=i)}setChosenRepresentation(e){this.#R=e;const t=null==e?void 0:e.id;if(!(this.isInit||!t||this.#P.size<=1))for(const e of this.#P.keys())e!==t&&this.#P.delete(e)}setABRDecisionSnapshot(e){if(!e||"object"!=typeof e)return void(this.#D=void 0);const t={...e};Array.isArray(e.availableRepresentations)&&(t.availableRepresentations=e.availableRepresentations.map((e=>({...e})))),this.#D=t}markLoadAttempt(){const e=Number(this.loadAttempts);this.loadAttempts=Number.isFinite(e)&&e>0?e+1:1,this.loadError=void 0}setLoadError(e){this.loadError=e||new Error("Segment load failed")}getRepresentationBuffer(e){return this.#P.get(e)}get chosenRepresentation(){return this.#R}get abrDecision(){return this.#D}get arrayBuffer(){return this.#R?this.#P.get(this.#R.id):void 0}get retainedByteLength(){let e=0;for(const t of this.#P.values())t&&"number"==typeof t.byteLength&&(e+=t.byteLength);return e}get bufferedRatio(){var e;const t=Og(this.#B)?this.#B:null===(e=this.#R)||void 0===e?void 0:e.sizeBytes;return Og(t)?Math.min(1,Math.max(0,this.#L/t)):this.retainedByteLength>0?1:0}get isLoaded(){return this.retainedByteLength>0}evict(){this.#R=void 0,this.#D=void 0,this.#P.clear(),this.#L=0,this.#B=void 0}}class $y{constructor(e={}){const{timestamp:t,name:n,data:i,isSticky:r=!1}=e;this.timestamp="number"==typeof t?t:0,this.name="string"==typeof n?n:"",this.data=i,this.isSticky="boolean"==typeof r&&r}}function jy(e,t){const n=Number(null==e?void 0:e.offset),i=Number(null==e?void 0:e.duration);if(!t)return{offset:n,duration:i};const r=(null==e?void 0:e.chosenRepresentation)||(Array.isArray(null==e?void 0:e.representations)?e.representations[0]:void 0),o=Number(null==r?void 0:r.segStart),s=Number(null==r?void 0:r.segDuration);return Number.isFinite(o)&&Number.isFinite(s)&&s>0?{offset:o,duration:s}:{offset:n,duration:i}}function Uy(e,t,n={}){if(!Array.isArray(e)||!e.length)return;const i=Number(t);if(!Number.isFinite(i))return;const r=!!n.preferRepresentationTime;let o,s,a=-1/0;for(let t=0;t<e.length;t+=1){const n=e[t];if(!n||n.isInit)continue;o||(o=n);const l=jy(n,r);if(!Number.isFinite(l.offset))continue;const c=Number(l.duration);if(Number.isFinite(c)&&c>0&&i>=l.offset&&i<l.offset+c)return n;l.offset<=i&&l.offset>a&&(a=l.offset,s=n)}return s||o}const qy=new Set(["video","audio","image","cue","data","bbox"]);class Vy{constructor(e={}){const{id:t,type:n,offset:i=0,duration:r,source:o,segments:s=[],cues:a=[]}=e;if(!t)throw new Error("Track requires id");if(!qy.has(n))throw new Error(`Track type must be one of ${Array.from(qy).join("|")}`);this.id=t,this.type=n,this.offset=i,this.duration=Og(r)?r:void 0,this.source=o,"cue"===n?(this._cues=a.map((e=>e instanceof $y?e:new $y(e))),this._segments=[]):(this._segments=s.map((e=>e instanceof Wy?e:new Wy(e))),this._cues=void 0)}get segments(){return this._segments.slice()}get cues(){if("cue"===this.type)return this._cues.slice()}get endTime(){if(Og(this.duration))return this.offset+this.duration;if(!this._segments.length)return;const e=this._segments.reduce(((e,t)=>{const n=Og(t.duration)?t.duration:0;return Math.max(e,t.offset+n)}),this.offset);return e}get buffered(){const e=this._segments.map((e=>({duration:Og(null==e?void 0:e.duration)?e.duration:0,offset:Og(null==e?void 0:e.offset)?e.offset:0,ratio:e&&!e.isInit&&"number"==typeof e.bufferedRatio?e.bufferedRatio:0}))).filter((e=>e.duration>0&&e.ratio>0));if(!e.length)return;const t=e.reduce(((e,t)=>Math.min(e,t.offset)),1/0),n=e.reduce(((e,t)=>{const n=t.offset+t.duration*Math.min(1,t.ratio);return Math.max(e,n)}),0);return!Number.isFinite(t)||!Number.isFinite(n)||n<=t?void 0:{start:t,end:n}}getMediaSegmentAtTime(e,t={}){return Uy(this._segments,e,t)}setSegments(e=[]){if("cue"===this.type)return;const t=Array.isArray(e)?e:[];this._segments=t.map((e=>e instanceof Wy?e:new Wy(e)))}}function Gy(e){return"string"==typeof e?e:e&&"object"==typeof e?e.nodeId||e.nodeIdOrRef||e.id:void 0}function Hy(e){const t=Gy(e);let n=1;if(e&&"object"==typeof e&&Og(e.weight)&&(n=e.weight),!t)throw new Error("Child entry requires a nodeId");return{nodeId:t,weight:n}}function Ky(e){return(Array.isArray(e)?e:[]).map((e=>Hy(e)))}function Xy(e,t=void 0){if("string"==typeof e){const t=e.match(/\d+\.?\d*/);if(t){const e=Number(t[0]);if(Number.isFinite(e))return e}}else if("number"==typeof e&&Number.isFinite(e))return e;return t}function Yy(e,t){if(e){if(e.includes("$Number%")){const n=e.match(/\$Number%0(\d+)d\$/);if(n){const i=Number(n[1]),r=String(t).padStart(i,"0");return e.replace(/\$Number%0\d+d\$/,r)}}return e.replace(/\$Number\$/g,String(t))}}function Qy(e,t){if(t)try{var n;return new URL(t,e||(null==ld||null===(n=ld.location)||void 0===n?void 0:n.href)||void 0).toString()}catch(e){return t}}const Jy=new Map;class Zy{static register(e,t){if(!e||"function"!=typeof t)throw new Error("ManifestFactory.register requires type and parser function");Jy.set(e,t)}static inferType(e={}){const{typeHint:t,url:n,mimeType:i,body:r}=e;return t||function(e=""){const t=function(e=""){return e&&"string"==typeof e?e.split("#")[0].split("?")[0].toLowerCase():""}(e);return t.endsWith(".mpd")?"dash":t.endsWith(".ivd")?"ivd":t.endsWith(".jpg")||t.endsWith(".jpeg")||t.endsWith(".png")||t.endsWith(".webp")||t.endsWith(".gif")||t.endsWith(".avif")?"image":void 0}(n||"")||function(e=""){const t=e.toLowerCase();return t.includes("dash")||t.includes("mpd")||t.includes("xml")?"dash":t.includes("ivd")||t.includes("json")?"ivd":t.includes("image/")?"image":void 0}(i||"")||function(e=""){const t="string"==typeof e?e.trim():"";if(t.startsWith("<")&&t.includes("<MPD"))return"dash";if(t.startsWith("{"))try{const e=JSON.parse(t);if(e&&"object"==typeof e)return"ivd"}catch(e){return}}(r||"")}static parse(e={}){const t=Zy.inferType(e);if(!t||!Jy.has(t))throw new Error("Unsupported manifest type");return Jy.get(t)(e)}}Zy.register("dash",(function(e={}){const{body:t,url:n}=e,i=function(){if(ld&&"function"==typeof ld.DOMParser)return new ld.DOMParser;throw new Error("DOMParser is not available in this environment")}().parseFromString(t||"","application/xml"),r=i.getElementsByTagName("MPD")[0];if(!r)throw new Error("Invalid MPD");const o=i.getElementsByTagName("Period")[0],s=o?Array.from(o.getElementsByTagName("AdaptationSet")):[],a=[];let l=Xy(r.getAttribute("mediaPresentationDuration"));l=Number.isFinite(l)?l:void 0,s.forEach(((e,t)=>{const i=e.getAttribute("mimeType")||"",r=function(e=""){const t=e.toLowerCase();return t.includes("video")?"video":t.includes("audio")?"audio":t.includes("image")?"image":"data"}(i),o=e.getAttribute("id")||`${r}-${t+1}`,s=e.getElementsByTagName("SegmentTemplate")[0],c=Array.from(e.getElementsByTagName("Representation")).map((e=>function(e,t,n){const i=e.getAttribute("id")||e.getAttribute("representationId")||"",r=Xy(e.getAttribute("bandwidth")),o=e.getAttribute("codecs"),s=e.getAttribute("mimeType")||t&&t.getAttribute("mimeType")||n,a=e.getElementsByTagName("SegmentTemplate")[0]||t;return{repId:i,bandwidth:r,codecs:o,mime:s,media:a?a.getAttribute("media"):void 0,initialization:a?a.getAttribute("initialization"):void 0,timescale:Xy(a&&a.getAttribute("timescale"))||Xy(t&&t.getAttribute("timescale"),1)||1,startNumber:Xy(a&&a.getAttribute("startNumber"))||Xy(t&&t.getAttribute("startNumber"),1)||1,timeline:function(e){const t=[],n=e.getElementsByTagName("SegmentTimeline")[0];if(!n)return t;const i=Array.from(n.getElementsByTagName("S"));let r=0;for(let e=0;e<i.length;e+=1){const n=i[e],o=Xy(n.getAttribute("t")),s=Xy(n.getAttribute("d")),a=Xy(n.getAttribute("r"),0);if(!Og(s))continue;Og(o)&&(r=o);const l=a>=0?a:0;for(let e=0;e<=l;e+=1)t.push({start:r,duration:s}),r+=s}return t}(a)}}(e,s,i))),u=c.map((e=>({id:e.repId,url:Qy(n,Yy(e.initialization,e.startNumber)),bandwidth:e.bandwidth,mime:e.mime,codecs:e.codecs,timescale:e.timescale}))).filter((e=>e.url)),d=c.reduce(((e,t)=>{const n=Array.isArray(null==e?void 0:e.timeline)?e.timeline.length:0;return(Array.isArray(null==t?void 0:t.timeline)?t.timeline.length:0)>n?t:e}),c[0]),h=Array.isArray(null==d?void 0:d.timeline)?d.timeline:[],f=h.length,p=[],m=(null==d?void 0:d.timescale)||1;u.length>0&&p.push({id:`init-${o}`,offset:0,duration:0,isInit:!0,representations:u});for(let e=0;e<f;e+=1){const t=h[e];if(!t)continue;const i=c.map((t=>{const i=t.startNumber+e,r=t.timescale||m,o=Array.isArray(t.timeline)?t.timeline[e]:void 0;if(!o)return null;const s=o.start,a=o.duration;return{id:t.repId,url:Qy(n,Yy(t.media,i)),bandwidth:t.bandwidth,mime:t.mime,codecs:t.codecs,timescale:t.timescale,segIndex:e,segStart:s/r,segDuration:a/r}})).filter(Boolean);i.length&&p.push({id:`${o}-seg-${e+1}`,offset:t.start/m,duration:t.duration/m,isInit:!1,representations:i})}a.push({id:o,type:r,offset:0,duration:l,segments:p})}));const c=a[0]?a[0].id:void 0;return{id:n||r.getAttribute("id")||"mpd",mainTrackId:c,tracks:a,duration:l}})),Zy.register("ivd",(function(e={}){var t;const{body:n,url:i}=e;let r;try{r="string"==typeof n?JSON.parse(n):n}catch(e){throw new Error("Invalid IVD manifest")}if(!r||"object"!=typeof r)throw new Error("Invalid IVD manifest");const o=Array.isArray(r.representations)?r.representations:[],s=new Map;o.forEach(((e,t)=>{const n=function(e){const t=(e.mimeType||"").toLowerCase();return t.includes("video")?"video":t.includes("audio")?"audio":"data"}(e),i=Number.isInteger(e.altIndex)?e.altIndex:0,r=`${n}-${i}`,o=(l=t,{id:`${(a=e).format||"unknownformat"}-${a.altIndex||0}-${a.label||l+1}`,url:a.url,mime:a.mimeType,codecs:a.codecs,bandwidth:a.bandwidth||a.audioBandwidth||a.videoBandwidth,sizeBytes:a.contentLength,duration:Og(a.duration)?a.duration:void 0,segIndex:Number.isInteger(a.segIndex)&&a.segIndex>=0?a.segIndex:0});var a,l;s.has(r)||s.set(r,{type:n,altIndex:i,reps:[]}),s.get(r).reps.push(o)}));const a=Array.from(s.values()).map(((e,t)=>{const n=new Map;e.reps.forEach((e=>{const t=Number.isInteger(e.segIndex)?e.segIndex:0;n.has(t)||n.set(t,[]),n.get(t).push(e)}));const i=Array.from(n.keys()).sort(((e,t)=>e-t));let o=0;const s=i.map((i=>{var r;const s=n.get(i)||[],a=(null===(r=s.find((e=>Og(e.duration))))||void 0===r?void 0:r.duration)||0,l={id:`${e.type}-${e.altIndex}-${t+1}-seg-${i+1}`,offset:o,duration:a,isInit:!1,representations:s.map((e=>{const{duration:t,segIndex:n,...i}=e;return i}))};return o+=a,l})),a=s.reduce(((e,t)=>e+(Og(t.duration)?t.duration:0)),0),l=Og(r.duration)?r.duration:a||void 0;return{id:`${e.type}-${e.altIndex}-${t+1}`,type:e.type,offset:0,duration:l,segments:s}})),l=r.mainTrackId||(null===(t=a.find((e=>"video"===e.type)))||void 0===t?void 0:t.id)||a[0]&&a[0].id,c=a.find((e=>e.id===l)),u=(null==c?void 0:c.duration)||void 0;return{id:r.id||i||"ivd",metadata:r.metadata||{},mainTrackId:l,tracks:a,duration:u}})),Zy.register("image",(function(e={}){const t=null==e?void 0:e.url;if(!t||"string"!=typeof t)throw new Error("ImageParser requires url");const n=Og(null==e?void 0:e.duration)?e.duration:30,i=Og(null==e?void 0:e.width)?e.width:void 0,r=Og(null==e?void 0:e.height)?e.height:void 0,o={id:"image-1",url:t,mime:"string"==typeof(null==e?void 0:e.mimeType)?e.mimeType:void 0};Og(i)&&Og(r)&&(o.width=i,o.height=r);const s="image-1";return{id:t,metadata:{},mainTrackId:s,tracks:[{id:s,type:"image",offset:0,duration:n,segments:[{id:"image-1-seg-1",offset:0,duration:n,isInit:!1,representations:[o]}]}],duration:n}}));const eb=["video/mp4"];function tb(e){return eb.includes(e.mime)}var nb={name:"containers",fn:function(e=[]){return e.filter(tb)},isRelevantForTrack:function(e){return"video"===(null==e?void 0:e.type)}};const ib=new(at=new WeakMap,lt=new WeakSet,class extends od{get name(){return"MediaCapabilities"}get defaults(){return{enabled:!0,smoothWeight:10,powerWeight:10,ignoreSmooth:!1,ignorePower:!0,codecBonus:{av01:.2,hvc1:.15,hev1:.15,vp09:.1,avc1:0}}}constructor(...e){super(...e),O(this,lt),F(this,at,void 0),C(at,this,new Map)}onDispose(){M(at,this)&&M(at,this).clear()}async sortRepsCodecs(e=[]){if(!Array.isArray(e)||0===e.length)return[];const t=[],n=new Set;let i=0;e.forEach((e=>{const r=null==e?void 0:e.baseCodec;r&&!n.has(r)&&(n.add(r),t.push({codec:r,rep:e,index:i}),i+=1)}));const r=(await Promise.all(t.map((async e=>{const{score:t}=await A(lt,this,lb).call(this,e.rep);return{...e,score:t}})))).sort(((e,t)=>{const n=t.score-e.score;return 0!==n?n:e.index-t.index}));return this.log.info("[sortRepsCodecs] Sorted entries:",r),r.map((e=>e.codec))}});function rb(){return!!(ld&&ld.navigator&&ld.navigator.mediaCapabilities&&"function"==typeof ld.navigator.mediaCapabilities.decodingInfo)}function ob(e){if(!e||"object"!=typeof e)return void this.log.debug("[#buildConfig] Invalid representation:",e);const t=e.mime||e.mimeType||"",n=function(e="",t=""){const n=e||"",i=t||"";return i?`${n}; codecs="${i}"`:n}(t,e.codecs||"");return function(e=""){return e.toLowerCase().includes("video")}(t)?(this.log.debug("[#buildConfig] Building video config for:",e),{type:"file",video:{contentType:n,width:e.width||1920,height:e.height||1080,bitrate:e.videoBandwidth||e.bandwidth||0,framerate:e.framerate||e.frameRate||24}}):function(e=""){return e.toLowerCase().includes("audio")}(t)?(this.log.debug("[#buildConfig] Building audio config for:",e),{type:"file",audio:{contentType:n,channels:e.channels||2,bitrate:e.audioBandwidth||e.bandwidth||0,samplerate:e.audioSamplingRate||48e3}}):void this.log.debug("[#buildConfig] Unknown mime type:",t)}function sb(e){return e?JSON.stringify(e):"invalid"}async function ab(e){if(!this.settings.enabled||!A(lt,this,rb).call(this)||!e)return this.log.debug("[#queryCapabilities] Not supported, returning false",e),{supported:!1,smooth:!1,powerEfficient:!1};const t=A(lt,this,sb).call(this,e),n=M(at,this).get(t);if(n)return n;let i;try{i=await ld.navigator.mediaCapabilities.decodingInfo(e)}catch(e){i={supported:!1,smooth:!1,powerEfficient:!1}}return this.log.debug("[#queryCapabilities] Config:",e,"\nDecoding info result:",i),M(at,this).set(t,i),i}async function lb(e){if(A(lt,this,ub).call(this,e))return this.log.debug("[#scoreRepresentation] Blocking HEVC on Firefox versions below support threshold",null==e?void 0:e.codecs),{score:-1e3,capability:{supported:!1,smooth:!1,powerEfficient:!1}};const t=A(lt,this,ob).call(this,e),n=await A(lt,this,ab).call(this,t),i=function(e="",t={}){const n=(e||"").toLowerCase();return Object.keys(t).reduce(((e,i)=>n.includes(i.toLowerCase())?t[i]:e),0)}(e.codecs||"",this.settings.codecBonus);let r=0;return n.supported&&(r+=1),!this.settings.ignoreSmooth&&n.smooth&&(r+=this.settings.smoothWeight),!this.settings.ignorePower&&n.powerEfficient&&(r+=this.settings.powerWeight),r+=i,{score:r,capability:n}}function cb(){if(!Zm())return!1;const e=ev();return!Number.isFinite(e)||e<150}function ub(e){if(!A(lt,this,cb).call(this))return!1;const t=function(e=""){const t=String(e||"").toLowerCase(),[n]=t.split(".");return n||""}((null==e?void 0:e.baseCodec)||(null==e?void 0:e.codecs)||"");return"hvc1"===t||"hev1"===t}const db=[],hb=()=>!0;[nb,{name:"force-video-codec",fn:function(e=[],{node:t}={}){const n=function(e){if("string"!=typeof e)return;const t=e.split(",")[0].trim();if(!t)return;const n=t.match(/^[a-z0-9]+/i);return n?n[0].toLowerCase():void 0}(null==t?void 0:t.forceVideoCodec);if(!n)return e;const i=e.filter((e=>(null==e?void 0:e.baseCodec)===n));return i.length?i:e},isRelevantForTrack:function(e){return"video"===(null==e?void 0:e.type)}},{name:"media-capabilities",fn:async function(e=[],{track:t}){if(null==t||!t.preferredCodec){const n=await ib.sortRepsCodecs(e);if(!Array.isArray(n)||0===n.length)return e;t.preferredCodec=n[0]}return e.filter((e=>(null==e?void 0:e.baseCodec)===t.preferredCodec))},isRelevantForTrack:function(e){return"video"===(null==e?void 0:e.type)}}].forEach((({name:e,fn:t,isRelevantForTrack:n})=>{!function(e,t,{isRelevantForTrack:n}={}){if(!e||"function"!=typeof t)throw new Error("registerRepresentationFilter requires a name and function");const i="function"==typeof n?n:hb;db.push({name:e,fn:t,isRelevantForTrack:i})}(e,t,{isRelevantForTrack:n})}));const fb=Ju("Node","warn"),pb={start:0,end:0},mb=.001;function vb(e){if(!Array.isArray(e)||!e.length)return;const t=e.map((e=>{const t=Number(null==e?void 0:e.segStart),n=Number(null==e?void 0:e.segDuration);return!Number.isFinite(t)||!Number.isFinite(n)||n<=0?null:{start:t,duration:n}}));if(t.some((e=>!e)))return;const n=t[0];return t.every((e=>Math.abs(e.start-n.start)<=mb&&Math.abs(e.duration-n.duration)<=mb))?{offset:n.start,duration:n.duration}:void 0}var gb=new WeakMap,yb=new WeakMap,bb=new WeakMap,kb=new WeakMap,wb=new WeakMap,xb=new WeakMap,_b=new WeakMap,Tb=new WeakMap,Ib=new WeakMap,Eb=new WeakMap,Sb=new WeakSet;class Ab extends Zu{constructor(e={},t={}){super(),O(this,Sb),F(this,gb,void 0),F(this,yb,void 0),F(this,bb,void 0),F(this,kb,void 0),F(this,wb,void 0),F(this,xb,void 0),F(this,_b,void 0),F(this,Tb,void 0),F(this,Ib,void 0),F(this,Eb,[]);const{id:n,manifestRef:i,duration:r,width:o,height:s,metadata:a={},children:l=[]}=e;if(!n)throw new Error("Node requires id");if(!i)throw new Error("Node requires manifestRef");this.id=n,this.manifestRef=i,this.metadata=a,this.state="pending",this.error=void 0,this.tracks=[],this.mainTrackId=void 0,this.imageFallbackActive=!1,this.disabledTracks=[],this.disabledTrackTypes=Array.isArray(t.disabledTracks)?t.disabledTracks.filter((e=>"string"==typeof e)):[],this.enabledRepFilters=Array.isArray(t.enabledRepFilters)?t.enabledRepFilters:void 0,this.forceVideoCodec="string"==typeof t.forceVideoCodec&&t.forceVideoCodec.trim()?t.forceVideoCodec.trim():void 0,C(_b,this,!0===t.forceImageFallback),C(gb,this,t.abrSelector),C(yb,this,t.assetsDeliveryService),C(kb,this,Og(r)?r:void 0),C(wb,this,Og(o)?o:void 0),C(xb,this,Og(s)?s:void 0),C(Tb,this,t&&"object"==typeof t.mediaHostRewriteMap?t.mediaHostRewriteMap:void 0),C(Ib,this,Og(t.maxManifestLoadAttempts)?t.maxManifestLoadAttempts:1/0),this.manifestLoadAttempts=0,this.manifestLoadError=void 0,C(Eb,this,Ky(l))}setChildren(e){const t=Ky(e);return A(Sb,this,Gb).call(this,t,{emit:!0})}addChild(e){const t=Hy(e),n=M(Eb,this).slice(),i=n.findIndex((e=>(null==e?void 0:e.nodeId)===t.nodeId));if(i>=0){var r;if((null===(r=n[i])||void 0===r?void 0:r.weight)===t.weight)return this.children;n[i]=t}else n.push(t);return A(Sb,this,Gb).call(this,n,{emit:!0})}removeChild(e){const t=Gy(e);if(!t)return this.children;const n=M(Eb,this).filter((e=>(null==e?void 0:e.nodeId)!==t));return n.length===M(Eb,this).length?this.children:A(Sb,this,Gb).call(this,n,{emit:!0})}async load(e={}){const{loadingMode:t="full",signal:n}=e;fb.info(`[load] [${this.id}] Loading node in '${t}' mode`);try{if(n&&n.aborted)throw ay();"ready"!==this.state&&await this.resolve({signal:n});const e="partial"===t,i=[];this.tracks.forEach((t=>{const n=t.segments||[];if(e){const e=n.find((e=>e.isInit)),r=n.find((e=>!e.isInit));e&&Array.isArray(e.representations)&&!e.isLoaded&&i.push({track:t,segment:e}),r&&Array.isArray(r.representations)&&!r.isLoaded&&i.push({track:t,segment:r})}else n.forEach((e=>{Array.isArray(e.representations)&&!e.isLoaded&&i.push({track:t,segment:e})}))}));const r=i.filter((({segment:e})=>e.isInit)),o=i.filter((({segment:e})=>!e.isInit)),s=o.length?o[0]:void 0,a=r.map((({track:e,segment:t})=>A(Sb,this,jb).call(this,e,t,n))),l=s?A(Sb,this,Ub).call(this,s.segment,s.track,n):Promise.resolve();await Promise.all([...a,l]);const c=s?o.slice(1):o;for(const e of c)await A(Sb,this,Ub).call(this,e.segment,e.track,n);if(n&&n.aborted)throw ay();return this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:t}),this}catch(e){if(ly(e,n))throw e;throw this.trigger("node:loaderror",{nodeId:this.id,node:this,error:e,loadingMode:t}),e}}async loadMediaSegmentsAtOffset(e,t={}){const n=Number(e);if(fb.info(`[loadMediaSegmentsAtOffset] [${this.id}] Loading media segments at offset ${n}`),!Number.isFinite(n))return;const{signal:i}=t;if(i&&i.aborted)throw ay();if("ready"!==this.state&&await this.resolve({signal:i}),"ready"!==this.state)return;const r=[],o=[];if(this.tracks.forEach((e=>{const t=(null==e?void 0:e.segments)||[];if(!Array.isArray(t)||!t.length)return;const s=t.find((e=>(null==e?void 0:e.isInit)&&Array.isArray(null==e?void 0:e.representations)));s&&!s.isLoaded&&r.push(A(Sb,this,jb).call(this,e,s,i)),t.forEach((t=>{if(!t||t.isInit||!Array.isArray(t.representations))return;const i=Number(t.offset);Number.isFinite(i)&&Math.abs(i-n)<=mb&&!t.isLoaded&&o.push({segment:t,track:e})}))})),r.length||o.length){if(await Promise.all(r),o.length&&await Promise.all(o.map((({segment:e,track:t})=>A(Sb,this,Ub).call(this,e,t,i)))),i&&i.aborted)throw ay();this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:"segment-offset",offsetSeconds:n})}}async resolve(e={}){const{signal:t,manifestOverride:n}=e;let i=!0;for(;i;){if(i=!1,"ready"===this.state)return this;if("resolving"===this.state)try{return await M(bb,this)}catch(e){if(!ly(e)||t&&t.aborted)throw e;i=!0;continue}if(t&&t.aborted)throw ay();if(this.hasExceededManifestLoadAttempts()){const e=this.manifestLoadError||new Error("Manifest load retry limit reached");throw this.state="failed",this.error=e,e}const e=A(Sb,this,Rb).call(this);return this.state="resolving",this.error=void 0,C(bb,this,(async()=>{try{const e=await A(Sb,this,qb).call(this,{signal:t,manifestOverride:n});if(t&&t.aborted)throw ay();let i=Zy.parse(e);return i=A(Sb,this,Pb).call(this,i),this.tracks=(i.tracks||[]).map((e=>e instanceof Vy?e:new Vy(e))),this.mainTrackId=i.mainTrackId||this.mainTrackId,this.metadata=i.metadata||this.metadata,A(Sb,this,Kb).call(this),A(Sb,this,Hb).call(this),await A(Sb,this,Vb).call(this),this.state="ready",this}catch(n){if(ly(n,t))throw A(Sb,this,Db).call(this,e),n;throw this.state="failed",this.error=n,n}})()),M(bb,this)}return M(bb,this)}evict(){this.tracks.forEach((e=>{(e.segments||[]).forEach((e=>{e.evict()}))}))}get children(){return M(Eb,this).slice()}set children(e){this.setChildren(e)}get duration(){if(!this.mainTrackId)return 0;const e=this.tracks.find((e=>e.id===this.mainTrackId));return e?Og(e.duration)?e.duration:e.endTime:0}get retainedByteLength(){let e=0;return this.tracks.forEach((t=>{(Array.isArray(t.segments)?t.segments:[]).forEach((t=>{e+=Og(t.retainedByteLength)?t.retainedByteLength:0}))})),e}get buffered(){if("ready"!==this.state)return pb;const e=Array.isArray(this.tracks)?this.tracks.find((e=>(null==e?void 0:e.id)===this.mainTrackId)):void 0,t=this.duration;if(!e||!Og(t))return pb;const n=Array.isArray(this.tracks)?this.tracks.map((e=>{if(!e||void 0===e.buffered)return;const t=e.buffered;return t&&Number.isFinite(t.start)&&Number.isFinite(t.end)?{track:e,range:t}:void 0})).filter(Boolean):[];if(!n.length)return pb;if(n.length===this.tracks.length&&n.every((({track:e,range:t})=>{const n=e.endTime,i=Og(e.offset)?e.offset:0;return Number.isFinite(n)&&t.start<=i&&t.end>=n})))return{start:0,end:t};const i=n.reduce(((e,{range:t})=>Math.min(e,t.end)),1/0);if(!Number.isFinite(i))return pb;const r=Math.min(i,t);return r>0?{start:0,end:r}:pb}get isLoaded(){return"ready"===this.state&&(Array.isArray(this.tracks)?this.tracks:[]).flatMap((e=>Array.isArray(null==e?void 0:e.segments)?e.segments:[])).every((e=>e.isLoaded))}hasExceededManifestLoadAttempts(){if(!Number.isFinite(M(Ib,this))||M(Ib,this)<=0)return!1;if(!this.manifestLoadError)return!1;const e=Number(this.manifestLoadAttempts);return Number.isFinite(e)&&e>=M(Ib,this)}}function Nb(e){return function(e,t){if(!e||"string"!=typeof e)return e;if(!t||"object"!=typeof t)return e;const n=ld&&"function"==typeof ld.URL?ld.URL:"function"==typeof URL?URL:null;if(!n)return e;let i;try{i=new n(e)}catch(t){return e}const r=function(e,t){const n=null==e?void 0:e.hostname,i=null==e?void 0:e.pathname;if("string"!=typeof n||"string"!=typeof i)return e;if(!/^s3(?:[.-][a-z0-9-]+)?\.amazonaws\.com$/i.test(n))return e;const r=i.split("/").filter(Boolean);if(r.length<2)return e;const o=r[0],s=new t(e.toString());return s.hostname=`${o}.${n}`,s.pathname=`/${r.slice(1).join("/")}`,s}(i,n),o=t[r.hostname]?r:i,s=t[o.hostname];if(!s||"string"!=typeof s)return e;let a;try{a=new n(s)}catch(t){return e}return a.protocol&&a.host?(o.protocol=a.protocol,o.host=a.host,o.toString()):e}(e,M(Tb,this))}function Mb(){return M(_b,this)||void 0===ld.VideoDecoder}function Fb(){return this.manifestRef&&"object"==typeof this.manifestRef&&"assets-delivery-service"===this.manifestRef.type}function Cb(e){if(!A(Sb,this,Fb).call(this))return!1;if(!A(Sb,this,Mb).call(this))return!1;const t=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[],n=t.find((t=>(null==t?void 0:t.id)===(null==e?void 0:e.mainTrackId)))||t[0];return"image"!==(null==n?void 0:n.type)}function Ob(e){const t=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[],n=function(e){const t=Number(null==e?void 0:e.duration);if(Number.isFinite(t)&&t>0)return t;const n=Array.isArray(null==e?void 0:e.segments)?e.segments:[];let i=0;return n.forEach((e=>{if(null!=e&&e.isInit)return;const t=Number(null==e?void 0:e.offset),n=Number(null==e?void 0:e.duration);!Number.isFinite(t)||!Number.isFinite(n)||n<=0||(i=Math.max(i,t+n))})),i>0?i:void 0}(t.find((t=>(null==t?void 0:t.id)===(null==e?void 0:e.mainTrackId)))||t[0]);return Og(n)?n:Og(M(kb,this))?M(kb,this):void 0}function Pb(e){if(this.imageFallbackActive=!1,!A(Sb,this,Cb).call(this,e))return e;if(!M(yb,this)||"function"!=typeof M(yb,this).resolveImageOne)return e;const t=M(yb,this).resolveImageOne(this.manifestRef),n=A(Sb,this,Nb).call(this,null==t?void 0:t.url);if(!n)return e;const i={typeHint:"image",url:n,duration:A(Sb,this,Ob).call(this,e),width:M(wb,this),height:M(xb,this)},r=Zy.parse(i);return e&&"object"==typeof e.metadata&&!Array.isArray(e.metadata)&&(r.metadata=e.metadata),this.imageFallbackActive=!0,r}function Rb(){return{state:this.state,error:this.error,tracks:this.tracks,mainTrackId:this.mainTrackId,metadata:this.metadata,imageFallbackActive:this.imageFallbackActive,disabledTracks:this.disabledTracks,manifestRef:this.manifestRef,manifestLoadAttempts:this.manifestLoadAttempts,manifestLoadError:this.manifestLoadError}}function Db(e){e&&(this.state=e.state,this.error=e.error,this.tracks=e.tracks,this.mainTrackId=e.mainTrackId,this.metadata=e.metadata,this.imageFallbackActive=e.imageFallbackActive,this.disabledTracks=e.disabledTracks,this.manifestRef=e.manifestRef,this.manifestLoadAttempts=e.manifestLoadAttempts,this.manifestLoadError=e.manifestLoadError)}function Lb(){const e=Number(this.manifestLoadAttempts);this.manifestLoadAttempts=Number.isFinite(e)&&e>0?e+1:1,this.manifestLoadError=void 0}function Bb(e){this.manifestLoadError=e||new Error("Manifest load failed")}function zb(e){if(!e)return null;const t={loadAttempts:Number(e.loadAttempts),loadError:e.loadError};if("function"==typeof e.markLoadAttempt)return e.markLoadAttempt(),t;const n=Number(e.loadAttempts);return e.loadAttempts=Number.isFinite(n)&&n>0?n+1:1,e.loadError=void 0,t}function Wb(e,t){if(!e||!t)return;const n=Number(t.loadAttempts);e.loadAttempts=Number.isFinite(n)&&n>=0?n:0,e.loadError=t.loadError}function $b(e,t){e&&("function"!=typeof e.setLoadError?e.loadError=t||new Error("Segment load failed"):e.setLoadError(t))}async function jb(e,t,n){const i=A(Sb,this,zb).call(this,t);try{const i=t.representations.map((async i=>{const r=A(Sb,this,Nb).call(this,i.url),o=await yy(r,{returnType:"arrayBuffer",signal:n,onProgress:({loaded:n,total:i,chunk:r})=>{t&&"function"==typeof t.setDownloadProgress&&t.setDownloadProgress(n,i),this.trigger("segment:chunk",{nodeId:this.id,trackId:null==e?void 0:e.id,trackType:null==e?void 0:e.type,segmentId:t.id,isInit:!0,loaded:n,total:i,chunk:r})}}),s=o instanceof ArrayBuffer?o:null==o?void 0:o.arrayBuffer;s&&t.setRepresentationBuffer(i.id,s)}));await Promise.all(i)}catch(e){if(ly(e,n))throw A(Sb,this,Wb).call(this,t,i),e;throw A(Sb,this,$b).call(this,t,e),e}}async function Ub(e,t,n){const i=M(gb,this),r={representations:e.representations,nodeId:this.id,trackId:null==t?void 0:t.id,segmentId:e.id},o=i&&"function"==typeof i.select?i.select(r):void 0,s=e.representations.find((e=>e.id===o))||e.representations[0];if(!s)return;e&&"function"==typeof e.setABRDecisionSnapshot&&e.setABRDecisionSnapshot(r.abrDecision),e.setChosenRepresentation(s);const a=A(Sb,this,zb).call(this,e);try{const i=A(Sb,this,Nb).call(this,s.url),r=await yy(i,{returnType:"arrayBuffer",signal:n,onProgress:({loaded:n,total:i,chunk:r})=>{e&&"function"==typeof e.setDownloadProgress&&e.setDownloadProgress(n,i),this.trigger("segment:chunk",{nodeId:this.id,trackId:null==t?void 0:t.id,trackType:null==t?void 0:t.type,segmentId:e.id,isInit:!1,loaded:n,total:i,chunk:r})}}),o=r instanceof ArrayBuffer?r:null==r?void 0:r.arrayBuffer;o&&(e.setRepresentationBuffer(s.id,o),e.setChosenRepresentation(s))}catch(t){if(ly(t,n))throw A(Sb,this,Wb).call(this,e,a),t;throw A(Sb,this,$b).call(this,e,t),t}}async function qb(e={}){const{signal:t,manifestOverride:n}=e;if(t&&t.aborted)throw ay();A(Sb,this,Lb).call(this);try{let e=this.manifestRef;if(n&&"object"==typeof n){if(A(Sb,this,Fb).call(this)&&"string"==typeof n.encodeProfile&&n.encodeProfile&&(this.manifestRef={...this.manifestRef,encodeProfile:n.encodeProfile},e=this.manifestRef),n.ivd)return{typeHint:"ivd",body:n.ivd};if(n.body){const e=A(Sb,this,Nb).call(this,n.url);return{typeHint:n.typeHint,url:e,mimeType:n.mimeType,body:n.body,duration:M(kb,this),width:M(wb,this),height:M(xb,this)}}"string"==typeof n.url&&n.url&&(e=n)}if(e&&"object"==typeof e&&"assets-delivery-service"===e.type){if(!M(yb,this)||"function"!=typeof M(yb,this).resolveOne)throw new Error("AssetsDeliveryService is required for assets-delivery-service manifestRef");const n=await M(yb,this).resolveOne(e,{signal:t});if(!n)throw new Error("AssetsDeliveryService returned empty result");if("string"==typeof n.encodeProfile&&n.encodeProfile&&(this.manifestRef={...e,encodeProfile:n.encodeProfile}),n.ivd)return{typeHint:"ivd",body:n.ivd};const i=n.typeHint,r=A(Sb,this,Nb).call(this,n.url),o=n.mimeType,s=n.body;if(r||s||o)return{typeHint:i,url:r,mimeType:o,body:s,duration:M(kb,this),width:M(wb,this),height:M(xb,this)};throw new Error("AssetsDeliveryService returned unsupported manifest shape")}if(e&&"object"==typeof e){const t=A(Sb,this,Nb).call(this,e.url),n=e.mimeType;if(e.body)return{url:t,mimeType:n,body:"string"==typeof e.body?e.body:JSON.stringify(e.body)}}if("string"==typeof e||e&&"string"==typeof e.url){const n="string"==typeof e?e:e.url,i=A(Sb,this,Nb).call(this,n),r="object"==typeof e?e.typeHint:void 0,o="object"==typeof e?e.mimeType:void 0;if("image"===Zy.inferType({typeHint:r,url:i,mimeType:o})){const t="object"==typeof e&&Og(e.duration)?e.duration:M(kb,this);return{typeHint:"image",url:i,mimeType:o,duration:t,width:"object"==typeof e&&Og(e.width)?e.width:M(wb,this),height:"object"==typeof e&&Og(e.height)?e.height:M(xb,this)}}const s=await yy(i,{returnType:"default",signal:t});return{url:i,body:s&&s.response&&"function"==typeof s.response.text?await s.response.text():void 0,mimeType:(s&&s.response&&s.response.headers&&"function"==typeof s.response.headers.get&&s.response.headers.get("content-type")?s.response.headers.get("content-type"):void 0)||o}}throw new Error("Node manifestRef is invalid or missing")}catch(e){if(ly(e,t))throw e;throw A(Sb,this,Bb).call(this,e),e}}async function Vb(){const e=db.slice().filter((e=>!this.enabledRepFilters||this.enabledRepFilters.includes(e.name)));if(e.length)for(let t=0;t<this.tracks.length;t+=1){const n=this.tracks[t],i=Array.isArray(n.segments)?n.segments:[],r=[];for(let t=0;t<i.length;t+=1){const o=i[t];if(!Array.isArray(o.representations)){r.push(o);continue}o.appliedFilters=o.appliedFilters||[];let s=o.representations;for(let t=0;t<e.length;t+=1){const{name:i,fn:r,isRelevantForTrack:a}=e[t];if(!a(n))continue;const l=await r(s,{segment:o,track:n,node:this});Array.isArray(l)&&(s=l),o.appliedFilters.push(i)}if(o.representations=s,o.representations.length){if(!o.isInit){const e=vb(o.representations);e&&(o.offset=e.offset,o.duration=e.duration)}r.push(o)}}r.length!==i.length&&n&&"function"==typeof n.setSegments&&n.setSegments(r)}}function Gb(e,{emit:t=!1}={}){return function(e=[],t=[]){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1){const i=e[n],r=t[n];if((null==i?void 0:i.nodeId)!==(null==r?void 0:r.nodeId)||(null==i?void 0:i.weight)!==(null==r?void 0:r.weight))return!1}return!0}(M(Eb,this),e)||(C(Eb,this,e),t&&(n=this)&&"function"==typeof n.trigger&&n.trigger("node:childrenchanged",{nodeId:n.id,node:n,children:Array.isArray(n.children)?n.children:[]})),this.children;var n}function Hb(){var e;const t=Array.isArray(this.disabledTrackTypes)?this.disabledTrackTypes:[];if(!t.length||!Array.isArray(this.tracks)||!this.tracks.length)return void(this.disabledTracks=[]);const n=new Set(t),i=[],r=[];this.tracks.forEach((e=>{e&&n.has(e.type)?r.push(e):e&&i.push(e)})),this.tracks=i,this.disabledTracks=r,this.mainTrackId&&!i.some((e=>e.id===this.mainTrackId))&&(this.mainTrackId=null===(e=i[0])||void 0===e?void 0:e.id)}function Kb(){if(!Array.isArray(this.tracks)||!this.tracks.length)return;const e=this.duration;if(!Og(e))return;const t=[new $y({name:"nodestart",timestamp:0,data:{id:this.id},isSticky:!0}),new $y({name:"nodeend",timestamp:e,data:{id:this.id}})],n=new Vy({id:`${this.id}-auto-cue`,type:"cue",cues:t,offset:0,duration:e});this.tracks.push(n)}var Xb=new WeakMap,Yb=new WeakMap,Qb=new WeakMap,Jb=new WeakMap,Zb=new WeakSet;class ek extends od{constructor(...e){super(...e),O(this,Zb),F(this,Xb,new Map),F(this,Yb,new Map),F(this,Qb,void 0),F(this,Jb,void 0);const[t,n]=e;C(Qb,this,t),C(Jb,this,n)}get name(){return"NodeRepository"}get defaults(){return{enabledRepFilters:["containers","force-video-codec","media-capabilities"],disabledTracks:xy("disabledTracks"),forceVideoCodec:xy("forceVideoCodec"),forceImageFallback:xy("forceImageFallback"),mediaHostRewriteMap:xy("mediaHostRewriteMap"),maxManifestLoadAttempts:3}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"get","list"])}onDispose(){M(Xb,this).forEach(((e,t)=>{const n=M(Yb,this).get(t);n&&e&&"function"==typeof e.off&&e.off(iv.NODE_CHILDREN_CHANGED,n)})),M(Yb,this).clear(),M(Xb,this).clear()}add(e){const t=e instanceof Ab?e:new Ab(e,{enabledRepFilters:this.settings.enabledRepFilters,disabledTracks:this.settings.disabledTracks,forceVideoCodec:this.settings.forceVideoCodec,forceImageFallback:this.settings.forceImageFallback,mediaHostRewriteMap:this.settings.mediaHostRewriteMap,maxManifestLoadAttempts:this.settings.maxManifestLoadAttempts,abrSelector:M(Qb,this),assetsDeliveryService:M(Jb,this)});if(!t.id)throw new Error("NodeRepository.add requires node with id");if(M(Xb,this).has(t.id))throw new Error(`NodeRepository.add: node with id ${t.id} already exists`);return M(Xb,this).set(t.id,t),A(Zb,this,tk).call(this,t),this.trigger(iv.NODE_ADD,{node:t}),t}get(e){const t=(null==e?void 0:e.id)||e;if(!t)throw new Error("NodeRepository.get requires node or id");return M(Xb,this).get(t)}list(){return Array.from(M(Xb,this).values())}}function tk(e){if(!e||"function"!=typeof e.on||!e.id)return;const t=e=>{this.trigger(iv.NODE_CHILDREN_CHANGED,e)};e.on(iv.NODE_CHILDREN_CHANGED,t),M(Yb,this).set(e.id,t)}var nk=new WeakMap,ik=new WeakMap,rk=new WeakSet;class ok extends od{constructor(...e){super(...e),O(this,rk),F(this,nk,void 0),F(this,ik,new Map);const[t]=e;C(nk,this,t)}get name(){return"ABRSelector"}get defaults(){return{safetyMargin:.35,minBufferForUpgrade:5,minBufferCritical:1,hysteresisRatio:1.1,abrStrategy:xy("abrStrategy")}}select(e={}){var t;const{representations:n=[],bufferSeconds:i}=e;if(!Array.isArray(n)||0===n.length)return;const r=M(nk,this)&&"function"==typeof M(nk,this).getKbps?M(nk,this).getKbps():void 0,o=A(rk,this,sk).call(this,n[0]),s=M(ik,this).get(o),a=this.settings.abrStrategy||"auto";this.log.debug(`[select] strategy=${a}, bw=${r}, buffer=${i}, prev=${s}`);const l=n.slice().sort(((e,t)=>A(rk,this,ak).call(this,e.bandwidth)-A(rk,this,ak).call(this,t.bandwidth)));if("bottom"===a){const t=l[0];return A(rk,this,uk).call(this,t,e,{decisionReason:"strategy:bottom",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==t?void 0:t.id}if("top"===a){const t=l[l.length-1];return A(rk,this,uk).call(this,t,e,{decisionReason:"strategy:top",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==t?void 0:t.id}if("random"===a){const t=l[Math.floor(Math.random()*l.length)];return A(rk,this,uk).call(this,t,e,{decisionReason:"strategy:random",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==t?void 0:t.id}const c=Number.isFinite(i)?i:void 0,u=Og(r)?r*this.settings.safetyMargin:void 0;let d="auto:highest-available";if(s&&void 0!==c&&c<this.settings.minBufferCritical){const t=l[0];return this.log.debug("[select] critical buffer -> lowest",e),A(rk,this,uk).call(this,t,e,{decisionReason:"auto:critical-buffer",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:u,bufferSeconds:c}),null==t?void 0:t.id}let h=l[l.length-1];if(void 0!==u){const t=l.filter((e=>A(rk,this,ak).call(this,e.bandwidth)<=u));t.length>0?(h=t[t.length-1],d="auto:highest-under-safe-bandwidth",this.log.debug("[select] under safe bandwidth ->",h.id,e)):(this.log.debug("[select] no rep under safe bandwidth, fallback lowest",e),h=l[0],d="auto:no-rep-under-safe-bandwidth")}if(s&&void 0!==c&&c<this.settings.minBufferForUpgrade){const t=n.find((e=>e.id===s));t&&Og(t.bandwidth)&&Og(h.bandwidth)&&h.bandwidth/t.bandwidth>this.settings.hysteresisRatio&&(h=n.filter((e=>e.bandwidth&&e.bandwidth<=t.bandwidth*this.settings.hysteresisRatio)).sort(((e,t)=>e.bandwidth-t.bandwidth)).pop()||t,d="auto:hysteresis-hold",this.log.debug("[select] hysteresis prevents upgrade; hold",h.id,e))}return A(rk,this,uk).call(this,h,e,{decisionReason:d,trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:u,bufferSeconds:c}),null===(t=h)||void 0===t?void 0:t.id}onDispose(){M(ik,this).clear(),C(nk,this,null)}}function sk(e){var t,n;return(null===(t=e.mime)||void 0===t||null===(n=t.split)||void 0===n||null===(n=n.call(t,"/"))||void 0===n?void 0:n[0])||"unknown"}function ak(e){return Og(e)?e/1e3:0}function lk(e){return Og(e)?e/1e3:void 0}function ck(e,t,n={}){const i=Array.isArray(null==t?void 0:t.representations)?t.representations.map((e=>({id:null==e?void 0:e.id,bandwidthKbps:A(rk,this,lk).call(this,null==e?void 0:e.bandwidth)}))):[];return{timeMs:Date.now(),strategy:this.settings.abrStrategy||"auto",decisionReason:n.decisionReason,nodeId:null==t?void 0:t.nodeId,trackId:null==t?void 0:t.trackId,segmentId:null==t?void 0:t.segmentId,trackType:n.trackType,measuredDownloadSpeedKbps:Number.isFinite(n.measuredDownloadSpeedKbps)?n.measuredDownloadSpeedKbps:void 0,safeBandwidthKbps:Number.isFinite(n.safeBandwidthKbps)?n.safeBandwidthKbps:void 0,bufferSeconds:Number.isFinite(n.bufferSeconds)?n.bufferSeconds:void 0,previousRepresentationId:n.previousRepresentationId,selectedRepresentationId:null==e?void 0:e.id,selectedRepresentationBandwidthKbps:A(rk,this,lk).call(this,null==e?void 0:e.bandwidth),safetyMargin:Number(this.settings.safetyMargin),minBufferForUpgrade:Number(this.settings.minBufferForUpgrade),minBufferCritical:Number(this.settings.minBufferCritical),hysteresisRatio:Number(this.settings.hysteresisRatio),availableRepresentations:i}}function uk(e,t,n={}){if(!e)return;const i=A(rk,this,ck).call(this,e,t,n);t&&"object"==typeof t&&(t.abrDecision=i),this.log.info("[select] Chosen representation:",e,"context:",t,"decision:",i),this.trigger("abr:selection",{representation:e,context:t,strategy:this.settings.abrStrategy,decision:i});const r=A(rk,this,sk).call(this,e);M(ik,this).set(r,e.id)}var dk=new WeakMap,hk=new WeakSet;class fk extends od{constructor(...e){super(...e),O(this,hk),F(this,dk,void 0);const[t]=e;if(C(dk,this,t),!M(dk,this)||"function"!=typeof M(dk,this).list)throw new Error("NodePrioritizer requires a NodeRepository instance")}get name(){return"NodePrioritizer"}get defaults(){return{levelMultiplier:1,priorityMultiplier:.3}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"sortNodes"])}onDispose(){C(dk,this,null)}getPrioritizationSnapshot(e){const t=M(dk,this).list();if(!t.length)return{orderedIds:[],reachableIds:[]};const{levels:n,weights:i}=A(hk,this,pk).call(this,t,e);return{orderedIds:A(hk,this,mk).call(this,t,n,i),reachableIds:Array.from(n.keys())}}sortNodes(e){const{orderedIds:t}=this.getPrioritizationSnapshot(e);return t.length?(this.log.info(`[sortNodes(${e})] Sorted nodes: [${t.join(", ")}]`),t):[]}getReachableNodeIds(e){const{reachableIds:t}=this.getPrioritizationSnapshot(e);return t}}function pk(e,t){const n=new Map;e.forEach((e=>{e&&e.id&&n.set(e.id,e)}));const i=new Map,r=new Map;if(!t||!n.has(t))return{levels:i,weights:r};const o=[{id:t,level:0,priority:1}];for(i.set(t,0),r.set(t,1);o.length;){const{id:e,level:t,priority:s}=o.shift(),a=n.get(e),l=Array.isArray(null==a?void 0:a.children)?a.children:[];for(let e=0;e<l.length;e+=1){const a=l[e],c=(null==a?void 0:a.nodeId)||(null==a?void 0:a.id);if(!c||!n.has(c)||i.has(c))continue;const u=Og(null==a?void 0:a.weight)?a.weight:1,d=Math.max(u,s);i.set(c,t+1),r.set(c,d),o.push({id:c,level:t+1,priority:d})}}return{levels:i,weights:r}}function mk(e,t,n){const i=t.size>0,{levelMultiplier:r,priorityMultiplier:o}=this.settings,s=e.map((e=>{var s;const a=t.has(e.id)?t.get(e.id):i?Number.MAX_SAFE_INTEGER:0,l=Number.isFinite(a)?a:Number.MAX_SAFE_INTEGER,c=null!==(s=n.get(e.id))&&void 0!==s?s:1,u=(Number.isFinite(l)?r*l:Number.MAX_SAFE_INTEGER)+o*c;return{id:e.id,score:u,level:l,priorityWeight:c}}));return s.sort(((e,t)=>e.score!==t.score?e.score-t.score:e.level!==t.level?e.level-t.level:e.priorityWeight!==t.priorityWeight?e.priorityWeight-t.priorityWeight:e.id.localeCompare(t.id))),s.map((e=>e.id))}function vk(e,t){return function(e,t){const n=Array.isArray(e)?e:[];return n.length?t&&n.includes(t)?t:n[0]:t||void 0}(null==e?void 0:e.availableEncodeProfiles,t)}function gk(e,t){const n=e&&"object"==typeof e?{...e}:e;return n&&"object"==typeof n?("string"==typeof t&&t?n.encodeProfile=t:delete n.encodeProfile,n):n}function yk(e){return"string"==typeof e&&e.startsWith("cmaf:")}function bk(e){return"image"===(null==e?void 0:e.assetType)?"image":"ivd"}function kk(e){if(!e||"object"!=typeof e)return e;if(Object.prototype.hasOwnProperty.call(e,"mpd")){const t="string"==typeof e.mpdUrl&&e.mpdUrl||"string"==typeof e.url&&e.url||void 0;return{typeHint:"dash",body:e.mpd,url:t}}return e.ivd||e.url||e.body||e.mimeType||e.typeHint?e:(t=e)&&"object"==typeof t&&Array.isArray(t.representations)?{ivd:e}:e;var t}var wk=new WeakMap,xk=new WeakMap,_k=new WeakSet;class Tk extends od{constructor(...e){super(...e),O(this,_k),F(this,wk,void 0),F(this,xk,void 0);const[,t={}]=e;C(wk,this,"function"==typeof t.fetchFn?t.fetchFn:void 0),C(xk,this,sy())}get name(){return"AssetsDeliveryService"}get defaults(){return{assetsDeliveryServiceUrl:"https://assets.eko.com",profile:xy("encodeProfile"),maxBatchSize:5,imageQueryParams:{startOffset:0,width:1024}}}async resolveOne(e,t={}){var n;const i=await this.resolve([e],t);if(!i.length)return;const r=i[0],o=null==r?void 0:r.manifest,s=null==r||null===(n=r.manifestRef)||void 0===n?void 0:n.encodeProfile;return o&&"object"==typeof o&&"string"==typeof s&&s?{...o,encodeProfile:s}:o}resolveImageOne(e){if(!A(_k,this,Ek).call(this,e))return;const t=vk(e,this.settings.profile),n=function(e,t,n){const i=function(e,t,n){const i=(e||"").replace(/\/$/,""),r=null==n?void 0:n.assetId,o=null==n?void 0:n.assetRevision;if(i&&t&&"string"==typeof r&&"number"==typeof o)return`${i}/${t}/${encodeURIComponent(r)}/${o}`}(e,"image",t);if(!i)return;const r=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return"";const t=new URLSearchParams;return Object.keys(e).forEach((n=>{if("string"!=typeof n||!n)return;const i=e[n];null!=i&&("number"!=typeof i||Number.isFinite(i))&&("string"!=typeof i&&"number"!=typeof i&&"boolean"!=typeof i||t.set(n,String(i)))})),t.toString()}(n);return r?`${i}?${r}`:i}(this.settings.assetsDeliveryServiceUrl||"",e,this.settings.imageQueryParams);if(!n)return;const i={typeHint:"image",url:n};return"string"==typeof t&&t&&(i.encodeProfile=t),i}async resolve(e=[],t={}){const n=(Array.isArray(e)?e:[e]).filter((e=>A(_k,this,Ek).call(this,e)));if(!n.length)return[];const i=A(_k,this,Ik).call(this,t);if(i&&i.aborted)return[];const r=[],o=this.settings.profile;n.forEach((e=>{if("image"!==bk(e))return;const t=this.resolveImageOne(e);t&&t.url&&r.push({manifestRef:gk(e,t.encodeProfile),manifest:{typeHint:"image",url:t.url}})}));const s=n.filter((e=>"image"!==bk(e))).map((e=>function(e,t){const n=vk(e,t);return{ref:e,profile:n,route:yk(n)?"dash":"ivd"}}(e,o))),a=A(_k,this,Ak).call(this,s);for(const{refs:e,route:t}of a){if(i&&i.aborted)return r;const{url:n}=A(_k,this,Nk).call(this,e,t),o=await A(_k,this,Mk).call(this,n,{method:"GET",signal:i});o&&"object"==typeof o&&e.forEach((({ref:e,profile:t})=>{const n=`${e.assetId}:${e.assetRevision}`,i=o[n]||o[e.assetId]||o[e.assetId||n];i&&r.push({manifestRef:gk(e,t),manifest:kk(i)})}))}return r}onDispose(){M(xk,this)&&M(xk,this).abort(),C(xk,this,null),C(wk,this,null)}}function Ik(e){return e&&e.signal?e.signal:M(xk,this)?M(xk,this).signal:void 0}function Ek(e){const t="number"==typeof(null==e?void 0:e.assetRevision)&&Number.isFinite(e.assetRevision)&&e.assetRevision>=0;return e&&"assets-delivery-service"===e.type&&"string"==typeof e.assetId&&t}function Sk(e,t){const n=Number.isFinite(t)&&t>0?t:e.length,i=[];for(let t=0;t<e.length;t+=n)i.push(e.slice(t,t+n));return i}function Ak(e){if(!Array.isArray(e)||!e.length)return[];const t=[];e.forEach((e=>{const n=t[t.length-1];n&&n.route===e.route?n.refs.push(e):t.push({route:e.route,refs:[e]})}));const n=[];return t.forEach((e=>{A(_k,this,Sk).call(this,e.refs,this.settings.maxBatchSize).forEach((t=>{n.push({route:e.route,refs:t})}))})),n}function Nk(e,t="ivd"){const n=e.map((({ref:e,profile:t})=>function(e,t){const n=`${e.assetId}:${e.assetRevision}`;return t?`${n}:${t}`:n}(e,t))),i=new URLSearchParams({assets:n.join(","),type:"data"});return{url:`${(this.settings.assetsDeliveryServiceUrl||"").replace(/\/$/,"")}/${"dash"===t?"dash":"ivd"}?${i.toString()}`}}async function Mk(e,t){return M(wk,this)?M(wk,this).call(this,e,t):await yy(e,{returnType:"json",method:(null==t?void 0:t.method)||"GET",signal:null==t?void 0:t.signal})}function Fk({prioritizer:e,repository:t,startNodeId:n,prioritizedIds:i,pendingIds:r,allowedIds:o,filter:s,fallbackToRepository:a=!0}={}){const l=Array.isArray(i)?i:e&&"function"==typeof e.sortNodes?e.sortNodes(n):[],c=a?(f=t)&&"function"==typeof f.list?f.list().map((e=>null==e?void 0:e.id)).filter(Boolean):[]:[],u=l.length?l:c,d=r?new Set(r):null,h=o?new Set(o):null;var f;return u.filter((e=>{if(!e)return!1;if(d&&d.has(e))return!1;if(h&&!h.has(e))return!1;const n=function(e,t){if(e&&"function"==typeof e.get)return e.get(t)}(t,e);return!(!n||"function"==typeof s&&!s(n,e))}))}const Ck=(ld.requestAnimationFrame||ld.mozRequestAnimationFrame||ld.webkitRequestAnimationFrame||ld.msRequestAnimationFrame||(e=>ld.setTimeout(e,1e3/60))).bind(ld),Ok=(ld.cancelAnimationFrame||ld.mozCancelAnimationFrame||ld.webkitCancelAnimationFrame||ld.msCancelAnimationFrame||(e=>ld.clearTimeout(e))).bind(ld),Pk=Ju("ticker","warn");let Rk,Dk=[],Lk=null,Bk=oy();function zk(){Bk=oy();const e=[];let t,n;for(n=Dk.length-1;n>=0;--n)t=Dk[n],Bk>=t.lastTick+t.interval&&e.push(t);for(n=e.length-1;n>=0;--n)if(t=e[n],!t.stopped){t.lastTick=Bk;try{t.callback()}catch(e){console&&"function"==typeof console.error?console.error(e):Pk.error(e)}}Rk=Ck(zk)}function Wk(){oy()-Bk>=200&&(Ok(Rk),zk())}function $k(e){let t=-1;for(let n=0;n<Dk.length;n+=1)if(Dk[n].callback===e){t=n;break}return t}function jk(e,t=0){if(!e||"function"!=typeof e||"number"!=typeof t||t<0)return void Pk.error("[start] Invalid arguments given to start method.",arguments);const n=$k(e);return-1!==n?(Pk.debug("[start] Callback already exists, overriding interval.",arguments),Dk[n].interval=t,e):(Dk.push({callback:e,interval:t,lastTick:oy()}),1===Dk.length&&(Rk=Ck(zk),Lk||(Lk=ld.setInterval(Wk,1e3))),e)}function Uk(e){const t=$k(e);-1!==t?(Dk[t].stopped=!0,Dk.splice(t,1),Dk.length||(Ok(Rk),ld.clearInterval(Lk),Lk=null)):Pk.debug("[stop] Callback not found, doing nothing.",arguments)}function qk(e){return-1!==$k(e)}function Vk(e,t,n){const i="number"==typeof n?n:(null==n?void 0:n.maxQueueSize)||Number.POSITIVE_INFINITY,r=null!=n&&n.immediatelyFlushFirst?"boolean"==typeof n.immediatelyFlushFirst?n.immediatelyFlushFirst?1:0:Number(n.immediatelyFlushFirst):0;let o=0;if("function"!=typeof e)return void Pk.error("[createThrottler] Bad argument given to createThrottler, first argument must be a function.",arguments);Pk.debug("[createThrottler] Creating a new throttler instance.",arguments);const s=[];function a(){Pk.debug("[onThrottlerTick] Calling callback with "+s.length+" queued items.");const t=s.slice(0);s.length=0,Uk(a),e(t)}const l={push:function(e){Pk.debug("[push] Queuing argument:",e),0===s.length&&jk(a,t),s.push(e),o+=1,(o<=r||s.length>=i)&&a()},flush:function(){Pk.debug("[flush] Flushing queue."),0!==s.length&&a()},dispose:function(){Pk.debug("[dispose] Disposing of throttler.");const e=s.slice(0);return s.length=0,Uk(a),e}};return Object.defineProperty(l,"interval",{enumerable:!0,get:function(){return t},set:function(e){"number"==typeof e&&(t=e)}}),l}function Gk(e,t){if(e&&"function"==typeof e)return e.__tickerThrottler||(e.__tickerThrottler=Vk((function(){e()}),t)),"number"==typeof t&&(e.__tickerThrottler.interval=t),e.__tickerThrottler.push(),e.__tickerThrottler;Pk.error("[scheduleExecution] Bad argument given to scheduleExecution, first argument must be a function.",arguments)}var Hk=new WeakMap,Kk=new WeakMap,Xk=new WeakMap,Yk=new WeakMap,Qk=new WeakMap,Jk=new WeakMap,Zk=new WeakMap,ew=new WeakMap,tw=new WeakMap,nw=new WeakMap,iw=new WeakMap,rw=new WeakMap,ow=new WeakMap,sw=new WeakMap,aw=new WeakMap,lw=new WeakMap,cw=new WeakSet;class uw extends od{constructor(...e){super(...e),O(this,cw),F(this,Hk,void 0),F(this,Kk,void 0),F(this,Xk,void 0),F(this,Yk,void 0),F(this,Qk,[]),F(this,Jk,[]),F(this,Zk,new Set),F(this,ew,new Set),F(this,tw,!1),F(this,nw,void 0),F(this,iw,void 0),F(this,rw,void 0),F(this,ow,void 0),F(this,sw,void 0),F(this,aw,void 0),F(this,lw,void 0);const[t,n,i,r]=e;C(Hk,this,t),C(Kk,this,n),C(Xk,this,i),C(Yk,this,r),C(nw,this,sy());const o=e.length?e[e.length-1]:void 0,s=o&&"object"==typeof o&&Number.isFinite(o.maxConcurrent)?o.maxConcurrent:void 0;Number.isFinite(s)&&(this.settings.maxConcurrent=s),C(lw,this,(()=>A(cw,this,ww).call(this))),A(cw,this,pw).call(this),A(cw,this,fw).call(this)}get name(){return"NodeResolver"}get defaults(){return{maxConcurrent:5}}onDispose(){var e;M(nw,this)&&M(nw,this).abort(),C(nw,this,null),M(Yk,this)&&"function"==typeof M(Yk,this).off&&M(rw,this)&&M(Yk,this).off(iv.PLACEMENT_ADDED,M(rw,this)),M(Yk,this)&&"function"==typeof M(Yk,this).off&&M(aw,this)&&M(Yk,this).off(iv.TIMELINE_RESET,M(aw,this)),M(Hk,this)&&"function"==typeof M(Hk,this).off&&M(ow,this)&&M(Hk,this).off(iv.NODE_ADD,M(ow,this)),M(Hk,this)&&"function"==typeof M(Hk,this).off&&M(sw,this)&&M(Hk,this).off(iv.NODE_CHILDREN_CHANGED,M(sw,this)),C(rw,this,null),C(ow,this,null),C(sw,this,null),C(aw,this,null),C(Qk,this,[]),C(Jk,this,[]),M(Zk,this).clear(),M(ew,this).clear(),C(tw,this,!1),C(iw,this,void 0),null!==(e=M(lw,this))&&void 0!==e&&e.__tickerThrottler&&M(lw,this).__tickerThrottler.dispose(),C(lw,this,null)}}function dw(){return M(nw,this)?M(nw,this).signal:void 0}function hw(){return this._disposed||M(nw,this)&&M(nw,this).signal.aborted}function fw(){M(Yk,this)&&"function"==typeof M(Yk,this).on&&(C(rw,this,(e=>{A(cw,this,vw).call(this,null==e?void 0:e.nodeId)})),M(Yk,this).on(iv.PLACEMENT_ADDED,M(rw,this)),C(aw,this,(()=>A(cw,this,mw).call(this))),M(Yk,this).on(iv.TIMELINE_RESET,M(aw,this))),M(Hk,this)&&"function"==typeof M(Hk,this).on&&(C(ow,this,(({node:e})=>{(null==e?void 0:e.id)&&A(cw,this,vw).call(this,e.id,{fromRepoAdd:!0})})),M(Hk,this).on(iv.NODE_ADD,M(ow,this)),C(sw,this,(()=>{Gk(M(lw,this),100)})),M(Hk,this).on(iv.NODE_CHILDREN_CHANGED,M(sw,this)))}function pw(){const e=M(Yk,this)&&Array.isArray(M(Yk,this).placements)?M(Yk,this).placements:[];e.forEach((e=>A(cw,this,vw).call(this,e.nodeId)));const t=e.length?e[e.length-1]:void 0;t&&t.nodeId&&C(iw,this,t.nodeId)}function mw(){M(nw,this)&&M(nw,this).abort(),C(nw,this,sy()),C(Qk,this,[]),C(Jk,this,[]),M(Zk,this).clear(),C(tw,this,!1),C(iw,this,void 0)}function vw(e,{fromRepoAdd:t=!1}={}){A(cw,this,hw).call(this)||e&&(M(ew,this).has(e)||M(Zk,this).has(e)||(M(Qk,this).push(e),M(iw,this)||t||C(iw,this,e),!M(tw,this)&&t||A(cw,this,gw).call(this)))}function gw(){if(M(tw,this))return void A(cw,this,yw).call(this);if(0===M(Qk,this).length)return;C(tw,this,!0);const e=M(Qk,this).shift();A(cw,this,xw).call(this,e).finally((()=>{A(cw,this,yw).call(this)}))}async function yw(){if(!A(cw,this,hw).call(this))for(M(Qk,this).length||M(Jk,this).length||C(Jk,this,A(cw,this,bw).call(this));M(Zk,this).size<this.settings.maxConcurrent;){const e=this.settings.maxConcurrent-M(Zk,this).size;if(e<=0)break;const t=[];for(;t.length<e&&(M(Qk,this).length||M(Jk,this).length);){let e=M(Qk,this).shift();e||(e=M(Jk,this).shift()),e&&t.push(e)}if(!t.length)break;const n=A(cw,this,_w).call(this,t);n.length&&M(Xk,this)&&"function"==typeof M(Xk,this).resolve&&A(cw,this,Tw).call(this,n).finally((()=>A(cw,this,yw).call(this))),t.filter((e=>!n.find((t=>t.nodeId===e)))).forEach((e=>{A(cw,this,xw).call(this,e).finally((()=>A(cw,this,yw).call(this)))}))}}function bw(){const e=new Set([...M(ew,this),...M(Zk,this),...M(Qk,this)]);return A(cw,this,kw).call(this,e)}function kw(e){const t=M(Yk,this)&&Array.isArray(M(Yk,this).placements)?M(Yk,this).placements:[],n=(t.length?t[t.length-1].nodeId:void 0)||M(iw,this);return Fk({prioritizer:M(Kk,this),repository:M(Hk,this),startNodeId:n,pendingIds:e,fallbackToRepository:!1})}function ww(){A(cw,this,hw).call(this)||(M(tw,this)||0!==M(Qk,this).length)&&(C(Jk,this,A(cw,this,bw).call(this)),M(tw,this)&&A(cw,this,yw).call(this))}async function xw(e,t){if(!e||M(ew,this).has(e)||M(Zk,this).has(e))return;const n=A(cw,this,dw).call(this);if(n&&n.aborted)return;const i=M(Hk,this)&&"function"==typeof M(Hk,this).get?M(Hk,this).get(e):void 0;if(i&&"function"==typeof i.resolve)if("function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts())M(ew,this).add(e);else{M(Zk,this).add(e);try{const r={signal:n};t&&(r.manifestOverride=t),await i.resolve(r),M(ew,this).add(e)}catch(t){if(ly(t,n))return;this.log.warn(`NodeResolver failed to resolve node ${e}: ${(null==t?void 0:t.message)||t}`),"function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts()&&M(ew,this).add(e)}finally{M(Zk,this).delete(e)}}}function _w(e){const t=[];return e.forEach((e=>{const n=M(Hk,this)&&"function"==typeof M(Hk,this).get?M(Hk,this).get(e):void 0;n&&n.manifestRef&&"assets-delivery-service"===n.manifestRef.type&&t.push({nodeId:e,ref:n.manifestRef})})),t}async function Tw(e){const t=A(cw,this,dw).call(this);if(!t||!t.aborted){e.forEach((({nodeId:e})=>M(Zk,this).add(e)));try{const n=e.map((e=>e.ref)),i=await M(Xk,this).resolve(n,{signal:t});e.forEach((({nodeId:e,ref:t})=>{var n;const r=M(Hk,this)&&"function"==typeof M(Hk,this).get?M(Hk,this).get(e):void 0;if(M(Zk,this).delete(e),!r||"function"!=typeof r.resolve)return;const o=Array.isArray(i)?i.find((e=>{const n=null==e?void 0:e.manifestRef;return n&&n.assetId===t.assetId&&n.assetRevision===t.assetRevision})):void 0,s="string"==typeof(null==o||null===(n=o.manifestRef)||void 0===n?void 0:n.encodeProfile)&&o.manifestRef.encodeProfile?o.manifestRef.encodeProfile:void 0,a=o?A(cw,this,Iw).call(this,o.manifest,s):void 0;A(cw,this,xw).call(this,e,a)}))}catch(n){ly(n,t)||this.log.warn(`NodeResolver ADS batch failed: ${(null==n?void 0:n.message)||n}`),e.forEach((({nodeId:e})=>M(Zk,this).delete(e)))}}}function Iw(e,t){if(!e)return;const n="string"==typeof t&&t?t:void 0,i=e=>n&&e&&"object"==typeof e?{...e,encodeProfile:n}:e;return e.ivd?i({typeHint:"ivd",body:e.ivd}):e.url||e.body||e.mimeType?i({typeHint:e.typeHint,url:e.url,mimeType:e.mimeType,body:e.body}):i(e)}const Ew=.001,Sw="priority";function Aw(e){const t=Number(e);return Number.isFinite(t)?t:0}var Nw=new WeakMap,Mw=new WeakMap,Fw=new WeakMap,Cw=new WeakMap,Ow=new WeakMap,Pw=new WeakMap,Rw=new WeakMap,Dw=new WeakMap,Lw=new WeakMap,Bw=new WeakMap,zw=new WeakMap,Ww=new WeakMap,$w=new WeakMap,jw=new WeakMap,Uw=new WeakMap,qw=new WeakMap,Vw=new WeakMap,Gw=new WeakMap,Hw=new WeakMap,Kw=new WeakMap,Xw=new WeakSet;class Yw extends od{constructor(...e){super(...e),O(this,Xw),F(this,Nw,void 0),F(this,Mw,void 0),F(this,Fw,void 0),F(this,Cw,new Map),F(this,Ow,new Map),F(this,Pw,[]),F(this,Rw,new Set),F(this,Dw,new Map),F(this,Lw,!1),F(this,Bw,void 0),F(this,zw,void 0),F(this,Ww,void 0),F(this,$w,void 0),F(this,jw,void 0),F(this,Uw,void 0),F(this,qw,void 0),F(this,Vw,void 0),F(this,Gw,!1),F(this,Hw,[]),F(this,Kw,void 0);const[t,n,i]=e;C(Nw,this,t),C(Mw,this,n),C(Fw,this,i),C(zw,this,sy()),C(Kw,this,(()=>A(Xw,this,Cx).call(this))),A(Xw,this,dx).call(this)}get name(){return"SegmentLoadCoordinator"}get defaults(){return{maxConcurrentLoads:3,maxSegmentLoadAttempts:3}}onDispose(){var e;M(zw,this)&&M(zw,this).abort(),C(zw,this,null),M(Dw,this).size&&M(Dw,this).forEach((e=>{(null==e?void 0:e.controller)&&e.controller.abort()})),M(Dw,this).clear(),M(Fw,this)&&"function"==typeof M(Fw,this).off&&(M(Ww,this)&&M(Fw,this).off(iv.PLACEMENT_ADDED,M(Ww,this)),M(jw,this)&&M(Fw,this).off(iv.TIMELINE_SEEKING,M(jw,this)),M(Uw,this)&&M(Fw,this).off(iv.TIMELINE_SEEKED,M(Uw,this)),M(qw,this)&&M(Fw,this).off(iv.TIMELINE_RESET,M(qw,this))),M(Nw,this)&&"function"==typeof M(Nw,this).off&&M($w,this)&&M(Nw,this).off(iv.NODE_CHILDREN_CHANGED,M($w,this)),M(Vw,this)&&"function"==typeof ld.removeEventListener&&ld.removeEventListener("online",M(Vw,this)),C(Ww,this,null),C($w,this,null),C(jw,this,null),C(Uw,this,null),C(qw,this,null),C(Vw,this,null),M(Cw,this).clear(),M(Ow,this).clear(),C(Pw,this,[]),M(Rw,this).clear(),M(Dw,this).clear(),C(Lw,this,!1),C(Bw,this,void 0),C(Gw,this,!1),C(Hw,this,[]),null!==(e=M(Kw,this))&&void 0!==e&&e.__tickerThrottler&&M(Kw,this).__tickerThrottler.dispose(),C(Kw,this,null)}}function Qw(){return M(zw,this)?M(zw,this).signal:void 0}function Jw(){return this._disposed||M(zw,this)&&M(zw,this).signal.aborted}function Zw(){const e=Number(this.settings.maxSegmentLoadAttempts);return Number.isFinite(e)&&e>0?e:1/0}function ex(e){const t=A(Xw,this,Zw).call(this);if(!Number.isFinite(t)||t===1/0)return!1;if(null==e||!e.loadError)return!1;const n=Number(e.loadAttempts);return Number.isFinite(n)&&n>=t}function tx(e){return!!e&&(!!A(Xw,this,ex).call(this,e)||A(Xw,this,nx).call(this,e))}function nx(e){if(!e)return!1;if("boolean"==typeof e.isLoaded)return e.isLoaded;const t=Number(e.retainedByteLength);return Number.isFinite(t)&&t>0}function ix(e){if(!e||A(Xw,this,nx).call(this,e))return;const t=Number(e.loadAttempts);(Number.isFinite(t)&&t>0||e.loadError)&&("function"==typeof e.evict&&e.evict(),e.loadAttempts=0,e.loadError=void 0)}function rx(e){e&&(e.manifestLoadError&&(e.manifestLoadAttempts=0,e.manifestLoadError=void 0,"failed"===e.state&&(e.state="pending",e.error=void 0)),(Array.isArray(e.tracks)?e.tracks:[]).forEach((e=>{(Array.isArray(null==e?void 0:e.segments)?e.segments:[]).forEach((e=>{A(Xw,this,ix).call(this,e)}))})))}function ox(){(M(Nw,this)&&"function"==typeof M(Nw,this).list?M(Nw,this).list():[]).forEach((e=>{A(Xw,this,rx).call(this,e)}))}function sx(e,{allowSeekKeep:t=!1,segmentOffset:n}={}){const i=sy(),r=i?i.signal:A(Xw,this,Qw).call(this);return e&&M(Dw,this).set(e,{controller:i,allowSeekKeep:!!t,segmentOffset:n}),{signal:r,controller:i}}function ax(e,t,n={}){const i=M(Dw,this).get(e);i&&i.controller===t&&(Object.prototype.hasOwnProperty.call(n,"allowSeekKeep")&&(i.allowSeekKeep=!!n.allowSeekKeep),Object.prototype.hasOwnProperty.call(n,"segmentOffset")&&(i.segmentOffset=n.segmentOffset))}function lx(e,t){const n=M(Dw,this).get(e);n&&(t&&n.controller!==t||M(Dw,this).delete(e))}function cx(e,t){const n=new Set;return(Array.isArray(e)?e:[]).forEach((e=>{const i=null==e?void 0:e.nodeId;if(!i)return;const r=M(Nw,this)&&"function"==typeof M(Nw,this).get?M(Nw,this).get(i):void 0;if(!r)return;const o=A(Xw,this,xx).call(this,r,e,t);Number.isFinite(o)&&n.add(`${i}:${o}`)})),n}function ux(e){M(Dw,this).size&&M(Dw,this).forEach(((t,n)=>{const i=null==t?void 0:t.segmentOffset,r=Number.isFinite(i)?`${n}:${i}`:"";!(null!=t&&t.allowSeekKeep&&r&&e&&e.has(r))&&(null==t?void 0:t.controller)&&t.controller.abort()}))}function dx(){M(Fw,this)&&"function"==typeof M(Fw,this).on&&(C(Ww,this,(e=>{A(Xw,this,gx).call(this,e)})),M(Fw,this).on(iv.PLACEMENT_ADDED,M(Ww,this)),C(jw,this,(e=>A(Xw,this,hx).call(this,e))),M(Fw,this).on(iv.TIMELINE_SEEKING,M(jw,this)),C(Uw,this,(e=>A(Xw,this,fx).call(this,e))),M(Fw,this).on(iv.TIMELINE_SEEKED,M(Uw,this)),C(qw,this,(()=>A(Xw,this,vx).call(this))),M(Fw,this).on(iv.TIMELINE_RESET,M(qw,this))),M(Nw,this)&&"function"==typeof M(Nw,this).on&&(C($w,this,(()=>{Gk(M(Kw,this),100)})),M(Nw,this).on(iv.NODE_CHILDREN_CHANGED,M($w,this))),"function"==typeof ld.addEventListener&&(C(Vw,this,(()=>A(Xw,this,mx).call(this))),ld.addEventListener("online",M(Vw,this)))}function hx(e={}){if(A(Xw,this,Jw).call(this))return;const t=Number(null==e?void 0:e.targetTime);if(!Number.isFinite(t))return;const n=Array.isArray(null==e?void 0:e.placements)?e.placements:[],i=A(Xw,this,cx).call(this,n,t);A(Xw,this,ux).call(this,i),C(Gw,this,!0),C(Hw,this,n.map((e=>{const n=null==e?void 0:e.nodeId;if(n)return{nodeId:n,placement:e,targetTime:t}})).filter(Boolean)),setTimeout((()=>A(Xw,this,bx).call(this)),0)}function fx(e={}){var t;if(A(Xw,this,Jw).call(this))return;C(Gw,this,!1),C(Hw,this,[]);const n=Number.isFinite(null==e?void 0:e.targetTime)?Number(e.targetTime):Number(null===(t=M(Fw,this))||void 0===t?void 0:t.currentTime);A(Xw,this,px).call(this,n),setTimeout((()=>A(Xw,this,bx).call(this)),0)}function px(e){var t;(Array.isArray(null===(t=M(Fw,this))||void 0===t?void 0:t.placements)?M(Fw,this).placements:[]).forEach((t=>{if(!t)return;const n=sm(t);if(Number.isFinite(n)){if(Number.isFinite(e)){if(n>=e)return void A(Xw,this,gx).call(this,t);const i=rm(t,M(Nw,this));return Number.isFinite(i)?void(n+i>e&&A(Xw,this,gx).call(this,t)):void(n<=e&&A(Xw,this,gx).call(this,t))}A(Xw,this,gx).call(this,t)}}))}function mx(){var e;A(Xw,this,Jw).call(this)||(A(Xw,this,ox).call(this),C(Gw,this,!1),C(Hw,this,[]),A(Xw,this,px).call(this,Number(null===(e=M(Fw,this))||void 0===e?void 0:e.currentTime)),C(Pw,this,A(Xw,this,Mx).call(this)),setTimeout((()=>A(Xw,this,bx).call(this)),0))}function vx(){M(zw,this)&&M(zw,this).abort(),C(zw,this,sy()),M(Dw,this).size&&M(Dw,this).forEach((e=>{(null==e?void 0:e.controller)&&e.controller.abort()})),M(Dw,this).clear(),M(Cw,this).clear(),M(Ow,this).clear(),C(Pw,this,[]),M(Rw,this).clear(),C(Lw,this,!1),C(Bw,this,void 0),C(Gw,this,!1),C(Hw,this,[])}function gx(e){if(A(Xw,this,Jw).call(this))return;const t=null==e?void 0:e.nodeId;if(!t)return;const n=M(Cw,this).get(t);if(n){const i=sm(n),r=sm(e);Number.isFinite(i)?Number.isFinite(r)&&r<i&&M(Cw,this).set(t,e):Number.isFinite(r)&&M(Cw,this).set(t,e)}else M(Cw,this).set(t,e);const i=M(Bw,this);C(Bw,this,t),i&&i!==t&&C(Pw,this,[]),M(Lw,this)?setTimeout((()=>A(Xw,this,bx).call(this)),0):A(Xw,this,yx).call(this)}function yx(){M(Lw,this)||M(Cw,this).size&&(C(Lw,this,!0),A(Xw,this,bx).call(this))}async function bx(){if(A(Xw,this,Jw).call(this))return;if(M(Rw,this).size>=this.settings.maxConcurrentLoads)return;if(M(Gw,this))return void(M(Hw,this).length&&A(Xw,this,kx).call(this));const e=A(Xw,this,Ix).call(this);if(e.hasPending)A(Xw,this,Ex).call(this,e);else for(M(Pw,this).length||C(Pw,this,A(Xw,this,Mx).call(this));M(Rw,this).size<this.settings.maxConcurrentLoads&&M(Pw,this).length;){const e=M(Pw,this).shift();A(Xw,this,Ox).call(this,e,"partial").finally((()=>{setTimeout((()=>A(Xw,this,bx).call(this)),0)}))}}function kx(){if(A(Xw,this,Jw).call(this))return;const e=Math.max(0,this.settings.maxConcurrentLoads-M(Rw,this).size);if(!e||!M(Hw,this).length)return;const t=[],n=[];for(let i=0;i<M(Hw,this).length;i+=1){const r=M(Hw,this)[i];(null==r?void 0:r.nodeId)&&(t.length<e&&!M(Rw,this).has(r.nodeId)?t.push(r):n.push(r))}C(Hw,this,n),t.forEach((e=>{A(Xw,this,wx).call(this,e).finally((()=>{setTimeout((()=>A(Xw,this,bx).call(this)),0)}))}))}async function wx(e={}){const t=null==e?void 0:e.nodeId,n=null==e?void 0:e.placement,i=Number(null==e?void 0:e.targetTime);if(!t||!n||!Number.isFinite(i))return;if(M(Rw,this).has(t))return;const{signal:r,controller:o}=A(Xw,this,sx).call(this,t);if(r&&r.aborted)A(Xw,this,lx).call(this,t,o);else{M(Rw,this).add(t);try{const e=M(Nw,this)&&"function"==typeof M(Nw,this).get?M(Nw,this).get(t):void 0;if(!e)return;if("ready"!==e.state&&"function"==typeof e.resolve)try{await e.resolve({signal:r})}catch(e){return}if("ready"!==e.state)return;const s=A(Xw,this,xx).call(this,e,n,i);if(!Number.isFinite(s)){const n=Array.isArray(null==e?void 0:e.tracks)?e.tracks.map((e=>null==e?void 0:e.type)).filter(Boolean):[];return void this.log.debug(`[#loadSeekWork] No seek segment offset for node [${t}] targetTime=${i} mainTrackId=${(null==e?void 0:e.mainTrackId)||"n/a"} trackTypes=[${n.join(",")}]`)}"function"==typeof e.loadMediaSegmentsAtOffset?(this.log.debug(`[#loadSeekWork] Loading seek segment for node [${t}] at offset=${s}`),A(Xw,this,ax).call(this,t,o,{allowSeekKeep:!0,segmentOffset:s}),await e.loadMediaSegmentsAtOffset(s,{signal:r})):"function"==typeof e.load&&await e.load({loadingMode:"partial",signal:r})}catch(e){ly(e,r)||this.log.warn(`[#loadSeekWork] SegmentLoadCoordinator failed to seek-load node ${t}: ${(null==e?void 0:e.message)||e}`)}finally{M(Rw,this).delete(t),A(Xw,this,lx).call(this,t,o)}}}function xx(e,t,n){var i;const r=sm(t);if(!Number.isFinite(r))return;const o=Aw(null==t?void 0:t.nodeOffsetOverride),s=Math.max(0,n-r+o),a=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[];let l;if(null!=e&&e.mainTrackId){const t=a.find((t=>(null==t?void 0:t.id)===e.mainTrackId));"video"!==(null==t?void 0:t.type)&&"image"!==(null==t?void 0:t.type)||(l=t)}if(l||(l=a.find((e=>"video"===(null==e?void 0:e.type)))||a.find((e=>"image"===(null==e?void 0:e.type)))),!l||!Array.isArray(l.segments))return;const c=l.segments.filter((e=>e&&!e.isInit&&Array.isArray(e.representations)));if(!c.length)return;const u=Aw(null===(i=l)||void 0===i?void 0:i.offset),d=Uy(c,Math.max(0,s-u),{preferRepresentationTime:!0}),h=Number(null==d?void 0:d.offset);return Number.isFinite(h)?h:void 0}function _x(e,t,n=(e=>null===(e=M(Fw,this))||void 0===e?void 0:e.currentTime)()){var i;const r=(Array.isArray(null===(i=M(Fw,this))||void 0===i?void 0:i.placements)?M(Fw,this).placements:[]).filter((t=>(null==t?void 0:t.nodeId)===e&&Number.isFinite(sm(t)))).sort(((e,t)=>sm(e)-sm(t)));if(!r.length)return t;const o=Number(n);if(!Number.isFinite(o))return t||r[0];let s,a;for(let e=0;e<r.length;e+=1){const t=r[e],n=sm(t);if(!Number.isFinite(n))continue;const i=rm(t,M(Nw,this)),l=Number.isFinite(i)&&i>=0;(!a&&n>=o-Ew&&(a=t),l)?o+Ew>=n&&o<n+i-Ew&&(s=t):o+Ew>=n&&(s=t)}return s||a||r[r.length-1]}function Tx(e,t){var n;const i=Number(sm(t));if(!Number.isFinite(i))return;const r=rm(t,M(Nw,this)),o=Number.isFinite(r)&&r>=0?i+r:void 0,s=(Array.isArray(null===(n=M(Fw,this))||void 0===n?void 0:n.placements)?M(Fw,this).placements:[]).filter((t=>(null==t?void 0:t.nodeId)===e&&Number.isFinite(sm(t)))).sort(((e,t)=>sm(e)-sm(t)));for(let e=0;e<s.length;e+=1){const t=s[e],n=Number(sm(t));if(Number.isFinite(n)&&!(n<=i+Ew)){if(Number.isFinite(o)&&n>o+Ew)return;return t}}}function Ix(){const e=[];let t=!1,n=1/0;if(M(Cw,this).forEach(((i,r)=>{if(!r||!i)return;const o=M(Ow,this).get(r);if(o)return t=!0,void(n=Math.min(n,Aw(o.timelineStart)));const s=A(Xw,this,Sx).call(this,r,i);s&&(t=!0,n=Math.min(n,Aw(s.timelineStart)),e.push(s))})),!t||!Number.isFinite(n))return{hasPending:!1,waveTime:void 0,startable:[]};const i=e.filter((e=>Aw(e.timelineStart)===n&&!M(Rw,this).has(e.nodeId))).sort(((e,t)=>{const n=Number.isFinite(null==e?void 0:e.timelineStart)?e.timelineStart:Number.POSITIVE_INFINITY,i=Number.isFinite(null==t?void 0:t.timelineStart)?t.timelineStart:Number.POSITIVE_INFINITY;return n!==i?n-i:String(e.nodeId).localeCompare(String(t.nodeId))}));return{hasPending:!0,waveTime:n,startable:i}}function Ex({waveTime:e,startable:t}){const n=Math.max(0,this.settings.maxConcurrentLoads-M(Rw,this).size);n&&t.length&&t.slice(0,n).forEach((t=>{A(Xw,this,Nx).call(this,t,e).finally((()=>{setTimeout((()=>A(Xw,this,bx).call(this)),0)}))}))}function Sx(e,t){var n,i;const r=M(Nw,this)&&"function"==typeof M(Nw,this).get?M(Nw,this).get(e):void 0;if(!r)return;if("function"==typeof r.hasExceededManifestLoadAttempts&&r.hasExceededManifestLoadAttempts())return void M(Cw,this).delete(e);const o=A(Xw,this,_x).call(this,e,t,null===(n=M(Fw,this))||void 0===n?void 0:n.currentTime),s=Number(sm(o)),a=Aw(null===(i=M(Fw,this))||void 0===i?void 0:i.currentTime),l="function"==typeof r.loadMediaSegmentsAtOffset,c="function"==typeof r.load;if(!l&&!c)return void M(Cw,this).delete(e);if(r.isLoaded)return void M(Cw,this).delete(e);if("ready"!==r.state){if(!Number.isFinite(s))return;return{nodeId:e,segmentOffset:0,timelineStart:s}}if(!A(Xw,this,Px).call(this,r))return void M(Cw,this).delete(e);const u=Array.isArray(r.tracks)?r.tracks:[],d=u.some((e=>{const t=(Array.isArray(null==e?void 0:e.segments)?e.segments:[]).find((e=>(null==e?void 0:e.isInit)&&Array.isArray(null==e?void 0:e.representations)));return!!t&&!A(Xw,this,tx).call(this,t)})),h=new Set;u.forEach((e=>{(Array.isArray(null==e?void 0:e.segments)?e.segments:[]).forEach((e=>{if(!e||e.isInit||!Array.isArray(e.representations))return;const t=Number(e.offset);if(Number.isFinite(t)){const e=Math.round(t/Ew)*Ew;h.add(e)}}))}));const f=Array.from(h).sort(((e,t)=>e-t)),p=t=>{const n=Number(sm(t));if(!Number.isFinite(n))return{status:"none"};const i=Aw(null==t?void 0:t.nodeOffsetOverride),o=Math.max(0,a-n+i);let s=0;for(let e=0;e<f.length&&f[e]<=o+Ew;e+=1)s=e;const l=f.slice(s);if(!l.some((e=>A(Xw,this,Ax).call(this,r,e))))return{status:f.slice(0,s).some((e=>A(Xw,this,Ax).call(this,r,e)))?"beforeOnly":"none"};const c=l.find((e=>A(Xw,this,Ax).call(this,r,e))),u=Math.max(0,Aw(c)-i);return{status:"work",work:{nodeId:e,segmentOffset:c,timelineStart:n+u}}},m=p(o);if("work"===m.status)return m.work;if("beforeOnly"!==m.status){if(d&&Number.isFinite(s))return{nodeId:e,segmentOffset:0,timelineStart:s};M(Cw,this).delete(e)}else{const t=A(Xw,this,Tx).call(this,e,o);if(t){const e=p(t);if("work"===e.status)return e.work}}}function Ax(e,t){const n=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[],i=Aw(t);return n.some((e=>(Array.isArray(null==e?void 0:e.segments)?e.segments:[]).some((e=>{if(!e||e.isInit||!Array.isArray(e.representations))return!1;const t=Number(e.offset);return Number.isFinite(t)&&Math.abs(t-i)<=Ew&&!A(Xw,this,tx).call(this,e)}))))}async function Nx(e,t){const n=null==e?void 0:e.nodeId,i=null==e?void 0:e.segmentOffset;if(this.log.debug(`[#loadP0Work] Loading ${Sw} node [${n}] at segmentOffset=${i} wave=${t}`),!n)return;const r=M(Nw,this)&&"function"==typeof M(Nw,this).get?M(Nw,this).get(n):void 0;if(!r)return void M(Cw,this).delete(n);const o="function"==typeof r.loadMediaSegmentsAtOffset&&Number.isFinite(i),{signal:s,controller:a}=A(Xw,this,sx).call(this,n,{allowSeekKeep:o,segmentOffset:i});if(s&&s.aborted)A(Xw,this,lx).call(this,n,a);else{M(Rw,this).add(n),M(Ow,this).set(n,{timelineStart:t,segmentOffset:i});try{"function"==typeof r.loadMediaSegmentsAtOffset?await r.loadMediaSegmentsAtOffset(i,{signal:s}):"function"==typeof r.load&&await r.load({loadingMode:"full",signal:s})}catch(e){if(ly(e,s))return;const t=`[#loadP0Work] SegmentLoadCoordinator failed to load ${Sw} work for node ${n}: ${(null==e?void 0:e.message)||e}`;this.log.warn(t)}finally{this.log.debug(`[#loadP0Work] Finished ${Sw} work for node [${n}]`),M(Ow,this).delete(n),M(Rw,this).delete(n),A(Xw,this,lx).call(this,n,a)}}}function Mx(){const e=new Set([...M(Cw,this).keys(),...M(Rw,this)]),t=A(Xw,this,Fx).call(this),n=Array.isArray(null==t?void 0:t.orderedIds)?t.orderedIds:null,i=Array.isArray(null==t?void 0:t.reachableIds)&&t.reachableIds.length?new Set(t.reachableIds):null,r=e=>!("function"==typeof e.hasExceededManifestLoadAttempts&&e.hasExceededManifestLoadAttempts()||e.isLoaded||"ready"===e.state&&A(Xw,this,Rx).call(this,e));if(i){const t=Fk({prioritizer:M(Mw,this),repository:M(Nw,this),startNodeId:M(Bw,this),prioritizedIds:n,pendingIds:e,allowedIds:i,filter:r});if(t.length)return t}return Fk({prioritizer:M(Mw,this),repository:M(Nw,this),startNodeId:M(Bw,this),prioritizedIds:n,pendingIds:e,filter:r})}function Fx(){return M(Mw,this)&&M(Bw,this)?"function"==typeof M(Mw,this).getPrioritizationSnapshot?M(Mw,this).getPrioritizationSnapshot(M(Bw,this)):{orderedIds:"function"==typeof M(Mw,this).sortNodes?M(Mw,this).sortNodes(M(Bw,this)):[],reachableIds:"function"==typeof M(Mw,this).getReachableNodeIds?M(Mw,this).getReachableNodeIds(M(Bw,this)):[]}:null}function Cx(){A(Xw,this,Jw).call(this)||(M(Lw,this)||M(Cw,this).size)&&(C(Pw,this,A(Xw,this,Mx).call(this)),M(Lw,this)&&!M(Gw,this)&&A(Xw,this,bx).call(this))}async function Ox(e,t){if(this.log.debug(`[#loadNode] Loading node [${e}] in '${t}' mode`),!e)return;const n=M(Nw,this)&&"function"==typeof M(Nw,this).get?M(Nw,this).get(e):void 0;if(!n||"function"!=typeof n.load)return;if("function"==typeof n.hasExceededManifestLoadAttempts&&n.hasExceededManifestLoadAttempts())return;if(n.isLoaded)return void this.log.debug(`[#loadNode] Skipping load for ${e}: already loaded`);const{signal:i,controller:r}=A(Xw,this,sx).call(this,e,{allowSeekKeep:!1});if(i&&i.aborted)A(Xw,this,lx).call(this,e,r);else try{if("ready"!==n.state&&await n.resolve({signal:i}),"ready"!==n.state)return void this.log.debug(`[#loadNode] Skipping load for ${e}: not ready`);if("partial"===t&&A(Xw,this,Rx).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${e}: partial already loaded`);if(!A(Xw,this,Px).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${e}: no loadable tracks`);M(Rw,this).add(e),await n.load({loadingMode:t,signal:i})}catch(t){if(ly(t,i))return;this.log.warn(`[#loadNode] SegmentLoadCoordinator failed to load node ${e}: ${(null==t?void 0:t.message)||t}`)}finally{this.log.debug(`[#loadNode] Finished loading node [${e}]`),M(Rw,this).delete(e),A(Xw,this,lx).call(this,e,r)}}function Px(e){return(Array.isArray(e.tracks)?e.tracks:[]).some((e=>{var t;return null==e||null===(t=e.segments)||void 0===t?void 0:t.length}))}function Rx(e){const t=(Array.isArray(null==e?void 0:e.tracks)?e.tracks:[]).filter((e=>Array.isArray(null==e?void 0:e.segments)&&e.segments.length));return!t.length||t.every((e=>{const t=Array.isArray(null==e?void 0:e.segments)?e.segments:[];if(!t.length)return!0;const n=t.find((e=>null==e?void 0:e.isInit)),i=t.find((e=>e&&!e.isInit));return!(n&&!A(Xw,this,tx).call(this,n)||i&&!A(Xw,this,tx).call(this,i))}))}class Dx extends od{constructor(...e){super(...e),this.track=void 0,this.lastSegment=void 0}get name(){return"BaseDecoder"}configure(e){this.track=e}decode(e){this.lastSegment=e}decodeChunk(e,t){}onDispose(){this.track=void 0,this.lastSegment=void 0}}function Lx(e){if(!e)throw new Error("Assertion failed.")}const Bx=e=>e&&e[e.length-1],zx=e=>{let t=0;for(;0===e.readBits(1)&&t<32;)t++;if(t>=32)throw new Error("Invalid exponential-Golomb code.");return(1<<t)-1+e.readBits(t)},Wx=e=>e.constructor===Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e),$x=e=>e.constructor===DataView?e:ArrayBuffer.isView(e)?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(e),jx=new TextDecoder,Ux=e=>Object.fromEntries(Object.entries(e).map((([e,t])=>[t,e]))),qx={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},Vx=Ux(qx),Gx={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},Hx=Ux(Gx),Kx={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},Xx=Ux(Kx),Yx=e=>[...e].map((e=>e.toString(16).padStart(2,"0"))).join(""),Qx=e=>(e=(e=(e=(e=(e=e>>1&1431655765|(1431655765&e)<<1)>>2&858993459|(858993459&e)<<2)>>4&252645135|(252645135&e)<<4)>>8&16711935|(16711935&e)<<8)>>16&65535|(65535&e)<<16)>>>0,Jx=(e,t,n)=>{let i=0,r=e.length-1,o=-1;for(;i<=r;){const s=i+r>>1,a=n(e[s]);a===t?(o=s,r=s-1):a<t?i=s+1:r=s-1}return o},Zx=(e,t,n)=>{let i=0,r=e.length-1,o=-1;for(;i<=r;){const s=i+(r-i+1)/2|0;n(e[s])<=t?(o=s,i=s+1):r=s-1}return o},e_=()=>{let e,t;return{promise:new Promise(((n,i)=>{e=n,t=i})),resolve:e,reject:t}},t_=(e,t,n)=>e.getUint8(t)<<16|e.getUint8(t+1)<<8|e.getUint8(t+2),n_=(e,t,n)=>Math.max(t,Math.min(n,e)),i_=/^[a-z]{3}$/,r_=1e6*(1+Number.EPSILON);let o_=null;let s_=null;const a_=()=>{if(null!==s_)return s_;if("undefined"==typeof navigator)return null;const e=/\bChrome\/(\d+)/.exec(navigator.userAgent);return e?s_=Number(e[1]):null},l_=e=>"number"==typeof e&&!Number.isNaN(e);class c_{constructor(e,t){if(this.data=e,this.mimeType=t,!(e instanceof Uint8Array))throw new TypeError("data must be a Uint8Array.");if("string"!=typeof t)throw new TypeError("mimeType must be a string.")}}const u_={default:!0,forced:!1,original:!1,commentary:!1,hearingImpaired:!1,visuallyImpaired:!1};class d_{constructor(e){this.bytes=e,this.pos=0}seekToByte(e){this.pos=8*e}readBit(){var e;const t=Math.floor(this.pos/8),n=null!==(e=this.bytes[t])&&void 0!==e?e:0,i=7-(7&this.pos),r=(n&1<<i)>>i;return this.pos++,r}readBits(e){if(1===e)return this.readBit();let t=0;for(let n=0;n<e;n++)t<<=1,t|=this.readBit();return t}writeBits(e,t){const n=this.pos+e;for(let e=this.pos;e<n;e++){const i=Math.floor(e/8);let r=this.bytes[i];const o=7-(7&e);r&=~(1<<o),r|=(t&1<<n-e-1)>>n-e-1<<o,this.bytes[i]=r}this.pos=n}readAlignedByte(){var e;if(this.pos%8!=0)throw new Error("Bitstream is not byte-aligned.");const t=this.pos/8,n=null!==(e=this.bytes[t])&&void 0!==e?e:0;return this.pos+=8,n}skipBits(e){this.pos+=e}getBitsLeft(){return 8*this.bytes.length-this.pos}clone(){const e=new d_(this.bytes);return e.pos=this.pos,e}}const h_=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],f_=[-1,1,2,3,4,5,6,8],p_=e=>{if(!e||e.byteLength<2)throw new TypeError("AAC description must be at least 2 bytes long.");const t=new d_(e);let n=t.readBits(5);31===n&&(n=32+t.readBits(6));const i=t.readBits(4);let r=null;15===i?r=t.readBits(24):i<h_.length&&(r=h_[i]);const o=t.readBits(4);let s=null;return o>=1&&o<=7&&(s=f_[o]),{objectType:n,frequencyIndex:i,sampleRate:r,channelConfiguration:o,numberOfChannels:s}},m_=["pcm-s16","pcm-s16be","pcm-s24","pcm-s24be","pcm-s32","pcm-s32be","pcm-f32","pcm-f32be","pcm-f64","pcm-f64be","pcm-u8","pcm-s8","ulaw","alaw"],v_=[{maxPictureSize:36864,maxBitrate:2e5,level:10},{maxPictureSize:73728,maxBitrate:8e5,level:11},{maxPictureSize:122880,maxBitrate:18e5,level:20},{maxPictureSize:245760,maxBitrate:36e5,level:21},{maxPictureSize:552960,maxBitrate:72e5,level:30},{maxPictureSize:983040,maxBitrate:12e6,level:31},{maxPictureSize:2228224,maxBitrate:18e6,level:40},{maxPictureSize:2228224,maxBitrate:3e7,level:41},{maxPictureSize:8912896,maxBitrate:6e7,level:50},{maxPictureSize:8912896,maxBitrate:12e7,level:51},{maxPictureSize:8912896,maxBitrate:18e7,level:52},{maxPictureSize:35651584,maxBitrate:18e7,level:60},{maxPictureSize:35651584,maxBitrate:24e7,level:61},{maxPictureSize:35651584,maxBitrate:48e7,level:62}],g_=e=>{const{codec:t,codecDescription:n,colorSpace:i,avcCodecInfo:r,hevcCodecInfo:o,vp9CodecInfo:s,av1CodecInfo:a}=e;if("avc"===t){if(Lx(null!==e.avcType),r){const t=new Uint8Array([r.avcProfileIndication,r.profileCompatibility,r.avcLevelIndication]);return`avc${e.avcType}.${Yx(t)}`}if(!n||n.byteLength<4)throw new TypeError("AVC decoder description is not provided or is not at least 4 bytes long.");return`avc${e.avcType}.${Yx(n.subarray(1,4))}`}if("hevc"===t){let e,t,i,r,s,a;if(o)e=o.generalProfileSpace,t=o.generalProfileIdc,i=Qx(o.generalProfileCompatibilityFlags),r=o.generalTierFlag,s=o.generalLevelIdc,a=[...o.generalConstraintIndicatorFlags];else{if(!n||n.byteLength<23)throw new TypeError("HEVC decoder description is not provided or is not at least 23 bytes long.");const o=$x(n),l=o.getUint8(1);e=l>>6&3,t=31&l,i=Qx(o.getUint32(2)),r=l>>5&1,s=o.getUint8(12),a=[];for(let e=0;e<6;e++)a.push(o.getUint8(6+e))}let l="hev1.";for(l+=["","A","B","C"][e]+t,l+=".",l+=i.toString(16).toUpperCase(),l+=".",l+=0===r?"L":"H",l+=s;a.length>0&&0===a[a.length-1];)a.pop();return a.length>0&&(l+=".",l+=a.map((e=>e.toString(16).toUpperCase())).join(".")),l}if("vp8"===t)return"vp8";if("vp9"===t){if(!s){const t=e.width*e.height;let n=Bx(v_).level;for(const e of v_)if(t<=e.maxPictureSize){n=e.level;break}return`vp09.00.${n.toString().padStart(2,"0")}.08`}let t=`vp09.${s.profile.toString().padStart(2,"0")}.${s.level.toString().padStart(2,"0")}.${s.bitDepth.toString().padStart(2,"0")}.${s.chromaSubsampling.toString().padStart(2,"0")}`;return t+=`.${s.colourPrimaries.toString().padStart(2,"0")}.${s.transferCharacteristics.toString().padStart(2,"0")}.${s.matrixCoefficients.toString().padStart(2,"0")}.${s.videoFullRangeFlag.toString().padStart(2,"0")}`,t.endsWith(".01.01.01.01.00")&&(t=t.slice(0,-15)),t}if("av1"===t){if(!a){const t=e.width*e.height;let n=Bx(v_).level;for(const e of v_)if(t<=e.maxPictureSize){n=e.level;break}return`av01.0.${n.toString().padStart(2,"0")}M.08`}const t=a.profile,n=a.level.toString().padStart(2,"0"),r=a.tier?"H":"M",o=a.bitDepth.toString().padStart(2,"0"),s=a.monochrome?"1":"0",l=100*a.chromaSubsamplingX+10*a.chromaSubsamplingY+1*(a.chromaSubsamplingX&&a.chromaSubsamplingY?a.chromaSamplePosition:0),c=null!=i&&i.primaries?qx[i.primaries]:1,u=null!=i&&i.transfer?Gx[i.transfer]:1,d=null!=i&&i.matrix?Kx[i.matrix]:1,h=null!=i&&i.fullRange?1:0;let f=`av01.${t}.${n}${r}.${o}`;return f+=`.${s}.${l.toString().padStart(3,"0")}`,f+=`.${c.toString().padStart(2,"0")}`,f+=`.${u.toString().padStart(2,"0")}`,f+=`.${d.toString().padStart(2,"0")}`,f+=`.${h}`,f.endsWith(".0.110.01.01.01.0")&&(f=f.slice(0,-17)),f}throw new TypeError(`Unhandled codec '${t}'.`)},y_=e=>{const{codec:t,codecDescription:n,aacCodecInfo:i}=e;if("aac"===t){if(!i)throw new TypeError("AAC codec info must be provided.");if(i.isMpeg2)return"mp4a.67";{let e;return e=null!==i.objectType?i.objectType:p_(n).objectType,`mp4a.40.${e}`}}if("mp3"===t)return"mp3";if("opus"===t)return"opus";if("vorbis"===t)return"vorbis";if("flac"===t)return"flac";if("ac3"===t)return"ac-3";if("eac3"===t)return"ec-3";if(t&&m_.includes(t))return t;throw new TypeError(`Unhandled codec '${t}'.`)},b_=/^pcm-([usf])(\d+)+(be)?$/,k_=[48e3,44100,32e3],w_=[24e3,22050,16e3];var x_,__;!function(e){e[e.NON_IDR_SLICE=1]="NON_IDR_SLICE",e[e.SLICE_DPA=2]="SLICE_DPA",e[e.SLICE_DPB=3]="SLICE_DPB",e[e.SLICE_DPC=4]="SLICE_DPC",e[e.IDR=5]="IDR",e[e.SEI=6]="SEI",e[e.SPS=7]="SPS",e[e.PPS=8]="PPS",e[e.AUD=9]="AUD",e[e.SPS_EXT=13]="SPS_EXT"}(x_||(x_={})),function(e){e[e.RASL_N=8]="RASL_N",e[e.RASL_R=9]="RASL_R",e[e.BLA_W_LP=16]="BLA_W_LP",e[e.RSV_IRAP_VCL23=23]="RSV_IRAP_VCL23",e[e.VPS_NUT=32]="VPS_NUT",e[e.SPS_NUT=33]="SPS_NUT",e[e.PPS_NUT=34]="PPS_NUT",e[e.AUD_NUT=35]="AUD_NUT",e[e.PREFIX_SEI_NUT=39]="PREFIX_SEI_NUT",e[e.SUFFIX_SEI_NUT=40]="SUFFIX_SEI_NUT"}(__||(__={}));const T_=function*(e){let t=0,n=-1;for(;t<e.length-2;){const i=e.indexOf(0,t);if(-1===i||i>=e.length-2)break;t=i;let r=0;t+3<e.length&&0===e[t+1]&&0===e[t+2]&&1===e[t+3]?r=4:0===e[t+1]&&1===e[t+2]&&(r=3),0!==r?(-1!==n&&t>n&&(yield{offset:n,length:t-n}),n=t+r,t=n):t++}-1!==n&&n<e.length&&(yield{offset:n,length:e.length-n})},I_=function*(e,t){let n=0;const i=new DataView(e.buffer,e.byteOffset,e.byteLength);for(;n+t<=e.length;){let e;1===t?e=i.getUint8(n):2===t?e=i.getUint16(n,!1):3===t?e=t_(i,n):(Lx(4===t),e=i.getUint32(n,!1)),n+=t,yield{offset:n,length:e},n+=e}},E_=e=>31&e,S_=e=>{const t=[],n=e.length;for(let i=0;i<n;i++)i+2<n&&0===e[i]&&0===e[i+1]&&3===e[i+2]?(t.push(0,0),i+=2):t.push(e[i]);return new Uint8Array(t)},A_=e=>e>>1&63,N_=function*(e){const t=new d_(e),n=()=>{let e=0;for(let n=0;n<8;n++){const i=t.readAlignedByte();if(e|=(127&i)<<7*n,!(128&i))break;if(7===n&&128&i)return null}return e>=2**32-1?null:e};for(;t.getBitsLeft()>=8;){t.skipBits(1);const i=t.readBits(4),r=t.readBits(1),o=t.readBits(1);let s;if(t.skipBits(1),r&&t.skipBits(8),o){const e=n();if(null===e)return;s=e}else s=Math.floor(t.getBitsLeft()/8);Lx(t.pos%8==0),yield{type:i,data:e.subarray(t.pos/8,t.pos/8+s)},t.skipBits(8*s)}};var M_;!function(e){e[e.STREAMINFO=0]="STREAMINFO",e[e.VORBIS_COMMENT=4]="VORBIS_COMMENT",e[e.PICTURE=6]="PICTURE"}(M_||(M_={}));const F_=[2,1,2,3,3,4,4,5];class C_{constructor(e){this.input=e}}const O_=[],P_=[],R_=new Uint8Array(0);class D_{constructor(e,t,n,i,r=-1,o,s){if(this.data=e,this.type=t,this.timestamp=n,this.duration=i,this.sequenceNumber=r,e===R_&&void 0===o)throw new Error("Internal error: byteLength must be explicitly provided when constructing metadata-only packets.");if(void 0===o&&(o=e.byteLength),!(e instanceof Uint8Array))throw new TypeError("data must be a Uint8Array.");if("key"!==t&&"delta"!==t)throw new TypeError('type must be either "key" or "delta".');if(!Number.isFinite(n))throw new TypeError("timestamp must be a number.");if(!Number.isFinite(i)||i<0)throw new TypeError("duration must be a non-negative number.");if(!Number.isFinite(r))throw new TypeError("sequenceNumber must be a number.");if(!Number.isInteger(o)||o<0)throw new TypeError("byteLength must be a non-negative integer.");if(void 0!==s&&("object"!=typeof s||!s))throw new TypeError("sideData, when provided, must be an object.");if(void 0!==(null==s?void 0:s.alpha)&&!(s.alpha instanceof Uint8Array))throw new TypeError("sideData.alpha, when provided, must be a Uint8Array.");if(void 0!==(null==s?void 0:s.alphaByteLength)&&(!Number.isInteger(s.alphaByteLength)||s.alphaByteLength<0))throw new TypeError("sideData.alphaByteLength, when provided, must be a non-negative integer.");this.byteLength=o,this.sideData=null!=s?s:{},this.sideData.alpha&&void 0===this.sideData.alphaByteLength&&(this.sideData.alphaByteLength=this.sideData.alpha.byteLength)}get isMetadataOnly(){return this.data===R_}get microsecondTimestamp(){return Math.trunc(r_*this.timestamp)}get microsecondDuration(){return Math.trunc(r_*this.duration)}toEncodedVideoChunk(){if(this.isMetadataOnly)throw new TypeError("Metadata-only packets cannot be converted to a video chunk.");if("undefined"==typeof EncodedVideoChunk)throw new Error("Your browser does not support EncodedVideoChunk.");return new EncodedVideoChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}alphaToEncodedVideoChunk(e=this.type){if(!this.sideData.alpha)throw new TypeError("This packet does not contain alpha side data.");if(this.isMetadataOnly)throw new TypeError("Metadata-only packets cannot be converted to a video chunk.");if("undefined"==typeof EncodedVideoChunk)throw new Error("Your browser does not support EncodedVideoChunk.");return new EncodedVideoChunk({data:this.sideData.alpha,type:e,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}toEncodedAudioChunk(){if(this.isMetadataOnly)throw new TypeError("Metadata-only packets cannot be converted to an audio chunk.");if("undefined"==typeof EncodedAudioChunk)throw new Error("Your browser does not support EncodedAudioChunk.");return new EncodedAudioChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}static fromEncodedChunk(e,t){var n;if(!(e instanceof EncodedVideoChunk||e instanceof EncodedAudioChunk))throw new TypeError("chunk must be an EncodedVideoChunk or EncodedAudioChunk.");const i=new Uint8Array(e.byteLength);return e.copyTo(i),new D_(i,e.type,e.timestamp/1e6,(null!==(n=e.duration)&&void 0!==n?n:0)/1e6,void 0,void 0,t)}clone(e){var t,n,i,r,o,s;if(void 0!==e&&("object"!=typeof e||null===e))throw new TypeError("options, when provided, must be an object.");if(void 0!==(null==e?void 0:e.data)&&!(e.data instanceof Uint8Array))throw new TypeError("options.data, when provided, must be a Uint8Array.");if(void 0!==(null==e?void 0:e.type)&&"key"!==e.type&&"delta"!==e.type)throw new TypeError('options.type, when provided, must be either "key" or "delta".');if(void 0!==(null==e?void 0:e.timestamp)&&!Number.isFinite(e.timestamp))throw new TypeError("options.timestamp, when provided, must be a number.");if(void 0!==(null==e?void 0:e.duration)&&!Number.isFinite(e.duration))throw new TypeError("options.duration, when provided, must be a number.");if(void 0!==(null==e?void 0:e.sequenceNumber)&&!Number.isFinite(e.sequenceNumber))throw new TypeError("options.sequenceNumber, when provided, must be a number.");if(void 0!==(null==e?void 0:e.sideData)&&("object"!=typeof e.sideData||null===e.sideData))throw new TypeError("options.sideData, when provided, must be an object.");return new D_(null!==(t=null==e?void 0:e.data)&&void 0!==t?t:this.data,null!==(n=null==e?void 0:e.type)&&void 0!==n?n:this.type,null!==(i=null==e?void 0:e.timestamp)&&void 0!==i?i:this.timestamp,null!==(r=null==e?void 0:e.duration)&&void 0!==r?r:this.duration,null!==(o=null==e?void 0:e.sequenceNumber)&&void 0!==o?o:this.sequenceNumber,this.byteLength,null!==(s=null==e?void 0:e.sideData)&&void 0!==s?s:this.sideData)}}const L_=e=>{if(!e||"object"!=typeof e)throw new TypeError("options must be an object.");if(void 0!==e.metadataOnly&&"boolean"!=typeof e.metadataOnly)throw new TypeError("options.metadataOnly, when defined, must be a boolean.");if(void 0!==e.verifyKeyPackets&&"boolean"!=typeof e.verifyKeyPackets)throw new TypeError("options.verifyKeyPackets, when defined, must be a boolean.");if(e.verifyKeyPackets&&e.metadataOnly)throw new TypeError("options.verifyKeyPackets and options.metadataOnly cannot be enabled together.")},B_=e=>{if(!l_(e))throw new TypeError("timestamp must be a number.")},z_=(e,t,n)=>n.verifyKeyPackets?t.then((async t=>{if(!t||"delta"===t.type)return t;const n=await e.determinePacketType(t);return n&&(t.type=n),t})):t;class W_{constructor(e){if(!(e instanceof $_))throw new TypeError("track must be an InputTrack.");this._track=e}getFirstPacket(e={}){if(L_(e),this._track.input._disposed)throw new fT;return z_(this._track,this._track._backing.getFirstPacket(e),e)}async getFirstKeyPacket(e={}){L_(e);const t=await this.getFirstPacket(e);return t?"key"===t.type?t:this.getNextKeyPacket(t,e):null}getPacket(e,t={}){if(B_(e),L_(t),this._track.input._disposed)throw new fT;return z_(this._track,this._track._backing.getPacket(e,t),t)}getNextPacket(e,t={}){if(!(e instanceof D_))throw new TypeError("packet must be an EncodedPacket.");if(L_(t),this._track.input._disposed)throw new fT;return z_(this._track,this._track._backing.getNextPacket(e,t),t)}async getKeyPacket(e,t={}){if(B_(e),L_(t),this._track.input._disposed)throw new fT;if(!t.verifyKeyPackets)return this._track._backing.getKeyPacket(e,t);const n=await this._track._backing.getKeyPacket(e,t);return n?(Lx("key"===n.type),"delta"===await this._track.determinePacketType(n)?this.getKeyPacket(n.timestamp-1/this._track.timeResolution,t):n):n}async getNextKeyPacket(e,t={}){if(!(e instanceof D_))throw new TypeError("packet must be an EncodedPacket.");if(L_(t),this._track.input._disposed)throw new fT;if(!t.verifyKeyPackets)return this._track._backing.getNextKeyPacket(e,t);const n=await this._track._backing.getNextKeyPacket(e,t);return n?(Lx("key"===n.type),"delta"===await this._track.determinePacketType(n)?this.getNextKeyPacket(n,t):n):n}packets(e,t,n={}){if(void 0!==e&&!(e instanceof D_))throw new TypeError("startPacket must be an EncodedPacket.");if(void 0!==e&&e.isMetadataOnly&&(null==n||!n.metadataOnly))throw new TypeError("startPacket can only be metadata-only if options.metadataOnly is enabled.");if(void 0!==t&&!(t instanceof D_))throw new TypeError("endPacket must be an EncodedPacket.");if(L_(n),this._track.input._disposed)throw new fT;const i=[];let{promise:r,resolve:o}=e_(),{promise:s,resolve:a}=e_(),l=!1,c=!1,u=null;const d=[];(async()=>{let u=null!=e?e:await this.getFirstPacket(n);for(;u&&!c&&!this._track.input._disposed&&!(t&&u.sequenceNumber>=(null==t?void 0:t.sequenceNumber));)i.length>Math.max(2,d.length)?(({promise:s,resolve:a}=e_()),await s):(i.push(u),o(),({promise:r,resolve:o}=e_()),u=await this.getNextPacket(u,n));l=!0,o()})().catch((e=>{u||(u=e,o())}));const h=this._track;return{async next(){for(;;){if(h.input._disposed)throw new fT;if(c)return{value:void 0,done:!0};if(u)throw u;if(i.length>0){const e=i.shift(),t=performance.now();for(d.push(t);d.length>0&&t-d[0]>=1e3;)d.shift();return a(),{value:e,done:!1}}if(l)return{value:void 0,done:!0};await r}},return:async()=>(c=!0,a(),o(),{value:void 0,done:!0}),async throw(e){throw e},[Symbol.asyncIterator](){return this}}}}class $_{constructor(e,t){this.input=e,this._backing=t}isVideoTrack(){return this instanceof j_}isAudioTrack(){return this instanceof U_}get id(){return this._backing.getId()}get number(){return this._backing.getNumber()}get internalCodecId(){return this._backing.getInternalCodecId()}get languageCode(){return this._backing.getLanguageCode()}get name(){return this._backing.getName()}get timeResolution(){return this._backing.getTimeResolution()}get disposition(){return this._backing.getDisposition()}getFirstTimestamp(){return this._backing.getFirstTimestamp()}computeDuration(){return this._backing.computeDuration()}async computePacketStats(e=1/0){const t=new W_(this);let n=1/0,i=-1/0,r=0,o=0;for await(const s of t.packets(void 0,void 0,{metadataOnly:!0})){if(r>=e&&s.timestamp>=i)break;n=Math.min(n,s.timestamp),i=Math.max(i,s.timestamp+s.duration),r++,o+=s.byteLength}return{packetCount:r,averagePacketRate:r?Number((r/(i-n)).toPrecision(16)):0,averageBitrate:r?Number((8*o/(i-n)).toPrecision(16)):0}}}class j_ extends $_{constructor(e,t){super(e,t),this._backing=t,this.pixelAspectRatio=(e=>{Lx(0!==e.den);let t=Math.abs(e.num),n=Math.abs(e.den);for(;0!==n;){const e=t%n;t=n,n=e}const i=t||1;return{num:e.num/i,den:e.den/i}})({num:this._backing.getSquarePixelWidth()*this._backing.getCodedHeight(),den:this._backing.getSquarePixelHeight()*this._backing.getCodedWidth()})}get type(){return"video"}get codec(){return this._backing.getCodec()}get codedWidth(){return this._backing.getCodedWidth()}get codedHeight(){return this._backing.getCodedHeight()}get rotation(){return this._backing.getRotation()}get squarePixelWidth(){return this._backing.getSquarePixelWidth()}get squarePixelHeight(){return this._backing.getSquarePixelHeight()}get displayWidth(){return this._backing.getRotation()%180==0?this.squarePixelWidth:this.squarePixelHeight}get displayHeight(){return this._backing.getRotation()%180==0?this.squarePixelHeight:this.squarePixelWidth}getColorSpace(){return this._backing.getColorSpace()}async hasHighDynamicRange(){const e=await this._backing.getColorSpace();return"bt2020"===e.primaries||"smpte432"===e.primaries||"pg"===e.transfer||"hlg"===e.transfer||"bt2020-ncl"===e.matrix}canBeTransparent(){return this._backing.canBeTransparent()}getDecoderConfig(){return this._backing.getDecoderConfig()}async getCodecParameterString(){var e;const t=await this._backing.getDecoderConfig();return null!==(e=null==t?void 0:t.codec)&&void 0!==e?e:null}async canDecode(){try{const e=await this._backing.getDecoderConfig();if(!e)return!1;const t=this._backing.getCodec();return Lx(null!==t),O_.some((n=>n.supports(t,e)))?!0:"undefined"!=typeof VideoDecoder&&!0===(await VideoDecoder.isConfigSupported(e)).supported}catch(e){return console.error("Error during decodability check:",e),!1}}async determinePacketType(e){if(!(e instanceof D_))throw new TypeError("packet must be an EncodedPacket.");if(e.isMetadataOnly)throw new TypeError("packet must not be metadata-only to determine its type.");if(null===this.codec)return null;const t=await this.getDecoderConfig();return Lx(t),((e,t,n)=>{switch(e){case"avc":for(const e of((e,t)=>{if(t.description){const n=3&Wx(t.description)[4];return I_(e,n+1)}return T_(e)})(n,t)){const t=n[e.offset],r=E_(t);if(r>=x_.NON_IDR_SLICE&&r<=x_.SLICE_DPC)return"delta";if(r===x_.IDR)return"key";if(r===x_.SEI&&(i=void 0,!(null!==o_?o_:o_=!("undefined"==typeof navigator||(null===(i=navigator.vendor)||void 0===i||!i.includes("Google Inc"))&&!/Chrome/.test(navigator.userAgent)))||a_()>=144)){const t=n.subarray(e.offset,e.offset+e.length),i=S_(t);let r=1;do{let e=0;for(;;){const t=i[r++];if(void 0===t)break;if(e+=t,t<255)break}let t=0;for(;;){const e=i[r++];if(void 0===e)break;if(t+=e,e<255)break}if(6===e){const e=new d_(i);e.pos=8*r;const t=zx(e),n=e.readBits(1);if(0===t&&1===n)return"key"}r+=t}while(r<i.length-1)}}return"delta";case"hevc":for(const e of((e,t)=>{if(t.description){const n=3&Wx(t.description)[21];return I_(e,n+1)}return T_(e)})(n,t)){const t=A_(n[e.offset]);if(t<__.BLA_W_LP)return"delta";if(t<=__.RSV_IRAP_VCL23)return"key"}return"delta";case"vp8":return 1&n[0]?"delta":"key";case"vp9":{const e=new d_(n);if(2!==e.readBits(2))return null;const t=e.readBits(1);return 3===(e.readBits(1)<<1)+t&&e.skipBits(1),e.readBits(1)?null:0===e.readBits(1)?"key":"delta"}case"av1":{let e=!1;for(const{type:t,data:i}of N_(n))if(1===t){const t=new d_(i);t.skipBits(4),e=!!t.readBits(1)}else if(3===t||6===t||7===t){if(e)return"key";const t=new d_(i);return t.readBits(1)?null:0===t.readBits(2)?"key":"delta"}return null}default:(e=>{throw new Error(`Unexpected value: ${e}`)})(e),Lx(!1)}var i})(this.codec,t,e.data)}}class U_ extends $_{constructor(e,t){super(e,t),this._backing=t}get type(){return"audio"}get codec(){return this._backing.getCodec()}get numberOfChannels(){return this._backing.getNumberOfChannels()}get sampleRate(){return this._backing.getSampleRate()}getDecoderConfig(){return this._backing.getDecoderConfig()}async getCodecParameterString(){var e;const t=await this._backing.getDecoderConfig();return null!==(e=null==t?void 0:t.codec)&&void 0!==e?e:null}async canDecode(){try{const e=await this._backing.getDecoderConfig();if(!e)return!1;const t=this._backing.getCodec();return Lx(null!==t),P_.some((n=>n.supports(t,e)))?!0:!!e.codec.startsWith("pcm-")||"undefined"!=typeof AudioDecoder&&!0===(await AudioDecoder.isConfigSupported(e)).supported}catch(e){return console.error("Error during decodability check:",e),!1}}async determinePacketType(e){if(!(e instanceof D_))throw new TypeError("packet must be an EncodedPacket.");return null===this.codec?null:"key"}}const q_=e=>{let t=xT(e);const n=ST(e,4);let i=8;1===t&&(t=TT(e),i=16);const r=t-i;return r<0?null:{name:n,totalSize:t,headerSize:i,contentSize:r}},V_=e=>_T(e)/65536,G_=e=>_T(e)/1073741824,H_=e=>{let t=0;for(let n=0;n<4;n++){t<<=7;const n=yT(e);if(t|=127&n,!(128&n))break}return t},K_=e=>{let t=bT(e);return e.skip(2),t=Math.min(t,e.remainingLength),jx.decode(gT(e,t))},X_=e=>{const t=q_(e);if(!t||"data"!==t.name)return null;if(e.remainingLength<8)return null;const n=xT(e);e.skip(4);const i=gT(e,t.contentSize-8);switch(n){case 1:return jx.decode(i);case 2:return new TextDecoder("utf-16be").decode(i);case 13:return new c_(i,"image/jpeg");case 14:return new c_(i,"image/png");case 27:return new c_(i,"image/bmp");default:return i}};class Y_ extends C_{constructor(e){super(e),this.moovSlice=null,this.currentTrack=null,this.tracks=[],this.metadataPromise=null,this.movieTimescale=-1,this.movieDurationInTimescale=-1,this.isQuickTime=!1,this.metadataTags={},this.currentMetadataKeys=null,this.isFragmented=!1,this.fragmentTrackDefaults=[],this.currentFragment=null,this.lastReadFragment=null,this.reader=e._reader}async computeDuration(){const e=await this.getTracks(),t=await Promise.all(e.map((e=>e.computeDuration())));return Math.max(0,...t)}async getTracks(){return await this.readMetadata(),this.tracks.map((e=>e.inputTrack))}async getMimeType(){await this.readMetadata();const e=await Promise.all(this.tracks.map((e=>e.inputTrack.getCodecParameterString())));return(e=>{let t=(e.hasVideo?"video/":e.hasAudio?"audio/":"application/")+(e.isQuickTime?"quicktime":"mp4");return e.codecStrings.length>0&&(t+=`; codecs="${[...new Set(e.codecStrings)].join(", ")}"`),t})({isQuickTime:this.isQuickTime,hasVideo:this.tracks.some((e=>{var t;return"video"===(null===(t=e.info)||void 0===t?void 0:t.type)})),hasAudio:this.tracks.some((e=>{var t;return"audio"===(null===(t=e.info)||void 0===t?void 0:t.type)})),codecStrings:e.filter(Boolean)})}async getMetadataTags(){return await this.readMetadata(),this.metadataTags}readMetadata(){var e;return null!==(e=this.metadataPromise)&&void 0!==e?e:this.metadataPromise=(async()=>{let e=0;for(;;){let t=this.reader.requestSliceRange(e,8,16);if(t instanceof Promise&&(t=await t),!t)break;const n=e,i=q_(t);if(!i)break;if("ftyp"===i.name){const e=ST(t,4);this.isQuickTime="qt "===e}else if("moov"===i.name){let e=this.reader.requestSlice(t.filePos,i.contentSize);if(e instanceof Promise&&(e=await e),!e)break;this.moovSlice=e,this.readContiguousBoxes(this.moovSlice),this.tracks.sort(((e,t)=>Number(t.disposition.default)-Number(e.disposition.default)));for(const e of this.tracks){const t=e.editListPreviousSegmentDurations/this.movieTimescale;e.editListOffset-=Math.round(t*e.timescale)}break}e=n+i.totalSize}if(this.isFragmented&&null!==this.reader.fileSize){let e=this.reader.requestSlice(this.reader.fileSize-4,4);e instanceof Promise&&(e=await e),Lx(e);const t=xT(e),n=this.reader.fileSize-t;if(n>=0&&n<=this.reader.fileSize-16){let e=this.reader.requestSliceRange(n,8,16);if(e instanceof Promise&&(e=await e),e){const t=q_(e);if(t&&"mfra"===t.name){let n=this.reader.requestSlice(e.filePos,t.contentSize);n instanceof Promise&&(n=await n),n&&this.readContiguousBoxes(n)}}}}})()}getSampleTableForTrack(e){var t;if(e.sampleTable)return e.sampleTable;const n={sampleTimingEntries:[],sampleCompositionTimeOffsets:[],sampleSizes:[],keySampleIndices:null,chunkOffsets:[],sampleToChunk:[],presentationTimestamps:null,presentationTimestampIndexMap:null};e.sampleTable=n,Lx(this.moovSlice);const i=this.moovSlice.slice(e.sampleTableByteOffset);if(this.currentTrack=e,this.traverseBox(i),this.currentTrack=null,"audio"===(null===(t=e.info)||void 0===t?void 0:t.type)&&e.info.codec&&m_.includes(e.info.codec)&&0===n.sampleCompositionTimeOffsets.length){var r;Lx("audio"===(null===(r=e.info)||void 0===r?void 0:r.type));const t=(e=>{if(Lx(m_.includes(e)),"ulaw"===e)return{dataType:"ulaw",sampleSize:1,littleEndian:!0,silentValue:255};if("alaw"===e)return{dataType:"alaw",sampleSize:1,littleEndian:!0,silentValue:213};const t=b_.exec(e);let n;return Lx(t),n="u"===t[1]?"unsigned":"s"===t[1]?"signed":"float",{dataType:n,sampleSize:Number(t[2])/8,littleEndian:"be"!==t[3],silentValue:"pcm-u8"===e?128:0}})(e.info.codec),i=[],o=[];for(let r=0;r<n.sampleToChunk.length;r++){const s=n.sampleToChunk[r],a=n.sampleToChunk[r+1],l=(a?a.startChunkIndex:n.chunkOffsets.length)-s.startChunkIndex;for(let r=0;r<l;r++){const a=s.startSampleIndex+r*s.samplesPerChunk,l=a+s.samplesPerChunk,c=Zx(n.sampleTimingEntries,a,(e=>e.startIndex)),u=n.sampleTimingEntries[c],d=Zx(n.sampleTimingEntries,l,(e=>e.startIndex)),h=n.sampleTimingEntries[d],f=u.startDecodeTimestamp+(a-u.startIndex)*u.delta,p=h.startDecodeTimestamp+(l-h.startIndex)*h.delta-f,m=Bx(i);m&&m.delta===p?m.count++:i.push({startIndex:s.startChunkIndex+r,startDecodeTimestamp:f,count:1,delta:p});const v=s.samplesPerChunk*t.sampleSize*e.info.numberOfChannels;o.push(v)}s.startSampleIndex=s.startChunkIndex,s.samplesPerChunk=1}n.sampleTimingEntries=i,n.sampleSizes=o}if(n.sampleCompositionTimeOffsets.length>0){n.presentationTimestamps=[];for(const e of n.sampleTimingEntries)for(let t=0;t<e.count;t++)n.presentationTimestamps.push({presentationTimestamp:e.startDecodeTimestamp+t*e.delta,sampleIndex:e.startIndex+t});for(const e of n.sampleCompositionTimeOffsets)for(let t=0;t<e.count;t++){const i=e.startIndex+t,r=n.presentationTimestamps[i];r&&(r.presentationTimestamp+=e.offset)}n.presentationTimestamps.sort(((e,t)=>e.presentationTimestamp-t.presentationTimestamp)),n.presentationTimestampIndexMap=Array(n.presentationTimestamps.length).fill(-1);for(let e=0;e<n.presentationTimestamps.length;e++)n.presentationTimestampIndexMap[n.presentationTimestamps[e].sampleIndex]=e}return n}async readFragment(e){var t;if((null===(t=this.lastReadFragment)||void 0===t?void 0:t.moofOffset)===e)return this.lastReadFragment;let n=this.reader.requestSliceRange(e,8,16);n instanceof Promise&&(n=await n),Lx(n);const i=q_(n);Lx("moof"===(null==i?void 0:i.name));let r=this.reader.requestSlice(e,i.totalSize);r instanceof Promise&&(r=await r),Lx(r),this.traverseBox(r);const o=this.lastReadFragment;Lx(o&&o.moofOffset===e);for(const[,e]of o.trackData){const t=e.track,{fragmentPositionCache:n}=t;if(!e.startTimestampIsFinal){const i=t.fragmentLookupTable.find((e=>e.moofOffset===o.moofOffset));if(i)rT(e,i.timestamp);else{const t=Zx(n,o.moofOffset-1,(e=>e.moofOffset));if(-1!==t){const i=n[t];rT(e,i.endTimestamp)}}e.startTimestampIsFinal=!0}const i=Zx(n,e.startTimestamp,(e=>e.startTimestamp));-1!==i&&n[i].moofOffset===o.moofOffset||n.splice(i+1,0,{moofOffset:o.moofOffset,startTimestamp:e.startTimestamp,endTimestamp:e.endTimestamp})}return o}readContiguousBoxes(e){const t=e.filePos;for(;e.filePos-t<=e.length-8&&this.traverseBox(e););}*iterateContiguousBoxes(e){const t=e.filePos;for(;e.filePos-t<=e.length-8;){const t=e.filePos,n=q_(e);if(!n)break;yield{boxInfo:n,slice:e},e.filePos=t+n.totalSize}}traverseBox(e){var t,n,i,r,o,s,a,l,c,u,d,h,f,p,m,v,g,y,b,k,w,x,_,T,I,E,S,A,N,M,F,C,O,P,R,D;const L=e.filePos,B=q_(e);if(!B)return!1;const z=e.filePos,W=L+B.totalSize;switch(B.name){case"mdia":case"minf":case"dinf":case"mfra":case"edts":case"wave":this.readContiguousBoxes(e.slice(z,B.contentSize));break;case"mvhd":{const t=yT(e);e.skip(3),1===t?(e.skip(16),this.movieTimescale=xT(e),this.movieDurationInTimescale=TT(e)):(e.skip(8),this.movieTimescale=xT(e),this.movieDurationInTimescale=xT(e))}break;case"trak":{const t={id:-1,demuxer:this,inputTrack:null,disposition:{...u_},info:null,timescale:-1,durationInMovieTimescale:-1,durationInMediaTimescale:-1,rotation:0,internalCodecId:null,name:null,languageCode:"und",sampleTableByteOffset:-1,sampleTable:null,fragmentLookupTable:[],currentFragmentState:null,fragmentPositionCache:[],editListPreviousSegmentDurations:0,editListOffset:0};if(this.currentTrack=t,this.readContiguousBoxes(e.slice(z,B.contentSize)),-1!==t.id&&-1!==t.timescale&&null!==t.info)if("video"===t.info.type&&-1!==t.info.width){const e=t;t.inputTrack=new j_(this.input,new J_(e)),this.tracks.push(t)}else if("audio"===t.info.type&&-1!==t.info.numberOfChannels){const e=t;t.inputTrack=new U_(this.input,new Z_(e)),this.tracks.push(t)}this.currentTrack=null}break;case"tkhd":{const t=this.currentTrack;if(!t)break;const n=yT(e),i=!!(1&kT(e));if(t.disposition.default=i,0===n)e.skip(8),t.id=xT(e),e.skip(4),t.durationInMovieTimescale=xT(e);else{if(1!==n)throw new Error(`Incorrect track header version ${n}.`);e.skip(16),t.id=xT(e),e.skip(4),t.durationInMovieTimescale=TT(e)}e.skip(16);const r=[V_(e),V_(e),G_(e),V_(e),V_(e),G_(e),V_(e),V_(e),G_(e)],o=(e=>{const t=(e%360+360)%360;if(0===t||90===t||180===t||270===t)return t;throw new Error(`Invalid rotation ${e}.`)})((Ce=oT(r),90*Math.round(Ce/90)));Lx(0===o||90===o||180===o||270===o),t.rotation=o}break;case"elst":{const t=this.currentTrack;if(!t)break;const n=yT(e);e.skip(3);let i=!1,r=0;const o=xT(e);for(let s=0;s<o;s++){const o=1===n?TT(e):xT(e),s=1===n?IT(e):_T(e),a=V_(e);if(0!==o){if(i){console.warn("Unsupported edit list: multiple edits are not currently supported. Only using first edit.");break}if(-1!==s){if(1!==a){console.warn("Unsupported edit list entry: media rate must be 1.");break}t.editListPreviousSegmentDurations=r,t.editListOffset=s,i=!0}else r+=o}}}break;case"mdhd":{const t=this.currentTrack;if(!t)break;const n=yT(e);e.skip(3),0===n?(e.skip(8),t.timescale=xT(e),t.durationInMediaTimescale=xT(e)):1===n&&(e.skip(16),t.timescale=xT(e),t.durationInMediaTimescale=TT(e));let i=bT(e);if(i>0){t.languageCode="";for(let e=0;e<3;e++)t.languageCode=String.fromCharCode(96+(31&i))+t.languageCode,i>>=5;Fe=t.languageCode,i_.test(Fe)||(t.languageCode="und")}}break;case"hdlr":{const t=this.currentTrack;if(!t)break;e.skip(8);const n=ST(e,4);"vide"===n?t.info={type:"video",width:-1,height:-1,squarePixelWidth:-1,squarePixelHeight:-1,codec:null,codecDescription:null,colorSpace:null,avcType:null,avcCodecInfo:null,hevcCodecInfo:null,vp9CodecInfo:null,av1CodecInfo:null}:"soun"===n&&(t.info={type:"audio",numberOfChannels:-1,sampleRate:-1,codec:null,codecDescription:null,aacCodecInfo:null})}break;case"stbl":{const t=this.currentTrack;if(!t)break;t.sampleTableByteOffset=L,this.readContiguousBoxes(e.slice(z,B.contentSize))}break;case"stsd":{const t=this.currentTrack;if(!t)break;if(null===t.info||t.sampleTable)break;const n=yT(e);e.skip(3);const i=xT(e);for(let r=0;r<i;r++){const i=e.filePos,r=q_(e);if(!r)break;t.internalCodecId=r.name;const o=r.name.toLowerCase();if("video"===t.info.type)"avc1"===o||"avc3"===o?(t.info.codec="avc",t.info.avcType="avc1"===o?1:3):"hvc1"===o||"hev1"===o?t.info.codec="hevc":"vp08"===o?t.info.codec="vp8":"vp09"===o?t.info.codec="vp9":"av01"===o?t.info.codec="av1":console.warn(`Unsupported video codec (sample entry type '${r.name}').`),e.skip(24),t.info.width=bT(e),t.info.height=bT(e),t.info.squarePixelWidth=t.info.width,t.info.squarePixelHeight=t.info.height,e.skip(50),this.readContiguousBoxes(e.slice(e.filePos,i+r.totalSize-e.filePos));else{"mp4a"===o||("opus"===o?t.info.codec="opus":"flac"===o?t.info.codec="flac":"twos"===o||"sowt"===o||"raw "===o||"in24"===o||"in32"===o||"fl32"===o||"fl64"===o||"lpcm"===o||"ipcm"===o||"fpcm"===o||("ulaw"===o?t.info.codec="ulaw":"alaw"===o?t.info.codec="alaw":"ac-3"===o?t.info.codec="ac3":"ec-3"===o?t.info.codec="eac3":console.warn(`Unsupported audio codec (sample entry type '${r.name}').`))),e.skip(8);const s=bT(e);e.skip(6);let a=bT(e),l=bT(e);e.skip(4);let c=xT(e)/65536;if(0===n&&s>0)if(1===s)e.skip(4),l=8*xT(e),e.skip(8);else if(2===s){e.skip(4),c=ET(e),a=xT(e),e.skip(4),l=xT(e);const n=xT(e);if(e.skip(8),"lpcm"===o){const e=l+7>>3,i=Boolean(1&n),r=Boolean(2&n),o=4&n?-1:0;l>0&&l<=64&&(i?32===l&&(t.info.codec=r?"pcm-f32be":"pcm-f32"):o&1<<e-1?1===e?t.info.codec="pcm-s8":2===e?t.info.codec=r?"pcm-s16be":"pcm-s16":3===e?t.info.codec=r?"pcm-s24be":"pcm-s24":4===e&&(t.info.codec=r?"pcm-s32be":"pcm-s32"):1===e&&(t.info.codec="pcm-u8")),null===t.info.codec&&console.warn("Unsupported PCM format.")}}"opus"===t.info.codec&&(c=48e3),t.info.numberOfChannels=a,t.info.sampleRate=c,"twos"===o?8===l?t.info.codec="pcm-s8":16===l?t.info.codec="pcm-s16be":(console.warn(`Unsupported sample size ${l} for codec 'twos'.`),t.info.codec=null):"sowt"===o?8===l?t.info.codec="pcm-s8":16===l?t.info.codec="pcm-s16":(console.warn(`Unsupported sample size ${l} for codec 'sowt'.`),t.info.codec=null):"raw "===o?t.info.codec="pcm-u8":"in24"===o?t.info.codec="pcm-s24be":"in32"===o?t.info.codec="pcm-s32be":"fl32"===o?t.info.codec="pcm-f32be":"fl64"===o?t.info.codec="pcm-f64be":"ipcm"===o?t.info.codec="pcm-s16be":"fpcm"===o&&(t.info.codec="pcm-f32be"),this.readContiguousBoxes(e.slice(e.filePos,i+r.totalSize-e.filePos))}}}break;case"avcC":{const t=this.currentTrack;if(!t)break;Lx(t.info),t.info.codecDescription=gT(e,B.contentSize)}break;case"hvcC":{const t=this.currentTrack;if(!t)break;Lx(t.info),t.info.codecDescription=gT(e,B.contentSize)}break;case"vpcC":{var $;const t=this.currentTrack;if(!t)break;Lx("video"===(null===($=t.info)||void 0===$?void 0:$.type)),e.skip(4);const n=yT(e),i=yT(e),r=yT(e),o=r>>4,s=r>>1&7,a=1&r,l=yT(e),c=yT(e),u=yT(e);t.info.vp9CodecInfo={profile:n,level:i,bitDepth:o,chromaSubsampling:s,videoFullRangeFlag:a,colourPrimaries:l,transferCharacteristics:c,matrixCoefficients:u}}break;case"av1C":{var j;const t=this.currentTrack;if(!t)break;Lx("video"===(null===(j=t.info)||void 0===j?void 0:j.type)),e.skip(1);const n=yT(e),i=n>>5,r=31&n,o=yT(e),s=o>>7,a=o>>6&1,l=o>>4&1,c=o>>3&1,u=o>>2&1,d=3&o,h=2===i&&a?o>>5&1?12:10:a?10:8;t.info.av1CodecInfo={profile:i,level:r,tier:s,bitDepth:h,monochrome:l,chromaSubsamplingX:c,chromaSubsamplingY:u,chromaSamplePosition:d}}break;case"colr":{var U;const t=this.currentTrack;if(!t)break;if(Lx("video"===(null===(U=t.info)||void 0===U?void 0:U.type)),"nclx"!==ST(e,4))break;const n=bT(e),i=bT(e),r=bT(e),o=Boolean(128&yT(e));t.info.colorSpace={primaries:Vx[n],transfer:Hx[i],matrix:Xx[r],fullRange:o}}break;case"pasp":{var q;const t=this.currentTrack;if(!t)break;Lx("video"===(null===(q=t.info)||void 0===q?void 0:q.type));const n=xT(e),i=xT(e);n>i?t.info.squarePixelWidth=Math.round(t.info.width*n/i):t.info.squarePixelHeight=Math.round(t.info.height*i/n)}break;case"esds":{var V;const t=this.currentTrack;if(!t)break;Lx("audio"===(null===(V=t.info)||void 0===V?void 0:V.type)),e.skip(4),Lx(3===yT(e)),H_(e),e.skip(2);const n=yT(e),i=!!(64&n),r=!!(32&n);if(!!(128&n)&&e.skip(2),i){const t=yT(e);e.skip(t)}r&&e.skip(2),Lx(4===yT(e));const o=H_(e),s=e.filePos,a=yT(e);if(64===a||103===a?(t.info.codec="aac",t.info.aacCodecInfo={isMpeg2:103===a,objectType:null}):105===a||107===a?t.info.codec="mp3":221===a?t.info.codec="vorbis":console.warn(`Unsupported audio codec (objectTypeIndication ${a}) - discarding track.`),e.skip(12),o>e.filePos-s){Lx(5===yT(e));const n=H_(e);if(t.info.codecDescription=gT(e,n),"aac"===t.info.codec){const e=p_(t.info.codecDescription);null!==e.numberOfChannels&&(t.info.numberOfChannels=e.numberOfChannels),null!==e.sampleRate&&(t.info.sampleRate=e.sampleRate)}}}break;case"enda":{var G;const t=this.currentTrack;if(!t)break;Lx("audio"===(null===(G=t.info)||void 0===G?void 0:G.type)),255&bT(e)&&("pcm-s16be"===t.info.codec?t.info.codec="pcm-s16":"pcm-s24be"===t.info.codec?t.info.codec="pcm-s24":"pcm-s32be"===t.info.codec?t.info.codec="pcm-s32":"pcm-f32be"===t.info.codec?t.info.codec="pcm-f32":"pcm-f64be"===t.info.codec&&(t.info.codec="pcm-f64"))}break;case"pcmC":{var H;const t=this.currentTrack;if(!t)break;Lx("audio"===(null===(H=t.info)||void 0===H?void 0:H.type)),e.skip(4);const n=yT(e),i=Boolean(1&n),r=yT(e);"pcm-s16be"===t.info.codec?i?16===r?t.info.codec="pcm-s16":24===r?t.info.codec="pcm-s24":32===r?t.info.codec="pcm-s32":(console.warn(`Invalid ipcm sample size ${r}.`),t.info.codec=null):16===r?t.info.codec="pcm-s16be":24===r?t.info.codec="pcm-s24be":32===r?t.info.codec="pcm-s32be":(console.warn(`Invalid ipcm sample size ${r}.`),t.info.codec=null):"pcm-f32be"===t.info.codec&&(i?32===r?t.info.codec="pcm-f32":64===r?t.info.codec="pcm-f64":(console.warn(`Invalid fpcm sample size ${r}.`),t.info.codec=null):32===r?t.info.codec="pcm-f32be":64===r?t.info.codec="pcm-f64be":(console.warn(`Invalid fpcm sample size ${r}.`),t.info.codec=null));break}case"dOps":{var K;const t=this.currentTrack;if(!t)break;Lx("audio"===(null===(K=t.info)||void 0===K?void 0:K.type)),e.skip(1);const n=yT(e),i=bT(e),r=xT(e),o=wT(e),s=yT(e);let a;a=0!==s?gT(e,2+n):new Uint8Array(0);const l=new Uint8Array(19+a.byteLength),c=new DataView(l.buffer);c.setUint32(0,1332770163,!1),c.setUint32(4,1214603620,!1),c.setUint8(8,1),c.setUint8(9,n),c.setUint16(10,i,!0),c.setUint32(12,r,!0),c.setInt16(16,o,!0),c.setUint8(18,s),l.set(a,19),t.info.codecDescription=l,t.info.numberOfChannels=n}break;case"dfLa":{var X;const t=this.currentTrack;if(!t)break;Lx("audio"===(null===(X=t.info)||void 0===X?void 0:X.type)),e.skip(4);const n=127,i=128,r=e.filePos;for(;e.filePos<W;){const r=yT(e),o=kT(e);if((r&n)===M_.STREAMINFO){e.skip(10);const n=xT(e),i=n>>>12,r=1+(n>>9&7);t.info.sampleRate=i,t.info.numberOfChannels=r,e.skip(20)}else e.skip(o);if(r&i)break}const o=e.filePos;e.filePos=r;const s=gT(e,o-r),a=new Uint8Array(4+s.byteLength);new DataView(a.buffer).setUint32(0,1716281667,!1),a.set(s,4),t.info.codecDescription=a}break;case"dac3":{var Y;const t=this.currentTrack;if(!t)break;Lx("audio"===(null===(Y=t.info)||void 0===Y?void 0:Y.type));const n=gT(e,3),i=new d_(n),r=i.readBits(2);i.skipBits(8);const o=i.readBits(3),s=i.readBits(1);r<3&&(t.info.sampleRate=k_[r]),t.info.numberOfChannels=F_[o]+s}break;case"dec3":{var Q;const t=this.currentTrack;if(!t)break;Lx("audio"===(null===(Q=t.info)||void 0===Q?void 0:Q.type));const n=(e=>{if(e.length<2)return null;const t=new d_(e),n=t.readBits(13),i=t.readBits(3),r=[];for(let n=0;n<=i&&!(Math.ceil(t.pos/8)+3>e.length);n++){const e=t.readBits(2),n=t.readBits(5);t.skipBits(1),t.skipBits(1);const i=t.readBits(3),o=t.readBits(3),s=t.readBits(1);t.skipBits(3);const a=t.readBits(4);let l=0;a>0?l=t.readBits(9):t.skipBits(1),r.push({fscod:e,fscod2:null,bsid:n,bsmod:i,acmod:o,lfeon:s,numDepSub:a,chanLoc:l})}return 0===r.length?null:{dataRate:n,substreams:r}})(gT(e,B.contentSize));if(!n){console.warn("Invalid dec3 box contents, ignoring.");break}const i=(e=>{const t=e.substreams[0];return Lx(t),t.fscod<3?k_[t.fscod]:null!==t.fscod2&&t.fscod2<3?w_[t.fscod2]:null})(n);null!==i&&(t.info.sampleRate=i),t.info.numberOfChannels=(e=>{const t=e.substreams[0];Lx(t);let n=F_[t.acmod]+t.lfeon;if(t.numDepSub>0){const e=[2,2,1,1,2,2,2,1,1];for(let i=0;i<9;i++)t.chanLoc&1<<8-i&&(n+=e[i])}return n})(n)}break;case"stts":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4);const n=xT(e);let i=0,r=0;for(let o=0;o<n;o++){const n=xT(e),o=xT(e);t.sampleTable.sampleTimingEntries.push({startIndex:i,startDecodeTimestamp:r,count:n,delta:o}),i+=n,r+=n*o}}break;case"ctts":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4);const n=xT(e);let i=0;for(let r=0;r<n;r++){const n=xT(e),r=_T(e);t.sampleTable.sampleCompositionTimeOffsets.push({startIndex:i,count:n,offset:r}),i+=n}}break;case"stsz":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4);const n=xT(e),i=xT(e);if(0===n)for(let n=0;n<i;n++){const n=xT(e);t.sampleTable.sampleSizes.push(n)}else t.sampleTable.sampleSizes.push(n)}break;case"stz2":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4),e.skip(3);const n=yT(e),i=xT(e),r=gT(e,Math.ceil(i*n/8)),o=new d_(r);for(let e=0;e<i;e++){const e=o.readBits(n);t.sampleTable.sampleSizes.push(e)}}break;case"stss":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4),t.sampleTable.keySampleIndices=[];const n=xT(e);for(let i=0;i<n;i++){const n=xT(e)-1;t.sampleTable.keySampleIndices.push(n)}0!==t.sampleTable.keySampleIndices[0]&&t.sampleTable.keySampleIndices.unshift(0)}break;case"stsc":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4);const n=xT(e);for(let i=0;i<n;i++){const n=xT(e)-1,i=xT(e),r=xT(e);t.sampleTable.sampleToChunk.push({startSampleIndex:-1,startChunkIndex:n,samplesPerChunk:i,sampleDescriptionIndex:r})}let i=0;for(let e=0;e<t.sampleTable.sampleToChunk.length;e++)t.sampleTable.sampleToChunk[e].startSampleIndex=i,e<t.sampleTable.sampleToChunk.length-1&&(i+=(t.sampleTable.sampleToChunk[e+1].startChunkIndex-t.sampleTable.sampleToChunk[e].startChunkIndex)*t.sampleTable.sampleToChunk[e].samplesPerChunk)}break;case"stco":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4);const n=xT(e);for(let i=0;i<n;i++){const n=xT(e);t.sampleTable.chunkOffsets.push(n)}}break;case"co64":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4);const n=xT(e);for(let i=0;i<n;i++){const n=TT(e);t.sampleTable.chunkOffsets.push(n)}}break;case"mvex":this.isFragmented=!0,this.readContiguousBoxes(e.slice(z,B.contentSize));break;case"mehd":{const t=yT(e);e.skip(3);const n=1===t?TT(e):xT(e);this.movieDurationInTimescale=n}break;case"trex":{e.skip(4);const t=xT(e),n=xT(e),i=xT(e),r=xT(e),o=xT(e);this.fragmentTrackDefaults.push({trackId:t,defaultSampleDescriptionIndex:n,defaultSampleDuration:i,defaultSampleSize:r,defaultSampleFlags:o})}break;case"tfra":{const t=yT(e);e.skip(3);const n=xT(e),i=this.tracks.find((e=>e.id===n));if(!i)break;const r=xT(e),o=(12&r)>>2,s=3&r,a=[yT,bT,kT,xT],l=a[(48&r)>>4],c=a[o],u=a[s],d=xT(e);for(let n=0;n<d;n++){const n=1===t?TT(e):xT(e),r=1===t?TT(e):xT(e);l(e),c(e),u(e),i.fragmentLookupTable.push({timestamp:n,moofOffset:r})}i.fragmentLookupTable.sort(((e,t)=>e.timestamp-t.timestamp));for(let e=0;e<i.fragmentLookupTable.length-1;e++){const t=i.fragmentLookupTable[e],n=i.fragmentLookupTable[e+1];t.timestamp===n.timestamp&&(i.fragmentLookupTable.splice(e+1,1),e--)}}break;case"moof":this.currentFragment={moofOffset:L,moofSize:B.totalSize,implicitBaseDataOffset:L,trackData:new Map},this.readContiguousBoxes(e.slice(z,B.contentSize)),this.lastReadFragment=this.currentFragment,this.currentFragment=null;break;case"traf":if(Lx(this.currentFragment),this.readContiguousBoxes(e.slice(z,B.contentSize)),this.currentTrack){const e=this.currentFragment.trackData.get(this.currentTrack.id);if(e){const{currentFragmentState:t}=this.currentTrack;Lx(t),null!==t.startTimestamp&&(rT(e,t.startTimestamp),e.startTimestampIsFinal=!0)}this.currentTrack.currentFragmentState=null,this.currentTrack=null}break;case"tfhd":{var J,Z,ee,te;Lx(this.currentFragment),e.skip(1);const t=kT(e),n=Boolean(1&t),i=Boolean(2&t),r=Boolean(8&t),o=Boolean(16&t),s=Boolean(32&t),a=Boolean(65536&t),l=Boolean(131072&t),c=xT(e),u=this.tracks.find((e=>e.id===c));if(!u)break;const d=this.fragmentTrackDefaults.find((e=>e.trackId===c));this.currentTrack=u,u.currentFragmentState={baseDataOffset:this.currentFragment.implicitBaseDataOffset,sampleDescriptionIndex:null!==(J=null==d?void 0:d.defaultSampleDescriptionIndex)&&void 0!==J?J:null,defaultSampleDuration:null!==(Z=null==d?void 0:d.defaultSampleDuration)&&void 0!==Z?Z:null,defaultSampleSize:null!==(ee=null==d?void 0:d.defaultSampleSize)&&void 0!==ee?ee:null,defaultSampleFlags:null!==(te=null==d?void 0:d.defaultSampleFlags)&&void 0!==te?te:null,startTimestamp:null},n?u.currentFragmentState.baseDataOffset=TT(e):l&&(u.currentFragmentState.baseDataOffset=this.currentFragment.moofOffset),i&&(u.currentFragmentState.sampleDescriptionIndex=xT(e)),r&&(u.currentFragmentState.defaultSampleDuration=xT(e)),o&&(u.currentFragmentState.defaultSampleSize=xT(e)),s&&(u.currentFragmentState.defaultSampleFlags=xT(e)),a&&(u.currentFragmentState.defaultSampleDuration=0)}break;case"tfdt":{const t=this.currentTrack;if(!t)break;Lx(t.currentFragmentState);const n=yT(e);e.skip(3);const i=0===n?xT(e):TT(e);t.currentFragmentState.startTimestamp=i}break;case"trun":{const t=this.currentTrack;if(!t)break;if(Lx(this.currentFragment),Lx(t.currentFragmentState),this.currentFragment.trackData.has(t.id)){console.warn("Can't have two trun boxes for the same track in one fragment. Ignoring...");break}const n=yT(e),i=kT(e),r=Boolean(1&i),o=Boolean(4&i),s=Boolean(256&i),a=Boolean(512&i),l=Boolean(1024&i),c=Boolean(2048&i),u=xT(e);let d=t.currentFragmentState.baseDataOffset;r&&(d+=_T(e));let h=null;o&&(h=xT(e));let f=d;if(0===u){this.currentFragment.implicitBaseDataOffset=f;break}let p=0;const m={track:t,startTimestamp:0,endTimestamp:0,firstKeyFrameTimestamp:null,samples:[],presentationTimestamps:[],startTimestampIsFinal:!1};this.currentFragment.trackData.set(t.id,m);for(let i=0;i<u;i++){let r,o,u;s?r=xT(e):(Lx(null!==t.currentFragmentState.defaultSampleDuration),r=t.currentFragmentState.defaultSampleDuration),a?o=xT(e):(Lx(null!==t.currentFragmentState.defaultSampleSize),o=t.currentFragmentState.defaultSampleSize),l?u=xT(e):(Lx(null!==t.currentFragmentState.defaultSampleFlags),u=t.currentFragmentState.defaultSampleFlags),0===i&&null!==h&&(u=h);let d=0;c&&(d=0===n?xT(e):_T(e));const v=!(65536&u);m.samples.push({presentationTimestamp:p+d,duration:r,byteOffset:f,byteSize:o,isKeyFrame:v}),f+=o,p+=r}m.presentationTimestamps=m.samples.map(((e,t)=>({presentationTimestamp:e.presentationTimestamp,sampleIndex:t}))).sort(((e,t)=>e.presentationTimestamp-t.presentationTimestamp));for(let e=0;e<m.presentationTimestamps.length;e++){const t=m.presentationTimestamps[e],n=m.samples[t.sampleIndex];if(null===m.firstKeyFrameTimestamp&&n.isKeyFrame&&(m.firstKeyFrameTimestamp=n.presentationTimestamp),e<m.presentationTimestamps.length-1){const i=m.presentationTimestamps[e+1];n.duration=i.presentationTimestamp-t.presentationTimestamp}}const v=m.samples[m.presentationTimestamps[0].sampleIndex],g=m.samples[Bx(m.presentationTimestamps).sampleIndex];m.startTimestamp=v.presentationTimestamp,m.endTimestamp=g.presentationTimestamp+g.duration,this.currentFragment.implicitBaseDataOffset=f}break;case"udta":{const g=this.iterateContiguousBoxes(e.slice(z,B.contentSize));for(const{boxInfo:e,slice:y}of g){if("meta"!==e.name&&!this.currentTrack){var ne,ie,re,oe,se,ae,le,ce;const t=y.filePos;null!==(ie=(ne=this.metadataTags).raw)&&void 0!==ie||(ne.raw={}),"©"===e.name[0]?null!==(se=(re=this.metadataTags.raw)[oe=e.name])&&void 0!==se||(re[oe]=K_(y)):null!==(ce=(ae=this.metadataTags.raw)[le=e.name])&&void 0!==ce||(ae[le]=gT(y,e.contentSize)),y.filePos=t}switch(e.name){case"meta":y.skip(-e.headerSize),this.traverseBox(y);break;case"©nam":case"name":this.currentTrack?this.currentTrack.name=jx.decode(gT(y,e.contentSize)):null!==(n=(t=this.metadataTags).title)&&void 0!==n||(t.title=K_(y));break;case"©des":this.currentTrack||null!==(r=(i=this.metadataTags).description)&&void 0!==r||(i.description=K_(y));break;case"©ART":this.currentTrack||null!==(s=(o=this.metadataTags).artist)&&void 0!==s||(o.artist=K_(y));break;case"©alb":this.currentTrack||null!==(l=(a=this.metadataTags).album)&&void 0!==l||(a.album=K_(y));break;case"albr":this.currentTrack||null!==(u=(c=this.metadataTags).albumArtist)&&void 0!==u||(c.albumArtist=K_(y));break;case"©gen":this.currentTrack||null!==(h=(d=this.metadataTags).genre)&&void 0!==h||(d.genre=K_(y));break;case"©day":if(!this.currentTrack){var ue,de;const e=new Date(K_(y));Number.isNaN(e.getTime())||null!==(de=(ue=this.metadataTags).date)&&void 0!==de||(ue.date=e)}break;case"©cmt":this.currentTrack||null!==(p=(f=this.metadataTags).comment)&&void 0!==p||(f.comment=K_(y));break;case"©lyr":this.currentTrack||null!==(v=(m=this.metadataTags).lyrics)&&void 0!==v||(m.lyrics=K_(y))}}}break;case"meta":{if(this.currentTrack)break;const t=0!==xT(e);this.currentMetadataKeys=new Map,t?this.readContiguousBoxes(e.slice(z,B.contentSize)):this.readContiguousBoxes(e.slice(z+4,B.contentSize-4)),this.currentMetadataKeys=null}break;case"keys":{if(!this.currentMetadataKeys)break;e.skip(4);const t=xT(e);for(let n=0;n<t;n++){const t=xT(e);e.skip(4);const i=jx.decode(gT(e,t-8));this.currentMetadataKeys.set(n+1,i)}}break;case"ilst":{if(!this.currentMetadataKeys)break;const t=this.iterateContiguousBoxes(e.slice(z,B.contentSize));for(const{boxInfo:e,slice:n}of t){var he,fe,pe,me,ve;let t=e.name;const i=(t.charCodeAt(0)<<24)+(t.charCodeAt(1)<<16)+(t.charCodeAt(2)<<8)+t.charCodeAt(3);this.currentMetadataKeys.has(i)&&(t=this.currentMetadataKeys.get(i));const r=X_(n);switch(null!==(fe=(he=this.metadataTags).raw)&&void 0!==fe||(he.raw={}),null!==(ve=(pe=this.metadataTags.raw)[me=t])&&void 0!==ve||(pe[me]=r),t){case"©nam":case"titl":case"com.apple.quicktime.title":case"title":"string"==typeof r&&(null!==(y=(g=this.metadataTags).title)&&void 0!==y||(g.title=r));break;case"©des":case"desc":case"dscp":case"com.apple.quicktime.description":case"description":"string"==typeof r&&(null!==(k=(b=this.metadataTags).description)&&void 0!==k||(b.description=r));break;case"©ART":case"com.apple.quicktime.artist":case"artist":"string"==typeof r&&(null!==(x=(w=this.metadataTags).artist)&&void 0!==x||(w.artist=r));break;case"©alb":case"albm":case"com.apple.quicktime.album":case"album":"string"==typeof r&&(null!==(T=(_=this.metadataTags).album)&&void 0!==T||(_.album=r));break;case"aART":case"album_artist":"string"==typeof r&&(null!==(E=(I=this.metadataTags).albumArtist)&&void 0!==E||(I.albumArtist=r));break;case"©cmt":case"com.apple.quicktime.comment":case"comment":"string"==typeof r&&(null!==(A=(S=this.metadataTags).comment)&&void 0!==A||(S.comment=r));break;case"©gen":case"gnre":case"com.apple.quicktime.genre":case"genre":"string"==typeof r&&(null!==(M=(N=this.metadataTags).genre)&&void 0!==M||(N.genre=r));break;case"©lyr":case"lyrics":"string"==typeof r&&(null!==(C=(F=this.metadataTags).lyrics)&&void 0!==C||(F.lyrics=r));break;case"©day":case"rldt":case"com.apple.quicktime.creationdate":case"date":if("string"==typeof r){var ge,ye;const e=new Date(r);Number.isNaN(e.getTime())||null!==(ye=(ge=this.metadataTags).date)&&void 0!==ye||(ge.date=e)}break;case"covr":case"com.apple.quicktime.artwork":r instanceof c_?(null!==(P=(O=this.metadataTags).images)&&void 0!==P||(O.images=[]),this.metadataTags.images.push({data:r.data,kind:"coverFront",mimeType:r.mimeType})):r instanceof Uint8Array&&(null!==(D=(R=this.metadataTags).images)&&void 0!==D||(R.images=[]),this.metadataTags.images.push({data:r,kind:"coverFront",mimeType:"image/*"}));break;case"track":if("string"==typeof r){var be,ke,we,xe;const e=r.split("/"),t=Number.parseInt(e[0],10),n=e[1]&&Number.parseInt(e[1],10);Number.isInteger(t)&&t>0&&(null!==(ke=(be=this.metadataTags).trackNumber)&&void 0!==ke||(be.trackNumber=t)),n&&Number.isInteger(n)&&n>0&&(null!==(xe=(we=this.metadataTags).tracksTotal)&&void 0!==xe||(we.tracksTotal=n))}break;case"trkn":if(r instanceof Uint8Array&&r.length>=6){var _e,Te,Ie,Ee;const e=$x(r),t=e.getUint16(2,!1),n=e.getUint16(4,!1);t>0&&(null!==(Te=(_e=this.metadataTags).trackNumber)&&void 0!==Te||(_e.trackNumber=t)),n>0&&(null!==(Ee=(Ie=this.metadataTags).tracksTotal)&&void 0!==Ee||(Ie.tracksTotal=n))}break;case"disc":case"disk":if(r instanceof Uint8Array&&r.length>=6){var Se,Ae,Ne,Me;const e=$x(r),t=e.getUint16(2,!1),n=e.getUint16(4,!1);t>0&&(null!==(Ae=(Se=this.metadataTags).discNumber)&&void 0!==Ae||(Se.discNumber=t)),n>0&&(null!==(Me=(Ne=this.metadataTags).discsTotal)&&void 0!==Me||(Ne.discsTotal=n))}}}}}var Fe,Ce;return e.filePos=W,!0}}class Q_{constructor(e){this.internalTrack=e,this.packetToSampleIndex=new WeakMap,this.packetToFragmentLocation=new WeakMap}getId(){return this.internalTrack.id}getNumber(){const e=this.internalTrack.demuxer,t=this.internalTrack.inputTrack.type;let n=0;for(const i of e.tracks)if(i.inputTrack.type===t&&n++,i===this.internalTrack)break;return n}getCodec(){throw new Error("Not implemented on base class.")}getInternalCodecId(){return this.internalTrack.internalCodecId}getName(){return this.internalTrack.name}getLanguageCode(){return this.internalTrack.languageCode}getTimeResolution(){return this.internalTrack.timescale}getDisposition(){return this.internalTrack.disposition}async computeDuration(){var e,t;const n=await this.getPacket(1/0,{metadataOnly:!0});return(null!==(e=null==n?void 0:n.timestamp)&&void 0!==e?e:0)+(null!==(t=null==n?void 0:n.duration)&&void 0!==t?t:0)}async getFirstTimestamp(){var e;const t=await this.getFirstPacket({metadataOnly:!0});return null!==(e=null==t?void 0:t.timestamp)&&void 0!==e?e:0}async getFirstPacket(e){const t=await this.fetchPacketForSampleIndex(0,e);return t||!this.internalTrack.demuxer.isFragmented?t:this.performFragmentedLookup(null,(e=>e.trackData.get(this.internalTrack.id)?{sampleIndex:0,correctSampleFound:!0}:{sampleIndex:-1,correctSampleFound:!1}),-1/0,1/0,e)}mapTimestampIntoTimescale(e){return(e=>{const t=Math.round(e);return Math.abs(e/t-1)<10*Number.EPSILON?t:e})(e*this.internalTrack.timescale)+this.internalTrack.editListOffset}async getPacket(e,t){const n=this.mapTimestampIntoTimescale(e),i=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),r=eT(i,n),o=await this.fetchPacketForSampleIndex(r,t);return sT(i)&&this.internalTrack.demuxer.isFragmented?this.performFragmentedLookup(null,(e=>{const t=e.trackData.get(this.internalTrack.id);if(!t)return{sampleIndex:-1,correctSampleFound:!1};const i=Zx(t.presentationTimestamps,n,(e=>e.presentationTimestamp));return{sampleIndex:-1!==i?t.presentationTimestamps[i].sampleIndex:-1,correctSampleFound:-1!==i&&n<t.endTimestamp}}),n,n,t):o}async getNextPacket(e,t){const n=this.packetToSampleIndex.get(e);if(void 0!==n)return this.fetchPacketForSampleIndex(n+1,t);const i=this.packetToFragmentLocation.get(e);if(void 0===i)throw new Error("Packet was not created from this track.");return this.performFragmentedLookup(i.fragment,(e=>{if(e===i.fragment){const t=e.trackData.get(this.internalTrack.id);if(i.sampleIndex+1<t.samples.length)return{sampleIndex:i.sampleIndex+1,correctSampleFound:!0}}else if(e.trackData.get(this.internalTrack.id))return{sampleIndex:0,correctSampleFound:!0};return{sampleIndex:-1,correctSampleFound:!1}}),-1/0,1/0,t)}async getKeyPacket(e,t){const n=this.mapTimestampIntoTimescale(e),i=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),r=tT(i,n),o=await this.fetchPacketForSampleIndex(r,t);return sT(i)&&this.internalTrack.demuxer.isFragmented?this.performFragmentedLookup(null,(e=>{const t=e.trackData.get(this.internalTrack.id);if(!t)return{sampleIndex:-1,correctSampleFound:!1};const i=((e,t)=>{for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1})(t.presentationTimestamps,(e=>t.samples[e.sampleIndex].isKeyFrame&&e.presentationTimestamp<=n));return{sampleIndex:-1!==i?t.presentationTimestamps[i].sampleIndex:-1,correctSampleFound:-1!==i&&n<t.endTimestamp}}),n,n,t):o}async getNextKeyPacket(e,t){const n=this.packetToSampleIndex.get(e);if(void 0!==n){const e=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),i=iT(e,n);return this.fetchPacketForSampleIndex(i,t)}const i=this.packetToFragmentLocation.get(e);if(void 0===i)throw new Error("Packet was not created from this track.");return this.performFragmentedLookup(i.fragment,(e=>{if(e===i.fragment){const t=e.trackData.get(this.internalTrack.id).samples.findIndex(((e,t)=>e.isKeyFrame&&t>i.sampleIndex));if(-1!==t)return{sampleIndex:t,correctSampleFound:!0}}else{const t=e.trackData.get(this.internalTrack.id);if(t&&null!==t.firstKeyFrameTimestamp){const e=t.samples.findIndex((e=>e.isKeyFrame));return Lx(-1!==e),{sampleIndex:e,correctSampleFound:!0}}}return{sampleIndex:-1,correctSampleFound:!1}}),-1/0,1/0,t)}async fetchPacketForSampleIndex(e,t){if(-1===e)return null;const n=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),i=nT(n,e);if(!i)return null;let r;if(t.metadataOnly)r=R_;else{let e=this.internalTrack.demuxer.reader.requestSlice(i.sampleOffset,i.sampleSize);e instanceof Promise&&(e=await e),Lx(e),r=gT(e,i.sampleSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new D_(r,i.isKeyFrame?"key":"delta",o,s,e,i.sampleSize);return this.packetToSampleIndex.set(a,e),a}async fetchPacketInFragment(e,t,n){if(-1===t)return null;const i=e.trackData.get(this.internalTrack.id).samples[t];let r;if(Lx(i),n.metadataOnly)r=R_;else{let e=this.internalTrack.demuxer.reader.requestSlice(i.byteOffset,i.byteSize);e instanceof Promise&&(e=await e),Lx(e),r=gT(e,i.byteSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new D_(r,i.isKeyFrame?"key":"delta",o,s,e.moofOffset+t,i.byteSize);return this.packetToFragmentLocation.set(a,{fragment:e,sampleIndex:t}),a}async performFragmentedLookup(e,t,n,i,r){var o,s;const a=this.internalTrack.demuxer;let l=null,c=null,u=-1;if(e){const{sampleIndex:n,correctSampleFound:i}=t(e);if(i)return this.fetchPacketInFragment(e,n,r);-1!==n&&(c=e,u=n)}const d=Zx(this.internalTrack.fragmentLookupTable,n,(e=>e.timestamp)),h=-1!==d?this.internalTrack.fragmentLookupTable[d]:null,f=Zx(this.internalTrack.fragmentPositionCache,n,(e=>e.startTimestamp)),p=-1!==f?this.internalTrack.fragmentPositionCache[f]:null,m=Math.max(null!==(o=null==h?void 0:h.moofOffset)&&void 0!==o?o:0,null!==(s=null==p?void 0:p.moofOffset)&&void 0!==s?s:0)||null;let v;for(e?null===m||e.moofOffset>=m?(v=e.moofOffset+e.moofSize,l=e):v=m:v=null!=m?m:0;;){if(l){const e=l.trackData.get(this.internalTrack.id);if(e&&e.startTimestamp>i)break}let e=a.reader.requestSliceRange(v,8,16);if(e instanceof Promise&&(e=await e),!e)break;const n=v,o=q_(e);if(!o)break;if("moof"===o.name){l=await a.readFragment(n);const{sampleIndex:e,correctSampleFound:i}=t(l);if(i)return this.fetchPacketInFragment(l,e,r);-1!==e&&(c=l,u=e)}v=n+o.totalSize}if(h&&(!c||c.moofOffset<h.moofOffset)){var g;const e=this.internalTrack.fragmentLookupTable[d-1];Lx(!e||e.timestamp<h.timestamp);const n=null!==(g=null==e?void 0:e.timestamp)&&void 0!==g?g:-1/0;return this.performFragmentedLookup(null,t,n,i,r)}return c?this.fetchPacketInFragment(c,u,r):null}}class J_ extends Q_{constructor(e){super(e),this.decoderConfigPromise=null,this.internalTrack=e}getCodec(){return this.internalTrack.info.codec}getCodedWidth(){return this.internalTrack.info.width}getCodedHeight(){return this.internalTrack.info.height}getSquarePixelWidth(){return this.internalTrack.info.squarePixelWidth}getSquarePixelHeight(){return this.internalTrack.info.squarePixelHeight}getRotation(){return this.internalTrack.rotation}async getColorSpace(){var e,t,n,i;return{primaries:null===(e=this.internalTrack.info.colorSpace)||void 0===e?void 0:e.primaries,transfer:null===(t=this.internalTrack.info.colorSpace)||void 0===t?void 0:t.transfer,matrix:null===(n=this.internalTrack.info.colorSpace)||void 0===n?void 0:n.matrix,fullRange:null===(i=this.internalTrack.info.colorSpace)||void 0===i?void 0:i.fullRange}}async canBeTransparent(){return!1}async getDecoderConfig(){var e;return this.internalTrack.info.codec?null!==(e=this.decoderConfigPromise)&&void 0!==e?e:this.decoderConfigPromise=(async(e,t)=>{if("vp9"!==this.internalTrack.info.codec||this.internalTrack.info.vp9CodecInfo){if("av1"===this.internalTrack.info.codec&&!this.internalTrack.info.av1CodecInfo){const e=await this.getFirstPacket({});this.internalTrack.info.av1CodecInfo=e&&(e=>{for(const{type:t,data:n}of N_(e)){if(1!==t)continue;const e=new d_(n),i=e.readBits(3);e.readBits(1);const r=e.readBits(1);let o=0,s=0,a=0;if(r)o=e.readBits(5);else{if(e.readBits(1)&&(e.skipBits(32),e.skipBits(32),e.readBits(1)))return null;const t=e.readBits(1);t&&(a=e.readBits(5),e.skipBits(32),e.skipBits(5),e.skipBits(5));const n=e.readBits(5);for(let i=0;i<=n;i++){e.skipBits(12);const n=e.readBits(5);if(0===i&&(o=n),n>7){const t=e.readBits(1);0===i&&(s=t)}if(t&&e.readBits(1)){const t=a+1;e.skipBits(t),e.skipBits(t),e.skipBits(1)}e.readBits(1)&&e.skipBits(4)}}const l=e.readBits(4),c=e.readBits(4),u=l+1;e.skipBits(u);const d=c+1;e.skipBits(d);let h=0;if(h=r?0:e.readBits(1),h&&(e.skipBits(4),e.skipBits(3)),e.skipBits(1),e.skipBits(1),e.skipBits(1),!r){e.skipBits(1),e.skipBits(1),e.skipBits(1),e.skipBits(1);const t=e.readBits(1);t&&(e.skipBits(1),e.skipBits(1));let n=0;n=e.readBits(1)?2:e.readBits(1),n>0&&(e.readBits(1)||e.skipBits(1)),t&&e.skipBits(3)}e.skipBits(1),e.skipBits(1),e.skipBits(1);const f=e.readBits(1);let p=8;2===i&&f?p=e.readBits(1)?12:10:i<=2&&(p=f?10:8);let m=0;1!==i&&(m=e.readBits(1));let v=1,g=1,y=0;return m||(0===i?(v=1,g=1):1===i?(v=0,g=0):12===p&&(v=e.readBits(1),v&&(g=e.readBits(1))),v&&g&&(y=e.readBits(2))),{profile:i,level:o,tier:s,bitDepth:p,monochrome:m,chromaSubsamplingX:v,chromaSubsamplingY:g,chromaSamplePosition:y}}return null})(e.data)}}else{const e=await this.getFirstPacket({});this.internalTrack.info.vp9CodecInfo=e&&(e=>{const t=new d_(e);if(2!==t.readBits(2))return null;const n=t.readBits(1),i=(t.readBits(1)<<1)+n;if(3===i&&t.skipBits(1),1===t.readBits(1))return null;if(0!==t.readBits(1))return null;if(t.skipBits(2),4817730!==t.readBits(24))return null;let r=8;i>=2&&(r=t.readBits(1)?12:10);const o=t.readBits(3);let s=0,a=0;if(7!==o)if(a=t.readBits(1),1===i||3===i){const e=t.readBits(1),n=t.readBits(1);s=e||n?e&&!n?2:1:3,t.skipBits(1)}else s=1;else s=3,a=1;const l=(t.readBits(16)+1)*(t.readBits(16)+1);let c=Bx(v_).level;for(const e of v_)if(l<=e.maxPictureSize){c=e.level;break}return{profile:i,level:c,bitDepth:r,chromaSubsampling:s,videoFullRangeFlag:a,colourPrimaries:2===o?1:1===o?6:2,transferCharacteristics:2===o?1:1===o?6:2,matrixCoefficients:7===o?0:2===o?1:1===o?6:2}})(e.data)}return{codec:g_(this.internalTrack.info),codedWidth:this.internalTrack.info.width,codedHeight:this.internalTrack.info.height,displayAspectWidth:this.internalTrack.info.squarePixelWidth,displayAspectHeight:this.internalTrack.info.squarePixelHeight,description:null!==(e=this.internalTrack.info.codecDescription)&&void 0!==e?e:void 0,colorSpace:null!==(t=this.internalTrack.info.colorSpace)&&void 0!==t?t:void 0}})():null}}class Z_ extends Q_{constructor(e){super(e),this.decoderConfig=null,this.internalTrack=e}getCodec(){return this.internalTrack.info.codec}getNumberOfChannels(){return this.internalTrack.info.numberOfChannels}getSampleRate(){return this.internalTrack.info.sampleRate}async getDecoderConfig(){var e,t;return this.internalTrack.info.codec?null!==(e=this.decoderConfig)&&void 0!==e?e:this.decoderConfig={codec:y_(this.internalTrack.info),numberOfChannels:this.internalTrack.info.numberOfChannels,sampleRate:this.internalTrack.info.sampleRate,description:null!==(t=this.internalTrack.info.codecDescription)&&void 0!==t?t:void 0}:null}}const eT=(e,t)=>{if(e.presentationTimestamps){const n=Zx(e.presentationTimestamps,t,(e=>e.presentationTimestamp));return-1===n?-1:e.presentationTimestamps[n].sampleIndex}{const n=Zx(e.sampleTimingEntries,t,(e=>e.startDecodeTimestamp));if(-1===n)return-1;const i=e.sampleTimingEntries[n];return i.startIndex+Math.min(Math.floor((t-i.startDecodeTimestamp)/i.delta),i.count-1)}},tT=(e,t)=>{if(!e.keySampleIndices)return eT(e,t);if(e.presentationTimestamps){const n=Zx(e.presentationTimestamps,t,(e=>e.presentationTimestamp));if(-1===n)return-1;for(let t=n;t>=0;t--){const n=e.presentationTimestamps[t].sampleIndex;if(-1!==Jx(e.keySampleIndices,n,(e=>e)))return n}return-1}{var n;const i=eT(e,t),r=Zx(e.keySampleIndices,i,(e=>e));return null!==(n=e.keySampleIndices[r])&&void 0!==n?n:-1}},nT=(e,t)=>{const n=Zx(e.sampleTimingEntries,t,(e=>e.startIndex)),i=e.sampleTimingEntries[n];if(!i||i.startIndex+i.count<=t)return null;let r=i.startDecodeTimestamp+(t-i.startIndex)*i.delta;const o=Zx(e.sampleCompositionTimeOffsets,t,(e=>e.startIndex)),s=e.sampleCompositionTimeOffsets[o];s&&t-s.startIndex<s.count&&(r+=s.offset);const a=e.sampleSizes[Math.min(t,e.sampleSizes.length-1)],l=Zx(e.sampleToChunk,t,(e=>e.startSampleIndex)),c=e.sampleToChunk[l];Lx(c);const u=c.startChunkIndex+Math.floor((t-c.startSampleIndex)/c.samplesPerChunk),d=e.chunkOffsets[u],h=c.startSampleIndex+(u-c.startChunkIndex)*c.samplesPerChunk;let f=0,p=d;if(1===e.sampleSizes.length)p+=a*(t-h),f+=a*c.samplesPerChunk;else for(let n=h;n<h+c.samplesPerChunk;n++){const i=e.sampleSizes[n];n<t&&(p+=i),f+=i}let m=i.delta;if(e.presentationTimestamps){const n=e.presentationTimestampIndexMap[t];Lx(void 0!==n),n<e.presentationTimestamps.length-1&&(m=e.presentationTimestamps[n+1].presentationTimestamp-r)}return{presentationTimestamp:r,duration:m,sampleOffset:p,sampleSize:a,chunkOffset:d,chunkSize:f,isKeyFrame:!e.keySampleIndices||-1!==Jx(e.keySampleIndices,t,(e=>e))}},iT=(e,t)=>{var n;if(!e.keySampleIndices)return t+1;const i=Zx(e.keySampleIndices,t,(e=>e));return null!==(n=e.keySampleIndices[i+1])&&void 0!==n?n:-1},rT=(e,t)=>{e.startTimestamp+=t,e.endTimestamp+=t;for(const n of e.samples)n.presentationTimestamp+=t;for(const n of e.presentationTimestamps)n.presentationTimestamp+=t},oT=e=>{const[t,,,n]=e,i=Math.hypot(t,n),r=t/i,o=n/i,s=-Math.atan2(o,r)*(180/Math.PI);return Number.isFinite(s)?s:0},sT=e=>0===e.sampleSizes.length;class aT{}class lT extends aT{async _getMajorBrand(e){let t=e._reader.requestSlice(0,12);return t instanceof Promise&&(t=await t),t?(t.skip(4),"ftyp"!==ST(t,4)?null:ST(t,4)):null}_createDemuxer(e){return new Y_(e)}}const cT=new class extends lT{async _canReadInput(e){const t=await this._getMajorBrand(e);return!!t&&"qt "!==t}get name(){return"MP4"}get mimeType(){return"video/mp4"}};class uT{constructor(){this._disposed=!1,this._sizePromise=null,this.onread=null}async getSizeOrNull(){var e;if(this._disposed)throw new fT;return null!==(e=this._sizePromise)&&void 0!==e?e:this._sizePromise=Promise.resolve(this._retrieveSize())}async getSize(){if(this._disposed)throw new fT;const e=await this.getSizeOrNull();if(null===e)throw new Error("Cannot determine the size of an unsized source.");return e}}class dT extends uT{constructor(e,t={}){var n;if(!(e instanceof ReadableStream))throw new TypeError("stream must be a ReadableStream.");if(!t||"object"!=typeof t)throw new TypeError("options must be an object.");if(void 0!==t.maxCacheSize&&(!l_(t.maxCacheSize)||t.maxCacheSize<0))throw new TypeError("options.maxCacheSize, when provided, must be a non-negative number.");super(),this._reader=null,this._cache=[],this._pendingSlices=[],this._currentIndex=0,this._targetIndex=0,this._maxRequestedIndex=0,this._endIndex=null,this._pulling=!1,this._stream=e,this._maxCacheSize=null!==(n=t.maxCacheSize)&&void 0!==n?n:16777216}_retrieveSize(){return this._endIndex}_read(e,t){if(null!==this._endIndex&&t>this._endIndex)return null;this._maxRequestedIndex=Math.max(this._maxRequestedIndex,t);const n=Zx(this._cache,e,(e=>e.start)),i=-1!==n?this._cache[n]:null;if(i&&i.start<=e&&t<=i.end)return{bytes:i.bytes,view:i.view,offset:i.start};let r=e;const o=new Uint8Array(t-e);if(-1!==n)for(let i=n;i<this._cache.length;i++){const n=this._cache[i];if(n.start>=t)break;const s=Math.max(e,n.start);s>r&&this._throwDueToCacheMiss();const a=Math.min(t,n.end);s<a&&(o.set(n.bytes.subarray(s-n.start,a-n.start),s-e),r=a)}if(r===t)return{bytes:o,view:$x(o),offset:e};this._currentIndex>r&&this._throwDueToCacheMiss();const{promise:s,resolve:a,reject:l}=e_();return this._pendingSlices.push({start:e,end:t,bytes:o,resolve:a,reject:l}),this._targetIndex=Math.max(this._targetIndex,t),this._pulling||(this._pulling=!0,this._pull().catch((e=>{if(this._pulling=!1,!(this._pendingSlices.length>0))throw e;this._pendingSlices.forEach((t=>t.reject(e))),this._pendingSlices.length=0}))),s}_throwDueToCacheMiss(){throw new Error("Read is before the cached region. With ReadableStreamSource, you must access the data more sequentially or increase the size of its cache.")}async _pull(){for(null!==(e=this._reader)&&void 0!==e||(this._reader=this._stream.getReader());this._currentIndex<this._targetIndex&&!this._disposed;){var e;const{done:t,value:n}=await this._reader.read();if(t){for(const e of this._pendingSlices)e.resolve(null);this._pendingSlices.length=0,this._endIndex=this._currentIndex;break}const i=this._currentIndex,r=this._currentIndex+n.byteLength;for(let e=0;e<this._pendingSlices.length;e++){const t=this._pendingSlices[e],o=Math.max(i,t.start),s=Math.min(r,t.end);o<s&&(t.bytes.set(n.subarray(o-i,s-i),o-t.start),s===t.end&&(t.resolve({bytes:t.bytes,view:$x(t.bytes),offset:t.start}),this._pendingSlices.splice(e,1),e--))}for(this._cache.push({start:i,end:r,bytes:n,view:$x(n),age:0});this._cache.length>0;){const e=this._cache[0];if(this._maxRequestedIndex-e.end<=this._maxCacheSize)break;this._cache.shift()}this._currentIndex+=n.byteLength}this._pulling=!1}_dispose(){this._pendingSlices.length=0,this._cache.length=0}}null!==(ct=Symbol.dispose)&&void 0!==ct||(Symbol.dispose=Symbol("Symbol.dispose"));class hT{get disposed(){return this._disposed}constructor(e){if(this._demuxerPromise=null,this._format=null,this._disposed=!1,!e||"object"!=typeof e)throw new TypeError("options must be an object.");if(!Array.isArray(e.formats)||e.formats.some((e=>!(e instanceof aT))))throw new TypeError("options.formats must be an array of InputFormat.");if(!(e.source instanceof uT))throw new TypeError("options.source must be a Source.");if(e.source._disposed)throw new Error("options.source must not be disposed.");this._formats=e.formats,this._source=e.source,this._reader=new pT(e.source)}_getDemuxer(){var e;return null!==(e=this._demuxerPromise)&&void 0!==e?e:this._demuxerPromise=(async()=>{this._reader.fileSize=await this._source.getSizeOrNull();for(const e of this._formats)if(await e._canReadInput(this))return this._format=e,e._createDemuxer(this);throw new Error("Input has an unsupported or unrecognizable format.")})()}get source(){return this._source}async getFormat(){return await this._getDemuxer(),Lx(this._format),this._format}async computeDuration(){return(await this._getDemuxer()).computeDuration()}async getFirstTimestamp(){const e=await this.getTracks();if(0===e.length)return 0;const t=await Promise.all(e.map((e=>e.getFirstTimestamp())));return Math.min(...t)}async getTracks(){return(await this._getDemuxer()).getTracks()}async getVideoTracks(){return(await this.getTracks()).filter((e=>e.isVideoTrack()))}async getAudioTracks(){return(await this.getTracks()).filter((e=>e.isAudioTrack()))}async getPrimaryVideoTrack(){var e;return null!==(e=(await this.getTracks()).find((e=>e.isVideoTrack())))&&void 0!==e?e:null}async getPrimaryAudioTrack(){var e;return null!==(e=(await this.getTracks()).find((e=>e.isAudioTrack())))&&void 0!==e?e:null}async getMimeType(){return(await this._getDemuxer()).getMimeType()}async getMetadataTags(){return(await this._getDemuxer()).getMetadataTags()}dispose(){this._disposed||(this._disposed=!0,this._source._disposed=!0,this._source._dispose())}[Symbol.dispose](){this.dispose()}}class fT extends Error{constructor(e="Input has been disposed."){super(e),this.name="InputDisposedError"}}class pT{constructor(e){this.source=e}requestSlice(e,t){if(this.source._disposed)throw new fT;if(e<0)return null;if(null!==this.fileSize&&e+t>this.fileSize)return null;const n=e+t,i=this.source._read(e,n);return i instanceof Promise?i.then((t=>t?new mT(t.bytes,t.view,t.offset,e,n):null)):i?new mT(i.bytes,i.view,i.offset,e,n):null}requestSliceRange(e,t,n){if(this.source._disposed)throw new fT;if(e<0)return null;if(null!==this.fileSize)return this.requestSlice(e,n_(this.fileSize-e,t,n));{const i=this.requestSlice(e,n),r=i=>{if(i)return i;const r=i=>(Lx(null!==i),this.requestSlice(e,n_(i-e,t,n))),o=this.source._retrieveSize();return o instanceof Promise?o.then(r):r(o)};return i instanceof Promise?i.then(r):r(i)}}}class mT{constructor(e,t,n,i,r){this.bytes=e,this.view=t,this.offset=n,this.start=i,this.end=r,this.bufferPos=i-n}static tempFromBytes(e){return new mT(e,$x(e),0,0,e.length)}get length(){return this.end-this.start}get filePos(){return this.offset+this.bufferPos}set filePos(e){this.bufferPos=e-this.offset}get remainingLength(){return Math.max(this.end-this.filePos,0)}skip(e){this.bufferPos+=e}slice(e,t=this.end-e){if(e<this.start||e+t>this.end)throw new RangeError("Slicing outside of original slice.");return new mT(this.bytes,this.view,this.offset,e,e+t)}}const vT=(e,t)=>{if(e.filePos<e.start||e.filePos+t>e.end)throw new RangeError(`Tried reading [${e.filePos}, ${e.filePos+t}), but slice is [${e.start}, ${e.end}). This is likely an internal error, please report it alongside the file that caused it.`)},gT=(e,t)=>{vT(e,t);const n=e.bytes.subarray(e.bufferPos,e.bufferPos+t);return e.bufferPos+=t,n},yT=e=>(vT(e,1),e.view.getUint8(e.bufferPos++)),bT=e=>{vT(e,2);const t=e.view.getUint16(e.bufferPos,!1);return e.bufferPos+=2,t},kT=e=>{vT(e,3);const t=t_(e.view,e.bufferPos);return e.bufferPos+=3,t},wT=e=>{vT(e,2);const t=e.view.getInt16(e.bufferPos,!1);return e.bufferPos+=2,t},xT=e=>{vT(e,4);const t=e.view.getUint32(e.bufferPos,!1);return e.bufferPos+=4,t},_T=e=>{vT(e,4);const t=e.view.getInt32(e.bufferPos,!1);return e.bufferPos+=4,t},TT=e=>4294967296*xT(e)+xT(e),IT=e=>4294967296*_T(e)+xT(e),ET=e=>{vT(e,8);const t=e.view.getFloat64(e.bufferPos,!1);return e.bufferPos+=8,t},ST=(e,t)=>{vT(e,t);let n="";for(let i=0;i<t;i++)n+=String.fromCharCode(e.bytes[e.bufferPos++]);return n};var AT=new WeakMap,NT=new WeakMap,MT=new WeakMap,FT=new WeakMap,CT=new WeakMap,OT=new WeakMap,PT=new WeakMap,RT=new WeakMap,DT=new WeakMap,LT=new WeakMap,BT=new WeakMap,zT=new WeakMap,WT=new WeakMap,$T=new WeakMap,jT=new WeakMap,UT=new WeakSet;class qT extends od{constructor(...e){super(...e),O(this,UT),F(this,AT,null),F(this,NT,null),F(this,MT,null),F(this,FT,null),F(this,CT,!1),F(this,OT,!1),F(this,PT,!1),F(this,RT,!1),F(this,DT,void 0),F(this,LT,null),F(this,BT,null),F(this,zT,!1),F(this,WT,!1),F(this,$T,null),F(this,jT,!1)}get name(){return"FMP4Demuxer"}get defaults(){return{}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"pushChunk","endOfStream"])}pushChunk(e,t={}){if(M(PT,this)||M(RT,this))return;const n=e instanceof Uint8Array?e:new Uint8Array(e),i=!!t.isInit;C(LT,this,A(UT,this,YT).call(this,n,t,i)),i&&(C(DT,this,n),C(BT,this,null),this.trigger("demux:init",{data:n})),A(UT,this,XT).call(this);try{var r;const e=null===(r=M(AT,this))||void 0===r?void 0:r.write(n);e&&"function"==typeof e.catch&&e.catch((e=>{A(UT,this,QT).call(this,e)}))}catch(e){if(M(PT,this)||A(UT,this,VT).call(this,e))return;return this.log.warn("[FMP4Demuxer] mediabunny demux failed",e),void A(UT,this,QT).call(this,e)}const o=A(UT,this,eI).call(this);o&&"function"==typeof o.catch&&o.catch((e=>{A(UT,this,QT).call(this,e)}))}endOfStream(){if(M(RT,this))return;if(M(zT,this))return;let e;C(zT,this,!0),C(WT,this,!1),C(jT,this,!1);try{var t;e=null===(t=M(AT,this))||void 0===t?void 0:t.close()}catch(t){e=Promise.resolve()}let n=!1;A(UT,this,HT).call(this),C($T,this,setTimeout((()=>{C($T,this,null),n||M(WT,this)||M(RT,this)||A(UT,this,KT).call(this)}),20)),Promise.resolve(e).catch((()=>{})).finally((()=>{n=!0,A(UT,this,HT).call(this),A(UT,this,KT).call(this)}))}onDispose(){super.onDispose(),C(RT,this,!0);try{var e,t;null===(e=M(MT,this))||void 0===e||null===(t=e.close)||void 0===t||t.call(e)}catch(e){}this.endOfStream();try{var n,i;null===(n=M(NT,this))||void 0===n||null===(i=n.dispose)||void 0===i||i.call(n)}catch(e){}C(MT,this,null),C(NT,this,null),C(PT,this,!1),C(LT,this,null),C(FT,this,null),C(CT,this,!1),C(OT,this,!1),C(zT,this,!1),C(WT,this,!1),C(jT,this,!1),A(UT,this,HT).call(this)}}function VT(e){return!!M(RT,this)&&(!e||("InputDisposedError"===(null==e?void 0:e.name)||("string"==typeof(null==e?void 0:e.message)?e.message:"").includes("Input has been disposed")))}function GT(){try{var e,t;const n=null===(e=M(AT,this))||void 0===e||null===(t=e.close)||void 0===t?void 0:t.call(e);n&&"function"==typeof n.catch&&n.catch((()=>{}))}catch(e){}C(AT,this,null)}function HT(){null!==M($T,this)&&(clearTimeout(M($T,this)),C($T,this,null))}function KT(){if(M(WT,this)||M(RT,this)||M(PT,this))return;if(C(WT,this,!0),M(OT,this))return void C(jT,this,!0);C(jT,this,!1);const e=A(UT,this,eI).call(this);e&&"function"==typeof e.catch&&e.catch((e=>{A(UT,this,QT).call(this,e)}))}function XT(){if(M(NT,this)&&M(AT,this))return;const e=ld.TransformStream;if(void 0===e)throw new Error("TransformStream is not available in this environment");const{readable:t,writable:n}=new e;C(AT,this,n.getWriter()),C(NT,this,new hT({source:new dT(t),formats:[cT]})),C(CT,this,!1)}function YT(e,t,n){const i={isInit:n,byteLength:(null==e?void 0:e.byteLength)||0};return"number"==typeof t.loaded&&(i.loaded=t.loaded),"number"==typeof t.total&&(i.total=t.total),"number"==typeof t.pts&&(i.pts=t.pts),"number"==typeof t.dts&&(i.dts=t.dts),"number"==typeof t.duration&&(i.duration=t.duration),"boolean"==typeof t.isKey&&(i.isKey=t.isKey),i}function QT(e){if(M(PT,this)||A(UT,this,VT).call(this,e))return;if(A(UT,this,ZT).call(this,e))return void C(CT,this,!1);C(PT,this,!0),A(UT,this,GT).call(this);try{var t,n;null===(t=M(MT,this))||void 0===t||null===(n=t.close)||void 0===n||n.call(t)}catch(e){}C(MT,this,null);try{var i,r;null===(i=M(NT,this))||void 0===i||null===(r=i.dispose)||void 0===r||r.call(i)}catch(e){}C(NT,this,null);const o={error:e,recoverable:!1,severity:"fatal",streamClosed:M(zT,this),streamFinalized:M(WT,this)};M(LT,this)&&(o.context={...M(LT,this)}),this.trigger("demux:error",o)}function JT(e){if(!e)return!1;const t="string"==typeof(null==e?void 0:e.message)?e.message:"";return!!t&&(t.includes("unsupported or unrecognizable format")||t.includes("No supported tracks found"))}function ZT(e){return!!A(UT,this,JT).call(this,e)&&(!M(WT,this)||M(jT,this))}async function eI(){if(!(M(RT,this)||M(PT,this)||M(CT,this)||M(OT,this))){C(OT,this,!0);try{A(UT,this,XT).call(this);const e=await M(NT,this).getPrimaryVideoTrack(),t=e?null:await M(NT,this).getPrimaryAudioTrack(),n=e||t;if(!n)throw new Error("No supported tracks found in MP4");const i=await n.getDecoderConfig(),r=await n.getCodecParameterString(),o=await M(NT,this).getMimeType();this.trigger("demux:init",{...M(DT,this)?{data:M(DT,this)}:{},decoderConfig:i,codec:r,mimeType:o}),C(MT,this,new W_(n)),C(CT,this,!0),C(FT,this,(async()=>{try{for await(const e of M(MT,this).packets()){if(M(RT,this))break;const t="number"==typeof e.timestamp?e.timestamp:0;null===M(BT,this)&&C(BT,this,t);let n=t-M(BT,this);n<0&&(n=0),this.trigger("demux:sample",{data:e.data,pts:n,dts:n,duration:e.duration,isKey:"key"===e.type})}this.trigger("demux:complete")}catch(e){A(UT,this,QT).call(this,e)}})())}catch(e){if(A(UT,this,ZT).call(this,e))return;throw e}finally{C(OT,this,!1),!M(jT,this)||M(PT,this)||M(RT,this)||A(UT,this,KT).call(this)}}}const tI=1e6,nI=24e3/1001,iI={primaries:"bt709",transfer:"bt709",matrix:"bt709",fullRange:!0},rI=new Uint8Array;function oI(e){return e?e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):rI:rI}let sI=null;const aI={video:(ut=new WeakMap,dt=new WeakMap,ht=new WeakMap,ft=new WeakMap,pt=new WeakMap,mt=new WeakMap,vt=new WeakMap,gt=new WeakMap,yt=new WeakMap,bt=new WeakMap,kt=new WeakMap,wt=new WeakMap,xt=new WeakMap,_t=new WeakMap,Tt=new WeakMap,It=new WeakMap,Et=new WeakMap,St=new WeakMap,At=new WeakMap,Nt=new WeakMap,Mt=new WeakMap,Ft=new WeakMap,Ct=new WeakMap,Ot=new WeakMap,Pt=new WeakMap,Rt=new WeakMap,Dt=new WeakMap,Lt=new WeakMap,Bt=new WeakMap,zt=new WeakMap,Wt=new WeakMap,$t=new WeakMap,jt=new WeakMap,Ut=new WeakMap,qt=new WeakSet,class extends Dx{get name(){return"WebCodecsSegmentDecoder"}get defaults(){return{decodedHorizonSeconds:1,maxDecodedFrames:24,maxDecodeQueueSize:4,av1ColorSpaceOverrideEnabled:!0,convertFramesToBitmapsOnAndroid:!0,androidFixEndOfSegmentDelta:.2}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"decodeChunk"])}constructor(...e){super(...e),O(this,qt),F(this,ut,void 0),F(this,dt,[]),F(this,ht,void 0),F(this,ft,void 0),F(this,pt,void 0),F(this,mt,void 0),F(this,vt,[]),F(this,gt,void 0),F(this,yt,new Map),F(this,bt,!0),F(this,kt,!1),F(this,wt,!1),F(this,xt,!1),F(this,_t,void 0),F(this,Tt,!1),F(this,It,!1),F(this,Et,0),F(this,St,void 0),F(this,At,void 0),F(this,Nt,{}),F(this,Mt,void 0),F(this,Ft,0),F(this,Ct,null),F(this,Ot,!1),F(this,Pt,null),F(this,Rt,void 0),F(this,Dt,0),F(this,Lt,0),F(this,Bt,0),F(this,zt,0),F(this,Wt,!1),F(this,$t,!1),F(this,jt,.2),F(this,Ut,Promise.resolve()),C(ht,this,this.settings.decodedHorizonSeconds||1),C(ft,this,A(qt,this,JI).call(this,this.settings.maxDecodedFrames)),C(pt,this,A(qt,this,eE).call(this,this.settings.maxDecodeQueueSize)),C(Wt,this,Xm()),C($t,this,A(qt,this,qI).call(this,this.settings.convertFramesToBitmapsOnAndroid)),C(jt,this,A(qt,this,VI).call(this,this.settings.androidFixEndOfSegmentDelta)),C(mt,this,(()=>0)),C(gt,this,(()=>A(qt,this,PI).call(this)));const t=this.settings.demuxerOptions?{FMP4Demuxer:this.settings.demuxerOptions}:{};C(ut,this,new qT(t)),M(ut,this).on("demux:init",(e=>A(qt,this,TI).call(this,e))),M(ut,this).on("demux:sample",(e=>A(qt,this,II).call(this,e))),M(ut,this).on("demux:complete",(()=>A(qt,this,EI).call(this))),M(ut,this).on("demux:error",(e=>A(qt,this,fI).call(this,e)))}setCurrentTimeProvider(e){"function"==typeof e&&C(mt,this,e)}setTimeOffsetSeconds(e){const t=Number(e);C(Ft,this,Number.isFinite(t)?t:0)}setSeekTargetTimeSeconds(e){const t=Number(e);C(Ct,this,Number.isFinite(t)?t:null),C(Ot,this,!1),C(Pt,this,null)}endOfStream(){M(ut,this)&&"function"==typeof M(ut,this).endOfStream&&M(ut,this).endOfStream()}configure(e){super.configure(e),C(Nt,this,{codec:A(qt,this,oE).call(this,e),width:(null==e?void 0:e.codedWidth)||(null==e?void 0:e.width),height:(null==e?void 0:e.codedHeight)||(null==e?void 0:e.height)}),C(St,this,M(Nt,this).codec)}setSegment(e){this.lastSegment=e,A(qt,this,kI).call(this)}setNodeId(e){C(Rt,this,e)}decode(e){this.setSegment(e);const t=null==e?void 0:e.arrayBuffer;t&&M(ut,this).pushChunk(t,{isInit:!(null==e||!e.isInit)})}async decodeChunk(e,t={}){await M(ut,this).pushChunk(e,{isInit:!!t.isInit,pts:"number"==typeof t.pts?t.pts:void 0,dts:"number"==typeof t.dts?t.dts:void 0,duration:"number"==typeof t.duration?t.duration:void 0,isKey:!!t.isKey,loaded:"number"==typeof t.loaded?t.loaded:void 0,total:"number"==typeof t.total?t.total:void 0})}get decodedFrames(){return M(dt,this).slice()}onDispose(){if(super.onDispose(),A(qt,this,LI).call(this),M(ut,this)&&"function"==typeof M(ut,this).dispose&&M(ut,this).dispose(),C(dt,this,[]),C(vt,this,[]),M(yt,this).clear(),C(Pt,this,null),M(_t,this)&&"function"==typeof M(_t,this).close)try{M(_t,this).close()}catch(e){}C(_t,this,null),C(Tt,this,!1),C(At,this,null),C(St,this,null),C(Rt,this,null),C(Ut,this,Promise.resolve()),A(qt,this,kI).call(this)}}),audio:(Vt=new WeakMap,Gt=new WeakMap,Ht=new WeakMap,Kt=new WeakMap,Xt=new WeakMap,Yt=new WeakMap,Qt=new WeakMap,Jt=new WeakSet,class extends Dx{constructor(...e){super(...e),O(this,Jt),F(this,Vt,void 0),F(this,Gt,[]),F(this,Ht,0),F(this,Kt,!1),F(this,Xt,!1),F(this,Yt,void 0),F(this,Qt,0)}get name(){return"WebAudioDecoder"}setSegment(e){C(Yt,this,e)}setTimeOffsetSeconds(e){const t=Number(e);C(Qt,this,Number.isFinite(t)?t:0)}decode(e){if(this.lastSegment=e,!e)return;if(e.isInit)return void C(Vt,this,oI(e.arrayBuffer));const t=e.arrayBuffer;t&&A(Jt,this,uI).call(this,oI(t),!0)}decodeChunk(e,t={}){if(!e)return;if(t.isInit)return void C(Vt,this,oI(e));const n=oI(e);if(!n.length)return;M(Gt,this).push(n),C(Ht,this,M(Ht,this)+n.length);const i=Number(t.loaded),r=Number(t.total);Number.isFinite(i)&&Number.isFinite(r)&&r>0&&i>=r&&A(Jt,this,lI).call(this)}endOfStream(){A(Jt,this,lI).call(this)}onDispose(){super.onDispose(),C(Vt,this,void 0),C(Gt,this,[]),C(Ht,this,0),C(Kt,this,!1),C(Xt,this,!1),C(Yt,this,void 0)}}),image:class extends Dx{#z;#W=0;#$=[];#j=0;#U;get name(){return"ImageDecoder"}setSegment(e){this.#z=e}setTimeOffsetSeconds(e){const t=Number(e);this.#W=Number.isFinite(t)?t:0}decode(e){super.decode(e),e&&(this.#z=e);const t=null==e?void 0:e.arrayBuffer;t instanceof ArrayBuffer&&(this.#$=[new Uint8Array(t)],this.#j=t.byteLength,this.endOfStream())}decodeChunk(e,t={}){if(null!=t&&t.isInit)return;const n=function(e){if(e)return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):ArrayBuffer.isView(e)&&e.buffer?new Uint8Array(e.buffer):void 0}(e);n&&n.length&&(this.#$.push(n),this.#j+=n.length)}async endOfStream(){var e,t,n;if(this.#U)return;if(!(this.#$.length&&this.#j>0))return;const i=new Uint8Array(this.#j);let r=0;for(let e=0;e<this.#$.length;e+=1){const t=this.#$[e];i.set(t,r),r+=t.length}const o=null===(e=this.#z)||void 0===e?void 0:e.chosenRepresentation,s=(null==o?void 0:o.mime)||(null===(t=this.track)||void 0===t?void 0:t.mimeType)||(null===(n=this.track)||void 0===n?void 0:n.mime)||function(e){if(e instanceof Uint8Array&&!(e.byteLength<4))return e.byteLength>=8&&137===e[0]&&80===e[1]&&78===e[2]&&71===e[3]&&13===e[4]&&10===e[5]&&26===e[6]&&10===e[7]?"image/png":255===e[0]&&216===e[1]&&255===e[2]?"image/jpeg":e.byteLength>=6&&71===e[0]&&73===e[1]&&70===e[2]&&56===e[3]?"image/gif":e.byteLength>=12&&82===e[0]&&73===e[1]&&70===e[2]&&70===e[3]&&87===e[8]&&69===e[9]&&66===e[10]&&80===e[11]?"image/webp":void 0}(i);try{var a,l;const e=await async function(e,t){const n=function(e,t){if(!(e&&e.byteLength>0))return;if("function"!=typeof ld.Blob)return;const n="string"==typeof t?t:"";return new ld.Blob([e],n?{type:n}:void 0)}(e,t);if(!n)throw new Error("Image decode requires Blob support");let i;if("function"==typeof ld.Image&&ld.URL&&"function"==typeof ld.URL.createObjectURL&&"function"==typeof ld.URL.revokeObjectURL){const e=ld.URL.createObjectURL(n);try{const t=new ld.Image;return await new Promise(((n,i)=>{t.onload=()=>n(),t.onerror=e=>i(e||new Error("Image decode failed")),t.src=e})),t}catch(e){i=e}finally{ld.URL.revokeObjectURL(e)}}if("function"==typeof ld.createImageBitmap)try{return ld.createImageBitmap(n)}catch(e){i=e}if(i)throw i;throw new Error("No supported image decode mechanism")}(i,s);this.#U=e;const t=function(e){if(!e)return;const t=[[e.naturalWidth,e.naturalHeight],[e.width,e.height],[e.displayWidth,e.displayHeight],[e.videoWidth,e.videoHeight],[e.codedWidth,e.codedHeight]];for(let e=0;e<t.length;e+=1){const[n,i]=t[e],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}(e);t&&o&&(Og(o.width)||(o.width=t.width),Og(o.height)||(o.height=t.height)),this.trigger("decoder:frame",{pts:this.#W,duration:Og(null===(a=this.#z)||void 0===a?void 0:a.duration)?this.#z.duration:null===(l=this.track)||void 0===l?void 0:l.duration,frame:e})}catch(e){this.trigger("decoder:error",{error:e})}}onDispose(){if(super.onDispose(),this.#U&&"function"==typeof this.#U.close)try{this.#U.close()}catch(e){}this.#U=null,this.#$=[],this.#j=0,this.#z=null}}};function lI(){if(M(Kt,this)||M(Xt,this))return;if(!M(Ht,this))return;const e=A(Jt,this,cI).call(this);e.length&&A(Jt,this,uI).call(this,e,!1)}function cI(){const e=M(Vt,this),t=e?e.length:0,n=t+M(Ht,this);if(!n)return rI;const i=new Uint8Array(n);let r=0;t&&(i.set(e,r),r+=t);for(let e=0;e<M(Gt,this).length;e+=1){const t=M(Gt,this)[e];t&&t.length&&(i.set(t,r),r+=t.length)}return i}function uI(e,t){if(M(Kt,this)||M(Xt,this))return;const n=t?A(Jt,this,dI).call(this,e):e;if(!n||!n.length)return;const i=function(){if(sI)return sI;const e=ld.AudioContext||ld.webkitAudioContext;return e?(sI=new e,sI):null}();if(!i||"function"!=typeof i.decodeAudioData)return void this.trigger("decoder:error",{error:new Error("AudioContext is not available")});const r=n.buffer.slice(0);C(Xt,this,!0),new Promise(((e,t)=>{const n=i.decodeAudioData(r,e,t);n&&"function"==typeof n.then&&n.then(e).catch(t)})).then((e=>{var t;C(Kt,this,!0);const n=Number.isFinite(null==e?void 0:e.duration)?e.duration:Number(null===(t=M(Yt,this))||void 0===t?void 0:t.duration)||void 0;this.trigger("decoder:audio",{audioBuffer:e,pts:M(Qt,this),duration:n})})).catch((e=>{this.trigger("decoder:error",{error:e})})).finally((()=>{C(Gt,this,[]),C(Ht,this,0),C(Xt,this,!1)}))}function dI(e){const t=M(Vt,this);if(!t||!t.length)return e;const n=t.length+e.length,i=new Uint8Array(n);return i.set(t,0),i.set(e,t.length),i}function hI(e,t){var n,i,r,o,s;const a=null!=e&&e.context&&"object"==typeof e.context?e.context:void 0;return{error:t,errorName:null==t?void 0:t.name,errorMessage:"string"==typeof(null==t?void 0:t.message)?t.message:void 0,nodeId:M(Rt,this),trackId:null===(n=this.track)||void 0===n?void 0:n.id,trackType:null===(i=this.track)||void 0===i?void 0:i.type,codec:(null===(r=M(Nt,this))||void 0===r?void 0:r.codec)||M(St,this),segmentId:null===(o=this.lastSegment)||void 0===o?void 0:o.id,segmentIsInit:!(null===(s=this.lastSegment)||void 0===s||!s.isInit),chunkContext:a}}function fI(e){const t=(null==e?void 0:e.error)||e,n=A(qt,this,hI).call(this,e,t);if(A(qt,this,pI).call(this,e,t))return this.log.warn("[onDemuxError] recoverable demux error",n),void A(qt,this,EI).call(this);const i=A(qt,this,_I).call(this,e),r=A(qt,this,mI).call(this,i);if(i&&0===i.missingFrames)return this.log.warn(`[onDemuxError] ignoring demux error (no missing frames)${r}`,{...n,missingFrameStats:i}),void A(qt,this,EI).call(this);let o=n;i&&(o={...n,missingFrameStats:i}),this.log.warn(`[onDemuxError] demux error${r}`,o),this.trigger("decoder:error",e)}function pI(e,t){if("boolean"==typeof(null==e?void 0:e.recoverable))return e.recoverable;const n="string"==typeof(null==e?void 0:e.severity)?e.severity:"";if(n)return"recoverable"===n||"transient"===n;const i="string"==typeof(null==t?void 0:t.message)?t.message:"";return!!i&&(i.includes("unsupported or unrecognizable format")||i.includes("No supported tracks found"))}function mI(e){return e?` expectedFrames=${A(qt,this,vI).call(this,e.expectedFrames)} demuxedFrames=${A(qt,this,vI).call(this,e.demuxedFrames)} missingFrames=${A(qt,this,vI).call(this,e.missingFrames)}`:""}function vI(e){if(null==e)return"unknown";const t=Number(e);return Number.isFinite(t)?String(t):"unknown"}function gI(e,t={}){return{expectedFrames:null,demuxedFrames:M(Dt,this),missingFrames:null,reason:e,...t}}function yI(e){const t=Number(e);return Number.isFinite(t)?t:null}function bI(e){var t,n;const i=(null==e?void 0:e.context)||{},r=Number(i.loaded),o=Number(i.total);if(!Number.isFinite(o)||o<=0||!Number.isFinite(r)||r<o)return null;if(null!==(t=this.lastSegment)&&void 0!==t&&t.isInit)return null;const s=Number(null===(n=this.lastSegment)||void 0===n?void 0:n.duration);if(!Number.isFinite(s)||s<=0)return A(qt,this,gI).call(this,"segment_duration_unavailable",{segmentDurationSeconds:A(qt,this,yI).call(this,s),demuxedCoverageSeconds:M(zt,this),frameDurationSeconds:null});const a=A(qt,this,xI).call(this);if(!Number.isFinite(a)||a<=0){const e=Math.max(1,Math.round(s*nI));return{expectedFrames:e,demuxedFrames:M(Dt,this),missingFrames:Math.max(0,e-M(Dt,this)),reason:"fallback_fps",fallbackFps:nI,segmentDurationSeconds:s,demuxedCoverageSeconds:M(zt,this),frameDurationSeconds:A(qt,this,yI).call(this,a)}}const l=Math.min(.5*a,.02),c=Math.max(0,s-M(zt,this)),u=c<=l?0:c,d=Math.max(1,Math.floor((s+l)/a)),h=Math.max(0,d-M(Dt,this)),f=u>0?Math.ceil(u/a):0;return{expectedFrames:d,demuxedFrames:M(Dt,this),missingFrames:Math.max(h,f),segmentDurationSeconds:s,demuxedCoverageSeconds:M(zt,this),frameDurationSeconds:a}}function kI(){C(Dt,this,0),C(Lt,this,0),C(Bt,this,0),C(zt,this,0)}function wI(e){C(Dt,this,M(Dt,this)+1);const t=Number(null==e?void 0:e.pts),n=Number(null==e?void 0:e.duration);if(Number.isFinite(n)&&n>0&&(C(Lt,this,M(Lt,this)+n),C(Bt,this,M(Bt,this)+1)),!Number.isFinite(t))return;const i=Number.isFinite(n)&&n>0?t+n:t;Number.isFinite(i)&&i>M(zt,this)&&C(zt,this,i)}function xI(){return M(Bt,this)>0?M(Lt,this)/M(Bt,this):M(Dt,this)>0&&M(zt,this)>0?M(zt,this)/M(Dt,this):null}function _I(e){return A(qt,this,bI).call(this,e)}function TI(e){(null==e?void 0:e.data)instanceof Uint8Array&&(C(At,this,e.data.buffer),A(qt,this,zI).call(this)),null!=e&&e.decoderConfig&&(C(Mt,this,e.decoderConfig),C(St,this,e.decoderConfig.codec||M(St,this)),A(qt,this,zI).call(this)),this.trigger("decoder:init",e)}function II(e){A(qt,this,wI).call(this,e),M(vt,this).push(e),A(qt,this,PI).call(this)}function EI(){C(kt,this,!0),A(qt,this,$I).call(this)}function SI(e){const t="number"==typeof(null==e?void 0:e.pts)?e.pts:void 0;if(Number.isFinite(t))return M(Ft,this)+t}function AI(e){return M(vt,this).some((t=>{const n=A(qt,this,SI).call(this,t);return Number.isFinite(n)&&n>=e}))}function NI(e){let t=-1,n=null;for(let i=0;i<M(vt,this).length;i+=1){const r=M(vt,this)[i],o=A(qt,this,SI).call(this,r);Number.isFinite(o)&&(null==r?void 0:r.isKey)&&o<=e&&(t=i,n=o)}return{chosenIndex:t,chosenPtsSeconds:n}}function MI(e){let t=-1,n=null;for(let i=0;i<M(vt,this).length;i+=1){const r=M(vt,this)[i],o=A(qt,this,SI).call(this,r);if(Number.isFinite(o)&&null!=r&&r.isKey&&(t=i,n=o,o>=e))break}return{chosenIndex:t,chosenPtsSeconds:n}}function FI(e){const t=e+M(ht,this),n=M(Ct,this);if(!Number.isFinite(n))return t;const i=Number.isFinite(M(Pt,this))?M(Pt,this):null;if(Number.isFinite(i))return Math.max(t,i);const{chosenPtsSeconds:r}=A(qt,this,MI).call(this,n);return Number.isFinite(r)?Math.max(t,r):t}function CI(e){const t=M(Ct,this);Number.isFinite(t)&&Number.isFinite(e)&&e>=t&&(C(Ct,this,null),C(Pt,this,null))}function OI(){const e=M(Ct,this);if(!Number.isFinite(e)||M(Ot,this))return!0;if(!A(qt,this,AI).call(this,e)&&!M(kt,this))return!1;const t=A(qt,this,NI).call(this,e);let n=t;if(-1===t.chosenIndex&&(n=A(qt,this,MI).call(this,e)),n.chosenIndex>0){const e=`[#maybeAlignToSeekKeyframe] Dropping ${n.chosenIndex} samples before keyframe @ ${n.chosenPtsSeconds}`;this.log.debug(e),M(vt,this).splice(0,n.chosenIndex)}return C(bt,this,!0),Number.isFinite(n.chosenPtsSeconds)&&C(Pt,this,n.chosenPtsSeconds),C(Ot,this,!0),!0}function PI(){const e=M(mt,this)?M(mt,this).call(this):0,t=A(qt,this,FI).call(this,e);if(A(qt,this,YI).call(this,e),A(qt,this,QI).call(this),!A(qt,this,OI).call(this))return void A(qt,this,DI).call(this);const n=void 0!==ld.VideoDecoder&&void 0!==ld.EncodedVideoChunk;for(n&&!M(Tt,this)&&M(Mt,this)&&A(qt,this,zI).call(this);M(vt,this).length&&!A(qt,this,ZI).call(this)&&!(n&&M(_t,this)&&A(qt,this,tE).call(this));){const e=M(vt,this)[0],i="number"==typeof(null==e?void 0:e.pts)?e.pts:0,r=M(Ft,this)+i;if(r>t)break;if(null!=e&&e.raw)M(vt,this).shift(),A(qt,this,RI).call(this,e);else{if(n){if(!M(Tt,this)||!M(_t,this))break;if(M(bt,this)&&!e.isKey){M(vt,this).shift();continue}M(vt,this).shift();const t=Math.max(0,Math.round(r*tI));M(yt,this).set(t,!!e.isKey);try{const n=new ld.EncodedVideoChunk({type:e.isKey?"key":"delta",timestamp:t,duration:e.duration?Math.round(e.duration*tI):void 0,data:e.data instanceof Uint8Array?e.data:new Uint8Array(e.data)});M(_t,this).decode(n),e.isKey&&C(bt,this,!1);continue}catch(e){M(yt,this).delete(t);const n="string"==typeof(null==e?void 0:e.message)?e.message:"";if("DataError"===(null==e?void 0:e.name)&&n.includes("key frame")){C(bt,this,!0);continue}this.log.warn("[#drainDecodeQueue] decode failed, falling back to placeholder",e)}}M(vt,this).shift(),A(qt,this,RI).call(this,e)}}A(qt,this,$I).call(this),A(qt,this,DI).call(this)}function RI(e){const t=M(mt,this)?M(mt,this).call(this):0,n=A(qt,this,FI).call(this,t),i=M(Ft,this)+("number"==typeof e.pts?e.pts:0);if(i<t||i>n)return;A(qt,this,YI).call(this,t);const r={pts:i,duration:e.duration,data:e.data,isKey:e.isKey};M(dt,this).push(r),A(qt,this,QI).call(this),this.trigger("decoder:frame",r),A(qt,this,CI).call(this,i)}function DI(){if(M(vt,this).length>0&&void 0!==ld.VideoDecoder){if(qk(M(gt,this)))return;jk(M(gt,this),50)}else A(qt,this,LI).call(this)}function LI(){M(gt,this)&&qk(M(gt,this))&&Uk(M(gt,this))}function BI(){return null!=ld&&ld.performance&&"function"==typeof ld.performance.now?ld.performance.now():Date.now()}function zI(){if(M(Tt,this))return;if(void 0===ld.VideoDecoder)return;if(!M(Mt,this))return;if(M(It,this)&&A(qt,this,BI).call(this)<M(Et,this))return;const e=A(qt,this,WI).call(this);try{C(_t,this,new ld.VideoDecoder({output:e=>A(qt,this,UI).call(this,e),error:e=>A(qt,this,jI).call(this,e)})),M(_t,this).configure(e),C(Tt,this,!0),C(bt,this,!0),C(It,this,!1),C(Et,this,0),A(qt,this,PI).call(this)}catch(e){this.log.warn("[#maybeConfigureDecoder] configure failed, falling back to placeholder decode",e),C(_t,this,null),C(Tt,this,!1),C(Mt,this,null)}}function WI(){const e={...M(Mt,this)};return A(qt,this,iE).call(this,e)&&M(Nt,this).codec?e.codec=M(Nt,this).codec:!e.codec&&M(St,this)&&(e.codec=M(St,this)),M(At,this)&&!e.description&&(e.description=M(At,this)),M(Nt,this).width&&!e.codedWidth&&(e.codedWidth=M(Nt,this).width),M(Nt,this).height&&!e.codedHeight&&(e.codedHeight=M(Nt,this).height),A(qt,this,rE).call(this,e),e}function $I(){void 0!==ld.VideoDecoder&&void 0!==ld.EncodedVideoChunk&&(M(It,this)||!M(kt,this)||M(xt,this)||M(wt,this)||M(Tt,this)&&M(_t,this)&&"function"==typeof M(_t,this).flush&&(M(vt,this).length||(C(wt,this,!0),Promise.resolve().then((()=>M(_t,this).flush())).then((()=>{C(xt,this,!0),C(bt,this,!0)})).catch((e=>{"AbortError"!==(null==e?void 0:e.name)&&this.log.warn("[#maybeFlushDecoder] flush failed",e)})).finally((()=>{C(wt,this,!1)})))))}function jI(e){if(this.log.warn("[#handleDecoderError] decoder error",e),this.trigger("decoder:error",{error:e}),M(_t,this)&&"function"==typeof M(_t,this).close)try{M(_t,this).close()}catch(e){}C(_t,this,null),C(Tt,this,!1),C(wt,this,!1),C(xt,this,!1),C(bt,this,!0),M(yt,this).clear(),C(It,this,!0),C(Et,this,A(qt,this,BI).call(this)+1e3)}function UI(e){C(Ut,this,M(Ut,this).then((()=>{var t;if(!this._disposed)return A(qt,this,XI).call(this,e);null===(t=e.close)||void 0===t||t.call(e)})).catch((t=>{this.log.warn("[#enqueueDecodedFrame] failed processing decoded frame",t);try{var n;null===(n=e.close)||void 0===n||n.call(e)}catch(e){}})))}function qI(e){return"boolean"!=typeof e||e}function VI(e){const t=Number(e);return!Number.isFinite(t)||t<0?.2:t}function GI(){return!!M($t,this)&&"function"==typeof ld.createImageBitmap&&M(Wt,this)}function HI(e){var t;const n=Number(null===(t=this.lastSegment)||void 0===t?void 0:t.duration);if(!Number.isFinite(n)||n<=0)return!1;if(!Number.isFinite(e))return!1;const i=Number(M(Ft,this));return!!Number.isFinite(i)&&e>=i+n-M(jt,this)}async function KI(e,t){try{var n;const i=A(qt,this,HI).call(this,t),r=await ld.createImageBitmap(e,{premultiplyAlpha:i?"none":"default"});return null!==(n=e.close)&&void 0!==n&&n.call(e),r}catch(t){return this.log.debug("[#maybeConvertFrameToBitmap] createImageBitmap failed",t),e}}async function XI(e){var t,n;let i=e;if(this._disposed)return void(null===(t=(n=i).close)||void 0===t||t.call(n));const r="number"==typeof e.timestamp?e.timestamp:void 0,o="number"==typeof e.timestamp?e.timestamp/tI:M(mt,this)?M(mt,this).call(this):0,s="number"==typeof e.duration?e.duration/tI:void 0;let a;void 0!==r&&(a=M(yt,this).get(r),M(yt,this).delete(r));try{var l,c,u,d;let t=M(mt,this)?M(mt,this).call(this):0,n=A(qt,this,FI).call(this,t);if(o<t||o>n)return void(null===(l=(c=i).close)||void 0===l||l.call(c));if(A(qt,this,GI).call(this)){var h,f,p,m;if(i=await A(qt,this,KI).call(this,e,o),this._disposed)return void(null===(h=(f=i).close)||void 0===h||h.call(f));if(t=M(mt,this)?M(mt,this).call(this):0,n=A(qt,this,FI).call(this,t),o<t||o>n)return void(null===(p=(m=i).close)||void 0===p||p.call(m))}if(A(qt,this,YI).call(this,t),this._disposed)return void(null===(u=(d=i).close)||void 0===u||u.call(d));const r={frame:i,pts:o,duration:s,isKey:void 0!==a&&a};M(dt,this).push(r),A(qt,this,QI).call(this),this.trigger("decoder:frame",r),A(qt,this,CI).call(this,o),this.log.debug(`[#handleDecodedFrame] [${M(Nt,this).codec}] Decoded frame:`,r)}catch(e){this.log.warn(`[#handleDecodedFrame] [${M(Nt,this).codec}] Failed to handle decoded frame`,e);try{var v,g;null===(v=(g=i).close)||void 0===v||v.call(g)}catch(e){}}}function YI(e){const t=A(qt,this,FI).call(this,e),n=[];M(dt,this).forEach((i=>{var r;const o=null!==(r=null==i?void 0:i.pts)&&void 0!==r?r:0;o<e||o>t||n.push(i)})),C(dt,this,n)}function QI(){const e=M(ft,this);if(!Number.isFinite(e)||e<=0)return;if(M(dt,this).length<=e)return;const t=M(dt,this).length-e;M(dt,this).splice(0,t)}function JI(e){const t=Number(e);return!Number.isFinite(t)||t<=0?0:Math.floor(t)}function ZI(){const e=M(ft,this);return!(!Number.isFinite(e)||e<=0)&&M(dt,this).length>=e}function eE(e){const t=Number(e);return!Number.isFinite(t)||t<=0?0:Math.floor(t)}function tE(){var e;const t=M(pt,this);if(!Number.isFinite(t)||t<=0)return!1;const n=Number(null===(e=M(_t,this))||void 0===e?void 0:e.decodeQueueSize);return!!Number.isFinite(n)&&n>=t}function nE(e){return"string"==typeof e&&e.toLowerCase().startsWith("av01")}function iE(e){var t;return!1!==this.settings.av1ColorSpaceOverrideEnabled&&A(qt,this,nE).call(this,(null===(t=M(Nt,this))||void 0===t?void 0:t.codec)||(null==e?void 0:e.codec))}function rE(e){A(qt,this,iE).call(this,e)&&(e.colorSpace={...iI})}function oE(e){if(e&&Array.isArray(e.segments))for(let t=0;t<e.segments.length;t+=1){const n=e.segments[t];if(!Array.isArray(null==n?void 0:n.representations))continue;const i=n.chosenRepresentation||n.representations[0];if(null!=i&&i.codecs)return i.codecs;if(null!=i&&i.mime)return i.mime}}class sE extends od{#q;get name(){return"DecoderFactory"}constructor(...e){super(...e);const t=e.length?e[e.length-1]:void 0;this.#q=t&&"object"==typeof t&&!Array.isArray(t)?t:{}}create(e,t=this.#q){if(!e||!e.type)return new Dx(t);const n=aI[e.type];return n?(this.log.debug(`[#create] [${e.type}] Creating decoder:`,n),new n(t)):new Dx(t)}}class aE{#V;#G;#H;#K;constructor(e={}){this.#V=e.getActiveRenderPlacement,this.#G=e.getPlacementsActiveAtTime,this.#H=e.ensureDecodedForPlacementAtTime;const t=Number(e.lookaheadSeconds);this.#K=Number.isFinite(t)&&t>=0?t:1}handleTimeUpdate(e={}){const t=Number(null==e?void 0:e.time);if(!Number.isFinite(t))return;if("function"!=typeof this.#H)return;const n="function"==typeof this.#G?this.#G:()=>[],i=n(t),r=new Set;i.forEach((e=>{null!=e&&e.placementId&&r.add(e.placementId),this.#H(e,t)}));const o=this.#K;if(!(o>0))return;const s=t+o;n(s).forEach((e=>{const t=null==e?void 0:e.placementId;t&&!r.has(t)&&this.#H(e,s)}))}dispose(){}}class lE{#X;#Y;#Q;#J;#Z;#ee;constructor(e={}){this.#X=e.getNode,this.#Y=e.getPlacementState,this.#Q=e.getDecodeTracks,this.#J=e.getSegmentIdForTrackAtTime,this.#Z=e.decodeLoadedMediaSegment,this.#ee=e.decodeLoadedMediaSegmentsAfter}ensureDecodedForPlacementAtTime(e,t){if(!e||!Number.isFinite(t))return;const n=null==e?void 0:e.placementId,i=null==e?void 0:e.nodeId;if(!n||!i)return;const r="function"==typeof this.#X?this.#X(i):void 0;if(!r)return;const o="function"==typeof this.#Y?this.#Y(n):void 0,s=null==o?void 0:o.trackStates;s&&"function"==typeof s.get&&("function"==typeof this.#Q?this.#Q(r).filter((e=>"video"===(null==e?void 0:e.type)||"image"===(null==e?void 0:e.type)||"audio"===(null==e?void 0:e.type))):[]).forEach((n=>{var i;const r=s.get(n.id);if(!r)return;const o="function"==typeof this.#J?this.#J(n,e,t):null;if(!o)return;const a=null==n||null===(i=n.segments)||void 0===i?void 0:i.find((e=>(null==e?void 0:e.id)===o));a&&!a.isInit&&a.retainedByteLength>0&&a.arrayBuffer&&(r.segmentDecoders&&"function"==typeof r.segmentDecoders.has&&r.segmentDecoders.has(o)||"function"!=typeof this.#Z||this.#Z(e,n,a),"video"===(null==n?void 0:n.type)&&"function"==typeof this.#ee&&this.#ee(e,n,a))}))}dispose(){}}const cE=new Set(["video","audio","image"]);function uE(e){const t=Number(e);return Number.isFinite(t)?t:0}var dE=new WeakMap,hE=new WeakMap,fE=new WeakMap,pE=new WeakMap,mE=new WeakMap,vE=new WeakMap,gE=new WeakMap,yE=new WeakMap,bE=new WeakMap,kE=new WeakMap,wE=new WeakMap,xE=new WeakMap,_E=new WeakMap,TE=new WeakMap,IE=new WeakMap,EE=new WeakMap,SE=new WeakMap,AE=new WeakMap,NE=new WeakMap,ME=new WeakSet;class FE extends od{constructor(...e){super(...e),O(this,ME),F(this,dE,void 0),F(this,hE,void 0),F(this,fE,void 0),F(this,pE,void 0),F(this,mE,void 0),F(this,vE,void 0),F(this,gE,void 0),F(this,yE,void 0),F(this,bE,void 0),F(this,kE,void 0),F(this,wE,void 0),F(this,xE,new Map),F(this,_E,new Map),F(this,TE,new Map),F(this,IE,new Map),F(this,EE,new Set),F(this,SE,0),F(this,AE,!1),F(this,NE,null);const[t,n,i]=e;C(dE,this,t),C(hE,this,n),C(fE,this,i||new sE),C(pE,this,new lE({getNode:e=>A(ME,this,nS).call(this,e),getPlacementState:e=>M(xE,this).get(e),getDecodeTracks:e=>A(ME,this,QE).call(this,e),getSegmentIdForTrackAtTime:(e,t,n)=>A(ME,this,zE).call(this,e,t,n),decodeLoadedMediaSegment:(e,t,n)=>{A(ME,this,xS).call(this,e,t,n)},decodeLoadedMediaSegmentsAfter:(e,t,n)=>{A(ME,this,pS).call(this,e,t,n)}})),C(mE,this,new aE({getActiveRenderPlacement:e=>{var t,n;return null===(t=M(hE,this))||void 0===t||null===(n=t.getActiveRenderPlacement)||void 0===n?void 0:n.call(t,e)},getPlacementsActiveAtTime:e=>{var t,n;return(null===(t=M(hE,this))||void 0===t||null===(n=t.getPlacementsActiveAtTime)||void 0===n?void 0:n.call(t,e))||[]},ensureDecodedForPlacementAtTime:(e,t)=>{var n,i;null===(n=M(pE,this))||void 0===n||null===(i=n.ensureDecodedForPlacementAtTime)||void 0===i||i.call(n,e,t)}})),A(ME,this,CE).call(this),A(ME,this,KE).call(this)}get name(){return"DecodeCoordinator"}onDispose(){var e,t;M(hE,this)&&"function"==typeof M(hE,this).off&&M(vE,this)&&M(hE,this).off(iv.PLACEMENT_ADDED,M(vE,this)),M(hE,this)&&"function"==typeof M(hE,this).off&&M(gE,this)&&M(hE,this).off(iv.TIMELINE_SEEKING,M(gE,this)),M(hE,this)&&"function"==typeof M(hE,this).off&&M(yE,this)&&M(hE,this).off(iv.TIMELINE_SEEKED,M(yE,this)),M(hE,this)&&"function"==typeof M(hE,this).off&&M(bE,this)&&M(hE,this).off(iv.TIMELINE_TIME_UPDATE,M(bE,this)),M(hE,this)&&"function"==typeof M(hE,this).off&&M(kE,this)&&M(hE,this).off(iv.TIMELINE_RESET,M(kE,this)),A(ME,this,OE).call(this),C(vE,this,null),C(gE,this,null),C(yE,this,null),C(bE,this,null),C(kE,this,null),null!==(e=M(pE,this))&&void 0!==e&&null!==(t=e.dispose)&&void 0!==t&&t.call(e),C(pE,this,null),M(mE,this)&&"function"==typeof M(mE,this).dispose&&M(mE,this).dispose(),C(mE,this,null),M(_E,this).forEach(((e,t)=>{const n=A(ME,this,nS).call(this,t);n&&"function"==typeof n.off&&n.off("node:loaded",e)})),M(_E,this).clear(),M(TE,this).forEach(((e,t)=>{const n=A(ME,this,nS).call(this,t);n&&"function"==typeof n.off&&n.off("segment:chunk",e)})),M(TE,this).clear(),M(IE,this).clear(),M(EE,this).clear(),A(ME,this,qE).call(this),M(xE,this).forEach((({trackStates:e})=>{e&&e.forEach((e=>{A(ME,this,sS).call(this,e)}))})),M(xE,this).clear()}}function CE(){M(hE,this)&&"function"==typeof M(hE,this).on&&(C(vE,this,(e=>{A(ME,this,XE).call(this,e)})),M(hE,this).on(iv.PLACEMENT_ADDED,M(vE,this)),C(gE,this,(e=>A(ME,this,PE).call(this,e))),M(hE,this).on(iv.TIMELINE_SEEKING,M(gE,this)),C(yE,this,(()=>A(ME,this,RE).call(this))),M(hE,this).on(iv.TIMELINE_SEEKED,M(yE,this)),C(bE,this,(e=>A(ME,this,DE).call(this,e))),M(hE,this).on(iv.TIMELINE_TIME_UPDATE,M(bE,this)),C(kE,this,(()=>A(ME,this,LE).call(this))),M(hE,this).on(iv.TIMELINE_RESET,M(kE,this))),(null==ld?void 0:ld.document)&&"function"==typeof ld.document.addEventListener&&(C(wE,this,(()=>{A(ME,this,VE).call(this)})),ld.document.addEventListener("visibilitychange",M(wE,this)))}function OE(){M(wE,this)&&null!=ld&&ld.document&&"function"==typeof ld.document.removeEventListener&&ld.document.removeEventListener("visibilitychange",M(wE,this)),C(wE,this,null)}function PE(e={}){const t=Number(null==e?void 0:e.targetTime);Number.isFinite(t)&&(M(xE,this).forEach((e=>{const n=null==e?void 0:e.trackStates;n&&n.forEach((n=>{var i;const r=null==n||null===(i=n.track)||void 0===i?void 0:i.type;"video"!==r&&"image"!==r&&"audio"!==r||(A(ME,this,BE).call(this,n,null==e?void 0:e.placement,t),n.seekSegmentId=null)}))})),(Array.isArray(null==e?void 0:e.placements)?e.placements:[]).forEach((e=>{const n=null==e?void 0:e.placementId,i=null==e?void 0:e.nodeId;if(!n||!i)return;const r=M(xE,this).get(n);if(!r||!r.trackStates)return;const o=A(ME,this,nS).call(this,i);o&&(r.trackStates.forEach((n=>{const i=null==n?void 0:n.track;!i||"video"!==i.type&&"image"!==i.type&&"audio"!==i.type||A(ME,this,BE).call(this,n,r.placement||e,t)})),A(ME,this,fS).call(this,r.placement||e,o))})))}function RE(){M(xE,this).forEach((e=>{const t=null==e?void 0:e.trackStates;t&&t.forEach((e=>{var t;const n=null==e||null===(t=e.track)||void 0===t?void 0:t.type;"video"!==n&&"image"!==n&&"audio"!==n||(e.seekSegmentId=null)}))}))}function DE(e={}){var t,n;A(ME,this,hS).call(this,null==e?void 0:e.time),null!==(t=M(mE,this))&&void 0!==t&&null!==(n=t.handleTimeUpdate)&&void 0!==n&&n.call(t,e),A(ME,this,VE).call(this),A(ME,this,aS).call(this,null==e?void 0:e.time)}function LE(){M(_E,this).forEach(((e,t)=>{const n=A(ME,this,nS).call(this,t);n&&"function"==typeof n.off&&n.off("node:loaded",e)})),M(_E,this).clear(),M(TE,this).forEach(((e,t)=>{const n=A(ME,this,nS).call(this,t);n&&"function"==typeof n.off&&n.off("segment:chunk",e)})),M(TE,this).clear(),M(IE,this).clear(),M(EE,this).clear(),M(xE,this).forEach((({trackStates:e})=>{e&&e.forEach((e=>{const t=null==e?void 0:e.segmentDecoders;t&&t.forEach((e=>{e&&"function"==typeof e.dispose&&e.dispose()}))}))})),M(xE,this).clear()}function BE(e,t,n){e&&(A(ME,this,sS).call(this,e),e.seekSegmentId=A(ME,this,zE).call(this,e.track,t,n))}function zE(e,t,n){if(!e||!t||!Array.isArray(e.segments))return null;const i=sm(t);if(!Number.isFinite(i))return null;const r=uE(null==t?void 0:t.nodeOffsetOverride),o=Math.max(0,n-i+r),s=uE(null==e?void 0:e.offset),a=Math.max(0,o-s),l="function"==typeof e.getMediaSegmentAtTime?e.getMediaSegmentAtTime(a,{preferRepresentationTime:!0}):Uy(e.segments,a,{preferRepresentationTime:!0});return(null==l?void 0:l.id)||null}function WE(e){if(!e)return!1;const t=null==e?void 0:e.name;if("QuotaExceededError"===t)return!0;if("EncodingError"===t)return!0;const n="string"==typeof(null==e?void 0:e.message)?e.message:"";return!!n.includes("Decoder failure")||!!n.includes("Codec reclaimed due to inactivity")||!("OperationError"!==t||!n.includes("initialize after flush"))}function $E(){const e=null==ld?void 0:ld.document;return!e||"string"!=typeof e.visibilityState||"visible"===e.visibilityState}function jE(){var e;const t=M(hE,this);if(!t||"number"!=typeof t.currentTime)return!1;if(t.state===hv)return!1;const n=Date.now();if(n<M(SE,this))return!1;const i=t.currentTime;if(!Number.isFinite(i))return!1;const r="function"==typeof t.getPlacementsActiveAtTime?t.getPlacementsActiveAtTime(i):[],o=Number(null==t||null===(e=t.settings)||void 0===e?void 0:e.snapToFps),s=Number.isFinite(o)&&o>0?1/o:1/60;let a;if(Array.isArray(r)&&r.length)a=i+s;else if(a=A(ME,this,UE).call(this,i),!Number.isFinite(a))return!1;return C(SE,this,n+1500),this.log.warn("[DecodeCoordinator] attempting decoder recovery seek"),t.currentTime=a,!0}function UE(e){var t;const n=M(hE,this);if(!n)return null;const i=Array.isArray(n.placements)?n.placements:[];if(!i.length)return null;const r=Number(e);if(!Number.isFinite(r))return null;const o=Number(null==n||null===(t=n.settings)||void 0===t?void 0:t.snapToFps),s=Number.isFinite(o)&&o>0?1/o:1/60;let a=Number.NEGATIVE_INFINITY,l=null,c=Number.NEGATIVE_INFINITY,u=null,d=null;return i.forEach((e=>{const t=sm(e);if(!Number.isFinite(t))return;(!Number.isFinite(d)||t<d)&&(d=t);const n=rm(e,M(dE,this)),i=Number.isFinite(n),o=i?t+n:t;(o>t||!i)&&((o>a||!Number.isFinite(a)&&Number.isFinite(o))&&(a=o,l=t),o<=r&&o>c&&(c=o,u=i?Math.max(t,o-s):t))})),Number.isFinite(l)&&Number.isFinite(a)&&r>=a-s?l:Number.isFinite(u)?u:Number.isFinite(d)?d:null}function qE(){C(AE,this,!1),C(NE,this,null)}function VE(){M(AE,this)&&A(ME,this,$E).call(this)&&A(ME,this,jE).call(this)}function GE(e){if(!A(ME,this,WE).call(this,e))return;const t=M(hE,this);t&&"number"==typeof t.currentTime&&(C(AE,this,!0),C(NE,this,e),A(ME,this,$E).call(this)&&A(ME,this,jE).call(this))}function HE(e){var t;return!!e&&(Array.isArray(null===(t=M(hE,this))||void 0===t?void 0:t.placements)?M(hE,this).placements:[]).includes(e)}function KE(e){var t;(Array.isArray(null===(t=M(hE,this))||void 0===t?void 0:t.placements)?[...M(hE,this).placements]:[]).filter((t=>"function"!=typeof e||e(t))).sort(((e,t)=>{const n=sm(e),i=sm(t);return(Number.isFinite(n)?n:Number.POSITIVE_INFINITY)-(Number.isFinite(i)?i:Number.POSITIVE_INFINITY)})).forEach((e=>{A(ME,this,XE).call(this,e)}))}async function XE(e){if(!e||!e.placementId||M(xE,this).has(e.placementId))return;if(!A(ME,this,HE).call(this,e))return;const t=e.nodeId;if(!t||!M(dE,this)||"function"!=typeof M(dE,this).get)return;const n=A(ME,this,nS).call(this,t);if(n){if(n.state&&"ready"!==n.state){if("function"==typeof n.resolve)try{await n.resolve()}catch(n){if(!A(ME,this,HE).call(this,e))return;return void this.log.warn(`[#processPlacement] Failed to resolve node ${t}`,n)}if(!A(ME,this,HE).call(this,e))return;if("ready"!==n.state)return}if(A(ME,this,dS).call(this,e))return A(ME,this,uS).call(this,e,n),void M(EE,this).add(e.placementId);A(ME,this,cS).call(this,e,n)}}function YE(e){return A(ME,this,QE).call(this,e).every((e=>A(ME,this,lS).call(this,e)))}function QE(e){return(Array.isArray(null==e?void 0:e.tracks)?e.tracks:[]).filter((e=>cE.has(null==e?void 0:e.type)))}function JE(e){if(!e||!e.id||"function"!=typeof e.on)return;if(M(_E,this).has(e.id))return;const t=()=>{A(ME,this,mS).call(this,e.id)};e.on("node:loaded",t),M(_E,this).set(e.id,t)}function ZE(e){if(!e||!e.id||"function"!=typeof e.on)return;if(M(TE,this).has(e.id))return;const t=e=>A(ME,this,vS).call(this,e);e.on("segment:chunk",t),M(TE,this).set(e.id,t)}function eS(e,t){if(!e||!t)return;const n=M(IE,this).get(e)||new Set;n.add(t),M(IE,this).set(e,n)}function tS(e){return M(IE,this).get(e)||new Set}function nS(e){if(e&&M(dE,this)&&"function"==typeof M(dE,this).get)return M(dE,this).get(e)}function iS(e){if(!e)return;const t=e.fullBufferRetryTimer;null!=t&&("function"==typeof(null==ld?void 0:ld.clearTimeout)?ld.clearTimeout.bind(ld):clearTimeout)(t),e.fullBufferRetryTimer=null,e.fullBufferDecodeScheduled=!1,e.fullBufferRetryAttempts=0}function rS(e){const t=null==e?void 0:e.segmentStates;t&&"function"==typeof t.forEach&&t.forEach((e=>{A(ME,this,iS).call(this,e)}))}function oS(e,t,n,i){var r,o;if(!(e&&t&&n&&i))return!1;const s=M(xE,this).get(e),a=null==s||null===(r=s.trackStates)||void 0===r?void 0:r.get(t);return(null==a||null===(o=a.segmentStates)||void 0===o?void 0:o.get(n))===i}function sS(e){if(!e)return;A(ME,this,rS).call(this,e);const t=e.segmentDecoders;t&&"function"==typeof t.forEach&&(t.forEach((e=>{if(e&&"function"==typeof e.dispose)try{e.dispose()}catch(e){}})),"function"==typeof t.clear&&t.clear()),e.segmentStates&&"function"==typeof e.segmentStates.clear&&e.segmentStates.clear(),e.ready=!1,e.seekSegmentId=null}function aS(e){const t=uE(e);if(!Number.isFinite(t))return;const n=t-2;Number.isFinite(n)&&M(xE,this).forEach((e=>{const t=null==e?void 0:e.placement;if(!t)return;const i=sm(t),r=rm(t,M(dE,this),{allowUnready:!0});if(!Number.isFinite(i)||!Number.isFinite(r))return;const o=i+r;if(!Number.isFinite(o)||o>n)return;const s=null==e?void 0:e.trackStates;s&&"function"==typeof s.forEach&&s.forEach((e=>{var t;const n=null==e||null===(t=e.track)||void 0===t?void 0:t.type;"video"!==n&&"image"!==n&&"audio"!==n||A(ME,this,sS).call(this,e)}))}))}function lS(e){if(!e||!Array.isArray(e.segments))return!1;const t=e.segments.find((e=>null==e?void 0:e.isInit));if(t&&!(t.retainedByteLength>0))return!1;const n=e.segments.find((e=>e&&!e.isInit));return!n||n.retainedByteLength>0}function cS(e,t){if(this.log.debug(`[#startDecode] [${e.placementId}] [${t.id}] Starting decode`),A(ME,this,uS).call(this,e,t)){if(A(ME,this,eS).call(this,t.id,e.placementId),!A(ME,this,YE).call(this,t))return A(ME,this,JE).call(this,t),void A(ME,this,ZE).call(this,t);A(ME,this,fS).call(this,e,t),A(ME,this,ZE).call(this,t)}}function uS(e,t){if(!e||!e.placementId||!t)return;const n=M(xE,this).get(e.placementId);if(n)return n.placement=e,n;const i=A(ME,this,QE).call(this,t),r=new Map;i.forEach((n=>{try{const e=n.segments.some((e=>null==e?void 0:e.isInit));r.set(n.id,{hasInit:e,track:n,ready:!1,segmentDecoders:new Map,segmentStates:new Map})}catch(i){this.trigger(iv.DECODE_ERROR,sv({placementId:e.placementId,nodeId:t.id,trackId:null==n?void 0:n.id,trackType:null==n?void 0:n.type,error:i}))}}));const o={trackStates:r,nodeId:t.id,placement:e};return M(xE,this).set(e.placementId,o),o}function dS(e){var t;const n=sm(e),i=uE(null===(t=M(hE,this))||void 0===t?void 0:t.currentTime);return!Number.isFinite(n)||!!Number.isFinite(i)&&n-i>2}function hS(e){if(!M(EE,this).size)return;const t=uE(e);if(!Number.isFinite(t))return;const n=[];M(EE,this).forEach((e=>{const i=M(xE,this).get(e),r=null==i?void 0:i.placement;if(!r)return void n.push(e);const o=sm(r);Number.isFinite(o)&&o-t<=2&&n.push(e)})),n.forEach((e=>{M(EE,this).delete(e);const t=M(xE,this).get(e),n=null==t?void 0:t.placement;if(!n)return;const i=A(ME,this,nS).call(this,n.nodeId);i&&A(ME,this,cS).call(this,n,i)}))}function fS(e,t){const n=M(xE,this).get(e.placementId);n&&A(ME,this,QE).call(this,t).forEach((i=>{const r=n.trackStates.get(i.id);if(r&&!r.ready)try{let n;if(r.seekSegmentId&&(n=i.segments.find((e=>e&&!e.isInit&&e.id===r.seekSegmentId&&e.retainedByteLength>0)),!n))return;if(n||(n=i.segments.find((e=>e&&!e.isInit&&e.retainedByteLength>0))),!n)return;A(ME,this,xS).call(this,e,i,n),r.seekSegmentId&&"video"===(null==i?void 0:i.type)&&A(ME,this,pS).call(this,e,i,n),r.ready=!0,this.trigger(iv.DECODE_READY,ov({placementId:e.placementId,nodeId:t.id,trackId:i.id,trackType:i.type}))}catch(n){this.trigger(iv.DECODE_ERROR,sv({placementId:e.placementId,nodeId:t.id,trackId:null==i?void 0:i.id,trackType:null==i?void 0:i.type,error:n}))}}))}function pS(e,t,n){var i;if(!(e&&t&&n&&Array.isArray(t.segments)))return;const r=null==e?void 0:e.placementId,o=r?M(xE,this).get(r):void 0,s=null==o||null===(i=o.trackStates)||void 0===i?void 0:i.get(t.id),a=null==s?void 0:s.segmentDecoders;if(!a||"function"!=typeof a.has)return;const l=t.segments,c=l.findIndex((e=>(null==e?void 0:e.id)===n.id));if(c<0)return;let u=0;for(let n=c+1;n<l.length;n+=1){const i=l[n];if(!i||i.isInit)continue;if(a.has(i.id))continue;if(!(i.retainedByteLength>0))break;const r=i.arrayBuffer;if(!r||"number"!=typeof r.byteLength||r.byteLength<=0)break;if(A(ME,this,xS).call(this,e,t,i),u+=1,u>=2)break}}function mS(e){const t=A(ME,this,nS).call(this,e);t&&A(ME,this,YE).call(this,t)&&A(ME,this,tS).call(this,e).forEach((e=>{const n=M(xE,this).get(e);A(ME,this,fS).call(this,(null==n?void 0:n.placement)||{placementId:e},t)}))}function vS(e){e&&e.nodeId&&e.trackId&&e.chunk&&A(ME,this,tS).call(this,e.nodeId).forEach((t=>A(ME,this,gS).call(this,t,e)))}function gS(e,t){const n=M(xE,this).get(e);if(!n)return;const i=n.trackStates.get(t.trackId);if(i)try{var r,o;if(t.isInit)return;const s=i.track,a=null==s||null===(r=s.segments)||void 0===r?void 0:r.find((e=>(null==e?void 0:e.id)===t.segmentId));if(!a||a.isInit)return;if("image"===(null==s?void 0:s.type))return void(!i.ready&&a.retainedByteLength>0&&A(ME,this,xS).call(this,n.placement,s,a)&&(i.ready=!0,this.trigger(iv.DECODE_READY,ov({placementId:e,nodeId:t.nodeId,trackId:t.trackId,trackType:t.trackType}))));if((null===(o=M(hE,this))||void 0===o?void 0:o.state)===hv&&i.seekSegmentId&&("video"===(null==s?void 0:s.type)||"audio"===(null==s?void 0:s.type))&&a.id!==i.seekSegmentId)return;const l=a.id,c=i.segmentStates.get(l)||{initSent:!1,pendingChunks:[],ended:!1,firstChunkObserved:!1,missedSegmentPrefix:!1,fullBufferDecodeScheduled:!1,fullBufferRetryTimer:null,fullBufferRetryAttempts:0};i.segmentStates.set(l,c);const u=A(ME,this,kS).call(this,n.placement,s,a);if(!u||"function"!=typeof u.decodeChunk)return;if(i.hasInit&&!c.initSent){const e=A(ME,this,wS).call(this,s,a);if(!e)return void c.pendingChunks.push({chunk:t.chunk,loaded:t.loaded,total:t.total});u.decodeChunk(e,{isInit:!0}),c.initSent=!0,c.pendingChunks.length&&(c.pendingChunks.forEach((e=>{u.decodeChunk(e.chunk,{isInit:!1,loaded:e.loaded,total:e.total})})),c.pendingChunks=[])}const d="number"==typeof t.loaded&&"number"==typeof t.total&&t.total>0&&t.loaded>=t.total;A(ME,this,yS).call(this,c,t)?d&&!c.ended&&A(ME,this,bS).call(this,n.placement,s,a,c):(u.decodeChunk(t.chunk,{isInit:!1,loaded:t.loaded,total:t.total}),d&&!c.ended&&"function"==typeof u.endOfStream&&(c.ended=!0,u.endOfStream())),i.ready||(i.ready=!0,this.trigger(iv.DECODE_READY,ov({placementId:e,nodeId:t.nodeId,trackId:t.trackId,trackType:t.trackType})))}catch(n){this.trigger(iv.DECODE_ERROR,sv({placementId:e,nodeId:t.nodeId,trackId:t.trackId,trackType:t.trackType,error:n}))}}function yS(e,t){var n;if(!e||e.missedSegmentPrefix)return!(null==e||!e.missedSegmentPrefix);if(e.firstChunkObserved)return!1;e.firstChunkObserved=!0;const i=Number(null==t?void 0:t.loaded),r=Number(null==t||null===(n=t.chunk)||void 0===n?void 0:n.byteLength);return!(!Number.isFinite(i)||!Number.isFinite(r)||r<=0)&&(e.missedSegmentPrefix=i>r,e.missedSegmentPrefix)}function bS(e,t,n,i){if(!e||!t||!n||!i||i.fullBufferDecodeScheduled)return;const r=null==e?void 0:e.placementId,o=null==t?void 0:t.id,s=null==n?void 0:n.id;if(!r||!o||!s)return;const a="function"==typeof(null==ld?void 0:ld.setTimeout)?ld.setTimeout.bind(ld):setTimeout;i.fullBufferDecodeScheduled=!0,i.fullBufferRetryAttempts=0;const l=()=>{if(!A(ME,this,oS).call(this,r,o,s,i)||i.ended)return void A(ME,this,iS).call(this,i);if(A(ME,this,xS).call(this,e,t,n))return void A(ME,this,iS).call(this,i);i.fullBufferRetryAttempts+=1;const c=i.fullBufferRetryAttempts<=8?0:50;i.fullBufferRetryTimer=a((()=>{l()}),c)};i.fullBufferRetryTimer=a((()=>{l()}),0)}function kS(e,t,n){var i,r;const o=null==e?void 0:e.placementId;if(!o||!t||!n)return;const s=M(xE,this).get(o),a=null==s||null===(i=s.trackStates)||void 0===i?void 0:i.get(t.id);if(!a)return;const l=a.segmentDecoders.get(n.id);if(l)return l;const c=M(fE,this).create(t);if(c&&"function"==typeof c.configure&&c.configure(t),c&&"function"==typeof c.setNodeId&&c.setNodeId(null==e?void 0:e.nodeId),c&&"function"==typeof c.setSegment&&c.setSegment(n),c&&"function"==typeof c.setCurrentTimeProvider&&c.setCurrentTimeProvider((()=>{var e;return"number"==typeof(null===(e=M(hE,this))||void 0===e?void 0:e.currentTime)?M(hE,this).currentTime:0})),c&&"function"==typeof c.setTimeOffsetSeconds){var u,d;const i=sm(e),r=uE(null==t?void 0:t.offset),o=uE(null!==(u=null==n||null===(d=n.chosenRepresentation)||void 0===d?void 0:d.segStart)&&void 0!==u?u:null==n?void 0:n.offset);Number.isFinite(i)&&c.setTimeOffsetSeconds(i+r+o)}return c&&"function"==typeof c.setSeekTargetTimeSeconds&&(null===(r=M(hE,this))||void 0===r?void 0:r.state)===hv&&"video"===(null==t?void 0:t.type)&&c.setSeekTargetTimeSeconds(M(hE,this).currentTime),c&&"function"==typeof c.on&&(c.on(iv.DECODER_FRAME,(i=>{i&&(!M(AE,this)||"video"!==(null==t?void 0:t.type)&&"image"!==(null==t?void 0:t.type)||(C(AE,this,!1),C(NE,this,null)),M(hE,this)&&"function"==typeof M(hE,this).notifyDecodedFrame&&(i.frame||i.data)&&M(hE,this).notifyDecodedFrame({placementId:o,nodeId:null==e?void 0:e.nodeId,trackId:null==t?void 0:t.id,trackType:null==t?void 0:t.type,segmentId:null==n?void 0:n.id,pts:i.pts,duration:i.duration,frame:i.frame,data:i.data}))})),c.on(iv.DECODER_AUDIO,(i=>{i&&i.audioBuffer&&this.trigger(iv.DECODER_AUDIO,ov({placementId:o,nodeId:null==e?void 0:e.nodeId,trackId:null==t?void 0:t.id,trackType:null==t?void 0:t.type,segmentId:null==n?void 0:n.id,pts:i.pts,duration:i.duration,audioBuffer:i.audioBuffer}))})),c.on(iv.DECODER_ERROR,(i=>{const r=(null==i?void 0:i.error)||i;this.trigger(iv.DECODER_ERROR,sv({placementId:o,nodeId:null==e?void 0:e.nodeId,trackId:null==t?void 0:t.id,trackType:null==t?void 0:t.type,segmentId:null==n?void 0:n.id,error:r})),A(ME,this,GE).call(this,r)}))),a.segmentDecoders.set(n.id,c),c}function wS(e,t){var n,i;if(!e||!t||!Array.isArray(e.segments))return;const r=e.segments.find((e=>null==e?void 0:e.isInit));if(!r||"function"!=typeof r.getRepresentationBuffer)return;const o=(null==t||null===(n=t.chosenRepresentation)||void 0===n?void 0:n.id)||(null==t||null===(i=t.representations)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.id);if(!o)return;const s=r.getRepresentationBuffer(o);return s?s instanceof Uint8Array?s:new Uint8Array(s):void 0}function xS(e,t,n){var i;if(!e||!t||!n)return!1;const r=e.placementId,o=M(xE,this).get(r),s=null==o||null===(i=o.trackStates)||void 0===i?void 0:i.get(t.id);if(!s)return!1;const a=A(ME,this,kS).call(this,e,t,n);if(!a||"function"!=typeof a.decodeChunk)return!1;const l=s.segmentStates.get(n.id)||{initSent:!1,pendingChunks:[],ended:!1,firstChunkObserved:!1,missedSegmentPrefix:!1,fullBufferDecodeScheduled:!1,fullBufferRetryTimer:null,fullBufferRetryAttempts:0};if(s.segmentStates.set(n.id,l),l.ended)return A(ME,this,iS).call(this,l),!0;if(s.hasInit&&!l.initSent){const e=A(ME,this,wS).call(this,t,n);if(!e)return!1;a.decodeChunk(e,{isInit:!0}),l.initSent=!0}const c=n.arrayBuffer;return!(!c||"number"!=typeof c.byteLength||c.byteLength<=0||(a.decodeChunk(new Uint8Array(c),{isInit:!1,loaded:c.byteLength,total:c.byteLength}),l.ended||"function"!=typeof a.endOfStream||(l.ended=!0,a.endOfStream()),A(ME,this,iS).call(this,l),0))}const _S=1e-6;var TS=new WeakMap,IS=new WeakMap,ES=new WeakMap,SS=new WeakMap,AS=new WeakMap,NS=new WeakMap,MS=new WeakMap,FS=new WeakMap,CS=new WeakSet;class OS extends od{get name(){return"TransitionManager"}get defaults(){return{durationSeconds:.5}}constructor(e,t,n){super(n),O(this,CS),F(this,TS,void 0),F(this,IS,void 0),F(this,ES,null),F(this,SS,null),F(this,AS,null),F(this,NS,0),F(this,MS,[]),F(this,FS,null),C(TS,this,e),C(IS,this,t),M(TS,this)&&"function"==typeof M(TS,this).on&&(C(FS,this,(()=>A(CS,this,jS).call(this))),M(TS,this).on(iv.TIMELINE_RESET,M(FS,this)))}transitionTo(e,t={}){const n=Number(e);if(!Number.isFinite(n))throw new Error("TransitionManager.transitionTo requires a numeric time");A(CS,this,jS).call(this);const i=A(CS,this,PS).call(this),r=A(CS,this,BS).call(this,n,t);return r?A(CS,this,zS).call(this,n,t,i,r):Promise.resolve()}onDispose(){M(TS,this)&&"function"==typeof M(TS,this).off&&M(FS,this)&&M(TS,this).off(iv.TIMELINE_RESET,M(FS,this)),C(FS,this,null),A(CS,this,jS).call(this),C(IS,this,null),C(TS,this,null)}}function PS(){return C(NS,this,M(NS,this)+1),M(NS,this)}function RS(e={}){var t;const n=Number(null==e?void 0:e.duration),i=Number(null===(t=this.settings)||void 0===t?void 0:t.durationSeconds);return Number.isFinite(n)?n:i}function DS(e={},t){return{duration:t,filter:null==e?void 0:e.filter,color:null==e?void 0:e.color,filters:null==e?void 0:e.filters,reverseFilters:null==e?void 0:e.reverseFilters,transition:null==e?void 0:e.transition}}function LS(e,t){const n=1e3*e,i=Number.isFinite(Number(null==t?void 0:t.outDurationMs))&&t.outDurationMs>0?t.outDurationMs:n;return{outDurationMs:i,inDurationMs:Number.isFinite(Number(null==t?void 0:t.inDurationMs))&&t.inDurationMs>0?t.inDurationMs:i}}function BS(e,t={}){var n;const i=M(IS,this),r=A(CS,this,RS).call(this,t);if(!i||"function"!=typeof i.startTransition)return M(TS,this).currentTime=e,null;if(!(r>0))return M(TS,this).currentTime=e,null!==(n=i.resetTransition)&&void 0!==n&&n.call(i),null;const o=A(CS,this,DS).call(this,t,r);"function"==typeof(null==t?void 0:t.onTransitionInStart)&&t.onTransitionInStart();const s=i.startTransition(o),{outDurationMs:a,inDurationMs:l}=A(CS,this,LS).call(this,r,s);return{renderer:i,transitionOptions:o,outDurationMs:a,inDurationMs:l,shouldWaitForFrames:!1!==(null==t?void 0:t.waitForVisualFrames)}}function zS(e,t={},n,i){const{renderer:r,transitionOptions:o,outDurationMs:s,inDurationMs:a,shouldWaitForFrames:l}=i,c=A(CS,this,HS).call(this,e,t,n),u=l?A(CS,this,KS).call(this,e,n):Promise.resolve();let d=!1,h=!1,f=!1,p=!l;const m=()=>{var e;A(CS,this,US).call(this,n)&&!f&&d&&h&&p&&(f=!0,"function"==typeof(null==t?void 0:t.onTransitionInEnd)&&t.onTransitionInEnd(),"function"==typeof(null==t?void 0:t.onTransitionOutStart)&&t.onTransitionOutStart(),null!==(e=r.beginTransitionIn)&&void 0!==e&&e.call(r,o),C(SS,this,setTimeout((()=>{var e;A(CS,this,US).call(this,n)&&(null!==(e=r.resetTransition)&&void 0!==e&&e.call(r),"function"==typeof(null==t?void 0:t.onTransitionOutEnd)&&t.onTransitionOutEnd(),A(CS,this,WS).call(this))}),a)))};return C(ES,this,setTimeout((()=>{d=!0,m()}),s)),c.then((()=>{h=!0,m()})).catch((()=>{var e;A(CS,this,US).call(this,n)&&(null!==(e=r.resetTransition)&&void 0!==e&&e.call(r),A(CS,this,WS).call(this))})),u.then((()=>{p=!0,m()})).catch((()=>{p=!0,m()})),M(TS,this).currentTime=e,new Promise((e=>{C(AS,this,e)}))}function WS(){const e=M(AS,this);C(AS,this,null),A(CS,this,$S).call(this),A(CS,this,GS).call(this),e&&e()}function $S(){M(ES,this)&&clearTimeout(M(ES,this)),M(SS,this)&&clearTimeout(M(SS,this)),C(ES,this,null),C(SS,this,null)}function jS(){var e,t;M(IS,this)&&null!==(e=(t=M(IS,this)).resetTransition)&&void 0!==e&&e.call(t),A(CS,this,$S).call(this),A(CS,this,GS).call(this),M(AS,this)&&(M(AS,this).call(this),C(AS,this,null))}function US(e){return M(NS,this)===e}function qS(e,t){M(TS,this)&&"function"==typeof M(TS,this).on&&(M(TS,this).on(e,t),M(MS,this).push({eventName:e,handler:t}))}function VS(e,t){M(TS,this)&&"function"==typeof M(TS,this).off&&(M(TS,this).off(e,t),C(MS,this,M(MS,this).filter((n=>n.eventName!==e||n.handler!==t))))}function GS(){M(TS,this)&&"function"==typeof M(TS,this).off?(M(MS,this).forEach((e=>{M(TS,this).off(e.eventName,e.handler)})),C(MS,this,[])):C(MS,this,[])}function HS(e,t,n){const i=null==t?void 0:t.transitionOutPromise;if(i&&"function"==typeof i.then)return i;if("function"==typeof i)try{const e=i();if(e&&"function"==typeof e.then)return e}catch(e){return Promise.resolve()}if(!M(TS,this)||"function"!=typeof M(TS,this).on)return Promise.resolve();const r=A(CS,this,XS).call(this);return new Promise((t=>{let i=!1;const o=r?iv.TIMELINE_SEEKED:"nodestart";let s,a;const l=()=>{A(CS,this,VS).call(this,iv.TIMELINE_SEEKING,s),A(CS,this,VS).call(this,o,a),t()};s=(t={})=>{A(CS,this,US).call(this,n)?A(CS,this,YS).call(this,t,e)&&(i=!0):l()},a=(t={})=>{A(CS,this,US).call(this,n)?(o!==iv.TIMELINE_SEEKED||A(CS,this,YS).call(this,t,e))&&(o===iv.TIMELINE_SEEKED||i)&&l():l()},A(CS,this,qS).call(this,iv.TIMELINE_SEEKING,s),A(CS,this,qS).call(this,o,a)}))}function KS(e,t){if(!M(TS,this)||"function"!=typeof M(TS,this).on)return Promise.resolve();const n=Number(e);return new Promise((e=>{const i=(r={})=>{if(!A(CS,this,US).call(this,t))return A(CS,this,VS).call(this,iv.VISUAL_FRAMES_AVAILABLE,i),void e();const o=Number(null==r?void 0:r.time);Number.isFinite(n)&&Number.isFinite(o)&&o+_S<n||(Array.isArray(null==r?void 0:r.frames)?r.frames:[]).length&&(A(CS,this,VS).call(this,iv.VISUAL_FRAMES_AVAILABLE,i),e())};A(CS,this,qS).call(this,iv.VISUAL_FRAMES_AVAILABLE,i)}))}function XS(){var e,t;const n=null===(e=M(TS,this))||void 0===e?void 0:e.state;if(n===dv||n===av)return!0;const i=null===(t=M(TS,this))||void 0===t?void 0:t.placements;return!Array.isArray(i)||0===i.length}function YS(e,t){const n=Number(null==e?void 0:e.targetTime);return!Number.isFinite(n)||Math.abs(n-t)<_S}function QS(e,t=0){const n=Number(e);return Number.isFinite(n)?n:t}var JS=new WeakMap,ZS=new WeakMap,eA=new WeakMap,tA=new WeakMap,nA=new WeakMap,iA=new WeakMap,rA=new WeakMap,oA=new WeakMap,sA=new WeakMap,aA=new WeakMap,lA=new WeakMap,cA=new WeakMap,uA=new WeakMap,dA=new WeakMap,hA=new WeakSet;class fA extends od{get name(){return"AudioPlaybackManager"}get defaults(){return{muted:!1,volume:1,lookaheadSeconds:1}}constructor(e,t,n){super(n),O(this,hA),F(this,JS,void 0),F(this,ZS,void 0),F(this,eA,null),F(this,tA,null),F(this,nA,[]),F(this,iA,new Set),F(this,rA,new Map),F(this,oA,!1),F(this,sA,1),F(this,aA,!0),F(this,lA,null),F(this,cA,null),F(this,uA,null),F(this,dA,null),C(JS,this,e),C(ZS,this,t),C(oA,this,!!this.settings.muted),C(sA,this,nm(this.settings.volume));const i=Array.isArray(null==n?void 0:n.disabledTracks)?n.disabledTracks:[];C(aA,this,!i.includes("audio")),A(hA,this,pA).call(this)}get muted(){return M(oA,this)}set muted(e){C(oA,this,!!e),A(hA,this,IA).call(this)}get volume(){return M(sA,this)}set volume(e){C(sA,this,nm(e)),A(hA,this,IA).call(this)}handleDecodedAudio(e={}){if(!M(aA,this))return;const t=null==e?void 0:e.audioBuffer,n=null==e?void 0:e.placementId,i=null==e?void 0:e.segmentId,r=QS(null==e?void 0:e.pts,null);if(!(t&&n&&i&&Number.isFinite(r)))return;const o=Number.isFinite(null==e?void 0:e.duration)?e.duration:t.duration,s=`${n}:${i}`;M(iA,this).has(s)||(M(nA,this).push({key:s,placementId:n,pts:r,duration:o,audioBuffer:t}),M(nA,this).sort(((e,t)=>e.pts-t.pts)),A(hA,this,bA).call(this))}onDispose(){A(hA,this,mA).call(this),A(hA,this,_A).call(this,!0),M(eA,this)&&"function"==typeof M(eA,this).close&&M(eA,this).close(),C(eA,this,null),C(tA,this,null),C(JS,this,null),C(ZS,this,null)}}function pA(){M(JS,this)&&"function"==typeof M(JS,this).on&&(C(lA,this,(e=>A(hA,this,vA).call(this,e))),M(JS,this).on(iv.TIMELINE_TIME_UPDATE,M(lA,this)),C(cA,this,(e=>A(hA,this,gA).call(this,e))),M(JS,this).on(iv.TIMELINE_STATE_CHANGE,M(cA,this)),C(dA,this,(()=>A(hA,this,yA).call(this))),M(JS,this).on(iv.TIMELINE_RESET,M(dA,this))),M(ZS,this)&&"function"==typeof M(ZS,this).on&&(C(uA,this,(e=>this.handleDecodedAudio(e))),M(ZS,this).on(iv.DECODER_AUDIO,M(uA,this)))}function mA(){M(JS,this)&&"function"==typeof M(JS,this).off&&(M(lA,this)&&M(JS,this).off(iv.TIMELINE_TIME_UPDATE,M(lA,this)),M(cA,this)&&M(JS,this).off(iv.TIMELINE_STATE_CHANGE,M(cA,this)),M(dA,this)&&M(JS,this).off(iv.TIMELINE_RESET,M(dA,this))),M(ZS,this)&&"function"==typeof M(ZS,this).off&&M(uA,this)&&M(ZS,this).off(iv.DECODER_AUDIO,M(uA,this)),C(lA,this,null),C(cA,this,null),C(uA,this,null),C(dA,this,null)}function vA(){A(hA,this,bA).call(this)}function gA(e={}){const t=null==e?void 0:e.to;if(t)return t===lv?(A(hA,this,EA).call(this),void A(hA,this,bA).call(this)):void(t!==dv&&t!==uv?t!==hv&&t!==fv||A(hA,this,yA).call(this):A(hA,this,SA).call(this))}function yA(){A(hA,this,SA).call(this),A(hA,this,_A).call(this,!0),C(nA,this,[])}function bA(){if(!M(aA,this)||!M(JS,this))return;if(M(JS,this).state!==lv)return;const e=A(hA,this,TA).call(this);if(!e)return;const t=QS(M(JS,this).currentTime,0),n=t+Math.max(0,QS(this.settings.lookaheadSeconds,1)),i=[];for(let r=0;r<M(nA,this).length;r+=1){const o=M(nA,this)[r];o&&(o.pts>n?i.push(o):A(hA,this,kA).call(this,o)&&A(hA,this,xA).call(this,o,e,t))}C(nA,this,i)}function kA(e){if(!e||!M(JS,this))return!1;const t=A(hA,this,wA).call(this,e.pts);return!(!t||t!==e.placementId)}function wA(e){if(!M(JS,this)||"function"!=typeof M(JS,this).getPlacementsActiveAtTime)return null;const t=M(JS,this).getPlacementsActiveAtTime(e);if(!Array.isArray(t)||!t.length)return null;const n=t.find((e=>null==e?void 0:e.placementId));return n?n.placementId:null}function xA(e,t,n){const i=e.key;if(M(iA,this).has(i))return;const r=e.audioBuffer;if(!r)return;const o=Number.isFinite(e.duration)?e.duration:r.duration,s=e.pts;if(!Number.isFinite(s))return;const a=n-s;if(Number.isFinite(o)&&o>0&&a>=o)return;const l=t.createBufferSource();l.buffer=r,l.connect(M(tA,this));let c=t.currentTime,u=0;a>0?u=a:a<0&&(c=t.currentTime+Math.abs(a));try{l.start(c,u)}catch(e){return void this.log.warn("[AudioPlaybackManager] Failed to start audio buffer",e)}M(iA,this).add(i),M(rA,this).set(i,l),l.onended=()=>{M(rA,this).delete(i)}}function _A(e){M(rA,this).forEach(((e,t)=>{if(e&&"function"==typeof e.stop)try{e.stop()}catch(e){}M(rA,this).delete(t)})),e&&M(iA,this).clear()}function TA(){if(M(eA,this))return M(eA,this);const e=ld.AudioContext||ld.webkitAudioContext;if(!e)return this.log.warn("[AudioPlaybackManager] AudioContext is not available."),null;try{return C(eA,this,new e),C(tA,this,M(eA,this).createGain()),M(tA,this).connect(M(eA,this).destination),A(hA,this,IA).call(this),M(eA,this)}catch(e){return this.log.warn("[AudioPlaybackManager] Failed to initialize AudioContext",e),C(eA,this,null),C(tA,this,null),null}}function IA(){if(!M(tA,this))return;const e=M(oA,this)?0:M(sA,this);M(tA,this).gain.value=e}function EA(){M(eA,this)&&"function"==typeof M(eA,this).resume&&"suspended"===M(eA,this).state&&M(eA,this).resume().catch((()=>{}))}function SA(){M(eA,this)&&"function"==typeof M(eA,this).suspend&&"running"===M(eA,this).state&&M(eA,this).suspend().catch((()=>{}))}var AA=new WeakMap,NA=new WeakMap,MA=new WeakMap,FA=new WeakMap,CA=new WeakMap,OA=new WeakSet;class PA extends od{constructor(...e){super(...e),O(this,OA),F(this,AA,void 0),F(this,NA,void 0),F(this,MA,void 0),F(this,FA,void 0),F(this,CA,void 0),C(AA,this,A(OA,this,DA).call(this,this.settings.currentTime)),C(NA,this,A(OA,this,LA).call(this,this.settings.playbackRate)),C(MA,this,null),C(FA,this,!1),C(CA,this,A(OA,this,RA).bind(this))}get name(){return"PlaybackClock"}get defaults(){return{currentTime:0,playbackRate:xy("playbackRate")}}get currentTime(){return M(AA,this)}get playbackRate(){return M(NA,this)}set playbackRate(e){C(NA,this,A(OA,this,LA).call(this,e))}play(){M(FA,this)||(C(FA,this,!0),C(MA,this,oy()),jk(M(CA,this),0))}pause(){M(FA,this)&&(C(FA,this,!1),Uk(M(CA,this)))}seek(e){C(AA,this,A(OA,this,DA).call(this,e)),C(MA,this,oy())}reset(){this.pause(),C(AA,this,0),C(MA,this,null)}onDispose(){this.pause(),C(CA,this,null)}}function RA(){const e=oy();if(null===M(MA,this))return C(MA,this,e),void this.trigger(iv.CLOCK_TICK,{currentTime:M(AA,this)});const t=e-M(MA,this);C(MA,this,e);const n=t/1e3;C(AA,this,M(AA,this)+n*M(NA,this)),this.trigger(iv.CLOCK_TICK,{currentTime:M(AA,this)})}function DA(e){return"number"!=typeof e||Number.isNaN(e)||!Number.isFinite(e)||e<0?0:e}function LA(e){return"number"!=typeof e||Number.isNaN(e)||!Number.isFinite(e)||e<=0?M(NA,this)||1:e}var BA=new WeakMap,zA=new WeakSet;class WA extends od{constructor(...e){super(...e),O(this,zA),F(this,BA,new Map)}get name(){return"TrackBuffers"}get defaults(){return{}}refreshNode(e){if(!e||!Array.isArray(e.tracks))return;const t=e.id,n=M(BA,this).get(t)||new Map;M(BA,this).set(t,n),e.tracks.forEach((e=>{const i=null==e?void 0:e.type;if(!i)return;const r=e.buffered,o=n.get(i),s=!!o&&o.ready,a=(l=r)&&Number.isFinite(l.start)&&Number.isFinite(l.end)&&l.end>l.start;var l,c,u;u=r,!(c=null==o?void 0:o.range)&&!u||c&&u&&c.start===u.start&&c.end===u.end?o&&o.ready!==a&&n.set(i,{range:r,ready:a}):(n.set(i,{range:r,ready:a}),this.trigger(iv.TRACK_BUFFER_UPDATE,{nodeId:t,trackType:i,range:r})),!s&&a?this.trigger(iv.TRACK_READY,{nodeId:t,trackType:i,range:r}):s&&!a&&this.trigger(iv.TRACK_UNDERFLOW,{nodeId:t,trackType:i,range:r})}))}getTrackRange(e,t){const n=M(BA,this).get(e),i=null==n?void 0:n.get(t);return null==i?void 0:i.range}computeBuffered(e=[],t=0,n){if(!n||"function"!=typeof n.get)return;const i=Number.isFinite(t)?t:0;let r,o,s=!1;for(let t=0;t<e.length;t+=1){const a=A(zA,this,jA).call(this,n,e[t],i);if(!a||a.end<=i)continue;if(void 0===r){r=a.start,o=a.end,s=a.full;continue}const l=a.start<=o,c=s&&a.full;if(!l&&!c)break;o=Math.max(o,a.end),s=a.full}return void 0===r||void 0===o?{start:0,end:0}:{start:r,end:o}}get buffered(){return M(BA,this)}reset(){M(BA,this).clear()}onDispose(){M(BA,this).clear(),"function"==typeof this.off&&this.off()}}function $A(e,t=0){const n=Array.isArray(null==e?void 0:e.segments)?e.segments:[],i=[];for(let e=0;e<n.length;e+=1){const t=n[e];if(!t||t.isInit)continue;const r=Number(t.duration),o=Number(t.offset),s=Number(t.bufferedRatio);if(!Number.isFinite(r)||r<=0||!Number.isFinite(o)||s<=0)continue;const a=o+r*Math.min(1,s);!Number.isFinite(a)||a<=o||i.push({start:o,end:a})}if(!i.length)return;i.sort(((e,t)=>e.start-t.start));const r=[i[0]];for(let e=1;e<i.length;e+=1){const t=i[e],n=r[r.length-1];t.start<=n.end+.001?n.end=Math.max(n.end,t.end):r.push({...t})}const o=Number.isFinite(t)?t:0;for(let e=0;e<r.length;e+=1){const t=r[e];if(t.end>o+.001)return t}}function jA(e,t,n=0){var i,r;const o=sm(t);if(!Number.isFinite(o))return;const s=e.get(t.nodeId);if(!s)return;const a=Array.isArray(s.tracks)?s.tracks:[];if(!a.length){const e=s.buffered;if(!e||!Number.isFinite(e.start)||!Number.isFinite(e.end))return;return A(zA,this,UA).call(this,s,e,o,t)}const l=s.mainTrackId,c=Number.isFinite(t.nodeOffsetOverride)?t.nodeOffsetOverride:0,u=Math.max(0,n-o+c);let d;l&&(d=a.find((e=>(null==e?void 0:e.id)===l))),(null===(i=d)||void 0===i?void 0:i.type)||(d=a.find((e=>null==e?void 0:e.type)));const h=A(zA,this,$A).call(this,d,u)||(null===(r=d)||void 0===r?void 0:r.buffered);return h&&Number.isFinite(h.start)&&Number.isFinite(h.end)?A(zA,this,UA).call(this,s,h,o,t):void 0}function UA(e,t,n,i){const r=Number.isFinite(i.nodeOffsetOverride)?i.nodeOffsetOverride:0;let o=t.start-r+n,s=t.end-r+n;const a=e.duration,l=Number.isFinite(i.nodeDurationOverride)?i.nodeDurationOverride:a;if(Number.isFinite(l)){const e=n+l;s=Math.min(s,e);const t=o<=n&&s>=e;if(o=Math.max(o,n),!(s>o))return;return{start:o,end:s,full:t}}if(o=Math.max(o,n),s>o)return{start:o,end:s,full:!1}}class qA{constructor(e={}){const{placementId:t,nodeId:n,offset:i,offsetPending:r=!1,offsetAnchorPlacementId:o,offsetEndSeconds:s,offsetAnchorEdge:a,offsetAnchorIsReference:l,nodeOffsetOverride:c,nodeDurationOverride:u,loop:d=!1,loopRootPlacementId:h,loopRootOffset:f}=e;if(!t)throw new Error("Placement requires placementId");if(!n)throw new Error("Placement requires nodeId");this.placementId=t,this.nodeId=n;const p=Number.isFinite(i)?i:0;this.offsetPending=!0===r,this.offsetAnchorPlacementId=o,this.offsetAnchorEdge=a,this.offsetAnchorIsReference=l,this.offsetEndSeconds=Number.isFinite(s)?s:void 0,this.offset=this.offsetPending?void 0:p,this.nodeOffsetOverride=c,this.nodeDurationOverride=u,this.loop=!0===d,this.loopRootPlacementId=h,this.loopRootOffset=f}}class VA extends od{constructor(e,t){super(t),this.timeline=e}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"handleDecodedFrame","handleClockTick","handleMainTrackBufferUpdate"])}enter(){}exit(){}play(){this.timeline.transitionTo(lv)}pause(){this.timeline.transitionTo(dv)}wait(){this.timeline.transitionTo(uv)}reset(){this.timeline.transitionTo(fv)}seek(e){this.timeline.transitionTo(hv,{targetTime:e,returnState:this.timeline.state})}getCurrentTime(){return this.timeline.currentTime}emitPlayerStateEvent(e,t={}){if(!e||!this.timeline||"function"!=typeof this.timeline.trigger)return;const n=Number.isFinite(null==t?void 0:t.time)?t.time:this.getCurrentTime(),i={...t,event:e};Number.isFinite(n)&&(i.time=n),this.timeline.trigger("player:state",i)}get buffered(){return this.timeline.computeBuffered(this.timeline.currentTime)}handleMainTrackUnderflow(e){this.wait()}handleMainTrackReady(e){const t=this.timeline.getLastStableState()||dv;this.timeline.transitionTo(t)}handleMainTrackBufferUpdate(e){}handleDecodedFrame(e){}handleClockTick(e){}onDispose(){this.timeline=null}}const GA=24e3/1001;function HA(e,t=(null==e?void 0:e.currentTime)){return Number.isFinite(t)?t:Number.isFinite(null==e?void 0:e.currentTime)?e.currentTime:0}function KA(e){var t;const n=Number(null==e||null===(t=e.settings)||void 0===t?void 0:t.snapToFps);return Number.isFinite(n)&&n>0?.5/n:.001}function XA(e){var t;const n=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[];let i;if(null!=e&&e.mainTrackId){const t=n.find((t=>(null==t?void 0:t.id)===e.mainTrackId));i=null==t?void 0:t.type}if(i||(i=null===(t=n.find((e=>null==e?void 0:e.type)))||void 0===t?void 0:t.type),"video"===i||"audio"===i||"image"===i)return i}function YA(e){const t=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[];if(t.length){if(null!=e&&e.mainTrackId){const n=t.find((t=>(null==t?void 0:t.id)===e.mainTrackId));if("video"===(null==n?void 0:n.type)||"image"===(null==n?void 0:n.type))return n}return t.find((e=>"video"===(null==e?void 0:e.type)||"image"===(null==e?void 0:e.type)))}}function QA(e,t,n,i,r){var o,s;const a="function"==typeof(null==e?void 0:e.getDecodedVisualBuffer)?e.getDecodedVisualBuffer(t,n):void 0;if(!a)return"function"==typeof(null==e?void 0:e.hasDecodedFirstFrame)&&e.hasDecodedFirstFrame(t,i);const l=Array.isArray(a.frames)?a.frames:[];let c,u=Number.isFinite(null===(o=a.current)||void 0===o?void 0:o.presentationTime)?a.current:void 0;for(let e=0;e<l.length;e+=1){const t=l[e],n=Number(null==t?void 0:t.presentationTime);if(Number.isFinite(n)){if(!(n<=r)){c=n;break}u=t}}const d=Number(null===(s=u)||void 0===s?void 0:s.presentationTime);if(!Number.isFinite(d)||d>r)return!1;const h=function(e,t,n,i){const r=Number(null==n?void 0:n.duration);if(Number.isFinite(r)&&r>0)return t+r;const o=function(e,t){const n=Number(null==e||null===(t=e.settings)||void 0===t?void 0:t.snapToFps);return 2/(Number.isFinite(n)&&n>0?n:GA)}(e),s=Number.isFinite(i)&&i>t?i-t:o;return t+Math.min(s,o)}(e,d,u,c);return!!Number.isFinite(h)&&r<=h+KA(e)}function JA(e,t=(null==e?void 0:e.currentTime)){const n=HA(e,t),i="function"==typeof(null==e?void 0:e.getPlacementsActiveAtTime)?e.getPlacementsActiveAtTime(n):[];if(!i.length)return!1;for(let t=0;t<i.length;t+=1){const n=i[t],r=null==n?void 0:n.placementId;if(!r)return!0;const o="function"==typeof(null==e?void 0:e.getNode)?e.getNode(n.nodeId):void 0;if(!o)return!0;const s=XA(o);if(!s)return!0;if(!e.hasDecodedFirstFrame(r,s))return!0}return!1}function ZA(e,t=(null==e?void 0:e.currentTime)){return JA(e,t)||function(e,t=(null==e?void 0:e.currentTime)){const n=HA(e,t),i="function"==typeof(null==e?void 0:e.getPlacementsActiveAtTime)?e.getPlacementsActiveAtTime(n):[];if(!i.length)return!1;for(let t=0;t<i.length;t+=1){const r=i[t],o=null==r?void 0:r.placementId;if(!o)return!0;const s="function"==typeof(null==e?void 0:e.getNode)?e.getNode(r.nodeId):void 0;if(!s)return!0;const a=YA(s);if(null!=a&&a.id&&!QA(e,o,a.id,a.type,n))return!0}return!1}(e,t)}function eN(e,t=(null==e?void 0:e.currentTime)){if("function"!=typeof(null==e?void 0:e.computeBuffered))return!1;const n=HA(e,t),i=e.computeBuffered(n),r=Number(null==i?void 0:i.start),o=Number(null==i?void 0:i.end);if(!Number.isFinite(r)||!Number.isFinite(o)||o<=r)return!1;const s=KA(e);if(!(r<=n+s))return!1;return o-n>=function(e,t){const n=Number(null==e||null===(t=e.settings)||void 0===t?void 0:t.waitingBufferAheadSeconds);return!Number.isFinite(n)||n<0?3:n}(e)-s||function(e,t,n,i){const r=function(e){const t=Array.isArray(null==e?void 0:e.placements)?e.placements:[];let n;for(let i=0;i<t.length;i+=1){const r=t[i],o=sm(r);if(!Number.isFinite(o))continue;const s="function"==typeof(null==e?void 0:e.getPlacementDuration)?e.getPlacementDuration(r):void 0;if(!Number.isFinite(s))continue;const a=o+s;Number.isFinite(a)&&(!Number.isFinite(n)||a>n)&&(n=a)}return n}(e);return!!Number.isFinite(r)&&(t>=r-i||n>=r-i)}(e,n,o,s)}const tN={[av]:class extends VA{get name(){return av}get defaults(){return{autoplay:xy("autoplay")}}enter(){this.timeline.recordStableState(dv),this.timeline.stopPlaybackClock()}play(){const e=ZA(this.timeline),t=e?uv:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:t}),e)return this.timeline.recordStableState(lv),void this.timeline.transitionTo(uv);this.timeline.transitionTo(t)}pause(){}handleDecodedFrame(e){if(!0!==this.settings.autoplay)return;if(!Array.isArray(this.timeline.placements)||!this.timeline.placements.length)return;if(ZA(this.timeline))return;const t=this.timeline.getPlaybackStartState();this.log.info("[handleDecodedFrame] Autoplay enabled, starting playback!"),this.emitPlayerStateEvent("play",{from:this.timeline.state,to:t}),this.timeline.transitionTo(t)}},[cv]:class extends VA{get name(){return cv}enter(e={}){const{from:t,to:n}=e;this.timeline.recordStableState(lv),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("canplay",{from:t,to:n})}play(){}pause(){this.timeline.transitionTo(dv)}},[lv]:class extends VA{get name(){return lv}enter(e={}){const{from:t,to:n,fromFirstFramePending:i}=e;this.timeline.recordStableState(lv),this.timeline.startPlaybackClock(),!0!==i&&this.emitPlayerStateEvent("canplay",{from:t,to:n}),this.emitPlayerStateEvent("playing",{from:t,to:n})}play(){}pause(){this.timeline.transitionTo(dv)}handleClockTick(e){const t=this.timeline.currentTime;ZA(this.timeline,t)&&(this.timeline.recordStableState(lv),this.timeline.transitionTo(uv))}},[uv]:(Zt=new WeakMap,en=new WeakMap,tn=new WeakSet,class extends VA{constructor(...e){super(...e),O(this,tn),F(this,Zt,void 0),F(this,en,null)}get name(){return uv}enter(e={}){const{from:t,to:n}=e;this.timeline.stopPlaybackClock(),A(tn,this,nN).call(this),A(tn,this,rN).call(this),this.emitPlayerStateEvent("waiting",{from:t,to:n}),A(tn,this,aN).call(this)}exit(){A(tn,this,iN).call(this),A(tn,this,oN).call(this)}play(){this.timeline.recordStableState(lv);const e=A(tn,this,sN).call(this),t=e?uv:this.timeline.getPlaybackStartState();this.emitPlayerStateEvent("play",{from:this.timeline.state,to:t}),e||this.timeline.transitionTo(t)}pause(){this.timeline.transitionTo(dv)}handleMainTrackReady(e){const t=this.timeline.getLastStableState()||dv;t!==lv?this.timeline.transitionTo(t):A(tn,this,aN).call(this)}handleDecodedFrame(e){A(tn,this,aN).call(this)}handleMainTrackBufferUpdate(e){A(tn,this,aN).call(this)}}),[dv]:class extends VA{get name(){return dv}enter(e={}){const{from:t,to:n}=e;this.timeline.recordStableState(dv),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("pause",{from:t,to:n})}play(){const e=ZA(this.timeline),t=e?uv:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:t}),e)return this.timeline.recordStableState(lv),void this.timeline.transitionTo(uv);this.timeline.transitionTo(t)}pause(){}},[hv]:class extends VA{get name(){return hv}enter(e={}){const{targetTime:t,returnState:n}=e;if(this.timeline&&"function"==typeof this.timeline.stopPlaybackClock&&this.timeline.stopPlaybackClock(),this.timeline&&"function"==typeof this.timeline.startSeeking)return void this.timeline.startSeeking(t,n);this.timeline.updateTime(t);const i=n===lv||n===cv,r=i&&"function"==typeof this.timeline.getPlaybackStartState?this.timeline.getPlaybackStartState(t):i?lv:dv;this.timeline.transitionTo(r,{fromSeeking:!0})}play(){var e;if(this.timeline&&"function"==typeof this.timeline.setSeekReturnState)return void this.timeline.setSeekReturnState(lv);const t="function"==typeof(null===(e=this.timeline)||void 0===e?void 0:e.getPlaybackStartState)?this.timeline.getPlaybackStartState():lv;this.timeline.transitionTo(t)}pause(){this.timeline&&"function"==typeof this.timeline.setSeekReturnState?this.timeline.setSeekReturnState(dv):this.timeline.transitionTo(dv)}handleDecodedFrame(e){this.timeline&&"function"==typeof this.timeline.maybeCompleteSeek&&this.timeline.maybeCompleteSeek(e)}},[fv]:class extends VA{get name(){return fv}enter(){this.timeline.resetClock(),this.timeline.transitionTo(av,{fromReset:!0})}play(){}pause(){}get buffered(){return{start:0,end:0}}}};function nN(){var e;const t=null===(e=this.timeline)||void 0===e?void 0:e.trackBuffers;t&&"function"==typeof t.on&&(C(Zt,this,(e=>this.handleMainTrackBufferUpdate(e))),t.on(iv.TRACK_BUFFER_UPDATE,M(Zt,this)))}function iN(){var e;const t=null===(e=this.timeline)||void 0===e?void 0:e.trackBuffers;M(Zt,this)&&t&&"function"==typeof t.off?(t.off(iv.TRACK_BUFFER_UPDATE,M(Zt,this)),C(Zt,this,null)):C(Zt,this,null)}function rN(){if(null!==M(en,this))return;const e="function"==typeof(null==ld?void 0:ld.setInterval)?ld.setInterval.bind(ld):setInterval;C(en,this,e((()=>{var e;(null===(e=this.timeline)||void 0===e?void 0:e.state)===uv&&A(tn,this,aN).call(this)}),200))}function oN(){null!==M(en,this)&&(("function"==typeof(null==ld?void 0:ld.clearInterval)?ld.clearInterval.bind(ld):clearInterval)(M(en,this)),C(en,this,null))}function sN(e=(e=>null===(e=this.timeline)||void 0===e?void 0:e.currentTime)()){return function(e,t=(null==e?void 0:e.currentTime),n={}){return!!JA(e,t)||!0===n.skipBufferResume||!eN(e,t)}(this.timeline,e)}function aN(e=(e=>null===(e=this.timeline)||void 0===e?void 0:e.currentTime)()){return(this.timeline.getLastStableState()||dv)===lv&&!A(tn,this,sN).call(this,e)&&(this.timeline.transitionTo(this.timeline.getPlaybackStartState(e)),!0)}function lN(e){return e&&("string"!=typeof e.state||"ready"===e.state)}function cN(e){return(Array.isArray(null==e?void 0:e.tracks)?e.tracks:[]).some((e=>"video"===(null==e?void 0:e.type)))}function uN(e){return(Array.isArray(null==e?void 0:e.tracks)?e.tracks:[]).some((e=>"video"===(null==e?void 0:e.type)||"image"===(null==e?void 0:e.type)))}function dN(e){return e===lv||e===cv}var hN=new WeakMap,fN=new WeakMap,pN=new WeakMap,mN=new WeakMap,vN=new WeakMap,gN=new WeakMap,yN=new WeakMap,bN=new WeakMap,kN=new WeakMap,wN=new WeakMap,xN=new WeakMap,_N=new WeakMap,TN=new WeakMap,IN=new WeakMap,EN=new WeakSet;class SN{constructor(e={}){O(this,EN),F(this,hN,void 0),F(this,fN,void 0),F(this,pN,void 0),F(this,mN,void 0),F(this,vN,void 0),F(this,gN,void 0),F(this,yN,void 0),F(this,bN,void 0),F(this,kN,void 0),F(this,wN,null),F(this,xN,dv),F(this,_N,[]),F(this,TN,new Set),F(this,IN,new Map),C(hN,this,e.getState),C(fN,this,e.getNode),C(pN,this,e.getPlacementsActiveAtTime),C(mN,this,e.getLastStableState),C(vN,this,e.getPlaybackStartState),C(gN,this,e.clearVisualFrameBuffers),C(yN,this,e.updateTime),C(bN,this,e.transitionTo),C(kN,this,e.trigger)}start(e,t){const n=Number(e);if(!Number.isFinite(n))return;let i=t;i===hv?i=M(xN,this):i===uv&&"function"==typeof M(mN,this)&&(i=M(mN,this).call(this)),C(xN,this,dN(i)?lv:dv),C(wN,this,n),M(TN,this).clear(),M(IN,this).clear(),C(_N,this,"function"==typeof M(pN,this)?M(pN,this).call(this,n):[]),"function"==typeof M(gN,this)&&M(gN,this).call(this),"function"==typeof M(yN,this)&&M(yN,this).call(this,n,{source:"seek"}),"function"==typeof M(kN,this)&&M(kN,this).call(this,iv.TIMELINE_SEEKING,{targetTime:n,placements:M(_N,this).slice()}),this.maybeComplete()}setReturnState(e){C(xN,this,dN(e)?lv:dv)}maybeComplete(e){if(("function"==typeof M(hN,this)?M(hN,this).call(this):void 0)!==hv)return;const t=M(wN,this);if(!Number.isFinite(t))return;const n=null==e?void 0:e.trackType,i=null==e?void 0:e.placementId;if(i&&"video"===n){const n=Number(null==e?void 0:e.pts);if(Number.isFinite(n)&&n>=t){M(TN,this).add(i);const e=M(IN,this).get(i);(!Number.isFinite(e)||n<e)&&M(IN,this).set(i,n)}}else i&&"image"===n&&function(e,t){const n=Number(null==e?void 0:e.pts),i=Number(null==e?void 0:e.duration);return!Number.isFinite(n)||(Number.isFinite(i)&&i>0?t>=n&&t<n+i:t>=n)}(e,t)&&M(TN,this).add(i);const r=Array.isArray(M(_N,this))?M(_N,this):[];if(r.length){if("function"==typeof M(fN,this)){for(let e=0;e<r.length;e+=1){const t=r[e],n=null==t?void 0:t.placementId;if(!n)return;const i=M(fN,this).call(this,t.nodeId);if(!lN(i))return;if(uN(i)&&!M(TN,this).has(n))return}A(EN,this,AN).call(this,t,r)}}else A(EN,this,AN).call(this,t,[])}dispose(){C(_N,this,[]),M(TN,this).clear(),M(IN,this).clear(),C(wN,this,null)}}function AN(e,t){const n=A(EN,this,NN).call(this,e,t);if("function"==typeof M(yN,this)&&M(yN,this).call(this,n,{source:"seek"}),C(wN,this,null),C(_N,this,[]),M(TN,this).clear(),M(IN,this).clear(),"function"==typeof M(kN,this)&&M(kN,this).call(this,iv.TIMELINE_SEEKED,{targetTime:e,placements:Array.isArray(t)?t.slice():[]}),"function"==typeof M(bN,this)){const e=M(xN,this)===lv&&"function"==typeof M(vN,this)?M(vN,this).call(this,n):M(xN,this);M(bN,this).call(this,e,{fromSeeking:!0})}}function NN(e,t){const n=Number(e);if(!Number.isFinite(n))return e;if(!Array.isArray(t)||!t.length||"function"!=typeof M(fN,this))return n;let i=n;for(let e=0;e<t.length;e+=1){const n=t[e],r=null==n?void 0:n.placementId;if(!r)continue;if(!cN(M(fN,this).call(this,n.nodeId)))continue;const o=M(IN,this).get(r);Number.isFinite(o)&&o>i&&(i=o)}return i}function MN(e){if(e&&"function"==typeof e.close)try{e.close()}catch(e){}}function FN(e){if(!e)return;const t=Array.isArray(null==e?void 0:e.frames)?e.frames:[],n=null==e?void 0:e.current;(n?[n,...t]:t).forEach((e=>MN(null==e?void 0:e.frame)))}function CN(e){return sm(e)}function ON(e){return Number.isFinite(null==e?void 0:e.loopRootOffset)?e.loopRootOffset:CN(e)}function PN(e,t){return"string"==typeof(null==e?void 0:e.loopRootPlacementId)&&e.loopRootPlacementId?e.loopRootPlacementId:t}function RN(e){if("string"!=typeof e)return Number.NaN;const t=e.match(/(\d+)/);return t?Number(t[1]):Number.NaN}function DN(e){if(!e)return;const t=[[e.displayWidth,e.displayHeight],[e.codedWidth,e.codedHeight],[e.videoWidth,e.videoHeight],[e.naturalWidth,e.naturalHeight],[e.width,e.height]];for(let e=0;e<t.length;e+=1){const[n,i]=t[e],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}const LN=1e-6;function BN(e){return e&&("string"!=typeof e.state||"ready"===e.state)}function zN(e){const t=Number(e);return Number.isFinite(t)?t:0}function WN(e){return(Array.isArray(null==e?void 0:e.tracks)?e.tracks:[]).filter((e=>"cue"===(null==e?void 0:e.type)&&Array.isArray(null==e?void 0:e.cues)))}function $N(e){return e&&"cue"===e.type&&Array.isArray(e.cues)?e.cues:[]}var jN=new WeakMap,UN=new WeakMap,qN=new WeakMap,VN=new WeakMap,GN=new WeakMap,HN=new WeakMap,KN=new WeakMap,XN=new WeakMap,YN=new WeakSet;class QN{constructor(e={}){O(this,YN),F(this,jN,void 0),F(this,UN,void 0),F(this,qN,void 0),F(this,VN,void 0),F(this,GN,void 0),F(this,HN,void 0),F(this,KN,-1e-6),F(this,XN,null),C(jN,this,e.getPlacements),C(UN,this,e.getPlacementsActiveAtTime),C(qN,this,e.getPlacementDuration),C(VN,this,e.getNode),C(GN,this,e.triggerTimeline),C(HN,this,e.triggerNode)}handleSeeking(e,t){const n=zN(e);C(XN,this,n)}handleSeeked(e){const t=zN(e),n=M(XN,this);C(XN,this,null),Number.isFinite(n)?(A(YN,this,ZN).call(this,n,t),C(KN,this,t)):C(KN,this,t)}handleTimeUpdate(e,t={}){const n=zN(e),i=M(KN,this);!0===(null==t?void 0:t.isSeeking)?C(KN,this,n):Number.isFinite(i)?n<=i?n<i&&C(KN,this,n-LN):(A(YN,this,JN).call(this,i,n),C(KN,this,n)):C(KN,this,n)}dispose(){C(XN,this,null),C(KN,this,-1e-6)}}function JN(e,t){const n="function"==typeof M(jN,this)?M(jN,this).call(this):[];A(YN,this,eM).call(this,n,e,t,{onlySticky:!1})}function ZN(e,t){if("function"!=typeof M(UN,this))return;const n=M(UN,this).call(this,t);A(YN,this,eM).call(this,n,e,t,{onlySticky:!0})}function eM(e,t,n,i={}){if("function"!=typeof M(VN,this)||"function"!=typeof M(GN,this))return;if(!Array.isArray(e)||!e.length)return;const r=!0===i.onlySticky,o=[];for(let i=0;i<e.length;i+=1){const s=e[i],a=null==s?void 0:s.placementId,l=null==s?void 0:s.nodeId;if(!a||!l)continue;const c=M(VN,this).call(this,l);if(!BN(c))continue;const u=WN(c);if(!u.length)continue;const d=sm(s);if(!Number.isFinite(d))continue;const h=Number.isFinite(null==s?void 0:s.nodeOffsetOverride)?s.nodeOffsetOverride:0,f="function"==typeof M(qN,this)?M(qN,this).call(this,s):void 0,p="number"==typeof f&&Number.isFinite(f)?d+f:Number.POSITIVE_INFINITY,m=r?d-LN:t;for(let e=0;e<u.length;e+=1){const t=$N(u[e]);for(let i=0;i<t.length;i+=1){const s=t[i],c=zN(null==s?void 0:s.timestamp),u=d+Math.max(0,c-h);u<=p&&(r&&!0!==(null==s?void 0:s.isSticky)||u>m&&u<=n&&"string"==typeof(null==s?void 0:s.name)&&s.name&&o.push({time:u,placementOffset:d,placementId:a,nodeId:l,cuepoint:s,trackIndex:e,cueIndex:i}))}}}o.length&&(o.sort(((e,t)=>e.time!==t.time?e.time-t.time:e.placementOffset!==t.placementOffset?e.placementOffset-t.placementOffset:e.placementId!==t.placementId?e.placementId<t.placementId?-1:1:e.trackIndex!==t.trackIndex?e.trackIndex-t.trackIndex:e.cueIndex-t.cueIndex)),o.forEach((e=>{const t=e.cuepoint,n={time:e.time,nodeId:e.nodeId,placementId:e.placementId,cuepoint:t};M(GN,this).call(this,"cuepoint",n),M(GN,this).call(this,t.name,n),"function"==typeof M(HN,this)&&(M(HN,this).call(this,e.nodeId,"cuepoint",n),M(HN,this).call(this,e.nodeId,t.name,n))})))}class tM{#te;#ne=0;#ie=new Set;constructor(e){this.#te="string"==typeof e?e:""}claim(e){if(e)return this.#ie.add(e),e;let t;do{t=`${this.#te}${++this.#ne}`}while(this.#ie.has(t));return this.#ie.add(t),t}reset(){this.#ne=0,this.#ie.clear()}}const nM=24e3/1001;function iM(e){var t;const n=null==e?void 0:e.frame;if(!n||!0===n.__closed||!0===n.closed)return 0;if("function"==typeof n.allocationSize)try{const e=Number(n.allocationSize());if(Number.isFinite(e)&&e>0)return e}catch(e){}const i=Number(null==n?void 0:n.byteLength);if(Number.isFinite(i)&&i>0)return i;const r=Number(null==n||null===(t=n.data)||void 0===t?void 0:t.byteLength);if(Number.isFinite(r)&&r>0)return r;const o=function(e,t){const n=Number(null==e?void 0:e.width),i=Number(null==e?void 0:e.height);return Number.isFinite(n)&&Number.isFinite(i)&&n>0&&i>0?{width:n,height:i}:DN(t)}(e,n),s=Number(null==o?void 0:o.width),a=Number(null==o?void 0:o.height);return Number.isFinite(s)&&Number.isFinite(a)&&s>0&&a>0?s*a*4:0}var rM=new WeakMap,oM=new WeakMap,sM=new WeakMap,aM=new WeakMap,lM=new WeakMap,cM=new WeakMap,uM=new WeakMap,dM=new WeakMap,hM=new WeakMap,fM=new WeakMap,pM=new WeakMap,mM=new WeakMap,vM=new WeakMap,gM=new WeakMap,yM=new WeakMap,bM=new WeakMap,kM=new WeakMap,wM=new WeakMap,xM=new WeakMap,_M=new WeakMap,TM=new WeakMap,IM=new WeakMap,EM=new WeakMap,SM=new WeakMap,AM=new WeakMap,NM=new WeakMap,MM=new WeakMap,FM=new WeakMap,CM=new WeakMap,OM=new WeakMap,PM=new WeakMap,RM=new WeakMap,DM=new WeakMap,LM=new WeakSet;class BM extends od{constructor(...e){super(...e),O(this,LM),F(this,rM,void 0),F(this,oM,void 0),F(this,sM,void 0),F(this,aM,void 0),F(this,lM,void 0),F(this,cM,!1),F(this,uM,[]),F(this,dM,new tM("placement-")),F(this,hM,[]),F(this,fM,new tM("renderplacement-")),F(this,pM,void 0),F(this,mM,void 0),F(this,vM,void 0),F(this,gM,!1),F(this,yM,new Set),F(this,bM,new Set),F(this,kM,new Map),F(this,wM,[]),F(this,xM,0),F(this,_M,new Set),F(this,TM,new Set),F(this,IM,Number.NEGATIVE_INFINITY),F(this,EM,[]),F(this,SM,Number.NEGATIVE_INFINITY),F(this,AM,0),F(this,NM,void 0),F(this,MM,void 0),F(this,FM,new Map),F(this,CM,null),F(this,OM,void 0),F(this,PM,void 0),F(this,RM,void 0),F(this,DM,void 0);const[t,n={}]=e;C(rM,this,t),C(NM,this,n),C(lM,this,new PA(n)),C(pM,this,new WA(n)),C(aM,this,dv),A(LM,this,XM).call(this),A(LM,this,YM).call(this),C(OM,this,new SN({getState:()=>this.state,getNode:e=>M(rM,this)&&"function"==typeof M(rM,this).get?M(rM,this).get(e):void 0,getPlacementsActiveAtTime:e=>A(LM,this,NF).call(this,e,{endEpsilonSeconds:A(LM,this,BF).call(this)}),getLastStableState:()=>this.getLastStableState(),getPlaybackStartState:e=>this.getPlaybackStartState(e),clearVisualFrameBuffers:()=>A(LM,this,SF).call(this),updateTime:(e,t)=>this.updateTime(e,t),transitionTo:(e,t)=>this.transitionTo(e,t),trigger:(e,t)=>this.trigger(e,t)})),C(PM,this,new QN({getPlacements:()=>M(uM,this).slice(),getPlacementsActiveAtTime:e=>A(LM,this,NF).call(this,e),getPlacementDuration:e=>A(LM,this,uF).call(this,e),getNode:e=>M(rM,this)&&"function"==typeof M(rM,this).get?M(rM,this).get(e):void 0,triggerTimeline:(e,t)=>this.trigger(e,t),triggerNode:(e,t,n)=>{const i=M(rM,this)&&"function"==typeof M(rM,this).get?M(rM,this).get(e):void 0;i&&"function"==typeof i.trigger&&i.trigger(t,n)}})),C(RM,this,(()=>{var e,t;null===(e=M(PM,this))||void 0===e||null===(t=e.handleSeeked)||void 0===t||t.call(e,this.currentTime)})),this.on(iv.TIMELINE_SEEKED,M(RM,this)),C(DM,this,(e=>A(LM,this,iF).call(this,e))),this.on("nodestart",M(DM,this)),this.transitionTo(av)}get name(){return"Timeline"}get defaults(){return{snapToFps:nM,maxBufferedVideoFrames:24}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"computeBuffered","notifyDecodedFrame","getDecodedFrameStats","getActiveRenderPlacement","maybeCompleteSeek","getPlacementsActiveAtTime","hasDecodedFirstFrame","getDecodedVisualBuffer","getPlacementDuration","getNode"])}transitionTo(e,t={}){const n=M(sM,this),i=function(e,t,n={}){const i=tN[e];return i?new i(t,n):null}(e,this,M(NM,this)),r=t&&"object"==typeof t&&!Array.isArray(t)?{...t,from:n,to:e}:{from:n,to:e};i?(M(oM,this)&&"function"==typeof M(oM,this).exit&&M(oM,this).exit(),C(oM,this,i),C(sM,this,e),"function"==typeof i.enter&&i.enter(r),this.trigger(iv.TIMELINE_STATE_CHANGE,{from:n,to:e,options:t})):this.log.warn(`Unknown state "${e}"`)}recordStableState(e){C(aM,this,e)}getLastStableState(){return M(aM,this)}enableFirstFrameRenderedGate(){C(cM,this,!0)}getPlaybackStartState(e=this.currentTime){return this.shouldWaitForFirstRenderedFrame(e)?cv:lv}shouldWaitForFirstRenderedFrame(e=this.currentTime){if(!M(cM,this)||M(gM,this))return!1;const t=Number.isFinite(e)?e:this.currentTime,n=A(LM,this,NF).call(this,t);return Array.isArray(n)&&n.length>0}notifyFirstFrameRendered(){M(gM,this)||(C(gM,this,!0),this.state===cv&&this.transitionTo(lv,{fromFirstFramePending:!0}))}get state(){return M(sM,this)}get paused(){return M(sM,this)===av||M(sM,this)===dv}get currentTime(){return M(lM,this).currentTime}set currentTime(e){M(oM,this).seek(e)}get playbackRate(){return M(lM,this).playbackRate}set playbackRate(e){M(lM,this).playbackRate=e}play(){M(oM,this).play()}pause(){M(oM,this).pause()}reset(){M(oM,this).reset()}seekToPlacement(e){if(!e)throw new Error("Timeline.seekToPlacement requires placement id");A(LM,this,sF).call(this);const t=A(LM,this,PF).call(this,e);if(!t)throw new Error("Timeline.seekToPlacement requires placement id");const n=sm(t);if(!Number.isFinite(n))throw new Error("Timeline.seekToPlacement requires resolved placement offset");return this.currentTime=n,n}updateTime(e,t={}){var n,i;A(LM,this,sF).call(this),A(LM,this,aF).call(this),M(lM,this).seek(e),A(LM,this,AF).call(this,this.currentTime),A(LM,this,MF).call(this);const r="string"==typeof(null==t?void 0:t.source)?t.source:"set";null!==(n=M(PM,this))&&void 0!==n&&null!==(i=n.handleTimeUpdate)&&void 0!==i&&i.call(n,this.currentTime,{isSeeking:this.state===hv}),A(LM,this,rF).call(this,this.currentTime),A(LM,this,xF).call(this,this.currentTime),this.trigger(iv.TIMELINE_TIME_UPDATE,rv(this.currentTime,r))}startSeeking(e,t){var n,i;null!==(n=M(PM,this))&&void 0!==n&&null!==(i=n.handleSeeking)&&void 0!==i&&i.call(n,this.currentTime,e),M(OM,this)&&"function"==typeof M(OM,this).start&&M(OM,this).start(e,t)}setSeekReturnState(e){M(OM,this)&&"function"==typeof M(OM,this).setReturnState&&M(OM,this).setReturnState(e)}maybeCompleteSeek(e){M(OM,this)&&"function"==typeof M(OM,this).maybeComplete&&M(OM,this).maybeComplete(e)}startPlaybackClock(){M(lM,this).play()}stopPlaybackClock(){M(lM,this).pause()}resetClock(){var e,t;M(lM,this).reset(),null===(e=M(PM,this))||void 0===e||null===(t=e.dispose)||void 0===t||t.call(e)}applyTimelineDefinition(e={}){const t=Array.isArray(null==e?void 0:e.placements)?e.placements:[],n=Array.isArray(null==e?void 0:e.renderPlacements)?e.renderPlacements:[];A(LM,this,zM).call(this),A(LM,this,WM).call(this,t),A(LM,this,$M).call(this,n),this.currentTime=0}placeOnTimeline(e,t,n={}){const i=e&&"object"==typeof e?e.id:e;if(!i)throw new Error("Timeline.placeOnTimeline requires node id");const r=M(dM,this).claim(n.placementId),o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=hm(t);if("string"==typeof t&&t.includes("@")&&!a)throw new Error("Timeline.placeOnTimeline requires valid placement reference");const{wantsEndOffset:l,endOffsetSeconds:c}=a?{wantsEndOffset:!1}:dm(t,n);let u,d,h,f=!1;const p=null!==a;if(A(LM,this,sF).call(this),a){const e=M(uM,this).find((e=>(null==e?void 0:e.placementId)===a.placementId));if(!e)throw new Error("Timeline.placeOnTimeline requires valid placement reference");d=e.placementId,h=a.anchor;const t=sm(e);if("start"===a.anchor)Number.isFinite(t)?u=A(LM,this,dF).call(this,t,{nodeOffsetOverride:o}):f=!0;else{const n=A(LM,this,uF).call(this,e);if(Number.isFinite(t)&&n>0){const e=t+n,i=A(LM,this,dF).call(this,e,{nodeOffsetOverride:o});u=Math.max(i,e)}else f=!0}}else if(l){const e=n.offsetAnchorPlacementId?M(uM,this).find((e=>(null==e?void 0:e.placementId)===n.offsetAnchorPlacementId)):M(uM,this).length?M(uM,this)[M(uM,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==e?void 0:e.placementId),d){const t=sm(e),n=A(LM,this,uF).call(this,e);Number.isFinite(t)&&n>0?u=A(LM,this,dF).call(this,t+n-c,{nodeOffsetOverride:o}):(f=!0,h="end")}else u=A(LM,this,dF).call(this,-c,{nodeOffsetOverride:o})}else u=um(t),u=A(LM,this,dF).call(this,u,{...n,nodeOffsetOverride:o});const m=!0===n.loop?n.loopRootPlacementId||r:void 0,v=!0===n.loop&&Number.isFinite(n.loopRootOffset)?n.loopRootOffset:!0===n.loop?u:void 0,g=l?c:a&&"end"===a.anchor?0:void 0,y=new qA({placementId:r,nodeId:i,offset:u,offsetPending:f,offsetAnchorPlacementId:f?d:void 0,offsetAnchorEdge:f?h:void 0,offsetAnchorIsReference:f?p:void 0,offsetEndSeconds:g,nodeOffsetOverride:o,nodeDurationOverride:s,loop:!0===n.loop,loopRootPlacementId:m,loopRootOffset:v});if(M(uM,this).push(y),lm(M(uM,this)),A(LM,this,kF).call(this,y),A(LM,this,yF).call(this),f&&d){const e=M(uM,this).find((e=>(null==e?void 0:e.placementId)===d));A(LM,this,fF).call(this,null==e?void 0:e.nodeId)}return this.trigger(iv.PLACEMENT_ADDED,y),r}placeRenderNodeOnTimeline(e,t,n,i={}){const r="string"==typeof e?e:null==e?void 0:e.type;if(!r||"string"!=typeof r)throw new Error("Timeline.placeRenderNodeOnTimeline requires render node type");const o=A(LM,this,hF).call(this,t,i),s=o.offset,a=!0===o.offsetPending,l=o.offsetAnchorPlacementId,c=o.offsetAnchorEdge,u=o.offsetAnchorIsReference,d=M(fM,this).claim(i.renderPlacementId),h=Number(n),f=h===Number.POSITIVE_INFINITY,p=Number.isFinite(h)&&h>0||f?h:void 0;if(!p)throw new Error("Timeline.placeRenderNodeOnTimeline requires a positive duration (seconds) or Infinity as 3rd argument");const m=i.params&&"object"==typeof i.params?i.params:void 0,v={renderPlacementId:d,type:r,offset:s,offsetPending:a,offsetAnchorPlacementId:l,offsetAnchorEdge:c,offsetAnchorIsReference:u,duration:p,params:m};if(!a){const e=s,t=s+p;fm(M(hM,this),e,t,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements")}if(M(hM,this).push(v),lm(M(hM,this)),a&&l){const e=M(uM,this).find((e=>(null==e?void 0:e.placementId)===l));A(LM,this,fF).call(this,null==e?void 0:e.nodeId)}return this.trigger(iv.RENDER_PLACEMENT_ADDED,v),d}get placements(){return M(uM,this).slice()}getPlacementsActiveAtTime(e){return A(LM,this,NF).call(this,e)}getNodesAtTime(e){const t=A(LM,this,RF).call(this,e);if(!Number.isFinite(t))return[];const n=A(LM,this,NF).call(this,t),i=[];return n.forEach((e=>{const t=this.getNode(null==e?void 0:e.nodeId);t&&i.push(t)})),i}getPlacementDuration(e){return A(LM,this,uF).call(this,e)}getNode(e){if(M(rM,this)&&"function"==typeof M(rM,this).get)return M(rM,this).get(e)}get renderPlacements(){return M(hM,this).slice()}get placementsAhead(){const e=this.currentTime;return M(uM,this).filter((t=>{const n=sm(t);if(!Number.isFinite(n))return!1;const i=A(LM,this,uF).call(this,t);return"number"==typeof i?n+i>e:n>=e}))}get buffered(){return M(oM,this)?M(oM,this).buffered:{start:0,end:0}}get trackBuffers(){return M(pM,this)}onDispose(){A(LM,this,HM).call(this),M(bM,this)&&M(bM,this).clear(),M(PM,this)&&"function"==typeof M(PM,this).dispose&&M(PM,this).dispose(),C(PM,this,null),A(LM,this,GM).call(this),A(LM,this,KM).call(this),M(OM,this)&&"function"==typeof M(OM,this).dispose&&M(OM,this).dispose(),C(OM,this,null),M(lM,this)&&"function"==typeof M(lM,this).dispose&&(M(MM,this)&&"function"==typeof M(lM,this).off&&(M(lM,this).off("tick",M(MM,this)),C(MM,this,null)),M(lM,this).dispose(),C(lM,this,null)),A(LM,this,vF).call(this),C(oM,this,null),C(sM,this,null),C(uM,this,[]),C(hM,this,[]),A(LM,this,gF).call(this),A(LM,this,yF).call(this),M(FM,this).clear(),C(CM,this,null)}notifyDecodedFrame(e={}){const t=null==e?void 0:e.placementId,n=null==e?void 0:e.trackType;if(!t||!n)return;const i=`${t}:${n}`;M(yM,this).add(i),A(LM,this,EF).call(this,e),A(LM,this,MF).call(this),M(oM,this)&&"function"==typeof M(oM,this).handleDecodedFrame&&M(oM,this).handleDecodedFrame(e)}getDecodedFrameStats(){return function(e){const t={totalBytes:0,frames:0,available:!1};if(!e||"function"!=typeof e.values)return t;for(const n of e.values()){const e=[];null!=n&&n.current&&e.push(n.current),Array.isArray(null==n?void 0:n.frames)&&e.push(...n.frames),e.forEach((e=>{const n=null==e?void 0:e.frame;if(!n||!0===n.__closed||!0===n.closed)return;t.frames+=1;const i=iM(e);Number.isFinite(i)&&i>0&&(t.totalBytes+=i)}))}return t.available=!0,t}(M(FM,this))}hasDecodedFirstFrame(e,t){return!(!e||!t)&&M(yM,this).has(`${e}:${t}`)}getDecodedVisualBuffer(e,t){if(e&&t)return M(FM,this).get(`${e}:${t}`)}computeBuffered(e){const t=M(rM,this);if(t&&"function"==typeof t.get)return M(pM,this).computeBuffered(M(uM,this),e,t)}getActiveRenderPlacement(e=this.currentTime){const t=Number.isFinite(e)?e:this.currentTime,n=Array.isArray(M(hM,this))?M(hM,this):[];if(!n.length)return;let i;for(let e=0;e<n.length;e+=1){const r=n[e];if(!0===(null==r?void 0:r.offsetPending))continue;const o="number"==typeof r.offset?r.offset:void 0;if(!Number.isFinite(o))continue;const s=r.duration;("number"==typeof s&&Number.isFinite(s)&&s>0?t>=o&&t<o+s:t>=o)&&(i=r)}return i}}function zM(){C(gM,this,!1),this.trigger(iv.TIMELINE_RESET,{reason:"switch"}),A(LM,this,SF).call(this),M(pM,this)&&"function"==typeof M(pM,this).reset&&M(pM,this).reset(),M(bM,this)&&M(bM,this).clear(),C(uM,this,[]),C(hM,this,[]),A(LM,this,gF).call(this),A(LM,this,yF).call(this),M(dM,this).reset(),M(fM,this).reset()}function WM(e=[]){for(let t=0;t<e.length;t+=1){const n=e[t];if(!n||!n.nodeId)continue;const i=A(LM,this,jM).call(this,n),r=A(LM,this,qM).call(this,n);this.placeOnTimeline(n.nodeId,r,i)}}function $M(e=[]){for(let t=0;t<e.length;t+=1){const n=e[t];if(!n||!n.type)continue;const i=A(LM,this,UM).call(this,n),r=A(LM,this,VM).call(this,n);this.placeRenderNodeOnTimeline(n.type,r,n.duration,i)}}function jM(e){const t={};return e.placementId&&(t.placementId=e.placementId),Number.isFinite(e.nodeOffsetOverride)&&(t.nodeOffsetOverride=e.nodeOffsetOverride),Number.isFinite(e.nodeDurationOverride)&&(t.nodeDurationOverride=e.nodeDurationOverride),!0===e.offsetPending&&(t.offsetPending=!0,e.offsetAnchorPlacementId&&(t.offsetAnchorPlacementId=e.offsetAnchorPlacementId),e.offsetAnchorEdge&&(t.offsetAnchorEdge=e.offsetAnchorEdge)),Number.isFinite(e.offsetEndSeconds)&&(t.offsetEndSeconds=e.offsetEndSeconds),!0===e.loop&&(t.loop=!0),e.loopRootPlacementId&&(t.loopRootPlacementId=e.loopRootPlacementId),Number.isFinite(e.loopRootOffset)&&(t.loopRootOffset=e.loopRootOffset),t}function UM(e){const t={};return e.renderPlacementId&&(t.renderPlacementId=e.renderPlacementId),e.params&&"object"==typeof e.params&&(t.params=e.params),t}function qM(e){if(!0===e.offsetPending&&e.offsetAnchorPlacementId&&e.offsetAnchorEdge){if(!0===e.offsetAnchorIsReference)return`${e.offsetAnchorPlacementId}@${e.offsetAnchorEdge}`;if("end"===e.offsetAnchorEdge)return Number.isFinite(e.offsetEndSeconds)&&e.offsetEndSeconds>0?-e.offsetEndSeconds:"end"}return"string"==typeof e.offset||Number.isFinite(e.offset)?e.offset:0}function VM(e){return!0===e.offsetPending&&e.offsetAnchorPlacementId&&e.offsetAnchorEdge&&!0===e.offsetAnchorIsReference?`${e.offsetAnchorPlacementId}@${e.offsetAnchorEdge}`:"string"==typeof e.offset||Number.isFinite(e.offset)?e.offset:0}function GM(){M(oM,this)&&"function"==typeof M(oM,this).exit&&M(oM,this).exit()}function HM(){M(RM,this)&&"function"==typeof this.off&&(this.off(iv.TIMELINE_SEEKED,M(RM,this)),C(RM,this,null)),M(DM,this)&&"function"==typeof this.off&&(this.off("nodestart",M(DM,this)),C(DM,this,null))}function KM(){M(pM,this)&&(M(mM,this)&&(M(pM,this).off("track:underflow",M(mM,this)),C(mM,this,null)),M(vM,this)&&(M(pM,this).off("track:ready",M(vM,this)),C(vM,this,null)),"function"==typeof M(pM,this).dispose&&M(pM,this).dispose(),C(pM,this,null))}function XM(){M(pM,this)&&"function"==typeof M(pM,this).on&&(C(mM,this,(e=>A(LM,this,JM).call(this,e))),C(vM,this,(e=>A(LM,this,ZM).call(this,e))),M(pM,this).on(iv.TRACK_UNDERFLOW,M(mM,this)),M(pM,this).on(iv.TRACK_READY,M(vM,this)))}function YM(){M(lM,this)&&"function"==typeof M(lM,this).on&&(C(MM,this,(e=>A(LM,this,QM).call(this,e))),M(lM,this).on(iv.CLOCK_TICK,M(MM,this)))}function QM(e){var t,n;A(LM,this,sF).call(this),A(LM,this,MF).call(this),null!==(t=M(PM,this))&&void 0!==t&&null!==(n=t.handleTimeUpdate)&&void 0!==n&&n.call(t,this.currentTime,{isSeeking:!1}),A(LM,this,rF).call(this,this.currentTime),this.trigger(iv.TIMELINE_TIME_UPDATE,rv(this.currentTime,"clock")),M(oM,this)&&"function"==typeof M(oM,this).handleClockTick&&M(oM,this).handleClockTick(e)}function JM(e){A(LM,this,sF).call(this);const t=A(LM,this,eF).call(this);t&&(null==e?void 0:e.trackType)===t.trackType&&(M(oM,this)&&"function"==typeof M(oM,this).handleMainTrackUnderflow?M(oM,this).handleMainTrackUnderflow(e):this.transitionTo(uv))}function ZM(e){if(A(LM,this,sF).call(this),this.state!==uv)return;const t=A(LM,this,eF).call(this);if(!t)return;if((null==e?void 0:e.trackType)!==t.trackType)return;if(M(oM,this)&&"function"==typeof M(oM,this).handleMainTrackReady)return void M(oM,this).handleMainTrackReady(e);const n=this.getLastStableState()||dv;this.transitionTo(n)}function eF(e=this.currentTime){const t=A(LM,this,nF).call(this,e);if(!t)return;const n=M(rM,this)&&"function"==typeof M(rM,this).get?M(rM,this).get(t.nodeId):void 0;if(!n)return;const i=A(LM,this,tF).call(this,n);return i?{placement:t,trackType:i}:void 0}function tF(e){var t;const n=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[];let i;if(null!=e&&e.mainTrackId){const t=n.find((t=>(null==t?void 0:t.id)===e.mainTrackId));i=null==t?void 0:t.type}if(i||(i=null===(t=n.find((e=>null==e?void 0:e.type)))||void 0===t?void 0:t.type),"video"===i||"audio"===i||"image"===i)return i}function nF(e=this.currentTime){const t=M(uM,this)||[];let n;for(let i=0;i<t.length;i+=1){const r=t[i],o=sm(r);if(!Number.isFinite(o))continue;const s=A(LM,this,uF).call(this,r);if(Number.isFinite(s)){if(e>=o&&e<o+s)return r}else if(e<=o)return r;!n&&e<o&&(n=r)}return n}function iF(e={}){if(this.state!==lv)return;const t=null==e?void 0:e.placementId;if(!t)return;const n=A(LM,this,PF).call(this,t);n&&A(LM,this,oF).call(this,n)}function rF(e=this.currentTime){if(this.state!==lv)return;const t=A(LM,this,NF).call(this,e);Array.isArray(t)&&t.length&&t.forEach((e=>A(LM,this,oF).call(this,e)))}function oF(e){const t=null==e?void 0:e.placementId;if(!t)return;if(M(bM,this).has(t))return;if(!e||!0!==e.loop)return;if(!e.nodeId)return;const n=A(LM,this,uF).call(this,e);if(!Number.isFinite(n)||n<=0)return;const i=sm(e);if(!Number.isFinite(i))return;const r=i+n;if(!Number.isFinite(r))return;const o=e.loopRootPlacementId||e.placementId,s=Number.isFinite(e.loopRootOffset)?e.loopRootOffset:i;M(bM,this).add(t),this.placeOnTimeline(e.nodeId,r,{nodeOffsetOverride:e.nodeOffsetOverride,nodeDurationOverride:e.nodeDurationOverride,loop:!0,loopRootPlacementId:o,loopRootOffset:s})}function sF(){const e=cm(M(uM,this),{getPlacementDuration:e=>A(LM,this,uF).call(this,e),snapPlacementOffset:(e,t)=>A(LM,this,dF).call(this,e,{nodeOffsetOverride:null==t?void 0:t.nodeOffsetOverride}),onResolvedPlacement:(e,t)=>{!0!==e.loop||Number.isFinite(e.loopRootOffset)||(e.loopRootOffset=e.offset),A(LM,this,pF).call(this,null==t?void 0:t.nodeId)}});return e.updated&&(A(LM,this,yF).call(this),e.resolvedPlacements.forEach((e=>{A(LM,this,kF).call(this,e),this.trigger(iv.PLACEMENT_ADDED,e)}))),e.updated}function aF(){if(!M(hM,this).length||!M(uM,this).length)return!1;const e=new Map;M(uM,this).forEach((t=>{(null==t?void 0:t.placementId)&&e.set(t.placementId,t)}));const t=M(hM,this).filter((e=>!0===(null==e?void 0:e.offsetPending)));if(!t.length)return!1;let n=!1;const i=[];for(let r=0;r<t.length;r+=1){const o=t[r];A(LM,this,lF).call(this,o,e)&&(n=!0,i.push(o))}return n&&(lm(M(hM,this)),i.forEach((e=>{this.trigger(iv.RENDER_PLACEMENT_ADDED,e)}))),n}function lF(e,t){const n=null==e?void 0:e.offsetAnchorPlacementId,i=null==e?void 0:e.offsetAnchorEdge;if(!n||!i)return!1;const r=t.get(n);if(!r||!0===r.offsetPending)return!1;const o=A(LM,this,cF).call(this,r,e);if(!Number.isFinite(o))return!1;e.offset=o,e.offsetPending=!1,e.offsetAnchorPlacementId=void 0,e.offsetAnchorEdge=void 0,e.offsetAnchorIsReference=void 0;const s=e.offset,a=e.offset+e.duration;return fm(M(hM,this).filter((t=>t!==e&&!0!==(null==t?void 0:t.offsetPending))),s,a,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements"),A(LM,this,pF).call(this,null==r?void 0:r.nodeId),!0}function cF(e,t){const n=sm(e);if(!Number.isFinite(n))return;if("start"===t.offsetAnchorEdge)return A(LM,this,dF).call(this,n);const i=A(LM,this,uF).call(this,e);if(!(i>0))return;const r=n+i;if(!Number.isFinite(r))return;const o=A(LM,this,dF).call(this,r);return!0===t.offsetAnchorIsReference?Math.max(o,r):o}function uF(e){return rm(e,M(rM,this))}function dF(e,t={}){var n;return function(e,t={},n){const i=Number(n);if(!(i>0))return e;const r=Number(e);if(!Number.isFinite(r))return e;const o=Number.isFinite(null==t?void 0:t.nodeOffsetOverride)?t.nodeOffsetOverride:0,s=r-o;return Math.round(s*i)/i+o}(e,t,null===(n=this.settings)||void 0===n?void 0:n.snapToFps)}function hF(e,t={}){const n=hm(e);if("string"==typeof e&&e.includes("@")&&!n)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");if(!n){const n=um(e);return{offset:A(LM,this,dF).call(this,n,t)}}const i=M(uM,this).find((e=>(null==e?void 0:e.placementId)===n.placementId));if(!i)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");const r=sm(i);if("start"===n.anchor)return Number.isFinite(r)?{offset:A(LM,this,dF).call(this,r,t)}:{offset:void 0,offsetPending:!0,offsetAnchorPlacementId:i.placementId,offsetAnchorEdge:"start",offsetAnchorIsReference:!0};const o=A(LM,this,uF).call(this,i);if(!(Number.isFinite(r)&&o>0))return{offset:void 0,offsetPending:!0,offsetAnchorPlacementId:i.placementId,offsetAnchorEdge:"end",offsetAnchorIsReference:!0};const s=r+o,a=A(LM,this,dF).call(this,s,t);return{offset:Math.max(a,s)}}function fF(e){if(!e||!M(rM,this)||"function"!=typeof M(rM,this).get)return;if(M(kM,this).has(e))return;let t;try{t=M(rM,this).get(e)}catch(e){return}if(!t||"function"!=typeof t.on)return;if("ready"===t.state&&t.duration>0)return void this.updateTime(this.currentTime);const n=()=>{this.updateTime(this.currentTime),A(LM,this,pF).call(this,e)};t.on(iv.NODE_LOADED,n),M(kM,this).set(e,n)}function pF(e){if(!e)return;if(A(LM,this,mF).call(this,e))return;const t=M(kM,this).get(e);if(!t)return;let n;try{n=M(rM,this).get(e)}catch(e){n=null}n&&"function"==typeof n.off&&n.off(iv.NODE_LOADED,t),M(kM,this).delete(e)}function mF(e){if(!e)return!1;const t=new Map;M(uM,this).forEach((e=>{(null==e?void 0:e.placementId)&&t.set(e.placementId,e)}));const n=n=>{if(null==n||!n.offsetPending||null==n||!n.offsetAnchorPlacementId)return!1;const i=t.get(n.offsetAnchorPlacementId);return(null==i?void 0:i.nodeId)===e};return!!M(uM,this).some((e=>n(e)))||!!M(hM,this).some((e=>n(e)))}function vF(){M(kM,this).size&&M(rM,this)?(M(kM,this).forEach(((e,t)=>{let n;try{n=M(rM,this).get(t)}catch(e){n=null}n&&"function"==typeof n.off&&n.off(iv.NODE_LOADED,e)})),M(kM,this).clear()):M(kM,this).clear()}function gF(){C(wM,this,[]),C(xM,this,0),M(_M,this).clear(),M(TM,this).clear(),C(IM,this,Number.NEGATIVE_INFINITY)}function yF(){C(EM,this,[]),C(AM,this,0),C(SM,this,Number.NEGATIVE_INFINITY)}function bF(e,t){const n=M(wM,this),i={placementId:e,endTime:t};if(!n.length||t>=n[n.length-1].endTime)return void n.push(i);const r=n.findIndex((e=>t<e.endTime)),o=-1===r?n.length:r;n.splice(o,0,i),o<M(xM,this)&&C(xM,this,M(xM,this)+1)}function kF(e){const t=null==e?void 0:e.placementId;if(!t||M(_M,this).has(t))return;const n=sm(e),i=A(LM,this,uF).call(this,e);if(!Number.isFinite(n)||!Number.isFinite(i)||i<0)return void M(TM,this).add(t);const r=n+i;Number.isFinite(r)&&(M(_M,this).add(t),M(TM,this).delete(t),A(LM,this,bF).call(this,t,r))}function wF(){M(TM,this).size&&Array.from(M(TM,this)).forEach((e=>{const t=A(LM,this,PF).call(this,e);t?A(LM,this,kF).call(this,t):M(TM,this).delete(e)}))}function xF(e){const t=Number(e);if(!Number.isFinite(t))return;if(t<M(IM,this))return void C(IM,this,t);if(C(IM,this,t),A(LM,this,wF).call(this),!M(wM,this).length)return;const n=new Set;let i=M(xM,this);for(;i<M(wM,this).length;){const e=M(wM,this)[i];if(!e||!Number.isFinite(e.endTime)||e.endTime>t)break;e.placementId&&n.add(e.placementId),i+=1}i!==M(xM,this)&&(C(xM,this,i),n.size&&(A(LM,this,IF).call(this,n),A(LM,this,_F).call(this,n)))}function _F(e){if(e&&e.size)for(const t of M(yM,this)){const n=t.split(":")[0];e.has(n)&&M(yM,this).delete(t)}}function TF(e){const t=Array.isArray(null==e?void 0:e.frames)?e.frames:[],n=null==e?void 0:e.current;(n?[n,...t]:t).forEach((e=>{const t=null==e?void 0:e.frame;if(t&&"function"==typeof t.close)try{t.close()}catch(e){}}))}function IF(e){if(e&&e.size)for(const[t,n]of M(FM,this).entries())e.has(null==n?void 0:n.placementId)&&(A(LM,this,TF).call(this,n),M(FM,this).delete(t))}function EF(e={}){var t;const n=null==e?void 0:e.placementId,i=null==e?void 0:e.nodeId,r=null==e?void 0:e.trackId,o=null==e?void 0:e.segmentId,s=null==e?void 0:e.trackType;if(!(n&&i&&r&&o))return;if("video"!==s&&"image"!==s)return;const a=(null==e?void 0:e.frame)||(null==e?void 0:e.data);if(!a)return;"video"===s&&"object"==typeof a&&"function"==typeof a.close&&(a.__keepOpen=!0);const l=DN(a),c=Number.isFinite(null==l?void 0:l.width)?l.width:void 0,u=Number.isFinite(null==l?void 0:l.height)?l.height:void 0,d=Number.isFinite(null==e?void 0:e.pts)?e.pts:void 0;if(!Number.isFinite(d))return;const h=Number.isFinite(null==e?void 0:e.duration)?e.duration:void 0,f=`${n}:${r}`,p=M(FM,this).get(f),m=p||{placementId:n,nodeId:i,trackId:r,trackType:s,frames:[],current:void 0},v={placementId:n,nodeId:i,trackId:r,segmentId:o,frame:a,width:c,height:u,presentationTime:d,duration:h},g=m.frames,y=g.length?g[g.length-1]:void 0;if(!y||y.presentationTime<=v.presentationTime)g.push(v);else{let e=g.findIndex((e=>e.presentationTime>v.presentationTime));-1===e&&(e=g.length),g.splice(e,0,v)}const b=Number(null===(t=this.settings)||void 0===t?void 0:t.maxBufferedVideoFrames);if("video"===s&&Number.isFinite(b)&&b>0&&g.length>b){const e=g.length-b;for(let t=0;t<e;t+=1){const e=g.pop(),t=null==e?void 0:e.frame;if(t&&"function"==typeof t.close)try{t.close()}catch(e){}}}p||M(FM,this).set(f,m)}function SF(){for(const e of M(FM,this).values())A(LM,this,TF).call(this,e);M(FM,this).clear(),C(CM,this,null),M(yM,this).clear()}function AF(e){const t=Number.isFinite(e)?e:this.currentTime;if(!Number.isFinite(t))return;t<M(SM,this)&&(C(EM,this,[]),C(AM,this,0));const n=Array.isArray(M(uM,this))?M(uM,this):[],i=[],r=new Set;M(EM,this).forEach((e=>{A(LM,this,zF).call(this,e,t)&&(i.push(e),(null==e?void 0:e.placementId)&&r.add(e.placementId))}));let o=M(AM,this);for(;o<n.length;){const e=n[o],s=sm(e);if(!Number.isFinite(s))break;if(s>t)break;if(A(LM,this,zF).call(this,e,t)){const t=null==e?void 0:e.placementId;t&&r.has(t)||(i.push(e),t&&r.add(t))}o+=1}C(EM,this,i),C(AM,this,o),C(SM,this,t)}function NF(e,t={}){const n=Number.isFinite(e)?e:this.currentTime,i=Number.isFinite(null==t?void 0:t.endEpsilonSeconds)?t.endEpsilonSeconds:0;return 0===i&&n===this.currentTime&&n===M(SM,this)?M(EM,this).slice():(Array.isArray(M(uM,this))?M(uM,this):[]).filter((e=>A(LM,this,zF).call(this,e,n,i)))}function MF(){const e=this.currentTime,t=A(LM,this,CF).call(this,e);if(!t.length)return void C(CM,this,null);const n=this.getActiveRenderPlacement(e),i=A(LM,this,OF).call(this,t,n);(i!==M(CM,this)||A(LM,this,FF).call(this,e,n))&&(C(CM,this,i),this.trigger(iv.VISUAL_FRAMES_AVAILABLE,{time:e,frames:t}))}function FF(e,t){const n=t||this.getActiveRenderPlacement(e);if(!n)return!1;if(!Nm.doesRenderNodeTypeRequireFrameCadence(null==n?void 0:n.type))return!1;const i=n.duration;return"number"==typeof i&&i>0}function CF(e){return function(e={}){const t=e.buffers,n=e.time,i=e.getPlacementById,r=e.isPlacementActiveAtTime,o=e.getPlacementDuration,s=[];if(!t||"function"!=typeof t.entries)return[];const a=[];for(const[e,c]of t.entries()){const t=null==c?void 0:c.placementId,u="function"==typeof i?i(t):void 0;if(!u){FN(c),a.push(e);continue}if("function"==typeof r&&!r(u,n)){const t=CN(u),i="function"==typeof o?o(u):void 0;Number.isFinite(i)&&Number.isFinite(t)&&n>=t+i&&(FN(c),a.push(e));continue}const d=Array.isArray(null==c?void 0:c.frames)?c.frames:[];for(;d.length&&Number.isFinite(null===(l=d[0])||void 0===l?void 0:l.presentationTime)&&d[0].presentationTime<=n;){var l;const e=c.current,t=d.shift();c.current=t,e&&e!==t&&MN(null==e?void 0:e.frame)}if(!c.current)continue;const h={placementId:t,nodeId:c.current.nodeId,trackId:c.current.trackId,segmentId:c.current.segmentId,frame:c.current.frame,width:c.current.width,height:c.current.height,presentationTime:c.current.presentationTime,duration:c.current.duration};s.push({frame:h,placementId:t,placementOffset:CN(u),placementSortOffset:ON(u),placementSortId:PN(u,t)})}return a.forEach((e=>{t.delete(e)})),s.sort(((e,t)=>{const n=Number.isFinite(null==e?void 0:e.placementSortOffset)?e.placementSortOffset:Number.isFinite(null==e?void 0:e.placementOffset)?e.placementOffset:0,i=Number.isFinite(null==t?void 0:t.placementSortOffset)?t.placementSortOffset:Number.isFinite(null==t?void 0:t.placementOffset)?t.placementOffset:0;if(n!==i)return n-i;const r=(null==e?void 0:e.placementSortId)||(null==e?void 0:e.placementId),o=(null==t?void 0:t.placementSortId)||(null==t?void 0:t.placementId),s=RN(r),a=RN(o);return Number.isFinite(s)&&Number.isFinite(a)&&s!==a?s-a:r&&o&&r!==o?r<o?-1:1:function(e,t){const n=(null==e?void 0:e.frame)||{},i=(null==t?void 0:t.frame)||{};return n.trackId!==i.trackId?n.trackId<i.trackId?-1:1:n.nodeId!==i.nodeId?n.nodeId<i.nodeId?-1:1:n.segmentId!==i.segmentId?n.segmentId<i.segmentId?-1:1:("number"==typeof n.presentationTime?n.presentationTime:0)-("number"==typeof i.presentationTime?i.presentationTime:0)}(e,t)})),s.map((e=>e.frame))}({buffers:M(FM,this),time:e,getPlacementById:e=>A(LM,this,PF).call(this,e),isPlacementActiveAtTime:(e,t)=>A(LM,this,zF).call(this,e,t),getPlacementDuration:e=>A(LM,this,uF).call(this,e)})}function OF(e,t){return`${t?`render:${t.renderPlacementId||t.type||"unknown"}`:"render:default"}|${e.map((e=>`${e.nodeId}:${e.trackId}:${e.segmentId}@${e.presentationTime}`)).join("|")}`}function PF(e){if(e)return(M(uM,this)||[]).find((t=>(null==t?void 0:t.placementId)===e))}function RF(e){if("end"===e){const e=A(LM,this,DF).call(this);if(!Number.isFinite(e))return;const t=A(LM,this,LF).call(this);return Math.max(0,e-Math.min(e,t))}const t=Number(e);return Number.isFinite(t)?t:0}function DF(){let e;return(Array.isArray(M(uM,this))?M(uM,this):[]).forEach((t=>{const n=sm(t);if(!Number.isFinite(n))return;const i=A(LM,this,uF).call(this,t);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(e)||r>e)&&(e=r)})),e}function LF(){const e=A(LM,this,BF).call(this);return e>0?e:.001}function BF(){var e;const t=Number(null===(e=this.settings)||void 0===e?void 0:e.snapToFps);return!Number.isFinite(t)||t<=0?0:.5/t}function zF(e,t,n=0){if(!am(e,t,M(rM,this)))return!1;const i=Number(n);if(!Number.isFinite(i)||i<=0)return!0;const r=A(LM,this,uF).call(this,e);if(!Number.isFinite(r))return!0;const o=sm(e);return!Number.isFinite(o)||t<o+r-i}var WF=new WeakMap,$F=new WeakMap,jF=new WeakMap,UF=new WeakMap,qF=new WeakMap,VF=new WeakMap,GF=new WeakMap,HF=new WeakMap,KF=new WeakMap,XF=new WeakMap,YF=new WeakMap,QF=new WeakMap,JF=new WeakMap,ZF=new WeakMap,eC=new WeakMap,tC=new WeakMap,nC=new WeakMap,iC=new WeakSet;class rC extends od{get name(){return"QoE"}get defaults(){return{calcScoreInterval:1,streamQualityWeight:.8,fpsWeight:.2,fpsMathFuncType:"quad",bestFpsMobile:27,bestFpsDesktop:57,waitingMultiplier:1,statusFloors:{excellent:.98,good:.85,fair:.7,poor:0,alert:0},alertStatusCeil:.3,fpsGracePeriod:2,windowSeconds:30}}constructor(...e){super(...e),O(this,iC),F(this,WF,void 0),F(this,$F,void 0),F(this,jF,1),F(this,UF,1),F(this,qF,1),F(this,VF,""),F(this,GF,0),F(this,HF,[]),F(this,KF,null),F(this,XF,void 0),F(this,YF,[]),F(this,QF,null),F(this,JF,null),F(this,ZF,0),F(this,eC,0),F(this,tC,0),F(this,nC,void 0);const[t]=e;C(WF,this,t),C(ZF,this,oy()),C(nC,this,A(iC,this,oC).call(this)),A(iC,this,sC).call(this),A(iC,this,aC).call(this),A(iC,this,hC).call(this),A(iC,this,uC).call(this)}get publicAPI(){return M(nC,this)}calcScore(){A(iC,this,wC).call(this)}onDispose(){M(WF,this)&&M($F,this)&&"function"==typeof M(WF,this).off&&M(WF,this).off(iv.TIMELINE_PLAYER_STATE,M($F,this)),C($F,this,null),A(iC,this,dC).call(this),A(iC,this,fC).call(this),C(WF,this,null),C(YF,this,[]),C(HF,this,[]),C(nC,this,null)}}function oC(){const e=this;return{get score(){return M(jF,e)},get status(){return M(VF,e)},get streamQualityScore(){return M(UF,e)},get fpsScore(){return M(qF,e)},get browserFps(){return M(GF,e)},get waitingSeconds(){return M(eC,e)/1e3},get playingSeconds(){return M(tC,e)/1e3}}}function sC(){Number(this.settings.streamQualityWeight)+Number(this.settings.fpsWeight)!==1&&(this.log.warn("QoE weights must sum to 1; resetting to legacy defaults."),this.settings.streamQualityWeight=.8,this.settings.fpsWeight=.2)}function aC(){M(WF,this)&&"function"==typeof M(WF,this).on&&(C($F,this,(e=>A(iC,this,lC).call(this,e))),M(WF,this).on(iv.TIMELINE_PLAYER_STATE,M($F,this)))}function lC(e={}){const t="string"==typeof(null==e?void 0:e.event)?e.event:"";"playing"!==t?"waiting"!==t?"pause"!==t&&"seeking"!==t&&"seeked"!==t&&"reset"!==t||A(iC,this,cC).call(this,null):A(iC,this,cC).call(this,"waiting"):A(iC,this,cC).call(this,"playing")}function cC(e){if(e===M(QF,this))return;const t=oy();M(QF,this)&&Number.isFinite(M(JF,this))&&M(YF,this).push({state:M(QF,this),startMs:M(JF,this),endMs:t}),C(QF,this,e),C(JF,this,e?t:null),A(iC,this,vC).call(this,t)}function uC(){const e=Number(this.settings.calcScoreInterval);!Number.isFinite(e)||e<=0||(C(XF,this,(()=>A(iC,this,wC).call(this))),jk(M(XF,this),1e3*e))}function dC(){M(XF,this)&&Uk(M(XF,this)),C(XF,this,null)}function hC(){if("function"!=typeof Ck)return;const e=()=>{if(this._disposed)return;const t=oy();C(GF,this,A(iC,this,pC).call(this,M(HF,this),t)),C(KF,this,Ck(e))};C(KF,this,Ck(e))}function fC(){M(KF,this)&&"function"==typeof Ok&&Ok(M(KF,this)),C(KF,this,null)}function pC(e,t){const n=A(iC,this,mC).call(this);for(e.push(t);e.length&&t-e[0]>n;)e.shift();if(e.length<2)return 0;const i=e[e.length-1]-e[0];return i<=0?0:1e3*(e.length-1)/i}function mC(){const e=Number(this.settings.windowSeconds);return!Number.isFinite(e)||e<=0?3e4:1e3*e}function vC(e){const t=e-A(iC,this,mC).call(this);for(;M(YF,this).length&&M(YF,this)[0].endMs<=t;)M(YF,this).shift()}function gC(e){const t=e-A(iC,this,mC).call(this);let n=0,i=0;const r=(r,o,s)=>{const a=Math.max(o,t),l=Math.min(s,e);l<=a||("waiting"===r?n+=l-a:"playing"===r&&(i+=l-a))};return M(YF,this).forEach((e=>{r(e.state,e.startMs,e.endMs)})),M(QF,this)&&Number.isFinite(M(JF,this))&&r(M(QF,this),M(JF,this),e),C(eC,this,n),C(tC,this,i),{waitingMs:n,playingMs:i}}function yC(e,t){if(e<=0)return 1;if(e>t)return 0;const n=t||1;return nm(1-e*this.settings.waitingMultiplier/n)}function bC(){if(oy()-M(ZF,this)<=1e3*this.settings.fpsGracePeriod)return 1;const e=Number(M(GF,this)),t=tv.isDesktop()?this.settings.bestFpsDesktop:this.settings.bestFpsMobile,n=nm(t>0?e/t:0);return"quad"===this.settings.fpsMathFuncType?n*n:n}function kC(e,t){const n=this.settings.statusFloors||{};let i="";return e>=n.excellent?i="excellent":e>=n.good?i="good":e>=n.fair?i="fair":(i="poor",e<=this.settings.alertStatusCeil&&t>0&&(i="alert")),i}function wC(){const e=oy(),{waitingMs:t,playingMs:n}=A(iC,this,gC).call(this,e),i=A(iC,this,yC).call(this,t,n),r=A(iC,this,bC).call(this),o=nm(i*this.settings.streamQualityWeight+r*this.settings.fpsWeight);o!==M(jF,this)&&(C(jF,this,o),this.trigger(iv.QOE_SCORE,o)),C(UF,this,i),C(qF,this,r);const s=A(iC,this,kC).call(this,o,t);s!==M(VF,this)&&(C(VF,this,s),this.trigger(iv.QOE_STATUS,s))}function xC(e,t=0){const n=Number(e);return Number.isFinite(n)?n:t}function _C(e){const t=Number(e);return!Number.isFinite(t)||t<0?0:t}var TC=new WeakMap,IC=new WeakMap,EC=new WeakMap,SC=new WeakMap,AC=new WeakSet;class NC extends od{get name(){return"SegmentEvictionCoordinator"}get defaults(){return{enabled:xy("segmentEvictionEnabled"),bufferBehindSeconds:xy("segmentEvictionBufferBehindSeconds"),bufferAheadSeconds:xy("segmentEvictionBufferAheadSeconds"),maxRetainedBytes:xy("segmentEvictionMaxRetainedBytes")}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"evictAtTime"])}constructor(e,t,n={}){super(n),O(this,AC),F(this,TC,void 0),F(this,IC,void 0),F(this,EC,void 0),F(this,SC,void 0),C(TC,this,e),C(IC,this,t),C(EC,this,(e=>A(AC,this,MC).call(this,e))),C(SC,this,(e=>A(AC,this,FC).call(this,e))),M(TC,this)&&"function"==typeof M(TC,this).on&&(M(TC,this).on(iv.TIMELINE_TIME_UPDATE,M(EC,this)),M(TC,this).on(iv.TIMELINE_SEEKED,M(SC,this)))}onDispose(){M(TC,this)&&"function"==typeof M(TC,this).off&&(M(TC,this).off(iv.TIMELINE_TIME_UPDATE,M(EC,this)),M(TC,this).off(iv.TIMELINE_SEEKED,M(SC,this))),C(TC,this,null),C(IC,this,null),C(EC,this,null),C(SC,this,null)}evictAtTime(e){if(!0!==this.settings.enabled)return;const t=Number(e);if(!Number.isFinite(t))return;const n=_C(this.settings.bufferBehindSeconds),i=_C(this.settings.bufferAheadSeconds),r=t-n,o=t+i,s=A(AC,this,CC).call(this);if(!s.length)return;const a=Number(this.settings.maxRetainedBytes);if(Number.isFinite(a)&&a>0&&A(AC,this,OC).call(this,s)<=a)return;const l=new Map;s.forEach((e=>{const t=null==e?void 0:e.nodeId;if(!t)return;const n=sm(e);if(!Number.isFinite(n))return;const i=l.get(t)||[];i.push(e),l.set(t,i)})),l.size&&l.forEach(((e,t)=>{const n=A(AC,this,PC).call(this,t);if(!n)return;const i=e.filter((e=>A(AC,this,RC).call(this,e,r,o)));i.length?A(AC,this,DC).call(this,n,i,r,o):"function"==typeof n.evict&&n.evict()}))}}function MC(e){var t,n;if(!0!==this.settings.enabled)return;if((null===(t=M(TC,this))||void 0===t?void 0:t.state)===hv)return;const i=Number(null==e?void 0:e.time),r=Number.isFinite(i)?i:Number(null===(n=M(TC,this))||void 0===n?void 0:n.currentTime);this.evictAtTime(r)}function FC(e){var t;if(!0!==this.settings.enabled)return;const n=Number(null==e?void 0:e.targetTime),i=Number.isFinite(n)?n:Number(null===(t=M(TC,this))||void 0===t?void 0:t.currentTime);this.evictAtTime(i)}function CC(){var e;const t=null===(e=M(TC,this))||void 0===e?void 0:e.placements;return Array.isArray(t)?t:[]}function OC(e){if(!Array.isArray(e)||!e.length)return 0;const t=new Set;let n=0;return e.forEach((e=>{const i=null==e?void 0:e.nodeId;if(!i||t.has(i))return;t.add(i);const r=A(AC,this,PC).call(this,i),o=Number(null==r?void 0:r.retainedByteLength);Og(o)?n+=o:(Array.isArray(null==r?void 0:r.tracks)?r.tracks:[]).forEach((e=>{(Array.isArray(null==e?void 0:e.segments)?e.segments:[]).forEach((e=>{Og(null==e?void 0:e.retainedByteLength)&&(n+=e.retainedByteLength)}))}))})),n}function PC(e){if(M(IC,this)&&"function"==typeof M(IC,this).get)return M(IC,this).get(e)}function RC(e,t,n){const i=sm(e);if(!Number.isFinite(i))return!1;const r=rm(e,M(IC,this));return(Number.isFinite(r)?i+r:Number.POSITIVE_INFINITY)>t&&i<n}function DC(e,t,n,i){const r=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[];r.length&&r.forEach((e=>{const r=Array.isArray(null==e?void 0:e.segments)?e.segments:[],o=xC(null==e?void 0:e.offset,0);r.forEach((e=>{if(!e||!Og(null==(r=e)?void 0:r.retainedByteLength))return;var r;if(e.isInit)return;let s=!1;for(let r=0;r<t.length;r+=1){const a=t[r],l=sm(a);if(!Number.isFinite(l))continue;const c=xC(null==a?void 0:a.nodeOffsetOverride,0),u=xC(null==e?void 0:e.offset,NaN);if(!Number.isFinite(u))continue;const d=xC(null==e?void 0:e.duration,0),h=l+o+u-c,f=h+(d>0?d:0),p=rm(a,M(IC,this)),m=Number.isFinite(p)?l+p:Number.POSITIVE_INFINITY;if(!(f<=l||h>=m||f<=n||h>=i)){s=!0;break}}s||e.evict()}))}))}var LC=new WeakMap,BC=new WeakMap,zC=new WeakMap,WC=new WeakSet;let $C=class extends od{get name(){return"DocumentVisibility"}get defaults(){return{autoPauseOnVisibilityChange:!0,autoResumeOnVisibilityChange:!0}}constructor(e,t={}){super(t),O(this,WC),F(this,LC,void 0),F(this,BC,null),F(this,zC,!1),C(LC,this,e),A(WC,this,jC).call(this)}onDispose(){A(WC,this,UC).call(this),C(LC,this,null),C(zC,this,!1)}};function jC(){const e=null==ld?void 0:ld.document;e&&"function"==typeof e.addEventListener&&(C(BC,this,(()=>A(WC,this,qC).call(this))),e.addEventListener("visibilitychange",M(BC,this)))}function UC(){const e=null==ld?void 0:ld.document;M(BC,this)&&e&&"function"==typeof e.removeEventListener&&e.removeEventListener("visibilitychange",M(BC,this)),C(BC,this,null)}function qC(){const e=null==ld?void 0:ld.document,t=null==e?void 0:e.visibilityState;"string"==typeof t&&("hidden"!==t?"visible"===t&&A(WC,this,GC).call(this):A(WC,this,VC).call(this))}function VC(){var e;(null===(e=this.settings)||void 0===e?void 0:e.autoPauseOnVisibilityChange)&&M(LC,this)&&"function"==typeof M(LC,this).pause&&(M(LC,this).state===lv?(this.log.info("[#handleHidden] Pausing timeline due to document visibility change"),M(LC,this).pause(),C(zC,this,!0)):C(zC,this,!1))}function GC(){var e;M(zC,this)&&(null===(e=this.settings)||void 0===e?void 0:e.autoResumeOnVisibilityChange)&&M(LC,this)&&"function"==typeof M(LC,this).play&&(M(LC,this).state!==lv?(this.log.info("[#handleVisible] Resuming timeline due to document visibility change"),M(LC,this).play(),C(zC,this,!1)):C(zC,this,!1))}const HC=[{event:"canplay",once:!0,trackAs:"canplay"},{event:"playing",once:!0,trackAs:"startedplaying"},"play","playing","waiting","pause","seeking","seeked","nodestart","nodeend"];function KC(e,t=0){return Number.isFinite(e)?e:t}function XC(e){const t=null==e?void 0:e.exposedPlayerAPI;return t&&"object"==typeof t?t:e}const YC=[function(e){return{schema:"iglu:com.helloeko/player/jsonschema/1-0-7",match:/^.*$/,getData:()=>{var t,n,i;const r=function(e){const t=null==e?void 0:e.exposedPlayerAPI;return t&&"object"==typeof t?t:e}(e);return{playerversion:"string"==typeof(null==r?void 0:r.version)?r.version:"0.0.0",isautoplay:!(null==r||null===(t=r.options)||void 0===t||!t.autoplay),playerqoe:KC(null==r||null===(n=r.qoe)||void 0===n?void 0:n.score),playerqoestatus:"string"==typeof(null==r||null===(i=r.qoe)||void 0===i?void 0:i.status)?r.qoe.status:"",ismuted:!(null==r||!r.muted),playervolume:KC(null==r?void 0:r.volume),playercontainerwidth:KC(null==r?void 0:r.containerWidth),playercontainerheight:KC(null==r?void 0:r.containerHeight)}}}},function(e){return{schema:"iglu:com.helloeko/currentnode/jsonschema/1-0-2",match:/^.*$/,getData:()=>{var t;const n=XC(e),i=function(e){const t=XC(e);if(!t||"function"!=typeof t.getNodesAtTime)return null;const n=Number.isFinite(t.currentTime)?t.currentTime:0,i=t.getNodesAtTime(n);return Array.isArray(i)&&0!==i.length&&i[0]||null}(e);return{currentnodeid:"string"==typeof(null==i?void 0:i.id)?i.id:"",currentnodetime:Number.isFinite(null==n?void 0:n.currentTime)?n.currentTime:0,currentnodeduration:Number.isFinite(null==i?void 0:i.duration)?i.duration:0,currentnodeprofile:"string"==typeof(null==i||null===(t=i.metadata)||void 0===t?void 0:t.profile)?i.metadata.profile:""}}}},function(e){let t=0,n=0;const i=()=>{t||(t=Date.now(),n=0)},r=()=>{t&&!n&&(n=Date.now())};return e&&"function"==typeof e.on&&(e.on("seeking",i),e.on("seeked",r)),{schema:"iglu:com.helloeko/seeked/jsonschema/1-0-0",match:"seeked",getData:()=>{r();const e=t&&n&&n>=t?(n-t)/1e3:0;return t=0,n=0,{seekduration:e}},dispose:()=>{e&&"function"==typeof e.off&&(e.off("seeking",i),e.off("seeked",r))}}},function(){return{schema:"iglu:com.helloeko/environment/jsonschema/1-0-0",match:/^.*$/,getData:()=>{var e;const t=null==ld||null===(e=ld.eko)||void 0===e||null===(e=e.environment)||void 0===e?void 0:e.embeddingApp;return t?{embeddingapp:t}:{}}}}],QC=Object.freeze({once:!1,trackAs:""});var JC=new WeakMap,ZC=new WeakMap,eO=new WeakMap,tO=new WeakMap,nO=new WeakMap,iO=new WeakMap,rO=new WeakSet;class oO extends od{get name(){return"Tracker"}get defaults(){return{tag:null,trackingEnabled:xy("trackingEnabled"),defaultForwarders:HC,defaultContextPackers:YC}}constructor(e,t={}){var n,i;super(t),O(this,rO),F(this,JC,void 0),F(this,ZC,new Map),F(this,eO,[]),F(this,tO,!1),F(this,nO,void 0),F(this,iO,void 0),C(iO,this,!this.settings.tag),C(nO,this,this.settings.tag||(null===(n=crypto)||void 0===n||null===(i=n.randomUUID)||void 0===i?void 0:i.call(n))||`eko-player-${Date.now()}`),C(JC,this,e),A(rO,this,hO).call(this),A(rO,this,aO).call(this)}track(e,...t){if(!this.settings.trackingEnabled)return;if("string"!=typeof e||!e)return void this.log.warn("[track] Expected event to be a non-empty string.");const n=A(rO,this,pO).call(this);n&&n("track",e,...t,M(nO,this))}registerContextPacker(e){if(!e||"object"!=typeof e)return void this.log.warn("[registerContextPacker] Expected a packer object.");const t={tag:M(nO,this),schema:e.schema,match:e.match,getData:A(rO,this,sO).call(this,e.getData)};if("string"!=typeof t.schema||!t.schema)return void this.log.warn('[registerContextPacker] Expected "schema" to be a non-empty string.');if("function"!=typeof t.getData)return void this.log.warn('[registerContextPacker] Expected "getData" to be a function.');if(!this.settings.trackingEnabled)return;const n=A(rO,this,pO).call(this);n&&n("registerContextPacker",t)}onDispose(){if(A(rO,this,dO).call(this),A(rO,this,fO).call(this),C(JC,this,null),M(iO,this)){const e=A(rO,this,pO).call(this);e&&(e("reset",M(nO,this)),C(nO,this,null))}}}function sO(e){return"function"!=typeof e?null:(...t)=>t.pop()!==M(nO,this)?null:e(...t)}function aO(){(Array.isArray(this.settings.defaultForwarders)?this.settings.defaultForwarders:[]).forEach((e=>A(rO,this,lO).call(this,e)))}function lO(e){const t=A(rO,this,cO).call(this,e);if(!t)return void this.log.warn("[#addEventForwarder] Invalid forwarder input.",e);const n=M(JC,this);if(!n||"function"!=typeof n.on)return;const i=A(rO,this,uO).call(this,t);if(M(ZC,this).has(i))return;const r=(...e)=>{t.once&&n&&"function"==typeof n.off&&n.off(t.event,r);const i=t.trackAs||t.event;this.track(i,...e)};n.on(t.event,r),M(ZC,this).set(i,{event:t.event,listener:r})}function cO(e){return"string"==typeof e&&e?{event:e,...QC}:e&&"object"==typeof e&&"string"==typeof e.event&&e.event?{event:e.event,once:!!e.once,trackAs:"string"==typeof e.trackAs?e.trackAs:""}:null}function uO({event:e,once:t,trackAs:n}){return`${e}:${t}:${n}`}function dO(){const e=M(JC,this);e&&"function"==typeof e.off&&M(ZC,this).forEach((({event:t,listener:n})=>{e.off(t,n)})),M(ZC,this).clear()}function hO(){(Array.isArray(this.settings.defaultContextPackers)?this.settings.defaultContextPackers:[]).forEach((e=>{if("function"!=typeof e)return;const t=e(M(JC,this),this);t&&"object"==typeof t&&("function"==typeof t.dispose&&M(eO,this).push(t.dispose),t.disabled||this.registerContextPacker({schema:t.schema,match:t.match,getData:t.getData}))}))}function fO(){M(eO,this).forEach((e=>{try{e()}catch(e){this.log.warn("[#teardownContextPackers] Failed disposing context packer.",e)}})),C(eO,this,[])}function pO(){const e=null==ld?void 0:ld.EkoAnalytics;return"function"==typeof e?e:(A(rO,this,mO).call(this),null)}function mO(){this.settings.trackingEnabled&&!M(tO,this)&&(this.log.warn("EkoAnalytics not found on window."),C(tO,this,!0))}class vO{#E;#re;#oe;#se;#ae;#le;#ce;#ue;#de;#he;#fe;#pe;#me;#ve;#ge;#ye;#be;#ke;#we;constructor(e,t={},n=null){this.#E=new ud(e,t),this.#re=new yd(this.#E,t),this.#oe=new Tk(t),this.#se=new Ny(t),this.#ae=new ok(this.#se,t),this.#le=new ek(this.#ae,this.#oe,t),this.#ce=new fk(this.#le,t),this.#ue=new BM(this.#le,t),this.#de=new $C(this.#ue,t),this.#ke=new NC(this.#ue,this.#le,t),this.#he=new uw(this.#le,this.#ce,this.#oe,this.#ue,t),this.#fe=new Yw(this.#le,this.#ce,this.#ue,t),this.#pe=new sE(t),this.#me=new FE(this.#le,this.#ue,this.#pe,t),this.#ge=new rC(this.#ue,t),this.#we=new oO(n,t);const i=t&&"object"==typeof t?t.adapters:null,r=i&&"object"==typeof i&&"function"==typeof i.renderAdapterFactory?i.renderAdapterFactory:null,o=i&&"object"==typeof i&&"function"==typeof i.audioAdapterFactory?i.audioAdapterFactory:null;this.#ye=r?r({timeline:this.#ue,canvas:this.#E,containerSize:this.#re,options:t}):new Jv(this.#ue,this.#E,this.#re,t),this.#ve=o?o({timeline:this.#ue,decodeCoordinator:this.#me,options:t}):new fA(this.#ue,this.#me,t),this.#be=new OS(this.#ue,this.#ye,t)}get canvas(){return this.#E}get containerSize(){return this.#re}get assetsDeliveryService(){return this.#oe}get downloadSpeed(){return this.#se}get abrSelector(){return this.#ae}get nodeRepository(){return this.#le}get nodePrioritizer(){return this.#ce}get timeline(){return this.#ue}get documentVisibility(){return this.#de}get nodeResolver(){return this.#he}get segmentLoadCoordinator(){return this.#fe}get decoderFactory(){return this.#pe}get parsingManager(){return this.#me}get audioAdapter(){return this.#ve}get audioPlaybackManager(){return this.#ve}get qoe(){return this.#ge}get renderAdapter(){return this.#ye}get renderer(){return this.#ye}get transitionManager(){return this.#be}get tracker(){return this.#we}dispose(){[this.#we,this.#ue,this.#de,this.#fe,this.#he,this.#ce,this.#le,this.#oe,this.#ae,this.#se,this.#me,this.#pe,this.#ve,this.#ge,this.#ye,this.#be,this.#ke,this.#re,this.#E].forEach((e=>{e&&"function"==typeof e.dispose&&e.dispose()})),this.#ue=null,this.#de=null,this.#fe=null,this.#he=null,this.#ce=null,this.#le=null,this.#oe=null,this.#ae=null,this.#se=null,this.#me=null,this.#pe=null,this.#ve=null,this.#ge=null,this.#ye=null,this.#be=null,this.#ke=null,this.#E=null,this.#we=null}}const gO="devops-main.1168767";var yO={isPlainObject:ed,deepMerge:td,get:ty,set:ny,ekoGlobalStore:iy,download:yy,isPositiveNumber:Og,clamp01:nm,root:ld,now:oy,getFrameDimensions:DN,useragent:nv,requestAnimationFrame:Ck,cancelAnimationFrame:Ok,start:jk,stop:Uk,isTicking:qk,predicator:function(e,t){const n=t||{};if("function"!=typeof e)return void Pk.error("[predicator] Bad argument given to predicator, first argument must be a function.",arguments);if(e.apply())return Pk.debug("[predicator] Invoking onFulfilled immediately."),void("function"==typeof n.onFulfilled&&n.onFulfilled.call(null,0));const i=n.timeout||1e4,r=n.interval,o=oy();let s,a,l,c,u;c=function(){e.apply()&&l()},l=function(){Uk(c),ld.clearTimeout(s),u=oy()-o,Pk.debug("[predicator] Invoking onFulfilled after "+u+" ms."),"function"==typeof n.onFulfilled&&n.onFulfilled.call(null,u)},a=function(){Uk(c),u=oy()-o,Pk.debug("[predicator] Invoking onTimeout after "+u+" ms."),"function"==typeof n.onTimeout&&n.onTimeout.call(null,u)},s=ld.setTimeout(a,i),jk(c,r)},createThrottler:Vk,scheduleExecution:Gk},bO=new WeakMap,kO=new WeakMap,wO=new WeakMap,xO=new WeakMap,_O=new WeakMap,TO=new WeakMap,IO=new WeakMap,EO=new WeakSet;class SO{constructor(e){O(this,EO),F(this,bO,[]),F(this,kO,[]),F(this,wO,new tM("placement-")),F(this,xO,new tM("renderplacement-")),F(this,_O,void 0),F(this,TO,new Map),F(this,IO,void 0),C(_O,this,e),C(IO,this,{allowUnready:!0,getNode:e=>A(EO,this,AO).call(this,e)})}get placements(){return M(bO,this).slice()}get renderPlacements(){return M(kO,this).slice()}getNodesAtTime(e){A(EO,this,NO).call(this);const t=A(EO,this,FO).call(this,e);if(!Number.isFinite(t))return[];const n=M(bO,this).filter((e=>am(e,t,null,M(IO,this)))),i=[];return n.forEach((e=>{const t=A(EO,this,AO).call(this,null==e?void 0:e.nodeId);t&&i.push(t)})),i}placeOnTimeline(e,t,n={}){const i=e&&"object"==typeof e?e:null,r=i?i.id:e;if(!r)throw new Error("TimelineDefinition.placeOnTimeline requires node id");i&&M(TO,this).set(r,i);const o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=hm(t);if("string"==typeof t&&t.includes("@")&&!a)throw new Error("TimelineDefinition.placeOnTimeline requires valid placement reference");const{wantsEndOffset:l,endOffsetSeconds:c}=a?{wantsEndOffset:!1}:dm(t,n);let u,d,h,f=!1;const p=null!==a;if(a){const e=M(bO,this).find((e=>(null==e?void 0:e.placementId)===a.placementId));if(!e)throw new Error("TimelineDefinition.placeOnTimeline requires valid placement reference");d=e.placementId,h=a.anchor;const t=sm(e);if("start"===a.anchor)Number.isFinite(t)?u=t:f=!0;else{const n=A(EO,this,MO).call(this,e);Number.isFinite(t)&&n>0?u=t+n:f=!0}}else if(l){const e=n.offsetAnchorPlacementId?M(bO,this).find((e=>(null==e?void 0:e.placementId)===n.offsetAnchorPlacementId)):M(bO,this).length?M(bO,this)[M(bO,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==e?void 0:e.placementId),d){const t=sm(e),n=A(EO,this,MO).call(this,e);Number.isFinite(t)&&n>0?u=t+n-c:(f=!0,h="end")}else u=-c}else u=um(t);const m=M(wO,this).claim(n.placementId),v={placementId:m,nodeId:r,offset:u,offsetPending:f,offsetAnchorPlacementId:f?d:void 0,offsetAnchorEdge:f?h:void 0,offsetAnchorIsReference:f?p:void 0,offsetEndSeconds:l?c:a&&"end"===a.anchor?0:void 0,nodeOffsetOverride:o,nodeDurationOverride:s,loop:!0===n.loop};return M(bO,this).push(v),lm(M(bO,this)),m}placeRenderNodeOnTimeline(e,t,n,i={}){const r="string"==typeof e?e:null==e?void 0:e.type;if(!r||"string"!=typeof r)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires render node type");let o,s,a,l=!1;const c=hm(t);if("string"==typeof t&&t.includes("@")&&!c)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires valid placement reference");const u=null!==c;if(c){const e=M(bO,this).find((e=>(null==e?void 0:e.placementId)===c.placementId));if(!e)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires valid placement reference");s=e.placementId,a=c.anchor;const t=sm(e);if("start"===c.anchor)Number.isFinite(t)?o=t:l=!0;else{const n=A(EO,this,MO).call(this,e);Number.isFinite(t)&&Number.isFinite(n)?o=t+n:l=!0}}else o=um(t);const d=M(xO,this).claim(i.renderPlacementId),h=Number(n),f=h===Number.POSITIVE_INFINITY,p=Number.isFinite(h)&&h>0||f?h:void 0;if(!p)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires a positive duration (seconds) or Infinity as 3rd argument");const m={renderPlacementId:d,type:r,offset:o,offsetPending:l,offsetAnchorPlacementId:l?s:void 0,offsetAnchorEdge:l?a:void 0,offsetAnchorIsReference:l?u:void 0,duration:p,params:i.params&&"object"==typeof i.params?i.params:void 0};if(!l){const e=o,t=o+p;fm(M(kO,this),e,t,"TimelineDefinition.placeRenderNodeOnTimeline does not allow overlapping render nodes")}return M(kO,this).push(m),lm(M(kO,this)),d}}function AO(e){if(e)return M(_O,this)&&"function"==typeof M(_O,this).get?M(_O,this).get(e):M(TO,this).get(e)}function NO(){return cm(M(bO,this),{getPlacementDuration:e=>A(EO,this,MO).call(this,e)}).updated}function MO(e){return rm(e,null,M(IO,this))}function FO(e){if("end"===e){const e=A(EO,this,CO).call(this);if(!Number.isFinite(e))return;return Math.max(0,e-Math.min(e,.001))}const t=Number(e);return Number.isFinite(t)?t:0}function CO(){let e;return M(bO,this).forEach((t=>{const n=sm(t);if(!Number.isFinite(n))return;const i=A(EO,this,MO).call(this,t);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(e)||r>e)&&(e=r)})),e}const OO=new Set(["canplay","play","playing","waiting","pause","seeking","seeked"]);var PO=new WeakMap,RO=new WeakMap,DO=new WeakMap,LO=new WeakMap,BO=new WeakMap,zO=new WeakMap,WO=new WeakMap,$O=new WeakMap,jO=new WeakMap,UO=new WeakMap,qO=new WeakMap,VO=new WeakMap,GO=new WeakMap,HO=new WeakMap,KO=new WeakMap,XO=new WeakMap,YO=new WeakMap,QO=new WeakMap,JO=new WeakMap,ZO=new WeakMap,eP=new WeakMap,tP=new WeakMap,nP=new WeakMap,iP=new WeakMap,rP=new WeakMap,oP=new WeakSet;class sP extends od{get name(){return"EkoPlayer"}get exposedPlayerAPI(){return M(LO,this)}constructor(e,t={}){const{options:n,publicOptions:i}=function(e={}){const t=td({},ky,e);Object.entries(by).forEach((([e,{targetPaths:n}])=>{void 0!==t[e]&&n.forEach((n=>{void 0===ty(t,n)&&ny(t,n,t[e])}))}));const n=function(e){const t={};return Object.keys(by).forEach((n=>{Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})),Object.freeze(t)}(t);return wy.info("Processed options:",t),wy.info("Public options:",n),{options:t,publicOptions:n}}(t);return super(n),O(this,oP),F(this,PO,void 0),F(this,RO,void 0),F(this,DO,void 0),F(this,LO,void 0),F(this,BO,void 0),F(this,zO,void 0),F(this,WO,void 0),F(this,$O,void 0),F(this,jO,void 0),F(this,UO,void 0),F(this,qO,void 0),F(this,VO,void 0),F(this,GO,void 0),F(this,HO,void 0),F(this,KO,void 0),F(this,XO,void 0),F(this,YO,void 0),F(this,QO,void 0),F(this,JO,void 0),F(this,ZO,void 0),F(this,eP,void 0),F(this,tP,void 0),F(this,nP,void 0),F(this,iP,void 0),F(this,rP,0),C(DO,this,i),this.log.info("Initializing EkoPlayer with options:",i),C(VO,this,new vO(e,n,this)),A(oP,this,vP).call(this,M(VO,this)),C(KO,this,(e=>A(oP,this,aP).call(this,e))),M(RO,this)&&"function"==typeof M(RO,this).on&&M(RO,this).on(iv.TIMELINE_CUEPOINT,M(KO,this)),C(XO,this,null),C(QO,this,(e=>A(oP,this,lP).call(this,e))),C(JO,this,(e=>{const t=e&&"object"==typeof e?e:{};A(oP,this,lP).call(this,{...t,event:"seeking"})})),C(ZO,this,(e=>{const t=e&&"object"==typeof e?e:{};A(oP,this,lP).call(this,{...t,event:"seeked"})})),M(RO,this)&&"function"==typeof M(RO,this).on&&(M(RO,this).on(iv.TIMELINE_PLAYER_STATE,M(QO,this)),M(RO,this).on(iv.TIMELINE_SEEKING,M(JO,this)),M(RO,this).on(iv.TIMELINE_SEEKED,M(ZO,this))),C(nP,this,(e=>{const t=e&&"object"==typeof e?e:{};this.trigger(iv.CONTAINER_RESIZE,t)})),M(GO,this)&&"function"==typeof M(GO,this).on&&M(GO,this).on(iv.CONTAINER_RESIZE,M(nP,this)),A(oP,this,hP).call(this),A(oP,this,dP).call(this),C(LO,this,A(oP,this,mP).call(this)),M(LO,this)}onDispose(){M(RO,this)&&"function"==typeof M(RO,this).off&&M(KO,this)&&M(RO,this).off(iv.TIMELINE_CUEPOINT,M(KO,this)),C(KO,this,null),M(RO,this)&&"function"==typeof M(RO,this).off&&(M(QO,this)&&M(RO,this).off(iv.TIMELINE_PLAYER_STATE,M(QO,this)),M(JO,this)&&M(RO,this).off(iv.TIMELINE_SEEKING,M(JO,this)),M(ZO,this)&&M(RO,this).off(iv.TIMELINE_SEEKED,M(ZO,this))),C(QO,this,null),C(JO,this,null),C(ZO,this,null),C(XO,this,null),M(GO,this)&&"function"==typeof M(GO,this).off&&M(nP,this)&&M(GO,this).off(iv.CONTAINER_RESIZE,M(nP,this)),C(nP,this,null),M(qO,this)&&"function"==typeof M(qO,this).off&&(M(eP,this)&&M(qO,this).off("qoescore",M(eP,this)),M(tP,this)&&M(qO,this).off("qoestatus",M(tP,this))),C(eP,this,null),C(tP,this,null),M(UO,this)&&"function"==typeof M(UO,this).off&&M(iP,this)&&M(UO,this).off(iv.DECODER_ERROR,M(iP,this)),C(iP,this,null),C(rP,this,0),M(HO,this)&&"function"==typeof M(HO,this).dispose&&M(HO,this).dispose(),C(HO,this,null),M(VO,this)&&"function"==typeof M(VO,this).dispose&&M(VO,this).dispose(),C(RO,this,null),C(PO,this,null),C(zO,this,null),C(WO,this,null),C($O,this,null),C(jO,this,null),C(UO,this,null),C(qO,this,null),C(GO,this,null),C(BO,this,null),C(LO,this,null),C(VO,this,null)}}function aP(e={}){var t;this.trigger(iv.TIMELINE_CUEPOINT,e);const n="string"==typeof(null==e||null===(t=e.cuepoint)||void 0===t?void 0:t.name)?e.cuepoint.name:"";n&&this.trigger(n,e)}function lP(e={}){const t="string"==typeof(null==e?void 0:e.event)?e.event:"";if(!OO.has(t))return;if("playing"!==t||Number.isFinite(M(YO,this))||(C(YO,this,oy()),this.log.info(`[#handlePlayerStateEvent] Playback started @ ${(M(YO,this)/1e3).toFixed(3)}s (${Date.now()})`)),M(XO,this)===t)return;C(XO,this,t);const n=Number.isFinite(null==e?void 0:e.time)?e.time:M(RO,this)&&Number.isFinite(M(RO,this).currentTime)?M(RO,this).currentTime:0,i={};Number.isFinite(n)&&(i.time=n),"string"==typeof(null==e?void 0:e.from)&&(i.from=e.from),"string"==typeof(null==e?void 0:e.to)&&(i.to=e.to),Number.isFinite(null==e?void 0:e.targetTime)&&(i.targetTime=e.targetTime),Array.isArray(null==e?void 0:e.placements)&&(i.placements=e.placements.slice()),this.trigger(t,i)}function cP(){return new SO(M(PO,this))}function uP(e){if(!e||"object"!=typeof e)throw new Error("EkoPlayer.switchTimeline requires a timeline definition");if(!M(RO,this)||"function"!=typeof M(RO,this).applyTimelineDefinition)throw new Error("EkoPlayer.switchTimeline requires an active timeline");M(RO,this).applyTimelineDefinition(e),"function"==typeof M(RO,this).play&&M(RO,this).play()}function dP(){M(qO,this)&&"function"==typeof M(qO,this).on&&(C(eP,this,(e=>{this.trigger(iv.QOE_SCORE,e)})),C(tP,this,(e=>{this.trigger(iv.QOE_STATUS,e)})),M(qO,this).on(iv.QOE_SCORE,M(eP,this)),M(qO,this).on(iv.QOE_STATUS,M(tP,this)))}function hP(){M(UO,this)&&"function"==typeof M(UO,this).on&&(C(iP,this,(e=>{const t=e&&"object"==typeof e?e:{error:e};this.trigger(iv.DECODER_ERROR,t),A(oP,this,fP).call(this,t)})),M(UO,this).on(iv.DECODER_ERROR,M(iP,this)))}function fP(e={}){var t;const n=M(RO,this);if(!n||"number"!=typeof n.currentTime)return;const i=Date.now();if(i<M(rP,this))return;const r=Number(n.currentTime);if(!Number.isFinite(r))return;const o=Number(null==n||null===(t=n.settings)||void 0===t?void 0:t.snapToFps),s=Number.isFinite(o)&&o>0?1/o:1/60;C(rP,this,i+1500),this.log.warn("[#attemptDecoderRecoverySeek] decoder:error received, attempting seek recovery",null==e?void 0:e.error),n.currentTime=r+s}async function pP(e={}){var t;if(M(HO,this))return M(HO,this);const n=e&&"object"==typeof e&&!Array.isArray(e)?{...e}:{},i=M(BO,this)&&M(BO,this).element?M(BO,this).element:null;if(!i)throw new Error("Debug overlay requires an initialized player canvas and mount element.");const r=function({canvasElement:e,containerElement:t}={}){const n=e&&e.parentNode?e.parentNode:null;if(null==t)return n;const i=function(e,t=(null==ld?void 0:ld.document)){if(cd(e))return e;if("string"!=typeof e)return null;let n=e.trim();if("#"===n.charAt(0)&&(n=n.slice(1)),!n||!t||"function"!=typeof t.getElementById)return null;const i=t.getElementById(n);return cd(i)?i:null}(t,e&&e.ownerDocument?e.ownerDocument:null);if(i)return i;if("string"==typeof t){const e=t.trim(),n="#"===e.charAt(0)?e.slice(1):e;if(!n)throw new Error("Debug overlay containerElement id cannot be empty.");throw new Error(`Debug overlay containerElement id "${n}" was not found.`)}throw new Error("Debug overlay containerElement must be an element id string or DOM element.")}({canvasElement:i,containerElement:n.containerElement});if(!r)throw new Error("Debug overlay requires an initialized player canvas and mount element.");Object.prototype.hasOwnProperty.call(n,"containerElement")&&delete n.containerElement;const o=await Promise.resolve().then((function(){return yD})),s=(null==o?void 0:o.createDebugOverlay)||(null==o?void 0:o.default);if("function"!=typeof s)throw new Error("Debug overlay bundle does not export createDebugOverlay().");return n.publicOptions=M(DO,this),n.playerVersion=gO,C(HO,this,s({mountElement:r,canvasElement:i,timeline:M(RO,this),assetsDeliveryServiceUrl:null===(t=M(VO,this))||void 0===t||null===(t=t.assetsDeliveryService)||void 0===t||null===(t=t.settings)||void 0===t?void 0:t.assetsDeliveryServiceUrl,getNode:e=>M(PO,this)&&"function"==typeof M(PO,this).get?M(PO,this).get(e):void 0,listNodes:()=>M(PO,this)&&"function"==typeof M(PO,this).list?M(PO,this).list():[],downloadSpeed:M(VO,this)?M(VO,this).downloadSpeed:void 0,downloadEvents:Qg,qoe:M(qO,this)?M(qO,this).publicAPI:void 0,qoeEvents:this,options:n,playbackStartedAtMs:M(YO,this)})),M(HO,this)}function mP(){const e=this;return{createTimeline:()=>A(oP,e,cP).call(e),switchTimeline:t=>A(oP,e,uP).call(e,t),play:M(RO,this).play,pause:M(RO,this).pause,reset:M(RO,this).reset,placeOnTimeline:M(RO,this).placeOnTimeline,placeRenderNodeOnTimeline:M(RO,this).placeRenderNodeOnTimeline,addNode:M(PO,this).add,getNode:M(PO,this).get,listNodes:M(PO,this).list,getNodesAtTime:t=>M(RO,e).getNodesAtTime(t),dispose:this.dispose,on:e.on,off:e.off,once:e.once,trigger:e.trigger,transitionTo:(t,n)=>M(WO,e).transitionTo(t,n),track:(t,...n)=>{if(M(jO,e)&&"function"==typeof M(jO,e).track)return M(jO,e).track(t,...n)},seekToPlacement:t=>M(RO,e).seekToPlacement(t),get currentTime(){return M(RO,e).currentTime},set currentTime(t){M(RO,e).currentTime=t},get buffered(){return M(RO,e).buffered},get options(){return M(DO,e)},get containerWidth(){return M(GO,e)?M(GO,e).containerWidth:0},get containerHeight(){return M(GO,e)?M(GO,e).containerHeight:0},get playbackRate(){return M(RO,e).playbackRate},set playbackRate(t){M(RO,e).playbackRate=t},get paused(){return!!M(RO,e)&&!0===M(RO,e).paused},get muted(){return!!M($O,e)&&M($O,e).muted},set muted(t){M($O,e)&&(M($O,e).muted=t)},get volume(){return M($O,e)?M($O,e).volume:1},set volume(t){M($O,e)&&(M($O,e).volume=t)},get qoe(){return M(qO,e)?M(qO,e).publicAPI:void 0},get utils(){return yO},get version(){return gO},loadDebugOverlay:(...t)=>A(oP,e,pP).call(e,...t)}}function vP(e){e&&(C(BO,this,e.canvas),C(PO,this,e.nodeRepository),C(RO,this,e.timeline),C($O,this,e.audioAdapter||e.audioPlaybackManager),C(jO,this,e.tracker),C(UO,this,e.parsingManager),C(qO,this,e.qoe),C(zO,this,e.renderAdapter||e.renderer),C(WO,this,e.transitionManager),C(GO,this,e.containerSize))}class gP{constructor({target:e,props:t}){if(!e)throw new Error("`options.target` is required");go(this.#xe,t,!0),this.#xe.v.EkoPlayer=sP;const n=e.hasChildNodes()?oa:ra;this.#_e=n(Pu,{target:e,props:this.#xe.v})}#_e;#xe=Si(mo(_o({})),"EkoGallery.#props");destroy(e){if(this.#_e)return ca(this.#_e,e)}get props(){return Ds(this.#xe)}}const yP=u("gallery-react");const bP=e.forwardRef(((t,n)=>{const{config:i,debug:r,ssrHtml:o,activeItem:s={index:0,step:0},forceMobile:a,videoAspectRatio:l,onEvent:c=()=>{}}=t,u=e.useRef(null),d=e.useRef({}),h=function(e){return void 0!==e}(i),f=e.useRef(s),p=e.useRef(o);d.current.initEventSent||(c("galleryinit"),d.current.initEventSent=!0);const m=e.useCallback((e=>{d.current.state=e,e.activeItemIndex===f.current.index&&e.activeModuleIndex===f.current.step||c("activeitemchanged",{index:e.activeItemIndex,step:e.activeModuleIndex})}),[]),v=e.useCallback((e=>{d.current.API=e,0===f.current.index&&0===f.current.step||e.selectItemAndStep(f.current.index,f.current.step),d.current.unsubscribe&&d.current.unsubscribe(),d.current.unsubscribe=e.subscribe(m)}),[]),g=e.useCallback(((e,t)=>{c(e,t)}),[c]);return e.useEffect((()=>(yP.setDataStorage("gallery-react",{config:i}),window.eko=window.eko||{},window.eko.config=i,window.eko.gallery={version:"devops-main/4.0.8"},()=>{window.eko.config=void 0})),[i]),e.useImperativeHandle(n,(()=>({prev:()=>{var e;null===(e=d.current.API)||void 0===e||e.prev()},next:()=>{var e;null===(e=d.current.API)||void 0===e||e.next()}}))),e.useEffect((()=>{if(null==u||!u.current)return;const e=u.current;return d.current.app=new gP({target:e,props:{config:i,forceMobile:a,videoAspectRatio:l,hideNav:!0,onGalleryReady:v,onEvent:g}}),()=>{var e;null===(e=d.current.app)||void 0===e||e.destroy()}}),[]),e.useEffect((()=>{d.current.app&&(d.current.app.props.config=i)}),[i]),e.useEffect((()=>{d.current.app&&(d.current.app.props.debug=r,d.current.app.props.forceMobile=a,d.current.app.props.videoAspectRatio=l,d.current.app.props.onEvent=g)}),[r,a,l,g]),e.useEffect((()=>{f.current=s,d.current.state&&(d.current.state.activeItemIndex===s.index&&d.current.state.activeModuleIndex===s.step||d.current.API.selectItemAndStep(s.index,s.step))}),[s]),h?e.createElement("div",R({style:{position:"relative",width:"100%",height:"100%"},ref:u},p.current?{dangerouslySetInnerHTML:{__html:p.current}}:{})):t.children}));bP.propTypes={className:Te.string,config:Te.object,variantId:Te.string,onEvent:Te.func,ssrHtml:Te.string,videoAspectRatio:Te.string,debug:Te.bool,activeItem:Te.shape({index:Te.number,step:Te.number}),forceMobile:Te.bool,instanceId:Te.string,children:Te.node},bP.displayName="EkoGallerySvelte";const kP=n("v2"),wP=n("v1"),xP="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{},_P=xP&&xP.performance,TP=_P&&"function"==typeof _P.now?()=>_P.now():()=>Date.now(),IP=Object.freeze({NODE_ADD:"node:add",NODE_CHILDREN_CHANGED:"node:childrenchanged",NODE_LOADED:"node:loaded",NODE_LOAD_ERROR:"node:loaderror",PLACEMENT_ADDED:"placement:added",RENDER_PLACEMENT_ADDED:"renderplacement:added",TIMELINE_TIME_UPDATE:"timeline:timeupdate",TIMELINE_STATE_CHANGE:"statechange",TIMELINE_SEEKING:"seeking",TIMELINE_SEEKED:"seeked",TIMELINE_RESET:"timeline:reset",TIMELINE_PLAYER_STATE:"player:state",TIMELINE_CUEPOINT:"cuepoint",VISUAL_FRAMES_AVAILABLE:"visualframesavailable",TRACK_BUFFER_UPDATE:"track:bufferupdate",TRACK_READY:"track:ready",TRACK_UNDERFLOW:"track:underflow",CLOCK_TICK:"tick",DECODE_READY:"decode:ready",DECODE_ERROR:"decode:error",DECODER_AUDIO:"decoder:audio",DECODER_FRAME:"decoder:frame",DECODER_INIT:"decoder:init",DECODER_ERROR:"decoder:error",QOE_SCORE:"qoescore",QOE_STATUS:"qoestatus",CONTAINER_RESIZE:"containerresize"}),EP=["ui-monospace,","SFMono-Regular,","Menlo,","Monaco,","Consolas,",'"Liberation Mono",','"Courier New",',"monospace"].join(" "),SP=`11px ${EP}`,AP=`12px ${EP}`;function NP(e){return"number"==typeof e&&Number.isFinite(e)}function MP(e){return NP(e)&&e>0}function FP(e){return NP(e)?Math.min(1,Math.max(0,e)):0}function CP(e,t=3){return NP(e)?e.toFixed(t):String(e)}function OP(e,t){const n=Number(e),i=Number(t);return!Number.isFinite(n)||!Number.isFinite(i)||n<=0||i<=0?"n/a":`${Math.round(n)}x${Math.round(i)}`}var PP=new WeakMap,RP=new WeakMap,DP=new WeakMap,LP=new WeakMap,BP=new WeakMap,zP=new WeakMap,WP=new WeakMap,$P=new WeakSet;class jP{constructor({width:e=220,height:t=48,windowMs:n=6e4,maxValue:i=60,autoScale:r=!1,formatValue:o}={}){O(this,$P),F(this,PP,void 0),F(this,RP,void 0),F(this,DP,[]),F(this,LP,void 0),F(this,BP,void 0),F(this,zP,void 0),F(this,WP,void 0);const s=null==xP?void 0:xP.document;if(!s||"function"!=typeof s.createElement)throw new Error("Debug overlay graph requires document.createElement.");C(PP,this,s.createElement("canvas")),M(PP,this).width=e,M(PP,this).height=t,M(PP,this).style.width=`${e}px`,M(PP,this).style.height=`${t}px`,M(PP,this).style.borderRadius="6px",M(PP,this).style.background="#111",C(RP,this,M(PP,this).getContext("2d")),C(LP,this,n),C(BP,this,i),C(zP,this,!!r),C(WP,this,"function"==typeof o?o:null)}get element(){return M(PP,this)}push(e,t){if(M(PP,this)&&M(RP,this)&&Number.isFinite(e)&&Number.isFinite(t)){for(M(DP,this).push({t:t,v:e});M(DP,this).length&&t-M(DP,this)[0].t>M(LP,this);)M(DP,this).shift();A($P,this,UP).call(this)}}dispose(){C(DP,this,[]),C(RP,this,null),C(PP,this,null)}}function UP(){const e=M(RP,this),t=M(PP,this);if(!e||!t)return;const n=t.width,i=t.height;if(!n||!i)return;if(e.clearRect(0,0,n,i),e.fillStyle="#111",e.fillRect(0,0,n,i),!M(DP,this).length)return;const r=M(DP,this)[0].t;if(!(M(DP,this)[M(DP,this).length-1].t>r))return;const o=M(zP,this)?M(DP,this).reduce(((e,t)=>t.v>e?t.v:e),0):M(BP,this),s=o>0?o:M(BP,this);e.strokeStyle="#0f0",e.lineWidth=2,e.beginPath();for(let t=0;t<M(DP,this).length;t+=1){const o=M(DP,this)[t],a=(o.t-r)/M(LP,this)*n,l=i-(s>0?Math.min(1,Math.max(0,o.v/s)):0)*i;0===t?e.moveTo(a,l):e.lineTo(a,l)}e.stroke();const a=M(DP,this).length?M(DP,this)[M(DP,this).length-1]:null,l=Number.isFinite(null==a?void 0:a.v)?a.v:null;if(null===l)return;const c=M(WP,this)?M(WP,this).call(this,l):l.toFixed(1);if("string"!=typeof c||!c)return;e.font=SP,e.textAlign="right",e.textBaseline="top";const u=e.measureText(c),d=Math.ceil(u.width)+8,h=n-d-2;e.fillStyle="rgba(0,0,0,0.55)",e.fillRect(h,2,d,14),e.fillStyle="#fff",e.fillText(c,n-2-4,4)}const qP=new Intl.NumberFormat("en-US");function VP(e,t){const n=(null==e?void 0:e.trackId)||"",i=(null==t?void 0:t.trackId)||"";if(n!==i)return n<i?-1:1;const r=(null==e?void 0:e.nodeId)||"",o=(null==t?void 0:t.nodeId)||"";if(r!==o)return r<o?-1:1;const s=(null==e?void 0:e.segmentId)||"",a=(null==t?void 0:t.segmentId)||"";return s!==a?s<a?-1:1:("number"==typeof(null==e?void 0:e.presentationTime)?e.presentationTime:0)-("number"==typeof(null==t?void 0:t.presentationTime)?t.presentationTime:0)}function GP(e,t){for(e.push(t);e.length&&t-e[0]>1e3;)e.shift();if(e.length<2)return 0;const n=e[e.length-1]-e[0];return n<=0?0:1e3*(e.length-1)/n}function HP(e,t){if("function"!=typeof e||!t)return;const n=e(t.nodeId),i=null==n?void 0:n.tracks;if(!Array.isArray(i))return;const r=i.find((e=>(null==e?void 0:e.id)===t.trackId)),o=null==r?void 0:r.segments;return Array.isArray(o)?o.find((e=>(null==e?void 0:e.id)===t.segmentId)):void 0}function KP(e,t){var n;const i=HP(e,t);return(null==i?void 0:i.abrDecision)||(null==i||null===(n=i.chosenRepresentation)||void 0===n?void 0:n.abrDecision)}function XP(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"n/a":`${qP.format(Math.round(t))}kbps`}function YP(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"n/a":`${qP.format(Math.round(t/1e3))}kbps`}function QP(e,t=3){const n=Number(e);return Number.isFinite(n)?n.toLocaleString("en-US",{minimumFractionDigits:t,maximumFractionDigits:t}):String(e)}function JP(e,t){var n;if("function"!=typeof e||!t)return;const i=e(t.nodeId),r=null==i||null===(n=i.manifestRef)||void 0===n?void 0:n.encodeProfile;return"string"==typeof r&&r?r:void 0}function ZP(e,t){if("function"!=typeof e||!t)return;const n=e(t.nodeId);return!0===(null==n?void 0:n.imageFallbackActive)?"image":void 0}function eR(e,t){const n=function(e){if(!e)return;const t=[[e.displayWidth,e.displayHeight],[e.codedWidth,e.codedHeight],[e.videoWidth,e.videoHeight],[e.naturalWidth,e.naturalHeight],[e.width,e.height]];for(let e=0;e<t.length;e+=1){const[n,i]=t[e],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}(null==t?void 0:t.frame)||{},i=Number.isFinite(null==t?void 0:t.width)?t.width:n.width,r=Number.isFinite(null==t?void 0:t.height)?t.height:n.height,o=function(e,t,n){return null===(n=HP(e,t))||void 0===n?void 0:n.chosenRepresentation}(e,t);if(!o)return NP(i)&&NP(r)?{width:i,height:r}:null;const s=o.width||o.codedWidth||i,a=o.height||o.codedHeight||r;return{id:o.id,codecs:o.codecs,mime:o.mime,bandwidth:o.bandwidth,width:s,height:a}}function tR(e){const t=Number(e);if(Number.isFinite(t)&&!(t<=0))return t/1e3}function nR(e,t){const n=Number(null==e?void 0:e.bandwidthKbps),i=Number(null==t?void 0:t.bandwidthKbps),r=Number.isFinite(n)&&n>0,o=Number.isFinite(i)&&i>0;if(r&&o&&n!==i)return n-i;if(r!==o)return r?-1:1;const s=(null==e?void 0:e.id)||"",a=(null==t?void 0:t.id)||"";return s===a?0:s<a?-1:1}function iR(e,t,n,i){const r=[];if(Array.isArray(null==i?void 0:i.availableRepresentations)&&i.availableRepresentations.forEach((e=>{const t="string"==typeof(null==e?void 0:e.id)&&e.id?e.id:void 0;if(!t)return;const n=Number(null==e?void 0:e.bandwidthKbps);r.push({id:t,bandwidthKbps:Number.isFinite(n)&&n>0?n:void 0})})),!r.length){const n=HP(e,t);(Array.isArray(null==n?void 0:n.representations)?n.representations:[]).forEach((e=>{const t="string"==typeof(null==e?void 0:e.id)&&e.id?e.id:void 0;t&&r.push({id:t,bandwidthKbps:tR(null==e?void 0:e.bandwidth)})}))}!r.length&&(null==n?void 0:n.id)&&r.push({id:n.id,bandwidthKbps:tR(n.bandwidth)});const o=new Map;return r.forEach((e=>{const t=null==e?void 0:e.id;t&&!o.has(t)&&o.set(t,e)})),Array.from(o.values()).sort(nR)}const rR=1024,oR=1048576,sR=1073741824;function aR(e){return NP(e)?e>=1e3?`${CP(e/1e3,1)} Mbps`:`${CP(e,1)} kbps`:"n/a"}function lR({downloadSpeed:e,downloadEvents:t}={}){const n=xP.document,i="function"==typeof(null==e?void 0:e.getKbps)?e.getKbps():void 0;let r=0;const{metricsRow:o,setInitial:s,setTotal:a}=function(e){const t=e.createElement("div");t.style.display="grid",t.style.gridTemplateColumns="1fr 1fr",t.style.gap="8px",t.style.font=AP;const n=e.createElement("div"),i=e.createElement("div");return t.appendChild(n),t.appendChild(i),{metricsRow:t,setInitial:e=>{n.textContent=`initial=${aR(e)}`},setTotal:e=>{var t;i.textContent="total="+(NP(t=e)?t<rR?`${Math.round(t)} B`:t<oR?`${CP(t/rR,1)} KB`:t<sR?`${CP(t/oR,2)} MB`:`${CP(t/sR,2)} GB`:"n/a")}}}(n),{graphWrap:l,speedGraph:c}=function(e,t){const n=e.createElement("div");n.style.marginTop="10px";const i=e.createElement("div");i.textContent="download speed",i.style.font=SP,i.style.opacity="0.9";const r=NP(t)&&t>0?t:1,o=new jP({autoScale:!0,maxValue:r,formatValue:aR});return n.appendChild(i),n.appendChild(o.element),{graphWrap:n,speedGraph:o}}(n,i);s(i),a(r);const u=e=>{const t=Number(null==e?void 0:e.kbps);Number.isFinite(t)&&c.push(t,null!=xP&&xP.performance&&"function"==typeof xP.performance.now?xP.performance.now():Date.now())},d=e=>{const t=Number(null==e?void 0:e.bytes);Number.isFinite(t)&&(r+=t,a(r))};return e&&"function"==typeof e.on&&e.on("download:speed",u),t&&"function"==typeof t.on&&t.on("download:sample",d),{id:"downloads",title:"Downloads",render:e=>{e.appendChild(o),e.appendChild(l)},dispose:()=>{e&&"function"==typeof e.off&&e.off("download:speed",u),t&&"function"==typeof t.off&&t.off("download:sample",d),c.dispose()}}}function cR(e){return NP(e)?CP(e,3):"n/a"}function uR(){return null!=xP&&xP.performance&&"function"==typeof xP.performance.now?xP.performance.now():Date.now()}var dR,hR,fR,pR={exports:{}},mR=(dR||(dR=1,hR=pR,function(e,t){hR.exports?hR.exports=t():e.log=t()}(pR.exports,(function(){var e=function(){},t="undefined",n=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],r={},o=null;function s(e,t){var n=e[t];if("function"==typeof n.bind)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch(t){return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function a(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function l(){for(var n=this.getLevel(),r=0;r<i.length;r++){var o=i[r];this[o]=r<n?e:this.methodFactory(o,n,this.name)}if(this.log=this.debug,typeof console===t&&n<this.levels.SILENT)return"No console available for logging"}function c(e){return function(){typeof console!==t&&(l.call(this),this[e].apply(this,arguments))}}function u(i,r,o){return"debug"===(l=i)&&(l="log"),typeof console!==t&&("trace"===l&&n?a:void 0!==console[l]?s(console,l):void 0!==console.log?s(console,"log"):e)||c.apply(this,arguments);var l}function d(e,n){var s,a,c,d=this,h="loglevel";function f(){var e;if(typeof window!==t&&h){try{e=window.localStorage[h]}catch(e){}if(typeof e===t)try{var n=window.document.cookie,i=encodeURIComponent(h),r=n.indexOf(i+"=");-1!==r&&(e=/^([^;]+)/.exec(n.slice(r+i.length+1))[1])}catch(e){}return void 0===d.levels[e]&&(e=void 0),e}}function p(e){var t=e;if("string"==typeof t&&void 0!==d.levels[t.toUpperCase()]&&(t=d.levels[t.toUpperCase()]),"number"==typeof t&&t>=0&&t<=d.levels.SILENT)return t;throw new TypeError("log.setLevel() called with invalid level: "+e)}"string"==typeof e?h+=":"+e:"symbol"==typeof e&&(h=void 0),d.name=e,d.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},d.methodFactory=n||u,d.getLevel=function(){return null!=c?c:null!=a?a:s},d.setLevel=function(e,n){return c=p(e),!1!==n&&function(e){var n=(i[e]||"silent").toUpperCase();if(typeof window!==t&&h){try{return void(window.localStorage[h]=n)}catch(e){}try{window.document.cookie=encodeURIComponent(h)+"="+n+";"}catch(e){}}}(c),l.call(d)},d.setDefaultLevel=function(e){a=p(e),f()||d.setLevel(e,!1)},d.resetLevel=function(){c=null,function(){if(typeof window!==t&&h){try{window.localStorage.removeItem(h)}catch(e){}try{window.document.cookie=encodeURIComponent(h)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(e){}}}(),l.call(d)},d.enableAll=function(e){d.setLevel(d.levels.TRACE,e)},d.disableAll=function(e){d.setLevel(d.levels.SILENT,e)},d.rebuild=function(){if(o!==d&&(s=p(o.getLevel())),l.call(d),o===d)for(var e in r)r[e].rebuild()},s=p(o?o.getLevel():"WARN");var m=f();null!=m&&(c=p(m)),l.call(d)}(o=new d).getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=r[e];return t||(t=r[e]=new d(e,o.methodFactory)),t};var h=typeof window!==t?window.log:void 0;return o.noConflict=function(){return typeof window!==t&&window.log===o&&(window.log=h),o},o.getLoggers=function(){return r},o.default=o,o}))),pR.exports),vR=(fR=mR)&&fR.__esModule&&Object.prototype.hasOwnProperty.call(fR,"default")?fR.default:fR;const gR=()=>{},yR=["trace","log","debug","info","warn","error","getLevel","setLevel"],bR=["trace","debug","info","warn","error","silent"],kR={TRACE:"color: white; background-color: magenta;",DEBUG:"color: black; background-color: turquoise;",INFO:"color: white; background-color: green;",WARN:"color: black; background-color: yellow;",ERROR:"color: white; background-color: red;"},wR="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global;let xR={level:"trace",appName:""},_R=[];const TR="object"==typeof wR&&wR.performance&&"function"==typeof wR.performance.now?wR.performance.now.bind(wR.performance):Date.now.bind(Date),IR=e=>e&&"string"==typeof e?e.toLowerCase().trim():"",ER=(()=>{try{const e=new URLSearchParams(document.location.search),t=[].concat(e.getAll("log")).concat(e.getAll("ekolog")).concat(e.getAll("ekologger")).join(",").split(",");if(0===t.length)return{};let n={};return t.forEach((e=>{const[t,i]=e.split(":");n[IR(t)]=IR(i)||"trace"})),n}catch(e){return{}}})(),SR=(e,t="")=>{const n=IR(e),i=vR.getLogger(n);if(i.__ekologger)return i.__ekologger;t||ER[n]||ER["*"]||(i.__noExplicitLevel=!0);const r=i.methodFactory;i.methodFactory=(t,n,i)=>{const o=r(t,n,i),s=t.toUpperCase();return(...t)=>{o(`[${((e,t=3)=>(TR()/1e3).toFixed(t))()}] %c[${s}] ${xR.appName?`[${xR.appName}] `:""}[${e}]`,kR[s],...t)}},t=ER[n]||ER["*"]||t||xR.level,i.setLevel(t,!1);const o=(...e)=>i.log(...e);return yR.forEach((e=>{o[e]=(...t)=>(_R.forEach((n=>{n[e](...t)})),i[e](...t))})),i.__ekologger=o,o};SR.setDefaults=({appName:e="",level:t})=>{e&&"string"==typeof e&&(xR.appName=e),(t=IR(t))&&bR.includes(t)&&(xR.level=t,Object.values(vR.getLoggers()).filter((e=>e.__noExplicitLevel)).forEach((e=>e.setLevel(xR.level,!1))))},SR.installDriver=e=>{const t={...yR.reduce(((t,n)=>(t[n]="function"==typeof(null==e?void 0:e[n])?e[n]:gR,t)),{})};_R.push(t)},SR("download","warn");Object.freeze(Object.entries({disabledTracks:{default:["audio"],targetPaths:["NodeRepository.disabledTracks"]},muted:{default:!1,targetPaths:["AudioPlaybackManager.muted"]},volume:{default:1,targetPaths:["AudioPlaybackManager.volume"]},encodeProfile:{default:null,targetPaths:["AssetsDeliveryService.profile"]},forceVideoCodec:{default:void 0,targetPaths:["NodeRepository.forceVideoCodec"]},forceImageFallback:{default:!1,targetPaths:["NodeRepository.forceImageFallback"]},mediaHostRewriteMap:{default:{"storageeko.s3.amazonaws.com":"https://storage.eko.com","studioz-post.s3.amazonaws.com":"https://studioz-post.eko.com"},targetPaths:["NodeRepository.mediaHostRewriteMap"]},playbackRate:{default:1,targetPaths:["PlaybackClock.playbackRate"]},initialKbps:{default:"auto",targetPaths:["DownloadSpeed.initialKbps"]},defaultRenderParams:{default:void 0,targetPaths:["Renderer.defaultRenderParams"]},maxBufferedVideoFrames:{default:24,targetPaths:["Timeline.maxBufferedVideoFrames"]},waitingBufferAheadSeconds:{default:3,targetPaths:["Timeline.waitingBufferAheadSeconds"]},abrStrategy:{default:"auto",targetPaths:["ABRSelector.abrStrategy"]},segmentEvictionEnabled:{default:!0,targetPaths:["SegmentEvictionCoordinator.enabled"]},segmentEvictionBufferBehindSeconds:{default:30,targetPaths:["SegmentEvictionCoordinator.bufferBehindSeconds"]},segmentEvictionBufferAheadSeconds:{default:30,targetPaths:["SegmentEvictionCoordinator.bufferAheadSeconds"]},segmentEvictionMaxRetainedBytes:{default:52428800,targetPaths:["SegmentEvictionCoordinator.maxRetainedBytes"]},autoplay:{default:!0,targetPaths:["Idle.autoplay"]},autoPauseOnVisibilityChange:{default:!0,targetPaths:["DocumentVisibility.autoPauseOnVisibilityChange"]},autoResumeOnVisibilityChange:{default:!0,targetPaths:["DocumentVisibility.autoResumeOnVisibilityChange"]},trackingEnabled:{default:!0,targetPaths:["Tracker.trackingEnabled"]}}).reduce(((e,[t,n])=>(Object.prototype.hasOwnProperty.call(n,"default")&&(e[t]=n.default),e)),{})),SR("config","warn");const AR=18,NR="rgba(83,170,255,0.9)",MR={pending:"rgba(255,255,255,0.55)",resolving:"rgba(255,200,87,0.9)",ready:"rgba(102,214,141,0.9)",failed:"rgba(255,92,92,0.9)",missing:"rgba(160,160,160,0.9)"},FR={border:"1px solid rgba(102,214,141,0.28)",background:"rgba(102,214,141,0.16)",color:"rgba(167,240,185,1)"},CR={border:"1px solid rgba(255,200,87,0.3)",background:"rgba(255,200,87,0.16)",color:"rgba(255,227,171,1)"},OR="noop",PR="seek",RR="copy-node-id",DR="copy-node-context",LR="copy-source-video-url",BR=[{value:OR,label:"NOOP"},{value:PR,label:"Seek"},{value:RR,label:"Copy Node ID"},{value:DR,label:"Copy Node Context"},{value:LR,label:"Copy Source Video URL"}],zR=["type","url","mimeType","assetId","assetRevision","encodeProfile","duration","width","height"],WR=["id","url","mime","codecs","baseCodec","bandwidth","timescale","sizeBytes","width","height","frameRate","segStart","segDuration"];function $R(e,t){if(MP(null==e?void 0:e.nodeDurationOverride))return e.nodeDurationOverride;if("function"!=typeof t)return null;const n=t(null==e?void 0:e.nodeId),i=null==n?void 0:n.duration;return MP(i)?i:null}function jR(e){const t=Number(null==e?void 0:e.duration);return t===Number.POSITIVE_INFINITY?Number.POSITIVE_INFINITY:MP(t)?t:null}function UR(e){return e===Number.POSITIVE_INFINITY}function qR(e){return NP(e)?String(e):""}function VR(e,t=[]){return t.reduce(((t,n)=>(void 0!==(null==e?void 0:e[n])&&(t[n]=e[n]),t)),{})}function GR(e){const t=BR.find((t=>t.value===e));return t?t.value:OR}function HR(e){return e?"string"==typeof(null==e?void 0:e.message)&&e.message?e.message:"string"==typeof e&&e?e:null:null}function KR(e){return e&&NP(e.start)&&NP(e.end)?{start:e.start,end:e.end}:null}function XR(e){return e?VR(e,WR):null}function YR(e,t){const n="string"==typeof(null==e?void 0:e.nodeId)?e.nodeId:"",i="function"==typeof t&&n?t(n):null,r=function(e){return e?"string"==typeof e?e:VR(e,zR):null}(null==i?void 0:i.manifestRef),o=r&&"object"==typeof r?r.assetId:void 0,s={placement:{placementId:"string"==typeof(null==e?void 0:e.placementId)?e.placementId:void 0,nodeId:n||void 0,offset:NP(null==e?void 0:e.offset)?e.offset:void 0,duration:$R(e,t),offsetPending:!0===(null==e?void 0:e.offsetPending),nodeOffsetOverride:NP(null==e?void 0:e.nodeOffsetOverride)?e.nodeOffsetOverride:void 0,nodeDurationOverride:NP(null==e?void 0:e.nodeDurationOverride)?e.nodeDurationOverride:void 0},node:i?{id:i.id||n||void 0,state:"string"==typeof i.state?i.state:void 0,duration:NP(i.duration)?i.duration:null,mainTrackId:"string"==typeof i.mainTrackId?i.mainTrackId:void 0,assetId:"string"==typeof o?o:void 0,manifestRef:r,buffered:KR(i.buffered),imageFallbackActive:!0===i.imageFallbackActive,retainedByteLength:NP(i.retainedByteLength)?i.retainedByteLength:0,children:Array.isArray(i.children)?i.children.map((e=>({nodeId:"string"==typeof(null==e?void 0:e.nodeId)?e.nodeId:void 0,weight:NP(null==e?void 0:e.weight)?e.weight:void 0}))):[],tracks:Array.isArray(i.tracks)?i.tracks.map((e=>function(e){return e?{id:e.id,type:e.type,offset:NP(e.offset)?e.offset:0,duration:NP(e.duration)?e.duration:null,endTime:NP(e.endTime)?e.endTime:null,buffered:KR(e.buffered),segments:Array.isArray(e.segments)?e.segments.map((e=>function(e){if(!e)return null;const t={id:e.id,isInit:!0===e.isInit,offset:NP(e.offset)?e.offset:0,duration:NP(e.duration)?e.duration:0,bufferedRatio:NP(e.bufferedRatio)?e.bufferedRatio:0,retainedByteLength:NP(e.retainedByteLength)?e.retainedByteLength:0,isLoaded:!0===e.isLoaded,loadAttempts:NP(Number(e.loadAttempts))?Number(e.loadAttempts):0,appliedFilters:Array.isArray(e.appliedFilters)?e.appliedFilters.slice():[],chosenRepresentation:XR(e.chosenRepresentation),representations:Array.isArray(e.representations)?e.representations.map((e=>XR(e))).filter(Boolean):[]},n=HR(e.loadError);return n&&(t.loadError=n),t}(e))).filter(Boolean):[]}:null}(e))).filter(Boolean):[]}:null};if(i){const e=Number(i.manifestLoadAttempts);NP(e)&&e>0&&(s.node.manifestLoadAttempts=e);const t=HR(i.manifestLoadError);t&&(s.node.manifestLoadError=t);const n=HR(i.error);n&&(s.node.error=n)}return s}function QR(e=[],t=[],n){const i=function(e=[],t){return Array.isArray(e)&&e.length?e.map((e=>e?["string"==typeof e.placementId?e.placementId:"","string"==typeof e.nodeId?e.nodeId:"",qR(e.offset),qR($R(e,t)),!0===e.offsetPending?"1":"0",qR(e.nodeOffsetOverride),qR(e.nodeDurationOverride)].join("|"):"null")).join(";"):""}(e,n);return`${i}::${function(e=[]){return Array.isArray(e)&&e.length?e.map((e=>{if(!e)return"null";const t="string"==typeof e.renderPlacementId?e.renderPlacementId:"",n="string"==typeof e.type?e.type:"",i=qR(e.offset),r=jR(e);return[t,n,i,r===Number.POSITIVE_INFINITY?"inf":qR(r),!0===e.offsetPending?"1":"0"].join("|")})).join(";"):""}(t)}`}function JR(e=[],t){if(!Array.isArray(e)||!e.length)return!1;for(let n=0;n<e.length;n+=1){const i=e[n];if(!i||!0===i.offsetPending)continue;if(MP(i.nodeDurationOverride))continue;if("function"!=typeof t)return!0;const r=t(i.nodeId);if(!MP(null==r?void 0:r.duration))return!0}return!1}function ZR(e=[]){return!(!Array.isArray(e)||!e.length)&&e.some((e=>!0===(null==e?void 0:e.offsetPending)))}function eD(e=[],t=[]){return ZR(e)||ZR(t)}function tD(e,t=[],n){if(!e||!Array.isArray(t)||!t.length)return;const i=e.querySelector('[data-segment-boundary="true"]');t.forEach((t=>{if(!t||!NP(t.startRatio)||!NP(t.endRatio))return;const r=FP(t.startRatio),o=FP(t.endRatio);if(!(o>r))return;const s=xP.document.createElement("div");s.dataset.bufferedSegment="true",s.style.position="absolute",s.style.top="0",s.style.bottom="0",s.style.left=100*r+"%",s.style.width=100*(o-r)+"%",s.style.background=n,s.style.opacity="0.8",s.style.pointerEvents="none",s.style.zIndex="0",i?e.insertBefore(s,i):e.appendChild(s)}))}function nD(e,t){if(!e)return;const n=e.querySelector('[data-active-highlight="true"]');if(!t)return void(n&&n.remove());if(n)return;const i=xP.document.createElement("div");i.dataset.activeHighlight="true",i.style.position="absolute",i.style.top="0",i.style.bottom="0",i.style.left="0",i.style.right="0",i.style.border="1px solid rgba(255,255,255,0.9)",i.style.borderRadius="4px",i.style.pointerEvents="none",i.style.zIndex="1",e.appendChild(i)}function iD({timeline:e,getNode:t,assetsDeliveryServiceUrl:n}={}){const i=null==xP?void 0:xP.document;if(!i||"function"!=typeof i.createElement)throw new Error("Debug overlay timeline tab requires document.createElement.");const r=i.createElement("div");r.style.display="flex",r.style.flexDirection="column",r.style.gap="8px",r.style.position="relative";const o=i.createElement("div");o.style.position="absolute",o.style.display="none",o.style.pointerEvents="none",o.style.zIndex="2",o.style.padding="4px 6px",o.style.borderRadius="6px",o.style.background="rgba(0,0,0,0.8)",o.style.border="1px solid rgba(255,255,255,0.2)",o.style.color="#fff",o.style.font=SP,o.style.maxWidth="220px",o.style.whiteSpace="nowrap",o.style.overflow="hidden",o.style.textOverflow="ellipsis";const s=i.createElement("div");s.dataset.timelineHoverDetails="true",s.style.position="absolute",s.style.display="none",s.style.pointerEvents="none",s.style.zIndex="3",s.style.padding="6px 8px",s.style.borderRadius="8px",s.style.background="rgba(0,0,0,0.85)",s.style.border="1px solid rgba(255,255,255,0.25)",s.style.color="#fff",s.style.font=SP,s.style.maxWidth="260px",s.style.flexDirection="column",s.style.gap="6px";const a=i.createElement("div");a.style.font=AP,a.style.opacity="0.95";const l=i.createElement("div");l.style.font=SP,l.style.opacity="0.7",l.style.textTransform="uppercase",l.style.marginTop="4px";const c=i.createElement("div");c.style.display="flex",c.style.flexDirection="column",c.style.gap="4px",s.appendChild(a),s.appendChild(l),s.appendChild(c);const u=i.createElement("div");u.style.display="flex",u.style.justifyContent="space-between",u.style.alignItems="center";const d=i.createElement("div");d.style.display="flex",d.style.alignItems="baseline",d.style.gap="10px";const h=i.createElement("div");h.style.font=AP,h.style.opacity="0.9";const f=i.createElement("div");f.style.font=SP,f.style.opacity="0.65",d.appendChild(h),d.appendChild(f);const p=i.createElement("label");p.style.display="inline-flex",p.style.alignItems="center",p.style.gap="6px",p.style.font=SP;const m=i.createElement("span");m.textContent="Click action";const v=i.createElement("select");v.style.font=SP,v.style.background="rgba(255,255,255,0.08)",v.style.color="#fff",v.style.border="1px solid rgba(255,255,255,0.2)",v.style.borderRadius="4px",v.style.padding="2px 6px",v.style.minHeight="24px",v.style.cursor="pointer",BR.forEach((e=>{const t=i.createElement("option");t.value=e.value,t.textContent=e.label,v.appendChild(t)})),v.value=OR;const g=i.createElement("div");g.dataset.timelineCopyStatus="true",g.setAttribute("role","status"),g.setAttribute("aria-live","polite"),g.style.display="none",g.style.position="absolute",g.style.right="0",g.style.bottom="calc(100% + 4px)",g.style.alignItems="center",g.style.padding="1px 6px",g.style.borderRadius="999px",g.style.border=FR.border,g.style.background=FR.background,g.style.color=FR.color,g.style.font=SP,g.style.whiteSpace="nowrap",g.style.pointerEvents="none",g.style.zIndex="4",g.style.opacity="0",g.style.transform="translateY(2px)",g.style.transition=["opacity 180ms ease","transform 180ms ease"].join(", "),p.appendChild(m),p.appendChild(v);const y=i.createElement("div");y.style.display="flex",y.style.alignItems="center",y.style.position="relative",y.style.flexShrink="0",y.appendChild(g),y.appendChild(p),u.appendChild(d),u.appendChild(y);const b=i.createElement("div");function k(e,t,{alignTop:n=!1}={}){const r=i.createElement("div");r.style.display="grid",r.style.gridTemplateColumns="64px 1fr",r.style.alignItems=n?"start":"center",r.style.gap="8px";const o=i.createElement("div");o.textContent=e,o.style.font=SP,o.style.opacity="0.8",n&&(o.style.paddingTop="2px");const s=i.createElement("div");s.style.position="relative",s.style.borderRadius="6px",s.style.background="rgba(255,255,255,0.08)",s.style.overflow="hidden",t&&(s.dataset.timelineLane=t);const a=i.createElement("div");return a.style.position="absolute",a.style.top="0",a.style.bottom="0",a.style.width="2px",a.style.background="rgba(255,255,255,0.8)",s.appendChild(a),r.appendChild(o),r.appendChild(s),b.appendChild(r),{track:s,indicator:a}}b.style.display="grid",b.style.gridTemplateRows="auto auto",b.style.gap="8px",r.appendChild(u),r.appendChild(b),r.appendChild(o),r.appendChild(s);const w=k("Nodes","nodes",{alignTop:!0}),x=k("Render","render");let _=[],T=[],I=0,E=OR,S=1;const A=new Map,N=new Map,M=new Map,F=new Map;let C=new Set,O=null,P=!1,R="",D=!1,L=0,B=0,z=null,W=null,$=null;function j(e){for(;e.childNodes.length>1;)e.removeChild(e.lastChild)}function U(){z&&(clearTimeout(z),z=null)}function q(){W&&(((null==xP?void 0:xP.clearTimeout)||clearTimeout)(W),W=null)}function V(){$&&(((null==xP?void 0:xP.clearTimeout)||clearTimeout)($),$=null)}function G(){g.style.display="none",g.style.opacity="0",g.style.transform="translateY(2px)",g.textContent=""}function H(){return!!D||!!e&&(Array.isArray(e.placements)||Array.isArray(e.renderPlacements))}function K(){if(!e)return!1;const t=Array.isArray(e.placements),n=Array.isArray(e.renderPlacements);if(!t&&!n)return!1;const i=t?e.placements:[],r=n?e.renderPlacements:[];return(i.length!==L||r.length!==B)&&(de(i,r),!0)}function X(){if(!D)return!1;const e=QR(_,T,t);return e!==R&&(R=e,ae(),ue(),!0)}function Y(){H()?z=function({shouldSchedule:e,isScheduled:t,intervalMs:n,onTick:i}){return t?null:setTimeout(i,n)}({shouldSchedule:!0,isScheduled:!!z,intervalMs:D?100:250,onTick:()=>{z=null,H()&&(K()||X()||Y())}}):U()}function Q(e,t){const n=t>0?I/t:0;e.style.left=100*FP(n)+"%",e.style.transform="translateX(-1px)"}function J(){o.style.display="none"}function Z(){q(),V(),G()}function ee(e,{tone:t="success"}={}){if(!e)return void Z();q(),V(),function(e="success"){const t=function(e="success"){return"warning"===e?CR:FR}(e);g.style.border=t.border,g.style.background=t.background,g.style.color=t.color}(t),g.textContent=e,g.style.display="inline-flex",g.style.opacity="0",g.style.transform="translateY(2px)","function"==typeof g.getBoundingClientRect&&g.getBoundingClientRect(),g.style.opacity="1",g.style.transform="translateY(0)";const n=(null==xP?void 0:xP.setTimeout)||setTimeout;W=n((()=>{W=null,function(){q(),V(),g.style.opacity="0",g.style.transform="translateY(-2px)";const e=(null==xP?void 0:xP.setTimeout)||setTimeout;$=e((()=>{$=null,G()}),180)}()}),1800)}function te(e,t){if(!e)return void J();o.textContent=e,o.style.display="block";const n=r.getBoundingClientRect(),i=o.getBoundingClientRect(),s=((null==t?void 0:t.clientX)||0)-n.left+12,a=((null==t?void 0:t.clientY)||0)-n.top+12,l=n.width-i.width-8,c=n.height-i.height-8,u=Math.max(8,Math.min(s,l)),d=Math.max(8,Math.min(a,c));o.style.left=`${u}px`,o.style.top=`${d}px`}function ne(){s.style.display="none"}function ie(e,n){const o="function"==typeof t&&e?t(e):null,u=Array.isArray(null==o?void 0:o.children)?o.children:[];if(!u.length)return void ne();if(a.textContent=e,l.textContent="children",function(){for(;c.firstChild;)c.removeChild(c.firstChild)}(),u.forEach((e=>{e&&e.nodeId&&c.appendChild(function(e){const n=i.createElement("div");n.style.display="grid",n.style.gridTemplateColumns="10px 1fr auto auto",n.style.alignItems="center",n.style.gap="6px";const r="string"==typeof(null==e?void 0:e.nodeId)?e.nodeId:"",o=MP(null==e?void 0:e.weight)?e.weight:1,s=function(e){if(!e||"function"!=typeof t)return"missing";const n=t(e);if(!n)return"missing";const i="string"==typeof n.state?n.state.trim().toLowerCase():"";return"pending"===i||"resolving"===i||"ready"===i||"failed"===i?i:"pending"}(r);n.dataset.childId=r,n.dataset.childStatus=s;const a=i.createElement("span");a.dataset.statusIndicator=s,a.style.width="8px",a.style.height="8px",a.style.borderRadius="999px",a.style.background=MR[s]||MR.pending,a.style.display="inline-block";const l=i.createElement("span");l.textContent=r||"unknown",l.style.overflow="hidden",l.style.textOverflow="ellipsis",l.style.whiteSpace="nowrap";const c=i.createElement("span");c.textContent=`w=${CP(o,0)}`,c.style.opacity="0.8";const u=i.createElement("span");return u.textContent=s,u.style.opacity="0.75",n.appendChild(a),n.appendChild(l),n.appendChild(c),n.appendChild(u),n}(e))})),!c.childNodes.length)return void ne();s.style.display="flex";const d=r.getBoundingClientRect(),h=s.getBoundingClientRect(),f=((null==n?void 0:n.clientX)||0)-d.left+12,p=((null==n?void 0:n.clientY)||0)-d.top+12,m=d.width-h.width-8,v=d.height-h.height-8,g=Math.max(8,Math.min(f,m)),y=Math.max(8,Math.min(p,v));s.style.left=`${g}px`,s.style.top=`${y}px`}function re(){const t=I;if(e&&"function"==typeof e.getPlacementsActiveAtTime){const n=e.getPlacementsActiveAtTime(t),i=new Set(n.map((e=>null==e?void 0:e.placementId)).filter((e=>"string"==typeof e&&e.length)));C.forEach((e=>{i.has(e)||nD(M.get(e),!1)})),i.forEach((e=>{C.has(e)||nD(M.get(e),!0)})),C=i}else w.track.querySelectorAll('[data-timeline-item="nodes"]').forEach((e=>{const n="true"===e.dataset.hasDuration,i=Number(e.dataset.start),r=Number(e.dataset.end);nD(e,n&&NP(t)&&t>=i&&t<r)}));if(e&&"function"==typeof e.getActiveRenderPlacement){const n=e.getActiveRenderPlacement(t),i=null==n?void 0:n.renderPlacementId;O&&O!==i&&nD(F.get(O),!1),i&&O!==i&&nD(F.get(i),!0),O=i||null}else x.track.querySelectorAll('[data-timeline-item="render"]').forEach((e=>{const n="true"===e.dataset.hasDuration,i=Number(e.dataset.start),r=Number(e.dataset.end);nD(e,n&&NP(t)&&t>=i&&t<r)}))}function oe(e){const n=$R(e,t);if(!MP(n)||"function"!=typeof t)return{boundaries:[],buffered:[]};const i=t(null==e?void 0:e.nodeId),r=function(e){const t=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[];if(!t.length)return null;if(null!=e&&e.mainTrackId){const n=t.find((t=>(null==t?void 0:t.id)===e.mainTrackId));if(n)return n}return t.find((e=>Array.isArray(null==e?void 0:e.segments)&&e.segments.length))||null}(i);if(!r)return{boundaries:[],buffered:[]};const o=e=>{if(!e)return 0;const t=Number(null==e?void 0:e.bufferedRatio);if(Number.isFinite(t))return FP(t);const n=Number(null==e?void 0:e.retainedByteLength);if(!MP(n))return 0;const i=null==e?void 0:e.chosenRepresentation,r=MP(null==i?void 0:i.sizeBytes)?i.sizeBytes:null;return MP(r)?FP(n/r):1},s=Array.isArray(r.segments)?r.segments:[],a=NP(null==r?void 0:r.offset)?r.offset:0,l=NP(null==e?void 0:e.nodeOffsetOverride)?e.nodeOffsetOverride:0;if(!s.length){const e=null==i?void 0:i.buffered,t=NP(null==e?void 0:e.start)?e.start-l:0,r=NP(null==e?void 0:e.end)?e.end-l:0,o=Math.max(0,t),s=Math.min(n,r);return s>o?{boundaries:[],buffered:[{startRatio:o/n,endRatio:s/n}]}:{boundaries:[],buffered:[]}}if("image"===(null==r?void 0:r.type)){const e=s.find((e=>e&&!e.isInit))||s[0],t=e?o(e):0;return t>0?{boundaries:[],buffered:[{startRatio:0,endRatio:FP(t)}]}:{boundaries:[],buffered:[]}}return function(e,t,n,i,r){const o=[],s=[];let a=0;return e.forEach((e=>{if(null!=e&&e.isInit)return;NP(null==e?void 0:e.offset)&&(a=e.offset);const l=a;if(!NP(l))return;const c=NP(null==e?void 0:e.duration)?e.duration:0,u=n+l-i,d=n+(l+c)-i;u>0&&u<t&&o.push(u/t);const h="function"==typeof r?r(e):0;if(c>0&&d>0&&u<t&&h>0){const e=Math.max(0,u),n=Math.min(t,d);if(n>e){const i=e+(n-e)*FP(h);s.push({startRatio:e/t,endRatio:i/t})}}c>0&&(NP(null==e?void 0:e.offset)?a=e.offset+c:a+=c)})),{boundaries:o,buffered:s}}(s,n,a,l,o)}function se(){const e=Array.isArray(_)?_:[],t=new Map(e.map((e=>[null==e?void 0:e.placementId,e])));for(const[e,n]of M.entries()){if(!e)continue;const i=t.get(e);i&&(n.querySelectorAll('[data-buffered-segment="true"]').forEach((e=>e.remove())),tD(n,oe(i).buffered,NR))}}function ae(){const e=new Set(_.map((e=>null==e?void 0:e.nodeId)).filter((e=>"string"==typeof e&&e.length)));e.forEach((e=>{if(N.has(e))return;const n="function"==typeof t?t(e):null;if(!n||"function"!=typeof n.on)return;const i=e=>function(e={}){if(!e||e.isInit)return;const t=null==e?void 0:e.nodeId,n=null==e?void 0:e.segmentId,i=Number(null==e?void 0:e.loaded),r=Number(null==e?void 0:e.total);if(!t||!n||!NP(i))return;const o=`${t}:${n}`,s=A.get(o)||{},a={loaded:Math.max(NP(s.loaded)?s.loaded:0,i),total:MP(r)?r:s.total};A.set(o,a),function(){if(P)return;P=!0;const e=null==xP?void 0:xP.requestAnimationFrame;"function"!=typeof e?((null==xP?void 0:xP.setTimeout)||setTimeout)((()=>{P=!1,se()}),0):e((()=>{P=!1,se()}))}()}(e);n.on("segment:chunk",i),N.set(e,{node:n,handler:i})}));for(const[t,n]of N.entries())e.has(t)||(null!=n&&n.node&&"function"==typeof n.node.off&&n.node.off("segment:chunk",n.handler),N.delete(t))}function le({track:e,color:t,start:n,duration:r,startTime:o,durationSeconds:s,segmentRatios:a,bufferedSegments:l,placementId:c,nodeId:u,label:d,rowIndex:h=0,rowHeight:f=18,rowGap:p=0,laneId:m,isClickable:v,isActive:g,tooltip:y,hoverDetailsNodeId:b,showLabel:k,onClick:w}){const x=i.createElement("div");!function(e,t){e.style.position="absolute",e.style.borderRadius="4px",e.style.background=t,e.style.opacity="0.9",e.style.font=SP,e.style.color="#fff",e.style.display="flex",e.style.alignItems="center",e.style.whiteSpace="nowrap",e.style.overflow="hidden",e.style.textOverflow="ellipsis"}(x,t),function(e,{startRatio:t,durationRatio:n,rowIndex:i=0,rowHeight:r=18,rowGap:o=0}={}){const s=i*(r+o)+2,a=Math.max(1,r-4);e.style.top=`${s}px`,e.style.height=`${a}px`;const l=FP(t);if(MP(n)){const t=Math.max(0,Math.min(n,1-l));return e.style.left=100*l+"%",e.style.width=100*t+"%",void(e.style.padding="0 4px")}e.style.left=100*l+"%",e.style.width="2px",e.style.padding="0"}(x,{startRatio:n,durationRatio:r,rowIndex:h,rowHeight:f,rowGap:p}),function(e,{laneId:t,label:n,isClickable:i,shouldShowLabel:r,onClick:o}={}){if(t&&(e.dataset.timelineItem=t),r&&n){const t=xP.document.createElement("span");t.textContent=n,t.style.position="relative",t.style.zIndex="2",t.style.pointerEvents="none",e.appendChild(t)}i&&(e.style.cursor="pointer"),"function"==typeof o&&e.addEventListener("click",o)}(x,{laneId:m,label:d,isClickable:v,shouldShowLabel:"boolean"==typeof k?k:MP(r),onClick:w}),y&&(x.title=y),NP(o)&&(x.dataset.start=String(o)),MP(s)||UR(s)?(x.dataset.end=String(o+s),x.dataset.hasDuration="true"):(x.dataset.end="",x.dataset.hasDuration="false"),c&&(x.dataset.placementId=c),u&&(x.dataset.nodeId=u),x.style.pointerEvents="auto",tD(x,l,NR),function(e,t=[]){e&&Array.isArray(t)&&t.length&&t.forEach((t=>{if(!NP(t)||t<=0||t>=1)return;const n=xP.document.createElement("div");n.dataset.segmentBoundary="true",n.style.position="absolute",n.style.top="2px",n.style.bottom="2px",n.style.width="1px",n.style.left=100*FP(t)+"%",n.style.transform="translateX(-0.5px)",n.style.background="rgba(255,255,255,0.35)",n.style.pointerEvents="none",n.style.zIndex="1",e.appendChild(n)}))}(x,a),nD(x,g),y&&(x.addEventListener("mouseenter",(e=>te(y,e))),x.addEventListener("mousemove",(e=>te(y,e))),x.addEventListener("mouseleave",J)),b&&(x.addEventListener("mouseenter",(e=>ie(b,e))),x.addEventListener("mousemove",(e=>ie(b,e))),x.addEventListener("mouseleave",ne)),e.appendChild(x),"nodes"===m&&c?M.set(c,x):"render"===m&&c&&F.set(c,x)}async function ce({event:i,placement:r,rangeEnd:o,track:s}){const a=GR(E);if(a===OR)return;if(a===PR)return void function(t,n,i){if(!e)return;if(!MP(n)||!i)return;const r="function"==typeof i.getBoundingClientRect?i.getBoundingClientRect():null,o=MP(null==r?void 0:r.width)?r.width:i.clientWidth;if(!MP(o))return;const s=NP(null==r?void 0:r.left)?r.left:0,a=FP(((NP(null==t?void 0:t.clientX)?t.clientX:0)-s)/o)*n;NP(a)&&(e.currentTime=a)}(i,o,s);const l="string"==typeof(null==r?void 0:r.nodeId)?r.nodeId:"",c="function"==typeof t&&l?t(l):null,u=a===RR?l:a===DR?JSON.stringify(YR(r,t),null,2):function(e,t){return function(e,t){return function(e,t,n){const i=(e||"").replace(/\/$/,""),r=null==n?void 0:n.assetId,o=null==n?void 0:n.assetRevision;if(i&&"string"==typeof r&&"number"==typeof o)return`${i}/raw/${encodeURIComponent(r)}/${o}`}(e,0,t)}(t,null==e?void 0:e.manifestRef)}(c,n),d=a===RR?"Copied node ID":a===DR?"Copied node context":"Copied source video URL";if(u)try{await async function(e,t){const n=null==xP||null===(t=xP.navigator)||void 0===t?void 0:t.clipboard;if(!n||"function"!=typeof n.writeText)throw new Error("Clipboard API unavailable.");await n.writeText(e)}(u),ee(d)}catch(e){}else a===LR&&ee("Source video URL unavailable",{tone:"warning"})}function ue(){const n=function(){let e=0;const n=Array.isArray(_)?_:[],i=Array.isArray(T)?T.filter((e=>!0!==(null==e?void 0:e.offsetPending))):[];return n.forEach((n=>{if(!0===(null==n?void 0:n.offsetPending))return;const i=NP(null==n?void 0:n.offset)?n.offset:void 0;if(!NP(i))return;const r=$R(n,t);e=MP(r)?Math.max(e,i+r):Math.max(e,i)})),i.forEach((t=>{const n=NP(null==t?void 0:t.offset)?t.offset:0,i=jR(t);e=MP(i)?Math.max(e,n+i):Math.max(e,n)})),MP(e)?e:1}();S=n,h.textContent=`t=${CP(I)}s`,f.textContent=`range=0-${CP(n)}s`,J(),ne(),j(w.track),j(x.track),M.clear(),F.clear(),C=new Set,O=null,P=!1;const i=Array.isArray(_)?_:[],r=Array.isArray(T)?T:[],o=function(n){const i=(Array.isArray(n)?n.slice():[]).map((e=>{if(!0===(null==e?void 0:e.offsetPending))return null;const n=NP(null==e?void 0:e.offset)?e.offset:void 0;if(!NP(n))return null;const i=$R(e,t);return{placement:e,offset:n,duration:i,end:MP(i)?n+i:n,rowIndex:0}})).filter(Boolean).sort(((e,t)=>{var n,i,r,o;const s=e.offset-t.offset;if(0!==s)return s;const a="string"==typeof(null===(n=e.placement)||void 0===n?void 0:n.nodeId)?e.placement.nodeId:"",l="string"==typeof(null===(i=t.placement)||void 0===i?void 0:i.nodeId)?t.placement.nodeId:"";if(a!==l)return a.localeCompare(l);const c="string"==typeof(null===(r=e.placement)||void 0===r?void 0:r.placementId)?e.placement.placementId:"",u="string"==typeof(null===(o=t.placement)||void 0===o?void 0:o.placementId)?t.placement.placementId:"";return c.localeCompare(u)})),r=[],o=function(e,t){const n=Number(null==e||null===(t=e.settings)||void 0===t?void 0:t.snapToFps);return!Number.isFinite(n)||n<=0?0:.5/n}(e);return i.forEach((e=>{const t=e.offset,n=NP(e.end)?e.end:t;let i=-1;for(let e=0;e<r.length;e+=1)if(r[e]<=t+o){i=e;break}-1===i?(i=r.length,r.push(n)):r[i]=Math.max(r[i],n),e.rowIndex=i})),{items:i,rowCount:Math.max(1,r.length)}}(i);var s;!function(e){const t=e.rowCount*AR+4*(e.rowCount-1);w.track.style.height=`${t}px`,x.track.style.height="18px",w.track.style.cursor="default",w.track.style.pointerEvents="auto",x.track.style.pointerEvents="auto"}(o),function(e,t){e.items.forEach((e=>{const n=e.placement,i=e.offset,r=e.duration,o=(null==n?void 0:n.nodeId)||(null==n?void 0:n.placementId)||"node",s=!!NP(I)&&I>=i&&(!MP(r)||I<i+r),a=oe(n),l=GR(E)!==OR;le({track:w.track,color:"rgba(255,255,255,0.16)",start:FP(i/t),duration:MP(r)?FP(r/t):null,startTime:i,durationSeconds:r,segmentRatios:a.boundaries,bufferedSegments:a.buffered,placementId:null==n?void 0:n.placementId,nodeId:null==n?void 0:n.nodeId,label:o,rowIndex:e.rowIndex,rowHeight:AR,rowGap:4,laneId:"nodes",isClickable:l,isActive:s,tooltip:(null==n?void 0:n.nodeId)||(null==n?void 0:n.placementId),hoverDetailsNodeId:null==n?void 0:n.nodeId,onClick:l?e=>{ce({event:e,placement:n,rangeEnd:t,track:w.track})}:void 0})}))}(o,n),s=n,r.forEach((e=>{const t=NP(null==e?void 0:e.offset)?e.offset:void 0;if(!NP(t))return;const n=jR(e),i=UR(n),r=(null==e?void 0:e.type)||(null==e?void 0:e.renderPlacementId)||"render",o=function(e){const t="string"==typeof e?e.trim().toLowerCase():"";return"switch"===t||"switching"===t||"switchingrendernode"===t}(null==e?void 0:e.type),a=o?()=>{"function"==typeof(null==xP?void 0:xP.switchTo)&&xP.switchTo("next")}:void 0;let l=!1;NP(I)&&(i?l=I>=t:MP(n)&&(l=I>=t&&I<t+n));const c=i&&MP(s)?FP((s-t)/s):MP(n)?FP(n/s):null;le({track:x.track,color:"rgba(248,162,62,0.9)",start:FP(t/s),duration:c,startTime:t,durationSeconds:n,label:r,placementId:null==e?void 0:e.renderPlacementId,rowIndex:0,rowHeight:AR,rowGap:0,laneId:"render",isClickable:!!o,isActive:l,tooltip:(null==e?void 0:e.type)||(null==e?void 0:e.renderPlacementId),showLabel:MP(n)||i,onClick:a})})),Q(w.indicator,n),Q(x.indicator,n),re(),se(),D=eD(_,T)||JR(_,t),R=D?QR(_,T,t):"",L=Array.isArray(_)?_.length:0,B=Array.isArray(T)?T.length:0,Y()}function de(e,n){_=Array.isArray(e)?e.slice():[],T=Array.isArray(n)?n.slice():[],D=eD(_,T)||JR(_,t),ae(),ue()}return v.addEventListener("change",(()=>{E=GR(v.value),v.value=E,ue()})),{id:"timeline",title:"Timeline",render:e=>{e.appendChild(r),ue()},updatePlacements:de,updateTime:function(e){if(I=NP(e)?e:I,K())return;if(D&&X())return;const t=S;NP(t)&&(h.textContent=`t=${CP(I)}s`,f.textContent=`range=0-${CP(t)}s`,Q(w.indicator,t),Q(x.indicator,t),re())},refresh:()=>ue(),dispose:()=>{U(),Z();for(const e of N.values())(null==e?void 0:e.node)&&"function"==typeof e.node.off&&e.node.off("segment:chunk",e.handler);N.clear(),A.clear()}}}const rD=1024,oD=1048576,sD=1073741824;function aD(e){return NP(e)?e<rD?`${Math.round(e)} B`:e<oD?`${CP(e/rD,1)} KB`:e<sD?`${CP(e/oD,2)} MB`:`${CP(e/sD,2)} GB`:"n/a"}const lD="ekoplayer-debug-overlay";var cD=new WeakMap,uD=new WeakMap,dD=new WeakMap,hD=new WeakMap,fD=new WeakSet;class pD{constructor({tabBarEl:e,contentEl:t}){O(this,fD),F(this,cD,[]),F(this,uD,void 0),F(this,dD,void 0),F(this,hD,void 0),C(dD,this,e),C(hD,this,t)}registerTab(e){e&&"string"==typeof e.id&&"string"==typeof e.title&&"function"==typeof e.render&&(M(cD,this).some((t=>t.id===e.id))||(M(cD,this).push(e),A(fD,this,mD).call(this),M(uD,this)||this.selectTab(e.id)))}selectTab(e){M(cD,this).find((t=>t.id===e))&&(C(uD,this,e),A(fD,this,mD).call(this),A(fD,this,vD).call(this))}dispose(){M(dD,this)&&(M(dD,this).innerHTML=""),M(hD,this)&&(M(hD,this).innerHTML=""),C(cD,this,[]),C(dD,this,null),C(hD,this,null)}}function mD(){const e=M(dD,this);e&&(e.innerHTML="",M(cD,this).forEach((t=>{const n=xP.document.createElement("button");n.type="button",n.textContent=t.title,n.style.cursor="pointer",n.style.padding="6px 10px",n.style.borderRadius="6px",n.style.border="1px solid rgba(255,255,255,0.2)",n.style.background=t.id===M(uD,this)?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.2)",n.style.color="#fff",n.style.font=AP,n.addEventListener("click",(()=>this.selectTab(t.id))),e.appendChild(n)})))}function vD(){const e=M(hD,this);if(!e)return;e.innerHTML="";const t=M(cD,this).find((e=>e.id===M(uD,this)));t&&t.render(e)}function gD({mountElement:e,canvasElement:t,timeline:n,assetsDeliveryServiceUrl:i,getNode:r,listNodes:o,downloadSpeed:s,downloadEvents:a,qoe:l,qoeEvents:c,options:u={},playbackStartedAtMs:d,playerVersion:h}={}){if(!e)throw new Error("Debug overlay requires mountElement.");if(!n||"function"!=typeof n.on)throw new Error("Debug overlay requires a Timeline with .on/.off.");!function(e){if(!e||!e.style)return;const t=null==xP?void 0:xP.window,n=t&&"function"==typeof t.getComputedStyle?t.getComputedStyle(e):null,i=n?n.position:e.style.position;i&&"static"!==i||(e.style.position="relative")}(e);const f=xP.document.getElementById(lD);f&&f.parentNode&&f.parentNode.removeChild(f);const p=function({mountElement:e,playerVersion:t}){const n=null==xP?void 0:xP.document;if(!n||"function"!=typeof n.createElement)throw new Error("Debug overlay requires document.createElement.");const i=n.createElement("div");i.id=lD,i.style.position="absolute",i.style.inset="0",i.style.zIndex="999999",i.style.pointerEvents="none";const r=n.createElement("div");r.style.position="absolute",r.style.top="8px",r.style.left="8px",r.style.width="460px",r.style.maxWidth="calc(100% - 16px)",r.style.background="rgba(0,0,0,0.65)",r.style.border="1px solid rgba(255,255,255,0.18)",r.style.borderRadius="10px",r.style.padding="10px",r.style.color="#fff",r.style.pointerEvents="auto",r.style.backdropFilter="blur(6px)";const o=n.createElement("div");o.style.display="flex",o.style.justifyContent="space-between",o.style.alignItems="center",o.style.gap="10px";const s=n.createElement("div");s.textContent="EkoPlayer Debug",s.style.font="600 13px ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial";const a=n.createElement("button");a.type="button",a.textContent="Hide",a.style.cursor="pointer",a.style.padding="6px 10px",a.style.borderRadius="8px",a.style.border="1px solid rgba(255,255,255,0.2)",a.style.background="rgba(0,0,0,0.2)",a.style.color="#fff",o.appendChild(s),o.appendChild(a);const l=n.createElement("div");l.style.display="flex",l.style.gap="8px",l.style.marginTop="10px";const c=n.createElement("div");c.style.marginTop="10px";const u=n.createElement("div");u.style.marginTop="10px",u.style.font=SP,u.style.display="flex",u.style.justifyContent="space-between",u.style.alignItems="center",u.style.gap="10px";const d=n.createElement("div");d.style.color="rgba(140, 224, 255, 0.9)",d.textContent="Playback started @ --";const h=n.createElement("div");h.style.opacity="0.7",h.style.marginLeft="auto",h.textContent=t?`version ${t}`:"version n/a",u.appendChild(d),u.appendChild(h);const f=n.createElement("button");return f.type="button",f.textContent="Debug",f.style.position="absolute",f.style.top="8px",f.style.left="8px",f.style.cursor="pointer",f.style.padding="6px 10px",f.style.borderRadius="10px",f.style.border="1px solid rgba(255,255,255,0.25)",f.style.background="rgba(0,0,0,0.55)",f.style.color="#fff",f.style.pointerEvents="auto",f.style.display="none",r.appendChild(o),r.appendChild(l),r.appendChild(c),r.appendChild(u),i.appendChild(r),i.appendChild(f),e.appendChild(i),{overlayRoot:i,panel:r,tabBar:l,content:c,hideBtn:a,showBtn:f,footerPlayback:d}}({mountElement:e,playerVersion:h||(null==u?void 0:u.playerVersion)}),m=new pD({tabBarEl:p.tabBar,contentEl:p.content});let v=!0;function g(){v=!1,p.panel.style.display="none",p.showBtn.style.display="inline-block"}function y(){v=!0,p.panel.style.display="block",p.showBtn.style.display="none"}p.hideBtn.addEventListener("click",g),p.showBtn.addEventListener("click",y);const b=iD({timeline:n,getNode:r,assetsDeliveryServiceUrl:i}),k=function({getNode:e}){const t=xP.document,n=t.createElement("pre");n.style.margin="0",n.style.whiteSpace="pre-wrap",n.style.font=AP,n.style.lineHeight="1.35";const i=t.createElement("div");i.style.display="flex",i.style.flexDirection="column",i.style.gap="8px",i.style.marginTop="6px";const r=t.createElement("div");r.style.display="flex",r.style.gap="10px",r.style.marginTop="10px",r.style.alignItems="center",r.style.flexWrap="wrap";const o=new jP({maxValue:60}),s=new jP({maxValue:60}),a=t.createElement("div"),l=t.createElement("div");l.textContent="browserfps",l.style.font=SP,l.style.opacity="0.9",a.appendChild(l),a.appendChild(o.element);const c=t.createElement("div"),u=t.createElement("div");return u.textContent="fps",u.style.font=l.style.font,u.style.opacity="0.9",c.appendChild(u),c.appendChild(s.element),r.appendChild(a),r.appendChild(c),{id:"frames",title:"Frames",render:e=>{e.appendChild(n),e.appendChild(i),e.appendChild(r)},pushBrowserFps:(e,t)=>o.push(e,t),pushVisualFps:(e,t)=>s.push(e,t),updateInfo:function({time:r,entries:o}){const s=Array.isArray(o)?o.slice().sort(VP):[];if(!s.length)return n.textContent="",void(i.innerHTML="");n.textContent=`t=${QP(r)}s tracks=${s.length}`,i.innerHTML="";for(let n=0;n<s.length;n+=1){const r=s[n],o=eR(e,r),a=(null==o?void 0:o.id)||"n/a",l=(null==o?void 0:o.codecs)||(null==o?void 0:o.mime)||"n/a",c=YP(null==o?void 0:o.bandwidth),u=OP(null==o?void 0:o.width,null==o?void 0:o.height),d=JP(e,r)||"n/a",h=ZP(e,r),f=h?` fallback=${h}`:"",p=KP(e,r),m=(null==p?void 0:p.strategy)||"n/a",v=(null==p?void 0:p.decisionReason)||"n/a",g=XP(null==p?void 0:p.measuredDownloadSpeedKbps),y=XP(null==p?void 0:p.safeBandwidthKbps),b=t.createElement("div");b.style.display="flex",b.style.flexDirection="column",b.style.gap="2px";const k=t.createElement("pre");k.style.margin="0",k.style.whiteSpace="pre-wrap",k.style.font=AP,k.style.lineHeight="1.35",k.textContent=[`${(null==r?void 0:r.nodeId)||"?"} ${(null==r?void 0:r.trackId)||"?"} ${(null==r?void 0:r.segmentId)||"?"} pts=${QP(null==r?void 0:r.presentationTime)}s`,`rep=${a} encodeProfile=${d}${f} res=${u} codec=${l} repBW=${c}`,`abr=strategy:${m} reason:${v} measuredBW:${g} safeBW:${y}`].join("\n"),b.appendChild(k);const w=(null==p?void 0:p.selectedRepresentationId)||(null==o?void 0:o.id),x=iR(e,r,o,p);if(x.length){const e=t.createElement("div");e.style.display="flex",e.style.alignItems="center",e.dataset.abrLadderRow="true",e.dataset.trackId=(null==r?void 0:r.trackId)||"",e.dataset.segmentId=(null==r?void 0:r.segmentId)||"";const n=t.createElement("div");n.style.display="inline-flex",n.style.alignItems="center",n.style.gap="2px",n.dataset.abrLadder="true",x.forEach((e=>{const i=t.createElement("span"),r=!!w&&e.id===w;i.dataset.abrLadderBlock="true",i.dataset.repId=e.id||"",i.dataset.selected=r?"true":"false",i.style.display="inline-block",i.style.width="10px",i.style.height="8px",i.style.borderRadius="2px",i.style.border="1px solid rgba(255,255,255,0.35)",i.style.background=r?"rgba(74, 222, 128, 0.95)":"rgba(156, 163, 175, 0.55)",i.title=`${e.id||"?"} ${XP(e.bandwidthKbps)}`,n.appendChild(i)})),e.appendChild(n),b.appendChild(e)}i.appendChild(b)}},dispose:()=>{o.dispose(),s.dispose()}}}({getNode:r}),w=lR({downloadSpeed:s,downloadEvents:a}),x=function({qoe:e,qoeEvents:t}={}){const n=null==xP?void 0:xP.document;if(!n||"function"!=typeof n.createElement)throw new Error("Debug overlay QoE tab requires document.createElement.");const i=n.createElement("pre");i.style.margin="0",i.style.whiteSpace="pre-wrap",i.style.font=AP;const{graphWrap:r,graph:o}=function(e){const t=e.createElement("div");t.style.marginTop="10px";const n=e.createElement("div");n.textContent="qoe score",n.style.font=SP,n.style.opacity="0.9";const i=new jP({maxValue:1,windowMs:3e4,formatValue:e=>cR(e)});return t.appendChild(n),t.appendChild(i.element),{graphWrap:t,graph:i}}(n);let s=null;const a=()=>{i.textContent=function(e){if(!e)return"QoE unavailable";const t="string"==typeof e.status?e.status:"n/a";return[`score=${cR(e.score)}`,`status=${t}`,`streamQualityScore=${cR(e.streamQualityScore)}`,`fpsScore=${cR(e.fpsScore)}`,`browserFps=${cR(e.browserFps)}`,`waitingSeconds=${cR(e.waitingSeconds)}`,`playingSeconds=${cR(e.playingSeconds)}`].join("\n")}(e)},l=()=>{if(!e)return;const t=Number(e.score);Number.isFinite(t)&&o.push(t,uR())},c=e=>{const t=Number(e);Number.isFinite(t)&&o.push(t,uR()),a()},u=()=>{a()};if(a(),l(),t&&"function"==typeof t.on&&(t.on("qoescore",c),t.on("qoestatus",u)),e){const e="function"==typeof(null==xP?void 0:xP.setInterval)?xP.setInterval:setInterval;s=e((()=>{l(),a()}),1e3)}return{id:"qoe",title:"QoE",render:e=>{e.appendChild(i),e.appendChild(r)},dispose:()=>{t&&"function"==typeof t.off&&(t.off("qoescore",c),t.off("qoestatus",u)),s&&(("function"==typeof(null==xP?void 0:xP.clearInterval)?xP.clearInterval:clearInterval)(s),s=null),o.dispose()}}}({qoe:l,qoeEvents:c}),_=function({timeline:e,getNode:t,listNodes:n,options:i}={}){const r=null==xP?void 0:xP.document;if(!r||"function"!=typeof r.createElement)throw new Error("Debug overlay Memory tab requires document.createElement.");const o=r.createElement("pre");o.style.margin="0",o.style.whiteSpace="pre-wrap",o.style.font=AP;const s=r.createElement("div");s.textContent="nodes",s.style.marginTop="10px",s.style.font=SP,s.style.opacity="0.9";const a=r.createElement("pre");a.style.margin="6px 0 0 0",a.style.whiteSpace="pre-wrap",a.style.font=AP;let l=null;const c=()=>{const r=function({timeline:e,getNode:t,listNodes:n}){const i=[];let r=0;if("function"==typeof n){let e;try{e=n()}catch(t){e=null}if(Array.isArray(e))return e.forEach((e=>{const t=null==e?void 0:e.id;if("string"!=typeof t||!t.length)return;const n=Number(null==e?void 0:e.retainedByteLength);Number.isFinite(n)&&(r+=n,i.push({nodeId:t,bytes:n}))})),i.sort(((e,t)=>t.bytes-e.bytes)),{totalBytes:r,nodes:i,available:!0}}if(!e||"function"!=typeof t)return{totalBytes:0,nodes:[],available:!1};const o=Array.isArray(e.placements)?e.placements:[];return new Set(o.map((e=>null==e?void 0:e.nodeId)).filter((e=>"string"==typeof e&&e.length))).forEach((e=>{const n=t(e),o=Number(null==n?void 0:n.retainedByteLength);Number.isFinite(o)&&(r+=o,i.push({nodeId:e,bytes:o}))})),i.sort(((e,t)=>t.bytes-e.bytes)),{totalBytes:r,nodes:i,available:!0}}({timeline:e,getNode:t,listNodes:n}),s=function({timeline:e}){if(!e||"function"!=typeof e.getDecodedFrameStats)return{totalBytes:0,frames:0,available:!1};try{const t=e.getDecodedFrameStats(),n=Number(null==t?void 0:t.totalBytes),i=Number(null==t?void 0:t.frames);return{totalBytes:Number.isFinite(n)?n:0,frames:Number.isFinite(i)?i:0,available:!1!==(null==t?void 0:t.available)}}catch(e){return{totalBytes:0,frames:0,available:!1}}}({timeline:e}),l=function(e,t,n,i){const r=Number(null!==(n=null==e||null===(i=e.publicOptions)||void 0===i?void 0:i.segmentEvictionMaxRetainedBytes)&&void 0!==n?n:null==e?void 0:e.segmentEvictionMaxRetainedBytes),o=NP(r)&&r>=0,s=o?aD(r):"n/a";return{active:o&&NP(t)&&t>r,thresholdLabel:s}}(i,r.available?r.totalBytes:NaN),c=l.active?"on":"off",u=s.available?aD(s.totalBytes):"n/a",d=s.available?s.frames:"n/a";if(!r.available)return o.textContent=[`decoded=${u} decodedFrames=${d}`,`retained=n/a eviction=${c} threshold=${l.thresholdLabel}`].join("\n"),void(a.textContent="");if(o.textContent=[`decoded=${u} decodedFrames=${d}`,[`retained=${aD(r.totalBytes)}`,`nodes=${r.nodes.length}`,`eviction=${c}`,`threshold=${l.thresholdLabel}`].join(" ")].join("\n"),!r.nodes.length)return void(a.textContent="none");const h=r.nodes.slice(0,8).map((e=>`${e.nodeId}: ${aD(e.bytes)}`));a.textContent=h.join("\n")};c();const u="function"==typeof(null==xP?void 0:xP.setInterval)?xP.setInterval:setInterval;return l=u(c,1e3),{id:"memory",title:"Memory",render:e=>{e.appendChild(o),e.appendChild(s),e.appendChild(a)},refresh:c,dispose:()=>{l&&(("function"==typeof(null==xP?void 0:xP.clearInterval)?xP.clearInterval:clearInterval)(l),l=null)}}}({timeline:n,getNode:r,listNodes:o,options:u});m.registerTab(b),m.registerTab(k),m.registerTab(w),m.registerTab(x),m.registerTab(_),m.registerTab(function({options:e}={}){const t=null==xP?void 0:xP.document;if(!t||"function"!=typeof t.createElement)throw new Error("Debug overlay options tab requires document.createElement.");const n=t.createElement("pre");n.style.margin="0",n.style.font=AP,n.style.whiteSpace="pre-wrap",n.style.wordBreak="break-word";const i=null==e?void 0:e.publicOptions,r=i&&"object"==typeof i?Object.keys(i):[];if(r.length){const e=r.map((e=>`${e}=${function(e){if(null===e)return"null";if(void 0===e)return"undefined";const t=typeof e;if("string"===t)return e;if("number"===t||"boolean"===t)return String(e);try{return JSON.stringify(e)}catch(t){return String(e)}}(i[e])}`));n.textContent=e.join("\n")}else n.textContent="publicOptions unavailable";return{id:"options",title:"Options",render:e=>{e.appendChild(n)}}}({options:u}));const T=[],I=[];let E=0,S=0,A=null,N=!1,M=0,F=null;function C(e){const t=Number(e);Number.isFinite(t)&&(t-M<250||(M=t,k.pushBrowserFps(E,t),k.pushVisualFps(S,t)))}xP.window&&"function"==typeof xP.window.requestAnimationFrame&&(A=xP.window.requestAnimationFrame((function e(t){N||(E=GP(T,t),C(t),A=xP.window.requestAnimationFrame(e))})));const O=(e={})=>{if(N||!v)return;const t=Array.isArray(e.frames)?e.frames:[];if(!t.length)return void(F=null);const n=null!=xP&&xP.performance&&"function"==typeof xP.performance.now?xP.performance.now():Date.now(),i=t.map((e=>`${null==e?void 0:e.nodeId}:${null==e?void 0:e.trackId}:${null==e?void 0:e.segmentId}@${null==e?void 0:e.presentationTime}`)).join("|");i!==F&&(S=GP(I,n),F=i),k.updateInfo({time:e.time,entries:t}),C(n)};let P=Number.isFinite(d)?d:void 0;if(Number.isFinite(P)&&p.footerPlayback){const e=P/1e3;p.footerPlayback.textContent=`Playback started @ ${CP(e)}s`}const R=(e={})=>{if(!N&&void 0===P&&"playing"===(null==e?void 0:e.event)&&(P=TP(),p.footerPlayback)){const e=P/1e3;p.footerPlayback.textContent=`Playback started @ ${CP(e)}s`}},D=()=>{const e=Array.isArray(null==n?void 0:n.placements)?n.placements:[],t=Array.isArray(null==n?void 0:n.renderPlacements)?n.renderPlacements:[];b.updatePlacements(e,t)},L=(e={})=>{if(N)return;const t=Number.isFinite(null==e?void 0:e.time)?e.time:null==n?void 0:n.currentTime;b.updateTime(t),_&&"function"==typeof _.refresh&&_.refresh()},B=()=>{N||D()},z=()=>{N||D()},W=null==n?void 0:n.trackBuffers,$=()=>{N||("function"==typeof b.refresh?b.refresh():D(),_&&"function"==typeof _.refresh&&_.refresh())};return n.on(IP.VISUAL_FRAMES_AVAILABLE,O),n.on(IP.TIMELINE_TIME_UPDATE,L),n.on(IP.PLACEMENT_ADDED,B),n.on(IP.RENDER_PLACEMENT_ADDED,z),n.on(IP.TIMELINE_PLAYER_STATE,R),W&&"function"==typeof W.on&&W.on("track:bufferupdate",$),D(),b.updateTime(null==n?void 0:n.currentTime),{show:y,hide:g,dispose:function(){N||(N=!0,A&&xP.window&&"function"==typeof xP.window.cancelAnimationFrame&&xP.window.cancelAnimationFrame(A),A=null,n&&"function"==typeof n.off&&(n.off(IP.VISUAL_FRAMES_AVAILABLE,O),n.off(IP.TIMELINE_TIME_UPDATE,L),n.off(IP.PLACEMENT_ADDED,B),n.off(IP.RENDER_PLACEMENT_ADDED,z),n.off(IP.TIMELINE_PLAYER_STATE,R)),W&&"function"==typeof W.off&&W.off("track:bufferupdate",$),k&&"function"==typeof k.dispose&&k.dispose(),b&&"function"==typeof b.dispose&&b.dispose(),w&&"function"==typeof w.dispose&&w.dispose(),x&&"function"==typeof x.dispose&&x.dispose(),_&&"function"==typeof _.dispose&&_.dispose(),m.dispose(),p.overlayRoot&&p.overlayRoot.parentNode&&p.overlayRoot.parentNode.removeChild(p.overlayRoot))},registerTab:function(e){m.registerTab(e)},selectTab:function(e){m.selectTab(e)}}}var yD=Object.freeze({__proto__:null,createDebugOverlay:gD,default:gD});exports.EkoGallery=bP,exports.EkoGalleryLegacy=nn,exports.ekoWebPixel=S,exports.getEkoAnalyticsSnippet=function(e){return`if (!window.EkoAnalytics) {\n !function () {\n var t, a, e, s, n;\n 'undefined' == typeof window || window.EkoAnalytics || (t = window, a = 'EkoAnalytics', e = document, s = 'script', t[a] || (t[a] = function () {\n t[a].f ? (t[a].q.push(arguments), t[a].ts.push(Date.now())) : t[a].apply(t, arguments);\n }, t[a].f = !0, t[a].q = t[a].q || [], t[a].ts = t[a].ts || [], t[a].t = Number(new Date), t[a].sa = [], t[a].cb = [], t[a].init = function (ids) {\n t[a].id = ids;\n }, t[a].childRequestIdsCallback = function (e) {\n e.data && 'ea-ids-request' === e.data.type && t[a].sa.push(e.source);\n }, t.addEventListener('message', t[a].childRequestIdsCallback)));\n }();\n\n window.EkoAnalytics.cb.push(() => {\n let setCookie = (key, value, additionalProperties = '') => {\n let hostname = window.location.hostname;\n let domain = hostname;\n \n let parts = hostname.split('.');\n if (parts.length > 2) {\n domain = parts.slice(-2).join('.');\n }\n\n // "samesite=lax" is needed for cross-site situations (like NZXT getting checkout url attributes from lambda).\n window.document.cookie = \`\${key}=\${value}; domain=.\${domain}; path=/; secure; samesite=lax; \${additionalProperties}\`;\n };\n\n setCookie('easid', encodeURIComponent(window.EkoAnalytics('getSid')));\n setCookie('eauid', encodeURIComponent(window.EkoAnalytics('getUid')), 'max-age=2147483647');\n });\n\n window.EkoAnalytics('configure', {\n snowplow: {\n options: {\n appId: 'ekoGalleryReactV4',\n },\n },\n ekoEnv: '${e?"production":"development"}',\n env: 'website',\n });\n window.EkoAnalytics('track', 'PageView');\n }`},exports.getEkoProductConfigUrl=kP,exports.getEkoProductConfigUrlLegacy=wP;