@ekolabs/eko-gallery-react 4.0.14-copy-instance-1193978.0 → 4.0.14-copy-instance-1201591.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 ut=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;var i=Object.getOwnPropertyNames(e).map((function(t){return e[t]}));if("0123456789"!==i.join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(t){r[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var n,i,r=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),o=1;o<arguments.length;o++){for(var s in n=Object(arguments[o]))lt.call(n,s)&&(r[s]=n[s]);if(at){i=at(n);for(var a=0;a<i.length;a++)ct.call(n,i[a])&&(r[i[a]]=n[i[a]])}}return r},dt="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",ht=Function.call.bind(Object.prototype.hasOwnProperty),ft=function(){};if("production"!==process.env.NODE_ENV){var pt=dt,mt={},vt=ht;ft=function(t){var e="Warning: "+t;"undefined"!=typeof console&&console.error(e);try{throw new Error(e)}catch(t){}}}function gt(t,e,n,i,r){if("production"!==process.env.NODE_ENV)for(var o in t)if(vt(t,o)){var s;try{if("function"!=typeof t[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 t[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw a.name="Invariant Violation",a}s=t[o](e,o,i,n,null,pt)}catch(t){s=t}if(!s||s instanceof Error||ft((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 mt)){mt[s.message]=!0;var l=r?r():"";ft("Failed "+n+" type: "+s.message+(null!=l?l:""))}}}gt.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(mt={})};var yt=gt,bt=function(){};function kt(){return null}"production"!==process.env.NODE_ENV&&(bt=function(t){var e="Warning: "+t;"undefined"!=typeof console&&console.error(e);try{throw new Error(e)}catch(t){}});var wt=function(t,e){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(kt),arrayOf:function(t){return l((function(e,n,i,r,o){if("function"!=typeof t)return new a("Property `"+o+"` of component `"+i+"` has invalid PropType notation inside arrayOf.");var s=e[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=t(s,l,i,r,o+"["+l+"]",dt);if(c instanceof Error)return c}return null}))},element:l((function(e,n,i,r,o){var s=e[n];return t(s)?null:new a("Invalid "+r+" `"+o+"` of type `"+h(s)+"` supplied to `"+i+"`, expected a single ReactElement.")})),elementType:l((function(t,e,n,i,r){var o=t[e];return st.isValidElementType(o)?null:new a("Invalid "+i+" `"+r+"` of type `"+h(o)+"` supplied to `"+n+"`, expected a single ReactElement type.")})),instanceOf:function(t){return l((function(e,n,i,o,s){if(!(e[n]instanceof t)){var l=t.name||r;return new a("Invalid "+o+" `"+s+"` of type `"+(((c=e[n]).constructor&&c.constructor.name?c.constructor.name:r)+"` supplied to `")+i+"`, expected instance of `"+l+"`.")}var c;return null}))},node:l((function(t,e,n,i,r){return d(t[e])?null:new a("Invalid "+i+" `"+r+"` supplied to `"+n+"`, expected a ReactNode.")})),objectOf:function(t){return l((function(e,n,i,r,o){if("function"!=typeof t)return new a("Property `"+o+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var s=e[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(ht(s,c)){var u=t(s,c,i,r,o+"."+c,dt);if(u instanceof Error)return u}return null}))},oneOf:function(t){if(!Array.isArray(t))return"production"!==process.env.NODE_ENV&&bt(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."),kt;return l((function(e,n,i,r,o){for(var l=e[n],c=0;c<t.length;c++)if(s(l,t[c]))return null;var u=JSON.stringify(t,(function(t,e){return"symbol"===f(e)?String(e):e}));return new a("Invalid "+r+" `"+o+"` of value `"+String(l)+"` supplied to `"+i+"`, expected one of "+u+".")}))},oneOfType:function(t){if(!Array.isArray(t))return"production"!==process.env.NODE_ENV&&bt("Invalid argument supplied to oneOfType, expected an instance of array."),kt;for(var e=0;e<t.length;e++){var n=t[e];if("function"!=typeof n)return bt("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+p(n)+" at index "+e+"."),kt}return l((function(e,n,i,r,o){for(var s=[],l=0;l<t.length;l++){var c=(0,t[l])(e,n,i,r,o,dt);if(null==c)return null;c.data&&ht(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(t){return l((function(e,n,i,r,o){var s=e[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 t){var d=t[c];if("function"!=typeof d)return u(i,r,o,c,f(d));var p=d(s,c,i,r,o+"."+c,dt);if(p)return p}return null}))},exact:function(t){return l((function(e,n,i,r,o){var s=e[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected `object`.");var c=ut({},e[n],t);for(var d in c){var p=t[d];if(ht(t,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(e[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(t),null," "));var m=p(s,d,i,r,o+"."+d,dt);if(m)return m}return null}))}};function s(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}function a(t,e){this.message=t,this.data=e&&"object"==typeof e?e:{},this.stack=""}function l(t){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!==dt){if(e){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&&(bt("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:t(s,l,c,u,d)}var s=o.bind(null,!1);return s.isRequired=o.bind(null,!0),s}function c(t){return l((function(e,n,i,r,o,s){var l=e[n];return h(l)!==t?new a("Invalid "+r+" `"+o+"` of type `"+f(l)+"` supplied to `"+i+"`, expected `"+t+"`.",{expectedType:t}):null}))}function u(t,e,n,i,r){return new a((t||"React class")+": "+e+" type `"+n+"."+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+r+"`.")}function d(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(d);if(null===e||t(e))return!0;var r=function(t){var e=t&&(n&&t[n]||t[i]);if("function"==typeof e)return e}(e);if(!r)return!1;var o,s=r.call(e);if(r!==e.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(t){var e=typeof t;return Array.isArray(t)?"array":t instanceof RegExp?"object":function(t,e){return"symbol"===t||!!e&&("Symbol"===e["@@toStringTag"]||"function"==typeof Symbol&&e instanceof Symbol)}(e,t)?"symbol":e}function f(t){if(null==t)return""+t;var e=h(t);if("object"===e){if(t instanceof Date)return"date";if(t instanceof RegExp)return"regexp"}return e}function p(t){var e=f(t);switch(e){case"array":case"object":return"an "+e;case"boolean":case"date":case"regexp":return"a "+e;default:return e}}return a.prototype=Error.prototype,o.checkPropTypes=yt,o.resetWarningCache=yt.resetWarningCache,o.PropTypes=o,o};function xt(){}function _t(){}_t.resetWarningCache=xt;var Tt=D((function(t){if("production"!==process.env.NODE_ENV){var e=st;t.exports=wt(e.isElement,!0)}else t.exports=function(){function t(t,e,n,i,r,o){if(o!==dt){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 e(){return t}t.isRequired=t;var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:_t,resetWarningCache:xt};return n.PropTypes=n,n}()}));const Et=/https?:\/\/(.*?\.)?eko.com/,It={"eko.project.interaction":"interaction","eko.project.swipe":"swipe"};let St=null,At=null,Nt=[];function Mt(t){return e=>{var n;if(!Et.test(e.origin)||"eko.embedapi"!==(null===(n=e.data)||void 0===n?void 0:n.source))return;const i=e.data,r=It[i.type];r&&(t?t(r,i.data):Nt.push({type:r,data:i.data}))}}"undefined"!=typeof window&&(At=Mt(null),window.addEventListener("message",At));var Ft={subscribe:function(t){"function"==typeof t?St?console.warn("[eko-gallery-react] Ignoring events subscribe since already subscribed"):(St=t,At=Mt(t),window.addEventListener("message",At),function(t){Nt.forEach((e=>{t(e.type,e.data)})),Nt=[]}(t)):console.warn("[eko-gallery-react] Ignoring events subscribe since a callback function was not provided as argument")},unsubscribe:function(){At?(window.removeEventListener("message",At),At=null,St=null,Nt=[]):console.warn("[eko-gallery-react] Ignoring events unsubscribe since not subscribed")},send:function(t,e){St?St(t,e):Nt.push({type:t,data:e})}};const Ct=({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(t,e=200){if(!t)return null;try{let n=t;t.includes("assets.eko.com")&&t.includes("/raw/")&&(n=t.replace("/raw/","/image/"));const i=new URL(n);return i.searchParams.set("width",e),i.href}catch(e){return t}}(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(t){S.track("gallery.interaction",{elementid:`thumbnail-${t}`,interactiontype:"click"}),Ft.send("interaction",{elementid:`thumbnail-${t}`,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})`}}))))};Ct.propTypes={index:Tt.number,activeIndex:Tt.number,setActiveIndex:Tt.func.isRequired,item:Tt.object.isRequired,src:Tt.string,navItemRefs:Tt.object.isRequired,itemIcon:Tt.string};const Ot=({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(t){const e=i?n.current.clientHeight:n.current.clientWidth,r=function(t,e){const n=i?e.scrollTop:e.scrollLeft;return Math.max(-n,Math.min(v-t-n,t))}("next"===t?e:-e,n.current);return{top:i?r:0,left:i?0:r,behavior:"smooth"}}function y(t){var e,i,r;const o=g(t),s="next"===t?null==h||null===(e=h.current)||void 0===e?void 0:e.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}),Ft.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 Pt(t,e,n){let i;return function(){const n=this,r=arguments;clearTimeout(i),i=setTimeout((function(){i=null,t.apply(n,r)}),e)}}Ot.propTypes={layout:Tt.object.isRequired,nav:Tt.object.isRequired,isVerticalNav:Tt.bool.isRequired,showPrevArrow:Tt.bool.isRequired,showNextArrow:Tt.bool.isRequired};const Rt=({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 t;const e=s||window.innerWidth<768?"mobile":"desktop",n=(null==r||null===(t=r[e])||void 0===t||null===(t=t.config)||void 0===t?void 0:t.orientation)||("desktop"===e?"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 t,e;const n=s||a()?"mobile":"desktop",i=null!==(t=null==r||null===(e=r[n])||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.navPagination)||void 0===e?void 0:e.scrollThreshold)&&void 0!==t?t:d;!function(t=d){var e,n;const i=l.current;if(!i)return;const o="none"!==(null==r||null===(e=r.desktop)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.navPagination)||void 0===e?void 0:e.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>t?"85%":"100%",m=i.scrollTop<=h-t?"15%":"0%",v=i.scrollWidth-i.clientWidth,g=i.scrollLeft>t?"15%":"0%",y=i.scrollLeft<=v-t?"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(t=d){var e,n,i,r,o,s;const a=p?null==l||null===(e=l.current)||void 0===e?void 0:e.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-t<c?(b(!1),w(!1)):a<=t?(b(!1),w(!0)):a+c>u-t?(b(!0),w(!1)):a+t>0&&a<u-t&&(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=Pt((t=>{var e;e=t,S.track("gallery.interaction",{elementid:"nav",interactiontype:e}),Ft.send("interaction",{elementid:"nav",interactiontype:e})}),200);const E=e.useCallback((t=>{n({index:t,step:0,source:"nav"})}),[]);return e.useEffect((()=>{var t;f(null===(t=u.current)||void 0===t?void 0:t[i])}),[i]),e.useEffect((()=>{if(null!=h&&h.current&&null!=l&&l.current){const t=h.current,e=l.current.clientWidth/2,n=t.clientWidth/2,i=l.current.clientHeight/2,r=t.clientHeight/2;l.current.scrollTo({left:t.offsetLeft-e+n,top:t.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 t=new ResizeObserver(_);return t.observe(l.current),()=>{t.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(Ot,{layout:r,nav:l,isVerticalNav:p,showPrevArrow:y,showNextArrow:k}),e.createElement("ul",{className:`eko-nav eko-mobile-nav-selected-${null!==(I=null==r||null===(A=r.mobile)||void 0===A||null===(A=A.config)||void 0===A?void 0:A.navItemsSelectedType)&&void 0!==I?I:"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(Ct,{key:o+n,index:n,activeIndex:i,setActiveIndex:E,item:t,src:o,navItemRefs:u,itemIcon:null==t?void 0:t.icon})}))));var I,A,N,M};Rt.propTypes={items:Tt.array.isRequired,activeIndex:Tt.number,setActiveIndex:Tt.func.isRequired,layout:Tt.object,carouselMounted:Tt.bool,forceMobile:Tt.bool};function Dt(){S.track("gallery.cover.displayed"),Ft.send("gallerycoverdisplayed")}function Lt(t){if(!t)return t;try{const e=new URL(t);return e.host.includes("assets.eko.com")&&e.pathname.startsWith("/image")&&!e.searchParams.has("width")?(e.pathname.endsWith(".png")&&(e.pathname=e.pathname.replace(/\.png$/,".webp")),e.searchParams.set("width",1920),e.toString()):t}catch(e){return t}}const Bt=({item:t,src:n,srcset:i,sizes:r,isCoverElement:o})=>{const s=e.useRef(null);return e.useEffect((()=>{var t;if(o){if(null===(t=s.current)||void 0===t||!t.complete)return s.current.addEventListener("load",Dt,{once:!0}),()=>{var t;null===(t=s.current)||void 0===t||t.removeEventListener("load",Dt,{once:!0})};Dt()}}),[]),e.createElement("img",{ref:s,src:Lt(n),srcSet:i,sizes:r,alt:t.name,fetchPriority:o?"high":"auto",loading:o?"eager":"lazy",style:{width:"100%",height:"100%"}})};Bt.propTypes={item:Tt.object.isRequired,src:Tt.string,srcset:Tt.string,sizes:Tt.string,isCoverElement:Tt.bool};const zt=Pt((t=>{var e;e=t,S.track("gallery.interaction",{elementid:"carousel",interactiontype:e}),Ft.send("interaction",{elementid:"carousel",interactiontype:e})}),200);function Wt(){zt("wheel")}const $t=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(t){const e=t.scrollLeft,n=t.scrollWidth-t.clientWidth;return 0===e?0:e>n?100:e/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 t=s.current;if(t)return t.addEventListener("scroll",p),()=>{t.removeEventListener("scroll",p)}}),[t]),e.useEffect((()=>{var t;let e=null===(t=a.current)||void 0===t?void 0:t[i.index];if(e&&("nav"===i.source||"external-nav"===i.source)){const t=e.current,n=s.current.clientWidth/2,i=(null==t?void 0:t.clientWidth)/2,r=(null==t?void 0:t.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:Wt,onTouchMove:function(t){d(t.targetTouches[0].clientX)},onTouchStart:function(t){c(t.targetTouches[0].clientX),d(null)},onTouchEnd:function(){u&&l&&(l-u>75||l-u<-75)&&zt("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(Bt,{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 jt(t){var e;return function(t){var e;return"eko.block.event"===(null==t||null===(e=t.data)||void 0===e?void 0:e.type)}(t)&&"GalleryBlock"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.blockType)}$t.propTypes={items:Tt.array.isRequired,setActiveIndex:Tt.func.isRequired,activeIndex:Tt.object,showSmartLoaders:Tt.bool},$t.displayName="CarouselLoop";const Ut="eko.project.invoke",qt="eko.block.invoke";function Vt(t,e,n){var i;null!=t&&t.contentWindow&&(null==t||null===(i=t.contentWindow)||void 0===i||i.postMessage({target:"eko.embedapi",type:e,data:n},"*"))}function Gt(t){return`#variantId=${encodeURIComponent(t)}`}const Ht=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(t={}){let e="";return Object.entries(t).forEach((([t,n])=>{e+=`&${t}=${n}`})),e}(null==t?void 0:t.qp),g=function(t,e,n){return`https://${t}play.eko.com/embed?${n?`id=${n}`:`piid=${e}`}&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(Gt(o||"ekonovar")),[_,T]=e.useState(g+v+w);let E;function I(){S.track("gallery.project.display"),l(),Ft.send("galleryloaded")}return e.useImperativeHandle(u,(()=>({prev:()=>{Vt(null==b?void 0:b.current,qt,{action:"onPrevModule"})},next:()=>{Vt(null==b?void 0:b.current,qt,{action:"onNextModule"})}}))),e.useEffect((()=>{k.current?Vt(null==b?void 0:b.current,Ut,{action:"updateVariant",args:{id:o}}):x(Gt(o))}),[o]),e.useEffect((()=>{Vt(null==b?void 0:b.current,qt,{action:"updateActiveModule",args:{activeItemIndex:null==r?void 0:r.index,activeModuleIndex:null==r?void 0:r.step}})}),[r]),e.useEffect((()=>{function t(t){if((function(t){var e;return"eko.project.blockstart"===(null==t||null===(e=t.data)||void 0===e?void 0:e.type)}(t)||function(t){var e,n;return"eko.project.started"===(null==t||null===(e=t.data)||void 0===e?void 0:e.type)&&(null==t||null===(n=t.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.started)}(t))&&!k.current)return e=t.data.data.blockType,k.current=!0,void("GalleryBlock"===e?Vt(null==b?void 0:b.current,qt,{action:"updateActiveModule",args:{activeItemIndex:null==r?void 0:r.index,activeModuleIndex:null==r?void 0:r.step}}):I());var e;if(k.current){if(function(t){var e;return jt(t)&&"activeModuleChanged"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.name)}(t))return void function(t){const e=t.data.data.data.activeItemIndex,n=t.data.data.data.activeModuleIndex;e===(null==r?void 0:r.index)&&n===(null==r?void 0:r.step)||i({index:e,step:n,source:"carousel"})}(t);(function(t){var e;return jt(t)&&"activeModuleChangeDone"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.name)})(t)&&!s&&I()}}return E=c||a()?"mobile":"desktop",function(t,e={}){window.addEventListener("message",t,e)}(t),()=>{!function(t,e={}){window.removeEventListener("message",t,e)}(t)}}),[r]),e.useEffect((()=>{k.current||Vt(null==b?void 0:b.current,Ut,{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":E},e.createElement("iframe",{allow:"autoplay; fullscreen",title:"eko gallery",src:_,style:{border:0},ref:b}))}));Ht.propTypes={config:Tt.object.isRequired,instanceId:Tt.string,setActiveItem:Tt.func.isRequired,activeItem:Tt.object.isRequired,variantId:Tt.string,smartGalleryLoaded:Tt.bool,onLoad:Tt.func,forceMobile:Tt.bool},Ht.displayName="SmartGallery";const Kt=()=>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}'),Xt=({layout:t,style:n})=>{let i={};return function(t={}){Object.keys(t).forEach((e=>{i[`--${e}Eko`]=t[e]}))}(n),function(t){var e,n;const r=(null==t||null===(e=t.desktop)||void 0===e?void 0:e.config)||{},o=(null==t||null===(n=t.mobile)||void 0===n?void 0:n.config)||{};Object.keys(r).forEach((t=>{"string"==typeof r[t]&&(i[`--${t}EkoDesktop`]=r[t])})),Object.keys(o).forEach((t=>{"string"==typeof o[t]&&(i[`--${t}EkoMobile`]=o[t])}))}(t),e.createElement("style",{key:{layout:t,style:n}},`.eko-gallery {${Object.keys(i).map((t=>`${t}: ${i[t]};`)).join("\n")}}`)};Xt.propTypes={layout:Tt.object,style:Tt.object},u("experiment");const Yt=({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 t=d.current;if(t){const e={};return null!=t&&t.id&&(e.id=t.id),null!=t&&t.productId&&(e.productid=t.productId),t.salesChannelId&&(e.saleschannelid=t.salesChannelId),null!=t&&t.salesChannelName&&(e.saleschannelname=t.salesChannelName),t.salesChannelType&&(e.saleschanneltype=t.salesChannelType),e.id?e:void 0}}},galleryInteractionPacker:{tag:s,schema:"iglu:com.helloeko/gallery_interaction/jsonschema/1-0-0",match:"gallery.interaction",getData:function({elementid:t,interactiontype:e}){return{elementid:String(t),interactiontype:e}}},galleryPacker:{tag:s,schema:"iglu:com.helloeko/gallery/jsonschema/1-0-2",match:/^gallery.*/,getData:function(){var t;return{activeitemid:l.current.toString(),activevariantid:a.current,hasinteractive:c.current,version:(null===(t=window.eko)||void 0===t||null===(t=t.gallery)||void 0===t?void 0:t.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 t;let e=function(t){let e=null;if(t){const n=Math.floor(Date.now()/1e3);for(const i of t){if("deliverable"!==i.type)return;const t=Math.floor(new Date(i.startDate).getTime()/1e3),r=Math.floor(new Date(i.endDate).getTime()/1e3);!0===i.active&&n>t&&n<r&&(e=i)}}return e}(u.current);if(!e)return;let n={experimentid:e.id||"",experimentvariant:e.chosen||"pending decision",experimenttype:e.type||""},i=null===(t=e.targetDevice)||void 0===t?void 0:t.toLowerCase();return"mobile"!==i&&"notmobile"!==i||(n.experimenttargeting={device:i}),n}}};return e.useEffect((()=>(Object.values(h).forEach((t=>{window.EkoAnalytics("registerContextPacker",t)})),()=>{window.EkoAnalytics("reset",s)})),[]),null};Yt.propTypes={activeVariantId:Tt.string,activeElementId:Tt.number,hasInteractive:Tt.bool,experiments:Tt.array,publishItem:Tt.object};const Qt=({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(Yt,{activeVariantId:t||"ekonovar",activeElementId:r,hasInteractive:i,experiments:o,publishItem:s})};Qt.propTypes={variantId:Tt.string,activeItem:Tt.object,hasInteractive:Tt.bool,activeIndex:Tt.number,experiments:Tt.array,publishItem:Tt.object};const Jt="eko-gallery-react";function Zt(t,e){var n,i,r;const o=(null==t||null===(n=t.variantMap)||void 0===n?void 0:n[e])||"ekonovar";return(null==t||null===(i=t.items)||void 0===i?void 0:i.find((t=>(null==t?void 0:t.variantId)===o)))||(null==t||null===(r=t.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 te=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(Zt(n,r)),[b,k]=e.useState({index:o.index,step:o.step,source:"external-nav"}),[w,x]=e.useState(!1),[_,T]=e.useState(!1),[E,I]=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 t=a||window.innerWidth<768?"eko-mobile":"eko-desktop";I(t)}return N.current||(Ft.send("galleryinit"),N.current=!0),e.useEffect((()=>{const t=C.current!==r;C.current=r,y(Zt(n,r)),t&&!A.current&&k({index:0,step:0,source:"external-nav"})}),[n,r]),e.useEffect((()=>{if(s)return Ft.subscribe(s),()=>{Ft.unsubscribe()}}),[s]),e.useEffect((()=>{A.current=_}),[_]),e.useEffect((()=>{x(!1),T(!1);const t=setTimeout((()=>{A.current||(x(!0),S.track("gallery.load.timeout"))}),1e3*m);return()=>{clearTimeout(t)}}),[n]),e.useEffect((()=>{O()}),[a]),e.useEffect((()=>(window.addEventListener("resize",O),O(),()=>{window.removeEventListener("resize",O)})),[a]),e.useEffect((()=>(window.EkoAnalytics("trackElementVisibility",F.current,Jt),()=>{window.EkoAnalytics("stopTrackingElementVisibility",Jt)})),[]),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||Ft.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(Kt,null),e.createElement(Xt,{layout:n.layout,style:n.style,forceMobile:a}),e.createElement(Qt,{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(t){let e="";return["mobile","desktop"].forEach((n=>{var i,r;const o=null!==(i=null==t||null===(r=t[n])||void 0===r?void 0:r.type)&&void 0!==i?i:"nav";if(e+=`eko-${n}-${o}-layout `,"nav"===o){var s;const i="desktop"===n,r=(null==t||null===(s=t[n])||void 0===s||null===(s=s.config)||void 0===s?void 0:s.orientation)||(i?"left":"bottom");e+=`eko-${n}-nav-${r} `}})),e}(n.layout)} ${null!=t?t:""}`.trim()} ${E}`,"aria-controls":"main-content",ref:F},e.createElement(Rt,{items:(null==g?void 0:g.items)||[],setActiveIndex:k,activeIndex:b.index,layout:n.layout,carouselMounted:_,forceMobile:a}),!_&&e.createElement($t,{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(Ht,{ref:l,config:n,instanceId:i,activeItem:b,setActiveItem:k,variantId:null==g?void 0:g.variantId,smartGalleryLoaded:_,forceMobile:a,onLoad:function(){T(!0)}})))}));te.propTypes={className:Tt.string,config:Tt.object.isRequired,instanceId:Tt.string,variantId:Tt.string,activeItem:Tt.object,onEvent:Tt.func,forceMobile:Tt.bool,onPrev:Tt.func,onNext:Tt.func},te.displayName="EkoGallery";var ee=e.memo(te);const ne=u("gallery-react");const ie=e.forwardRef(((t,n)=>{var i;e.useEffect((()=>(ne.setDataStorage("gallery-react",{config:t.config}),window.eko=window.eko||{},window.eko.config=t.config,window.eko.gallery={version:"copy-instance/4.0.13"},()=>{window.eko.config=void 0})),[t.config]);const{children:r,...o}=t;return void 0!==t.config?e.createElement(ee,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}));ie.propTypes={className:Tt.string,config:Tt.object,variantId:Tt.string,onEvent:Tt.func,instanceId:Tt.string,children:Tt.node},ie.displayName="EkoGalleryWrapper";var re,oe,se,ae,le,ce,ue,de,he,fe,pe,me,ve,ge,ye,be,ke,we,xe,_e,Te,Ee,Ie,Se,Ae,Ne,Me,Fe,Ce,Oe,Pe,Re,De,Le,Be,ze,We,$e,je,Ue,qe,Ve,Ge,He,Ke,Xe,Ye,Qe,Je,Ze,tn,en=e.memo(ie);const nn=1,rn=2,on=4,sn=8,an=16,ln=1,cn=4,un=8,dn=16,hn="[",fn="[!",pn="]",mn={},vn=Symbol(),gn=Symbol("filename"),yn="http://www.w3.org/1999/xhtml",bn="@attach",kn=!0;var wn=Array.isArray,xn=Array.prototype.indexOf,_n=Array.from,Tn=Object.defineProperty,En=Object.getOwnPropertyDescriptor,In=Object.getOwnPropertyDescriptors,Sn=Object.prototype,An=Array.prototype,Nn=Object.getPrototypeOf,Mn=Object.isExtensible;function Fn(){var t,e;return{promise:new Promise(((n,i)=>{t=n,e=i})),resolve:t,reject:e}}const Cn=2,On=4,Pn=8,Rn=1<<24,Dn=16,Ln=32,Bn=64,zn=128,Wn=512,$n=1024,jn=2048,Un=4096,qn=8192,Vn=16384,Gn=32768,Hn=65536,Kn=1<<17,Xn=1<<18,Yn=1<<19,Qn=1<<20,Jn=1<<25,Zn=32768,ti=1<<21,ei=1<<22,ni=1<<23,ii=Symbol("$state"),ri=Symbol("legacy props"),oi=Symbol(""),si=Symbol("proxy path"),ai=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},li=3,ci=8;function ui(t){{const e=new Error(`lifecycle_outside_component\n\`${t}(...)\` can only be used during component initialisation\nhttps://svelte.dev/e/lifecycle_outside_component`);throw e.name="Svelte error",e}}var di="font-weight: bold",hi="font-weight: normal";function fi(t){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",di,hi)}function pi(t){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 \`${t}\` will produce unexpected results\nhttps://svelte.dev/e/state_proxy_equality_mismatch`,di,hi)}let mi,vi=!1;function gi(t){vi=t}function yi(t){if(null===t)throw fi(),mn;return mi=t}function bi(){return yi(Po(mi))}function ki(t){if(vi){if(null!==Po(mi))throw fi(),mn;mi=t}}function wi(t=!0){for(var e=0,n=mi;;){if(n.nodeType===ci){var i=n.data;if(i===pn){if(0===e)return n;e-=1}else i!==hn&&i!==fn||(e+=1)}var r=Po(n);t&&n.remove(),n=r}}function xi(t){if(!t||t.nodeType!==ci)throw fi(),mn;return t.data}function _i(t){return t===this.v}function Ti(t){return e=t,n=this.v,!(e!=e?n==n:e!==n||null!==e&&"object"==typeof e||"function"==typeof e);var e,n}let Ei=!1;function Ii(t,e){return t.label=e,Si(t.v,e),t}function Si(t,e){var n;return null==t||null===(n=t[si])||void 0===n||n.call(t,e),t}function Ai(t){const e=new Error,n=function(){const t=Error.stackTraceLimit;Error.stackTraceLimit=1/0;const e=(new Error).stack;if(Error.stackTraceLimit=t,!e)return[];const n=e.split("\n"),i=[];for(let t=0;t<n.length;t++){const e=n[t],r=e.replaceAll("\\","/");if("Error"!==e.trim()){if(e.includes("validate_each_keys"))return[];r.includes("svelte/src/internal")||r.includes("node_modules/.vite")||i.push(e)}}return i}();return 0===n.length?null:(n.unshift("\n"),Tn(e,"stack",{value:n.join("\n")}),Tn(e,"name",{value:t}),e)}let Ni=null;function Mi(t){Ni=t}let Fi=null;function Ci(t){Fi=t}let Oi=null;function Pi(t){Oi=t}function Ri(t){return Bi("getContext").get(t)}function Di(t,e=!1,n){Ni={p:Ni,i:!1,c:null,e:null,s:t,x:null,l:null},Ni.function=n,Oi=n}function Li(t){var e,n,i=Ni,r=i.e;if(null!==r)for(var o of(i.e=null,r))Ho(o);return i.i=!0,Ni=i.p,Oi=null!==(e=null===(n=Ni)||void 0===n?void 0:n.function)&&void 0!==e?e:null,{}}function Bi(t){var e,n;return null===Ni&&ui(t),null!==(n=(e=Ni).c)&&void 0!==n?n:e.c=new Map(function(t){let e=t.p;for(;null!==e;){const t=e.c;if(null!==t)return t;e=e.p}return null}(Ni)||void 0)}let zi=[];function Wi(){var t=zi;zi=[],function(t){for(var e=0;e<t.length;e++)t[e]()}(t)}function $i(t){if(0===zi.length&&!rr){var e=zi;queueMicrotask((()=>{e===zi&&Wi()}))}zi.push(t)}function ji(){for(;zi.length>0;)Wi()}const Ui=new WeakMap;function qi(t){var e=vs;if(null===e)return fs.f|=ni,t;if(t instanceof Error&&!Ui.has(t)&&Ui.set(t,function(t,e){var n,i;const r=En(t,"message");if(r&&!r.configurable)return;var o=Ao?" ":"\t",s=`\n${o}in ${(null===(n=e.fn)||void 0===n?void 0:n.name)||"<unknown>"}`,a=e.ctx;for(;null!==a;){var l;s+=`\n${o}in ${null===(l=a.function)||void 0===l?void 0:l[gn].split("/").pop()}`,a=a.p}return{message:t.message+`\n${s}\n`,stack:null===(i=t.stack)||void 0===i?void 0:i.split("\n").filter((t=>!t.includes("svelte/src/internal"))).join("\n")}}(t,e)),e.f&Gn)Vi(t,e);else{if(!(e.f&zn))throw!e.parent&&t instanceof Error&&Gi(t),t;e.b.error(t)}}function Vi(t,e){for(;null!==e;){if(e.f&zn)try{return void e.b.error(t)}catch(e){t=e}e=e.parent}throw t instanceof Error&&Gi(t),t}function Gi(t){const e=Ui.get(t);e&&(Tn(t,"message",{value:e.message}),Tn(t,"stack",{value:e.stack}))}const Hi=-7169;function Ki(t,e){t.f=t.f&Hi|e}function Xi(t){t.f&Wn||null===t.deps?Ki(t,$n):Ki(t,Un)}function Yi(t){if(null!==t)for(const e of t)e.f&Cn&&e.f&Zn&&(e.f^=Zn,Yi(e.deps))}function Qi(t,e,n){t.f&jn?e.add(t):t.f&Un&&n.add(t),Yi(t.deps),Ki(t,$n)}const Ji=new Set;let Zi=null,tr=null,er=[],nr=null,ir=!1,rr=!1;var or=new WeakMap,sr=new WeakMap,ar=new WeakMap,lr=new WeakMap,cr=new WeakMap,ur=new WeakMap,dr=new WeakMap,hr=new WeakSet;class fr{constructor(){O(this,hr),P(this,"committed",!1),P(this,"current",new Map),P(this,"previous",new Map),F(this,or,new Set),F(this,sr,new Set),F(this,ar,0),F(this,lr,0),F(this,cr,null),F(this,ur,new Set),F(this,dr,new Set),P(this,"skipped_effects",new Set),P(this,"is_fork",!1)}is_deferred(){return this.is_fork||M(lr,this)>0}process(t){er=[],this.apply();var e,n=[],i=[];for(const e of t)A(hr,this,pr).call(this,e,n,i);(this.is_fork||A(hr,this,vr).call(this),this.is_deferred())?(A(hr,this,mr).call(this,i),A(hr,this,mr).call(this,n)):(Zi=null,wr(i),wr(n),null===(e=M(cr,this))||void 0===e||e.resolve());tr=null}capture(t,e){var n;(e===vn||this.previous.has(t)||this.previous.set(t,e),t.f&ni)||(this.current.set(t,t.v),null===(n=tr)||void 0===n||n.set(t,t.v))}activate(){Zi=this,this.apply()}deactivate(){Zi===this&&(Zi=null,tr=null)}flush(){if(this.activate(),er.length>0){if(yr(),null!==Zi&&Zi!==this)return}else 0===M(ar,this)&&this.process([]);this.deactivate()}discard(){for(const t of M(sr,this))t(this);M(sr,this).clear()}increment(t){C(ar,this,M(ar,this)+1),t&&C(lr,this,M(lr,this)+1)}decrement(t){C(ar,this,M(ar,this)-1),t&&C(lr,this,M(lr,this)-1),this.revive()}revive(){for(const t of M(ur,this))M(dr,this).delete(t),Ki(t,jn),Tr(t);for(const t of M(dr,this))Ki(t,Un),Tr(t);this.flush()}oncommit(t){M(or,this).add(t)}ondiscard(t){M(sr,this).add(t)}settled(){var t;return(null!==(t=M(cr,this))&&void 0!==t?t:C(cr,this,Fn())).promise}static ensure(){if(null===Zi){const t=Zi=new fr;Ji.add(Zi),rr||fr.enqueue((()=>{Zi===t&&t.flush()}))}return Zi}static enqueue(t){$i(t)}apply(){}}function pr(t,e,n){t.f^=$n;for(var i=t.first,r=null;null!==i;){var o=i.f,s=!!(o&(Ln|Bn));if(!(s&&!!(o&$n)||!!(o&qn)||this.skipped_effects.has(i))&&null!==i.fn){s?i.f^=$n:null!==r&&o&(On|Pn|Rn)?r.b.defer_effect(i):o&On?e.push(i):As(i)&&(o&Dn&&M(ur,this).add(i),Os(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 mr(t){for(var e=0;e<t.length;e+=1)Qi(t[e],M(ur,this),M(dr,this))}function vr(){if(0===M(lr,this)){for(const t of M(or,this))t();M(or,this).clear()}0===M(ar,this)&&A(hr,this,gr).call(this)}function gr(){if(Ji.size>1){this.previous.clear();var t=tr,e=!0;for(const t of Ji){if(t===this){e=!1;continue}const i=[];for(const[n,r]of this.current){if(t.current.has(n)){if(!e||r===t.current.get(n))continue;t.current.set(n,r)}i.push(n)}if(0===i.length)continue;const r=[...t.current.keys()].filter((t=>!this.current.has(t)));if(r.length>0){var n=er;er=[];const e=new Set,o=new Map;for(const t of i)xr(t,r,e,o);if(er.length>0){Zi=t,t.apply();for(const e of er)A(hr,t,pr).call(t,e,[],[]);t.deactivate()}er=n}}Zi=null,tr=t}this.committed=!0,Ji.delete(this)}function yr(){var t=cs;ir=!0;var e=new Set;try{var n=0;for(us(!0);er.length>0;){var i=fr.ensure();if(n++>1e3){if(kn){var r=new Map;for(const t of i.current.keys())for(const[e,n]of null!==(o=t.updated)&&void 0!==o?o:[]){var o,s=r.get(e);s||(s={error:n.error,count:0},r.set(e,s)),s.count+=n.count}for(const t of r.values())t.error&&console.error(t.error)}br()}if(i.process(er),co.clear(),kn)for(const t of i.current.keys())e.add(t)}}finally{ir=!1,us(t),nr=null;for(const t of e)t.updated=null}}function br(){try{!function(){{const t=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 t.name="Svelte error",t}}()}catch(t){Tn(t,"stack",{value:""}),Vi(t,nr)}}let kr=null;function wr(t){var e=t.length;if(0!==e){for(var n=0;n<e;){var i,r=t[n++];if(!(r.f&(Vn|qn))&&As(r))if(kr=new Set,Os(r),null===r.deps&&null===r.first&&null===r.nodes&&(null===r.teardown&&null===r.ac?is(r):r.fn=null),(null===(i=kr)||void 0===i?void 0:i.size)>0){co.clear();for(const t of kr){if(t.f&(Vn|qn))continue;const e=[t];let n=t.parent;for(;null!==n;)kr.has(n)&&(kr.delete(n),e.push(n)),n=n.parent;for(let t=e.length-1;t>=0;t--){const n=e[t];n.f&(Vn|qn)||Os(n)}}kr.clear()}}kr=null}}function xr(t,e,n,i){if(!n.has(t)&&(n.add(t),null!==t.reactions))for(const r of t.reactions){const t=r.f;t&Cn?xr(r,e,n,i):t&(ei|Dn)&&!(t&jn)&&_r(r,e,i)&&(Ki(r,jn),Tr(r))}}function _r(t,e,n){const i=n.get(t);if(void 0!==i)return i;if(null!==t.deps)for(const i of t.deps){if(e.includes(i))return!0;if(i.f&Cn&&_r(i,e,n))return n.set(i,!0),!0}return n.set(t,!1),!1}function Tr(t){for(var e=nr=t;null!==e.parent;){var n=(e=e.parent).f;if(ir&&e===vs&&n&Dn&&!(n&Xn))return;if(n&(Bn|Ln)){if(!(n&$n))return;e.f^=$n}}er.push(e)}var Er=Hn|Yn|zn;var Ir=new WeakMap,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 WeakSet;class qr{constructor(t,e,n){O(this,Ur),P(this,"parent",void 0),P(this,"is_pending",!1),F(this,Ir,void 0),F(this,Sr,vi?mi:null),F(this,Ar,void 0),F(this,Nr,void 0),F(this,Mr,void 0),F(this,Fr,null),F(this,Cr,null),F(this,Or,null),F(this,Pr,null),F(this,Rr,null),F(this,Dr,0),F(this,Lr,0),F(this,Br,!1),F(this,zr,new Set),F(this,Wr,new Set),F(this,$r,null),F(this,jr,function(t){let e,n=0,i=fo(0);return Ii(i,"createSubscriber version"),()=>{qo()&&(Rs(i),Xo((()=>(0===n&&(e=Bs((()=>t((()=>bo(i)))))),n+=1,()=>{$i((()=>{var t;n-=1,0===n&&(null===(t=e)||void 0===t||t(),e=void 0,bo(i))}))}))))}}((()=>(C($r,this,fo(M(Dr,this))),Ii(M($r,this),"$effect.pending()"),()=>{C($r,this,null)})))),C(Ir,this,t),C(Ar,this,e),C(Nr,this,n),this.parent=vs.b,this.is_pending=!!M(Ar,this).pending,C(Mr,this,Qo((()=>{if(vs.b=this,vi){const t=M(Sr,this);bi();t.nodeType===ci&&t.data===fn?A(Ur,this,Gr).call(this):(A(Ur,this,Vr).call(this),0===M(Lr,this)&&(this.is_pending=!1))}else{var t=A(Ur,this,Hr).call(this);try{C(Fr,this,Zo((()=>n(t))))}catch(t){this.error(t)}M(Lr,this)>0?A(Ur,this,Xr).call(this):this.is_pending=!1}return()=>{var t;null===(t=M(Rr,this))||void 0===t||t.remove()}}),Er)),vi&&C(Ir,this,mi)}defer_effect(t){Qi(t,M(zr,this),M(Wr,this))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!M(Ar,this).pending}update_pending_count(t){A(Ur,this,Yr).call(this,t),C(Dr,this,M(Dr,this)+t),M($r,this)&&go(M($r,this),M(Dr,this))}get_effect_pending(){return M(jr,this).call(this),Rs(M($r,this))}error(t){var e=M(Ar,this).onerror;let n=M(Ar,this).failed;if(M(Br,this)||!e&&!n)throw t;M(Fr,this)&&(ns(M(Fr,this)),C(Fr,this,null)),M(Cr,this)&&(ns(M(Cr,this)),C(Cr,this,null)),M(Or,this)&&(ns(M(Or,this)),C(Or,this,null)),vi&&(yi(M(Sr,this)),function(t=1){if(vi){for(var e=t,n=mi;e--;)n=Po(n);mi=n}}(),yi(wi()));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",di,hi):(i=!0,r&&function(){{const t=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 t.name="Svelte error",t}}(),fr.ensure(),C(Dr,this,0),null!==M(Or,this)&&rs(M(Or,this),(()=>{C(Or,this,null)})),this.is_pending=this.has_pending_snippet(),C(Fr,this,A(Ur,this,Kr).call(this,(()=>(C(Br,this,!1),Zo((()=>M(Nr,this).call(this,M(Ir,this)))))))),M(Lr,this)>0?A(Ur,this,Xr).call(this):this.is_pending=!1)};var s=fs;try{ms(null),r=!0,null==e||e(t,o),r=!1}catch(t){Vi(t,M(Mr,this)&&M(Mr,this).parent)}finally{ms(s)}n&&$i((()=>{C(Or,this,A(Ur,this,Kr).call(this,(()=>{fr.ensure(),C(Br,this,!0);try{return Zo((()=>{n(M(Ir,this),(()=>t),(()=>o))}))}catch(t){return Vi(t,M(Mr,this).parent),null}finally{C(Br,this,!1)}})))}))}}function Vr(){try{C(Fr,this,Zo((()=>M(Nr,this).call(this,M(Ir,this)))))}catch(t){this.error(t)}}function Gr(){const t=M(Ar,this).pending;t&&(C(Cr,this,Zo((()=>t(M(Ir,this))))),fr.enqueue((()=>{var t=A(Ur,this,Hr).call(this);C(Fr,this,A(Ur,this,Kr).call(this,(()=>(fr.ensure(),Zo((()=>M(Nr,this).call(this,t))))))),M(Lr,this)>0?A(Ur,this,Xr).call(this):(rs(M(Cr,this),(()=>{C(Cr,this,null)})),this.is_pending=!1)})))}function Hr(){var t=M(Ir,this);return this.is_pending&&(C(Rr,this,Co()),M(Ir,this).before(M(Rr,this)),t=M(Rr,this)),t}function Kr(t){var e=vs,n=fs,i=Ni;gs(M(Mr,this)),ms(M(Mr,this)),Mi(M(Mr,this).ctx);try{return t()}catch(t){return qi(t),null}finally{gs(e),ms(n),Mi(i)}}function Xr(){const t=M(Ar,this).pending;null!==M(Fr,this)&&(C(Pr,this,document.createDocumentFragment()),M(Pr,this).append(M(Rr,this)),ls(M(Fr,this),M(Pr,this))),null===M(Cr,this)&&C(Cr,this,Zo((()=>t(M(Ir,this)))))}function Yr(t){var e;if(this.has_pending_snippet()){if(C(Lr,this,M(Lr,this)+t),0===M(Lr,this)){this.is_pending=!1;for(const t of M(zr,this))Ki(t,jn),Tr(t);for(const t of M(Wr,this))Ki(t,Un),Tr(t);M(zr,this).clear(),M(Wr,this).clear(),M(Cr,this)&&rs(M(Cr,this),(()=>{C(Cr,this,null)})),M(Pr,this)&&(M(Ir,this).before(M(Pr,this)),C(Pr,this,null))}}else this.parent&&A(Ur,e=this.parent,Yr).call(e,t)}function Qr(t,e,n,i){const r=to;if(0!==n.length||0!==t.length){var o,s,a,l,c,u=Zi,d=vs,h=(o=vs,s=fs,a=Ni,l=Zi,c=Fi,function(t=!0){gs(o),ms(s),Mi(a),t&&(null==l||l.activate()),Ci(c)});t.length>0?Promise.all(t).then((()=>{h();try{return f()}finally{null==u||u.deactivate(),Jr()}})):f()}else i(e.map(r));function f(){Promise.all(n.map((t=>eo(t)))).then((t=>{h();try{i([...e.map(r),...t])}catch(t){d.f&Vn||Vi(t,d)}null==u||u.deactivate(),Jr()})).catch((t=>{Vi(t,d)}))}}function Jr(){gs(null),ms(null),Mi(null),Ci(null)}const Zr=new Set;function to(t){var e=Cn|jn,n=null!==fs&&fs.f&Cn?fs:null;null!==vs&&(vs.f|=Yn);return{ctx:Ni,deps:null,effects:null,equals:_i,f:e,fn:t,reactions:null,rv:0,v:vn,wv:0,parent:null!=n?n:vs,ac:null}}function eo(t,e,n){let i=vs;null===i&&function(){{const t=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 t.name="Svelte error",t}}();var r=i.b,o=void 0,s=fo(vn);s.label=e;var a=!fs,l=new Map;return function(t){Uo(ei|Yn,t,!0)}((()=>{var e=Fn();o=e.promise;try{Promise.resolve(t()).then(e.resolve,e.reject).then((()=>{n===Zi&&n.committed&&n.deactivate(),Jr()}))}catch(t){e.reject(t),Jr()}var n=Zi;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(ai),l.delete(n),l.set(n,e)}const u=(t,e=void 0)=>{if(n.activate(),e)e!==ai&&(s.f|=ni,go(s,e));else{s.f&ni&&(s.f^=ni),go(s,t);for(const[t,e]of l){if(l.delete(t),t===n)break;e.reject(ai)}}a&&(r.update_pending_count(-1),n.decrement(c))};e.promise.then(u,(t=>u(null,t||"unknown")))})),Vo((()=>{for(const t of l.values())t.reject(ai)})),s.f|=ei,new Promise((t=>{!function e(n){function i(){n===o?t(s):e(o)}n.then(i,i)}(o)}))}function no(t){const e=to(t);return bs(e),e}function io(t){const e=to(t);return e.equals=Ti,e}function ro(t){var e=t.effects;if(null!==e){t.effects=null;for(var n=0;n<e.length;n+=1)ns(e[n])}}let oo=[];function so(t){var e,n=vs;gs(function(t){for(var e=t.parent;null!==e;){if(!(e.f&Cn))return e.f&Vn?null:e;e=e.parent}return null}(t));{let i=lo;uo(new Set);try{oo.includes(t)&&function(){{const t=new Error("derived_references_self\nA derived value cannot reference itself recursively\nhttps://svelte.dev/e/derived_references_self");throw t.name="Svelte error",t}}(),oo.push(t),t.f&=~Zn,ro(t),e=Ms(t)}finally{gs(n),uo(i),oo.pop()}}return e}function ao(t){var e,n,i=so(t);if(!t.equals(i)&&(t.wv=Ss(),(null===(e=Zi)||void 0===e||!e.is_fork||null===t.deps)&&(t.v=i,null===t.deps)))return void Ki(t,$n);ds||(null!==tr?(qo()||null!==(n=Zi)&&void 0!==n&&n.is_fork)&&tr.set(t,i):Xi(t))}let lo=new Set;const co=new Map;function uo(t){lo=t}let ho=!1;function fo(t,e){return{f:0,v:t,reactions:null,equals:_i,rv:0,wv:0}}function po(t,e){const n=fo(t);return bs(n),n}function mo(t,e=!1,n=!0){const i=fo(t);return e||(i.equals=Ti),i}function vo(t,e,n=!1){var i;null!==fs&&(!ps||fs.f&Kn)&&fs.f&(Cn|Dn|ei|Kn)&&(null===(i=ys)||void 0===i||!i.includes(t))&&function(){{const t=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 t.name="Svelte error",t}}();let r=n?xo(e):e;return Si(r,t.label),go(t,r)}function go(t,e){if(!t.equals(e)){var n=t.v;ds?co.set(t,e):co.set(t,n),t.v=e;var i=fr.ensure();if(i.capture(t,n),null!==vs){var r,o,s;null!==(r=t.updated)&&void 0!==r||(t.updated=new Map);const e=(null!==(o=null===(s=t.updated.get(""))||void 0===s?void 0:s.count)&&void 0!==o?o:0)+1;if(t.updated.set("",{error:null,count:e}),e>5){const e=Ai("updated at");if(null!==e){let n=t.updated.get(e.stack);n||(n={error:e,count:0},t.updated.set(e.stack,n)),n.count++}}}if(null!==vs&&(t.set_during_effect=!0),t.f&Cn){const e=t;t.f&jn&&so(e),Xi(e)}t.wv=Ss(),ko(t,jn),null!==vs&&vs.f&$n&&!(vs.f&(Ln|Bn))&&(null===xs?function(t){xs=t}([t]):xs.push(t)),!i.is_fork&&lo.size>0&&!ho&&yo()}return e}function yo(){ho=!1;var t=cs;us(!0);const e=Array.from(lo);try{for(const t of e)t.f&$n&&Ki(t,Un),As(t)&&Os(t)}finally{us(t)}lo.clear()}function bo(t){vo(t,t.v+1)}function ko(t,e){var n=t.reactions;if(null!==n)for(var i=n.length,r=0;r<i;r++){var o=n[r],s=o.f;if(s&Kn)lo.add(o);else{var a=!(s&jn);if(a&&Ki(o,e),s&Cn){var l,c=o;null===(l=tr)||void 0===l||l.delete(c),s&Zn||(s&Wn&&(o.f|=Zn),ko(c,Un))}else a&&(s&Dn&&null!==kr&&kr.add(o),Tr(o))}}}const wo=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function xo(t){if("object"!=typeof t||null===t||ii in t)return t;const e=Nn(t);if(e!==Sn&&e!==An)return t;var n=new Map,i=wn(t),r=po(0),o=Es,s=t=>{if(Es===o)return t();var e=fs,n=Es;ms(null),Is(o);var i=t();return ms(e),Is(n),i};i&&(n.set("length",po(t.length)),t=new Proxy(t,{get(t,e,n){var i=Reflect.get(t,e,n);return Eo.has(e)?function(...t){ho=!0;var e=i.apply(this,t);return yo(),e}:i}}));var a="";let l=!1;function c(t){if(!l){l=!0,Ii(r,`${a=t} version`);for(const[t,e]of n)Ii(e,_o(a,t));l=!1}}return new Proxy(t,{defineProperty(t,e,i){"value"in i&&!1!==i.configurable&&!1!==i.enumerable&&!1!==i.writable||function(){{const t=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 t.name="Svelte error",t}}();var r=n.get(e);return void 0===r?r=s((()=>{var t=po(i.value);return n.set(e,t),"string"==typeof e&&Ii(t,_o(a,e)),t})):vo(r,i.value,!0),!0},deleteProperty(t,e){var i=n.get(e);if(void 0===i){if(e in t){const t=s((()=>po(vn)));n.set(e,t),bo(r),Ii(t,_o(a,e))}}else vo(i,vn),bo(r);return!0},get(e,i,r){var o;if(i===ii)return t;if(i===si)return c;var l=n.get(i),u=i in e;if(void 0===l&&(!u||null!==(o=En(e,i))&&void 0!==o&&o.writable)&&(l=s((()=>{var t=po(xo(u?e[i]:vn));return Ii(t,_o(a,i)),t})),n.set(i,l)),void 0!==l){var d=Rs(l);return d===vn?void 0:d}return Reflect.get(e,i,r)},getOwnPropertyDescriptor(t,e){var i=Reflect.getOwnPropertyDescriptor(t,e);if(i&&"value"in i){var r=n.get(e);r&&(i.value=Rs(r))}else if(void 0===i){var o=n.get(e),s=null==o?void 0:o.v;if(void 0!==o&&s!==vn)return{enumerable:!0,configurable:!0,value:s,writable:!0}}return i},has(t,e){var i;if(e===ii)return!0;var r=n.get(e),o=void 0!==r&&r.v!==vn||Reflect.has(t,e);if((void 0!==r||null!==vs&&(!o||null!==(i=En(t,e))&&void 0!==i&&i.writable))&&(void 0===r&&(r=s((()=>{var n=po(o?xo(t[e]):vn);return Ii(n,_o(a,e)),n})),n.set(e,r)),Rs(r)===vn))return!1;return o},set(t,e,o,l){var c,u=n.get(e),d=e in t;if(i&&"length"===e)for(var h=o;h<u.v;h+=1){var f=n.get(h+"");void 0!==f?vo(f,vn):h in t&&(f=s((()=>po(vn))),n.set(h+"",f),Ii(f,_o(a,h)))}void 0===u?(!d||null!==(c=En(t,e))&&void 0!==c&&c.writable)&&(Ii(u=s((()=>po(void 0))),_o(a,e)),vo(u,xo(o)),n.set(e,u)):(d=u.v!==vn,vo(u,s((()=>xo(o)))));var p=Reflect.getOwnPropertyDescriptor(t,e);if(null!=p&&p.set&&p.set.call(l,o),!d){if(i&&"string"==typeof e){var m=n.get("length"),v=Number(e);Number.isInteger(v)&&v>=m.v&&vo(m,v+1)}bo(r)}return!0},ownKeys(t){Rs(r);var e=Reflect.ownKeys(t).filter((t=>{var e=n.get(t);return void 0===e||e.v!==vn}));for(var[i,o]of n)o.v===vn||i in t||e.push(i);return e},setPrototypeOf(){!function(){{const t=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw t.name="Svelte error",t}}()}})}function _o(t,e){var n;return"symbol"==typeof e?`${t}[Symbol(${null!==(n=e.description)&&void 0!==n?n:""})]`:wo.test(e)?`${t}.${e}`:/^\d+$/.test(e)?`${t}[${e}]`:`${t}['${e}']`}function To(t){try{if(null!==t&&"object"==typeof t&&ii in t)return t[ii]}catch{}return t}const Eo=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function Io(t,e,n=!0){try{t===e!=(To(t)===To(e))&&pi(n?"===":"!==")}catch{}return t===e===n}var So,Ao,No,Mo;function Fo(){if(void 0===So){So=window,Ao=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;No=En(e,"firstChild").get,Mo=En(e,"nextSibling").get,Mn(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),Mn(n)&&(n.__t=void 0),t.__svelte_meta=null,function(){const t=Array.prototype,e=Array.__svelte_cleanup;e&&e();const{indexOf:n,lastIndexOf:i,includes:r}=t;t.indexOf=function(t,e){const i=n.call(this,t,e);if(-1===i)for(let n=null!=e?e:0;n<this.length;n+=1)if(To(this[n])===t){pi("array.indexOf(...)");break}return i},t.lastIndexOf=function(t,e){const n=i.call(this,t,null!=e?e:this.length-1);if(-1===n)for(let n=0;n<=(null!=e?e:this.length-1);n+=1)if(To(this[n])===t){pi("array.lastIndexOf(...)");break}return n},t.includes=function(t,e){const n=r.call(this,t,e);if(!n)for(let e=0;e<this.length;e+=1)if(To(this[e])===t){pi("array.includes(...)");break}return n},Array.__svelte_cleanup=()=>{t.indexOf=n,t.lastIndexOf=i,t.includes=r}}()}}function Co(t=""){return document.createTextNode(t)}function Oo(t){return No.call(t)}function Po(t){return Mo.call(t)}function Ro(t,e){if(!vi)return Oo(t);var n=Oo(mi);if(null===n)n=mi.appendChild(Co());else if(e&&n.nodeType!==li){var i,r=Co();return null===(i=n)||void 0===i||i.before(r),yi(r),r}return yi(n),n}function Do(t,e=!1){var n;if(!vi){var i=Oo(t);return i instanceof Comment&&""===i.data?Po(i):i}if(e&&(null===(n=mi)||void 0===n?void 0:n.nodeType)!==li){var r,o=Co();return null===(r=mi)||void 0===r||r.before(o),yi(o),o}return mi}function Lo(t,e=1,n=!1){var i;let r=vi?mi:t;for(var o;e--;)o=r,r=Po(r);if(!vi)return r;if(n&&(null===(i=r)||void 0===i?void 0:i.nodeType)!==li){var s,a=Co();if(null===r)null===(s=o)||void 0===s||s.after(a);else r.before(a);return yi(a),a}return yi(r),r}function Bo(t){t.textContent=""}function zo(t,e){if(e){const e=document.body;t.autofocus=!0,$i((()=>{document.activeElement===e&&t.focus()}))}}let Wo=!1;function $o(t){var e=fs,n=vs;ms(null),gs(null);try{return t()}finally{ms(e),gs(n)}}function jo(t){null===vs&&(null===fs&&function(t){{const e=new Error(`effect_orphan\n\`${t}\` can only be used inside an effect (e.g. during component initialisation)\nhttps://svelte.dev/e/effect_orphan`);throw e.name="Svelte error",e}}(t),function(){{const t=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 t.name="Svelte error",t}}()),ds&&function(t){{const e=new Error(`effect_in_teardown\n\`${t}\` cannot be used inside an effect cleanup function\nhttps://svelte.dev/e/effect_in_teardown`);throw e.name="Svelte error",e}}(t)}function Uo(t,e,n){for(var i=vs;null!==i&&i.f&Kn;)i=i.parent;null!==i&&i.f&qn&&(t|=qn);var r={ctx:Ni,deps:null,nodes:null,f:t|jn|Wn,first:null,fn:e,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,wv:0,ac:null};if(r.component_function=Oi,n)try{Os(r),r.f|=Gn}catch(t){throw ns(r),t}else null!==e&&Tr(r);var o=r;if(!n||null!==o.deps||null!==o.teardown||null!==o.nodes||o.first!==o.last||o.f&Yn||(o=o.first,t&Dn&&t&Hn&&null!==o&&(o.f|=Hn)),null!==o&&(o.parent=i,null!==i&&function(t,e){var n=e.last;null===n?e.last=e.first=t:(n.next=t,t.prev=n,e.last=t)}(o,i),null!==fs&&fs.f&Cn&&!(t&Bn))){var s,a=fs;(null!==(s=a.effects)&&void 0!==s?s:a.effects=[]).push(o)}return r}function qo(){return null!==fs&&!ps}function Vo(t){const e=Uo(Pn,null,!1);return Ki(e,$n),e.teardown=t,e}function Go(t){jo("$effect"),Tn(t,"name",{value:"$effect"});var e=vs.f;if(!!(fs||!(e&Ln)||e&Gn))return Ho(t);var n,i=Ni;(null!==(n=i.e)&&void 0!==n?n:i.e=[]).push(t)}function Ho(t){return Uo(On|Qn,t,!1)}function Ko(t){return Uo(On,t,!1)}function Xo(t,e=0){return Uo(Pn|e,t,!0)}function Yo(t,e=[],n=[],i=[]){Qr(i,e,n,(e=>{Uo(Pn,(()=>t(...e.map(Rs))),!0)}))}function Qo(t,e=0){var n=Uo(Dn|e,t,!0);return n.dev_stack=Fi,n}function Jo(t,e=0){var n=Uo(Rn|e,t,!0);return n.dev_stack=Fi,n}function Zo(t){return Uo(Ln|Yn,t,!0)}function ts(t){var e=t.teardown;if(null!==e){const t=ds,n=fs;hs(!0),ms(null);try{e.call(null)}finally{hs(t),ms(n)}}}function es(t,e=!1){var n=t.first;for(t.first=t.last=null;null!==n;){const t=n.ac;null!==t&&$o((()=>{t.abort(ai)}));var i=n.next;n.f&Bn?n.parent=null:ns(n,e),n=i}}function ns(t,e=!0){var n=!1;(e||t.f&Xn)&&null!==t.nodes&&null!==t.nodes.end&&(!function(t,e){for(;null!==t;){var n=t===e?null:Po(t);t.remove(),t=n}}(t.nodes.start,t.nodes.end),n=!0),es(t,e&&!n),Cs(t,0),Ki(t,Vn);var i=t.nodes&&t.nodes.t;if(null!==i)for(const t of i)t.stop();ts(t);var r=t.parent;null!==r&&null!==r.first&&is(t),t.component_function=null,t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=null}function is(t){var e=t.parent,n=t.prev,i=t.next;null!==n&&(n.next=i),null!==i&&(i.prev=n),null!==e&&(e.first===t&&(e.first=i),e.last===t&&(e.last=n))}function rs(t,e,n=!0){var i=[];os(t,i,!0);var r=()=>{n&&ns(t),e&&e()},o=i.length;if(o>0){var s=()=>--o||r();for(var a of i)a.out(s)}else r()}function os(t,e,n){if(!(t.f&qn)){t.f^=qn;var i=t.nodes&&t.nodes.t;if(null!==i)for(const t of i)(t.is_global||n)&&e.push(t);for(var r=t.first;null!==r;){var o=r.next;os(r,e,!!(!!(r.f&Hn)||!!(r.f&Ln)&&!!(t.f&Dn))&&n),r=o}}}function ss(t){as(t,!0)}function as(t,e){if(t.f&qn){t.f^=qn,t.f&$n||(Ki(t,jn),Tr(t));for(var n=t.first;null!==n;){var i=n.next;as(n,!!(!!(n.f&Hn)||!!(n.f&Ln))&&e),n=i}var r=t.nodes&&t.nodes.t;if(null!==r)for(const t of r)(t.is_global||e)&&t.in()}}function ls(t,e){if(t.nodes)for(var n=t.nodes.start,i=t.nodes.end;null!==n;){var r=n===i?null:Po(n);e.append(n),n=r}}let cs=!1;function us(t){cs=t}let ds=!1;function hs(t){ds=t}let fs=null,ps=!1;function ms(t){fs=t}let vs=null;function gs(t){vs=t}let ys=null;function bs(t){null!==fs&&(null===ys?ys=[t]:ys.push(t))}let ks=null,ws=0,xs=null;let _s=1,Ts=0,Es=Ts;function Is(t){Es=t}function Ss(){return++_s}function As(t){var e=t.f;if(e&jn)return!0;if(e&Cn&&(t.f&=~Zn),e&Un){for(var n=t.deps,i=n.length,r=0;r<i;r++){var o=n[r];if(As(o)&&ao(o),o.wv>t.wv)return!0}e&Wn&&null===tr&&Ki(t,$n)}return!1}function Ns(t,e,n=!0){var i,r=t.reactions;if(null!==r&&(null===(i=ys)||void 0===i||!i.includes(t)))for(var o=0;o<r.length;o++){var s=r[o];s.f&Cn?Ns(s,e,!1):e===s&&(n?Ki(s,jn):s.f&$n&&Ki(s,Un),Tr(s))}}function Ms(t){var e=ks,n=ws,i=xs,r=fs,o=ys,s=Ni,a=ps,l=Es,c=t.f;ks=null,ws=0,xs=null,fs=c&(Ln|Bn)?null:t,ys=null,Mi(t.ctx),ps=!1,Es=++Ts,null!==t.ac&&($o((()=>{t.ac.abort(ai)})),t.ac=null);try{t.f|=ti;var u=(0,t.fn)(),d=t.deps;if(null!==ks){var h;if(Cs(t,ws),null!==d&&ws>0)for(d.length=ws+ks.length,h=0;h<ks.length;h++)d[ws+h]=ks[h];else t.deps=d=ks;if(qo()&&t.f&Wn)for(h=ws;h<d.length;h++){var f,p;(null!==(p=(f=d[h]).reactions)&&void 0!==p?p:f.reactions=[]).push(t)}}else null!==d&&ws<d.length&&(Cs(t,ws),d.length=ws);if(!(null===xs||ps||null===d||t.f&(Cn|Un|jn)))for(h=0;h<xs.length;h++)Ns(xs[h],t);return null!==r&&r!==t&&(Ts++,null!==xs&&(null===i?i=xs:i.push(...xs))),t.f&ni&&(t.f^=ni),u}catch(t){return qi(t)}finally{t.f^=ti,ks=e,ws=n,xs=i,fs=r,ys=o,Mi(s),ps=a,Es=l}}function Fs(t,e){let n=e.reactions;if(null!==n){var i=xn.call(n,t);if(-1!==i){var r=n.length-1;0===r?n=e.reactions=null:(n[i]=n[r],n.pop())}}if(null===n&&e.f&Cn&&(null===ks||!ks.includes(e))){var o=e;o.f&Wn&&(o.f^=Wn,o.f&=~Zn),Xi(o),ro(o),Cs(o,0)}}function Cs(t,e){var n=t.deps;if(null!==n)for(var i=e;i<n.length;i++)Fs(t,n[i])}function Os(t){var e=t.f;if(!(e&Vn)){Ki(t,$n);var n=vs,i=cs;vs=t,cs=!0;var r,o=Oi;Pi(t.component_function);var s=Fi;Ci(null!==(r=t.dev_stack)&&void 0!==r?r:Fi);try{e&(Dn|Rn)?function(t){for(var e=t.first;null!==e;){var n=e.next;e.f&Ln||ns(e),e=n}}(t):es(t),ts(t);var a=Ms(t);t.teardown="function"==typeof a?a:null,t.wv=_s,kn&&Ei&&t.f&jn&&t.deps}finally{cs=i,vs=n,Pi(o),Ci(s)}}}async function Ps(){await Promise.resolve(),function(){var t=rr;rr=!0;try{for(;;){var e;if(ji(),0===er.length&&(null===(e=Zi)||void 0===e||e.flush(),0===er.length))return void(nr=null);yr()}}finally{rr=t}}()}function Rs(t){var e,n,i=!!(t.f&Cn);if(null!==fs&&!ps&&!(null!==vs&&!!(vs.f&Vn)||null!==(n=ys)&&void 0!==n&&n.includes(t))){var r=fs.deps;if(fs.f&ti)t.rv<Ts&&(t.rv=Ts,null===ks&&null!==r&&r[ws]===t?ws++:null===ks?ks=[t]:ks.includes(t)||ks.push(t));else{var o,s;(null!==(s=(o=fs).deps)&&void 0!==s?s:o.deps=[]).push(t);var a=t.reactions;null===a?t.reactions=[fs]:a.includes(fs)||a.push(fs)}}if(Zr.delete(t),ds&&co.has(t))return co.get(t);if(i){var l=t;if(ds){var c=l.v;return(l.f&$n||null===l.reactions)&&!Ls(l)||(c=so(l)),co.set(l,c),c}var u=!(l.f&Wn)&&!ps&&null!==fs&&(cs||!!(fs.f&Wn)),d=null===l.deps;As(l)&&(u&&(l.f|=Wn),ao(l)),u&&!d&&Ds(l)}if(null!==(e=tr)&&void 0!==e&&e.has(t))return tr.get(t);if(t.f&ni)throw t.v;return t.v}function Ds(t){if(null!==t.deps){t.f|=Wn;for(const n of t.deps){var e;(null!==(e=n.reactions)&&void 0!==e?e:n.reactions=[]).push(t),n.f&Cn&&!(n.f&Wn)&&Ds(n)}}}function Ls(t){if(t.v===vn)return!0;if(null===t.deps)return!1;for(const e of t.deps){if(co.has(e))return!0;if(e.f&Cn&&Ls(e))return!0}return!1}function Bs(t){var e=ps;try{return ps=!0,t()}finally{ps=e}}const zs=new Set,Ws=new Set;function $s(t,e,n,i={}){function r(t){if(i.capture||Vs.call(e,t),!t.cancelBubble)return $o((()=>null==n?void 0:n.call(this,t)))}return t.startsWith("pointer")||t.startsWith("touch")||"wheel"===t?$i((()=>{e.addEventListener(t,r,i)})):e.addEventListener(t,r,i),r}function js(t,e,n,i,r){var o={capture:i,passive:r},s=$s(t,e,n,o);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&Vo((()=>{e.removeEventListener(t,s,o)}))}function Us(t){for(var e=0;e<t.length;e++)zs.add(t[e]);for(var n of Ws)n(t)}let qs=null;function Vs(t){var e,n=this,i=n.ownerDocument,r=t.type,o=(null===(e=t.composedPath)||void 0===e?void 0:e.call(t))||[],s=o[0]||t.target;qs=t;var a=0,l=qs===t&&t.__root;if(l){var c=o.indexOf(l);if(-1!==c&&(n===document||n===window))return void(t.__root=n);var u=o.indexOf(n);if(-1===u)return;c<=u&&(a=c)}if((s=o[a]||t.target)!==n){Tn(t,"currentTarget",{configurable:!0,get:()=>s||i});var d=fs,h=vs;ms(null),gs(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&&t.target!==s||v.call(s,t)}catch(t){f?p.push(t):f=t}if(t.cancelBubble||m===n||null===m)break;s=m}if(f){for(let t of p)queueMicrotask((()=>{throw t}));throw f}}finally{t.__root=n,delete t.currentTarget,ms(d),gs(h)}}}function Gs(t,e){var n=vs;null===n.nodes&&(n.nodes={start:t,end:e,a:null,t:null})}function Hs(t,e){var n,i=!!(1&e),r=!!(2&e),o=!t.startsWith("<!>");return()=>{if(vi)return Gs(mi,null),mi;var e,s;void 0===n&&(e=o?t:"<!>"+t,(s=document.createElement("template")).innerHTML=e.replaceAll("<!>","\x3c!----\x3e"),n=s.content,i||(n=Oo(n)));var a=r||Ao?document.importNode(n,!0):n.cloneNode(!0);i?Gs(Oo(a),a.lastChild):Gs(a,a);return a}}function Ks(){if(vi)return Gs(mi,null),mi;var t=document.createDocumentFragment(),e=document.createComment(""),n=Co();return t.append(e,n),Gs(e,n),t}function Xs(t,e){if(vi){var n=vs;return n.f&Gn&&null!==n.nodes.end||(n.nodes.end=mi),void bi()}null!==t&&t.before(e)}function Ys(t){return t.endsWith("capture")&&"gotpointercapture"!==t&&"lostpointercapture"!==t}const Qs=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function Js(t){return Qs.includes(t)}const Zs={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(t){var e;return t=t.toLowerCase(),null!==(e=Zs[t])&&void 0!==e?e:t}const ea=["touchstart","touchmove"];function na(t,e){var n,i=null==e?"":"object"==typeof e?e+"":e;i!==(null!==(n=t.__t)&&void 0!==n?n:t.__t=t.nodeValue)&&(t.__t=i,t.nodeValue=i+"")}function ia(t,e){return sa(t,e)}function ra(t,e){var n;Fo(),e.intro=null!==(n=e.intro)&&void 0!==n&&n;const i=e.target,r=vi,o=mi;try{for(var s=Oo(i);s&&(s.nodeType!==ci||s.data!==hn);)s=Po(s);if(!s)throw mn;gi(!0),yi(s);const n=sa(t,{...e,anchor:s});return gi(!1),n}catch(n){if(n instanceof Error&&n.message.split("\n").some((t=>t.startsWith("https://svelte.dev/e/"))))throw n;return n!==mn&&console.warn("Failed to hydrate: ",n),!1===e.recover&&function(){{const t=new Error("hydration_failed\nFailed to hydrate the application\nhttps://svelte.dev/e/hydration_failed");throw t.name="Svelte error",t}}(),Fo(),Bo(i),gi(!1),ia(t,e)}finally{gi(r),yi(o)}}const oa=new Map;function sa(t,{target:e,anchor:n,props:i={},events:r,context:o,intro:s=!0}){Fo();var a=new Set,l=t=>{for(var n=0;n<t.length;n++){var i=t[n];if(!a.has(i)){a.add(i);var r=(s=i,ea.includes(s));e.addEventListener(i,Vs,{passive:r});var o=oa.get(i);void 0===o?(document.addEventListener(i,Vs,{passive:r}),oa.set(i,1)):oa.set(i,o+1)}}var s};l(_n(zs)),Ws.add(l);var c=void 0,u=function(t){fr.ensure();const e=Uo(Bn|Yn,t,!0);return(t={})=>new Promise((n=>{t.outro?rs(e,(()=>{ns(e),n(void 0)})):(ns(e),n(void 0))}))}((()=>{var s=null!=n?n:e.appendChild(Co());return function(t,e,n){new qr(t,e,n)}(s,{pending:()=>{}},(e=>{o&&(Di({}),Ni.c=o);if(r&&(i.$$events=r),vi&&Gs(e,null),c=t(e,i)||{},vi&&(vs.nodes.end=mi,null===mi||mi.nodeType!==ci||mi.data!==pn))throw fi(),mn;o&&Li()})),()=>{for(var t of a){e.removeEventListener(t,Vs);var i=oa.get(t);0==--i?(document.removeEventListener(t,Vs),oa.delete(t)):oa.set(t,i)}var r;(Ws.delete(l),s!==n)&&(null===(r=s.parentNode)||void 0===r||r.removeChild(s))}}));return aa.set(c,u),c}let aa=new WeakMap;function la(t,e){const n=aa.get(t);return n?(aa.delete(t),n(e)):(ii in t?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",di,hi):console.warn("%c[svelte] lifecycle_double_unmount\n%cTried to unmount a component that was not mounted\nhttps://svelte.dev/e/lifecycle_double_unmount",di,hi),Promise.resolve())}class ca{anchor;#t=new Map;#e=new Map;#n=new Map;#i=new Set;#r=!0;constructor(t,e=!0){this.anchor=t,this.#r=e}#o=()=>{var t=Zi;if(this.#t.has(t)){var e=this.#t.get(t),n=this.#e.get(e);if(n)ss(n),this.#i.delete(e);else{var i=this.#n.get(e);i&&(this.#e.set(e,i.effect),this.#n.delete(e),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),n=i.effect)}for(const[e,n]of this.#t){if(this.#t.delete(e),e===t)break;const i=this.#n.get(n);i&&(ns(i.effect),this.#n.delete(n))}for(const[t,i]of this.#e){if(t===e||this.#i.has(t))continue;const r=()=>{if(Array.from(this.#t.values()).includes(t)){var e=document.createDocumentFragment();ls(i,e),e.append(Co()),this.#n.set(t,{effect:i,fragment:e})}else ns(i);this.#i.delete(t),this.#e.delete(t)};this.#r||!n?(this.#i.add(t),rs(i,r,!1)):r()}}};#s=t=>{this.#t.delete(t);const e=Array.from(this.#t.values());for(const[t,n]of this.#n)e.includes(t)||(ns(n.effect),this.#n.delete(t))};ensure(t,e){var n=Zi;!e||this.#e.has(t)||this.#n.has(t)||this.#e.set(t,Zo((()=>e(this.anchor)))),this.#t.set(n,t),vi&&(this.anchor=mi),this.#o()}}{let t=function(t){if(!(t in globalThis)){let e;Object.defineProperty(globalThis,t,{configurable:!0,get:()=>{if(void 0!==e)return e;!function(t){{const e=new Error(`rune_outside_svelte\nThe \`${t}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files\nhttps://svelte.dev/e/rune_outside_svelte`);throw e.name="Svelte error",e}}(t)},set:t=>{e=t}})}};t("$state"),t("$effect"),t("$derived"),t("$inspect"),t("$props"),t("$bindable")}var ua,da=new Map;function ha(t,e,n=!1){vi&&bi();var i=new ca(t);function r(e,n){if(vi){if(e===(xi(t)===fn)){var r=wi();return yi(r),i.anchor=r,gi(!1),i.ensure(e,n),void gi(!0)}}i.ensure(e,n)}Qo((()=>{var t=!1;e(((e,n=!0)=>{t=!0,r(n,e)})),t||r(!1,null)}),n?Hn:0)}function fa(t,e){return e}function pa(t,e=!0){for(var n=0;n<t.length;n++)ns(t[n],e)}function ma(t,e,n,i,r,o=null){var s=t,a=new Map;if(!!(e&on)){var l=t;s=vi?yi(Oo(l)):l.appendChild(Co())}vi&&bi();var c,u=null,d=io((()=>{var t=n();return wn(t)?t:null==t?[]:_n(t)})),h=!0;function f(){m.fallback=u,function(t,e,n,i,r){var o,s,a,l,c,u=!!(i&sn),d=e.length,h=t.items,f=t.effect.first,p=null,m=[],v=[];if(u)for(c=0;c<d;c+=1){var g,y;if(a=r(e[c],c),!((l=h.get(a).e).f&Jn))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(e[c],c),l=h.get(a).e,null!==t.outrogroups)for(const e of t.outrogroups)e.pending.delete(l),e.done.delete(l);if(l.f&Jn){if(l.f^=Jn,l!==f){var b=p?p.next:f;l===t.effect.last&&(t.effect.last=l.prev),l.prev&&(l.prev.next=l.next),l.next&&(l.next.prev=l.prev),ya(t,p,l),ya(t,l,b),ga(l,b,n),m=[],v=[],f=(p=l).next;continue}ga(l,null,n)}var k,w;if(l.f&qn)if(ss(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],E=m[m.length-1];for(x=0;x<m.length;x+=1)ga(m[x],_,n);for(x=0;x<v.length;x+=1)o.delete(v[x]);ya(t,T.prev,E.next),ya(t,p,T),ya(t,E,_),f=_,p=E,c-=1,m=[],v=[]}else o.delete(l),ga(l,f,n),ya(t,l.prev,l.next),ya(t,l,null===p?t.effect.first:p.next),ya(t,p,l),p=l;continue}for(m=[],v=[];null!==f&&f!==l;){var I;(null!==(I=o)&&void 0!==I?I:o=new Set).add(f),v.push(f),f=f.next}if(null===f)continue}l.f&Jn||m.push(l),p=l,f=l.next}if(null!==t.outrogroups){for(const e of t.outrogroups){var S;if(0===e.pending.size)pa(_n(e.done)),null===(S=t.outrogroups)||void 0===S||S.delete(e)}0===t.outrogroups.size&&(t.outrogroups=null)}if(null!==f||void 0!==o){var A=[];if(void 0!==o)for(l of o)l.f&qn||A.push(l);for(;null!==f;)f.f&qn||f===t.fallback||A.push(f),f=f.next;var N=A.length;if(N>0){var M=i&on&&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(t,e,n){for(var i,r=e.length,o=e.length,s=0;s<r;s++){let n=e[s];rs(n,(()=>{if(i){if(i.pending.delete(n),i.done.add(n),0===i.pending.size){var e=t.outrogroups;pa(_n(i.done)),e.delete(i),0===e.size&&(t.outrogroups=null)}}else o-=1}),!1)}if(0===o){var a=null!==n;if(a){var l=n,c=l.parentNode;Bo(c),c.append(l),t.items.clear()}pa(e,!a)}else{var u;i={pending:new Set(e),done:new Set},(null!==(u=t.outrogroups)&&void 0!==u?u:t.outrogroups=new Set).add(i)}}(t,A,M)}}u&&$i((()=>{if(void 0!==s)for(l of s){var t;null===(t=l.nodes)||void 0===t||null===(t=t.a)||void 0===t||t.apply()}}))}(m,c,s,e,i),null!==u&&(0===c.length?u.f&Jn?(u.f^=Jn,ga(u,null,s)):ss(u):rs(u,(()=>{u=null})))}var p=Qo((()=>{var t=(c=Rs(d)).length;let l=!1;vi&&(xi(s)===fn!==(0===t)&&(yi(s=wi()),gi(!1),l=!0));for(var p=new Set,m=0;m<t;m+=1){vi&&mi.nodeType===ci&&mi.data===pn&&(s=mi,l=!0,gi(!1));var v,g=c[m],y=i(g,m),b=h?null:a.get(y);if(b)b.v&&go(b.v,g),b.i&&go(b.i,m);else b=va(a,h?s:null!==(v=ua)&&void 0!==v?v:ua=Co(),g,y,m,r,e,n),h||(b.e.f|=Jn),a.set(y,b);p.add(y)}0===t&&o&&!u&&(h?u=Zo((()=>o(s))):(u=Zo((()=>{var t;return o(null!==(t=ua)&&void 0!==t?t:ua=Co())}))).f|=Jn),vi&&t>0&&yi(wi()),h||f(),l&&gi(!0),Rs(d)})),m={effect:p,items:a,outrogroups:null,fallback:u};h=!1,vi&&(s=mi)}function va(t,e,n,i,r,o,s,a){var l=s&nn?s&an?fo(n):mo(n,!1,!1):null,c=s&rn?fo(r):null;return l&&(l.trace=()=>{var t;a()[null!==(t=null==c?void 0:c.v)&&void 0!==t?t:r]}),{v:l,i:c,e:Zo((()=>(o(e,null!=l?l:n,null!=c?c:r,a),()=>{t.delete(i)})))}}function ga(t,e,n){if(t.nodes)for(var i=t.nodes.start,r=t.nodes.end,o=!e||e.f&Jn?n:e.nodes.start;null!==i;){var s=Po(i);if(o.before(i),i===r)return;i=s}}function ya(t,e,n){null===e?t.effect.first=n:e.next=n,null===n?t.effect.last=e:n.prev=e}function ba(t,e){Ko((()=>{var n,i=t.getRootNode(),r=i.host?i:null!==(n=i.head)&&void 0!==n?n:i.ownerDocument.head;if(!r.querySelector("#"+e.hash)){const t=document.createElement("style");t.id=e.hash,t.textContent=e.code,r.appendChild(t),function(t,e){var n=da.get(t);n||(n=new Set,da.set(t,n)),n.add(e)}(e.hash,t)}}))}function ka(t,e){var n,i=void 0;Jo((()=>{i!==(i=e())&&(n&&(ns(n),n=null),i&&(n=Zo((()=>{Ko((()=>i(t)))}))))}))}function wa(t){var e,n,i="";if("string"==typeof t||"number"==typeof t)i+=t;else if("object"==typeof t)if(Array.isArray(t)){var r=t.length;for(e=0;e<r;e++)t[e]&&(n=wa(t[e]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}function xa(t){return"object"==typeof t?function(){for(var t,e,n=0,i="",r=arguments.length;n<r;n++)(t=arguments[n])&&(e=wa(t))&&(i&&(i+=" "),i+=e);return i}(t):null!=t?t:""}const _a=[..." \t\n\r\f \v\ufeff"];function Ta(t,e=!1){var n=e?" !important;":";",i="";for(var r in t){var o=t[r];null!=o&&""!==o&&(i+=" "+r+": "+o+n)}return i}function Ea(t){return"-"!==t[0]||"-"!==t[1]?t.toLowerCase():t}function Ia(t,e,n,i,r,o){var s=t.__className;if(vi||s!==n||void 0===s){var a=function(t,e,n){var i=null==t?"":""+t;if(e&&(i=i?i+" "+e:e),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&&!_a.includes(i[s-1])||a!==i.length&&!_a.includes(i[a])?s=a:i=(0===s?"":i.substring(0,s))+i.substring(a+1)}return""===i?null:i}(n,i,o);vi&&a===t.getAttribute("class")||(null==a?t.removeAttribute("class"):e?t.className=a:t.setAttribute("class",a)),t.__className=n}else if(o&&r!==o)for(var l in o){var c=!!o[l];null!=r&&c===!!r[l]||t.classList.toggle(l,c)}return o}function Sa(t,e={},n,i){for(var r in n){var o=n[r];e[r]!==o&&(null==n[r]?t.style.removeProperty(r):t.style.setProperty(r,o,i))}}function Aa(t,e,n,i){var r=t.__style;if(vi||r!==e){var o=function(t,e){if(e){var n,i,r="";if(Array.isArray(e)?(n=e[0],i=e[1]):n=e,t){t=String(t).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 e=t.length;for(var d=0;d<e;d++){var h=t[d];if(a?"/"===h&&"*"===t[d-1]&&(a=!1):o?o===h&&(o=!1):"/"===h&&"*"===t[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===e-1){if(-1!==u){var f=Ea(t.substring(c,u).trim());l.includes(f)||(";"!==h&&d++,r+=" "+t.substring(c,d).trim()+";")}c=d+1,u=-1}}}return n&&(r+=Ta(n)),i&&(r+=Ta(i,!0)),""===(r=r.trim())?null:r}return null==t?null:String(t)}(e,i);vi&&o===t.getAttribute("style")||(null==o?t.removeAttribute("style"):t.style.cssText=o),t.__style=e}else i&&(Array.isArray(i)?(Sa(t,null==n?void 0:n[0],i[0]),Sa(t,null==n?void 0:n[1],i[1],"important")):Sa(t,n,i));return i}function Na(t,e,n=!1){if(t.multiple){if(null==e)return;if(!wn(e))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",di,hi);for(var i of t.options)i.selected=e.includes(Ma(i))}else{for(i of t.options){var r=Ma(i);if(o=r,s=e,Object.is(To(o),To(s)))return void(i.selected=!0)}var o,s;n&&void 0===e||(t.selectedIndex=-1)}}function Ma(t){return"__value"in t?t.__value:t.value}const Fa=Symbol("class"),Ca=Symbol("style"),Oa=Symbol("is custom element"),Pa=Symbol("is html");function Ra(t){if(vi){var e=!1,n=()=>{if(!e){if(e=!0,t.hasAttribute("value")){var n=t.value;La(t,"value",null),t.value=n}if(t.hasAttribute("checked")){var i=t.checked;La(t,"checked",null),t.checked=i}}};t.__on_r=n,$i(n),Wo||(Wo=!0,document.addEventListener("reset",(t=>{Promise.resolve().then((()=>{if(!t.defaultPrevented)for(const n of t.target.elements){var e;null===(e=n.__on_r)||void 0===e||e.call(n)}}))}),{capture:!0}))}}function Da(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function La(t,e,n,i){var r=za(t);vi&&(r[e]=t.getAttribute(e),"src"===e||"srcset"===e||"href"===e&&"LINK"===t.nodeName)?i||function(t,e,n){var i;if("srcset"===e&&function(t,e){var n=Ua(t.srcset),i=Ua(e);return i.length===n.length&&i.every((([t,e],i)=>e===n[i][1]&&(ja(n[i][0],t)||ja(t,n[i][0]))))}(t,n))return;if(ja(null!==(i=t.getAttribute(e))&&void 0!==i?i:"",n))return;!function(t,e,n){console.warn(`%c[svelte] hydration_attribute_changed\n%cThe \`${t}\` attribute on \`${e}\` 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`,di,hi)}(e,t.outerHTML.replace(t.innerHTML,t.innerHTML&&"..."),String(n))}(t,e,null!=n?n:""):r[e]!==(r[e]=n)&&("loading"===e&&(t[oi]=n),null==n?t.removeAttribute(e):"string"!=typeof n&&$a(t).includes(e)?t[e]=n:t.setAttribute(e,n))}function Ba(t,e,n=[],i=[],r=[],o,s=!1,a=!1){Qr(r,n,i,(n=>{var i=void 0,r={},l="SELECT"===t.nodeName,c=!1;if(Jo((()=>{var u=e(...n.map(Rs)),d=function(t,e,n,i,r=!1,o=!1){if(vi&&r&&"INPUT"===t.tagName){var s=t;("checkbox"===s.type?"defaultChecked":"defaultValue")in n||Ra(s)}var a=za(t),l=a[Oa],c=!a[Pa];let u=vi&&l;u&&gi(!1);var d,h=e||{},f="OPTION"===t.tagName;for(var p in e)p in n||(n[p]=null);n.class?n.class=xa(n.class):n.class=null,n[Ca]&&(null!==(d=n.style)&&void 0!==d||(n.style=null));var m=$a(t);for(const r in n){let s=n[r];if(f&&"value"===r&&null==s)t.value=t.__value="",h[r]=s;else if("class"!==r)if("style"!==r){var v=h[r];if(s!==v||void 0===s&&t.hasAttribute(r)){h[r]=s;var g=r[0]+r[1];if("$$"!==g)if("on"===g){const e={},n="$$"+r;let i=r.slice(2);var y=Js(i);if(Ys(i)&&(i=i.slice(0,-7),e.capture=!0),!y&&v){if(null!=s)continue;t.removeEventListener(i,h[n],e),h[n]=null}if(null!=s)if(y)t[`__${i}`]=s,Us([i]);else{let o=function(t){h[r].call(this,t)};h[n]=$s(i,t,o,e)}else y&&(t[`__${i}`]=void 0)}else if("style"===r)La(t,r,s);else if("autofocus"===r)zo(t,Boolean(s));else if(l||"__value"!==r&&("value"!==r||null==s))if("selected"===r&&f)Da(t,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)?(t[b]=s,b in a&&(a[b]=vn)):"function"!=typeof s&&La(t,b,s,o);else if(a[r]=null,"value"===b||"checked"===b){let n=t;const i=void 0===e;if("value"===b){let t=n.defaultValue;n.removeAttribute(b),n.defaultValue=t,n.value=n.__value=i?t:null}else{let t=n.defaultChecked;n.removeAttribute(b),n.defaultChecked=t,n.checked=!!i&&t}}else t.removeAttribute(r)}else t.value=t.__value=s}}else Aa(t,s,null==e?void 0:e[Ca],n[Ca]),h[r]=s,h[Ca]=n[Ca];else Ia(t,"http://www.w3.org/1999/xhtml"===t.namespaceURI,s,i,null==e?void 0:e[Fa],n[Fa]),h[r]=s,h[Fa]=n[Fa]}return u&&gi(!0),h}(t,i,u,o,s,a);c&&l&&"value"in u&&Na(t,u.value);for(let t of Object.getOwnPropertySymbols(r))u[t]||ns(r[t]);for(let e of Object.getOwnPropertySymbols(u)){var h=u[e];e.description!==bn||i&&h===i[e]||(r[e]&&ns(r[e]),r[e]=Zo((()=>ka(t,(()=>h))))),d[e]=h}i=d})),l){var u=t;Ko((()=>{Na(u,i.value,!0),function(t){var e=new MutationObserver((()=>{Na(t,t.__value)}));e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Vo((()=>{e.disconnect()}))}(u)}))}c=!0}))}function za(t){var e;return null!==(e=t.__attributes)&&void 0!==e?e:t.__attributes={[Oa]:t.nodeName.includes("-"),[Pa]:t.namespaceURI===yn}}var Wa=new Map;function $a(t){var e,n=t.getAttribute("is")||t.nodeName,i=Wa.get(n);if(i)return i;Wa.set(n,i=[]);for(var r=t,o=Element.prototype;o!==r;){for(var s in e=In(r))e[s].set&&i.push(s);r=Nn(r)}return i}function ja(t,e){return t===e||new URL(t,document.baseURI).href===new URL(e,document.baseURI).href}function Ua(t){return t.split(",").map((t=>t.trim().split(" ").filter(Boolean)))}function qa(t,e){return t===e||(null==t?void 0:t[ii])===e}function Va(t={},e,n,i){return Ko((()=>{var i,r;return Xo((()=>{i=r,r=[],Bs((()=>{t!==n(...r)&&(e(t,...r),i&&qa(n(...i),t)&&e(null,...i))}))})),()=>{$i((()=>{r&&qa(n(...r),t)&&e(null,...r)}))}})),t}let Ga=!1;function Ha(t,e,n,i){var r,o,s=!!(n&un),a=!!(n&dn),l=i,c=!0,u=()=>(c&&(c=!1,l=a?Bs(i):i),l);if(s){var d,h,f=ii in t||ri in t;r=null!==(d=null===(h=En(t,e))||void 0===h?void 0:h.set)&&void 0!==d?d:f&&e in t?n=>t[e]=n:void 0}var p,m=!1;if(s?[o,m]=function(t){var e=Ga;try{return Ga=!1,[t(),Ga]}finally{Ga=e}}((()=>t[e])):o=t[e],void 0===o&&void 0!==i&&(o=u(),r&&(!function(t){{const e=new Error(`props_invalid_value\nCannot do \`bind:${t}={undefined}\` when \`${t}\` has a fallback value\nhttps://svelte.dev/e/props_invalid_value`);throw e.name="Svelte error",e}}(e),r(o))),p=()=>{var n=t[e];return void 0===n?u():(c=!0,n)},!(n&cn))return p;if(r){var v=t.$$legacy;return function(t,e){return arguments.length>0?((!e||v||m)&&r(e?p():t),t):p()}}var g=!1,y=(n&ln?to:io)((()=>(g=!1,p())));y.label=e,s&&Rs(y);var b=vs;return function(t,e){if(arguments.length>0){const n=e?Rs(y):s?xo(t):t;return vo(y,n),g=!0,void 0!==l&&(l=n),t}return ds&&g||b.f&Vn?y.v:Rs(y)}}var Ka,Xa,Ya,Qa;"undefined"!=typeof window&&(null!==(Xa=(Ka=null!==(Qa=(Ya=window).__svelte)&&void 0!==Qa?Qa:Ya.__svelte={}).v)&&void 0!==Xa?Xa:Ka.v=new Set).add("5");function Ja(t,{include:e,exclude:n}={}){const i=t=>{const i=e=>"string"==typeof e?t===e:e.test(t);return e?e.some(i):!n||!n.some(i)};for(const[e,n]of(t=>{const e=new Set;do{for(const n of Reflect.ownKeys(t))e.add([t,n])}while((t=Reflect.getPrototypeOf(t))&&t!==Object.prototype);return e})(t.constructor.prototype)){if("constructor"===n||!i(n))continue;const r=Reflect.getOwnPropertyDescriptor(e,n);r&&"function"==typeof r.value&&(t[n]=t[n].bind(t))}return t}function Za(t,e){t.getNodesAtTime(0)[0].once("nodestart",e)}class tl{constructor({position:t,gallery:e,config:n}){this.config=n,this.position=t,this.gallery=e,this.name=n.name;const{variantId:i,itemIndex:r,moduleIndex:o}=t;this.id=`${n.itemType}_${i}_${r}_${o}`,Ja(this)}#a=Ii(po(xo({})),"BaseModule.#state");#l=Ii(po(null),"BaseModule.#cover");#c=Ii(po(!1),"BaseModule.#showCover");#u=Ii(po(null),"BaseModule.#Component");id;player;position;config;timeline;moduleEndListener;hasDuration=!1;coverAssets=[];get state(){return Rs(this.#a)}set state(t){vo(this.#a,t,!0)}get cover(){return Rs(this.#l)}set cover(t){vo(this.#l,t)}get showCover(){return Rs(this.#c)}set showCover(t){vo(this.#c,t,!0)}get Component(){return Rs(this.#u)}set Component(t){vo(this.#u,t)}emitModuleEnd(){var t;null===(t=this.moduleEndListener)||void 0===t||t.call(this)}start(t){this.player=t}setPosition(){this.gallery.state.playingModulePosition=this.position}play(){this.gallery.track("moduleview"),Za(this.timeline,(()=>{this.setPosition()})),this.player.switchTimeline(this.timeline)}get duration(){return this.hasDuration?this.timeline.placements.reduce(((t,e)=>t+this.player.getNode(e.nodeId).duration),0):0}}const el="cmaf:";function nl(t,e,n){var i,r,o;const s=(null==e||null===(i=e.entity)||void 0===i?void 0:i.entityId)||(null==e?void 0:e.assetId),a=null!==(r=null==e||null===(o=e.entity)||void 0===o?void 0:o.entityRevision)&&void 0!==r?r:null==e?void 0:e.assetRevision,l=function(t){return t&&t.find((t=>t.startsWith(el)))?t.filter((t=>t.startsWith(el))):t}(null==e?void 0:e.availableEncodeProfiles);return n.addNode({id:t,manifestRef:{type:"assets-delivery-service",assetId:s,assetRevision:a,availableEncodeProfiles:l}})}var il=Hs('<h3 class="text-box-title svelte-wejicf"> </h3>'),rl=Hs('<span class="text-box-title svelte-wejicf"> </span>'),ol=Hs('<span class="text-box-description minimized-description svelte-wejicf"> </span>'),sl=Hs('<span class="read-more-cta svelte-wejicf" aria-hidden="true">Read more</span>'),al=Hs('<button class="expand-description-button svelte-wejicf" aria-expanded="false" aria-controls="expanded-text-content" aria-label="Expand feature description"><!> <!></button>'),ll=Hs('<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=Hs('<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(t,e){Di(e,!0),ba(t,ul);let n=Ha(e,"textBox",3,null),i=Ha(e,"isMobile",3,!1),r=po(!1),o=po(null),s=po(!1),a=no((()=>{var t;return(null===(t=n())||void 0===t?void 0:t.title)||""})),l=no((()=>{var t;return(null===(t=n())||void 0===t?void 0:t.description)||""})),c=no((()=>i()?16:18)),u=no((()=>i()?12:16));function d(){Rs(o)&&vo(s,Rs(o).scrollWidth>Rs(o).clientWidth||Rs(o).scrollHeight>Rs(o).clientHeight,!0)}Go((()=>{Rs(o)&&d()}));var h=Ks();js("resize",So,d);var f=Do(h),p=t=>{var n=cl(),d=Ro(n),h=Ro(d),f=Ro(h),p=t=>{var e=il(),n=Ro(e,!0);ki(e),Yo((()=>na(n,Rs(a)))),Xs(t,e)};ha(f,(t=>{i()&&t(p)}));var m=Lo(f,2),v=Ro(m,!0);ki(m),ki(h);var g=Lo(h,2),y=t=>{var n=al(),u=no((()=>e.gallery.interaction((()=>vo(r,!0)),{elementid:"textbox-expand",elementtype:"textbox",elementname:"Read more",interactiontype:"module-ui"})));n.__click=function(...t){var e;null===(e=Rs(u))||void 0===e||e.apply(this,t)};var d=Ro(n),h=t=>{var e=rl(),n=Ro(e,!0);ki(e),Yo((()=>na(n,Rs(a)))),Xs(t,e)},f=t=>{var e=ol(),n=Ro(e,!0);ki(e),Va(e,(t=>vo(o,t)),(()=>Rs(o))),Yo((()=>na(n,Rs(l)))),Xs(t,e)};ha(d,(t=>{i()&&Rs(a)?t(h):t(f,!1)}));var p=Lo(d,2),m=t=>{Xs(t,sl())};ha(p,(t=>{(i()||!i()&&Rs(s))&&t(m)})),ki(n),Yo((()=>Aa(n,`line-height: ${Rs(c)}px;`))),Xs(t,n)};ha(g,(t=>{Rs(r)||t(y)})),ki(d);var b=Lo(d,2),k=t=>{var n=ll(),o=no((()=>e.gallery.interaction((()=>vo(r,!1)))));n.__click=function(...t){var e;null===(e=Rs(o))||void 0===e||e.apply(this,t)},Yo((()=>Aa(n,`margin-bottom: ${!i()&&Rs(r)?"8px":"0px"};\n line-height: ${Rs(u)}px;`))),Xs(t,n)};ha(b,(t=>{Rs(r)&&t(k)})),ki(n),Yo((()=>{Ia(n,1,"step-description-container "+(Rs(r)?"expanded":""),"svelte-wejicf"),Aa(n,`padding: ${i()?"8px 16px":"16px 16px 64px 16px"};`),Aa(h,`line-height: ${Rs(c)}px;`),La(h,"hidden",!Rs(r)),na(v,Rs(l))})),Xs(t,n)};ha(f,(t=>{(Rs(a)||Rs(l))&&t(p)})),Xs(t,h),Li()}function hl(t,e){const n=no((()=>e.state.textBox));dl(t,{get textBox(){return Rs(n)},get isMobile(){return e.isMobile},get gallery(){return e.gallery}})}Us(["click"]);var fl=Hs('<div class="toggle-option-container svelte-16pmvvn"><button data-elementtype="toggle" data-interactiontype="module-ui"> </button></div>'),pl=Hs('<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(t,e){Di(e,!0),ba(t,ml);const n=no((()=>e.state.options)),i=no((()=>e.state.currentOptionIndex)),r=no((()=>e.state.onOptionClicked)),o=no((()=>e.state.textBox));var s=pl(),a=Do(s),l=Ro(a);ma(l,21,(()=>Rs(n)),fa,((t,n,o)=>{var s=fl();Aa(s,`--button-index: ${o};`);var a=Ro(s);let l;var c=no((()=>e.gallery.interaction((()=>Rs(r)(o)))));a.__click=function(...t){var e;null===(e=Rs(c))||void 0===e||e.apply(this,t)},La(a,"data-elementid",`${o+1}`);var u=Ro(a,!0);ki(a),ki(s),Yo((()=>{l=Ia(a,1,"toggle-option-button svelte-16pmvvn",null,l,{selected:Rs(i)===o}),La(a,"data-elementname",Rs(n).label),na(u,Rs(n).label)})),Xs(t,s)})),ki(l),ki(a);var c=Lo(a,2),u=t=>{dl(t,{get textBox(){return Rs(o)},get isMobile(){return e.isMobile},get gallery(){return e.gallery}})};ha(c,(t=>{Rs(o)&&t(u)})),Yo((()=>{var t;return Ia(l,1,`toggle-options selected-${null!==(t=Rs(i))&&void 0!==t?t:""}`,"svelte-16pmvvn")})),Xs(t,s),Li()}Us(["click"]);var gl=new WeakSet;function yl(t){var e,n;t!==this.state.currentOptionIndex&&(this.state.currentOptionIndex=t,this.state.textBox=this.config.options[t].textBox,this.cover=this.coverAssets[t],this.synced?this.switchTo(t):(this.timeline=null===(e=this.timelines)||void 0===e?void 0:e[t],this.showCover=!0,Za(this.timeline,(()=>{this.showCover=!1})),null===(n=this.player)||void 0===n||n.switchTimeline(this.timeline)))}const bl=(t,e,n)=>n>e?e:n<t?t:n;function kl(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let wl=()=>{},xl=()=>{};function _l(t){let e;return()=>(void 0===e&&(e=t()),e)}"undefined"!=typeof process&&"production"!==(null===(re=process.env)||void 0===re?void 0:re.NODE_ENV)&&(wl=(t,e,n)=>{t||"undefined"==typeof console||console.warn(kl(e,n))},xl=(t,e,n)=>{if(!t)throw new Error(kl(e,n))});const Tl=t=>t,El=t=>1e3*t,Il=t=>t/1e3;const Sl=t=>Array.isArray(t)&&"number"==typeof t[0],Al=(t,e,n=10)=>{let i="";const r=Math.max(Math.round(e/n),2);for(let e=0;e<r;e++)i+=Math.round(1e4*t(e/(r-1)))/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},Nl=2e4;function Ml(t){let e=0;let n=t.next(e);for(;!n.done&&e<Nl;)e+=50,n=t.next(e);return e>=Nl?1/0:e}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:t=Cl.duration,bounce:e=Cl.bounce,velocity:n=Cl.velocity,mass:i=Cl.mass}){let r,o;wl(t<=El(Cl.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let s=1-e;s=bl(Cl.minDamping,Cl.maxDamping,s),t=bl(Cl.minDuration,Cl.maxDuration,Il(t)),s<1?(r=e=>{const i=e*s,r=i*t,o=i-n,a=Dl(e,s),l=Math.exp(-r);return Ol-o/a*l},o=e=>{const i=e*s*t,o=i*n+n,a=Math.pow(s,2)*Math.pow(e,2)*t,l=Math.exp(-i),c=Dl(Math.pow(e,2),s);return(-r(e)+Ol>0?-1:1)*((o-a)*l)/c}):(r=e=>Math.exp(-e*t)*((e-n)*t+1)-Ol,o=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let i=n;for(let n=1;n<Rl;n++)i-=t(i)/e(i);return i}(r,o,5/t);if(t=El(t),isNaN(a))return{stiffness:Cl.stiffness,damping:Cl.damping,duration:t};{const e=Math.pow(a,2)*i;return{stiffness:e,damping:2*s*Math.sqrt(i*e),duration:t}}}const Rl=12;function Dl(t,e){return t*Math.sqrt(1-e*e)}const Ll=["duration","bounce"],Bl=["stiffness","damping","mass"];function zl(t,e){return e.some((e=>void 0!==t[e]))}function Wl(t=Cl.visualDuration,e=Cl.bounce){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;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(t){let e={velocity:Cl.velocity,stiffness:Cl.stiffness,damping:Cl.damping,mass:Cl.mass,isResolvedFromDuration:!1,...t};if(!zl(t,Bl)&&zl(t,Ll))if(t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(1.2*n),r=i*i,o=2*bl(.05,1,1-(t.bounce||0))*Math.sqrt(r);e={...e,mass:Cl.mass,stiffness:r,damping:o}}else{const n=Pl(t);e={...e,...n,mass:Cl.mass},e.isResolvedFromDuration=!0}return e}({...n,velocity:-Il(n.velocity||0)}),p=h||0,m=c/(2*Math.sqrt(l*u)),v=s-o,g=Il(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 t=Dl(g,m);b=e=>{const n=Math.exp(-m*g*e);return s-n*((p+m*g*v)/t*Math.sin(t*e)+v*Math.cos(t*e))}}else if(1===m)b=t=>s-Math.exp(-g*t)*(v+(p+g*v)*t);else{const t=g*Math.sqrt(m*m-1);b=e=>{const n=Math.exp(-m*g*e),i=Math.min(t*e,300);return s-n*((p+m*g*v)*Math.sinh(i)+t*v*Math.cosh(i))/t}}const k={calculatedDuration:f&&d||null,next:t=>{const e=b(t);if(f)a.done=t>=d;else{let n=0===t?p:0;m<1&&(n=0===t?El(p):function(t,e,n){const i=Math.max(e-Fl,0);return r=n-t(i),(o=e-i)?r*(1e3/o):0;var r,o}(b,t,e));const o=Math.abs(n)<=i,l=Math.abs(s-e)<=r;a.done=o&&l}return a.value=a.done?s:e,a},toString:()=>{const t=Math.min(Ml(k),Nl),e=Al((e=>k.next(t*e).value),t,30);return t+"ms "+e},toTransition:()=>{}};return k}Wl.applyToOptions=t=>{const e=function(t,e=100,n){const i=n({...t,keyframes:[0,e]}),r=Math.min(Ml(i),Nl);return{type:"keyframes",ease:t=>i.next(r*t).value/e,duration:Il(r)}}(t,100,Wl);return t.ease=e.ease,t.duration=El(e.duration),t.type="keyframes",t};const $l=t=>null!==t;class jl{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise((t=>{this.resolve=t}))}notifyFinished(){this.resolve()}then(t,e){return this.finished.then(t,e)}}function Ul(t){for(let n=1;n<t.length;n++){var e;null!==(e=t[n])&&void 0!==e||(t[n]=t[n-1])}}const ql=t=>t.startsWith("--");const Vl=_l((()=>void 0!==window.ScrollTimeline)),Gl={};function Hl(t,e){const n=_l(t);return()=>{var t;return null!==(t=Gl[e])&&void 0!==t?t:n()}}const Kl=Hl((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing"),Xl=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${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(t,e){return t?"function"==typeof t?Kl()?Al(t,e):"ease-out":Sl(t)?Xl(t):Array.isArray(t)?t.map((t=>Ql(t,e)||Yl.easeOut)):Yl[t]:void 0}function Jl(t,e,n,{delay:i=0,duration:r=300,repeat:o=0,repeatType:s="loop",ease:a="easeOut",times:l}={},c=void 0){const u={[e]: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 t.animate(u,h)}class Zl extends jl{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:e,name:n,keyframes:i,pseudoElement:r,allowFlatten:o=!1,finalKeyframe:s,onComplete:a}=t;this.isPseudoElement=Boolean(r),this.allowFlatten=o,this.options=t,xl("string"!=typeof t.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:t,...e}){return function(t){return"function"==typeof t&&"applyToOptions"in t}(t)&&Kl()?t.applyToOptions(e):(null!==(n=e.duration)&&void 0!==n||(e.duration=300),null!==(i=e.ease)&&void 0!==i||(e.ease="easeOut"),e);var n,i}(t);this.animation=Jl(e,n,i,l,r),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!r){const t=function(t,{repeat:e,repeatType:n="loop"},i,r=1){const o=t.filter($l),s=r<0||e&&"loop"!==n&&e%2==1?0:o.length-1;return s&&void 0!==i?i:o[s]}(i,this.options,s,this.speed);this.updateMotionValue?this.updateMotionValue(t):function(t,e,n){ql(e)?t.style.setProperty(e,n):t.style[e]=n}(e,n,t),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 t,e;null===(t=(e=this.animation).finish)||void 0===t||t.call(e)}cancel(){try{this.animation.cancel()}catch(t){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;"idle"!==t&&"finished"!==t&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var t,e;this.isPseudoElement||(null===(t=(e=this.animation).commitStyles)||void 0===t||t.call(e))}get duration(){var t,e;const n=(null===(t=this.animation.effect)||void 0===t||null===(e=t.getComputedTiming)||void 0===e?void 0:e.call(t).duration)||0;return Il(Number(n))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Il(t)}get time(){return Il(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=El(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){var t;return null!==(t=this.manualStartTime)&&void 0!==t?t:Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,observe:e}){var n;this.allowFlatten&&(null===(n=this.animation.effect)||void 0===n||n.updateTiming({easing:"linear"}));return this.animation.onfinish=null,t&&Vl()?(this.animation.timeline=t,Tl):e(this)}}class tc{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map((t=>t.finished)))}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t){const e=this.animations.map((e=>e.attachTimeline(t)));return()=>{e.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return ec(this.animations,"duration")}get iterationDuration(){return ec(this.animations,"iterationDuration")}runAll(t){this.animations.forEach((e=>e[t]()))}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function ec(t,e){let n=0;for(let i=0;i<t.length;i++){const r=t[i][e];null!==r&&r>n&&(n=r)}return n}class nc extends tc{then(t,e){return this.finished.finally(t).then((()=>{}))}}const ic=new WeakMap,rc=(t,e="")=>`${t}:${e}`;function oc(t){const e=ic.get(t)||new Map;return ic.set(t,e),e}function sc(t,e){var n,i;return null!==(n=null!==(i=null==t?void 0:t[e])&&void 0!==i?i:null==t?void 0:t.default)&&void 0!==n?n:t}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(t,e){for(let n=0;n<t.length;n++)"number"==typeof t[n]&&ac.has(e)&&(t[n]=t[n]+"px")}function cc(t,e){const n=window.getComputedStyle(t);return ql(e)?n.getPropertyValue(e):n[e]}function uc(t,e,n,i){if(null==t)return[];const r=function(t){if(null==t)return[];if(t instanceof EventTarget)return[t];if("string"==typeof t){const e=document.querySelectorAll(t);return e?Array.from(e):[]}return Array.from(t).filter((t=>null!=t))}(t),o=r.length;xl(Boolean(o),"No valid elements provided.","no-valid-elements");const s=[];for(let t=0;t<o;t++){const i=r[t],a={...n};"function"==typeof a.delay&&(a.delay=a.delay(t,o));for(const t in e){let n=e[t];Array.isArray(n)||(n=[n]);const r={...sc(a,t)};r.duration&&(r.duration=El(r.duration)),r.delay&&(r.delay=El(r.delay));const o=oc(i),l=rc(t,r.pseudoElement||""),c=o.get(l);c&&c.stop(),s.push({map:o,key:l,unresolvedKeyframes:n,options:{...r,element:i,name:t,allowFlatten:!a.type&&!a.ease}})}}for(let t=0;t<s.length;t++){const{unresolvedKeyframes:e,options:n}=s[t],{element:i,name:r,pseudoElement:o}=n;o||null!==e[0]||(e[0]=cc(i,r)),Ul(e),lc(e,r),!o&&e.length<2&&e.unshift(cc(i,r)),n.keyframes=e}const a=[];for(let t=0;t<s.length;t++){const{map:e,key:n,options:i}=s[t],r=new Zl(i);e.set(n,r),r.finished.finally((()=>e.delete(n))),a.push(r)}return a}const dc=(()=>function(t,e,n){return new nc(uc(t,e,n))})();var hc=Hs('<button class="svelte-16kucsb"><div class="svelte-16kucsb"> </div></button>'),fc=Hs('<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(t,e){Di(e,!0),ba(t,pc);const n=no((()=>e.state.ctaText)),i=no((()=>e.state.animationConfig)),r=no((()=>e.state.showCta)),o=no((()=>e.state.onCtaClick));let s=null,a=null,l=po(!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})}Go((()=>{const{mass:t,stiffness:e,damping:n,delay:o}=Rs(i);let u;return Rs(r)&&(u=setTimeout((async()=>{vo(l,!0),u=null,dc(s,{transform:["translateY(40px) scale(0, 0.2)","translateY(0) scale(1, 1)"],opacity:1},{type:Wl,mass:t,stiffness:e,damping:n}),await dc(a,{transform:["translateY(20px) scale(0.8)","translateY(0) scale(1)"],opacity:1},{type:Wl,mass:t,stiffness:e,damping:n,delay:.15}),c=!0}),o)),()=>{u&&clearTimeout(u)}}));var f=fc(),p=Ro(f),m=t=>{var e=hc();e.__mousedown=h,e.__touchstart=h,e.__click=function(...t){var e;null===(e=Rs(o))||void 0===e||e.apply(this,t)};var i=Ro(e),r=Ro(i,!0);ki(i),Va(i,(t=>a=t),(()=>a)),ki(e),Va(e,(t=>s=t),(()=>s)),Yo((()=>{Aa(e,"pointer-events: "+(Rs(l)?"auto":"none")),na(r,Rs(n))})),js("mouseenter",e,u),js("mouseleave",e,d),Xs(t,e)};ha(p,(t=>{Rs(r)&&t(m)})),ki(f),Xs(t,f),Li()}Us(["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:t,...e}){var n;super({...e,config:t}),this.Component=hl,this.hasDuration=!t.loop,Ja(this),this.coverAssets.push(null!==(n=t.intro)&&void 0!==n?n:t.video),this.cover=this.coverAssets[0],this.state={textBox:t.textBox}}start(t){super.start(t),this.timeline=t.createTimeline();const e=this.config;e.intro&&this.timeline.placeOnTimeline(nl(`${this.id}_intro`,e.intro,t),"end");const n=nl(this.id,e.video,t);this.timeline.placeOnTimeline(n,"end",{loop:e.loop}),e.loop||n.on("nodeend",this.emitModuleEnd)}},toggleModule:class extends tl{constructor({config:t,...e}){super({...e,config:t}),O(this,gl),this.Component=vl,this.synced=t.sync,this.switchTo=()=>{},Ja(this),this.coverAssets=t.options.map((t=>{var e;return null!==(e=t.intro)&&void 0!==e?e:t.video})),this.cover=this.coverAssets[0],this.state={options:t.options.map((t=>({label:t.label,note:t.note}))),currentOptionIndex:0,onOptionClicked:A(gl,this,yl).bind(this),textBox:t.options[0].textBox}}start(t){super.start(t),this.synced?(this.timeline=t.createTimeline(),this.config.options.forEach(((e,n)=>{this.timeline.placeOnTimeline(nl(`${this.id}_option_${n}`,e.video,t),0,{loop:!0})})),this.timeline.placeRenderNodeOnTimeline("switch",0,1/0,{params:{switchCrossfadeSeconds:.25,initSwitching:({switchTo:t})=>{this.switchTo=t,t(this.state.currentOptionIndex,{crossfadeSeconds:0})}}})):(this.timelines=this.config.options.map(((e,n)=>{const i=t.createTimeline();return e.intro&&i.placeOnTimeline(nl(`${this.id}_option_${n}_intro`,e.intro,t),"end"),i.placeOnTimeline(nl(`${this.id}_option_${n}`,e.video,t),"end",{loop:!0}),i})),this.timeline=this.timelines[this.state.currentOptionIndex])}},tryItModule:class extends tl{constructor({config:t,...e}){var n;super({...e,config:t}),O(this,vc),Ja(this);const{introVideo:i}=t;this.coverAssets.push(null!==(n=i.intro)&&void 0!==n?n:i.loop),this.cover=this.coverAssets[0],this.state={ctaText:t.ctaText,animationConfig:t.animationConfig,showCta:!0,onCtaClick:A(vc,this,gc).bind(this)}}start(t){super.start(t),this.Component=mc,this.timeline=t.createTimeline();const{introVideo:e,mainVideo:n}=this.config;if(e.intro&&this.timeline.placeOnTimeline(nl(`${this.id}_intro_intro`,e.intro,t)),this.timeline.placeOnTimeline(nl(`${this.id}_intro_loop`,e.loop,t),"end",{loop:!0}),n){this.mainTimeline=t.createTimeline(),n.intro&&this.mainTimeline.placeOnTimeline(nl(`${this.id}_main_intro`,n.intro,t));const e=nl(`${this.id}_main_loop`,n.loop,t);this.mainTimeline.placeOnTimeline(e,"end",{loop:!0})}}play(){this.state.showCta=!0,super.play()}}};class bc{#d=Ii(po({}),"GalleryState.#variants");#h=Ii(po("ekonovar"),"GalleryState.#activeVariant");#f=Ii(po(0),"GalleryState.#activeItemIndex");#p=Ii(po(0),"GalleryState.#activeModuleIndex");#m=Ii(po(xo({itemIndex:0,moduleIndex:0})),"GalleryState.#playingModulePosition");#v=Ii(no((()=>{var t;return null===(t=Rs(this.#d))||void 0===t?void 0:t[Rs(this.#h)]})),"GalleryState.#currentItemsList");#g=Ii(no((()=>{var t;return null===(t=Rs(this.#v))||void 0===t?void 0:t[Rs(this.#f)]})),"GalleryState.#currentItem");#y=Ii(no((()=>{var t,e;return Rs(this.#b)?null===(e=Rs(this.#v))||void 0===e?void 0:e[Rs(this.#m).itemIndex].modules[Rs(this.#m).moduleIndex]:null===(t=Rs(this.#g))||void 0===t?void 0:t.modules[Rs(this.#p)]})),"GalleryState.#currentModule");#k=Ii(no((()=>{var t;return(null===(t=Rs(this.#v))||void 0===t?void 0:t.flatMap((t=>t.modules)))||[]})),"GalleryState.#currentModulesList");#w=Ii(po(!1),"GalleryState.#playerLoaded");#x=Ii(po(!1),"GalleryState.#paused");#b=Ii(po(!1),"GalleryState.#startedPlaying");#_=Ii(no((()=>!(Io(Rs(this.#m).itemIndex,this.activeItemIndex)&&Io(Rs(this.#m).moduleIndex,this.activeModuleIndex)))),"GalleryState.#seeking");set variants(t){vo(this.#d,t)}set activeVariant(t){vo(this.#h,t,!0)}set activeItemIndex(t){vo(this.#f,t,!0)}set activeModuleIndex(t){vo(this.#p,t,!0)}set playingModulePosition(t){vo(this.#m,t,!0)}set playerLoaded(t){vo(this.#w,t,!0)}set paused(t){vo(this.#x,t,!0)}set startedPlaying(t){vo(this.#b,t,!0)}get variants(){return Rs(this.#d)}get activeVariant(){return Rs(this.#h)}get activeItemIndex(){return Rs(this.#f)}get activeModuleIndex(){return Rs(this.#p)}get playingModulePosition(){return Rs(this.#m)}get currentItemsList(){return Rs(this.#v)}get currentItem(){return Rs(this.#g)}get currentModule(){return Rs(this.#y)}get playerLoaded(){return Rs(this.#w)}get paused(){return Rs(this.#x)}get startedPlaying(){return Rs(this.#b)}get seeking(){return Rs(this.#_)}get currentModulesList(){return Rs(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 Ec=new WeakMap,Ic=new WeakMap,Sc=new WeakMap,Ac=new WeakMap,Nc=new WeakMap,Mc=new WeakMap,Fc=new WeakSet;class Cc{constructor(t){var e,n,i,r,o;O(this,Fc),F(this,Ec,void 0),F(this,Ic,void 0),F(this,Sc,void 0),F(this,Ac,void 0),F(this,Nc,void 0),F(this,Mc,void 0),P(this,"public",void 0),P(this,"version","0.0.16"),Ja(this),C(Ec,this,(null===(e=crypto)||void 0===e||null===(n=e.randomUUID)||void 0===n?void 0:n.call(e))||`eko-gallery-${Date.now()}`),C(Ac,this,t),C(Mc,this,(null==t?void 0:t.onEvent)||(()=>{})),C(Ic,this,new bc(null==t||null===(i=t.options)||void 0===i?void 0:i.galleryEnv)),C(Nc,this,((t="")=>(Io(t,"production")&&(t=""),Object.fromEntries(Object.entries(kc).map((([e,n])=>[e,n.replaceAll("{{env}}",t)])))))(null==t||null===(r=t.options)||void 0===r?void 0:r.galleryEnv)),C(Sc,this,[]);const s=null==t||null===(o=t.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((t=>Io(t.blockType,"GalleryBlock"))))||void 0===o?void 0:o.config;var a;s?(A(Fc,this,Oc).call(this,s.items),A(Fc,this,Pc).call(this,s.items),function(t,e){function n(e){window.EkoAnalytics("registerContextPacker",{tag:t,...e})}function i(e){return function(...n){return n.pop()!==t?null:e(...n)}}"undefined"!=typeof window&&window.EkoAnalytics&&(n({schema:"iglu:com.helloeko/gallery-app/jsonschema/1-0-0",match:/.*/,getData:i((()=>{var t,n,i,r,o;const s=null===(t=e.currentItem)||void 0===t?void 0:t.modules[e.activeModuleIndex];return{itemid:(null===(n=e.currentItem)||void 0===n?void 0:n.id)||"",itemindex:e.activeItemIndex,totalitems:(null===(i=e.currentItemsList)||void 0===i?void 0:i.length)||0,itemname:(null===(r=e.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:e.activeModuleIndex,totalmodules:(null===(o=e.currentItem)||void 0===o?void 0:o.modules.length)||0,version:"0.0.16"}}))}),n({schema:"iglu:com.helloeko/implementation_interactions/jsonschema/1-0-6",match:"interaction",getData:i((t=>t))}))}(M(Ec,this),M(Ic,this))):console.warn("[eko-gallery-app] Gallery initiated without an instance, results will be empty"),this.public=(a=this,Tc.reduce(((t,e)=>{if(!(e in a))throw new Error(`[eko-gallery-app] Public API member "${e}" does not exist on GalleryLogic`);const n=a[e];return t[e]=Io(typeof n,"function")?n.bind(a):n,t}),{}))}dispose(){var t,e;Io(typeof window,"undefined",!1)&&(null===(t=(e=window).EkoAnalytics)||void 0===t||t.call(e,"reset",M(Ec,this)))}start(t){M(Ic,this).playerLoaded=!0,M(Sc,this).forEach((e=>{e.start(t)})),C(Sc,this,null),A(Fc,this,Rc).call(this,t),M(Ic,this).currentModule.play()}selectItem(t){const e=M(Ic,this);Io(t,e.activeItemIndex)||(e.activeItemIndex=t,e.activeModuleIndex=0)}selectItemAndStep(t,e){const n=M(Ic,this);Io(t,n.activeItemIndex)&&Io(e,n.activeModuleIndex)||(n.activeItemIndex=t,n.activeModuleIndex=e)}next(){A(Fc,this,Lc).call(this)}prev(){const t=M(Ic,this);if(t.activeModuleIndex=t.activeModuleIndex-1,!t.currentItem.modules[t.activeModuleIndex])if(t.currentItemsList[t.activeItemIndex-1]){t.activeItemIndex=t.activeItemIndex-1;const e=t.currentItemsList[t.activeItemIndex];t.activeModuleIndex=e.modules.length-1}else t.activeModuleIndex=t.activeModuleIndex+1}subscribe(t){const e=M(Ic,this);return function(t){fr.ensure();const e=Uo(Bn|Yn,t,!0);return()=>{ns(e)}}((()=>{Go((()=>{const n=_c.reduce(((t,n)=>(t[n]=e[n],t)),{});t(n)}))}))}getCoverUrl(t,e){var n,i,r,o;const s=(null==t||null===(n=t.entity)||void 0===n?void 0:n.entityId)||(null==t?void 0:t.assetId),a=null!==(i=null==t||null===(r=t.entity)||void 0===r?void 0:r.entityRevision)&&void 0!==i?i:null==t?void 0:t.assetRevision;if(!s)throw new Error(`[getCoverUrl] No assetId found in assetConfig: ${JSON.stringify(t||{},null,2)}`);if(!a&&Io(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)&&e&&(l.pathname=l.pathname.replace(".png",".webp"))):(l=new URL(`${M(Nc,this).assetsDeliveryBase}/image/${s}/${a}?startOffset=0`),l.pathname+=e?".webp":".png"),e&&l.searchParams.set("width",e),l.href}track(t,...e){var n,i;Io(typeof window,"undefined",!1)&&(null===(n=(i=window).EkoAnalytics)||void 0===n||n.call(i,"track",t,...e,M(Ec,this)))}interaction(t,e){const n=M(Ec,this);return i=>{if(Io(typeof window,"undefined",!1)){var r,o,s,a;const t=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&&(Io(i.detail.direction,"left")?l="swipe_next":Io(i.detail.direction,"right")&&(l="swipe_prev"));const c={elementid:(null==t?void 0:t.elementid)||(null==e?void 0:e.elementid)||"",elementtype:(null==t?void 0:t.elementtype)||(null==e?void 0:e.elementtype)||"",elementname:(null==t?void 0:t.elementname)||(null==e?void 0:e.elementname)||"",interactiontype:l||(null==t?void 0:t.interactiontype)||(null==e?void 0:e.interactiontype)||""};null===(s=(a=window).EkoAnalytics)||void 0===s||s.call(a,"track","interaction",c,n),M(Mc,this).call(this,"interaction",c)}t(i)}}get uuid(){return M(Ec,this)}get state(){return M(Ic,this)}get urls(){return M(Nc,this)}}function Oc(t){const e={};for(let n of t)for(let t of Object.keys(n.variants||{}))e[t]=[];e.ekonovar=[],M(Ic,this).variants=e}function Pc(t){const e=(t=[],e)=>{const n=[];for(let[i,r]of t.entries()){if(!yc[r.itemType])throw new Error(`Unknown module type ${r.itemType}`);const t=new yc[r.itemType]({position:{...e,moduleIndex:i},config:r,gallery:this});t.moduleEndListener=A(Fc,this,Dc).bind(this),n.push(t)}return n};for(const[i,r]of t.entries())if(Io(r.itemType,"galleryItemV2")){const{modules:t,...o}=r;for(const[s,a]of Object.entries(M(Ic,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=e(t,{variantId:s,itemIndex:i}),C(Sc,this,[...M(Sc,this),...n.modules]),a.push(n)}}}}function Rc(t){for(const[,e]of Object.entries(M(Ic,this).variants))for(const[n,i]of e.entries()){const r=i.modules,o=e.filter((t=>Io(t,i,!1))).map((t=>t.modules[0]));for(const[i,s]of r.entries()){let a=r[i+1];a||(a=e[(n+1)%e.length].modules[0]);const l=a.timeline.getNodesAtTime(0)[0],c=o.filter((t=>Io(t,a,!1))).map((t=>t.timeline.getNodesAtTime(0)[0])),u=[{nodeId:l.id,weight:wc},...c.map((t=>({nodeId:t.id,weight:xc})))];for(const e of s.timeline.placements){t.getNode(e.nodeId).setChildren(u)}}}}function Dc(){const t=M(Ic,this),e=t.currentItem.modules;e.length>1&&Io(t.activeModuleIndex,e.length-1)?t.activeModuleIndex=0:A(Fc,this,Lc).call(this)}function Lc(){const t=M(Ic,this);t.activeModuleIndex=t.activeModuleIndex+1,t.currentItem.modules[t.activeModuleIndex]||(t.currentItemsList[t.activeItemIndex+1]?(t.activeItemIndex=t.activeItemIndex+1,t.activeModuleIndex=0):t.activeModuleIndex=t.activeModuleIndex-1)}var Bc=Hs('<button><span class="svelte-er27y2"> </span></button>'),zc=Hs('<div class="nav-buttons-container svelte-er27y2"><div class="nav-buttons svelte-er27y2"></div></div>');const Wc={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);}"};Us(["click"]);const $c="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 jc=Hs('<button><img class="svelte-1al44kl"/></button>');const Uc={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 qc(t,e){ba(t,Uc);const n=Ha(e,"hidden",3,!1);var i=jc();let r;i.__click=function(...t){var n;null===(n=e.onClick)||void 0===n||n.apply(this,t)};var o=Ro(i);ki(i),Yo((()=>{var t;r=Ia(i,1,`nav-button ${null!==(t=e.type)&&void 0!==t?t:""}`,"svelte-1al44kl",r,{hidden:n()}),La(i,"aria-label",e.type),La(o,"src",$c),La(o,"alt",e.type)})),Xs(t,i)}Us(["click"]);var Vc=Hs('<button data-elementtype="step-indicator" data-interactiontype="navigation"><span class="svelte-1mxltt0"> </span></button>'),Gc=Hs('<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 Hc={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 Kc(t,e){Di(e,!0),ba(t,Hc);const n=16,i=32;let r=Ha(e,"gallery",7),o=po(null),s=po(null),a=po(!1),l=po(!1);const c=no((()=>{let t=[];return t=r().state.currentItem.modules.map(((t,e)=>({index:e,type:e===r().state.activeModuleIndex?"active":"",name:t.name}))),t}));function u(){Rs(o)&&(vo(a,Rs(o).scrollLeft>0),vo(l,Rs(o).scrollLeft+Rs(o).clientWidth<Rs(o).scrollWidth-0))}function d(t){Rs(o).scrollBy({left:t,behavior:"smooth"})}function h(t,e){const r=t.getBoundingClientRect(),o=e.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 t=Array.from(Rs(o).querySelectorAll(".step-button")).find((t=>{const e=t.getBoundingClientRect(),n=Rs(o).getBoundingClientRect();return e.left>n.left+i}));if(t){const e=t.previousElementSibling;e&&h(Rs(o),e)}}function p(){const t=Array.from(Rs(o).querySelectorAll(".step-button")).reverse().find((t=>{const e=t.getBoundingClientRect(),n=Rs(o).getBoundingClientRect();return e.right<n.right-i}));if(t){const e=t.nextElementSibling;e&&h(Rs(o),e)}}Go((()=>{if(Rs(o)){u();const t=Rs(o).querySelector(".step-button.active");t&&vo(s,t,!0);const e=new MutationObserver((()=>{const t=Rs(o).querySelector(".step-button.active");t&&vo(s,t,!0)}));e.observe(Rs(o),{attributes:!0,attributeFilter:["class"],subtree:!0});const n=new ResizeObserver((()=>{u()}));return n.observe(Rs(o)),()=>{e.disconnect(),n.disconnect()}}})),Go((()=>{Rs(c),Rs(o)&&Ps().then(u)})),Go((()=>{Rs(s)&&Rs(o)&&h(Rs(o),Rs(s))}));var m=Ks();js("resize",So,u),function(t,e,n){vi&&bi();var i=new ca(t);Qo((()=>{var t=e();i.ensure(t,n)}))}(Do(m),(()=>r().state.activeItemIndex),(t=>{var e=Gc(),n=Ro(e);let i;n.__click=f;var s=Lo(n,2);let d;ma(s,21,(()=>Rs(c)),fa,((t,e)=>{var n=Vc();let i;var s=no((()=>r().interaction((t=>{return n=t.currentTarget,i=Rs(e).index,r().state.activeModuleIndex=i,void h(Rs(o),n);var n,i}))));n.__click=function(...t){var e;null===(e=Rs(s))||void 0===e||e.apply(this,t)};var a=Ro(n),l=Ro(a,!0);ki(a),ki(n),Yo((()=>{i=Ia(n,1,"step-button svelte-1mxltt0",null,i,{active:"active"===Rs(e).type}),La(n,"aria-label",`Go to step $${Rs(e).index+1}`),La(n,"data-elementid",`${Rs(e).index+1}`),La(n,"data-elementname",Rs(e).name),na(l,Rs(e).name)})),Xs(t,n)})),ki(s),Va(s,(t=>vo(o,t)),(()=>Rs(o)));var m=Lo(s,2);let v;m.__click=p,ki(e),Yo((()=>{var t;i=Ia(n,1,"step-arrow step-arrow-prev svelte-1mxltt0",null,i,{visible:Rs(a)}),d=Ia(s,1,"steps-indicator svelte-1mxltt0",null,d,{"with-duration":r().state.currentModule.hasDuration,paused:r().state.paused,"fade-left":Rs(a),"fade-right":Rs(l)}),Aa(s,`--stepDuration: ${null!==(t=r().state.currentModule.duration)&&void 0!==t?t:""}s`),v=Ia(m,1,"step-arrow step-arrow-next svelte-1mxltt0",null,v,{visible:Rs(l)})})),js("scroll",s,u),Xs(t,e)})),Xs(t,m),Li()}Us(["click"]);const 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='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",Yc="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 Qc=Hs('<img alt="Play" class="svelte-a3r6re"/>'),Jc=Hs('<img alt="Pause" class="svelte-a3r6re"/>'),Zc=Hs('<button class="pause-button svelte-a3r6re" data-elementid="play_pause" data-elementtype="button"><!></button>');const tu={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;}"};Us(["click"]);const eu=300,nu=60,iu="none";function ru(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}function ou(t,e,n){const{x:i,y:r}=function(t,e){const n=t.getBoundingClientRect();return{x:Math.round(e.clientX-n.left),y:Math.round(e.clientY-n.top)}}(t,e);return{event:e,pointersCount:n.length,target:e.target,x:i,y:r,attachmentNode:t}}function su(t,e,n,i,r){const o=ou(t,n,i);return t.dispatchEvent(new CustomEvent(`${e}${r}`,{detail:o})),o}function au(){let t=[],e=()=>{},n=[];return{setPointerControls:(i,r,o,s,a,l=iu,c=[])=>{var u;if(r.style.touchAction=(u=l,Array.isArray(u)?u:[u]).join(" "),n=c,n.forEach((e=>{var n;null===(n=e.onInit)||void 0===n||n.call(e,t)})),!t.length){let l=function(e){t.push(e);const l=su(r,i,e,t,"down");function c(e){const o=t.length;t=function(t,e){return e.filter((e=>Io(t.pointerId,e.pointerId,!1)))}(e,t);if(o>t.length){t.length||(u(),d(),h(),f());const o=su(r,i,e,t,"up");null==a||a(t,e),setTimeout((()=>{n.forEach((e=>{var n;null===(n=e.onUp)||void 0===n||n.call(e,o,t)}))}))}}null==s||s(t,e),setTimeout((()=>{n.forEach((e=>{var n;null===(n=e.onDown)||void 0===n||n.call(e,l,t)}))}));const u=ru(r,"pointermove",(e=>{t=t.map((t=>Io(e.pointerId,t.pointerId)?e:t));const s=su(r,i,e,t,"move");null==o||o(t,e),n.forEach((e=>{var n;null===(n=e.onMove)||void 0===n||n.call(e,s,t)}))})),d=ru(r,"lostpointercapture",(t=>{c(t)})),h=ru(r,"pointerup",(t=>{c(t)})),f=ru(r,"pointerleave",(t=>{c(t)}))};e=ru(r,"pointerdown",l)}return{destroy:()=>{t.length||(e(),n.forEach((t=>{var e;null===(e=t.onDestroy)||void 0===e||e.call(t)})))}}}}}const lu="@attach";function cu(){return Symbol(lu)}const uu="swipe";function du(t,e,n,i=!1){const{setPointerControls:r}=au(),o=i?uu:cu();return{...n,[`on${uu}`]:t,[o]:t=>{const{onDown:n,onUp:i,parameters:o}=function(t,e){const n={timeframe:eu,minSwipeDistance:nu,touchAction:iu,composed:!1,...e};let i,r,o,s;function a(t,e){r=e.clientX,o=e.clientY,i=Date.now(),Io(t.length,1)&&(s=e.target)}function l(e,a){if(Io(a.type,"pointerup")&&Io(e.length,0)&&Date.now()-i<n.timeframe){const e=a.clientX-r,i=a.clientY-o,l=Math.abs(e),c=Math.abs(i);let u=null;l>=2*c&&l>n.minSwipeDistance?u=e>0?"right":"left":c>=2*l&&c>n.minSwipeDistance&&(u=i>0?"bottom":"top"),u&&t.dispatchEvent(new CustomEvent(uu,{detail:{direction:u,target:s,pointerType:a.pointerType}}))}}return{onDown:a,onUp:l,parameters:n}}(t,null==e?void 0:e());return r(uu,t,null,n,i,o.touchAction,o.plugins).destroy}}}const hu="tap";function fu(t,e,n,i=!1){const{setPointerControls:r}=au(),o=i?hu:cu();return{...n,[`on${hu}`]:t,[o]:t=>{const{onDown:n,onUp:i,parameters:o}=function(t,e){const n={timeframe:eu,composed:!1,touchAction:"auto",...e};let i,r,o;function s(e,s){if(Math.abs(s.clientX-r)<4&&Math.abs(s.clientY-o)<4&&Date.now()-i<n.timeframe){const e=t.getBoundingClientRect(),n=Math.round(s.clientX-e.left),i=Math.round(s.clientY-e.top);t.dispatchEvent(new CustomEvent(hu,{detail:{x:n,y:i,target:s.target,pointerType:s.pointerType}}))}}function a(t,e){r=e.clientX,o=e.clientY,i=Date.now()}return{onDown:a,onUp:s,parameters:n}}(t,null==e?void 0:e());return r(hu,t,null,n,i,o.touchAction,o.plugins).destroy}}}const pu=t=>{const e="#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 e=t.fadeTime,n=Date.now(),i=n-c;i>e/20&&(a&&o&&s&&r&&(s.drawImage(r,0,0),a.clearRect(0,0,r.width,r.height),a.globalAlpha=1-3*i/e,a.drawImage(o,0,0),a.globalAlpha=1,s.clearRect(0,0,r.width,r.height)),c=n),l&&requestAnimationFrame(d)}function h(t){u.x=t.x,u.y=t.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(e){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=t.zIndex)&&void 0!==i?i:n};\n`,window.document.body.appendChild(r),window.addEventListener("resize",f),e&&h(e.event),o=document.createElement("canvas"),f(),s=o.getContext("2d"),l=!0,d()}function m(){var t;l=!1,null===(t=window.document.getElementById("svelte-gestures-highlight-plugin"))||void 0===t||t.remove(),window.removeEventListener("resize",f)}return{onMove:n=>{var r,o,s;r=n.event,a&&(a.beginPath(),a.lineWidth=null!==(o=t.lineWidth)&&void 0!==o?o:i,a.lineCap="round",a.strokeStyle=null!==(s=t.color)&&void 0!==s?s:e,Io(u.x,void 0,!1)&&Io(u.y,void 0,!1)?(a.moveTo(u.x,u.y),h(r),a.lineTo(u.x,u.y)):h(r),a.stroke())},onDown:t=>{p(t)},onUp:(t,e)=>{Io(e.length,0)&&m()},onDestroy:m,onInit:t=>{t.length&&(u.x=void 0,u.y=void 0,p())}}};var mu=Hs("<div></div>"),vu=Hs("<div></div>");const gu={hash:"svelte-1fv6njc",code:".swiper.svelte-1fv6njc {position:absolute;top:0;left:0;pointer-events:auto;width:100%;height:100%;}"};var yu=Hs("<img/>"),bu=Hs('<div class="ui-container svelte-1rvgxfc"><!></div>'),ku=Hs('<div class="cover-container svelte-1rvgxfc"><!> <!> <!></div>'),wu=Hs('<div class="covers-container svelte-1rvgxfc" style="scroll-behavior: auto;"></div>');const xu={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 _u(t,e){Di(e,!0),ba(t,xu);const n=[375,768,1024,1400,1920];let i,r=Ha(e,"scrollOffset",15),o=Ha(e,"isMobile",3,!1),s=Ha(e,"gallery",7),a=no((()=>s().state.playingModulePosition)),l=null,c=null,u=no((()=>s().state.startedPlaying)),d=no((()=>s().state.currentModulesList)),h=no((()=>Rs(d).findIndex((t=>p(s().state.playingModulePosition,t.position))))),f=!1;function p(t,e){return t.itemIndex===e.itemIndex&&t.moduleIndex===e.moduleIndex}function m(t){const e=t.scrollLeft,n=t.scrollWidth-t.clientWidth;return 0===e?0:e>n?100:e/n*100}function v(t){var e;o()&&t.preventDefault();const{target:n}=t,u=m(n),f=(null===(e=Rs(d))||void 0===e?void 0:e.length)||1,v=100/(f-1||1),g=Math.round(u/v);let y=Math.min(g,f-1);const b=Rs(d)[y],k={itemIndex:s().state.activeItemIndex,moduleIndex:s().state.activeModuleIndex};if(!l){const t=i.children[Rs(h)],e=i.getBoundingClientRect(),n=t.getBoundingClientRect();r(n.x-e.x)}c&&clearTimeout(c),c=setTimeout((()=>{const t=m(n);Math.abs(t-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=Rs(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),vo(a,b.position)}function g(){f||(s().track("coverdisplay"),f=!0)}Go((()=>{const{activeItemIndex:t,activeModuleIndex:e}=s().state;t===Rs(a).itemIndex&&e===Rs(a).moduleIndex||Bs((()=>{var n,r;const o=Rs(d).findIndex((n=>{const{itemIndex:i,moduleIndex:r}=n.position;return t===i&&e===r}));l=(null===(n=Rs(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"})}))})),Go((()=>{Rs(u)&&Bs((()=>{s().track("projectstartedplaying")}))}));var y=Ks(),b=Do(y),k=t=>{var r=wu();ma(r,23,(()=>Rs(d)),(t=>t.id),((t,i,r)=>{var a=ku(),l=Ro(a),c=t=>{var e=yu();let o;Yo((t=>{o=Ia(e,1,"cover-image svelte-1rvgxfc",null,o,{hidden:Rs(u)&&Rs(r)===Rs(h),"force-show":Rs(i).showCover}),La(e,"src",t),La(e,"alt",Rs(i).name),La(e,"fetchpriority",0===Rs(r)?"high":"auto")}),[()=>s().getCoverUrl(Rs(i).cover,n[n.length-1])]),js("load",e,(function(...t){var e;null===(e=0===Rs(r)?g:()=>{})||void 0===e||e.apply(this,t)})),function(t){if(!vi)return;t.removeAttribute("onload"),t.removeAttribute("onerror");const e=t.__e;void 0!==e&&(t.__e=void 0,queueMicrotask((()=>{t.isConnected&&t.dispatchEvent(e)})))}(e),Xs(t,e)};ha(l,(t=>{t(c)}));var d=Lo(l,2);!function(t,e){Di(e,!0),ba(t,gu);const n={color:"#e3e3e3",fadeTime:300,lineWidth:8},i=du(e.gallery.interaction((t=>{const{direction:n}=t.detail;var i;if("left"===n)null===(i=e.gallery)||void 0===i||i.next(),e.onEvent("swipe",[-1,0]);else if("right"===n){var r;null===(r=e.gallery)||void 0===r||r.prev(),e.onEvent("swipe",[1,0])}}),{elementid:"swiper"}),(()=>({touchAction:"pan-y",plugins:e.debug?[pu(n)]:[]}))),r=fu((function(t){const{x:n,y:i}=t.detail;e.onEvent("click",{x:n,y:i})}),(()=>({touchAction:"pan-y"})));var o=Ks(),s=Do(o),a=t=>{var e=mu();Ba(e,(()=>({...i,...r,class:"swiper"})),void 0,void 0,void 0,"svelte-1fv6njc"),Xs(t,e)},l=t=>{var e=vu();Ba(e,(()=>({...r,class:"swiper"})),void 0,void 0,void 0,"svelte-1fv6njc"),Xs(t,e)};ha(s,(t=>{e.isMobile?t(a):t(l,!1)})),Xs(t,o),Li()}(d,{get gallery(){return s()},get debug(){return e.debug},get isMobile(){return o()},get onEvent(){return e.onEvent}});var f=Lo(d,2),p=t=>{var e=bu();!function(t,e,n){vi&&bi();var i=new ca(t);Qo((()=>{var t,r=null!==(t=e())&&void 0!==t?t:null;i.ensure(r,r&&(t=>n(t,r)))}),Hn)}(Ro(e),(()=>Rs(i).Component),((t,e)=>{e(t,{get state(){return Rs(i).state},get gallery(){return s()},get isMobile(){return o()}})})),ki(e),Xs(t,e)};ha(f,(t=>{var e;null!==(e=Rs(i))&&void 0!==e&&e.Component&&t(p)})),ki(a),Xs(t,a)})),ki(r),Va(r,(t=>i=t),(()=>i)),js("scroll",r,v),Xs(t,r)};ha(b,(t=>{Rs(d)&&t(k)})),Xs(t,y),Li()}const Tu="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};let Eu;function Iu(){const t=Tu&&Tu.navigator&&(Tu.navigator.userAgent||Tu.navigator.platform||Tu.navigator.vendor)||"";if(Eu&&Eu.ua===t)return Eu;const e=t.toLowerCase(),n=e.includes("android"),i=e.includes("iphone")||e.includes("ipad")||e.includes("ipod")||e.includes("ios"),r=n||i||e.includes("mobile");return Eu={ua:t,isMobile:r},Eu}var Su,Au;"undefined"!=typeof window&&(window.addEventListener("pageshow",(function(t){t.persisted&&setTimeout((function(){window.location.reload()}),10)}),!1),null===(Su=(Au=window).EkoAnalytics)||void 0===Su||Su.call(Au,"track","init"));var Nu=Hs('<div class="paging-buttons svelte-1n46o8q"><!> <!></div>'),Mu=Hs('<div style="position: absolute; top: 0; left: 0; width: 100%;"></div>'),Fu=Hs("<!> <!>",1),Cu=Hs('<div class="player-container svelte-1n46o8q"><div class="player-div swipable svelte-1n46o8q"></div> <!> <!> <!> <!></div> <!>',1),Ou=Hs('<div class="eko-gallery-app svelte-1n46o8q"><!></div>');const Pu={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 Ru(t,e){Di(e,!0),ba(t,Pu);const n=Ha(e,"config",19,(()=>({}))),i=Ha(e,"forceMobile",3,!1),r=Ha(e,"videoAspectRatio",3,"unset"),o=Ha(e,"onGalleryReady",3,(()=>{})),s=Ha(e,"onEvent",3,(()=>{}));let a,l=!1,c=po(new Cc({...n(),onEvent:s()})),u=po(null),d=no((()=>i()||Iu().isMobile)),h=po(0),f=po(void 0),p=po(!0),m=po(xo({width:"100%",height:"100%"}));var v,g,y;function b(){const t={AssetsDeliveryService:{assetsDeliveryServiceUrl:Rs(c).urls.assetsDeliveryBase},Tracker:{tag:Rs(c).uuid}};vo(u,new e.EkoPlayer(a,function(t,...e){function n(t){return"[object Object]"===Object.prototype.toString.call(t)}function i(t,e){if(Array.isArray(e)){Array.isArray(t)||(t=Array.isArray(t)?t.slice():[]);const r=Math.max(t.length,e.length);for(let o=0;o<r;o++){const r=t[o],s=e[o];null!=s&&(n(r)&&n(s)?t[o]=i({...r},s):Array.isArray(r)&&Array.isArray(s)?t[o]=i(r.slice(),s):n(s)?t[o]=i({},s):Array.isArray(s)?t[o]=i([],s):t[o]=s)}return t}if(n(e)){n(t)||(t={});for(const r of Object.keys(e)){const o=t[r],s=e[r];n(o)&&n(s)?t[r]=i({...o},s):Array.isArray(o)&&Array.isArray(s)?t[r]=i(o.slice(),s):n(s)?t[r]=i({},s):Array.isArray(s)?t[r]=i([],s):void 0!==s&&(t[r]=s)}return t}return e}for(const n of e)null!==n&&i(t,n);return t}({},e.playerOptions,t))),Rs(u).on("playing",(()=>{Rs(c).state.paused=!1})),Rs(u).on("pause",(()=>{Rs(c).state.paused=!0})),Rs(u).once("playing",(()=>{Rs(c).state.startedPlaying=!0,s()("galleryloaded")}))}function k(t){var e;null===(e=Rs(c))||void 0===e||e.selectItem(t)}function w(){var t;null===(t=Rs(c))||void 0===t||t.next()}function x(){var t;null===(t=Rs(c))||void 0===t||t.prev()}function _(){Rs(u).paused?Rs(u).play():Rs(u).pause()}function T(){return`--uiTranformX: ${Rs(h)}px;--videoAspect: ${r()};--videoWidth: ${Rs(m).width};--videoHeight: ${Rs(m).height};`}v="state",g=()=>Rs(c).state,Bi("setContext").set(v,g),y=()=>(o()(Rs(c).public),n()&&e.EkoPlayer&&(b(),Rs(c).start(Rs(u))),()=>{var t;null===(t=Rs(u))||void 0===t||t.dispose(),Rs(c).dispose()}),null===Ni&&ui("onMount"),Go((()=>{const t=Bs(y);if("function"==typeof t)return t})),Go((()=>{n()&&e.EkoPlayer&&(l?Bs((()=>{var t;Rs(c).dispose(),vo(c,new Cc({...n(),onEvent:s()})),null===(t=Rs(u))||void 0===t||t.dispose(),vo(p,!1),Ps().then((()=>(vo(p,!0),Ps()))).then((()=>{o()(Rs(c).public),b(),Rs(c).start(Rs(u))}))})):l=!0)})),Go((()=>{Rs(f)&&Rs(u)&&Rs(u).loadDebugOverlay({containerElement:Rs(f)})})),Go((()=>{if("unset"!==r()&&r().includes("/")){const[t,e]=r().split("/").map((t=>Number(t)));isNaN(t)||isNaN(e)||vo(m,t>e?{width:"100%",height:"auto"}:{width:"auto",height:"100%"},!0)}else vo(m,{width:"100%",height:"100%"},!0)}));var E=Ou(),I=Ro(E),S=t=>{var n=Cu(),i=Do(n),r=Ro(i);Va(r,(t=>a=t),(()=>a));var o=Lo(r,2);_u(o,{get isMobile(){return Rs(d)},get gallery(){return Rs(c)},get debug(){return e.debug},get onEvent(){return s()},get scrollOffset(){return Rs(h)},set scrollOffset(t){vo(h,t,!0)}});var l=Lo(o,2),u=t=>{var e=Nu(),n=Ro(e);qc(n,{type:"prev",onClick:x}),qc(Lo(n,2),{type:"next",onClick:w}),ki(e),Xs(t,e)};ha(l,(t=>{Rs(d)||e.hideNav||t(u)}));var p=Lo(l,2),m=t=>{Kc(t,{get gallery(){return Rs(c)}})};ha(p,(t=>{var e;!Rs(d)&&(null===(e=Rs(c).state.currentItem)||void 0===e?void 0:e.modules.length)>1&&t(m)}));var v=Lo(p,2),g=t=>{var n=Fu(),i=Do(n);!function(t,e){Di(e,!0),ba(t,tu);const n=Ri("state");let i=no((()=>n().paused));var r=Zc(),o=no((()=>e.gallery.interaction(e.onPauseClick)));r.__click=function(...t){var e;null===(e=Rs(o))||void 0===e||e.apply(this,t)};var s=Ro(r),a=t=>{var e=Qc();Yo((()=>La(e,"src",Xc))),Xs(t,e)},l=t=>{var e=Jc();Yo((()=>La(e,"src",Yc))),Xs(t,e)};ha(s,(t=>{n().paused?t(a):t(l,!1)})),ki(r),Yo((()=>{La(r,"aria-label",Rs(i)?"Play":"Pause"),La(r,"data-interactiontype",Rs(i)?"play":"pause")})),Xs(t,r),Li()}(i,{onPauseClick:_,get gallery(){return Rs(c)}});var r=Lo(i,2),o=t=>{var e=Mu();Va(e,(t=>vo(f,t)),(()=>Rs(f))),Xs(t,e)};ha(r,(t=>{e.debug&&t(o)})),Xs(t,n)};ha(v,(t=>{Rs(c).state.startedPlaying&&t(g)})),ki(i);var y=Lo(i,2),b=t=>{!function(t,e){Di(e,!0),ba(t,Wc);let n=Ha(e,"onNavItemClick",3,(()=>{}));const i=Ri("state");var r=zc(),o=Ro(r);ma(o,23,(()=>i().currentItemsList),(t=>t.id),((t,e,r)=>{var o=Bc();let s;o.__click=()=>n()(Rs(r));var a=Ro(o),l=Ro(a,!0);ki(a),ki(o),Yo((t=>{s=Ia(o,1,"nav-button svelte-er27y2",null,s,t),na(l,Rs(e).name)}),[()=>({selected:Rs(r)===i().activeItemIndex})]),Xs(t,o)})),ki(o),ki(r),Xs(t,r),Li()}(t,{onNavItemClick:k})};ha(y,(t=>{e.hideNav||t(b)})),Yo((t=>Aa(i,t)),[T]),Xs(t,n)};ha(I,(t=>{n()&&Rs(p)&&t(S)})),ki(E),Xs(t,E),Li()}function Du(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Lu,Bu,zu,Wu,$u={exports:{}},ju=Du((Lu||(Lu=1,zu=$u.exports,Wu=function(){var t=function(){},e="undefined",n=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],r={},o=null;function s(t,e){var n=t[e];if("function"==typeof n.bind)return n.bind(t);try{return Function.prototype.bind.call(n,t)}catch(e){return function(){return Function.prototype.apply.apply(n,[t,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?t:this.methodFactory(o,n,this.name)}if(this.log=this.debug,typeof console===e&&n<this.levels.SILENT)return"No console available for logging"}function c(t){return function(){typeof console!==e&&(l.call(this),this[t].apply(this,arguments))}}function u(i,r,o){return"debug"===(l=i)&&(l="log"),typeof console!==e&&("trace"===l&&n?a:void 0!==console[l]?s(console,l):void 0!==console.log?s(console,"log"):t)||c.apply(this,arguments);var l}function d(t,n){var s,a,c,d=this,h="loglevel";function f(){var t;if(typeof window!==e&&h){try{t=window.localStorage[h]}catch(t){}if(typeof t===e)try{var n=window.document.cookie,i=encodeURIComponent(h),r=n.indexOf(i+"=");-1!==r&&(t=/^([^;]+)/.exec(n.slice(r+i.length+1))[1])}catch(t){}return void 0===d.levels[t]&&(t=void 0),t}}function p(t){var e=t;if("string"==typeof e&&void 0!==d.levels[e.toUpperCase()]&&(e=d.levels[e.toUpperCase()]),"number"==typeof e&&e>=0&&e<=d.levels.SILENT)return e;throw new TypeError("log.setLevel() called with invalid level: "+t)}"string"==typeof t?h+=":"+t:"symbol"==typeof t&&(h=void 0),d.name=t,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(t,n){return c=p(t),!1!==n&&function(t){var n=(i[t]||"silent").toUpperCase();if(typeof window!==e&&h){try{return void(window.localStorage[h]=n)}catch(t){}try{window.document.cookie=encodeURIComponent(h)+"="+n+";"}catch(t){}}}(c),l.call(d)},d.setDefaultLevel=function(t){a=p(t),f()||d.setLevel(t,!1)},d.resetLevel=function(){c=null,function(){if(typeof window!==e&&h){try{window.localStorage.removeItem(h)}catch(t){}try{window.document.cookie=encodeURIComponent(h)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(t){}}}(),l.call(d)},d.enableAll=function(t){d.setLevel(d.levels.TRACE,t)},d.disableAll=function(t){d.setLevel(d.levels.SILENT,t)},d.rebuild=function(){if(o!==d&&(s=p(o.getLevel())),l.call(d),o===d)for(var t in r)r[t].rebuild()},s=p(o?o.getLevel():"WARN");var m=f();null!=m&&(c=p(m)),l.call(d)}(o=new d).getLogger=function(t){if("symbol"!=typeof t&&"string"!=typeof t||""===t)throw new TypeError("You must supply a name when creating a logger.");var e=r[t];return e||(e=r[t]=new d(t,o.methodFactory)),e};var h=typeof window!==e?window.log:void 0;return o.noConflict=function(){return typeof window!==e&&window.log===o&&(window.log=h),o},o.getLoggers=function(){return r},o.default=o,o},(Bu=$u).exports?Bu.exports=Wu():zu.log=Wu()),$u.exports));const Uu=()=>{},qu=["trace","log","debug","info","warn","error","getLevel","setLevel"],Vu=["trace","debug","info","warn","error","silent"],Gu={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;"},Hu="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global;let Ku={level:"trace",appName:""},Xu=[];const Yu="object"==typeof Hu&&Hu.performance&&"function"==typeof Hu.performance.now?Hu.performance.now.bind(Hu.performance):Date.now.bind(Date),Qu=t=>t&&"string"==typeof t?t.toLowerCase().trim():"",Ju=(()=>{try{const t=new URLSearchParams(document.location.search),e=[].concat(t.getAll("log")).concat(t.getAll("ekolog")).concat(t.getAll("ekologger")).join(",").split(",");if(0===e.length)return{};let n={};return e.forEach((t=>{const[e,i]=t.split(":");n[Qu(e)]=Qu(i)||"trace"})),n}catch(t){return{}}})(),Zu=(t,e="")=>{const n=Qu(t),i=ju.getLogger(n);if(i.__ekologger)return i.__ekologger;e||Ju[n]||Ju["*"]||(i.__noExplicitLevel=!0);const r=i.methodFactory;i.methodFactory=(e,n,i)=>{const o=r(e,n,i),s=e.toUpperCase();return(...e)=>{o(`[${((t,e=3)=>(Yu()/1e3).toFixed(e))()}] %c[${s}] ${Ku.appName?`[${Ku.appName}] `:""}[${t}]`,Gu[s],...e)}},e=Ju[n]||Ju["*"]||e||Ku.level,i.setLevel(e,!1);const o=(...t)=>i.log(...t);return qu.forEach((t=>{o[t]=(...e)=>(Xu.forEach((n=>{n[t](...e)})),i[t](...e))})),i.__ekologger=o,o};Zu.setDefaults=({appName:t="",level:e})=>{t&&"string"==typeof t&&(Ku.appName=t),(e=Qu(e))&&Vu.includes(e)&&(Ku.level=e,Object.values(ju.getLoggers()).filter((t=>t.__noExplicitLevel)).forEach((t=>t.setLevel(Ku.level,!1))))},Zu.installDriver=t=>{const e={...qu.reduce(((e,n)=>(e[n]="function"==typeof(null==t?void 0:t[n])?t[n]:Uu,e)),{})};Xu.push(e)};let td=class{#T=new Map;on(t,e){if("function"!=typeof e)return this;const n=this.#T.get(t)||new Set;return n.add(e),this.#T.set(t,n),this}once(t,e){if("function"!=typeof e)return this;const n=(...i)=>(this.off(t,n),e(...i));return this.on(t,n)}off(t,e){if(!t)return this.#T.clear(),this;const n=this.#T.get(t);return n?e?(n.delete(e),0===n.size&&this.#T.delete(t),this):(this.#T.delete(t),this):this}trigger(t,...e){const n=this.#T.get(t);return n?(n.forEach((t=>t(...e))),this):this}};function ed(t){return"[object Object]"===Object.prototype.toString.call(t)}function nd(t,...e){const n=ed(t)?{...t}:{};return e.forEach((t=>{ed(t)&&Object.keys(t).forEach((e=>{const i=t[e],r=n[e];ed(i)&&ed(r)?n[e]=nd(r,i):Array.isArray(i)?n[e]=i.slice():n[e]=i}))})),n}function id(t){if("string"==typeof t)return`'${t}'`;if(Array.isArray(t))return`[${t.map((t=>id(t))).join(", ")}]`;if(ed(t))try{return JSON.stringify(t)}catch(t){return"[object Object]"}return null===t?"null":void 0===t?"undefined":String(t)}function rd(t){return Array.from(t).map((t=>id(t))).join(", ")}var od=new WeakSet;let sd=class extends td{constructor(...t){super(),O(this,od);const e=t.length?t[t.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=Zu(n,this.loglevel);const i=ed(this.defaults)?this.defaults:{},r=ed(e)&&ed(e[n])?e[n]:{};this.settings=nd({},i,r),A(od,this,ad).call(this),A(od,this,ld).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 ad(){const t=new Set,e=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(t.has(o))continue;const s=Object.getOwnPropertyDescriptor(n,o);if(!s||"function"!=typeof s.value)continue;const a=s.value.bind(this),l=!e.has(o);this[o]=l?(...t)=>(this.log&&"function"==typeof this.log.debug&&this.log.debug(`${this.name}.${o}(${rd(t)})`),a(...t)):a,t.add(o)}n=Object.getPrototypeOf(n)}}function ld(){if("undefined"==typeof window||"function"!=typeof window.addEventListener)return;const t=()=>{try{"function"==typeof this.dispose&&this.dispose()}catch(t){this.log&&"function"==typeof this.log.error&&this.log.error("dispose failed",t)}};window.addEventListener("pagehide",t),window.addEventListener("beforeunload",t),this._lifecycleCleanup=()=>{window.removeEventListener("pagehide",t),window.removeEventListener("beforeunload",t)}}const cd="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};function ud(t){return Boolean(t)&&"object"==typeof t&&1===t.nodeType&&"function"==typeof t.appendChild}const dd=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",CANVAS_WEBGL_CONTEXT_LOST:"canvas.webglcontextlost",CANVAS_WEBGL_CONTEXT_RESTORED:"canvas.webglcontextrestored"});function hd(t,e){const n={};return Number.isFinite(t)&&(n.time=t),"string"==typeof e&&(n.source=e),n}function fd({placementId:t,nodeId:e,trackId:n,segmentId:i,trackType:r,pts:o,duration:s,frame:a,audioBuffer:l}={}){const c={};return t&&(c.placementId=t),e&&(c.nodeId=e),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 pd({placementId:t,nodeId:e,trackId:n,segmentId:i,trackType:r,error:o}={}){const s={};return t&&(s.placementId=t),e&&(s.nodeId=e),n&&(s.trackId=n),i&&(s.segmentId=i),r&&(s.trackType=r),o&&(s.error=o),s}var md=new WeakMap,vd=new WeakMap,gd=new WeakMap,yd=new WeakMap,bd=new WeakMap,kd=new WeakMap,wd=new WeakMap,xd=new WeakSet;let _d=class extends sd{get defaults(){return{style:{width:"100%",height:"100%"},contextAttributes:{alpha:!1,depth:!1,stencil:!1,antialias:!1,preserveDrawingBuffer:!1,powerPreference:"low-power"}}}constructor(...t){var e,n;super(...t),O(this,xd),F(this,md,void 0),F(this,vd,void 0),F(this,gd,void 0),F(this,yd,void 0),F(this,bd,void 0),F(this,kd,void 0),F(this,wd,void 0);const[i,r=null]=t;C(kd,this,r);const o=function(t,e=(null==cd?void 0:cd.document)){if(ud(t))return t;const n="string"==typeof t?t:null;if(!n||!e||"function"!=typeof e.querySelector)return null;const i=e.querySelector(n);return ud(i)?i:null}(i);if(!o)throw new Error("Canvas requires a valid mount target (HTMLElement or selector string).");C(md,this,o);const s=null==cd?void 0:cd.document;if(!s||"function"!=typeof s.createElement)throw new Error("Canvas requires document.createElement.");var a,l;C(vd,this,s.createElement("canvas")),a=M(vd,this),l=null===(e=this.settings)||void 0===e?void 0:e.style,a&&l&&"object"==typeof l&&!Array.isArray(l)&&Object.keys(l).forEach((t=>{const e=l[t];null!=e&&(a.style[t]=String(e))})),M(md,this).appendChild(M(vd,this));const c=null===(n=this.settings)||void 0===n?void 0:n.contextAttributes,u=c&&"object"==typeof c&&!Array.isArray(c)?c:void 0;if(C(wd,this,u),C(gd,this,M(vd,this).getContext("webgl2",u)),!M(gd,this))throw new Error("Canvas WebGL2 context is not available.");A(xd,this,Ed).call(this)}get name(){return"Canvas"}get element(){return M(vd,this)}get gl(){return M(gd,this)}onDispose(){A(xd,this,Id).call(this),M(vd,this)&&M(vd,this).parentNode&&M(vd,this).parentNode.removeChild(M(vd,this)),C(gd,this,null),C(vd,this,null),C(md,this,null),C(kd,this,null),C(wd,this,null),C(yd,this,null),C(bd,this,null)}};function Td(t,e){var n,i;this.trigger(t,e),null===(n=M(kd,this))||void 0===n||null===(i=n.trigger)||void 0===i||i.call(n,t,e)}function Ed(){M(vd,this)&&(C(yd,this,(t=>{"function"==typeof(null==t?void 0:t.preventDefault)&&t.preventDefault(),this.log.error("WebGL context lost",t),A(xd,this,Td).call(this,dd.CANVAS_WEBGL_CONTEXT_LOST,t)})),C(bd,this,(t=>{var e;C(gd,this,(null===(e=M(vd,this))||void 0===e?void 0:e.getContext("webgl2",M(wd,this)))||null),M(gd,this)?A(xd,this,Td).call(this,dd.CANVAS_WEBGL_CONTEXT_RESTORED,t):this.log.error("WebGL context restored event fired but WebGL2 context is still unavailable.",t)})),M(vd,this).addEventListener("webglcontextlost",M(yd,this)),M(vd,this).addEventListener("webglcontextrestored",M(bd,this)))}function Id(){M(vd,this)&&(M(vd,this).removeEventListener("webglcontextlost",M(yd,this)),M(vd,this).removeEventListener("webglcontextrestored",M(bd,this)))}var Sd=new WeakMap,Ad=new WeakMap,Nd=new WeakMap,Md=new WeakMap,Fd=new WeakMap,Cd=new WeakMap,Od=new WeakSet;let Pd=class extends sd{get name(){return"ContainerSize"}get containerWidth(){return M(Ad,this)}get containerHeight(){return M(Nd,this)}get width(){return M(Ad,this)}get height(){return M(Nd,this)}constructor(...t){super(...t),O(this,Od),F(this,Sd,void 0),F(this,Ad,0),F(this,Nd,0),F(this,Md,null),F(this,Fd,null),F(this,Cd,null);const[e]=t;var n;C(Sd,this,(n=e)&&n.element&&ud(n.element)?n.element:ud(n)?n:null),M(Sd,this)&&(A(Od,this,Dd).call(this,!0),A(Od,this,Rd).call(this))}onDispose(){M(Md,this)&&"function"==typeof M(Md,this).disconnect&&M(Md,this).disconnect(),C(Md,this,null),M(Cd,this)&&"function"==typeof(null==cd?void 0:cd.removeEventListener)&&cd.removeEventListener("resize",M(Cd,this)),C(Cd,this,null),M(Fd,this)&&((null==cd?void 0:cd.clearInterval)||clearInterval)(M(Fd,this)),C(Fd,this,null),C(Sd,this,null)}};function Rd(){if(!M(Sd,this))return;const t=null==cd?void 0:cd.ResizeObserver;if("function"==typeof t)return C(Md,this,new t((()=>A(Od,this,Dd).call(this)))),void M(Md,this).observe(M(Sd,this));C(Cd,this,(()=>A(Od,this,Dd).call(this))),"function"==typeof(null==cd?void 0:cd.addEventListener)&&cd.addEventListener("resize",M(Cd,this));const e=(null==cd?void 0:cd.setInterval)||setInterval;C(Fd,this,e((()=>A(Od,this,Dd).call(this)),250))}function Dd(t=!1){if(!M(Sd,this))return;const{width:e,height:n}=function(t){const e=Number(null==t?void 0:t.clientWidth),n=Number(null==t?void 0:t.clientHeight);return{width:Number.isFinite(e)&&e>0?Math.round(e):0,height:Number.isFinite(n)&&n>0?Math.round(n):0}}(M(Sd,this));(t||e!==M(Ad,this)||n!==M(Nd,this))&&(C(Ad,this,e),C(Nd,this,n),this.trigger("containerresize",{width:e,height:n}))}var Ld={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 Bd=class{constructor(t,e){this.canvasSource=t,this.startRendering=e,this.gl=null,this.glOptions=null}init(t,e,n){this.glOptions=n||{};const i=this.initCanvas(this.canvasSource,t,e);return this.initWebgl(i,this.glOptions)}initCanvas(){throw new Error("implement on concrete class")}getContextConfig(t={}){if(!t||"object"!=typeof t)return{contextType:"webgl",contextAttributes:void 0};const{contextType:e,contextAttributes:n,__shaderGraph:i,...r}=t,o=Object.prototype.hasOwnProperty.call(t,"contextAttributes");let s=o?n:r;return o||!s||"object"!=typeof s||Array.isArray(s)||0!==Object.keys(s).length||(s=void 0),{contextType:e||"webgl",contextAttributes:s}}initWebgl(t,e={}){const{contextType:n,contextAttributes:i}=this.getContextConfig(e),r=t.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 zd,Wd={exports:{}},$d=(zd||(zd=1,function(t){var e=Object.prototype.hasOwnProperty,n="~";function i(){}function r(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,i,o,s){if("function"!=typeof i)throw new TypeError("The listener must be a function");var a=new r(i,o||t,s),l=n?n+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],a]:t._events[l].push(a):(t._events[l]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new i:delete t._events[e]}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 t,i,r=[];if(0===this._eventsCount)return r;for(i in t=this._events)e.call(t,i)&&r.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},a.prototype.listeners=function(t){var e=n?n+t:t,i=this._events[e];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(t){var e=n?n+t:t,i=this._events[e];return i?i.fn?1:i.length:0},a.prototype.emit=function(t,e,i,r,o,s){var a=n?n+t:t;if(!this._events[a])return!1;var l,c,u=this._events[a],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,i),!0;case 4:return u.fn.call(u.context,e,i,r),!0;case 5:return u.fn.call(u.context,e,i,r,o),!0;case 6:return u.fn.call(u.context,e,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(t,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,e);break;case 3:u[c].fn.call(u[c].context,e,i);break;case 4:u[c].fn.call(u[c].context,e,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(t,e,n){return o(this,t,e,n,!1)},a.prototype.once=function(t,e,n){return o(this,t,e,n,!0)},a.prototype.removeListener=function(t,e,i,r){var o=n?n+t:t;if(!this._events[o])return this;if(!e)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==e||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!==e||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(t){var e;return t?(e=n?n+t:t,this._events[e]&&s(this,e)):(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,t.exports=a}(Wd)),Wd.exports),jd=Du($d);let Ud=class extends Bd{constructor(t){super(t,!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 e=new jd;this.on=e.on.bind(e),this.off=e.off.bind(e),this.once=e.once.bind(e),this.trigger=e.emit.bind(e)}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(t,e,n){var i;this.player=t,this.setSrcVidTracksFn=e;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)&&null!=(a=o)&&"object"==typeof a&&!Array.isArray(a)&&Object.keys(a).length>0;var a;const l={contextType:r};s&&(l.contextAttributes=o),t.initPlugin("canvas",l);const c={drawFrame:this.canvasDrawFrameFn.bind(this),resize:n,contextType:r,offscreenVideoCanvasEnabled:!1,viewportModeEnabled:!0,fps:0};return s&&(c.contextAttributes=o),t.canvas.init(c),t.paused&&0===t.currentTime&&(this.shouldUpdateTexture=!1),this.addPlayerListeners(),t.canvas.canvas}canvasDrawFrameFn(t,e,n){var i;this.setSrcVidTracksFn&&this.shouldUpdateTexture&&t&&e&&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((t=>{this.player.once("seeked",(()=>{this.shouldUpdateTexture=!0,t()})),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)}},qd=class extends Bd{constructor(t){super(t,!1)}initCanvas(t,e){const n=function(){const t=document.querySelector("video");t&&t.videoHeight&&e(t),requestAnimationFrame(n)};return requestAnimationFrame(n),document.getElementById(t)}},Vd=class extends Bd{constructor(t){super(t,!1)}initCanvas({src:t,dest:e},n,i){const r="string"==typeof e?document.querySelector(e):e,o="undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement,s=()=>{this.isDisposed||(t&&t.videoHeight&&n(t),requestAnimationFrame(s))};return o?requestAnimationFrame(s):"function"==typeof t?t(n,i):n(t),r}dispose(){this.isDisposed=!0}};var Gd=function(t){let e;return e="string"==typeof t?new qd(t):t&&t.src&&t.dest?new Vd(t):new Ud(t),e};function Hd(t){return Array.isArray(t)||(t=[t]),t}let Kd=class{constructor(t){this.store=t?{...t.get()}:{}}reset(){this.store={}}get(t){if(!t)return this.store;const e=(t=Hd(t)).reduce(((t,e)=>{const n=this.store[e];return t.push(n),t}),[]);return 1===e.length?e[0]:e}set(t,e){if(t=Hd(t),e=Hd(e),t.length!==e.length)throw new Error(`cant set values ${e} to keys ${t}, length did not match`);t.forEach(((t,n)=>{this.store[t]=e[n]}))}},Xd=class{constructor(t,e,n,i){this.gl=i.gl,this.unit=t,this.bindPoint=e,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(t){this.height=t}setWidth(t){this.width=t}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 Yd=Zu("frame","warn");let Qd=!1;if("undefined"!=typeof window&&window.InterludePlayer){let t=window.InterludePlayer.environment,e=t.isAffectedBySafari17SeekBug,n=t.ua.includes("WMT1H")&&t.ua.includes("iOS/17");Qd=e||n}function Jd(t,e){const n=t.gl;var i;n.texImage2D(t.bindPoint,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e),t.__hasAllocated=!0,i=t,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 Zd=class extends Xd{fill(t){if(Qd&&(t.paused||"undefined"!=typeof document&&"hidden"===document.visibilityState))return;if(t.__closed)return;this.bind();const e=function(t,e){let n=!t.__hasAllocated;return e?(e.width===t.width&&e.height===t.height||(n=!0),t.width=e.width,t.height=e.height,n):n}(this,function(t){if(!t)return;const e=[[t.displayWidth,t.displayHeight],[t.codedWidth,t.codedHeight],[t.videoWidth,t.videoHeight],[t.naturalWidth,t.naturalHeight],[t.width,t.height]];for(let t=0;t<e.length;t+=1){const[n,i]=e[t],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}(t)),n=performance.now();!function(t,e,n){const i=t.gl,r=function(t){if("undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement)return!0;const e="object"==typeof window?window:"object"==typeof self?self:null,n=e&&e.VideoFrame;return"function"==typeof n&&t instanceof n}(e);r&&(t.__useSubImage=!1),n||!1===t.__useSubImage||r?Jd(t,e):(i.texSubImage2D(t.bindPoint,0,0,0,i.RGBA,i.UNSIGNED_BYTE,e),void 0===t.__useSubImage&&(i.getError()!==i.NO_ERROR?(t.__useSubImage=!1,Jd(t,e)):t.__useSubImage=!0))}(this,t,e);const i=(performance.now()-n)/1e3;i>=.1&&Yd.warn(`[fill] texImage2D() took ${i.toFixed(3)} seconds to execute.`),"function"==typeof t.close&&!0!==t.__keepOpen&&(t.close(),t.__closed=!0)}},th=class extends Xd{constructor(t,e,n){super(...arguments),n.needRefresh&&(this.fill(null),n.needRefresh=!1)}fill(t){if(this.bind(),t&&t.tagName&&"IMG"===t.tagName){const e=Number(t.naturalWidth||t.width),n=Number(t.naturalHeight||t.height);this.gl.texImage2D(this.bindPoint,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),Number.isFinite(e)&&Number.isFinite(n)&&(this.actualWidth=e,this.actualHeight=n,this.textureObjectInfo&&(this.textureObjectInfo.allocatedWidth=e,this.textureObjectInfo.allocatedHeight=n))}else{const e=this.gl.canvas.width,n=this.gl.canvas.height;this.gl.texImage2D(this.bindPoint,0,this.gl.RGBA,e,n,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),Number.isFinite(e)&&Number.isFinite(n)&&(this.actualWidth=e,this.actualHeight=n,this.textureObjectInfo&&(this.textureObjectInfo.allocatedWidth=e,this.textureObjectInfo.allocatedHeight=n))}}};var eh=function(t,e,n,i,r){let o;switch(t){case"frame":o=new Zd(e,n,i,r);break;case"pixel":o=new th(e,n,i,r);break;default:throw new Error(`cant recognize type ${t}`)}return o};let nh=class{constructor(t){this.gl=t.gl;const e=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS)||20;return this.maxTextures=Math.min(20,e),this.textureObjectPool=[],this.textureUnitsPool=new Set(Array(this.maxTextures).keys()),this.activeTextures=t.activeTextures instanceof Set?t.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 t=this.textureUnitsPool.values(),e=Math.min.apply(null,[...t]);return this.textureUnitsPool.delete(e),e}createTexture(t){const e=t&&t.type||{},n=this.gl.TEXTURE_2D,i=this.getTextureUnit(),r=this.getTextureObject(),o=eh(e,i,n,r,{gl:this.gl});return this.activeTextures.add(o),o}releaseTexture(t){this.textureUnitsPool.has(t.getUnit())||(this.textureObjectPool.push({object:t.getObject(),needRefresh:!1}),this.textureUnitsPool.add(t.getUnit())),this.activeTextures.delete(t)}refreshTextureObjects(){this.textureObjectPool.forEach((t=>{t.needRefresh=!0}))}refreshActiveTextures(){const t=new Set;this.activeTextures.forEach((e=>{if(!e||"function"!=typeof e.getUnit)return;t.add(e.getUnit());const n={object:this.gl.createTexture(),needRefresh:!0};e.gl=this.gl,e.textureObjectInfo=n,e.textureObject=n.object,e.__hasAllocated=!1,e.__useSubImage=void 0,e.actualWidth=null,e.actualHeight=null,"function"==typeof e.setParameters&&e.setParameters()})),this.textureObjectPool=[],this.textureUnitsPool=new Set(Array(this.maxTextures).keys()),t.forEach((t=>{this.textureUnitsPool.delete(t)}))}};const ih=Ld.VIDEO_SOURCE_PREFIX,rh=Ld.TEXTURE_SOURCE_PREFIX,oh=Ld.PREVIOUS_OUTPUT_PREFIX,sh=Ld.SAVED_FRAME_PREFIX;function ah(t,e,n){t.set(`${ih}${n}`,e)}function lh(t,e,n){t.set(`${oh}${n}`,e)}function ch(t,e,n){t.set(`${sh}${n}`,e)}let uh=class{constructor(t){return this.gl=t.gl,this.glSource=t.glSource,this.textureManager=t.textureManager,this.capturedFramesManager=t.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(t){for(const[e,n]of Object.entries(this.capturedFramesManager.getCurrentFrames()))ah(t,n,e),lh(t,n,e);for(const[e,n]of Object.entries(this.capturedFramesManager.getSavedFrames()))ch(t,n,e)}setTextureSource(t,e,n){t.set(`${rh}${n}`,e)}getInput(t,e){return t.get(e)}getPrevOutput(t,e){return e=Number.isInteger(e)?e:0,t.get(`${oh}${e}`)}setOutputs(t,e=[],n=[]){if(Array.isArray(n)||(n=[n]),e.length>n.length)throw new Error(`output ids ${e.length} is bigger then supplied outputs ${n.length}`);n.forEach(((e,n)=>{lh(t,e,n)})),e.forEach(((e,i)=>{t.set(e,n[i])}))}disposeTextures(t,e){const n=e.getUnit();t.forEach((t=>{const e=t.getUnit();this.capturedFramesManager.isReservedUnit(e)||n===e||this.textureManager.releaseTexture(t)}))}disposeAllStore(t){const e=new Set;Object.values(t.get()).forEach((t=>{const n=t.getUnit();this.capturedFramesManager.isReservedUnit(n)||e.has(n)||t.isStatic||(this.textureManager.releaseTexture(t),e.add(n))}))}},dh=class{constructor(t){this.context=t}bind(){throw new Error("impl in concrete")}},hh=100,fh=100;function ph(t,e){hh=t,fh=e}let mh=class extends dh{bind(t){var e,n;this.context.gl.bindFramebuffer(this.context.gl.FRAMEBUFFER,null);const i=null===(e=this.context.gl)||void 0===e||null===(e=e.canvas)||void 0===e?void 0:e.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),ph(i,r)),t}},vh=class extends dh{bind(t){Array.isArray(t)||(t=[t]),this.context.gl.bindFramebuffer(this.context.gl.FRAMEBUFFER,this.context.frameBufferObject);const e=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,e.textureObject,0),this.context.gl.clear(this.context.gl.COLOR_BUFFER_BIT),!0===this.context.useCanvasSizedFilterTargets){var i,r;const t=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(t)&&t>0&&e.setWidth(t),Number.isFinite(n)&&n>0&&e.setHeight(n);const o=e.textureObjectInfo,s=null==o?void 0:o.allocatedWidth,a=null==o?void 0:o.allocatedHeight;Number.isFinite(t)&&Number.isFinite(n)&&(s!==t||a!==n)&&"function"==typeof e.fill&&e.fill(null)}else t[0]&&(e.setHeight(t[0].getHeight()),e.setWidth(t[0].getWidth()));return e}},gh=class{constructor(t){this.gl=t.gl,this.textureManager=t.textureManager,this.useCanvasSizedFilterTargets=t.useCanvasSizedFilterTargets,this.bufferIndex=0,this.frameBufferObjectsPool=[this.gl.createFramebuffer(),this.gl.createFramebuffer(),this.gl.createFramebuffer()]}getFrameBufferObject(){const t=this.frameBufferObjectsPool[this.bufferIndex];return this.bufferIndex=this.bufferIndex++%this.frameBufferObjectsPool.length,t}create(t){let e;return e=t===Ld.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS?new mh({gl:this.gl}):new vh({gl:this.gl,textureManager:this.textureManager,frameBufferObject:this.getFrameBufferObject(),useCanvasSizedFilterTargets:this.useCanvasSizedFilterTargets}),e}};function yh(t,e,n){const i=e===t.VERTEX_SHADER?"vertex":"fragment";var r;r=t,Boolean(r)&&("undefined"!=typeof WebGL2RenderingContext&&r instanceof WebGL2RenderingContext||"function"==typeof r.createVertexArray)&&(n=function(t="",e){if("string"!=typeof t||!t||function(t=""){return"string"==typeof t&&t.includes("#version 300 es")}(t))return t;let n=t;if("vertex"===e&&(n=n.replace(/\battribute\b/g,"in"),n=n.replace(/\bvarying\b/g,"out")),"fragment"===e&&(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"===e&&n.includes("fragColor")&&!/\bout\s+vec4\s+fragColor\s*;/.test(n)){const t=n.split("\n");let e=1;for(let n=1;n<t.length;n+=1)if(t[n].trim().startsWith("precision ")){e=n+1;break}t.splice(e,0,"out vec4 fragColor;"),n=t.join("\n")}return n}(n,i));const o=t.createShader(e);if(!o)throw new Error(`Failed to create ${i} shader`);if(t.shaderSource(o,n),t.compileShader(o),t.getShaderParameter(o,t.COMPILE_STATUS))return o;const s=t.getShaderInfoLog(o);throw t.deleteShader(o),new Error(s)}var bh=function(t,e){return yh(t,t.VERTEX_SHADER,e)},kh=function(t,e){return yh(t,t.FRAGMENT_SHADER,e)};const wh={position_3d:0,texture_coordinate_2d:1};var xh=function(t,e,n){const i=t.createProgram();if(t.attachShader(i,e),t.attachShader(i,n),Object.entries(wh).forEach((([e,n])=>{t.bindAttribLocation(i,n,e)})),t.linkProgram(i),t.getProgramParameter(i,t.LINK_STATUS))return i;const r=t.getProgramInfoLog(i);throw t.deleteProgram(i),new Error(r)},_h=[-1,-1,1,1,-1,1,-1,1,1,1,1,1],Th=[0,1,2,2,1,3],Eh=[0,0,1,0,0,1,1,1];const Ih=96,Sh=[new Float32Array(new ArrayBuffer(Ih)),new Float32Array(new ArrayBuffer(Ih)),new Float32Array(new ArrayBuffer(Ih)),new Float32Array(new ArrayBuffer(Ih)),new Float32Array(new ArrayBuffer(Ih)),new Float32Array(new ArrayBuffer(Ih))],Ah=[new Int16Array(6),new Int16Array(6),new Int16Array(6)];let Nh=class{constructor(t,e,n){return this.gl=n.gl,this.program=n.program,this.bindPoint=e,this.location=this.gl.getAttribLocation(this.program,t),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 t;switch(this.bindPoint){case this.gl.ARRAY_BUFFER:t=Sh[this.floatBufferCounter],this.floatBufferCounter=this.floatBufferCounter++%Sh.length;break;case this.gl.ELEMENT_ARRAY_BUFFER:t=Ah[this.unit16BufferCounter],this.unit16BufferCounter=this.unit16BufferCounter++%Ah.length;break;default:throw new Error("cant get buffer for this bind point: ",this.bindPoint)}return t}fillBuffer(t){this.bindBuffer();const e=this.getBuffer();e.set(t,0),this.gl.bufferData(this.bindPoint,e,this.gl.STATIC_DRAW)}getPointerData(){throw new Error("you should impl this function")}setPointer(){this.bindBuffer(),this.enable();const t=this.getPointerData();this.gl.vertexAttribPointer(this.location,t.size,t.type,t.normalize,t.stride,t.offset)}dispose(){this.gl.deleteBuffer(this.buffer)}};const Mh={position_3d:class extends Nh{getPointerData(){return{size:3,type:this.gl.FLOAT,normalize:!1,stride:0,offset:0}}},position_indexes:class extends Nh{setPointer(){}getPointerData(){}enable(){}},texture_coordinate_2d:class extends Nh{getPointerData(){return{size:2,type:this.gl.FLOAT,normalize:!0,stride:0,offset:0}}}};var Fh=function(t,e,n){const i=Mh[t];if(!i)throw new Error(`${t} is not a attribute name,choose from list: ${Object.keys(Mh)}`);return new i(t,e,n)};let Ch=class{constructor(t,e){this.gl=e.gl,this.program=e.program,this.location=this.gl.getUniformLocation(this.program,t)}compute(){return this}set(){return this}},Oh=class extends Ch{set(t){this.gl.uniform1fv(this.location,t)}},Ph=class extends Ch{set(t){t&&(t.beforeUse(),this.gl.uniform1i(this.location,t.getUnit()))}};const Rh="first_texture_dimensions",Dh="viewport_dimensions",Lh="time",Bh={RUNTIME_OPTIONS:"runtimeOptions[0]",STATIC_OPTIONS:"staticOptions[0]",FIRST_TEXTURE:"first_texture",SECOND_TEXTURE:"second_texture",FIRST_MATRIX:"first_mat4"},zh={[Bh.FIRST_TEXTURE]:Ph,[Bh.SECOND_TEXTURE]:Ph,[Bh.FIRST_MATRIX]:class extends Ch{set(t){this.gl.uniformMatrix4fv(this.location,!1,t)}},[Bh.STATIC_OPTIONS]:Oh,[Bh.RUNTIME_OPTIONS]:Oh};var Wh=function(t,e){const n=zh[t];if(!n)throw new Error(`${t} is not a attribute name,choose from list: ${Object.keys(zh)}`);return new n(t,e)},$h=function(t,e){let n=(Date.now()-t||0)/(e||1);return n=Number.parseFloat(n).toFixed(7),n=Math.min(1,n),n};const jh="position_3d",Uh="position_indexes",qh="texture_coordinate_2d";class Vh{constructor(t,e,n,i){this.type=t,this.gl=i.gl,this.frameBuffer=i.frameBufferFactory.create(t),this.rebindAttributesOnProgramSwitch=!1!==i.rebindAttributesOnProgramSwitch,this.vertexShader=bh(this.gl,e.vertex),this.fragmentShader=kh(this.gl,e.fragment),this.program=xh(this.gl,this.vertexShader,this.fragmentShader);const r={gl:this.gl,program:this.program};this.attributes=function(t,e){const n={};return t=t||[],(t=[{id:jh,bindPoint:e.gl.ARRAY_BUFFER},{id:Uh,bindPoint:e.gl.ELEMENT_ARRAY_BUFFER},{id:qh,bindPoint:e.gl.ARRAY_BUFFER}].concat(t)).forEach((t=>{const i=t.id;n[i]=Fh(i,t.bindPoint,e)})),n}(n.attributes,r),this.uniforms=function(t,e){const n={};return(t=t||[]).forEach((t=>{const i=t.id;n[i]=Wh(i,e)})),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 e=[{id:Bh.RUNTIME_OPTIONS},{id:Bh.STATIC_OPTIONS}];return(t.getUniformList||Vh.getUniformList)().forEach((t=>{Object.values(Bh).includes(t)&&e.push({id:t})})),e}handleRuntimeUniforms(t,e){const{inputTextures:n,viewportDimensions:i}=t;let r=Array.isArray(n)?n:[n],o=[];(this.constructor.getUniformList||Vh.getUniformList)().forEach((t=>{switch(t){case Bh.FIRST_TEXTURE:this.uniforms[Bh.FIRST_TEXTURE].set(r[0]);break;case Bh.SECOND_TEXTURE:this.uniforms[Bh.SECOND_TEXTURE].set(r[1]);break;case Rh:o=[...o,r[0].getWidth(),r[0].getHeight()];break;case Dh:o=[...o,i.width,i.height];break;case Lh:{const t=$h(e.startTime,e.duration);o=[...o,t];break}}})),o.length>0&&this.uniforms[Bh.RUNTIME_OPTIONS].set(o)}static getUniformList(){return[Bh.FIRST_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(){}handleAttributes(){this.attributes[jh].fillBuffer(_h),this.attributes[jh].setPointer(),this.attributes[Uh].fillBuffer(Th),this.attributes[qh].fillBuffer(Eh),this.attributes[qh].setPointer()}disposeAttributes(){Object.values(this.attributes).forEach((t=>{t.dispose()}))}render(t,e){const n=this.frameBuffer.bind(t);let i={width:hh,height:fh};return this.gl.useProgram(this.program),this.rebindAttributesOnProgramSwitch&&this.gl.__shaderGraphLastProgram!==this.program&&(this.handleAttributes(),this.gl.__shaderGraphLastProgram=this.program),this.handleRuntimeUniforms({inputTextures:t,viewportDimensions:i},e),this.draw(),n}draw(){const t=this.gl.TRIANGLES,e=this.gl.UNSIGNED_SHORT;this.gl.drawElements(t,6,e,0)}updateStaticUniforms(t){this.gl.useProgram(this.program),this.handleStaticUniforms(t)}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 Gh,Hh="undefined"!=typeof Float32Array?Float32Array:Array;function Kh(){var t=new Hh(3);return Hh!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Xh(t,e,n){var i=new Hh(3);return i[0]=t,i[1]=e,i[2]=n,i}function Yh(){var t=new Hh(4);return Hh!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}Kh(),function(){var t;t=new Hh(4),Hh!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}(),Kh(),Xh(1,0,0),Xh(0,1,0),Yh(),Yh(),Gh=new Hh(9),Hh!=Float32Array&&(Gh[1]=0,Gh[2]=0,Gh[3]=0,Gh[5]=0,Gh[6]=0,Gh[7]=0),Gh[0]=1,Gh[4]=1,Gh[8]=1;class Qh extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(Qh)};super(Qh.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}"},e,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:Qh.getInitialOptions().translate.x},{properties:["translate","y"],type:"slider",minValue:-2,maxValue:2,step:.001,initialValue:Qh.getInitialOptions().translate.y},{properties:["scale","x"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:Qh.getInitialOptions().scale.x},{properties:["scale","y"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:Qh.getInitialOptions().scale.y},{properties:["rotate"],type:"slider",minValue:-360,maxValue:360,step:1,initialValue:Qh.getInitialOptions().rotate}]}static getUniformList(){return[Bh.FIRST_TEXTURE,Bh.FIRST_MATRIX]}handleStaticUniforms(t){if(!t||!t.translate||!t.scale)throw new Error(`bad options object for Transform filter, check ${t}`);const e=Number.parseFloat(t.translate.x).toFixed(7),n=-1*Number.parseFloat(t.translate.y).toFixed(7),i=Number.parseFloat(t.scale.x).toFixed(7),r=Number.parseFloat(t.scale.y).toFixed(7),o=t.rotate||0;var s;this.transformMatrix=function(t,e,n,i){var r=e[0],o=e[1],s=e[2],a=e[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 t[0]=(1-(p+v))*k,t[1]=(h+b)*k,t[2]=(f-y)*k,t[3]=0,t[4]=(h-b)*w,t[5]=(1-(d+v))*w,t[6]=(m+g)*w,t[7]=0,t[8]=(f+y)*x,t[9]=(m-g)*x,t[10]=(1-(d+p))*x,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}((s=new Hh(16),Hh!=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(t,e,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"zyx",o=Math.PI/360;e*=o,i*=o,n*=o;var s=Math.sin(e),a=Math.cos(e),l=Math.sin(n),c=Math.cos(n),u=Math.sin(i),d=Math.cos(i);switch(r){case"xyz":t[0]=s*c*d+a*l*u,t[1]=a*l*d-s*c*u,t[2]=a*c*u+s*l*d,t[3]=a*c*d-s*l*u;break;case"xzy":t[0]=s*c*d-a*l*u,t[1]=a*l*d-s*c*u,t[2]=a*c*u+s*l*d,t[3]=a*c*d+s*l*u;break;case"yxz":t[0]=s*c*d+a*l*u,t[1]=a*l*d-s*c*u,t[2]=a*c*u-s*l*d,t[3]=a*c*d+s*l*u;break;case"yzx":t[0]=s*c*d+a*l*u,t[1]=a*l*d+s*c*u,t[2]=a*c*u-s*l*d,t[3]=a*c*d-s*l*u;break;case"zxy":t[0]=s*c*d-a*l*u,t[1]=a*l*d+s*c*u,t[2]=a*c*u+s*l*d,t[3]=a*c*d-s*l*u;break;case"zyx":t[0]=s*c*d-a*l*u,t[1]=a*l*d+s*c*u,t[2]=a*c*u-s*l*d,t[3]=a*c*d+s*l*u;break;default:throw new Error("Unknown angle order "+r)}return t}(Yh(),0,0,o),Xh(e,n,0),Xh(i,r,1)),this.uniforms[Bh.FIRST_MATRIX].set(this.transformMatrix)}}class Jh extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(Jh)};super(Jh.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}"},e,t)}static getFilterType(){return"horizontalBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[Bh.FIRST_TEXTURE,Rh]}}class Zh extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(Zh)};super(Zh.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}"},e,t)}static getFilterType(){return"verticalBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[Bh.FIRST_TEXTURE,Rh]}}class tf extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(tf)};super(tf.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}"},e,t)}static getFilterType(){return"fastBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[Bh.FIRST_TEXTURE,Rh,Dh]}handleStaticUniforms(t){var e;const n=(null!==(e=Number.parseFloat(t.offsetDist))&&void 0!==e?e:4).toFixed(3);this.uniforms[Bh.STATIC_OPTIONS].set([n])}}class ef extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(ef)};super(ef.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}"},e,t)}static getFilterType(){return"directionalBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[Bh.FIRST_TEXTURE,Rh,Dh]}handleStaticUniforms(t){var e,n;const i=(null!==(e=Number.parseFloat(t.angle))&&void 0!==e?e:90).toFixed(3),r=(null!==(n=Number.parseFloat(t.strength))&&void 0!==n?n:.1).toFixed(3);this.uniforms[Bh.STATIC_OPTIONS].set([i,r])}}class nf extends Vh{constructor(t){const e={uniforms:Vh.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}",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}"},e,t)}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(t){const e=Number.parseFloat(t.power).toFixed(7);this.uniforms[Bh.STATIC_OPTIONS].set([e])}}class rf extends Vh{constructor(t){const e={uniforms:Vh.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;\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}"},e,t)}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[Bh.FIRST_TEXTURE,Rh,Bh.SECOND_TEXTURE]}handleStaticUniforms(t){let e;switch(t.type){case"box":e=0;break;case"rounded":e=1;break;default:throw new Error("cant recognize shape composite mask type")}const n=Number.parseFloat(t.center.x).toFixed(7);let i=Number.parseFloat(t.center.y).toFixed(7);i+=0;const r=Number.parseFloat(t.area.width).toFixed(7),o=Number.parseFloat(t.area.height).toFixed(7),s=Number.parseFloat(t.radius).toFixed(7),a=Number.parseFloat(t.edgeSoftness).toFixed(7);this.uniforms[Bh.STATIC_OPTIONS].set([e,n,i,r,o,s,a])}}class of extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(of)};super(of.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}"},e,t)}static getFilterType(){return"shapeComposite"}static getInputsCount(){return 2}static getInitialOptions(){return{}}static getUniformList(){return[Bh.FIRST_TEXTURE,Bh.SECOND_TEXTURE]}}class sf extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(sf)};super(sf.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"},e,t)}static getFilterType(){return"lut"}static getInputsCount(){return 2}static getInitialOptions(){return{}}static getUniformList(){return[Bh.FIRST_TEXTURE,Bh.SECOND_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(t){const e=Number.parseFloat(t.lutSize).toFixed(1);this.uniforms[Bh.STATIC_OPTIONS].set([e])}}var af="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",lf='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:cf,cos:uf,sin:df,acos:hf,atan2:ff,sqrt:pf,pow:mf}=Math;function vf(t){return t<0?-mf(-t,1/3):mf(t,1/3)}const gf=Math.PI,yf=2*gf,bf=gf/2,kf=Number.MAX_SAFE_INTEGER||9007199254740991,wf=Number.MIN_SAFE_INTEGER||-9007199254740991,xf={x:0,y:0,z:0},_f={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(t,e){const n=e(t);let i=n.x*n.x+n.y*n.y;return void 0!==n.z&&(i+=n.z*n.z),pf(i)},compute:function(t,e,n){if(0===t)return e[0].t=0,e[0];const i=e.length-1;if(1===t)return e[i].t=1,e[i];const r=1-t;let o=e;if(0===i)return e[0].t=t,e[0];if(1===i){const e={x:r*o[0].x+t*o[1].x,y:r*o[0].y+t*o[1].y,t:t};return n&&(e.z=r*o[0].z+t*o[1].z),e}if(i<4){let e,s,a,l=r*r,c=t*t,u=0;2===i?(o=[o[0],o[1],o[2],xf],e=l,s=r*t*2,a=c):3===i&&(e=l*r,s=l*t*3,a=r*c*3,u=t*c);const d={x:e*o[0].x+s*o[1].x+a*o[2].x+u*o[3].x,y:e*o[0].y+s*o[1].y+a*o[2].y+u*o[3].y,t:t};return n&&(d.z=e*o[0].z+s*o[1].z+a*o[2].z+u*o[3].z),d}const s=JSON.parse(JSON.stringify(e));for(;s.length>1;){for(let e=0;e<s.length-1;e++)s[e]={x:s[e].x+(s[e+1].x-s[e].x)*t,y:s[e].y+(s[e+1].y-s[e].y)*t},void 0!==s[e].z&&(s[e].z=s[e].z+(s[e+1].z-s[e].z)*t);s.splice(s.length-1,1)}return s[0].t=t,s[0]},computeWithRatios:function(t,e,n,i){const r=1-t,o=n,s=e;let a,l=o[0],c=o[1],u=o[2],d=o[3];return l*=r,c*=t,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:t}):(l*=r,c*=2*r,u*=t*t,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:t}):(l*=r,c*=1.5*r,u*=3*r,d*=t*t*t,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:t}):void 0))},derive:function(t,e){const n=[];for(let i=t,r=i.length,o=r-1;r>1;r--,o--){const t=[];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)},e&&(n.z=o*(i[r+1].z-i[r].z)),t.push(n);n.push(t),i=t}return n},between:function(t,e,n){return e<=t&&t<=n||_f.approximately(t,e)||_f.approximately(t,n)},approximately:function(t,e,n){return cf(t-e)<=(n||1e-6)},length:function(t){const e=_f.Tvalues.length;let n=0;for(let i,r=0;r<e;r++)i=.5*_f.Tvalues[r]+.5,n+=_f.Cvalues[r]*_f.arcfn(i,t);return.5*n},map:function(t,e,n,i,r){return i+(t-e)/(n-e)*(r-i)},lerp:function(t,e,n){const i={x:e.x+t*(n.x-e.x),y:e.y+t*(n.y-e.y)};return void 0!==e.z&&void 0!==n.z&&(i.z=e.z+t*(n.z-e.z)),i},pointToString:function(t){let e=t.x+"/"+t.y;return void 0!==t.z&&(e+="/"+t.z),e},pointsToString:function(t){return"["+t.map(_f.pointToString).join(", ")+"]"},copy:function(t){return JSON.parse(JSON.stringify(t))},angle:function(t,e,n){const i=e.x-t.x,r=e.y-t.y,o=n.x-t.x,s=n.y-t.y;return ff(i*s-r*o,i*o+r*s)},round:function(t,e){const n=""+t,i=n.indexOf(".");return parseFloat(n.substring(0,i+1+e))},dist:function(t,e){const n=t.x-e.x,i=t.y-e.y;return pf(n*n+i*i)},closest:function(t,e){let n,i,r=mf(2,63);return t.forEach((function(t,o){i=_f.dist(e,t),i<r&&(r=i,n=o)})),{mdist:r,mpos:n}},abcratio:function(t,e){if(2!==e&&3!==e)return!1;if(void 0===t)t=.5;else if(0===t||1===t)return t;const n=mf(t,e)+mf(1-t,e);return cf((n-1)/n)},projectionratio:function(t,e){if(2!==e&&3!==e)return!1;if(void 0===t)t=.5;else if(0===t||1===t)return t;const n=mf(1-t,e);return n/(mf(t,e)+n)},lli8:function(t,e,n,i,r,o,s,a){const l=(t-n)*(o-a)-(e-i)*(r-s);return 0!=l&&{x:((t*i-e*n)*(r-s)-(t-n)*(r*a-o*s))/l,y:((t*i-e*n)*(o-a)-(e-i)*(r*a-o*s))/l}},lli4:function(t,e,n,i){const r=t.x,o=t.y,s=e.x,a=e.y,l=n.x,c=n.y,u=i.x,d=i.y;return _f.lli8(r,o,s,a,l,c,u,d)},lli:function(t,e){return _f.lli4(t,t.c,e,e.c)},makeline:function(t,e){return new Of(t.x,t.y,(t.x+e.x)/2,(t.y+e.y)/2,e.x,e.y)},findbbox:function(t){let e=kf,n=kf,i=wf,r=wf;return t.forEach((function(t){const o=t.bbox();e>o.x.min&&(e=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:e,mid:(e+i)/2,max:i,size:i-e},y:{min:n,mid:(n+r)/2,max:r,size:r-n}}},shapeintersections:function(t,e,n,i,r){if(!_f.bboxoverlap(e,i))return[];const o=[],s=[t.startcap,t.forward,t.back,t.endcap],a=[n.startcap,n.forward,n.back,n.endcap];return s.forEach((function(e){e.virtual||a.forEach((function(i){if(i.virtual)return;const s=e.intersects(i,r);s.length>0&&(s.c1=e,s.c2=i,s.s1=t,s.s2=n,o.push(s))}))})),o},makeshape:function(t,e,n){const i=e.points.length,r=t.points.length,o=_f.makeline(e.points[i-1],t.points[0]),s=_f.makeline(t.points[r-1],e.points[0]),a={startcap:o,forward:t,back:e,endcap:s,bbox:_f.findbbox([o,t,e,s]),intersections:function(t){return _f.shapeintersections(a,a.bbox,t,t.bbox,n)}};return a},getminmax:function(t,e,n){if(!n)return{min:0,max:0};let i,r,o=kf,s=wf;-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=t.get(i),r[e]<o&&(o=r[e]),r[e]>s&&(s=r[e]);return{min:o,mid:(o+s)/2,max:s,size:s-o}},align:function(t,e){const n=e.p1.x,i=e.p1.y,r=-ff(e.p2.y-i,e.p2.x-n);return t.map((function(t){return{x:(t.x-n)*uf(r)-(t.y-i)*df(r),y:(t.x-n)*df(r)+(t.y-i)*uf(r)}}))},roots:function(t,e){e=e||{p1:{x:0,y:0},p2:{x:1,y:0}};const n=t.length-1,i=_f.align(t,e),r=function(t){return 0<=t&&t<=1};if(2===n){const t=i[0].y,e=i[1].y,n=i[2].y,o=t-2*e+n;if(0!==o){const i=-pf(e*e-t*n),s=-t+e;return[-(i+s)/o,-(-i+s)/o].filter(r)}return e!==n&&0===o?[(2*e-n)/(2*e-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(_f.approximately(l,0)){if(_f.approximately(c,0))return _f.approximately(u,0)?[]:[-d/u].filter(r);const t=pf(u*u-4*c*d),e=2*c;return[(t-u)/e,(-u-t)/e].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 t=-h/3,e=pf(t*t*t),n=-p/(2*e),i=hf(n<-1?-1:n>1?1:n),o=2*vf(e);return b=o*uf(i/3)-c/3,k=o*uf((i+yf)/3)-c/3,w=o*uf((i+2*yf)/3)-c/3,[b,k,w].filter(r)}if(0===v)return g=m<0?vf(-m):-vf(m),b=2*g-c/3,k=-g-c/3,[b,k].filter(r);{const t=pf(v);return g=vf(-m+t),y=vf(m+t),[g-y-c/3].filter(r)}},droots:function(t){if(3===t.length){const e=t[0],n=t[1],i=t[2],r=e-2*n+i;if(0!==r){const t=-pf(n*n-e*i),o=-e+n;return[-(t+o)/r,-(-t+o)/r]}return n!==i&&0===r?[(2*n-i)/(2*(n-i))]:[]}if(2===t.length){const e=t[0],n=t[1];return e!==n?[e/(e-n)]:[]}return[]},curvature:function(t,e,n,i,r){let o,s,a,l,c=0,u=0;const d=_f.compute(t,e),h=_f.compute(t,n),f=d.x*d.x+d.y*d.y;if(i?(o=pf(mf(d.y*h.z-h.y*d.z,2)+mf(d.z*h.x-h.z*d.x,2)+mf(d.x*h.y-h.x*d.y,2)),s=mf(f+d.z*d.z,1.5)):(o=d.x*h.y-d.y*h.x,s=mf(f,1.5)),0===o||0===s)return{k:0,r:0};if(c=o/s,u=s/o,!r){const r=_f.curvature(t-.001,e,n,i,!0).k,o=_f.curvature(t+.001,e,n,i,!0).k;l=(o-c+(c-r))/2,a=(cf(o-c)+cf(c-r))/2}return{k:c,r:u,dk:l,adk:a}},inflections:function(t){if(t.length<4)return[];const e=_f.align(t,{p1:t[0],p2:t.slice(-1)[0]}),n=e[2].x*e[1].y,i=e[3].x*e[1].y,r=e[1].x*e[2].y,o=18*(-3*n+2*i+3*r-e[3].x*e[2].y),s=18*(3*n-i-3*r),a=18*(r-n);if(_f.approximately(o,0)){if(!_f.approximately(s,0)){let t=-a/s;if(0<=t&&t<=1)return[t]}return[]}const l=2*o;if(_f.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(t){return 0<=t&&t<=1}))},bboxoverlap:function(t,e){const n=["x","y"],i=n.length;for(let r,o,s,a,l=0;l<i;l++)if(r=n[l],o=t[r].mid,s=e[r].mid,a=(t[r].size+e[r].size)/2,cf(o-s)>=a)return!1;return!0},expandbox:function(t,e){e.x.min<t.x.min&&(t.x.min=e.x.min),e.y.min<t.y.min&&(t.y.min=e.y.min),e.z&&e.z.min<t.z.min&&(t.z.min=e.z.min),e.x.max>t.x.max&&(t.x.max=e.x.max),e.y.max>t.y.max&&(t.y.max=e.y.max),e.z&&e.z.max>t.z.max&&(t.z.max=e.z.max),t.x.mid=(t.x.min+t.x.max)/2,t.y.mid=(t.y.min+t.y.max)/2,t.z&&(t.z.mid=(t.z.min+t.z.max)/2),t.x.size=t.x.max-t.x.min,t.y.size=t.y.max-t.y.min,t.z&&(t.z.size=t.z.max-t.z.min)},pairiteration:function(t,e,n){const i=t.bbox(),r=e.bbox(),o=1e5,s=n||.5;if(i.x.size+i.y.size<s&&r.x.size+r.y.size<s)return[(o*(t._t1+t._t2)/2|0)/o+"/"+(o*(e._t1+e._t2)/2|0)/o];let a=t.split(.5),l=e.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(t){return _f.bboxoverlap(t.left.bbox(),t.right.bbox())}));let u=[];return 0===c.length||(c.forEach((function(t){u=u.concat(_f.pairiteration(t.left,t.right,s))})),u=u.filter((function(t,e){return u.indexOf(t)===e}))),u},getccenter:function(t,e,n){const i=e.x-t.x,r=e.y-t.y,o=n.x-e.x,s=n.y-e.y,a=i*uf(bf)-r*df(bf),l=i*df(bf)+r*uf(bf),c=o*uf(bf)-s*df(bf),u=o*df(bf)+s*uf(bf),d=(t.x+e.x)/2,h=(t.y+e.y)/2,f=(e.x+n.x)/2,p=(e.y+n.y)/2,m=d+a,v=h+l,g=f+c,y=p+u,b=_f.lli8(d,h,m,v,f,p,g,y),k=_f.dist(b,t);let w,x=ff(t.y-b.y,t.x-b.x),_=ff(e.y-b.y,e.x-b.x),T=ff(n.y-b.y,n.x-b.x);return x<T?((x>_||_>T)&&(x+=yf),x>T&&(w=T,T=x,x=w)):T<_&&_<x?(w=T,T=x,x=w):T+=yf,b.s=x,b.e=T,b.r=k,b},numberSort:function(t,e){return t-e}};class Tf{constructor(t){this.curves=[],this._3d=!1,t&&(this.curves=t,this._3d=this.curves[0]._3d)}valueOf(){return this.toString()}toString(){return"["+this.curves.map((function(t){return _f.pointsToString(t.points)})).join(", ")+"]"}addCurve(t){this.curves.push(t),this._3d=this._3d||t._3d}length(){return this.curves.map((function(t){return t.length()})).reduce((function(t,e){return t+e}))}curve(t){return this.curves[t]}bbox(){const t=this.curves;for(var e=t[0].bbox(),n=1;n<t.length;n++)_f.expandbox(e,t[n].bbox());return e}offset(t){const e=[];return this.curves.forEach((function(n){e.push(...n.offset(t))})),new Tf(e)}}const{abs:Ef,min:If,max:Sf,cos:Af,sin:Nf,acos:Mf,sqrt:Ff}=Math,Cf=Math.PI;let Of=class e{constructor(t){let e=t&&t.forEach?t:Array.from(arguments).slice(),n=!1;if("object"==typeof e[0]){n=e.length;const t=[];e.forEach((function(e){["x","y","z"].forEach((function(n){void 0!==e[n]&&t.push(e[n])}))})),e=t}let i=!1;const r=e.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)||t&&t[0]&&void 0!==t[0].z,s=this.points=[];for(let t=0,n=o?3:2;t<r;t+=n){var a={x:e[t],y:e[t+1]};o&&(a.z=e[t+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=_f.align(s,{p1:s[0],p2:s[l]}),d=_f.dist(s[0],s[l]);this._linear=u.reduce(((t,e)=>t+Ef(e.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=_f.dist(n,s.C));const a=o*(1-r)/r,l=_f.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},E={x:i.x+(x-i.x)/(1-r),y:i.y+(_-i.y)/(1-r)};return new e(t,T,E,i)}static getUtils(){return _f}getUtils(){return e.getUtils()}static get PolyBezier(){return Tf}valueOf(){return this.toString()}toString(){return _f.pointsToString(this.points)}toSVG(){if(this._3d)return!1;const t=this.points,e=["M",t[0].x,t[0].y,2===this.order?"Q":"C"];for(let n=1,i=t.length;n<i;n++)e.push(t[n].x),e.push(t[n].y);return e.join(" ")}setRatios(t){if(t.length!==this.points.length)throw new Error("incorrect number of ratio values");this.ratios=t,this._lut=[]}verify(){const t=this.coordDigest();t!==this._print&&(this._print=t,this.update())}coordDigest(){return this.points.map((function(t,e){return""+e+t.x+t.y+(t.z?t.z:0)})).join("")}update(){this._lut=[],this.dpoints=_f.derive(this.points,this._3d),this.computedirection()}computedirection(){const t=this.points,e=_f.angle(t[0],t[this.order],t[1]);this.clockwise=e>0}length(){return _f.length(this.derivative.bind(this))}static getABC(t=2,e,n,i,r=.5){const o=_f.projectionratio(r,t),s=1-o,a={x:o*e.x+s*i.x,y:o*e.y+s*i.y},l=_f.abcratio(r,t);return{A:{x:n.x+(n.x-a.x)/l,y:n.y+(n.y-a.y)/l},B:n,C:a,S:e,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(t){if(this.verify(),t=t||100,this._lut.length===t+1)return this._lut;this._lut=[],t++,this._lut=[];for(let e,n,i=0;i<t;i++)n=i/(t-1),e=this.compute(n),e.t=n,this._lut.push(e);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],_f.dist(t,e)<n&&(r.push(t),s+=o/i.length);return!!r.length&&(t/=r.length)}project(t){const e=this.getLUT(),n=e.length-1,i=_f.closest(e,t),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 e;u<s+a;u+=a)l=this.compute(u),e=_f.dist(t,l),e<c&&(c=e,d=u);return d=d<0?0:d>1?1:d,l=this.compute(d),l.t=d,l.d=c,l}get(t){return this.compute(t)}point(t){return this.points[t]}compute(t){return this.ratios?_f.computeWithRatios(t,this.points,this.ratios,this._3d):_f.compute(t,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(t){return _f.compute(t,this.dpoints[0],this._3d)}dderivative(t){return _f.compute(t,this.dpoints[1],this._3d)}align(){let t=this.points;return new e(_f.align(t,{p1:t[0],p2:t[t.length-1]}))}curvature(t){return _f.curvature(t,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return _f.inflections(this.points)}normal(t){return this._3d?this.__normal3(t):this.__normal2(t)}__normal2(t){const e=this.derivative(t),n=Ff(e.x*e.x+e.y*e.y);return{t:t,x:-e.y/n,y:e.x/n}}__normal3(t){const e=this.derivative(t),n=this.derivative(t+.01),i=Ff(e.x*e.x+e.y*e.y+e.z*e.z),r=Ff(n.x*n.x+n.y*n.y+n.z*n.z);e.x/=i,e.y/=i,e.z/=i,n.x/=r,n.y/=r,n.z/=r;const o={x:n.y*e.z-n.z*e.y,y:n.z*e.x-n.x*e.z,z:n.x*e.y-n.y*e.x},s=Ff(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:t,x:a[0]*e.x+a[1]*e.y+a[2]*e.z,y:a[3]*e.x+a[4]*e.y+a[5]*e.z,z:a[6]*e.x+a[7]*e.y+a[8]*e.z}}hull(t){let e=this.points,n=[],i=[],r=0;for(i[r++]=e[0],i[r++]=e[1],i[r++]=e[2],3===this.order&&(i[r++]=e[3]);e.length>1;){n=[];for(let o,s=0,a=e.length-1;s<a;s++)o=_f.lerp(t,e[s],e[s+1]),i[r++]=o,n.push(o);e=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=_f.map(0,0,1,this._t1,this._t2),r.left._t2=_f.map(t,0,1,this._t1,this._t2),r.right._t1=_f.map(t,0,1,this._t1,this._t2),r.right._t2=_f.map(1,0,1,this._t1,this._t2),n?(n=_f.map(n,t,1,0,1),r.right.split(n).left):r}extrema(){const t={};let e=[];return this.dims.forEach(function(n){let i=function(t){return t[n]},r=this.dpoints[0].map(i);t[n]=_f.droots(r),3===this.order&&(r=this.dpoints[1].map(i),t[n]=t[n].concat(_f.droots(r))),t[n]=t[n].filter((function(t){return t>=0&&t<=1})),e=e.concat(t[n].sort(_f.numberSort))}.bind(this)),t.values=e.sort(_f.numberSort).filter((function(t,n){return e.indexOf(t)===n})),t}bbox(){const t=this.extrema(),e={};return this.dims.forEach(function(n){e[n]=_f.getminmax(this,n,t[n])}.bind(this)),e}overlaps(t){const e=this.bbox(),n=t.bbox();return _f.bboxoverlap(e,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 t=_f.angle(this.points[0],this.points[3],this.points[1]),e=_f.angle(this.points[0],this.points[3],this.points[2]);if(t>0&&e<0||t<0&&e>0)return!1}const t=this.normal(0),e=this.normal(1);let n=t.x*e.x+t.y*e.y;return this._3d&&(n+=t.z*e.z),Ef(Mf(n))<Cf/3}reduce(){let t,e,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],t=1;t<a.length;t++)i=a[t],e=this.split(n,i),e._t1=n,e._t2=i,o.push(e),n=i;return o.forEach((function(t){for(n=0,i=0;i<=1;)for(i=n+r;i<=1.01;i+=r)if(e=t.split(n,i),!e.simple()){if(i-=r,Ef(n-i)<r)return[];e=t.split(n,i),e._t1=_f.map(n,0,1,t._t1,t._t2),e._t2=_f.map(i,0,1,t._t1,t._t2),s.push(e),n=i;break}n<1&&(e=t.split(n,1),e._t1=_f.map(n,0,1,t._t1,t._t2),e._t2=t._t2,s.push(e))})),s}translate(t,n,i){i="number"==typeof i?i:n;const r=this.order;let o=this.points.map(((t,e)=>(1-e/r)*n+e/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=_f.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(t){const e=c[t*n]=_f.copy(o[t*n]);e.x+=(t?a:s)*l[t].n.x,e.y+=(t?a:s)*l[t].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=Ff(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((t=>{if(2===n&&t)return;const e=c[t*n],i=this.derivative(t),r={x:e.x+i.x,y:e.y+i.y};c[t+1]=_f.lli4(e,r,u,o[t+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=_f.makeline(h[2],d[0]),p=_f.makeline(d[2],h[0]),m=[f,new e(d),p,new e(h)];return new Tf(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(t,e,n,i,r){return function(o){const s=i/n,a=(i+r)/n,l=e-t;return _f.map(o,0,1,t+s*l,t+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(t){return l=t.points,l[3]?t.points=[l[3],l[2],l[1],l[0]]:t.points=[l[2],l[1],l[0]],t})).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=_f.makeline(v,p),b=_f.makeline(m,g),k=[y].concat(a).concat([b]).concat(c);return new Tf(k)}outlineshapes(t,e,n){e=e||t;const i=this.outline(t,e).curves,r=[];for(let t=1,e=i.length;t<e/2;t++){const o=_f.makeshape(i[t],i[e-t],n);o.startcap.virtual=t>1,o.endcap.virtual=t<e/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(t){const e=If(t.p1.x,t.p2.x),n=If(t.p1.y,t.p2.y),i=Sf(t.p1.x,t.p2.x),r=Sf(t.p1.y,t.p2.y);return _f.roots(this.points,t).filter((t=>{var o=this.get(t);return _f.between(o.x,e,i)&&_f.between(o.y,n,r)}))}selfintersects(t){const e=this.reduce(),n=e.length-2,i=[];for(let r,o,s,a=0;a<n;a++)o=e.slice(a,a+1),s=e.slice(a+2),r=this.curveintersects(o,s,t),i.push(...r);return i}curveintersects(t,e,n){const i=[];t.forEach((function(t){e.forEach((function(e){t.overlaps(e)&&i.push({left:t,right:e})}))}));let r=[];return i.forEach((function(t){const e=_f.pairiteration(t.left,t.right,n);e.length>0&&(r=r.concat(e))})),r}arcs(t){return t=t||.5,this._iterate(t,[])}_error(t,e,n,i){const r=(i-n)/4,o=this.get(n+r),s=this.get(i-r),a=_f.dist(t,e),l=_f.dist(t,o),c=_f.dist(t,s);return Ef(l-a)+Ef(c-a)}_iterate(t,e){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=_f.getccenter(u,o,s),a.interval={start:i,end:r},d=this._error(a,u,i,r)<=t,c=h&&!d,c||(p=r),d){if(r>=1){if(a.interval.end=p=1,l=a,r>1){let t={x:a.x+a.r*Af(a.e),y:a.y+a.r*Nf(a.e)};a.e+=_f.angle({x:a.x,y:a.y},t,this.get(1))}break}r+=(r-i)/2}else r=f}while(!c&&n++<100);if(n>=100)break;l=l||a,e.push(l),i=p}while(r<1);return e}};var Pf={pointsToCurve:function(t,e){let n=1/e;if(0===t.length){let t=[];for(let i=0;i<e;i++){let e=i*n;t.push({x:e,y:.5})}return t}if(1===t.length){let i=t[0].y,r=[{x:0,y:i}];for(let t=0;t<e;t++){let e=t*n+n;r.push({x:e,y:i})}return r}let i=[],r=t[0],o=t[t.length-1],s=new Of({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 Of(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 e=0;e<t.length-1;e++){let n=t[e],r=t[e+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 Of(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 t=0;t<e;t++){let e,r=t*n+n;i.every((t=>{let n=t.intersects({p1:{x:r,y:0},p2:{x:r,y:1}});return!(n.length>0&&(e=t.get(n[0]),l.push(e),1))}))}return l}};class Rf{constructor(t,e){this.xs=t,this.ys=e,this.ks=this.getNaturalKs(new Float64Array(this.xs.length))}getNaturalKs(t){const e=this.xs.length-1,n=function(t,e){const n=[];for(let i=0;i<t;i++)n.push(new Float64Array(e));return n}(e+1,e+2);for(let t=1;t<e;t++)n[t][t-1]=1/(this.xs[t]-this.xs[t-1]),n[t][t]=2*(1/(this.xs[t]-this.xs[t-1])+1/(this.xs[t+1]-this.xs[t])),n[t][t+1]=1/(this.xs[t+1]-this.xs[t]),n[t][e+1]=3*((this.ys[t]-this.ys[t-1])/((this.xs[t]-this.xs[t-1])*(this.xs[t]-this.xs[t-1]))+(this.ys[t+1]-this.ys[t])/((this.xs[t+1]-this.xs[t])*(this.xs[t+1]-this.xs[t])));return n[0][0]=2/(this.xs[1]-this.xs[0]),n[0][1]=1/(this.xs[1]-this.xs[0]),n[0][e+1]=3*(this.ys[1]-this.ys[0])/((this.xs[1]-this.xs[0])*(this.xs[1]-this.xs[0])),n[e][e-1]=1/(this.xs[e]-this.xs[e-1]),n[e][e]=2/(this.xs[e]-this.xs[e-1]),n[e][e+1]=3*(this.ys[e]-this.ys[e-1])/((this.xs[e]-this.xs[e-1])*(this.xs[e]-this.xs[e-1])),function(t,e){const n=t.length;let i=0,r=0;for(;i<n&&r<=n;){let e=0,o=-1/0;for(let s=i;s<n;s++){const n=Math.abs(t[s][r]);n>o&&(e=s,o=n)}if(0===t[e][r])r++;else{Df(t,i,e);for(let e=i+1;e<n;e++){const o=t[e][r]/t[i][r];t[e][r]=0;for(let s=r+1;s<=n;s++)t[e][s]-=t[i][s]*o}i++,r++}}for(let i=n-1;i>=0;i--){var o=0;t[i][i]&&(o=t[i][n]/t[i][i]),e[i]=o;for(let e=i-1;e>=0;e--)t[e][n]-=t[e][i]*o,t[e][i]=0}return e}(n,t)}getIndexBefore(t){let e=0,n=this.xs.length,i=0;for(;e<n;)i=Math.floor((e+n)/2),this.xs[i]<t&&i!==e?e=i:n=this.xs[i]>=t&&i!==n?i:e;return e===this.xs.length-1?this.xs.length-1:e+1}at(t){let e=this.getIndexBefore(t);const n=(t-this.xs[e-1])/(this.xs[e]-this.xs[e-1]),i=this.ks[e-1]*(this.xs[e]-this.xs[e-1])-(this.ys[e]-this.ys[e-1]),r=-this.ks[e]*(this.xs[e]-this.xs[e-1])+(this.ys[e]-this.ys[e-1]);return(1-n)*this.ys[e-1]+n*this.ys[e]+n*(1-n)*(i*(1-n)+r*n)}}function Df(t,e,n){let i=t[e];t[e]=t[n],t[n]=i}function Lf(t,e,n){const i=n[0],r=n[n.length-1];if(t<i.x)return i.y;if(t>r.x)return r.y;const o=e.at(t);return Math.max(0,Math.min(o,1))}var Bf={pointsToCurve:function(t,e){if(!Array.isArray(t)||!t.every((t=>"object"==typeof t&&"number"==typeof t.x&&"number"==typeof t.y&&t.x>=0&&t.x<=1&&t.y>=0&&t.y<=1)))throw new Error("[pointsToCurve] Invalid points. Expected array of objects with x and y in [0, 1] range.");if(!("number"==typeof e&&e>=1))throw new Error(`[pointsToCurve] Invalid resolution: ${e}. Expected integer >= 1.`);const n=t.map((t=>t.x)),i=t.map((t=>t.y)),r=new Rf(n,i);let o=[];for(let n=0;n<e;n++)o.push(Lf(n/(e-1),r,t));return o}};function zf(t,e=256,n={}){return"bezier"===n.type?Pf.pointsToCurve(t,e,n):Bf.pointsToCurve(t,e)}const Wf=[];for(let t=0;t<256;t++)Wf[t]=t;class $f extends Vh{constructor(t){const e={vertex:af,fragment:lf},n={uniforms:Vh.getUniformInfo($f)};super($f.getFilterType(),e,n,t)}static getFilterType(){return"curves"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=[];var n;e=[...t.master||t.points||t.masterPoints?t.master||(n=t.points||t.masterPoints,zf(n,256).map((t=>255*t))):Wf],this.uniforms[Bh.STATIC_OPTIONS].set(e)}}function jf(t,e,n){if("number"!=typeof t||t<0||t>255)throw new Error(`[levels] Invalid black point: ${t}. Expected integer between 0 and 255`);if("number"!=typeof e||e<0||e>255)throw new Error(`[levels] Invalid white point: ${e}. 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(t>e)throw new Error(`[levels] Invalid black and white points: ${t}, ${e}. Expected black <= white`);let i=[];for(let r=0;r<256;r++){let o;o=r<=t?0:r>=e?255:255*Math.pow((r-t)/(e-t),1/n),i[r]=o}return i}class Uf extends Vh{constructor(t){const e={vertex:af,fragment:lf},n={uniforms:Vh.getUniformInfo(Uf)};super(Uf.getFilterType(),e,n,t)}static getFilterType(){return"levels"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=[...jf(t.black,t.white,t.gamma)];this.uniforms[Bh.STATIC_OPTIONS].set(e)}}const qf=360,Vf=[];for(let t=0;t<qf;t++)Vf[t]=t;class Gf extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(Gf)};super(Gf.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"},e,t)}static getFilterType(){return"hue"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=t.points&&function(t){return zf(t,qf,{type:"bezier"}).map((t=>{return e=t,((Math.round(e.x*qf)+180)%qf+(1-e.y-.5)*qf+qf)%qf;var e}))}(t.points)||Vf;this.uniforms[Bh.STATIC_OPTIONS].set(e)}}class Hf extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(Hf)};super(Hf.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"},e,t)}static getFilterType(){return"whiteBalance"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=t.temperature?t.temperature:0,n=t.tint?t.tint:0;this.uniforms[Bh.STATIC_OPTIONS].set([e,n])}}class Kf extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(Kf)};super(Kf.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"},e,t)}static getFilterType(){return"vibrance"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=t.amount?t.amount/100*2:0,n=null===t.redBalance?1:t.redBalance,i=null===t.greenBalance?1:t.greenBalance,r=null===t.blueBalance?1:t.blueBalance;this.uniforms[Bh.STATIC_OPTIONS].set([e,n,i,r])}}class Xf extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(Xf)};super(Xf.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"},e,t)}static getFilterType(){return"saturation"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=null===t.amount?1:t.amount;this.uniforms[Bh.STATIC_OPTIONS].set([e])}}class Yf extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(Yf)};super(Yf.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}"},e,t)}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[Bh.FIRST_TEXTURE,Rh,Dh]}handleStaticUniforms(t){let e={...Yf.getInitialOptions(),...t};const n=Number.parseFloat(e.source.center.x).toFixed(5),i=Number.parseFloat(e.source.center.y).toFixed(5),r=Number.parseFloat(e.source.width).toFixed(5),o=Number.parseFloat(e.source.height).toFixed(5),s=Number.parseFloat(e.target.center.x).toFixed(5),a=Number.parseFloat(e.target.center.y).toFixed(5),l=Number.parseFloat(e.target.width).toFixed(5),c=Number.parseFloat(e.target.height).toFixed(5),u=Number.parseFloat(e.edgeSoftness).toFixed(5),d=e.source.aspectRatio?Number.parseFloat(e.source.aspectRatio).toFixed(5):0;let h;h="fill"===e.fitType?0:"contain"===e.fitType?1:2;const f=Number.parseFloat(e.cornerRadius).toFixed(5);this.uniforms[Bh.STATIC_OPTIONS].set([n,i,r,o,s,a,l,c,h,f,d,u])}}class Qf extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(Qf)};super(Qf.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}"},e,t)}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(t){var e;const n=Number.parseFloat(t.color.r).toFixed(5),i=Number.parseFloat(t.color.g).toFixed(5),r=Number.parseFloat(t.color.b).toFixed(5),o=(null!==(e=Number.parseFloat(t.color.a))&&void 0!==e?e:1).toFixed(5);this.uniforms[Bh.STATIC_OPTIONS].set([n,i,r,o])}}class Jf extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(Jf)};super(Jf.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"},e,t)}static getFilterType(){return"solidImage"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}}class Zf extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(Zf)};super(Zf.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"},e,t)}static getFilterType(){return"lab"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=t.temperature?t.temperature:0,n=t.tint?t.tint:0;this.uniforms[Bh.STATIC_OPTIONS].set([e,n])}}class tp extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(tp)};super(tp.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} "},e,t)}static getFilterType(){return"exposure"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=null===t.exposure?0:t.exposure;this.uniforms[Bh.STATIC_OPTIONS].set([e])}}var ep,np,ip,rp,op,sp,ap,lp;function cp(){if(rp)return ip;rp=1;const t=np?ep:(np=1,ep={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]}),e={};for(const n of Object.keys(t))e[t[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"]}};ip=n;for(const t of Object.keys(n)){if(!("channels"in n[t]))throw new Error("missing channels property: "+t);if(!("labels"in n[t]))throw new Error("missing channel labels property: "+t);if(n[t].labels.length!==n[t].channels)throw new Error("channel and label counts mismatch: "+t);const{channels:e,labels:i}=n[t];delete n[t].channels,delete n[t].labels,Object.defineProperty(n[t],"channels",{value:e}),Object.defineProperty(n[t],"labels",{value:i})}function i(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}return n.rgb.hsl=function(t){const e=t[0]/255,n=t[1]/255,i=t[2]/255,r=Math.min(e,n,i),o=Math.max(e,n,i),s=o-r;let a,l;o===r?a=0:e===o?a=(n-i)/s:n===o?a=2+(i-e)/s:i===o&&(a=4+(e-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(t){let e,n,i,r,o;const s=t[0]/255,a=t[1]/255,l=t[2]/255,c=Math.max(s,a,l),u=c-Math.min(s,a,l),d=function(t){return(c-t)/6/u+.5};return 0===u?(r=0,o=0):(o=u/c,e=d(s),n=d(a),i=d(l),s===c?r=i-n:a===c?r=1/3+e-i:l===c&&(r=2/3+n-e),r<0?r+=1:r>1&&(r-=1)),[360*r,100*o,100*c]},n.rgb.hwb=function(t){const e=t[0],i=t[1];let r=t[2];const o=n.rgb.hsl(t)[0],s=1/255*Math.min(e,Math.min(i,r));return r=1-1/255*Math.max(e,Math.max(i,r)),[o,100*s,100*r]},n.rgb.cmyk=function(t){const e=t[0]/255,n=t[1]/255,i=t[2]/255,r=Math.min(1-e,1-n,1-i);return[100*((1-e-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=e[n];if(r)return r;let o,s=1/0;for(const e of Object.keys(t)){const r=i(n,t[e]);r<s&&(s=r,o=e)}return o},n.keyword.rgb=function(e){return t[e]},n.rgb.xyz=function(t){let e=t[0]/255,n=t[1]/255,i=t[2]/255;return e=e>.04045?((e+.055)/1.055)**2.4:e/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*e+.3576*n+.1805*i),100*(.2126*e+.7152*n+.0722*i),100*(.0193*e+.1192*n+.9505*i)]},n.rgb.lab=function(t){const e=n.rgb.xyz(t);let i=e[0],r=e[1],o=e[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(t){const e=t[0]/360,n=t[1]/100,i=t[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 t=0;t<3;t++)o=e+1/3*-(t-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[t]=255*s;return l},n.hsl.hsv=function(t){const e=t[0];let n=t[1]/100,i=t[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,[e,100*(0===i?2*r/(o+r):2*n/(i+n)),(i+n)/2*100]},n.hsv.rgb=function(t){const e=t[0]/60,n=t[1]/100;let i=t[2]/100;const r=Math.floor(e)%6,o=e-Math.floor(e),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(t){const e=t[0],n=t[1]/100,i=t[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,[e,100*o,100*s]},n.hwb.rgb=function(t){const e=t[0]/360;let n=t[1]/100,i=t[2]/100;const r=n+i;let o;r>1&&(n/=r,i/=r);const s=Math.floor(6*e),a=1-i;o=6*e-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(t){const e=t[0]/100,n=t[1]/100,i=t[2]/100,r=t[3]/100;return[255*(1-Math.min(1,e*(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(t){const e=t[0]/100,n=t[1]/100,i=t[2]/100;let r,o,s;return r=3.2406*e+-1.5372*n+-.4986*i,o=-.9689*e+1.8758*n+.0415*i,s=.0557*e+-.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(t){let e=t[0],n=t[1],i=t[2];return e/=95.047,n/=100,i/=108.883,e=e>.008856?e**(1/3):7.787*e+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*(e-n),200*(n-i)]},n.lab.xyz=function(t){let e,n,i;n=(t[0]+16)/116,e=t[1]/500+n,i=n-t[2]/200;const r=n**3,o=e**3,s=i**3;return n=r>.008856?r:(n-16/116)/7.787,e=o>.008856?o:(e-16/116)/7.787,i=s>.008856?s:(i-16/116)/7.787,e*=95.047,n*=100,i*=108.883,[e,n,i]},n.lab.lch=function(t){const e=t[0],n=t[1],i=t[2];let r;return r=360*Math.atan2(i,n)/2/Math.PI,r<0&&(r+=360),[e,Math.sqrt(n*n+i*i),r]},n.lch.lab=function(t){const e=t[0],n=t[1],i=t[2]/360*2*Math.PI;return[e,n*Math.cos(i),n*Math.sin(i)]},n.rgb.ansi16=function(t,e=null){const[i,r,o]=t;let s=null===e?n.rgb.hsv(t)[2]:e;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(t){return n.rgb.ansi16(n.hsv.rgb(t),t[2])},n.rgb.ansi256=function(t){const e=t[0],n=t[1],i=t[2];return e===n&&n===i?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(n/255*5)+Math.round(i/255*5)},n.ansi16.rgb=function(t){let e=t%10;if(0===e||7===e)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];const n=.5*(1+~~(t>50));return[(1&e)*n*255,(e>>1&1)*n*255,(e>>2&1)*n*255]},n.ansi256.rgb=function(t){if(t>=232){const e=10*(t-232)+8;return[e,e,e]}let e;return t-=16,[Math.floor(t/36)/5*255,Math.floor((e=t%36)/6)/5*255,e%6/5*255]},n.rgb.hex=function(t){const e=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(e.length)+e},n.hex.rgb=function(t){const e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let n=e[0];3===e[0].length&&(n=n.split("").map((t=>t+t)).join(""));const i=parseInt(n,16);return[i>>16&255,i>>8&255,255&i]},n.rgb.hcg=function(t){const e=t[0]/255,n=t[1]/255,i=t[2]/255,r=Math.max(Math.max(e,n),i),o=Math.min(Math.min(e,n),i),s=r-o;let a,l;return a=s<1?o/(1-s):0,l=s<=0?0:r===e?(n-i)/s%6:r===n?2+(i-e)/s:4+(e-n)/s,l/=6,l%=1,[360*l,100*s,100*a]},n.hsl.hcg=function(t){const e=t[1]/100,n=t[2]/100,i=n<.5?2*e*n:2*e*(1-n);let r=0;return i<1&&(r=(n-.5*i)/(1-i)),[t[0],100*i,100*r]},n.hsv.hcg=function(t){const e=t[1]/100,n=t[2]/100,i=e*n;let r=0;return i<1&&(r=(n-i)/(1-i)),[t[0],100*i,100*r]},n.hcg.rgb=function(t){const e=t[0]/360,n=t[1]/100,i=t[2]/100;if(0===n)return[255*i,255*i,255*i];const r=[0,0,0],o=e%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(t){const e=t[1]/100,n=e+t[2]/100*(1-e);let i=0;return n>0&&(i=e/n),[t[0],100*i,100*n]},n.hcg.hsl=function(t){const e=t[1]/100,n=t[2]/100*(1-e)+.5*e;let i=0;return n>0&&n<.5?i=e/(2*n):n>=.5&&n<1&&(i=e/(2*(1-n))),[t[0],100*i,100*n]},n.hcg.hwb=function(t){const e=t[1]/100,n=e+t[2]/100*(1-e);return[t[0],100*(n-e),100*(1-n)]},n.hwb.hcg=function(t){const e=t[1]/100,n=1-t[2]/100,i=n-e;let r=0;return i<1&&(r=(n-i)/(1-i)),[t[0],100*i,100*r]},n.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},n.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},n.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},n.gray.hsl=function(t){return[0,0,t[0]]},n.gray.hsv=n.gray.hsl,n.gray.hwb=function(t){return[0,100,t[0]]},n.gray.cmyk=function(t){return[0,0,0,t[0]]},n.gray.lab=function(t){return[t[0],0,0]},n.gray.hex=function(t){const e=255&Math.round(t[0]/100*255),n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n},n.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]},ip}function up(){if(sp)return op;sp=1;const t=cp();function e(t,e){return function(n){return e(t(n))}}function n(n,i){const r=[i[n].parent,n];let o=t[i[n].parent][n],s=i[n].parent;for(;i[s].parent;)r.unshift(i[s].parent),o=e(t[i[s].parent][s],o),s=i[s].parent;return o.conversion=r,o}return op=function(e){const i=function(e){const n=function(){const e={},n=Object.keys(t);for(let t=n.length,i=0;i<t;i++)e[n[i]]={distance:-1,parent:null};return e}(),i=[e];for(n[e].distance=0;i.length;){const e=i.pop(),r=Object.keys(t[e]);for(let t=r.length,o=0;o<t;o++){const t=r[o],s=n[t];-1===s.distance&&(s.distance=n[e].distance+1,s.parent=e,i.unshift(t))}}return n}(e),r={},o=Object.keys(i);for(let t=o.length,e=0;e<t;e++){const t=o[e];null!==i[t].parent&&(r[t]=n(t,i))}return r}}var dp=function(){if(lp)return ap;lp=1;const t=cp(),e=up(),n={};return Object.keys(t).forEach((i=>{n[i]={},Object.defineProperty(n[i],"channels",{value:t[i].channels}),Object.defineProperty(n[i],"labels",{value:t[i].labels});const r=e(i);Object.keys(r).forEach((t=>{const e=r[t];n[i][t]=function(t){const e=function(...e){const n=e[0];if(null==n)return n;n.length>1&&(e=n);const i=t(e);if("object"==typeof i)for(let t=i.length,e=0;e<t;e++)i[e]=Math.round(i[e]);return i};return"conversion"in t&&(e.conversion=t.conversion),e}(e),n[i][t].raw=function(t){const e=function(...e){const n=e[0];return null==n?n:(n.length>1&&(e=n),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}(e)}))})),ap=n}(),hp=Du(dp);class fp extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(fp)};super(fp.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}"},e,t)}static getFilterType(){return"hardLight"}static getInputsCount(){return 1}static getInitialOptions(){return{color:"4b0082"}}getOptionsDisplay(){return[{properties:["color"],type:"colorPicker"}]}handleStaticUniforms(t){const e=hp.hex.rgb(t.color).map((t=>t/255));this.uniforms[Bh.STATIC_OPTIONS].set([e[0],e[1],e[2]])}}class pp extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(pp)};super(pp.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"},e,t)}static getFilterType(){return"exposureTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{properties:{power:{form:0,to:0,ease:[0,0,1,1]}}}}handleStaticUniforms(t){const e=t.properties.power;this.uniforms[Bh.STATIC_OPTIONS].set([e.from,e.to,...e.ease])}static getUniformList(){return[Bh.FIRST_TEXTURE,Lh]}}class mp extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(mp)};super(mp.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}"},e,t)}static getFilterType(){return"dipToBlackTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{}}handleStaticUniforms(t){const e=t.properties.power;this.uniforms[Bh.STATIC_OPTIONS].set([e.from,e.to,...e.ease])}static getUniformList(){return[Bh.FIRST_TEXTURE,Lh]}}class vp extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(vp)};super(vp.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}"},e,t)}static getFilterType(){return"transformTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{}}handleStaticUniforms(t){const e=t.properties.scale||{},n=t.properties.translate||{};e.ease=e.ease||[0,0,1,1],n.ease=n.ease||[0,0,1,1],this.uniforms[Bh.STATIC_OPTIONS].set([e.from&&e.from.x||1,e.to&&e.to.x||1,e.from&&e.from.y||1,e.to&&e.to.y||1,...e.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[Bh.FIRST_TEXTURE,Lh]}}class gp extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(gp)};super(gp.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}"},e,t)}static getFilterType(){return"motionBlurTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{}}handleStaticUniforms(t){const e=t.properties.power||{from:0,to:0},n=t.properties.direction||{x:0,y:0};e.ease=e.ease||[0,0,1,1],this.uniforms[Bh.STATIC_OPTIONS].set([e.from,e.to,...e.ease,n.x,n.y])}static getUniformList(){return[Bh.FIRST_TEXTURE,Lh,Rh]}}class yp extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(yp)};super(yp.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}"},e,t)}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(t){const e=t.properties.power||{from:0,to:0};e.ease=e.ease||[0,0,1,1];const n=t.properties.color,i=hp.hex.rgb(n).map((t=>t/255));this.uniforms[Bh.STATIC_OPTIONS].set([e.from,e.to,...e.ease,i[0],i[1],i[2]])}static getUniformList(){return[Bh.FIRST_TEXTURE,Lh]}}var bp=Object.freeze({__proto__:null,Crop:Yf,Curves:$f,Default:class t extends Vh{constructor(e){const n={uniforms:Vh.getUniformInfo(t)};super(t.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,e)}static getFilterType(){return"__default"}static getInputsCount(){return 1}static getInitialOptions(){return{}}},DipToBlackTransition:mp,DirectionalBlur:ef,Exposure:tp,ExposureTransition:pp,FadeToColorTransition:yp,FastBlur:tf,HardLight:fp,HorizontalBlur:Jh,Hue:Gf,Lab:Zf,Levels:Uf,Lut:sf,MotionBlurTransition:gp,Opacity:nf,Saturation:Xf,ShapeComposite:of,ShapeCompositeMask:rf,Solid:Qf,SolidImage:Jf,Transform:Qh,TransformTransition:vp,VerticalBlur:Zh,Vibrance:Kf,WhiteBalance:Hf});const kp=Object.values(bp).reduce(((t,e)=>(t[e.getFilterType()]=e,t)),{});class wp{constructor(t){this.context=t}static getFilterClass(t){return kp[t]}getFilterIds(){return Object.keys(this.filterTypeToInstanceMap)}create(t,e){this.context={...this.context,options:e.options};const n=new kp[t](this.context);if(!n)throw new Error(`${t} is not a atom filter, atomFilter list: `,this.getFilterIds());return n}}const xp=Ld.PREVIOUS_OUTPUT_PREFIX,_p=Object.values(bp).reduce(((t,e)=>(t[e.getFilterType()]={type:e.getFilterType(),options:e.getInitialOptions(),inputs:[...Array(e.getInputsCount())].map(((t,e)=>`${xp}${e}`)),outputs:[]},t)),{});var Tp,Ep,Ip=function(){if(Ep)return Tp;Ep=1;var t=function(t){return function(t){return!!t&&"object"==typeof t}(t)&&(n=t,!("[object RegExp]"===(i=Object.prototype.toString.call(n))||"[object Date]"===i||n.$$typeof===e));var n,i},e="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(t,e){return!1!==e.clone&&e.isMergeableObject(t)?s((n=t,Array.isArray(n)?[]:{}),t,e):t;var n}function i(t,e,i){return t.concat(e).map((function(t){return n(t,i)}))}function r(t){return Object.keys(t).concat((e=t,Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]));var e}function o(t,e){try{return e in t}catch(t){return!1}}function s(e,a,l){(l=l||{}).arrayMerge=l.arrayMerge||i,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=n;var c=Array.isArray(a);return c===Array.isArray(e)?c?l.arrayMerge(e,a,l):function(t,e,i){var a={};return i.isMergeableObject(t)&&r(t).forEach((function(e){a[e]=n(t[e],i)})),r(e).forEach((function(r){var l,c;o(l=t,c=r)&&(!Object.hasOwnProperty.call(l,c)||!Object.propertyIsEnumerable.call(l,c))||(o(t,r)&&i.isMergeableObject(e[r])?a[r]=function(t,e){if(!e.customMerge)return s;var n=e.customMerge(t);return"function"==typeof n?n:s}(r,i)(t[r],e[r],i):a[r]=n(e[r],i))})),a}(e,a,l):n(a,l)}return s.all=function(t,e){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce((function(t,n){return s(t,n,e)}),{})},Tp=s}(),Sp=Du(Ip),Ap=function(t,e){return Sp(t,e,{arrayMerge:(t,e)=>e})};const Np=Ld.MESSAGES.UPDATE_OPTIONS;let Mp=class{constructor(t,e){this.eventEmitter=new jd,this.type=t,this.inputs=e.inputs,this.outputs=e.outputs,this.options=e.options}render(){throw new Error("concrete class should implement")}_updateOptions(){throw new Error("concrete class should implement")}updateOptions(t){this._updateOptions(t),this.eventEmitter.emit(Np,this.options)}updateInputs(t){t&&(this.inputs.length===t.length&&this.inputs.every(((e,n)=>e===t[n]))||(this.inputs=[...t]))}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 Fp extends Mp{constructor(t,e,n){super(...arguments),this.filter=n.filterFactory.create(this.type,{options:this.options})}render(t){const e=t.ioStore,n=t.graphIOManager,i=this.getInputs(),r=this.getOutputs(),o=e.get(i),s=this.filter.render(o,this.options);return n.setOutputs(e,r,s),s}_updateOptions(t){this.options=Ap(this.options,t),this.filter.updateStaticUniforms(this.options)}dispose(){this.filter.dispose()}}const Cp=Ld.MESSAGES.UPDATE_OPTIONS;class Op extends Fp{constructor(t,e,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}baseNodeUpdateOptions(t){this.options=Ap(this.options,t),this.filter.updateStaticUniforms(this.options)}registerListeners(){this.baseNode.getEventEmitter().on(Cp,this.baseNodeUpdateOptions,this)}dispose(){this.filter.dispose(),this.baseNode.getEventEmitter().off(Cp,this.baseNodeUpdateOptions,this)}}function Pp(t){return null!==t&&"object"==typeof t}function Rp(t){if(!Pp(t)||(e=t,Array.isArray(e)))return t;var e;const n=Object.keys(t).sort(),i={};return n.forEach((e=>{i[e]=Rp(t[e])})),i}function Dp(t,e){return null!=t&&t.id&&null!=e&&e.id?t.type===e.type&&t.id===e.id:t.type===e.type}function Lp(t,e){const n=[];t.forEach(((t,i)=>{const r=(o=t,e.findIndex((t=>function(t,e){const n=JSON.parse(JSON.stringify(t));return r=JSON.parse(JSON.stringify(e)),Pp(i=n)&&Pp(r)?JSON.stringify(Rp(i))===JSON.stringify(Rp(r)):!(!Number.isNaN(i)||!Number.isNaN(r))||i===r;var i,r}(o,t))));var o;if(-1!==r)return void n.push({type:"take",index:r});const s=(a=t,l=i,(c=e)&&c[l]&&Dp(a,c[l])?l:c.findIndex((t=>Dp(a,t))));var a,l,c;-1===s?n.push({type:"create",newGraphIndex:i}):n.push({type:"update",currentGraphIndex:s,newGraphIndex:i})}));const i=n.reduce(((t,e)=>("take"===e.type?t.push(e.index):"update"===e.type&&t.push(e.currentGraphIndex),t)),[]);return e.reduce(((t,e,n)=>(i.includes(n)||t.push(n),t)),[]).forEach((t=>{n.push({type:"dispose",currentGraphIndex:t})})),n}function Bp(t,e,n,i){const r=[];return t.forEach((t=>{switch(t.type){case"take":r.push(n[t.index]);break;case"update":const o=e[t.newGraphIndex].options,s=n[t.currentGraphIndex];s.updateInputs(e[t.newGraphIndex].inputs),s.updateOptions(o),r.push(s);break;case"create":const a=Yp.create(e[t.newGraphIndex],i);r.push(a);break;case"dispose":n[t.currentGraphIndex].dispose();break;default:throw new Error("cant apply action type: ",t.type)}})),r}var zp=function(t,e,n,i){const r=t.graph,o=e.graph;if(!(o&&r&&Array.isArray(o)&&Array.isArray(r)))throw new Error("cant apply new composite options",t);return Bp(Lp(r,o),r,n,i)};class Wp extends Mp{constructor(t,e,n){super(...arguments),this.context=n,this.nodes=this.createNodes(this.options)}createNodes(t){if(!t||!t.graph)throw new Error("cant create composite node, please supply info.options.graph");return t.graph.map((t=>Yp.create(t,this.context)))}render(t){const e=t.ioStore,n=t.graphIOManager;let i=n.getPrevOutput(e);const r=this.outputs;if(this.nodes.length){const t=new Kd(e),r="__PREVIOUS:0",o=[],s=new Set;this.nodes.forEach(((e,a)=>{const l={ioStore:t,graphIOManager:n},c=e.getOutputs?e.getOutputs():void 0,u=Array.isArray(c)?c:[],d={};u.forEach((e=>{d[e]=t.get(e)}));const h=t.get(r);i=e.render(l),a!==this.nodes.length-1&&o.push(i);const f=new Set;if(h&&h!==i&&f.add(h),u.forEach((t=>{const e=d[t];e&&e!==i&&f.add(e)})),f.size){const e=new Set(Object.values(t.get()));f.forEach((t=>{e.has(t)||(n.disposeTextures([t],i),s.add(t))}))}}));const a=o.filter((t=>!s.has(t)));n.disposeTextures(a,i)}return n.setOutputs(e,r,i),i}getOptionsDisplay(){return[]}_updateOptions(t){this.nodes=zp(t,this.options,this.nodes,this.context),this.options=t}dispose(){this.nodes.forEach((t=>{t.dispose()}))}}const $p=Ld.MESSAGES.UPDATE_OPTIONS;class jp extends Wp{constructor(t,e,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}registerListeners(){this.baseNode.getEventEmitter().on($p,this.updateOptions,this)}dispose(){this.nodes.forEach((t=>{t.dispose()})),this.baseNode.getEventEmitter().off($p,this.updateOptions,this)}}const Up=Ld.SYSTEM_NODES.TAGS.ATOM,qp=Ld.SYSTEM_NODES.TAGS.FILTER,Vp=Ld.SYSTEM_NODES.TAGS.COMPOSITE_FILTER,Gp=Ld.SYSTEM_NODES.TAGS.TRANSITION_FILTER,Hp=Ld.PREVIOUS_OUTPUT_PREFIX,Kp=Object.keys(_p);function Xp(t,e){const n=(i=t.type,_p[i]);var i;return t=Ap(n,t),new Fp(t.type,t,e)}var Yp={create:function(t,e){let n;switch(function(t){let e;return n=t,e=Kp.includes(n)?Up:t===Vp?Vp:t===Gp?Gp:qp,e;var n}((t=JSON.parse(JSON.stringify(t))).type)){case Up:n=Xp(t,e);break;case qp:n=function(t,e){const n=function(t,e){const n=e.get(t);if(!n)throw new Error(`no base node, cant resolve type: ${t}`);return n}(t.type,e.nodeStore),i=n.getType(),r=n.getInfo();let o;return t=Ap(r,t),e={...e,baseNode:n},o=i===Vp?new jp(i,t,e):new Op(i,t,e),o}(t,e);break;case Vp:n=function(t,e){const n=t.type;return t=Ap({inputs:[`${Hp}0`]},t),new Wp(n,t,e)}(t,e);break;case Gp:n=function(t,e){const n=t.options.filter;if(!n)throw new Error(`transition filter should supply base filter ${n}`);return t.type=`${n}Transition`,Xp(t,e)}(t,e);break;default:throw new Error("cant create node",t.type)}return n}};const Qp=Ld.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS;var Jp=function(t){const e={[Qp]:_p[Qp]};for(const[n,i]of Object.entries(e)){const e=Yp.create(i,t);t.nodeStore.set(n,e)}},Zp=function(t,e){for(const[n,i]of Object.entries(t)){const t=Yp.create(i,e);e.nodeStore.set(n,t)}};const tm=Ld.CAPTURED_FRAME_PREFIX;class em{constructor(t){return this.textureManager=t.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(t,e){e=e||0,this.currentFrameTextures[e].fill(t)}saveFrame(t){0!==this.saveInNextFrameTextures.length&&(this.saveInNextFrameTextures.forEach((e=>{e.fill(t)})),this.saveInNextFrameTextures=[])}capture(t,e){(t.videoHeight>150||t.displayHeight>150)&&(this.updateCurrentFrame(t,e),this.saveFrame(t))}createCaptureId(){const t=this.textureManager.createTexture({type:"frame"});this.saveInNextFrameTextures.push(t);const e=t.getUnit(),n=`${tm}${e}`;return this.savedFramesTextures[n]=t,this.reservedUnits.add(e),n}releaseCaptureId(t){if("string"!=typeof t)throw new Error("capture id should be string");delete this.saveInNextFrameTextures[t];const e=t.split(":")[1];this.reservedUnits.delete(parseInt(e,10))}getCurrentFrames(){return this.currentFrameTextures}getSavedFrames(){return this.savedFramesTextures}isReservedUnit(t){return this.reservedUnits.has(t)}}const nm=Zu("ShaderGraphApplication","warn"),im=Ld.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS,rm=Object.freeze({useCanvasSizedFilterTargets:!1,rebindAttributesOnProgramSwitch:!0,forwardContextAttributes:!0});function om(t={}){const e=null==t?void 0:t.performanceToggles;return e&&"object"==typeof e?{...rm,...e}:{...rm}}class sm{constructor(t,e={}){return this.glSource=t,this.config=e,this.performanceToggles=om(e),this.isContextLost=!1,this.isRecovering=!1,this.isDisposed=!1,this.pendingNodeOptionUpdates=new Map,this.doInit(t,e)}doInit(t,e){this.source=Gd(t),this.performanceToggles=om(e),this.isDisposed=!1,this.resetViewportSyncState(),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(t={},e=rm){const n=null!=t&&t.glOptions&&"object"==typeof t.glOptions?{...t.glOptions}:{},i=n.__shaderGraph&&"object"==typeof n.__shaderGraph?n.__shaderGraph:{};return{...n,__shaderGraph:{...i,forwardContextAttributes:!1!==e.forwardContextAttributes}}}(e,this.performanceToggles);return this.gl=this.source.init(this.setSrcVidTracks,this.resizeCanvasSize,n),this.addCanvasListeners(),this.addSourceListeners(),this.exposeDebugGlobalIfBrowser(),this.selectedRenderNode=null,this.setupRenderInfrastructure(t,e),e.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)}}exposeDebugGlobalIfBrowser(){"undefined"!=typeof window&&(window.ekoShaderGraph=this)}setupRenderInfrastructure(t,e){this.activeTextures=this.activeTextures||new Set,this.textureManager=new nh({gl:this.gl,activeTextures:this.activeTextures}),this.capturedFramesManager=new em({textureManager:this.textureManager}),this.graphIOManager=new uh({glSource:t,gl:this.gl,textureManager:this.textureManager,capturedFramesManager:this.capturedFramesManager}),this.frameBufferFactory=new gh({gl:this.gl,textureManager:this.textureManager,useCanvasSizedFilterTargets:this.performanceToggles.useCanvasSizedFilterTargets}),this.filterFactory=new wp({gl:this.gl,frameBufferFactory:this.frameBufferFactory,rebindAttributesOnProgramSwitch:this.performanceToggles.rebindAttributesOnProgramSwitch}),this.nodeStore=new Kd,this.ioStore=new Kd,Jp({nodeStore:this.nodeStore,filterFactory:this.filterFactory}),this.addClientNodes(e.nodes,this.isRecovering)}getNodes(){return nm.debug("[getNodes]"),this.nodeStore.get()}addClientNodes(t,e=!1){if(nm.debug("[addClientNodes]",t),t&&!e&&(this.addClientNodeInvocations=this.addClientNodeInvocations||[],this.addClientNodeInvocations.push(t)),!e&&this.isContextUnavailable())return;t=t||{};const n=JSON.parse(JSON.stringify(t));Zp(n,{nodeStore:this.nodeStore,filterFactory:this.filterFactory})}addTexture(t,e,n){if(nm.debug("[addTexture]",t,e,n),this.isContextUnavailable())return null;let i=this.textureManager.createTexture({type:e});return i.isStatic=!0,t&&i.fill(t),this.graphIOManager.setTextureSource(this.ioStore,i,n),i}releaseTexture(t){nm.debug("[releaseTexture]",t),this.isContextUnavailable()||this.textureManager.releaseTexture(t)}selectNode(t){if(nm.debug("[selectNode]",t),!this.isContextUnavailable())return this.nodeStore.get(t)||nm.warn("Missing render node",t),void(this.selectedRenderNodeId=t);this.selectedRenderNodeId=t}captureTexture(){return nm.debug("[captureTexture]"),this.isContextUnavailable()?null:this.capturedFramesManager.createCaptureId()}disposeTexture(t){return nm.debug("[disposeTexture]",t),this.isContextUnavailable()||"string"!=typeof t?null:this.capturedFramesManager.releaseCaptureId(t)}setSrcVidTracks(t){this.isContextUnavailable()||this.capturedFramesManager&&this.capturedFramesManager.capture(t)}resizeCanvasSize(t,e,n,i){this.dirtyCanvasSize={width:n,height:i}}resetViewportSyncState(){this._lastSyncedViewportCanvasWidth=null,this._lastSyncedViewportCanvasHeight=null}syncViewportToCanvasBackingStoreIfChanged(){var t,e;const n=null===(t=this.gl)||void 0===t||null===(t=t.canvas)||void 0===t?void 0:t.width,i=null===(e=this.gl)||void 0===e||null===(e=e.canvas)||void 0===e?void 0:e.height;!Number.isFinite(n)||!Number.isFinite(i)||n<=0||i<=0||n===this._lastSyncedViewportCanvasWidth&&i===this._lastSyncedViewportCanvasHeight||(ph(n,i),this.gl.viewport(0,0,n,i),this._lastSyncedViewportCanvasWidth=n,this._lastSyncedViewportCanvasHeight=i)}isContextUnavailable(){return!!this.isDisposed||!(!this.isRecovering&&!this.isContextLost)||!(!this.gl||"function"!=typeof this.gl.isContextLost)&&this.gl.isContextLost()}queueNodeOptionUpdate(t,e){t&&e&&"object"==typeof e&&(this.pendingNodeOptionUpdates||(this.pendingNodeOptionUpdates=new Map),this.pendingNodeOptionUpdates.set(t,e))}applyPendingNodeOptionUpdates(t=!1){if(!this.pendingNodeOptionUpdates||!this.pendingNodeOptionUpdates.size)return;const e=Array.from(this.pendingNodeOptionUpdates.entries());this.pendingNodeOptionUpdates.clear(),e.forEach((([e,n])=>{try{if(t){const t=this.nodeStore.get(e);if(!t||"function"!=typeof t.updateOptions)return void this.queueNodeOptionUpdate(e,n);try{t.updateOptions(n)}catch(t){nm.error("Failed to apply pending node options",e,t),this.queueNodeOptionUpdate(e,n)}return}this.updateOptions(e,n)}catch(t){nm.error("Failed to apply pending node options",e,t)}}))}render(t={}){const{noRaf:e=!1}=t;if(this.isContextUnavailable())return;if(this.dirtyCanvasSize){let{width:t=this.gl.canvas.width,height:e=this.gl.canvas.height}=this.dirtyCanvasSize;ph(t,e),this.gl.canvas.width=t,this.gl.canvas.height=e,this.textureManager.refreshTextureObjects(),this.gl.viewport(0,0,t,e),this.dirtyCanvasSize=!1,this._lastSyncedViewportCanvasWidth=t,this._lastSyncedViewportCanvasHeight=e}this.syncViewportToCanvasBackingStoreIfChanged(),this.graphIOManager.setVideoSources(this.ioStore);let n={ioStore:this.ioStore,graphIOManager:this.graphIOManager};this.renderSelectedNode(n),this.config.onPreRenderToScreen&&this.config.onPreRenderToScreen(),this.renderToCanvas(n),this.config.onPostRenderToScreen&&this.config.onPostRenderToScreen(),this.graphIOManager.disposeAllStore(this.ioStore),n=null,!e&&!this.config.userWillCallRender&&(this.rafId=requestAnimationFrame(this.render))}renderSelectedNode(t){if(!this.selectedRenderNodeId)return;const e=this.nodeStore.get(this.selectedRenderNodeId);e&&"function"==typeof e.render?e.render(t):(nm.warn("Missing selected render node",this.selectedRenderNodeId),this.selectedRenderNodeId=null)}renderToCanvas(t){const e=this.nodeStore.get(im);e&&"function"==typeof e.render?e.render(t):nm.warn("Missing render-to-canvas node")}updateOptions(t,e){if(nm.debug("[updateOptions]",t,e),this.isContextUnavailable())return void this.queueNodeOptionUpdate(t,e);const n=this.nodeStore.get(t);if(n&&"function"==typeof n.updateOptions)try{n.updateOptions(e)}catch(n){nm.error("Failed to update node options",t,n),this.queueNodeOptionUpdate(t,e)}else this.queueNodeOptionUpdate(t,e)}addSourceListeners(){var t;"function"==typeof(null===(t=this.source)||void 0===t?void 0:t.on)&&this.source.on("forcerender",this.onForceRender)}removeSourceListeners(){var t;"function"==typeof(null===(t=this.source)||void 0===t?void 0:t.off)&&this.source.off("forcerender",this.onForceRender)}addCanvasListeners(){var t;(null==this||null===(t=this.gl)||void 0===t?void 0:t.canvas)&&(this.config.noWebGLContextLostRecovery||this.gl.canvas.addEventListener("webglcontextlost",this.onWebGLContextLost))}removeCanvasListeners(){var t;(null==this||null===(t=this.gl)||void 0===t?void 0:t.canvas)&&this.gl.canvas.removeEventListener("webglcontextlost",this.onWebGLContextLost)}getNodesOptions(){const t=this.getNodes();let e={};return Object.keys(t).filter((t=>"__default"!==t)).forEach((n=>{e[n]=t[n].options})),e}getDocumentVisibilityPromise(){return new Promise((t=>{"visible"===document.visibilityState&&t();const e=()=>{"visible"===document.visibilityState&&(document.removeEventListener("visibilitychange",e),t())};document.addEventListener("visibilitychange",e)}))}onForceRender(){nm.info("[onForceRender]"),this.render({noRaf:!0})}async onWebGLContextLost(t){if(t&&"function"==typeof t.preventDefault&&t.preventDefault(),this.isDisposed||this.isRecovering)return;this.isContextLost=!0,this.isRecovering=!0;const e=this.getNodesOptions(),n=this.addClientNodeInvocations,i=this.selectedRenderNodeId;cancelAnimationFrame(this.rafId),nm.warn("WebGL context lost - attempting to recover");const r=async()=>{if(this.isDisposed)this.isRecovering=!1;else try{var t;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((t=>{nm.debug("Re-adding client nodes",t),this.addClientNodes(t,!0)})),Object.entries(e).forEach((([t,e])=>{nm.debug("Re-applying node options",t,e);const n=this.nodeStore.get(t);n&&"function"==typeof n.updateOptions&&n.updateOptions(e)})),i&&(this.selectedRenderNodeId=i),this.applyPendingNodeOptionUpdates(!0);const o="function"==typeof(null===(t=this.source)||void 0===t?void 0:t.recover);o&&(nm.debug("Recovering glSource (i.e. seeking/resetting player)"),await this.source.recover()),this.isContextLost=!1,this.isRecovering=!1,o&&this.render()}catch(t){nm.error("Failed to recover WebGL context, retrying",t),setTimeout(r,200)}};await r()}dispose(t=!0){if(this.selectedRenderNode=null,t&&(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 e=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS);for(let t=0;t<e;++t)this.gl.activeTexture(this.gl.TEXTURE0+t),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),t)try{this.gl.getExtension("WEBGL_lose_context").loseContext()}catch(t){console.error(t)}}this.selectedRenderNodeId=null,t&&delete this.addClientNodeInvocations}}class am{constructor(t={}){this.options=t}get type(){return"stage"}getSignature(){return this.type}build({inputs:t=[]}={}){return{graph:[],outputs:t,signature:this.getSignature()}}}function lm(t={}){const e={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={...e.source,...t.source||{}},i={...e.target,...t.target||{}};return{...e,...t,source:n,target:i}}class cm extends am{get type(){return"retarget"}getSignature(){var t;const e=Array.isArray(null===(t=this.options)||void 0===t?void 0:t.frames)?this.options.frames:[];return`${this.type}:${e.length}`}build({inputs:t=[],stageIndex:e=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:t,signature:this.getSignature()};const r=[],o=[];for(let n=0;n<t.length;n+=1){const s=t[n],a=i[n];if(!a){o.push(s);continue}const l=`retarget-${e}-${n}`;r.push({id:l,type:"crop",inputs:[s],outputs:[l],options:lm(a)}),o.push(l)}return{graph:r,outputs:o,signature:this.getSignature()}}}class um{#E=new Map;constructor(){this.register("retarget",cm)}register(t,e){t&&"function"==typeof e&&this.#E.set(t,e)}create(t={}){const e="string"==typeof(null==t?void 0:t.type)?t.type:null;if(!e)return null;const n=this.#E.get(e);return n?new n((null==t?void 0:t.options)||{}):null}}class dm{constructor(t={}){this.params=t}static get panAndScanTarget(){return"pre"}static buildDefaultLayoutGraph(t=[]){const e=t[0]||"__SRC_TEXTURE:0";return{type:"default",signature:`default:${t.length}`,isDynamic:!1,graph:[{type:"opacity",inputs:[e],options:{power:1}}]}}static prepareRenderFrames({frames:t}={}){return Array.isArray(t)?t:[]}static getRenderTiming({timing:t}={}){return t&&"object"==typeof t?t:{}}static resetRenderState(t){}render(t){}}class hm extends dm{#I=null;#S=null;static get type(){return"default"}static get aliases(){return["DefaultRenderNode","default"]}static get requiresFrameCadence(){return!1}static buildLayoutGraph({inputs:t=[]}={}){return super.buildDefaultLayoutGraph(t)}static prepareRenderFrames({frames:t}={}){const e=Array.isArray(t)?t:[];if(e.length<=1)return e;const n=e[e.length-1];return n?[n]:e}render(t){var e;const n=(null==t||null===(e=t.visualFramesAvailable)||void 0===e?void 0:e.frames)||[];if(!n.length)return;const i=null==t?void 0:t.shaderGraph,r=null==t?void 0:t.shaderGraphNodeIds;if(!i||"function"!=typeof i.updateOptions||"function"!=typeof i.selectNode)return;const o=null==r?void 0:r.default;if(o)try{const t=n.map(((t,e)=>t?`__SRC_TEXTURE:${e}`:null)).filter(Boolean),e=hm.buildLayoutGraph({inputs:t}),r=e.signature;this.#I!==r&&(i.updateOptions(o,{graph:e.graph}),this.#I=r),this.#S!==o&&(i.selectNode(o),this.#S=o),i.render({noRaf:!0})}catch(t){}}}function fm(t){const e=Number(t);return Number.isFinite(e)?e<=0?0:e>=1?1:e:0}class pm extends dm{#I=null;#S=null;#A=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:t=[],normalizedTime:e}={}){if(t.length<2)return super.buildDefaultLayoutGraph(t);const n=fm(e),i=[{type:"opacity",inputs:[t[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",t[0]],options:{}}];return{type:pm.type,signature:`${pm.type}:${t.length}`,isDynamic:!0,graph:i}}static prepareRenderFrames({frames:t,timelineTime:e,active:n}={}){let i=(Array.isArray(t)?t:[]).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(e)||!Number.isFinite(r)||!Number.isFinite(o))return i;const s=fm((e-o)/r);return s<=0?[i[0]]:s>=1?[i[1]]:i}render(t){var e;const n=(null==t||null===(e=t.visualFramesAvailable)||void 0===e?void 0:e.frames)||[];if(!n.length)return;const i=null==t?void 0:t.shaderGraph,r=null==t?void 0:t.shaderGraphNodeIds;if(!i||"function"!=typeof i.updateOptions||"function"!=typeof i.selectNode)return;if(n.length<2){const t=null==r?void 0:r.default;if(!t)return;try{const e="default";if(this.#I!==e){const n=pm.buildLayoutGraph({inputs:["__SRC_TEXTURE:0"]});i.updateOptions(t,{graph:n.graph}),this.#I=e}this.#S!==t&&(i.selectNode(t),this.#S=t),i.render({noRaf:!0})}catch(t){}return}const o=null==r?void 0:r.crossFade;if(o)try{const e=["__SRC_TEXTURE:0","__SRC_TEXTURE:1"],n=pm.buildLayoutGraph({inputs:e,normalizedTime:null==t?void 0:t.renderNodeNormalizedTime}),r=n.signature,s=Number(null==t?void 0:t.renderNodeNormalizedTime),a=Number.isFinite(s)?s:0;this.#I===r&&this.#A===a||(i.updateOptions(o,{graph:n.graph}),this.#I=r,this.#A=a),this.#S!==o&&(i.selectNode(o),this.#S=o),i.render({noRaf:!0})}catch(t){}}}function mm(t,e,n={}){if("number"==typeof(null==t?void 0:t.nodeDurationOverride)&&Number.isFinite(t.nodeDurationOverride))return t.nodeDurationOverride;const i="function"==typeof(null==n?void 0:n.getNode)?n.getNode:e&&"function"==typeof e.get?t=>e.get(t):null;if(!i)return;const r=i(null==t?void 0:t.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 t.nodeOffsetOverride&&Number.isFinite(t.nodeOffsetOverride)&&(a=t.nodeOffsetOverride);const l=o-a;return l>0?l:0}function vm(t){return!(!t||!0===t.offsetPending)&&Number.isFinite(t.offset)}function gm(t){return vm(t)?t.offset:void 0}function ym(t,e,n,i={}){if(!t)return!1;const r=gm(t);if(!Number.isFinite(r))return!1;const o=mm(t,n,i);return Number.isFinite(o)?e>=r&&e<r+o:e>=r}function bm(t=[]){if(!Array.isArray(t))return t;const e=[],n=[];return t.forEach((t=>{vm(t)?e.push(t):n.push(t)})),e.sort(((t,e)=>t.offset-e.offset)),t.splice(0,t.length,...e,...n),t}function km(t=[],e={}){if(!Array.isArray(t)||!t.length)return{updated:!1,resolvedPlacements:[]};const n="function"==typeof e.getPlacementDuration?e.getPlacementDuration:()=>{},i="function"==typeof e.snapPlacementOffset?e.snapPlacementOffset:t=>t,r="function"==typeof e.onResolvedPlacement?e.onResolvedPlacement:null,o=new Map,s=[];if(t.forEach((t=>{null!=t&&t.placementId&&o.set(t.placementId,t),!0===(null==t?void 0:t.offsetPending)&&s.push(t)})),!s.length)return{updated:!1,resolvedPlacements:[]};let a=!1;const l=[];let c=s,u=!0;for(;c.length&&u;){u=!1;const t=[];for(let e=0;e<c.length;e+=1){const s=c[e],d=null==s?void 0:s.offsetAnchorPlacementId;if(!d){t.push(s);continue}const h=o.get(d);if(!h||!0===h.offsetPending){t.push(s);continue}const f=gm(h);if(!Number.isFinite(f)){t.push(s);continue}let p;if("start"===s.offsetAnchorEdge)p=i(f,s);else{const e=n(h);if(!(e>0)){t.push(s);continue}const r=f+e-(Number.isFinite(s.offsetEndSeconds)?s.offsetEndSeconds:0);if(!Number.isFinite(r)){t.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):t.push(s)}c=t}return a&&!1!==e.sortPlacements&&bm(t),{updated:a,resolvedPlacements:l}}function wm(t){const e=Number(t);return Number.isFinite(e)?e:0}function xm(t,e={}){const n=function(t){const e=Number(t);return Number.isFinite(e)&&e<0?Math.abs(e):0}(t),i=Number.isFinite(null==e?void 0:e.offsetEndSeconds)?e.offsetEndSeconds:n;var r;return{wantsEndOffset:"end"===(r=t)||null==r||n>0||!0===(null==e?void 0:e.offsetPending),endOffsetSeconds:i,endOffsetFromAtSeconds:n}}function _m(t){if("string"!=typeof t)return null;const e=t.trim();if(!e||"end"===e)return null;const n=Number(e);if(Number.isFinite(n))return null;const i=e.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 Tm(t=[],e,n,i){if(Array.isArray(t))for(let r=0;r<t.length;r+=1){const o=t[r],s="number"==typeof(null==o?void 0:o.offset)?o.offset:0;if(e<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 Em(t){const e=Number(t);return Number.isFinite(e)&&e>0?e:0}function Im(t){return(null==t?void 0:t.id)||(null==t?void 0:t.nodeId)||null}function Sm(t,e){return Array.isArray(t)&&e?t.findIndex((t=>Im(t)===e)):-1}function Am(t,e,n){const i=function(t,e,n){if(!Array.isArray(e)||0===e.length)return null;const i=e.length;if(null==t||"next"===t){const t=Sm(e,n);return t>=0?(t+1)%i:0}if("prev"===t){const t=Sm(e,n);return t>=0?(t-1+i)%i:i-1}const r=Number(t);return Number.isInteger(r)&&r>=0&&r<i?r:null}(t,e,n);return Number.isInteger(i)?Im(e[i]):null}function Nm(t,e,n,i){const r=function(t,e){if(!Array.isArray(t)||t.length<=1)return t||[];const n=function(t){const e=[],n=new Set;return Array.isArray(t)?(t.forEach((t=>{const i=null==t?void 0:t.placementId;i&&!n.has(i)&&(n.add(i),e.push(i))})),e):e}(e);if(!n.length)return t;const i=new Map;t.forEach((t=>{const e=null==t?void 0:t.placementId;e&&!i.has(e)&&i.set(e,t)}));const r=[],o=new Set;return n.forEach((t=>{const e=i.get(t);e&&!o.has(t)&&(o.add(t),r.push(e))})),t.forEach((t=>{const e=null==t?void 0:t.placementId;e&&!o.has(e)&&(o.add(e),r.push(t))})),r}(function(t,e){const n=function(t){const e=Number(null==t?void 0:t.offset),n=Number(null==t?void 0:t.duration),i=n===Number.POSITIVE_INFINITY,r=Number.isFinite(n)&&n>0||i;return Number.isFinite(e)&&r?{start:e,end:i?Number.POSITIVE_INFINITY:e+n}:null}(e);if(!n||!t||!Array.isArray(t.placements))return[];const i=function(t,e){const n=Number(null==t||null===(e=t.settings)||void 0===e?void 0:e.snapToFps);return!Number.isFinite(n)||n<=0?0:.5/n}(t),r=t.placements.filter((e=>{const r=function(t,e){const n=gm(t);if(!Number.isFinite(n))return null;const i="function"==typeof(null==e?void 0:e.getPlacementDuration)?e.getPlacementDuration(t):void 0;return{start:n,end:Number.isFinite(i)&&i>=0?n+i:Number.POSITIVE_INFINITY}}(e,t);return!!r&&r.start<n.end&&r.end>n.start+i}));return r.sort(((t,e)=>gm(t)-gm(e))),r}(e,n),i),o=function(t,e){const n=[],i=new Set;return Array.isArray(t)?(t.forEach((t=>{const r=null==t?void 0:t.nodeId;if(!r||i.has(r))return;const o="function"==typeof(null==e?void 0:e.getNode)?e.getNode(r):null;if(o){const t="object"==typeof o&&null!==o?o.id||o.nodeId?o:{...o,id:r}:{id:r};n.push(t),i.add(r)}})),n):n}(r,e),s=function(t){const e=new Map;return t.forEach((t=>{const n=null==t?void 0:t.placementId,i=null==t?void 0:t.nodeId;n&&i&&(e.has(i)||e.set(i,[]),e.get(i).push(n))})),e}(r),a=Array.isArray(t.nodes)?t.nodes:[];return a.splice(0,a.length,...o),t.nodes=a,t.placements=r,t.nodePlacementMap=s,{nodes:a,placements:r,nodePlacementMap:s}}function Mm(t,e,n){if(!Array.isArray(t))return null;if(e){const n=t.find((t=>(null==t?void 0:t.placementId)===e));if(n)return n}return n&&t.find((t=>(null==t?void 0:t.nodeId)===n))||null}function Fm(t,e){if(!e||!Array.isArray(t))return null;const n=t.find((t=>(null==t?void 0:t.placementId)===e));return(null==n?void 0:n.nodeId)||null}function Cm(t,e,n){if(!t||!e)return null;const i=e.get(t);if(!Array.isArray(i)||!i.length)return null;for(let e=0;e<i.length;e+=1){const r=i[e];if(Mm(n,r,t))return r}return null}function Om(t){t.initialized=!1,t.activeRenderPlacementId=null,t.nodes=[],t.placements=[],t.nodePlacementMap=null,t.selectedPlacementId=null,t.previousPlacementId=null,t.pendingSwitch=null,t.switchStartTime=null,t.switchDuration=0,t.switchNormalizedTime=void 0,t.switchTo=null,t.countOfConcurrentChannels=null}class Pm extends dm{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:t=[],normalizedTime:e}={}){if(t.length<2)return super.buildDefaultLayoutGraph(t);const n=fm(e),i=[{type:"opacity",inputs:[t[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",t[0]],options:{}}];return{type:Pm.type,signature:`${Pm.type}:${t.length}`,isDynamic:!0,graph:i}}static getRenderTiming({timing:t,state:e}={}){const n=t&&"object"==typeof t?t:{},i=Number(null==e?void 0:e.switchNormalizedTime);return Number.isFinite(i)?{...n,normalizedTime:fm(i)}:n}static prepareRenderFrames({frames:t,timelineTime:e,timeline:n,active:i,renderNodeParams:r,state:o}={}){const s=Array.isArray(t)?t:[],a=o&&"object"==typeof o?o:{},l=null==i?void 0:i.renderPlacementId;l&&a.activeRenderPlacementId!==l&&(Om(a),a.activeRenderPlacementId=l);const c=null==r?void 0:r.initSwitching,u=Nm(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=(t,e)=>{const n=Fm(a.placements,a.selectedPlacementId),i=Am(t,a.nodes,n);if(!i)return;const r={nodeId:i};e&&Object.prototype.hasOwnProperty.call(e,"crossfadeSeconds")&&void 0!==e.crossfadeSeconds&&(r.crossfadeSeconds=e.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 t=Number(null==r?void 0:r.initialChannelIndex),e=Am(Number.isInteger(t)&&t>=0?t:0,a.nodes,null);let n=null;if(e&&(n=Cm(e,a.nodePlacementMap,s),!n&&a.nodePlacementMap)){const t=a.nodePlacementMap.get(e);Array.isArray(t)&&t.length&&(n=t[0])}a.selectedPlacementId=n||function(t,e){if(Array.isArray(e))for(let i=0;i<e.length;i+=1){var n;const r=null===(n=e[i])||void 0===n?void 0:n.placementId;if(r&&Mm(t,r))return r}const i=Array.isArray(t)?t.find((t=>null==t?void 0:t.placementId)):null;return i?i.placementId:null}(s,a.placements)}if(a.pendingSwitch&&Number.isFinite(e)){const t=Cm(a.pendingSwitch.nodeId,a.nodePlacementMap,s);if(t){const n=a.selectedPlacementId;a.previousPlacementId=n&&n!==t?n:null,a.selectedPlacementId=t;const i=Object.prototype.hasOwnProperty.call(a.pendingSwitch,"crossfadeSeconds"),o=Em(a.pendingSwitch.crossfadeSeconds),s=Em(null==r?void 0:r.switchCrossfadeSeconds),l=i?o:s;a.switchDuration=l,l>0?a.switchStartTime=e:(a.switchStartTime=null,a.previousPlacementId=null)}a.pendingSwitch=null}let p;if(Number.isFinite(a.switchStartTime)&&a.switchDuration>0&&Number.isFinite(e)){const t=e-a.switchStartTime;t>=a.switchDuration?(a.switchStartTime=null,a.switchDuration=0,a.previousPlacementId=null):t>=0&&(p=fm(t/a.switchDuration))}a.switchNormalizedTime=Number.isFinite(p)?p:void 0;const m=Fm(a.placements,a.selectedPlacementId),v=Mm(s,a.selectedPlacementId,m)||s[0];let g=null;if(Number.isFinite(a.switchNormalizedTime)&&a.previousPlacementId){const t=Fm(a.placements,a.previousPlacementId),e=Fm(a.placements,a.selectedPlacementId),n=Mm(s,a.previousPlacementId,t),i=Mm(s,a.selectedPlacementId,e);n&&i&&(g=[n,i])}return g||(g=v?[v]:s),g}static resetRenderState(t){t&&"object"==typeof t&&Om(t)}}const Rm=.5,Dm="auto";function Lm(t){return"vertical"===t?"vertical":"horizontal"}function Bm(t){return void 0===t||t===Dm?Dm:"manual"}function zm(t){const e=Number(t);return Number.isFinite(e)&&e>=0?e:.004}function Wm(t,e){const n=Number(null==t?void 0:t.width),i=Number(null==t?void 0:t.height);return Number.isFinite(n)&&Number.isFinite(i)&&n>0&&i>0?i>n?"vertical":"horizontal":Lm(e)}function $m(t,e){const n=e&&"object"==typeof e&&e.runtimeParams&&"object"==typeof e.runtimeParams?e.runtimeParams:{},i=Object.prototype.hasOwnProperty.call(n,"orientationMode")?n.orientationMode:null==t?void 0:t.orientationMode,r=Object.prototype.hasOwnProperty.call(n,"orientation")?n.orientation:null==t?void 0:t.orientation,o=Object.prototype.hasOwnProperty.call(n,"gap")?n.gap:null==t?void 0:t.gap,s=Bm(i);return{orientationMode:s,orientation:s===Dm?Wm(null==e?void 0:e.viewportSize,r):Lm(r),gap:zm(o)}}function jm(t){t&&"object"==typeof t&&(t.activeRenderPlacementId=null,t.frames=null,t.gridInitialized=!1,t.runtimeParams=null,t.setGridParams=null)}class Um extends dm{static get type(){return"grid"}static get aliases(){return["GridRenderNode","grid","SideBySideRenderNode","side-by-side","sidebyside"]}static get requiresFrameCadence(){return!1}static get panAndScanTarget(){return"skip"}static resolvePanAndScanTarget({frameCount:t}={}){return t<2?"pre":Um.panAndScanTarget}static buildLayoutGraph({inputs:t=[],renderNodeParams:e,state:n}={}){const i=Array.isArray(t)?t.slice(0,12):[],r=i.length;if(r<2)return super.buildDefaultLayoutGraph(i);const{orientation:o,gap:s}=$m(e,n),{rows:a,cols:l}=(p=o,(f=r)<=3?"vertical"===p?{rows:f,cols:1}:{rows:1,cols:f}:4===f?{rows:2,cols:2}:f<=6?"vertical"===p?{rows:3,cols:2}:{rows:2,cols:3}:f<=8?"vertical"===p?{rows:4,cols:2}:{rows:2,cols:4}:9===f?{rows:3,cols:3}:"vertical"===p?{rows:4,cols:3}:{rows:3,cols:4}),c=1/a,u=Math.max(0,c-s),d=[],h="grid-slice";var f,p;function m(t){const e=Math.floor(t/l),n=function(t,e,n,i){const r=(e-1)*n;return t===e-1&&i>r?i-r:n}(e,a,l,r),i=n<l?t-e*l:t%l,o=1/n;return{row:e,cellWidth:o,cropWidth:Math.max(0,o-s),targetCenterX:(i+Rm)*o,targetCenterY:(e+Rm)*c}}function v(t,e,n){const i=m(t);return{id:`grid-crop-${t}`,type:"crop",inputs:[e],outputs:[n],options:{source:{center:{x:Rm,y:Rm},width:1,height:1},target:{center:{x:i.targetCenterX,y:i.targetCenterY},width:i.cropWidth,height:u},fitType:"fill",cornerRadius:0,edgeSoftness:0}}}function g(t){const e=m(t);return{id:`grid-mask-${t}`,type:"shapeCompositeMask",inputs:[h,"accum"],outputs:["accum"],options:{type:"box",center:{x:2*e.targetCenterX-1,y:1-2*e.targetCenterY},area:{width:e.cellWidth,height:c},radius:0,edgeSoftness:0}}}d.push(v(0,i[0],"accum"));for(let t=1;t<r;t+=1)d.push(v(t,i[t],h)),d.push(g(t));return{type:Um.type,signature:`${Um.type}:${r}:${a}x${l}:${o}:${s}`,isDynamic:!1,graph:d}}static prepareRenderFrames({frames:t,renderNodeParams:e,active:n,state:i}={}){const r=Array.isArray(t)?t.slice(0,12):[],o=i&&"object"==typeof i?i:{},s=null==n?void 0:n.renderPlacementId;s&&o.activeRenderPlacementId!==s&&(jm(o),o.activeRenderPlacementId=s);const a=Array.isArray(o.frames)?o.frames:[],l=null==e?void 0:e.initGrid;if("function"==typeof l&&(o.setGridParams||(o.setGridParams=t=>{!function(t,e){if(!t||"object"!=typeof t||!e||"object"!=typeof e)return;const n=t.runtimeParams&&"object"==typeof t.runtimeParams?{...t.runtimeParams}:{};Object.prototype.hasOwnProperty.call(e,"orientationMode")&&(n.orientationMode=Bm(e.orientationMode)),Object.prototype.hasOwnProperty.call(e,"orientation")&&(n.orientation=Lm(e.orientation)),Object.prototype.hasOwnProperty.call(e,"gap")&&(n.gap=zm(e.gap)),t.runtimeParams=n}(o,t),"function"==typeof o.requestRender&&o.requestRender()}),!o.gridInitialized)){o.gridInitialized=!0;const t=$m(e,o);try{l({orientationMode:t.orientationMode,orientation:t.orientation,gap:t.gap,setGridParams:o.setGridParams})}catch(t){}}if(r.length<2){const t=function(t,e){if(!Array.isArray(e)||e.length<2)return t.length?[t[t.length-1]]:[];const n=Math.min(12,Math.max(t.length,e.length,2)),i=t[0]||e[0];return Array.from({length:n},((n,r)=>t[r]||e[r]||i))}(r,a);return o.frames=t,t}return o.frames=r,r}static resetRenderState(t){jm(t)}}const qm=[hm,pm,Pm,Um],Vm=new Map;function Gm(t){if("string"!=typeof t)return null;const e=t.trim();return e?e.toLowerCase():null}function Hm(t){const e=Gm(t);return e&&Vm.get(e)||null}function Km(t){return Hm(t)||hm}qm.forEach((t=>function(t){(function(t){const e=Array.isArray(t.aliases)?t.aliases:[],n=t.type;return(n?[n,...e]:e.slice()).filter((t=>"string"==typeof t&&t.trim().length))})(t).forEach((e=>{const n=Gm(e);n&&Vm.set(n,t)}))}(t)));class Xm{static get defaultType(){return hm.type||"default"}static getRenderNodeClass(t){return Hm(t)}static normalizeType(t){const e=Hm(t);return e?e.type:null}static doesRenderNodeTypeRequireFrameCadence(t){const e=Hm(t);return!!e&&!0===e.requiresFrameCadence}static buildLayoutGraph({type:t,inputs:e=[],normalizedTime:n,renderNodeParams:i,state:r}={}){const o=Km(t);return o&&"function"==typeof o.buildLayoutGraph?o.buildLayoutGraph({inputs:e,normalizedTime:n,renderNodeParams:i,state:r}):hm.buildLayoutGraph({inputs:e,normalizedTime:n,renderNodeParams:i,state:r})}static getPanAndScanTarget(t,e={}){const n=Km(t);return"post"===(i=n&&"function"==typeof n.resolvePanAndScanTarget?n.resolvePanAndScanTarget(e):null==n?void 0:n.panAndScanTarget)||"skip"===i?i:"pre";var i}static prepareRenderFrames({type:t,frames:e,timelineTime:n,timeline:i,active:r,renderNodeParams:o,state:s}={}){const a=Km(t);if(a&&"function"==typeof a.prepareRenderFrames){const t=a.prepareRenderFrames({frames:e,timelineTime:n,timeline:i,active:r,renderNodeParams:o,state:s});if(Array.isArray(t))return t}return Array.isArray(e)?e:[]}static getRenderTiming({type:t,timing:e,timelineTime:n,active:i,renderNodeParams:r,state:o}={}){const s=Km(t),a=e&&"object"==typeof e?e:{};if(s&&"function"==typeof s.getRenderTiming){const t=s.getRenderTiming({timing:a,timelineTime:n,active:i,renderNodeParams:r,state:o});if(t&&"object"==typeof t)return{...a,...t}}return a}static resetRenderState(t,e){const n=Km(t);n&&"function"==typeof n.resetRenderState&&n.resetRenderState(e)}static resetAllRenderStates(t){t&&"function"==typeof t.forEach&&t.forEach(((t,e)=>{Xm.resetRenderState(e,t)}))}create(t,e){return t&&"function"==typeof t.render?t:new(Km(t))(e)}}function Ym(t){return Array.isArray(t)?t.filter((t=>t&&"string"==typeof t.type)):[]}function Qm(t,e){return t&&"function"==typeof t.getSignature?t.getSignature():(null==e?void 0:e.type)||"stage"}class Jm{#N;constructor(t){this.#N=t||new um}build(t={}){const e=(Array.isArray(null==t?void 0:t.frames)?t.frames:[]).length,n=Array.from({length:e},((t,e)=>`__SRC_TEXTURE:${e}`)),i=Xm.normalizeType(null==t?void 0:t.layoutType)||Xm.defaultType,r=null==t?void 0:t.normalizedTime,o=Ym(null==t?void 0:t.preStages),s=Ym(null==t?void 0:t.postStages),a=[],l=[`layout:${i}`,`inputs:${e}`];let c=n;o.forEach(((e,n)=>{const i=this.#N.create(e);if(!i)return;const r=i.build({inputs:c,stageIndex:n,context:t});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(Qm(i,e))}));const u=Xm.buildLayoutGraph({type:i,inputs:c,normalizedTime:r,renderNodeParams:null==t?void 0:t.renderNodeParams,state:null==t?void 0:t.renderNodeState}),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(((e,n)=>{const i=this.#N.create(e);if(!i)return;const r=i.build({inputs:[h],stageIndex:n,context:t});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(Qm(i,e))})),{graph:a,signature:l.join("|"),isDynamic:d}}}const Zm=[0,0,1,1],tv="zoomInExposure",ev=["transform","exposure","fadeToColor","dipToBlack"],nv={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 iv(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}function rv(t,e=Zm){return Array.isArray(t)&&t.length>=4?t:e}function ov(t){return"string"==typeof t&&t.trim()?t.trim():"#ffffff"}function sv(t,e){const n=null==t?void 0:t[e];return!1===n||null==n?null:ed(n)?n:{}}function av(t={}){let e=0;return ev.forEach((n=>{const i=sv(t,n);if(!i)return;const r=iv(null==i?void 0:i.duration);r>e&&(e=r)})),e}function lv(t,e,n,i,r){const o=[];return ev.forEach((s=>{const a=sv(t,s);if(!a)return;const l=function(t,e,n){const i=iv(null==t?void 0:t.duration);return Number.isFinite(n)&&n>0?i>0&&e>0?i*e:n:i}(a,n,i),c=function(t,e,n,i,r){const o={type:"transition",inputs:["__PREVIOUS:0"],options:{filter:t,startTime:n,duration:i,properties:{}}};if("transform"===t){var s,a,l,c;const t=rv(null==e?void 0:e.ease),n=(null==e||null===(s=e.scale)||void 0===s?void 0:s.from)||{x:1,y:1},i=(null==e||null===(a=e.scale)||void 0===a?void 0:a.to)||{x:1,y:1},r=(null==e||null===(l=e.translate)||void 0===l?void 0:l.from)||{x:0,y:0},u=(null==e||null===(c=e.translate)||void 0===c?void 0:c.to)||{x:0,y:0};return o.options.properties.scale={from:n,to:i,ease:t},o.options.properties.translate={from:r,to:u,ease:t},o}if("fadeToColor"===t){const t=rv(null==e?void 0:e.ease),n=(null==e?void 0:e.power)||{from:0,to:1};return o.options.properties.power={from:iv(null==n?void 0:n.from,0),to:iv(null==n?void 0:n.to,1),ease:t},o.options.properties.color=ov((null==e?void 0:e.color)||r),o}if("exposure"===t||"dipToBlack"===t){const t=rv(null==e?void 0:e.ease),n=(null==e?void 0:e.power)||{from:0,to:1};return o.options.properties.power={from:iv(null==n?void 0:n.from,0),to:iv(null==n?void 0:n.to,1),ease:t},o}return null}(s,a,e,l,r);c&&o.push(c)})),o}function cv(t=[]){const e=t.map((t=>{const e=JSON.parse(JSON.stringify(t));return null!=e&&e.options&&(e.options.startTime=0),e}));return JSON.stringify(e)}class uv{#M=null;start(t={}){const e=null==t?void 0:t.shaderGraph;if(!e||"function"!=typeof e.captureTexture)return null;const{baseFilters:n,reverseFilters:i}=function(t={}){const e=function(t={}){if(ed(null==t?void 0:t.transition))return t.transition;if("string"==typeof(null==t?void 0:t.transition))return nv[t.transition]||nv[tv];if(ed(null==t?void 0:t.filters)||ed(null==t?void 0:t.reverseFilters))return{filters:t.filters||{},reverseFilters:t.reverseFilters||{}};if("string"==typeof(null==t?void 0:t.filter)){const e=iv(t.duration)>0?1e3*t.duration:500;return{filters:{[t.filter]:{duration:e,power:{from:0,to:1}}},reverseFilters:{}}}return nv[tv]}(t),n=nd({},(null==e?void 0:e.filters)||{},ed(null==t?void 0:t.filters)?t.filters:{}),i=function(t={}){const e={};return Object.keys(t).forEach((n=>{const i=t[n];if(!1===i)return void(e[n]=!1);const r=JSON.parse(JSON.stringify(ed(i)?i:{}));Object.values(r).forEach((t=>function(t){if(t&&"object"==typeof t&&"from"in t&&"to"in t){const e=t.from;t.from=t.to,t.to=e}}(t))),e[n]=r})),e}(n),r=nd({},(null==e?void 0:e.reverseFilters)||{},ed(null==t?void 0:t.reverseFilters)?t.reverseFilters:{});return{baseFilters:n,reverseFilters:nd({},i,r)}}(t),r=iv(null==t?void 0:t.duration),o=r>0?1e3*r:null,s=av(n),a=av(i),l=o&&s>0?o/s:1,c=o&&a>0?o/a:1,u=o||s||500,d=o||a||u,h=ov(null==t?void 0:t.color),f=e.captureTexture(),p=Date.now(),m=lv(n,p,l,o,h);return this.#M={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:cv(m),inGraph:null,inSignature:null},{captureId:f,outDurationMs:u,inDurationMs:d}}beginIncoming(){if(!this.#M)return;const t=Date.now(),e=lv(this.#M.reverseFilters,t,this.#M.inScale,this.#M.durationOverrideMs,this.#M.color);this.#M={...this.#M,phase:"in",startTime:t,inGraph:e,inSignature:cv(e)}}reset(t){var e;t&&"function"==typeof t.disposeTexture&&null!==(e=this.#M)&&void 0!==e&&e.captureId&&t.disposeTexture(this.#M.captureId),this.#M=null}getState(){return this.#M}buildOutgoingGraph(){const t=this.#M;return t&&"out"===t.phase&&Array.isArray(t.outGraph)&&t.outGraph.length?{signature:`transition:out:${t.outSignature||""}`,forceUpdate:!1,graph:t.outGraph}:null}buildIncomingGraph(){const t=this.#M;return t&&"in"===t.phase&&Array.isArray(t.inGraph)&&t.inGraph.length?{signature:`transition:in:${t.inSignature||""}`,forceUpdate:!1,graph:t.inGraph}:null}}let dv;const hv=[/firefox\/(\d+)/,/edg\/(\d+)/,/opr\/(\d+)/,/chrome\/(\d+)/];function fv(){const t=cd&&cd.navigator&&(cd.navigator.userAgent||cd.navigator.platform||cd.navigator.vendor)||"";if(dv&&dv.ua===t)return dv;const e=t.toLowerCase(),n=e.includes("android"),i=e.includes("iphone")||e.includes("ipad")||e.includes("ipod")||e.includes("ios"),r=n||i||e.includes("mobile"),o=!!t&&!r,s=e.includes("firefox/"),a=function(t=""){for(let e=0;e<hv.length;e+=1){const n=hv[e],i=t.match(n);if(!i)continue;const r=Number(i[1]);return Number.isFinite(r)?r:null}if(t.includes("safari/")&&t.includes("version/")){const e=t.match(/version\/(\d+)/);if(!e)return null;const n=Number(e[1]);return Number.isFinite(n)?n:null}return null}(e);return dv={ua:t,lowerUA:e,isAndroid:n,isiOS:i,isMobile:r,isDesktop:o,isFirefox:s,browserMajorVersion:a},dv}function pv(){return fv().ua}function mv(){return fv().isAndroid}function vv(){return fv().isiOS}function gv(){return fv().isMobile}function yv(){return fv().isDesktop}function bv(){return fv().isFirefox}function kv(){return fv().browserMajorVersion}var wv={getUserAgent:pv,isAndroid:mv,isiOS:vv,isMobile:gv,isDesktop:yv,isFirefox:bv,getBrowserMajorVersion:kv},xv=Object.freeze({__proto__:null,default:wv,getBrowserMajorVersion:kv,getUserAgent:pv,isAndroid:mv,isDesktop:yv,isFirefox:bv,isMobile:gv,isiOS:vv});const _v="Idle",Tv="Playing",Ev="FirstFramePending",Iv="Waiting",Sv="Paused",Av="Seeking",Nv="Resetting";function Mv(t){return Array.isArray(t)?t.filter((t=>t&&"string"==typeof t.type)):[]}function Fv(t,e){return!!Array.isArray(t)&&t.some((t=>(null==t?void 0:t.type)===e))}function Cv(t){const e=Number(t);return!Number.isFinite(e)||e<=0?null:{type:"retarget",options:{frames:Array.from({length:e},(()=>({fitType:"fill"})))},meta:{source:"panAndScan"}}}function Ov(t){return Array.isArray(t)?t.filter((t=>{return!("panAndScan"===(null==(e=t)||null===(n=e.meta)||void 0===n?void 0:n.source));var e,n})):[]}const Pv=2073600;function Rv(t,e){const n=Number(t);return Number.isFinite(n)&&n>0?n:e}function Dv(t,e){if(null==t)return e;const n=Number(t);return Number.isFinite(n)?n:e}var 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 WeakMap,Jv=new WeakMap,Zv=new WeakMap,tg=new WeakMap,eg=new WeakMap,ng=new WeakMap,ig=new WeakMap,rg=new WeakMap,og=new WeakMap,sg=new WeakMap,ag=new WeakMap,lg=new WeakMap,cg=new WeakMap,ug=new WeakMap,dg=new WeakMap,hg=new WeakMap,fg=new WeakMap,pg=new WeakMap,mg=new WeakMap,vg=new WeakMap,gg=new WeakSet;class yg extends sd{static get pipelineNodeId(){return"ekoplayer-render-pipeline"}get defaults(){return{defaultRenderParams:void 0,resourceLimits:{enabled:!0,maxCanvasPixels:Pv,maxDevicePixelRatio:0,renderScale:1,transitionMinFrameIntervalMs:33}}}constructor(...t){super(...t),O(this,gg),F(this,Lv,void 0),F(this,Bv,void 0),F(this,zv,void 0),F(this,Wv,void 0),F(this,$v,void 0),F(this,jv,void 0),F(this,Uv,void 0),F(this,qv,void 0),F(this,Vv,void 0),F(this,Gv,void 0),F(this,Hv,void 0),F(this,Kv,void 0),F(this,Xv,null),F(this,Yv,null),F(this,Qv,void 0),F(this,Jv,void 0),F(this,Zv,void 0),F(this,tg,[]),F(this,eg,[]),F(this,ng,null),F(this,ig,null),F(this,rg,null),F(this,og,null),F(this,sg,null),F(this,ag,null),F(this,lg,new Map),F(this,cg,null),F(this,ug,null),F(this,dg,!1),F(this,hg,!1),F(this,fg,!1),F(this,pg,!1),F(this,mg,[]),F(this,vg,null);const[e,n,i]=t;C(Lv,this,e),C(Bv,this,n),C(zv,this,i),M(Lv,this)&&"function"==typeof M(Lv,this).enableFirstFrameRenderedGate&&M(Lv,this).enableFirstFrameRenderedGate(),C(Kv,this,new Jm),C(Qv,this,new uv),C(Jv,this,null),C(Zv,this,null),C(rg,this,null),C(Wv,this,(t=>A(gg,this,iy).call(this,t))),M(Lv,this)&&"function"==typeof M(Lv,this).on&&(M(Lv,this).on(dd.VISUAL_FRAMES_AVAILABLE,M(Wv,this)),C($v,this,(()=>{var t,e,n,i;A(gg,this,_g).call(this),A(gg,this,Jg).call(this,0),C(eg,this,[]),C(ng,this,null),C(Xv,this,null),C(Yv,this,null),A(gg,this,jg).call(this),C(cg,this,null);(null===(t=M(Qv,this))||void 0===t||null===(e=t.getState)||void 0===e?void 0:e.call(t))||null===(n=M(Qv,this))||void 0===n||null===(i=n.reset)||void 0===i||i.call(n,M(Jv,this))})),M(Lv,this).on(dd.TIMELINE_SEEKING,M($v,this)),C(jv,this,((t={})=>{"switch"===(null==t?void 0:t.reason)||"reset"===(null==t?void 0:t.reason)?A(gg,this,kg).call(this):A(gg,this,bg).call(this),A(gg,this,Tg).call(this)})),M(Lv,this).on(dd.TIMELINE_RESET,M(jv,this)),C(Vv,this,(()=>A(gg,this,Gg).call(this))),M(Lv,this).on(dd.TIMELINE_TIME_UPDATE,M(Vv,this)),C(Uv,this,(()=>{A(gg,this,ry).call(this)&&M(ig,this)&&A(gg,this,iy).call(this,M(ig,this))})),M(Lv,this).on(dd.TIMELINE_STATE_CHANGE,M(Uv,this))),M(Bv,this)&&"function"==typeof M(Bv,this).on&&(C(Gv,this,(()=>{const t=M(ig,this);C(pg,this,!0),A(gg,this,bg).call(this),C(ig,this,t)})),M(Bv,this).on(dd.CANVAS_WEBGL_CONTEXT_LOST,M(Gv,this)),C(Hv,this,(()=>{var t;const e=null===(t=M(Bv,this))||void 0===t?void 0:t.gl;if(!e||"function"==typeof e.isContextLost&&e.isContextLost())return void C(pg,this,!0);const n=M(ig,this);C(pg,this,!1),A(gg,this,bg).call(this),C(ig,this,n),n&&A(gg,this,ry).call(this)&&A(gg,this,iy).call(this,n)})),M(Bv,this).on(dd.CANVAS_WEBGL_CONTEXT_RESTORED,M(Hv,this))),C(qv,this,(()=>{C(ng,this,null),M(ig,this)&&A(gg,this,ry).call(this)&&A(gg,this,iy).call(this,M(ig,this))})),M(zv,this)&&"function"==typeof M(zv,this).on&&M(zv,this).on(dd.CONTAINER_RESIZE,M(qv,this))}get name(){return"Renderer"}onDispose(){M(Lv,this)&&M(Wv,this)&&"function"==typeof M(Lv,this).off&&M(Lv,this).off(dd.VISUAL_FRAMES_AVAILABLE,M(Wv,this)),M(Lv,this)&&M($v,this)&&"function"==typeof M(Lv,this).off&&M(Lv,this).off(dd.TIMELINE_SEEKING,M($v,this)),M(Lv,this)&&M(jv,this)&&"function"==typeof M(Lv,this).off&&M(Lv,this).off(dd.TIMELINE_RESET,M(jv,this)),M(Lv,this)&&M(Vv,this)&&"function"==typeof M(Lv,this).off&&M(Lv,this).off(dd.TIMELINE_TIME_UPDATE,M(Vv,this)),M(Lv,this)&&M(Uv,this)&&"function"==typeof M(Lv,this).off&&M(Lv,this).off(dd.TIMELINE_STATE_CHANGE,M(Uv,this)),M(zv,this)&&M(qv,this)&&"function"==typeof M(zv,this).off&&M(zv,this).off(dd.CONTAINER_RESIZE,M(qv,this)),M(Bv,this)&&M(Gv,this)&&"function"==typeof M(Bv,this).off&&M(Bv,this).off(dd.CANVAS_WEBGL_CONTEXT_LOST,M(Gv,this)),M(Bv,this)&&M(Hv,this)&&"function"==typeof M(Bv,this).off&&M(Bv,this).off(dd.CANVAS_WEBGL_CONTEXT_RESTORED,M(Hv,this)),A(gg,this,bg).call(this),C(Wv,this,null),C($v,this,null),C(jv,this,null),C(Vv,this,null),C(Uv,this,null),C(qv,this,null),C(Gv,this,null),C(Hv,this,null),C(Kv,this,null),C(Qv,this,null),C(lg,this,null),C(cg,this,null),C(Bv,this,null),C(zv,this,null),C(Lv,this,null)}startTransition(t={}){var e,n;const i=null===(e=M(Bv,this))||void 0===e?void 0:e.element,r=null===(n=M(Bv,this))||void 0===n?void 0:n.gl;if(!i||!r)return null;if(M(pg,this)||"function"==typeof r.isContextLost&&r.isContextLost())return C(pg,this,!0),null;if(A(gg,this,Ig).call(this,i),!M(Jv,this))return null;const o=M(Qv,this).start({shaderGraph:M(Jv,this),duration:null==t?void 0:t.duration,filter:null==t?void 0:t.filter,color:null==t?void 0:t.color,filters:null==t?void 0:t.filters,reverseFilters:null==t?void 0:t.reverseFilters,transition:null==t?void 0:t.transition});return C(rg,this,M(ig,this)||null),A(gg,this,ty).call(this),o}beginTransitionIn(t={}){var e,n;null!==(e=M(Qv,this))&&void 0!==e&&null!==(n=e.beginIncoming)&&void 0!==n&&n.call(e,t),C(rg,this,null),A(gg,this,ty).call(this)}resetTransition(){var t,e;null!==(t=M(Qv,this))&&void 0!==t&&null!==(e=t.reset)&&void 0!==e&&e.call(t,M(Jv,this)),C(rg,this,null),A(gg,this,ey).call(this)}}function bg(){if(A(gg,this,_g).call(this),M(Qv,this)&&"function"==typeof M(Qv,this).reset&&M(Qv,this).reset(M(Jv,this)),A(gg,this,Jg).call(this,0),M(Jv,this)&&"function"==typeof M(Jv,this).dispose)try{M(Jv,this).dispose()}catch(t){}C(Jv,this,null),C(Zv,this,null),C(tg,this,[]),C(eg,this,[]),C(dg,this,!1),C(ng,this,null),C(Xv,this,null),C(Yv,this,null),C(ig,this,null),C(rg,this,null),A(gg,this,ey).call(this),A(gg,this,jg).call(this),C(cg,this,null)}function kg(){A(gg,this,_g).call(this),M(Qv,this)&&"function"==typeof M(Qv,this).reset&&M(Qv,this).reset(M(Jv,this)),A(gg,this,Jg).call(this,0),C(tg,this,[]),C(eg,this,[]),C(ng,this,null),C(Xv,this,null),C(Yv,this,null),C(ig,this,null),C(rg,this,null),A(gg,this,ey).call(this),A(gg,this,jg).call(this),C(cg,this,null),C(ug,this,null)}function wg(){const t="function"==typeof cd.requestAnimationFrame?cd.requestAnimationFrame.bind(cd):null,e="function"==typeof cd.cancelAnimationFrame?cd.cancelAnimationFrame.bind(cd):null;return t?{schedule:e=>t(e),cancel(t){"number"==typeof t&&e&&e(t)}}:null}function xg(t){C(mg,this,M(mg,this).filter((e=>e!==t))),M(mg,this).length||C(vg,this,null)}function _g(){M(vg,this)&&M(mg,this).forEach((t=>M(vg,this).call(this,t))),C(mg,this,[]),C(vg,this,null),C(fg,this,!1)}function Tg(){A(gg,this,_g).call(this),C(hg,this,!1)}function Eg(){if(M(hg,this)||M(fg,this))return;const t=A(gg,this,wg).call(this);if(!t)return;const{schedule:e,cancel:n}=t;let i;C(vg,this,n),C(fg,this,!0),i=e((()=>{let t;A(gg,this,xg).call(this,i),t=e((()=>{A(gg,this,xg).call(this,t),C(fg,this,!1),M(hg,this)||(C(hg,this,!0),M(Lv,this)&&"function"==typeof M(Lv,this).notifyFirstFrameRendered&&M(Lv,this).notifyFirstFrameRendered())})),M(mg,this).push(t)})),M(mg,this).push(i)}function Ig(t){if(M(Jv,this)||!t)return;const e=this,n={dest:t,src:(t,n)=>{C(Zv,e,n)}};C(Jv,e,new sm(n,{userWillCallRender:!0,glOptions:{contextType:"webgl2"},performanceToggles:{useCanvasSizedFilterTargets:!0}})),M(Jv,e)&&"function"==typeof M(Jv,e).addNodes&&M(Jv,e).addNodes({[oe.pipelineNodeId]:{type:"composite",options:{graph:[]}}})}function Sg(t){var e;if("null"===(null==t?void 0:t.message))return!0;const n=null===(e=M(Bv,this))||void 0===e?void 0:e.gl;return!(!n||"function"!=typeof n.isContextLost||!n.isContextLost())}function Ag(t,e,n){const i=e||M(ig,this)||null;if(A(gg,this,bg).call(this),C(ig,this,i),!n)return this.log.warn("Shader graph render failed; rebuilding graph once.",t),void A(gg,this,iy).call(this,i,!0);this.log.warn("Shader graph render is still unavailable after rebuild; deferring until the next render pass.",t)}function Ng(){var t;const e=null===(t=this.settings)||void 0===t?void 0:t.resourceLimits;return!e||"object"!=typeof e||Array.isArray(e)?{}:e}function Mg(){const t=A(gg,this,Ng).call(this).enabled;return!0===t||!1!==t&&vv()}function Fg(){if(!A(gg,this,Mg).call(this))return 0;const t=Dv(A(gg,this,Ng).call(this).transitionMinFrameIntervalMs,33);return Number.isFinite(t)&&t>0?t:0}function Cg(t,e,n={}){const i=!0===(null==n?void 0:n.useDevicePixelRatio),r=A(gg,this,Mg).call(this),o=i?Rv(null==cd?void 0:cd.devicePixelRatio,1):1;let s=o,a=0;if(r){const t=A(gg,this,Ng).call(this);a=Dv(t.maxCanvasPixels,Pv);const e=Dv(t.maxDevicePixelRatio,0);s=Rv(t.renderScale,1)*(e>0?Math.min(o,e):o)}let l=Math.max(1,Math.round(t*s)),c=Math.max(1,Math.round(e*s));if(r&&a>0){const t=l*c;if(t>a){const e=Math.sqrt(a/t);l=Math.max(1,Math.floor(l*e)),c=Math.max(1,Math.floor(c*e))}}return{width:l,height:c}}function Og(t=[],e={}){var n;const i=null===(n=M(Bv,this))||void 0===n?void 0:n.element,r=M(Zv,this);if(!i||"function"!=typeof r)return!1;let o=0,s=0;const a=!0===(null==e?void 0:e.useViewportSize);if(a){var l,c,u,d,h,f;const t=Number(null!==(l=null===(c=M(zv,this))||void 0===c?void 0:c.containerWidth)&&void 0!==l?l:null===(u=M(zv,this))||void 0===u?void 0:u.width),e=Number(null!==(d=null===(h=M(zv,this))||void 0===h?void 0:h.containerHeight)&&void 0!==d?d:null===(f=M(zv,this))||void 0===f?void 0:f.height);if(Number.isFinite(t)&&Number.isFinite(e)&&t>0&&e>0)o=Math.round(t),s=Math.round(e);else{const t=Number(i.clientWidth),e=Number(i.clientHeight);Number.isFinite(t)&&Number.isFinite(e)&&t>0&&e>0&&(o=Math.round(t),s=Math.round(e))}}if(!(o>0&&s>0)){if(!Array.isArray(t)||!t.length)return;for(let e=0;e<t.length;e+=1){var p;const n=null===(p=t[e])||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(gg,this,Cg).call(this,o,s,{useDevicePixelRatio:a}),v=m.width,g=m.height,y=M(ng,this);return!(y&&y.width===v&&y.height===g||(C(ng,this,{width:v,height:g}),r(null,null,v,g),0))}function Pg(t){const e=null==t?void 0:t.nodeId,n=null==t?void 0:t.trackId,i=null==t?void 0:t.segmentId,r=null==t?void 0:t.presentationTime;return e&&n&&i&&Number.isFinite(r)?`${e}:${n}:${i}@${r}`:null}function Rg(t,e,n){const i=Number.isFinite(null==t?void 0:t.duration)&&t.duration>0?t.duration:void 0;let r;if(i&&Number.isFinite(null==t?void 0:t.offset)){const n=(e-t.offset)/i;r=n<0?0:n>1?1:n}const o=A(gg,this,Dg).call(this,t),s=A(gg,this,Lg).call(this,o);return Xm.getRenderTiming({type:o,timing:{duration:i,normalizedTime:r},timelineTime:e,active:t,renderNodeParams:n,state:s})}function Dg(t){return Xm.normalizeType(null==t?void 0:t.type)||Xm.defaultType}function Lg(t){if(!t||!M(lg,this))return null;let e=M(lg,this).get(t);return e||(e={},M(lg,this).set(t,e)),e}function Bg(){var t,e,n,i,r,o,s,a,l,c,u;const d=Number(null!==(t=null===(e=M(zv,this))||void 0===e?void 0:e.containerWidth)&&void 0!==t?t:null===(n=M(zv,this))||void 0===n?void 0:n.width),h=Number(null!==(i=null===(r=M(zv,this))||void 0===r?void 0:r.containerHeight)&&void 0!==i?i:null===(o=M(zv,this))||void 0===o?void 0:o.height);if(Number.isFinite(d)&&Number.isFinite(h)&&d>0&&h>0)return{width:Math.round(d),height:Math.round(h)};const f=null===(s=M(Bv,this))||void 0===s?void 0:s.element,p=Number(null==f?void 0:f.clientWidth),m=Number(null==f?void 0:f.clientHeight);if(Number.isFinite(p)&&Number.isFinite(m)&&p>0&&m>0)return{width:Math.round(p),height:Math.round(m)};const v=Number(null!==(a=null==f?void 0:f.width)&&void 0!==a?a:null===(l=M(ng,this))||void 0===l?void 0:l.width),g=Number(null!==(c=null==f?void 0:f.height)&&void 0!==c?c:null===(u=M(ng,this))||void 0===u?void 0:u.height);return Number.isFinite(v)&&Number.isFinite(g)&&v>0&&g>0?{width:Math.round(v),height:Math.round(g)}:null}function zg(t){const e=A(gg,this,Lg).call(this,t);return e&&"object"==typeof e&&(e.requestRender=()=>A(gg,this,Wg).call(this),e.viewportSize=A(gg,this,Bg).call(this)),e}function Wg(){M(dg,this)||(C(dg,this,!0),Promise.resolve().then((()=>{C(dg,this,!1),M(ig,this)&&A(gg,this,ry).call(this)&&A(gg,this,iy).call(this,M(ig,this))})))}function $g(t){if(!t||!M(lg,this))return;const e=M(lg,this).get(t);e&&Xm.resetRenderState(t,e),M(lg,this).delete(t)}function jg(){M(lg,this)&&(Xm.resetAllRenderStates(M(lg,this)),M(lg,this).clear())}function Ug(t,e,n,i){const r=A(gg,this,Dg).call(this,t);M(cg,this)&&M(cg,this)!==r&&A(gg,this,$g).call(this,M(cg,this)),C(cg,this,r);const o=A(gg,this,zg).call(this,r);return Xm.prepareRenderFrames({type:r,frames:e,timelineTime:n,timeline:M(Lv,this),active:t,renderNodeParams:i,state:o})}function qg(t){var e;return null!=t&&t.params&&"object"==typeof t.params?t.params:!t&&null!==(e=this.settings)&&void 0!==e&&e.defaultRenderParams&&"object"==typeof this.settings.defaultRenderParams?this.settings.defaultRenderParams:{}}function Vg(t){return t?String(t.renderPlacementId||t.type||"unknown"):"default"}function Gg(){if(!M(Lv,this)||!M(ig,this))return;const t=M(Lv,this).currentTime,e=M(Lv,this).getActiveRenderPlacement(t),n=A(gg,this,Vg).call(this,e);n!==M(ug,this)&&(C(ug,this,n),A(gg,this,iy).call(this,{...M(ig,this),time:t}))}function Hg(t){return!t||"object"!=typeof t||!Object.prototype.hasOwnProperty.call(t,"panAndScan")||!1!==t.panAndScan}function Kg(t,e){const n=A(gg,this,qg).call(this,t),i=null==n?void 0:n.stages;let r=Mv(null==i?void 0:i.pre),o=Mv(null==i?void 0:i.post);const s=A(gg,this,Hg).call(this,n),a=A(gg,this,Dg).call(this,t),l=Fv(r,"retarget")||Fv(o,"retarget");if(s&&!l){const i=Xm.getPanAndScanTarget(a,{frameCount:Array.isArray(e)?e.length:0,active:t,renderNodeParams:n});if("pre"===i){const t=Cv(Array.isArray(e)?e.length:0);t&&(r=[t,...r])}else if("post"===i){const t=Cv(1);t&&(o=[...o,t])}}else s||(r=Ov(r),o=Ov(o));return{preStages:r,postStages:o,renderNodeParams:n}}function Xg(t,e,n,i,r){const o=r||A(gg,this,Rg).call(this,t,n,i),s=A(gg,this,Kg).call(this,t,e),a=A(gg,this,Dg).call(this,t),l=A(gg,this,zg).call(this,a);return M(Kv,this).build({layoutType:null==t?void 0:t.type,frames:e,preStages:s.preStages,postStages:s.postStages,normalizedTime:o.normalizedTime,renderNodeDuration:o.duration,renderNodeParams:s.renderNodeParams,renderNodeState:l,timelineTime:n})}function Yg(){var t,e;const n=null===(t=M(Qv,this))||void 0===t||null===(e=t.getState)||void 0===e?void 0:e.call(t);return"out"===(null==n?void 0:n.phase)?M(Qv,this).buildOutgoingGraph():"in"===(null==n?void 0:n.phase)?M(Qv,this).buildIncomingGraph():null}function Qg(t,e,n,i){const r=n||e!==M(Xv,this),o=r||i;return r&&M(Jv,this)&&"function"==typeof M(Jv,this).updateOptions&&(M(Jv,this).updateOptions(oe.pipelineNodeId,{graph:t}),C(Xv,this,e)),M(Jv,this)&&"function"==typeof M(Jv,this).selectNode&&M(Yv,this)!==oe.pipelineNodeId&&(M(Jv,this).selectNode(oe.pipelineNodeId),C(Yv,this,oe.pipelineNodeId)),!(!o||!M(Jv,this)||"function"!=typeof M(Jv,this).render||(M(Jv,this).render({noRaf:!0}),0))}function Jg(t){if(!Array.isArray(M(tg,this))||!M(tg,this).length)return;const e=Number.isFinite(t)?Math.max(0,t):0;if(!(M(tg,this).length<=e)){for(let t=e;t<M(tg,this).length;t+=1){const e=M(tg,this)[t];if(e&&M(Jv,this)&&"function"==typeof M(Jv,this).releaseTexture)try{M(Jv,this).releaseTexture(e)}catch(t){}}M(tg,this).length=e,M(eg,this).length=e}}function Zg(t=[]){if(!M(Jv,this)||"function"!=typeof M(Jv,this).addTexture)return{didUpdate:!1,hasUploadFailure:!1,ready:!1};if("function"==typeof M(Jv,this).isContextUnavailable&&M(Jv,this).isContextUnavailable())return{didUpdate:!1,hasUploadFailure:!1,ready:!1};if(!Array.isArray(t)||!t.length)return A(gg,this,Jg).call(this,0),{didUpdate:!1,hasUploadFailure:!1,ready:!1};A(gg,this,Jg).call(this,t.length);let e=!1,n=!1,i=!0;for(let o=0;o<t.length;o+=1){var r;M(tg,this)[o]||"function"!=typeof M(Jv,this).addTexture||(M(tg,this)[o]=M(Jv,this).addTexture(null,"frame",o));const s=A(gg,this,Pg).call(this,t[o]),a=null===(r=t[o])||void 0===r?void 0:r.frame;if(M(tg,this)[o]&&a){if(!s||s!==M(eg,this)[o])try{M(tg,this)[o].fill(a),M(eg,this)[o]=s,e=!0}catch(t){i=!1,n=!0,M(eg,this)[o]=null}}else i=!1}return{didUpdate:e,hasUploadFailure:n,ready:i}}function ty(){if(M(og,this))return;const t="function"==typeof cd.requestAnimationFrame?t=>cd.requestAnimationFrame(t):t=>setTimeout(t,16),e="function"==typeof cd.cancelAnimationFrame?t=>cd.cancelAnimationFrame(t):clearTimeout;C(sg,this,e);const n=()=>{var e,i;if(null!==(e=M(Qv,this))&&void 0!==e&&null!==(i=e.getState)&&void 0!==i&&i.call(e)){if(M(ig,this)){const t=A(gg,this,Fg).call(this),e=Date.now();(!t||!M(ag,this)||e-M(ag,this)>=t)&&(C(ag,this,e),A(gg,this,iy).call(this,M(ig,this)))}C(og,this,t(n))}else C(og,this,null)};C(og,this,t(n))}function ey(){M(og,this)&&M(sg,this)&&M(sg,this).call(this,M(og,this)),C(og,this,null),C(sg,this,null),C(ag,this,null)}function ny(t){var e,n;const i=null===(e=M(Qv,this))||void 0===e||null===(n=e.getState)||void 0===n?void 0:n.call(e);return"out"===(null==i?void 0:i.phase)&&M(rg,this)?M(rg,this):t}function iy(t={},e=!1){try{var n,i;t&&C(ig,this,t);const e=null===(n=M(Bv,this))||void 0===n?void 0:n.element,r=null===(i=M(Bv,this))||void 0===i?void 0:i.gl;if(!e||!r)return;if(M(pg,this)||"function"==typeof r.isContextLost&&r.isContextLost())return void C(pg,this,!0);if(!A(gg,this,ry).call(this))return;const o=A(gg,this,ny).call(this,t),s=Number.isFinite(null==o?void 0:o.time)?o.time:void 0;if(!Number.isFinite(s))return;if(A(gg,this,Ig).call(this,e),!M(Jv,this))return;const a=M(Lv,this)&&"function"==typeof M(Lv,this).getActiveRenderPlacement?M(Lv,this).getActiveRenderPlacement(s):void 0,l=A(gg,this,Vg).call(this,a);l!==M(ug,this)&&C(ug,this,l);const c=Array.isArray(null==o?void 0:o.frames)?o.frames:[],u=A(gg,this,qg).call(this,a),d=A(gg,this,Hg).call(this,u),h=A(gg,this,Ug).call(this,a,c,s,u),f=A(gg,this,Rg).call(this,a,s,u),p=A(gg,this,Og).call(this,h,{useViewportSize:d}),m=A(gg,this,Zg).call(this,h),v=m.didUpdate;if(h.length>0&&!m.ready)return void(m.hasUploadFailure&&this.log.warn("Skipping render because one or more input textures could not be uploaded."));const g=A(gg,this,Xg).call(this,a,h,s,u,f),y=A(gg,this,Yg).call(this);let b=g.graph,k=g.signature,w=!!g.isDynamic;y&&Array.isArray(y.graph)&&y.graph.length&&(b=b.concat(y.graph),k=`${k}|${y.signature||"transition"}`,w=w||!!y.forceUpdate);const x=p||v||w||y&&Array.isArray(y.graph)&&y.graph.length;A(gg,this,Qg).call(this,b,k,w,x)&&h.length>0&&A(gg,this,Eg).call(this)}catch(n){if(A(gg,this,Sg).call(this,n))return void A(gg,this,Ag).call(this,n,t,e);throw n}}function ry(){var t;const e=null===(t=M(Lv,this))||void 0===t?void 0:t.state;return e===_v||e===Ev||e===Tv||e===Sv}function oy(t){return"number"==typeof t&&Number.isFinite(t)&&t>0}function sy(t){return t&&"resource"===t.entryType&&t.transferSize>0&&t.duration>0&&t.responseEnd>=t.requestStart}function ay(t){return Array.isArray(t)&&0!==t.length?t.reduce(((t,e)=>t+e),0)/t.length:NaN}oe=yg;var ly=new WeakMap,cy=new WeakMap,uy=new WeakMap,dy=new WeakMap,hy=new WeakSet;class fy extends sd{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(...t){super(...t),O(this,hy),F(this,ly,void 0),F(this,cy,void 0),F(this,uy,void 0),F(this,dy,void 0),C(ly,this,!!(cd&&cd.navigator&&cd.navigator.connection)),C(cy,this,!(!cd||!cd.performance||"function"!=typeof cd.performance.getEntriesByType)),C(uy,this,A(hy,this,my).call(this)),C(dy,this,A(hy,this,ky).call(this))}guesstimate(){const t=A(hy,this,xy).call(this);this.log.debug("[guesstimate] Data:",t);const e=A(hy,this,wy).call(this,t),n=oy(e)?e:t.defaultKbps;return A(hy,this,vy).call(this,n),this.log.info(`[guesstimate] Result: ${n} kbps`),n}update(t){oy(t)&&A(hy,this,vy).call(this,t)}onDispose(){C(uy,this,void 0),C(dy,this,void 0)}}function py(){return Math.round(Date.now()/1e3)}function my(){try{if(!cd||!cd.localStorage||"function"!=typeof cd.localStorage.getItem)return}catch(t){return}const t=this.settings.persistentStorage.key,e=cd.localStorage.getItem(t);if(e)try{const t=JSON.parse(e),n=this.settings.persistentStorage.ttl,i=A(hy,this,py).call(this)-t.timestamp;if("number"==typeof n&&n>=0&&i>n)return null;if(!oy(t.value))return;return t.value}catch(t){return}}function vy(t){if(!oy(t))return;try{if(!cd||!cd.localStorage||"function"!=typeof cd.localStorage.setItem)return}catch(t){return}const e=this.settings.persistentStorage.key,n=JSON.stringify({value:t,timestamp:A(hy,this,py).call(this)});try{cd.localStorage.setItem(e,n),C(uy,this,t)}catch(t){}}function gy(){return cd&&cd.performance&&"function"==typeof cd.performance.getEntriesByType?ay(cd.performance.getEntriesByType("resource").filter(sy).map((t=>8*t.transferSize/t.duration))):NaN}function yy(){if(!cd||!cd.navigator||!cd.navigator.connection)return NaN;const t=cd.navigator.connection.downlink;return oy(t)?1e3*t:NaN}function by(){if(!M(ly,this))return NaN;const t=cd.navigator.connection,e=t.effectiveType||t.type,n=this.settings.connectionType||{};return e&&Object.prototype.hasOwnProperty.call(n,e)?n[e]:NaN}function ky(){const t=this.settings.ua||{};return mv()?t.android:vv()?t.ios:t.desktop}function wy(t){const e=Array.isArray(this.settings.priorities)?this.settings.priorities:[];for(let n=0;n<e.length;n+=1){const i=e[n];if(!Array.isArray(i)||0===i.length)continue;const r=i.map((e=>t[e])).filter((t=>oy(t)));if(r.length===i.length)return this.log.debug("[#selectFromPriorities] Selected from priorities:",i,"with values:",r),ay(r)}return NaN}function xy(){const t=this.settings.testOverrides||{},e=oy(t.resourceTiming)?t.resourceTiming:A(hy,this,gy).call(this),n=oy(t.downlink)?t.downlink:A(hy,this,yy).call(this),i=oy(t.persistentValue)?t.persistentValue:M(uy,this),r=oy(t.connectionType)?t.connectionType:A(hy,this,by).call(this),o=oy(t.ua)?t.ua:M(dy,this);return{defaultKbps:this.settings.defaultKbps,resourceTiming:e,downlink:n,connectionType:r,persistentValue:i,ua:o}}const _y=new td;function Ty(t){return"string"!=typeof t||0===t.length?[]:t.split(".").filter((t=>t.length>0))}function Ey(t){if("string"!=typeof t)return!1;if(0===t.length)return!1;const e=Number(t);return Number.isInteger(e)&&String(e)===t}function Iy(t){return null!==t&&"object"==typeof t}function Sy(t,e,n){const i=Ty(e);if(0===i.length)return void 0===t?n:t;let r=t;for(let t=0;t<i.length;t+=1){if(null==r)return n;if(r=r[i[t]],void 0===r)return n}return void 0===r?n:r}function Ay(t,e,n){if(!Iy(t))return t;const i=Ty(e);if(0===i.length)return t;let r=t;for(let t=0;t<i.length;t+=1){const e=i[t];if(t===i.length-1){r[e]=n;break}Iy(r[e])||(r[e]=Ey(i[t+1])?[]:{}),r=r[e]}return t}const Ny={get:(t,e)=>cd&&cd.eko?Sy(cd.eko,t,e):e,set(t,e){if(cd)return cd.eko&&"object"==typeof cd.eko||(cd.eko={}),Ay(cd.eko,t,e),cd.eko}},My=cd&&cd.performance,Fy=My&&"function"==typeof My.now?()=>My.now():()=>Date.now();function Cy(){return"undefined"==typeof AbortController?null:new AbortController}function Oy(){const t=new Error("The operation was aborted");return t.name="AbortError",t.code="ABORT_ERR",t}function Py(t,e){return!(!e||!e.aborted)||!!t&&("AbortError"===t.name||"ABORT_ERR"===t.code||20===t.code)}const Ry=2,Dy=100,Ly=2,By="runtime.downloadSpeedSamples",zy=Zu("download","warn");function Wy(t){return new Promise((e=>{setTimeout(e,t)}))}function $y(t){return t>=500}function jy(t){if(!t||!t.headers||"function"!=typeof t.headers.get)return 0;const e=t.headers.get("content-length");if(!e)return 0;const n=Number(e);return Number.isNaN(n)||n<0?0:n}function Uy(t,e,n,i,r,o){const s={bytes:t,durationMs:e,kbps:e>0?8*t/e:0,startTime:n,endTime:i,url:o};try{let t=Ny.get(r);t||(t=[],Ny.set(r,t)),t.push(s)}catch(t){}return s}async function qy(t,e={}){const{method:n="GET",headers:i,body:r,retries:o=Ry,retryDelay:s=Dy,backoffFactor:a=Ly,samplesTargetPath:l=By,fetch:c,loglevel:u="warn",cache:d,signal:h,onProgress:f,returnType:p="default"}=e;zy.setLevel(u);const m=function(t){if(t)return t;if(cd&&"function"==typeof cd.fetch)return cd.fetch.bind(cd);throw new Error("fetch is not available in this environment")}(c);let v=0,g=s;for(;;){if(h&&h.aborted)throw Oy();const e=Fy();try{const s=await m(t,{method:n,headers:i,body:r,cache:d,mode:"cors",signal:h});if(h&&h.aborted)throw Oy();if(!s.ok){if(v<o&&$y(s.status)){v+=1,zy.warn(`[${t}] Download attempt #${v} failed with status ${s.status}, retrying in ${g}ms...`),await Wy(g),g*=a;continue}zy.error(`[${t}] Download attempt #${v} failed with status ${s.status}, no more retries.`);const e=new Error(`Download failed with status ${s.status}`);throw e.status=s.status,e}let c=Fy();const u=jy(s),y="arrayBuffer"===p||"bytes"===p,b=y&&"function"==typeof f;let k,w,x,_,T,E=0;if(y&&s.body&&"function"==typeof s.body.getReader&&b){const t=s.body.getReader(),e=[];for(;;){if(h&&h.aborted)throw Oy();const{done:n,value:i}=await t.read();if(n)break;if(i&&i.length){const t=Fy();Number.isFinite(_)||(_=t),T=t,e.push(i),E+=i.length,f({loaded:E,total:u||void 0,chunk:i})}}k=new Uint8Array(E);let n=0;e.forEach((t=>{k.set(t,n),n+=t.length})),c=Fy()}else if(y){const t=await s.arrayBuffer();k=new Uint8Array(t),E=k.length,c=Fy()}else"text"===p?(w=await s.text(),c=Fy()):"json"===p&&(x=await s.json(),c=Fy());if(h&&h.aborted)throw Oy();const I=y?k?k.length:E:("text"===p&&"string"==typeof w?w.length:0)||("json"===p&&x?JSON.stringify(x).length:0),S=u||I||0;let A=e,N=c;Number.isFinite(_)&&(A=_,Number.isFinite(T)&&(N=Math.max(T,c))),(!Number.isFinite(A)||!Number.isFinite(N)||N<A)&&(A=e,N=c);const M=Math.max(0,N-A),F=Uy(S,M,A,N,l,t);try{_y.trigger("download:sample",F)}catch(t){}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 t=k||new Uint8Array(await s.arrayBuffer());return"arrayBuffer"===p?t.buffer:t}return"text"===p?w:"json"===p?x:C}catch(e){if(Py(e,h))throw"AbortError"===e.name?e:Oy();if(!(v<o)||e.status&&!$y(e.status))throw zy.error(`[${t}] Download attempt #${v} failed with error ${e}, no more retries.`),e;v+=1,zy.warn(`[${t}] Download attempt #${v} failed with error ${e}, retrying in ${g}ms...`),await Wy(g),g*=a}}}const Vy={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"]}},Gy=Object.freeze(Object.entries(Vy).reduce(((t,[e,n])=>(Object.prototype.hasOwnProperty.call(n,"default")&&(t[e]=n.default),t)),{})),Hy=Zu("config","warn");function Ky(t){return Gy[t]}var Xy=new WeakMap,Yy=new WeakMap,Qy=new WeakMap,Jy=new WeakMap,Zy=new WeakMap,tb=new WeakSet;class eb extends sd{get name(){return"DownloadSpeed"}get defaults(){return{alpha:.3,maxSamples:30,minBytesPerSample:1024,minDurationMs:5,maxSampleKbpsCap:void 0,ignoreCacheHits:!0,samplesPath:"runtime.downloadSpeedSamples",initialKbps:Ky("initialKbps"),probeUrl:void 0,defaultKbps:2500}}constructor(...t){super(...t),O(this,tb),F(this,Xy,void 0),F(this,Yy,void 0),F(this,Qy,void 0),F(this,Jy,void 0),F(this,Zy,void 0),C(Qy,this,[]),C(Yy,this,0),C(Xy,this,A(tb,this,rb).call(this)),C(Zy,this,Cy()),C(Jy,this,(t=>{A(tb,this,ub).call(this,t,"event")})),A(tb,this,ob).call(this),_y.on("download:sample",M(Jy,this)),A(tb,this,sb).call(this),this.log.debug(`[#constructor] Initial estimate: ${M(Xy,this)} kbps`)}getKbps(){return M(Xy,this)}addSample(t){A(tb,this,ub).call(this,t,"manual")}reset(){C(Qy,this,[]),C(Yy,this,0),C(Xy,this,A(tb,this,rb).call(this))}onDispose(){M(Zy,this)&&M(Zy,this).abort(),C(Zy,this,null),_y.off("download:sample",M(Jy,this)),C(Qy,this,[]),C(Yy,this,0),C(Xy,this,void 0),C(Jy,this,null)}}function nb(t,e){return!!(this.settings.ignoreCacheHits&&(0===e||t&&"boolean"==typeof t.cached&&t.cached||t&&"number"==typeof t.transferSize&&"number"==typeof t.encodedBodySize&&t.transferSize<=t.encodedBodySize))}function ib(t){if(!t||"object"!=typeof t)return null;const e=Number(t.bytes),n=Number(t.durationMs);let i=oy(t.kbps)?Number(t.kbps):NaN;return!oy(i)&&n>0&&oy(e)&&(i=8*e/n),oy(i)?e<=this.settings.minBytesPerSample||n<=this.settings.minDurationMs||A(tb,this,nb).call(this,t,e)?null:(oy(this.settings.maxSampleKbpsCap)&&i>this.settings.maxSampleKbpsCap&&(i=this.settings.maxSampleKbpsCap),{...t,bytes:e,durationMs:n,kbps:i}):null}function rb(){const t=this.settings.initialKbps;if(oy(t))return t;if("auto"===t)try{const t=(new fy).guesstimate();if(oy(t))return t}catch(t){}return this.settings.defaultKbps}function ob(){const t=Ny.get(this.settings.samplesPath,[]);if(!Array.isArray(t)||0===t.length)return;const e=t.slice(-this.settings.maxSamples);for(let t=0;t<e.length;t+=1)A(tb,this,ub).call(this,e[t],"replay",{emit:!1})}async function sb(){if(!this.settings.probeUrl||M(Yy,this)>0)return;const t=M(Zy,this)?M(Zy,this).signal:void 0;if(!t||!t.aborted)try{await qy(this.settings.probeUrl,{cache:"no-store",samplesTargetPath:this.settings.samplesPath,signal:t})}catch(t){}}function ab(t){return"number"==typeof t.startTime&&"number"==typeof t.endTime&&Number.isFinite(t.startTime)&&Number.isFinite(t.endTime)&&t.startTime>=0&&t.endTime>t.startTime}function lb(t,e){if(!A(tb,this,ab).call(this,t)||!A(tb,this,ab).call(this,e))return 0;const n=Math.max(t.startTime,e.startTime);return Math.min(t.endTime,e.endTime)-n}function cb(t){if(!A(tb,this,ab).call(this,t))return t;const e=[];for(let n=0;n<M(Qy,this).length;n+=1){const i=M(Qy,this)[n];A(tb,this,ab).call(this,i)&&(A(tb,this,lb).call(this,t,i)>0&&e.push(i))}if(0===e.length)return t;C(Qy,this,M(Qy,this).filter((t=>!e.includes(t))));const n=[t,...e],i=n.reduce(((t,e)=>t+(e.bytes||0)),0),r=Math.min(...n.map((t=>t.startTime))),o=Math.max(...n.map((t=>t.endTime))),s=o-r;if(!oy(i)||s<=0)return t;const a={bytes:i,durationMs:s,kbps:8*i/s,startTime:r,endTime:o,url:t.url||e[e.length-1].url};return A(tb,this,ib).call(this,a)}function ub(t,e,{emit:n=!0}={}){const i=A(tb,this,ib).call(this,t);if(!i)return;const r=A(tb,this,cb).call(this,i);if(!r)return;C(Yy,this,M(Yy,this)+1),M(Qy,this).push(r),M(Qy,this).length>this.settings.maxSamples&&M(Qy,this).shift();const o=this.defaults.alpha,s="number"==typeof this.settings.alpha?this.settings.alpha:o,a=oy(M(Xy,this)),l=a?M(Xy,this):r.kbps,c=a||1!==M(Yy,this)?s*r.kbps+(1-s)*l:r.kbps;C(Xy,this,c),this.log.debug(`[#ingestSample] Next estimate: ${c} kbps`),n&&this.trigger("download:speed",{kbps:M(Xy,this),sample:r,source:e,samplesCount:M(Yy,this)})}class db{constructor(t={}){const{id:e,url:n,uri:i,mime:r,codecs:o,bandwidth:s,timescale:a,sizeBytes:l,...c}=t;if(!e)throw new Error("Representation requires id");const u=n||i;if(!u)throw new Error("Representation requires url or uri");this.id=e,this.url=u,this.mime=r,this.codecs=o,this.baseCodec=function(t=""){if(!t||"string"!=typeof t)return;const e=t.split(",")[0].trim();if(!e)return;const n=e.match(/^[a-z0-9]+/i);return n?n[0].toLowerCase():void 0}(o),oy(s)&&(this.bandwidth=s),oy(a)&&(this.timescale=a),oy(l)&&(this.sizeBytes=l),Object.assign(this,c)}}class hb{#F=new Map;#C;#O;#P=0;#R;constructor(t={}){const{id:e,offset:n=0,duration:i=0,isInit:r=!1,representations:o=[]}=t;if(!e)throw new Error("Segment requires id");o.forEach((t=>{if(!t||!t.url&&!t.uri)throw new Error("Segment representation must include uri or url")})),this.id=e,this.offset=n,this.duration=i,this.isInit=!!r,this.originalRepresentations=o.map((t=>t instanceof db?t:new db(t))),this.representations=this.originalRepresentations.map((t=>t)),this.appliedFilters=[],this.loadAttempts=0,this.loadError=void 0}setRepresentationBuffer(t,e){t&&e&&this.#F.set(t,e)}setDownloadProgress(t,e){const n=Number(t);Number.isFinite(n)&&n>=0&&(this.#P=Math.max(this.#P,n));const i=Number(e);Number.isFinite(i)&&i>0&&(this.#R=i)}setChosenRepresentation(t){this.#C=t;const e=null==t?void 0:t.id;if(!(this.isInit||!e||this.#F.size<=1))for(const t of this.#F.keys())t!==e&&this.#F.delete(t)}setABRDecisionSnapshot(t){if(!t||"object"!=typeof t)return void(this.#O=void 0);const e={...t};Array.isArray(t.availableRepresentations)&&(e.availableRepresentations=t.availableRepresentations.map((t=>({...t})))),this.#O=e}markLoadAttempt(){const t=Number(this.loadAttempts);this.loadAttempts=Number.isFinite(t)&&t>0?t+1:1,this.loadError=void 0}setLoadError(t){this.loadError=t||new Error("Segment load failed")}getRepresentationBuffer(t){return this.#F.get(t)}get chosenRepresentation(){return this.#C}get abrDecision(){return this.#O}get arrayBuffer(){return this.#C?this.#F.get(this.#C.id):void 0}get retainedByteLength(){let t=0;for(const e of this.#F.values())e&&"number"==typeof e.byteLength&&(t+=e.byteLength);return t}get bufferedRatio(){var t;const e=oy(this.#R)?this.#R:null===(t=this.#C)||void 0===t?void 0:t.sizeBytes;return oy(e)?Math.min(1,Math.max(0,this.#P/e)):this.retainedByteLength>0?1:0}get isLoaded(){return this.retainedByteLength>0}evict(){this.#C=void 0,this.#O=void 0,this.#F.clear(),this.#P=0,this.#R=void 0}}class fb{constructor(t={}){const{timestamp:e,name:n,data:i,isSticky:r=!1}=t;this.timestamp="number"==typeof e?e:0,this.name="string"==typeof n?n:"",this.data=i,this.isSticky="boolean"==typeof r&&r}}function pb(t,e){const n=Number(null==t?void 0:t.offset),i=Number(null==t?void 0:t.duration);if(!e)return{offset:n,duration:i};const r=(null==t?void 0:t.chosenRepresentation)||(Array.isArray(null==t?void 0:t.representations)?t.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 mb(t,e,n={}){if(!Array.isArray(t)||!t.length)return;const i=Number(e);if(!Number.isFinite(i))return;const r=!!n.preferRepresentationTime;let o,s,a=-1/0;for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||n.isInit)continue;o||(o=n);const l=pb(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 vb=new Set(["video","audio","image","cue","data","bbox"]);let gb=class{constructor(t={}){const{id:e,type:n,offset:i=0,duration:r,source:o,segments:s=[],cues:a=[]}=t;if(!e)throw new Error("Track requires id");if(!vb.has(n))throw new Error(`Track type must be one of ${Array.from(vb).join("|")}`);this.id=e,this.type=n,this.offset=i,this.duration=oy(r)?r:void 0,this.source=o,"cue"===n?(this._cues=a.map((t=>t instanceof fb?t:new fb(t))),this._segments=[]):(this._segments=s.map((t=>t instanceof hb?t:new hb(t))),this._cues=void 0)}get segments(){return this._segments.slice()}get cues(){if("cue"===this.type)return this._cues.slice()}get endTime(){if(oy(this.duration))return this.offset+this.duration;if(!this._segments.length)return;const t=this._segments.reduce(((t,e)=>{const n=oy(e.duration)?e.duration:0;return Math.max(t,e.offset+n)}),this.offset);return t}get buffered(){const t=this._segments.map((t=>({duration:oy(null==t?void 0:t.duration)?t.duration:0,offset:oy(null==t?void 0:t.offset)?t.offset:0,ratio:t&&!t.isInit&&"number"==typeof t.bufferedRatio?t.bufferedRatio:0}))).filter((t=>t.duration>0&&t.ratio>0));if(!t.length)return;const e=t.reduce(((t,e)=>Math.min(t,e.offset)),1/0),n=t.reduce(((t,e)=>{const n=e.offset+e.duration*Math.min(1,e.ratio);return Math.max(t,n)}),0);return!Number.isFinite(e)||!Number.isFinite(n)||n<=e?void 0:{start:e,end:n}}getMediaSegmentAtTime(t,e={}){return mb(this._segments,t,e)}setSegments(t=[]){if("cue"===this.type)return;const e=Array.isArray(t)?t:[];this._segments=e.map((t=>t instanceof hb?t:new hb(t)))}};function yb(t){return"string"==typeof t?t:t&&"object"==typeof t?t.nodeId||t.nodeIdOrRef||t.id:void 0}function bb(t){const e=yb(t);let n=1;if(t&&"object"==typeof t&&oy(t.weight)&&(n=t.weight),!e)throw new Error("Child entry requires a nodeId");return{nodeId:e,weight:n}}function kb(t){return(Array.isArray(t)?t:[]).map((t=>bb(t)))}function wb(t,e=void 0){if("string"==typeof t){const e=t.match(/\d+\.?\d*/);if(e){const t=Number(e[0]);if(Number.isFinite(t))return t}}else if("number"==typeof t&&Number.isFinite(t))return t;return e}function xb(t,e){if(t){if(t.includes("$Number%")){const n=t.match(/\$Number%0(\d+)d\$/);if(n){const i=Number(n[1]),r=String(e).padStart(i,"0");return t.replace(/\$Number%0\d+d\$/,r)}}return t.replace(/\$Number\$/g,String(e))}}function _b(t,e){if(e)try{var n;return new URL(e,t||(null==cd||null===(n=cd.location)||void 0===n?void 0:n.href)||void 0).toString()}catch(t){return e}}const Tb=new Map;class Eb{static register(t,e){if(!t||"function"!=typeof e)throw new Error("ManifestFactory.register requires type and parser function");Tb.set(t,e)}static inferType(t={}){const{typeHint:e,url:n,mimeType:i,body:r}=t;return e||function(t=""){const e=function(t=""){return t&&"string"==typeof t?t.split("#")[0].split("?")[0].toLowerCase():""}(t);return e.endsWith(".mpd")?"dash":e.endsWith(".ivd")?"ivd":e.endsWith(".jpg")||e.endsWith(".jpeg")||e.endsWith(".png")||e.endsWith(".webp")||e.endsWith(".gif")||e.endsWith(".avif")?"image":void 0}(n||"")||function(t=""){const e=t.toLowerCase();return e.includes("dash")||e.includes("mpd")||e.includes("xml")?"dash":e.includes("ivd")||e.includes("json")?"ivd":e.includes("image/")?"image":void 0}(i||"")||function(t=""){const e="string"==typeof t?t.trim():"";if(e.startsWith("<")&&e.includes("<MPD"))return"dash";if(e.startsWith("{"))try{const t=JSON.parse(e);if(t&&"object"==typeof t)return"ivd"}catch(t){return}}(r||"")}static parse(t={}){const e=Eb.inferType(t);if(!e||!Tb.has(e))throw new Error("Unsupported manifest type");return Tb.get(e)(t)}}Eb.register("dash",(function(t={}){const{body:e,url:n}=t,i=function(){if(cd&&"function"==typeof cd.DOMParser)return new cd.DOMParser;throw new Error("DOMParser is not available in this environment")}().parseFromString(e||"","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=wb(r.getAttribute("mediaPresentationDuration"));l=Number.isFinite(l)?l:void 0,s.forEach(((t,e)=>{const i=t.getAttribute("mimeType")||"",r=function(t=""){const e=t.toLowerCase();return e.includes("video")?"video":e.includes("audio")?"audio":e.includes("image")?"image":"data"}(i),o=t.getAttribute("id")||`${r}-${e+1}`,s=t.getElementsByTagName("SegmentTemplate")[0],c=Array.from(t.getElementsByTagName("Representation")).map((t=>function(t,e,n){const i=t.getAttribute("id")||t.getAttribute("representationId")||"",r=wb(t.getAttribute("bandwidth")),o=t.getAttribute("codecs"),s=t.getAttribute("mimeType")||e&&e.getAttribute("mimeType")||n,a=t.getElementsByTagName("SegmentTemplate")[0]||e;return{repId:i,bandwidth:r,codecs:o,mime:s,media:a?a.getAttribute("media"):void 0,initialization:a?a.getAttribute("initialization"):void 0,timescale:wb(a&&a.getAttribute("timescale"))||wb(e&&e.getAttribute("timescale"),1)||1,startNumber:wb(a&&a.getAttribute("startNumber"))||wb(e&&e.getAttribute("startNumber"),1)||1,timeline:function(t){const e=[],n=t.getElementsByTagName("SegmentTimeline")[0];if(!n)return e;const i=Array.from(n.getElementsByTagName("S"));let r=0;for(let t=0;t<i.length;t+=1){const n=i[t],o=wb(n.getAttribute("t")),s=wb(n.getAttribute("d")),a=wb(n.getAttribute("r"),0);if(!oy(s))continue;oy(o)&&(r=o);const l=a>=0?a:0;for(let t=0;t<=l;t+=1)e.push({start:r,duration:s}),r+=s}return e}(a)}}(t,s,i))),u=c.map((t=>({id:t.repId,url:_b(n,xb(t.initialization,t.startNumber)),bandwidth:t.bandwidth,mime:t.mime,codecs:t.codecs,timescale:t.timescale}))).filter((t=>t.url)),d=c.reduce(((t,e)=>{const n=Array.isArray(null==t?void 0:t.timeline)?t.timeline.length:0;return(Array.isArray(null==e?void 0:e.timeline)?e.timeline.length:0)>n?e:t}),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 t=0;t<f;t+=1){const e=h[t];if(!e)continue;const i=c.map((e=>{const i=e.startNumber+t,r=e.timescale||m,o=Array.isArray(e.timeline)?e.timeline[t]:void 0;if(!o)return null;const s=o.start,a=o.duration;return{id:e.repId,url:_b(n,xb(e.media,i)),bandwidth:e.bandwidth,mime:e.mime,codecs:e.codecs,timescale:e.timescale,segIndex:t,segStart:s/r,segDuration:a/r}})).filter(Boolean);i.length&&p.push({id:`${o}-seg-${t+1}`,offset:e.start/m,duration:e.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}})),Eb.register("ivd",(function(t={}){var e;const{body:n,url:i}=t;let r;try{r="string"==typeof n?JSON.parse(n):n}catch(t){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(((t,e)=>{const n=function(t){const e=(t.mimeType||"").toLowerCase();return e.includes("video")?"video":e.includes("audio")?"audio":"data"}(t),i=Number.isInteger(t.altIndex)?t.altIndex:0,r=`${n}-${i}`,o=(l=e,{id:`${(a=t).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:oy(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(((t,e)=>{const n=new Map;t.reps.forEach((t=>{const e=Number.isInteger(t.segIndex)?t.segIndex:0;n.has(e)||n.set(e,[]),n.get(e).push(t)}));const i=Array.from(n.keys()).sort(((t,e)=>t-e));let o=0;const s=i.map((i=>{var r;const s=n.get(i)||[],a=(null===(r=s.find((t=>oy(t.duration))))||void 0===r?void 0:r.duration)||0,l={id:`${t.type}-${t.altIndex}-${e+1}-seg-${i+1}`,offset:o,duration:a,isInit:!1,representations:s.map((t=>{const{duration:e,segIndex:n,...i}=t;return i}))};return o+=a,l})),a=s.reduce(((t,e)=>t+(oy(e.duration)?e.duration:0)),0),l=oy(r.duration)?r.duration:a||void 0;return{id:`${t.type}-${t.altIndex}-${e+1}`,type:t.type,offset:0,duration:l,segments:s}})),l=r.mainTrackId||(null===(e=a.find((t=>"video"===t.type)))||void 0===e?void 0:e.id)||a[0]&&a[0].id,c=a.find((t=>t.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}})),Eb.register("image",(function(t={}){const e=null==t?void 0:t.url;if(!e||"string"!=typeof e)throw new Error("ImageParser requires url");const n=oy(null==t?void 0:t.duration)?t.duration:30,i=oy(null==t?void 0:t.width)?t.width:void 0,r=oy(null==t?void 0:t.height)?t.height:void 0,o={id:"image-1",url:e,mime:"string"==typeof(null==t?void 0:t.mimeType)?t.mimeType:void 0};oy(i)&&oy(r)&&(o.width=i,o.height=r);const s="image-1";return{id:e,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 Ib=["video/mp4"];function Sb(t){return Ib.includes(t.mime)}var Ab={name:"containers",fn:function(t=[]){return t.filter(Sb)},isRelevantForTrack:function(t){return"video"===(null==t?void 0:t.type)}};const Nb=new(se=new WeakMap,ae=new WeakSet,class extends sd{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(...t){super(...t),O(this,ae),F(this,se,void 0),C(se,this,new Map)}onDispose(){M(se,this)&&M(se,this).clear()}async sortRepsCodecs(t=[]){if(!Array.isArray(t)||0===t.length)return[];const e=[],n=new Set;let i=0;t.forEach((t=>{const r=null==t?void 0:t.baseCodec;r&&!n.has(r)&&(n.add(r),e.push({codec:r,rep:t,index:i}),i+=1)}));const r=(await Promise.all(e.map((async t=>{const{score:e}=await A(ae,this,Pb).call(this,t.rep);return{...t,score:e}})))).sort(((t,e)=>{const n=e.score-t.score;return 0!==n?n:t.index-e.index}));return this.log.info("[sortRepsCodecs] Sorted entries:",r),r.map((t=>t.codec))}});function Mb(){return!!(cd&&cd.navigator&&cd.navigator.mediaCapabilities&&"function"==typeof cd.navigator.mediaCapabilities.decodingInfo)}function Fb(t){if(!t||"object"!=typeof t)return void this.log.debug("[#buildConfig] Invalid representation:",t);const e=t.mime||t.mimeType||"",n=function(t="",e=""){const n=t||"",i=e||"";return i?`${n}; codecs="${i}"`:n}(e,t.codecs||"");return function(t=""){return t.toLowerCase().includes("video")}(e)?(this.log.debug("[#buildConfig] Building video config for:",t),{type:"file",video:{contentType:n,width:t.width||1920,height:t.height||1080,bitrate:t.videoBandwidth||t.bandwidth||0,framerate:t.framerate||t.frameRate||24}}):function(t=""){return t.toLowerCase().includes("audio")}(e)?(this.log.debug("[#buildConfig] Building audio config for:",t),{type:"file",audio:{contentType:n,channels:t.channels||2,bitrate:t.audioBandwidth||t.bandwidth||0,samplerate:t.audioSamplingRate||48e3}}):void this.log.debug("[#buildConfig] Unknown mime type:",e)}function Cb(t){return t?JSON.stringify(t):"invalid"}async function Ob(t){if(!this.settings.enabled||!A(ae,this,Mb).call(this)||!t)return this.log.debug("[#queryCapabilities] Not supported, returning false",t),{supported:!1,smooth:!1,powerEfficient:!1};const e=A(ae,this,Cb).call(this,t),n=M(se,this).get(e);if(n)return n;let i;try{i=await cd.navigator.mediaCapabilities.decodingInfo(t)}catch(t){i={supported:!1,smooth:!1,powerEfficient:!1}}return this.log.debug("[#queryCapabilities] Config:",t,"\nDecoding info result:",i),M(se,this).set(e,i),i}async function Pb(t){if(A(ae,this,Db).call(this,t))return this.log.debug("[#scoreRepresentation] Blocking HEVC on Firefox versions below support threshold",null==t?void 0:t.codecs),{score:-1e3,capability:{supported:!1,smooth:!1,powerEfficient:!1}};const e=A(ae,this,Fb).call(this,t),n=await A(ae,this,Ob).call(this,e),i=function(t="",e={}){const n=(t||"").toLowerCase();return Object.keys(e).reduce(((t,i)=>n.includes(i.toLowerCase())?e[i]:t),0)}(t.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 Rb(){if(!bv())return!1;const t=kv();return!Number.isFinite(t)||t<150}function Db(t){if(!A(ae,this,Rb).call(this))return!1;const e=function(t=""){const e=String(t||"").toLowerCase(),[n]=e.split(".");return n||""}((null==t?void 0:t.baseCodec)||(null==t?void 0:t.codecs)||"");return"hvc1"===e||"hev1"===e}const Lb=[],Bb=()=>!0;[Ab,{name:"force-video-codec",fn:function(t=[],{node:e}={}){const n=function(t){if("string"!=typeof t)return;const e=t.split(",")[0].trim();if(!e)return;const n=e.match(/^[a-z0-9]+/i);return n?n[0].toLowerCase():void 0}(null==e?void 0:e.forceVideoCodec);if(!n)return t;const i=t.filter((t=>(null==t?void 0:t.baseCodec)===n));return i.length?i:t},isRelevantForTrack:function(t){return"video"===(null==t?void 0:t.type)}},{name:"media-capabilities",fn:async function(t=[],{track:e}){if(null==e||!e.preferredCodec){const n=await Nb.sortRepsCodecs(t);if(!Array.isArray(n)||0===n.length)return t;e.preferredCodec=n[0]}return t.filter((t=>(null==t?void 0:t.baseCodec)===e.preferredCodec))},isRelevantForTrack:function(t){return"video"===(null==t?void 0:t.type)}}].forEach((({name:t,fn:e,isRelevantForTrack:n})=>{!function(t,e,{isRelevantForTrack:n}={}){if(!t||"function"!=typeof e)throw new Error("registerRepresentationFilter requires a name and function");const i="function"==typeof n?n:Bb;Lb.push({name:t,fn:e,isRelevantForTrack:i})}(t,e,{isRelevantForTrack:n})}));const zb=Zu("Node","warn"),Wb={start:0,end:0},$b=.001;function jb(t){if(!Array.isArray(t)||!t.length)return;const e=t.map((t=>{const e=Number(null==t?void 0:t.segStart),n=Number(null==t?void 0:t.segDuration);return!Number.isFinite(e)||!Number.isFinite(n)||n<=0?null:{start:e,duration:n}}));if(e.some((t=>!t)))return;const n=e[0];return e.every((t=>Math.abs(t.start-n.start)<=$b&&Math.abs(t.duration-n.duration)<=$b))?{offset:n.start,duration:n.duration}:void 0}var Ub=new WeakMap,qb=new WeakMap,Vb=new WeakMap,Gb=new WeakMap,Hb=new WeakMap,Kb=new WeakMap,Xb=new WeakMap,Yb=new WeakMap,Qb=new WeakMap,Jb=new WeakMap,Zb=new WeakSet;class tk extends td{constructor(t={},e={}){super(),O(this,Zb),F(this,Ub,void 0),F(this,qb,void 0),F(this,Vb,void 0),F(this,Gb,void 0),F(this,Hb,void 0),F(this,Kb,void 0),F(this,Xb,void 0),F(this,Yb,void 0),F(this,Qb,void 0),F(this,Jb,[]);const{id:n,manifestRef:i,duration:r,width:o,height:s,metadata:a={},children:l=[]}=t;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(e.disabledTracks)?e.disabledTracks.filter((t=>"string"==typeof t)):[],this.enabledRepFilters=Array.isArray(e.enabledRepFilters)?e.enabledRepFilters:void 0,this.forceVideoCodec="string"==typeof e.forceVideoCodec&&e.forceVideoCodec.trim()?e.forceVideoCodec.trim():void 0,C(Xb,this,!0===e.forceImageFallback),C(Ub,this,e.abrSelector),C(qb,this,e.assetsDeliveryService),C(Gb,this,oy(r)?r:void 0),C(Hb,this,oy(o)?o:void 0),C(Kb,this,oy(s)?s:void 0),C(Yb,this,e&&"object"==typeof e.mediaHostRewriteMap?e.mediaHostRewriteMap:void 0),C(Qb,this,oy(e.maxManifestLoadAttempts)?e.maxManifestLoadAttempts:1/0),this.manifestLoadAttempts=0,this.manifestLoadError=void 0,C(Jb,this,kb(l))}setChildren(t){const e=kb(t);return A(Zb,this,yk).call(this,e,{emit:!0})}addChild(t){const e=bb(t),n=M(Jb,this).slice(),i=n.findIndex((t=>(null==t?void 0:t.nodeId)===e.nodeId));if(i>=0){var r;if((null===(r=n[i])||void 0===r?void 0:r.weight)===e.weight)return this.children;n[i]=e}else n.push(e);return A(Zb,this,yk).call(this,n,{emit:!0})}removeChild(t){const e=yb(t);if(!e)return this.children;const n=M(Jb,this).filter((t=>(null==t?void 0:t.nodeId)!==e));return n.length===M(Jb,this).length?this.children:A(Zb,this,yk).call(this,n,{emit:!0})}async load(t={}){const{loadingMode:e="full",signal:n}=t;zb.info(`[load] [${this.id}] Loading node in '${e}' mode`);try{if(n&&n.aborted)throw Oy();"ready"!==this.state&&await this.resolve({signal:n});const t="partial"===e,i=[];this.tracks.forEach((e=>{const n=e.segments||[];if(t){const t=n.find((t=>t.isInit)),r=n.find((t=>!t.isInit));t&&Array.isArray(t.representations)&&!t.isLoaded&&i.push({track:e,segment:t}),r&&Array.isArray(r.representations)&&!r.isLoaded&&i.push({track:e,segment:r})}else n.forEach((t=>{Array.isArray(t.representations)&&!t.isLoaded&&i.push({track:e,segment:t})}))}));const r=i.filter((({segment:t})=>t.isInit)),o=i.filter((({segment:t})=>!t.isInit)),s=o.length?o[0]:void 0,a=r.map((({track:t,segment:e})=>A(Zb,this,pk).call(this,t,e,n))),l=s?A(Zb,this,mk).call(this,s.segment,s.track,n):Promise.resolve();await Promise.all([...a,l]);const c=s?o.slice(1):o;for(const t of c)await A(Zb,this,mk).call(this,t.segment,t.track,n);if(n&&n.aborted)throw Oy();return this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:e}),this}catch(t){if(Py(t,n))throw t;throw this.trigger("node:loaderror",{nodeId:this.id,node:this,error:t,loadingMode:e}),t}}async loadMediaSegmentsAtOffset(t,e={}){const n=Number(t);if(zb.info(`[loadMediaSegmentsAtOffset] [${this.id}] Loading media segments at offset ${n}`),!Number.isFinite(n))return;const{signal:i}=e;if(i&&i.aborted)throw Oy();if("ready"!==this.state&&await this.resolve({signal:i}),"ready"!==this.state)return;const r=[],o=[];if(this.tracks.forEach((t=>{const e=(null==t?void 0:t.segments)||[];if(!Array.isArray(e)||!e.length)return;const s=e.find((t=>(null==t?void 0:t.isInit)&&Array.isArray(null==t?void 0:t.representations)));s&&!s.isLoaded&&r.push(A(Zb,this,pk).call(this,t,s,i)),e.forEach((e=>{if(!e||e.isInit||!Array.isArray(e.representations))return;const i=Number(e.offset);Number.isFinite(i)&&Math.abs(i-n)<=$b&&!e.isLoaded&&o.push({segment:e,track:t})}))})),r.length||o.length){if(await Promise.all(r),o.length&&await Promise.all(o.map((({segment:t,track:e})=>A(Zb,this,mk).call(this,t,e,i)))),i&&i.aborted)throw Oy();this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:"segment-offset",offsetSeconds:n})}}async resolve(t={}){const{signal:e,manifestOverride:n}=t;let i=!0;for(;i;){if(i=!1,"ready"===this.state)return this;if("resolving"===this.state)try{return await M(Vb,this)}catch(t){if(!Py(t)||e&&e.aborted)throw t;i=!0;continue}if(e&&e.aborted)throw Oy();if(this.hasExceededManifestLoadAttempts()){const t=this.manifestLoadError||new Error("Manifest load retry limit reached");throw this.state="failed",this.error=t,t}const t=A(Zb,this,ak).call(this);return this.state="resolving",this.error=void 0,C(Vb,this,(async()=>{try{const t=await A(Zb,this,vk).call(this,{signal:e,manifestOverride:n});if(e&&e.aborted)throw Oy();let i=Eb.parse(t);return i=A(Zb,this,sk).call(this,i),this.tracks=(i.tracks||[]).map((t=>t instanceof gb?t:new gb(t))),this.mainTrackId=i.mainTrackId||this.mainTrackId,this.metadata=i.metadata||this.metadata,A(Zb,this,kk).call(this),A(Zb,this,bk).call(this),await A(Zb,this,gk).call(this),this.state="ready",this}catch(n){if(Py(n,e))throw A(Zb,this,lk).call(this,t),n;throw this.state="failed",this.error=n,n}})()),M(Vb,this)}return M(Vb,this)}evict(){this.tracks.forEach((t=>{(t.segments||[]).forEach((t=>{t.evict()}))}))}get children(){return M(Jb,this).slice()}set children(t){this.setChildren(t)}get duration(){if(!this.mainTrackId)return 0;const t=this.tracks.find((t=>t.id===this.mainTrackId));return t?oy(t.duration)?t.duration:t.endTime:0}get retainedByteLength(){let t=0;return this.tracks.forEach((e=>{(Array.isArray(e.segments)?e.segments:[]).forEach((e=>{t+=oy(e.retainedByteLength)?e.retainedByteLength:0}))})),t}get buffered(){if("ready"!==this.state)return Wb;const t=Array.isArray(this.tracks)?this.tracks.find((t=>(null==t?void 0:t.id)===this.mainTrackId)):void 0,e=this.duration;if(!t||!oy(e))return Wb;const n=Array.isArray(this.tracks)?this.tracks.map((t=>{if(!t||void 0===t.buffered)return;const e=t.buffered;return e&&Number.isFinite(e.start)&&Number.isFinite(e.end)?{track:t,range:e}:void 0})).filter(Boolean):[];if(!n.length)return Wb;if(n.length===this.tracks.length&&n.every((({track:t,range:e})=>{const n=t.endTime,i=oy(t.offset)?t.offset:0;return Number.isFinite(n)&&e.start<=i&&e.end>=n})))return{start:0,end:e};const i=n.reduce(((t,{range:e})=>Math.min(t,e.end)),1/0);if(!Number.isFinite(i))return Wb;const r=Math.min(i,e);return r>0?{start:0,end:r}:Wb}get isLoaded(){return"ready"===this.state&&(Array.isArray(this.tracks)?this.tracks:[]).flatMap((t=>Array.isArray(null==t?void 0:t.segments)?t.segments:[])).every((t=>t.isLoaded))}hasExceededManifestLoadAttempts(){if(!Number.isFinite(M(Qb,this))||M(Qb,this)<=0)return!1;if(!this.manifestLoadError)return!1;const t=Number(this.manifestLoadAttempts);return Number.isFinite(t)&&t>=M(Qb,this)}}function ek(t){return function(t,e){if(!t||"string"!=typeof t)return t;if(!e||"object"!=typeof e)return t;const n=cd&&"function"==typeof cd.URL?cd.URL:"function"==typeof URL?URL:null;if(!n)return t;let i;try{i=new n(t)}catch(e){return t}const r=function(t,e){const n=null==t?void 0:t.hostname,i=null==t?void 0:t.pathname;if("string"!=typeof n||"string"!=typeof i)return t;if(!/^s3(?:[.-][a-z0-9-]+)?\.amazonaws\.com$/i.test(n))return t;const r=i.split("/").filter(Boolean);if(r.length<2)return t;const o=r[0],s=new e(t.toString());return s.hostname=`${o}.${n}`,s.pathname=`/${r.slice(1).join("/")}`,s}(i,n),o=e[r.hostname]?r:i,s=e[o.hostname];if(!s||"string"!=typeof s)return t;let a;try{a=new n(s)}catch(e){return t}return a.protocol&&a.host?(o.protocol=a.protocol,o.host=a.host,o.toString()):t}(t,M(Yb,this))}function nk(){return M(Xb,this)||void 0===cd.VideoDecoder}function ik(){return this.manifestRef&&"object"==typeof this.manifestRef&&"assets-delivery-service"===this.manifestRef.type}function rk(t){if(!A(Zb,this,ik).call(this))return!1;if(!A(Zb,this,nk).call(this))return!1;const e=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[],n=e.find((e=>(null==e?void 0:e.id)===(null==t?void 0:t.mainTrackId)))||e[0];return"image"!==(null==n?void 0:n.type)}function ok(t){const e=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[],n=function(t){const e=Number(null==t?void 0:t.duration);if(Number.isFinite(e)&&e>0)return e;const n=Array.isArray(null==t?void 0:t.segments)?t.segments:[];let i=0;return n.forEach((t=>{if(null!=t&&t.isInit)return;const e=Number(null==t?void 0:t.offset),n=Number(null==t?void 0:t.duration);!Number.isFinite(e)||!Number.isFinite(n)||n<=0||(i=Math.max(i,e+n))})),i>0?i:void 0}(e.find((e=>(null==e?void 0:e.id)===(null==t?void 0:t.mainTrackId)))||e[0]);return oy(n)?n:oy(M(Gb,this))?M(Gb,this):void 0}function sk(t){if(this.imageFallbackActive=!1,!A(Zb,this,rk).call(this,t))return t;if(!M(qb,this)||"function"!=typeof M(qb,this).resolveImageOne)return t;const e=M(qb,this).resolveImageOne(this.manifestRef),n=A(Zb,this,ek).call(this,null==e?void 0:e.url);if(!n)return t;const i={typeHint:"image",url:n,duration:A(Zb,this,ok).call(this,t),width:M(Hb,this),height:M(Kb,this)},r=Eb.parse(i);return t&&"object"==typeof t.metadata&&!Array.isArray(t.metadata)&&(r.metadata=t.metadata),this.imageFallbackActive=!0,r}function ak(){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 lk(t){t&&(this.state=t.state,this.error=t.error,this.tracks=t.tracks,this.mainTrackId=t.mainTrackId,this.metadata=t.metadata,this.imageFallbackActive=t.imageFallbackActive,this.disabledTracks=t.disabledTracks,this.manifestRef=t.manifestRef,this.manifestLoadAttempts=t.manifestLoadAttempts,this.manifestLoadError=t.manifestLoadError)}function ck(){const t=Number(this.manifestLoadAttempts);this.manifestLoadAttempts=Number.isFinite(t)&&t>0?t+1:1,this.manifestLoadError=void 0}function uk(t){this.manifestLoadError=t||new Error("Manifest load failed")}function dk(t){if(!t)return null;const e={loadAttempts:Number(t.loadAttempts),loadError:t.loadError};if("function"==typeof t.markLoadAttempt)return t.markLoadAttempt(),e;const n=Number(t.loadAttempts);return t.loadAttempts=Number.isFinite(n)&&n>0?n+1:1,t.loadError=void 0,e}function hk(t,e){if(!t||!e)return;const n=Number(e.loadAttempts);t.loadAttempts=Number.isFinite(n)&&n>=0?n:0,t.loadError=e.loadError}function fk(t,e){t&&("function"!=typeof t.setLoadError?t.loadError=e||new Error("Segment load failed"):t.setLoadError(e))}async function pk(t,e,n){const i=A(Zb,this,dk).call(this,e);try{const i=e.representations.map((async i=>{const r=A(Zb,this,ek).call(this,i.url),o=await qy(r,{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:!0,loaded:n,total:i,chunk:r})}}),s=o instanceof ArrayBuffer?o:null==o?void 0:o.arrayBuffer;s&&e.setRepresentationBuffer(i.id,s)}));await Promise.all(i)}catch(t){if(Py(t,n))throw A(Zb,this,hk).call(this,e,i),t;throw A(Zb,this,fk).call(this,e,t),t}}async function mk(t,e,n){const i=M(Ub,this),r={representations:t.representations,nodeId:this.id,trackId:null==e?void 0:e.id,segmentId:t.id},o=i&&"function"==typeof i.select?i.select(r):void 0,s=t.representations.find((t=>t.id===o))||t.representations[0];if(!s)return;t&&"function"==typeof t.setABRDecisionSnapshot&&t.setABRDecisionSnapshot(r.abrDecision),t.setChosenRepresentation(s);const a=A(Zb,this,dk).call(this,t);try{const i=A(Zb,this,ek).call(this,s.url),r=await qy(i,{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:!1,loaded:n,total:i,chunk:r})}}),o=r instanceof ArrayBuffer?r:null==r?void 0:r.arrayBuffer;o&&(t.setRepresentationBuffer(s.id,o),t.setChosenRepresentation(s))}catch(e){if(Py(e,n))throw A(Zb,this,hk).call(this,t,a),e;throw A(Zb,this,fk).call(this,t,e),e}}async function vk(t={}){const{signal:e,manifestOverride:n}=t;if(e&&e.aborted)throw Oy();A(Zb,this,ck).call(this);try{let t=this.manifestRef;if(n&&"object"==typeof n){if(A(Zb,this,ik).call(this)&&"string"==typeof n.encodeProfile&&n.encodeProfile&&(this.manifestRef={...this.manifestRef,encodeProfile:n.encodeProfile},t=this.manifestRef),n.ivd)return{typeHint:"ivd",body:n.ivd};if(n.body){const t=A(Zb,this,ek).call(this,n.url);return{typeHint:n.typeHint,url:t,mimeType:n.mimeType,body:n.body,duration:M(Gb,this),width:M(Hb,this),height:M(Kb,this)}}"string"==typeof n.url&&n.url&&(t=n)}if(t&&"object"==typeof t&&"assets-delivery-service"===t.type){if(!M(qb,this)||"function"!=typeof M(qb,this).resolveOne)throw new Error("AssetsDeliveryService is required for assets-delivery-service manifestRef");const n=await M(qb,this).resolveOne(t,{signal:e});if(!n)throw new Error("AssetsDeliveryService returned empty result");if("string"==typeof n.encodeProfile&&n.encodeProfile&&(this.manifestRef={...t,encodeProfile:n.encodeProfile}),n.ivd)return{typeHint:"ivd",body:n.ivd};const i=n.typeHint,r=A(Zb,this,ek).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(Gb,this),width:M(Hb,this),height:M(Kb,this)};throw new Error("AssetsDeliveryService returned unsupported manifest shape")}if(t&&"object"==typeof t){const e=A(Zb,this,ek).call(this,t.url),n=t.mimeType;if(t.body)return{url:e,mimeType:n,body:"string"==typeof t.body?t.body:JSON.stringify(t.body)}}if("string"==typeof t||t&&"string"==typeof t.url){const n="string"==typeof t?t:t.url,i=A(Zb,this,ek).call(this,n),r="object"==typeof t?t.typeHint:void 0,o="object"==typeof t?t.mimeType:void 0;if("image"===Eb.inferType({typeHint:r,url:i,mimeType:o})){const e="object"==typeof t&&oy(t.duration)?t.duration:M(Gb,this);return{typeHint:"image",url:i,mimeType:o,duration:e,width:"object"==typeof t&&oy(t.width)?t.width:M(Hb,this),height:"object"==typeof t&&oy(t.height)?t.height:M(Kb,this)}}const s=await qy(i,{returnType:"default",signal:e});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(t){if(Py(t,e))throw t;throw A(Zb,this,uk).call(this,t),t}}async function gk(){const t=Lb.slice().filter((t=>!this.enabledRepFilters||this.enabledRepFilters.includes(t.name)));if(t.length)for(let e=0;e<this.tracks.length;e+=1){const n=this.tracks[e],i=Array.isArray(n.segments)?n.segments:[],r=[];for(let e=0;e<i.length;e+=1){const o=i[e];if(!Array.isArray(o.representations)){r.push(o);continue}o.appliedFilters=o.appliedFilters||[];let s=o.representations;for(let e=0;e<t.length;e+=1){const{name:i,fn:r,isRelevantForTrack:a}=t[e];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 t=jb(o.representations);t&&(o.offset=t.offset,o.duration=t.duration)}r.push(o)}}r.length!==i.length&&n&&"function"==typeof n.setSegments&&n.setSegments(r)}}function yk(t,{emit:e=!1}={}){return function(t=[],e=[]){if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n<t.length;n+=1){const i=t[n],r=e[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(Jb,this),t)||(C(Jb,this,t),e&&(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 bk(){var t;const e=Array.isArray(this.disabledTrackTypes)?this.disabledTrackTypes:[];if(!e.length||!Array.isArray(this.tracks)||!this.tracks.length)return void(this.disabledTracks=[]);const n=new Set(e),i=[],r=[];this.tracks.forEach((t=>{t&&n.has(t.type)?r.push(t):t&&i.push(t)})),this.tracks=i,this.disabledTracks=r,this.mainTrackId&&!i.some((t=>t.id===this.mainTrackId))&&(this.mainTrackId=null===(t=i[0])||void 0===t?void 0:t.id)}function kk(){if(!Array.isArray(this.tracks)||!this.tracks.length)return;const t=this.duration;if(!oy(t))return;const e=[new fb({name:"nodestart",timestamp:0,data:{id:this.id},isSticky:!0}),new fb({name:"nodeend",timestamp:t,data:{id:this.id}})],n=new gb({id:`${this.id}-auto-cue`,type:"cue",cues:e,offset:0,duration:t});this.tracks.push(n)}var wk=new WeakMap,xk=new WeakMap,_k=new WeakMap,Tk=new WeakMap,Ek=new WeakSet;class Ik extends sd{constructor(...t){super(...t),O(this,Ek),F(this,wk,new Map),F(this,xk,new Map),F(this,_k,void 0),F(this,Tk,void 0);const[e,n]=t;C(_k,this,e),C(Tk,this,n)}get name(){return"NodeRepository"}get defaults(){return{enabledRepFilters:["containers","force-video-codec","media-capabilities"],disabledTracks:Ky("disabledTracks"),forceVideoCodec:Ky("forceVideoCodec"),forceImageFallback:Ky("forceImageFallback"),mediaHostRewriteMap:Ky("mediaHostRewriteMap"),maxManifestLoadAttempts:3}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"get","list"])}onDispose(){M(wk,this).forEach(((t,e)=>{const n=M(xk,this).get(e);n&&t&&"function"==typeof t.off&&t.off(dd.NODE_CHILDREN_CHANGED,n)})),M(xk,this).clear(),M(wk,this).clear()}add(t){const e=t instanceof tk?t:new tk(t,{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(_k,this),assetsDeliveryService:M(Tk,this)});if(!e.id)throw new Error("NodeRepository.add requires node with id");if(M(wk,this).has(e.id))throw new Error(`NodeRepository.add: node with id ${e.id} already exists`);return M(wk,this).set(e.id,e),A(Ek,this,Sk).call(this,e),this.trigger(dd.NODE_ADD,{node:e}),e}get(t){const e=(null==t?void 0:t.id)||t;if(!e)throw new Error("NodeRepository.get requires node or id");return M(wk,this).get(e)}list(){return Array.from(M(wk,this).values())}}function Sk(t){if(!t||"function"!=typeof t.on||!t.id)return;const e=t=>{this.trigger(dd.NODE_CHILDREN_CHANGED,t)};t.on(dd.NODE_CHILDREN_CHANGED,e),M(xk,this).set(t.id,e)}var Ak=new WeakMap,Nk=new WeakMap,Mk=new WeakSet;class Fk extends sd{constructor(...t){super(...t),O(this,Mk),F(this,Ak,void 0),F(this,Nk,new Map);const[e]=t;C(Ak,this,e)}get name(){return"ABRSelector"}get defaults(){return{safetyMargin:.35,minBufferForUpgrade:5,minBufferCritical:1,hysteresisRatio:1.1,abrStrategy:Ky("abrStrategy")}}select(t={}){var e;const{representations:n=[],bufferSeconds:i}=t;if(!Array.isArray(n)||0===n.length)return;const r=M(Ak,this)&&"function"==typeof M(Ak,this).getKbps?M(Ak,this).getKbps():void 0,o=A(Mk,this,Ck).call(this,n[0]),s=M(Nk,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(((t,e)=>A(Mk,this,Ok).call(this,t.bandwidth)-A(Mk,this,Ok).call(this,e.bandwidth)));if("bottom"===a){const e=l[0];return A(Mk,this,Dk).call(this,e,t,{decisionReason:"strategy:bottom",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==e?void 0:e.id}if("top"===a){const e=l[l.length-1];return A(Mk,this,Dk).call(this,e,t,{decisionReason:"strategy:top",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==e?void 0:e.id}if("random"===a){const e=l[Math.floor(Math.random()*l.length)];return A(Mk,this,Dk).call(this,e,t,{decisionReason:"strategy:random",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==e?void 0:e.id}const c=Number.isFinite(i)?i:void 0,u=oy(r)?r*this.settings.safetyMargin:void 0;let d="auto:highest-available";if(s&&void 0!==c&&c<this.settings.minBufferCritical){const e=l[0];return this.log.debug("[select] critical buffer -> lowest",t),A(Mk,this,Dk).call(this,e,t,{decisionReason:"auto:critical-buffer",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:u,bufferSeconds:c}),null==e?void 0:e.id}let h=l[l.length-1];if(void 0!==u){const e=l.filter((t=>A(Mk,this,Ok).call(this,t.bandwidth)<=u));e.length>0?(h=e[e.length-1],d="auto:highest-under-safe-bandwidth",this.log.debug("[select] under safe bandwidth ->",h.id,t)):(this.log.debug("[select] no rep under safe bandwidth, fallback lowest",t),h=l[0],d="auto:no-rep-under-safe-bandwidth")}if(s&&void 0!==c&&c<this.settings.minBufferForUpgrade){const e=n.find((t=>t.id===s));e&&oy(e.bandwidth)&&oy(h.bandwidth)&&h.bandwidth/e.bandwidth>this.settings.hysteresisRatio&&(h=n.filter((t=>t.bandwidth&&t.bandwidth<=e.bandwidth*this.settings.hysteresisRatio)).sort(((t,e)=>t.bandwidth-e.bandwidth)).pop()||e,d="auto:hysteresis-hold",this.log.debug("[select] hysteresis prevents upgrade; hold",h.id,t))}return A(Mk,this,Dk).call(this,h,t,{decisionReason:d,trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:u,bufferSeconds:c}),null===(e=h)||void 0===e?void 0:e.id}onDispose(){M(Nk,this).clear(),C(Ak,this,null)}}function Ck(t){var e,n;return(null===(e=t.mime)||void 0===e||null===(n=e.split)||void 0===n||null===(n=n.call(e,"/"))||void 0===n?void 0:n[0])||"unknown"}function Ok(t){return oy(t)?t/1e3:0}function Pk(t){return oy(t)?t/1e3:void 0}function Rk(t,e,n={}){const i=Array.isArray(null==e?void 0:e.representations)?e.representations.map((t=>({id:null==t?void 0:t.id,bandwidthKbps:A(Mk,this,Pk).call(this,null==t?void 0:t.bandwidth)}))):[];return{timeMs:Date.now(),strategy:this.settings.abrStrategy||"auto",decisionReason:n.decisionReason,nodeId:null==e?void 0:e.nodeId,trackId:null==e?void 0:e.trackId,segmentId:null==e?void 0:e.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==t?void 0:t.id,selectedRepresentationBandwidthKbps:A(Mk,this,Pk).call(this,null==t?void 0:t.bandwidth),safetyMargin:Number(this.settings.safetyMargin),minBufferForUpgrade:Number(this.settings.minBufferForUpgrade),minBufferCritical:Number(this.settings.minBufferCritical),hysteresisRatio:Number(this.settings.hysteresisRatio),availableRepresentations:i}}function Dk(t,e,n={}){if(!t)return;const i=A(Mk,this,Rk).call(this,t,e,n);e&&"object"==typeof e&&(e.abrDecision=i),this.log.info("[select] Chosen representation:",t,"context:",e,"decision:",i),this.trigger("abr:selection",{representation:t,context:e,strategy:this.settings.abrStrategy,decision:i});const r=A(Mk,this,Ck).call(this,t);M(Nk,this).set(r,t.id)}var Lk=new WeakMap,Bk=new WeakSet;class zk extends sd{constructor(...t){super(...t),O(this,Bk),F(this,Lk,void 0);const[e]=t;if(C(Lk,this,e),!M(Lk,this)||"function"!=typeof M(Lk,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(Lk,this,null)}getPrioritizationSnapshot(t){const e=M(Lk,this).list();if(!e.length)return{orderedIds:[],reachableIds:[]};const{levels:n,weights:i}=A(Bk,this,Wk).call(this,e,t);return{orderedIds:A(Bk,this,$k).call(this,e,n,i),reachableIds:Array.from(n.keys())}}sortNodes(t){const{orderedIds:e}=this.getPrioritizationSnapshot(t);return e.length?(this.log.info(`[sortNodes(${t})] Sorted nodes: [${e.join(", ")}]`),e):[]}getReachableNodeIds(t){const{reachableIds:e}=this.getPrioritizationSnapshot(t);return e}}function Wk(t,e){const n=new Map;t.forEach((t=>{t&&t.id&&n.set(t.id,t)}));const i=new Map,r=new Map;if(!e||!n.has(e))return{levels:i,weights:r};const o=[{id:e,level:0,priority:1}];for(i.set(e,0),r.set(e,1);o.length;){const{id:t,level:e,priority:s}=o.shift(),a=n.get(t),l=Array.isArray(null==a?void 0:a.children)?a.children:[];for(let t=0;t<l.length;t+=1){const a=l[t],c=(null==a?void 0:a.nodeId)||(null==a?void 0:a.id);if(!c||!n.has(c)||i.has(c))continue;const u=oy(null==a?void 0:a.weight)?a.weight:1,d=Math.max(u,s);i.set(c,e+1),r.set(c,d),o.push({id:c,level:e+1,priority:d})}}return{levels:i,weights:r}}function $k(t,e,n){const i=e.size>0,{levelMultiplier:r,priorityMultiplier:o}=this.settings,s=t.map((t=>{var s;const a=e.has(t.id)?e.get(t.id):i?Number.MAX_SAFE_INTEGER:0,l=Number.isFinite(a)?a:Number.MAX_SAFE_INTEGER,c=null!==(s=n.get(t.id))&&void 0!==s?s:1,u=(Number.isFinite(l)?r*l:Number.MAX_SAFE_INTEGER)+o*c;return{id:t.id,score:u,level:l,priorityWeight:c}}));return s.sort(((t,e)=>t.score!==e.score?t.score-e.score:t.level!==e.level?t.level-e.level:t.priorityWeight!==e.priorityWeight?t.priorityWeight-e.priorityWeight:t.id.localeCompare(e.id))),s.map((t=>t.id))}function jk(t,e){return function(t,e){const n=Array.isArray(t)?t:[];return n.length?e&&n.includes(e)?e:n[0]:e||void 0}(null==t?void 0:t.availableEncodeProfiles,e)}function Uk(t,e){const n=t&&"object"==typeof t?{...t}:t;return n&&"object"==typeof n?("string"==typeof e&&e?n.encodeProfile=e:delete n.encodeProfile,n):n}function qk(t){return"string"==typeof t&&t.startsWith("cmaf:")}function Vk(t){return"image"===(null==t?void 0:t.assetType)?"image":"ivd"}function Gk(t){if(!t||"object"!=typeof t)return t;if(Object.prototype.hasOwnProperty.call(t,"mpd")){const e="string"==typeof t.mpdUrl&&t.mpdUrl||"string"==typeof t.url&&t.url||void 0;return{typeHint:"dash",body:t.mpd,url:e}}return t.ivd||t.url||t.body||t.mimeType||t.typeHint?t:(e=t)&&"object"==typeof e&&Array.isArray(e.representations)?{ivd:t}:t;var e}var Hk=new WeakMap,Kk=new WeakMap,Xk=new WeakSet;class Yk extends sd{constructor(...t){super(...t),O(this,Xk),F(this,Hk,void 0),F(this,Kk,void 0);const[,e={}]=t;C(Hk,this,"function"==typeof e.fetchFn?e.fetchFn:void 0),C(Kk,this,Cy())}get name(){return"AssetsDeliveryService"}get defaults(){return{assetsDeliveryServiceUrl:"https://assets.eko.com",profile:Ky("encodeProfile"),maxBatchSize:5,imageQueryParams:{startOffset:0,width:1024}}}async resolveOne(t,e={}){var n;const i=await this.resolve([t],e);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(t){if(!A(Xk,this,Jk).call(this,t))return;const e=jk(t,this.settings.profile),n=function(t,e,n){const i=function(t,e,n){const i=(t||"").replace(/\/$/,""),r=null==n?void 0:n.assetId,o=null==n?void 0:n.assetRevision;if(i&&e&&"string"==typeof r&&"number"==typeof o)return`${i}/${e}/${encodeURIComponent(r)}/${o}`}(t,"image",e);if(!i)return;const r=function(t){if(!t||"object"!=typeof t||Array.isArray(t))return"";const e=new URLSearchParams;return Object.keys(t).forEach((n=>{if("string"!=typeof n||!n)return;const i=t[n];null!=i&&("number"!=typeof i||Number.isFinite(i))&&("string"!=typeof i&&"number"!=typeof i&&"boolean"!=typeof i||e.set(n,String(i)))})),e.toString()}(n);return r?`${i}?${r}`:i}(this.settings.assetsDeliveryServiceUrl||"",t,this.settings.imageQueryParams);if(!n)return;const i={typeHint:"image",url:n};return"string"==typeof e&&e&&(i.encodeProfile=e),i}async resolve(t=[],e={}){const n=(Array.isArray(t)?t:[t]).filter((t=>A(Xk,this,Jk).call(this,t)));if(!n.length)return[];const i=A(Xk,this,Qk).call(this,e);if(i&&i.aborted)return[];const r=[],o=this.settings.profile;n.forEach((t=>{if("image"!==Vk(t))return;const e=this.resolveImageOne(t);e&&e.url&&r.push({manifestRef:Uk(t,e.encodeProfile),manifest:{typeHint:"image",url:e.url}})}));const s=n.filter((t=>"image"!==Vk(t))).map((t=>function(t,e){const n=jk(t,e);return{ref:t,profile:n,route:qk(n)?"dash":"ivd"}}(t,o))),a=A(Xk,this,tw).call(this,s);for(const{refs:t,route:e}of a){if(i&&i.aborted)return r;const{url:n}=A(Xk,this,ew).call(this,t,e),o=await A(Xk,this,nw).call(this,n,{method:"GET",signal:i});o&&"object"==typeof o&&t.forEach((({ref:t,profile:e})=>{const n=`${t.assetId}:${t.assetRevision}`,i=o[n]||o[t.assetId]||o[t.assetId||n];i&&r.push({manifestRef:Uk(t,e),manifest:Gk(i)})}))}return r}onDispose(){M(Kk,this)&&M(Kk,this).abort(),C(Kk,this,null),C(Hk,this,null)}}function Qk(t){return t&&t.signal?t.signal:M(Kk,this)?M(Kk,this).signal:void 0}function Jk(t){const e="number"==typeof(null==t?void 0:t.assetRevision)&&Number.isFinite(t.assetRevision)&&t.assetRevision>=0;return t&&"assets-delivery-service"===t.type&&"string"==typeof t.assetId&&e}function Zk(t,e){const n=Number.isFinite(e)&&e>0?e:t.length,i=[];for(let e=0;e<t.length;e+=n)i.push(t.slice(e,e+n));return i}function tw(t){if(!Array.isArray(t)||!t.length)return[];const e=[];t.forEach((t=>{const n=e[e.length-1];n&&n.route===t.route?n.refs.push(t):e.push({route:t.route,refs:[t]})}));const n=[];return e.forEach((t=>{A(Xk,this,Zk).call(this,t.refs,this.settings.maxBatchSize).forEach((e=>{n.push({route:t.route,refs:e})}))})),n}function ew(t,e="ivd"){const n=t.map((({ref:t,profile:e})=>function(t,e){const n=`${t.assetId}:${t.assetRevision}`;return e?`${n}:${e}`:n}(t,e))),i=new URLSearchParams({assets:n.join(","),type:"data"});return{url:`${(this.settings.assetsDeliveryServiceUrl||"").replace(/\/$/,"")}/${"dash"===e?"dash":"ivd"}?${i.toString()}`}}async function nw(t,e){return M(Hk,this)?M(Hk,this).call(this,t,e):await qy(t,{returnType:"json",method:(null==e?void 0:e.method)||"GET",signal:null==e?void 0:e.signal})}function iw({prioritizer:t,repository:e,startNodeId:n,prioritizedIds:i,pendingIds:r,allowedIds:o,filter:s,fallbackToRepository:a=!0}={}){const l=Array.isArray(i)?i:t&&"function"==typeof t.sortNodes?t.sortNodes(n):[],c=a?(f=e)&&"function"==typeof f.list?f.list().map((t=>null==t?void 0:t.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((t=>{if(!t)return!1;if(d&&d.has(t))return!1;if(h&&!h.has(t))return!1;const n=function(t,e){if(t&&"function"==typeof t.get)return t.get(e)}(e,t);return!(!n||"function"==typeof s&&!s(n,t))}))}const rw=(cd.requestAnimationFrame||cd.mozRequestAnimationFrame||cd.webkitRequestAnimationFrame||cd.msRequestAnimationFrame||(t=>cd.setTimeout(t,1e3/60))).bind(cd),ow=(cd.cancelAnimationFrame||cd.mozCancelAnimationFrame||cd.webkitCancelAnimationFrame||cd.msCancelAnimationFrame||(t=>cd.clearTimeout(t))).bind(cd),sw=Zu("ticker","warn");let aw,lw=[],cw=null,uw=Fy();function dw(){uw=Fy();const t=[];let e,n;for(n=lw.length-1;n>=0;--n)e=lw[n],uw>=e.lastTick+e.interval&&t.push(e);for(n=t.length-1;n>=0;--n)if(e=t[n],!e.stopped){e.lastTick=uw;try{e.callback()}catch(t){console&&"function"==typeof console.error?console.error(t):sw.error(t)}}aw=rw(dw)}function hw(){Fy()-uw>=200&&(ow(aw),dw())}function fw(t){let e=-1;for(let n=0;n<lw.length;n+=1)if(lw[n].callback===t){e=n;break}return e}function pw(t,e=0){if(!t||"function"!=typeof t||"number"!=typeof e||e<0)return void sw.error("[start] Invalid arguments given to start method.",arguments);const n=fw(t);return-1!==n?(sw.debug("[start] Callback already exists, overriding interval.",arguments),lw[n].interval=e,t):(lw.push({callback:t,interval:e,lastTick:Fy()}),1===lw.length&&(aw=rw(dw),cw||(cw=cd.setInterval(hw,1e3))),t)}function mw(t){const e=fw(t);-1!==e?(lw[e].stopped=!0,lw.splice(e,1),lw.length||(ow(aw),cd.clearInterval(cw),cw=null)):sw.debug("[stop] Callback not found, doing nothing.",arguments)}function vw(t){return-1!==fw(t)}function gw(t,e,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 t)return void sw.error("[createThrottler] Bad argument given to createThrottler, first argument must be a function.",arguments);sw.debug("[createThrottler] Creating a new throttler instance.",arguments);const s=[];function a(){sw.debug("[onThrottlerTick] Calling callback with "+s.length+" queued items.");const e=s.slice(0);s.length=0,mw(a),t(e)}const l={push:function(t){sw.debug("[push] Queuing argument:",t),0===s.length&&pw(a,e),s.push(t),o+=1,(o<=r||s.length>=i)&&a()},flush:function(){sw.debug("[flush] Flushing queue."),0!==s.length&&a()},dispose:function(){sw.debug("[dispose] Disposing of throttler.");const t=s.slice(0);return s.length=0,mw(a),t}};return Object.defineProperty(l,"interval",{enumerable:!0,get:function(){return e},set:function(t){"number"==typeof t&&(e=t)}}),l}function yw(t,e){if(t&&"function"==typeof t)return t.__tickerThrottler||(t.__tickerThrottler=gw((function(){t()}),e)),"number"==typeof e&&(t.__tickerThrottler.interval=e),t.__tickerThrottler.push(),t.__tickerThrottler;sw.error("[scheduleExecution] Bad argument given to scheduleExecution, first argument must be a function.",arguments)}var bw=new WeakMap,kw=new WeakMap,ww=new WeakMap,xw=new WeakMap,_w=new WeakMap,Tw=new WeakMap,Ew=new WeakMap,Iw=new WeakMap,Sw=new WeakMap,Aw=new WeakMap,Nw=new WeakMap,Mw=new WeakMap,Fw=new WeakMap,Cw=new WeakMap,Ow=new WeakMap,Pw=new WeakMap,Rw=new WeakSet;class Dw extends sd{constructor(...t){super(...t),O(this,Rw),F(this,bw,void 0),F(this,kw,void 0),F(this,ww,void 0),F(this,xw,void 0),F(this,_w,[]),F(this,Tw,[]),F(this,Ew,new Set),F(this,Iw,new Set),F(this,Sw,!1),F(this,Aw,void 0),F(this,Nw,void 0),F(this,Mw,void 0),F(this,Fw,void 0),F(this,Cw,void 0),F(this,Ow,void 0),F(this,Pw,void 0);const[e,n,i,r]=t;C(bw,this,e),C(kw,this,n),C(ww,this,i),C(xw,this,r),C(Aw,this,Cy());const o=t.length?t[t.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(Pw,this,(()=>A(Rw,this,Hw).call(this))),A(Rw,this,Ww).call(this),A(Rw,this,zw).call(this)}get name(){return"NodeResolver"}get defaults(){return{maxConcurrent:5}}onDispose(){var t;M(Aw,this)&&M(Aw,this).abort(),C(Aw,this,null),M(xw,this)&&"function"==typeof M(xw,this).off&&M(Mw,this)&&M(xw,this).off(dd.PLACEMENT_ADDED,M(Mw,this)),M(xw,this)&&"function"==typeof M(xw,this).off&&M(Ow,this)&&M(xw,this).off(dd.TIMELINE_RESET,M(Ow,this)),M(bw,this)&&"function"==typeof M(bw,this).off&&M(Fw,this)&&M(bw,this).off(dd.NODE_ADD,M(Fw,this)),M(bw,this)&&"function"==typeof M(bw,this).off&&M(Cw,this)&&M(bw,this).off(dd.NODE_CHILDREN_CHANGED,M(Cw,this)),C(Mw,this,null),C(Fw,this,null),C(Cw,this,null),C(Ow,this,null),C(_w,this,[]),C(Tw,this,[]),M(Ew,this).clear(),M(Iw,this).clear(),C(Sw,this,!1),C(Nw,this,void 0),null!==(t=M(Pw,this))&&void 0!==t&&t.__tickerThrottler&&M(Pw,this).__tickerThrottler.dispose(),C(Pw,this,null)}}function Lw(){return M(Aw,this)?M(Aw,this).signal:void 0}function Bw(){return this._disposed||M(Aw,this)&&M(Aw,this).signal.aborted}function zw(){M(xw,this)&&"function"==typeof M(xw,this).on&&(C(Mw,this,(t=>{A(Rw,this,jw).call(this,null==t?void 0:t.nodeId)})),M(xw,this).on(dd.PLACEMENT_ADDED,M(Mw,this)),C(Ow,this,(()=>A(Rw,this,$w).call(this))),M(xw,this).on(dd.TIMELINE_RESET,M(Ow,this))),M(bw,this)&&"function"==typeof M(bw,this).on&&(C(Fw,this,(({node:t})=>{(null==t?void 0:t.id)&&A(Rw,this,jw).call(this,t.id,{fromRepoAdd:!0})})),M(bw,this).on(dd.NODE_ADD,M(Fw,this)),C(Cw,this,(()=>{yw(M(Pw,this),100)})),M(bw,this).on(dd.NODE_CHILDREN_CHANGED,M(Cw,this)))}function Ww(){const t=M(xw,this)&&Array.isArray(M(xw,this).placements)?M(xw,this).placements:[];t.forEach((t=>A(Rw,this,jw).call(this,t.nodeId)));const e=t.length?t[t.length-1]:void 0;e&&e.nodeId&&C(Nw,this,e.nodeId)}function $w(){M(Aw,this)&&M(Aw,this).abort(),C(Aw,this,Cy()),C(_w,this,[]),C(Tw,this,[]),M(Ew,this).clear(),C(Sw,this,!1),C(Nw,this,void 0)}function jw(t,{fromRepoAdd:e=!1}={}){A(Rw,this,Bw).call(this)||t&&(M(Iw,this).has(t)||M(Ew,this).has(t)||(M(_w,this).push(t),M(Nw,this)||e||C(Nw,this,t),!M(Sw,this)&&e||A(Rw,this,Uw).call(this)))}function Uw(){if(M(Sw,this))return void A(Rw,this,qw).call(this);if(0===M(_w,this).length)return;C(Sw,this,!0);const t=M(_w,this).shift();A(Rw,this,Kw).call(this,t).finally((()=>{A(Rw,this,qw).call(this)}))}async function qw(){if(!A(Rw,this,Bw).call(this))for(M(_w,this).length||M(Tw,this).length||C(Tw,this,A(Rw,this,Vw).call(this));M(Ew,this).size<this.settings.maxConcurrent;){const t=this.settings.maxConcurrent-M(Ew,this).size;if(t<=0)break;const e=[];for(;e.length<t&&(M(_w,this).length||M(Tw,this).length);){let t=M(_w,this).shift();t||(t=M(Tw,this).shift()),t&&e.push(t)}if(!e.length)break;const n=A(Rw,this,Xw).call(this,e);n.length&&M(ww,this)&&"function"==typeof M(ww,this).resolve&&A(Rw,this,Yw).call(this,n).finally((()=>A(Rw,this,qw).call(this))),e.filter((t=>!n.find((e=>e.nodeId===t)))).forEach((t=>{A(Rw,this,Kw).call(this,t).finally((()=>A(Rw,this,qw).call(this)))}))}}function Vw(){const t=new Set([...M(Iw,this),...M(Ew,this),...M(_w,this)]);return A(Rw,this,Gw).call(this,t)}function Gw(t){const e=M(xw,this)&&Array.isArray(M(xw,this).placements)?M(xw,this).placements:[],n=(e.length?e[e.length-1].nodeId:void 0)||M(Nw,this);return iw({prioritizer:M(kw,this),repository:M(bw,this),startNodeId:n,pendingIds:t,fallbackToRepository:!1})}function Hw(){A(Rw,this,Bw).call(this)||(M(Sw,this)||0!==M(_w,this).length)&&(C(Tw,this,A(Rw,this,Vw).call(this)),M(Sw,this)&&A(Rw,this,qw).call(this))}async function Kw(t,e){if(!t||M(Iw,this).has(t)||M(Ew,this).has(t))return;const n=A(Rw,this,Lw).call(this);if(n&&n.aborted)return;const i=M(bw,this)&&"function"==typeof M(bw,this).get?M(bw,this).get(t):void 0;if(i&&"function"==typeof i.resolve)if("function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts())M(Iw,this).add(t);else{M(Ew,this).add(t);try{const r={signal:n};e&&(r.manifestOverride=e),await i.resolve(r),M(Iw,this).add(t)}catch(e){if(Py(e,n))return;this.log.warn(`NodeResolver failed to resolve node ${t}: ${(null==e?void 0:e.message)||e}`),"function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts()&&M(Iw,this).add(t)}finally{M(Ew,this).delete(t)}}}function Xw(t){const e=[];return t.forEach((t=>{const n=M(bw,this)&&"function"==typeof M(bw,this).get?M(bw,this).get(t):void 0;n&&n.manifestRef&&"assets-delivery-service"===n.manifestRef.type&&e.push({nodeId:t,ref:n.manifestRef})})),e}async function Yw(t){const e=A(Rw,this,Lw).call(this);if(!e||!e.aborted){t.forEach((({nodeId:t})=>M(Ew,this).add(t)));try{const n=t.map((t=>t.ref)),i=await M(ww,this).resolve(n,{signal:e});t.forEach((({nodeId:t,ref:e})=>{var n;const r=M(bw,this)&&"function"==typeof M(bw,this).get?M(bw,this).get(t):void 0;if(M(Ew,this).delete(t),!r||"function"!=typeof r.resolve)return;const o=Array.isArray(i)?i.find((t=>{const n=null==t?void 0:t.manifestRef;return n&&n.assetId===e.assetId&&n.assetRevision===e.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(Rw,this,Qw).call(this,o.manifest,s):void 0;A(Rw,this,Kw).call(this,t,a)}))}catch(n){Py(n,e)||this.log.warn(`NodeResolver ADS batch failed: ${(null==n?void 0:n.message)||n}`),t.forEach((({nodeId:t})=>M(Ew,this).delete(t)))}}}function Qw(t,e){if(!t)return;const n="string"==typeof e&&e?e:void 0,i=t=>n&&t&&"object"==typeof t?{...t,encodeProfile:n}:t;return t.ivd?i({typeHint:"ivd",body:t.ivd}):t.url||t.body||t.mimeType?i({typeHint:t.typeHint,url:t.url,mimeType:t.mimeType,body:t.body}):i(t)}const Jw=.001,Zw="priority";function tx(t){const e=Number(t);return Number.isFinite(e)?e:0}var ex=new WeakMap,nx=new WeakMap,ix=new WeakMap,rx=new WeakMap,ox=new WeakMap,sx=new WeakMap,ax=new WeakMap,lx=new WeakMap,cx=new WeakMap,ux=new WeakMap,dx=new WeakMap,hx=new WeakMap,fx=new WeakMap,px=new WeakMap,mx=new WeakMap,vx=new WeakMap,gx=new WeakMap,yx=new WeakMap,bx=new WeakMap,kx=new WeakMap,wx=new WeakSet;class xx extends sd{constructor(...t){super(...t),O(this,wx),F(this,ex,void 0),F(this,nx,void 0),F(this,ix,void 0),F(this,rx,new Map),F(this,ox,new Map),F(this,sx,[]),F(this,ax,new Set),F(this,lx,new Map),F(this,cx,!1),F(this,ux,void 0),F(this,dx,void 0),F(this,hx,void 0),F(this,fx,void 0),F(this,px,void 0),F(this,mx,void 0),F(this,vx,void 0),F(this,gx,void 0),F(this,yx,!1),F(this,bx,[]),F(this,kx,void 0);const[e,n,i]=t;C(ex,this,e),C(nx,this,n),C(ix,this,i),C(dx,this,Cy()),C(kx,this,(()=>A(wx,this,r_).call(this))),A(wx,this,Lx).call(this)}get name(){return"SegmentLoadCoordinator"}get defaults(){return{maxConcurrentLoads:3,maxSegmentLoadAttempts:3}}onDispose(){var t;M(dx,this)&&M(dx,this).abort(),C(dx,this,null),M(lx,this).size&&M(lx,this).forEach((t=>{(null==t?void 0:t.controller)&&t.controller.abort()})),M(lx,this).clear(),M(ix,this)&&"function"==typeof M(ix,this).off&&(M(hx,this)&&M(ix,this).off(dd.PLACEMENT_ADDED,M(hx,this)),M(px,this)&&M(ix,this).off(dd.TIMELINE_SEEKING,M(px,this)),M(mx,this)&&M(ix,this).off(dd.TIMELINE_SEEKED,M(mx,this)),M(vx,this)&&M(ix,this).off(dd.TIMELINE_RESET,M(vx,this))),M(ex,this)&&"function"==typeof M(ex,this).off&&M(fx,this)&&M(ex,this).off(dd.NODE_CHILDREN_CHANGED,M(fx,this)),M(gx,this)&&"function"==typeof cd.removeEventListener&&cd.removeEventListener("online",M(gx,this)),C(hx,this,null),C(fx,this,null),C(px,this,null),C(mx,this,null),C(vx,this,null),C(gx,this,null),M(rx,this).clear(),M(ox,this).clear(),C(sx,this,[]),M(ax,this).clear(),M(lx,this).clear(),C(cx,this,!1),C(ux,this,void 0),C(yx,this,!1),C(bx,this,[]),null!==(t=M(kx,this))&&void 0!==t&&t.__tickerThrottler&&M(kx,this).__tickerThrottler.dispose(),C(kx,this,null)}}function _x(){return M(dx,this)?M(dx,this).signal:void 0}function Tx(){return this._disposed||M(dx,this)&&M(dx,this).signal.aborted}function Ex(){const t=Number(this.settings.maxSegmentLoadAttempts);return Number.isFinite(t)&&t>0?t:1/0}function Ix(t){const e=A(wx,this,Ex).call(this);if(!Number.isFinite(e)||e===1/0)return!1;if(null==t||!t.loadError)return!1;const n=Number(t.loadAttempts);return Number.isFinite(n)&&n>=e}function Sx(t){return!!t&&(!!A(wx,this,Ix).call(this,t)||A(wx,this,Ax).call(this,t))}function Ax(t){if(!t)return!1;if("boolean"==typeof t.isLoaded)return t.isLoaded;const e=Number(t.retainedByteLength);return Number.isFinite(e)&&e>0}function Nx(t){if(!t||A(wx,this,Ax).call(this,t))return;const e=Number(t.loadAttempts);(Number.isFinite(e)&&e>0||t.loadError)&&("function"==typeof t.evict&&t.evict(),t.loadAttempts=0,t.loadError=void 0)}function Mx(t){t&&(t.manifestLoadError&&(t.manifestLoadAttempts=0,t.manifestLoadError=void 0,"failed"===t.state&&(t.state="pending",t.error=void 0)),(Array.isArray(t.tracks)?t.tracks:[]).forEach((t=>{(Array.isArray(null==t?void 0:t.segments)?t.segments:[]).forEach((t=>{A(wx,this,Nx).call(this,t)}))})))}function Fx(){(M(ex,this)&&"function"==typeof M(ex,this).list?M(ex,this).list():[]).forEach((t=>{A(wx,this,Mx).call(this,t)}))}function Cx(t,{allowSeekKeep:e=!1,segmentOffset:n}={}){const i=Cy(),r=i?i.signal:A(wx,this,_x).call(this);return t&&M(lx,this).set(t,{controller:i,allowSeekKeep:!!e,segmentOffset:n}),{signal:r,controller:i}}function Ox(t,e,n={}){const i=M(lx,this).get(t);i&&i.controller===e&&(Object.prototype.hasOwnProperty.call(n,"allowSeekKeep")&&(i.allowSeekKeep=!!n.allowSeekKeep),Object.prototype.hasOwnProperty.call(n,"segmentOffset")&&(i.segmentOffset=n.segmentOffset))}function Px(t,e){const n=M(lx,this).get(t);n&&(e&&n.controller!==e||M(lx,this).delete(t))}function Rx(t,e){const n=new Set;return(Array.isArray(t)?t:[]).forEach((t=>{const i=null==t?void 0:t.nodeId;if(!i)return;const r=M(ex,this)&&"function"==typeof M(ex,this).get?M(ex,this).get(i):void 0;if(!r)return;const o=A(wx,this,Kx).call(this,r,t,e);Number.isFinite(o)&&n.add(`${i}:${o}`)})),n}function Dx(t){M(lx,this).size&&M(lx,this).forEach(((e,n)=>{const i=null==e?void 0:e.segmentOffset,r=Number.isFinite(i)?`${n}:${i}`:"";!(null!=e&&e.allowSeekKeep&&r&&t&&t.has(r))&&(null==e?void 0:e.controller)&&e.controller.abort()}))}function Lx(){M(ix,this)&&"function"==typeof M(ix,this).on&&(C(hx,this,(t=>{A(wx,this,Ux).call(this,t)})),M(ix,this).on(dd.PLACEMENT_ADDED,M(hx,this)),C(px,this,(t=>A(wx,this,Bx).call(this,t))),M(ix,this).on(dd.TIMELINE_SEEKING,M(px,this)),C(mx,this,(t=>A(wx,this,zx).call(this,t))),M(ix,this).on(dd.TIMELINE_SEEKED,M(mx,this)),C(vx,this,(()=>A(wx,this,jx).call(this))),M(ix,this).on(dd.TIMELINE_RESET,M(vx,this))),M(ex,this)&&"function"==typeof M(ex,this).on&&(C(fx,this,(()=>{yw(M(kx,this),100)})),M(ex,this).on(dd.NODE_CHILDREN_CHANGED,M(fx,this))),"function"==typeof cd.addEventListener&&(C(gx,this,(()=>A(wx,this,$x).call(this))),cd.addEventListener("online",M(gx,this)))}function Bx(t={}){if(A(wx,this,Tx).call(this))return;const e=Number(null==t?void 0:t.targetTime);if(!Number.isFinite(e))return;const n=Array.isArray(null==t?void 0:t.placements)?t.placements:[],i=A(wx,this,Rx).call(this,n,e);A(wx,this,Dx).call(this,i),C(yx,this,!0),C(bx,this,n.map((t=>{const n=null==t?void 0:t.nodeId;if(n)return{nodeId:n,placement:t,targetTime:e}})).filter(Boolean)),setTimeout((()=>A(wx,this,Vx).call(this)),0)}function zx(t={}){var e;if(A(wx,this,Tx).call(this))return;C(yx,this,!1),C(bx,this,[]);const n=Number.isFinite(null==t?void 0:t.targetTime)?Number(t.targetTime):Number(null===(e=M(ix,this))||void 0===e?void 0:e.currentTime);A(wx,this,Wx).call(this,n),setTimeout((()=>A(wx,this,Vx).call(this)),0)}function Wx(t){var e;(Array.isArray(null===(e=M(ix,this))||void 0===e?void 0:e.placements)?M(ix,this).placements:[]).forEach((e=>{if(!e)return;const n=gm(e);if(Number.isFinite(n)){if(Number.isFinite(t)){if(n>=t)return void A(wx,this,Ux).call(this,e);const i=mm(e,M(ex,this));return Number.isFinite(i)?void(n+i>t&&A(wx,this,Ux).call(this,e)):void(n<=t&&A(wx,this,Ux).call(this,e))}A(wx,this,Ux).call(this,e)}}))}function $x(){var t;A(wx,this,Tx).call(this)||(A(wx,this,Fx).call(this),C(yx,this,!1),C(bx,this,[]),A(wx,this,Wx).call(this,Number(null===(t=M(ix,this))||void 0===t?void 0:t.currentTime)),C(sx,this,A(wx,this,n_).call(this)),setTimeout((()=>A(wx,this,Vx).call(this)),0))}function jx(){M(dx,this)&&M(dx,this).abort(),C(dx,this,Cy()),M(lx,this).size&&M(lx,this).forEach((t=>{(null==t?void 0:t.controller)&&t.controller.abort()})),M(lx,this).clear(),M(rx,this).clear(),M(ox,this).clear(),C(sx,this,[]),M(ax,this).clear(),C(cx,this,!1),C(ux,this,void 0),C(yx,this,!1),C(bx,this,[])}function Ux(t){if(A(wx,this,Tx).call(this))return;const e=null==t?void 0:t.nodeId;if(!e)return;const n=M(rx,this).get(e);if(n){const i=gm(n),r=gm(t);Number.isFinite(i)?Number.isFinite(r)&&r<i&&M(rx,this).set(e,t):Number.isFinite(r)&&M(rx,this).set(e,t)}else M(rx,this).set(e,t);const i=M(ux,this);C(ux,this,e),i&&i!==e&&C(sx,this,[]),M(cx,this)?setTimeout((()=>A(wx,this,Vx).call(this)),0):A(wx,this,qx).call(this)}function qx(){M(cx,this)||M(rx,this).size&&(C(cx,this,!0),A(wx,this,Vx).call(this))}async function Vx(){if(A(wx,this,Tx).call(this))return;if(M(ax,this).size>=this.settings.maxConcurrentLoads)return;if(M(yx,this))return void(M(bx,this).length&&A(wx,this,Gx).call(this));const t=A(wx,this,Qx).call(this);if(t.hasPending)A(wx,this,Jx).call(this,t);else for(M(sx,this).length||C(sx,this,A(wx,this,n_).call(this));M(ax,this).size<this.settings.maxConcurrentLoads&&M(sx,this).length;){const t=M(sx,this).shift();A(wx,this,o_).call(this,t,"partial").finally((()=>{setTimeout((()=>A(wx,this,Vx).call(this)),0)}))}}function Gx(){if(A(wx,this,Tx).call(this))return;const t=Math.max(0,this.settings.maxConcurrentLoads-M(ax,this).size);if(!t||!M(bx,this).length)return;const e=[],n=[];for(let i=0;i<M(bx,this).length;i+=1){const r=M(bx,this)[i];(null==r?void 0:r.nodeId)&&(e.length<t&&!M(ax,this).has(r.nodeId)?e.push(r):n.push(r))}C(bx,this,n),e.forEach((t=>{A(wx,this,Hx).call(this,t).finally((()=>{setTimeout((()=>A(wx,this,Vx).call(this)),0)}))}))}async function Hx(t={}){const e=null==t?void 0:t.nodeId,n=null==t?void 0:t.placement,i=Number(null==t?void 0:t.targetTime);if(!e||!n||!Number.isFinite(i))return;if(M(ax,this).has(e))return;const{signal:r,controller:o}=A(wx,this,Cx).call(this,e);if(r&&r.aborted)A(wx,this,Px).call(this,e,o);else{M(ax,this).add(e);try{const t=M(ex,this)&&"function"==typeof M(ex,this).get?M(ex,this).get(e):void 0;if(!t)return;if("ready"!==t.state&&"function"==typeof t.resolve)try{await t.resolve({signal:r})}catch(t){return}if("ready"!==t.state)return;const s=A(wx,this,Kx).call(this,t,n,i);if(!Number.isFinite(s)){const n=Array.isArray(null==t?void 0:t.tracks)?t.tracks.map((t=>null==t?void 0:t.type)).filter(Boolean):[];return void this.log.debug(`[#loadSeekWork] No seek segment offset for node [${e}] targetTime=${i} mainTrackId=${(null==t?void 0:t.mainTrackId)||"n/a"} trackTypes=[${n.join(",")}]`)}"function"==typeof t.loadMediaSegmentsAtOffset?(this.log.debug(`[#loadSeekWork] Loading seek segment for node [${e}] at offset=${s}`),A(wx,this,Ox).call(this,e,o,{allowSeekKeep:!0,segmentOffset:s}),await t.loadMediaSegmentsAtOffset(s,{signal:r})):"function"==typeof t.load&&await t.load({loadingMode:"partial",signal:r})}catch(t){Py(t,r)||this.log.warn(`[#loadSeekWork] SegmentLoadCoordinator failed to seek-load node ${e}: ${(null==t?void 0:t.message)||t}`)}finally{M(ax,this).delete(e),A(wx,this,Px).call(this,e,o)}}}function Kx(t,e,n){var i;const r=gm(e);if(!Number.isFinite(r))return;const o=tx(null==e?void 0:e.nodeOffsetOverride),s=Math.max(0,n-r+o),a=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[];let l;if(null!=t&&t.mainTrackId){const e=a.find((e=>(null==e?void 0:e.id)===t.mainTrackId));"video"!==(null==e?void 0:e.type)&&"image"!==(null==e?void 0:e.type)||(l=e)}if(l||(l=a.find((t=>"video"===(null==t?void 0:t.type)))||a.find((t=>"image"===(null==t?void 0:t.type)))),!l||!Array.isArray(l.segments))return;const c=l.segments.filter((t=>t&&!t.isInit&&Array.isArray(t.representations)));if(!c.length)return;const u=tx(null===(i=l)||void 0===i?void 0:i.offset),d=mb(c,Math.max(0,s-u),{preferRepresentationTime:!0}),h=Number(null==d?void 0:d.offset);return Number.isFinite(h)?h:void 0}function Xx(t,e,n=(t=>null===(t=M(ix,this))||void 0===t?void 0:t.currentTime)()){var i;const r=(Array.isArray(null===(i=M(ix,this))||void 0===i?void 0:i.placements)?M(ix,this).placements:[]).filter((e=>(null==e?void 0:e.nodeId)===t&&Number.isFinite(gm(e)))).sort(((t,e)=>gm(t)-gm(e)));if(!r.length)return e;const o=Number(n);if(!Number.isFinite(o))return e||r[0];let s,a;for(let t=0;t<r.length;t+=1){const e=r[t],n=gm(e);if(!Number.isFinite(n))continue;const i=mm(e,M(ex,this)),l=Number.isFinite(i)&&i>=0;(!a&&n>=o-Jw&&(a=e),l)?o+Jw>=n&&o<n+i-Jw&&(s=e):o+Jw>=n&&(s=e)}return s||a||r[r.length-1]}function Yx(t,e){var n;const i=Number(gm(e));if(!Number.isFinite(i))return;const r=mm(e,M(ex,this)),o=Number.isFinite(r)&&r>=0?i+r:void 0,s=(Array.isArray(null===(n=M(ix,this))||void 0===n?void 0:n.placements)?M(ix,this).placements:[]).filter((e=>(null==e?void 0:e.nodeId)===t&&Number.isFinite(gm(e)))).sort(((t,e)=>gm(t)-gm(e)));for(let t=0;t<s.length;t+=1){const e=s[t],n=Number(gm(e));if(Number.isFinite(n)&&!(n<=i+Jw)){if(Number.isFinite(o)&&n>o+Jw)return;return e}}}function Qx(){const t=[];let e=!1,n=1/0;if(M(rx,this).forEach(((i,r)=>{if(!r||!i)return;const o=M(ox,this).get(r);if(o)return e=!0,void(n=Math.min(n,tx(o.timelineStart)));const s=A(wx,this,Zx).call(this,r,i);s&&(e=!0,n=Math.min(n,tx(s.timelineStart)),t.push(s))})),!e||!Number.isFinite(n))return{hasPending:!1,waveTime:void 0,startable:[]};const i=t.filter((t=>tx(t.timelineStart)===n&&!M(ax,this).has(t.nodeId))).sort(((t,e)=>{const n=Number.isFinite(null==t?void 0:t.timelineStart)?t.timelineStart:Number.POSITIVE_INFINITY,i=Number.isFinite(null==e?void 0:e.timelineStart)?e.timelineStart:Number.POSITIVE_INFINITY;return n!==i?n-i:String(t.nodeId).localeCompare(String(e.nodeId))}));return{hasPending:!0,waveTime:n,startable:i}}function Jx({waveTime:t,startable:e}){const n=Math.max(0,this.settings.maxConcurrentLoads-M(ax,this).size);n&&e.length&&e.slice(0,n).forEach((e=>{A(wx,this,e_).call(this,e,t).finally((()=>{setTimeout((()=>A(wx,this,Vx).call(this)),0)}))}))}function Zx(t,e){var n,i;const r=M(ex,this)&&"function"==typeof M(ex,this).get?M(ex,this).get(t):void 0;if(!r)return;if("function"==typeof r.hasExceededManifestLoadAttempts&&r.hasExceededManifestLoadAttempts())return void M(rx,this).delete(t);const o=A(wx,this,Xx).call(this,t,e,null===(n=M(ix,this))||void 0===n?void 0:n.currentTime),s=Number(gm(o)),a=tx(null===(i=M(ix,this))||void 0===i?void 0:i.currentTime),l="function"==typeof r.loadMediaSegmentsAtOffset,c="function"==typeof r.load;if(!l&&!c)return void M(rx,this).delete(t);if(r.isLoaded)return void M(rx,this).delete(t);if("ready"!==r.state){if(!Number.isFinite(s))return;return{nodeId:t,segmentOffset:0,timelineStart:s}}if(!A(wx,this,s_).call(this,r))return void M(rx,this).delete(t);const u=Array.isArray(r.tracks)?r.tracks:[],d=u.some((t=>{const e=(Array.isArray(null==t?void 0:t.segments)?t.segments:[]).find((t=>(null==t?void 0:t.isInit)&&Array.isArray(null==t?void 0:t.representations)));return!!e&&!A(wx,this,Sx).call(this,e)})),h=new Set;u.forEach((t=>{(Array.isArray(null==t?void 0:t.segments)?t.segments:[]).forEach((t=>{if(!t||t.isInit||!Array.isArray(t.representations))return;const e=Number(t.offset);if(Number.isFinite(e)){const t=Math.round(e/Jw)*Jw;h.add(t)}}))}));const f=Array.from(h).sort(((t,e)=>t-e)),p=e=>{const n=Number(gm(e));if(!Number.isFinite(n))return{status:"none"};const i=tx(null==e?void 0:e.nodeOffsetOverride),o=Math.max(0,a-n+i);let s=0;for(let t=0;t<f.length&&f[t]<=o+Jw;t+=1)s=t;const l=f.slice(s);if(!l.some((t=>A(wx,this,t_).call(this,r,t))))return{status:f.slice(0,s).some((t=>A(wx,this,t_).call(this,r,t)))?"beforeOnly":"none"};const c=l.find((t=>A(wx,this,t_).call(this,r,t))),u=Math.max(0,tx(c)-i);return{status:"work",work:{nodeId:t,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:t,segmentOffset:0,timelineStart:s};M(rx,this).delete(t)}else{const e=A(wx,this,Yx).call(this,t,o);if(e){const t=p(e);if("work"===t.status)return t.work}}}function t_(t,e){const n=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[],i=tx(e);return n.some((t=>(Array.isArray(null==t?void 0:t.segments)?t.segments:[]).some((t=>{if(!t||t.isInit||!Array.isArray(t.representations))return!1;const e=Number(t.offset);return Number.isFinite(e)&&Math.abs(e-i)<=Jw&&!A(wx,this,Sx).call(this,t)}))))}async function e_(t,e){const n=null==t?void 0:t.nodeId,i=null==t?void 0:t.segmentOffset;if(this.log.debug(`[#loadP0Work] Loading ${Zw} node [${n}] at segmentOffset=${i} wave=${e}`),!n)return;const r=M(ex,this)&&"function"==typeof M(ex,this).get?M(ex,this).get(n):void 0;if(!r)return void M(rx,this).delete(n);const o="function"==typeof r.loadMediaSegmentsAtOffset&&Number.isFinite(i),{signal:s,controller:a}=A(wx,this,Cx).call(this,n,{allowSeekKeep:o,segmentOffset:i});if(s&&s.aborted)A(wx,this,Px).call(this,n,a);else{M(ax,this).add(n),M(ox,this).set(n,{timelineStart:e,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(t){if(Py(t,s))return;const e=`[#loadP0Work] SegmentLoadCoordinator failed to load ${Zw} work for node ${n}: ${(null==t?void 0:t.message)||t}`;this.log.warn(e)}finally{this.log.debug(`[#loadP0Work] Finished ${Zw} work for node [${n}]`),M(ox,this).delete(n),M(ax,this).delete(n),A(wx,this,Px).call(this,n,a)}}}function n_(){const t=new Set([...M(rx,this).keys(),...M(ax,this)]),e=A(wx,this,i_).call(this),n=Array.isArray(null==e?void 0:e.orderedIds)?e.orderedIds:null,i=Array.isArray(null==e?void 0:e.reachableIds)&&e.reachableIds.length?new Set(e.reachableIds):null,r=t=>!("function"==typeof t.hasExceededManifestLoadAttempts&&t.hasExceededManifestLoadAttempts()||t.isLoaded||"ready"===t.state&&A(wx,this,a_).call(this,t));if(i){const e=iw({prioritizer:M(nx,this),repository:M(ex,this),startNodeId:M(ux,this),prioritizedIds:n,pendingIds:t,allowedIds:i,filter:r});if(e.length)return e}return iw({prioritizer:M(nx,this),repository:M(ex,this),startNodeId:M(ux,this),prioritizedIds:n,pendingIds:t,filter:r})}function i_(){return M(nx,this)&&M(ux,this)?"function"==typeof M(nx,this).getPrioritizationSnapshot?M(nx,this).getPrioritizationSnapshot(M(ux,this)):{orderedIds:"function"==typeof M(nx,this).sortNodes?M(nx,this).sortNodes(M(ux,this)):[],reachableIds:"function"==typeof M(nx,this).getReachableNodeIds?M(nx,this).getReachableNodeIds(M(ux,this)):[]}:null}function r_(){A(wx,this,Tx).call(this)||(M(cx,this)||M(rx,this).size)&&(C(sx,this,A(wx,this,n_).call(this)),M(cx,this)&&!M(yx,this)&&A(wx,this,Vx).call(this))}async function o_(t,e){if(this.log.debug(`[#loadNode] Loading node [${t}] in '${e}' mode`),!t)return;const n=M(ex,this)&&"function"==typeof M(ex,this).get?M(ex,this).get(t):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 ${t}: already loaded`);const{signal:i,controller:r}=A(wx,this,Cx).call(this,t,{allowSeekKeep:!1});if(i&&i.aborted)A(wx,this,Px).call(this,t,r);else try{if("ready"!==n.state&&await n.resolve({signal:i}),"ready"!==n.state)return void this.log.debug(`[#loadNode] Skipping load for ${t}: not ready`);if("partial"===e&&A(wx,this,a_).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${t}: partial already loaded`);if(!A(wx,this,s_).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${t}: no loadable tracks`);M(ax,this).add(t),await n.load({loadingMode:e,signal:i})}catch(e){if(Py(e,i))return;this.log.warn(`[#loadNode] SegmentLoadCoordinator failed to load node ${t}: ${(null==e?void 0:e.message)||e}`)}finally{this.log.debug(`[#loadNode] Finished loading node [${t}]`),M(ax,this).delete(t),A(wx,this,Px).call(this,t,r)}}function s_(t){return(Array.isArray(t.tracks)?t.tracks:[]).some((t=>{var e;return null==t||null===(e=t.segments)||void 0===e?void 0:e.length}))}function a_(t){const e=(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).filter((t=>Array.isArray(null==t?void 0:t.segments)&&t.segments.length));return!e.length||e.every((t=>{const e=Array.isArray(null==t?void 0:t.segments)?t.segments:[];if(!e.length)return!0;const n=e.find((t=>null==t?void 0:t.isInit)),i=e.find((t=>t&&!t.isInit));return!(n&&!A(wx,this,Sx).call(this,n)||i&&!A(wx,this,Sx).call(this,i))}))}class l_ extends sd{constructor(...t){super(...t),this.track=void 0,this.lastSegment=void 0}get name(){return"BaseDecoder"}configure(t){this.track=t}decode(t){this.lastSegment=t}decodeChunk(t,e){}onDispose(){this.track=void 0,this.lastSegment=void 0}}function c_(t){if(!t)throw new Error("Assertion failed.")}const u_=t=>t&&t[t.length-1],d_=t=>{let e=0;for(;0===t.readBits(1)&&e<32;)e++;if(e>=32)throw new Error("Invalid exponential-Golomb code.");return(1<<e)-1+t.readBits(e)},h_=t=>t.constructor===Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t),f_=t=>t.constructor===DataView?t:ArrayBuffer.isView(t)?new DataView(t.buffer,t.byteOffset,t.byteLength):new DataView(t),p_=new TextDecoder,m_=t=>Object.fromEntries(Object.entries(t).map((([t,e])=>[e,t]))),v_={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},g_=m_(v_),y_={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},b_=m_(y_),k_={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},w_=m_(k_),x_=t=>[...t].map((t=>t.toString(16).padStart(2,"0"))).join(""),__=t=>(t=(t=(t=(t=(t=t>>1&1431655765|(1431655765&t)<<1)>>2&858993459|(858993459&t)<<2)>>4&252645135|(252645135&t)<<4)>>8&16711935|(16711935&t)<<8)>>16&65535|(65535&t)<<16)>>>0,T_=(t,e,n)=>{let i=0,r=t.length-1,o=-1;for(;i<=r;){const s=i+r>>1,a=n(t[s]);a===e?(o=s,r=s-1):a<e?i=s+1:r=s-1}return o},E_=(t,e,n)=>{let i=0,r=t.length-1,o=-1;for(;i<=r;){const s=i+(r-i+1)/2|0;n(t[s])<=e?(o=s,i=s+1):r=s-1}return o},I_=()=>{let t,e;return{promise:new Promise(((n,i)=>{t=n,e=i})),resolve:t,reject:e}},S_=(t,e,n)=>t.getUint8(e)<<16|t.getUint8(e+1)<<8|t.getUint8(e+2),A_=(t,e,n)=>Math.max(e,Math.min(n,t)),N_=/^[a-z]{3}$/,M_=1e6*(1+Number.EPSILON);let F_=null;let C_=null;const O_=()=>{if(null!==C_)return C_;if("undefined"==typeof navigator)return null;const t=/\bChrome\/(\d+)/.exec(navigator.userAgent);return t?C_=Number(t[1]):null},P_=t=>"number"==typeof t&&!Number.isNaN(t);class R_{constructor(t,e){if(this.data=t,this.mimeType=e,!(t instanceof Uint8Array))throw new TypeError("data must be a Uint8Array.");if("string"!=typeof e)throw new TypeError("mimeType must be a string.")}}const D_={default:!0,forced:!1,original:!1,commentary:!1,hearingImpaired:!1,visuallyImpaired:!1};class L_{constructor(t){this.bytes=t,this.pos=0}seekToByte(t){this.pos=8*t}readBit(){var t;const e=Math.floor(this.pos/8),n=null!==(t=this.bytes[e])&&void 0!==t?t:0,i=7-(7&this.pos),r=(n&1<<i)>>i;return this.pos++,r}readBits(t){if(1===t)return this.readBit();let e=0;for(let n=0;n<t;n++)e<<=1,e|=this.readBit();return e}writeBits(t,e){const n=this.pos+t;for(let t=this.pos;t<n;t++){const i=Math.floor(t/8);let r=this.bytes[i];const o=7-(7&t);r&=~(1<<o),r|=(e&1<<n-t-1)>>n-t-1<<o,this.bytes[i]=r}this.pos=n}readAlignedByte(){var t;if(this.pos%8!=0)throw new Error("Bitstream is not byte-aligned.");const e=this.pos/8,n=null!==(t=this.bytes[e])&&void 0!==t?t:0;return this.pos+=8,n}skipBits(t){this.pos+=t}getBitsLeft(){return 8*this.bytes.length-this.pos}clone(){const t=new L_(this.bytes);return t.pos=this.pos,t}}const B_=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],z_=[-1,1,2,3,4,5,6,8],W_=t=>{if(!t||t.byteLength<2)throw new TypeError("AAC description must be at least 2 bytes long.");const e=new L_(t);let n=e.readBits(5);31===n&&(n=32+e.readBits(6));const i=e.readBits(4);let r=null;15===i?r=e.readBits(24):i<B_.length&&(r=B_[i]);const o=e.readBits(4);let s=null;return o>=1&&o<=7&&(s=z_[o]),{objectType:n,frequencyIndex:i,sampleRate:r,channelConfiguration:o,numberOfChannels:s}},$_=["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"],j_=[{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}],U_=t=>{const{codec:e,codecDescription:n,colorSpace:i,avcCodecInfo:r,hevcCodecInfo:o,vp9CodecInfo:s,av1CodecInfo:a}=t;if("avc"===e){if(c_(null!==t.avcType),r){const e=new Uint8Array([r.avcProfileIndication,r.profileCompatibility,r.avcLevelIndication]);return`avc${t.avcType}.${x_(e)}`}if(!n||n.byteLength<4)throw new TypeError("AVC decoder description is not provided or is not at least 4 bytes long.");return`avc${t.avcType}.${x_(n.subarray(1,4))}`}if("hevc"===e){let t,e,i,r,s,a;if(o)t=o.generalProfileSpace,e=o.generalProfileIdc,i=__(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=f_(n),l=o.getUint8(1);t=l>>6&3,e=31&l,i=__(o.getUint32(2)),r=l>>5&1,s=o.getUint8(12),a=[];for(let t=0;t<6;t++)a.push(o.getUint8(6+t))}let l="hev1.";for(l+=["","A","B","C"][t]+e,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((t=>t.toString(16).toUpperCase())).join(".")),l}if("vp8"===e)return"vp8";if("vp9"===e){if(!s){const e=t.width*t.height;let n=u_(j_).level;for(const t of j_)if(e<=t.maxPictureSize){n=t.level;break}return`vp09.00.${n.toString().padStart(2,"0")}.08`}let e=`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 e+=`.${s.colourPrimaries.toString().padStart(2,"0")}.${s.transferCharacteristics.toString().padStart(2,"0")}.${s.matrixCoefficients.toString().padStart(2,"0")}.${s.videoFullRangeFlag.toString().padStart(2,"0")}`,e.endsWith(".01.01.01.01.00")&&(e=e.slice(0,-15)),e}if("av1"===e){if(!a){const e=t.width*t.height;let n=u_(j_).level;for(const t of j_)if(e<=t.maxPictureSize){n=t.level;break}return`av01.0.${n.toString().padStart(2,"0")}M.08`}const e=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?v_[i.primaries]:1,u=null!=i&&i.transfer?y_[i.transfer]:1,d=null!=i&&i.matrix?k_[i.matrix]:1,h=null!=i&&i.fullRange?1:0;let f=`av01.${e}.${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 '${e}'.`)},q_=t=>{const{codec:e,codecDescription:n,aacCodecInfo:i}=t;if("aac"===e){if(!i)throw new TypeError("AAC codec info must be provided.");if(i.isMpeg2)return"mp4a.67";{let t;return t=null!==i.objectType?i.objectType:W_(n).objectType,`mp4a.40.${t}`}}if("mp3"===e)return"mp3";if("opus"===e)return"opus";if("vorbis"===e)return"vorbis";if("flac"===e)return"flac";if("ac3"===e)return"ac-3";if("eac3"===e)return"ec-3";if(e&&$_.includes(e))return e;throw new TypeError(`Unhandled codec '${e}'.`)},V_=/^pcm-([usf])(\d+)+(be)?$/,G_=[48e3,44100,32e3],H_=[24e3,22050,16e3];var K_,X_;!function(t){t[t.NON_IDR_SLICE=1]="NON_IDR_SLICE",t[t.SLICE_DPA=2]="SLICE_DPA",t[t.SLICE_DPB=3]="SLICE_DPB",t[t.SLICE_DPC=4]="SLICE_DPC",t[t.IDR=5]="IDR",t[t.SEI=6]="SEI",t[t.SPS=7]="SPS",t[t.PPS=8]="PPS",t[t.AUD=9]="AUD",t[t.SPS_EXT=13]="SPS_EXT"}(K_||(K_={})),function(t){t[t.RASL_N=8]="RASL_N",t[t.RASL_R=9]="RASL_R",t[t.BLA_W_LP=16]="BLA_W_LP",t[t.RSV_IRAP_VCL23=23]="RSV_IRAP_VCL23",t[t.VPS_NUT=32]="VPS_NUT",t[t.SPS_NUT=33]="SPS_NUT",t[t.PPS_NUT=34]="PPS_NUT",t[t.AUD_NUT=35]="AUD_NUT",t[t.PREFIX_SEI_NUT=39]="PREFIX_SEI_NUT",t[t.SUFFIX_SEI_NUT=40]="SUFFIX_SEI_NUT"}(X_||(X_={}));const Y_=function*(t){let e=0,n=-1;for(;e<t.length-2;){const i=t.indexOf(0,e);if(-1===i||i>=t.length-2)break;e=i;let r=0;e+3<t.length&&0===t[e+1]&&0===t[e+2]&&1===t[e+3]?r=4:0===t[e+1]&&1===t[e+2]&&(r=3),0!==r?(-1!==n&&e>n&&(yield{offset:n,length:e-n}),n=e+r,e=n):e++}-1!==n&&n<t.length&&(yield{offset:n,length:t.length-n})},Q_=function*(t,e){let n=0;const i=new DataView(t.buffer,t.byteOffset,t.byteLength);for(;n+e<=t.length;){let t;1===e?t=i.getUint8(n):2===e?t=i.getUint16(n,!1):3===e?t=S_(i,n):(c_(4===e),t=i.getUint32(n,!1)),n+=e,yield{offset:n,length:t},n+=t}},J_=t=>31&t,Z_=t=>{const e=[],n=t.length;for(let i=0;i<n;i++)i+2<n&&0===t[i]&&0===t[i+1]&&3===t[i+2]?(e.push(0,0),i+=2):e.push(t[i]);return new Uint8Array(e)},tT=t=>t>>1&63,eT=function*(t){const e=new L_(t),n=()=>{let t=0;for(let n=0;n<8;n++){const i=e.readAlignedByte();if(t|=(127&i)<<7*n,!(128&i))break;if(7===n&&128&i)return null}return t>=2**32-1?null:t};for(;e.getBitsLeft()>=8;){e.skipBits(1);const i=e.readBits(4),r=e.readBits(1),o=e.readBits(1);let s;if(e.skipBits(1),r&&e.skipBits(8),o){const t=n();if(null===t)return;s=t}else s=Math.floor(e.getBitsLeft()/8);c_(e.pos%8==0),yield{type:i,data:t.subarray(e.pos/8,e.pos/8+s)},e.skipBits(8*s)}};var nT;!function(t){t[t.STREAMINFO=0]="STREAMINFO",t[t.VORBIS_COMMENT=4]="VORBIS_COMMENT",t[t.PICTURE=6]="PICTURE"}(nT||(nT={}));const iT=[2,1,2,3,3,4,4,5];class rT{constructor(t){this.input=t}}const oT=[],sT=[],aT=new Uint8Array(0);class lT{constructor(t,e,n,i,r=-1,o,s){if(this.data=t,this.type=e,this.timestamp=n,this.duration=i,this.sequenceNumber=r,t===aT&&void 0===o)throw new Error("Internal error: byteLength must be explicitly provided when constructing metadata-only packets.");if(void 0===o&&(o=t.byteLength),!(t instanceof Uint8Array))throw new TypeError("data must be a Uint8Array.");if("key"!==e&&"delta"!==e)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===aT}get microsecondTimestamp(){return Math.trunc(M_*this.timestamp)}get microsecondDuration(){return Math.trunc(M_*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(t=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:t,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(t,e){var n;if(!(t instanceof EncodedVideoChunk||t instanceof EncodedAudioChunk))throw new TypeError("chunk must be an EncodedVideoChunk or EncodedAudioChunk.");const i=new Uint8Array(t.byteLength);return t.copyTo(i),new lT(i,t.type,t.timestamp/1e6,(null!==(n=t.duration)&&void 0!==n?n:0)/1e6,void 0,void 0,e)}clone(t){var e,n,i,r,o,s;if(void 0!==t&&("object"!=typeof t||null===t))throw new TypeError("options, when provided, must be an object.");if(void 0!==(null==t?void 0:t.data)&&!(t.data instanceof Uint8Array))throw new TypeError("options.data, when provided, must be a Uint8Array.");if(void 0!==(null==t?void 0:t.type)&&"key"!==t.type&&"delta"!==t.type)throw new TypeError('options.type, when provided, must be either "key" or "delta".');if(void 0!==(null==t?void 0:t.timestamp)&&!Number.isFinite(t.timestamp))throw new TypeError("options.timestamp, when provided, must be a number.");if(void 0!==(null==t?void 0:t.duration)&&!Number.isFinite(t.duration))throw new TypeError("options.duration, when provided, must be a number.");if(void 0!==(null==t?void 0:t.sequenceNumber)&&!Number.isFinite(t.sequenceNumber))throw new TypeError("options.sequenceNumber, when provided, must be a number.");if(void 0!==(null==t?void 0:t.sideData)&&("object"!=typeof t.sideData||null===t.sideData))throw new TypeError("options.sideData, when provided, must be an object.");return new lT(null!==(e=null==t?void 0:t.data)&&void 0!==e?e:this.data,null!==(n=null==t?void 0:t.type)&&void 0!==n?n:this.type,null!==(i=null==t?void 0:t.timestamp)&&void 0!==i?i:this.timestamp,null!==(r=null==t?void 0:t.duration)&&void 0!==r?r:this.duration,null!==(o=null==t?void 0:t.sequenceNumber)&&void 0!==o?o:this.sequenceNumber,this.byteLength,null!==(s=null==t?void 0:t.sideData)&&void 0!==s?s:this.sideData)}}const cT=t=>{if(!t||"object"!=typeof t)throw new TypeError("options must be an object.");if(void 0!==t.metadataOnly&&"boolean"!=typeof t.metadataOnly)throw new TypeError("options.metadataOnly, when defined, must be a boolean.");if(void 0!==t.verifyKeyPackets&&"boolean"!=typeof t.verifyKeyPackets)throw new TypeError("options.verifyKeyPackets, when defined, must be a boolean.");if(t.verifyKeyPackets&&t.metadataOnly)throw new TypeError("options.verifyKeyPackets and options.metadataOnly cannot be enabled together.")},uT=t=>{if(!P_(t))throw new TypeError("timestamp must be a number.")},dT=(t,e,n)=>n.verifyKeyPackets?e.then((async e=>{if(!e||"delta"===e.type)return e;const n=await t.determinePacketType(e);return n&&(e.type=n),e})):e;class hT{constructor(t){if(!(t instanceof fT))throw new TypeError("track must be an InputTrack.");this._track=t}getFirstPacket(t={}){if(cT(t),this._track.input._disposed)throw new zT;return dT(this._track,this._track._backing.getFirstPacket(t),t)}async getFirstKeyPacket(t={}){cT(t);const e=await this.getFirstPacket(t);return e?"key"===e.type?e:this.getNextKeyPacket(e,t):null}getPacket(t,e={}){if(uT(t),cT(e),this._track.input._disposed)throw new zT;return dT(this._track,this._track._backing.getPacket(t,e),e)}getNextPacket(t,e={}){if(!(t instanceof lT))throw new TypeError("packet must be an EncodedPacket.");if(cT(e),this._track.input._disposed)throw new zT;return dT(this._track,this._track._backing.getNextPacket(t,e),e)}async getKeyPacket(t,e={}){if(uT(t),cT(e),this._track.input._disposed)throw new zT;if(!e.verifyKeyPackets)return this._track._backing.getKeyPacket(t,e);const n=await this._track._backing.getKeyPacket(t,e);return n?(c_("key"===n.type),"delta"===await this._track.determinePacketType(n)?this.getKeyPacket(n.timestamp-1/this._track.timeResolution,e):n):n}async getNextKeyPacket(t,e={}){if(!(t instanceof lT))throw new TypeError("packet must be an EncodedPacket.");if(cT(e),this._track.input._disposed)throw new zT;if(!e.verifyKeyPackets)return this._track._backing.getNextKeyPacket(t,e);const n=await this._track._backing.getNextKeyPacket(t,e);return n?(c_("key"===n.type),"delta"===await this._track.determinePacketType(n)?this.getNextKeyPacket(n,e):n):n}packets(t,e,n={}){if(void 0!==t&&!(t instanceof lT))throw new TypeError("startPacket must be an EncodedPacket.");if(void 0!==t&&t.isMetadataOnly&&(null==n||!n.metadataOnly))throw new TypeError("startPacket can only be metadata-only if options.metadataOnly is enabled.");if(void 0!==e&&!(e instanceof lT))throw new TypeError("endPacket must be an EncodedPacket.");if(cT(n),this._track.input._disposed)throw new zT;const i=[];let{promise:r,resolve:o}=I_(),{promise:s,resolve:a}=I_(),l=!1,c=!1,u=null;const d=[];(async()=>{let u=null!=t?t:await this.getFirstPacket(n);for(;u&&!c&&!this._track.input._disposed&&!(e&&u.sequenceNumber>=(null==e?void 0:e.sequenceNumber));)i.length>Math.max(2,d.length)?(({promise:s,resolve:a}=I_()),await s):(i.push(u),o(),({promise:r,resolve:o}=I_()),u=await this.getNextPacket(u,n));l=!0,o()})().catch((t=>{u||(u=t,o())}));const h=this._track;return{async next(){for(;;){if(h.input._disposed)throw new zT;if(c)return{value:void 0,done:!0};if(u)throw u;if(i.length>0){const t=i.shift(),e=performance.now();for(d.push(e);d.length>0&&e-d[0]>=1e3;)d.shift();return a(),{value:t,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(t){throw t},[Symbol.asyncIterator](){return this}}}}class fT{constructor(t,e){this.input=t,this._backing=e}isVideoTrack(){return this instanceof pT}isAudioTrack(){return this instanceof mT}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(t=1/0){const e=new hT(this);let n=1/0,i=-1/0,r=0,o=0;for await(const s of e.packets(void 0,void 0,{metadataOnly:!0})){if(r>=t&&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 pT extends fT{constructor(t,e){super(t,e),this._backing=e,this.pixelAspectRatio=(t=>{c_(0!==t.den);let e=Math.abs(t.num),n=Math.abs(t.den);for(;0!==n;){const t=e%n;e=n,n=t}const i=e||1;return{num:t.num/i,den:t.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 t=await this._backing.getColorSpace();return"bt2020"===t.primaries||"smpte432"===t.primaries||"pg"===t.transfer||"hlg"===t.transfer||"bt2020-ncl"===t.matrix}canBeTransparent(){return this._backing.canBeTransparent()}getDecoderConfig(){return this._backing.getDecoderConfig()}async getCodecParameterString(){var t;const e=await this._backing.getDecoderConfig();return null!==(t=null==e?void 0:e.codec)&&void 0!==t?t:null}async canDecode(){try{const t=await this._backing.getDecoderConfig();if(!t)return!1;const e=this._backing.getCodec();return c_(null!==e),oT.some((n=>n.supports(e,t)))?!0:"undefined"!=typeof VideoDecoder&&!0===(await VideoDecoder.isConfigSupported(t)).supported}catch(t){return console.error("Error during decodability check:",t),!1}}async determinePacketType(t){if(!(t instanceof lT))throw new TypeError("packet must be an EncodedPacket.");if(t.isMetadataOnly)throw new TypeError("packet must not be metadata-only to determine its type.");if(null===this.codec)return null;const e=await this.getDecoderConfig();return c_(e),((t,e,n)=>{switch(t){case"avc":for(const t of((t,e)=>{if(e.description){const n=3&h_(e.description)[4];return Q_(t,n+1)}return Y_(t)})(n,e)){const e=n[t.offset],r=J_(e);if(r>=K_.NON_IDR_SLICE&&r<=K_.SLICE_DPC)return"delta";if(r===K_.IDR)return"key";if(r===K_.SEI&&(i=void 0,!(null!==F_?F_:F_=!("undefined"==typeof navigator||(null===(i=navigator.vendor)||void 0===i||!i.includes("Google Inc"))&&!/Chrome/.test(navigator.userAgent)))||O_()>=144)){const e=n.subarray(t.offset,t.offset+t.length),i=Z_(e);let r=1;do{let t=0;for(;;){const e=i[r++];if(void 0===e)break;if(t+=e,e<255)break}let e=0;for(;;){const t=i[r++];if(void 0===t)break;if(e+=t,t<255)break}if(6===t){const t=new L_(i);t.pos=8*r;const e=d_(t),n=t.readBits(1);if(0===e&&1===n)return"key"}r+=e}while(r<i.length-1)}}return"delta";case"hevc":for(const t of((t,e)=>{if(e.description){const n=3&h_(e.description)[21];return Q_(t,n+1)}return Y_(t)})(n,e)){const e=tT(n[t.offset]);if(e<X_.BLA_W_LP)return"delta";if(e<=X_.RSV_IRAP_VCL23)return"key"}return"delta";case"vp8":return 1&n[0]?"delta":"key";case"vp9":{const t=new L_(n);if(2!==t.readBits(2))return null;const e=t.readBits(1);return 3===(t.readBits(1)<<1)+e&&t.skipBits(1),t.readBits(1)?null:0===t.readBits(1)?"key":"delta"}case"av1":{let t=!1;for(const{type:e,data:i}of eT(n))if(1===e){const e=new L_(i);e.skipBits(4),t=!!e.readBits(1)}else if(3===e||6===e||7===e){if(t)return"key";const e=new L_(i);return e.readBits(1)?null:0===e.readBits(2)?"key":"delta"}return null}default:(t=>{throw new Error(`Unexpected value: ${t}`)})(t),c_(!1)}var i})(this.codec,e,t.data)}}class mT extends fT{constructor(t,e){super(t,e),this._backing=e}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 t;const e=await this._backing.getDecoderConfig();return null!==(t=null==e?void 0:e.codec)&&void 0!==t?t:null}async canDecode(){try{const t=await this._backing.getDecoderConfig();if(!t)return!1;const e=this._backing.getCodec();return c_(null!==e),sT.some((n=>n.supports(e,t)))?!0:!!t.codec.startsWith("pcm-")||"undefined"!=typeof AudioDecoder&&!0===(await AudioDecoder.isConfigSupported(t)).supported}catch(t){return console.error("Error during decodability check:",t),!1}}async determinePacketType(t){if(!(t instanceof lT))throw new TypeError("packet must be an EncodedPacket.");return null===this.codec?null:"key"}}const vT=t=>{let e=KT(t);const n=ZT(t,4);let i=8;1===e&&(e=YT(t),i=16);const r=e-i;return r<0?null:{name:n,totalSize:e,headerSize:i,contentSize:r}},gT=t=>XT(t)/65536,yT=t=>XT(t)/1073741824,bT=t=>{let e=0;for(let n=0;n<4;n++){e<<=7;const n=qT(t);if(e|=127&n,!(128&n))break}return e},kT=t=>{let e=VT(t);return t.skip(2),e=Math.min(e,t.remainingLength),p_.decode(UT(t,e))},wT=t=>{const e=vT(t);if(!e||"data"!==e.name)return null;if(t.remainingLength<8)return null;const n=KT(t);t.skip(4);const i=UT(t,e.contentSize-8);switch(n){case 1:return p_.decode(i);case 2:return new TextDecoder("utf-16be").decode(i);case 13:return new R_(i,"image/jpeg");case 14:return new R_(i,"image/png");case 27:return new R_(i,"image/bmp");default:return i}};class xT extends rT{constructor(t){super(t),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=t._reader}async computeDuration(){const t=await this.getTracks(),e=await Promise.all(t.map((t=>t.computeDuration())));return Math.max(0,...e)}async getTracks(){return await this.readMetadata(),this.tracks.map((t=>t.inputTrack))}async getMimeType(){await this.readMetadata();const t=await Promise.all(this.tracks.map((t=>t.inputTrack.getCodecParameterString())));return(t=>{let e=(t.hasVideo?"video/":t.hasAudio?"audio/":"application/")+(t.isQuickTime?"quicktime":"mp4");return t.codecStrings.length>0&&(e+=`; codecs="${[...new Set(t.codecStrings)].join(", ")}"`),e})({isQuickTime:this.isQuickTime,hasVideo:this.tracks.some((t=>{var e;return"video"===(null===(e=t.info)||void 0===e?void 0:e.type)})),hasAudio:this.tracks.some((t=>{var e;return"audio"===(null===(e=t.info)||void 0===e?void 0:e.type)})),codecStrings:t.filter(Boolean)})}async getMetadataTags(){return await this.readMetadata(),this.metadataTags}readMetadata(){var t;return null!==(t=this.metadataPromise)&&void 0!==t?t:this.metadataPromise=(async()=>{let t=0;for(;;){let e=this.reader.requestSliceRange(t,8,16);if(e instanceof Promise&&(e=await e),!e)break;const n=t,i=vT(e);if(!i)break;if("ftyp"===i.name){const t=ZT(e,4);this.isQuickTime="qt "===t}else if("moov"===i.name){let t=this.reader.requestSlice(e.filePos,i.contentSize);if(t instanceof Promise&&(t=await t),!t)break;this.moovSlice=t,this.readContiguousBoxes(this.moovSlice),this.tracks.sort(((t,e)=>Number(e.disposition.default)-Number(t.disposition.default)));for(const t of this.tracks){const e=t.editListPreviousSegmentDurations/this.movieTimescale;t.editListOffset-=Math.round(e*t.timescale)}break}t=n+i.totalSize}if(this.isFragmented&&null!==this.reader.fileSize){let t=this.reader.requestSlice(this.reader.fileSize-4,4);t instanceof Promise&&(t=await t),c_(t);const e=KT(t),n=this.reader.fileSize-e;if(n>=0&&n<=this.reader.fileSize-16){let t=this.reader.requestSliceRange(n,8,16);if(t instanceof Promise&&(t=await t),t){const e=vT(t);if(e&&"mfra"===e.name){let n=this.reader.requestSlice(t.filePos,e.contentSize);n instanceof Promise&&(n=await n),n&&this.readContiguousBoxes(n)}}}}})()}getSampleTableForTrack(t){var e;if(t.sampleTable)return t.sampleTable;const n={sampleTimingEntries:[],sampleCompositionTimeOffsets:[],sampleSizes:[],keySampleIndices:null,chunkOffsets:[],sampleToChunk:[],presentationTimestamps:null,presentationTimestampIndexMap:null};t.sampleTable=n,c_(this.moovSlice);const i=this.moovSlice.slice(t.sampleTableByteOffset);if(this.currentTrack=t,this.traverseBox(i),this.currentTrack=null,"audio"===(null===(e=t.info)||void 0===e?void 0:e.type)&&t.info.codec&&$_.includes(t.info.codec)&&0===n.sampleCompositionTimeOffsets.length){var r;c_("audio"===(null===(r=t.info)||void 0===r?void 0:r.type));const e=(t=>{if(c_($_.includes(t)),"ulaw"===t)return{dataType:"ulaw",sampleSize:1,littleEndian:!0,silentValue:255};if("alaw"===t)return{dataType:"alaw",sampleSize:1,littleEndian:!0,silentValue:213};const e=V_.exec(t);let n;return c_(e),n="u"===e[1]?"unsigned":"s"===e[1]?"signed":"float",{dataType:n,sampleSize:Number(e[2])/8,littleEndian:"be"!==e[3],silentValue:"pcm-u8"===t?128:0}})(t.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=E_(n.sampleTimingEntries,a,(t=>t.startIndex)),u=n.sampleTimingEntries[c],d=E_(n.sampleTimingEntries,l,(t=>t.startIndex)),h=n.sampleTimingEntries[d],f=u.startDecodeTimestamp+(a-u.startIndex)*u.delta,p=h.startDecodeTimestamp+(l-h.startIndex)*h.delta-f,m=u_(i);m&&m.delta===p?m.count++:i.push({startIndex:s.startChunkIndex+r,startDecodeTimestamp:f,count:1,delta:p});const v=s.samplesPerChunk*e.sampleSize*t.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 t of n.sampleTimingEntries)for(let e=0;e<t.count;e++)n.presentationTimestamps.push({presentationTimestamp:t.startDecodeTimestamp+e*t.delta,sampleIndex:t.startIndex+e});for(const t of n.sampleCompositionTimeOffsets)for(let e=0;e<t.count;e++){const i=t.startIndex+e,r=n.presentationTimestamps[i];r&&(r.presentationTimestamp+=t.offset)}n.presentationTimestamps.sort(((t,e)=>t.presentationTimestamp-e.presentationTimestamp)),n.presentationTimestampIndexMap=Array(n.presentationTimestamps.length).fill(-1);for(let t=0;t<n.presentationTimestamps.length;t++)n.presentationTimestampIndexMap[n.presentationTimestamps[t].sampleIndex]=t}return n}async readFragment(t){var e;if((null===(e=this.lastReadFragment)||void 0===e?void 0:e.moofOffset)===t)return this.lastReadFragment;let n=this.reader.requestSliceRange(t,8,16);n instanceof Promise&&(n=await n),c_(n);const i=vT(n);c_("moof"===(null==i?void 0:i.name));let r=this.reader.requestSlice(t,i.totalSize);r instanceof Promise&&(r=await r),c_(r),this.traverseBox(r);const o=this.lastReadFragment;c_(o&&o.moofOffset===t);for(const[,t]of o.trackData){const e=t.track,{fragmentPositionCache:n}=e;if(!t.startTimestampIsFinal){const i=e.fragmentLookupTable.find((t=>t.moofOffset===o.moofOffset));if(i)MT(t,i.timestamp);else{const e=E_(n,o.moofOffset-1,(t=>t.moofOffset));if(-1!==e){const i=n[e];MT(t,i.endTimestamp)}}t.startTimestampIsFinal=!0}const i=E_(n,t.startTimestamp,(t=>t.startTimestamp));-1!==i&&n[i].moofOffset===o.moofOffset||n.splice(i+1,0,{moofOffset:o.moofOffset,startTimestamp:t.startTimestamp,endTimestamp:t.endTimestamp})}return o}readContiguousBoxes(t){const e=t.filePos;for(;t.filePos-e<=t.length-8&&this.traverseBox(t););}*iterateContiguousBoxes(t){const e=t.filePos;for(;t.filePos-e<=t.length-8;){const e=t.filePos,n=vT(t);if(!n)break;yield{boxInfo:n,slice:t},t.filePos=e+n.totalSize}}traverseBox(t){var e,n,i,r,o,s,a,l,c,u,d,h,f,p,m,v,g,y,b,k,w,x,_,T,E,I,S,A,N,M,F,C,O,P,R,D;const L=t.filePos,B=vT(t);if(!B)return!1;const z=t.filePos,W=L+B.totalSize;switch(B.name){case"mdia":case"minf":case"dinf":case"mfra":case"edts":case"wave":this.readContiguousBoxes(t.slice(z,B.contentSize));break;case"mvhd":{const e=qT(t);t.skip(3),1===e?(t.skip(16),this.movieTimescale=KT(t),this.movieDurationInTimescale=YT(t)):(t.skip(8),this.movieTimescale=KT(t),this.movieDurationInTimescale=KT(t))}break;case"trak":{const e={id:-1,demuxer:this,inputTrack:null,disposition:{...D_},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=e,this.readContiguousBoxes(t.slice(z,B.contentSize)),-1!==e.id&&-1!==e.timescale&&null!==e.info)if("video"===e.info.type&&-1!==e.info.width){const t=e;e.inputTrack=new pT(this.input,new TT(t)),this.tracks.push(e)}else if("audio"===e.info.type&&-1!==e.info.numberOfChannels){const t=e;e.inputTrack=new mT(this.input,new ET(t)),this.tracks.push(e)}this.currentTrack=null}break;case"tkhd":{const e=this.currentTrack;if(!e)break;const n=qT(t),i=!!(1&GT(t));if(e.disposition.default=i,0===n)t.skip(8),e.id=KT(t),t.skip(4),e.durationInMovieTimescale=KT(t);else{if(1!==n)throw new Error(`Incorrect track header version ${n}.`);t.skip(16),e.id=KT(t),t.skip(4),e.durationInMovieTimescale=YT(t)}t.skip(16);const r=[gT(t),gT(t),yT(t),gT(t),gT(t),yT(t),gT(t),gT(t),yT(t)],o=(t=>{const e=(t%360+360)%360;if(0===e||90===e||180===e||270===e)return e;throw new Error(`Invalid rotation ${t}.`)})((Ct=FT(r),90*Math.round(Ct/90)));c_(0===o||90===o||180===o||270===o),e.rotation=o}break;case"elst":{const e=this.currentTrack;if(!e)break;const n=qT(t);t.skip(3);let i=!1,r=0;const o=KT(t);for(let s=0;s<o;s++){const o=1===n?YT(t):KT(t),s=1===n?QT(t):XT(t),a=gT(t);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}e.editListPreviousSegmentDurations=r,e.editListOffset=s,i=!0}else r+=o}}}break;case"mdhd":{const e=this.currentTrack;if(!e)break;const n=qT(t);t.skip(3),0===n?(t.skip(8),e.timescale=KT(t),e.durationInMediaTimescale=KT(t)):1===n&&(t.skip(16),e.timescale=KT(t),e.durationInMediaTimescale=YT(t));let i=VT(t);if(i>0){e.languageCode="";for(let t=0;t<3;t++)e.languageCode=String.fromCharCode(96+(31&i))+e.languageCode,i>>=5;Ft=e.languageCode,N_.test(Ft)||(e.languageCode="und")}}break;case"hdlr":{const e=this.currentTrack;if(!e)break;t.skip(8);const n=ZT(t,4);"vide"===n?e.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&&(e.info={type:"audio",numberOfChannels:-1,sampleRate:-1,codec:null,codecDescription:null,aacCodecInfo:null})}break;case"stbl":{const e=this.currentTrack;if(!e)break;e.sampleTableByteOffset=L,this.readContiguousBoxes(t.slice(z,B.contentSize))}break;case"stsd":{const e=this.currentTrack;if(!e)break;if(null===e.info||e.sampleTable)break;const n=qT(t);t.skip(3);const i=KT(t);for(let r=0;r<i;r++){const i=t.filePos,r=vT(t);if(!r)break;e.internalCodecId=r.name;const o=r.name.toLowerCase();if("video"===e.info.type)"avc1"===o||"avc3"===o?(e.info.codec="avc",e.info.avcType="avc1"===o?1:3):"hvc1"===o||"hev1"===o?e.info.codec="hevc":"vp08"===o?e.info.codec="vp8":"vp09"===o?e.info.codec="vp9":"av01"===o?e.info.codec="av1":console.warn(`Unsupported video codec (sample entry type '${r.name}').`),t.skip(24),e.info.width=VT(t),e.info.height=VT(t),e.info.squarePixelWidth=e.info.width,e.info.squarePixelHeight=e.info.height,t.skip(50),this.readContiguousBoxes(t.slice(t.filePos,i+r.totalSize-t.filePos));else{"mp4a"===o||("opus"===o?e.info.codec="opus":"flac"===o?e.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?e.info.codec="ulaw":"alaw"===o?e.info.codec="alaw":"ac-3"===o?e.info.codec="ac3":"ec-3"===o?e.info.codec="eac3":console.warn(`Unsupported audio codec (sample entry type '${r.name}').`))),t.skip(8);const s=VT(t);t.skip(6);let a=VT(t),l=VT(t);t.skip(4);let c=KT(t)/65536;if(0===n&&s>0)if(1===s)t.skip(4),l=8*KT(t),t.skip(8);else if(2===s){t.skip(4),c=JT(t),a=KT(t),t.skip(4),l=KT(t);const n=KT(t);if(t.skip(8),"lpcm"===o){const t=l+7>>3,i=Boolean(1&n),r=Boolean(2&n),o=4&n?-1:0;l>0&&l<=64&&(i?32===l&&(e.info.codec=r?"pcm-f32be":"pcm-f32"):o&1<<t-1?1===t?e.info.codec="pcm-s8":2===t?e.info.codec=r?"pcm-s16be":"pcm-s16":3===t?e.info.codec=r?"pcm-s24be":"pcm-s24":4===t&&(e.info.codec=r?"pcm-s32be":"pcm-s32"):1===t&&(e.info.codec="pcm-u8")),null===e.info.codec&&console.warn("Unsupported PCM format.")}}"opus"===e.info.codec&&(c=48e3),e.info.numberOfChannels=a,e.info.sampleRate=c,"twos"===o?8===l?e.info.codec="pcm-s8":16===l?e.info.codec="pcm-s16be":(console.warn(`Unsupported sample size ${l} for codec 'twos'.`),e.info.codec=null):"sowt"===o?8===l?e.info.codec="pcm-s8":16===l?e.info.codec="pcm-s16":(console.warn(`Unsupported sample size ${l} for codec 'sowt'.`),e.info.codec=null):"raw "===o?e.info.codec="pcm-u8":"in24"===o?e.info.codec="pcm-s24be":"in32"===o?e.info.codec="pcm-s32be":"fl32"===o?e.info.codec="pcm-f32be":"fl64"===o?e.info.codec="pcm-f64be":"ipcm"===o?e.info.codec="pcm-s16be":"fpcm"===o&&(e.info.codec="pcm-f32be"),this.readContiguousBoxes(t.slice(t.filePos,i+r.totalSize-t.filePos))}}}break;case"avcC":{const e=this.currentTrack;if(!e)break;c_(e.info),e.info.codecDescription=UT(t,B.contentSize)}break;case"hvcC":{const e=this.currentTrack;if(!e)break;c_(e.info),e.info.codecDescription=UT(t,B.contentSize)}break;case"vpcC":{var $;const e=this.currentTrack;if(!e)break;c_("video"===(null===($=e.info)||void 0===$?void 0:$.type)),t.skip(4);const n=qT(t),i=qT(t),r=qT(t),o=r>>4,s=r>>1&7,a=1&r,l=qT(t),c=qT(t),u=qT(t);e.info.vp9CodecInfo={profile:n,level:i,bitDepth:o,chromaSubsampling:s,videoFullRangeFlag:a,colourPrimaries:l,transferCharacteristics:c,matrixCoefficients:u}}break;case"av1C":{var j;const e=this.currentTrack;if(!e)break;c_("video"===(null===(j=e.info)||void 0===j?void 0:j.type)),t.skip(1);const n=qT(t),i=n>>5,r=31&n,o=qT(t),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;e.info.av1CodecInfo={profile:i,level:r,tier:s,bitDepth:h,monochrome:l,chromaSubsamplingX:c,chromaSubsamplingY:u,chromaSamplePosition:d}}break;case"colr":{var U;const e=this.currentTrack;if(!e)break;if(c_("video"===(null===(U=e.info)||void 0===U?void 0:U.type)),"nclx"!==ZT(t,4))break;const n=VT(t),i=VT(t),r=VT(t),o=Boolean(128&qT(t));e.info.colorSpace={primaries:g_[n],transfer:b_[i],matrix:w_[r],fullRange:o}}break;case"pasp":{var q;const e=this.currentTrack;if(!e)break;c_("video"===(null===(q=e.info)||void 0===q?void 0:q.type));const n=KT(t),i=KT(t);n>i?e.info.squarePixelWidth=Math.round(e.info.width*n/i):e.info.squarePixelHeight=Math.round(e.info.height*i/n)}break;case"esds":{var V;const e=this.currentTrack;if(!e)break;c_("audio"===(null===(V=e.info)||void 0===V?void 0:V.type)),t.skip(4),c_(3===qT(t)),bT(t),t.skip(2);const n=qT(t),i=!!(64&n),r=!!(32&n);if(!!(128&n)&&t.skip(2),i){const e=qT(t);t.skip(e)}r&&t.skip(2),c_(4===qT(t));const o=bT(t),s=t.filePos,a=qT(t);if(64===a||103===a?(e.info.codec="aac",e.info.aacCodecInfo={isMpeg2:103===a,objectType:null}):105===a||107===a?e.info.codec="mp3":221===a?e.info.codec="vorbis":console.warn(`Unsupported audio codec (objectTypeIndication ${a}) - discarding track.`),t.skip(12),o>t.filePos-s){c_(5===qT(t));const n=bT(t);if(e.info.codecDescription=UT(t,n),"aac"===e.info.codec){const t=W_(e.info.codecDescription);null!==t.numberOfChannels&&(e.info.numberOfChannels=t.numberOfChannels),null!==t.sampleRate&&(e.info.sampleRate=t.sampleRate)}}}break;case"enda":{var G;const e=this.currentTrack;if(!e)break;c_("audio"===(null===(G=e.info)||void 0===G?void 0:G.type)),255&VT(t)&&("pcm-s16be"===e.info.codec?e.info.codec="pcm-s16":"pcm-s24be"===e.info.codec?e.info.codec="pcm-s24":"pcm-s32be"===e.info.codec?e.info.codec="pcm-s32":"pcm-f32be"===e.info.codec?e.info.codec="pcm-f32":"pcm-f64be"===e.info.codec&&(e.info.codec="pcm-f64"))}break;case"pcmC":{var H;const e=this.currentTrack;if(!e)break;c_("audio"===(null===(H=e.info)||void 0===H?void 0:H.type)),t.skip(4);const n=qT(t),i=Boolean(1&n),r=qT(t);"pcm-s16be"===e.info.codec?i?16===r?e.info.codec="pcm-s16":24===r?e.info.codec="pcm-s24":32===r?e.info.codec="pcm-s32":(console.warn(`Invalid ipcm sample size ${r}.`),e.info.codec=null):16===r?e.info.codec="pcm-s16be":24===r?e.info.codec="pcm-s24be":32===r?e.info.codec="pcm-s32be":(console.warn(`Invalid ipcm sample size ${r}.`),e.info.codec=null):"pcm-f32be"===e.info.codec&&(i?32===r?e.info.codec="pcm-f32":64===r?e.info.codec="pcm-f64":(console.warn(`Invalid fpcm sample size ${r}.`),e.info.codec=null):32===r?e.info.codec="pcm-f32be":64===r?e.info.codec="pcm-f64be":(console.warn(`Invalid fpcm sample size ${r}.`),e.info.codec=null));break}case"dOps":{var K;const e=this.currentTrack;if(!e)break;c_("audio"===(null===(K=e.info)||void 0===K?void 0:K.type)),t.skip(1);const n=qT(t),i=VT(t),r=KT(t),o=HT(t),s=qT(t);let a;a=0!==s?UT(t,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),e.info.codecDescription=l,e.info.numberOfChannels=n}break;case"dfLa":{var X;const e=this.currentTrack;if(!e)break;c_("audio"===(null===(X=e.info)||void 0===X?void 0:X.type)),t.skip(4);const n=127,i=128,r=t.filePos;for(;t.filePos<W;){const r=qT(t),o=GT(t);if((r&n)===nT.STREAMINFO){t.skip(10);const n=KT(t),i=n>>>12,r=1+(n>>9&7);e.info.sampleRate=i,e.info.numberOfChannels=r,t.skip(20)}else t.skip(o);if(r&i)break}const o=t.filePos;t.filePos=r;const s=UT(t,o-r),a=new Uint8Array(4+s.byteLength);new DataView(a.buffer).setUint32(0,1716281667,!1),a.set(s,4),e.info.codecDescription=a}break;case"dac3":{var Y;const e=this.currentTrack;if(!e)break;c_("audio"===(null===(Y=e.info)||void 0===Y?void 0:Y.type));const n=UT(t,3),i=new L_(n),r=i.readBits(2);i.skipBits(8);const o=i.readBits(3),s=i.readBits(1);r<3&&(e.info.sampleRate=G_[r]),e.info.numberOfChannels=iT[o]+s}break;case"dec3":{var Q;const e=this.currentTrack;if(!e)break;c_("audio"===(null===(Q=e.info)||void 0===Q?void 0:Q.type));const n=(t=>{if(t.length<2)return null;const e=new L_(t),n=e.readBits(13),i=e.readBits(3),r=[];for(let n=0;n<=i&&!(Math.ceil(e.pos/8)+3>t.length);n++){const t=e.readBits(2),n=e.readBits(5);e.skipBits(1),e.skipBits(1);const i=e.readBits(3),o=e.readBits(3),s=e.readBits(1);e.skipBits(3);const a=e.readBits(4);let l=0;a>0?l=e.readBits(9):e.skipBits(1),r.push({fscod:t,fscod2:null,bsid:n,bsmod:i,acmod:o,lfeon:s,numDepSub:a,chanLoc:l})}return 0===r.length?null:{dataRate:n,substreams:r}})(UT(t,B.contentSize));if(!n){console.warn("Invalid dec3 box contents, ignoring.");break}const i=(t=>{const e=t.substreams[0];return c_(e),e.fscod<3?G_[e.fscod]:null!==e.fscod2&&e.fscod2<3?H_[e.fscod2]:null})(n);null!==i&&(e.info.sampleRate=i),e.info.numberOfChannels=(t=>{const e=t.substreams[0];c_(e);let n=iT[e.acmod]+e.lfeon;if(e.numDepSub>0){const t=[2,2,1,1,2,2,2,1,1];for(let i=0;i<9;i++)e.chanLoc&1<<8-i&&(n+=t[i])}return n})(n)}break;case"stts":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4);const n=KT(t);let i=0,r=0;for(let o=0;o<n;o++){const n=KT(t),o=KT(t);e.sampleTable.sampleTimingEntries.push({startIndex:i,startDecodeTimestamp:r,count:n,delta:o}),i+=n,r+=n*o}}break;case"ctts":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4);const n=KT(t);let i=0;for(let r=0;r<n;r++){const n=KT(t),r=XT(t);e.sampleTable.sampleCompositionTimeOffsets.push({startIndex:i,count:n,offset:r}),i+=n}}break;case"stsz":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4);const n=KT(t),i=KT(t);if(0===n)for(let n=0;n<i;n++){const n=KT(t);e.sampleTable.sampleSizes.push(n)}else e.sampleTable.sampleSizes.push(n)}break;case"stz2":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4),t.skip(3);const n=qT(t),i=KT(t),r=UT(t,Math.ceil(i*n/8)),o=new L_(r);for(let t=0;t<i;t++){const t=o.readBits(n);e.sampleTable.sampleSizes.push(t)}}break;case"stss":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4),e.sampleTable.keySampleIndices=[];const n=KT(t);for(let i=0;i<n;i++){const n=KT(t)-1;e.sampleTable.keySampleIndices.push(n)}0!==e.sampleTable.keySampleIndices[0]&&e.sampleTable.keySampleIndices.unshift(0)}break;case"stsc":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4);const n=KT(t);for(let i=0;i<n;i++){const n=KT(t)-1,i=KT(t),r=KT(t);e.sampleTable.sampleToChunk.push({startSampleIndex:-1,startChunkIndex:n,samplesPerChunk:i,sampleDescriptionIndex:r})}let i=0;for(let t=0;t<e.sampleTable.sampleToChunk.length;t++)e.sampleTable.sampleToChunk[t].startSampleIndex=i,t<e.sampleTable.sampleToChunk.length-1&&(i+=(e.sampleTable.sampleToChunk[t+1].startChunkIndex-e.sampleTable.sampleToChunk[t].startChunkIndex)*e.sampleTable.sampleToChunk[t].samplesPerChunk)}break;case"stco":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4);const n=KT(t);for(let i=0;i<n;i++){const n=KT(t);e.sampleTable.chunkOffsets.push(n)}}break;case"co64":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4);const n=KT(t);for(let i=0;i<n;i++){const n=YT(t);e.sampleTable.chunkOffsets.push(n)}}break;case"mvex":this.isFragmented=!0,this.readContiguousBoxes(t.slice(z,B.contentSize));break;case"mehd":{const e=qT(t);t.skip(3);const n=1===e?YT(t):KT(t);this.movieDurationInTimescale=n}break;case"trex":{t.skip(4);const e=KT(t),n=KT(t),i=KT(t),r=KT(t),o=KT(t);this.fragmentTrackDefaults.push({trackId:e,defaultSampleDescriptionIndex:n,defaultSampleDuration:i,defaultSampleSize:r,defaultSampleFlags:o})}break;case"tfra":{const e=qT(t);t.skip(3);const n=KT(t),i=this.tracks.find((t=>t.id===n));if(!i)break;const r=KT(t),o=(12&r)>>2,s=3&r,a=[qT,VT,GT,KT],l=a[(48&r)>>4],c=a[o],u=a[s],d=KT(t);for(let n=0;n<d;n++){const n=1===e?YT(t):KT(t),r=1===e?YT(t):KT(t);l(t),c(t),u(t),i.fragmentLookupTable.push({timestamp:n,moofOffset:r})}i.fragmentLookupTable.sort(((t,e)=>t.timestamp-e.timestamp));for(let t=0;t<i.fragmentLookupTable.length-1;t++){const e=i.fragmentLookupTable[t],n=i.fragmentLookupTable[t+1];e.timestamp===n.timestamp&&(i.fragmentLookupTable.splice(t+1,1),t--)}}break;case"moof":this.currentFragment={moofOffset:L,moofSize:B.totalSize,implicitBaseDataOffset:L,trackData:new Map},this.readContiguousBoxes(t.slice(z,B.contentSize)),this.lastReadFragment=this.currentFragment,this.currentFragment=null;break;case"traf":if(c_(this.currentFragment),this.readContiguousBoxes(t.slice(z,B.contentSize)),this.currentTrack){const t=this.currentFragment.trackData.get(this.currentTrack.id);if(t){const{currentFragmentState:e}=this.currentTrack;c_(e),null!==e.startTimestamp&&(MT(t,e.startTimestamp),t.startTimestampIsFinal=!0)}this.currentTrack.currentFragmentState=null,this.currentTrack=null}break;case"tfhd":{var J,Z,tt,et;c_(this.currentFragment),t.skip(1);const e=GT(t),n=Boolean(1&e),i=Boolean(2&e),r=Boolean(8&e),o=Boolean(16&e),s=Boolean(32&e),a=Boolean(65536&e),l=Boolean(131072&e),c=KT(t),u=this.tracks.find((t=>t.id===c));if(!u)break;const d=this.fragmentTrackDefaults.find((t=>t.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!==(tt=null==d?void 0:d.defaultSampleSize)&&void 0!==tt?tt:null,defaultSampleFlags:null!==(et=null==d?void 0:d.defaultSampleFlags)&&void 0!==et?et:null,startTimestamp:null},n?u.currentFragmentState.baseDataOffset=YT(t):l&&(u.currentFragmentState.baseDataOffset=this.currentFragment.moofOffset),i&&(u.currentFragmentState.sampleDescriptionIndex=KT(t)),r&&(u.currentFragmentState.defaultSampleDuration=KT(t)),o&&(u.currentFragmentState.defaultSampleSize=KT(t)),s&&(u.currentFragmentState.defaultSampleFlags=KT(t)),a&&(u.currentFragmentState.defaultSampleDuration=0)}break;case"tfdt":{const e=this.currentTrack;if(!e)break;c_(e.currentFragmentState);const n=qT(t);t.skip(3);const i=0===n?KT(t):YT(t);e.currentFragmentState.startTimestamp=i}break;case"trun":{const e=this.currentTrack;if(!e)break;if(c_(this.currentFragment),c_(e.currentFragmentState),this.currentFragment.trackData.has(e.id)){console.warn("Can't have two trun boxes for the same track in one fragment. Ignoring...");break}const n=qT(t),i=GT(t),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=KT(t);let d=e.currentFragmentState.baseDataOffset;r&&(d+=XT(t));let h=null;o&&(h=KT(t));let f=d;if(0===u){this.currentFragment.implicitBaseDataOffset=f;break}let p=0;const m={track:e,startTimestamp:0,endTimestamp:0,firstKeyFrameTimestamp:null,samples:[],presentationTimestamps:[],startTimestampIsFinal:!1};this.currentFragment.trackData.set(e.id,m);for(let i=0;i<u;i++){let r,o,u;s?r=KT(t):(c_(null!==e.currentFragmentState.defaultSampleDuration),r=e.currentFragmentState.defaultSampleDuration),a?o=KT(t):(c_(null!==e.currentFragmentState.defaultSampleSize),o=e.currentFragmentState.defaultSampleSize),l?u=KT(t):(c_(null!==e.currentFragmentState.defaultSampleFlags),u=e.currentFragmentState.defaultSampleFlags),0===i&&null!==h&&(u=h);let d=0;c&&(d=0===n?KT(t):XT(t));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(((t,e)=>({presentationTimestamp:t.presentationTimestamp,sampleIndex:e}))).sort(((t,e)=>t.presentationTimestamp-e.presentationTimestamp));for(let t=0;t<m.presentationTimestamps.length;t++){const e=m.presentationTimestamps[t],n=m.samples[e.sampleIndex];if(null===m.firstKeyFrameTimestamp&&n.isKeyFrame&&(m.firstKeyFrameTimestamp=n.presentationTimestamp),t<m.presentationTimestamps.length-1){const i=m.presentationTimestamps[t+1];n.duration=i.presentationTimestamp-e.presentationTimestamp}}const v=m.samples[m.presentationTimestamps[0].sampleIndex],g=m.samples[u_(m.presentationTimestamps).sampleIndex];m.startTimestamp=v.presentationTimestamp,m.endTimestamp=g.presentationTimestamp+g.duration,this.currentFragment.implicitBaseDataOffset=f}break;case"udta":{const g=this.iterateContiguousBoxes(t.slice(z,B.contentSize));for(const{boxInfo:t,slice:y}of g){if("meta"!==t.name&&!this.currentTrack){var nt,it,rt,ot,st,at,lt,ct;const e=y.filePos;null!==(it=(nt=this.metadataTags).raw)&&void 0!==it||(nt.raw={}),"©"===t.name[0]?null!==(st=(rt=this.metadataTags.raw)[ot=t.name])&&void 0!==st||(rt[ot]=kT(y)):null!==(ct=(at=this.metadataTags.raw)[lt=t.name])&&void 0!==ct||(at[lt]=UT(y,t.contentSize)),y.filePos=e}switch(t.name){case"meta":y.skip(-t.headerSize),this.traverseBox(y);break;case"©nam":case"name":this.currentTrack?this.currentTrack.name=p_.decode(UT(y,t.contentSize)):null!==(n=(e=this.metadataTags).title)&&void 0!==n||(e.title=kT(y));break;case"©des":this.currentTrack||null!==(r=(i=this.metadataTags).description)&&void 0!==r||(i.description=kT(y));break;case"©ART":this.currentTrack||null!==(s=(o=this.metadataTags).artist)&&void 0!==s||(o.artist=kT(y));break;case"©alb":this.currentTrack||null!==(l=(a=this.metadataTags).album)&&void 0!==l||(a.album=kT(y));break;case"albr":this.currentTrack||null!==(u=(c=this.metadataTags).albumArtist)&&void 0!==u||(c.albumArtist=kT(y));break;case"©gen":this.currentTrack||null!==(h=(d=this.metadataTags).genre)&&void 0!==h||(d.genre=kT(y));break;case"©day":if(!this.currentTrack){var ut,dt;const t=new Date(kT(y));Number.isNaN(t.getTime())||null!==(dt=(ut=this.metadataTags).date)&&void 0!==dt||(ut.date=t)}break;case"©cmt":this.currentTrack||null!==(p=(f=this.metadataTags).comment)&&void 0!==p||(f.comment=kT(y));break;case"©lyr":this.currentTrack||null!==(v=(m=this.metadataTags).lyrics)&&void 0!==v||(m.lyrics=kT(y))}}}break;case"meta":{if(this.currentTrack)break;const e=0!==KT(t);this.currentMetadataKeys=new Map,e?this.readContiguousBoxes(t.slice(z,B.contentSize)):this.readContiguousBoxes(t.slice(z+4,B.contentSize-4)),this.currentMetadataKeys=null}break;case"keys":{if(!this.currentMetadataKeys)break;t.skip(4);const e=KT(t);for(let n=0;n<e;n++){const e=KT(t);t.skip(4);const i=p_.decode(UT(t,e-8));this.currentMetadataKeys.set(n+1,i)}}break;case"ilst":{if(!this.currentMetadataKeys)break;const e=this.iterateContiguousBoxes(t.slice(z,B.contentSize));for(const{boxInfo:t,slice:n}of e){var ht,ft,pt,mt,vt;let e=t.name;const i=(e.charCodeAt(0)<<24)+(e.charCodeAt(1)<<16)+(e.charCodeAt(2)<<8)+e.charCodeAt(3);this.currentMetadataKeys.has(i)&&(e=this.currentMetadataKeys.get(i));const r=wT(n);switch(null!==(ft=(ht=this.metadataTags).raw)&&void 0!==ft||(ht.raw={}),null!==(vt=(pt=this.metadataTags.raw)[mt=e])&&void 0!==vt||(pt[mt]=r),e){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!==(I=(E=this.metadataTags).albumArtist)&&void 0!==I||(E.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 gt,yt;const t=new Date(r);Number.isNaN(t.getTime())||null!==(yt=(gt=this.metadataTags).date)&&void 0!==yt||(gt.date=t)}break;case"covr":case"com.apple.quicktime.artwork":r instanceof R_?(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 bt,kt,wt,xt;const t=r.split("/"),e=Number.parseInt(t[0],10),n=t[1]&&Number.parseInt(t[1],10);Number.isInteger(e)&&e>0&&(null!==(kt=(bt=this.metadataTags).trackNumber)&&void 0!==kt||(bt.trackNumber=e)),n&&Number.isInteger(n)&&n>0&&(null!==(xt=(wt=this.metadataTags).tracksTotal)&&void 0!==xt||(wt.tracksTotal=n))}break;case"trkn":if(r instanceof Uint8Array&&r.length>=6){var _t,Tt,Et,It;const t=f_(r),e=t.getUint16(2,!1),n=t.getUint16(4,!1);e>0&&(null!==(Tt=(_t=this.metadataTags).trackNumber)&&void 0!==Tt||(_t.trackNumber=e)),n>0&&(null!==(It=(Et=this.metadataTags).tracksTotal)&&void 0!==It||(Et.tracksTotal=n))}break;case"disc":case"disk":if(r instanceof Uint8Array&&r.length>=6){var St,At,Nt,Mt;const t=f_(r),e=t.getUint16(2,!1),n=t.getUint16(4,!1);e>0&&(null!==(At=(St=this.metadataTags).discNumber)&&void 0!==At||(St.discNumber=e)),n>0&&(null!==(Mt=(Nt=this.metadataTags).discsTotal)&&void 0!==Mt||(Nt.discsTotal=n))}}}}}var Ft,Ct;return t.filePos=W,!0}}class _T{constructor(t){this.internalTrack=t,this.packetToSampleIndex=new WeakMap,this.packetToFragmentLocation=new WeakMap}getId(){return this.internalTrack.id}getNumber(){const t=this.internalTrack.demuxer,e=this.internalTrack.inputTrack.type;let n=0;for(const i of t.tracks)if(i.inputTrack.type===e&&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 t,e;const n=await this.getPacket(1/0,{metadataOnly:!0});return(null!==(t=null==n?void 0:n.timestamp)&&void 0!==t?t:0)+(null!==(e=null==n?void 0:n.duration)&&void 0!==e?e:0)}async getFirstTimestamp(){var t;const e=await this.getFirstPacket({metadataOnly:!0});return null!==(t=null==e?void 0:e.timestamp)&&void 0!==t?t:0}async getFirstPacket(t){const e=await this.fetchPacketForSampleIndex(0,t);return e||!this.internalTrack.demuxer.isFragmented?e:this.performFragmentedLookup(null,(t=>t.trackData.get(this.internalTrack.id)?{sampleIndex:0,correctSampleFound:!0}:{sampleIndex:-1,correctSampleFound:!1}),-1/0,1/0,t)}mapTimestampIntoTimescale(t){return(t=>{const e=Math.round(t);return Math.abs(t/e-1)<10*Number.EPSILON?e:t})(t*this.internalTrack.timescale)+this.internalTrack.editListOffset}async getPacket(t,e){const n=this.mapTimestampIntoTimescale(t),i=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),r=IT(i,n),o=await this.fetchPacketForSampleIndex(r,e);return CT(i)&&this.internalTrack.demuxer.isFragmented?this.performFragmentedLookup(null,(t=>{const e=t.trackData.get(this.internalTrack.id);if(!e)return{sampleIndex:-1,correctSampleFound:!1};const i=E_(e.presentationTimestamps,n,(t=>t.presentationTimestamp));return{sampleIndex:-1!==i?e.presentationTimestamps[i].sampleIndex:-1,correctSampleFound:-1!==i&&n<e.endTimestamp}}),n,n,e):o}async getNextPacket(t,e){const n=this.packetToSampleIndex.get(t);if(void 0!==n)return this.fetchPacketForSampleIndex(n+1,e);const i=this.packetToFragmentLocation.get(t);if(void 0===i)throw new Error("Packet was not created from this track.");return this.performFragmentedLookup(i.fragment,(t=>{if(t===i.fragment){const e=t.trackData.get(this.internalTrack.id);if(i.sampleIndex+1<e.samples.length)return{sampleIndex:i.sampleIndex+1,correctSampleFound:!0}}else if(t.trackData.get(this.internalTrack.id))return{sampleIndex:0,correctSampleFound:!0};return{sampleIndex:-1,correctSampleFound:!1}}),-1/0,1/0,e)}async getKeyPacket(t,e){const n=this.mapTimestampIntoTimescale(t),i=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),r=ST(i,n),o=await this.fetchPacketForSampleIndex(r,e);return CT(i)&&this.internalTrack.demuxer.isFragmented?this.performFragmentedLookup(null,(t=>{const e=t.trackData.get(this.internalTrack.id);if(!e)return{sampleIndex:-1,correctSampleFound:!1};const i=((t,e)=>{for(let n=t.length-1;n>=0;n--)if(e(t[n]))return n;return-1})(e.presentationTimestamps,(t=>e.samples[t.sampleIndex].isKeyFrame&&t.presentationTimestamp<=n));return{sampleIndex:-1!==i?e.presentationTimestamps[i].sampleIndex:-1,correctSampleFound:-1!==i&&n<e.endTimestamp}}),n,n,e):o}async getNextKeyPacket(t,e){const n=this.packetToSampleIndex.get(t);if(void 0!==n){const t=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),i=NT(t,n);return this.fetchPacketForSampleIndex(i,e)}const i=this.packetToFragmentLocation.get(t);if(void 0===i)throw new Error("Packet was not created from this track.");return this.performFragmentedLookup(i.fragment,(t=>{if(t===i.fragment){const e=t.trackData.get(this.internalTrack.id).samples.findIndex(((t,e)=>t.isKeyFrame&&e>i.sampleIndex));if(-1!==e)return{sampleIndex:e,correctSampleFound:!0}}else{const e=t.trackData.get(this.internalTrack.id);if(e&&null!==e.firstKeyFrameTimestamp){const t=e.samples.findIndex((t=>t.isKeyFrame));return c_(-1!==t),{sampleIndex:t,correctSampleFound:!0}}}return{sampleIndex:-1,correctSampleFound:!1}}),-1/0,1/0,e)}async fetchPacketForSampleIndex(t,e){if(-1===t)return null;const n=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),i=AT(n,t);if(!i)return null;let r;if(e.metadataOnly)r=aT;else{let t=this.internalTrack.demuxer.reader.requestSlice(i.sampleOffset,i.sampleSize);t instanceof Promise&&(t=await t),c_(t),r=UT(t,i.sampleSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new lT(r,i.isKeyFrame?"key":"delta",o,s,t,i.sampleSize);return this.packetToSampleIndex.set(a,t),a}async fetchPacketInFragment(t,e,n){if(-1===e)return null;const i=t.trackData.get(this.internalTrack.id).samples[e];let r;if(c_(i),n.metadataOnly)r=aT;else{let t=this.internalTrack.demuxer.reader.requestSlice(i.byteOffset,i.byteSize);t instanceof Promise&&(t=await t),c_(t),r=UT(t,i.byteSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new lT(r,i.isKeyFrame?"key":"delta",o,s,t.moofOffset+e,i.byteSize);return this.packetToFragmentLocation.set(a,{fragment:t,sampleIndex:e}),a}async performFragmentedLookup(t,e,n,i,r){var o,s;const a=this.internalTrack.demuxer;let l=null,c=null,u=-1;if(t){const{sampleIndex:n,correctSampleFound:i}=e(t);if(i)return this.fetchPacketInFragment(t,n,r);-1!==n&&(c=t,u=n)}const d=E_(this.internalTrack.fragmentLookupTable,n,(t=>t.timestamp)),h=-1!==d?this.internalTrack.fragmentLookupTable[d]:null,f=E_(this.internalTrack.fragmentPositionCache,n,(t=>t.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(t?null===m||t.moofOffset>=m?(v=t.moofOffset+t.moofSize,l=t):v=m:v=null!=m?m:0;;){if(l){const t=l.trackData.get(this.internalTrack.id);if(t&&t.startTimestamp>i)break}let t=a.reader.requestSliceRange(v,8,16);if(t instanceof Promise&&(t=await t),!t)break;const n=v,o=vT(t);if(!o)break;if("moof"===o.name){l=await a.readFragment(n);const{sampleIndex:t,correctSampleFound:i}=e(l);if(i)return this.fetchPacketInFragment(l,t,r);-1!==t&&(c=l,u=t)}v=n+o.totalSize}if(h&&(!c||c.moofOffset<h.moofOffset)){var g;const t=this.internalTrack.fragmentLookupTable[d-1];c_(!t||t.timestamp<h.timestamp);const n=null!==(g=null==t?void 0:t.timestamp)&&void 0!==g?g:-1/0;return this.performFragmentedLookup(null,e,n,i,r)}return c?this.fetchPacketInFragment(c,u,r):null}}class TT extends _T{constructor(t){super(t),this.decoderConfigPromise=null,this.internalTrack=t}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 t,e,n,i;return{primaries:null===(t=this.internalTrack.info.colorSpace)||void 0===t?void 0:t.primaries,transfer:null===(e=this.internalTrack.info.colorSpace)||void 0===e?void 0:e.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 t;return this.internalTrack.info.codec?null!==(t=this.decoderConfigPromise)&&void 0!==t?t:this.decoderConfigPromise=(async(t,e)=>{if("vp9"!==this.internalTrack.info.codec||this.internalTrack.info.vp9CodecInfo){if("av1"===this.internalTrack.info.codec&&!this.internalTrack.info.av1CodecInfo){const t=await this.getFirstPacket({});this.internalTrack.info.av1CodecInfo=t&&(t=>{for(const{type:e,data:n}of eT(t)){if(1!==e)continue;const t=new L_(n),i=t.readBits(3);t.readBits(1);const r=t.readBits(1);let o=0,s=0,a=0;if(r)o=t.readBits(5);else{if(t.readBits(1)&&(t.skipBits(32),t.skipBits(32),t.readBits(1)))return null;const e=t.readBits(1);e&&(a=t.readBits(5),t.skipBits(32),t.skipBits(5),t.skipBits(5));const n=t.readBits(5);for(let i=0;i<=n;i++){t.skipBits(12);const n=t.readBits(5);if(0===i&&(o=n),n>7){const e=t.readBits(1);0===i&&(s=e)}if(e&&t.readBits(1)){const e=a+1;t.skipBits(e),t.skipBits(e),t.skipBits(1)}t.readBits(1)&&t.skipBits(4)}}const l=t.readBits(4),c=t.readBits(4),u=l+1;t.skipBits(u);const d=c+1;t.skipBits(d);let h=0;if(h=r?0:t.readBits(1),h&&(t.skipBits(4),t.skipBits(3)),t.skipBits(1),t.skipBits(1),t.skipBits(1),!r){t.skipBits(1),t.skipBits(1),t.skipBits(1),t.skipBits(1);const e=t.readBits(1);e&&(t.skipBits(1),t.skipBits(1));let n=0;n=t.readBits(1)?2:t.readBits(1),n>0&&(t.readBits(1)||t.skipBits(1)),e&&t.skipBits(3)}t.skipBits(1),t.skipBits(1),t.skipBits(1);const f=t.readBits(1);let p=8;2===i&&f?p=t.readBits(1)?12:10:i<=2&&(p=f?10:8);let m=0;1!==i&&(m=t.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=t.readBits(1),v&&(g=t.readBits(1))),v&&g&&(y=t.readBits(2))),{profile:i,level:o,tier:s,bitDepth:p,monochrome:m,chromaSubsamplingX:v,chromaSubsamplingY:g,chromaSamplePosition:y}}return null})(t.data)}}else{const t=await this.getFirstPacket({});this.internalTrack.info.vp9CodecInfo=t&&(t=>{const e=new L_(t);if(2!==e.readBits(2))return null;const n=e.readBits(1),i=(e.readBits(1)<<1)+n;if(3===i&&e.skipBits(1),1===e.readBits(1))return null;if(0!==e.readBits(1))return null;if(e.skipBits(2),4817730!==e.readBits(24))return null;let r=8;i>=2&&(r=e.readBits(1)?12:10);const o=e.readBits(3);let s=0,a=0;if(7!==o)if(a=e.readBits(1),1===i||3===i){const t=e.readBits(1),n=e.readBits(1);s=t||n?t&&!n?2:1:3,e.skipBits(1)}else s=1;else s=3,a=1;const l=(e.readBits(16)+1)*(e.readBits(16)+1);let c=u_(j_).level;for(const t of j_)if(l<=t.maxPictureSize){c=t.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}})(t.data)}return{codec:U_(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!==(t=this.internalTrack.info.codecDescription)&&void 0!==t?t:void 0,colorSpace:null!==(e=this.internalTrack.info.colorSpace)&&void 0!==e?e:void 0}})():null}}class ET extends _T{constructor(t){super(t),this.decoderConfig=null,this.internalTrack=t}getCodec(){return this.internalTrack.info.codec}getNumberOfChannels(){return this.internalTrack.info.numberOfChannels}getSampleRate(){return this.internalTrack.info.sampleRate}async getDecoderConfig(){var t,e;return this.internalTrack.info.codec?null!==(t=this.decoderConfig)&&void 0!==t?t:this.decoderConfig={codec:q_(this.internalTrack.info),numberOfChannels:this.internalTrack.info.numberOfChannels,sampleRate:this.internalTrack.info.sampleRate,description:null!==(e=this.internalTrack.info.codecDescription)&&void 0!==e?e:void 0}:null}}const IT=(t,e)=>{if(t.presentationTimestamps){const n=E_(t.presentationTimestamps,e,(t=>t.presentationTimestamp));return-1===n?-1:t.presentationTimestamps[n].sampleIndex}{const n=E_(t.sampleTimingEntries,e,(t=>t.startDecodeTimestamp));if(-1===n)return-1;const i=t.sampleTimingEntries[n];return i.startIndex+Math.min(Math.floor((e-i.startDecodeTimestamp)/i.delta),i.count-1)}},ST=(t,e)=>{if(!t.keySampleIndices)return IT(t,e);if(t.presentationTimestamps){const n=E_(t.presentationTimestamps,e,(t=>t.presentationTimestamp));if(-1===n)return-1;for(let e=n;e>=0;e--){const n=t.presentationTimestamps[e].sampleIndex;if(-1!==T_(t.keySampleIndices,n,(t=>t)))return n}return-1}{var n;const i=IT(t,e),r=E_(t.keySampleIndices,i,(t=>t));return null!==(n=t.keySampleIndices[r])&&void 0!==n?n:-1}},AT=(t,e)=>{const n=E_(t.sampleTimingEntries,e,(t=>t.startIndex)),i=t.sampleTimingEntries[n];if(!i||i.startIndex+i.count<=e)return null;let r=i.startDecodeTimestamp+(e-i.startIndex)*i.delta;const o=E_(t.sampleCompositionTimeOffsets,e,(t=>t.startIndex)),s=t.sampleCompositionTimeOffsets[o];s&&e-s.startIndex<s.count&&(r+=s.offset);const a=t.sampleSizes[Math.min(e,t.sampleSizes.length-1)],l=E_(t.sampleToChunk,e,(t=>t.startSampleIndex)),c=t.sampleToChunk[l];c_(c);const u=c.startChunkIndex+Math.floor((e-c.startSampleIndex)/c.samplesPerChunk),d=t.chunkOffsets[u],h=c.startSampleIndex+(u-c.startChunkIndex)*c.samplesPerChunk;let f=0,p=d;if(1===t.sampleSizes.length)p+=a*(e-h),f+=a*c.samplesPerChunk;else for(let n=h;n<h+c.samplesPerChunk;n++){const i=t.sampleSizes[n];n<e&&(p+=i),f+=i}let m=i.delta;if(t.presentationTimestamps){const n=t.presentationTimestampIndexMap[e];c_(void 0!==n),n<t.presentationTimestamps.length-1&&(m=t.presentationTimestamps[n+1].presentationTimestamp-r)}return{presentationTimestamp:r,duration:m,sampleOffset:p,sampleSize:a,chunkOffset:d,chunkSize:f,isKeyFrame:!t.keySampleIndices||-1!==T_(t.keySampleIndices,e,(t=>t))}},NT=(t,e)=>{var n;if(!t.keySampleIndices)return e+1;const i=E_(t.keySampleIndices,e,(t=>t));return null!==(n=t.keySampleIndices[i+1])&&void 0!==n?n:-1},MT=(t,e)=>{t.startTimestamp+=e,t.endTimestamp+=e;for(const n of t.samples)n.presentationTimestamp+=e;for(const n of t.presentationTimestamps)n.presentationTimestamp+=e},FT=t=>{const[e,,,n]=t,i=Math.hypot(e,n),r=e/i,o=n/i,s=-Math.atan2(o,r)*(180/Math.PI);return Number.isFinite(s)?s:0},CT=t=>0===t.sampleSizes.length;class OT{}class PT extends OT{async _getMajorBrand(t){let e=t._reader.requestSlice(0,12);return e instanceof Promise&&(e=await e),e?(e.skip(4),"ftyp"!==ZT(e,4)?null:ZT(e,4)):null}_createDemuxer(t){return new xT(t)}}const RT=new class extends PT{async _canReadInput(t){const e=await this._getMajorBrand(t);return!!e&&"qt "!==e}get name(){return"MP4"}get mimeType(){return"video/mp4"}};class DT{constructor(){this._disposed=!1,this._sizePromise=null,this.onread=null}async getSizeOrNull(){var t;if(this._disposed)throw new zT;return null!==(t=this._sizePromise)&&void 0!==t?t:this._sizePromise=Promise.resolve(this._retrieveSize())}async getSize(){if(this._disposed)throw new zT;const t=await this.getSizeOrNull();if(null===t)throw new Error("Cannot determine the size of an unsized source.");return t}}class LT extends DT{constructor(t,e={}){var n;if(!(t instanceof ReadableStream))throw new TypeError("stream must be a ReadableStream.");if(!e||"object"!=typeof e)throw new TypeError("options must be an object.");if(void 0!==e.maxCacheSize&&(!P_(e.maxCacheSize)||e.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=t,this._maxCacheSize=null!==(n=e.maxCacheSize)&&void 0!==n?n:16777216}_retrieveSize(){return this._endIndex}_read(t,e){if(null!==this._endIndex&&e>this._endIndex)return null;this._maxRequestedIndex=Math.max(this._maxRequestedIndex,e);const n=E_(this._cache,t,(t=>t.start)),i=-1!==n?this._cache[n]:null;if(i&&i.start<=t&&e<=i.end)return{bytes:i.bytes,view:i.view,offset:i.start};let r=t;const o=new Uint8Array(e-t);if(-1!==n)for(let i=n;i<this._cache.length;i++){const n=this._cache[i];if(n.start>=e)break;const s=Math.max(t,n.start);s>r&&this._throwDueToCacheMiss();const a=Math.min(e,n.end);s<a&&(o.set(n.bytes.subarray(s-n.start,a-n.start),s-t),r=a)}if(r===e)return{bytes:o,view:f_(o),offset:t};this._currentIndex>r&&this._throwDueToCacheMiss();const{promise:s,resolve:a,reject:l}=I_();return this._pendingSlices.push({start:t,end:e,bytes:o,resolve:a,reject:l}),this._targetIndex=Math.max(this._targetIndex,e),this._pulling||(this._pulling=!0,this._pull().catch((t=>{if(this._pulling=!1,!(this._pendingSlices.length>0))throw t;this._pendingSlices.forEach((e=>e.reject(t))),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!==(t=this._reader)&&void 0!==t||(this._reader=this._stream.getReader());this._currentIndex<this._targetIndex&&!this._disposed;){var t;const{done:e,value:n}=await this._reader.read();if(e){for(const t of this._pendingSlices)t.resolve(null);this._pendingSlices.length=0,this._endIndex=this._currentIndex;break}const i=this._currentIndex,r=this._currentIndex+n.byteLength;for(let t=0;t<this._pendingSlices.length;t++){const e=this._pendingSlices[t],o=Math.max(i,e.start),s=Math.min(r,e.end);o<s&&(e.bytes.set(n.subarray(o-i,s-i),o-e.start),s===e.end&&(e.resolve({bytes:e.bytes,view:f_(e.bytes),offset:e.start}),this._pendingSlices.splice(t,1),t--))}for(this._cache.push({start:i,end:r,bytes:n,view:f_(n),age:0});this._cache.length>0;){const t=this._cache[0];if(this._maxRequestedIndex-t.end<=this._maxCacheSize)break;this._cache.shift()}this._currentIndex+=n.byteLength}this._pulling=!1}_dispose(){this._pendingSlices.length=0,this._cache.length=0}}null!==(le=Symbol.dispose)&&void 0!==le||(Symbol.dispose=Symbol("Symbol.dispose"));class BT{get disposed(){return this._disposed}constructor(t){if(this._demuxerPromise=null,this._format=null,this._disposed=!1,!t||"object"!=typeof t)throw new TypeError("options must be an object.");if(!Array.isArray(t.formats)||t.formats.some((t=>!(t instanceof OT))))throw new TypeError("options.formats must be an array of InputFormat.");if(!(t.source instanceof DT))throw new TypeError("options.source must be a Source.");if(t.source._disposed)throw new Error("options.source must not be disposed.");this._formats=t.formats,this._source=t.source,this._reader=new WT(t.source)}_getDemuxer(){var t;return null!==(t=this._demuxerPromise)&&void 0!==t?t:this._demuxerPromise=(async()=>{this._reader.fileSize=await this._source.getSizeOrNull();for(const t of this._formats)if(await t._canReadInput(this))return this._format=t,t._createDemuxer(this);throw new Error("Input has an unsupported or unrecognizable format.")})()}get source(){return this._source}async getFormat(){return await this._getDemuxer(),c_(this._format),this._format}async computeDuration(){return(await this._getDemuxer()).computeDuration()}async getFirstTimestamp(){const t=await this.getTracks();if(0===t.length)return 0;const e=await Promise.all(t.map((t=>t.getFirstTimestamp())));return Math.min(...e)}async getTracks(){return(await this._getDemuxer()).getTracks()}async getVideoTracks(){return(await this.getTracks()).filter((t=>t.isVideoTrack()))}async getAudioTracks(){return(await this.getTracks()).filter((t=>t.isAudioTrack()))}async getPrimaryVideoTrack(){var t;return null!==(t=(await this.getTracks()).find((t=>t.isVideoTrack())))&&void 0!==t?t:null}async getPrimaryAudioTrack(){var t;return null!==(t=(await this.getTracks()).find((t=>t.isAudioTrack())))&&void 0!==t?t: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 zT extends Error{constructor(t="Input has been disposed."){super(t),this.name="InputDisposedError"}}class WT{constructor(t){this.source=t}requestSlice(t,e){if(this.source._disposed)throw new zT;if(t<0)return null;if(null!==this.fileSize&&t+e>this.fileSize)return null;const n=t+e,i=this.source._read(t,n);return i instanceof Promise?i.then((e=>e?new $T(e.bytes,e.view,e.offset,t,n):null)):i?new $T(i.bytes,i.view,i.offset,t,n):null}requestSliceRange(t,e,n){if(this.source._disposed)throw new zT;if(t<0)return null;if(null!==this.fileSize)return this.requestSlice(t,A_(this.fileSize-t,e,n));{const i=this.requestSlice(t,n),r=i=>{if(i)return i;const r=i=>(c_(null!==i),this.requestSlice(t,A_(i-t,e,n))),o=this.source._retrieveSize();return o instanceof Promise?o.then(r):r(o)};return i instanceof Promise?i.then(r):r(i)}}}class $T{constructor(t,e,n,i,r){this.bytes=t,this.view=e,this.offset=n,this.start=i,this.end=r,this.bufferPos=i-n}static tempFromBytes(t){return new $T(t,f_(t),0,0,t.length)}get length(){return this.end-this.start}get filePos(){return this.offset+this.bufferPos}set filePos(t){this.bufferPos=t-this.offset}get remainingLength(){return Math.max(this.end-this.filePos,0)}skip(t){this.bufferPos+=t}slice(t,e=this.end-t){if(t<this.start||t+e>this.end)throw new RangeError("Slicing outside of original slice.");return new $T(this.bytes,this.view,this.offset,t,t+e)}}const jT=(t,e)=>{if(t.filePos<t.start||t.filePos+e>t.end)throw new RangeError(`Tried reading [${t.filePos}, ${t.filePos+e}), but slice is [${t.start}, ${t.end}). This is likely an internal error, please report it alongside the file that caused it.`)},UT=(t,e)=>{jT(t,e);const n=t.bytes.subarray(t.bufferPos,t.bufferPos+e);return t.bufferPos+=e,n},qT=t=>(jT(t,1),t.view.getUint8(t.bufferPos++)),VT=t=>{jT(t,2);const e=t.view.getUint16(t.bufferPos,!1);return t.bufferPos+=2,e},GT=t=>{jT(t,3);const e=S_(t.view,t.bufferPos);return t.bufferPos+=3,e},HT=t=>{jT(t,2);const e=t.view.getInt16(t.bufferPos,!1);return t.bufferPos+=2,e},KT=t=>{jT(t,4);const e=t.view.getUint32(t.bufferPos,!1);return t.bufferPos+=4,e},XT=t=>{jT(t,4);const e=t.view.getInt32(t.bufferPos,!1);return t.bufferPos+=4,e},YT=t=>4294967296*KT(t)+KT(t),QT=t=>4294967296*XT(t)+KT(t),JT=t=>{jT(t,8);const e=t.view.getFloat64(t.bufferPos,!1);return t.bufferPos+=8,e},ZT=(t,e)=>{jT(t,e);let n="";for(let i=0;i<e;i++)n+=String.fromCharCode(t.bytes[t.bufferPos++]);return n};var tE=new WeakMap,eE=new WeakMap,nE=new WeakMap,iE=new WeakMap,rE=new WeakMap,oE=new WeakMap,sE=new WeakMap,aE=new WeakMap,lE=new WeakMap,cE=new WeakMap,uE=new WeakMap,dE=new WeakMap,hE=new WeakMap,fE=new WeakMap,pE=new WeakMap,mE=new WeakSet;class vE extends sd{constructor(...t){super(...t),O(this,mE),F(this,tE,null),F(this,eE,null),F(this,nE,null),F(this,iE,null),F(this,rE,!1),F(this,oE,!1),F(this,sE,!1),F(this,aE,!1),F(this,lE,void 0),F(this,cE,null),F(this,uE,null),F(this,dE,!1),F(this,hE,!1),F(this,fE,null),F(this,pE,!1)}get name(){return"FMP4Demuxer"}get defaults(){return{}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"pushChunk","endOfStream"])}pushChunk(t,e={}){if(M(sE,this)||M(aE,this))return;const n=t instanceof Uint8Array?t:new Uint8Array(t),i=!!e.isInit;C(cE,this,A(mE,this,xE).call(this,n,e,i)),i&&(C(lE,this,n),C(uE,this,null),this.trigger("demux:init",{data:n})),A(mE,this,wE).call(this);try{var r;const t=null===(r=M(tE,this))||void 0===r?void 0:r.write(n);t&&"function"==typeof t.catch&&t.catch((t=>{A(mE,this,_E).call(this,t)}))}catch(t){if(M(sE,this)||A(mE,this,gE).call(this,t))return;return this.log.warn("[FMP4Demuxer] mediabunny demux failed",t),void A(mE,this,_E).call(this,t)}const o=A(mE,this,IE).call(this);o&&"function"==typeof o.catch&&o.catch((t=>{A(mE,this,_E).call(this,t)}))}endOfStream(){if(M(aE,this))return;if(M(dE,this))return;let t;C(dE,this,!0),C(hE,this,!1),C(pE,this,!1);try{var e;t=null===(e=M(tE,this))||void 0===e?void 0:e.close()}catch(e){t=Promise.resolve()}let n=!1;A(mE,this,bE).call(this),C(fE,this,setTimeout((()=>{C(fE,this,null),n||M(hE,this)||M(aE,this)||A(mE,this,kE).call(this)}),20)),Promise.resolve(t).catch((()=>{})).finally((()=>{n=!0,A(mE,this,bE).call(this),A(mE,this,kE).call(this)}))}onDispose(){super.onDispose(),C(aE,this,!0);try{var t,e;null===(t=M(nE,this))||void 0===t||null===(e=t.close)||void 0===e||e.call(t)}catch(t){}this.endOfStream();try{var n,i;null===(n=M(eE,this))||void 0===n||null===(i=n.dispose)||void 0===i||i.call(n)}catch(t){}C(nE,this,null),C(eE,this,null),C(sE,this,!1),C(cE,this,null),C(iE,this,null),C(rE,this,!1),C(oE,this,!1),C(dE,this,!1),C(hE,this,!1),C(pE,this,!1),A(mE,this,bE).call(this)}}function gE(t){return!!M(aE,this)&&(!t||("InputDisposedError"===(null==t?void 0:t.name)||("string"==typeof(null==t?void 0:t.message)?t.message:"").includes("Input has been disposed")))}function yE(){try{var t,e;const n=null===(t=M(tE,this))||void 0===t||null===(e=t.close)||void 0===e?void 0:e.call(t);n&&"function"==typeof n.catch&&n.catch((()=>{}))}catch(t){}C(tE,this,null)}function bE(){null!==M(fE,this)&&(clearTimeout(M(fE,this)),C(fE,this,null))}function kE(){if(M(hE,this)||M(aE,this)||M(sE,this))return;if(C(hE,this,!0),M(oE,this))return void C(pE,this,!0);C(pE,this,!1);const t=A(mE,this,IE).call(this);t&&"function"==typeof t.catch&&t.catch((t=>{A(mE,this,_E).call(this,t)}))}function wE(){if(M(eE,this)&&M(tE,this))return;const t=cd.TransformStream;if(void 0===t)throw new Error("TransformStream is not available in this environment");const{readable:e,writable:n}=new t;C(tE,this,n.getWriter()),C(eE,this,new BT({source:new LT(e),formats:[RT]})),C(rE,this,!1)}function xE(t,e,n){const i={isInit:n,byteLength:(null==t?void 0:t.byteLength)||0};return"number"==typeof e.loaded&&(i.loaded=e.loaded),"number"==typeof e.total&&(i.total=e.total),"number"==typeof e.pts&&(i.pts=e.pts),"number"==typeof e.dts&&(i.dts=e.dts),"number"==typeof e.duration&&(i.duration=e.duration),"boolean"==typeof e.isKey&&(i.isKey=e.isKey),i}function _E(t){if(M(sE,this)||A(mE,this,gE).call(this,t))return;if(A(mE,this,EE).call(this,t))return void C(rE,this,!1);C(sE,this,!0),A(mE,this,yE).call(this);try{var e,n;null===(e=M(nE,this))||void 0===e||null===(n=e.close)||void 0===n||n.call(e)}catch(t){}C(nE,this,null);try{var i,r;null===(i=M(eE,this))||void 0===i||null===(r=i.dispose)||void 0===r||r.call(i)}catch(t){}C(eE,this,null);const o={error:t,recoverable:!1,severity:"fatal",streamClosed:M(dE,this),streamFinalized:M(hE,this)};M(cE,this)&&(o.context={...M(cE,this)}),this.trigger("demux:error",o)}function TE(t){if(!t)return!1;const e="string"==typeof(null==t?void 0:t.message)?t.message:"";return!!e&&(e.includes("unsupported or unrecognizable format")||e.includes("No supported tracks found"))}function EE(t){return!!A(mE,this,TE).call(this,t)&&(!M(hE,this)||M(pE,this))}async function IE(){if(!(M(aE,this)||M(sE,this)||M(rE,this)||M(oE,this))){C(oE,this,!0);try{A(mE,this,wE).call(this);const t=await M(eE,this).getPrimaryVideoTrack(),e=t?null:await M(eE,this).getPrimaryAudioTrack(),n=t||e;if(!n)throw new Error("No supported tracks found in MP4");const i=await n.getDecoderConfig(),r=await n.getCodecParameterString(),o=await M(eE,this).getMimeType();this.trigger("demux:init",{...M(lE,this)?{data:M(lE,this)}:{},decoderConfig:i,codec:r,mimeType:o}),C(nE,this,new hT(n)),C(rE,this,!0),C(iE,this,(async()=>{try{for await(const t of M(nE,this).packets()){if(M(aE,this))break;const e="number"==typeof t.timestamp?t.timestamp:0;null===M(uE,this)&&C(uE,this,e);let n=e-M(uE,this);n<0&&(n=0),this.trigger("demux:sample",{data:t.data,pts:n,dts:n,duration:t.duration,isKey:"key"===t.type})}this.trigger("demux:complete")}catch(t){A(mE,this,_E).call(this,t)}})())}catch(t){if(A(mE,this,EE).call(this,t))return;throw t}finally{C(oE,this,!1),!M(pE,this)||M(sE,this)||M(aE,this)||A(mE,this,kE).call(this)}}}const SE=1e6,AE=24e3/1001,NE={primaries:"bt709",transfer:"bt709",matrix:"bt709",fullRange:!0},ME=new Uint8Array;function FE(t){return t?t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):ME:ME}let CE=null;const OE={video:(ce=new WeakMap,ue=new WeakMap,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,Ee=new WeakMap,Ie=new WeakMap,Se=new WeakMap,Ae=new WeakMap,Ne=new WeakMap,Me=new WeakMap,Fe=new WeakMap,Ce=new WeakMap,Oe=new WeakMap,Pe=new WeakMap,Re=new WeakMap,De=new WeakMap,Le=new WeakMap,Be=new WeakMap,ze=new WeakMap,We=new WeakMap,$e=new WeakMap,je=new WeakMap,Ue=new WeakSet,class extends l_{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(...t){super(...t),O(this,Ue),F(this,ce,void 0),F(this,ue,[]),F(this,de,void 0),F(this,he,void 0),F(this,fe,void 0),F(this,pe,void 0),F(this,me,[]),F(this,ve,void 0),F(this,ge,new Map),F(this,ye,!0),F(this,be,!1),F(this,ke,!1),F(this,we,!1),F(this,xe,void 0),F(this,_e,!1),F(this,Te,!1),F(this,Ee,0),F(this,Ie,void 0),F(this,Se,void 0),F(this,Ae,{}),F(this,Ne,void 0),F(this,Me,0),F(this,Fe,null),F(this,Ce,!1),F(this,Oe,null),F(this,Pe,void 0),F(this,Re,0),F(this,De,0),F(this,Le,0),F(this,Be,0),F(this,ze,!1),F(this,We,!1),F(this,$e,.2),F(this,je,Promise.resolve()),C(de,this,this.settings.decodedHorizonSeconds||1),C(he,this,A(Ue,this,TI).call(this,this.settings.maxDecodedFrames)),C(fe,this,A(Ue,this,II).call(this,this.settings.maxDecodeQueueSize)),C(ze,this,mv()),C(We,this,A(Ue,this,vI).call(this,this.settings.convertFramesToBitmapsOnAndroid)),C($e,this,A(Ue,this,gI).call(this,this.settings.androidFixEndOfSegmentDelta)),C(pe,this,(()=>0)),C(ve,this,(()=>A(Ue,this,sI).call(this)));const e=this.settings.demuxerOptions?{FMP4Demuxer:this.settings.demuxerOptions}:{};C(ce,this,new vE(e)),M(ce,this).on("demux:init",(t=>A(Ue,this,YE).call(this,t))),M(ce,this).on("demux:sample",(t=>A(Ue,this,QE).call(this,t))),M(ce,this).on("demux:complete",(()=>A(Ue,this,JE).call(this))),M(ce,this).on("demux:error",(t=>A(Ue,this,zE).call(this,t)))}setCurrentTimeProvider(t){"function"==typeof t&&C(pe,this,t)}setTimeOffsetSeconds(t){const e=Number(t);C(Me,this,Number.isFinite(e)?e:0)}setSeekTargetTimeSeconds(t){const e=Number(t);C(Fe,this,Number.isFinite(e)?e:null),C(Ce,this,!1),C(Oe,this,null)}endOfStream(){M(ce,this)&&"function"==typeof M(ce,this).endOfStream&&M(ce,this).endOfStream()}configure(t){super.configure(t),C(Ae,this,{codec:A(Ue,this,FI).call(this,t),width:(null==t?void 0:t.codedWidth)||(null==t?void 0:t.width),height:(null==t?void 0:t.codedHeight)||(null==t?void 0:t.height)}),C(Ie,this,M(Ae,this).codec)}setSegment(t){this.lastSegment=t,A(Ue,this,GE).call(this)}setNodeId(t){C(Pe,this,t)}decode(t){this.setSegment(t);const e=null==t?void 0:t.arrayBuffer;e&&M(ce,this).pushChunk(e,{isInit:!(null==t||!t.isInit)})}async decodeChunk(t,e={}){await M(ce,this).pushChunk(t,{isInit:!!e.isInit,pts:"number"==typeof e.pts?e.pts:void 0,dts:"number"==typeof e.dts?e.dts:void 0,duration:"number"==typeof e.duration?e.duration:void 0,isKey:!!e.isKey,loaded:"number"==typeof e.loaded?e.loaded:void 0,total:"number"==typeof e.total?e.total:void 0})}get decodedFrames(){return M(ue,this).slice()}onDispose(){if(super.onDispose(),A(Ue,this,cI).call(this),M(ce,this)&&"function"==typeof M(ce,this).dispose&&M(ce,this).dispose(),C(ue,this,[]),C(me,this,[]),M(ge,this).clear(),C(Oe,this,null),M(xe,this)&&"function"==typeof M(xe,this).close)try{M(xe,this).close()}catch(t){}C(xe,this,null),C(_e,this,!1),C(Se,this,null),C(Ie,this,null),C(Pe,this,null),C(je,this,Promise.resolve()),A(Ue,this,GE).call(this)}}),audio:(qe=new WeakMap,Ve=new WeakMap,Ge=new WeakMap,He=new WeakMap,Ke=new WeakMap,Xe=new WeakMap,Ye=new WeakMap,Qe=new WeakSet,class extends l_{constructor(...t){super(...t),O(this,Qe),F(this,qe,void 0),F(this,Ve,[]),F(this,Ge,0),F(this,He,!1),F(this,Ke,!1),F(this,Xe,void 0),F(this,Ye,0)}get name(){return"WebAudioDecoder"}setSegment(t){C(Xe,this,t)}setTimeOffsetSeconds(t){const e=Number(t);C(Ye,this,Number.isFinite(e)?e:0)}decode(t){if(this.lastSegment=t,!t)return;if(t.isInit)return void C(qe,this,FE(t.arrayBuffer));const e=t.arrayBuffer;e&&A(Qe,this,DE).call(this,FE(e),!0)}decodeChunk(t,e={}){if(!t)return;if(e.isInit)return void C(qe,this,FE(t));const n=FE(t);if(!n.length)return;M(Ve,this).push(n),C(Ge,this,M(Ge,this)+n.length);const i=Number(e.loaded),r=Number(e.total);Number.isFinite(i)&&Number.isFinite(r)&&r>0&&i>=r&&A(Qe,this,PE).call(this)}endOfStream(){A(Qe,this,PE).call(this)}onDispose(){super.onDispose(),C(qe,this,void 0),C(Ve,this,[]),C(Ge,this,0),C(He,this,!1),C(Ke,this,!1),C(Xe,this,void 0)}}),image:class extends l_{#D;#L=0;#B=[];#z=0;#W;get name(){return"ImageDecoder"}setSegment(t){this.#D=t}setTimeOffsetSeconds(t){const e=Number(t);this.#L=Number.isFinite(e)?e:0}decode(t){super.decode(t),t&&(this.#D=t);const e=null==t?void 0:t.arrayBuffer;e instanceof ArrayBuffer&&(this.#B=[new Uint8Array(e)],this.#z=e.byteLength,this.endOfStream())}decodeChunk(t,e={}){if(null!=e&&e.isInit)return;const n=function(t){if(t)return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):ArrayBuffer.isView(t)&&t.buffer?new Uint8Array(t.buffer):void 0}(t);n&&n.length&&(this.#B.push(n),this.#z+=n.length)}async endOfStream(){var t,e,n;if(this.#W)return;if(!(this.#B.length&&this.#z>0))return;const i=new Uint8Array(this.#z);let r=0;for(let t=0;t<this.#B.length;t+=1){const e=this.#B[t];i.set(e,r),r+=e.length}const o=null===(t=this.#D)||void 0===t?void 0:t.chosenRepresentation,s=(null==o?void 0:o.mime)||(null===(e=this.track)||void 0===e?void 0:e.mimeType)||(null===(n=this.track)||void 0===n?void 0:n.mime)||function(t){if(t instanceof Uint8Array&&!(t.byteLength<4))return t.byteLength>=8&&137===t[0]&&80===t[1]&&78===t[2]&&71===t[3]&&13===t[4]&&10===t[5]&&26===t[6]&&10===t[7]?"image/png":255===t[0]&&216===t[1]&&255===t[2]?"image/jpeg":t.byteLength>=6&&71===t[0]&&73===t[1]&&70===t[2]&&56===t[3]?"image/gif":t.byteLength>=12&&82===t[0]&&73===t[1]&&70===t[2]&&70===t[3]&&87===t[8]&&69===t[9]&&66===t[10]&&80===t[11]?"image/webp":void 0}(i);try{var a,l;const t=await async function(t,e){const n=function(t,e){if(!(t&&t.byteLength>0))return;if("function"!=typeof cd.Blob)return;const n="string"==typeof e?e:"";return new cd.Blob([t],n?{type:n}:void 0)}(t,e);if(!n)throw new Error("Image decode requires Blob support");let i;if("function"==typeof cd.Image&&cd.URL&&"function"==typeof cd.URL.createObjectURL&&"function"==typeof cd.URL.revokeObjectURL){const t=cd.URL.createObjectURL(n);try{const e=new cd.Image;return await new Promise(((n,i)=>{e.onload=()=>n(),e.onerror=t=>i(t||new Error("Image decode failed")),e.src=t})),e}catch(t){i=t}finally{cd.URL.revokeObjectURL(t)}}if("function"==typeof cd.createImageBitmap)try{return cd.createImageBitmap(n)}catch(t){i=t}if(i)throw i;throw new Error("No supported image decode mechanism")}(i,s);this.#W=t;const e=function(t){if(!t)return;const e=[[t.naturalWidth,t.naturalHeight],[t.width,t.height],[t.displayWidth,t.displayHeight],[t.videoWidth,t.videoHeight],[t.codedWidth,t.codedHeight]];for(let t=0;t<e.length;t+=1){const[n,i]=e[t],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}(t);e&&o&&(oy(o.width)||(o.width=e.width),oy(o.height)||(o.height=e.height)),this.trigger("decoder:frame",{pts:this.#L,duration:oy(null===(a=this.#D)||void 0===a?void 0:a.duration)?this.#D.duration:null===(l=this.track)||void 0===l?void 0:l.duration,frame:t})}catch(t){this.trigger("decoder:error",{error:t})}}onDispose(){if(super.onDispose(),this.#W&&"function"==typeof this.#W.close)try{this.#W.close()}catch(t){}this.#W=null,this.#B=[],this.#z=0,this.#D=null}}};function PE(){if(M(He,this)||M(Ke,this))return;if(!M(Ge,this))return;const t=A(Qe,this,RE).call(this);t.length&&A(Qe,this,DE).call(this,t,!1)}function RE(){const t=M(qe,this),e=t?t.length:0,n=e+M(Ge,this);if(!n)return ME;const i=new Uint8Array(n);let r=0;e&&(i.set(t,r),r+=e);for(let t=0;t<M(Ve,this).length;t+=1){const e=M(Ve,this)[t];e&&e.length&&(i.set(e,r),r+=e.length)}return i}function DE(t,e){if(M(He,this)||M(Ke,this))return;const n=e?A(Qe,this,LE).call(this,t):t;if(!n||!n.length)return;const i=function(){if(CE)return CE;const t=cd.AudioContext||cd.webkitAudioContext;return t?(CE=new t,CE):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(Ke,this,!0),new Promise(((t,e)=>{const n=i.decodeAudioData(r,t,e);n&&"function"==typeof n.then&&n.then(t).catch(e)})).then((t=>{var e;C(He,this,!0);const n=Number.isFinite(null==t?void 0:t.duration)?t.duration:Number(null===(e=M(Xe,this))||void 0===e?void 0:e.duration)||void 0;this.trigger("decoder:audio",{audioBuffer:t,pts:M(Ye,this),duration:n})})).catch((t=>{this.trigger("decoder:error",{error:t})})).finally((()=>{C(Ve,this,[]),C(Ge,this,0),C(Ke,this,!1)}))}function LE(t){const e=M(qe,this);if(!e||!e.length)return t;const n=e.length+t.length,i=new Uint8Array(n);return i.set(e,0),i.set(t,e.length),i}function BE(t,e){var n,i,r,o,s;const a=null!=t&&t.context&&"object"==typeof t.context?t.context:void 0;return{error:e,errorName:null==e?void 0:e.name,errorMessage:"string"==typeof(null==e?void 0:e.message)?e.message:void 0,nodeId:M(Pe,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(Ae,this))||void 0===r?void 0:r.codec)||M(Ie,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 zE(t){const e=(null==t?void 0:t.error)||t,n=A(Ue,this,BE).call(this,t,e);if(A(Ue,this,WE).call(this,t,e))return this.log.warn("[onDemuxError] recoverable demux error",n),void A(Ue,this,JE).call(this);const i=A(Ue,this,XE).call(this,t),r=A(Ue,this,$E).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(Ue,this,JE).call(this);let o=n;i&&(o={...n,missingFrameStats:i}),this.log.warn(`[onDemuxError] demux error${r}`,o),this.trigger("decoder:error",t)}function WE(t,e){if("boolean"==typeof(null==t?void 0:t.recoverable))return t.recoverable;const n="string"==typeof(null==t?void 0:t.severity)?t.severity:"";if(n)return"recoverable"===n||"transient"===n;const i="string"==typeof(null==e?void 0:e.message)?e.message:"";return!!i&&(i.includes("unsupported or unrecognizable format")||i.includes("No supported tracks found"))}function $E(t){return t?` expectedFrames=${A(Ue,this,jE).call(this,t.expectedFrames)} demuxedFrames=${A(Ue,this,jE).call(this,t.demuxedFrames)} missingFrames=${A(Ue,this,jE).call(this,t.missingFrames)}`:""}function jE(t){if(null==t)return"unknown";const e=Number(t);return Number.isFinite(e)?String(e):"unknown"}function UE(t,e={}){return{expectedFrames:null,demuxedFrames:M(Re,this),missingFrames:null,reason:t,...e}}function qE(t){const e=Number(t);return Number.isFinite(e)?e:null}function VE(t){var e,n;const i=(null==t?void 0:t.context)||{},r=Number(i.loaded),o=Number(i.total);if(!Number.isFinite(o)||o<=0||!Number.isFinite(r)||r<o)return null;if(null!==(e=this.lastSegment)&&void 0!==e&&e.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(Ue,this,UE).call(this,"segment_duration_unavailable",{segmentDurationSeconds:A(Ue,this,qE).call(this,s),demuxedCoverageSeconds:M(Be,this),frameDurationSeconds:null});const a=A(Ue,this,KE).call(this);if(!Number.isFinite(a)||a<=0){const t=Math.max(1,Math.round(s*AE));return{expectedFrames:t,demuxedFrames:M(Re,this),missingFrames:Math.max(0,t-M(Re,this)),reason:"fallback_fps",fallbackFps:AE,segmentDurationSeconds:s,demuxedCoverageSeconds:M(Be,this),frameDurationSeconds:A(Ue,this,qE).call(this,a)}}const l=Math.min(.5*a,.02),c=Math.max(0,s-M(Be,this)),u=c<=l?0:c,d=Math.max(1,Math.floor((s+l)/a)),h=Math.max(0,d-M(Re,this)),f=u>0?Math.ceil(u/a):0;return{expectedFrames:d,demuxedFrames:M(Re,this),missingFrames:Math.max(h,f),segmentDurationSeconds:s,demuxedCoverageSeconds:M(Be,this),frameDurationSeconds:a}}function GE(){C(Re,this,0),C(De,this,0),C(Le,this,0),C(Be,this,0)}function HE(t){C(Re,this,M(Re,this)+1);const e=Number(null==t?void 0:t.pts),n=Number(null==t?void 0:t.duration);if(Number.isFinite(n)&&n>0&&(C(De,this,M(De,this)+n),C(Le,this,M(Le,this)+1)),!Number.isFinite(e))return;const i=Number.isFinite(n)&&n>0?e+n:e;Number.isFinite(i)&&i>M(Be,this)&&C(Be,this,i)}function KE(){return M(Le,this)>0?M(De,this)/M(Le,this):M(Re,this)>0&&M(Be,this)>0?M(Be,this)/M(Re,this):null}function XE(t){return A(Ue,this,VE).call(this,t)}function YE(t){(null==t?void 0:t.data)instanceof Uint8Array&&(C(Se,this,t.data.buffer),A(Ue,this,dI).call(this)),null!=t&&t.decoderConfig&&(C(Ne,this,t.decoderConfig),C(Ie,this,t.decoderConfig.codec||M(Ie,this)),A(Ue,this,dI).call(this)),this.trigger("decoder:init",t)}function QE(t){A(Ue,this,HE).call(this,t),M(me,this).push(t),A(Ue,this,sI).call(this)}function JE(){C(be,this,!0),A(Ue,this,fI).call(this)}function ZE(t){const e="number"==typeof(null==t?void 0:t.pts)?t.pts:void 0;if(Number.isFinite(e))return M(Me,this)+e}function tI(t){return M(me,this).some((e=>{const n=A(Ue,this,ZE).call(this,e);return Number.isFinite(n)&&n>=t}))}function eI(t){let e=-1,n=null;for(let i=0;i<M(me,this).length;i+=1){const r=M(me,this)[i],o=A(Ue,this,ZE).call(this,r);Number.isFinite(o)&&(null==r?void 0:r.isKey)&&o<=t&&(e=i,n=o)}return{chosenIndex:e,chosenPtsSeconds:n}}function nI(t){let e=-1,n=null;for(let i=0;i<M(me,this).length;i+=1){const r=M(me,this)[i],o=A(Ue,this,ZE).call(this,r);if(Number.isFinite(o)&&null!=r&&r.isKey&&(e=i,n=o,o>=t))break}return{chosenIndex:e,chosenPtsSeconds:n}}function iI(t){const e=t+M(de,this),n=M(Fe,this);if(!Number.isFinite(n))return e;const i=Number.isFinite(M(Oe,this))?M(Oe,this):null;if(Number.isFinite(i))return Math.max(e,i);const{chosenPtsSeconds:r}=A(Ue,this,nI).call(this,n);return Number.isFinite(r)?Math.max(e,r):e}function rI(t){const e=M(Fe,this);Number.isFinite(e)&&Number.isFinite(t)&&t>=e&&(C(Fe,this,null),C(Oe,this,null))}function oI(){const t=M(Fe,this);if(!Number.isFinite(t)||M(Ce,this))return!0;if(!A(Ue,this,tI).call(this,t)&&!M(be,this))return!1;const e=A(Ue,this,eI).call(this,t);let n=e;if(-1===e.chosenIndex&&(n=A(Ue,this,nI).call(this,t)),n.chosenIndex>0){const t=`[#maybeAlignToSeekKeyframe] Dropping ${n.chosenIndex} samples before keyframe @ ${n.chosenPtsSeconds}`;this.log.debug(t),M(me,this).splice(0,n.chosenIndex)}return C(ye,this,!0),Number.isFinite(n.chosenPtsSeconds)&&C(Oe,this,n.chosenPtsSeconds),C(Ce,this,!0),!0}function sI(){const t=M(pe,this)?M(pe,this).call(this):0,e=A(Ue,this,iI).call(this,t);if(A(Ue,this,xI).call(this,t),A(Ue,this,_I).call(this),!A(Ue,this,oI).call(this))return void A(Ue,this,lI).call(this);const n=void 0!==cd.VideoDecoder&&void 0!==cd.EncodedVideoChunk;for(n&&!M(_e,this)&&M(Ne,this)&&A(Ue,this,dI).call(this);M(me,this).length&&!A(Ue,this,EI).call(this)&&!(n&&M(xe,this)&&A(Ue,this,SI).call(this));){const t=M(me,this)[0],i="number"==typeof(null==t?void 0:t.pts)?t.pts:0,r=M(Me,this)+i;if(r>e)break;if(null!=t&&t.raw)M(me,this).shift(),A(Ue,this,aI).call(this,t);else{if(n){if(!M(_e,this)||!M(xe,this))break;if(M(ye,this)&&!t.isKey){M(me,this).shift();continue}M(me,this).shift();const e=Math.max(0,Math.round(r*SE));M(ge,this).set(e,!!t.isKey);try{const n=new cd.EncodedVideoChunk({type:t.isKey?"key":"delta",timestamp:e,duration:t.duration?Math.round(t.duration*SE):void 0,data:t.data instanceof Uint8Array?t.data:new Uint8Array(t.data)});M(xe,this).decode(n),t.isKey&&C(ye,this,!1);continue}catch(t){M(ge,this).delete(e);const n="string"==typeof(null==t?void 0:t.message)?t.message:"";if("DataError"===(null==t?void 0:t.name)&&n.includes("key frame")){C(ye,this,!0);continue}this.log.warn("[#drainDecodeQueue] decode failed, falling back to placeholder",t)}}M(me,this).shift(),A(Ue,this,aI).call(this,t)}}A(Ue,this,fI).call(this),A(Ue,this,lI).call(this)}function aI(t){const e=M(pe,this)?M(pe,this).call(this):0,n=A(Ue,this,iI).call(this,e),i=M(Me,this)+("number"==typeof t.pts?t.pts:0);if(i<e||i>n)return;A(Ue,this,xI).call(this,e);const r={pts:i,duration:t.duration,data:t.data,isKey:t.isKey};M(ue,this).push(r),A(Ue,this,_I).call(this),this.trigger("decoder:frame",r),A(Ue,this,rI).call(this,i)}function lI(){if(M(me,this).length>0&&void 0!==cd.VideoDecoder){if(vw(M(ve,this)))return;pw(M(ve,this),50)}else A(Ue,this,cI).call(this)}function cI(){M(ve,this)&&vw(M(ve,this))&&mw(M(ve,this))}function uI(){return null!=cd&&cd.performance&&"function"==typeof cd.performance.now?cd.performance.now():Date.now()}function dI(){if(M(_e,this))return;if(void 0===cd.VideoDecoder)return;if(!M(Ne,this))return;if(M(Te,this)&&A(Ue,this,uI).call(this)<M(Ee,this))return;const t=A(Ue,this,hI).call(this);try{C(xe,this,new cd.VideoDecoder({output:t=>A(Ue,this,mI).call(this,t),error:t=>A(Ue,this,pI).call(this,t)})),M(xe,this).configure(t),C(_e,this,!0),C(ye,this,!0),C(Te,this,!1),C(Ee,this,0),A(Ue,this,sI).call(this)}catch(t){this.log.warn("[#maybeConfigureDecoder] configure failed, falling back to placeholder decode",t),C(xe,this,null),C(_e,this,!1),C(Ne,this,null)}}function hI(){const t={...M(Ne,this)};return A(Ue,this,NI).call(this,t)&&M(Ae,this).codec?t.codec=M(Ae,this).codec:!t.codec&&M(Ie,this)&&(t.codec=M(Ie,this)),M(Se,this)&&!t.description&&(t.description=M(Se,this)),M(Ae,this).width&&!t.codedWidth&&(t.codedWidth=M(Ae,this).width),M(Ae,this).height&&!t.codedHeight&&(t.codedHeight=M(Ae,this).height),A(Ue,this,MI).call(this,t),t}function fI(){void 0!==cd.VideoDecoder&&void 0!==cd.EncodedVideoChunk&&(M(Te,this)||!M(be,this)||M(we,this)||M(ke,this)||M(_e,this)&&M(xe,this)&&"function"==typeof M(xe,this).flush&&(M(me,this).length||(C(ke,this,!0),Promise.resolve().then((()=>M(xe,this).flush())).then((()=>{C(we,this,!0),C(ye,this,!0)})).catch((t=>{"AbortError"!==(null==t?void 0:t.name)&&this.log.warn("[#maybeFlushDecoder] flush failed",t)})).finally((()=>{C(ke,this,!1)})))))}function pI(t){if(this.log.warn("[#handleDecoderError] decoder error",t),this.trigger("decoder:error",{error:t}),M(xe,this)&&"function"==typeof M(xe,this).close)try{M(xe,this).close()}catch(t){}C(xe,this,null),C(_e,this,!1),C(ke,this,!1),C(we,this,!1),C(ye,this,!0),M(ge,this).clear(),C(Te,this,!0),C(Ee,this,A(Ue,this,uI).call(this)+1e3)}function mI(t){C(je,this,M(je,this).then((()=>{var e;if(!this._disposed)return A(Ue,this,wI).call(this,t);null===(e=t.close)||void 0===e||e.call(t)})).catch((e=>{this.log.warn("[#enqueueDecodedFrame] failed processing decoded frame",e);try{var n;null===(n=t.close)||void 0===n||n.call(t)}catch(t){}})))}function vI(t){return"boolean"!=typeof t||t}function gI(t){const e=Number(t);return!Number.isFinite(e)||e<0?.2:e}function yI(){return!!M(We,this)&&"function"==typeof cd.createImageBitmap&&M(ze,this)}function bI(t){var e;const n=Number(null===(e=this.lastSegment)||void 0===e?void 0:e.duration);if(!Number.isFinite(n)||n<=0)return!1;if(!Number.isFinite(t))return!1;const i=Number(M(Me,this));return!!Number.isFinite(i)&&t>=i+n-M($e,this)}async function kI(t,e){try{var n;const i=A(Ue,this,bI).call(this,e),r=await cd.createImageBitmap(t,{premultiplyAlpha:i?"none":"default"});return null!==(n=t.close)&&void 0!==n&&n.call(t),r}catch(e){return this.log.debug("[#maybeConvertFrameToBitmap] createImageBitmap failed",e),t}}async function wI(t){var e,n;let i=t;if(this._disposed)return void(null===(e=(n=i).close)||void 0===e||e.call(n));const r="number"==typeof t.timestamp?t.timestamp:void 0,o="number"==typeof t.timestamp?t.timestamp/SE:M(pe,this)?M(pe,this).call(this):0,s="number"==typeof t.duration?t.duration/SE:void 0;let a;void 0!==r&&(a=M(ge,this).get(r),M(ge,this).delete(r));try{var l,c,u,d;let e=M(pe,this)?M(pe,this).call(this):0,n=A(Ue,this,iI).call(this,e);if(o<e||o>n)return void(null===(l=(c=i).close)||void 0===l||l.call(c));if(A(Ue,this,yI).call(this)){var h,f,p,m;if(i=await A(Ue,this,kI).call(this,t,o),this._disposed)return void(null===(h=(f=i).close)||void 0===h||h.call(f));if(e=M(pe,this)?M(pe,this).call(this):0,n=A(Ue,this,iI).call(this,e),o<e||o>n)return void(null===(p=(m=i).close)||void 0===p||p.call(m))}if(A(Ue,this,xI).call(this,e),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(ue,this).push(r),A(Ue,this,_I).call(this),this.trigger("decoder:frame",r),A(Ue,this,rI).call(this,o),this.log.debug(`[#handleDecodedFrame] [${M(Ae,this).codec}] Decoded frame:`,r)}catch(t){this.log.warn(`[#handleDecodedFrame] [${M(Ae,this).codec}] Failed to handle decoded frame`,t);try{var v,g;null===(v=(g=i).close)||void 0===v||v.call(g)}catch(t){}}}function xI(t){const e=A(Ue,this,iI).call(this,t),n=[];M(ue,this).forEach((i=>{var r;const o=null!==(r=null==i?void 0:i.pts)&&void 0!==r?r:0;o<t||o>e||n.push(i)})),C(ue,this,n)}function _I(){const t=M(he,this);if(!Number.isFinite(t)||t<=0)return;if(M(ue,this).length<=t)return;const e=M(ue,this).length-t;M(ue,this).splice(0,e)}function TI(t){const e=Number(t);return!Number.isFinite(e)||e<=0?0:Math.floor(e)}function EI(){const t=M(he,this);return!(!Number.isFinite(t)||t<=0)&&M(ue,this).length>=t}function II(t){const e=Number(t);return!Number.isFinite(e)||e<=0?0:Math.floor(e)}function SI(){var t;const e=M(fe,this);if(!Number.isFinite(e)||e<=0)return!1;const n=Number(null===(t=M(xe,this))||void 0===t?void 0:t.decodeQueueSize);return!!Number.isFinite(n)&&n>=e}function AI(t){return"string"==typeof t&&t.toLowerCase().startsWith("av01")}function NI(t){var e;return!1!==this.settings.av1ColorSpaceOverrideEnabled&&A(Ue,this,AI).call(this,(null===(e=M(Ae,this))||void 0===e?void 0:e.codec)||(null==t?void 0:t.codec))}function MI(t){A(Ue,this,NI).call(this,t)&&(t.colorSpace={...NE})}function FI(t){if(t&&Array.isArray(t.segments))for(let e=0;e<t.segments.length;e+=1){const n=t.segments[e];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 CI extends sd{#$;get name(){return"DecoderFactory"}constructor(...t){super(...t);const e=t.length?t[t.length-1]:void 0;this.#$=e&&"object"==typeof e&&!Array.isArray(e)?e:{}}create(t,e=this.#$){if(!t||!t.type)return new l_(e);const n=OE[t.type];return n?(this.log.debug(`[#create] [${t.type}] Creating decoder:`,n),new n(e)):new l_(e)}}class OI{#j;#U;#q;#V;constructor(t={}){this.#j=t.getActiveRenderPlacement,this.#U=t.getPlacementsActiveAtTime,this.#q=t.ensureDecodedForPlacementAtTime;const e=Number(t.lookaheadSeconds);this.#V=Number.isFinite(e)&&e>=0?e:1}handleTimeUpdate(t={}){const e=Number(null==t?void 0:t.time);if(!Number.isFinite(e))return;if("function"!=typeof this.#q)return;const n="function"==typeof this.#U?this.#U:()=>[],i=n(e),r=new Set;i.forEach((t=>{null!=t&&t.placementId&&r.add(t.placementId),this.#q(t,e)}));const o=this.#V;if(!(o>0))return;const s=e+o;n(s).forEach((t=>{const e=null==t?void 0:t.placementId;e&&!r.has(e)&&this.#q(t,s)}))}dispose(){}}class PI{#G;#H;#K;#X;#Y;#Q;constructor(t={}){this.#G=t.getNode,this.#H=t.getPlacementState,this.#K=t.getDecodeTracks,this.#X=t.getSegmentIdForTrackAtTime,this.#Y=t.decodeLoadedMediaSegment,this.#Q=t.decodeLoadedMediaSegmentsAfter}ensureDecodedForPlacementAtTime(t,e){if(!t||!Number.isFinite(e))return;const n=null==t?void 0:t.placementId,i=null==t?void 0:t.nodeId;if(!n||!i)return;const r="function"==typeof this.#G?this.#G(i):void 0;if(!r)return;const o="function"==typeof this.#H?this.#H(n):void 0,s=null==o?void 0:o.trackStates;s&&"function"==typeof s.get&&("function"==typeof this.#K?this.#K(r).filter((t=>"video"===(null==t?void 0:t.type)||"image"===(null==t?void 0:t.type)||"audio"===(null==t?void 0:t.type))):[]).forEach((n=>{var i;const r=s.get(n.id);if(!r)return;const o="function"==typeof this.#X?this.#X(n,t,e):null;if(!o)return;const a=null==n||null===(i=n.segments)||void 0===i?void 0:i.find((t=>(null==t?void 0:t.id)===o));a&&!a.isInit&&a.retainedByteLength>0&&a.arrayBuffer&&(r.segmentDecoders&&"function"==typeof r.segmentDecoders.has&&r.segmentDecoders.has(o)||"function"!=typeof this.#Y||this.#Y(t,n,a),"video"===(null==n?void 0:n.type)&&"function"==typeof this.#Q&&this.#Q(t,n,a))}))}dispose(){}}const RI=new Set(["video","audio","image"]);function DI(t){const e=Number(t);return Number.isFinite(e)?e:0}var LI=new WeakMap,BI=new WeakMap,zI=new WeakMap,WI=new WeakMap,$I=new WeakMap,jI=new WeakMap,UI=new WeakMap,qI=new WeakMap,VI=new WeakMap,GI=new WeakMap,HI=new WeakMap,KI=new WeakMap,XI=new WeakMap,YI=new WeakMap,QI=new WeakMap,JI=new WeakMap,ZI=new WeakMap,tS=new WeakMap,eS=new WeakMap,nS=new WeakSet;class iS extends sd{constructor(...t){super(...t),O(this,nS),F(this,LI,void 0),F(this,BI,void 0),F(this,zI,void 0),F(this,WI,void 0),F(this,$I,void 0),F(this,jI,void 0),F(this,UI,void 0),F(this,qI,void 0),F(this,VI,void 0),F(this,GI,void 0),F(this,HI,void 0),F(this,KI,new Map),F(this,XI,new Map),F(this,YI,new Map),F(this,QI,new Map),F(this,JI,new Set),F(this,ZI,0),F(this,tS,!1),F(this,eS,null);const[e,n,i]=t;C(LI,this,e),C(BI,this,n),C(zI,this,i||new CI),C(WI,this,new PI({getNode:t=>A(nS,this,AS).call(this,t),getPlacementState:t=>M(KI,this).get(t),getDecodeTracks:t=>A(nS,this,_S).call(this,t),getSegmentIdForTrackAtTime:(t,e,n)=>A(nS,this,dS).call(this,t,e,n),decodeLoadedMediaSegment:(t,e,n)=>{A(nS,this,KS).call(this,t,e,n)},decodeLoadedMediaSegmentsAfter:(t,e,n)=>{A(nS,this,WS).call(this,t,e,n)}})),C($I,this,new OI({getActiveRenderPlacement:t=>{var e,n;return null===(e=M(BI,this))||void 0===e||null===(n=e.getActiveRenderPlacement)||void 0===n?void 0:n.call(e,t)},getPlacementsActiveAtTime:t=>{var e,n;return(null===(e=M(BI,this))||void 0===e||null===(n=e.getPlacementsActiveAtTime)||void 0===n?void 0:n.call(e,t))||[]},ensureDecodedForPlacementAtTime:(t,e)=>{var n,i;null===(n=M(WI,this))||void 0===n||null===(i=n.ensureDecodedForPlacementAtTime)||void 0===i||i.call(n,t,e)}})),A(nS,this,rS).call(this),A(nS,this,kS).call(this)}get name(){return"DecodeCoordinator"}onDispose(){var t,e;M(BI,this)&&"function"==typeof M(BI,this).off&&M(jI,this)&&M(BI,this).off(dd.PLACEMENT_ADDED,M(jI,this)),M(BI,this)&&"function"==typeof M(BI,this).off&&M(UI,this)&&M(BI,this).off(dd.TIMELINE_SEEKING,M(UI,this)),M(BI,this)&&"function"==typeof M(BI,this).off&&M(qI,this)&&M(BI,this).off(dd.TIMELINE_SEEKED,M(qI,this)),M(BI,this)&&"function"==typeof M(BI,this).off&&M(VI,this)&&M(BI,this).off(dd.TIMELINE_TIME_UPDATE,M(VI,this)),M(BI,this)&&"function"==typeof M(BI,this).off&&M(GI,this)&&M(BI,this).off(dd.TIMELINE_RESET,M(GI,this)),A(nS,this,oS).call(this),C(jI,this,null),C(UI,this,null),C(qI,this,null),C(VI,this,null),C(GI,this,null),null!==(t=M(WI,this))&&void 0!==t&&null!==(e=t.dispose)&&void 0!==e&&e.call(t),C(WI,this,null),M($I,this)&&"function"==typeof M($I,this).dispose&&M($I,this).dispose(),C($I,this,null),M(XI,this).forEach(((t,e)=>{const n=A(nS,this,AS).call(this,e);n&&"function"==typeof n.off&&n.off("node:loaded",t)})),M(XI,this).clear(),M(YI,this).forEach(((t,e)=>{const n=A(nS,this,AS).call(this,e);n&&"function"==typeof n.off&&n.off("segment:chunk",t)})),M(YI,this).clear(),M(QI,this).clear(),M(JI,this).clear(),A(nS,this,vS).call(this),M(KI,this).forEach((({trackStates:t})=>{t&&t.forEach((t=>{A(nS,this,CS).call(this,t)}))})),M(KI,this).clear()}}function rS(){M(BI,this)&&"function"==typeof M(BI,this).on&&(C(jI,this,(t=>{A(nS,this,wS).call(this,t)})),M(BI,this).on(dd.PLACEMENT_ADDED,M(jI,this)),C(UI,this,(t=>A(nS,this,sS).call(this,t))),M(BI,this).on(dd.TIMELINE_SEEKING,M(UI,this)),C(qI,this,(()=>A(nS,this,aS).call(this))),M(BI,this).on(dd.TIMELINE_SEEKED,M(qI,this)),C(VI,this,(t=>A(nS,this,lS).call(this,t))),M(BI,this).on(dd.TIMELINE_TIME_UPDATE,M(VI,this)),C(GI,this,(()=>A(nS,this,cS).call(this))),M(BI,this).on(dd.TIMELINE_RESET,M(GI,this))),(null==cd?void 0:cd.document)&&"function"==typeof cd.document.addEventListener&&(C(HI,this,(()=>{A(nS,this,gS).call(this)})),cd.document.addEventListener("visibilitychange",M(HI,this)))}function oS(){M(HI,this)&&null!=cd&&cd.document&&"function"==typeof cd.document.removeEventListener&&cd.document.removeEventListener("visibilitychange",M(HI,this)),C(HI,this,null)}function sS(t={}){const e=Number(null==t?void 0:t.targetTime);Number.isFinite(e)&&(M(KI,this).forEach((t=>{const n=null==t?void 0:t.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(nS,this,uS).call(this,n,null==t?void 0:t.placement,e),n.seekSegmentId=null)}))})),(Array.isArray(null==t?void 0:t.placements)?t.placements:[]).forEach((t=>{const n=null==t?void 0:t.placementId,i=null==t?void 0:t.nodeId;if(!n||!i)return;const r=M(KI,this).get(n);if(!r||!r.trackStates)return;const o=A(nS,this,AS).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(nS,this,uS).call(this,n,r.placement||t,e)})),A(nS,this,zS).call(this,r.placement||t,o))})))}function aS(){M(KI,this).forEach((t=>{const e=null==t?void 0:t.trackStates;e&&e.forEach((t=>{var e;const n=null==t||null===(e=t.track)||void 0===e?void 0:e.type;"video"!==n&&"image"!==n&&"audio"!==n||(t.seekSegmentId=null)}))}))}function lS(t={}){var e,n;A(nS,this,BS).call(this,null==t?void 0:t.time),null!==(e=M($I,this))&&void 0!==e&&null!==(n=e.handleTimeUpdate)&&void 0!==n&&n.call(e,t),A(nS,this,gS).call(this),A(nS,this,OS).call(this,null==t?void 0:t.time)}function cS(){M(XI,this).forEach(((t,e)=>{const n=A(nS,this,AS).call(this,e);n&&"function"==typeof n.off&&n.off("node:loaded",t)})),M(XI,this).clear(),M(YI,this).forEach(((t,e)=>{const n=A(nS,this,AS).call(this,e);n&&"function"==typeof n.off&&n.off("segment:chunk",t)})),M(YI,this).clear(),M(QI,this).clear(),M(JI,this).clear(),M(KI,this).forEach((({trackStates:t})=>{t&&t.forEach((t=>{const e=null==t?void 0:t.segmentDecoders;e&&e.forEach((t=>{t&&"function"==typeof t.dispose&&t.dispose()}))}))})),M(KI,this).clear()}function uS(t,e,n){t&&(A(nS,this,CS).call(this,t),t.seekSegmentId=A(nS,this,dS).call(this,t.track,e,n))}function dS(t,e,n){if(!t||!e||!Array.isArray(t.segments))return null;const i=gm(e);if(!Number.isFinite(i))return null;const r=DI(null==e?void 0:e.nodeOffsetOverride),o=Math.max(0,n-i+r),s=DI(null==t?void 0:t.offset),a=Math.max(0,o-s),l="function"==typeof t.getMediaSegmentAtTime?t.getMediaSegmentAtTime(a,{preferRepresentationTime:!0}):mb(t.segments,a,{preferRepresentationTime:!0});return(null==l?void 0:l.id)||null}function hS(t){if(!t)return!1;const e=null==t?void 0:t.name;if("QuotaExceededError"===e)return!0;if("EncodingError"===e)return!0;const n="string"==typeof(null==t?void 0:t.message)?t.message:"";return!!n.includes("Decoder failure")||!!n.includes("Codec reclaimed due to inactivity")||!("OperationError"!==e||!n.includes("initialize after flush"))}function fS(){const t=null==cd?void 0:cd.document;return!t||"string"!=typeof t.visibilityState||"visible"===t.visibilityState}function pS(){var t;const e=M(BI,this);if(!e||"number"!=typeof e.currentTime)return!1;if(e.state===Av)return!1;const n=Date.now();if(n<M(ZI,this))return!1;const i=e.currentTime;if(!Number.isFinite(i))return!1;const r="function"==typeof e.getPlacementsActiveAtTime?e.getPlacementsActiveAtTime(i):[],o=Number(null==e||null===(t=e.settings)||void 0===t?void 0:t.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(nS,this,mS).call(this,i),!Number.isFinite(a))return!1;return C(ZI,this,n+1500),this.log.warn("[DecodeCoordinator] attempting decoder recovery seek"),e.currentTime=a,!0}function mS(t){var e;const n=M(BI,this);if(!n)return null;const i=Array.isArray(n.placements)?n.placements:[];if(!i.length)return null;const r=Number(t);if(!Number.isFinite(r))return null;const o=Number(null==n||null===(e=n.settings)||void 0===e?void 0:e.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((t=>{const e=gm(t);if(!Number.isFinite(e))return;(!Number.isFinite(d)||e<d)&&(d=e);const n=mm(t,M(LI,this)),i=Number.isFinite(n),o=i?e+n:e;(o>e||!i)&&((o>a||!Number.isFinite(a)&&Number.isFinite(o))&&(a=o,l=e),o<=r&&o>c&&(c=o,u=i?Math.max(e,o-s):e))})),Number.isFinite(l)&&Number.isFinite(a)&&r>=a-s?l:Number.isFinite(u)?u:Number.isFinite(d)?d:null}function vS(){C(tS,this,!1),C(eS,this,null)}function gS(){M(tS,this)&&A(nS,this,fS).call(this)&&A(nS,this,pS).call(this)}function yS(t){if(!A(nS,this,hS).call(this,t))return;const e=M(BI,this);e&&"number"==typeof e.currentTime&&(C(tS,this,!0),C(eS,this,t),A(nS,this,fS).call(this)&&A(nS,this,pS).call(this))}function bS(t){var e;return!!t&&(Array.isArray(null===(e=M(BI,this))||void 0===e?void 0:e.placements)?M(BI,this).placements:[]).includes(t)}function kS(t){var e;(Array.isArray(null===(e=M(BI,this))||void 0===e?void 0:e.placements)?[...M(BI,this).placements]:[]).filter((e=>"function"!=typeof t||t(e))).sort(((t,e)=>{const n=gm(t),i=gm(e);return(Number.isFinite(n)?n:Number.POSITIVE_INFINITY)-(Number.isFinite(i)?i:Number.POSITIVE_INFINITY)})).forEach((t=>{A(nS,this,wS).call(this,t)}))}async function wS(t){if(!t||!t.placementId||M(KI,this).has(t.placementId))return;if(!A(nS,this,bS).call(this,t))return;const e=t.nodeId;if(!e||!M(LI,this)||"function"!=typeof M(LI,this).get)return;const n=A(nS,this,AS).call(this,e);if(n){if(n.state&&"ready"!==n.state){if("function"==typeof n.resolve)try{await n.resolve()}catch(n){if(!A(nS,this,bS).call(this,t))return;return void this.log.warn(`[#processPlacement] Failed to resolve node ${e}`,n)}if(!A(nS,this,bS).call(this,t))return;if("ready"!==n.state)return}if(A(nS,this,LS).call(this,t))return A(nS,this,DS).call(this,t,n),void M(JI,this).add(t.placementId);A(nS,this,RS).call(this,t,n)}}function xS(t){return A(nS,this,_S).call(this,t).every((t=>A(nS,this,PS).call(this,t)))}function _S(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).filter((t=>RI.has(null==t?void 0:t.type)))}function TS(t){if(!t||!t.id||"function"!=typeof t.on)return;if(M(XI,this).has(t.id))return;const e=()=>{A(nS,this,$S).call(this,t.id)};t.on("node:loaded",e),M(XI,this).set(t.id,e)}function ES(t){if(!t||!t.id||"function"!=typeof t.on)return;if(M(YI,this).has(t.id))return;const e=t=>A(nS,this,jS).call(this,t);t.on("segment:chunk",e),M(YI,this).set(t.id,e)}function IS(t,e){if(!t||!e)return;const n=M(QI,this).get(t)||new Set;n.add(e),M(QI,this).set(t,n)}function SS(t){return M(QI,this).get(t)||new Set}function AS(t){if(t&&M(LI,this)&&"function"==typeof M(LI,this).get)return M(LI,this).get(t)}function NS(t){if(!t)return;const e=t.fullBufferRetryTimer;null!=e&&("function"==typeof(null==cd?void 0:cd.clearTimeout)?cd.clearTimeout.bind(cd):clearTimeout)(e),t.fullBufferRetryTimer=null,t.fullBufferDecodeScheduled=!1,t.fullBufferRetryAttempts=0}function MS(t){const e=null==t?void 0:t.segmentStates;e&&"function"==typeof e.forEach&&e.forEach((t=>{A(nS,this,NS).call(this,t)}))}function FS(t,e,n,i){var r,o;if(!(t&&e&&n&&i))return!1;const s=M(KI,this).get(t),a=null==s||null===(r=s.trackStates)||void 0===r?void 0:r.get(e);return(null==a||null===(o=a.segmentStates)||void 0===o?void 0:o.get(n))===i}function CS(t){if(!t)return;A(nS,this,MS).call(this,t);const e=t.segmentDecoders;e&&"function"==typeof e.forEach&&(e.forEach((t=>{if(t&&"function"==typeof t.dispose)try{t.dispose()}catch(t){}})),"function"==typeof e.clear&&e.clear()),t.segmentStates&&"function"==typeof t.segmentStates.clear&&t.segmentStates.clear(),t.ready=!1,t.seekSegmentId=null}function OS(t){const e=DI(t);if(!Number.isFinite(e))return;const n=e-2;Number.isFinite(n)&&M(KI,this).forEach((t=>{const e=null==t?void 0:t.placement;if(!e)return;const i=gm(e),r=mm(e,M(LI,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==t?void 0:t.trackStates;s&&"function"==typeof s.forEach&&s.forEach((t=>{var e;const n=null==t||null===(e=t.track)||void 0===e?void 0:e.type;"video"!==n&&"image"!==n&&"audio"!==n||A(nS,this,CS).call(this,t)}))}))}function PS(t){if(!t||!Array.isArray(t.segments))return!1;const e=t.segments.find((t=>null==t?void 0:t.isInit));if(e&&!(e.retainedByteLength>0))return!1;const n=t.segments.find((t=>t&&!t.isInit));return!n||n.retainedByteLength>0}function RS(t,e){if(this.log.debug(`[#startDecode] [${t.placementId}] [${e.id}] Starting decode`),A(nS,this,DS).call(this,t,e)){if(A(nS,this,IS).call(this,e.id,t.placementId),!A(nS,this,xS).call(this,e))return A(nS,this,TS).call(this,e),void A(nS,this,ES).call(this,e);A(nS,this,zS).call(this,t,e),A(nS,this,ES).call(this,e)}}function DS(t,e){if(!t||!t.placementId||!e)return;const n=M(KI,this).get(t.placementId);if(n)return n.placement=t,n;const i=A(nS,this,_S).call(this,e),r=new Map;i.forEach((n=>{try{const t=n.segments.some((t=>null==t?void 0:t.isInit));r.set(n.id,{hasInit:t,track:n,ready:!1,segmentDecoders:new Map,segmentStates:new Map})}catch(i){this.trigger(dd.DECODE_ERROR,pd({placementId:t.placementId,nodeId:e.id,trackId:null==n?void 0:n.id,trackType:null==n?void 0:n.type,error:i}))}}));const o={trackStates:r,nodeId:e.id,placement:t};return M(KI,this).set(t.placementId,o),o}function LS(t){var e;const n=gm(t),i=DI(null===(e=M(BI,this))||void 0===e?void 0:e.currentTime);return!Number.isFinite(n)||!!Number.isFinite(i)&&n-i>2}function BS(t){if(!M(JI,this).size)return;const e=DI(t);if(!Number.isFinite(e))return;const n=[];M(JI,this).forEach((t=>{const i=M(KI,this).get(t),r=null==i?void 0:i.placement;if(!r)return void n.push(t);const o=gm(r);Number.isFinite(o)&&o-e<=2&&n.push(t)})),n.forEach((t=>{M(JI,this).delete(t);const e=M(KI,this).get(t),n=null==e?void 0:e.placement;if(!n)return;const i=A(nS,this,AS).call(this,n.nodeId);i&&A(nS,this,RS).call(this,n,i)}))}function zS(t,e){const n=M(KI,this).get(t.placementId);n&&A(nS,this,_S).call(this,e).forEach((i=>{const r=n.trackStates.get(i.id);if(r&&!r.ready)try{let n;if(r.seekSegmentId&&(n=i.segments.find((t=>t&&!t.isInit&&t.id===r.seekSegmentId&&t.retainedByteLength>0)),!n))return;if(n||(n=i.segments.find((t=>t&&!t.isInit&&t.retainedByteLength>0))),!n)return;A(nS,this,KS).call(this,t,i,n),r.seekSegmentId&&"video"===(null==i?void 0:i.type)&&A(nS,this,WS).call(this,t,i,n),r.ready=!0,this.trigger(dd.DECODE_READY,fd({placementId:t.placementId,nodeId:e.id,trackId:i.id,trackType:i.type}))}catch(n){this.trigger(dd.DECODE_ERROR,pd({placementId:t.placementId,nodeId:e.id,trackId:null==i?void 0:i.id,trackType:null==i?void 0:i.type,error:n}))}}))}function WS(t,e,n){var i;if(!(t&&e&&n&&Array.isArray(e.segments)))return;const r=null==t?void 0:t.placementId,o=r?M(KI,this).get(r):void 0,s=null==o||null===(i=o.trackStates)||void 0===i?void 0:i.get(e.id),a=null==s?void 0:s.segmentDecoders;if(!a||"function"!=typeof a.has)return;const l=e.segments,c=l.findIndex((t=>(null==t?void 0:t.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(nS,this,KS).call(this,t,e,i),u+=1,u>=2)break}}function $S(t){const e=A(nS,this,AS).call(this,t);e&&A(nS,this,xS).call(this,e)&&A(nS,this,SS).call(this,t).forEach((t=>{const n=M(KI,this).get(t);A(nS,this,zS).call(this,(null==n?void 0:n.placement)||{placementId:t},e)}))}function jS(t){t&&t.nodeId&&t.trackId&&t.chunk&&A(nS,this,SS).call(this,t.nodeId).forEach((e=>A(nS,this,US).call(this,e,t)))}function US(t,e){const n=M(KI,this).get(t);if(!n)return;const i=n.trackStates.get(e.trackId);if(i)try{var r,o;if(e.isInit)return;const s=i.track,a=null==s||null===(r=s.segments)||void 0===r?void 0:r.find((t=>(null==t?void 0:t.id)===e.segmentId));if(!a||a.isInit)return;if("image"===(null==s?void 0:s.type))return void(!i.ready&&a.retainedByteLength>0&&A(nS,this,KS).call(this,n.placement,s,a)&&(i.ready=!0,this.trigger(dd.DECODE_READY,fd({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType}))));if((null===(o=M(BI,this))||void 0===o?void 0:o.state)===Av&&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(nS,this,GS).call(this,n.placement,s,a);if(!u||"function"!=typeof u.decodeChunk)return;if(i.hasInit&&!c.initSent){const t=A(nS,this,HS).call(this,s,a);if(!t)return void c.pendingChunks.push({chunk:e.chunk,loaded:e.loaded,total:e.total});u.decodeChunk(t,{isInit:!0}),c.initSent=!0,c.pendingChunks.length&&(c.pendingChunks.forEach((t=>{u.decodeChunk(t.chunk,{isInit:!1,loaded:t.loaded,total:t.total})})),c.pendingChunks=[])}const d="number"==typeof e.loaded&&"number"==typeof e.total&&e.total>0&&e.loaded>=e.total;A(nS,this,qS).call(this,c,e)?d&&!c.ended&&A(nS,this,VS).call(this,n.placement,s,a,c):(u.decodeChunk(e.chunk,{isInit:!1,loaded:e.loaded,total:e.total}),d&&!c.ended&&"function"==typeof u.endOfStream&&(c.ended=!0,u.endOfStream())),i.ready||(i.ready=!0,this.trigger(dd.DECODE_READY,fd({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType})))}catch(n){this.trigger(dd.DECODE_ERROR,pd({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType,error:n}))}}function qS(t,e){var n;if(!t||t.missedSegmentPrefix)return!(null==t||!t.missedSegmentPrefix);if(t.firstChunkObserved)return!1;t.firstChunkObserved=!0;const i=Number(null==e?void 0:e.loaded),r=Number(null==e||null===(n=e.chunk)||void 0===n?void 0:n.byteLength);return!(!Number.isFinite(i)||!Number.isFinite(r)||r<=0)&&(t.missedSegmentPrefix=i>r,t.missedSegmentPrefix)}function VS(t,e,n,i){if(!t||!e||!n||!i||i.fullBufferDecodeScheduled)return;const r=null==t?void 0:t.placementId,o=null==e?void 0:e.id,s=null==n?void 0:n.id;if(!r||!o||!s)return;const a="function"==typeof(null==cd?void 0:cd.setTimeout)?cd.setTimeout.bind(cd):setTimeout;i.fullBufferDecodeScheduled=!0,i.fullBufferRetryAttempts=0;const l=()=>{if(!A(nS,this,FS).call(this,r,o,s,i)||i.ended)return void A(nS,this,NS).call(this,i);if(A(nS,this,KS).call(this,t,e,n))return void A(nS,this,NS).call(this,i);i.fullBufferRetryAttempts+=1;const c=i.fullBufferRetryAttempts<=8?0:50;i.fullBufferRetryTimer=a((()=>{l()}),c)};i.fullBufferRetryTimer=a((()=>{l()}),0)}function GS(t,e,n){var i,r;const o=null==t?void 0:t.placementId;if(!o||!e||!n)return;const s=M(KI,this).get(o),a=null==s||null===(i=s.trackStates)||void 0===i?void 0:i.get(e.id);if(!a)return;const l=a.segmentDecoders.get(n.id);if(l)return l;const c=M(zI,this).create(e);if(c&&"function"==typeof c.configure&&c.configure(e),c&&"function"==typeof c.setNodeId&&c.setNodeId(null==t?void 0:t.nodeId),c&&"function"==typeof c.setSegment&&c.setSegment(n),c&&"function"==typeof c.setCurrentTimeProvider&&c.setCurrentTimeProvider((()=>{var t;return"number"==typeof(null===(t=M(BI,this))||void 0===t?void 0:t.currentTime)?M(BI,this).currentTime:0})),c&&"function"==typeof c.setTimeOffsetSeconds){var u,d;const i=gm(t),r=DI(null==e?void 0:e.offset),o=DI(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(BI,this))||void 0===r?void 0:r.state)===Av&&"video"===(null==e?void 0:e.type)&&c.setSeekTargetTimeSeconds(M(BI,this).currentTime),c&&"function"==typeof c.on&&(c.on(dd.DECODER_FRAME,(i=>{i&&(!M(tS,this)||"video"!==(null==e?void 0:e.type)&&"image"!==(null==e?void 0:e.type)||(C(tS,this,!1),C(eS,this,null)),M(BI,this)&&"function"==typeof M(BI,this).notifyDecodedFrame&&(i.frame||i.data)&&M(BI,this).notifyDecodedFrame({placementId:o,nodeId:null==t?void 0:t.nodeId,trackId:null==e?void 0:e.id,trackType:null==e?void 0:e.type,segmentId:null==n?void 0:n.id,pts:i.pts,duration:i.duration,frame:i.frame,data:i.data}))})),c.on(dd.DECODER_AUDIO,(i=>{i&&i.audioBuffer&&this.trigger(dd.DECODER_AUDIO,fd({placementId:o,nodeId:null==t?void 0:t.nodeId,trackId:null==e?void 0:e.id,trackType:null==e?void 0:e.type,segmentId:null==n?void 0:n.id,pts:i.pts,duration:i.duration,audioBuffer:i.audioBuffer}))})),c.on(dd.DECODER_ERROR,(i=>{const r=(null==i?void 0:i.error)||i;this.trigger(dd.DECODER_ERROR,pd({placementId:o,nodeId:null==t?void 0:t.nodeId,trackId:null==e?void 0:e.id,trackType:null==e?void 0:e.type,segmentId:null==n?void 0:n.id,error:r})),A(nS,this,yS).call(this,r)}))),a.segmentDecoders.set(n.id,c),c}function HS(t,e){var n,i;if(!t||!e||!Array.isArray(t.segments))return;const r=t.segments.find((t=>null==t?void 0:t.isInit));if(!r||"function"!=typeof r.getRepresentationBuffer)return;const o=(null==e||null===(n=e.chosenRepresentation)||void 0===n?void 0:n.id)||(null==e||null===(i=e.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 KS(t,e,n){var i;if(!t||!e||!n)return!1;const r=t.placementId,o=M(KI,this).get(r),s=null==o||null===(i=o.trackStates)||void 0===i?void 0:i.get(e.id);if(!s)return!1;const a=A(nS,this,GS).call(this,t,e,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(nS,this,NS).call(this,l),!0;if(s.hasInit&&!l.initSent){const t=A(nS,this,HS).call(this,e,n);if(!t)return!1;a.decodeChunk(t,{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(nS,this,NS).call(this,l),0))}const XS=1e-6;var YS=new WeakMap,QS=new WeakMap,JS=new WeakMap,ZS=new WeakMap,tA=new WeakMap,eA=new WeakMap,nA=new WeakMap,iA=new WeakMap,rA=new WeakSet;class oA extends sd{get name(){return"TransitionManager"}get defaults(){return{durationSeconds:.5}}constructor(t,e,n){super(n),O(this,rA),F(this,YS,void 0),F(this,QS,void 0),F(this,JS,null),F(this,ZS,null),F(this,tA,null),F(this,eA,0),F(this,nA,[]),F(this,iA,null),C(YS,this,t),C(QS,this,e),M(YS,this)&&"function"==typeof M(YS,this).on&&(C(iA,this,(()=>A(rA,this,pA).call(this))),M(YS,this).on(dd.TIMELINE_RESET,M(iA,this)))}transitionTo(t,e={}){const n=Number(t);if(!Number.isFinite(n))throw new Error("TransitionManager.transitionTo requires a numeric time");A(rA,this,pA).call(this);const i=A(rA,this,sA).call(this),r=A(rA,this,uA).call(this,n,e);return r?A(rA,this,dA).call(this,n,e,i,r):Promise.resolve()}onDispose(){M(YS,this)&&"function"==typeof M(YS,this).off&&M(iA,this)&&M(YS,this).off(dd.TIMELINE_RESET,M(iA,this)),C(iA,this,null),A(rA,this,pA).call(this),C(QS,this,null),C(YS,this,null)}}function sA(){return C(eA,this,M(eA,this)+1),M(eA,this)}function aA(t={}){var e;const n=Number(null==t?void 0:t.duration),i=Number(null===(e=this.settings)||void 0===e?void 0:e.durationSeconds);return Number.isFinite(n)?n:i}function lA(t={},e){return{duration:e,filter:null==t?void 0:t.filter,color:null==t?void 0:t.color,filters:null==t?void 0:t.filters,reverseFilters:null==t?void 0:t.reverseFilters,transition:null==t?void 0:t.transition}}function cA(t,e){const n=1e3*t,i=Number.isFinite(Number(null==e?void 0:e.outDurationMs))&&e.outDurationMs>0?e.outDurationMs:n;return{outDurationMs:i,inDurationMs:Number.isFinite(Number(null==e?void 0:e.inDurationMs))&&e.inDurationMs>0?e.inDurationMs:i}}function uA(t,e={}){var n;const i=M(QS,this),r=A(rA,this,aA).call(this,e);if(!i||"function"!=typeof i.startTransition)return M(YS,this).currentTime=t,null;if(!(r>0))return M(YS,this).currentTime=t,null!==(n=i.resetTransition)&&void 0!==n&&n.call(i),null;const o=A(rA,this,lA).call(this,e,r);"function"==typeof(null==e?void 0:e.onTransitionInStart)&&e.onTransitionInStart();const s=i.startTransition(o),{outDurationMs:a,inDurationMs:l}=A(rA,this,cA).call(this,r,s);return{renderer:i,transitionOptions:o,outDurationMs:a,inDurationMs:l,shouldWaitForFrames:!1!==(null==e?void 0:e.waitForVisualFrames)}}function dA(t,e={},n,i){const{renderer:r,transitionOptions:o,outDurationMs:s,inDurationMs:a,shouldWaitForFrames:l}=i,c=A(rA,this,bA).call(this,t,e,n),u=l?A(rA,this,kA).call(this,t,n):Promise.resolve();let d=!1,h=!1,f=!1,p=!l;const m=()=>{var t;A(rA,this,mA).call(this,n)&&!f&&d&&h&&p&&(f=!0,"function"==typeof(null==e?void 0:e.onTransitionInEnd)&&e.onTransitionInEnd(),"function"==typeof(null==e?void 0:e.onTransitionOutStart)&&e.onTransitionOutStart(),null!==(t=r.beginTransitionIn)&&void 0!==t&&t.call(r,o),C(ZS,this,setTimeout((()=>{var t;A(rA,this,mA).call(this,n)&&(null!==(t=r.resetTransition)&&void 0!==t&&t.call(r),"function"==typeof(null==e?void 0:e.onTransitionOutEnd)&&e.onTransitionOutEnd(),A(rA,this,hA).call(this))}),a)))};return C(JS,this,setTimeout((()=>{d=!0,m()}),s)),c.then((()=>{h=!0,m()})).catch((()=>{var t;A(rA,this,mA).call(this,n)&&(null!==(t=r.resetTransition)&&void 0!==t&&t.call(r),A(rA,this,hA).call(this))})),u.then((()=>{p=!0,m()})).catch((()=>{p=!0,m()})),M(YS,this).currentTime=t,new Promise((t=>{C(tA,this,t)}))}function hA(){const t=M(tA,this);C(tA,this,null),A(rA,this,fA).call(this),A(rA,this,yA).call(this),t&&t()}function fA(){M(JS,this)&&clearTimeout(M(JS,this)),M(ZS,this)&&clearTimeout(M(ZS,this)),C(JS,this,null),C(ZS,this,null)}function pA(){var t,e;M(QS,this)&&null!==(t=(e=M(QS,this)).resetTransition)&&void 0!==t&&t.call(e),A(rA,this,fA).call(this),A(rA,this,yA).call(this),M(tA,this)&&(M(tA,this).call(this),C(tA,this,null))}function mA(t){return M(eA,this)===t}function vA(t,e){M(YS,this)&&"function"==typeof M(YS,this).on&&(M(YS,this).on(t,e),M(nA,this).push({eventName:t,handler:e}))}function gA(t,e){M(YS,this)&&"function"==typeof M(YS,this).off&&(M(YS,this).off(t,e),C(nA,this,M(nA,this).filter((n=>n.eventName!==t||n.handler!==e))))}function yA(){M(YS,this)&&"function"==typeof M(YS,this).off?(M(nA,this).forEach((t=>{M(YS,this).off(t.eventName,t.handler)})),C(nA,this,[])):C(nA,this,[])}function bA(t,e,n){const i=null==e?void 0:e.transitionOutPromise;if(i&&"function"==typeof i.then)return i;if("function"==typeof i)try{const t=i();if(t&&"function"==typeof t.then)return t}catch(t){return Promise.resolve()}if(!M(YS,this)||"function"!=typeof M(YS,this).on)return Promise.resolve();const r=A(rA,this,wA).call(this);return new Promise((e=>{let i=!1;const o=r?dd.TIMELINE_SEEKED:"nodestart";let s,a;const l=()=>{A(rA,this,gA).call(this,dd.TIMELINE_SEEKING,s),A(rA,this,gA).call(this,o,a),e()};s=(e={})=>{A(rA,this,mA).call(this,n)?A(rA,this,xA).call(this,e,t)&&(i=!0):l()},a=(e={})=>{A(rA,this,mA).call(this,n)?(o!==dd.TIMELINE_SEEKED||A(rA,this,xA).call(this,e,t))&&(o===dd.TIMELINE_SEEKED||i)&&l():l()},A(rA,this,vA).call(this,dd.TIMELINE_SEEKING,s),A(rA,this,vA).call(this,o,a)}))}function kA(t,e){if(!M(YS,this)||"function"!=typeof M(YS,this).on)return Promise.resolve();const n=Number(t);return new Promise((t=>{const i=(r={})=>{if(!A(rA,this,mA).call(this,e))return A(rA,this,gA).call(this,dd.VISUAL_FRAMES_AVAILABLE,i),void t();const o=Number(null==r?void 0:r.time);Number.isFinite(n)&&Number.isFinite(o)&&o+XS<n||(Array.isArray(null==r?void 0:r.frames)?r.frames:[]).length&&(A(rA,this,gA).call(this,dd.VISUAL_FRAMES_AVAILABLE,i),t())};A(rA,this,vA).call(this,dd.VISUAL_FRAMES_AVAILABLE,i)}))}function wA(){var t,e;const n=null===(t=M(YS,this))||void 0===t?void 0:t.state;if(n===Sv||n===_v)return!0;const i=null===(e=M(YS,this))||void 0===e?void 0:e.placements;return!Array.isArray(i)||0===i.length}function xA(t,e){const n=Number(null==t?void 0:t.targetTime);return!Number.isFinite(n)||Math.abs(n-e)<XS}function _A(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}var TA=new WeakMap,EA=new WeakMap,IA=new WeakMap,SA=new WeakMap,AA=new WeakMap,NA=new WeakMap,MA=new WeakMap,FA=new WeakMap,CA=new WeakMap,OA=new WeakMap,PA=new WeakMap,RA=new WeakMap,DA=new WeakMap,LA=new WeakMap,BA=new WeakSet;class zA extends sd{get name(){return"AudioPlaybackManager"}get defaults(){return{muted:!1,volume:1,lookaheadSeconds:1}}constructor(t,e,n){super(n),O(this,BA),F(this,TA,void 0),F(this,EA,void 0),F(this,IA,null),F(this,SA,null),F(this,AA,[]),F(this,NA,new Set),F(this,MA,new Map),F(this,FA,!1),F(this,CA,1),F(this,OA,!0),F(this,PA,null),F(this,RA,null),F(this,DA,null),F(this,LA,null),C(TA,this,t),C(EA,this,e),C(FA,this,!!this.settings.muted),C(CA,this,fm(this.settings.volume));const i=Array.isArray(null==n?void 0:n.disabledTracks)?n.disabledTracks:[];C(OA,this,!i.includes("audio")),A(BA,this,WA).call(this)}get muted(){return M(FA,this)}set muted(t){C(FA,this,!!t),A(BA,this,QA).call(this)}get volume(){return M(CA,this)}set volume(t){C(CA,this,fm(t)),A(BA,this,QA).call(this)}handleDecodedAudio(t={}){if(!M(OA,this))return;const e=null==t?void 0:t.audioBuffer,n=null==t?void 0:t.placementId,i=null==t?void 0:t.segmentId,r=_A(null==t?void 0:t.pts,null);if(!(e&&n&&i&&Number.isFinite(r)))return;const o=Number.isFinite(null==t?void 0:t.duration)?t.duration:e.duration,s=`${n}:${i}`;M(NA,this).has(s)||(M(AA,this).push({key:s,placementId:n,pts:r,duration:o,audioBuffer:e}),M(AA,this).sort(((t,e)=>t.pts-e.pts)),A(BA,this,VA).call(this))}onDispose(){A(BA,this,$A).call(this),A(BA,this,XA).call(this,!0),M(IA,this)&&"function"==typeof M(IA,this).close&&M(IA,this).close(),C(IA,this,null),C(SA,this,null),C(TA,this,null),C(EA,this,null)}}function WA(){M(TA,this)&&"function"==typeof M(TA,this).on&&(C(PA,this,(t=>A(BA,this,jA).call(this,t))),M(TA,this).on(dd.TIMELINE_TIME_UPDATE,M(PA,this)),C(RA,this,(t=>A(BA,this,UA).call(this,t))),M(TA,this).on(dd.TIMELINE_STATE_CHANGE,M(RA,this)),C(LA,this,(()=>A(BA,this,qA).call(this))),M(TA,this).on(dd.TIMELINE_RESET,M(LA,this))),M(EA,this)&&"function"==typeof M(EA,this).on&&(C(DA,this,(t=>this.handleDecodedAudio(t))),M(EA,this).on(dd.DECODER_AUDIO,M(DA,this)))}function $A(){M(TA,this)&&"function"==typeof M(TA,this).off&&(M(PA,this)&&M(TA,this).off(dd.TIMELINE_TIME_UPDATE,M(PA,this)),M(RA,this)&&M(TA,this).off(dd.TIMELINE_STATE_CHANGE,M(RA,this)),M(LA,this)&&M(TA,this).off(dd.TIMELINE_RESET,M(LA,this))),M(EA,this)&&"function"==typeof M(EA,this).off&&M(DA,this)&&M(EA,this).off(dd.DECODER_AUDIO,M(DA,this)),C(PA,this,null),C(RA,this,null),C(DA,this,null),C(LA,this,null)}function jA(){A(BA,this,VA).call(this)}function UA(t={}){const e=null==t?void 0:t.to;if(e)return e===Tv?(A(BA,this,JA).call(this),void A(BA,this,VA).call(this)):void(e!==Sv&&e!==Iv?e!==Av&&e!==Nv||A(BA,this,qA).call(this):A(BA,this,ZA).call(this))}function qA(){A(BA,this,ZA).call(this),A(BA,this,XA).call(this,!0),C(AA,this,[])}function VA(){if(!M(OA,this)||!M(TA,this))return;if(M(TA,this).state!==Tv)return;const t=A(BA,this,YA).call(this);if(!t)return;const e=_A(M(TA,this).currentTime,0),n=e+Math.max(0,_A(this.settings.lookaheadSeconds,1)),i=[];for(let r=0;r<M(AA,this).length;r+=1){const o=M(AA,this)[r];o&&(o.pts>n?i.push(o):A(BA,this,GA).call(this,o)&&A(BA,this,KA).call(this,o,t,e))}C(AA,this,i)}function GA(t){if(!t||!M(TA,this))return!1;const e=A(BA,this,HA).call(this,t.pts);return!(!e||e!==t.placementId)}function HA(t){if(!M(TA,this)||"function"!=typeof M(TA,this).getPlacementsActiveAtTime)return null;const e=M(TA,this).getPlacementsActiveAtTime(t);if(!Array.isArray(e)||!e.length)return null;const n=e.find((t=>null==t?void 0:t.placementId));return n?n.placementId:null}function KA(t,e,n){const i=t.key;if(M(NA,this).has(i))return;const r=t.audioBuffer;if(!r)return;const o=Number.isFinite(t.duration)?t.duration:r.duration,s=t.pts;if(!Number.isFinite(s))return;const a=n-s;if(Number.isFinite(o)&&o>0&&a>=o)return;const l=e.createBufferSource();l.buffer=r,l.connect(M(SA,this));let c=e.currentTime,u=0;a>0?u=a:a<0&&(c=e.currentTime+Math.abs(a));try{l.start(c,u)}catch(t){return void this.log.warn("[AudioPlaybackManager] Failed to start audio buffer",t)}M(NA,this).add(i),M(MA,this).set(i,l),l.onended=()=>{M(MA,this).delete(i)}}function XA(t){M(MA,this).forEach(((t,e)=>{if(t&&"function"==typeof t.stop)try{t.stop()}catch(t){}M(MA,this).delete(e)})),t&&M(NA,this).clear()}function YA(){if(M(IA,this))return M(IA,this);const t=cd.AudioContext||cd.webkitAudioContext;if(!t)return this.log.warn("[AudioPlaybackManager] AudioContext is not available."),null;try{return C(IA,this,new t),C(SA,this,M(IA,this).createGain()),M(SA,this).connect(M(IA,this).destination),A(BA,this,QA).call(this),M(IA,this)}catch(t){return this.log.warn("[AudioPlaybackManager] Failed to initialize AudioContext",t),C(IA,this,null),C(SA,this,null),null}}function QA(){if(!M(SA,this))return;const t=M(FA,this)?0:M(CA,this);M(SA,this).gain.value=t}function JA(){M(IA,this)&&"function"==typeof M(IA,this).resume&&"suspended"===M(IA,this).state&&M(IA,this).resume().catch((()=>{}))}function ZA(){M(IA,this)&&"function"==typeof M(IA,this).suspend&&"running"===M(IA,this).state&&M(IA,this).suspend().catch((()=>{}))}var tN=new WeakMap,eN=new WeakMap,nN=new WeakMap,iN=new WeakMap,rN=new WeakMap,oN=new WeakSet;class sN extends sd{constructor(...t){super(...t),O(this,oN),F(this,tN,void 0),F(this,eN,void 0),F(this,nN,void 0),F(this,iN,void 0),F(this,rN,void 0),C(tN,this,A(oN,this,lN).call(this,this.settings.currentTime)),C(eN,this,A(oN,this,cN).call(this,this.settings.playbackRate)),C(nN,this,null),C(iN,this,!1),C(rN,this,A(oN,this,aN).bind(this))}get name(){return"PlaybackClock"}get defaults(){return{currentTime:0,playbackRate:Ky("playbackRate")}}get currentTime(){return M(tN,this)}get playbackRate(){return M(eN,this)}set playbackRate(t){C(eN,this,A(oN,this,cN).call(this,t))}play(){M(iN,this)||(C(iN,this,!0),C(nN,this,Fy()),pw(M(rN,this),0))}pause(){M(iN,this)&&(C(iN,this,!1),mw(M(rN,this)))}seek(t){C(tN,this,A(oN,this,lN).call(this,t)),C(nN,this,Fy())}reset(){this.pause(),C(tN,this,0),C(nN,this,null)}onDispose(){this.pause(),C(rN,this,null)}}function aN(){const t=Fy();if(null===M(nN,this))return C(nN,this,t),void this.trigger(dd.CLOCK_TICK,{currentTime:M(tN,this)});const e=t-M(nN,this);C(nN,this,t);const n=e/1e3;C(tN,this,M(tN,this)+n*M(eN,this)),this.trigger(dd.CLOCK_TICK,{currentTime:M(tN,this)})}function lN(t){return"number"!=typeof t||Number.isNaN(t)||!Number.isFinite(t)||t<0?0:t}function cN(t){return"number"!=typeof t||Number.isNaN(t)||!Number.isFinite(t)||t<=0?M(eN,this)||1:t}var uN=new WeakMap,dN=new WeakSet;class hN extends sd{constructor(...t){super(...t),O(this,dN),F(this,uN,new Map)}get name(){return"TrackBuffers"}get defaults(){return{}}refreshNode(t){if(!t||!Array.isArray(t.tracks))return;const e=t.id,n=M(uN,this).get(e)||new Map;M(uN,this).set(e,n),t.tracks.forEach((t=>{const i=null==t?void 0:t.type;if(!i)return;const r=t.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(dd.TRACK_BUFFER_UPDATE,{nodeId:e,trackType:i,range:r})),!s&&a?this.trigger(dd.TRACK_READY,{nodeId:e,trackType:i,range:r}):s&&!a&&this.trigger(dd.TRACK_UNDERFLOW,{nodeId:e,trackType:i,range:r})}))}getTrackRange(t,e){const n=M(uN,this).get(t),i=null==n?void 0:n.get(e);return null==i?void 0:i.range}computeBuffered(t=[],e=0,n){if(!n||"function"!=typeof n.get)return;const i=Number.isFinite(e)?e:0;let r,o,s=!1;for(let e=0;e<t.length;e+=1){const a=A(dN,this,pN).call(this,n,t[e],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(uN,this)}reset(){M(uN,this).clear()}onDispose(){M(uN,this).clear(),"function"==typeof this.off&&this.off()}}function fN(t,e=0){const n=Array.isArray(null==t?void 0:t.segments)?t.segments:[],i=[];for(let t=0;t<n.length;t+=1){const e=n[t];if(!e||e.isInit)continue;const r=Number(e.duration),o=Number(e.offset),s=Number(e.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(((t,e)=>t.start-e.start));const r=[i[0]];for(let t=1;t<i.length;t+=1){const e=i[t],n=r[r.length-1];e.start<=n.end+.001?n.end=Math.max(n.end,e.end):r.push({...e})}const o=Number.isFinite(e)?e:0;for(let t=0;t<r.length;t+=1){const e=r[t];if(e.end>o+.001)return e}}function pN(t,e,n=0){var i,r;const o=gm(e);if(!Number.isFinite(o))return;const s=t.get(e.nodeId);if(!s)return;const a=Array.isArray(s.tracks)?s.tracks:[];if(!a.length){const t=s.buffered;if(!t||!Number.isFinite(t.start)||!Number.isFinite(t.end))return;return A(dN,this,mN).call(this,s,t,o,e)}const l=s.mainTrackId,c=Number.isFinite(e.nodeOffsetOverride)?e.nodeOffsetOverride:0,u=Math.max(0,n-o+c);let d;l&&(d=a.find((t=>(null==t?void 0:t.id)===l))),(null===(i=d)||void 0===i?void 0:i.type)||(d=a.find((t=>null==t?void 0:t.type)));const h=A(dN,this,fN).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(dN,this,mN).call(this,s,h,o,e):void 0}function mN(t,e,n,i){const r=Number.isFinite(i.nodeOffsetOverride)?i.nodeOffsetOverride:0;let o=e.start-r+n,s=e.end-r+n;const a=t.duration,l=Number.isFinite(i.nodeDurationOverride)?i.nodeDurationOverride:a;if(Number.isFinite(l)){const t=n+l;s=Math.min(s,t);const e=o<=n&&s>=t;if(o=Math.max(o,n),!(s>o))return;return{start:o,end:s,full:e}}if(o=Math.max(o,n),s>o)return{start:o,end:s,full:!1}}class vN{constructor(t={}){const{placementId:e,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}=t;if(!e)throw new Error("Placement requires placementId");if(!n)throw new Error("Placement requires nodeId");this.placementId=e,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 gN extends sd{constructor(t,e){super(e),this.timeline=t}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"handleDecodedFrame","handleClockTick","handleMainTrackBufferUpdate"])}enter(){}exit(){}play(){this.timeline.transitionTo(Tv)}pause(){this.timeline.transitionTo(Sv)}wait(){this.timeline.transitionTo(Iv)}reset(){this.timeline.transitionTo(Nv)}seek(t){this.timeline.transitionTo(Av,{targetTime:t,returnState:this.timeline.state})}getCurrentTime(){return this.timeline.currentTime}emitPlayerStateEvent(t,e={}){if(!t||!this.timeline||"function"!=typeof this.timeline.trigger)return;const n=Number.isFinite(null==e?void 0:e.time)?e.time:this.getCurrentTime(),i={...e,event:t};Number.isFinite(n)&&(i.time=n),this.timeline.trigger("player:state",i)}get buffered(){return this.timeline.computeBuffered(this.timeline.currentTime)}handleMainTrackUnderflow(t){this.wait()}handleMainTrackReady(t){const e=this.timeline.getLastStableState()||Sv;this.timeline.transitionTo(e)}handleMainTrackBufferUpdate(t){}handleDecodedFrame(t){}handleClockTick(t){}onDispose(){this.timeline=null}}const yN=24e3/1001;function bN(t,e=(null==t?void 0:t.currentTime)){return Number.isFinite(e)?e:Number.isFinite(null==t?void 0:t.currentTime)?t.currentTime:0}function kN(t){var e;const n=Number(null==t||null===(e=t.settings)||void 0===e?void 0:e.snapToFps);return Number.isFinite(n)&&n>0?.5/n:.001}function wN(t){var e;const n=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[];let i;if(null!=t&&t.mainTrackId){const e=n.find((e=>(null==e?void 0:e.id)===t.mainTrackId));i=null==e?void 0:e.type}if(i||(i=null===(e=n.find((t=>null==t?void 0:t.type)))||void 0===e?void 0:e.type),"video"===i||"audio"===i||"image"===i)return i}function xN(t){const e=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[];if(e.length){if(null!=t&&t.mainTrackId){const n=e.find((e=>(null==e?void 0:e.id)===t.mainTrackId));if("video"===(null==n?void 0:n.type)||"image"===(null==n?void 0:n.type))return n}return e.find((t=>"video"===(null==t?void 0:t.type)||"image"===(null==t?void 0:t.type)))}}function _N(t,e,n,i,r){var o,s;const a="function"==typeof(null==t?void 0:t.getDecodedVisualBuffer)?t.getDecodedVisualBuffer(e,n):void 0;if(!a)return"function"==typeof(null==t?void 0:t.hasDecodedFirstFrame)&&t.hasDecodedFirstFrame(e,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 t=0;t<l.length;t+=1){const e=l[t],n=Number(null==e?void 0:e.presentationTime);if(Number.isFinite(n)){if(!(n<=r)){c=n;break}u=e}}const d=Number(null===(s=u)||void 0===s?void 0:s.presentationTime);if(!Number.isFinite(d)||d>r)return!1;const h=function(t,e,n,i){const r=Number(null==n?void 0:n.duration);if(Number.isFinite(r)&&r>0)return e+r;const o=function(t,e){const n=Number(null==t||null===(e=t.settings)||void 0===e?void 0:e.snapToFps);return 2/(Number.isFinite(n)&&n>0?n:yN)}(t),s=Number.isFinite(i)&&i>e?i-e:o;return e+Math.min(s,o)}(t,d,u,c);return!!Number.isFinite(h)&&r<=h+kN(t)}function TN(t,e=(null==t?void 0:t.currentTime)){const n=bN(t,e),i="function"==typeof(null==t?void 0:t.getPlacementsActiveAtTime)?t.getPlacementsActiveAtTime(n):[];if(!i.length)return!1;for(let e=0;e<i.length;e+=1){const n=i[e],r=null==n?void 0:n.placementId;if(!r)return!0;const o="function"==typeof(null==t?void 0:t.getNode)?t.getNode(n.nodeId):void 0;if(!o)return!0;const s=wN(o);if(!s)return!0;if(!t.hasDecodedFirstFrame(r,s))return!0}return!1}function EN(t,e=(null==t?void 0:t.currentTime)){return TN(t,e)||function(t,e=(null==t?void 0:t.currentTime)){const n=bN(t,e),i="function"==typeof(null==t?void 0:t.getPlacementsActiveAtTime)?t.getPlacementsActiveAtTime(n):[];if(!i.length)return!1;for(let e=0;e<i.length;e+=1){const r=i[e],o=null==r?void 0:r.placementId;if(!o)return!0;const s="function"==typeof(null==t?void 0:t.getNode)?t.getNode(r.nodeId):void 0;if(!s)return!0;const a=xN(s);if(null!=a&&a.id&&!_N(t,o,a.id,a.type,n))return!0}return!1}(t,e)}function IN(t,e=(null==t?void 0:t.currentTime)){if("function"!=typeof(null==t?void 0:t.computeBuffered))return!1;const n=bN(t,e),i=t.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=kN(t);if(!(r<=n+s))return!1;return o-n>=function(t,e){const n=Number(null==t||null===(e=t.settings)||void 0===e?void 0:e.waitingBufferAheadSeconds);return!Number.isFinite(n)||n<0?3:n}(t)-s||function(t,e,n,i){const r=function(t){const e=Array.isArray(null==t?void 0:t.placements)?t.placements:[];let n;for(let i=0;i<e.length;i+=1){const r=e[i],o=gm(r);if(!Number.isFinite(o))continue;const s="function"==typeof(null==t?void 0:t.getPlacementDuration)?t.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}(t);return!!Number.isFinite(r)&&(e>=r-i||n>=r-i)}(t,n,o,s)}const SN={[_v]:class extends gN{get name(){return _v}get defaults(){return{autoplay:Ky("autoplay")}}enter(){this.timeline.recordStableState(Sv),this.timeline.stopPlaybackClock()}play(){const t=EN(this.timeline),e=t?Iv:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t)return this.timeline.recordStableState(Tv),void this.timeline.transitionTo(Iv);this.timeline.transitionTo(e)}pause(){}handleDecodedFrame(t){if(!0!==this.settings.autoplay)return;if(!Array.isArray(this.timeline.placements)||!this.timeline.placements.length)return;if(EN(this.timeline))return;const e=this.timeline.getPlaybackStartState();this.log.info("[handleDecodedFrame] Autoplay enabled, starting playback!"),this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),this.timeline.transitionTo(e)}},[Ev]:class extends gN{get name(){return Ev}enter(t={}){const{from:e,to:n}=t;this.timeline.recordStableState(Tv),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("canplay",{from:e,to:n})}play(){}handleMainTrackUnderflow(){}pause(){this.timeline.transitionTo(Sv)}},[Tv]:class extends gN{get name(){return Tv}enter(t={}){const{from:e,to:n,fromFirstFramePending:i}=t;this.timeline.recordStableState(Tv),this.timeline.startPlaybackClock(),!0!==i&&this.emitPlayerStateEvent("canplay",{from:e,to:n}),this.emitPlayerStateEvent("playing",{from:e,to:n})}play(){}pause(){this.timeline.transitionTo(Sv)}handleClockTick(t){const e=this.timeline.currentTime;EN(this.timeline,e)&&(this.timeline.recordStableState(Tv),this.timeline.transitionTo(Iv))}},[Iv]:(Je=new WeakMap,Ze=new WeakMap,tn=new WeakSet,class extends gN{constructor(...t){super(...t),O(this,tn),F(this,Je,void 0),F(this,Ze,null)}get name(){return Iv}enter(t={}){const{from:e,to:n}=t;this.timeline.stopPlaybackClock(),A(tn,this,AN).call(this),A(tn,this,MN).call(this),this.emitPlayerStateEvent("waiting",{from:e,to:n}),A(tn,this,ON).call(this)}exit(){A(tn,this,NN).call(this),A(tn,this,FN).call(this)}play(){this.timeline.recordStableState(Tv);const t=A(tn,this,CN).call(this),e=t?Iv:this.timeline.getPlaybackStartState();this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t||this.timeline.transitionTo(e)}pause(){this.timeline.transitionTo(Sv)}handleMainTrackReady(t){const e=this.timeline.getLastStableState()||Sv;e!==Tv?this.timeline.transitionTo(e):A(tn,this,ON).call(this)}handleDecodedFrame(t){A(tn,this,ON).call(this)}handleMainTrackBufferUpdate(t){A(tn,this,ON).call(this)}}),[Sv]:class extends gN{get name(){return Sv}enter(t={}){const{from:e,to:n}=t;this.timeline.recordStableState(Sv),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("pause",{from:e,to:n})}play(){const t=EN(this.timeline),e=t?Iv:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t)return this.timeline.recordStableState(Tv),void this.timeline.transitionTo(Iv);this.timeline.transitionTo(e)}pause(){}},[Av]:class extends gN{get name(){return Av}enter(t={}){const{targetTime:e,returnState:n}=t;if(this.timeline&&"function"==typeof this.timeline.stopPlaybackClock&&this.timeline.stopPlaybackClock(),this.timeline&&"function"==typeof this.timeline.startSeeking)return void this.timeline.startSeeking(e,n);this.timeline.updateTime(e);const i=n===Tv||n===Ev,r=i&&"function"==typeof this.timeline.getPlaybackStartState?this.timeline.getPlaybackStartState(e):i?Tv:Sv;this.timeline.transitionTo(r,{fromSeeking:!0})}play(){var t;if(this.timeline&&"function"==typeof this.timeline.setSeekReturnState)return void this.timeline.setSeekReturnState(Tv);const e="function"==typeof(null===(t=this.timeline)||void 0===t?void 0:t.getPlaybackStartState)?this.timeline.getPlaybackStartState():Tv;this.timeline.transitionTo(e)}pause(){this.timeline&&"function"==typeof this.timeline.setSeekReturnState?this.timeline.setSeekReturnState(Sv):this.timeline.transitionTo(Sv)}handleDecodedFrame(t){this.timeline&&"function"==typeof this.timeline.maybeCompleteSeek&&this.timeline.maybeCompleteSeek(t)}},[Nv]:class extends gN{get name(){return Nv}enter(){this.timeline.resetClock(),this.timeline.transitionTo(_v,{fromReset:!0})}play(){}pause(){}get buffered(){return{start:0,end:0}}}};function AN(){var t;const e=null===(t=this.timeline)||void 0===t?void 0:t.trackBuffers;e&&"function"==typeof e.on&&(C(Je,this,(t=>this.handleMainTrackBufferUpdate(t))),e.on(dd.TRACK_BUFFER_UPDATE,M(Je,this)))}function NN(){var t;const e=null===(t=this.timeline)||void 0===t?void 0:t.trackBuffers;M(Je,this)&&e&&"function"==typeof e.off?(e.off(dd.TRACK_BUFFER_UPDATE,M(Je,this)),C(Je,this,null)):C(Je,this,null)}function MN(){if(null!==M(Ze,this))return;const t="function"==typeof(null==cd?void 0:cd.setInterval)?cd.setInterval.bind(cd):setInterval;C(Ze,this,t((()=>{var t;(null===(t=this.timeline)||void 0===t?void 0:t.state)===Iv&&A(tn,this,ON).call(this)}),200))}function FN(){null!==M(Ze,this)&&(("function"==typeof(null==cd?void 0:cd.clearInterval)?cd.clearInterval.bind(cd):clearInterval)(M(Ze,this)),C(Ze,this,null))}function CN(t=(t=>null===(t=this.timeline)||void 0===t?void 0:t.currentTime)()){return function(t,e=(null==t?void 0:t.currentTime),n={}){return!!TN(t,e)||!0===n.skipBufferResume||!IN(t,e)}(this.timeline,t)}function ON(t=(t=>null===(t=this.timeline)||void 0===t?void 0:t.currentTime)()){return(this.timeline.getLastStableState()||Sv)===Tv&&!A(tn,this,CN).call(this,t)&&(this.timeline.transitionTo(this.timeline.getPlaybackStartState(t)),!0)}function PN(t){return t&&("string"!=typeof t.state||"ready"===t.state)}function RN(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).some((t=>"video"===(null==t?void 0:t.type)))}function DN(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).some((t=>"video"===(null==t?void 0:t.type)||"image"===(null==t?void 0:t.type)))}function LN(t){return t===Tv||t===Ev}var BN=new WeakMap,zN=new WeakMap,WN=new WeakMap,$N=new WeakMap,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 WeakMap,QN=new WeakMap,JN=new WeakSet;class ZN{constructor(t={}){O(this,JN),F(this,BN,void 0),F(this,zN,void 0),F(this,WN,void 0),F(this,$N,void 0),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,null),F(this,KN,Sv),F(this,XN,[]),F(this,YN,new Set),F(this,QN,new Map),C(BN,this,t.getState),C(zN,this,t.getNode),C(WN,this,t.getPlacementsActiveAtTime),C($N,this,t.getLastStableState),C(jN,this,t.getPlaybackStartState),C(UN,this,t.clearVisualFrameBuffers),C(qN,this,t.updateTime),C(VN,this,t.transitionTo),C(GN,this,t.trigger)}start(t,e){const n=Number(t);if(!Number.isFinite(n))return;let i=e;i===Av?i=M(KN,this):i===Iv&&"function"==typeof M($N,this)&&(i=M($N,this).call(this)),C(KN,this,LN(i)?Tv:Sv),C(HN,this,n),M(YN,this).clear(),M(QN,this).clear(),C(XN,this,"function"==typeof M(WN,this)?M(WN,this).call(this,n):[]),"function"==typeof M(UN,this)&&M(UN,this).call(this),"function"==typeof M(qN,this)&&M(qN,this).call(this,n,{source:"seek"}),"function"==typeof M(GN,this)&&M(GN,this).call(this,dd.TIMELINE_SEEKING,{targetTime:n,placements:M(XN,this).slice()}),this.maybeComplete()}setReturnState(t){C(KN,this,LN(t)?Tv:Sv)}maybeComplete(t){if(("function"==typeof M(BN,this)?M(BN,this).call(this):void 0)!==Av)return;const e=M(HN,this);if(!Number.isFinite(e))return;const n=null==t?void 0:t.trackType,i=null==t?void 0:t.placementId;if(i&&"video"===n){const n=Number(null==t?void 0:t.pts);if(Number.isFinite(n)&&n>=e){M(YN,this).add(i);const t=M(QN,this).get(i);(!Number.isFinite(t)||n<t)&&M(QN,this).set(i,n)}}else i&&"image"===n&&function(t,e){const n=Number(null==t?void 0:t.pts),i=Number(null==t?void 0:t.duration);return!Number.isFinite(n)||(Number.isFinite(i)&&i>0?e>=n&&e<n+i:e>=n)}(t,e)&&M(YN,this).add(i);const r=Array.isArray(M(XN,this))?M(XN,this):[];if(r.length){if("function"==typeof M(zN,this)){for(let t=0;t<r.length;t+=1){const e=r[t],n=null==e?void 0:e.placementId;if(!n)return;const i=M(zN,this).call(this,e.nodeId);if(!PN(i))return;if(DN(i)&&!M(YN,this).has(n))return}A(JN,this,tM).call(this,e,r)}}else A(JN,this,tM).call(this,e,[])}dispose(){C(XN,this,[]),M(YN,this).clear(),M(QN,this).clear(),C(HN,this,null)}}function tM(t,e){const n=A(JN,this,eM).call(this,t,e);if("function"==typeof M(qN,this)&&M(qN,this).call(this,n,{source:"seek"}),C(HN,this,null),C(XN,this,[]),M(YN,this).clear(),M(QN,this).clear(),"function"==typeof M(GN,this)&&M(GN,this).call(this,dd.TIMELINE_SEEKED,{targetTime:t,placements:Array.isArray(e)?e.slice():[]}),"function"==typeof M(VN,this)){const t=M(KN,this)===Tv&&"function"==typeof M(jN,this)?M(jN,this).call(this,n):M(KN,this);M(VN,this).call(this,t,{fromSeeking:!0})}}function eM(t,e){const n=Number(t);if(!Number.isFinite(n))return t;if(!Array.isArray(e)||!e.length||"function"!=typeof M(zN,this))return n;let i=n;for(let t=0;t<e.length;t+=1){const n=e[t],r=null==n?void 0:n.placementId;if(!r)continue;if(!RN(M(zN,this).call(this,n.nodeId)))continue;const o=M(QN,this).get(r);Number.isFinite(o)&&o>i&&(i=o)}return i}function nM(t){if(t&&"function"==typeof t.close)try{t.close()}catch(t){}}function iM(t){if(!t)return;const e=Array.isArray(null==t?void 0:t.frames)?t.frames:[],n=null==t?void 0:t.current;(n?[n,...e]:e).forEach((t=>nM(null==t?void 0:t.frame)))}function rM(t){return gm(t)}function oM(t){return Number.isFinite(null==t?void 0:t.loopRootOffset)?t.loopRootOffset:rM(t)}function sM(t,e){return"string"==typeof(null==t?void 0:t.loopRootPlacementId)&&t.loopRootPlacementId?t.loopRootPlacementId:e}function aM(t){if("string"!=typeof t)return Number.NaN;const e=t.match(/(\d+)/);return e?Number(e[1]):Number.NaN}function lM(t){if(!t)return;const e=[[t.displayWidth,t.displayHeight],[t.codedWidth,t.codedHeight],[t.videoWidth,t.videoHeight],[t.naturalWidth,t.naturalHeight],[t.width,t.height]];for(let t=0;t<e.length;t+=1){const[n,i]=e[t],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}const cM=1e-6;function uM(t){return t&&("string"!=typeof t.state||"ready"===t.state)}function dM(t){const e=Number(t);return Number.isFinite(e)?e:0}function hM(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).filter((t=>"cue"===(null==t?void 0:t.type)&&Array.isArray(null==t?void 0:t.cues)))}function fM(t){return t&&"cue"===t.type&&Array.isArray(t.cues)?t.cues:[]}var 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 WeakSet;class _M{constructor(t={}){O(this,xM),F(this,pM,void 0),F(this,mM,void 0),F(this,vM,void 0),F(this,gM,void 0),F(this,yM,void 0),F(this,bM,void 0),F(this,kM,-1e-6),F(this,wM,null),C(pM,this,t.getPlacements),C(mM,this,t.getPlacementsActiveAtTime),C(vM,this,t.getPlacementDuration),C(gM,this,t.getNode),C(yM,this,t.triggerTimeline),C(bM,this,t.triggerNode)}handleSeeking(t,e){const n=dM(t);C(wM,this,n)}handleSeeked(t){const e=dM(t),n=M(wM,this);C(wM,this,null),Number.isFinite(n)?(A(xM,this,EM).call(this,n,e),C(kM,this,e)):C(kM,this,e)}handleTimeUpdate(t,e={}){const n=dM(t),i=M(kM,this);!0===(null==e?void 0:e.isSeeking)?C(kM,this,n):Number.isFinite(i)?n<=i?n<i&&C(kM,this,n-cM):(A(xM,this,TM).call(this,i,n),C(kM,this,n)):C(kM,this,n)}dispose(){C(wM,this,null),C(kM,this,-1e-6)}}function TM(t,e){const n="function"==typeof M(pM,this)?M(pM,this).call(this):[];A(xM,this,IM).call(this,n,t,e,{onlySticky:!1})}function EM(t,e){if("function"!=typeof M(mM,this))return;const n=M(mM,this).call(this,e);A(xM,this,IM).call(this,n,t,e,{onlySticky:!0})}function IM(t,e,n,i={}){if("function"!=typeof M(gM,this)||"function"!=typeof M(yM,this))return;if(!Array.isArray(t)||!t.length)return;const r=!0===i.onlySticky,o=[];for(let i=0;i<t.length;i+=1){const s=t[i],a=null==s?void 0:s.placementId,l=null==s?void 0:s.nodeId;if(!a||!l)continue;const c=M(gM,this).call(this,l);if(!uM(c))continue;const u=hM(c);if(!u.length)continue;const d=gm(s);if(!Number.isFinite(d))continue;const h=Number.isFinite(null==s?void 0:s.nodeOffsetOverride)?s.nodeOffsetOverride:0,f="function"==typeof M(vM,this)?M(vM,this).call(this,s):void 0,p="number"==typeof f&&Number.isFinite(f)?d+f:Number.POSITIVE_INFINITY,m=r?d-cM:e;for(let t=0;t<u.length;t+=1){const e=fM(u[t]);for(let i=0;i<e.length;i+=1){const s=e[i],c=dM(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:t,cueIndex:i}))}}}o.length&&(o.sort(((t,e)=>t.time!==e.time?t.time-e.time:t.placementOffset!==e.placementOffset?t.placementOffset-e.placementOffset:t.placementId!==e.placementId?t.placementId<e.placementId?-1:1:t.trackIndex!==e.trackIndex?t.trackIndex-e.trackIndex:t.cueIndex-e.cueIndex)),o.forEach((t=>{const e=t.cuepoint,n={time:t.time,nodeId:t.nodeId,placementId:t.placementId,cuepoint:e};M(yM,this).call(this,"cuepoint",n),M(yM,this).call(this,e.name,n),"function"==typeof M(bM,this)&&(M(bM,this).call(this,t.nodeId,"cuepoint",n),M(bM,this).call(this,t.nodeId,e.name,n))})))}let SM=class{#J;#Z=0;#tt=new Set;constructor(t){this.#J="string"==typeof t?t:""}claim(t){if(t)return this.#tt.add(t),t;let e;do{e=`${this.#J}${++this.#Z}`}while(this.#tt.has(e));return this.#tt.add(e),e}reset(){this.#Z=0,this.#tt.clear()}};const AM=24e3/1001;function NM(t){var e;const n=null==t?void 0:t.frame;if(!n||!0===n.__closed||!0===n.closed)return 0;if("function"==typeof n.allocationSize)try{const t=Number(n.allocationSize());if(Number.isFinite(t)&&t>0)return t}catch(t){}const i=Number(null==n?void 0:n.byteLength);if(Number.isFinite(i)&&i>0)return i;const r=Number(null==n||null===(e=n.data)||void 0===e?void 0:e.byteLength);if(Number.isFinite(r)&&r>0)return r;const o=function(t,e){const n=Number(null==t?void 0:t.width),i=Number(null==t?void 0:t.height);return Number.isFinite(n)&&Number.isFinite(i)&&n>0&&i>0?{width:n,height:i}:lM(e)}(t,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 MM=new WeakMap,FM=new WeakMap,CM=new WeakMap,OM=new WeakMap,PM=new WeakMap,RM=new WeakMap,DM=new WeakMap,LM=new WeakMap,BM=new WeakMap,zM=new WeakMap,WM=new WeakMap,$M=new WeakMap,jM=new WeakMap,UM=new WeakMap,qM=new WeakMap,VM=new WeakMap,GM=new WeakMap,HM=new WeakMap,KM=new WeakMap,XM=new WeakMap,YM=new WeakMap,QM=new WeakMap,JM=new WeakMap,ZM=new WeakMap,tF=new WeakMap,eF=new WeakMap,nF=new WeakMap,iF=new WeakMap,rF=new WeakMap,oF=new WeakMap,sF=new WeakMap,aF=new WeakMap,lF=new WeakMap,cF=new WeakSet;class uF extends sd{constructor(...t){super(...t),O(this,cF),F(this,MM,void 0),F(this,FM,void 0),F(this,CM,void 0),F(this,OM,void 0),F(this,PM,void 0),F(this,RM,!1),F(this,DM,[]),F(this,LM,new SM("placement-")),F(this,BM,[]),F(this,zM,new SM("renderplacement-")),F(this,WM,void 0),F(this,$M,void 0),F(this,jM,void 0),F(this,UM,!1),F(this,qM,new Set),F(this,VM,new Set),F(this,GM,new Map),F(this,HM,[]),F(this,KM,0),F(this,XM,new Set),F(this,YM,new Set),F(this,QM,Number.NEGATIVE_INFINITY),F(this,JM,[]),F(this,ZM,Number.NEGATIVE_INFINITY),F(this,tF,0),F(this,eF,void 0),F(this,nF,void 0),F(this,iF,new Map),F(this,rF,null),F(this,oF,void 0),F(this,sF,void 0),F(this,aF,void 0),F(this,lF,void 0);const[e,n={}]=t;C(MM,this,e),C(eF,this,n),C(PM,this,new sN(n)),C(WM,this,new hN(n)),C(OM,this,Sv),A(cF,this,wF).call(this),A(cF,this,xF).call(this),C(oF,this,new ZN({getState:()=>this.state,getNode:t=>M(MM,this)&&"function"==typeof M(MM,this).get?M(MM,this).get(t):void 0,getPlacementsActiveAtTime:t=>A(cF,this,eC).call(this,t,{endEpsilonSeconds:A(cF,this,uC).call(this)}),getLastStableState:()=>this.getLastStableState(),getPlaybackStartState:t=>this.getPlaybackStartState(t),clearVisualFrameBuffers:()=>A(cF,this,ZF).call(this),updateTime:(t,e)=>this.updateTime(t,e),transitionTo:(t,e)=>this.transitionTo(t,e),trigger:(t,e)=>this.trigger(t,e)})),C(sF,this,new _M({getPlacements:()=>M(DM,this).slice(),getPlacementsActiveAtTime:t=>A(cF,this,eC).call(this,t),getPlacementDuration:t=>A(cF,this,DF).call(this,t),getNode:t=>M(MM,this)&&"function"==typeof M(MM,this).get?M(MM,this).get(t):void 0,triggerTimeline:(t,e)=>this.trigger(t,e),triggerNode:(t,e,n)=>{const i=M(MM,this)&&"function"==typeof M(MM,this).get?M(MM,this).get(t):void 0;i&&"function"==typeof i.trigger&&i.trigger(e,n)}})),C(aF,this,(()=>{var t,e;null===(t=M(sF,this))||void 0===t||null===(e=t.handleSeeked)||void 0===e||e.call(t,this.currentTime)})),this.on(dd.TIMELINE_SEEKED,M(aF,this)),C(lF,this,(t=>A(cF,this,NF).call(this,t))),this.on("nodestart",M(lF,this)),this.transitionTo(_v)}get name(){return"Timeline"}get defaults(){return{snapToFps:AM,maxBufferedVideoFrames:24}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"computeBuffered","notifyDecodedFrame","getDecodedFrameStats","getActiveRenderPlacement","maybeCompleteSeek","getPlacementsActiveAtTime","hasDecodedFirstFrame","getDecodedVisualBuffer","getPlacementDuration","getNode"])}transitionTo(t,e={}){const n=M(CM,this),i=function(t,e,n={}){const i=SN[t];return i?new i(e,n):null}(t,this,M(eF,this)),r=e&&"object"==typeof e&&!Array.isArray(e)?{...e,from:n,to:t}:{from:n,to:t};i?(M(FM,this)&&"function"==typeof M(FM,this).exit&&M(FM,this).exit(),C(FM,this,i),C(CM,this,t),"function"==typeof i.enter&&i.enter(r),this.trigger(dd.TIMELINE_STATE_CHANGE,{from:n,to:t,options:e})):this.log.warn(`Unknown state "${t}"`)}recordStableState(t){C(OM,this,t)}getLastStableState(){return M(OM,this)}enableFirstFrameRenderedGate(){C(RM,this,!0)}getPlaybackStartState(t=this.currentTime){return this.shouldWaitForFirstRenderedFrame(t)?Ev:Tv}shouldWaitForFirstRenderedFrame(t=this.currentTime){if(!M(RM,this)||M(UM,this))return!1;const e=Number.isFinite(t)?t:this.currentTime,n=A(cF,this,eC).call(this,e);return Array.isArray(n)&&n.length>0}notifyFirstFrameRendered(){M(UM,this)||(C(UM,this,!0),this.state===Ev&&this.transitionTo(Tv,{fromFirstFramePending:!0}))}get state(){return M(CM,this)}get paused(){return M(CM,this)===_v||M(CM,this)===Sv}get currentTime(){return M(PM,this).currentTime}set currentTime(t){M(FM,this).seek(t)}get playbackRate(){return M(PM,this).playbackRate}set playbackRate(t){M(PM,this).playbackRate=t}play(){M(FM,this).play()}pause(){M(FM,this).pause()}reset(){M(FM,this).reset()}seekToPlacement(t){if(!t)throw new Error("Timeline.seekToPlacement requires placement id");A(cF,this,CF).call(this);const e=A(cF,this,sC).call(this,t);if(!e)throw new Error("Timeline.seekToPlacement requires placement id");const n=gm(e);if(!Number.isFinite(n))throw new Error("Timeline.seekToPlacement requires resolved placement offset");return this.currentTime=n,n}updateTime(t,e={}){var n,i;A(cF,this,CF).call(this),A(cF,this,OF).call(this),M(PM,this).seek(t),A(cF,this,tC).call(this,this.currentTime),A(cF,this,nC).call(this);const r="string"==typeof(null==e?void 0:e.source)?e.source:"set";null!==(n=M(sF,this))&&void 0!==n&&null!==(i=n.handleTimeUpdate)&&void 0!==i&&i.call(n,this.currentTime,{isSeeking:this.state===Av}),A(cF,this,MF).call(this,this.currentTime),A(cF,this,KF).call(this,this.currentTime),this.trigger(dd.TIMELINE_TIME_UPDATE,hd(this.currentTime,r))}startSeeking(t,e){var n,i;null!==(n=M(sF,this))&&void 0!==n&&null!==(i=n.handleSeeking)&&void 0!==i&&i.call(n,this.currentTime,t),M(oF,this)&&"function"==typeof M(oF,this).start&&M(oF,this).start(t,e)}setSeekReturnState(t){M(oF,this)&&"function"==typeof M(oF,this).setReturnState&&M(oF,this).setReturnState(t)}maybeCompleteSeek(t){M(oF,this)&&"function"==typeof M(oF,this).maybeComplete&&M(oF,this).maybeComplete(t)}startPlaybackClock(){M(PM,this).play()}stopPlaybackClock(){M(PM,this).pause()}resetClock(){var t,e;C(UM,this,!1),M(PM,this).reset(),this.trigger(dd.TIMELINE_RESET,{reason:"reset"}),null===(t=M(sF,this))||void 0===t||null===(e=t.dispose)||void 0===e||e.call(t)}applyTimelineDefinition(t={}){const e=Array.isArray(null==t?void 0:t.placements)?t.placements:[],n=Array.isArray(null==t?void 0:t.renderPlacements)?t.renderPlacements:[];A(cF,this,dF).call(this),A(cF,this,hF).call(this,e),A(cF,this,fF).call(this,n),this.currentTime=0}placeOnTimeline(t,e,n={}){const i=t&&"object"==typeof t?t.id:t;if(!i)throw new Error("Timeline.placeOnTimeline requires node id");const r=M(LM,this).claim(n.placementId),o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=_m(e);if("string"==typeof e&&e.includes("@")&&!a)throw new Error("Timeline.placeOnTimeline requires valid placement reference");const{wantsEndOffset:l,endOffsetSeconds:c}=a?{wantsEndOffset:!1}:xm(e,n);let u,d,h,f=!1;const p=null!==a;if(A(cF,this,CF).call(this),a){const t=M(DM,this).find((t=>(null==t?void 0:t.placementId)===a.placementId));if(!t)throw new Error("Timeline.placeOnTimeline requires valid placement reference");d=t.placementId,h=a.anchor;const e=gm(t);if("start"===a.anchor)Number.isFinite(e)?u=A(cF,this,LF).call(this,e,{nodeOffsetOverride:o}):f=!0;else{const n=A(cF,this,DF).call(this,t);if(Number.isFinite(e)&&n>0){const t=e+n,i=A(cF,this,LF).call(this,t,{nodeOffsetOverride:o});u=Math.max(i,t)}else f=!0}}else if(l){const t=n.offsetAnchorPlacementId?M(DM,this).find((t=>(null==t?void 0:t.placementId)===n.offsetAnchorPlacementId)):M(DM,this).length?M(DM,this)[M(DM,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==t?void 0:t.placementId),d){const e=gm(t),n=A(cF,this,DF).call(this,t);Number.isFinite(e)&&n>0?u=A(cF,this,LF).call(this,e+n-c,{nodeOffsetOverride:o}):(f=!0,h="end")}else u=A(cF,this,LF).call(this,-c,{nodeOffsetOverride:o})}else u=wm(e),u=A(cF,this,LF).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 vN({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(DM,this).push(y),bm(M(DM,this)),A(cF,this,GF).call(this,y),A(cF,this,qF).call(this),f&&d){const t=M(DM,this).find((t=>(null==t?void 0:t.placementId)===d));A(cF,this,zF).call(this,null==t?void 0:t.nodeId)}return this.trigger(dd.PLACEMENT_ADDED,y),r}placeRenderNodeOnTimeline(t,e,n,i={}){const r="string"==typeof t?t:null==t?void 0:t.type;if(!r||"string"!=typeof r)throw new Error("Timeline.placeRenderNodeOnTimeline requires render node type");const o=A(cF,this,BF).call(this,e,i),s=o.offset,a=!0===o.offsetPending,l=o.offsetAnchorPlacementId,c=o.offsetAnchorEdge,u=o.offsetAnchorIsReference,d=M(zM,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 t=s,e=s+p;Tm(M(BM,this),t,e,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements")}if(M(BM,this).push(v),bm(M(BM,this)),a&&l){const t=M(DM,this).find((t=>(null==t?void 0:t.placementId)===l));A(cF,this,zF).call(this,null==t?void 0:t.nodeId)}return this.trigger(dd.RENDER_PLACEMENT_ADDED,v),d}get placements(){return M(DM,this).slice()}getPlacementsActiveAtTime(t){return A(cF,this,eC).call(this,t)}getNodesAtTime(t){const e=A(cF,this,aC).call(this,t);if(!Number.isFinite(e))return[];const n=A(cF,this,eC).call(this,e),i=[];return n.forEach((t=>{const e=this.getNode(null==t?void 0:t.nodeId);e&&i.push(e)})),i}getPlacementDuration(t){return A(cF,this,DF).call(this,t)}getNode(t){if(M(MM,this)&&"function"==typeof M(MM,this).get)return M(MM,this).get(t)}get renderPlacements(){return M(BM,this).slice()}get placementsAhead(){const t=this.currentTime;return M(DM,this).filter((e=>{const n=gm(e);if(!Number.isFinite(n))return!1;const i=A(cF,this,DF).call(this,e);return"number"==typeof i?n+i>t:n>=t}))}get buffered(){return M(FM,this)?M(FM,this).buffered:{start:0,end:0}}get trackBuffers(){return M(WM,this)}onDispose(){A(cF,this,bF).call(this),M(VM,this)&&M(VM,this).clear(),M(sF,this)&&"function"==typeof M(sF,this).dispose&&M(sF,this).dispose(),C(sF,this,null),A(cF,this,yF).call(this),A(cF,this,kF).call(this),M(oF,this)&&"function"==typeof M(oF,this).dispose&&M(oF,this).dispose(),C(oF,this,null),M(PM,this)&&"function"==typeof M(PM,this).dispose&&(M(nF,this)&&"function"==typeof M(PM,this).off&&(M(PM,this).off("tick",M(nF,this)),C(nF,this,null)),M(PM,this).dispose(),C(PM,this,null)),A(cF,this,jF).call(this),C(FM,this,null),C(CM,this,null),C(DM,this,[]),C(BM,this,[]),A(cF,this,UF).call(this),A(cF,this,qF).call(this),M(iF,this).clear(),C(rF,this,null)}notifyDecodedFrame(t={}){const e=null==t?void 0:t.placementId,n=null==t?void 0:t.trackType;if(!e||!n)return;const i=`${e}:${n}`;M(qM,this).add(i),A(cF,this,JF).call(this,t),A(cF,this,nC).call(this),M(FM,this)&&"function"==typeof M(FM,this).handleDecodedFrame&&M(FM,this).handleDecodedFrame(t)}getDecodedFrameStats(){return function(t){const e={totalBytes:0,frames:0,available:!1};if(!t||"function"!=typeof t.values)return e;for(const n of t.values()){const t=[];null!=n&&n.current&&t.push(n.current),Array.isArray(null==n?void 0:n.frames)&&t.push(...n.frames),t.forEach((t=>{const n=null==t?void 0:t.frame;if(!n||!0===n.__closed||!0===n.closed)return;e.frames+=1;const i=NM(t);Number.isFinite(i)&&i>0&&(e.totalBytes+=i)}))}return e.available=!0,e}(M(iF,this))}hasDecodedFirstFrame(t,e){return!(!t||!e)&&M(qM,this).has(`${t}:${e}`)}getDecodedVisualBuffer(t,e){if(t&&e)return M(iF,this).get(`${t}:${e}`)}computeBuffered(t){const e=M(MM,this);if(e&&"function"==typeof e.get)return M(WM,this).computeBuffered(M(DM,this),t,e)}getActiveRenderPlacement(t=this.currentTime){const e=Number.isFinite(t)?t:this.currentTime,n=Array.isArray(M(BM,this))?M(BM,this):[];if(!n.length)return;let i;for(let t=0;t<n.length;t+=1){const r=n[t];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?e>=o&&e<o+s:e>=o)&&(i=r)}return i}}function dF(){C(UM,this,!1),this.trigger(dd.TIMELINE_RESET,{reason:"switch"}),A(cF,this,ZF).call(this),M(WM,this)&&"function"==typeof M(WM,this).reset&&M(WM,this).reset(),M(VM,this)&&M(VM,this).clear(),C(DM,this,[]),C(BM,this,[]),A(cF,this,UF).call(this),A(cF,this,qF).call(this),M(LM,this).reset(),M(zM,this).reset()}function hF(t=[]){for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||!n.nodeId)continue;const i=A(cF,this,pF).call(this,n),r=A(cF,this,vF).call(this,n);this.placeOnTimeline(n.nodeId,r,i)}}function fF(t=[]){for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||!n.type)continue;const i=A(cF,this,mF).call(this,n),r=A(cF,this,gF).call(this,n);this.placeRenderNodeOnTimeline(n.type,r,n.duration,i)}}function pF(t){const e={};return t.placementId&&(e.placementId=t.placementId),Number.isFinite(t.nodeOffsetOverride)&&(e.nodeOffsetOverride=t.nodeOffsetOverride),Number.isFinite(t.nodeDurationOverride)&&(e.nodeDurationOverride=t.nodeDurationOverride),!0===t.offsetPending&&(e.offsetPending=!0,t.offsetAnchorPlacementId&&(e.offsetAnchorPlacementId=t.offsetAnchorPlacementId),t.offsetAnchorEdge&&(e.offsetAnchorEdge=t.offsetAnchorEdge)),Number.isFinite(t.offsetEndSeconds)&&(e.offsetEndSeconds=t.offsetEndSeconds),!0===t.loop&&(e.loop=!0),t.loopRootPlacementId&&(e.loopRootPlacementId=t.loopRootPlacementId),Number.isFinite(t.loopRootOffset)&&(e.loopRootOffset=t.loopRootOffset),e}function mF(t){const e={};return t.renderPlacementId&&(e.renderPlacementId=t.renderPlacementId),t.params&&"object"==typeof t.params&&(e.params=t.params),e}function vF(t){if(!0===t.offsetPending&&t.offsetAnchorPlacementId&&t.offsetAnchorEdge){if(!0===t.offsetAnchorIsReference)return`${t.offsetAnchorPlacementId}@${t.offsetAnchorEdge}`;if("end"===t.offsetAnchorEdge)return Number.isFinite(t.offsetEndSeconds)&&t.offsetEndSeconds>0?-t.offsetEndSeconds:"end"}return"string"==typeof t.offset||Number.isFinite(t.offset)?t.offset:0}function gF(t){return!0===t.offsetPending&&t.offsetAnchorPlacementId&&t.offsetAnchorEdge&&!0===t.offsetAnchorIsReference?`${t.offsetAnchorPlacementId}@${t.offsetAnchorEdge}`:"string"==typeof t.offset||Number.isFinite(t.offset)?t.offset:0}function yF(){M(FM,this)&&"function"==typeof M(FM,this).exit&&M(FM,this).exit()}function bF(){M(aF,this)&&"function"==typeof this.off&&(this.off(dd.TIMELINE_SEEKED,M(aF,this)),C(aF,this,null)),M(lF,this)&&"function"==typeof this.off&&(this.off("nodestart",M(lF,this)),C(lF,this,null))}function kF(){M(WM,this)&&(M($M,this)&&(M(WM,this).off("track:underflow",M($M,this)),C($M,this,null)),M(jM,this)&&(M(WM,this).off("track:ready",M(jM,this)),C(jM,this,null)),"function"==typeof M(WM,this).dispose&&M(WM,this).dispose(),C(WM,this,null))}function wF(){M(WM,this)&&"function"==typeof M(WM,this).on&&(C($M,this,(t=>A(cF,this,TF).call(this,t))),C(jM,this,(t=>A(cF,this,EF).call(this,t))),M(WM,this).on(dd.TRACK_UNDERFLOW,M($M,this)),M(WM,this).on(dd.TRACK_READY,M(jM,this)))}function xF(){M(PM,this)&&"function"==typeof M(PM,this).on&&(C(nF,this,(t=>A(cF,this,_F).call(this,t))),M(PM,this).on(dd.CLOCK_TICK,M(nF,this)))}function _F(t){var e,n;A(cF,this,CF).call(this),A(cF,this,nC).call(this),null!==(e=M(sF,this))&&void 0!==e&&null!==(n=e.handleTimeUpdate)&&void 0!==n&&n.call(e,this.currentTime,{isSeeking:!1}),A(cF,this,MF).call(this,this.currentTime),this.trigger(dd.TIMELINE_TIME_UPDATE,hd(this.currentTime,"clock")),M(FM,this)&&"function"==typeof M(FM,this).handleClockTick&&M(FM,this).handleClockTick(t)}function TF(t){A(cF,this,CF).call(this);const e=A(cF,this,IF).call(this);e&&(null==t?void 0:t.trackType)===e.trackType&&(M(FM,this)&&"function"==typeof M(FM,this).handleMainTrackUnderflow?M(FM,this).handleMainTrackUnderflow(t):this.transitionTo(Iv))}function EF(t){if(A(cF,this,CF).call(this),this.state!==Iv)return;const e=A(cF,this,IF).call(this);if(!e)return;if((null==t?void 0:t.trackType)!==e.trackType)return;if(M(FM,this)&&"function"==typeof M(FM,this).handleMainTrackReady)return void M(FM,this).handleMainTrackReady(t);const n=this.getLastStableState()||Sv;this.transitionTo(n)}function IF(t=this.currentTime){const e=A(cF,this,AF).call(this,t);if(!e)return;const n=M(MM,this)&&"function"==typeof M(MM,this).get?M(MM,this).get(e.nodeId):void 0;if(!n)return;const i=A(cF,this,SF).call(this,n);return i?{placement:e,trackType:i}:void 0}function SF(t){var e;const n=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[];let i;if(null!=t&&t.mainTrackId){const e=n.find((e=>(null==e?void 0:e.id)===t.mainTrackId));i=null==e?void 0:e.type}if(i||(i=null===(e=n.find((t=>null==t?void 0:t.type)))||void 0===e?void 0:e.type),"video"===i||"audio"===i||"image"===i)return i}function AF(t=this.currentTime){const e=M(DM,this)||[];let n;for(let i=0;i<e.length;i+=1){const r=e[i],o=gm(r);if(!Number.isFinite(o))continue;const s=A(cF,this,DF).call(this,r);if(Number.isFinite(s)){if(t>=o&&t<o+s)return r}else if(t<=o)return r;!n&&t<o&&(n=r)}return n}function NF(t={}){if(this.state!==Tv)return;const e=null==t?void 0:t.placementId;if(!e)return;const n=A(cF,this,sC).call(this,e);n&&A(cF,this,FF).call(this,n)}function MF(t=this.currentTime){if(this.state!==Tv)return;const e=A(cF,this,eC).call(this,t);Array.isArray(e)&&e.length&&e.forEach((t=>A(cF,this,FF).call(this,t)))}function FF(t){const e=null==t?void 0:t.placementId;if(!e)return;if(M(VM,this).has(e))return;if(!t||!0!==t.loop)return;if(!t.nodeId)return;const n=A(cF,this,DF).call(this,t);if(!Number.isFinite(n)||n<=0)return;const i=gm(t);if(!Number.isFinite(i))return;const r=i+n;if(!Number.isFinite(r))return;const o=t.loopRootPlacementId||t.placementId,s=Number.isFinite(t.loopRootOffset)?t.loopRootOffset:i;M(VM,this).add(e),this.placeOnTimeline(t.nodeId,r,{nodeOffsetOverride:t.nodeOffsetOverride,nodeDurationOverride:t.nodeDurationOverride,loop:!0,loopRootPlacementId:o,loopRootOffset:s})}function CF(){const t=km(M(DM,this),{getPlacementDuration:t=>A(cF,this,DF).call(this,t),snapPlacementOffset:(t,e)=>A(cF,this,LF).call(this,t,{nodeOffsetOverride:null==e?void 0:e.nodeOffsetOverride}),onResolvedPlacement:(t,e)=>{!0!==t.loop||Number.isFinite(t.loopRootOffset)||(t.loopRootOffset=t.offset),A(cF,this,WF).call(this,null==e?void 0:e.nodeId)}});return t.updated&&(A(cF,this,qF).call(this),t.resolvedPlacements.forEach((t=>{A(cF,this,GF).call(this,t),this.trigger(dd.PLACEMENT_ADDED,t)}))),t.updated}function OF(){if(!M(BM,this).length||!M(DM,this).length)return!1;const t=new Map;M(DM,this).forEach((e=>{(null==e?void 0:e.placementId)&&t.set(e.placementId,e)}));const e=M(BM,this).filter((t=>!0===(null==t?void 0:t.offsetPending)));if(!e.length)return!1;let n=!1;const i=[];for(let r=0;r<e.length;r+=1){const o=e[r];A(cF,this,PF).call(this,o,t)&&(n=!0,i.push(o))}return n&&(bm(M(BM,this)),i.forEach((t=>{this.trigger(dd.RENDER_PLACEMENT_ADDED,t)}))),n}function PF(t,e){const n=null==t?void 0:t.offsetAnchorPlacementId,i=null==t?void 0:t.offsetAnchorEdge;if(!n||!i)return!1;const r=e.get(n);if(!r||!0===r.offsetPending)return!1;const o=A(cF,this,RF).call(this,r,t);if(!Number.isFinite(o))return!1;t.offset=o,t.offsetPending=!1,t.offsetAnchorPlacementId=void 0,t.offsetAnchorEdge=void 0,t.offsetAnchorIsReference=void 0;const s=t.offset,a=t.offset+t.duration;return Tm(M(BM,this).filter((e=>e!==t&&!0!==(null==e?void 0:e.offsetPending))),s,a,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements"),A(cF,this,WF).call(this,null==r?void 0:r.nodeId),!0}function RF(t,e){const n=gm(t);if(!Number.isFinite(n))return;if("start"===e.offsetAnchorEdge)return A(cF,this,LF).call(this,n);const i=A(cF,this,DF).call(this,t);if(!(i>0))return;const r=n+i;if(!Number.isFinite(r))return;const o=A(cF,this,LF).call(this,r);return!0===e.offsetAnchorIsReference?Math.max(o,r):o}function DF(t){return mm(t,M(MM,this))}function LF(t,e={}){var n;return function(t,e={},n){const i=Number(n);if(!(i>0))return t;const r=Number(t);if(!Number.isFinite(r))return t;const o=Number.isFinite(null==e?void 0:e.nodeOffsetOverride)?e.nodeOffsetOverride:0,s=r-o;return Math.round(s*i)/i+o}(t,e,null===(n=this.settings)||void 0===n?void 0:n.snapToFps)}function BF(t,e={}){const n=_m(t);if("string"==typeof t&&t.includes("@")&&!n)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");if(!n){const n=wm(t);return{offset:A(cF,this,LF).call(this,n,e)}}const i=M(DM,this).find((t=>(null==t?void 0:t.placementId)===n.placementId));if(!i)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");const r=gm(i);if("start"===n.anchor)return Number.isFinite(r)?{offset:A(cF,this,LF).call(this,r,e)}:{offset:void 0,offsetPending:!0,offsetAnchorPlacementId:i.placementId,offsetAnchorEdge:"start",offsetAnchorIsReference:!0};const o=A(cF,this,DF).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(cF,this,LF).call(this,s,e);return{offset:Math.max(a,s)}}function zF(t){if(!t||!M(MM,this)||"function"!=typeof M(MM,this).get)return;if(M(GM,this).has(t))return;let e;try{e=M(MM,this).get(t)}catch(t){return}if(!e||"function"!=typeof e.on)return;if("ready"===e.state&&e.duration>0)return void this.updateTime(this.currentTime);const n=()=>{this.updateTime(this.currentTime),A(cF,this,WF).call(this,t)};e.on(dd.NODE_LOADED,n),M(GM,this).set(t,n)}function WF(t){if(!t)return;if(A(cF,this,$F).call(this,t))return;const e=M(GM,this).get(t);if(!e)return;let n;try{n=M(MM,this).get(t)}catch(t){n=null}n&&"function"==typeof n.off&&n.off(dd.NODE_LOADED,e),M(GM,this).delete(t)}function $F(t){if(!t)return!1;const e=new Map;M(DM,this).forEach((t=>{(null==t?void 0:t.placementId)&&e.set(t.placementId,t)}));const n=n=>{if(null==n||!n.offsetPending||null==n||!n.offsetAnchorPlacementId)return!1;const i=e.get(n.offsetAnchorPlacementId);return(null==i?void 0:i.nodeId)===t};return!!M(DM,this).some((t=>n(t)))||!!M(BM,this).some((t=>n(t)))}function jF(){M(GM,this).size&&M(MM,this)?(M(GM,this).forEach(((t,e)=>{let n;try{n=M(MM,this).get(e)}catch(t){n=null}n&&"function"==typeof n.off&&n.off(dd.NODE_LOADED,t)})),M(GM,this).clear()):M(GM,this).clear()}function UF(){C(HM,this,[]),C(KM,this,0),M(XM,this).clear(),M(YM,this).clear(),C(QM,this,Number.NEGATIVE_INFINITY)}function qF(){C(JM,this,[]),C(tF,this,0),C(ZM,this,Number.NEGATIVE_INFINITY)}function VF(t,e){const n=M(HM,this),i={placementId:t,endTime:e};if(!n.length||e>=n[n.length-1].endTime)return void n.push(i);const r=n.findIndex((t=>e<t.endTime)),o=-1===r?n.length:r;n.splice(o,0,i),o<M(KM,this)&&C(KM,this,M(KM,this)+1)}function GF(t){const e=null==t?void 0:t.placementId;if(!e||M(XM,this).has(e))return;const n=gm(t),i=A(cF,this,DF).call(this,t);if(!Number.isFinite(n)||!Number.isFinite(i)||i<0)return void M(YM,this).add(e);const r=n+i;Number.isFinite(r)&&(M(XM,this).add(e),M(YM,this).delete(e),A(cF,this,VF).call(this,e,r))}function HF(){M(YM,this).size&&Array.from(M(YM,this)).forEach((t=>{const e=A(cF,this,sC).call(this,t);e?A(cF,this,GF).call(this,e):M(YM,this).delete(t)}))}function KF(t){const e=Number(t);if(!Number.isFinite(e))return;if(e<M(QM,this))return void C(QM,this,e);if(C(QM,this,e),A(cF,this,HF).call(this),!M(HM,this).length)return;const n=new Set;let i=M(KM,this);for(;i<M(HM,this).length;){const t=M(HM,this)[i];if(!t||!Number.isFinite(t.endTime)||t.endTime>e)break;t.placementId&&n.add(t.placementId),i+=1}i!==M(KM,this)&&(C(KM,this,i),n.size&&(A(cF,this,QF).call(this,n),A(cF,this,XF).call(this,n)))}function XF(t){if(t&&t.size)for(const e of M(qM,this)){const n=e.split(":")[0];t.has(n)&&M(qM,this).delete(e)}}function YF(t){const e=Array.isArray(null==t?void 0:t.frames)?t.frames:[],n=null==t?void 0:t.current;(n?[n,...e]:e).forEach((t=>{const e=null==t?void 0:t.frame;if(e&&"function"==typeof e.close)try{e.close()}catch(t){}}))}function QF(t){if(t&&t.size)for(const[e,n]of M(iF,this).entries())t.has(null==n?void 0:n.placementId)&&(A(cF,this,YF).call(this,n),M(iF,this).delete(e))}function JF(t={}){var e;const n=null==t?void 0:t.placementId,i=null==t?void 0:t.nodeId,r=null==t?void 0:t.trackId,o=null==t?void 0:t.segmentId,s=null==t?void 0:t.trackType;if(!(n&&i&&r&&o))return;if("video"!==s&&"image"!==s)return;const a=(null==t?void 0:t.frame)||(null==t?void 0:t.data);if(!a)return;"video"===s&&"object"==typeof a&&"function"==typeof a.close&&(a.__keepOpen=!0);const l=lM(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==t?void 0:t.pts)?t.pts:void 0;if(!Number.isFinite(d))return;const h=Number.isFinite(null==t?void 0:t.duration)?t.duration:void 0,f=`${n}:${r}`,p=M(iF,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 t=g.findIndex((t=>t.presentationTime>v.presentationTime));-1===t&&(t=g.length),g.splice(t,0,v)}const b=Number(null===(e=this.settings)||void 0===e?void 0:e.maxBufferedVideoFrames);if("video"===s&&Number.isFinite(b)&&b>0&&g.length>b){const t=g.length-b;for(let e=0;e<t;e+=1){const t=g.pop(),e=null==t?void 0:t.frame;if(e&&"function"==typeof e.close)try{e.close()}catch(t){}}}p||M(iF,this).set(f,m)}function ZF(){for(const t of M(iF,this).values())A(cF,this,YF).call(this,t);M(iF,this).clear(),C(rF,this,null),M(qM,this).clear()}function tC(t){const e=Number.isFinite(t)?t:this.currentTime;if(!Number.isFinite(e))return;e<M(ZM,this)&&(C(JM,this,[]),C(tF,this,0));const n=Array.isArray(M(DM,this))?M(DM,this):[],i=[],r=new Set;M(JM,this).forEach((t=>{A(cF,this,dC).call(this,t,e)&&(i.push(t),(null==t?void 0:t.placementId)&&r.add(t.placementId))}));let o=M(tF,this);for(;o<n.length;){const t=n[o],s=gm(t);if(!Number.isFinite(s))break;if(s>e)break;if(A(cF,this,dC).call(this,t,e)){const e=null==t?void 0:t.placementId;e&&r.has(e)||(i.push(t),e&&r.add(e))}o+=1}C(JM,this,i),C(tF,this,o),C(ZM,this,e)}function eC(t,e={}){const n=Number.isFinite(t)?t:this.currentTime,i=Number.isFinite(null==e?void 0:e.endEpsilonSeconds)?e.endEpsilonSeconds:0;return 0===i&&n===this.currentTime&&n===M(ZM,this)?M(JM,this).slice():(Array.isArray(M(DM,this))?M(DM,this):[]).filter((t=>A(cF,this,dC).call(this,t,n,i)))}function nC(){const t=this.currentTime,e=A(cF,this,rC).call(this,t);if(!e.length)return void C(rF,this,null);const n=this.getActiveRenderPlacement(t),i=A(cF,this,oC).call(this,e,n);(i!==M(rF,this)||A(cF,this,iC).call(this,t,n))&&(C(rF,this,i),this.trigger(dd.VISUAL_FRAMES_AVAILABLE,{time:t,frames:e}))}function iC(t,e){const n=e||this.getActiveRenderPlacement(t);if(!n)return!1;if(!Xm.doesRenderNodeTypeRequireFrameCadence(null==n?void 0:n.type))return!1;const i=n.duration;return"number"==typeof i&&i>0}function rC(t){return function(t={}){const e=t.buffers,n=t.time,i=t.getPlacementById,r=t.isPlacementActiveAtTime,o=t.getPlacementDuration,s=[];if(!e||"function"!=typeof e.entries)return[];const a=[];for(const[t,c]of e.entries()){const e=null==c?void 0:c.placementId,u="function"==typeof i?i(e):void 0;if(!u){iM(c),a.push(t);continue}if("function"==typeof r&&!r(u,n)){const e=rM(u),i="function"==typeof o?o(u):void 0;Number.isFinite(i)&&Number.isFinite(e)&&n>=e+i&&(iM(c),a.push(t));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 t=c.current,e=d.shift();c.current=e,t&&t!==e&&nM(null==t?void 0:t.frame)}if(!c.current)continue;const h={placementId:e,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:e,placementOffset:rM(u),placementSortOffset:oM(u),placementSortId:sM(u,e)})}return a.forEach((t=>{e.delete(t)})),s.sort(((t,e)=>{const n=Number.isFinite(null==t?void 0:t.placementSortOffset)?t.placementSortOffset:Number.isFinite(null==t?void 0:t.placementOffset)?t.placementOffset:0,i=Number.isFinite(null==e?void 0:e.placementSortOffset)?e.placementSortOffset:Number.isFinite(null==e?void 0:e.placementOffset)?e.placementOffset:0;if(n!==i)return n-i;const r=(null==t?void 0:t.placementSortId)||(null==t?void 0:t.placementId),o=(null==e?void 0:e.placementSortId)||(null==e?void 0:e.placementId),s=aM(r),a=aM(o);return Number.isFinite(s)&&Number.isFinite(a)&&s!==a?s-a:r&&o&&r!==o?r<o?-1:1:function(t,e){const n=(null==t?void 0:t.frame)||{},i=(null==e?void 0:e.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)}(t,e)})),s.map((t=>t.frame))}({buffers:M(iF,this),time:t,getPlacementById:t=>A(cF,this,sC).call(this,t),isPlacementActiveAtTime:(t,e)=>A(cF,this,dC).call(this,t,e),getPlacementDuration:t=>A(cF,this,DF).call(this,t)})}function oC(t,e){return`${e?`render:${e.renderPlacementId||e.type||"unknown"}`:"render:default"}|${t.map((t=>`${t.nodeId}:${t.trackId}:${t.segmentId}@${t.presentationTime}`)).join("|")}`}function sC(t){if(t)return(M(DM,this)||[]).find((e=>(null==e?void 0:e.placementId)===t))}function aC(t){if("end"===t){const t=A(cF,this,lC).call(this);if(!Number.isFinite(t))return;const e=A(cF,this,cC).call(this);return Math.max(0,t-Math.min(t,e))}const e=Number(t);return Number.isFinite(e)?e:0}function lC(){let t;return(Array.isArray(M(DM,this))?M(DM,this):[]).forEach((e=>{const n=gm(e);if(!Number.isFinite(n))return;const i=A(cF,this,DF).call(this,e);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(t)||r>t)&&(t=r)})),t}function cC(){const t=A(cF,this,uC).call(this);return t>0?t:.001}function uC(){var t;const e=Number(null===(t=this.settings)||void 0===t?void 0:t.snapToFps);return!Number.isFinite(e)||e<=0?0:.5/e}function dC(t,e,n=0){if(!ym(t,e,M(MM,this)))return!1;const i=Number(n);if(!Number.isFinite(i)||i<=0)return!0;const r=A(cF,this,DF).call(this,t);if(!Number.isFinite(r))return!0;const o=gm(t);return!Number.isFinite(o)||e<o+r-i}var hC=new WeakMap,fC=new WeakMap,pC=new WeakMap,mC=new WeakMap,vC=new WeakMap,gC=new WeakMap,yC=new WeakMap,bC=new WeakMap,kC=new WeakMap,wC=new WeakMap,xC=new WeakMap,_C=new WeakMap,TC=new WeakMap,EC=new WeakMap,IC=new WeakMap,SC=new WeakMap,AC=new WeakMap,NC=new WeakSet;class MC extends sd{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(...t){super(...t),O(this,NC),F(this,hC,void 0),F(this,fC,void 0),F(this,pC,1),F(this,mC,1),F(this,vC,1),F(this,gC,""),F(this,yC,0),F(this,bC,[]),F(this,kC,null),F(this,wC,void 0),F(this,xC,[]),F(this,_C,null),F(this,TC,null),F(this,EC,0),F(this,IC,0),F(this,SC,0),F(this,AC,void 0);const[e]=t;C(hC,this,e),C(EC,this,Fy()),C(AC,this,A(NC,this,FC).call(this)),A(NC,this,CC).call(this),A(NC,this,OC).call(this),A(NC,this,BC).call(this),A(NC,this,DC).call(this)}get publicAPI(){return M(AC,this)}calcScore(){A(NC,this,HC).call(this)}onDispose(){M(hC,this)&&M(fC,this)&&"function"==typeof M(hC,this).off&&M(hC,this).off(dd.TIMELINE_PLAYER_STATE,M(fC,this)),C(fC,this,null),A(NC,this,LC).call(this),A(NC,this,zC).call(this),C(hC,this,null),C(xC,this,[]),C(bC,this,[]),C(AC,this,null)}}function FC(){const t=this;return{get score(){return M(pC,t)},get status(){return M(gC,t)},get streamQualityScore(){return M(mC,t)},get fpsScore(){return M(vC,t)},get browserFps(){return M(yC,t)},get waitingSeconds(){return M(IC,t)/1e3},get playingSeconds(){return M(SC,t)/1e3}}}function CC(){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 OC(){M(hC,this)&&"function"==typeof M(hC,this).on&&(C(fC,this,(t=>A(NC,this,PC).call(this,t))),M(hC,this).on(dd.TIMELINE_PLAYER_STATE,M(fC,this)))}function PC(t={}){const e="string"==typeof(null==t?void 0:t.event)?t.event:"";"playing"!==e?"waiting"!==e?"pause"!==e&&"seeking"!==e&&"seeked"!==e&&"reset"!==e||A(NC,this,RC).call(this,null):A(NC,this,RC).call(this,"waiting"):A(NC,this,RC).call(this,"playing")}function RC(t){if(t===M(_C,this))return;const e=Fy();M(_C,this)&&Number.isFinite(M(TC,this))&&M(xC,this).push({state:M(_C,this),startMs:M(TC,this),endMs:e}),C(_C,this,t),C(TC,this,t?e:null),A(NC,this,jC).call(this,e)}function DC(){const t=Number(this.settings.calcScoreInterval);!Number.isFinite(t)||t<=0||(C(wC,this,(()=>A(NC,this,HC).call(this))),pw(M(wC,this),1e3*t))}function LC(){M(wC,this)&&mw(M(wC,this)),C(wC,this,null)}function BC(){if("function"!=typeof rw)return;const t=()=>{if(this._disposed)return;const e=Fy();C(yC,this,A(NC,this,WC).call(this,M(bC,this),e)),C(kC,this,rw(t))};C(kC,this,rw(t))}function zC(){M(kC,this)&&"function"==typeof ow&&ow(M(kC,this)),C(kC,this,null)}function WC(t,e){const n=A(NC,this,$C).call(this);for(t.push(e);t.length&&e-t[0]>n;)t.shift();if(t.length<2)return 0;const i=t[t.length-1]-t[0];return i<=0?0:1e3*(t.length-1)/i}function $C(){const t=Number(this.settings.windowSeconds);return!Number.isFinite(t)||t<=0?3e4:1e3*t}function jC(t){const e=t-A(NC,this,$C).call(this);for(;M(xC,this).length&&M(xC,this)[0].endMs<=e;)M(xC,this).shift()}function UC(t){const e=t-A(NC,this,$C).call(this);let n=0,i=0;const r=(r,o,s)=>{const a=Math.max(o,e),l=Math.min(s,t);l<=a||("waiting"===r?n+=l-a:"playing"===r&&(i+=l-a))};return M(xC,this).forEach((t=>{r(t.state,t.startMs,t.endMs)})),M(_C,this)&&Number.isFinite(M(TC,this))&&r(M(_C,this),M(TC,this),t),C(IC,this,n),C(SC,this,i),{waitingMs:n,playingMs:i}}function qC(t,e){if(t<=0)return 1;if(t>e)return 0;const n=e||1;return fm(1-t*this.settings.waitingMultiplier/n)}function VC(){if(Fy()-M(EC,this)<=1e3*this.settings.fpsGracePeriod)return 1;const t=Number(M(yC,this)),e=wv.isDesktop()?this.settings.bestFpsDesktop:this.settings.bestFpsMobile,n=fm(e>0?t/e:0);return"quad"===this.settings.fpsMathFuncType?n*n:n}function GC(t,e){const n=this.settings.statusFloors||{};let i="";return t>=n.excellent?i="excellent":t>=n.good?i="good":t>=n.fair?i="fair":(i="poor",t<=this.settings.alertStatusCeil&&e>0&&(i="alert")),i}function HC(){const t=Fy(),{waitingMs:e,playingMs:n}=A(NC,this,UC).call(this,t),i=A(NC,this,qC).call(this,e,n),r=A(NC,this,VC).call(this),o=fm(i*this.settings.streamQualityWeight+r*this.settings.fpsWeight);o!==M(pC,this)&&(C(pC,this,o),this.trigger(dd.QOE_SCORE,o)),C(mC,this,i),C(vC,this,r);const s=A(NC,this,GC).call(this,o,e);s!==M(gC,this)&&(C(gC,this,s),this.trigger(dd.QOE_STATUS,s))}function KC(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}function XC(t){const e=Number(t);return!Number.isFinite(e)||e<0?0:e}var YC=new WeakMap,QC=new WeakMap,JC=new WeakMap,ZC=new WeakMap,tO=new WeakSet;class eO extends sd{get name(){return"SegmentEvictionCoordinator"}get defaults(){return{enabled:Ky("segmentEvictionEnabled"),bufferBehindSeconds:Ky("segmentEvictionBufferBehindSeconds"),bufferAheadSeconds:Ky("segmentEvictionBufferAheadSeconds"),maxRetainedBytes:Ky("segmentEvictionMaxRetainedBytes")}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"evictAtTime"])}constructor(t,e,n={}){super(n),O(this,tO),F(this,YC,void 0),F(this,QC,void 0),F(this,JC,void 0),F(this,ZC,void 0),C(YC,this,t),C(QC,this,e),C(JC,this,(t=>A(tO,this,nO).call(this,t))),C(ZC,this,(t=>A(tO,this,iO).call(this,t))),M(YC,this)&&"function"==typeof M(YC,this).on&&(M(YC,this).on(dd.TIMELINE_TIME_UPDATE,M(JC,this)),M(YC,this).on(dd.TIMELINE_SEEKED,M(ZC,this)))}onDispose(){M(YC,this)&&"function"==typeof M(YC,this).off&&(M(YC,this).off(dd.TIMELINE_TIME_UPDATE,M(JC,this)),M(YC,this).off(dd.TIMELINE_SEEKED,M(ZC,this))),C(YC,this,null),C(QC,this,null),C(JC,this,null),C(ZC,this,null)}evictAtTime(t){if(!0!==this.settings.enabled)return;const e=Number(t);if(!Number.isFinite(e))return;const n=XC(this.settings.bufferBehindSeconds),i=XC(this.settings.bufferAheadSeconds),r=e-n,o=e+i,s=A(tO,this,rO).call(this);if(!s.length)return;const a=Number(this.settings.maxRetainedBytes);if(Number.isFinite(a)&&a>0&&A(tO,this,oO).call(this,s)<=a)return;const l=new Map;s.forEach((t=>{const e=null==t?void 0:t.nodeId;if(!e)return;const n=gm(t);if(!Number.isFinite(n))return;const i=l.get(e)||[];i.push(t),l.set(e,i)})),l.size&&l.forEach(((t,e)=>{const n=A(tO,this,sO).call(this,e);if(!n)return;const i=t.filter((t=>A(tO,this,aO).call(this,t,r,o)));i.length?A(tO,this,lO).call(this,n,i,r,o):"function"==typeof n.evict&&n.evict()}))}}function nO(t){var e,n;if(!0!==this.settings.enabled)return;if((null===(e=M(YC,this))||void 0===e?void 0:e.state)===Av)return;const i=Number(null==t?void 0:t.time),r=Number.isFinite(i)?i:Number(null===(n=M(YC,this))||void 0===n?void 0:n.currentTime);this.evictAtTime(r)}function iO(t){var e;if(!0!==this.settings.enabled)return;const n=Number(null==t?void 0:t.targetTime),i=Number.isFinite(n)?n:Number(null===(e=M(YC,this))||void 0===e?void 0:e.currentTime);this.evictAtTime(i)}function rO(){var t;const e=null===(t=M(YC,this))||void 0===t?void 0:t.placements;return Array.isArray(e)?e:[]}function oO(t){if(!Array.isArray(t)||!t.length)return 0;const e=new Set;let n=0;return t.forEach((t=>{const i=null==t?void 0:t.nodeId;if(!i||e.has(i))return;e.add(i);const r=A(tO,this,sO).call(this,i),o=Number(null==r?void 0:r.retainedByteLength);oy(o)?n+=o:(Array.isArray(null==r?void 0:r.tracks)?r.tracks:[]).forEach((t=>{(Array.isArray(null==t?void 0:t.segments)?t.segments:[]).forEach((t=>{oy(null==t?void 0:t.retainedByteLength)&&(n+=t.retainedByteLength)}))}))})),n}function sO(t){if(M(QC,this)&&"function"==typeof M(QC,this).get)return M(QC,this).get(t)}function aO(t,e,n){const i=gm(t);if(!Number.isFinite(i))return!1;const r=mm(t,M(QC,this));return(Number.isFinite(r)?i+r:Number.POSITIVE_INFINITY)>e&&i<n}function lO(t,e,n,i){const r=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[];r.length&&r.forEach((t=>{const r=Array.isArray(null==t?void 0:t.segments)?t.segments:[],o=KC(null==t?void 0:t.offset,0);r.forEach((t=>{if(!t||!oy(null==(r=t)?void 0:r.retainedByteLength))return;var r;if(t.isInit)return;let s=!1;for(let r=0;r<e.length;r+=1){const a=e[r],l=gm(a);if(!Number.isFinite(l))continue;const c=KC(null==a?void 0:a.nodeOffsetOverride,0),u=KC(null==t?void 0:t.offset,NaN);if(!Number.isFinite(u))continue;const d=KC(null==t?void 0:t.duration,0),h=l+o+u-c,f=h+(d>0?d:0),p=mm(a,M(QC,this)),m=Number.isFinite(p)?l+p:Number.POSITIVE_INFINITY;if(!(f<=l||h>=m||f<=n||h>=i)){s=!0;break}}s||t.evict()}))}))}var cO=new WeakMap,uO=new WeakMap,dO=new WeakMap,hO=new WeakSet;class fO extends sd{get name(){return"DocumentVisibility"}get defaults(){return{autoPauseOnVisibilityChange:!0,autoResumeOnVisibilityChange:!0}}constructor(t,e={}){super(e),O(this,hO),F(this,cO,void 0),F(this,uO,null),F(this,dO,!1),C(cO,this,t),A(hO,this,pO).call(this)}onDispose(){A(hO,this,mO).call(this),C(cO,this,null),C(dO,this,!1)}}function pO(){const t=null==cd?void 0:cd.document;t&&"function"==typeof t.addEventListener&&(C(uO,this,(()=>A(hO,this,vO).call(this))),t.addEventListener("visibilitychange",M(uO,this)))}function mO(){const t=null==cd?void 0:cd.document;M(uO,this)&&t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",M(uO,this)),C(uO,this,null)}function vO(){const t=null==cd?void 0:cd.document,e=null==t?void 0:t.visibilityState;"string"==typeof e&&("hidden"!==e?"visible"===e&&A(hO,this,yO).call(this):A(hO,this,gO).call(this))}function gO(){var t;(null===(t=this.settings)||void 0===t?void 0:t.autoPauseOnVisibilityChange)&&M(cO,this)&&"function"==typeof M(cO,this).pause&&(M(cO,this).state===Tv?(this.log.info("[#handleHidden] Pausing timeline due to document visibility change"),M(cO,this).pause(),C(dO,this,!0)):C(dO,this,!1))}function yO(){var t;M(dO,this)&&(null===(t=this.settings)||void 0===t?void 0:t.autoResumeOnVisibilityChange)&&M(cO,this)&&"function"==typeof M(cO,this).play&&(M(cO,this).state!==Tv?(this.log.info("[#handleVisible] Resuming timeline due to document visibility change"),M(cO,this).play(),C(dO,this,!1)):C(dO,this,!1))}const bO=[{event:"canplay",once:!0,trackAs:"canplay"},{event:"playing",once:!0,trackAs:"startedplaying"},"seeked","canvas.webglcontextlost"];function kO(t,e=0){return Number.isFinite(t)?t:e}function wO(t){const e=null==t?void 0:t.exposedPlayerAPI;return e&&"object"==typeof e?e:t}const xO=[function(t){return{schema:"iglu:com.helloeko/player/jsonschema/1-0-7",match:/^.*$/,getData:()=>{var e,n,i;const r=function(t){const e=null==t?void 0:t.exposedPlayerAPI;return e&&"object"==typeof e?e:t}(t);return{playerversion:"string"==typeof(null==r?void 0:r.version)?r.version:"0.0.0",isautoplay:!(null==r||null===(e=r.options)||void 0===e||!e.autoplay),playerqoe:kO(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:kO(null==r?void 0:r.volume),playercontainerwidth:kO(null==r?void 0:r.containerWidth),playercontainerheight:kO(null==r?void 0:r.containerHeight)}}}},function(t){return{schema:"iglu:com.helloeko/currentnode/jsonschema/1-0-2",match:/^.*$/,getData:()=>{var e;const n=wO(t),i=function(t){const e=wO(t);if(!e||"function"!=typeof e.getNodesAtTime)return null;const n=Number.isFinite(e.currentTime)?e.currentTime:0,i=e.getNodesAtTime(n);return Array.isArray(i)&&0!==i.length&&i[0]||null}(t);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===(e=i.metadata)||void 0===e?void 0:e.profile)?i.metadata.profile:""}}}},function(t){let e=0,n=0;const i=()=>{e||(e=Date.now(),n=0)},r=()=>{e&&!n&&(n=Date.now())};return t&&"function"==typeof t.on&&(t.on("seeking",i),t.on("seeked",r)),{schema:"iglu:com.helloeko/seeked/jsonschema/1-0-0",match:"seeked",getData:()=>{r();const t=e&&n&&n>=e?(n-e)/1e3:0;return e=0,n=0,{seekduration:t}},dispose:()=>{t&&"function"==typeof t.off&&(t.off("seeking",i),t.off("seeked",r))}}},function(){return{schema:"iglu:com.helloeko/environment/jsonschema/1-0-0",match:/^.*$/,getData:()=>{var t;const e=null==cd||null===(t=cd.eko)||void 0===t||null===(t=t.environment)||void 0===t?void 0:t.embeddingApp;return e?{embeddingapp:e}:{}}}}],_O=Object.freeze({once:!1,trackAs:""});var TO=new WeakMap,EO=new WeakMap,IO=new WeakMap,SO=new WeakMap,AO=new WeakMap,NO=new WeakMap,MO=new WeakSet;class FO extends sd{get name(){return"Tracker"}get defaults(){return{tag:null,trackingEnabled:Ky("trackingEnabled"),defaultForwarders:bO,defaultContextPackers:xO}}constructor(t,e={}){var n,i;super(e),O(this,MO),F(this,TO,void 0),F(this,EO,new Map),F(this,IO,[]),F(this,SO,!1),F(this,AO,void 0),F(this,NO,void 0),C(NO,this,!this.settings.tag),C(AO,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(TO,this,t),A(MO,this,BO).call(this),A(MO,this,OO).call(this)}track(t,...e){if(!this.settings.trackingEnabled)return;if("string"!=typeof t||!t)return void this.log.warn("[track] Expected event to be a non-empty string.");const n=A(MO,this,WO).call(this);n&&n("track",t,...e,M(AO,this))}registerContextPacker(t){if(!t||"object"!=typeof t)return void this.log.warn("[registerContextPacker] Expected a packer object.");const e={tag:M(AO,this),schema:t.schema,match:t.match,getData:A(MO,this,CO).call(this,t.getData)};if("string"!=typeof e.schema||!e.schema)return void this.log.warn('[registerContextPacker] Expected "schema" to be a non-empty string.');if("function"!=typeof e.getData)return void this.log.warn('[registerContextPacker] Expected "getData" to be a function.');if(!this.settings.trackingEnabled)return;const n=A(MO,this,WO).call(this);n&&n("registerContextPacker",e)}onDispose(){if(A(MO,this,LO).call(this),A(MO,this,zO).call(this),C(TO,this,null),M(NO,this)){const t=A(MO,this,WO).call(this);t&&(t("reset",M(AO,this)),C(AO,this,null))}}}function CO(t){return"function"!=typeof t?null:(...e)=>e.pop()!==M(AO,this)?null:t(...e)}function OO(){(Array.isArray(this.settings.defaultForwarders)?this.settings.defaultForwarders:[]).forEach((t=>A(MO,this,PO).call(this,t)))}function PO(t){const e=A(MO,this,RO).call(this,t);if(!e)return void this.log.warn("[#addEventForwarder] Invalid forwarder input.",t);const n=M(TO,this);if(!n||"function"!=typeof n.on)return;const i=A(MO,this,DO).call(this,e);if(M(EO,this).has(i))return;const r=(...t)=>{e.once&&n&&"function"==typeof n.off&&n.off(e.event,r);const i=e.trackAs||e.event;this.track(i,...t)};n.on(e.event,r),M(EO,this).set(i,{event:e.event,listener:r})}function RO(t){return"string"==typeof t&&t?{event:t,..._O}:t&&"object"==typeof t&&"string"==typeof t.event&&t.event?{event:t.event,once:!!t.once,trackAs:"string"==typeof t.trackAs?t.trackAs:""}:null}function DO({event:t,once:e,trackAs:n}){return`${t}:${e}:${n}`}function LO(){const t=M(TO,this);t&&"function"==typeof t.off&&M(EO,this).forEach((({event:e,listener:n})=>{t.off(e,n)})),M(EO,this).clear()}function BO(){(Array.isArray(this.settings.defaultContextPackers)?this.settings.defaultContextPackers:[]).forEach((t=>{if("function"!=typeof t)return;const e=t(M(TO,this),this);e&&"object"==typeof e&&("function"==typeof e.dispose&&M(IO,this).push(e.dispose),e.disabled||this.registerContextPacker({schema:e.schema,match:e.match,getData:e.getData}))}))}function zO(){M(IO,this).forEach((t=>{try{t()}catch(t){this.log.warn("[#teardownContextPackers] Failed disposing context packer.",t)}})),C(IO,this,[])}function WO(){const t=null==cd?void 0:cd.EkoAnalytics;return"function"==typeof t?t:(A(MO,this,$O).call(this),null)}function $O(){this.settings.trackingEnabled&&!M(SO,this)&&(this.log.warn("EkoAnalytics not found on window."),C(SO,this,!0))}class jO{#et;#nt;#it;#rt;#ot;#st;#at;#lt;#ct;#ut;#dt;#ht;#ft;#pt;#mt;#vt;#gt;#yt;#bt;constructor(t,e={},n=null){this.#et=new _d(t,n,e),this.#nt=new Pd(this.#et,e),this.#it=new Yk(e),this.#rt=new eb(e),this.#ot=new Fk(this.#rt,e),this.#st=new Ik(this.#ot,this.#it,e),this.#at=new zk(this.#st,e),this.#lt=new uF(this.#st,e),this.#ct=new fO(this.#lt,e),this.#yt=new eO(this.#lt,this.#st,e),this.#ut=new Dw(this.#st,this.#at,this.#it,this.#lt,e),this.#dt=new xx(this.#st,this.#at,this.#lt,e),this.#ht=new CI(e),this.#ft=new iS(this.#st,this.#lt,this.#ht,e),this.#mt=new MC(this.#lt,e),this.#bt=new FO(n,e);const i=e&&"object"==typeof e?e.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.#vt=r?r({timeline:this.#lt,canvas:this.#et,containerSize:this.#nt,options:e}):new yg(this.#lt,this.#et,this.#nt,e),this.#pt=o?o({timeline:this.#lt,decodeCoordinator:this.#ft,options:e}):new zA(this.#lt,this.#ft,e),this.#gt=new oA(this.#lt,this.#vt,e)}get canvas(){return this.#et}get containerSize(){return this.#nt}get assetsDeliveryService(){return this.#it}get downloadSpeed(){return this.#rt}get abrSelector(){return this.#ot}get nodeRepository(){return this.#st}get nodePrioritizer(){return this.#at}get timeline(){return this.#lt}get documentVisibility(){return this.#ct}get nodeResolver(){return this.#ut}get segmentLoadCoordinator(){return this.#dt}get decoderFactory(){return this.#ht}get parsingManager(){return this.#ft}get audioAdapter(){return this.#pt}get audioPlaybackManager(){return this.#pt}get qoe(){return this.#mt}get renderAdapter(){return this.#vt}get renderer(){return this.#vt}get transitionManager(){return this.#gt}get tracker(){return this.#bt}dispose(){[this.#bt,this.#lt,this.#ct,this.#dt,this.#ut,this.#at,this.#st,this.#it,this.#ot,this.#rt,this.#ft,this.#ht,this.#pt,this.#mt,this.#vt,this.#gt,this.#yt,this.#nt,this.#et].forEach((t=>{t&&"function"==typeof t.dispose&&t.dispose()})),this.#lt=null,this.#ct=null,this.#dt=null,this.#ut=null,this.#at=null,this.#st=null,this.#it=null,this.#ot=null,this.#rt=null,this.#ft=null,this.#ht=null,this.#pt=null,this.#mt=null,this.#vt=null,this.#gt=null,this.#yt=null,this.#et=null,this.#bt=null}}const UO="copy-instance.1193978";var qO={isPlainObject:ed,deepMerge:nd,get:Sy,set:Ay,ekoGlobalStore:Ny,download:qy,isPositiveNumber:oy,clamp01:fm,root:cd,now:Fy,getFrameDimensions:lM,useragent:xv,requestAnimationFrame:rw,cancelAnimationFrame:ow,start:pw,stop:mw,isTicking:vw,predicator:function(t,e){const n=e||{};if("function"!=typeof t)return void sw.error("[predicator] Bad argument given to predicator, first argument must be a function.",arguments);if(t.apply())return sw.debug("[predicator] Invoking onFulfilled immediately."),void("function"==typeof n.onFulfilled&&n.onFulfilled.call(null,0));const i=n.timeout||1e4,r=n.interval,o=Fy();let s,a,l,c,u;c=function(){t.apply()&&l()},l=function(){mw(c),cd.clearTimeout(s),u=Fy()-o,sw.debug("[predicator] Invoking onFulfilled after "+u+" ms."),"function"==typeof n.onFulfilled&&n.onFulfilled.call(null,u)},a=function(){mw(c),u=Fy()-o,sw.debug("[predicator] Invoking onTimeout after "+u+" ms."),"function"==typeof n.onTimeout&&n.onTimeout.call(null,u)},s=cd.setTimeout(a,i),pw(c,r)},createThrottler:gw,scheduleExecution:yw},VO=new WeakMap,GO=new WeakMap,HO=new WeakMap,KO=new WeakMap,XO=new WeakMap,YO=new WeakMap,QO=new WeakMap,JO=new WeakSet;class ZO{constructor(t){O(this,JO),F(this,VO,[]),F(this,GO,[]),F(this,HO,new SM("placement-")),F(this,KO,new SM("renderplacement-")),F(this,XO,void 0),F(this,YO,new Map),F(this,QO,void 0),C(XO,this,t),C(QO,this,{allowUnready:!0,getNode:t=>A(JO,this,tP).call(this,t)})}get placements(){return M(VO,this).slice()}get renderPlacements(){return M(GO,this).slice()}getNodesAtTime(t){A(JO,this,eP).call(this);const e=A(JO,this,iP).call(this,t);if(!Number.isFinite(e))return[];const n=M(VO,this).filter((t=>ym(t,e,null,M(QO,this)))),i=[];return n.forEach((t=>{const e=A(JO,this,tP).call(this,null==t?void 0:t.nodeId);e&&i.push(e)})),i}placeOnTimeline(t,e,n={}){const i=t&&"object"==typeof t?t:null,r=i?i.id:t;if(!r)throw new Error("TimelineDefinition.placeOnTimeline requires node id");i&&M(YO,this).set(r,i);const o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=_m(e);if("string"==typeof e&&e.includes("@")&&!a)throw new Error("TimelineDefinition.placeOnTimeline requires valid placement reference");const{wantsEndOffset:l,endOffsetSeconds:c}=a?{wantsEndOffset:!1}:xm(e,n);let u,d,h,f=!1;const p=null!==a;if(a){const t=M(VO,this).find((t=>(null==t?void 0:t.placementId)===a.placementId));if(!t)throw new Error("TimelineDefinition.placeOnTimeline requires valid placement reference");d=t.placementId,h=a.anchor;const e=gm(t);if("start"===a.anchor)Number.isFinite(e)?u=e:f=!0;else{const n=A(JO,this,nP).call(this,t);Number.isFinite(e)&&n>0?u=e+n:f=!0}}else if(l){const t=n.offsetAnchorPlacementId?M(VO,this).find((t=>(null==t?void 0:t.placementId)===n.offsetAnchorPlacementId)):M(VO,this).length?M(VO,this)[M(VO,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==t?void 0:t.placementId),d){const e=gm(t),n=A(JO,this,nP).call(this,t);Number.isFinite(e)&&n>0?u=e+n-c:(f=!0,h="end")}else u=-c}else u=wm(e);const m=M(HO,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(VO,this).push(v),bm(M(VO,this)),m}placeRenderNodeOnTimeline(t,e,n,i={}){const r="string"==typeof t?t:null==t?void 0:t.type;if(!r||"string"!=typeof r)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires render node type");let o,s,a,l=!1;const c=_m(e);if("string"==typeof e&&e.includes("@")&&!c)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires valid placement reference");const u=null!==c;if(c){const t=M(VO,this).find((t=>(null==t?void 0:t.placementId)===c.placementId));if(!t)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires valid placement reference");s=t.placementId,a=c.anchor;const e=gm(t);if("start"===c.anchor)Number.isFinite(e)?o=e:l=!0;else{const n=A(JO,this,nP).call(this,t);Number.isFinite(e)&&Number.isFinite(n)?o=e+n:l=!0}}else o=wm(e);const d=M(KO,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 t=o,e=o+p;Tm(M(GO,this),t,e,"TimelineDefinition.placeRenderNodeOnTimeline does not allow overlapping render nodes")}return M(GO,this).push(m),bm(M(GO,this)),d}}function tP(t){if(t)return M(XO,this)&&"function"==typeof M(XO,this).get?M(XO,this).get(t):M(YO,this).get(t)}function eP(){return km(M(VO,this),{getPlacementDuration:t=>A(JO,this,nP).call(this,t)}).updated}function nP(t){return mm(t,null,M(QO,this))}function iP(t){if("end"===t){const t=A(JO,this,rP).call(this);if(!Number.isFinite(t))return;return Math.max(0,t-Math.min(t,.001))}const e=Number(t);return Number.isFinite(e)?e:0}function rP(){let t;return M(VO,this).forEach((e=>{const n=gm(e);if(!Number.isFinite(n))return;const i=A(JO,this,nP).call(this,e);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(t)||r>t)&&(t=r)})),t}const oP=new Set(["canplay","play","playing","waiting","pause","seeking","seeked"]);var sP=new WeakMap,aP=new WeakMap,lP=new WeakMap,cP=new WeakMap,uP=new WeakMap,dP=new WeakMap,hP=new WeakMap,fP=new WeakMap,pP=new WeakMap,mP=new WeakMap,vP=new WeakMap,gP=new WeakMap,yP=new WeakMap,bP=new WeakMap,kP=new WeakMap,wP=new WeakMap,xP=new WeakMap,_P=new WeakMap,TP=new WeakMap,EP=new WeakMap,IP=new WeakMap,SP=new WeakMap,AP=new WeakMap,NP=new WeakMap,MP=new WeakMap,FP=new WeakSet;class CP extends sd{get name(){return"EkoPlayer"}get exposedPlayerAPI(){return M(cP,this)}constructor(t,e={}){const{options:n,publicOptions:i}=function(t={}){const e=nd({},Gy,t);Object.entries(Vy).forEach((([t,{targetPaths:n}])=>{void 0!==e[t]&&n.forEach((n=>{void 0===Sy(e,n)&&Ay(e,n,e[t])}))}));const n=function(t){const e={};return Object.keys(Vy).forEach((n=>{Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})),Object.freeze(e)}(e);return Hy.info("Processed options:",e),Hy.info("Public options:",n),{options:e,publicOptions:n}}(e);return super(n),O(this,FP),F(this,sP,void 0),F(this,aP,void 0),F(this,lP,void 0),F(this,cP,void 0),F(this,uP,void 0),F(this,dP,void 0),F(this,hP,void 0),F(this,fP,void 0),F(this,pP,void 0),F(this,mP,void 0),F(this,vP,void 0),F(this,gP,void 0),F(this,yP,void 0),F(this,bP,void 0),F(this,kP,void 0),F(this,wP,void 0),F(this,xP,void 0),F(this,_P,void 0),F(this,TP,void 0),F(this,EP,void 0),F(this,IP,void 0),F(this,SP,void 0),F(this,AP,void 0),F(this,NP,void 0),F(this,MP,0),C(lP,this,i),this.log.info("Initializing EkoPlayer with options:",i),C(gP,this,new jO(t,n,this)),A(FP,this,jP).call(this,M(gP,this)),C(kP,this,(t=>A(FP,this,OP).call(this,t))),M(aP,this)&&"function"==typeof M(aP,this).on&&M(aP,this).on(dd.TIMELINE_CUEPOINT,M(kP,this)),C(wP,this,null),C(_P,this,(t=>A(FP,this,PP).call(this,t))),C(TP,this,(t=>{const e=t&&"object"==typeof t?t:{};A(FP,this,PP).call(this,{...e,event:"seeking"})})),C(EP,this,(t=>{const e=t&&"object"==typeof t?t:{};A(FP,this,PP).call(this,{...e,event:"seeked"})})),M(aP,this)&&"function"==typeof M(aP,this).on&&(M(aP,this).on(dd.TIMELINE_PLAYER_STATE,M(_P,this)),M(aP,this).on(dd.TIMELINE_SEEKING,M(TP,this)),M(aP,this).on(dd.TIMELINE_SEEKED,M(EP,this))),C(AP,this,(t=>{const e=t&&"object"==typeof t?t:{};this.trigger(dd.CONTAINER_RESIZE,e)})),M(yP,this)&&"function"==typeof M(yP,this).on&&M(yP,this).on(dd.CONTAINER_RESIZE,M(AP,this)),A(FP,this,BP).call(this),A(FP,this,LP).call(this),C(cP,this,A(FP,this,$P).call(this)),M(cP,this)}onDispose(){M(aP,this)&&"function"==typeof M(aP,this).off&&M(kP,this)&&M(aP,this).off(dd.TIMELINE_CUEPOINT,M(kP,this)),C(kP,this,null),M(aP,this)&&"function"==typeof M(aP,this).off&&(M(_P,this)&&M(aP,this).off(dd.TIMELINE_PLAYER_STATE,M(_P,this)),M(TP,this)&&M(aP,this).off(dd.TIMELINE_SEEKING,M(TP,this)),M(EP,this)&&M(aP,this).off(dd.TIMELINE_SEEKED,M(EP,this))),C(_P,this,null),C(TP,this,null),C(EP,this,null),C(wP,this,null),M(yP,this)&&"function"==typeof M(yP,this).off&&M(AP,this)&&M(yP,this).off(dd.CONTAINER_RESIZE,M(AP,this)),C(AP,this,null),M(vP,this)&&"function"==typeof M(vP,this).off&&(M(IP,this)&&M(vP,this).off("qoescore",M(IP,this)),M(SP,this)&&M(vP,this).off("qoestatus",M(SP,this))),C(IP,this,null),C(SP,this,null),M(mP,this)&&"function"==typeof M(mP,this).off&&M(NP,this)&&M(mP,this).off(dd.DECODER_ERROR,M(NP,this)),C(NP,this,null),C(MP,this,0),M(bP,this)&&"function"==typeof M(bP,this).dispose&&M(bP,this).dispose(),C(bP,this,null),M(gP,this)&&"function"==typeof M(gP,this).dispose&&M(gP,this).dispose(),C(aP,this,null),C(sP,this,null),C(dP,this,null),C(hP,this,null),C(fP,this,null),C(pP,this,null),C(mP,this,null),C(vP,this,null),C(yP,this,null),C(uP,this,null),C(cP,this,null),C(gP,this,null)}}function OP(t={}){var e;this.trigger(dd.TIMELINE_CUEPOINT,t);const n="string"==typeof(null==t||null===(e=t.cuepoint)||void 0===e?void 0:e.name)?t.cuepoint.name:"";n&&this.trigger(n,t)}function PP(t={}){const e="string"==typeof(null==t?void 0:t.event)?t.event:"";if(!oP.has(e))return;if("playing"!==e||Number.isFinite(M(xP,this))||(C(xP,this,Fy()),this.log.info(`[#handlePlayerStateEvent] Playback started @ ${(M(xP,this)/1e3).toFixed(3)}s (${Date.now()})`)),M(wP,this)===e)return;C(wP,this,e);const n=Number.isFinite(null==t?void 0:t.time)?t.time:M(aP,this)&&Number.isFinite(M(aP,this).currentTime)?M(aP,this).currentTime:0,i={};Number.isFinite(n)&&(i.time=n),"string"==typeof(null==t?void 0:t.from)&&(i.from=t.from),"string"==typeof(null==t?void 0:t.to)&&(i.to=t.to),Number.isFinite(null==t?void 0:t.targetTime)&&(i.targetTime=t.targetTime),Array.isArray(null==t?void 0:t.placements)&&(i.placements=t.placements.slice()),this.trigger(e,i)}function RP(){return new ZO(M(sP,this))}function DP(t){if(!t||"object"!=typeof t)throw new Error("EkoPlayer.switchTimeline requires a timeline definition");if(!M(aP,this)||"function"!=typeof M(aP,this).applyTimelineDefinition)throw new Error("EkoPlayer.switchTimeline requires an active timeline");M(aP,this).applyTimelineDefinition(t),"function"==typeof M(aP,this).play&&M(aP,this).play()}function LP(){M(vP,this)&&"function"==typeof M(vP,this).on&&(C(IP,this,(t=>{this.trigger(dd.QOE_SCORE,t)})),C(SP,this,(t=>{this.trigger(dd.QOE_STATUS,t)})),M(vP,this).on(dd.QOE_SCORE,M(IP,this)),M(vP,this).on(dd.QOE_STATUS,M(SP,this)))}function BP(){M(mP,this)&&"function"==typeof M(mP,this).on&&(C(NP,this,(t=>{const e=t&&"object"==typeof t?t:{error:t};this.trigger(dd.DECODER_ERROR,e),A(FP,this,zP).call(this,e)})),M(mP,this).on(dd.DECODER_ERROR,M(NP,this)))}function zP(t={}){var e;const n=M(aP,this);if(!n||"number"!=typeof n.currentTime)return;const i=Date.now();if(i<M(MP,this))return;const r=Number(n.currentTime);if(!Number.isFinite(r))return;const o=Number(null==n||null===(e=n.settings)||void 0===e?void 0:e.snapToFps),s=Number.isFinite(o)&&o>0?1/o:1/60;C(MP,this,i+1500),this.log.warn("[#attemptDecoderRecoverySeek] decoder:error received, attempting seek recovery",null==t?void 0:t.error),n.currentTime=r+s}async function WP(t={}){var e;if(M(bP,this))return M(bP,this);const n=t&&"object"==typeof t&&!Array.isArray(t)?{...t}:{},i=M(uP,this)&&M(uP,this).element?M(uP,this).element:null;if(!i)throw new Error("Debug overlay requires an initialized player canvas and mount element.");const r=function({canvasElement:t,containerElement:e}={}){const n=t&&t.parentNode?t.parentNode:null;if(null==e)return n;const i=function(t,e=(null==cd?void 0:cd.document)){if(ud(t))return t;if("string"!=typeof t)return null;let n=t.trim();if("#"===n.charAt(0)&&(n=n.slice(1)),!n||!e||"function"!=typeof e.getElementById)return null;const i=e.getElementById(n);return ud(i)?i:null}(e,t&&t.ownerDocument?t.ownerDocument:null);if(i)return i;if("string"==typeof e){const t=e.trim(),n="#"===t.charAt(0)?t.slice(1):t;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 qD})),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(lP,this),n.playerVersion=UO,C(bP,this,s({mountElement:r,canvasElement:i,timeline:M(aP,this),assetsDeliveryServiceUrl:null===(e=M(gP,this))||void 0===e||null===(e=e.assetsDeliveryService)||void 0===e||null===(e=e.settings)||void 0===e?void 0:e.assetsDeliveryServiceUrl,getNode:t=>M(sP,this)&&"function"==typeof M(sP,this).get?M(sP,this).get(t):void 0,listNodes:()=>M(sP,this)&&"function"==typeof M(sP,this).list?M(sP,this).list():[],downloadSpeed:M(gP,this)?M(gP,this).downloadSpeed:void 0,downloadEvents:_y,qoe:M(vP,this)?M(vP,this).publicAPI:void 0,qoeEvents:this,options:n,playbackStartedAtMs:M(xP,this)})),M(bP,this)}function $P(){const t=this;return{createTimeline:()=>A(FP,t,RP).call(t),switchTimeline:e=>A(FP,t,DP).call(t,e),play:M(aP,this).play,pause:M(aP,this).pause,reset:M(aP,this).reset,placeOnTimeline:M(aP,this).placeOnTimeline,placeRenderNodeOnTimeline:M(aP,this).placeRenderNodeOnTimeline,addNode:M(sP,this).add,getNode:M(sP,this).get,listNodes:M(sP,this).list,getNodesAtTime:e=>M(aP,t).getNodesAtTime(e),dispose:this.dispose,on:t.on,off:t.off,once:t.once,trigger:t.trigger,transitionTo:(e,n)=>M(hP,t).transitionTo(e,n),track:(e,...n)=>{if(M(pP,t)&&"function"==typeof M(pP,t).track)return M(pP,t).track(e,...n)},seekToPlacement:e=>M(aP,t).seekToPlacement(e),get currentTime(){return M(aP,t).currentTime},set currentTime(e){M(aP,t).currentTime=e},get buffered(){return M(aP,t).buffered},get options(){return M(lP,t)},get containerWidth(){return M(yP,t)?M(yP,t).containerWidth:0},get containerHeight(){return M(yP,t)?M(yP,t).containerHeight:0},get playbackRate(){return M(aP,t).playbackRate},set playbackRate(e){M(aP,t).playbackRate=e},get paused(){return!!M(aP,t)&&!0===M(aP,t).paused},get muted(){return!!M(fP,t)&&M(fP,t).muted},set muted(e){M(fP,t)&&(M(fP,t).muted=e)},get volume(){return M(fP,t)?M(fP,t).volume:1},set volume(e){M(fP,t)&&(M(fP,t).volume=e)},get qoe(){return M(vP,t)?M(vP,t).publicAPI:void 0},get utils(){return qO},get version(){return UO},loadDebugOverlay:(...e)=>A(FP,t,WP).call(t,...e)}}function jP(t){t&&(C(uP,this,t.canvas),C(sP,this,t.nodeRepository),C(aP,this,t.timeline),C(fP,this,t.audioAdapter||t.audioPlaybackManager),C(pP,this,t.tracker),C(mP,this,t.parsingManager),C(vP,this,t.qoe),C(dP,this,t.renderAdapter||t.renderer),C(hP,this,t.transitionManager),C(yP,this,t.containerSize))}class UP{constructor({target:t,props:e}){if(!t)throw new Error("`options.target` is required");vo(this.#kt,e,!0),this.#kt.v.EkoPlayer=CP;const n=t.hasChildNodes()?ra:ia;this.#wt=n(Ru,{target:t,props:this.#kt.v})}#wt;#kt=Ii(po(xo({})),"EkoGallery.#props");destroy(t){if(this.#wt)return la(this.#wt,t)}get props(){return Rs(this.#kt)}}const qP=u("gallery-react");const VP=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(t){return void 0!==t}(i),f=e.useRef(s),p=e.useRef(o);d.current.initEventSent||(c("galleryinit"),d.current.initEventSent=!0);const m=e.useCallback((t=>{d.current.state=t,t.activeItemIndex===f.current.index&&t.activeModuleIndex===f.current.step||c("activeitemchanged",{index:t.activeItemIndex,step:t.activeModuleIndex})}),[]),v=e.useCallback((t=>{d.current.API=t,0===f.current.index&&0===f.current.step||t.selectItemAndStep(f.current.index,f.current.step),d.current.unsubscribe&&d.current.unsubscribe(),d.current.unsubscribe=t.subscribe(m)}),[]),g=e.useCallback(((t,e)=>{c(t,e)}),[c]);return e.useEffect((()=>(qP.setDataStorage("gallery-react",{config:i}),window.eko=window.eko||{},window.eko.config=i,window.eko.gallery={version:"copy-instance/4.0.13"},()=>{window.eko.config=void 0})),[i]),e.useImperativeHandle(n,(()=>({prev:()=>{var t;null===(t=d.current.API)||void 0===t||t.prev()},next:()=>{var t;null===(t=d.current.API)||void 0===t||t.next()}}))),e.useEffect((()=>{if(null==u||!u.current)return;const t=u.current;return d.current.app=new UP({target:t,props:{config:i,forceMobile:a,videoAspectRatio:l,hideNav:!0,onGalleryReady:v,onEvent:g}}),()=>{var t;null===(t=d.current.app)||void 0===t||t.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}));VP.propTypes={className:Tt.string,config:Tt.object,variantId:Tt.string,onEvent:Tt.func,ssrHtml:Tt.string,videoAspectRatio:Tt.string,debug:Tt.bool,activeItem:Tt.shape({index:Tt.number,step:Tt.number}),forceMobile:Tt.bool,instanceId:Tt.string,children:Tt.node},VP.displayName="EkoGallerySvelte";const GP=n("v2"),HP=n("v1"),KP="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{},XP=KP&&KP.performance,YP=XP&&"function"==typeof XP.now?()=>XP.now():()=>Date.now(),QP=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",CANVAS_WEBGL_CONTEXT_LOST:"canvas.webglcontextlost",CANVAS_WEBGL_CONTEXT_RESTORED:"canvas.webglcontextrestored"}),JP=["ui-monospace,","SFMono-Regular,","Menlo,","Monaco,","Consolas,",'"Liberation Mono",','"Courier New",',"monospace"].join(" "),ZP=`11px ${JP}`,tR=`12px ${JP}`;function eR(t){return"number"==typeof t&&Number.isFinite(t)}function nR(t){return eR(t)&&t>0}function iR(t){return eR(t)?Math.min(1,Math.max(0,t)):0}function rR(t,e=3){return eR(t)?t.toFixed(e):String(t)}function oR(t,e){const n=Number(t),i=Number(e);return!Number.isFinite(n)||!Number.isFinite(i)||n<=0||i<=0?"n/a":`${Math.round(n)}x${Math.round(i)}`}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({width:t=220,height:e=48,windowMs:n=6e4,maxValue:i=60,autoScale:r=!1,formatValue:o}={}){O(this,fR),F(this,sR,void 0),F(this,aR,void 0),F(this,lR,[]),F(this,cR,void 0),F(this,uR,void 0),F(this,dR,void 0),F(this,hR,void 0);const s=null==KP?void 0:KP.document;if(!s||"function"!=typeof s.createElement)throw new Error("Debug overlay graph requires document.createElement.");C(sR,this,s.createElement("canvas")),M(sR,this).width=t,M(sR,this).height=e,M(sR,this).style.width=`${t}px`,M(sR,this).style.height=`${e}px`,M(sR,this).style.borderRadius="6px",M(sR,this).style.background="#111",C(aR,this,M(sR,this).getContext("2d")),C(cR,this,n),C(uR,this,i),C(dR,this,!!r),C(hR,this,"function"==typeof o?o:null)}get element(){return M(sR,this)}push(t,e){if(M(sR,this)&&M(aR,this)&&Number.isFinite(t)&&Number.isFinite(e)){for(M(lR,this).push({t:e,v:t});M(lR,this).length&&e-M(lR,this)[0].t>M(cR,this);)M(lR,this).shift();A(fR,this,mR).call(this)}}dispose(){C(lR,this,[]),C(aR,this,null),C(sR,this,null)}}function mR(){const t=M(aR,this),e=M(sR,this);if(!t||!e)return;const n=e.width,i=e.height;if(!n||!i)return;if(t.clearRect(0,0,n,i),t.fillStyle="#111",t.fillRect(0,0,n,i),!M(lR,this).length)return;const r=M(lR,this)[0].t;if(!(M(lR,this)[M(lR,this).length-1].t>r))return;const o=M(dR,this)?M(lR,this).reduce(((t,e)=>e.v>t?e.v:t),0):M(uR,this),s=o>0?o:M(uR,this);t.strokeStyle="#0f0",t.lineWidth=2,t.beginPath();for(let e=0;e<M(lR,this).length;e+=1){const o=M(lR,this)[e],a=(o.t-r)/M(cR,this)*n,l=i-(s>0?Math.min(1,Math.max(0,o.v/s)):0)*i;0===e?t.moveTo(a,l):t.lineTo(a,l)}t.stroke();const a=M(lR,this).length?M(lR,this)[M(lR,this).length-1]:null,l=Number.isFinite(null==a?void 0:a.v)?a.v:null;if(null===l)return;const c=M(hR,this)?M(hR,this).call(this,l):l.toFixed(1);if("string"!=typeof c||!c)return;t.font=ZP,t.textAlign="right",t.textBaseline="top";const u=t.measureText(c),d=Math.ceil(u.width)+8,h=n-d-2;t.fillStyle="rgba(0,0,0,0.55)",t.fillRect(h,2,d,14),t.fillStyle="#fff",t.fillText(c,n-2-4,4)}const vR=new Intl.NumberFormat("en-US");function gR(t,e){const n=(null==t?void 0:t.trackId)||"",i=(null==e?void 0:e.trackId)||"";if(n!==i)return n<i?-1:1;const r=(null==t?void 0:t.nodeId)||"",o=(null==e?void 0:e.nodeId)||"";if(r!==o)return r<o?-1:1;const s=(null==t?void 0:t.segmentId)||"",a=(null==e?void 0:e.segmentId)||"";return s!==a?s<a?-1:1:("number"==typeof(null==t?void 0:t.presentationTime)?t.presentationTime:0)-("number"==typeof(null==e?void 0:e.presentationTime)?e.presentationTime:0)}function yR(t,e){for(t.push(e);t.length&&e-t[0]>1e3;)t.shift();if(t.length<2)return 0;const n=t[t.length-1]-t[0];return n<=0?0:1e3*(t.length-1)/n}function bR(t,e){if("function"!=typeof t||!e)return;const n=t(e.nodeId),i=null==n?void 0:n.tracks;if(!Array.isArray(i))return;const r=i.find((t=>(null==t?void 0:t.id)===e.trackId)),o=null==r?void 0:r.segments;return Array.isArray(o)?o.find((t=>(null==t?void 0:t.id)===e.segmentId)):void 0}function kR(t,e){var n;const i=bR(t,e);return(null==i?void 0:i.abrDecision)||(null==i||null===(n=i.chosenRepresentation)||void 0===n?void 0:n.abrDecision)}function wR(t){const e=Number(t);return!Number.isFinite(e)||e<=0?"n/a":`${vR.format(Math.round(e))}kbps`}function xR(t){const e=Number(t);return!Number.isFinite(e)||e<=0?"n/a":`${vR.format(Math.round(e/1e3))}kbps`}function _R(t,e=3){const n=Number(t);return Number.isFinite(n)?n.toLocaleString("en-US",{minimumFractionDigits:e,maximumFractionDigits:e}):String(t)}function TR(t,e){var n;if("function"!=typeof t||!e)return;const i=t(e.nodeId),r=null==i||null===(n=i.manifestRef)||void 0===n?void 0:n.encodeProfile;return"string"==typeof r&&r?r:void 0}function ER(t,e){if("function"!=typeof t||!e)return;const n=t(e.nodeId);return!0===(null==n?void 0:n.imageFallbackActive)?"image":void 0}function IR(t,e){const n=function(t){if(!t)return;const e=[[t.displayWidth,t.displayHeight],[t.codedWidth,t.codedHeight],[t.videoWidth,t.videoHeight],[t.naturalWidth,t.naturalHeight],[t.width,t.height]];for(let t=0;t<e.length;t+=1){const[n,i]=e[t],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}(null==e?void 0:e.frame)||{},i=Number.isFinite(null==e?void 0:e.width)?e.width:n.width,r=Number.isFinite(null==e?void 0:e.height)?e.height:n.height,o=function(t,e,n){return null===(n=bR(t,e))||void 0===n?void 0:n.chosenRepresentation}(t,e);if(!o)return eR(i)&&eR(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 SR(t){const e=Number(t);if(Number.isFinite(e)&&!(e<=0))return e/1e3}function AR(t,e){const n=Number(null==t?void 0:t.bandwidthKbps),i=Number(null==e?void 0:e.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==t?void 0:t.id)||"",a=(null==e?void 0:e.id)||"";return s===a?0:s<a?-1:1}function NR(t,e,n,i){const r=[];if(Array.isArray(null==i?void 0:i.availableRepresentations)&&i.availableRepresentations.forEach((t=>{const e="string"==typeof(null==t?void 0:t.id)&&t.id?t.id:void 0;if(!e)return;const n=Number(null==t?void 0:t.bandwidthKbps);r.push({id:e,bandwidthKbps:Number.isFinite(n)&&n>0?n:void 0})})),!r.length){const n=bR(t,e);(Array.isArray(null==n?void 0:n.representations)?n.representations:[]).forEach((t=>{const e="string"==typeof(null==t?void 0:t.id)&&t.id?t.id:void 0;e&&r.push({id:e,bandwidthKbps:SR(null==t?void 0:t.bandwidth)})}))}!r.length&&(null==n?void 0:n.id)&&r.push({id:n.id,bandwidthKbps:SR(n.bandwidth)});const o=new Map;return r.forEach((t=>{const e=null==t?void 0:t.id;e&&!o.has(e)&&o.set(e,t)})),Array.from(o.values()).sort(AR)}const MR=1024,FR=1048576,CR=1073741824;function OR(t){return eR(t)?t>=1e3?`${rR(t/1e3,1)} Mbps`:`${rR(t,1)} kbps`:"n/a"}function PR({downloadSpeed:t,downloadEvents:e}={}){const n=KP.document,i="function"==typeof(null==t?void 0:t.getKbps)?t.getKbps():void 0;let r=0;const{metricsRow:o,setInitial:s,setTotal:a}=function(t){const e=t.createElement("div");e.style.display="grid",e.style.gridTemplateColumns="1fr 1fr",e.style.gap="8px",e.style.font=tR;const n=t.createElement("div"),i=t.createElement("div");return e.appendChild(n),e.appendChild(i),{metricsRow:e,setInitial:t=>{n.textContent=`initial=${OR(t)}`},setTotal:t=>{var e;i.textContent="total="+(eR(e=t)?e<MR?`${Math.round(e)} B`:e<FR?`${rR(e/MR,1)} KB`:e<CR?`${rR(e/FR,2)} MB`:`${rR(e/CR,2)} GB`:"n/a")}}}(n),{graphWrap:l,speedGraph:c}=function(t,e){const n=t.createElement("div");n.style.marginTop="10px";const i=t.createElement("div");i.textContent="download speed",i.style.font=ZP,i.style.opacity="0.9";const r=eR(e)&&e>0?e:1,o=new pR({autoScale:!0,maxValue:r,formatValue:OR});return n.appendChild(i),n.appendChild(o.element),{graphWrap:n,speedGraph:o}}(n,i);s(i),a(r);const u=t=>{const e=Number(null==t?void 0:t.kbps);Number.isFinite(e)&&c.push(e,null!=KP&&KP.performance&&"function"==typeof KP.performance.now?KP.performance.now():Date.now())},d=t=>{const e=Number(null==t?void 0:t.bytes);Number.isFinite(e)&&(r+=e,a(r))};return t&&"function"==typeof t.on&&t.on("download:speed",u),e&&"function"==typeof e.on&&e.on("download:sample",d),{id:"downloads",title:"Downloads",render:t=>{t.appendChild(o),t.appendChild(l)},dispose:()=>{t&&"function"==typeof t.off&&t.off("download:speed",u),e&&"function"==typeof e.off&&e.off("download:sample",d),c.dispose()}}}function RR(t){return eR(t)?rR(t,3):"n/a"}function DR(){return null!=KP&&KP.performance&&"function"==typeof KP.performance.now?KP.performance.now():Date.now()}var LR,BR,zR,WR={exports:{}},$R=(LR||(LR=1,BR=WR,function(t,e){BR.exports?BR.exports=e():t.log=e()}(WR.exports,(function(){var t=function(){},e="undefined",n=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],r={},o=null;function s(t,e){var n=t[e];if("function"==typeof n.bind)return n.bind(t);try{return Function.prototype.bind.call(n,t)}catch(e){return function(){return Function.prototype.apply.apply(n,[t,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?t:this.methodFactory(o,n,this.name)}if(this.log=this.debug,typeof console===e&&n<this.levels.SILENT)return"No console available for logging"}function c(t){return function(){typeof console!==e&&(l.call(this),this[t].apply(this,arguments))}}function u(i,r,o){return"debug"===(l=i)&&(l="log"),typeof console!==e&&("trace"===l&&n?a:void 0!==console[l]?s(console,l):void 0!==console.log?s(console,"log"):t)||c.apply(this,arguments);var l}function d(t,n){var s,a,c,d=this,h="loglevel";function f(){var t;if(typeof window!==e&&h){try{t=window.localStorage[h]}catch(t){}if(typeof t===e)try{var n=window.document.cookie,i=encodeURIComponent(h),r=n.indexOf(i+"=");-1!==r&&(t=/^([^;]+)/.exec(n.slice(r+i.length+1))[1])}catch(t){}return void 0===d.levels[t]&&(t=void 0),t}}function p(t){var e=t;if("string"==typeof e&&void 0!==d.levels[e.toUpperCase()]&&(e=d.levels[e.toUpperCase()]),"number"==typeof e&&e>=0&&e<=d.levels.SILENT)return e;throw new TypeError("log.setLevel() called with invalid level: "+t)}"string"==typeof t?h+=":"+t:"symbol"==typeof t&&(h=void 0),d.name=t,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(t,n){return c=p(t),!1!==n&&function(t){var n=(i[t]||"silent").toUpperCase();if(typeof window!==e&&h){try{return void(window.localStorage[h]=n)}catch(t){}try{window.document.cookie=encodeURIComponent(h)+"="+n+";"}catch(t){}}}(c),l.call(d)},d.setDefaultLevel=function(t){a=p(t),f()||d.setLevel(t,!1)},d.resetLevel=function(){c=null,function(){if(typeof window!==e&&h){try{window.localStorage.removeItem(h)}catch(t){}try{window.document.cookie=encodeURIComponent(h)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(t){}}}(),l.call(d)},d.enableAll=function(t){d.setLevel(d.levels.TRACE,t)},d.disableAll=function(t){d.setLevel(d.levels.SILENT,t)},d.rebuild=function(){if(o!==d&&(s=p(o.getLevel())),l.call(d),o===d)for(var t in r)r[t].rebuild()},s=p(o?o.getLevel():"WARN");var m=f();null!=m&&(c=p(m)),l.call(d)}(o=new d).getLogger=function(t){if("symbol"!=typeof t&&"string"!=typeof t||""===t)throw new TypeError("You must supply a name when creating a logger.");var e=r[t];return e||(e=r[t]=new d(t,o.methodFactory)),e};var h=typeof window!==e?window.log:void 0;return o.noConflict=function(){return typeof window!==e&&window.log===o&&(window.log=h),o},o.getLoggers=function(){return r},o.default=o,o}))),WR.exports),jR=(zR=$R)&&zR.__esModule&&Object.prototype.hasOwnProperty.call(zR,"default")?zR.default:zR;const UR=()=>{},qR=["trace","log","debug","info","warn","error","getLevel","setLevel"],VR=["trace","debug","info","warn","error","silent"],GR={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;"},HR="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global;let KR={level:"trace",appName:""},XR=[];const YR="object"==typeof HR&&HR.performance&&"function"==typeof HR.performance.now?HR.performance.now.bind(HR.performance):Date.now.bind(Date),QR=t=>t&&"string"==typeof t?t.toLowerCase().trim():"",JR=(()=>{try{const t=new URLSearchParams(document.location.search),e=[].concat(t.getAll("log")).concat(t.getAll("ekolog")).concat(t.getAll("ekologger")).join(",").split(",");if(0===e.length)return{};let n={};return e.forEach((t=>{const[e,i]=t.split(":");n[QR(e)]=QR(i)||"trace"})),n}catch(t){return{}}})(),ZR=(t,e="")=>{const n=QR(t),i=jR.getLogger(n);if(i.__ekologger)return i.__ekologger;e||JR[n]||JR["*"]||(i.__noExplicitLevel=!0);const r=i.methodFactory;i.methodFactory=(e,n,i)=>{const o=r(e,n,i),s=e.toUpperCase();return(...e)=>{o(`[${((t,e=3)=>(YR()/1e3).toFixed(e))()}] %c[${s}] ${KR.appName?`[${KR.appName}] `:""}[${t}]`,GR[s],...e)}},e=JR[n]||JR["*"]||e||KR.level,i.setLevel(e,!1);const o=(...t)=>i.log(...t);return qR.forEach((t=>{o[t]=(...e)=>(XR.forEach((n=>{n[t](...e)})),i[t](...e))})),i.__ekologger=o,o};ZR.setDefaults=({appName:t="",level:e})=>{t&&"string"==typeof t&&(KR.appName=t),(e=QR(e))&&VR.includes(e)&&(KR.level=e,Object.values(jR.getLoggers()).filter((t=>t.__noExplicitLevel)).forEach((t=>t.setLevel(KR.level,!1))))},ZR.installDriver=t=>{const e={...qR.reduce(((e,n)=>(e[n]="function"==typeof(null==t?void 0:t[n])?t[n]:UR,e)),{})};XR.push(e)},ZR("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(((t,[e,n])=>(Object.prototype.hasOwnProperty.call(n,"default")&&(t[e]=n.default),t)),{})),ZR("config","warn");const tD=18,eD="rgba(83,170,255,0.9)",nD={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)"},iD={border:"1px solid rgba(102,214,141,0.28)",background:"rgba(102,214,141,0.16)",color:"rgba(167,240,185,1)"},rD={border:"1px solid rgba(255,200,87,0.3)",background:"rgba(255,200,87,0.16)",color:"rgba(255,227,171,1)"},oD="noop",sD="seek",aD="copy-node-id",lD="copy-node-context",cD="copy-source-video-url",uD=[{value:oD,label:"NOOP"},{value:sD,label:"Seek"},{value:aD,label:"Copy Node ID"},{value:lD,label:"Copy Node Context"},{value:cD,label:"Copy Source Video URL"}],dD=["type","url","mimeType","assetId","assetRevision","encodeProfile","duration","width","height"],hD=["id","url","mime","codecs","baseCodec","bandwidth","timescale","sizeBytes","width","height","frameRate","segStart","segDuration"];function fD(t,e){if(nR(null==t?void 0:t.nodeDurationOverride))return t.nodeDurationOverride;if("function"!=typeof e)return null;const n=e(null==t?void 0:t.nodeId),i=null==n?void 0:n.duration;return nR(i)?i:null}function pD(t){const e=Number(null==t?void 0:t.duration);return e===Number.POSITIVE_INFINITY?Number.POSITIVE_INFINITY:nR(e)?e:null}function mD(t){return t===Number.POSITIVE_INFINITY}function vD(t){return eR(t)?String(t):""}function gD(t,e=[]){return e.reduce(((e,n)=>(void 0!==(null==t?void 0:t[n])&&(e[n]=t[n]),e)),{})}function yD(t){const e=uD.find((e=>e.value===t));return e?e.value:oD}function bD(t){return t?"string"==typeof(null==t?void 0:t.message)&&t.message?t.message:"string"==typeof t&&t?t:null:null}function kD(t){return t&&eR(t.start)&&eR(t.end)?{start:t.start,end:t.end}:null}function wD(t){return t?gD(t,hD):null}function xD(t,e){const n="string"==typeof(null==t?void 0:t.nodeId)?t.nodeId:"",i="function"==typeof e&&n?e(n):null,r=function(t){return t?"string"==typeof t?t:gD(t,dD):null}(null==i?void 0:i.manifestRef),o=r&&"object"==typeof r?r.assetId:void 0,s={placement:{placementId:"string"==typeof(null==t?void 0:t.placementId)?t.placementId:void 0,nodeId:n||void 0,offset:eR(null==t?void 0:t.offset)?t.offset:void 0,duration:fD(t,e),offsetPending:!0===(null==t?void 0:t.offsetPending),nodeOffsetOverride:eR(null==t?void 0:t.nodeOffsetOverride)?t.nodeOffsetOverride:void 0,nodeDurationOverride:eR(null==t?void 0:t.nodeDurationOverride)?t.nodeDurationOverride:void 0},node:i?{id:i.id||n||void 0,state:"string"==typeof i.state?i.state:void 0,duration:eR(i.duration)?i.duration:null,mainTrackId:"string"==typeof i.mainTrackId?i.mainTrackId:void 0,assetId:"string"==typeof o?o:void 0,manifestRef:r,buffered:kD(i.buffered),imageFallbackActive:!0===i.imageFallbackActive,retainedByteLength:eR(i.retainedByteLength)?i.retainedByteLength:0,children:Array.isArray(i.children)?i.children.map((t=>({nodeId:"string"==typeof(null==t?void 0:t.nodeId)?t.nodeId:void 0,weight:eR(null==t?void 0:t.weight)?t.weight:void 0}))):[],tracks:Array.isArray(i.tracks)?i.tracks.map((t=>function(t){return t?{id:t.id,type:t.type,offset:eR(t.offset)?t.offset:0,duration:eR(t.duration)?t.duration:null,endTime:eR(t.endTime)?t.endTime:null,buffered:kD(t.buffered),segments:Array.isArray(t.segments)?t.segments.map((t=>function(t){if(!t)return null;const e={id:t.id,isInit:!0===t.isInit,offset:eR(t.offset)?t.offset:0,duration:eR(t.duration)?t.duration:0,bufferedRatio:eR(t.bufferedRatio)?t.bufferedRatio:0,retainedByteLength:eR(t.retainedByteLength)?t.retainedByteLength:0,isLoaded:!0===t.isLoaded,loadAttempts:eR(Number(t.loadAttempts))?Number(t.loadAttempts):0,appliedFilters:Array.isArray(t.appliedFilters)?t.appliedFilters.slice():[],chosenRepresentation:wD(t.chosenRepresentation),representations:Array.isArray(t.representations)?t.representations.map((t=>wD(t))).filter(Boolean):[]},n=bD(t.loadError);return n&&(e.loadError=n),e}(t))).filter(Boolean):[]}:null}(t))).filter(Boolean):[]}:null};if(i){const t=Number(i.manifestLoadAttempts);eR(t)&&t>0&&(s.node.manifestLoadAttempts=t);const e=bD(i.manifestLoadError);e&&(s.node.manifestLoadError=e);const n=bD(i.error);n&&(s.node.error=n)}return s}function _D(t=[],e=[],n){const i=function(t=[],e){return Array.isArray(t)&&t.length?t.map((t=>t?["string"==typeof t.placementId?t.placementId:"","string"==typeof t.nodeId?t.nodeId:"",vD(t.offset),vD(fD(t,e)),!0===t.offsetPending?"1":"0",vD(t.nodeOffsetOverride),vD(t.nodeDurationOverride)].join("|"):"null")).join(";"):""}(t,n);return`${i}::${function(t=[]){return Array.isArray(t)&&t.length?t.map((t=>{if(!t)return"null";const e="string"==typeof t.renderPlacementId?t.renderPlacementId:"",n="string"==typeof t.type?t.type:"",i=vD(t.offset),r=pD(t);return[e,n,i,r===Number.POSITIVE_INFINITY?"inf":vD(r),!0===t.offsetPending?"1":"0"].join("|")})).join(";"):""}(e)}`}function TD(t=[],e){if(!Array.isArray(t)||!t.length)return!1;for(let n=0;n<t.length;n+=1){const i=t[n];if(!i||!0===i.offsetPending)continue;if(nR(i.nodeDurationOverride))continue;if("function"!=typeof e)return!0;const r=e(i.nodeId);if(!nR(null==r?void 0:r.duration))return!0}return!1}function ED(t=[]){return!(!Array.isArray(t)||!t.length)&&t.some((t=>!0===(null==t?void 0:t.offsetPending)))}function ID(t=[],e=[]){return ED(t)||ED(e)}function SD(t,e=[],n){if(!t||!Array.isArray(e)||!e.length)return;const i=t.querySelector('[data-segment-boundary="true"]');e.forEach((e=>{if(!e||!eR(e.startRatio)||!eR(e.endRatio))return;const r=iR(e.startRatio),o=iR(e.endRatio);if(!(o>r))return;const s=KP.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?t.insertBefore(s,i):t.appendChild(s)}))}function AD(t,e){if(!t)return;const n=t.querySelector('[data-active-highlight="true"]');if(!e)return void(n&&n.remove());if(n)return;const i=KP.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",t.appendChild(i)}function ND({timeline:t,getNode:e,assetsDeliveryServiceUrl:n}={}){const i=null==KP?void 0:KP.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=ZP,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=ZP,s.style.maxWidth="260px",s.style.flexDirection="column",s.style.gap="6px";const a=i.createElement("div");a.style.font=tR,a.style.opacity="0.95";const l=i.createElement("div");l.style.font=ZP,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=tR,h.style.opacity="0.9";const f=i.createElement("div");f.style.font=ZP,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=ZP;const m=i.createElement("span");m.textContent="Click action";const v=i.createElement("select");v.style.font=ZP,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",uD.forEach((t=>{const e=i.createElement("option");e.value=t.value,e.textContent=t.label,v.appendChild(e)})),v.value=oD;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=iD.border,g.style.background=iD.background,g.style.color=iD.color,g.style.font=ZP,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(t,e,{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=t,o.style.font=ZP,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",e&&(s.dataset.timelineLane=e);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=[],E=0,I=oD,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(t){for(;t.childNodes.length>1;)t.removeChild(t.lastChild)}function U(){z&&(clearTimeout(z),z=null)}function q(){W&&(((null==KP?void 0:KP.clearTimeout)||clearTimeout)(W),W=null)}function V(){$&&(((null==KP?void 0:KP.clearTimeout)||clearTimeout)($),$=null)}function G(){g.style.display="none",g.style.opacity="0",g.style.transform="translateY(2px)",g.textContent=""}function H(){return!!D||!!t&&(Array.isArray(t.placements)||Array.isArray(t.renderPlacements))}function K(){if(!t)return!1;const e=Array.isArray(t.placements),n=Array.isArray(t.renderPlacements);if(!e&&!n)return!1;const i=e?t.placements:[],r=n?t.renderPlacements:[];return(i.length!==L||r.length!==B)&&(dt(i,r),!0)}function X(){if(!D)return!1;const t=_D(_,T,e);return t!==R&&(R=t,at(),ut(),!0)}function Y(){H()?z=function({shouldSchedule:t,isScheduled:e,intervalMs:n,onTick:i}){return e?null:setTimeout(i,n)}({shouldSchedule:!0,isScheduled:!!z,intervalMs:D?100:250,onTick:()=>{z=null,H()&&(K()||X()||Y())}}):U()}function Q(t,e){const n=e>0?E/e:0;t.style.left=100*iR(n)+"%",t.style.transform="translateX(-1px)"}function J(){o.style.display="none"}function Z(){q(),V(),G()}function tt(t,{tone:e="success"}={}){if(!t)return void Z();q(),V(),function(t="success"){const e=function(t="success"){return"warning"===t?rD:iD}(t);g.style.border=e.border,g.style.background=e.background,g.style.color=e.color}(e),g.textContent=t,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==KP?void 0:KP.setTimeout)||setTimeout;W=n((()=>{W=null,function(){q(),V(),g.style.opacity="0",g.style.transform="translateY(-2px)";const t=(null==KP?void 0:KP.setTimeout)||setTimeout;$=t((()=>{$=null,G()}),180)}()}),1800)}function et(t,e){if(!t)return void J();o.textContent=t,o.style.display="block";const n=r.getBoundingClientRect(),i=o.getBoundingClientRect(),s=((null==e?void 0:e.clientX)||0)-n.left+12,a=((null==e?void 0:e.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 nt(){s.style.display="none"}function it(t,n){const o="function"==typeof e&&t?e(t):null,u=Array.isArray(null==o?void 0:o.children)?o.children:[];if(!u.length)return void nt();if(a.textContent=t,l.textContent="children",function(){for(;c.firstChild;)c.removeChild(c.firstChild)}(),u.forEach((t=>{t&&t.nodeId&&c.appendChild(function(t){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==t?void 0:t.nodeId)?t.nodeId:"",o=nR(null==t?void 0:t.weight)?t.weight:1,s=function(t){if(!t||"function"!=typeof e)return"missing";const n=e(t);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=nD[s]||nD.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=${rR(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}(t))})),!c.childNodes.length)return void nt();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 rt(){const e=E;if(t&&"function"==typeof t.getPlacementsActiveAtTime){const n=t.getPlacementsActiveAtTime(e),i=new Set(n.map((t=>null==t?void 0:t.placementId)).filter((t=>"string"==typeof t&&t.length)));C.forEach((t=>{i.has(t)||AD(M.get(t),!1)})),i.forEach((t=>{C.has(t)||AD(M.get(t),!0)})),C=i}else w.track.querySelectorAll('[data-timeline-item="nodes"]').forEach((t=>{const n="true"===t.dataset.hasDuration,i=Number(t.dataset.start),r=Number(t.dataset.end);AD(t,n&&eR(e)&&e>=i&&e<r)}));if(t&&"function"==typeof t.getActiveRenderPlacement){const n=t.getActiveRenderPlacement(e),i=null==n?void 0:n.renderPlacementId;O&&O!==i&&AD(F.get(O),!1),i&&O!==i&&AD(F.get(i),!0),O=i||null}else x.track.querySelectorAll('[data-timeline-item="render"]').forEach((t=>{const n="true"===t.dataset.hasDuration,i=Number(t.dataset.start),r=Number(t.dataset.end);AD(t,n&&eR(e)&&e>=i&&e<r)}))}function ot(t){const n=fD(t,e);if(!nR(n)||"function"!=typeof e)return{boundaries:[],buffered:[]};const i=e(null==t?void 0:t.nodeId),r=function(t){const e=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[];if(!e.length)return null;if(null!=t&&t.mainTrackId){const n=e.find((e=>(null==e?void 0:e.id)===t.mainTrackId));if(n)return n}return e.find((t=>Array.isArray(null==t?void 0:t.segments)&&t.segments.length))||null}(i);if(!r)return{boundaries:[],buffered:[]};const o=t=>{if(!t)return 0;const e=Number(null==t?void 0:t.bufferedRatio);if(Number.isFinite(e))return iR(e);const n=Number(null==t?void 0:t.retainedByteLength);if(!nR(n))return 0;const i=null==t?void 0:t.chosenRepresentation,r=nR(null==i?void 0:i.sizeBytes)?i.sizeBytes:null;return nR(r)?iR(n/r):1},s=Array.isArray(r.segments)?r.segments:[],a=eR(null==r?void 0:r.offset)?r.offset:0,l=eR(null==t?void 0:t.nodeOffsetOverride)?t.nodeOffsetOverride:0;if(!s.length){const t=null==i?void 0:i.buffered,e=eR(null==t?void 0:t.start)?t.start-l:0,r=eR(null==t?void 0:t.end)?t.end-l:0,o=Math.max(0,e),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 t=s.find((t=>t&&!t.isInit))||s[0],e=t?o(t):0;return e>0?{boundaries:[],buffered:[{startRatio:0,endRatio:iR(e)}]}:{boundaries:[],buffered:[]}}return function(t,e,n,i,r){const o=[],s=[];let a=0;return t.forEach((t=>{if(null!=t&&t.isInit)return;eR(null==t?void 0:t.offset)&&(a=t.offset);const l=a;if(!eR(l))return;const c=eR(null==t?void 0:t.duration)?t.duration:0,u=n+l-i,d=n+(l+c)-i;u>0&&u<e&&o.push(u/e);const h="function"==typeof r?r(t):0;if(c>0&&d>0&&u<e&&h>0){const t=Math.max(0,u),n=Math.min(e,d);if(n>t){const i=t+(n-t)*iR(h);s.push({startRatio:t/e,endRatio:i/e})}}c>0&&(eR(null==t?void 0:t.offset)?a=t.offset+c:a+=c)})),{boundaries:o,buffered:s}}(s,n,a,l,o)}function st(){const t=Array.isArray(_)?_:[],e=new Map(t.map((t=>[null==t?void 0:t.placementId,t])));for(const[t,n]of M.entries()){if(!t)continue;const i=e.get(t);i&&(n.querySelectorAll('[data-buffered-segment="true"]').forEach((t=>t.remove())),SD(n,ot(i).buffered,eD))}}function at(){const t=new Set(_.map((t=>null==t?void 0:t.nodeId)).filter((t=>"string"==typeof t&&t.length)));t.forEach((t=>{if(N.has(t))return;const n="function"==typeof e?e(t):null;if(!n||"function"!=typeof n.on)return;const i=t=>function(t={}){if(!t||t.isInit)return;const e=null==t?void 0:t.nodeId,n=null==t?void 0:t.segmentId,i=Number(null==t?void 0:t.loaded),r=Number(null==t?void 0:t.total);if(!e||!n||!eR(i))return;const o=`${e}:${n}`,s=A.get(o)||{},a={loaded:Math.max(eR(s.loaded)?s.loaded:0,i),total:nR(r)?r:s.total};A.set(o,a),function(){if(P)return;P=!0;const t=null==KP?void 0:KP.requestAnimationFrame;"function"!=typeof t?((null==KP?void 0:KP.setTimeout)||setTimeout)((()=>{P=!1,st()}),0):t((()=>{P=!1,st()}))}()}(t);n.on("segment:chunk",i),N.set(t,{node:n,handler:i})}));for(const[e,n]of N.entries())t.has(e)||(null!=n&&n.node&&"function"==typeof n.node.off&&n.node.off("segment:chunk",n.handler),N.delete(e))}function lt({track:t,color:e,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(t,e){t.style.position="absolute",t.style.borderRadius="4px",t.style.background=e,t.style.opacity="0.9",t.style.font=ZP,t.style.color="#fff",t.style.display="flex",t.style.alignItems="center",t.style.whiteSpace="nowrap",t.style.overflow="hidden",t.style.textOverflow="ellipsis"}(x,e),function(t,{startRatio:e,durationRatio:n,rowIndex:i=0,rowHeight:r=18,rowGap:o=0}={}){const s=i*(r+o)+2,a=Math.max(1,r-4);t.style.top=`${s}px`,t.style.height=`${a}px`;const l=iR(e);if(nR(n)){const e=Math.max(0,Math.min(n,1-l));return t.style.left=100*l+"%",t.style.width=100*e+"%",void(t.style.padding="0 4px")}t.style.left=100*l+"%",t.style.width="2px",t.style.padding="0"}(x,{startRatio:n,durationRatio:r,rowIndex:h,rowHeight:f,rowGap:p}),function(t,{laneId:e,label:n,isClickable:i,shouldShowLabel:r,onClick:o}={}){if(e&&(t.dataset.timelineItem=e),r&&n){const e=KP.document.createElement("span");e.textContent=n,e.style.position="relative",e.style.zIndex="2",e.style.pointerEvents="none",t.appendChild(e)}i&&(t.style.cursor="pointer"),"function"==typeof o&&t.addEventListener("click",o)}(x,{laneId:m,label:d,isClickable:v,shouldShowLabel:"boolean"==typeof k?k:nR(r),onClick:w}),y&&(x.title=y),eR(o)&&(x.dataset.start=String(o)),nR(s)||mD(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",SD(x,l,eD),function(t,e=[]){t&&Array.isArray(e)&&e.length&&e.forEach((e=>{if(!eR(e)||e<=0||e>=1)return;const n=KP.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*iR(e)+"%",n.style.transform="translateX(-0.5px)",n.style.background="rgba(255,255,255,0.35)",n.style.pointerEvents="none",n.style.zIndex="1",t.appendChild(n)}))}(x,a),AD(x,g),y&&(x.addEventListener("mouseenter",(t=>et(y,t))),x.addEventListener("mousemove",(t=>et(y,t))),x.addEventListener("mouseleave",J)),b&&(x.addEventListener("mouseenter",(t=>it(b,t))),x.addEventListener("mousemove",(t=>it(b,t))),x.addEventListener("mouseleave",nt)),t.appendChild(x),"nodes"===m&&c?M.set(c,x):"render"===m&&c&&F.set(c,x)}async function ct({event:i,placement:r,rangeEnd:o,track:s}){const a=yD(I);if(a===oD)return;if(a===sD)return void function(e,n,i){if(!t)return;if(!nR(n)||!i)return;const r="function"==typeof i.getBoundingClientRect?i.getBoundingClientRect():null,o=nR(null==r?void 0:r.width)?r.width:i.clientWidth;if(!nR(o))return;const s=eR(null==r?void 0:r.left)?r.left:0,a=iR(((eR(null==e?void 0:e.clientX)?e.clientX:0)-s)/o)*n;eR(a)&&(t.currentTime=a)}(i,o,s);const l="string"==typeof(null==r?void 0:r.nodeId)?r.nodeId:"",c="function"==typeof e&&l?e(l):null,u=a===aD?l:a===lD?JSON.stringify(xD(r,e),null,2):function(t,e){return function(t,e){return function(t,e,n){const i=(t||"").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}`}(t,0,e)}(e,null==t?void 0:t.manifestRef)}(c,n),d=a===aD?"Copied node ID":a===lD?"Copied node context":"Copied source video URL";if(u)try{await async function(t,e){const n=null==KP||null===(e=KP.navigator)||void 0===e?void 0:e.clipboard;if(!n||"function"!=typeof n.writeText)throw new Error("Clipboard API unavailable.");await n.writeText(t)}(u),tt(d)}catch(t){}else a===cD&&tt("Source video URL unavailable",{tone:"warning"})}function ut(){const n=function(){let t=0;const n=Array.isArray(_)?_:[],i=Array.isArray(T)?T.filter((t=>!0!==(null==t?void 0:t.offsetPending))):[];return n.forEach((n=>{if(!0===(null==n?void 0:n.offsetPending))return;const i=eR(null==n?void 0:n.offset)?n.offset:void 0;if(!eR(i))return;const r=fD(n,e);t=nR(r)?Math.max(t,i+r):Math.max(t,i)})),i.forEach((e=>{const n=eR(null==e?void 0:e.offset)?e.offset:0,i=pD(e);t=nR(i)?Math.max(t,n+i):Math.max(t,n)})),nR(t)?t:1}();S=n,h.textContent=`t=${rR(E)}s`,f.textContent=`range=0-${rR(n)}s`,J(),nt(),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((t=>{if(!0===(null==t?void 0:t.offsetPending))return null;const n=eR(null==t?void 0:t.offset)?t.offset:void 0;if(!eR(n))return null;const i=fD(t,e);return{placement:t,offset:n,duration:i,end:nR(i)?n+i:n,rowIndex:0}})).filter(Boolean).sort(((t,e)=>{var n,i,r,o;const s=t.offset-e.offset;if(0!==s)return s;const a="string"==typeof(null===(n=t.placement)||void 0===n?void 0:n.nodeId)?t.placement.nodeId:"",l="string"==typeof(null===(i=e.placement)||void 0===i?void 0:i.nodeId)?e.placement.nodeId:"";if(a!==l)return a.localeCompare(l);const c="string"==typeof(null===(r=t.placement)||void 0===r?void 0:r.placementId)?t.placement.placementId:"",u="string"==typeof(null===(o=e.placement)||void 0===o?void 0:o.placementId)?e.placement.placementId:"";return c.localeCompare(u)})),r=[],o=function(t,e){const n=Number(null==t||null===(e=t.settings)||void 0===e?void 0:e.snapToFps);return!Number.isFinite(n)||n<=0?0:.5/n}(t);return i.forEach((t=>{const e=t.offset,n=eR(t.end)?t.end:e;let i=-1;for(let t=0;t<r.length;t+=1)if(r[t]<=e+o){i=t;break}-1===i?(i=r.length,r.push(n)):r[i]=Math.max(r[i],n),t.rowIndex=i})),{items:i,rowCount:Math.max(1,r.length)}}(i);var s;!function(t){const e=t.rowCount*tD+4*(t.rowCount-1);w.track.style.height=`${e}px`,x.track.style.height="18px",w.track.style.cursor="default",w.track.style.pointerEvents="auto",x.track.style.pointerEvents="auto"}(o),function(t,e){t.items.forEach((t=>{const n=t.placement,i=t.offset,r=t.duration,o=(null==n?void 0:n.nodeId)||(null==n?void 0:n.placementId)||"node",s=!!eR(E)&&E>=i&&(!nR(r)||E<i+r),a=ot(n),l=yD(I)!==oD;lt({track:w.track,color:"rgba(255,255,255,0.16)",start:iR(i/e),duration:nR(r)?iR(r/e):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:t.rowIndex,rowHeight:tD,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?t=>{ct({event:t,placement:n,rangeEnd:e,track:w.track})}:void 0})}))}(o,n),s=n,r.forEach((t=>{const e=eR(null==t?void 0:t.offset)?t.offset:void 0;if(!eR(e))return;const n=pD(t),i=mD(n),r=(null==t?void 0:t.type)||(null==t?void 0:t.renderPlacementId)||"render",o=function(t){const e="string"==typeof t?t.trim().toLowerCase():"";return"switch"===e||"switching"===e||"switchingrendernode"===e}(null==t?void 0:t.type),a=o?()=>{"function"==typeof(null==KP?void 0:KP.switchTo)&&KP.switchTo("next")}:void 0;let l=!1;eR(E)&&(i?l=E>=e:nR(n)&&(l=E>=e&&E<e+n));const c=i&&nR(s)?iR((s-e)/s):nR(n)?iR(n/s):null;lt({track:x.track,color:"rgba(248,162,62,0.9)",start:iR(e/s),duration:c,startTime:e,durationSeconds:n,label:r,placementId:null==t?void 0:t.renderPlacementId,rowIndex:0,rowHeight:tD,rowGap:0,laneId:"render",isClickable:!!o,isActive:l,tooltip:(null==t?void 0:t.type)||(null==t?void 0:t.renderPlacementId),showLabel:nR(n)||i,onClick:a})})),Q(w.indicator,n),Q(x.indicator,n),rt(),st(),D=ID(_,T)||TD(_,e),R=D?_D(_,T,e):"",L=Array.isArray(_)?_.length:0,B=Array.isArray(T)?T.length:0,Y()}function dt(t,n){_=Array.isArray(t)?t.slice():[],T=Array.isArray(n)?n.slice():[],D=ID(_,T)||TD(_,e),at(),ut()}return v.addEventListener("change",(()=>{I=yD(v.value),v.value=I,ut()})),{id:"timeline",title:"Timeline",render:t=>{t.appendChild(r),ut()},updatePlacements:dt,updateTime:function(t){if(E=eR(t)?t:E,K())return;if(D&&X())return;const e=S;eR(e)&&(h.textContent=`t=${rR(E)}s`,f.textContent=`range=0-${rR(e)}s`,Q(w.indicator,e),Q(x.indicator,e),rt())},refresh:()=>ut(),dispose:()=>{U(),Z();for(const t of N.values())(null==t?void 0:t.node)&&"function"==typeof t.node.off&&t.node.off("segment:chunk",t.handler);N.clear(),A.clear()}}}const MD=1024,FD=1048576,CD=1073741824;function OD(t){return eR(t)?t<MD?`${Math.round(t)} B`:t<FD?`${rR(t/MD,1)} KB`:t<CD?`${rR(t/FD,2)} MB`:`${rR(t/CD,2)} GB`:"n/a"}const PD="ekoplayer-debug-overlay";var RD=new WeakMap,DD=new WeakMap,LD=new WeakMap,BD=new WeakMap,zD=new WeakSet;class WD{constructor({tabBarEl:t,contentEl:e}){O(this,zD),F(this,RD,[]),F(this,DD,void 0),F(this,LD,void 0),F(this,BD,void 0),C(LD,this,t),C(BD,this,e)}registerTab(t){t&&"string"==typeof t.id&&"string"==typeof t.title&&"function"==typeof t.render&&(M(RD,this).some((e=>e.id===t.id))||(M(RD,this).push(t),A(zD,this,$D).call(this),M(DD,this)||this.selectTab(t.id)))}selectTab(t){M(RD,this).find((e=>e.id===t))&&(C(DD,this,t),A(zD,this,$D).call(this),A(zD,this,jD).call(this))}dispose(){M(LD,this)&&(M(LD,this).innerHTML=""),M(BD,this)&&(M(BD,this).innerHTML=""),C(RD,this,[]),C(LD,this,null),C(BD,this,null)}}function $D(){const t=M(LD,this);t&&(t.innerHTML="",M(RD,this).forEach((e=>{const n=KP.document.createElement("button");n.type="button",n.textContent=e.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=e.id===M(DD,this)?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.2)",n.style.color="#fff",n.style.font=tR,n.addEventListener("click",(()=>this.selectTab(e.id))),t.appendChild(n)})))}function jD(){const t=M(BD,this);if(!t)return;t.innerHTML="";const e=M(RD,this).find((t=>t.id===M(DD,this)));e&&e.render(t)}function UD({mountElement:t,canvasElement:e,timeline:n,assetsDeliveryServiceUrl:i,getNode:r,listNodes:o,downloadSpeed:s,downloadEvents:a,qoe:l,qoeEvents:c,options:u={},playbackStartedAtMs:d,playerVersion:h}={}){if(!t)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(t){if(!t||!t.style)return;const e=null==KP?void 0:KP.window,n=e&&"function"==typeof e.getComputedStyle?e.getComputedStyle(t):null,i=n?n.position:t.style.position;i&&"static"!==i||(t.style.position="relative")}(t);const f=KP.document.getElementById(PD);f&&f.parentNode&&f.parentNode.removeChild(f);const p=function({mountElement:t,playerVersion:e}){const n=null==KP?void 0:KP.document;if(!n||"function"!=typeof n.createElement)throw new Error("Debug overlay requires document.createElement.");const i=n.createElement("div");i.id=PD,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=ZP,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=e?`version ${e}`:"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),t.appendChild(i),{overlayRoot:i,panel:r,tabBar:l,content:c,hideBtn:a,showBtn:f,footerPlayback:d}}({mountElement:t,playerVersion:h||(null==u?void 0:u.playerVersion)}),m=new WD({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=ND({timeline:n,getNode:r,assetsDeliveryServiceUrl:i}),k=function({getNode:t}){const e=KP.document,n=e.createElement("pre");n.style.margin="0",n.style.whiteSpace="pre-wrap",n.style.font=tR,n.style.lineHeight="1.35";const i=e.createElement("div");i.style.display="flex",i.style.flexDirection="column",i.style.gap="8px",i.style.marginTop="6px";const r=e.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 pR({maxValue:60}),s=new pR({maxValue:60}),a=e.createElement("div"),l=e.createElement("div");l.textContent="browserfps",l.style.font=ZP,l.style.opacity="0.9",a.appendChild(l),a.appendChild(o.element);const c=e.createElement("div"),u=e.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:t=>{t.appendChild(n),t.appendChild(i),t.appendChild(r)},pushBrowserFps:(t,e)=>o.push(t,e),pushVisualFps:(t,e)=>s.push(t,e),updateInfo:function({time:r,entries:o}){const s=Array.isArray(o)?o.slice().sort(gR):[];if(!s.length)return n.textContent="",void(i.innerHTML="");n.textContent=`t=${_R(r)}s tracks=${s.length}`,i.innerHTML="";for(let n=0;n<s.length;n+=1){const r=s[n],o=IR(t,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=xR(null==o?void 0:o.bandwidth),u=oR(null==o?void 0:o.width,null==o?void 0:o.height),d=TR(t,r)||"n/a",h=ER(t,r),f=h?` fallback=${h}`:"",p=kR(t,r),m=(null==p?void 0:p.strategy)||"n/a",v=(null==p?void 0:p.decisionReason)||"n/a",g=wR(null==p?void 0:p.measuredDownloadSpeedKbps),y=wR(null==p?void 0:p.safeBandwidthKbps),b=e.createElement("div");b.style.display="flex",b.style.flexDirection="column",b.style.gap="2px";const k=e.createElement("pre");k.style.margin="0",k.style.whiteSpace="pre-wrap",k.style.font=tR,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=${_R(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=NR(t,r,o,p);if(x.length){const t=e.createElement("div");t.style.display="flex",t.style.alignItems="center",t.dataset.abrLadderRow="true",t.dataset.trackId=(null==r?void 0:r.trackId)||"",t.dataset.segmentId=(null==r?void 0:r.segmentId)||"";const n=e.createElement("div");n.style.display="inline-flex",n.style.alignItems="center",n.style.gap="2px",n.dataset.abrLadder="true",x.forEach((t=>{const i=e.createElement("span"),r=!!w&&t.id===w;i.dataset.abrLadderBlock="true",i.dataset.repId=t.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=`${t.id||"?"} ${wR(t.bandwidthKbps)}`,n.appendChild(i)})),t.appendChild(n),b.appendChild(t)}i.appendChild(b)}},dispose:()=>{o.dispose(),s.dispose()}}}({getNode:r}),w=PR({downloadSpeed:s,downloadEvents:a}),x=function({qoe:t,qoeEvents:e}={}){const n=null==KP?void 0:KP.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=tR;const{graphWrap:r,graph:o}=function(t){const e=t.createElement("div");e.style.marginTop="10px";const n=t.createElement("div");n.textContent="qoe score",n.style.font=ZP,n.style.opacity="0.9";const i=new pR({maxValue:1,windowMs:3e4,formatValue:t=>RR(t)});return e.appendChild(n),e.appendChild(i.element),{graphWrap:e,graph:i}}(n);let s=null;const a=()=>{i.textContent=function(t){if(!t)return"QoE unavailable";const e="string"==typeof t.status?t.status:"n/a";return[`score=${RR(t.score)}`,`status=${e}`,`streamQualityScore=${RR(t.streamQualityScore)}`,`fpsScore=${RR(t.fpsScore)}`,`browserFps=${RR(t.browserFps)}`,`waitingSeconds=${RR(t.waitingSeconds)}`,`playingSeconds=${RR(t.playingSeconds)}`].join("\n")}(t)},l=()=>{if(!t)return;const e=Number(t.score);Number.isFinite(e)&&o.push(e,DR())},c=t=>{const e=Number(t);Number.isFinite(e)&&o.push(e,DR()),a()},u=()=>{a()};if(a(),l(),e&&"function"==typeof e.on&&(e.on("qoescore",c),e.on("qoestatus",u)),t){const t="function"==typeof(null==KP?void 0:KP.setInterval)?KP.setInterval:setInterval;s=t((()=>{l(),a()}),1e3)}return{id:"qoe",title:"QoE",render:t=>{t.appendChild(i),t.appendChild(r)},dispose:()=>{e&&"function"==typeof e.off&&(e.off("qoescore",c),e.off("qoestatus",u)),s&&(("function"==typeof(null==KP?void 0:KP.clearInterval)?KP.clearInterval:clearInterval)(s),s=null),o.dispose()}}}({qoe:l,qoeEvents:c}),_=function({timeline:t,getNode:e,listNodes:n,options:i}={}){const r=null==KP?void 0:KP.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=tR;const s=r.createElement("div");s.textContent="nodes",s.style.marginTop="10px",s.style.font=ZP,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=tR;let l=null;const c=()=>{const r=function({timeline:t,getNode:e,listNodes:n}){const i=[];let r=0;if("function"==typeof n){let t;try{t=n()}catch(e){t=null}if(Array.isArray(t))return t.forEach((t=>{const e=null==t?void 0:t.id;if("string"!=typeof e||!e.length)return;const n=Number(null==t?void 0:t.retainedByteLength);Number.isFinite(n)&&(r+=n,i.push({nodeId:e,bytes:n}))})),i.sort(((t,e)=>e.bytes-t.bytes)),{totalBytes:r,nodes:i,available:!0}}if(!t||"function"!=typeof e)return{totalBytes:0,nodes:[],available:!1};const o=Array.isArray(t.placements)?t.placements:[];return new Set(o.map((t=>null==t?void 0:t.nodeId)).filter((t=>"string"==typeof t&&t.length))).forEach((t=>{const n=e(t),o=Number(null==n?void 0:n.retainedByteLength);Number.isFinite(o)&&(r+=o,i.push({nodeId:t,bytes:o}))})),i.sort(((t,e)=>e.bytes-t.bytes)),{totalBytes:r,nodes:i,available:!0}}({timeline:t,getNode:e,listNodes:n}),s=function({timeline:t}){if(!t||"function"!=typeof t.getDecodedFrameStats)return{totalBytes:0,frames:0,available:!1};try{const e=t.getDecodedFrameStats(),n=Number(null==e?void 0:e.totalBytes),i=Number(null==e?void 0:e.frames);return{totalBytes:Number.isFinite(n)?n:0,frames:Number.isFinite(i)?i:0,available:!1!==(null==e?void 0:e.available)}}catch(t){return{totalBytes:0,frames:0,available:!1}}}({timeline:t}),l=function(t,e,n,i){const r=Number(null!==(n=null==t||null===(i=t.publicOptions)||void 0===i?void 0:i.segmentEvictionMaxRetainedBytes)&&void 0!==n?n:null==t?void 0:t.segmentEvictionMaxRetainedBytes),o=eR(r)&&r>=0,s=o?OD(r):"n/a";return{active:o&&eR(e)&&e>r,thresholdLabel:s}}(i,r.available?r.totalBytes:NaN),c=l.active?"on":"off",u=s.available?OD(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=${OD(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((t=>`${t.nodeId}: ${OD(t.bytes)}`));a.textContent=h.join("\n")};c();const u="function"==typeof(null==KP?void 0:KP.setInterval)?KP.setInterval:setInterval;return l=u(c,1e3),{id:"memory",title:"Memory",render:t=>{t.appendChild(o),t.appendChild(s),t.appendChild(a)},refresh:c,dispose:()=>{l&&(("function"==typeof(null==KP?void 0:KP.clearInterval)?KP.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:t}={}){const e=null==KP?void 0:KP.document;if(!e||"function"!=typeof e.createElement)throw new Error("Debug overlay options tab requires document.createElement.");const n=e.createElement("pre");n.style.margin="0",n.style.font=tR,n.style.whiteSpace="pre-wrap",n.style.wordBreak="break-word";const i=null==t?void 0:t.publicOptions,r=i&&"object"==typeof i?Object.keys(i):[];if(r.length){const t=r.map((t=>`${t}=${function(t){if(null===t)return"null";if(void 0===t)return"undefined";const e=typeof t;if("string"===e)return t;if("number"===e||"boolean"===e)return String(t);try{return JSON.stringify(t)}catch(e){return String(t)}}(i[t])}`));n.textContent=t.join("\n")}else n.textContent="publicOptions unavailable";return{id:"options",title:"Options",render:t=>{t.appendChild(n)}}}({options:u}));const T=[],E=[];let I=0,S=0,A=null,N=!1,M=0,F=null;function C(t){const e=Number(t);Number.isFinite(e)&&(e-M<250||(M=e,k.pushBrowserFps(I,e),k.pushVisualFps(S,e)))}KP.window&&"function"==typeof KP.window.requestAnimationFrame&&(A=KP.window.requestAnimationFrame((function t(e){N||(I=yR(T,e),C(e),A=KP.window.requestAnimationFrame(t))})));const O=(t={})=>{if(N||!v)return;const e=Array.isArray(t.frames)?t.frames:[];if(!e.length)return void(F=null);const n=null!=KP&&KP.performance&&"function"==typeof KP.performance.now?KP.performance.now():Date.now(),i=e.map((t=>`${null==t?void 0:t.nodeId}:${null==t?void 0:t.trackId}:${null==t?void 0:t.segmentId}@${null==t?void 0:t.presentationTime}`)).join("|");i!==F&&(S=yR(E,n),F=i),k.updateInfo({time:t.time,entries:e}),C(n)};let P=Number.isFinite(d)?d:void 0;if(Number.isFinite(P)&&p.footerPlayback){const t=P/1e3;p.footerPlayback.textContent=`Playback started @ ${rR(t)}s`}const R=(t={})=>{if(!N&&void 0===P&&"playing"===(null==t?void 0:t.event)&&(P=YP(),p.footerPlayback)){const t=P/1e3;p.footerPlayback.textContent=`Playback started @ ${rR(t)}s`}},D=()=>{const t=Array.isArray(null==n?void 0:n.placements)?n.placements:[],e=Array.isArray(null==n?void 0:n.renderPlacements)?n.renderPlacements:[];b.updatePlacements(t,e)},L=(t={})=>{if(N)return;const e=Number.isFinite(null==t?void 0:t.time)?t.time:null==n?void 0:n.currentTime;b.updateTime(e),_&&"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(QP.VISUAL_FRAMES_AVAILABLE,O),n.on(QP.TIMELINE_TIME_UPDATE,L),n.on(QP.PLACEMENT_ADDED,B),n.on(QP.RENDER_PLACEMENT_ADDED,z),n.on(QP.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&&KP.window&&"function"==typeof KP.window.cancelAnimationFrame&&KP.window.cancelAnimationFrame(A),A=null,n&&"function"==typeof n.off&&(n.off(QP.VISUAL_FRAMES_AVAILABLE,O),n.off(QP.TIMELINE_TIME_UPDATE,L),n.off(QP.PLACEMENT_ADDED,B),n.off(QP.RENDER_PLACEMENT_ADDED,z),n.off(QP.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(t){m.registerTab(t)},selectTab:function(t){m.selectTab(t)}}}var qD=Object.freeze({__proto__:null,createDebugOverlay:UD,default:UD});exports.EkoGallery=VP,exports.EkoGalleryLegacy=en,exports.ekoWebPixel=S,exports.getEkoAnalyticsSnippet=function(t){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: '${t?"production":"development"}',\n env: 'website',\n });\n window.EkoAnalytics('track', 'PageView');\n }`},exports.getEkoProductConfigUrl=GP,exports.getEkoProductConfigUrlLegacy=HP;
14
+ */var ut=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;var i=Object.getOwnPropertyNames(e).map((function(t){return e[t]}));if("0123456789"!==i.join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(t){r[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var n,i,r=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),o=1;o<arguments.length;o++){for(var s in n=Object(arguments[o]))lt.call(n,s)&&(r[s]=n[s]);if(at){i=at(n);for(var a=0;a<i.length;a++)ct.call(n,i[a])&&(r[i[a]]=n[i[a]])}}return r},dt="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",ht=Function.call.bind(Object.prototype.hasOwnProperty),ft=function(){};if("production"!==process.env.NODE_ENV){var pt=dt,mt={},vt=ht;ft=function(t){var e="Warning: "+t;"undefined"!=typeof console&&console.error(e);try{throw new Error(e)}catch(t){}}}function gt(t,e,n,i,r){if("production"!==process.env.NODE_ENV)for(var o in t)if(vt(t,o)){var s;try{if("function"!=typeof t[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 t[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw a.name="Invariant Violation",a}s=t[o](e,o,i,n,null,pt)}catch(t){s=t}if(!s||s instanceof Error||ft((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 mt)){mt[s.message]=!0;var l=r?r():"";ft("Failed "+n+" type: "+s.message+(null!=l?l:""))}}}gt.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(mt={})};var yt=gt,bt=function(){};function kt(){return null}"production"!==process.env.NODE_ENV&&(bt=function(t){var e="Warning: "+t;"undefined"!=typeof console&&console.error(e);try{throw new Error(e)}catch(t){}});var wt=function(t,e){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(kt),arrayOf:function(t){return l((function(e,n,i,r,o){if("function"!=typeof t)return new a("Property `"+o+"` of component `"+i+"` has invalid PropType notation inside arrayOf.");var s=e[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=t(s,l,i,r,o+"["+l+"]",dt);if(c instanceof Error)return c}return null}))},element:l((function(e,n,i,r,o){var s=e[n];return t(s)?null:new a("Invalid "+r+" `"+o+"` of type `"+h(s)+"` supplied to `"+i+"`, expected a single ReactElement.")})),elementType:l((function(t,e,n,i,r){var o=t[e];return st.isValidElementType(o)?null:new a("Invalid "+i+" `"+r+"` of type `"+h(o)+"` supplied to `"+n+"`, expected a single ReactElement type.")})),instanceOf:function(t){return l((function(e,n,i,o,s){if(!(e[n]instanceof t)){var l=t.name||r;return new a("Invalid "+o+" `"+s+"` of type `"+(((c=e[n]).constructor&&c.constructor.name?c.constructor.name:r)+"` supplied to `")+i+"`, expected instance of `"+l+"`.")}var c;return null}))},node:l((function(t,e,n,i,r){return d(t[e])?null:new a("Invalid "+i+" `"+r+"` supplied to `"+n+"`, expected a ReactNode.")})),objectOf:function(t){return l((function(e,n,i,r,o){if("function"!=typeof t)return new a("Property `"+o+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var s=e[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(ht(s,c)){var u=t(s,c,i,r,o+"."+c,dt);if(u instanceof Error)return u}return null}))},oneOf:function(t){if(!Array.isArray(t))return"production"!==process.env.NODE_ENV&&bt(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."),kt;return l((function(e,n,i,r,o){for(var l=e[n],c=0;c<t.length;c++)if(s(l,t[c]))return null;var u=JSON.stringify(t,(function(t,e){return"symbol"===f(e)?String(e):e}));return new a("Invalid "+r+" `"+o+"` of value `"+String(l)+"` supplied to `"+i+"`, expected one of "+u+".")}))},oneOfType:function(t){if(!Array.isArray(t))return"production"!==process.env.NODE_ENV&&bt("Invalid argument supplied to oneOfType, expected an instance of array."),kt;for(var e=0;e<t.length;e++){var n=t[e];if("function"!=typeof n)return bt("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+p(n)+" at index "+e+"."),kt}return l((function(e,n,i,r,o){for(var s=[],l=0;l<t.length;l++){var c=(0,t[l])(e,n,i,r,o,dt);if(null==c)return null;c.data&&ht(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(t){return l((function(e,n,i,r,o){var s=e[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 t){var d=t[c];if("function"!=typeof d)return u(i,r,o,c,f(d));var p=d(s,c,i,r,o+"."+c,dt);if(p)return p}return null}))},exact:function(t){return l((function(e,n,i,r,o){var s=e[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected `object`.");var c=ut({},e[n],t);for(var d in c){var p=t[d];if(ht(t,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(e[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(t),null," "));var m=p(s,d,i,r,o+"."+d,dt);if(m)return m}return null}))}};function s(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}function a(t,e){this.message=t,this.data=e&&"object"==typeof e?e:{},this.stack=""}function l(t){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!==dt){if(e){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&&(bt("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:t(s,l,c,u,d)}var s=o.bind(null,!1);return s.isRequired=o.bind(null,!0),s}function c(t){return l((function(e,n,i,r,o,s){var l=e[n];return h(l)!==t?new a("Invalid "+r+" `"+o+"` of type `"+f(l)+"` supplied to `"+i+"`, expected `"+t+"`.",{expectedType:t}):null}))}function u(t,e,n,i,r){return new a((t||"React class")+": "+e+" type `"+n+"."+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+r+"`.")}function d(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(d);if(null===e||t(e))return!0;var r=function(t){var e=t&&(n&&t[n]||t[i]);if("function"==typeof e)return e}(e);if(!r)return!1;var o,s=r.call(e);if(r!==e.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(t){var e=typeof t;return Array.isArray(t)?"array":t instanceof RegExp?"object":function(t,e){return"symbol"===t||!!e&&("Symbol"===e["@@toStringTag"]||"function"==typeof Symbol&&e instanceof Symbol)}(e,t)?"symbol":e}function f(t){if(null==t)return""+t;var e=h(t);if("object"===e){if(t instanceof Date)return"date";if(t instanceof RegExp)return"regexp"}return e}function p(t){var e=f(t);switch(e){case"array":case"object":return"an "+e;case"boolean":case"date":case"regexp":return"a "+e;default:return e}}return a.prototype=Error.prototype,o.checkPropTypes=yt,o.resetWarningCache=yt.resetWarningCache,o.PropTypes=o,o};function xt(){}function _t(){}_t.resetWarningCache=xt;var Tt=D((function(t){if("production"!==process.env.NODE_ENV){var e=st;t.exports=wt(e.isElement,!0)}else t.exports=function(){function t(t,e,n,i,r,o){if(o!==dt){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 e(){return t}t.isRequired=t;var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:_t,resetWarningCache:xt};return n.PropTypes=n,n}()}));const Et=/https?:\/\/(.*?\.)?eko.com/,It={"eko.project.interaction":"interaction","eko.project.swipe":"swipe"};let St=null,At=null,Nt=[];function Mt(t){return e=>{var n;if(!Et.test(e.origin)||"eko.embedapi"!==(null===(n=e.data)||void 0===n?void 0:n.source))return;const i=e.data,r=It[i.type];r&&(t?t(r,i.data):Nt.push({type:r,data:i.data}))}}"undefined"!=typeof window&&(At=Mt(null),window.addEventListener("message",At));var Ft={subscribe:function(t){"function"==typeof t?St?console.warn("[eko-gallery-react] Ignoring events subscribe since already subscribed"):(St=t,At=Mt(t),window.addEventListener("message",At),function(t){Nt.forEach((e=>{t(e.type,e.data)})),Nt=[]}(t)):console.warn("[eko-gallery-react] Ignoring events subscribe since a callback function was not provided as argument")},unsubscribe:function(){At?(window.removeEventListener("message",At),At=null,St=null,Nt=[]):console.warn("[eko-gallery-react] Ignoring events unsubscribe since not subscribed")},send:function(t,e){St?St(t,e):Nt.push({type:t,data:e})}};const Ct=({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(t,e=200){if(!t)return null;try{let n=t;t.includes("assets.eko.com")&&t.includes("/raw/")&&(n=t.replace("/raw/","/image/"));const i=new URL(n);return i.searchParams.set("width",e),i.href}catch(e){return t}}(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(t){S.track("gallery.interaction",{elementid:`thumbnail-${t}`,interactiontype:"click"}),Ft.send("interaction",{elementid:`thumbnail-${t}`,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})`}}))))};Ct.propTypes={index:Tt.number,activeIndex:Tt.number,setActiveIndex:Tt.func.isRequired,item:Tt.object.isRequired,src:Tt.string,navItemRefs:Tt.object.isRequired,itemIcon:Tt.string};const Ot=({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(t){const e=i?n.current.clientHeight:n.current.clientWidth,r=function(t,e){const n=i?e.scrollTop:e.scrollLeft;return Math.max(-n,Math.min(v-t-n,t))}("next"===t?e:-e,n.current);return{top:i?r:0,left:i?0:r,behavior:"smooth"}}function y(t){var e,i,r;const o=g(t),s="next"===t?null==h||null===(e=h.current)||void 0===e?void 0:e.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}),Ft.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 Pt(t,e,n){let i;return function(){const n=this,r=arguments;clearTimeout(i),i=setTimeout((function(){i=null,t.apply(n,r)}),e)}}Ot.propTypes={layout:Tt.object.isRequired,nav:Tt.object.isRequired,isVerticalNav:Tt.bool.isRequired,showPrevArrow:Tt.bool.isRequired,showNextArrow:Tt.bool.isRequired};const Rt=({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 t;const e=s||window.innerWidth<768?"mobile":"desktop",n=(null==r||null===(t=r[e])||void 0===t||null===(t=t.config)||void 0===t?void 0:t.orientation)||("desktop"===e?"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 t,e;const n=s||a()?"mobile":"desktop",i=null!==(t=null==r||null===(e=r[n])||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.navPagination)||void 0===e?void 0:e.scrollThreshold)&&void 0!==t?t:d;!function(t=d){var e,n;const i=l.current;if(!i)return;const o="none"!==(null==r||null===(e=r.desktop)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.navPagination)||void 0===e?void 0:e.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>t?"85%":"100%",m=i.scrollTop<=h-t?"15%":"0%",v=i.scrollWidth-i.clientWidth,g=i.scrollLeft>t?"15%":"0%",y=i.scrollLeft<=v-t?"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(t=d){var e,n,i,r,o,s;const a=p?null==l||null===(e=l.current)||void 0===e?void 0:e.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-t<c?(b(!1),w(!1)):a<=t?(b(!1),w(!0)):a+c>u-t?(b(!0),w(!1)):a+t>0&&a<u-t&&(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=Pt((t=>{var e;e=t,S.track("gallery.interaction",{elementid:"nav",interactiontype:e}),Ft.send("interaction",{elementid:"nav",interactiontype:e})}),200);const E=e.useCallback((t=>{n({index:t,step:0,source:"nav"})}),[]);return e.useEffect((()=>{var t;f(null===(t=u.current)||void 0===t?void 0:t[i])}),[i]),e.useEffect((()=>{if(null!=h&&h.current&&null!=l&&l.current){const t=h.current,e=l.current.clientWidth/2,n=t.clientWidth/2,i=l.current.clientHeight/2,r=t.clientHeight/2;l.current.scrollTo({left:t.offsetLeft-e+n,top:t.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 t=new ResizeObserver(_);return t.observe(l.current),()=>{t.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(Ot,{layout:r,nav:l,isVerticalNav:p,showPrevArrow:y,showNextArrow:k}),e.createElement("ul",{className:`eko-nav eko-mobile-nav-selected-${null!==(I=null==r||null===(A=r.mobile)||void 0===A||null===(A=A.config)||void 0===A?void 0:A.navItemsSelectedType)&&void 0!==I?I:"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(Ct,{key:o+n,index:n,activeIndex:i,setActiveIndex:E,item:t,src:o,navItemRefs:u,itemIcon:null==t?void 0:t.icon})}))));var I,A,N,M};Rt.propTypes={items:Tt.array.isRequired,activeIndex:Tt.number,setActiveIndex:Tt.func.isRequired,layout:Tt.object,carouselMounted:Tt.bool,forceMobile:Tt.bool};function Dt(){S.track("gallery.cover.displayed"),Ft.send("gallerycoverdisplayed")}function Lt(t){if(!t)return t;try{const e=new URL(t);return e.host.includes("assets.eko.com")&&e.pathname.startsWith("/image")&&!e.searchParams.has("width")?(e.pathname.endsWith(".png")&&(e.pathname=e.pathname.replace(/\.png$/,".webp")),e.searchParams.set("width",1920),e.toString()):t}catch(e){return t}}const Bt=({item:t,src:n,srcset:i,sizes:r,isCoverElement:o})=>{const s=e.useRef(null);return e.useEffect((()=>{var t;if(o){if(null===(t=s.current)||void 0===t||!t.complete)return s.current.addEventListener("load",Dt,{once:!0}),()=>{var t;null===(t=s.current)||void 0===t||t.removeEventListener("load",Dt,{once:!0})};Dt()}}),[]),e.createElement("img",{ref:s,src:Lt(n),srcSet:i,sizes:r,alt:t.name,fetchPriority:o?"high":"auto",loading:o?"eager":"lazy",style:{width:"100%",height:"100%"}})};Bt.propTypes={item:Tt.object.isRequired,src:Tt.string,srcset:Tt.string,sizes:Tt.string,isCoverElement:Tt.bool};const zt=Pt((t=>{var e;e=t,S.track("gallery.interaction",{elementid:"carousel",interactiontype:e}),Ft.send("interaction",{elementid:"carousel",interactiontype:e})}),200);function Wt(){zt("wheel")}const $t=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(t){const e=t.scrollLeft,n=t.scrollWidth-t.clientWidth;return 0===e?0:e>n?100:e/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 t=s.current;if(t)return t.addEventListener("scroll",p),()=>{t.removeEventListener("scroll",p)}}),[t]),e.useEffect((()=>{var t;let e=null===(t=a.current)||void 0===t?void 0:t[i.index];if(e&&("nav"===i.source||"external-nav"===i.source)){const t=e.current,n=s.current.clientWidth/2,i=(null==t?void 0:t.clientWidth)/2,r=(null==t?void 0:t.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:Wt,onTouchMove:function(t){d(t.targetTouches[0].clientX)},onTouchStart:function(t){c(t.targetTouches[0].clientX),d(null)},onTouchEnd:function(){u&&l&&(l-u>75||l-u<-75)&&zt("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(Bt,{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 jt(t){var e;return function(t){var e;return"eko.block.event"===(null==t||null===(e=t.data)||void 0===e?void 0:e.type)}(t)&&"GalleryBlock"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.blockType)}$t.propTypes={items:Tt.array.isRequired,setActiveIndex:Tt.func.isRequired,activeIndex:Tt.object,showSmartLoaders:Tt.bool},$t.displayName="CarouselLoop";const Ut="eko.project.invoke",qt="eko.block.invoke";function Vt(t,e,n){var i;null!=t&&t.contentWindow&&(null==t||null===(i=t.contentWindow)||void 0===i||i.postMessage({target:"eko.embedapi",type:e,data:n},"*"))}function Gt(t){return`#variantId=${encodeURIComponent(t)}`}const Ht=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(t={}){let e="";return Object.entries(t).forEach((([t,n])=>{e+=`&${t}=${n}`})),e}(null==t?void 0:t.qp),g=function(t,e,n){return`https://${t}play.eko.com/embed?${n?`id=${n}`:`piid=${e}`}&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(Gt(o||"ekonovar")),[_,T]=e.useState(g+v+w);let E;function I(){S.track("gallery.project.display"),l(),Ft.send("galleryloaded")}return e.useImperativeHandle(u,(()=>({prev:()=>{Vt(null==b?void 0:b.current,qt,{action:"onPrevModule"})},next:()=>{Vt(null==b?void 0:b.current,qt,{action:"onNextModule"})}}))),e.useEffect((()=>{k.current?Vt(null==b?void 0:b.current,Ut,{action:"updateVariant",args:{id:o}}):x(Gt(o))}),[o]),e.useEffect((()=>{Vt(null==b?void 0:b.current,qt,{action:"updateActiveModule",args:{activeItemIndex:null==r?void 0:r.index,activeModuleIndex:null==r?void 0:r.step}})}),[r]),e.useEffect((()=>{function t(t){if((function(t){var e;return"eko.project.blockstart"===(null==t||null===(e=t.data)||void 0===e?void 0:e.type)}(t)||function(t){var e,n;return"eko.project.started"===(null==t||null===(e=t.data)||void 0===e?void 0:e.type)&&(null==t||null===(n=t.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.started)}(t))&&!k.current)return e=t.data.data.blockType,k.current=!0,void("GalleryBlock"===e?Vt(null==b?void 0:b.current,qt,{action:"updateActiveModule",args:{activeItemIndex:null==r?void 0:r.index,activeModuleIndex:null==r?void 0:r.step}}):I());var e;if(k.current){if(function(t){var e;return jt(t)&&"activeModuleChanged"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.name)}(t))return void function(t){const e=t.data.data.data.activeItemIndex,n=t.data.data.data.activeModuleIndex;e===(null==r?void 0:r.index)&&n===(null==r?void 0:r.step)||i({index:e,step:n,source:"carousel"})}(t);(function(t){var e;return jt(t)&&"activeModuleChangeDone"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.name)})(t)&&!s&&I()}}return E=c||a()?"mobile":"desktop",function(t,e={}){window.addEventListener("message",t,e)}(t),()=>{!function(t,e={}){window.removeEventListener("message",t,e)}(t)}}),[r]),e.useEffect((()=>{k.current||Vt(null==b?void 0:b.current,Ut,{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":E},e.createElement("iframe",{allow:"autoplay; fullscreen",title:"eko gallery",src:_,style:{border:0},ref:b}))}));Ht.propTypes={config:Tt.object.isRequired,instanceId:Tt.string,setActiveItem:Tt.func.isRequired,activeItem:Tt.object.isRequired,variantId:Tt.string,smartGalleryLoaded:Tt.bool,onLoad:Tt.func,forceMobile:Tt.bool},Ht.displayName="SmartGallery";const Kt=()=>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}'),Xt=({layout:t,style:n})=>{let i={};return function(t={}){Object.keys(t).forEach((e=>{i[`--${e}Eko`]=t[e]}))}(n),function(t){var e,n;const r=(null==t||null===(e=t.desktop)||void 0===e?void 0:e.config)||{},o=(null==t||null===(n=t.mobile)||void 0===n?void 0:n.config)||{};Object.keys(r).forEach((t=>{"string"==typeof r[t]&&(i[`--${t}EkoDesktop`]=r[t])})),Object.keys(o).forEach((t=>{"string"==typeof o[t]&&(i[`--${t}EkoMobile`]=o[t])}))}(t),e.createElement("style",{key:{layout:t,style:n}},`.eko-gallery {${Object.keys(i).map((t=>`${t}: ${i[t]};`)).join("\n")}}`)};Xt.propTypes={layout:Tt.object,style:Tt.object},u("experiment");const Yt=({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 t=d.current;if(t){const e={};return null!=t&&t.id&&(e.id=t.id),null!=t&&t.productId&&(e.productid=t.productId),t.salesChannelId&&(e.saleschannelid=t.salesChannelId),null!=t&&t.salesChannelName&&(e.saleschannelname=t.salesChannelName),t.salesChannelType&&(e.saleschanneltype=t.salesChannelType),e.id?e:void 0}}},galleryInteractionPacker:{tag:s,schema:"iglu:com.helloeko/gallery_interaction/jsonschema/1-0-0",match:"gallery.interaction",getData:function({elementid:t,interactiontype:e}){return{elementid:String(t),interactiontype:e}}},galleryPacker:{tag:s,schema:"iglu:com.helloeko/gallery/jsonschema/1-0-2",match:/^gallery.*/,getData:function(){var t;return{activeitemid:l.current.toString(),activevariantid:a.current,hasinteractive:c.current,version:(null===(t=window.eko)||void 0===t||null===(t=t.gallery)||void 0===t?void 0:t.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 t;let e=function(t){let e=null;if(t){const n=Math.floor(Date.now()/1e3);for(const i of t){if("deliverable"!==i.type)return;const t=Math.floor(new Date(i.startDate).getTime()/1e3),r=Math.floor(new Date(i.endDate).getTime()/1e3);!0===i.active&&n>t&&n<r&&(e=i)}}return e}(u.current);if(!e)return;let n={experimentid:e.id||"",experimentvariant:e.chosen||"pending decision",experimenttype:e.type||""},i=null===(t=e.targetDevice)||void 0===t?void 0:t.toLowerCase();return"mobile"!==i&&"notmobile"!==i||(n.experimenttargeting={device:i}),n}}};return e.useEffect((()=>(Object.values(h).forEach((t=>{window.EkoAnalytics("registerContextPacker",t)})),()=>{window.EkoAnalytics("reset",s)})),[]),null};Yt.propTypes={activeVariantId:Tt.string,activeElementId:Tt.number,hasInteractive:Tt.bool,experiments:Tt.array,publishItem:Tt.object};const Qt=({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(Yt,{activeVariantId:t||"ekonovar",activeElementId:r,hasInteractive:i,experiments:o,publishItem:s})};Qt.propTypes={variantId:Tt.string,activeItem:Tt.object,hasInteractive:Tt.bool,activeIndex:Tt.number,experiments:Tt.array,publishItem:Tt.object};const Jt="eko-gallery-react";function Zt(t,e){var n,i,r;const o=(null==t||null===(n=t.variantMap)||void 0===n?void 0:n[e])||"ekonovar";return(null==t||null===(i=t.items)||void 0===i?void 0:i.find((t=>(null==t?void 0:t.variantId)===o)))||(null==t||null===(r=t.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 te=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(Zt(n,r)),[b,k]=e.useState({index:o.index,step:o.step,source:"external-nav"}),[w,x]=e.useState(!1),[_,T]=e.useState(!1),[E,I]=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 t=a||window.innerWidth<768?"eko-mobile":"eko-desktop";I(t)}return N.current||(Ft.send("galleryinit"),N.current=!0),e.useEffect((()=>{const t=C.current!==r;C.current=r,y(Zt(n,r)),t&&!A.current&&k({index:0,step:0,source:"external-nav"})}),[n,r]),e.useEffect((()=>{if(s)return Ft.subscribe(s),()=>{Ft.unsubscribe()}}),[s]),e.useEffect((()=>{A.current=_}),[_]),e.useEffect((()=>{x(!1),T(!1);const t=setTimeout((()=>{A.current||(x(!0),S.track("gallery.load.timeout"))}),1e3*m);return()=>{clearTimeout(t)}}),[n]),e.useEffect((()=>{O()}),[a]),e.useEffect((()=>(window.addEventListener("resize",O),O(),()=>{window.removeEventListener("resize",O)})),[a]),e.useEffect((()=>(window.EkoAnalytics("trackElementVisibility",F.current,Jt),()=>{window.EkoAnalytics("stopTrackingElementVisibility",Jt)})),[]),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||Ft.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(Kt,null),e.createElement(Xt,{layout:n.layout,style:n.style,forceMobile:a}),e.createElement(Qt,{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(t){let e="";return["mobile","desktop"].forEach((n=>{var i,r;const o=null!==(i=null==t||null===(r=t[n])||void 0===r?void 0:r.type)&&void 0!==i?i:"nav";if(e+=`eko-${n}-${o}-layout `,"nav"===o){var s;const i="desktop"===n,r=(null==t||null===(s=t[n])||void 0===s||null===(s=s.config)||void 0===s?void 0:s.orientation)||(i?"left":"bottom");e+=`eko-${n}-nav-${r} `}})),e}(n.layout)} ${null!=t?t:""}`.trim()} ${E}`,"aria-controls":"main-content",ref:F},e.createElement(Rt,{items:(null==g?void 0:g.items)||[],setActiveIndex:k,activeIndex:b.index,layout:n.layout,carouselMounted:_,forceMobile:a}),!_&&e.createElement($t,{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(Ht,{ref:l,config:n,instanceId:i,activeItem:b,setActiveItem:k,variantId:null==g?void 0:g.variantId,smartGalleryLoaded:_,forceMobile:a,onLoad:function(){T(!0)}})))}));te.propTypes={className:Tt.string,config:Tt.object.isRequired,instanceId:Tt.string,variantId:Tt.string,activeItem:Tt.object,onEvent:Tt.func,forceMobile:Tt.bool,onPrev:Tt.func,onNext:Tt.func},te.displayName="EkoGallery";var ee=e.memo(te);const ne=u("gallery-react");const ie=e.forwardRef(((t,n)=>{var i;e.useEffect((()=>(ne.setDataStorage("gallery-react",{config:t.config}),window.eko=window.eko||{},window.eko.config=t.config,window.eko.gallery={version:"copy-instance/4.0.13"},()=>{window.eko.config=void 0})),[t.config]);const{children:r,...o}=t;return void 0!==t.config?e.createElement(ee,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}));ie.propTypes={className:Tt.string,config:Tt.object,variantId:Tt.string,onEvent:Tt.func,instanceId:Tt.string,children:Tt.node},ie.displayName="EkoGalleryWrapper";var re,oe,se,ae,le,ce,ue,de,he,fe,pe,me,ve,ge,ye,be,ke,we,xe,_e,Te,Ee,Ie,Se,Ae,Ne,Me,Fe,Ce,Oe,Pe,Re,De,Le,Be,ze,We,$e,je,Ue,qe,Ve,Ge,He,Ke,Xe,Ye,Qe,Je,Ze,tn,en=e.memo(ie);const nn=1,rn=2,on=4,sn=8,an=16,ln=1,cn=4,un=8,dn=16,hn="[",fn="[!",pn="]",mn={},vn=Symbol(),gn=Symbol("filename"),yn="http://www.w3.org/1999/xhtml",bn="@attach",kn=!0;var wn=Array.isArray,xn=Array.prototype.indexOf,_n=Array.from,Tn=Object.defineProperty,En=Object.getOwnPropertyDescriptor,In=Object.getOwnPropertyDescriptors,Sn=Object.prototype,An=Array.prototype,Nn=Object.getPrototypeOf,Mn=Object.isExtensible;function Fn(){var t,e;return{promise:new Promise(((n,i)=>{t=n,e=i})),resolve:t,reject:e}}const Cn=2,On=4,Pn=8,Rn=1<<24,Dn=16,Ln=32,Bn=64,zn=128,Wn=512,$n=1024,jn=2048,Un=4096,qn=8192,Vn=16384,Gn=32768,Hn=65536,Kn=1<<17,Xn=1<<18,Yn=1<<19,Qn=1<<20,Jn=1<<25,Zn=32768,ti=1<<21,ei=1<<22,ni=1<<23,ii=Symbol("$state"),ri=Symbol("legacy props"),oi=Symbol(""),si=Symbol("proxy path"),ai=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},li=3,ci=8;function ui(t){{const e=new Error(`lifecycle_outside_component\n\`${t}(...)\` can only be used during component initialisation\nhttps://svelte.dev/e/lifecycle_outside_component`);throw e.name="Svelte error",e}}var di="font-weight: bold",hi="font-weight: normal";function fi(t){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",di,hi)}function pi(t){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 \`${t}\` will produce unexpected results\nhttps://svelte.dev/e/state_proxy_equality_mismatch`,di,hi)}let mi,vi=!1;function gi(t){vi=t}function yi(t){if(null===t)throw fi(),mn;return mi=t}function bi(){return yi(Po(mi))}function ki(t){if(vi){if(null!==Po(mi))throw fi(),mn;mi=t}}function wi(t=!0){for(var e=0,n=mi;;){if(n.nodeType===ci){var i=n.data;if(i===pn){if(0===e)return n;e-=1}else i!==hn&&i!==fn||(e+=1)}var r=Po(n);t&&n.remove(),n=r}}function xi(t){if(!t||t.nodeType!==ci)throw fi(),mn;return t.data}function _i(t){return t===this.v}function Ti(t){return e=t,n=this.v,!(e!=e?n==n:e!==n||null!==e&&"object"==typeof e||"function"==typeof e);var e,n}let Ei=!1;function Ii(t,e){return t.label=e,Si(t.v,e),t}function Si(t,e){var n;return null==t||null===(n=t[si])||void 0===n||n.call(t,e),t}function Ai(t){const e=new Error,n=function(){const t=Error.stackTraceLimit;Error.stackTraceLimit=1/0;const e=(new Error).stack;if(Error.stackTraceLimit=t,!e)return[];const n=e.split("\n"),i=[];for(let t=0;t<n.length;t++){const e=n[t],r=e.replaceAll("\\","/");if("Error"!==e.trim()){if(e.includes("validate_each_keys"))return[];r.includes("svelte/src/internal")||r.includes("node_modules/.vite")||i.push(e)}}return i}();return 0===n.length?null:(n.unshift("\n"),Tn(e,"stack",{value:n.join("\n")}),Tn(e,"name",{value:t}),e)}let Ni=null;function Mi(t){Ni=t}let Fi=null;function Ci(t){Fi=t}let Oi=null;function Pi(t){Oi=t}function Ri(t){return Bi("getContext").get(t)}function Di(t,e=!1,n){Ni={p:Ni,i:!1,c:null,e:null,s:t,x:null,l:null},Ni.function=n,Oi=n}function Li(t){var e,n,i=Ni,r=i.e;if(null!==r)for(var o of(i.e=null,r))Ho(o);return i.i=!0,Ni=i.p,Oi=null!==(e=null===(n=Ni)||void 0===n?void 0:n.function)&&void 0!==e?e:null,{}}function Bi(t){var e,n;return null===Ni&&ui(t),null!==(n=(e=Ni).c)&&void 0!==n?n:e.c=new Map(function(t){let e=t.p;for(;null!==e;){const t=e.c;if(null!==t)return t;e=e.p}return null}(Ni)||void 0)}let zi=[];function Wi(){var t=zi;zi=[],function(t){for(var e=0;e<t.length;e++)t[e]()}(t)}function $i(t){if(0===zi.length&&!rr){var e=zi;queueMicrotask((()=>{e===zi&&Wi()}))}zi.push(t)}function ji(){for(;zi.length>0;)Wi()}const Ui=new WeakMap;function qi(t){var e=vs;if(null===e)return fs.f|=ni,t;if(t instanceof Error&&!Ui.has(t)&&Ui.set(t,function(t,e){var n,i;const r=En(t,"message");if(r&&!r.configurable)return;var o=Ao?" ":"\t",s=`\n${o}in ${(null===(n=e.fn)||void 0===n?void 0:n.name)||"<unknown>"}`,a=e.ctx;for(;null!==a;){var l;s+=`\n${o}in ${null===(l=a.function)||void 0===l?void 0:l[gn].split("/").pop()}`,a=a.p}return{message:t.message+`\n${s}\n`,stack:null===(i=t.stack)||void 0===i?void 0:i.split("\n").filter((t=>!t.includes("svelte/src/internal"))).join("\n")}}(t,e)),e.f&Gn)Vi(t,e);else{if(!(e.f&zn))throw!e.parent&&t instanceof Error&&Gi(t),t;e.b.error(t)}}function Vi(t,e){for(;null!==e;){if(e.f&zn)try{return void e.b.error(t)}catch(e){t=e}e=e.parent}throw t instanceof Error&&Gi(t),t}function Gi(t){const e=Ui.get(t);e&&(Tn(t,"message",{value:e.message}),Tn(t,"stack",{value:e.stack}))}const Hi=-7169;function Ki(t,e){t.f=t.f&Hi|e}function Xi(t){t.f&Wn||null===t.deps?Ki(t,$n):Ki(t,Un)}function Yi(t){if(null!==t)for(const e of t)e.f&Cn&&e.f&Zn&&(e.f^=Zn,Yi(e.deps))}function Qi(t,e,n){t.f&jn?e.add(t):t.f&Un&&n.add(t),Yi(t.deps),Ki(t,$n)}const Ji=new Set;let Zi=null,tr=null,er=[],nr=null,ir=!1,rr=!1;var or=new WeakMap,sr=new WeakMap,ar=new WeakMap,lr=new WeakMap,cr=new WeakMap,ur=new WeakMap,dr=new WeakMap,hr=new WeakSet;class fr{constructor(){O(this,hr),P(this,"committed",!1),P(this,"current",new Map),P(this,"previous",new Map),F(this,or,new Set),F(this,sr,new Set),F(this,ar,0),F(this,lr,0),F(this,cr,null),F(this,ur,new Set),F(this,dr,new Set),P(this,"skipped_effects",new Set),P(this,"is_fork",!1)}is_deferred(){return this.is_fork||M(lr,this)>0}process(t){er=[],this.apply();var e,n=[],i=[];for(const e of t)A(hr,this,pr).call(this,e,n,i);(this.is_fork||A(hr,this,vr).call(this),this.is_deferred())?(A(hr,this,mr).call(this,i),A(hr,this,mr).call(this,n)):(Zi=null,wr(i),wr(n),null===(e=M(cr,this))||void 0===e||e.resolve());tr=null}capture(t,e){var n;(e===vn||this.previous.has(t)||this.previous.set(t,e),t.f&ni)||(this.current.set(t,t.v),null===(n=tr)||void 0===n||n.set(t,t.v))}activate(){Zi=this,this.apply()}deactivate(){Zi===this&&(Zi=null,tr=null)}flush(){if(this.activate(),er.length>0){if(yr(),null!==Zi&&Zi!==this)return}else 0===M(ar,this)&&this.process([]);this.deactivate()}discard(){for(const t of M(sr,this))t(this);M(sr,this).clear()}increment(t){C(ar,this,M(ar,this)+1),t&&C(lr,this,M(lr,this)+1)}decrement(t){C(ar,this,M(ar,this)-1),t&&C(lr,this,M(lr,this)-1),this.revive()}revive(){for(const t of M(ur,this))M(dr,this).delete(t),Ki(t,jn),Tr(t);for(const t of M(dr,this))Ki(t,Un),Tr(t);this.flush()}oncommit(t){M(or,this).add(t)}ondiscard(t){M(sr,this).add(t)}settled(){var t;return(null!==(t=M(cr,this))&&void 0!==t?t:C(cr,this,Fn())).promise}static ensure(){if(null===Zi){const t=Zi=new fr;Ji.add(Zi),rr||fr.enqueue((()=>{Zi===t&&t.flush()}))}return Zi}static enqueue(t){$i(t)}apply(){}}function pr(t,e,n){t.f^=$n;for(var i=t.first,r=null;null!==i;){var o=i.f,s=!!(o&(Ln|Bn));if(!(s&&!!(o&$n)||!!(o&qn)||this.skipped_effects.has(i))&&null!==i.fn){s?i.f^=$n:null!==r&&o&(On|Pn|Rn)?r.b.defer_effect(i):o&On?e.push(i):As(i)&&(o&Dn&&M(ur,this).add(i),Os(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 mr(t){for(var e=0;e<t.length;e+=1)Qi(t[e],M(ur,this),M(dr,this))}function vr(){if(0===M(lr,this)){for(const t of M(or,this))t();M(or,this).clear()}0===M(ar,this)&&A(hr,this,gr).call(this)}function gr(){if(Ji.size>1){this.previous.clear();var t=tr,e=!0;for(const t of Ji){if(t===this){e=!1;continue}const i=[];for(const[n,r]of this.current){if(t.current.has(n)){if(!e||r===t.current.get(n))continue;t.current.set(n,r)}i.push(n)}if(0===i.length)continue;const r=[...t.current.keys()].filter((t=>!this.current.has(t)));if(r.length>0){var n=er;er=[];const e=new Set,o=new Map;for(const t of i)xr(t,r,e,o);if(er.length>0){Zi=t,t.apply();for(const e of er)A(hr,t,pr).call(t,e,[],[]);t.deactivate()}er=n}}Zi=null,tr=t}this.committed=!0,Ji.delete(this)}function yr(){var t=cs;ir=!0;var e=new Set;try{var n=0;for(us(!0);er.length>0;){var i=fr.ensure();if(n++>1e3){if(kn){var r=new Map;for(const t of i.current.keys())for(const[e,n]of null!==(o=t.updated)&&void 0!==o?o:[]){var o,s=r.get(e);s||(s={error:n.error,count:0},r.set(e,s)),s.count+=n.count}for(const t of r.values())t.error&&console.error(t.error)}br()}if(i.process(er),co.clear(),kn)for(const t of i.current.keys())e.add(t)}}finally{ir=!1,us(t),nr=null;for(const t of e)t.updated=null}}function br(){try{!function(){{const t=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 t.name="Svelte error",t}}()}catch(t){Tn(t,"stack",{value:""}),Vi(t,nr)}}let kr=null;function wr(t){var e=t.length;if(0!==e){for(var n=0;n<e;){var i,r=t[n++];if(!(r.f&(Vn|qn))&&As(r))if(kr=new Set,Os(r),null===r.deps&&null===r.first&&null===r.nodes&&(null===r.teardown&&null===r.ac?is(r):r.fn=null),(null===(i=kr)||void 0===i?void 0:i.size)>0){co.clear();for(const t of kr){if(t.f&(Vn|qn))continue;const e=[t];let n=t.parent;for(;null!==n;)kr.has(n)&&(kr.delete(n),e.push(n)),n=n.parent;for(let t=e.length-1;t>=0;t--){const n=e[t];n.f&(Vn|qn)||Os(n)}}kr.clear()}}kr=null}}function xr(t,e,n,i){if(!n.has(t)&&(n.add(t),null!==t.reactions))for(const r of t.reactions){const t=r.f;t&Cn?xr(r,e,n,i):t&(ei|Dn)&&!(t&jn)&&_r(r,e,i)&&(Ki(r,jn),Tr(r))}}function _r(t,e,n){const i=n.get(t);if(void 0!==i)return i;if(null!==t.deps)for(const i of t.deps){if(e.includes(i))return!0;if(i.f&Cn&&_r(i,e,n))return n.set(i,!0),!0}return n.set(t,!1),!1}function Tr(t){for(var e=nr=t;null!==e.parent;){var n=(e=e.parent).f;if(ir&&e===vs&&n&Dn&&!(n&Xn))return;if(n&(Bn|Ln)){if(!(n&$n))return;e.f^=$n}}er.push(e)}var Er=Hn|Yn|zn;var Ir=new WeakMap,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 WeakSet;class qr{constructor(t,e,n){O(this,Ur),P(this,"parent",void 0),P(this,"is_pending",!1),F(this,Ir,void 0),F(this,Sr,vi?mi:null),F(this,Ar,void 0),F(this,Nr,void 0),F(this,Mr,void 0),F(this,Fr,null),F(this,Cr,null),F(this,Or,null),F(this,Pr,null),F(this,Rr,null),F(this,Dr,0),F(this,Lr,0),F(this,Br,!1),F(this,zr,new Set),F(this,Wr,new Set),F(this,$r,null),F(this,jr,function(t){let e,n=0,i=fo(0);return Ii(i,"createSubscriber version"),()=>{qo()&&(Rs(i),Xo((()=>(0===n&&(e=Bs((()=>t((()=>bo(i)))))),n+=1,()=>{$i((()=>{var t;n-=1,0===n&&(null===(t=e)||void 0===t||t(),e=void 0,bo(i))}))}))))}}((()=>(C($r,this,fo(M(Dr,this))),Ii(M($r,this),"$effect.pending()"),()=>{C($r,this,null)})))),C(Ir,this,t),C(Ar,this,e),C(Nr,this,n),this.parent=vs.b,this.is_pending=!!M(Ar,this).pending,C(Mr,this,Qo((()=>{if(vs.b=this,vi){const t=M(Sr,this);bi();t.nodeType===ci&&t.data===fn?A(Ur,this,Gr).call(this):(A(Ur,this,Vr).call(this),0===M(Lr,this)&&(this.is_pending=!1))}else{var t=A(Ur,this,Hr).call(this);try{C(Fr,this,Zo((()=>n(t))))}catch(t){this.error(t)}M(Lr,this)>0?A(Ur,this,Xr).call(this):this.is_pending=!1}return()=>{var t;null===(t=M(Rr,this))||void 0===t||t.remove()}}),Er)),vi&&C(Ir,this,mi)}defer_effect(t){Qi(t,M(zr,this),M(Wr,this))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!M(Ar,this).pending}update_pending_count(t){A(Ur,this,Yr).call(this,t),C(Dr,this,M(Dr,this)+t),M($r,this)&&go(M($r,this),M(Dr,this))}get_effect_pending(){return M(jr,this).call(this),Rs(M($r,this))}error(t){var e=M(Ar,this).onerror;let n=M(Ar,this).failed;if(M(Br,this)||!e&&!n)throw t;M(Fr,this)&&(ns(M(Fr,this)),C(Fr,this,null)),M(Cr,this)&&(ns(M(Cr,this)),C(Cr,this,null)),M(Or,this)&&(ns(M(Or,this)),C(Or,this,null)),vi&&(yi(M(Sr,this)),function(t=1){if(vi){for(var e=t,n=mi;e--;)n=Po(n);mi=n}}(),yi(wi()));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",di,hi):(i=!0,r&&function(){{const t=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 t.name="Svelte error",t}}(),fr.ensure(),C(Dr,this,0),null!==M(Or,this)&&rs(M(Or,this),(()=>{C(Or,this,null)})),this.is_pending=this.has_pending_snippet(),C(Fr,this,A(Ur,this,Kr).call(this,(()=>(C(Br,this,!1),Zo((()=>M(Nr,this).call(this,M(Ir,this)))))))),M(Lr,this)>0?A(Ur,this,Xr).call(this):this.is_pending=!1)};var s=fs;try{ms(null),r=!0,null==e||e(t,o),r=!1}catch(t){Vi(t,M(Mr,this)&&M(Mr,this).parent)}finally{ms(s)}n&&$i((()=>{C(Or,this,A(Ur,this,Kr).call(this,(()=>{fr.ensure(),C(Br,this,!0);try{return Zo((()=>{n(M(Ir,this),(()=>t),(()=>o))}))}catch(t){return Vi(t,M(Mr,this).parent),null}finally{C(Br,this,!1)}})))}))}}function Vr(){try{C(Fr,this,Zo((()=>M(Nr,this).call(this,M(Ir,this)))))}catch(t){this.error(t)}}function Gr(){const t=M(Ar,this).pending;t&&(C(Cr,this,Zo((()=>t(M(Ir,this))))),fr.enqueue((()=>{var t=A(Ur,this,Hr).call(this);C(Fr,this,A(Ur,this,Kr).call(this,(()=>(fr.ensure(),Zo((()=>M(Nr,this).call(this,t))))))),M(Lr,this)>0?A(Ur,this,Xr).call(this):(rs(M(Cr,this),(()=>{C(Cr,this,null)})),this.is_pending=!1)})))}function Hr(){var t=M(Ir,this);return this.is_pending&&(C(Rr,this,Co()),M(Ir,this).before(M(Rr,this)),t=M(Rr,this)),t}function Kr(t){var e=vs,n=fs,i=Ni;gs(M(Mr,this)),ms(M(Mr,this)),Mi(M(Mr,this).ctx);try{return t()}catch(t){return qi(t),null}finally{gs(e),ms(n),Mi(i)}}function Xr(){const t=M(Ar,this).pending;null!==M(Fr,this)&&(C(Pr,this,document.createDocumentFragment()),M(Pr,this).append(M(Rr,this)),ls(M(Fr,this),M(Pr,this))),null===M(Cr,this)&&C(Cr,this,Zo((()=>t(M(Ir,this)))))}function Yr(t){var e;if(this.has_pending_snippet()){if(C(Lr,this,M(Lr,this)+t),0===M(Lr,this)){this.is_pending=!1;for(const t of M(zr,this))Ki(t,jn),Tr(t);for(const t of M(Wr,this))Ki(t,Un),Tr(t);M(zr,this).clear(),M(Wr,this).clear(),M(Cr,this)&&rs(M(Cr,this),(()=>{C(Cr,this,null)})),M(Pr,this)&&(M(Ir,this).before(M(Pr,this)),C(Pr,this,null))}}else this.parent&&A(Ur,e=this.parent,Yr).call(e,t)}function Qr(t,e,n,i){const r=to;if(0!==n.length||0!==t.length){var o,s,a,l,c,u=Zi,d=vs,h=(o=vs,s=fs,a=Ni,l=Zi,c=Fi,function(t=!0){gs(o),ms(s),Mi(a),t&&(null==l||l.activate()),Ci(c)});t.length>0?Promise.all(t).then((()=>{h();try{return f()}finally{null==u||u.deactivate(),Jr()}})):f()}else i(e.map(r));function f(){Promise.all(n.map((t=>eo(t)))).then((t=>{h();try{i([...e.map(r),...t])}catch(t){d.f&Vn||Vi(t,d)}null==u||u.deactivate(),Jr()})).catch((t=>{Vi(t,d)}))}}function Jr(){gs(null),ms(null),Mi(null),Ci(null)}const Zr=new Set;function to(t){var e=Cn|jn,n=null!==fs&&fs.f&Cn?fs:null;null!==vs&&(vs.f|=Yn);return{ctx:Ni,deps:null,effects:null,equals:_i,f:e,fn:t,reactions:null,rv:0,v:vn,wv:0,parent:null!=n?n:vs,ac:null}}function eo(t,e,n){let i=vs;null===i&&function(){{const t=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 t.name="Svelte error",t}}();var r=i.b,o=void 0,s=fo(vn);s.label=e;var a=!fs,l=new Map;return function(t){Uo(ei|Yn,t,!0)}((()=>{var e=Fn();o=e.promise;try{Promise.resolve(t()).then(e.resolve,e.reject).then((()=>{n===Zi&&n.committed&&n.deactivate(),Jr()}))}catch(t){e.reject(t),Jr()}var n=Zi;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(ai),l.delete(n),l.set(n,e)}const u=(t,e=void 0)=>{if(n.activate(),e)e!==ai&&(s.f|=ni,go(s,e));else{s.f&ni&&(s.f^=ni),go(s,t);for(const[t,e]of l){if(l.delete(t),t===n)break;e.reject(ai)}}a&&(r.update_pending_count(-1),n.decrement(c))};e.promise.then(u,(t=>u(null,t||"unknown")))})),Vo((()=>{for(const t of l.values())t.reject(ai)})),s.f|=ei,new Promise((t=>{!function e(n){function i(){n===o?t(s):e(o)}n.then(i,i)}(o)}))}function no(t){const e=to(t);return bs(e),e}function io(t){const e=to(t);return e.equals=Ti,e}function ro(t){var e=t.effects;if(null!==e){t.effects=null;for(var n=0;n<e.length;n+=1)ns(e[n])}}let oo=[];function so(t){var e,n=vs;gs(function(t){for(var e=t.parent;null!==e;){if(!(e.f&Cn))return e.f&Vn?null:e;e=e.parent}return null}(t));{let i=lo;uo(new Set);try{oo.includes(t)&&function(){{const t=new Error("derived_references_self\nA derived value cannot reference itself recursively\nhttps://svelte.dev/e/derived_references_self");throw t.name="Svelte error",t}}(),oo.push(t),t.f&=~Zn,ro(t),e=Ms(t)}finally{gs(n),uo(i),oo.pop()}}return e}function ao(t){var e,n,i=so(t);if(!t.equals(i)&&(t.wv=Ss(),(null===(e=Zi)||void 0===e||!e.is_fork||null===t.deps)&&(t.v=i,null===t.deps)))return void Ki(t,$n);ds||(null!==tr?(qo()||null!==(n=Zi)&&void 0!==n&&n.is_fork)&&tr.set(t,i):Xi(t))}let lo=new Set;const co=new Map;function uo(t){lo=t}let ho=!1;function fo(t,e){return{f:0,v:t,reactions:null,equals:_i,rv:0,wv:0}}function po(t,e){const n=fo(t);return bs(n),n}function mo(t,e=!1,n=!0){const i=fo(t);return e||(i.equals=Ti),i}function vo(t,e,n=!1){var i;null!==fs&&(!ps||fs.f&Kn)&&fs.f&(Cn|Dn|ei|Kn)&&(null===(i=ys)||void 0===i||!i.includes(t))&&function(){{const t=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 t.name="Svelte error",t}}();let r=n?xo(e):e;return Si(r,t.label),go(t,r)}function go(t,e){if(!t.equals(e)){var n=t.v;ds?co.set(t,e):co.set(t,n),t.v=e;var i=fr.ensure();if(i.capture(t,n),null!==vs){var r,o,s;null!==(r=t.updated)&&void 0!==r||(t.updated=new Map);const e=(null!==(o=null===(s=t.updated.get(""))||void 0===s?void 0:s.count)&&void 0!==o?o:0)+1;if(t.updated.set("",{error:null,count:e}),e>5){const e=Ai("updated at");if(null!==e){let n=t.updated.get(e.stack);n||(n={error:e,count:0},t.updated.set(e.stack,n)),n.count++}}}if(null!==vs&&(t.set_during_effect=!0),t.f&Cn){const e=t;t.f&jn&&so(e),Xi(e)}t.wv=Ss(),ko(t,jn),null!==vs&&vs.f&$n&&!(vs.f&(Ln|Bn))&&(null===xs?function(t){xs=t}([t]):xs.push(t)),!i.is_fork&&lo.size>0&&!ho&&yo()}return e}function yo(){ho=!1;var t=cs;us(!0);const e=Array.from(lo);try{for(const t of e)t.f&$n&&Ki(t,Un),As(t)&&Os(t)}finally{us(t)}lo.clear()}function bo(t){vo(t,t.v+1)}function ko(t,e){var n=t.reactions;if(null!==n)for(var i=n.length,r=0;r<i;r++){var o=n[r],s=o.f;if(s&Kn)lo.add(o);else{var a=!(s&jn);if(a&&Ki(o,e),s&Cn){var l,c=o;null===(l=tr)||void 0===l||l.delete(c),s&Zn||(s&Wn&&(o.f|=Zn),ko(c,Un))}else a&&(s&Dn&&null!==kr&&kr.add(o),Tr(o))}}}const wo=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function xo(t){if("object"!=typeof t||null===t||ii in t)return t;const e=Nn(t);if(e!==Sn&&e!==An)return t;var n=new Map,i=wn(t),r=po(0),o=Es,s=t=>{if(Es===o)return t();var e=fs,n=Es;ms(null),Is(o);var i=t();return ms(e),Is(n),i};i&&(n.set("length",po(t.length)),t=new Proxy(t,{get(t,e,n){var i=Reflect.get(t,e,n);return Eo.has(e)?function(...t){ho=!0;var e=i.apply(this,t);return yo(),e}:i}}));var a="";let l=!1;function c(t){if(!l){l=!0,Ii(r,`${a=t} version`);for(const[t,e]of n)Ii(e,_o(a,t));l=!1}}return new Proxy(t,{defineProperty(t,e,i){"value"in i&&!1!==i.configurable&&!1!==i.enumerable&&!1!==i.writable||function(){{const t=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 t.name="Svelte error",t}}();var r=n.get(e);return void 0===r?r=s((()=>{var t=po(i.value);return n.set(e,t),"string"==typeof e&&Ii(t,_o(a,e)),t})):vo(r,i.value,!0),!0},deleteProperty(t,e){var i=n.get(e);if(void 0===i){if(e in t){const t=s((()=>po(vn)));n.set(e,t),bo(r),Ii(t,_o(a,e))}}else vo(i,vn),bo(r);return!0},get(e,i,r){var o;if(i===ii)return t;if(i===si)return c;var l=n.get(i),u=i in e;if(void 0===l&&(!u||null!==(o=En(e,i))&&void 0!==o&&o.writable)&&(l=s((()=>{var t=po(xo(u?e[i]:vn));return Ii(t,_o(a,i)),t})),n.set(i,l)),void 0!==l){var d=Rs(l);return d===vn?void 0:d}return Reflect.get(e,i,r)},getOwnPropertyDescriptor(t,e){var i=Reflect.getOwnPropertyDescriptor(t,e);if(i&&"value"in i){var r=n.get(e);r&&(i.value=Rs(r))}else if(void 0===i){var o=n.get(e),s=null==o?void 0:o.v;if(void 0!==o&&s!==vn)return{enumerable:!0,configurable:!0,value:s,writable:!0}}return i},has(t,e){var i;if(e===ii)return!0;var r=n.get(e),o=void 0!==r&&r.v!==vn||Reflect.has(t,e);if((void 0!==r||null!==vs&&(!o||null!==(i=En(t,e))&&void 0!==i&&i.writable))&&(void 0===r&&(r=s((()=>{var n=po(o?xo(t[e]):vn);return Ii(n,_o(a,e)),n})),n.set(e,r)),Rs(r)===vn))return!1;return o},set(t,e,o,l){var c,u=n.get(e),d=e in t;if(i&&"length"===e)for(var h=o;h<u.v;h+=1){var f=n.get(h+"");void 0!==f?vo(f,vn):h in t&&(f=s((()=>po(vn))),n.set(h+"",f),Ii(f,_o(a,h)))}void 0===u?(!d||null!==(c=En(t,e))&&void 0!==c&&c.writable)&&(Ii(u=s((()=>po(void 0))),_o(a,e)),vo(u,xo(o)),n.set(e,u)):(d=u.v!==vn,vo(u,s((()=>xo(o)))));var p=Reflect.getOwnPropertyDescriptor(t,e);if(null!=p&&p.set&&p.set.call(l,o),!d){if(i&&"string"==typeof e){var m=n.get("length"),v=Number(e);Number.isInteger(v)&&v>=m.v&&vo(m,v+1)}bo(r)}return!0},ownKeys(t){Rs(r);var e=Reflect.ownKeys(t).filter((t=>{var e=n.get(t);return void 0===e||e.v!==vn}));for(var[i,o]of n)o.v===vn||i in t||e.push(i);return e},setPrototypeOf(){!function(){{const t=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw t.name="Svelte error",t}}()}})}function _o(t,e){var n;return"symbol"==typeof e?`${t}[Symbol(${null!==(n=e.description)&&void 0!==n?n:""})]`:wo.test(e)?`${t}.${e}`:/^\d+$/.test(e)?`${t}[${e}]`:`${t}['${e}']`}function To(t){try{if(null!==t&&"object"==typeof t&&ii in t)return t[ii]}catch{}return t}const Eo=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function Io(t,e,n=!0){try{t===e!=(To(t)===To(e))&&pi(n?"===":"!==")}catch{}return t===e===n}var So,Ao,No,Mo;function Fo(){if(void 0===So){So=window,Ao=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;No=En(e,"firstChild").get,Mo=En(e,"nextSibling").get,Mn(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),Mn(n)&&(n.__t=void 0),t.__svelte_meta=null,function(){const t=Array.prototype,e=Array.__svelte_cleanup;e&&e();const{indexOf:n,lastIndexOf:i,includes:r}=t;t.indexOf=function(t,e){const i=n.call(this,t,e);if(-1===i)for(let n=null!=e?e:0;n<this.length;n+=1)if(To(this[n])===t){pi("array.indexOf(...)");break}return i},t.lastIndexOf=function(t,e){const n=i.call(this,t,null!=e?e:this.length-1);if(-1===n)for(let n=0;n<=(null!=e?e:this.length-1);n+=1)if(To(this[n])===t){pi("array.lastIndexOf(...)");break}return n},t.includes=function(t,e){const n=r.call(this,t,e);if(!n)for(let e=0;e<this.length;e+=1)if(To(this[e])===t){pi("array.includes(...)");break}return n},Array.__svelte_cleanup=()=>{t.indexOf=n,t.lastIndexOf=i,t.includes=r}}()}}function Co(t=""){return document.createTextNode(t)}function Oo(t){return No.call(t)}function Po(t){return Mo.call(t)}function Ro(t,e){if(!vi)return Oo(t);var n=Oo(mi);if(null===n)n=mi.appendChild(Co());else if(e&&n.nodeType!==li){var i,r=Co();return null===(i=n)||void 0===i||i.before(r),yi(r),r}return yi(n),n}function Do(t,e=!1){var n;if(!vi){var i=Oo(t);return i instanceof Comment&&""===i.data?Po(i):i}if(e&&(null===(n=mi)||void 0===n?void 0:n.nodeType)!==li){var r,o=Co();return null===(r=mi)||void 0===r||r.before(o),yi(o),o}return mi}function Lo(t,e=1,n=!1){var i;let r=vi?mi:t;for(var o;e--;)o=r,r=Po(r);if(!vi)return r;if(n&&(null===(i=r)||void 0===i?void 0:i.nodeType)!==li){var s,a=Co();if(null===r)null===(s=o)||void 0===s||s.after(a);else r.before(a);return yi(a),a}return yi(r),r}function Bo(t){t.textContent=""}function zo(t,e){if(e){const e=document.body;t.autofocus=!0,$i((()=>{document.activeElement===e&&t.focus()}))}}let Wo=!1;function $o(t){var e=fs,n=vs;ms(null),gs(null);try{return t()}finally{ms(e),gs(n)}}function jo(t){null===vs&&(null===fs&&function(t){{const e=new Error(`effect_orphan\n\`${t}\` can only be used inside an effect (e.g. during component initialisation)\nhttps://svelte.dev/e/effect_orphan`);throw e.name="Svelte error",e}}(t),function(){{const t=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 t.name="Svelte error",t}}()),ds&&function(t){{const e=new Error(`effect_in_teardown\n\`${t}\` cannot be used inside an effect cleanup function\nhttps://svelte.dev/e/effect_in_teardown`);throw e.name="Svelte error",e}}(t)}function Uo(t,e,n){for(var i=vs;null!==i&&i.f&Kn;)i=i.parent;null!==i&&i.f&qn&&(t|=qn);var r={ctx:Ni,deps:null,nodes:null,f:t|jn|Wn,first:null,fn:e,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,wv:0,ac:null};if(r.component_function=Oi,n)try{Os(r),r.f|=Gn}catch(t){throw ns(r),t}else null!==e&&Tr(r);var o=r;if(!n||null!==o.deps||null!==o.teardown||null!==o.nodes||o.first!==o.last||o.f&Yn||(o=o.first,t&Dn&&t&Hn&&null!==o&&(o.f|=Hn)),null!==o&&(o.parent=i,null!==i&&function(t,e){var n=e.last;null===n?e.last=e.first=t:(n.next=t,t.prev=n,e.last=t)}(o,i),null!==fs&&fs.f&Cn&&!(t&Bn))){var s,a=fs;(null!==(s=a.effects)&&void 0!==s?s:a.effects=[]).push(o)}return r}function qo(){return null!==fs&&!ps}function Vo(t){const e=Uo(Pn,null,!1);return Ki(e,$n),e.teardown=t,e}function Go(t){jo("$effect"),Tn(t,"name",{value:"$effect"});var e=vs.f;if(!!(fs||!(e&Ln)||e&Gn))return Ho(t);var n,i=Ni;(null!==(n=i.e)&&void 0!==n?n:i.e=[]).push(t)}function Ho(t){return Uo(On|Qn,t,!1)}function Ko(t){return Uo(On,t,!1)}function Xo(t,e=0){return Uo(Pn|e,t,!0)}function Yo(t,e=[],n=[],i=[]){Qr(i,e,n,(e=>{Uo(Pn,(()=>t(...e.map(Rs))),!0)}))}function Qo(t,e=0){var n=Uo(Dn|e,t,!0);return n.dev_stack=Fi,n}function Jo(t,e=0){var n=Uo(Rn|e,t,!0);return n.dev_stack=Fi,n}function Zo(t){return Uo(Ln|Yn,t,!0)}function ts(t){var e=t.teardown;if(null!==e){const t=ds,n=fs;hs(!0),ms(null);try{e.call(null)}finally{hs(t),ms(n)}}}function es(t,e=!1){var n=t.first;for(t.first=t.last=null;null!==n;){const t=n.ac;null!==t&&$o((()=>{t.abort(ai)}));var i=n.next;n.f&Bn?n.parent=null:ns(n,e),n=i}}function ns(t,e=!0){var n=!1;(e||t.f&Xn)&&null!==t.nodes&&null!==t.nodes.end&&(!function(t,e){for(;null!==t;){var n=t===e?null:Po(t);t.remove(),t=n}}(t.nodes.start,t.nodes.end),n=!0),es(t,e&&!n),Cs(t,0),Ki(t,Vn);var i=t.nodes&&t.nodes.t;if(null!==i)for(const t of i)t.stop();ts(t);var r=t.parent;null!==r&&null!==r.first&&is(t),t.component_function=null,t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=null}function is(t){var e=t.parent,n=t.prev,i=t.next;null!==n&&(n.next=i),null!==i&&(i.prev=n),null!==e&&(e.first===t&&(e.first=i),e.last===t&&(e.last=n))}function rs(t,e,n=!0){var i=[];os(t,i,!0);var r=()=>{n&&ns(t),e&&e()},o=i.length;if(o>0){var s=()=>--o||r();for(var a of i)a.out(s)}else r()}function os(t,e,n){if(!(t.f&qn)){t.f^=qn;var i=t.nodes&&t.nodes.t;if(null!==i)for(const t of i)(t.is_global||n)&&e.push(t);for(var r=t.first;null!==r;){var o=r.next;os(r,e,!!(!!(r.f&Hn)||!!(r.f&Ln)&&!!(t.f&Dn))&&n),r=o}}}function ss(t){as(t,!0)}function as(t,e){if(t.f&qn){t.f^=qn,t.f&$n||(Ki(t,jn),Tr(t));for(var n=t.first;null!==n;){var i=n.next;as(n,!!(!!(n.f&Hn)||!!(n.f&Ln))&&e),n=i}var r=t.nodes&&t.nodes.t;if(null!==r)for(const t of r)(t.is_global||e)&&t.in()}}function ls(t,e){if(t.nodes)for(var n=t.nodes.start,i=t.nodes.end;null!==n;){var r=n===i?null:Po(n);e.append(n),n=r}}let cs=!1;function us(t){cs=t}let ds=!1;function hs(t){ds=t}let fs=null,ps=!1;function ms(t){fs=t}let vs=null;function gs(t){vs=t}let ys=null;function bs(t){null!==fs&&(null===ys?ys=[t]:ys.push(t))}let ks=null,ws=0,xs=null;let _s=1,Ts=0,Es=Ts;function Is(t){Es=t}function Ss(){return++_s}function As(t){var e=t.f;if(e&jn)return!0;if(e&Cn&&(t.f&=~Zn),e&Un){for(var n=t.deps,i=n.length,r=0;r<i;r++){var o=n[r];if(As(o)&&ao(o),o.wv>t.wv)return!0}e&Wn&&null===tr&&Ki(t,$n)}return!1}function Ns(t,e,n=!0){var i,r=t.reactions;if(null!==r&&(null===(i=ys)||void 0===i||!i.includes(t)))for(var o=0;o<r.length;o++){var s=r[o];s.f&Cn?Ns(s,e,!1):e===s&&(n?Ki(s,jn):s.f&$n&&Ki(s,Un),Tr(s))}}function Ms(t){var e=ks,n=ws,i=xs,r=fs,o=ys,s=Ni,a=ps,l=Es,c=t.f;ks=null,ws=0,xs=null,fs=c&(Ln|Bn)?null:t,ys=null,Mi(t.ctx),ps=!1,Es=++Ts,null!==t.ac&&($o((()=>{t.ac.abort(ai)})),t.ac=null);try{t.f|=ti;var u=(0,t.fn)(),d=t.deps;if(null!==ks){var h;if(Cs(t,ws),null!==d&&ws>0)for(d.length=ws+ks.length,h=0;h<ks.length;h++)d[ws+h]=ks[h];else t.deps=d=ks;if(qo()&&t.f&Wn)for(h=ws;h<d.length;h++){var f,p;(null!==(p=(f=d[h]).reactions)&&void 0!==p?p:f.reactions=[]).push(t)}}else null!==d&&ws<d.length&&(Cs(t,ws),d.length=ws);if(!(null===xs||ps||null===d||t.f&(Cn|Un|jn)))for(h=0;h<xs.length;h++)Ns(xs[h],t);return null!==r&&r!==t&&(Ts++,null!==xs&&(null===i?i=xs:i.push(...xs))),t.f&ni&&(t.f^=ni),u}catch(t){return qi(t)}finally{t.f^=ti,ks=e,ws=n,xs=i,fs=r,ys=o,Mi(s),ps=a,Es=l}}function Fs(t,e){let n=e.reactions;if(null!==n){var i=xn.call(n,t);if(-1!==i){var r=n.length-1;0===r?n=e.reactions=null:(n[i]=n[r],n.pop())}}if(null===n&&e.f&Cn&&(null===ks||!ks.includes(e))){var o=e;o.f&Wn&&(o.f^=Wn,o.f&=~Zn),Xi(o),ro(o),Cs(o,0)}}function Cs(t,e){var n=t.deps;if(null!==n)for(var i=e;i<n.length;i++)Fs(t,n[i])}function Os(t){var e=t.f;if(!(e&Vn)){Ki(t,$n);var n=vs,i=cs;vs=t,cs=!0;var r,o=Oi;Pi(t.component_function);var s=Fi;Ci(null!==(r=t.dev_stack)&&void 0!==r?r:Fi);try{e&(Dn|Rn)?function(t){for(var e=t.first;null!==e;){var n=e.next;e.f&Ln||ns(e),e=n}}(t):es(t),ts(t);var a=Ms(t);t.teardown="function"==typeof a?a:null,t.wv=_s,kn&&Ei&&t.f&jn&&t.deps}finally{cs=i,vs=n,Pi(o),Ci(s)}}}async function Ps(){await Promise.resolve(),function(){var t=rr;rr=!0;try{for(;;){var e;if(ji(),0===er.length&&(null===(e=Zi)||void 0===e||e.flush(),0===er.length))return void(nr=null);yr()}}finally{rr=t}}()}function Rs(t){var e,n,i=!!(t.f&Cn);if(null!==fs&&!ps&&!(null!==vs&&!!(vs.f&Vn)||null!==(n=ys)&&void 0!==n&&n.includes(t))){var r=fs.deps;if(fs.f&ti)t.rv<Ts&&(t.rv=Ts,null===ks&&null!==r&&r[ws]===t?ws++:null===ks?ks=[t]:ks.includes(t)||ks.push(t));else{var o,s;(null!==(s=(o=fs).deps)&&void 0!==s?s:o.deps=[]).push(t);var a=t.reactions;null===a?t.reactions=[fs]:a.includes(fs)||a.push(fs)}}if(Zr.delete(t),ds&&co.has(t))return co.get(t);if(i){var l=t;if(ds){var c=l.v;return(l.f&$n||null===l.reactions)&&!Ls(l)||(c=so(l)),co.set(l,c),c}var u=!(l.f&Wn)&&!ps&&null!==fs&&(cs||!!(fs.f&Wn)),d=null===l.deps;As(l)&&(u&&(l.f|=Wn),ao(l)),u&&!d&&Ds(l)}if(null!==(e=tr)&&void 0!==e&&e.has(t))return tr.get(t);if(t.f&ni)throw t.v;return t.v}function Ds(t){if(null!==t.deps){t.f|=Wn;for(const n of t.deps){var e;(null!==(e=n.reactions)&&void 0!==e?e:n.reactions=[]).push(t),n.f&Cn&&!(n.f&Wn)&&Ds(n)}}}function Ls(t){if(t.v===vn)return!0;if(null===t.deps)return!1;for(const e of t.deps){if(co.has(e))return!0;if(e.f&Cn&&Ls(e))return!0}return!1}function Bs(t){var e=ps;try{return ps=!0,t()}finally{ps=e}}const zs=new Set,Ws=new Set;function $s(t,e,n,i={}){function r(t){if(i.capture||Vs.call(e,t),!t.cancelBubble)return $o((()=>null==n?void 0:n.call(this,t)))}return t.startsWith("pointer")||t.startsWith("touch")||"wheel"===t?$i((()=>{e.addEventListener(t,r,i)})):e.addEventListener(t,r,i),r}function js(t,e,n,i,r){var o={capture:i,passive:r},s=$s(t,e,n,o);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&Vo((()=>{e.removeEventListener(t,s,o)}))}function Us(t){for(var e=0;e<t.length;e++)zs.add(t[e]);for(var n of Ws)n(t)}let qs=null;function Vs(t){var e,n=this,i=n.ownerDocument,r=t.type,o=(null===(e=t.composedPath)||void 0===e?void 0:e.call(t))||[],s=o[0]||t.target;qs=t;var a=0,l=qs===t&&t.__root;if(l){var c=o.indexOf(l);if(-1!==c&&(n===document||n===window))return void(t.__root=n);var u=o.indexOf(n);if(-1===u)return;c<=u&&(a=c)}if((s=o[a]||t.target)!==n){Tn(t,"currentTarget",{configurable:!0,get:()=>s||i});var d=fs,h=vs;ms(null),gs(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&&t.target!==s||v.call(s,t)}catch(t){f?p.push(t):f=t}if(t.cancelBubble||m===n||null===m)break;s=m}if(f){for(let t of p)queueMicrotask((()=>{throw t}));throw f}}finally{t.__root=n,delete t.currentTarget,ms(d),gs(h)}}}function Gs(t,e){var n=vs;null===n.nodes&&(n.nodes={start:t,end:e,a:null,t:null})}function Hs(t,e){var n,i=!!(1&e),r=!!(2&e),o=!t.startsWith("<!>");return()=>{if(vi)return Gs(mi,null),mi;var e,s;void 0===n&&(e=o?t:"<!>"+t,(s=document.createElement("template")).innerHTML=e.replaceAll("<!>","\x3c!----\x3e"),n=s.content,i||(n=Oo(n)));var a=r||Ao?document.importNode(n,!0):n.cloneNode(!0);i?Gs(Oo(a),a.lastChild):Gs(a,a);return a}}function Ks(){if(vi)return Gs(mi,null),mi;var t=document.createDocumentFragment(),e=document.createComment(""),n=Co();return t.append(e,n),Gs(e,n),t}function Xs(t,e){if(vi){var n=vs;return n.f&Gn&&null!==n.nodes.end||(n.nodes.end=mi),void bi()}null!==t&&t.before(e)}function Ys(t){return t.endsWith("capture")&&"gotpointercapture"!==t&&"lostpointercapture"!==t}const Qs=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function Js(t){return Qs.includes(t)}const Zs={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(t){var e;return t=t.toLowerCase(),null!==(e=Zs[t])&&void 0!==e?e:t}const ea=["touchstart","touchmove"];function na(t,e){var n,i=null==e?"":"object"==typeof e?e+"":e;i!==(null!==(n=t.__t)&&void 0!==n?n:t.__t=t.nodeValue)&&(t.__t=i,t.nodeValue=i+"")}function ia(t,e){return sa(t,e)}function ra(t,e){var n;Fo(),e.intro=null!==(n=e.intro)&&void 0!==n&&n;const i=e.target,r=vi,o=mi;try{for(var s=Oo(i);s&&(s.nodeType!==ci||s.data!==hn);)s=Po(s);if(!s)throw mn;gi(!0),yi(s);const n=sa(t,{...e,anchor:s});return gi(!1),n}catch(n){if(n instanceof Error&&n.message.split("\n").some((t=>t.startsWith("https://svelte.dev/e/"))))throw n;return n!==mn&&console.warn("Failed to hydrate: ",n),!1===e.recover&&function(){{const t=new Error("hydration_failed\nFailed to hydrate the application\nhttps://svelte.dev/e/hydration_failed");throw t.name="Svelte error",t}}(),Fo(),Bo(i),gi(!1),ia(t,e)}finally{gi(r),yi(o)}}const oa=new Map;function sa(t,{target:e,anchor:n,props:i={},events:r,context:o,intro:s=!0}){Fo();var a=new Set,l=t=>{for(var n=0;n<t.length;n++){var i=t[n];if(!a.has(i)){a.add(i);var r=(s=i,ea.includes(s));e.addEventListener(i,Vs,{passive:r});var o=oa.get(i);void 0===o?(document.addEventListener(i,Vs,{passive:r}),oa.set(i,1)):oa.set(i,o+1)}}var s};l(_n(zs)),Ws.add(l);var c=void 0,u=function(t){fr.ensure();const e=Uo(Bn|Yn,t,!0);return(t={})=>new Promise((n=>{t.outro?rs(e,(()=>{ns(e),n(void 0)})):(ns(e),n(void 0))}))}((()=>{var s=null!=n?n:e.appendChild(Co());return function(t,e,n){new qr(t,e,n)}(s,{pending:()=>{}},(e=>{o&&(Di({}),Ni.c=o);if(r&&(i.$$events=r),vi&&Gs(e,null),c=t(e,i)||{},vi&&(vs.nodes.end=mi,null===mi||mi.nodeType!==ci||mi.data!==pn))throw fi(),mn;o&&Li()})),()=>{for(var t of a){e.removeEventListener(t,Vs);var i=oa.get(t);0==--i?(document.removeEventListener(t,Vs),oa.delete(t)):oa.set(t,i)}var r;(Ws.delete(l),s!==n)&&(null===(r=s.parentNode)||void 0===r||r.removeChild(s))}}));return aa.set(c,u),c}let aa=new WeakMap;function la(t,e){const n=aa.get(t);return n?(aa.delete(t),n(e)):(ii in t?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",di,hi):console.warn("%c[svelte] lifecycle_double_unmount\n%cTried to unmount a component that was not mounted\nhttps://svelte.dev/e/lifecycle_double_unmount",di,hi),Promise.resolve())}class ca{anchor;#t=new Map;#e=new Map;#n=new Map;#i=new Set;#r=!0;constructor(t,e=!0){this.anchor=t,this.#r=e}#o=()=>{var t=Zi;if(this.#t.has(t)){var e=this.#t.get(t),n=this.#e.get(e);if(n)ss(n),this.#i.delete(e);else{var i=this.#n.get(e);i&&(this.#e.set(e,i.effect),this.#n.delete(e),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),n=i.effect)}for(const[e,n]of this.#t){if(this.#t.delete(e),e===t)break;const i=this.#n.get(n);i&&(ns(i.effect),this.#n.delete(n))}for(const[t,i]of this.#e){if(t===e||this.#i.has(t))continue;const r=()=>{if(Array.from(this.#t.values()).includes(t)){var e=document.createDocumentFragment();ls(i,e),e.append(Co()),this.#n.set(t,{effect:i,fragment:e})}else ns(i);this.#i.delete(t),this.#e.delete(t)};this.#r||!n?(this.#i.add(t),rs(i,r,!1)):r()}}};#s=t=>{this.#t.delete(t);const e=Array.from(this.#t.values());for(const[t,n]of this.#n)e.includes(t)||(ns(n.effect),this.#n.delete(t))};ensure(t,e){var n=Zi;!e||this.#e.has(t)||this.#n.has(t)||this.#e.set(t,Zo((()=>e(this.anchor)))),this.#t.set(n,t),vi&&(this.anchor=mi),this.#o()}}{let t=function(t){if(!(t in globalThis)){let e;Object.defineProperty(globalThis,t,{configurable:!0,get:()=>{if(void 0!==e)return e;!function(t){{const e=new Error(`rune_outside_svelte\nThe \`${t}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files\nhttps://svelte.dev/e/rune_outside_svelte`);throw e.name="Svelte error",e}}(t)},set:t=>{e=t}})}};t("$state"),t("$effect"),t("$derived"),t("$inspect"),t("$props"),t("$bindable")}var ua,da=new Map;function ha(t,e,n=!1){vi&&bi();var i=new ca(t);function r(e,n){if(vi){if(e===(xi(t)===fn)){var r=wi();return yi(r),i.anchor=r,gi(!1),i.ensure(e,n),void gi(!0)}}i.ensure(e,n)}Qo((()=>{var t=!1;e(((e,n=!0)=>{t=!0,r(n,e)})),t||r(!1,null)}),n?Hn:0)}function fa(t,e){return e}function pa(t,e=!0){for(var n=0;n<t.length;n++)ns(t[n],e)}function ma(t,e,n,i,r,o=null){var s=t,a=new Map;if(!!(e&on)){var l=t;s=vi?yi(Oo(l)):l.appendChild(Co())}vi&&bi();var c,u=null,d=io((()=>{var t=n();return wn(t)?t:null==t?[]:_n(t)})),h=!0;function f(){m.fallback=u,function(t,e,n,i,r){var o,s,a,l,c,u=!!(i&sn),d=e.length,h=t.items,f=t.effect.first,p=null,m=[],v=[];if(u)for(c=0;c<d;c+=1){var g,y;if(a=r(e[c],c),!((l=h.get(a).e).f&Jn))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(e[c],c),l=h.get(a).e,null!==t.outrogroups)for(const e of t.outrogroups)e.pending.delete(l),e.done.delete(l);if(l.f&Jn){if(l.f^=Jn,l!==f){var b=p?p.next:f;l===t.effect.last&&(t.effect.last=l.prev),l.prev&&(l.prev.next=l.next),l.next&&(l.next.prev=l.prev),ya(t,p,l),ya(t,l,b),ga(l,b,n),m=[],v=[],f=(p=l).next;continue}ga(l,null,n)}var k,w;if(l.f&qn)if(ss(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],E=m[m.length-1];for(x=0;x<m.length;x+=1)ga(m[x],_,n);for(x=0;x<v.length;x+=1)o.delete(v[x]);ya(t,T.prev,E.next),ya(t,p,T),ya(t,E,_),f=_,p=E,c-=1,m=[],v=[]}else o.delete(l),ga(l,f,n),ya(t,l.prev,l.next),ya(t,l,null===p?t.effect.first:p.next),ya(t,p,l),p=l;continue}for(m=[],v=[];null!==f&&f!==l;){var I;(null!==(I=o)&&void 0!==I?I:o=new Set).add(f),v.push(f),f=f.next}if(null===f)continue}l.f&Jn||m.push(l),p=l,f=l.next}if(null!==t.outrogroups){for(const e of t.outrogroups){var S;if(0===e.pending.size)pa(_n(e.done)),null===(S=t.outrogroups)||void 0===S||S.delete(e)}0===t.outrogroups.size&&(t.outrogroups=null)}if(null!==f||void 0!==o){var A=[];if(void 0!==o)for(l of o)l.f&qn||A.push(l);for(;null!==f;)f.f&qn||f===t.fallback||A.push(f),f=f.next;var N=A.length;if(N>0){var M=i&on&&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(t,e,n){for(var i,r=e.length,o=e.length,s=0;s<r;s++){let n=e[s];rs(n,(()=>{if(i){if(i.pending.delete(n),i.done.add(n),0===i.pending.size){var e=t.outrogroups;pa(_n(i.done)),e.delete(i),0===e.size&&(t.outrogroups=null)}}else o-=1}),!1)}if(0===o){var a=null!==n;if(a){var l=n,c=l.parentNode;Bo(c),c.append(l),t.items.clear()}pa(e,!a)}else{var u;i={pending:new Set(e),done:new Set},(null!==(u=t.outrogroups)&&void 0!==u?u:t.outrogroups=new Set).add(i)}}(t,A,M)}}u&&$i((()=>{if(void 0!==s)for(l of s){var t;null===(t=l.nodes)||void 0===t||null===(t=t.a)||void 0===t||t.apply()}}))}(m,c,s,e,i),null!==u&&(0===c.length?u.f&Jn?(u.f^=Jn,ga(u,null,s)):ss(u):rs(u,(()=>{u=null})))}var p=Qo((()=>{var t=(c=Rs(d)).length;let l=!1;vi&&(xi(s)===fn!==(0===t)&&(yi(s=wi()),gi(!1),l=!0));for(var p=new Set,m=0;m<t;m+=1){vi&&mi.nodeType===ci&&mi.data===pn&&(s=mi,l=!0,gi(!1));var v,g=c[m],y=i(g,m),b=h?null:a.get(y);if(b)b.v&&go(b.v,g),b.i&&go(b.i,m);else b=va(a,h?s:null!==(v=ua)&&void 0!==v?v:ua=Co(),g,y,m,r,e,n),h||(b.e.f|=Jn),a.set(y,b);p.add(y)}0===t&&o&&!u&&(h?u=Zo((()=>o(s))):(u=Zo((()=>{var t;return o(null!==(t=ua)&&void 0!==t?t:ua=Co())}))).f|=Jn),vi&&t>0&&yi(wi()),h||f(),l&&gi(!0),Rs(d)})),m={effect:p,items:a,outrogroups:null,fallback:u};h=!1,vi&&(s=mi)}function va(t,e,n,i,r,o,s,a){var l=s&nn?s&an?fo(n):mo(n,!1,!1):null,c=s&rn?fo(r):null;return l&&(l.trace=()=>{var t;a()[null!==(t=null==c?void 0:c.v)&&void 0!==t?t:r]}),{v:l,i:c,e:Zo((()=>(o(e,null!=l?l:n,null!=c?c:r,a),()=>{t.delete(i)})))}}function ga(t,e,n){if(t.nodes)for(var i=t.nodes.start,r=t.nodes.end,o=!e||e.f&Jn?n:e.nodes.start;null!==i;){var s=Po(i);if(o.before(i),i===r)return;i=s}}function ya(t,e,n){null===e?t.effect.first=n:e.next=n,null===n?t.effect.last=e:n.prev=e}function ba(t,e){Ko((()=>{var n,i=t.getRootNode(),r=i.host?i:null!==(n=i.head)&&void 0!==n?n:i.ownerDocument.head;if(!r.querySelector("#"+e.hash)){const t=document.createElement("style");t.id=e.hash,t.textContent=e.code,r.appendChild(t),function(t,e){var n=da.get(t);n||(n=new Set,da.set(t,n)),n.add(e)}(e.hash,t)}}))}function ka(t,e){var n,i=void 0;Jo((()=>{i!==(i=e())&&(n&&(ns(n),n=null),i&&(n=Zo((()=>{Ko((()=>i(t)))}))))}))}function wa(t){var e,n,i="";if("string"==typeof t||"number"==typeof t)i+=t;else if("object"==typeof t)if(Array.isArray(t)){var r=t.length;for(e=0;e<r;e++)t[e]&&(n=wa(t[e]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}function xa(t){return"object"==typeof t?function(){for(var t,e,n=0,i="",r=arguments.length;n<r;n++)(t=arguments[n])&&(e=wa(t))&&(i&&(i+=" "),i+=e);return i}(t):null!=t?t:""}const _a=[..." \t\n\r\f \v\ufeff"];function Ta(t,e=!1){var n=e?" !important;":";",i="";for(var r in t){var o=t[r];null!=o&&""!==o&&(i+=" "+r+": "+o+n)}return i}function Ea(t){return"-"!==t[0]||"-"!==t[1]?t.toLowerCase():t}function Ia(t,e,n,i,r,o){var s=t.__className;if(vi||s!==n||void 0===s){var a=function(t,e,n){var i=null==t?"":""+t;if(e&&(i=i?i+" "+e:e),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&&!_a.includes(i[s-1])||a!==i.length&&!_a.includes(i[a])?s=a:i=(0===s?"":i.substring(0,s))+i.substring(a+1)}return""===i?null:i}(n,i,o);vi&&a===t.getAttribute("class")||(null==a?t.removeAttribute("class"):e?t.className=a:t.setAttribute("class",a)),t.__className=n}else if(o&&r!==o)for(var l in o){var c=!!o[l];null!=r&&c===!!r[l]||t.classList.toggle(l,c)}return o}function Sa(t,e={},n,i){for(var r in n){var o=n[r];e[r]!==o&&(null==n[r]?t.style.removeProperty(r):t.style.setProperty(r,o,i))}}function Aa(t,e,n,i){var r=t.__style;if(vi||r!==e){var o=function(t,e){if(e){var n,i,r="";if(Array.isArray(e)?(n=e[0],i=e[1]):n=e,t){t=String(t).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 e=t.length;for(var d=0;d<e;d++){var h=t[d];if(a?"/"===h&&"*"===t[d-1]&&(a=!1):o?o===h&&(o=!1):"/"===h&&"*"===t[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===e-1){if(-1!==u){var f=Ea(t.substring(c,u).trim());l.includes(f)||(";"!==h&&d++,r+=" "+t.substring(c,d).trim()+";")}c=d+1,u=-1}}}return n&&(r+=Ta(n)),i&&(r+=Ta(i,!0)),""===(r=r.trim())?null:r}return null==t?null:String(t)}(e,i);vi&&o===t.getAttribute("style")||(null==o?t.removeAttribute("style"):t.style.cssText=o),t.__style=e}else i&&(Array.isArray(i)?(Sa(t,null==n?void 0:n[0],i[0]),Sa(t,null==n?void 0:n[1],i[1],"important")):Sa(t,n,i));return i}function Na(t,e,n=!1){if(t.multiple){if(null==e)return;if(!wn(e))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",di,hi);for(var i of t.options)i.selected=e.includes(Ma(i))}else{for(i of t.options){var r=Ma(i);if(o=r,s=e,Object.is(To(o),To(s)))return void(i.selected=!0)}var o,s;n&&void 0===e||(t.selectedIndex=-1)}}function Ma(t){return"__value"in t?t.__value:t.value}const Fa=Symbol("class"),Ca=Symbol("style"),Oa=Symbol("is custom element"),Pa=Symbol("is html");function Ra(t){if(vi){var e=!1,n=()=>{if(!e){if(e=!0,t.hasAttribute("value")){var n=t.value;La(t,"value",null),t.value=n}if(t.hasAttribute("checked")){var i=t.checked;La(t,"checked",null),t.checked=i}}};t.__on_r=n,$i(n),Wo||(Wo=!0,document.addEventListener("reset",(t=>{Promise.resolve().then((()=>{if(!t.defaultPrevented)for(const n of t.target.elements){var e;null===(e=n.__on_r)||void 0===e||e.call(n)}}))}),{capture:!0}))}}function Da(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function La(t,e,n,i){var r=za(t);vi&&(r[e]=t.getAttribute(e),"src"===e||"srcset"===e||"href"===e&&"LINK"===t.nodeName)?i||function(t,e,n){var i;if("srcset"===e&&function(t,e){var n=Ua(t.srcset),i=Ua(e);return i.length===n.length&&i.every((([t,e],i)=>e===n[i][1]&&(ja(n[i][0],t)||ja(t,n[i][0]))))}(t,n))return;if(ja(null!==(i=t.getAttribute(e))&&void 0!==i?i:"",n))return;!function(t,e,n){console.warn(`%c[svelte] hydration_attribute_changed\n%cThe \`${t}\` attribute on \`${e}\` 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`,di,hi)}(e,t.outerHTML.replace(t.innerHTML,t.innerHTML&&"..."),String(n))}(t,e,null!=n?n:""):r[e]!==(r[e]=n)&&("loading"===e&&(t[oi]=n),null==n?t.removeAttribute(e):"string"!=typeof n&&$a(t).includes(e)?t[e]=n:t.setAttribute(e,n))}function Ba(t,e,n=[],i=[],r=[],o,s=!1,a=!1){Qr(r,n,i,(n=>{var i=void 0,r={},l="SELECT"===t.nodeName,c=!1;if(Jo((()=>{var u=e(...n.map(Rs)),d=function(t,e,n,i,r=!1,o=!1){if(vi&&r&&"INPUT"===t.tagName){var s=t;("checkbox"===s.type?"defaultChecked":"defaultValue")in n||Ra(s)}var a=za(t),l=a[Oa],c=!a[Pa];let u=vi&&l;u&&gi(!1);var d,h=e||{},f="OPTION"===t.tagName;for(var p in e)p in n||(n[p]=null);n.class?n.class=xa(n.class):n.class=null,n[Ca]&&(null!==(d=n.style)&&void 0!==d||(n.style=null));var m=$a(t);for(const r in n){let s=n[r];if(f&&"value"===r&&null==s)t.value=t.__value="",h[r]=s;else if("class"!==r)if("style"!==r){var v=h[r];if(s!==v||void 0===s&&t.hasAttribute(r)){h[r]=s;var g=r[0]+r[1];if("$$"!==g)if("on"===g){const e={},n="$$"+r;let i=r.slice(2);var y=Js(i);if(Ys(i)&&(i=i.slice(0,-7),e.capture=!0),!y&&v){if(null!=s)continue;t.removeEventListener(i,h[n],e),h[n]=null}if(null!=s)if(y)t[`__${i}`]=s,Us([i]);else{let o=function(t){h[r].call(this,t)};h[n]=$s(i,t,o,e)}else y&&(t[`__${i}`]=void 0)}else if("style"===r)La(t,r,s);else if("autofocus"===r)zo(t,Boolean(s));else if(l||"__value"!==r&&("value"!==r||null==s))if("selected"===r&&f)Da(t,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)?(t[b]=s,b in a&&(a[b]=vn)):"function"!=typeof s&&La(t,b,s,o);else if(a[r]=null,"value"===b||"checked"===b){let n=t;const i=void 0===e;if("value"===b){let t=n.defaultValue;n.removeAttribute(b),n.defaultValue=t,n.value=n.__value=i?t:null}else{let t=n.defaultChecked;n.removeAttribute(b),n.defaultChecked=t,n.checked=!!i&&t}}else t.removeAttribute(r)}else t.value=t.__value=s}}else Aa(t,s,null==e?void 0:e[Ca],n[Ca]),h[r]=s,h[Ca]=n[Ca];else Ia(t,"http://www.w3.org/1999/xhtml"===t.namespaceURI,s,i,null==e?void 0:e[Fa],n[Fa]),h[r]=s,h[Fa]=n[Fa]}return u&&gi(!0),h}(t,i,u,o,s,a);c&&l&&"value"in u&&Na(t,u.value);for(let t of Object.getOwnPropertySymbols(r))u[t]||ns(r[t]);for(let e of Object.getOwnPropertySymbols(u)){var h=u[e];e.description!==bn||i&&h===i[e]||(r[e]&&ns(r[e]),r[e]=Zo((()=>ka(t,(()=>h))))),d[e]=h}i=d})),l){var u=t;Ko((()=>{Na(u,i.value,!0),function(t){var e=new MutationObserver((()=>{Na(t,t.__value)}));e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Vo((()=>{e.disconnect()}))}(u)}))}c=!0}))}function za(t){var e;return null!==(e=t.__attributes)&&void 0!==e?e:t.__attributes={[Oa]:t.nodeName.includes("-"),[Pa]:t.namespaceURI===yn}}var Wa=new Map;function $a(t){var e,n=t.getAttribute("is")||t.nodeName,i=Wa.get(n);if(i)return i;Wa.set(n,i=[]);for(var r=t,o=Element.prototype;o!==r;){for(var s in e=In(r))e[s].set&&i.push(s);r=Nn(r)}return i}function ja(t,e){return t===e||new URL(t,document.baseURI).href===new URL(e,document.baseURI).href}function Ua(t){return t.split(",").map((t=>t.trim().split(" ").filter(Boolean)))}function qa(t,e){return t===e||(null==t?void 0:t[ii])===e}function Va(t={},e,n,i){return Ko((()=>{var i,r;return Xo((()=>{i=r,r=[],Bs((()=>{t!==n(...r)&&(e(t,...r),i&&qa(n(...i),t)&&e(null,...i))}))})),()=>{$i((()=>{r&&qa(n(...r),t)&&e(null,...r)}))}})),t}let Ga=!1;function Ha(t,e,n,i){var r,o,s=!!(n&un),a=!!(n&dn),l=i,c=!0,u=()=>(c&&(c=!1,l=a?Bs(i):i),l);if(s){var d,h,f=ii in t||ri in t;r=null!==(d=null===(h=En(t,e))||void 0===h?void 0:h.set)&&void 0!==d?d:f&&e in t?n=>t[e]=n:void 0}var p,m=!1;if(s?[o,m]=function(t){var e=Ga;try{return Ga=!1,[t(),Ga]}finally{Ga=e}}((()=>t[e])):o=t[e],void 0===o&&void 0!==i&&(o=u(),r&&(!function(t){{const e=new Error(`props_invalid_value\nCannot do \`bind:${t}={undefined}\` when \`${t}\` has a fallback value\nhttps://svelte.dev/e/props_invalid_value`);throw e.name="Svelte error",e}}(e),r(o))),p=()=>{var n=t[e];return void 0===n?u():(c=!0,n)},!(n&cn))return p;if(r){var v=t.$$legacy;return function(t,e){return arguments.length>0?((!e||v||m)&&r(e?p():t),t):p()}}var g=!1,y=(n&ln?to:io)((()=>(g=!1,p())));y.label=e,s&&Rs(y);var b=vs;return function(t,e){if(arguments.length>0){const n=e?Rs(y):s?xo(t):t;return vo(y,n),g=!0,void 0!==l&&(l=n),t}return ds&&g||b.f&Vn?y.v:Rs(y)}}var Ka,Xa,Ya,Qa;"undefined"!=typeof window&&(null!==(Xa=(Ka=null!==(Qa=(Ya=window).__svelte)&&void 0!==Qa?Qa:Ya.__svelte={}).v)&&void 0!==Xa?Xa:Ka.v=new Set).add("5");function Ja(t,{include:e,exclude:n}={}){const i=t=>{const i=e=>"string"==typeof e?t===e:e.test(t);return e?e.some(i):!n||!n.some(i)};for(const[e,n]of(t=>{const e=new Set;do{for(const n of Reflect.ownKeys(t))e.add([t,n])}while((t=Reflect.getPrototypeOf(t))&&t!==Object.prototype);return e})(t.constructor.prototype)){if("constructor"===n||!i(n))continue;const r=Reflect.getOwnPropertyDescriptor(e,n);r&&"function"==typeof r.value&&(t[n]=t[n].bind(t))}return t}function Za(t,e){t.getNodesAtTime(0)[0].once("nodestart",e)}class tl{constructor({position:t,gallery:e,config:n}){this.config=n,this.position=t,this.gallery=e,this.name=n.name;const{variantId:i,itemIndex:r,moduleIndex:o}=t;this.id=`${n.itemType}_${i}_${r}_${o}`,Ja(this)}#a=Ii(po(xo({})),"BaseModule.#state");#l=Ii(po(null),"BaseModule.#cover");#c=Ii(po(!1),"BaseModule.#showCover");#u=Ii(po(null),"BaseModule.#Component");id;player;position;config;timeline;moduleEndListener;hasDuration=!1;coverAssets=[];get state(){return Rs(this.#a)}set state(t){vo(this.#a,t,!0)}get cover(){return Rs(this.#l)}set cover(t){vo(this.#l,t)}get showCover(){return Rs(this.#c)}set showCover(t){vo(this.#c,t,!0)}get Component(){return Rs(this.#u)}set Component(t){vo(this.#u,t)}emitModuleEnd(){var t;null===(t=this.moduleEndListener)||void 0===t||t.call(this)}start(t){this.player=t}setPosition(){this.gallery.state.playingModulePosition=this.position}play(){this.gallery.track("moduleview"),Za(this.timeline,(()=>{this.setPosition()})),this.player.switchTimeline(this.timeline)}get duration(){return this.hasDuration?this.timeline.placements.reduce(((t,e)=>t+this.player.getNode(e.nodeId).duration),0):0}}const el="cmaf:";function nl(t,e,n){var i,r,o;const s=(null==e||null===(i=e.entity)||void 0===i?void 0:i.entityId)||(null==e?void 0:e.assetId),a=null!==(r=null==e||null===(o=e.entity)||void 0===o?void 0:o.entityRevision)&&void 0!==r?r:null==e?void 0:e.assetRevision,l=function(t){return t&&t.find((t=>t.startsWith(el)))?t.filter((t=>t.startsWith(el))):t}(null==e?void 0:e.availableEncodeProfiles);return n.addNode({id:t,manifestRef:{type:"assets-delivery-service",assetId:s,assetRevision:a,availableEncodeProfiles:l}})}var il=Hs('<h3 class="text-box-title svelte-wejicf"> </h3>'),rl=Hs('<span class="text-box-title svelte-wejicf"> </span>'),ol=Hs('<span class="text-box-description minimized-description svelte-wejicf"> </span>'),sl=Hs('<span class="read-more-cta svelte-wejicf" aria-hidden="true">Read more</span>'),al=Hs('<button class="expand-description-button svelte-wejicf" aria-expanded="false" aria-controls="expanded-text-content" aria-label="Expand feature description"><!> <!></button>'),ll=Hs('<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=Hs('<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(t,e){Di(e,!0),ba(t,ul);let n=Ha(e,"textBox",3,null),i=Ha(e,"isMobile",3,!1),r=po(!1),o=po(null),s=po(!1),a=no((()=>{var t;return(null===(t=n())||void 0===t?void 0:t.title)||""})),l=no((()=>{var t;return(null===(t=n())||void 0===t?void 0:t.description)||""})),c=no((()=>i()?16:18)),u=no((()=>i()?12:16));function d(){Rs(o)&&vo(s,Rs(o).scrollWidth>Rs(o).clientWidth||Rs(o).scrollHeight>Rs(o).clientHeight,!0)}Go((()=>{Rs(o)&&d()}));var h=Ks();js("resize",So,d);var f=Do(h),p=t=>{var n=cl(),d=Ro(n),h=Ro(d),f=Ro(h),p=t=>{var e=il(),n=Ro(e,!0);ki(e),Yo((()=>na(n,Rs(a)))),Xs(t,e)};ha(f,(t=>{i()&&t(p)}));var m=Lo(f,2),v=Ro(m,!0);ki(m),ki(h);var g=Lo(h,2),y=t=>{var n=al(),u=no((()=>e.gallery.interaction((()=>vo(r,!0)),{elementid:"textbox-expand",elementtype:"textbox",elementname:"Read more",interactiontype:"module-ui"})));n.__click=function(...t){var e;null===(e=Rs(u))||void 0===e||e.apply(this,t)};var d=Ro(n),h=t=>{var e=rl(),n=Ro(e,!0);ki(e),Yo((()=>na(n,Rs(a)))),Xs(t,e)},f=t=>{var e=ol(),n=Ro(e,!0);ki(e),Va(e,(t=>vo(o,t)),(()=>Rs(o))),Yo((()=>na(n,Rs(l)))),Xs(t,e)};ha(d,(t=>{i()&&Rs(a)?t(h):t(f,!1)}));var p=Lo(d,2),m=t=>{Xs(t,sl())};ha(p,(t=>{(i()||!i()&&Rs(s))&&t(m)})),ki(n),Yo((()=>Aa(n,`line-height: ${Rs(c)}px;`))),Xs(t,n)};ha(g,(t=>{Rs(r)||t(y)})),ki(d);var b=Lo(d,2),k=t=>{var n=ll(),o=no((()=>e.gallery.interaction((()=>vo(r,!1)))));n.__click=function(...t){var e;null===(e=Rs(o))||void 0===e||e.apply(this,t)},Yo((()=>Aa(n,`margin-bottom: ${!i()&&Rs(r)?"8px":"0px"};\n line-height: ${Rs(u)}px;`))),Xs(t,n)};ha(b,(t=>{Rs(r)&&t(k)})),ki(n),Yo((()=>{Ia(n,1,"step-description-container "+(Rs(r)?"expanded":""),"svelte-wejicf"),Aa(n,`padding: ${i()?"8px 16px":"16px 16px 64px 16px"};`),Aa(h,`line-height: ${Rs(c)}px;`),La(h,"hidden",!Rs(r)),na(v,Rs(l))})),Xs(t,n)};ha(f,(t=>{(Rs(a)||Rs(l))&&t(p)})),Xs(t,h),Li()}function hl(t,e){const n=no((()=>e.state.textBox));dl(t,{get textBox(){return Rs(n)},get isMobile(){return e.isMobile},get gallery(){return e.gallery}})}Us(["click"]);var fl=Hs('<div class="toggle-option-container svelte-16pmvvn"><button data-elementtype="toggle" data-interactiontype="module-ui"> </button></div>'),pl=Hs('<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(t,e){Di(e,!0),ba(t,ml);const n=no((()=>e.state.options)),i=no((()=>e.state.currentOptionIndex)),r=no((()=>e.state.onOptionClicked)),o=no((()=>e.state.textBox));var s=pl(),a=Do(s),l=Ro(a);ma(l,21,(()=>Rs(n)),fa,((t,n,o)=>{var s=fl();Aa(s,`--button-index: ${o};`);var a=Ro(s);let l;var c=no((()=>e.gallery.interaction((()=>Rs(r)(o)))));a.__click=function(...t){var e;null===(e=Rs(c))||void 0===e||e.apply(this,t)},La(a,"data-elementid",`${o+1}`);var u=Ro(a,!0);ki(a),ki(s),Yo((()=>{l=Ia(a,1,"toggle-option-button svelte-16pmvvn",null,l,{selected:Rs(i)===o}),La(a,"data-elementname",Rs(n).label),na(u,Rs(n).label)})),Xs(t,s)})),ki(l),ki(a);var c=Lo(a,2),u=t=>{dl(t,{get textBox(){return Rs(o)},get isMobile(){return e.isMobile},get gallery(){return e.gallery}})};ha(c,(t=>{Rs(o)&&t(u)})),Yo((()=>{var t;return Ia(l,1,`toggle-options selected-${null!==(t=Rs(i))&&void 0!==t?t:""}`,"svelte-16pmvvn")})),Xs(t,s),Li()}Us(["click"]);var gl=new WeakSet;function yl(t){var e,n;t!==this.state.currentOptionIndex&&(this.state.currentOptionIndex=t,this.state.textBox=this.config.options[t].textBox,this.cover=this.coverAssets[t],this.synced?this.switchTo(t):(this.timeline=null===(e=this.timelines)||void 0===e?void 0:e[t],this.showCover=!0,Za(this.timeline,(()=>{this.showCover=!1})),null===(n=this.player)||void 0===n||n.switchTimeline(this.timeline)))}const bl=(t,e,n)=>n>e?e:n<t?t:n;function kl(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let wl=()=>{},xl=()=>{};function _l(t){let e;return()=>(void 0===e&&(e=t()),e)}"undefined"!=typeof process&&"production"!==(null===(re=process.env)||void 0===re?void 0:re.NODE_ENV)&&(wl=(t,e,n)=>{t||"undefined"==typeof console||console.warn(kl(e,n))},xl=(t,e,n)=>{if(!t)throw new Error(kl(e,n))});const Tl=t=>t,El=t=>1e3*t,Il=t=>t/1e3;const Sl=t=>Array.isArray(t)&&"number"==typeof t[0],Al=(t,e,n=10)=>{let i="";const r=Math.max(Math.round(e/n),2);for(let e=0;e<r;e++)i+=Math.round(1e4*t(e/(r-1)))/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},Nl=2e4;function Ml(t){let e=0;let n=t.next(e);for(;!n.done&&e<Nl;)e+=50,n=t.next(e);return e>=Nl?1/0:e}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:t=Cl.duration,bounce:e=Cl.bounce,velocity:n=Cl.velocity,mass:i=Cl.mass}){let r,o;wl(t<=El(Cl.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let s=1-e;s=bl(Cl.minDamping,Cl.maxDamping,s),t=bl(Cl.minDuration,Cl.maxDuration,Il(t)),s<1?(r=e=>{const i=e*s,r=i*t,o=i-n,a=Dl(e,s),l=Math.exp(-r);return Ol-o/a*l},o=e=>{const i=e*s*t,o=i*n+n,a=Math.pow(s,2)*Math.pow(e,2)*t,l=Math.exp(-i),c=Dl(Math.pow(e,2),s);return(-r(e)+Ol>0?-1:1)*((o-a)*l)/c}):(r=e=>Math.exp(-e*t)*((e-n)*t+1)-Ol,o=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let i=n;for(let n=1;n<Rl;n++)i-=t(i)/e(i);return i}(r,o,5/t);if(t=El(t),isNaN(a))return{stiffness:Cl.stiffness,damping:Cl.damping,duration:t};{const e=Math.pow(a,2)*i;return{stiffness:e,damping:2*s*Math.sqrt(i*e),duration:t}}}const Rl=12;function Dl(t,e){return t*Math.sqrt(1-e*e)}const Ll=["duration","bounce"],Bl=["stiffness","damping","mass"];function zl(t,e){return e.some((e=>void 0!==t[e]))}function Wl(t=Cl.visualDuration,e=Cl.bounce){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;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(t){let e={velocity:Cl.velocity,stiffness:Cl.stiffness,damping:Cl.damping,mass:Cl.mass,isResolvedFromDuration:!1,...t};if(!zl(t,Bl)&&zl(t,Ll))if(t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(1.2*n),r=i*i,o=2*bl(.05,1,1-(t.bounce||0))*Math.sqrt(r);e={...e,mass:Cl.mass,stiffness:r,damping:o}}else{const n=Pl(t);e={...e,...n,mass:Cl.mass},e.isResolvedFromDuration=!0}return e}({...n,velocity:-Il(n.velocity||0)}),p=h||0,m=c/(2*Math.sqrt(l*u)),v=s-o,g=Il(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 t=Dl(g,m);b=e=>{const n=Math.exp(-m*g*e);return s-n*((p+m*g*v)/t*Math.sin(t*e)+v*Math.cos(t*e))}}else if(1===m)b=t=>s-Math.exp(-g*t)*(v+(p+g*v)*t);else{const t=g*Math.sqrt(m*m-1);b=e=>{const n=Math.exp(-m*g*e),i=Math.min(t*e,300);return s-n*((p+m*g*v)*Math.sinh(i)+t*v*Math.cosh(i))/t}}const k={calculatedDuration:f&&d||null,next:t=>{const e=b(t);if(f)a.done=t>=d;else{let n=0===t?p:0;m<1&&(n=0===t?El(p):function(t,e,n){const i=Math.max(e-Fl,0);return r=n-t(i),(o=e-i)?r*(1e3/o):0;var r,o}(b,t,e));const o=Math.abs(n)<=i,l=Math.abs(s-e)<=r;a.done=o&&l}return a.value=a.done?s:e,a},toString:()=>{const t=Math.min(Ml(k),Nl),e=Al((e=>k.next(t*e).value),t,30);return t+"ms "+e},toTransition:()=>{}};return k}Wl.applyToOptions=t=>{const e=function(t,e=100,n){const i=n({...t,keyframes:[0,e]}),r=Math.min(Ml(i),Nl);return{type:"keyframes",ease:t=>i.next(r*t).value/e,duration:Il(r)}}(t,100,Wl);return t.ease=e.ease,t.duration=El(e.duration),t.type="keyframes",t};const $l=t=>null!==t;class jl{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise((t=>{this.resolve=t}))}notifyFinished(){this.resolve()}then(t,e){return this.finished.then(t,e)}}function Ul(t){for(let n=1;n<t.length;n++){var e;null!==(e=t[n])&&void 0!==e||(t[n]=t[n-1])}}const ql=t=>t.startsWith("--");const Vl=_l((()=>void 0!==window.ScrollTimeline)),Gl={};function Hl(t,e){const n=_l(t);return()=>{var t;return null!==(t=Gl[e])&&void 0!==t?t:n()}}const Kl=Hl((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing"),Xl=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${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(t,e){return t?"function"==typeof t?Kl()?Al(t,e):"ease-out":Sl(t)?Xl(t):Array.isArray(t)?t.map((t=>Ql(t,e)||Yl.easeOut)):Yl[t]:void 0}function Jl(t,e,n,{delay:i=0,duration:r=300,repeat:o=0,repeatType:s="loop",ease:a="easeOut",times:l}={},c=void 0){const u={[e]: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 t.animate(u,h)}class Zl extends jl{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:e,name:n,keyframes:i,pseudoElement:r,allowFlatten:o=!1,finalKeyframe:s,onComplete:a}=t;this.isPseudoElement=Boolean(r),this.allowFlatten=o,this.options=t,xl("string"!=typeof t.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:t,...e}){return function(t){return"function"==typeof t&&"applyToOptions"in t}(t)&&Kl()?t.applyToOptions(e):(null!==(n=e.duration)&&void 0!==n||(e.duration=300),null!==(i=e.ease)&&void 0!==i||(e.ease="easeOut"),e);var n,i}(t);this.animation=Jl(e,n,i,l,r),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!r){const t=function(t,{repeat:e,repeatType:n="loop"},i,r=1){const o=t.filter($l),s=r<0||e&&"loop"!==n&&e%2==1?0:o.length-1;return s&&void 0!==i?i:o[s]}(i,this.options,s,this.speed);this.updateMotionValue?this.updateMotionValue(t):function(t,e,n){ql(e)?t.style.setProperty(e,n):t.style[e]=n}(e,n,t),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 t,e;null===(t=(e=this.animation).finish)||void 0===t||t.call(e)}cancel(){try{this.animation.cancel()}catch(t){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;"idle"!==t&&"finished"!==t&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var t,e;this.isPseudoElement||(null===(t=(e=this.animation).commitStyles)||void 0===t||t.call(e))}get duration(){var t,e;const n=(null===(t=this.animation.effect)||void 0===t||null===(e=t.getComputedTiming)||void 0===e?void 0:e.call(t).duration)||0;return Il(Number(n))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Il(t)}get time(){return Il(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=El(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){var t;return null!==(t=this.manualStartTime)&&void 0!==t?t:Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,observe:e}){var n;this.allowFlatten&&(null===(n=this.animation.effect)||void 0===n||n.updateTiming({easing:"linear"}));return this.animation.onfinish=null,t&&Vl()?(this.animation.timeline=t,Tl):e(this)}}class tc{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map((t=>t.finished)))}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t){const e=this.animations.map((e=>e.attachTimeline(t)));return()=>{e.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return ec(this.animations,"duration")}get iterationDuration(){return ec(this.animations,"iterationDuration")}runAll(t){this.animations.forEach((e=>e[t]()))}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function ec(t,e){let n=0;for(let i=0;i<t.length;i++){const r=t[i][e];null!==r&&r>n&&(n=r)}return n}class nc extends tc{then(t,e){return this.finished.finally(t).then((()=>{}))}}const ic=new WeakMap,rc=(t,e="")=>`${t}:${e}`;function oc(t){const e=ic.get(t)||new Map;return ic.set(t,e),e}function sc(t,e){var n,i;return null!==(n=null!==(i=null==t?void 0:t[e])&&void 0!==i?i:null==t?void 0:t.default)&&void 0!==n?n:t}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(t,e){for(let n=0;n<t.length;n++)"number"==typeof t[n]&&ac.has(e)&&(t[n]=t[n]+"px")}function cc(t,e){const n=window.getComputedStyle(t);return ql(e)?n.getPropertyValue(e):n[e]}function uc(t,e,n,i){if(null==t)return[];const r=function(t){if(null==t)return[];if(t instanceof EventTarget)return[t];if("string"==typeof t){const e=document.querySelectorAll(t);return e?Array.from(e):[]}return Array.from(t).filter((t=>null!=t))}(t),o=r.length;xl(Boolean(o),"No valid elements provided.","no-valid-elements");const s=[];for(let t=0;t<o;t++){const i=r[t],a={...n};"function"==typeof a.delay&&(a.delay=a.delay(t,o));for(const t in e){let n=e[t];Array.isArray(n)||(n=[n]);const r={...sc(a,t)};r.duration&&(r.duration=El(r.duration)),r.delay&&(r.delay=El(r.delay));const o=oc(i),l=rc(t,r.pseudoElement||""),c=o.get(l);c&&c.stop(),s.push({map:o,key:l,unresolvedKeyframes:n,options:{...r,element:i,name:t,allowFlatten:!a.type&&!a.ease}})}}for(let t=0;t<s.length;t++){const{unresolvedKeyframes:e,options:n}=s[t],{element:i,name:r,pseudoElement:o}=n;o||null!==e[0]||(e[0]=cc(i,r)),Ul(e),lc(e,r),!o&&e.length<2&&e.unshift(cc(i,r)),n.keyframes=e}const a=[];for(let t=0;t<s.length;t++){const{map:e,key:n,options:i}=s[t],r=new Zl(i);e.set(n,r),r.finished.finally((()=>e.delete(n))),a.push(r)}return a}const dc=(()=>function(t,e,n){return new nc(uc(t,e,n))})();var hc=Hs('<button class="svelte-16kucsb"><div class="svelte-16kucsb"> </div></button>'),fc=Hs('<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(t,e){Di(e,!0),ba(t,pc);const n=no((()=>e.state.ctaText)),i=no((()=>e.state.animationConfig)),r=no((()=>e.state.showCta)),o=no((()=>e.state.onCtaClick));let s=null,a=null,l=po(!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})}Go((()=>{const{mass:t,stiffness:e,damping:n,delay:o}=Rs(i);let u;return Rs(r)&&(u=setTimeout((async()=>{vo(l,!0),u=null,dc(s,{transform:["translateY(40px) scale(0, 0.2)","translateY(0) scale(1, 1)"],opacity:1},{type:Wl,mass:t,stiffness:e,damping:n}),await dc(a,{transform:["translateY(20px) scale(0.8)","translateY(0) scale(1)"],opacity:1},{type:Wl,mass:t,stiffness:e,damping:n,delay:.15}),c=!0}),o)),()=>{u&&clearTimeout(u)}}));var f=fc(),p=Ro(f),m=t=>{var e=hc();e.__mousedown=h,e.__touchstart=h,e.__click=function(...t){var e;null===(e=Rs(o))||void 0===e||e.apply(this,t)};var i=Ro(e),r=Ro(i,!0);ki(i),Va(i,(t=>a=t),(()=>a)),ki(e),Va(e,(t=>s=t),(()=>s)),Yo((()=>{Aa(e,"pointer-events: "+(Rs(l)?"auto":"none")),na(r,Rs(n))})),js("mouseenter",e,u),js("mouseleave",e,d),Xs(t,e)};ha(p,(t=>{Rs(r)&&t(m)})),ki(f),Xs(t,f),Li()}Us(["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:t,...e}){var n;super({...e,config:t}),this.Component=hl,this.hasDuration=!t.loop,Ja(this),this.coverAssets.push(null!==(n=t.intro)&&void 0!==n?n:t.video),this.cover=this.coverAssets[0],this.state={textBox:t.textBox}}start(t){super.start(t),this.timeline=t.createTimeline();const e=this.config;e.intro&&this.timeline.placeOnTimeline(nl(`${this.id}_intro`,e.intro,t),"end");const n=nl(this.id,e.video,t);this.timeline.placeOnTimeline(n,"end",{loop:e.loop}),e.loop||n.on("nodeend",this.emitModuleEnd)}},toggleModule:class extends tl{constructor({config:t,...e}){super({...e,config:t}),O(this,gl),this.Component=vl,this.synced=t.sync,this.switchTo=()=>{},Ja(this),this.coverAssets=t.options.map((t=>{var e;return null!==(e=t.intro)&&void 0!==e?e:t.video})),this.cover=this.coverAssets[0],this.state={options:t.options.map((t=>({label:t.label,note:t.note}))),currentOptionIndex:0,onOptionClicked:A(gl,this,yl).bind(this),textBox:t.options[0].textBox}}start(t){super.start(t),this.synced?(this.timeline=t.createTimeline(),this.config.options.forEach(((e,n)=>{this.timeline.placeOnTimeline(nl(`${this.id}_option_${n}`,e.video,t),0,{loop:!0})})),this.timeline.placeRenderNodeOnTimeline("switch",0,1/0,{params:{switchCrossfadeSeconds:.25,initSwitching:({switchTo:t})=>{this.switchTo=t,t(this.state.currentOptionIndex,{crossfadeSeconds:0})}}})):(this.timelines=this.config.options.map(((e,n)=>{const i=t.createTimeline();return e.intro&&i.placeOnTimeline(nl(`${this.id}_option_${n}_intro`,e.intro,t),"end"),i.placeOnTimeline(nl(`${this.id}_option_${n}`,e.video,t),"end",{loop:!0}),i})),this.timeline=this.timelines[this.state.currentOptionIndex])}},tryItModule:class extends tl{constructor({config:t,...e}){var n;super({...e,config:t}),O(this,vc),Ja(this);const{introVideo:i}=t;this.coverAssets.push(null!==(n=i.intro)&&void 0!==n?n:i.loop),this.cover=this.coverAssets[0],this.state={ctaText:t.ctaText,animationConfig:t.animationConfig,showCta:!0,onCtaClick:A(vc,this,gc).bind(this)}}start(t){super.start(t),this.Component=mc,this.timeline=t.createTimeline();const{introVideo:e,mainVideo:n}=this.config;if(e.intro&&this.timeline.placeOnTimeline(nl(`${this.id}_intro_intro`,e.intro,t)),this.timeline.placeOnTimeline(nl(`${this.id}_intro_loop`,e.loop,t),"end",{loop:!0}),n){this.mainTimeline=t.createTimeline(),n.intro&&this.mainTimeline.placeOnTimeline(nl(`${this.id}_main_intro`,n.intro,t));const e=nl(`${this.id}_main_loop`,n.loop,t);this.mainTimeline.placeOnTimeline(e,"end",{loop:!0})}}play(){this.state.showCta=!0,super.play()}}};class bc{#d=Ii(po({}),"GalleryState.#variants");#h=Ii(po("ekonovar"),"GalleryState.#activeVariant");#f=Ii(po(0),"GalleryState.#activeItemIndex");#p=Ii(po(0),"GalleryState.#activeModuleIndex");#m=Ii(po(xo({itemIndex:0,moduleIndex:0})),"GalleryState.#playingModulePosition");#v=Ii(no((()=>{var t;return null===(t=Rs(this.#d))||void 0===t?void 0:t[Rs(this.#h)]})),"GalleryState.#currentItemsList");#g=Ii(no((()=>{var t;return null===(t=Rs(this.#v))||void 0===t?void 0:t[Rs(this.#f)]})),"GalleryState.#currentItem");#y=Ii(no((()=>{var t,e;return Rs(this.#b)?null===(e=Rs(this.#v))||void 0===e?void 0:e[Rs(this.#m).itemIndex].modules[Rs(this.#m).moduleIndex]:null===(t=Rs(this.#g))||void 0===t?void 0:t.modules[Rs(this.#p)]})),"GalleryState.#currentModule");#k=Ii(no((()=>{var t;return(null===(t=Rs(this.#v))||void 0===t?void 0:t.flatMap((t=>t.modules)))||[]})),"GalleryState.#currentModulesList");#w=Ii(po(!1),"GalleryState.#playerLoaded");#x=Ii(po(!1),"GalleryState.#paused");#b=Ii(po(!1),"GalleryState.#startedPlaying");#_=Ii(no((()=>!(Io(Rs(this.#m).itemIndex,this.activeItemIndex)&&Io(Rs(this.#m).moduleIndex,this.activeModuleIndex)))),"GalleryState.#seeking");set variants(t){vo(this.#d,t)}set activeVariant(t){vo(this.#h,t,!0)}set activeItemIndex(t){vo(this.#f,t,!0)}set activeModuleIndex(t){vo(this.#p,t,!0)}set playingModulePosition(t){vo(this.#m,t,!0)}set playerLoaded(t){vo(this.#w,t,!0)}set paused(t){vo(this.#x,t,!0)}set startedPlaying(t){vo(this.#b,t,!0)}get variants(){return Rs(this.#d)}get activeVariant(){return Rs(this.#h)}get activeItemIndex(){return Rs(this.#f)}get activeModuleIndex(){return Rs(this.#p)}get playingModulePosition(){return Rs(this.#m)}get currentItemsList(){return Rs(this.#v)}get currentItem(){return Rs(this.#g)}get currentModule(){return Rs(this.#y)}get playerLoaded(){return Rs(this.#w)}get paused(){return Rs(this.#x)}get startedPlaying(){return Rs(this.#b)}get seeking(){return Rs(this.#_)}get currentModulesList(){return Rs(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 Ec=new WeakMap,Ic=new WeakMap,Sc=new WeakMap,Ac=new WeakMap,Nc=new WeakMap,Mc=new WeakMap,Fc=new WeakSet;class Cc{constructor(t){var e,n,i,r,o;O(this,Fc),F(this,Ec,void 0),F(this,Ic,void 0),F(this,Sc,void 0),F(this,Ac,void 0),F(this,Nc,void 0),F(this,Mc,void 0),P(this,"public",void 0),P(this,"version","0.0.16"),Ja(this),C(Ec,this,(null===(e=crypto)||void 0===e||null===(n=e.randomUUID)||void 0===n?void 0:n.call(e))||`eko-gallery-${Date.now()}`),C(Ac,this,t),C(Mc,this,(null==t?void 0:t.onEvent)||(()=>{})),C(Ic,this,new bc(null==t||null===(i=t.options)||void 0===i?void 0:i.galleryEnv)),C(Nc,this,((t="")=>(Io(t,"production")&&(t=""),Object.fromEntries(Object.entries(kc).map((([e,n])=>[e,n.replaceAll("{{env}}",t)])))))(null==t||null===(r=t.options)||void 0===r?void 0:r.galleryEnv)),C(Sc,this,[]);const s=null==t||null===(o=t.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((t=>Io(t.blockType,"GalleryBlock"))))||void 0===o?void 0:o.config;var a;s?(A(Fc,this,Oc).call(this,s.items),A(Fc,this,Pc).call(this,s.items),function(t,e){function n(e){window.EkoAnalytics("registerContextPacker",{tag:t,...e})}function i(e){return function(...n){return n.pop()!==t?null:e(...n)}}"undefined"!=typeof window&&window.EkoAnalytics&&(n({schema:"iglu:com.helloeko/gallery-app/jsonschema/1-0-0",match:/.*/,getData:i((()=>{var t,n,i,r,o;const s=null===(t=e.currentItem)||void 0===t?void 0:t.modules[e.activeModuleIndex];return{itemid:(null===(n=e.currentItem)||void 0===n?void 0:n.id)||"",itemindex:e.activeItemIndex,totalitems:(null===(i=e.currentItemsList)||void 0===i?void 0:i.length)||0,itemname:(null===(r=e.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:e.activeModuleIndex,totalmodules:(null===(o=e.currentItem)||void 0===o?void 0:o.modules.length)||0,version:"0.0.16"}}))}),n({schema:"iglu:com.helloeko/implementation_interactions/jsonschema/1-0-6",match:"interaction",getData:i((t=>t))}))}(M(Ec,this),M(Ic,this))):console.warn("[eko-gallery-app] Gallery initiated without an instance, results will be empty"),this.public=(a=this,Tc.reduce(((t,e)=>{if(!(e in a))throw new Error(`[eko-gallery-app] Public API member "${e}" does not exist on GalleryLogic`);const n=a[e];return t[e]=Io(typeof n,"function")?n.bind(a):n,t}),{}))}dispose(){var t,e;Io(typeof window,"undefined",!1)&&(null===(t=(e=window).EkoAnalytics)||void 0===t||t.call(e,"reset",M(Ec,this)))}start(t){M(Ic,this).playerLoaded=!0,M(Sc,this).forEach((e=>{e.start(t)})),C(Sc,this,null),A(Fc,this,Rc).call(this,t),M(Ic,this).currentModule.play()}selectItem(t){const e=M(Ic,this);Io(t,e.activeItemIndex)||(e.activeItemIndex=t,e.activeModuleIndex=0)}selectItemAndStep(t,e){const n=M(Ic,this);Io(t,n.activeItemIndex)&&Io(e,n.activeModuleIndex)||(n.activeItemIndex=t,n.activeModuleIndex=e)}next(){A(Fc,this,Lc).call(this)}prev(){const t=M(Ic,this);if(t.activeModuleIndex=t.activeModuleIndex-1,!t.currentItem.modules[t.activeModuleIndex])if(t.currentItemsList[t.activeItemIndex-1]){t.activeItemIndex=t.activeItemIndex-1;const e=t.currentItemsList[t.activeItemIndex];t.activeModuleIndex=e.modules.length-1}else t.activeModuleIndex=t.activeModuleIndex+1}subscribe(t){const e=M(Ic,this);return function(t){fr.ensure();const e=Uo(Bn|Yn,t,!0);return()=>{ns(e)}}((()=>{Go((()=>{const n=_c.reduce(((t,n)=>(t[n]=e[n],t)),{});t(n)}))}))}getCoverUrl(t,e){var n,i,r,o;const s=(null==t||null===(n=t.entity)||void 0===n?void 0:n.entityId)||(null==t?void 0:t.assetId),a=null!==(i=null==t||null===(r=t.entity)||void 0===r?void 0:r.entityRevision)&&void 0!==i?i:null==t?void 0:t.assetRevision;if(!s)throw new Error(`[getCoverUrl] No assetId found in assetConfig: ${JSON.stringify(t||{},null,2)}`);if(!a&&Io(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)&&e&&(l.pathname=l.pathname.replace(".png",".webp"))):(l=new URL(`${M(Nc,this).assetsDeliveryBase}/image/${s}/${a}?startOffset=0`),l.pathname+=e?".webp":".png"),e&&l.searchParams.set("width",e),l.href}track(t,...e){var n,i;Io(typeof window,"undefined",!1)&&(null===(n=(i=window).EkoAnalytics)||void 0===n||n.call(i,"track",t,...e,M(Ec,this)))}interaction(t,e){const n=M(Ec,this);return i=>{if(Io(typeof window,"undefined",!1)){var r,o,s,a;const t=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&&(Io(i.detail.direction,"left")?l="swipe_next":Io(i.detail.direction,"right")&&(l="swipe_prev"));const c={elementid:(null==t?void 0:t.elementid)||(null==e?void 0:e.elementid)||"",elementtype:(null==t?void 0:t.elementtype)||(null==e?void 0:e.elementtype)||"",elementname:(null==t?void 0:t.elementname)||(null==e?void 0:e.elementname)||"",interactiontype:l||(null==t?void 0:t.interactiontype)||(null==e?void 0:e.interactiontype)||""};null===(s=(a=window).EkoAnalytics)||void 0===s||s.call(a,"track","interaction",c,n),M(Mc,this).call(this,"interaction",c)}t(i)}}get uuid(){return M(Ec,this)}get state(){return M(Ic,this)}get urls(){return M(Nc,this)}}function Oc(t){const e={};for(let n of t)for(let t of Object.keys(n.variants||{}))e[t]=[];e.ekonovar=[],M(Ic,this).variants=e}function Pc(t){const e=(t=[],e)=>{const n=[];for(let[i,r]of t.entries()){if(!yc[r.itemType])throw new Error(`Unknown module type ${r.itemType}`);const t=new yc[r.itemType]({position:{...e,moduleIndex:i},config:r,gallery:this});t.moduleEndListener=A(Fc,this,Dc).bind(this),n.push(t)}return n};for(const[i,r]of t.entries())if(Io(r.itemType,"galleryItemV2")){const{modules:t,...o}=r;for(const[s,a]of Object.entries(M(Ic,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=e(t,{variantId:s,itemIndex:i}),C(Sc,this,[...M(Sc,this),...n.modules]),a.push(n)}}}}function Rc(t){for(const[,e]of Object.entries(M(Ic,this).variants))for(const[n,i]of e.entries()){const r=i.modules,o=e.filter((t=>Io(t,i,!1))).map((t=>t.modules[0]));for(const[i,s]of r.entries()){let a=r[i+1];a||(a=e[(n+1)%e.length].modules[0]);const l=a.timeline.getNodesAtTime(0)[0],c=o.filter((t=>Io(t,a,!1))).map((t=>t.timeline.getNodesAtTime(0)[0])),u=[{nodeId:l.id,weight:wc},...c.map((t=>({nodeId:t.id,weight:xc})))];for(const e of s.timeline.placements){t.getNode(e.nodeId).setChildren(u)}}}}function Dc(){const t=M(Ic,this),e=t.currentItem.modules;e.length>1&&Io(t.activeModuleIndex,e.length-1)?t.activeModuleIndex=0:A(Fc,this,Lc).call(this)}function Lc(){const t=M(Ic,this);t.activeModuleIndex=t.activeModuleIndex+1,t.currentItem.modules[t.activeModuleIndex]||(t.currentItemsList[t.activeItemIndex+1]?(t.activeItemIndex=t.activeItemIndex+1,t.activeModuleIndex=0):t.activeModuleIndex=t.activeModuleIndex-1)}var Bc=Hs('<button><span class="svelte-er27y2"> </span></button>'),zc=Hs('<div class="nav-buttons-container svelte-er27y2"><div class="nav-buttons svelte-er27y2"></div></div>');const Wc={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);}"};Us(["click"]);const $c="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 jc=Hs('<button><img class="svelte-1al44kl"/></button>');const Uc={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 qc(t,e){ba(t,Uc);const n=Ha(e,"hidden",3,!1);var i=jc();let r;i.__click=function(...t){var n;null===(n=e.onClick)||void 0===n||n.apply(this,t)};var o=Ro(i);ki(i),Yo((()=>{var t;r=Ia(i,1,`nav-button ${null!==(t=e.type)&&void 0!==t?t:""}`,"svelte-1al44kl",r,{hidden:n()}),La(i,"aria-label",e.type),La(o,"src",$c),La(o,"alt",e.type)})),Xs(t,i)}Us(["click"]);var Vc=Hs('<button data-elementtype="step-indicator" data-interactiontype="navigation"><span class="svelte-1mxltt0"> </span></button>'),Gc=Hs('<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 Hc={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 Kc(t,e){Di(e,!0),ba(t,Hc);const n=16,i=32;let r=Ha(e,"gallery",7),o=po(null),s=po(null),a=po(!1),l=po(!1);const c=no((()=>{let t=[];return t=r().state.currentItem.modules.map(((t,e)=>({index:e,type:e===r().state.activeModuleIndex?"active":"",name:t.name}))),t}));function u(){Rs(o)&&(vo(a,Rs(o).scrollLeft>0),vo(l,Rs(o).scrollLeft+Rs(o).clientWidth<Rs(o).scrollWidth-0))}function d(t){Rs(o).scrollBy({left:t,behavior:"smooth"})}function h(t,e){const r=t.getBoundingClientRect(),o=e.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 t=Array.from(Rs(o).querySelectorAll(".step-button")).find((t=>{const e=t.getBoundingClientRect(),n=Rs(o).getBoundingClientRect();return e.left>n.left+i}));if(t){const e=t.previousElementSibling;e&&h(Rs(o),e)}}function p(){const t=Array.from(Rs(o).querySelectorAll(".step-button")).reverse().find((t=>{const e=t.getBoundingClientRect(),n=Rs(o).getBoundingClientRect();return e.right<n.right-i}));if(t){const e=t.nextElementSibling;e&&h(Rs(o),e)}}Go((()=>{if(Rs(o)){u();const t=Rs(o).querySelector(".step-button.active");t&&vo(s,t,!0);const e=new MutationObserver((()=>{const t=Rs(o).querySelector(".step-button.active");t&&vo(s,t,!0)}));e.observe(Rs(o),{attributes:!0,attributeFilter:["class"],subtree:!0});const n=new ResizeObserver((()=>{u()}));return n.observe(Rs(o)),()=>{e.disconnect(),n.disconnect()}}})),Go((()=>{Rs(c),Rs(o)&&Ps().then(u)})),Go((()=>{Rs(s)&&Rs(o)&&h(Rs(o),Rs(s))}));var m=Ks();js("resize",So,u),function(t,e,n){vi&&bi();var i=new ca(t);Qo((()=>{var t=e();i.ensure(t,n)}))}(Do(m),(()=>r().state.activeItemIndex),(t=>{var e=Gc(),n=Ro(e);let i;n.__click=f;var s=Lo(n,2);let d;ma(s,21,(()=>Rs(c)),fa,((t,e)=>{var n=Vc();let i;var s=no((()=>r().interaction((t=>{return n=t.currentTarget,i=Rs(e).index,r().state.activeModuleIndex=i,void h(Rs(o),n);var n,i}))));n.__click=function(...t){var e;null===(e=Rs(s))||void 0===e||e.apply(this,t)};var a=Ro(n),l=Ro(a,!0);ki(a),ki(n),Yo((()=>{i=Ia(n,1,"step-button svelte-1mxltt0",null,i,{active:"active"===Rs(e).type}),La(n,"aria-label",`Go to step $${Rs(e).index+1}`),La(n,"data-elementid",`${Rs(e).index+1}`),La(n,"data-elementname",Rs(e).name),na(l,Rs(e).name)})),Xs(t,n)})),ki(s),Va(s,(t=>vo(o,t)),(()=>Rs(o)));var m=Lo(s,2);let v;m.__click=p,ki(e),Yo((()=>{var t;i=Ia(n,1,"step-arrow step-arrow-prev svelte-1mxltt0",null,i,{visible:Rs(a)}),d=Ia(s,1,"steps-indicator svelte-1mxltt0",null,d,{"with-duration":r().state.currentModule.hasDuration,paused:r().state.paused,"fade-left":Rs(a),"fade-right":Rs(l)}),Aa(s,`--stepDuration: ${null!==(t=r().state.currentModule.duration)&&void 0!==t?t:""}s`),v=Ia(m,1,"step-arrow step-arrow-next svelte-1mxltt0",null,v,{visible:Rs(l)})})),js("scroll",s,u),Xs(t,e)})),Xs(t,m),Li()}Us(["click"]);const 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='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",Yc="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 Qc=Hs('<img alt="Play" class="svelte-a3r6re"/>'),Jc=Hs('<img alt="Pause" class="svelte-a3r6re"/>'),Zc=Hs('<button class="pause-button svelte-a3r6re" data-elementid="play_pause" data-elementtype="button"><!></button>');const tu={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;}"};Us(["click"]);const eu=300,nu=60,iu="none";function ru(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}function ou(t,e,n){const{x:i,y:r}=function(t,e){const n=t.getBoundingClientRect();return{x:Math.round(e.clientX-n.left),y:Math.round(e.clientY-n.top)}}(t,e);return{event:e,pointersCount:n.length,target:e.target,x:i,y:r,attachmentNode:t}}function su(t,e,n,i,r){const o=ou(t,n,i);return t.dispatchEvent(new CustomEvent(`${e}${r}`,{detail:o})),o}function au(){let t=[],e=()=>{},n=[];return{setPointerControls:(i,r,o,s,a,l=iu,c=[])=>{var u;if(r.style.touchAction=(u=l,Array.isArray(u)?u:[u]).join(" "),n=c,n.forEach((e=>{var n;null===(n=e.onInit)||void 0===n||n.call(e,t)})),!t.length){let l=function(e){t.push(e);const l=su(r,i,e,t,"down");function c(e){const o=t.length;t=function(t,e){return e.filter((e=>Io(t.pointerId,e.pointerId,!1)))}(e,t);if(o>t.length){t.length||(u(),d(),h(),f());const o=su(r,i,e,t,"up");null==a||a(t,e),setTimeout((()=>{n.forEach((e=>{var n;null===(n=e.onUp)||void 0===n||n.call(e,o,t)}))}))}}null==s||s(t,e),setTimeout((()=>{n.forEach((e=>{var n;null===(n=e.onDown)||void 0===n||n.call(e,l,t)}))}));const u=ru(r,"pointermove",(e=>{t=t.map((t=>Io(e.pointerId,t.pointerId)?e:t));const s=su(r,i,e,t,"move");null==o||o(t,e),n.forEach((e=>{var n;null===(n=e.onMove)||void 0===n||n.call(e,s,t)}))})),d=ru(r,"lostpointercapture",(t=>{c(t)})),h=ru(r,"pointerup",(t=>{c(t)})),f=ru(r,"pointerleave",(t=>{c(t)}))};e=ru(r,"pointerdown",l)}return{destroy:()=>{t.length||(e(),n.forEach((t=>{var e;null===(e=t.onDestroy)||void 0===e||e.call(t)})))}}}}}const lu="@attach";function cu(){return Symbol(lu)}const uu="swipe";function du(t,e,n,i=!1){const{setPointerControls:r}=au(),o=i?uu:cu();return{...n,[`on${uu}`]:t,[o]:t=>{const{onDown:n,onUp:i,parameters:o}=function(t,e){const n={timeframe:eu,minSwipeDistance:nu,touchAction:iu,composed:!1,...e};let i,r,o,s;function a(t,e){r=e.clientX,o=e.clientY,i=Date.now(),Io(t.length,1)&&(s=e.target)}function l(e,a){if(Io(a.type,"pointerup")&&Io(e.length,0)&&Date.now()-i<n.timeframe){const e=a.clientX-r,i=a.clientY-o,l=Math.abs(e),c=Math.abs(i);let u=null;l>=2*c&&l>n.minSwipeDistance?u=e>0?"right":"left":c>=2*l&&c>n.minSwipeDistance&&(u=i>0?"bottom":"top"),u&&t.dispatchEvent(new CustomEvent(uu,{detail:{direction:u,target:s,pointerType:a.pointerType}}))}}return{onDown:a,onUp:l,parameters:n}}(t,null==e?void 0:e());return r(uu,t,null,n,i,o.touchAction,o.plugins).destroy}}}const hu="tap";function fu(t,e,n,i=!1){const{setPointerControls:r}=au(),o=i?hu:cu();return{...n,[`on${hu}`]:t,[o]:t=>{const{onDown:n,onUp:i,parameters:o}=function(t,e){const n={timeframe:eu,composed:!1,touchAction:"auto",...e};let i,r,o;function s(e,s){if(Math.abs(s.clientX-r)<4&&Math.abs(s.clientY-o)<4&&Date.now()-i<n.timeframe){const e=t.getBoundingClientRect(),n=Math.round(s.clientX-e.left),i=Math.round(s.clientY-e.top);t.dispatchEvent(new CustomEvent(hu,{detail:{x:n,y:i,target:s.target,pointerType:s.pointerType}}))}}function a(t,e){r=e.clientX,o=e.clientY,i=Date.now()}return{onDown:a,onUp:s,parameters:n}}(t,null==e?void 0:e());return r(hu,t,null,n,i,o.touchAction,o.plugins).destroy}}}const pu=t=>{const e="#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 e=t.fadeTime,n=Date.now(),i=n-c;i>e/20&&(a&&o&&s&&r&&(s.drawImage(r,0,0),a.clearRect(0,0,r.width,r.height),a.globalAlpha=1-3*i/e,a.drawImage(o,0,0),a.globalAlpha=1,s.clearRect(0,0,r.width,r.height)),c=n),l&&requestAnimationFrame(d)}function h(t){u.x=t.x,u.y=t.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(e){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=t.zIndex)&&void 0!==i?i:n};\n`,window.document.body.appendChild(r),window.addEventListener("resize",f),e&&h(e.event),o=document.createElement("canvas"),f(),s=o.getContext("2d"),l=!0,d()}function m(){var t;l=!1,null===(t=window.document.getElementById("svelte-gestures-highlight-plugin"))||void 0===t||t.remove(),window.removeEventListener("resize",f)}return{onMove:n=>{var r,o,s;r=n.event,a&&(a.beginPath(),a.lineWidth=null!==(o=t.lineWidth)&&void 0!==o?o:i,a.lineCap="round",a.strokeStyle=null!==(s=t.color)&&void 0!==s?s:e,Io(u.x,void 0,!1)&&Io(u.y,void 0,!1)?(a.moveTo(u.x,u.y),h(r),a.lineTo(u.x,u.y)):h(r),a.stroke())},onDown:t=>{p(t)},onUp:(t,e)=>{Io(e.length,0)&&m()},onDestroy:m,onInit:t=>{t.length&&(u.x=void 0,u.y=void 0,p())}}};var mu=Hs("<div></div>"),vu=Hs("<div></div>");const gu={hash:"svelte-1fv6njc",code:".swiper.svelte-1fv6njc {position:absolute;top:0;left:0;pointer-events:auto;width:100%;height:100%;}"};var yu=Hs("<img/>"),bu=Hs('<div class="ui-container svelte-1rvgxfc"><!></div>'),ku=Hs('<div class="cover-container svelte-1rvgxfc"><!> <!> <!></div>'),wu=Hs('<div class="covers-container svelte-1rvgxfc" style="scroll-behavior: auto;"></div>');const xu={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 _u(t,e){Di(e,!0),ba(t,xu);const n=[375,768,1024,1400,1920];let i,r=Ha(e,"scrollOffset",15),o=Ha(e,"isMobile",3,!1),s=Ha(e,"gallery",7),a=no((()=>s().state.playingModulePosition)),l=null,c=null,u=no((()=>s().state.startedPlaying)),d=no((()=>s().state.currentModulesList)),h=no((()=>Rs(d).findIndex((t=>p(s().state.playingModulePosition,t.position))))),f=!1;function p(t,e){return t.itemIndex===e.itemIndex&&t.moduleIndex===e.moduleIndex}function m(t){const e=t.scrollLeft,n=t.scrollWidth-t.clientWidth;return 0===e?0:e>n?100:e/n*100}function v(t){var e;o()&&t.preventDefault();const{target:n}=t,u=m(n),f=(null===(e=Rs(d))||void 0===e?void 0:e.length)||1,v=100/(f-1||1),g=Math.round(u/v);let y=Math.min(g,f-1);const b=Rs(d)[y],k={itemIndex:s().state.activeItemIndex,moduleIndex:s().state.activeModuleIndex};if(!l){const t=i.children[Rs(h)],e=i.getBoundingClientRect(),n=t.getBoundingClientRect();r(n.x-e.x)}c&&clearTimeout(c),c=setTimeout((()=>{const t=m(n);Math.abs(t-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=Rs(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),vo(a,b.position)}function g(){f||(s().track("coverdisplay"),f=!0)}Go((()=>{const{activeItemIndex:t,activeModuleIndex:e}=s().state;t===Rs(a).itemIndex&&e===Rs(a).moduleIndex||Bs((()=>{var n,r;const o=Rs(d).findIndex((n=>{const{itemIndex:i,moduleIndex:r}=n.position;return t===i&&e===r}));l=(null===(n=Rs(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"})}))})),Go((()=>{Rs(u)&&Bs((()=>{s().track("projectstartedplaying")}))}));var y=Ks(),b=Do(y),k=t=>{var r=wu();ma(r,23,(()=>Rs(d)),(t=>t.id),((t,i,r)=>{var a=ku(),l=Ro(a),c=t=>{var e=yu();let o;Yo((t=>{o=Ia(e,1,"cover-image svelte-1rvgxfc",null,o,{hidden:Rs(u)&&Rs(r)===Rs(h),"force-show":Rs(i).showCover}),La(e,"src",t),La(e,"alt",Rs(i).name),La(e,"fetchpriority",0===Rs(r)?"high":"auto")}),[()=>s().getCoverUrl(Rs(i).cover,n[n.length-1])]),js("load",e,(function(...t){var e;null===(e=0===Rs(r)?g:()=>{})||void 0===e||e.apply(this,t)})),function(t){if(!vi)return;t.removeAttribute("onload"),t.removeAttribute("onerror");const e=t.__e;void 0!==e&&(t.__e=void 0,queueMicrotask((()=>{t.isConnected&&t.dispatchEvent(e)})))}(e),Xs(t,e)};ha(l,(t=>{t(c)}));var d=Lo(l,2);!function(t,e){Di(e,!0),ba(t,gu);const n={color:"#e3e3e3",fadeTime:300,lineWidth:8},i=du(e.gallery.interaction((t=>{const{direction:n}=t.detail;var i;if("left"===n)null===(i=e.gallery)||void 0===i||i.next(),e.onEvent("swipe",[-1,0]);else if("right"===n){var r;null===(r=e.gallery)||void 0===r||r.prev(),e.onEvent("swipe",[1,0])}}),{elementid:"swiper"}),(()=>({touchAction:"pan-y",plugins:e.debug?[pu(n)]:[]}))),r=fu((function(t){const{x:n,y:i}=t.detail;e.onEvent("click",{x:n,y:i})}),(()=>({touchAction:"pan-y"})));var o=Ks(),s=Do(o),a=t=>{var e=mu();Ba(e,(()=>({...i,...r,class:"swiper"})),void 0,void 0,void 0,"svelte-1fv6njc"),Xs(t,e)},l=t=>{var e=vu();Ba(e,(()=>({...r,class:"swiper"})),void 0,void 0,void 0,"svelte-1fv6njc"),Xs(t,e)};ha(s,(t=>{e.isMobile?t(a):t(l,!1)})),Xs(t,o),Li()}(d,{get gallery(){return s()},get debug(){return e.debug},get isMobile(){return o()},get onEvent(){return e.onEvent}});var f=Lo(d,2),p=t=>{var e=bu();!function(t,e,n){vi&&bi();var i=new ca(t);Qo((()=>{var t,r=null!==(t=e())&&void 0!==t?t:null;i.ensure(r,r&&(t=>n(t,r)))}),Hn)}(Ro(e),(()=>Rs(i).Component),((t,e)=>{e(t,{get state(){return Rs(i).state},get gallery(){return s()},get isMobile(){return o()}})})),ki(e),Xs(t,e)};ha(f,(t=>{var e;null!==(e=Rs(i))&&void 0!==e&&e.Component&&t(p)})),ki(a),Xs(t,a)})),ki(r),Va(r,(t=>i=t),(()=>i)),js("scroll",r,v),Xs(t,r)};ha(b,(t=>{Rs(d)&&t(k)})),Xs(t,y),Li()}const Tu="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};let Eu;function Iu(){const t=Tu&&Tu.navigator&&(Tu.navigator.userAgent||Tu.navigator.platform||Tu.navigator.vendor)||"";if(Eu&&Eu.ua===t)return Eu;const e=t.toLowerCase(),n=e.includes("android"),i=e.includes("iphone")||e.includes("ipad")||e.includes("ipod")||e.includes("ios"),r=n||i||e.includes("mobile");return Eu={ua:t,isMobile:r},Eu}var Su,Au;"undefined"!=typeof window&&(window.addEventListener("pageshow",(function(t){t.persisted&&setTimeout((function(){window.location.reload()}),10)}),!1),null===(Su=(Au=window).EkoAnalytics)||void 0===Su||Su.call(Au,"track","init"));var Nu=Hs('<div class="paging-buttons svelte-1n46o8q"><!> <!></div>'),Mu=Hs('<div style="position: absolute; top: 0; left: 0; width: 100%;"></div>'),Fu=Hs("<!> <!>",1),Cu=Hs('<div class="player-container svelte-1n46o8q"><div class="player-div swipable svelte-1n46o8q"></div> <!> <!> <!> <!></div> <!>',1),Ou=Hs('<div class="eko-gallery-app svelte-1n46o8q"><!></div>');const Pu={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 Ru(t,e){Di(e,!0),ba(t,Pu);const n=Ha(e,"config",19,(()=>({}))),i=Ha(e,"forceMobile",3,!1),r=Ha(e,"videoAspectRatio",3,"unset"),o=Ha(e,"onGalleryReady",3,(()=>{})),s=Ha(e,"onEvent",3,(()=>{}));let a,l=!1,c=po(new Cc({...n(),onEvent:s()})),u=po(null),d=no((()=>i()||Iu().isMobile)),h=po(0),f=po(void 0),p=po(!0),m=po(xo({width:"100%",height:"100%"}));var v,g,y;function b(){const t={AssetsDeliveryService:{assetsDeliveryServiceUrl:Rs(c).urls.assetsDeliveryBase},Tracker:{tag:Rs(c).uuid}};vo(u,new e.EkoPlayer(a,function(t,...e){function n(t){return"[object Object]"===Object.prototype.toString.call(t)}function i(t,e){if(Array.isArray(e)){Array.isArray(t)||(t=Array.isArray(t)?t.slice():[]);const r=Math.max(t.length,e.length);for(let o=0;o<r;o++){const r=t[o],s=e[o];null!=s&&(n(r)&&n(s)?t[o]=i({...r},s):Array.isArray(r)&&Array.isArray(s)?t[o]=i(r.slice(),s):n(s)?t[o]=i({},s):Array.isArray(s)?t[o]=i([],s):t[o]=s)}return t}if(n(e)){n(t)||(t={});for(const r of Object.keys(e)){const o=t[r],s=e[r];n(o)&&n(s)?t[r]=i({...o},s):Array.isArray(o)&&Array.isArray(s)?t[r]=i(o.slice(),s):n(s)?t[r]=i({},s):Array.isArray(s)?t[r]=i([],s):void 0!==s&&(t[r]=s)}return t}return e}for(const n of e)null!==n&&i(t,n);return t}({},e.playerOptions,t))),Rs(u).on("playing",(()=>{Rs(c).state.paused=!1})),Rs(u).on("pause",(()=>{Rs(c).state.paused=!0})),Rs(u).once("playing",(()=>{Rs(c).state.startedPlaying=!0,s()("galleryloaded")}))}function k(t){var e;null===(e=Rs(c))||void 0===e||e.selectItem(t)}function w(){var t;null===(t=Rs(c))||void 0===t||t.next()}function x(){var t;null===(t=Rs(c))||void 0===t||t.prev()}function _(){Rs(u).paused?Rs(u).play():Rs(u).pause()}function T(){return`--uiTranformX: ${Rs(h)}px;--videoAspect: ${r()};--videoWidth: ${Rs(m).width};--videoHeight: ${Rs(m).height};`}v="state",g=()=>Rs(c).state,Bi("setContext").set(v,g),y=()=>(o()(Rs(c).public),n()&&e.EkoPlayer&&(b(),Rs(c).start(Rs(u))),()=>{var t;null===(t=Rs(u))||void 0===t||t.dispose(),Rs(c).dispose()}),null===Ni&&ui("onMount"),Go((()=>{const t=Bs(y);if("function"==typeof t)return t})),Go((()=>{n()&&e.EkoPlayer&&(l?Bs((()=>{var t;Rs(c).dispose(),vo(c,new Cc({...n(),onEvent:s()})),null===(t=Rs(u))||void 0===t||t.dispose(),vo(p,!1),Ps().then((()=>(vo(p,!0),Ps()))).then((()=>{o()(Rs(c).public),b(),Rs(c).start(Rs(u))}))})):l=!0)})),Go((()=>{Rs(f)&&Rs(u)&&Rs(u).loadDebugOverlay({containerElement:Rs(f)})})),Go((()=>{if("unset"!==r()&&r().includes("/")){const[t,e]=r().split("/").map((t=>Number(t)));isNaN(t)||isNaN(e)||vo(m,t>e?{width:"100%",height:"auto"}:{width:"auto",height:"100%"},!0)}else vo(m,{width:"100%",height:"100%"},!0)}));var E=Ou(),I=Ro(E),S=t=>{var n=Cu(),i=Do(n),r=Ro(i);Va(r,(t=>a=t),(()=>a));var o=Lo(r,2);_u(o,{get isMobile(){return Rs(d)},get gallery(){return Rs(c)},get debug(){return e.debug},get onEvent(){return s()},get scrollOffset(){return Rs(h)},set scrollOffset(t){vo(h,t,!0)}});var l=Lo(o,2),u=t=>{var e=Nu(),n=Ro(e);qc(n,{type:"prev",onClick:x}),qc(Lo(n,2),{type:"next",onClick:w}),ki(e),Xs(t,e)};ha(l,(t=>{Rs(d)||e.hideNav||t(u)}));var p=Lo(l,2),m=t=>{Kc(t,{get gallery(){return Rs(c)}})};ha(p,(t=>{var e;!Rs(d)&&(null===(e=Rs(c).state.currentItem)||void 0===e?void 0:e.modules.length)>1&&t(m)}));var v=Lo(p,2),g=t=>{var n=Fu(),i=Do(n);!function(t,e){Di(e,!0),ba(t,tu);const n=Ri("state");let i=no((()=>n().paused));var r=Zc(),o=no((()=>e.gallery.interaction(e.onPauseClick)));r.__click=function(...t){var e;null===(e=Rs(o))||void 0===e||e.apply(this,t)};var s=Ro(r),a=t=>{var e=Qc();Yo((()=>La(e,"src",Xc))),Xs(t,e)},l=t=>{var e=Jc();Yo((()=>La(e,"src",Yc))),Xs(t,e)};ha(s,(t=>{n().paused?t(a):t(l,!1)})),ki(r),Yo((()=>{La(r,"aria-label",Rs(i)?"Play":"Pause"),La(r,"data-interactiontype",Rs(i)?"play":"pause")})),Xs(t,r),Li()}(i,{onPauseClick:_,get gallery(){return Rs(c)}});var r=Lo(i,2),o=t=>{var e=Mu();Va(e,(t=>vo(f,t)),(()=>Rs(f))),Xs(t,e)};ha(r,(t=>{e.debug&&t(o)})),Xs(t,n)};ha(v,(t=>{Rs(c).state.startedPlaying&&t(g)})),ki(i);var y=Lo(i,2),b=t=>{!function(t,e){Di(e,!0),ba(t,Wc);let n=Ha(e,"onNavItemClick",3,(()=>{}));const i=Ri("state");var r=zc(),o=Ro(r);ma(o,23,(()=>i().currentItemsList),(t=>t.id),((t,e,r)=>{var o=Bc();let s;o.__click=()=>n()(Rs(r));var a=Ro(o),l=Ro(a,!0);ki(a),ki(o),Yo((t=>{s=Ia(o,1,"nav-button svelte-er27y2",null,s,t),na(l,Rs(e).name)}),[()=>({selected:Rs(r)===i().activeItemIndex})]),Xs(t,o)})),ki(o),ki(r),Xs(t,r),Li()}(t,{onNavItemClick:k})};ha(y,(t=>{e.hideNav||t(b)})),Yo((t=>Aa(i,t)),[T]),Xs(t,n)};ha(I,(t=>{n()&&Rs(p)&&t(S)})),ki(E),Xs(t,E),Li()}function Du(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Lu,Bu,zu,Wu,$u={exports:{}},ju=Du((Lu||(Lu=1,zu=$u.exports,Wu=function(){var t=function(){},e="undefined",n=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],r={},o=null;function s(t,e){var n=t[e];if("function"==typeof n.bind)return n.bind(t);try{return Function.prototype.bind.call(n,t)}catch(e){return function(){return Function.prototype.apply.apply(n,[t,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?t:this.methodFactory(o,n,this.name)}if(this.log=this.debug,typeof console===e&&n<this.levels.SILENT)return"No console available for logging"}function c(t){return function(){typeof console!==e&&(l.call(this),this[t].apply(this,arguments))}}function u(i,r,o){return"debug"===(l=i)&&(l="log"),typeof console!==e&&("trace"===l&&n?a:void 0!==console[l]?s(console,l):void 0!==console.log?s(console,"log"):t)||c.apply(this,arguments);var l}function d(t,n){var s,a,c,d=this,h="loglevel";function f(){var t;if(typeof window!==e&&h){try{t=window.localStorage[h]}catch(t){}if(typeof t===e)try{var n=window.document.cookie,i=encodeURIComponent(h),r=n.indexOf(i+"=");-1!==r&&(t=/^([^;]+)/.exec(n.slice(r+i.length+1))[1])}catch(t){}return void 0===d.levels[t]&&(t=void 0),t}}function p(t){var e=t;if("string"==typeof e&&void 0!==d.levels[e.toUpperCase()]&&(e=d.levels[e.toUpperCase()]),"number"==typeof e&&e>=0&&e<=d.levels.SILENT)return e;throw new TypeError("log.setLevel() called with invalid level: "+t)}"string"==typeof t?h+=":"+t:"symbol"==typeof t&&(h=void 0),d.name=t,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(t,n){return c=p(t),!1!==n&&function(t){var n=(i[t]||"silent").toUpperCase();if(typeof window!==e&&h){try{return void(window.localStorage[h]=n)}catch(t){}try{window.document.cookie=encodeURIComponent(h)+"="+n+";"}catch(t){}}}(c),l.call(d)},d.setDefaultLevel=function(t){a=p(t),f()||d.setLevel(t,!1)},d.resetLevel=function(){c=null,function(){if(typeof window!==e&&h){try{window.localStorage.removeItem(h)}catch(t){}try{window.document.cookie=encodeURIComponent(h)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(t){}}}(),l.call(d)},d.enableAll=function(t){d.setLevel(d.levels.TRACE,t)},d.disableAll=function(t){d.setLevel(d.levels.SILENT,t)},d.rebuild=function(){if(o!==d&&(s=p(o.getLevel())),l.call(d),o===d)for(var t in r)r[t].rebuild()},s=p(o?o.getLevel():"WARN");var m=f();null!=m&&(c=p(m)),l.call(d)}(o=new d).getLogger=function(t){if("symbol"!=typeof t&&"string"!=typeof t||""===t)throw new TypeError("You must supply a name when creating a logger.");var e=r[t];return e||(e=r[t]=new d(t,o.methodFactory)),e};var h=typeof window!==e?window.log:void 0;return o.noConflict=function(){return typeof window!==e&&window.log===o&&(window.log=h),o},o.getLoggers=function(){return r},o.default=o,o},(Bu=$u).exports?Bu.exports=Wu():zu.log=Wu()),$u.exports));const Uu=()=>{},qu=["trace","log","debug","info","warn","error","getLevel","setLevel"],Vu=["trace","debug","info","warn","error","silent"],Gu={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;"},Hu="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global;let Ku={level:"trace",appName:""},Xu=[];const Yu="object"==typeof Hu&&Hu.performance&&"function"==typeof Hu.performance.now?Hu.performance.now.bind(Hu.performance):Date.now.bind(Date),Qu=t=>t&&"string"==typeof t?t.toLowerCase().trim():"",Ju=(()=>{try{const t=new URLSearchParams(document.location.search),e=[].concat(t.getAll("log")).concat(t.getAll("ekolog")).concat(t.getAll("ekologger")).join(",").split(",");if(0===e.length)return{};let n={};return e.forEach((t=>{const[e,i]=t.split(":");n[Qu(e)]=Qu(i)||"trace"})),n}catch(t){return{}}})(),Zu=(t,e="")=>{const n=Qu(t),i=ju.getLogger(n);if(i.__ekologger)return i.__ekologger;e||Ju[n]||Ju["*"]||(i.__noExplicitLevel=!0);const r=i.methodFactory;i.methodFactory=(e,n,i)=>{const o=r(e,n,i),s=e.toUpperCase();return(...e)=>{o(`[${((t,e=3)=>(Yu()/1e3).toFixed(e))()}] %c[${s}] ${Ku.appName?`[${Ku.appName}] `:""}[${t}]`,Gu[s],...e)}},e=Ju[n]||Ju["*"]||e||Ku.level,i.setLevel(e,!1);const o=(...t)=>i.log(...t);return qu.forEach((t=>{o[t]=(...e)=>(Xu.forEach((n=>{n[t](...e)})),i[t](...e))})),i.__ekologger=o,o};Zu.setDefaults=({appName:t="",level:e})=>{t&&"string"==typeof t&&(Ku.appName=t),(e=Qu(e))&&Vu.includes(e)&&(Ku.level=e,Object.values(ju.getLoggers()).filter((t=>t.__noExplicitLevel)).forEach((t=>t.setLevel(Ku.level,!1))))},Zu.installDriver=t=>{const e={...qu.reduce(((e,n)=>(e[n]="function"==typeof(null==t?void 0:t[n])?t[n]:Uu,e)),{})};Xu.push(e)};let td=class{#T=new Map;on(t,e){if("function"!=typeof e)return this;const n=this.#T.get(t)||new Set;return n.add(e),this.#T.set(t,n),this}once(t,e){if("function"!=typeof e)return this;const n=(...i)=>(this.off(t,n),e(...i));return this.on(t,n)}off(t,e){if(!t)return this.#T.clear(),this;const n=this.#T.get(t);return n?e?(n.delete(e),0===n.size&&this.#T.delete(t),this):(this.#T.delete(t),this):this}trigger(t,...e){const n=this.#T.get(t);return n?(n.forEach((t=>t(...e))),this):this}};function ed(t){return"[object Object]"===Object.prototype.toString.call(t)}function nd(t,...e){const n=ed(t)?{...t}:{};return e.forEach((t=>{ed(t)&&Object.keys(t).forEach((e=>{const i=t[e],r=n[e];ed(i)&&ed(r)?n[e]=nd(r,i):Array.isArray(i)?n[e]=i.slice():n[e]=i}))})),n}function id(t){if("string"==typeof t)return`'${t}'`;if(Array.isArray(t))return`[${t.map((t=>id(t))).join(", ")}]`;if(ed(t))try{return JSON.stringify(t)}catch(t){return"[object Object]"}return null===t?"null":void 0===t?"undefined":String(t)}function rd(t){return Array.from(t).map((t=>id(t))).join(", ")}var od=new WeakSet;let sd=class extends td{constructor(...t){super(),O(this,od);const e=t.length?t[t.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=Zu(n,this.loglevel);const i=ed(this.defaults)?this.defaults:{},r=ed(e)&&ed(e[n])?e[n]:{};this.settings=nd({},i,r),A(od,this,ad).call(this),A(od,this,ld).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 ad(){const t=new Set,e=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(t.has(o))continue;const s=Object.getOwnPropertyDescriptor(n,o);if(!s||"function"!=typeof s.value)continue;const a=s.value.bind(this),l=!e.has(o);this[o]=l?(...t)=>(this.log&&"function"==typeof this.log.debug&&this.log.debug(`${this.name}.${o}(${rd(t)})`),a(...t)):a,t.add(o)}n=Object.getPrototypeOf(n)}}function ld(){if("undefined"==typeof window||"function"!=typeof window.addEventListener)return;const t=()=>{try{"function"==typeof this.dispose&&this.dispose()}catch(t){this.log&&"function"==typeof this.log.error&&this.log.error("dispose failed",t)}};window.addEventListener("pagehide",t),window.addEventListener("beforeunload",t),this._lifecycleCleanup=()=>{window.removeEventListener("pagehide",t),window.removeEventListener("beforeunload",t)}}const cd="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};function ud(t){return Boolean(t)&&"object"==typeof t&&1===t.nodeType&&"function"==typeof t.appendChild}const dd=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",CANVAS_WEBGL_CONTEXT_LOST:"canvas.webglcontextlost",CANVAS_WEBGL_CONTEXT_RESTORED:"canvas.webglcontextrestored"});function hd(t,e){const n={};return Number.isFinite(t)&&(n.time=t),"string"==typeof e&&(n.source=e),n}function fd({placementId:t,nodeId:e,trackId:n,segmentId:i,trackType:r,pts:o,duration:s,frame:a,audioBuffer:l}={}){const c={};return t&&(c.placementId=t),e&&(c.nodeId=e),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 pd({placementId:t,nodeId:e,trackId:n,segmentId:i,trackType:r,error:o}={}){const s={};return t&&(s.placementId=t),e&&(s.nodeId=e),n&&(s.trackId=n),i&&(s.segmentId=i),r&&(s.trackType=r),o&&(s.error=o),s}var md=new WeakMap,vd=new WeakMap,gd=new WeakMap,yd=new WeakMap,bd=new WeakMap,kd=new WeakMap,wd=new WeakMap,xd=new WeakSet;let _d=class extends sd{get defaults(){return{style:{width:"100%",height:"100%"},contextAttributes:{alpha:!1,depth:!1,stencil:!1,antialias:!1,preserveDrawingBuffer:!1,powerPreference:"low-power"}}}constructor(...t){var e,n;super(...t),O(this,xd),F(this,md,void 0),F(this,vd,void 0),F(this,gd,void 0),F(this,yd,void 0),F(this,bd,void 0),F(this,kd,void 0),F(this,wd,void 0);const[i,r=null]=t;C(kd,this,r);const o=function(t,e=(null==cd?void 0:cd.document)){if(ud(t))return t;const n="string"==typeof t?t:null;if(!n||!e||"function"!=typeof e.querySelector)return null;const i=e.querySelector(n);return ud(i)?i:null}(i);if(!o)throw new Error("Canvas requires a valid mount target (HTMLElement or selector string).");C(md,this,o);const s=null==cd?void 0:cd.document;if(!s||"function"!=typeof s.createElement)throw new Error("Canvas requires document.createElement.");var a,l;C(vd,this,s.createElement("canvas")),a=M(vd,this),l=null===(e=this.settings)||void 0===e?void 0:e.style,a&&l&&"object"==typeof l&&!Array.isArray(l)&&Object.keys(l).forEach((t=>{const e=l[t];null!=e&&(a.style[t]=String(e))})),M(md,this).appendChild(M(vd,this));const c=null===(n=this.settings)||void 0===n?void 0:n.contextAttributes,u=c&&"object"==typeof c&&!Array.isArray(c)?c:void 0;if(C(wd,this,u),C(gd,this,M(vd,this).getContext("webgl2",u)),!M(gd,this))throw new Error("Canvas WebGL2 context is not available.");A(xd,this,Ed).call(this)}get name(){return"Canvas"}get element(){return M(vd,this)}get gl(){return M(gd,this)}onDispose(){A(xd,this,Id).call(this),M(vd,this)&&M(vd,this).parentNode&&M(vd,this).parentNode.removeChild(M(vd,this)),C(gd,this,null),C(vd,this,null),C(md,this,null),C(kd,this,null),C(wd,this,null),C(yd,this,null),C(bd,this,null)}};function Td(t,e){var n,i;this.trigger(t,e),null===(n=M(kd,this))||void 0===n||null===(i=n.trigger)||void 0===i||i.call(n,t,e)}function Ed(){M(vd,this)&&(C(yd,this,(t=>{"function"==typeof(null==t?void 0:t.preventDefault)&&t.preventDefault(),this.log.error("WebGL context lost",t),A(xd,this,Td).call(this,dd.CANVAS_WEBGL_CONTEXT_LOST,t)})),C(bd,this,(t=>{var e;C(gd,this,(null===(e=M(vd,this))||void 0===e?void 0:e.getContext("webgl2",M(wd,this)))||null),M(gd,this)?A(xd,this,Td).call(this,dd.CANVAS_WEBGL_CONTEXT_RESTORED,t):this.log.error("WebGL context restored event fired but WebGL2 context is still unavailable.",t)})),M(vd,this).addEventListener("webglcontextlost",M(yd,this)),M(vd,this).addEventListener("webglcontextrestored",M(bd,this)))}function Id(){M(vd,this)&&(M(vd,this).removeEventListener("webglcontextlost",M(yd,this)),M(vd,this).removeEventListener("webglcontextrestored",M(bd,this)))}var Sd=new WeakMap,Ad=new WeakMap,Nd=new WeakMap,Md=new WeakMap,Fd=new WeakMap,Cd=new WeakMap,Od=new WeakSet;let Pd=class extends sd{get name(){return"ContainerSize"}get containerWidth(){return M(Ad,this)}get containerHeight(){return M(Nd,this)}get width(){return M(Ad,this)}get height(){return M(Nd,this)}constructor(...t){super(...t),O(this,Od),F(this,Sd,void 0),F(this,Ad,0),F(this,Nd,0),F(this,Md,null),F(this,Fd,null),F(this,Cd,null);const[e]=t;var n;C(Sd,this,(n=e)&&n.element&&ud(n.element)?n.element:ud(n)?n:null),M(Sd,this)&&(A(Od,this,Dd).call(this,!0),A(Od,this,Rd).call(this))}onDispose(){M(Md,this)&&"function"==typeof M(Md,this).disconnect&&M(Md,this).disconnect(),C(Md,this,null),M(Cd,this)&&"function"==typeof(null==cd?void 0:cd.removeEventListener)&&cd.removeEventListener("resize",M(Cd,this)),C(Cd,this,null),M(Fd,this)&&((null==cd?void 0:cd.clearInterval)||clearInterval)(M(Fd,this)),C(Fd,this,null),C(Sd,this,null)}};function Rd(){if(!M(Sd,this))return;const t=null==cd?void 0:cd.ResizeObserver;if("function"==typeof t)return C(Md,this,new t((()=>A(Od,this,Dd).call(this)))),void M(Md,this).observe(M(Sd,this));C(Cd,this,(()=>A(Od,this,Dd).call(this))),"function"==typeof(null==cd?void 0:cd.addEventListener)&&cd.addEventListener("resize",M(Cd,this));const e=(null==cd?void 0:cd.setInterval)||setInterval;C(Fd,this,e((()=>A(Od,this,Dd).call(this)),250))}function Dd(t=!1){if(!M(Sd,this))return;const{width:e,height:n}=function(t){const e=Number(null==t?void 0:t.clientWidth),n=Number(null==t?void 0:t.clientHeight);return{width:Number.isFinite(e)&&e>0?Math.round(e):0,height:Number.isFinite(n)&&n>0?Math.round(n):0}}(M(Sd,this));(t||e!==M(Ad,this)||n!==M(Nd,this))&&(C(Ad,this,e),C(Nd,this,n),this.trigger("containerresize",{width:e,height:n}))}var Ld={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 Bd=class{constructor(t,e){this.canvasSource=t,this.startRendering=e,this.gl=null,this.glOptions=null}init(t,e,n){this.glOptions=n||{};const i=this.initCanvas(this.canvasSource,t,e);return this.initWebgl(i,this.glOptions)}initCanvas(){throw new Error("implement on concrete class")}getContextConfig(t={}){if(!t||"object"!=typeof t)return{contextType:"webgl",contextAttributes:void 0};const{contextType:e,contextAttributes:n,__shaderGraph:i,...r}=t,o=Object.prototype.hasOwnProperty.call(t,"contextAttributes");let s=o?n:r;return o||!s||"object"!=typeof s||Array.isArray(s)||0!==Object.keys(s).length||(s=void 0),{contextType:e||"webgl",contextAttributes:s}}initWebgl(t,e={}){const{contextType:n,contextAttributes:i}=this.getContextConfig(e),r=t.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 zd,Wd={exports:{}},$d=(zd||(zd=1,function(t){var e=Object.prototype.hasOwnProperty,n="~";function i(){}function r(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,i,o,s){if("function"!=typeof i)throw new TypeError("The listener must be a function");var a=new r(i,o||t,s),l=n?n+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],a]:t._events[l].push(a):(t._events[l]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new i:delete t._events[e]}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 t,i,r=[];if(0===this._eventsCount)return r;for(i in t=this._events)e.call(t,i)&&r.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},a.prototype.listeners=function(t){var e=n?n+t:t,i=this._events[e];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(t){var e=n?n+t:t,i=this._events[e];return i?i.fn?1:i.length:0},a.prototype.emit=function(t,e,i,r,o,s){var a=n?n+t:t;if(!this._events[a])return!1;var l,c,u=this._events[a],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,i),!0;case 4:return u.fn.call(u.context,e,i,r),!0;case 5:return u.fn.call(u.context,e,i,r,o),!0;case 6:return u.fn.call(u.context,e,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(t,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,e);break;case 3:u[c].fn.call(u[c].context,e,i);break;case 4:u[c].fn.call(u[c].context,e,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(t,e,n){return o(this,t,e,n,!1)},a.prototype.once=function(t,e,n){return o(this,t,e,n,!0)},a.prototype.removeListener=function(t,e,i,r){var o=n?n+t:t;if(!this._events[o])return this;if(!e)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==e||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!==e||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(t){var e;return t?(e=n?n+t:t,this._events[e]&&s(this,e)):(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,t.exports=a}(Wd)),Wd.exports),jd=Du($d);let Ud=class extends Bd{constructor(t){super(t,!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 e=new jd;this.on=e.on.bind(e),this.off=e.off.bind(e),this.once=e.once.bind(e),this.trigger=e.emit.bind(e)}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(t,e,n){var i;this.player=t,this.setSrcVidTracksFn=e;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)&&null!=(a=o)&&"object"==typeof a&&!Array.isArray(a)&&Object.keys(a).length>0;var a;const l={contextType:r};s&&(l.contextAttributes=o),t.initPlugin("canvas",l);const c={drawFrame:this.canvasDrawFrameFn.bind(this),resize:n,contextType:r,offscreenVideoCanvasEnabled:!1,viewportModeEnabled:!0,fps:0};return s&&(c.contextAttributes=o),t.canvas.init(c),t.paused&&0===t.currentTime&&(this.shouldUpdateTexture=!1),this.addPlayerListeners(),t.canvas.canvas}canvasDrawFrameFn(t,e,n){var i;this.setSrcVidTracksFn&&this.shouldUpdateTexture&&t&&e&&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((t=>{this.player.once("seeked",(()=>{this.shouldUpdateTexture=!0,t()})),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)}},qd=class extends Bd{constructor(t){super(t,!1)}initCanvas(t,e){const n=function(){const t=document.querySelector("video");t&&t.videoHeight&&e(t),requestAnimationFrame(n)};return requestAnimationFrame(n),document.getElementById(t)}},Vd=class extends Bd{constructor(t){super(t,!1)}initCanvas({src:t,dest:e},n,i){const r="string"==typeof e?document.querySelector(e):e,o="undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement,s=()=>{this.isDisposed||(t&&t.videoHeight&&n(t),requestAnimationFrame(s))};return o?requestAnimationFrame(s):"function"==typeof t?t(n,i):n(t),r}dispose(){this.isDisposed=!0}};var Gd=function(t){let e;return e="string"==typeof t?new qd(t):t&&t.src&&t.dest?new Vd(t):new Ud(t),e};function Hd(t){return Array.isArray(t)||(t=[t]),t}let Kd=class{constructor(t){this.store=t?{...t.get()}:{}}reset(){this.store={}}get(t){if(!t)return this.store;const e=(t=Hd(t)).reduce(((t,e)=>{const n=this.store[e];return t.push(n),t}),[]);return 1===e.length?e[0]:e}set(t,e){if(t=Hd(t),e=Hd(e),t.length!==e.length)throw new Error(`cant set values ${e} to keys ${t}, length did not match`);t.forEach(((t,n)=>{this.store[t]=e[n]}))}},Xd=class{constructor(t,e,n,i){this.gl=i.gl,this.unit=t,this.bindPoint=e,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(t){this.height=t}setWidth(t){this.width=t}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 Yd=Zu("frame","warn");let Qd=!1;if("undefined"!=typeof window&&window.InterludePlayer){let t=window.InterludePlayer.environment,e=t.isAffectedBySafari17SeekBug,n=t.ua.includes("WMT1H")&&t.ua.includes("iOS/17");Qd=e||n}function Jd(t,e){const n=t.gl;var i;n.texImage2D(t.bindPoint,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e),t.__hasAllocated=!0,i=t,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 Zd=class extends Xd{fill(t){if(Qd&&(t.paused||"undefined"!=typeof document&&"hidden"===document.visibilityState))return;if(t.__closed)return;this.bind();const e=function(t,e){let n=!t.__hasAllocated;return e?(e.width===t.width&&e.height===t.height||(n=!0),t.width=e.width,t.height=e.height,n):n}(this,function(t){if(!t)return;const e=[[t.displayWidth,t.displayHeight],[t.codedWidth,t.codedHeight],[t.videoWidth,t.videoHeight],[t.naturalWidth,t.naturalHeight],[t.width,t.height]];for(let t=0;t<e.length;t+=1){const[n,i]=e[t],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}(t)),n=performance.now();!function(t,e,n){const i=t.gl,r=function(t){if("undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement)return!0;const e="object"==typeof window?window:"object"==typeof self?self:null,n=e&&e.VideoFrame;return"function"==typeof n&&t instanceof n}(e);r&&(t.__useSubImage=!1),n||!1===t.__useSubImage||r?Jd(t,e):(i.texSubImage2D(t.bindPoint,0,0,0,i.RGBA,i.UNSIGNED_BYTE,e),void 0===t.__useSubImage&&(i.getError()!==i.NO_ERROR?(t.__useSubImage=!1,Jd(t,e)):t.__useSubImage=!0))}(this,t,e);const i=(performance.now()-n)/1e3;i>=.1&&Yd.warn(`[fill] texImage2D() took ${i.toFixed(3)} seconds to execute.`),"function"==typeof t.close&&!0!==t.__keepOpen&&(t.close(),t.__closed=!0)}},th=class extends Xd{constructor(t,e,n){super(...arguments),n.needRefresh&&(this.fill(null),n.needRefresh=!1)}fill(t){if(this.bind(),t&&t.tagName&&"IMG"===t.tagName){const e=Number(t.naturalWidth||t.width),n=Number(t.naturalHeight||t.height);this.gl.texImage2D(this.bindPoint,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),Number.isFinite(e)&&Number.isFinite(n)&&(this.actualWidth=e,this.actualHeight=n,this.textureObjectInfo&&(this.textureObjectInfo.allocatedWidth=e,this.textureObjectInfo.allocatedHeight=n))}else{const e=this.gl.canvas.width,n=this.gl.canvas.height;this.gl.texImage2D(this.bindPoint,0,this.gl.RGBA,e,n,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),Number.isFinite(e)&&Number.isFinite(n)&&(this.actualWidth=e,this.actualHeight=n,this.textureObjectInfo&&(this.textureObjectInfo.allocatedWidth=e,this.textureObjectInfo.allocatedHeight=n))}}};var eh=function(t,e,n,i,r){let o;switch(t){case"frame":o=new Zd(e,n,i,r);break;case"pixel":o=new th(e,n,i,r);break;default:throw new Error(`cant recognize type ${t}`)}return o};let nh=class{constructor(t){this.gl=t.gl;const e=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS)||20;return this.maxTextures=Math.min(20,e),this.textureObjectPool=[],this.textureUnitsPool=new Set(Array(this.maxTextures).keys()),this.activeTextures=t.activeTextures instanceof Set?t.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 t=this.textureUnitsPool.values(),e=Math.min.apply(null,[...t]);return this.textureUnitsPool.delete(e),e}createTexture(t){const e=t&&t.type||{},n=this.gl.TEXTURE_2D,i=this.getTextureUnit(),r=this.getTextureObject(),o=eh(e,i,n,r,{gl:this.gl});return this.activeTextures.add(o),o}releaseTexture(t){this.textureUnitsPool.has(t.getUnit())||(this.textureObjectPool.push({object:t.getObject(),needRefresh:!1}),this.textureUnitsPool.add(t.getUnit())),this.activeTextures.delete(t)}refreshTextureObjects(){this.textureObjectPool.forEach((t=>{t.needRefresh=!0}))}refreshActiveTextures(){const t=new Set;this.activeTextures.forEach((e=>{if(!e||"function"!=typeof e.getUnit)return;t.add(e.getUnit());const n={object:this.gl.createTexture(),needRefresh:!0};e.gl=this.gl,e.textureObjectInfo=n,e.textureObject=n.object,e.__hasAllocated=!1,e.__useSubImage=void 0,e.actualWidth=null,e.actualHeight=null,"function"==typeof e.setParameters&&e.setParameters()})),this.textureObjectPool=[],this.textureUnitsPool=new Set(Array(this.maxTextures).keys()),t.forEach((t=>{this.textureUnitsPool.delete(t)}))}};const ih=Ld.VIDEO_SOURCE_PREFIX,rh=Ld.TEXTURE_SOURCE_PREFIX,oh=Ld.PREVIOUS_OUTPUT_PREFIX,sh=Ld.SAVED_FRAME_PREFIX;function ah(t,e,n){t.set(`${ih}${n}`,e)}function lh(t,e,n){t.set(`${oh}${n}`,e)}function ch(t,e,n){t.set(`${sh}${n}`,e)}let uh=class{constructor(t){return this.gl=t.gl,this.glSource=t.glSource,this.textureManager=t.textureManager,this.capturedFramesManager=t.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(t){for(const[e,n]of Object.entries(this.capturedFramesManager.getCurrentFrames()))ah(t,n,e),lh(t,n,e);for(const[e,n]of Object.entries(this.capturedFramesManager.getSavedFrames()))ch(t,n,e)}setTextureSource(t,e,n){t.set(`${rh}${n}`,e)}getInput(t,e){return t.get(e)}getPrevOutput(t,e){return e=Number.isInteger(e)?e:0,t.get(`${oh}${e}`)}setOutputs(t,e=[],n=[]){if(Array.isArray(n)||(n=[n]),e.length>n.length)throw new Error(`output ids ${e.length} is bigger then supplied outputs ${n.length}`);n.forEach(((e,n)=>{lh(t,e,n)})),e.forEach(((e,i)=>{t.set(e,n[i])}))}disposeTextures(t,e){const n=e.getUnit();t.forEach((t=>{const e=t.getUnit();this.capturedFramesManager.isReservedUnit(e)||n===e||this.textureManager.releaseTexture(t)}))}disposeAllStore(t){const e=new Set;Object.values(t.get()).forEach((t=>{const n=t.getUnit();this.capturedFramesManager.isReservedUnit(n)||e.has(n)||t.isStatic||(this.textureManager.releaseTexture(t),e.add(n))}))}},dh=class{constructor(t){this.context=t}bind(){throw new Error("impl in concrete")}},hh=100,fh=100;function ph(t,e){hh=t,fh=e}let mh=class extends dh{bind(t){var e,n;this.context.gl.bindFramebuffer(this.context.gl.FRAMEBUFFER,null);const i=null===(e=this.context.gl)||void 0===e||null===(e=e.canvas)||void 0===e?void 0:e.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),ph(i,r)),t}},vh=class extends dh{bind(t){Array.isArray(t)||(t=[t]),this.context.gl.bindFramebuffer(this.context.gl.FRAMEBUFFER,this.context.frameBufferObject);const e=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,e.textureObject,0),this.context.gl.clear(this.context.gl.COLOR_BUFFER_BIT),!0===this.context.useCanvasSizedFilterTargets){var i,r;const t=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(t)&&t>0&&e.setWidth(t),Number.isFinite(n)&&n>0&&e.setHeight(n);const o=e.textureObjectInfo,s=null==o?void 0:o.allocatedWidth,a=null==o?void 0:o.allocatedHeight;Number.isFinite(t)&&Number.isFinite(n)&&(s!==t||a!==n)&&"function"==typeof e.fill&&e.fill(null)}else t[0]&&(e.setHeight(t[0].getHeight()),e.setWidth(t[0].getWidth()));return e}},gh=class{constructor(t){this.gl=t.gl,this.textureManager=t.textureManager,this.useCanvasSizedFilterTargets=t.useCanvasSizedFilterTargets,this.bufferIndex=0,this.frameBufferObjectsPool=[this.gl.createFramebuffer(),this.gl.createFramebuffer(),this.gl.createFramebuffer()]}getFrameBufferObject(){const t=this.frameBufferObjectsPool[this.bufferIndex];return this.bufferIndex=this.bufferIndex++%this.frameBufferObjectsPool.length,t}create(t){let e;return e=t===Ld.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS?new mh({gl:this.gl}):new vh({gl:this.gl,textureManager:this.textureManager,frameBufferObject:this.getFrameBufferObject(),useCanvasSizedFilterTargets:this.useCanvasSizedFilterTargets}),e}};function yh(t,e,n){const i=e===t.VERTEX_SHADER?"vertex":"fragment";var r;r=t,Boolean(r)&&("undefined"!=typeof WebGL2RenderingContext&&r instanceof WebGL2RenderingContext||"function"==typeof r.createVertexArray)&&(n=function(t="",e){if("string"!=typeof t||!t||function(t=""){return"string"==typeof t&&t.includes("#version 300 es")}(t))return t;let n=t;if("vertex"===e&&(n=n.replace(/\battribute\b/g,"in"),n=n.replace(/\bvarying\b/g,"out")),"fragment"===e&&(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"===e&&n.includes("fragColor")&&!/\bout\s+vec4\s+fragColor\s*;/.test(n)){const t=n.split("\n");let e=1;for(let n=1;n<t.length;n+=1)if(t[n].trim().startsWith("precision ")){e=n+1;break}t.splice(e,0,"out vec4 fragColor;"),n=t.join("\n")}return n}(n,i));const o=t.createShader(e);if(!o)throw new Error(`Failed to create ${i} shader`);if(t.shaderSource(o,n),t.compileShader(o),t.getShaderParameter(o,t.COMPILE_STATUS))return o;const s=t.getShaderInfoLog(o);throw t.deleteShader(o),new Error(s)}var bh=function(t,e){return yh(t,t.VERTEX_SHADER,e)},kh=function(t,e){return yh(t,t.FRAGMENT_SHADER,e)};const wh={position_3d:0,texture_coordinate_2d:1};var xh=function(t,e,n){const i=t.createProgram();if(t.attachShader(i,e),t.attachShader(i,n),Object.entries(wh).forEach((([e,n])=>{t.bindAttribLocation(i,n,e)})),t.linkProgram(i),t.getProgramParameter(i,t.LINK_STATUS))return i;const r=t.getProgramInfoLog(i);throw t.deleteProgram(i),new Error(r)},_h=[-1,-1,1,1,-1,1,-1,1,1,1,1,1],Th=[0,1,2,2,1,3],Eh=[0,0,1,0,0,1,1,1];const Ih=96,Sh=[new Float32Array(new ArrayBuffer(Ih)),new Float32Array(new ArrayBuffer(Ih)),new Float32Array(new ArrayBuffer(Ih)),new Float32Array(new ArrayBuffer(Ih)),new Float32Array(new ArrayBuffer(Ih)),new Float32Array(new ArrayBuffer(Ih))],Ah=[new Int16Array(6),new Int16Array(6),new Int16Array(6)];let Nh=class{constructor(t,e,n){return this.gl=n.gl,this.program=n.program,this.bindPoint=e,this.location=this.gl.getAttribLocation(this.program,t),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 t;switch(this.bindPoint){case this.gl.ARRAY_BUFFER:t=Sh[this.floatBufferCounter],this.floatBufferCounter=this.floatBufferCounter++%Sh.length;break;case this.gl.ELEMENT_ARRAY_BUFFER:t=Ah[this.unit16BufferCounter],this.unit16BufferCounter=this.unit16BufferCounter++%Ah.length;break;default:throw new Error("cant get buffer for this bind point: ",this.bindPoint)}return t}fillBuffer(t){this.bindBuffer();const e=this.getBuffer();e.set(t,0),this.gl.bufferData(this.bindPoint,e,this.gl.STATIC_DRAW)}getPointerData(){throw new Error("you should impl this function")}setPointer(){this.bindBuffer(),this.enable();const t=this.getPointerData();this.gl.vertexAttribPointer(this.location,t.size,t.type,t.normalize,t.stride,t.offset)}dispose(){this.gl.deleteBuffer(this.buffer)}};const Mh={position_3d:class extends Nh{getPointerData(){return{size:3,type:this.gl.FLOAT,normalize:!1,stride:0,offset:0}}},position_indexes:class extends Nh{setPointer(){}getPointerData(){}enable(){}},texture_coordinate_2d:class extends Nh{getPointerData(){return{size:2,type:this.gl.FLOAT,normalize:!0,stride:0,offset:0}}}};var Fh=function(t,e,n){const i=Mh[t];if(!i)throw new Error(`${t} is not a attribute name,choose from list: ${Object.keys(Mh)}`);return new i(t,e,n)};let Ch=class{constructor(t,e){this.gl=e.gl,this.program=e.program,this.location=this.gl.getUniformLocation(this.program,t)}compute(){return this}set(){return this}},Oh=class extends Ch{set(t){this.gl.uniform1fv(this.location,t)}},Ph=class extends Ch{set(t){t&&(t.beforeUse(),this.gl.uniform1i(this.location,t.getUnit()))}};const Rh="first_texture_dimensions",Dh="viewport_dimensions",Lh="time",Bh={RUNTIME_OPTIONS:"runtimeOptions[0]",STATIC_OPTIONS:"staticOptions[0]",FIRST_TEXTURE:"first_texture",SECOND_TEXTURE:"second_texture",FIRST_MATRIX:"first_mat4"},zh={[Bh.FIRST_TEXTURE]:Ph,[Bh.SECOND_TEXTURE]:Ph,[Bh.FIRST_MATRIX]:class extends Ch{set(t){this.gl.uniformMatrix4fv(this.location,!1,t)}},[Bh.STATIC_OPTIONS]:Oh,[Bh.RUNTIME_OPTIONS]:Oh};var Wh=function(t,e){const n=zh[t];if(!n)throw new Error(`${t} is not a attribute name,choose from list: ${Object.keys(zh)}`);return new n(t,e)},$h=function(t,e){let n=(Date.now()-t||0)/(e||1);return n=Number.parseFloat(n).toFixed(7),n=Math.min(1,n),n};const jh="position_3d",Uh="position_indexes",qh="texture_coordinate_2d";class Vh{constructor(t,e,n,i){this.type=t,this.gl=i.gl,this.frameBuffer=i.frameBufferFactory.create(t),this.rebindAttributesOnProgramSwitch=!1!==i.rebindAttributesOnProgramSwitch,this.vertexShader=bh(this.gl,e.vertex),this.fragmentShader=kh(this.gl,e.fragment),this.program=xh(this.gl,this.vertexShader,this.fragmentShader);const r={gl:this.gl,program:this.program};this.attributes=function(t,e){const n={};return t=t||[],(t=[{id:jh,bindPoint:e.gl.ARRAY_BUFFER},{id:Uh,bindPoint:e.gl.ELEMENT_ARRAY_BUFFER},{id:qh,bindPoint:e.gl.ARRAY_BUFFER}].concat(t)).forEach((t=>{const i=t.id;n[i]=Fh(i,t.bindPoint,e)})),n}(n.attributes,r),this.uniforms=function(t,e){const n={};return(t=t||[]).forEach((t=>{const i=t.id;n[i]=Wh(i,e)})),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 e=[{id:Bh.RUNTIME_OPTIONS},{id:Bh.STATIC_OPTIONS}];return(t.getUniformList||Vh.getUniformList)().forEach((t=>{Object.values(Bh).includes(t)&&e.push({id:t})})),e}handleRuntimeUniforms(t,e){const{inputTextures:n,viewportDimensions:i}=t;let r=Array.isArray(n)?n:[n],o=[];(this.constructor.getUniformList||Vh.getUniformList)().forEach((t=>{switch(t){case Bh.FIRST_TEXTURE:this.uniforms[Bh.FIRST_TEXTURE].set(r[0]);break;case Bh.SECOND_TEXTURE:this.uniforms[Bh.SECOND_TEXTURE].set(r[1]);break;case Rh:o=[...o,r[0].getWidth(),r[0].getHeight()];break;case Dh:o=[...o,i.width,i.height];break;case Lh:{const t=$h(e.startTime,e.duration);o=[...o,t];break}}})),o.length>0&&this.uniforms[Bh.RUNTIME_OPTIONS].set(o)}static getUniformList(){return[Bh.FIRST_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(){}handleAttributes(){this.attributes[jh].fillBuffer(_h),this.attributes[jh].setPointer(),this.attributes[Uh].fillBuffer(Th),this.attributes[qh].fillBuffer(Eh),this.attributes[qh].setPointer()}disposeAttributes(){Object.values(this.attributes).forEach((t=>{t.dispose()}))}render(t,e){const n=this.frameBuffer.bind(t);let i={width:hh,height:fh};return this.gl.useProgram(this.program),this.rebindAttributesOnProgramSwitch&&this.gl.__shaderGraphLastProgram!==this.program&&(this.handleAttributes(),this.gl.__shaderGraphLastProgram=this.program),this.handleRuntimeUniforms({inputTextures:t,viewportDimensions:i},e),this.draw(),n}draw(){const t=this.gl.TRIANGLES,e=this.gl.UNSIGNED_SHORT;this.gl.drawElements(t,6,e,0)}updateStaticUniforms(t){this.gl.useProgram(this.program),this.handleStaticUniforms(t)}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 Gh,Hh="undefined"!=typeof Float32Array?Float32Array:Array;function Kh(){var t=new Hh(3);return Hh!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Xh(t,e,n){var i=new Hh(3);return i[0]=t,i[1]=e,i[2]=n,i}function Yh(){var t=new Hh(4);return Hh!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}Kh(),function(){var t;t=new Hh(4),Hh!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}(),Kh(),Xh(1,0,0),Xh(0,1,0),Yh(),Yh(),Gh=new Hh(9),Hh!=Float32Array&&(Gh[1]=0,Gh[2]=0,Gh[3]=0,Gh[5]=0,Gh[6]=0,Gh[7]=0),Gh[0]=1,Gh[4]=1,Gh[8]=1;class Qh extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(Qh)};super(Qh.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}"},e,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:Qh.getInitialOptions().translate.x},{properties:["translate","y"],type:"slider",minValue:-2,maxValue:2,step:.001,initialValue:Qh.getInitialOptions().translate.y},{properties:["scale","x"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:Qh.getInitialOptions().scale.x},{properties:["scale","y"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:Qh.getInitialOptions().scale.y},{properties:["rotate"],type:"slider",minValue:-360,maxValue:360,step:1,initialValue:Qh.getInitialOptions().rotate}]}static getUniformList(){return[Bh.FIRST_TEXTURE,Bh.FIRST_MATRIX]}handleStaticUniforms(t){if(!t||!t.translate||!t.scale)throw new Error(`bad options object for Transform filter, check ${t}`);const e=Number.parseFloat(t.translate.x).toFixed(7),n=-1*Number.parseFloat(t.translate.y).toFixed(7),i=Number.parseFloat(t.scale.x).toFixed(7),r=Number.parseFloat(t.scale.y).toFixed(7),o=t.rotate||0;var s;this.transformMatrix=function(t,e,n,i){var r=e[0],o=e[1],s=e[2],a=e[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 t[0]=(1-(p+v))*k,t[1]=(h+b)*k,t[2]=(f-y)*k,t[3]=0,t[4]=(h-b)*w,t[5]=(1-(d+v))*w,t[6]=(m+g)*w,t[7]=0,t[8]=(f+y)*x,t[9]=(m-g)*x,t[10]=(1-(d+p))*x,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}((s=new Hh(16),Hh!=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(t,e,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"zyx",o=Math.PI/360;e*=o,i*=o,n*=o;var s=Math.sin(e),a=Math.cos(e),l=Math.sin(n),c=Math.cos(n),u=Math.sin(i),d=Math.cos(i);switch(r){case"xyz":t[0]=s*c*d+a*l*u,t[1]=a*l*d-s*c*u,t[2]=a*c*u+s*l*d,t[3]=a*c*d-s*l*u;break;case"xzy":t[0]=s*c*d-a*l*u,t[1]=a*l*d-s*c*u,t[2]=a*c*u+s*l*d,t[3]=a*c*d+s*l*u;break;case"yxz":t[0]=s*c*d+a*l*u,t[1]=a*l*d-s*c*u,t[2]=a*c*u-s*l*d,t[3]=a*c*d+s*l*u;break;case"yzx":t[0]=s*c*d+a*l*u,t[1]=a*l*d+s*c*u,t[2]=a*c*u-s*l*d,t[3]=a*c*d-s*l*u;break;case"zxy":t[0]=s*c*d-a*l*u,t[1]=a*l*d+s*c*u,t[2]=a*c*u+s*l*d,t[3]=a*c*d-s*l*u;break;case"zyx":t[0]=s*c*d-a*l*u,t[1]=a*l*d+s*c*u,t[2]=a*c*u-s*l*d,t[3]=a*c*d+s*l*u;break;default:throw new Error("Unknown angle order "+r)}return t}(Yh(),0,0,o),Xh(e,n,0),Xh(i,r,1)),this.uniforms[Bh.FIRST_MATRIX].set(this.transformMatrix)}}class Jh extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(Jh)};super(Jh.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}"},e,t)}static getFilterType(){return"horizontalBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[Bh.FIRST_TEXTURE,Rh]}}class Zh extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(Zh)};super(Zh.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}"},e,t)}static getFilterType(){return"verticalBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[Bh.FIRST_TEXTURE,Rh]}}class tf extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(tf)};super(tf.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}"},e,t)}static getFilterType(){return"fastBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[Bh.FIRST_TEXTURE,Rh,Dh]}handleStaticUniforms(t){var e;const n=(null!==(e=Number.parseFloat(t.offsetDist))&&void 0!==e?e:4).toFixed(3);this.uniforms[Bh.STATIC_OPTIONS].set([n])}}class ef extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(ef)};super(ef.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}"},e,t)}static getFilterType(){return"directionalBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[Bh.FIRST_TEXTURE,Rh,Dh]}handleStaticUniforms(t){var e,n;const i=(null!==(e=Number.parseFloat(t.angle))&&void 0!==e?e:90).toFixed(3),r=(null!==(n=Number.parseFloat(t.strength))&&void 0!==n?n:.1).toFixed(3);this.uniforms[Bh.STATIC_OPTIONS].set([i,r])}}class nf extends Vh{constructor(t){const e={uniforms:Vh.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}",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}"},e,t)}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(t){const e=Number.parseFloat(t.power).toFixed(7);this.uniforms[Bh.STATIC_OPTIONS].set([e])}}class rf extends Vh{constructor(t){const e={uniforms:Vh.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;\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}"},e,t)}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[Bh.FIRST_TEXTURE,Rh,Bh.SECOND_TEXTURE]}handleStaticUniforms(t){let e;switch(t.type){case"box":e=0;break;case"rounded":e=1;break;default:throw new Error("cant recognize shape composite mask type")}const n=Number.parseFloat(t.center.x).toFixed(7);let i=Number.parseFloat(t.center.y).toFixed(7);i+=0;const r=Number.parseFloat(t.area.width).toFixed(7),o=Number.parseFloat(t.area.height).toFixed(7),s=Number.parseFloat(t.radius).toFixed(7),a=Number.parseFloat(t.edgeSoftness).toFixed(7);this.uniforms[Bh.STATIC_OPTIONS].set([e,n,i,r,o,s,a])}}class of extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(of)};super(of.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}"},e,t)}static getFilterType(){return"shapeComposite"}static getInputsCount(){return 2}static getInitialOptions(){return{}}static getUniformList(){return[Bh.FIRST_TEXTURE,Bh.SECOND_TEXTURE]}}class sf extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(sf)};super(sf.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"},e,t)}static getFilterType(){return"lut"}static getInputsCount(){return 2}static getInitialOptions(){return{}}static getUniformList(){return[Bh.FIRST_TEXTURE,Bh.SECOND_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(t){const e=Number.parseFloat(t.lutSize).toFixed(1);this.uniforms[Bh.STATIC_OPTIONS].set([e])}}var af="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",lf='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:cf,cos:uf,sin:df,acos:hf,atan2:ff,sqrt:pf,pow:mf}=Math;function vf(t){return t<0?-mf(-t,1/3):mf(t,1/3)}const gf=Math.PI,yf=2*gf,bf=gf/2,kf=Number.MAX_SAFE_INTEGER||9007199254740991,wf=Number.MIN_SAFE_INTEGER||-9007199254740991,xf={x:0,y:0,z:0},_f={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(t,e){const n=e(t);let i=n.x*n.x+n.y*n.y;return void 0!==n.z&&(i+=n.z*n.z),pf(i)},compute:function(t,e,n){if(0===t)return e[0].t=0,e[0];const i=e.length-1;if(1===t)return e[i].t=1,e[i];const r=1-t;let o=e;if(0===i)return e[0].t=t,e[0];if(1===i){const e={x:r*o[0].x+t*o[1].x,y:r*o[0].y+t*o[1].y,t:t};return n&&(e.z=r*o[0].z+t*o[1].z),e}if(i<4){let e,s,a,l=r*r,c=t*t,u=0;2===i?(o=[o[0],o[1],o[2],xf],e=l,s=r*t*2,a=c):3===i&&(e=l*r,s=l*t*3,a=r*c*3,u=t*c);const d={x:e*o[0].x+s*o[1].x+a*o[2].x+u*o[3].x,y:e*o[0].y+s*o[1].y+a*o[2].y+u*o[3].y,t:t};return n&&(d.z=e*o[0].z+s*o[1].z+a*o[2].z+u*o[3].z),d}const s=JSON.parse(JSON.stringify(e));for(;s.length>1;){for(let e=0;e<s.length-1;e++)s[e]={x:s[e].x+(s[e+1].x-s[e].x)*t,y:s[e].y+(s[e+1].y-s[e].y)*t},void 0!==s[e].z&&(s[e].z=s[e].z+(s[e+1].z-s[e].z)*t);s.splice(s.length-1,1)}return s[0].t=t,s[0]},computeWithRatios:function(t,e,n,i){const r=1-t,o=n,s=e;let a,l=o[0],c=o[1],u=o[2],d=o[3];return l*=r,c*=t,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:t}):(l*=r,c*=2*r,u*=t*t,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:t}):(l*=r,c*=1.5*r,u*=3*r,d*=t*t*t,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:t}):void 0))},derive:function(t,e){const n=[];for(let i=t,r=i.length,o=r-1;r>1;r--,o--){const t=[];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)},e&&(n.z=o*(i[r+1].z-i[r].z)),t.push(n);n.push(t),i=t}return n},between:function(t,e,n){return e<=t&&t<=n||_f.approximately(t,e)||_f.approximately(t,n)},approximately:function(t,e,n){return cf(t-e)<=(n||1e-6)},length:function(t){const e=_f.Tvalues.length;let n=0;for(let i,r=0;r<e;r++)i=.5*_f.Tvalues[r]+.5,n+=_f.Cvalues[r]*_f.arcfn(i,t);return.5*n},map:function(t,e,n,i,r){return i+(t-e)/(n-e)*(r-i)},lerp:function(t,e,n){const i={x:e.x+t*(n.x-e.x),y:e.y+t*(n.y-e.y)};return void 0!==e.z&&void 0!==n.z&&(i.z=e.z+t*(n.z-e.z)),i},pointToString:function(t){let e=t.x+"/"+t.y;return void 0!==t.z&&(e+="/"+t.z),e},pointsToString:function(t){return"["+t.map(_f.pointToString).join(", ")+"]"},copy:function(t){return JSON.parse(JSON.stringify(t))},angle:function(t,e,n){const i=e.x-t.x,r=e.y-t.y,o=n.x-t.x,s=n.y-t.y;return ff(i*s-r*o,i*o+r*s)},round:function(t,e){const n=""+t,i=n.indexOf(".");return parseFloat(n.substring(0,i+1+e))},dist:function(t,e){const n=t.x-e.x,i=t.y-e.y;return pf(n*n+i*i)},closest:function(t,e){let n,i,r=mf(2,63);return t.forEach((function(t,o){i=_f.dist(e,t),i<r&&(r=i,n=o)})),{mdist:r,mpos:n}},abcratio:function(t,e){if(2!==e&&3!==e)return!1;if(void 0===t)t=.5;else if(0===t||1===t)return t;const n=mf(t,e)+mf(1-t,e);return cf((n-1)/n)},projectionratio:function(t,e){if(2!==e&&3!==e)return!1;if(void 0===t)t=.5;else if(0===t||1===t)return t;const n=mf(1-t,e);return n/(mf(t,e)+n)},lli8:function(t,e,n,i,r,o,s,a){const l=(t-n)*(o-a)-(e-i)*(r-s);return 0!=l&&{x:((t*i-e*n)*(r-s)-(t-n)*(r*a-o*s))/l,y:((t*i-e*n)*(o-a)-(e-i)*(r*a-o*s))/l}},lli4:function(t,e,n,i){const r=t.x,o=t.y,s=e.x,a=e.y,l=n.x,c=n.y,u=i.x,d=i.y;return _f.lli8(r,o,s,a,l,c,u,d)},lli:function(t,e){return _f.lli4(t,t.c,e,e.c)},makeline:function(t,e){return new Of(t.x,t.y,(t.x+e.x)/2,(t.y+e.y)/2,e.x,e.y)},findbbox:function(t){let e=kf,n=kf,i=wf,r=wf;return t.forEach((function(t){const o=t.bbox();e>o.x.min&&(e=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:e,mid:(e+i)/2,max:i,size:i-e},y:{min:n,mid:(n+r)/2,max:r,size:r-n}}},shapeintersections:function(t,e,n,i,r){if(!_f.bboxoverlap(e,i))return[];const o=[],s=[t.startcap,t.forward,t.back,t.endcap],a=[n.startcap,n.forward,n.back,n.endcap];return s.forEach((function(e){e.virtual||a.forEach((function(i){if(i.virtual)return;const s=e.intersects(i,r);s.length>0&&(s.c1=e,s.c2=i,s.s1=t,s.s2=n,o.push(s))}))})),o},makeshape:function(t,e,n){const i=e.points.length,r=t.points.length,o=_f.makeline(e.points[i-1],t.points[0]),s=_f.makeline(t.points[r-1],e.points[0]),a={startcap:o,forward:t,back:e,endcap:s,bbox:_f.findbbox([o,t,e,s]),intersections:function(t){return _f.shapeintersections(a,a.bbox,t,t.bbox,n)}};return a},getminmax:function(t,e,n){if(!n)return{min:0,max:0};let i,r,o=kf,s=wf;-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=t.get(i),r[e]<o&&(o=r[e]),r[e]>s&&(s=r[e]);return{min:o,mid:(o+s)/2,max:s,size:s-o}},align:function(t,e){const n=e.p1.x,i=e.p1.y,r=-ff(e.p2.y-i,e.p2.x-n);return t.map((function(t){return{x:(t.x-n)*uf(r)-(t.y-i)*df(r),y:(t.x-n)*df(r)+(t.y-i)*uf(r)}}))},roots:function(t,e){e=e||{p1:{x:0,y:0},p2:{x:1,y:0}};const n=t.length-1,i=_f.align(t,e),r=function(t){return 0<=t&&t<=1};if(2===n){const t=i[0].y,e=i[1].y,n=i[2].y,o=t-2*e+n;if(0!==o){const i=-pf(e*e-t*n),s=-t+e;return[-(i+s)/o,-(-i+s)/o].filter(r)}return e!==n&&0===o?[(2*e-n)/(2*e-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(_f.approximately(l,0)){if(_f.approximately(c,0))return _f.approximately(u,0)?[]:[-d/u].filter(r);const t=pf(u*u-4*c*d),e=2*c;return[(t-u)/e,(-u-t)/e].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 t=-h/3,e=pf(t*t*t),n=-p/(2*e),i=hf(n<-1?-1:n>1?1:n),o=2*vf(e);return b=o*uf(i/3)-c/3,k=o*uf((i+yf)/3)-c/3,w=o*uf((i+2*yf)/3)-c/3,[b,k,w].filter(r)}if(0===v)return g=m<0?vf(-m):-vf(m),b=2*g-c/3,k=-g-c/3,[b,k].filter(r);{const t=pf(v);return g=vf(-m+t),y=vf(m+t),[g-y-c/3].filter(r)}},droots:function(t){if(3===t.length){const e=t[0],n=t[1],i=t[2],r=e-2*n+i;if(0!==r){const t=-pf(n*n-e*i),o=-e+n;return[-(t+o)/r,-(-t+o)/r]}return n!==i&&0===r?[(2*n-i)/(2*(n-i))]:[]}if(2===t.length){const e=t[0],n=t[1];return e!==n?[e/(e-n)]:[]}return[]},curvature:function(t,e,n,i,r){let o,s,a,l,c=0,u=0;const d=_f.compute(t,e),h=_f.compute(t,n),f=d.x*d.x+d.y*d.y;if(i?(o=pf(mf(d.y*h.z-h.y*d.z,2)+mf(d.z*h.x-h.z*d.x,2)+mf(d.x*h.y-h.x*d.y,2)),s=mf(f+d.z*d.z,1.5)):(o=d.x*h.y-d.y*h.x,s=mf(f,1.5)),0===o||0===s)return{k:0,r:0};if(c=o/s,u=s/o,!r){const r=_f.curvature(t-.001,e,n,i,!0).k,o=_f.curvature(t+.001,e,n,i,!0).k;l=(o-c+(c-r))/2,a=(cf(o-c)+cf(c-r))/2}return{k:c,r:u,dk:l,adk:a}},inflections:function(t){if(t.length<4)return[];const e=_f.align(t,{p1:t[0],p2:t.slice(-1)[0]}),n=e[2].x*e[1].y,i=e[3].x*e[1].y,r=e[1].x*e[2].y,o=18*(-3*n+2*i+3*r-e[3].x*e[2].y),s=18*(3*n-i-3*r),a=18*(r-n);if(_f.approximately(o,0)){if(!_f.approximately(s,0)){let t=-a/s;if(0<=t&&t<=1)return[t]}return[]}const l=2*o;if(_f.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(t){return 0<=t&&t<=1}))},bboxoverlap:function(t,e){const n=["x","y"],i=n.length;for(let r,o,s,a,l=0;l<i;l++)if(r=n[l],o=t[r].mid,s=e[r].mid,a=(t[r].size+e[r].size)/2,cf(o-s)>=a)return!1;return!0},expandbox:function(t,e){e.x.min<t.x.min&&(t.x.min=e.x.min),e.y.min<t.y.min&&(t.y.min=e.y.min),e.z&&e.z.min<t.z.min&&(t.z.min=e.z.min),e.x.max>t.x.max&&(t.x.max=e.x.max),e.y.max>t.y.max&&(t.y.max=e.y.max),e.z&&e.z.max>t.z.max&&(t.z.max=e.z.max),t.x.mid=(t.x.min+t.x.max)/2,t.y.mid=(t.y.min+t.y.max)/2,t.z&&(t.z.mid=(t.z.min+t.z.max)/2),t.x.size=t.x.max-t.x.min,t.y.size=t.y.max-t.y.min,t.z&&(t.z.size=t.z.max-t.z.min)},pairiteration:function(t,e,n){const i=t.bbox(),r=e.bbox(),o=1e5,s=n||.5;if(i.x.size+i.y.size<s&&r.x.size+r.y.size<s)return[(o*(t._t1+t._t2)/2|0)/o+"/"+(o*(e._t1+e._t2)/2|0)/o];let a=t.split(.5),l=e.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(t){return _f.bboxoverlap(t.left.bbox(),t.right.bbox())}));let u=[];return 0===c.length||(c.forEach((function(t){u=u.concat(_f.pairiteration(t.left,t.right,s))})),u=u.filter((function(t,e){return u.indexOf(t)===e}))),u},getccenter:function(t,e,n){const i=e.x-t.x,r=e.y-t.y,o=n.x-e.x,s=n.y-e.y,a=i*uf(bf)-r*df(bf),l=i*df(bf)+r*uf(bf),c=o*uf(bf)-s*df(bf),u=o*df(bf)+s*uf(bf),d=(t.x+e.x)/2,h=(t.y+e.y)/2,f=(e.x+n.x)/2,p=(e.y+n.y)/2,m=d+a,v=h+l,g=f+c,y=p+u,b=_f.lli8(d,h,m,v,f,p,g,y),k=_f.dist(b,t);let w,x=ff(t.y-b.y,t.x-b.x),_=ff(e.y-b.y,e.x-b.x),T=ff(n.y-b.y,n.x-b.x);return x<T?((x>_||_>T)&&(x+=yf),x>T&&(w=T,T=x,x=w)):T<_&&_<x?(w=T,T=x,x=w):T+=yf,b.s=x,b.e=T,b.r=k,b},numberSort:function(t,e){return t-e}};class Tf{constructor(t){this.curves=[],this._3d=!1,t&&(this.curves=t,this._3d=this.curves[0]._3d)}valueOf(){return this.toString()}toString(){return"["+this.curves.map((function(t){return _f.pointsToString(t.points)})).join(", ")+"]"}addCurve(t){this.curves.push(t),this._3d=this._3d||t._3d}length(){return this.curves.map((function(t){return t.length()})).reduce((function(t,e){return t+e}))}curve(t){return this.curves[t]}bbox(){const t=this.curves;for(var e=t[0].bbox(),n=1;n<t.length;n++)_f.expandbox(e,t[n].bbox());return e}offset(t){const e=[];return this.curves.forEach((function(n){e.push(...n.offset(t))})),new Tf(e)}}const{abs:Ef,min:If,max:Sf,cos:Af,sin:Nf,acos:Mf,sqrt:Ff}=Math,Cf=Math.PI;let Of=class e{constructor(t){let e=t&&t.forEach?t:Array.from(arguments).slice(),n=!1;if("object"==typeof e[0]){n=e.length;const t=[];e.forEach((function(e){["x","y","z"].forEach((function(n){void 0!==e[n]&&t.push(e[n])}))})),e=t}let i=!1;const r=e.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)||t&&t[0]&&void 0!==t[0].z,s=this.points=[];for(let t=0,n=o?3:2;t<r;t+=n){var a={x:e[t],y:e[t+1]};o&&(a.z=e[t+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=_f.align(s,{p1:s[0],p2:s[l]}),d=_f.dist(s[0],s[l]);this._linear=u.reduce(((t,e)=>t+Ef(e.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=_f.dist(n,s.C));const a=o*(1-r)/r,l=_f.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},E={x:i.x+(x-i.x)/(1-r),y:i.y+(_-i.y)/(1-r)};return new e(t,T,E,i)}static getUtils(){return _f}getUtils(){return e.getUtils()}static get PolyBezier(){return Tf}valueOf(){return this.toString()}toString(){return _f.pointsToString(this.points)}toSVG(){if(this._3d)return!1;const t=this.points,e=["M",t[0].x,t[0].y,2===this.order?"Q":"C"];for(let n=1,i=t.length;n<i;n++)e.push(t[n].x),e.push(t[n].y);return e.join(" ")}setRatios(t){if(t.length!==this.points.length)throw new Error("incorrect number of ratio values");this.ratios=t,this._lut=[]}verify(){const t=this.coordDigest();t!==this._print&&(this._print=t,this.update())}coordDigest(){return this.points.map((function(t,e){return""+e+t.x+t.y+(t.z?t.z:0)})).join("")}update(){this._lut=[],this.dpoints=_f.derive(this.points,this._3d),this.computedirection()}computedirection(){const t=this.points,e=_f.angle(t[0],t[this.order],t[1]);this.clockwise=e>0}length(){return _f.length(this.derivative.bind(this))}static getABC(t=2,e,n,i,r=.5){const o=_f.projectionratio(r,t),s=1-o,a={x:o*e.x+s*i.x,y:o*e.y+s*i.y},l=_f.abcratio(r,t);return{A:{x:n.x+(n.x-a.x)/l,y:n.y+(n.y-a.y)/l},B:n,C:a,S:e,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(t){if(this.verify(),t=t||100,this._lut.length===t+1)return this._lut;this._lut=[],t++,this._lut=[];for(let e,n,i=0;i<t;i++)n=i/(t-1),e=this.compute(n),e.t=n,this._lut.push(e);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],_f.dist(t,e)<n&&(r.push(t),s+=o/i.length);return!!r.length&&(t/=r.length)}project(t){const e=this.getLUT(),n=e.length-1,i=_f.closest(e,t),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 e;u<s+a;u+=a)l=this.compute(u),e=_f.dist(t,l),e<c&&(c=e,d=u);return d=d<0?0:d>1?1:d,l=this.compute(d),l.t=d,l.d=c,l}get(t){return this.compute(t)}point(t){return this.points[t]}compute(t){return this.ratios?_f.computeWithRatios(t,this.points,this.ratios,this._3d):_f.compute(t,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(t){return _f.compute(t,this.dpoints[0],this._3d)}dderivative(t){return _f.compute(t,this.dpoints[1],this._3d)}align(){let t=this.points;return new e(_f.align(t,{p1:t[0],p2:t[t.length-1]}))}curvature(t){return _f.curvature(t,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return _f.inflections(this.points)}normal(t){return this._3d?this.__normal3(t):this.__normal2(t)}__normal2(t){const e=this.derivative(t),n=Ff(e.x*e.x+e.y*e.y);return{t:t,x:-e.y/n,y:e.x/n}}__normal3(t){const e=this.derivative(t),n=this.derivative(t+.01),i=Ff(e.x*e.x+e.y*e.y+e.z*e.z),r=Ff(n.x*n.x+n.y*n.y+n.z*n.z);e.x/=i,e.y/=i,e.z/=i,n.x/=r,n.y/=r,n.z/=r;const o={x:n.y*e.z-n.z*e.y,y:n.z*e.x-n.x*e.z,z:n.x*e.y-n.y*e.x},s=Ff(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:t,x:a[0]*e.x+a[1]*e.y+a[2]*e.z,y:a[3]*e.x+a[4]*e.y+a[5]*e.z,z:a[6]*e.x+a[7]*e.y+a[8]*e.z}}hull(t){let e=this.points,n=[],i=[],r=0;for(i[r++]=e[0],i[r++]=e[1],i[r++]=e[2],3===this.order&&(i[r++]=e[3]);e.length>1;){n=[];for(let o,s=0,a=e.length-1;s<a;s++)o=_f.lerp(t,e[s],e[s+1]),i[r++]=o,n.push(o);e=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=_f.map(0,0,1,this._t1,this._t2),r.left._t2=_f.map(t,0,1,this._t1,this._t2),r.right._t1=_f.map(t,0,1,this._t1,this._t2),r.right._t2=_f.map(1,0,1,this._t1,this._t2),n?(n=_f.map(n,t,1,0,1),r.right.split(n).left):r}extrema(){const t={};let e=[];return this.dims.forEach(function(n){let i=function(t){return t[n]},r=this.dpoints[0].map(i);t[n]=_f.droots(r),3===this.order&&(r=this.dpoints[1].map(i),t[n]=t[n].concat(_f.droots(r))),t[n]=t[n].filter((function(t){return t>=0&&t<=1})),e=e.concat(t[n].sort(_f.numberSort))}.bind(this)),t.values=e.sort(_f.numberSort).filter((function(t,n){return e.indexOf(t)===n})),t}bbox(){const t=this.extrema(),e={};return this.dims.forEach(function(n){e[n]=_f.getminmax(this,n,t[n])}.bind(this)),e}overlaps(t){const e=this.bbox(),n=t.bbox();return _f.bboxoverlap(e,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 t=_f.angle(this.points[0],this.points[3],this.points[1]),e=_f.angle(this.points[0],this.points[3],this.points[2]);if(t>0&&e<0||t<0&&e>0)return!1}const t=this.normal(0),e=this.normal(1);let n=t.x*e.x+t.y*e.y;return this._3d&&(n+=t.z*e.z),Ef(Mf(n))<Cf/3}reduce(){let t,e,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],t=1;t<a.length;t++)i=a[t],e=this.split(n,i),e._t1=n,e._t2=i,o.push(e),n=i;return o.forEach((function(t){for(n=0,i=0;i<=1;)for(i=n+r;i<=1.01;i+=r)if(e=t.split(n,i),!e.simple()){if(i-=r,Ef(n-i)<r)return[];e=t.split(n,i),e._t1=_f.map(n,0,1,t._t1,t._t2),e._t2=_f.map(i,0,1,t._t1,t._t2),s.push(e),n=i;break}n<1&&(e=t.split(n,1),e._t1=_f.map(n,0,1,t._t1,t._t2),e._t2=t._t2,s.push(e))})),s}translate(t,n,i){i="number"==typeof i?i:n;const r=this.order;let o=this.points.map(((t,e)=>(1-e/r)*n+e/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=_f.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(t){const e=c[t*n]=_f.copy(o[t*n]);e.x+=(t?a:s)*l[t].n.x,e.y+=(t?a:s)*l[t].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=Ff(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((t=>{if(2===n&&t)return;const e=c[t*n],i=this.derivative(t),r={x:e.x+i.x,y:e.y+i.y};c[t+1]=_f.lli4(e,r,u,o[t+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=_f.makeline(h[2],d[0]),p=_f.makeline(d[2],h[0]),m=[f,new e(d),p,new e(h)];return new Tf(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(t,e,n,i,r){return function(o){const s=i/n,a=(i+r)/n,l=e-t;return _f.map(o,0,1,t+s*l,t+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(t){return l=t.points,l[3]?t.points=[l[3],l[2],l[1],l[0]]:t.points=[l[2],l[1],l[0]],t})).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=_f.makeline(v,p),b=_f.makeline(m,g),k=[y].concat(a).concat([b]).concat(c);return new Tf(k)}outlineshapes(t,e,n){e=e||t;const i=this.outline(t,e).curves,r=[];for(let t=1,e=i.length;t<e/2;t++){const o=_f.makeshape(i[t],i[e-t],n);o.startcap.virtual=t>1,o.endcap.virtual=t<e/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(t){const e=If(t.p1.x,t.p2.x),n=If(t.p1.y,t.p2.y),i=Sf(t.p1.x,t.p2.x),r=Sf(t.p1.y,t.p2.y);return _f.roots(this.points,t).filter((t=>{var o=this.get(t);return _f.between(o.x,e,i)&&_f.between(o.y,n,r)}))}selfintersects(t){const e=this.reduce(),n=e.length-2,i=[];for(let r,o,s,a=0;a<n;a++)o=e.slice(a,a+1),s=e.slice(a+2),r=this.curveintersects(o,s,t),i.push(...r);return i}curveintersects(t,e,n){const i=[];t.forEach((function(t){e.forEach((function(e){t.overlaps(e)&&i.push({left:t,right:e})}))}));let r=[];return i.forEach((function(t){const e=_f.pairiteration(t.left,t.right,n);e.length>0&&(r=r.concat(e))})),r}arcs(t){return t=t||.5,this._iterate(t,[])}_error(t,e,n,i){const r=(i-n)/4,o=this.get(n+r),s=this.get(i-r),a=_f.dist(t,e),l=_f.dist(t,o),c=_f.dist(t,s);return Ef(l-a)+Ef(c-a)}_iterate(t,e){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=_f.getccenter(u,o,s),a.interval={start:i,end:r},d=this._error(a,u,i,r)<=t,c=h&&!d,c||(p=r),d){if(r>=1){if(a.interval.end=p=1,l=a,r>1){let t={x:a.x+a.r*Af(a.e),y:a.y+a.r*Nf(a.e)};a.e+=_f.angle({x:a.x,y:a.y},t,this.get(1))}break}r+=(r-i)/2}else r=f}while(!c&&n++<100);if(n>=100)break;l=l||a,e.push(l),i=p}while(r<1);return e}};var Pf={pointsToCurve:function(t,e){let n=1/e;if(0===t.length){let t=[];for(let i=0;i<e;i++){let e=i*n;t.push({x:e,y:.5})}return t}if(1===t.length){let i=t[0].y,r=[{x:0,y:i}];for(let t=0;t<e;t++){let e=t*n+n;r.push({x:e,y:i})}return r}let i=[],r=t[0],o=t[t.length-1],s=new Of({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 Of(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 e=0;e<t.length-1;e++){let n=t[e],r=t[e+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 Of(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 t=0;t<e;t++){let e,r=t*n+n;i.every((t=>{let n=t.intersects({p1:{x:r,y:0},p2:{x:r,y:1}});return!(n.length>0&&(e=t.get(n[0]),l.push(e),1))}))}return l}};class Rf{constructor(t,e){this.xs=t,this.ys=e,this.ks=this.getNaturalKs(new Float64Array(this.xs.length))}getNaturalKs(t){const e=this.xs.length-1,n=function(t,e){const n=[];for(let i=0;i<t;i++)n.push(new Float64Array(e));return n}(e+1,e+2);for(let t=1;t<e;t++)n[t][t-1]=1/(this.xs[t]-this.xs[t-1]),n[t][t]=2*(1/(this.xs[t]-this.xs[t-1])+1/(this.xs[t+1]-this.xs[t])),n[t][t+1]=1/(this.xs[t+1]-this.xs[t]),n[t][e+1]=3*((this.ys[t]-this.ys[t-1])/((this.xs[t]-this.xs[t-1])*(this.xs[t]-this.xs[t-1]))+(this.ys[t+1]-this.ys[t])/((this.xs[t+1]-this.xs[t])*(this.xs[t+1]-this.xs[t])));return n[0][0]=2/(this.xs[1]-this.xs[0]),n[0][1]=1/(this.xs[1]-this.xs[0]),n[0][e+1]=3*(this.ys[1]-this.ys[0])/((this.xs[1]-this.xs[0])*(this.xs[1]-this.xs[0])),n[e][e-1]=1/(this.xs[e]-this.xs[e-1]),n[e][e]=2/(this.xs[e]-this.xs[e-1]),n[e][e+1]=3*(this.ys[e]-this.ys[e-1])/((this.xs[e]-this.xs[e-1])*(this.xs[e]-this.xs[e-1])),function(t,e){const n=t.length;let i=0,r=0;for(;i<n&&r<=n;){let e=0,o=-1/0;for(let s=i;s<n;s++){const n=Math.abs(t[s][r]);n>o&&(e=s,o=n)}if(0===t[e][r])r++;else{Df(t,i,e);for(let e=i+1;e<n;e++){const o=t[e][r]/t[i][r];t[e][r]=0;for(let s=r+1;s<=n;s++)t[e][s]-=t[i][s]*o}i++,r++}}for(let i=n-1;i>=0;i--){var o=0;t[i][i]&&(o=t[i][n]/t[i][i]),e[i]=o;for(let e=i-1;e>=0;e--)t[e][n]-=t[e][i]*o,t[e][i]=0}return e}(n,t)}getIndexBefore(t){let e=0,n=this.xs.length,i=0;for(;e<n;)i=Math.floor((e+n)/2),this.xs[i]<t&&i!==e?e=i:n=this.xs[i]>=t&&i!==n?i:e;return e===this.xs.length-1?this.xs.length-1:e+1}at(t){let e=this.getIndexBefore(t);const n=(t-this.xs[e-1])/(this.xs[e]-this.xs[e-1]),i=this.ks[e-1]*(this.xs[e]-this.xs[e-1])-(this.ys[e]-this.ys[e-1]),r=-this.ks[e]*(this.xs[e]-this.xs[e-1])+(this.ys[e]-this.ys[e-1]);return(1-n)*this.ys[e-1]+n*this.ys[e]+n*(1-n)*(i*(1-n)+r*n)}}function Df(t,e,n){let i=t[e];t[e]=t[n],t[n]=i}function Lf(t,e,n){const i=n[0],r=n[n.length-1];if(t<i.x)return i.y;if(t>r.x)return r.y;const o=e.at(t);return Math.max(0,Math.min(o,1))}var Bf={pointsToCurve:function(t,e){if(!Array.isArray(t)||!t.every((t=>"object"==typeof t&&"number"==typeof t.x&&"number"==typeof t.y&&t.x>=0&&t.x<=1&&t.y>=0&&t.y<=1)))throw new Error("[pointsToCurve] Invalid points. Expected array of objects with x and y in [0, 1] range.");if(!("number"==typeof e&&e>=1))throw new Error(`[pointsToCurve] Invalid resolution: ${e}. Expected integer >= 1.`);const n=t.map((t=>t.x)),i=t.map((t=>t.y)),r=new Rf(n,i);let o=[];for(let n=0;n<e;n++)o.push(Lf(n/(e-1),r,t));return o}};function zf(t,e=256,n={}){return"bezier"===n.type?Pf.pointsToCurve(t,e,n):Bf.pointsToCurve(t,e)}const Wf=[];for(let t=0;t<256;t++)Wf[t]=t;class $f extends Vh{constructor(t){const e={vertex:af,fragment:lf},n={uniforms:Vh.getUniformInfo($f)};super($f.getFilterType(),e,n,t)}static getFilterType(){return"curves"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=[];var n;e=[...t.master||t.points||t.masterPoints?t.master||(n=t.points||t.masterPoints,zf(n,256).map((t=>255*t))):Wf],this.uniforms[Bh.STATIC_OPTIONS].set(e)}}function jf(t,e,n){if("number"!=typeof t||t<0||t>255)throw new Error(`[levels] Invalid black point: ${t}. Expected integer between 0 and 255`);if("number"!=typeof e||e<0||e>255)throw new Error(`[levels] Invalid white point: ${e}. 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(t>e)throw new Error(`[levels] Invalid black and white points: ${t}, ${e}. Expected black <= white`);let i=[];for(let r=0;r<256;r++){let o;o=r<=t?0:r>=e?255:255*Math.pow((r-t)/(e-t),1/n),i[r]=o}return i}class Uf extends Vh{constructor(t){const e={vertex:af,fragment:lf},n={uniforms:Vh.getUniformInfo(Uf)};super(Uf.getFilterType(),e,n,t)}static getFilterType(){return"levels"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=[...jf(t.black,t.white,t.gamma)];this.uniforms[Bh.STATIC_OPTIONS].set(e)}}const qf=360,Vf=[];for(let t=0;t<qf;t++)Vf[t]=t;class Gf extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(Gf)};super(Gf.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"},e,t)}static getFilterType(){return"hue"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=t.points&&function(t){return zf(t,qf,{type:"bezier"}).map((t=>{return e=t,((Math.round(e.x*qf)+180)%qf+(1-e.y-.5)*qf+qf)%qf;var e}))}(t.points)||Vf;this.uniforms[Bh.STATIC_OPTIONS].set(e)}}class Hf extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(Hf)};super(Hf.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"},e,t)}static getFilterType(){return"whiteBalance"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=t.temperature?t.temperature:0,n=t.tint?t.tint:0;this.uniforms[Bh.STATIC_OPTIONS].set([e,n])}}class Kf extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(Kf)};super(Kf.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"},e,t)}static getFilterType(){return"vibrance"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=t.amount?t.amount/100*2:0,n=null===t.redBalance?1:t.redBalance,i=null===t.greenBalance?1:t.greenBalance,r=null===t.blueBalance?1:t.blueBalance;this.uniforms[Bh.STATIC_OPTIONS].set([e,n,i,r])}}class Xf extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(Xf)};super(Xf.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"},e,t)}static getFilterType(){return"saturation"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=null===t.amount?1:t.amount;this.uniforms[Bh.STATIC_OPTIONS].set([e])}}class Yf extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(Yf)};super(Yf.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}"},e,t)}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[Bh.FIRST_TEXTURE,Rh,Dh]}handleStaticUniforms(t){let e={...Yf.getInitialOptions(),...t};const n=Number.parseFloat(e.source.center.x).toFixed(5),i=Number.parseFloat(e.source.center.y).toFixed(5),r=Number.parseFloat(e.source.width).toFixed(5),o=Number.parseFloat(e.source.height).toFixed(5),s=Number.parseFloat(e.target.center.x).toFixed(5),a=Number.parseFloat(e.target.center.y).toFixed(5),l=Number.parseFloat(e.target.width).toFixed(5),c=Number.parseFloat(e.target.height).toFixed(5),u=Number.parseFloat(e.edgeSoftness).toFixed(5),d=e.source.aspectRatio?Number.parseFloat(e.source.aspectRatio).toFixed(5):0;let h;h="fill"===e.fitType?0:"contain"===e.fitType?1:2;const f=Number.parseFloat(e.cornerRadius).toFixed(5);this.uniforms[Bh.STATIC_OPTIONS].set([n,i,r,o,s,a,l,c,h,f,d,u])}}class Qf extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(Qf)};super(Qf.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}"},e,t)}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(t){var e;const n=Number.parseFloat(t.color.r).toFixed(5),i=Number.parseFloat(t.color.g).toFixed(5),r=Number.parseFloat(t.color.b).toFixed(5),o=(null!==(e=Number.parseFloat(t.color.a))&&void 0!==e?e:1).toFixed(5);this.uniforms[Bh.STATIC_OPTIONS].set([n,i,r,o])}}class Jf extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(Jf)};super(Jf.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"},e,t)}static getFilterType(){return"solidImage"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}}class Zf extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(Zf)};super(Zf.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"},e,t)}static getFilterType(){return"lab"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=t.temperature?t.temperature:0,n=t.tint?t.tint:0;this.uniforms[Bh.STATIC_OPTIONS].set([e,n])}}class tp extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(tp)};super(tp.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} "},e,t)}static getFilterType(){return"exposure"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=null===t.exposure?0:t.exposure;this.uniforms[Bh.STATIC_OPTIONS].set([e])}}var ep,np,ip,rp,op,sp,ap,lp;function cp(){if(rp)return ip;rp=1;const t=np?ep:(np=1,ep={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]}),e={};for(const n of Object.keys(t))e[t[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"]}};ip=n;for(const t of Object.keys(n)){if(!("channels"in n[t]))throw new Error("missing channels property: "+t);if(!("labels"in n[t]))throw new Error("missing channel labels property: "+t);if(n[t].labels.length!==n[t].channels)throw new Error("channel and label counts mismatch: "+t);const{channels:e,labels:i}=n[t];delete n[t].channels,delete n[t].labels,Object.defineProperty(n[t],"channels",{value:e}),Object.defineProperty(n[t],"labels",{value:i})}function i(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}return n.rgb.hsl=function(t){const e=t[0]/255,n=t[1]/255,i=t[2]/255,r=Math.min(e,n,i),o=Math.max(e,n,i),s=o-r;let a,l;o===r?a=0:e===o?a=(n-i)/s:n===o?a=2+(i-e)/s:i===o&&(a=4+(e-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(t){let e,n,i,r,o;const s=t[0]/255,a=t[1]/255,l=t[2]/255,c=Math.max(s,a,l),u=c-Math.min(s,a,l),d=function(t){return(c-t)/6/u+.5};return 0===u?(r=0,o=0):(o=u/c,e=d(s),n=d(a),i=d(l),s===c?r=i-n:a===c?r=1/3+e-i:l===c&&(r=2/3+n-e),r<0?r+=1:r>1&&(r-=1)),[360*r,100*o,100*c]},n.rgb.hwb=function(t){const e=t[0],i=t[1];let r=t[2];const o=n.rgb.hsl(t)[0],s=1/255*Math.min(e,Math.min(i,r));return r=1-1/255*Math.max(e,Math.max(i,r)),[o,100*s,100*r]},n.rgb.cmyk=function(t){const e=t[0]/255,n=t[1]/255,i=t[2]/255,r=Math.min(1-e,1-n,1-i);return[100*((1-e-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=e[n];if(r)return r;let o,s=1/0;for(const e of Object.keys(t)){const r=i(n,t[e]);r<s&&(s=r,o=e)}return o},n.keyword.rgb=function(e){return t[e]},n.rgb.xyz=function(t){let e=t[0]/255,n=t[1]/255,i=t[2]/255;return e=e>.04045?((e+.055)/1.055)**2.4:e/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*e+.3576*n+.1805*i),100*(.2126*e+.7152*n+.0722*i),100*(.0193*e+.1192*n+.9505*i)]},n.rgb.lab=function(t){const e=n.rgb.xyz(t);let i=e[0],r=e[1],o=e[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(t){const e=t[0]/360,n=t[1]/100,i=t[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 t=0;t<3;t++)o=e+1/3*-(t-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[t]=255*s;return l},n.hsl.hsv=function(t){const e=t[0];let n=t[1]/100,i=t[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,[e,100*(0===i?2*r/(o+r):2*n/(i+n)),(i+n)/2*100]},n.hsv.rgb=function(t){const e=t[0]/60,n=t[1]/100;let i=t[2]/100;const r=Math.floor(e)%6,o=e-Math.floor(e),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(t){const e=t[0],n=t[1]/100,i=t[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,[e,100*o,100*s]},n.hwb.rgb=function(t){const e=t[0]/360;let n=t[1]/100,i=t[2]/100;const r=n+i;let o;r>1&&(n/=r,i/=r);const s=Math.floor(6*e),a=1-i;o=6*e-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(t){const e=t[0]/100,n=t[1]/100,i=t[2]/100,r=t[3]/100;return[255*(1-Math.min(1,e*(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(t){const e=t[0]/100,n=t[1]/100,i=t[2]/100;let r,o,s;return r=3.2406*e+-1.5372*n+-.4986*i,o=-.9689*e+1.8758*n+.0415*i,s=.0557*e+-.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(t){let e=t[0],n=t[1],i=t[2];return e/=95.047,n/=100,i/=108.883,e=e>.008856?e**(1/3):7.787*e+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*(e-n),200*(n-i)]},n.lab.xyz=function(t){let e,n,i;n=(t[0]+16)/116,e=t[1]/500+n,i=n-t[2]/200;const r=n**3,o=e**3,s=i**3;return n=r>.008856?r:(n-16/116)/7.787,e=o>.008856?o:(e-16/116)/7.787,i=s>.008856?s:(i-16/116)/7.787,e*=95.047,n*=100,i*=108.883,[e,n,i]},n.lab.lch=function(t){const e=t[0],n=t[1],i=t[2];let r;return r=360*Math.atan2(i,n)/2/Math.PI,r<0&&(r+=360),[e,Math.sqrt(n*n+i*i),r]},n.lch.lab=function(t){const e=t[0],n=t[1],i=t[2]/360*2*Math.PI;return[e,n*Math.cos(i),n*Math.sin(i)]},n.rgb.ansi16=function(t,e=null){const[i,r,o]=t;let s=null===e?n.rgb.hsv(t)[2]:e;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(t){return n.rgb.ansi16(n.hsv.rgb(t),t[2])},n.rgb.ansi256=function(t){const e=t[0],n=t[1],i=t[2];return e===n&&n===i?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(n/255*5)+Math.round(i/255*5)},n.ansi16.rgb=function(t){let e=t%10;if(0===e||7===e)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];const n=.5*(1+~~(t>50));return[(1&e)*n*255,(e>>1&1)*n*255,(e>>2&1)*n*255]},n.ansi256.rgb=function(t){if(t>=232){const e=10*(t-232)+8;return[e,e,e]}let e;return t-=16,[Math.floor(t/36)/5*255,Math.floor((e=t%36)/6)/5*255,e%6/5*255]},n.rgb.hex=function(t){const e=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(e.length)+e},n.hex.rgb=function(t){const e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let n=e[0];3===e[0].length&&(n=n.split("").map((t=>t+t)).join(""));const i=parseInt(n,16);return[i>>16&255,i>>8&255,255&i]},n.rgb.hcg=function(t){const e=t[0]/255,n=t[1]/255,i=t[2]/255,r=Math.max(Math.max(e,n),i),o=Math.min(Math.min(e,n),i),s=r-o;let a,l;return a=s<1?o/(1-s):0,l=s<=0?0:r===e?(n-i)/s%6:r===n?2+(i-e)/s:4+(e-n)/s,l/=6,l%=1,[360*l,100*s,100*a]},n.hsl.hcg=function(t){const e=t[1]/100,n=t[2]/100,i=n<.5?2*e*n:2*e*(1-n);let r=0;return i<1&&(r=(n-.5*i)/(1-i)),[t[0],100*i,100*r]},n.hsv.hcg=function(t){const e=t[1]/100,n=t[2]/100,i=e*n;let r=0;return i<1&&(r=(n-i)/(1-i)),[t[0],100*i,100*r]},n.hcg.rgb=function(t){const e=t[0]/360,n=t[1]/100,i=t[2]/100;if(0===n)return[255*i,255*i,255*i];const r=[0,0,0],o=e%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(t){const e=t[1]/100,n=e+t[2]/100*(1-e);let i=0;return n>0&&(i=e/n),[t[0],100*i,100*n]},n.hcg.hsl=function(t){const e=t[1]/100,n=t[2]/100*(1-e)+.5*e;let i=0;return n>0&&n<.5?i=e/(2*n):n>=.5&&n<1&&(i=e/(2*(1-n))),[t[0],100*i,100*n]},n.hcg.hwb=function(t){const e=t[1]/100,n=e+t[2]/100*(1-e);return[t[0],100*(n-e),100*(1-n)]},n.hwb.hcg=function(t){const e=t[1]/100,n=1-t[2]/100,i=n-e;let r=0;return i<1&&(r=(n-i)/(1-i)),[t[0],100*i,100*r]},n.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},n.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},n.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},n.gray.hsl=function(t){return[0,0,t[0]]},n.gray.hsv=n.gray.hsl,n.gray.hwb=function(t){return[0,100,t[0]]},n.gray.cmyk=function(t){return[0,0,0,t[0]]},n.gray.lab=function(t){return[t[0],0,0]},n.gray.hex=function(t){const e=255&Math.round(t[0]/100*255),n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n},n.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]},ip}function up(){if(sp)return op;sp=1;const t=cp();function e(t,e){return function(n){return e(t(n))}}function n(n,i){const r=[i[n].parent,n];let o=t[i[n].parent][n],s=i[n].parent;for(;i[s].parent;)r.unshift(i[s].parent),o=e(t[i[s].parent][s],o),s=i[s].parent;return o.conversion=r,o}return op=function(e){const i=function(e){const n=function(){const e={},n=Object.keys(t);for(let t=n.length,i=0;i<t;i++)e[n[i]]={distance:-1,parent:null};return e}(),i=[e];for(n[e].distance=0;i.length;){const e=i.pop(),r=Object.keys(t[e]);for(let t=r.length,o=0;o<t;o++){const t=r[o],s=n[t];-1===s.distance&&(s.distance=n[e].distance+1,s.parent=e,i.unshift(t))}}return n}(e),r={},o=Object.keys(i);for(let t=o.length,e=0;e<t;e++){const t=o[e];null!==i[t].parent&&(r[t]=n(t,i))}return r}}var dp=function(){if(lp)return ap;lp=1;const t=cp(),e=up(),n={};return Object.keys(t).forEach((i=>{n[i]={},Object.defineProperty(n[i],"channels",{value:t[i].channels}),Object.defineProperty(n[i],"labels",{value:t[i].labels});const r=e(i);Object.keys(r).forEach((t=>{const e=r[t];n[i][t]=function(t){const e=function(...e){const n=e[0];if(null==n)return n;n.length>1&&(e=n);const i=t(e);if("object"==typeof i)for(let t=i.length,e=0;e<t;e++)i[e]=Math.round(i[e]);return i};return"conversion"in t&&(e.conversion=t.conversion),e}(e),n[i][t].raw=function(t){const e=function(...e){const n=e[0];return null==n?n:(n.length>1&&(e=n),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}(e)}))})),ap=n}(),hp=Du(dp);class fp extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(fp)};super(fp.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}"},e,t)}static getFilterType(){return"hardLight"}static getInputsCount(){return 1}static getInitialOptions(){return{color:"4b0082"}}getOptionsDisplay(){return[{properties:["color"],type:"colorPicker"}]}handleStaticUniforms(t){const e=hp.hex.rgb(t.color).map((t=>t/255));this.uniforms[Bh.STATIC_OPTIONS].set([e[0],e[1],e[2]])}}class pp extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(pp)};super(pp.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"},e,t)}static getFilterType(){return"exposureTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{properties:{power:{form:0,to:0,ease:[0,0,1,1]}}}}handleStaticUniforms(t){const e=t.properties.power;this.uniforms[Bh.STATIC_OPTIONS].set([e.from,e.to,...e.ease])}static getUniformList(){return[Bh.FIRST_TEXTURE,Lh]}}class mp extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(mp)};super(mp.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}"},e,t)}static getFilterType(){return"dipToBlackTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{}}handleStaticUniforms(t){const e=t.properties.power;this.uniforms[Bh.STATIC_OPTIONS].set([e.from,e.to,...e.ease])}static getUniformList(){return[Bh.FIRST_TEXTURE,Lh]}}class vp extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(vp)};super(vp.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}"},e,t)}static getFilterType(){return"transformTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{}}handleStaticUniforms(t){const e=t.properties.scale||{},n=t.properties.translate||{};e.ease=e.ease||[0,0,1,1],n.ease=n.ease||[0,0,1,1],this.uniforms[Bh.STATIC_OPTIONS].set([e.from&&e.from.x||1,e.to&&e.to.x||1,e.from&&e.from.y||1,e.to&&e.to.y||1,...e.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[Bh.FIRST_TEXTURE,Lh]}}class gp extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(gp)};super(gp.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}"},e,t)}static getFilterType(){return"motionBlurTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{}}handleStaticUniforms(t){const e=t.properties.power||{from:0,to:0},n=t.properties.direction||{x:0,y:0};e.ease=e.ease||[0,0,1,1],this.uniforms[Bh.STATIC_OPTIONS].set([e.from,e.to,...e.ease,n.x,n.y])}static getUniformList(){return[Bh.FIRST_TEXTURE,Lh,Rh]}}class yp extends Vh{constructor(t){const e={uniforms:Vh.getUniformInfo(yp)};super(yp.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}"},e,t)}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(t){const e=t.properties.power||{from:0,to:0};e.ease=e.ease||[0,0,1,1];const n=t.properties.color,i=hp.hex.rgb(n).map((t=>t/255));this.uniforms[Bh.STATIC_OPTIONS].set([e.from,e.to,...e.ease,i[0],i[1],i[2]])}static getUniformList(){return[Bh.FIRST_TEXTURE,Lh]}}var bp=Object.freeze({__proto__:null,Crop:Yf,Curves:$f,Default:class t extends Vh{constructor(e){const n={uniforms:Vh.getUniformInfo(t)};super(t.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,e)}static getFilterType(){return"__default"}static getInputsCount(){return 1}static getInitialOptions(){return{}}},DipToBlackTransition:mp,DirectionalBlur:ef,Exposure:tp,ExposureTransition:pp,FadeToColorTransition:yp,FastBlur:tf,HardLight:fp,HorizontalBlur:Jh,Hue:Gf,Lab:Zf,Levels:Uf,Lut:sf,MotionBlurTransition:gp,Opacity:nf,Saturation:Xf,ShapeComposite:of,ShapeCompositeMask:rf,Solid:Qf,SolidImage:Jf,Transform:Qh,TransformTransition:vp,VerticalBlur:Zh,Vibrance:Kf,WhiteBalance:Hf});const kp=Object.values(bp).reduce(((t,e)=>(t[e.getFilterType()]=e,t)),{});class wp{constructor(t){this.context=t}static getFilterClass(t){return kp[t]}getFilterIds(){return Object.keys(this.filterTypeToInstanceMap)}create(t,e){this.context={...this.context,options:e.options};const n=new kp[t](this.context);if(!n)throw new Error(`${t} is not a atom filter, atomFilter list: `,this.getFilterIds());return n}}const xp=Ld.PREVIOUS_OUTPUT_PREFIX,_p=Object.values(bp).reduce(((t,e)=>(t[e.getFilterType()]={type:e.getFilterType(),options:e.getInitialOptions(),inputs:[...Array(e.getInputsCount())].map(((t,e)=>`${xp}${e}`)),outputs:[]},t)),{});var Tp,Ep,Ip=function(){if(Ep)return Tp;Ep=1;var t=function(t){return function(t){return!!t&&"object"==typeof t}(t)&&(n=t,!("[object RegExp]"===(i=Object.prototype.toString.call(n))||"[object Date]"===i||n.$$typeof===e));var n,i},e="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(t,e){return!1!==e.clone&&e.isMergeableObject(t)?s((n=t,Array.isArray(n)?[]:{}),t,e):t;var n}function i(t,e,i){return t.concat(e).map((function(t){return n(t,i)}))}function r(t){return Object.keys(t).concat((e=t,Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]));var e}function o(t,e){try{return e in t}catch(t){return!1}}function s(e,a,l){(l=l||{}).arrayMerge=l.arrayMerge||i,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=n;var c=Array.isArray(a);return c===Array.isArray(e)?c?l.arrayMerge(e,a,l):function(t,e,i){var a={};return i.isMergeableObject(t)&&r(t).forEach((function(e){a[e]=n(t[e],i)})),r(e).forEach((function(r){var l,c;o(l=t,c=r)&&(!Object.hasOwnProperty.call(l,c)||!Object.propertyIsEnumerable.call(l,c))||(o(t,r)&&i.isMergeableObject(e[r])?a[r]=function(t,e){if(!e.customMerge)return s;var n=e.customMerge(t);return"function"==typeof n?n:s}(r,i)(t[r],e[r],i):a[r]=n(e[r],i))})),a}(e,a,l):n(a,l)}return s.all=function(t,e){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce((function(t,n){return s(t,n,e)}),{})},Tp=s}(),Sp=Du(Ip),Ap=function(t,e){return Sp(t,e,{arrayMerge:(t,e)=>e})};const Np=Ld.MESSAGES.UPDATE_OPTIONS;let Mp=class{constructor(t,e){this.eventEmitter=new jd,this.type=t,this.inputs=e.inputs,this.outputs=e.outputs,this.options=e.options}render(){throw new Error("concrete class should implement")}_updateOptions(){throw new Error("concrete class should implement")}updateOptions(t){this._updateOptions(t),this.eventEmitter.emit(Np,this.options)}updateInputs(t){t&&(this.inputs.length===t.length&&this.inputs.every(((e,n)=>e===t[n]))||(this.inputs=[...t]))}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 Fp extends Mp{constructor(t,e,n){super(...arguments),this.filter=n.filterFactory.create(this.type,{options:this.options})}render(t){const e=t.ioStore,n=t.graphIOManager,i=this.getInputs(),r=this.getOutputs(),o=e.get(i),s=this.filter.render(o,this.options);return n.setOutputs(e,r,s),s}_updateOptions(t){this.options=Ap(this.options,t),this.filter.updateStaticUniforms(this.options)}dispose(){this.filter.dispose()}}const Cp=Ld.MESSAGES.UPDATE_OPTIONS;class Op extends Fp{constructor(t,e,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}baseNodeUpdateOptions(t){this.options=Ap(this.options,t),this.filter.updateStaticUniforms(this.options)}registerListeners(){this.baseNode.getEventEmitter().on(Cp,this.baseNodeUpdateOptions,this)}dispose(){this.filter.dispose(),this.baseNode.getEventEmitter().off(Cp,this.baseNodeUpdateOptions,this)}}function Pp(t){return null!==t&&"object"==typeof t}function Rp(t){if(!Pp(t)||(e=t,Array.isArray(e)))return t;var e;const n=Object.keys(t).sort(),i={};return n.forEach((e=>{i[e]=Rp(t[e])})),i}function Dp(t,e){return null!=t&&t.id&&null!=e&&e.id?t.type===e.type&&t.id===e.id:t.type===e.type}function Lp(t,e){const n=[];t.forEach(((t,i)=>{const r=(o=t,e.findIndex((t=>function(t,e){const n=JSON.parse(JSON.stringify(t));return r=JSON.parse(JSON.stringify(e)),Pp(i=n)&&Pp(r)?JSON.stringify(Rp(i))===JSON.stringify(Rp(r)):!(!Number.isNaN(i)||!Number.isNaN(r))||i===r;var i,r}(o,t))));var o;if(-1!==r)return void n.push({type:"take",index:r});const s=(a=t,l=i,(c=e)&&c[l]&&Dp(a,c[l])?l:c.findIndex((t=>Dp(a,t))));var a,l,c;-1===s?n.push({type:"create",newGraphIndex:i}):n.push({type:"update",currentGraphIndex:s,newGraphIndex:i})}));const i=n.reduce(((t,e)=>("take"===e.type?t.push(e.index):"update"===e.type&&t.push(e.currentGraphIndex),t)),[]);return e.reduce(((t,e,n)=>(i.includes(n)||t.push(n),t)),[]).forEach((t=>{n.push({type:"dispose",currentGraphIndex:t})})),n}function Bp(t,e,n,i){const r=[];return t.forEach((t=>{switch(t.type){case"take":r.push(n[t.index]);break;case"update":const o=e[t.newGraphIndex].options,s=n[t.currentGraphIndex];s.updateInputs(e[t.newGraphIndex].inputs),s.updateOptions(o),r.push(s);break;case"create":const a=Yp.create(e[t.newGraphIndex],i);r.push(a);break;case"dispose":n[t.currentGraphIndex].dispose();break;default:throw new Error("cant apply action type: ",t.type)}})),r}var zp=function(t,e,n,i){const r=t.graph,o=e.graph;if(!(o&&r&&Array.isArray(o)&&Array.isArray(r)))throw new Error("cant apply new composite options",t);return Bp(Lp(r,o),r,n,i)};class Wp extends Mp{constructor(t,e,n){super(...arguments),this.context=n,this.nodes=this.createNodes(this.options)}createNodes(t){if(!t||!t.graph)throw new Error("cant create composite node, please supply info.options.graph");return t.graph.map((t=>Yp.create(t,this.context)))}render(t){const e=t.ioStore,n=t.graphIOManager;let i=n.getPrevOutput(e);const r=this.outputs;if(this.nodes.length){const t=new Kd(e),r="__PREVIOUS:0",o=[],s=new Set;this.nodes.forEach(((e,a)=>{const l={ioStore:t,graphIOManager:n},c=e.getOutputs?e.getOutputs():void 0,u=Array.isArray(c)?c:[],d={};u.forEach((e=>{d[e]=t.get(e)}));const h=t.get(r);i=e.render(l),a!==this.nodes.length-1&&o.push(i);const f=new Set;if(h&&h!==i&&f.add(h),u.forEach((t=>{const e=d[t];e&&e!==i&&f.add(e)})),f.size){const e=new Set(Object.values(t.get()));f.forEach((t=>{e.has(t)||(n.disposeTextures([t],i),s.add(t))}))}}));const a=o.filter((t=>!s.has(t)));n.disposeTextures(a,i)}return n.setOutputs(e,r,i),i}getOptionsDisplay(){return[]}_updateOptions(t){this.nodes=zp(t,this.options,this.nodes,this.context),this.options=t}dispose(){this.nodes.forEach((t=>{t.dispose()}))}}const $p=Ld.MESSAGES.UPDATE_OPTIONS;class jp extends Wp{constructor(t,e,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}registerListeners(){this.baseNode.getEventEmitter().on($p,this.updateOptions,this)}dispose(){this.nodes.forEach((t=>{t.dispose()})),this.baseNode.getEventEmitter().off($p,this.updateOptions,this)}}const Up=Ld.SYSTEM_NODES.TAGS.ATOM,qp=Ld.SYSTEM_NODES.TAGS.FILTER,Vp=Ld.SYSTEM_NODES.TAGS.COMPOSITE_FILTER,Gp=Ld.SYSTEM_NODES.TAGS.TRANSITION_FILTER,Hp=Ld.PREVIOUS_OUTPUT_PREFIX,Kp=Object.keys(_p);function Xp(t,e){const n=(i=t.type,_p[i]);var i;return t=Ap(n,t),new Fp(t.type,t,e)}var Yp={create:function(t,e){let n;switch(function(t){let e;return n=t,e=Kp.includes(n)?Up:t===Vp?Vp:t===Gp?Gp:qp,e;var n}((t=JSON.parse(JSON.stringify(t))).type)){case Up:n=Xp(t,e);break;case qp:n=function(t,e){const n=function(t,e){const n=e.get(t);if(!n)throw new Error(`no base node, cant resolve type: ${t}`);return n}(t.type,e.nodeStore),i=n.getType(),r=n.getInfo();let o;return t=Ap(r,t),e={...e,baseNode:n},o=i===Vp?new jp(i,t,e):new Op(i,t,e),o}(t,e);break;case Vp:n=function(t,e){const n=t.type;return t=Ap({inputs:[`${Hp}0`]},t),new Wp(n,t,e)}(t,e);break;case Gp:n=function(t,e){const n=t.options.filter;if(!n)throw new Error(`transition filter should supply base filter ${n}`);return t.type=`${n}Transition`,Xp(t,e)}(t,e);break;default:throw new Error("cant create node",t.type)}return n}};const Qp=Ld.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS;var Jp=function(t){const e={[Qp]:_p[Qp]};for(const[n,i]of Object.entries(e)){const e=Yp.create(i,t);t.nodeStore.set(n,e)}},Zp=function(t,e){for(const[n,i]of Object.entries(t)){const t=Yp.create(i,e);e.nodeStore.set(n,t)}};const tm=Ld.CAPTURED_FRAME_PREFIX;class em{constructor(t){return this.textureManager=t.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(t,e){e=e||0,this.currentFrameTextures[e].fill(t)}saveFrame(t){0!==this.saveInNextFrameTextures.length&&(this.saveInNextFrameTextures.forEach((e=>{e.fill(t)})),this.saveInNextFrameTextures=[])}capture(t,e){(t.videoHeight>150||t.displayHeight>150)&&(this.updateCurrentFrame(t,e),this.saveFrame(t))}createCaptureId(){const t=this.textureManager.createTexture({type:"frame"});this.saveInNextFrameTextures.push(t);const e=t.getUnit(),n=`${tm}${e}`;return this.savedFramesTextures[n]=t,this.reservedUnits.add(e),n}releaseCaptureId(t){if("string"!=typeof t)throw new Error("capture id should be string");delete this.saveInNextFrameTextures[t];const e=t.split(":")[1];this.reservedUnits.delete(parseInt(e,10))}getCurrentFrames(){return this.currentFrameTextures}getSavedFrames(){return this.savedFramesTextures}isReservedUnit(t){return this.reservedUnits.has(t)}}const nm=Zu("ShaderGraphApplication","warn"),im=Ld.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS,rm=Object.freeze({useCanvasSizedFilterTargets:!1,rebindAttributesOnProgramSwitch:!0,forwardContextAttributes:!0});function om(t={}){const e=null==t?void 0:t.performanceToggles;return e&&"object"==typeof e?{...rm,...e}:{...rm}}class sm{constructor(t,e={}){return this.glSource=t,this.config=e,this.performanceToggles=om(e),this.isContextLost=!1,this.isRecovering=!1,this.isDisposed=!1,this.pendingNodeOptionUpdates=new Map,this.doInit(t,e)}doInit(t,e){this.source=Gd(t),this.performanceToggles=om(e),this.isDisposed=!1,this.resetViewportSyncState(),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(t={},e=rm){const n=null!=t&&t.glOptions&&"object"==typeof t.glOptions?{...t.glOptions}:{},i=n.__shaderGraph&&"object"==typeof n.__shaderGraph?n.__shaderGraph:{};return{...n,__shaderGraph:{...i,forwardContextAttributes:!1!==e.forwardContextAttributes}}}(e,this.performanceToggles);return this.gl=this.source.init(this.setSrcVidTracks,this.resizeCanvasSize,n),this.addCanvasListeners(),this.addSourceListeners(),this.exposeDebugGlobalIfBrowser(),this.selectedRenderNode=null,this.setupRenderInfrastructure(t,e),e.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)}}exposeDebugGlobalIfBrowser(){"undefined"!=typeof window&&(window.ekoShaderGraph=this)}setupRenderInfrastructure(t,e){this.activeTextures=this.activeTextures||new Set,this.textureManager=new nh({gl:this.gl,activeTextures:this.activeTextures}),this.capturedFramesManager=new em({textureManager:this.textureManager}),this.graphIOManager=new uh({glSource:t,gl:this.gl,textureManager:this.textureManager,capturedFramesManager:this.capturedFramesManager}),this.frameBufferFactory=new gh({gl:this.gl,textureManager:this.textureManager,useCanvasSizedFilterTargets:this.performanceToggles.useCanvasSizedFilterTargets}),this.filterFactory=new wp({gl:this.gl,frameBufferFactory:this.frameBufferFactory,rebindAttributesOnProgramSwitch:this.performanceToggles.rebindAttributesOnProgramSwitch}),this.nodeStore=new Kd,this.ioStore=new Kd,Jp({nodeStore:this.nodeStore,filterFactory:this.filterFactory}),this.addClientNodes(e.nodes,this.isRecovering)}getNodes(){return nm.debug("[getNodes]"),this.nodeStore.get()}addClientNodes(t,e=!1){if(nm.debug("[addClientNodes]",t),t&&!e&&(this.addClientNodeInvocations=this.addClientNodeInvocations||[],this.addClientNodeInvocations.push(t)),!e&&this.isContextUnavailable())return;t=t||{};const n=JSON.parse(JSON.stringify(t));Zp(n,{nodeStore:this.nodeStore,filterFactory:this.filterFactory})}addTexture(t,e,n){if(nm.debug("[addTexture]",t,e,n),this.isContextUnavailable())return null;let i=this.textureManager.createTexture({type:e});return i.isStatic=!0,t&&i.fill(t),this.graphIOManager.setTextureSource(this.ioStore,i,n),i}releaseTexture(t){nm.debug("[releaseTexture]",t),this.isContextUnavailable()||this.textureManager.releaseTexture(t)}selectNode(t){if(nm.debug("[selectNode]",t),!this.isContextUnavailable())return this.nodeStore.get(t)||nm.warn("Missing render node",t),void(this.selectedRenderNodeId=t);this.selectedRenderNodeId=t}captureTexture(){return nm.debug("[captureTexture]"),this.isContextUnavailable()?null:this.capturedFramesManager.createCaptureId()}disposeTexture(t){return nm.debug("[disposeTexture]",t),this.isContextUnavailable()||"string"!=typeof t?null:this.capturedFramesManager.releaseCaptureId(t)}setSrcVidTracks(t){this.isContextUnavailable()||this.capturedFramesManager&&this.capturedFramesManager.capture(t)}resizeCanvasSize(t,e,n,i){this.dirtyCanvasSize={width:n,height:i}}resetViewportSyncState(){this._lastSyncedViewportCanvasWidth=null,this._lastSyncedViewportCanvasHeight=null}syncViewportToCanvasBackingStoreIfChanged(){var t,e;const n=null===(t=this.gl)||void 0===t||null===(t=t.canvas)||void 0===t?void 0:t.width,i=null===(e=this.gl)||void 0===e||null===(e=e.canvas)||void 0===e?void 0:e.height;!Number.isFinite(n)||!Number.isFinite(i)||n<=0||i<=0||n===this._lastSyncedViewportCanvasWidth&&i===this._lastSyncedViewportCanvasHeight||(ph(n,i),this.gl.viewport(0,0,n,i),this._lastSyncedViewportCanvasWidth=n,this._lastSyncedViewportCanvasHeight=i)}isContextUnavailable(){return!!this.isDisposed||!(!this.isRecovering&&!this.isContextLost)||!(!this.gl||"function"!=typeof this.gl.isContextLost)&&this.gl.isContextLost()}queueNodeOptionUpdate(t,e){t&&e&&"object"==typeof e&&(this.pendingNodeOptionUpdates||(this.pendingNodeOptionUpdates=new Map),this.pendingNodeOptionUpdates.set(t,e))}applyPendingNodeOptionUpdates(t=!1){if(!this.pendingNodeOptionUpdates||!this.pendingNodeOptionUpdates.size)return;const e=Array.from(this.pendingNodeOptionUpdates.entries());this.pendingNodeOptionUpdates.clear(),e.forEach((([e,n])=>{try{if(t){const t=this.nodeStore.get(e);if(!t||"function"!=typeof t.updateOptions)return void this.queueNodeOptionUpdate(e,n);try{t.updateOptions(n)}catch(t){nm.error("Failed to apply pending node options",e,t),this.queueNodeOptionUpdate(e,n)}return}this.updateOptions(e,n)}catch(t){nm.error("Failed to apply pending node options",e,t)}}))}render(t={}){const{noRaf:e=!1}=t;if(this.isContextUnavailable())return;if(this.dirtyCanvasSize){let{width:t=this.gl.canvas.width,height:e=this.gl.canvas.height}=this.dirtyCanvasSize;ph(t,e),this.gl.canvas.width=t,this.gl.canvas.height=e,this.textureManager.refreshTextureObjects(),this.gl.viewport(0,0,t,e),this.dirtyCanvasSize=!1,this._lastSyncedViewportCanvasWidth=t,this._lastSyncedViewportCanvasHeight=e}this.syncViewportToCanvasBackingStoreIfChanged(),this.graphIOManager.setVideoSources(this.ioStore);let n={ioStore:this.ioStore,graphIOManager:this.graphIOManager};this.renderSelectedNode(n),this.config.onPreRenderToScreen&&this.config.onPreRenderToScreen(),this.renderToCanvas(n),this.config.onPostRenderToScreen&&this.config.onPostRenderToScreen(),this.graphIOManager.disposeAllStore(this.ioStore),n=null,!e&&!this.config.userWillCallRender&&(this.rafId=requestAnimationFrame(this.render))}renderSelectedNode(t){if(!this.selectedRenderNodeId)return;const e=this.nodeStore.get(this.selectedRenderNodeId);e&&"function"==typeof e.render?e.render(t):(nm.warn("Missing selected render node",this.selectedRenderNodeId),this.selectedRenderNodeId=null)}renderToCanvas(t){const e=this.nodeStore.get(im);e&&"function"==typeof e.render?e.render(t):nm.warn("Missing render-to-canvas node")}updateOptions(t,e){if(nm.debug("[updateOptions]",t,e),this.isContextUnavailable())return void this.queueNodeOptionUpdate(t,e);const n=this.nodeStore.get(t);if(n&&"function"==typeof n.updateOptions)try{n.updateOptions(e)}catch(n){nm.error("Failed to update node options",t,n),this.queueNodeOptionUpdate(t,e)}else this.queueNodeOptionUpdate(t,e)}addSourceListeners(){var t;"function"==typeof(null===(t=this.source)||void 0===t?void 0:t.on)&&this.source.on("forcerender",this.onForceRender)}removeSourceListeners(){var t;"function"==typeof(null===(t=this.source)||void 0===t?void 0:t.off)&&this.source.off("forcerender",this.onForceRender)}addCanvasListeners(){var t;(null==this||null===(t=this.gl)||void 0===t?void 0:t.canvas)&&(this.config.noWebGLContextLostRecovery||this.gl.canvas.addEventListener("webglcontextlost",this.onWebGLContextLost))}removeCanvasListeners(){var t;(null==this||null===(t=this.gl)||void 0===t?void 0:t.canvas)&&this.gl.canvas.removeEventListener("webglcontextlost",this.onWebGLContextLost)}getNodesOptions(){const t=this.getNodes();let e={};return Object.keys(t).filter((t=>"__default"!==t)).forEach((n=>{e[n]=t[n].options})),e}getDocumentVisibilityPromise(){return new Promise((t=>{"visible"===document.visibilityState&&t();const e=()=>{"visible"===document.visibilityState&&(document.removeEventListener("visibilitychange",e),t())};document.addEventListener("visibilitychange",e)}))}onForceRender(){nm.info("[onForceRender]"),this.render({noRaf:!0})}async onWebGLContextLost(t){if(t&&"function"==typeof t.preventDefault&&t.preventDefault(),this.isDisposed||this.isRecovering)return;this.isContextLost=!0,this.isRecovering=!0;const e=this.getNodesOptions(),n=this.addClientNodeInvocations,i=this.selectedRenderNodeId;cancelAnimationFrame(this.rafId),nm.warn("WebGL context lost - attempting to recover");const r=async()=>{if(this.isDisposed)this.isRecovering=!1;else try{var t;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((t=>{nm.debug("Re-adding client nodes",t),this.addClientNodes(t,!0)})),Object.entries(e).forEach((([t,e])=>{nm.debug("Re-applying node options",t,e);const n=this.nodeStore.get(t);n&&"function"==typeof n.updateOptions&&n.updateOptions(e)})),i&&(this.selectedRenderNodeId=i),this.applyPendingNodeOptionUpdates(!0);const o="function"==typeof(null===(t=this.source)||void 0===t?void 0:t.recover);o&&(nm.debug("Recovering glSource (i.e. seeking/resetting player)"),await this.source.recover()),this.isContextLost=!1,this.isRecovering=!1,o&&this.render()}catch(t){nm.error("Failed to recover WebGL context, retrying",t),setTimeout(r,200)}};await r()}dispose(t=!0){if(this.selectedRenderNode=null,t&&(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 e=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS);for(let t=0;t<e;++t)this.gl.activeTexture(this.gl.TEXTURE0+t),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),t)try{this.gl.getExtension("WEBGL_lose_context").loseContext()}catch(t){console.error(t)}}this.selectedRenderNodeId=null,t&&delete this.addClientNodeInvocations}}class am{constructor(t={}){this.options=t}get type(){return"stage"}getSignature(){return this.type}build({inputs:t=[]}={}){return{graph:[],outputs:t,signature:this.getSignature()}}}function lm(t={}){const e={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={...e.source,...t.source||{}},i={...e.target,...t.target||{}};return{...e,...t,source:n,target:i}}class cm extends am{get type(){return"retarget"}getSignature(){var t;const e=Array.isArray(null===(t=this.options)||void 0===t?void 0:t.frames)?this.options.frames:[];return`${this.type}:${e.length}`}build({inputs:t=[],stageIndex:e=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:t,signature:this.getSignature()};const r=[],o=[];for(let n=0;n<t.length;n+=1){const s=t[n],a=i[n];if(!a){o.push(s);continue}const l=`retarget-${e}-${n}`;r.push({id:l,type:"crop",inputs:[s],outputs:[l],options:lm(a)}),o.push(l)}return{graph:r,outputs:o,signature:this.getSignature()}}}class um{#E=new Map;constructor(){this.register("retarget",cm)}register(t,e){t&&"function"==typeof e&&this.#E.set(t,e)}create(t={}){const e="string"==typeof(null==t?void 0:t.type)?t.type:null;if(!e)return null;const n=this.#E.get(e);return n?new n((null==t?void 0:t.options)||{}):null}}class dm{constructor(t={}){this.params=t}static get panAndScanTarget(){return"pre"}static buildDefaultLayoutGraph(t=[]){const e=t[0]||"__SRC_TEXTURE:0";return{type:"default",signature:`default:${t.length}`,isDynamic:!1,graph:[{type:"opacity",inputs:[e],options:{power:1}}]}}static prepareRenderFrames({frames:t}={}){return Array.isArray(t)?t:[]}static getRenderTiming({timing:t}={}){return t&&"object"==typeof t?t:{}}static resetRenderState(t){}render(t){}}class hm extends dm{#I=null;#S=null;static get type(){return"default"}static get aliases(){return["DefaultRenderNode","default"]}static get requiresFrameCadence(){return!1}static buildLayoutGraph({inputs:t=[]}={}){return super.buildDefaultLayoutGraph(t)}static prepareRenderFrames({frames:t}={}){const e=Array.isArray(t)?t:[];if(e.length<=1)return e;const n=e[e.length-1];return n?[n]:e}render(t){var e;const n=(null==t||null===(e=t.visualFramesAvailable)||void 0===e?void 0:e.frames)||[];if(!n.length)return;const i=null==t?void 0:t.shaderGraph,r=null==t?void 0:t.shaderGraphNodeIds;if(!i||"function"!=typeof i.updateOptions||"function"!=typeof i.selectNode)return;const o=null==r?void 0:r.default;if(o)try{const t=n.map(((t,e)=>t?`__SRC_TEXTURE:${e}`:null)).filter(Boolean),e=hm.buildLayoutGraph({inputs:t}),r=e.signature;this.#I!==r&&(i.updateOptions(o,{graph:e.graph}),this.#I=r),this.#S!==o&&(i.selectNode(o),this.#S=o),i.render({noRaf:!0})}catch(t){}}}function fm(t){const e=Number(t);return Number.isFinite(e)?e<=0?0:e>=1?1:e:0}class pm extends dm{#I=null;#S=null;#A=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:t=[],normalizedTime:e}={}){if(t.length<2)return super.buildDefaultLayoutGraph(t);const n=fm(e),i=[{type:"opacity",inputs:[t[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",t[0]],options:{}}];return{type:pm.type,signature:`${pm.type}:${t.length}`,isDynamic:!0,graph:i}}static prepareRenderFrames({frames:t,timelineTime:e,active:n}={}){let i=(Array.isArray(t)?t:[]).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(e)||!Number.isFinite(r)||!Number.isFinite(o))return i;const s=fm((e-o)/r);return s<=0?[i[0]]:s>=1?[i[1]]:i}render(t){var e;const n=(null==t||null===(e=t.visualFramesAvailable)||void 0===e?void 0:e.frames)||[];if(!n.length)return;const i=null==t?void 0:t.shaderGraph,r=null==t?void 0:t.shaderGraphNodeIds;if(!i||"function"!=typeof i.updateOptions||"function"!=typeof i.selectNode)return;if(n.length<2){const t=null==r?void 0:r.default;if(!t)return;try{const e="default";if(this.#I!==e){const n=pm.buildLayoutGraph({inputs:["__SRC_TEXTURE:0"]});i.updateOptions(t,{graph:n.graph}),this.#I=e}this.#S!==t&&(i.selectNode(t),this.#S=t),i.render({noRaf:!0})}catch(t){}return}const o=null==r?void 0:r.crossFade;if(o)try{const e=["__SRC_TEXTURE:0","__SRC_TEXTURE:1"],n=pm.buildLayoutGraph({inputs:e,normalizedTime:null==t?void 0:t.renderNodeNormalizedTime}),r=n.signature,s=Number(null==t?void 0:t.renderNodeNormalizedTime),a=Number.isFinite(s)?s:0;this.#I===r&&this.#A===a||(i.updateOptions(o,{graph:n.graph}),this.#I=r,this.#A=a),this.#S!==o&&(i.selectNode(o),this.#S=o),i.render({noRaf:!0})}catch(t){}}}function mm(t,e,n={}){if("number"==typeof(null==t?void 0:t.nodeDurationOverride)&&Number.isFinite(t.nodeDurationOverride))return t.nodeDurationOverride;const i="function"==typeof(null==n?void 0:n.getNode)?n.getNode:e&&"function"==typeof e.get?t=>e.get(t):null;if(!i)return;const r=i(null==t?void 0:t.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 t.nodeOffsetOverride&&Number.isFinite(t.nodeOffsetOverride)&&(a=t.nodeOffsetOverride);const l=o-a;return l>0?l:0}function vm(t){return!(!t||!0===t.offsetPending)&&Number.isFinite(t.offset)}function gm(t){return vm(t)?t.offset:void 0}function ym(t,e,n,i={}){if(!t)return!1;const r=gm(t);if(!Number.isFinite(r))return!1;const o=mm(t,n,i);return Number.isFinite(o)?e>=r&&e<r+o:e>=r}function bm(t=[]){if(!Array.isArray(t))return t;const e=[],n=[];return t.forEach((t=>{vm(t)?e.push(t):n.push(t)})),e.sort(((t,e)=>t.offset-e.offset)),t.splice(0,t.length,...e,...n),t}function km(t=[],e={}){if(!Array.isArray(t)||!t.length)return{updated:!1,resolvedPlacements:[]};const n="function"==typeof e.getPlacementDuration?e.getPlacementDuration:()=>{},i="function"==typeof e.snapPlacementOffset?e.snapPlacementOffset:t=>t,r="function"==typeof e.onResolvedPlacement?e.onResolvedPlacement:null,o=new Map,s=[];if(t.forEach((t=>{null!=t&&t.placementId&&o.set(t.placementId,t),!0===(null==t?void 0:t.offsetPending)&&s.push(t)})),!s.length)return{updated:!1,resolvedPlacements:[]};let a=!1;const l=[];let c=s,u=!0;for(;c.length&&u;){u=!1;const t=[];for(let e=0;e<c.length;e+=1){const s=c[e],d=null==s?void 0:s.offsetAnchorPlacementId;if(!d){t.push(s);continue}const h=o.get(d);if(!h||!0===h.offsetPending){t.push(s);continue}const f=gm(h);if(!Number.isFinite(f)){t.push(s);continue}let p;if("start"===s.offsetAnchorEdge)p=i(f,s);else{const e=n(h);if(!(e>0)){t.push(s);continue}const r=f+e-(Number.isFinite(s.offsetEndSeconds)?s.offsetEndSeconds:0);if(!Number.isFinite(r)){t.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):t.push(s)}c=t}return a&&!1!==e.sortPlacements&&bm(t),{updated:a,resolvedPlacements:l}}function wm(t){const e=Number(t);return Number.isFinite(e)?e:0}function xm(t,e={}){const n=function(t){const e=Number(t);return Number.isFinite(e)&&e<0?Math.abs(e):0}(t),i=Number.isFinite(null==e?void 0:e.offsetEndSeconds)?e.offsetEndSeconds:n;var r;return{wantsEndOffset:"end"===(r=t)||null==r||n>0||!0===(null==e?void 0:e.offsetPending),endOffsetSeconds:i,endOffsetFromAtSeconds:n}}function _m(t){if("string"!=typeof t)return null;const e=t.trim();if(!e||"end"===e)return null;const n=Number(e);if(Number.isFinite(n))return null;const i=e.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 Tm(t=[],e,n,i){if(Array.isArray(t))for(let r=0;r<t.length;r+=1){const o=t[r],s="number"==typeof(null==o?void 0:o.offset)?o.offset:0;if(e<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 Em(t){const e=Number(t);return Number.isFinite(e)&&e>0?e:0}function Im(t){return(null==t?void 0:t.id)||(null==t?void 0:t.nodeId)||null}function Sm(t,e){return Array.isArray(t)&&e?t.findIndex((t=>Im(t)===e)):-1}function Am(t,e,n){const i=function(t,e,n){if(!Array.isArray(e)||0===e.length)return null;const i=e.length;if(null==t||"next"===t){const t=Sm(e,n);return t>=0?(t+1)%i:0}if("prev"===t){const t=Sm(e,n);return t>=0?(t-1+i)%i:i-1}const r=Number(t);return Number.isInteger(r)&&r>=0&&r<i?r:null}(t,e,n);return Number.isInteger(i)?Im(e[i]):null}function Nm(t,e,n,i){const r=function(t,e){if(!Array.isArray(t)||t.length<=1)return t||[];const n=function(t){const e=[],n=new Set;return Array.isArray(t)?(t.forEach((t=>{const i=null==t?void 0:t.placementId;i&&!n.has(i)&&(n.add(i),e.push(i))})),e):e}(e);if(!n.length)return t;const i=new Map;t.forEach((t=>{const e=null==t?void 0:t.placementId;e&&!i.has(e)&&i.set(e,t)}));const r=[],o=new Set;return n.forEach((t=>{const e=i.get(t);e&&!o.has(t)&&(o.add(t),r.push(e))})),t.forEach((t=>{const e=null==t?void 0:t.placementId;e&&!o.has(e)&&(o.add(e),r.push(t))})),r}(function(t,e){const n=function(t){const e=Number(null==t?void 0:t.offset),n=Number(null==t?void 0:t.duration),i=n===Number.POSITIVE_INFINITY,r=Number.isFinite(n)&&n>0||i;return Number.isFinite(e)&&r?{start:e,end:i?Number.POSITIVE_INFINITY:e+n}:null}(e);if(!n||!t||!Array.isArray(t.placements))return[];const i=function(t,e){const n=Number(null==t||null===(e=t.settings)||void 0===e?void 0:e.snapToFps);return!Number.isFinite(n)||n<=0?0:.5/n}(t),r=t.placements.filter((e=>{const r=function(t,e){const n=gm(t);if(!Number.isFinite(n))return null;const i="function"==typeof(null==e?void 0:e.getPlacementDuration)?e.getPlacementDuration(t):void 0;return{start:n,end:Number.isFinite(i)&&i>=0?n+i:Number.POSITIVE_INFINITY}}(e,t);return!!r&&r.start<n.end&&r.end>n.start+i}));return r.sort(((t,e)=>gm(t)-gm(e))),r}(e,n),i),o=function(t,e){const n=[],i=new Set;return Array.isArray(t)?(t.forEach((t=>{const r=null==t?void 0:t.nodeId;if(!r||i.has(r))return;const o="function"==typeof(null==e?void 0:e.getNode)?e.getNode(r):null;if(o){const t="object"==typeof o&&null!==o?o.id||o.nodeId?o:{...o,id:r}:{id:r};n.push(t),i.add(r)}})),n):n}(r,e),s=function(t){const e=new Map;return t.forEach((t=>{const n=null==t?void 0:t.placementId,i=null==t?void 0:t.nodeId;n&&i&&(e.has(i)||e.set(i,[]),e.get(i).push(n))})),e}(r),a=Array.isArray(t.nodes)?t.nodes:[];return a.splice(0,a.length,...o),t.nodes=a,t.placements=r,t.nodePlacementMap=s,{nodes:a,placements:r,nodePlacementMap:s}}function Mm(t,e,n){if(!Array.isArray(t))return null;if(e){const n=t.find((t=>(null==t?void 0:t.placementId)===e));if(n)return n}return n&&t.find((t=>(null==t?void 0:t.nodeId)===n))||null}function Fm(t,e){if(!e||!Array.isArray(t))return null;const n=t.find((t=>(null==t?void 0:t.placementId)===e));return(null==n?void 0:n.nodeId)||null}function Cm(t,e,n){if(!t||!e)return null;const i=e.get(t);if(!Array.isArray(i)||!i.length)return null;for(let e=0;e<i.length;e+=1){const r=i[e];if(Mm(n,r,t))return r}return null}function Om(t){t.initialized=!1,t.activeRenderPlacementId=null,t.nodes=[],t.placements=[],t.nodePlacementMap=null,t.selectedPlacementId=null,t.previousPlacementId=null,t.pendingSwitch=null,t.switchStartTime=null,t.switchDuration=0,t.switchNormalizedTime=void 0,t.switchTo=null,t.countOfConcurrentChannels=null}class Pm extends dm{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:t=[],normalizedTime:e}={}){if(t.length<2)return super.buildDefaultLayoutGraph(t);const n=fm(e),i=[{type:"opacity",inputs:[t[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",t[0]],options:{}}];return{type:Pm.type,signature:`${Pm.type}:${t.length}`,isDynamic:!0,graph:i}}static getRenderTiming({timing:t,state:e}={}){const n=t&&"object"==typeof t?t:{},i=Number(null==e?void 0:e.switchNormalizedTime);return Number.isFinite(i)?{...n,normalizedTime:fm(i)}:n}static prepareRenderFrames({frames:t,timelineTime:e,timeline:n,active:i,renderNodeParams:r,state:o}={}){const s=Array.isArray(t)?t:[],a=o&&"object"==typeof o?o:{},l=null==i?void 0:i.renderPlacementId;l&&a.activeRenderPlacementId!==l&&(Om(a),a.activeRenderPlacementId=l);const c=null==r?void 0:r.initSwitching,u=Nm(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=(t,e)=>{const n=Fm(a.placements,a.selectedPlacementId),i=Am(t,a.nodes,n);if(!i)return;const r={nodeId:i};e&&Object.prototype.hasOwnProperty.call(e,"crossfadeSeconds")&&void 0!==e.crossfadeSeconds&&(r.crossfadeSeconds=e.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 t=Number(null==r?void 0:r.initialChannelIndex),e=Am(Number.isInteger(t)&&t>=0?t:0,a.nodes,null);let n=null;if(e&&(n=Cm(e,a.nodePlacementMap,s),!n&&a.nodePlacementMap)){const t=a.nodePlacementMap.get(e);Array.isArray(t)&&t.length&&(n=t[0])}a.selectedPlacementId=n||function(t,e){if(Array.isArray(e))for(let i=0;i<e.length;i+=1){var n;const r=null===(n=e[i])||void 0===n?void 0:n.placementId;if(r&&Mm(t,r))return r}const i=Array.isArray(t)?t.find((t=>null==t?void 0:t.placementId)):null;return i?i.placementId:null}(s,a.placements)}if(a.pendingSwitch&&Number.isFinite(e)){const t=Cm(a.pendingSwitch.nodeId,a.nodePlacementMap,s);if(t){const n=a.selectedPlacementId;a.previousPlacementId=n&&n!==t?n:null,a.selectedPlacementId=t;const i=Object.prototype.hasOwnProperty.call(a.pendingSwitch,"crossfadeSeconds"),o=Em(a.pendingSwitch.crossfadeSeconds),s=Em(null==r?void 0:r.switchCrossfadeSeconds),l=i?o:s;a.switchDuration=l,l>0?a.switchStartTime=e:(a.switchStartTime=null,a.previousPlacementId=null)}a.pendingSwitch=null}let p;if(Number.isFinite(a.switchStartTime)&&a.switchDuration>0&&Number.isFinite(e)){const t=e-a.switchStartTime;t>=a.switchDuration?(a.switchStartTime=null,a.switchDuration=0,a.previousPlacementId=null):t>=0&&(p=fm(t/a.switchDuration))}a.switchNormalizedTime=Number.isFinite(p)?p:void 0;const m=Fm(a.placements,a.selectedPlacementId),v=Mm(s,a.selectedPlacementId,m)||s[0];let g=null;if(Number.isFinite(a.switchNormalizedTime)&&a.previousPlacementId){const t=Fm(a.placements,a.previousPlacementId),e=Fm(a.placements,a.selectedPlacementId),n=Mm(s,a.previousPlacementId,t),i=Mm(s,a.selectedPlacementId,e);n&&i&&(g=[n,i])}return g||(g=v?[v]:s),g}static resetRenderState(t){t&&"object"==typeof t&&Om(t)}}const Rm=.5,Dm="auto";function Lm(t){return"vertical"===t?"vertical":"horizontal"}function Bm(t){return void 0===t||t===Dm?Dm:"manual"}function zm(t){const e=Number(t);return Number.isFinite(e)&&e>=0?e:.004}function Wm(t,e){const n=Number(null==t?void 0:t.width),i=Number(null==t?void 0:t.height);return Number.isFinite(n)&&Number.isFinite(i)&&n>0&&i>0?i>n?"vertical":"horizontal":Lm(e)}function $m(t,e){const n=e&&"object"==typeof e&&e.runtimeParams&&"object"==typeof e.runtimeParams?e.runtimeParams:{},i=Object.prototype.hasOwnProperty.call(n,"orientationMode")?n.orientationMode:null==t?void 0:t.orientationMode,r=Object.prototype.hasOwnProperty.call(n,"orientation")?n.orientation:null==t?void 0:t.orientation,o=Object.prototype.hasOwnProperty.call(n,"gap")?n.gap:null==t?void 0:t.gap,s=Bm(i);return{orientationMode:s,orientation:s===Dm?Wm(null==e?void 0:e.viewportSize,r):Lm(r),gap:zm(o)}}function jm(t){t&&"object"==typeof t&&(t.activeRenderPlacementId=null,t.frames=null,t.gridInitialized=!1,t.runtimeParams=null,t.setGridParams=null)}class Um extends dm{static get type(){return"grid"}static get aliases(){return["GridRenderNode","grid","SideBySideRenderNode","side-by-side","sidebyside"]}static get requiresFrameCadence(){return!1}static get panAndScanTarget(){return"skip"}static resolvePanAndScanTarget({frameCount:t}={}){return t<2?"pre":Um.panAndScanTarget}static buildLayoutGraph({inputs:t=[],renderNodeParams:e,state:n}={}){const i=Array.isArray(t)?t.slice(0,12):[],r=i.length;if(r<2)return super.buildDefaultLayoutGraph(i);const{orientation:o,gap:s}=$m(e,n),{rows:a,cols:l}=(p=o,(f=r)<=3?"vertical"===p?{rows:f,cols:1}:{rows:1,cols:f}:4===f?{rows:2,cols:2}:f<=6?"vertical"===p?{rows:3,cols:2}:{rows:2,cols:3}:f<=8?"vertical"===p?{rows:4,cols:2}:{rows:2,cols:4}:9===f?{rows:3,cols:3}:"vertical"===p?{rows:4,cols:3}:{rows:3,cols:4}),c=1/a,u=Math.max(0,c-s),d=[],h="grid-slice";var f,p;function m(t){const e=Math.floor(t/l),n=function(t,e,n,i){const r=(e-1)*n;return t===e-1&&i>r?i-r:n}(e,a,l,r),i=n<l?t-e*l:t%l,o=1/n;return{row:e,cellWidth:o,cropWidth:Math.max(0,o-s),targetCenterX:(i+Rm)*o,targetCenterY:(e+Rm)*c}}function v(t,e,n){const i=m(t);return{id:`grid-crop-${t}`,type:"crop",inputs:[e],outputs:[n],options:{source:{center:{x:Rm,y:Rm},width:1,height:1},target:{center:{x:i.targetCenterX,y:i.targetCenterY},width:i.cropWidth,height:u},fitType:"fill",cornerRadius:0,edgeSoftness:0}}}function g(t){const e=m(t);return{id:`grid-mask-${t}`,type:"shapeCompositeMask",inputs:[h,"accum"],outputs:["accum"],options:{type:"box",center:{x:2*e.targetCenterX-1,y:1-2*e.targetCenterY},area:{width:e.cellWidth,height:c},radius:0,edgeSoftness:0}}}d.push(v(0,i[0],"accum"));for(let t=1;t<r;t+=1)d.push(v(t,i[t],h)),d.push(g(t));return{type:Um.type,signature:`${Um.type}:${r}:${a}x${l}:${o}:${s}`,isDynamic:!1,graph:d}}static prepareRenderFrames({frames:t,renderNodeParams:e,active:n,state:i}={}){const r=Array.isArray(t)?t.slice(0,12):[],o=i&&"object"==typeof i?i:{},s=null==n?void 0:n.renderPlacementId;s&&o.activeRenderPlacementId!==s&&(jm(o),o.activeRenderPlacementId=s);const a=Array.isArray(o.frames)?o.frames:[],l=null==e?void 0:e.initGrid;if("function"==typeof l&&(o.setGridParams||(o.setGridParams=t=>{!function(t,e){if(!t||"object"!=typeof t||!e||"object"!=typeof e)return;const n=t.runtimeParams&&"object"==typeof t.runtimeParams?{...t.runtimeParams}:{};Object.prototype.hasOwnProperty.call(e,"orientationMode")&&(n.orientationMode=Bm(e.orientationMode)),Object.prototype.hasOwnProperty.call(e,"orientation")&&(n.orientation=Lm(e.orientation)),Object.prototype.hasOwnProperty.call(e,"gap")&&(n.gap=zm(e.gap)),t.runtimeParams=n}(o,t),"function"==typeof o.requestRender&&o.requestRender()}),!o.gridInitialized)){o.gridInitialized=!0;const t=$m(e,o);try{l({orientationMode:t.orientationMode,orientation:t.orientation,gap:t.gap,setGridParams:o.setGridParams})}catch(t){}}if(r.length<2){const t=function(t,e){if(!Array.isArray(e)||e.length<2)return t.length?[t[t.length-1]]:[];const n=Math.min(12,Math.max(t.length,e.length,2)),i=t[0]||e[0];return Array.from({length:n},((n,r)=>t[r]||e[r]||i))}(r,a);return o.frames=t,t}return o.frames=r,r}static resetRenderState(t){jm(t)}}const qm=[hm,pm,Pm,Um],Vm=new Map;function Gm(t){if("string"!=typeof t)return null;const e=t.trim();return e?e.toLowerCase():null}function Hm(t){const e=Gm(t);return e&&Vm.get(e)||null}function Km(t){return Hm(t)||hm}qm.forEach((t=>function(t){(function(t){const e=Array.isArray(t.aliases)?t.aliases:[],n=t.type;return(n?[n,...e]:e.slice()).filter((t=>"string"==typeof t&&t.trim().length))})(t).forEach((e=>{const n=Gm(e);n&&Vm.set(n,t)}))}(t)));class Xm{static get defaultType(){return hm.type||"default"}static getRenderNodeClass(t){return Hm(t)}static normalizeType(t){const e=Hm(t);return e?e.type:null}static doesRenderNodeTypeRequireFrameCadence(t){const e=Hm(t);return!!e&&!0===e.requiresFrameCadence}static buildLayoutGraph({type:t,inputs:e=[],normalizedTime:n,renderNodeParams:i,state:r}={}){const o=Km(t);return o&&"function"==typeof o.buildLayoutGraph?o.buildLayoutGraph({inputs:e,normalizedTime:n,renderNodeParams:i,state:r}):hm.buildLayoutGraph({inputs:e,normalizedTime:n,renderNodeParams:i,state:r})}static getPanAndScanTarget(t,e={}){const n=Km(t);return"post"===(i=n&&"function"==typeof n.resolvePanAndScanTarget?n.resolvePanAndScanTarget(e):null==n?void 0:n.panAndScanTarget)||"skip"===i?i:"pre";var i}static prepareRenderFrames({type:t,frames:e,timelineTime:n,timeline:i,active:r,renderNodeParams:o,state:s}={}){const a=Km(t);if(a&&"function"==typeof a.prepareRenderFrames){const t=a.prepareRenderFrames({frames:e,timelineTime:n,timeline:i,active:r,renderNodeParams:o,state:s});if(Array.isArray(t))return t}return Array.isArray(e)?e:[]}static getRenderTiming({type:t,timing:e,timelineTime:n,active:i,renderNodeParams:r,state:o}={}){const s=Km(t),a=e&&"object"==typeof e?e:{};if(s&&"function"==typeof s.getRenderTiming){const t=s.getRenderTiming({timing:a,timelineTime:n,active:i,renderNodeParams:r,state:o});if(t&&"object"==typeof t)return{...a,...t}}return a}static resetRenderState(t,e){const n=Km(t);n&&"function"==typeof n.resetRenderState&&n.resetRenderState(e)}static resetAllRenderStates(t){t&&"function"==typeof t.forEach&&t.forEach(((t,e)=>{Xm.resetRenderState(e,t)}))}create(t,e){return t&&"function"==typeof t.render?t:new(Km(t))(e)}}function Ym(t){return Array.isArray(t)?t.filter((t=>t&&"string"==typeof t.type)):[]}function Qm(t,e){return t&&"function"==typeof t.getSignature?t.getSignature():(null==e?void 0:e.type)||"stage"}class Jm{#N;constructor(t){this.#N=t||new um}build(t={}){const e=(Array.isArray(null==t?void 0:t.frames)?t.frames:[]).length,n=Array.from({length:e},((t,e)=>`__SRC_TEXTURE:${e}`)),i=Xm.normalizeType(null==t?void 0:t.layoutType)||Xm.defaultType,r=null==t?void 0:t.normalizedTime,o=Ym(null==t?void 0:t.preStages),s=Ym(null==t?void 0:t.postStages),a=[],l=[`layout:${i}`,`inputs:${e}`];let c=n;o.forEach(((e,n)=>{const i=this.#N.create(e);if(!i)return;const r=i.build({inputs:c,stageIndex:n,context:t});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(Qm(i,e))}));const u=Xm.buildLayoutGraph({type:i,inputs:c,normalizedTime:r,renderNodeParams:null==t?void 0:t.renderNodeParams,state:null==t?void 0:t.renderNodeState}),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(((e,n)=>{const i=this.#N.create(e);if(!i)return;const r=i.build({inputs:[h],stageIndex:n,context:t});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(Qm(i,e))})),{graph:a,signature:l.join("|"),isDynamic:d}}}const Zm=[0,0,1,1],tv="zoomInExposure",ev=["transform","exposure","fadeToColor","dipToBlack"],nv={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 iv(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}function rv(t,e=Zm){return Array.isArray(t)&&t.length>=4?t:e}function ov(t){return"string"==typeof t&&t.trim()?t.trim():"#ffffff"}function sv(t,e){const n=null==t?void 0:t[e];return!1===n||null==n?null:ed(n)?n:{}}function av(t={}){let e=0;return ev.forEach((n=>{const i=sv(t,n);if(!i)return;const r=iv(null==i?void 0:i.duration);r>e&&(e=r)})),e}function lv(t,e,n,i,r){const o=[];return ev.forEach((s=>{const a=sv(t,s);if(!a)return;const l=function(t,e,n){const i=iv(null==t?void 0:t.duration);return Number.isFinite(n)&&n>0?i>0&&e>0?i*e:n:i}(a,n,i),c=function(t,e,n,i,r){const o={type:"transition",inputs:["__PREVIOUS:0"],options:{filter:t,startTime:n,duration:i,properties:{}}};if("transform"===t){var s,a,l,c;const t=rv(null==e?void 0:e.ease),n=(null==e||null===(s=e.scale)||void 0===s?void 0:s.from)||{x:1,y:1},i=(null==e||null===(a=e.scale)||void 0===a?void 0:a.to)||{x:1,y:1},r=(null==e||null===(l=e.translate)||void 0===l?void 0:l.from)||{x:0,y:0},u=(null==e||null===(c=e.translate)||void 0===c?void 0:c.to)||{x:0,y:0};return o.options.properties.scale={from:n,to:i,ease:t},o.options.properties.translate={from:r,to:u,ease:t},o}if("fadeToColor"===t){const t=rv(null==e?void 0:e.ease),n=(null==e?void 0:e.power)||{from:0,to:1};return o.options.properties.power={from:iv(null==n?void 0:n.from,0),to:iv(null==n?void 0:n.to,1),ease:t},o.options.properties.color=ov((null==e?void 0:e.color)||r),o}if("exposure"===t||"dipToBlack"===t){const t=rv(null==e?void 0:e.ease),n=(null==e?void 0:e.power)||{from:0,to:1};return o.options.properties.power={from:iv(null==n?void 0:n.from,0),to:iv(null==n?void 0:n.to,1),ease:t},o}return null}(s,a,e,l,r);c&&o.push(c)})),o}function cv(t=[]){const e=t.map((t=>{const e=JSON.parse(JSON.stringify(t));return null!=e&&e.options&&(e.options.startTime=0),e}));return JSON.stringify(e)}class uv{#M=null;start(t={}){const e=null==t?void 0:t.shaderGraph;if(!e||"function"!=typeof e.captureTexture)return null;const{baseFilters:n,reverseFilters:i}=function(t={}){const e=function(t={}){if(ed(null==t?void 0:t.transition))return t.transition;if("string"==typeof(null==t?void 0:t.transition))return nv[t.transition]||nv[tv];if(ed(null==t?void 0:t.filters)||ed(null==t?void 0:t.reverseFilters))return{filters:t.filters||{},reverseFilters:t.reverseFilters||{}};if("string"==typeof(null==t?void 0:t.filter)){const e=iv(t.duration)>0?1e3*t.duration:500;return{filters:{[t.filter]:{duration:e,power:{from:0,to:1}}},reverseFilters:{}}}return nv[tv]}(t),n=nd({},(null==e?void 0:e.filters)||{},ed(null==t?void 0:t.filters)?t.filters:{}),i=function(t={}){const e={};return Object.keys(t).forEach((n=>{const i=t[n];if(!1===i)return void(e[n]=!1);const r=JSON.parse(JSON.stringify(ed(i)?i:{}));Object.values(r).forEach((t=>function(t){if(t&&"object"==typeof t&&"from"in t&&"to"in t){const e=t.from;t.from=t.to,t.to=e}}(t))),e[n]=r})),e}(n),r=nd({},(null==e?void 0:e.reverseFilters)||{},ed(null==t?void 0:t.reverseFilters)?t.reverseFilters:{});return{baseFilters:n,reverseFilters:nd({},i,r)}}(t),r=iv(null==t?void 0:t.duration),o=r>0?1e3*r:null,s=av(n),a=av(i),l=o&&s>0?o/s:1,c=o&&a>0?o/a:1,u=o||s||500,d=o||a||u,h=ov(null==t?void 0:t.color),f=e.captureTexture(),p=Date.now(),m=lv(n,p,l,o,h);return this.#M={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:cv(m),inGraph:null,inSignature:null},{captureId:f,outDurationMs:u,inDurationMs:d}}beginIncoming(){if(!this.#M)return;const t=Date.now(),e=lv(this.#M.reverseFilters,t,this.#M.inScale,this.#M.durationOverrideMs,this.#M.color);this.#M={...this.#M,phase:"in",startTime:t,inGraph:e,inSignature:cv(e)}}reset(t){var e;t&&"function"==typeof t.disposeTexture&&null!==(e=this.#M)&&void 0!==e&&e.captureId&&t.disposeTexture(this.#M.captureId),this.#M=null}getState(){return this.#M}buildOutgoingGraph(){const t=this.#M;return t&&"out"===t.phase&&Array.isArray(t.outGraph)&&t.outGraph.length?{signature:`transition:out:${t.outSignature||""}`,forceUpdate:!1,graph:t.outGraph}:null}buildIncomingGraph(){const t=this.#M;return t&&"in"===t.phase&&Array.isArray(t.inGraph)&&t.inGraph.length?{signature:`transition:in:${t.inSignature||""}`,forceUpdate:!1,graph:t.inGraph}:null}}let dv;const hv=[/firefox\/(\d+)/,/edg\/(\d+)/,/opr\/(\d+)/,/chrome\/(\d+)/];function fv(){const t=cd&&cd.navigator&&(cd.navigator.userAgent||cd.navigator.platform||cd.navigator.vendor)||"";if(dv&&dv.ua===t)return dv;const e=t.toLowerCase(),n=e.includes("android"),i=e.includes("iphone")||e.includes("ipad")||e.includes("ipod")||e.includes("ios"),r=n||i||e.includes("mobile"),o=!!t&&!r,s=e.includes("firefox/"),a=function(t=""){for(let e=0;e<hv.length;e+=1){const n=hv[e],i=t.match(n);if(!i)continue;const r=Number(i[1]);return Number.isFinite(r)?r:null}if(t.includes("safari/")&&t.includes("version/")){const e=t.match(/version\/(\d+)/);if(!e)return null;const n=Number(e[1]);return Number.isFinite(n)?n:null}return null}(e);return dv={ua:t,lowerUA:e,isAndroid:n,isiOS:i,isMobile:r,isDesktop:o,isFirefox:s,browserMajorVersion:a},dv}function pv(){return fv().ua}function mv(){return fv().isAndroid}function vv(){return fv().isiOS}function gv(){return fv().isMobile}function yv(){return fv().isDesktop}function bv(){return fv().isFirefox}function kv(){return fv().browserMajorVersion}var wv={getUserAgent:pv,isAndroid:mv,isiOS:vv,isMobile:gv,isDesktop:yv,isFirefox:bv,getBrowserMajorVersion:kv},xv=Object.freeze({__proto__:null,default:wv,getBrowserMajorVersion:kv,getUserAgent:pv,isAndroid:mv,isDesktop:yv,isFirefox:bv,isMobile:gv,isiOS:vv});const _v="Idle",Tv="Playing",Ev="FirstFramePending",Iv="Waiting",Sv="Paused",Av="Seeking",Nv="Resetting";function Mv(t){return Array.isArray(t)?t.filter((t=>t&&"string"==typeof t.type)):[]}function Fv(t,e){return!!Array.isArray(t)&&t.some((t=>(null==t?void 0:t.type)===e))}function Cv(t){const e=Number(t);return!Number.isFinite(e)||e<=0?null:{type:"retarget",options:{frames:Array.from({length:e},(()=>({fitType:"fill"})))},meta:{source:"panAndScan"}}}function Ov(t){return Array.isArray(t)?t.filter((t=>{return!("panAndScan"===(null==(e=t)||null===(n=e.meta)||void 0===n?void 0:n.source));var e,n})):[]}const Pv=2073600;function Rv(t,e){const n=Number(t);return Number.isFinite(n)&&n>0?n:e}function Dv(t,e){if(null==t)return e;const n=Number(t);return Number.isFinite(n)?n:e}var 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 WeakMap,Jv=new WeakMap,Zv=new WeakMap,tg=new WeakMap,eg=new WeakMap,ng=new WeakMap,ig=new WeakMap,rg=new WeakMap,og=new WeakMap,sg=new WeakMap,ag=new WeakMap,lg=new WeakMap,cg=new WeakMap,ug=new WeakMap,dg=new WeakMap,hg=new WeakMap,fg=new WeakMap,pg=new WeakMap,mg=new WeakMap,vg=new WeakMap,gg=new WeakSet;class yg extends sd{static get pipelineNodeId(){return"ekoplayer-render-pipeline"}get defaults(){return{defaultRenderParams:void 0,resourceLimits:{enabled:!0,maxCanvasPixels:Pv,maxDevicePixelRatio:0,renderScale:1,transitionMinFrameIntervalMs:33}}}constructor(...t){super(...t),O(this,gg),F(this,Lv,void 0),F(this,Bv,void 0),F(this,zv,void 0),F(this,Wv,void 0),F(this,$v,void 0),F(this,jv,void 0),F(this,Uv,void 0),F(this,qv,void 0),F(this,Vv,void 0),F(this,Gv,void 0),F(this,Hv,void 0),F(this,Kv,void 0),F(this,Xv,null),F(this,Yv,null),F(this,Qv,void 0),F(this,Jv,void 0),F(this,Zv,void 0),F(this,tg,[]),F(this,eg,[]),F(this,ng,null),F(this,ig,null),F(this,rg,null),F(this,og,null),F(this,sg,null),F(this,ag,null),F(this,lg,new Map),F(this,cg,null),F(this,ug,null),F(this,dg,!1),F(this,hg,!1),F(this,fg,!1),F(this,pg,!1),F(this,mg,[]),F(this,vg,null);const[e,n,i]=t;C(Lv,this,e),C(Bv,this,n),C(zv,this,i),M(Lv,this)&&"function"==typeof M(Lv,this).enableFirstFrameRenderedGate&&M(Lv,this).enableFirstFrameRenderedGate(),C(Kv,this,new Jm),C(Qv,this,new uv),C(Jv,this,null),C(Zv,this,null),C(rg,this,null),C(Wv,this,(t=>A(gg,this,iy).call(this,t))),M(Lv,this)&&"function"==typeof M(Lv,this).on&&(M(Lv,this).on(dd.VISUAL_FRAMES_AVAILABLE,M(Wv,this)),C($v,this,(()=>{var t,e,n,i;A(gg,this,_g).call(this),A(gg,this,Jg).call(this,0),C(eg,this,[]),C(ng,this,null),C(Xv,this,null),C(Yv,this,null),A(gg,this,jg).call(this),C(cg,this,null);(null===(t=M(Qv,this))||void 0===t||null===(e=t.getState)||void 0===e?void 0:e.call(t))||null===(n=M(Qv,this))||void 0===n||null===(i=n.reset)||void 0===i||i.call(n,M(Jv,this))})),M(Lv,this).on(dd.TIMELINE_SEEKING,M($v,this)),C(jv,this,((t={})=>{"switch"===(null==t?void 0:t.reason)||"reset"===(null==t?void 0:t.reason)?A(gg,this,kg).call(this):A(gg,this,bg).call(this),A(gg,this,Tg).call(this)})),M(Lv,this).on(dd.TIMELINE_RESET,M(jv,this)),C(Vv,this,(()=>A(gg,this,Gg).call(this))),M(Lv,this).on(dd.TIMELINE_TIME_UPDATE,M(Vv,this)),C(Uv,this,(()=>{A(gg,this,ry).call(this)&&M(ig,this)&&A(gg,this,iy).call(this,M(ig,this))})),M(Lv,this).on(dd.TIMELINE_STATE_CHANGE,M(Uv,this))),M(Bv,this)&&"function"==typeof M(Bv,this).on&&(C(Gv,this,(()=>{const t=M(ig,this);C(pg,this,!0),A(gg,this,bg).call(this),C(ig,this,t)})),M(Bv,this).on(dd.CANVAS_WEBGL_CONTEXT_LOST,M(Gv,this)),C(Hv,this,(()=>{var t;const e=null===(t=M(Bv,this))||void 0===t?void 0:t.gl;if(!e||"function"==typeof e.isContextLost&&e.isContextLost())return void C(pg,this,!0);const n=M(ig,this);C(pg,this,!1),A(gg,this,bg).call(this),C(ig,this,n),n&&A(gg,this,ry).call(this)&&A(gg,this,iy).call(this,n)})),M(Bv,this).on(dd.CANVAS_WEBGL_CONTEXT_RESTORED,M(Hv,this))),C(qv,this,(()=>{C(ng,this,null),M(ig,this)&&A(gg,this,ry).call(this)&&A(gg,this,iy).call(this,M(ig,this))})),M(zv,this)&&"function"==typeof M(zv,this).on&&M(zv,this).on(dd.CONTAINER_RESIZE,M(qv,this))}get name(){return"Renderer"}onDispose(){M(Lv,this)&&M(Wv,this)&&"function"==typeof M(Lv,this).off&&M(Lv,this).off(dd.VISUAL_FRAMES_AVAILABLE,M(Wv,this)),M(Lv,this)&&M($v,this)&&"function"==typeof M(Lv,this).off&&M(Lv,this).off(dd.TIMELINE_SEEKING,M($v,this)),M(Lv,this)&&M(jv,this)&&"function"==typeof M(Lv,this).off&&M(Lv,this).off(dd.TIMELINE_RESET,M(jv,this)),M(Lv,this)&&M(Vv,this)&&"function"==typeof M(Lv,this).off&&M(Lv,this).off(dd.TIMELINE_TIME_UPDATE,M(Vv,this)),M(Lv,this)&&M(Uv,this)&&"function"==typeof M(Lv,this).off&&M(Lv,this).off(dd.TIMELINE_STATE_CHANGE,M(Uv,this)),M(zv,this)&&M(qv,this)&&"function"==typeof M(zv,this).off&&M(zv,this).off(dd.CONTAINER_RESIZE,M(qv,this)),M(Bv,this)&&M(Gv,this)&&"function"==typeof M(Bv,this).off&&M(Bv,this).off(dd.CANVAS_WEBGL_CONTEXT_LOST,M(Gv,this)),M(Bv,this)&&M(Hv,this)&&"function"==typeof M(Bv,this).off&&M(Bv,this).off(dd.CANVAS_WEBGL_CONTEXT_RESTORED,M(Hv,this)),A(gg,this,bg).call(this),C(Wv,this,null),C($v,this,null),C(jv,this,null),C(Vv,this,null),C(Uv,this,null),C(qv,this,null),C(Gv,this,null),C(Hv,this,null),C(Kv,this,null),C(Qv,this,null),C(lg,this,null),C(cg,this,null),C(Bv,this,null),C(zv,this,null),C(Lv,this,null)}startTransition(t={}){var e,n;const i=null===(e=M(Bv,this))||void 0===e?void 0:e.element,r=null===(n=M(Bv,this))||void 0===n?void 0:n.gl;if(!i||!r)return null;if(M(pg,this)||"function"==typeof r.isContextLost&&r.isContextLost())return C(pg,this,!0),null;if(A(gg,this,Ig).call(this,i),!M(Jv,this))return null;const o=M(Qv,this).start({shaderGraph:M(Jv,this),duration:null==t?void 0:t.duration,filter:null==t?void 0:t.filter,color:null==t?void 0:t.color,filters:null==t?void 0:t.filters,reverseFilters:null==t?void 0:t.reverseFilters,transition:null==t?void 0:t.transition});return C(rg,this,M(ig,this)||null),A(gg,this,ty).call(this),o}beginTransitionIn(t={}){var e,n;null!==(e=M(Qv,this))&&void 0!==e&&null!==(n=e.beginIncoming)&&void 0!==n&&n.call(e,t),C(rg,this,null),A(gg,this,ty).call(this)}resetTransition(){var t,e;null!==(t=M(Qv,this))&&void 0!==t&&null!==(e=t.reset)&&void 0!==e&&e.call(t,M(Jv,this)),C(rg,this,null),A(gg,this,ey).call(this)}}function bg(){if(A(gg,this,_g).call(this),M(Qv,this)&&"function"==typeof M(Qv,this).reset&&M(Qv,this).reset(M(Jv,this)),A(gg,this,Jg).call(this,0),M(Jv,this)&&"function"==typeof M(Jv,this).dispose)try{M(Jv,this).dispose()}catch(t){}C(Jv,this,null),C(Zv,this,null),C(tg,this,[]),C(eg,this,[]),C(dg,this,!1),C(ng,this,null),C(Xv,this,null),C(Yv,this,null),C(ig,this,null),C(rg,this,null),A(gg,this,ey).call(this),A(gg,this,jg).call(this),C(cg,this,null)}function kg(){A(gg,this,_g).call(this),M(Qv,this)&&"function"==typeof M(Qv,this).reset&&M(Qv,this).reset(M(Jv,this)),A(gg,this,Jg).call(this,0),C(tg,this,[]),C(eg,this,[]),C(ng,this,null),C(Xv,this,null),C(Yv,this,null),C(ig,this,null),C(rg,this,null),A(gg,this,ey).call(this),A(gg,this,jg).call(this),C(cg,this,null),C(ug,this,null)}function wg(){const t="function"==typeof cd.requestAnimationFrame?cd.requestAnimationFrame.bind(cd):null,e="function"==typeof cd.cancelAnimationFrame?cd.cancelAnimationFrame.bind(cd):null;return t?{schedule:e=>t(e),cancel(t){"number"==typeof t&&e&&e(t)}}:null}function xg(t){C(mg,this,M(mg,this).filter((e=>e!==t))),M(mg,this).length||C(vg,this,null)}function _g(){M(vg,this)&&M(mg,this).forEach((t=>M(vg,this).call(this,t))),C(mg,this,[]),C(vg,this,null),C(fg,this,!1)}function Tg(){A(gg,this,_g).call(this),C(hg,this,!1)}function Eg(){if(M(hg,this)||M(fg,this))return;const t=A(gg,this,wg).call(this);if(!t)return;const{schedule:e,cancel:n}=t;let i;C(vg,this,n),C(fg,this,!0),i=e((()=>{let t;A(gg,this,xg).call(this,i),t=e((()=>{A(gg,this,xg).call(this,t),C(fg,this,!1),M(hg,this)||(C(hg,this,!0),M(Lv,this)&&"function"==typeof M(Lv,this).notifyFirstFrameRendered&&M(Lv,this).notifyFirstFrameRendered())})),M(mg,this).push(t)})),M(mg,this).push(i)}function Ig(t){if(M(Jv,this)||!t)return;const e=this,n={dest:t,src:(t,n)=>{C(Zv,e,n)}};C(Jv,e,new sm(n,{userWillCallRender:!0,glOptions:{contextType:"webgl2"},performanceToggles:{useCanvasSizedFilterTargets:!0}})),M(Jv,e)&&"function"==typeof M(Jv,e).addNodes&&M(Jv,e).addNodes({[oe.pipelineNodeId]:{type:"composite",options:{graph:[]}}})}function Sg(t){var e;if("null"===(null==t?void 0:t.message))return!0;const n=null===(e=M(Bv,this))||void 0===e?void 0:e.gl;return!(!n||"function"!=typeof n.isContextLost||!n.isContextLost())}function Ag(t,e,n){const i=e||M(ig,this)||null;if(A(gg,this,bg).call(this),C(ig,this,i),!n)return this.log.warn("Shader graph render failed; rebuilding graph once.",t),void A(gg,this,iy).call(this,i,!0);this.log.warn("Shader graph render is still unavailable after rebuild; deferring until the next render pass.",t)}function Ng(){var t;const e=null===(t=this.settings)||void 0===t?void 0:t.resourceLimits;return!e||"object"!=typeof e||Array.isArray(e)?{}:e}function Mg(){const t=A(gg,this,Ng).call(this).enabled;return!0===t||!1!==t&&vv()}function Fg(){if(!A(gg,this,Mg).call(this))return 0;const t=Dv(A(gg,this,Ng).call(this).transitionMinFrameIntervalMs,33);return Number.isFinite(t)&&t>0?t:0}function Cg(t,e,n={}){const i=!0===(null==n?void 0:n.useDevicePixelRatio),r=A(gg,this,Mg).call(this),o=i?Rv(null==cd?void 0:cd.devicePixelRatio,1):1;let s=o,a=0;if(r){const t=A(gg,this,Ng).call(this);a=Dv(t.maxCanvasPixels,Pv);const e=Dv(t.maxDevicePixelRatio,0);s=Rv(t.renderScale,1)*(e>0?Math.min(o,e):o)}let l=Math.max(1,Math.round(t*s)),c=Math.max(1,Math.round(e*s));if(r&&a>0){const t=l*c;if(t>a){const e=Math.sqrt(a/t);l=Math.max(1,Math.floor(l*e)),c=Math.max(1,Math.floor(c*e))}}return{width:l,height:c}}function Og(t=[],e={}){var n;const i=null===(n=M(Bv,this))||void 0===n?void 0:n.element,r=M(Zv,this);if(!i||"function"!=typeof r)return!1;let o=0,s=0;const a=!0===(null==e?void 0:e.useViewportSize);if(a){var l,c,u,d,h,f;const t=Number(null!==(l=null===(c=M(zv,this))||void 0===c?void 0:c.containerWidth)&&void 0!==l?l:null===(u=M(zv,this))||void 0===u?void 0:u.width),e=Number(null!==(d=null===(h=M(zv,this))||void 0===h?void 0:h.containerHeight)&&void 0!==d?d:null===(f=M(zv,this))||void 0===f?void 0:f.height);if(Number.isFinite(t)&&Number.isFinite(e)&&t>0&&e>0)o=Math.round(t),s=Math.round(e);else{const t=Number(i.clientWidth),e=Number(i.clientHeight);Number.isFinite(t)&&Number.isFinite(e)&&t>0&&e>0&&(o=Math.round(t),s=Math.round(e))}}if(!(o>0&&s>0)){if(!Array.isArray(t)||!t.length)return;for(let e=0;e<t.length;e+=1){var p;const n=null===(p=t[e])||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(gg,this,Cg).call(this,o,s,{useDevicePixelRatio:a}),v=m.width,g=m.height,y=M(ng,this);return!(y&&y.width===v&&y.height===g||(C(ng,this,{width:v,height:g}),r(null,null,v,g),0))}function Pg(t){const e=null==t?void 0:t.nodeId,n=null==t?void 0:t.trackId,i=null==t?void 0:t.segmentId,r=null==t?void 0:t.presentationTime;return e&&n&&i&&Number.isFinite(r)?`${e}:${n}:${i}@${r}`:null}function Rg(t,e,n){const i=Number.isFinite(null==t?void 0:t.duration)&&t.duration>0?t.duration:void 0;let r;if(i&&Number.isFinite(null==t?void 0:t.offset)){const n=(e-t.offset)/i;r=n<0?0:n>1?1:n}const o=A(gg,this,Dg).call(this,t),s=A(gg,this,Lg).call(this,o);return Xm.getRenderTiming({type:o,timing:{duration:i,normalizedTime:r},timelineTime:e,active:t,renderNodeParams:n,state:s})}function Dg(t){return Xm.normalizeType(null==t?void 0:t.type)||Xm.defaultType}function Lg(t){if(!t||!M(lg,this))return null;let e=M(lg,this).get(t);return e||(e={},M(lg,this).set(t,e)),e}function Bg(){var t,e,n,i,r,o,s,a,l,c,u;const d=Number(null!==(t=null===(e=M(zv,this))||void 0===e?void 0:e.containerWidth)&&void 0!==t?t:null===(n=M(zv,this))||void 0===n?void 0:n.width),h=Number(null!==(i=null===(r=M(zv,this))||void 0===r?void 0:r.containerHeight)&&void 0!==i?i:null===(o=M(zv,this))||void 0===o?void 0:o.height);if(Number.isFinite(d)&&Number.isFinite(h)&&d>0&&h>0)return{width:Math.round(d),height:Math.round(h)};const f=null===(s=M(Bv,this))||void 0===s?void 0:s.element,p=Number(null==f?void 0:f.clientWidth),m=Number(null==f?void 0:f.clientHeight);if(Number.isFinite(p)&&Number.isFinite(m)&&p>0&&m>0)return{width:Math.round(p),height:Math.round(m)};const v=Number(null!==(a=null==f?void 0:f.width)&&void 0!==a?a:null===(l=M(ng,this))||void 0===l?void 0:l.width),g=Number(null!==(c=null==f?void 0:f.height)&&void 0!==c?c:null===(u=M(ng,this))||void 0===u?void 0:u.height);return Number.isFinite(v)&&Number.isFinite(g)&&v>0&&g>0?{width:Math.round(v),height:Math.round(g)}:null}function zg(t){const e=A(gg,this,Lg).call(this,t);return e&&"object"==typeof e&&(e.requestRender=()=>A(gg,this,Wg).call(this),e.viewportSize=A(gg,this,Bg).call(this)),e}function Wg(){M(dg,this)||(C(dg,this,!0),Promise.resolve().then((()=>{C(dg,this,!1),M(ig,this)&&A(gg,this,ry).call(this)&&A(gg,this,iy).call(this,M(ig,this))})))}function $g(t){if(!t||!M(lg,this))return;const e=M(lg,this).get(t);e&&Xm.resetRenderState(t,e),M(lg,this).delete(t)}function jg(){M(lg,this)&&(Xm.resetAllRenderStates(M(lg,this)),M(lg,this).clear())}function Ug(t,e,n,i){const r=A(gg,this,Dg).call(this,t);M(cg,this)&&M(cg,this)!==r&&A(gg,this,$g).call(this,M(cg,this)),C(cg,this,r);const o=A(gg,this,zg).call(this,r);return Xm.prepareRenderFrames({type:r,frames:e,timelineTime:n,timeline:M(Lv,this),active:t,renderNodeParams:i,state:o})}function qg(t){var e;return null!=t&&t.params&&"object"==typeof t.params?t.params:!t&&null!==(e=this.settings)&&void 0!==e&&e.defaultRenderParams&&"object"==typeof this.settings.defaultRenderParams?this.settings.defaultRenderParams:{}}function Vg(t){return t?String(t.renderPlacementId||t.type||"unknown"):"default"}function Gg(){if(!M(Lv,this)||!M(ig,this))return;const t=M(Lv,this).currentTime,e=M(Lv,this).getActiveRenderPlacement(t),n=A(gg,this,Vg).call(this,e);n!==M(ug,this)&&(C(ug,this,n),A(gg,this,iy).call(this,{...M(ig,this),time:t}))}function Hg(t){return!t||"object"!=typeof t||!Object.prototype.hasOwnProperty.call(t,"panAndScan")||!1!==t.panAndScan}function Kg(t,e){const n=A(gg,this,qg).call(this,t),i=null==n?void 0:n.stages;let r=Mv(null==i?void 0:i.pre),o=Mv(null==i?void 0:i.post);const s=A(gg,this,Hg).call(this,n),a=A(gg,this,Dg).call(this,t),l=Fv(r,"retarget")||Fv(o,"retarget");if(s&&!l){const i=Xm.getPanAndScanTarget(a,{frameCount:Array.isArray(e)?e.length:0,active:t,renderNodeParams:n});if("pre"===i){const t=Cv(Array.isArray(e)?e.length:0);t&&(r=[t,...r])}else if("post"===i){const t=Cv(1);t&&(o=[...o,t])}}else s||(r=Ov(r),o=Ov(o));return{preStages:r,postStages:o,renderNodeParams:n}}function Xg(t,e,n,i,r){const o=r||A(gg,this,Rg).call(this,t,n,i),s=A(gg,this,Kg).call(this,t,e),a=A(gg,this,Dg).call(this,t),l=A(gg,this,zg).call(this,a);return M(Kv,this).build({layoutType:null==t?void 0:t.type,frames:e,preStages:s.preStages,postStages:s.postStages,normalizedTime:o.normalizedTime,renderNodeDuration:o.duration,renderNodeParams:s.renderNodeParams,renderNodeState:l,timelineTime:n})}function Yg(){var t,e;const n=null===(t=M(Qv,this))||void 0===t||null===(e=t.getState)||void 0===e?void 0:e.call(t);return"out"===(null==n?void 0:n.phase)?M(Qv,this).buildOutgoingGraph():"in"===(null==n?void 0:n.phase)?M(Qv,this).buildIncomingGraph():null}function Qg(t,e,n,i){const r=n||e!==M(Xv,this),o=r||i;return r&&M(Jv,this)&&"function"==typeof M(Jv,this).updateOptions&&(M(Jv,this).updateOptions(oe.pipelineNodeId,{graph:t}),C(Xv,this,e)),M(Jv,this)&&"function"==typeof M(Jv,this).selectNode&&M(Yv,this)!==oe.pipelineNodeId&&(M(Jv,this).selectNode(oe.pipelineNodeId),C(Yv,this,oe.pipelineNodeId)),!(!o||!M(Jv,this)||"function"!=typeof M(Jv,this).render||(M(Jv,this).render({noRaf:!0}),0))}function Jg(t){if(!Array.isArray(M(tg,this))||!M(tg,this).length)return;const e=Number.isFinite(t)?Math.max(0,t):0;if(!(M(tg,this).length<=e)){for(let t=e;t<M(tg,this).length;t+=1){const e=M(tg,this)[t];if(e&&M(Jv,this)&&"function"==typeof M(Jv,this).releaseTexture)try{M(Jv,this).releaseTexture(e)}catch(t){}}M(tg,this).length=e,M(eg,this).length=e}}function Zg(t=[]){if(!M(Jv,this)||"function"!=typeof M(Jv,this).addTexture)return{didUpdate:!1,hasUploadFailure:!1,ready:!1};if("function"==typeof M(Jv,this).isContextUnavailable&&M(Jv,this).isContextUnavailable())return{didUpdate:!1,hasUploadFailure:!1,ready:!1};if(!Array.isArray(t)||!t.length)return A(gg,this,Jg).call(this,0),{didUpdate:!1,hasUploadFailure:!1,ready:!1};A(gg,this,Jg).call(this,t.length);let e=!1,n=!1,i=!0;for(let o=0;o<t.length;o+=1){var r;M(tg,this)[o]||"function"!=typeof M(Jv,this).addTexture||(M(tg,this)[o]=M(Jv,this).addTexture(null,"frame",o));const s=A(gg,this,Pg).call(this,t[o]),a=null===(r=t[o])||void 0===r?void 0:r.frame;if(M(tg,this)[o]&&a){if(!s||s!==M(eg,this)[o])try{M(tg,this)[o].fill(a),M(eg,this)[o]=s,e=!0}catch(t){i=!1,n=!0,M(eg,this)[o]=null}}else i=!1}return{didUpdate:e,hasUploadFailure:n,ready:i}}function ty(){if(M(og,this))return;const t="function"==typeof cd.requestAnimationFrame?t=>cd.requestAnimationFrame(t):t=>setTimeout(t,16),e="function"==typeof cd.cancelAnimationFrame?t=>cd.cancelAnimationFrame(t):clearTimeout;C(sg,this,e);const n=()=>{var e,i;if(null!==(e=M(Qv,this))&&void 0!==e&&null!==(i=e.getState)&&void 0!==i&&i.call(e)){if(M(ig,this)){const t=A(gg,this,Fg).call(this),e=Date.now();(!t||!M(ag,this)||e-M(ag,this)>=t)&&(C(ag,this,e),A(gg,this,iy).call(this,M(ig,this)))}C(og,this,t(n))}else C(og,this,null)};C(og,this,t(n))}function ey(){M(og,this)&&M(sg,this)&&M(sg,this).call(this,M(og,this)),C(og,this,null),C(sg,this,null),C(ag,this,null)}function ny(t){var e,n;const i=null===(e=M(Qv,this))||void 0===e||null===(n=e.getState)||void 0===n?void 0:n.call(e);return"out"===(null==i?void 0:i.phase)&&M(rg,this)?M(rg,this):t}function iy(t={},e=!1){try{var n,i;t&&C(ig,this,t);const e=null===(n=M(Bv,this))||void 0===n?void 0:n.element,r=null===(i=M(Bv,this))||void 0===i?void 0:i.gl;if(!e||!r)return;if(M(pg,this)||"function"==typeof r.isContextLost&&r.isContextLost())return void C(pg,this,!0);if(!A(gg,this,ry).call(this))return;const o=A(gg,this,ny).call(this,t),s=Number.isFinite(null==o?void 0:o.time)?o.time:void 0;if(!Number.isFinite(s))return;if(A(gg,this,Ig).call(this,e),!M(Jv,this))return;const a=M(Lv,this)&&"function"==typeof M(Lv,this).getActiveRenderPlacement?M(Lv,this).getActiveRenderPlacement(s):void 0,l=A(gg,this,Vg).call(this,a);l!==M(ug,this)&&C(ug,this,l);const c=Array.isArray(null==o?void 0:o.frames)?o.frames:[],u=A(gg,this,qg).call(this,a),d=A(gg,this,Hg).call(this,u),h=A(gg,this,Ug).call(this,a,c,s,u),f=A(gg,this,Rg).call(this,a,s,u),p=A(gg,this,Og).call(this,h,{useViewportSize:d}),m=A(gg,this,Zg).call(this,h),v=m.didUpdate;if(h.length>0&&!m.ready)return void(m.hasUploadFailure&&this.log.warn("Skipping render because one or more input textures could not be uploaded."));const g=A(gg,this,Xg).call(this,a,h,s,u,f),y=A(gg,this,Yg).call(this);let b=g.graph,k=g.signature,w=!!g.isDynamic;y&&Array.isArray(y.graph)&&y.graph.length&&(b=b.concat(y.graph),k=`${k}|${y.signature||"transition"}`,w=w||!!y.forceUpdate);const x=p||v||w||y&&Array.isArray(y.graph)&&y.graph.length;A(gg,this,Qg).call(this,b,k,w,x)&&h.length>0&&A(gg,this,Eg).call(this)}catch(n){if(A(gg,this,Sg).call(this,n))return void A(gg,this,Ag).call(this,n,t,e);throw n}}function ry(){var t;const e=null===(t=M(Lv,this))||void 0===t?void 0:t.state;return e===_v||e===Ev||e===Tv||e===Sv}function oy(t){return"number"==typeof t&&Number.isFinite(t)&&t>0}function sy(t){return t&&"resource"===t.entryType&&t.transferSize>0&&t.duration>0&&t.responseEnd>=t.requestStart}function ay(t){return Array.isArray(t)&&0!==t.length?t.reduce(((t,e)=>t+e),0)/t.length:NaN}oe=yg;var ly=new WeakMap,cy=new WeakMap,uy=new WeakMap,dy=new WeakMap,hy=new WeakSet;class fy extends sd{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(...t){super(...t),O(this,hy),F(this,ly,void 0),F(this,cy,void 0),F(this,uy,void 0),F(this,dy,void 0),C(ly,this,!!(cd&&cd.navigator&&cd.navigator.connection)),C(cy,this,!(!cd||!cd.performance||"function"!=typeof cd.performance.getEntriesByType)),C(uy,this,A(hy,this,my).call(this)),C(dy,this,A(hy,this,ky).call(this))}guesstimate(){const t=A(hy,this,xy).call(this);this.log.debug("[guesstimate] Data:",t);const e=A(hy,this,wy).call(this,t),n=oy(e)?e:t.defaultKbps;return A(hy,this,vy).call(this,n),this.log.info(`[guesstimate] Result: ${n} kbps`),n}update(t){oy(t)&&A(hy,this,vy).call(this,t)}onDispose(){C(uy,this,void 0),C(dy,this,void 0)}}function py(){return Math.round(Date.now()/1e3)}function my(){try{if(!cd||!cd.localStorage||"function"!=typeof cd.localStorage.getItem)return}catch(t){return}const t=this.settings.persistentStorage.key,e=cd.localStorage.getItem(t);if(e)try{const t=JSON.parse(e),n=this.settings.persistentStorage.ttl,i=A(hy,this,py).call(this)-t.timestamp;if("number"==typeof n&&n>=0&&i>n)return null;if(!oy(t.value))return;return t.value}catch(t){return}}function vy(t){if(!oy(t))return;try{if(!cd||!cd.localStorage||"function"!=typeof cd.localStorage.setItem)return}catch(t){return}const e=this.settings.persistentStorage.key,n=JSON.stringify({value:t,timestamp:A(hy,this,py).call(this)});try{cd.localStorage.setItem(e,n),C(uy,this,t)}catch(t){}}function gy(){return cd&&cd.performance&&"function"==typeof cd.performance.getEntriesByType?ay(cd.performance.getEntriesByType("resource").filter(sy).map((t=>8*t.transferSize/t.duration))):NaN}function yy(){if(!cd||!cd.navigator||!cd.navigator.connection)return NaN;const t=cd.navigator.connection.downlink;return oy(t)?1e3*t:NaN}function by(){if(!M(ly,this))return NaN;const t=cd.navigator.connection,e=t.effectiveType||t.type,n=this.settings.connectionType||{};return e&&Object.prototype.hasOwnProperty.call(n,e)?n[e]:NaN}function ky(){const t=this.settings.ua||{};return mv()?t.android:vv()?t.ios:t.desktop}function wy(t){const e=Array.isArray(this.settings.priorities)?this.settings.priorities:[];for(let n=0;n<e.length;n+=1){const i=e[n];if(!Array.isArray(i)||0===i.length)continue;const r=i.map((e=>t[e])).filter((t=>oy(t)));if(r.length===i.length)return this.log.debug("[#selectFromPriorities] Selected from priorities:",i,"with values:",r),ay(r)}return NaN}function xy(){const t=this.settings.testOverrides||{},e=oy(t.resourceTiming)?t.resourceTiming:A(hy,this,gy).call(this),n=oy(t.downlink)?t.downlink:A(hy,this,yy).call(this),i=oy(t.persistentValue)?t.persistentValue:M(uy,this),r=oy(t.connectionType)?t.connectionType:A(hy,this,by).call(this),o=oy(t.ua)?t.ua:M(dy,this);return{defaultKbps:this.settings.defaultKbps,resourceTiming:e,downlink:n,connectionType:r,persistentValue:i,ua:o}}const _y=new td;function Ty(t){return"string"!=typeof t||0===t.length?[]:t.split(".").filter((t=>t.length>0))}function Ey(t){if("string"!=typeof t)return!1;if(0===t.length)return!1;const e=Number(t);return Number.isInteger(e)&&String(e)===t}function Iy(t){return null!==t&&"object"==typeof t}function Sy(t,e,n){const i=Ty(e);if(0===i.length)return void 0===t?n:t;let r=t;for(let t=0;t<i.length;t+=1){if(null==r)return n;if(r=r[i[t]],void 0===r)return n}return void 0===r?n:r}function Ay(t,e,n){if(!Iy(t))return t;const i=Ty(e);if(0===i.length)return t;let r=t;for(let t=0;t<i.length;t+=1){const e=i[t];if(t===i.length-1){r[e]=n;break}Iy(r[e])||(r[e]=Ey(i[t+1])?[]:{}),r=r[e]}return t}const Ny={get:(t,e)=>cd&&cd.eko?Sy(cd.eko,t,e):e,set(t,e){if(cd)return cd.eko&&"object"==typeof cd.eko||(cd.eko={}),Ay(cd.eko,t,e),cd.eko}},My=cd&&cd.performance,Fy=My&&"function"==typeof My.now?()=>My.now():()=>Date.now();function Cy(){return"undefined"==typeof AbortController?null:new AbortController}function Oy(){const t=new Error("The operation was aborted");return t.name="AbortError",t.code="ABORT_ERR",t}function Py(t,e){return!(!e||!e.aborted)||!!t&&("AbortError"===t.name||"ABORT_ERR"===t.code||20===t.code)}const Ry=2,Dy=100,Ly=2,By="runtime.downloadSpeedSamples",zy=Zu("download","warn");function Wy(t){return new Promise((e=>{setTimeout(e,t)}))}function $y(t){return t>=500}function jy(t){if(!t||!t.headers||"function"!=typeof t.headers.get)return 0;const e=t.headers.get("content-length");if(!e)return 0;const n=Number(e);return Number.isNaN(n)||n<0?0:n}function Uy(t,e,n,i,r,o){const s={bytes:t,durationMs:e,kbps:e>0?8*t/e:0,startTime:n,endTime:i,url:o};try{let t=Ny.get(r);t||(t=[],Ny.set(r,t)),t.push(s)}catch(t){}return s}async function qy(t,e={}){const{method:n="GET",headers:i,body:r,retries:o=Ry,retryDelay:s=Dy,backoffFactor:a=Ly,samplesTargetPath:l=By,fetch:c,loglevel:u="warn",cache:d,signal:h,onProgress:f,returnType:p="default"}=e;zy.setLevel(u);const m=function(t){if(t)return t;if(cd&&"function"==typeof cd.fetch)return cd.fetch.bind(cd);throw new Error("fetch is not available in this environment")}(c);let v=0,g=s;for(;;){if(h&&h.aborted)throw Oy();const e=Fy();try{const s=await m(t,{method:n,headers:i,body:r,cache:d,mode:"cors",signal:h});if(h&&h.aborted)throw Oy();if(!s.ok){if(v<o&&$y(s.status)){v+=1,zy.warn(`[${t}] Download attempt #${v} failed with status ${s.status}, retrying in ${g}ms...`),await Wy(g),g*=a;continue}zy.error(`[${t}] Download attempt #${v} failed with status ${s.status}, no more retries.`);const e=new Error(`Download failed with status ${s.status}`);throw e.status=s.status,e}let c=Fy();const u=jy(s),y="arrayBuffer"===p||"bytes"===p,b=y&&"function"==typeof f;let k,w,x,_,T,E=0;if(y&&s.body&&"function"==typeof s.body.getReader&&b){const t=s.body.getReader(),e=[];for(;;){if(h&&h.aborted)throw Oy();const{done:n,value:i}=await t.read();if(n)break;if(i&&i.length){const t=Fy();Number.isFinite(_)||(_=t),T=t,e.push(i),E+=i.length,f({loaded:E,total:u||void 0,chunk:i})}}k=new Uint8Array(E);let n=0;e.forEach((t=>{k.set(t,n),n+=t.length})),c=Fy()}else if(y){const t=await s.arrayBuffer();k=new Uint8Array(t),E=k.length,c=Fy()}else"text"===p?(w=await s.text(),c=Fy()):"json"===p&&(x=await s.json(),c=Fy());if(h&&h.aborted)throw Oy();const I=y?k?k.length:E:("text"===p&&"string"==typeof w?w.length:0)||("json"===p&&x?JSON.stringify(x).length:0),S=u||I||0;let A=e,N=c;Number.isFinite(_)&&(A=_,Number.isFinite(T)&&(N=Math.max(T,c))),(!Number.isFinite(A)||!Number.isFinite(N)||N<A)&&(A=e,N=c);const M=Math.max(0,N-A),F=Uy(S,M,A,N,l,t);try{_y.trigger("download:sample",F)}catch(t){}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 t=k||new Uint8Array(await s.arrayBuffer());return"arrayBuffer"===p?t.buffer:t}return"text"===p?w:"json"===p?x:C}catch(e){if(Py(e,h))throw"AbortError"===e.name?e:Oy();if(!(v<o)||e.status&&!$y(e.status))throw zy.error(`[${t}] Download attempt #${v} failed with error ${e}, no more retries.`),e;v+=1,zy.warn(`[${t}] Download attempt #${v} failed with error ${e}, retrying in ${g}ms...`),await Wy(g),g*=a}}}const Vy={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"]}},Gy=Object.freeze(Object.entries(Vy).reduce(((t,[e,n])=>(Object.prototype.hasOwnProperty.call(n,"default")&&(t[e]=n.default),t)),{})),Hy=Zu("config","warn");function Ky(t){return Gy[t]}var Xy=new WeakMap,Yy=new WeakMap,Qy=new WeakMap,Jy=new WeakMap,Zy=new WeakMap,tb=new WeakSet;class eb extends sd{get name(){return"DownloadSpeed"}get defaults(){return{alpha:.3,maxSamples:30,minBytesPerSample:1024,minDurationMs:5,maxSampleKbpsCap:void 0,ignoreCacheHits:!0,samplesPath:"runtime.downloadSpeedSamples",initialKbps:Ky("initialKbps"),probeUrl:void 0,defaultKbps:2500}}constructor(...t){super(...t),O(this,tb),F(this,Xy,void 0),F(this,Yy,void 0),F(this,Qy,void 0),F(this,Jy,void 0),F(this,Zy,void 0),C(Qy,this,[]),C(Yy,this,0),C(Xy,this,A(tb,this,rb).call(this)),C(Zy,this,Cy()),C(Jy,this,(t=>{A(tb,this,ub).call(this,t,"event")})),A(tb,this,ob).call(this),_y.on("download:sample",M(Jy,this)),A(tb,this,sb).call(this),this.log.debug(`[#constructor] Initial estimate: ${M(Xy,this)} kbps`)}getKbps(){return M(Xy,this)}addSample(t){A(tb,this,ub).call(this,t,"manual")}reset(){C(Qy,this,[]),C(Yy,this,0),C(Xy,this,A(tb,this,rb).call(this))}onDispose(){M(Zy,this)&&M(Zy,this).abort(),C(Zy,this,null),_y.off("download:sample",M(Jy,this)),C(Qy,this,[]),C(Yy,this,0),C(Xy,this,void 0),C(Jy,this,null)}}function nb(t,e){return!!(this.settings.ignoreCacheHits&&(0===e||t&&"boolean"==typeof t.cached&&t.cached||t&&"number"==typeof t.transferSize&&"number"==typeof t.encodedBodySize&&t.transferSize<=t.encodedBodySize))}function ib(t){if(!t||"object"!=typeof t)return null;const e=Number(t.bytes),n=Number(t.durationMs);let i=oy(t.kbps)?Number(t.kbps):NaN;return!oy(i)&&n>0&&oy(e)&&(i=8*e/n),oy(i)?e<=this.settings.minBytesPerSample||n<=this.settings.minDurationMs||A(tb,this,nb).call(this,t,e)?null:(oy(this.settings.maxSampleKbpsCap)&&i>this.settings.maxSampleKbpsCap&&(i=this.settings.maxSampleKbpsCap),{...t,bytes:e,durationMs:n,kbps:i}):null}function rb(){const t=this.settings.initialKbps;if(oy(t))return t;if("auto"===t)try{const t=(new fy).guesstimate();if(oy(t))return t}catch(t){}return this.settings.defaultKbps}function ob(){const t=Ny.get(this.settings.samplesPath,[]);if(!Array.isArray(t)||0===t.length)return;const e=t.slice(-this.settings.maxSamples);for(let t=0;t<e.length;t+=1)A(tb,this,ub).call(this,e[t],"replay",{emit:!1})}async function sb(){if(!this.settings.probeUrl||M(Yy,this)>0)return;const t=M(Zy,this)?M(Zy,this).signal:void 0;if(!t||!t.aborted)try{await qy(this.settings.probeUrl,{cache:"no-store",samplesTargetPath:this.settings.samplesPath,signal:t})}catch(t){}}function ab(t){return"number"==typeof t.startTime&&"number"==typeof t.endTime&&Number.isFinite(t.startTime)&&Number.isFinite(t.endTime)&&t.startTime>=0&&t.endTime>t.startTime}function lb(t,e){if(!A(tb,this,ab).call(this,t)||!A(tb,this,ab).call(this,e))return 0;const n=Math.max(t.startTime,e.startTime);return Math.min(t.endTime,e.endTime)-n}function cb(t){if(!A(tb,this,ab).call(this,t))return t;const e=[];for(let n=0;n<M(Qy,this).length;n+=1){const i=M(Qy,this)[n];A(tb,this,ab).call(this,i)&&(A(tb,this,lb).call(this,t,i)>0&&e.push(i))}if(0===e.length)return t;C(Qy,this,M(Qy,this).filter((t=>!e.includes(t))));const n=[t,...e],i=n.reduce(((t,e)=>t+(e.bytes||0)),0),r=Math.min(...n.map((t=>t.startTime))),o=Math.max(...n.map((t=>t.endTime))),s=o-r;if(!oy(i)||s<=0)return t;const a={bytes:i,durationMs:s,kbps:8*i/s,startTime:r,endTime:o,url:t.url||e[e.length-1].url};return A(tb,this,ib).call(this,a)}function ub(t,e,{emit:n=!0}={}){const i=A(tb,this,ib).call(this,t);if(!i)return;const r=A(tb,this,cb).call(this,i);if(!r)return;C(Yy,this,M(Yy,this)+1),M(Qy,this).push(r),M(Qy,this).length>this.settings.maxSamples&&M(Qy,this).shift();const o=this.defaults.alpha,s="number"==typeof this.settings.alpha?this.settings.alpha:o,a=oy(M(Xy,this)),l=a?M(Xy,this):r.kbps,c=a||1!==M(Yy,this)?s*r.kbps+(1-s)*l:r.kbps;C(Xy,this,c),this.log.debug(`[#ingestSample] Next estimate: ${c} kbps`),n&&this.trigger("download:speed",{kbps:M(Xy,this),sample:r,source:e,samplesCount:M(Yy,this)})}class db{constructor(t={}){const{id:e,url:n,uri:i,mime:r,codecs:o,bandwidth:s,timescale:a,sizeBytes:l,...c}=t;if(!e)throw new Error("Representation requires id");const u=n||i;if(!u)throw new Error("Representation requires url or uri");this.id=e,this.url=u,this.mime=r,this.codecs=o,this.baseCodec=function(t=""){if(!t||"string"!=typeof t)return;const e=t.split(",")[0].trim();if(!e)return;const n=e.match(/^[a-z0-9]+/i);return n?n[0].toLowerCase():void 0}(o),oy(s)&&(this.bandwidth=s),oy(a)&&(this.timescale=a),oy(l)&&(this.sizeBytes=l),Object.assign(this,c)}}class hb{#F=new Map;#C;#O;#P=0;#R;constructor(t={}){const{id:e,offset:n=0,duration:i=0,isInit:r=!1,representations:o=[]}=t;if(!e)throw new Error("Segment requires id");o.forEach((t=>{if(!t||!t.url&&!t.uri)throw new Error("Segment representation must include uri or url")})),this.id=e,this.offset=n,this.duration=i,this.isInit=!!r,this.originalRepresentations=o.map((t=>t instanceof db?t:new db(t))),this.representations=this.originalRepresentations.map((t=>t)),this.appliedFilters=[],this.loadAttempts=0,this.loadError=void 0}setRepresentationBuffer(t,e){t&&e&&this.#F.set(t,e)}setDownloadProgress(t,e){const n=Number(t);Number.isFinite(n)&&n>=0&&(this.#P=Math.max(this.#P,n));const i=Number(e);Number.isFinite(i)&&i>0&&(this.#R=i)}setChosenRepresentation(t){this.#C=t;const e=null==t?void 0:t.id;if(!(this.isInit||!e||this.#F.size<=1))for(const t of this.#F.keys())t!==e&&this.#F.delete(t)}setABRDecisionSnapshot(t){if(!t||"object"!=typeof t)return void(this.#O=void 0);const e={...t};Array.isArray(t.availableRepresentations)&&(e.availableRepresentations=t.availableRepresentations.map((t=>({...t})))),this.#O=e}markLoadAttempt(){const t=Number(this.loadAttempts);this.loadAttempts=Number.isFinite(t)&&t>0?t+1:1,this.loadError=void 0}setLoadError(t){this.loadError=t||new Error("Segment load failed")}getRepresentationBuffer(t){return this.#F.get(t)}get chosenRepresentation(){return this.#C}get abrDecision(){return this.#O}get arrayBuffer(){return this.#C?this.#F.get(this.#C.id):void 0}get retainedByteLength(){let t=0;for(const e of this.#F.values())e&&"number"==typeof e.byteLength&&(t+=e.byteLength);return t}get bufferedRatio(){var t;const e=oy(this.#R)?this.#R:null===(t=this.#C)||void 0===t?void 0:t.sizeBytes;return oy(e)?Math.min(1,Math.max(0,this.#P/e)):this.retainedByteLength>0?1:0}get isLoaded(){return this.retainedByteLength>0}evict(){this.#C=void 0,this.#O=void 0,this.#F.clear(),this.#P=0,this.#R=void 0}}class fb{constructor(t={}){const{timestamp:e,name:n,data:i,isSticky:r=!1}=t;this.timestamp="number"==typeof e?e:0,this.name="string"==typeof n?n:"",this.data=i,this.isSticky="boolean"==typeof r&&r}}function pb(t,e){const n=Number(null==t?void 0:t.offset),i=Number(null==t?void 0:t.duration);if(!e)return{offset:n,duration:i};const r=(null==t?void 0:t.chosenRepresentation)||(Array.isArray(null==t?void 0:t.representations)?t.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 mb(t,e,n={}){if(!Array.isArray(t)||!t.length)return;const i=Number(e);if(!Number.isFinite(i))return;const r=!!n.preferRepresentationTime;let o,s,a=-1/0;for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||n.isInit)continue;o||(o=n);const l=pb(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 vb=new Set(["video","audio","image","cue","data","bbox"]);let gb=class{constructor(t={}){const{id:e,type:n,offset:i=0,duration:r,source:o,segments:s=[],cues:a=[]}=t;if(!e)throw new Error("Track requires id");if(!vb.has(n))throw new Error(`Track type must be one of ${Array.from(vb).join("|")}`);this.id=e,this.type=n,this.offset=i,this.duration=oy(r)?r:void 0,this.source=o,"cue"===n?(this._cues=a.map((t=>t instanceof fb?t:new fb(t))),this._segments=[]):(this._segments=s.map((t=>t instanceof hb?t:new hb(t))),this._cues=void 0)}get segments(){return this._segments.slice()}get cues(){if("cue"===this.type)return this._cues.slice()}get endTime(){if(oy(this.duration))return this.offset+this.duration;if(!this._segments.length)return;const t=this._segments.reduce(((t,e)=>{const n=oy(e.duration)?e.duration:0;return Math.max(t,e.offset+n)}),this.offset);return t}get buffered(){const t=this._segments.map((t=>({duration:oy(null==t?void 0:t.duration)?t.duration:0,offset:oy(null==t?void 0:t.offset)?t.offset:0,ratio:t&&!t.isInit&&"number"==typeof t.bufferedRatio?t.bufferedRatio:0}))).filter((t=>t.duration>0&&t.ratio>0));if(!t.length)return;const e=t.reduce(((t,e)=>Math.min(t,e.offset)),1/0),n=t.reduce(((t,e)=>{const n=e.offset+e.duration*Math.min(1,e.ratio);return Math.max(t,n)}),0);return!Number.isFinite(e)||!Number.isFinite(n)||n<=e?void 0:{start:e,end:n}}getMediaSegmentAtTime(t,e={}){return mb(this._segments,t,e)}setSegments(t=[]){if("cue"===this.type)return;const e=Array.isArray(t)?t:[];this._segments=e.map((t=>t instanceof hb?t:new hb(t)))}};function yb(t){return"string"==typeof t?t:t&&"object"==typeof t?t.nodeId||t.nodeIdOrRef||t.id:void 0}function bb(t){const e=yb(t);let n=1;if(t&&"object"==typeof t&&oy(t.weight)&&(n=t.weight),!e)throw new Error("Child entry requires a nodeId");return{nodeId:e,weight:n}}function kb(t){return(Array.isArray(t)?t:[]).map((t=>bb(t)))}function wb(t,e=void 0){if("string"==typeof t){const e=t.match(/\d+\.?\d*/);if(e){const t=Number(e[0]);if(Number.isFinite(t))return t}}else if("number"==typeof t&&Number.isFinite(t))return t;return e}function xb(t,e){if(t){if(t.includes("$Number%")){const n=t.match(/\$Number%0(\d+)d\$/);if(n){const i=Number(n[1]),r=String(e).padStart(i,"0");return t.replace(/\$Number%0\d+d\$/,r)}}return t.replace(/\$Number\$/g,String(e))}}function _b(t,e){if(e)try{var n;return new URL(e,t||(null==cd||null===(n=cd.location)||void 0===n?void 0:n.href)||void 0).toString()}catch(t){return e}}const Tb=new Map;class Eb{static register(t,e){if(!t||"function"!=typeof e)throw new Error("ManifestFactory.register requires type and parser function");Tb.set(t,e)}static inferType(t={}){const{typeHint:e,url:n,mimeType:i,body:r}=t;return e||function(t=""){const e=function(t=""){return t&&"string"==typeof t?t.split("#")[0].split("?")[0].toLowerCase():""}(t);return e.endsWith(".mpd")?"dash":e.endsWith(".ivd")?"ivd":e.endsWith(".jpg")||e.endsWith(".jpeg")||e.endsWith(".png")||e.endsWith(".webp")||e.endsWith(".gif")||e.endsWith(".avif")?"image":void 0}(n||"")||function(t=""){const e=t.toLowerCase();return e.includes("dash")||e.includes("mpd")||e.includes("xml")?"dash":e.includes("ivd")||e.includes("json")?"ivd":e.includes("image/")?"image":void 0}(i||"")||function(t=""){const e="string"==typeof t?t.trim():"";if(e.startsWith("<")&&e.includes("<MPD"))return"dash";if(e.startsWith("{"))try{const t=JSON.parse(e);if(t&&"object"==typeof t)return"ivd"}catch(t){return}}(r||"")}static parse(t={}){const e=Eb.inferType(t);if(!e||!Tb.has(e))throw new Error("Unsupported manifest type");return Tb.get(e)(t)}}Eb.register("dash",(function(t={}){const{body:e,url:n}=t,i=function(){if(cd&&"function"==typeof cd.DOMParser)return new cd.DOMParser;throw new Error("DOMParser is not available in this environment")}().parseFromString(e||"","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=wb(r.getAttribute("mediaPresentationDuration"));l=Number.isFinite(l)?l:void 0,s.forEach(((t,e)=>{const i=t.getAttribute("mimeType")||"",r=function(t=""){const e=t.toLowerCase();return e.includes("video")?"video":e.includes("audio")?"audio":e.includes("image")?"image":"data"}(i),o=t.getAttribute("id")||`${r}-${e+1}`,s=t.getElementsByTagName("SegmentTemplate")[0],c=Array.from(t.getElementsByTagName("Representation")).map((t=>function(t,e,n){const i=t.getAttribute("id")||t.getAttribute("representationId")||"",r=wb(t.getAttribute("bandwidth")),o=t.getAttribute("codecs"),s=t.getAttribute("mimeType")||e&&e.getAttribute("mimeType")||n,a=t.getElementsByTagName("SegmentTemplate")[0]||e;return{repId:i,bandwidth:r,codecs:o,mime:s,media:a?a.getAttribute("media"):void 0,initialization:a?a.getAttribute("initialization"):void 0,timescale:wb(a&&a.getAttribute("timescale"))||wb(e&&e.getAttribute("timescale"),1)||1,startNumber:wb(a&&a.getAttribute("startNumber"))||wb(e&&e.getAttribute("startNumber"),1)||1,timeline:function(t){const e=[],n=t.getElementsByTagName("SegmentTimeline")[0];if(!n)return e;const i=Array.from(n.getElementsByTagName("S"));let r=0;for(let t=0;t<i.length;t+=1){const n=i[t],o=wb(n.getAttribute("t")),s=wb(n.getAttribute("d")),a=wb(n.getAttribute("r"),0);if(!oy(s))continue;oy(o)&&(r=o);const l=a>=0?a:0;for(let t=0;t<=l;t+=1)e.push({start:r,duration:s}),r+=s}return e}(a)}}(t,s,i))),u=c.map((t=>({id:t.repId,url:_b(n,xb(t.initialization,t.startNumber)),bandwidth:t.bandwidth,mime:t.mime,codecs:t.codecs,timescale:t.timescale}))).filter((t=>t.url)),d=c.reduce(((t,e)=>{const n=Array.isArray(null==t?void 0:t.timeline)?t.timeline.length:0;return(Array.isArray(null==e?void 0:e.timeline)?e.timeline.length:0)>n?e:t}),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 t=0;t<f;t+=1){const e=h[t];if(!e)continue;const i=c.map((e=>{const i=e.startNumber+t,r=e.timescale||m,o=Array.isArray(e.timeline)?e.timeline[t]:void 0;if(!o)return null;const s=o.start,a=o.duration;return{id:e.repId,url:_b(n,xb(e.media,i)),bandwidth:e.bandwidth,mime:e.mime,codecs:e.codecs,timescale:e.timescale,segIndex:t,segStart:s/r,segDuration:a/r}})).filter(Boolean);i.length&&p.push({id:`${o}-seg-${t+1}`,offset:e.start/m,duration:e.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}})),Eb.register("ivd",(function(t={}){var e;const{body:n,url:i}=t;let r;try{r="string"==typeof n?JSON.parse(n):n}catch(t){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(((t,e)=>{const n=function(t){const e=(t.mimeType||"").toLowerCase();return e.includes("video")?"video":e.includes("audio")?"audio":"data"}(t),i=Number.isInteger(t.altIndex)?t.altIndex:0,r=`${n}-${i}`,o=(l=e,{id:`${(a=t).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:oy(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(((t,e)=>{const n=new Map;t.reps.forEach((t=>{const e=Number.isInteger(t.segIndex)?t.segIndex:0;n.has(e)||n.set(e,[]),n.get(e).push(t)}));const i=Array.from(n.keys()).sort(((t,e)=>t-e));let o=0;const s=i.map((i=>{var r;const s=n.get(i)||[],a=(null===(r=s.find((t=>oy(t.duration))))||void 0===r?void 0:r.duration)||0,l={id:`${t.type}-${t.altIndex}-${e+1}-seg-${i+1}`,offset:o,duration:a,isInit:!1,representations:s.map((t=>{const{duration:e,segIndex:n,...i}=t;return i}))};return o+=a,l})),a=s.reduce(((t,e)=>t+(oy(e.duration)?e.duration:0)),0),l=oy(r.duration)?r.duration:a||void 0;return{id:`${t.type}-${t.altIndex}-${e+1}`,type:t.type,offset:0,duration:l,segments:s}})),l=r.mainTrackId||(null===(e=a.find((t=>"video"===t.type)))||void 0===e?void 0:e.id)||a[0]&&a[0].id,c=a.find((t=>t.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}})),Eb.register("image",(function(t={}){const e=null==t?void 0:t.url;if(!e||"string"!=typeof e)throw new Error("ImageParser requires url");const n=oy(null==t?void 0:t.duration)?t.duration:30,i=oy(null==t?void 0:t.width)?t.width:void 0,r=oy(null==t?void 0:t.height)?t.height:void 0,o={id:"image-1",url:e,mime:"string"==typeof(null==t?void 0:t.mimeType)?t.mimeType:void 0};oy(i)&&oy(r)&&(o.width=i,o.height=r);const s="image-1";return{id:e,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 Ib=["video/mp4"];function Sb(t){return Ib.includes(t.mime)}var Ab={name:"containers",fn:function(t=[]){return t.filter(Sb)},isRelevantForTrack:function(t){return"video"===(null==t?void 0:t.type)}};const Nb=new(se=new WeakMap,ae=new WeakSet,class extends sd{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(...t){super(...t),O(this,ae),F(this,se,void 0),C(se,this,new Map)}onDispose(){M(se,this)&&M(se,this).clear()}async sortRepsCodecs(t=[]){if(!Array.isArray(t)||0===t.length)return[];const e=[],n=new Set;let i=0;t.forEach((t=>{const r=null==t?void 0:t.baseCodec;r&&!n.has(r)&&(n.add(r),e.push({codec:r,rep:t,index:i}),i+=1)}));const r=(await Promise.all(e.map((async t=>{const{score:e}=await A(ae,this,Pb).call(this,t.rep);return{...t,score:e}})))).sort(((t,e)=>{const n=e.score-t.score;return 0!==n?n:t.index-e.index}));return this.log.info("[sortRepsCodecs] Sorted entries:",r),r.map((t=>t.codec))}});function Mb(){return!!(cd&&cd.navigator&&cd.navigator.mediaCapabilities&&"function"==typeof cd.navigator.mediaCapabilities.decodingInfo)}function Fb(t){if(!t||"object"!=typeof t)return void this.log.debug("[#buildConfig] Invalid representation:",t);const e=t.mime||t.mimeType||"",n=function(t="",e=""){const n=t||"",i=e||"";return i?`${n}; codecs="${i}"`:n}(e,t.codecs||"");return function(t=""){return t.toLowerCase().includes("video")}(e)?(this.log.debug("[#buildConfig] Building video config for:",t),{type:"file",video:{contentType:n,width:t.width||1920,height:t.height||1080,bitrate:t.videoBandwidth||t.bandwidth||0,framerate:t.framerate||t.frameRate||24}}):function(t=""){return t.toLowerCase().includes("audio")}(e)?(this.log.debug("[#buildConfig] Building audio config for:",t),{type:"file",audio:{contentType:n,channels:t.channels||2,bitrate:t.audioBandwidth||t.bandwidth||0,samplerate:t.audioSamplingRate||48e3}}):void this.log.debug("[#buildConfig] Unknown mime type:",e)}function Cb(t){return t?JSON.stringify(t):"invalid"}async function Ob(t){if(!this.settings.enabled||!A(ae,this,Mb).call(this)||!t)return this.log.debug("[#queryCapabilities] Not supported, returning false",t),{supported:!1,smooth:!1,powerEfficient:!1};const e=A(ae,this,Cb).call(this,t),n=M(se,this).get(e);if(n)return n;let i;try{i=await cd.navigator.mediaCapabilities.decodingInfo(t)}catch(t){i={supported:!1,smooth:!1,powerEfficient:!1}}return this.log.debug("[#queryCapabilities] Config:",t,"\nDecoding info result:",i),M(se,this).set(e,i),i}async function Pb(t){if(A(ae,this,Db).call(this,t))return this.log.debug("[#scoreRepresentation] Blocking HEVC on Firefox versions below support threshold",null==t?void 0:t.codecs),{score:-1e3,capability:{supported:!1,smooth:!1,powerEfficient:!1}};const e=A(ae,this,Fb).call(this,t),n=await A(ae,this,Ob).call(this,e),i=function(t="",e={}){const n=(t||"").toLowerCase();return Object.keys(e).reduce(((t,i)=>n.includes(i.toLowerCase())?e[i]:t),0)}(t.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 Rb(){if(!bv())return!1;const t=kv();return!Number.isFinite(t)||t<150}function Db(t){if(!A(ae,this,Rb).call(this))return!1;const e=function(t=""){const e=String(t||"").toLowerCase(),[n]=e.split(".");return n||""}((null==t?void 0:t.baseCodec)||(null==t?void 0:t.codecs)||"");return"hvc1"===e||"hev1"===e}const Lb=[],Bb=()=>!0;[Ab,{name:"force-video-codec",fn:function(t=[],{node:e}={}){const n=function(t){if("string"!=typeof t)return;const e=t.split(",")[0].trim();if(!e)return;const n=e.match(/^[a-z0-9]+/i);return n?n[0].toLowerCase():void 0}(null==e?void 0:e.forceVideoCodec);if(!n)return t;const i=t.filter((t=>(null==t?void 0:t.baseCodec)===n));return i.length?i:t},isRelevantForTrack:function(t){return"video"===(null==t?void 0:t.type)}},{name:"media-capabilities",fn:async function(t=[],{track:e}){if(null==e||!e.preferredCodec){const n=await Nb.sortRepsCodecs(t);if(!Array.isArray(n)||0===n.length)return t;e.preferredCodec=n[0]}return t.filter((t=>(null==t?void 0:t.baseCodec)===e.preferredCodec))},isRelevantForTrack:function(t){return"video"===(null==t?void 0:t.type)}}].forEach((({name:t,fn:e,isRelevantForTrack:n})=>{!function(t,e,{isRelevantForTrack:n}={}){if(!t||"function"!=typeof e)throw new Error("registerRepresentationFilter requires a name and function");const i="function"==typeof n?n:Bb;Lb.push({name:t,fn:e,isRelevantForTrack:i})}(t,e,{isRelevantForTrack:n})}));const zb=Zu("Node","warn"),Wb={start:0,end:0},$b=.001;function jb(t){if(!Array.isArray(t)||!t.length)return;const e=t.map((t=>{const e=Number(null==t?void 0:t.segStart),n=Number(null==t?void 0:t.segDuration);return!Number.isFinite(e)||!Number.isFinite(n)||n<=0?null:{start:e,duration:n}}));if(e.some((t=>!t)))return;const n=e[0];return e.every((t=>Math.abs(t.start-n.start)<=$b&&Math.abs(t.duration-n.duration)<=$b))?{offset:n.start,duration:n.duration}:void 0}var Ub=new WeakMap,qb=new WeakMap,Vb=new WeakMap,Gb=new WeakMap,Hb=new WeakMap,Kb=new WeakMap,Xb=new WeakMap,Yb=new WeakMap,Qb=new WeakMap,Jb=new WeakMap,Zb=new WeakSet;class tk extends td{constructor(t={},e={}){super(),O(this,Zb),F(this,Ub,void 0),F(this,qb,void 0),F(this,Vb,void 0),F(this,Gb,void 0),F(this,Hb,void 0),F(this,Kb,void 0),F(this,Xb,void 0),F(this,Yb,void 0),F(this,Qb,void 0),F(this,Jb,[]);const{id:n,manifestRef:i,duration:r,width:o,height:s,metadata:a={},children:l=[]}=t;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(e.disabledTracks)?e.disabledTracks.filter((t=>"string"==typeof t)):[],this.enabledRepFilters=Array.isArray(e.enabledRepFilters)?e.enabledRepFilters:void 0,this.forceVideoCodec="string"==typeof e.forceVideoCodec&&e.forceVideoCodec.trim()?e.forceVideoCodec.trim():void 0,C(Xb,this,!0===e.forceImageFallback),C(Ub,this,e.abrSelector),C(qb,this,e.assetsDeliveryService),C(Gb,this,oy(r)?r:void 0),C(Hb,this,oy(o)?o:void 0),C(Kb,this,oy(s)?s:void 0),C(Yb,this,e&&"object"==typeof e.mediaHostRewriteMap?e.mediaHostRewriteMap:void 0),C(Qb,this,oy(e.maxManifestLoadAttempts)?e.maxManifestLoadAttempts:1/0),this.manifestLoadAttempts=0,this.manifestLoadError=void 0,C(Jb,this,kb(l))}setChildren(t){const e=kb(t);return A(Zb,this,yk).call(this,e,{emit:!0})}addChild(t){const e=bb(t),n=M(Jb,this).slice(),i=n.findIndex((t=>(null==t?void 0:t.nodeId)===e.nodeId));if(i>=0){var r;if((null===(r=n[i])||void 0===r?void 0:r.weight)===e.weight)return this.children;n[i]=e}else n.push(e);return A(Zb,this,yk).call(this,n,{emit:!0})}removeChild(t){const e=yb(t);if(!e)return this.children;const n=M(Jb,this).filter((t=>(null==t?void 0:t.nodeId)!==e));return n.length===M(Jb,this).length?this.children:A(Zb,this,yk).call(this,n,{emit:!0})}async load(t={}){const{loadingMode:e="full",signal:n}=t;zb.info(`[load] [${this.id}] Loading node in '${e}' mode`);try{if(n&&n.aborted)throw Oy();"ready"!==this.state&&await this.resolve({signal:n});const t="partial"===e,i=[];this.tracks.forEach((e=>{const n=e.segments||[];if(t){const t=n.find((t=>t.isInit)),r=n.find((t=>!t.isInit));t&&Array.isArray(t.representations)&&!t.isLoaded&&i.push({track:e,segment:t}),r&&Array.isArray(r.representations)&&!r.isLoaded&&i.push({track:e,segment:r})}else n.forEach((t=>{Array.isArray(t.representations)&&!t.isLoaded&&i.push({track:e,segment:t})}))}));const r=i.filter((({segment:t})=>t.isInit)),o=i.filter((({segment:t})=>!t.isInit)),s=o.length?o[0]:void 0,a=r.map((({track:t,segment:e})=>A(Zb,this,pk).call(this,t,e,n))),l=s?A(Zb,this,mk).call(this,s.segment,s.track,n):Promise.resolve();await Promise.all([...a,l]);const c=s?o.slice(1):o;for(const t of c)await A(Zb,this,mk).call(this,t.segment,t.track,n);if(n&&n.aborted)throw Oy();return this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:e}),this}catch(t){if(Py(t,n))throw t;throw this.trigger("node:loaderror",{nodeId:this.id,node:this,error:t,loadingMode:e}),t}}async loadMediaSegmentsAtOffset(t,e={}){const n=Number(t);if(zb.info(`[loadMediaSegmentsAtOffset] [${this.id}] Loading media segments at offset ${n}`),!Number.isFinite(n))return;const{signal:i}=e;if(i&&i.aborted)throw Oy();if("ready"!==this.state&&await this.resolve({signal:i}),"ready"!==this.state)return;const r=[],o=[];if(this.tracks.forEach((t=>{const e=(null==t?void 0:t.segments)||[];if(!Array.isArray(e)||!e.length)return;const s=e.find((t=>(null==t?void 0:t.isInit)&&Array.isArray(null==t?void 0:t.representations)));s&&!s.isLoaded&&r.push(A(Zb,this,pk).call(this,t,s,i)),e.forEach((e=>{if(!e||e.isInit||!Array.isArray(e.representations))return;const i=Number(e.offset);Number.isFinite(i)&&Math.abs(i-n)<=$b&&!e.isLoaded&&o.push({segment:e,track:t})}))})),r.length||o.length){if(await Promise.all(r),o.length&&await Promise.all(o.map((({segment:t,track:e})=>A(Zb,this,mk).call(this,t,e,i)))),i&&i.aborted)throw Oy();this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:"segment-offset",offsetSeconds:n})}}async resolve(t={}){const{signal:e,manifestOverride:n}=t;let i=!0;for(;i;){if(i=!1,"ready"===this.state)return this;if("resolving"===this.state)try{return await M(Vb,this)}catch(t){if(!Py(t)||e&&e.aborted)throw t;i=!0;continue}if(e&&e.aborted)throw Oy();if(this.hasExceededManifestLoadAttempts()){const t=this.manifestLoadError||new Error("Manifest load retry limit reached");throw this.state="failed",this.error=t,t}const t=A(Zb,this,ak).call(this);return this.state="resolving",this.error=void 0,C(Vb,this,(async()=>{try{const t=await A(Zb,this,vk).call(this,{signal:e,manifestOverride:n});if(e&&e.aborted)throw Oy();let i=Eb.parse(t);return i=A(Zb,this,sk).call(this,i),this.tracks=(i.tracks||[]).map((t=>t instanceof gb?t:new gb(t))),this.mainTrackId=i.mainTrackId||this.mainTrackId,this.metadata=i.metadata||this.metadata,A(Zb,this,kk).call(this),A(Zb,this,bk).call(this),await A(Zb,this,gk).call(this),this.state="ready",this}catch(n){if(Py(n,e))throw A(Zb,this,lk).call(this,t),n;throw this.state="failed",this.error=n,n}})()),M(Vb,this)}return M(Vb,this)}evict(){this.tracks.forEach((t=>{(t.segments||[]).forEach((t=>{t.evict()}))}))}get children(){return M(Jb,this).slice()}set children(t){this.setChildren(t)}get duration(){if(!this.mainTrackId)return 0;const t=this.tracks.find((t=>t.id===this.mainTrackId));return t?oy(t.duration)?t.duration:t.endTime:0}get retainedByteLength(){let t=0;return this.tracks.forEach((e=>{(Array.isArray(e.segments)?e.segments:[]).forEach((e=>{t+=oy(e.retainedByteLength)?e.retainedByteLength:0}))})),t}get buffered(){if("ready"!==this.state)return Wb;const t=Array.isArray(this.tracks)?this.tracks.find((t=>(null==t?void 0:t.id)===this.mainTrackId)):void 0,e=this.duration;if(!t||!oy(e))return Wb;const n=Array.isArray(this.tracks)?this.tracks.map((t=>{if(!t||void 0===t.buffered)return;const e=t.buffered;return e&&Number.isFinite(e.start)&&Number.isFinite(e.end)?{track:t,range:e}:void 0})).filter(Boolean):[];if(!n.length)return Wb;if(n.length===this.tracks.length&&n.every((({track:t,range:e})=>{const n=t.endTime,i=oy(t.offset)?t.offset:0;return Number.isFinite(n)&&e.start<=i&&e.end>=n})))return{start:0,end:e};const i=n.reduce(((t,{range:e})=>Math.min(t,e.end)),1/0);if(!Number.isFinite(i))return Wb;const r=Math.min(i,e);return r>0?{start:0,end:r}:Wb}get isLoaded(){return"ready"===this.state&&(Array.isArray(this.tracks)?this.tracks:[]).flatMap((t=>Array.isArray(null==t?void 0:t.segments)?t.segments:[])).every((t=>t.isLoaded))}hasExceededManifestLoadAttempts(){if(!Number.isFinite(M(Qb,this))||M(Qb,this)<=0)return!1;if(!this.manifestLoadError)return!1;const t=Number(this.manifestLoadAttempts);return Number.isFinite(t)&&t>=M(Qb,this)}}function ek(t){return function(t,e){if(!t||"string"!=typeof t)return t;if(!e||"object"!=typeof e)return t;const n=cd&&"function"==typeof cd.URL?cd.URL:"function"==typeof URL?URL:null;if(!n)return t;let i;try{i=new n(t)}catch(e){return t}const r=function(t,e){const n=null==t?void 0:t.hostname,i=null==t?void 0:t.pathname;if("string"!=typeof n||"string"!=typeof i)return t;if(!/^s3(?:[.-][a-z0-9-]+)?\.amazonaws\.com$/i.test(n))return t;const r=i.split("/").filter(Boolean);if(r.length<2)return t;const o=r[0],s=new e(t.toString());return s.hostname=`${o}.${n}`,s.pathname=`/${r.slice(1).join("/")}`,s}(i,n),o=e[r.hostname]?r:i,s=e[o.hostname];if(!s||"string"!=typeof s)return t;let a;try{a=new n(s)}catch(e){return t}return a.protocol&&a.host?(o.protocol=a.protocol,o.host=a.host,o.toString()):t}(t,M(Yb,this))}function nk(){return M(Xb,this)||void 0===cd.VideoDecoder}function ik(){return this.manifestRef&&"object"==typeof this.manifestRef&&"assets-delivery-service"===this.manifestRef.type}function rk(t){if(!A(Zb,this,ik).call(this))return!1;if(!A(Zb,this,nk).call(this))return!1;const e=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[],n=e.find((e=>(null==e?void 0:e.id)===(null==t?void 0:t.mainTrackId)))||e[0];return"image"!==(null==n?void 0:n.type)}function ok(t){const e=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[],n=function(t){const e=Number(null==t?void 0:t.duration);if(Number.isFinite(e)&&e>0)return e;const n=Array.isArray(null==t?void 0:t.segments)?t.segments:[];let i=0;return n.forEach((t=>{if(null!=t&&t.isInit)return;const e=Number(null==t?void 0:t.offset),n=Number(null==t?void 0:t.duration);!Number.isFinite(e)||!Number.isFinite(n)||n<=0||(i=Math.max(i,e+n))})),i>0?i:void 0}(e.find((e=>(null==e?void 0:e.id)===(null==t?void 0:t.mainTrackId)))||e[0]);return oy(n)?n:oy(M(Gb,this))?M(Gb,this):void 0}function sk(t){if(this.imageFallbackActive=!1,!A(Zb,this,rk).call(this,t))return t;if(!M(qb,this)||"function"!=typeof M(qb,this).resolveImageOne)return t;const e=M(qb,this).resolveImageOne(this.manifestRef),n=A(Zb,this,ek).call(this,null==e?void 0:e.url);if(!n)return t;const i={typeHint:"image",url:n,duration:A(Zb,this,ok).call(this,t),width:M(Hb,this),height:M(Kb,this)},r=Eb.parse(i);return t&&"object"==typeof t.metadata&&!Array.isArray(t.metadata)&&(r.metadata=t.metadata),this.imageFallbackActive=!0,r}function ak(){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 lk(t){t&&(this.state=t.state,this.error=t.error,this.tracks=t.tracks,this.mainTrackId=t.mainTrackId,this.metadata=t.metadata,this.imageFallbackActive=t.imageFallbackActive,this.disabledTracks=t.disabledTracks,this.manifestRef=t.manifestRef,this.manifestLoadAttempts=t.manifestLoadAttempts,this.manifestLoadError=t.manifestLoadError)}function ck(){const t=Number(this.manifestLoadAttempts);this.manifestLoadAttempts=Number.isFinite(t)&&t>0?t+1:1,this.manifestLoadError=void 0}function uk(t){this.manifestLoadError=t||new Error("Manifest load failed")}function dk(t){if(!t)return null;const e={loadAttempts:Number(t.loadAttempts),loadError:t.loadError};if("function"==typeof t.markLoadAttempt)return t.markLoadAttempt(),e;const n=Number(t.loadAttempts);return t.loadAttempts=Number.isFinite(n)&&n>0?n+1:1,t.loadError=void 0,e}function hk(t,e){if(!t||!e)return;const n=Number(e.loadAttempts);t.loadAttempts=Number.isFinite(n)&&n>=0?n:0,t.loadError=e.loadError}function fk(t,e){t&&("function"!=typeof t.setLoadError?t.loadError=e||new Error("Segment load failed"):t.setLoadError(e))}async function pk(t,e,n){const i=A(Zb,this,dk).call(this,e);try{const i=e.representations.map((async i=>{const r=A(Zb,this,ek).call(this,i.url),o=await qy(r,{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:!0,loaded:n,total:i,chunk:r})}}),s=o instanceof ArrayBuffer?o:null==o?void 0:o.arrayBuffer;s&&e.setRepresentationBuffer(i.id,s)}));await Promise.all(i)}catch(t){if(Py(t,n))throw A(Zb,this,hk).call(this,e,i),t;throw A(Zb,this,fk).call(this,e,t),t}}async function mk(t,e,n){const i=M(Ub,this),r={representations:t.representations,nodeId:this.id,trackId:null==e?void 0:e.id,segmentId:t.id},o=i&&"function"==typeof i.select?i.select(r):void 0,s=t.representations.find((t=>t.id===o))||t.representations[0];if(!s)return;t&&"function"==typeof t.setABRDecisionSnapshot&&t.setABRDecisionSnapshot(r.abrDecision),t.setChosenRepresentation(s);const a=A(Zb,this,dk).call(this,t);try{const i=A(Zb,this,ek).call(this,s.url),r=await qy(i,{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:!1,loaded:n,total:i,chunk:r})}}),o=r instanceof ArrayBuffer?r:null==r?void 0:r.arrayBuffer;o&&(t.setRepresentationBuffer(s.id,o),t.setChosenRepresentation(s))}catch(e){if(Py(e,n))throw A(Zb,this,hk).call(this,t,a),e;throw A(Zb,this,fk).call(this,t,e),e}}async function vk(t={}){const{signal:e,manifestOverride:n}=t;if(e&&e.aborted)throw Oy();A(Zb,this,ck).call(this);try{let t=this.manifestRef;if(n&&"object"==typeof n){if(A(Zb,this,ik).call(this)&&"string"==typeof n.encodeProfile&&n.encodeProfile&&(this.manifestRef={...this.manifestRef,encodeProfile:n.encodeProfile},t=this.manifestRef),n.ivd)return{typeHint:"ivd",body:n.ivd};if(n.body){const t=A(Zb,this,ek).call(this,n.url);return{typeHint:n.typeHint,url:t,mimeType:n.mimeType,body:n.body,duration:M(Gb,this),width:M(Hb,this),height:M(Kb,this)}}"string"==typeof n.url&&n.url&&(t=n)}if(t&&"object"==typeof t&&"assets-delivery-service"===t.type){if(!M(qb,this)||"function"!=typeof M(qb,this).resolveOne)throw new Error("AssetsDeliveryService is required for assets-delivery-service manifestRef");const n=await M(qb,this).resolveOne(t,{signal:e});if(!n)throw new Error("AssetsDeliveryService returned empty result");if("string"==typeof n.encodeProfile&&n.encodeProfile&&(this.manifestRef={...t,encodeProfile:n.encodeProfile}),n.ivd)return{typeHint:"ivd",body:n.ivd};const i=n.typeHint,r=A(Zb,this,ek).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(Gb,this),width:M(Hb,this),height:M(Kb,this)};throw new Error("AssetsDeliveryService returned unsupported manifest shape")}if(t&&"object"==typeof t){const e=A(Zb,this,ek).call(this,t.url),n=t.mimeType;if(t.body)return{url:e,mimeType:n,body:"string"==typeof t.body?t.body:JSON.stringify(t.body)}}if("string"==typeof t||t&&"string"==typeof t.url){const n="string"==typeof t?t:t.url,i=A(Zb,this,ek).call(this,n),r="object"==typeof t?t.typeHint:void 0,o="object"==typeof t?t.mimeType:void 0;if("image"===Eb.inferType({typeHint:r,url:i,mimeType:o})){const e="object"==typeof t&&oy(t.duration)?t.duration:M(Gb,this);return{typeHint:"image",url:i,mimeType:o,duration:e,width:"object"==typeof t&&oy(t.width)?t.width:M(Hb,this),height:"object"==typeof t&&oy(t.height)?t.height:M(Kb,this)}}const s=await qy(i,{returnType:"default",signal:e});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(t){if(Py(t,e))throw t;throw A(Zb,this,uk).call(this,t),t}}async function gk(){const t=Lb.slice().filter((t=>!this.enabledRepFilters||this.enabledRepFilters.includes(t.name)));if(t.length)for(let e=0;e<this.tracks.length;e+=1){const n=this.tracks[e],i=Array.isArray(n.segments)?n.segments:[],r=[];for(let e=0;e<i.length;e+=1){const o=i[e];if(!Array.isArray(o.representations)){r.push(o);continue}o.appliedFilters=o.appliedFilters||[];let s=o.representations;for(let e=0;e<t.length;e+=1){const{name:i,fn:r,isRelevantForTrack:a}=t[e];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 t=jb(o.representations);t&&(o.offset=t.offset,o.duration=t.duration)}r.push(o)}}r.length!==i.length&&n&&"function"==typeof n.setSegments&&n.setSegments(r)}}function yk(t,{emit:e=!1}={}){return function(t=[],e=[]){if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n<t.length;n+=1){const i=t[n],r=e[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(Jb,this),t)||(C(Jb,this,t),e&&(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 bk(){var t;const e=Array.isArray(this.disabledTrackTypes)?this.disabledTrackTypes:[];if(!e.length||!Array.isArray(this.tracks)||!this.tracks.length)return void(this.disabledTracks=[]);const n=new Set(e),i=[],r=[];this.tracks.forEach((t=>{t&&n.has(t.type)?r.push(t):t&&i.push(t)})),this.tracks=i,this.disabledTracks=r,this.mainTrackId&&!i.some((t=>t.id===this.mainTrackId))&&(this.mainTrackId=null===(t=i[0])||void 0===t?void 0:t.id)}function kk(){if(!Array.isArray(this.tracks)||!this.tracks.length)return;const t=this.duration;if(!oy(t))return;const e=[new fb({name:"nodestart",timestamp:0,data:{id:this.id},isSticky:!0}),new fb({name:"nodeend",timestamp:t,data:{id:this.id}})],n=new gb({id:`${this.id}-auto-cue`,type:"cue",cues:e,offset:0,duration:t});this.tracks.push(n)}var wk=new WeakMap,xk=new WeakMap,_k=new WeakMap,Tk=new WeakMap,Ek=new WeakSet;class Ik extends sd{constructor(...t){super(...t),O(this,Ek),F(this,wk,new Map),F(this,xk,new Map),F(this,_k,void 0),F(this,Tk,void 0);const[e,n]=t;C(_k,this,e),C(Tk,this,n)}get name(){return"NodeRepository"}get defaults(){return{enabledRepFilters:["containers","force-video-codec","media-capabilities"],disabledTracks:Ky("disabledTracks"),forceVideoCodec:Ky("forceVideoCodec"),forceImageFallback:Ky("forceImageFallback"),mediaHostRewriteMap:Ky("mediaHostRewriteMap"),maxManifestLoadAttempts:3}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"get","list"])}onDispose(){M(wk,this).forEach(((t,e)=>{const n=M(xk,this).get(e);n&&t&&"function"==typeof t.off&&t.off(dd.NODE_CHILDREN_CHANGED,n)})),M(xk,this).clear(),M(wk,this).clear()}add(t){const e=t instanceof tk?t:new tk(t,{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(_k,this),assetsDeliveryService:M(Tk,this)});if(!e.id)throw new Error("NodeRepository.add requires node with id");if(M(wk,this).has(e.id))throw new Error(`NodeRepository.add: node with id ${e.id} already exists`);return M(wk,this).set(e.id,e),A(Ek,this,Sk).call(this,e),this.trigger(dd.NODE_ADD,{node:e}),e}get(t){const e=(null==t?void 0:t.id)||t;if(!e)throw new Error("NodeRepository.get requires node or id");return M(wk,this).get(e)}list(){return Array.from(M(wk,this).values())}}function Sk(t){if(!t||"function"!=typeof t.on||!t.id)return;const e=t=>{this.trigger(dd.NODE_CHILDREN_CHANGED,t)};t.on(dd.NODE_CHILDREN_CHANGED,e),M(xk,this).set(t.id,e)}var Ak=new WeakMap,Nk=new WeakMap,Mk=new WeakSet;class Fk extends sd{constructor(...t){super(...t),O(this,Mk),F(this,Ak,void 0),F(this,Nk,new Map);const[e]=t;C(Ak,this,e)}get name(){return"ABRSelector"}get defaults(){return{safetyMargin:.35,minBufferForUpgrade:5,minBufferCritical:1,hysteresisRatio:1.1,abrStrategy:Ky("abrStrategy")}}select(t={}){var e;const{representations:n=[],bufferSeconds:i}=t;if(!Array.isArray(n)||0===n.length)return;const r=M(Ak,this)&&"function"==typeof M(Ak,this).getKbps?M(Ak,this).getKbps():void 0,o=A(Mk,this,Ck).call(this,n[0]),s=M(Nk,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(((t,e)=>A(Mk,this,Ok).call(this,t.bandwidth)-A(Mk,this,Ok).call(this,e.bandwidth)));if("bottom"===a){const e=l[0];return A(Mk,this,Dk).call(this,e,t,{decisionReason:"strategy:bottom",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==e?void 0:e.id}if("top"===a){const e=l[l.length-1];return A(Mk,this,Dk).call(this,e,t,{decisionReason:"strategy:top",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==e?void 0:e.id}if("random"===a){const e=l[Math.floor(Math.random()*l.length)];return A(Mk,this,Dk).call(this,e,t,{decisionReason:"strategy:random",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==e?void 0:e.id}const c=Number.isFinite(i)?i:void 0,u=oy(r)?r*this.settings.safetyMargin:void 0;let d="auto:highest-available";if(s&&void 0!==c&&c<this.settings.minBufferCritical){const e=l[0];return this.log.debug("[select] critical buffer -> lowest",t),A(Mk,this,Dk).call(this,e,t,{decisionReason:"auto:critical-buffer",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:u,bufferSeconds:c}),null==e?void 0:e.id}let h=l[l.length-1];if(void 0!==u){const e=l.filter((t=>A(Mk,this,Ok).call(this,t.bandwidth)<=u));e.length>0?(h=e[e.length-1],d="auto:highest-under-safe-bandwidth",this.log.debug("[select] under safe bandwidth ->",h.id,t)):(this.log.debug("[select] no rep under safe bandwidth, fallback lowest",t),h=l[0],d="auto:no-rep-under-safe-bandwidth")}if(s&&void 0!==c&&c<this.settings.minBufferForUpgrade){const e=n.find((t=>t.id===s));e&&oy(e.bandwidth)&&oy(h.bandwidth)&&h.bandwidth/e.bandwidth>this.settings.hysteresisRatio&&(h=n.filter((t=>t.bandwidth&&t.bandwidth<=e.bandwidth*this.settings.hysteresisRatio)).sort(((t,e)=>t.bandwidth-e.bandwidth)).pop()||e,d="auto:hysteresis-hold",this.log.debug("[select] hysteresis prevents upgrade; hold",h.id,t))}return A(Mk,this,Dk).call(this,h,t,{decisionReason:d,trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:u,bufferSeconds:c}),null===(e=h)||void 0===e?void 0:e.id}onDispose(){M(Nk,this).clear(),C(Ak,this,null)}}function Ck(t){var e,n;return(null===(e=t.mime)||void 0===e||null===(n=e.split)||void 0===n||null===(n=n.call(e,"/"))||void 0===n?void 0:n[0])||"unknown"}function Ok(t){return oy(t)?t/1e3:0}function Pk(t){return oy(t)?t/1e3:void 0}function Rk(t,e,n={}){const i=Array.isArray(null==e?void 0:e.representations)?e.representations.map((t=>({id:null==t?void 0:t.id,bandwidthKbps:A(Mk,this,Pk).call(this,null==t?void 0:t.bandwidth)}))):[];return{timeMs:Date.now(),strategy:this.settings.abrStrategy||"auto",decisionReason:n.decisionReason,nodeId:null==e?void 0:e.nodeId,trackId:null==e?void 0:e.trackId,segmentId:null==e?void 0:e.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==t?void 0:t.id,selectedRepresentationBandwidthKbps:A(Mk,this,Pk).call(this,null==t?void 0:t.bandwidth),safetyMargin:Number(this.settings.safetyMargin),minBufferForUpgrade:Number(this.settings.minBufferForUpgrade),minBufferCritical:Number(this.settings.minBufferCritical),hysteresisRatio:Number(this.settings.hysteresisRatio),availableRepresentations:i}}function Dk(t,e,n={}){if(!t)return;const i=A(Mk,this,Rk).call(this,t,e,n);e&&"object"==typeof e&&(e.abrDecision=i),this.log.info("[select] Chosen representation:",t,"context:",e,"decision:",i),this.trigger("abr:selection",{representation:t,context:e,strategy:this.settings.abrStrategy,decision:i});const r=A(Mk,this,Ck).call(this,t);M(Nk,this).set(r,t.id)}var Lk=new WeakMap,Bk=new WeakSet;class zk extends sd{constructor(...t){super(...t),O(this,Bk),F(this,Lk,void 0);const[e]=t;if(C(Lk,this,e),!M(Lk,this)||"function"!=typeof M(Lk,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(Lk,this,null)}getPrioritizationSnapshot(t){const e=M(Lk,this).list();if(!e.length)return{orderedIds:[],reachableIds:[]};const{levels:n,weights:i}=A(Bk,this,Wk).call(this,e,t);return{orderedIds:A(Bk,this,$k).call(this,e,n,i),reachableIds:Array.from(n.keys())}}sortNodes(t){const{orderedIds:e}=this.getPrioritizationSnapshot(t);return e.length?(this.log.info(`[sortNodes(${t})] Sorted nodes: [${e.join(", ")}]`),e):[]}getReachableNodeIds(t){const{reachableIds:e}=this.getPrioritizationSnapshot(t);return e}}function Wk(t,e){const n=new Map;t.forEach((t=>{t&&t.id&&n.set(t.id,t)}));const i=new Map,r=new Map;if(!e||!n.has(e))return{levels:i,weights:r};const o=[{id:e,level:0,priority:1}];for(i.set(e,0),r.set(e,1);o.length;){const{id:t,level:e,priority:s}=o.shift(),a=n.get(t),l=Array.isArray(null==a?void 0:a.children)?a.children:[];for(let t=0;t<l.length;t+=1){const a=l[t],c=(null==a?void 0:a.nodeId)||(null==a?void 0:a.id);if(!c||!n.has(c)||i.has(c))continue;const u=oy(null==a?void 0:a.weight)?a.weight:1,d=Math.max(u,s);i.set(c,e+1),r.set(c,d),o.push({id:c,level:e+1,priority:d})}}return{levels:i,weights:r}}function $k(t,e,n){const i=e.size>0,{levelMultiplier:r,priorityMultiplier:o}=this.settings,s=t.map((t=>{var s;const a=e.has(t.id)?e.get(t.id):i?Number.MAX_SAFE_INTEGER:0,l=Number.isFinite(a)?a:Number.MAX_SAFE_INTEGER,c=null!==(s=n.get(t.id))&&void 0!==s?s:1,u=(Number.isFinite(l)?r*l:Number.MAX_SAFE_INTEGER)+o*c;return{id:t.id,score:u,level:l,priorityWeight:c}}));return s.sort(((t,e)=>t.score!==e.score?t.score-e.score:t.level!==e.level?t.level-e.level:t.priorityWeight!==e.priorityWeight?t.priorityWeight-e.priorityWeight:t.id.localeCompare(e.id))),s.map((t=>t.id))}function jk(t,e){return function(t,e){const n=Array.isArray(t)?t:[];return n.length?e&&n.includes(e)?e:n[0]:e||void 0}(null==t?void 0:t.availableEncodeProfiles,e)}function Uk(t,e){const n=t&&"object"==typeof t?{...t}:t;return n&&"object"==typeof n?("string"==typeof e&&e?n.encodeProfile=e:delete n.encodeProfile,n):n}function qk(t){return"string"==typeof t&&t.startsWith("cmaf:")}function Vk(t){return"image"===(null==t?void 0:t.assetType)?"image":"ivd"}function Gk(t){if(!t||"object"!=typeof t)return t;if(Object.prototype.hasOwnProperty.call(t,"mpd")){const e="string"==typeof t.mpdUrl&&t.mpdUrl||"string"==typeof t.url&&t.url||void 0;return{typeHint:"dash",body:t.mpd,url:e}}return t.ivd||t.url||t.body||t.mimeType||t.typeHint?t:(e=t)&&"object"==typeof e&&Array.isArray(e.representations)?{ivd:t}:t;var e}var Hk=new WeakMap,Kk=new WeakMap,Xk=new WeakSet;class Yk extends sd{constructor(...t){super(...t),O(this,Xk),F(this,Hk,void 0),F(this,Kk,void 0);const[,e={}]=t;C(Hk,this,"function"==typeof e.fetchFn?e.fetchFn:void 0),C(Kk,this,Cy())}get name(){return"AssetsDeliveryService"}get defaults(){return{assetsDeliveryServiceUrl:"https://assets.eko.com",profile:Ky("encodeProfile"),maxBatchSize:5,imageQueryParams:{startOffset:0,width:1024}}}async resolveOne(t,e={}){var n;const i=await this.resolve([t],e);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(t){if(!A(Xk,this,Jk).call(this,t))return;const e=jk(t,this.settings.profile),n=function(t,e,n){const i=function(t,e,n){const i=(t||"").replace(/\/$/,""),r=null==n?void 0:n.assetId,o=null==n?void 0:n.assetRevision;if(i&&e&&"string"==typeof r&&"number"==typeof o)return`${i}/${e}/${encodeURIComponent(r)}/${o}`}(t,"image",e);if(!i)return;const r=function(t){if(!t||"object"!=typeof t||Array.isArray(t))return"";const e=new URLSearchParams;return Object.keys(t).forEach((n=>{if("string"!=typeof n||!n)return;const i=t[n];null!=i&&("number"!=typeof i||Number.isFinite(i))&&("string"!=typeof i&&"number"!=typeof i&&"boolean"!=typeof i||e.set(n,String(i)))})),e.toString()}(n);return r?`${i}?${r}`:i}(this.settings.assetsDeliveryServiceUrl||"",t,this.settings.imageQueryParams);if(!n)return;const i={typeHint:"image",url:n};return"string"==typeof e&&e&&(i.encodeProfile=e),i}async resolve(t=[],e={}){const n=(Array.isArray(t)?t:[t]).filter((t=>A(Xk,this,Jk).call(this,t)));if(!n.length)return[];const i=A(Xk,this,Qk).call(this,e);if(i&&i.aborted)return[];const r=[],o=this.settings.profile;n.forEach((t=>{if("image"!==Vk(t))return;const e=this.resolveImageOne(t);e&&e.url&&r.push({manifestRef:Uk(t,e.encodeProfile),manifest:{typeHint:"image",url:e.url}})}));const s=n.filter((t=>"image"!==Vk(t))).map((t=>function(t,e){const n=jk(t,e);return{ref:t,profile:n,route:qk(n)?"dash":"ivd"}}(t,o))),a=A(Xk,this,tw).call(this,s);for(const{refs:t,route:e}of a){if(i&&i.aborted)return r;const{url:n}=A(Xk,this,ew).call(this,t,e),o=await A(Xk,this,nw).call(this,n,{method:"GET",signal:i});o&&"object"==typeof o&&t.forEach((({ref:t,profile:e})=>{const n=`${t.assetId}:${t.assetRevision}`,i=o[n]||o[t.assetId]||o[t.assetId||n];i&&r.push({manifestRef:Uk(t,e),manifest:Gk(i)})}))}return r}onDispose(){M(Kk,this)&&M(Kk,this).abort(),C(Kk,this,null),C(Hk,this,null)}}function Qk(t){return t&&t.signal?t.signal:M(Kk,this)?M(Kk,this).signal:void 0}function Jk(t){const e="number"==typeof(null==t?void 0:t.assetRevision)&&Number.isFinite(t.assetRevision)&&t.assetRevision>=0;return t&&"assets-delivery-service"===t.type&&"string"==typeof t.assetId&&e}function Zk(t,e){const n=Number.isFinite(e)&&e>0?e:t.length,i=[];for(let e=0;e<t.length;e+=n)i.push(t.slice(e,e+n));return i}function tw(t){if(!Array.isArray(t)||!t.length)return[];const e=[];t.forEach((t=>{const n=e[e.length-1];n&&n.route===t.route?n.refs.push(t):e.push({route:t.route,refs:[t]})}));const n=[];return e.forEach((t=>{A(Xk,this,Zk).call(this,t.refs,this.settings.maxBatchSize).forEach((e=>{n.push({route:t.route,refs:e})}))})),n}function ew(t,e="ivd"){const n=t.map((({ref:t,profile:e})=>function(t,e){const n=`${t.assetId}:${t.assetRevision}`;return e?`${n}:${e}`:n}(t,e))),i=new URLSearchParams({assets:n.join(","),type:"data"});return{url:`${(this.settings.assetsDeliveryServiceUrl||"").replace(/\/$/,"")}/${"dash"===e?"dash":"ivd"}?${i.toString()}`}}async function nw(t,e){return M(Hk,this)?M(Hk,this).call(this,t,e):await qy(t,{returnType:"json",method:(null==e?void 0:e.method)||"GET",signal:null==e?void 0:e.signal})}function iw({prioritizer:t,repository:e,startNodeId:n,prioritizedIds:i,pendingIds:r,allowedIds:o,filter:s,fallbackToRepository:a=!0}={}){const l=Array.isArray(i)?i:t&&"function"==typeof t.sortNodes?t.sortNodes(n):[],c=a?(f=e)&&"function"==typeof f.list?f.list().map((t=>null==t?void 0:t.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((t=>{if(!t)return!1;if(d&&d.has(t))return!1;if(h&&!h.has(t))return!1;const n=function(t,e){if(t&&"function"==typeof t.get)return t.get(e)}(e,t);return!(!n||"function"==typeof s&&!s(n,t))}))}const rw=(cd.requestAnimationFrame||cd.mozRequestAnimationFrame||cd.webkitRequestAnimationFrame||cd.msRequestAnimationFrame||(t=>cd.setTimeout(t,1e3/60))).bind(cd),ow=(cd.cancelAnimationFrame||cd.mozCancelAnimationFrame||cd.webkitCancelAnimationFrame||cd.msCancelAnimationFrame||(t=>cd.clearTimeout(t))).bind(cd),sw=Zu("ticker","warn");let aw,lw=[],cw=null,uw=Fy();function dw(){uw=Fy();const t=[];let e,n;for(n=lw.length-1;n>=0;--n)e=lw[n],uw>=e.lastTick+e.interval&&t.push(e);for(n=t.length-1;n>=0;--n)if(e=t[n],!e.stopped){e.lastTick=uw;try{e.callback()}catch(t){console&&"function"==typeof console.error?console.error(t):sw.error(t)}}aw=rw(dw)}function hw(){Fy()-uw>=200&&(ow(aw),dw())}function fw(t){let e=-1;for(let n=0;n<lw.length;n+=1)if(lw[n].callback===t){e=n;break}return e}function pw(t,e=0){if(!t||"function"!=typeof t||"number"!=typeof e||e<0)return void sw.error("[start] Invalid arguments given to start method.",arguments);const n=fw(t);return-1!==n?(sw.debug("[start] Callback already exists, overriding interval.",arguments),lw[n].interval=e,t):(lw.push({callback:t,interval:e,lastTick:Fy()}),1===lw.length&&(aw=rw(dw),cw||(cw=cd.setInterval(hw,1e3))),t)}function mw(t){const e=fw(t);-1!==e?(lw[e].stopped=!0,lw.splice(e,1),lw.length||(ow(aw),cd.clearInterval(cw),cw=null)):sw.debug("[stop] Callback not found, doing nothing.",arguments)}function vw(t){return-1!==fw(t)}function gw(t,e,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 t)return void sw.error("[createThrottler] Bad argument given to createThrottler, first argument must be a function.",arguments);sw.debug("[createThrottler] Creating a new throttler instance.",arguments);const s=[];function a(){sw.debug("[onThrottlerTick] Calling callback with "+s.length+" queued items.");const e=s.slice(0);s.length=0,mw(a),t(e)}const l={push:function(t){sw.debug("[push] Queuing argument:",t),0===s.length&&pw(a,e),s.push(t),o+=1,(o<=r||s.length>=i)&&a()},flush:function(){sw.debug("[flush] Flushing queue."),0!==s.length&&a()},dispose:function(){sw.debug("[dispose] Disposing of throttler.");const t=s.slice(0);return s.length=0,mw(a),t}};return Object.defineProperty(l,"interval",{enumerable:!0,get:function(){return e},set:function(t){"number"==typeof t&&(e=t)}}),l}function yw(t,e){if(t&&"function"==typeof t)return t.__tickerThrottler||(t.__tickerThrottler=gw((function(){t()}),e)),"number"==typeof e&&(t.__tickerThrottler.interval=e),t.__tickerThrottler.push(),t.__tickerThrottler;sw.error("[scheduleExecution] Bad argument given to scheduleExecution, first argument must be a function.",arguments)}var bw=new WeakMap,kw=new WeakMap,ww=new WeakMap,xw=new WeakMap,_w=new WeakMap,Tw=new WeakMap,Ew=new WeakMap,Iw=new WeakMap,Sw=new WeakMap,Aw=new WeakMap,Nw=new WeakMap,Mw=new WeakMap,Fw=new WeakMap,Cw=new WeakMap,Ow=new WeakMap,Pw=new WeakMap,Rw=new WeakSet;class Dw extends sd{constructor(...t){super(...t),O(this,Rw),F(this,bw,void 0),F(this,kw,void 0),F(this,ww,void 0),F(this,xw,void 0),F(this,_w,[]),F(this,Tw,[]),F(this,Ew,new Set),F(this,Iw,new Set),F(this,Sw,!1),F(this,Aw,void 0),F(this,Nw,void 0),F(this,Mw,void 0),F(this,Fw,void 0),F(this,Cw,void 0),F(this,Ow,void 0),F(this,Pw,void 0);const[e,n,i,r]=t;C(bw,this,e),C(kw,this,n),C(ww,this,i),C(xw,this,r),C(Aw,this,Cy());const o=t.length?t[t.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(Pw,this,(()=>A(Rw,this,Hw).call(this))),A(Rw,this,Ww).call(this),A(Rw,this,zw).call(this)}get name(){return"NodeResolver"}get defaults(){return{maxConcurrent:5}}onDispose(){var t;M(Aw,this)&&M(Aw,this).abort(),C(Aw,this,null),M(xw,this)&&"function"==typeof M(xw,this).off&&M(Mw,this)&&M(xw,this).off(dd.PLACEMENT_ADDED,M(Mw,this)),M(xw,this)&&"function"==typeof M(xw,this).off&&M(Ow,this)&&M(xw,this).off(dd.TIMELINE_RESET,M(Ow,this)),M(bw,this)&&"function"==typeof M(bw,this).off&&M(Fw,this)&&M(bw,this).off(dd.NODE_ADD,M(Fw,this)),M(bw,this)&&"function"==typeof M(bw,this).off&&M(Cw,this)&&M(bw,this).off(dd.NODE_CHILDREN_CHANGED,M(Cw,this)),C(Mw,this,null),C(Fw,this,null),C(Cw,this,null),C(Ow,this,null),C(_w,this,[]),C(Tw,this,[]),M(Ew,this).clear(),M(Iw,this).clear(),C(Sw,this,!1),C(Nw,this,void 0),null!==(t=M(Pw,this))&&void 0!==t&&t.__tickerThrottler&&M(Pw,this).__tickerThrottler.dispose(),C(Pw,this,null)}}function Lw(){return M(Aw,this)?M(Aw,this).signal:void 0}function Bw(){return this._disposed||M(Aw,this)&&M(Aw,this).signal.aborted}function zw(){M(xw,this)&&"function"==typeof M(xw,this).on&&(C(Mw,this,(t=>{A(Rw,this,jw).call(this,null==t?void 0:t.nodeId)})),M(xw,this).on(dd.PLACEMENT_ADDED,M(Mw,this)),C(Ow,this,(()=>A(Rw,this,$w).call(this))),M(xw,this).on(dd.TIMELINE_RESET,M(Ow,this))),M(bw,this)&&"function"==typeof M(bw,this).on&&(C(Fw,this,(({node:t})=>{(null==t?void 0:t.id)&&A(Rw,this,jw).call(this,t.id,{fromRepoAdd:!0})})),M(bw,this).on(dd.NODE_ADD,M(Fw,this)),C(Cw,this,(()=>{yw(M(Pw,this),100)})),M(bw,this).on(dd.NODE_CHILDREN_CHANGED,M(Cw,this)))}function Ww(){const t=M(xw,this)&&Array.isArray(M(xw,this).placements)?M(xw,this).placements:[];t.forEach((t=>A(Rw,this,jw).call(this,t.nodeId)));const e=t.length?t[t.length-1]:void 0;e&&e.nodeId&&C(Nw,this,e.nodeId)}function $w(){M(Aw,this)&&M(Aw,this).abort(),C(Aw,this,Cy()),C(_w,this,[]),C(Tw,this,[]),M(Ew,this).clear(),C(Sw,this,!1),C(Nw,this,void 0)}function jw(t,{fromRepoAdd:e=!1}={}){A(Rw,this,Bw).call(this)||t&&(M(Iw,this).has(t)||M(Ew,this).has(t)||(M(_w,this).push(t),M(Nw,this)||e||C(Nw,this,t),!M(Sw,this)&&e||A(Rw,this,Uw).call(this)))}function Uw(){if(M(Sw,this))return void A(Rw,this,qw).call(this);if(0===M(_w,this).length)return;C(Sw,this,!0);const t=M(_w,this).shift();A(Rw,this,Kw).call(this,t).finally((()=>{A(Rw,this,qw).call(this)}))}async function qw(){if(!A(Rw,this,Bw).call(this))for(M(_w,this).length||M(Tw,this).length||C(Tw,this,A(Rw,this,Vw).call(this));M(Ew,this).size<this.settings.maxConcurrent;){const t=this.settings.maxConcurrent-M(Ew,this).size;if(t<=0)break;const e=[];for(;e.length<t&&(M(_w,this).length||M(Tw,this).length);){let t=M(_w,this).shift();t||(t=M(Tw,this).shift()),t&&e.push(t)}if(!e.length)break;const n=A(Rw,this,Xw).call(this,e);n.length&&M(ww,this)&&"function"==typeof M(ww,this).resolve&&A(Rw,this,Yw).call(this,n).finally((()=>A(Rw,this,qw).call(this))),e.filter((t=>!n.find((e=>e.nodeId===t)))).forEach((t=>{A(Rw,this,Kw).call(this,t).finally((()=>A(Rw,this,qw).call(this)))}))}}function Vw(){const t=new Set([...M(Iw,this),...M(Ew,this),...M(_w,this)]);return A(Rw,this,Gw).call(this,t)}function Gw(t){const e=M(xw,this)&&Array.isArray(M(xw,this).placements)?M(xw,this).placements:[],n=(e.length?e[e.length-1].nodeId:void 0)||M(Nw,this);return iw({prioritizer:M(kw,this),repository:M(bw,this),startNodeId:n,pendingIds:t,fallbackToRepository:!1})}function Hw(){A(Rw,this,Bw).call(this)||(M(Sw,this)||0!==M(_w,this).length)&&(C(Tw,this,A(Rw,this,Vw).call(this)),M(Sw,this)&&A(Rw,this,qw).call(this))}async function Kw(t,e){if(!t||M(Iw,this).has(t)||M(Ew,this).has(t))return;const n=A(Rw,this,Lw).call(this);if(n&&n.aborted)return;const i=M(bw,this)&&"function"==typeof M(bw,this).get?M(bw,this).get(t):void 0;if(i&&"function"==typeof i.resolve)if("function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts())M(Iw,this).add(t);else{M(Ew,this).add(t);try{const r={signal:n};e&&(r.manifestOverride=e),await i.resolve(r),M(Iw,this).add(t)}catch(e){if(Py(e,n))return;this.log.warn(`NodeResolver failed to resolve node ${t}: ${(null==e?void 0:e.message)||e}`),"function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts()&&M(Iw,this).add(t)}finally{M(Ew,this).delete(t)}}}function Xw(t){const e=[];return t.forEach((t=>{const n=M(bw,this)&&"function"==typeof M(bw,this).get?M(bw,this).get(t):void 0;n&&n.manifestRef&&"assets-delivery-service"===n.manifestRef.type&&e.push({nodeId:t,ref:n.manifestRef})})),e}async function Yw(t){const e=A(Rw,this,Lw).call(this);if(!e||!e.aborted){t.forEach((({nodeId:t})=>M(Ew,this).add(t)));try{const n=t.map((t=>t.ref)),i=await M(ww,this).resolve(n,{signal:e});t.forEach((({nodeId:t,ref:e})=>{var n;const r=M(bw,this)&&"function"==typeof M(bw,this).get?M(bw,this).get(t):void 0;if(M(Ew,this).delete(t),!r||"function"!=typeof r.resolve)return;const o=Array.isArray(i)?i.find((t=>{const n=null==t?void 0:t.manifestRef;return n&&n.assetId===e.assetId&&n.assetRevision===e.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(Rw,this,Qw).call(this,o.manifest,s):void 0;A(Rw,this,Kw).call(this,t,a)}))}catch(n){Py(n,e)||this.log.warn(`NodeResolver ADS batch failed: ${(null==n?void 0:n.message)||n}`),t.forEach((({nodeId:t})=>M(Ew,this).delete(t)))}}}function Qw(t,e){if(!t)return;const n="string"==typeof e&&e?e:void 0,i=t=>n&&t&&"object"==typeof t?{...t,encodeProfile:n}:t;return t.ivd?i({typeHint:"ivd",body:t.ivd}):t.url||t.body||t.mimeType?i({typeHint:t.typeHint,url:t.url,mimeType:t.mimeType,body:t.body}):i(t)}const Jw=.001,Zw="priority";function tx(t){const e=Number(t);return Number.isFinite(e)?e:0}var ex=new WeakMap,nx=new WeakMap,ix=new WeakMap,rx=new WeakMap,ox=new WeakMap,sx=new WeakMap,ax=new WeakMap,lx=new WeakMap,cx=new WeakMap,ux=new WeakMap,dx=new WeakMap,hx=new WeakMap,fx=new WeakMap,px=new WeakMap,mx=new WeakMap,vx=new WeakMap,gx=new WeakMap,yx=new WeakMap,bx=new WeakMap,kx=new WeakMap,wx=new WeakSet;class xx extends sd{constructor(...t){super(...t),O(this,wx),F(this,ex,void 0),F(this,nx,void 0),F(this,ix,void 0),F(this,rx,new Map),F(this,ox,new Map),F(this,sx,[]),F(this,ax,new Set),F(this,lx,new Map),F(this,cx,!1),F(this,ux,void 0),F(this,dx,void 0),F(this,hx,void 0),F(this,fx,void 0),F(this,px,void 0),F(this,mx,void 0),F(this,vx,void 0),F(this,gx,void 0),F(this,yx,!1),F(this,bx,[]),F(this,kx,void 0);const[e,n,i]=t;C(ex,this,e),C(nx,this,n),C(ix,this,i),C(dx,this,Cy()),C(kx,this,(()=>A(wx,this,r_).call(this))),A(wx,this,Lx).call(this)}get name(){return"SegmentLoadCoordinator"}get defaults(){return{maxConcurrentLoads:3,maxSegmentLoadAttempts:3}}onDispose(){var t;M(dx,this)&&M(dx,this).abort(),C(dx,this,null),M(lx,this).size&&M(lx,this).forEach((t=>{(null==t?void 0:t.controller)&&t.controller.abort()})),M(lx,this).clear(),M(ix,this)&&"function"==typeof M(ix,this).off&&(M(hx,this)&&M(ix,this).off(dd.PLACEMENT_ADDED,M(hx,this)),M(px,this)&&M(ix,this).off(dd.TIMELINE_SEEKING,M(px,this)),M(mx,this)&&M(ix,this).off(dd.TIMELINE_SEEKED,M(mx,this)),M(vx,this)&&M(ix,this).off(dd.TIMELINE_RESET,M(vx,this))),M(ex,this)&&"function"==typeof M(ex,this).off&&M(fx,this)&&M(ex,this).off(dd.NODE_CHILDREN_CHANGED,M(fx,this)),M(gx,this)&&"function"==typeof cd.removeEventListener&&cd.removeEventListener("online",M(gx,this)),C(hx,this,null),C(fx,this,null),C(px,this,null),C(mx,this,null),C(vx,this,null),C(gx,this,null),M(rx,this).clear(),M(ox,this).clear(),C(sx,this,[]),M(ax,this).clear(),M(lx,this).clear(),C(cx,this,!1),C(ux,this,void 0),C(yx,this,!1),C(bx,this,[]),null!==(t=M(kx,this))&&void 0!==t&&t.__tickerThrottler&&M(kx,this).__tickerThrottler.dispose(),C(kx,this,null)}}function _x(){return M(dx,this)?M(dx,this).signal:void 0}function Tx(){return this._disposed||M(dx,this)&&M(dx,this).signal.aborted}function Ex(){const t=Number(this.settings.maxSegmentLoadAttempts);return Number.isFinite(t)&&t>0?t:1/0}function Ix(t){const e=A(wx,this,Ex).call(this);if(!Number.isFinite(e)||e===1/0)return!1;if(null==t||!t.loadError)return!1;const n=Number(t.loadAttempts);return Number.isFinite(n)&&n>=e}function Sx(t){return!!t&&(!!A(wx,this,Ix).call(this,t)||A(wx,this,Ax).call(this,t))}function Ax(t){if(!t)return!1;if("boolean"==typeof t.isLoaded)return t.isLoaded;const e=Number(t.retainedByteLength);return Number.isFinite(e)&&e>0}function Nx(t){if(!t||A(wx,this,Ax).call(this,t))return;const e=Number(t.loadAttempts);(Number.isFinite(e)&&e>0||t.loadError)&&("function"==typeof t.evict&&t.evict(),t.loadAttempts=0,t.loadError=void 0)}function Mx(t){t&&(t.manifestLoadError&&(t.manifestLoadAttempts=0,t.manifestLoadError=void 0,"failed"===t.state&&(t.state="pending",t.error=void 0)),(Array.isArray(t.tracks)?t.tracks:[]).forEach((t=>{(Array.isArray(null==t?void 0:t.segments)?t.segments:[]).forEach((t=>{A(wx,this,Nx).call(this,t)}))})))}function Fx(){(M(ex,this)&&"function"==typeof M(ex,this).list?M(ex,this).list():[]).forEach((t=>{A(wx,this,Mx).call(this,t)}))}function Cx(t,{allowSeekKeep:e=!1,segmentOffset:n}={}){const i=Cy(),r=i?i.signal:A(wx,this,_x).call(this);return t&&M(lx,this).set(t,{controller:i,allowSeekKeep:!!e,segmentOffset:n}),{signal:r,controller:i}}function Ox(t,e,n={}){const i=M(lx,this).get(t);i&&i.controller===e&&(Object.prototype.hasOwnProperty.call(n,"allowSeekKeep")&&(i.allowSeekKeep=!!n.allowSeekKeep),Object.prototype.hasOwnProperty.call(n,"segmentOffset")&&(i.segmentOffset=n.segmentOffset))}function Px(t,e){const n=M(lx,this).get(t);n&&(e&&n.controller!==e||M(lx,this).delete(t))}function Rx(t,e){const n=new Set;return(Array.isArray(t)?t:[]).forEach((t=>{const i=null==t?void 0:t.nodeId;if(!i)return;const r=M(ex,this)&&"function"==typeof M(ex,this).get?M(ex,this).get(i):void 0;if(!r)return;const o=A(wx,this,Kx).call(this,r,t,e);Number.isFinite(o)&&n.add(`${i}:${o}`)})),n}function Dx(t){M(lx,this).size&&M(lx,this).forEach(((e,n)=>{const i=null==e?void 0:e.segmentOffset,r=Number.isFinite(i)?`${n}:${i}`:"";!(null!=e&&e.allowSeekKeep&&r&&t&&t.has(r))&&(null==e?void 0:e.controller)&&e.controller.abort()}))}function Lx(){M(ix,this)&&"function"==typeof M(ix,this).on&&(C(hx,this,(t=>{A(wx,this,Ux).call(this,t)})),M(ix,this).on(dd.PLACEMENT_ADDED,M(hx,this)),C(px,this,(t=>A(wx,this,Bx).call(this,t))),M(ix,this).on(dd.TIMELINE_SEEKING,M(px,this)),C(mx,this,(t=>A(wx,this,zx).call(this,t))),M(ix,this).on(dd.TIMELINE_SEEKED,M(mx,this)),C(vx,this,(()=>A(wx,this,jx).call(this))),M(ix,this).on(dd.TIMELINE_RESET,M(vx,this))),M(ex,this)&&"function"==typeof M(ex,this).on&&(C(fx,this,(()=>{yw(M(kx,this),100)})),M(ex,this).on(dd.NODE_CHILDREN_CHANGED,M(fx,this))),"function"==typeof cd.addEventListener&&(C(gx,this,(()=>A(wx,this,$x).call(this))),cd.addEventListener("online",M(gx,this)))}function Bx(t={}){if(A(wx,this,Tx).call(this))return;const e=Number(null==t?void 0:t.targetTime);if(!Number.isFinite(e))return;const n=Array.isArray(null==t?void 0:t.placements)?t.placements:[],i=A(wx,this,Rx).call(this,n,e);A(wx,this,Dx).call(this,i),C(yx,this,!0),C(bx,this,n.map((t=>{const n=null==t?void 0:t.nodeId;if(n)return{nodeId:n,placement:t,targetTime:e}})).filter(Boolean)),setTimeout((()=>A(wx,this,Vx).call(this)),0)}function zx(t={}){var e;if(A(wx,this,Tx).call(this))return;C(yx,this,!1),C(bx,this,[]);const n=Number.isFinite(null==t?void 0:t.targetTime)?Number(t.targetTime):Number(null===(e=M(ix,this))||void 0===e?void 0:e.currentTime);A(wx,this,Wx).call(this,n),setTimeout((()=>A(wx,this,Vx).call(this)),0)}function Wx(t){var e;(Array.isArray(null===(e=M(ix,this))||void 0===e?void 0:e.placements)?M(ix,this).placements:[]).forEach((e=>{if(!e)return;const n=gm(e);if(Number.isFinite(n)){if(Number.isFinite(t)){if(n>=t)return void A(wx,this,Ux).call(this,e);const i=mm(e,M(ex,this));return Number.isFinite(i)?void(n+i>t&&A(wx,this,Ux).call(this,e)):void(n<=t&&A(wx,this,Ux).call(this,e))}A(wx,this,Ux).call(this,e)}}))}function $x(){var t;A(wx,this,Tx).call(this)||(A(wx,this,Fx).call(this),C(yx,this,!1),C(bx,this,[]),A(wx,this,Wx).call(this,Number(null===(t=M(ix,this))||void 0===t?void 0:t.currentTime)),C(sx,this,A(wx,this,n_).call(this)),setTimeout((()=>A(wx,this,Vx).call(this)),0))}function jx(){M(dx,this)&&M(dx,this).abort(),C(dx,this,Cy()),M(lx,this).size&&M(lx,this).forEach((t=>{(null==t?void 0:t.controller)&&t.controller.abort()})),M(lx,this).clear(),M(rx,this).clear(),M(ox,this).clear(),C(sx,this,[]),M(ax,this).clear(),C(cx,this,!1),C(ux,this,void 0),C(yx,this,!1),C(bx,this,[])}function Ux(t){if(A(wx,this,Tx).call(this))return;const e=null==t?void 0:t.nodeId;if(!e)return;const n=M(rx,this).get(e);if(n){const i=gm(n),r=gm(t);Number.isFinite(i)?Number.isFinite(r)&&r<i&&M(rx,this).set(e,t):Number.isFinite(r)&&M(rx,this).set(e,t)}else M(rx,this).set(e,t);const i=M(ux,this);C(ux,this,e),i&&i!==e&&C(sx,this,[]),M(cx,this)?setTimeout((()=>A(wx,this,Vx).call(this)),0):A(wx,this,qx).call(this)}function qx(){M(cx,this)||M(rx,this).size&&(C(cx,this,!0),A(wx,this,Vx).call(this))}async function Vx(){if(A(wx,this,Tx).call(this))return;if(M(ax,this).size>=this.settings.maxConcurrentLoads)return;if(M(yx,this))return void(M(bx,this).length&&A(wx,this,Gx).call(this));const t=A(wx,this,Qx).call(this);if(t.hasPending)A(wx,this,Jx).call(this,t);else for(M(sx,this).length||C(sx,this,A(wx,this,n_).call(this));M(ax,this).size<this.settings.maxConcurrentLoads&&M(sx,this).length;){const t=M(sx,this).shift();A(wx,this,o_).call(this,t,"partial").finally((()=>{setTimeout((()=>A(wx,this,Vx).call(this)),0)}))}}function Gx(){if(A(wx,this,Tx).call(this))return;const t=Math.max(0,this.settings.maxConcurrentLoads-M(ax,this).size);if(!t||!M(bx,this).length)return;const e=[],n=[];for(let i=0;i<M(bx,this).length;i+=1){const r=M(bx,this)[i];(null==r?void 0:r.nodeId)&&(e.length<t&&!M(ax,this).has(r.nodeId)?e.push(r):n.push(r))}C(bx,this,n),e.forEach((t=>{A(wx,this,Hx).call(this,t).finally((()=>{setTimeout((()=>A(wx,this,Vx).call(this)),0)}))}))}async function Hx(t={}){const e=null==t?void 0:t.nodeId,n=null==t?void 0:t.placement,i=Number(null==t?void 0:t.targetTime);if(!e||!n||!Number.isFinite(i))return;if(M(ax,this).has(e))return;const{signal:r,controller:o}=A(wx,this,Cx).call(this,e);if(r&&r.aborted)A(wx,this,Px).call(this,e,o);else{M(ax,this).add(e);try{const t=M(ex,this)&&"function"==typeof M(ex,this).get?M(ex,this).get(e):void 0;if(!t)return;if("ready"!==t.state&&"function"==typeof t.resolve)try{await t.resolve({signal:r})}catch(t){return}if("ready"!==t.state)return;const s=A(wx,this,Kx).call(this,t,n,i);if(!Number.isFinite(s)){const n=Array.isArray(null==t?void 0:t.tracks)?t.tracks.map((t=>null==t?void 0:t.type)).filter(Boolean):[];return void this.log.debug(`[#loadSeekWork] No seek segment offset for node [${e}] targetTime=${i} mainTrackId=${(null==t?void 0:t.mainTrackId)||"n/a"} trackTypes=[${n.join(",")}]`)}"function"==typeof t.loadMediaSegmentsAtOffset?(this.log.debug(`[#loadSeekWork] Loading seek segment for node [${e}] at offset=${s}`),A(wx,this,Ox).call(this,e,o,{allowSeekKeep:!0,segmentOffset:s}),await t.loadMediaSegmentsAtOffset(s,{signal:r})):"function"==typeof t.load&&await t.load({loadingMode:"partial",signal:r})}catch(t){Py(t,r)||this.log.warn(`[#loadSeekWork] SegmentLoadCoordinator failed to seek-load node ${e}: ${(null==t?void 0:t.message)||t}`)}finally{M(ax,this).delete(e),A(wx,this,Px).call(this,e,o)}}}function Kx(t,e,n){var i;const r=gm(e);if(!Number.isFinite(r))return;const o=tx(null==e?void 0:e.nodeOffsetOverride),s=Math.max(0,n-r+o),a=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[];let l;if(null!=t&&t.mainTrackId){const e=a.find((e=>(null==e?void 0:e.id)===t.mainTrackId));"video"!==(null==e?void 0:e.type)&&"image"!==(null==e?void 0:e.type)||(l=e)}if(l||(l=a.find((t=>"video"===(null==t?void 0:t.type)))||a.find((t=>"image"===(null==t?void 0:t.type)))),!l||!Array.isArray(l.segments))return;const c=l.segments.filter((t=>t&&!t.isInit&&Array.isArray(t.representations)));if(!c.length)return;const u=tx(null===(i=l)||void 0===i?void 0:i.offset),d=mb(c,Math.max(0,s-u),{preferRepresentationTime:!0}),h=Number(null==d?void 0:d.offset);return Number.isFinite(h)?h:void 0}function Xx(t,e,n=(t=>null===(t=M(ix,this))||void 0===t?void 0:t.currentTime)()){var i;const r=(Array.isArray(null===(i=M(ix,this))||void 0===i?void 0:i.placements)?M(ix,this).placements:[]).filter((e=>(null==e?void 0:e.nodeId)===t&&Number.isFinite(gm(e)))).sort(((t,e)=>gm(t)-gm(e)));if(!r.length)return e;const o=Number(n);if(!Number.isFinite(o))return e||r[0];let s,a;for(let t=0;t<r.length;t+=1){const e=r[t],n=gm(e);if(!Number.isFinite(n))continue;const i=mm(e,M(ex,this)),l=Number.isFinite(i)&&i>=0;(!a&&n>=o-Jw&&(a=e),l)?o+Jw>=n&&o<n+i-Jw&&(s=e):o+Jw>=n&&(s=e)}return s||a||r[r.length-1]}function Yx(t,e){var n;const i=Number(gm(e));if(!Number.isFinite(i))return;const r=mm(e,M(ex,this)),o=Number.isFinite(r)&&r>=0?i+r:void 0,s=(Array.isArray(null===(n=M(ix,this))||void 0===n?void 0:n.placements)?M(ix,this).placements:[]).filter((e=>(null==e?void 0:e.nodeId)===t&&Number.isFinite(gm(e)))).sort(((t,e)=>gm(t)-gm(e)));for(let t=0;t<s.length;t+=1){const e=s[t],n=Number(gm(e));if(Number.isFinite(n)&&!(n<=i+Jw)){if(Number.isFinite(o)&&n>o+Jw)return;return e}}}function Qx(){const t=[];let e=!1,n=1/0;if(M(rx,this).forEach(((i,r)=>{if(!r||!i)return;const o=M(ox,this).get(r);if(o)return e=!0,void(n=Math.min(n,tx(o.timelineStart)));const s=A(wx,this,Zx).call(this,r,i);s&&(e=!0,n=Math.min(n,tx(s.timelineStart)),t.push(s))})),!e||!Number.isFinite(n))return{hasPending:!1,waveTime:void 0,startable:[]};const i=t.filter((t=>tx(t.timelineStart)===n&&!M(ax,this).has(t.nodeId))).sort(((t,e)=>{const n=Number.isFinite(null==t?void 0:t.timelineStart)?t.timelineStart:Number.POSITIVE_INFINITY,i=Number.isFinite(null==e?void 0:e.timelineStart)?e.timelineStart:Number.POSITIVE_INFINITY;return n!==i?n-i:String(t.nodeId).localeCompare(String(e.nodeId))}));return{hasPending:!0,waveTime:n,startable:i}}function Jx({waveTime:t,startable:e}){const n=Math.max(0,this.settings.maxConcurrentLoads-M(ax,this).size);n&&e.length&&e.slice(0,n).forEach((e=>{A(wx,this,e_).call(this,e,t).finally((()=>{setTimeout((()=>A(wx,this,Vx).call(this)),0)}))}))}function Zx(t,e){var n,i;const r=M(ex,this)&&"function"==typeof M(ex,this).get?M(ex,this).get(t):void 0;if(!r)return;if("function"==typeof r.hasExceededManifestLoadAttempts&&r.hasExceededManifestLoadAttempts())return void M(rx,this).delete(t);const o=A(wx,this,Xx).call(this,t,e,null===(n=M(ix,this))||void 0===n?void 0:n.currentTime),s=Number(gm(o)),a=tx(null===(i=M(ix,this))||void 0===i?void 0:i.currentTime),l="function"==typeof r.loadMediaSegmentsAtOffset,c="function"==typeof r.load;if(!l&&!c)return void M(rx,this).delete(t);if(r.isLoaded)return void M(rx,this).delete(t);if("ready"!==r.state){if(!Number.isFinite(s))return;return{nodeId:t,segmentOffset:0,timelineStart:s}}if(!A(wx,this,s_).call(this,r))return void M(rx,this).delete(t);const u=Array.isArray(r.tracks)?r.tracks:[],d=u.some((t=>{const e=(Array.isArray(null==t?void 0:t.segments)?t.segments:[]).find((t=>(null==t?void 0:t.isInit)&&Array.isArray(null==t?void 0:t.representations)));return!!e&&!A(wx,this,Sx).call(this,e)})),h=new Set;u.forEach((t=>{(Array.isArray(null==t?void 0:t.segments)?t.segments:[]).forEach((t=>{if(!t||t.isInit||!Array.isArray(t.representations))return;const e=Number(t.offset);if(Number.isFinite(e)){const t=Math.round(e/Jw)*Jw;h.add(t)}}))}));const f=Array.from(h).sort(((t,e)=>t-e)),p=e=>{const n=Number(gm(e));if(!Number.isFinite(n))return{status:"none"};const i=tx(null==e?void 0:e.nodeOffsetOverride),o=Math.max(0,a-n+i);let s=0;for(let t=0;t<f.length&&f[t]<=o+Jw;t+=1)s=t;const l=f.slice(s);if(!l.some((t=>A(wx,this,t_).call(this,r,t))))return{status:f.slice(0,s).some((t=>A(wx,this,t_).call(this,r,t)))?"beforeOnly":"none"};const c=l.find((t=>A(wx,this,t_).call(this,r,t))),u=Math.max(0,tx(c)-i);return{status:"work",work:{nodeId:t,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:t,segmentOffset:0,timelineStart:s};M(rx,this).delete(t)}else{const e=A(wx,this,Yx).call(this,t,o);if(e){const t=p(e);if("work"===t.status)return t.work}}}function t_(t,e){const n=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[],i=tx(e);return n.some((t=>(Array.isArray(null==t?void 0:t.segments)?t.segments:[]).some((t=>{if(!t||t.isInit||!Array.isArray(t.representations))return!1;const e=Number(t.offset);return Number.isFinite(e)&&Math.abs(e-i)<=Jw&&!A(wx,this,Sx).call(this,t)}))))}async function e_(t,e){const n=null==t?void 0:t.nodeId,i=null==t?void 0:t.segmentOffset;if(this.log.debug(`[#loadP0Work] Loading ${Zw} node [${n}] at segmentOffset=${i} wave=${e}`),!n)return;const r=M(ex,this)&&"function"==typeof M(ex,this).get?M(ex,this).get(n):void 0;if(!r)return void M(rx,this).delete(n);const o="function"==typeof r.loadMediaSegmentsAtOffset&&Number.isFinite(i),{signal:s,controller:a}=A(wx,this,Cx).call(this,n,{allowSeekKeep:o,segmentOffset:i});if(s&&s.aborted)A(wx,this,Px).call(this,n,a);else{M(ax,this).add(n),M(ox,this).set(n,{timelineStart:e,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(t){if(Py(t,s))return;const e=`[#loadP0Work] SegmentLoadCoordinator failed to load ${Zw} work for node ${n}: ${(null==t?void 0:t.message)||t}`;this.log.warn(e)}finally{this.log.debug(`[#loadP0Work] Finished ${Zw} work for node [${n}]`),M(ox,this).delete(n),M(ax,this).delete(n),A(wx,this,Px).call(this,n,a)}}}function n_(){const t=new Set([...M(rx,this).keys(),...M(ax,this)]),e=A(wx,this,i_).call(this),n=Array.isArray(null==e?void 0:e.orderedIds)?e.orderedIds:null,i=Array.isArray(null==e?void 0:e.reachableIds)&&e.reachableIds.length?new Set(e.reachableIds):null,r=t=>!("function"==typeof t.hasExceededManifestLoadAttempts&&t.hasExceededManifestLoadAttempts()||t.isLoaded||"ready"===t.state&&A(wx,this,a_).call(this,t));if(i){const e=iw({prioritizer:M(nx,this),repository:M(ex,this),startNodeId:M(ux,this),prioritizedIds:n,pendingIds:t,allowedIds:i,filter:r});if(e.length)return e}return iw({prioritizer:M(nx,this),repository:M(ex,this),startNodeId:M(ux,this),prioritizedIds:n,pendingIds:t,filter:r})}function i_(){return M(nx,this)&&M(ux,this)?"function"==typeof M(nx,this).getPrioritizationSnapshot?M(nx,this).getPrioritizationSnapshot(M(ux,this)):{orderedIds:"function"==typeof M(nx,this).sortNodes?M(nx,this).sortNodes(M(ux,this)):[],reachableIds:"function"==typeof M(nx,this).getReachableNodeIds?M(nx,this).getReachableNodeIds(M(ux,this)):[]}:null}function r_(){A(wx,this,Tx).call(this)||(M(cx,this)||M(rx,this).size)&&(C(sx,this,A(wx,this,n_).call(this)),M(cx,this)&&!M(yx,this)&&A(wx,this,Vx).call(this))}async function o_(t,e){if(this.log.debug(`[#loadNode] Loading node [${t}] in '${e}' mode`),!t)return;const n=M(ex,this)&&"function"==typeof M(ex,this).get?M(ex,this).get(t):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 ${t}: already loaded`);const{signal:i,controller:r}=A(wx,this,Cx).call(this,t,{allowSeekKeep:!1});if(i&&i.aborted)A(wx,this,Px).call(this,t,r);else try{if("ready"!==n.state&&await n.resolve({signal:i}),"ready"!==n.state)return void this.log.debug(`[#loadNode] Skipping load for ${t}: not ready`);if("partial"===e&&A(wx,this,a_).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${t}: partial already loaded`);if(!A(wx,this,s_).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${t}: no loadable tracks`);M(ax,this).add(t),await n.load({loadingMode:e,signal:i})}catch(e){if(Py(e,i))return;this.log.warn(`[#loadNode] SegmentLoadCoordinator failed to load node ${t}: ${(null==e?void 0:e.message)||e}`)}finally{this.log.debug(`[#loadNode] Finished loading node [${t}]`),M(ax,this).delete(t),A(wx,this,Px).call(this,t,r)}}function s_(t){return(Array.isArray(t.tracks)?t.tracks:[]).some((t=>{var e;return null==t||null===(e=t.segments)||void 0===e?void 0:e.length}))}function a_(t){const e=(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).filter((t=>Array.isArray(null==t?void 0:t.segments)&&t.segments.length));return!e.length||e.every((t=>{const e=Array.isArray(null==t?void 0:t.segments)?t.segments:[];if(!e.length)return!0;const n=e.find((t=>null==t?void 0:t.isInit)),i=e.find((t=>t&&!t.isInit));return!(n&&!A(wx,this,Sx).call(this,n)||i&&!A(wx,this,Sx).call(this,i))}))}class l_ extends sd{constructor(...t){super(...t),this.track=void 0,this.lastSegment=void 0}get name(){return"BaseDecoder"}configure(t){this.track=t}decode(t){this.lastSegment=t}decodeChunk(t,e){}onDispose(){this.track=void 0,this.lastSegment=void 0}}function c_(t){if(!t)throw new Error("Assertion failed.")}const u_=t=>t&&t[t.length-1],d_=t=>{let e=0;for(;0===t.readBits(1)&&e<32;)e++;if(e>=32)throw new Error("Invalid exponential-Golomb code.");return(1<<e)-1+t.readBits(e)},h_=t=>t.constructor===Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t),f_=t=>t.constructor===DataView?t:ArrayBuffer.isView(t)?new DataView(t.buffer,t.byteOffset,t.byteLength):new DataView(t),p_=new TextDecoder,m_=t=>Object.fromEntries(Object.entries(t).map((([t,e])=>[e,t]))),v_={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},g_=m_(v_),y_={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},b_=m_(y_),k_={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},w_=m_(k_),x_=t=>[...t].map((t=>t.toString(16).padStart(2,"0"))).join(""),__=t=>(t=(t=(t=(t=(t=t>>1&1431655765|(1431655765&t)<<1)>>2&858993459|(858993459&t)<<2)>>4&252645135|(252645135&t)<<4)>>8&16711935|(16711935&t)<<8)>>16&65535|(65535&t)<<16)>>>0,T_=(t,e,n)=>{let i=0,r=t.length-1,o=-1;for(;i<=r;){const s=i+r>>1,a=n(t[s]);a===e?(o=s,r=s-1):a<e?i=s+1:r=s-1}return o},E_=(t,e,n)=>{let i=0,r=t.length-1,o=-1;for(;i<=r;){const s=i+(r-i+1)/2|0;n(t[s])<=e?(o=s,i=s+1):r=s-1}return o},I_=()=>{let t,e;return{promise:new Promise(((n,i)=>{t=n,e=i})),resolve:t,reject:e}},S_=(t,e,n)=>t.getUint8(e)<<16|t.getUint8(e+1)<<8|t.getUint8(e+2),A_=(t,e,n)=>Math.max(e,Math.min(n,t)),N_=/^[a-z]{3}$/,M_=1e6*(1+Number.EPSILON);let F_=null;let C_=null;const O_=()=>{if(null!==C_)return C_;if("undefined"==typeof navigator)return null;const t=/\bChrome\/(\d+)/.exec(navigator.userAgent);return t?C_=Number(t[1]):null},P_=t=>"number"==typeof t&&!Number.isNaN(t);class R_{constructor(t,e){if(this.data=t,this.mimeType=e,!(t instanceof Uint8Array))throw new TypeError("data must be a Uint8Array.");if("string"!=typeof e)throw new TypeError("mimeType must be a string.")}}const D_={default:!0,forced:!1,original:!1,commentary:!1,hearingImpaired:!1,visuallyImpaired:!1};class L_{constructor(t){this.bytes=t,this.pos=0}seekToByte(t){this.pos=8*t}readBit(){var t;const e=Math.floor(this.pos/8),n=null!==(t=this.bytes[e])&&void 0!==t?t:0,i=7-(7&this.pos),r=(n&1<<i)>>i;return this.pos++,r}readBits(t){if(1===t)return this.readBit();let e=0;for(let n=0;n<t;n++)e<<=1,e|=this.readBit();return e}writeBits(t,e){const n=this.pos+t;for(let t=this.pos;t<n;t++){const i=Math.floor(t/8);let r=this.bytes[i];const o=7-(7&t);r&=~(1<<o),r|=(e&1<<n-t-1)>>n-t-1<<o,this.bytes[i]=r}this.pos=n}readAlignedByte(){var t;if(this.pos%8!=0)throw new Error("Bitstream is not byte-aligned.");const e=this.pos/8,n=null!==(t=this.bytes[e])&&void 0!==t?t:0;return this.pos+=8,n}skipBits(t){this.pos+=t}getBitsLeft(){return 8*this.bytes.length-this.pos}clone(){const t=new L_(this.bytes);return t.pos=this.pos,t}}const B_=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],z_=[-1,1,2,3,4,5,6,8],W_=t=>{if(!t||t.byteLength<2)throw new TypeError("AAC description must be at least 2 bytes long.");const e=new L_(t);let n=e.readBits(5);31===n&&(n=32+e.readBits(6));const i=e.readBits(4);let r=null;15===i?r=e.readBits(24):i<B_.length&&(r=B_[i]);const o=e.readBits(4);let s=null;return o>=1&&o<=7&&(s=z_[o]),{objectType:n,frequencyIndex:i,sampleRate:r,channelConfiguration:o,numberOfChannels:s}},$_=["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"],j_=[{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}],U_=t=>{const{codec:e,codecDescription:n,colorSpace:i,avcCodecInfo:r,hevcCodecInfo:o,vp9CodecInfo:s,av1CodecInfo:a}=t;if("avc"===e){if(c_(null!==t.avcType),r){const e=new Uint8Array([r.avcProfileIndication,r.profileCompatibility,r.avcLevelIndication]);return`avc${t.avcType}.${x_(e)}`}if(!n||n.byteLength<4)throw new TypeError("AVC decoder description is not provided or is not at least 4 bytes long.");return`avc${t.avcType}.${x_(n.subarray(1,4))}`}if("hevc"===e){let t,e,i,r,s,a;if(o)t=o.generalProfileSpace,e=o.generalProfileIdc,i=__(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=f_(n),l=o.getUint8(1);t=l>>6&3,e=31&l,i=__(o.getUint32(2)),r=l>>5&1,s=o.getUint8(12),a=[];for(let t=0;t<6;t++)a.push(o.getUint8(6+t))}let l="hev1.";for(l+=["","A","B","C"][t]+e,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((t=>t.toString(16).toUpperCase())).join(".")),l}if("vp8"===e)return"vp8";if("vp9"===e){if(!s){const e=t.width*t.height;let n=u_(j_).level;for(const t of j_)if(e<=t.maxPictureSize){n=t.level;break}return`vp09.00.${n.toString().padStart(2,"0")}.08`}let e=`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 e+=`.${s.colourPrimaries.toString().padStart(2,"0")}.${s.transferCharacteristics.toString().padStart(2,"0")}.${s.matrixCoefficients.toString().padStart(2,"0")}.${s.videoFullRangeFlag.toString().padStart(2,"0")}`,e.endsWith(".01.01.01.01.00")&&(e=e.slice(0,-15)),e}if("av1"===e){if(!a){const e=t.width*t.height;let n=u_(j_).level;for(const t of j_)if(e<=t.maxPictureSize){n=t.level;break}return`av01.0.${n.toString().padStart(2,"0")}M.08`}const e=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?v_[i.primaries]:1,u=null!=i&&i.transfer?y_[i.transfer]:1,d=null!=i&&i.matrix?k_[i.matrix]:1,h=null!=i&&i.fullRange?1:0;let f=`av01.${e}.${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 '${e}'.`)},q_=t=>{const{codec:e,codecDescription:n,aacCodecInfo:i}=t;if("aac"===e){if(!i)throw new TypeError("AAC codec info must be provided.");if(i.isMpeg2)return"mp4a.67";{let t;return t=null!==i.objectType?i.objectType:W_(n).objectType,`mp4a.40.${t}`}}if("mp3"===e)return"mp3";if("opus"===e)return"opus";if("vorbis"===e)return"vorbis";if("flac"===e)return"flac";if("ac3"===e)return"ac-3";if("eac3"===e)return"ec-3";if(e&&$_.includes(e))return e;throw new TypeError(`Unhandled codec '${e}'.`)},V_=/^pcm-([usf])(\d+)+(be)?$/,G_=[48e3,44100,32e3],H_=[24e3,22050,16e3];var K_,X_;!function(t){t[t.NON_IDR_SLICE=1]="NON_IDR_SLICE",t[t.SLICE_DPA=2]="SLICE_DPA",t[t.SLICE_DPB=3]="SLICE_DPB",t[t.SLICE_DPC=4]="SLICE_DPC",t[t.IDR=5]="IDR",t[t.SEI=6]="SEI",t[t.SPS=7]="SPS",t[t.PPS=8]="PPS",t[t.AUD=9]="AUD",t[t.SPS_EXT=13]="SPS_EXT"}(K_||(K_={})),function(t){t[t.RASL_N=8]="RASL_N",t[t.RASL_R=9]="RASL_R",t[t.BLA_W_LP=16]="BLA_W_LP",t[t.RSV_IRAP_VCL23=23]="RSV_IRAP_VCL23",t[t.VPS_NUT=32]="VPS_NUT",t[t.SPS_NUT=33]="SPS_NUT",t[t.PPS_NUT=34]="PPS_NUT",t[t.AUD_NUT=35]="AUD_NUT",t[t.PREFIX_SEI_NUT=39]="PREFIX_SEI_NUT",t[t.SUFFIX_SEI_NUT=40]="SUFFIX_SEI_NUT"}(X_||(X_={}));const Y_=function*(t){let e=0,n=-1;for(;e<t.length-2;){const i=t.indexOf(0,e);if(-1===i||i>=t.length-2)break;e=i;let r=0;e+3<t.length&&0===t[e+1]&&0===t[e+2]&&1===t[e+3]?r=4:0===t[e+1]&&1===t[e+2]&&(r=3),0!==r?(-1!==n&&e>n&&(yield{offset:n,length:e-n}),n=e+r,e=n):e++}-1!==n&&n<t.length&&(yield{offset:n,length:t.length-n})},Q_=function*(t,e){let n=0;const i=new DataView(t.buffer,t.byteOffset,t.byteLength);for(;n+e<=t.length;){let t;1===e?t=i.getUint8(n):2===e?t=i.getUint16(n,!1):3===e?t=S_(i,n):(c_(4===e),t=i.getUint32(n,!1)),n+=e,yield{offset:n,length:t},n+=t}},J_=t=>31&t,Z_=t=>{const e=[],n=t.length;for(let i=0;i<n;i++)i+2<n&&0===t[i]&&0===t[i+1]&&3===t[i+2]?(e.push(0,0),i+=2):e.push(t[i]);return new Uint8Array(e)},tT=t=>t>>1&63,eT=function*(t){const e=new L_(t),n=()=>{let t=0;for(let n=0;n<8;n++){const i=e.readAlignedByte();if(t|=(127&i)<<7*n,!(128&i))break;if(7===n&&128&i)return null}return t>=2**32-1?null:t};for(;e.getBitsLeft()>=8;){e.skipBits(1);const i=e.readBits(4),r=e.readBits(1),o=e.readBits(1);let s;if(e.skipBits(1),r&&e.skipBits(8),o){const t=n();if(null===t)return;s=t}else s=Math.floor(e.getBitsLeft()/8);c_(e.pos%8==0),yield{type:i,data:t.subarray(e.pos/8,e.pos/8+s)},e.skipBits(8*s)}};var nT;!function(t){t[t.STREAMINFO=0]="STREAMINFO",t[t.VORBIS_COMMENT=4]="VORBIS_COMMENT",t[t.PICTURE=6]="PICTURE"}(nT||(nT={}));const iT=[2,1,2,3,3,4,4,5];class rT{constructor(t){this.input=t}}const oT=[],sT=[],aT=new Uint8Array(0);class lT{constructor(t,e,n,i,r=-1,o,s){if(this.data=t,this.type=e,this.timestamp=n,this.duration=i,this.sequenceNumber=r,t===aT&&void 0===o)throw new Error("Internal error: byteLength must be explicitly provided when constructing metadata-only packets.");if(void 0===o&&(o=t.byteLength),!(t instanceof Uint8Array))throw new TypeError("data must be a Uint8Array.");if("key"!==e&&"delta"!==e)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===aT}get microsecondTimestamp(){return Math.trunc(M_*this.timestamp)}get microsecondDuration(){return Math.trunc(M_*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(t=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:t,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(t,e){var n;if(!(t instanceof EncodedVideoChunk||t instanceof EncodedAudioChunk))throw new TypeError("chunk must be an EncodedVideoChunk or EncodedAudioChunk.");const i=new Uint8Array(t.byteLength);return t.copyTo(i),new lT(i,t.type,t.timestamp/1e6,(null!==(n=t.duration)&&void 0!==n?n:0)/1e6,void 0,void 0,e)}clone(t){var e,n,i,r,o,s;if(void 0!==t&&("object"!=typeof t||null===t))throw new TypeError("options, when provided, must be an object.");if(void 0!==(null==t?void 0:t.data)&&!(t.data instanceof Uint8Array))throw new TypeError("options.data, when provided, must be a Uint8Array.");if(void 0!==(null==t?void 0:t.type)&&"key"!==t.type&&"delta"!==t.type)throw new TypeError('options.type, when provided, must be either "key" or "delta".');if(void 0!==(null==t?void 0:t.timestamp)&&!Number.isFinite(t.timestamp))throw new TypeError("options.timestamp, when provided, must be a number.");if(void 0!==(null==t?void 0:t.duration)&&!Number.isFinite(t.duration))throw new TypeError("options.duration, when provided, must be a number.");if(void 0!==(null==t?void 0:t.sequenceNumber)&&!Number.isFinite(t.sequenceNumber))throw new TypeError("options.sequenceNumber, when provided, must be a number.");if(void 0!==(null==t?void 0:t.sideData)&&("object"!=typeof t.sideData||null===t.sideData))throw new TypeError("options.sideData, when provided, must be an object.");return new lT(null!==(e=null==t?void 0:t.data)&&void 0!==e?e:this.data,null!==(n=null==t?void 0:t.type)&&void 0!==n?n:this.type,null!==(i=null==t?void 0:t.timestamp)&&void 0!==i?i:this.timestamp,null!==(r=null==t?void 0:t.duration)&&void 0!==r?r:this.duration,null!==(o=null==t?void 0:t.sequenceNumber)&&void 0!==o?o:this.sequenceNumber,this.byteLength,null!==(s=null==t?void 0:t.sideData)&&void 0!==s?s:this.sideData)}}const cT=t=>{if(!t||"object"!=typeof t)throw new TypeError("options must be an object.");if(void 0!==t.metadataOnly&&"boolean"!=typeof t.metadataOnly)throw new TypeError("options.metadataOnly, when defined, must be a boolean.");if(void 0!==t.verifyKeyPackets&&"boolean"!=typeof t.verifyKeyPackets)throw new TypeError("options.verifyKeyPackets, when defined, must be a boolean.");if(t.verifyKeyPackets&&t.metadataOnly)throw new TypeError("options.verifyKeyPackets and options.metadataOnly cannot be enabled together.")},uT=t=>{if(!P_(t))throw new TypeError("timestamp must be a number.")},dT=(t,e,n)=>n.verifyKeyPackets?e.then((async e=>{if(!e||"delta"===e.type)return e;const n=await t.determinePacketType(e);return n&&(e.type=n),e})):e;class hT{constructor(t){if(!(t instanceof fT))throw new TypeError("track must be an InputTrack.");this._track=t}getFirstPacket(t={}){if(cT(t),this._track.input._disposed)throw new zT;return dT(this._track,this._track._backing.getFirstPacket(t),t)}async getFirstKeyPacket(t={}){cT(t);const e=await this.getFirstPacket(t);return e?"key"===e.type?e:this.getNextKeyPacket(e,t):null}getPacket(t,e={}){if(uT(t),cT(e),this._track.input._disposed)throw new zT;return dT(this._track,this._track._backing.getPacket(t,e),e)}getNextPacket(t,e={}){if(!(t instanceof lT))throw new TypeError("packet must be an EncodedPacket.");if(cT(e),this._track.input._disposed)throw new zT;return dT(this._track,this._track._backing.getNextPacket(t,e),e)}async getKeyPacket(t,e={}){if(uT(t),cT(e),this._track.input._disposed)throw new zT;if(!e.verifyKeyPackets)return this._track._backing.getKeyPacket(t,e);const n=await this._track._backing.getKeyPacket(t,e);return n?(c_("key"===n.type),"delta"===await this._track.determinePacketType(n)?this.getKeyPacket(n.timestamp-1/this._track.timeResolution,e):n):n}async getNextKeyPacket(t,e={}){if(!(t instanceof lT))throw new TypeError("packet must be an EncodedPacket.");if(cT(e),this._track.input._disposed)throw new zT;if(!e.verifyKeyPackets)return this._track._backing.getNextKeyPacket(t,e);const n=await this._track._backing.getNextKeyPacket(t,e);return n?(c_("key"===n.type),"delta"===await this._track.determinePacketType(n)?this.getNextKeyPacket(n,e):n):n}packets(t,e,n={}){if(void 0!==t&&!(t instanceof lT))throw new TypeError("startPacket must be an EncodedPacket.");if(void 0!==t&&t.isMetadataOnly&&(null==n||!n.metadataOnly))throw new TypeError("startPacket can only be metadata-only if options.metadataOnly is enabled.");if(void 0!==e&&!(e instanceof lT))throw new TypeError("endPacket must be an EncodedPacket.");if(cT(n),this._track.input._disposed)throw new zT;const i=[];let{promise:r,resolve:o}=I_(),{promise:s,resolve:a}=I_(),l=!1,c=!1,u=null;const d=[];(async()=>{let u=null!=t?t:await this.getFirstPacket(n);for(;u&&!c&&!this._track.input._disposed&&!(e&&u.sequenceNumber>=(null==e?void 0:e.sequenceNumber));)i.length>Math.max(2,d.length)?(({promise:s,resolve:a}=I_()),await s):(i.push(u),o(),({promise:r,resolve:o}=I_()),u=await this.getNextPacket(u,n));l=!0,o()})().catch((t=>{u||(u=t,o())}));const h=this._track;return{async next(){for(;;){if(h.input._disposed)throw new zT;if(c)return{value:void 0,done:!0};if(u)throw u;if(i.length>0){const t=i.shift(),e=performance.now();for(d.push(e);d.length>0&&e-d[0]>=1e3;)d.shift();return a(),{value:t,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(t){throw t},[Symbol.asyncIterator](){return this}}}}class fT{constructor(t,e){this.input=t,this._backing=e}isVideoTrack(){return this instanceof pT}isAudioTrack(){return this instanceof mT}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(t=1/0){const e=new hT(this);let n=1/0,i=-1/0,r=0,o=0;for await(const s of e.packets(void 0,void 0,{metadataOnly:!0})){if(r>=t&&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 pT extends fT{constructor(t,e){super(t,e),this._backing=e,this.pixelAspectRatio=(t=>{c_(0!==t.den);let e=Math.abs(t.num),n=Math.abs(t.den);for(;0!==n;){const t=e%n;e=n,n=t}const i=e||1;return{num:t.num/i,den:t.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 t=await this._backing.getColorSpace();return"bt2020"===t.primaries||"smpte432"===t.primaries||"pg"===t.transfer||"hlg"===t.transfer||"bt2020-ncl"===t.matrix}canBeTransparent(){return this._backing.canBeTransparent()}getDecoderConfig(){return this._backing.getDecoderConfig()}async getCodecParameterString(){var t;const e=await this._backing.getDecoderConfig();return null!==(t=null==e?void 0:e.codec)&&void 0!==t?t:null}async canDecode(){try{const t=await this._backing.getDecoderConfig();if(!t)return!1;const e=this._backing.getCodec();return c_(null!==e),oT.some((n=>n.supports(e,t)))?!0:"undefined"!=typeof VideoDecoder&&!0===(await VideoDecoder.isConfigSupported(t)).supported}catch(t){return console.error("Error during decodability check:",t),!1}}async determinePacketType(t){if(!(t instanceof lT))throw new TypeError("packet must be an EncodedPacket.");if(t.isMetadataOnly)throw new TypeError("packet must not be metadata-only to determine its type.");if(null===this.codec)return null;const e=await this.getDecoderConfig();return c_(e),((t,e,n)=>{switch(t){case"avc":for(const t of((t,e)=>{if(e.description){const n=3&h_(e.description)[4];return Q_(t,n+1)}return Y_(t)})(n,e)){const e=n[t.offset],r=J_(e);if(r>=K_.NON_IDR_SLICE&&r<=K_.SLICE_DPC)return"delta";if(r===K_.IDR)return"key";if(r===K_.SEI&&(i=void 0,!(null!==F_?F_:F_=!("undefined"==typeof navigator||(null===(i=navigator.vendor)||void 0===i||!i.includes("Google Inc"))&&!/Chrome/.test(navigator.userAgent)))||O_()>=144)){const e=n.subarray(t.offset,t.offset+t.length),i=Z_(e);let r=1;do{let t=0;for(;;){const e=i[r++];if(void 0===e)break;if(t+=e,e<255)break}let e=0;for(;;){const t=i[r++];if(void 0===t)break;if(e+=t,t<255)break}if(6===t){const t=new L_(i);t.pos=8*r;const e=d_(t),n=t.readBits(1);if(0===e&&1===n)return"key"}r+=e}while(r<i.length-1)}}return"delta";case"hevc":for(const t of((t,e)=>{if(e.description){const n=3&h_(e.description)[21];return Q_(t,n+1)}return Y_(t)})(n,e)){const e=tT(n[t.offset]);if(e<X_.BLA_W_LP)return"delta";if(e<=X_.RSV_IRAP_VCL23)return"key"}return"delta";case"vp8":return 1&n[0]?"delta":"key";case"vp9":{const t=new L_(n);if(2!==t.readBits(2))return null;const e=t.readBits(1);return 3===(t.readBits(1)<<1)+e&&t.skipBits(1),t.readBits(1)?null:0===t.readBits(1)?"key":"delta"}case"av1":{let t=!1;for(const{type:e,data:i}of eT(n))if(1===e){const e=new L_(i);e.skipBits(4),t=!!e.readBits(1)}else if(3===e||6===e||7===e){if(t)return"key";const e=new L_(i);return e.readBits(1)?null:0===e.readBits(2)?"key":"delta"}return null}default:(t=>{throw new Error(`Unexpected value: ${t}`)})(t),c_(!1)}var i})(this.codec,e,t.data)}}class mT extends fT{constructor(t,e){super(t,e),this._backing=e}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 t;const e=await this._backing.getDecoderConfig();return null!==(t=null==e?void 0:e.codec)&&void 0!==t?t:null}async canDecode(){try{const t=await this._backing.getDecoderConfig();if(!t)return!1;const e=this._backing.getCodec();return c_(null!==e),sT.some((n=>n.supports(e,t)))?!0:!!t.codec.startsWith("pcm-")||"undefined"!=typeof AudioDecoder&&!0===(await AudioDecoder.isConfigSupported(t)).supported}catch(t){return console.error("Error during decodability check:",t),!1}}async determinePacketType(t){if(!(t instanceof lT))throw new TypeError("packet must be an EncodedPacket.");return null===this.codec?null:"key"}}const vT=t=>{let e=KT(t);const n=ZT(t,4);let i=8;1===e&&(e=YT(t),i=16);const r=e-i;return r<0?null:{name:n,totalSize:e,headerSize:i,contentSize:r}},gT=t=>XT(t)/65536,yT=t=>XT(t)/1073741824,bT=t=>{let e=0;for(let n=0;n<4;n++){e<<=7;const n=qT(t);if(e|=127&n,!(128&n))break}return e},kT=t=>{let e=VT(t);return t.skip(2),e=Math.min(e,t.remainingLength),p_.decode(UT(t,e))},wT=t=>{const e=vT(t);if(!e||"data"!==e.name)return null;if(t.remainingLength<8)return null;const n=KT(t);t.skip(4);const i=UT(t,e.contentSize-8);switch(n){case 1:return p_.decode(i);case 2:return new TextDecoder("utf-16be").decode(i);case 13:return new R_(i,"image/jpeg");case 14:return new R_(i,"image/png");case 27:return new R_(i,"image/bmp");default:return i}};class xT extends rT{constructor(t){super(t),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=t._reader}async computeDuration(){const t=await this.getTracks(),e=await Promise.all(t.map((t=>t.computeDuration())));return Math.max(0,...e)}async getTracks(){return await this.readMetadata(),this.tracks.map((t=>t.inputTrack))}async getMimeType(){await this.readMetadata();const t=await Promise.all(this.tracks.map((t=>t.inputTrack.getCodecParameterString())));return(t=>{let e=(t.hasVideo?"video/":t.hasAudio?"audio/":"application/")+(t.isQuickTime?"quicktime":"mp4");return t.codecStrings.length>0&&(e+=`; codecs="${[...new Set(t.codecStrings)].join(", ")}"`),e})({isQuickTime:this.isQuickTime,hasVideo:this.tracks.some((t=>{var e;return"video"===(null===(e=t.info)||void 0===e?void 0:e.type)})),hasAudio:this.tracks.some((t=>{var e;return"audio"===(null===(e=t.info)||void 0===e?void 0:e.type)})),codecStrings:t.filter(Boolean)})}async getMetadataTags(){return await this.readMetadata(),this.metadataTags}readMetadata(){var t;return null!==(t=this.metadataPromise)&&void 0!==t?t:this.metadataPromise=(async()=>{let t=0;for(;;){let e=this.reader.requestSliceRange(t,8,16);if(e instanceof Promise&&(e=await e),!e)break;const n=t,i=vT(e);if(!i)break;if("ftyp"===i.name){const t=ZT(e,4);this.isQuickTime="qt "===t}else if("moov"===i.name){let t=this.reader.requestSlice(e.filePos,i.contentSize);if(t instanceof Promise&&(t=await t),!t)break;this.moovSlice=t,this.readContiguousBoxes(this.moovSlice),this.tracks.sort(((t,e)=>Number(e.disposition.default)-Number(t.disposition.default)));for(const t of this.tracks){const e=t.editListPreviousSegmentDurations/this.movieTimescale;t.editListOffset-=Math.round(e*t.timescale)}break}t=n+i.totalSize}if(this.isFragmented&&null!==this.reader.fileSize){let t=this.reader.requestSlice(this.reader.fileSize-4,4);t instanceof Promise&&(t=await t),c_(t);const e=KT(t),n=this.reader.fileSize-e;if(n>=0&&n<=this.reader.fileSize-16){let t=this.reader.requestSliceRange(n,8,16);if(t instanceof Promise&&(t=await t),t){const e=vT(t);if(e&&"mfra"===e.name){let n=this.reader.requestSlice(t.filePos,e.contentSize);n instanceof Promise&&(n=await n),n&&this.readContiguousBoxes(n)}}}}})()}getSampleTableForTrack(t){var e;if(t.sampleTable)return t.sampleTable;const n={sampleTimingEntries:[],sampleCompositionTimeOffsets:[],sampleSizes:[],keySampleIndices:null,chunkOffsets:[],sampleToChunk:[],presentationTimestamps:null,presentationTimestampIndexMap:null};t.sampleTable=n,c_(this.moovSlice);const i=this.moovSlice.slice(t.sampleTableByteOffset);if(this.currentTrack=t,this.traverseBox(i),this.currentTrack=null,"audio"===(null===(e=t.info)||void 0===e?void 0:e.type)&&t.info.codec&&$_.includes(t.info.codec)&&0===n.sampleCompositionTimeOffsets.length){var r;c_("audio"===(null===(r=t.info)||void 0===r?void 0:r.type));const e=(t=>{if(c_($_.includes(t)),"ulaw"===t)return{dataType:"ulaw",sampleSize:1,littleEndian:!0,silentValue:255};if("alaw"===t)return{dataType:"alaw",sampleSize:1,littleEndian:!0,silentValue:213};const e=V_.exec(t);let n;return c_(e),n="u"===e[1]?"unsigned":"s"===e[1]?"signed":"float",{dataType:n,sampleSize:Number(e[2])/8,littleEndian:"be"!==e[3],silentValue:"pcm-u8"===t?128:0}})(t.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=E_(n.sampleTimingEntries,a,(t=>t.startIndex)),u=n.sampleTimingEntries[c],d=E_(n.sampleTimingEntries,l,(t=>t.startIndex)),h=n.sampleTimingEntries[d],f=u.startDecodeTimestamp+(a-u.startIndex)*u.delta,p=h.startDecodeTimestamp+(l-h.startIndex)*h.delta-f,m=u_(i);m&&m.delta===p?m.count++:i.push({startIndex:s.startChunkIndex+r,startDecodeTimestamp:f,count:1,delta:p});const v=s.samplesPerChunk*e.sampleSize*t.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 t of n.sampleTimingEntries)for(let e=0;e<t.count;e++)n.presentationTimestamps.push({presentationTimestamp:t.startDecodeTimestamp+e*t.delta,sampleIndex:t.startIndex+e});for(const t of n.sampleCompositionTimeOffsets)for(let e=0;e<t.count;e++){const i=t.startIndex+e,r=n.presentationTimestamps[i];r&&(r.presentationTimestamp+=t.offset)}n.presentationTimestamps.sort(((t,e)=>t.presentationTimestamp-e.presentationTimestamp)),n.presentationTimestampIndexMap=Array(n.presentationTimestamps.length).fill(-1);for(let t=0;t<n.presentationTimestamps.length;t++)n.presentationTimestampIndexMap[n.presentationTimestamps[t].sampleIndex]=t}return n}async readFragment(t){var e;if((null===(e=this.lastReadFragment)||void 0===e?void 0:e.moofOffset)===t)return this.lastReadFragment;let n=this.reader.requestSliceRange(t,8,16);n instanceof Promise&&(n=await n),c_(n);const i=vT(n);c_("moof"===(null==i?void 0:i.name));let r=this.reader.requestSlice(t,i.totalSize);r instanceof Promise&&(r=await r),c_(r),this.traverseBox(r);const o=this.lastReadFragment;c_(o&&o.moofOffset===t);for(const[,t]of o.trackData){const e=t.track,{fragmentPositionCache:n}=e;if(!t.startTimestampIsFinal){const i=e.fragmentLookupTable.find((t=>t.moofOffset===o.moofOffset));if(i)MT(t,i.timestamp);else{const e=E_(n,o.moofOffset-1,(t=>t.moofOffset));if(-1!==e){const i=n[e];MT(t,i.endTimestamp)}}t.startTimestampIsFinal=!0}const i=E_(n,t.startTimestamp,(t=>t.startTimestamp));-1!==i&&n[i].moofOffset===o.moofOffset||n.splice(i+1,0,{moofOffset:o.moofOffset,startTimestamp:t.startTimestamp,endTimestamp:t.endTimestamp})}return o}readContiguousBoxes(t){const e=t.filePos;for(;t.filePos-e<=t.length-8&&this.traverseBox(t););}*iterateContiguousBoxes(t){const e=t.filePos;for(;t.filePos-e<=t.length-8;){const e=t.filePos,n=vT(t);if(!n)break;yield{boxInfo:n,slice:t},t.filePos=e+n.totalSize}}traverseBox(t){var e,n,i,r,o,s,a,l,c,u,d,h,f,p,m,v,g,y,b,k,w,x,_,T,E,I,S,A,N,M,F,C,O,P,R,D;const L=t.filePos,B=vT(t);if(!B)return!1;const z=t.filePos,W=L+B.totalSize;switch(B.name){case"mdia":case"minf":case"dinf":case"mfra":case"edts":case"wave":this.readContiguousBoxes(t.slice(z,B.contentSize));break;case"mvhd":{const e=qT(t);t.skip(3),1===e?(t.skip(16),this.movieTimescale=KT(t),this.movieDurationInTimescale=YT(t)):(t.skip(8),this.movieTimescale=KT(t),this.movieDurationInTimescale=KT(t))}break;case"trak":{const e={id:-1,demuxer:this,inputTrack:null,disposition:{...D_},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=e,this.readContiguousBoxes(t.slice(z,B.contentSize)),-1!==e.id&&-1!==e.timescale&&null!==e.info)if("video"===e.info.type&&-1!==e.info.width){const t=e;e.inputTrack=new pT(this.input,new TT(t)),this.tracks.push(e)}else if("audio"===e.info.type&&-1!==e.info.numberOfChannels){const t=e;e.inputTrack=new mT(this.input,new ET(t)),this.tracks.push(e)}this.currentTrack=null}break;case"tkhd":{const e=this.currentTrack;if(!e)break;const n=qT(t),i=!!(1&GT(t));if(e.disposition.default=i,0===n)t.skip(8),e.id=KT(t),t.skip(4),e.durationInMovieTimescale=KT(t);else{if(1!==n)throw new Error(`Incorrect track header version ${n}.`);t.skip(16),e.id=KT(t),t.skip(4),e.durationInMovieTimescale=YT(t)}t.skip(16);const r=[gT(t),gT(t),yT(t),gT(t),gT(t),yT(t),gT(t),gT(t),yT(t)],o=(t=>{const e=(t%360+360)%360;if(0===e||90===e||180===e||270===e)return e;throw new Error(`Invalid rotation ${t}.`)})((Ct=FT(r),90*Math.round(Ct/90)));c_(0===o||90===o||180===o||270===o),e.rotation=o}break;case"elst":{const e=this.currentTrack;if(!e)break;const n=qT(t);t.skip(3);let i=!1,r=0;const o=KT(t);for(let s=0;s<o;s++){const o=1===n?YT(t):KT(t),s=1===n?QT(t):XT(t),a=gT(t);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}e.editListPreviousSegmentDurations=r,e.editListOffset=s,i=!0}else r+=o}}}break;case"mdhd":{const e=this.currentTrack;if(!e)break;const n=qT(t);t.skip(3),0===n?(t.skip(8),e.timescale=KT(t),e.durationInMediaTimescale=KT(t)):1===n&&(t.skip(16),e.timescale=KT(t),e.durationInMediaTimescale=YT(t));let i=VT(t);if(i>0){e.languageCode="";for(let t=0;t<3;t++)e.languageCode=String.fromCharCode(96+(31&i))+e.languageCode,i>>=5;Ft=e.languageCode,N_.test(Ft)||(e.languageCode="und")}}break;case"hdlr":{const e=this.currentTrack;if(!e)break;t.skip(8);const n=ZT(t,4);"vide"===n?e.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&&(e.info={type:"audio",numberOfChannels:-1,sampleRate:-1,codec:null,codecDescription:null,aacCodecInfo:null})}break;case"stbl":{const e=this.currentTrack;if(!e)break;e.sampleTableByteOffset=L,this.readContiguousBoxes(t.slice(z,B.contentSize))}break;case"stsd":{const e=this.currentTrack;if(!e)break;if(null===e.info||e.sampleTable)break;const n=qT(t);t.skip(3);const i=KT(t);for(let r=0;r<i;r++){const i=t.filePos,r=vT(t);if(!r)break;e.internalCodecId=r.name;const o=r.name.toLowerCase();if("video"===e.info.type)"avc1"===o||"avc3"===o?(e.info.codec="avc",e.info.avcType="avc1"===o?1:3):"hvc1"===o||"hev1"===o?e.info.codec="hevc":"vp08"===o?e.info.codec="vp8":"vp09"===o?e.info.codec="vp9":"av01"===o?e.info.codec="av1":console.warn(`Unsupported video codec (sample entry type '${r.name}').`),t.skip(24),e.info.width=VT(t),e.info.height=VT(t),e.info.squarePixelWidth=e.info.width,e.info.squarePixelHeight=e.info.height,t.skip(50),this.readContiguousBoxes(t.slice(t.filePos,i+r.totalSize-t.filePos));else{"mp4a"===o||("opus"===o?e.info.codec="opus":"flac"===o?e.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?e.info.codec="ulaw":"alaw"===o?e.info.codec="alaw":"ac-3"===o?e.info.codec="ac3":"ec-3"===o?e.info.codec="eac3":console.warn(`Unsupported audio codec (sample entry type '${r.name}').`))),t.skip(8);const s=VT(t);t.skip(6);let a=VT(t),l=VT(t);t.skip(4);let c=KT(t)/65536;if(0===n&&s>0)if(1===s)t.skip(4),l=8*KT(t),t.skip(8);else if(2===s){t.skip(4),c=JT(t),a=KT(t),t.skip(4),l=KT(t);const n=KT(t);if(t.skip(8),"lpcm"===o){const t=l+7>>3,i=Boolean(1&n),r=Boolean(2&n),o=4&n?-1:0;l>0&&l<=64&&(i?32===l&&(e.info.codec=r?"pcm-f32be":"pcm-f32"):o&1<<t-1?1===t?e.info.codec="pcm-s8":2===t?e.info.codec=r?"pcm-s16be":"pcm-s16":3===t?e.info.codec=r?"pcm-s24be":"pcm-s24":4===t&&(e.info.codec=r?"pcm-s32be":"pcm-s32"):1===t&&(e.info.codec="pcm-u8")),null===e.info.codec&&console.warn("Unsupported PCM format.")}}"opus"===e.info.codec&&(c=48e3),e.info.numberOfChannels=a,e.info.sampleRate=c,"twos"===o?8===l?e.info.codec="pcm-s8":16===l?e.info.codec="pcm-s16be":(console.warn(`Unsupported sample size ${l} for codec 'twos'.`),e.info.codec=null):"sowt"===o?8===l?e.info.codec="pcm-s8":16===l?e.info.codec="pcm-s16":(console.warn(`Unsupported sample size ${l} for codec 'sowt'.`),e.info.codec=null):"raw "===o?e.info.codec="pcm-u8":"in24"===o?e.info.codec="pcm-s24be":"in32"===o?e.info.codec="pcm-s32be":"fl32"===o?e.info.codec="pcm-f32be":"fl64"===o?e.info.codec="pcm-f64be":"ipcm"===o?e.info.codec="pcm-s16be":"fpcm"===o&&(e.info.codec="pcm-f32be"),this.readContiguousBoxes(t.slice(t.filePos,i+r.totalSize-t.filePos))}}}break;case"avcC":{const e=this.currentTrack;if(!e)break;c_(e.info),e.info.codecDescription=UT(t,B.contentSize)}break;case"hvcC":{const e=this.currentTrack;if(!e)break;c_(e.info),e.info.codecDescription=UT(t,B.contentSize)}break;case"vpcC":{var $;const e=this.currentTrack;if(!e)break;c_("video"===(null===($=e.info)||void 0===$?void 0:$.type)),t.skip(4);const n=qT(t),i=qT(t),r=qT(t),o=r>>4,s=r>>1&7,a=1&r,l=qT(t),c=qT(t),u=qT(t);e.info.vp9CodecInfo={profile:n,level:i,bitDepth:o,chromaSubsampling:s,videoFullRangeFlag:a,colourPrimaries:l,transferCharacteristics:c,matrixCoefficients:u}}break;case"av1C":{var j;const e=this.currentTrack;if(!e)break;c_("video"===(null===(j=e.info)||void 0===j?void 0:j.type)),t.skip(1);const n=qT(t),i=n>>5,r=31&n,o=qT(t),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;e.info.av1CodecInfo={profile:i,level:r,tier:s,bitDepth:h,monochrome:l,chromaSubsamplingX:c,chromaSubsamplingY:u,chromaSamplePosition:d}}break;case"colr":{var U;const e=this.currentTrack;if(!e)break;if(c_("video"===(null===(U=e.info)||void 0===U?void 0:U.type)),"nclx"!==ZT(t,4))break;const n=VT(t),i=VT(t),r=VT(t),o=Boolean(128&qT(t));e.info.colorSpace={primaries:g_[n],transfer:b_[i],matrix:w_[r],fullRange:o}}break;case"pasp":{var q;const e=this.currentTrack;if(!e)break;c_("video"===(null===(q=e.info)||void 0===q?void 0:q.type));const n=KT(t),i=KT(t);n>i?e.info.squarePixelWidth=Math.round(e.info.width*n/i):e.info.squarePixelHeight=Math.round(e.info.height*i/n)}break;case"esds":{var V;const e=this.currentTrack;if(!e)break;c_("audio"===(null===(V=e.info)||void 0===V?void 0:V.type)),t.skip(4),c_(3===qT(t)),bT(t),t.skip(2);const n=qT(t),i=!!(64&n),r=!!(32&n);if(!!(128&n)&&t.skip(2),i){const e=qT(t);t.skip(e)}r&&t.skip(2),c_(4===qT(t));const o=bT(t),s=t.filePos,a=qT(t);if(64===a||103===a?(e.info.codec="aac",e.info.aacCodecInfo={isMpeg2:103===a,objectType:null}):105===a||107===a?e.info.codec="mp3":221===a?e.info.codec="vorbis":console.warn(`Unsupported audio codec (objectTypeIndication ${a}) - discarding track.`),t.skip(12),o>t.filePos-s){c_(5===qT(t));const n=bT(t);if(e.info.codecDescription=UT(t,n),"aac"===e.info.codec){const t=W_(e.info.codecDescription);null!==t.numberOfChannels&&(e.info.numberOfChannels=t.numberOfChannels),null!==t.sampleRate&&(e.info.sampleRate=t.sampleRate)}}}break;case"enda":{var G;const e=this.currentTrack;if(!e)break;c_("audio"===(null===(G=e.info)||void 0===G?void 0:G.type)),255&VT(t)&&("pcm-s16be"===e.info.codec?e.info.codec="pcm-s16":"pcm-s24be"===e.info.codec?e.info.codec="pcm-s24":"pcm-s32be"===e.info.codec?e.info.codec="pcm-s32":"pcm-f32be"===e.info.codec?e.info.codec="pcm-f32":"pcm-f64be"===e.info.codec&&(e.info.codec="pcm-f64"))}break;case"pcmC":{var H;const e=this.currentTrack;if(!e)break;c_("audio"===(null===(H=e.info)||void 0===H?void 0:H.type)),t.skip(4);const n=qT(t),i=Boolean(1&n),r=qT(t);"pcm-s16be"===e.info.codec?i?16===r?e.info.codec="pcm-s16":24===r?e.info.codec="pcm-s24":32===r?e.info.codec="pcm-s32":(console.warn(`Invalid ipcm sample size ${r}.`),e.info.codec=null):16===r?e.info.codec="pcm-s16be":24===r?e.info.codec="pcm-s24be":32===r?e.info.codec="pcm-s32be":(console.warn(`Invalid ipcm sample size ${r}.`),e.info.codec=null):"pcm-f32be"===e.info.codec&&(i?32===r?e.info.codec="pcm-f32":64===r?e.info.codec="pcm-f64":(console.warn(`Invalid fpcm sample size ${r}.`),e.info.codec=null):32===r?e.info.codec="pcm-f32be":64===r?e.info.codec="pcm-f64be":(console.warn(`Invalid fpcm sample size ${r}.`),e.info.codec=null));break}case"dOps":{var K;const e=this.currentTrack;if(!e)break;c_("audio"===(null===(K=e.info)||void 0===K?void 0:K.type)),t.skip(1);const n=qT(t),i=VT(t),r=KT(t),o=HT(t),s=qT(t);let a;a=0!==s?UT(t,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),e.info.codecDescription=l,e.info.numberOfChannels=n}break;case"dfLa":{var X;const e=this.currentTrack;if(!e)break;c_("audio"===(null===(X=e.info)||void 0===X?void 0:X.type)),t.skip(4);const n=127,i=128,r=t.filePos;for(;t.filePos<W;){const r=qT(t),o=GT(t);if((r&n)===nT.STREAMINFO){t.skip(10);const n=KT(t),i=n>>>12,r=1+(n>>9&7);e.info.sampleRate=i,e.info.numberOfChannels=r,t.skip(20)}else t.skip(o);if(r&i)break}const o=t.filePos;t.filePos=r;const s=UT(t,o-r),a=new Uint8Array(4+s.byteLength);new DataView(a.buffer).setUint32(0,1716281667,!1),a.set(s,4),e.info.codecDescription=a}break;case"dac3":{var Y;const e=this.currentTrack;if(!e)break;c_("audio"===(null===(Y=e.info)||void 0===Y?void 0:Y.type));const n=UT(t,3),i=new L_(n),r=i.readBits(2);i.skipBits(8);const o=i.readBits(3),s=i.readBits(1);r<3&&(e.info.sampleRate=G_[r]),e.info.numberOfChannels=iT[o]+s}break;case"dec3":{var Q;const e=this.currentTrack;if(!e)break;c_("audio"===(null===(Q=e.info)||void 0===Q?void 0:Q.type));const n=(t=>{if(t.length<2)return null;const e=new L_(t),n=e.readBits(13),i=e.readBits(3),r=[];for(let n=0;n<=i&&!(Math.ceil(e.pos/8)+3>t.length);n++){const t=e.readBits(2),n=e.readBits(5);e.skipBits(1),e.skipBits(1);const i=e.readBits(3),o=e.readBits(3),s=e.readBits(1);e.skipBits(3);const a=e.readBits(4);let l=0;a>0?l=e.readBits(9):e.skipBits(1),r.push({fscod:t,fscod2:null,bsid:n,bsmod:i,acmod:o,lfeon:s,numDepSub:a,chanLoc:l})}return 0===r.length?null:{dataRate:n,substreams:r}})(UT(t,B.contentSize));if(!n){console.warn("Invalid dec3 box contents, ignoring.");break}const i=(t=>{const e=t.substreams[0];return c_(e),e.fscod<3?G_[e.fscod]:null!==e.fscod2&&e.fscod2<3?H_[e.fscod2]:null})(n);null!==i&&(e.info.sampleRate=i),e.info.numberOfChannels=(t=>{const e=t.substreams[0];c_(e);let n=iT[e.acmod]+e.lfeon;if(e.numDepSub>0){const t=[2,2,1,1,2,2,2,1,1];for(let i=0;i<9;i++)e.chanLoc&1<<8-i&&(n+=t[i])}return n})(n)}break;case"stts":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4);const n=KT(t);let i=0,r=0;for(let o=0;o<n;o++){const n=KT(t),o=KT(t);e.sampleTable.sampleTimingEntries.push({startIndex:i,startDecodeTimestamp:r,count:n,delta:o}),i+=n,r+=n*o}}break;case"ctts":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4);const n=KT(t);let i=0;for(let r=0;r<n;r++){const n=KT(t),r=XT(t);e.sampleTable.sampleCompositionTimeOffsets.push({startIndex:i,count:n,offset:r}),i+=n}}break;case"stsz":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4);const n=KT(t),i=KT(t);if(0===n)for(let n=0;n<i;n++){const n=KT(t);e.sampleTable.sampleSizes.push(n)}else e.sampleTable.sampleSizes.push(n)}break;case"stz2":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4),t.skip(3);const n=qT(t),i=KT(t),r=UT(t,Math.ceil(i*n/8)),o=new L_(r);for(let t=0;t<i;t++){const t=o.readBits(n);e.sampleTable.sampleSizes.push(t)}}break;case"stss":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4),e.sampleTable.keySampleIndices=[];const n=KT(t);for(let i=0;i<n;i++){const n=KT(t)-1;e.sampleTable.keySampleIndices.push(n)}0!==e.sampleTable.keySampleIndices[0]&&e.sampleTable.keySampleIndices.unshift(0)}break;case"stsc":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4);const n=KT(t);for(let i=0;i<n;i++){const n=KT(t)-1,i=KT(t),r=KT(t);e.sampleTable.sampleToChunk.push({startSampleIndex:-1,startChunkIndex:n,samplesPerChunk:i,sampleDescriptionIndex:r})}let i=0;for(let t=0;t<e.sampleTable.sampleToChunk.length;t++)e.sampleTable.sampleToChunk[t].startSampleIndex=i,t<e.sampleTable.sampleToChunk.length-1&&(i+=(e.sampleTable.sampleToChunk[t+1].startChunkIndex-e.sampleTable.sampleToChunk[t].startChunkIndex)*e.sampleTable.sampleToChunk[t].samplesPerChunk)}break;case"stco":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4);const n=KT(t);for(let i=0;i<n;i++){const n=KT(t);e.sampleTable.chunkOffsets.push(n)}}break;case"co64":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4);const n=KT(t);for(let i=0;i<n;i++){const n=YT(t);e.sampleTable.chunkOffsets.push(n)}}break;case"mvex":this.isFragmented=!0,this.readContiguousBoxes(t.slice(z,B.contentSize));break;case"mehd":{const e=qT(t);t.skip(3);const n=1===e?YT(t):KT(t);this.movieDurationInTimescale=n}break;case"trex":{t.skip(4);const e=KT(t),n=KT(t),i=KT(t),r=KT(t),o=KT(t);this.fragmentTrackDefaults.push({trackId:e,defaultSampleDescriptionIndex:n,defaultSampleDuration:i,defaultSampleSize:r,defaultSampleFlags:o})}break;case"tfra":{const e=qT(t);t.skip(3);const n=KT(t),i=this.tracks.find((t=>t.id===n));if(!i)break;const r=KT(t),o=(12&r)>>2,s=3&r,a=[qT,VT,GT,KT],l=a[(48&r)>>4],c=a[o],u=a[s],d=KT(t);for(let n=0;n<d;n++){const n=1===e?YT(t):KT(t),r=1===e?YT(t):KT(t);l(t),c(t),u(t),i.fragmentLookupTable.push({timestamp:n,moofOffset:r})}i.fragmentLookupTable.sort(((t,e)=>t.timestamp-e.timestamp));for(let t=0;t<i.fragmentLookupTable.length-1;t++){const e=i.fragmentLookupTable[t],n=i.fragmentLookupTable[t+1];e.timestamp===n.timestamp&&(i.fragmentLookupTable.splice(t+1,1),t--)}}break;case"moof":this.currentFragment={moofOffset:L,moofSize:B.totalSize,implicitBaseDataOffset:L,trackData:new Map},this.readContiguousBoxes(t.slice(z,B.contentSize)),this.lastReadFragment=this.currentFragment,this.currentFragment=null;break;case"traf":if(c_(this.currentFragment),this.readContiguousBoxes(t.slice(z,B.contentSize)),this.currentTrack){const t=this.currentFragment.trackData.get(this.currentTrack.id);if(t){const{currentFragmentState:e}=this.currentTrack;c_(e),null!==e.startTimestamp&&(MT(t,e.startTimestamp),t.startTimestampIsFinal=!0)}this.currentTrack.currentFragmentState=null,this.currentTrack=null}break;case"tfhd":{var J,Z,tt,et;c_(this.currentFragment),t.skip(1);const e=GT(t),n=Boolean(1&e),i=Boolean(2&e),r=Boolean(8&e),o=Boolean(16&e),s=Boolean(32&e),a=Boolean(65536&e),l=Boolean(131072&e),c=KT(t),u=this.tracks.find((t=>t.id===c));if(!u)break;const d=this.fragmentTrackDefaults.find((t=>t.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!==(tt=null==d?void 0:d.defaultSampleSize)&&void 0!==tt?tt:null,defaultSampleFlags:null!==(et=null==d?void 0:d.defaultSampleFlags)&&void 0!==et?et:null,startTimestamp:null},n?u.currentFragmentState.baseDataOffset=YT(t):l&&(u.currentFragmentState.baseDataOffset=this.currentFragment.moofOffset),i&&(u.currentFragmentState.sampleDescriptionIndex=KT(t)),r&&(u.currentFragmentState.defaultSampleDuration=KT(t)),o&&(u.currentFragmentState.defaultSampleSize=KT(t)),s&&(u.currentFragmentState.defaultSampleFlags=KT(t)),a&&(u.currentFragmentState.defaultSampleDuration=0)}break;case"tfdt":{const e=this.currentTrack;if(!e)break;c_(e.currentFragmentState);const n=qT(t);t.skip(3);const i=0===n?KT(t):YT(t);e.currentFragmentState.startTimestamp=i}break;case"trun":{const e=this.currentTrack;if(!e)break;if(c_(this.currentFragment),c_(e.currentFragmentState),this.currentFragment.trackData.has(e.id)){console.warn("Can't have two trun boxes for the same track in one fragment. Ignoring...");break}const n=qT(t),i=GT(t),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=KT(t);let d=e.currentFragmentState.baseDataOffset;r&&(d+=XT(t));let h=null;o&&(h=KT(t));let f=d;if(0===u){this.currentFragment.implicitBaseDataOffset=f;break}let p=0;const m={track:e,startTimestamp:0,endTimestamp:0,firstKeyFrameTimestamp:null,samples:[],presentationTimestamps:[],startTimestampIsFinal:!1};this.currentFragment.trackData.set(e.id,m);for(let i=0;i<u;i++){let r,o,u;s?r=KT(t):(c_(null!==e.currentFragmentState.defaultSampleDuration),r=e.currentFragmentState.defaultSampleDuration),a?o=KT(t):(c_(null!==e.currentFragmentState.defaultSampleSize),o=e.currentFragmentState.defaultSampleSize),l?u=KT(t):(c_(null!==e.currentFragmentState.defaultSampleFlags),u=e.currentFragmentState.defaultSampleFlags),0===i&&null!==h&&(u=h);let d=0;c&&(d=0===n?KT(t):XT(t));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(((t,e)=>({presentationTimestamp:t.presentationTimestamp,sampleIndex:e}))).sort(((t,e)=>t.presentationTimestamp-e.presentationTimestamp));for(let t=0;t<m.presentationTimestamps.length;t++){const e=m.presentationTimestamps[t],n=m.samples[e.sampleIndex];if(null===m.firstKeyFrameTimestamp&&n.isKeyFrame&&(m.firstKeyFrameTimestamp=n.presentationTimestamp),t<m.presentationTimestamps.length-1){const i=m.presentationTimestamps[t+1];n.duration=i.presentationTimestamp-e.presentationTimestamp}}const v=m.samples[m.presentationTimestamps[0].sampleIndex],g=m.samples[u_(m.presentationTimestamps).sampleIndex];m.startTimestamp=v.presentationTimestamp,m.endTimestamp=g.presentationTimestamp+g.duration,this.currentFragment.implicitBaseDataOffset=f}break;case"udta":{const g=this.iterateContiguousBoxes(t.slice(z,B.contentSize));for(const{boxInfo:t,slice:y}of g){if("meta"!==t.name&&!this.currentTrack){var nt,it,rt,ot,st,at,lt,ct;const e=y.filePos;null!==(it=(nt=this.metadataTags).raw)&&void 0!==it||(nt.raw={}),"©"===t.name[0]?null!==(st=(rt=this.metadataTags.raw)[ot=t.name])&&void 0!==st||(rt[ot]=kT(y)):null!==(ct=(at=this.metadataTags.raw)[lt=t.name])&&void 0!==ct||(at[lt]=UT(y,t.contentSize)),y.filePos=e}switch(t.name){case"meta":y.skip(-t.headerSize),this.traverseBox(y);break;case"©nam":case"name":this.currentTrack?this.currentTrack.name=p_.decode(UT(y,t.contentSize)):null!==(n=(e=this.metadataTags).title)&&void 0!==n||(e.title=kT(y));break;case"©des":this.currentTrack||null!==(r=(i=this.metadataTags).description)&&void 0!==r||(i.description=kT(y));break;case"©ART":this.currentTrack||null!==(s=(o=this.metadataTags).artist)&&void 0!==s||(o.artist=kT(y));break;case"©alb":this.currentTrack||null!==(l=(a=this.metadataTags).album)&&void 0!==l||(a.album=kT(y));break;case"albr":this.currentTrack||null!==(u=(c=this.metadataTags).albumArtist)&&void 0!==u||(c.albumArtist=kT(y));break;case"©gen":this.currentTrack||null!==(h=(d=this.metadataTags).genre)&&void 0!==h||(d.genre=kT(y));break;case"©day":if(!this.currentTrack){var ut,dt;const t=new Date(kT(y));Number.isNaN(t.getTime())||null!==(dt=(ut=this.metadataTags).date)&&void 0!==dt||(ut.date=t)}break;case"©cmt":this.currentTrack||null!==(p=(f=this.metadataTags).comment)&&void 0!==p||(f.comment=kT(y));break;case"©lyr":this.currentTrack||null!==(v=(m=this.metadataTags).lyrics)&&void 0!==v||(m.lyrics=kT(y))}}}break;case"meta":{if(this.currentTrack)break;const e=0!==KT(t);this.currentMetadataKeys=new Map,e?this.readContiguousBoxes(t.slice(z,B.contentSize)):this.readContiguousBoxes(t.slice(z+4,B.contentSize-4)),this.currentMetadataKeys=null}break;case"keys":{if(!this.currentMetadataKeys)break;t.skip(4);const e=KT(t);for(let n=0;n<e;n++){const e=KT(t);t.skip(4);const i=p_.decode(UT(t,e-8));this.currentMetadataKeys.set(n+1,i)}}break;case"ilst":{if(!this.currentMetadataKeys)break;const e=this.iterateContiguousBoxes(t.slice(z,B.contentSize));for(const{boxInfo:t,slice:n}of e){var ht,ft,pt,mt,vt;let e=t.name;const i=(e.charCodeAt(0)<<24)+(e.charCodeAt(1)<<16)+(e.charCodeAt(2)<<8)+e.charCodeAt(3);this.currentMetadataKeys.has(i)&&(e=this.currentMetadataKeys.get(i));const r=wT(n);switch(null!==(ft=(ht=this.metadataTags).raw)&&void 0!==ft||(ht.raw={}),null!==(vt=(pt=this.metadataTags.raw)[mt=e])&&void 0!==vt||(pt[mt]=r),e){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!==(I=(E=this.metadataTags).albumArtist)&&void 0!==I||(E.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 gt,yt;const t=new Date(r);Number.isNaN(t.getTime())||null!==(yt=(gt=this.metadataTags).date)&&void 0!==yt||(gt.date=t)}break;case"covr":case"com.apple.quicktime.artwork":r instanceof R_?(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 bt,kt,wt,xt;const t=r.split("/"),e=Number.parseInt(t[0],10),n=t[1]&&Number.parseInt(t[1],10);Number.isInteger(e)&&e>0&&(null!==(kt=(bt=this.metadataTags).trackNumber)&&void 0!==kt||(bt.trackNumber=e)),n&&Number.isInteger(n)&&n>0&&(null!==(xt=(wt=this.metadataTags).tracksTotal)&&void 0!==xt||(wt.tracksTotal=n))}break;case"trkn":if(r instanceof Uint8Array&&r.length>=6){var _t,Tt,Et,It;const t=f_(r),e=t.getUint16(2,!1),n=t.getUint16(4,!1);e>0&&(null!==(Tt=(_t=this.metadataTags).trackNumber)&&void 0!==Tt||(_t.trackNumber=e)),n>0&&(null!==(It=(Et=this.metadataTags).tracksTotal)&&void 0!==It||(Et.tracksTotal=n))}break;case"disc":case"disk":if(r instanceof Uint8Array&&r.length>=6){var St,At,Nt,Mt;const t=f_(r),e=t.getUint16(2,!1),n=t.getUint16(4,!1);e>0&&(null!==(At=(St=this.metadataTags).discNumber)&&void 0!==At||(St.discNumber=e)),n>0&&(null!==(Mt=(Nt=this.metadataTags).discsTotal)&&void 0!==Mt||(Nt.discsTotal=n))}}}}}var Ft,Ct;return t.filePos=W,!0}}class _T{constructor(t){this.internalTrack=t,this.packetToSampleIndex=new WeakMap,this.packetToFragmentLocation=new WeakMap}getId(){return this.internalTrack.id}getNumber(){const t=this.internalTrack.demuxer,e=this.internalTrack.inputTrack.type;let n=0;for(const i of t.tracks)if(i.inputTrack.type===e&&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 t,e;const n=await this.getPacket(1/0,{metadataOnly:!0});return(null!==(t=null==n?void 0:n.timestamp)&&void 0!==t?t:0)+(null!==(e=null==n?void 0:n.duration)&&void 0!==e?e:0)}async getFirstTimestamp(){var t;const e=await this.getFirstPacket({metadataOnly:!0});return null!==(t=null==e?void 0:e.timestamp)&&void 0!==t?t:0}async getFirstPacket(t){const e=await this.fetchPacketForSampleIndex(0,t);return e||!this.internalTrack.demuxer.isFragmented?e:this.performFragmentedLookup(null,(t=>t.trackData.get(this.internalTrack.id)?{sampleIndex:0,correctSampleFound:!0}:{sampleIndex:-1,correctSampleFound:!1}),-1/0,1/0,t)}mapTimestampIntoTimescale(t){return(t=>{const e=Math.round(t);return Math.abs(t/e-1)<10*Number.EPSILON?e:t})(t*this.internalTrack.timescale)+this.internalTrack.editListOffset}async getPacket(t,e){const n=this.mapTimestampIntoTimescale(t),i=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),r=IT(i,n),o=await this.fetchPacketForSampleIndex(r,e);return CT(i)&&this.internalTrack.demuxer.isFragmented?this.performFragmentedLookup(null,(t=>{const e=t.trackData.get(this.internalTrack.id);if(!e)return{sampleIndex:-1,correctSampleFound:!1};const i=E_(e.presentationTimestamps,n,(t=>t.presentationTimestamp));return{sampleIndex:-1!==i?e.presentationTimestamps[i].sampleIndex:-1,correctSampleFound:-1!==i&&n<e.endTimestamp}}),n,n,e):o}async getNextPacket(t,e){const n=this.packetToSampleIndex.get(t);if(void 0!==n)return this.fetchPacketForSampleIndex(n+1,e);const i=this.packetToFragmentLocation.get(t);if(void 0===i)throw new Error("Packet was not created from this track.");return this.performFragmentedLookup(i.fragment,(t=>{if(t===i.fragment){const e=t.trackData.get(this.internalTrack.id);if(i.sampleIndex+1<e.samples.length)return{sampleIndex:i.sampleIndex+1,correctSampleFound:!0}}else if(t.trackData.get(this.internalTrack.id))return{sampleIndex:0,correctSampleFound:!0};return{sampleIndex:-1,correctSampleFound:!1}}),-1/0,1/0,e)}async getKeyPacket(t,e){const n=this.mapTimestampIntoTimescale(t),i=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),r=ST(i,n),o=await this.fetchPacketForSampleIndex(r,e);return CT(i)&&this.internalTrack.demuxer.isFragmented?this.performFragmentedLookup(null,(t=>{const e=t.trackData.get(this.internalTrack.id);if(!e)return{sampleIndex:-1,correctSampleFound:!1};const i=((t,e)=>{for(let n=t.length-1;n>=0;n--)if(e(t[n]))return n;return-1})(e.presentationTimestamps,(t=>e.samples[t.sampleIndex].isKeyFrame&&t.presentationTimestamp<=n));return{sampleIndex:-1!==i?e.presentationTimestamps[i].sampleIndex:-1,correctSampleFound:-1!==i&&n<e.endTimestamp}}),n,n,e):o}async getNextKeyPacket(t,e){const n=this.packetToSampleIndex.get(t);if(void 0!==n){const t=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),i=NT(t,n);return this.fetchPacketForSampleIndex(i,e)}const i=this.packetToFragmentLocation.get(t);if(void 0===i)throw new Error("Packet was not created from this track.");return this.performFragmentedLookup(i.fragment,(t=>{if(t===i.fragment){const e=t.trackData.get(this.internalTrack.id).samples.findIndex(((t,e)=>t.isKeyFrame&&e>i.sampleIndex));if(-1!==e)return{sampleIndex:e,correctSampleFound:!0}}else{const e=t.trackData.get(this.internalTrack.id);if(e&&null!==e.firstKeyFrameTimestamp){const t=e.samples.findIndex((t=>t.isKeyFrame));return c_(-1!==t),{sampleIndex:t,correctSampleFound:!0}}}return{sampleIndex:-1,correctSampleFound:!1}}),-1/0,1/0,e)}async fetchPacketForSampleIndex(t,e){if(-1===t)return null;const n=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),i=AT(n,t);if(!i)return null;let r;if(e.metadataOnly)r=aT;else{let t=this.internalTrack.demuxer.reader.requestSlice(i.sampleOffset,i.sampleSize);t instanceof Promise&&(t=await t),c_(t),r=UT(t,i.sampleSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new lT(r,i.isKeyFrame?"key":"delta",o,s,t,i.sampleSize);return this.packetToSampleIndex.set(a,t),a}async fetchPacketInFragment(t,e,n){if(-1===e)return null;const i=t.trackData.get(this.internalTrack.id).samples[e];let r;if(c_(i),n.metadataOnly)r=aT;else{let t=this.internalTrack.demuxer.reader.requestSlice(i.byteOffset,i.byteSize);t instanceof Promise&&(t=await t),c_(t),r=UT(t,i.byteSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new lT(r,i.isKeyFrame?"key":"delta",o,s,t.moofOffset+e,i.byteSize);return this.packetToFragmentLocation.set(a,{fragment:t,sampleIndex:e}),a}async performFragmentedLookup(t,e,n,i,r){var o,s;const a=this.internalTrack.demuxer;let l=null,c=null,u=-1;if(t){const{sampleIndex:n,correctSampleFound:i}=e(t);if(i)return this.fetchPacketInFragment(t,n,r);-1!==n&&(c=t,u=n)}const d=E_(this.internalTrack.fragmentLookupTable,n,(t=>t.timestamp)),h=-1!==d?this.internalTrack.fragmentLookupTable[d]:null,f=E_(this.internalTrack.fragmentPositionCache,n,(t=>t.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(t?null===m||t.moofOffset>=m?(v=t.moofOffset+t.moofSize,l=t):v=m:v=null!=m?m:0;;){if(l){const t=l.trackData.get(this.internalTrack.id);if(t&&t.startTimestamp>i)break}let t=a.reader.requestSliceRange(v,8,16);if(t instanceof Promise&&(t=await t),!t)break;const n=v,o=vT(t);if(!o)break;if("moof"===o.name){l=await a.readFragment(n);const{sampleIndex:t,correctSampleFound:i}=e(l);if(i)return this.fetchPacketInFragment(l,t,r);-1!==t&&(c=l,u=t)}v=n+o.totalSize}if(h&&(!c||c.moofOffset<h.moofOffset)){var g;const t=this.internalTrack.fragmentLookupTable[d-1];c_(!t||t.timestamp<h.timestamp);const n=null!==(g=null==t?void 0:t.timestamp)&&void 0!==g?g:-1/0;return this.performFragmentedLookup(null,e,n,i,r)}return c?this.fetchPacketInFragment(c,u,r):null}}class TT extends _T{constructor(t){super(t),this.decoderConfigPromise=null,this.internalTrack=t}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 t,e,n,i;return{primaries:null===(t=this.internalTrack.info.colorSpace)||void 0===t?void 0:t.primaries,transfer:null===(e=this.internalTrack.info.colorSpace)||void 0===e?void 0:e.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 t;return this.internalTrack.info.codec?null!==(t=this.decoderConfigPromise)&&void 0!==t?t:this.decoderConfigPromise=(async(t,e)=>{if("vp9"!==this.internalTrack.info.codec||this.internalTrack.info.vp9CodecInfo){if("av1"===this.internalTrack.info.codec&&!this.internalTrack.info.av1CodecInfo){const t=await this.getFirstPacket({});this.internalTrack.info.av1CodecInfo=t&&(t=>{for(const{type:e,data:n}of eT(t)){if(1!==e)continue;const t=new L_(n),i=t.readBits(3);t.readBits(1);const r=t.readBits(1);let o=0,s=0,a=0;if(r)o=t.readBits(5);else{if(t.readBits(1)&&(t.skipBits(32),t.skipBits(32),t.readBits(1)))return null;const e=t.readBits(1);e&&(a=t.readBits(5),t.skipBits(32),t.skipBits(5),t.skipBits(5));const n=t.readBits(5);for(let i=0;i<=n;i++){t.skipBits(12);const n=t.readBits(5);if(0===i&&(o=n),n>7){const e=t.readBits(1);0===i&&(s=e)}if(e&&t.readBits(1)){const e=a+1;t.skipBits(e),t.skipBits(e),t.skipBits(1)}t.readBits(1)&&t.skipBits(4)}}const l=t.readBits(4),c=t.readBits(4),u=l+1;t.skipBits(u);const d=c+1;t.skipBits(d);let h=0;if(h=r?0:t.readBits(1),h&&(t.skipBits(4),t.skipBits(3)),t.skipBits(1),t.skipBits(1),t.skipBits(1),!r){t.skipBits(1),t.skipBits(1),t.skipBits(1),t.skipBits(1);const e=t.readBits(1);e&&(t.skipBits(1),t.skipBits(1));let n=0;n=t.readBits(1)?2:t.readBits(1),n>0&&(t.readBits(1)||t.skipBits(1)),e&&t.skipBits(3)}t.skipBits(1),t.skipBits(1),t.skipBits(1);const f=t.readBits(1);let p=8;2===i&&f?p=t.readBits(1)?12:10:i<=2&&(p=f?10:8);let m=0;1!==i&&(m=t.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=t.readBits(1),v&&(g=t.readBits(1))),v&&g&&(y=t.readBits(2))),{profile:i,level:o,tier:s,bitDepth:p,monochrome:m,chromaSubsamplingX:v,chromaSubsamplingY:g,chromaSamplePosition:y}}return null})(t.data)}}else{const t=await this.getFirstPacket({});this.internalTrack.info.vp9CodecInfo=t&&(t=>{const e=new L_(t);if(2!==e.readBits(2))return null;const n=e.readBits(1),i=(e.readBits(1)<<1)+n;if(3===i&&e.skipBits(1),1===e.readBits(1))return null;if(0!==e.readBits(1))return null;if(e.skipBits(2),4817730!==e.readBits(24))return null;let r=8;i>=2&&(r=e.readBits(1)?12:10);const o=e.readBits(3);let s=0,a=0;if(7!==o)if(a=e.readBits(1),1===i||3===i){const t=e.readBits(1),n=e.readBits(1);s=t||n?t&&!n?2:1:3,e.skipBits(1)}else s=1;else s=3,a=1;const l=(e.readBits(16)+1)*(e.readBits(16)+1);let c=u_(j_).level;for(const t of j_)if(l<=t.maxPictureSize){c=t.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}})(t.data)}return{codec:U_(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!==(t=this.internalTrack.info.codecDescription)&&void 0!==t?t:void 0,colorSpace:null!==(e=this.internalTrack.info.colorSpace)&&void 0!==e?e:void 0}})():null}}class ET extends _T{constructor(t){super(t),this.decoderConfig=null,this.internalTrack=t}getCodec(){return this.internalTrack.info.codec}getNumberOfChannels(){return this.internalTrack.info.numberOfChannels}getSampleRate(){return this.internalTrack.info.sampleRate}async getDecoderConfig(){var t,e;return this.internalTrack.info.codec?null!==(t=this.decoderConfig)&&void 0!==t?t:this.decoderConfig={codec:q_(this.internalTrack.info),numberOfChannels:this.internalTrack.info.numberOfChannels,sampleRate:this.internalTrack.info.sampleRate,description:null!==(e=this.internalTrack.info.codecDescription)&&void 0!==e?e:void 0}:null}}const IT=(t,e)=>{if(t.presentationTimestamps){const n=E_(t.presentationTimestamps,e,(t=>t.presentationTimestamp));return-1===n?-1:t.presentationTimestamps[n].sampleIndex}{const n=E_(t.sampleTimingEntries,e,(t=>t.startDecodeTimestamp));if(-1===n)return-1;const i=t.sampleTimingEntries[n];return i.startIndex+Math.min(Math.floor((e-i.startDecodeTimestamp)/i.delta),i.count-1)}},ST=(t,e)=>{if(!t.keySampleIndices)return IT(t,e);if(t.presentationTimestamps){const n=E_(t.presentationTimestamps,e,(t=>t.presentationTimestamp));if(-1===n)return-1;for(let e=n;e>=0;e--){const n=t.presentationTimestamps[e].sampleIndex;if(-1!==T_(t.keySampleIndices,n,(t=>t)))return n}return-1}{var n;const i=IT(t,e),r=E_(t.keySampleIndices,i,(t=>t));return null!==(n=t.keySampleIndices[r])&&void 0!==n?n:-1}},AT=(t,e)=>{const n=E_(t.sampleTimingEntries,e,(t=>t.startIndex)),i=t.sampleTimingEntries[n];if(!i||i.startIndex+i.count<=e)return null;let r=i.startDecodeTimestamp+(e-i.startIndex)*i.delta;const o=E_(t.sampleCompositionTimeOffsets,e,(t=>t.startIndex)),s=t.sampleCompositionTimeOffsets[o];s&&e-s.startIndex<s.count&&(r+=s.offset);const a=t.sampleSizes[Math.min(e,t.sampleSizes.length-1)],l=E_(t.sampleToChunk,e,(t=>t.startSampleIndex)),c=t.sampleToChunk[l];c_(c);const u=c.startChunkIndex+Math.floor((e-c.startSampleIndex)/c.samplesPerChunk),d=t.chunkOffsets[u],h=c.startSampleIndex+(u-c.startChunkIndex)*c.samplesPerChunk;let f=0,p=d;if(1===t.sampleSizes.length)p+=a*(e-h),f+=a*c.samplesPerChunk;else for(let n=h;n<h+c.samplesPerChunk;n++){const i=t.sampleSizes[n];n<e&&(p+=i),f+=i}let m=i.delta;if(t.presentationTimestamps){const n=t.presentationTimestampIndexMap[e];c_(void 0!==n),n<t.presentationTimestamps.length-1&&(m=t.presentationTimestamps[n+1].presentationTimestamp-r)}return{presentationTimestamp:r,duration:m,sampleOffset:p,sampleSize:a,chunkOffset:d,chunkSize:f,isKeyFrame:!t.keySampleIndices||-1!==T_(t.keySampleIndices,e,(t=>t))}},NT=(t,e)=>{var n;if(!t.keySampleIndices)return e+1;const i=E_(t.keySampleIndices,e,(t=>t));return null!==(n=t.keySampleIndices[i+1])&&void 0!==n?n:-1},MT=(t,e)=>{t.startTimestamp+=e,t.endTimestamp+=e;for(const n of t.samples)n.presentationTimestamp+=e;for(const n of t.presentationTimestamps)n.presentationTimestamp+=e},FT=t=>{const[e,,,n]=t,i=Math.hypot(e,n),r=e/i,o=n/i,s=-Math.atan2(o,r)*(180/Math.PI);return Number.isFinite(s)?s:0},CT=t=>0===t.sampleSizes.length;class OT{}class PT extends OT{async _getMajorBrand(t){let e=t._reader.requestSlice(0,12);return e instanceof Promise&&(e=await e),e?(e.skip(4),"ftyp"!==ZT(e,4)?null:ZT(e,4)):null}_createDemuxer(t){return new xT(t)}}const RT=new class extends PT{async _canReadInput(t){const e=await this._getMajorBrand(t);return!!e&&"qt "!==e}get name(){return"MP4"}get mimeType(){return"video/mp4"}};class DT{constructor(){this._disposed=!1,this._sizePromise=null,this.onread=null}async getSizeOrNull(){var t;if(this._disposed)throw new zT;return null!==(t=this._sizePromise)&&void 0!==t?t:this._sizePromise=Promise.resolve(this._retrieveSize())}async getSize(){if(this._disposed)throw new zT;const t=await this.getSizeOrNull();if(null===t)throw new Error("Cannot determine the size of an unsized source.");return t}}class LT extends DT{constructor(t,e={}){var n;if(!(t instanceof ReadableStream))throw new TypeError("stream must be a ReadableStream.");if(!e||"object"!=typeof e)throw new TypeError("options must be an object.");if(void 0!==e.maxCacheSize&&(!P_(e.maxCacheSize)||e.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=t,this._maxCacheSize=null!==(n=e.maxCacheSize)&&void 0!==n?n:16777216}_retrieveSize(){return this._endIndex}_read(t,e){if(null!==this._endIndex&&e>this._endIndex)return null;this._maxRequestedIndex=Math.max(this._maxRequestedIndex,e);const n=E_(this._cache,t,(t=>t.start)),i=-1!==n?this._cache[n]:null;if(i&&i.start<=t&&e<=i.end)return{bytes:i.bytes,view:i.view,offset:i.start};let r=t;const o=new Uint8Array(e-t);if(-1!==n)for(let i=n;i<this._cache.length;i++){const n=this._cache[i];if(n.start>=e)break;const s=Math.max(t,n.start);s>r&&this._throwDueToCacheMiss();const a=Math.min(e,n.end);s<a&&(o.set(n.bytes.subarray(s-n.start,a-n.start),s-t),r=a)}if(r===e)return{bytes:o,view:f_(o),offset:t};this._currentIndex>r&&this._throwDueToCacheMiss();const{promise:s,resolve:a,reject:l}=I_();return this._pendingSlices.push({start:t,end:e,bytes:o,resolve:a,reject:l}),this._targetIndex=Math.max(this._targetIndex,e),this._pulling||(this._pulling=!0,this._pull().catch((t=>{if(this._pulling=!1,!(this._pendingSlices.length>0))throw t;this._pendingSlices.forEach((e=>e.reject(t))),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!==(t=this._reader)&&void 0!==t||(this._reader=this._stream.getReader());this._currentIndex<this._targetIndex&&!this._disposed;){var t;const{done:e,value:n}=await this._reader.read();if(e){for(const t of this._pendingSlices)t.resolve(null);this._pendingSlices.length=0,this._endIndex=this._currentIndex;break}const i=this._currentIndex,r=this._currentIndex+n.byteLength;for(let t=0;t<this._pendingSlices.length;t++){const e=this._pendingSlices[t],o=Math.max(i,e.start),s=Math.min(r,e.end);o<s&&(e.bytes.set(n.subarray(o-i,s-i),o-e.start),s===e.end&&(e.resolve({bytes:e.bytes,view:f_(e.bytes),offset:e.start}),this._pendingSlices.splice(t,1),t--))}for(this._cache.push({start:i,end:r,bytes:n,view:f_(n),age:0});this._cache.length>0;){const t=this._cache[0];if(this._maxRequestedIndex-t.end<=this._maxCacheSize)break;this._cache.shift()}this._currentIndex+=n.byteLength}this._pulling=!1}_dispose(){this._pendingSlices.length=0,this._cache.length=0}}null!==(le=Symbol.dispose)&&void 0!==le||(Symbol.dispose=Symbol("Symbol.dispose"));class BT{get disposed(){return this._disposed}constructor(t){if(this._demuxerPromise=null,this._format=null,this._disposed=!1,!t||"object"!=typeof t)throw new TypeError("options must be an object.");if(!Array.isArray(t.formats)||t.formats.some((t=>!(t instanceof OT))))throw new TypeError("options.formats must be an array of InputFormat.");if(!(t.source instanceof DT))throw new TypeError("options.source must be a Source.");if(t.source._disposed)throw new Error("options.source must not be disposed.");this._formats=t.formats,this._source=t.source,this._reader=new WT(t.source)}_getDemuxer(){var t;return null!==(t=this._demuxerPromise)&&void 0!==t?t:this._demuxerPromise=(async()=>{this._reader.fileSize=await this._source.getSizeOrNull();for(const t of this._formats)if(await t._canReadInput(this))return this._format=t,t._createDemuxer(this);throw new Error("Input has an unsupported or unrecognizable format.")})()}get source(){return this._source}async getFormat(){return await this._getDemuxer(),c_(this._format),this._format}async computeDuration(){return(await this._getDemuxer()).computeDuration()}async getFirstTimestamp(){const t=await this.getTracks();if(0===t.length)return 0;const e=await Promise.all(t.map((t=>t.getFirstTimestamp())));return Math.min(...e)}async getTracks(){return(await this._getDemuxer()).getTracks()}async getVideoTracks(){return(await this.getTracks()).filter((t=>t.isVideoTrack()))}async getAudioTracks(){return(await this.getTracks()).filter((t=>t.isAudioTrack()))}async getPrimaryVideoTrack(){var t;return null!==(t=(await this.getTracks()).find((t=>t.isVideoTrack())))&&void 0!==t?t:null}async getPrimaryAudioTrack(){var t;return null!==(t=(await this.getTracks()).find((t=>t.isAudioTrack())))&&void 0!==t?t: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 zT extends Error{constructor(t="Input has been disposed."){super(t),this.name="InputDisposedError"}}class WT{constructor(t){this.source=t}requestSlice(t,e){if(this.source._disposed)throw new zT;if(t<0)return null;if(null!==this.fileSize&&t+e>this.fileSize)return null;const n=t+e,i=this.source._read(t,n);return i instanceof Promise?i.then((e=>e?new $T(e.bytes,e.view,e.offset,t,n):null)):i?new $T(i.bytes,i.view,i.offset,t,n):null}requestSliceRange(t,e,n){if(this.source._disposed)throw new zT;if(t<0)return null;if(null!==this.fileSize)return this.requestSlice(t,A_(this.fileSize-t,e,n));{const i=this.requestSlice(t,n),r=i=>{if(i)return i;const r=i=>(c_(null!==i),this.requestSlice(t,A_(i-t,e,n))),o=this.source._retrieveSize();return o instanceof Promise?o.then(r):r(o)};return i instanceof Promise?i.then(r):r(i)}}}class $T{constructor(t,e,n,i,r){this.bytes=t,this.view=e,this.offset=n,this.start=i,this.end=r,this.bufferPos=i-n}static tempFromBytes(t){return new $T(t,f_(t),0,0,t.length)}get length(){return this.end-this.start}get filePos(){return this.offset+this.bufferPos}set filePos(t){this.bufferPos=t-this.offset}get remainingLength(){return Math.max(this.end-this.filePos,0)}skip(t){this.bufferPos+=t}slice(t,e=this.end-t){if(t<this.start||t+e>this.end)throw new RangeError("Slicing outside of original slice.");return new $T(this.bytes,this.view,this.offset,t,t+e)}}const jT=(t,e)=>{if(t.filePos<t.start||t.filePos+e>t.end)throw new RangeError(`Tried reading [${t.filePos}, ${t.filePos+e}), but slice is [${t.start}, ${t.end}). This is likely an internal error, please report it alongside the file that caused it.`)},UT=(t,e)=>{jT(t,e);const n=t.bytes.subarray(t.bufferPos,t.bufferPos+e);return t.bufferPos+=e,n},qT=t=>(jT(t,1),t.view.getUint8(t.bufferPos++)),VT=t=>{jT(t,2);const e=t.view.getUint16(t.bufferPos,!1);return t.bufferPos+=2,e},GT=t=>{jT(t,3);const e=S_(t.view,t.bufferPos);return t.bufferPos+=3,e},HT=t=>{jT(t,2);const e=t.view.getInt16(t.bufferPos,!1);return t.bufferPos+=2,e},KT=t=>{jT(t,4);const e=t.view.getUint32(t.bufferPos,!1);return t.bufferPos+=4,e},XT=t=>{jT(t,4);const e=t.view.getInt32(t.bufferPos,!1);return t.bufferPos+=4,e},YT=t=>4294967296*KT(t)+KT(t),QT=t=>4294967296*XT(t)+KT(t),JT=t=>{jT(t,8);const e=t.view.getFloat64(t.bufferPos,!1);return t.bufferPos+=8,e},ZT=(t,e)=>{jT(t,e);let n="";for(let i=0;i<e;i++)n+=String.fromCharCode(t.bytes[t.bufferPos++]);return n};var tE=new WeakMap,eE=new WeakMap,nE=new WeakMap,iE=new WeakMap,rE=new WeakMap,oE=new WeakMap,sE=new WeakMap,aE=new WeakMap,lE=new WeakMap,cE=new WeakMap,uE=new WeakMap,dE=new WeakMap,hE=new WeakMap,fE=new WeakMap,pE=new WeakMap,mE=new WeakSet;class vE extends sd{constructor(...t){super(...t),O(this,mE),F(this,tE,null),F(this,eE,null),F(this,nE,null),F(this,iE,null),F(this,rE,!1),F(this,oE,!1),F(this,sE,!1),F(this,aE,!1),F(this,lE,void 0),F(this,cE,null),F(this,uE,null),F(this,dE,!1),F(this,hE,!1),F(this,fE,null),F(this,pE,!1)}get name(){return"FMP4Demuxer"}get defaults(){return{}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"pushChunk","endOfStream"])}pushChunk(t,e={}){if(M(sE,this)||M(aE,this))return;const n=t instanceof Uint8Array?t:new Uint8Array(t),i=!!e.isInit;C(cE,this,A(mE,this,xE).call(this,n,e,i)),i&&(C(lE,this,n),C(uE,this,null),this.trigger("demux:init",{data:n})),A(mE,this,wE).call(this);try{var r;const t=null===(r=M(tE,this))||void 0===r?void 0:r.write(n);t&&"function"==typeof t.catch&&t.catch((t=>{A(mE,this,_E).call(this,t)}))}catch(t){if(M(sE,this)||A(mE,this,gE).call(this,t))return;return this.log.warn("[FMP4Demuxer] mediabunny demux failed",t),void A(mE,this,_E).call(this,t)}const o=A(mE,this,IE).call(this);o&&"function"==typeof o.catch&&o.catch((t=>{A(mE,this,_E).call(this,t)}))}endOfStream(){if(M(aE,this))return;if(M(dE,this))return;let t;C(dE,this,!0),C(hE,this,!1),C(pE,this,!1);try{var e;t=null===(e=M(tE,this))||void 0===e?void 0:e.close()}catch(e){t=Promise.resolve()}let n=!1;A(mE,this,bE).call(this),C(fE,this,setTimeout((()=>{C(fE,this,null),n||M(hE,this)||M(aE,this)||A(mE,this,kE).call(this)}),20)),Promise.resolve(t).catch((()=>{})).finally((()=>{n=!0,A(mE,this,bE).call(this),A(mE,this,kE).call(this)}))}onDispose(){super.onDispose(),C(aE,this,!0);try{var t,e;null===(t=M(nE,this))||void 0===t||null===(e=t.close)||void 0===e||e.call(t)}catch(t){}this.endOfStream();try{var n,i;null===(n=M(eE,this))||void 0===n||null===(i=n.dispose)||void 0===i||i.call(n)}catch(t){}C(nE,this,null),C(eE,this,null),C(sE,this,!1),C(cE,this,null),C(iE,this,null),C(rE,this,!1),C(oE,this,!1),C(dE,this,!1),C(hE,this,!1),C(pE,this,!1),A(mE,this,bE).call(this)}}function gE(t){return!!M(aE,this)&&(!t||("InputDisposedError"===(null==t?void 0:t.name)||("string"==typeof(null==t?void 0:t.message)?t.message:"").includes("Input has been disposed")))}function yE(){try{var t,e;const n=null===(t=M(tE,this))||void 0===t||null===(e=t.close)||void 0===e?void 0:e.call(t);n&&"function"==typeof n.catch&&n.catch((()=>{}))}catch(t){}C(tE,this,null)}function bE(){null!==M(fE,this)&&(clearTimeout(M(fE,this)),C(fE,this,null))}function kE(){if(M(hE,this)||M(aE,this)||M(sE,this))return;if(C(hE,this,!0),M(oE,this))return void C(pE,this,!0);C(pE,this,!1);const t=A(mE,this,IE).call(this);t&&"function"==typeof t.catch&&t.catch((t=>{A(mE,this,_E).call(this,t)}))}function wE(){if(M(eE,this)&&M(tE,this))return;const t=cd.TransformStream;if(void 0===t)throw new Error("TransformStream is not available in this environment");const{readable:e,writable:n}=new t;C(tE,this,n.getWriter()),C(eE,this,new BT({source:new LT(e),formats:[RT]})),C(rE,this,!1)}function xE(t,e,n){const i={isInit:n,byteLength:(null==t?void 0:t.byteLength)||0};return"number"==typeof e.loaded&&(i.loaded=e.loaded),"number"==typeof e.total&&(i.total=e.total),"number"==typeof e.pts&&(i.pts=e.pts),"number"==typeof e.dts&&(i.dts=e.dts),"number"==typeof e.duration&&(i.duration=e.duration),"boolean"==typeof e.isKey&&(i.isKey=e.isKey),i}function _E(t){if(M(sE,this)||A(mE,this,gE).call(this,t))return;if(A(mE,this,EE).call(this,t))return void C(rE,this,!1);C(sE,this,!0),A(mE,this,yE).call(this);try{var e,n;null===(e=M(nE,this))||void 0===e||null===(n=e.close)||void 0===n||n.call(e)}catch(t){}C(nE,this,null);try{var i,r;null===(i=M(eE,this))||void 0===i||null===(r=i.dispose)||void 0===r||r.call(i)}catch(t){}C(eE,this,null);const o={error:t,recoverable:!1,severity:"fatal",streamClosed:M(dE,this),streamFinalized:M(hE,this)};M(cE,this)&&(o.context={...M(cE,this)}),this.trigger("demux:error",o)}function TE(t){if(!t)return!1;const e="string"==typeof(null==t?void 0:t.message)?t.message:"";return!!e&&(e.includes("unsupported or unrecognizable format")||e.includes("No supported tracks found"))}function EE(t){return!!A(mE,this,TE).call(this,t)&&(!M(hE,this)||M(pE,this))}async function IE(){if(!(M(aE,this)||M(sE,this)||M(rE,this)||M(oE,this))){C(oE,this,!0);try{A(mE,this,wE).call(this);const t=await M(eE,this).getPrimaryVideoTrack(),e=t?null:await M(eE,this).getPrimaryAudioTrack(),n=t||e;if(!n)throw new Error("No supported tracks found in MP4");const i=await n.getDecoderConfig(),r=await n.getCodecParameterString(),o=await M(eE,this).getMimeType();this.trigger("demux:init",{...M(lE,this)?{data:M(lE,this)}:{},decoderConfig:i,codec:r,mimeType:o}),C(nE,this,new hT(n)),C(rE,this,!0),C(iE,this,(async()=>{try{for await(const t of M(nE,this).packets()){if(M(aE,this))break;const e="number"==typeof t.timestamp?t.timestamp:0;null===M(uE,this)&&C(uE,this,e);let n=e-M(uE,this);n<0&&(n=0),this.trigger("demux:sample",{data:t.data,pts:n,dts:n,duration:t.duration,isKey:"key"===t.type})}this.trigger("demux:complete")}catch(t){A(mE,this,_E).call(this,t)}})())}catch(t){if(A(mE,this,EE).call(this,t))return;throw t}finally{C(oE,this,!1),!M(pE,this)||M(sE,this)||M(aE,this)||A(mE,this,kE).call(this)}}}const SE=1e6,AE=24e3/1001,NE={primaries:"bt709",transfer:"bt709",matrix:"bt709",fullRange:!0},ME=new Uint8Array;function FE(t){return t?t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):ME:ME}let CE=null;const OE={video:(ce=new WeakMap,ue=new WeakMap,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,Ee=new WeakMap,Ie=new WeakMap,Se=new WeakMap,Ae=new WeakMap,Ne=new WeakMap,Me=new WeakMap,Fe=new WeakMap,Ce=new WeakMap,Oe=new WeakMap,Pe=new WeakMap,Re=new WeakMap,De=new WeakMap,Le=new WeakMap,Be=new WeakMap,ze=new WeakMap,We=new WeakMap,$e=new WeakMap,je=new WeakMap,Ue=new WeakSet,class extends l_{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(...t){super(...t),O(this,Ue),F(this,ce,void 0),F(this,ue,[]),F(this,de,void 0),F(this,he,void 0),F(this,fe,void 0),F(this,pe,void 0),F(this,me,[]),F(this,ve,void 0),F(this,ge,new Map),F(this,ye,!0),F(this,be,!1),F(this,ke,!1),F(this,we,!1),F(this,xe,void 0),F(this,_e,!1),F(this,Te,!1),F(this,Ee,0),F(this,Ie,void 0),F(this,Se,void 0),F(this,Ae,{}),F(this,Ne,void 0),F(this,Me,0),F(this,Fe,null),F(this,Ce,!1),F(this,Oe,null),F(this,Pe,void 0),F(this,Re,0),F(this,De,0),F(this,Le,0),F(this,Be,0),F(this,ze,!1),F(this,We,!1),F(this,$e,.2),F(this,je,Promise.resolve()),C(de,this,this.settings.decodedHorizonSeconds||1),C(he,this,A(Ue,this,TI).call(this,this.settings.maxDecodedFrames)),C(fe,this,A(Ue,this,II).call(this,this.settings.maxDecodeQueueSize)),C(ze,this,mv()),C(We,this,A(Ue,this,vI).call(this,this.settings.convertFramesToBitmapsOnAndroid)),C($e,this,A(Ue,this,gI).call(this,this.settings.androidFixEndOfSegmentDelta)),C(pe,this,(()=>0)),C(ve,this,(()=>A(Ue,this,sI).call(this)));const e=this.settings.demuxerOptions?{FMP4Demuxer:this.settings.demuxerOptions}:{};C(ce,this,new vE(e)),M(ce,this).on("demux:init",(t=>A(Ue,this,YE).call(this,t))),M(ce,this).on("demux:sample",(t=>A(Ue,this,QE).call(this,t))),M(ce,this).on("demux:complete",(()=>A(Ue,this,JE).call(this))),M(ce,this).on("demux:error",(t=>A(Ue,this,zE).call(this,t)))}setCurrentTimeProvider(t){"function"==typeof t&&C(pe,this,t)}setTimeOffsetSeconds(t){const e=Number(t);C(Me,this,Number.isFinite(e)?e:0)}setSeekTargetTimeSeconds(t){const e=Number(t);C(Fe,this,Number.isFinite(e)?e:null),C(Ce,this,!1),C(Oe,this,null)}endOfStream(){M(ce,this)&&"function"==typeof M(ce,this).endOfStream&&M(ce,this).endOfStream()}configure(t){super.configure(t),C(Ae,this,{codec:A(Ue,this,FI).call(this,t),width:(null==t?void 0:t.codedWidth)||(null==t?void 0:t.width),height:(null==t?void 0:t.codedHeight)||(null==t?void 0:t.height)}),C(Ie,this,M(Ae,this).codec)}setSegment(t){this.lastSegment=t,A(Ue,this,GE).call(this)}setNodeId(t){C(Pe,this,t)}decode(t){this.setSegment(t);const e=null==t?void 0:t.arrayBuffer;e&&M(ce,this).pushChunk(e,{isInit:!(null==t||!t.isInit)})}async decodeChunk(t,e={}){await M(ce,this).pushChunk(t,{isInit:!!e.isInit,pts:"number"==typeof e.pts?e.pts:void 0,dts:"number"==typeof e.dts?e.dts:void 0,duration:"number"==typeof e.duration?e.duration:void 0,isKey:!!e.isKey,loaded:"number"==typeof e.loaded?e.loaded:void 0,total:"number"==typeof e.total?e.total:void 0})}get decodedFrames(){return M(ue,this).slice()}onDispose(){if(super.onDispose(),A(Ue,this,cI).call(this),M(ce,this)&&"function"==typeof M(ce,this).dispose&&M(ce,this).dispose(),C(ue,this,[]),C(me,this,[]),M(ge,this).clear(),C(Oe,this,null),M(xe,this)&&"function"==typeof M(xe,this).close)try{M(xe,this).close()}catch(t){}C(xe,this,null),C(_e,this,!1),C(Se,this,null),C(Ie,this,null),C(Pe,this,null),C(je,this,Promise.resolve()),A(Ue,this,GE).call(this)}}),audio:(qe=new WeakMap,Ve=new WeakMap,Ge=new WeakMap,He=new WeakMap,Ke=new WeakMap,Xe=new WeakMap,Ye=new WeakMap,Qe=new WeakSet,class extends l_{constructor(...t){super(...t),O(this,Qe),F(this,qe,void 0),F(this,Ve,[]),F(this,Ge,0),F(this,He,!1),F(this,Ke,!1),F(this,Xe,void 0),F(this,Ye,0)}get name(){return"WebAudioDecoder"}setSegment(t){C(Xe,this,t)}setTimeOffsetSeconds(t){const e=Number(t);C(Ye,this,Number.isFinite(e)?e:0)}decode(t){if(this.lastSegment=t,!t)return;if(t.isInit)return void C(qe,this,FE(t.arrayBuffer));const e=t.arrayBuffer;e&&A(Qe,this,DE).call(this,FE(e),!0)}decodeChunk(t,e={}){if(!t)return;if(e.isInit)return void C(qe,this,FE(t));const n=FE(t);if(!n.length)return;M(Ve,this).push(n),C(Ge,this,M(Ge,this)+n.length);const i=Number(e.loaded),r=Number(e.total);Number.isFinite(i)&&Number.isFinite(r)&&r>0&&i>=r&&A(Qe,this,PE).call(this)}endOfStream(){A(Qe,this,PE).call(this)}onDispose(){super.onDispose(),C(qe,this,void 0),C(Ve,this,[]),C(Ge,this,0),C(He,this,!1),C(Ke,this,!1),C(Xe,this,void 0)}}),image:class extends l_{#D;#L=0;#B=[];#z=0;#W;get name(){return"ImageDecoder"}setSegment(t){this.#D=t}setTimeOffsetSeconds(t){const e=Number(t);this.#L=Number.isFinite(e)?e:0}decode(t){super.decode(t),t&&(this.#D=t);const e=null==t?void 0:t.arrayBuffer;e instanceof ArrayBuffer&&(this.#B=[new Uint8Array(e)],this.#z=e.byteLength,this.endOfStream())}decodeChunk(t,e={}){if(null!=e&&e.isInit)return;const n=function(t){if(t)return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):ArrayBuffer.isView(t)&&t.buffer?new Uint8Array(t.buffer):void 0}(t);n&&n.length&&(this.#B.push(n),this.#z+=n.length)}async endOfStream(){var t,e,n;if(this.#W)return;if(!(this.#B.length&&this.#z>0))return;const i=new Uint8Array(this.#z);let r=0;for(let t=0;t<this.#B.length;t+=1){const e=this.#B[t];i.set(e,r),r+=e.length}const o=null===(t=this.#D)||void 0===t?void 0:t.chosenRepresentation,s=(null==o?void 0:o.mime)||(null===(e=this.track)||void 0===e?void 0:e.mimeType)||(null===(n=this.track)||void 0===n?void 0:n.mime)||function(t){if(t instanceof Uint8Array&&!(t.byteLength<4))return t.byteLength>=8&&137===t[0]&&80===t[1]&&78===t[2]&&71===t[3]&&13===t[4]&&10===t[5]&&26===t[6]&&10===t[7]?"image/png":255===t[0]&&216===t[1]&&255===t[2]?"image/jpeg":t.byteLength>=6&&71===t[0]&&73===t[1]&&70===t[2]&&56===t[3]?"image/gif":t.byteLength>=12&&82===t[0]&&73===t[1]&&70===t[2]&&70===t[3]&&87===t[8]&&69===t[9]&&66===t[10]&&80===t[11]?"image/webp":void 0}(i);try{var a,l;const t=await async function(t,e){const n=function(t,e){if(!(t&&t.byteLength>0))return;if("function"!=typeof cd.Blob)return;const n="string"==typeof e?e:"";return new cd.Blob([t],n?{type:n}:void 0)}(t,e);if(!n)throw new Error("Image decode requires Blob support");let i;if("function"==typeof cd.Image&&cd.URL&&"function"==typeof cd.URL.createObjectURL&&"function"==typeof cd.URL.revokeObjectURL){const t=cd.URL.createObjectURL(n);try{const e=new cd.Image;return await new Promise(((n,i)=>{e.onload=()=>n(),e.onerror=t=>i(t||new Error("Image decode failed")),e.src=t})),e}catch(t){i=t}finally{cd.URL.revokeObjectURL(t)}}if("function"==typeof cd.createImageBitmap)try{return cd.createImageBitmap(n)}catch(t){i=t}if(i)throw i;throw new Error("No supported image decode mechanism")}(i,s);this.#W=t;const e=function(t){if(!t)return;const e=[[t.naturalWidth,t.naturalHeight],[t.width,t.height],[t.displayWidth,t.displayHeight],[t.videoWidth,t.videoHeight],[t.codedWidth,t.codedHeight]];for(let t=0;t<e.length;t+=1){const[n,i]=e[t],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}(t);e&&o&&(oy(o.width)||(o.width=e.width),oy(o.height)||(o.height=e.height)),this.trigger("decoder:frame",{pts:this.#L,duration:oy(null===(a=this.#D)||void 0===a?void 0:a.duration)?this.#D.duration:null===(l=this.track)||void 0===l?void 0:l.duration,frame:t})}catch(t){this.trigger("decoder:error",{error:t})}}onDispose(){if(super.onDispose(),this.#W&&"function"==typeof this.#W.close)try{this.#W.close()}catch(t){}this.#W=null,this.#B=[],this.#z=0,this.#D=null}}};function PE(){if(M(He,this)||M(Ke,this))return;if(!M(Ge,this))return;const t=A(Qe,this,RE).call(this);t.length&&A(Qe,this,DE).call(this,t,!1)}function RE(){const t=M(qe,this),e=t?t.length:0,n=e+M(Ge,this);if(!n)return ME;const i=new Uint8Array(n);let r=0;e&&(i.set(t,r),r+=e);for(let t=0;t<M(Ve,this).length;t+=1){const e=M(Ve,this)[t];e&&e.length&&(i.set(e,r),r+=e.length)}return i}function DE(t,e){if(M(He,this)||M(Ke,this))return;const n=e?A(Qe,this,LE).call(this,t):t;if(!n||!n.length)return;const i=function(){if(CE)return CE;const t=cd.AudioContext||cd.webkitAudioContext;return t?(CE=new t,CE):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(Ke,this,!0),new Promise(((t,e)=>{const n=i.decodeAudioData(r,t,e);n&&"function"==typeof n.then&&n.then(t).catch(e)})).then((t=>{var e;C(He,this,!0);const n=Number.isFinite(null==t?void 0:t.duration)?t.duration:Number(null===(e=M(Xe,this))||void 0===e?void 0:e.duration)||void 0;this.trigger("decoder:audio",{audioBuffer:t,pts:M(Ye,this),duration:n})})).catch((t=>{this.trigger("decoder:error",{error:t})})).finally((()=>{C(Ve,this,[]),C(Ge,this,0),C(Ke,this,!1)}))}function LE(t){const e=M(qe,this);if(!e||!e.length)return t;const n=e.length+t.length,i=new Uint8Array(n);return i.set(e,0),i.set(t,e.length),i}function BE(t,e){var n,i,r,o,s;const a=null!=t&&t.context&&"object"==typeof t.context?t.context:void 0;return{error:e,errorName:null==e?void 0:e.name,errorMessage:"string"==typeof(null==e?void 0:e.message)?e.message:void 0,nodeId:M(Pe,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(Ae,this))||void 0===r?void 0:r.codec)||M(Ie,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 zE(t){const e=(null==t?void 0:t.error)||t,n=A(Ue,this,BE).call(this,t,e);if(A(Ue,this,WE).call(this,t,e))return this.log.warn("[onDemuxError] recoverable demux error",n),void A(Ue,this,JE).call(this);const i=A(Ue,this,XE).call(this,t),r=A(Ue,this,$E).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(Ue,this,JE).call(this);let o=n;i&&(o={...n,missingFrameStats:i}),this.log.warn(`[onDemuxError] demux error${r}`,o),this.trigger("decoder:error",t)}function WE(t,e){if("boolean"==typeof(null==t?void 0:t.recoverable))return t.recoverable;const n="string"==typeof(null==t?void 0:t.severity)?t.severity:"";if(n)return"recoverable"===n||"transient"===n;const i="string"==typeof(null==e?void 0:e.message)?e.message:"";return!!i&&(i.includes("unsupported or unrecognizable format")||i.includes("No supported tracks found"))}function $E(t){return t?` expectedFrames=${A(Ue,this,jE).call(this,t.expectedFrames)} demuxedFrames=${A(Ue,this,jE).call(this,t.demuxedFrames)} missingFrames=${A(Ue,this,jE).call(this,t.missingFrames)}`:""}function jE(t){if(null==t)return"unknown";const e=Number(t);return Number.isFinite(e)?String(e):"unknown"}function UE(t,e={}){return{expectedFrames:null,demuxedFrames:M(Re,this),missingFrames:null,reason:t,...e}}function qE(t){const e=Number(t);return Number.isFinite(e)?e:null}function VE(t){var e,n;const i=(null==t?void 0:t.context)||{},r=Number(i.loaded),o=Number(i.total);if(!Number.isFinite(o)||o<=0||!Number.isFinite(r)||r<o)return null;if(null!==(e=this.lastSegment)&&void 0!==e&&e.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(Ue,this,UE).call(this,"segment_duration_unavailable",{segmentDurationSeconds:A(Ue,this,qE).call(this,s),demuxedCoverageSeconds:M(Be,this),frameDurationSeconds:null});const a=A(Ue,this,KE).call(this);if(!Number.isFinite(a)||a<=0){const t=Math.max(1,Math.round(s*AE));return{expectedFrames:t,demuxedFrames:M(Re,this),missingFrames:Math.max(0,t-M(Re,this)),reason:"fallback_fps",fallbackFps:AE,segmentDurationSeconds:s,demuxedCoverageSeconds:M(Be,this),frameDurationSeconds:A(Ue,this,qE).call(this,a)}}const l=Math.min(.5*a,.02),c=Math.max(0,s-M(Be,this)),u=c<=l?0:c,d=Math.max(1,Math.floor((s+l)/a)),h=Math.max(0,d-M(Re,this)),f=u>0?Math.ceil(u/a):0;return{expectedFrames:d,demuxedFrames:M(Re,this),missingFrames:Math.max(h,f),segmentDurationSeconds:s,demuxedCoverageSeconds:M(Be,this),frameDurationSeconds:a}}function GE(){C(Re,this,0),C(De,this,0),C(Le,this,0),C(Be,this,0)}function HE(t){C(Re,this,M(Re,this)+1);const e=Number(null==t?void 0:t.pts),n=Number(null==t?void 0:t.duration);if(Number.isFinite(n)&&n>0&&(C(De,this,M(De,this)+n),C(Le,this,M(Le,this)+1)),!Number.isFinite(e))return;const i=Number.isFinite(n)&&n>0?e+n:e;Number.isFinite(i)&&i>M(Be,this)&&C(Be,this,i)}function KE(){return M(Le,this)>0?M(De,this)/M(Le,this):M(Re,this)>0&&M(Be,this)>0?M(Be,this)/M(Re,this):null}function XE(t){return A(Ue,this,VE).call(this,t)}function YE(t){(null==t?void 0:t.data)instanceof Uint8Array&&(C(Se,this,t.data.buffer),A(Ue,this,dI).call(this)),null!=t&&t.decoderConfig&&(C(Ne,this,t.decoderConfig),C(Ie,this,t.decoderConfig.codec||M(Ie,this)),A(Ue,this,dI).call(this)),this.trigger("decoder:init",t)}function QE(t){A(Ue,this,HE).call(this,t),M(me,this).push(t),A(Ue,this,sI).call(this)}function JE(){C(be,this,!0),A(Ue,this,fI).call(this)}function ZE(t){const e="number"==typeof(null==t?void 0:t.pts)?t.pts:void 0;if(Number.isFinite(e))return M(Me,this)+e}function tI(t){return M(me,this).some((e=>{const n=A(Ue,this,ZE).call(this,e);return Number.isFinite(n)&&n>=t}))}function eI(t){let e=-1,n=null;for(let i=0;i<M(me,this).length;i+=1){const r=M(me,this)[i],o=A(Ue,this,ZE).call(this,r);Number.isFinite(o)&&(null==r?void 0:r.isKey)&&o<=t&&(e=i,n=o)}return{chosenIndex:e,chosenPtsSeconds:n}}function nI(t){let e=-1,n=null;for(let i=0;i<M(me,this).length;i+=1){const r=M(me,this)[i],o=A(Ue,this,ZE).call(this,r);if(Number.isFinite(o)&&null!=r&&r.isKey&&(e=i,n=o,o>=t))break}return{chosenIndex:e,chosenPtsSeconds:n}}function iI(t){const e=t+M(de,this),n=M(Fe,this);if(!Number.isFinite(n))return e;const i=Number.isFinite(M(Oe,this))?M(Oe,this):null;if(Number.isFinite(i))return Math.max(e,i);const{chosenPtsSeconds:r}=A(Ue,this,nI).call(this,n);return Number.isFinite(r)?Math.max(e,r):e}function rI(t){const e=M(Fe,this);Number.isFinite(e)&&Number.isFinite(t)&&t>=e&&(C(Fe,this,null),C(Oe,this,null))}function oI(){const t=M(Fe,this);if(!Number.isFinite(t)||M(Ce,this))return!0;if(!A(Ue,this,tI).call(this,t)&&!M(be,this))return!1;const e=A(Ue,this,eI).call(this,t);let n=e;if(-1===e.chosenIndex&&(n=A(Ue,this,nI).call(this,t)),n.chosenIndex>0){const t=`[#maybeAlignToSeekKeyframe] Dropping ${n.chosenIndex} samples before keyframe @ ${n.chosenPtsSeconds}`;this.log.debug(t),M(me,this).splice(0,n.chosenIndex)}return C(ye,this,!0),Number.isFinite(n.chosenPtsSeconds)&&C(Oe,this,n.chosenPtsSeconds),C(Ce,this,!0),!0}function sI(){const t=M(pe,this)?M(pe,this).call(this):0,e=A(Ue,this,iI).call(this,t);if(A(Ue,this,xI).call(this,t),A(Ue,this,_I).call(this),!A(Ue,this,oI).call(this))return void A(Ue,this,lI).call(this);const n=void 0!==cd.VideoDecoder&&void 0!==cd.EncodedVideoChunk;for(n&&!M(_e,this)&&M(Ne,this)&&A(Ue,this,dI).call(this);M(me,this).length&&!A(Ue,this,EI).call(this)&&!(n&&M(xe,this)&&A(Ue,this,SI).call(this));){const t=M(me,this)[0],i="number"==typeof(null==t?void 0:t.pts)?t.pts:0,r=M(Me,this)+i;if(r>e)break;if(null!=t&&t.raw)M(me,this).shift(),A(Ue,this,aI).call(this,t);else{if(n){if(!M(_e,this)||!M(xe,this))break;if(M(ye,this)&&!t.isKey){M(me,this).shift();continue}M(me,this).shift();const e=Math.max(0,Math.round(r*SE));M(ge,this).set(e,!!t.isKey);try{const n=new cd.EncodedVideoChunk({type:t.isKey?"key":"delta",timestamp:e,duration:t.duration?Math.round(t.duration*SE):void 0,data:t.data instanceof Uint8Array?t.data:new Uint8Array(t.data)});M(xe,this).decode(n),t.isKey&&C(ye,this,!1);continue}catch(t){M(ge,this).delete(e);const n="string"==typeof(null==t?void 0:t.message)?t.message:"";if("DataError"===(null==t?void 0:t.name)&&n.includes("key frame")){C(ye,this,!0);continue}this.log.warn("[#drainDecodeQueue] decode failed, falling back to placeholder",t)}}M(me,this).shift(),A(Ue,this,aI).call(this,t)}}A(Ue,this,fI).call(this),A(Ue,this,lI).call(this)}function aI(t){const e=M(pe,this)?M(pe,this).call(this):0,n=A(Ue,this,iI).call(this,e),i=M(Me,this)+("number"==typeof t.pts?t.pts:0);if(i<e||i>n)return;A(Ue,this,xI).call(this,e);const r={pts:i,duration:t.duration,data:t.data,isKey:t.isKey};M(ue,this).push(r),A(Ue,this,_I).call(this),this.trigger("decoder:frame",r),A(Ue,this,rI).call(this,i)}function lI(){if(M(me,this).length>0&&void 0!==cd.VideoDecoder){if(vw(M(ve,this)))return;pw(M(ve,this),50)}else A(Ue,this,cI).call(this)}function cI(){M(ve,this)&&vw(M(ve,this))&&mw(M(ve,this))}function uI(){return null!=cd&&cd.performance&&"function"==typeof cd.performance.now?cd.performance.now():Date.now()}function dI(){if(M(_e,this))return;if(void 0===cd.VideoDecoder)return;if(!M(Ne,this))return;if(M(Te,this)&&A(Ue,this,uI).call(this)<M(Ee,this))return;const t=A(Ue,this,hI).call(this);try{C(xe,this,new cd.VideoDecoder({output:t=>A(Ue,this,mI).call(this,t),error:t=>A(Ue,this,pI).call(this,t)})),M(xe,this).configure(t),C(_e,this,!0),C(ye,this,!0),C(Te,this,!1),C(Ee,this,0),A(Ue,this,sI).call(this)}catch(t){this.log.warn("[#maybeConfigureDecoder] configure failed, falling back to placeholder decode",t),C(xe,this,null),C(_e,this,!1),C(Ne,this,null)}}function hI(){const t={...M(Ne,this)};return A(Ue,this,NI).call(this,t)&&M(Ae,this).codec?t.codec=M(Ae,this).codec:!t.codec&&M(Ie,this)&&(t.codec=M(Ie,this)),M(Se,this)&&!t.description&&(t.description=M(Se,this)),M(Ae,this).width&&!t.codedWidth&&(t.codedWidth=M(Ae,this).width),M(Ae,this).height&&!t.codedHeight&&(t.codedHeight=M(Ae,this).height),A(Ue,this,MI).call(this,t),t}function fI(){void 0!==cd.VideoDecoder&&void 0!==cd.EncodedVideoChunk&&(M(Te,this)||!M(be,this)||M(we,this)||M(ke,this)||M(_e,this)&&M(xe,this)&&"function"==typeof M(xe,this).flush&&(M(me,this).length||(C(ke,this,!0),Promise.resolve().then((()=>M(xe,this).flush())).then((()=>{C(we,this,!0),C(ye,this,!0)})).catch((t=>{"AbortError"!==(null==t?void 0:t.name)&&this.log.warn("[#maybeFlushDecoder] flush failed",t)})).finally((()=>{C(ke,this,!1)})))))}function pI(t){if(this.log.warn("[#handleDecoderError] decoder error",t),this.trigger("decoder:error",{error:t}),M(xe,this)&&"function"==typeof M(xe,this).close)try{M(xe,this).close()}catch(t){}C(xe,this,null),C(_e,this,!1),C(ke,this,!1),C(we,this,!1),C(ye,this,!0),M(ge,this).clear(),C(Te,this,!0),C(Ee,this,A(Ue,this,uI).call(this)+1e3)}function mI(t){C(je,this,M(je,this).then((()=>{var e;if(!this._disposed)return A(Ue,this,wI).call(this,t);null===(e=t.close)||void 0===e||e.call(t)})).catch((e=>{this.log.warn("[#enqueueDecodedFrame] failed processing decoded frame",e);try{var n;null===(n=t.close)||void 0===n||n.call(t)}catch(t){}})))}function vI(t){return"boolean"!=typeof t||t}function gI(t){const e=Number(t);return!Number.isFinite(e)||e<0?.2:e}function yI(){return!!M(We,this)&&"function"==typeof cd.createImageBitmap&&M(ze,this)}function bI(t){var e;const n=Number(null===(e=this.lastSegment)||void 0===e?void 0:e.duration);if(!Number.isFinite(n)||n<=0)return!1;if(!Number.isFinite(t))return!1;const i=Number(M(Me,this));return!!Number.isFinite(i)&&t>=i+n-M($e,this)}async function kI(t,e){try{var n;const i=A(Ue,this,bI).call(this,e),r=await cd.createImageBitmap(t,{premultiplyAlpha:i?"none":"default"});return null!==(n=t.close)&&void 0!==n&&n.call(t),r}catch(e){return this.log.debug("[#maybeConvertFrameToBitmap] createImageBitmap failed",e),t}}async function wI(t){var e,n;let i=t;if(this._disposed)return void(null===(e=(n=i).close)||void 0===e||e.call(n));const r="number"==typeof t.timestamp?t.timestamp:void 0,o="number"==typeof t.timestamp?t.timestamp/SE:M(pe,this)?M(pe,this).call(this):0,s="number"==typeof t.duration?t.duration/SE:void 0;let a;void 0!==r&&(a=M(ge,this).get(r),M(ge,this).delete(r));try{var l,c,u,d;let e=M(pe,this)?M(pe,this).call(this):0,n=A(Ue,this,iI).call(this,e);if(o<e||o>n)return void(null===(l=(c=i).close)||void 0===l||l.call(c));if(A(Ue,this,yI).call(this)){var h,f,p,m;if(i=await A(Ue,this,kI).call(this,t,o),this._disposed)return void(null===(h=(f=i).close)||void 0===h||h.call(f));if(e=M(pe,this)?M(pe,this).call(this):0,n=A(Ue,this,iI).call(this,e),o<e||o>n)return void(null===(p=(m=i).close)||void 0===p||p.call(m))}if(A(Ue,this,xI).call(this,e),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(ue,this).push(r),A(Ue,this,_I).call(this),this.trigger("decoder:frame",r),A(Ue,this,rI).call(this,o),this.log.debug(`[#handleDecodedFrame] [${M(Ae,this).codec}] Decoded frame:`,r)}catch(t){this.log.warn(`[#handleDecodedFrame] [${M(Ae,this).codec}] Failed to handle decoded frame`,t);try{var v,g;null===(v=(g=i).close)||void 0===v||v.call(g)}catch(t){}}}function xI(t){const e=A(Ue,this,iI).call(this,t),n=[];M(ue,this).forEach((i=>{var r;const o=null!==(r=null==i?void 0:i.pts)&&void 0!==r?r:0;o<t||o>e||n.push(i)})),C(ue,this,n)}function _I(){const t=M(he,this);if(!Number.isFinite(t)||t<=0)return;if(M(ue,this).length<=t)return;const e=M(ue,this).length-t;M(ue,this).splice(0,e)}function TI(t){const e=Number(t);return!Number.isFinite(e)||e<=0?0:Math.floor(e)}function EI(){const t=M(he,this);return!(!Number.isFinite(t)||t<=0)&&M(ue,this).length>=t}function II(t){const e=Number(t);return!Number.isFinite(e)||e<=0?0:Math.floor(e)}function SI(){var t;const e=M(fe,this);if(!Number.isFinite(e)||e<=0)return!1;const n=Number(null===(t=M(xe,this))||void 0===t?void 0:t.decodeQueueSize);return!!Number.isFinite(n)&&n>=e}function AI(t){return"string"==typeof t&&t.toLowerCase().startsWith("av01")}function NI(t){var e;return!1!==this.settings.av1ColorSpaceOverrideEnabled&&A(Ue,this,AI).call(this,(null===(e=M(Ae,this))||void 0===e?void 0:e.codec)||(null==t?void 0:t.codec))}function MI(t){A(Ue,this,NI).call(this,t)&&(t.colorSpace={...NE})}function FI(t){if(t&&Array.isArray(t.segments))for(let e=0;e<t.segments.length;e+=1){const n=t.segments[e];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 CI extends sd{#$;get name(){return"DecoderFactory"}constructor(...t){super(...t);const e=t.length?t[t.length-1]:void 0;this.#$=e&&"object"==typeof e&&!Array.isArray(e)?e:{}}create(t,e=this.#$){if(!t||!t.type)return new l_(e);const n=OE[t.type];return n?(this.log.debug(`[#create] [${t.type}] Creating decoder:`,n),new n(e)):new l_(e)}}class OI{#j;#U;#q;#V;constructor(t={}){this.#j=t.getActiveRenderPlacement,this.#U=t.getPlacementsActiveAtTime,this.#q=t.ensureDecodedForPlacementAtTime;const e=Number(t.lookaheadSeconds);this.#V=Number.isFinite(e)&&e>=0?e:1}handleTimeUpdate(t={}){const e=Number(null==t?void 0:t.time);if(!Number.isFinite(e))return;if("function"!=typeof this.#q)return;const n="function"==typeof this.#U?this.#U:()=>[],i=n(e),r=new Set;i.forEach((t=>{null!=t&&t.placementId&&r.add(t.placementId),this.#q(t,e)}));const o=this.#V;if(!(o>0))return;const s=e+o;n(s).forEach((t=>{const e=null==t?void 0:t.placementId;e&&!r.has(e)&&this.#q(t,s)}))}dispose(){}}class PI{#G;#H;#K;#X;#Y;#Q;constructor(t={}){this.#G=t.getNode,this.#H=t.getPlacementState,this.#K=t.getDecodeTracks,this.#X=t.getSegmentIdForTrackAtTime,this.#Y=t.decodeLoadedMediaSegment,this.#Q=t.decodeLoadedMediaSegmentsAfter}ensureDecodedForPlacementAtTime(t,e){if(!t||!Number.isFinite(e))return;const n=null==t?void 0:t.placementId,i=null==t?void 0:t.nodeId;if(!n||!i)return;const r="function"==typeof this.#G?this.#G(i):void 0;if(!r)return;const o="function"==typeof this.#H?this.#H(n):void 0,s=null==o?void 0:o.trackStates;s&&"function"==typeof s.get&&("function"==typeof this.#K?this.#K(r).filter((t=>"video"===(null==t?void 0:t.type)||"image"===(null==t?void 0:t.type)||"audio"===(null==t?void 0:t.type))):[]).forEach((n=>{var i;const r=s.get(n.id);if(!r)return;const o="function"==typeof this.#X?this.#X(n,t,e):null;if(!o)return;const a=null==n||null===(i=n.segments)||void 0===i?void 0:i.find((t=>(null==t?void 0:t.id)===o));a&&!a.isInit&&a.retainedByteLength>0&&a.arrayBuffer&&(r.segmentDecoders&&"function"==typeof r.segmentDecoders.has&&r.segmentDecoders.has(o)||"function"!=typeof this.#Y||this.#Y(t,n,a),"video"===(null==n?void 0:n.type)&&"function"==typeof this.#Q&&this.#Q(t,n,a))}))}dispose(){}}const RI=new Set(["video","audio","image"]);function DI(t){const e=Number(t);return Number.isFinite(e)?e:0}var LI=new WeakMap,BI=new WeakMap,zI=new WeakMap,WI=new WeakMap,$I=new WeakMap,jI=new WeakMap,UI=new WeakMap,qI=new WeakMap,VI=new WeakMap,GI=new WeakMap,HI=new WeakMap,KI=new WeakMap,XI=new WeakMap,YI=new WeakMap,QI=new WeakMap,JI=new WeakMap,ZI=new WeakMap,tS=new WeakMap,eS=new WeakMap,nS=new WeakSet;class iS extends sd{constructor(...t){super(...t),O(this,nS),F(this,LI,void 0),F(this,BI,void 0),F(this,zI,void 0),F(this,WI,void 0),F(this,$I,void 0),F(this,jI,void 0),F(this,UI,void 0),F(this,qI,void 0),F(this,VI,void 0),F(this,GI,void 0),F(this,HI,void 0),F(this,KI,new Map),F(this,XI,new Map),F(this,YI,new Map),F(this,QI,new Map),F(this,JI,new Set),F(this,ZI,0),F(this,tS,!1),F(this,eS,null);const[e,n,i]=t;C(LI,this,e),C(BI,this,n),C(zI,this,i||new CI),C(WI,this,new PI({getNode:t=>A(nS,this,AS).call(this,t),getPlacementState:t=>M(KI,this).get(t),getDecodeTracks:t=>A(nS,this,_S).call(this,t),getSegmentIdForTrackAtTime:(t,e,n)=>A(nS,this,dS).call(this,t,e,n),decodeLoadedMediaSegment:(t,e,n)=>{A(nS,this,KS).call(this,t,e,n)},decodeLoadedMediaSegmentsAfter:(t,e,n)=>{A(nS,this,WS).call(this,t,e,n)}})),C($I,this,new OI({getActiveRenderPlacement:t=>{var e,n;return null===(e=M(BI,this))||void 0===e||null===(n=e.getActiveRenderPlacement)||void 0===n?void 0:n.call(e,t)},getPlacementsActiveAtTime:t=>{var e,n;return(null===(e=M(BI,this))||void 0===e||null===(n=e.getPlacementsActiveAtTime)||void 0===n?void 0:n.call(e,t))||[]},ensureDecodedForPlacementAtTime:(t,e)=>{var n,i;null===(n=M(WI,this))||void 0===n||null===(i=n.ensureDecodedForPlacementAtTime)||void 0===i||i.call(n,t,e)}})),A(nS,this,rS).call(this),A(nS,this,kS).call(this)}get name(){return"DecodeCoordinator"}onDispose(){var t,e;M(BI,this)&&"function"==typeof M(BI,this).off&&M(jI,this)&&M(BI,this).off(dd.PLACEMENT_ADDED,M(jI,this)),M(BI,this)&&"function"==typeof M(BI,this).off&&M(UI,this)&&M(BI,this).off(dd.TIMELINE_SEEKING,M(UI,this)),M(BI,this)&&"function"==typeof M(BI,this).off&&M(qI,this)&&M(BI,this).off(dd.TIMELINE_SEEKED,M(qI,this)),M(BI,this)&&"function"==typeof M(BI,this).off&&M(VI,this)&&M(BI,this).off(dd.TIMELINE_TIME_UPDATE,M(VI,this)),M(BI,this)&&"function"==typeof M(BI,this).off&&M(GI,this)&&M(BI,this).off(dd.TIMELINE_RESET,M(GI,this)),A(nS,this,oS).call(this),C(jI,this,null),C(UI,this,null),C(qI,this,null),C(VI,this,null),C(GI,this,null),null!==(t=M(WI,this))&&void 0!==t&&null!==(e=t.dispose)&&void 0!==e&&e.call(t),C(WI,this,null),M($I,this)&&"function"==typeof M($I,this).dispose&&M($I,this).dispose(),C($I,this,null),M(XI,this).forEach(((t,e)=>{const n=A(nS,this,AS).call(this,e);n&&"function"==typeof n.off&&n.off("node:loaded",t)})),M(XI,this).clear(),M(YI,this).forEach(((t,e)=>{const n=A(nS,this,AS).call(this,e);n&&"function"==typeof n.off&&n.off("segment:chunk",t)})),M(YI,this).clear(),M(QI,this).clear(),M(JI,this).clear(),A(nS,this,vS).call(this),M(KI,this).forEach((({trackStates:t})=>{t&&t.forEach((t=>{A(nS,this,CS).call(this,t)}))})),M(KI,this).clear()}}function rS(){M(BI,this)&&"function"==typeof M(BI,this).on&&(C(jI,this,(t=>{A(nS,this,wS).call(this,t)})),M(BI,this).on(dd.PLACEMENT_ADDED,M(jI,this)),C(UI,this,(t=>A(nS,this,sS).call(this,t))),M(BI,this).on(dd.TIMELINE_SEEKING,M(UI,this)),C(qI,this,(()=>A(nS,this,aS).call(this))),M(BI,this).on(dd.TIMELINE_SEEKED,M(qI,this)),C(VI,this,(t=>A(nS,this,lS).call(this,t))),M(BI,this).on(dd.TIMELINE_TIME_UPDATE,M(VI,this)),C(GI,this,(()=>A(nS,this,cS).call(this))),M(BI,this).on(dd.TIMELINE_RESET,M(GI,this))),(null==cd?void 0:cd.document)&&"function"==typeof cd.document.addEventListener&&(C(HI,this,(()=>{A(nS,this,gS).call(this)})),cd.document.addEventListener("visibilitychange",M(HI,this)))}function oS(){M(HI,this)&&null!=cd&&cd.document&&"function"==typeof cd.document.removeEventListener&&cd.document.removeEventListener("visibilitychange",M(HI,this)),C(HI,this,null)}function sS(t={}){const e=Number(null==t?void 0:t.targetTime);Number.isFinite(e)&&(M(KI,this).forEach((t=>{const n=null==t?void 0:t.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(nS,this,uS).call(this,n,null==t?void 0:t.placement,e),n.seekSegmentId=null)}))})),(Array.isArray(null==t?void 0:t.placements)?t.placements:[]).forEach((t=>{const n=null==t?void 0:t.placementId,i=null==t?void 0:t.nodeId;if(!n||!i)return;const r=M(KI,this).get(n);if(!r||!r.trackStates)return;const o=A(nS,this,AS).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(nS,this,uS).call(this,n,r.placement||t,e)})),A(nS,this,zS).call(this,r.placement||t,o))})))}function aS(){M(KI,this).forEach((t=>{const e=null==t?void 0:t.trackStates;e&&e.forEach((t=>{var e;const n=null==t||null===(e=t.track)||void 0===e?void 0:e.type;"video"!==n&&"image"!==n&&"audio"!==n||(t.seekSegmentId=null)}))}))}function lS(t={}){var e,n;A(nS,this,BS).call(this,null==t?void 0:t.time),null!==(e=M($I,this))&&void 0!==e&&null!==(n=e.handleTimeUpdate)&&void 0!==n&&n.call(e,t),A(nS,this,gS).call(this),A(nS,this,OS).call(this,null==t?void 0:t.time)}function cS(){M(XI,this).forEach(((t,e)=>{const n=A(nS,this,AS).call(this,e);n&&"function"==typeof n.off&&n.off("node:loaded",t)})),M(XI,this).clear(),M(YI,this).forEach(((t,e)=>{const n=A(nS,this,AS).call(this,e);n&&"function"==typeof n.off&&n.off("segment:chunk",t)})),M(YI,this).clear(),M(QI,this).clear(),M(JI,this).clear(),M(KI,this).forEach((({trackStates:t})=>{t&&t.forEach((t=>{const e=null==t?void 0:t.segmentDecoders;e&&e.forEach((t=>{t&&"function"==typeof t.dispose&&t.dispose()}))}))})),M(KI,this).clear()}function uS(t,e,n){t&&(A(nS,this,CS).call(this,t),t.seekSegmentId=A(nS,this,dS).call(this,t.track,e,n))}function dS(t,e,n){if(!t||!e||!Array.isArray(t.segments))return null;const i=gm(e);if(!Number.isFinite(i))return null;const r=DI(null==e?void 0:e.nodeOffsetOverride),o=Math.max(0,n-i+r),s=DI(null==t?void 0:t.offset),a=Math.max(0,o-s),l="function"==typeof t.getMediaSegmentAtTime?t.getMediaSegmentAtTime(a,{preferRepresentationTime:!0}):mb(t.segments,a,{preferRepresentationTime:!0});return(null==l?void 0:l.id)||null}function hS(t){if(!t)return!1;const e=null==t?void 0:t.name;if("QuotaExceededError"===e)return!0;if("EncodingError"===e)return!0;const n="string"==typeof(null==t?void 0:t.message)?t.message:"";return!!n.includes("Decoder failure")||!!n.includes("Codec reclaimed due to inactivity")||!("OperationError"!==e||!n.includes("initialize after flush"))}function fS(){const t=null==cd?void 0:cd.document;return!t||"string"!=typeof t.visibilityState||"visible"===t.visibilityState}function pS(){var t;const e=M(BI,this);if(!e||"number"!=typeof e.currentTime)return!1;if(e.state===Av)return!1;const n=Date.now();if(n<M(ZI,this))return!1;const i=e.currentTime;if(!Number.isFinite(i))return!1;const r="function"==typeof e.getPlacementsActiveAtTime?e.getPlacementsActiveAtTime(i):[],o=Number(null==e||null===(t=e.settings)||void 0===t?void 0:t.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(nS,this,mS).call(this,i),!Number.isFinite(a))return!1;return C(ZI,this,n+1500),this.log.warn("[DecodeCoordinator] attempting decoder recovery seek"),e.currentTime=a,!0}function mS(t){var e;const n=M(BI,this);if(!n)return null;const i=Array.isArray(n.placements)?n.placements:[];if(!i.length)return null;const r=Number(t);if(!Number.isFinite(r))return null;const o=Number(null==n||null===(e=n.settings)||void 0===e?void 0:e.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((t=>{const e=gm(t);if(!Number.isFinite(e))return;(!Number.isFinite(d)||e<d)&&(d=e);const n=mm(t,M(LI,this)),i=Number.isFinite(n),o=i?e+n:e;(o>e||!i)&&((o>a||!Number.isFinite(a)&&Number.isFinite(o))&&(a=o,l=e),o<=r&&o>c&&(c=o,u=i?Math.max(e,o-s):e))})),Number.isFinite(l)&&Number.isFinite(a)&&r>=a-s?l:Number.isFinite(u)?u:Number.isFinite(d)?d:null}function vS(){C(tS,this,!1),C(eS,this,null)}function gS(){M(tS,this)&&A(nS,this,fS).call(this)&&A(nS,this,pS).call(this)}function yS(t){if(!A(nS,this,hS).call(this,t))return;const e=M(BI,this);e&&"number"==typeof e.currentTime&&(C(tS,this,!0),C(eS,this,t),A(nS,this,fS).call(this)&&A(nS,this,pS).call(this))}function bS(t){var e;return!!t&&(Array.isArray(null===(e=M(BI,this))||void 0===e?void 0:e.placements)?M(BI,this).placements:[]).includes(t)}function kS(t){var e;(Array.isArray(null===(e=M(BI,this))||void 0===e?void 0:e.placements)?[...M(BI,this).placements]:[]).filter((e=>"function"!=typeof t||t(e))).sort(((t,e)=>{const n=gm(t),i=gm(e);return(Number.isFinite(n)?n:Number.POSITIVE_INFINITY)-(Number.isFinite(i)?i:Number.POSITIVE_INFINITY)})).forEach((t=>{A(nS,this,wS).call(this,t)}))}async function wS(t){if(!t||!t.placementId||M(KI,this).has(t.placementId))return;if(!A(nS,this,bS).call(this,t))return;const e=t.nodeId;if(!e||!M(LI,this)||"function"!=typeof M(LI,this).get)return;const n=A(nS,this,AS).call(this,e);if(n){if(n.state&&"ready"!==n.state){if("function"==typeof n.resolve)try{await n.resolve()}catch(n){if(!A(nS,this,bS).call(this,t))return;return void this.log.warn(`[#processPlacement] Failed to resolve node ${e}`,n)}if(!A(nS,this,bS).call(this,t))return;if("ready"!==n.state)return}if(A(nS,this,LS).call(this,t))return A(nS,this,DS).call(this,t,n),void M(JI,this).add(t.placementId);A(nS,this,RS).call(this,t,n)}}function xS(t){return A(nS,this,_S).call(this,t).every((t=>A(nS,this,PS).call(this,t)))}function _S(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).filter((t=>RI.has(null==t?void 0:t.type)))}function TS(t){if(!t||!t.id||"function"!=typeof t.on)return;if(M(XI,this).has(t.id))return;const e=()=>{A(nS,this,$S).call(this,t.id)};t.on("node:loaded",e),M(XI,this).set(t.id,e)}function ES(t){if(!t||!t.id||"function"!=typeof t.on)return;if(M(YI,this).has(t.id))return;const e=t=>A(nS,this,jS).call(this,t);t.on("segment:chunk",e),M(YI,this).set(t.id,e)}function IS(t,e){if(!t||!e)return;const n=M(QI,this).get(t)||new Set;n.add(e),M(QI,this).set(t,n)}function SS(t){return M(QI,this).get(t)||new Set}function AS(t){if(t&&M(LI,this)&&"function"==typeof M(LI,this).get)return M(LI,this).get(t)}function NS(t){if(!t)return;const e=t.fullBufferRetryTimer;null!=e&&("function"==typeof(null==cd?void 0:cd.clearTimeout)?cd.clearTimeout.bind(cd):clearTimeout)(e),t.fullBufferRetryTimer=null,t.fullBufferDecodeScheduled=!1,t.fullBufferRetryAttempts=0}function MS(t){const e=null==t?void 0:t.segmentStates;e&&"function"==typeof e.forEach&&e.forEach((t=>{A(nS,this,NS).call(this,t)}))}function FS(t,e,n,i){var r,o;if(!(t&&e&&n&&i))return!1;const s=M(KI,this).get(t),a=null==s||null===(r=s.trackStates)||void 0===r?void 0:r.get(e);return(null==a||null===(o=a.segmentStates)||void 0===o?void 0:o.get(n))===i}function CS(t){if(!t)return;A(nS,this,MS).call(this,t);const e=t.segmentDecoders;e&&"function"==typeof e.forEach&&(e.forEach((t=>{if(t&&"function"==typeof t.dispose)try{t.dispose()}catch(t){}})),"function"==typeof e.clear&&e.clear()),t.segmentStates&&"function"==typeof t.segmentStates.clear&&t.segmentStates.clear(),t.ready=!1,t.seekSegmentId=null}function OS(t){const e=DI(t);if(!Number.isFinite(e))return;const n=e-2;Number.isFinite(n)&&M(KI,this).forEach((t=>{const e=null==t?void 0:t.placement;if(!e)return;const i=gm(e),r=mm(e,M(LI,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==t?void 0:t.trackStates;s&&"function"==typeof s.forEach&&s.forEach((t=>{var e;const n=null==t||null===(e=t.track)||void 0===e?void 0:e.type;"video"!==n&&"image"!==n&&"audio"!==n||A(nS,this,CS).call(this,t)}))}))}function PS(t){if(!t||!Array.isArray(t.segments))return!1;const e=t.segments.find((t=>null==t?void 0:t.isInit));if(e&&!(e.retainedByteLength>0))return!1;const n=t.segments.find((t=>t&&!t.isInit));return!n||n.retainedByteLength>0}function RS(t,e){if(this.log.debug(`[#startDecode] [${t.placementId}] [${e.id}] Starting decode`),A(nS,this,DS).call(this,t,e)){if(A(nS,this,IS).call(this,e.id,t.placementId),!A(nS,this,xS).call(this,e))return A(nS,this,TS).call(this,e),void A(nS,this,ES).call(this,e);A(nS,this,zS).call(this,t,e),A(nS,this,ES).call(this,e)}}function DS(t,e){if(!t||!t.placementId||!e)return;const n=M(KI,this).get(t.placementId);if(n)return n.placement=t,n;const i=A(nS,this,_S).call(this,e),r=new Map;i.forEach((n=>{try{const t=n.segments.some((t=>null==t?void 0:t.isInit));r.set(n.id,{hasInit:t,track:n,ready:!1,segmentDecoders:new Map,segmentStates:new Map})}catch(i){this.trigger(dd.DECODE_ERROR,pd({placementId:t.placementId,nodeId:e.id,trackId:null==n?void 0:n.id,trackType:null==n?void 0:n.type,error:i}))}}));const o={trackStates:r,nodeId:e.id,placement:t};return M(KI,this).set(t.placementId,o),o}function LS(t){var e;const n=gm(t),i=DI(null===(e=M(BI,this))||void 0===e?void 0:e.currentTime);return!Number.isFinite(n)||!!Number.isFinite(i)&&n-i>2}function BS(t){if(!M(JI,this).size)return;const e=DI(t);if(!Number.isFinite(e))return;const n=[];M(JI,this).forEach((t=>{const i=M(KI,this).get(t),r=null==i?void 0:i.placement;if(!r)return void n.push(t);const o=gm(r);Number.isFinite(o)&&o-e<=2&&n.push(t)})),n.forEach((t=>{M(JI,this).delete(t);const e=M(KI,this).get(t),n=null==e?void 0:e.placement;if(!n)return;const i=A(nS,this,AS).call(this,n.nodeId);i&&A(nS,this,RS).call(this,n,i)}))}function zS(t,e){const n=M(KI,this).get(t.placementId);n&&A(nS,this,_S).call(this,e).forEach((i=>{const r=n.trackStates.get(i.id);if(r&&!r.ready)try{let n;if(r.seekSegmentId&&(n=i.segments.find((t=>t&&!t.isInit&&t.id===r.seekSegmentId&&t.retainedByteLength>0)),!n))return;if(n||(n=i.segments.find((t=>t&&!t.isInit&&t.retainedByteLength>0))),!n)return;A(nS,this,KS).call(this,t,i,n),r.seekSegmentId&&"video"===(null==i?void 0:i.type)&&A(nS,this,WS).call(this,t,i,n),r.ready=!0,this.trigger(dd.DECODE_READY,fd({placementId:t.placementId,nodeId:e.id,trackId:i.id,trackType:i.type}))}catch(n){this.trigger(dd.DECODE_ERROR,pd({placementId:t.placementId,nodeId:e.id,trackId:null==i?void 0:i.id,trackType:null==i?void 0:i.type,error:n}))}}))}function WS(t,e,n){var i;if(!(t&&e&&n&&Array.isArray(e.segments)))return;const r=null==t?void 0:t.placementId,o=r?M(KI,this).get(r):void 0,s=null==o||null===(i=o.trackStates)||void 0===i?void 0:i.get(e.id),a=null==s?void 0:s.segmentDecoders;if(!a||"function"!=typeof a.has)return;const l=e.segments,c=l.findIndex((t=>(null==t?void 0:t.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(nS,this,KS).call(this,t,e,i),u+=1,u>=2)break}}function $S(t){const e=A(nS,this,AS).call(this,t);e&&A(nS,this,xS).call(this,e)&&A(nS,this,SS).call(this,t).forEach((t=>{const n=M(KI,this).get(t);A(nS,this,zS).call(this,(null==n?void 0:n.placement)||{placementId:t},e)}))}function jS(t){t&&t.nodeId&&t.trackId&&t.chunk&&A(nS,this,SS).call(this,t.nodeId).forEach((e=>A(nS,this,US).call(this,e,t)))}function US(t,e){const n=M(KI,this).get(t);if(!n)return;const i=n.trackStates.get(e.trackId);if(i)try{var r,o;if(e.isInit)return;const s=i.track,a=null==s||null===(r=s.segments)||void 0===r?void 0:r.find((t=>(null==t?void 0:t.id)===e.segmentId));if(!a||a.isInit)return;if("image"===(null==s?void 0:s.type))return void(!i.ready&&a.retainedByteLength>0&&A(nS,this,KS).call(this,n.placement,s,a)&&(i.ready=!0,this.trigger(dd.DECODE_READY,fd({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType}))));if((null===(o=M(BI,this))||void 0===o?void 0:o.state)===Av&&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(nS,this,GS).call(this,n.placement,s,a);if(!u||"function"!=typeof u.decodeChunk)return;if(i.hasInit&&!c.initSent){const t=A(nS,this,HS).call(this,s,a);if(!t)return void c.pendingChunks.push({chunk:e.chunk,loaded:e.loaded,total:e.total});u.decodeChunk(t,{isInit:!0}),c.initSent=!0,c.pendingChunks.length&&(c.pendingChunks.forEach((t=>{u.decodeChunk(t.chunk,{isInit:!1,loaded:t.loaded,total:t.total})})),c.pendingChunks=[])}const d="number"==typeof e.loaded&&"number"==typeof e.total&&e.total>0&&e.loaded>=e.total;A(nS,this,qS).call(this,c,e)?d&&!c.ended&&A(nS,this,VS).call(this,n.placement,s,a,c):(u.decodeChunk(e.chunk,{isInit:!1,loaded:e.loaded,total:e.total}),d&&!c.ended&&"function"==typeof u.endOfStream&&(c.ended=!0,u.endOfStream())),i.ready||(i.ready=!0,this.trigger(dd.DECODE_READY,fd({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType})))}catch(n){this.trigger(dd.DECODE_ERROR,pd({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType,error:n}))}}function qS(t,e){var n;if(!t||t.missedSegmentPrefix)return!(null==t||!t.missedSegmentPrefix);if(t.firstChunkObserved)return!1;t.firstChunkObserved=!0;const i=Number(null==e?void 0:e.loaded),r=Number(null==e||null===(n=e.chunk)||void 0===n?void 0:n.byteLength);return!(!Number.isFinite(i)||!Number.isFinite(r)||r<=0)&&(t.missedSegmentPrefix=i>r,t.missedSegmentPrefix)}function VS(t,e,n,i){if(!t||!e||!n||!i||i.fullBufferDecodeScheduled)return;const r=null==t?void 0:t.placementId,o=null==e?void 0:e.id,s=null==n?void 0:n.id;if(!r||!o||!s)return;const a="function"==typeof(null==cd?void 0:cd.setTimeout)?cd.setTimeout.bind(cd):setTimeout;i.fullBufferDecodeScheduled=!0,i.fullBufferRetryAttempts=0;const l=()=>{if(!A(nS,this,FS).call(this,r,o,s,i)||i.ended)return void A(nS,this,NS).call(this,i);if(A(nS,this,KS).call(this,t,e,n))return void A(nS,this,NS).call(this,i);i.fullBufferRetryAttempts+=1;const c=i.fullBufferRetryAttempts<=8?0:50;i.fullBufferRetryTimer=a((()=>{l()}),c)};i.fullBufferRetryTimer=a((()=>{l()}),0)}function GS(t,e,n){var i,r;const o=null==t?void 0:t.placementId;if(!o||!e||!n)return;const s=M(KI,this).get(o),a=null==s||null===(i=s.trackStates)||void 0===i?void 0:i.get(e.id);if(!a)return;const l=a.segmentDecoders.get(n.id);if(l)return l;const c=M(zI,this).create(e);if(c&&"function"==typeof c.configure&&c.configure(e),c&&"function"==typeof c.setNodeId&&c.setNodeId(null==t?void 0:t.nodeId),c&&"function"==typeof c.setSegment&&c.setSegment(n),c&&"function"==typeof c.setCurrentTimeProvider&&c.setCurrentTimeProvider((()=>{var t;return"number"==typeof(null===(t=M(BI,this))||void 0===t?void 0:t.currentTime)?M(BI,this).currentTime:0})),c&&"function"==typeof c.setTimeOffsetSeconds){var u,d;const i=gm(t),r=DI(null==e?void 0:e.offset),o=DI(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(BI,this))||void 0===r?void 0:r.state)===Av&&"video"===(null==e?void 0:e.type)&&c.setSeekTargetTimeSeconds(M(BI,this).currentTime),c&&"function"==typeof c.on&&(c.on(dd.DECODER_FRAME,(i=>{i&&(!M(tS,this)||"video"!==(null==e?void 0:e.type)&&"image"!==(null==e?void 0:e.type)||(C(tS,this,!1),C(eS,this,null)),M(BI,this)&&"function"==typeof M(BI,this).notifyDecodedFrame&&(i.frame||i.data)&&M(BI,this).notifyDecodedFrame({placementId:o,nodeId:null==t?void 0:t.nodeId,trackId:null==e?void 0:e.id,trackType:null==e?void 0:e.type,segmentId:null==n?void 0:n.id,pts:i.pts,duration:i.duration,frame:i.frame,data:i.data}))})),c.on(dd.DECODER_AUDIO,(i=>{i&&i.audioBuffer&&this.trigger(dd.DECODER_AUDIO,fd({placementId:o,nodeId:null==t?void 0:t.nodeId,trackId:null==e?void 0:e.id,trackType:null==e?void 0:e.type,segmentId:null==n?void 0:n.id,pts:i.pts,duration:i.duration,audioBuffer:i.audioBuffer}))})),c.on(dd.DECODER_ERROR,(i=>{const r=(null==i?void 0:i.error)||i;this.trigger(dd.DECODER_ERROR,pd({placementId:o,nodeId:null==t?void 0:t.nodeId,trackId:null==e?void 0:e.id,trackType:null==e?void 0:e.type,segmentId:null==n?void 0:n.id,error:r})),A(nS,this,yS).call(this,r)}))),a.segmentDecoders.set(n.id,c),c}function HS(t,e){var n,i;if(!t||!e||!Array.isArray(t.segments))return;const r=t.segments.find((t=>null==t?void 0:t.isInit));if(!r||"function"!=typeof r.getRepresentationBuffer)return;const o=(null==e||null===(n=e.chosenRepresentation)||void 0===n?void 0:n.id)||(null==e||null===(i=e.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 KS(t,e,n){var i;if(!t||!e||!n)return!1;const r=t.placementId,o=M(KI,this).get(r),s=null==o||null===(i=o.trackStates)||void 0===i?void 0:i.get(e.id);if(!s)return!1;const a=A(nS,this,GS).call(this,t,e,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(nS,this,NS).call(this,l),!0;if(s.hasInit&&!l.initSent){const t=A(nS,this,HS).call(this,e,n);if(!t)return!1;a.decodeChunk(t,{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(nS,this,NS).call(this,l),0))}const XS=1e-6;var YS=new WeakMap,QS=new WeakMap,JS=new WeakMap,ZS=new WeakMap,tA=new WeakMap,eA=new WeakMap,nA=new WeakMap,iA=new WeakMap,rA=new WeakSet;class oA extends sd{get name(){return"TransitionManager"}get defaults(){return{durationSeconds:.5}}constructor(t,e,n){super(n),O(this,rA),F(this,YS,void 0),F(this,QS,void 0),F(this,JS,null),F(this,ZS,null),F(this,tA,null),F(this,eA,0),F(this,nA,[]),F(this,iA,null),C(YS,this,t),C(QS,this,e),M(YS,this)&&"function"==typeof M(YS,this).on&&(C(iA,this,(()=>A(rA,this,pA).call(this))),M(YS,this).on(dd.TIMELINE_RESET,M(iA,this)))}transitionTo(t,e={}){const n=Number(t);if(!Number.isFinite(n))throw new Error("TransitionManager.transitionTo requires a numeric time");A(rA,this,pA).call(this);const i=A(rA,this,sA).call(this),r=A(rA,this,uA).call(this,n,e);return r?A(rA,this,dA).call(this,n,e,i,r):Promise.resolve()}onDispose(){M(YS,this)&&"function"==typeof M(YS,this).off&&M(iA,this)&&M(YS,this).off(dd.TIMELINE_RESET,M(iA,this)),C(iA,this,null),A(rA,this,pA).call(this),C(QS,this,null),C(YS,this,null)}}function sA(){return C(eA,this,M(eA,this)+1),M(eA,this)}function aA(t={}){var e;const n=Number(null==t?void 0:t.duration),i=Number(null===(e=this.settings)||void 0===e?void 0:e.durationSeconds);return Number.isFinite(n)?n:i}function lA(t={},e){return{duration:e,filter:null==t?void 0:t.filter,color:null==t?void 0:t.color,filters:null==t?void 0:t.filters,reverseFilters:null==t?void 0:t.reverseFilters,transition:null==t?void 0:t.transition}}function cA(t,e){const n=1e3*t,i=Number.isFinite(Number(null==e?void 0:e.outDurationMs))&&e.outDurationMs>0?e.outDurationMs:n;return{outDurationMs:i,inDurationMs:Number.isFinite(Number(null==e?void 0:e.inDurationMs))&&e.inDurationMs>0?e.inDurationMs:i}}function uA(t,e={}){var n;const i=M(QS,this),r=A(rA,this,aA).call(this,e);if(!i||"function"!=typeof i.startTransition)return M(YS,this).currentTime=t,null;if(!(r>0))return M(YS,this).currentTime=t,null!==(n=i.resetTransition)&&void 0!==n&&n.call(i),null;const o=A(rA,this,lA).call(this,e,r);"function"==typeof(null==e?void 0:e.onTransitionInStart)&&e.onTransitionInStart();const s=i.startTransition(o),{outDurationMs:a,inDurationMs:l}=A(rA,this,cA).call(this,r,s);return{renderer:i,transitionOptions:o,outDurationMs:a,inDurationMs:l,shouldWaitForFrames:!1!==(null==e?void 0:e.waitForVisualFrames)}}function dA(t,e={},n,i){const{renderer:r,transitionOptions:o,outDurationMs:s,inDurationMs:a,shouldWaitForFrames:l}=i,c=A(rA,this,bA).call(this,t,e,n),u=l?A(rA,this,kA).call(this,t,n):Promise.resolve();let d=!1,h=!1,f=!1,p=!l;const m=()=>{var t;A(rA,this,mA).call(this,n)&&!f&&d&&h&&p&&(f=!0,"function"==typeof(null==e?void 0:e.onTransitionInEnd)&&e.onTransitionInEnd(),"function"==typeof(null==e?void 0:e.onTransitionOutStart)&&e.onTransitionOutStart(),null!==(t=r.beginTransitionIn)&&void 0!==t&&t.call(r,o),C(ZS,this,setTimeout((()=>{var t;A(rA,this,mA).call(this,n)&&(null!==(t=r.resetTransition)&&void 0!==t&&t.call(r),"function"==typeof(null==e?void 0:e.onTransitionOutEnd)&&e.onTransitionOutEnd(),A(rA,this,hA).call(this))}),a)))};return C(JS,this,setTimeout((()=>{d=!0,m()}),s)),c.then((()=>{h=!0,m()})).catch((()=>{var t;A(rA,this,mA).call(this,n)&&(null!==(t=r.resetTransition)&&void 0!==t&&t.call(r),A(rA,this,hA).call(this))})),u.then((()=>{p=!0,m()})).catch((()=>{p=!0,m()})),M(YS,this).currentTime=t,new Promise((t=>{C(tA,this,t)}))}function hA(){const t=M(tA,this);C(tA,this,null),A(rA,this,fA).call(this),A(rA,this,yA).call(this),t&&t()}function fA(){M(JS,this)&&clearTimeout(M(JS,this)),M(ZS,this)&&clearTimeout(M(ZS,this)),C(JS,this,null),C(ZS,this,null)}function pA(){var t,e;M(QS,this)&&null!==(t=(e=M(QS,this)).resetTransition)&&void 0!==t&&t.call(e),A(rA,this,fA).call(this),A(rA,this,yA).call(this),M(tA,this)&&(M(tA,this).call(this),C(tA,this,null))}function mA(t){return M(eA,this)===t}function vA(t,e){M(YS,this)&&"function"==typeof M(YS,this).on&&(M(YS,this).on(t,e),M(nA,this).push({eventName:t,handler:e}))}function gA(t,e){M(YS,this)&&"function"==typeof M(YS,this).off&&(M(YS,this).off(t,e),C(nA,this,M(nA,this).filter((n=>n.eventName!==t||n.handler!==e))))}function yA(){M(YS,this)&&"function"==typeof M(YS,this).off?(M(nA,this).forEach((t=>{M(YS,this).off(t.eventName,t.handler)})),C(nA,this,[])):C(nA,this,[])}function bA(t,e,n){const i=null==e?void 0:e.transitionOutPromise;if(i&&"function"==typeof i.then)return i;if("function"==typeof i)try{const t=i();if(t&&"function"==typeof t.then)return t}catch(t){return Promise.resolve()}if(!M(YS,this)||"function"!=typeof M(YS,this).on)return Promise.resolve();const r=A(rA,this,wA).call(this);return new Promise((e=>{let i=!1;const o=r?dd.TIMELINE_SEEKED:"nodestart";let s,a;const l=()=>{A(rA,this,gA).call(this,dd.TIMELINE_SEEKING,s),A(rA,this,gA).call(this,o,a),e()};s=(e={})=>{A(rA,this,mA).call(this,n)?A(rA,this,xA).call(this,e,t)&&(i=!0):l()},a=(e={})=>{A(rA,this,mA).call(this,n)?(o!==dd.TIMELINE_SEEKED||A(rA,this,xA).call(this,e,t))&&(o===dd.TIMELINE_SEEKED||i)&&l():l()},A(rA,this,vA).call(this,dd.TIMELINE_SEEKING,s),A(rA,this,vA).call(this,o,a)}))}function kA(t,e){if(!M(YS,this)||"function"!=typeof M(YS,this).on)return Promise.resolve();const n=Number(t);return new Promise((t=>{const i=(r={})=>{if(!A(rA,this,mA).call(this,e))return A(rA,this,gA).call(this,dd.VISUAL_FRAMES_AVAILABLE,i),void t();const o=Number(null==r?void 0:r.time);Number.isFinite(n)&&Number.isFinite(o)&&o+XS<n||(Array.isArray(null==r?void 0:r.frames)?r.frames:[]).length&&(A(rA,this,gA).call(this,dd.VISUAL_FRAMES_AVAILABLE,i),t())};A(rA,this,vA).call(this,dd.VISUAL_FRAMES_AVAILABLE,i)}))}function wA(){var t,e;const n=null===(t=M(YS,this))||void 0===t?void 0:t.state;if(n===Sv||n===_v)return!0;const i=null===(e=M(YS,this))||void 0===e?void 0:e.placements;return!Array.isArray(i)||0===i.length}function xA(t,e){const n=Number(null==t?void 0:t.targetTime);return!Number.isFinite(n)||Math.abs(n-e)<XS}function _A(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}var TA=new WeakMap,EA=new WeakMap,IA=new WeakMap,SA=new WeakMap,AA=new WeakMap,NA=new WeakMap,MA=new WeakMap,FA=new WeakMap,CA=new WeakMap,OA=new WeakMap,PA=new WeakMap,RA=new WeakMap,DA=new WeakMap,LA=new WeakMap,BA=new WeakSet;class zA extends sd{get name(){return"AudioPlaybackManager"}get defaults(){return{muted:!1,volume:1,lookaheadSeconds:1}}constructor(t,e,n){super(n),O(this,BA),F(this,TA,void 0),F(this,EA,void 0),F(this,IA,null),F(this,SA,null),F(this,AA,[]),F(this,NA,new Set),F(this,MA,new Map),F(this,FA,!1),F(this,CA,1),F(this,OA,!0),F(this,PA,null),F(this,RA,null),F(this,DA,null),F(this,LA,null),C(TA,this,t),C(EA,this,e),C(FA,this,!!this.settings.muted),C(CA,this,fm(this.settings.volume));const i=Array.isArray(null==n?void 0:n.disabledTracks)?n.disabledTracks:[];C(OA,this,!i.includes("audio")),A(BA,this,WA).call(this)}get muted(){return M(FA,this)}set muted(t){C(FA,this,!!t),A(BA,this,QA).call(this)}get volume(){return M(CA,this)}set volume(t){C(CA,this,fm(t)),A(BA,this,QA).call(this)}handleDecodedAudio(t={}){if(!M(OA,this))return;const e=null==t?void 0:t.audioBuffer,n=null==t?void 0:t.placementId,i=null==t?void 0:t.segmentId,r=_A(null==t?void 0:t.pts,null);if(!(e&&n&&i&&Number.isFinite(r)))return;const o=Number.isFinite(null==t?void 0:t.duration)?t.duration:e.duration,s=`${n}:${i}`;M(NA,this).has(s)||(M(AA,this).push({key:s,placementId:n,pts:r,duration:o,audioBuffer:e}),M(AA,this).sort(((t,e)=>t.pts-e.pts)),A(BA,this,VA).call(this))}onDispose(){A(BA,this,$A).call(this),A(BA,this,XA).call(this,!0),M(IA,this)&&"function"==typeof M(IA,this).close&&M(IA,this).close(),C(IA,this,null),C(SA,this,null),C(TA,this,null),C(EA,this,null)}}function WA(){M(TA,this)&&"function"==typeof M(TA,this).on&&(C(PA,this,(t=>A(BA,this,jA).call(this,t))),M(TA,this).on(dd.TIMELINE_TIME_UPDATE,M(PA,this)),C(RA,this,(t=>A(BA,this,UA).call(this,t))),M(TA,this).on(dd.TIMELINE_STATE_CHANGE,M(RA,this)),C(LA,this,(()=>A(BA,this,qA).call(this))),M(TA,this).on(dd.TIMELINE_RESET,M(LA,this))),M(EA,this)&&"function"==typeof M(EA,this).on&&(C(DA,this,(t=>this.handleDecodedAudio(t))),M(EA,this).on(dd.DECODER_AUDIO,M(DA,this)))}function $A(){M(TA,this)&&"function"==typeof M(TA,this).off&&(M(PA,this)&&M(TA,this).off(dd.TIMELINE_TIME_UPDATE,M(PA,this)),M(RA,this)&&M(TA,this).off(dd.TIMELINE_STATE_CHANGE,M(RA,this)),M(LA,this)&&M(TA,this).off(dd.TIMELINE_RESET,M(LA,this))),M(EA,this)&&"function"==typeof M(EA,this).off&&M(DA,this)&&M(EA,this).off(dd.DECODER_AUDIO,M(DA,this)),C(PA,this,null),C(RA,this,null),C(DA,this,null),C(LA,this,null)}function jA(){A(BA,this,VA).call(this)}function UA(t={}){const e=null==t?void 0:t.to;if(e)return e===Tv?(A(BA,this,JA).call(this),void A(BA,this,VA).call(this)):void(e!==Sv&&e!==Iv?e!==Av&&e!==Nv||A(BA,this,qA).call(this):A(BA,this,ZA).call(this))}function qA(){A(BA,this,ZA).call(this),A(BA,this,XA).call(this,!0),C(AA,this,[])}function VA(){if(!M(OA,this)||!M(TA,this))return;if(M(TA,this).state!==Tv)return;const t=A(BA,this,YA).call(this);if(!t)return;const e=_A(M(TA,this).currentTime,0),n=e+Math.max(0,_A(this.settings.lookaheadSeconds,1)),i=[];for(let r=0;r<M(AA,this).length;r+=1){const o=M(AA,this)[r];o&&(o.pts>n?i.push(o):A(BA,this,GA).call(this,o)&&A(BA,this,KA).call(this,o,t,e))}C(AA,this,i)}function GA(t){if(!t||!M(TA,this))return!1;const e=A(BA,this,HA).call(this,t.pts);return!(!e||e!==t.placementId)}function HA(t){if(!M(TA,this)||"function"!=typeof M(TA,this).getPlacementsActiveAtTime)return null;const e=M(TA,this).getPlacementsActiveAtTime(t);if(!Array.isArray(e)||!e.length)return null;const n=e.find((t=>null==t?void 0:t.placementId));return n?n.placementId:null}function KA(t,e,n){const i=t.key;if(M(NA,this).has(i))return;const r=t.audioBuffer;if(!r)return;const o=Number.isFinite(t.duration)?t.duration:r.duration,s=t.pts;if(!Number.isFinite(s))return;const a=n-s;if(Number.isFinite(o)&&o>0&&a>=o)return;const l=e.createBufferSource();l.buffer=r,l.connect(M(SA,this));let c=e.currentTime,u=0;a>0?u=a:a<0&&(c=e.currentTime+Math.abs(a));try{l.start(c,u)}catch(t){return void this.log.warn("[AudioPlaybackManager] Failed to start audio buffer",t)}M(NA,this).add(i),M(MA,this).set(i,l),l.onended=()=>{M(MA,this).delete(i)}}function XA(t){M(MA,this).forEach(((t,e)=>{if(t&&"function"==typeof t.stop)try{t.stop()}catch(t){}M(MA,this).delete(e)})),t&&M(NA,this).clear()}function YA(){if(M(IA,this))return M(IA,this);const t=cd.AudioContext||cd.webkitAudioContext;if(!t)return this.log.warn("[AudioPlaybackManager] AudioContext is not available."),null;try{return C(IA,this,new t),C(SA,this,M(IA,this).createGain()),M(SA,this).connect(M(IA,this).destination),A(BA,this,QA).call(this),M(IA,this)}catch(t){return this.log.warn("[AudioPlaybackManager] Failed to initialize AudioContext",t),C(IA,this,null),C(SA,this,null),null}}function QA(){if(!M(SA,this))return;const t=M(FA,this)?0:M(CA,this);M(SA,this).gain.value=t}function JA(){M(IA,this)&&"function"==typeof M(IA,this).resume&&"suspended"===M(IA,this).state&&M(IA,this).resume().catch((()=>{}))}function ZA(){M(IA,this)&&"function"==typeof M(IA,this).suspend&&"running"===M(IA,this).state&&M(IA,this).suspend().catch((()=>{}))}var tN=new WeakMap,eN=new WeakMap,nN=new WeakMap,iN=new WeakMap,rN=new WeakMap,oN=new WeakSet;class sN extends sd{constructor(...t){super(...t),O(this,oN),F(this,tN,void 0),F(this,eN,void 0),F(this,nN,void 0),F(this,iN,void 0),F(this,rN,void 0),C(tN,this,A(oN,this,lN).call(this,this.settings.currentTime)),C(eN,this,A(oN,this,cN).call(this,this.settings.playbackRate)),C(nN,this,null),C(iN,this,!1),C(rN,this,A(oN,this,aN).bind(this))}get name(){return"PlaybackClock"}get defaults(){return{currentTime:0,playbackRate:Ky("playbackRate")}}get currentTime(){return M(tN,this)}get playbackRate(){return M(eN,this)}set playbackRate(t){C(eN,this,A(oN,this,cN).call(this,t))}play(){M(iN,this)||(C(iN,this,!0),C(nN,this,Fy()),pw(M(rN,this),0))}pause(){M(iN,this)&&(C(iN,this,!1),mw(M(rN,this)))}seek(t){C(tN,this,A(oN,this,lN).call(this,t)),C(nN,this,Fy())}reset(){this.pause(),C(tN,this,0),C(nN,this,null)}onDispose(){this.pause(),C(rN,this,null)}}function aN(){const t=Fy();if(null===M(nN,this))return C(nN,this,t),void this.trigger(dd.CLOCK_TICK,{currentTime:M(tN,this)});const e=t-M(nN,this);C(nN,this,t);const n=e/1e3;C(tN,this,M(tN,this)+n*M(eN,this)),this.trigger(dd.CLOCK_TICK,{currentTime:M(tN,this)})}function lN(t){return"number"!=typeof t||Number.isNaN(t)||!Number.isFinite(t)||t<0?0:t}function cN(t){return"number"!=typeof t||Number.isNaN(t)||!Number.isFinite(t)||t<=0?M(eN,this)||1:t}var uN=new WeakMap,dN=new WeakSet;class hN extends sd{constructor(...t){super(...t),O(this,dN),F(this,uN,new Map)}get name(){return"TrackBuffers"}get defaults(){return{}}refreshNode(t){if(!t||!Array.isArray(t.tracks))return;const e=t.id,n=M(uN,this).get(e)||new Map;M(uN,this).set(e,n),t.tracks.forEach((t=>{const i=null==t?void 0:t.type;if(!i)return;const r=t.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(dd.TRACK_BUFFER_UPDATE,{nodeId:e,trackType:i,range:r})),!s&&a?this.trigger(dd.TRACK_READY,{nodeId:e,trackType:i,range:r}):s&&!a&&this.trigger(dd.TRACK_UNDERFLOW,{nodeId:e,trackType:i,range:r})}))}getTrackRange(t,e){const n=M(uN,this).get(t),i=null==n?void 0:n.get(e);return null==i?void 0:i.range}computeBuffered(t=[],e=0,n){if(!n||"function"!=typeof n.get)return;const i=Number.isFinite(e)?e:0;let r,o,s=!1;for(let e=0;e<t.length;e+=1){const a=A(dN,this,pN).call(this,n,t[e],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(uN,this)}reset(){M(uN,this).clear()}onDispose(){M(uN,this).clear(),"function"==typeof this.off&&this.off()}}function fN(t,e=0){const n=Array.isArray(null==t?void 0:t.segments)?t.segments:[],i=[];for(let t=0;t<n.length;t+=1){const e=n[t];if(!e||e.isInit)continue;const r=Number(e.duration),o=Number(e.offset),s=Number(e.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(((t,e)=>t.start-e.start));const r=[i[0]];for(let t=1;t<i.length;t+=1){const e=i[t],n=r[r.length-1];e.start<=n.end+.001?n.end=Math.max(n.end,e.end):r.push({...e})}const o=Number.isFinite(e)?e:0;for(let t=0;t<r.length;t+=1){const e=r[t];if(e.end>o+.001)return e}}function pN(t,e,n=0){var i,r;const o=gm(e);if(!Number.isFinite(o))return;const s=t.get(e.nodeId);if(!s)return;const a=Array.isArray(s.tracks)?s.tracks:[];if(!a.length){const t=s.buffered;if(!t||!Number.isFinite(t.start)||!Number.isFinite(t.end))return;return A(dN,this,mN).call(this,s,t,o,e)}const l=s.mainTrackId,c=Number.isFinite(e.nodeOffsetOverride)?e.nodeOffsetOverride:0,u=Math.max(0,n-o+c);let d;l&&(d=a.find((t=>(null==t?void 0:t.id)===l))),(null===(i=d)||void 0===i?void 0:i.type)||(d=a.find((t=>null==t?void 0:t.type)));const h=A(dN,this,fN).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(dN,this,mN).call(this,s,h,o,e):void 0}function mN(t,e,n,i){const r=Number.isFinite(i.nodeOffsetOverride)?i.nodeOffsetOverride:0;let o=e.start-r+n,s=e.end-r+n;const a=t.duration,l=Number.isFinite(i.nodeDurationOverride)?i.nodeDurationOverride:a;if(Number.isFinite(l)){const t=n+l;s=Math.min(s,t);const e=o<=n&&s>=t;if(o=Math.max(o,n),!(s>o))return;return{start:o,end:s,full:e}}if(o=Math.max(o,n),s>o)return{start:o,end:s,full:!1}}class vN{constructor(t={}){const{placementId:e,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}=t;if(!e)throw new Error("Placement requires placementId");if(!n)throw new Error("Placement requires nodeId");this.placementId=e,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 gN extends sd{constructor(t,e){super(e),this.timeline=t}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"handleDecodedFrame","handleClockTick","handleMainTrackBufferUpdate"])}enter(){}exit(){}play(){this.timeline.transitionTo(Tv)}pause(){this.timeline.transitionTo(Sv)}wait(){this.timeline.transitionTo(Iv)}reset(){this.timeline.transitionTo(Nv)}seek(t){this.timeline.transitionTo(Av,{targetTime:t,returnState:this.timeline.state})}getCurrentTime(){return this.timeline.currentTime}emitPlayerStateEvent(t,e={}){if(!t||!this.timeline||"function"!=typeof this.timeline.trigger)return;const n=Number.isFinite(null==e?void 0:e.time)?e.time:this.getCurrentTime(),i={...e,event:t};Number.isFinite(n)&&(i.time=n),this.timeline.trigger("player:state",i)}get buffered(){return this.timeline.computeBuffered(this.timeline.currentTime)}handleMainTrackUnderflow(t){this.wait()}handleMainTrackReady(t){const e=this.timeline.getLastStableState()||Sv;this.timeline.transitionTo(e)}handleMainTrackBufferUpdate(t){}handleDecodedFrame(t){}handleClockTick(t){}onDispose(){this.timeline=null}}const yN=24e3/1001;function bN(t,e=(null==t?void 0:t.currentTime)){return Number.isFinite(e)?e:Number.isFinite(null==t?void 0:t.currentTime)?t.currentTime:0}function kN(t){var e;const n=Number(null==t||null===(e=t.settings)||void 0===e?void 0:e.snapToFps);return Number.isFinite(n)&&n>0?.5/n:.001}function wN(t){var e;const n=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[];let i;if(null!=t&&t.mainTrackId){const e=n.find((e=>(null==e?void 0:e.id)===t.mainTrackId));i=null==e?void 0:e.type}if(i||(i=null===(e=n.find((t=>null==t?void 0:t.type)))||void 0===e?void 0:e.type),"video"===i||"audio"===i||"image"===i)return i}function xN(t){const e=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[];if(e.length){if(null!=t&&t.mainTrackId){const n=e.find((e=>(null==e?void 0:e.id)===t.mainTrackId));if("video"===(null==n?void 0:n.type)||"image"===(null==n?void 0:n.type))return n}return e.find((t=>"video"===(null==t?void 0:t.type)||"image"===(null==t?void 0:t.type)))}}function _N(t,e,n,i,r){var o,s;const a="function"==typeof(null==t?void 0:t.getDecodedVisualBuffer)?t.getDecodedVisualBuffer(e,n):void 0;if(!a)return"function"==typeof(null==t?void 0:t.hasDecodedFirstFrame)&&t.hasDecodedFirstFrame(e,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 t=0;t<l.length;t+=1){const e=l[t],n=Number(null==e?void 0:e.presentationTime);if(Number.isFinite(n)){if(!(n<=r)){c=n;break}u=e}}const d=Number(null===(s=u)||void 0===s?void 0:s.presentationTime);if(!Number.isFinite(d)||d>r)return!1;const h=function(t,e,n,i){const r=Number(null==n?void 0:n.duration);if(Number.isFinite(r)&&r>0)return e+r;const o=function(t,e){const n=Number(null==t||null===(e=t.settings)||void 0===e?void 0:e.snapToFps);return 2/(Number.isFinite(n)&&n>0?n:yN)}(t),s=Number.isFinite(i)&&i>e?i-e:o;return e+Math.min(s,o)}(t,d,u,c);return!!Number.isFinite(h)&&r<=h+kN(t)}function TN(t,e=(null==t?void 0:t.currentTime)){const n=bN(t,e),i="function"==typeof(null==t?void 0:t.getPlacementsActiveAtTime)?t.getPlacementsActiveAtTime(n):[];if(!i.length)return!1;for(let e=0;e<i.length;e+=1){const n=i[e],r=null==n?void 0:n.placementId;if(!r)return!0;const o="function"==typeof(null==t?void 0:t.getNode)?t.getNode(n.nodeId):void 0;if(!o)return!0;const s=wN(o);if(!s)return!0;if(!t.hasDecodedFirstFrame(r,s))return!0}return!1}function EN(t,e=(null==t?void 0:t.currentTime)){return TN(t,e)||function(t,e=(null==t?void 0:t.currentTime)){const n=bN(t,e),i="function"==typeof(null==t?void 0:t.getPlacementsActiveAtTime)?t.getPlacementsActiveAtTime(n):[];if(!i.length)return!1;for(let e=0;e<i.length;e+=1){const r=i[e],o=null==r?void 0:r.placementId;if(!o)return!0;const s="function"==typeof(null==t?void 0:t.getNode)?t.getNode(r.nodeId):void 0;if(!s)return!0;const a=xN(s);if(null!=a&&a.id&&!_N(t,o,a.id,a.type,n))return!0}return!1}(t,e)}function IN(t,e=(null==t?void 0:t.currentTime)){if("function"!=typeof(null==t?void 0:t.computeBuffered))return!1;const n=bN(t,e),i=t.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=kN(t);if(!(r<=n+s))return!1;return o-n>=function(t,e){const n=Number(null==t||null===(e=t.settings)||void 0===e?void 0:e.waitingBufferAheadSeconds);return!Number.isFinite(n)||n<0?3:n}(t)-s||function(t,e,n,i){const r=function(t){const e=Array.isArray(null==t?void 0:t.placements)?t.placements:[];let n;for(let i=0;i<e.length;i+=1){const r=e[i],o=gm(r);if(!Number.isFinite(o))continue;const s="function"==typeof(null==t?void 0:t.getPlacementDuration)?t.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}(t);return!!Number.isFinite(r)&&(e>=r-i||n>=r-i)}(t,n,o,s)}const SN={[_v]:class extends gN{get name(){return _v}get defaults(){return{autoplay:Ky("autoplay")}}enter(){this.timeline.recordStableState(Sv),this.timeline.stopPlaybackClock()}play(){const t=EN(this.timeline),e=t?Iv:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t)return this.timeline.recordStableState(Tv),void this.timeline.transitionTo(Iv);this.timeline.transitionTo(e)}pause(){}handleDecodedFrame(t){if(!0!==this.settings.autoplay)return;if(!Array.isArray(this.timeline.placements)||!this.timeline.placements.length)return;if(EN(this.timeline))return;const e=this.timeline.getPlaybackStartState();this.log.info("[handleDecodedFrame] Autoplay enabled, starting playback!"),this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),this.timeline.transitionTo(e)}},[Ev]:class extends gN{get name(){return Ev}enter(t={}){const{from:e,to:n}=t;this.timeline.recordStableState(Tv),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("canplay",{from:e,to:n})}play(){}handleMainTrackUnderflow(){}pause(){this.timeline.transitionTo(Sv)}},[Tv]:class extends gN{get name(){return Tv}enter(t={}){const{from:e,to:n,fromFirstFramePending:i}=t;this.timeline.recordStableState(Tv),this.timeline.startPlaybackClock(),!0!==i&&this.emitPlayerStateEvent("canplay",{from:e,to:n}),this.emitPlayerStateEvent("playing",{from:e,to:n})}play(){}pause(){this.timeline.transitionTo(Sv)}handleClockTick(t){const e=this.timeline.currentTime;EN(this.timeline,e)&&(this.timeline.recordStableState(Tv),this.timeline.transitionTo(Iv))}},[Iv]:(Je=new WeakMap,Ze=new WeakMap,tn=new WeakSet,class extends gN{constructor(...t){super(...t),O(this,tn),F(this,Je,void 0),F(this,Ze,null)}get name(){return Iv}enter(t={}){const{from:e,to:n}=t;this.timeline.stopPlaybackClock(),A(tn,this,AN).call(this),A(tn,this,MN).call(this),this.emitPlayerStateEvent("waiting",{from:e,to:n}),A(tn,this,ON).call(this)}exit(){A(tn,this,NN).call(this),A(tn,this,FN).call(this)}play(){this.timeline.recordStableState(Tv);const t=A(tn,this,CN).call(this),e=t?Iv:this.timeline.getPlaybackStartState();this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t||this.timeline.transitionTo(e)}pause(){this.timeline.transitionTo(Sv)}handleMainTrackReady(t){const e=this.timeline.getLastStableState()||Sv;e!==Tv?this.timeline.transitionTo(e):A(tn,this,ON).call(this)}handleDecodedFrame(t){A(tn,this,ON).call(this)}handleMainTrackBufferUpdate(t){A(tn,this,ON).call(this)}}),[Sv]:class extends gN{get name(){return Sv}enter(t={}){const{from:e,to:n}=t;this.timeline.recordStableState(Sv),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("pause",{from:e,to:n})}play(){const t=EN(this.timeline),e=t?Iv:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t)return this.timeline.recordStableState(Tv),void this.timeline.transitionTo(Iv);this.timeline.transitionTo(e)}pause(){}},[Av]:class extends gN{get name(){return Av}enter(t={}){const{targetTime:e,returnState:n}=t;if(this.timeline&&"function"==typeof this.timeline.stopPlaybackClock&&this.timeline.stopPlaybackClock(),this.timeline&&"function"==typeof this.timeline.startSeeking)return void this.timeline.startSeeking(e,n);this.timeline.updateTime(e);const i=n===Tv||n===Ev,r=i&&"function"==typeof this.timeline.getPlaybackStartState?this.timeline.getPlaybackStartState(e):i?Tv:Sv;this.timeline.transitionTo(r,{fromSeeking:!0})}play(){var t;if(this.timeline&&"function"==typeof this.timeline.setSeekReturnState)return void this.timeline.setSeekReturnState(Tv);const e="function"==typeof(null===(t=this.timeline)||void 0===t?void 0:t.getPlaybackStartState)?this.timeline.getPlaybackStartState():Tv;this.timeline.transitionTo(e)}pause(){this.timeline&&"function"==typeof this.timeline.setSeekReturnState?this.timeline.setSeekReturnState(Sv):this.timeline.transitionTo(Sv)}handleDecodedFrame(t){this.timeline&&"function"==typeof this.timeline.maybeCompleteSeek&&this.timeline.maybeCompleteSeek(t)}},[Nv]:class extends gN{get name(){return Nv}enter(){this.timeline.resetClock(),this.timeline.transitionTo(_v,{fromReset:!0})}play(){}pause(){}get buffered(){return{start:0,end:0}}}};function AN(){var t;const e=null===(t=this.timeline)||void 0===t?void 0:t.trackBuffers;e&&"function"==typeof e.on&&(C(Je,this,(t=>this.handleMainTrackBufferUpdate(t))),e.on(dd.TRACK_BUFFER_UPDATE,M(Je,this)))}function NN(){var t;const e=null===(t=this.timeline)||void 0===t?void 0:t.trackBuffers;M(Je,this)&&e&&"function"==typeof e.off?(e.off(dd.TRACK_BUFFER_UPDATE,M(Je,this)),C(Je,this,null)):C(Je,this,null)}function MN(){if(null!==M(Ze,this))return;const t="function"==typeof(null==cd?void 0:cd.setInterval)?cd.setInterval.bind(cd):setInterval;C(Ze,this,t((()=>{var t;(null===(t=this.timeline)||void 0===t?void 0:t.state)===Iv&&A(tn,this,ON).call(this)}),200))}function FN(){null!==M(Ze,this)&&(("function"==typeof(null==cd?void 0:cd.clearInterval)?cd.clearInterval.bind(cd):clearInterval)(M(Ze,this)),C(Ze,this,null))}function CN(t=(t=>null===(t=this.timeline)||void 0===t?void 0:t.currentTime)()){return function(t,e=(null==t?void 0:t.currentTime),n={}){return!!TN(t,e)||!0===n.skipBufferResume||!IN(t,e)}(this.timeline,t)}function ON(t=(t=>null===(t=this.timeline)||void 0===t?void 0:t.currentTime)()){return(this.timeline.getLastStableState()||Sv)===Tv&&!A(tn,this,CN).call(this,t)&&(this.timeline.transitionTo(this.timeline.getPlaybackStartState(t)),!0)}function PN(t){return t&&("string"!=typeof t.state||"ready"===t.state)}function RN(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).some((t=>"video"===(null==t?void 0:t.type)))}function DN(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).some((t=>"video"===(null==t?void 0:t.type)||"image"===(null==t?void 0:t.type)))}function LN(t){return t===Tv||t===Ev}var BN=new WeakMap,zN=new WeakMap,WN=new WeakMap,$N=new WeakMap,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 WeakMap,QN=new WeakMap,JN=new WeakSet;class ZN{constructor(t={}){O(this,JN),F(this,BN,void 0),F(this,zN,void 0),F(this,WN,void 0),F(this,$N,void 0),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,null),F(this,KN,Sv),F(this,XN,[]),F(this,YN,new Set),F(this,QN,new Map),C(BN,this,t.getState),C(zN,this,t.getNode),C(WN,this,t.getPlacementsActiveAtTime),C($N,this,t.getLastStableState),C(jN,this,t.getPlaybackStartState),C(UN,this,t.clearVisualFrameBuffers),C(qN,this,t.updateTime),C(VN,this,t.transitionTo),C(GN,this,t.trigger)}start(t,e){const n=Number(t);if(!Number.isFinite(n))return;let i=e;i===Av?i=M(KN,this):i===Iv&&"function"==typeof M($N,this)&&(i=M($N,this).call(this)),C(KN,this,LN(i)?Tv:Sv),C(HN,this,n),M(YN,this).clear(),M(QN,this).clear(),C(XN,this,"function"==typeof M(WN,this)?M(WN,this).call(this,n):[]),"function"==typeof M(UN,this)&&M(UN,this).call(this),"function"==typeof M(qN,this)&&M(qN,this).call(this,n,{source:"seek"}),"function"==typeof M(GN,this)&&M(GN,this).call(this,dd.TIMELINE_SEEKING,{targetTime:n,placements:M(XN,this).slice()}),this.maybeComplete()}setReturnState(t){C(KN,this,LN(t)?Tv:Sv)}maybeComplete(t){if(("function"==typeof M(BN,this)?M(BN,this).call(this):void 0)!==Av)return;const e=M(HN,this);if(!Number.isFinite(e))return;const n=null==t?void 0:t.trackType,i=null==t?void 0:t.placementId;if(i&&"video"===n){const n=Number(null==t?void 0:t.pts);if(Number.isFinite(n)&&n>=e){M(YN,this).add(i);const t=M(QN,this).get(i);(!Number.isFinite(t)||n<t)&&M(QN,this).set(i,n)}}else i&&"image"===n&&function(t,e){const n=Number(null==t?void 0:t.pts),i=Number(null==t?void 0:t.duration);return!Number.isFinite(n)||(Number.isFinite(i)&&i>0?e>=n&&e<n+i:e>=n)}(t,e)&&M(YN,this).add(i);const r=Array.isArray(M(XN,this))?M(XN,this):[];if(r.length){if("function"==typeof M(zN,this)){for(let t=0;t<r.length;t+=1){const e=r[t],n=null==e?void 0:e.placementId;if(!n)return;const i=M(zN,this).call(this,e.nodeId);if(!PN(i))return;if(DN(i)&&!M(YN,this).has(n))return}A(JN,this,tM).call(this,e,r)}}else A(JN,this,tM).call(this,e,[])}dispose(){C(XN,this,[]),M(YN,this).clear(),M(QN,this).clear(),C(HN,this,null)}}function tM(t,e){const n=A(JN,this,eM).call(this,t,e);if("function"==typeof M(qN,this)&&M(qN,this).call(this,n,{source:"seek"}),C(HN,this,null),C(XN,this,[]),M(YN,this).clear(),M(QN,this).clear(),"function"==typeof M(GN,this)&&M(GN,this).call(this,dd.TIMELINE_SEEKED,{targetTime:t,placements:Array.isArray(e)?e.slice():[]}),"function"==typeof M(VN,this)){const t=M(KN,this)===Tv&&"function"==typeof M(jN,this)?M(jN,this).call(this,n):M(KN,this);M(VN,this).call(this,t,{fromSeeking:!0})}}function eM(t,e){const n=Number(t);if(!Number.isFinite(n))return t;if(!Array.isArray(e)||!e.length||"function"!=typeof M(zN,this))return n;let i=n;for(let t=0;t<e.length;t+=1){const n=e[t],r=null==n?void 0:n.placementId;if(!r)continue;if(!RN(M(zN,this).call(this,n.nodeId)))continue;const o=M(QN,this).get(r);Number.isFinite(o)&&o>i&&(i=o)}return i}function nM(t){if(t&&"function"==typeof t.close)try{t.close()}catch(t){}}function iM(t){if(!t)return;const e=Array.isArray(null==t?void 0:t.frames)?t.frames:[],n=null==t?void 0:t.current;(n?[n,...e]:e).forEach((t=>nM(null==t?void 0:t.frame)))}function rM(t){return gm(t)}function oM(t){return Number.isFinite(null==t?void 0:t.loopRootOffset)?t.loopRootOffset:rM(t)}function sM(t,e){return"string"==typeof(null==t?void 0:t.loopRootPlacementId)&&t.loopRootPlacementId?t.loopRootPlacementId:e}function aM(t){if("string"!=typeof t)return Number.NaN;const e=t.match(/(\d+)/);return e?Number(e[1]):Number.NaN}function lM(t){if(!t)return;const e=[[t.displayWidth,t.displayHeight],[t.codedWidth,t.codedHeight],[t.videoWidth,t.videoHeight],[t.naturalWidth,t.naturalHeight],[t.width,t.height]];for(let t=0;t<e.length;t+=1){const[n,i]=e[t],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}const cM=1e-6;function uM(t){return t&&("string"!=typeof t.state||"ready"===t.state)}function dM(t){const e=Number(t);return Number.isFinite(e)?e:0}function hM(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).filter((t=>"cue"===(null==t?void 0:t.type)&&Array.isArray(null==t?void 0:t.cues)))}function fM(t){return t&&"cue"===t.type&&Array.isArray(t.cues)?t.cues:[]}var 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 WeakSet;class _M{constructor(t={}){O(this,xM),F(this,pM,void 0),F(this,mM,void 0),F(this,vM,void 0),F(this,gM,void 0),F(this,yM,void 0),F(this,bM,void 0),F(this,kM,-1e-6),F(this,wM,null),C(pM,this,t.getPlacements),C(mM,this,t.getPlacementsActiveAtTime),C(vM,this,t.getPlacementDuration),C(gM,this,t.getNode),C(yM,this,t.triggerTimeline),C(bM,this,t.triggerNode)}handleSeeking(t,e){const n=dM(t);C(wM,this,n)}handleSeeked(t){const e=dM(t),n=M(wM,this);C(wM,this,null),Number.isFinite(n)?(A(xM,this,EM).call(this,n,e),C(kM,this,e)):C(kM,this,e)}handleTimeUpdate(t,e={}){const n=dM(t),i=M(kM,this);!0===(null==e?void 0:e.isSeeking)?C(kM,this,n):Number.isFinite(i)?n<=i?n<i&&C(kM,this,n-cM):(A(xM,this,TM).call(this,i,n),C(kM,this,n)):C(kM,this,n)}dispose(){C(wM,this,null),C(kM,this,-1e-6)}}function TM(t,e){const n="function"==typeof M(pM,this)?M(pM,this).call(this):[];A(xM,this,IM).call(this,n,t,e,{onlySticky:!1})}function EM(t,e){if("function"!=typeof M(mM,this))return;const n=M(mM,this).call(this,e);A(xM,this,IM).call(this,n,t,e,{onlySticky:!0})}function IM(t,e,n,i={}){if("function"!=typeof M(gM,this)||"function"!=typeof M(yM,this))return;if(!Array.isArray(t)||!t.length)return;const r=!0===i.onlySticky,o=[];for(let i=0;i<t.length;i+=1){const s=t[i],a=null==s?void 0:s.placementId,l=null==s?void 0:s.nodeId;if(!a||!l)continue;const c=M(gM,this).call(this,l);if(!uM(c))continue;const u=hM(c);if(!u.length)continue;const d=gm(s);if(!Number.isFinite(d))continue;const h=Number.isFinite(null==s?void 0:s.nodeOffsetOverride)?s.nodeOffsetOverride:0,f="function"==typeof M(vM,this)?M(vM,this).call(this,s):void 0,p="number"==typeof f&&Number.isFinite(f)?d+f:Number.POSITIVE_INFINITY,m=r?d-cM:e;for(let t=0;t<u.length;t+=1){const e=fM(u[t]);for(let i=0;i<e.length;i+=1){const s=e[i],c=dM(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:t,cueIndex:i}))}}}o.length&&(o.sort(((t,e)=>t.time!==e.time?t.time-e.time:t.placementOffset!==e.placementOffset?t.placementOffset-e.placementOffset:t.placementId!==e.placementId?t.placementId<e.placementId?-1:1:t.trackIndex!==e.trackIndex?t.trackIndex-e.trackIndex:t.cueIndex-e.cueIndex)),o.forEach((t=>{const e=t.cuepoint,n={time:t.time,nodeId:t.nodeId,placementId:t.placementId,cuepoint:e};M(yM,this).call(this,"cuepoint",n),M(yM,this).call(this,e.name,n),"function"==typeof M(bM,this)&&(M(bM,this).call(this,t.nodeId,"cuepoint",n),M(bM,this).call(this,t.nodeId,e.name,n))})))}let SM=class{#J;#Z=0;#tt=new Set;constructor(t){this.#J="string"==typeof t?t:""}claim(t){if(t)return this.#tt.add(t),t;let e;do{e=`${this.#J}${++this.#Z}`}while(this.#tt.has(e));return this.#tt.add(e),e}reset(){this.#Z=0,this.#tt.clear()}};const AM=24e3/1001;function NM(t){var e;const n=null==t?void 0:t.frame;if(!n||!0===n.__closed||!0===n.closed)return 0;if("function"==typeof n.allocationSize)try{const t=Number(n.allocationSize());if(Number.isFinite(t)&&t>0)return t}catch(t){}const i=Number(null==n?void 0:n.byteLength);if(Number.isFinite(i)&&i>0)return i;const r=Number(null==n||null===(e=n.data)||void 0===e?void 0:e.byteLength);if(Number.isFinite(r)&&r>0)return r;const o=function(t,e){const n=Number(null==t?void 0:t.width),i=Number(null==t?void 0:t.height);return Number.isFinite(n)&&Number.isFinite(i)&&n>0&&i>0?{width:n,height:i}:lM(e)}(t,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 MM=new WeakMap,FM=new WeakMap,CM=new WeakMap,OM=new WeakMap,PM=new WeakMap,RM=new WeakMap,DM=new WeakMap,LM=new WeakMap,BM=new WeakMap,zM=new WeakMap,WM=new WeakMap,$M=new WeakMap,jM=new WeakMap,UM=new WeakMap,qM=new WeakMap,VM=new WeakMap,GM=new WeakMap,HM=new WeakMap,KM=new WeakMap,XM=new WeakMap,YM=new WeakMap,QM=new WeakMap,JM=new WeakMap,ZM=new WeakMap,tF=new WeakMap,eF=new WeakMap,nF=new WeakMap,iF=new WeakMap,rF=new WeakMap,oF=new WeakMap,sF=new WeakMap,aF=new WeakMap,lF=new WeakMap,cF=new WeakSet;class uF extends sd{constructor(...t){super(...t),O(this,cF),F(this,MM,void 0),F(this,FM,void 0),F(this,CM,void 0),F(this,OM,void 0),F(this,PM,void 0),F(this,RM,!1),F(this,DM,[]),F(this,LM,new SM("placement-")),F(this,BM,[]),F(this,zM,new SM("renderplacement-")),F(this,WM,void 0),F(this,$M,void 0),F(this,jM,void 0),F(this,UM,!1),F(this,qM,new Set),F(this,VM,new Set),F(this,GM,new Map),F(this,HM,[]),F(this,KM,0),F(this,XM,new Set),F(this,YM,new Set),F(this,QM,Number.NEGATIVE_INFINITY),F(this,JM,[]),F(this,ZM,Number.NEGATIVE_INFINITY),F(this,tF,0),F(this,eF,void 0),F(this,nF,void 0),F(this,iF,new Map),F(this,rF,null),F(this,oF,void 0),F(this,sF,void 0),F(this,aF,void 0),F(this,lF,void 0);const[e,n={}]=t;C(MM,this,e),C(eF,this,n),C(PM,this,new sN(n)),C(WM,this,new hN(n)),C(OM,this,Sv),A(cF,this,wF).call(this),A(cF,this,xF).call(this),C(oF,this,new ZN({getState:()=>this.state,getNode:t=>M(MM,this)&&"function"==typeof M(MM,this).get?M(MM,this).get(t):void 0,getPlacementsActiveAtTime:t=>A(cF,this,eC).call(this,t,{endEpsilonSeconds:A(cF,this,uC).call(this)}),getLastStableState:()=>this.getLastStableState(),getPlaybackStartState:t=>this.getPlaybackStartState(t),clearVisualFrameBuffers:()=>A(cF,this,ZF).call(this),updateTime:(t,e)=>this.updateTime(t,e),transitionTo:(t,e)=>this.transitionTo(t,e),trigger:(t,e)=>this.trigger(t,e)})),C(sF,this,new _M({getPlacements:()=>M(DM,this).slice(),getPlacementsActiveAtTime:t=>A(cF,this,eC).call(this,t),getPlacementDuration:t=>A(cF,this,DF).call(this,t),getNode:t=>M(MM,this)&&"function"==typeof M(MM,this).get?M(MM,this).get(t):void 0,triggerTimeline:(t,e)=>this.trigger(t,e),triggerNode:(t,e,n)=>{const i=M(MM,this)&&"function"==typeof M(MM,this).get?M(MM,this).get(t):void 0;i&&"function"==typeof i.trigger&&i.trigger(e,n)}})),C(aF,this,(()=>{var t,e;null===(t=M(sF,this))||void 0===t||null===(e=t.handleSeeked)||void 0===e||e.call(t,this.currentTime)})),this.on(dd.TIMELINE_SEEKED,M(aF,this)),C(lF,this,(t=>A(cF,this,NF).call(this,t))),this.on("nodestart",M(lF,this)),this.transitionTo(_v)}get name(){return"Timeline"}get defaults(){return{snapToFps:AM,maxBufferedVideoFrames:24}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"computeBuffered","notifyDecodedFrame","getDecodedFrameStats","getActiveRenderPlacement","maybeCompleteSeek","getPlacementsActiveAtTime","hasDecodedFirstFrame","getDecodedVisualBuffer","getPlacementDuration","getNode"])}transitionTo(t,e={}){const n=M(CM,this),i=function(t,e,n={}){const i=SN[t];return i?new i(e,n):null}(t,this,M(eF,this)),r=e&&"object"==typeof e&&!Array.isArray(e)?{...e,from:n,to:t}:{from:n,to:t};i?(M(FM,this)&&"function"==typeof M(FM,this).exit&&M(FM,this).exit(),C(FM,this,i),C(CM,this,t),"function"==typeof i.enter&&i.enter(r),this.trigger(dd.TIMELINE_STATE_CHANGE,{from:n,to:t,options:e})):this.log.warn(`Unknown state "${t}"`)}recordStableState(t){C(OM,this,t)}getLastStableState(){return M(OM,this)}enableFirstFrameRenderedGate(){C(RM,this,!0)}getPlaybackStartState(t=this.currentTime){return this.shouldWaitForFirstRenderedFrame(t)?Ev:Tv}shouldWaitForFirstRenderedFrame(t=this.currentTime){if(!M(RM,this)||M(UM,this))return!1;const e=Number.isFinite(t)?t:this.currentTime,n=A(cF,this,eC).call(this,e);return Array.isArray(n)&&n.length>0}notifyFirstFrameRendered(){M(UM,this)||(C(UM,this,!0),this.state===Ev&&this.transitionTo(Tv,{fromFirstFramePending:!0}))}get state(){return M(CM,this)}get paused(){return M(CM,this)===_v||M(CM,this)===Sv}get currentTime(){return M(PM,this).currentTime}set currentTime(t){M(FM,this).seek(t)}get playbackRate(){return M(PM,this).playbackRate}set playbackRate(t){M(PM,this).playbackRate=t}play(){M(FM,this).play()}pause(){M(FM,this).pause()}reset(){M(FM,this).reset()}seekToPlacement(t){if(!t)throw new Error("Timeline.seekToPlacement requires placement id");A(cF,this,CF).call(this);const e=A(cF,this,sC).call(this,t);if(!e)throw new Error("Timeline.seekToPlacement requires placement id");const n=gm(e);if(!Number.isFinite(n))throw new Error("Timeline.seekToPlacement requires resolved placement offset");return this.currentTime=n,n}updateTime(t,e={}){var n,i;A(cF,this,CF).call(this),A(cF,this,OF).call(this),M(PM,this).seek(t),A(cF,this,tC).call(this,this.currentTime),A(cF,this,nC).call(this);const r="string"==typeof(null==e?void 0:e.source)?e.source:"set";null!==(n=M(sF,this))&&void 0!==n&&null!==(i=n.handleTimeUpdate)&&void 0!==i&&i.call(n,this.currentTime,{isSeeking:this.state===Av}),A(cF,this,MF).call(this,this.currentTime),A(cF,this,KF).call(this,this.currentTime),this.trigger(dd.TIMELINE_TIME_UPDATE,hd(this.currentTime,r))}startSeeking(t,e){var n,i;null!==(n=M(sF,this))&&void 0!==n&&null!==(i=n.handleSeeking)&&void 0!==i&&i.call(n,this.currentTime,t),M(oF,this)&&"function"==typeof M(oF,this).start&&M(oF,this).start(t,e)}setSeekReturnState(t){M(oF,this)&&"function"==typeof M(oF,this).setReturnState&&M(oF,this).setReturnState(t)}maybeCompleteSeek(t){M(oF,this)&&"function"==typeof M(oF,this).maybeComplete&&M(oF,this).maybeComplete(t)}startPlaybackClock(){M(PM,this).play()}stopPlaybackClock(){M(PM,this).pause()}resetClock(){var t,e;C(UM,this,!1),M(PM,this).reset(),this.trigger(dd.TIMELINE_RESET,{reason:"reset"}),null===(t=M(sF,this))||void 0===t||null===(e=t.dispose)||void 0===e||e.call(t)}applyTimelineDefinition(t={}){const e=Array.isArray(null==t?void 0:t.placements)?t.placements:[],n=Array.isArray(null==t?void 0:t.renderPlacements)?t.renderPlacements:[];A(cF,this,dF).call(this),A(cF,this,hF).call(this,e),A(cF,this,fF).call(this,n),this.currentTime=0}placeOnTimeline(t,e,n={}){const i=t&&"object"==typeof t?t.id:t;if(!i)throw new Error("Timeline.placeOnTimeline requires node id");const r=M(LM,this).claim(n.placementId),o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=_m(e);if("string"==typeof e&&e.includes("@")&&!a)throw new Error("Timeline.placeOnTimeline requires valid placement reference");const{wantsEndOffset:l,endOffsetSeconds:c}=a?{wantsEndOffset:!1}:xm(e,n);let u,d,h,f=!1;const p=null!==a;if(A(cF,this,CF).call(this),a){const t=M(DM,this).find((t=>(null==t?void 0:t.placementId)===a.placementId));if(!t)throw new Error("Timeline.placeOnTimeline requires valid placement reference");d=t.placementId,h=a.anchor;const e=gm(t);if("start"===a.anchor)Number.isFinite(e)?u=A(cF,this,LF).call(this,e,{nodeOffsetOverride:o}):f=!0;else{const n=A(cF,this,DF).call(this,t);if(Number.isFinite(e)&&n>0){const t=e+n,i=A(cF,this,LF).call(this,t,{nodeOffsetOverride:o});u=Math.max(i,t)}else f=!0}}else if(l){const t=n.offsetAnchorPlacementId?M(DM,this).find((t=>(null==t?void 0:t.placementId)===n.offsetAnchorPlacementId)):M(DM,this).length?M(DM,this)[M(DM,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==t?void 0:t.placementId),d){const e=gm(t),n=A(cF,this,DF).call(this,t);Number.isFinite(e)&&n>0?u=A(cF,this,LF).call(this,e+n-c,{nodeOffsetOverride:o}):(f=!0,h="end")}else u=A(cF,this,LF).call(this,-c,{nodeOffsetOverride:o})}else u=wm(e),u=A(cF,this,LF).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 vN({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(DM,this).push(y),bm(M(DM,this)),A(cF,this,GF).call(this,y),A(cF,this,qF).call(this),f&&d){const t=M(DM,this).find((t=>(null==t?void 0:t.placementId)===d));A(cF,this,zF).call(this,null==t?void 0:t.nodeId)}return this.trigger(dd.PLACEMENT_ADDED,y),r}placeRenderNodeOnTimeline(t,e,n,i={}){const r="string"==typeof t?t:null==t?void 0:t.type;if(!r||"string"!=typeof r)throw new Error("Timeline.placeRenderNodeOnTimeline requires render node type");const o=A(cF,this,BF).call(this,e,i),s=o.offset,a=!0===o.offsetPending,l=o.offsetAnchorPlacementId,c=o.offsetAnchorEdge,u=o.offsetAnchorIsReference,d=M(zM,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 t=s,e=s+p;Tm(M(BM,this),t,e,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements")}if(M(BM,this).push(v),bm(M(BM,this)),a&&l){const t=M(DM,this).find((t=>(null==t?void 0:t.placementId)===l));A(cF,this,zF).call(this,null==t?void 0:t.nodeId)}return this.trigger(dd.RENDER_PLACEMENT_ADDED,v),d}get placements(){return M(DM,this).slice()}getPlacementsActiveAtTime(t){return A(cF,this,eC).call(this,t)}getNodesAtTime(t){const e=A(cF,this,aC).call(this,t);if(!Number.isFinite(e))return[];const n=A(cF,this,eC).call(this,e),i=[];return n.forEach((t=>{const e=this.getNode(null==t?void 0:t.nodeId);e&&i.push(e)})),i}getPlacementDuration(t){return A(cF,this,DF).call(this,t)}getNode(t){if(M(MM,this)&&"function"==typeof M(MM,this).get)return M(MM,this).get(t)}get renderPlacements(){return M(BM,this).slice()}get placementsAhead(){const t=this.currentTime;return M(DM,this).filter((e=>{const n=gm(e);if(!Number.isFinite(n))return!1;const i=A(cF,this,DF).call(this,e);return"number"==typeof i?n+i>t:n>=t}))}get buffered(){return M(FM,this)?M(FM,this).buffered:{start:0,end:0}}get trackBuffers(){return M(WM,this)}onDispose(){A(cF,this,bF).call(this),M(VM,this)&&M(VM,this).clear(),M(sF,this)&&"function"==typeof M(sF,this).dispose&&M(sF,this).dispose(),C(sF,this,null),A(cF,this,yF).call(this),A(cF,this,kF).call(this),M(oF,this)&&"function"==typeof M(oF,this).dispose&&M(oF,this).dispose(),C(oF,this,null),M(PM,this)&&"function"==typeof M(PM,this).dispose&&(M(nF,this)&&"function"==typeof M(PM,this).off&&(M(PM,this).off("tick",M(nF,this)),C(nF,this,null)),M(PM,this).dispose(),C(PM,this,null)),A(cF,this,jF).call(this),C(FM,this,null),C(CM,this,null),C(DM,this,[]),C(BM,this,[]),A(cF,this,UF).call(this),A(cF,this,qF).call(this),M(iF,this).clear(),C(rF,this,null)}notifyDecodedFrame(t={}){const e=null==t?void 0:t.placementId,n=null==t?void 0:t.trackType;if(!e||!n)return;const i=`${e}:${n}`;M(qM,this).add(i),A(cF,this,JF).call(this,t),A(cF,this,nC).call(this),M(FM,this)&&"function"==typeof M(FM,this).handleDecodedFrame&&M(FM,this).handleDecodedFrame(t)}getDecodedFrameStats(){return function(t){const e={totalBytes:0,frames:0,available:!1};if(!t||"function"!=typeof t.values)return e;for(const n of t.values()){const t=[];null!=n&&n.current&&t.push(n.current),Array.isArray(null==n?void 0:n.frames)&&t.push(...n.frames),t.forEach((t=>{const n=null==t?void 0:t.frame;if(!n||!0===n.__closed||!0===n.closed)return;e.frames+=1;const i=NM(t);Number.isFinite(i)&&i>0&&(e.totalBytes+=i)}))}return e.available=!0,e}(M(iF,this))}hasDecodedFirstFrame(t,e){return!(!t||!e)&&M(qM,this).has(`${t}:${e}`)}getDecodedVisualBuffer(t,e){if(t&&e)return M(iF,this).get(`${t}:${e}`)}computeBuffered(t){const e=M(MM,this);if(e&&"function"==typeof e.get)return M(WM,this).computeBuffered(M(DM,this),t,e)}getActiveRenderPlacement(t=this.currentTime){const e=Number.isFinite(t)?t:this.currentTime,n=Array.isArray(M(BM,this))?M(BM,this):[];if(!n.length)return;let i;for(let t=0;t<n.length;t+=1){const r=n[t];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?e>=o&&e<o+s:e>=o)&&(i=r)}return i}}function dF(){C(UM,this,!1),this.trigger(dd.TIMELINE_RESET,{reason:"switch"}),A(cF,this,ZF).call(this),M(WM,this)&&"function"==typeof M(WM,this).reset&&M(WM,this).reset(),M(VM,this)&&M(VM,this).clear(),C(DM,this,[]),C(BM,this,[]),A(cF,this,UF).call(this),A(cF,this,qF).call(this),M(LM,this).reset(),M(zM,this).reset()}function hF(t=[]){for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||!n.nodeId)continue;const i=A(cF,this,pF).call(this,n),r=A(cF,this,vF).call(this,n);this.placeOnTimeline(n.nodeId,r,i)}}function fF(t=[]){for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||!n.type)continue;const i=A(cF,this,mF).call(this,n),r=A(cF,this,gF).call(this,n);this.placeRenderNodeOnTimeline(n.type,r,n.duration,i)}}function pF(t){const e={};return t.placementId&&(e.placementId=t.placementId),Number.isFinite(t.nodeOffsetOverride)&&(e.nodeOffsetOverride=t.nodeOffsetOverride),Number.isFinite(t.nodeDurationOverride)&&(e.nodeDurationOverride=t.nodeDurationOverride),!0===t.offsetPending&&(e.offsetPending=!0,t.offsetAnchorPlacementId&&(e.offsetAnchorPlacementId=t.offsetAnchorPlacementId),t.offsetAnchorEdge&&(e.offsetAnchorEdge=t.offsetAnchorEdge)),Number.isFinite(t.offsetEndSeconds)&&(e.offsetEndSeconds=t.offsetEndSeconds),!0===t.loop&&(e.loop=!0),t.loopRootPlacementId&&(e.loopRootPlacementId=t.loopRootPlacementId),Number.isFinite(t.loopRootOffset)&&(e.loopRootOffset=t.loopRootOffset),e}function mF(t){const e={};return t.renderPlacementId&&(e.renderPlacementId=t.renderPlacementId),t.params&&"object"==typeof t.params&&(e.params=t.params),e}function vF(t){if(!0===t.offsetPending&&t.offsetAnchorPlacementId&&t.offsetAnchorEdge){if(!0===t.offsetAnchorIsReference)return`${t.offsetAnchorPlacementId}@${t.offsetAnchorEdge}`;if("end"===t.offsetAnchorEdge)return Number.isFinite(t.offsetEndSeconds)&&t.offsetEndSeconds>0?-t.offsetEndSeconds:"end"}return"string"==typeof t.offset||Number.isFinite(t.offset)?t.offset:0}function gF(t){return!0===t.offsetPending&&t.offsetAnchorPlacementId&&t.offsetAnchorEdge&&!0===t.offsetAnchorIsReference?`${t.offsetAnchorPlacementId}@${t.offsetAnchorEdge}`:"string"==typeof t.offset||Number.isFinite(t.offset)?t.offset:0}function yF(){M(FM,this)&&"function"==typeof M(FM,this).exit&&M(FM,this).exit()}function bF(){M(aF,this)&&"function"==typeof this.off&&(this.off(dd.TIMELINE_SEEKED,M(aF,this)),C(aF,this,null)),M(lF,this)&&"function"==typeof this.off&&(this.off("nodestart",M(lF,this)),C(lF,this,null))}function kF(){M(WM,this)&&(M($M,this)&&(M(WM,this).off("track:underflow",M($M,this)),C($M,this,null)),M(jM,this)&&(M(WM,this).off("track:ready",M(jM,this)),C(jM,this,null)),"function"==typeof M(WM,this).dispose&&M(WM,this).dispose(),C(WM,this,null))}function wF(){M(WM,this)&&"function"==typeof M(WM,this).on&&(C($M,this,(t=>A(cF,this,TF).call(this,t))),C(jM,this,(t=>A(cF,this,EF).call(this,t))),M(WM,this).on(dd.TRACK_UNDERFLOW,M($M,this)),M(WM,this).on(dd.TRACK_READY,M(jM,this)))}function xF(){M(PM,this)&&"function"==typeof M(PM,this).on&&(C(nF,this,(t=>A(cF,this,_F).call(this,t))),M(PM,this).on(dd.CLOCK_TICK,M(nF,this)))}function _F(t){var e,n;A(cF,this,CF).call(this),A(cF,this,nC).call(this),null!==(e=M(sF,this))&&void 0!==e&&null!==(n=e.handleTimeUpdate)&&void 0!==n&&n.call(e,this.currentTime,{isSeeking:!1}),A(cF,this,MF).call(this,this.currentTime),this.trigger(dd.TIMELINE_TIME_UPDATE,hd(this.currentTime,"clock")),M(FM,this)&&"function"==typeof M(FM,this).handleClockTick&&M(FM,this).handleClockTick(t)}function TF(t){A(cF,this,CF).call(this);const e=A(cF,this,IF).call(this);e&&(null==t?void 0:t.trackType)===e.trackType&&(M(FM,this)&&"function"==typeof M(FM,this).handleMainTrackUnderflow?M(FM,this).handleMainTrackUnderflow(t):this.transitionTo(Iv))}function EF(t){if(A(cF,this,CF).call(this),this.state!==Iv)return;const e=A(cF,this,IF).call(this);if(!e)return;if((null==t?void 0:t.trackType)!==e.trackType)return;if(M(FM,this)&&"function"==typeof M(FM,this).handleMainTrackReady)return void M(FM,this).handleMainTrackReady(t);const n=this.getLastStableState()||Sv;this.transitionTo(n)}function IF(t=this.currentTime){const e=A(cF,this,AF).call(this,t);if(!e)return;const n=M(MM,this)&&"function"==typeof M(MM,this).get?M(MM,this).get(e.nodeId):void 0;if(!n)return;const i=A(cF,this,SF).call(this,n);return i?{placement:e,trackType:i}:void 0}function SF(t){var e;const n=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[];let i;if(null!=t&&t.mainTrackId){const e=n.find((e=>(null==e?void 0:e.id)===t.mainTrackId));i=null==e?void 0:e.type}if(i||(i=null===(e=n.find((t=>null==t?void 0:t.type)))||void 0===e?void 0:e.type),"video"===i||"audio"===i||"image"===i)return i}function AF(t=this.currentTime){const e=M(DM,this)||[];let n;for(let i=0;i<e.length;i+=1){const r=e[i],o=gm(r);if(!Number.isFinite(o))continue;const s=A(cF,this,DF).call(this,r);if(Number.isFinite(s)){if(t>=o&&t<o+s)return r}else if(t<=o)return r;!n&&t<o&&(n=r)}return n}function NF(t={}){if(this.state!==Tv)return;const e=null==t?void 0:t.placementId;if(!e)return;const n=A(cF,this,sC).call(this,e);n&&A(cF,this,FF).call(this,n)}function MF(t=this.currentTime){if(this.state!==Tv)return;const e=A(cF,this,eC).call(this,t);Array.isArray(e)&&e.length&&e.forEach((t=>A(cF,this,FF).call(this,t)))}function FF(t){const e=null==t?void 0:t.placementId;if(!e)return;if(M(VM,this).has(e))return;if(!t||!0!==t.loop)return;if(!t.nodeId)return;const n=A(cF,this,DF).call(this,t);if(!Number.isFinite(n)||n<=0)return;const i=gm(t);if(!Number.isFinite(i))return;const r=i+n;if(!Number.isFinite(r))return;const o=t.loopRootPlacementId||t.placementId,s=Number.isFinite(t.loopRootOffset)?t.loopRootOffset:i;M(VM,this).add(e),this.placeOnTimeline(t.nodeId,r,{nodeOffsetOverride:t.nodeOffsetOverride,nodeDurationOverride:t.nodeDurationOverride,loop:!0,loopRootPlacementId:o,loopRootOffset:s})}function CF(){const t=km(M(DM,this),{getPlacementDuration:t=>A(cF,this,DF).call(this,t),snapPlacementOffset:(t,e)=>A(cF,this,LF).call(this,t,{nodeOffsetOverride:null==e?void 0:e.nodeOffsetOverride}),onResolvedPlacement:(t,e)=>{!0!==t.loop||Number.isFinite(t.loopRootOffset)||(t.loopRootOffset=t.offset),A(cF,this,WF).call(this,null==e?void 0:e.nodeId)}});return t.updated&&(A(cF,this,qF).call(this),t.resolvedPlacements.forEach((t=>{A(cF,this,GF).call(this,t),this.trigger(dd.PLACEMENT_ADDED,t)}))),t.updated}function OF(){if(!M(BM,this).length||!M(DM,this).length)return!1;const t=new Map;M(DM,this).forEach((e=>{(null==e?void 0:e.placementId)&&t.set(e.placementId,e)}));const e=M(BM,this).filter((t=>!0===(null==t?void 0:t.offsetPending)));if(!e.length)return!1;let n=!1;const i=[];for(let r=0;r<e.length;r+=1){const o=e[r];A(cF,this,PF).call(this,o,t)&&(n=!0,i.push(o))}return n&&(bm(M(BM,this)),i.forEach((t=>{this.trigger(dd.RENDER_PLACEMENT_ADDED,t)}))),n}function PF(t,e){const n=null==t?void 0:t.offsetAnchorPlacementId,i=null==t?void 0:t.offsetAnchorEdge;if(!n||!i)return!1;const r=e.get(n);if(!r||!0===r.offsetPending)return!1;const o=A(cF,this,RF).call(this,r,t);if(!Number.isFinite(o))return!1;t.offset=o,t.offsetPending=!1,t.offsetAnchorPlacementId=void 0,t.offsetAnchorEdge=void 0,t.offsetAnchorIsReference=void 0;const s=t.offset,a=t.offset+t.duration;return Tm(M(BM,this).filter((e=>e!==t&&!0!==(null==e?void 0:e.offsetPending))),s,a,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements"),A(cF,this,WF).call(this,null==r?void 0:r.nodeId),!0}function RF(t,e){const n=gm(t);if(!Number.isFinite(n))return;if("start"===e.offsetAnchorEdge)return A(cF,this,LF).call(this,n);const i=A(cF,this,DF).call(this,t);if(!(i>0))return;const r=n+i;if(!Number.isFinite(r))return;const o=A(cF,this,LF).call(this,r);return!0===e.offsetAnchorIsReference?Math.max(o,r):o}function DF(t){return mm(t,M(MM,this))}function LF(t,e={}){var n;return function(t,e={},n){const i=Number(n);if(!(i>0))return t;const r=Number(t);if(!Number.isFinite(r))return t;const o=Number.isFinite(null==e?void 0:e.nodeOffsetOverride)?e.nodeOffsetOverride:0,s=r-o;return Math.round(s*i)/i+o}(t,e,null===(n=this.settings)||void 0===n?void 0:n.snapToFps)}function BF(t,e={}){const n=_m(t);if("string"==typeof t&&t.includes("@")&&!n)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");if(!n){const n=wm(t);return{offset:A(cF,this,LF).call(this,n,e)}}const i=M(DM,this).find((t=>(null==t?void 0:t.placementId)===n.placementId));if(!i)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");const r=gm(i);if("start"===n.anchor)return Number.isFinite(r)?{offset:A(cF,this,LF).call(this,r,e)}:{offset:void 0,offsetPending:!0,offsetAnchorPlacementId:i.placementId,offsetAnchorEdge:"start",offsetAnchorIsReference:!0};const o=A(cF,this,DF).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(cF,this,LF).call(this,s,e);return{offset:Math.max(a,s)}}function zF(t){if(!t||!M(MM,this)||"function"!=typeof M(MM,this).get)return;if(M(GM,this).has(t))return;let e;try{e=M(MM,this).get(t)}catch(t){return}if(!e||"function"!=typeof e.on)return;if("ready"===e.state&&e.duration>0)return void this.updateTime(this.currentTime);const n=()=>{this.updateTime(this.currentTime),A(cF,this,WF).call(this,t)};e.on(dd.NODE_LOADED,n),M(GM,this).set(t,n)}function WF(t){if(!t)return;if(A(cF,this,$F).call(this,t))return;const e=M(GM,this).get(t);if(!e)return;let n;try{n=M(MM,this).get(t)}catch(t){n=null}n&&"function"==typeof n.off&&n.off(dd.NODE_LOADED,e),M(GM,this).delete(t)}function $F(t){if(!t)return!1;const e=new Map;M(DM,this).forEach((t=>{(null==t?void 0:t.placementId)&&e.set(t.placementId,t)}));const n=n=>{if(null==n||!n.offsetPending||null==n||!n.offsetAnchorPlacementId)return!1;const i=e.get(n.offsetAnchorPlacementId);return(null==i?void 0:i.nodeId)===t};return!!M(DM,this).some((t=>n(t)))||!!M(BM,this).some((t=>n(t)))}function jF(){M(GM,this).size&&M(MM,this)?(M(GM,this).forEach(((t,e)=>{let n;try{n=M(MM,this).get(e)}catch(t){n=null}n&&"function"==typeof n.off&&n.off(dd.NODE_LOADED,t)})),M(GM,this).clear()):M(GM,this).clear()}function UF(){C(HM,this,[]),C(KM,this,0),M(XM,this).clear(),M(YM,this).clear(),C(QM,this,Number.NEGATIVE_INFINITY)}function qF(){C(JM,this,[]),C(tF,this,0),C(ZM,this,Number.NEGATIVE_INFINITY)}function VF(t,e){const n=M(HM,this),i={placementId:t,endTime:e};if(!n.length||e>=n[n.length-1].endTime)return void n.push(i);const r=n.findIndex((t=>e<t.endTime)),o=-1===r?n.length:r;n.splice(o,0,i),o<M(KM,this)&&C(KM,this,M(KM,this)+1)}function GF(t){const e=null==t?void 0:t.placementId;if(!e||M(XM,this).has(e))return;const n=gm(t),i=A(cF,this,DF).call(this,t);if(!Number.isFinite(n)||!Number.isFinite(i)||i<0)return void M(YM,this).add(e);const r=n+i;Number.isFinite(r)&&(M(XM,this).add(e),M(YM,this).delete(e),A(cF,this,VF).call(this,e,r))}function HF(){M(YM,this).size&&Array.from(M(YM,this)).forEach((t=>{const e=A(cF,this,sC).call(this,t);e?A(cF,this,GF).call(this,e):M(YM,this).delete(t)}))}function KF(t){const e=Number(t);if(!Number.isFinite(e))return;if(e<M(QM,this))return void C(QM,this,e);if(C(QM,this,e),A(cF,this,HF).call(this),!M(HM,this).length)return;const n=new Set;let i=M(KM,this);for(;i<M(HM,this).length;){const t=M(HM,this)[i];if(!t||!Number.isFinite(t.endTime)||t.endTime>e)break;t.placementId&&n.add(t.placementId),i+=1}i!==M(KM,this)&&(C(KM,this,i),n.size&&(A(cF,this,QF).call(this,n),A(cF,this,XF).call(this,n)))}function XF(t){if(t&&t.size)for(const e of M(qM,this)){const n=e.split(":")[0];t.has(n)&&M(qM,this).delete(e)}}function YF(t){const e=Array.isArray(null==t?void 0:t.frames)?t.frames:[],n=null==t?void 0:t.current;(n?[n,...e]:e).forEach((t=>{const e=null==t?void 0:t.frame;if(e&&"function"==typeof e.close)try{e.close()}catch(t){}}))}function QF(t){if(t&&t.size)for(const[e,n]of M(iF,this).entries())t.has(null==n?void 0:n.placementId)&&(A(cF,this,YF).call(this,n),M(iF,this).delete(e))}function JF(t={}){var e;const n=null==t?void 0:t.placementId,i=null==t?void 0:t.nodeId,r=null==t?void 0:t.trackId,o=null==t?void 0:t.segmentId,s=null==t?void 0:t.trackType;if(!(n&&i&&r&&o))return;if("video"!==s&&"image"!==s)return;const a=(null==t?void 0:t.frame)||(null==t?void 0:t.data);if(!a)return;"video"===s&&"object"==typeof a&&"function"==typeof a.close&&(a.__keepOpen=!0);const l=lM(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==t?void 0:t.pts)?t.pts:void 0;if(!Number.isFinite(d))return;const h=Number.isFinite(null==t?void 0:t.duration)?t.duration:void 0,f=`${n}:${r}`,p=M(iF,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 t=g.findIndex((t=>t.presentationTime>v.presentationTime));-1===t&&(t=g.length),g.splice(t,0,v)}const b=Number(null===(e=this.settings)||void 0===e?void 0:e.maxBufferedVideoFrames);if("video"===s&&Number.isFinite(b)&&b>0&&g.length>b){const t=g.length-b;for(let e=0;e<t;e+=1){const t=g.pop(),e=null==t?void 0:t.frame;if(e&&"function"==typeof e.close)try{e.close()}catch(t){}}}p||M(iF,this).set(f,m)}function ZF(){for(const t of M(iF,this).values())A(cF,this,YF).call(this,t);M(iF,this).clear(),C(rF,this,null),M(qM,this).clear()}function tC(t){const e=Number.isFinite(t)?t:this.currentTime;if(!Number.isFinite(e))return;e<M(ZM,this)&&(C(JM,this,[]),C(tF,this,0));const n=Array.isArray(M(DM,this))?M(DM,this):[],i=[],r=new Set;M(JM,this).forEach((t=>{A(cF,this,dC).call(this,t,e)&&(i.push(t),(null==t?void 0:t.placementId)&&r.add(t.placementId))}));let o=M(tF,this);for(;o<n.length;){const t=n[o],s=gm(t);if(!Number.isFinite(s))break;if(s>e)break;if(A(cF,this,dC).call(this,t,e)){const e=null==t?void 0:t.placementId;e&&r.has(e)||(i.push(t),e&&r.add(e))}o+=1}C(JM,this,i),C(tF,this,o),C(ZM,this,e)}function eC(t,e={}){const n=Number.isFinite(t)?t:this.currentTime,i=Number.isFinite(null==e?void 0:e.endEpsilonSeconds)?e.endEpsilonSeconds:0;return 0===i&&n===this.currentTime&&n===M(ZM,this)?M(JM,this).slice():(Array.isArray(M(DM,this))?M(DM,this):[]).filter((t=>A(cF,this,dC).call(this,t,n,i)))}function nC(){const t=this.currentTime,e=A(cF,this,rC).call(this,t);if(!e.length)return void C(rF,this,null);const n=this.getActiveRenderPlacement(t),i=A(cF,this,oC).call(this,e,n);(i!==M(rF,this)||A(cF,this,iC).call(this,t,n))&&(C(rF,this,i),this.trigger(dd.VISUAL_FRAMES_AVAILABLE,{time:t,frames:e}))}function iC(t,e){const n=e||this.getActiveRenderPlacement(t);if(!n)return!1;if(!Xm.doesRenderNodeTypeRequireFrameCadence(null==n?void 0:n.type))return!1;const i=n.duration;return"number"==typeof i&&i>0}function rC(t){return function(t={}){const e=t.buffers,n=t.time,i=t.getPlacementById,r=t.isPlacementActiveAtTime,o=t.getPlacementDuration,s=[];if(!e||"function"!=typeof e.entries)return[];const a=[];for(const[t,c]of e.entries()){const e=null==c?void 0:c.placementId,u="function"==typeof i?i(e):void 0;if(!u){iM(c),a.push(t);continue}if("function"==typeof r&&!r(u,n)){const e=rM(u),i="function"==typeof o?o(u):void 0;Number.isFinite(i)&&Number.isFinite(e)&&n>=e+i&&(iM(c),a.push(t));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 t=c.current,e=d.shift();c.current=e,t&&t!==e&&nM(null==t?void 0:t.frame)}if(!c.current)continue;const h={placementId:e,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:e,placementOffset:rM(u),placementSortOffset:oM(u),placementSortId:sM(u,e)})}return a.forEach((t=>{e.delete(t)})),s.sort(((t,e)=>{const n=Number.isFinite(null==t?void 0:t.placementSortOffset)?t.placementSortOffset:Number.isFinite(null==t?void 0:t.placementOffset)?t.placementOffset:0,i=Number.isFinite(null==e?void 0:e.placementSortOffset)?e.placementSortOffset:Number.isFinite(null==e?void 0:e.placementOffset)?e.placementOffset:0;if(n!==i)return n-i;const r=(null==t?void 0:t.placementSortId)||(null==t?void 0:t.placementId),o=(null==e?void 0:e.placementSortId)||(null==e?void 0:e.placementId),s=aM(r),a=aM(o);return Number.isFinite(s)&&Number.isFinite(a)&&s!==a?s-a:r&&o&&r!==o?r<o?-1:1:function(t,e){const n=(null==t?void 0:t.frame)||{},i=(null==e?void 0:e.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)}(t,e)})),s.map((t=>t.frame))}({buffers:M(iF,this),time:t,getPlacementById:t=>A(cF,this,sC).call(this,t),isPlacementActiveAtTime:(t,e)=>A(cF,this,dC).call(this,t,e),getPlacementDuration:t=>A(cF,this,DF).call(this,t)})}function oC(t,e){return`${e?`render:${e.renderPlacementId||e.type||"unknown"}`:"render:default"}|${t.map((t=>`${t.nodeId}:${t.trackId}:${t.segmentId}@${t.presentationTime}`)).join("|")}`}function sC(t){if(t)return(M(DM,this)||[]).find((e=>(null==e?void 0:e.placementId)===t))}function aC(t){if("end"===t){const t=A(cF,this,lC).call(this);if(!Number.isFinite(t))return;const e=A(cF,this,cC).call(this);return Math.max(0,t-Math.min(t,e))}const e=Number(t);return Number.isFinite(e)?e:0}function lC(){let t;return(Array.isArray(M(DM,this))?M(DM,this):[]).forEach((e=>{const n=gm(e);if(!Number.isFinite(n))return;const i=A(cF,this,DF).call(this,e);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(t)||r>t)&&(t=r)})),t}function cC(){const t=A(cF,this,uC).call(this);return t>0?t:.001}function uC(){var t;const e=Number(null===(t=this.settings)||void 0===t?void 0:t.snapToFps);return!Number.isFinite(e)||e<=0?0:.5/e}function dC(t,e,n=0){if(!ym(t,e,M(MM,this)))return!1;const i=Number(n);if(!Number.isFinite(i)||i<=0)return!0;const r=A(cF,this,DF).call(this,t);if(!Number.isFinite(r))return!0;const o=gm(t);return!Number.isFinite(o)||e<o+r-i}var hC=new WeakMap,fC=new WeakMap,pC=new WeakMap,mC=new WeakMap,vC=new WeakMap,gC=new WeakMap,yC=new WeakMap,bC=new WeakMap,kC=new WeakMap,wC=new WeakMap,xC=new WeakMap,_C=new WeakMap,TC=new WeakMap,EC=new WeakMap,IC=new WeakMap,SC=new WeakMap,AC=new WeakMap,NC=new WeakSet;class MC extends sd{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(...t){super(...t),O(this,NC),F(this,hC,void 0),F(this,fC,void 0),F(this,pC,1),F(this,mC,1),F(this,vC,1),F(this,gC,""),F(this,yC,0),F(this,bC,[]),F(this,kC,null),F(this,wC,void 0),F(this,xC,[]),F(this,_C,null),F(this,TC,null),F(this,EC,0),F(this,IC,0),F(this,SC,0),F(this,AC,void 0);const[e]=t;C(hC,this,e),C(EC,this,Fy()),C(AC,this,A(NC,this,FC).call(this)),A(NC,this,CC).call(this),A(NC,this,OC).call(this),A(NC,this,BC).call(this),A(NC,this,DC).call(this)}get publicAPI(){return M(AC,this)}calcScore(){A(NC,this,HC).call(this)}onDispose(){M(hC,this)&&M(fC,this)&&"function"==typeof M(hC,this).off&&M(hC,this).off(dd.TIMELINE_PLAYER_STATE,M(fC,this)),C(fC,this,null),A(NC,this,LC).call(this),A(NC,this,zC).call(this),C(hC,this,null),C(xC,this,[]),C(bC,this,[]),C(AC,this,null)}}function FC(){const t=this;return{get score(){return M(pC,t)},get status(){return M(gC,t)},get streamQualityScore(){return M(mC,t)},get fpsScore(){return M(vC,t)},get browserFps(){return M(yC,t)},get waitingSeconds(){return M(IC,t)/1e3},get playingSeconds(){return M(SC,t)/1e3}}}function CC(){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 OC(){M(hC,this)&&"function"==typeof M(hC,this).on&&(C(fC,this,(t=>A(NC,this,PC).call(this,t))),M(hC,this).on(dd.TIMELINE_PLAYER_STATE,M(fC,this)))}function PC(t={}){const e="string"==typeof(null==t?void 0:t.event)?t.event:"";"playing"!==e?"waiting"!==e?"pause"!==e&&"seeking"!==e&&"seeked"!==e&&"reset"!==e||A(NC,this,RC).call(this,null):A(NC,this,RC).call(this,"waiting"):A(NC,this,RC).call(this,"playing")}function RC(t){if(t===M(_C,this))return;const e=Fy();M(_C,this)&&Number.isFinite(M(TC,this))&&M(xC,this).push({state:M(_C,this),startMs:M(TC,this),endMs:e}),C(_C,this,t),C(TC,this,t?e:null),A(NC,this,jC).call(this,e)}function DC(){const t=Number(this.settings.calcScoreInterval);!Number.isFinite(t)||t<=0||(C(wC,this,(()=>A(NC,this,HC).call(this))),pw(M(wC,this),1e3*t))}function LC(){M(wC,this)&&mw(M(wC,this)),C(wC,this,null)}function BC(){if("function"!=typeof rw)return;const t=()=>{if(this._disposed)return;const e=Fy();C(yC,this,A(NC,this,WC).call(this,M(bC,this),e)),C(kC,this,rw(t))};C(kC,this,rw(t))}function zC(){M(kC,this)&&"function"==typeof ow&&ow(M(kC,this)),C(kC,this,null)}function WC(t,e){const n=A(NC,this,$C).call(this);for(t.push(e);t.length&&e-t[0]>n;)t.shift();if(t.length<2)return 0;const i=t[t.length-1]-t[0];return i<=0?0:1e3*(t.length-1)/i}function $C(){const t=Number(this.settings.windowSeconds);return!Number.isFinite(t)||t<=0?3e4:1e3*t}function jC(t){const e=t-A(NC,this,$C).call(this);for(;M(xC,this).length&&M(xC,this)[0].endMs<=e;)M(xC,this).shift()}function UC(t){const e=t-A(NC,this,$C).call(this);let n=0,i=0;const r=(r,o,s)=>{const a=Math.max(o,e),l=Math.min(s,t);l<=a||("waiting"===r?n+=l-a:"playing"===r&&(i+=l-a))};return M(xC,this).forEach((t=>{r(t.state,t.startMs,t.endMs)})),M(_C,this)&&Number.isFinite(M(TC,this))&&r(M(_C,this),M(TC,this),t),C(IC,this,n),C(SC,this,i),{waitingMs:n,playingMs:i}}function qC(t,e){if(t<=0)return 1;if(t>e)return 0;const n=e||1;return fm(1-t*this.settings.waitingMultiplier/n)}function VC(){if(Fy()-M(EC,this)<=1e3*this.settings.fpsGracePeriod)return 1;const t=Number(M(yC,this)),e=wv.isDesktop()?this.settings.bestFpsDesktop:this.settings.bestFpsMobile,n=fm(e>0?t/e:0);return"quad"===this.settings.fpsMathFuncType?n*n:n}function GC(t,e){const n=this.settings.statusFloors||{};let i="";return t>=n.excellent?i="excellent":t>=n.good?i="good":t>=n.fair?i="fair":(i="poor",t<=this.settings.alertStatusCeil&&e>0&&(i="alert")),i}function HC(){const t=Fy(),{waitingMs:e,playingMs:n}=A(NC,this,UC).call(this,t),i=A(NC,this,qC).call(this,e,n),r=A(NC,this,VC).call(this),o=fm(i*this.settings.streamQualityWeight+r*this.settings.fpsWeight);o!==M(pC,this)&&(C(pC,this,o),this.trigger(dd.QOE_SCORE,o)),C(mC,this,i),C(vC,this,r);const s=A(NC,this,GC).call(this,o,e);s!==M(gC,this)&&(C(gC,this,s),this.trigger(dd.QOE_STATUS,s))}function KC(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}function XC(t){const e=Number(t);return!Number.isFinite(e)||e<0?0:e}var YC=new WeakMap,QC=new WeakMap,JC=new WeakMap,ZC=new WeakMap,tO=new WeakSet;class eO extends sd{get name(){return"SegmentEvictionCoordinator"}get defaults(){return{enabled:Ky("segmentEvictionEnabled"),bufferBehindSeconds:Ky("segmentEvictionBufferBehindSeconds"),bufferAheadSeconds:Ky("segmentEvictionBufferAheadSeconds"),maxRetainedBytes:Ky("segmentEvictionMaxRetainedBytes")}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"evictAtTime"])}constructor(t,e,n={}){super(n),O(this,tO),F(this,YC,void 0),F(this,QC,void 0),F(this,JC,void 0),F(this,ZC,void 0),C(YC,this,t),C(QC,this,e),C(JC,this,(t=>A(tO,this,nO).call(this,t))),C(ZC,this,(t=>A(tO,this,iO).call(this,t))),M(YC,this)&&"function"==typeof M(YC,this).on&&(M(YC,this).on(dd.TIMELINE_TIME_UPDATE,M(JC,this)),M(YC,this).on(dd.TIMELINE_SEEKED,M(ZC,this)))}onDispose(){M(YC,this)&&"function"==typeof M(YC,this).off&&(M(YC,this).off(dd.TIMELINE_TIME_UPDATE,M(JC,this)),M(YC,this).off(dd.TIMELINE_SEEKED,M(ZC,this))),C(YC,this,null),C(QC,this,null),C(JC,this,null),C(ZC,this,null)}evictAtTime(t){if(!0!==this.settings.enabled)return;const e=Number(t);if(!Number.isFinite(e))return;const n=XC(this.settings.bufferBehindSeconds),i=XC(this.settings.bufferAheadSeconds),r=e-n,o=e+i,s=A(tO,this,rO).call(this);if(!s.length)return;const a=Number(this.settings.maxRetainedBytes);if(Number.isFinite(a)&&a>0&&A(tO,this,oO).call(this,s)<=a)return;const l=new Map;s.forEach((t=>{const e=null==t?void 0:t.nodeId;if(!e)return;const n=gm(t);if(!Number.isFinite(n))return;const i=l.get(e)||[];i.push(t),l.set(e,i)})),l.size&&l.forEach(((t,e)=>{const n=A(tO,this,sO).call(this,e);if(!n)return;const i=t.filter((t=>A(tO,this,aO).call(this,t,r,o)));i.length?A(tO,this,lO).call(this,n,i,r,o):"function"==typeof n.evict&&n.evict()}))}}function nO(t){var e,n;if(!0!==this.settings.enabled)return;if((null===(e=M(YC,this))||void 0===e?void 0:e.state)===Av)return;const i=Number(null==t?void 0:t.time),r=Number.isFinite(i)?i:Number(null===(n=M(YC,this))||void 0===n?void 0:n.currentTime);this.evictAtTime(r)}function iO(t){var e;if(!0!==this.settings.enabled)return;const n=Number(null==t?void 0:t.targetTime),i=Number.isFinite(n)?n:Number(null===(e=M(YC,this))||void 0===e?void 0:e.currentTime);this.evictAtTime(i)}function rO(){var t;const e=null===(t=M(YC,this))||void 0===t?void 0:t.placements;return Array.isArray(e)?e:[]}function oO(t){if(!Array.isArray(t)||!t.length)return 0;const e=new Set;let n=0;return t.forEach((t=>{const i=null==t?void 0:t.nodeId;if(!i||e.has(i))return;e.add(i);const r=A(tO,this,sO).call(this,i),o=Number(null==r?void 0:r.retainedByteLength);oy(o)?n+=o:(Array.isArray(null==r?void 0:r.tracks)?r.tracks:[]).forEach((t=>{(Array.isArray(null==t?void 0:t.segments)?t.segments:[]).forEach((t=>{oy(null==t?void 0:t.retainedByteLength)&&(n+=t.retainedByteLength)}))}))})),n}function sO(t){if(M(QC,this)&&"function"==typeof M(QC,this).get)return M(QC,this).get(t)}function aO(t,e,n){const i=gm(t);if(!Number.isFinite(i))return!1;const r=mm(t,M(QC,this));return(Number.isFinite(r)?i+r:Number.POSITIVE_INFINITY)>e&&i<n}function lO(t,e,n,i){const r=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[];r.length&&r.forEach((t=>{const r=Array.isArray(null==t?void 0:t.segments)?t.segments:[],o=KC(null==t?void 0:t.offset,0);r.forEach((t=>{if(!t||!oy(null==(r=t)?void 0:r.retainedByteLength))return;var r;if(t.isInit)return;let s=!1;for(let r=0;r<e.length;r+=1){const a=e[r],l=gm(a);if(!Number.isFinite(l))continue;const c=KC(null==a?void 0:a.nodeOffsetOverride,0),u=KC(null==t?void 0:t.offset,NaN);if(!Number.isFinite(u))continue;const d=KC(null==t?void 0:t.duration,0),h=l+o+u-c,f=h+(d>0?d:0),p=mm(a,M(QC,this)),m=Number.isFinite(p)?l+p:Number.POSITIVE_INFINITY;if(!(f<=l||h>=m||f<=n||h>=i)){s=!0;break}}s||t.evict()}))}))}var cO=new WeakMap,uO=new WeakMap,dO=new WeakMap,hO=new WeakSet;class fO extends sd{get name(){return"DocumentVisibility"}get defaults(){return{autoPauseOnVisibilityChange:!0,autoResumeOnVisibilityChange:!0}}constructor(t,e={}){super(e),O(this,hO),F(this,cO,void 0),F(this,uO,null),F(this,dO,!1),C(cO,this,t),A(hO,this,pO).call(this)}onDispose(){A(hO,this,mO).call(this),C(cO,this,null),C(dO,this,!1)}}function pO(){const t=null==cd?void 0:cd.document;t&&"function"==typeof t.addEventListener&&(C(uO,this,(()=>A(hO,this,vO).call(this))),t.addEventListener("visibilitychange",M(uO,this)))}function mO(){const t=null==cd?void 0:cd.document;M(uO,this)&&t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",M(uO,this)),C(uO,this,null)}function vO(){const t=null==cd?void 0:cd.document,e=null==t?void 0:t.visibilityState;"string"==typeof e&&("hidden"!==e?"visible"===e&&A(hO,this,yO).call(this):A(hO,this,gO).call(this))}function gO(){var t;(null===(t=this.settings)||void 0===t?void 0:t.autoPauseOnVisibilityChange)&&M(cO,this)&&"function"==typeof M(cO,this).pause&&(M(cO,this).state===Tv?(this.log.info("[#handleHidden] Pausing timeline due to document visibility change"),M(cO,this).pause(),C(dO,this,!0)):C(dO,this,!1))}function yO(){var t;M(dO,this)&&(null===(t=this.settings)||void 0===t?void 0:t.autoResumeOnVisibilityChange)&&M(cO,this)&&"function"==typeof M(cO,this).play&&(M(cO,this).state!==Tv?(this.log.info("[#handleVisible] Resuming timeline due to document visibility change"),M(cO,this).play(),C(dO,this,!1)):C(dO,this,!1))}const bO=[{event:"canplay",once:!0,trackAs:"canplay"},{event:"playing",once:!0,trackAs:"startedplaying"},"seeked","canvas.webglcontextlost"];function kO(t,e=0){return Number.isFinite(t)?t:e}function wO(t){const e=null==t?void 0:t.exposedPlayerAPI;return e&&"object"==typeof e?e:t}const xO=[function(t){return{schema:"iglu:com.helloeko/player/jsonschema/1-0-7",match:/^.*$/,getData:()=>{var e,n,i;const r=function(t){const e=null==t?void 0:t.exposedPlayerAPI;return e&&"object"==typeof e?e:t}(t);return{playerversion:"string"==typeof(null==r?void 0:r.version)?r.version:"0.0.0",isautoplay:!(null==r||null===(e=r.options)||void 0===e||!e.autoplay),playerqoe:kO(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:kO(null==r?void 0:r.volume),playercontainerwidth:kO(null==r?void 0:r.containerWidth),playercontainerheight:kO(null==r?void 0:r.containerHeight)}}}},function(t){return{schema:"iglu:com.helloeko/currentnode/jsonschema/1-0-2",match:/^.*$/,getData:()=>{var e;const n=wO(t),i=function(t){const e=wO(t);if(!e||"function"!=typeof e.getNodesAtTime)return null;const n=Number.isFinite(e.currentTime)?e.currentTime:0,i=e.getNodesAtTime(n);return Array.isArray(i)&&0!==i.length&&i[0]||null}(t);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===(e=i.metadata)||void 0===e?void 0:e.profile)?i.metadata.profile:""}}}},function(t){let e=0,n=0;const i=()=>{e||(e=Date.now(),n=0)},r=()=>{e&&!n&&(n=Date.now())};return t&&"function"==typeof t.on&&(t.on("seeking",i),t.on("seeked",r)),{schema:"iglu:com.helloeko/seeked/jsonschema/1-0-0",match:"seeked",getData:()=>{r();const t=e&&n&&n>=e?(n-e)/1e3:0;return e=0,n=0,{seekduration:t}},dispose:()=>{t&&"function"==typeof t.off&&(t.off("seeking",i),t.off("seeked",r))}}},function(){return{schema:"iglu:com.helloeko/environment/jsonschema/1-0-0",match:/^.*$/,getData:()=>{var t;const e=null==cd||null===(t=cd.eko)||void 0===t||null===(t=t.environment)||void 0===t?void 0:t.embeddingApp;return e?{embeddingapp:e}:{}}}}],_O=Object.freeze({once:!1,trackAs:""});var TO=new WeakMap,EO=new WeakMap,IO=new WeakMap,SO=new WeakMap,AO=new WeakMap,NO=new WeakMap,MO=new WeakSet;class FO extends sd{get name(){return"Tracker"}get defaults(){return{tag:null,trackingEnabled:Ky("trackingEnabled"),defaultForwarders:bO,defaultContextPackers:xO}}constructor(t,e={}){var n,i;super(e),O(this,MO),F(this,TO,void 0),F(this,EO,new Map),F(this,IO,[]),F(this,SO,!1),F(this,AO,void 0),F(this,NO,void 0),C(NO,this,!this.settings.tag),C(AO,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(TO,this,t),A(MO,this,BO).call(this),A(MO,this,OO).call(this)}track(t,...e){if(!this.settings.trackingEnabled)return;if("string"!=typeof t||!t)return void this.log.warn("[track] Expected event to be a non-empty string.");const n=A(MO,this,WO).call(this);n&&n("track",t,...e,M(AO,this))}registerContextPacker(t){if(!t||"object"!=typeof t)return void this.log.warn("[registerContextPacker] Expected a packer object.");const e={tag:M(AO,this),schema:t.schema,match:t.match,getData:A(MO,this,CO).call(this,t.getData)};if("string"!=typeof e.schema||!e.schema)return void this.log.warn('[registerContextPacker] Expected "schema" to be a non-empty string.');if("function"!=typeof e.getData)return void this.log.warn('[registerContextPacker] Expected "getData" to be a function.');if(!this.settings.trackingEnabled)return;const n=A(MO,this,WO).call(this);n&&n("registerContextPacker",e)}onDispose(){if(A(MO,this,LO).call(this),A(MO,this,zO).call(this),C(TO,this,null),M(NO,this)){const t=A(MO,this,WO).call(this);t&&(t("reset",M(AO,this)),C(AO,this,null))}}}function CO(t){return"function"!=typeof t?null:(...e)=>e.pop()!==M(AO,this)?null:t(...e)}function OO(){(Array.isArray(this.settings.defaultForwarders)?this.settings.defaultForwarders:[]).forEach((t=>A(MO,this,PO).call(this,t)))}function PO(t){const e=A(MO,this,RO).call(this,t);if(!e)return void this.log.warn("[#addEventForwarder] Invalid forwarder input.",t);const n=M(TO,this);if(!n||"function"!=typeof n.on)return;const i=A(MO,this,DO).call(this,e);if(M(EO,this).has(i))return;const r=(...t)=>{e.once&&n&&"function"==typeof n.off&&n.off(e.event,r);const i=e.trackAs||e.event;this.track(i,...t)};n.on(e.event,r),M(EO,this).set(i,{event:e.event,listener:r})}function RO(t){return"string"==typeof t&&t?{event:t,..._O}:t&&"object"==typeof t&&"string"==typeof t.event&&t.event?{event:t.event,once:!!t.once,trackAs:"string"==typeof t.trackAs?t.trackAs:""}:null}function DO({event:t,once:e,trackAs:n}){return`${t}:${e}:${n}`}function LO(){const t=M(TO,this);t&&"function"==typeof t.off&&M(EO,this).forEach((({event:e,listener:n})=>{t.off(e,n)})),M(EO,this).clear()}function BO(){(Array.isArray(this.settings.defaultContextPackers)?this.settings.defaultContextPackers:[]).forEach((t=>{if("function"!=typeof t)return;const e=t(M(TO,this),this);e&&"object"==typeof e&&("function"==typeof e.dispose&&M(IO,this).push(e.dispose),e.disabled||this.registerContextPacker({schema:e.schema,match:e.match,getData:e.getData}))}))}function zO(){M(IO,this).forEach((t=>{try{t()}catch(t){this.log.warn("[#teardownContextPackers] Failed disposing context packer.",t)}})),C(IO,this,[])}function WO(){const t=null==cd?void 0:cd.EkoAnalytics;return"function"==typeof t?t:(A(MO,this,$O).call(this),null)}function $O(){this.settings.trackingEnabled&&!M(SO,this)&&(this.log.warn("EkoAnalytics not found on window."),C(SO,this,!0))}class jO{#et;#nt;#it;#rt;#ot;#st;#at;#lt;#ct;#ut;#dt;#ht;#ft;#pt;#mt;#vt;#gt;#yt;#bt;constructor(t,e={},n=null){this.#et=new _d(t,n,e),this.#nt=new Pd(this.#et,e),this.#it=new Yk(e),this.#rt=new eb(e),this.#ot=new Fk(this.#rt,e),this.#st=new Ik(this.#ot,this.#it,e),this.#at=new zk(this.#st,e),this.#lt=new uF(this.#st,e),this.#ct=new fO(this.#lt,e),this.#yt=new eO(this.#lt,this.#st,e),this.#ut=new Dw(this.#st,this.#at,this.#it,this.#lt,e),this.#dt=new xx(this.#st,this.#at,this.#lt,e),this.#ht=new CI(e),this.#ft=new iS(this.#st,this.#lt,this.#ht,e),this.#mt=new MC(this.#lt,e),this.#bt=new FO(n,e);const i=e&&"object"==typeof e?e.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.#vt=r?r({timeline:this.#lt,canvas:this.#et,containerSize:this.#nt,options:e}):new yg(this.#lt,this.#et,this.#nt,e),this.#pt=o?o({timeline:this.#lt,decodeCoordinator:this.#ft,options:e}):new zA(this.#lt,this.#ft,e),this.#gt=new oA(this.#lt,this.#vt,e)}get canvas(){return this.#et}get containerSize(){return this.#nt}get assetsDeliveryService(){return this.#it}get downloadSpeed(){return this.#rt}get abrSelector(){return this.#ot}get nodeRepository(){return this.#st}get nodePrioritizer(){return this.#at}get timeline(){return this.#lt}get documentVisibility(){return this.#ct}get nodeResolver(){return this.#ut}get segmentLoadCoordinator(){return this.#dt}get decoderFactory(){return this.#ht}get parsingManager(){return this.#ft}get audioAdapter(){return this.#pt}get audioPlaybackManager(){return this.#pt}get qoe(){return this.#mt}get renderAdapter(){return this.#vt}get renderer(){return this.#vt}get transitionManager(){return this.#gt}get tracker(){return this.#bt}dispose(){[this.#bt,this.#lt,this.#ct,this.#dt,this.#ut,this.#at,this.#st,this.#it,this.#ot,this.#rt,this.#ft,this.#ht,this.#pt,this.#mt,this.#vt,this.#gt,this.#yt,this.#nt,this.#et].forEach((t=>{t&&"function"==typeof t.dispose&&t.dispose()})),this.#lt=null,this.#ct=null,this.#dt=null,this.#ut=null,this.#at=null,this.#st=null,this.#it=null,this.#ot=null,this.#rt=null,this.#ft=null,this.#ht=null,this.#pt=null,this.#mt=null,this.#vt=null,this.#gt=null,this.#yt=null,this.#et=null,this.#bt=null}}const UO="copy-instance.1201591";var qO={isPlainObject:ed,deepMerge:nd,get:Sy,set:Ay,ekoGlobalStore:Ny,download:qy,isPositiveNumber:oy,clamp01:fm,root:cd,now:Fy,getFrameDimensions:lM,useragent:xv,requestAnimationFrame:rw,cancelAnimationFrame:ow,start:pw,stop:mw,isTicking:vw,predicator:function(t,e){const n=e||{};if("function"!=typeof t)return void sw.error("[predicator] Bad argument given to predicator, first argument must be a function.",arguments);if(t.apply())return sw.debug("[predicator] Invoking onFulfilled immediately."),void("function"==typeof n.onFulfilled&&n.onFulfilled.call(null,0));const i=n.timeout||1e4,r=n.interval,o=Fy();let s,a,l,c,u;c=function(){t.apply()&&l()},l=function(){mw(c),cd.clearTimeout(s),u=Fy()-o,sw.debug("[predicator] Invoking onFulfilled after "+u+" ms."),"function"==typeof n.onFulfilled&&n.onFulfilled.call(null,u)},a=function(){mw(c),u=Fy()-o,sw.debug("[predicator] Invoking onTimeout after "+u+" ms."),"function"==typeof n.onTimeout&&n.onTimeout.call(null,u)},s=cd.setTimeout(a,i),pw(c,r)},createThrottler:gw,scheduleExecution:yw},VO=new WeakMap,GO=new WeakMap,HO=new WeakMap,KO=new WeakMap,XO=new WeakMap,YO=new WeakMap,QO=new WeakMap,JO=new WeakSet;class ZO{constructor(t){O(this,JO),F(this,VO,[]),F(this,GO,[]),F(this,HO,new SM("placement-")),F(this,KO,new SM("renderplacement-")),F(this,XO,void 0),F(this,YO,new Map),F(this,QO,void 0),C(XO,this,t),C(QO,this,{allowUnready:!0,getNode:t=>A(JO,this,tP).call(this,t)})}get placements(){return M(VO,this).slice()}get renderPlacements(){return M(GO,this).slice()}getNodesAtTime(t){A(JO,this,eP).call(this);const e=A(JO,this,iP).call(this,t);if(!Number.isFinite(e))return[];const n=M(VO,this).filter((t=>ym(t,e,null,M(QO,this)))),i=[];return n.forEach((t=>{const e=A(JO,this,tP).call(this,null==t?void 0:t.nodeId);e&&i.push(e)})),i}placeOnTimeline(t,e,n={}){const i=t&&"object"==typeof t?t:null,r=i?i.id:t;if(!r)throw new Error("TimelineDefinition.placeOnTimeline requires node id");i&&M(YO,this).set(r,i);const o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=_m(e);if("string"==typeof e&&e.includes("@")&&!a)throw new Error("TimelineDefinition.placeOnTimeline requires valid placement reference");const{wantsEndOffset:l,endOffsetSeconds:c}=a?{wantsEndOffset:!1}:xm(e,n);let u,d,h,f=!1;const p=null!==a;if(a){const t=M(VO,this).find((t=>(null==t?void 0:t.placementId)===a.placementId));if(!t)throw new Error("TimelineDefinition.placeOnTimeline requires valid placement reference");d=t.placementId,h=a.anchor;const e=gm(t);if("start"===a.anchor)Number.isFinite(e)?u=e:f=!0;else{const n=A(JO,this,nP).call(this,t);Number.isFinite(e)&&n>0?u=e+n:f=!0}}else if(l){const t=n.offsetAnchorPlacementId?M(VO,this).find((t=>(null==t?void 0:t.placementId)===n.offsetAnchorPlacementId)):M(VO,this).length?M(VO,this)[M(VO,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==t?void 0:t.placementId),d){const e=gm(t),n=A(JO,this,nP).call(this,t);Number.isFinite(e)&&n>0?u=e+n-c:(f=!0,h="end")}else u=-c}else u=wm(e);const m=M(HO,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(VO,this).push(v),bm(M(VO,this)),m}placeRenderNodeOnTimeline(t,e,n,i={}){const r="string"==typeof t?t:null==t?void 0:t.type;if(!r||"string"!=typeof r)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires render node type");let o,s,a,l=!1;const c=_m(e);if("string"==typeof e&&e.includes("@")&&!c)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires valid placement reference");const u=null!==c;if(c){const t=M(VO,this).find((t=>(null==t?void 0:t.placementId)===c.placementId));if(!t)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires valid placement reference");s=t.placementId,a=c.anchor;const e=gm(t);if("start"===c.anchor)Number.isFinite(e)?o=e:l=!0;else{const n=A(JO,this,nP).call(this,t);Number.isFinite(e)&&Number.isFinite(n)?o=e+n:l=!0}}else o=wm(e);const d=M(KO,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 t=o,e=o+p;Tm(M(GO,this),t,e,"TimelineDefinition.placeRenderNodeOnTimeline does not allow overlapping render nodes")}return M(GO,this).push(m),bm(M(GO,this)),d}}function tP(t){if(t)return M(XO,this)&&"function"==typeof M(XO,this).get?M(XO,this).get(t):M(YO,this).get(t)}function eP(){return km(M(VO,this),{getPlacementDuration:t=>A(JO,this,nP).call(this,t)}).updated}function nP(t){return mm(t,null,M(QO,this))}function iP(t){if("end"===t){const t=A(JO,this,rP).call(this);if(!Number.isFinite(t))return;return Math.max(0,t-Math.min(t,.001))}const e=Number(t);return Number.isFinite(e)?e:0}function rP(){let t;return M(VO,this).forEach((e=>{const n=gm(e);if(!Number.isFinite(n))return;const i=A(JO,this,nP).call(this,e);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(t)||r>t)&&(t=r)})),t}const oP=new Set(["canplay","play","playing","waiting","pause","seeking","seeked"]);var sP=new WeakMap,aP=new WeakMap,lP=new WeakMap,cP=new WeakMap,uP=new WeakMap,dP=new WeakMap,hP=new WeakMap,fP=new WeakMap,pP=new WeakMap,mP=new WeakMap,vP=new WeakMap,gP=new WeakMap,yP=new WeakMap,bP=new WeakMap,kP=new WeakMap,wP=new WeakMap,xP=new WeakMap,_P=new WeakMap,TP=new WeakMap,EP=new WeakMap,IP=new WeakMap,SP=new WeakMap,AP=new WeakMap,NP=new WeakMap,MP=new WeakMap,FP=new WeakSet;class CP extends sd{get name(){return"EkoPlayer"}get exposedPlayerAPI(){return M(cP,this)}constructor(t,e={}){const{options:n,publicOptions:i}=function(t={}){const e=nd({},Gy,t);Object.entries(Vy).forEach((([t,{targetPaths:n}])=>{void 0!==e[t]&&n.forEach((n=>{void 0===Sy(e,n)&&Ay(e,n,e[t])}))}));const n=function(t){const e={};return Object.keys(Vy).forEach((n=>{Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})),Object.freeze(e)}(e);return Hy.info("Processed options:",e),Hy.info("Public options:",n),{options:e,publicOptions:n}}(e);return super(n),O(this,FP),F(this,sP,void 0),F(this,aP,void 0),F(this,lP,void 0),F(this,cP,void 0),F(this,uP,void 0),F(this,dP,void 0),F(this,hP,void 0),F(this,fP,void 0),F(this,pP,void 0),F(this,mP,void 0),F(this,vP,void 0),F(this,gP,void 0),F(this,yP,void 0),F(this,bP,void 0),F(this,kP,void 0),F(this,wP,void 0),F(this,xP,void 0),F(this,_P,void 0),F(this,TP,void 0),F(this,EP,void 0),F(this,IP,void 0),F(this,SP,void 0),F(this,AP,void 0),F(this,NP,void 0),F(this,MP,0),C(lP,this,i),this.log.info("Initializing EkoPlayer with options:",i),C(gP,this,new jO(t,n,this)),A(FP,this,jP).call(this,M(gP,this)),C(kP,this,(t=>A(FP,this,OP).call(this,t))),M(aP,this)&&"function"==typeof M(aP,this).on&&M(aP,this).on(dd.TIMELINE_CUEPOINT,M(kP,this)),C(wP,this,null),C(_P,this,(t=>A(FP,this,PP).call(this,t))),C(TP,this,(t=>{const e=t&&"object"==typeof t?t:{};A(FP,this,PP).call(this,{...e,event:"seeking"})})),C(EP,this,(t=>{const e=t&&"object"==typeof t?t:{};A(FP,this,PP).call(this,{...e,event:"seeked"})})),M(aP,this)&&"function"==typeof M(aP,this).on&&(M(aP,this).on(dd.TIMELINE_PLAYER_STATE,M(_P,this)),M(aP,this).on(dd.TIMELINE_SEEKING,M(TP,this)),M(aP,this).on(dd.TIMELINE_SEEKED,M(EP,this))),C(AP,this,(t=>{const e=t&&"object"==typeof t?t:{};this.trigger(dd.CONTAINER_RESIZE,e)})),M(yP,this)&&"function"==typeof M(yP,this).on&&M(yP,this).on(dd.CONTAINER_RESIZE,M(AP,this)),A(FP,this,BP).call(this),A(FP,this,LP).call(this),C(cP,this,A(FP,this,$P).call(this)),M(cP,this)}onDispose(){M(aP,this)&&"function"==typeof M(aP,this).off&&M(kP,this)&&M(aP,this).off(dd.TIMELINE_CUEPOINT,M(kP,this)),C(kP,this,null),M(aP,this)&&"function"==typeof M(aP,this).off&&(M(_P,this)&&M(aP,this).off(dd.TIMELINE_PLAYER_STATE,M(_P,this)),M(TP,this)&&M(aP,this).off(dd.TIMELINE_SEEKING,M(TP,this)),M(EP,this)&&M(aP,this).off(dd.TIMELINE_SEEKED,M(EP,this))),C(_P,this,null),C(TP,this,null),C(EP,this,null),C(wP,this,null),M(yP,this)&&"function"==typeof M(yP,this).off&&M(AP,this)&&M(yP,this).off(dd.CONTAINER_RESIZE,M(AP,this)),C(AP,this,null),M(vP,this)&&"function"==typeof M(vP,this).off&&(M(IP,this)&&M(vP,this).off("qoescore",M(IP,this)),M(SP,this)&&M(vP,this).off("qoestatus",M(SP,this))),C(IP,this,null),C(SP,this,null),M(mP,this)&&"function"==typeof M(mP,this).off&&M(NP,this)&&M(mP,this).off(dd.DECODER_ERROR,M(NP,this)),C(NP,this,null),C(MP,this,0),M(bP,this)&&"function"==typeof M(bP,this).dispose&&M(bP,this).dispose(),C(bP,this,null),M(gP,this)&&"function"==typeof M(gP,this).dispose&&M(gP,this).dispose(),C(aP,this,null),C(sP,this,null),C(dP,this,null),C(hP,this,null),C(fP,this,null),C(pP,this,null),C(mP,this,null),C(vP,this,null),C(yP,this,null),C(uP,this,null),C(cP,this,null),C(gP,this,null)}}function OP(t={}){var e;this.trigger(dd.TIMELINE_CUEPOINT,t);const n="string"==typeof(null==t||null===(e=t.cuepoint)||void 0===e?void 0:e.name)?t.cuepoint.name:"";n&&this.trigger(n,t)}function PP(t={}){const e="string"==typeof(null==t?void 0:t.event)?t.event:"";if(!oP.has(e))return;if("playing"!==e||Number.isFinite(M(xP,this))||(C(xP,this,Fy()),this.log.info(`[#handlePlayerStateEvent] Playback started @ ${(M(xP,this)/1e3).toFixed(3)}s (${Date.now()})`)),M(wP,this)===e)return;C(wP,this,e);const n=Number.isFinite(null==t?void 0:t.time)?t.time:M(aP,this)&&Number.isFinite(M(aP,this).currentTime)?M(aP,this).currentTime:0,i={};Number.isFinite(n)&&(i.time=n),"string"==typeof(null==t?void 0:t.from)&&(i.from=t.from),"string"==typeof(null==t?void 0:t.to)&&(i.to=t.to),Number.isFinite(null==t?void 0:t.targetTime)&&(i.targetTime=t.targetTime),Array.isArray(null==t?void 0:t.placements)&&(i.placements=t.placements.slice()),this.trigger(e,i)}function RP(){return new ZO(M(sP,this))}function DP(t){if(!t||"object"!=typeof t)throw new Error("EkoPlayer.switchTimeline requires a timeline definition");if(!M(aP,this)||"function"!=typeof M(aP,this).applyTimelineDefinition)throw new Error("EkoPlayer.switchTimeline requires an active timeline");M(aP,this).applyTimelineDefinition(t),"function"==typeof M(aP,this).play&&M(aP,this).play()}function LP(){M(vP,this)&&"function"==typeof M(vP,this).on&&(C(IP,this,(t=>{this.trigger(dd.QOE_SCORE,t)})),C(SP,this,(t=>{this.trigger(dd.QOE_STATUS,t)})),M(vP,this).on(dd.QOE_SCORE,M(IP,this)),M(vP,this).on(dd.QOE_STATUS,M(SP,this)))}function BP(){M(mP,this)&&"function"==typeof M(mP,this).on&&(C(NP,this,(t=>{const e=t&&"object"==typeof t?t:{error:t};this.trigger(dd.DECODER_ERROR,e),A(FP,this,zP).call(this,e)})),M(mP,this).on(dd.DECODER_ERROR,M(NP,this)))}function zP(t={}){var e;const n=M(aP,this);if(!n||"number"!=typeof n.currentTime)return;const i=Date.now();if(i<M(MP,this))return;const r=Number(n.currentTime);if(!Number.isFinite(r))return;const o=Number(null==n||null===(e=n.settings)||void 0===e?void 0:e.snapToFps),s=Number.isFinite(o)&&o>0?1/o:1/60;C(MP,this,i+1500),this.log.warn("[#attemptDecoderRecoverySeek] decoder:error received, attempting seek recovery",null==t?void 0:t.error),n.currentTime=r+s}async function WP(t={}){var e;if(M(bP,this))return M(bP,this);const n=t&&"object"==typeof t&&!Array.isArray(t)?{...t}:{},i=M(uP,this)&&M(uP,this).element?M(uP,this).element:null;if(!i)throw new Error("Debug overlay requires an initialized player canvas and mount element.");const r=function({canvasElement:t,containerElement:e}={}){const n=t&&t.parentNode?t.parentNode:null;if(null==e)return n;const i=function(t,e=(null==cd?void 0:cd.document)){if(ud(t))return t;if("string"!=typeof t)return null;let n=t.trim();if("#"===n.charAt(0)&&(n=n.slice(1)),!n||!e||"function"!=typeof e.getElementById)return null;const i=e.getElementById(n);return ud(i)?i:null}(e,t&&t.ownerDocument?t.ownerDocument:null);if(i)return i;if("string"==typeof e){const t=e.trim(),n="#"===t.charAt(0)?t.slice(1):t;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 qD})),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(lP,this),n.playerVersion=UO,C(bP,this,s({mountElement:r,canvasElement:i,timeline:M(aP,this),assetsDeliveryServiceUrl:null===(e=M(gP,this))||void 0===e||null===(e=e.assetsDeliveryService)||void 0===e||null===(e=e.settings)||void 0===e?void 0:e.assetsDeliveryServiceUrl,getNode:t=>M(sP,this)&&"function"==typeof M(sP,this).get?M(sP,this).get(t):void 0,listNodes:()=>M(sP,this)&&"function"==typeof M(sP,this).list?M(sP,this).list():[],downloadSpeed:M(gP,this)?M(gP,this).downloadSpeed:void 0,downloadEvents:_y,qoe:M(vP,this)?M(vP,this).publicAPI:void 0,qoeEvents:this,options:n,playbackStartedAtMs:M(xP,this)})),M(bP,this)}function $P(){const t=this;return{createTimeline:()=>A(FP,t,RP).call(t),switchTimeline:e=>A(FP,t,DP).call(t,e),play:M(aP,this).play,pause:M(aP,this).pause,reset:M(aP,this).reset,placeOnTimeline:M(aP,this).placeOnTimeline,placeRenderNodeOnTimeline:M(aP,this).placeRenderNodeOnTimeline,addNode:M(sP,this).add,getNode:M(sP,this).get,listNodes:M(sP,this).list,getNodesAtTime:e=>M(aP,t).getNodesAtTime(e),dispose:this.dispose,on:t.on,off:t.off,once:t.once,trigger:t.trigger,transitionTo:(e,n)=>M(hP,t).transitionTo(e,n),track:(e,...n)=>{if(M(pP,t)&&"function"==typeof M(pP,t).track)return M(pP,t).track(e,...n)},seekToPlacement:e=>M(aP,t).seekToPlacement(e),get currentTime(){return M(aP,t).currentTime},set currentTime(e){M(aP,t).currentTime=e},get buffered(){return M(aP,t).buffered},get options(){return M(lP,t)},get containerWidth(){return M(yP,t)?M(yP,t).containerWidth:0},get containerHeight(){return M(yP,t)?M(yP,t).containerHeight:0},get playbackRate(){return M(aP,t).playbackRate},set playbackRate(e){M(aP,t).playbackRate=e},get paused(){return!!M(aP,t)&&!0===M(aP,t).paused},get muted(){return!!M(fP,t)&&M(fP,t).muted},set muted(e){M(fP,t)&&(M(fP,t).muted=e)},get volume(){return M(fP,t)?M(fP,t).volume:1},set volume(e){M(fP,t)&&(M(fP,t).volume=e)},get qoe(){return M(vP,t)?M(vP,t).publicAPI:void 0},get utils(){return qO},get version(){return UO},loadDebugOverlay:(...e)=>A(FP,t,WP).call(t,...e)}}function jP(t){t&&(C(uP,this,t.canvas),C(sP,this,t.nodeRepository),C(aP,this,t.timeline),C(fP,this,t.audioAdapter||t.audioPlaybackManager),C(pP,this,t.tracker),C(mP,this,t.parsingManager),C(vP,this,t.qoe),C(dP,this,t.renderAdapter||t.renderer),C(hP,this,t.transitionManager),C(yP,this,t.containerSize))}class UP{constructor({target:t,props:e}){if(!t)throw new Error("`options.target` is required");vo(this.#kt,e,!0),this.#kt.v.EkoPlayer=CP;const n=t.hasChildNodes()?ra:ia;this.#wt=n(Ru,{target:t,props:this.#kt.v})}#wt;#kt=Ii(po(xo({})),"EkoGallery.#props");destroy(t){if(this.#wt)return la(this.#wt,t)}get props(){return Rs(this.#kt)}}const qP=u("gallery-react");const VP=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(t){return void 0!==t}(i),f=e.useRef(s),p=e.useRef(o);d.current.initEventSent||(c("galleryinit"),d.current.initEventSent=!0);const m=e.useCallback((t=>{d.current.state=t,t.activeItemIndex===f.current.index&&t.activeModuleIndex===f.current.step||c("activeitemchanged",{index:t.activeItemIndex,step:t.activeModuleIndex})}),[]),v=e.useCallback((t=>{d.current.API=t,0===f.current.index&&0===f.current.step||t.selectItemAndStep(f.current.index,f.current.step),d.current.unsubscribe&&d.current.unsubscribe(),d.current.unsubscribe=t.subscribe(m)}),[]),g=e.useCallback(((t,e)=>{c(t,e)}),[c]);return e.useEffect((()=>(qP.setDataStorage("gallery-react",{config:i}),window.eko=window.eko||{},window.eko.config=i,window.eko.gallery={version:"copy-instance/4.0.13"},()=>{window.eko.config=void 0})),[i]),e.useImperativeHandle(n,(()=>({prev:()=>{var t;null===(t=d.current.API)||void 0===t||t.prev()},next:()=>{var t;null===(t=d.current.API)||void 0===t||t.next()}}))),e.useEffect((()=>{if(null==u||!u.current)return;const t=u.current;return d.current.app=new UP({target:t,props:{config:i,forceMobile:a,videoAspectRatio:l,hideNav:!0,onGalleryReady:v,onEvent:g}}),()=>{var t;null===(t=d.current.app)||void 0===t||t.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}));VP.propTypes={className:Tt.string,config:Tt.object,variantId:Tt.string,onEvent:Tt.func,ssrHtml:Tt.string,videoAspectRatio:Tt.string,debug:Tt.bool,activeItem:Tt.shape({index:Tt.number,step:Tt.number}),forceMobile:Tt.bool,instanceId:Tt.string,children:Tt.node},VP.displayName="EkoGallerySvelte";const GP=n("v2"),HP=n("v1"),KP="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{},XP=KP&&KP.performance,YP=XP&&"function"==typeof XP.now?()=>XP.now():()=>Date.now(),QP=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",CANVAS_WEBGL_CONTEXT_LOST:"canvas.webglcontextlost",CANVAS_WEBGL_CONTEXT_RESTORED:"canvas.webglcontextrestored"}),JP=["ui-monospace,","SFMono-Regular,","Menlo,","Monaco,","Consolas,",'"Liberation Mono",','"Courier New",',"monospace"].join(" "),ZP=`11px ${JP}`,tR=`12px ${JP}`;function eR(t){return"number"==typeof t&&Number.isFinite(t)}function nR(t){return eR(t)&&t>0}function iR(t){return eR(t)?Math.min(1,Math.max(0,t)):0}function rR(t,e=3){return eR(t)?t.toFixed(e):String(t)}function oR(t,e){const n=Number(t),i=Number(e);return!Number.isFinite(n)||!Number.isFinite(i)||n<=0||i<=0?"n/a":`${Math.round(n)}x${Math.round(i)}`}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({width:t=220,height:e=48,windowMs:n=6e4,maxValue:i=60,autoScale:r=!1,formatValue:o}={}){O(this,fR),F(this,sR,void 0),F(this,aR,void 0),F(this,lR,[]),F(this,cR,void 0),F(this,uR,void 0),F(this,dR,void 0),F(this,hR,void 0);const s=null==KP?void 0:KP.document;if(!s||"function"!=typeof s.createElement)throw new Error("Debug overlay graph requires document.createElement.");C(sR,this,s.createElement("canvas")),M(sR,this).width=t,M(sR,this).height=e,M(sR,this).style.width=`${t}px`,M(sR,this).style.height=`${e}px`,M(sR,this).style.borderRadius="6px",M(sR,this).style.background="#111",C(aR,this,M(sR,this).getContext("2d")),C(cR,this,n),C(uR,this,i),C(dR,this,!!r),C(hR,this,"function"==typeof o?o:null)}get element(){return M(sR,this)}push(t,e){if(M(sR,this)&&M(aR,this)&&Number.isFinite(t)&&Number.isFinite(e)){for(M(lR,this).push({t:e,v:t});M(lR,this).length&&e-M(lR,this)[0].t>M(cR,this);)M(lR,this).shift();A(fR,this,mR).call(this)}}dispose(){C(lR,this,[]),C(aR,this,null),C(sR,this,null)}}function mR(){const t=M(aR,this),e=M(sR,this);if(!t||!e)return;const n=e.width,i=e.height;if(!n||!i)return;if(t.clearRect(0,0,n,i),t.fillStyle="#111",t.fillRect(0,0,n,i),!M(lR,this).length)return;const r=M(lR,this)[0].t;if(!(M(lR,this)[M(lR,this).length-1].t>r))return;const o=M(dR,this)?M(lR,this).reduce(((t,e)=>e.v>t?e.v:t),0):M(uR,this),s=o>0?o:M(uR,this);t.strokeStyle="#0f0",t.lineWidth=2,t.beginPath();for(let e=0;e<M(lR,this).length;e+=1){const o=M(lR,this)[e],a=(o.t-r)/M(cR,this)*n,l=i-(s>0?Math.min(1,Math.max(0,o.v/s)):0)*i;0===e?t.moveTo(a,l):t.lineTo(a,l)}t.stroke();const a=M(lR,this).length?M(lR,this)[M(lR,this).length-1]:null,l=Number.isFinite(null==a?void 0:a.v)?a.v:null;if(null===l)return;const c=M(hR,this)?M(hR,this).call(this,l):l.toFixed(1);if("string"!=typeof c||!c)return;t.font=ZP,t.textAlign="right",t.textBaseline="top";const u=t.measureText(c),d=Math.ceil(u.width)+8,h=n-d-2;t.fillStyle="rgba(0,0,0,0.55)",t.fillRect(h,2,d,14),t.fillStyle="#fff",t.fillText(c,n-2-4,4)}const vR=new Intl.NumberFormat("en-US");function gR(t,e){const n=(null==t?void 0:t.trackId)||"",i=(null==e?void 0:e.trackId)||"";if(n!==i)return n<i?-1:1;const r=(null==t?void 0:t.nodeId)||"",o=(null==e?void 0:e.nodeId)||"";if(r!==o)return r<o?-1:1;const s=(null==t?void 0:t.segmentId)||"",a=(null==e?void 0:e.segmentId)||"";return s!==a?s<a?-1:1:("number"==typeof(null==t?void 0:t.presentationTime)?t.presentationTime:0)-("number"==typeof(null==e?void 0:e.presentationTime)?e.presentationTime:0)}function yR(t,e){for(t.push(e);t.length&&e-t[0]>1e3;)t.shift();if(t.length<2)return 0;const n=t[t.length-1]-t[0];return n<=0?0:1e3*(t.length-1)/n}function bR(t,e){if("function"!=typeof t||!e)return;const n=t(e.nodeId),i=null==n?void 0:n.tracks;if(!Array.isArray(i))return;const r=i.find((t=>(null==t?void 0:t.id)===e.trackId)),o=null==r?void 0:r.segments;return Array.isArray(o)?o.find((t=>(null==t?void 0:t.id)===e.segmentId)):void 0}function kR(t,e){var n;const i=bR(t,e);return(null==i?void 0:i.abrDecision)||(null==i||null===(n=i.chosenRepresentation)||void 0===n?void 0:n.abrDecision)}function wR(t){const e=Number(t);return!Number.isFinite(e)||e<=0?"n/a":`${vR.format(Math.round(e))}kbps`}function xR(t){const e=Number(t);return!Number.isFinite(e)||e<=0?"n/a":`${vR.format(Math.round(e/1e3))}kbps`}function _R(t,e=3){const n=Number(t);return Number.isFinite(n)?n.toLocaleString("en-US",{minimumFractionDigits:e,maximumFractionDigits:e}):String(t)}function TR(t,e){var n;if("function"!=typeof t||!e)return;const i=t(e.nodeId),r=null==i||null===(n=i.manifestRef)||void 0===n?void 0:n.encodeProfile;return"string"==typeof r&&r?r:void 0}function ER(t,e){if("function"!=typeof t||!e)return;const n=t(e.nodeId);return!0===(null==n?void 0:n.imageFallbackActive)?"image":void 0}function IR(t,e){const n=function(t){if(!t)return;const e=[[t.displayWidth,t.displayHeight],[t.codedWidth,t.codedHeight],[t.videoWidth,t.videoHeight],[t.naturalWidth,t.naturalHeight],[t.width,t.height]];for(let t=0;t<e.length;t+=1){const[n,i]=e[t],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}(null==e?void 0:e.frame)||{},i=Number.isFinite(null==e?void 0:e.width)?e.width:n.width,r=Number.isFinite(null==e?void 0:e.height)?e.height:n.height,o=function(t,e,n){return null===(n=bR(t,e))||void 0===n?void 0:n.chosenRepresentation}(t,e);if(!o)return eR(i)&&eR(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 SR(t){const e=Number(t);if(Number.isFinite(e)&&!(e<=0))return e/1e3}function AR(t,e){const n=Number(null==t?void 0:t.bandwidthKbps),i=Number(null==e?void 0:e.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==t?void 0:t.id)||"",a=(null==e?void 0:e.id)||"";return s===a?0:s<a?-1:1}function NR(t,e,n,i){const r=[];if(Array.isArray(null==i?void 0:i.availableRepresentations)&&i.availableRepresentations.forEach((t=>{const e="string"==typeof(null==t?void 0:t.id)&&t.id?t.id:void 0;if(!e)return;const n=Number(null==t?void 0:t.bandwidthKbps);r.push({id:e,bandwidthKbps:Number.isFinite(n)&&n>0?n:void 0})})),!r.length){const n=bR(t,e);(Array.isArray(null==n?void 0:n.representations)?n.representations:[]).forEach((t=>{const e="string"==typeof(null==t?void 0:t.id)&&t.id?t.id:void 0;e&&r.push({id:e,bandwidthKbps:SR(null==t?void 0:t.bandwidth)})}))}!r.length&&(null==n?void 0:n.id)&&r.push({id:n.id,bandwidthKbps:SR(n.bandwidth)});const o=new Map;return r.forEach((t=>{const e=null==t?void 0:t.id;e&&!o.has(e)&&o.set(e,t)})),Array.from(o.values()).sort(AR)}const MR=1024,FR=1048576,CR=1073741824;function OR(t){return eR(t)?t>=1e3?`${rR(t/1e3,1)} Mbps`:`${rR(t,1)} kbps`:"n/a"}function PR({downloadSpeed:t,downloadEvents:e}={}){const n=KP.document,i="function"==typeof(null==t?void 0:t.getKbps)?t.getKbps():void 0;let r=0;const{metricsRow:o,setInitial:s,setTotal:a}=function(t){const e=t.createElement("div");e.style.display="grid",e.style.gridTemplateColumns="1fr 1fr",e.style.gap="8px",e.style.font=tR;const n=t.createElement("div"),i=t.createElement("div");return e.appendChild(n),e.appendChild(i),{metricsRow:e,setInitial:t=>{n.textContent=`initial=${OR(t)}`},setTotal:t=>{var e;i.textContent="total="+(eR(e=t)?e<MR?`${Math.round(e)} B`:e<FR?`${rR(e/MR,1)} KB`:e<CR?`${rR(e/FR,2)} MB`:`${rR(e/CR,2)} GB`:"n/a")}}}(n),{graphWrap:l,speedGraph:c}=function(t,e){const n=t.createElement("div");n.style.marginTop="10px";const i=t.createElement("div");i.textContent="download speed",i.style.font=ZP,i.style.opacity="0.9";const r=eR(e)&&e>0?e:1,o=new pR({autoScale:!0,maxValue:r,formatValue:OR});return n.appendChild(i),n.appendChild(o.element),{graphWrap:n,speedGraph:o}}(n,i);s(i),a(r);const u=t=>{const e=Number(null==t?void 0:t.kbps);Number.isFinite(e)&&c.push(e,null!=KP&&KP.performance&&"function"==typeof KP.performance.now?KP.performance.now():Date.now())},d=t=>{const e=Number(null==t?void 0:t.bytes);Number.isFinite(e)&&(r+=e,a(r))};return t&&"function"==typeof t.on&&t.on("download:speed",u),e&&"function"==typeof e.on&&e.on("download:sample",d),{id:"downloads",title:"Downloads",render:t=>{t.appendChild(o),t.appendChild(l)},dispose:()=>{t&&"function"==typeof t.off&&t.off("download:speed",u),e&&"function"==typeof e.off&&e.off("download:sample",d),c.dispose()}}}function RR(t){return eR(t)?rR(t,3):"n/a"}function DR(){return null!=KP&&KP.performance&&"function"==typeof KP.performance.now?KP.performance.now():Date.now()}var LR,BR,zR,WR={exports:{}},$R=(LR||(LR=1,BR=WR,function(t,e){BR.exports?BR.exports=e():t.log=e()}(WR.exports,(function(){var t=function(){},e="undefined",n=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],r={},o=null;function s(t,e){var n=t[e];if("function"==typeof n.bind)return n.bind(t);try{return Function.prototype.bind.call(n,t)}catch(e){return function(){return Function.prototype.apply.apply(n,[t,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?t:this.methodFactory(o,n,this.name)}if(this.log=this.debug,typeof console===e&&n<this.levels.SILENT)return"No console available for logging"}function c(t){return function(){typeof console!==e&&(l.call(this),this[t].apply(this,arguments))}}function u(i,r,o){return"debug"===(l=i)&&(l="log"),typeof console!==e&&("trace"===l&&n?a:void 0!==console[l]?s(console,l):void 0!==console.log?s(console,"log"):t)||c.apply(this,arguments);var l}function d(t,n){var s,a,c,d=this,h="loglevel";function f(){var t;if(typeof window!==e&&h){try{t=window.localStorage[h]}catch(t){}if(typeof t===e)try{var n=window.document.cookie,i=encodeURIComponent(h),r=n.indexOf(i+"=");-1!==r&&(t=/^([^;]+)/.exec(n.slice(r+i.length+1))[1])}catch(t){}return void 0===d.levels[t]&&(t=void 0),t}}function p(t){var e=t;if("string"==typeof e&&void 0!==d.levels[e.toUpperCase()]&&(e=d.levels[e.toUpperCase()]),"number"==typeof e&&e>=0&&e<=d.levels.SILENT)return e;throw new TypeError("log.setLevel() called with invalid level: "+t)}"string"==typeof t?h+=":"+t:"symbol"==typeof t&&(h=void 0),d.name=t,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(t,n){return c=p(t),!1!==n&&function(t){var n=(i[t]||"silent").toUpperCase();if(typeof window!==e&&h){try{return void(window.localStorage[h]=n)}catch(t){}try{window.document.cookie=encodeURIComponent(h)+"="+n+";"}catch(t){}}}(c),l.call(d)},d.setDefaultLevel=function(t){a=p(t),f()||d.setLevel(t,!1)},d.resetLevel=function(){c=null,function(){if(typeof window!==e&&h){try{window.localStorage.removeItem(h)}catch(t){}try{window.document.cookie=encodeURIComponent(h)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(t){}}}(),l.call(d)},d.enableAll=function(t){d.setLevel(d.levels.TRACE,t)},d.disableAll=function(t){d.setLevel(d.levels.SILENT,t)},d.rebuild=function(){if(o!==d&&(s=p(o.getLevel())),l.call(d),o===d)for(var t in r)r[t].rebuild()},s=p(o?o.getLevel():"WARN");var m=f();null!=m&&(c=p(m)),l.call(d)}(o=new d).getLogger=function(t){if("symbol"!=typeof t&&"string"!=typeof t||""===t)throw new TypeError("You must supply a name when creating a logger.");var e=r[t];return e||(e=r[t]=new d(t,o.methodFactory)),e};var h=typeof window!==e?window.log:void 0;return o.noConflict=function(){return typeof window!==e&&window.log===o&&(window.log=h),o},o.getLoggers=function(){return r},o.default=o,o}))),WR.exports),jR=(zR=$R)&&zR.__esModule&&Object.prototype.hasOwnProperty.call(zR,"default")?zR.default:zR;const UR=()=>{},qR=["trace","log","debug","info","warn","error","getLevel","setLevel"],VR=["trace","debug","info","warn","error","silent"],GR={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;"},HR="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global;let KR={level:"trace",appName:""},XR=[];const YR="object"==typeof HR&&HR.performance&&"function"==typeof HR.performance.now?HR.performance.now.bind(HR.performance):Date.now.bind(Date),QR=t=>t&&"string"==typeof t?t.toLowerCase().trim():"",JR=(()=>{try{const t=new URLSearchParams(document.location.search),e=[].concat(t.getAll("log")).concat(t.getAll("ekolog")).concat(t.getAll("ekologger")).join(",").split(",");if(0===e.length)return{};let n={};return e.forEach((t=>{const[e,i]=t.split(":");n[QR(e)]=QR(i)||"trace"})),n}catch(t){return{}}})(),ZR=(t,e="")=>{const n=QR(t),i=jR.getLogger(n);if(i.__ekologger)return i.__ekologger;e||JR[n]||JR["*"]||(i.__noExplicitLevel=!0);const r=i.methodFactory;i.methodFactory=(e,n,i)=>{const o=r(e,n,i),s=e.toUpperCase();return(...e)=>{o(`[${((t,e=3)=>(YR()/1e3).toFixed(e))()}] %c[${s}] ${KR.appName?`[${KR.appName}] `:""}[${t}]`,GR[s],...e)}},e=JR[n]||JR["*"]||e||KR.level,i.setLevel(e,!1);const o=(...t)=>i.log(...t);return qR.forEach((t=>{o[t]=(...e)=>(XR.forEach((n=>{n[t](...e)})),i[t](...e))})),i.__ekologger=o,o};ZR.setDefaults=({appName:t="",level:e})=>{t&&"string"==typeof t&&(KR.appName=t),(e=QR(e))&&VR.includes(e)&&(KR.level=e,Object.values(jR.getLoggers()).filter((t=>t.__noExplicitLevel)).forEach((t=>t.setLevel(KR.level,!1))))},ZR.installDriver=t=>{const e={...qR.reduce(((e,n)=>(e[n]="function"==typeof(null==t?void 0:t[n])?t[n]:UR,e)),{})};XR.push(e)},ZR("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(((t,[e,n])=>(Object.prototype.hasOwnProperty.call(n,"default")&&(t[e]=n.default),t)),{})),ZR("config","warn");const tD=18,eD="rgba(83,170,255,0.9)",nD={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)"},iD={border:"1px solid rgba(102,214,141,0.28)",background:"rgba(102,214,141,0.16)",color:"rgba(167,240,185,1)"},rD={border:"1px solid rgba(255,200,87,0.3)",background:"rgba(255,200,87,0.16)",color:"rgba(255,227,171,1)"},oD="noop",sD="seek",aD="copy-node-id",lD="copy-node-context",cD="copy-source-video-url",uD=[{value:oD,label:"NOOP"},{value:sD,label:"Seek"},{value:aD,label:"Copy Node ID"},{value:lD,label:"Copy Node Context"},{value:cD,label:"Copy Source Video URL"}],dD=["type","url","mimeType","assetId","assetRevision","encodeProfile","duration","width","height"],hD=["id","url","mime","codecs","baseCodec","bandwidth","timescale","sizeBytes","width","height","frameRate","segStart","segDuration"];function fD(t,e){if(nR(null==t?void 0:t.nodeDurationOverride))return t.nodeDurationOverride;if("function"!=typeof e)return null;const n=e(null==t?void 0:t.nodeId),i=null==n?void 0:n.duration;return nR(i)?i:null}function pD(t){const e=Number(null==t?void 0:t.duration);return e===Number.POSITIVE_INFINITY?Number.POSITIVE_INFINITY:nR(e)?e:null}function mD(t){return t===Number.POSITIVE_INFINITY}function vD(t){return eR(t)?String(t):""}function gD(t,e=[]){return e.reduce(((e,n)=>(void 0!==(null==t?void 0:t[n])&&(e[n]=t[n]),e)),{})}function yD(t){const e=uD.find((e=>e.value===t));return e?e.value:oD}function bD(t){return t?"string"==typeof(null==t?void 0:t.message)&&t.message?t.message:"string"==typeof t&&t?t:null:null}function kD(t){return t&&eR(t.start)&&eR(t.end)?{start:t.start,end:t.end}:null}function wD(t){return t?gD(t,hD):null}function xD(t,e){const n="string"==typeof(null==t?void 0:t.nodeId)?t.nodeId:"",i="function"==typeof e&&n?e(n):null,r=function(t){return t?"string"==typeof t?t:gD(t,dD):null}(null==i?void 0:i.manifestRef),o=r&&"object"==typeof r?r.assetId:void 0,s={placement:{placementId:"string"==typeof(null==t?void 0:t.placementId)?t.placementId:void 0,nodeId:n||void 0,offset:eR(null==t?void 0:t.offset)?t.offset:void 0,duration:fD(t,e),offsetPending:!0===(null==t?void 0:t.offsetPending),nodeOffsetOverride:eR(null==t?void 0:t.nodeOffsetOverride)?t.nodeOffsetOverride:void 0,nodeDurationOverride:eR(null==t?void 0:t.nodeDurationOverride)?t.nodeDurationOverride:void 0},node:i?{id:i.id||n||void 0,state:"string"==typeof i.state?i.state:void 0,duration:eR(i.duration)?i.duration:null,mainTrackId:"string"==typeof i.mainTrackId?i.mainTrackId:void 0,assetId:"string"==typeof o?o:void 0,manifestRef:r,buffered:kD(i.buffered),imageFallbackActive:!0===i.imageFallbackActive,retainedByteLength:eR(i.retainedByteLength)?i.retainedByteLength:0,children:Array.isArray(i.children)?i.children.map((t=>({nodeId:"string"==typeof(null==t?void 0:t.nodeId)?t.nodeId:void 0,weight:eR(null==t?void 0:t.weight)?t.weight:void 0}))):[],tracks:Array.isArray(i.tracks)?i.tracks.map((t=>function(t){return t?{id:t.id,type:t.type,offset:eR(t.offset)?t.offset:0,duration:eR(t.duration)?t.duration:null,endTime:eR(t.endTime)?t.endTime:null,buffered:kD(t.buffered),segments:Array.isArray(t.segments)?t.segments.map((t=>function(t){if(!t)return null;const e={id:t.id,isInit:!0===t.isInit,offset:eR(t.offset)?t.offset:0,duration:eR(t.duration)?t.duration:0,bufferedRatio:eR(t.bufferedRatio)?t.bufferedRatio:0,retainedByteLength:eR(t.retainedByteLength)?t.retainedByteLength:0,isLoaded:!0===t.isLoaded,loadAttempts:eR(Number(t.loadAttempts))?Number(t.loadAttempts):0,appliedFilters:Array.isArray(t.appliedFilters)?t.appliedFilters.slice():[],chosenRepresentation:wD(t.chosenRepresentation),representations:Array.isArray(t.representations)?t.representations.map((t=>wD(t))).filter(Boolean):[]},n=bD(t.loadError);return n&&(e.loadError=n),e}(t))).filter(Boolean):[]}:null}(t))).filter(Boolean):[]}:null};if(i){const t=Number(i.manifestLoadAttempts);eR(t)&&t>0&&(s.node.manifestLoadAttempts=t);const e=bD(i.manifestLoadError);e&&(s.node.manifestLoadError=e);const n=bD(i.error);n&&(s.node.error=n)}return s}function _D(t=[],e=[],n){const i=function(t=[],e){return Array.isArray(t)&&t.length?t.map((t=>t?["string"==typeof t.placementId?t.placementId:"","string"==typeof t.nodeId?t.nodeId:"",vD(t.offset),vD(fD(t,e)),!0===t.offsetPending?"1":"0",vD(t.nodeOffsetOverride),vD(t.nodeDurationOverride)].join("|"):"null")).join(";"):""}(t,n);return`${i}::${function(t=[]){return Array.isArray(t)&&t.length?t.map((t=>{if(!t)return"null";const e="string"==typeof t.renderPlacementId?t.renderPlacementId:"",n="string"==typeof t.type?t.type:"",i=vD(t.offset),r=pD(t);return[e,n,i,r===Number.POSITIVE_INFINITY?"inf":vD(r),!0===t.offsetPending?"1":"0"].join("|")})).join(";"):""}(e)}`}function TD(t=[],e){if(!Array.isArray(t)||!t.length)return!1;for(let n=0;n<t.length;n+=1){const i=t[n];if(!i||!0===i.offsetPending)continue;if(nR(i.nodeDurationOverride))continue;if("function"!=typeof e)return!0;const r=e(i.nodeId);if(!nR(null==r?void 0:r.duration))return!0}return!1}function ED(t=[]){return!(!Array.isArray(t)||!t.length)&&t.some((t=>!0===(null==t?void 0:t.offsetPending)))}function ID(t=[],e=[]){return ED(t)||ED(e)}function SD(t,e=[],n){if(!t||!Array.isArray(e)||!e.length)return;const i=t.querySelector('[data-segment-boundary="true"]');e.forEach((e=>{if(!e||!eR(e.startRatio)||!eR(e.endRatio))return;const r=iR(e.startRatio),o=iR(e.endRatio);if(!(o>r))return;const s=KP.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?t.insertBefore(s,i):t.appendChild(s)}))}function AD(t,e){if(!t)return;const n=t.querySelector('[data-active-highlight="true"]');if(!e)return void(n&&n.remove());if(n)return;const i=KP.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",t.appendChild(i)}function ND({timeline:t,getNode:e,assetsDeliveryServiceUrl:n}={}){const i=null==KP?void 0:KP.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=ZP,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=ZP,s.style.maxWidth="260px",s.style.flexDirection="column",s.style.gap="6px";const a=i.createElement("div");a.style.font=tR,a.style.opacity="0.95";const l=i.createElement("div");l.style.font=ZP,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=tR,h.style.opacity="0.9";const f=i.createElement("div");f.style.font=ZP,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=ZP;const m=i.createElement("span");m.textContent="Click action";const v=i.createElement("select");v.style.font=ZP,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",uD.forEach((t=>{const e=i.createElement("option");e.value=t.value,e.textContent=t.label,v.appendChild(e)})),v.value=oD;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=iD.border,g.style.background=iD.background,g.style.color=iD.color,g.style.font=ZP,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(t,e,{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=t,o.style.font=ZP,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",e&&(s.dataset.timelineLane=e);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=[],E=0,I=oD,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(t){for(;t.childNodes.length>1;)t.removeChild(t.lastChild)}function U(){z&&(clearTimeout(z),z=null)}function q(){W&&(((null==KP?void 0:KP.clearTimeout)||clearTimeout)(W),W=null)}function V(){$&&(((null==KP?void 0:KP.clearTimeout)||clearTimeout)($),$=null)}function G(){g.style.display="none",g.style.opacity="0",g.style.transform="translateY(2px)",g.textContent=""}function H(){return!!D||!!t&&(Array.isArray(t.placements)||Array.isArray(t.renderPlacements))}function K(){if(!t)return!1;const e=Array.isArray(t.placements),n=Array.isArray(t.renderPlacements);if(!e&&!n)return!1;const i=e?t.placements:[],r=n?t.renderPlacements:[];return(i.length!==L||r.length!==B)&&(dt(i,r),!0)}function X(){if(!D)return!1;const t=_D(_,T,e);return t!==R&&(R=t,at(),ut(),!0)}function Y(){H()?z=function({shouldSchedule:t,isScheduled:e,intervalMs:n,onTick:i}){return e?null:setTimeout(i,n)}({shouldSchedule:!0,isScheduled:!!z,intervalMs:D?100:250,onTick:()=>{z=null,H()&&(K()||X()||Y())}}):U()}function Q(t,e){const n=e>0?E/e:0;t.style.left=100*iR(n)+"%",t.style.transform="translateX(-1px)"}function J(){o.style.display="none"}function Z(){q(),V(),G()}function tt(t,{tone:e="success"}={}){if(!t)return void Z();q(),V(),function(t="success"){const e=function(t="success"){return"warning"===t?rD:iD}(t);g.style.border=e.border,g.style.background=e.background,g.style.color=e.color}(e),g.textContent=t,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==KP?void 0:KP.setTimeout)||setTimeout;W=n((()=>{W=null,function(){q(),V(),g.style.opacity="0",g.style.transform="translateY(-2px)";const t=(null==KP?void 0:KP.setTimeout)||setTimeout;$=t((()=>{$=null,G()}),180)}()}),1800)}function et(t,e){if(!t)return void J();o.textContent=t,o.style.display="block";const n=r.getBoundingClientRect(),i=o.getBoundingClientRect(),s=((null==e?void 0:e.clientX)||0)-n.left+12,a=((null==e?void 0:e.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 nt(){s.style.display="none"}function it(t,n){const o="function"==typeof e&&t?e(t):null,u=Array.isArray(null==o?void 0:o.children)?o.children:[];if(!u.length)return void nt();if(a.textContent=t,l.textContent="children",function(){for(;c.firstChild;)c.removeChild(c.firstChild)}(),u.forEach((t=>{t&&t.nodeId&&c.appendChild(function(t){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==t?void 0:t.nodeId)?t.nodeId:"",o=nR(null==t?void 0:t.weight)?t.weight:1,s=function(t){if(!t||"function"!=typeof e)return"missing";const n=e(t);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=nD[s]||nD.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=${rR(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}(t))})),!c.childNodes.length)return void nt();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 rt(){const e=E;if(t&&"function"==typeof t.getPlacementsActiveAtTime){const n=t.getPlacementsActiveAtTime(e),i=new Set(n.map((t=>null==t?void 0:t.placementId)).filter((t=>"string"==typeof t&&t.length)));C.forEach((t=>{i.has(t)||AD(M.get(t),!1)})),i.forEach((t=>{C.has(t)||AD(M.get(t),!0)})),C=i}else w.track.querySelectorAll('[data-timeline-item="nodes"]').forEach((t=>{const n="true"===t.dataset.hasDuration,i=Number(t.dataset.start),r=Number(t.dataset.end);AD(t,n&&eR(e)&&e>=i&&e<r)}));if(t&&"function"==typeof t.getActiveRenderPlacement){const n=t.getActiveRenderPlacement(e),i=null==n?void 0:n.renderPlacementId;O&&O!==i&&AD(F.get(O),!1),i&&O!==i&&AD(F.get(i),!0),O=i||null}else x.track.querySelectorAll('[data-timeline-item="render"]').forEach((t=>{const n="true"===t.dataset.hasDuration,i=Number(t.dataset.start),r=Number(t.dataset.end);AD(t,n&&eR(e)&&e>=i&&e<r)}))}function ot(t){const n=fD(t,e);if(!nR(n)||"function"!=typeof e)return{boundaries:[],buffered:[]};const i=e(null==t?void 0:t.nodeId),r=function(t){const e=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[];if(!e.length)return null;if(null!=t&&t.mainTrackId){const n=e.find((e=>(null==e?void 0:e.id)===t.mainTrackId));if(n)return n}return e.find((t=>Array.isArray(null==t?void 0:t.segments)&&t.segments.length))||null}(i);if(!r)return{boundaries:[],buffered:[]};const o=t=>{if(!t)return 0;const e=Number(null==t?void 0:t.bufferedRatio);if(Number.isFinite(e))return iR(e);const n=Number(null==t?void 0:t.retainedByteLength);if(!nR(n))return 0;const i=null==t?void 0:t.chosenRepresentation,r=nR(null==i?void 0:i.sizeBytes)?i.sizeBytes:null;return nR(r)?iR(n/r):1},s=Array.isArray(r.segments)?r.segments:[],a=eR(null==r?void 0:r.offset)?r.offset:0,l=eR(null==t?void 0:t.nodeOffsetOverride)?t.nodeOffsetOverride:0;if(!s.length){const t=null==i?void 0:i.buffered,e=eR(null==t?void 0:t.start)?t.start-l:0,r=eR(null==t?void 0:t.end)?t.end-l:0,o=Math.max(0,e),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 t=s.find((t=>t&&!t.isInit))||s[0],e=t?o(t):0;return e>0?{boundaries:[],buffered:[{startRatio:0,endRatio:iR(e)}]}:{boundaries:[],buffered:[]}}return function(t,e,n,i,r){const o=[],s=[];let a=0;return t.forEach((t=>{if(null!=t&&t.isInit)return;eR(null==t?void 0:t.offset)&&(a=t.offset);const l=a;if(!eR(l))return;const c=eR(null==t?void 0:t.duration)?t.duration:0,u=n+l-i,d=n+(l+c)-i;u>0&&u<e&&o.push(u/e);const h="function"==typeof r?r(t):0;if(c>0&&d>0&&u<e&&h>0){const t=Math.max(0,u),n=Math.min(e,d);if(n>t){const i=t+(n-t)*iR(h);s.push({startRatio:t/e,endRatio:i/e})}}c>0&&(eR(null==t?void 0:t.offset)?a=t.offset+c:a+=c)})),{boundaries:o,buffered:s}}(s,n,a,l,o)}function st(){const t=Array.isArray(_)?_:[],e=new Map(t.map((t=>[null==t?void 0:t.placementId,t])));for(const[t,n]of M.entries()){if(!t)continue;const i=e.get(t);i&&(n.querySelectorAll('[data-buffered-segment="true"]').forEach((t=>t.remove())),SD(n,ot(i).buffered,eD))}}function at(){const t=new Set(_.map((t=>null==t?void 0:t.nodeId)).filter((t=>"string"==typeof t&&t.length)));t.forEach((t=>{if(N.has(t))return;const n="function"==typeof e?e(t):null;if(!n||"function"!=typeof n.on)return;const i=t=>function(t={}){if(!t||t.isInit)return;const e=null==t?void 0:t.nodeId,n=null==t?void 0:t.segmentId,i=Number(null==t?void 0:t.loaded),r=Number(null==t?void 0:t.total);if(!e||!n||!eR(i))return;const o=`${e}:${n}`,s=A.get(o)||{},a={loaded:Math.max(eR(s.loaded)?s.loaded:0,i),total:nR(r)?r:s.total};A.set(o,a),function(){if(P)return;P=!0;const t=null==KP?void 0:KP.requestAnimationFrame;"function"!=typeof t?((null==KP?void 0:KP.setTimeout)||setTimeout)((()=>{P=!1,st()}),0):t((()=>{P=!1,st()}))}()}(t);n.on("segment:chunk",i),N.set(t,{node:n,handler:i})}));for(const[e,n]of N.entries())t.has(e)||(null!=n&&n.node&&"function"==typeof n.node.off&&n.node.off("segment:chunk",n.handler),N.delete(e))}function lt({track:t,color:e,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(t,e){t.style.position="absolute",t.style.borderRadius="4px",t.style.background=e,t.style.opacity="0.9",t.style.font=ZP,t.style.color="#fff",t.style.display="flex",t.style.alignItems="center",t.style.whiteSpace="nowrap",t.style.overflow="hidden",t.style.textOverflow="ellipsis"}(x,e),function(t,{startRatio:e,durationRatio:n,rowIndex:i=0,rowHeight:r=18,rowGap:o=0}={}){const s=i*(r+o)+2,a=Math.max(1,r-4);t.style.top=`${s}px`,t.style.height=`${a}px`;const l=iR(e);if(nR(n)){const e=Math.max(0,Math.min(n,1-l));return t.style.left=100*l+"%",t.style.width=100*e+"%",void(t.style.padding="0 4px")}t.style.left=100*l+"%",t.style.width="2px",t.style.padding="0"}(x,{startRatio:n,durationRatio:r,rowIndex:h,rowHeight:f,rowGap:p}),function(t,{laneId:e,label:n,isClickable:i,shouldShowLabel:r,onClick:o}={}){if(e&&(t.dataset.timelineItem=e),r&&n){const e=KP.document.createElement("span");e.textContent=n,e.style.position="relative",e.style.zIndex="2",e.style.pointerEvents="none",t.appendChild(e)}i&&(t.style.cursor="pointer"),"function"==typeof o&&t.addEventListener("click",o)}(x,{laneId:m,label:d,isClickable:v,shouldShowLabel:"boolean"==typeof k?k:nR(r),onClick:w}),y&&(x.title=y),eR(o)&&(x.dataset.start=String(o)),nR(s)||mD(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",SD(x,l,eD),function(t,e=[]){t&&Array.isArray(e)&&e.length&&e.forEach((e=>{if(!eR(e)||e<=0||e>=1)return;const n=KP.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*iR(e)+"%",n.style.transform="translateX(-0.5px)",n.style.background="rgba(255,255,255,0.35)",n.style.pointerEvents="none",n.style.zIndex="1",t.appendChild(n)}))}(x,a),AD(x,g),y&&(x.addEventListener("mouseenter",(t=>et(y,t))),x.addEventListener("mousemove",(t=>et(y,t))),x.addEventListener("mouseleave",J)),b&&(x.addEventListener("mouseenter",(t=>it(b,t))),x.addEventListener("mousemove",(t=>it(b,t))),x.addEventListener("mouseleave",nt)),t.appendChild(x),"nodes"===m&&c?M.set(c,x):"render"===m&&c&&F.set(c,x)}async function ct({event:i,placement:r,rangeEnd:o,track:s}){const a=yD(I);if(a===oD)return;if(a===sD)return void function(e,n,i){if(!t)return;if(!nR(n)||!i)return;const r="function"==typeof i.getBoundingClientRect?i.getBoundingClientRect():null,o=nR(null==r?void 0:r.width)?r.width:i.clientWidth;if(!nR(o))return;const s=eR(null==r?void 0:r.left)?r.left:0,a=iR(((eR(null==e?void 0:e.clientX)?e.clientX:0)-s)/o)*n;eR(a)&&(t.currentTime=a)}(i,o,s);const l="string"==typeof(null==r?void 0:r.nodeId)?r.nodeId:"",c="function"==typeof e&&l?e(l):null,u=a===aD?l:a===lD?JSON.stringify(xD(r,e),null,2):function(t,e){return function(t,e){return function(t,e,n){const i=(t||"").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}`}(t,0,e)}(e,null==t?void 0:t.manifestRef)}(c,n),d=a===aD?"Copied node ID":a===lD?"Copied node context":"Copied source video URL";if(u)try{await async function(t,e){const n=null==KP||null===(e=KP.navigator)||void 0===e?void 0:e.clipboard;if(!n||"function"!=typeof n.writeText)throw new Error("Clipboard API unavailable.");await n.writeText(t)}(u),tt(d)}catch(t){}else a===cD&&tt("Source video URL unavailable",{tone:"warning"})}function ut(){const n=function(){let t=0;const n=Array.isArray(_)?_:[],i=Array.isArray(T)?T.filter((t=>!0!==(null==t?void 0:t.offsetPending))):[];return n.forEach((n=>{if(!0===(null==n?void 0:n.offsetPending))return;const i=eR(null==n?void 0:n.offset)?n.offset:void 0;if(!eR(i))return;const r=fD(n,e);t=nR(r)?Math.max(t,i+r):Math.max(t,i)})),i.forEach((e=>{const n=eR(null==e?void 0:e.offset)?e.offset:0,i=pD(e);t=nR(i)?Math.max(t,n+i):Math.max(t,n)})),nR(t)?t:1}();S=n,h.textContent=`t=${rR(E)}s`,f.textContent=`range=0-${rR(n)}s`,J(),nt(),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((t=>{if(!0===(null==t?void 0:t.offsetPending))return null;const n=eR(null==t?void 0:t.offset)?t.offset:void 0;if(!eR(n))return null;const i=fD(t,e);return{placement:t,offset:n,duration:i,end:nR(i)?n+i:n,rowIndex:0}})).filter(Boolean).sort(((t,e)=>{var n,i,r,o;const s=t.offset-e.offset;if(0!==s)return s;const a="string"==typeof(null===(n=t.placement)||void 0===n?void 0:n.nodeId)?t.placement.nodeId:"",l="string"==typeof(null===(i=e.placement)||void 0===i?void 0:i.nodeId)?e.placement.nodeId:"";if(a!==l)return a.localeCompare(l);const c="string"==typeof(null===(r=t.placement)||void 0===r?void 0:r.placementId)?t.placement.placementId:"",u="string"==typeof(null===(o=e.placement)||void 0===o?void 0:o.placementId)?e.placement.placementId:"";return c.localeCompare(u)})),r=[],o=function(t,e){const n=Number(null==t||null===(e=t.settings)||void 0===e?void 0:e.snapToFps);return!Number.isFinite(n)||n<=0?0:.5/n}(t);return i.forEach((t=>{const e=t.offset,n=eR(t.end)?t.end:e;let i=-1;for(let t=0;t<r.length;t+=1)if(r[t]<=e+o){i=t;break}-1===i?(i=r.length,r.push(n)):r[i]=Math.max(r[i],n),t.rowIndex=i})),{items:i,rowCount:Math.max(1,r.length)}}(i);var s;!function(t){const e=t.rowCount*tD+4*(t.rowCount-1);w.track.style.height=`${e}px`,x.track.style.height="18px",w.track.style.cursor="default",w.track.style.pointerEvents="auto",x.track.style.pointerEvents="auto"}(o),function(t,e){t.items.forEach((t=>{const n=t.placement,i=t.offset,r=t.duration,o=(null==n?void 0:n.nodeId)||(null==n?void 0:n.placementId)||"node",s=!!eR(E)&&E>=i&&(!nR(r)||E<i+r),a=ot(n),l=yD(I)!==oD;lt({track:w.track,color:"rgba(255,255,255,0.16)",start:iR(i/e),duration:nR(r)?iR(r/e):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:t.rowIndex,rowHeight:tD,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?t=>{ct({event:t,placement:n,rangeEnd:e,track:w.track})}:void 0})}))}(o,n),s=n,r.forEach((t=>{const e=eR(null==t?void 0:t.offset)?t.offset:void 0;if(!eR(e))return;const n=pD(t),i=mD(n),r=(null==t?void 0:t.type)||(null==t?void 0:t.renderPlacementId)||"render",o=function(t){const e="string"==typeof t?t.trim().toLowerCase():"";return"switch"===e||"switching"===e||"switchingrendernode"===e}(null==t?void 0:t.type),a=o?()=>{"function"==typeof(null==KP?void 0:KP.switchTo)&&KP.switchTo("next")}:void 0;let l=!1;eR(E)&&(i?l=E>=e:nR(n)&&(l=E>=e&&E<e+n));const c=i&&nR(s)?iR((s-e)/s):nR(n)?iR(n/s):null;lt({track:x.track,color:"rgba(248,162,62,0.9)",start:iR(e/s),duration:c,startTime:e,durationSeconds:n,label:r,placementId:null==t?void 0:t.renderPlacementId,rowIndex:0,rowHeight:tD,rowGap:0,laneId:"render",isClickable:!!o,isActive:l,tooltip:(null==t?void 0:t.type)||(null==t?void 0:t.renderPlacementId),showLabel:nR(n)||i,onClick:a})})),Q(w.indicator,n),Q(x.indicator,n),rt(),st(),D=ID(_,T)||TD(_,e),R=D?_D(_,T,e):"",L=Array.isArray(_)?_.length:0,B=Array.isArray(T)?T.length:0,Y()}function dt(t,n){_=Array.isArray(t)?t.slice():[],T=Array.isArray(n)?n.slice():[],D=ID(_,T)||TD(_,e),at(),ut()}return v.addEventListener("change",(()=>{I=yD(v.value),v.value=I,ut()})),{id:"timeline",title:"Timeline",render:t=>{t.appendChild(r),ut()},updatePlacements:dt,updateTime:function(t){if(E=eR(t)?t:E,K())return;if(D&&X())return;const e=S;eR(e)&&(h.textContent=`t=${rR(E)}s`,f.textContent=`range=0-${rR(e)}s`,Q(w.indicator,e),Q(x.indicator,e),rt())},refresh:()=>ut(),dispose:()=>{U(),Z();for(const t of N.values())(null==t?void 0:t.node)&&"function"==typeof t.node.off&&t.node.off("segment:chunk",t.handler);N.clear(),A.clear()}}}const MD=1024,FD=1048576,CD=1073741824;function OD(t){return eR(t)?t<MD?`${Math.round(t)} B`:t<FD?`${rR(t/MD,1)} KB`:t<CD?`${rR(t/FD,2)} MB`:`${rR(t/CD,2)} GB`:"n/a"}const PD="ekoplayer-debug-overlay";var RD=new WeakMap,DD=new WeakMap,LD=new WeakMap,BD=new WeakMap,zD=new WeakSet;class WD{constructor({tabBarEl:t,contentEl:e}){O(this,zD),F(this,RD,[]),F(this,DD,void 0),F(this,LD,void 0),F(this,BD,void 0),C(LD,this,t),C(BD,this,e)}registerTab(t){t&&"string"==typeof t.id&&"string"==typeof t.title&&"function"==typeof t.render&&(M(RD,this).some((e=>e.id===t.id))||(M(RD,this).push(t),A(zD,this,$D).call(this),M(DD,this)||this.selectTab(t.id)))}selectTab(t){M(RD,this).find((e=>e.id===t))&&(C(DD,this,t),A(zD,this,$D).call(this),A(zD,this,jD).call(this))}dispose(){M(LD,this)&&(M(LD,this).innerHTML=""),M(BD,this)&&(M(BD,this).innerHTML=""),C(RD,this,[]),C(LD,this,null),C(BD,this,null)}}function $D(){const t=M(LD,this);t&&(t.innerHTML="",M(RD,this).forEach((e=>{const n=KP.document.createElement("button");n.type="button",n.textContent=e.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=e.id===M(DD,this)?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.2)",n.style.color="#fff",n.style.font=tR,n.addEventListener("click",(()=>this.selectTab(e.id))),t.appendChild(n)})))}function jD(){const t=M(BD,this);if(!t)return;t.innerHTML="";const e=M(RD,this).find((t=>t.id===M(DD,this)));e&&e.render(t)}function UD({mountElement:t,canvasElement:e,timeline:n,assetsDeliveryServiceUrl:i,getNode:r,listNodes:o,downloadSpeed:s,downloadEvents:a,qoe:l,qoeEvents:c,options:u={},playbackStartedAtMs:d,playerVersion:h}={}){if(!t)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(t){if(!t||!t.style)return;const e=null==KP?void 0:KP.window,n=e&&"function"==typeof e.getComputedStyle?e.getComputedStyle(t):null,i=n?n.position:t.style.position;i&&"static"!==i||(t.style.position="relative")}(t);const f=KP.document.getElementById(PD);f&&f.parentNode&&f.parentNode.removeChild(f);const p=function({mountElement:t,playerVersion:e}){const n=null==KP?void 0:KP.document;if(!n||"function"!=typeof n.createElement)throw new Error("Debug overlay requires document.createElement.");const i=n.createElement("div");i.id=PD,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=ZP,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=e?`version ${e}`:"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),t.appendChild(i),{overlayRoot:i,panel:r,tabBar:l,content:c,hideBtn:a,showBtn:f,footerPlayback:d}}({mountElement:t,playerVersion:h||(null==u?void 0:u.playerVersion)}),m=new WD({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=ND({timeline:n,getNode:r,assetsDeliveryServiceUrl:i}),k=function({getNode:t}){const e=KP.document,n=e.createElement("pre");n.style.margin="0",n.style.whiteSpace="pre-wrap",n.style.font=tR,n.style.lineHeight="1.35";const i=e.createElement("div");i.style.display="flex",i.style.flexDirection="column",i.style.gap="8px",i.style.marginTop="6px";const r=e.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 pR({maxValue:60}),s=new pR({maxValue:60}),a=e.createElement("div"),l=e.createElement("div");l.textContent="browserfps",l.style.font=ZP,l.style.opacity="0.9",a.appendChild(l),a.appendChild(o.element);const c=e.createElement("div"),u=e.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:t=>{t.appendChild(n),t.appendChild(i),t.appendChild(r)},pushBrowserFps:(t,e)=>o.push(t,e),pushVisualFps:(t,e)=>s.push(t,e),updateInfo:function({time:r,entries:o}){const s=Array.isArray(o)?o.slice().sort(gR):[];if(!s.length)return n.textContent="",void(i.innerHTML="");n.textContent=`t=${_R(r)}s tracks=${s.length}`,i.innerHTML="";for(let n=0;n<s.length;n+=1){const r=s[n],o=IR(t,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=xR(null==o?void 0:o.bandwidth),u=oR(null==o?void 0:o.width,null==o?void 0:o.height),d=TR(t,r)||"n/a",h=ER(t,r),f=h?` fallback=${h}`:"",p=kR(t,r),m=(null==p?void 0:p.strategy)||"n/a",v=(null==p?void 0:p.decisionReason)||"n/a",g=wR(null==p?void 0:p.measuredDownloadSpeedKbps),y=wR(null==p?void 0:p.safeBandwidthKbps),b=e.createElement("div");b.style.display="flex",b.style.flexDirection="column",b.style.gap="2px";const k=e.createElement("pre");k.style.margin="0",k.style.whiteSpace="pre-wrap",k.style.font=tR,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=${_R(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=NR(t,r,o,p);if(x.length){const t=e.createElement("div");t.style.display="flex",t.style.alignItems="center",t.dataset.abrLadderRow="true",t.dataset.trackId=(null==r?void 0:r.trackId)||"",t.dataset.segmentId=(null==r?void 0:r.segmentId)||"";const n=e.createElement("div");n.style.display="inline-flex",n.style.alignItems="center",n.style.gap="2px",n.dataset.abrLadder="true",x.forEach((t=>{const i=e.createElement("span"),r=!!w&&t.id===w;i.dataset.abrLadderBlock="true",i.dataset.repId=t.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=`${t.id||"?"} ${wR(t.bandwidthKbps)}`,n.appendChild(i)})),t.appendChild(n),b.appendChild(t)}i.appendChild(b)}},dispose:()=>{o.dispose(),s.dispose()}}}({getNode:r}),w=PR({downloadSpeed:s,downloadEvents:a}),x=function({qoe:t,qoeEvents:e}={}){const n=null==KP?void 0:KP.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=tR;const{graphWrap:r,graph:o}=function(t){const e=t.createElement("div");e.style.marginTop="10px";const n=t.createElement("div");n.textContent="qoe score",n.style.font=ZP,n.style.opacity="0.9";const i=new pR({maxValue:1,windowMs:3e4,formatValue:t=>RR(t)});return e.appendChild(n),e.appendChild(i.element),{graphWrap:e,graph:i}}(n);let s=null;const a=()=>{i.textContent=function(t){if(!t)return"QoE unavailable";const e="string"==typeof t.status?t.status:"n/a";return[`score=${RR(t.score)}`,`status=${e}`,`streamQualityScore=${RR(t.streamQualityScore)}`,`fpsScore=${RR(t.fpsScore)}`,`browserFps=${RR(t.browserFps)}`,`waitingSeconds=${RR(t.waitingSeconds)}`,`playingSeconds=${RR(t.playingSeconds)}`].join("\n")}(t)},l=()=>{if(!t)return;const e=Number(t.score);Number.isFinite(e)&&o.push(e,DR())},c=t=>{const e=Number(t);Number.isFinite(e)&&o.push(e,DR()),a()},u=()=>{a()};if(a(),l(),e&&"function"==typeof e.on&&(e.on("qoescore",c),e.on("qoestatus",u)),t){const t="function"==typeof(null==KP?void 0:KP.setInterval)?KP.setInterval:setInterval;s=t((()=>{l(),a()}),1e3)}return{id:"qoe",title:"QoE",render:t=>{t.appendChild(i),t.appendChild(r)},dispose:()=>{e&&"function"==typeof e.off&&(e.off("qoescore",c),e.off("qoestatus",u)),s&&(("function"==typeof(null==KP?void 0:KP.clearInterval)?KP.clearInterval:clearInterval)(s),s=null),o.dispose()}}}({qoe:l,qoeEvents:c}),_=function({timeline:t,getNode:e,listNodes:n,options:i}={}){const r=null==KP?void 0:KP.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=tR;const s=r.createElement("div");s.textContent="nodes",s.style.marginTop="10px",s.style.font=ZP,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=tR;let l=null;const c=()=>{const r=function({timeline:t,getNode:e,listNodes:n}){const i=[];let r=0;if("function"==typeof n){let t;try{t=n()}catch(e){t=null}if(Array.isArray(t))return t.forEach((t=>{const e=null==t?void 0:t.id;if("string"!=typeof e||!e.length)return;const n=Number(null==t?void 0:t.retainedByteLength);Number.isFinite(n)&&(r+=n,i.push({nodeId:e,bytes:n}))})),i.sort(((t,e)=>e.bytes-t.bytes)),{totalBytes:r,nodes:i,available:!0}}if(!t||"function"!=typeof e)return{totalBytes:0,nodes:[],available:!1};const o=Array.isArray(t.placements)?t.placements:[];return new Set(o.map((t=>null==t?void 0:t.nodeId)).filter((t=>"string"==typeof t&&t.length))).forEach((t=>{const n=e(t),o=Number(null==n?void 0:n.retainedByteLength);Number.isFinite(o)&&(r+=o,i.push({nodeId:t,bytes:o}))})),i.sort(((t,e)=>e.bytes-t.bytes)),{totalBytes:r,nodes:i,available:!0}}({timeline:t,getNode:e,listNodes:n}),s=function({timeline:t}){if(!t||"function"!=typeof t.getDecodedFrameStats)return{totalBytes:0,frames:0,available:!1};try{const e=t.getDecodedFrameStats(),n=Number(null==e?void 0:e.totalBytes),i=Number(null==e?void 0:e.frames);return{totalBytes:Number.isFinite(n)?n:0,frames:Number.isFinite(i)?i:0,available:!1!==(null==e?void 0:e.available)}}catch(t){return{totalBytes:0,frames:0,available:!1}}}({timeline:t}),l=function(t,e,n,i){const r=Number(null!==(n=null==t||null===(i=t.publicOptions)||void 0===i?void 0:i.segmentEvictionMaxRetainedBytes)&&void 0!==n?n:null==t?void 0:t.segmentEvictionMaxRetainedBytes),o=eR(r)&&r>=0,s=o?OD(r):"n/a";return{active:o&&eR(e)&&e>r,thresholdLabel:s}}(i,r.available?r.totalBytes:NaN),c=l.active?"on":"off",u=s.available?OD(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=${OD(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((t=>`${t.nodeId}: ${OD(t.bytes)}`));a.textContent=h.join("\n")};c();const u="function"==typeof(null==KP?void 0:KP.setInterval)?KP.setInterval:setInterval;return l=u(c,1e3),{id:"memory",title:"Memory",render:t=>{t.appendChild(o),t.appendChild(s),t.appendChild(a)},refresh:c,dispose:()=>{l&&(("function"==typeof(null==KP?void 0:KP.clearInterval)?KP.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:t}={}){const e=null==KP?void 0:KP.document;if(!e||"function"!=typeof e.createElement)throw new Error("Debug overlay options tab requires document.createElement.");const n=e.createElement("pre");n.style.margin="0",n.style.font=tR,n.style.whiteSpace="pre-wrap",n.style.wordBreak="break-word";const i=null==t?void 0:t.publicOptions,r=i&&"object"==typeof i?Object.keys(i):[];if(r.length){const t=r.map((t=>`${t}=${function(t){if(null===t)return"null";if(void 0===t)return"undefined";const e=typeof t;if("string"===e)return t;if("number"===e||"boolean"===e)return String(t);try{return JSON.stringify(t)}catch(e){return String(t)}}(i[t])}`));n.textContent=t.join("\n")}else n.textContent="publicOptions unavailable";return{id:"options",title:"Options",render:t=>{t.appendChild(n)}}}({options:u}));const T=[],E=[];let I=0,S=0,A=null,N=!1,M=0,F=null;function C(t){const e=Number(t);Number.isFinite(e)&&(e-M<250||(M=e,k.pushBrowserFps(I,e),k.pushVisualFps(S,e)))}KP.window&&"function"==typeof KP.window.requestAnimationFrame&&(A=KP.window.requestAnimationFrame((function t(e){N||(I=yR(T,e),C(e),A=KP.window.requestAnimationFrame(t))})));const O=(t={})=>{if(N||!v)return;const e=Array.isArray(t.frames)?t.frames:[];if(!e.length)return void(F=null);const n=null!=KP&&KP.performance&&"function"==typeof KP.performance.now?KP.performance.now():Date.now(),i=e.map((t=>`${null==t?void 0:t.nodeId}:${null==t?void 0:t.trackId}:${null==t?void 0:t.segmentId}@${null==t?void 0:t.presentationTime}`)).join("|");i!==F&&(S=yR(E,n),F=i),k.updateInfo({time:t.time,entries:e}),C(n)};let P=Number.isFinite(d)?d:void 0;if(Number.isFinite(P)&&p.footerPlayback){const t=P/1e3;p.footerPlayback.textContent=`Playback started @ ${rR(t)}s`}const R=(t={})=>{if(!N&&void 0===P&&"playing"===(null==t?void 0:t.event)&&(P=YP(),p.footerPlayback)){const t=P/1e3;p.footerPlayback.textContent=`Playback started @ ${rR(t)}s`}},D=()=>{const t=Array.isArray(null==n?void 0:n.placements)?n.placements:[],e=Array.isArray(null==n?void 0:n.renderPlacements)?n.renderPlacements:[];b.updatePlacements(t,e)},L=(t={})=>{if(N)return;const e=Number.isFinite(null==t?void 0:t.time)?t.time:null==n?void 0:n.currentTime;b.updateTime(e),_&&"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(QP.VISUAL_FRAMES_AVAILABLE,O),n.on(QP.TIMELINE_TIME_UPDATE,L),n.on(QP.PLACEMENT_ADDED,B),n.on(QP.RENDER_PLACEMENT_ADDED,z),n.on(QP.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&&KP.window&&"function"==typeof KP.window.cancelAnimationFrame&&KP.window.cancelAnimationFrame(A),A=null,n&&"function"==typeof n.off&&(n.off(QP.VISUAL_FRAMES_AVAILABLE,O),n.off(QP.TIMELINE_TIME_UPDATE,L),n.off(QP.PLACEMENT_ADDED,B),n.off(QP.RENDER_PLACEMENT_ADDED,z),n.off(QP.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(t){m.registerTab(t)},selectTab:function(t){m.selectTab(t)}}}var qD=Object.freeze({__proto__:null,createDebugOverlay:UD,default:UD});exports.EkoGallery=VP,exports.EkoGalleryLegacy=en,exports.ekoWebPixel=S,exports.getEkoAnalyticsSnippet=function(t){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: '${t?"production":"development"}',\n env: 'website',\n });\n window.EkoAnalytics('track', 'PageView');\n }`},exports.getEkoProductConfigUrl=GP,exports.getEkoProductConfigUrlLegacy=HP;