@ekolabs/eko-gallery-react 4.0.1 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -11,4 +11,4 @@ import e,{useRef as n,useState as i,createRef as r,useCallback as o,useEffect as
11
11
  object-assign
12
12
  (c) Sindre Sorhus
13
13
  @license MIT
14
- */var bt=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]))vt.call(n,s)&&(r[s]=n[s]);if(gt){i=gt(n);for(var a=0;a<i.length;a++)yt.call(n,i[a])&&(r[i[a]]=n[i[a]])}}return r},kt="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",xt=Function.call.bind(Object.prototype.hasOwnProperty),wt=function(){};if("production"!==process.env.NODE_ENV){var _t=kt,Tt={},It=xt;wt=function(t){var e="Warning: "+t;"undefined"!=typeof console&&console.error(e);try{throw new Error(e)}catch(t){}}}function Et(t,e,n,i,r){if("production"!==process.env.NODE_ENV)for(var o in t)if(It(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,_t)}catch(t){s=t}if(!s||s instanceof Error||wt((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 Tt)){Tt[s.message]=!0;var l=r?r():"";wt("Failed "+n+" type: "+s.message+(null!=l?l:""))}}}Et.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(Tt={})};var St=Et,Nt=function(){};function At(){return null}"production"!==process.env.NODE_ENV&&(Nt=function(t){var e="Warning: "+t;"undefined"!=typeof console&&console.error(e);try{throw new Error(e)}catch(t){}});var Mt=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(At),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+"]",kt);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 mt.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(xt(s,c)){var u=t(s,c,i,r,o+"."+c,kt);if(u instanceof Error)return u}return null}))},oneOf:function(t){if(!Array.isArray(t))return"production"!==process.env.NODE_ENV&&Nt(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."),At;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&&Nt("Invalid argument supplied to oneOfType, expected an instance of array."),At;for(var e=0;e<t.length;e++){var n=t[e];if("function"!=typeof n)return Nt("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+p(n)+" at index "+e+"."),At}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,kt);if(null==c)return null;c.data&&xt(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,kt);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=bt({},e[n],t);for(var d in c){var p=t[d];if(xt(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,kt);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!==kt){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&&(Nt("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=St,o.resetWarningCache=St.resetWarningCache,o.PropTypes=o,o};function Ft(){}function Ot(){}Ot.resetWarningCache=Ft;var Pt=V((function(t){if("production"!==process.env.NODE_ENV){var e=mt;t.exports=Mt(e.isElement,!0)}else t.exports=function(){function t(t,e,n,i,r,o){if(o!==kt){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:Ot,resetWarningCache:Ft};return n.PropTypes=n,n}()}));const Ct=/https?:\/\/(.*?\.)?eko.com/,Dt={"eko.project.interaction":"interaction","eko.project.swipe":"swipe"};let Rt=null,Bt=null,Lt=[];function zt(t){return e=>{var n;if(!Ct.test(e.origin)||"eko.embedapi"!==(null===(n=e.data)||void 0===n?void 0:n.source))return;const i=e.data,r=Dt[i.type];r&&(t?t(r,i.data):Lt.push({type:r,data:i.data}))}}"undefined"!=typeof window&&(Bt=zt(null),window.addEventListener("message",Bt));var Wt={subscribe:function(t){"function"==typeof t?Rt?console.warn("[eko-gallery-react] Ignoring events subscribe since already subscribed"):(Rt=t,Bt=zt(t),window.addEventListener("message",Bt),function(t){Lt.forEach((e=>{t(e.type,e.data)})),Lt=[]}(t)):console.warn("[eko-gallery-react] Ignoring events subscribe since a callback function was not provided as argument")},unsubscribe:function(){Bt?(window.removeEventListener("message",Bt),Bt=null,Rt=null,Lt=[]):console.warn("[eko-gallery-react] Ignoring events unsubscribe since not subscribed")},send:function(t,e){Rt?Rt(t,e):Lt.push({type:t,data:e})}};const Ut=({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){R.track("gallery.interaction",{elementid:`thumbnail-${t}`,interactiontype:"click"}),Wt.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})`}}))))};Ut.propTypes={index:Pt.number,activeIndex:Pt.number,setActiveIndex:Pt.func.isRequired,item:Pt.object.isRequired,src:Pt.string,navItemRefs:Pt.object.isRequired,itemIcon:Pt.string};const jt=({layout:t,nav:i,isVerticalNav:r,showPrevArrow:o,showNextArrow:s})=>{var a,l,c,u,d;const h=n(null),f=n(null),p="arrows"===(null==t||null===(a=t.mobile)||void 0===a||null===(a=a.config)||void 0===a||null===(a=a.navPagination)||void 0===a?void 0:a.type)?"eko-mobile-arrows":"",m="arrows"===(null!==(l=null==t||null===(c=t.desktop)||void 0===c||null===(c=c.config)||void 0===c||null===(c=c.navPagination)||void 0===c?void 0:c.type)&&void 0!==l?l:"arrows")?"eko-desktop-arrows":"",g=p||m,v=r?null==i||null===(u=i.current)||void 0===u?void 0:u.scrollHeight:null==i||null===(d=i.current)||void 0===d?void 0:d.scrollWidth;function y(t){const e=r?i.current.clientHeight:i.current.clientWidth,n=function(t,e){const n=r?e.scrollTop:e.scrollLeft;return Math.max(-n,Math.min(v-t-n,t))}("next"===t?e:-e,i.current);return{top:r?n:0,left:r?0:n,behavior:"smooth"}}function b(t){var e,n,r;const o=y(t),s="next"===t?null==f||null===(e=f.current)||void 0===e?void 0:e.id:null==h||null===(n=h.current)||void 0===n?void 0:n.id;var a,l;window.EkoAnalytics("track","gallery.interaction",{elementid:s,interactiontype:"click"}),null==i||null===(r=i.current)||void 0===r||r.scrollBy(o),a=s,l="click",R.track("gallery.interaction",{elementId:a,interactiontype:l}),Wt.send("interaction",{elementId:a,interactiontype:l})}return e.createElement(e.Fragment,null,g&&e.createElement(e.Fragment,null,e.createElement("button",q({type:"button","aria-label":"Go to previous item","aria-hidden":o?"false":"true",onClick:()=>b("prev"),ref:h,id:"eko-nav-prev-arrow",className:`eko-nav-arrow eko-prev-nav-button ${p} ${m} ${o?"":"eko-hidden-nav-button"}`},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:"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",q({type:"button","aria-label":"Go to next item","aria-hidden":s?"false":"true",onClick:()=>b("next"),ref:f,className:`eko-nav-arrow eko-next-nav-button ${p} ${m} ${s?"":"eko-hidden-nav-button"}`,id:"eko-nav-next-arrow"},s?{}:{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 $t(t,e,n){let i;return function(){const n=this,r=arguments;clearTimeout(i),i=setTimeout((function(){i=null,t.apply(n,r)}),e)}}jt.propTypes={layout:Pt.object.isRequired,nav:Pt.object.isRequired,isVerticalNav:Pt.bool.isRequired,showPrevArrow:Pt.bool.isRequired,showNextArrow:Pt.bool.isRequired};const qt=({items:t,setActiveIndex:a,activeIndex:l,layout:c,carouselMounted:u,forceMobile:d})=>{const h=n(null),f=n(null),p=n([]),m=3,[v,y]=i(null),[b,k]=i(!1),[x,w]=i(0),[_,T]=i(!1),[I,E]=i(!1);function S(){var t;const e=d||window.innerWidth<768?"mobile":"desktop",n=(null==c||null===(t=c[e])||void 0===t||null===(t=t.config)||void 0===t?void 0:t.orientation)||("desktop"===e?"left":"bottom");k("left"===n||"right"===n);const i=f.current.parentNode,r=u?".eko-smart-gallery-container iframe":".eko-carousel",o=i.querySelector(r);setTimeout((()=>{w(o.clientHeight)}),0)}function N(){var t,e;const n=d||g()?"mobile":"desktop",i=null!==(t=null==c||null===(e=c[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:m;!function(t=m){var e,n;const i=h.current;if(!i)return;const r="none"!==(null==c||null===(e=c.desktop)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.navPagination)||void 0===e?void 0:e.type),o=(s=null==c||null===(n=c.mobile)||void 0===n||null===(n=n.config)||void 0===n||null===(n=n.navPagination)||void 0===n?void 0:n.type,"mask"===s||"arrows"===s);var s;if((d||g())&&!o)return void i.style.setProperty("-webkit-mask","none");if(!g()&&!r)return void i.style.setProperty("-webkit-mask","none");const a=i.scrollHeight-i.clientHeight,l=i.scrollTop>t?"85%":"100%",u=i.scrollTop<=a-t?"15%":"0%",f=i.scrollWidth-i.clientWidth,p=i.scrollLeft>t?"15%":"0%",v=i.scrollLeft<=f-t?"85%":"100%";b?i.style.setProperty("-webkit-mask",`linear-gradient(0deg,#0000,#000 ${u} ${l},#0000)`):i.style.setProperty("-webkit-mask",`linear-gradient(90deg,#0000,#000 ${p} ${v},#0000)`)}(i),function(t=m){var e,n,i,r,o,s;const a=b?null==h||null===(e=h.current)||void 0===e?void 0:e.scrollTop:null==h||null===(n=h.current)||void 0===n?void 0:n.scrollLeft,l=b?null==h||null===(i=h.current)||void 0===i?void 0:i.clientHeight:null==h||null===(r=h.current)||void 0===r?void 0:r.clientWidth,c=b?null==h||null===(o=h.current)||void 0===o?void 0:o.scrollHeight:null==h||null===(s=h.current)||void 0===s?void 0:s.scrollWidth;c-t<l?(T(!1),E(!1)):a<=t?(T(!1),E(!0)):a+l>c-t?(T(!0),E(!1)):a+t>0&&a<c-t&&(T(!0),E(!0))}(i)}p.current=null==t?void 0:t.map(((t,e)=>{var n,i;return null!==(n=null==p||null===(i=p.current)||void 0===i?void 0:i[e])&&void 0!==n?n:r()}));const A=$t((t=>{var e;e=t,R.track("gallery.interaction",{elementid:"nav",interactiontype:e}),Wt.send("interaction",{elementid:"nav",interactiontype:e})}),200);const M=o((t=>{a({index:t,step:0,source:"nav"})}),[]);return s((()=>{var t;y(null===(t=p.current)||void 0===t?void 0:t[l])}),[l]),s((()=>{if(null!=v&&v.current&&null!=h&&h.current){const t=v.current,e=h.current.clientWidth/2,n=t.clientWidth/2,i=h.current.clientHeight/2,r=t.clientHeight/2;h.current.scrollTo({left:t.offsetLeft-e+n,top:t.offsetTop-i+r,behavior:"smooth"})}}),[v]),s((()=>{S()}),[]),s((()=>(window.addEventListener("resize",S),()=>{window.removeEventListener("resize",S)})),[f,u,d]),s((()=>{w(0),S()}),[t,f,u,d]),s((()=>{N();const t=new ResizeObserver(N);return t.observe(h.current),()=>{t.disconnect()}}),[t,d,b]),e.createElement("div",{className:"eko-nav-container",ref:f,style:{opacity:x>0?1:0,height:""+(x&&b?x+"px":"auto")}},e.createElement(jt,{layout:c,nav:h,isVerticalNav:b,showPrevArrow:_,showNextArrow:I}),e.createElement("ul",{className:`eko-nav eko-mobile-nav-selected-${null!==(F=null==c||null===(O=c.mobile)||void 0===O||null===(O=O.config)||void 0===O?void 0:O.navItemsSelectedType)&&void 0!==F?F:"underline"} eko-desktop-nav-selected-${null!==(P=null==c||null===(C=c.desktop)||void 0===C||null===(C=C.config)||void 0===C?void 0:C.navItemsSelectedType)&&void 0!==P?P:"underline"}`,ref:h,onScroll:function(){N()},onWheel:function(){A("wheel")},onTouchMove:function(){A("swipe")}},null==t?void 0:t.map(((t,n)=>{var i;const r=(null==t||null===(i=t.media)||void 0===i?void 0:i.url)||(null==t?void 0:t.media)||"";return e.createElement(Ut,{key:r+n,index:n,activeIndex:l,setActiveIndex:M,item:t,src:r,navItemRefs:p,itemIcon:null==t?void 0:t.icon})}))));var F,O,P,C};qt.propTypes={items:Pt.array.isRequired,activeIndex:Pt.number,setActiveIndex:Pt.func.isRequired,layout:Pt.object,carouselMounted:Pt.bool,forceMobile:Pt.bool};function Vt(){R.track("gallery.cover.displayed"),Wt.send("gallerycoverdisplayed")}function Gt(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 Ht=({item:t,src:i,srcset:r,sizes:o,isCoverElement:a})=>{const l=n(null);return s((()=>{var t;if(a){if(null===(t=l.current)||void 0===t||!t.complete)return l.current.addEventListener("load",Vt,{once:!0}),()=>{var t;null===(t=l.current)||void 0===t||t.removeEventListener("load",Vt,{once:!0})};Vt()}}),[]),e.createElement("img",{ref:l,src:Gt(i),srcSet:r,sizes:o,alt:t.name,fetchPriority:a?"high":"auto",loading:a?"eager":"lazy",style:{width:"100%",height:"100%"}})};Ht.propTypes={item:Pt.object.isRequired,src:Pt.string,srcset:Pt.string,sizes:Pt.string,isCoverElement:Pt.bool};const Kt=$t((t=>{var e;e=t,R.track("gallery.interaction",{elementid:"carousel",interactiontype:e}),Wt.send("interaction",{elementid:"carousel",interactiontype:e})}),200);function Xt(){Kt("wheel")}const Yt=a((({items:t,setActiveIndex:o,activeIndex:a,showSmartLoaders:c},u)=>{const d=n(null),h=n([]);h.current=null==t?void 0:t.map(((t,e)=>{var n,i;return null!==(n=null==h||null===(i=h.current)||void 0===i?void 0:i[e])&&void 0!==n?n:r()}));const[f,p]=i(),[m,g]=i(),v=n(a),y=n(!1);function b(){const e=function(t){const e=t.scrollLeft,n=t.scrollWidth-t.clientWidth;return 0===e?0:e>n?100:e/n*100}(d.current)*(null==t?void 0:t.length)/100,n=Math.min(Math.trunc(e),(null==t?void 0:t.length)-1),i=v.current;"nav"!==i.source&&"external-nav"!==i.source?(y.current&&n!==i.index&&(y.current=!1),y.current||(n>(null==t?void 0:t.length)-1?o({index:(null==t?void 0:t.length)-1,source:"carousel"}):o({index:n,source:"carousel"}))):n===i.index?y.current=!0:y.current&&n!==i.index&&(y.current=!1,o({index:n,source:"carousel"}))}return l(u,(()=>({prev:()=>{o({index:Math.max(0,v.current.index-1),source:"carousel"})},next:()=>{o({index:Math.min((null==t?void 0:t.length)-1,v.current.index+1),source:"carousel"})}}))),s((()=>{const t=d.current;if(t)return t.addEventListener("scroll",b),()=>{t.removeEventListener("scroll",b)}}),[t]),s((()=>{var t;let e=null===(t=h.current)||void 0===t?void 0:t[a.index];if(e&&("nav"===a.source||"external-nav"===a.source)){const t=e.current,n=d.current.clientWidth/2,i=(null==t?void 0:t.clientWidth)/2,r=(null==t?void 0:t.offsetLeft)-n+i;d.current.scrollTo({left:r,behavior:"smooth"})}}),[a]),s((()=>{v.current=a,"nav"!==a.source&&"external-nav"!==a.source||(y.current=!1)}),[a]),e.createElement("ul",{className:"eko-carousel",ref:d,onScroll:b,onWheel:Xt,onTouchMove:function(t){g(t.targetTouches[0].clientX)},onTouchStart:function(t){p(t.targetTouches[0].clientX),g(null)},onTouchEnd:function(){m&&f&&(f-m>75||f-m<-75)&&Kt("swipe")}},null==t?void 0:t.map(((t,n)=>{const i=(null==t?void 0:t.cover)||(null==t?void 0:t.media),r=(null==i?void 0:i.url)||i;return e.createElement("li",{className:"eko-carousel-item",key:r+n,ref:h.current[n]},e.createElement(Ht,{item:t,src:r,srcset:null==i?void 0:i.srcset,sizes:null==i?void 0:i.sizes,isCoverElement:0===n}),c&&"image"!==t.type&&e.createElement("div",{className:"eko-smart-loading"},e.createElement("div",null),e.createElement("p",null,"Loading video experience")))})))}));function Qt(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)}Yt.propTypes={items:Pt.array.isRequired,setActiveIndex:Pt.func.isRequired,activeIndex:Pt.object,showSmartLoaders:Pt.bool},Yt.displayName="CarouselLoop";const Jt="eko.project.invoke",Zt="eko.block.invoke";function te(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 ee(t){return`#variantId=${encodeURIComponent(t)}`}const ne=a((({config:t,instanceId:r,setActiveItem:o,activeItem:a,variantId:c,smartGalleryLoaded:u,onLoad:d,forceMobile:h},f)=>{var p,m,v;const y=null!==(p=null===(m=t.options)||void 0===m?void 0:m.galleryEnv)&&void 0!==p?p:"",b=null===(v=t.__autoGenerated)||void 0===v||null===(v=v.publishItem)||void 0===v?void 0:v.id,k=function(t={}){let e="";return Object.entries(t).forEach((([t,n])=>{e+=`&${t}=${n}`})),e}(null==t?void 0:t.qp),x=function(t,e,n){return`https://${t}play.eko.com/embed?${n?`id=${n}`:`piid=${e}`}&nocover=true&galleryBlockMode=gallery&eko_pixel=true`}(y,b,r),w=n(null),_=n(null),T=n(!1),[I,E]=i(ee(c||"ekonovar")),[S,N]=i(x+k+I);let A;function M(){R.track("gallery.project.display"),d(),Wt.send("galleryloaded")}return l(f,(()=>({prev:()=>{te(null==_?void 0:_.current,Zt,{action:"onPrevModule"})},next:()=>{te(null==_?void 0:_.current,Zt,{action:"onNextModule"})}}))),s((()=>{T.current?te(null==_?void 0:_.current,Jt,{action:"updateVariant",args:{id:c}}):E(ee(c))}),[c]),s((()=>{te(null==_?void 0:_.current,Zt,{action:"updateActiveModule",args:{activeItemIndex:null==a?void 0:a.index,activeModuleIndex:null==a?void 0:a.step}})}),[a]),s((()=>{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))&&!T.current)return e=t.data.data.blockType,T.current=!0,void("GalleryBlock"===e?te(null==_?void 0:_.current,Zt,{action:"updateActiveModule",args:{activeItemIndex:null==a?void 0:a.index,activeModuleIndex:null==a?void 0:a.step}}):M());var e;if(T.current){if(function(t){var e;return Qt(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==a?void 0:a.index)&&n===(null==a?void 0:a.step)||o({index:e,step:n,source:"carousel"})}(t);(function(t){var e;return Qt(t)&&"activeModuleChangeDone"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.name)})(t)&&!u&&M()}}return A=h||g()?"mobile":"desktop",function(t,e={}){window.addEventListener("message",t,e)}(t),()=>{!function(t,e={}){window.removeEventListener("message",t,e)}(t)}}),[a]),s((()=>{T.current||te(null==_?void 0:_.current,Jt,{action:"queryProjectStarted"})}),[a,u]),s((()=>{T.current=!1}),[t]),s((()=>{N(x+k+I)}),[I]),e.createElement("div",{className:"eko-smart-gallery-container "+(u?"":"eko-project-not-ready"),ref:w,"data-type":"smart-gallery","data-qp":k,"data-variant":c,"data-device":A},e.createElement("iframe",{allow:"autoplay; fullscreen",title:"eko gallery",src:S,style:{border:0},ref:_}))}));ne.propTypes={config:Pt.object.isRequired,instanceId:Pt.string,setActiveItem:Pt.func.isRequired,activeItem:Pt.object.isRequired,variantId:Pt.string,smartGalleryLoaded:Pt.bool,onLoad:Pt.func,forceMobile:Pt.bool},ne.displayName="SmartGallery";const ie=()=>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}'),re=({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")}}`)};re.propTypes={layout:Pt.object,style:Pt.object},b("experiment");const oe=({activeVariantId:t,activeElementId:e,hasInteractive:i,experiments:r,publishItem:o})=>{const a="gallery",l=n(t),c=n(e),u=n(i),d=n(r),h=n(o);s((()=>{l.current=t,c.current=e,u.current=i,d.current=r,h.current=o}),[t,e,i,r,o]);const f={publishItemPacker:{tag:a,schema:"iglu:com.helloeko/publishitem/jsonschema/1-0-0",match:/.*/,getData:function(){const t=h.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:a,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:a,schema:"iglu:com.helloeko/gallery/jsonschema/1-0-2",match:/^gallery.*/,getData:function(){var t;return{activeitemid:c.current.toString(),activevariantid:l.current,hasinteractive:u.current,version:(null===(t=window.eko)||void 0===t||null===(t=t.gallery)||void 0===t?void 0:t.version)||""}}},activeVariantIdPacker:{tag:a,schema:"iglu:com.helloeko/variant/jsonschema/1-0-1",match:/.*/,getData:function(){if(l.current)return{id:l.current}}},experimentPacker:{tag:a,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}(d.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 s((()=>(Object.values(f).forEach((t=>{window.EkoAnalytics("registerContextPacker",t)})),()=>{window.EkoAnalytics("reset",a)})),[]),null};oe.propTypes={activeVariantId:Pt.string,activeElementId:Pt.number,hasInteractive:Pt.bool,experiments:Pt.array,publishItem:Pt.object};const se=({variantId:t,activeItem:i,hasInteractive:r,activeIndex:o,experiments:a,publishItem:l})=>{const c=n(!0);return s((()=>{c.current||t&&R.track("gallery.variant.change")}),[t]),s((()=>{c.current||R.track("gallery.element.change",{activeIndex:o})}),[o]),s((()=>{c.current||i&&null!=l&&l.id&&R.track("gallery.asset.view",{publishitemid:l.id,type:i.type,name:i.name})}),[i]),s((()=>{c.current=!1}),[]),e.createElement(oe,{activeVariantId:t||"ekonovar",activeElementId:o,hasInteractive:r,experiments:a,publishItem:l})};se.propTypes={variantId:Pt.string,activeItem:Pt.object,hasInteractive:Pt.bool,activeIndex:Pt.number,experiments:Pt.array,publishItem:Pt.object};const ae="eko-gallery-react";function le(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 ce=a((({className:t,config:r,instanceId:o,variantId:a,activeItem:l={index:0,step:0},onEvent:c,forceMobile:u},d)=>{var h,f,p,m,g,v;const y=null!==(h=null===(f=r.options)||void 0===f?void 0:f.loadingTimeout)&&void 0!==h?h:12,b=null===(p=null===(m=r.options)||void 0===m?void 0:m.showCoverLoadAnimation)||void 0===p||p,[k,x]=i(le(r,a)),[w,_]=i({index:l.index,step:l.step,source:"external-nav"}),[T,I]=i(!1),[E,S]=i(!1),[N,A]=i("eko-desktop"),M=n(!1),F=n(!1),O=n(l),P=n(null),C=n(a);function D(){const t=u||window.innerWidth<768?"eko-mobile":"eko-desktop";A(t)}return F.current||(Wt.send("galleryinit"),F.current=!0),s((()=>{const t=C.current!==a;C.current=a,x(le(r,a)),t&&!M.current&&_({index:0,step:0,source:"external-nav"})}),[r,a]),s((()=>{if(c)return Wt.subscribe(c),()=>{Wt.unsubscribe()}}),[c]),s((()=>{M.current=E}),[E]),s((()=>{I(!1),S(!1);const t=setTimeout((()=>{M.current||(I(!0),R.track("gallery.load.timeout"))}),1e3*y);return()=>{clearTimeout(t)}}),[r]),s((()=>{D()}),[u]),s((()=>(window.addEventListener("resize",D),D(),()=>{window.removeEventListener("resize",D)})),[u]),s((()=>(window.EkoAnalytics("trackElementVisibility",P.current,ae),()=>{window.EkoAnalytics("stopTrackingElementVisibility",ae)})),[]),s((()=>{!("carousel"===(null==w?void 0:w.source)||"nav"===(null==w?void 0:w.source))||(null==w?void 0:w.index)===l.index&&(null==w?void 0:w.step)===l.step||Wt.send("activeitemchanged",{index:null==w?void 0:w.index,step:null==w?void 0:w.step})}),[w,l]),s((()=>{O.current.index===l.index&&O.current.step===l.step||(O.current=l,_({index:l.index,step:l.step,source:"external-nav"}))}),[l]),e.createElement(e.Fragment,null,e.createElement(ie,null),e.createElement(re,{layout:r.layout,style:r.style,forceMobile:u}),e.createElement(se,{variantId:a,activeItem:null==k||null===(g=k.items)||void 0===g?void 0:g[w.index],activeIndex:w.index,hasInteractive:E,experiments:r.experiments,publishItem:null==r||null===(v=r.__autoGenerated)||void 0===v?void 0:v.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}(r.layout)} ${null!=t?t:""}`.trim()} ${N}`,"aria-controls":"main-content",ref:P},e.createElement(qt,{items:(null==k?void 0:k.items)||[],setActiveIndex:_,activeIndex:w.index,layout:r.layout,carouselMounted:E,forceMobile:u}),!E&&e.createElement(Yt,{ref:d,items:(null==k?void 0:k.items)||[],setActiveIndex:_,activeIndex:{index:w.index,source:null==w?void 0:w.source},showSmartLoaders:!T&&b}),!T&&e.createElement(ne,{ref:d,config:r,instanceId:o,activeItem:w,setActiveItem:_,variantId:null==k?void 0:k.variantId,smartGalleryLoaded:E,forceMobile:u,onLoad:function(){S(!0)}})))}));ce.propTypes={className:Pt.string,config:Pt.object.isRequired,instanceId:Pt.string,variantId:Pt.string,activeItem:Pt.object,onEvent:Pt.func,forceMobile:Pt.bool,onPrev:Pt.func,onNext:Pt.func},ce.displayName="EkoGallery";var ue=c(ce);const de=b("gallery-react");const he=a(((t,n)=>{var i;s((()=>(de.setDataStorage("gallery-react",{config:t.config}),window.eko=window.eko||{},window.eko.config=t.config,window.eko.gallery={version:"4.0.1"},()=>{window.eko.config=void 0})),[t.config]);const{children:r,...o}=t;return void 0!==t.config?e.createElement(ue,q({ref:n},o,{key:null===(i=t.config.__autoGenerated)||void 0===i||null===(i=i.publishItem)||void 0===i?void 0:i.id})):r}));he.propTypes={className:Pt.string,config:Pt.object,variantId:Pt.string,onEvent:Pt.func,instanceId:Pt.string,children:Pt.node},he.displayName="EkoGalleryWrapper";var fe,pe,me,ge,ve,ye,be,ke,xe,we,_e,Te,Ie,Ee,Se,Ne,Ae,Me,Fe,Oe,Pe,Ce,De,Re,Be,Le,ze,We,Ue,je,$e,qe,Ve,Ge,He,Ke,Xe,Ye,Qe,Je,Ze,tn,en,nn,rn,on,sn,an,ln,cn,un,dn,hn,fn=c(he);const pn=1,mn=2,gn=4,vn=8,yn=16,bn=1,kn=4,xn=8,wn=16,_n="[",Tn="[!",In="]",En={},Sn=Symbol(),Nn="http://www.w3.org/1999/xhtml",An=!1;var Mn=Array.isArray,Fn=Array.prototype.indexOf,On=Array.from,Pn=Object.defineProperty,Cn=Object.getOwnPropertyDescriptor,Dn=Object.getOwnPropertyDescriptors,Rn=Object.prototype,Bn=Array.prototype,Ln=Object.getPrototypeOf,zn=Object.isExtensible;function Wn(){var t,e;return{promise:new Promise(((n,i)=>{t=n,e=i})),resolve:t,reject:e}}const Un=2,jn=4,$n=8,qn=1<<24,Vn=16,Gn=32,Hn=64,Kn=128,Xn=512,Yn=1024,Qn=2048,Jn=4096,Zn=8192,ti=16384,ei=32768,ni=65536,ii=1<<17,ri=1<<18,oi=1<<19,si=1<<20,ai=1<<25,li=32768,ci=1<<21,ui=1<<22,di=1<<23,hi=Symbol("$state"),fi=Symbol("legacy props"),pi=Symbol(""),mi=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},gi=3,vi=8;function yi(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function bi(t){console.warn("https://svelte.dev/e/hydration_mismatch")}let ki,xi=!1;function wi(t){xi=t}function _i(t){if(null===t)throw bi(),En;return ki=t}function Ti(){return _i(xo(ki))}function Ii(t){if(xi){if(null!==xo(ki))throw bi(),En;ki=t}}function Ei(t=!0){for(var e=0,n=ki;;){if(n.nodeType===vi){var i=n.data;if(i===In){if(0===e)return n;e-=1}else i!==_n&&i!==Tn||(e+=1)}var r=xo(n);t&&n.remove(),n=r}}function Si(t){if(!t||t.nodeType!==vi)throw bi(),En;return t.data}function Ni(t){return t===this.v}function Ai(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 Mi=!1,Fi=null;function Oi(t){Fi=t}function Pi(t){return Ri().get(t)}function Ci(t,e=!1,n){Fi={p:Fi,i:!1,c:null,e:null,s:t,x:null,l:null}}function Di(t){var e=Fi,n=e.e;if(null!==n)for(var i of(e.e=null,n))Oo(i);return e.i=!0,Fi=e.p,{}}function Ri(t){var e,n;return null===Fi&&yi(),null!==(n=(e=Fi).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}(Fi)||void 0)}let Bi=[];function Li(){var t=Bi;Bi=[],function(t){for(var e=0;e<t.length;e++)t[e]()}(t)}function zi(t){if(0===Bi.length&&!tr){var e=Bi;queueMicrotask((()=>{e===Bi&&Li()}))}Bi.push(t)}function Wi(){for(;Bi.length>0;)Li()}function Ui(t){var e=ts;if(null===e)return Qo.f|=di,t;if(e.f&ei)ji(t,e);else{if(!(e.f&Kn))throw t;e.b.error(t)}}function ji(t,e){for(;null!==e;){if(e.f&Kn)try{return void e.b.error(t)}catch(e){t=e}e=e.parent}throw t}const $i=-7169;function qi(t,e){t.f=t.f&$i|e}function Vi(t){t.f&Xn||null===t.deps?qi(t,Yn):qi(t,Jn)}function Gi(t){if(null!==t)for(const e of t)e.f&Un&&e.f&li&&(e.f^=li,Gi(e.deps))}function Hi(t,e,n){t.f&Qn?e.add(t):t.f&Jn&&n.add(t),Gi(t.deps),qi(t,Yn)}const Ki=new Set;let Xi=null,Yi=null,Qi=[],Ji=null,Zi=!1,tr=!1;var er=new WeakMap,nr=new WeakMap,ir=new WeakMap,rr=new WeakMap,or=new WeakMap,sr=new WeakMap,ar=new WeakMap,lr=new WeakSet;class cr{constructor(){j(this,lr),$(this,"committed",!1),$(this,"current",new Map),$(this,"previous",new Map),W(this,er,new Set),W(this,nr,new Set),W(this,ir,0),W(this,rr,0),W(this,or,null),W(this,sr,new Set),W(this,ar,new Set),$(this,"skipped_effects",new Set),$(this,"is_fork",!1)}is_deferred(){return this.is_fork||z(rr,this)>0}process(t){Qi=[],this.apply();var e,n=[],i=[];for(const e of t)B(lr,this,ur).call(this,e,n,i);(this.is_fork||B(lr,this,hr).call(this),this.is_deferred())?(B(lr,this,dr).call(this,i),B(lr,this,dr).call(this,n)):(Xi=null,vr(i),vr(n),null===(e=z(or,this))||void 0===e||e.resolve());Yi=null}capture(t,e){var n;(e===Sn||this.previous.has(t)||this.previous.set(t,e),t.f&di)||(this.current.set(t,t.v),null===(n=Yi)||void 0===n||n.set(t,t.v))}activate(){Xi=this,this.apply()}deactivate(){Xi===this&&(Xi=null,Yi=null)}flush(){if(this.activate(),Qi.length>0){if(pr(),null!==Xi&&Xi!==this)return}else 0===z(ir,this)&&this.process([]);this.deactivate()}discard(){for(const t of z(nr,this))t(this);z(nr,this).clear()}increment(t){U(ir,this,z(ir,this)+1),t&&U(rr,this,z(rr,this)+1)}decrement(t){U(ir,this,z(ir,this)-1),t&&U(rr,this,z(rr,this)-1),this.revive()}revive(){for(const t of z(sr,this))z(ar,this).delete(t),qi(t,Qn),kr(t);for(const t of z(ar,this))qi(t,Jn),kr(t);this.flush()}oncommit(t){z(er,this).add(t)}ondiscard(t){z(nr,this).add(t)}settled(){var t;return(null!==(t=z(or,this))&&void 0!==t?t:U(or,this,Wn())).promise}static ensure(){if(null===Xi){const t=Xi=new cr;Ki.add(Xi),tr||cr.enqueue((()=>{Xi===t&&t.flush()}))}return Xi}static enqueue(t){zi(t)}apply(){}}function ur(t,e,n){t.f^=Yn;for(var i=t.first,r=null;null!==i;){var o=i.f,s=!!(o&(Gn|Hn));if(!(s&&!!(o&Yn)||!!(o&Zn)||this.skipped_effects.has(i))&&null!==i.fn){s?i.f^=Yn:null!==r&&o&(jn|$n|qn)?r.b.defer_effect(i):o&jn?e.push(i):hs(i)&&(o&Vn&&z(sr,this).add(i),vs(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 dr(t){for(var e=0;e<t.length;e+=1)Hi(t[e],z(sr,this),z(ar,this))}function hr(){if(0===z(rr,this)){for(const t of z(er,this))t();z(er,this).clear()}0===z(ir,this)&&B(lr,this,fr).call(this)}function fr(){if(Ki.size>1){this.previous.clear();var t=Yi,e=!0;for(const t of Ki){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=Qi;Qi=[];const e=new Set,o=new Map;for(const t of i)yr(t,r,e,o);if(Qi.length>0){Xi=t,t.apply();for(const e of Qi)B(lr,t,ur).call(t,e,[],[]);t.deactivate()}Qi=n}}Xi=null,Yi=t}this.committed=!0,Ki.delete(this)}function pr(){var t=Ho;Zi=!0;try{var e=0;for(Ko(!0);Qi.length>0;){var n=cr.ensure();if(e++>1e3)mr();n.process(Qi),io.clear()}}finally{Zi=!1,Ko(t),Ji=null}}function mr(){try{!function(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}()}catch(t){ji(t,Ji)}}let gr=null;function vr(t){var e=t.length;if(0!==e){for(var n=0;n<e;){var i,r=t[n++];if(!(r.f&(ti|Zn))&&hs(r))if(gr=new Set,vs(r),null===r.deps&&null===r.first&&null===r.nodes&&(null===r.teardown&&null===r.ac?Uo(r):r.fn=null),(null===(i=gr)||void 0===i?void 0:i.size)>0){io.clear();for(const t of gr){if(t.f&(ti|Zn))continue;const e=[t];let n=t.parent;for(;null!==n;)gr.has(n)&&(gr.delete(n),e.push(n)),n=n.parent;for(let t=e.length-1;t>=0;t--){const n=e[t];n.f&(ti|Zn)||vs(n)}}gr.clear()}}gr=null}}function yr(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&Un?yr(r,e,n,i):t&(ui|Vn)&&!(t&Qn)&&br(r,e,i)&&(qi(r,Qn),kr(r))}}function br(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&Un&&br(i,e,n))return n.set(i,!0),!0}return n.set(t,!1),!1}function kr(t){for(var e=Ji=t;null!==e.parent;){var n=(e=e.parent).f;if(Zi&&e===ts&&n&Vn&&!(n&ri))return;if(n&(Hn|Gn)){if(!(n&Yn))return;e.f^=Yn}}Qi.push(e)}var xr=ni|oi|Kn;var wr=new WeakMap,_r=new WeakMap,Tr=new WeakMap,Ir=new WeakMap,Er=new WeakMap,Sr=new WeakMap,Nr=new WeakMap,Ar=new WeakMap,Mr=new WeakMap,Fr=new WeakMap,Or=new WeakMap,Pr=new WeakMap,Cr=new WeakMap,Dr=new WeakMap,Rr=new WeakMap,Br=new WeakMap,Lr=new WeakMap,zr=new WeakSet;class Wr{constructor(t,e,n){j(this,zr),$(this,"parent",void 0),$(this,"is_pending",!1),W(this,wr,void 0),W(this,_r,xi?ki:null),W(this,Tr,void 0),W(this,Ir,void 0),W(this,Er,void 0),W(this,Sr,null),W(this,Nr,null),W(this,Ar,null),W(this,Mr,null),W(this,Fr,null),W(this,Or,0),W(this,Pr,0),W(this,Cr,!1),W(this,Dr,new Set),W(this,Rr,new Set),W(this,Br,null),W(this,Lr,function(t){let e,n=0,i=oo(0);return()=>{Ao()&&(bs(i),Co((()=>(0===n&&(e=ws((()=>t((()=>uo(i)))))),n+=1,()=>{zi((()=>{var t;n-=1,0===n&&(null===(t=e)||void 0===t||t(),e=void 0,uo(i))}))}))))}}((()=>(U(Br,this,oo(z(Or,this))),()=>{U(Br,this,null)})))),U(wr,this,t),U(Tr,this,e),U(Ir,this,n),this.parent=ts.b,this.is_pending=!!z(Tr,this).pending,U(Er,this,Ro((()=>{if(ts.b=this,xi){const t=z(_r,this);Ti();t.nodeType===vi&&t.data===Tn?B(zr,this,jr).call(this):(B(zr,this,Ur).call(this),0===z(Pr,this)&&(this.is_pending=!1))}else{var t=B(zr,this,$r).call(this);try{U(Sr,this,Bo((()=>n(t))))}catch(t){this.error(t)}z(Pr,this)>0?B(zr,this,Vr).call(this):this.is_pending=!1}return()=>{var t;null===(t=z(Fr,this))||void 0===t||t.remove()}}),xr)),xi&&U(wr,this,ki)}defer_effect(t){Hi(t,z(Dr,this),z(Rr,this))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!z(Tr,this).pending}update_pending_count(t){B(zr,this,Gr).call(this,t),U(Or,this,z(Or,this)+t),z(Br,this)&&co(z(Br,this),z(Or,this))}get_effect_pending(){return z(Lr,this).call(this),bs(z(Br,this))}error(t){var e=z(Tr,this).onerror;let n=z(Tr,this).failed;if(z(Cr,this)||!e&&!n)throw t;z(Sr,this)&&(Wo(z(Sr,this)),U(Sr,this,null)),z(Nr,this)&&(Wo(z(Nr,this)),U(Nr,this,null)),z(Ar,this)&&(Wo(z(Ar,this)),U(Ar,this,null)),xi&&(_i(z(_r,this)),function(t=1){if(xi){for(var e=t,n=ki;e--;)n=xo(n);ki=n}}(),_i(Ei()));var i=!1,r=!1;const o=()=>{i?console.warn("https://svelte.dev/e/svelte_boundary_reset_noop"):(i=!0,r&&function(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}(),cr.ensure(),U(Or,this,0),null!==z(Ar,this)&&jo(z(Ar,this),(()=>{U(Ar,this,null)})),this.is_pending=this.has_pending_snippet(),U(Sr,this,B(zr,this,qr).call(this,(()=>(U(Cr,this,!1),Bo((()=>z(Ir,this).call(this,z(wr,this)))))))),z(Pr,this)>0?B(zr,this,Vr).call(this):this.is_pending=!1)};var s=Qo;try{Zo(null),r=!0,null==e||e(t,o),r=!1}catch(t){ji(t,z(Er,this)&&z(Er,this).parent)}finally{Zo(s)}n&&zi((()=>{U(Ar,this,B(zr,this,qr).call(this,(()=>{cr.ensure(),U(Cr,this,!0);try{return Bo((()=>{n(z(wr,this),(()=>t),(()=>o))}))}catch(t){return ji(t,z(Er,this).parent),null}finally{U(Cr,this,!1)}})))}))}}function Ur(){try{U(Sr,this,Bo((()=>z(Ir,this).call(this,z(wr,this)))))}catch(t){this.error(t)}}function jr(){const t=z(Tr,this).pending;t&&(U(Nr,this,Bo((()=>t(z(wr,this))))),cr.enqueue((()=>{var t=B(zr,this,$r).call(this);U(Sr,this,B(zr,this,qr).call(this,(()=>(cr.ensure(),Bo((()=>z(Ir,this).call(this,t))))))),z(Pr,this)>0?B(zr,this,Vr).call(this):(jo(z(Nr,this),(()=>{U(Nr,this,null)})),this.is_pending=!1)})))}function $r(){var t=z(wr,this);return this.is_pending&&(U(Fr,this,bo()),z(wr,this).before(z(Fr,this)),t=z(Fr,this)),t}function qr(t){var e=ts,n=Qo,i=Fi;es(z(Er,this)),Zo(z(Er,this)),Oi(z(Er,this).ctx);try{return t()}catch(t){return Ui(t),null}finally{es(e),Zo(n),Oi(i)}}function Vr(){const t=z(Tr,this).pending;null!==z(Sr,this)&&(U(Mr,this,document.createDocumentFragment()),z(Mr,this).append(z(Fr,this)),Go(z(Sr,this),z(Mr,this))),null===z(Nr,this)&&U(Nr,this,Bo((()=>t(z(wr,this)))))}function Gr(t){var e;if(this.has_pending_snippet()){if(U(Pr,this,z(Pr,this)+t),0===z(Pr,this)){this.is_pending=!1;for(const t of z(Dr,this))qi(t,Qn),kr(t);for(const t of z(Rr,this))qi(t,Jn),kr(t);z(Dr,this).clear(),z(Rr,this).clear(),z(Nr,this)&&jo(z(Nr,this),(()=>{U(Nr,this,null)})),z(Mr,this)&&(z(wr,this).before(z(Mr,this)),U(Mr,this,null))}}else this.parent&&B(zr,e=this.parent,Gr).call(e,t)}function Hr(t,e,n,i){const r=Xr;if(0!==n.length||0!==t.length){var o,s,a,l,c=Xi,u=ts,d=(o=ts,s=Qo,a=Fi,l=Xi,function(t=!0){es(o),Zo(s),Oi(a),t&&(null==l||l.activate())});t.length>0?Promise.all(t).then((()=>{d();try{return h()}finally{null==c||c.deactivate(),Kr()}})):h()}else i(e.map(r));function h(){Promise.all(n.map((t=>Yr(t)))).then((t=>{d();try{i([...e.map(r),...t])}catch(t){u.f&ti||ji(t,u)}null==c||c.deactivate(),Kr()})).catch((t=>{ji(t,u)}))}}function Kr(){es(null),Zo(null),Oi(null)}function Xr(t){var e=Un|Qn,n=null!==Qo&&Qo.f&Un?Qo:null;null!==ts&&(ts.f|=oi);return{ctx:Fi,deps:null,effects:null,equals:Ni,f:e,fn:t,reactions:null,rv:0,v:Sn,wv:0,parent:null!=n?n:ts,ac:null}}function Yr(t,e,n){let i=ts;null===i&&function(){throw new Error("https://svelte.dev/e/async_derived_orphan")}();var r=i.b,o=void 0,s=oo(Sn),a=!Qo,l=new Map;return function(t){No(ui|oi,t,!0)}((()=>{var e=Wn();o=e.promise;try{Promise.resolve(t()).then(e.resolve,e.reject).then((()=>{n===Xi&&n.committed&&n.deactivate(),Kr()}))}catch(t){e.reject(t),Kr()}var n=Xi;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(mi),l.delete(n),l.set(n,e)}const u=(t,e=void 0)=>{if(n.activate(),e)e!==mi&&(s.f|=di,co(s,e));else{s.f&di&&(s.f^=di),co(s,t);for(const[t,e]of l){if(l.delete(t),t===n)break;e.reject(mi)}}a&&(r.update_pending_count(-1),n.decrement(c))};e.promise.then(u,(t=>u(null,t||"unknown")))})),Mo((()=>{for(const t of l.values())t.reject(mi)})),new Promise((t=>{!function e(n){function i(){n===o?t(s):e(o)}n.then(i,i)}(o)}))}function Qr(t){const e=Xr(t);return is(e),e}function Jr(t){const e=Xr(t);return e.equals=Ai,e}function Zr(t){var e=t.effects;if(null!==e){t.effects=null;for(var n=0;n<e.length;n+=1)Wo(e[n])}}function to(t){var e,n=ts;es(function(t){for(var e=t.parent;null!==e;){if(!(e.f&Un))return e.f&ti?null:e;e=e.parent}return null}(t));try{t.f&=~li,Zr(t),e=ps(t)}finally{es(n)}return e}function eo(t){var e,n,i=to(t);if(!t.equals(i)&&(t.wv=ds(),(null===(e=Xi)||void 0===e||!e.is_fork||null===t.deps)&&(t.v=i,null===t.deps)))return void qi(t,Yn);Xo||(null!==Yi?(Ao()||null!==(n=Xi)&&void 0!==n&&n.is_fork)&&Yi.set(t,i):Vi(t))}let no=new Set;const io=new Map;let ro=!1;function oo(t,e){return{f:0,v:t,reactions:null,equals:Ni,rv:0,wv:0}}function so(t,e){const n=oo(t);return is(n),n}function ao(t,e=!1,n=!0){const i=oo(t);return e||(i.equals=Ai),i}function lo(t,e,n=!1){var i;return null!==Qo&&(!Jo||Qo.f&ii)&&Qo.f&(Un|Vn|ui|ii)&&(null===(i=ns)||void 0===i||!i.includes(t))&&function(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}(),co(t,n?fo(e):e)}function co(t,e){if(!t.equals(e)){var n=t.v;Xo?io.set(t,e):io.set(t,n),t.v=e;var i=cr.ensure();if(i.capture(t,n),t.f&Un){const e=t;t.f&Qn&&to(e),Vi(e)}t.wv=ds(),ho(t,Qn),null!==ts&&ts.f&Yn&&!(ts.f&(Gn|Hn))&&(null===ss?function(t){ss=t}([t]):ss.push(t)),!i.is_fork&&no.size>0&&!ro&&function(){ro=!1;var t=Ho;Ko(!0);const e=Array.from(no);try{for(const t of e)t.f&Yn&&qi(t,Jn),hs(t)&&vs(t)}finally{Ko(t)}no.clear()}()}return e}function uo(t){lo(t,t.v+1)}function ho(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,a=!(s&Qn);if(a&&qi(o,e),s&Un){var l,c=o;null===(l=Yi)||void 0===l||l.delete(c),s&li||(s&Xn&&(o.f|=li),ho(c,Jn))}else a&&(s&Vn&&null!==gr&&gr.add(o),kr(o))}}function fo(t){if("object"!=typeof t||null===t||hi in t)return t;const e=Ln(t);if(e!==Rn&&e!==Bn)return t;var n=new Map,i=Mn(t),r=so(0),o=cs,s=t=>{if(cs===o)return t();var e=Qo,n=cs;Zo(null),us(o);var i=t();return Zo(e),us(n),i};return i&&n.set("length",so(t.length)),new Proxy(t,{defineProperty(t,e,i){"value"in i&&!1!==i.configurable&&!1!==i.enumerable&&!1!==i.writable||function(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}();var r=n.get(e);return void 0===r?r=s((()=>{var t=so(i.value);return n.set(e,t),t})):lo(r,i.value,!0),!0},deleteProperty(t,e){var i=n.get(e);if(void 0===i){if(e in t){const t=s((()=>so(Sn)));n.set(e,t),uo(r)}}else lo(i,Sn),uo(r);return!0},get(e,i,r){var o;if(i===hi)return t;var a=n.get(i),l=i in e;if(void 0===a&&(!l||null!==(o=Cn(e,i))&&void 0!==o&&o.writable)&&(a=s((()=>so(fo(l?e[i]:Sn)))),n.set(i,a)),void 0!==a){var c=bs(a);return c===Sn?void 0:c}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=bs(r))}else if(void 0===i){var o=n.get(e),s=null==o?void 0:o.v;if(void 0!==o&&s!==Sn)return{enumerable:!0,configurable:!0,value:s,writable:!0}}return i},has(t,e){var i;if(e===hi)return!0;var r=n.get(e),o=void 0!==r&&r.v!==Sn||Reflect.has(t,e);if((void 0!==r||null!==ts&&(!o||null!==(i=Cn(t,e))&&void 0!==i&&i.writable))&&(void 0===r&&(r=s((()=>so(o?fo(t[e]):Sn))),n.set(e,r)),bs(r)===Sn))return!1;return o},set(t,e,o,a){var l,c=n.get(e),u=e in t;if(i&&"length"===e)for(var d=o;d<c.v;d+=1){var h=n.get(d+"");void 0!==h?lo(h,Sn):d in t&&(h=s((()=>so(Sn))),n.set(d+"",h))}void 0===c?(!u||null!==(l=Cn(t,e))&&void 0!==l&&l.writable)&&(lo(c=s((()=>so(void 0))),fo(o)),n.set(e,c)):(u=c.v!==Sn,lo(c,s((()=>fo(o)))));var f=Reflect.getOwnPropertyDescriptor(t,e);if(null!=f&&f.set&&f.set.call(a,o),!u){if(i&&"string"==typeof e){var p=n.get("length"),m=Number(e);Number.isInteger(m)&&m>=p.v&&lo(p,m+1)}uo(r)}return!0},ownKeys(t){bs(r);var e=Reflect.ownKeys(t).filter((t=>{var e=n.get(t);return void 0===e||e.v!==Sn}));for(var[i,o]of n)o.v===Sn||i in t||e.push(i);return e},setPrototypeOf(){!function(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}()}})}var po,mo,go,vo;function yo(){if(void 0===po){po=window,mo=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;go=Cn(e,"firstChild").get,vo=Cn(e,"nextSibling").get,zn(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),zn(n)&&(n.__t=void 0)}}function bo(t=""){return document.createTextNode(t)}function ko(t){return go.call(t)}function xo(t){return vo.call(t)}function wo(t,e){if(!xi)return ko(t);var n=ko(ki);if(null===n)n=ki.appendChild(bo());else if(e&&n.nodeType!==gi){var i,r=bo();return null===(i=n)||void 0===i||i.before(r),_i(r),r}return _i(n),n}function _o(t,e=!1){var n;if(!xi){var i=ko(t);return i instanceof Comment&&""===i.data?xo(i):i}if(e&&(null===(n=ki)||void 0===n?void 0:n.nodeType)!==gi){var r,o=bo();return null===(r=ki)||void 0===r||r.before(o),_i(o),o}return ki}function To(t,e=1,n=!1){var i;let r=xi?ki:t;for(var o;e--;)o=r,r=xo(r);if(!xi)return r;if(n&&(null===(i=r)||void 0===i?void 0:i.nodeType)!==gi){var s,a=bo();if(null===r)null===(s=o)||void 0===s||s.after(a);else r.before(a);return _i(a),a}return _i(r),r}function Io(t){t.textContent=""}function Eo(t){var e=Qo,n=ts;Zo(null),es(null);try{return t()}finally{Zo(e),es(n)}}function So(t){null===ts&&(null===Qo&&function(){throw new Error("https://svelte.dev/e/effect_orphan")}(),function(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}()),Xo&&function(){throw new Error("https://svelte.dev/e/effect_in_teardown")}()}function No(t,e,n){var i=ts;null!==i&&i.f&Zn&&(t|=Zn);var r={ctx:Fi,deps:null,nodes:null,f:t|Qn|Xn,first:null,fn:e,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,wv:0,ac:null};if(n)try{vs(r),r.f|=ei}catch(t){throw Wo(r),t}else null!==e&&kr(r);var o=r;if(!n||null!==o.deps||null!==o.teardown||null!==o.nodes||o.first!==o.last||o.f&oi||(o=o.first,t&Vn&&t&ni&&null!==o&&(o.f|=ni)),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!==Qo&&Qo.f&Un&&!(t&Hn))){var s,a=Qo;(null!==(s=a.effects)&&void 0!==s?s:a.effects=[]).push(o)}return r}function Ao(){return null!==Qo&&!Jo}function Mo(t){const e=No($n,null,!1);return qi(e,Yn),e.teardown=t,e}function Fo(t){So();var e=ts.f;if(!!(Qo||!(e&Gn)||e&ei))return Oo(t);var n,i=Fi;(null!==(n=i.e)&&void 0!==n?n:i.e=[]).push(t)}function Oo(t){return No(jn|si,t,!1)}function Po(t){return No(jn,t,!1)}function Co(t,e=0){return No($n|e,t,!0)}function Do(t,e=[],n=[],i=[]){Hr(i,e,n,(e=>{No($n,(()=>t(...e.map(bs))),!0)}))}function Ro(t,e=0){return No(Vn|e,t,!0)}function Bo(t){return No(Gn|oi,t,!0)}function Lo(t){var e=t.teardown;if(null!==e){const t=Xo,n=Qo;Yo(!0),Zo(null);try{e.call(null)}finally{Yo(t),Zo(n)}}}function zo(t,e=!1){var n=t.first;for(t.first=t.last=null;null!==n;){const t=n.ac;null!==t&&Eo((()=>{t.abort(mi)}));var i=n.next;n.f&Hn?n.parent=null:Wo(n,e),n=i}}function Wo(t,e=!0){var n=!1;(e||t.f&ri)&&null!==t.nodes&&null!==t.nodes.end&&(!function(t,e){for(;null!==t;){var n=t===e?null:xo(t);t.remove(),t=n}}(t.nodes.start,t.nodes.end),n=!0),zo(t,e&&!n),gs(t,0),qi(t,ti);var i=t.nodes&&t.nodes.t;if(null!==i)for(const t of i)t.stop();Lo(t);var r=t.parent;null!==r&&null!==r.first&&Uo(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=null}function Uo(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 jo(t,e,n=!0){var i=[];$o(t,i,!0);var r=()=>{n&&Wo(t),e&&e()},o=i.length;if(o>0){var s=()=>--o||r();for(var a of i)a.out(s)}else r()}function $o(t,e,n){if(!(t.f&Zn)){t.f^=Zn;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;$o(r,e,!!(!!(r.f&ni)||!!(r.f&Gn)&&!!(t.f&Vn))&&n),r=o}}}function qo(t){Vo(t,!0)}function Vo(t,e){if(t.f&Zn){t.f^=Zn,t.f&Yn||(qi(t,Qn),kr(t));for(var n=t.first;null!==n;){var i=n.next;Vo(n,!!(!!(n.f&ni)||!!(n.f&Gn))&&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 Go(t,e){if(t.nodes)for(var n=t.nodes.start,i=t.nodes.end;null!==n;){var r=n===i?null:xo(n);e.append(n),n=r}}let Ho=!1;function Ko(t){Ho=t}let Xo=!1;function Yo(t){Xo=t}let Qo=null,Jo=!1;function Zo(t){Qo=t}let ts=null;function es(t){ts=t}let ns=null;function is(t){null!==Qo&&(null===ns?ns=[t]:ns.push(t))}let rs=null,os=0,ss=null;let as=1,ls=0,cs=ls;function us(t){cs=t}function ds(){return++as}function hs(t){var e=t.f;if(e&Qn)return!0;if(e&Un&&(t.f&=~li),e&Jn){for(var n=t.deps,i=n.length,r=0;r<i;r++){var o=n[r];if(hs(o)&&eo(o),o.wv>t.wv)return!0}e&Xn&&null===Yi&&qi(t,Yn)}return!1}function fs(t,e,n=!0){var i,r=t.reactions;if(null!==r&&(null===(i=ns)||void 0===i||!i.includes(t)))for(var o=0;o<r.length;o++){var s=r[o];s.f&Un?fs(s,e,!1):e===s&&(n?qi(s,Qn):s.f&Yn&&qi(s,Jn),kr(s))}}function ps(t){var e=rs,n=os,i=ss,r=Qo,o=ns,s=Fi,a=Jo,l=cs,c=t.f;rs=null,os=0,ss=null,Qo=c&(Gn|Hn)?null:t,ns=null,Oi(t.ctx),Jo=!1,cs=++ls,null!==t.ac&&(Eo((()=>{t.ac.abort(mi)})),t.ac=null);try{t.f|=ci;var u=(0,t.fn)(),d=t.deps;if(null!==rs){var h;if(gs(t,os),null!==d&&os>0)for(d.length=os+rs.length,h=0;h<rs.length;h++)d[os+h]=rs[h];else t.deps=d=rs;if(Ao()&&t.f&Xn)for(h=os;h<d.length;h++){var f,p;(null!==(p=(f=d[h]).reactions)&&void 0!==p?p:f.reactions=[]).push(t)}}else null!==d&&os<d.length&&(gs(t,os),d.length=os);if(!(null===ss||Jo||null===d||t.f&(Un|Jn|Qn)))for(h=0;h<ss.length;h++)fs(ss[h],t);return null!==r&&r!==t&&(ls++,null!==ss&&(null===i?i=ss:i.push(...ss))),t.f&di&&(t.f^=di),u}catch(t){return Ui(t)}finally{t.f^=ci,rs=e,os=n,ss=i,Qo=r,ns=o,Oi(s),Jo=a,cs=l}}function ms(t,e){let n=e.reactions;if(null!==n){var i=Fn.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&Un&&(null===rs||!rs.includes(e))){var o=e;o.f&Xn&&(o.f^=Xn,o.f&=~li),Vi(o),Zr(o),gs(o,0)}}function gs(t,e){var n=t.deps;if(null!==n)for(var i=e;i<n.length;i++)ms(t,n[i])}function vs(t){var e=t.f;if(!(e&ti)){qi(t,Yn);var n=ts,i=Ho;ts=t,Ho=!0;try{e&(Vn|qn)?function(t){for(var e=t.first;null!==e;){var n=e.next;e.f&Gn||Wo(e),e=n}}(t):zo(t),Lo(t);var r=ps(t);t.teardown="function"==typeof r?r:null,t.wv=as,An&&Mi&&t.f&Qn&&t.deps}finally{Ho=i,ts=n}}}async function ys(){await Promise.resolve(),function(){var t=tr;tr=!0;try{for(;;){var e;if(Wi(),0===Qi.length&&(null===(e=Xi)||void 0===e||e.flush(),0===Qi.length))return void(Ji=null);pr()}}finally{tr=t}}()}function bs(t){var e,n,i=!!(t.f&Un);if(null!==Qo&&!Jo&&!(null!==ts&&!!(ts.f&ti)||null!==(n=ns)&&void 0!==n&&n.includes(t))){var r=Qo.deps;if(Qo.f&ci)t.rv<ls&&(t.rv=ls,null===rs&&null!==r&&r[os]===t?os++:null===rs?rs=[t]:rs.includes(t)||rs.push(t));else{var o,s;(null!==(s=(o=Qo).deps)&&void 0!==s?s:o.deps=[]).push(t);var a=t.reactions;null===a?t.reactions=[Qo]:a.includes(Qo)||a.push(Qo)}}if(Xo&&io.has(t))return io.get(t);if(i){var l=t;if(Xo){var c=l.v;return(l.f&Yn||null===l.reactions)&&!xs(l)||(c=to(l)),io.set(l,c),c}var u=!(l.f&Xn)&&!Jo&&null!==Qo&&(Ho||!!(Qo.f&Xn)),d=null===l.deps;hs(l)&&(u&&(l.f|=Xn),eo(l)),u&&!d&&ks(l)}if(null!==(e=Yi)&&void 0!==e&&e.has(t))return Yi.get(t);if(t.f&di)throw t.v;return t.v}function ks(t){if(null!==t.deps){t.f|=Xn;for(const n of t.deps){var e;(null!==(e=n.reactions)&&void 0!==e?e:n.reactions=[]).push(t),n.f&Un&&!(n.f&Xn)&&ks(n)}}}function xs(t){if(t.v===Sn)return!0;if(null===t.deps)return!1;for(const e of t.deps){if(io.has(e))return!0;if(e.f&Un&&xs(e))return!0}return!1}function ws(t){var e=Jo;try{return Jo=!0,t()}finally{Jo=e}}const _s=new Set,Ts=new Set;function Is(t,e,n,i,r){var o={capture:i,passive:r},s=function(t,e,n,i={}){function r(t){if(i.capture||Ns.call(e,t),!t.cancelBubble)return Eo((()=>null==n?void 0:n.call(this,t)))}return t.startsWith("pointer")||t.startsWith("touch")||"wheel"===t?zi((()=>{e.addEventListener(t,r,i)})):e.addEventListener(t,r,i),r}(t,e,n,o);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&Mo((()=>{e.removeEventListener(t,s,o)}))}function Es(t){for(var e=0;e<t.length;e++)_s.add(t[e]);for(var n of Ts)n(t)}let Ss=null;function Ns(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;Ss=t;var a=0,l=Ss===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){Pn(t,"currentTarget",{configurable:!0,get:()=>s||i});var d=Qo,h=ts;Zo(null),es(null);try{for(var f,p=[];null!==s;){var m=s.assignedSlot||s.parentNode||s.host||null;try{var g=s["__"+r];null==g||s.disabled&&t.target!==s||g.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,Zo(d),es(h)}}}function As(t,e){var n=ts;null===n.nodes&&(n.nodes={start:t,end:e,a:null,t:null})}function Ms(t,e){var n,i=!!(1&e),r=!!(2&e),o=!t.startsWith("<!>");return()=>{if(xi)return As(ki,null),ki;var e,s;void 0===n&&(e=o?t:"<!>"+t,(s=document.createElement("template")).innerHTML=e.replaceAll("<!>","\x3c!----\x3e"),n=s.content,i||(n=ko(n)));var a=r||mo?document.importNode(n,!0):n.cloneNode(!0);i?As(ko(a),a.lastChild):As(a,a);return a}}function Fs(){if(xi)return As(ki,null),ki;var t=document.createDocumentFragment(),e=document.createComment(""),n=bo();return t.append(e,n),As(e,n),t}function Os(t,e){if(xi){var n=ts;return n.f&ei&&null!==n.nodes.end||(n.nodes.end=ki),void Ti()}null!==t&&t.before(e)}const Ps=["touchstart","touchmove"];function Cs(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 Ds(t,e){return Ls(t,e)}function Rs(t,e){var n;yo(),e.intro=null!==(n=e.intro)&&void 0!==n&&n;const i=e.target,r=xi,o=ki;try{for(var s=ko(i);s&&(s.nodeType!==vi||s.data!==_n);)s=xo(s);if(!s)throw En;wi(!0),_i(s);const n=Ls(t,{...e,anchor:s});return wi(!1),n}catch(n){if(n instanceof Error&&n.message.split("\n").some((t=>t.startsWith("https://svelte.dev/e/"))))throw n;return n!==En&&console.warn("Failed to hydrate: ",n),!1===e.recover&&function(){throw new Error("https://svelte.dev/e/hydration_failed")}(),yo(),Io(i),wi(!1),Ds(t,e)}finally{wi(r),_i(o)}}const Bs=new Map;function Ls(t,{target:e,anchor:n,props:i={},events:r,context:o,intro:s=!0}){yo();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,Ps.includes(s));e.addEventListener(i,Ns,{passive:r});var o=Bs.get(i);void 0===o?(document.addEventListener(i,Ns,{passive:r}),Bs.set(i,1)):Bs.set(i,o+1)}}var s};l(On(_s)),Ts.add(l);var c=void 0,u=function(t){cr.ensure();const e=No(Hn|oi,t,!0);return(t={})=>new Promise((n=>{t.outro?jo(e,(()=>{Wo(e),n(void 0)})):(Wo(e),n(void 0))}))}((()=>{var s=null!=n?n:e.appendChild(bo());return function(t,e,n){new Wr(t,e,n)}(s,{pending:()=>{}},(e=>{o&&(Ci({}),Fi.c=o);if(r&&(i.$$events=r),xi&&As(e,null),c=t(e,i)||{},xi&&(ts.nodes.end=ki,null===ki||ki.nodeType!==vi||ki.data!==In))throw bi(),En;o&&Di()})),()=>{for(var t of a){e.removeEventListener(t,Ns);var i=Bs.get(t);0==--i?(document.removeEventListener(t,Ns),Bs.delete(t)):Bs.set(t,i)}var r;(Ts.delete(l),s!==n)&&(null===(r=s.parentNode)||void 0===r||r.removeChild(s))}}));return zs.set(c,u),c}let zs=new WeakMap;class Ws{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=Xi;if(this.#t.has(t)){var e=this.#t.get(t),n=this.#e.get(e);if(n)qo(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&&(Wo(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();Go(i,e),e.append(bo()),this.#n.set(t,{effect:i,fragment:e})}else Wo(i);this.#i.delete(t),this.#e.delete(t)};this.#r||!n?(this.#i.add(t),jo(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)||(Wo(n.effect),this.#n.delete(t))};ensure(t,e){var n=Xi;!e||this.#e.has(t)||this.#n.has(t)||this.#e.set(t,Bo((()=>e(this.anchor)))),this.#t.set(n,t),xi&&(this.anchor=ki),this.#o()}}function Us(t,e,n=!1){xi&&Ti();var i=new Ws(t);function r(e,n){if(xi){if(e===(Si(t)===Tn)){var r=Ei();return _i(r),i.anchor=r,wi(!1),i.ensure(e,n),void wi(!0)}}i.ensure(e,n)}Ro((()=>{var t=!1;e(((e,n=!0)=>{t=!0,r(n,e)})),t||r(!1,null)}),n?ni:0)}function js(t,e){return e}function $s(t,e=!0){for(var n=0;n<t.length;n++)Wo(t[n],e)}var qs;function Vs(t,e,n,i,r,o=null){var s=t,a=new Map;if(!!(e&gn)){var l=t;s=xi?_i(ko(l)):l.appendChild(bo())}xi&&Ti();var c,u=null,d=Jr((()=>{var t=n();return Mn(t)?t:null==t?[]:On(t)})),h=!0;function f(){m.fallback=u,function(t,e,n,i,r){var o,s,a,l,c,u=!!(i&vn),d=e.length,h=t.items,f=t.effect.first,p=null,m=[],g=[];if(u)for(c=0;c<d;c+=1){var v,y;if(a=r(e[c],c),!((l=h.get(a).e).f&ai))null===(v=l.nodes)||void 0===v||null===(v=v.a)||void 0===v||v.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&ai){if(l.f^=ai,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),Ks(t,p,l),Ks(t,l,b),Hs(l,b,n),m=[],g=[],f=(p=l).next;continue}Hs(l,null,n)}var k,x;if(l.f&Zn)if(qo(l),u)null===(k=l.nodes)||void 0===k||null===(k=k.a)||void 0===k||k.unfix(),(null!==(x=s)&&void 0!==x?x:s=new Set).delete(l);if(l!==f){if(void 0!==o&&o.has(l)){if(m.length<g.length){var w,_=g[0];p=_.prev;var T=m[0],I=m[m.length-1];for(w=0;w<m.length;w+=1)Hs(m[w],_,n);for(w=0;w<g.length;w+=1)o.delete(g[w]);Ks(t,T.prev,I.next),Ks(t,p,T),Ks(t,I,_),f=_,p=I,c-=1,m=[],g=[]}else o.delete(l),Hs(l,f,n),Ks(t,l.prev,l.next),Ks(t,l,null===p?t.effect.first:p.next),Ks(t,p,l),p=l;continue}for(m=[],g=[];null!==f&&f!==l;){var E;(null!==(E=o)&&void 0!==E?E:o=new Set).add(f),g.push(f),f=f.next}if(null===f)continue}l.f&ai||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)$s(On(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 N=[];if(void 0!==o)for(l of o)l.f&Zn||N.push(l);for(;null!==f;)f.f&Zn||f===t.fallback||N.push(f),f=f.next;var A=N.length;if(A>0){var M=i&gn&&0===d?n:null;if(u){for(c=0;c<A;c+=1){var F;null===(F=N[c].nodes)||void 0===F||null===(F=F.a)||void 0===F||F.measure()}for(c=0;c<A;c+=1){var O;null===(O=N[c].nodes)||void 0===O||null===(O=O.a)||void 0===O||O.fix()}}!function(t,e,n){for(var i,r=e.length,o=e.length,s=0;s<r;s++){let n=e[s];jo(n,(()=>{if(i){if(i.pending.delete(n),i.done.add(n),0===i.pending.size){var e=t.outrogroups;$s(On(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;Io(c),c.append(l),t.items.clear()}$s(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,N,M)}}u&&zi((()=>{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&ai?(u.f^=ai,Hs(u,null,s)):qo(u):jo(u,(()=>{u=null})))}var p=Ro((()=>{var t=(c=bs(d)).length;let l=!1;xi&&(Si(s)===Tn!==(0===t)&&(_i(s=Ei()),wi(!1),l=!0));for(var p=new Set,m=0;m<t;m+=1){xi&&ki.nodeType===vi&&ki.data===In&&(s=ki,l=!0,wi(!1));var g,v=c[m],y=i(v,m),b=h?null:a.get(y);if(b)b.v&&co(b.v,v),b.i&&co(b.i,m);else b=Gs(a,h?s:null!==(g=qs)&&void 0!==g?g:qs=bo(),v,y,m,r,e,n),h||(b.e.f|=ai),a.set(y,b);p.add(y)}0===t&&o&&!u&&(h?u=Bo((()=>o(s))):(u=Bo((()=>{var t;return o(null!==(t=qs)&&void 0!==t?t:qs=bo())}))).f|=ai),xi&&t>0&&_i(Ei()),h||f(),l&&wi(!0),bs(d)})),m={effect:p,items:a,outrogroups:null,fallback:u};h=!1,xi&&(s=ki)}function Gs(t,e,n,i,r,o,s,a){var l=s&pn?s&yn?oo(n):ao(n,!1,!1):null,c=s&mn?oo(r):null;return{v:l,i:c,e:Bo((()=>(o(e,null!=l?l:n,null!=c?c:r,a),()=>{t.delete(i)})))}}function Hs(t,e,n){if(t.nodes)for(var i=t.nodes.start,r=t.nodes.end,o=!e||e.f&ai?n:e.nodes.start;null!==i;){var s=xo(i);if(o.before(i),i===r)return;i=s}}function Ks(t,e,n){null===e?t.effect.first=n:e.next=n,null===n?t.effect.last=e:n.prev=e}const Xs=[..." \t\n\r\f \v\ufeff"];function Ys(t,e,n,i,r,o){var s=t.__className;if(xi||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&&!Xs.includes(i[s-1])||a!==i.length&&!Xs.includes(i[a])?s=a:i=(0===s?"":i.substring(0,s))+i.substring(a+1)}return""===i?null:i}(n,i,o);xi&&a===t.getAttribute("class")||(null==a?t.removeAttribute("class"):t.className=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 Qs(t,e,n,i){var r=t.__style;if(xi||r!==e){var o=function(t){return null==t?null:String(t)}(e);xi&&o===t.getAttribute("style")||(null==o?t.removeAttribute("style"):t.style.cssText=o),t.__style=e}return i}const Js=Symbol("is custom element"),Zs=Symbol("is html");function ta(t,e,n,i){var r=function(t){var e;return null!==(e=t.__attributes)&&void 0!==e?e:t.__attributes={[Js]:t.nodeName.includes("-"),[Zs]:t.namespaceURI===Nn}}(t);xi&&(r[e]=t.getAttribute(e),"src"===e||"srcset"===e||"href"===e&&"LINK"===t.nodeName)||r[e]!==(r[e]=n)&&("loading"===e&&(t[pi]=n),null==n?t.removeAttribute(e):"string"!=typeof n&&function(t){var e,n=t.getAttribute("is")||t.nodeName,i=ea.get(n);if(i)return i;ea.set(n,i=[]);var r=t,o=Element.prototype;for(;o!==r;){for(var s in e=Dn(r))e[s].set&&i.push(s);r=Ln(r)}return i}(t).includes(e)?t[e]=n:t.setAttribute(e,n))}var ea=new Map;var na=new WeakMap,ia=new WeakMap,ra=new WeakMap,oa=new WeakSet;class sa{constructor(t){j(this,oa),W(this,na,new WeakMap),W(this,ia,void 0),W(this,ra,void 0),U(ra,this,t)}observe(t,e){var n=z(na,this).get(t)||new Set;return n.add(e),z(na,this).set(t,n),B(oa,this,aa).call(this).observe(t,z(ra,this)),()=>{var n=z(na,this).get(t);n.delete(e),0===n.size&&(z(na,this).delete(t),z(ia,this).unobserve(t))}}}function aa(){var t;return null!==(t=z(ia,this))&&void 0!==t?t:U(ia,this,new ResizeObserver((t=>{for(var e of t)for(var n of(fe.entries.set(e.target,e),z(na,this).get(e.target)||[]))n(e)})))}fe=sa,$(sa,"entries",new WeakMap);var la=new sa({box:"content-box"}),ca=new sa({box:"border-box"});function ua(t,e,n){Mo(la.observe(t,(t=>n(t[e]))))}function da(t,e,n){var i=ca.observe(t,(()=>n(t[e])));Po((()=>(ws((()=>n(t[e]))),i)))}function ha(t,e){return t===e||(null==t?void 0:t[hi])===e}function fa(t={},e,n,i){return Po((()=>{var i,r;return Co((()=>{i=r,r=[],ws((()=>{t!==n(...r)&&(e(t,...r),i&&ha(n(...i),t)&&e(null,...i))}))})),()=>{zi((()=>{r&&ha(n(...r),t)&&e(null,...r)}))}})),t}let pa=!1;function ma(t,e,n,i){var r,o,s=!!(n&xn),a=!!(n&wn),l=i,c=!0,u=()=>(c&&(c=!1,l=a?ws(i):i),l);if(s){var d,h,f=hi in t||fi in t;r=null!==(d=null===(h=Cn(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=pa;try{return pa=!1,[t(),pa]}finally{pa=e}}((()=>t[e])):o=t[e],void 0===o&&void 0!==i&&(o=u(),r&&(!function(){throw new Error("https://svelte.dev/e/props_invalid_value")}(),r(o))),p=()=>{var n=t[e];return void 0===n?u():(c=!0,n)},!(n&kn))return p;if(r){var g=t.$$legacy;return function(t,e){return arguments.length>0?((!e||g||m)&&r(e?p():t),t):p()}}var v=!1,y=(n&bn?Xr:Jr)((()=>(v=!1,p())));s&&bs(y);var b=ts;return function(t,e){if(arguments.length>0){const n=e?bs(y):s?fo(t):t;return lo(y,n),v=!0,void 0!==l&&(l=n),t}return Xo&&v||b.f&ti?y.v:bs(y)}}var ga,va,ya,ba;"undefined"!=typeof window&&(null!==(va=(ga=null!==(ba=(ya=window).__svelte)&&void 0!==ba?ba:ya.__svelte={}).v)&&void 0!==va?va:ga.v=new Set).add("5");function ka(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}class xa{constructor({position:t,galleryState:e,config:n}){this.config=n,this.position=t,this.galleryState=e,this.name=n.name;const{variantId:i,itemIndex:r,moduleIndex:o}=t;this.id=`${n.itemType}_${i}_${r}_${o}`,ka(this)}#a=so(fo({}));#l=so(null);#c=so(null);id;player;position;config;timeline;moduleEndListener;hasDuration=!1;coverAssets=[];get state(){return bs(this.#a)}set state(t){lo(this.#a,t,!0)}get cover(){return bs(this.#l)}set cover(t){lo(this.#l,t)}get Component(){return bs(this.#c)}set Component(t){lo(this.#c,t)}emitModuleEnd(){var t;null===(t=this.moduleEndListener)||void 0===t||t.call(this)}start(t){this.player=t}setPosition(){this.galleryState.playingModulePosition=this.position}play(){this.timeline.getNodesAtTime(0)[0].once("nodestart",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}}function wa(t,e,n){return n.addNode({id:t,manifestRef:{type:"assets-delivery-service",assetId:e.entity.entityId,assetRevision:e.entity.entityRevision,availableEncodeProfiles:e.availableEncodeProfiles}})}var _a=Ms('<h3 class="svelte-17x2i38"> </h3>'),Ta=Ms('<p class="svelte-17x2i38"> </p>'),Ia=Ms('<span class="svelte-17x2i38"> </span>'),Ea=Ms('<div><button class="svelte-17x2i38"><!> <!> <!></button></div>'),Sa=Ms('<div class="textBoxDescriptionBox svelte-17x2i38" aria-roledescription="Feature description box"><!></div>');function Na(t,e){const n=Qr((()=>e.state.textBox));!function(t,e){Ci(e,!0);let n=ma(e,"textBox",3,null),i=ma(e,"isMobile",3,!1),r=so(!1),o=so(0),s=so(null),a=so(null),l=so(null),c=Qr((()=>{var t;return(null===(t=bs(l))||void 0===t?void 0:t.blockSize)||20})),u=Qr((()=>{var t,e,n,i;return(null===(t=bs(a))||void 0===t?void 0:t.inlineSize)-bs(c)>(null===(e=bs(s))||void 0===e?void 0:e.clientWidth)||(null===(n=bs(s))||void 0===n?void 0:n.scrollHeight)>(null===(i=bs(s))||void 0===i?void 0:i.clientHeight)}));function d(){lo(r,!bs(r))}var h=Fs(),f=_o(h),p=t=>{var e=Sa(),c=wo(e),h=t=>{var e=Ea(),c=wo(e);c.__click=d;var h=wo(c),f=t=>{var e=_a(),i=wo(e,!0);Ii(e),Do((()=>Cs(i,n().title))),Os(t,e)};Us(h,(t=>{var e;i()&&null!==(e=n())&&void 0!==e&&e.title&&t(f)}));var p=To(h,2),m=t=>{var e=Ta(),i=wo(e,!0);Ii(e),fa(e,(t=>lo(s,t)),(()=>bs(s))),Do((()=>Cs(i,n().description))),ua(e,"contentBoxSize",(t=>lo(a,t))),Os(t,e)};Us(p,(t=>{(!i()||i()&&bs(r))&&t(m)}));var g=To(p,2),v=t=>{var e=Ia(),n=wo(e);Ii(e),Do((()=>Cs(n,"Read "+(bs(r)?"less":"more")))),ua(e,"contentBoxSize",(t=>lo(l,t))),Os(t,e)};Us(g,(t=>{(i()||!i()&&(bs(u)||bs(r)))&&t(v)})),Ii(c),Ii(e),Do((()=>{var t;Ys(e,0,"step-description "+(bs(r)?"expanded":""),"svelte-17x2i38"),Qs(e,`height: ${null!==(t=bs(o))&&void 0!==t?t:""}px`)})),da(c,"clientHeight",(t=>lo(o,t))),Os(t,e)};Us(c,(t=>{var e;null!==(e=n())&&void 0!==e&&e.description&&t(h)})),Ii(e),Do((()=>Qs(e,`padding: ${i()?"8px 16px":"16px 16px 56px 16px"};`))),Os(t,e)};Us(f,(t=>{var e,i;(null!==(e=n())&&void 0!==e&&e.title||null!==(i=n())&&void 0!==i&&i.description)&&t(p)})),Os(t,h),Di()}(t,{get textBox(){return bs(n)},get isMobile(){return e.isMobile}})}Es(["click"]);var Aa=Ms('<div class="toggle-option-container svelte-16pmvvn"><button> </button></div>'),Ma=Ms('<div class="toggle-container svelte-16pmvvn"><div></div></div>');function Fa(t,e){const n=Qr((()=>e.state.options)),i=Qr((()=>e.state.currentOptionIndex)),r=Qr((()=>e.state.onOptionClicked));var o=Ma(),s=wo(o);Vs(s,21,(()=>bs(n)),js,((t,e,n)=>{var o=Aa();Qs(o,`--button-index: ${n};`);var s=wo(o);let a;s.__click=()=>bs(r)(n);var l=wo(s,!0);Ii(s),Ii(o),Do((()=>{a=Ys(s,0,"toggle-option-button svelte-16pmvvn",null,a,{selected:bs(i)===n}),Cs(l,bs(e).label)})),Os(t,o)})),Ii(s),Ii(o),Do((()=>{var t;return Ys(s,0,`toggle-options selected-${null!==(t=bs(i))&&void 0!==t?t:""}`,"svelte-16pmvvn")})),Os(t,o)}Es(["click"]);var Oa=new WeakSet;function Pa(t){var e,n;t!==this.state.currentOptionIndex&&(this.state.currentOptionIndex=t,this.cover=this.coverAssets[t],this.synced?this.switchTo(t):(this.timeline=null===(e=this.timelines)||void 0===e?void 0:e[t],null===(n=this.player)||void 0===n||n.switchTimeline(this.timeline)))}const Ca=(t,e,n)=>n>e?e:n<t?t:n;function Da(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let Ra=()=>{},Ba=()=>{};function La(t){let e;return()=>(void 0===e&&(e=t()),e)}"undefined"!=typeof process&&"production"!==(null===(pe=process.env)||void 0===pe?void 0:pe.NODE_ENV)&&(Ra=(t,e,n)=>{t||"undefined"==typeof console||console.warn(Da(e,n))},Ba=(t,e,n)=>{if(!t)throw new Error(Da(e,n))});const za=t=>t,Wa=t=>1e3*t,Ua=t=>t/1e3;const ja=t=>Array.isArray(t)&&"number"==typeof t[0],$a=(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)})`},qa=2e4;function Va(t){let e=0;let n=t.next(e);for(;!n.done&&e<qa;)e+=50,n=t.next(e);return e>=qa?1/0:e}const Ga=5;const Ha={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},Ka=.001;function Xa({duration:t=Ha.duration,bounce:e=Ha.bounce,velocity:n=Ha.velocity,mass:i=Ha.mass}){let r,o;Ra(t<=Wa(Ha.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let s=1-e;s=Ca(Ha.minDamping,Ha.maxDamping,s),t=Ca(Ha.minDuration,Ha.maxDuration,Ua(t)),s<1?(r=e=>{const i=e*s,r=i*t,o=i-n,a=Qa(e,s),l=Math.exp(-r);return Ka-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=Qa(Math.pow(e,2),s);return(-r(e)+Ka>0?-1:1)*((o-a)*l)/c}):(r=e=>Math.exp(-e*t)*((e-n)*t+1)-Ka,o=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let i=n;for(let n=1;n<Ya;n++)i-=t(i)/e(i);return i}(r,o,5/t);if(t=Wa(t),isNaN(a))return{stiffness:Ha.stiffness,damping:Ha.damping,duration:t};{const e=Math.pow(a,2)*i;return{stiffness:e,damping:2*s*Math.sqrt(i*e),duration:t}}}const Ya=12;function Qa(t,e){return t*Math.sqrt(1-e*e)}const Ja=["duration","bounce"],Za=["stiffness","damping","mass"];function tl(t,e){return e.some((e=>void 0!==t[e]))}function el(t=Ha.visualDuration,e=Ha.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:Ha.velocity,stiffness:Ha.stiffness,damping:Ha.damping,mass:Ha.mass,isResolvedFromDuration:!1,...t};if(!tl(t,Za)&&tl(t,Ja))if(t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(1.2*n),r=i*i,o=2*Ca(.05,1,1-(t.bounce||0))*Math.sqrt(r);e={...e,mass:Ha.mass,stiffness:r,damping:o}}else{const n=Xa(t);e={...e,...n,mass:Ha.mass},e.isResolvedFromDuration=!0}return e}({...n,velocity:-Ua(n.velocity||0)}),p=h||0,m=c/(2*Math.sqrt(l*u)),g=s-o,v=Ua(Math.sqrt(l/u)),y=Math.abs(g)<5;let b;if(i||(i=y?Ha.restSpeed.granular:Ha.restSpeed.default),r||(r=y?Ha.restDelta.granular:Ha.restDelta.default),m<1){const t=Qa(v,m);b=e=>{const n=Math.exp(-m*v*e);return s-n*((p+m*v*g)/t*Math.sin(t*e)+g*Math.cos(t*e))}}else if(1===m)b=t=>s-Math.exp(-v*t)*(g+(p+v*g)*t);else{const t=v*Math.sqrt(m*m-1);b=e=>{const n=Math.exp(-m*v*e),i=Math.min(t*e,300);return s-n*((p+m*v*g)*Math.sinh(i)+t*g*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?Wa(p):function(t,e,n){const i=Math.max(e-Ga,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(Va(k),qa),e=$a((e=>k.next(t*e).value),t,30);return t+"ms "+e},toTransition:()=>{}};return k}el.applyToOptions=t=>{const e=function(t,e=100,n){const i=n({...t,keyframes:[0,e]}),r=Math.min(Va(i),qa);return{type:"keyframes",ease:t=>i.next(r*t).value/e,duration:Ua(r)}}(t,100,el);return t.ease=e.ease,t.duration=Wa(e.duration),t.type="keyframes",t};const nl=t=>null!==t;class il{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 rl(t){for(let n=1;n<t.length;n++){var e;null!==(e=t[n])&&void 0!==e||(t[n]=t[n-1])}}const ol=t=>t.startsWith("--");const sl=La((()=>void 0!==window.ScrollTimeline)),al={};function ll(t,e){const n=La(t);return()=>{var t;return null!==(t=al[e])&&void 0!==t?t:n()}}const cl=ll((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing"),ul=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,dl={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ul([0,.65,.55,1]),circOut:ul([.55,0,1,.45]),backIn:ul([.31,.01,.66,-.59]),backOut:ul([.33,1.53,.69,.99])};function hl(t,e){return t?"function"==typeof t?cl()?$a(t,e):"ease-out":ja(t)?ul(t):Array.isArray(t)?t.map((t=>hl(t,e)||dl.easeOut)):dl[t]:void 0}function fl(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=hl(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 pl extends il{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,Ba("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)&&cl()?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=fl(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(nl),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){ol(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 Ua(Number(n))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Ua(t)}get time(){return Ua(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Wa(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&&sl()?(this.animation.timeline=t,za):e(this)}}class ml{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 gl(this.animations,"duration")}get iterationDuration(){return gl(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 gl(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 vl extends ml{then(t,e){return this.finished.finally(t).then((()=>{}))}}const yl=new WeakMap,bl=(t,e="")=>`${t}:${e}`;function kl(t){const e=yl.get(t)||new Map;return yl.set(t,e),e}function xl(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 wl=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 _l(t,e){for(let n=0;n<t.length;n++)"number"==typeof t[n]&&wl.has(e)&&(t[n]=t[n]+"px")}function Tl(t,e){const n=window.getComputedStyle(t);return ol(e)?n.getPropertyValue(e):n[e]}function Il(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;Ba(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={...xl(a,t)};r.duration&&(r.duration=Wa(r.duration)),r.delay&&(r.delay=Wa(r.delay));const o=kl(i),l=bl(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]=Tl(i,r)),rl(e),_l(e,r),!o&&e.length<2&&e.unshift(Tl(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 pl(i);e.set(n,r),r.finished.finally((()=>e.delete(n))),a.push(r)}return a}const El=(()=>function(t,e,n){return new vl(Il(t,e,n))})();var Sl=Ms('<button class="svelte-16kucsb"><div class="svelte-16kucsb"> </div></button>'),Nl=Ms('<div class="tryIt-container svelte-16kucsb"><!></div>');function Al(t,e){Ci(e,!0);const n=Qr((()=>e.state.ctaText)),i=Qr((()=>e.state.animationConfig)),r=Qr((()=>e.state.showCta)),o=Qr((()=>e.state.onCtaClick));let s=null,a=null,l=so(!1),c=!1;function u(){c&&El(s,{transform:"scale(1.05)"},{type:el,mass:1.5,stiffness:400,damping:30})}function d(){c&&El(s,{transform:"scale(1)"},{type:el,mass:1.5,stiffness:400,damping:30})}function h(){c&&El(s,{transform:"scale(0.95)"},{type:el,mass:1,stiffness:600,damping:30})}Fo((()=>{const{mass:t,stiffness:e,damping:n,delay:o}=bs(i);let u;return bs(r)&&(u=setTimeout((async()=>{lo(l,!0),u=null,El(s,{transform:["translateY(40px) scale(0, 0.2)","translateY(0) scale(1, 1)"],opacity:1},{type:el,mass:t,stiffness:e,damping:n}),await El(a,{transform:["translateY(20px) scale(0.8)","translateY(0) scale(1)"],opacity:1},{type:el,mass:t,stiffness:e,damping:n,delay:.15}),c=!0}),o)),()=>{u&&clearTimeout(u)}}));var f=Nl(),p=wo(f),m=t=>{var e=Sl();e.__mousedown=h,e.__touchstart=h,e.__click=function(...t){var e;null===(e=bs(o))||void 0===e||e.apply(this,t)};var i=wo(e),r=wo(i,!0);Ii(i),fa(i,(t=>a=t),(()=>a)),Ii(e),fa(e,(t=>s=t),(()=>s)),Do((()=>{Qs(e,"pointer-events: "+(bs(l)?"auto":"none")),Cs(r,bs(n))})),Is("mouseenter",e,u),Is("mouseleave",e,d),Os(t,e)};Us(p,(t=>{bs(r)&&t(m)})),Ii(f),Os(t,f),Di()}Es(["mousedown","touchstart","click"]);var Ml=new WeakSet;function Fl(){this.mainTimeline?this.player.switchTimeline(this.mainTimeline):this.emitModuleEnd(),this.state.showCta=!1}const Ol={videoModule:class extends xa{constructor({config:t,...e}){var n;super({...e,config:t}),this.Component=Na,this.hasDuration=!t.loop,ka(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(wa(`${this.id}_intro`,e.intro,t),"end");const n=wa(this.id,e.video,t);this.timeline.placeOnTimeline(n,"end",{loop:e.loop}),e.loop||n.on("nodeend",this.emitModuleEnd)}},toggleModule:class extends xa{constructor({config:t,...e}){super({...e,config:t}),j(this,Oa),this.Component=Fa,this.synced=t.sync,this.switchTo=()=>{},ka(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:B(Oa,this,Pa).bind(this)}}start(t){super.start(t),this.synced?(this.timeline=t.createTimeline(),this.config.options.forEach(((e,n)=>{this.timeline.placeOnTimeline(wa(`${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(wa(`${this.id}_option_${n}_intro`,e.intro,t),"end"),i.placeOnTimeline(wa(`${this.id}_option_${n}`,e.video,t),"end",{loop:!0}),i})),this.timeline=this.timelines[this.state.currentOptionIndex])}},tryItModule:class extends xa{constructor({config:t,...e}){var n;super({...e,config:t}),j(this,Ml),ka(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:B(Ml,this,Fl).bind(this)}}start(t){super.start(t),this.Component=Al,this.timeline=t.createTimeline();const{introVideo:e,mainVideo:n}=this.config;if(e.intro&&this.timeline.placeOnTimeline(wa(`${this.id}_intro_intro`,e.intro,t)),this.timeline.placeOnTimeline(wa(`${this.id}_intro_loop`,e.loop,t),"end",{loop:!0}),n){this.mainTimeline=t.createTimeline(),n.intro&&this.mainTimeline.placeOnTimeline(wa(`${this.id}_main_intro`,n.intro,t));const e=wa(`${this.id}_main_loop`,n.loop,t);this.mainTimeline.placeOnTimeline(e,"end",{loop:!0})}}play(){this.state.showCta=!0,super.play()}}};class Pl{#u=so({});#d=so("ekonovar");#h=so(0);#f=so(0);#p=so(fo({itemIndex:0,moduleIndex:0}));#m=Qr((()=>{var t;return null===(t=bs(this.#u))||void 0===t?void 0:t[bs(this.#d)]}));#g=Qr((()=>{var t;return null===(t=bs(this.#m))||void 0===t?void 0:t[bs(this.#h)]}));#v=Qr((()=>{var t,e;return bs(this.#y)?null===(e=bs(this.#m))||void 0===e?void 0:e[bs(this.#p).itemIndex].modules[bs(this.#p).moduleIndex]:null===(t=bs(this.#g))||void 0===t?void 0:t.modules[bs(this.#f)]}));#b=Qr((()=>{var t;return(null===(t=bs(this.#m))||void 0===t?void 0:t.flatMap((t=>t.modules)))||[]}));#k=so(!1);#y=so(!1);#x=Qr((()=>!(bs(this.#p).itemIndex===this.activeItemIndex&&bs(this.#p).moduleIndex===this.activeModuleIndex)));set variants(t){lo(this.#u,t)}set activeVariant(t){lo(this.#d,t,!0)}set activeItemIndex(t){lo(this.#h,t,!0)}set activeModuleIndex(t){lo(this.#f,t,!0)}set playingModulePosition(t){lo(this.#p,t,!0)}set paused(t){lo(this.#k,t,!0)}set startedPlaying(t){lo(this.#y,t,!0)}get variants(){return bs(this.#u)}get activeVariant(){return bs(this.#d)}get activeItemIndex(){return bs(this.#h)}get activeModuleIndex(){return bs(this.#f)}get playingModulePosition(){return bs(this.#p)}get currentItemsList(){return bs(this.#m)}get currentItem(){return bs(this.#g)}get currentModule(){return bs(this.#v)}get paused(){return bs(this.#k)}get startedPlaying(){return bs(this.#y)}get seeking(){return bs(this.#x)}get currentModulesList(){return bs(this.#b)}}var Cl="https://assets.eko.com";const Dl=2,Rl=5,Bl=["activeItemIndex","activeModuleIndex","paused","startedPlaying"],Ll=["version","selectItem","selectItemAndStep","next","prev","subscribe"];var zl=new WeakMap,Wl=new WeakMap,Ul=new WeakMap,jl=new WeakSet;class $l{constructor(t){var e;j(this,jl),W(this,zl,void 0),W(this,Wl,void 0),W(this,Ul,void 0),$(this,"public",void 0),$(this,"version","0.0.6"),ka(this),U(Ul,this,t),U(zl,this,new Pl),U(Wl,this,[]);const n=null==t||null===(e=t.instance)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.blocks)||void 0===e||null===(e=e.blocksArr)||void 0===e||null===(e=e.find((t=>"GalleryBlock"===t.blockType)))||void 0===e?void 0:e.config;var i;n?(B(jl,this,ql).call(this,n.items),B(jl,this,Vl).call(this,n.items)):console.warn("[eko-gallery-app] Gallery initiated without an instance, results will be empty"),this.public=(i=this,Ll.reduce(((t,e)=>{if(!(e in i))throw new Error(`[eko-gallery-app] Public API member "${e}" does not exist on GalleryLogic`);const n=i[e];return t[e]="function"==typeof n?n.bind(i):n,t}),{}))}start(t){z(Wl,this).forEach((e=>{e.start(t)})),U(Wl,this,null),B(jl,this,Gl).call(this,t),z(zl,this).currentModule.play()}selectItem(t){const e=z(zl,this);t!==e.activeItemIndex&&(e.activeItemIndex=t,e.activeModuleIndex=0)}selectItemAndStep(t,e){const n=z(zl,this);t===n.activeItemIndex&&e===n.activeModuleIndex||(n.activeItemIndex=t,n.activeModuleIndex=e)}next(){const t=z(zl,this);t.seeking||(t.startedPlaying?B(jl,this,Kl).call(this):t.activeItemIndex=(t.activeItemIndex+1)%t.currentItemsList.length)}prev(){const t=z(zl,this);if(!t.seeking)if(t.startedPlaying){if(t.activeModuleIndex=t.activeModuleIndex-1,!t.currentItem.modules[t.activeModuleIndex]){t.activeItemIndex=(t.activeItemIndex-1+t.currentItemsList.length)%t.currentItemsList.length;const e=t.currentItemsList[t.activeItemIndex];t.activeModuleIndex=e.modules.length-1}}else t.activeItemIndex=(t.activeItemIndex-1+t.currentItemsList.length)%t.currentItemsList.length}subscribe(t){const e=z(zl,this);return function(t){cr.ensure();const e=No(Hn|oi,t,!0);return()=>{Wo(e)}}((()=>{Fo((()=>{const n=Bl.reduce(((t,n)=>(t[n]=e[n],t)),{});t(n)}))}))}getCoverUrl(t,e){var n,i;const r=null==t||null===(n=t.entity)||void 0===n?void 0:n.entityId;if(!r)throw new Error("[getCoverUrl] No assetId found.");let o;var s;return null!==(i=z(Ul,this))&&void 0!==i&&null!==(i=i.coverAssetsMap)&&void 0!==i&&i[r]?(o=new URL(z(Ul,this).coverAssetsMap[r]),/^[a-z0-9]*assets.eko.com$/.test(o.host)&&e&&(o.pathname=o.pathname.replace(".png",".webp"))):(s=t,o=new URL(`${Cl}/image/${s.entity.entityId}/${s.entity.entityRevision}?startOffset=0`),o.pathname+=e?".webp":".png"),e&&o.searchParams.set("width",e),o.href}get currentConfig(){return z(Ul,this)}get state(){return z(zl,this)}}function ql(t){const e={};for(let n of t)for(let t of Object.keys(n.variants||{}))e[t]=[];e.ekonovar=[],z(zl,this).variants=e}function Vl(t){const e=(t=[],e)=>{const n=[];for(let[i,r]of t.entries()){if(!Ol[r.itemType])throw new Error(`Unknown module type ${r.itemType}`);const t=new Ol[r.itemType]({position:{...e,moduleIndex:i},config:r,galleryState:z(zl,this)});t.moduleEndListener=B(jl,this,Hl).bind(this),n.push(t)}return n};for(const[i,r]of t.entries())if("galleryItemV2"===r.itemType){const{modules:t,...o}=r;for(const[s,a]of Object.entries(z(zl,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}),U(Wl,this,[...z(Wl,this),...n.modules]),a.push(n)}}}}function Gl(t){for(const[,e]of Object.entries(z(zl,this).variants))for(const[n,i]of e.entries()){const r=i.modules,o=e.filter((t=>t!==i)).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=>t!==a)).map((t=>t.timeline.getNodesAtTime(0)[0])),u=[{nodeId:l.id,weight:Dl},...c.map((t=>({nodeId:t.id,weight:Rl})))];for(const e of s.timeline.placements){t.getNode(e.nodeId).setChildren(u)}}}}function Hl(){const t=z(zl,this),e=t.currentItem.modules;e.length>1&&t.activeModuleIndex===e.length-1?t.activeModuleIndex=0:B(jl,this,Kl).call(this)}function Kl(){const t=z(zl,this);t.activeModuleIndex=t.activeModuleIndex+1,t.currentItem.modules[t.activeModuleIndex]||(t.activeItemIndex=(t.activeItemIndex+1)%t.currentItemsList.length,t.activeModuleIndex=0)}var Xl=Ms('<button><span class="svelte-er27y2"> </span></button>'),Yl=Ms('<div class="nav-buttons-container svelte-er27y2"><div class="nav-buttons svelte-er27y2"></div></div>');Es(["click"]);const Ql="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 Jl=Ms('<button><img class="svelte-1al44kl"/></button>');function Zl(t,e){const n=ma(e,"hidden",3,!1);var i=Jl();let r;i.__click=function(...t){var n;null===(n=e.onClick)||void 0===n||n.apply(this,t)};var o=wo(i);Ii(i),Do((()=>{var t;r=Ys(i,0,`nav-button ${null!==(t=e.type)&&void 0!==t?t:""}`,"svelte-1al44kl",r,{hidden:n()}),ta(i,"aria-label",e.type),ta(o,"src",Ql),ta(o,"alt",e.type)})),Os(t,i)}Es(["click"]);var tc=Ms('<button><span class="svelte-1mxltt0"> </span></button>'),ec=Ms('<div class="steps-indicator-container svelte-1mxltt0"><button aria-label="Scroll to previous steps"><img alt="Previous steps button" class="svelte-1mxltt0"/></button> <div role="group" aria-roledescription="Sequence navigation buttons"></div> <button aria-label="Scroll to next steps"><img alt="Next steps button" class="svelte-1mxltt0"/></button></div>');function nc(t,e){Ci(e,!0);const n=16,i=32,r=Pi("state");let o=so(null),s=so(null),a=so(!1),l=so(!1);const c=Qr((()=>{let t=[];return t=r().currentItem.modules.map(((t,e)=>({index:e,type:e===r().activeModuleIndex?"active":"",name:t.name}))),t}));function u(){bs(o)&&(lo(a,bs(o).scrollLeft>3),lo(l,bs(o).scrollLeft+bs(o).clientWidth<bs(o).scrollWidth-3))}function d(t){bs(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(bs(o).querySelectorAll(".step-button")).find((t=>{const e=t.getBoundingClientRect(),n=bs(o).getBoundingClientRect();return e.left>n.left+i}));if(t){const e=t.previousElementSibling;e&&h(bs(o),e)}}function p(){const t=Array.from(bs(o).querySelectorAll(".step-button")).reverse().find((t=>{const e=t.getBoundingClientRect(),n=bs(o).getBoundingClientRect();return e.right<n.right-i}));if(t){const e=t.nextElementSibling;e&&h(bs(o),e)}}Fo((()=>{if(bs(o)){u();const t=new MutationObserver((()=>{const t=bs(o).querySelector(".step-button.active");t&&lo(s,t,!0)}));return t.observe(bs(o),{attributes:!0,attributeFilter:["class"],subtree:!0}),()=>{t.disconnect()}}})),Fo((()=>{bs(s)&&bs(o)&&h(bs(o),bs(s))}));var m=Fs();Is("resize",po,u),function(t,e,n){xi&&Ti();var i=new Ws(t);Ro((()=>{var t=e();i.ensure(t,n)}))}(_o(m),(()=>r().activeItemIndex),(t=>{var e=ec(),n=wo(e);let i;n.__click=f;var s=wo(n);Ii(n);var d=To(n,2);let m;Vs(d,21,(()=>bs(c)),js,((t,e)=>{var n=tc();let i;n.__click=t=>{return n=t.currentTarget,i=bs(e).index,r().activeModuleIndex=i,void h(bs(o),n);var n,i};var s=wo(n),a=wo(s,!0);Ii(s),Ii(n),Do((()=>{i=Ys(n,0,"step-button svelte-1mxltt0",null,i,{active:"active"===bs(e).type}),ta(n,"aria-label",`Go to step $${bs(e).index+1}`),Cs(a,bs(e).name)})),Os(t,n)})),Ii(d),fa(d,(t=>lo(o,t)),(()=>bs(o)));var g=To(d,2);let v;g.__click=p;var y=wo(g);Ii(g),Ii(e),Do(((t,e)=>{i=Ys(n,0,"step-arrow step-arrow-prev svelte-1mxltt0",null,i,{visible:bs(a)}),ta(s,"src",Ql),m=Ys(d,0,"steps-indicator svelte-1mxltt0",null,m,t),Qs(d,`--stepDuration: ${null!=e?e:""}s`),v=Ys(g,0,"step-arrow step-arrow-next svelte-1mxltt0",null,v,{visible:bs(l)}),ta(y,"src",Ql)}),[()=>({"with-duration":r().currentModule.hasDuration,paused:r().paused}),()=>r().currentModule.duration]),Is("scroll",d,u),Os(t,e)})),Os(t,m),Di()}Es(["click"]);const ic="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",rc="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 oc=Ms('<img alt="Play" class="svelte-a3r6re"/>'),sc=Ms('<img alt="Pause" class="svelte-a3r6re"/>'),ac=Ms('<button class="pause-button svelte-a3r6re"><!></button>');Es(["click"]);var lc,cc,uc="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function dc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var hc=function(){if(cc)return lc;cc=1;var t=NaN,e="[object Symbol]",n=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,r=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt,a="object"==typeof uc&&uc&&uc.Object===Object&&uc,l="object"==typeof self&&self&&self.Object===Object&&self,c=a||l||Function("return this")(),u=Object.prototype.toString,d=Math.max,h=Math.min,f=function(){return c.Date.now()};function p(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function m(a){if("number"==typeof a)return a;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&u.call(t)==e}(a))return t;if(p(a)){var l="function"==typeof a.valueOf?a.valueOf():a;a=p(l)?l+"":l}if("string"!=typeof a)return 0===a?a:+a;a=a.replace(n,"");var c=r.test(a);return c||o.test(a)?s(a.slice(2),c?2:8):i.test(a)?t:+a}return lc=function(t,e,n){var i,r,o,s,a,l,c=0,u=!1,g=!1,v=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function y(e){var n=i,o=r;return i=r=void 0,c=e,s=t.apply(o,n)}function b(t){var n=t-l;return void 0===l||n>=e||n<0||g&&t-c>=o}function k(){var t=f();if(b(t))return x(t);a=setTimeout(k,function(t){var n=e-(t-l);return g?h(n,o-(t-c)):n}(t))}function x(t){return a=void 0,v&&i?y(t):(i=r=void 0,s)}function w(){var t=f(),n=b(t);if(i=arguments,r=this,l=t,n){if(void 0===a)return function(t){return c=t,a=setTimeout(k,e),u?y(t):s}(l);if(g)return a=setTimeout(k,e),y(l)}return void 0===a&&(a=setTimeout(k,e)),s}return e=m(e)||0,p(n)&&(u=!!n.leading,o=(g="maxWait"in n)?d(m(n.maxWait)||0,e):o,v="trailing"in n?!!n.trailing:v),w.cancel=function(){void 0!==a&&clearTimeout(a),c=0,i=l=r=a=void 0},w.flush=function(){return void 0===a?s:x(f())},w},lc}();const fc=dc(hc);var pc=Ms("<img/>"),mc=Ms('<div class="ui-container svelte-1rvgxfc"><!></div>'),gc=Ms('<div class="cover-container svelte-1rvgxfc"><!> <!></div>'),vc=Ms('<div class="covers-container svelte-1rvgxfc" style="scroll-behavior: smooth;"></div>');function yc(t,e){Ci(e,!0);const n=[375,768,1024,1400,1920];let i=ma(e,"scrollOffset",15),r=ma(e,"isMobile",3,!1);const o=Pi("state");let s,a=so(void 0),l=so(1920),c=Qr((()=>o().playingModulePosition)),u=null,d=null,h=Qr((()=>o().startedPlaying)),f=Qr((()=>o().currentModulesList)),p=Qr((()=>bs(f).findIndex((t=>v(o().playingModulePosition,t.position)))));const m=fc((t=>{let e=n.find((e=>e>t));e||(e=n[n.length-1]),lo(l,e,!0)}),300);async function g(){o().seeking&&(o().startedPlaying?o().currentItemsList[o().activeItemIndex].modules[o().activeModuleIndex].play():o().playingModulePosition=bs(c),i(0))}function v(t,e){return t.itemIndex===e.itemIndex&&t.moduleIndex===e.moduleIndex}function y(t){const e=t.scrollLeft,n=t.scrollWidth-t.clientWidth;return 0===e?0:e>n?100:e/n*100}function b({target:t}){var e;const n=y(t),r=(null===(e=bs(f))||void 0===e?void 0:e.length)||1,a=100/(r-1||1),l=Math.round(n/a);let h=Math.min(l,r-1);const m=bs(f)[h],b={itemIndex:o().activeItemIndex,moduleIndex:o().activeModuleIndex};null!==u||v(m.position,b)||(o().activeItemIndex=m.position.itemIndex,o().activeModuleIndex=m.position.moduleIndex),lo(c,m.position);const k=s.children[bs(p)],x=s.getBoundingClientRect(),w=k.getBoundingClientRect();i(w.x-x.x),d&&clearTimeout(d),d=setTimeout((()=>{const e=y(t);Math.abs(e-l*a)<.25&&(null!==u?v(m.position,u)&&(u=null,g()):g())}),150)}Fo((()=>{const{activeItemIndex:t,activeModuleIndex:e}=o();t===bs(c).itemIndex&&e===bs(c).moduleIndex||ws((()=>{var n;const i=bs(f).findIndex((n=>{const{itemIndex:i,moduleIndex:r}=n.position;return t===i&&e===r}));u=(null===(n=bs(f)[i])||void 0===n?void 0:n.position)||null;const r=s.children[i];null==r||r.scrollIntoView()}))})),Fo((()=>m(bs(a)*window.devicePixelRatio)));var k=Fs(),x=_o(k),w=t=>{var n=vc();Vs(n,23,(()=>bs(f)),(t=>t.id),((t,n,i)=>{var o=gc(),s=wo(o),a=t=>{var r=pc();let o;Do((t=>{o=Ys(r,0,"cover-image svelte-1rvgxfc",null,o,{active:bs(h)&&bs(i)===bs(p)}),ta(r,"src",t),ta(r,"alt",bs(n).name),ta(r,"fetchpriority",0===bs(i)?"high":"auto")}),[()=>e.getCoverUrl(bs(n).cover,bs(l))]),Os(t,r)};Us(s,(t=>{bs(l)&&t(a)}));var c=To(s,2),u=t=>{var e=mc();!function(t,e,n){xi&&Ti();var i=new Ws(t);Ro((()=>{var t,r=null!==(t=e())&&void 0!==t?t:null;i.ensure(r,r&&(t=>n(t,r)))}),ni)}(wo(e),(()=>bs(n).Component),((t,e)=>{e(t,{get state(){return bs(n).state},get isMobile(){return r()}})})),Ii(e),Os(t,e)};Us(c,(t=>{var e;null!==(e=bs(n))&&void 0!==e&&e.Component&&t(u)})),Ii(o),Os(t,o)})),Ii(n),fa(n,(t=>s=t),(()=>s)),Is("scroll",n,b),da(n,"clientWidth",(t=>lo(a,t))),Os(t,n)};Us(x,(t=>{bs(f)&&t(w)})),Os(t,k),Di()}const bc="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};let kc;function xc(){const t=bc&&bc.navigator&&(bc.navigator.userAgent||bc.navigator.platform||bc.navigator.vendor)||"";if(kc&&kc.ua===t)return kc;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 kc={ua:t,isMobile:r},kc}var wc=Ms('<div class="absolute-full paging-buttons svelte-1n46o8q"><!> <!></div>'),_c=Ms("<div></div>"),Tc=Ms("<!> <!>",1),Ic=Ms('<div class="player-container svelte-1n46o8q"><div class="absolute-full swipable svelte-1n46o8q"></div> <!> <!> <!> <!></div> <!>',1),Ec=Ms('<div class="eko-gallery-app svelte-1n46o8q"><!></div>');function Sc(t,e){Ci(e,!0);const n=ma(e,"config",19,(()=>({}))),i=ma(e,"forceMobile",3,!1),r=ma(e,"onGalleryReady",3,(()=>{}));let o,s=so(fo(new $l(n()))),a=so(null),l=Qr((()=>i()||xc().isMobile)),c=so(0),u=so(void 0),d=so(!0);var h,f,p;function m(){lo(a,new e.EkoPlayer(o,e.playerOptions)),bs(a).on("playing",(()=>{bs(s).state.paused=!1})),bs(a).on("pause",(()=>{bs(s).state.paused=!0})),bs(a).once("playing",(()=>{bs(s).state.startedPlaying=!0}))}function g(t){var e;null===(e=bs(s))||void 0===e||e.selectItem(t)}function v(){var t;null===(t=bs(s))||void 0===t||t.next()}function y(){var t;null===(t=bs(s))||void 0===t||t.prev()}function b(){bs(a).paused?bs(a).play():bs(a).pause()}h="state",f=()=>bs(s).state,Ri().set(h,f),p=()=>(n()&&e.EkoPlayer&&(m(),bs(s).start(bs(a))),r()(bs(s).public),()=>{var t;null===(t=bs(a))||void 0===t||t.dispose()}),null===Fi&&yi(),Fo((()=>{const t=ws(p);if("function"==typeof t)return t})),Fo((()=>{var t;n()&&n()!==bs(s).currentConfig&&(lo(s,new $l(n()),!0),null===(t=bs(a))||void 0===t||t.dispose(),lo(d,!1),ys().then((()=>(lo(d,!0),ys()))).then((()=>{m(),bs(s).start(bs(a)),r()(bs(s).public)})))})),Fo((()=>{bs(u)&&bs(a)&&bs(a).loadDebugOverlay({containerElement:bs(u)})}));var k=Ec(),x=wo(k),w=t=>{var n=Ic(),i=_o(n),r=wo(i);fa(r,(t=>o=t),(()=>o));var a=To(r,2);yc(a,{get isMobile(){return bs(l)},get getCoverUrl(){return bs(s).getCoverUrl},get scrollOffset(){return bs(c)},set scrollOffset(t){lo(c,t,!0)}});var d=To(a,2),h=t=>{var e=wc(),n=wo(e);Zl(n,{type:"prev",onClick:y}),Zl(To(n,2),{type:"next",onClick:v}),Ii(e),Os(t,e)};Us(d,(t=>{bs(l)||e.hideNav||t(h)}));var f=To(d,2),p=t=>{nc(t,{})};Us(f,(t=>{var e;!bs(l)&&(null===(e=bs(s).state.currentItem)||void 0===e?void 0:e.modules.length)>1&&t(p)}));var m=To(f,2),k=t=>{var n=Tc(),i=_o(n);!function(t,e){Ci(e,!0);const n=Pi("state");var i=ac();i.__click=function(...t){var n;null===(n=e.onPauseClick)||void 0===n||n.apply(this,t)};var r=wo(i),o=t=>{var e=oc();Do((()=>ta(e,"src",ic))),Os(t,e)},s=t=>{var e=sc();Do((()=>ta(e,"src",rc))),Os(t,e)};Us(r,(t=>{n().paused?t(o):t(s,!1)})),Ii(i),Do((t=>ta(i,"aria-label",t)),[()=>n().paused?"Play":"Pause"]),Os(t,i),Di()}(i,{onPauseClick:b});var r=To(i,2),o=t=>{var e=_c();fa(e,(t=>lo(u,t)),(()=>bs(u))),Os(t,e)};Us(r,(t=>{e.debug&&t(o)})),Os(t,n)};Us(m,(t=>{bs(s).state.startedPlaying&&t(k)})),Ii(i);var x=To(i,2),w=t=>{!function(t,e){Ci(e,!0);let n=ma(e,"onNavItemClick",3,(()=>{}));const i=Pi("state");var r=Yl(),o=wo(r);Vs(o,23,(()=>i().currentItemsList),(t=>t.id),((t,e,r)=>{var o=Xl();let s;o.__click=()=>n()(bs(r));var a=wo(o),l=wo(a,!0);Ii(a),Ii(o),Do((t=>{s=Ys(o,0,"nav-button svelte-er27y2",null,s,t),Cs(l,bs(e).name)}),[()=>({selected:bs(r)===i().activeItemIndex})]),Os(t,o)})),Ii(o),Ii(r),Os(t,r),Di()}(t,{onNavItemClick:g})};Us(x,(t=>{e.hideNav||t(w)})),Do((()=>{var t;return Qs(i,`--uiTranformX: ${null!==(t=bs(c))&&void 0!==t?t:""}px`)})),Os(t,n)};Us(x,(t=>{n()&&bs(d)&&t(w)})),Ii(k),Os(t,k),Di()}function Nc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ac,Mc,Fc,Oc,Pc={exports:{}},Cc=Nc((Ac||(Ac=1,Fc=Pc.exports,Oc=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},(Mc=Pc).exports?Mc.exports=Oc():Fc.log=Oc()),Pc.exports));const Dc=()=>{},Rc=["trace","log","debug","info","warn","error","getLevel","setLevel"],Bc=["trace","debug","info","warn","error","silent"],Lc={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;"},zc="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global;let Wc={level:"trace",appName:""},Uc=[];const jc="object"==typeof zc&&zc.performance&&"function"==typeof zc.performance.now?zc.performance.now.bind(zc.performance):Date.now.bind(Date),$c=t=>t&&"string"==typeof t?t.toLowerCase().trim():"",qc=(()=>{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[$c(e)]=$c(i)||"trace"})),n}catch(t){return{}}})(),Vc=(t,e="")=>{const n=$c(t),i=Cc.getLogger(n);if(i.__ekologger)return i.__ekologger;e||qc[n]||qc["*"]||(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)=>(jc()/1e3).toFixed(e))()}] %c[${s}] ${Wc.appName?`[${Wc.appName}] `:""}[${t}]`,Lc[s],...e)}},e=qc[n]||qc["*"]||e||Wc.level,i.setLevel(e,!1);const o=(...t)=>i.log(...t);return Rc.forEach((t=>{o[t]=(...e)=>(Uc.forEach((n=>{n[t](...e)})),i[t](...e))})),i.__ekologger=o,o};Vc.setDefaults=({appName:t="",level:e})=>{t&&"string"==typeof t&&(Wc.appName=t),(e=$c(e))&&Bc.includes(e)&&(Wc.level=e,Object.values(Cc.getLoggers()).filter((t=>t.__noExplicitLevel)).forEach((t=>t.setLevel(Wc.level,!1))))},Vc.installDriver=t=>{const e={...Rc.reduce(((e,n)=>(e[n]="function"==typeof(null==t?void 0:t[n])?t[n]:Dc,e)),{})};Uc.push(e)};let Gc=class{#w=new Map;on(t,e){if("function"!=typeof e)return this;const n=this.#w.get(t)||new Set;return n.add(e),this.#w.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.#w.clear(),this;const n=this.#w.get(t);return n?e?(n.delete(e),0===n.size&&this.#w.delete(t),this):(this.#w.delete(t),this):this}trigger(t,...e){const n=this.#w.get(t);return n?(n.forEach((t=>t(...e))),this):this}};function Hc(t){return"[object Object]"===Object.prototype.toString.call(t)}function Kc(t,...e){const n=Hc(t)?{...t}:{};return e.forEach((t=>{Hc(t)&&Object.keys(t).forEach((e=>{const i=t[e],r=n[e];Hc(i)&&Hc(r)?n[e]=Kc(r,i):Array.isArray(i)?n[e]=i.slice():n[e]=i}))})),n}function Xc(t){if("string"==typeof t)return`'${t}'`;if(Array.isArray(t))return`[${t.map((t=>Xc(t))).join(", ")}]`;if(Hc(t))try{return JSON.stringify(t)}catch(t){return"[object Object]"}return null===t?"null":void 0===t?"undefined":String(t)}function Yc(t){return Array.from(t).map((t=>Xc(t))).join(", ")}var Qc=new WeakSet;class Jc extends Gc{constructor(...t){super(),j(this,Qc);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=Vc(n,this.loglevel);const i=Hc(this.defaults)?this.defaults:{},r=Hc(e)&&Hc(e[n])?e[n]:{};this.settings=Kc({},i,r),B(Qc,this,Zc).call(this),B(Qc,this,tu).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 Zc(){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}(${Yc(t)})`),a(...t)):a,t.add(o)}n=Object.getPrototypeOf(n)}}function tu(){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 eu="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};function nu(t){return Boolean(t)&&"object"==typeof t&&1===t.nodeType&&"function"==typeof t.appendChild}class iu extends Jc{#_;#T;#I;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);const[i]=t,r=function(t,e=(null==eu?void 0:eu.document)){if(nu(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 nu(i)?i:null}(i);if(!r)throw new Error("Canvas requires a valid mount target (HTMLElement or selector string).");this.#_=r;const o=null==eu?void 0:eu.document;if(!o||"function"!=typeof o.createElement)throw new Error("Canvas requires document.createElement.");var s,a;this.#T=o.createElement("canvas"),s=this.#T,a=null===(e=this.settings)||void 0===e?void 0:e.style,s&&a&&"object"==typeof a&&!Array.isArray(a)&&Object.keys(a).forEach((t=>{const e=a[t];null!=e&&(s.style[t]=String(e))})),this.#_.appendChild(this.#T);const l=null===(n=this.settings)||void 0===n?void 0:n.contextAttributes,c=l&&"object"==typeof l&&!Array.isArray(l)?l:void 0;if(this.#I=this.#T.getContext("webgl2",c),!this.#I)throw new Error("Canvas WebGL2 context is not available.")}get name(){return"Canvas"}get element(){return this.#T}get gl(){return this.#I}onDispose(){this.#T&&this.#T.parentNode&&this.#T.parentNode.removeChild(this.#T),this.#I=null,this.#T=null,this.#_=null}}var ru=new WeakMap,ou=new WeakMap,su=new WeakMap,au=new WeakMap,lu=new WeakMap,cu=new WeakMap,uu=new WeakSet;class du extends Jc{get name(){return"ContainerSize"}get containerWidth(){return z(ou,this)}get containerHeight(){return z(su,this)}get width(){return z(ou,this)}get height(){return z(su,this)}constructor(...t){super(...t),j(this,uu),W(this,ru,void 0),W(this,ou,0),W(this,su,0),W(this,au,null),W(this,lu,null),W(this,cu,null);const[e]=t;var n;U(ru,this,(n=e)&&n.element&&nu(n.element)?n.element:nu(n)?n:null),z(ru,this)&&(B(uu,this,fu).call(this,!0),B(uu,this,hu).call(this))}onDispose(){z(au,this)&&"function"==typeof z(au,this).disconnect&&z(au,this).disconnect(),U(au,this,null),z(cu,this)&&"function"==typeof(null==eu?void 0:eu.removeEventListener)&&eu.removeEventListener("resize",z(cu,this)),U(cu,this,null),z(lu,this)&&((null==eu?void 0:eu.clearInterval)||clearInterval)(z(lu,this)),U(lu,this,null),U(ru,this,null)}}function hu(){if(!z(ru,this))return;const t=null==eu?void 0:eu.ResizeObserver;if("function"==typeof t)return U(au,this,new t((()=>B(uu,this,fu).call(this)))),void z(au,this).observe(z(ru,this));U(cu,this,(()=>B(uu,this,fu).call(this))),"function"==typeof(null==eu?void 0:eu.addEventListener)&&eu.addEventListener("resize",z(cu,this));const e=(null==eu?void 0:eu.setInterval)||setInterval;U(lu,this,e((()=>B(uu,this,fu).call(this)),250))}function fu(t=!1){if(!z(ru,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}}(z(ru,this));(t||e!==z(ou,this)||n!==z(su,this))&&(U(ou,this,e),U(su,this,n),this.trigger("containerresize",{width:e,height:n}))}var pu={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"}};class mu{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;return{contextType:e||"webgl",contextAttributes:Object.prototype.hasOwnProperty.call(t,"contextAttributes")?n:r}}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 gu,vu={exports:{}},yu=(gu||(gu=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}(vu)),vu.exports),bu=Nc(yu);class ku extends mu{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 bu;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);const a={contextType:r};s&&void 0!==o&&(a.contextAttributes=o),t.initPlugin("canvas",a);const l={drawFrame:this.canvasDrawFrameFn.bind(this),resize:n,contextType:r,offscreenVideoCanvasEnabled:!1,viewportModeEnabled:!0,fps:0};return s&&void 0!==o&&(l.contextAttributes=o),t.canvas.init(l),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)}}class xu extends mu{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)}}class wu extends mu{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 _u=function(t){let e;return e="string"==typeof t?new xu(t):t&&t.src&&t.dest?new wu(t):new ku(t),e};function Tu(t){return Array.isArray(t)||(t=[t]),t}class Iu{constructor(t){this.store=t?{...t.get()}:{}}reset(){this.store={}}get(t){if(!t)return this.store;const e=(t=Tu(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=Tu(t),e=Tu(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]}))}}class Eu{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 Su=Vc("frame","warn");let Nu=!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");Nu=e||n}function Au(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))}class Mu extends Eu{fill(t){if(Nu&&(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?Au(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,Au(t,e)):t.__useSubImage=!0))}(this,t,e);const i=(performance.now()-n)/1e3;i>=.1&&Su.warn(`[fill] texImage2D() took ${i.toFixed(3)} seconds to execute.`),"function"==typeof t.close&&!0!==t.__keepOpen&&(t.close(),t.__closed=!0)}}class Fu extends Eu{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 Ou=function(t,e,n,i,r){let o;switch(t){case"frame":o=new Mu(e,n,i,r);break;case"pixel":o=new Fu(e,n,i,r);break;default:throw new Error(`cant recognize type ${t}`)}return o};class Pu{constructor(t){return this.gl=t.gl,this.textureObjectPool=[],this.textureUnitsPool=new Set(Array(20).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=Ou(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(20).keys()),t.forEach((t=>{this.textureUnitsPool.delete(t)}))}}const Cu=pu.VIDEO_SOURCE_PREFIX,Du=pu.TEXTURE_SOURCE_PREFIX,Ru=pu.PREVIOUS_OUTPUT_PREFIX,Bu=pu.SAVED_FRAME_PREFIX;function Lu(t,e,n){t.set(`${Cu}${n}`,e)}function zu(t,e,n){t.set(`${Ru}${n}`,e)}function Wu(t,e,n){t.set(`${Bu}${n}`,e)}class Uu{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()))Lu(t,n,e),zu(t,n,e);for(const[e,n]of Object.entries(this.capturedFramesManager.getSavedFrames()))Wu(t,n,e)}setTextureSource(t,e,n){t.set(`${Du}${n}`,e)}getInput(t,e){return t.get(e)}getPrevOutput(t,e){return e=Number.isInteger(e)?e:0,t.get(`${Ru}${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)=>{zu(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))}))}}class ju{constructor(t){this.context=t}bind(){throw new Error("impl in concrete")}}let $u=100,qu=100;function Vu(t,e){$u=t,qu=e}let Gu=class extends ju{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),Vu(i,r)),t}},Hu=class extends ju{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),!1!==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}};class Ku{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===pu.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS?new Gu({gl:this.gl}):new Hu({gl:this.gl,textureManager:this.textureManager,frameBufferObject:this.getFrameBufferObject(),useCanvasSizedFilterTargets:this.useCanvasSizedFilterTargets}),e}}function Xu(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 Yu=function(t,e){return Xu(t,t.VERTEX_SHADER,e)},Qu=function(t,e){return Xu(t,t.FRAGMENT_SHADER,e)};const Ju={position_3d:0,texture_coordinate_2d:1};var Zu=function(t,e,n){const i=t.createProgram();if(t.attachShader(i,e),t.attachShader(i,n),Object.entries(Ju).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)},td=[-1,-1,1,1,-1,1,-1,1,1,1,1,1],ed=[0,1,2,2,1,3],nd=[0,0,1,0,0,1,1,1];const id=96,rd=[new Float32Array(new ArrayBuffer(id)),new Float32Array(new ArrayBuffer(id)),new Float32Array(new ArrayBuffer(id)),new Float32Array(new ArrayBuffer(id)),new Float32Array(new ArrayBuffer(id)),new Float32Array(new ArrayBuffer(id))],od=[new Int16Array(6),new Int16Array(6),new Int16Array(6)];class sd{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=rd[this.floatBufferCounter],this.floatBufferCounter=this.floatBufferCounter++%rd.length;break;case this.gl.ELEMENT_ARRAY_BUFFER:t=od[this.unit16BufferCounter],this.unit16BufferCounter=this.unit16BufferCounter++%od.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 ad={position_3d:class extends sd{getPointerData(){return{size:3,type:this.gl.FLOAT,normalize:!1,stride:0,offset:0}}},position_indexes:class extends sd{setPointer(){}getPointerData(){}enable(){}},texture_coordinate_2d:class extends sd{getPointerData(){return{size:2,type:this.gl.FLOAT,normalize:!0,stride:0,offset:0}}}};var ld=function(t,e,n){const i=ad[t];if(!i)throw new Error(`${t} is not a attribute name,choose from list: ${Object.keys(ad)}`);return new i(t,e,n)};class cd{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}}class ud extends cd{set(t){this.gl.uniform1fv(this.location,t)}}class dd extends cd{set(t){t&&(t.beforeUse(),this.gl.uniform1i(this.location,t.getUnit()))}}const hd="first_texture_dimensions",fd="viewport_dimensions",pd="time",md={RUNTIME_OPTIONS:"runtimeOptions[0]",STATIC_OPTIONS:"staticOptions[0]",FIRST_TEXTURE:"first_texture",SECOND_TEXTURE:"second_texture",FIRST_MATRIX:"first_mat4"},gd={[md.FIRST_TEXTURE]:dd,[md.SECOND_TEXTURE]:dd,[md.FIRST_MATRIX]:class extends cd{set(t){this.gl.uniformMatrix4fv(this.location,!1,t)}},[md.STATIC_OPTIONS]:ud,[md.RUNTIME_OPTIONS]:ud};var vd=function(t,e){const n=gd[t];if(!n)throw new Error(`${t} is not a attribute name,choose from list: ${Object.keys(gd)}`);return new n(t,e)},yd=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 bd="position_3d",kd="position_indexes",xd="texture_coordinate_2d";class wd{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=Yu(this.gl,e.vertex),this.fragmentShader=Qu(this.gl,e.fragment),this.program=Zu(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:bd,bindPoint:e.gl.ARRAY_BUFFER},{id:kd,bindPoint:e.gl.ELEMENT_ARRAY_BUFFER},{id:xd,bindPoint:e.gl.ARRAY_BUFFER}].concat(t)).forEach((t=>{const i=t.id;n[i]=ld(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]=vd(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:md.RUNTIME_OPTIONS},{id:md.STATIC_OPTIONS}];return(t.getUniformList||wd.getUniformList)().forEach((t=>{Object.values(md).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||wd.getUniformList)().forEach((t=>{switch(t){case md.FIRST_TEXTURE:this.uniforms[md.FIRST_TEXTURE].set(r[0]);break;case md.SECOND_TEXTURE:this.uniforms[md.SECOND_TEXTURE].set(r[1]);break;case hd:o=[...o,r[0].getWidth(),r[0].getHeight()];break;case fd:o=[...o,i.width,i.height];break;case pd:{const t=yd(e.startTime,e.duration);o=[...o,t];break}}})),o.length>0&&this.uniforms[md.RUNTIME_OPTIONS].set(o)}static getUniformList(){return[md.FIRST_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(){}handleAttributes(){this.attributes[bd].fillBuffer(td),this.attributes[bd].setPointer(),this.attributes[kd].fillBuffer(ed),this.attributes[xd].fillBuffer(nd),this.attributes[xd].setPointer()}disposeAttributes(){Object.values(this.attributes).forEach((t=>{t.dispose()}))}render(t,e){const n=this.frameBuffer.bind(t);let i={width:$u,height:qu};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)}}class _d extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(_d)};super(_d.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}"},e,t)}static getFilterType(){return"__default"}static getInputsCount(){return 1}static getInitialOptions(){return{}}}var Td,Id="undefined"!=typeof Float32Array?Float32Array:Array;function Ed(){var t=new Id(3);return Id!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Sd(t,e,n){var i=new Id(3);return i[0]=t,i[1]=e,i[2]=n,i}function Nd(){var t=new Id(4);return Id!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}Ed(),function(){var t;t=new Id(4),Id!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}(),Ed(),Sd(1,0,0),Sd(0,1,0),Nd(),Nd(),Td=new Id(9),Id!=Float32Array&&(Td[1]=0,Td[2]=0,Td[3]=0,Td[5]=0,Td[6]=0,Td[7]=0),Td[0]=1,Td[4]=1,Td[8]=1;class Ad extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Ad)};super(Ad.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:Ad.getInitialOptions().translate.x},{properties:["translate","y"],type:"slider",minValue:-2,maxValue:2,step:.001,initialValue:Ad.getInitialOptions().translate.y},{properties:["scale","x"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:Ad.getInitialOptions().scale.x},{properties:["scale","y"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:Ad.getInitialOptions().scale.y},{properties:["rotate"],type:"slider",minValue:-360,maxValue:360,step:1,initialValue:Ad.getInitialOptions().rotate}]}static getUniformList(){return[md.FIRST_TEXTURE,md.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,g=s*u,v=a*l,y=a*c,b=a*u,k=i[0],x=i[1],w=i[2];return t[0]=(1-(p+g))*k,t[1]=(h+b)*k,t[2]=(f-y)*k,t[3]=0,t[4]=(h-b)*x,t[5]=(1-(d+g))*x,t[6]=(m+v)*x,t[7]=0,t[8]=(f+y)*w,t[9]=(m-v)*w,t[10]=(1-(d+p))*w,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}((s=new Id(16),Id!=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}(Nd(),0,0,o),Sd(e,n,0),Sd(i,r,1)),this.uniforms[md.FIRST_MATRIX].set(this.transformMatrix)}}class Md extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Md)};super(Md.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[md.FIRST_TEXTURE,hd]}}class Fd extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Fd)};super(Fd.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[md.FIRST_TEXTURE,hd]}}class Od extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Od)};super(Od.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[md.FIRST_TEXTURE,hd,fd]}handleStaticUniforms(t){var e;const n=(null!==(e=Number.parseFloat(t.offsetDist))&&void 0!==e?e:4).toFixed(3);this.uniforms[md.STATIC_OPTIONS].set([n])}}class Pd extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Pd)};super(Pd.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[md.FIRST_TEXTURE,hd,fd]}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[md.STATIC_OPTIONS].set([i,r])}}class Cd extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Cd)};super(Cd.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[md.STATIC_OPTIONS].set([e])}}class Dd extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Dd)};super(Dd.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[md.FIRST_TEXTURE,hd,md.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[md.STATIC_OPTIONS].set([e,n,i,r,o,s,a])}}class Rd extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Rd)};super(Rd.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[md.FIRST_TEXTURE,md.SECOND_TEXTURE]}}class Bd extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Bd)};super(Bd.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[md.FIRST_TEXTURE,md.SECOND_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(t){const e=Number.parseFloat(t.lutSize).toFixed(1);this.uniforms[md.STATIC_OPTIONS].set([e])}}var Ld="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",zd='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:Wd,cos:Ud,sin:jd,acos:$d,atan2:qd,sqrt:Vd,pow:Gd}=Math;function Hd(t){return t<0?-Gd(-t,1/3):Gd(t,1/3)}const Kd=Math.PI,Xd=2*Kd,Yd=Kd/2,Qd=Number.MAX_SAFE_INTEGER||9007199254740991,Jd=Number.MIN_SAFE_INTEGER||-9007199254740991,Zd={x:0,y:0,z:0},th={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),Vd(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],Zd],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||th.approximately(t,e)||th.approximately(t,n)},approximately:function(t,e,n){return Wd(t-e)<=(n||1e-6)},length:function(t){const e=th.Tvalues.length;let n=0;for(let i,r=0;r<e;r++)i=.5*th.Tvalues[r]+.5,n+=th.Cvalues[r]*th.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(th.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 qd(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 Vd(n*n+i*i)},closest:function(t,e){let n,i,r=Gd(2,63);return t.forEach((function(t,o){i=th.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=Gd(t,e)+Gd(1-t,e);return Wd((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=Gd(1-t,e);return n/(Gd(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 th.lli8(r,o,s,a,l,c,u,d)},lli:function(t,e){return th.lli4(t,t.c,e,e.c)},makeline:function(t,e){return new uh(t.x,t.y,(t.x+e.x)/2,(t.y+e.y)/2,e.x,e.y)},findbbox:function(t){let e=Qd,n=Qd,i=Jd,r=Jd;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(!th.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=th.makeline(e.points[i-1],t.points[0]),s=th.makeline(t.points[r-1],e.points[0]),a={startcap:o,forward:t,back:e,endcap:s,bbox:th.findbbox([o,t,e,s]),intersections:function(t){return th.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=Qd,s=Jd;-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=-qd(e.p2.y-i,e.p2.x-n);return t.map((function(t){return{x:(t.x-n)*Ud(r)-(t.y-i)*jd(r),y:(t.x-n)*jd(r)+(t.y-i)*Ud(r)}}))},roots:function(t,e){e=e||{p1:{x:0,y:0},p2:{x:1,y:0}};const n=t.length-1,i=th.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=-Vd(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(th.approximately(l,0)){if(th.approximately(c,0))return th.approximately(u,0)?[]:[-d/u].filter(r);const t=Vd(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,g=m*m+f*f*f;let v,y,b,k,x;if(g<0){const t=-h/3,e=Vd(t*t*t),n=-p/(2*e),i=$d(n<-1?-1:n>1?1:n),o=2*Hd(e);return b=o*Ud(i/3)-c/3,k=o*Ud((i+Xd)/3)-c/3,x=o*Ud((i+2*Xd)/3)-c/3,[b,k,x].filter(r)}if(0===g)return v=m<0?Hd(-m):-Hd(m),b=2*v-c/3,k=-v-c/3,[b,k].filter(r);{const t=Vd(g);return v=Hd(-m+t),y=Hd(m+t),[v-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=-Vd(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=th.compute(t,e),h=th.compute(t,n),f=d.x*d.x+d.y*d.y;if(i?(o=Vd(Gd(d.y*h.z-h.y*d.z,2)+Gd(d.z*h.x-h.z*d.x,2)+Gd(d.x*h.y-h.x*d.y,2)),s=Gd(f+d.z*d.z,1.5)):(o=d.x*h.y-d.y*h.x,s=Gd(f,1.5)),0===o||0===s)return{k:0,r:0};if(c=o/s,u=s/o,!r){const r=th.curvature(t-.001,e,n,i,!0).k,o=th.curvature(t+.001,e,n,i,!0).k;l=(o-c+(c-r))/2,a=(Wd(o-c)+Wd(c-r))/2}return{k:c,r:u,dk:l,adk:a}},inflections:function(t){if(t.length<4)return[];const e=th.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(th.approximately(o,0)){if(!th.approximately(s,0)){let t=-a/s;if(0<=t&&t<=1)return[t]}return[]}const l=2*o;if(th.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,Wd(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 th.bboxoverlap(t.left.bbox(),t.right.bbox())}));let u=[];return 0===c.length||(c.forEach((function(t){u=u.concat(th.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*Ud(Yd)-r*jd(Yd),l=i*jd(Yd)+r*Ud(Yd),c=o*Ud(Yd)-s*jd(Yd),u=o*jd(Yd)+s*Ud(Yd),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,g=h+l,v=f+c,y=p+u,b=th.lli8(d,h,m,g,f,p,v,y),k=th.dist(b,t);let x,w=qd(t.y-b.y,t.x-b.x),_=qd(e.y-b.y,e.x-b.x),T=qd(n.y-b.y,n.x-b.x);return w<T?((w>_||_>T)&&(w+=Xd),w>T&&(x=T,T=w,w=x)):T<_&&_<w?(x=T,T=w,w=x):T+=Xd,b.s=w,b.e=T,b.r=k,b},numberSort:function(t,e){return t-e}};class eh{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 th.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++)th.expandbox(e,t[n].bbox());return e}offset(t){const e=[];return this.curves.forEach((function(n){e.push(...n.offset(t))})),new eh(e)}}const{abs:nh,min:ih,max:rh,cos:oh,sin:sh,acos:ah,sqrt:lh}=Math,ch=Math.PI;let uh=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=th.align(s,{p1:s[0],p2:s[l]}),d=th.dist(s[0],s[l]);this._linear=u.reduce(((t,e)=>t+nh(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=th.dist(n,s.C));const a=o*(1-r)/r,l=th.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,g=n.y-h,v=n.x+f,y=n.y+p,b=s.A,k=b.x+(m-b.x)/(1-r),x=b.y+(g-b.y)/(1-r),w=b.x+(v-b.x)/r,_=b.y+(y-b.y)/r,T={x:t.x+(k-t.x)/r,y:t.y+(x-t.y)/r},I={x:i.x+(w-i.x)/(1-r),y:i.y+(_-i.y)/(1-r)};return new e(t,T,I,i)}static getUtils(){return th}getUtils(){return e.getUtils()}static get PolyBezier(){return eh}valueOf(){return this.toString()}toString(){return th.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=th.derive(this.points,this._3d),this.computedirection()}computedirection(){const t=this.points,e=th.angle(t[0],t[this.order],t[1]);this.clockwise=e>0}length(){return th.length(this.derivative.bind(this))}static getABC(t=2,e,n,i,r=.5){const o=th.projectionratio(r,t),s=1-o,a={x:o*e.x+s*i.x,y:o*e.y+s*i.y},l=th.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],th.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=th.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=th.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?th.computeWithRatios(t,this.points,this.ratios,this._3d):th.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 th.compute(t,this.dpoints[0],this._3d)}dderivative(t){return th.compute(t,this.dpoints[1],this._3d)}align(){let t=this.points;return new e(th.align(t,{p1:t[0],p2:t[t.length-1]}))}curvature(t){return th.curvature(t,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return th.inflections(this.points)}normal(t){return this._3d?this.__normal3(t):this.__normal2(t)}__normal2(t){const e=this.derivative(t),n=lh(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=lh(e.x*e.x+e.y*e.y+e.z*e.z),r=lh(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=lh(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=th.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=th.map(0,0,1,this._t1,this._t2),r.left._t2=th.map(t,0,1,this._t1,this._t2),r.right._t1=th.map(t,0,1,this._t1,this._t2),r.right._t2=th.map(1,0,1,this._t1,this._t2),n?(n=th.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]=th.droots(r),3===this.order&&(r=this.dpoints[1].map(i),t[n]=t[n].concat(th.droots(r))),t[n]=t[n].filter((function(t){return t>=0&&t<=1})),e=e.concat(t[n].sort(th.numberSort))}.bind(this)),t.values=e.sort(th.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]=th.getminmax(this,n,t[n])}.bind(this)),e}overlaps(t){const e=this.bbox(),n=t.bbox();return th.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=th.angle(this.points[0],this.points[3],this.points[1]),e=th.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),nh(ah(n))<ch/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,nh(n-i)<r)return[];e=t.split(n,i),e._t1=th.map(n,0,1,t._t1,t._t2),e._t2=th.map(i,0,1,t._t1,t._t2),s.push(e),n=i;break}n<1&&(e=t.split(n,1),e._t1=th.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=th.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]=th.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=lh(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]=th.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=th.makeline(h[2],d[0]),p=th.makeline(d[2],h[0]),m=[f,new e(d),p,new e(h)];return new eh(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 th.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],g=c[s-1].points[c[s-1].points.length-1],v=c[0].points[0],y=th.makeline(g,p),b=th.makeline(m,v),k=[y].concat(a).concat([b]).concat(c);return new eh(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=th.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=ih(t.p1.x,t.p2.x),n=ih(t.p1.y,t.p2.y),i=rh(t.p1.x,t.p2.x),r=rh(t.p1.y,t.p2.y);return th.roots(this.points,t).filter((t=>{var o=this.get(t);return th.between(o.x,e,i)&&th.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=th.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=th.dist(t,e),l=th.dist(t,o),c=th.dist(t,s);return nh(l-a)+nh(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=th.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*oh(a.e),y:a.y+a.r*sh(a.e)};a.e+=th.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 dh={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 uh({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 uh(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 uh(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 hh{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{fh(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 fh(t,e,n){let i=t[e];t[e]=t[n],t[n]=i}function ph(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 mh={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 hh(n,i);let o=[];for(let n=0;n<e;n++)o.push(ph(n/(e-1),r,t));return o}};function gh(t,e=256,n={}){return"bezier"===n.type?dh.pointsToCurve(t,e,n):mh.pointsToCurve(t,e)}const vh=[];for(let t=0;t<256;t++)vh[t]=t;class yh extends wd{constructor(t){const e={vertex:Ld,fragment:zd},n={uniforms:wd.getUniformInfo(yh)};super(yh.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,gh(n,256).map((t=>255*t))):vh],this.uniforms[md.STATIC_OPTIONS].set(e)}}function bh(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 kh extends wd{constructor(t){const e={vertex:Ld,fragment:zd},n={uniforms:wd.getUniformInfo(kh)};super(kh.getFilterType(),e,n,t)}static getFilterType(){return"levels"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=[...bh(t.black,t.white,t.gamma)];this.uniforms[md.STATIC_OPTIONS].set(e)}}const xh=360,wh=[];for(let t=0;t<xh;t++)wh[t]=t;class _h extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(_h)};super(_h.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\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 gh(t,xh,{type:"bezier"}).map((t=>{return e=t,((Math.round(e.x*xh)+180)%xh+(1-e.y-.5)*xh+xh)%xh;var e}))}(t.points)||wh;this.uniforms[md.STATIC_OPTIONS].set(e)}}class Th extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Th)};super(Th.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[md.STATIC_OPTIONS].set([e,n])}}class Ih extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Ih)};super(Ih.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[md.STATIC_OPTIONS].set([e,n,i,r])}}class Eh extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Eh)};super(Eh.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[md.STATIC_OPTIONS].set([e])}}class Sh extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Sh)};super(Sh.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[md.FIRST_TEXTURE,hd,fd]}handleStaticUniforms(t){let e={...Sh.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[md.STATIC_OPTIONS].set([n,i,r,o,s,a,l,c,h,f,d,u])}}class Nh extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Nh)};super(Nh.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[md.STATIC_OPTIONS].set([n,i,r,o])}}class Ah extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Ah)};super(Ah.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 Mh extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Mh)};super(Mh.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[md.STATIC_OPTIONS].set([e,n])}}class Fh extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Fh)};super(Fh.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[md.STATIC_OPTIONS].set([e])}}var Oh,Ph,Ch,Dh,Rh,Bh,Lh,zh;function Wh(){if(Dh)return Ch;Dh=1;const t=Ph?Oh:(Ph=1,Oh={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"]}};Ch=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]},Ch}function Uh(){if(Bh)return Rh;Bh=1;const t=Wh();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 Rh=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 jh=function(){if(zh)return Lh;zh=1;const t=Wh(),e=Uh(),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)}))})),Lh=n}(),$h=Nc(jh);class qh extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(qh)};super(qh.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=$h.hex.rgb(t.color).map((t=>t/255));this.uniforms[md.STATIC_OPTIONS].set([e[0],e[1],e[2]])}}class Vh extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Vh)};super(Vh.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[md.STATIC_OPTIONS].set([e.from,e.to,...e.ease])}static getUniformList(){return[md.FIRST_TEXTURE,pd]}}class Gh extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Gh)};super(Gh.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[md.STATIC_OPTIONS].set([e.from,e.to,...e.ease])}static getUniformList(){return[md.FIRST_TEXTURE,pd]}}class Hh extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Hh)};super(Hh.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[md.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[md.FIRST_TEXTURE,pd]}}class Kh extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Kh)};super(Kh.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[md.STATIC_OPTIONS].set([e.from,e.to,...e.ease,n.x,n.y])}static getUniformList(){return[md.FIRST_TEXTURE,pd,hd]}}class Xh extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Xh)};super(Xh.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=$h.hex.rgb(n).map((t=>t/255));this.uniforms[md.STATIC_OPTIONS].set([e.from,e.to,...e.ease,i[0],i[1],i[2]])}static getUniformList(){return[md.FIRST_TEXTURE,pd]}}var Yh=Object.freeze({__proto__:null,Crop:Sh,Curves:yh,Default:_d,DipToBlackTransition:Gh,DirectionalBlur:Pd,Exposure:Fh,ExposureTransition:Vh,FadeToColorTransition:Xh,FastBlur:Od,HardLight:qh,HorizontalBlur:Md,Hue:_h,Lab:Mh,Levels:kh,Lut:Bd,MotionBlurTransition:Kh,Opacity:Cd,Saturation:Eh,ShapeComposite:Rd,ShapeCompositeMask:Dd,Solid:Nh,SolidImage:Ah,Transform:Ad,TransformTransition:Hh,VerticalBlur:Fd,Vibrance:Ih,WhiteBalance:Th});const Qh=Object.values(Yh).reduce(((t,e)=>(t[e.getFilterType()]=e,t)),{});class Jh{constructor(t){this.context=t}static getFilterClass(t){return Qh[t]}getFilterIds(){return Object.keys(this.filterTypeToInstanceMap)}create(t,e){this.context={...this.context,options:e.options};const n=new Qh[t](this.context);if(!n)throw new Error(`${t} is not a atom filter, atomFilter list: `,this.getFilterIds());return n}}const Zh=pu.PREVIOUS_OUTPUT_PREFIX,tf=Object.values(Yh).reduce(((t,e)=>(t[e.getFilterType()]={type:e.getFilterType(),options:e.getInitialOptions(),inputs:[...Array(e.getInputsCount())].map(((t,e)=>`${Zh}${e}`)),outputs:[]},t)),{});var ef,nf,rf=function(){if(nf)return ef;nf=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)}),{})},ef=s}(),of=Nc(rf),sf=function(t,e){return of(t,e,{arrayMerge:(t,e)=>e})};const af=pu.MESSAGES.UPDATE_OPTIONS;let lf=class{constructor(t,e){this.eventEmitter=new bu,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(af,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 cf extends lf{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=sf(this.options,t),this.filter.updateStaticUniforms(this.options)}dispose(){this.filter.dispose()}}const uf=pu.MESSAGES.UPDATE_OPTIONS;class df extends cf{constructor(t,e,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}baseNodeUpdateOptions(t){this.options=sf(this.options,t),this.filter.updateStaticUniforms(this.options)}registerListeners(){this.baseNode.getEventEmitter().on(uf,this.baseNodeUpdateOptions,this)}dispose(){this.filter.dispose(),this.baseNode.getEventEmitter().off(uf,this.baseNodeUpdateOptions,this)}}function hf(t){return null!==t&&"object"==typeof t}function ff(t){if(!hf(t)||(e=t,Array.isArray(e)))return t;var e;const n=Object.keys(t).sort(),i={};return n.forEach((e=>{i[e]=ff(t[e])})),i}function pf(t,e){return null!=t&&t.id&&null!=e&&e.id?t.type===e.type&&t.id===e.id:t.type===e.type}function mf(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)),hf(i=n)&&hf(r)?JSON.stringify(ff(i))===JSON.stringify(ff(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]&&pf(a,c[l])?l:c.findIndex((t=>pf(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 gf(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=Nf.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 vf=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 gf(mf(r,o),r,n,i)};class yf extends lf{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=>Nf.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 Iu(e),r=[];this.nodes.forEach(((e,o)=>{const s={ioStore:t,graphIOManager:n};i=e.render(s),o!==this.nodes.length-1&&r.push(i)})),n.disposeTextures(r,i)}return n.setOutputs(e,r,i),i}getOptionsDisplay(){return[]}_updateOptions(t){this.nodes=vf(t,this.options,this.nodes,this.context),this.options=t}dispose(){this.nodes.forEach((t=>{t.dispose()}))}}const bf=pu.MESSAGES.UPDATE_OPTIONS;class kf extends yf{constructor(t,e,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}registerListeners(){this.baseNode.getEventEmitter().on(bf,this.updateOptions,this)}dispose(){this.nodes.forEach((t=>{t.dispose()})),this.baseNode.getEventEmitter().off(bf,this.updateOptions,this)}}const xf=pu.SYSTEM_NODES.TAGS.ATOM,wf=pu.SYSTEM_NODES.TAGS.FILTER,_f=pu.SYSTEM_NODES.TAGS.COMPOSITE_FILTER,Tf=pu.SYSTEM_NODES.TAGS.TRANSITION_FILTER,If=pu.PREVIOUS_OUTPUT_PREFIX,Ef=Object.keys(tf);function Sf(t,e){const n=(i=t.type,tf[i]);var i;return t=sf(n,t),new cf(t.type,t,e)}var Nf={create:function(t,e){let n;switch(function(t){let e;return n=t,e=Ef.includes(n)?xf:t===_f?_f:t===Tf?Tf:wf,e;var n}((t=JSON.parse(JSON.stringify(t))).type)){case xf:n=Sf(t,e);break;case wf: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=sf(r,t),e={...e,baseNode:n},o=i===_f?new kf(i,t,e):new df(i,t,e),o}(t,e);break;case _f:n=function(t,e){const n=t.type;return t=sf({inputs:[`${If}0`]},t),new yf(n,t,e)}(t,e);break;case Tf: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`,Sf(t,e)}(t,e);break;default:throw new Error("cant create node",t.type)}return n}};const Af=pu.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS;var Mf=function(t){const e={[Af]:tf[Af]};for(const[n,i]of Object.entries(e)){const e=Nf.create(i,t);t.nodeStore.set(n,e)}},Ff=function(t,e){for(const[n,i]of Object.entries(t)){const t=Nf.create(i,e);e.nodeStore.set(n,t)}};const Of=pu.CAPTURED_FRAME_PREFIX;class Pf{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=`${Of}${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 Cf=Vc("ShaderGraphApplication","warn"),Df=pu.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS,Rf=Object.freeze({useCanvasSizedFilterTargets:!1,rebindAttributesOnProgramSwitch:!0,forwardContextAttributes:!0});function Bf(t={}){const e=null==t?void 0:t.performanceToggles;return e&&"object"==typeof e?{...Rf,...e}:{...Rf}}class Lf{constructor(t,e={}){return this.glSource=t,this.config=e,this.performanceToggles=Bf(e),this.isContextLost=!1,this.isRecovering=!1,this.isDisposed=!1,this.pendingNodeOptionUpdates=new Map,this.doInit(t,e)}doInit(t,e){this.source=_u(t),this.performanceToggles=Bf(e),this.isDisposed=!1,this.render=this.render.bind(this),this.resizeCanvasSize=this.resizeCanvasSize.bind(this),this.setSrcVidTracks=this.setSrcVidTracks.bind(this),this.onWebGLContextLost=this.onWebGLContextLost.bind(this),this.onForceRender=this.onForceRender.bind(this),this.resizeCanvasSize._shouldPreventDefault=!0;const n=function(t={},e=Rf){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(),"undefined"!=typeof window&&(window.ekoShaderGraph=this),this.selectedRenderNode=null,this.activeTextures=this.activeTextures||new Set,this.textureManager=new Pu({gl:this.gl,activeTextures:this.activeTextures}),this.capturedFramesManager=new Pf({textureManager:this.textureManager}),this.graphIOManager=new Uu({glSource:t,gl:this.gl,textureManager:this.textureManager,capturedFramesManager:this.capturedFramesManager}),this.frameBufferFactory=new Ku({gl:this.gl,textureManager:this.textureManager,useCanvasSizedFilterTargets:this.performanceToggles.useCanvasSizedFilterTargets}),this.filterFactory=new Jh({gl:this.gl,frameBufferFactory:this.frameBufferFactory,rebindAttributesOnProgramSwitch:this.performanceToggles.rebindAttributesOnProgramSwitch}),this.nodeStore=new Iu,this.ioStore=new Iu,Mf({nodeStore:this.nodeStore,filterFactory:this.filterFactory}),this.addClientNodes(e.nodes,this.isRecovering),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)}}getNodes(){return Cf.debug("[getNodes]"),this.nodeStore.get()}addClientNodes(t,e=!1){if(Cf.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));Ff(n,{nodeStore:this.nodeStore,filterFactory:this.filterFactory})}addTexture(t,e,n){if(Cf.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){Cf.debug("[releaseTexture]",t),this.isContextUnavailable()||this.textureManager.releaseTexture(t)}selectNode(t){if(Cf.debug("[selectNode]",t),!this.isContextUnavailable())return this.nodeStore.get(t)||Cf.warn("Missing render node",t),void(this.selectedRenderNodeId=t);this.selectedRenderNodeId=t}captureTexture(){return Cf.debug("[captureTexture]"),this.isContextUnavailable()?null:this.capturedFramesManager.createCaptureId()}disposeTexture(t){return Cf.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}}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){Cf.error("Failed to apply pending node options",e,t),this.queueNodeOptionUpdate(e,n)}return}this.updateOptions(e,n)}catch(t){Cf.error("Failed to apply pending node options",e,t)}}))}render(t={}){var e,n;const{noRaf:i=!1}=t;if(this.isContextUnavailable())return;if(this.dirtyCanvasSize){let{width:t=this.gl.canvas.width,height:e=this.gl.canvas.height}=this.dirtyCanvasSize;Vu(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}const r=null===(e=this.gl)||void 0===e||null===(e=e.canvas)||void 0===e?void 0:e.width,o=null===(n=this.gl)||void 0===n||null===(n=n.canvas)||void 0===n?void 0:n.height;Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0&&(Vu(r,o),this.gl.viewport(0,0,r,o)),this.graphIOManager.setVideoSources(this.ioStore);let s={ioStore:this.ioStore,graphIOManager:this.graphIOManager};this.renderSelectedNode(s),this.config.onPreRenderToScreen&&this.config.onPreRenderToScreen(),this.renderToCanvas(s),this.config.onPostRenderToScreen&&this.config.onPostRenderToScreen(),this.graphIOManager.disposeAllStore(this.ioStore),s=null,!i&&!this.config.userWillCallRender&&(this.rafId=requestAnimationFrame(this.render))}renderSelectedNode(t){if(!this.selectedRenderNodeId)return;const e=this.nodeStore.get(this.selectedRenderNodeId);e&&"function"==typeof e.render?e.render(t):(Cf.warn("Missing selected render node",this.selectedRenderNodeId),this.selectedRenderNodeId=null)}renderToCanvas(t){const e=this.nodeStore.get(Df);e&&"function"==typeof e.render?e.render(t):Cf.warn("Missing render-to-canvas node")}updateOptions(t,e){if(Cf.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){Cf.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(){Cf.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),Cf.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=>{Cf.debug("Re-adding client nodes",t),this.addClientNodes(t,!0)})),Object.entries(e).forEach((([t,e])=>{Cf.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&&(Cf.debug("Recovering glSource (i.e. seeking/resetting player)"),await this.source.recover()),this.isContextLost=!1,this.isRecovering=!1,o&&this.render()}catch(t){Cf.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 zf{constructor(t={}){this.options=t}get type(){return"stage"}getSignature(){return this.type}build({inputs:t=[]}={}){return{graph:[],outputs:t,signature:this.getSignature()}}}function Wf(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 Uf extends zf{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:Wf(a)}),o.push(l)}return{graph:r,outputs:o,signature:this.getSignature()}}}class jf{#E=new Map;constructor(){this.register("retarget",Uf)}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 $f{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 qf extends $f{#S=null;#N=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=qf.buildLayoutGraph({inputs:t}),r=e.signature;this.#S!==r&&(i.updateOptions(o,{graph:e.graph}),this.#S=r),this.#N!==o&&(i.selectNode(o),this.#N=o),i.render({noRaf:!0})}catch(t){}}}var Vf=new WeakMap,Gf=new WeakMap,Hf=new WeakSet;class Kf extends $f{constructor(...t){super(...t),j(this,Hf),W(this,Vf,null),W(this,Gf,null)}static get type(){return"side-by-side"}static get aliases(){return["SideBySideRenderNode","side-by-side","sidebyside"]}static get requiresFrameCadence(){return!1}static get panAndScanTarget(){return"skip"}static buildLayoutGraph({inputs:t=[]}={}){const e=t.length;if(e<=1)return super.buildDefaultLayoutGraph(t);const n=1/e,i=[],r=t.map(((t,e)=>{const r=(e+.5)*n,o=`slice-${e}`;return i.push({id:`side-by-side-crop-${e}`,type:"crop",inputs:[t],outputs:[o],options:{source:{center:{x:.5,y:.5},width:1,height:1},target:{center:{x:r,y:.5},width:n,height:1},fitType:"fill",cornerRadius:0,edgeSoftness:0}}),o}));let o=r[0];for(let t=1;t<e;t+=1){const e=(t+.5)*n*2-1;i.push({id:`side-by-side-mask-${t}`,type:"shapeCompositeMask",inputs:[r[t],o],outputs:["accum"],options:{type:"box",center:{x:e,y:0},area:{width:n,height:1},radius:0,edgeSoftness:0}}),o="accum"}return{type:Kf.type,signature:`${Kf.type}:${t.length}`,isDynamic:!1,graph:i}}static prepareRenderFrames({frames:t,state:e}={}){const n=Array.isArray(t)?t:[],i=e&&"object"==typeof e?e:{},r=Array.isArray(i.frames)?i.frames:[];if(!n.length&&!r.length)return i.frames=[],i!==e&&e&&"object"==typeof e&&Object.assign(e,i),[];const o=Math.max(n.length,r.length,2),s=Array.from({length:o}),a=n[0]||r[0];for(let t=0;t<o;t+=1)s[t]=n[t]||r[t]||a;return i.frames=s,i!==e&&e&&"object"==typeof e&&Object.assign(e,i),s}static resetRenderState(t){t&&"object"==typeof t&&(t.frames=null)}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.sideBySide;if(o){if(1===n.length){const t=null==r?void 0:r.default;try{B(Hf,this,Xf).call(this,i,t)}catch(t){}return}try{B(Hf,this,Yf).call(this,i,o,n)}catch(t){}}}}function Xf(t,e){if(!e)return;const n=me.buildLayoutGraph({inputs:["__SRC_TEXTURE:0"]}),i=n.signature;z(Vf,this)!==i&&(t.updateOptions(e,{graph:n.graph}),U(Vf,this,i)),z(Gf,this)!==e&&(t.selectNode(e),U(Gf,this,e)),t.render({noRaf:!0})}function Yf(t,e,n){const i=Array.isArray(n)?n.length:0;if(!e||!i||i<2)return;const r=n.map(((t,e)=>t?`__SRC_TEXTURE:${e}`:null)).filter(Boolean),o=me.buildLayoutGraph({inputs:r}),s=o.signature;z(Vf,this)!==s&&(t.updateOptions(e,{graph:o.graph}),U(Vf,this,s)),z(Gf,this)!==e&&(t.selectNode(e),U(Gf,this,e)),t.render({noRaf:!0})}function Qf(t){const e=Number(t);return Number.isFinite(e)?e<=0?0:e>=1?1:e:0}me=Kf;class Jf extends $f{#S=null;#N=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=Qf(e),i=[{type:"opacity",inputs:[t[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",t[0]],options:{}}];return{type:Jf.type,signature:`${Jf.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=Qf((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.#S!==e){const n=Jf.buildLayoutGraph({inputs:["__SRC_TEXTURE:0"]});i.updateOptions(t,{graph:n.graph}),this.#S=e}this.#N!==t&&(i.selectNode(t),this.#N=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=Jf.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.#S===r&&this.#A===a||(i.updateOptions(o,{graph:n.graph}),this.#S=r,this.#A=a),this.#N!==o&&(i.selectNode(o),this.#N=o),i.render({noRaf:!0})}catch(t){}}}function Zf(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 tp(t){return!(!t||!0===t.offsetPending)&&Number.isFinite(t.offset)}function ep(t){return tp(t)?t.offset:void 0}function np(t,e,n,i={}){if(!t)return!1;const r=ep(t);if(!Number.isFinite(r))return!1;const o=Zf(t,n,i);return Number.isFinite(o)?e>=r&&e<r+o:e>=r}function ip(t=[]){if(!Array.isArray(t))return t;const e=[],n=[];return t.forEach((t=>{tp(t)?e.push(t):n.push(t)})),e.sort(((t,e)=>t.offset-e.offset)),t.splice(0,t.length,...e,...n),t}function rp(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=ep(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&&ip(t),{updated:a,resolvedPlacements:l}}function op(t){const e=Number(t);return Number.isFinite(e)?e:0}function sp(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 ap(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 lp(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 cp(t){const e=Number(t);return Number.isFinite(e)&&e>0?e:0}function up(t){return(null==t?void 0:t.id)||(null==t?void 0:t.nodeId)||null}function dp(t,e){return Array.isArray(t)&&e?t.findIndex((t=>up(t)===e)):-1}function hp(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=dp(e,n);return t>=0?(t+1)%i:0}if("prev"===t){const t=dp(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)?up(e[i]):null}function fp(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=ep(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)=>ep(t)-ep(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 pp(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 mp(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 gp(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(pp(n,r,t))return r}return null}function vp(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 yp extends $f{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=Qf(e),i=[{type:"opacity",inputs:[t[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",t[0]],options:{}}];return{type:yp.type,signature:`${yp.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:Qf(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&&(vp(a),a.activeRenderPlacementId=l);const c=null==r?void 0:r.initSwitching,u=fp(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=mp(a.placements,a.selectedPlacementId),i=hp(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=hp(Number.isInteger(t)&&t>=0?t:0,a.nodes,null);let n=null;if(e&&(n=gp(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&&pp(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=gp(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=cp(a.pendingSwitch.crossfadeSeconds),s=cp(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=Qf(t/a.switchDuration))}a.switchNormalizedTime=Number.isFinite(p)?p:void 0;const m=mp(a.placements,a.selectedPlacementId),g=pp(s,a.selectedPlacementId,m)||s[0];let v=null;if(Number.isFinite(a.switchNormalizedTime)&&a.previousPlacementId){const t=mp(a.placements,a.previousPlacementId),e=mp(a.placements,a.selectedPlacementId),n=pp(s,a.previousPlacementId,t),i=pp(s,a.selectedPlacementId,e);n&&i&&(v=[n,i])}return v||(v=g?[g]:s),v}static resetRenderState(t){t&&"object"==typeof t&&vp(t)}}const bp=[qf,Kf,Jf,yp],kp=new Map;function xp(t){if("string"!=typeof t)return null;const e=t.trim();return e?e.toLowerCase():null}function wp(t){const e=xp(t);return e&&kp.get(e)||null}function _p(t){return wp(t)||qf}bp.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=xp(e);n&&kp.set(n,t)}))}(t)));class Tp{static get defaultType(){return qf.type||"default"}static getRenderNodeClass(t){return wp(t)}static normalizeType(t){const e=wp(t);return e?e.type:null}static doesRenderNodeTypeRequireFrameCadence(t){const e=wp(t);return!!e&&!0===e.requiresFrameCadence}static buildLayoutGraph({type:t,inputs:e=[],normalizedTime:n}={}){const i=_p(t);return i&&"function"==typeof i.buildLayoutGraph?i.buildLayoutGraph({inputs:e,normalizedTime:n}):qf.buildLayoutGraph({inputs:e,normalizedTime:n})}static getPanAndScanTarget(t){const e=_p(t);return"post"===(n=null==e?void 0:e.panAndScanTarget)||"skip"===n?n:"pre";var n}static prepareRenderFrames({type:t,frames:e,timelineTime:n,timeline:i,active:r,renderNodeParams:o,state:s}={}){const a=_p(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=_p(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=_p(t);n&&"function"==typeof n.resetRenderState&&n.resetRenderState(e)}static resetAllRenderStates(t){t&&"function"==typeof t.forEach&&t.forEach(((t,e)=>{Tp.resetRenderState(e,t)}))}create(t,e){return t&&"function"==typeof t.render?t:new(_p(t))(e)}}function Ip(t){return Array.isArray(t)?t.filter((t=>t&&"string"==typeof t.type)):[]}function Ep(t,e){return t&&"function"==typeof t.getSignature?t.getSignature():(null==e?void 0:e.type)||"stage"}class Sp{#M;constructor(t){this.#M=t||new jf}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=Tp.normalizeType(null==t?void 0:t.layoutType)||Tp.defaultType,r=null==t?void 0:t.normalizedTime,o=Ip(null==t?void 0:t.preStages),s=Ip(null==t?void 0:t.postStages),a=[],l=[`layout:${i}`,`inputs:${e}`];let c=n;o.forEach(((e,n)=>{const i=this.#M.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(Ep(i,e))}));const u=Tp.buildLayoutGraph({type:i,inputs:c,normalizedTime:r}),d=!(null==u||!u.isDynamic);Array.isArray(null==u?void 0:u.graph)&&u.graph.length&&a.push(...u.graph),l.push((null==u?void 0:u.signature)||`${i}:${c.length}`);let h="__PREVIOUS:0";return s.forEach(((e,n)=>{const i=this.#M.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(Ep(i,e))})),{graph:a,signature:l.join("|"),isDynamic:d}}}const Np=[0,0,1,1],Ap="zoomInExposure",Mp=["transform","exposure","fadeToColor","dipToBlack"],Fp={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 Op(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}function Pp(t,e=Np){return Array.isArray(t)&&t.length>=4?t:e}function Cp(t){return"string"==typeof t&&t.trim()?t.trim():"#ffffff"}function Dp(t,e){const n=null==t?void 0:t[e];return!1===n||null==n?null:Hc(n)?n:{}}function Rp(t={}){let e=0;return Mp.forEach((n=>{const i=Dp(t,n);if(!i)return;const r=Op(null==i?void 0:i.duration);r>e&&(e=r)})),e}function Bp(t,e,n,i,r){const o=[];return Mp.forEach((s=>{const a=Dp(t,s);if(!a)return;const l=function(t,e,n){const i=Op(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=Pp(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=Pp(null==e?void 0:e.ease),n=(null==e?void 0:e.power)||{from:0,to:1};return o.options.properties.power={from:Op(null==n?void 0:n.from,0),to:Op(null==n?void 0:n.to,1),ease:t},o.options.properties.color=Cp((null==e?void 0:e.color)||r),o}if("exposure"===t||"dipToBlack"===t){const t=Pp(null==e?void 0:e.ease),n=(null==e?void 0:e.power)||{from:0,to:1};return o.options.properties.power={from:Op(null==n?void 0:n.from,0),to:Op(null==n?void 0:n.to,1),ease:t},o}return null}(s,a,e,l,r);c&&o.push(c)})),o}function Lp(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 zp{#F=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(Hc(null==t?void 0:t.transition))return t.transition;if("string"==typeof(null==t?void 0:t.transition))return Fp[t.transition]||Fp[Ap];if(Hc(null==t?void 0:t.filters)||Hc(null==t?void 0:t.reverseFilters))return{filters:t.filters||{},reverseFilters:t.reverseFilters||{}};if("string"==typeof(null==t?void 0:t.filter)){const e=Op(t.duration)>0?1e3*t.duration:500;return{filters:{[t.filter]:{duration:e,power:{from:0,to:1}}},reverseFilters:{}}}return Fp[Ap]}(t),n=Kc({},(null==e?void 0:e.filters)||{},Hc(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(Hc(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=Kc({},(null==e?void 0:e.reverseFilters)||{},Hc(null==t?void 0:t.reverseFilters)?t.reverseFilters:{});return{baseFilters:n,reverseFilters:Kc({},i,r)}}(t),r=Op(null==t?void 0:t.duration),o=r>0?1e3*r:null,s=Rp(n),a=Rp(i),l=o&&s>0?o/s:1,c=o&&a>0?o/a:1,u=o||s||500,d=o||a||u,h=Cp(null==t?void 0:t.color),f=e.captureTexture(),p=Date.now(),m=Bp(n,p,l,o,h);return this.#F={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:Lp(m),inGraph:null,inSignature:null},{captureId:f,outDurationMs:u,inDurationMs:d}}beginIncoming(){if(!this.#F)return;const t=Date.now(),e=Bp(this.#F.reverseFilters,t,this.#F.inScale,this.#F.durationOverrideMs,this.#F.color);this.#F={...this.#F,phase:"in",startTime:t,inGraph:e,inSignature:Lp(e)}}reset(t){var e;t&&"function"==typeof t.disposeTexture&&null!==(e=this.#F)&&void 0!==e&&e.captureId&&t.disposeTexture(this.#F.captureId),this.#F=null}getState(){return this.#F}buildOutgoingGraph(){const t=this.#F;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.#F;return t&&"in"===t.phase&&Array.isArray(t.inGraph)&&t.inGraph.length?{signature:`transition:in:${t.inSignature||""}`,forceUpdate:!1,graph:t.inGraph}:null}}let Wp;const Up=[/firefox\/(\d+)/,/edg\/(\d+)/,/opr\/(\d+)/,/chrome\/(\d+)/];function jp(){const t=eu&&eu.navigator&&(eu.navigator.userAgent||eu.navigator.platform||eu.navigator.vendor)||"";if(Wp&&Wp.ua===t)return Wp;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<Up.length;e+=1){const n=Up[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 Wp={ua:t,lowerUA:e,isAndroid:n,isiOS:i,isMobile:r,isDesktop:o,isFirefox:s,browserMajorVersion:a},Wp}function $p(){return jp().ua}function qp(){return jp().isAndroid}function Vp(){return jp().isiOS}function Gp(){return jp().isMobile}function Hp(){return jp().isDesktop}function Kp(){return jp().isFirefox}function Xp(){return jp().browserMajorVersion}var Yp={getUserAgent:$p,isAndroid:qp,isiOS:Vp,isMobile:Gp,isDesktop:Hp,isFirefox:Kp,getBrowserMajorVersion:Xp},Qp=Object.freeze({__proto__:null,default:Yp,getBrowserMajorVersion:Xp,getUserAgent:$p,isAndroid:qp,isDesktop:Hp,isFirefox:Kp,isMobile:Gp,isiOS:Vp});const Jp=Object.freeze({NODE_ADD:"node:add",NODE_CHILDREN_CHANGED:"node:childrenchanged",NODE_LOADED:"node:loaded",NODE_LOAD_ERROR:"node:loaderror",PLACEMENT_ADDED:"placement:added",RENDER_PLACEMENT_ADDED:"renderplacement:added",TIMELINE_TIME_UPDATE:"timeline:timeupdate",TIMELINE_STATE_CHANGE:"statechange",TIMELINE_SEEKING:"seeking",TIMELINE_SEEKED:"seeked",TIMELINE_RESET:"timeline:reset",TIMELINE_PLAYER_STATE:"player:state",TIMELINE_CUEPOINT:"cuepoint",VISUAL_FRAMES_AVAILABLE:"visualframesavailable",TRACK_BUFFER_UPDATE:"track:bufferupdate",TRACK_READY:"track:ready",TRACK_UNDERFLOW:"track:underflow",CLOCK_TICK:"tick",DECODE_READY:"decode:ready",DECODE_ERROR:"decode:error",DECODER_AUDIO:"decoder:audio",DECODER_FRAME:"decoder:frame",DECODER_INIT:"decoder:init",DECODER_ERROR:"decoder:error",QOE_SCORE:"qoescore",QOE_STATUS:"qoestatus",CONTAINER_RESIZE:"containerresize"});function Zp(t,e){const n={};return Number.isFinite(t)&&(n.time=t),"string"==typeof e&&(n.source=e),n}function tm({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 em({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}const nm="Idle",im="Playing",rm="Waiting",om="Paused",sm="Seeking",am="Resetting";function lm(t){return Array.isArray(t)?t.filter((t=>t&&"string"==typeof t.type)):[]}function cm(t,e){return!!Array.isArray(t)&&t.some((t=>(null==t?void 0:t.type)===e))}function um(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 dm(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 hm=2073600;function fm(t,e){const n=Number(t);return Number.isFinite(n)&&n>0?n:e}function pm(t,e){if(null==t)return e;const n=Number(t);return Number.isFinite(n)?n:e}var mm=new WeakMap,gm=new WeakMap,vm=new WeakMap,ym=new WeakMap,bm=new WeakMap,km=new WeakMap,xm=new WeakMap,wm=new WeakMap,_m=new WeakMap,Tm=new WeakMap,Im=new WeakMap,Em=new WeakMap,Sm=new WeakMap,Nm=new WeakMap,Am=new WeakMap,Mm=new WeakMap,Fm=new WeakMap,Om=new WeakMap,Pm=new WeakMap,Cm=new WeakMap,Dm=new WeakMap,Rm=new WeakMap,Bm=new WeakMap,Lm=new WeakMap,zm=new WeakMap,Wm=new WeakSet;class Um extends Jc{static get pipelineNodeId(){return"ekoplayer-render-pipeline"}get defaults(){return{defaultRenderParams:void 0,resourceLimits:{enabled:!0,maxCanvasPixels:hm,maxDevicePixelRatio:1,renderScale:1,transitionMinFrameIntervalMs:33}}}constructor(...t){super(...t),j(this,Wm),W(this,mm,void 0),W(this,gm,void 0),W(this,vm,void 0),W(this,ym,void 0),W(this,bm,void 0),W(this,km,void 0),W(this,xm,void 0),W(this,wm,void 0),W(this,_m,void 0),W(this,Tm,null),W(this,Im,null),W(this,Em,void 0),W(this,Sm,void 0),W(this,Nm,void 0),W(this,Am,[]),W(this,Mm,[]),W(this,Fm,null),W(this,Om,null),W(this,Pm,null),W(this,Cm,null),W(this,Dm,null),W(this,Rm,null),W(this,Bm,new Map),W(this,Lm,null),W(this,zm,null);const[e,n,i]=t;U(mm,this,e),U(gm,this,n),U(vm,this,i),U(_m,this,new Sp),U(Em,this,new zp),U(Sm,this,null),U(Nm,this,null),U(Pm,this,null),U(ym,this,(t=>B(Wm,this,mg).call(this,t))),z(mm,this)&&"function"==typeof z(mm,this).on&&(z(mm,this).on(Jp.VISUAL_FRAMES_AVAILABLE,z(ym,this)),U(bm,this,(()=>{var t,e,n,i;B(Wm,this,ug).call(this,0),U(Mm,this,[]),U(Fm,this,null),U(Tm,this,null),U(Im,this,null),B(Wm,this,tg).call(this),U(Lm,this,null);(null===(t=z(Em,this))||void 0===t||null===(e=t.getState)||void 0===e?void 0:e.call(t))||null===(n=z(Em,this))||void 0===n||null===(i=n.reset)||void 0===i||i.call(n,z(Sm,this))})),z(mm,this).on(Jp.TIMELINE_SEEKING,z(bm,this)),U(wm,this,(()=>B(Wm,this,rg).call(this))),z(mm,this).on(Jp.TIMELINE_TIME_UPDATE,z(wm,this)),U(km,this,(()=>{B(Wm,this,gg).call(this)&&z(Om,this)&&B(Wm,this,mg).call(this,z(Om,this))})),z(mm,this).on(Jp.TIMELINE_STATE_CHANGE,z(km,this))),U(xm,this,(()=>{U(Fm,this,null),z(Om,this)&&B(Wm,this,gg).call(this)&&B(Wm,this,mg).call(this,z(Om,this))})),z(vm,this)&&"function"==typeof z(vm,this).on&&z(vm,this).on(Jp.CONTAINER_RESIZE,z(xm,this))}get name(){return"Renderer"}onDispose(){z(mm,this)&&z(ym,this)&&"function"==typeof z(mm,this).off&&z(mm,this).off(Jp.VISUAL_FRAMES_AVAILABLE,z(ym,this)),z(mm,this)&&z(bm,this)&&"function"==typeof z(mm,this).off&&z(mm,this).off(Jp.TIMELINE_SEEKING,z(bm,this)),z(mm,this)&&z(wm,this)&&"function"==typeof z(mm,this).off&&z(mm,this).off(Jp.TIMELINE_TIME_UPDATE,z(wm,this)),z(mm,this)&&z(km,this)&&"function"==typeof z(mm,this).off&&z(mm,this).off(Jp.TIMELINE_STATE_CHANGE,z(km,this)),z(vm,this)&&z(xm,this)&&"function"==typeof z(vm,this).off&&z(vm,this).off(Jp.CONTAINER_RESIZE,z(xm,this)),B(Wm,this,jm).call(this),U(ym,this,null),U(bm,this,null),U(wm,this,null),U(km,this,null),U(xm,this,null),U(_m,this,null),U(Em,this,null),U(Bm,this,null),U(Lm,this,null),U(gm,this,null),U(vm,this,null),U(mm,this,null)}startTransition(t={}){var e;const n=null===(e=z(gm,this))||void 0===e?void 0:e.element;if(!n)return null;if(B(Wm,this,$m).call(this,n),!z(Sm,this))return null;const i=z(Em,this).start({shaderGraph:z(Sm,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 U(Pm,this,z(Om,this)||null),B(Wm,this,hg).call(this),i}beginTransitionIn(t={}){var e,n;null!==(e=z(Em,this))&&void 0!==e&&null!==(n=e.beginIncoming)&&void 0!==n&&n.call(e,t),U(Pm,this,null),B(Wm,this,hg).call(this)}resetTransition(){var t,e;null!==(t=z(Em,this))&&void 0!==t&&null!==(e=t.reset)&&void 0!==e&&e.call(t,z(Sm,this)),U(Pm,this,null),B(Wm,this,fg).call(this)}}function jm(){if(z(Em,this)&&"function"==typeof z(Em,this).reset&&z(Em,this).reset(z(Sm,this)),B(Wm,this,ug).call(this,0),z(Sm,this)&&"function"==typeof z(Sm,this).dispose)try{z(Sm,this).dispose()}catch(t){}U(Sm,this,null),U(Nm,this,null),U(Am,this,[]),U(Mm,this,[]),U(Fm,this,null),U(Tm,this,null),U(Im,this,null),U(Om,this,null),U(Pm,this,null),B(Wm,this,fg).call(this),B(Wm,this,tg).call(this),U(Lm,this,null)}function $m(t){if(z(Sm,this)||!t)return;const e=this,n={dest:t,src:(t,n)=>{U(Nm,e,n)}};U(Sm,e,new Lf(n,{userWillCallRender:!0,glOptions:{contextType:"webgl2"},performanceToggles:{useCanvasSizedFilterTargets:!0}})),z(Sm,e)&&"function"==typeof z(Sm,e).addNodes&&z(Sm,e).addNodes({[ge.pipelineNodeId]:{type:"composite",options:{graph:[]}}})}function qm(){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 Vm(){const t=B(Wm,this,qm).call(this).enabled;return!0===t||!1!==t&&Vp()}function Gm(){if(!B(Wm,this,Vm).call(this))return 0;const t=pm(B(Wm,this,qm).call(this).transitionMinFrameIntervalMs,33);return Number.isFinite(t)&&t>0?t:0}function Hm(t,e){if(!B(Wm,this,Vm).call(this))return{width:t,height:e};const n=B(Wm,this,qm).call(this),i=pm(n.maxCanvasPixels,hm),r=pm(n.maxDevicePixelRatio,1),o=fm(n.renderScale,1),s=fm(null==eu?void 0:eu.devicePixelRatio,1),a=o*(r>0?Math.min(s,r):s);let l=Math.max(1,Math.round(t*a)),c=Math.max(1,Math.round(e*a));if(i>0){const t=l*c;if(t>i){const e=Math.sqrt(i/t);l=Math.max(1,Math.floor(l*e)),c=Math.max(1,Math.floor(c*e))}}return{width:l,height:c}}function Km(t=[],e={}){var n;const i=null===(n=z(gm,this))||void 0===n?void 0:n.element,r=z(Nm,this);if(!i||"function"!=typeof r)return!1;let o=0,s=0;if(!0===(null==e?void 0:e.useViewportSize)){var a,l,c,u,d,h;const t=Number(null!==(a=null===(l=z(vm,this))||void 0===l?void 0:l.containerWidth)&&void 0!==a?a:null===(c=z(vm,this))||void 0===c?void 0:c.width),e=Number(null!==(u=null===(d=z(vm,this))||void 0===d?void 0:d.containerHeight)&&void 0!==u?u:null===(h=z(vm,this))||void 0===h?void 0:h.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 f;const n=null===(f=t[e])||void 0===f?void 0:f.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 p=B(Wm,this,Hm).call(this,o,s),m=p.width,g=p.height,v=z(Fm,this);return!(v&&v.width===m&&v.height===g||(U(Fm,this,{width:m,height:g}),r(null,null,m,g),0))}function Xm(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 Ym(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=B(Wm,this,Qm).call(this,t),s=B(Wm,this,Jm).call(this,o);return Tp.getRenderTiming({type:o,timing:{duration:i,normalizedTime:r},timelineTime:e,active:t,renderNodeParams:n,state:s})}function Qm(t){return Tp.normalizeType(null==t?void 0:t.type)||Tp.defaultType}function Jm(t){if(!t||!z(Bm,this))return null;let e=z(Bm,this).get(t);return e||(e={},z(Bm,this).set(t,e)),e}function Zm(t){if(!t||!z(Bm,this))return;const e=z(Bm,this).get(t);e&&Tp.resetRenderState(t,e),z(Bm,this).delete(t)}function tg(){z(Bm,this)&&(Tp.resetAllRenderStates(z(Bm,this)),z(Bm,this).clear())}function eg(t,e,n,i){const r=B(Wm,this,Qm).call(this,t);z(Lm,this)&&z(Lm,this)!==r&&B(Wm,this,Zm).call(this,z(Lm,this)),U(Lm,this,r);const o=B(Wm,this,Jm).call(this,r);return Tp.prepareRenderFrames({type:r,frames:e,timelineTime:n,timeline:z(mm,this),active:t,renderNodeParams:i,state:o})}function ng(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 ig(t){return t?String(t.renderPlacementId||t.type||"unknown"):"default"}function rg(){if(!z(mm,this)||!z(Om,this))return;const t=z(mm,this).currentTime,e=z(mm,this).getActiveRenderPlacement(t),n=B(Wm,this,ig).call(this,e);n!==z(zm,this)&&(U(zm,this,n),B(Wm,this,mg).call(this,{...z(Om,this),time:t}))}function og(t){return!t||"object"!=typeof t||!Object.prototype.hasOwnProperty.call(t,"panAndScan")||!1!==t.panAndScan}function sg(t,e){const n=B(Wm,this,ng).call(this,t),i=null==n?void 0:n.stages;let r=lm(null==i?void 0:i.pre),o=lm(null==i?void 0:i.post);const s=B(Wm,this,og).call(this,n),a=B(Wm,this,Qm).call(this,t),l=cm(r,"retarget")||cm(o,"retarget");if(s&&!l){const t=Tp.getPanAndScanTarget(a);if("pre"===t){const t=um(Array.isArray(e)?e.length:0);t&&(r=[t,...r])}else if("post"===t){const t=um(1);t&&(o=[...o,t])}}else s||(r=dm(r),o=dm(o));return{preStages:r,postStages:o,renderNodeParams:n}}function ag(t,e,n,i,r){const o=r||B(Wm,this,Ym).call(this,t,n,i),s=B(Wm,this,sg).call(this,t,e);return z(_m,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,timelineTime:n})}function lg(){var t,e;const n=null===(t=z(Em,this))||void 0===t||null===(e=t.getState)||void 0===e?void 0:e.call(t);return"out"===(null==n?void 0:n.phase)?z(Em,this).buildOutgoingGraph():"in"===(null==n?void 0:n.phase)?z(Em,this).buildIncomingGraph():null}function cg(t,e,n,i){const r=n||e!==z(Tm,this),o=r||i;r&&z(Sm,this)&&"function"==typeof z(Sm,this).updateOptions&&(z(Sm,this).updateOptions(ge.pipelineNodeId,{graph:t}),U(Tm,this,e)),z(Sm,this)&&"function"==typeof z(Sm,this).selectNode&&z(Im,this)!==ge.pipelineNodeId&&(z(Sm,this).selectNode(ge.pipelineNodeId),U(Im,this,ge.pipelineNodeId)),o&&z(Sm,this)&&"function"==typeof z(Sm,this).render&&z(Sm,this).render({noRaf:!0})}function ug(t){if(!Array.isArray(z(Am,this))||!z(Am,this).length)return;const e=Number.isFinite(t)?Math.max(0,t):0;if(!(z(Am,this).length<=e)){for(let t=e;t<z(Am,this).length;t+=1){const e=z(Am,this)[t];if(e&&z(Sm,this)&&"function"==typeof z(Sm,this).releaseTexture)try{z(Sm,this).releaseTexture(e)}catch(t){}}z(Am,this).length=e,z(Mm,this).length=e}}function dg(t=[]){if(!z(Sm,this)||"function"!=typeof z(Sm,this).addTexture)return!1;if("function"==typeof z(Sm,this).isContextUnavailable&&z(Sm,this).isContextUnavailable())return!1;if(!Array.isArray(t)||!t.length)return B(Wm,this,ug).call(this,0),!1;B(Wm,this,ug).call(this,t.length);let e=!1;for(let i=0;i<t.length;i+=1){var n;z(Am,this)[i]||"function"!=typeof z(Sm,this).addTexture||(z(Am,this)[i]=z(Sm,this).addTexture(null,"frame",i));const r=B(Wm,this,Xm).call(this,t[i]),o=null===(n=t[i])||void 0===n?void 0:n.frame;if(z(Am,this)[i]&&o&&(!r||r!==z(Mm,this)[i]))try{z(Am,this)[i].fill(o),z(Mm,this)[i]=r,e=!0}catch(t){}}return e}function hg(){if(z(Cm,this))return;const t="function"==typeof eu.requestAnimationFrame?t=>eu.requestAnimationFrame(t):t=>setTimeout(t,16),e="function"==typeof eu.cancelAnimationFrame?t=>eu.cancelAnimationFrame(t):clearTimeout;U(Dm,this,e);const n=()=>{var e,i;if(null!==(e=z(Em,this))&&void 0!==e&&null!==(i=e.getState)&&void 0!==i&&i.call(e)){if(z(Om,this)){const t=B(Wm,this,Gm).call(this),e=Date.now();(!t||!z(Rm,this)||e-z(Rm,this)>=t)&&(U(Rm,this,e),B(Wm,this,mg).call(this,z(Om,this)))}U(Cm,this,t(n))}else U(Cm,this,null)};U(Cm,this,t(n))}function fg(){z(Cm,this)&&z(Dm,this)&&z(Dm,this).call(this,z(Cm,this)),U(Cm,this,null),U(Dm,this,null),U(Rm,this,null)}function pg(t){var e,n;const i=null===(e=z(Em,this))||void 0===e||null===(n=e.getState)||void 0===n?void 0:n.call(e);return"out"===(null==i?void 0:i.phase)&&z(Pm,this)?z(Pm,this):t}function mg(t={}){var e,n;const i=null===(e=z(gm,this))||void 0===e?void 0:e.element,r=null===(n=z(gm,this))||void 0===n?void 0:n.gl;if(!i||!r)return;if(t&&U(Om,this,t),!B(Wm,this,gg).call(this))return;const o=B(Wm,this,pg).call(this,t),s=Number.isFinite(null==o?void 0:o.time)?o.time:void 0;if(!Number.isFinite(s))return;if(B(Wm,this,$m).call(this,i),!z(Sm,this))return;const a=z(mm,this)&&"function"==typeof z(mm,this).getActiveRenderPlacement?z(mm,this).getActiveRenderPlacement(s):void 0,l=B(Wm,this,ig).call(this,a);l!==z(zm,this)&&U(zm,this,l);const c=Array.isArray(null==o?void 0:o.frames)?o.frames:[],u=B(Wm,this,ng).call(this,a),d=B(Wm,this,og).call(this,u),h=B(Wm,this,eg).call(this,a,c,s,u),f=B(Wm,this,Ym).call(this,a,s,u),p=B(Wm,this,Km).call(this,h,{useViewportSize:d}),m=B(Wm,this,dg).call(this,h),g=B(Wm,this,ag).call(this,a,h,s,u,f),v=B(Wm,this,lg).call(this);let y=g.graph,b=g.signature,k=!!g.isDynamic;v&&Array.isArray(v.graph)&&v.graph.length&&(y=y.concat(v.graph),b=`${b}|${v.signature||"transition"}`,k=k||!!v.forceUpdate);const x=p||m||k||v&&Array.isArray(v.graph)&&v.graph.length;B(Wm,this,cg).call(this,y,b,k,x)}function gg(){var t;const e=null===(t=z(mm,this))||void 0===t?void 0:t.state;return e===nm||e===im||e===om}function vg(t){return"number"==typeof t&&Number.isFinite(t)&&t>0}function yg(t){return t&&"resource"===t.entryType&&t.transferSize>0&&t.duration>0&&t.responseEnd>=t.requestStart}function bg(t){return Array.isArray(t)&&0!==t.length?t.reduce(((t,e)=>t+e),0)/t.length:NaN}ge=Um;var kg=new WeakMap,xg=new WeakMap,wg=new WeakMap,_g=new WeakMap,Tg=new WeakSet;class Ig extends Jc{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),j(this,Tg),W(this,kg,void 0),W(this,xg,void 0),W(this,wg,void 0),W(this,_g,void 0),U(kg,this,!!(eu&&eu.navigator&&eu.navigator.connection)),U(xg,this,!(!eu||!eu.performance||"function"!=typeof eu.performance.getEntriesByType)),U(wg,this,B(Tg,this,Sg).call(this)),U(_g,this,B(Tg,this,Og).call(this))}guesstimate(){const t=B(Tg,this,Cg).call(this);this.log.debug("[guesstimate] Data:",t);const e=B(Tg,this,Pg).call(this,t),n=vg(e)?e:t.defaultKbps;return B(Tg,this,Ng).call(this,n),this.log.info(`[guesstimate] Result: ${n} kbps`),n}update(t){vg(t)&&B(Tg,this,Ng).call(this,t)}onDispose(){U(wg,this,void 0),U(_g,this,void 0)}}function Eg(){return Math.round(Date.now()/1e3)}function Sg(){try{if(!eu||!eu.localStorage||"function"!=typeof eu.localStorage.getItem)return}catch(t){return}const t=this.settings.persistentStorage.key,e=eu.localStorage.getItem(t);if(e)try{const t=JSON.parse(e),n=this.settings.persistentStorage.ttl,i=B(Tg,this,Eg).call(this)-t.timestamp;if("number"==typeof n&&n>=0&&i>n)return null;if(!vg(t.value))return;return t.value}catch(t){return}}function Ng(t){if(!vg(t))return;try{if(!eu||!eu.localStorage||"function"!=typeof eu.localStorage.setItem)return}catch(t){return}const e=this.settings.persistentStorage.key,n=JSON.stringify({value:t,timestamp:B(Tg,this,Eg).call(this)});try{eu.localStorage.setItem(e,n),U(wg,this,t)}catch(t){}}function Ag(){return eu&&eu.performance&&"function"==typeof eu.performance.getEntriesByType?bg(eu.performance.getEntriesByType("resource").filter(yg).map((t=>8*t.transferSize/t.duration))):NaN}function Mg(){if(!eu||!eu.navigator||!eu.navigator.connection)return NaN;const t=eu.navigator.connection.downlink;return vg(t)?1e3*t:NaN}function Fg(){if(!z(kg,this))return NaN;const t=eu.navigator.connection,e=t.effectiveType||t.type,n=this.settings.connectionType||{};return e&&Object.prototype.hasOwnProperty.call(n,e)?n[e]:NaN}function Og(){const t=this.settings.ua||{};return qp()?t.android:Vp()?t.ios:t.desktop}function Pg(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=>vg(t)));if(r.length===i.length)return this.log.debug("[#selectFromPriorities] Selected from priorities:",i,"with values:",r),bg(r)}return NaN}function Cg(){const t=this.settings.testOverrides||{},e=vg(t.resourceTiming)?t.resourceTiming:B(Tg,this,Ag).call(this),n=vg(t.downlink)?t.downlink:B(Tg,this,Mg).call(this),i=vg(t.persistentValue)?t.persistentValue:z(wg,this),r=vg(t.connectionType)?t.connectionType:B(Tg,this,Fg).call(this),o=vg(t.ua)?t.ua:z(_g,this);return{defaultKbps:this.settings.defaultKbps,resourceTiming:e,downlink:n,connectionType:r,persistentValue:i,ua:o}}const Dg=new Gc;function Rg(t){return"string"!=typeof t||0===t.length?[]:t.split(".").filter((t=>t.length>0))}function Bg(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 Lg(t){return null!==t&&"object"==typeof t}function zg(t,e,n){const i=Rg(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 Wg(t,e,n){if(!Lg(t))return t;const i=Rg(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}Lg(r[e])||(r[e]=Bg(i[t+1])?[]:{}),r=r[e]}return t}const Ug={get:(t,e)=>eu&&eu.eko?zg(eu.eko,t,e):e,set(t,e){if(eu)return eu.eko&&"object"==typeof eu.eko||(eu.eko={}),Wg(eu.eko,t,e),eu.eko}},jg=eu&&eu.performance,$g=jg&&"function"==typeof jg.now?()=>jg.now():()=>Date.now();function qg(){return"undefined"==typeof AbortController?null:new AbortController}function Vg(){const t=new Error("The operation was aborted");return t.name="AbortError",t.code="ABORT_ERR",t}function Gg(t,e){return!(!e||!e.aborted)||!!t&&("AbortError"===t.name||"ABORT_ERR"===t.code||20===t.code)}const Hg=2,Kg=100,Xg=2,Yg="runtime.downloadSpeedSamples",Qg=Vc("download","warn");function Jg(t){return new Promise((e=>{setTimeout(e,t)}))}function Zg(t){return t>=500}function tv(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 ev(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=Ug.get(r);t||(t=[],Ug.set(r,t)),t.push(s)}catch(t){}return s}async function nv(t,e={}){const{method:n="GET",headers:i,body:r,retries:o=Hg,retryDelay:s=Kg,backoffFactor:a=Xg,samplesTargetPath:l=Yg,fetch:c,loglevel:u="warn",cache:d,signal:h,onProgress:f,returnType:p="default"}=e;Qg.setLevel(u);const m=function(t){if(t)return t;if(eu&&"function"==typeof eu.fetch)return eu.fetch.bind(eu);throw new Error("fetch is not available in this environment")}(c);let g=0,v=s;for(;;){if(h&&h.aborted)throw Vg();const e=$g();try{const s=await m(t,{method:n,headers:i,body:r,cache:d,mode:"cors",signal:h});if(h&&h.aborted)throw Vg();if(!s.ok){if(g<o&&Zg(s.status)){g+=1,Qg.warn(`[${t}] Download attempt #${g} failed with status ${s.status}, retrying in ${v}ms...`),await Jg(v),v*=a;continue}Qg.error(`[${t}] Download attempt #${g} 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=$g();const u=tv(s),y="arrayBuffer"===p||"bytes"===p,b=y&&"function"==typeof f;let k,x,w,_,T,I=0;if(y&&s.body&&"function"==typeof s.body.getReader&&b){const t=s.body.getReader(),e=[];for(;;){if(h&&h.aborted)throw Vg();const{done:n,value:i}=await t.read();if(n)break;if(i&&i.length){const t=$g();Number.isFinite(_)||(_=t),T=t,e.push(i),I+=i.length,f({loaded:I,total:u||void 0,chunk:i})}}k=new Uint8Array(I);let n=0;e.forEach((t=>{k.set(t,n),n+=t.length})),c=$g()}else if(y){const t=await s.arrayBuffer();k=new Uint8Array(t),I=k.length,c=$g()}else"text"===p?(x=await s.text(),c=$g()):"json"===p&&(w=await s.json(),c=$g());if(h&&h.aborted)throw Vg();const E=y?k?k.length:I:("text"===p&&"string"==typeof x?x.length:0)||("json"===p&&w?JSON.stringify(w).length:0),S=u||E||0;let N=e,A=c;Number.isFinite(_)&&(N=_,Number.isFinite(T)&&(A=Math.max(T,c))),(!Number.isFinite(N)||!Number.isFinite(A)||A<N)&&(N=e,A=c);const M=Math.max(0,A-N),F=ev(S,M,N,A,l,t);try{Dg.trigger("download:sample",F)}catch(t){}const O={response:s,bytes:S,durationMs:M,kbps:F.kbps,startTime:F.startTime,endTime:F.endTime};if("default"===p)return O;if("arrayBuffer"===p||"bytes"===p){const t=k||new Uint8Array(await s.arrayBuffer());return"arrayBuffer"===p?t.buffer:t}return"text"===p?x:"json"===p?w:O}catch(e){if(Gg(e,h))throw"AbortError"===e.name?e:Vg();if(!(g<o)||e.status&&!Zg(e.status))throw Qg.error(`[${t}] Download attempt #${g} failed with error ${e}, no more retries.`),e;g+=1,Qg.warn(`[${t}] Download attempt #${g} failed with error ${e}, retrying in ${v}ms...`),await Jg(v),v*=a}}}const iv={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"]}},rv=Object.freeze(Object.entries(iv).reduce(((t,[e,n])=>(Object.prototype.hasOwnProperty.call(n,"default")&&(t[e]=n.default),t)),{})),ov=Vc("config","warn");function sv(t){return rv[t]}var av=new WeakMap,lv=new WeakMap,cv=new WeakMap,uv=new WeakMap,dv=new WeakMap,hv=new WeakSet;class fv extends Jc{get name(){return"DownloadSpeed"}get defaults(){return{alpha:.3,maxSamples:30,minBytesPerSample:1024,minDurationMs:5,maxSampleKbpsCap:void 0,ignoreCacheHits:!0,samplesPath:"runtime.downloadSpeedSamples",initialKbps:sv("initialKbps"),probeUrl:void 0,defaultKbps:2500}}constructor(...t){super(...t),j(this,hv),W(this,av,void 0),W(this,lv,void 0),W(this,cv,void 0),W(this,uv,void 0),W(this,dv,void 0),U(cv,this,[]),U(lv,this,0),U(av,this,B(hv,this,gv).call(this)),U(dv,this,qg()),U(uv,this,(t=>{B(hv,this,wv).call(this,t,"event")})),B(hv,this,vv).call(this),Dg.on("download:sample",z(uv,this)),B(hv,this,yv).call(this),this.log.debug(`[#constructor] Initial estimate: ${z(av,this)} kbps`)}getKbps(){return z(av,this)}addSample(t){B(hv,this,wv).call(this,t,"manual")}reset(){U(cv,this,[]),U(lv,this,0),U(av,this,B(hv,this,gv).call(this))}onDispose(){z(dv,this)&&z(dv,this).abort(),U(dv,this,null),Dg.off("download:sample",z(uv,this)),U(cv,this,[]),U(lv,this,0),U(av,this,void 0),U(uv,this,null)}}function pv(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 mv(t){if(!t||"object"!=typeof t)return null;const e=Number(t.bytes),n=Number(t.durationMs);let i=vg(t.kbps)?Number(t.kbps):NaN;return!vg(i)&&n>0&&vg(e)&&(i=8*e/n),vg(i)?e<=this.settings.minBytesPerSample||n<=this.settings.minDurationMs||B(hv,this,pv).call(this,t,e)?null:(vg(this.settings.maxSampleKbpsCap)&&i>this.settings.maxSampleKbpsCap&&(i=this.settings.maxSampleKbpsCap),{...t,bytes:e,durationMs:n,kbps:i}):null}function gv(){const t=this.settings.initialKbps;if(vg(t))return t;if("auto"===t)try{const t=(new Ig).guesstimate();if(vg(t))return t}catch(t){}return this.settings.defaultKbps}function vv(){const t=Ug.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)B(hv,this,wv).call(this,e[t],"replay",{emit:!1})}async function yv(){if(!this.settings.probeUrl||z(lv,this)>0)return;const t=z(dv,this)?z(dv,this).signal:void 0;if(!t||!t.aborted)try{await nv(this.settings.probeUrl,{cache:"no-store",samplesTargetPath:this.settings.samplesPath,signal:t})}catch(t){}}function bv(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 kv(t,e){if(!B(hv,this,bv).call(this,t)||!B(hv,this,bv).call(this,e))return 0;const n=Math.max(t.startTime,e.startTime);return Math.min(t.endTime,e.endTime)-n}function xv(t){if(!B(hv,this,bv).call(this,t))return t;const e=[];for(let n=0;n<z(cv,this).length;n+=1){const i=z(cv,this)[n];B(hv,this,bv).call(this,i)&&(B(hv,this,kv).call(this,t,i)>0&&e.push(i))}if(0===e.length)return t;U(cv,this,z(cv,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(!vg(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 B(hv,this,mv).call(this,a)}function wv(t,e,{emit:n=!0}={}){const i=B(hv,this,mv).call(this,t);if(!i)return;const r=B(hv,this,xv).call(this,i);if(!r)return;U(lv,this,z(lv,this)+1),z(cv,this).push(r),z(cv,this).length>this.settings.maxSamples&&z(cv,this).shift();const o=this.defaults.alpha,s="number"==typeof this.settings.alpha?this.settings.alpha:o,a=vg(z(av,this)),l=a?z(av,this):r.kbps,c=a||1!==z(lv,this)?s*r.kbps+(1-s)*l:r.kbps;U(av,this,c),this.log.debug(`[#ingestSample] Next estimate: ${c} kbps`),n&&this.trigger("download:speed",{kbps:z(av,this),sample:r,source:e,samplesCount:z(lv,this)})}class _v{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),vg(s)&&(this.bandwidth=s),vg(a)&&(this.timescale=a),vg(l)&&(this.sizeBytes=l),Object.assign(this,c)}}class Tv{#O=new Map;#P;#C;#D=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 _v?t:new _v(t))),this.representations=this.originalRepresentations.map((t=>t)),this.appliedFilters=[],this.loadAttempts=0,this.loadError=void 0}setRepresentationBuffer(t,e){t&&e&&this.#O.set(t,e)}setDownloadProgress(t,e){const n=Number(t);Number.isFinite(n)&&n>=0&&(this.#D=Math.max(this.#D,n));const i=Number(e);Number.isFinite(i)&&i>0&&(this.#R=i)}setChosenRepresentation(t){this.#P=t;const e=null==t?void 0:t.id;if(!(this.isInit||!e||this.#O.size<=1))for(const t of this.#O.keys())t!==e&&this.#O.delete(t)}setABRDecisionSnapshot(t){if(!t||"object"!=typeof t)return void(this.#C=void 0);const e={...t};Array.isArray(t.availableRepresentations)&&(e.availableRepresentations=t.availableRepresentations.map((t=>({...t})))),this.#C=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.#O.get(t)}get chosenRepresentation(){return this.#P}get abrDecision(){return this.#C}get arrayBuffer(){return this.#P?this.#O.get(this.#P.id):void 0}get retainedByteLength(){let t=0;for(const e of this.#O.values())e&&"number"==typeof e.byteLength&&(t+=e.byteLength);return t}get bufferedRatio(){var t;const e=vg(this.#R)?this.#R:null===(t=this.#P)||void 0===t?void 0:t.sizeBytes;return vg(e)?Math.min(1,Math.max(0,this.#D/e)):this.retainedByteLength>0?1:0}get isLoaded(){return this.retainedByteLength>0}evict(){this.#P=void 0,this.#C=void 0,this.#O.clear(),this.#D=0,this.#R=void 0}}class Iv{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 Ev(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 Sv(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=Ev(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 Nv=new Set(["video","audio","image","cue","data","bbox"]);class Av{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(!Nv.has(n))throw new Error(`Track type must be one of ${Array.from(Nv).join("|")}`);this.id=e,this.type=n,this.offset=i,this.duration=vg(r)?r:void 0,this.source=o,"cue"===n?(this._cues=a.map((t=>t instanceof Iv?t:new Iv(t))),this._segments=[]):(this._segments=s.map((t=>t instanceof Tv?t:new Tv(t))),this._cues=void 0)}get segments(){return this._segments.slice()}get cues(){if("cue"===this.type)return this._cues.slice()}get endTime(){if(vg(this.duration))return this.offset+this.duration;if(!this._segments.length)return;const t=this._segments.reduce(((t,e)=>{const n=vg(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:vg(null==t?void 0:t.duration)?t.duration:0,offset:vg(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 Sv(this._segments,t,e)}setSegments(t=[]){if("cue"===this.type)return;const e=Array.isArray(t)?t:[];this._segments=e.map((t=>t instanceof Tv?t:new Tv(t)))}}function Mv(t){return"string"==typeof t?t:t&&"object"==typeof t?t.nodeId||t.nodeIdOrRef||t.id:void 0}function Fv(t){const e=Mv(t);let n=1;if(t&&"object"==typeof t&&vg(t.weight)&&(n=t.weight),!e)throw new Error("Child entry requires a nodeId");return{nodeId:e,weight:n}}function Ov(t){return(Array.isArray(t)?t:[]).map((t=>Fv(t)))}function Pv(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 Cv(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 Dv(t,e){if(e)try{var n;return new URL(e,t||(null==eu||null===(n=eu.location)||void 0===n?void 0:n.href)||void 0).toString()}catch(t){return e}}const Rv=new Map;class Bv{static register(t,e){if(!t||"function"!=typeof e)throw new Error("ManifestFactory.register requires type and parser function");Rv.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=Bv.inferType(t);if(!e||!Rv.has(e))throw new Error("Unsupported manifest type");return Rv.get(e)(t)}}Bv.register("dash",(function(t={}){const{body:e,url:n}=t,i=function(){if(eu&&"function"==typeof eu.DOMParser)return new eu.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=Pv(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=Pv(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:Pv(a&&a.getAttribute("timescale"))||Pv(e&&e.getAttribute("timescale"),1)||1,startNumber:Pv(a&&a.getAttribute("startNumber"))||Pv(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=Pv(n.getAttribute("t")),s=Pv(n.getAttribute("d")),a=Pv(n.getAttribute("r"),0);if(!vg(s))continue;vg(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:Dv(n,Cv(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:Dv(n,Cv(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}})),Bv.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:vg(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=>vg(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+(vg(e.duration)?e.duration:0)),0),l=vg(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}})),Bv.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=vg(null==t?void 0:t.duration)?t.duration:30,i=vg(null==t?void 0:t.width)?t.width:void 0,r=vg(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};vg(i)&&vg(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 Lv=["video/mp4"];function zv(t){return Lv.includes(t.mime)}var Wv={name:"containers",fn:function(t=[]){return t.filter(zv)},isRelevantForTrack:function(t){return"video"===(null==t?void 0:t.type)}};const Uv=new(ve=new WeakMap,ye=new WeakSet,class extends Jc{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),j(this,ye),W(this,ve,void 0),U(ve,this,new Map)}onDispose(){z(ve,this)&&z(ve,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 B(ye,this,Gv).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 jv(){return!!(eu&&eu.navigator&&eu.navigator.mediaCapabilities&&"function"==typeof eu.navigator.mediaCapabilities.decodingInfo)}function $v(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 qv(t){return t?JSON.stringify(t):"invalid"}async function Vv(t){if(!this.settings.enabled||!B(ye,this,jv).call(this)||!t)return this.log.debug("[#queryCapabilities] Not supported, returning false",t),{supported:!1,smooth:!1,powerEfficient:!1};const e=B(ye,this,qv).call(this,t),n=z(ve,this).get(e);if(n)return n;let i;try{i=await eu.navigator.mediaCapabilities.decodingInfo(t)}catch(t){i={supported:!1,smooth:!1,powerEfficient:!1}}return this.log.debug("[#queryCapabilities] Config:",t,"\nDecoding info result:",i),z(ve,this).set(e,i),i}async function Gv(t){if(B(ye,this,Kv).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=B(ye,this,$v).call(this,t),n=await B(ye,this,Vv).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 Hv(){if(!Kp())return!1;const t=Xp();return!Number.isFinite(t)||t<150}function Kv(t){if(!B(ye,this,Hv).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 Xv=[],Yv=()=>!0;[Wv,{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 Uv.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:Yv;Xv.push({name:t,fn:e,isRelevantForTrack:i})}(t,e,{isRelevantForTrack:n})}));const Qv=Vc("Node","warn"),Jv={start:0,end:0},Zv=.001;function ty(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)<=Zv&&Math.abs(t.duration-n.duration)<=Zv))?{offset:n.start,duration:n.duration}:void 0}var ey=new WeakMap,ny=new WeakMap,iy=new WeakMap,ry=new WeakMap,oy=new WeakMap,sy=new WeakMap,ay=new WeakMap,ly=new WeakMap,cy=new WeakMap,uy=new WeakMap,dy=new WeakSet;class hy extends Gc{constructor(t={},e={}){super(),j(this,dy),W(this,ey,void 0),W(this,ny,void 0),W(this,iy,void 0),W(this,ry,void 0),W(this,oy,void 0),W(this,sy,void 0),W(this,ay,void 0),W(this,ly,void 0),W(this,cy,void 0),W(this,uy,[]);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,U(ay,this,!0===e.forceImageFallback),U(ey,this,e.abrSelector),U(ny,this,e.assetsDeliveryService),U(ry,this,vg(r)?r:void 0),U(oy,this,vg(o)?o:void 0),U(sy,this,vg(s)?s:void 0),U(ly,this,e&&"object"==typeof e.mediaHostRewriteMap?e.mediaHostRewriteMap:void 0),U(cy,this,vg(e.maxManifestLoadAttempts)?e.maxManifestLoadAttempts:1/0),this.manifestLoadAttempts=0,this.manifestLoadError=void 0,U(uy,this,Ov(l))}setChildren(t){const e=Ov(t);return B(dy,this,Ny).call(this,e,{emit:!0})}addChild(t){const e=Fv(t),n=z(uy,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 B(dy,this,Ny).call(this,n,{emit:!0})}removeChild(t){const e=Mv(t);if(!e)return this.children;const n=z(uy,this).filter((t=>(null==t?void 0:t.nodeId)!==e));return n.length===z(uy,this).length?this.children:B(dy,this,Ny).call(this,n,{emit:!0})}async load(t={}){const{loadingMode:e="full",signal:n}=t;Qv.info(`[load] [${this.id}] Loading node in '${e}' mode`);try{if(n&&n.aborted)throw Vg();"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})=>B(dy,this,Ty).call(this,t,e,n))),l=s?B(dy,this,Iy).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 B(dy,this,Iy).call(this,t.segment,t.track,n);if(n&&n.aborted)throw Vg();return this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:e}),this}catch(t){if(Gg(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(Qv.info(`[loadMediaSegmentsAtOffset] [${this.id}] Loading media segments at offset ${n}`),!Number.isFinite(n))return;const{signal:i}=e;if(i&&i.aborted)throw Vg();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(B(dy,this,Ty).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)<=Zv&&!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})=>B(dy,this,Iy).call(this,t,e,i)))),i&&i.aborted)throw Vg();this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:"segment-offset",offsetSeconds:n})}}async resolve(t={}){if("ready"===this.state)return this;if("resolving"===this.state)return z(iy,this);const{signal:e,manifestOverride:n}=t;if(e&&e.aborted)throw Vg();if(this.hasExceededManifestLoadAttempts()){const t=this.manifestLoadError||new Error("Manifest load retry limit reached");throw this.state="failed",this.error=t,t}const i=this.state;return this.state="resolving",this.error=void 0,U(iy,this,(async()=>{try{const t=await B(dy,this,Ey).call(this,{signal:e,manifestOverride:n});if(e&&e.aborted)throw Vg();let i=Bv.parse(t);return i=B(dy,this,yy).call(this,i),this.tracks=(i.tracks||[]).map((t=>t instanceof Av?t:new Av(t))),this.mainTrackId=i.mainTrackId||this.mainTrackId,this.metadata=i.metadata||this.metadata,B(dy,this,My).call(this),B(dy,this,Ay).call(this),await B(dy,this,Sy).call(this),this.state="ready",this}catch(t){if(Gg(t,e))throw this.state=i,this.error=void 0,t;throw this.state="failed",this.error=t,t}})()),z(iy,this)}evict(){this.tracks.forEach((t=>{(t.segments||[]).forEach((t=>{t.evict()}))}))}get children(){return z(uy,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?vg(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+=vg(e.retainedByteLength)?e.retainedByteLength:0}))})),t}get buffered(){if("ready"!==this.state)return Jv;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||!vg(e))return Jv;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 Jv;if(n.length===this.tracks.length&&n.every((({track:t,range:e})=>{const n=t.endTime,i=vg(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 Jv;const r=Math.min(i,e);return r>0?{start:0,end:r}:Jv}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(z(cy,this))||z(cy,this)<=0)return!1;if(!this.manifestLoadError)return!1;const t=Number(this.manifestLoadAttempts);return Number.isFinite(t)&&t>=z(cy,this)}}function fy(t){return function(t,e){if(!t||"string"!=typeof t)return t;if(!e||"object"!=typeof e)return t;const n=eu&&"function"==typeof eu.URL?eu.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,z(ly,this))}function py(){return z(ay,this)||void 0===eu.VideoDecoder}function my(){return this.manifestRef&&"object"==typeof this.manifestRef&&"assets-delivery-service"===this.manifestRef.type}function gy(t){if(!B(dy,this,my).call(this))return!1;if(!B(dy,this,py).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 vy(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 vg(n)?n:vg(z(ry,this))?z(ry,this):void 0}function yy(t){if(this.imageFallbackActive=!1,!B(dy,this,gy).call(this,t))return t;if(!z(ny,this)||"function"!=typeof z(ny,this).resolveImageOne)return t;const e=z(ny,this).resolveImageOne(this.manifestRef),n=B(dy,this,fy).call(this,null==e?void 0:e.url);if(!n)return t;const i={typeHint:"image",url:n,duration:B(dy,this,vy).call(this,t),width:z(oy,this),height:z(sy,this)},r=Bv.parse(i);return t&&"object"==typeof t.metadata&&!Array.isArray(t.metadata)&&(r.metadata=t.metadata),this.imageFallbackActive=!0,r}function by(){const t=Number(this.manifestLoadAttempts);this.manifestLoadAttempts=Number.isFinite(t)&&t>0?t+1:1,this.manifestLoadError=void 0}function ky(t){this.manifestLoadError=t||new Error("Manifest load failed")}function xy(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 wy(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 _y(t,e){t&&("function"!=typeof t.setLoadError?t.loadError=e||new Error("Segment load failed"):t.setLoadError(e))}async function Ty(t,e,n){const i=B(dy,this,xy).call(this,e);try{const i=e.representations.map((async i=>{const r=B(dy,this,fy).call(this,i.url),o=await nv(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(Gg(t,n))throw B(dy,this,wy).call(this,e,i),t;throw B(dy,this,_y).call(this,e,t),t}}async function Iy(t,e,n){const i=z(ey,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=B(dy,this,xy).call(this,t);try{const i=B(dy,this,fy).call(this,s.url),r=await nv(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(Gg(e,n))throw B(dy,this,wy).call(this,t,a),e;throw B(dy,this,_y).call(this,t,e),e}}async function Ey(t={}){const{signal:e,manifestOverride:n}=t;if(e&&e.aborted)throw Vg();B(dy,this,by).call(this);try{let t=this.manifestRef;if(n&&"object"==typeof n){if(B(dy,this,my).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=B(dy,this,fy).call(this,n.url);return{typeHint:n.typeHint,url:t,mimeType:n.mimeType,body:n.body,duration:z(ry,this),width:z(oy,this),height:z(sy,this)}}"string"==typeof n.url&&n.url&&(t=n)}if(t&&"object"==typeof t&&"assets-delivery-service"===t.type){if(!z(ny,this)||"function"!=typeof z(ny,this).resolveOne)throw new Error("AssetsDeliveryService is required for assets-delivery-service manifestRef");const n=await z(ny,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=B(dy,this,fy).call(this,n.url),o=n.mimeType,s=n.body;if(r||s||o)return{typeHint:i,url:r,mimeType:o,body:s,duration:z(ry,this),width:z(oy,this),height:z(sy,this)};throw new Error("AssetsDeliveryService returned unsupported manifest shape")}if(t&&"object"==typeof t){const e=B(dy,this,fy).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=B(dy,this,fy).call(this,n),r="object"==typeof t?t.typeHint:void 0,o="object"==typeof t?t.mimeType:void 0;if("image"===Bv.inferType({typeHint:r,url:i,mimeType:o})){const e="object"==typeof t&&vg(t.duration)?t.duration:z(ry,this);return{typeHint:"image",url:i,mimeType:o,duration:e,width:"object"==typeof t&&vg(t.width)?t.width:z(oy,this),height:"object"==typeof t&&vg(t.height)?t.height:z(sy,this)}}const s=await nv(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){throw B(dy,this,ky).call(this,t),t}}async function Sy(){const t=Xv.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=ty(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 Ny(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}(z(uy,this),t)||(U(uy,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 Ay(){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 My(){if(!Array.isArray(this.tracks)||!this.tracks.length)return;const t=this.duration;if(!vg(t))return;const e=[new Iv({name:"nodestart",timestamp:0,data:{id:this.id},isSticky:!0}),new Iv({name:"nodeend",timestamp:t,data:{id:this.id}})],n=new Av({id:`${this.id}-auto-cue`,type:"cue",cues:e,offset:0,duration:t});this.tracks.push(n)}var Fy=new WeakMap,Oy=new WeakMap,Py=new WeakMap,Cy=new WeakMap,Dy=new WeakSet;class Ry extends Jc{constructor(...t){super(...t),j(this,Dy),W(this,Fy,new Map),W(this,Oy,new Map),W(this,Py,void 0),W(this,Cy,void 0);const[e,n]=t;U(Py,this,e),U(Cy,this,n)}get name(){return"NodeRepository"}get defaults(){return{enabledRepFilters:["containers","force-video-codec","media-capabilities"],disabledTracks:sv("disabledTracks"),forceVideoCodec:sv("forceVideoCodec"),forceImageFallback:sv("forceImageFallback"),mediaHostRewriteMap:sv("mediaHostRewriteMap"),maxManifestLoadAttempts:3}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"get","list"])}onDispose(){z(Fy,this).forEach(((t,e)=>{const n=z(Oy,this).get(e);n&&t&&"function"==typeof t.off&&t.off(Jp.NODE_CHILDREN_CHANGED,n)})),z(Oy,this).clear(),z(Fy,this).clear()}add(t){const e=t instanceof hy?t:new hy(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:z(Py,this),assetsDeliveryService:z(Cy,this)});if(!e.id)throw new Error("NodeRepository.add requires node with id");if(z(Fy,this).has(e.id))throw new Error(`NodeRepository.add: node with id ${e.id} already exists`);return z(Fy,this).set(e.id,e),B(Dy,this,By).call(this,e),this.trigger(Jp.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 z(Fy,this).get(e)}list(){return Array.from(z(Fy,this).values())}}function By(t){if(!t||"function"!=typeof t.on||!t.id)return;const e=t=>{this.trigger(Jp.NODE_CHILDREN_CHANGED,t)};t.on(Jp.NODE_CHILDREN_CHANGED,e),z(Oy,this).set(t.id,e)}var Ly=new WeakMap,zy=new WeakMap,Wy=new WeakSet;class Uy extends Jc{constructor(...t){super(...t),j(this,Wy),W(this,Ly,void 0),W(this,zy,new Map);const[e]=t;U(Ly,this,e)}get name(){return"ABRSelector"}get defaults(){return{safetyMargin:.35,minBufferForUpgrade:5,minBufferCritical:1,hysteresisRatio:1.1,abrStrategy:sv("abrStrategy")}}select(t={}){var e;const{representations:n=[],bufferSeconds:i}=t;if(!Array.isArray(n)||0===n.length)return;const r=z(Ly,this)&&"function"==typeof z(Ly,this).getKbps?z(Ly,this).getKbps():void 0,o=B(Wy,this,jy).call(this,n[0]),s=z(zy,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)=>B(Wy,this,$y).call(this,t.bandwidth)-B(Wy,this,$y).call(this,e.bandwidth)));if("bottom"===a){const e=l[0];return B(Wy,this,Gy).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 B(Wy,this,Gy).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 B(Wy,this,Gy).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=vg(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),B(Wy,this,Gy).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=>B(Wy,this,$y).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&&vg(e.bandwidth)&&vg(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 B(Wy,this,Gy).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(){z(zy,this).clear(),U(Ly,this,null)}}function jy(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 $y(t){return vg(t)?t/1e3:0}function qy(t){return vg(t)?t/1e3:void 0}function Vy(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:B(Wy,this,qy).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:B(Wy,this,qy).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 Gy(t,e,n={}){if(!t)return;const i=B(Wy,this,Vy).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=B(Wy,this,jy).call(this,t);z(zy,this).set(r,t.id)}var Hy=new WeakMap,Ky=new WeakSet;class Xy extends Jc{constructor(...t){super(...t),j(this,Ky),W(this,Hy,void 0);const[e]=t;if(U(Hy,this,e),!z(Hy,this)||"function"!=typeof z(Hy,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(){U(Hy,this,null)}getPrioritizationSnapshot(t){const e=z(Hy,this).list();if(!e.length)return{orderedIds:[],reachableIds:[]};const{levels:n,weights:i}=B(Ky,this,Yy).call(this,e,t);return{orderedIds:B(Ky,this,Qy).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 Yy(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=vg(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 Qy(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 Jy(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 Zy(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 tb(t){return"string"==typeof t&&t.startsWith("cmaf:")}function eb(t){return"image"===(null==t?void 0:t.assetType)?"image":"ivd"}function nb(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 ib=new WeakMap,rb=new WeakMap,ob=new WeakSet;class sb extends Jc{constructor(...t){super(...t),j(this,ob),W(this,ib,void 0),W(this,rb,void 0);const[,e={}]=t;U(ib,this,"function"==typeof e.fetchFn?e.fetchFn:void 0),U(rb,this,qg())}get name(){return"AssetsDeliveryService"}get defaults(){return{assetsDeliveryServiceUrl:"https://assets.eko.com",profile:sv("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(!B(ob,this,lb).call(this,t))return;const e=Jy(t,this.settings.profile),n=function(t,e,n){const i=(t||"").replace(/\/$/,""),r=null==e?void 0:e.assetId,o=null==e?void 0:e.assetRevision;if(!i||"string"!=typeof r||"number"!=typeof o)return;const s=`${i}/image/${encodeURIComponent(r)}/${o}`,a=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 a?`${s}?${a}`:s}(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=>B(ob,this,lb).call(this,t)));if(!n.length)return[];const i=B(ob,this,ab).call(this,e);if(i&&i.aborted)return[];const r=[],o=this.settings.profile;n.forEach((t=>{if("image"!==eb(t))return;const e=this.resolveImageOne(t);e&&e.url&&r.push({manifestRef:Zy(t,e.encodeProfile),manifest:{typeHint:"image",url:e.url}})}));const s=n.filter((t=>"image"!==eb(t))).map((t=>function(t,e){const n=Jy(t,e);return{ref:t,profile:n,route:tb(n)?"dash":"ivd"}}(t,o))),a=B(ob,this,ub).call(this,s);for(const{refs:t,route:e}of a){if(i&&i.aborted)return r;const{url:n}=B(ob,this,db).call(this,t,e),o=await B(ob,this,hb).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:Zy(t,e),manifest:nb(i)})}))}return r}onDispose(){z(rb,this)&&z(rb,this).abort(),U(rb,this,null),U(ib,this,null)}}function ab(t){return t&&t.signal?t.signal:z(rb,this)?z(rb,this).signal:void 0}function lb(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 cb(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 ub(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=>{B(ob,this,cb).call(this,t.refs,this.settings.maxBatchSize).forEach((e=>{n.push({route:t.route,refs:e})}))})),n}function db(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 hb(t,e){return z(ib,this)?z(ib,this).call(this,t,e):await nv(t,{returnType:"json",method:(null==e?void 0:e.method)||"GET",signal:null==e?void 0:e.signal})}function fb({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 pb=(eu.requestAnimationFrame||eu.mozRequestAnimationFrame||eu.webkitRequestAnimationFrame||eu.msRequestAnimationFrame||(t=>eu.setTimeout(t,1e3/60))).bind(eu),mb=(eu.cancelAnimationFrame||eu.mozCancelAnimationFrame||eu.webkitCancelAnimationFrame||eu.msCancelAnimationFrame||(t=>eu.clearTimeout(t))).bind(eu),gb=Vc("ticker","warn");let vb,yb=[],bb=null,kb=$g();function xb(){kb=$g();const t=[];let e,n;for(n=yb.length-1;n>=0;--n)e=yb[n],kb>=e.lastTick+e.interval&&t.push(e);for(n=t.length-1;n>=0;--n)if(e=t[n],!e.stopped){e.lastTick=kb;try{e.callback()}catch(t){console&&"function"==typeof console.error?console.error(t):gb.error(t)}}vb=pb(xb)}function wb(){$g()-kb>=200&&(mb(vb),xb())}function _b(t){let e=-1;for(let n=0;n<yb.length;n+=1)if(yb[n].callback===t){e=n;break}return e}function Tb(t,e=0){if(!t||"function"!=typeof t||"number"!=typeof e||e<0)return void gb.error("[start] Invalid arguments given to start method.",arguments);const n=_b(t);return-1!==n?(gb.debug("[start] Callback already exists, overriding interval.",arguments),yb[n].interval=e,t):(yb.push({callback:t,interval:e,lastTick:$g()}),1===yb.length&&(vb=pb(xb),bb||(bb=eu.setInterval(wb,1e3))),t)}function Ib(t){const e=_b(t);-1!==e?(yb[e].stopped=!0,yb.splice(e,1),yb.length||(mb(vb),eu.clearInterval(bb),bb=null)):gb.debug("[stop] Callback not found, doing nothing.",arguments)}function Eb(t){return-1!==_b(t)}function Sb(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 gb.error("[createThrottler] Bad argument given to createThrottler, first argument must be a function.",arguments);gb.debug("[createThrottler] Creating a new throttler instance.",arguments);const s=[];function a(){gb.debug("[onThrottlerTick] Calling callback with "+s.length+" queued items.");const e=s.slice(0);s.length=0,Ib(a),t(e)}const l={push:function(t){gb.debug("[push] Queuing argument:",t),0===s.length&&Tb(a,e),s.push(t),o+=1,(o<=r||s.length>=i)&&a()},flush:function(){gb.debug("[flush] Flushing queue."),0!==s.length&&a()},dispose:function(){gb.debug("[dispose] Disposing of throttler.");const t=s.slice(0);return s.length=0,Ib(a),t}};return Object.defineProperty(l,"interval",{enumerable:!0,get:function(){return e},set:function(t){"number"==typeof t&&(e=t)}}),l}function Nb(t,e){if(t&&"function"==typeof t)return t.__tickerThrottler||(t.__tickerThrottler=Sb((function(){t()}),e)),"number"==typeof e&&(t.__tickerThrottler.interval=e),t.__tickerThrottler.push(),t.__tickerThrottler;gb.error("[scheduleExecution] Bad argument given to scheduleExecution, first argument must be a function.",arguments)}var Ab=new WeakMap,Mb=new WeakMap,Fb=new WeakMap,Ob=new WeakMap,Pb=new WeakMap,Cb=new WeakMap,Db=new WeakMap,Rb=new WeakMap,Bb=new WeakMap,Lb=new WeakMap,zb=new WeakMap,Wb=new WeakMap,Ub=new WeakMap,jb=new WeakMap,$b=new WeakMap,qb=new WeakMap,Vb=new WeakSet;class Gb extends Jc{constructor(...t){super(...t),j(this,Vb),W(this,Ab,void 0),W(this,Mb,void 0),W(this,Fb,void 0),W(this,Ob,void 0),W(this,Pb,[]),W(this,Cb,[]),W(this,Db,new Set),W(this,Rb,new Set),W(this,Bb,!1),W(this,Lb,void 0),W(this,zb,void 0),W(this,Wb,void 0),W(this,Ub,void 0),W(this,jb,void 0),W(this,$b,void 0),W(this,qb,void 0);const[e,n,i,r]=t;U(Ab,this,e),U(Mb,this,n),U(Fb,this,i),U(Ob,this,r),U(Lb,this,qg());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),U(qb,this,(()=>B(Vb,this,ik).call(this))),B(Vb,this,Yb).call(this),B(Vb,this,Xb).call(this)}get name(){return"NodeResolver"}get defaults(){return{maxConcurrent:5}}onDispose(){var t;z(Lb,this)&&z(Lb,this).abort(),U(Lb,this,null),z(Ob,this)&&"function"==typeof z(Ob,this).off&&z(Wb,this)&&z(Ob,this).off(Jp.PLACEMENT_ADDED,z(Wb,this)),z(Ob,this)&&"function"==typeof z(Ob,this).off&&z($b,this)&&z(Ob,this).off(Jp.TIMELINE_RESET,z($b,this)),z(Ab,this)&&"function"==typeof z(Ab,this).off&&z(Ub,this)&&z(Ab,this).off(Jp.NODE_ADD,z(Ub,this)),z(Ab,this)&&"function"==typeof z(Ab,this).off&&z(jb,this)&&z(Ab,this).off(Jp.NODE_CHILDREN_CHANGED,z(jb,this)),U(Wb,this,null),U(Ub,this,null),U(jb,this,null),U($b,this,null),U(Pb,this,[]),U(Cb,this,[]),z(Db,this).clear(),z(Rb,this).clear(),U(Bb,this,!1),U(zb,this,void 0),null!==(t=z(qb,this))&&void 0!==t&&t.__tickerThrottler&&z(qb,this).__tickerThrottler.dispose(),U(qb,this,null)}}function Hb(){return z(Lb,this)?z(Lb,this).signal:void 0}function Kb(){return this._disposed||z(Lb,this)&&z(Lb,this).signal.aborted}function Xb(){z(Ob,this)&&"function"==typeof z(Ob,this).on&&(U(Wb,this,(t=>{B(Vb,this,Jb).call(this,null==t?void 0:t.nodeId)})),z(Ob,this).on(Jp.PLACEMENT_ADDED,z(Wb,this)),U($b,this,(()=>B(Vb,this,Qb).call(this))),z(Ob,this).on(Jp.TIMELINE_RESET,z($b,this))),z(Ab,this)&&"function"==typeof z(Ab,this).on&&(U(Ub,this,(({node:t})=>{(null==t?void 0:t.id)&&B(Vb,this,Jb).call(this,t.id,{fromRepoAdd:!0})})),z(Ab,this).on(Jp.NODE_ADD,z(Ub,this)),U(jb,this,(()=>{Nb(z(qb,this),100)})),z(Ab,this).on(Jp.NODE_CHILDREN_CHANGED,z(jb,this)))}function Yb(){const t=z(Ob,this)&&Array.isArray(z(Ob,this).placements)?z(Ob,this).placements:[];t.forEach((t=>B(Vb,this,Jb).call(this,t.nodeId)));const e=t.length?t[t.length-1]:void 0;e&&e.nodeId&&U(zb,this,e.nodeId)}function Qb(){z(Lb,this)&&z(Lb,this).abort(),U(Lb,this,qg()),U(Pb,this,[]),U(Cb,this,[]),z(Db,this).clear(),U(Bb,this,!1),U(zb,this,void 0)}function Jb(t,{fromRepoAdd:e=!1}={}){B(Vb,this,Kb).call(this)||t&&(z(Rb,this).has(t)||z(Db,this).has(t)||(z(Pb,this).push(t),z(zb,this)||e||U(zb,this,t),!z(Bb,this)&&e||B(Vb,this,Zb).call(this)))}function Zb(){if(z(Bb,this))return void B(Vb,this,tk).call(this);if(0===z(Pb,this).length)return;U(Bb,this,!0);const t=z(Pb,this).shift();B(Vb,this,rk).call(this,t).finally((()=>{B(Vb,this,tk).call(this)}))}async function tk(){if(!B(Vb,this,Kb).call(this))for(z(Pb,this).length||z(Cb,this).length||U(Cb,this,B(Vb,this,ek).call(this));z(Db,this).size<this.settings.maxConcurrent;){const t=this.settings.maxConcurrent-z(Db,this).size;if(t<=0)break;const e=[];for(;e.length<t&&(z(Pb,this).length||z(Cb,this).length);){let t=z(Pb,this).shift();t||(t=z(Cb,this).shift()),t&&e.push(t)}if(!e.length)break;const n=B(Vb,this,ok).call(this,e);n.length&&z(Fb,this)&&"function"==typeof z(Fb,this).resolve&&B(Vb,this,sk).call(this,n).finally((()=>B(Vb,this,tk).call(this))),e.filter((t=>!n.find((e=>e.nodeId===t)))).forEach((t=>{B(Vb,this,rk).call(this,t).finally((()=>B(Vb,this,tk).call(this)))}))}}function ek(){const t=new Set([...z(Rb,this),...z(Db,this),...z(Pb,this)]);return B(Vb,this,nk).call(this,t)}function nk(t){const e=z(Ob,this)&&Array.isArray(z(Ob,this).placements)?z(Ob,this).placements:[],n=(e.length?e[e.length-1].nodeId:void 0)||z(zb,this);return fb({prioritizer:z(Mb,this),repository:z(Ab,this),startNodeId:n,pendingIds:t,fallbackToRepository:!1})}function ik(){B(Vb,this,Kb).call(this)||(z(Bb,this)||0!==z(Pb,this).length)&&(U(Cb,this,B(Vb,this,ek).call(this)),z(Bb,this)&&B(Vb,this,tk).call(this))}async function rk(t,e){if(!t||z(Rb,this).has(t)||z(Db,this).has(t))return;const n=B(Vb,this,Hb).call(this);if(n&&n.aborted)return;const i=z(Ab,this)&&"function"==typeof z(Ab,this).get?z(Ab,this).get(t):void 0;if(i&&"function"==typeof i.resolve)if("function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts())z(Rb,this).add(t);else{z(Db,this).add(t);try{const r={signal:n};e&&(r.manifestOverride=e),await i.resolve(r),z(Rb,this).add(t)}catch(e){if(Gg(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()&&z(Rb,this).add(t)}finally{z(Db,this).delete(t)}}}function ok(t){const e=[];return t.forEach((t=>{const n=z(Ab,this)&&"function"==typeof z(Ab,this).get?z(Ab,this).get(t):void 0;n&&n.manifestRef&&"assets-delivery-service"===n.manifestRef.type&&e.push({nodeId:t,ref:n.manifestRef})})),e}async function sk(t){const e=B(Vb,this,Hb).call(this);if(!e||!e.aborted){t.forEach((({nodeId:t})=>z(Db,this).add(t)));try{const n=t.map((t=>t.ref)),i=await z(Fb,this).resolve(n,{signal:e});t.forEach((({nodeId:t,ref:e})=>{var n;const r=z(Ab,this)&&"function"==typeof z(Ab,this).get?z(Ab,this).get(t):void 0;if(z(Db,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?B(Vb,this,ak).call(this,o.manifest,s):void 0;B(Vb,this,rk).call(this,t,a)}))}catch(n){Gg(n,e)||this.log.warn(`NodeResolver ADS batch failed: ${(null==n?void 0:n.message)||n}`),t.forEach((({nodeId:t})=>z(Db,this).delete(t)))}}}function ak(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 lk=.001,ck="priority";function uk(t){const e=Number(t);return Number.isFinite(e)?e:0}var dk=new WeakMap,hk=new WeakMap,fk=new WeakMap,pk=new WeakMap,mk=new WeakMap,gk=new WeakMap,vk=new WeakMap,yk=new WeakMap,bk=new WeakMap,kk=new WeakMap,xk=new WeakMap,wk=new WeakMap,_k=new WeakMap,Tk=new WeakMap,Ik=new WeakMap,Ek=new WeakMap,Sk=new WeakMap,Nk=new WeakMap,Ak=new WeakMap,Mk=new WeakSet;class Fk extends Jc{constructor(...t){super(...t),j(this,Mk),W(this,dk,void 0),W(this,hk,void 0),W(this,fk,void 0),W(this,pk,new Map),W(this,mk,new Map),W(this,gk,[]),W(this,vk,new Set),W(this,yk,new Map),W(this,bk,!1),W(this,kk,void 0),W(this,xk,void 0),W(this,wk,void 0),W(this,_k,void 0),W(this,Tk,void 0),W(this,Ik,void 0),W(this,Ek,void 0),W(this,Sk,!1),W(this,Nk,[]),W(this,Ak,void 0);const[e,n,i]=t;U(dk,this,e),U(hk,this,n),U(fk,this,i),U(xk,this,qg()),U(Ak,this,(()=>B(Mk,this,ax).call(this))),B(Mk,this,jk).call(this)}get name(){return"SegmentLoadCoordinator"}get defaults(){return{maxConcurrentLoads:3,maxSegmentLoadAttempts:3}}onDispose(){var t;z(xk,this)&&z(xk,this).abort(),U(xk,this,null),z(yk,this).size&&z(yk,this).forEach((t=>{(null==t?void 0:t.controller)&&t.controller.abort()})),z(yk,this).clear(),z(fk,this)&&"function"==typeof z(fk,this).off&&(z(wk,this)&&z(fk,this).off(Jp.PLACEMENT_ADDED,z(wk,this)),z(Tk,this)&&z(fk,this).off(Jp.TIMELINE_SEEKING,z(Tk,this)),z(Ik,this)&&z(fk,this).off(Jp.TIMELINE_SEEKED,z(Ik,this)),z(Ek,this)&&z(fk,this).off(Jp.TIMELINE_RESET,z(Ek,this))),z(dk,this)&&"function"==typeof z(dk,this).off&&z(_k,this)&&z(dk,this).off(Jp.NODE_CHILDREN_CHANGED,z(_k,this)),U(wk,this,null),U(_k,this,null),U(Tk,this,null),U(Ik,this,null),U(Ek,this,null),z(pk,this).clear(),z(mk,this).clear(),U(gk,this,[]),z(vk,this).clear(),z(yk,this).clear(),U(bk,this,!1),U(kk,this,void 0),U(Sk,this,!1),U(Nk,this,[]),null!==(t=z(Ak,this))&&void 0!==t&&t.__tickerThrottler&&z(Ak,this).__tickerThrottler.dispose(),U(Ak,this,null)}}function Ok(){return z(xk,this)?z(xk,this).signal:void 0}function Pk(){return this._disposed||z(xk,this)&&z(xk,this).signal.aborted}function Ck(){const t=Number(this.settings.maxSegmentLoadAttempts);return Number.isFinite(t)&&t>0?t:1/0}function Dk(t){const e=B(Mk,this,Ck).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 Rk(t){if(!t)return!1;if(B(Mk,this,Dk).call(this,t))return!0;if("boolean"==typeof t.isLoaded)return t.isLoaded;const e=Number(t.retainedByteLength);return Number.isFinite(e)&&e>0}function Bk(t,{allowSeekKeep:e=!1,segmentOffset:n}={}){const i=qg(),r=i?i.signal:B(Mk,this,Ok).call(this);return t&&z(yk,this).set(t,{controller:i,allowSeekKeep:!!e,segmentOffset:n}),{signal:r,controller:i}}function Lk(t,e,n={}){const i=z(yk,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 zk(t,e){const n=z(yk,this).get(t);n&&(e&&n.controller!==e||z(yk,this).delete(t))}function Wk(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=z(dk,this)&&"function"==typeof z(dk,this).get?z(dk,this).get(i):void 0;if(!r)return;const o=B(Mk,this,Qk).call(this,r,t,e);Number.isFinite(o)&&n.add(`${i}:${o}`)})),n}function Uk(t){z(yk,this).size&&z(yk,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 jk(){z(fk,this)&&"function"==typeof z(fk,this).on&&(U(wk,this,(t=>{B(Mk,this,Gk).call(this,t)})),z(fk,this).on(Jp.PLACEMENT_ADDED,z(wk,this)),U(Tk,this,(t=>B(Mk,this,$k).call(this,t))),z(fk,this).on(Jp.TIMELINE_SEEKING,z(Tk,this)),U(Ik,this,(t=>B(Mk,this,qk).call(this,t))),z(fk,this).on(Jp.TIMELINE_SEEKED,z(Ik,this)),U(Ek,this,(()=>B(Mk,this,Vk).call(this))),z(fk,this).on(Jp.TIMELINE_RESET,z(Ek,this))),z(dk,this)&&"function"==typeof z(dk,this).on&&(U(_k,this,(()=>{Nb(z(Ak,this),100)})),z(dk,this).on(Jp.NODE_CHILDREN_CHANGED,z(_k,this)))}function $k(t={}){if(B(Mk,this,Pk).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=B(Mk,this,Wk).call(this,n,e);B(Mk,this,Uk).call(this,i),U(Sk,this,!0),U(Nk,this,n.map((t=>{const n=null==t?void 0:t.nodeId;if(n)return{nodeId:n,placement:t,targetTime:e}})).filter(Boolean)),setTimeout((()=>B(Mk,this,Kk).call(this)),0)}function qk(t={}){var e,n;if(B(Mk,this,Pk).call(this))return;U(Sk,this,!1),U(Nk,this,[]);const i=Number.isFinite(null==t?void 0:t.targetTime)?Number(t.targetTime):Number(null===(e=z(fk,this))||void 0===e?void 0:e.currentTime);(Array.isArray(null===(n=z(fk,this))||void 0===n?void 0:n.placements)?z(fk,this).placements:[]).forEach((t=>{if(!t)return;const e=ep(t);if(Number.isFinite(e)){if(Number.isFinite(i)){if(e>=i)return void B(Mk,this,Gk).call(this,t);const n=Zf(t,z(dk,this));return Number.isFinite(n)?void(e+n>i&&B(Mk,this,Gk).call(this,t)):void(e<=i&&B(Mk,this,Gk).call(this,t))}B(Mk,this,Gk).call(this,t)}})),setTimeout((()=>B(Mk,this,Kk).call(this)),0)}function Vk(){z(xk,this)&&z(xk,this).abort(),U(xk,this,qg()),z(yk,this).size&&z(yk,this).forEach((t=>{(null==t?void 0:t.controller)&&t.controller.abort()})),z(yk,this).clear(),z(pk,this).clear(),z(mk,this).clear(),U(gk,this,[]),z(vk,this).clear(),U(bk,this,!1),U(kk,this,void 0),U(Sk,this,!1),U(Nk,this,[])}function Gk(t){if(B(Mk,this,Pk).call(this))return;const e=null==t?void 0:t.nodeId;if(!e)return;const n=z(pk,this).get(e);if(n){const i=ep(n),r=ep(t);Number.isFinite(i)?Number.isFinite(r)&&r<i&&z(pk,this).set(e,t):Number.isFinite(r)&&z(pk,this).set(e,t)}else z(pk,this).set(e,t);const i=z(kk,this);U(kk,this,e),i&&i!==e&&U(gk,this,[]),z(bk,this)?setTimeout((()=>B(Mk,this,Kk).call(this)),0):B(Mk,this,Hk).call(this)}function Hk(){z(bk,this)||z(pk,this).size&&(U(bk,this,!0),B(Mk,this,Kk).call(this))}async function Kk(){if(B(Mk,this,Pk).call(this))return;if(z(vk,this).size>=this.settings.maxConcurrentLoads)return;if(z(Sk,this))return void(z(Nk,this).length&&B(Mk,this,Xk).call(this));const t=B(Mk,this,tx).call(this);if(t.hasPending)B(Mk,this,ex).call(this,t);else for(z(gk,this).length||U(gk,this,B(Mk,this,ox).call(this));z(vk,this).size<this.settings.maxConcurrentLoads&&z(gk,this).length;){const t=z(gk,this).shift();B(Mk,this,lx).call(this,t,"partial").finally((()=>{setTimeout((()=>B(Mk,this,Kk).call(this)),0)}))}}function Xk(){if(B(Mk,this,Pk).call(this))return;const t=Math.max(0,this.settings.maxConcurrentLoads-z(vk,this).size);if(!t||!z(Nk,this).length)return;const e=[],n=[];for(let i=0;i<z(Nk,this).length;i+=1){const r=z(Nk,this)[i];(null==r?void 0:r.nodeId)&&(e.length<t&&!z(vk,this).has(r.nodeId)?e.push(r):n.push(r))}U(Nk,this,n),e.forEach((t=>{B(Mk,this,Yk).call(this,t).finally((()=>{setTimeout((()=>B(Mk,this,Kk).call(this)),0)}))}))}async function Yk(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(z(vk,this).has(e))return;const{signal:r,controller:o}=B(Mk,this,Bk).call(this,e);if(r&&r.aborted)B(Mk,this,zk).call(this,e,o);else{z(vk,this).add(e);try{const t=z(dk,this)&&"function"==typeof z(dk,this).get?z(dk,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=B(Mk,this,Qk).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}`),B(Mk,this,Lk).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){Gg(t,r)||this.log.warn(`[#loadSeekWork] SegmentLoadCoordinator failed to seek-load node ${e}: ${(null==t?void 0:t.message)||t}`)}finally{z(vk,this).delete(e),B(Mk,this,zk).call(this,e,o)}}}function Qk(t,e,n){var i;const r=ep(e);if(!Number.isFinite(r))return;const o=uk(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=uk(null===(i=l)||void 0===i?void 0:i.offset),d=Sv(c,Math.max(0,s-u),{preferRepresentationTime:!0}),h=Number(null==d?void 0:d.offset);return Number.isFinite(h)?h:void 0}function Jk(t,e,n=(t=>null===(t=z(fk,this))||void 0===t?void 0:t.currentTime)()){var i;const r=(Array.isArray(null===(i=z(fk,this))||void 0===i?void 0:i.placements)?z(fk,this).placements:[]).filter((e=>(null==e?void 0:e.nodeId)===t&&Number.isFinite(ep(e)))).sort(((t,e)=>ep(t)-ep(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=ep(e);if(!Number.isFinite(n))continue;const i=Zf(e,z(dk,this)),l=Number.isFinite(i)&&i>=0;(!a&&n>=o-lk&&(a=e),l)?o+lk>=n&&o<n+i-lk&&(s=e):o+lk>=n&&(s=e)}return s||a||r[r.length-1]}function Zk(t,e){var n;const i=Number(ep(e));if(!Number.isFinite(i))return;const r=Zf(e,z(dk,this)),o=Number.isFinite(r)&&r>=0?i+r:void 0,s=(Array.isArray(null===(n=z(fk,this))||void 0===n?void 0:n.placements)?z(fk,this).placements:[]).filter((e=>(null==e?void 0:e.nodeId)===t&&Number.isFinite(ep(e)))).sort(((t,e)=>ep(t)-ep(e)));for(let t=0;t<s.length;t+=1){const e=s[t],n=Number(ep(e));if(Number.isFinite(n)&&!(n<=i+lk)){if(Number.isFinite(o)&&n>o+lk)return;return e}}}function tx(){const t=[];let e=!1,n=1/0;if(z(pk,this).forEach(((i,r)=>{if(!r||!i)return;const o=z(mk,this).get(r);if(o)return e=!0,void(n=Math.min(n,uk(o.timelineStart)));const s=B(Mk,this,nx).call(this,r,i);s&&(e=!0,n=Math.min(n,uk(s.timelineStart)),t.push(s))})),!e||!Number.isFinite(n))return{hasPending:!1,waveTime:void 0,startable:[]};const i=t.filter((t=>uk(t.timelineStart)===n&&!z(vk,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 ex({waveTime:t,startable:e}){const n=Math.max(0,this.settings.maxConcurrentLoads-z(vk,this).size);n&&e.length&&e.slice(0,n).forEach((e=>{B(Mk,this,rx).call(this,e,t).finally((()=>{setTimeout((()=>B(Mk,this,Kk).call(this)),0)}))}))}function nx(t,e){var n,i;const r=z(dk,this)&&"function"==typeof z(dk,this).get?z(dk,this).get(t):void 0;if(!r)return;if("function"==typeof r.hasExceededManifestLoadAttempts&&r.hasExceededManifestLoadAttempts())return void z(pk,this).delete(t);const o=B(Mk,this,Jk).call(this,t,e,null===(n=z(fk,this))||void 0===n?void 0:n.currentTime),s=Number(ep(o)),a=uk(null===(i=z(fk,this))||void 0===i?void 0:i.currentTime),l="function"==typeof r.loadMediaSegmentsAtOffset,c="function"==typeof r.load;if(!l&&!c)return void z(pk,this).delete(t);if(r.isLoaded)return void z(pk,this).delete(t);if("ready"!==r.state){if(!Number.isFinite(s))return;return{nodeId:t,segmentOffset:0,timelineStart:s}}if(!B(Mk,this,cx).call(this,r))return void z(pk,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&&!B(Mk,this,Rk).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/lk)*lk;h.add(t)}}))}));const f=Array.from(h).sort(((t,e)=>t-e)),p=e=>{const n=Number(ep(e));if(!Number.isFinite(n))return{status:"none"};const i=uk(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+lk;t+=1)s=t;const l=f.slice(s);if(!l.some((t=>B(Mk,this,ix).call(this,r,t))))return{status:f.slice(0,s).some((t=>B(Mk,this,ix).call(this,r,t)))?"beforeOnly":"none"};const c=l.find((t=>B(Mk,this,ix).call(this,r,t))),u=Math.max(0,uk(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};z(pk,this).delete(t)}else{const e=B(Mk,this,Zk).call(this,t,o);if(e){const t=p(e);if("work"===t.status)return t.work}}}function ix(t,e){const n=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[],i=uk(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)<=lk&&!B(Mk,this,Rk).call(this,t)}))))}async function rx(t,e){const n=null==t?void 0:t.nodeId,i=null==t?void 0:t.segmentOffset;if(this.log.debug(`[#loadP0Work] Loading ${ck} node [${n}] at segmentOffset=${i} wave=${e}`),!n)return;const r=z(dk,this)&&"function"==typeof z(dk,this).get?z(dk,this).get(n):void 0;if(!r)return void z(pk,this).delete(n);const o="function"==typeof r.loadMediaSegmentsAtOffset&&Number.isFinite(i),{signal:s,controller:a}=B(Mk,this,Bk).call(this,n,{allowSeekKeep:o,segmentOffset:i});if(s&&s.aborted)B(Mk,this,zk).call(this,n,a);else{z(vk,this).add(n),z(mk,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(Gg(t,s))return;const e=`[#loadP0Work] SegmentLoadCoordinator failed to load ${ck} work for node ${n}: ${(null==t?void 0:t.message)||t}`;this.log.warn(e)}finally{this.log.debug(`[#loadP0Work] Finished ${ck} work for node [${n}]`),z(mk,this).delete(n),z(vk,this).delete(n),B(Mk,this,zk).call(this,n,a)}}}function ox(){const t=new Set([...z(pk,this).keys(),...z(vk,this)]),e=B(Mk,this,sx).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&&B(Mk,this,ux).call(this,t));if(i){const e=fb({prioritizer:z(hk,this),repository:z(dk,this),startNodeId:z(kk,this),prioritizedIds:n,pendingIds:t,allowedIds:i,filter:r});if(e.length)return e}return fb({prioritizer:z(hk,this),repository:z(dk,this),startNodeId:z(kk,this),prioritizedIds:n,pendingIds:t,filter:r})}function sx(){return z(hk,this)&&z(kk,this)?"function"==typeof z(hk,this).getPrioritizationSnapshot?z(hk,this).getPrioritizationSnapshot(z(kk,this)):{orderedIds:"function"==typeof z(hk,this).sortNodes?z(hk,this).sortNodes(z(kk,this)):[],reachableIds:"function"==typeof z(hk,this).getReachableNodeIds?z(hk,this).getReachableNodeIds(z(kk,this)):[]}:null}function ax(){B(Mk,this,Pk).call(this)||(z(bk,this)||z(pk,this).size)&&(U(gk,this,B(Mk,this,ox).call(this)),z(bk,this)&&!z(Sk,this)&&B(Mk,this,Kk).call(this))}async function lx(t,e){if(this.log.debug(`[#loadNode] Loading node [${t}] in '${e}' mode`),!t)return;const n=z(dk,this)&&"function"==typeof z(dk,this).get?z(dk,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}=B(Mk,this,Bk).call(this,t,{allowSeekKeep:!1});if(i&&i.aborted)B(Mk,this,zk).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&&B(Mk,this,ux).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${t}: partial already loaded`);if(!B(Mk,this,cx).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${t}: no loadable tracks`);z(vk,this).add(t),await n.load({loadingMode:e,signal:i})}catch(e){if(Gg(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}]`),z(vk,this).delete(t),B(Mk,this,zk).call(this,t,r)}}function cx(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 ux(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&&!B(Mk,this,Rk).call(this,n)||i&&!B(Mk,this,Rk).call(this,i))}))}class dx extends Jc{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 hx(t){if(!t)throw new Error("Assertion failed.")}const fx=t=>t&&t[t.length-1],px=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)},mx=t=>t.constructor===Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t),gx=t=>t.constructor===DataView?t:ArrayBuffer.isView(t)?new DataView(t.buffer,t.byteOffset,t.byteLength):new DataView(t),vx=new TextDecoder,yx=t=>Object.fromEntries(Object.entries(t).map((([t,e])=>[e,t]))),bx={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},kx=yx(bx),xx={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},wx=yx(xx),_x={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},Tx=yx(_x),Ix=t=>[...t].map((t=>t.toString(16).padStart(2,"0"))).join(""),Ex=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,Sx=(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},Nx=(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},Ax=()=>{let t,e;return{promise:new Promise(((n,i)=>{t=n,e=i})),resolve:t,reject:e}},Mx=(t,e,n)=>t.getUint8(e)<<16|t.getUint8(e+1)<<8|t.getUint8(e+2),Fx=(t,e,n)=>Math.max(e,Math.min(n,t)),Ox=/^[a-z]{3}$/,Px=1e6*(1+Number.EPSILON);let Cx=null;let Dx=null;const Rx=()=>{if(null!==Dx)return Dx;if("undefined"==typeof navigator)return null;const t=/\bChrome\/(\d+)/.exec(navigator.userAgent);return t?Dx=Number(t[1]):null},Bx=t=>"number"==typeof t&&!Number.isNaN(t);class Lx{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 zx={default:!0,forced:!1,original:!1,commentary:!1,hearingImpaired:!1,visuallyImpaired:!1};class Wx{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 Wx(this.bytes);return t.pos=this.pos,t}}const Ux=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],jx=[-1,1,2,3,4,5,6,8],$x=t=>{if(!t||t.byteLength<2)throw new TypeError("AAC description must be at least 2 bytes long.");const e=new Wx(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<Ux.length&&(r=Ux[i]);const o=e.readBits(4);let s=null;return o>=1&&o<=7&&(s=jx[o]),{objectType:n,frequencyIndex:i,sampleRate:r,channelConfiguration:o,numberOfChannels:s}},qx=["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"],Vx=[{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}],Gx=t=>{const{codec:e,codecDescription:n,colorSpace:i,avcCodecInfo:r,hevcCodecInfo:o,vp9CodecInfo:s,av1CodecInfo:a}=t;if("avc"===e){if(hx(null!==t.avcType),r){const e=new Uint8Array([r.avcProfileIndication,r.profileCompatibility,r.avcLevelIndication]);return`avc${t.avcType}.${Ix(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}.${Ix(n.subarray(1,4))}`}if("hevc"===e){let t,e,i,r,s,a;if(o)t=o.generalProfileSpace,e=o.generalProfileIdc,i=Ex(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=gx(n),l=o.getUint8(1);t=l>>6&3,e=31&l,i=Ex(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=fx(Vx).level;for(const t of Vx)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=fx(Vx).level;for(const t of Vx)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?bx[i.primaries]:1,u=null!=i&&i.transfer?xx[i.transfer]:1,d=null!=i&&i.matrix?_x[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}'.`)},Hx=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:$x(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&&qx.includes(e))return e;throw new TypeError(`Unhandled codec '${e}'.`)},Kx=/^pcm-([usf])(\d+)+(be)?$/,Xx=[48e3,44100,32e3],Yx=[24e3,22050,16e3];var Qx,Jx;!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"}(Qx||(Qx={})),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"}(Jx||(Jx={}));const Zx=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})},tw=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=Mx(i,n):(hx(4===e),t=i.getUint32(n,!1)),n+=e,yield{offset:n,length:t},n+=t}},ew=t=>31&t,nw=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)},iw=t=>t>>1&63,rw=function*(t){const e=new Wx(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);hx(e.pos%8==0),yield{type:i,data:t.subarray(e.pos/8,e.pos/8+s)},e.skipBits(8*s)}};var ow;!function(t){t[t.STREAMINFO=0]="STREAMINFO",t[t.VORBIS_COMMENT=4]="VORBIS_COMMENT",t[t.PICTURE=6]="PICTURE"}(ow||(ow={}));const sw=[2,1,2,3,3,4,4,5];class aw{constructor(t){this.input=t}}const lw=[],cw=[],uw=new Uint8Array(0);class dw{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===uw&&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===uw}get microsecondTimestamp(){return Math.trunc(Px*this.timestamp)}get microsecondDuration(){return Math.trunc(Px*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 dw(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 dw(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 hw=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.")},fw=t=>{if(!Bx(t))throw new TypeError("timestamp must be a number.")},pw=(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 mw{constructor(t){if(!(t instanceof gw))throw new TypeError("track must be an InputTrack.");this._track=t}getFirstPacket(t={}){if(hw(t),this._track.input._disposed)throw new jw;return pw(this._track,this._track._backing.getFirstPacket(t),t)}async getFirstKeyPacket(t={}){hw(t);const e=await this.getFirstPacket(t);return e?"key"===e.type?e:this.getNextKeyPacket(e,t):null}getPacket(t,e={}){if(fw(t),hw(e),this._track.input._disposed)throw new jw;return pw(this._track,this._track._backing.getPacket(t,e),e)}getNextPacket(t,e={}){if(!(t instanceof dw))throw new TypeError("packet must be an EncodedPacket.");if(hw(e),this._track.input._disposed)throw new jw;return pw(this._track,this._track._backing.getNextPacket(t,e),e)}async getKeyPacket(t,e={}){if(fw(t),hw(e),this._track.input._disposed)throw new jw;if(!e.verifyKeyPackets)return this._track._backing.getKeyPacket(t,e);const n=await this._track._backing.getKeyPacket(t,e);return n?(hx("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 dw))throw new TypeError("packet must be an EncodedPacket.");if(hw(e),this._track.input._disposed)throw new jw;if(!e.verifyKeyPackets)return this._track._backing.getNextKeyPacket(t,e);const n=await this._track._backing.getNextKeyPacket(t,e);return n?(hx("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 dw))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 dw))throw new TypeError("endPacket must be an EncodedPacket.");if(hw(n),this._track.input._disposed)throw new jw;const i=[];let{promise:r,resolve:o}=Ax(),{promise:s,resolve:a}=Ax(),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}=Ax()),await s):(i.push(u),o(),({promise:r,resolve:o}=Ax()),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 jw;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 gw{constructor(t,e){this.input=t,this._backing=e}isVideoTrack(){return this instanceof vw}isAudioTrack(){return this instanceof yw}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 mw(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 vw extends gw{constructor(t,e){super(t,e),this._backing=e,this.pixelAspectRatio=(t=>{hx(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 hx(null!==e),lw.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 dw))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 hx(e),((t,e,n)=>{switch(t){case"avc":for(const t of((t,e)=>{if(e.description){const n=3&mx(e.description)[4];return tw(t,n+1)}return Zx(t)})(n,e)){const e=n[t.offset],r=ew(e);if(r>=Qx.NON_IDR_SLICE&&r<=Qx.SLICE_DPC)return"delta";if(r===Qx.IDR)return"key";if(r===Qx.SEI&&(i=void 0,!(null!==Cx?Cx:Cx=!("undefined"==typeof navigator||(null===(i=navigator.vendor)||void 0===i||!i.includes("Google Inc"))&&!/Chrome/.test(navigator.userAgent)))||Rx()>=144)){const e=n.subarray(t.offset,t.offset+t.length),i=nw(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 Wx(i);t.pos=8*r;const e=px(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&mx(e.description)[21];return tw(t,n+1)}return Zx(t)})(n,e)){const e=iw(n[t.offset]);if(e<Jx.BLA_W_LP)return"delta";if(e<=Jx.RSV_IRAP_VCL23)return"key"}return"delta";case"vp8":return 1&n[0]?"delta":"key";case"vp9":{const t=new Wx(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 rw(n))if(1===e){const e=new Wx(i);e.skipBits(4),t=!!e.readBits(1)}else if(3===e||6===e||7===e){if(t)return"key";const e=new Wx(i);return e.readBits(1)?null:0===e.readBits(2)?"key":"delta"}return null}default:(t=>{throw new Error(`Unexpected value: ${t}`)})(t),hx(!1)}var i})(this.codec,e,t.data)}}class yw extends gw{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 hx(null!==e),cw.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 dw))throw new TypeError("packet must be an EncodedPacket.");return null===this.codec?null:"key"}}const bw=t=>{let e=Qw(t);const n=n_(t,4);let i=8;1===e&&(e=Zw(t),i=16);const r=e-i;return r<0?null:{name:n,totalSize:e,headerSize:i,contentSize:r}},kw=t=>Jw(t)/65536,xw=t=>Jw(t)/1073741824,ww=t=>{let e=0;for(let n=0;n<4;n++){e<<=7;const n=Hw(t);if(e|=127&n,!(128&n))break}return e},_w=t=>{let e=Kw(t);return t.skip(2),e=Math.min(e,t.remainingLength),vx.decode(Gw(t,e))},Tw=t=>{const e=bw(t);if(!e||"data"!==e.name)return null;if(t.remainingLength<8)return null;const n=Qw(t);t.skip(4);const i=Gw(t,e.contentSize-8);switch(n){case 1:return vx.decode(i);case 2:return new TextDecoder("utf-16be").decode(i);case 13:return new Lx(i,"image/jpeg");case 14:return new Lx(i,"image/png");case 27:return new Lx(i,"image/bmp");default:return i}};class Iw extends aw{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=bw(e);if(!i)break;if("ftyp"===i.name){const t=n_(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),hx(t);const e=Qw(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=bw(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,hx(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&&qx.includes(t.info.codec)&&0===n.sampleCompositionTimeOffsets.length){var r;hx("audio"===(null===(r=t.info)||void 0===r?void 0:r.type));const e=(t=>{if(hx(qx.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=Kx.exec(t);let n;return hx(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=Nx(n.sampleTimingEntries,a,(t=>t.startIndex)),u=n.sampleTimingEntries[c],d=Nx(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=fx(i);m&&m.delta===p?m.count++:i.push({startIndex:s.startChunkIndex+r,startDecodeTimestamp:f,count:1,delta:p});const g=s.samplesPerChunk*e.sampleSize*t.info.numberOfChannels;o.push(g)}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),hx(n);const i=bw(n);hx("moof"===(null==i?void 0:i.name));let r=this.reader.requestSlice(t,i.totalSize);r instanceof Promise&&(r=await r),hx(r),this.traverseBox(r);const o=this.lastReadFragment;hx(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)Pw(t,i.timestamp);else{const e=Nx(n,o.moofOffset-1,(t=>t.moofOffset));if(-1!==e){const i=n[e];Pw(t,i.endTimestamp)}}t.startTimestampIsFinal=!0}const i=Nx(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=bw(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,g,v,y,b,k,x,w,_,T,I,E,S,N,A,M,F,O,P,C,D,R;const B=t.filePos,L=bw(t);if(!L)return!1;const z=t.filePos,W=B+L.totalSize;switch(L.name){case"mdia":case"minf":case"dinf":case"mfra":case"edts":case"wave":this.readContiguousBoxes(t.slice(z,L.contentSize));break;case"mvhd":{const e=Hw(t);t.skip(3),1===e?(t.skip(16),this.movieTimescale=Qw(t),this.movieDurationInTimescale=Zw(t)):(t.skip(8),this.movieTimescale=Qw(t),this.movieDurationInTimescale=Qw(t))}break;case"trak":{const e={id:-1,demuxer:this,inputTrack:null,disposition:{...zx},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,L.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 vw(this.input,new Sw(t)),this.tracks.push(e)}else if("audio"===e.info.type&&-1!==e.info.numberOfChannels){const t=e;e.inputTrack=new yw(this.input,new Nw(t)),this.tracks.push(e)}this.currentTrack=null}break;case"tkhd":{const e=this.currentTrack;if(!e)break;const n=Hw(t),i=!!(1&Xw(t));if(e.disposition.default=i,0===n)t.skip(8),e.id=Qw(t),t.skip(4),e.durationInMovieTimescale=Qw(t);else{if(1!==n)throw new Error(`Incorrect track header version ${n}.`);t.skip(16),e.id=Qw(t),t.skip(4),e.durationInMovieTimescale=Zw(t)}t.skip(16);const r=[kw(t),kw(t),xw(t),kw(t),kw(t),xw(t),kw(t),kw(t),xw(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}.`)})((Ot=Cw(r),90*Math.round(Ot/90)));hx(0===o||90===o||180===o||270===o),e.rotation=o}break;case"elst":{const e=this.currentTrack;if(!e)break;const n=Hw(t);t.skip(3);let i=!1,r=0;const o=Qw(t);for(let s=0;s<o;s++){const o=1===n?Zw(t):Qw(t),s=1===n?t_(t):Jw(t),a=kw(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=Hw(t);t.skip(3),0===n?(t.skip(8),e.timescale=Qw(t),e.durationInMediaTimescale=Qw(t)):1===n&&(t.skip(16),e.timescale=Qw(t),e.durationInMediaTimescale=Zw(t));let i=Kw(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,Ox.test(Ft)||(e.languageCode="und")}}break;case"hdlr":{const e=this.currentTrack;if(!e)break;t.skip(8);const n=n_(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=B,this.readContiguousBoxes(t.slice(z,L.contentSize))}break;case"stsd":{const e=this.currentTrack;if(!e)break;if(null===e.info||e.sampleTable)break;const n=Hw(t);t.skip(3);const i=Qw(t);for(let r=0;r<i;r++){const i=t.filePos,r=bw(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=Kw(t),e.info.height=Kw(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=Kw(t);t.skip(6);let a=Kw(t),l=Kw(t);t.skip(4);let c=Qw(t)/65536;if(0===n&&s>0)if(1===s)t.skip(4),l=8*Qw(t),t.skip(8);else if(2===s){t.skip(4),c=e_(t),a=Qw(t),t.skip(4),l=Qw(t);const n=Qw(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;hx(e.info),e.info.codecDescription=Gw(t,L.contentSize)}break;case"hvcC":{const e=this.currentTrack;if(!e)break;hx(e.info),e.info.codecDescription=Gw(t,L.contentSize)}break;case"vpcC":{var U;const e=this.currentTrack;if(!e)break;hx("video"===(null===(U=e.info)||void 0===U?void 0:U.type)),t.skip(4);const n=Hw(t),i=Hw(t),r=Hw(t),o=r>>4,s=r>>1&7,a=1&r,l=Hw(t),c=Hw(t),u=Hw(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;hx("video"===(null===(j=e.info)||void 0===j?void 0:j.type)),t.skip(1);const n=Hw(t),i=n>>5,r=31&n,o=Hw(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 $;const e=this.currentTrack;if(!e)break;if(hx("video"===(null===($=e.info)||void 0===$?void 0:$.type)),"nclx"!==n_(t,4))break;const n=Kw(t),i=Kw(t),r=Kw(t),o=Boolean(128&Hw(t));e.info.colorSpace={primaries:kx[n],transfer:wx[i],matrix:Tx[r],fullRange:o}}break;case"pasp":{var q;const e=this.currentTrack;if(!e)break;hx("video"===(null===(q=e.info)||void 0===q?void 0:q.type));const n=Qw(t),i=Qw(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;hx("audio"===(null===(V=e.info)||void 0===V?void 0:V.type)),t.skip(4),hx(3===Hw(t)),ww(t),t.skip(2);const n=Hw(t),i=!!(64&n),r=!!(32&n);if(!!(128&n)&&t.skip(2),i){const e=Hw(t);t.skip(e)}r&&t.skip(2),hx(4===Hw(t));const o=ww(t),s=t.filePos,a=Hw(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){hx(5===Hw(t));const n=ww(t);if(e.info.codecDescription=Gw(t,n),"aac"===e.info.codec){const t=$x(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;hx("audio"===(null===(G=e.info)||void 0===G?void 0:G.type)),255&Kw(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;hx("audio"===(null===(H=e.info)||void 0===H?void 0:H.type)),t.skip(4);const n=Hw(t),i=Boolean(1&n),r=Hw(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;hx("audio"===(null===(K=e.info)||void 0===K?void 0:K.type)),t.skip(1);const n=Hw(t),i=Kw(t),r=Qw(t),o=Yw(t),s=Hw(t);let a;a=0!==s?Gw(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;hx("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=Hw(t),o=Xw(t);if((r&n)===ow.STREAMINFO){t.skip(10);const n=Qw(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=Gw(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;hx("audio"===(null===(Y=e.info)||void 0===Y?void 0:Y.type));const n=Gw(t,3),i=new Wx(n),r=i.readBits(2);i.skipBits(8);const o=i.readBits(3),s=i.readBits(1);r<3&&(e.info.sampleRate=Xx[r]),e.info.numberOfChannels=sw[o]+s}break;case"dec3":{var Q;const e=this.currentTrack;if(!e)break;hx("audio"===(null===(Q=e.info)||void 0===Q?void 0:Q.type));const n=(t=>{if(t.length<2)return null;const e=new Wx(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}})(Gw(t,L.contentSize));if(!n){console.warn("Invalid dec3 box contents, ignoring.");break}const i=(t=>{const e=t.substreams[0];return hx(e),e.fscod<3?Xx[e.fscod]:null!==e.fscod2&&e.fscod2<3?Yx[e.fscod2]:null})(n);null!==i&&(e.info.sampleRate=i),e.info.numberOfChannels=(t=>{const e=t.substreams[0];hx(e);let n=sw[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=Qw(t);let i=0,r=0;for(let o=0;o<n;o++){const n=Qw(t),o=Qw(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=Qw(t);let i=0;for(let r=0;r<n;r++){const n=Qw(t),r=Jw(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=Qw(t),i=Qw(t);if(0===n)for(let n=0;n<i;n++){const n=Qw(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=Hw(t),i=Qw(t),r=Gw(t,Math.ceil(i*n/8)),o=new Wx(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=Qw(t);for(let i=0;i<n;i++){const n=Qw(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=Qw(t);for(let i=0;i<n;i++){const n=Qw(t)-1,i=Qw(t),r=Qw(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=Qw(t);for(let i=0;i<n;i++){const n=Qw(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=Qw(t);for(let i=0;i<n;i++){const n=Zw(t);e.sampleTable.chunkOffsets.push(n)}}break;case"mvex":this.isFragmented=!0,this.readContiguousBoxes(t.slice(z,L.contentSize));break;case"mehd":{const e=Hw(t);t.skip(3);const n=1===e?Zw(t):Qw(t);this.movieDurationInTimescale=n}break;case"trex":{t.skip(4);const e=Qw(t),n=Qw(t),i=Qw(t),r=Qw(t),o=Qw(t);this.fragmentTrackDefaults.push({trackId:e,defaultSampleDescriptionIndex:n,defaultSampleDuration:i,defaultSampleSize:r,defaultSampleFlags:o})}break;case"tfra":{const e=Hw(t);t.skip(3);const n=Qw(t),i=this.tracks.find((t=>t.id===n));if(!i)break;const r=Qw(t),o=(12&r)>>2,s=3&r,a=[Hw,Kw,Xw,Qw],l=a[(48&r)>>4],c=a[o],u=a[s],d=Qw(t);for(let n=0;n<d;n++){const n=1===e?Zw(t):Qw(t),r=1===e?Zw(t):Qw(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:B,moofSize:L.totalSize,implicitBaseDataOffset:B,trackData:new Map},this.readContiguousBoxes(t.slice(z,L.contentSize)),this.lastReadFragment=this.currentFragment,this.currentFragment=null;break;case"traf":if(hx(this.currentFragment),this.readContiguousBoxes(t.slice(z,L.contentSize)),this.currentTrack){const t=this.currentFragment.trackData.get(this.currentTrack.id);if(t){const{currentFragmentState:e}=this.currentTrack;hx(e),null!==e.startTimestamp&&(Pw(t,e.startTimestamp),t.startTimestampIsFinal=!0)}this.currentTrack.currentFragmentState=null,this.currentTrack=null}break;case"tfhd":{var J,Z,tt,et;hx(this.currentFragment),t.skip(1);const e=Xw(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=Qw(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=Zw(t):l&&(u.currentFragmentState.baseDataOffset=this.currentFragment.moofOffset),i&&(u.currentFragmentState.sampleDescriptionIndex=Qw(t)),r&&(u.currentFragmentState.defaultSampleDuration=Qw(t)),o&&(u.currentFragmentState.defaultSampleSize=Qw(t)),s&&(u.currentFragmentState.defaultSampleFlags=Qw(t)),a&&(u.currentFragmentState.defaultSampleDuration=0)}break;case"tfdt":{const e=this.currentTrack;if(!e)break;hx(e.currentFragmentState);const n=Hw(t);t.skip(3);const i=0===n?Qw(t):Zw(t);e.currentFragmentState.startTimestamp=i}break;case"trun":{const e=this.currentTrack;if(!e)break;if(hx(this.currentFragment),hx(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=Hw(t),i=Xw(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=Qw(t);let d=e.currentFragmentState.baseDataOffset;r&&(d+=Jw(t));let h=null;o&&(h=Qw(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=Qw(t):(hx(null!==e.currentFragmentState.defaultSampleDuration),r=e.currentFragmentState.defaultSampleDuration),a?o=Qw(t):(hx(null!==e.currentFragmentState.defaultSampleSize),o=e.currentFragmentState.defaultSampleSize),l?u=Qw(t):(hx(null!==e.currentFragmentState.defaultSampleFlags),u=e.currentFragmentState.defaultSampleFlags),0===i&&null!==h&&(u=h);let d=0;c&&(d=0===n?Qw(t):Jw(t));const g=!(65536&u);m.samples.push({presentationTimestamp:p+d,duration:r,byteOffset:f,byteSize:o,isKeyFrame:g}),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 g=m.samples[m.presentationTimestamps[0].sampleIndex],v=m.samples[fx(m.presentationTimestamps).sampleIndex];m.startTimestamp=g.presentationTimestamp,m.endTimestamp=v.presentationTimestamp+v.duration,this.currentFragment.implicitBaseDataOffset=f}break;case"udta":{const v=this.iterateContiguousBoxes(t.slice(z,L.contentSize));for(const{boxInfo:t,slice:y}of v){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]=_w(y)):null!==(ct=(at=this.metadataTags.raw)[lt=t.name])&&void 0!==ct||(at[lt]=Gw(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=vx.decode(Gw(y,t.contentSize)):null!==(n=(e=this.metadataTags).title)&&void 0!==n||(e.title=_w(y));break;case"©des":this.currentTrack||null!==(r=(i=this.metadataTags).description)&&void 0!==r||(i.description=_w(y));break;case"©ART":this.currentTrack||null!==(s=(o=this.metadataTags).artist)&&void 0!==s||(o.artist=_w(y));break;case"©alb":this.currentTrack||null!==(l=(a=this.metadataTags).album)&&void 0!==l||(a.album=_w(y));break;case"albr":this.currentTrack||null!==(u=(c=this.metadataTags).albumArtist)&&void 0!==u||(c.albumArtist=_w(y));break;case"©gen":this.currentTrack||null!==(h=(d=this.metadataTags).genre)&&void 0!==h||(d.genre=_w(y));break;case"©day":if(!this.currentTrack){var ut,dt;const t=new Date(_w(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=_w(y));break;case"©lyr":this.currentTrack||null!==(g=(m=this.metadataTags).lyrics)&&void 0!==g||(m.lyrics=_w(y))}}}break;case"meta":{if(this.currentTrack)break;const e=0!==Qw(t);this.currentMetadataKeys=new Map,e?this.readContiguousBoxes(t.slice(z,L.contentSize)):this.readContiguousBoxes(t.slice(z+4,L.contentSize-4)),this.currentMetadataKeys=null}break;case"keys":{if(!this.currentMetadataKeys)break;t.skip(4);const e=Qw(t);for(let n=0;n<e;n++){const e=Qw(t);t.skip(4);const i=vx.decode(Gw(t,e-8));this.currentMetadataKeys.set(n+1,i)}}break;case"ilst":{if(!this.currentMetadataKeys)break;const e=this.iterateContiguousBoxes(t.slice(z,L.contentSize));for(const{boxInfo:t,slice:n}of e){var ht,ft,pt,mt,gt;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=Tw(n);switch(null!==(ft=(ht=this.metadataTags).raw)&&void 0!==ft||(ht.raw={}),null!==(gt=(pt=this.metadataTags.raw)[mt=e])&&void 0!==gt||(pt[mt]=r),e){case"©nam":case"titl":case"com.apple.quicktime.title":case"title":"string"==typeof r&&(null!==(y=(v=this.metadataTags).title)&&void 0!==y||(v.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!==(w=(x=this.metadataTags).artist)&&void 0!==w||(x.artist=r));break;case"©alb":case"albm":case"com.apple.quicktime.album":case"album":"string"==typeof r&&(null!==(T=(_=this.metadataTags).album)&&void 0!==T||(_.album=r));break;case"aART":case"album_artist":"string"==typeof r&&(null!==(E=(I=this.metadataTags).albumArtist)&&void 0!==E||(I.albumArtist=r));break;case"©cmt":case"com.apple.quicktime.comment":case"comment":"string"==typeof r&&(null!==(N=(S=this.metadataTags).comment)&&void 0!==N||(S.comment=r));break;case"©gen":case"gnre":case"com.apple.quicktime.genre":case"genre":"string"==typeof r&&(null!==(M=(A=this.metadataTags).genre)&&void 0!==M||(A.genre=r));break;case"©lyr":case"lyrics":"string"==typeof r&&(null!==(O=(F=this.metadataTags).lyrics)&&void 0!==O||(F.lyrics=r));break;case"©day":case"rldt":case"com.apple.quicktime.creationdate":case"date":if("string"==typeof r){var vt,yt;const t=new Date(r);Number.isNaN(t.getTime())||null!==(yt=(vt=this.metadataTags).date)&&void 0!==yt||(vt.date=t)}break;case"covr":case"com.apple.quicktime.artwork":r instanceof Lx?(null!==(C=(P=this.metadataTags).images)&&void 0!==C||(P.images=[]),this.metadataTags.images.push({data:r.data,kind:"coverFront",mimeType:r.mimeType})):r instanceof Uint8Array&&(null!==(R=(D=this.metadataTags).images)&&void 0!==R||(D.images=[]),this.metadataTags.images.push({data:r,kind:"coverFront",mimeType:"image/*"}));break;case"track":if("string"==typeof r){var bt,kt,xt,wt;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!==(wt=(xt=this.metadataTags).tracksTotal)&&void 0!==wt||(xt.tracksTotal=n))}break;case"trkn":if(r instanceof Uint8Array&&r.length>=6){var _t,Tt,It,Et;const t=gx(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!==(Et=(It=this.metadataTags).tracksTotal)&&void 0!==Et||(It.tracksTotal=n))}break;case"disc":case"disk":if(r instanceof Uint8Array&&r.length>=6){var St,Nt,At,Mt;const t=gx(r),e=t.getUint16(2,!1),n=t.getUint16(4,!1);e>0&&(null!==(Nt=(St=this.metadataTags).discNumber)&&void 0!==Nt||(St.discNumber=e)),n>0&&(null!==(Mt=(At=this.metadataTags).discsTotal)&&void 0!==Mt||(At.discsTotal=n))}}}}}var Ft,Ot;return t.filePos=W,!0}}class Ew{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=Aw(i,n),o=await this.fetchPacketForSampleIndex(r,e);return Dw(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=Nx(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=Mw(i,n),o=await this.fetchPacketForSampleIndex(r,e);return Dw(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=Ow(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 hx(-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=Fw(n,t);if(!i)return null;let r;if(e.metadataOnly)r=uw;else{let t=this.internalTrack.demuxer.reader.requestSlice(i.sampleOffset,i.sampleSize);t instanceof Promise&&(t=await t),hx(t),r=Gw(t,i.sampleSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new dw(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(hx(i),n.metadataOnly)r=uw;else{let t=this.internalTrack.demuxer.reader.requestSlice(i.byteOffset,i.byteSize);t instanceof Promise&&(t=await t),hx(t),r=Gw(t,i.byteSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new dw(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=Nx(this.internalTrack.fragmentLookupTable,n,(t=>t.timestamp)),h=-1!==d?this.internalTrack.fragmentLookupTable[d]:null,f=Nx(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 g;for(t?null===m||t.moofOffset>=m?(g=t.moofOffset+t.moofSize,l=t):g=m:g=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(g,8,16);if(t instanceof Promise&&(t=await t),!t)break;const n=g,o=bw(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)}g=n+o.totalSize}if(h&&(!c||c.moofOffset<h.moofOffset)){var v;const t=this.internalTrack.fragmentLookupTable[d-1];hx(!t||t.timestamp<h.timestamp);const n=null!==(v=null==t?void 0:t.timestamp)&&void 0!==v?v:-1/0;return this.performFragmentedLookup(null,e,n,i,r)}return c?this.fetchPacketInFragment(c,u,r):null}}class Sw extends Ew{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 rw(t)){if(1!==e)continue;const t=new Wx(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 g=1,v=1,y=0;return m||(0===i?(g=1,v=1):1===i?(g=0,v=0):12===p&&(g=t.readBits(1),g&&(v=t.readBits(1))),g&&v&&(y=t.readBits(2))),{profile:i,level:o,tier:s,bitDepth:p,monochrome:m,chromaSubsamplingX:g,chromaSubsamplingY:v,chromaSamplePosition:y}}return null})(t.data)}}else{const t=await this.getFirstPacket({});this.internalTrack.info.vp9CodecInfo=t&&(t=>{const e=new Wx(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=fx(Vx).level;for(const t of Vx)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:Gx(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 Nw extends Ew{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:Hx(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 Aw=(t,e)=>{if(t.presentationTimestamps){const n=Nx(t.presentationTimestamps,e,(t=>t.presentationTimestamp));return-1===n?-1:t.presentationTimestamps[n].sampleIndex}{const n=Nx(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)}},Mw=(t,e)=>{if(!t.keySampleIndices)return Aw(t,e);if(t.presentationTimestamps){const n=Nx(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!==Sx(t.keySampleIndices,n,(t=>t)))return n}return-1}{var n;const i=Aw(t,e),r=Nx(t.keySampleIndices,i,(t=>t));return null!==(n=t.keySampleIndices[r])&&void 0!==n?n:-1}},Fw=(t,e)=>{const n=Nx(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=Nx(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=Nx(t.sampleToChunk,e,(t=>t.startSampleIndex)),c=t.sampleToChunk[l];hx(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];hx(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!==Sx(t.keySampleIndices,e,(t=>t))}},Ow=(t,e)=>{var n;if(!t.keySampleIndices)return e+1;const i=Nx(t.keySampleIndices,e,(t=>t));return null!==(n=t.keySampleIndices[i+1])&&void 0!==n?n:-1},Pw=(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},Cw=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},Dw=t=>0===t.sampleSizes.length;class Rw{}class Bw extends Rw{async _getMajorBrand(t){let e=t._reader.requestSlice(0,12);return e instanceof Promise&&(e=await e),e?(e.skip(4),"ftyp"!==n_(e,4)?null:n_(e,4)):null}_createDemuxer(t){return new Iw(t)}}const Lw=new class extends Bw{async _canReadInput(t){const e=await this._getMajorBrand(t);return!!e&&"qt "!==e}get name(){return"MP4"}get mimeType(){return"video/mp4"}};class zw{constructor(){this._disposed=!1,this._sizePromise=null,this.onread=null}async getSizeOrNull(){var t;if(this._disposed)throw new jw;return null!==(t=this._sizePromise)&&void 0!==t?t:this._sizePromise=Promise.resolve(this._retrieveSize())}async getSize(){if(this._disposed)throw new jw;const t=await this.getSizeOrNull();if(null===t)throw new Error("Cannot determine the size of an unsized source.");return t}}class Ww extends zw{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&&(!Bx(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=Nx(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:gx(o),offset:t};this._currentIndex>r&&this._throwDueToCacheMiss();const{promise:s,resolve:a,reject:l}=Ax();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:gx(e.bytes),offset:e.start}),this._pendingSlices.splice(t,1),t--))}for(this._cache.push({start:i,end:r,bytes:n,view:gx(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!==(be=Symbol.dispose)&&void 0!==be||(Symbol.dispose=Symbol("Symbol.dispose"));class Uw{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 Rw))))throw new TypeError("options.formats must be an array of InputFormat.");if(!(t.source instanceof zw))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 $w(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(),hx(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 jw extends Error{constructor(t="Input has been disposed."){super(t),this.name="InputDisposedError"}}class $w{constructor(t){this.source=t}requestSlice(t,e){if(this.source._disposed)throw new jw;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 qw(e.bytes,e.view,e.offset,t,n):null)):i?new qw(i.bytes,i.view,i.offset,t,n):null}requestSliceRange(t,e,n){if(this.source._disposed)throw new jw;if(t<0)return null;if(null!==this.fileSize)return this.requestSlice(t,Fx(this.fileSize-t,e,n));{const i=this.requestSlice(t,n),r=i=>{if(i)return i;const r=i=>(hx(null!==i),this.requestSlice(t,Fx(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 qw{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 qw(t,gx(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 qw(this.bytes,this.view,this.offset,t,t+e)}}const Vw=(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.`)},Gw=(t,e)=>{Vw(t,e);const n=t.bytes.subarray(t.bufferPos,t.bufferPos+e);return t.bufferPos+=e,n},Hw=t=>(Vw(t,1),t.view.getUint8(t.bufferPos++)),Kw=t=>{Vw(t,2);const e=t.view.getUint16(t.bufferPos,!1);return t.bufferPos+=2,e},Xw=t=>{Vw(t,3);const e=Mx(t.view,t.bufferPos);return t.bufferPos+=3,e},Yw=t=>{Vw(t,2);const e=t.view.getInt16(t.bufferPos,!1);return t.bufferPos+=2,e},Qw=t=>{Vw(t,4);const e=t.view.getUint32(t.bufferPos,!1);return t.bufferPos+=4,e},Jw=t=>{Vw(t,4);const e=t.view.getInt32(t.bufferPos,!1);return t.bufferPos+=4,e},Zw=t=>4294967296*Qw(t)+Qw(t),t_=t=>4294967296*Jw(t)+Qw(t),e_=t=>{Vw(t,8);const e=t.view.getFloat64(t.bufferPos,!1);return t.bufferPos+=8,e},n_=(t,e)=>{Vw(t,e);let n="";for(let i=0;i<e;i++)n+=String.fromCharCode(t.bytes[t.bufferPos++]);return n};var i_=new WeakMap,r_=new WeakMap,o_=new WeakMap,s_=new WeakMap,a_=new WeakMap,l_=new WeakMap,c_=new WeakMap,u_=new WeakMap,d_=new WeakMap,h_=new WeakMap,f_=new WeakMap,p_=new WeakMap,m_=new WeakMap,g_=new WeakMap,v_=new WeakMap,y_=new WeakSet;class b_ extends Jc{constructor(...t){super(...t),j(this,y_),W(this,i_,null),W(this,r_,null),W(this,o_,null),W(this,s_,null),W(this,a_,!1),W(this,l_,!1),W(this,c_,!1),W(this,u_,!1),W(this,d_,void 0),W(this,h_,null),W(this,f_,null),W(this,p_,!1),W(this,m_,!1),W(this,g_,null),W(this,v_,!1)}get name(){return"FMP4Demuxer"}get defaults(){return{}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"pushChunk","endOfStream"])}pushChunk(t,e={}){if(z(c_,this)||z(u_,this))return;const n=t instanceof Uint8Array?t:new Uint8Array(t),i=!!e.isInit;U(h_,this,B(y_,this,I_).call(this,n,e,i)),i&&(U(d_,this,n),U(f_,this,null),this.trigger("demux:init",{data:n})),B(y_,this,T_).call(this);try{var r;const t=null===(r=z(i_,this))||void 0===r?void 0:r.write(n);t&&"function"==typeof t.catch&&t.catch((t=>{B(y_,this,E_).call(this,t)}))}catch(t){if(z(c_,this)||B(y_,this,k_).call(this,t))return;return this.log.warn("[FMP4Demuxer] mediabunny demux failed",t),void B(y_,this,E_).call(this,t)}const o=B(y_,this,A_).call(this);o&&"function"==typeof o.catch&&o.catch((t=>{B(y_,this,E_).call(this,t)}))}endOfStream(){if(z(u_,this))return;if(z(p_,this))return;let t;U(p_,this,!0),U(m_,this,!1),U(v_,this,!1);try{var e;t=null===(e=z(i_,this))||void 0===e?void 0:e.close()}catch(e){t=Promise.resolve()}let n=!1;B(y_,this,w_).call(this),U(g_,this,setTimeout((()=>{U(g_,this,null),n||z(m_,this)||z(u_,this)||B(y_,this,__).call(this)}),20)),Promise.resolve(t).catch((()=>{})).finally((()=>{n=!0,B(y_,this,w_).call(this),B(y_,this,__).call(this)}))}onDispose(){super.onDispose(),U(u_,this,!0);try{var t,e;null===(t=z(o_,this))||void 0===t||null===(e=t.close)||void 0===e||e.call(t)}catch(t){}this.endOfStream();try{var n,i;null===(n=z(r_,this))||void 0===n||null===(i=n.dispose)||void 0===i||i.call(n)}catch(t){}U(o_,this,null),U(r_,this,null),U(c_,this,!1),U(h_,this,null),U(s_,this,null),U(a_,this,!1),U(l_,this,!1),U(p_,this,!1),U(m_,this,!1),U(v_,this,!1),B(y_,this,w_).call(this)}}function k_(t){return!!z(u_,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 x_(){try{var t,e;const n=null===(t=z(i_,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){}U(i_,this,null)}function w_(){null!==z(g_,this)&&(clearTimeout(z(g_,this)),U(g_,this,null))}function __(){if(z(m_,this)||z(u_,this)||z(c_,this))return;if(U(m_,this,!0),z(l_,this))return void U(v_,this,!0);U(v_,this,!1);const t=B(y_,this,A_).call(this);t&&"function"==typeof t.catch&&t.catch((t=>{B(y_,this,E_).call(this,t)}))}function T_(){if(z(r_,this)&&z(i_,this))return;const t=eu.TransformStream;if(void 0===t)throw new Error("TransformStream is not available in this environment");const{readable:e,writable:n}=new t;U(i_,this,n.getWriter()),U(r_,this,new Uw({source:new Ww(e),formats:[Lw]})),U(a_,this,!1)}function I_(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(z(c_,this)||B(y_,this,k_).call(this,t))return;if(B(y_,this,N_).call(this,t))return void U(a_,this,!1);U(c_,this,!0),B(y_,this,x_).call(this);try{var e,n;null===(e=z(o_,this))||void 0===e||null===(n=e.close)||void 0===n||n.call(e)}catch(t){}U(o_,this,null);try{var i,r;null===(i=z(r_,this))||void 0===i||null===(r=i.dispose)||void 0===r||r.call(i)}catch(t){}U(r_,this,null);const o={error:t,recoverable:!1,severity:"fatal",streamClosed:z(p_,this),streamFinalized:z(m_,this)};z(h_,this)&&(o.context={...z(h_,this)}),this.trigger("demux:error",o)}function S_(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 N_(t){return!!B(y_,this,S_).call(this,t)&&(!z(m_,this)||z(v_,this))}async function A_(){if(!(z(u_,this)||z(c_,this)||z(a_,this)||z(l_,this))){U(l_,this,!0);try{B(y_,this,T_).call(this);const t=await z(r_,this).getPrimaryVideoTrack(),e=t?null:await z(r_,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 z(r_,this).getMimeType();this.trigger("demux:init",{...z(d_,this)?{data:z(d_,this)}:{},decoderConfig:i,codec:r,mimeType:o}),U(o_,this,new mw(n)),U(a_,this,!0),U(s_,this,(async()=>{try{for await(const t of z(o_,this).packets()){if(z(u_,this))break;const e="number"==typeof t.timestamp?t.timestamp:0;null===z(f_,this)&&U(f_,this,e);let n=e-z(f_,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){B(y_,this,E_).call(this,t)}})())}catch(t){if(B(y_,this,N_).call(this,t))return;throw t}finally{U(l_,this,!1),!z(v_,this)||z(c_,this)||z(u_,this)||B(y_,this,__).call(this)}}}const M_=1e6,F_=24e3/1001,O_=new Uint8Array;function P_(t){return t?t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):O_:O_}let C_=null;const D_={video:(ke=new WeakMap,xe=new WeakMap,we=new WeakMap,_e=new WeakMap,Te=new WeakMap,Ie=new WeakMap,Ee=new WeakMap,Se=new WeakMap,Ne=new WeakMap,Ae=new WeakMap,Me=new WeakMap,Fe=new WeakMap,Oe=new WeakMap,Pe=new WeakMap,Ce=new WeakMap,De=new WeakMap,Re=new WeakMap,Be=new WeakMap,Le=new WeakMap,ze=new WeakMap,We=new WeakMap,Ue=new WeakMap,je=new WeakMap,$e=new WeakMap,qe=new WeakMap,Ve=new WeakMap,Ge=new WeakMap,He=new WeakMap,Ke=new WeakMap,Xe=new WeakMap,Ye=new WeakMap,Qe=new WeakMap,Je=new WeakMap,Ze=new WeakMap,tn=new WeakSet,class extends dx{get name(){return"WebCodecsSegmentDecoder"}get defaults(){return{decodedHorizonSeconds:1,maxDecodedFrames:24,maxDecodeQueueSize:4,convertFramesToBitmapsOnAndroid:!0,androidFixEndOfSegmentDelta:.2}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"decodeChunk"])}constructor(...t){super(...t),j(this,tn),W(this,ke,void 0),W(this,xe,[]),W(this,we,void 0),W(this,_e,void 0),W(this,Te,void 0),W(this,Ie,void 0),W(this,Ee,[]),W(this,Se,void 0),W(this,Ne,new Map),W(this,Ae,!0),W(this,Me,!1),W(this,Fe,!1),W(this,Oe,!1),W(this,Pe,void 0),W(this,Ce,!1),W(this,De,!1),W(this,Re,0),W(this,Be,void 0),W(this,Le,void 0),W(this,ze,{}),W(this,We,void 0),W(this,Ue,0),W(this,je,null),W(this,$e,!1),W(this,qe,null),W(this,Ve,void 0),W(this,Ge,0),W(this,He,0),W(this,Ke,0),W(this,Xe,0),W(this,Ye,!1),W(this,Qe,!1),W(this,Je,.2),W(this,Ze,Promise.resolve()),U(we,this,this.settings.decodedHorizonSeconds||1),U(_e,this,B(tn,this,IT).call(this,this.settings.maxDecodedFrames)),U(Te,this,B(tn,this,ST).call(this,this.settings.maxDecodeQueueSize)),U(Ye,this,qp()),U(Qe,this,B(tn,this,vT).call(this,this.settings.convertFramesToBitmapsOnAndroid)),U(Je,this,B(tn,this,yT).call(this,this.settings.androidFixEndOfSegmentDelta)),U(Ie,this,(()=>0)),U(Se,this,(()=>B(tn,this,lT).call(this)));const e=this.settings.demuxerOptions?{FMP4Demuxer:this.settings.demuxerOptions}:{};U(ke,this,new b_(e)),z(ke,this).on("demux:init",(t=>B(tn,this,J_).call(this,t))),z(ke,this).on("demux:sample",(t=>B(tn,this,Z_).call(this,t))),z(ke,this).on("demux:complete",(()=>B(tn,this,tT).call(this))),z(ke,this).on("demux:error",(t=>B(tn,this,U_).call(this,t)))}setCurrentTimeProvider(t){"function"==typeof t&&U(Ie,this,t)}setTimeOffsetSeconds(t){const e=Number(t);U(Ue,this,Number.isFinite(e)?e:0)}setSeekTargetTimeSeconds(t){const e=Number(t);U(je,this,Number.isFinite(e)?e:null),U($e,this,!1),U(qe,this,null)}endOfStream(){z(ke,this)&&"function"==typeof z(ke,this).endOfStream&&z(ke,this).endOfStream()}configure(t){super.configure(t),U(ze,this,{codec:B(tn,this,AT).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)}),U(Be,this,z(ze,this).codec)}setSegment(t){this.lastSegment=t,B(tn,this,K_).call(this)}setNodeId(t){U(Ve,this,t)}decode(t){this.setSegment(t);const e=null==t?void 0:t.arrayBuffer;e&&z(ke,this).pushChunk(e,{isInit:!(null==t||!t.isInit)})}async decodeChunk(t,e={}){await z(ke,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 z(xe,this).slice()}onDispose(){if(super.onDispose(),B(tn,this,dT).call(this),z(ke,this)&&"function"==typeof z(ke,this).dispose&&z(ke,this).dispose(),U(xe,this,[]),U(Ee,this,[]),z(Ne,this).clear(),U(qe,this,null),z(Pe,this)&&"function"==typeof z(Pe,this).close)try{z(Pe,this).close()}catch(t){}U(Pe,this,null),U(Ce,this,!1),U(Le,this,null),U(Be,this,null),U(Ve,this,null),U(Ze,this,Promise.resolve()),B(tn,this,K_).call(this)}}),audio:(en=new WeakMap,nn=new WeakMap,rn=new WeakMap,on=new WeakMap,sn=new WeakMap,an=new WeakMap,ln=new WeakMap,cn=new WeakSet,class extends dx{constructor(...t){super(...t),j(this,cn),W(this,en,void 0),W(this,nn,[]),W(this,rn,0),W(this,on,!1),W(this,sn,!1),W(this,an,void 0),W(this,ln,0)}get name(){return"WebAudioDecoder"}setSegment(t){U(an,this,t)}setTimeOffsetSeconds(t){const e=Number(t);U(ln,this,Number.isFinite(e)?e:0)}decode(t){if(this.lastSegment=t,!t)return;if(t.isInit)return void U(en,this,P_(t.arrayBuffer));const e=t.arrayBuffer;e&&B(cn,this,L_).call(this,P_(e),!0)}decodeChunk(t,e={}){if(!t)return;if(e.isInit)return void U(en,this,P_(t));const n=P_(t);if(!n.length)return;z(nn,this).push(n),U(rn,this,z(rn,this)+n.length);const i=Number(e.loaded),r=Number(e.total);Number.isFinite(i)&&Number.isFinite(r)&&r>0&&i>=r&&B(cn,this,R_).call(this)}endOfStream(){B(cn,this,R_).call(this)}onDispose(){super.onDispose(),U(en,this,void 0),U(nn,this,[]),U(rn,this,0),U(on,this,!1),U(sn,this,!1),U(an,this,void 0)}}),image:class extends dx{#B;#L=0;#z=[];#W=0;#U;get name(){return"ImageDecoder"}setSegment(t){this.#B=t}setTimeOffsetSeconds(t){const e=Number(t);this.#L=Number.isFinite(e)?e:0}decode(t){super.decode(t),t&&(this.#B=t);const e=null==t?void 0:t.arrayBuffer;e instanceof ArrayBuffer&&(this.#z=[new Uint8Array(e)],this.#W=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.#z.push(n),this.#W+=n.length)}async endOfStream(){var t,e,n;if(this.#U)return;if(!(this.#z.length&&this.#W>0))return;const i=new Uint8Array(this.#W);let r=0;for(let t=0;t<this.#z.length;t+=1){const e=this.#z[t];i.set(e,r),r+=e.length}const o=null===(t=this.#B)||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 eu.Blob)return;const n="string"==typeof e?e:"";return new eu.Blob([t],n?{type:n}:void 0)}(t,e);if(!n)throw new Error("Image decode requires Blob support");let i;if("function"==typeof eu.Image&&eu.URL&&"function"==typeof eu.URL.createObjectURL&&"function"==typeof eu.URL.revokeObjectURL){const t=eu.URL.createObjectURL(n);try{const e=new eu.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{eu.URL.revokeObjectURL(t)}}if("function"==typeof eu.createImageBitmap)try{return eu.createImageBitmap(n)}catch(t){i=t}if(i)throw i;throw new Error("No supported image decode mechanism")}(i,s);this.#U=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&&(vg(o.width)||(o.width=e.width),vg(o.height)||(o.height=e.height)),this.trigger("decoder:frame",{pts:this.#L,duration:vg(null===(a=this.#B)||void 0===a?void 0:a.duration)?this.#B.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.#U&&"function"==typeof this.#U.close)try{this.#U.close()}catch(t){}this.#U=null,this.#z=[],this.#W=0,this.#B=null}}};function R_(){if(z(on,this)||z(sn,this))return;if(!z(rn,this))return;const t=B(cn,this,B_).call(this);t.length&&B(cn,this,L_).call(this,t,!1)}function B_(){const t=z(en,this),e=t?t.length:0,n=e+z(rn,this);if(!n)return O_;const i=new Uint8Array(n);let r=0;e&&(i.set(t,r),r+=e);for(let t=0;t<z(nn,this).length;t+=1){const e=z(nn,this)[t];e&&e.length&&(i.set(e,r),r+=e.length)}return i}function L_(t,e){if(z(on,this)||z(sn,this))return;const n=e?B(cn,this,z_).call(this,t):t;if(!n||!n.length)return;const i=function(){if(C_)return C_;const t=eu.AudioContext||eu.webkitAudioContext;return t?(C_=new t,C_):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);U(sn,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;U(on,this,!0);const n=Number.isFinite(null==t?void 0:t.duration)?t.duration:Number(null===(e=z(an,this))||void 0===e?void 0:e.duration)||void 0;this.trigger("decoder:audio",{audioBuffer:t,pts:z(ln,this),duration:n})})).catch((t=>{this.trigger("decoder:error",{error:t})})).finally((()=>{U(nn,this,[]),U(rn,this,0),U(sn,this,!1)}))}function z_(t){const e=z(en,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 W_(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:z(Ve,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=z(ze,this))||void 0===r?void 0:r.codec)||z(Be,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 U_(t){const e=(null==t?void 0:t.error)||t,n=B(tn,this,W_).call(this,t,e);if(B(tn,this,j_).call(this,t,e))return this.log.warn("[onDemuxError] recoverable demux error",n),void B(tn,this,tT).call(this);const i=B(tn,this,Q_).call(this,t),r=B(tn,this,$_).call(this,i);if(i&&0===i.missingFrames)return this.log.warn(`[onDemuxError] ignoring demux error (no missing frames)${r}`,{...n,missingFrameStats:i}),void B(tn,this,tT).call(this);let o=n;i&&(o={...n,missingFrameStats:i}),this.log.warn(`[onDemuxError] demux error${r}`,o),this.trigger("decoder:error",t)}function j_(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 $_(t){return t?` expectedFrames=${B(tn,this,q_).call(this,t.expectedFrames)} demuxedFrames=${B(tn,this,q_).call(this,t.demuxedFrames)} missingFrames=${B(tn,this,q_).call(this,t.missingFrames)}`:""}function q_(t){if(null==t)return"unknown";const e=Number(t);return Number.isFinite(e)?String(e):"unknown"}function V_(t,e={}){return{expectedFrames:null,demuxedFrames:z(Ge,this),missingFrames:null,reason:t,...e}}function G_(t){const e=Number(t);return Number.isFinite(e)?e:null}function H_(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 B(tn,this,V_).call(this,"segment_duration_unavailable",{segmentDurationSeconds:B(tn,this,G_).call(this,s),demuxedCoverageSeconds:z(Xe,this),frameDurationSeconds:null});const a=B(tn,this,Y_).call(this);if(!Number.isFinite(a)||a<=0){const t=Math.max(1,Math.round(s*F_));return{expectedFrames:t,demuxedFrames:z(Ge,this),missingFrames:Math.max(0,t-z(Ge,this)),reason:"fallback_fps",fallbackFps:F_,segmentDurationSeconds:s,demuxedCoverageSeconds:z(Xe,this),frameDurationSeconds:B(tn,this,G_).call(this,a)}}const l=Math.min(.5*a,.02),c=Math.max(0,s-z(Xe,this)),u=c<=l?0:c,d=Math.max(1,Math.floor((s+l)/a)),h=Math.max(0,d-z(Ge,this)),f=u>0?Math.ceil(u/a):0;return{expectedFrames:d,demuxedFrames:z(Ge,this),missingFrames:Math.max(h,f),segmentDurationSeconds:s,demuxedCoverageSeconds:z(Xe,this),frameDurationSeconds:a}}function K_(){U(Ge,this,0),U(He,this,0),U(Ke,this,0),U(Xe,this,0)}function X_(t){U(Ge,this,z(Ge,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&&(U(He,this,z(He,this)+n),U(Ke,this,z(Ke,this)+1)),!Number.isFinite(e))return;const i=Number.isFinite(n)&&n>0?e+n:e;Number.isFinite(i)&&i>z(Xe,this)&&U(Xe,this,i)}function Y_(){return z(Ke,this)>0?z(He,this)/z(Ke,this):z(Ge,this)>0&&z(Xe,this)>0?z(Xe,this)/z(Ge,this):null}function Q_(t){return B(tn,this,H_).call(this,t)}function J_(t){(null==t?void 0:t.data)instanceof Uint8Array&&(U(Le,this,t.data.buffer),B(tn,this,fT).call(this)),null!=t&&t.decoderConfig&&(U(We,this,t.decoderConfig),U(Be,this,t.decoderConfig.codec||z(Be,this)),B(tn,this,fT).call(this)),this.trigger("decoder:init",t)}function Z_(t){B(tn,this,X_).call(this,t),z(Ee,this).push(t),B(tn,this,lT).call(this)}function tT(){U(Me,this,!0),B(tn,this,pT).call(this)}function eT(t){const e="number"==typeof(null==t?void 0:t.pts)?t.pts:void 0;if(Number.isFinite(e))return z(Ue,this)+e}function nT(t){return z(Ee,this).some((e=>{const n=B(tn,this,eT).call(this,e);return Number.isFinite(n)&&n>=t}))}function iT(t){let e=-1,n=null;for(let i=0;i<z(Ee,this).length;i+=1){const r=z(Ee,this)[i],o=B(tn,this,eT).call(this,r);Number.isFinite(o)&&(null==r?void 0:r.isKey)&&o<=t&&(e=i,n=o)}return{chosenIndex:e,chosenPtsSeconds:n}}function rT(t){let e=-1,n=null;for(let i=0;i<z(Ee,this).length;i+=1){const r=z(Ee,this)[i],o=B(tn,this,eT).call(this,r);if(Number.isFinite(o)&&null!=r&&r.isKey&&(e=i,n=o,o>=t))break}return{chosenIndex:e,chosenPtsSeconds:n}}function oT(t){const e=t+z(we,this),n=z(je,this);if(!Number.isFinite(n))return e;const i=Number.isFinite(z(qe,this))?z(qe,this):null;if(Number.isFinite(i))return Math.max(e,i);const{chosenPtsSeconds:r}=B(tn,this,rT).call(this,n);return Number.isFinite(r)?Math.max(e,r):e}function sT(t){const e=z(je,this);Number.isFinite(e)&&Number.isFinite(t)&&t>=e&&(U(je,this,null),U(qe,this,null))}function aT(){const t=z(je,this);if(!Number.isFinite(t)||z($e,this))return!0;if(!B(tn,this,nT).call(this,t)&&!z(Me,this))return!1;const e=B(tn,this,iT).call(this,t);let n=e;if(-1===e.chosenIndex&&(n=B(tn,this,rT).call(this,t)),n.chosenIndex>0){const t=`[#maybeAlignToSeekKeyframe] Dropping ${n.chosenIndex} samples before keyframe @ ${n.chosenPtsSeconds}`;this.log.debug(t),z(Ee,this).splice(0,n.chosenIndex)}return U(Ae,this,!0),Number.isFinite(n.chosenPtsSeconds)&&U(qe,this,n.chosenPtsSeconds),U($e,this,!0),!0}function lT(){const t=z(Ie,this)?z(Ie,this).call(this):0,e=B(tn,this,oT).call(this,t);if(B(tn,this,_T).call(this,t),B(tn,this,TT).call(this),!B(tn,this,aT).call(this))return void B(tn,this,uT).call(this);const n=void 0!==eu.VideoDecoder&&void 0!==eu.EncodedVideoChunk;for(n&&!z(Ce,this)&&z(We,this)&&B(tn,this,fT).call(this);z(Ee,this).length&&!B(tn,this,ET).call(this)&&!(n&&z(Pe,this)&&B(tn,this,NT).call(this));){const t=z(Ee,this)[0],i="number"==typeof(null==t?void 0:t.pts)?t.pts:0,r=z(Ue,this)+i;if(r>e)break;if(null!=t&&t.raw)z(Ee,this).shift(),B(tn,this,cT).call(this,t);else{if(n){if(!z(Ce,this)||!z(Pe,this))break;if(z(Ae,this)&&!t.isKey){z(Ee,this).shift();continue}z(Ee,this).shift();const e=Math.max(0,Math.round(r*M_));z(Ne,this).set(e,!!t.isKey);try{const n=new eu.EncodedVideoChunk({type:t.isKey?"key":"delta",timestamp:e,duration:t.duration?Math.round(t.duration*M_):void 0,data:t.data instanceof Uint8Array?t.data:new Uint8Array(t.data)});z(Pe,this).decode(n),t.isKey&&U(Ae,this,!1);continue}catch(t){z(Ne,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")){U(Ae,this,!0);continue}this.log.warn("[#drainDecodeQueue] decode failed, falling back to placeholder",t)}}z(Ee,this).shift(),B(tn,this,cT).call(this,t)}}B(tn,this,pT).call(this),B(tn,this,uT).call(this)}function cT(t){const e=z(Ie,this)?z(Ie,this).call(this):0,n=B(tn,this,oT).call(this,e),i=z(Ue,this)+("number"==typeof t.pts?t.pts:0);if(i<e||i>n)return;B(tn,this,_T).call(this,e);const r={pts:i,duration:t.duration,data:t.data,isKey:t.isKey};z(xe,this).push(r),B(tn,this,TT).call(this),this.trigger("decoder:frame",r),B(tn,this,sT).call(this,i)}function uT(){if(z(Ee,this).length>0&&void 0!==eu.VideoDecoder){if(Eb(z(Se,this)))return;Tb(z(Se,this),50)}else B(tn,this,dT).call(this)}function dT(){z(Se,this)&&Eb(z(Se,this))&&Ib(z(Se,this))}function hT(){return null!=eu&&eu.performance&&"function"==typeof eu.performance.now?eu.performance.now():Date.now()}function fT(){if(z(Ce,this))return;if(void 0===eu.VideoDecoder)return;if(!z(We,this))return;if(z(De,this)&&B(tn,this,hT).call(this)<z(Re,this))return;const t={...z(We,this)};!t.codec&&z(Be,this)&&(t.codec=z(Be,this)),z(Le,this)&&!t.description&&(t.description=z(Le,this)),z(ze,this).width&&!t.codedWidth&&(t.codedWidth=z(ze,this).width),z(ze,this).height&&!t.codedHeight&&(t.codedHeight=z(ze,this).height);try{U(Pe,this,new eu.VideoDecoder({output:t=>B(tn,this,gT).call(this,t),error:t=>B(tn,this,mT).call(this,t)})),z(Pe,this).configure(t),U(Ce,this,!0),U(Ae,this,!0),U(De,this,!1),U(Re,this,0),B(tn,this,lT).call(this)}catch(t){this.log.warn("[#maybeConfigureDecoder] configure failed, falling back to placeholder decode",t),U(Pe,this,null),U(Ce,this,!1),U(We,this,null)}}function pT(){void 0!==eu.VideoDecoder&&void 0!==eu.EncodedVideoChunk&&(z(De,this)||!z(Me,this)||z(Oe,this)||z(Fe,this)||z(Ce,this)&&z(Pe,this)&&"function"==typeof z(Pe,this).flush&&(z(Ee,this).length||(U(Fe,this,!0),Promise.resolve().then((()=>z(Pe,this).flush())).then((()=>{U(Oe,this,!0),U(Ae,this,!0)})).catch((t=>{"AbortError"!==(null==t?void 0:t.name)&&this.log.warn("[#maybeFlushDecoder] flush failed",t)})).finally((()=>{U(Fe,this,!1)})))))}function mT(t){if(this.log.warn("[#handleDecoderError] decoder error",t),this.trigger("decoder:error",{error:t}),z(Pe,this)&&"function"==typeof z(Pe,this).close)try{z(Pe,this).close()}catch(t){}U(Pe,this,null),U(Ce,this,!1),U(Fe,this,!1),U(Oe,this,!1),U(Ae,this,!0),z(Ne,this).clear(),U(De,this,!0),U(Re,this,B(tn,this,hT).call(this)+1e3)}function gT(t){U(Ze,this,z(Ze,this).then((()=>{var e;if(!this._disposed)return B(tn,this,wT).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 vT(t){return"boolean"!=typeof t||t}function yT(t){const e=Number(t);return!Number.isFinite(e)||e<0?.2:e}function bT(){return!!z(Qe,this)&&"function"==typeof eu.createImageBitmap&&z(Ye,this)}function kT(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(z(Ue,this));return!!Number.isFinite(i)&&t>=i+n-z(Je,this)}async function xT(t,e){try{var n;const i=B(tn,this,kT).call(this,e),r=await eu.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 wT(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/M_:z(Ie,this)?z(Ie,this).call(this):0,s="number"==typeof t.duration?t.duration/M_:void 0;let a;void 0!==r&&(a=z(Ne,this).get(r),z(Ne,this).delete(r));try{var l,c,u,d;let e=z(Ie,this)?z(Ie,this).call(this):0,n=B(tn,this,oT).call(this,e);if(o<e||o>n)return void(null===(l=(c=i).close)||void 0===l||l.call(c));if(B(tn,this,bT).call(this)){var h,f,p,m;if(i=await B(tn,this,xT).call(this,t,o),this._disposed)return void(null===(h=(f=i).close)||void 0===h||h.call(f));if(e=z(Ie,this)?z(Ie,this).call(this):0,n=B(tn,this,oT).call(this,e),o<e||o>n)return void(null===(p=(m=i).close)||void 0===p||p.call(m))}if(B(tn,this,_T).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};z(xe,this).push(r),B(tn,this,TT).call(this),this.trigger("decoder:frame",r),B(tn,this,sT).call(this,o),this.log.debug(`[#handleDecodedFrame] [${z(ze,this).codec}] Decoded frame:`,r)}catch(t){this.log.warn(`[#handleDecodedFrame] [${z(ze,this).codec}] Failed to handle decoded frame`,t);try{var g,v;null===(g=(v=i).close)||void 0===g||g.call(v)}catch(t){}}}function _T(t){const e=B(tn,this,oT).call(this,t),n=[];z(xe,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)})),U(xe,this,n)}function TT(){const t=z(_e,this);if(!Number.isFinite(t)||t<=0)return;if(z(xe,this).length<=t)return;const e=z(xe,this).length-t;z(xe,this).splice(0,e)}function IT(t){const e=Number(t);return!Number.isFinite(e)||e<=0?0:Math.floor(e)}function ET(){const t=z(_e,this);return!(!Number.isFinite(t)||t<=0)&&z(xe,this).length>=t}function ST(t){const e=Number(t);return!Number.isFinite(e)||e<=0?0:Math.floor(e)}function NT(){var t;const e=z(Te,this);if(!Number.isFinite(e)||e<=0)return!1;const n=Number(null===(t=z(Pe,this))||void 0===t?void 0:t.decodeQueueSize);return!!Number.isFinite(n)&&n>=e}function AT(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 MT extends Jc{get name(){return"DecoderFactory"}create(t,e){if(!t||!t.type)return new dx(e);const n=D_[t.type];return n?(this.log.debug(`[#create] [${t.type}] Creating decoder:`,n),new n(e)):new dx(e)}}class FT{#j;#$;#q;#V;constructor(t={}){this.#j=t.getActiveRenderPlacement,this.#$=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.#$?this.#$:()=>[],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 OT{#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 PT=new Set(["video","audio","image"]);function CT(t){const e=Number(t);return Number.isFinite(e)?e:0}var DT=new WeakMap,RT=new WeakMap,BT=new WeakMap,LT=new WeakMap,zT=new WeakMap,WT=new WeakMap,UT=new WeakMap,jT=new WeakMap,$T=new WeakMap,qT=new WeakMap,VT=new WeakMap,GT=new WeakMap,HT=new WeakMap,KT=new WeakMap,XT=new WeakMap,YT=new WeakMap,QT=new WeakMap,JT=new WeakMap,ZT=new WeakMap,tI=new WeakSet;class eI extends Jc{constructor(...t){super(...t),j(this,tI),W(this,DT,void 0),W(this,RT,void 0),W(this,BT,void 0),W(this,LT,void 0),W(this,zT,void 0),W(this,WT,void 0),W(this,UT,void 0),W(this,jT,void 0),W(this,$T,void 0),W(this,qT,void 0),W(this,VT,void 0),W(this,GT,new Map),W(this,HT,new Map),W(this,KT,new Map),W(this,XT,new Map),W(this,YT,new Set),W(this,QT,0),W(this,JT,!1),W(this,ZT,null);const[e,n,i]=t;U(DT,this,e),U(RT,this,n),U(BT,this,i||new MT),U(LT,this,new OT({getNode:t=>B(tI,this,II).call(this,t),getPlacementState:t=>z(GT,this).get(t),getDecodeTracks:t=>B(tI,this,kI).call(this,t),getSegmentIdForTrackAtTime:(t,e,n)=>B(tI,this,cI).call(this,t,e,n),decodeLoadedMediaSegment:(t,e,n)=>{B(tI,this,VI).call(this,t,e,n)},decodeLoadedMediaSegmentsAfter:(t,e,n)=>{B(tI,this,BI).call(this,t,e,n)}})),U(zT,this,new FT({getActiveRenderPlacement:t=>{var e,n;return null===(e=z(RT,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=z(RT,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=z(LT,this))||void 0===n||null===(i=n.ensureDecodedForPlacementAtTime)||void 0===i||i.call(n,t,e)}})),B(tI,this,nI).call(this),B(tI,this,vI).call(this)}get name(){return"DecodeCoordinator"}onDispose(){var t,e;z(RT,this)&&"function"==typeof z(RT,this).off&&z(WT,this)&&z(RT,this).off(Jp.PLACEMENT_ADDED,z(WT,this)),z(RT,this)&&"function"==typeof z(RT,this).off&&z(UT,this)&&z(RT,this).off(Jp.TIMELINE_SEEKING,z(UT,this)),z(RT,this)&&"function"==typeof z(RT,this).off&&z(jT,this)&&z(RT,this).off(Jp.TIMELINE_SEEKED,z(jT,this)),z(RT,this)&&"function"==typeof z(RT,this).off&&z($T,this)&&z(RT,this).off(Jp.TIMELINE_TIME_UPDATE,z($T,this)),z(RT,this)&&"function"==typeof z(RT,this).off&&z(qT,this)&&z(RT,this).off(Jp.TIMELINE_RESET,z(qT,this)),B(tI,this,iI).call(this),U(WT,this,null),U(UT,this,null),U(jT,this,null),U($T,this,null),U(qT,this,null),null!==(t=z(LT,this))&&void 0!==t&&null!==(e=t.dispose)&&void 0!==e&&e.call(t),U(LT,this,null),z(zT,this)&&"function"==typeof z(zT,this).dispose&&z(zT,this).dispose(),U(zT,this,null),z(HT,this).forEach(((t,e)=>{const n=B(tI,this,II).call(this,e);n&&"function"==typeof n.off&&n.off("node:loaded",t)})),z(HT,this).clear(),z(KT,this).forEach(((t,e)=>{const n=B(tI,this,II).call(this,e);n&&"function"==typeof n.off&&n.off("segment:chunk",t)})),z(KT,this).clear(),z(XT,this).clear(),z(YT,this).clear(),B(tI,this,pI).call(this),z(GT,this).forEach((({trackStates:t})=>{t&&t.forEach((t=>{B(tI,this,AI).call(this,t)}))})),z(GT,this).clear()}}function nI(){z(RT,this)&&"function"==typeof z(RT,this).on&&(U(WT,this,(t=>{B(tI,this,yI).call(this,t)})),z(RT,this).on(Jp.PLACEMENT_ADDED,z(WT,this)),U(UT,this,(t=>B(tI,this,rI).call(this,t))),z(RT,this).on(Jp.TIMELINE_SEEKING,z(UT,this)),U(jT,this,(()=>B(tI,this,oI).call(this))),z(RT,this).on(Jp.TIMELINE_SEEKED,z(jT,this)),U($T,this,(t=>B(tI,this,sI).call(this,t))),z(RT,this).on(Jp.TIMELINE_TIME_UPDATE,z($T,this)),U(qT,this,(()=>B(tI,this,aI).call(this))),z(RT,this).on(Jp.TIMELINE_RESET,z(qT,this))),(null==eu?void 0:eu.document)&&"function"==typeof eu.document.addEventListener&&(U(VT,this,(()=>{B(tI,this,mI).call(this)})),eu.document.addEventListener("visibilitychange",z(VT,this)))}function iI(){z(VT,this)&&null!=eu&&eu.document&&"function"==typeof eu.document.removeEventListener&&eu.document.removeEventListener("visibilitychange",z(VT,this)),U(VT,this,null)}function rI(t={}){const e=Number(null==t?void 0:t.targetTime);Number.isFinite(e)&&(z(GT,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||(B(tI,this,lI).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=z(GT,this).get(n);if(!r||!r.trackStates)return;const o=B(tI,this,II).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||B(tI,this,lI).call(this,n,r.placement||t,e)})),B(tI,this,RI).call(this,r.placement||t,o))})))}function oI(){z(GT,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 sI(t={}){var e,n;B(tI,this,DI).call(this,null==t?void 0:t.time),null!==(e=z(zT,this))&&void 0!==e&&null!==(n=e.handleTimeUpdate)&&void 0!==n&&n.call(e,t),B(tI,this,mI).call(this),B(tI,this,MI).call(this,null==t?void 0:t.time)}function aI(){z(HT,this).forEach(((t,e)=>{const n=B(tI,this,II).call(this,e);n&&"function"==typeof n.off&&n.off("node:loaded",t)})),z(HT,this).clear(),z(KT,this).forEach(((t,e)=>{const n=B(tI,this,II).call(this,e);n&&"function"==typeof n.off&&n.off("segment:chunk",t)})),z(KT,this).clear(),z(XT,this).clear(),z(YT,this).clear(),z(GT,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()}))}))})),z(GT,this).clear()}function lI(t,e,n){t&&(B(tI,this,AI).call(this,t),t.seekSegmentId=B(tI,this,cI).call(this,t.track,e,n))}function cI(t,e,n){if(!t||!e||!Array.isArray(t.segments))return null;const i=ep(e);if(!Number.isFinite(i))return null;const r=CT(null==e?void 0:e.nodeOffsetOverride),o=Math.max(0,n-i+r),s=CT(null==t?void 0:t.offset),a=Math.max(0,o-s),l="function"==typeof t.getMediaSegmentAtTime?t.getMediaSegmentAtTime(a,{preferRepresentationTime:!0}):Sv(t.segments,a,{preferRepresentationTime:!0});return(null==l?void 0:l.id)||null}function uI(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 dI(){const t=null==eu?void 0:eu.document;return!t||"string"!=typeof t.visibilityState||"visible"===t.visibilityState}function hI(){var t;const e=z(RT,this);if(!e||"number"!=typeof e.currentTime)return!1;if(e.state===sm)return!1;const n=Date.now();if(n<z(QT,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=B(tI,this,fI).call(this,i),!Number.isFinite(a))return!1;return U(QT,this,n+1500),this.log.warn("[DecodeCoordinator] attempting decoder recovery seek"),e.currentTime=a,!0}function fI(t){var e;const n=z(RT,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=ep(t);if(!Number.isFinite(e))return;(!Number.isFinite(d)||e<d)&&(d=e);const n=Zf(t,z(DT,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 pI(){U(JT,this,!1),U(ZT,this,null)}function mI(){z(JT,this)&&B(tI,this,dI).call(this)&&B(tI,this,hI).call(this)}function gI(t){if(!B(tI,this,uI).call(this,t))return;const e=z(RT,this);e&&"number"==typeof e.currentTime&&(U(JT,this,!0),U(ZT,this,t),B(tI,this,dI).call(this)&&B(tI,this,hI).call(this))}function vI(t){var e;(Array.isArray(null===(e=z(RT,this))||void 0===e?void 0:e.placements)?[...z(RT,this).placements]:[]).filter((e=>"function"!=typeof t||t(e))).sort(((t,e)=>{const n=ep(t),i=ep(e);return(Number.isFinite(n)?n:Number.POSITIVE_INFINITY)-(Number.isFinite(i)?i:Number.POSITIVE_INFINITY)})).forEach((t=>{B(tI,this,yI).call(this,t)}))}async function yI(t){if(!t||!t.placementId||z(GT,this).has(t.placementId))return;const e=t.nodeId;if(!e||!z(DT,this)||"function"!=typeof z(DT,this).get)return;const n=B(tI,this,II).call(this,e);if(n){if(n.state&&"ready"!==n.state){if("function"==typeof n.resolve)try{await n.resolve()}catch(t){return void this.log.warn(`[#processPlacement] Failed to resolve node ${e}`,t)}if("ready"!==n.state)return}if(B(tI,this,CI).call(this,t))return B(tI,this,PI).call(this,t,n),void z(YT,this).add(t.placementId);B(tI,this,OI).call(this,t,n)}}function bI(t){return B(tI,this,kI).call(this,t).every((t=>B(tI,this,FI).call(this,t)))}function kI(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).filter((t=>PT.has(null==t?void 0:t.type)))}function xI(t){if(!t||!t.id||"function"!=typeof t.on)return;if(z(HT,this).has(t.id))return;const e=()=>{B(tI,this,LI).call(this,t.id)};t.on("node:loaded",e),z(HT,this).set(t.id,e)}function wI(t){if(!t||!t.id||"function"!=typeof t.on)return;if(z(KT,this).has(t.id))return;const e=t=>B(tI,this,zI).call(this,t);t.on("segment:chunk",e),z(KT,this).set(t.id,e)}function _I(t,e){if(!t||!e)return;const n=z(XT,this).get(t)||new Set;n.add(e),z(XT,this).set(t,n)}function TI(t){return z(XT,this).get(t)||new Set}function II(t){if(t&&z(DT,this)&&"function"==typeof z(DT,this).get)return z(DT,this).get(t)}function EI(t){if(!t)return;const e=t.fullBufferRetryTimer;null!=e&&("function"==typeof(null==eu?void 0:eu.clearTimeout)?eu.clearTimeout.bind(eu):clearTimeout)(e),t.fullBufferRetryTimer=null,t.fullBufferDecodeScheduled=!1,t.fullBufferRetryAttempts=0}function SI(t){const e=null==t?void 0:t.segmentStates;e&&"function"==typeof e.forEach&&e.forEach((t=>{B(tI,this,EI).call(this,t)}))}function NI(t,e,n,i){var r,o;if(!(t&&e&&n&&i))return!1;const s=z(GT,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 AI(t){if(!t)return;B(tI,this,SI).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 MI(t){const e=CT(t);if(!Number.isFinite(e))return;const n=e-2;Number.isFinite(n)&&z(GT,this).forEach((t=>{const e=null==t?void 0:t.placement;if(!e)return;const i=ep(e),r=Zf(e,z(DT,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||B(tI,this,AI).call(this,t)}))}))}function FI(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 OI(t,e){if(this.log.debug(`[#startDecode] [${t.placementId}] [${e.id}] Starting decode`),B(tI,this,PI).call(this,t,e)){if(B(tI,this,_I).call(this,e.id,t.placementId),!B(tI,this,bI).call(this,e))return B(tI,this,xI).call(this,e),void B(tI,this,wI).call(this,e);B(tI,this,RI).call(this,t,e),B(tI,this,wI).call(this,e)}}function PI(t,e){if(!t||!t.placementId||!e)return;const n=z(GT,this).get(t.placementId);if(n)return n.placement=t,n;const i=B(tI,this,kI).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(Jp.DECODE_ERROR,em({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 z(GT,this).set(t.placementId,o),o}function CI(t){var e;const n=ep(t),i=CT(null===(e=z(RT,this))||void 0===e?void 0:e.currentTime);return!Number.isFinite(n)||!!Number.isFinite(i)&&n-i>2}function DI(t){if(!z(YT,this).size)return;const e=CT(t);if(!Number.isFinite(e))return;const n=[];z(YT,this).forEach((t=>{const i=z(GT,this).get(t),r=null==i?void 0:i.placement;if(!r)return void n.push(t);const o=ep(r);Number.isFinite(o)&&o-e<=2&&n.push(t)})),n.forEach((t=>{z(YT,this).delete(t);const e=z(GT,this).get(t),n=null==e?void 0:e.placement;if(!n)return;const i=B(tI,this,II).call(this,n.nodeId);i&&B(tI,this,OI).call(this,n,i)}))}function RI(t,e){const n=z(GT,this).get(t.placementId);n&&B(tI,this,kI).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;B(tI,this,VI).call(this,t,i,n),r.seekSegmentId&&"video"===(null==i?void 0:i.type)&&B(tI,this,BI).call(this,t,i,n),r.ready=!0,this.trigger(Jp.DECODE_READY,tm({placementId:t.placementId,nodeId:e.id,trackId:i.id,trackType:i.type}))}catch(n){this.trigger(Jp.DECODE_ERROR,em({placementId:t.placementId,nodeId:e.id,trackId:null==i?void 0:i.id,trackType:null==i?void 0:i.type,error:n}))}}))}function BI(t,e,n){var i;if(!(t&&e&&n&&Array.isArray(e.segments)))return;const r=null==t?void 0:t.placementId,o=r?z(GT,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(B(tI,this,VI).call(this,t,e,i),u+=1,u>=2)break}}function LI(t){const e=B(tI,this,II).call(this,t);e&&B(tI,this,bI).call(this,e)&&B(tI,this,TI).call(this,t).forEach((t=>{const n=z(GT,this).get(t);B(tI,this,RI).call(this,(null==n?void 0:n.placement)||{placementId:t},e)}))}function zI(t){t&&t.nodeId&&t.trackId&&t.chunk&&B(tI,this,TI).call(this,t.nodeId).forEach((e=>B(tI,this,WI).call(this,e,t)))}function WI(t,e){const n=z(GT,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&&B(tI,this,VI).call(this,n.placement,s,a)&&(i.ready=!0,this.trigger(Jp.DECODE_READY,tm({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType}))));if((null===(o=z(RT,this))||void 0===o?void 0:o.state)===sm&&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=B(tI,this,$I).call(this,n.placement,s,a);if(!u||"function"!=typeof u.decodeChunk)return;if(i.hasInit&&!c.initSent){const t=B(tI,this,qI).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;B(tI,this,UI).call(this,c,e)?d&&!c.ended&&B(tI,this,jI).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(Jp.DECODE_READY,tm({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType})))}catch(n){this.trigger(Jp.DECODE_ERROR,em({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType,error:n}))}}function UI(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 jI(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==eu?void 0:eu.setTimeout)?eu.setTimeout.bind(eu):setTimeout;i.fullBufferDecodeScheduled=!0,i.fullBufferRetryAttempts=0;const l=()=>{if(!B(tI,this,NI).call(this,r,o,s,i)||i.ended)return void B(tI,this,EI).call(this,i);if(B(tI,this,VI).call(this,t,e,n))return void B(tI,this,EI).call(this,i);i.fullBufferRetryAttempts+=1;const c=i.fullBufferRetryAttempts<=8?0:50;i.fullBufferRetryTimer=a((()=>{l()}),c)};i.fullBufferRetryTimer=a((()=>{l()}),0)}function $I(t,e,n){var i,r;const o=null==t?void 0:t.placementId;if(!o||!e||!n)return;const s=z(GT,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=z(BT,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=z(RT,this))||void 0===t?void 0:t.currentTime)?z(RT,this).currentTime:0})),c&&"function"==typeof c.setTimeOffsetSeconds){var u,d;const i=ep(t),r=CT(null==e?void 0:e.offset),o=CT(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=z(RT,this))||void 0===r?void 0:r.state)===sm&&"video"===(null==e?void 0:e.type)&&c.setSeekTargetTimeSeconds(z(RT,this).currentTime),c&&"function"==typeof c.on&&(c.on(Jp.DECODER_FRAME,(i=>{i&&(!z(JT,this)||"video"!==(null==e?void 0:e.type)&&"image"!==(null==e?void 0:e.type)||(U(JT,this,!1),U(ZT,this,null)),z(RT,this)&&"function"==typeof z(RT,this).notifyDecodedFrame&&(i.frame||i.data)&&z(RT,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(Jp.DECODER_AUDIO,(i=>{i&&i.audioBuffer&&this.trigger(Jp.DECODER_AUDIO,tm({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(Jp.DECODER_ERROR,(i=>{const r=(null==i?void 0:i.error)||i;this.trigger(Jp.DECODER_ERROR,em({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})),B(tI,this,gI).call(this,r)}))),a.segmentDecoders.set(n.id,c),c}function qI(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 VI(t,e,n){var i;if(!t||!e||!n)return!1;const r=t.placementId,o=z(GT,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=B(tI,this,$I).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 B(tI,this,EI).call(this,l),!0;if(s.hasInit&&!l.initSent){const t=B(tI,this,qI).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()),B(tI,this,EI).call(this,l),0))}const GI=1e-6;var HI=new WeakMap,KI=new WeakMap,XI=new WeakMap,YI=new WeakMap,QI=new WeakMap,JI=new WeakMap,ZI=new WeakMap,tE=new WeakMap,eE=new WeakSet;class nE extends Jc{get name(){return"TransitionManager"}get defaults(){return{durationSeconds:.5}}constructor(t,e,n){super(n),j(this,eE),W(this,HI,void 0),W(this,KI,void 0),W(this,XI,null),W(this,YI,null),W(this,QI,null),W(this,JI,0),W(this,ZI,[]),W(this,tE,null),U(HI,this,t),U(KI,this,e),z(HI,this)&&"function"==typeof z(HI,this).on&&(U(tE,this,(()=>B(eE,this,dE).call(this))),z(HI,this).on(Jp.TIMELINE_RESET,z(tE,this)))}transitionTo(t,e={}){const n=Number(t);if(!Number.isFinite(n))throw new Error("TransitionManager.transitionTo requires a numeric time");B(eE,this,dE).call(this);const i=B(eE,this,iE).call(this),r=B(eE,this,aE).call(this,n,e);return r?B(eE,this,lE).call(this,n,e,i,r):Promise.resolve()}onDispose(){z(HI,this)&&"function"==typeof z(HI,this).off&&z(tE,this)&&z(HI,this).off(Jp.TIMELINE_RESET,z(tE,this)),U(tE,this,null),B(eE,this,dE).call(this),U(KI,this,null),U(HI,this,null)}}function iE(){return U(JI,this,z(JI,this)+1),z(JI,this)}function rE(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 oE(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 sE(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 aE(t,e={}){var n;const i=z(KI,this),r=B(eE,this,rE).call(this,e);if(!i||"function"!=typeof i.startTransition)return z(HI,this).currentTime=t,null;if(!(r>0))return z(HI,this).currentTime=t,null!==(n=i.resetTransition)&&void 0!==n&&n.call(i),null;const o=B(eE,this,oE).call(this,e,r);"function"==typeof(null==e?void 0:e.onTransitionInStart)&&e.onTransitionInStart();const s=i.startTransition(o),{outDurationMs:a,inDurationMs:l}=B(eE,this,sE).call(this,r,s);return{renderer:i,transitionOptions:o,outDurationMs:a,inDurationMs:l,shouldWaitForFrames:!1!==(null==e?void 0:e.waitForVisualFrames)}}function lE(t,e={},n,i){const{renderer:r,transitionOptions:o,outDurationMs:s,inDurationMs:a,shouldWaitForFrames:l}=i,c=B(eE,this,gE).call(this,t,e,n),u=l?B(eE,this,vE).call(this,t,n):Promise.resolve();let d=!1,h=!1,f=!1,p=!l;const m=()=>{var t;B(eE,this,hE).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),U(YI,this,setTimeout((()=>{var t;B(eE,this,hE).call(this,n)&&(null!==(t=r.resetTransition)&&void 0!==t&&t.call(r),"function"==typeof(null==e?void 0:e.onTransitionOutEnd)&&e.onTransitionOutEnd(),B(eE,this,cE).call(this))}),a)))};return U(XI,this,setTimeout((()=>{d=!0,m()}),s)),c.then((()=>{h=!0,m()})).catch((()=>{var t;B(eE,this,hE).call(this,n)&&(null!==(t=r.resetTransition)&&void 0!==t&&t.call(r),B(eE,this,cE).call(this))})),u.then((()=>{p=!0,m()})).catch((()=>{p=!0,m()})),z(HI,this).currentTime=t,new Promise((t=>{U(QI,this,t)}))}function cE(){const t=z(QI,this);U(QI,this,null),B(eE,this,uE).call(this),B(eE,this,mE).call(this),t&&t()}function uE(){z(XI,this)&&clearTimeout(z(XI,this)),z(YI,this)&&clearTimeout(z(YI,this)),U(XI,this,null),U(YI,this,null)}function dE(){var t,e;z(KI,this)&&null!==(t=(e=z(KI,this)).resetTransition)&&void 0!==t&&t.call(e),B(eE,this,uE).call(this),B(eE,this,mE).call(this),z(QI,this)&&(z(QI,this).call(this),U(QI,this,null))}function hE(t){return z(JI,this)===t}function fE(t,e){z(HI,this)&&"function"==typeof z(HI,this).on&&(z(HI,this).on(t,e),z(ZI,this).push({eventName:t,handler:e}))}function pE(t,e){z(HI,this)&&"function"==typeof z(HI,this).off&&(z(HI,this).off(t,e),U(ZI,this,z(ZI,this).filter((n=>n.eventName!==t||n.handler!==e))))}function mE(){z(HI,this)&&"function"==typeof z(HI,this).off?(z(ZI,this).forEach((t=>{z(HI,this).off(t.eventName,t.handler)})),U(ZI,this,[])):U(ZI,this,[])}function gE(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(!z(HI,this)||"function"!=typeof z(HI,this).on)return Promise.resolve();const r=B(eE,this,yE).call(this);return new Promise((e=>{let i=!1;const o=r?Jp.TIMELINE_SEEKED:"nodestart";let s,a;const l=()=>{B(eE,this,pE).call(this,Jp.TIMELINE_SEEKING,s),B(eE,this,pE).call(this,o,a),e()};s=(e={})=>{B(eE,this,hE).call(this,n)?B(eE,this,bE).call(this,e,t)&&(i=!0):l()},a=(e={})=>{B(eE,this,hE).call(this,n)?(o!==Jp.TIMELINE_SEEKED||B(eE,this,bE).call(this,e,t))&&(o===Jp.TIMELINE_SEEKED||i)&&l():l()},B(eE,this,fE).call(this,Jp.TIMELINE_SEEKING,s),B(eE,this,fE).call(this,o,a)}))}function vE(t,e){if(!z(HI,this)||"function"!=typeof z(HI,this).on)return Promise.resolve();const n=Number(t);return new Promise((t=>{const i=(r={})=>{if(!B(eE,this,hE).call(this,e))return B(eE,this,pE).call(this,Jp.VISUAL_FRAMES_AVAILABLE,i),void t();const o=Number(null==r?void 0:r.time);Number.isFinite(n)&&Number.isFinite(o)&&o+GI<n||(Array.isArray(null==r?void 0:r.frames)?r.frames:[]).length&&(B(eE,this,pE).call(this,Jp.VISUAL_FRAMES_AVAILABLE,i),t())};B(eE,this,fE).call(this,Jp.VISUAL_FRAMES_AVAILABLE,i)}))}function yE(){var t,e;const n=null===(t=z(HI,this))||void 0===t?void 0:t.state;if(n===om||n===nm)return!0;const i=null===(e=z(HI,this))||void 0===e?void 0:e.placements;return!Array.isArray(i)||0===i.length}function bE(t,e){const n=Number(null==t?void 0:t.targetTime);return!Number.isFinite(n)||Math.abs(n-e)<GI}function kE(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}var xE=new WeakMap,wE=new WeakMap,_E=new WeakMap,TE=new WeakMap,IE=new WeakMap,EE=new WeakMap,SE=new WeakMap,NE=new WeakMap,AE=new WeakMap,ME=new WeakMap,FE=new WeakMap,OE=new WeakMap,PE=new WeakMap,CE=new WeakMap,DE=new WeakSet;class RE extends Jc{get name(){return"AudioPlaybackManager"}get defaults(){return{muted:!1,volume:1,lookaheadSeconds:1}}constructor(t,e,n){super(n),j(this,DE),W(this,xE,void 0),W(this,wE,void 0),W(this,_E,null),W(this,TE,null),W(this,IE,[]),W(this,EE,new Set),W(this,SE,new Map),W(this,NE,!1),W(this,AE,1),W(this,ME,!0),W(this,FE,null),W(this,OE,null),W(this,PE,null),W(this,CE,null),U(xE,this,t),U(wE,this,e),U(NE,this,!!this.settings.muted),U(AE,this,Qf(this.settings.volume));const i=Array.isArray(null==n?void 0:n.disabledTracks)?n.disabledTracks:[];U(ME,this,!i.includes("audio")),B(DE,this,BE).call(this)}get muted(){return z(NE,this)}set muted(t){U(NE,this,!!t),B(DE,this,KE).call(this)}get volume(){return z(AE,this)}set volume(t){U(AE,this,Qf(t)),B(DE,this,KE).call(this)}handleDecodedAudio(t={}){if(!z(ME,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=kE(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}`;z(EE,this).has(s)||(z(IE,this).push({key:s,placementId:n,pts:r,duration:o,audioBuffer:e}),z(IE,this).sort(((t,e)=>t.pts-e.pts)),B(DE,this,jE).call(this))}onDispose(){B(DE,this,LE).call(this),B(DE,this,GE).call(this,!0),z(_E,this)&&"function"==typeof z(_E,this).close&&z(_E,this).close(),U(_E,this,null),U(TE,this,null),U(xE,this,null),U(wE,this,null)}}function BE(){z(xE,this)&&"function"==typeof z(xE,this).on&&(U(FE,this,(t=>B(DE,this,zE).call(this,t))),z(xE,this).on(Jp.TIMELINE_TIME_UPDATE,z(FE,this)),U(OE,this,(t=>B(DE,this,WE).call(this,t))),z(xE,this).on(Jp.TIMELINE_STATE_CHANGE,z(OE,this)),U(CE,this,(()=>B(DE,this,UE).call(this))),z(xE,this).on(Jp.TIMELINE_RESET,z(CE,this))),z(wE,this)&&"function"==typeof z(wE,this).on&&(U(PE,this,(t=>this.handleDecodedAudio(t))),z(wE,this).on(Jp.DECODER_AUDIO,z(PE,this)))}function LE(){z(xE,this)&&"function"==typeof z(xE,this).off&&(z(FE,this)&&z(xE,this).off(Jp.TIMELINE_TIME_UPDATE,z(FE,this)),z(OE,this)&&z(xE,this).off(Jp.TIMELINE_STATE_CHANGE,z(OE,this)),z(CE,this)&&z(xE,this).off(Jp.TIMELINE_RESET,z(CE,this))),z(wE,this)&&"function"==typeof z(wE,this).off&&z(PE,this)&&z(wE,this).off(Jp.DECODER_AUDIO,z(PE,this)),U(FE,this,null),U(OE,this,null),U(PE,this,null),U(CE,this,null)}function zE(){B(DE,this,jE).call(this)}function WE(t={}){const e=null==t?void 0:t.to;if(e)return e===im?(B(DE,this,XE).call(this),void B(DE,this,jE).call(this)):void(e!==om&&e!==rm?e!==sm&&e!==am||B(DE,this,UE).call(this):B(DE,this,YE).call(this))}function UE(){B(DE,this,YE).call(this),B(DE,this,GE).call(this,!0),U(IE,this,[])}function jE(){if(!z(ME,this)||!z(xE,this))return;if(z(xE,this).state!==im)return;const t=B(DE,this,HE).call(this);if(!t)return;const e=kE(z(xE,this).currentTime,0),n=e+Math.max(0,kE(this.settings.lookaheadSeconds,1)),i=[];for(let r=0;r<z(IE,this).length;r+=1){const o=z(IE,this)[r];o&&(o.pts>n?i.push(o):B(DE,this,$E).call(this,o)&&B(DE,this,VE).call(this,o,t,e))}U(IE,this,i)}function $E(t){if(!t||!z(xE,this))return!1;const e=B(DE,this,qE).call(this,t.pts);return!(!e||e!==t.placementId)}function qE(t){if(!z(xE,this)||"function"!=typeof z(xE,this).getPlacementsActiveAtTime)return null;const e=z(xE,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 VE(t,e,n){const i=t.key;if(z(EE,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(z(TE,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)}z(EE,this).add(i),z(SE,this).set(i,l),l.onended=()=>{z(SE,this).delete(i)}}function GE(t){z(SE,this).forEach(((t,e)=>{if(t&&"function"==typeof t.stop)try{t.stop()}catch(t){}z(SE,this).delete(e)})),t&&z(EE,this).clear()}function HE(){if(z(_E,this))return z(_E,this);const t=eu.AudioContext||eu.webkitAudioContext;if(!t)return this.log.warn("[AudioPlaybackManager] AudioContext is not available."),null;try{return U(_E,this,new t),U(TE,this,z(_E,this).createGain()),z(TE,this).connect(z(_E,this).destination),B(DE,this,KE).call(this),z(_E,this)}catch(t){return this.log.warn("[AudioPlaybackManager] Failed to initialize AudioContext",t),U(_E,this,null),U(TE,this,null),null}}function KE(){if(!z(TE,this))return;const t=z(NE,this)?0:z(AE,this);z(TE,this).gain.value=t}function XE(){z(_E,this)&&"function"==typeof z(_E,this).resume&&"suspended"===z(_E,this).state&&z(_E,this).resume().catch((()=>{}))}function YE(){z(_E,this)&&"function"==typeof z(_E,this).suspend&&"running"===z(_E,this).state&&z(_E,this).suspend().catch((()=>{}))}var QE=new WeakMap,JE=new WeakMap,ZE=new WeakMap,tS=new WeakMap,eS=new WeakMap,nS=new WeakSet;class iS extends Jc{constructor(...t){super(...t),j(this,nS),W(this,QE,void 0),W(this,JE,void 0),W(this,ZE,void 0),W(this,tS,void 0),W(this,eS,void 0),U(QE,this,B(nS,this,oS).call(this,this.settings.currentTime)),U(JE,this,B(nS,this,sS).call(this,this.settings.playbackRate)),U(ZE,this,null),U(tS,this,!1),U(eS,this,B(nS,this,rS).bind(this))}get name(){return"PlaybackClock"}get defaults(){return{currentTime:0,playbackRate:sv("playbackRate")}}get currentTime(){return z(QE,this)}get playbackRate(){return z(JE,this)}set playbackRate(t){U(JE,this,B(nS,this,sS).call(this,t))}play(){z(tS,this)||(U(tS,this,!0),U(ZE,this,$g()),Tb(z(eS,this),0))}pause(){z(tS,this)&&(U(tS,this,!1),Ib(z(eS,this)))}seek(t){U(QE,this,B(nS,this,oS).call(this,t)),U(ZE,this,$g())}reset(){this.pause(),U(QE,this,0),U(ZE,this,null)}onDispose(){this.pause(),U(eS,this,null)}}function rS(){const t=$g();if(null===z(ZE,this))return U(ZE,this,t),void this.trigger(Jp.CLOCK_TICK,{currentTime:z(QE,this)});const e=t-z(ZE,this);U(ZE,this,t);const n=e/1e3;U(QE,this,z(QE,this)+n*z(JE,this)),this.trigger(Jp.CLOCK_TICK,{currentTime:z(QE,this)})}function oS(t){return"number"!=typeof t||Number.isNaN(t)||!Number.isFinite(t)||t<0?0:t}function sS(t){return"number"!=typeof t||Number.isNaN(t)||!Number.isFinite(t)||t<=0?z(JE,this)||1:t}var aS=new WeakMap,lS=new WeakSet;class cS extends Jc{constructor(...t){super(...t),j(this,lS),W(this,aS,new Map)}get name(){return"TrackBuffers"}get defaults(){return{}}refreshNode(t){if(!t||!Array.isArray(t.tracks))return;const e=t.id,n=z(aS,this).get(e)||new Map;z(aS,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(Jp.TRACK_BUFFER_UPDATE,{nodeId:e,trackType:i,range:r})),!s&&a?this.trigger(Jp.TRACK_READY,{nodeId:e,trackType:i,range:r}):s&&!a&&this.trigger(Jp.TRACK_UNDERFLOW,{nodeId:e,trackType:i,range:r})}))}getTrackRange(t,e){const n=z(aS,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=B(lS,this,dS).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 z(aS,this)}reset(){z(aS,this).clear()}onDispose(){z(aS,this).clear(),"function"==typeof this.off&&this.off()}}function uS(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 dS(t,e,n=0){var i,r;const o=ep(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 B(lS,this,hS).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=B(lS,this,uS).call(this,d,u)||(null===(r=d)||void 0===r?void 0:r.buffered);return h&&Number.isFinite(h.start)&&Number.isFinite(h.end)?B(lS,this,hS).call(this,s,h,o,e):void 0}function hS(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 fS{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 pS extends Jc{constructor(t,e){super(e),this.timeline=t}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"handleDecodedFrame","handleClockTick","handleMainTrackBufferUpdate"])}enter(){}exit(){}play(){this.timeline.transitionTo(im)}pause(){this.timeline.transitionTo(om)}wait(){this.timeline.transitionTo(rm)}reset(){this.timeline.transitionTo(am)}seek(t){this.timeline.transitionTo(sm,{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()||om;this.timeline.transitionTo(e)}handleMainTrackBufferUpdate(t){}handleDecodedFrame(t){}handleClockTick(t){}onDispose(){this.timeline=null}}const mS=24e3/1001;function gS(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 vS(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 yS(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 bS(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 kS(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:mS)}(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+vS(t)}function xS(t,e=(null==t?void 0:t.currentTime)){const n=gS(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=yS(o);if(!s)return!0;if(!t.hasDecodedFirstFrame(r,s))return!0}return!1}function wS(t,e=(null==t?void 0:t.currentTime)){return xS(t,e)||function(t,e=(null==t?void 0:t.currentTime)){const n=gS(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=bS(s);if(null!=a&&a.id&&!kS(t,o,a.id,a.type,n))return!0}return!1}(t,e)}function _S(t,e=(null==t?void 0:t.currentTime)){if("function"!=typeof(null==t?void 0:t.computeBuffered))return!1;const n=gS(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=vS(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=ep(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 TS={[nm]:class extends pS{get name(){return nm}get defaults(){return{autoplay:sv("autoplay")}}enter(){this.timeline.recordStableState(om),this.timeline.stopPlaybackClock()}play(){const t=wS(this.timeline),e=t?rm:im;if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t)return this.timeline.recordStableState(im),void this.timeline.transitionTo(rm);this.timeline.transitionTo(im)}pause(){}handleDecodedFrame(t){!0===this.settings.autoplay&&Array.isArray(this.timeline.placements)&&this.timeline.placements.length&&(wS(this.timeline)||(this.log.info("[handleDecodedFrame] Autoplay enabled, transitioning to Playing!"),this.emitPlayerStateEvent("play",{from:this.timeline.state,to:im}),this.timeline.transitionTo(im)))}},[im]:class extends pS{get name(){return im}enter(t={}){const{from:e,to:n}=t;this.timeline.recordStableState(im),this.timeline.startPlaybackClock(),this.emitPlayerStateEvent("canplay",{from:e,to:n}),this.emitPlayerStateEvent("playing",{from:e,to:n})}play(){}pause(){this.timeline.transitionTo(om)}handleClockTick(t){const e=this.timeline.currentTime;wS(this.timeline,e)&&(this.timeline.recordStableState(im),this.timeline.transitionTo(rm))}},[rm]:(un=new WeakMap,dn=new WeakMap,hn=new WeakSet,class extends pS{constructor(...t){super(...t),j(this,hn),W(this,un,void 0),W(this,dn,null)}get name(){return rm}enter(t={}){const{from:e,to:n}=t;this.timeline.stopPlaybackClock(),B(hn,this,IS).call(this),B(hn,this,SS).call(this),this.emitPlayerStateEvent("waiting",{from:e,to:n}),B(hn,this,MS).call(this)}exit(){B(hn,this,ES).call(this),B(hn,this,NS).call(this)}play(){this.timeline.recordStableState(im);const t=B(hn,this,AS).call(this),e=t?rm:im;this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t||this.timeline.transitionTo(im)}pause(){this.timeline.transitionTo(om)}handleMainTrackReady(t){const e=this.timeline.getLastStableState()||om;e!==im?this.timeline.transitionTo(e):B(hn,this,MS).call(this)}handleDecodedFrame(t){B(hn,this,MS).call(this)}handleMainTrackBufferUpdate(t){B(hn,this,MS).call(this)}}),[om]:class extends pS{get name(){return om}enter(t={}){const{from:e,to:n}=t;this.timeline.recordStableState(om),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("pause",{from:e,to:n})}play(){const t=wS(this.timeline),e=t?rm:im;if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t)return this.timeline.recordStableState(im),void this.timeline.transitionTo(rm);this.timeline.transitionTo(im)}pause(){}},[sm]:class extends pS{get name(){return sm}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===im?im:om;this.timeline.transitionTo(i,{fromSeeking:!0})}play(){this.timeline&&"function"==typeof this.timeline.setSeekReturnState?this.timeline.setSeekReturnState(im):this.timeline.transitionTo(im)}pause(){this.timeline&&"function"==typeof this.timeline.setSeekReturnState?this.timeline.setSeekReturnState(om):this.timeline.transitionTo(om)}handleDecodedFrame(t){this.timeline&&"function"==typeof this.timeline.maybeCompleteSeek&&this.timeline.maybeCompleteSeek(t)}},[am]:class extends pS{get name(){return am}enter(){this.timeline.resetClock(),this.timeline.transitionTo(nm,{fromReset:!0})}play(){}pause(){}get buffered(){return{start:0,end:0}}}};function IS(){var t;const e=null===(t=this.timeline)||void 0===t?void 0:t.trackBuffers;e&&"function"==typeof e.on&&(U(un,this,(t=>this.handleMainTrackBufferUpdate(t))),e.on(Jp.TRACK_BUFFER_UPDATE,z(un,this)))}function ES(){var t;const e=null===(t=this.timeline)||void 0===t?void 0:t.trackBuffers;z(un,this)&&e&&"function"==typeof e.off?(e.off(Jp.TRACK_BUFFER_UPDATE,z(un,this)),U(un,this,null)):U(un,this,null)}function SS(){if(null!==z(dn,this))return;const t="function"==typeof(null==eu?void 0:eu.setInterval)?eu.setInterval.bind(eu):setInterval;U(dn,this,t((()=>{var t;(null===(t=this.timeline)||void 0===t?void 0:t.state)===rm&&B(hn,this,MS).call(this)}),200))}function NS(){null!==z(dn,this)&&(("function"==typeof(null==eu?void 0:eu.clearInterval)?eu.clearInterval.bind(eu):clearInterval)(z(dn,this)),U(dn,this,null))}function AS(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!!xS(t,e)||!0===n.skipBufferResume||!_S(t,e)}(this.timeline,t)}function MS(t=(t=>null===(t=this.timeline)||void 0===t?void 0:t.currentTime)()){return(this.timeline.getLastStableState()||om)===im&&!B(hn,this,AS).call(this,t)&&(this.timeline.transitionTo(im),!0)}function FS(t){return t&&("string"!=typeof t.state||"ready"===t.state)}function OS(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).some((t=>"video"===(null==t?void 0:t.type)))}function PS(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)))}var CS=new WeakMap,DS=new WeakMap,RS=new WeakMap,BS=new WeakMap,LS=new WeakMap,zS=new WeakMap,WS=new WeakMap,US=new WeakMap,jS=new WeakMap,$S=new WeakMap,qS=new WeakMap,VS=new WeakMap,GS=new WeakMap,HS=new WeakSet;class KS{constructor(t={}){j(this,HS),W(this,CS,void 0),W(this,DS,void 0),W(this,RS,void 0),W(this,BS,void 0),W(this,LS,void 0),W(this,zS,void 0),W(this,WS,void 0),W(this,US,void 0),W(this,jS,null),W(this,$S,om),W(this,qS,[]),W(this,VS,new Set),W(this,GS,new Map),U(CS,this,t.getState),U(DS,this,t.getNode),U(RS,this,t.getPlacementsActiveAtTime),U(BS,this,t.getLastStableState),U(LS,this,t.clearVisualFrameBuffers),U(zS,this,t.updateTime),U(WS,this,t.transitionTo),U(US,this,t.trigger)}start(t,e){const n=Number(t);if(!Number.isFinite(n))return;let i=e;i===sm?i=z($S,this):i===rm&&"function"==typeof z(BS,this)&&(i=z(BS,this).call(this)),U($S,this,i===im?im:om),U(jS,this,n),z(VS,this).clear(),z(GS,this).clear(),U(qS,this,"function"==typeof z(RS,this)?z(RS,this).call(this,n):[]),"function"==typeof z(LS,this)&&z(LS,this).call(this),"function"==typeof z(zS,this)&&z(zS,this).call(this,n,{source:"seek"}),"function"==typeof z(US,this)&&z(US,this).call(this,Jp.TIMELINE_SEEKING,{targetTime:n,placements:z(qS,this).slice()}),this.maybeComplete()}setReturnState(t){U($S,this,t===im?im:om)}maybeComplete(t){if(("function"==typeof z(CS,this)?z(CS,this).call(this):void 0)!==sm)return;const e=z(jS,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){z(VS,this).add(i);const t=z(GS,this).get(i);(!Number.isFinite(t)||n<t)&&z(GS,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)&&z(VS,this).add(i);const r=Array.isArray(z(qS,this))?z(qS,this):[];if(r.length){if("function"==typeof z(DS,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=z(DS,this).call(this,e.nodeId);if(!FS(i))return;if(PS(i)&&!z(VS,this).has(n))return}B(HS,this,XS).call(this,e,r)}}else B(HS,this,XS).call(this,e,[])}dispose(){U(qS,this,[]),z(VS,this).clear(),z(GS,this).clear(),U(jS,this,null)}}function XS(t,e){const n=B(HS,this,YS).call(this,t,e);"function"==typeof z(zS,this)&&z(zS,this).call(this,n,{source:"seek"}),U(jS,this,null),U(qS,this,[]),z(VS,this).clear(),z(GS,this).clear(),"function"==typeof z(US,this)&&z(US,this).call(this,Jp.TIMELINE_SEEKED,{targetTime:t,placements:Array.isArray(e)?e.slice():[]}),"function"==typeof z(WS,this)&&z(WS,this).call(this,z($S,this),{fromSeeking:!0})}function YS(t,e){const n=Number(t);if(!Number.isFinite(n))return t;if(!Array.isArray(e)||!e.length||"function"!=typeof z(DS,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(!OS(z(DS,this).call(this,n.nodeId)))continue;const o=z(GS,this).get(r);Number.isFinite(o)&&o>i&&(i=o)}return i}function QS(t){if(t&&"function"==typeof t.close)try{t.close()}catch(t){}}function JS(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=>QS(null==t?void 0:t.frame)))}function ZS(t){return ep(t)}function tN(t){return Number.isFinite(null==t?void 0:t.loopRootOffset)?t.loopRootOffset:ZS(t)}function eN(t,e){return"string"==typeof(null==t?void 0:t.loopRootPlacementId)&&t.loopRootPlacementId?t.loopRootPlacementId:e}function nN(t){if("string"!=typeof t)return Number.NaN;const e=t.match(/(\d+)/);return e?Number(e[1]):Number.NaN}function iN(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 rN=1e-6;function oN(t){return t&&("string"!=typeof t.state||"ready"===t.state)}function sN(t){const e=Number(t);return Number.isFinite(e)?e:0}function aN(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 lN(t){return t&&"cue"===t.type&&Array.isArray(t.cues)?t.cues:[]}var cN=new WeakMap,uN=new WeakMap,dN=new WeakMap,hN=new WeakMap,fN=new WeakMap,pN=new WeakMap,mN=new WeakMap,gN=new WeakMap,vN=new WeakSet;class yN{constructor(t={}){j(this,vN),W(this,cN,void 0),W(this,uN,void 0),W(this,dN,void 0),W(this,hN,void 0),W(this,fN,void 0),W(this,pN,void 0),W(this,mN,-1e-6),W(this,gN,null),U(cN,this,t.getPlacements),U(uN,this,t.getPlacementsActiveAtTime),U(dN,this,t.getPlacementDuration),U(hN,this,t.getNode),U(fN,this,t.triggerTimeline),U(pN,this,t.triggerNode)}handleSeeking(t,e){const n=sN(t);U(gN,this,n)}handleSeeked(t){const e=sN(t),n=z(gN,this);U(gN,this,null),Number.isFinite(n)?(B(vN,this,kN).call(this,n,e),U(mN,this,e)):U(mN,this,e)}handleTimeUpdate(t,e={}){const n=sN(t),i=z(mN,this);!0===(null==e?void 0:e.isSeeking)?U(mN,this,n):Number.isFinite(i)?n<=i?n<i&&U(mN,this,n-rN):(B(vN,this,bN).call(this,i,n),U(mN,this,n)):U(mN,this,n)}dispose(){U(gN,this,null),U(mN,this,-1e-6)}}function bN(t,e){const n="function"==typeof z(cN,this)?z(cN,this).call(this):[];B(vN,this,xN).call(this,n,t,e,{onlySticky:!1})}function kN(t,e){if("function"!=typeof z(uN,this))return;const n=z(uN,this).call(this,e);B(vN,this,xN).call(this,n,t,e,{onlySticky:!0})}function xN(t,e,n,i={}){if("function"!=typeof z(hN,this)||"function"!=typeof z(fN,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=z(hN,this).call(this,l);if(!oN(c))continue;const u=aN(c);if(!u.length)continue;const d=ep(s);if(!Number.isFinite(d))continue;const h=Number.isFinite(null==s?void 0:s.nodeOffsetOverride)?s.nodeOffsetOverride:0,f="function"==typeof z(dN,this)?z(dN,this).call(this,s):void 0,p="number"==typeof f&&Number.isFinite(f)?d+f:Number.POSITIVE_INFINITY,m=r?d-rN:e;for(let t=0;t<u.length;t+=1){const e=lN(u[t]);for(let i=0;i<e.length;i+=1){const s=e[i],c=sN(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};z(fN,this).call(this,"cuepoint",n),z(fN,this).call(this,e.name,n),"function"==typeof z(pN,this)&&(z(pN,this).call(this,t.nodeId,"cuepoint",n),z(pN,this).call(this,t.nodeId,e.name,n))})))}class wN{#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 _N=24e3/1001;function TN(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}:iN(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 IN=new WeakMap,EN=new WeakMap,SN=new WeakMap,NN=new WeakMap,AN=new WeakMap,MN=new WeakMap,FN=new WeakMap,ON=new WeakMap,PN=new WeakMap,CN=new WeakMap,DN=new WeakMap,RN=new WeakMap,BN=new WeakMap,LN=new WeakMap,zN=new WeakMap,WN=new WeakMap,UN=new WeakMap,jN=new WeakMap,$N=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 WeakMap,ZN=new WeakMap,tA=new WeakMap,eA=new WeakMap,nA=new WeakSet;class iA extends Jc{constructor(...t){super(...t),j(this,nA),W(this,IN,void 0),W(this,EN,void 0),W(this,SN,void 0),W(this,NN,void 0),W(this,AN,void 0),W(this,MN,[]),W(this,FN,new wN("placement-")),W(this,ON,[]),W(this,PN,new wN("renderplacement-")),W(this,CN,void 0),W(this,DN,void 0),W(this,RN,void 0),W(this,BN,new Set),W(this,LN,new Set),W(this,zN,new Map),W(this,WN,[]),W(this,UN,0),W(this,jN,new Set),W(this,$N,new Set),W(this,qN,Number.NEGATIVE_INFINITY),W(this,VN,[]),W(this,GN,Number.NEGATIVE_INFINITY),W(this,HN,0),W(this,KN,void 0),W(this,XN,void 0),W(this,YN,new Map),W(this,QN,null),W(this,JN,void 0),W(this,ZN,void 0),W(this,tA,void 0),W(this,eA,void 0);const[e,n={}]=t;U(IN,this,e),U(KN,this,n),U(AN,this,new iS(n)),U(CN,this,new cS(n)),U(NN,this,om),B(nA,this,pA).call(this),B(nA,this,mA).call(this),U(JN,this,new KS({getState:()=>this.state,getNode:t=>z(IN,this)&&"function"==typeof z(IN,this).get?z(IN,this).get(t):void 0,getPlacementsActiveAtTime:t=>B(nA,this,KA).call(this,t,{endEpsilonSeconds:B(nA,this,iM).call(this)}),getLastStableState:()=>this.getLastStableState(),clearVisualFrameBuffers:()=>B(nA,this,GA).call(this),updateTime:(t,e)=>this.updateTime(t,e),transitionTo:(t,e)=>this.transitionTo(t,e),trigger:(t,e)=>this.trigger(t,e)})),U(ZN,this,new yN({getPlacements:()=>z(MN,this).slice(),getPlacementsActiveAtTime:t=>B(nA,this,KA).call(this,t),getPlacementDuration:t=>B(nA,this,AA).call(this,t),getNode:t=>z(IN,this)&&"function"==typeof z(IN,this).get?z(IN,this).get(t):void 0,triggerTimeline:(t,e)=>this.trigger(t,e),triggerNode:(t,e,n)=>{const i=z(IN,this)&&"function"==typeof z(IN,this).get?z(IN,this).get(t):void 0;i&&"function"==typeof i.trigger&&i.trigger(e,n)}})),U(tA,this,(()=>{var t,e;null===(t=z(ZN,this))||void 0===t||null===(e=t.handleSeeked)||void 0===e||e.call(t,this.currentTime)})),this.on(Jp.TIMELINE_SEEKED,z(tA,this)),U(eA,this,(t=>B(nA,this,wA).call(this,t))),this.on("nodestart",z(eA,this)),this.transitionTo(nm)}get name(){return"Timeline"}get defaults(){return{snapToFps:_N,maxBufferedVideoFrames:24}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"computeBuffered","notifyDecodedFrame","getDecodedFrameStats","getActiveRenderPlacement","maybeCompleteSeek","getPlacementsActiveAtTime","hasDecodedFirstFrame","getDecodedVisualBuffer","getPlacementDuration","getNode"])}transitionTo(t,e={}){const n=z(SN,this),i=function(t,e,n={}){const i=TS[t];return i?new i(e,n):null}(t,this,z(KN,this)),r=e&&"object"==typeof e&&!Array.isArray(e)?{...e,from:n,to:t}:{from:n,to:t};i?(z(EN,this)&&"function"==typeof z(EN,this).exit&&z(EN,this).exit(),U(EN,this,i),U(SN,this,t),"function"==typeof i.enter&&i.enter(r),this.trigger(Jp.TIMELINE_STATE_CHANGE,{from:n,to:t,options:e})):this.log.warn(`Unknown state "${t}"`)}recordStableState(t){U(NN,this,t)}getLastStableState(){return z(NN,this)}get state(){return z(SN,this)}get paused(){return z(SN,this)===nm||z(SN,this)===om}get currentTime(){return z(AN,this).currentTime}set currentTime(t){z(EN,this).seek(t)}get playbackRate(){return z(AN,this).playbackRate}set playbackRate(t){z(AN,this).playbackRate=t}play(){z(EN,this).play()}pause(){z(EN,this).pause()}reset(){z(EN,this).reset()}seekToPlacement(t){if(!t)throw new Error("Timeline.seekToPlacement requires placement id");B(nA,this,IA).call(this);const e=B(nA,this,ZA).call(this,t);if(!e)throw new Error("Timeline.seekToPlacement requires placement id");const n=ep(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;B(nA,this,IA).call(this),B(nA,this,EA).call(this),z(AN,this).seek(t),B(nA,this,HA).call(this,this.currentTime),B(nA,this,XA).call(this);const r="string"==typeof(null==e?void 0:e.source)?e.source:"set";null!==(n=z(ZN,this))&&void 0!==n&&null!==(i=n.handleTimeUpdate)&&void 0!==i&&i.call(n,this.currentTime,{isSeeking:this.state===sm}),B(nA,this,_A).call(this,this.currentTime),B(nA,this,UA).call(this,this.currentTime),this.trigger(Jp.TIMELINE_TIME_UPDATE,Zp(this.currentTime,r))}startSeeking(t,e){var n,i;null!==(n=z(ZN,this))&&void 0!==n&&null!==(i=n.handleSeeking)&&void 0!==i&&i.call(n,this.currentTime,t),z(JN,this)&&"function"==typeof z(JN,this).start&&z(JN,this).start(t,e)}setSeekReturnState(t){z(JN,this)&&"function"==typeof z(JN,this).setReturnState&&z(JN,this).setReturnState(t)}maybeCompleteSeek(t){z(JN,this)&&"function"==typeof z(JN,this).maybeComplete&&z(JN,this).maybeComplete(t)}startPlaybackClock(){z(AN,this).play()}stopPlaybackClock(){z(AN,this).pause()}resetClock(){var t,e;z(AN,this).reset(),null===(t=z(ZN,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:[];B(nA,this,rA).call(this),B(nA,this,oA).call(this,e),B(nA,this,sA).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=z(FN,this).claim(n.placementId),o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=ap(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}:sp(e,n);let u,d,h,f=!1;const p=null!==a;if(B(nA,this,IA).call(this),a){const t=z(MN,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=ep(t);if("start"===a.anchor)Number.isFinite(e)?u=B(nA,this,MA).call(this,e,{nodeOffsetOverride:o}):f=!0;else{const n=B(nA,this,AA).call(this,t);if(Number.isFinite(e)&&n>0){const t=e+n,i=B(nA,this,MA).call(this,t,{nodeOffsetOverride:o});u=Math.max(i,t)}else f=!0}}else if(l){const t=n.offsetAnchorPlacementId?z(MN,this).find((t=>(null==t?void 0:t.placementId)===n.offsetAnchorPlacementId)):z(MN,this).length?z(MN,this)[z(MN,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==t?void 0:t.placementId),d){const e=ep(t),n=B(nA,this,AA).call(this,t);Number.isFinite(e)&&n>0?u=B(nA,this,MA).call(this,e+n-c,{nodeOffsetOverride:o}):(f=!0,h="end")}else u=B(nA,this,MA).call(this,-c,{nodeOffsetOverride:o})}else u=op(e),u=B(nA,this,MA).call(this,u,{...n,nodeOffsetOverride:o});const m=!0===n.loop?n.loopRootPlacementId||r:void 0,g=!0===n.loop&&Number.isFinite(n.loopRootOffset)?n.loopRootOffset:!0===n.loop?u:void 0,v=l?c:a&&"end"===a.anchor?0:void 0,y=new fS({placementId:r,nodeId:i,offset:u,offsetPending:f,offsetAnchorPlacementId:f?d:void 0,offsetAnchorEdge:f?h:void 0,offsetAnchorIsReference:f?p:void 0,offsetEndSeconds:v,nodeOffsetOverride:o,nodeDurationOverride:s,loop:!0===n.loop,loopRootPlacementId:m,loopRootOffset:g});if(z(MN,this).push(y),ip(z(MN,this)),B(nA,this,zA).call(this,y),B(nA,this,BA).call(this),f&&d){const t=z(MN,this).find((t=>(null==t?void 0:t.placementId)===d));B(nA,this,OA).call(this,null==t?void 0:t.nodeId)}return this.trigger(Jp.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=B(nA,this,FA).call(this,e,i),s=o.offset,a=!0===o.offsetPending,l=o.offsetAnchorPlacementId,c=o.offsetAnchorEdge,u=o.offsetAnchorIsReference,d=z(PN,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,g={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;lp(z(ON,this),t,e,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements")}if(z(ON,this).push(g),ip(z(ON,this)),a&&l){const t=z(MN,this).find((t=>(null==t?void 0:t.placementId)===l));B(nA,this,OA).call(this,null==t?void 0:t.nodeId)}return this.trigger(Jp.RENDER_PLACEMENT_ADDED,g),d}get placements(){return z(MN,this).slice()}getPlacementsActiveAtTime(t){return B(nA,this,KA).call(this,t)}getNodesAtTime(t){const e=B(nA,this,tM).call(this,t);if(!Number.isFinite(e))return[];const n=B(nA,this,KA).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 B(nA,this,AA).call(this,t)}getNode(t){if(z(IN,this)&&"function"==typeof z(IN,this).get)return z(IN,this).get(t)}get renderPlacements(){return z(ON,this).slice()}get placementsAhead(){const t=this.currentTime;return z(MN,this).filter((e=>{const n=ep(e);if(!Number.isFinite(n))return!1;const i=B(nA,this,AA).call(this,e);return"number"==typeof i?n+i>t:n>=t}))}get buffered(){return z(EN,this)?z(EN,this).buffered:{start:0,end:0}}get trackBuffers(){return z(CN,this)}onDispose(){B(nA,this,hA).call(this),z(LN,this)&&z(LN,this).clear(),z(ZN,this)&&"function"==typeof z(ZN,this).dispose&&z(ZN,this).dispose(),U(ZN,this,null),B(nA,this,dA).call(this),B(nA,this,fA).call(this),z(JN,this)&&"function"==typeof z(JN,this).dispose&&z(JN,this).dispose(),U(JN,this,null),z(AN,this)&&"function"==typeof z(AN,this).dispose&&(z(XN,this)&&"function"==typeof z(AN,this).off&&(z(AN,this).off("tick",z(XN,this)),U(XN,this,null)),z(AN,this).dispose(),U(AN,this,null)),B(nA,this,DA).call(this),U(EN,this,null),U(SN,this,null),U(MN,this,[]),U(ON,this,[]),B(nA,this,RA).call(this),B(nA,this,BA).call(this),z(YN,this).clear(),U(QN,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}`;z(BN,this).add(i),B(nA,this,VA).call(this,t),B(nA,this,XA).call(this),z(EN,this)&&"function"==typeof z(EN,this).handleDecodedFrame&&z(EN,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=TN(t);Number.isFinite(i)&&i>0&&(e.totalBytes+=i)}))}return e.available=!0,e}(z(YN,this))}hasDecodedFirstFrame(t,e){return!(!t||!e)&&z(BN,this).has(`${t}:${e}`)}getDecodedVisualBuffer(t,e){if(t&&e)return z(YN,this).get(`${t}:${e}`)}computeBuffered(t){const e=z(IN,this);if(e&&"function"==typeof e.get)return z(CN,this).computeBuffered(z(MN,this),t,e)}getActiveRenderPlacement(t=this.currentTime){const e=Number.isFinite(t)?t:this.currentTime,n=Array.isArray(z(ON,this))?z(ON,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 rA(){this.trigger(Jp.TIMELINE_RESET,{reason:"switch"}),B(nA,this,GA).call(this),z(CN,this)&&"function"==typeof z(CN,this).reset&&z(CN,this).reset(),z(LN,this)&&z(LN,this).clear(),U(MN,this,[]),U(ON,this,[]),B(nA,this,RA).call(this),B(nA,this,BA).call(this),z(FN,this).reset(),z(PN,this).reset()}function oA(t=[]){for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||!n.nodeId)continue;const i=B(nA,this,aA).call(this,n),r=B(nA,this,cA).call(this,n);this.placeOnTimeline(n.nodeId,r,i)}}function sA(t=[]){for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||!n.type)continue;const i=B(nA,this,lA).call(this,n),r=B(nA,this,uA).call(this,n);this.placeRenderNodeOnTimeline(n.type,r,n.duration,i)}}function aA(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 lA(t){const e={};return t.renderPlacementId&&(e.renderPlacementId=t.renderPlacementId),t.params&&"object"==typeof t.params&&(e.params=t.params),e}function cA(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 uA(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 dA(){z(EN,this)&&"function"==typeof z(EN,this).exit&&z(EN,this).exit()}function hA(){z(tA,this)&&"function"==typeof this.off&&(this.off(Jp.TIMELINE_SEEKED,z(tA,this)),U(tA,this,null)),z(eA,this)&&"function"==typeof this.off&&(this.off("nodestart",z(eA,this)),U(eA,this,null))}function fA(){z(CN,this)&&(z(DN,this)&&(z(CN,this).off("track:underflow",z(DN,this)),U(DN,this,null)),z(RN,this)&&(z(CN,this).off("track:ready",z(RN,this)),U(RN,this,null)),"function"==typeof z(CN,this).dispose&&z(CN,this).dispose(),U(CN,this,null))}function pA(){z(CN,this)&&"function"==typeof z(CN,this).on&&(U(DN,this,(t=>B(nA,this,vA).call(this,t))),U(RN,this,(t=>B(nA,this,yA).call(this,t))),z(CN,this).on(Jp.TRACK_UNDERFLOW,z(DN,this)),z(CN,this).on(Jp.TRACK_READY,z(RN,this)))}function mA(){z(AN,this)&&"function"==typeof z(AN,this).on&&(U(XN,this,(t=>B(nA,this,gA).call(this,t))),z(AN,this).on(Jp.CLOCK_TICK,z(XN,this)))}function gA(t){var e,n;B(nA,this,IA).call(this),B(nA,this,XA).call(this),null!==(e=z(ZN,this))&&void 0!==e&&null!==(n=e.handleTimeUpdate)&&void 0!==n&&n.call(e,this.currentTime,{isSeeking:!1}),B(nA,this,_A).call(this,this.currentTime),this.trigger(Jp.TIMELINE_TIME_UPDATE,Zp(this.currentTime,"clock")),z(EN,this)&&"function"==typeof z(EN,this).handleClockTick&&z(EN,this).handleClockTick(t)}function vA(t){B(nA,this,IA).call(this);const e=B(nA,this,bA).call(this);e&&(null==t?void 0:t.trackType)===e.trackType&&(z(EN,this)&&"function"==typeof z(EN,this).handleMainTrackUnderflow?z(EN,this).handleMainTrackUnderflow(t):this.transitionTo(rm))}function yA(t){if(B(nA,this,IA).call(this),this.state!==rm)return;const e=B(nA,this,bA).call(this);if(!e)return;if((null==t?void 0:t.trackType)!==e.trackType)return;if(z(EN,this)&&"function"==typeof z(EN,this).handleMainTrackReady)return void z(EN,this).handleMainTrackReady(t);const n=this.getLastStableState()||om;this.transitionTo(n)}function bA(t=this.currentTime){const e=B(nA,this,xA).call(this,t);if(!e)return;const n=z(IN,this)&&"function"==typeof z(IN,this).get?z(IN,this).get(e.nodeId):void 0;if(!n)return;const i=B(nA,this,kA).call(this,n);return i?{placement:e,trackType:i}:void 0}function kA(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 xA(t=this.currentTime){const e=z(MN,this)||[];let n;for(let i=0;i<e.length;i+=1){const r=e[i],o=ep(r);if(!Number.isFinite(o))continue;const s=B(nA,this,AA).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 wA(t={}){if(this.state!==im)return;const e=null==t?void 0:t.placementId;if(!e)return;const n=B(nA,this,ZA).call(this,e);n&&B(nA,this,TA).call(this,n)}function _A(t=this.currentTime){if(this.state!==im)return;const e=B(nA,this,KA).call(this,t);Array.isArray(e)&&e.length&&e.forEach((t=>B(nA,this,TA).call(this,t)))}function TA(t){const e=null==t?void 0:t.placementId;if(!e)return;if(z(LN,this).has(e))return;if(!t||!0!==t.loop)return;if(!t.nodeId)return;const n=B(nA,this,AA).call(this,t);if(!Number.isFinite(n)||n<=0)return;const i=ep(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;z(LN,this).add(e),this.placeOnTimeline(t.nodeId,r,{nodeOffsetOverride:t.nodeOffsetOverride,nodeDurationOverride:t.nodeDurationOverride,loop:!0,loopRootPlacementId:o,loopRootOffset:s})}function IA(){const t=rp(z(MN,this),{getPlacementDuration:t=>B(nA,this,AA).call(this,t),snapPlacementOffset:(t,e)=>B(nA,this,MA).call(this,t,{nodeOffsetOverride:null==e?void 0:e.nodeOffsetOverride}),onResolvedPlacement:(t,e)=>{!0!==t.loop||Number.isFinite(t.loopRootOffset)||(t.loopRootOffset=t.offset),B(nA,this,PA).call(this,null==e?void 0:e.nodeId)}});return t.updated&&(B(nA,this,BA).call(this),t.resolvedPlacements.forEach((t=>{B(nA,this,zA).call(this,t),this.trigger(Jp.PLACEMENT_ADDED,t)}))),t.updated}function EA(){if(!z(ON,this).length||!z(MN,this).length)return!1;const t=new Map;z(MN,this).forEach((e=>{(null==e?void 0:e.placementId)&&t.set(e.placementId,e)}));const e=z(ON,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];B(nA,this,SA).call(this,o,t)&&(n=!0,i.push(o))}return n&&(ip(z(ON,this)),i.forEach((t=>{this.trigger(Jp.RENDER_PLACEMENT_ADDED,t)}))),n}function SA(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=B(nA,this,NA).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 lp(z(ON,this).filter((e=>e!==t&&!0!==(null==e?void 0:e.offsetPending))),s,a,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements"),B(nA,this,PA).call(this,null==r?void 0:r.nodeId),!0}function NA(t,e){const n=ep(t);if(!Number.isFinite(n))return;if("start"===e.offsetAnchorEdge)return B(nA,this,MA).call(this,n);const i=B(nA,this,AA).call(this,t);if(!(i>0))return;const r=n+i;if(!Number.isFinite(r))return;const o=B(nA,this,MA).call(this,r);return!0===e.offsetAnchorIsReference?Math.max(o,r):o}function AA(t){return Zf(t,z(IN,this))}function MA(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 FA(t,e={}){const n=ap(t);if("string"==typeof t&&t.includes("@")&&!n)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");if(!n){const n=op(t);return{offset:B(nA,this,MA).call(this,n,e)}}const i=z(MN,this).find((t=>(null==t?void 0:t.placementId)===n.placementId));if(!i)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");const r=ep(i);if("start"===n.anchor)return Number.isFinite(r)?{offset:B(nA,this,MA).call(this,r,e)}:{offset:void 0,offsetPending:!0,offsetAnchorPlacementId:i.placementId,offsetAnchorEdge:"start",offsetAnchorIsReference:!0};const o=B(nA,this,AA).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=B(nA,this,MA).call(this,s,e);return{offset:Math.max(a,s)}}function OA(t){if(!t||!z(IN,this)||"function"!=typeof z(IN,this).get)return;if(z(zN,this).has(t))return;let e;try{e=z(IN,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),B(nA,this,PA).call(this,t)};e.on(Jp.NODE_LOADED,n),z(zN,this).set(t,n)}function PA(t){if(!t)return;if(B(nA,this,CA).call(this,t))return;const e=z(zN,this).get(t);if(!e)return;let n;try{n=z(IN,this).get(t)}catch(t){n=null}n&&"function"==typeof n.off&&n.off(Jp.NODE_LOADED,e),z(zN,this).delete(t)}function CA(t){if(!t)return!1;const e=new Map;z(MN,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!!z(MN,this).some((t=>n(t)))||!!z(ON,this).some((t=>n(t)))}function DA(){z(zN,this).size&&z(IN,this)?(z(zN,this).forEach(((t,e)=>{let n;try{n=z(IN,this).get(e)}catch(t){n=null}n&&"function"==typeof n.off&&n.off(Jp.NODE_LOADED,t)})),z(zN,this).clear()):z(zN,this).clear()}function RA(){U(WN,this,[]),U(UN,this,0),z(jN,this).clear(),z($N,this).clear(),U(qN,this,Number.NEGATIVE_INFINITY)}function BA(){U(VN,this,[]),U(HN,this,0),U(GN,this,Number.NEGATIVE_INFINITY)}function LA(t,e){const n=z(WN,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<z(UN,this)&&U(UN,this,z(UN,this)+1)}function zA(t){const e=null==t?void 0:t.placementId;if(!e||z(jN,this).has(e))return;const n=ep(t),i=B(nA,this,AA).call(this,t);if(!Number.isFinite(n)||!Number.isFinite(i)||i<0)return void z($N,this).add(e);const r=n+i;Number.isFinite(r)&&(z(jN,this).add(e),z($N,this).delete(e),B(nA,this,LA).call(this,e,r))}function WA(){z($N,this).size&&Array.from(z($N,this)).forEach((t=>{const e=B(nA,this,ZA).call(this,t);e?B(nA,this,zA).call(this,e):z($N,this).delete(t)}))}function UA(t){const e=Number(t);if(!Number.isFinite(e))return;if(e<z(qN,this))return void U(qN,this,e);if(U(qN,this,e),B(nA,this,WA).call(this),!z(WN,this).length)return;const n=new Set;let i=z(UN,this);for(;i<z(WN,this).length;){const t=z(WN,this)[i];if(!t||!Number.isFinite(t.endTime)||t.endTime>e)break;t.placementId&&n.add(t.placementId),i+=1}i!==z(UN,this)&&(U(UN,this,i),n.size&&(B(nA,this,qA).call(this,n),B(nA,this,jA).call(this,n)))}function jA(t){if(t&&t.size)for(const e of z(BN,this)){const n=e.split(":")[0];t.has(n)&&z(BN,this).delete(e)}}function $A(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 qA(t){if(t&&t.size)for(const[e,n]of z(YN,this).entries())t.has(null==n?void 0:n.placementId)&&(B(nA,this,$A).call(this,n),z(YN,this).delete(e))}function VA(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=iN(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=z(YN,this).get(f),m=p||{placementId:n,nodeId:i,trackId:r,trackType:s,frames:[],current:void 0},g={placementId:n,nodeId:i,trackId:r,segmentId:o,frame:a,width:c,height:u,presentationTime:d,duration:h},v=m.frames,y=v.length?v[v.length-1]:void 0;if(!y||y.presentationTime<=g.presentationTime)v.push(g);else{let t=v.findIndex((t=>t.presentationTime>g.presentationTime));-1===t&&(t=v.length),v.splice(t,0,g)}const b=Number(null===(e=this.settings)||void 0===e?void 0:e.maxBufferedVideoFrames);if("video"===s&&Number.isFinite(b)&&b>0&&v.length>b){const t=v.length-b;for(let e=0;e<t;e+=1){const t=v.pop(),e=null==t?void 0:t.frame;if(e&&"function"==typeof e.close)try{e.close()}catch(t){}}}p||z(YN,this).set(f,m)}function GA(){for(const t of z(YN,this).values())B(nA,this,$A).call(this,t);z(YN,this).clear(),U(QN,this,null),z(BN,this).clear()}function HA(t){const e=Number.isFinite(t)?t:this.currentTime;if(!Number.isFinite(e))return;e<z(GN,this)&&(U(VN,this,[]),U(HN,this,0));const n=Array.isArray(z(MN,this))?z(MN,this):[],i=[],r=new Set;z(VN,this).forEach((t=>{B(nA,this,rM).call(this,t,e)&&(i.push(t),(null==t?void 0:t.placementId)&&r.add(t.placementId))}));let o=z(HN,this);for(;o<n.length;){const t=n[o],s=ep(t);if(!Number.isFinite(s))break;if(s>e)break;if(B(nA,this,rM).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}U(VN,this,i),U(HN,this,o),U(GN,this,e)}function KA(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===z(GN,this)?z(VN,this).slice():(Array.isArray(z(MN,this))?z(MN,this):[]).filter((t=>B(nA,this,rM).call(this,t,n,i)))}function XA(){const t=this.currentTime,e=B(nA,this,QA).call(this,t);if(!e.length)return void U(QN,this,null);const n=this.getActiveRenderPlacement(t),i=B(nA,this,JA).call(this,e,n);(i!==z(QN,this)||B(nA,this,YA).call(this,t,n))&&(U(QN,this,i),this.trigger(Jp.VISUAL_FRAMES_AVAILABLE,{time:t,frames:e}))}function YA(t,e){const n=e||this.getActiveRenderPlacement(t);if(!n)return!1;if(!Tp.doesRenderNodeTypeRequireFrameCadence(null==n?void 0:n.type))return!1;const i=n.duration;return"number"==typeof i&&i>0}function QA(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){JS(c),a.push(t);continue}if("function"==typeof r&&!r(u,n)){const e=ZS(u),i="function"==typeof o?o(u):void 0;Number.isFinite(i)&&Number.isFinite(e)&&n>=e+i&&(JS(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&&QS(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:ZS(u),placementSortOffset:tN(u),placementSortId:eN(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=nN(r),a=nN(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:z(YN,this),time:t,getPlacementById:t=>B(nA,this,ZA).call(this,t),isPlacementActiveAtTime:(t,e)=>B(nA,this,rM).call(this,t,e),getPlacementDuration:t=>B(nA,this,AA).call(this,t)})}function JA(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 ZA(t){if(t)return(z(MN,this)||[]).find((e=>(null==e?void 0:e.placementId)===t))}function tM(t){if("end"===t){const t=B(nA,this,eM).call(this);if(!Number.isFinite(t))return;const e=B(nA,this,nM).call(this);return Math.max(0,t-Math.min(t,e))}const e=Number(t);return Number.isFinite(e)?e:0}function eM(){let t;return(Array.isArray(z(MN,this))?z(MN,this):[]).forEach((e=>{const n=ep(e);if(!Number.isFinite(n))return;const i=B(nA,this,AA).call(this,e);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(t)||r>t)&&(t=r)})),t}function nM(){const t=B(nA,this,iM).call(this);return t>0?t:.001}function iM(){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 rM(t,e,n=0){if(!np(t,e,z(IN,this)))return!1;const i=Number(n);if(!Number.isFinite(i)||i<=0)return!0;const r=B(nA,this,AA).call(this,t);if(!Number.isFinite(r))return!0;const o=ep(t);return!Number.isFinite(o)||e<o+r-i}var oM=new WeakMap,sM=new WeakMap,aM=new WeakMap,lM=new WeakMap,cM=new WeakMap,uM=new WeakMap,dM=new WeakMap,hM=new WeakMap,fM=new WeakMap,pM=new WeakMap,mM=new WeakMap,gM=new WeakMap,vM=new WeakMap,yM=new WeakMap,bM=new WeakMap,kM=new WeakMap,xM=new WeakMap,wM=new WeakSet;class _M extends Jc{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),j(this,wM),W(this,oM,void 0),W(this,sM,void 0),W(this,aM,1),W(this,lM,1),W(this,cM,1),W(this,uM,""),W(this,dM,0),W(this,hM,[]),W(this,fM,null),W(this,pM,void 0),W(this,mM,[]),W(this,gM,null),W(this,vM,null),W(this,yM,0),W(this,bM,0),W(this,kM,0),W(this,xM,void 0);const[e]=t;U(oM,this,e),U(yM,this,$g()),U(xM,this,B(wM,this,TM).call(this)),B(wM,this,IM).call(this),B(wM,this,EM).call(this),B(wM,this,FM).call(this),B(wM,this,AM).call(this)}get publicAPI(){return z(xM,this)}calcScore(){B(wM,this,WM).call(this)}onDispose(){z(oM,this)&&z(sM,this)&&"function"==typeof z(oM,this).off&&z(oM,this).off(Jp.TIMELINE_PLAYER_STATE,z(sM,this)),U(sM,this,null),B(wM,this,MM).call(this),B(wM,this,OM).call(this),U(oM,this,null),U(mM,this,[]),U(hM,this,[]),U(xM,this,null)}}function TM(){const t=this;return{get score(){return z(aM,t)},get status(){return z(uM,t)},get streamQualityScore(){return z(lM,t)},get fpsScore(){return z(cM,t)},get browserFps(){return z(dM,t)},get waitingSeconds(){return z(bM,t)/1e3},get playingSeconds(){return z(kM,t)/1e3}}}function IM(){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 EM(){z(oM,this)&&"function"==typeof z(oM,this).on&&(U(sM,this,(t=>B(wM,this,SM).call(this,t))),z(oM,this).on(Jp.TIMELINE_PLAYER_STATE,z(sM,this)))}function SM(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||B(wM,this,NM).call(this,null):B(wM,this,NM).call(this,"waiting"):B(wM,this,NM).call(this,"playing")}function NM(t){if(t===z(gM,this))return;const e=$g();z(gM,this)&&Number.isFinite(z(vM,this))&&z(mM,this).push({state:z(gM,this),startMs:z(vM,this),endMs:e}),U(gM,this,t),U(vM,this,t?e:null),B(wM,this,DM).call(this,e)}function AM(){const t=Number(this.settings.calcScoreInterval);!Number.isFinite(t)||t<=0||(U(pM,this,(()=>B(wM,this,WM).call(this))),Tb(z(pM,this),1e3*t))}function MM(){z(pM,this)&&Ib(z(pM,this)),U(pM,this,null)}function FM(){if("function"!=typeof pb)return;const t=()=>{if(this._disposed)return;const e=$g();U(dM,this,B(wM,this,PM).call(this,z(hM,this),e)),U(fM,this,pb(t))};U(fM,this,pb(t))}function OM(){z(fM,this)&&"function"==typeof mb&&mb(z(fM,this)),U(fM,this,null)}function PM(t,e){const n=B(wM,this,CM).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 CM(){const t=Number(this.settings.windowSeconds);return!Number.isFinite(t)||t<=0?3e4:1e3*t}function DM(t){const e=t-B(wM,this,CM).call(this);for(;z(mM,this).length&&z(mM,this)[0].endMs<=e;)z(mM,this).shift()}function RM(t){const e=t-B(wM,this,CM).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 z(mM,this).forEach((t=>{r(t.state,t.startMs,t.endMs)})),z(gM,this)&&Number.isFinite(z(vM,this))&&r(z(gM,this),z(vM,this),t),U(bM,this,n),U(kM,this,i),{waitingMs:n,playingMs:i}}function BM(t,e){if(t<=0)return 1;if(t>e)return 0;const n=e||1;return Qf(1-t*this.settings.waitingMultiplier/n)}function LM(){if($g()-z(yM,this)<=1e3*this.settings.fpsGracePeriod)return 1;const t=Number(z(dM,this)),e=Yp.isDesktop()?this.settings.bestFpsDesktop:this.settings.bestFpsMobile,n=Qf(e>0?t/e:0);return"quad"===this.settings.fpsMathFuncType?n*n:n}function zM(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 WM(){const t=$g(),{waitingMs:e,playingMs:n}=B(wM,this,RM).call(this,t),i=B(wM,this,BM).call(this,e,n),r=B(wM,this,LM).call(this),o=Qf(i*this.settings.streamQualityWeight+r*this.settings.fpsWeight);o!==z(aM,this)&&(U(aM,this,o),this.trigger(Jp.QOE_SCORE,o)),U(lM,this,i),U(cM,this,r);const s=B(wM,this,zM).call(this,o,e);s!==z(uM,this)&&(U(uM,this,s),this.trigger(Jp.QOE_STATUS,s))}function UM(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}function jM(t){const e=Number(t);return!Number.isFinite(e)||e<0?0:e}var $M=new WeakMap,qM=new WeakMap,VM=new WeakMap,GM=new WeakMap,HM=new WeakSet;class KM extends Jc{get name(){return"SegmentEvictionCoordinator"}get defaults(){return{enabled:sv("segmentEvictionEnabled"),bufferBehindSeconds:sv("segmentEvictionBufferBehindSeconds"),bufferAheadSeconds:sv("segmentEvictionBufferAheadSeconds"),maxRetainedBytes:sv("segmentEvictionMaxRetainedBytes")}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"evictAtTime"])}constructor(t,e,n={}){super(n),j(this,HM),W(this,$M,void 0),W(this,qM,void 0),W(this,VM,void 0),W(this,GM,void 0),U($M,this,t),U(qM,this,e),U(VM,this,(t=>B(HM,this,XM).call(this,t))),U(GM,this,(t=>B(HM,this,YM).call(this,t))),z($M,this)&&"function"==typeof z($M,this).on&&(z($M,this).on(Jp.TIMELINE_TIME_UPDATE,z(VM,this)),z($M,this).on(Jp.TIMELINE_SEEKED,z(GM,this)))}onDispose(){z($M,this)&&"function"==typeof z($M,this).off&&(z($M,this).off(Jp.TIMELINE_TIME_UPDATE,z(VM,this)),z($M,this).off(Jp.TIMELINE_SEEKED,z(GM,this))),U($M,this,null),U(qM,this,null),U(VM,this,null),U(GM,this,null)}evictAtTime(t){if(!0!==this.settings.enabled)return;const e=Number(t);if(!Number.isFinite(e))return;const n=jM(this.settings.bufferBehindSeconds),i=jM(this.settings.bufferAheadSeconds),r=e-n,o=e+i,s=B(HM,this,QM).call(this);if(!s.length)return;const a=Number(this.settings.maxRetainedBytes);if(Number.isFinite(a)&&a>0&&B(HM,this,JM).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=ep(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=B(HM,this,ZM).call(this,e);if(!n)return;const i=t.filter((t=>B(HM,this,tF).call(this,t,r,o)));i.length?B(HM,this,eF).call(this,n,i,r,o):"function"==typeof n.evict&&n.evict()}))}}function XM(t){var e,n;if(!0!==this.settings.enabled)return;if((null===(e=z($M,this))||void 0===e?void 0:e.state)===sm)return;const i=Number(null==t?void 0:t.time),r=Number.isFinite(i)?i:Number(null===(n=z($M,this))||void 0===n?void 0:n.currentTime);this.evictAtTime(r)}function YM(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=z($M,this))||void 0===e?void 0:e.currentTime);this.evictAtTime(i)}function QM(){var t;const e=null===(t=z($M,this))||void 0===t?void 0:t.placements;return Array.isArray(e)?e:[]}function JM(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=B(HM,this,ZM).call(this,i),o=Number(null==r?void 0:r.retainedByteLength);vg(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=>{vg(null==t?void 0:t.retainedByteLength)&&(n+=t.retainedByteLength)}))}))})),n}function ZM(t){if(z(qM,this)&&"function"==typeof z(qM,this).get)return z(qM,this).get(t)}function tF(t,e,n){const i=ep(t);if(!Number.isFinite(i))return!1;const r=Zf(t,z(qM,this));return(Number.isFinite(r)?i+r:Number.POSITIVE_INFINITY)>e&&i<n}function eF(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=UM(null==t?void 0:t.offset,0);r.forEach((t=>{if(!t||!vg(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=ep(a);if(!Number.isFinite(l))continue;const c=UM(null==a?void 0:a.nodeOffsetOverride,0),u=UM(null==t?void 0:t.offset,NaN);if(!Number.isFinite(u))continue;const d=UM(null==t?void 0:t.duration,0),h=l+o+u-c,f=h+(d>0?d:0),p=Zf(a,z(qM,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 nF=new WeakMap,iF=new WeakMap,rF=new WeakMap,oF=new WeakSet;class sF extends Jc{get name(){return"DocumentVisibility"}get defaults(){return{autoPauseOnVisibilityChange:!0,autoResumeOnVisibilityChange:!0}}constructor(t,e={}){super(e),j(this,oF),W(this,nF,void 0),W(this,iF,null),W(this,rF,!1),U(nF,this,t),B(oF,this,aF).call(this)}onDispose(){B(oF,this,lF).call(this),U(nF,this,null),U(rF,this,!1)}}function aF(){const t=null==eu?void 0:eu.document;t&&"function"==typeof t.addEventListener&&(U(iF,this,(()=>B(oF,this,cF).call(this))),t.addEventListener("visibilitychange",z(iF,this)))}function lF(){const t=null==eu?void 0:eu.document;z(iF,this)&&t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",z(iF,this)),U(iF,this,null)}function cF(){const t=null==eu?void 0:eu.document,e=null==t?void 0:t.visibilityState;"string"==typeof e&&("hidden"!==e?"visible"===e&&B(oF,this,dF).call(this):B(oF,this,uF).call(this))}function uF(){var t;(null===(t=this.settings)||void 0===t?void 0:t.autoPauseOnVisibilityChange)&&z(nF,this)&&"function"==typeof z(nF,this).pause&&(z(nF,this).state===im?(this.log.info("[#handleHidden] Pausing timeline due to document visibility change"),z(nF,this).pause(),U(rF,this,!0)):U(rF,this,!1))}function dF(){var t;z(rF,this)&&(null===(t=this.settings)||void 0===t?void 0:t.autoResumeOnVisibilityChange)&&z(nF,this)&&"function"==typeof z(nF,this).play&&(z(nF,this).state!==im?(this.log.info("[#handleVisible] Resuming timeline due to document visibility change"),z(nF,this).play(),U(rF,this,!1)):U(rF,this,!1))}const hF=[{event:"canplay",once:!0,trackAs:"canplay"},{event:"playing",once:!0,trackAs:"startedplaying"},"play","playing","waiting","pause","seeking","seeked","nodestart","nodeend"];function fF(t,e=0){return Number.isFinite(t)?t:e}function pF(t){const e=null==t?void 0:t.exposedPlayerAPI;return e&&"object"==typeof e?e:t}const mF=[function(t){return{schema:"iglu:com.helloeko/player/jsonschema/1-0-6",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:fF(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:fF(null==r?void 0:r.volume),playercontainerwidth:fF(null==r?void 0:r.containerWidth),playercontainerheight:fF(null==r?void 0:r.containerHeight)}}}},function(t){return{schema:"iglu:com.helloeko/currentnode/jsonschema/1-0-1",match:/^.*$/,getData:()=>{var e;const n=pF(t),i=function(t){const e=pF(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==eu||null===(t=eu.eko)||void 0===t||null===(t=t.environment)||void 0===t?void 0:t.embeddingApp;return e?{embeddingapp:e}:{}}}}],gF=Object.freeze({once:!1,trackAs:""});var vF=new WeakMap,yF=new WeakMap,bF=new WeakMap,kF=new WeakMap,xF=new WeakSet;class wF extends Jc{get name(){return"Tracker"}get defaults(){return{trackingEnabled:sv("trackingEnabled"),defaultForwarders:hF,defaultContextPackers:mF}}constructor(t,e={}){super(e),j(this,xF),W(this,vF,void 0),W(this,yF,new Map),W(this,bF,[]),W(this,kF,!1),U(vF,this,t),B(xF,this,NF).call(this),B(xF,this,_F).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=B(xF,this,MF).call(this);n&&n("track",t,...e)}registerContextPacker(t){if(!t||"object"!=typeof t)return void this.log.warn("[registerContextPacker] Expected a packer object.");const e={schema:t.schema,match:t.match,getData: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=B(xF,this,MF).call(this);n&&n("registerContextPacker",e)}onDispose(){B(xF,this,SF).call(this),B(xF,this,AF).call(this),U(vF,this,null),U(kF,this,!1)}}function _F(){(Array.isArray(this.settings.defaultForwarders)?this.settings.defaultForwarders:[]).forEach((t=>B(xF,this,TF).call(this,t)))}function TF(t){const e=B(xF,this,IF).call(this,t);if(!e)return void this.log.warn("[#addEventForwarder] Invalid forwarder input.",t);const n=z(vF,this);if(!n||"function"!=typeof n.on)return;const i=B(xF,this,EF).call(this,e);if(z(yF,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),z(yF,this).set(i,{event:e.event,listener:r})}function IF(t){return"string"==typeof t&&t?{event:t,...gF}: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 EF({event:t,once:e,trackAs:n}){return`${t}:${e}:${n}`}function SF(){const t=z(vF,this);t&&"function"==typeof t.off&&z(yF,this).forEach((({event:e,listener:n})=>{t.off(e,n)})),z(yF,this).clear()}function NF(){(Array.isArray(this.settings.defaultContextPackers)?this.settings.defaultContextPackers:[]).forEach((t=>{if("function"!=typeof t)return;const e=t(z(vF,this),this);e&&"object"==typeof e&&("function"==typeof e.dispose&&z(bF,this).push(e.dispose),e.disabled||this.registerContextPacker({schema:e.schema,match:e.match,getData:e.getData}))}))}function AF(){z(bF,this).forEach((t=>{try{t()}catch(t){this.log.warn("[#teardownContextPackers] Failed disposing context packer.",t)}})),U(bF,this,[])}function MF(){const t=null==eu?void 0:eu.EkoAnalytics;return"function"==typeof t?t:(B(xF,this,FF).call(this),null)}function FF(){this.settings.trackingEnabled&&!z(kF,this)&&(this.log.warn("EkoAnalytics not found on window."),U(kF,this,!0))}class OF{#T;#et;#nt;#it;#rt;#ot;#st;#at;#lt;#ct;#ut;#dt;#ht;#ft;#pt;#mt;#gt;#vt;#yt;constructor(t,e={},n=null){this.#T=new iu(t,e),this.#et=new du(this.#T,e),this.#nt=new sb(e),this.#it=new fv(e),this.#rt=new Uy(this.#it,e),this.#ot=new Ry(this.#rt,this.#nt,e),this.#st=new Xy(this.#ot,e),this.#at=new iA(this.#ot,e),this.#lt=new sF(this.#at,e),this.#vt=new KM(this.#at,this.#ot,e),this.#ct=new Gb(this.#ot,this.#st,this.#nt,this.#at,e),this.#ut=new Fk(this.#ot,this.#st,this.#at,e),this.#dt=new MT(e),this.#ht=new eI(this.#ot,this.#at,this.#dt,e),this.#pt=new _M(this.#at,e),this.#yt=new wF(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.#mt=r?r({timeline:this.#at,canvas:this.#T,containerSize:this.#et,options:e}):new Um(this.#at,this.#T,this.#et,e),this.#ft=o?o({timeline:this.#at,decodeCoordinator:this.#ht,options:e}):new RE(this.#at,this.#ht,e),this.#gt=new nE(this.#at,this.#mt,e)}get canvas(){return this.#T}get containerSize(){return this.#et}get assetsDeliveryService(){return this.#nt}get downloadSpeed(){return this.#it}get abrSelector(){return this.#rt}get nodeRepository(){return this.#ot}get nodePrioritizer(){return this.#st}get timeline(){return this.#at}get documentVisibility(){return this.#lt}get nodeResolver(){return this.#ct}get segmentLoadCoordinator(){return this.#ut}get decoderFactory(){return this.#dt}get parsingManager(){return this.#ht}get audioAdapter(){return this.#ft}get audioPlaybackManager(){return this.#ft}get qoe(){return this.#pt}get renderAdapter(){return this.#mt}get renderer(){return this.#mt}get transitionManager(){return this.#gt}get tracker(){return this.#yt}dispose(){[this.#yt,this.#at,this.#lt,this.#ut,this.#ct,this.#st,this.#ot,this.#nt,this.#rt,this.#it,this.#ht,this.#dt,this.#ft,this.#pt,this.#mt,this.#gt,this.#vt,this.#et,this.#T].forEach((t=>{t&&"function"==typeof t.dispose&&t.dispose()})),this.#at=null,this.#lt=null,this.#ut=null,this.#ct=null,this.#st=null,this.#ot=null,this.#nt=null,this.#rt=null,this.#it=null,this.#ht=null,this.#dt=null,this.#ft=null,this.#pt=null,this.#mt=null,this.#gt=null,this.#vt=null,this.#T=null,this.#yt=null}}const PF="main.1146573";var CF={isPlainObject:Hc,deepMerge:Kc,get:zg,set:Wg,ekoGlobalStore:Ug,download:nv,isPositiveNumber:vg,clamp01:Qf,root:eu,now:$g,getFrameDimensions:iN,useragent:Qp,requestAnimationFrame:pb,cancelAnimationFrame:mb,start:Tb,stop:Ib,isTicking:Eb,predicator:function(t,e){const n=e||{};if("function"!=typeof t)return void gb.error("[predicator] Bad argument given to predicator, first argument must be a function.",arguments);if(t.apply())return gb.debug("[predicator] Invoking onFulfilled immediately."),void("function"==typeof n.onFulfilled&&n.onFulfilled.call(null,0));const i=n.timeout||1e4,r=n.interval,o=$g();let s,a,l,c,u;c=function(){t.apply()&&l()},l=function(){Ib(c),eu.clearTimeout(s),u=$g()-o,gb.debug("[predicator] Invoking onFulfilled after "+u+" ms."),"function"==typeof n.onFulfilled&&n.onFulfilled.call(null,u)},a=function(){Ib(c),u=$g()-o,gb.debug("[predicator] Invoking onTimeout after "+u+" ms."),"function"==typeof n.onTimeout&&n.onTimeout.call(null,u)},s=eu.setTimeout(a,i),Tb(c,r)},createThrottler:Sb,scheduleExecution:Nb},DF=new WeakMap,RF=new WeakMap,BF=new WeakMap,LF=new WeakMap,zF=new WeakMap,WF=new WeakMap,UF=new WeakMap,jF=new WeakSet;class $F{constructor(t){j(this,jF),W(this,DF,[]),W(this,RF,[]),W(this,BF,new wN("placement-")),W(this,LF,new wN("renderplacement-")),W(this,zF,void 0),W(this,WF,new Map),W(this,UF,void 0),U(zF,this,t),U(UF,this,{allowUnready:!0,getNode:t=>B(jF,this,qF).call(this,t)})}get placements(){return z(DF,this).slice()}get renderPlacements(){return z(RF,this).slice()}getNodesAtTime(t){B(jF,this,VF).call(this);const e=B(jF,this,HF).call(this,t);if(!Number.isFinite(e))return[];const n=z(DF,this).filter((t=>np(t,e,null,z(UF,this)))),i=[];return n.forEach((t=>{const e=B(jF,this,qF).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&&z(WF,this).set(r,i);const o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=ap(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}:sp(e,n);let u,d,h,f=!1;const p=null!==a;if(a){const t=z(DF,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=ep(t);if("start"===a.anchor)Number.isFinite(e)?u=e:f=!0;else{const n=B(jF,this,GF).call(this,t);Number.isFinite(e)&&n>0?u=e+n:f=!0}}else if(l){const t=n.offsetAnchorPlacementId?z(DF,this).find((t=>(null==t?void 0:t.placementId)===n.offsetAnchorPlacementId)):z(DF,this).length?z(DF,this)[z(DF,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==t?void 0:t.placementId),d){const e=ep(t),n=B(jF,this,GF).call(this,t);Number.isFinite(e)&&n>0?u=e+n-c:(f=!0,h="end")}else u=-c}else u=op(e);const m=z(BF,this).claim(n.placementId),g={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 z(DF,this).push(g),ip(z(DF,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=ap(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=z(DF,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=ep(t);if("start"===c.anchor)Number.isFinite(e)?o=e:l=!0;else{const n=B(jF,this,GF).call(this,t);Number.isFinite(e)&&Number.isFinite(n)?o=e+n:l=!0}}else o=op(e);const d=z(LF,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;lp(z(RF,this),t,e,"TimelineDefinition.placeRenderNodeOnTimeline does not allow overlapping render nodes")}return z(RF,this).push(m),ip(z(RF,this)),d}}function qF(t){if(t)return z(zF,this)&&"function"==typeof z(zF,this).get?z(zF,this).get(t):z(WF,this).get(t)}function VF(){return rp(z(DF,this),{getPlacementDuration:t=>B(jF,this,GF).call(this,t)}).updated}function GF(t){return Zf(t,null,z(UF,this))}function HF(t){if("end"===t){const t=B(jF,this,KF).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 KF(){let t;return z(DF,this).forEach((e=>{const n=ep(e);if(!Number.isFinite(n))return;const i=B(jF,this,GF).call(this,e);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(t)||r>t)&&(t=r)})),t}const XF=new Set(["canplay","play","playing","waiting","pause","seeking","seeked"]);var YF=new WeakMap,QF=new WeakMap,JF=new WeakMap,ZF=new WeakMap,tO=new WeakMap,eO=new WeakMap,nO=new WeakMap,iO=new WeakMap,rO=new WeakMap,oO=new WeakMap,sO=new WeakMap,aO=new WeakMap,lO=new WeakMap,cO=new WeakMap,uO=new WeakMap,dO=new WeakMap,hO=new WeakMap,fO=new WeakMap,pO=new WeakMap,mO=new WeakMap,gO=new WeakMap,vO=new WeakMap,yO=new WeakMap,bO=new WeakMap,kO=new WeakMap,xO=new WeakSet;class wO extends Jc{get name(){return"EkoPlayer"}get exposedPlayerAPI(){return z(ZF,this)}constructor(t,e={}){const{options:n,publicOptions:i}=function(t={}){const e=Kc({},rv,t);Object.entries(iv).forEach((([t,{targetPaths:n}])=>{void 0!==e[t]&&n.forEach((n=>{void 0===zg(e,n)&&Wg(e,n,e[t])}))}));const n=function(t){const e={};return Object.keys(iv).forEach((n=>{Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})),Object.freeze(e)}(e);return ov.info("Processed options:",e),ov.info("Public options:",n),{options:e,publicOptions:n}}(e);return super(n),j(this,xO),W(this,YF,void 0),W(this,QF,void 0),W(this,JF,void 0),W(this,ZF,void 0),W(this,tO,void 0),W(this,eO,void 0),W(this,nO,void 0),W(this,iO,void 0),W(this,rO,void 0),W(this,oO,void 0),W(this,sO,void 0),W(this,aO,void 0),W(this,lO,void 0),W(this,cO,void 0),W(this,uO,void 0),W(this,dO,void 0),W(this,hO,void 0),W(this,fO,void 0),W(this,pO,void 0),W(this,mO,void 0),W(this,gO,void 0),W(this,vO,void 0),W(this,yO,void 0),W(this,bO,void 0),W(this,kO,0),U(JF,this,i),this.log.info("Initializing EkoPlayer with options:",i),U(aO,this,new OF(t,n,this)),B(xO,this,OO).call(this,z(aO,this)),U(uO,this,(t=>B(xO,this,_O).call(this,t))),z(QF,this)&&"function"==typeof z(QF,this).on&&z(QF,this).on(Jp.TIMELINE_CUEPOINT,z(uO,this)),U(dO,this,null),U(fO,this,(t=>B(xO,this,TO).call(this,t))),U(pO,this,(t=>{const e=t&&"object"==typeof t?t:{};B(xO,this,TO).call(this,{...e,event:"seeking"})})),U(mO,this,(t=>{const e=t&&"object"==typeof t?t:{};B(xO,this,TO).call(this,{...e,event:"seeked"})})),z(QF,this)&&"function"==typeof z(QF,this).on&&(z(QF,this).on(Jp.TIMELINE_PLAYER_STATE,z(fO,this)),z(QF,this).on(Jp.TIMELINE_SEEKING,z(pO,this)),z(QF,this).on(Jp.TIMELINE_SEEKED,z(mO,this))),U(yO,this,(t=>{const e=t&&"object"==typeof t?t:{};this.trigger(Jp.CONTAINER_RESIZE,e)})),z(lO,this)&&"function"==typeof z(lO,this).on&&z(lO,this).on(Jp.CONTAINER_RESIZE,z(yO,this)),B(xO,this,NO).call(this),B(xO,this,SO).call(this),U(ZF,this,B(xO,this,FO).call(this)),z(ZF,this)}onDispose(){z(QF,this)&&"function"==typeof z(QF,this).off&&z(uO,this)&&z(QF,this).off(Jp.TIMELINE_CUEPOINT,z(uO,this)),U(uO,this,null),z(QF,this)&&"function"==typeof z(QF,this).off&&(z(fO,this)&&z(QF,this).off(Jp.TIMELINE_PLAYER_STATE,z(fO,this)),z(pO,this)&&z(QF,this).off(Jp.TIMELINE_SEEKING,z(pO,this)),z(mO,this)&&z(QF,this).off(Jp.TIMELINE_SEEKED,z(mO,this))),U(fO,this,null),U(pO,this,null),U(mO,this,null),U(dO,this,null),z(lO,this)&&"function"==typeof z(lO,this).off&&z(yO,this)&&z(lO,this).off(Jp.CONTAINER_RESIZE,z(yO,this)),U(yO,this,null),z(sO,this)&&"function"==typeof z(sO,this).off&&(z(gO,this)&&z(sO,this).off("qoescore",z(gO,this)),z(vO,this)&&z(sO,this).off("qoestatus",z(vO,this))),U(gO,this,null),U(vO,this,null),z(oO,this)&&"function"==typeof z(oO,this).off&&z(bO,this)&&z(oO,this).off(Jp.DECODER_ERROR,z(bO,this)),U(bO,this,null),U(kO,this,0),z(cO,this)&&"function"==typeof z(cO,this).dispose&&z(cO,this).dispose(),U(cO,this,null),z(aO,this)&&"function"==typeof z(aO,this).dispose&&z(aO,this).dispose(),U(QF,this,null),U(YF,this,null),U(eO,this,null),U(nO,this,null),U(iO,this,null),U(rO,this,null),U(oO,this,null),U(sO,this,null),U(lO,this,null),U(tO,this,null),U(ZF,this,null),U(aO,this,null)}}function _O(t={}){var e;this.trigger(Jp.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 TO(t={}){const e="string"==typeof(null==t?void 0:t.event)?t.event:"";if(!XF.has(e))return;if("playing"!==e||Number.isFinite(z(hO,this))||U(hO,this,$g()),z(dO,this)===e)return;U(dO,this,e);const n=Number.isFinite(null==t?void 0:t.time)?t.time:z(QF,this)&&Number.isFinite(z(QF,this).currentTime)?z(QF,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 IO(){return new $F(z(YF,this))}function EO(t){if(!t||"object"!=typeof t)throw new Error("EkoPlayer.switchTimeline requires a timeline definition");if(!z(QF,this)||"function"!=typeof z(QF,this).applyTimelineDefinition)throw new Error("EkoPlayer.switchTimeline requires an active timeline");z(QF,this).applyTimelineDefinition(t),"function"==typeof z(QF,this).play&&z(QF,this).play()}function SO(){z(sO,this)&&"function"==typeof z(sO,this).on&&(U(gO,this,(t=>{this.trigger(Jp.QOE_SCORE,t)})),U(vO,this,(t=>{this.trigger(Jp.QOE_STATUS,t)})),z(sO,this).on(Jp.QOE_SCORE,z(gO,this)),z(sO,this).on(Jp.QOE_STATUS,z(vO,this)))}function NO(){z(oO,this)&&"function"==typeof z(oO,this).on&&(U(bO,this,(t=>{const e=t&&"object"==typeof t?t:{error:t};this.trigger(Jp.DECODER_ERROR,e),B(xO,this,AO).call(this,e)})),z(oO,this).on(Jp.DECODER_ERROR,z(bO,this)))}function AO(t={}){var e;const n=z(QF,this);if(!n||"number"!=typeof n.currentTime)return;const i=Date.now();if(i<z(kO,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;U(kO,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 MO(t={}){if(z(cO,this))return z(cO,this);const e=t&&"object"==typeof t&&!Array.isArray(t)?{...t}:{},n=z(tO,this)&&z(tO,this).element?z(tO,this).element:null;if(!n)throw new Error("Debug overlay requires an initialized player canvas and mount element.");const i=function({canvasElement:t,containerElement:e}={}){const n=t&&t.parentNode?t.parentNode:null;if(null==e)return n;const i=function(t,e=(null==eu?void 0:eu.document)){if(nu(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 nu(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:n,containerElement:e.containerElement});if(!i)throw new Error("Debug overlay requires an initialized player canvas and mount element.");Object.prototype.hasOwnProperty.call(e,"containerElement")&&delete e.containerElement;const r=await import("./debug-overlay-BIxN1VnC.esm.js"),o=(null==r?void 0:r.createDebugOverlay)||(null==r?void 0:r.default);if("function"!=typeof o)throw new Error("Debug overlay bundle does not export createDebugOverlay().");return e.publicOptions=z(JF,this),e.playerVersion=PF,U(cO,this,o({mountElement:i,canvasElement:n,timeline:z(QF,this),getNode:t=>z(YF,this)&&"function"==typeof z(YF,this).get?z(YF,this).get(t):void 0,listNodes:()=>z(YF,this)&&"function"==typeof z(YF,this).list?z(YF,this).list():[],downloadSpeed:z(aO,this)?z(aO,this).downloadSpeed:void 0,downloadEvents:Dg,qoe:z(sO,this)?z(sO,this).publicAPI:void 0,qoeEvents:this,options:e,playbackStartedAtMs:z(hO,this)})),z(cO,this)}function FO(){const t=this;return{createTimeline:()=>B(xO,t,IO).call(t),switchTimeline:e=>B(xO,t,EO).call(t,e),play:z(QF,this).play,pause:z(QF,this).pause,reset:z(QF,this).reset,placeOnTimeline:z(QF,this).placeOnTimeline,placeRenderNodeOnTimeline:z(QF,this).placeRenderNodeOnTimeline,addNode:z(YF,this).add,getNode:z(YF,this).get,listNodes:z(YF,this).list,getNodesAtTime:e=>z(QF,t).getNodesAtTime(e),dispose:this.dispose,on:t.on,off:t.off,once:t.once,trigger:t.trigger,transitionTo:(e,n)=>z(nO,t).transitionTo(e,n),track:(e,...n)=>{if(z(rO,t)&&"function"==typeof z(rO,t).track)return z(rO,t).track(e,...n)},seekToPlacement:e=>z(QF,t).seekToPlacement(e),get currentTime(){return z(QF,t).currentTime},set currentTime(e){z(QF,t).currentTime=e},get buffered(){return z(QF,t).buffered},get options(){return z(JF,t)},get containerWidth(){return z(lO,t)?z(lO,t).containerWidth:0},get containerHeight(){return z(lO,t)?z(lO,t).containerHeight:0},get playbackRate(){return z(QF,t).playbackRate},set playbackRate(e){z(QF,t).playbackRate=e},get paused(){return!!z(QF,t)&&!0===z(QF,t).paused},get muted(){return!!z(iO,t)&&z(iO,t).muted},set muted(e){z(iO,t)&&(z(iO,t).muted=e)},get volume(){return z(iO,t)?z(iO,t).volume:1},set volume(e){z(iO,t)&&(z(iO,t).volume=e)},get qoe(){return z(sO,t)?z(sO,t).publicAPI:void 0},get utils(){return CF},get version(){return PF},loadDebugOverlay:(...e)=>B(xO,t,MO).call(t,...e)}}function OO(t){t&&(U(tO,this,t.canvas),U(YF,this,t.nodeRepository),U(QF,this,t.timeline),U(iO,this,t.audioAdapter||t.audioPlaybackManager),U(rO,this,t.tracker),U(oO,this,t.parsingManager),U(sO,this,t.qoe),U(eO,this,t.renderAdapter||t.renderer),U(nO,this,t.transitionManager),U(lO,this,t.containerSize))}class PO{constructor({target:t,props:e}){if(!t)throw new Error("`options.target` is required");lo(this.#bt,e,!0),this.#bt.v.EkoPlayer=wO;const n=t.hasChildNodes()?Rs:Ds;this.#kt=n(Sc,{target:t,props:this.#bt.v})}#kt;#bt=so(fo({}));destroy(t){if(this.#kt)return function(t,e){const n=zs.get(t);return n?(zs.delete(t),n(e)):Promise.resolve()}(this.#kt,t)}get props(){return bs(this.#bt)}}const CO=()=>e.createElement("style",{suppressHydrationWarning:!0},'\n .textBoxDescriptionBox.svelte-17x2i38 {\n width: 100%;\n position: absolute;\n bottom: 0;\n display: flex;\n flex-direction: column;\n gap: 8px;\n box-sizing: border-box;\n 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 );\n }\n\n .step-description.svelte-17x2i38 {\n overflow: hidden;\n position: relative;\n transition: all 0.4s cubic-bezier(0, 1, 0.25, 1);\n font-size: 12px;\n font-weight: 400;\n font-style: normal;\n line-height: 16px;\n letter-spacing: 0px;\n color: #000;\n display: flex;\n flex-direction: column;\n transition: height 0.2s ease;\n interpolate-size: allow-keywords;\n\n > button:where(.svelte-17x2i38) {\n display: flex;\n justify-content: space-between;\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n line-height: 18px;\n gap: 8px;\n font-weight: 400;\n letter-spacing: 0%;\n }\n\n &.expanded {\n > button:where(.svelte-17x2i38) {\n flex-direction: column;\n align-items: flex-start;\n }\n\n p:where(.svelte-17x2i38) {\n -webkit-mask-image: none;\n mask-image: none;\n }\n }\n\n &:not(.expanded) {\n p:where(.svelte-17x2i38) {\n overflow: hidden;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n line-clamp: 1;\n }\n }\n\n h3:where(.svelte-17x2i38) {\n margin: 0;\n font-size: 16px;\n font-weight: 500;\n color: #030303;\n }\n\n p:where(.svelte-17x2i38) {\n margin: 0;\n text-align: left;\n }\n\n span:where(.svelte-17x2i38) {\n color: #014FD3;\n font-size: 12px;\n font-weight: 600;\n flex-shrink: 0;\n }\n }\n.eko-gallery-app {\n --toggleModule_gap: 8px;\n --toggleModule_padding: 10px 58px 0 0;\n --toggleModule_options_padding: 0;\n --toggleModule_options_height: auto;\n --toggleModule_options_width: 100%;\n --toggleModule_options_gap: 8px;\n --toggleModule_button_backgroundColor: #FFFFFF;\n --toggleModule_button_padding: 8px 12px;\n --toggleModule_button_boxShadow: 0px 2px 8px 2px rgba(0, 0, 0, 0.07);\n --toggleModule_button_text_fontFamily: var(--fontName);\n --toggleModule_button_text_fontSize: 12px;\n --toggleModule_button_text_fontWeight: 400;\n --toggleModule_button_text_fontStyle: normal;\n --toggleModule_button_text_lineHeight: 16px;\n --toggleModule_button_text_letterSpacing: -0.2px;\n --toggleModule_button_text_color: #000;\n --toggleModule_button_border_radius: 100px;\n --toggleModule_title_fontFamily: var(--fontName);\n --toggleModule_title_fontSize: 13px;\n --toggleModule_title_fontWeight: 400;\n --toggleModule_title_fontStyle: normal;\n --toggleModule_title_lineHeight: 120%;\n --toggleModule_title_letterSpacing: 0;\n --toggleModule_title_color: #666;\n --toggleModule_title_textAlignment: center;\n --toggleModule_note_fontFamily: var(--fontName);\n --toggleModule_note_fontSize: 12px;\n --toggleModule_note_fontWeight: 400;\n --toggleModule_note_fontStyle: normal;\n --toggleModule_note_lineHeight: 120%;\n --toggleModule_note_letterSpacing: 0;\n --toggleModule_note_color: #888;\n --toggleModule_note_topMargin: 4px;\n}\n\n.toggle-container.svelte-16pmvvn {\n position: absolute;\n top: 0;\n padding: var(--toggleModule_padding);\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: var(--toggleModule_gap);\n pointer-events: auto;\n box-sizing: border-box;\n}\n\n.toggle-options.svelte-16pmvvn {\n width: var(--toggleModule_options_width);\n height: var(--toggleModule_options_height);\n padding: var(--toggleModule_options_padding);\n gap: var(--toggleModule_options_gap);\n display: flex;\n justify-content: end;\n margin: 0;\n}\n\n.toggle-option-container.svelte-16pmvvn {\n position: relative;\n min-width: 0;\n}\n/* (unused) .toggle-option-container:has(button.selected) .option-note {\n animation: optionNoteIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards 0.3s;\n}*/\n\n.toggle-option-button.svelte-16pmvvn {\n border-radius: var(--toggleModule_button_borderRadius);\n font-family: var(--toggleModule_button_text_fontFamily);\n font-size: var(--toggleModule_button_text_fontSize);\n font-weight: var(--toggleModule_button_text_fontWeight);\n font-style: var(--toggleModule_button_text_fontStyle);\n line-height: var(--toggleModule_button_text_lineHeight);\n letter-spacing: var(--toggleModule_button_text_letterSpacing);\n color: var(--toggleModule_button_text_color);\n padding: var(--toggleModule_button_padding);\n border: #E4E5E8 solid 1px;\n background: #FBFBFB;\n display: flex;\n width: 100%;\n height: 100%;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n cursor: pointer;\n position: relative;\n transition: all 0.3s ease-in-out;\n animation-duration: 0.5s;\n animation-timing-function: cubic-bezier(0.36, 0, 0, 1);\n animation-fill-mode: both;\n animation-delay: calc(var(--button-index) * 90ms);\n animation-name: svelte-16pmvvn-button-back-appear-anim;\n transform-origin: bottom center;\n border-radius: var(--toggleModule_button_border_radius);\n}\n.toggle-option-button.selected.svelte-16pmvvn {\n box-shadow: none;\n color: #FFFFFF;\n background: #014FD3;\n border-color: #014FD3;\n}\n.toggle-option-button.svelte-16pmvvn:hover:not(.selected) {\n background: #F3F4F6;\n}\n.toggle-option-button.svelte-16pmvvn:active:not(.selected) {\n background: #E4E5E8;\n}\n.toggle-option-button.svelte-16pmvvn:focus {\n outline-offset: 4px;\n outline-width: 2px;\n}\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}.eko-gallery-app {\n --tryItModule_justifyContent: center;\n --tryItModule_alignItems: flex-end;\n --tryItModule_padding: 16px 20px 48px 20px;\n --tryItModule_button_padding: 16px 32px;\n --tryItModule_button_textAlign: center;\n --tryItModule_button_borderRadius: 100px;\n --tryItModule_button_border: 0;\n --tryItModule_button_boxShadow: 0 4px 24px 2px rgba(0, 0, 0, 0.12);\n --tryItModule_button_background: #FFFFFF;\n --tryItModule_button_text_fontFamily: var(--fontName);\n --tryItModule_button_text_fontSize: 18px;\n --tryItModule_button_text_color: #222;\n --tryItModule_button_text_weight: 500;\n --tryItModule_button_text_lineHeight: 120%;\n --tryItModule_button_text_letterSpacing: -0.1px;\n}\n\n.tryIt-container.svelte-16kucsb {\n position: relative;\n padding: var(--tryItModule_padding);\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n display: flex;\n justify-content: var(--tryItModule_justifyContent);\n align-items: var(--tryItModule_alignItems);\n}\n.tryIt-container.svelte-16kucsb button:where(.svelte-16kucsb) {\n padding: var(--tryItModule_button_padding);\n text-align: var(--tryItModule_button_textAlign);\n border-radius: var(--tryItModule_button_borderRadius);\n border: var(--tryItModule_button_border);\n background: var(--tryItModule_button_background);\n box-shadow: var(--tryItModule_button_boxShadow);\n font-family: var(--tryItModule_button_text_fontFamily);\n font-size: var(--tryItModule_button_text_fontSize);\n color: var(--tryItModule_button_text_color);\n font-weight: var(--tryItModule_button_text_weight);\n line-height: var(--tryItModule_button_text_lineHeight);\n letter-spacing: var(--tryItModule_button_text_letterSpacing);\n cursor: pointer;\n opacity: 0;\n overflow: hidden;\n}\n.tryIt-container.svelte-16kucsb button:where(.svelte-16kucsb) div:where(.svelte-16kucsb) {\n opacity: 0;\n}.eko-gallery-app {\n --nav_gap: 10px;\n --nav_padding: 12px 16px;\n --nav_bgColor: #FFFFFF;\n --nav_justifyContent: center;\n --nav_button_width: fit-content;\n --nav_button_bgColor: #FFFFFF;\n --nav_button_borderRadius: 100px;\n --nav_button_paddingTop: 8px;\n --nav_button_paddingBottom: var(--nav_button_paddingTop);\n --nav_button_paddingLeft: 12px;\n --nav_button_paddingRight: var(--nav_button_paddingLeft);\n --nav_button_boxShadow: 0 0 0 1px #E7E7E7;\n --nav_button_gap: 2px;\n --nav_button_selected_boxShadow: 0 0 0 1px #000000;\n --nav_button_selected_bgColor: var(--nav_button_bgColor);\n --nav_button_text_color: #000000;\n --nav_button_text_fontSize: 14px;\n --nav_button_text_fontWeight: 500;\n --nav_button_text_fontFamily: var(--fontName);\n --nav_button_text_lineHeight: 120%;\n --nav_button_text_letterSpacing: 0px;\n --nav_button_text_align: center;\n --nav_button_selected_text_color: var(--nav_button_text_color);\n --nav_button_selected_text_fontWeight: var(--nav_button_text_fontWeight);\n --nav_button_image_borderRadius: calc(var(--nav_button_borderRadius) - var(--nav_button_paddingTop));\n --nav_arrow_color: var(--secondaryColor);\n --nav_arrow_bgColor: var(--primaryColor);\n --nav_arrow_padding: 9px;\n --nav_arrow_size: 28px;\n --nav_arrow_boxShadow: 0 0 8px 0 rgba(0, 0, 0, 0.3);\n}\n\n.nav-buttons-container.svelte-er27y2 {\n width: 100%;\n background-color: var(--nav_bgColor);\n height: var(--buttonsContainerHeight);\n display: flex;\n box-sizing: border-box;\n text-align: center;\n justify-content: var(--nav_justifyContent);\n align-items: center;\n position: relative;\n flex-shrink: 0;\n}\n\n.nav-buttons.svelte-er27y2 {\n display: flex;\n margin: 0;\n gap: var(--nav_gap);\n height: 100%;\n align-items: center;\n padding: var(--nav_padding);\n box-sizing: border-box;\n overflow-x: auto;\n scrollbar-width: none;\n max-width: 100%;\n width: fit-content;\n overflow-y: hidden;\n overscroll-behavior-y: none;\n}\n\n.nav-button.svelte-er27y2 {\n display: flex;\n outline: none;\n flex-shrink: 0;\n height: 100%;\n width: var(--nav_button_width);\n border: none;\n cursor: pointer;\n align-items: center;\n gap: var(--nav_button_gap);\n transition: all 0.2s ease-in-out;\n background-color: var(--nav_button_bgColor);\n border-radius: var(--nav_button_borderRadius);\n /* eslint-disable-next-line max-len */\n padding: var(--nav_button_paddingTop) var(--nav_button_paddingRight) var(--nav_button_paddingBottom) var(--nav_button_paddingLeft);\n box-shadow: var(--nav_button_boxShadow);\n}\n.nav-button.svelte-er27y2 span:where(.svelte-er27y2) {\n flex: 1 0 0;\n transition: color 0.2s ease-in-out;\n color: var(--nav_button_text_color);\n font-weight: var(--nav_button_text_fontWeight);\n font-size: var(--nav_button_text_fontSize);\n font-family: var(--nav_button_text_fontFamily);\n line-height: var(--nav_button_text_lineHeight);\n letter-spacing: var(--nav_button_text_letterSpacing);\n text-align: var(--nav_button_text_align);\n}\n.nav-button.selected.svelte-er27y2 {\n background-color: var(--nav_button_selected_bgColor);\n box-shadow: var(--nav_button_selected_boxShadow);\n}\n.nav-button.selected.svelte-er27y2 span:where(.svelte-er27y2) {\n color: var(--nav_button_selected_text_color);\n font-weight: var(--nav_button_selected_text_fontWeight);\n}.nav-button.svelte-1al44kl {\n height: 30px;\n width: 30px;\n border-radius: 100%;\n background-color: transparent;\n padding: 9px;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: auto;\n border: 0;\n opacity: 100%;\n cursor: pointer;\n transition-property: background-color, box-shadow, opacity;\n position: relative;\n}\n.nav-button.prev.svelte-1al44kl {\n transform: rotate(180deg);\n}\n.nav-button.hidden.svelte-1al44kl {\n opacity: 0;\n pointer-events: none;\n}\n.nav-button.svelte-1al44kl::before {\n content: "";\n position: absolute;\n top: -8px;\n right: -8px;\n bottom: -8px;\n left: -8px;\n}\n.nav-button.svelte-1al44kl img:where(.svelte-1al44kl) {\n height: 100%;\n}.steps-indicator-container.svelte-1mxltt0 {\n width: calc(100% - 32px);\n position: absolute;\n bottom: 12px;\n left: 16px;\n animation-duration: 0.75s;\n animation-timing-function: cubic-bezier(0.36, 0, 0, 1);\n animation-fill-mode: both;\n animation-delay: 0.15s;\n animation-name: svelte-1mxltt0-gallery-steps-appear-anim;\n}\n\n.steps-indicator.svelte-1mxltt0 {\n --stepSize: 6px;\n --stepPadding: 7px;\n gap: 8px;\n padding: 4px 0px;\n display: flex;\n align-items: center;\n overflow-x: auto;\n pointer-events: all;\n scrollbar-width: none;\n}\n.steps-indicator.with-duration.svelte-1mxltt0 .step-button:where(.svelte-1mxltt0) span:where(.svelte-1mxltt0) {\n position: relative;\n overflow: hidden;\n}\n.steps-indicator.with-duration.svelte-1mxltt0 .step-button:where(.svelte-1mxltt0) span:where(.svelte-1mxltt0):after {\n transition: 0.3s ease-in-out;\n transition-property: opacity, width;\n}\n/* (unused) .steps-indicator.with-duration.paused .step-button span.active:after {\n animation-play-state: paused;\n}*/\n\n.step-button.svelte-1mxltt0 {\n padding: 8px 12px;\n border: #E4E5E8 solid 1px;\n background-color: #FBFBFB;\n cursor: pointer;\n pointer-events: all;\n flex-shrink: 0;\n border-radius: 100px;\n font-size: 12px;\n font-weight: 400;\n line-height: 16px;\n color: #030303;\n transition: all 0.3s ease-in-out;\n outline-color: #3191fc;\n}\n.step-button.active.svelte-1mxltt0 {\n background-color: #014FD3;\n color: #FFFFFF;\n box-shadow: none;\n border-color: #014FD3;\n}\n.step-button.active.svelte-1mxltt0:after {\n opacity: 100%;\n animation: svelte-1mxltt0-stepDurationAnimation var(--stepDuration) linear forwards;\n animation-play-state: running;\n}\n.step-button.svelte-1mxltt0:hover:not(.active) {\n background: #F3F4F6;\n}\n.step-button.svelte-1mxltt0:active:not(.active) {\n background: #E4E5E8;\n}\n.step-button.svelte-1mxltt0:focus {\n outline-offset: 4px;\n outline-width: 2px;\n}\n/* (unused) .step-button:has(> .tiny) {\n pointer-events: none;\n cursor: default;\n}*/\n.step-button.svelte-1mxltt0 span:where(.svelte-1mxltt0) {\n display: block;\n box-sizing: border-box;\n pointer-events: none;\n white-space: nowrap;\n}\n/* (unused) .step-button span.tiny {\n width: calc(var(--stepSize) / 2);\n height: calc(var(--stepSize) / 2);\n}*/\n.step-button.svelte-1mxltt0 span:where(.svelte-1mxltt0):after {\n content: "";\n background-color: rgba(0, 0, 0, 0.6);\n position: absolute;\n border-radius: var(--stepSize);\n width: 0;\n height: 100%;\n top: 0;\n left: -100%;\n opacity: 0;\n transform: translateX(0);\n animation-play-state: paused;\n}\n\n.step-arrow.svelte-1mxltt0 {\n width: 32px;\n height: 34px;\n position: absolute;\n z-index: 10;\n bottom: 4px;\n border: none;\n background-color: #FBFBFB;\n padding: 10px;\n pointer-events: none;\n cursor: pointer;\n opacity: 0;\n}\n.step-arrow.svelte-1mxltt0:hover {\n background: #F6F6F7;\n}\n.step-arrow.svelte-1mxltt0:active {\n background: #E4E5E8;\n}\n\n.step-arrow-prev.svelte-1mxltt0 {\n left: 0;\n transform: translateX(-100%);\n animation: svelte-1mxltt0-arrow-left-disappear 0.3s cubic-bezier(0.36, 0, 0, 1) both;\n}\n.step-arrow-prev.visible.svelte-1mxltt0 {\n pointer-events: auto;\n animation: svelte-1mxltt0-arrow-left-appear 0.3s cubic-bezier(0.36, 0, 0, 1) both;\n}\n.step-arrow-prev.svelte-1mxltt0 img:where(.svelte-1mxltt0) {\n transform: rotate(180deg);\n}\n\n.step-arrow-next.svelte-1mxltt0 {\n right: 0;\n transform: translateX(100%);\n animation: svelte-1mxltt0-arrow-right-disappear 0.3s cubic-bezier(0.36, 0, 0, 1) both;\n}\n.step-arrow-next.visible.svelte-1mxltt0 {\n pointer-events: auto;\n animation: svelte-1mxltt0-arrow-right-appear 0.3s cubic-bezier(0.36, 0, 0, 1) both;\n}\n\nimg.svelte-1mxltt0 {\n height: 100%;\n}\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}.pause-button.svelte-a3r6re {\n position: absolute;\n top: 10px;\n right: 10px;\n background: #FFFFFF;\n border-radius: 100%;\n border: 1px #C4C8CF solid;\n padding: 0;\n width: 32px;\n height: 32px;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: auto;\n transition: background 0.2s ease-in-out;\n cursor: pointer;\n outline-color: #3191fc;\n}\n.pause-button.svelte-a3r6re:hover {\n background: #F6F6F7;\n}\n.pause-button.svelte-a3r6re:active {\n background: #E4E5E8;\n}\n.pause-button.svelte-a3r6re:focus {\n outline-offset: 8px;\n outline-width: 2px;\n}\n.pause-button.svelte-a3r6re img:where(.svelte-a3r6re) {\n width: 16px;\n height: 16px;\n pointer-events: none;\n}.covers-container.svelte-1rvgxfc {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n overflow-x: auto;\n overflow-y: hidden;\n scroll-snap-type: x mandatory;\n display: flex;\n pointer-events: auto;\n}\n.covers-container.svelte-1rvgxfc::-webkit-scrollbar {\n display: none;\n}\n\n.cover-container.svelte-1rvgxfc {\n position: relative;\n width: 100%;\n height: 100%;\n flex-shrink: 0;\n scroll-snap-align: center;\n user-select: none;\n}\n\n.cover-image.svelte-1rvgxfc {\n width: 100%;\n height: 100%;\n object-fit: cover;\n pointer-events: none;\n}\n.cover-image.active.svelte-1rvgxfc {\n opacity: 0;\n}\n\n.ui-container.svelte-1rvgxfc {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n}.eko-gallery-app.svelte-1n46o8q {\n position: relative;\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n user-select: none;\n box-sizing: border-box;\n}\n.eko-gallery-app.svelte-1n46o8q:hover .paging-buttons:where(.svelte-1n46o8q) .nav-button {\n background-color: #FFFFFF;\n box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.12);\n}\n.eko-gallery-app.svelte-1n46o8q * {\n box-sizing: border-box;\n}\n\n.player-container.svelte-1n46o8q {\n position: relative;\n flex: 1;\n width: 100%;\n pointer-events: none;\n overflow: hidden;\n}\n\n.absolute-full.svelte-1n46o8q {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n}\n\n.swipable.svelte-1n46o8q {\n will-change: transform;\n transform: translate3d(var(--uiTranformX, 0), 0, 0);\n}\n\n.paging-buttons.svelte-1n46o8q {\n display: flex;\n justify-content: space-between;\n align-items: center;\n pointer-events: none;\n padding: 0 12px;\n}\n.paging-buttons.svelte-1n46o8q .nav-button {\n transition: 0.2s ease-in-out;\n box-shadow: none;\n}\n.paging-buttons.svelte-1n46o8q .nav-button img {\n opacity: 0.6;\n}'),DO=b("gallery-react");const RO=a(((t,i)=>{const r=n(null),a=n({}),{config:c,debug:u,ssrHtml:d,activeItem:h={index:0,step:0},onEvent:f=()=>{}}=t,p=function(t){return void 0!==t}(c),m=n(h),g=n(d),v=o((t=>{a.current.state=t,t.activeItemIndex===m.current.index&&t.activeModuleIndex===m.current.step||f("activeitemchanged",{index:t.activeItemIndex,step:t.activeModuleIndex})}),[]),y=o((t=>{a.current.API=t,a.current.unsubscribe&&a.current.unsubscribe(),a.current.unsubscribe=t.subscribe(v)}),[]);return s((()=>(DO.setDataStorage("gallery-react",{config:c}),window.eko=window.eko||{},window.eko.config=c,window.eko.gallery={version:"4.0.1"},()=>{window.eko.config=void 0})),[c]),l(i,(()=>({prev:()=>{var t;null===(t=a.current.API)||void 0===t||t.prev()},next:()=>{var t;null===(t=a.current.API)||void 0===t||t.next()}}))),s((()=>{if(null==r||!r.current)return;const t=r.current;return a.current.app=new PO({target:t,props:{config:c,hideNav:!0,onGalleryReady:y}}),()=>{var t;null===(t=a.current.app)||void 0===t||t.destroy()}}),[]),s((()=>{a.current.app&&(a.current.app.props.config=c)}),[c]),s((()=>{a.current.app&&(a.current.app.props.debug=u)}),[u]),s((()=>{m.current=h,a.current.state&&(a.current.state.activeItemIndex===h.index&&a.current.state.activeModuleIndex===h.step||a.current.API.selectItemAndStep(h.index,h.step))}),[h]),p?e.createElement(e.Fragment,null,e.createElement(CO,null),e.createElement("div",q({style:{position:"relative",width:"100%",height:"100%"},ref:r},g.current?{dangerouslySetInnerHTML:{__html:g.current}}:{}))):t.children}));RO.propTypes={className:Pt.string,config:Pt.object,variantId:Pt.string,onEvent:Pt.func,ssrHtml:Pt.string,debug:Pt.bool,activeItem:Pt.shape({index:Pt.number,step:Pt.number}),instanceId:Pt.string,children:Pt.node},RO.displayName="EkoGallerySvelte";const BO=d("v2"),LO=d("v1");export{fn as E,j as _,W as a,U as b,z as c,B as d,u as e,LO as f,BO as g,RO as h,R as w};
14
+ */var bt=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]))vt.call(n,s)&&(r[s]=n[s]);if(gt){i=gt(n);for(var a=0;a<i.length;a++)yt.call(n,i[a])&&(r[i[a]]=n[i[a]])}}return r},kt="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",xt=Function.call.bind(Object.prototype.hasOwnProperty),wt=function(){};if("production"!==process.env.NODE_ENV){var _t=kt,Tt={},It=xt;wt=function(t){var e="Warning: "+t;"undefined"!=typeof console&&console.error(e);try{throw new Error(e)}catch(t){}}}function Et(t,e,n,i,r){if("production"!==process.env.NODE_ENV)for(var o in t)if(It(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,_t)}catch(t){s=t}if(!s||s instanceof Error||wt((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 Tt)){Tt[s.message]=!0;var l=r?r():"";wt("Failed "+n+" type: "+s.message+(null!=l?l:""))}}}Et.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(Tt={})};var St=Et,Nt=function(){};function At(){return null}"production"!==process.env.NODE_ENV&&(Nt=function(t){var e="Warning: "+t;"undefined"!=typeof console&&console.error(e);try{throw new Error(e)}catch(t){}});var Mt=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(At),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+"]",kt);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 mt.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(xt(s,c)){var u=t(s,c,i,r,o+"."+c,kt);if(u instanceof Error)return u}return null}))},oneOf:function(t){if(!Array.isArray(t))return"production"!==process.env.NODE_ENV&&Nt(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."),At;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&&Nt("Invalid argument supplied to oneOfType, expected an instance of array."),At;for(var e=0;e<t.length;e++){var n=t[e];if("function"!=typeof n)return Nt("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+p(n)+" at index "+e+"."),At}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,kt);if(null==c)return null;c.data&&xt(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,kt);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=bt({},e[n],t);for(var d in c){var p=t[d];if(xt(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,kt);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!==kt){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&&(Nt("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=St,o.resetWarningCache=St.resetWarningCache,o.PropTypes=o,o};function Ft(){}function Ot(){}Ot.resetWarningCache=Ft;var Pt=V((function(t){if("production"!==process.env.NODE_ENV){var e=mt;t.exports=Mt(e.isElement,!0)}else t.exports=function(){function t(t,e,n,i,r,o){if(o!==kt){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:Ot,resetWarningCache:Ft};return n.PropTypes=n,n}()}));const Ct=/https?:\/\/(.*?\.)?eko.com/,Dt={"eko.project.interaction":"interaction","eko.project.swipe":"swipe"};let Rt=null,Bt=null,Lt=[];function zt(t){return e=>{var n;if(!Ct.test(e.origin)||"eko.embedapi"!==(null===(n=e.data)||void 0===n?void 0:n.source))return;const i=e.data,r=Dt[i.type];r&&(t?t(r,i.data):Lt.push({type:r,data:i.data}))}}"undefined"!=typeof window&&(Bt=zt(null),window.addEventListener("message",Bt));var Wt={subscribe:function(t){"function"==typeof t?Rt?console.warn("[eko-gallery-react] Ignoring events subscribe since already subscribed"):(Rt=t,Bt=zt(t),window.addEventListener("message",Bt),function(t){Lt.forEach((e=>{t(e.type,e.data)})),Lt=[]}(t)):console.warn("[eko-gallery-react] Ignoring events subscribe since a callback function was not provided as argument")},unsubscribe:function(){Bt?(window.removeEventListener("message",Bt),Bt=null,Rt=null,Lt=[]):console.warn("[eko-gallery-react] Ignoring events unsubscribe since not subscribed")},send:function(t,e){Rt?Rt(t,e):Lt.push({type:t,data:e})}};const Ut=({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){R.track("gallery.interaction",{elementid:`thumbnail-${t}`,interactiontype:"click"}),Wt.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})`}}))))};Ut.propTypes={index:Pt.number,activeIndex:Pt.number,setActiveIndex:Pt.func.isRequired,item:Pt.object.isRequired,src:Pt.string,navItemRefs:Pt.object.isRequired,itemIcon:Pt.string};const jt=({layout:t,nav:i,isVerticalNav:r,showPrevArrow:o,showNextArrow:s})=>{var a,l,c,u,d;const h=n(null),f=n(null),p="arrows"===(null==t||null===(a=t.mobile)||void 0===a||null===(a=a.config)||void 0===a||null===(a=a.navPagination)||void 0===a?void 0:a.type)?"eko-mobile-arrows":"",m="arrows"===(null!==(l=null==t||null===(c=t.desktop)||void 0===c||null===(c=c.config)||void 0===c||null===(c=c.navPagination)||void 0===c?void 0:c.type)&&void 0!==l?l:"arrows")?"eko-desktop-arrows":"",g=p||m,v=r?null==i||null===(u=i.current)||void 0===u?void 0:u.scrollHeight:null==i||null===(d=i.current)||void 0===d?void 0:d.scrollWidth;function y(t){const e=r?i.current.clientHeight:i.current.clientWidth,n=function(t,e){const n=r?e.scrollTop:e.scrollLeft;return Math.max(-n,Math.min(v-t-n,t))}("next"===t?e:-e,i.current);return{top:r?n:0,left:r?0:n,behavior:"smooth"}}function b(t){var e,n,r;const o=y(t),s="next"===t?null==f||null===(e=f.current)||void 0===e?void 0:e.id:null==h||null===(n=h.current)||void 0===n?void 0:n.id;var a,l;window.EkoAnalytics("track","gallery.interaction",{elementid:s,interactiontype:"click"}),null==i||null===(r=i.current)||void 0===r||r.scrollBy(o),a=s,l="click",R.track("gallery.interaction",{elementId:a,interactiontype:l}),Wt.send("interaction",{elementId:a,interactiontype:l})}return e.createElement(e.Fragment,null,g&&e.createElement(e.Fragment,null,e.createElement("button",q({type:"button","aria-label":"Go to previous item","aria-hidden":o?"false":"true",onClick:()=>b("prev"),ref:h,id:"eko-nav-prev-arrow",className:`eko-nav-arrow eko-prev-nav-button ${p} ${m} ${o?"":"eko-hidden-nav-button"}`},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:"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",q({type:"button","aria-label":"Go to next item","aria-hidden":s?"false":"true",onClick:()=>b("next"),ref:f,className:`eko-nav-arrow eko-next-nav-button ${p} ${m} ${s?"":"eko-hidden-nav-button"}`,id:"eko-nav-next-arrow"},s?{}:{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 $t(t,e,n){let i;return function(){const n=this,r=arguments;clearTimeout(i),i=setTimeout((function(){i=null,t.apply(n,r)}),e)}}jt.propTypes={layout:Pt.object.isRequired,nav:Pt.object.isRequired,isVerticalNav:Pt.bool.isRequired,showPrevArrow:Pt.bool.isRequired,showNextArrow:Pt.bool.isRequired};const qt=({items:t,setActiveIndex:a,activeIndex:l,layout:c,carouselMounted:u,forceMobile:d})=>{const h=n(null),f=n(null),p=n([]),m=3,[v,y]=i(null),[b,k]=i(!1),[x,w]=i(0),[_,T]=i(!1),[I,E]=i(!1);function S(){var t;const e=d||window.innerWidth<768?"mobile":"desktop",n=(null==c||null===(t=c[e])||void 0===t||null===(t=t.config)||void 0===t?void 0:t.orientation)||("desktop"===e?"left":"bottom");k("left"===n||"right"===n);const i=f.current.parentNode,r=u?".eko-smart-gallery-container iframe":".eko-carousel",o=i.querySelector(r);setTimeout((()=>{w(o.clientHeight)}),0)}function N(){var t,e;const n=d||g()?"mobile":"desktop",i=null!==(t=null==c||null===(e=c[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:m;!function(t=m){var e,n;const i=h.current;if(!i)return;const r="none"!==(null==c||null===(e=c.desktop)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.navPagination)||void 0===e?void 0:e.type),o=(s=null==c||null===(n=c.mobile)||void 0===n||null===(n=n.config)||void 0===n||null===(n=n.navPagination)||void 0===n?void 0:n.type,"mask"===s||"arrows"===s);var s;if((d||g())&&!o)return void i.style.setProperty("-webkit-mask","none");if(!g()&&!r)return void i.style.setProperty("-webkit-mask","none");const a=i.scrollHeight-i.clientHeight,l=i.scrollTop>t?"85%":"100%",u=i.scrollTop<=a-t?"15%":"0%",f=i.scrollWidth-i.clientWidth,p=i.scrollLeft>t?"15%":"0%",v=i.scrollLeft<=f-t?"85%":"100%";b?i.style.setProperty("-webkit-mask",`linear-gradient(0deg,#0000,#000 ${u} ${l},#0000)`):i.style.setProperty("-webkit-mask",`linear-gradient(90deg,#0000,#000 ${p} ${v},#0000)`)}(i),function(t=m){var e,n,i,r,o,s;const a=b?null==h||null===(e=h.current)||void 0===e?void 0:e.scrollTop:null==h||null===(n=h.current)||void 0===n?void 0:n.scrollLeft,l=b?null==h||null===(i=h.current)||void 0===i?void 0:i.clientHeight:null==h||null===(r=h.current)||void 0===r?void 0:r.clientWidth,c=b?null==h||null===(o=h.current)||void 0===o?void 0:o.scrollHeight:null==h||null===(s=h.current)||void 0===s?void 0:s.scrollWidth;c-t<l?(T(!1),E(!1)):a<=t?(T(!1),E(!0)):a+l>c-t?(T(!0),E(!1)):a+t>0&&a<c-t&&(T(!0),E(!0))}(i)}p.current=null==t?void 0:t.map(((t,e)=>{var n,i;return null!==(n=null==p||null===(i=p.current)||void 0===i?void 0:i[e])&&void 0!==n?n:r()}));const A=$t((t=>{var e;e=t,R.track("gallery.interaction",{elementid:"nav",interactiontype:e}),Wt.send("interaction",{elementid:"nav",interactiontype:e})}),200);const M=o((t=>{a({index:t,step:0,source:"nav"})}),[]);return s((()=>{var t;y(null===(t=p.current)||void 0===t?void 0:t[l])}),[l]),s((()=>{if(null!=v&&v.current&&null!=h&&h.current){const t=v.current,e=h.current.clientWidth/2,n=t.clientWidth/2,i=h.current.clientHeight/2,r=t.clientHeight/2;h.current.scrollTo({left:t.offsetLeft-e+n,top:t.offsetTop-i+r,behavior:"smooth"})}}),[v]),s((()=>{S()}),[]),s((()=>(window.addEventListener("resize",S),()=>{window.removeEventListener("resize",S)})),[f,u,d]),s((()=>{w(0),S()}),[t,f,u,d]),s((()=>{N();const t=new ResizeObserver(N);return t.observe(h.current),()=>{t.disconnect()}}),[t,d,b]),e.createElement("div",{className:"eko-nav-container",ref:f,style:{opacity:x>0?1:0,height:""+(x&&b?x+"px":"auto")}},e.createElement(jt,{layout:c,nav:h,isVerticalNav:b,showPrevArrow:_,showNextArrow:I}),e.createElement("ul",{className:`eko-nav eko-mobile-nav-selected-${null!==(F=null==c||null===(O=c.mobile)||void 0===O||null===(O=O.config)||void 0===O?void 0:O.navItemsSelectedType)&&void 0!==F?F:"underline"} eko-desktop-nav-selected-${null!==(P=null==c||null===(C=c.desktop)||void 0===C||null===(C=C.config)||void 0===C?void 0:C.navItemsSelectedType)&&void 0!==P?P:"underline"}`,ref:h,onScroll:function(){N()},onWheel:function(){A("wheel")},onTouchMove:function(){A("swipe")}},null==t?void 0:t.map(((t,n)=>{var i;const r=(null==t||null===(i=t.media)||void 0===i?void 0:i.url)||(null==t?void 0:t.media)||"";return e.createElement(Ut,{key:r+n,index:n,activeIndex:l,setActiveIndex:M,item:t,src:r,navItemRefs:p,itemIcon:null==t?void 0:t.icon})}))));var F,O,P,C};qt.propTypes={items:Pt.array.isRequired,activeIndex:Pt.number,setActiveIndex:Pt.func.isRequired,layout:Pt.object,carouselMounted:Pt.bool,forceMobile:Pt.bool};function Vt(){R.track("gallery.cover.displayed"),Wt.send("gallerycoverdisplayed")}function Gt(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 Ht=({item:t,src:i,srcset:r,sizes:o,isCoverElement:a})=>{const l=n(null);return s((()=>{var t;if(a){if(null===(t=l.current)||void 0===t||!t.complete)return l.current.addEventListener("load",Vt,{once:!0}),()=>{var t;null===(t=l.current)||void 0===t||t.removeEventListener("load",Vt,{once:!0})};Vt()}}),[]),e.createElement("img",{ref:l,src:Gt(i),srcSet:r,sizes:o,alt:t.name,fetchPriority:a?"high":"auto",loading:a?"eager":"lazy",style:{width:"100%",height:"100%"}})};Ht.propTypes={item:Pt.object.isRequired,src:Pt.string,srcset:Pt.string,sizes:Pt.string,isCoverElement:Pt.bool};const Kt=$t((t=>{var e;e=t,R.track("gallery.interaction",{elementid:"carousel",interactiontype:e}),Wt.send("interaction",{elementid:"carousel",interactiontype:e})}),200);function Xt(){Kt("wheel")}const Yt=a((({items:t,setActiveIndex:o,activeIndex:a,showSmartLoaders:c},u)=>{const d=n(null),h=n([]);h.current=null==t?void 0:t.map(((t,e)=>{var n,i;return null!==(n=null==h||null===(i=h.current)||void 0===i?void 0:i[e])&&void 0!==n?n:r()}));const[f,p]=i(),[m,g]=i(),v=n(a),y=n(!1);function b(){const e=function(t){const e=t.scrollLeft,n=t.scrollWidth-t.clientWidth;return 0===e?0:e>n?100:e/n*100}(d.current)*(null==t?void 0:t.length)/100,n=Math.min(Math.trunc(e),(null==t?void 0:t.length)-1),i=v.current;"nav"!==i.source&&"external-nav"!==i.source?(y.current&&n!==i.index&&(y.current=!1),y.current||(n>(null==t?void 0:t.length)-1?o({index:(null==t?void 0:t.length)-1,source:"carousel"}):o({index:n,source:"carousel"}))):n===i.index?y.current=!0:y.current&&n!==i.index&&(y.current=!1,o({index:n,source:"carousel"}))}return l(u,(()=>({prev:()=>{o({index:Math.max(0,v.current.index-1),source:"carousel"})},next:()=>{o({index:Math.min((null==t?void 0:t.length)-1,v.current.index+1),source:"carousel"})}}))),s((()=>{const t=d.current;if(t)return t.addEventListener("scroll",b),()=>{t.removeEventListener("scroll",b)}}),[t]),s((()=>{var t;let e=null===(t=h.current)||void 0===t?void 0:t[a.index];if(e&&("nav"===a.source||"external-nav"===a.source)){const t=e.current,n=d.current.clientWidth/2,i=(null==t?void 0:t.clientWidth)/2,r=(null==t?void 0:t.offsetLeft)-n+i;d.current.scrollTo({left:r,behavior:"smooth"})}}),[a]),s((()=>{v.current=a,"nav"!==a.source&&"external-nav"!==a.source||(y.current=!1)}),[a]),e.createElement("ul",{className:"eko-carousel",ref:d,onScroll:b,onWheel:Xt,onTouchMove:function(t){g(t.targetTouches[0].clientX)},onTouchStart:function(t){p(t.targetTouches[0].clientX),g(null)},onTouchEnd:function(){m&&f&&(f-m>75||f-m<-75)&&Kt("swipe")}},null==t?void 0:t.map(((t,n)=>{const i=(null==t?void 0:t.cover)||(null==t?void 0:t.media),r=(null==i?void 0:i.url)||i;return e.createElement("li",{className:"eko-carousel-item",key:r+n,ref:h.current[n]},e.createElement(Ht,{item:t,src:r,srcset:null==i?void 0:i.srcset,sizes:null==i?void 0:i.sizes,isCoverElement:0===n}),c&&"image"!==t.type&&e.createElement("div",{className:"eko-smart-loading"},e.createElement("div",null),e.createElement("p",null,"Loading video experience")))})))}));function Qt(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)}Yt.propTypes={items:Pt.array.isRequired,setActiveIndex:Pt.func.isRequired,activeIndex:Pt.object,showSmartLoaders:Pt.bool},Yt.displayName="CarouselLoop";const Jt="eko.project.invoke",Zt="eko.block.invoke";function te(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 ee(t){return`#variantId=${encodeURIComponent(t)}`}const ne=a((({config:t,instanceId:r,setActiveItem:o,activeItem:a,variantId:c,smartGalleryLoaded:u,onLoad:d,forceMobile:h},f)=>{var p,m,v;const y=null!==(p=null===(m=t.options)||void 0===m?void 0:m.galleryEnv)&&void 0!==p?p:"",b=null===(v=t.__autoGenerated)||void 0===v||null===(v=v.publishItem)||void 0===v?void 0:v.id,k=function(t={}){let e="";return Object.entries(t).forEach((([t,n])=>{e+=`&${t}=${n}`})),e}(null==t?void 0:t.qp),x=function(t,e,n){return`https://${t}play.eko.com/embed?${n?`id=${n}`:`piid=${e}`}&nocover=true&galleryBlockMode=gallery&eko_pixel=true`}(y,b,r),w=n(null),_=n(null),T=n(!1),[I,E]=i(ee(c||"ekonovar")),[S,N]=i(x+k+I);let A;function M(){R.track("gallery.project.display"),d(),Wt.send("galleryloaded")}return l(f,(()=>({prev:()=>{te(null==_?void 0:_.current,Zt,{action:"onPrevModule"})},next:()=>{te(null==_?void 0:_.current,Zt,{action:"onNextModule"})}}))),s((()=>{T.current?te(null==_?void 0:_.current,Jt,{action:"updateVariant",args:{id:c}}):E(ee(c))}),[c]),s((()=>{te(null==_?void 0:_.current,Zt,{action:"updateActiveModule",args:{activeItemIndex:null==a?void 0:a.index,activeModuleIndex:null==a?void 0:a.step}})}),[a]),s((()=>{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))&&!T.current)return e=t.data.data.blockType,T.current=!0,void("GalleryBlock"===e?te(null==_?void 0:_.current,Zt,{action:"updateActiveModule",args:{activeItemIndex:null==a?void 0:a.index,activeModuleIndex:null==a?void 0:a.step}}):M());var e;if(T.current){if(function(t){var e;return Qt(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==a?void 0:a.index)&&n===(null==a?void 0:a.step)||o({index:e,step:n,source:"carousel"})}(t);(function(t){var e;return Qt(t)&&"activeModuleChangeDone"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.name)})(t)&&!u&&M()}}return A=h||g()?"mobile":"desktop",function(t,e={}){window.addEventListener("message",t,e)}(t),()=>{!function(t,e={}){window.removeEventListener("message",t,e)}(t)}}),[a]),s((()=>{T.current||te(null==_?void 0:_.current,Jt,{action:"queryProjectStarted"})}),[a,u]),s((()=>{T.current=!1}),[t]),s((()=>{N(x+k+I)}),[I]),e.createElement("div",{className:"eko-smart-gallery-container "+(u?"":"eko-project-not-ready"),ref:w,"data-type":"smart-gallery","data-qp":k,"data-variant":c,"data-device":A},e.createElement("iframe",{allow:"autoplay; fullscreen",title:"eko gallery",src:S,style:{border:0},ref:_}))}));ne.propTypes={config:Pt.object.isRequired,instanceId:Pt.string,setActiveItem:Pt.func.isRequired,activeItem:Pt.object.isRequired,variantId:Pt.string,smartGalleryLoaded:Pt.bool,onLoad:Pt.func,forceMobile:Pt.bool},ne.displayName="SmartGallery";const ie=()=>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}'),re=({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")}}`)};re.propTypes={layout:Pt.object,style:Pt.object},b("experiment");const oe=({activeVariantId:t,activeElementId:e,hasInteractive:i,experiments:r,publishItem:o})=>{const a="gallery",l=n(t),c=n(e),u=n(i),d=n(r),h=n(o);s((()=>{l.current=t,c.current=e,u.current=i,d.current=r,h.current=o}),[t,e,i,r,o]);const f={publishItemPacker:{tag:a,schema:"iglu:com.helloeko/publishitem/jsonschema/1-0-0",match:/.*/,getData:function(){const t=h.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:a,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:a,schema:"iglu:com.helloeko/gallery/jsonschema/1-0-2",match:/^gallery.*/,getData:function(){var t;return{activeitemid:c.current.toString(),activevariantid:l.current,hasinteractive:u.current,version:(null===(t=window.eko)||void 0===t||null===(t=t.gallery)||void 0===t?void 0:t.version)||""}}},activeVariantIdPacker:{tag:a,schema:"iglu:com.helloeko/variant/jsonschema/1-0-1",match:/.*/,getData:function(){if(l.current)return{id:l.current}}},experimentPacker:{tag:a,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}(d.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 s((()=>(Object.values(f).forEach((t=>{window.EkoAnalytics("registerContextPacker",t)})),()=>{window.EkoAnalytics("reset",a)})),[]),null};oe.propTypes={activeVariantId:Pt.string,activeElementId:Pt.number,hasInteractive:Pt.bool,experiments:Pt.array,publishItem:Pt.object};const se=({variantId:t,activeItem:i,hasInteractive:r,activeIndex:o,experiments:a,publishItem:l})=>{const c=n(!0);return s((()=>{c.current||t&&R.track("gallery.variant.change")}),[t]),s((()=>{c.current||R.track("gallery.element.change",{activeIndex:o})}),[o]),s((()=>{c.current||i&&null!=l&&l.id&&R.track("gallery.asset.view",{publishitemid:l.id,type:i.type,name:i.name})}),[i]),s((()=>{c.current=!1}),[]),e.createElement(oe,{activeVariantId:t||"ekonovar",activeElementId:o,hasInteractive:r,experiments:a,publishItem:l})};se.propTypes={variantId:Pt.string,activeItem:Pt.object,hasInteractive:Pt.bool,activeIndex:Pt.number,experiments:Pt.array,publishItem:Pt.object};const ae="eko-gallery-react";function le(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 ce=a((({className:t,config:r,instanceId:o,variantId:a,activeItem:l={index:0,step:0},onEvent:c,forceMobile:u},d)=>{var h,f,p,m,g,v;const y=null!==(h=null===(f=r.options)||void 0===f?void 0:f.loadingTimeout)&&void 0!==h?h:12,b=null===(p=null===(m=r.options)||void 0===m?void 0:m.showCoverLoadAnimation)||void 0===p||p,[k,x]=i(le(r,a)),[w,_]=i({index:l.index,step:l.step,source:"external-nav"}),[T,I]=i(!1),[E,S]=i(!1),[N,A]=i("eko-desktop"),M=n(!1),F=n(!1),O=n(l),P=n(null),C=n(a);function D(){const t=u||window.innerWidth<768?"eko-mobile":"eko-desktop";A(t)}return F.current||(Wt.send("galleryinit"),F.current=!0),s((()=>{const t=C.current!==a;C.current=a,x(le(r,a)),t&&!M.current&&_({index:0,step:0,source:"external-nav"})}),[r,a]),s((()=>{if(c)return Wt.subscribe(c),()=>{Wt.unsubscribe()}}),[c]),s((()=>{M.current=E}),[E]),s((()=>{I(!1),S(!1);const t=setTimeout((()=>{M.current||(I(!0),R.track("gallery.load.timeout"))}),1e3*y);return()=>{clearTimeout(t)}}),[r]),s((()=>{D()}),[u]),s((()=>(window.addEventListener("resize",D),D(),()=>{window.removeEventListener("resize",D)})),[u]),s((()=>(window.EkoAnalytics("trackElementVisibility",P.current,ae),()=>{window.EkoAnalytics("stopTrackingElementVisibility",ae)})),[]),s((()=>{!("carousel"===(null==w?void 0:w.source)||"nav"===(null==w?void 0:w.source))||(null==w?void 0:w.index)===l.index&&(null==w?void 0:w.step)===l.step||Wt.send("activeitemchanged",{index:null==w?void 0:w.index,step:null==w?void 0:w.step})}),[w,l]),s((()=>{O.current.index===l.index&&O.current.step===l.step||(O.current=l,_({index:l.index,step:l.step,source:"external-nav"}))}),[l]),e.createElement(e.Fragment,null,e.createElement(ie,null),e.createElement(re,{layout:r.layout,style:r.style,forceMobile:u}),e.createElement(se,{variantId:a,activeItem:null==k||null===(g=k.items)||void 0===g?void 0:g[w.index],activeIndex:w.index,hasInteractive:E,experiments:r.experiments,publishItem:null==r||null===(v=r.__autoGenerated)||void 0===v?void 0:v.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}(r.layout)} ${null!=t?t:""}`.trim()} ${N}`,"aria-controls":"main-content",ref:P},e.createElement(qt,{items:(null==k?void 0:k.items)||[],setActiveIndex:_,activeIndex:w.index,layout:r.layout,carouselMounted:E,forceMobile:u}),!E&&e.createElement(Yt,{ref:d,items:(null==k?void 0:k.items)||[],setActiveIndex:_,activeIndex:{index:w.index,source:null==w?void 0:w.source},showSmartLoaders:!T&&b}),!T&&e.createElement(ne,{ref:d,config:r,instanceId:o,activeItem:w,setActiveItem:_,variantId:null==k?void 0:k.variantId,smartGalleryLoaded:E,forceMobile:u,onLoad:function(){S(!0)}})))}));ce.propTypes={className:Pt.string,config:Pt.object.isRequired,instanceId:Pt.string,variantId:Pt.string,activeItem:Pt.object,onEvent:Pt.func,forceMobile:Pt.bool,onPrev:Pt.func,onNext:Pt.func},ce.displayName="EkoGallery";var ue=c(ce);const de=b("gallery-react");const he=a(((t,n)=>{var i;s((()=>(de.setDataStorage("gallery-react",{config:t.config}),window.eko=window.eko||{},window.eko.config=t.config,window.eko.gallery={version:"4.0.2"},()=>{window.eko.config=void 0})),[t.config]);const{children:r,...o}=t;return void 0!==t.config?e.createElement(ue,q({ref:n},o,{key:null===(i=t.config.__autoGenerated)||void 0===i||null===(i=i.publishItem)||void 0===i?void 0:i.id})):r}));he.propTypes={className:Pt.string,config:Pt.object,variantId:Pt.string,onEvent:Pt.func,instanceId:Pt.string,children:Pt.node},he.displayName="EkoGalleryWrapper";var fe,pe,me,ge,ve,ye,be,ke,xe,we,_e,Te,Ie,Ee,Se,Ne,Ae,Me,Fe,Oe,Pe,Ce,De,Re,Be,Le,ze,We,Ue,je,$e,qe,Ve,Ge,He,Ke,Xe,Ye,Qe,Je,Ze,tn,en,nn,rn,on,sn,an,ln,cn,un,dn,hn,fn=c(he);const pn=1,mn=2,gn=4,vn=8,yn=16,bn=1,kn=4,xn=8,wn=16,_n="[",Tn="[!",In="]",En={},Sn=Symbol(),Nn="http://www.w3.org/1999/xhtml",An=!1;var Mn=Array.isArray,Fn=Array.prototype.indexOf,On=Array.from,Pn=Object.defineProperty,Cn=Object.getOwnPropertyDescriptor,Dn=Object.getOwnPropertyDescriptors,Rn=Object.prototype,Bn=Array.prototype,Ln=Object.getPrototypeOf,zn=Object.isExtensible;function Wn(){var t,e;return{promise:new Promise(((n,i)=>{t=n,e=i})),resolve:t,reject:e}}const Un=2,jn=4,$n=8,qn=1<<24,Vn=16,Gn=32,Hn=64,Kn=128,Xn=512,Yn=1024,Qn=2048,Jn=4096,Zn=8192,ti=16384,ei=32768,ni=65536,ii=1<<17,ri=1<<18,oi=1<<19,si=1<<20,ai=1<<25,li=32768,ci=1<<21,ui=1<<22,di=1<<23,hi=Symbol("$state"),fi=Symbol("legacy props"),pi=Symbol(""),mi=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},gi=3,vi=8;function yi(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function bi(t){console.warn("https://svelte.dev/e/hydration_mismatch")}let ki,xi=!1;function wi(t){xi=t}function _i(t){if(null===t)throw bi(),En;return ki=t}function Ti(){return _i(xo(ki))}function Ii(t){if(xi){if(null!==xo(ki))throw bi(),En;ki=t}}function Ei(t=!0){for(var e=0,n=ki;;){if(n.nodeType===vi){var i=n.data;if(i===In){if(0===e)return n;e-=1}else i!==_n&&i!==Tn||(e+=1)}var r=xo(n);t&&n.remove(),n=r}}function Si(t){if(!t||t.nodeType!==vi)throw bi(),En;return t.data}function Ni(t){return t===this.v}function Ai(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 Mi=!1,Fi=null;function Oi(t){Fi=t}function Pi(t){return Ri().get(t)}function Ci(t,e=!1,n){Fi={p:Fi,i:!1,c:null,e:null,s:t,x:null,l:null}}function Di(t){var e=Fi,n=e.e;if(null!==n)for(var i of(e.e=null,n))Oo(i);return e.i=!0,Fi=e.p,{}}function Ri(t){var e,n;return null===Fi&&yi(),null!==(n=(e=Fi).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}(Fi)||void 0)}let Bi=[];function Li(){var t=Bi;Bi=[],function(t){for(var e=0;e<t.length;e++)t[e]()}(t)}function zi(t){if(0===Bi.length&&!tr){var e=Bi;queueMicrotask((()=>{e===Bi&&Li()}))}Bi.push(t)}function Wi(){for(;Bi.length>0;)Li()}function Ui(t){var e=ts;if(null===e)return Qo.f|=di,t;if(e.f&ei)ji(t,e);else{if(!(e.f&Kn))throw t;e.b.error(t)}}function ji(t,e){for(;null!==e;){if(e.f&Kn)try{return void e.b.error(t)}catch(e){t=e}e=e.parent}throw t}const $i=-7169;function qi(t,e){t.f=t.f&$i|e}function Vi(t){t.f&Xn||null===t.deps?qi(t,Yn):qi(t,Jn)}function Gi(t){if(null!==t)for(const e of t)e.f&Un&&e.f&li&&(e.f^=li,Gi(e.deps))}function Hi(t,e,n){t.f&Qn?e.add(t):t.f&Jn&&n.add(t),Gi(t.deps),qi(t,Yn)}const Ki=new Set;let Xi=null,Yi=null,Qi=[],Ji=null,Zi=!1,tr=!1;var er=new WeakMap,nr=new WeakMap,ir=new WeakMap,rr=new WeakMap,or=new WeakMap,sr=new WeakMap,ar=new WeakMap,lr=new WeakSet;class cr{constructor(){j(this,lr),$(this,"committed",!1),$(this,"current",new Map),$(this,"previous",new Map),W(this,er,new Set),W(this,nr,new Set),W(this,ir,0),W(this,rr,0),W(this,or,null),W(this,sr,new Set),W(this,ar,new Set),$(this,"skipped_effects",new Set),$(this,"is_fork",!1)}is_deferred(){return this.is_fork||z(rr,this)>0}process(t){Qi=[],this.apply();var e,n=[],i=[];for(const e of t)B(lr,this,ur).call(this,e,n,i);(this.is_fork||B(lr,this,hr).call(this),this.is_deferred())?(B(lr,this,dr).call(this,i),B(lr,this,dr).call(this,n)):(Xi=null,vr(i),vr(n),null===(e=z(or,this))||void 0===e||e.resolve());Yi=null}capture(t,e){var n;(e===Sn||this.previous.has(t)||this.previous.set(t,e),t.f&di)||(this.current.set(t,t.v),null===(n=Yi)||void 0===n||n.set(t,t.v))}activate(){Xi=this,this.apply()}deactivate(){Xi===this&&(Xi=null,Yi=null)}flush(){if(this.activate(),Qi.length>0){if(pr(),null!==Xi&&Xi!==this)return}else 0===z(ir,this)&&this.process([]);this.deactivate()}discard(){for(const t of z(nr,this))t(this);z(nr,this).clear()}increment(t){U(ir,this,z(ir,this)+1),t&&U(rr,this,z(rr,this)+1)}decrement(t){U(ir,this,z(ir,this)-1),t&&U(rr,this,z(rr,this)-1),this.revive()}revive(){for(const t of z(sr,this))z(ar,this).delete(t),qi(t,Qn),kr(t);for(const t of z(ar,this))qi(t,Jn),kr(t);this.flush()}oncommit(t){z(er,this).add(t)}ondiscard(t){z(nr,this).add(t)}settled(){var t;return(null!==(t=z(or,this))&&void 0!==t?t:U(or,this,Wn())).promise}static ensure(){if(null===Xi){const t=Xi=new cr;Ki.add(Xi),tr||cr.enqueue((()=>{Xi===t&&t.flush()}))}return Xi}static enqueue(t){zi(t)}apply(){}}function ur(t,e,n){t.f^=Yn;for(var i=t.first,r=null;null!==i;){var o=i.f,s=!!(o&(Gn|Hn));if(!(s&&!!(o&Yn)||!!(o&Zn)||this.skipped_effects.has(i))&&null!==i.fn){s?i.f^=Yn:null!==r&&o&(jn|$n|qn)?r.b.defer_effect(i):o&jn?e.push(i):hs(i)&&(o&Vn&&z(sr,this).add(i),vs(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 dr(t){for(var e=0;e<t.length;e+=1)Hi(t[e],z(sr,this),z(ar,this))}function hr(){if(0===z(rr,this)){for(const t of z(er,this))t();z(er,this).clear()}0===z(ir,this)&&B(lr,this,fr).call(this)}function fr(){if(Ki.size>1){this.previous.clear();var t=Yi,e=!0;for(const t of Ki){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=Qi;Qi=[];const e=new Set,o=new Map;for(const t of i)yr(t,r,e,o);if(Qi.length>0){Xi=t,t.apply();for(const e of Qi)B(lr,t,ur).call(t,e,[],[]);t.deactivate()}Qi=n}}Xi=null,Yi=t}this.committed=!0,Ki.delete(this)}function pr(){var t=Ho;Zi=!0;try{var e=0;for(Ko(!0);Qi.length>0;){var n=cr.ensure();if(e++>1e3)mr();n.process(Qi),io.clear()}}finally{Zi=!1,Ko(t),Ji=null}}function mr(){try{!function(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}()}catch(t){ji(t,Ji)}}let gr=null;function vr(t){var e=t.length;if(0!==e){for(var n=0;n<e;){var i,r=t[n++];if(!(r.f&(ti|Zn))&&hs(r))if(gr=new Set,vs(r),null===r.deps&&null===r.first&&null===r.nodes&&(null===r.teardown&&null===r.ac?Uo(r):r.fn=null),(null===(i=gr)||void 0===i?void 0:i.size)>0){io.clear();for(const t of gr){if(t.f&(ti|Zn))continue;const e=[t];let n=t.parent;for(;null!==n;)gr.has(n)&&(gr.delete(n),e.push(n)),n=n.parent;for(let t=e.length-1;t>=0;t--){const n=e[t];n.f&(ti|Zn)||vs(n)}}gr.clear()}}gr=null}}function yr(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&Un?yr(r,e,n,i):t&(ui|Vn)&&!(t&Qn)&&br(r,e,i)&&(qi(r,Qn),kr(r))}}function br(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&Un&&br(i,e,n))return n.set(i,!0),!0}return n.set(t,!1),!1}function kr(t){for(var e=Ji=t;null!==e.parent;){var n=(e=e.parent).f;if(Zi&&e===ts&&n&Vn&&!(n&ri))return;if(n&(Hn|Gn)){if(!(n&Yn))return;e.f^=Yn}}Qi.push(e)}var xr=ni|oi|Kn;var wr=new WeakMap,_r=new WeakMap,Tr=new WeakMap,Ir=new WeakMap,Er=new WeakMap,Sr=new WeakMap,Nr=new WeakMap,Ar=new WeakMap,Mr=new WeakMap,Fr=new WeakMap,Or=new WeakMap,Pr=new WeakMap,Cr=new WeakMap,Dr=new WeakMap,Rr=new WeakMap,Br=new WeakMap,Lr=new WeakMap,zr=new WeakSet;class Wr{constructor(t,e,n){j(this,zr),$(this,"parent",void 0),$(this,"is_pending",!1),W(this,wr,void 0),W(this,_r,xi?ki:null),W(this,Tr,void 0),W(this,Ir,void 0),W(this,Er,void 0),W(this,Sr,null),W(this,Nr,null),W(this,Ar,null),W(this,Mr,null),W(this,Fr,null),W(this,Or,0),W(this,Pr,0),W(this,Cr,!1),W(this,Dr,new Set),W(this,Rr,new Set),W(this,Br,null),W(this,Lr,function(t){let e,n=0,i=oo(0);return()=>{Ao()&&(bs(i),Co((()=>(0===n&&(e=ws((()=>t((()=>uo(i)))))),n+=1,()=>{zi((()=>{var t;n-=1,0===n&&(null===(t=e)||void 0===t||t(),e=void 0,uo(i))}))}))))}}((()=>(U(Br,this,oo(z(Or,this))),()=>{U(Br,this,null)})))),U(wr,this,t),U(Tr,this,e),U(Ir,this,n),this.parent=ts.b,this.is_pending=!!z(Tr,this).pending,U(Er,this,Ro((()=>{if(ts.b=this,xi){const t=z(_r,this);Ti();t.nodeType===vi&&t.data===Tn?B(zr,this,jr).call(this):(B(zr,this,Ur).call(this),0===z(Pr,this)&&(this.is_pending=!1))}else{var t=B(zr,this,$r).call(this);try{U(Sr,this,Bo((()=>n(t))))}catch(t){this.error(t)}z(Pr,this)>0?B(zr,this,Vr).call(this):this.is_pending=!1}return()=>{var t;null===(t=z(Fr,this))||void 0===t||t.remove()}}),xr)),xi&&U(wr,this,ki)}defer_effect(t){Hi(t,z(Dr,this),z(Rr,this))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!z(Tr,this).pending}update_pending_count(t){B(zr,this,Gr).call(this,t),U(Or,this,z(Or,this)+t),z(Br,this)&&co(z(Br,this),z(Or,this))}get_effect_pending(){return z(Lr,this).call(this),bs(z(Br,this))}error(t){var e=z(Tr,this).onerror;let n=z(Tr,this).failed;if(z(Cr,this)||!e&&!n)throw t;z(Sr,this)&&(Wo(z(Sr,this)),U(Sr,this,null)),z(Nr,this)&&(Wo(z(Nr,this)),U(Nr,this,null)),z(Ar,this)&&(Wo(z(Ar,this)),U(Ar,this,null)),xi&&(_i(z(_r,this)),function(t=1){if(xi){for(var e=t,n=ki;e--;)n=xo(n);ki=n}}(),_i(Ei()));var i=!1,r=!1;const o=()=>{i?console.warn("https://svelte.dev/e/svelte_boundary_reset_noop"):(i=!0,r&&function(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}(),cr.ensure(),U(Or,this,0),null!==z(Ar,this)&&jo(z(Ar,this),(()=>{U(Ar,this,null)})),this.is_pending=this.has_pending_snippet(),U(Sr,this,B(zr,this,qr).call(this,(()=>(U(Cr,this,!1),Bo((()=>z(Ir,this).call(this,z(wr,this)))))))),z(Pr,this)>0?B(zr,this,Vr).call(this):this.is_pending=!1)};var s=Qo;try{Zo(null),r=!0,null==e||e(t,o),r=!1}catch(t){ji(t,z(Er,this)&&z(Er,this).parent)}finally{Zo(s)}n&&zi((()=>{U(Ar,this,B(zr,this,qr).call(this,(()=>{cr.ensure(),U(Cr,this,!0);try{return Bo((()=>{n(z(wr,this),(()=>t),(()=>o))}))}catch(t){return ji(t,z(Er,this).parent),null}finally{U(Cr,this,!1)}})))}))}}function Ur(){try{U(Sr,this,Bo((()=>z(Ir,this).call(this,z(wr,this)))))}catch(t){this.error(t)}}function jr(){const t=z(Tr,this).pending;t&&(U(Nr,this,Bo((()=>t(z(wr,this))))),cr.enqueue((()=>{var t=B(zr,this,$r).call(this);U(Sr,this,B(zr,this,qr).call(this,(()=>(cr.ensure(),Bo((()=>z(Ir,this).call(this,t))))))),z(Pr,this)>0?B(zr,this,Vr).call(this):(jo(z(Nr,this),(()=>{U(Nr,this,null)})),this.is_pending=!1)})))}function $r(){var t=z(wr,this);return this.is_pending&&(U(Fr,this,bo()),z(wr,this).before(z(Fr,this)),t=z(Fr,this)),t}function qr(t){var e=ts,n=Qo,i=Fi;es(z(Er,this)),Zo(z(Er,this)),Oi(z(Er,this).ctx);try{return t()}catch(t){return Ui(t),null}finally{es(e),Zo(n),Oi(i)}}function Vr(){const t=z(Tr,this).pending;null!==z(Sr,this)&&(U(Mr,this,document.createDocumentFragment()),z(Mr,this).append(z(Fr,this)),Go(z(Sr,this),z(Mr,this))),null===z(Nr,this)&&U(Nr,this,Bo((()=>t(z(wr,this)))))}function Gr(t){var e;if(this.has_pending_snippet()){if(U(Pr,this,z(Pr,this)+t),0===z(Pr,this)){this.is_pending=!1;for(const t of z(Dr,this))qi(t,Qn),kr(t);for(const t of z(Rr,this))qi(t,Jn),kr(t);z(Dr,this).clear(),z(Rr,this).clear(),z(Nr,this)&&jo(z(Nr,this),(()=>{U(Nr,this,null)})),z(Mr,this)&&(z(wr,this).before(z(Mr,this)),U(Mr,this,null))}}else this.parent&&B(zr,e=this.parent,Gr).call(e,t)}function Hr(t,e,n,i){const r=Xr;if(0!==n.length||0!==t.length){var o,s,a,l,c=Xi,u=ts,d=(o=ts,s=Qo,a=Fi,l=Xi,function(t=!0){es(o),Zo(s),Oi(a),t&&(null==l||l.activate())});t.length>0?Promise.all(t).then((()=>{d();try{return h()}finally{null==c||c.deactivate(),Kr()}})):h()}else i(e.map(r));function h(){Promise.all(n.map((t=>Yr(t)))).then((t=>{d();try{i([...e.map(r),...t])}catch(t){u.f&ti||ji(t,u)}null==c||c.deactivate(),Kr()})).catch((t=>{ji(t,u)}))}}function Kr(){es(null),Zo(null),Oi(null)}function Xr(t){var e=Un|Qn,n=null!==Qo&&Qo.f&Un?Qo:null;null!==ts&&(ts.f|=oi);return{ctx:Fi,deps:null,effects:null,equals:Ni,f:e,fn:t,reactions:null,rv:0,v:Sn,wv:0,parent:null!=n?n:ts,ac:null}}function Yr(t,e,n){let i=ts;null===i&&function(){throw new Error("https://svelte.dev/e/async_derived_orphan")}();var r=i.b,o=void 0,s=oo(Sn),a=!Qo,l=new Map;return function(t){No(ui|oi,t,!0)}((()=>{var e=Wn();o=e.promise;try{Promise.resolve(t()).then(e.resolve,e.reject).then((()=>{n===Xi&&n.committed&&n.deactivate(),Kr()}))}catch(t){e.reject(t),Kr()}var n=Xi;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(mi),l.delete(n),l.set(n,e)}const u=(t,e=void 0)=>{if(n.activate(),e)e!==mi&&(s.f|=di,co(s,e));else{s.f&di&&(s.f^=di),co(s,t);for(const[t,e]of l){if(l.delete(t),t===n)break;e.reject(mi)}}a&&(r.update_pending_count(-1),n.decrement(c))};e.promise.then(u,(t=>u(null,t||"unknown")))})),Mo((()=>{for(const t of l.values())t.reject(mi)})),new Promise((t=>{!function e(n){function i(){n===o?t(s):e(o)}n.then(i,i)}(o)}))}function Qr(t){const e=Xr(t);return is(e),e}function Jr(t){const e=Xr(t);return e.equals=Ai,e}function Zr(t){var e=t.effects;if(null!==e){t.effects=null;for(var n=0;n<e.length;n+=1)Wo(e[n])}}function to(t){var e,n=ts;es(function(t){for(var e=t.parent;null!==e;){if(!(e.f&Un))return e.f&ti?null:e;e=e.parent}return null}(t));try{t.f&=~li,Zr(t),e=ps(t)}finally{es(n)}return e}function eo(t){var e,n,i=to(t);if(!t.equals(i)&&(t.wv=ds(),(null===(e=Xi)||void 0===e||!e.is_fork||null===t.deps)&&(t.v=i,null===t.deps)))return void qi(t,Yn);Xo||(null!==Yi?(Ao()||null!==(n=Xi)&&void 0!==n&&n.is_fork)&&Yi.set(t,i):Vi(t))}let no=new Set;const io=new Map;let ro=!1;function oo(t,e){return{f:0,v:t,reactions:null,equals:Ni,rv:0,wv:0}}function so(t,e){const n=oo(t);return is(n),n}function ao(t,e=!1,n=!0){const i=oo(t);return e||(i.equals=Ai),i}function lo(t,e,n=!1){var i;return null!==Qo&&(!Jo||Qo.f&ii)&&Qo.f&(Un|Vn|ui|ii)&&(null===(i=ns)||void 0===i||!i.includes(t))&&function(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}(),co(t,n?fo(e):e)}function co(t,e){if(!t.equals(e)){var n=t.v;Xo?io.set(t,e):io.set(t,n),t.v=e;var i=cr.ensure();if(i.capture(t,n),t.f&Un){const e=t;t.f&Qn&&to(e),Vi(e)}t.wv=ds(),ho(t,Qn),null!==ts&&ts.f&Yn&&!(ts.f&(Gn|Hn))&&(null===ss?function(t){ss=t}([t]):ss.push(t)),!i.is_fork&&no.size>0&&!ro&&function(){ro=!1;var t=Ho;Ko(!0);const e=Array.from(no);try{for(const t of e)t.f&Yn&&qi(t,Jn),hs(t)&&vs(t)}finally{Ko(t)}no.clear()}()}return e}function uo(t){lo(t,t.v+1)}function ho(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,a=!(s&Qn);if(a&&qi(o,e),s&Un){var l,c=o;null===(l=Yi)||void 0===l||l.delete(c),s&li||(s&Xn&&(o.f|=li),ho(c,Jn))}else a&&(s&Vn&&null!==gr&&gr.add(o),kr(o))}}function fo(t){if("object"!=typeof t||null===t||hi in t)return t;const e=Ln(t);if(e!==Rn&&e!==Bn)return t;var n=new Map,i=Mn(t),r=so(0),o=cs,s=t=>{if(cs===o)return t();var e=Qo,n=cs;Zo(null),us(o);var i=t();return Zo(e),us(n),i};return i&&n.set("length",so(t.length)),new Proxy(t,{defineProperty(t,e,i){"value"in i&&!1!==i.configurable&&!1!==i.enumerable&&!1!==i.writable||function(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}();var r=n.get(e);return void 0===r?r=s((()=>{var t=so(i.value);return n.set(e,t),t})):lo(r,i.value,!0),!0},deleteProperty(t,e){var i=n.get(e);if(void 0===i){if(e in t){const t=s((()=>so(Sn)));n.set(e,t),uo(r)}}else lo(i,Sn),uo(r);return!0},get(e,i,r){var o;if(i===hi)return t;var a=n.get(i),l=i in e;if(void 0===a&&(!l||null!==(o=Cn(e,i))&&void 0!==o&&o.writable)&&(a=s((()=>so(fo(l?e[i]:Sn)))),n.set(i,a)),void 0!==a){var c=bs(a);return c===Sn?void 0:c}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=bs(r))}else if(void 0===i){var o=n.get(e),s=null==o?void 0:o.v;if(void 0!==o&&s!==Sn)return{enumerable:!0,configurable:!0,value:s,writable:!0}}return i},has(t,e){var i;if(e===hi)return!0;var r=n.get(e),o=void 0!==r&&r.v!==Sn||Reflect.has(t,e);if((void 0!==r||null!==ts&&(!o||null!==(i=Cn(t,e))&&void 0!==i&&i.writable))&&(void 0===r&&(r=s((()=>so(o?fo(t[e]):Sn))),n.set(e,r)),bs(r)===Sn))return!1;return o},set(t,e,o,a){var l,c=n.get(e),u=e in t;if(i&&"length"===e)for(var d=o;d<c.v;d+=1){var h=n.get(d+"");void 0!==h?lo(h,Sn):d in t&&(h=s((()=>so(Sn))),n.set(d+"",h))}void 0===c?(!u||null!==(l=Cn(t,e))&&void 0!==l&&l.writable)&&(lo(c=s((()=>so(void 0))),fo(o)),n.set(e,c)):(u=c.v!==Sn,lo(c,s((()=>fo(o)))));var f=Reflect.getOwnPropertyDescriptor(t,e);if(null!=f&&f.set&&f.set.call(a,o),!u){if(i&&"string"==typeof e){var p=n.get("length"),m=Number(e);Number.isInteger(m)&&m>=p.v&&lo(p,m+1)}uo(r)}return!0},ownKeys(t){bs(r);var e=Reflect.ownKeys(t).filter((t=>{var e=n.get(t);return void 0===e||e.v!==Sn}));for(var[i,o]of n)o.v===Sn||i in t||e.push(i);return e},setPrototypeOf(){!function(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}()}})}var po,mo,go,vo;function yo(){if(void 0===po){po=window,mo=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;go=Cn(e,"firstChild").get,vo=Cn(e,"nextSibling").get,zn(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),zn(n)&&(n.__t=void 0)}}function bo(t=""){return document.createTextNode(t)}function ko(t){return go.call(t)}function xo(t){return vo.call(t)}function wo(t,e){if(!xi)return ko(t);var n=ko(ki);if(null===n)n=ki.appendChild(bo());else if(e&&n.nodeType!==gi){var i,r=bo();return null===(i=n)||void 0===i||i.before(r),_i(r),r}return _i(n),n}function _o(t,e=!1){var n;if(!xi){var i=ko(t);return i instanceof Comment&&""===i.data?xo(i):i}if(e&&(null===(n=ki)||void 0===n?void 0:n.nodeType)!==gi){var r,o=bo();return null===(r=ki)||void 0===r||r.before(o),_i(o),o}return ki}function To(t,e=1,n=!1){var i;let r=xi?ki:t;for(var o;e--;)o=r,r=xo(r);if(!xi)return r;if(n&&(null===(i=r)||void 0===i?void 0:i.nodeType)!==gi){var s,a=bo();if(null===r)null===(s=o)||void 0===s||s.after(a);else r.before(a);return _i(a),a}return _i(r),r}function Io(t){t.textContent=""}function Eo(t){var e=Qo,n=ts;Zo(null),es(null);try{return t()}finally{Zo(e),es(n)}}function So(t){null===ts&&(null===Qo&&function(){throw new Error("https://svelte.dev/e/effect_orphan")}(),function(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}()),Xo&&function(){throw new Error("https://svelte.dev/e/effect_in_teardown")}()}function No(t,e,n){var i=ts;null!==i&&i.f&Zn&&(t|=Zn);var r={ctx:Fi,deps:null,nodes:null,f:t|Qn|Xn,first:null,fn:e,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,wv:0,ac:null};if(n)try{vs(r),r.f|=ei}catch(t){throw Wo(r),t}else null!==e&&kr(r);var o=r;if(!n||null!==o.deps||null!==o.teardown||null!==o.nodes||o.first!==o.last||o.f&oi||(o=o.first,t&Vn&&t&ni&&null!==o&&(o.f|=ni)),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!==Qo&&Qo.f&Un&&!(t&Hn))){var s,a=Qo;(null!==(s=a.effects)&&void 0!==s?s:a.effects=[]).push(o)}return r}function Ao(){return null!==Qo&&!Jo}function Mo(t){const e=No($n,null,!1);return qi(e,Yn),e.teardown=t,e}function Fo(t){So();var e=ts.f;if(!!(Qo||!(e&Gn)||e&ei))return Oo(t);var n,i=Fi;(null!==(n=i.e)&&void 0!==n?n:i.e=[]).push(t)}function Oo(t){return No(jn|si,t,!1)}function Po(t){return No(jn,t,!1)}function Co(t,e=0){return No($n|e,t,!0)}function Do(t,e=[],n=[],i=[]){Hr(i,e,n,(e=>{No($n,(()=>t(...e.map(bs))),!0)}))}function Ro(t,e=0){return No(Vn|e,t,!0)}function Bo(t){return No(Gn|oi,t,!0)}function Lo(t){var e=t.teardown;if(null!==e){const t=Xo,n=Qo;Yo(!0),Zo(null);try{e.call(null)}finally{Yo(t),Zo(n)}}}function zo(t,e=!1){var n=t.first;for(t.first=t.last=null;null!==n;){const t=n.ac;null!==t&&Eo((()=>{t.abort(mi)}));var i=n.next;n.f&Hn?n.parent=null:Wo(n,e),n=i}}function Wo(t,e=!0){var n=!1;(e||t.f&ri)&&null!==t.nodes&&null!==t.nodes.end&&(!function(t,e){for(;null!==t;){var n=t===e?null:xo(t);t.remove(),t=n}}(t.nodes.start,t.nodes.end),n=!0),zo(t,e&&!n),gs(t,0),qi(t,ti);var i=t.nodes&&t.nodes.t;if(null!==i)for(const t of i)t.stop();Lo(t);var r=t.parent;null!==r&&null!==r.first&&Uo(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=null}function Uo(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 jo(t,e,n=!0){var i=[];$o(t,i,!0);var r=()=>{n&&Wo(t),e&&e()},o=i.length;if(o>0){var s=()=>--o||r();for(var a of i)a.out(s)}else r()}function $o(t,e,n){if(!(t.f&Zn)){t.f^=Zn;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;$o(r,e,!!(!!(r.f&ni)||!!(r.f&Gn)&&!!(t.f&Vn))&&n),r=o}}}function qo(t){Vo(t,!0)}function Vo(t,e){if(t.f&Zn){t.f^=Zn,t.f&Yn||(qi(t,Qn),kr(t));for(var n=t.first;null!==n;){var i=n.next;Vo(n,!!(!!(n.f&ni)||!!(n.f&Gn))&&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 Go(t,e){if(t.nodes)for(var n=t.nodes.start,i=t.nodes.end;null!==n;){var r=n===i?null:xo(n);e.append(n),n=r}}let Ho=!1;function Ko(t){Ho=t}let Xo=!1;function Yo(t){Xo=t}let Qo=null,Jo=!1;function Zo(t){Qo=t}let ts=null;function es(t){ts=t}let ns=null;function is(t){null!==Qo&&(null===ns?ns=[t]:ns.push(t))}let rs=null,os=0,ss=null;let as=1,ls=0,cs=ls;function us(t){cs=t}function ds(){return++as}function hs(t){var e=t.f;if(e&Qn)return!0;if(e&Un&&(t.f&=~li),e&Jn){for(var n=t.deps,i=n.length,r=0;r<i;r++){var o=n[r];if(hs(o)&&eo(o),o.wv>t.wv)return!0}e&Xn&&null===Yi&&qi(t,Yn)}return!1}function fs(t,e,n=!0){var i,r=t.reactions;if(null!==r&&(null===(i=ns)||void 0===i||!i.includes(t)))for(var o=0;o<r.length;o++){var s=r[o];s.f&Un?fs(s,e,!1):e===s&&(n?qi(s,Qn):s.f&Yn&&qi(s,Jn),kr(s))}}function ps(t){var e=rs,n=os,i=ss,r=Qo,o=ns,s=Fi,a=Jo,l=cs,c=t.f;rs=null,os=0,ss=null,Qo=c&(Gn|Hn)?null:t,ns=null,Oi(t.ctx),Jo=!1,cs=++ls,null!==t.ac&&(Eo((()=>{t.ac.abort(mi)})),t.ac=null);try{t.f|=ci;var u=(0,t.fn)(),d=t.deps;if(null!==rs){var h;if(gs(t,os),null!==d&&os>0)for(d.length=os+rs.length,h=0;h<rs.length;h++)d[os+h]=rs[h];else t.deps=d=rs;if(Ao()&&t.f&Xn)for(h=os;h<d.length;h++){var f,p;(null!==(p=(f=d[h]).reactions)&&void 0!==p?p:f.reactions=[]).push(t)}}else null!==d&&os<d.length&&(gs(t,os),d.length=os);if(!(null===ss||Jo||null===d||t.f&(Un|Jn|Qn)))for(h=0;h<ss.length;h++)fs(ss[h],t);return null!==r&&r!==t&&(ls++,null!==ss&&(null===i?i=ss:i.push(...ss))),t.f&di&&(t.f^=di),u}catch(t){return Ui(t)}finally{t.f^=ci,rs=e,os=n,ss=i,Qo=r,ns=o,Oi(s),Jo=a,cs=l}}function ms(t,e){let n=e.reactions;if(null!==n){var i=Fn.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&Un&&(null===rs||!rs.includes(e))){var o=e;o.f&Xn&&(o.f^=Xn,o.f&=~li),Vi(o),Zr(o),gs(o,0)}}function gs(t,e){var n=t.deps;if(null!==n)for(var i=e;i<n.length;i++)ms(t,n[i])}function vs(t){var e=t.f;if(!(e&ti)){qi(t,Yn);var n=ts,i=Ho;ts=t,Ho=!0;try{e&(Vn|qn)?function(t){for(var e=t.first;null!==e;){var n=e.next;e.f&Gn||Wo(e),e=n}}(t):zo(t),Lo(t);var r=ps(t);t.teardown="function"==typeof r?r:null,t.wv=as,An&&Mi&&t.f&Qn&&t.deps}finally{Ho=i,ts=n}}}async function ys(){await Promise.resolve(),function(){var t=tr;tr=!0;try{for(;;){var e;if(Wi(),0===Qi.length&&(null===(e=Xi)||void 0===e||e.flush(),0===Qi.length))return void(Ji=null);pr()}}finally{tr=t}}()}function bs(t){var e,n,i=!!(t.f&Un);if(null!==Qo&&!Jo&&!(null!==ts&&!!(ts.f&ti)||null!==(n=ns)&&void 0!==n&&n.includes(t))){var r=Qo.deps;if(Qo.f&ci)t.rv<ls&&(t.rv=ls,null===rs&&null!==r&&r[os]===t?os++:null===rs?rs=[t]:rs.includes(t)||rs.push(t));else{var o,s;(null!==(s=(o=Qo).deps)&&void 0!==s?s:o.deps=[]).push(t);var a=t.reactions;null===a?t.reactions=[Qo]:a.includes(Qo)||a.push(Qo)}}if(Xo&&io.has(t))return io.get(t);if(i){var l=t;if(Xo){var c=l.v;return(l.f&Yn||null===l.reactions)&&!xs(l)||(c=to(l)),io.set(l,c),c}var u=!(l.f&Xn)&&!Jo&&null!==Qo&&(Ho||!!(Qo.f&Xn)),d=null===l.deps;hs(l)&&(u&&(l.f|=Xn),eo(l)),u&&!d&&ks(l)}if(null!==(e=Yi)&&void 0!==e&&e.has(t))return Yi.get(t);if(t.f&di)throw t.v;return t.v}function ks(t){if(null!==t.deps){t.f|=Xn;for(const n of t.deps){var e;(null!==(e=n.reactions)&&void 0!==e?e:n.reactions=[]).push(t),n.f&Un&&!(n.f&Xn)&&ks(n)}}}function xs(t){if(t.v===Sn)return!0;if(null===t.deps)return!1;for(const e of t.deps){if(io.has(e))return!0;if(e.f&Un&&xs(e))return!0}return!1}function ws(t){var e=Jo;try{return Jo=!0,t()}finally{Jo=e}}const _s=new Set,Ts=new Set;function Is(t,e,n,i,r){var o={capture:i,passive:r},s=function(t,e,n,i={}){function r(t){if(i.capture||Ns.call(e,t),!t.cancelBubble)return Eo((()=>null==n?void 0:n.call(this,t)))}return t.startsWith("pointer")||t.startsWith("touch")||"wheel"===t?zi((()=>{e.addEventListener(t,r,i)})):e.addEventListener(t,r,i),r}(t,e,n,o);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&Mo((()=>{e.removeEventListener(t,s,o)}))}function Es(t){for(var e=0;e<t.length;e++)_s.add(t[e]);for(var n of Ts)n(t)}let Ss=null;function Ns(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;Ss=t;var a=0,l=Ss===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){Pn(t,"currentTarget",{configurable:!0,get:()=>s||i});var d=Qo,h=ts;Zo(null),es(null);try{for(var f,p=[];null!==s;){var m=s.assignedSlot||s.parentNode||s.host||null;try{var g=s["__"+r];null==g||s.disabled&&t.target!==s||g.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,Zo(d),es(h)}}}function As(t,e){var n=ts;null===n.nodes&&(n.nodes={start:t,end:e,a:null,t:null})}function Ms(t,e){var n,i=!!(1&e),r=!!(2&e),o=!t.startsWith("<!>");return()=>{if(xi)return As(ki,null),ki;var e,s;void 0===n&&(e=o?t:"<!>"+t,(s=document.createElement("template")).innerHTML=e.replaceAll("<!>","\x3c!----\x3e"),n=s.content,i||(n=ko(n)));var a=r||mo?document.importNode(n,!0):n.cloneNode(!0);i?As(ko(a),a.lastChild):As(a,a);return a}}function Fs(){if(xi)return As(ki,null),ki;var t=document.createDocumentFragment(),e=document.createComment(""),n=bo();return t.append(e,n),As(e,n),t}function Os(t,e){if(xi){var n=ts;return n.f&ei&&null!==n.nodes.end||(n.nodes.end=ki),void Ti()}null!==t&&t.before(e)}const Ps=["touchstart","touchmove"];function Cs(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 Ds(t,e){return Ls(t,e)}function Rs(t,e){var n;yo(),e.intro=null!==(n=e.intro)&&void 0!==n&&n;const i=e.target,r=xi,o=ki;try{for(var s=ko(i);s&&(s.nodeType!==vi||s.data!==_n);)s=xo(s);if(!s)throw En;wi(!0),_i(s);const n=Ls(t,{...e,anchor:s});return wi(!1),n}catch(n){if(n instanceof Error&&n.message.split("\n").some((t=>t.startsWith("https://svelte.dev/e/"))))throw n;return n!==En&&console.warn("Failed to hydrate: ",n),!1===e.recover&&function(){throw new Error("https://svelte.dev/e/hydration_failed")}(),yo(),Io(i),wi(!1),Ds(t,e)}finally{wi(r),_i(o)}}const Bs=new Map;function Ls(t,{target:e,anchor:n,props:i={},events:r,context:o,intro:s=!0}){yo();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,Ps.includes(s));e.addEventListener(i,Ns,{passive:r});var o=Bs.get(i);void 0===o?(document.addEventListener(i,Ns,{passive:r}),Bs.set(i,1)):Bs.set(i,o+1)}}var s};l(On(_s)),Ts.add(l);var c=void 0,u=function(t){cr.ensure();const e=No(Hn|oi,t,!0);return(t={})=>new Promise((n=>{t.outro?jo(e,(()=>{Wo(e),n(void 0)})):(Wo(e),n(void 0))}))}((()=>{var s=null!=n?n:e.appendChild(bo());return function(t,e,n){new Wr(t,e,n)}(s,{pending:()=>{}},(e=>{o&&(Ci({}),Fi.c=o);if(r&&(i.$$events=r),xi&&As(e,null),c=t(e,i)||{},xi&&(ts.nodes.end=ki,null===ki||ki.nodeType!==vi||ki.data!==In))throw bi(),En;o&&Di()})),()=>{for(var t of a){e.removeEventListener(t,Ns);var i=Bs.get(t);0==--i?(document.removeEventListener(t,Ns),Bs.delete(t)):Bs.set(t,i)}var r;(Ts.delete(l),s!==n)&&(null===(r=s.parentNode)||void 0===r||r.removeChild(s))}}));return zs.set(c,u),c}let zs=new WeakMap;class Ws{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=Xi;if(this.#t.has(t)){var e=this.#t.get(t),n=this.#e.get(e);if(n)qo(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&&(Wo(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();Go(i,e),e.append(bo()),this.#n.set(t,{effect:i,fragment:e})}else Wo(i);this.#i.delete(t),this.#e.delete(t)};this.#r||!n?(this.#i.add(t),jo(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)||(Wo(n.effect),this.#n.delete(t))};ensure(t,e){var n=Xi;!e||this.#e.has(t)||this.#n.has(t)||this.#e.set(t,Bo((()=>e(this.anchor)))),this.#t.set(n,t),xi&&(this.anchor=ki),this.#o()}}function Us(t,e,n=!1){xi&&Ti();var i=new Ws(t);function r(e,n){if(xi){if(e===(Si(t)===Tn)){var r=Ei();return _i(r),i.anchor=r,wi(!1),i.ensure(e,n),void wi(!0)}}i.ensure(e,n)}Ro((()=>{var t=!1;e(((e,n=!0)=>{t=!0,r(n,e)})),t||r(!1,null)}),n?ni:0)}function js(t,e){return e}function $s(t,e=!0){for(var n=0;n<t.length;n++)Wo(t[n],e)}var qs;function Vs(t,e,n,i,r,o=null){var s=t,a=new Map;if(!!(e&gn)){var l=t;s=xi?_i(ko(l)):l.appendChild(bo())}xi&&Ti();var c,u=null,d=Jr((()=>{var t=n();return Mn(t)?t:null==t?[]:On(t)})),h=!0;function f(){m.fallback=u,function(t,e,n,i,r){var o,s,a,l,c,u=!!(i&vn),d=e.length,h=t.items,f=t.effect.first,p=null,m=[],g=[];if(u)for(c=0;c<d;c+=1){var v,y;if(a=r(e[c],c),!((l=h.get(a).e).f&ai))null===(v=l.nodes)||void 0===v||null===(v=v.a)||void 0===v||v.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&ai){if(l.f^=ai,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),Ks(t,p,l),Ks(t,l,b),Hs(l,b,n),m=[],g=[],f=(p=l).next;continue}Hs(l,null,n)}var k,x;if(l.f&Zn)if(qo(l),u)null===(k=l.nodes)||void 0===k||null===(k=k.a)||void 0===k||k.unfix(),(null!==(x=s)&&void 0!==x?x:s=new Set).delete(l);if(l!==f){if(void 0!==o&&o.has(l)){if(m.length<g.length){var w,_=g[0];p=_.prev;var T=m[0],I=m[m.length-1];for(w=0;w<m.length;w+=1)Hs(m[w],_,n);for(w=0;w<g.length;w+=1)o.delete(g[w]);Ks(t,T.prev,I.next),Ks(t,p,T),Ks(t,I,_),f=_,p=I,c-=1,m=[],g=[]}else o.delete(l),Hs(l,f,n),Ks(t,l.prev,l.next),Ks(t,l,null===p?t.effect.first:p.next),Ks(t,p,l),p=l;continue}for(m=[],g=[];null!==f&&f!==l;){var E;(null!==(E=o)&&void 0!==E?E:o=new Set).add(f),g.push(f),f=f.next}if(null===f)continue}l.f&ai||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)$s(On(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 N=[];if(void 0!==o)for(l of o)l.f&Zn||N.push(l);for(;null!==f;)f.f&Zn||f===t.fallback||N.push(f),f=f.next;var A=N.length;if(A>0){var M=i&gn&&0===d?n:null;if(u){for(c=0;c<A;c+=1){var F;null===(F=N[c].nodes)||void 0===F||null===(F=F.a)||void 0===F||F.measure()}for(c=0;c<A;c+=1){var O;null===(O=N[c].nodes)||void 0===O||null===(O=O.a)||void 0===O||O.fix()}}!function(t,e,n){for(var i,r=e.length,o=e.length,s=0;s<r;s++){let n=e[s];jo(n,(()=>{if(i){if(i.pending.delete(n),i.done.add(n),0===i.pending.size){var e=t.outrogroups;$s(On(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;Io(c),c.append(l),t.items.clear()}$s(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,N,M)}}u&&zi((()=>{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&ai?(u.f^=ai,Hs(u,null,s)):qo(u):jo(u,(()=>{u=null})))}var p=Ro((()=>{var t=(c=bs(d)).length;let l=!1;xi&&(Si(s)===Tn!==(0===t)&&(_i(s=Ei()),wi(!1),l=!0));for(var p=new Set,m=0;m<t;m+=1){xi&&ki.nodeType===vi&&ki.data===In&&(s=ki,l=!0,wi(!1));var g,v=c[m],y=i(v,m),b=h?null:a.get(y);if(b)b.v&&co(b.v,v),b.i&&co(b.i,m);else b=Gs(a,h?s:null!==(g=qs)&&void 0!==g?g:qs=bo(),v,y,m,r,e,n),h||(b.e.f|=ai),a.set(y,b);p.add(y)}0===t&&o&&!u&&(h?u=Bo((()=>o(s))):(u=Bo((()=>{var t;return o(null!==(t=qs)&&void 0!==t?t:qs=bo())}))).f|=ai),xi&&t>0&&_i(Ei()),h||f(),l&&wi(!0),bs(d)})),m={effect:p,items:a,outrogroups:null,fallback:u};h=!1,xi&&(s=ki)}function Gs(t,e,n,i,r,o,s,a){var l=s&pn?s&yn?oo(n):ao(n,!1,!1):null,c=s&mn?oo(r):null;return{v:l,i:c,e:Bo((()=>(o(e,null!=l?l:n,null!=c?c:r,a),()=>{t.delete(i)})))}}function Hs(t,e,n){if(t.nodes)for(var i=t.nodes.start,r=t.nodes.end,o=!e||e.f&ai?n:e.nodes.start;null!==i;){var s=xo(i);if(o.before(i),i===r)return;i=s}}function Ks(t,e,n){null===e?t.effect.first=n:e.next=n,null===n?t.effect.last=e:n.prev=e}const Xs=[..." \t\n\r\f \v\ufeff"];function Ys(t,e,n,i,r,o){var s=t.__className;if(xi||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&&!Xs.includes(i[s-1])||a!==i.length&&!Xs.includes(i[a])?s=a:i=(0===s?"":i.substring(0,s))+i.substring(a+1)}return""===i?null:i}(n,i,o);xi&&a===t.getAttribute("class")||(null==a?t.removeAttribute("class"):t.className=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 Qs(t,e,n,i){var r=t.__style;if(xi||r!==e){var o=function(t){return null==t?null:String(t)}(e);xi&&o===t.getAttribute("style")||(null==o?t.removeAttribute("style"):t.style.cssText=o),t.__style=e}return i}const Js=Symbol("is custom element"),Zs=Symbol("is html");function ta(t,e,n,i){var r=function(t){var e;return null!==(e=t.__attributes)&&void 0!==e?e:t.__attributes={[Js]:t.nodeName.includes("-"),[Zs]:t.namespaceURI===Nn}}(t);xi&&(r[e]=t.getAttribute(e),"src"===e||"srcset"===e||"href"===e&&"LINK"===t.nodeName)||r[e]!==(r[e]=n)&&("loading"===e&&(t[pi]=n),null==n?t.removeAttribute(e):"string"!=typeof n&&function(t){var e,n=t.getAttribute("is")||t.nodeName,i=ea.get(n);if(i)return i;ea.set(n,i=[]);var r=t,o=Element.prototype;for(;o!==r;){for(var s in e=Dn(r))e[s].set&&i.push(s);r=Ln(r)}return i}(t).includes(e)?t[e]=n:t.setAttribute(e,n))}var ea=new Map;var na=new WeakMap,ia=new WeakMap,ra=new WeakMap,oa=new WeakSet;class sa{constructor(t){j(this,oa),W(this,na,new WeakMap),W(this,ia,void 0),W(this,ra,void 0),U(ra,this,t)}observe(t,e){var n=z(na,this).get(t)||new Set;return n.add(e),z(na,this).set(t,n),B(oa,this,aa).call(this).observe(t,z(ra,this)),()=>{var n=z(na,this).get(t);n.delete(e),0===n.size&&(z(na,this).delete(t),z(ia,this).unobserve(t))}}}function aa(){var t;return null!==(t=z(ia,this))&&void 0!==t?t:U(ia,this,new ResizeObserver((t=>{for(var e of t)for(var n of(fe.entries.set(e.target,e),z(na,this).get(e.target)||[]))n(e)})))}fe=sa,$(sa,"entries",new WeakMap);var la=new sa({box:"content-box"}),ca=new sa({box:"border-box"});function ua(t,e,n){Mo(la.observe(t,(t=>n(t[e]))))}function da(t,e,n){var i=ca.observe(t,(()=>n(t[e])));Po((()=>(ws((()=>n(t[e]))),i)))}function ha(t,e){return t===e||(null==t?void 0:t[hi])===e}function fa(t={},e,n,i){return Po((()=>{var i,r;return Co((()=>{i=r,r=[],ws((()=>{t!==n(...r)&&(e(t,...r),i&&ha(n(...i),t)&&e(null,...i))}))})),()=>{zi((()=>{r&&ha(n(...r),t)&&e(null,...r)}))}})),t}let pa=!1;function ma(t,e,n,i){var r,o,s=!!(n&xn),a=!!(n&wn),l=i,c=!0,u=()=>(c&&(c=!1,l=a?ws(i):i),l);if(s){var d,h,f=hi in t||fi in t;r=null!==(d=null===(h=Cn(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=pa;try{return pa=!1,[t(),pa]}finally{pa=e}}((()=>t[e])):o=t[e],void 0===o&&void 0!==i&&(o=u(),r&&(!function(){throw new Error("https://svelte.dev/e/props_invalid_value")}(),r(o))),p=()=>{var n=t[e];return void 0===n?u():(c=!0,n)},!(n&kn))return p;if(r){var g=t.$$legacy;return function(t,e){return arguments.length>0?((!e||g||m)&&r(e?p():t),t):p()}}var v=!1,y=(n&bn?Xr:Jr)((()=>(v=!1,p())));s&&bs(y);var b=ts;return function(t,e){if(arguments.length>0){const n=e?bs(y):s?fo(t):t;return lo(y,n),v=!0,void 0!==l&&(l=n),t}return Xo&&v||b.f&ti?y.v:bs(y)}}var ga,va,ya,ba;"undefined"!=typeof window&&(null!==(va=(ga=null!==(ba=(ya=window).__svelte)&&void 0!==ba?ba:ya.__svelte={}).v)&&void 0!==va?va:ga.v=new Set).add("5");function ka(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}class xa{constructor({position:t,galleryState:e,config:n}){this.config=n,this.position=t,this.galleryState=e,this.name=n.name;const{variantId:i,itemIndex:r,moduleIndex:o}=t;this.id=`${n.itemType}_${i}_${r}_${o}`,ka(this)}#a=so(fo({}));#l=so(null);#c=so(null);id;player;position;config;timeline;moduleEndListener;hasDuration=!1;coverAssets=[];get state(){return bs(this.#a)}set state(t){lo(this.#a,t,!0)}get cover(){return bs(this.#l)}set cover(t){lo(this.#l,t)}get Component(){return bs(this.#c)}set Component(t){lo(this.#c,t)}emitModuleEnd(){var t;null===(t=this.moduleEndListener)||void 0===t||t.call(this)}start(t){this.player=t}setPosition(){this.galleryState.playingModulePosition=this.position}play(){this.timeline.getNodesAtTime(0)[0].once("nodestart",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}}function wa(t,e,n){return n.addNode({id:t,manifestRef:{type:"assets-delivery-service",assetId:e.entity.entityId,assetRevision:e.entity.entityRevision,availableEncodeProfiles:e.availableEncodeProfiles}})}var _a=Ms('<h3 class="svelte-17x2i38"> </h3>'),Ta=Ms('<p class="svelte-17x2i38"> </p>'),Ia=Ms('<span class="svelte-17x2i38"> </span>'),Ea=Ms('<div><button class="svelte-17x2i38"><!> <!> <!></button></div>'),Sa=Ms('<div class="textBoxDescriptionBox svelte-17x2i38" aria-roledescription="Feature description box"><!></div>');function Na(t,e){const n=Qr((()=>e.state.textBox));!function(t,e){Ci(e,!0);let n=ma(e,"textBox",3,null),i=ma(e,"isMobile",3,!1),r=so(!1),o=so(0),s=so(null),a=so(null),l=so(null),c=Qr((()=>{var t;return(null===(t=bs(l))||void 0===t?void 0:t.blockSize)||20})),u=Qr((()=>{var t,e,n,i;return(null===(t=bs(a))||void 0===t?void 0:t.inlineSize)-bs(c)>(null===(e=bs(s))||void 0===e?void 0:e.clientWidth)||(null===(n=bs(s))||void 0===n?void 0:n.scrollHeight)>(null===(i=bs(s))||void 0===i?void 0:i.clientHeight)}));function d(){lo(r,!bs(r))}var h=Fs(),f=_o(h),p=t=>{var e=Sa(),c=wo(e),h=t=>{var e=Ea(),c=wo(e);c.__click=d;var h=wo(c),f=t=>{var e=_a(),i=wo(e,!0);Ii(e),Do((()=>Cs(i,n().title))),Os(t,e)};Us(h,(t=>{var e;i()&&null!==(e=n())&&void 0!==e&&e.title&&t(f)}));var p=To(h,2),m=t=>{var e=Ta(),i=wo(e,!0);Ii(e),fa(e,(t=>lo(s,t)),(()=>bs(s))),Do((()=>Cs(i,n().description))),ua(e,"contentBoxSize",(t=>lo(a,t))),Os(t,e)};Us(p,(t=>{(!i()||i()&&bs(r))&&t(m)}));var g=To(p,2),v=t=>{var e=Ia(),n=wo(e);Ii(e),Do((()=>Cs(n,"Read "+(bs(r)?"less":"more")))),ua(e,"contentBoxSize",(t=>lo(l,t))),Os(t,e)};Us(g,(t=>{(i()||!i()&&(bs(u)||bs(r)))&&t(v)})),Ii(c),Ii(e),Do((()=>{var t;Ys(e,0,"step-description "+(bs(r)?"expanded":""),"svelte-17x2i38"),Qs(e,`height: ${null!==(t=bs(o))&&void 0!==t?t:""}px`)})),da(c,"clientHeight",(t=>lo(o,t))),Os(t,e)};Us(c,(t=>{var e;null!==(e=n())&&void 0!==e&&e.description&&t(h)})),Ii(e),Do((()=>Qs(e,`padding: ${i()?"8px 16px":"16px 16px 56px 16px"};`))),Os(t,e)};Us(f,(t=>{var e,i;(null!==(e=n())&&void 0!==e&&e.title||null!==(i=n())&&void 0!==i&&i.description)&&t(p)})),Os(t,h),Di()}(t,{get textBox(){return bs(n)},get isMobile(){return e.isMobile}})}Es(["click"]);var Aa=Ms('<div class="toggle-option-container svelte-16pmvvn"><button> </button></div>'),Ma=Ms('<div class="toggle-container svelte-16pmvvn"><div></div></div>');function Fa(t,e){const n=Qr((()=>e.state.options)),i=Qr((()=>e.state.currentOptionIndex)),r=Qr((()=>e.state.onOptionClicked));var o=Ma(),s=wo(o);Vs(s,21,(()=>bs(n)),js,((t,e,n)=>{var o=Aa();Qs(o,`--button-index: ${n};`);var s=wo(o);let a;s.__click=()=>bs(r)(n);var l=wo(s,!0);Ii(s),Ii(o),Do((()=>{a=Ys(s,0,"toggle-option-button svelte-16pmvvn",null,a,{selected:bs(i)===n}),Cs(l,bs(e).label)})),Os(t,o)})),Ii(s),Ii(o),Do((()=>{var t;return Ys(s,0,`toggle-options selected-${null!==(t=bs(i))&&void 0!==t?t:""}`,"svelte-16pmvvn")})),Os(t,o)}Es(["click"]);var Oa=new WeakSet;function Pa(t){var e,n;t!==this.state.currentOptionIndex&&(this.state.currentOptionIndex=t,this.cover=this.coverAssets[t],this.synced?this.switchTo(t):(this.timeline=null===(e=this.timelines)||void 0===e?void 0:e[t],null===(n=this.player)||void 0===n||n.switchTimeline(this.timeline)))}const Ca=(t,e,n)=>n>e?e:n<t?t:n;function Da(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let Ra=()=>{},Ba=()=>{};function La(t){let e;return()=>(void 0===e&&(e=t()),e)}"undefined"!=typeof process&&"production"!==(null===(pe=process.env)||void 0===pe?void 0:pe.NODE_ENV)&&(Ra=(t,e,n)=>{t||"undefined"==typeof console||console.warn(Da(e,n))},Ba=(t,e,n)=>{if(!t)throw new Error(Da(e,n))});const za=t=>t,Wa=t=>1e3*t,Ua=t=>t/1e3;const ja=t=>Array.isArray(t)&&"number"==typeof t[0],$a=(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)})`},qa=2e4;function Va(t){let e=0;let n=t.next(e);for(;!n.done&&e<qa;)e+=50,n=t.next(e);return e>=qa?1/0:e}const Ga=5;const Ha={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},Ka=.001;function Xa({duration:t=Ha.duration,bounce:e=Ha.bounce,velocity:n=Ha.velocity,mass:i=Ha.mass}){let r,o;Ra(t<=Wa(Ha.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let s=1-e;s=Ca(Ha.minDamping,Ha.maxDamping,s),t=Ca(Ha.minDuration,Ha.maxDuration,Ua(t)),s<1?(r=e=>{const i=e*s,r=i*t,o=i-n,a=Qa(e,s),l=Math.exp(-r);return Ka-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=Qa(Math.pow(e,2),s);return(-r(e)+Ka>0?-1:1)*((o-a)*l)/c}):(r=e=>Math.exp(-e*t)*((e-n)*t+1)-Ka,o=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let i=n;for(let n=1;n<Ya;n++)i-=t(i)/e(i);return i}(r,o,5/t);if(t=Wa(t),isNaN(a))return{stiffness:Ha.stiffness,damping:Ha.damping,duration:t};{const e=Math.pow(a,2)*i;return{stiffness:e,damping:2*s*Math.sqrt(i*e),duration:t}}}const Ya=12;function Qa(t,e){return t*Math.sqrt(1-e*e)}const Ja=["duration","bounce"],Za=["stiffness","damping","mass"];function tl(t,e){return e.some((e=>void 0!==t[e]))}function el(t=Ha.visualDuration,e=Ha.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:Ha.velocity,stiffness:Ha.stiffness,damping:Ha.damping,mass:Ha.mass,isResolvedFromDuration:!1,...t};if(!tl(t,Za)&&tl(t,Ja))if(t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(1.2*n),r=i*i,o=2*Ca(.05,1,1-(t.bounce||0))*Math.sqrt(r);e={...e,mass:Ha.mass,stiffness:r,damping:o}}else{const n=Xa(t);e={...e,...n,mass:Ha.mass},e.isResolvedFromDuration=!0}return e}({...n,velocity:-Ua(n.velocity||0)}),p=h||0,m=c/(2*Math.sqrt(l*u)),g=s-o,v=Ua(Math.sqrt(l/u)),y=Math.abs(g)<5;let b;if(i||(i=y?Ha.restSpeed.granular:Ha.restSpeed.default),r||(r=y?Ha.restDelta.granular:Ha.restDelta.default),m<1){const t=Qa(v,m);b=e=>{const n=Math.exp(-m*v*e);return s-n*((p+m*v*g)/t*Math.sin(t*e)+g*Math.cos(t*e))}}else if(1===m)b=t=>s-Math.exp(-v*t)*(g+(p+v*g)*t);else{const t=v*Math.sqrt(m*m-1);b=e=>{const n=Math.exp(-m*v*e),i=Math.min(t*e,300);return s-n*((p+m*v*g)*Math.sinh(i)+t*g*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?Wa(p):function(t,e,n){const i=Math.max(e-Ga,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(Va(k),qa),e=$a((e=>k.next(t*e).value),t,30);return t+"ms "+e},toTransition:()=>{}};return k}el.applyToOptions=t=>{const e=function(t,e=100,n){const i=n({...t,keyframes:[0,e]}),r=Math.min(Va(i),qa);return{type:"keyframes",ease:t=>i.next(r*t).value/e,duration:Ua(r)}}(t,100,el);return t.ease=e.ease,t.duration=Wa(e.duration),t.type="keyframes",t};const nl=t=>null!==t;class il{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 rl(t){for(let n=1;n<t.length;n++){var e;null!==(e=t[n])&&void 0!==e||(t[n]=t[n-1])}}const ol=t=>t.startsWith("--");const sl=La((()=>void 0!==window.ScrollTimeline)),al={};function ll(t,e){const n=La(t);return()=>{var t;return null!==(t=al[e])&&void 0!==t?t:n()}}const cl=ll((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing"),ul=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,dl={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ul([0,.65,.55,1]),circOut:ul([.55,0,1,.45]),backIn:ul([.31,.01,.66,-.59]),backOut:ul([.33,1.53,.69,.99])};function hl(t,e){return t?"function"==typeof t?cl()?$a(t,e):"ease-out":ja(t)?ul(t):Array.isArray(t)?t.map((t=>hl(t,e)||dl.easeOut)):dl[t]:void 0}function fl(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=hl(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 pl extends il{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,Ba("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)&&cl()?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=fl(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(nl),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){ol(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 Ua(Number(n))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Ua(t)}get time(){return Ua(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Wa(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&&sl()?(this.animation.timeline=t,za):e(this)}}class ml{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 gl(this.animations,"duration")}get iterationDuration(){return gl(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 gl(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 vl extends ml{then(t,e){return this.finished.finally(t).then((()=>{}))}}const yl=new WeakMap,bl=(t,e="")=>`${t}:${e}`;function kl(t){const e=yl.get(t)||new Map;return yl.set(t,e),e}function xl(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 wl=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 _l(t,e){for(let n=0;n<t.length;n++)"number"==typeof t[n]&&wl.has(e)&&(t[n]=t[n]+"px")}function Tl(t,e){const n=window.getComputedStyle(t);return ol(e)?n.getPropertyValue(e):n[e]}function Il(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;Ba(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={...xl(a,t)};r.duration&&(r.duration=Wa(r.duration)),r.delay&&(r.delay=Wa(r.delay));const o=kl(i),l=bl(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]=Tl(i,r)),rl(e),_l(e,r),!o&&e.length<2&&e.unshift(Tl(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 pl(i);e.set(n,r),r.finished.finally((()=>e.delete(n))),a.push(r)}return a}const El=(()=>function(t,e,n){return new vl(Il(t,e,n))})();var Sl=Ms('<button class="svelte-16kucsb"><div class="svelte-16kucsb"> </div></button>'),Nl=Ms('<div class="tryIt-container svelte-16kucsb"><!></div>');function Al(t,e){Ci(e,!0);const n=Qr((()=>e.state.ctaText)),i=Qr((()=>e.state.animationConfig)),r=Qr((()=>e.state.showCta)),o=Qr((()=>e.state.onCtaClick));let s=null,a=null,l=so(!1),c=!1;function u(){c&&El(s,{transform:"scale(1.05)"},{type:el,mass:1.5,stiffness:400,damping:30})}function d(){c&&El(s,{transform:"scale(1)"},{type:el,mass:1.5,stiffness:400,damping:30})}function h(){c&&El(s,{transform:"scale(0.95)"},{type:el,mass:1,stiffness:600,damping:30})}Fo((()=>{const{mass:t,stiffness:e,damping:n,delay:o}=bs(i);let u;return bs(r)&&(u=setTimeout((async()=>{lo(l,!0),u=null,El(s,{transform:["translateY(40px) scale(0, 0.2)","translateY(0) scale(1, 1)"],opacity:1},{type:el,mass:t,stiffness:e,damping:n}),await El(a,{transform:["translateY(20px) scale(0.8)","translateY(0) scale(1)"],opacity:1},{type:el,mass:t,stiffness:e,damping:n,delay:.15}),c=!0}),o)),()=>{u&&clearTimeout(u)}}));var f=Nl(),p=wo(f),m=t=>{var e=Sl();e.__mousedown=h,e.__touchstart=h,e.__click=function(...t){var e;null===(e=bs(o))||void 0===e||e.apply(this,t)};var i=wo(e),r=wo(i,!0);Ii(i),fa(i,(t=>a=t),(()=>a)),Ii(e),fa(e,(t=>s=t),(()=>s)),Do((()=>{Qs(e,"pointer-events: "+(bs(l)?"auto":"none")),Cs(r,bs(n))})),Is("mouseenter",e,u),Is("mouseleave",e,d),Os(t,e)};Us(p,(t=>{bs(r)&&t(m)})),Ii(f),Os(t,f),Di()}Es(["mousedown","touchstart","click"]);var Ml=new WeakSet;function Fl(){this.mainTimeline?this.player.switchTimeline(this.mainTimeline):this.emitModuleEnd(),this.state.showCta=!1}const Ol={videoModule:class extends xa{constructor({config:t,...e}){var n;super({...e,config:t}),this.Component=Na,this.hasDuration=!t.loop,ka(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(wa(`${this.id}_intro`,e.intro,t),"end");const n=wa(this.id,e.video,t);this.timeline.placeOnTimeline(n,"end",{loop:e.loop}),e.loop||n.on("nodeend",this.emitModuleEnd)}},toggleModule:class extends xa{constructor({config:t,...e}){super({...e,config:t}),j(this,Oa),this.Component=Fa,this.synced=t.sync,this.switchTo=()=>{},ka(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:B(Oa,this,Pa).bind(this)}}start(t){super.start(t),this.synced?(this.timeline=t.createTimeline(),this.config.options.forEach(((e,n)=>{this.timeline.placeOnTimeline(wa(`${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(wa(`${this.id}_option_${n}_intro`,e.intro,t),"end"),i.placeOnTimeline(wa(`${this.id}_option_${n}`,e.video,t),"end",{loop:!0}),i})),this.timeline=this.timelines[this.state.currentOptionIndex])}},tryItModule:class extends xa{constructor({config:t,...e}){var n;super({...e,config:t}),j(this,Ml),ka(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:B(Ml,this,Fl).bind(this)}}start(t){super.start(t),this.Component=Al,this.timeline=t.createTimeline();const{introVideo:e,mainVideo:n}=this.config;if(e.intro&&this.timeline.placeOnTimeline(wa(`${this.id}_intro_intro`,e.intro,t)),this.timeline.placeOnTimeline(wa(`${this.id}_intro_loop`,e.loop,t),"end",{loop:!0}),n){this.mainTimeline=t.createTimeline(),n.intro&&this.mainTimeline.placeOnTimeline(wa(`${this.id}_main_intro`,n.intro,t));const e=wa(`${this.id}_main_loop`,n.loop,t);this.mainTimeline.placeOnTimeline(e,"end",{loop:!0})}}play(){this.state.showCta=!0,super.play()}}};class Pl{#u=so({});#d=so("ekonovar");#h=so(0);#f=so(0);#p=so(fo({itemIndex:0,moduleIndex:0}));#m=Qr((()=>{var t;return null===(t=bs(this.#u))||void 0===t?void 0:t[bs(this.#d)]}));#g=Qr((()=>{var t;return null===(t=bs(this.#m))||void 0===t?void 0:t[bs(this.#h)]}));#v=Qr((()=>{var t,e;return bs(this.#y)?null===(e=bs(this.#m))||void 0===e?void 0:e[bs(this.#p).itemIndex].modules[bs(this.#p).moduleIndex]:null===(t=bs(this.#g))||void 0===t?void 0:t.modules[bs(this.#f)]}));#b=Qr((()=>{var t;return(null===(t=bs(this.#m))||void 0===t?void 0:t.flatMap((t=>t.modules)))||[]}));#k=so(!1);#y=so(!1);#x=Qr((()=>!(bs(this.#p).itemIndex===this.activeItemIndex&&bs(this.#p).moduleIndex===this.activeModuleIndex)));set variants(t){lo(this.#u,t)}set activeVariant(t){lo(this.#d,t,!0)}set activeItemIndex(t){lo(this.#h,t,!0)}set activeModuleIndex(t){lo(this.#f,t,!0)}set playingModulePosition(t){lo(this.#p,t,!0)}set paused(t){lo(this.#k,t,!0)}set startedPlaying(t){lo(this.#y,t,!0)}get variants(){return bs(this.#u)}get activeVariant(){return bs(this.#d)}get activeItemIndex(){return bs(this.#h)}get activeModuleIndex(){return bs(this.#f)}get playingModulePosition(){return bs(this.#p)}get currentItemsList(){return bs(this.#m)}get currentItem(){return bs(this.#g)}get currentModule(){return bs(this.#v)}get paused(){return bs(this.#k)}get startedPlaying(){return bs(this.#y)}get seeking(){return bs(this.#x)}get currentModulesList(){return bs(this.#b)}}var Cl="https://assets.eko.com";const Dl=2,Rl=5,Bl=["activeItemIndex","activeModuleIndex","paused","startedPlaying"],Ll=["version","selectItem","selectItemAndStep","next","prev","subscribe"];var zl=new WeakMap,Wl=new WeakMap,Ul=new WeakMap,jl=new WeakSet;class $l{constructor(t){var e;j(this,jl),W(this,zl,void 0),W(this,Wl,void 0),W(this,Ul,void 0),$(this,"public",void 0),$(this,"version","0.0.6"),ka(this),U(Ul,this,t),U(zl,this,new Pl),U(Wl,this,[]);const n=null==t||null===(e=t.instance)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.blocks)||void 0===e||null===(e=e.blocksArr)||void 0===e||null===(e=e.find((t=>"GalleryBlock"===t.blockType)))||void 0===e?void 0:e.config;var i;n?(B(jl,this,ql).call(this,n.items),B(jl,this,Vl).call(this,n.items)):console.warn("[eko-gallery-app] Gallery initiated without an instance, results will be empty"),this.public=(i=this,Ll.reduce(((t,e)=>{if(!(e in i))throw new Error(`[eko-gallery-app] Public API member "${e}" does not exist on GalleryLogic`);const n=i[e];return t[e]="function"==typeof n?n.bind(i):n,t}),{}))}start(t){z(Wl,this).forEach((e=>{e.start(t)})),U(Wl,this,null),B(jl,this,Gl).call(this,t),z(zl,this).currentModule.play()}selectItem(t){const e=z(zl,this);t!==e.activeItemIndex&&(e.activeItemIndex=t,e.activeModuleIndex=0)}selectItemAndStep(t,e){const n=z(zl,this);t===n.activeItemIndex&&e===n.activeModuleIndex||(n.activeItemIndex=t,n.activeModuleIndex=e)}next(){const t=z(zl,this);t.seeking||(t.startedPlaying?B(jl,this,Kl).call(this):t.activeItemIndex=(t.activeItemIndex+1)%t.currentItemsList.length)}prev(){const t=z(zl,this);if(!t.seeking)if(t.startedPlaying){if(t.activeModuleIndex=t.activeModuleIndex-1,!t.currentItem.modules[t.activeModuleIndex]){t.activeItemIndex=(t.activeItemIndex-1+t.currentItemsList.length)%t.currentItemsList.length;const e=t.currentItemsList[t.activeItemIndex];t.activeModuleIndex=e.modules.length-1}}else t.activeItemIndex=(t.activeItemIndex-1+t.currentItemsList.length)%t.currentItemsList.length}subscribe(t){const e=z(zl,this);return function(t){cr.ensure();const e=No(Hn|oi,t,!0);return()=>{Wo(e)}}((()=>{Fo((()=>{const n=Bl.reduce(((t,n)=>(t[n]=e[n],t)),{});t(n)}))}))}getCoverUrl(t,e){var n,i;const r=null==t||null===(n=t.entity)||void 0===n?void 0:n.entityId;if(!r)throw new Error("[getCoverUrl] No assetId found.");let o;var s;return null!==(i=z(Ul,this))&&void 0!==i&&null!==(i=i.coverAssetsMap)&&void 0!==i&&i[r]?(o=new URL(z(Ul,this).coverAssetsMap[r]),/^[a-z0-9]*assets.eko.com$/.test(o.host)&&e&&(o.pathname=o.pathname.replace(".png",".webp"))):(s=t,o=new URL(`${Cl}/image/${s.entity.entityId}/${s.entity.entityRevision}?startOffset=0`),o.pathname+=e?".webp":".png"),e&&o.searchParams.set("width",e),o.href}get currentConfig(){return z(Ul,this)}get state(){return z(zl,this)}}function ql(t){const e={};for(let n of t)for(let t of Object.keys(n.variants||{}))e[t]=[];e.ekonovar=[],z(zl,this).variants=e}function Vl(t){const e=(t=[],e)=>{const n=[];for(let[i,r]of t.entries()){if(!Ol[r.itemType])throw new Error(`Unknown module type ${r.itemType}`);const t=new Ol[r.itemType]({position:{...e,moduleIndex:i},config:r,galleryState:z(zl,this)});t.moduleEndListener=B(jl,this,Hl).bind(this),n.push(t)}return n};for(const[i,r]of t.entries())if("galleryItemV2"===r.itemType){const{modules:t,...o}=r;for(const[s,a]of Object.entries(z(zl,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}),U(Wl,this,[...z(Wl,this),...n.modules]),a.push(n)}}}}function Gl(t){for(const[,e]of Object.entries(z(zl,this).variants))for(const[n,i]of e.entries()){const r=i.modules,o=e.filter((t=>t!==i)).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=>t!==a)).map((t=>t.timeline.getNodesAtTime(0)[0])),u=[{nodeId:l.id,weight:Dl},...c.map((t=>({nodeId:t.id,weight:Rl})))];for(const e of s.timeline.placements){t.getNode(e.nodeId).setChildren(u)}}}}function Hl(){const t=z(zl,this),e=t.currentItem.modules;e.length>1&&t.activeModuleIndex===e.length-1?t.activeModuleIndex=0:B(jl,this,Kl).call(this)}function Kl(){const t=z(zl,this);t.activeModuleIndex=t.activeModuleIndex+1,t.currentItem.modules[t.activeModuleIndex]||(t.activeItemIndex=(t.activeItemIndex+1)%t.currentItemsList.length,t.activeModuleIndex=0)}var Xl=Ms('<button><span class="svelte-er27y2"> </span></button>'),Yl=Ms('<div class="nav-buttons-container svelte-er27y2"><div class="nav-buttons svelte-er27y2"></div></div>');Es(["click"]);const Ql="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 Jl=Ms('<button><img class="svelte-1al44kl"/></button>');function Zl(t,e){const n=ma(e,"hidden",3,!1);var i=Jl();let r;i.__click=function(...t){var n;null===(n=e.onClick)||void 0===n||n.apply(this,t)};var o=wo(i);Ii(i),Do((()=>{var t;r=Ys(i,0,`nav-button ${null!==(t=e.type)&&void 0!==t?t:""}`,"svelte-1al44kl",r,{hidden:n()}),ta(i,"aria-label",e.type),ta(o,"src",Ql),ta(o,"alt",e.type)})),Os(t,i)}Es(["click"]);var tc=Ms('<button><span class="svelte-1mxltt0"> </span></button>'),ec=Ms('<div class="steps-indicator-container svelte-1mxltt0"><button aria-label="Scroll to previous steps"><img alt="Previous steps button" class="svelte-1mxltt0"/></button> <div role="group" aria-roledescription="Sequence navigation buttons"></div> <button aria-label="Scroll to next steps"><img alt="Next steps button" class="svelte-1mxltt0"/></button></div>');function nc(t,e){Ci(e,!0);const n=16,i=32,r=Pi("state");let o=so(null),s=so(null),a=so(!1),l=so(!1);const c=Qr((()=>{let t=[];return t=r().currentItem.modules.map(((t,e)=>({index:e,type:e===r().activeModuleIndex?"active":"",name:t.name}))),t}));function u(){bs(o)&&(lo(a,bs(o).scrollLeft>3),lo(l,bs(o).scrollLeft+bs(o).clientWidth<bs(o).scrollWidth-3))}function d(t){bs(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(bs(o).querySelectorAll(".step-button")).find((t=>{const e=t.getBoundingClientRect(),n=bs(o).getBoundingClientRect();return e.left>n.left+i}));if(t){const e=t.previousElementSibling;e&&h(bs(o),e)}}function p(){const t=Array.from(bs(o).querySelectorAll(".step-button")).reverse().find((t=>{const e=t.getBoundingClientRect(),n=bs(o).getBoundingClientRect();return e.right<n.right-i}));if(t){const e=t.nextElementSibling;e&&h(bs(o),e)}}Fo((()=>{if(bs(o)){u();const t=new MutationObserver((()=>{const t=bs(o).querySelector(".step-button.active");t&&lo(s,t,!0)}));return t.observe(bs(o),{attributes:!0,attributeFilter:["class"],subtree:!0}),()=>{t.disconnect()}}})),Fo((()=>{bs(s)&&bs(o)&&h(bs(o),bs(s))}));var m=Fs();Is("resize",po,u),function(t,e,n){xi&&Ti();var i=new Ws(t);Ro((()=>{var t=e();i.ensure(t,n)}))}(_o(m),(()=>r().activeItemIndex),(t=>{var e=ec(),n=wo(e);let i;n.__click=f;var s=wo(n);Ii(n);var d=To(n,2);let m;Vs(d,21,(()=>bs(c)),js,((t,e)=>{var n=tc();let i;n.__click=t=>{return n=t.currentTarget,i=bs(e).index,r().activeModuleIndex=i,void h(bs(o),n);var n,i};var s=wo(n),a=wo(s,!0);Ii(s),Ii(n),Do((()=>{i=Ys(n,0,"step-button svelte-1mxltt0",null,i,{active:"active"===bs(e).type}),ta(n,"aria-label",`Go to step $${bs(e).index+1}`),Cs(a,bs(e).name)})),Os(t,n)})),Ii(d),fa(d,(t=>lo(o,t)),(()=>bs(o)));var g=To(d,2);let v;g.__click=p;var y=wo(g);Ii(g),Ii(e),Do(((t,e)=>{i=Ys(n,0,"step-arrow step-arrow-prev svelte-1mxltt0",null,i,{visible:bs(a)}),ta(s,"src",Ql),m=Ys(d,0,"steps-indicator svelte-1mxltt0",null,m,t),Qs(d,`--stepDuration: ${null!=e?e:""}s`),v=Ys(g,0,"step-arrow step-arrow-next svelte-1mxltt0",null,v,{visible:bs(l)}),ta(y,"src",Ql)}),[()=>({"with-duration":r().currentModule.hasDuration,paused:r().paused}),()=>r().currentModule.duration]),Is("scroll",d,u),Os(t,e)})),Os(t,m),Di()}Es(["click"]);const ic="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",rc="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 oc=Ms('<img alt="Play" class="svelte-a3r6re"/>'),sc=Ms('<img alt="Pause" class="svelte-a3r6re"/>'),ac=Ms('<button class="pause-button svelte-a3r6re"><!></button>');Es(["click"]);var lc,cc,uc="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function dc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var hc=function(){if(cc)return lc;cc=1;var t=NaN,e="[object Symbol]",n=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,r=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt,a="object"==typeof uc&&uc&&uc.Object===Object&&uc,l="object"==typeof self&&self&&self.Object===Object&&self,c=a||l||Function("return this")(),u=Object.prototype.toString,d=Math.max,h=Math.min,f=function(){return c.Date.now()};function p(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function m(a){if("number"==typeof a)return a;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&u.call(t)==e}(a))return t;if(p(a)){var l="function"==typeof a.valueOf?a.valueOf():a;a=p(l)?l+"":l}if("string"!=typeof a)return 0===a?a:+a;a=a.replace(n,"");var c=r.test(a);return c||o.test(a)?s(a.slice(2),c?2:8):i.test(a)?t:+a}return lc=function(t,e,n){var i,r,o,s,a,l,c=0,u=!1,g=!1,v=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function y(e){var n=i,o=r;return i=r=void 0,c=e,s=t.apply(o,n)}function b(t){var n=t-l;return void 0===l||n>=e||n<0||g&&t-c>=o}function k(){var t=f();if(b(t))return x(t);a=setTimeout(k,function(t){var n=e-(t-l);return g?h(n,o-(t-c)):n}(t))}function x(t){return a=void 0,v&&i?y(t):(i=r=void 0,s)}function w(){var t=f(),n=b(t);if(i=arguments,r=this,l=t,n){if(void 0===a)return function(t){return c=t,a=setTimeout(k,e),u?y(t):s}(l);if(g)return a=setTimeout(k,e),y(l)}return void 0===a&&(a=setTimeout(k,e)),s}return e=m(e)||0,p(n)&&(u=!!n.leading,o=(g="maxWait"in n)?d(m(n.maxWait)||0,e):o,v="trailing"in n?!!n.trailing:v),w.cancel=function(){void 0!==a&&clearTimeout(a),c=0,i=l=r=a=void 0},w.flush=function(){return void 0===a?s:x(f())},w},lc}();const fc=dc(hc);var pc=Ms("<img/>"),mc=Ms('<div class="ui-container svelte-1rvgxfc"><!></div>'),gc=Ms('<div class="cover-container svelte-1rvgxfc"><!> <!></div>'),vc=Ms('<div class="covers-container svelte-1rvgxfc" style="scroll-behavior: smooth;"></div>');function yc(t,e){Ci(e,!0);const n=[375,768,1024,1400,1920];let i=ma(e,"scrollOffset",15),r=ma(e,"isMobile",3,!1);const o=Pi("state");let s,a=so(void 0),l=so(1920),c=Qr((()=>o().playingModulePosition)),u=null,d=null,h=Qr((()=>o().startedPlaying)),f=Qr((()=>o().currentModulesList)),p=Qr((()=>bs(f).findIndex((t=>v(o().playingModulePosition,t.position)))));const m=fc((t=>{let e=n.find((e=>e>t));e||(e=n[n.length-1]),lo(l,e,!0)}),300);async function g(){o().seeking&&(o().startedPlaying?o().currentItemsList[o().activeItemIndex].modules[o().activeModuleIndex].play():o().playingModulePosition=bs(c),i(0))}function v(t,e){return t.itemIndex===e.itemIndex&&t.moduleIndex===e.moduleIndex}function y(t){const e=t.scrollLeft,n=t.scrollWidth-t.clientWidth;return 0===e?0:e>n?100:e/n*100}function b({target:t}){var e;const n=y(t),r=(null===(e=bs(f))||void 0===e?void 0:e.length)||1,a=100/(r-1||1),l=Math.round(n/a);let h=Math.min(l,r-1);const m=bs(f)[h],b={itemIndex:o().activeItemIndex,moduleIndex:o().activeModuleIndex};null!==u||v(m.position,b)||(o().activeItemIndex=m.position.itemIndex,o().activeModuleIndex=m.position.moduleIndex),lo(c,m.position);const k=s.children[bs(p)],x=s.getBoundingClientRect(),w=k.getBoundingClientRect();i(w.x-x.x),d&&clearTimeout(d),d=setTimeout((()=>{const e=y(t);Math.abs(e-l*a)<.25&&(null!==u?v(m.position,u)&&(u=null,g()):g())}),150)}Fo((()=>{const{activeItemIndex:t,activeModuleIndex:e}=o();t===bs(c).itemIndex&&e===bs(c).moduleIndex||ws((()=>{var n;const i=bs(f).findIndex((n=>{const{itemIndex:i,moduleIndex:r}=n.position;return t===i&&e===r}));u=(null===(n=bs(f)[i])||void 0===n?void 0:n.position)||null;const r=s.children[i];null==r||r.scrollIntoView()}))})),Fo((()=>m(bs(a)*window.devicePixelRatio)));var k=Fs(),x=_o(k),w=t=>{var n=vc();Vs(n,23,(()=>bs(f)),(t=>t.id),((t,n,i)=>{var o=gc(),s=wo(o),a=t=>{var r=pc();let o;Do((t=>{o=Ys(r,0,"cover-image svelte-1rvgxfc",null,o,{active:bs(h)&&bs(i)===bs(p)}),ta(r,"src",t),ta(r,"alt",bs(n).name),ta(r,"fetchpriority",0===bs(i)?"high":"auto")}),[()=>e.getCoverUrl(bs(n).cover,bs(l))]),Os(t,r)};Us(s,(t=>{bs(l)&&t(a)}));var c=To(s,2),u=t=>{var e=mc();!function(t,e,n){xi&&Ti();var i=new Ws(t);Ro((()=>{var t,r=null!==(t=e())&&void 0!==t?t:null;i.ensure(r,r&&(t=>n(t,r)))}),ni)}(wo(e),(()=>bs(n).Component),((t,e)=>{e(t,{get state(){return bs(n).state},get isMobile(){return r()}})})),Ii(e),Os(t,e)};Us(c,(t=>{var e;null!==(e=bs(n))&&void 0!==e&&e.Component&&t(u)})),Ii(o),Os(t,o)})),Ii(n),fa(n,(t=>s=t),(()=>s)),Is("scroll",n,b),da(n,"clientWidth",(t=>lo(a,t))),Os(t,n)};Us(x,(t=>{bs(f)&&t(w)})),Os(t,k),Di()}const bc="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};let kc;function xc(){const t=bc&&bc.navigator&&(bc.navigator.userAgent||bc.navigator.platform||bc.navigator.vendor)||"";if(kc&&kc.ua===t)return kc;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 kc={ua:t,isMobile:r},kc}var wc=Ms('<div class="absolute-full paging-buttons svelte-1n46o8q"><!> <!></div>'),_c=Ms("<div></div>"),Tc=Ms("<!> <!>",1),Ic=Ms('<div class="player-container svelte-1n46o8q"><div class="absolute-full swipable svelte-1n46o8q"></div> <!> <!> <!> <!></div> <!>',1),Ec=Ms('<div class="eko-gallery-app svelte-1n46o8q"><!></div>');function Sc(t,e){Ci(e,!0);const n=ma(e,"config",19,(()=>({}))),i=ma(e,"forceMobile",3,!1),r=ma(e,"onGalleryReady",3,(()=>{}));let o,s=so(fo(new $l(n()))),a=so(null),l=Qr((()=>i()||xc().isMobile)),c=so(0),u=so(void 0),d=so(!0);var h,f,p;function m(){lo(a,new e.EkoPlayer(o,e.playerOptions)),bs(a).on("playing",(()=>{bs(s).state.paused=!1})),bs(a).on("pause",(()=>{bs(s).state.paused=!0})),bs(a).once("playing",(()=>{bs(s).state.startedPlaying=!0}))}function g(t){var e;null===(e=bs(s))||void 0===e||e.selectItem(t)}function v(){var t;null===(t=bs(s))||void 0===t||t.next()}function y(){var t;null===(t=bs(s))||void 0===t||t.prev()}function b(){bs(a).paused?bs(a).play():bs(a).pause()}h="state",f=()=>bs(s).state,Ri().set(h,f),p=()=>(n()&&e.EkoPlayer&&(m(),bs(s).start(bs(a))),r()(bs(s).public),()=>{var t;null===(t=bs(a))||void 0===t||t.dispose()}),null===Fi&&yi(),Fo((()=>{const t=ws(p);if("function"==typeof t)return t})),Fo((()=>{var t;n()&&n()!==bs(s).currentConfig&&(lo(s,new $l(n()),!0),null===(t=bs(a))||void 0===t||t.dispose(),lo(d,!1),ys().then((()=>(lo(d,!0),ys()))).then((()=>{m(),bs(s).start(bs(a)),r()(bs(s).public)})))})),Fo((()=>{bs(u)&&bs(a)&&bs(a).loadDebugOverlay({containerElement:bs(u)})}));var k=Ec(),x=wo(k),w=t=>{var n=Ic(),i=_o(n),r=wo(i);fa(r,(t=>o=t),(()=>o));var a=To(r,2);yc(a,{get isMobile(){return bs(l)},get getCoverUrl(){return bs(s).getCoverUrl},get scrollOffset(){return bs(c)},set scrollOffset(t){lo(c,t,!0)}});var d=To(a,2),h=t=>{var e=wc(),n=wo(e);Zl(n,{type:"prev",onClick:y}),Zl(To(n,2),{type:"next",onClick:v}),Ii(e),Os(t,e)};Us(d,(t=>{bs(l)||e.hideNav||t(h)}));var f=To(d,2),p=t=>{nc(t,{})};Us(f,(t=>{var e;!bs(l)&&(null===(e=bs(s).state.currentItem)||void 0===e?void 0:e.modules.length)>1&&t(p)}));var m=To(f,2),k=t=>{var n=Tc(),i=_o(n);!function(t,e){Ci(e,!0);const n=Pi("state");var i=ac();i.__click=function(...t){var n;null===(n=e.onPauseClick)||void 0===n||n.apply(this,t)};var r=wo(i),o=t=>{var e=oc();Do((()=>ta(e,"src",ic))),Os(t,e)},s=t=>{var e=sc();Do((()=>ta(e,"src",rc))),Os(t,e)};Us(r,(t=>{n().paused?t(o):t(s,!1)})),Ii(i),Do((t=>ta(i,"aria-label",t)),[()=>n().paused?"Play":"Pause"]),Os(t,i),Di()}(i,{onPauseClick:b});var r=To(i,2),o=t=>{var e=_c();fa(e,(t=>lo(u,t)),(()=>bs(u))),Os(t,e)};Us(r,(t=>{e.debug&&t(o)})),Os(t,n)};Us(m,(t=>{bs(s).state.startedPlaying&&t(k)})),Ii(i);var x=To(i,2),w=t=>{!function(t,e){Ci(e,!0);let n=ma(e,"onNavItemClick",3,(()=>{}));const i=Pi("state");var r=Yl(),o=wo(r);Vs(o,23,(()=>i().currentItemsList),(t=>t.id),((t,e,r)=>{var o=Xl();let s;o.__click=()=>n()(bs(r));var a=wo(o),l=wo(a,!0);Ii(a),Ii(o),Do((t=>{s=Ys(o,0,"nav-button svelte-er27y2",null,s,t),Cs(l,bs(e).name)}),[()=>({selected:bs(r)===i().activeItemIndex})]),Os(t,o)})),Ii(o),Ii(r),Os(t,r),Di()}(t,{onNavItemClick:g})};Us(x,(t=>{e.hideNav||t(w)})),Do((()=>{var t;return Qs(i,`--uiTranformX: ${null!==(t=bs(c))&&void 0!==t?t:""}px`)})),Os(t,n)};Us(x,(t=>{n()&&bs(d)&&t(w)})),Ii(k),Os(t,k),Di()}function Nc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ac,Mc,Fc,Oc,Pc={exports:{}},Cc=Nc((Ac||(Ac=1,Fc=Pc.exports,Oc=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},(Mc=Pc).exports?Mc.exports=Oc():Fc.log=Oc()),Pc.exports));const Dc=()=>{},Rc=["trace","log","debug","info","warn","error","getLevel","setLevel"],Bc=["trace","debug","info","warn","error","silent"],Lc={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;"},zc="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global;let Wc={level:"trace",appName:""},Uc=[];const jc="object"==typeof zc&&zc.performance&&"function"==typeof zc.performance.now?zc.performance.now.bind(zc.performance):Date.now.bind(Date),$c=t=>t&&"string"==typeof t?t.toLowerCase().trim():"",qc=(()=>{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[$c(e)]=$c(i)||"trace"})),n}catch(t){return{}}})(),Vc=(t,e="")=>{const n=$c(t),i=Cc.getLogger(n);if(i.__ekologger)return i.__ekologger;e||qc[n]||qc["*"]||(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)=>(jc()/1e3).toFixed(e))()}] %c[${s}] ${Wc.appName?`[${Wc.appName}] `:""}[${t}]`,Lc[s],...e)}},e=qc[n]||qc["*"]||e||Wc.level,i.setLevel(e,!1);const o=(...t)=>i.log(...t);return Rc.forEach((t=>{o[t]=(...e)=>(Uc.forEach((n=>{n[t](...e)})),i[t](...e))})),i.__ekologger=o,o};Vc.setDefaults=({appName:t="",level:e})=>{t&&"string"==typeof t&&(Wc.appName=t),(e=$c(e))&&Bc.includes(e)&&(Wc.level=e,Object.values(Cc.getLoggers()).filter((t=>t.__noExplicitLevel)).forEach((t=>t.setLevel(Wc.level,!1))))},Vc.installDriver=t=>{const e={...Rc.reduce(((e,n)=>(e[n]="function"==typeof(null==t?void 0:t[n])?t[n]:Dc,e)),{})};Uc.push(e)};let Gc=class{#w=new Map;on(t,e){if("function"!=typeof e)return this;const n=this.#w.get(t)||new Set;return n.add(e),this.#w.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.#w.clear(),this;const n=this.#w.get(t);return n?e?(n.delete(e),0===n.size&&this.#w.delete(t),this):(this.#w.delete(t),this):this}trigger(t,...e){const n=this.#w.get(t);return n?(n.forEach((t=>t(...e))),this):this}};function Hc(t){return"[object Object]"===Object.prototype.toString.call(t)}function Kc(t,...e){const n=Hc(t)?{...t}:{};return e.forEach((t=>{Hc(t)&&Object.keys(t).forEach((e=>{const i=t[e],r=n[e];Hc(i)&&Hc(r)?n[e]=Kc(r,i):Array.isArray(i)?n[e]=i.slice():n[e]=i}))})),n}function Xc(t){if("string"==typeof t)return`'${t}'`;if(Array.isArray(t))return`[${t.map((t=>Xc(t))).join(", ")}]`;if(Hc(t))try{return JSON.stringify(t)}catch(t){return"[object Object]"}return null===t?"null":void 0===t?"undefined":String(t)}function Yc(t){return Array.from(t).map((t=>Xc(t))).join(", ")}var Qc=new WeakSet;class Jc extends Gc{constructor(...t){super(),j(this,Qc);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=Vc(n,this.loglevel);const i=Hc(this.defaults)?this.defaults:{},r=Hc(e)&&Hc(e[n])?e[n]:{};this.settings=Kc({},i,r),B(Qc,this,Zc).call(this),B(Qc,this,tu).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 Zc(){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}(${Yc(t)})`),a(...t)):a,t.add(o)}n=Object.getPrototypeOf(n)}}function tu(){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 eu="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};function nu(t){return Boolean(t)&&"object"==typeof t&&1===t.nodeType&&"function"==typeof t.appendChild}class iu extends Jc{#_;#T;#I;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);const[i]=t,r=function(t,e=(null==eu?void 0:eu.document)){if(nu(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 nu(i)?i:null}(i);if(!r)throw new Error("Canvas requires a valid mount target (HTMLElement or selector string).");this.#_=r;const o=null==eu?void 0:eu.document;if(!o||"function"!=typeof o.createElement)throw new Error("Canvas requires document.createElement.");var s,a;this.#T=o.createElement("canvas"),s=this.#T,a=null===(e=this.settings)||void 0===e?void 0:e.style,s&&a&&"object"==typeof a&&!Array.isArray(a)&&Object.keys(a).forEach((t=>{const e=a[t];null!=e&&(s.style[t]=String(e))})),this.#_.appendChild(this.#T);const l=null===(n=this.settings)||void 0===n?void 0:n.contextAttributes,c=l&&"object"==typeof l&&!Array.isArray(l)?l:void 0;if(this.#I=this.#T.getContext("webgl2",c),!this.#I)throw new Error("Canvas WebGL2 context is not available.")}get name(){return"Canvas"}get element(){return this.#T}get gl(){return this.#I}onDispose(){this.#T&&this.#T.parentNode&&this.#T.parentNode.removeChild(this.#T),this.#I=null,this.#T=null,this.#_=null}}var ru=new WeakMap,ou=new WeakMap,su=new WeakMap,au=new WeakMap,lu=new WeakMap,cu=new WeakMap,uu=new WeakSet;class du extends Jc{get name(){return"ContainerSize"}get containerWidth(){return z(ou,this)}get containerHeight(){return z(su,this)}get width(){return z(ou,this)}get height(){return z(su,this)}constructor(...t){super(...t),j(this,uu),W(this,ru,void 0),W(this,ou,0),W(this,su,0),W(this,au,null),W(this,lu,null),W(this,cu,null);const[e]=t;var n;U(ru,this,(n=e)&&n.element&&nu(n.element)?n.element:nu(n)?n:null),z(ru,this)&&(B(uu,this,fu).call(this,!0),B(uu,this,hu).call(this))}onDispose(){z(au,this)&&"function"==typeof z(au,this).disconnect&&z(au,this).disconnect(),U(au,this,null),z(cu,this)&&"function"==typeof(null==eu?void 0:eu.removeEventListener)&&eu.removeEventListener("resize",z(cu,this)),U(cu,this,null),z(lu,this)&&((null==eu?void 0:eu.clearInterval)||clearInterval)(z(lu,this)),U(lu,this,null),U(ru,this,null)}}function hu(){if(!z(ru,this))return;const t=null==eu?void 0:eu.ResizeObserver;if("function"==typeof t)return U(au,this,new t((()=>B(uu,this,fu).call(this)))),void z(au,this).observe(z(ru,this));U(cu,this,(()=>B(uu,this,fu).call(this))),"function"==typeof(null==eu?void 0:eu.addEventListener)&&eu.addEventListener("resize",z(cu,this));const e=(null==eu?void 0:eu.setInterval)||setInterval;U(lu,this,e((()=>B(uu,this,fu).call(this)),250))}function fu(t=!1){if(!z(ru,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}}(z(ru,this));(t||e!==z(ou,this)||n!==z(su,this))&&(U(ou,this,e),U(su,this,n),this.trigger("containerresize",{width:e,height:n}))}var pu={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"}};class mu{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;return{contextType:e||"webgl",contextAttributes:Object.prototype.hasOwnProperty.call(t,"contextAttributes")?n:r}}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 gu,vu={exports:{}},yu=(gu||(gu=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}(vu)),vu.exports),bu=Nc(yu);class ku extends mu{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 bu;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);const a={contextType:r};s&&void 0!==o&&(a.contextAttributes=o),t.initPlugin("canvas",a);const l={drawFrame:this.canvasDrawFrameFn.bind(this),resize:n,contextType:r,offscreenVideoCanvasEnabled:!1,viewportModeEnabled:!0,fps:0};return s&&void 0!==o&&(l.contextAttributes=o),t.canvas.init(l),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)}}class xu extends mu{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)}}class wu extends mu{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 _u=function(t){let e;return e="string"==typeof t?new xu(t):t&&t.src&&t.dest?new wu(t):new ku(t),e};function Tu(t){return Array.isArray(t)||(t=[t]),t}class Iu{constructor(t){this.store=t?{...t.get()}:{}}reset(){this.store={}}get(t){if(!t)return this.store;const e=(t=Tu(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=Tu(t),e=Tu(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]}))}}class Eu{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 Su=Vc("frame","warn");let Nu=!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");Nu=e||n}function Au(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))}class Mu extends Eu{fill(t){if(Nu&&(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?Au(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,Au(t,e)):t.__useSubImage=!0))}(this,t,e);const i=(performance.now()-n)/1e3;i>=.1&&Su.warn(`[fill] texImage2D() took ${i.toFixed(3)} seconds to execute.`),"function"==typeof t.close&&!0!==t.__keepOpen&&(t.close(),t.__closed=!0)}}class Fu extends Eu{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 Ou=function(t,e,n,i,r){let o;switch(t){case"frame":o=new Mu(e,n,i,r);break;case"pixel":o=new Fu(e,n,i,r);break;default:throw new Error(`cant recognize type ${t}`)}return o};class Pu{constructor(t){return this.gl=t.gl,this.textureObjectPool=[],this.textureUnitsPool=new Set(Array(20).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=Ou(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(20).keys()),t.forEach((t=>{this.textureUnitsPool.delete(t)}))}}const Cu=pu.VIDEO_SOURCE_PREFIX,Du=pu.TEXTURE_SOURCE_PREFIX,Ru=pu.PREVIOUS_OUTPUT_PREFIX,Bu=pu.SAVED_FRAME_PREFIX;function Lu(t,e,n){t.set(`${Cu}${n}`,e)}function zu(t,e,n){t.set(`${Ru}${n}`,e)}function Wu(t,e,n){t.set(`${Bu}${n}`,e)}class Uu{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()))Lu(t,n,e),zu(t,n,e);for(const[e,n]of Object.entries(this.capturedFramesManager.getSavedFrames()))Wu(t,n,e)}setTextureSource(t,e,n){t.set(`${Du}${n}`,e)}getInput(t,e){return t.get(e)}getPrevOutput(t,e){return e=Number.isInteger(e)?e:0,t.get(`${Ru}${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)=>{zu(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))}))}}class ju{constructor(t){this.context=t}bind(){throw new Error("impl in concrete")}}let $u=100,qu=100;function Vu(t,e){$u=t,qu=e}let Gu=class extends ju{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),Vu(i,r)),t}},Hu=class extends ju{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),!1!==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}};class Ku{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===pu.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS?new Gu({gl:this.gl}):new Hu({gl:this.gl,textureManager:this.textureManager,frameBufferObject:this.getFrameBufferObject(),useCanvasSizedFilterTargets:this.useCanvasSizedFilterTargets}),e}}function Xu(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 Yu=function(t,e){return Xu(t,t.VERTEX_SHADER,e)},Qu=function(t,e){return Xu(t,t.FRAGMENT_SHADER,e)};const Ju={position_3d:0,texture_coordinate_2d:1};var Zu=function(t,e,n){const i=t.createProgram();if(t.attachShader(i,e),t.attachShader(i,n),Object.entries(Ju).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)},td=[-1,-1,1,1,-1,1,-1,1,1,1,1,1],ed=[0,1,2,2,1,3],nd=[0,0,1,0,0,1,1,1];const id=96,rd=[new Float32Array(new ArrayBuffer(id)),new Float32Array(new ArrayBuffer(id)),new Float32Array(new ArrayBuffer(id)),new Float32Array(new ArrayBuffer(id)),new Float32Array(new ArrayBuffer(id)),new Float32Array(new ArrayBuffer(id))],od=[new Int16Array(6),new Int16Array(6),new Int16Array(6)];class sd{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=rd[this.floatBufferCounter],this.floatBufferCounter=this.floatBufferCounter++%rd.length;break;case this.gl.ELEMENT_ARRAY_BUFFER:t=od[this.unit16BufferCounter],this.unit16BufferCounter=this.unit16BufferCounter++%od.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 ad={position_3d:class extends sd{getPointerData(){return{size:3,type:this.gl.FLOAT,normalize:!1,stride:0,offset:0}}},position_indexes:class extends sd{setPointer(){}getPointerData(){}enable(){}},texture_coordinate_2d:class extends sd{getPointerData(){return{size:2,type:this.gl.FLOAT,normalize:!0,stride:0,offset:0}}}};var ld=function(t,e,n){const i=ad[t];if(!i)throw new Error(`${t} is not a attribute name,choose from list: ${Object.keys(ad)}`);return new i(t,e,n)};class cd{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}}class ud extends cd{set(t){this.gl.uniform1fv(this.location,t)}}class dd extends cd{set(t){t&&(t.beforeUse(),this.gl.uniform1i(this.location,t.getUnit()))}}const hd="first_texture_dimensions",fd="viewport_dimensions",pd="time",md={RUNTIME_OPTIONS:"runtimeOptions[0]",STATIC_OPTIONS:"staticOptions[0]",FIRST_TEXTURE:"first_texture",SECOND_TEXTURE:"second_texture",FIRST_MATRIX:"first_mat4"},gd={[md.FIRST_TEXTURE]:dd,[md.SECOND_TEXTURE]:dd,[md.FIRST_MATRIX]:class extends cd{set(t){this.gl.uniformMatrix4fv(this.location,!1,t)}},[md.STATIC_OPTIONS]:ud,[md.RUNTIME_OPTIONS]:ud};var vd=function(t,e){const n=gd[t];if(!n)throw new Error(`${t} is not a attribute name,choose from list: ${Object.keys(gd)}`);return new n(t,e)},yd=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 bd="position_3d",kd="position_indexes",xd="texture_coordinate_2d";class wd{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=Yu(this.gl,e.vertex),this.fragmentShader=Qu(this.gl,e.fragment),this.program=Zu(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:bd,bindPoint:e.gl.ARRAY_BUFFER},{id:kd,bindPoint:e.gl.ELEMENT_ARRAY_BUFFER},{id:xd,bindPoint:e.gl.ARRAY_BUFFER}].concat(t)).forEach((t=>{const i=t.id;n[i]=ld(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]=vd(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:md.RUNTIME_OPTIONS},{id:md.STATIC_OPTIONS}];return(t.getUniformList||wd.getUniformList)().forEach((t=>{Object.values(md).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||wd.getUniformList)().forEach((t=>{switch(t){case md.FIRST_TEXTURE:this.uniforms[md.FIRST_TEXTURE].set(r[0]);break;case md.SECOND_TEXTURE:this.uniforms[md.SECOND_TEXTURE].set(r[1]);break;case hd:o=[...o,r[0].getWidth(),r[0].getHeight()];break;case fd:o=[...o,i.width,i.height];break;case pd:{const t=yd(e.startTime,e.duration);o=[...o,t];break}}})),o.length>0&&this.uniforms[md.RUNTIME_OPTIONS].set(o)}static getUniformList(){return[md.FIRST_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(){}handleAttributes(){this.attributes[bd].fillBuffer(td),this.attributes[bd].setPointer(),this.attributes[kd].fillBuffer(ed),this.attributes[xd].fillBuffer(nd),this.attributes[xd].setPointer()}disposeAttributes(){Object.values(this.attributes).forEach((t=>{t.dispose()}))}render(t,e){const n=this.frameBuffer.bind(t);let i={width:$u,height:qu};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)}}class _d extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(_d)};super(_d.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}"},e,t)}static getFilterType(){return"__default"}static getInputsCount(){return 1}static getInitialOptions(){return{}}}var Td,Id="undefined"!=typeof Float32Array?Float32Array:Array;function Ed(){var t=new Id(3);return Id!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Sd(t,e,n){var i=new Id(3);return i[0]=t,i[1]=e,i[2]=n,i}function Nd(){var t=new Id(4);return Id!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}Ed(),function(){var t;t=new Id(4),Id!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}(),Ed(),Sd(1,0,0),Sd(0,1,0),Nd(),Nd(),Td=new Id(9),Id!=Float32Array&&(Td[1]=0,Td[2]=0,Td[3]=0,Td[5]=0,Td[6]=0,Td[7]=0),Td[0]=1,Td[4]=1,Td[8]=1;class Ad extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Ad)};super(Ad.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:Ad.getInitialOptions().translate.x},{properties:["translate","y"],type:"slider",minValue:-2,maxValue:2,step:.001,initialValue:Ad.getInitialOptions().translate.y},{properties:["scale","x"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:Ad.getInitialOptions().scale.x},{properties:["scale","y"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:Ad.getInitialOptions().scale.y},{properties:["rotate"],type:"slider",minValue:-360,maxValue:360,step:1,initialValue:Ad.getInitialOptions().rotate}]}static getUniformList(){return[md.FIRST_TEXTURE,md.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,g=s*u,v=a*l,y=a*c,b=a*u,k=i[0],x=i[1],w=i[2];return t[0]=(1-(p+g))*k,t[1]=(h+b)*k,t[2]=(f-y)*k,t[3]=0,t[4]=(h-b)*x,t[5]=(1-(d+g))*x,t[6]=(m+v)*x,t[7]=0,t[8]=(f+y)*w,t[9]=(m-v)*w,t[10]=(1-(d+p))*w,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}((s=new Id(16),Id!=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}(Nd(),0,0,o),Sd(e,n,0),Sd(i,r,1)),this.uniforms[md.FIRST_MATRIX].set(this.transformMatrix)}}class Md extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Md)};super(Md.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[md.FIRST_TEXTURE,hd]}}class Fd extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Fd)};super(Fd.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[md.FIRST_TEXTURE,hd]}}class Od extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Od)};super(Od.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[md.FIRST_TEXTURE,hd,fd]}handleStaticUniforms(t){var e;const n=(null!==(e=Number.parseFloat(t.offsetDist))&&void 0!==e?e:4).toFixed(3);this.uniforms[md.STATIC_OPTIONS].set([n])}}class Pd extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Pd)};super(Pd.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[md.FIRST_TEXTURE,hd,fd]}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[md.STATIC_OPTIONS].set([i,r])}}class Cd extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Cd)};super(Cd.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[md.STATIC_OPTIONS].set([e])}}class Dd extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Dd)};super(Dd.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[md.FIRST_TEXTURE,hd,md.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[md.STATIC_OPTIONS].set([e,n,i,r,o,s,a])}}class Rd extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Rd)};super(Rd.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[md.FIRST_TEXTURE,md.SECOND_TEXTURE]}}class Bd extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Bd)};super(Bd.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[md.FIRST_TEXTURE,md.SECOND_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(t){const e=Number.parseFloat(t.lutSize).toFixed(1);this.uniforms[md.STATIC_OPTIONS].set([e])}}var Ld="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",zd='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:Wd,cos:Ud,sin:jd,acos:$d,atan2:qd,sqrt:Vd,pow:Gd}=Math;function Hd(t){return t<0?-Gd(-t,1/3):Gd(t,1/3)}const Kd=Math.PI,Xd=2*Kd,Yd=Kd/2,Qd=Number.MAX_SAFE_INTEGER||9007199254740991,Jd=Number.MIN_SAFE_INTEGER||-9007199254740991,Zd={x:0,y:0,z:0},th={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),Vd(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],Zd],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||th.approximately(t,e)||th.approximately(t,n)},approximately:function(t,e,n){return Wd(t-e)<=(n||1e-6)},length:function(t){const e=th.Tvalues.length;let n=0;for(let i,r=0;r<e;r++)i=.5*th.Tvalues[r]+.5,n+=th.Cvalues[r]*th.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(th.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 qd(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 Vd(n*n+i*i)},closest:function(t,e){let n,i,r=Gd(2,63);return t.forEach((function(t,o){i=th.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=Gd(t,e)+Gd(1-t,e);return Wd((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=Gd(1-t,e);return n/(Gd(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 th.lli8(r,o,s,a,l,c,u,d)},lli:function(t,e){return th.lli4(t,t.c,e,e.c)},makeline:function(t,e){return new uh(t.x,t.y,(t.x+e.x)/2,(t.y+e.y)/2,e.x,e.y)},findbbox:function(t){let e=Qd,n=Qd,i=Jd,r=Jd;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(!th.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=th.makeline(e.points[i-1],t.points[0]),s=th.makeline(t.points[r-1],e.points[0]),a={startcap:o,forward:t,back:e,endcap:s,bbox:th.findbbox([o,t,e,s]),intersections:function(t){return th.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=Qd,s=Jd;-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=-qd(e.p2.y-i,e.p2.x-n);return t.map((function(t){return{x:(t.x-n)*Ud(r)-(t.y-i)*jd(r),y:(t.x-n)*jd(r)+(t.y-i)*Ud(r)}}))},roots:function(t,e){e=e||{p1:{x:0,y:0},p2:{x:1,y:0}};const n=t.length-1,i=th.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=-Vd(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(th.approximately(l,0)){if(th.approximately(c,0))return th.approximately(u,0)?[]:[-d/u].filter(r);const t=Vd(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,g=m*m+f*f*f;let v,y,b,k,x;if(g<0){const t=-h/3,e=Vd(t*t*t),n=-p/(2*e),i=$d(n<-1?-1:n>1?1:n),o=2*Hd(e);return b=o*Ud(i/3)-c/3,k=o*Ud((i+Xd)/3)-c/3,x=o*Ud((i+2*Xd)/3)-c/3,[b,k,x].filter(r)}if(0===g)return v=m<0?Hd(-m):-Hd(m),b=2*v-c/3,k=-v-c/3,[b,k].filter(r);{const t=Vd(g);return v=Hd(-m+t),y=Hd(m+t),[v-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=-Vd(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=th.compute(t,e),h=th.compute(t,n),f=d.x*d.x+d.y*d.y;if(i?(o=Vd(Gd(d.y*h.z-h.y*d.z,2)+Gd(d.z*h.x-h.z*d.x,2)+Gd(d.x*h.y-h.x*d.y,2)),s=Gd(f+d.z*d.z,1.5)):(o=d.x*h.y-d.y*h.x,s=Gd(f,1.5)),0===o||0===s)return{k:0,r:0};if(c=o/s,u=s/o,!r){const r=th.curvature(t-.001,e,n,i,!0).k,o=th.curvature(t+.001,e,n,i,!0).k;l=(o-c+(c-r))/2,a=(Wd(o-c)+Wd(c-r))/2}return{k:c,r:u,dk:l,adk:a}},inflections:function(t){if(t.length<4)return[];const e=th.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(th.approximately(o,0)){if(!th.approximately(s,0)){let t=-a/s;if(0<=t&&t<=1)return[t]}return[]}const l=2*o;if(th.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,Wd(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 th.bboxoverlap(t.left.bbox(),t.right.bbox())}));let u=[];return 0===c.length||(c.forEach((function(t){u=u.concat(th.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*Ud(Yd)-r*jd(Yd),l=i*jd(Yd)+r*Ud(Yd),c=o*Ud(Yd)-s*jd(Yd),u=o*jd(Yd)+s*Ud(Yd),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,g=h+l,v=f+c,y=p+u,b=th.lli8(d,h,m,g,f,p,v,y),k=th.dist(b,t);let x,w=qd(t.y-b.y,t.x-b.x),_=qd(e.y-b.y,e.x-b.x),T=qd(n.y-b.y,n.x-b.x);return w<T?((w>_||_>T)&&(w+=Xd),w>T&&(x=T,T=w,w=x)):T<_&&_<w?(x=T,T=w,w=x):T+=Xd,b.s=w,b.e=T,b.r=k,b},numberSort:function(t,e){return t-e}};class eh{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 th.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++)th.expandbox(e,t[n].bbox());return e}offset(t){const e=[];return this.curves.forEach((function(n){e.push(...n.offset(t))})),new eh(e)}}const{abs:nh,min:ih,max:rh,cos:oh,sin:sh,acos:ah,sqrt:lh}=Math,ch=Math.PI;let uh=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=th.align(s,{p1:s[0],p2:s[l]}),d=th.dist(s[0],s[l]);this._linear=u.reduce(((t,e)=>t+nh(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=th.dist(n,s.C));const a=o*(1-r)/r,l=th.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,g=n.y-h,v=n.x+f,y=n.y+p,b=s.A,k=b.x+(m-b.x)/(1-r),x=b.y+(g-b.y)/(1-r),w=b.x+(v-b.x)/r,_=b.y+(y-b.y)/r,T={x:t.x+(k-t.x)/r,y:t.y+(x-t.y)/r},I={x:i.x+(w-i.x)/(1-r),y:i.y+(_-i.y)/(1-r)};return new e(t,T,I,i)}static getUtils(){return th}getUtils(){return e.getUtils()}static get PolyBezier(){return eh}valueOf(){return this.toString()}toString(){return th.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=th.derive(this.points,this._3d),this.computedirection()}computedirection(){const t=this.points,e=th.angle(t[0],t[this.order],t[1]);this.clockwise=e>0}length(){return th.length(this.derivative.bind(this))}static getABC(t=2,e,n,i,r=.5){const o=th.projectionratio(r,t),s=1-o,a={x:o*e.x+s*i.x,y:o*e.y+s*i.y},l=th.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],th.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=th.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=th.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?th.computeWithRatios(t,this.points,this.ratios,this._3d):th.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 th.compute(t,this.dpoints[0],this._3d)}dderivative(t){return th.compute(t,this.dpoints[1],this._3d)}align(){let t=this.points;return new e(th.align(t,{p1:t[0],p2:t[t.length-1]}))}curvature(t){return th.curvature(t,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return th.inflections(this.points)}normal(t){return this._3d?this.__normal3(t):this.__normal2(t)}__normal2(t){const e=this.derivative(t),n=lh(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=lh(e.x*e.x+e.y*e.y+e.z*e.z),r=lh(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=lh(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=th.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=th.map(0,0,1,this._t1,this._t2),r.left._t2=th.map(t,0,1,this._t1,this._t2),r.right._t1=th.map(t,0,1,this._t1,this._t2),r.right._t2=th.map(1,0,1,this._t1,this._t2),n?(n=th.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]=th.droots(r),3===this.order&&(r=this.dpoints[1].map(i),t[n]=t[n].concat(th.droots(r))),t[n]=t[n].filter((function(t){return t>=0&&t<=1})),e=e.concat(t[n].sort(th.numberSort))}.bind(this)),t.values=e.sort(th.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]=th.getminmax(this,n,t[n])}.bind(this)),e}overlaps(t){const e=this.bbox(),n=t.bbox();return th.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=th.angle(this.points[0],this.points[3],this.points[1]),e=th.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),nh(ah(n))<ch/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,nh(n-i)<r)return[];e=t.split(n,i),e._t1=th.map(n,0,1,t._t1,t._t2),e._t2=th.map(i,0,1,t._t1,t._t2),s.push(e),n=i;break}n<1&&(e=t.split(n,1),e._t1=th.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=th.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]=th.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=lh(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]=th.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=th.makeline(h[2],d[0]),p=th.makeline(d[2],h[0]),m=[f,new e(d),p,new e(h)];return new eh(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 th.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],g=c[s-1].points[c[s-1].points.length-1],v=c[0].points[0],y=th.makeline(g,p),b=th.makeline(m,v),k=[y].concat(a).concat([b]).concat(c);return new eh(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=th.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=ih(t.p1.x,t.p2.x),n=ih(t.p1.y,t.p2.y),i=rh(t.p1.x,t.p2.x),r=rh(t.p1.y,t.p2.y);return th.roots(this.points,t).filter((t=>{var o=this.get(t);return th.between(o.x,e,i)&&th.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=th.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=th.dist(t,e),l=th.dist(t,o),c=th.dist(t,s);return nh(l-a)+nh(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=th.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*oh(a.e),y:a.y+a.r*sh(a.e)};a.e+=th.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 dh={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 uh({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 uh(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 uh(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 hh{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{fh(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 fh(t,e,n){let i=t[e];t[e]=t[n],t[n]=i}function ph(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 mh={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 hh(n,i);let o=[];for(let n=0;n<e;n++)o.push(ph(n/(e-1),r,t));return o}};function gh(t,e=256,n={}){return"bezier"===n.type?dh.pointsToCurve(t,e,n):mh.pointsToCurve(t,e)}const vh=[];for(let t=0;t<256;t++)vh[t]=t;class yh extends wd{constructor(t){const e={vertex:Ld,fragment:zd},n={uniforms:wd.getUniformInfo(yh)};super(yh.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,gh(n,256).map((t=>255*t))):vh],this.uniforms[md.STATIC_OPTIONS].set(e)}}function bh(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 kh extends wd{constructor(t){const e={vertex:Ld,fragment:zd},n={uniforms:wd.getUniformInfo(kh)};super(kh.getFilterType(),e,n,t)}static getFilterType(){return"levels"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=[...bh(t.black,t.white,t.gamma)];this.uniforms[md.STATIC_OPTIONS].set(e)}}const xh=360,wh=[];for(let t=0;t<xh;t++)wh[t]=t;class _h extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(_h)};super(_h.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\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 gh(t,xh,{type:"bezier"}).map((t=>{return e=t,((Math.round(e.x*xh)+180)%xh+(1-e.y-.5)*xh+xh)%xh;var e}))}(t.points)||wh;this.uniforms[md.STATIC_OPTIONS].set(e)}}class Th extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Th)};super(Th.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[md.STATIC_OPTIONS].set([e,n])}}class Ih extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Ih)};super(Ih.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[md.STATIC_OPTIONS].set([e,n,i,r])}}class Eh extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Eh)};super(Eh.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[md.STATIC_OPTIONS].set([e])}}class Sh extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Sh)};super(Sh.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[md.FIRST_TEXTURE,hd,fd]}handleStaticUniforms(t){let e={...Sh.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[md.STATIC_OPTIONS].set([n,i,r,o,s,a,l,c,h,f,d,u])}}class Nh extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Nh)};super(Nh.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[md.STATIC_OPTIONS].set([n,i,r,o])}}class Ah extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Ah)};super(Ah.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 Mh extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Mh)};super(Mh.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[md.STATIC_OPTIONS].set([e,n])}}class Fh extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Fh)};super(Fh.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[md.STATIC_OPTIONS].set([e])}}var Oh,Ph,Ch,Dh,Rh,Bh,Lh,zh;function Wh(){if(Dh)return Ch;Dh=1;const t=Ph?Oh:(Ph=1,Oh={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"]}};Ch=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]},Ch}function Uh(){if(Bh)return Rh;Bh=1;const t=Wh();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 Rh=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 jh=function(){if(zh)return Lh;zh=1;const t=Wh(),e=Uh(),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)}))})),Lh=n}(),$h=Nc(jh);class qh extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(qh)};super(qh.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=$h.hex.rgb(t.color).map((t=>t/255));this.uniforms[md.STATIC_OPTIONS].set([e[0],e[1],e[2]])}}class Vh extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Vh)};super(Vh.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[md.STATIC_OPTIONS].set([e.from,e.to,...e.ease])}static getUniformList(){return[md.FIRST_TEXTURE,pd]}}class Gh extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Gh)};super(Gh.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[md.STATIC_OPTIONS].set([e.from,e.to,...e.ease])}static getUniformList(){return[md.FIRST_TEXTURE,pd]}}class Hh extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Hh)};super(Hh.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[md.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[md.FIRST_TEXTURE,pd]}}class Kh extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Kh)};super(Kh.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[md.STATIC_OPTIONS].set([e.from,e.to,...e.ease,n.x,n.y])}static getUniformList(){return[md.FIRST_TEXTURE,pd,hd]}}class Xh extends wd{constructor(t){const e={uniforms:wd.getUniformInfo(Xh)};super(Xh.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=$h.hex.rgb(n).map((t=>t/255));this.uniforms[md.STATIC_OPTIONS].set([e.from,e.to,...e.ease,i[0],i[1],i[2]])}static getUniformList(){return[md.FIRST_TEXTURE,pd]}}var Yh=Object.freeze({__proto__:null,Crop:Sh,Curves:yh,Default:_d,DipToBlackTransition:Gh,DirectionalBlur:Pd,Exposure:Fh,ExposureTransition:Vh,FadeToColorTransition:Xh,FastBlur:Od,HardLight:qh,HorizontalBlur:Md,Hue:_h,Lab:Mh,Levels:kh,Lut:Bd,MotionBlurTransition:Kh,Opacity:Cd,Saturation:Eh,ShapeComposite:Rd,ShapeCompositeMask:Dd,Solid:Nh,SolidImage:Ah,Transform:Ad,TransformTransition:Hh,VerticalBlur:Fd,Vibrance:Ih,WhiteBalance:Th});const Qh=Object.values(Yh).reduce(((t,e)=>(t[e.getFilterType()]=e,t)),{});class Jh{constructor(t){this.context=t}static getFilterClass(t){return Qh[t]}getFilterIds(){return Object.keys(this.filterTypeToInstanceMap)}create(t,e){this.context={...this.context,options:e.options};const n=new Qh[t](this.context);if(!n)throw new Error(`${t} is not a atom filter, atomFilter list: `,this.getFilterIds());return n}}const Zh=pu.PREVIOUS_OUTPUT_PREFIX,tf=Object.values(Yh).reduce(((t,e)=>(t[e.getFilterType()]={type:e.getFilterType(),options:e.getInitialOptions(),inputs:[...Array(e.getInputsCount())].map(((t,e)=>`${Zh}${e}`)),outputs:[]},t)),{});var ef,nf,rf=function(){if(nf)return ef;nf=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)}),{})},ef=s}(),of=Nc(rf),sf=function(t,e){return of(t,e,{arrayMerge:(t,e)=>e})};const af=pu.MESSAGES.UPDATE_OPTIONS;let lf=class{constructor(t,e){this.eventEmitter=new bu,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(af,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 cf extends lf{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=sf(this.options,t),this.filter.updateStaticUniforms(this.options)}dispose(){this.filter.dispose()}}const uf=pu.MESSAGES.UPDATE_OPTIONS;class df extends cf{constructor(t,e,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}baseNodeUpdateOptions(t){this.options=sf(this.options,t),this.filter.updateStaticUniforms(this.options)}registerListeners(){this.baseNode.getEventEmitter().on(uf,this.baseNodeUpdateOptions,this)}dispose(){this.filter.dispose(),this.baseNode.getEventEmitter().off(uf,this.baseNodeUpdateOptions,this)}}function hf(t){return null!==t&&"object"==typeof t}function ff(t){if(!hf(t)||(e=t,Array.isArray(e)))return t;var e;const n=Object.keys(t).sort(),i={};return n.forEach((e=>{i[e]=ff(t[e])})),i}function pf(t,e){return null!=t&&t.id&&null!=e&&e.id?t.type===e.type&&t.id===e.id:t.type===e.type}function mf(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)),hf(i=n)&&hf(r)?JSON.stringify(ff(i))===JSON.stringify(ff(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]&&pf(a,c[l])?l:c.findIndex((t=>pf(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 gf(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=Nf.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 vf=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 gf(mf(r,o),r,n,i)};class yf extends lf{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=>Nf.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 Iu(e),r=[];this.nodes.forEach(((e,o)=>{const s={ioStore:t,graphIOManager:n};i=e.render(s),o!==this.nodes.length-1&&r.push(i)})),n.disposeTextures(r,i)}return n.setOutputs(e,r,i),i}getOptionsDisplay(){return[]}_updateOptions(t){this.nodes=vf(t,this.options,this.nodes,this.context),this.options=t}dispose(){this.nodes.forEach((t=>{t.dispose()}))}}const bf=pu.MESSAGES.UPDATE_OPTIONS;class kf extends yf{constructor(t,e,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}registerListeners(){this.baseNode.getEventEmitter().on(bf,this.updateOptions,this)}dispose(){this.nodes.forEach((t=>{t.dispose()})),this.baseNode.getEventEmitter().off(bf,this.updateOptions,this)}}const xf=pu.SYSTEM_NODES.TAGS.ATOM,wf=pu.SYSTEM_NODES.TAGS.FILTER,_f=pu.SYSTEM_NODES.TAGS.COMPOSITE_FILTER,Tf=pu.SYSTEM_NODES.TAGS.TRANSITION_FILTER,If=pu.PREVIOUS_OUTPUT_PREFIX,Ef=Object.keys(tf);function Sf(t,e){const n=(i=t.type,tf[i]);var i;return t=sf(n,t),new cf(t.type,t,e)}var Nf={create:function(t,e){let n;switch(function(t){let e;return n=t,e=Ef.includes(n)?xf:t===_f?_f:t===Tf?Tf:wf,e;var n}((t=JSON.parse(JSON.stringify(t))).type)){case xf:n=Sf(t,e);break;case wf: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=sf(r,t),e={...e,baseNode:n},o=i===_f?new kf(i,t,e):new df(i,t,e),o}(t,e);break;case _f:n=function(t,e){const n=t.type;return t=sf({inputs:[`${If}0`]},t),new yf(n,t,e)}(t,e);break;case Tf: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`,Sf(t,e)}(t,e);break;default:throw new Error("cant create node",t.type)}return n}};const Af=pu.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS;var Mf=function(t){const e={[Af]:tf[Af]};for(const[n,i]of Object.entries(e)){const e=Nf.create(i,t);t.nodeStore.set(n,e)}},Ff=function(t,e){for(const[n,i]of Object.entries(t)){const t=Nf.create(i,e);e.nodeStore.set(n,t)}};const Of=pu.CAPTURED_FRAME_PREFIX;class Pf{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=`${Of}${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 Cf=Vc("ShaderGraphApplication","warn"),Df=pu.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS,Rf=Object.freeze({useCanvasSizedFilterTargets:!1,rebindAttributesOnProgramSwitch:!0,forwardContextAttributes:!0});function Bf(t={}){const e=null==t?void 0:t.performanceToggles;return e&&"object"==typeof e?{...Rf,...e}:{...Rf}}class Lf{constructor(t,e={}){return this.glSource=t,this.config=e,this.performanceToggles=Bf(e),this.isContextLost=!1,this.isRecovering=!1,this.isDisposed=!1,this.pendingNodeOptionUpdates=new Map,this.doInit(t,e)}doInit(t,e){this.source=_u(t),this.performanceToggles=Bf(e),this.isDisposed=!1,this.render=this.render.bind(this),this.resizeCanvasSize=this.resizeCanvasSize.bind(this),this.setSrcVidTracks=this.setSrcVidTracks.bind(this),this.onWebGLContextLost=this.onWebGLContextLost.bind(this),this.onForceRender=this.onForceRender.bind(this),this.resizeCanvasSize._shouldPreventDefault=!0;const n=function(t={},e=Rf){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(),"undefined"!=typeof window&&(window.ekoShaderGraph=this),this.selectedRenderNode=null,this.activeTextures=this.activeTextures||new Set,this.textureManager=new Pu({gl:this.gl,activeTextures:this.activeTextures}),this.capturedFramesManager=new Pf({textureManager:this.textureManager}),this.graphIOManager=new Uu({glSource:t,gl:this.gl,textureManager:this.textureManager,capturedFramesManager:this.capturedFramesManager}),this.frameBufferFactory=new Ku({gl:this.gl,textureManager:this.textureManager,useCanvasSizedFilterTargets:this.performanceToggles.useCanvasSizedFilterTargets}),this.filterFactory=new Jh({gl:this.gl,frameBufferFactory:this.frameBufferFactory,rebindAttributesOnProgramSwitch:this.performanceToggles.rebindAttributesOnProgramSwitch}),this.nodeStore=new Iu,this.ioStore=new Iu,Mf({nodeStore:this.nodeStore,filterFactory:this.filterFactory}),this.addClientNodes(e.nodes,this.isRecovering),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)}}getNodes(){return Cf.debug("[getNodes]"),this.nodeStore.get()}addClientNodes(t,e=!1){if(Cf.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));Ff(n,{nodeStore:this.nodeStore,filterFactory:this.filterFactory})}addTexture(t,e,n){if(Cf.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){Cf.debug("[releaseTexture]",t),this.isContextUnavailable()||this.textureManager.releaseTexture(t)}selectNode(t){if(Cf.debug("[selectNode]",t),!this.isContextUnavailable())return this.nodeStore.get(t)||Cf.warn("Missing render node",t),void(this.selectedRenderNodeId=t);this.selectedRenderNodeId=t}captureTexture(){return Cf.debug("[captureTexture]"),this.isContextUnavailable()?null:this.capturedFramesManager.createCaptureId()}disposeTexture(t){return Cf.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}}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){Cf.error("Failed to apply pending node options",e,t),this.queueNodeOptionUpdate(e,n)}return}this.updateOptions(e,n)}catch(t){Cf.error("Failed to apply pending node options",e,t)}}))}render(t={}){var e,n;const{noRaf:i=!1}=t;if(this.isContextUnavailable())return;if(this.dirtyCanvasSize){let{width:t=this.gl.canvas.width,height:e=this.gl.canvas.height}=this.dirtyCanvasSize;Vu(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}const r=null===(e=this.gl)||void 0===e||null===(e=e.canvas)||void 0===e?void 0:e.width,o=null===(n=this.gl)||void 0===n||null===(n=n.canvas)||void 0===n?void 0:n.height;Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0&&(Vu(r,o),this.gl.viewport(0,0,r,o)),this.graphIOManager.setVideoSources(this.ioStore);let s={ioStore:this.ioStore,graphIOManager:this.graphIOManager};this.renderSelectedNode(s),this.config.onPreRenderToScreen&&this.config.onPreRenderToScreen(),this.renderToCanvas(s),this.config.onPostRenderToScreen&&this.config.onPostRenderToScreen(),this.graphIOManager.disposeAllStore(this.ioStore),s=null,!i&&!this.config.userWillCallRender&&(this.rafId=requestAnimationFrame(this.render))}renderSelectedNode(t){if(!this.selectedRenderNodeId)return;const e=this.nodeStore.get(this.selectedRenderNodeId);e&&"function"==typeof e.render?e.render(t):(Cf.warn("Missing selected render node",this.selectedRenderNodeId),this.selectedRenderNodeId=null)}renderToCanvas(t){const e=this.nodeStore.get(Df);e&&"function"==typeof e.render?e.render(t):Cf.warn("Missing render-to-canvas node")}updateOptions(t,e){if(Cf.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){Cf.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(){Cf.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),Cf.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=>{Cf.debug("Re-adding client nodes",t),this.addClientNodes(t,!0)})),Object.entries(e).forEach((([t,e])=>{Cf.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&&(Cf.debug("Recovering glSource (i.e. seeking/resetting player)"),await this.source.recover()),this.isContextLost=!1,this.isRecovering=!1,o&&this.render()}catch(t){Cf.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 zf{constructor(t={}){this.options=t}get type(){return"stage"}getSignature(){return this.type}build({inputs:t=[]}={}){return{graph:[],outputs:t,signature:this.getSignature()}}}function Wf(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 Uf extends zf{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:Wf(a)}),o.push(l)}return{graph:r,outputs:o,signature:this.getSignature()}}}class jf{#E=new Map;constructor(){this.register("retarget",Uf)}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 $f{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 qf extends $f{#S=null;#N=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=qf.buildLayoutGraph({inputs:t}),r=e.signature;this.#S!==r&&(i.updateOptions(o,{graph:e.graph}),this.#S=r),this.#N!==o&&(i.selectNode(o),this.#N=o),i.render({noRaf:!0})}catch(t){}}}var Vf=new WeakMap,Gf=new WeakMap,Hf=new WeakSet;class Kf extends $f{constructor(...t){super(...t),j(this,Hf),W(this,Vf,null),W(this,Gf,null)}static get type(){return"side-by-side"}static get aliases(){return["SideBySideRenderNode","side-by-side","sidebyside"]}static get requiresFrameCadence(){return!1}static get panAndScanTarget(){return"skip"}static buildLayoutGraph({inputs:t=[]}={}){const e=t.length;if(e<=1)return super.buildDefaultLayoutGraph(t);const n=1/e,i=[],r=t.map(((t,e)=>{const r=(e+.5)*n,o=`slice-${e}`;return i.push({id:`side-by-side-crop-${e}`,type:"crop",inputs:[t],outputs:[o],options:{source:{center:{x:.5,y:.5},width:1,height:1},target:{center:{x:r,y:.5},width:n,height:1},fitType:"fill",cornerRadius:0,edgeSoftness:0}}),o}));let o=r[0];for(let t=1;t<e;t+=1){const e=(t+.5)*n*2-1;i.push({id:`side-by-side-mask-${t}`,type:"shapeCompositeMask",inputs:[r[t],o],outputs:["accum"],options:{type:"box",center:{x:e,y:0},area:{width:n,height:1},radius:0,edgeSoftness:0}}),o="accum"}return{type:Kf.type,signature:`${Kf.type}:${t.length}`,isDynamic:!1,graph:i}}static prepareRenderFrames({frames:t,state:e}={}){const n=Array.isArray(t)?t:[],i=e&&"object"==typeof e?e:{},r=Array.isArray(i.frames)?i.frames:[];if(!n.length&&!r.length)return i.frames=[],i!==e&&e&&"object"==typeof e&&Object.assign(e,i),[];const o=Math.max(n.length,r.length,2),s=Array.from({length:o}),a=n[0]||r[0];for(let t=0;t<o;t+=1)s[t]=n[t]||r[t]||a;return i.frames=s,i!==e&&e&&"object"==typeof e&&Object.assign(e,i),s}static resetRenderState(t){t&&"object"==typeof t&&(t.frames=null)}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.sideBySide;if(o){if(1===n.length){const t=null==r?void 0:r.default;try{B(Hf,this,Xf).call(this,i,t)}catch(t){}return}try{B(Hf,this,Yf).call(this,i,o,n)}catch(t){}}}}function Xf(t,e){if(!e)return;const n=me.buildLayoutGraph({inputs:["__SRC_TEXTURE:0"]}),i=n.signature;z(Vf,this)!==i&&(t.updateOptions(e,{graph:n.graph}),U(Vf,this,i)),z(Gf,this)!==e&&(t.selectNode(e),U(Gf,this,e)),t.render({noRaf:!0})}function Yf(t,e,n){const i=Array.isArray(n)?n.length:0;if(!e||!i||i<2)return;const r=n.map(((t,e)=>t?`__SRC_TEXTURE:${e}`:null)).filter(Boolean),o=me.buildLayoutGraph({inputs:r}),s=o.signature;z(Vf,this)!==s&&(t.updateOptions(e,{graph:o.graph}),U(Vf,this,s)),z(Gf,this)!==e&&(t.selectNode(e),U(Gf,this,e)),t.render({noRaf:!0})}function Qf(t){const e=Number(t);return Number.isFinite(e)?e<=0?0:e>=1?1:e:0}me=Kf;class Jf extends $f{#S=null;#N=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=Qf(e),i=[{type:"opacity",inputs:[t[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",t[0]],options:{}}];return{type:Jf.type,signature:`${Jf.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=Qf((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.#S!==e){const n=Jf.buildLayoutGraph({inputs:["__SRC_TEXTURE:0"]});i.updateOptions(t,{graph:n.graph}),this.#S=e}this.#N!==t&&(i.selectNode(t),this.#N=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=Jf.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.#S===r&&this.#A===a||(i.updateOptions(o,{graph:n.graph}),this.#S=r,this.#A=a),this.#N!==o&&(i.selectNode(o),this.#N=o),i.render({noRaf:!0})}catch(t){}}}function Zf(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 tp(t){return!(!t||!0===t.offsetPending)&&Number.isFinite(t.offset)}function ep(t){return tp(t)?t.offset:void 0}function np(t,e,n,i={}){if(!t)return!1;const r=ep(t);if(!Number.isFinite(r))return!1;const o=Zf(t,n,i);return Number.isFinite(o)?e>=r&&e<r+o:e>=r}function ip(t=[]){if(!Array.isArray(t))return t;const e=[],n=[];return t.forEach((t=>{tp(t)?e.push(t):n.push(t)})),e.sort(((t,e)=>t.offset-e.offset)),t.splice(0,t.length,...e,...n),t}function rp(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=ep(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&&ip(t),{updated:a,resolvedPlacements:l}}function op(t){const e=Number(t);return Number.isFinite(e)?e:0}function sp(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 ap(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 lp(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 cp(t){const e=Number(t);return Number.isFinite(e)&&e>0?e:0}function up(t){return(null==t?void 0:t.id)||(null==t?void 0:t.nodeId)||null}function dp(t,e){return Array.isArray(t)&&e?t.findIndex((t=>up(t)===e)):-1}function hp(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=dp(e,n);return t>=0?(t+1)%i:0}if("prev"===t){const t=dp(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)?up(e[i]):null}function fp(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=ep(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)=>ep(t)-ep(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 pp(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 mp(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 gp(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(pp(n,r,t))return r}return null}function vp(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 yp extends $f{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=Qf(e),i=[{type:"opacity",inputs:[t[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",t[0]],options:{}}];return{type:yp.type,signature:`${yp.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:Qf(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&&(vp(a),a.activeRenderPlacementId=l);const c=null==r?void 0:r.initSwitching,u=fp(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=mp(a.placements,a.selectedPlacementId),i=hp(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=hp(Number.isInteger(t)&&t>=0?t:0,a.nodes,null);let n=null;if(e&&(n=gp(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&&pp(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=gp(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=cp(a.pendingSwitch.crossfadeSeconds),s=cp(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=Qf(t/a.switchDuration))}a.switchNormalizedTime=Number.isFinite(p)?p:void 0;const m=mp(a.placements,a.selectedPlacementId),g=pp(s,a.selectedPlacementId,m)||s[0];let v=null;if(Number.isFinite(a.switchNormalizedTime)&&a.previousPlacementId){const t=mp(a.placements,a.previousPlacementId),e=mp(a.placements,a.selectedPlacementId),n=pp(s,a.previousPlacementId,t),i=pp(s,a.selectedPlacementId,e);n&&i&&(v=[n,i])}return v||(v=g?[g]:s),v}static resetRenderState(t){t&&"object"==typeof t&&vp(t)}}const bp=[qf,Kf,Jf,yp],kp=new Map;function xp(t){if("string"!=typeof t)return null;const e=t.trim();return e?e.toLowerCase():null}function wp(t){const e=xp(t);return e&&kp.get(e)||null}function _p(t){return wp(t)||qf}bp.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=xp(e);n&&kp.set(n,t)}))}(t)));class Tp{static get defaultType(){return qf.type||"default"}static getRenderNodeClass(t){return wp(t)}static normalizeType(t){const e=wp(t);return e?e.type:null}static doesRenderNodeTypeRequireFrameCadence(t){const e=wp(t);return!!e&&!0===e.requiresFrameCadence}static buildLayoutGraph({type:t,inputs:e=[],normalizedTime:n}={}){const i=_p(t);return i&&"function"==typeof i.buildLayoutGraph?i.buildLayoutGraph({inputs:e,normalizedTime:n}):qf.buildLayoutGraph({inputs:e,normalizedTime:n})}static getPanAndScanTarget(t){const e=_p(t);return"post"===(n=null==e?void 0:e.panAndScanTarget)||"skip"===n?n:"pre";var n}static prepareRenderFrames({type:t,frames:e,timelineTime:n,timeline:i,active:r,renderNodeParams:o,state:s}={}){const a=_p(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=_p(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=_p(t);n&&"function"==typeof n.resetRenderState&&n.resetRenderState(e)}static resetAllRenderStates(t){t&&"function"==typeof t.forEach&&t.forEach(((t,e)=>{Tp.resetRenderState(e,t)}))}create(t,e){return t&&"function"==typeof t.render?t:new(_p(t))(e)}}function Ip(t){return Array.isArray(t)?t.filter((t=>t&&"string"==typeof t.type)):[]}function Ep(t,e){return t&&"function"==typeof t.getSignature?t.getSignature():(null==e?void 0:e.type)||"stage"}class Sp{#M;constructor(t){this.#M=t||new jf}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=Tp.normalizeType(null==t?void 0:t.layoutType)||Tp.defaultType,r=null==t?void 0:t.normalizedTime,o=Ip(null==t?void 0:t.preStages),s=Ip(null==t?void 0:t.postStages),a=[],l=[`layout:${i}`,`inputs:${e}`];let c=n;o.forEach(((e,n)=>{const i=this.#M.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(Ep(i,e))}));const u=Tp.buildLayoutGraph({type:i,inputs:c,normalizedTime:r}),d=!(null==u||!u.isDynamic);Array.isArray(null==u?void 0:u.graph)&&u.graph.length&&a.push(...u.graph),l.push((null==u?void 0:u.signature)||`${i}:${c.length}`);let h="__PREVIOUS:0";return s.forEach(((e,n)=>{const i=this.#M.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(Ep(i,e))})),{graph:a,signature:l.join("|"),isDynamic:d}}}const Np=[0,0,1,1],Ap="zoomInExposure",Mp=["transform","exposure","fadeToColor","dipToBlack"],Fp={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 Op(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}function Pp(t,e=Np){return Array.isArray(t)&&t.length>=4?t:e}function Cp(t){return"string"==typeof t&&t.trim()?t.trim():"#ffffff"}function Dp(t,e){const n=null==t?void 0:t[e];return!1===n||null==n?null:Hc(n)?n:{}}function Rp(t={}){let e=0;return Mp.forEach((n=>{const i=Dp(t,n);if(!i)return;const r=Op(null==i?void 0:i.duration);r>e&&(e=r)})),e}function Bp(t,e,n,i,r){const o=[];return Mp.forEach((s=>{const a=Dp(t,s);if(!a)return;const l=function(t,e,n){const i=Op(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=Pp(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=Pp(null==e?void 0:e.ease),n=(null==e?void 0:e.power)||{from:0,to:1};return o.options.properties.power={from:Op(null==n?void 0:n.from,0),to:Op(null==n?void 0:n.to,1),ease:t},o.options.properties.color=Cp((null==e?void 0:e.color)||r),o}if("exposure"===t||"dipToBlack"===t){const t=Pp(null==e?void 0:e.ease),n=(null==e?void 0:e.power)||{from:0,to:1};return o.options.properties.power={from:Op(null==n?void 0:n.from,0),to:Op(null==n?void 0:n.to,1),ease:t},o}return null}(s,a,e,l,r);c&&o.push(c)})),o}function Lp(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 zp{#F=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(Hc(null==t?void 0:t.transition))return t.transition;if("string"==typeof(null==t?void 0:t.transition))return Fp[t.transition]||Fp[Ap];if(Hc(null==t?void 0:t.filters)||Hc(null==t?void 0:t.reverseFilters))return{filters:t.filters||{},reverseFilters:t.reverseFilters||{}};if("string"==typeof(null==t?void 0:t.filter)){const e=Op(t.duration)>0?1e3*t.duration:500;return{filters:{[t.filter]:{duration:e,power:{from:0,to:1}}},reverseFilters:{}}}return Fp[Ap]}(t),n=Kc({},(null==e?void 0:e.filters)||{},Hc(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(Hc(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=Kc({},(null==e?void 0:e.reverseFilters)||{},Hc(null==t?void 0:t.reverseFilters)?t.reverseFilters:{});return{baseFilters:n,reverseFilters:Kc({},i,r)}}(t),r=Op(null==t?void 0:t.duration),o=r>0?1e3*r:null,s=Rp(n),a=Rp(i),l=o&&s>0?o/s:1,c=o&&a>0?o/a:1,u=o||s||500,d=o||a||u,h=Cp(null==t?void 0:t.color),f=e.captureTexture(),p=Date.now(),m=Bp(n,p,l,o,h);return this.#F={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:Lp(m),inGraph:null,inSignature:null},{captureId:f,outDurationMs:u,inDurationMs:d}}beginIncoming(){if(!this.#F)return;const t=Date.now(),e=Bp(this.#F.reverseFilters,t,this.#F.inScale,this.#F.durationOverrideMs,this.#F.color);this.#F={...this.#F,phase:"in",startTime:t,inGraph:e,inSignature:Lp(e)}}reset(t){var e;t&&"function"==typeof t.disposeTexture&&null!==(e=this.#F)&&void 0!==e&&e.captureId&&t.disposeTexture(this.#F.captureId),this.#F=null}getState(){return this.#F}buildOutgoingGraph(){const t=this.#F;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.#F;return t&&"in"===t.phase&&Array.isArray(t.inGraph)&&t.inGraph.length?{signature:`transition:in:${t.inSignature||""}`,forceUpdate:!1,graph:t.inGraph}:null}}let Wp;const Up=[/firefox\/(\d+)/,/edg\/(\d+)/,/opr\/(\d+)/,/chrome\/(\d+)/];function jp(){const t=eu&&eu.navigator&&(eu.navigator.userAgent||eu.navigator.platform||eu.navigator.vendor)||"";if(Wp&&Wp.ua===t)return Wp;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<Up.length;e+=1){const n=Up[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 Wp={ua:t,lowerUA:e,isAndroid:n,isiOS:i,isMobile:r,isDesktop:o,isFirefox:s,browserMajorVersion:a},Wp}function $p(){return jp().ua}function qp(){return jp().isAndroid}function Vp(){return jp().isiOS}function Gp(){return jp().isMobile}function Hp(){return jp().isDesktop}function Kp(){return jp().isFirefox}function Xp(){return jp().browserMajorVersion}var Yp={getUserAgent:$p,isAndroid:qp,isiOS:Vp,isMobile:Gp,isDesktop:Hp,isFirefox:Kp,getBrowserMajorVersion:Xp},Qp=Object.freeze({__proto__:null,default:Yp,getBrowserMajorVersion:Xp,getUserAgent:$p,isAndroid:qp,isDesktop:Hp,isFirefox:Kp,isMobile:Gp,isiOS:Vp});const Jp=Object.freeze({NODE_ADD:"node:add",NODE_CHILDREN_CHANGED:"node:childrenchanged",NODE_LOADED:"node:loaded",NODE_LOAD_ERROR:"node:loaderror",PLACEMENT_ADDED:"placement:added",RENDER_PLACEMENT_ADDED:"renderplacement:added",TIMELINE_TIME_UPDATE:"timeline:timeupdate",TIMELINE_STATE_CHANGE:"statechange",TIMELINE_SEEKING:"seeking",TIMELINE_SEEKED:"seeked",TIMELINE_RESET:"timeline:reset",TIMELINE_PLAYER_STATE:"player:state",TIMELINE_CUEPOINT:"cuepoint",VISUAL_FRAMES_AVAILABLE:"visualframesavailable",TRACK_BUFFER_UPDATE:"track:bufferupdate",TRACK_READY:"track:ready",TRACK_UNDERFLOW:"track:underflow",CLOCK_TICK:"tick",DECODE_READY:"decode:ready",DECODE_ERROR:"decode:error",DECODER_AUDIO:"decoder:audio",DECODER_FRAME:"decoder:frame",DECODER_INIT:"decoder:init",DECODER_ERROR:"decoder:error",QOE_SCORE:"qoescore",QOE_STATUS:"qoestatus",CONTAINER_RESIZE:"containerresize"});function Zp(t,e){const n={};return Number.isFinite(t)&&(n.time=t),"string"==typeof e&&(n.source=e),n}function tm({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 em({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}const nm="Idle",im="Playing",rm="Waiting",om="Paused",sm="Seeking",am="Resetting";function lm(t){return Array.isArray(t)?t.filter((t=>t&&"string"==typeof t.type)):[]}function cm(t,e){return!!Array.isArray(t)&&t.some((t=>(null==t?void 0:t.type)===e))}function um(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 dm(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 hm=2073600;function fm(t,e){const n=Number(t);return Number.isFinite(n)&&n>0?n:e}function pm(t,e){if(null==t)return e;const n=Number(t);return Number.isFinite(n)?n:e}var mm=new WeakMap,gm=new WeakMap,vm=new WeakMap,ym=new WeakMap,bm=new WeakMap,km=new WeakMap,xm=new WeakMap,wm=new WeakMap,_m=new WeakMap,Tm=new WeakMap,Im=new WeakMap,Em=new WeakMap,Sm=new WeakMap,Nm=new WeakMap,Am=new WeakMap,Mm=new WeakMap,Fm=new WeakMap,Om=new WeakMap,Pm=new WeakMap,Cm=new WeakMap,Dm=new WeakMap,Rm=new WeakMap,Bm=new WeakMap,Lm=new WeakMap,zm=new WeakMap,Wm=new WeakSet;class Um extends Jc{static get pipelineNodeId(){return"ekoplayer-render-pipeline"}get defaults(){return{defaultRenderParams:void 0,resourceLimits:{enabled:!0,maxCanvasPixels:hm,maxDevicePixelRatio:1,renderScale:1,transitionMinFrameIntervalMs:33}}}constructor(...t){super(...t),j(this,Wm),W(this,mm,void 0),W(this,gm,void 0),W(this,vm,void 0),W(this,ym,void 0),W(this,bm,void 0),W(this,km,void 0),W(this,xm,void 0),W(this,wm,void 0),W(this,_m,void 0),W(this,Tm,null),W(this,Im,null),W(this,Em,void 0),W(this,Sm,void 0),W(this,Nm,void 0),W(this,Am,[]),W(this,Mm,[]),W(this,Fm,null),W(this,Om,null),W(this,Pm,null),W(this,Cm,null),W(this,Dm,null),W(this,Rm,null),W(this,Bm,new Map),W(this,Lm,null),W(this,zm,null);const[e,n,i]=t;U(mm,this,e),U(gm,this,n),U(vm,this,i),U(_m,this,new Sp),U(Em,this,new zp),U(Sm,this,null),U(Nm,this,null),U(Pm,this,null),U(ym,this,(t=>B(Wm,this,mg).call(this,t))),z(mm,this)&&"function"==typeof z(mm,this).on&&(z(mm,this).on(Jp.VISUAL_FRAMES_AVAILABLE,z(ym,this)),U(bm,this,(()=>{var t,e,n,i;B(Wm,this,ug).call(this,0),U(Mm,this,[]),U(Fm,this,null),U(Tm,this,null),U(Im,this,null),B(Wm,this,tg).call(this),U(Lm,this,null);(null===(t=z(Em,this))||void 0===t||null===(e=t.getState)||void 0===e?void 0:e.call(t))||null===(n=z(Em,this))||void 0===n||null===(i=n.reset)||void 0===i||i.call(n,z(Sm,this))})),z(mm,this).on(Jp.TIMELINE_SEEKING,z(bm,this)),U(wm,this,(()=>B(Wm,this,rg).call(this))),z(mm,this).on(Jp.TIMELINE_TIME_UPDATE,z(wm,this)),U(km,this,(()=>{B(Wm,this,gg).call(this)&&z(Om,this)&&B(Wm,this,mg).call(this,z(Om,this))})),z(mm,this).on(Jp.TIMELINE_STATE_CHANGE,z(km,this))),U(xm,this,(()=>{U(Fm,this,null),z(Om,this)&&B(Wm,this,gg).call(this)&&B(Wm,this,mg).call(this,z(Om,this))})),z(vm,this)&&"function"==typeof z(vm,this).on&&z(vm,this).on(Jp.CONTAINER_RESIZE,z(xm,this))}get name(){return"Renderer"}onDispose(){z(mm,this)&&z(ym,this)&&"function"==typeof z(mm,this).off&&z(mm,this).off(Jp.VISUAL_FRAMES_AVAILABLE,z(ym,this)),z(mm,this)&&z(bm,this)&&"function"==typeof z(mm,this).off&&z(mm,this).off(Jp.TIMELINE_SEEKING,z(bm,this)),z(mm,this)&&z(wm,this)&&"function"==typeof z(mm,this).off&&z(mm,this).off(Jp.TIMELINE_TIME_UPDATE,z(wm,this)),z(mm,this)&&z(km,this)&&"function"==typeof z(mm,this).off&&z(mm,this).off(Jp.TIMELINE_STATE_CHANGE,z(km,this)),z(vm,this)&&z(xm,this)&&"function"==typeof z(vm,this).off&&z(vm,this).off(Jp.CONTAINER_RESIZE,z(xm,this)),B(Wm,this,jm).call(this),U(ym,this,null),U(bm,this,null),U(wm,this,null),U(km,this,null),U(xm,this,null),U(_m,this,null),U(Em,this,null),U(Bm,this,null),U(Lm,this,null),U(gm,this,null),U(vm,this,null),U(mm,this,null)}startTransition(t={}){var e;const n=null===(e=z(gm,this))||void 0===e?void 0:e.element;if(!n)return null;if(B(Wm,this,$m).call(this,n),!z(Sm,this))return null;const i=z(Em,this).start({shaderGraph:z(Sm,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 U(Pm,this,z(Om,this)||null),B(Wm,this,hg).call(this),i}beginTransitionIn(t={}){var e,n;null!==(e=z(Em,this))&&void 0!==e&&null!==(n=e.beginIncoming)&&void 0!==n&&n.call(e,t),U(Pm,this,null),B(Wm,this,hg).call(this)}resetTransition(){var t,e;null!==(t=z(Em,this))&&void 0!==t&&null!==(e=t.reset)&&void 0!==e&&e.call(t,z(Sm,this)),U(Pm,this,null),B(Wm,this,fg).call(this)}}function jm(){if(z(Em,this)&&"function"==typeof z(Em,this).reset&&z(Em,this).reset(z(Sm,this)),B(Wm,this,ug).call(this,0),z(Sm,this)&&"function"==typeof z(Sm,this).dispose)try{z(Sm,this).dispose()}catch(t){}U(Sm,this,null),U(Nm,this,null),U(Am,this,[]),U(Mm,this,[]),U(Fm,this,null),U(Tm,this,null),U(Im,this,null),U(Om,this,null),U(Pm,this,null),B(Wm,this,fg).call(this),B(Wm,this,tg).call(this),U(Lm,this,null)}function $m(t){if(z(Sm,this)||!t)return;const e=this,n={dest:t,src:(t,n)=>{U(Nm,e,n)}};U(Sm,e,new Lf(n,{userWillCallRender:!0,glOptions:{contextType:"webgl2"},performanceToggles:{useCanvasSizedFilterTargets:!0}})),z(Sm,e)&&"function"==typeof z(Sm,e).addNodes&&z(Sm,e).addNodes({[ge.pipelineNodeId]:{type:"composite",options:{graph:[]}}})}function qm(){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 Vm(){const t=B(Wm,this,qm).call(this).enabled;return!0===t||!1!==t&&Vp()}function Gm(){if(!B(Wm,this,Vm).call(this))return 0;const t=pm(B(Wm,this,qm).call(this).transitionMinFrameIntervalMs,33);return Number.isFinite(t)&&t>0?t:0}function Hm(t,e){if(!B(Wm,this,Vm).call(this))return{width:t,height:e};const n=B(Wm,this,qm).call(this),i=pm(n.maxCanvasPixels,hm),r=pm(n.maxDevicePixelRatio,1),o=fm(n.renderScale,1),s=fm(null==eu?void 0:eu.devicePixelRatio,1),a=o*(r>0?Math.min(s,r):s);let l=Math.max(1,Math.round(t*a)),c=Math.max(1,Math.round(e*a));if(i>0){const t=l*c;if(t>i){const e=Math.sqrt(i/t);l=Math.max(1,Math.floor(l*e)),c=Math.max(1,Math.floor(c*e))}}return{width:l,height:c}}function Km(t=[],e={}){var n;const i=null===(n=z(gm,this))||void 0===n?void 0:n.element,r=z(Nm,this);if(!i||"function"!=typeof r)return!1;let o=0,s=0;if(!0===(null==e?void 0:e.useViewportSize)){var a,l,c,u,d,h;const t=Number(null!==(a=null===(l=z(vm,this))||void 0===l?void 0:l.containerWidth)&&void 0!==a?a:null===(c=z(vm,this))||void 0===c?void 0:c.width),e=Number(null!==(u=null===(d=z(vm,this))||void 0===d?void 0:d.containerHeight)&&void 0!==u?u:null===(h=z(vm,this))||void 0===h?void 0:h.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 f;const n=null===(f=t[e])||void 0===f?void 0:f.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 p=B(Wm,this,Hm).call(this,o,s),m=p.width,g=p.height,v=z(Fm,this);return!(v&&v.width===m&&v.height===g||(U(Fm,this,{width:m,height:g}),r(null,null,m,g),0))}function Xm(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 Ym(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=B(Wm,this,Qm).call(this,t),s=B(Wm,this,Jm).call(this,o);return Tp.getRenderTiming({type:o,timing:{duration:i,normalizedTime:r},timelineTime:e,active:t,renderNodeParams:n,state:s})}function Qm(t){return Tp.normalizeType(null==t?void 0:t.type)||Tp.defaultType}function Jm(t){if(!t||!z(Bm,this))return null;let e=z(Bm,this).get(t);return e||(e={},z(Bm,this).set(t,e)),e}function Zm(t){if(!t||!z(Bm,this))return;const e=z(Bm,this).get(t);e&&Tp.resetRenderState(t,e),z(Bm,this).delete(t)}function tg(){z(Bm,this)&&(Tp.resetAllRenderStates(z(Bm,this)),z(Bm,this).clear())}function eg(t,e,n,i){const r=B(Wm,this,Qm).call(this,t);z(Lm,this)&&z(Lm,this)!==r&&B(Wm,this,Zm).call(this,z(Lm,this)),U(Lm,this,r);const o=B(Wm,this,Jm).call(this,r);return Tp.prepareRenderFrames({type:r,frames:e,timelineTime:n,timeline:z(mm,this),active:t,renderNodeParams:i,state:o})}function ng(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 ig(t){return t?String(t.renderPlacementId||t.type||"unknown"):"default"}function rg(){if(!z(mm,this)||!z(Om,this))return;const t=z(mm,this).currentTime,e=z(mm,this).getActiveRenderPlacement(t),n=B(Wm,this,ig).call(this,e);n!==z(zm,this)&&(U(zm,this,n),B(Wm,this,mg).call(this,{...z(Om,this),time:t}))}function og(t){return!t||"object"!=typeof t||!Object.prototype.hasOwnProperty.call(t,"panAndScan")||!1!==t.panAndScan}function sg(t,e){const n=B(Wm,this,ng).call(this,t),i=null==n?void 0:n.stages;let r=lm(null==i?void 0:i.pre),o=lm(null==i?void 0:i.post);const s=B(Wm,this,og).call(this,n),a=B(Wm,this,Qm).call(this,t),l=cm(r,"retarget")||cm(o,"retarget");if(s&&!l){const t=Tp.getPanAndScanTarget(a);if("pre"===t){const t=um(Array.isArray(e)?e.length:0);t&&(r=[t,...r])}else if("post"===t){const t=um(1);t&&(o=[...o,t])}}else s||(r=dm(r),o=dm(o));return{preStages:r,postStages:o,renderNodeParams:n}}function ag(t,e,n,i,r){const o=r||B(Wm,this,Ym).call(this,t,n,i),s=B(Wm,this,sg).call(this,t,e);return z(_m,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,timelineTime:n})}function lg(){var t,e;const n=null===(t=z(Em,this))||void 0===t||null===(e=t.getState)||void 0===e?void 0:e.call(t);return"out"===(null==n?void 0:n.phase)?z(Em,this).buildOutgoingGraph():"in"===(null==n?void 0:n.phase)?z(Em,this).buildIncomingGraph():null}function cg(t,e,n,i){const r=n||e!==z(Tm,this),o=r||i;r&&z(Sm,this)&&"function"==typeof z(Sm,this).updateOptions&&(z(Sm,this).updateOptions(ge.pipelineNodeId,{graph:t}),U(Tm,this,e)),z(Sm,this)&&"function"==typeof z(Sm,this).selectNode&&z(Im,this)!==ge.pipelineNodeId&&(z(Sm,this).selectNode(ge.pipelineNodeId),U(Im,this,ge.pipelineNodeId)),o&&z(Sm,this)&&"function"==typeof z(Sm,this).render&&z(Sm,this).render({noRaf:!0})}function ug(t){if(!Array.isArray(z(Am,this))||!z(Am,this).length)return;const e=Number.isFinite(t)?Math.max(0,t):0;if(!(z(Am,this).length<=e)){for(let t=e;t<z(Am,this).length;t+=1){const e=z(Am,this)[t];if(e&&z(Sm,this)&&"function"==typeof z(Sm,this).releaseTexture)try{z(Sm,this).releaseTexture(e)}catch(t){}}z(Am,this).length=e,z(Mm,this).length=e}}function dg(t=[]){if(!z(Sm,this)||"function"!=typeof z(Sm,this).addTexture)return!1;if("function"==typeof z(Sm,this).isContextUnavailable&&z(Sm,this).isContextUnavailable())return!1;if(!Array.isArray(t)||!t.length)return B(Wm,this,ug).call(this,0),!1;B(Wm,this,ug).call(this,t.length);let e=!1;for(let i=0;i<t.length;i+=1){var n;z(Am,this)[i]||"function"!=typeof z(Sm,this).addTexture||(z(Am,this)[i]=z(Sm,this).addTexture(null,"frame",i));const r=B(Wm,this,Xm).call(this,t[i]),o=null===(n=t[i])||void 0===n?void 0:n.frame;if(z(Am,this)[i]&&o&&(!r||r!==z(Mm,this)[i]))try{z(Am,this)[i].fill(o),z(Mm,this)[i]=r,e=!0}catch(t){}}return e}function hg(){if(z(Cm,this))return;const t="function"==typeof eu.requestAnimationFrame?t=>eu.requestAnimationFrame(t):t=>setTimeout(t,16),e="function"==typeof eu.cancelAnimationFrame?t=>eu.cancelAnimationFrame(t):clearTimeout;U(Dm,this,e);const n=()=>{var e,i;if(null!==(e=z(Em,this))&&void 0!==e&&null!==(i=e.getState)&&void 0!==i&&i.call(e)){if(z(Om,this)){const t=B(Wm,this,Gm).call(this),e=Date.now();(!t||!z(Rm,this)||e-z(Rm,this)>=t)&&(U(Rm,this,e),B(Wm,this,mg).call(this,z(Om,this)))}U(Cm,this,t(n))}else U(Cm,this,null)};U(Cm,this,t(n))}function fg(){z(Cm,this)&&z(Dm,this)&&z(Dm,this).call(this,z(Cm,this)),U(Cm,this,null),U(Dm,this,null),U(Rm,this,null)}function pg(t){var e,n;const i=null===(e=z(Em,this))||void 0===e||null===(n=e.getState)||void 0===n?void 0:n.call(e);return"out"===(null==i?void 0:i.phase)&&z(Pm,this)?z(Pm,this):t}function mg(t={}){var e,n;const i=null===(e=z(gm,this))||void 0===e?void 0:e.element,r=null===(n=z(gm,this))||void 0===n?void 0:n.gl;if(!i||!r)return;if(t&&U(Om,this,t),!B(Wm,this,gg).call(this))return;const o=B(Wm,this,pg).call(this,t),s=Number.isFinite(null==o?void 0:o.time)?o.time:void 0;if(!Number.isFinite(s))return;if(B(Wm,this,$m).call(this,i),!z(Sm,this))return;const a=z(mm,this)&&"function"==typeof z(mm,this).getActiveRenderPlacement?z(mm,this).getActiveRenderPlacement(s):void 0,l=B(Wm,this,ig).call(this,a);l!==z(zm,this)&&U(zm,this,l);const c=Array.isArray(null==o?void 0:o.frames)?o.frames:[],u=B(Wm,this,ng).call(this,a),d=B(Wm,this,og).call(this,u),h=B(Wm,this,eg).call(this,a,c,s,u),f=B(Wm,this,Ym).call(this,a,s,u),p=B(Wm,this,Km).call(this,h,{useViewportSize:d}),m=B(Wm,this,dg).call(this,h),g=B(Wm,this,ag).call(this,a,h,s,u,f),v=B(Wm,this,lg).call(this);let y=g.graph,b=g.signature,k=!!g.isDynamic;v&&Array.isArray(v.graph)&&v.graph.length&&(y=y.concat(v.graph),b=`${b}|${v.signature||"transition"}`,k=k||!!v.forceUpdate);const x=p||m||k||v&&Array.isArray(v.graph)&&v.graph.length;B(Wm,this,cg).call(this,y,b,k,x)}function gg(){var t;const e=null===(t=z(mm,this))||void 0===t?void 0:t.state;return e===nm||e===im||e===om}function vg(t){return"number"==typeof t&&Number.isFinite(t)&&t>0}function yg(t){return t&&"resource"===t.entryType&&t.transferSize>0&&t.duration>0&&t.responseEnd>=t.requestStart}function bg(t){return Array.isArray(t)&&0!==t.length?t.reduce(((t,e)=>t+e),0)/t.length:NaN}ge=Um;var kg=new WeakMap,xg=new WeakMap,wg=new WeakMap,_g=new WeakMap,Tg=new WeakSet;class Ig extends Jc{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),j(this,Tg),W(this,kg,void 0),W(this,xg,void 0),W(this,wg,void 0),W(this,_g,void 0),U(kg,this,!!(eu&&eu.navigator&&eu.navigator.connection)),U(xg,this,!(!eu||!eu.performance||"function"!=typeof eu.performance.getEntriesByType)),U(wg,this,B(Tg,this,Sg).call(this)),U(_g,this,B(Tg,this,Og).call(this))}guesstimate(){const t=B(Tg,this,Cg).call(this);this.log.debug("[guesstimate] Data:",t);const e=B(Tg,this,Pg).call(this,t),n=vg(e)?e:t.defaultKbps;return B(Tg,this,Ng).call(this,n),this.log.info(`[guesstimate] Result: ${n} kbps`),n}update(t){vg(t)&&B(Tg,this,Ng).call(this,t)}onDispose(){U(wg,this,void 0),U(_g,this,void 0)}}function Eg(){return Math.round(Date.now()/1e3)}function Sg(){try{if(!eu||!eu.localStorage||"function"!=typeof eu.localStorage.getItem)return}catch(t){return}const t=this.settings.persistentStorage.key,e=eu.localStorage.getItem(t);if(e)try{const t=JSON.parse(e),n=this.settings.persistentStorage.ttl,i=B(Tg,this,Eg).call(this)-t.timestamp;if("number"==typeof n&&n>=0&&i>n)return null;if(!vg(t.value))return;return t.value}catch(t){return}}function Ng(t){if(!vg(t))return;try{if(!eu||!eu.localStorage||"function"!=typeof eu.localStorage.setItem)return}catch(t){return}const e=this.settings.persistentStorage.key,n=JSON.stringify({value:t,timestamp:B(Tg,this,Eg).call(this)});try{eu.localStorage.setItem(e,n),U(wg,this,t)}catch(t){}}function Ag(){return eu&&eu.performance&&"function"==typeof eu.performance.getEntriesByType?bg(eu.performance.getEntriesByType("resource").filter(yg).map((t=>8*t.transferSize/t.duration))):NaN}function Mg(){if(!eu||!eu.navigator||!eu.navigator.connection)return NaN;const t=eu.navigator.connection.downlink;return vg(t)?1e3*t:NaN}function Fg(){if(!z(kg,this))return NaN;const t=eu.navigator.connection,e=t.effectiveType||t.type,n=this.settings.connectionType||{};return e&&Object.prototype.hasOwnProperty.call(n,e)?n[e]:NaN}function Og(){const t=this.settings.ua||{};return qp()?t.android:Vp()?t.ios:t.desktop}function Pg(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=>vg(t)));if(r.length===i.length)return this.log.debug("[#selectFromPriorities] Selected from priorities:",i,"with values:",r),bg(r)}return NaN}function Cg(){const t=this.settings.testOverrides||{},e=vg(t.resourceTiming)?t.resourceTiming:B(Tg,this,Ag).call(this),n=vg(t.downlink)?t.downlink:B(Tg,this,Mg).call(this),i=vg(t.persistentValue)?t.persistentValue:z(wg,this),r=vg(t.connectionType)?t.connectionType:B(Tg,this,Fg).call(this),o=vg(t.ua)?t.ua:z(_g,this);return{defaultKbps:this.settings.defaultKbps,resourceTiming:e,downlink:n,connectionType:r,persistentValue:i,ua:o}}const Dg=new Gc;function Rg(t){return"string"!=typeof t||0===t.length?[]:t.split(".").filter((t=>t.length>0))}function Bg(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 Lg(t){return null!==t&&"object"==typeof t}function zg(t,e,n){const i=Rg(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 Wg(t,e,n){if(!Lg(t))return t;const i=Rg(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}Lg(r[e])||(r[e]=Bg(i[t+1])?[]:{}),r=r[e]}return t}const Ug={get:(t,e)=>eu&&eu.eko?zg(eu.eko,t,e):e,set(t,e){if(eu)return eu.eko&&"object"==typeof eu.eko||(eu.eko={}),Wg(eu.eko,t,e),eu.eko}},jg=eu&&eu.performance,$g=jg&&"function"==typeof jg.now?()=>jg.now():()=>Date.now();function qg(){return"undefined"==typeof AbortController?null:new AbortController}function Vg(){const t=new Error("The operation was aborted");return t.name="AbortError",t.code="ABORT_ERR",t}function Gg(t,e){return!(!e||!e.aborted)||!!t&&("AbortError"===t.name||"ABORT_ERR"===t.code||20===t.code)}const Hg=2,Kg=100,Xg=2,Yg="runtime.downloadSpeedSamples",Qg=Vc("download","warn");function Jg(t){return new Promise((e=>{setTimeout(e,t)}))}function Zg(t){return t>=500}function tv(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 ev(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=Ug.get(r);t||(t=[],Ug.set(r,t)),t.push(s)}catch(t){}return s}async function nv(t,e={}){const{method:n="GET",headers:i,body:r,retries:o=Hg,retryDelay:s=Kg,backoffFactor:a=Xg,samplesTargetPath:l=Yg,fetch:c,loglevel:u="warn",cache:d,signal:h,onProgress:f,returnType:p="default"}=e;Qg.setLevel(u);const m=function(t){if(t)return t;if(eu&&"function"==typeof eu.fetch)return eu.fetch.bind(eu);throw new Error("fetch is not available in this environment")}(c);let g=0,v=s;for(;;){if(h&&h.aborted)throw Vg();const e=$g();try{const s=await m(t,{method:n,headers:i,body:r,cache:d,mode:"cors",signal:h});if(h&&h.aborted)throw Vg();if(!s.ok){if(g<o&&Zg(s.status)){g+=1,Qg.warn(`[${t}] Download attempt #${g} failed with status ${s.status}, retrying in ${v}ms...`),await Jg(v),v*=a;continue}Qg.error(`[${t}] Download attempt #${g} 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=$g();const u=tv(s),y="arrayBuffer"===p||"bytes"===p,b=y&&"function"==typeof f;let k,x,w,_,T,I=0;if(y&&s.body&&"function"==typeof s.body.getReader&&b){const t=s.body.getReader(),e=[];for(;;){if(h&&h.aborted)throw Vg();const{done:n,value:i}=await t.read();if(n)break;if(i&&i.length){const t=$g();Number.isFinite(_)||(_=t),T=t,e.push(i),I+=i.length,f({loaded:I,total:u||void 0,chunk:i})}}k=new Uint8Array(I);let n=0;e.forEach((t=>{k.set(t,n),n+=t.length})),c=$g()}else if(y){const t=await s.arrayBuffer();k=new Uint8Array(t),I=k.length,c=$g()}else"text"===p?(x=await s.text(),c=$g()):"json"===p&&(w=await s.json(),c=$g());if(h&&h.aborted)throw Vg();const E=y?k?k.length:I:("text"===p&&"string"==typeof x?x.length:0)||("json"===p&&w?JSON.stringify(w).length:0),S=u||E||0;let N=e,A=c;Number.isFinite(_)&&(N=_,Number.isFinite(T)&&(A=Math.max(T,c))),(!Number.isFinite(N)||!Number.isFinite(A)||A<N)&&(N=e,A=c);const M=Math.max(0,A-N),F=ev(S,M,N,A,l,t);try{Dg.trigger("download:sample",F)}catch(t){}const O={response:s,bytes:S,durationMs:M,kbps:F.kbps,startTime:F.startTime,endTime:F.endTime};if("default"===p)return O;if("arrayBuffer"===p||"bytes"===p){const t=k||new Uint8Array(await s.arrayBuffer());return"arrayBuffer"===p?t.buffer:t}return"text"===p?x:"json"===p?w:O}catch(e){if(Gg(e,h))throw"AbortError"===e.name?e:Vg();if(!(g<o)||e.status&&!Zg(e.status))throw Qg.error(`[${t}] Download attempt #${g} failed with error ${e}, no more retries.`),e;g+=1,Qg.warn(`[${t}] Download attempt #${g} failed with error ${e}, retrying in ${v}ms...`),await Jg(v),v*=a}}}const iv={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"]}},rv=Object.freeze(Object.entries(iv).reduce(((t,[e,n])=>(Object.prototype.hasOwnProperty.call(n,"default")&&(t[e]=n.default),t)),{})),ov=Vc("config","warn");function sv(t){return rv[t]}var av=new WeakMap,lv=new WeakMap,cv=new WeakMap,uv=new WeakMap,dv=new WeakMap,hv=new WeakSet;class fv extends Jc{get name(){return"DownloadSpeed"}get defaults(){return{alpha:.3,maxSamples:30,minBytesPerSample:1024,minDurationMs:5,maxSampleKbpsCap:void 0,ignoreCacheHits:!0,samplesPath:"runtime.downloadSpeedSamples",initialKbps:sv("initialKbps"),probeUrl:void 0,defaultKbps:2500}}constructor(...t){super(...t),j(this,hv),W(this,av,void 0),W(this,lv,void 0),W(this,cv,void 0),W(this,uv,void 0),W(this,dv,void 0),U(cv,this,[]),U(lv,this,0),U(av,this,B(hv,this,gv).call(this)),U(dv,this,qg()),U(uv,this,(t=>{B(hv,this,wv).call(this,t,"event")})),B(hv,this,vv).call(this),Dg.on("download:sample",z(uv,this)),B(hv,this,yv).call(this),this.log.debug(`[#constructor] Initial estimate: ${z(av,this)} kbps`)}getKbps(){return z(av,this)}addSample(t){B(hv,this,wv).call(this,t,"manual")}reset(){U(cv,this,[]),U(lv,this,0),U(av,this,B(hv,this,gv).call(this))}onDispose(){z(dv,this)&&z(dv,this).abort(),U(dv,this,null),Dg.off("download:sample",z(uv,this)),U(cv,this,[]),U(lv,this,0),U(av,this,void 0),U(uv,this,null)}}function pv(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 mv(t){if(!t||"object"!=typeof t)return null;const e=Number(t.bytes),n=Number(t.durationMs);let i=vg(t.kbps)?Number(t.kbps):NaN;return!vg(i)&&n>0&&vg(e)&&(i=8*e/n),vg(i)?e<=this.settings.minBytesPerSample||n<=this.settings.minDurationMs||B(hv,this,pv).call(this,t,e)?null:(vg(this.settings.maxSampleKbpsCap)&&i>this.settings.maxSampleKbpsCap&&(i=this.settings.maxSampleKbpsCap),{...t,bytes:e,durationMs:n,kbps:i}):null}function gv(){const t=this.settings.initialKbps;if(vg(t))return t;if("auto"===t)try{const t=(new Ig).guesstimate();if(vg(t))return t}catch(t){}return this.settings.defaultKbps}function vv(){const t=Ug.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)B(hv,this,wv).call(this,e[t],"replay",{emit:!1})}async function yv(){if(!this.settings.probeUrl||z(lv,this)>0)return;const t=z(dv,this)?z(dv,this).signal:void 0;if(!t||!t.aborted)try{await nv(this.settings.probeUrl,{cache:"no-store",samplesTargetPath:this.settings.samplesPath,signal:t})}catch(t){}}function bv(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 kv(t,e){if(!B(hv,this,bv).call(this,t)||!B(hv,this,bv).call(this,e))return 0;const n=Math.max(t.startTime,e.startTime);return Math.min(t.endTime,e.endTime)-n}function xv(t){if(!B(hv,this,bv).call(this,t))return t;const e=[];for(let n=0;n<z(cv,this).length;n+=1){const i=z(cv,this)[n];B(hv,this,bv).call(this,i)&&(B(hv,this,kv).call(this,t,i)>0&&e.push(i))}if(0===e.length)return t;U(cv,this,z(cv,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(!vg(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 B(hv,this,mv).call(this,a)}function wv(t,e,{emit:n=!0}={}){const i=B(hv,this,mv).call(this,t);if(!i)return;const r=B(hv,this,xv).call(this,i);if(!r)return;U(lv,this,z(lv,this)+1),z(cv,this).push(r),z(cv,this).length>this.settings.maxSamples&&z(cv,this).shift();const o=this.defaults.alpha,s="number"==typeof this.settings.alpha?this.settings.alpha:o,a=vg(z(av,this)),l=a?z(av,this):r.kbps,c=a||1!==z(lv,this)?s*r.kbps+(1-s)*l:r.kbps;U(av,this,c),this.log.debug(`[#ingestSample] Next estimate: ${c} kbps`),n&&this.trigger("download:speed",{kbps:z(av,this),sample:r,source:e,samplesCount:z(lv,this)})}class _v{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),vg(s)&&(this.bandwidth=s),vg(a)&&(this.timescale=a),vg(l)&&(this.sizeBytes=l),Object.assign(this,c)}}class Tv{#O=new Map;#P;#C;#D=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 _v?t:new _v(t))),this.representations=this.originalRepresentations.map((t=>t)),this.appliedFilters=[],this.loadAttempts=0,this.loadError=void 0}setRepresentationBuffer(t,e){t&&e&&this.#O.set(t,e)}setDownloadProgress(t,e){const n=Number(t);Number.isFinite(n)&&n>=0&&(this.#D=Math.max(this.#D,n));const i=Number(e);Number.isFinite(i)&&i>0&&(this.#R=i)}setChosenRepresentation(t){this.#P=t;const e=null==t?void 0:t.id;if(!(this.isInit||!e||this.#O.size<=1))for(const t of this.#O.keys())t!==e&&this.#O.delete(t)}setABRDecisionSnapshot(t){if(!t||"object"!=typeof t)return void(this.#C=void 0);const e={...t};Array.isArray(t.availableRepresentations)&&(e.availableRepresentations=t.availableRepresentations.map((t=>({...t})))),this.#C=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.#O.get(t)}get chosenRepresentation(){return this.#P}get abrDecision(){return this.#C}get arrayBuffer(){return this.#P?this.#O.get(this.#P.id):void 0}get retainedByteLength(){let t=0;for(const e of this.#O.values())e&&"number"==typeof e.byteLength&&(t+=e.byteLength);return t}get bufferedRatio(){var t;const e=vg(this.#R)?this.#R:null===(t=this.#P)||void 0===t?void 0:t.sizeBytes;return vg(e)?Math.min(1,Math.max(0,this.#D/e)):this.retainedByteLength>0?1:0}get isLoaded(){return this.retainedByteLength>0}evict(){this.#P=void 0,this.#C=void 0,this.#O.clear(),this.#D=0,this.#R=void 0}}class Iv{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 Ev(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 Sv(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=Ev(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 Nv=new Set(["video","audio","image","cue","data","bbox"]);class Av{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(!Nv.has(n))throw new Error(`Track type must be one of ${Array.from(Nv).join("|")}`);this.id=e,this.type=n,this.offset=i,this.duration=vg(r)?r:void 0,this.source=o,"cue"===n?(this._cues=a.map((t=>t instanceof Iv?t:new Iv(t))),this._segments=[]):(this._segments=s.map((t=>t instanceof Tv?t:new Tv(t))),this._cues=void 0)}get segments(){return this._segments.slice()}get cues(){if("cue"===this.type)return this._cues.slice()}get endTime(){if(vg(this.duration))return this.offset+this.duration;if(!this._segments.length)return;const t=this._segments.reduce(((t,e)=>{const n=vg(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:vg(null==t?void 0:t.duration)?t.duration:0,offset:vg(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 Sv(this._segments,t,e)}setSegments(t=[]){if("cue"===this.type)return;const e=Array.isArray(t)?t:[];this._segments=e.map((t=>t instanceof Tv?t:new Tv(t)))}}function Mv(t){return"string"==typeof t?t:t&&"object"==typeof t?t.nodeId||t.nodeIdOrRef||t.id:void 0}function Fv(t){const e=Mv(t);let n=1;if(t&&"object"==typeof t&&vg(t.weight)&&(n=t.weight),!e)throw new Error("Child entry requires a nodeId");return{nodeId:e,weight:n}}function Ov(t){return(Array.isArray(t)?t:[]).map((t=>Fv(t)))}function Pv(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 Cv(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 Dv(t,e){if(e)try{var n;return new URL(e,t||(null==eu||null===(n=eu.location)||void 0===n?void 0:n.href)||void 0).toString()}catch(t){return e}}const Rv=new Map;class Bv{static register(t,e){if(!t||"function"!=typeof e)throw new Error("ManifestFactory.register requires type and parser function");Rv.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=Bv.inferType(t);if(!e||!Rv.has(e))throw new Error("Unsupported manifest type");return Rv.get(e)(t)}}Bv.register("dash",(function(t={}){const{body:e,url:n}=t,i=function(){if(eu&&"function"==typeof eu.DOMParser)return new eu.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=Pv(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=Pv(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:Pv(a&&a.getAttribute("timescale"))||Pv(e&&e.getAttribute("timescale"),1)||1,startNumber:Pv(a&&a.getAttribute("startNumber"))||Pv(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=Pv(n.getAttribute("t")),s=Pv(n.getAttribute("d")),a=Pv(n.getAttribute("r"),0);if(!vg(s))continue;vg(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:Dv(n,Cv(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:Dv(n,Cv(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}})),Bv.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:vg(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=>vg(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+(vg(e.duration)?e.duration:0)),0),l=vg(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}})),Bv.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=vg(null==t?void 0:t.duration)?t.duration:30,i=vg(null==t?void 0:t.width)?t.width:void 0,r=vg(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};vg(i)&&vg(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 Lv=["video/mp4"];function zv(t){return Lv.includes(t.mime)}var Wv={name:"containers",fn:function(t=[]){return t.filter(zv)},isRelevantForTrack:function(t){return"video"===(null==t?void 0:t.type)}};const Uv=new(ve=new WeakMap,ye=new WeakSet,class extends Jc{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),j(this,ye),W(this,ve,void 0),U(ve,this,new Map)}onDispose(){z(ve,this)&&z(ve,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 B(ye,this,Gv).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 jv(){return!!(eu&&eu.navigator&&eu.navigator.mediaCapabilities&&"function"==typeof eu.navigator.mediaCapabilities.decodingInfo)}function $v(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 qv(t){return t?JSON.stringify(t):"invalid"}async function Vv(t){if(!this.settings.enabled||!B(ye,this,jv).call(this)||!t)return this.log.debug("[#queryCapabilities] Not supported, returning false",t),{supported:!1,smooth:!1,powerEfficient:!1};const e=B(ye,this,qv).call(this,t),n=z(ve,this).get(e);if(n)return n;let i;try{i=await eu.navigator.mediaCapabilities.decodingInfo(t)}catch(t){i={supported:!1,smooth:!1,powerEfficient:!1}}return this.log.debug("[#queryCapabilities] Config:",t,"\nDecoding info result:",i),z(ve,this).set(e,i),i}async function Gv(t){if(B(ye,this,Kv).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=B(ye,this,$v).call(this,t),n=await B(ye,this,Vv).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 Hv(){if(!Kp())return!1;const t=Xp();return!Number.isFinite(t)||t<150}function Kv(t){if(!B(ye,this,Hv).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 Xv=[],Yv=()=>!0;[Wv,{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 Uv.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:Yv;Xv.push({name:t,fn:e,isRelevantForTrack:i})}(t,e,{isRelevantForTrack:n})}));const Qv=Vc("Node","warn"),Jv={start:0,end:0},Zv=.001;function ty(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)<=Zv&&Math.abs(t.duration-n.duration)<=Zv))?{offset:n.start,duration:n.duration}:void 0}var ey=new WeakMap,ny=new WeakMap,iy=new WeakMap,ry=new WeakMap,oy=new WeakMap,sy=new WeakMap,ay=new WeakMap,ly=new WeakMap,cy=new WeakMap,uy=new WeakMap,dy=new WeakSet;class hy extends Gc{constructor(t={},e={}){super(),j(this,dy),W(this,ey,void 0),W(this,ny,void 0),W(this,iy,void 0),W(this,ry,void 0),W(this,oy,void 0),W(this,sy,void 0),W(this,ay,void 0),W(this,ly,void 0),W(this,cy,void 0),W(this,uy,[]);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,U(ay,this,!0===e.forceImageFallback),U(ey,this,e.abrSelector),U(ny,this,e.assetsDeliveryService),U(ry,this,vg(r)?r:void 0),U(oy,this,vg(o)?o:void 0),U(sy,this,vg(s)?s:void 0),U(ly,this,e&&"object"==typeof e.mediaHostRewriteMap?e.mediaHostRewriteMap:void 0),U(cy,this,vg(e.maxManifestLoadAttempts)?e.maxManifestLoadAttempts:1/0),this.manifestLoadAttempts=0,this.manifestLoadError=void 0,U(uy,this,Ov(l))}setChildren(t){const e=Ov(t);return B(dy,this,Ny).call(this,e,{emit:!0})}addChild(t){const e=Fv(t),n=z(uy,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 B(dy,this,Ny).call(this,n,{emit:!0})}removeChild(t){const e=Mv(t);if(!e)return this.children;const n=z(uy,this).filter((t=>(null==t?void 0:t.nodeId)!==e));return n.length===z(uy,this).length?this.children:B(dy,this,Ny).call(this,n,{emit:!0})}async load(t={}){const{loadingMode:e="full",signal:n}=t;Qv.info(`[load] [${this.id}] Loading node in '${e}' mode`);try{if(n&&n.aborted)throw Vg();"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})=>B(dy,this,Ty).call(this,t,e,n))),l=s?B(dy,this,Iy).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 B(dy,this,Iy).call(this,t.segment,t.track,n);if(n&&n.aborted)throw Vg();return this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:e}),this}catch(t){if(Gg(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(Qv.info(`[loadMediaSegmentsAtOffset] [${this.id}] Loading media segments at offset ${n}`),!Number.isFinite(n))return;const{signal:i}=e;if(i&&i.aborted)throw Vg();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(B(dy,this,Ty).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)<=Zv&&!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})=>B(dy,this,Iy).call(this,t,e,i)))),i&&i.aborted)throw Vg();this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:"segment-offset",offsetSeconds:n})}}async resolve(t={}){if("ready"===this.state)return this;if("resolving"===this.state)return z(iy,this);const{signal:e,manifestOverride:n}=t;if(e&&e.aborted)throw Vg();if(this.hasExceededManifestLoadAttempts()){const t=this.manifestLoadError||new Error("Manifest load retry limit reached");throw this.state="failed",this.error=t,t}const i=this.state;return this.state="resolving",this.error=void 0,U(iy,this,(async()=>{try{const t=await B(dy,this,Ey).call(this,{signal:e,manifestOverride:n});if(e&&e.aborted)throw Vg();let i=Bv.parse(t);return i=B(dy,this,yy).call(this,i),this.tracks=(i.tracks||[]).map((t=>t instanceof Av?t:new Av(t))),this.mainTrackId=i.mainTrackId||this.mainTrackId,this.metadata=i.metadata||this.metadata,B(dy,this,My).call(this),B(dy,this,Ay).call(this),await B(dy,this,Sy).call(this),this.state="ready",this}catch(t){if(Gg(t,e))throw this.state=i,this.error=void 0,t;throw this.state="failed",this.error=t,t}})()),z(iy,this)}evict(){this.tracks.forEach((t=>{(t.segments||[]).forEach((t=>{t.evict()}))}))}get children(){return z(uy,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?vg(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+=vg(e.retainedByteLength)?e.retainedByteLength:0}))})),t}get buffered(){if("ready"!==this.state)return Jv;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||!vg(e))return Jv;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 Jv;if(n.length===this.tracks.length&&n.every((({track:t,range:e})=>{const n=t.endTime,i=vg(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 Jv;const r=Math.min(i,e);return r>0?{start:0,end:r}:Jv}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(z(cy,this))||z(cy,this)<=0)return!1;if(!this.manifestLoadError)return!1;const t=Number(this.manifestLoadAttempts);return Number.isFinite(t)&&t>=z(cy,this)}}function fy(t){return function(t,e){if(!t||"string"!=typeof t)return t;if(!e||"object"!=typeof e)return t;const n=eu&&"function"==typeof eu.URL?eu.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,z(ly,this))}function py(){return z(ay,this)||void 0===eu.VideoDecoder}function my(){return this.manifestRef&&"object"==typeof this.manifestRef&&"assets-delivery-service"===this.manifestRef.type}function gy(t){if(!B(dy,this,my).call(this))return!1;if(!B(dy,this,py).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 vy(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 vg(n)?n:vg(z(ry,this))?z(ry,this):void 0}function yy(t){if(this.imageFallbackActive=!1,!B(dy,this,gy).call(this,t))return t;if(!z(ny,this)||"function"!=typeof z(ny,this).resolveImageOne)return t;const e=z(ny,this).resolveImageOne(this.manifestRef),n=B(dy,this,fy).call(this,null==e?void 0:e.url);if(!n)return t;const i={typeHint:"image",url:n,duration:B(dy,this,vy).call(this,t),width:z(oy,this),height:z(sy,this)},r=Bv.parse(i);return t&&"object"==typeof t.metadata&&!Array.isArray(t.metadata)&&(r.metadata=t.metadata),this.imageFallbackActive=!0,r}function by(){const t=Number(this.manifestLoadAttempts);this.manifestLoadAttempts=Number.isFinite(t)&&t>0?t+1:1,this.manifestLoadError=void 0}function ky(t){this.manifestLoadError=t||new Error("Manifest load failed")}function xy(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 wy(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 _y(t,e){t&&("function"!=typeof t.setLoadError?t.loadError=e||new Error("Segment load failed"):t.setLoadError(e))}async function Ty(t,e,n){const i=B(dy,this,xy).call(this,e);try{const i=e.representations.map((async i=>{const r=B(dy,this,fy).call(this,i.url),o=await nv(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(Gg(t,n))throw B(dy,this,wy).call(this,e,i),t;throw B(dy,this,_y).call(this,e,t),t}}async function Iy(t,e,n){const i=z(ey,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=B(dy,this,xy).call(this,t);try{const i=B(dy,this,fy).call(this,s.url),r=await nv(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(Gg(e,n))throw B(dy,this,wy).call(this,t,a),e;throw B(dy,this,_y).call(this,t,e),e}}async function Ey(t={}){const{signal:e,manifestOverride:n}=t;if(e&&e.aborted)throw Vg();B(dy,this,by).call(this);try{let t=this.manifestRef;if(n&&"object"==typeof n){if(B(dy,this,my).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=B(dy,this,fy).call(this,n.url);return{typeHint:n.typeHint,url:t,mimeType:n.mimeType,body:n.body,duration:z(ry,this),width:z(oy,this),height:z(sy,this)}}"string"==typeof n.url&&n.url&&(t=n)}if(t&&"object"==typeof t&&"assets-delivery-service"===t.type){if(!z(ny,this)||"function"!=typeof z(ny,this).resolveOne)throw new Error("AssetsDeliveryService is required for assets-delivery-service manifestRef");const n=await z(ny,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=B(dy,this,fy).call(this,n.url),o=n.mimeType,s=n.body;if(r||s||o)return{typeHint:i,url:r,mimeType:o,body:s,duration:z(ry,this),width:z(oy,this),height:z(sy,this)};throw new Error("AssetsDeliveryService returned unsupported manifest shape")}if(t&&"object"==typeof t){const e=B(dy,this,fy).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=B(dy,this,fy).call(this,n),r="object"==typeof t?t.typeHint:void 0,o="object"==typeof t?t.mimeType:void 0;if("image"===Bv.inferType({typeHint:r,url:i,mimeType:o})){const e="object"==typeof t&&vg(t.duration)?t.duration:z(ry,this);return{typeHint:"image",url:i,mimeType:o,duration:e,width:"object"==typeof t&&vg(t.width)?t.width:z(oy,this),height:"object"==typeof t&&vg(t.height)?t.height:z(sy,this)}}const s=await nv(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){throw B(dy,this,ky).call(this,t),t}}async function Sy(){const t=Xv.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=ty(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 Ny(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}(z(uy,this),t)||(U(uy,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 Ay(){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 My(){if(!Array.isArray(this.tracks)||!this.tracks.length)return;const t=this.duration;if(!vg(t))return;const e=[new Iv({name:"nodestart",timestamp:0,data:{id:this.id},isSticky:!0}),new Iv({name:"nodeend",timestamp:t,data:{id:this.id}})],n=new Av({id:`${this.id}-auto-cue`,type:"cue",cues:e,offset:0,duration:t});this.tracks.push(n)}var Fy=new WeakMap,Oy=new WeakMap,Py=new WeakMap,Cy=new WeakMap,Dy=new WeakSet;class Ry extends Jc{constructor(...t){super(...t),j(this,Dy),W(this,Fy,new Map),W(this,Oy,new Map),W(this,Py,void 0),W(this,Cy,void 0);const[e,n]=t;U(Py,this,e),U(Cy,this,n)}get name(){return"NodeRepository"}get defaults(){return{enabledRepFilters:["containers","force-video-codec","media-capabilities"],disabledTracks:sv("disabledTracks"),forceVideoCodec:sv("forceVideoCodec"),forceImageFallback:sv("forceImageFallback"),mediaHostRewriteMap:sv("mediaHostRewriteMap"),maxManifestLoadAttempts:3}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"get","list"])}onDispose(){z(Fy,this).forEach(((t,e)=>{const n=z(Oy,this).get(e);n&&t&&"function"==typeof t.off&&t.off(Jp.NODE_CHILDREN_CHANGED,n)})),z(Oy,this).clear(),z(Fy,this).clear()}add(t){const e=t instanceof hy?t:new hy(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:z(Py,this),assetsDeliveryService:z(Cy,this)});if(!e.id)throw new Error("NodeRepository.add requires node with id");if(z(Fy,this).has(e.id))throw new Error(`NodeRepository.add: node with id ${e.id} already exists`);return z(Fy,this).set(e.id,e),B(Dy,this,By).call(this,e),this.trigger(Jp.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 z(Fy,this).get(e)}list(){return Array.from(z(Fy,this).values())}}function By(t){if(!t||"function"!=typeof t.on||!t.id)return;const e=t=>{this.trigger(Jp.NODE_CHILDREN_CHANGED,t)};t.on(Jp.NODE_CHILDREN_CHANGED,e),z(Oy,this).set(t.id,e)}var Ly=new WeakMap,zy=new WeakMap,Wy=new WeakSet;class Uy extends Jc{constructor(...t){super(...t),j(this,Wy),W(this,Ly,void 0),W(this,zy,new Map);const[e]=t;U(Ly,this,e)}get name(){return"ABRSelector"}get defaults(){return{safetyMargin:.35,minBufferForUpgrade:5,minBufferCritical:1,hysteresisRatio:1.1,abrStrategy:sv("abrStrategy")}}select(t={}){var e;const{representations:n=[],bufferSeconds:i}=t;if(!Array.isArray(n)||0===n.length)return;const r=z(Ly,this)&&"function"==typeof z(Ly,this).getKbps?z(Ly,this).getKbps():void 0,o=B(Wy,this,jy).call(this,n[0]),s=z(zy,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)=>B(Wy,this,$y).call(this,t.bandwidth)-B(Wy,this,$y).call(this,e.bandwidth)));if("bottom"===a){const e=l[0];return B(Wy,this,Gy).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 B(Wy,this,Gy).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 B(Wy,this,Gy).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=vg(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),B(Wy,this,Gy).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=>B(Wy,this,$y).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&&vg(e.bandwidth)&&vg(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 B(Wy,this,Gy).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(){z(zy,this).clear(),U(Ly,this,null)}}function jy(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 $y(t){return vg(t)?t/1e3:0}function qy(t){return vg(t)?t/1e3:void 0}function Vy(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:B(Wy,this,qy).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:B(Wy,this,qy).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 Gy(t,e,n={}){if(!t)return;const i=B(Wy,this,Vy).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=B(Wy,this,jy).call(this,t);z(zy,this).set(r,t.id)}var Hy=new WeakMap,Ky=new WeakSet;class Xy extends Jc{constructor(...t){super(...t),j(this,Ky),W(this,Hy,void 0);const[e]=t;if(U(Hy,this,e),!z(Hy,this)||"function"!=typeof z(Hy,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(){U(Hy,this,null)}getPrioritizationSnapshot(t){const e=z(Hy,this).list();if(!e.length)return{orderedIds:[],reachableIds:[]};const{levels:n,weights:i}=B(Ky,this,Yy).call(this,e,t);return{orderedIds:B(Ky,this,Qy).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 Yy(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=vg(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 Qy(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 Jy(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 Zy(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 tb(t){return"string"==typeof t&&t.startsWith("cmaf:")}function eb(t){return"image"===(null==t?void 0:t.assetType)?"image":"ivd"}function nb(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 ib=new WeakMap,rb=new WeakMap,ob=new WeakSet;class sb extends Jc{constructor(...t){super(...t),j(this,ob),W(this,ib,void 0),W(this,rb,void 0);const[,e={}]=t;U(ib,this,"function"==typeof e.fetchFn?e.fetchFn:void 0),U(rb,this,qg())}get name(){return"AssetsDeliveryService"}get defaults(){return{assetsDeliveryServiceUrl:"https://assets.eko.com",profile:sv("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(!B(ob,this,lb).call(this,t))return;const e=Jy(t,this.settings.profile),n=function(t,e,n){const i=(t||"").replace(/\/$/,""),r=null==e?void 0:e.assetId,o=null==e?void 0:e.assetRevision;if(!i||"string"!=typeof r||"number"!=typeof o)return;const s=`${i}/image/${encodeURIComponent(r)}/${o}`,a=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 a?`${s}?${a}`:s}(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=>B(ob,this,lb).call(this,t)));if(!n.length)return[];const i=B(ob,this,ab).call(this,e);if(i&&i.aborted)return[];const r=[],o=this.settings.profile;n.forEach((t=>{if("image"!==eb(t))return;const e=this.resolveImageOne(t);e&&e.url&&r.push({manifestRef:Zy(t,e.encodeProfile),manifest:{typeHint:"image",url:e.url}})}));const s=n.filter((t=>"image"!==eb(t))).map((t=>function(t,e){const n=Jy(t,e);return{ref:t,profile:n,route:tb(n)?"dash":"ivd"}}(t,o))),a=B(ob,this,ub).call(this,s);for(const{refs:t,route:e}of a){if(i&&i.aborted)return r;const{url:n}=B(ob,this,db).call(this,t,e),o=await B(ob,this,hb).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:Zy(t,e),manifest:nb(i)})}))}return r}onDispose(){z(rb,this)&&z(rb,this).abort(),U(rb,this,null),U(ib,this,null)}}function ab(t){return t&&t.signal?t.signal:z(rb,this)?z(rb,this).signal:void 0}function lb(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 cb(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 ub(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=>{B(ob,this,cb).call(this,t.refs,this.settings.maxBatchSize).forEach((e=>{n.push({route:t.route,refs:e})}))})),n}function db(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 hb(t,e){return z(ib,this)?z(ib,this).call(this,t,e):await nv(t,{returnType:"json",method:(null==e?void 0:e.method)||"GET",signal:null==e?void 0:e.signal})}function fb({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 pb=(eu.requestAnimationFrame||eu.mozRequestAnimationFrame||eu.webkitRequestAnimationFrame||eu.msRequestAnimationFrame||(t=>eu.setTimeout(t,1e3/60))).bind(eu),mb=(eu.cancelAnimationFrame||eu.mozCancelAnimationFrame||eu.webkitCancelAnimationFrame||eu.msCancelAnimationFrame||(t=>eu.clearTimeout(t))).bind(eu),gb=Vc("ticker","warn");let vb,yb=[],bb=null,kb=$g();function xb(){kb=$g();const t=[];let e,n;for(n=yb.length-1;n>=0;--n)e=yb[n],kb>=e.lastTick+e.interval&&t.push(e);for(n=t.length-1;n>=0;--n)if(e=t[n],!e.stopped){e.lastTick=kb;try{e.callback()}catch(t){console&&"function"==typeof console.error?console.error(t):gb.error(t)}}vb=pb(xb)}function wb(){$g()-kb>=200&&(mb(vb),xb())}function _b(t){let e=-1;for(let n=0;n<yb.length;n+=1)if(yb[n].callback===t){e=n;break}return e}function Tb(t,e=0){if(!t||"function"!=typeof t||"number"!=typeof e||e<0)return void gb.error("[start] Invalid arguments given to start method.",arguments);const n=_b(t);return-1!==n?(gb.debug("[start] Callback already exists, overriding interval.",arguments),yb[n].interval=e,t):(yb.push({callback:t,interval:e,lastTick:$g()}),1===yb.length&&(vb=pb(xb),bb||(bb=eu.setInterval(wb,1e3))),t)}function Ib(t){const e=_b(t);-1!==e?(yb[e].stopped=!0,yb.splice(e,1),yb.length||(mb(vb),eu.clearInterval(bb),bb=null)):gb.debug("[stop] Callback not found, doing nothing.",arguments)}function Eb(t){return-1!==_b(t)}function Sb(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 gb.error("[createThrottler] Bad argument given to createThrottler, first argument must be a function.",arguments);gb.debug("[createThrottler] Creating a new throttler instance.",arguments);const s=[];function a(){gb.debug("[onThrottlerTick] Calling callback with "+s.length+" queued items.");const e=s.slice(0);s.length=0,Ib(a),t(e)}const l={push:function(t){gb.debug("[push] Queuing argument:",t),0===s.length&&Tb(a,e),s.push(t),o+=1,(o<=r||s.length>=i)&&a()},flush:function(){gb.debug("[flush] Flushing queue."),0!==s.length&&a()},dispose:function(){gb.debug("[dispose] Disposing of throttler.");const t=s.slice(0);return s.length=0,Ib(a),t}};return Object.defineProperty(l,"interval",{enumerable:!0,get:function(){return e},set:function(t){"number"==typeof t&&(e=t)}}),l}function Nb(t,e){if(t&&"function"==typeof t)return t.__tickerThrottler||(t.__tickerThrottler=Sb((function(){t()}),e)),"number"==typeof e&&(t.__tickerThrottler.interval=e),t.__tickerThrottler.push(),t.__tickerThrottler;gb.error("[scheduleExecution] Bad argument given to scheduleExecution, first argument must be a function.",arguments)}var Ab=new WeakMap,Mb=new WeakMap,Fb=new WeakMap,Ob=new WeakMap,Pb=new WeakMap,Cb=new WeakMap,Db=new WeakMap,Rb=new WeakMap,Bb=new WeakMap,Lb=new WeakMap,zb=new WeakMap,Wb=new WeakMap,Ub=new WeakMap,jb=new WeakMap,$b=new WeakMap,qb=new WeakMap,Vb=new WeakSet;class Gb extends Jc{constructor(...t){super(...t),j(this,Vb),W(this,Ab,void 0),W(this,Mb,void 0),W(this,Fb,void 0),W(this,Ob,void 0),W(this,Pb,[]),W(this,Cb,[]),W(this,Db,new Set),W(this,Rb,new Set),W(this,Bb,!1),W(this,Lb,void 0),W(this,zb,void 0),W(this,Wb,void 0),W(this,Ub,void 0),W(this,jb,void 0),W(this,$b,void 0),W(this,qb,void 0);const[e,n,i,r]=t;U(Ab,this,e),U(Mb,this,n),U(Fb,this,i),U(Ob,this,r),U(Lb,this,qg());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),U(qb,this,(()=>B(Vb,this,ik).call(this))),B(Vb,this,Yb).call(this),B(Vb,this,Xb).call(this)}get name(){return"NodeResolver"}get defaults(){return{maxConcurrent:5}}onDispose(){var t;z(Lb,this)&&z(Lb,this).abort(),U(Lb,this,null),z(Ob,this)&&"function"==typeof z(Ob,this).off&&z(Wb,this)&&z(Ob,this).off(Jp.PLACEMENT_ADDED,z(Wb,this)),z(Ob,this)&&"function"==typeof z(Ob,this).off&&z($b,this)&&z(Ob,this).off(Jp.TIMELINE_RESET,z($b,this)),z(Ab,this)&&"function"==typeof z(Ab,this).off&&z(Ub,this)&&z(Ab,this).off(Jp.NODE_ADD,z(Ub,this)),z(Ab,this)&&"function"==typeof z(Ab,this).off&&z(jb,this)&&z(Ab,this).off(Jp.NODE_CHILDREN_CHANGED,z(jb,this)),U(Wb,this,null),U(Ub,this,null),U(jb,this,null),U($b,this,null),U(Pb,this,[]),U(Cb,this,[]),z(Db,this).clear(),z(Rb,this).clear(),U(Bb,this,!1),U(zb,this,void 0),null!==(t=z(qb,this))&&void 0!==t&&t.__tickerThrottler&&z(qb,this).__tickerThrottler.dispose(),U(qb,this,null)}}function Hb(){return z(Lb,this)?z(Lb,this).signal:void 0}function Kb(){return this._disposed||z(Lb,this)&&z(Lb,this).signal.aborted}function Xb(){z(Ob,this)&&"function"==typeof z(Ob,this).on&&(U(Wb,this,(t=>{B(Vb,this,Jb).call(this,null==t?void 0:t.nodeId)})),z(Ob,this).on(Jp.PLACEMENT_ADDED,z(Wb,this)),U($b,this,(()=>B(Vb,this,Qb).call(this))),z(Ob,this).on(Jp.TIMELINE_RESET,z($b,this))),z(Ab,this)&&"function"==typeof z(Ab,this).on&&(U(Ub,this,(({node:t})=>{(null==t?void 0:t.id)&&B(Vb,this,Jb).call(this,t.id,{fromRepoAdd:!0})})),z(Ab,this).on(Jp.NODE_ADD,z(Ub,this)),U(jb,this,(()=>{Nb(z(qb,this),100)})),z(Ab,this).on(Jp.NODE_CHILDREN_CHANGED,z(jb,this)))}function Yb(){const t=z(Ob,this)&&Array.isArray(z(Ob,this).placements)?z(Ob,this).placements:[];t.forEach((t=>B(Vb,this,Jb).call(this,t.nodeId)));const e=t.length?t[t.length-1]:void 0;e&&e.nodeId&&U(zb,this,e.nodeId)}function Qb(){z(Lb,this)&&z(Lb,this).abort(),U(Lb,this,qg()),U(Pb,this,[]),U(Cb,this,[]),z(Db,this).clear(),U(Bb,this,!1),U(zb,this,void 0)}function Jb(t,{fromRepoAdd:e=!1}={}){B(Vb,this,Kb).call(this)||t&&(z(Rb,this).has(t)||z(Db,this).has(t)||(z(Pb,this).push(t),z(zb,this)||e||U(zb,this,t),!z(Bb,this)&&e||B(Vb,this,Zb).call(this)))}function Zb(){if(z(Bb,this))return void B(Vb,this,tk).call(this);if(0===z(Pb,this).length)return;U(Bb,this,!0);const t=z(Pb,this).shift();B(Vb,this,rk).call(this,t).finally((()=>{B(Vb,this,tk).call(this)}))}async function tk(){if(!B(Vb,this,Kb).call(this))for(z(Pb,this).length||z(Cb,this).length||U(Cb,this,B(Vb,this,ek).call(this));z(Db,this).size<this.settings.maxConcurrent;){const t=this.settings.maxConcurrent-z(Db,this).size;if(t<=0)break;const e=[];for(;e.length<t&&(z(Pb,this).length||z(Cb,this).length);){let t=z(Pb,this).shift();t||(t=z(Cb,this).shift()),t&&e.push(t)}if(!e.length)break;const n=B(Vb,this,ok).call(this,e);n.length&&z(Fb,this)&&"function"==typeof z(Fb,this).resolve&&B(Vb,this,sk).call(this,n).finally((()=>B(Vb,this,tk).call(this))),e.filter((t=>!n.find((e=>e.nodeId===t)))).forEach((t=>{B(Vb,this,rk).call(this,t).finally((()=>B(Vb,this,tk).call(this)))}))}}function ek(){const t=new Set([...z(Rb,this),...z(Db,this),...z(Pb,this)]);return B(Vb,this,nk).call(this,t)}function nk(t){const e=z(Ob,this)&&Array.isArray(z(Ob,this).placements)?z(Ob,this).placements:[],n=(e.length?e[e.length-1].nodeId:void 0)||z(zb,this);return fb({prioritizer:z(Mb,this),repository:z(Ab,this),startNodeId:n,pendingIds:t,fallbackToRepository:!1})}function ik(){B(Vb,this,Kb).call(this)||(z(Bb,this)||0!==z(Pb,this).length)&&(U(Cb,this,B(Vb,this,ek).call(this)),z(Bb,this)&&B(Vb,this,tk).call(this))}async function rk(t,e){if(!t||z(Rb,this).has(t)||z(Db,this).has(t))return;const n=B(Vb,this,Hb).call(this);if(n&&n.aborted)return;const i=z(Ab,this)&&"function"==typeof z(Ab,this).get?z(Ab,this).get(t):void 0;if(i&&"function"==typeof i.resolve)if("function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts())z(Rb,this).add(t);else{z(Db,this).add(t);try{const r={signal:n};e&&(r.manifestOverride=e),await i.resolve(r),z(Rb,this).add(t)}catch(e){if(Gg(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()&&z(Rb,this).add(t)}finally{z(Db,this).delete(t)}}}function ok(t){const e=[];return t.forEach((t=>{const n=z(Ab,this)&&"function"==typeof z(Ab,this).get?z(Ab,this).get(t):void 0;n&&n.manifestRef&&"assets-delivery-service"===n.manifestRef.type&&e.push({nodeId:t,ref:n.manifestRef})})),e}async function sk(t){const e=B(Vb,this,Hb).call(this);if(!e||!e.aborted){t.forEach((({nodeId:t})=>z(Db,this).add(t)));try{const n=t.map((t=>t.ref)),i=await z(Fb,this).resolve(n,{signal:e});t.forEach((({nodeId:t,ref:e})=>{var n;const r=z(Ab,this)&&"function"==typeof z(Ab,this).get?z(Ab,this).get(t):void 0;if(z(Db,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?B(Vb,this,ak).call(this,o.manifest,s):void 0;B(Vb,this,rk).call(this,t,a)}))}catch(n){Gg(n,e)||this.log.warn(`NodeResolver ADS batch failed: ${(null==n?void 0:n.message)||n}`),t.forEach((({nodeId:t})=>z(Db,this).delete(t)))}}}function ak(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 lk=.001,ck="priority";function uk(t){const e=Number(t);return Number.isFinite(e)?e:0}var dk=new WeakMap,hk=new WeakMap,fk=new WeakMap,pk=new WeakMap,mk=new WeakMap,gk=new WeakMap,vk=new WeakMap,yk=new WeakMap,bk=new WeakMap,kk=new WeakMap,xk=new WeakMap,wk=new WeakMap,_k=new WeakMap,Tk=new WeakMap,Ik=new WeakMap,Ek=new WeakMap,Sk=new WeakMap,Nk=new WeakMap,Ak=new WeakMap,Mk=new WeakSet;class Fk extends Jc{constructor(...t){super(...t),j(this,Mk),W(this,dk,void 0),W(this,hk,void 0),W(this,fk,void 0),W(this,pk,new Map),W(this,mk,new Map),W(this,gk,[]),W(this,vk,new Set),W(this,yk,new Map),W(this,bk,!1),W(this,kk,void 0),W(this,xk,void 0),W(this,wk,void 0),W(this,_k,void 0),W(this,Tk,void 0),W(this,Ik,void 0),W(this,Ek,void 0),W(this,Sk,!1),W(this,Nk,[]),W(this,Ak,void 0);const[e,n,i]=t;U(dk,this,e),U(hk,this,n),U(fk,this,i),U(xk,this,qg()),U(Ak,this,(()=>B(Mk,this,ax).call(this))),B(Mk,this,jk).call(this)}get name(){return"SegmentLoadCoordinator"}get defaults(){return{maxConcurrentLoads:3,maxSegmentLoadAttempts:3}}onDispose(){var t;z(xk,this)&&z(xk,this).abort(),U(xk,this,null),z(yk,this).size&&z(yk,this).forEach((t=>{(null==t?void 0:t.controller)&&t.controller.abort()})),z(yk,this).clear(),z(fk,this)&&"function"==typeof z(fk,this).off&&(z(wk,this)&&z(fk,this).off(Jp.PLACEMENT_ADDED,z(wk,this)),z(Tk,this)&&z(fk,this).off(Jp.TIMELINE_SEEKING,z(Tk,this)),z(Ik,this)&&z(fk,this).off(Jp.TIMELINE_SEEKED,z(Ik,this)),z(Ek,this)&&z(fk,this).off(Jp.TIMELINE_RESET,z(Ek,this))),z(dk,this)&&"function"==typeof z(dk,this).off&&z(_k,this)&&z(dk,this).off(Jp.NODE_CHILDREN_CHANGED,z(_k,this)),U(wk,this,null),U(_k,this,null),U(Tk,this,null),U(Ik,this,null),U(Ek,this,null),z(pk,this).clear(),z(mk,this).clear(),U(gk,this,[]),z(vk,this).clear(),z(yk,this).clear(),U(bk,this,!1),U(kk,this,void 0),U(Sk,this,!1),U(Nk,this,[]),null!==(t=z(Ak,this))&&void 0!==t&&t.__tickerThrottler&&z(Ak,this).__tickerThrottler.dispose(),U(Ak,this,null)}}function Ok(){return z(xk,this)?z(xk,this).signal:void 0}function Pk(){return this._disposed||z(xk,this)&&z(xk,this).signal.aborted}function Ck(){const t=Number(this.settings.maxSegmentLoadAttempts);return Number.isFinite(t)&&t>0?t:1/0}function Dk(t){const e=B(Mk,this,Ck).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 Rk(t){if(!t)return!1;if(B(Mk,this,Dk).call(this,t))return!0;if("boolean"==typeof t.isLoaded)return t.isLoaded;const e=Number(t.retainedByteLength);return Number.isFinite(e)&&e>0}function Bk(t,{allowSeekKeep:e=!1,segmentOffset:n}={}){const i=qg(),r=i?i.signal:B(Mk,this,Ok).call(this);return t&&z(yk,this).set(t,{controller:i,allowSeekKeep:!!e,segmentOffset:n}),{signal:r,controller:i}}function Lk(t,e,n={}){const i=z(yk,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 zk(t,e){const n=z(yk,this).get(t);n&&(e&&n.controller!==e||z(yk,this).delete(t))}function Wk(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=z(dk,this)&&"function"==typeof z(dk,this).get?z(dk,this).get(i):void 0;if(!r)return;const o=B(Mk,this,Qk).call(this,r,t,e);Number.isFinite(o)&&n.add(`${i}:${o}`)})),n}function Uk(t){z(yk,this).size&&z(yk,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 jk(){z(fk,this)&&"function"==typeof z(fk,this).on&&(U(wk,this,(t=>{B(Mk,this,Gk).call(this,t)})),z(fk,this).on(Jp.PLACEMENT_ADDED,z(wk,this)),U(Tk,this,(t=>B(Mk,this,$k).call(this,t))),z(fk,this).on(Jp.TIMELINE_SEEKING,z(Tk,this)),U(Ik,this,(t=>B(Mk,this,qk).call(this,t))),z(fk,this).on(Jp.TIMELINE_SEEKED,z(Ik,this)),U(Ek,this,(()=>B(Mk,this,Vk).call(this))),z(fk,this).on(Jp.TIMELINE_RESET,z(Ek,this))),z(dk,this)&&"function"==typeof z(dk,this).on&&(U(_k,this,(()=>{Nb(z(Ak,this),100)})),z(dk,this).on(Jp.NODE_CHILDREN_CHANGED,z(_k,this)))}function $k(t={}){if(B(Mk,this,Pk).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=B(Mk,this,Wk).call(this,n,e);B(Mk,this,Uk).call(this,i),U(Sk,this,!0),U(Nk,this,n.map((t=>{const n=null==t?void 0:t.nodeId;if(n)return{nodeId:n,placement:t,targetTime:e}})).filter(Boolean)),setTimeout((()=>B(Mk,this,Kk).call(this)),0)}function qk(t={}){var e,n;if(B(Mk,this,Pk).call(this))return;U(Sk,this,!1),U(Nk,this,[]);const i=Number.isFinite(null==t?void 0:t.targetTime)?Number(t.targetTime):Number(null===(e=z(fk,this))||void 0===e?void 0:e.currentTime);(Array.isArray(null===(n=z(fk,this))||void 0===n?void 0:n.placements)?z(fk,this).placements:[]).forEach((t=>{if(!t)return;const e=ep(t);if(Number.isFinite(e)){if(Number.isFinite(i)){if(e>=i)return void B(Mk,this,Gk).call(this,t);const n=Zf(t,z(dk,this));return Number.isFinite(n)?void(e+n>i&&B(Mk,this,Gk).call(this,t)):void(e<=i&&B(Mk,this,Gk).call(this,t))}B(Mk,this,Gk).call(this,t)}})),setTimeout((()=>B(Mk,this,Kk).call(this)),0)}function Vk(){z(xk,this)&&z(xk,this).abort(),U(xk,this,qg()),z(yk,this).size&&z(yk,this).forEach((t=>{(null==t?void 0:t.controller)&&t.controller.abort()})),z(yk,this).clear(),z(pk,this).clear(),z(mk,this).clear(),U(gk,this,[]),z(vk,this).clear(),U(bk,this,!1),U(kk,this,void 0),U(Sk,this,!1),U(Nk,this,[])}function Gk(t){if(B(Mk,this,Pk).call(this))return;const e=null==t?void 0:t.nodeId;if(!e)return;const n=z(pk,this).get(e);if(n){const i=ep(n),r=ep(t);Number.isFinite(i)?Number.isFinite(r)&&r<i&&z(pk,this).set(e,t):Number.isFinite(r)&&z(pk,this).set(e,t)}else z(pk,this).set(e,t);const i=z(kk,this);U(kk,this,e),i&&i!==e&&U(gk,this,[]),z(bk,this)?setTimeout((()=>B(Mk,this,Kk).call(this)),0):B(Mk,this,Hk).call(this)}function Hk(){z(bk,this)||z(pk,this).size&&(U(bk,this,!0),B(Mk,this,Kk).call(this))}async function Kk(){if(B(Mk,this,Pk).call(this))return;if(z(vk,this).size>=this.settings.maxConcurrentLoads)return;if(z(Sk,this))return void(z(Nk,this).length&&B(Mk,this,Xk).call(this));const t=B(Mk,this,tx).call(this);if(t.hasPending)B(Mk,this,ex).call(this,t);else for(z(gk,this).length||U(gk,this,B(Mk,this,ox).call(this));z(vk,this).size<this.settings.maxConcurrentLoads&&z(gk,this).length;){const t=z(gk,this).shift();B(Mk,this,lx).call(this,t,"partial").finally((()=>{setTimeout((()=>B(Mk,this,Kk).call(this)),0)}))}}function Xk(){if(B(Mk,this,Pk).call(this))return;const t=Math.max(0,this.settings.maxConcurrentLoads-z(vk,this).size);if(!t||!z(Nk,this).length)return;const e=[],n=[];for(let i=0;i<z(Nk,this).length;i+=1){const r=z(Nk,this)[i];(null==r?void 0:r.nodeId)&&(e.length<t&&!z(vk,this).has(r.nodeId)?e.push(r):n.push(r))}U(Nk,this,n),e.forEach((t=>{B(Mk,this,Yk).call(this,t).finally((()=>{setTimeout((()=>B(Mk,this,Kk).call(this)),0)}))}))}async function Yk(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(z(vk,this).has(e))return;const{signal:r,controller:o}=B(Mk,this,Bk).call(this,e);if(r&&r.aborted)B(Mk,this,zk).call(this,e,o);else{z(vk,this).add(e);try{const t=z(dk,this)&&"function"==typeof z(dk,this).get?z(dk,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=B(Mk,this,Qk).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}`),B(Mk,this,Lk).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){Gg(t,r)||this.log.warn(`[#loadSeekWork] SegmentLoadCoordinator failed to seek-load node ${e}: ${(null==t?void 0:t.message)||t}`)}finally{z(vk,this).delete(e),B(Mk,this,zk).call(this,e,o)}}}function Qk(t,e,n){var i;const r=ep(e);if(!Number.isFinite(r))return;const o=uk(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=uk(null===(i=l)||void 0===i?void 0:i.offset),d=Sv(c,Math.max(0,s-u),{preferRepresentationTime:!0}),h=Number(null==d?void 0:d.offset);return Number.isFinite(h)?h:void 0}function Jk(t,e,n=(t=>null===(t=z(fk,this))||void 0===t?void 0:t.currentTime)()){var i;const r=(Array.isArray(null===(i=z(fk,this))||void 0===i?void 0:i.placements)?z(fk,this).placements:[]).filter((e=>(null==e?void 0:e.nodeId)===t&&Number.isFinite(ep(e)))).sort(((t,e)=>ep(t)-ep(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=ep(e);if(!Number.isFinite(n))continue;const i=Zf(e,z(dk,this)),l=Number.isFinite(i)&&i>=0;(!a&&n>=o-lk&&(a=e),l)?o+lk>=n&&o<n+i-lk&&(s=e):o+lk>=n&&(s=e)}return s||a||r[r.length-1]}function Zk(t,e){var n;const i=Number(ep(e));if(!Number.isFinite(i))return;const r=Zf(e,z(dk,this)),o=Number.isFinite(r)&&r>=0?i+r:void 0,s=(Array.isArray(null===(n=z(fk,this))||void 0===n?void 0:n.placements)?z(fk,this).placements:[]).filter((e=>(null==e?void 0:e.nodeId)===t&&Number.isFinite(ep(e)))).sort(((t,e)=>ep(t)-ep(e)));for(let t=0;t<s.length;t+=1){const e=s[t],n=Number(ep(e));if(Number.isFinite(n)&&!(n<=i+lk)){if(Number.isFinite(o)&&n>o+lk)return;return e}}}function tx(){const t=[];let e=!1,n=1/0;if(z(pk,this).forEach(((i,r)=>{if(!r||!i)return;const o=z(mk,this).get(r);if(o)return e=!0,void(n=Math.min(n,uk(o.timelineStart)));const s=B(Mk,this,nx).call(this,r,i);s&&(e=!0,n=Math.min(n,uk(s.timelineStart)),t.push(s))})),!e||!Number.isFinite(n))return{hasPending:!1,waveTime:void 0,startable:[]};const i=t.filter((t=>uk(t.timelineStart)===n&&!z(vk,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 ex({waveTime:t,startable:e}){const n=Math.max(0,this.settings.maxConcurrentLoads-z(vk,this).size);n&&e.length&&e.slice(0,n).forEach((e=>{B(Mk,this,rx).call(this,e,t).finally((()=>{setTimeout((()=>B(Mk,this,Kk).call(this)),0)}))}))}function nx(t,e){var n,i;const r=z(dk,this)&&"function"==typeof z(dk,this).get?z(dk,this).get(t):void 0;if(!r)return;if("function"==typeof r.hasExceededManifestLoadAttempts&&r.hasExceededManifestLoadAttempts())return void z(pk,this).delete(t);const o=B(Mk,this,Jk).call(this,t,e,null===(n=z(fk,this))||void 0===n?void 0:n.currentTime),s=Number(ep(o)),a=uk(null===(i=z(fk,this))||void 0===i?void 0:i.currentTime),l="function"==typeof r.loadMediaSegmentsAtOffset,c="function"==typeof r.load;if(!l&&!c)return void z(pk,this).delete(t);if(r.isLoaded)return void z(pk,this).delete(t);if("ready"!==r.state){if(!Number.isFinite(s))return;return{nodeId:t,segmentOffset:0,timelineStart:s}}if(!B(Mk,this,cx).call(this,r))return void z(pk,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&&!B(Mk,this,Rk).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/lk)*lk;h.add(t)}}))}));const f=Array.from(h).sort(((t,e)=>t-e)),p=e=>{const n=Number(ep(e));if(!Number.isFinite(n))return{status:"none"};const i=uk(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+lk;t+=1)s=t;const l=f.slice(s);if(!l.some((t=>B(Mk,this,ix).call(this,r,t))))return{status:f.slice(0,s).some((t=>B(Mk,this,ix).call(this,r,t)))?"beforeOnly":"none"};const c=l.find((t=>B(Mk,this,ix).call(this,r,t))),u=Math.max(0,uk(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};z(pk,this).delete(t)}else{const e=B(Mk,this,Zk).call(this,t,o);if(e){const t=p(e);if("work"===t.status)return t.work}}}function ix(t,e){const n=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[],i=uk(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)<=lk&&!B(Mk,this,Rk).call(this,t)}))))}async function rx(t,e){const n=null==t?void 0:t.nodeId,i=null==t?void 0:t.segmentOffset;if(this.log.debug(`[#loadP0Work] Loading ${ck} node [${n}] at segmentOffset=${i} wave=${e}`),!n)return;const r=z(dk,this)&&"function"==typeof z(dk,this).get?z(dk,this).get(n):void 0;if(!r)return void z(pk,this).delete(n);const o="function"==typeof r.loadMediaSegmentsAtOffset&&Number.isFinite(i),{signal:s,controller:a}=B(Mk,this,Bk).call(this,n,{allowSeekKeep:o,segmentOffset:i});if(s&&s.aborted)B(Mk,this,zk).call(this,n,a);else{z(vk,this).add(n),z(mk,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(Gg(t,s))return;const e=`[#loadP0Work] SegmentLoadCoordinator failed to load ${ck} work for node ${n}: ${(null==t?void 0:t.message)||t}`;this.log.warn(e)}finally{this.log.debug(`[#loadP0Work] Finished ${ck} work for node [${n}]`),z(mk,this).delete(n),z(vk,this).delete(n),B(Mk,this,zk).call(this,n,a)}}}function ox(){const t=new Set([...z(pk,this).keys(),...z(vk,this)]),e=B(Mk,this,sx).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&&B(Mk,this,ux).call(this,t));if(i){const e=fb({prioritizer:z(hk,this),repository:z(dk,this),startNodeId:z(kk,this),prioritizedIds:n,pendingIds:t,allowedIds:i,filter:r});if(e.length)return e}return fb({prioritizer:z(hk,this),repository:z(dk,this),startNodeId:z(kk,this),prioritizedIds:n,pendingIds:t,filter:r})}function sx(){return z(hk,this)&&z(kk,this)?"function"==typeof z(hk,this).getPrioritizationSnapshot?z(hk,this).getPrioritizationSnapshot(z(kk,this)):{orderedIds:"function"==typeof z(hk,this).sortNodes?z(hk,this).sortNodes(z(kk,this)):[],reachableIds:"function"==typeof z(hk,this).getReachableNodeIds?z(hk,this).getReachableNodeIds(z(kk,this)):[]}:null}function ax(){B(Mk,this,Pk).call(this)||(z(bk,this)||z(pk,this).size)&&(U(gk,this,B(Mk,this,ox).call(this)),z(bk,this)&&!z(Sk,this)&&B(Mk,this,Kk).call(this))}async function lx(t,e){if(this.log.debug(`[#loadNode] Loading node [${t}] in '${e}' mode`),!t)return;const n=z(dk,this)&&"function"==typeof z(dk,this).get?z(dk,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}=B(Mk,this,Bk).call(this,t,{allowSeekKeep:!1});if(i&&i.aborted)B(Mk,this,zk).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&&B(Mk,this,ux).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${t}: partial already loaded`);if(!B(Mk,this,cx).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${t}: no loadable tracks`);z(vk,this).add(t),await n.load({loadingMode:e,signal:i})}catch(e){if(Gg(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}]`),z(vk,this).delete(t),B(Mk,this,zk).call(this,t,r)}}function cx(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 ux(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&&!B(Mk,this,Rk).call(this,n)||i&&!B(Mk,this,Rk).call(this,i))}))}class dx extends Jc{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 hx(t){if(!t)throw new Error("Assertion failed.")}const fx=t=>t&&t[t.length-1],px=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)},mx=t=>t.constructor===Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t),gx=t=>t.constructor===DataView?t:ArrayBuffer.isView(t)?new DataView(t.buffer,t.byteOffset,t.byteLength):new DataView(t),vx=new TextDecoder,yx=t=>Object.fromEntries(Object.entries(t).map((([t,e])=>[e,t]))),bx={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},kx=yx(bx),xx={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},wx=yx(xx),_x={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},Tx=yx(_x),Ix=t=>[...t].map((t=>t.toString(16).padStart(2,"0"))).join(""),Ex=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,Sx=(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},Nx=(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},Ax=()=>{let t,e;return{promise:new Promise(((n,i)=>{t=n,e=i})),resolve:t,reject:e}},Mx=(t,e,n)=>t.getUint8(e)<<16|t.getUint8(e+1)<<8|t.getUint8(e+2),Fx=(t,e,n)=>Math.max(e,Math.min(n,t)),Ox=/^[a-z]{3}$/,Px=1e6*(1+Number.EPSILON);let Cx=null;let Dx=null;const Rx=()=>{if(null!==Dx)return Dx;if("undefined"==typeof navigator)return null;const t=/\bChrome\/(\d+)/.exec(navigator.userAgent);return t?Dx=Number(t[1]):null},Bx=t=>"number"==typeof t&&!Number.isNaN(t);class Lx{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 zx={default:!0,forced:!1,original:!1,commentary:!1,hearingImpaired:!1,visuallyImpaired:!1};class Wx{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 Wx(this.bytes);return t.pos=this.pos,t}}const Ux=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],jx=[-1,1,2,3,4,5,6,8],$x=t=>{if(!t||t.byteLength<2)throw new TypeError("AAC description must be at least 2 bytes long.");const e=new Wx(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<Ux.length&&(r=Ux[i]);const o=e.readBits(4);let s=null;return o>=1&&o<=7&&(s=jx[o]),{objectType:n,frequencyIndex:i,sampleRate:r,channelConfiguration:o,numberOfChannels:s}},qx=["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"],Vx=[{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}],Gx=t=>{const{codec:e,codecDescription:n,colorSpace:i,avcCodecInfo:r,hevcCodecInfo:o,vp9CodecInfo:s,av1CodecInfo:a}=t;if("avc"===e){if(hx(null!==t.avcType),r){const e=new Uint8Array([r.avcProfileIndication,r.profileCompatibility,r.avcLevelIndication]);return`avc${t.avcType}.${Ix(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}.${Ix(n.subarray(1,4))}`}if("hevc"===e){let t,e,i,r,s,a;if(o)t=o.generalProfileSpace,e=o.generalProfileIdc,i=Ex(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=gx(n),l=o.getUint8(1);t=l>>6&3,e=31&l,i=Ex(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=fx(Vx).level;for(const t of Vx)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=fx(Vx).level;for(const t of Vx)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?bx[i.primaries]:1,u=null!=i&&i.transfer?xx[i.transfer]:1,d=null!=i&&i.matrix?_x[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}'.`)},Hx=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:$x(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&&qx.includes(e))return e;throw new TypeError(`Unhandled codec '${e}'.`)},Kx=/^pcm-([usf])(\d+)+(be)?$/,Xx=[48e3,44100,32e3],Yx=[24e3,22050,16e3];var Qx,Jx;!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"}(Qx||(Qx={})),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"}(Jx||(Jx={}));const Zx=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})},tw=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=Mx(i,n):(hx(4===e),t=i.getUint32(n,!1)),n+=e,yield{offset:n,length:t},n+=t}},ew=t=>31&t,nw=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)},iw=t=>t>>1&63,rw=function*(t){const e=new Wx(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);hx(e.pos%8==0),yield{type:i,data:t.subarray(e.pos/8,e.pos/8+s)},e.skipBits(8*s)}};var ow;!function(t){t[t.STREAMINFO=0]="STREAMINFO",t[t.VORBIS_COMMENT=4]="VORBIS_COMMENT",t[t.PICTURE=6]="PICTURE"}(ow||(ow={}));const sw=[2,1,2,3,3,4,4,5];class aw{constructor(t){this.input=t}}const lw=[],cw=[],uw=new Uint8Array(0);class dw{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===uw&&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===uw}get microsecondTimestamp(){return Math.trunc(Px*this.timestamp)}get microsecondDuration(){return Math.trunc(Px*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 dw(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 dw(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 hw=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.")},fw=t=>{if(!Bx(t))throw new TypeError("timestamp must be a number.")},pw=(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 mw{constructor(t){if(!(t instanceof gw))throw new TypeError("track must be an InputTrack.");this._track=t}getFirstPacket(t={}){if(hw(t),this._track.input._disposed)throw new jw;return pw(this._track,this._track._backing.getFirstPacket(t),t)}async getFirstKeyPacket(t={}){hw(t);const e=await this.getFirstPacket(t);return e?"key"===e.type?e:this.getNextKeyPacket(e,t):null}getPacket(t,e={}){if(fw(t),hw(e),this._track.input._disposed)throw new jw;return pw(this._track,this._track._backing.getPacket(t,e),e)}getNextPacket(t,e={}){if(!(t instanceof dw))throw new TypeError("packet must be an EncodedPacket.");if(hw(e),this._track.input._disposed)throw new jw;return pw(this._track,this._track._backing.getNextPacket(t,e),e)}async getKeyPacket(t,e={}){if(fw(t),hw(e),this._track.input._disposed)throw new jw;if(!e.verifyKeyPackets)return this._track._backing.getKeyPacket(t,e);const n=await this._track._backing.getKeyPacket(t,e);return n?(hx("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 dw))throw new TypeError("packet must be an EncodedPacket.");if(hw(e),this._track.input._disposed)throw new jw;if(!e.verifyKeyPackets)return this._track._backing.getNextKeyPacket(t,e);const n=await this._track._backing.getNextKeyPacket(t,e);return n?(hx("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 dw))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 dw))throw new TypeError("endPacket must be an EncodedPacket.");if(hw(n),this._track.input._disposed)throw new jw;const i=[];let{promise:r,resolve:o}=Ax(),{promise:s,resolve:a}=Ax(),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}=Ax()),await s):(i.push(u),o(),({promise:r,resolve:o}=Ax()),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 jw;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 gw{constructor(t,e){this.input=t,this._backing=e}isVideoTrack(){return this instanceof vw}isAudioTrack(){return this instanceof yw}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 mw(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 vw extends gw{constructor(t,e){super(t,e),this._backing=e,this.pixelAspectRatio=(t=>{hx(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 hx(null!==e),lw.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 dw))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 hx(e),((t,e,n)=>{switch(t){case"avc":for(const t of((t,e)=>{if(e.description){const n=3&mx(e.description)[4];return tw(t,n+1)}return Zx(t)})(n,e)){const e=n[t.offset],r=ew(e);if(r>=Qx.NON_IDR_SLICE&&r<=Qx.SLICE_DPC)return"delta";if(r===Qx.IDR)return"key";if(r===Qx.SEI&&(i=void 0,!(null!==Cx?Cx:Cx=!("undefined"==typeof navigator||(null===(i=navigator.vendor)||void 0===i||!i.includes("Google Inc"))&&!/Chrome/.test(navigator.userAgent)))||Rx()>=144)){const e=n.subarray(t.offset,t.offset+t.length),i=nw(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 Wx(i);t.pos=8*r;const e=px(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&mx(e.description)[21];return tw(t,n+1)}return Zx(t)})(n,e)){const e=iw(n[t.offset]);if(e<Jx.BLA_W_LP)return"delta";if(e<=Jx.RSV_IRAP_VCL23)return"key"}return"delta";case"vp8":return 1&n[0]?"delta":"key";case"vp9":{const t=new Wx(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 rw(n))if(1===e){const e=new Wx(i);e.skipBits(4),t=!!e.readBits(1)}else if(3===e||6===e||7===e){if(t)return"key";const e=new Wx(i);return e.readBits(1)?null:0===e.readBits(2)?"key":"delta"}return null}default:(t=>{throw new Error(`Unexpected value: ${t}`)})(t),hx(!1)}var i})(this.codec,e,t.data)}}class yw extends gw{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 hx(null!==e),cw.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 dw))throw new TypeError("packet must be an EncodedPacket.");return null===this.codec?null:"key"}}const bw=t=>{let e=Qw(t);const n=n_(t,4);let i=8;1===e&&(e=Zw(t),i=16);const r=e-i;return r<0?null:{name:n,totalSize:e,headerSize:i,contentSize:r}},kw=t=>Jw(t)/65536,xw=t=>Jw(t)/1073741824,ww=t=>{let e=0;for(let n=0;n<4;n++){e<<=7;const n=Hw(t);if(e|=127&n,!(128&n))break}return e},_w=t=>{let e=Kw(t);return t.skip(2),e=Math.min(e,t.remainingLength),vx.decode(Gw(t,e))},Tw=t=>{const e=bw(t);if(!e||"data"!==e.name)return null;if(t.remainingLength<8)return null;const n=Qw(t);t.skip(4);const i=Gw(t,e.contentSize-8);switch(n){case 1:return vx.decode(i);case 2:return new TextDecoder("utf-16be").decode(i);case 13:return new Lx(i,"image/jpeg");case 14:return new Lx(i,"image/png");case 27:return new Lx(i,"image/bmp");default:return i}};class Iw extends aw{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=bw(e);if(!i)break;if("ftyp"===i.name){const t=n_(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),hx(t);const e=Qw(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=bw(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,hx(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&&qx.includes(t.info.codec)&&0===n.sampleCompositionTimeOffsets.length){var r;hx("audio"===(null===(r=t.info)||void 0===r?void 0:r.type));const e=(t=>{if(hx(qx.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=Kx.exec(t);let n;return hx(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=Nx(n.sampleTimingEntries,a,(t=>t.startIndex)),u=n.sampleTimingEntries[c],d=Nx(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=fx(i);m&&m.delta===p?m.count++:i.push({startIndex:s.startChunkIndex+r,startDecodeTimestamp:f,count:1,delta:p});const g=s.samplesPerChunk*e.sampleSize*t.info.numberOfChannels;o.push(g)}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),hx(n);const i=bw(n);hx("moof"===(null==i?void 0:i.name));let r=this.reader.requestSlice(t,i.totalSize);r instanceof Promise&&(r=await r),hx(r),this.traverseBox(r);const o=this.lastReadFragment;hx(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)Pw(t,i.timestamp);else{const e=Nx(n,o.moofOffset-1,(t=>t.moofOffset));if(-1!==e){const i=n[e];Pw(t,i.endTimestamp)}}t.startTimestampIsFinal=!0}const i=Nx(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=bw(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,g,v,y,b,k,x,w,_,T,I,E,S,N,A,M,F,O,P,C,D,R;const B=t.filePos,L=bw(t);if(!L)return!1;const z=t.filePos,W=B+L.totalSize;switch(L.name){case"mdia":case"minf":case"dinf":case"mfra":case"edts":case"wave":this.readContiguousBoxes(t.slice(z,L.contentSize));break;case"mvhd":{const e=Hw(t);t.skip(3),1===e?(t.skip(16),this.movieTimescale=Qw(t),this.movieDurationInTimescale=Zw(t)):(t.skip(8),this.movieTimescale=Qw(t),this.movieDurationInTimescale=Qw(t))}break;case"trak":{const e={id:-1,demuxer:this,inputTrack:null,disposition:{...zx},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,L.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 vw(this.input,new Sw(t)),this.tracks.push(e)}else if("audio"===e.info.type&&-1!==e.info.numberOfChannels){const t=e;e.inputTrack=new yw(this.input,new Nw(t)),this.tracks.push(e)}this.currentTrack=null}break;case"tkhd":{const e=this.currentTrack;if(!e)break;const n=Hw(t),i=!!(1&Xw(t));if(e.disposition.default=i,0===n)t.skip(8),e.id=Qw(t),t.skip(4),e.durationInMovieTimescale=Qw(t);else{if(1!==n)throw new Error(`Incorrect track header version ${n}.`);t.skip(16),e.id=Qw(t),t.skip(4),e.durationInMovieTimescale=Zw(t)}t.skip(16);const r=[kw(t),kw(t),xw(t),kw(t),kw(t),xw(t),kw(t),kw(t),xw(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}.`)})((Ot=Cw(r),90*Math.round(Ot/90)));hx(0===o||90===o||180===o||270===o),e.rotation=o}break;case"elst":{const e=this.currentTrack;if(!e)break;const n=Hw(t);t.skip(3);let i=!1,r=0;const o=Qw(t);for(let s=0;s<o;s++){const o=1===n?Zw(t):Qw(t),s=1===n?t_(t):Jw(t),a=kw(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=Hw(t);t.skip(3),0===n?(t.skip(8),e.timescale=Qw(t),e.durationInMediaTimescale=Qw(t)):1===n&&(t.skip(16),e.timescale=Qw(t),e.durationInMediaTimescale=Zw(t));let i=Kw(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,Ox.test(Ft)||(e.languageCode="und")}}break;case"hdlr":{const e=this.currentTrack;if(!e)break;t.skip(8);const n=n_(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=B,this.readContiguousBoxes(t.slice(z,L.contentSize))}break;case"stsd":{const e=this.currentTrack;if(!e)break;if(null===e.info||e.sampleTable)break;const n=Hw(t);t.skip(3);const i=Qw(t);for(let r=0;r<i;r++){const i=t.filePos,r=bw(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=Kw(t),e.info.height=Kw(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=Kw(t);t.skip(6);let a=Kw(t),l=Kw(t);t.skip(4);let c=Qw(t)/65536;if(0===n&&s>0)if(1===s)t.skip(4),l=8*Qw(t),t.skip(8);else if(2===s){t.skip(4),c=e_(t),a=Qw(t),t.skip(4),l=Qw(t);const n=Qw(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;hx(e.info),e.info.codecDescription=Gw(t,L.contentSize)}break;case"hvcC":{const e=this.currentTrack;if(!e)break;hx(e.info),e.info.codecDescription=Gw(t,L.contentSize)}break;case"vpcC":{var U;const e=this.currentTrack;if(!e)break;hx("video"===(null===(U=e.info)||void 0===U?void 0:U.type)),t.skip(4);const n=Hw(t),i=Hw(t),r=Hw(t),o=r>>4,s=r>>1&7,a=1&r,l=Hw(t),c=Hw(t),u=Hw(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;hx("video"===(null===(j=e.info)||void 0===j?void 0:j.type)),t.skip(1);const n=Hw(t),i=n>>5,r=31&n,o=Hw(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 $;const e=this.currentTrack;if(!e)break;if(hx("video"===(null===($=e.info)||void 0===$?void 0:$.type)),"nclx"!==n_(t,4))break;const n=Kw(t),i=Kw(t),r=Kw(t),o=Boolean(128&Hw(t));e.info.colorSpace={primaries:kx[n],transfer:wx[i],matrix:Tx[r],fullRange:o}}break;case"pasp":{var q;const e=this.currentTrack;if(!e)break;hx("video"===(null===(q=e.info)||void 0===q?void 0:q.type));const n=Qw(t),i=Qw(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;hx("audio"===(null===(V=e.info)||void 0===V?void 0:V.type)),t.skip(4),hx(3===Hw(t)),ww(t),t.skip(2);const n=Hw(t),i=!!(64&n),r=!!(32&n);if(!!(128&n)&&t.skip(2),i){const e=Hw(t);t.skip(e)}r&&t.skip(2),hx(4===Hw(t));const o=ww(t),s=t.filePos,a=Hw(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){hx(5===Hw(t));const n=ww(t);if(e.info.codecDescription=Gw(t,n),"aac"===e.info.codec){const t=$x(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;hx("audio"===(null===(G=e.info)||void 0===G?void 0:G.type)),255&Kw(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;hx("audio"===(null===(H=e.info)||void 0===H?void 0:H.type)),t.skip(4);const n=Hw(t),i=Boolean(1&n),r=Hw(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;hx("audio"===(null===(K=e.info)||void 0===K?void 0:K.type)),t.skip(1);const n=Hw(t),i=Kw(t),r=Qw(t),o=Yw(t),s=Hw(t);let a;a=0!==s?Gw(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;hx("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=Hw(t),o=Xw(t);if((r&n)===ow.STREAMINFO){t.skip(10);const n=Qw(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=Gw(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;hx("audio"===(null===(Y=e.info)||void 0===Y?void 0:Y.type));const n=Gw(t,3),i=new Wx(n),r=i.readBits(2);i.skipBits(8);const o=i.readBits(3),s=i.readBits(1);r<3&&(e.info.sampleRate=Xx[r]),e.info.numberOfChannels=sw[o]+s}break;case"dec3":{var Q;const e=this.currentTrack;if(!e)break;hx("audio"===(null===(Q=e.info)||void 0===Q?void 0:Q.type));const n=(t=>{if(t.length<2)return null;const e=new Wx(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}})(Gw(t,L.contentSize));if(!n){console.warn("Invalid dec3 box contents, ignoring.");break}const i=(t=>{const e=t.substreams[0];return hx(e),e.fscod<3?Xx[e.fscod]:null!==e.fscod2&&e.fscod2<3?Yx[e.fscod2]:null})(n);null!==i&&(e.info.sampleRate=i),e.info.numberOfChannels=(t=>{const e=t.substreams[0];hx(e);let n=sw[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=Qw(t);let i=0,r=0;for(let o=0;o<n;o++){const n=Qw(t),o=Qw(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=Qw(t);let i=0;for(let r=0;r<n;r++){const n=Qw(t),r=Jw(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=Qw(t),i=Qw(t);if(0===n)for(let n=0;n<i;n++){const n=Qw(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=Hw(t),i=Qw(t),r=Gw(t,Math.ceil(i*n/8)),o=new Wx(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=Qw(t);for(let i=0;i<n;i++){const n=Qw(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=Qw(t);for(let i=0;i<n;i++){const n=Qw(t)-1,i=Qw(t),r=Qw(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=Qw(t);for(let i=0;i<n;i++){const n=Qw(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=Qw(t);for(let i=0;i<n;i++){const n=Zw(t);e.sampleTable.chunkOffsets.push(n)}}break;case"mvex":this.isFragmented=!0,this.readContiguousBoxes(t.slice(z,L.contentSize));break;case"mehd":{const e=Hw(t);t.skip(3);const n=1===e?Zw(t):Qw(t);this.movieDurationInTimescale=n}break;case"trex":{t.skip(4);const e=Qw(t),n=Qw(t),i=Qw(t),r=Qw(t),o=Qw(t);this.fragmentTrackDefaults.push({trackId:e,defaultSampleDescriptionIndex:n,defaultSampleDuration:i,defaultSampleSize:r,defaultSampleFlags:o})}break;case"tfra":{const e=Hw(t);t.skip(3);const n=Qw(t),i=this.tracks.find((t=>t.id===n));if(!i)break;const r=Qw(t),o=(12&r)>>2,s=3&r,a=[Hw,Kw,Xw,Qw],l=a[(48&r)>>4],c=a[o],u=a[s],d=Qw(t);for(let n=0;n<d;n++){const n=1===e?Zw(t):Qw(t),r=1===e?Zw(t):Qw(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:B,moofSize:L.totalSize,implicitBaseDataOffset:B,trackData:new Map},this.readContiguousBoxes(t.slice(z,L.contentSize)),this.lastReadFragment=this.currentFragment,this.currentFragment=null;break;case"traf":if(hx(this.currentFragment),this.readContiguousBoxes(t.slice(z,L.contentSize)),this.currentTrack){const t=this.currentFragment.trackData.get(this.currentTrack.id);if(t){const{currentFragmentState:e}=this.currentTrack;hx(e),null!==e.startTimestamp&&(Pw(t,e.startTimestamp),t.startTimestampIsFinal=!0)}this.currentTrack.currentFragmentState=null,this.currentTrack=null}break;case"tfhd":{var J,Z,tt,et;hx(this.currentFragment),t.skip(1);const e=Xw(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=Qw(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=Zw(t):l&&(u.currentFragmentState.baseDataOffset=this.currentFragment.moofOffset),i&&(u.currentFragmentState.sampleDescriptionIndex=Qw(t)),r&&(u.currentFragmentState.defaultSampleDuration=Qw(t)),o&&(u.currentFragmentState.defaultSampleSize=Qw(t)),s&&(u.currentFragmentState.defaultSampleFlags=Qw(t)),a&&(u.currentFragmentState.defaultSampleDuration=0)}break;case"tfdt":{const e=this.currentTrack;if(!e)break;hx(e.currentFragmentState);const n=Hw(t);t.skip(3);const i=0===n?Qw(t):Zw(t);e.currentFragmentState.startTimestamp=i}break;case"trun":{const e=this.currentTrack;if(!e)break;if(hx(this.currentFragment),hx(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=Hw(t),i=Xw(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=Qw(t);let d=e.currentFragmentState.baseDataOffset;r&&(d+=Jw(t));let h=null;o&&(h=Qw(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=Qw(t):(hx(null!==e.currentFragmentState.defaultSampleDuration),r=e.currentFragmentState.defaultSampleDuration),a?o=Qw(t):(hx(null!==e.currentFragmentState.defaultSampleSize),o=e.currentFragmentState.defaultSampleSize),l?u=Qw(t):(hx(null!==e.currentFragmentState.defaultSampleFlags),u=e.currentFragmentState.defaultSampleFlags),0===i&&null!==h&&(u=h);let d=0;c&&(d=0===n?Qw(t):Jw(t));const g=!(65536&u);m.samples.push({presentationTimestamp:p+d,duration:r,byteOffset:f,byteSize:o,isKeyFrame:g}),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 g=m.samples[m.presentationTimestamps[0].sampleIndex],v=m.samples[fx(m.presentationTimestamps).sampleIndex];m.startTimestamp=g.presentationTimestamp,m.endTimestamp=v.presentationTimestamp+v.duration,this.currentFragment.implicitBaseDataOffset=f}break;case"udta":{const v=this.iterateContiguousBoxes(t.slice(z,L.contentSize));for(const{boxInfo:t,slice:y}of v){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]=_w(y)):null!==(ct=(at=this.metadataTags.raw)[lt=t.name])&&void 0!==ct||(at[lt]=Gw(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=vx.decode(Gw(y,t.contentSize)):null!==(n=(e=this.metadataTags).title)&&void 0!==n||(e.title=_w(y));break;case"©des":this.currentTrack||null!==(r=(i=this.metadataTags).description)&&void 0!==r||(i.description=_w(y));break;case"©ART":this.currentTrack||null!==(s=(o=this.metadataTags).artist)&&void 0!==s||(o.artist=_w(y));break;case"©alb":this.currentTrack||null!==(l=(a=this.metadataTags).album)&&void 0!==l||(a.album=_w(y));break;case"albr":this.currentTrack||null!==(u=(c=this.metadataTags).albumArtist)&&void 0!==u||(c.albumArtist=_w(y));break;case"©gen":this.currentTrack||null!==(h=(d=this.metadataTags).genre)&&void 0!==h||(d.genre=_w(y));break;case"©day":if(!this.currentTrack){var ut,dt;const t=new Date(_w(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=_w(y));break;case"©lyr":this.currentTrack||null!==(g=(m=this.metadataTags).lyrics)&&void 0!==g||(m.lyrics=_w(y))}}}break;case"meta":{if(this.currentTrack)break;const e=0!==Qw(t);this.currentMetadataKeys=new Map,e?this.readContiguousBoxes(t.slice(z,L.contentSize)):this.readContiguousBoxes(t.slice(z+4,L.contentSize-4)),this.currentMetadataKeys=null}break;case"keys":{if(!this.currentMetadataKeys)break;t.skip(4);const e=Qw(t);for(let n=0;n<e;n++){const e=Qw(t);t.skip(4);const i=vx.decode(Gw(t,e-8));this.currentMetadataKeys.set(n+1,i)}}break;case"ilst":{if(!this.currentMetadataKeys)break;const e=this.iterateContiguousBoxes(t.slice(z,L.contentSize));for(const{boxInfo:t,slice:n}of e){var ht,ft,pt,mt,gt;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=Tw(n);switch(null!==(ft=(ht=this.metadataTags).raw)&&void 0!==ft||(ht.raw={}),null!==(gt=(pt=this.metadataTags.raw)[mt=e])&&void 0!==gt||(pt[mt]=r),e){case"©nam":case"titl":case"com.apple.quicktime.title":case"title":"string"==typeof r&&(null!==(y=(v=this.metadataTags).title)&&void 0!==y||(v.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!==(w=(x=this.metadataTags).artist)&&void 0!==w||(x.artist=r));break;case"©alb":case"albm":case"com.apple.quicktime.album":case"album":"string"==typeof r&&(null!==(T=(_=this.metadataTags).album)&&void 0!==T||(_.album=r));break;case"aART":case"album_artist":"string"==typeof r&&(null!==(E=(I=this.metadataTags).albumArtist)&&void 0!==E||(I.albumArtist=r));break;case"©cmt":case"com.apple.quicktime.comment":case"comment":"string"==typeof r&&(null!==(N=(S=this.metadataTags).comment)&&void 0!==N||(S.comment=r));break;case"©gen":case"gnre":case"com.apple.quicktime.genre":case"genre":"string"==typeof r&&(null!==(M=(A=this.metadataTags).genre)&&void 0!==M||(A.genre=r));break;case"©lyr":case"lyrics":"string"==typeof r&&(null!==(O=(F=this.metadataTags).lyrics)&&void 0!==O||(F.lyrics=r));break;case"©day":case"rldt":case"com.apple.quicktime.creationdate":case"date":if("string"==typeof r){var vt,yt;const t=new Date(r);Number.isNaN(t.getTime())||null!==(yt=(vt=this.metadataTags).date)&&void 0!==yt||(vt.date=t)}break;case"covr":case"com.apple.quicktime.artwork":r instanceof Lx?(null!==(C=(P=this.metadataTags).images)&&void 0!==C||(P.images=[]),this.metadataTags.images.push({data:r.data,kind:"coverFront",mimeType:r.mimeType})):r instanceof Uint8Array&&(null!==(R=(D=this.metadataTags).images)&&void 0!==R||(D.images=[]),this.metadataTags.images.push({data:r,kind:"coverFront",mimeType:"image/*"}));break;case"track":if("string"==typeof r){var bt,kt,xt,wt;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!==(wt=(xt=this.metadataTags).tracksTotal)&&void 0!==wt||(xt.tracksTotal=n))}break;case"trkn":if(r instanceof Uint8Array&&r.length>=6){var _t,Tt,It,Et;const t=gx(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!==(Et=(It=this.metadataTags).tracksTotal)&&void 0!==Et||(It.tracksTotal=n))}break;case"disc":case"disk":if(r instanceof Uint8Array&&r.length>=6){var St,Nt,At,Mt;const t=gx(r),e=t.getUint16(2,!1),n=t.getUint16(4,!1);e>0&&(null!==(Nt=(St=this.metadataTags).discNumber)&&void 0!==Nt||(St.discNumber=e)),n>0&&(null!==(Mt=(At=this.metadataTags).discsTotal)&&void 0!==Mt||(At.discsTotal=n))}}}}}var Ft,Ot;return t.filePos=W,!0}}class Ew{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=Aw(i,n),o=await this.fetchPacketForSampleIndex(r,e);return Dw(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=Nx(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=Mw(i,n),o=await this.fetchPacketForSampleIndex(r,e);return Dw(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=Ow(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 hx(-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=Fw(n,t);if(!i)return null;let r;if(e.metadataOnly)r=uw;else{let t=this.internalTrack.demuxer.reader.requestSlice(i.sampleOffset,i.sampleSize);t instanceof Promise&&(t=await t),hx(t),r=Gw(t,i.sampleSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new dw(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(hx(i),n.metadataOnly)r=uw;else{let t=this.internalTrack.demuxer.reader.requestSlice(i.byteOffset,i.byteSize);t instanceof Promise&&(t=await t),hx(t),r=Gw(t,i.byteSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new dw(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=Nx(this.internalTrack.fragmentLookupTable,n,(t=>t.timestamp)),h=-1!==d?this.internalTrack.fragmentLookupTable[d]:null,f=Nx(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 g;for(t?null===m||t.moofOffset>=m?(g=t.moofOffset+t.moofSize,l=t):g=m:g=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(g,8,16);if(t instanceof Promise&&(t=await t),!t)break;const n=g,o=bw(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)}g=n+o.totalSize}if(h&&(!c||c.moofOffset<h.moofOffset)){var v;const t=this.internalTrack.fragmentLookupTable[d-1];hx(!t||t.timestamp<h.timestamp);const n=null!==(v=null==t?void 0:t.timestamp)&&void 0!==v?v:-1/0;return this.performFragmentedLookup(null,e,n,i,r)}return c?this.fetchPacketInFragment(c,u,r):null}}class Sw extends Ew{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 rw(t)){if(1!==e)continue;const t=new Wx(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 g=1,v=1,y=0;return m||(0===i?(g=1,v=1):1===i?(g=0,v=0):12===p&&(g=t.readBits(1),g&&(v=t.readBits(1))),g&&v&&(y=t.readBits(2))),{profile:i,level:o,tier:s,bitDepth:p,monochrome:m,chromaSubsamplingX:g,chromaSubsamplingY:v,chromaSamplePosition:y}}return null})(t.data)}}else{const t=await this.getFirstPacket({});this.internalTrack.info.vp9CodecInfo=t&&(t=>{const e=new Wx(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=fx(Vx).level;for(const t of Vx)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:Gx(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 Nw extends Ew{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:Hx(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 Aw=(t,e)=>{if(t.presentationTimestamps){const n=Nx(t.presentationTimestamps,e,(t=>t.presentationTimestamp));return-1===n?-1:t.presentationTimestamps[n].sampleIndex}{const n=Nx(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)}},Mw=(t,e)=>{if(!t.keySampleIndices)return Aw(t,e);if(t.presentationTimestamps){const n=Nx(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!==Sx(t.keySampleIndices,n,(t=>t)))return n}return-1}{var n;const i=Aw(t,e),r=Nx(t.keySampleIndices,i,(t=>t));return null!==(n=t.keySampleIndices[r])&&void 0!==n?n:-1}},Fw=(t,e)=>{const n=Nx(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=Nx(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=Nx(t.sampleToChunk,e,(t=>t.startSampleIndex)),c=t.sampleToChunk[l];hx(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];hx(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!==Sx(t.keySampleIndices,e,(t=>t))}},Ow=(t,e)=>{var n;if(!t.keySampleIndices)return e+1;const i=Nx(t.keySampleIndices,e,(t=>t));return null!==(n=t.keySampleIndices[i+1])&&void 0!==n?n:-1},Pw=(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},Cw=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},Dw=t=>0===t.sampleSizes.length;class Rw{}class Bw extends Rw{async _getMajorBrand(t){let e=t._reader.requestSlice(0,12);return e instanceof Promise&&(e=await e),e?(e.skip(4),"ftyp"!==n_(e,4)?null:n_(e,4)):null}_createDemuxer(t){return new Iw(t)}}const Lw=new class extends Bw{async _canReadInput(t){const e=await this._getMajorBrand(t);return!!e&&"qt "!==e}get name(){return"MP4"}get mimeType(){return"video/mp4"}};class zw{constructor(){this._disposed=!1,this._sizePromise=null,this.onread=null}async getSizeOrNull(){var t;if(this._disposed)throw new jw;return null!==(t=this._sizePromise)&&void 0!==t?t:this._sizePromise=Promise.resolve(this._retrieveSize())}async getSize(){if(this._disposed)throw new jw;const t=await this.getSizeOrNull();if(null===t)throw new Error("Cannot determine the size of an unsized source.");return t}}class Ww extends zw{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&&(!Bx(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=Nx(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:gx(o),offset:t};this._currentIndex>r&&this._throwDueToCacheMiss();const{promise:s,resolve:a,reject:l}=Ax();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:gx(e.bytes),offset:e.start}),this._pendingSlices.splice(t,1),t--))}for(this._cache.push({start:i,end:r,bytes:n,view:gx(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!==(be=Symbol.dispose)&&void 0!==be||(Symbol.dispose=Symbol("Symbol.dispose"));class Uw{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 Rw))))throw new TypeError("options.formats must be an array of InputFormat.");if(!(t.source instanceof zw))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 $w(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(),hx(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 jw extends Error{constructor(t="Input has been disposed."){super(t),this.name="InputDisposedError"}}class $w{constructor(t){this.source=t}requestSlice(t,e){if(this.source._disposed)throw new jw;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 qw(e.bytes,e.view,e.offset,t,n):null)):i?new qw(i.bytes,i.view,i.offset,t,n):null}requestSliceRange(t,e,n){if(this.source._disposed)throw new jw;if(t<0)return null;if(null!==this.fileSize)return this.requestSlice(t,Fx(this.fileSize-t,e,n));{const i=this.requestSlice(t,n),r=i=>{if(i)return i;const r=i=>(hx(null!==i),this.requestSlice(t,Fx(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 qw{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 qw(t,gx(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 qw(this.bytes,this.view,this.offset,t,t+e)}}const Vw=(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.`)},Gw=(t,e)=>{Vw(t,e);const n=t.bytes.subarray(t.bufferPos,t.bufferPos+e);return t.bufferPos+=e,n},Hw=t=>(Vw(t,1),t.view.getUint8(t.bufferPos++)),Kw=t=>{Vw(t,2);const e=t.view.getUint16(t.bufferPos,!1);return t.bufferPos+=2,e},Xw=t=>{Vw(t,3);const e=Mx(t.view,t.bufferPos);return t.bufferPos+=3,e},Yw=t=>{Vw(t,2);const e=t.view.getInt16(t.bufferPos,!1);return t.bufferPos+=2,e},Qw=t=>{Vw(t,4);const e=t.view.getUint32(t.bufferPos,!1);return t.bufferPos+=4,e},Jw=t=>{Vw(t,4);const e=t.view.getInt32(t.bufferPos,!1);return t.bufferPos+=4,e},Zw=t=>4294967296*Qw(t)+Qw(t),t_=t=>4294967296*Jw(t)+Qw(t),e_=t=>{Vw(t,8);const e=t.view.getFloat64(t.bufferPos,!1);return t.bufferPos+=8,e},n_=(t,e)=>{Vw(t,e);let n="";for(let i=0;i<e;i++)n+=String.fromCharCode(t.bytes[t.bufferPos++]);return n};var i_=new WeakMap,r_=new WeakMap,o_=new WeakMap,s_=new WeakMap,a_=new WeakMap,l_=new WeakMap,c_=new WeakMap,u_=new WeakMap,d_=new WeakMap,h_=new WeakMap,f_=new WeakMap,p_=new WeakMap,m_=new WeakMap,g_=new WeakMap,v_=new WeakMap,y_=new WeakSet;class b_ extends Jc{constructor(...t){super(...t),j(this,y_),W(this,i_,null),W(this,r_,null),W(this,o_,null),W(this,s_,null),W(this,a_,!1),W(this,l_,!1),W(this,c_,!1),W(this,u_,!1),W(this,d_,void 0),W(this,h_,null),W(this,f_,null),W(this,p_,!1),W(this,m_,!1),W(this,g_,null),W(this,v_,!1)}get name(){return"FMP4Demuxer"}get defaults(){return{}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"pushChunk","endOfStream"])}pushChunk(t,e={}){if(z(c_,this)||z(u_,this))return;const n=t instanceof Uint8Array?t:new Uint8Array(t),i=!!e.isInit;U(h_,this,B(y_,this,I_).call(this,n,e,i)),i&&(U(d_,this,n),U(f_,this,null),this.trigger("demux:init",{data:n})),B(y_,this,T_).call(this);try{var r;const t=null===(r=z(i_,this))||void 0===r?void 0:r.write(n);t&&"function"==typeof t.catch&&t.catch((t=>{B(y_,this,E_).call(this,t)}))}catch(t){if(z(c_,this)||B(y_,this,k_).call(this,t))return;return this.log.warn("[FMP4Demuxer] mediabunny demux failed",t),void B(y_,this,E_).call(this,t)}const o=B(y_,this,A_).call(this);o&&"function"==typeof o.catch&&o.catch((t=>{B(y_,this,E_).call(this,t)}))}endOfStream(){if(z(u_,this))return;if(z(p_,this))return;let t;U(p_,this,!0),U(m_,this,!1),U(v_,this,!1);try{var e;t=null===(e=z(i_,this))||void 0===e?void 0:e.close()}catch(e){t=Promise.resolve()}let n=!1;B(y_,this,w_).call(this),U(g_,this,setTimeout((()=>{U(g_,this,null),n||z(m_,this)||z(u_,this)||B(y_,this,__).call(this)}),20)),Promise.resolve(t).catch((()=>{})).finally((()=>{n=!0,B(y_,this,w_).call(this),B(y_,this,__).call(this)}))}onDispose(){super.onDispose(),U(u_,this,!0);try{var t,e;null===(t=z(o_,this))||void 0===t||null===(e=t.close)||void 0===e||e.call(t)}catch(t){}this.endOfStream();try{var n,i;null===(n=z(r_,this))||void 0===n||null===(i=n.dispose)||void 0===i||i.call(n)}catch(t){}U(o_,this,null),U(r_,this,null),U(c_,this,!1),U(h_,this,null),U(s_,this,null),U(a_,this,!1),U(l_,this,!1),U(p_,this,!1),U(m_,this,!1),U(v_,this,!1),B(y_,this,w_).call(this)}}function k_(t){return!!z(u_,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 x_(){try{var t,e;const n=null===(t=z(i_,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){}U(i_,this,null)}function w_(){null!==z(g_,this)&&(clearTimeout(z(g_,this)),U(g_,this,null))}function __(){if(z(m_,this)||z(u_,this)||z(c_,this))return;if(U(m_,this,!0),z(l_,this))return void U(v_,this,!0);U(v_,this,!1);const t=B(y_,this,A_).call(this);t&&"function"==typeof t.catch&&t.catch((t=>{B(y_,this,E_).call(this,t)}))}function T_(){if(z(r_,this)&&z(i_,this))return;const t=eu.TransformStream;if(void 0===t)throw new Error("TransformStream is not available in this environment");const{readable:e,writable:n}=new t;U(i_,this,n.getWriter()),U(r_,this,new Uw({source:new Ww(e),formats:[Lw]})),U(a_,this,!1)}function I_(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(z(c_,this)||B(y_,this,k_).call(this,t))return;if(B(y_,this,N_).call(this,t))return void U(a_,this,!1);U(c_,this,!0),B(y_,this,x_).call(this);try{var e,n;null===(e=z(o_,this))||void 0===e||null===(n=e.close)||void 0===n||n.call(e)}catch(t){}U(o_,this,null);try{var i,r;null===(i=z(r_,this))||void 0===i||null===(r=i.dispose)||void 0===r||r.call(i)}catch(t){}U(r_,this,null);const o={error:t,recoverable:!1,severity:"fatal",streamClosed:z(p_,this),streamFinalized:z(m_,this)};z(h_,this)&&(o.context={...z(h_,this)}),this.trigger("demux:error",o)}function S_(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 N_(t){return!!B(y_,this,S_).call(this,t)&&(!z(m_,this)||z(v_,this))}async function A_(){if(!(z(u_,this)||z(c_,this)||z(a_,this)||z(l_,this))){U(l_,this,!0);try{B(y_,this,T_).call(this);const t=await z(r_,this).getPrimaryVideoTrack(),e=t?null:await z(r_,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 z(r_,this).getMimeType();this.trigger("demux:init",{...z(d_,this)?{data:z(d_,this)}:{},decoderConfig:i,codec:r,mimeType:o}),U(o_,this,new mw(n)),U(a_,this,!0),U(s_,this,(async()=>{try{for await(const t of z(o_,this).packets()){if(z(u_,this))break;const e="number"==typeof t.timestamp?t.timestamp:0;null===z(f_,this)&&U(f_,this,e);let n=e-z(f_,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){B(y_,this,E_).call(this,t)}})())}catch(t){if(B(y_,this,N_).call(this,t))return;throw t}finally{U(l_,this,!1),!z(v_,this)||z(c_,this)||z(u_,this)||B(y_,this,__).call(this)}}}const M_=1e6,F_=24e3/1001,O_=new Uint8Array;function P_(t){return t?t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):O_:O_}let C_=null;const D_={video:(ke=new WeakMap,xe=new WeakMap,we=new WeakMap,_e=new WeakMap,Te=new WeakMap,Ie=new WeakMap,Ee=new WeakMap,Se=new WeakMap,Ne=new WeakMap,Ae=new WeakMap,Me=new WeakMap,Fe=new WeakMap,Oe=new WeakMap,Pe=new WeakMap,Ce=new WeakMap,De=new WeakMap,Re=new WeakMap,Be=new WeakMap,Le=new WeakMap,ze=new WeakMap,We=new WeakMap,Ue=new WeakMap,je=new WeakMap,$e=new WeakMap,qe=new WeakMap,Ve=new WeakMap,Ge=new WeakMap,He=new WeakMap,Ke=new WeakMap,Xe=new WeakMap,Ye=new WeakMap,Qe=new WeakMap,Je=new WeakMap,Ze=new WeakMap,tn=new WeakSet,class extends dx{get name(){return"WebCodecsSegmentDecoder"}get defaults(){return{decodedHorizonSeconds:1,maxDecodedFrames:24,maxDecodeQueueSize:4,convertFramesToBitmapsOnAndroid:!0,androidFixEndOfSegmentDelta:.2}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"decodeChunk"])}constructor(...t){super(...t),j(this,tn),W(this,ke,void 0),W(this,xe,[]),W(this,we,void 0),W(this,_e,void 0),W(this,Te,void 0),W(this,Ie,void 0),W(this,Ee,[]),W(this,Se,void 0),W(this,Ne,new Map),W(this,Ae,!0),W(this,Me,!1),W(this,Fe,!1),W(this,Oe,!1),W(this,Pe,void 0),W(this,Ce,!1),W(this,De,!1),W(this,Re,0),W(this,Be,void 0),W(this,Le,void 0),W(this,ze,{}),W(this,We,void 0),W(this,Ue,0),W(this,je,null),W(this,$e,!1),W(this,qe,null),W(this,Ve,void 0),W(this,Ge,0),W(this,He,0),W(this,Ke,0),W(this,Xe,0),W(this,Ye,!1),W(this,Qe,!1),W(this,Je,.2),W(this,Ze,Promise.resolve()),U(we,this,this.settings.decodedHorizonSeconds||1),U(_e,this,B(tn,this,IT).call(this,this.settings.maxDecodedFrames)),U(Te,this,B(tn,this,ST).call(this,this.settings.maxDecodeQueueSize)),U(Ye,this,qp()),U(Qe,this,B(tn,this,vT).call(this,this.settings.convertFramesToBitmapsOnAndroid)),U(Je,this,B(tn,this,yT).call(this,this.settings.androidFixEndOfSegmentDelta)),U(Ie,this,(()=>0)),U(Se,this,(()=>B(tn,this,lT).call(this)));const e=this.settings.demuxerOptions?{FMP4Demuxer:this.settings.demuxerOptions}:{};U(ke,this,new b_(e)),z(ke,this).on("demux:init",(t=>B(tn,this,J_).call(this,t))),z(ke,this).on("demux:sample",(t=>B(tn,this,Z_).call(this,t))),z(ke,this).on("demux:complete",(()=>B(tn,this,tT).call(this))),z(ke,this).on("demux:error",(t=>B(tn,this,U_).call(this,t)))}setCurrentTimeProvider(t){"function"==typeof t&&U(Ie,this,t)}setTimeOffsetSeconds(t){const e=Number(t);U(Ue,this,Number.isFinite(e)?e:0)}setSeekTargetTimeSeconds(t){const e=Number(t);U(je,this,Number.isFinite(e)?e:null),U($e,this,!1),U(qe,this,null)}endOfStream(){z(ke,this)&&"function"==typeof z(ke,this).endOfStream&&z(ke,this).endOfStream()}configure(t){super.configure(t),U(ze,this,{codec:B(tn,this,AT).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)}),U(Be,this,z(ze,this).codec)}setSegment(t){this.lastSegment=t,B(tn,this,K_).call(this)}setNodeId(t){U(Ve,this,t)}decode(t){this.setSegment(t);const e=null==t?void 0:t.arrayBuffer;e&&z(ke,this).pushChunk(e,{isInit:!(null==t||!t.isInit)})}async decodeChunk(t,e={}){await z(ke,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 z(xe,this).slice()}onDispose(){if(super.onDispose(),B(tn,this,dT).call(this),z(ke,this)&&"function"==typeof z(ke,this).dispose&&z(ke,this).dispose(),U(xe,this,[]),U(Ee,this,[]),z(Ne,this).clear(),U(qe,this,null),z(Pe,this)&&"function"==typeof z(Pe,this).close)try{z(Pe,this).close()}catch(t){}U(Pe,this,null),U(Ce,this,!1),U(Le,this,null),U(Be,this,null),U(Ve,this,null),U(Ze,this,Promise.resolve()),B(tn,this,K_).call(this)}}),audio:(en=new WeakMap,nn=new WeakMap,rn=new WeakMap,on=new WeakMap,sn=new WeakMap,an=new WeakMap,ln=new WeakMap,cn=new WeakSet,class extends dx{constructor(...t){super(...t),j(this,cn),W(this,en,void 0),W(this,nn,[]),W(this,rn,0),W(this,on,!1),W(this,sn,!1),W(this,an,void 0),W(this,ln,0)}get name(){return"WebAudioDecoder"}setSegment(t){U(an,this,t)}setTimeOffsetSeconds(t){const e=Number(t);U(ln,this,Number.isFinite(e)?e:0)}decode(t){if(this.lastSegment=t,!t)return;if(t.isInit)return void U(en,this,P_(t.arrayBuffer));const e=t.arrayBuffer;e&&B(cn,this,L_).call(this,P_(e),!0)}decodeChunk(t,e={}){if(!t)return;if(e.isInit)return void U(en,this,P_(t));const n=P_(t);if(!n.length)return;z(nn,this).push(n),U(rn,this,z(rn,this)+n.length);const i=Number(e.loaded),r=Number(e.total);Number.isFinite(i)&&Number.isFinite(r)&&r>0&&i>=r&&B(cn,this,R_).call(this)}endOfStream(){B(cn,this,R_).call(this)}onDispose(){super.onDispose(),U(en,this,void 0),U(nn,this,[]),U(rn,this,0),U(on,this,!1),U(sn,this,!1),U(an,this,void 0)}}),image:class extends dx{#B;#L=0;#z=[];#W=0;#U;get name(){return"ImageDecoder"}setSegment(t){this.#B=t}setTimeOffsetSeconds(t){const e=Number(t);this.#L=Number.isFinite(e)?e:0}decode(t){super.decode(t),t&&(this.#B=t);const e=null==t?void 0:t.arrayBuffer;e instanceof ArrayBuffer&&(this.#z=[new Uint8Array(e)],this.#W=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.#z.push(n),this.#W+=n.length)}async endOfStream(){var t,e,n;if(this.#U)return;if(!(this.#z.length&&this.#W>0))return;const i=new Uint8Array(this.#W);let r=0;for(let t=0;t<this.#z.length;t+=1){const e=this.#z[t];i.set(e,r),r+=e.length}const o=null===(t=this.#B)||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 eu.Blob)return;const n="string"==typeof e?e:"";return new eu.Blob([t],n?{type:n}:void 0)}(t,e);if(!n)throw new Error("Image decode requires Blob support");let i;if("function"==typeof eu.Image&&eu.URL&&"function"==typeof eu.URL.createObjectURL&&"function"==typeof eu.URL.revokeObjectURL){const t=eu.URL.createObjectURL(n);try{const e=new eu.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{eu.URL.revokeObjectURL(t)}}if("function"==typeof eu.createImageBitmap)try{return eu.createImageBitmap(n)}catch(t){i=t}if(i)throw i;throw new Error("No supported image decode mechanism")}(i,s);this.#U=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&&(vg(o.width)||(o.width=e.width),vg(o.height)||(o.height=e.height)),this.trigger("decoder:frame",{pts:this.#L,duration:vg(null===(a=this.#B)||void 0===a?void 0:a.duration)?this.#B.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.#U&&"function"==typeof this.#U.close)try{this.#U.close()}catch(t){}this.#U=null,this.#z=[],this.#W=0,this.#B=null}}};function R_(){if(z(on,this)||z(sn,this))return;if(!z(rn,this))return;const t=B(cn,this,B_).call(this);t.length&&B(cn,this,L_).call(this,t,!1)}function B_(){const t=z(en,this),e=t?t.length:0,n=e+z(rn,this);if(!n)return O_;const i=new Uint8Array(n);let r=0;e&&(i.set(t,r),r+=e);for(let t=0;t<z(nn,this).length;t+=1){const e=z(nn,this)[t];e&&e.length&&(i.set(e,r),r+=e.length)}return i}function L_(t,e){if(z(on,this)||z(sn,this))return;const n=e?B(cn,this,z_).call(this,t):t;if(!n||!n.length)return;const i=function(){if(C_)return C_;const t=eu.AudioContext||eu.webkitAudioContext;return t?(C_=new t,C_):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);U(sn,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;U(on,this,!0);const n=Number.isFinite(null==t?void 0:t.duration)?t.duration:Number(null===(e=z(an,this))||void 0===e?void 0:e.duration)||void 0;this.trigger("decoder:audio",{audioBuffer:t,pts:z(ln,this),duration:n})})).catch((t=>{this.trigger("decoder:error",{error:t})})).finally((()=>{U(nn,this,[]),U(rn,this,0),U(sn,this,!1)}))}function z_(t){const e=z(en,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 W_(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:z(Ve,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=z(ze,this))||void 0===r?void 0:r.codec)||z(Be,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 U_(t){const e=(null==t?void 0:t.error)||t,n=B(tn,this,W_).call(this,t,e);if(B(tn,this,j_).call(this,t,e))return this.log.warn("[onDemuxError] recoverable demux error",n),void B(tn,this,tT).call(this);const i=B(tn,this,Q_).call(this,t),r=B(tn,this,$_).call(this,i);if(i&&0===i.missingFrames)return this.log.warn(`[onDemuxError] ignoring demux error (no missing frames)${r}`,{...n,missingFrameStats:i}),void B(tn,this,tT).call(this);let o=n;i&&(o={...n,missingFrameStats:i}),this.log.warn(`[onDemuxError] demux error${r}`,o),this.trigger("decoder:error",t)}function j_(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 $_(t){return t?` expectedFrames=${B(tn,this,q_).call(this,t.expectedFrames)} demuxedFrames=${B(tn,this,q_).call(this,t.demuxedFrames)} missingFrames=${B(tn,this,q_).call(this,t.missingFrames)}`:""}function q_(t){if(null==t)return"unknown";const e=Number(t);return Number.isFinite(e)?String(e):"unknown"}function V_(t,e={}){return{expectedFrames:null,demuxedFrames:z(Ge,this),missingFrames:null,reason:t,...e}}function G_(t){const e=Number(t);return Number.isFinite(e)?e:null}function H_(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 B(tn,this,V_).call(this,"segment_duration_unavailable",{segmentDurationSeconds:B(tn,this,G_).call(this,s),demuxedCoverageSeconds:z(Xe,this),frameDurationSeconds:null});const a=B(tn,this,Y_).call(this);if(!Number.isFinite(a)||a<=0){const t=Math.max(1,Math.round(s*F_));return{expectedFrames:t,demuxedFrames:z(Ge,this),missingFrames:Math.max(0,t-z(Ge,this)),reason:"fallback_fps",fallbackFps:F_,segmentDurationSeconds:s,demuxedCoverageSeconds:z(Xe,this),frameDurationSeconds:B(tn,this,G_).call(this,a)}}const l=Math.min(.5*a,.02),c=Math.max(0,s-z(Xe,this)),u=c<=l?0:c,d=Math.max(1,Math.floor((s+l)/a)),h=Math.max(0,d-z(Ge,this)),f=u>0?Math.ceil(u/a):0;return{expectedFrames:d,demuxedFrames:z(Ge,this),missingFrames:Math.max(h,f),segmentDurationSeconds:s,demuxedCoverageSeconds:z(Xe,this),frameDurationSeconds:a}}function K_(){U(Ge,this,0),U(He,this,0),U(Ke,this,0),U(Xe,this,0)}function X_(t){U(Ge,this,z(Ge,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&&(U(He,this,z(He,this)+n),U(Ke,this,z(Ke,this)+1)),!Number.isFinite(e))return;const i=Number.isFinite(n)&&n>0?e+n:e;Number.isFinite(i)&&i>z(Xe,this)&&U(Xe,this,i)}function Y_(){return z(Ke,this)>0?z(He,this)/z(Ke,this):z(Ge,this)>0&&z(Xe,this)>0?z(Xe,this)/z(Ge,this):null}function Q_(t){return B(tn,this,H_).call(this,t)}function J_(t){(null==t?void 0:t.data)instanceof Uint8Array&&(U(Le,this,t.data.buffer),B(tn,this,fT).call(this)),null!=t&&t.decoderConfig&&(U(We,this,t.decoderConfig),U(Be,this,t.decoderConfig.codec||z(Be,this)),B(tn,this,fT).call(this)),this.trigger("decoder:init",t)}function Z_(t){B(tn,this,X_).call(this,t),z(Ee,this).push(t),B(tn,this,lT).call(this)}function tT(){U(Me,this,!0),B(tn,this,pT).call(this)}function eT(t){const e="number"==typeof(null==t?void 0:t.pts)?t.pts:void 0;if(Number.isFinite(e))return z(Ue,this)+e}function nT(t){return z(Ee,this).some((e=>{const n=B(tn,this,eT).call(this,e);return Number.isFinite(n)&&n>=t}))}function iT(t){let e=-1,n=null;for(let i=0;i<z(Ee,this).length;i+=1){const r=z(Ee,this)[i],o=B(tn,this,eT).call(this,r);Number.isFinite(o)&&(null==r?void 0:r.isKey)&&o<=t&&(e=i,n=o)}return{chosenIndex:e,chosenPtsSeconds:n}}function rT(t){let e=-1,n=null;for(let i=0;i<z(Ee,this).length;i+=1){const r=z(Ee,this)[i],o=B(tn,this,eT).call(this,r);if(Number.isFinite(o)&&null!=r&&r.isKey&&(e=i,n=o,o>=t))break}return{chosenIndex:e,chosenPtsSeconds:n}}function oT(t){const e=t+z(we,this),n=z(je,this);if(!Number.isFinite(n))return e;const i=Number.isFinite(z(qe,this))?z(qe,this):null;if(Number.isFinite(i))return Math.max(e,i);const{chosenPtsSeconds:r}=B(tn,this,rT).call(this,n);return Number.isFinite(r)?Math.max(e,r):e}function sT(t){const e=z(je,this);Number.isFinite(e)&&Number.isFinite(t)&&t>=e&&(U(je,this,null),U(qe,this,null))}function aT(){const t=z(je,this);if(!Number.isFinite(t)||z($e,this))return!0;if(!B(tn,this,nT).call(this,t)&&!z(Me,this))return!1;const e=B(tn,this,iT).call(this,t);let n=e;if(-1===e.chosenIndex&&(n=B(tn,this,rT).call(this,t)),n.chosenIndex>0){const t=`[#maybeAlignToSeekKeyframe] Dropping ${n.chosenIndex} samples before keyframe @ ${n.chosenPtsSeconds}`;this.log.debug(t),z(Ee,this).splice(0,n.chosenIndex)}return U(Ae,this,!0),Number.isFinite(n.chosenPtsSeconds)&&U(qe,this,n.chosenPtsSeconds),U($e,this,!0),!0}function lT(){const t=z(Ie,this)?z(Ie,this).call(this):0,e=B(tn,this,oT).call(this,t);if(B(tn,this,_T).call(this,t),B(tn,this,TT).call(this),!B(tn,this,aT).call(this))return void B(tn,this,uT).call(this);const n=void 0!==eu.VideoDecoder&&void 0!==eu.EncodedVideoChunk;for(n&&!z(Ce,this)&&z(We,this)&&B(tn,this,fT).call(this);z(Ee,this).length&&!B(tn,this,ET).call(this)&&!(n&&z(Pe,this)&&B(tn,this,NT).call(this));){const t=z(Ee,this)[0],i="number"==typeof(null==t?void 0:t.pts)?t.pts:0,r=z(Ue,this)+i;if(r>e)break;if(null!=t&&t.raw)z(Ee,this).shift(),B(tn,this,cT).call(this,t);else{if(n){if(!z(Ce,this)||!z(Pe,this))break;if(z(Ae,this)&&!t.isKey){z(Ee,this).shift();continue}z(Ee,this).shift();const e=Math.max(0,Math.round(r*M_));z(Ne,this).set(e,!!t.isKey);try{const n=new eu.EncodedVideoChunk({type:t.isKey?"key":"delta",timestamp:e,duration:t.duration?Math.round(t.duration*M_):void 0,data:t.data instanceof Uint8Array?t.data:new Uint8Array(t.data)});z(Pe,this).decode(n),t.isKey&&U(Ae,this,!1);continue}catch(t){z(Ne,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")){U(Ae,this,!0);continue}this.log.warn("[#drainDecodeQueue] decode failed, falling back to placeholder",t)}}z(Ee,this).shift(),B(tn,this,cT).call(this,t)}}B(tn,this,pT).call(this),B(tn,this,uT).call(this)}function cT(t){const e=z(Ie,this)?z(Ie,this).call(this):0,n=B(tn,this,oT).call(this,e),i=z(Ue,this)+("number"==typeof t.pts?t.pts:0);if(i<e||i>n)return;B(tn,this,_T).call(this,e);const r={pts:i,duration:t.duration,data:t.data,isKey:t.isKey};z(xe,this).push(r),B(tn,this,TT).call(this),this.trigger("decoder:frame",r),B(tn,this,sT).call(this,i)}function uT(){if(z(Ee,this).length>0&&void 0!==eu.VideoDecoder){if(Eb(z(Se,this)))return;Tb(z(Se,this),50)}else B(tn,this,dT).call(this)}function dT(){z(Se,this)&&Eb(z(Se,this))&&Ib(z(Se,this))}function hT(){return null!=eu&&eu.performance&&"function"==typeof eu.performance.now?eu.performance.now():Date.now()}function fT(){if(z(Ce,this))return;if(void 0===eu.VideoDecoder)return;if(!z(We,this))return;if(z(De,this)&&B(tn,this,hT).call(this)<z(Re,this))return;const t={...z(We,this)};!t.codec&&z(Be,this)&&(t.codec=z(Be,this)),z(Le,this)&&!t.description&&(t.description=z(Le,this)),z(ze,this).width&&!t.codedWidth&&(t.codedWidth=z(ze,this).width),z(ze,this).height&&!t.codedHeight&&(t.codedHeight=z(ze,this).height);try{U(Pe,this,new eu.VideoDecoder({output:t=>B(tn,this,gT).call(this,t),error:t=>B(tn,this,mT).call(this,t)})),z(Pe,this).configure(t),U(Ce,this,!0),U(Ae,this,!0),U(De,this,!1),U(Re,this,0),B(tn,this,lT).call(this)}catch(t){this.log.warn("[#maybeConfigureDecoder] configure failed, falling back to placeholder decode",t),U(Pe,this,null),U(Ce,this,!1),U(We,this,null)}}function pT(){void 0!==eu.VideoDecoder&&void 0!==eu.EncodedVideoChunk&&(z(De,this)||!z(Me,this)||z(Oe,this)||z(Fe,this)||z(Ce,this)&&z(Pe,this)&&"function"==typeof z(Pe,this).flush&&(z(Ee,this).length||(U(Fe,this,!0),Promise.resolve().then((()=>z(Pe,this).flush())).then((()=>{U(Oe,this,!0),U(Ae,this,!0)})).catch((t=>{"AbortError"!==(null==t?void 0:t.name)&&this.log.warn("[#maybeFlushDecoder] flush failed",t)})).finally((()=>{U(Fe,this,!1)})))))}function mT(t){if(this.log.warn("[#handleDecoderError] decoder error",t),this.trigger("decoder:error",{error:t}),z(Pe,this)&&"function"==typeof z(Pe,this).close)try{z(Pe,this).close()}catch(t){}U(Pe,this,null),U(Ce,this,!1),U(Fe,this,!1),U(Oe,this,!1),U(Ae,this,!0),z(Ne,this).clear(),U(De,this,!0),U(Re,this,B(tn,this,hT).call(this)+1e3)}function gT(t){U(Ze,this,z(Ze,this).then((()=>{var e;if(!this._disposed)return B(tn,this,wT).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 vT(t){return"boolean"!=typeof t||t}function yT(t){const e=Number(t);return!Number.isFinite(e)||e<0?.2:e}function bT(){return!!z(Qe,this)&&"function"==typeof eu.createImageBitmap&&z(Ye,this)}function kT(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(z(Ue,this));return!!Number.isFinite(i)&&t>=i+n-z(Je,this)}async function xT(t,e){try{var n;const i=B(tn,this,kT).call(this,e),r=await eu.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 wT(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/M_:z(Ie,this)?z(Ie,this).call(this):0,s="number"==typeof t.duration?t.duration/M_:void 0;let a;void 0!==r&&(a=z(Ne,this).get(r),z(Ne,this).delete(r));try{var l,c,u,d;let e=z(Ie,this)?z(Ie,this).call(this):0,n=B(tn,this,oT).call(this,e);if(o<e||o>n)return void(null===(l=(c=i).close)||void 0===l||l.call(c));if(B(tn,this,bT).call(this)){var h,f,p,m;if(i=await B(tn,this,xT).call(this,t,o),this._disposed)return void(null===(h=(f=i).close)||void 0===h||h.call(f));if(e=z(Ie,this)?z(Ie,this).call(this):0,n=B(tn,this,oT).call(this,e),o<e||o>n)return void(null===(p=(m=i).close)||void 0===p||p.call(m))}if(B(tn,this,_T).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};z(xe,this).push(r),B(tn,this,TT).call(this),this.trigger("decoder:frame",r),B(tn,this,sT).call(this,o),this.log.debug(`[#handleDecodedFrame] [${z(ze,this).codec}] Decoded frame:`,r)}catch(t){this.log.warn(`[#handleDecodedFrame] [${z(ze,this).codec}] Failed to handle decoded frame`,t);try{var g,v;null===(g=(v=i).close)||void 0===g||g.call(v)}catch(t){}}}function _T(t){const e=B(tn,this,oT).call(this,t),n=[];z(xe,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)})),U(xe,this,n)}function TT(){const t=z(_e,this);if(!Number.isFinite(t)||t<=0)return;if(z(xe,this).length<=t)return;const e=z(xe,this).length-t;z(xe,this).splice(0,e)}function IT(t){const e=Number(t);return!Number.isFinite(e)||e<=0?0:Math.floor(e)}function ET(){const t=z(_e,this);return!(!Number.isFinite(t)||t<=0)&&z(xe,this).length>=t}function ST(t){const e=Number(t);return!Number.isFinite(e)||e<=0?0:Math.floor(e)}function NT(){var t;const e=z(Te,this);if(!Number.isFinite(e)||e<=0)return!1;const n=Number(null===(t=z(Pe,this))||void 0===t?void 0:t.decodeQueueSize);return!!Number.isFinite(n)&&n>=e}function AT(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 MT extends Jc{get name(){return"DecoderFactory"}create(t,e){if(!t||!t.type)return new dx(e);const n=D_[t.type];return n?(this.log.debug(`[#create] [${t.type}] Creating decoder:`,n),new n(e)):new dx(e)}}class FT{#j;#$;#q;#V;constructor(t={}){this.#j=t.getActiveRenderPlacement,this.#$=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.#$?this.#$:()=>[],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 OT{#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 PT=new Set(["video","audio","image"]);function CT(t){const e=Number(t);return Number.isFinite(e)?e:0}var DT=new WeakMap,RT=new WeakMap,BT=new WeakMap,LT=new WeakMap,zT=new WeakMap,WT=new WeakMap,UT=new WeakMap,jT=new WeakMap,$T=new WeakMap,qT=new WeakMap,VT=new WeakMap,GT=new WeakMap,HT=new WeakMap,KT=new WeakMap,XT=new WeakMap,YT=new WeakMap,QT=new WeakMap,JT=new WeakMap,ZT=new WeakMap,tI=new WeakSet;class eI extends Jc{constructor(...t){super(...t),j(this,tI),W(this,DT,void 0),W(this,RT,void 0),W(this,BT,void 0),W(this,LT,void 0),W(this,zT,void 0),W(this,WT,void 0),W(this,UT,void 0),W(this,jT,void 0),W(this,$T,void 0),W(this,qT,void 0),W(this,VT,void 0),W(this,GT,new Map),W(this,HT,new Map),W(this,KT,new Map),W(this,XT,new Map),W(this,YT,new Set),W(this,QT,0),W(this,JT,!1),W(this,ZT,null);const[e,n,i]=t;U(DT,this,e),U(RT,this,n),U(BT,this,i||new MT),U(LT,this,new OT({getNode:t=>B(tI,this,II).call(this,t),getPlacementState:t=>z(GT,this).get(t),getDecodeTracks:t=>B(tI,this,kI).call(this,t),getSegmentIdForTrackAtTime:(t,e,n)=>B(tI,this,cI).call(this,t,e,n),decodeLoadedMediaSegment:(t,e,n)=>{B(tI,this,VI).call(this,t,e,n)},decodeLoadedMediaSegmentsAfter:(t,e,n)=>{B(tI,this,BI).call(this,t,e,n)}})),U(zT,this,new FT({getActiveRenderPlacement:t=>{var e,n;return null===(e=z(RT,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=z(RT,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=z(LT,this))||void 0===n||null===(i=n.ensureDecodedForPlacementAtTime)||void 0===i||i.call(n,t,e)}})),B(tI,this,nI).call(this),B(tI,this,vI).call(this)}get name(){return"DecodeCoordinator"}onDispose(){var t,e;z(RT,this)&&"function"==typeof z(RT,this).off&&z(WT,this)&&z(RT,this).off(Jp.PLACEMENT_ADDED,z(WT,this)),z(RT,this)&&"function"==typeof z(RT,this).off&&z(UT,this)&&z(RT,this).off(Jp.TIMELINE_SEEKING,z(UT,this)),z(RT,this)&&"function"==typeof z(RT,this).off&&z(jT,this)&&z(RT,this).off(Jp.TIMELINE_SEEKED,z(jT,this)),z(RT,this)&&"function"==typeof z(RT,this).off&&z($T,this)&&z(RT,this).off(Jp.TIMELINE_TIME_UPDATE,z($T,this)),z(RT,this)&&"function"==typeof z(RT,this).off&&z(qT,this)&&z(RT,this).off(Jp.TIMELINE_RESET,z(qT,this)),B(tI,this,iI).call(this),U(WT,this,null),U(UT,this,null),U(jT,this,null),U($T,this,null),U(qT,this,null),null!==(t=z(LT,this))&&void 0!==t&&null!==(e=t.dispose)&&void 0!==e&&e.call(t),U(LT,this,null),z(zT,this)&&"function"==typeof z(zT,this).dispose&&z(zT,this).dispose(),U(zT,this,null),z(HT,this).forEach(((t,e)=>{const n=B(tI,this,II).call(this,e);n&&"function"==typeof n.off&&n.off("node:loaded",t)})),z(HT,this).clear(),z(KT,this).forEach(((t,e)=>{const n=B(tI,this,II).call(this,e);n&&"function"==typeof n.off&&n.off("segment:chunk",t)})),z(KT,this).clear(),z(XT,this).clear(),z(YT,this).clear(),B(tI,this,pI).call(this),z(GT,this).forEach((({trackStates:t})=>{t&&t.forEach((t=>{B(tI,this,AI).call(this,t)}))})),z(GT,this).clear()}}function nI(){z(RT,this)&&"function"==typeof z(RT,this).on&&(U(WT,this,(t=>{B(tI,this,yI).call(this,t)})),z(RT,this).on(Jp.PLACEMENT_ADDED,z(WT,this)),U(UT,this,(t=>B(tI,this,rI).call(this,t))),z(RT,this).on(Jp.TIMELINE_SEEKING,z(UT,this)),U(jT,this,(()=>B(tI,this,oI).call(this))),z(RT,this).on(Jp.TIMELINE_SEEKED,z(jT,this)),U($T,this,(t=>B(tI,this,sI).call(this,t))),z(RT,this).on(Jp.TIMELINE_TIME_UPDATE,z($T,this)),U(qT,this,(()=>B(tI,this,aI).call(this))),z(RT,this).on(Jp.TIMELINE_RESET,z(qT,this))),(null==eu?void 0:eu.document)&&"function"==typeof eu.document.addEventListener&&(U(VT,this,(()=>{B(tI,this,mI).call(this)})),eu.document.addEventListener("visibilitychange",z(VT,this)))}function iI(){z(VT,this)&&null!=eu&&eu.document&&"function"==typeof eu.document.removeEventListener&&eu.document.removeEventListener("visibilitychange",z(VT,this)),U(VT,this,null)}function rI(t={}){const e=Number(null==t?void 0:t.targetTime);Number.isFinite(e)&&(z(GT,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||(B(tI,this,lI).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=z(GT,this).get(n);if(!r||!r.trackStates)return;const o=B(tI,this,II).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||B(tI,this,lI).call(this,n,r.placement||t,e)})),B(tI,this,RI).call(this,r.placement||t,o))})))}function oI(){z(GT,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 sI(t={}){var e,n;B(tI,this,DI).call(this,null==t?void 0:t.time),null!==(e=z(zT,this))&&void 0!==e&&null!==(n=e.handleTimeUpdate)&&void 0!==n&&n.call(e,t),B(tI,this,mI).call(this),B(tI,this,MI).call(this,null==t?void 0:t.time)}function aI(){z(HT,this).forEach(((t,e)=>{const n=B(tI,this,II).call(this,e);n&&"function"==typeof n.off&&n.off("node:loaded",t)})),z(HT,this).clear(),z(KT,this).forEach(((t,e)=>{const n=B(tI,this,II).call(this,e);n&&"function"==typeof n.off&&n.off("segment:chunk",t)})),z(KT,this).clear(),z(XT,this).clear(),z(YT,this).clear(),z(GT,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()}))}))})),z(GT,this).clear()}function lI(t,e,n){t&&(B(tI,this,AI).call(this,t),t.seekSegmentId=B(tI,this,cI).call(this,t.track,e,n))}function cI(t,e,n){if(!t||!e||!Array.isArray(t.segments))return null;const i=ep(e);if(!Number.isFinite(i))return null;const r=CT(null==e?void 0:e.nodeOffsetOverride),o=Math.max(0,n-i+r),s=CT(null==t?void 0:t.offset),a=Math.max(0,o-s),l="function"==typeof t.getMediaSegmentAtTime?t.getMediaSegmentAtTime(a,{preferRepresentationTime:!0}):Sv(t.segments,a,{preferRepresentationTime:!0});return(null==l?void 0:l.id)||null}function uI(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 dI(){const t=null==eu?void 0:eu.document;return!t||"string"!=typeof t.visibilityState||"visible"===t.visibilityState}function hI(){var t;const e=z(RT,this);if(!e||"number"!=typeof e.currentTime)return!1;if(e.state===sm)return!1;const n=Date.now();if(n<z(QT,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=B(tI,this,fI).call(this,i),!Number.isFinite(a))return!1;return U(QT,this,n+1500),this.log.warn("[DecodeCoordinator] attempting decoder recovery seek"),e.currentTime=a,!0}function fI(t){var e;const n=z(RT,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=ep(t);if(!Number.isFinite(e))return;(!Number.isFinite(d)||e<d)&&(d=e);const n=Zf(t,z(DT,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 pI(){U(JT,this,!1),U(ZT,this,null)}function mI(){z(JT,this)&&B(tI,this,dI).call(this)&&B(tI,this,hI).call(this)}function gI(t){if(!B(tI,this,uI).call(this,t))return;const e=z(RT,this);e&&"number"==typeof e.currentTime&&(U(JT,this,!0),U(ZT,this,t),B(tI,this,dI).call(this)&&B(tI,this,hI).call(this))}function vI(t){var e;(Array.isArray(null===(e=z(RT,this))||void 0===e?void 0:e.placements)?[...z(RT,this).placements]:[]).filter((e=>"function"!=typeof t||t(e))).sort(((t,e)=>{const n=ep(t),i=ep(e);return(Number.isFinite(n)?n:Number.POSITIVE_INFINITY)-(Number.isFinite(i)?i:Number.POSITIVE_INFINITY)})).forEach((t=>{B(tI,this,yI).call(this,t)}))}async function yI(t){if(!t||!t.placementId||z(GT,this).has(t.placementId))return;const e=t.nodeId;if(!e||!z(DT,this)||"function"!=typeof z(DT,this).get)return;const n=B(tI,this,II).call(this,e);if(n){if(n.state&&"ready"!==n.state){if("function"==typeof n.resolve)try{await n.resolve()}catch(t){return void this.log.warn(`[#processPlacement] Failed to resolve node ${e}`,t)}if("ready"!==n.state)return}if(B(tI,this,CI).call(this,t))return B(tI,this,PI).call(this,t,n),void z(YT,this).add(t.placementId);B(tI,this,OI).call(this,t,n)}}function bI(t){return B(tI,this,kI).call(this,t).every((t=>B(tI,this,FI).call(this,t)))}function kI(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).filter((t=>PT.has(null==t?void 0:t.type)))}function xI(t){if(!t||!t.id||"function"!=typeof t.on)return;if(z(HT,this).has(t.id))return;const e=()=>{B(tI,this,LI).call(this,t.id)};t.on("node:loaded",e),z(HT,this).set(t.id,e)}function wI(t){if(!t||!t.id||"function"!=typeof t.on)return;if(z(KT,this).has(t.id))return;const e=t=>B(tI,this,zI).call(this,t);t.on("segment:chunk",e),z(KT,this).set(t.id,e)}function _I(t,e){if(!t||!e)return;const n=z(XT,this).get(t)||new Set;n.add(e),z(XT,this).set(t,n)}function TI(t){return z(XT,this).get(t)||new Set}function II(t){if(t&&z(DT,this)&&"function"==typeof z(DT,this).get)return z(DT,this).get(t)}function EI(t){if(!t)return;const e=t.fullBufferRetryTimer;null!=e&&("function"==typeof(null==eu?void 0:eu.clearTimeout)?eu.clearTimeout.bind(eu):clearTimeout)(e),t.fullBufferRetryTimer=null,t.fullBufferDecodeScheduled=!1,t.fullBufferRetryAttempts=0}function SI(t){const e=null==t?void 0:t.segmentStates;e&&"function"==typeof e.forEach&&e.forEach((t=>{B(tI,this,EI).call(this,t)}))}function NI(t,e,n,i){var r,o;if(!(t&&e&&n&&i))return!1;const s=z(GT,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 AI(t){if(!t)return;B(tI,this,SI).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 MI(t){const e=CT(t);if(!Number.isFinite(e))return;const n=e-2;Number.isFinite(n)&&z(GT,this).forEach((t=>{const e=null==t?void 0:t.placement;if(!e)return;const i=ep(e),r=Zf(e,z(DT,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||B(tI,this,AI).call(this,t)}))}))}function FI(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 OI(t,e){if(this.log.debug(`[#startDecode] [${t.placementId}] [${e.id}] Starting decode`),B(tI,this,PI).call(this,t,e)){if(B(tI,this,_I).call(this,e.id,t.placementId),!B(tI,this,bI).call(this,e))return B(tI,this,xI).call(this,e),void B(tI,this,wI).call(this,e);B(tI,this,RI).call(this,t,e),B(tI,this,wI).call(this,e)}}function PI(t,e){if(!t||!t.placementId||!e)return;const n=z(GT,this).get(t.placementId);if(n)return n.placement=t,n;const i=B(tI,this,kI).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(Jp.DECODE_ERROR,em({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 z(GT,this).set(t.placementId,o),o}function CI(t){var e;const n=ep(t),i=CT(null===(e=z(RT,this))||void 0===e?void 0:e.currentTime);return!Number.isFinite(n)||!!Number.isFinite(i)&&n-i>2}function DI(t){if(!z(YT,this).size)return;const e=CT(t);if(!Number.isFinite(e))return;const n=[];z(YT,this).forEach((t=>{const i=z(GT,this).get(t),r=null==i?void 0:i.placement;if(!r)return void n.push(t);const o=ep(r);Number.isFinite(o)&&o-e<=2&&n.push(t)})),n.forEach((t=>{z(YT,this).delete(t);const e=z(GT,this).get(t),n=null==e?void 0:e.placement;if(!n)return;const i=B(tI,this,II).call(this,n.nodeId);i&&B(tI,this,OI).call(this,n,i)}))}function RI(t,e){const n=z(GT,this).get(t.placementId);n&&B(tI,this,kI).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;B(tI,this,VI).call(this,t,i,n),r.seekSegmentId&&"video"===(null==i?void 0:i.type)&&B(tI,this,BI).call(this,t,i,n),r.ready=!0,this.trigger(Jp.DECODE_READY,tm({placementId:t.placementId,nodeId:e.id,trackId:i.id,trackType:i.type}))}catch(n){this.trigger(Jp.DECODE_ERROR,em({placementId:t.placementId,nodeId:e.id,trackId:null==i?void 0:i.id,trackType:null==i?void 0:i.type,error:n}))}}))}function BI(t,e,n){var i;if(!(t&&e&&n&&Array.isArray(e.segments)))return;const r=null==t?void 0:t.placementId,o=r?z(GT,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(B(tI,this,VI).call(this,t,e,i),u+=1,u>=2)break}}function LI(t){const e=B(tI,this,II).call(this,t);e&&B(tI,this,bI).call(this,e)&&B(tI,this,TI).call(this,t).forEach((t=>{const n=z(GT,this).get(t);B(tI,this,RI).call(this,(null==n?void 0:n.placement)||{placementId:t},e)}))}function zI(t){t&&t.nodeId&&t.trackId&&t.chunk&&B(tI,this,TI).call(this,t.nodeId).forEach((e=>B(tI,this,WI).call(this,e,t)))}function WI(t,e){const n=z(GT,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&&B(tI,this,VI).call(this,n.placement,s,a)&&(i.ready=!0,this.trigger(Jp.DECODE_READY,tm({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType}))));if((null===(o=z(RT,this))||void 0===o?void 0:o.state)===sm&&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=B(tI,this,$I).call(this,n.placement,s,a);if(!u||"function"!=typeof u.decodeChunk)return;if(i.hasInit&&!c.initSent){const t=B(tI,this,qI).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;B(tI,this,UI).call(this,c,e)?d&&!c.ended&&B(tI,this,jI).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(Jp.DECODE_READY,tm({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType})))}catch(n){this.trigger(Jp.DECODE_ERROR,em({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType,error:n}))}}function UI(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 jI(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==eu?void 0:eu.setTimeout)?eu.setTimeout.bind(eu):setTimeout;i.fullBufferDecodeScheduled=!0,i.fullBufferRetryAttempts=0;const l=()=>{if(!B(tI,this,NI).call(this,r,o,s,i)||i.ended)return void B(tI,this,EI).call(this,i);if(B(tI,this,VI).call(this,t,e,n))return void B(tI,this,EI).call(this,i);i.fullBufferRetryAttempts+=1;const c=i.fullBufferRetryAttempts<=8?0:50;i.fullBufferRetryTimer=a((()=>{l()}),c)};i.fullBufferRetryTimer=a((()=>{l()}),0)}function $I(t,e,n){var i,r;const o=null==t?void 0:t.placementId;if(!o||!e||!n)return;const s=z(GT,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=z(BT,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=z(RT,this))||void 0===t?void 0:t.currentTime)?z(RT,this).currentTime:0})),c&&"function"==typeof c.setTimeOffsetSeconds){var u,d;const i=ep(t),r=CT(null==e?void 0:e.offset),o=CT(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=z(RT,this))||void 0===r?void 0:r.state)===sm&&"video"===(null==e?void 0:e.type)&&c.setSeekTargetTimeSeconds(z(RT,this).currentTime),c&&"function"==typeof c.on&&(c.on(Jp.DECODER_FRAME,(i=>{i&&(!z(JT,this)||"video"!==(null==e?void 0:e.type)&&"image"!==(null==e?void 0:e.type)||(U(JT,this,!1),U(ZT,this,null)),z(RT,this)&&"function"==typeof z(RT,this).notifyDecodedFrame&&(i.frame||i.data)&&z(RT,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(Jp.DECODER_AUDIO,(i=>{i&&i.audioBuffer&&this.trigger(Jp.DECODER_AUDIO,tm({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(Jp.DECODER_ERROR,(i=>{const r=(null==i?void 0:i.error)||i;this.trigger(Jp.DECODER_ERROR,em({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})),B(tI,this,gI).call(this,r)}))),a.segmentDecoders.set(n.id,c),c}function qI(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 VI(t,e,n){var i;if(!t||!e||!n)return!1;const r=t.placementId,o=z(GT,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=B(tI,this,$I).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 B(tI,this,EI).call(this,l),!0;if(s.hasInit&&!l.initSent){const t=B(tI,this,qI).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()),B(tI,this,EI).call(this,l),0))}const GI=1e-6;var HI=new WeakMap,KI=new WeakMap,XI=new WeakMap,YI=new WeakMap,QI=new WeakMap,JI=new WeakMap,ZI=new WeakMap,tE=new WeakMap,eE=new WeakSet;class nE extends Jc{get name(){return"TransitionManager"}get defaults(){return{durationSeconds:.5}}constructor(t,e,n){super(n),j(this,eE),W(this,HI,void 0),W(this,KI,void 0),W(this,XI,null),W(this,YI,null),W(this,QI,null),W(this,JI,0),W(this,ZI,[]),W(this,tE,null),U(HI,this,t),U(KI,this,e),z(HI,this)&&"function"==typeof z(HI,this).on&&(U(tE,this,(()=>B(eE,this,dE).call(this))),z(HI,this).on(Jp.TIMELINE_RESET,z(tE,this)))}transitionTo(t,e={}){const n=Number(t);if(!Number.isFinite(n))throw new Error("TransitionManager.transitionTo requires a numeric time");B(eE,this,dE).call(this);const i=B(eE,this,iE).call(this),r=B(eE,this,aE).call(this,n,e);return r?B(eE,this,lE).call(this,n,e,i,r):Promise.resolve()}onDispose(){z(HI,this)&&"function"==typeof z(HI,this).off&&z(tE,this)&&z(HI,this).off(Jp.TIMELINE_RESET,z(tE,this)),U(tE,this,null),B(eE,this,dE).call(this),U(KI,this,null),U(HI,this,null)}}function iE(){return U(JI,this,z(JI,this)+1),z(JI,this)}function rE(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 oE(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 sE(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 aE(t,e={}){var n;const i=z(KI,this),r=B(eE,this,rE).call(this,e);if(!i||"function"!=typeof i.startTransition)return z(HI,this).currentTime=t,null;if(!(r>0))return z(HI,this).currentTime=t,null!==(n=i.resetTransition)&&void 0!==n&&n.call(i),null;const o=B(eE,this,oE).call(this,e,r);"function"==typeof(null==e?void 0:e.onTransitionInStart)&&e.onTransitionInStart();const s=i.startTransition(o),{outDurationMs:a,inDurationMs:l}=B(eE,this,sE).call(this,r,s);return{renderer:i,transitionOptions:o,outDurationMs:a,inDurationMs:l,shouldWaitForFrames:!1!==(null==e?void 0:e.waitForVisualFrames)}}function lE(t,e={},n,i){const{renderer:r,transitionOptions:o,outDurationMs:s,inDurationMs:a,shouldWaitForFrames:l}=i,c=B(eE,this,gE).call(this,t,e,n),u=l?B(eE,this,vE).call(this,t,n):Promise.resolve();let d=!1,h=!1,f=!1,p=!l;const m=()=>{var t;B(eE,this,hE).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),U(YI,this,setTimeout((()=>{var t;B(eE,this,hE).call(this,n)&&(null!==(t=r.resetTransition)&&void 0!==t&&t.call(r),"function"==typeof(null==e?void 0:e.onTransitionOutEnd)&&e.onTransitionOutEnd(),B(eE,this,cE).call(this))}),a)))};return U(XI,this,setTimeout((()=>{d=!0,m()}),s)),c.then((()=>{h=!0,m()})).catch((()=>{var t;B(eE,this,hE).call(this,n)&&(null!==(t=r.resetTransition)&&void 0!==t&&t.call(r),B(eE,this,cE).call(this))})),u.then((()=>{p=!0,m()})).catch((()=>{p=!0,m()})),z(HI,this).currentTime=t,new Promise((t=>{U(QI,this,t)}))}function cE(){const t=z(QI,this);U(QI,this,null),B(eE,this,uE).call(this),B(eE,this,mE).call(this),t&&t()}function uE(){z(XI,this)&&clearTimeout(z(XI,this)),z(YI,this)&&clearTimeout(z(YI,this)),U(XI,this,null),U(YI,this,null)}function dE(){var t,e;z(KI,this)&&null!==(t=(e=z(KI,this)).resetTransition)&&void 0!==t&&t.call(e),B(eE,this,uE).call(this),B(eE,this,mE).call(this),z(QI,this)&&(z(QI,this).call(this),U(QI,this,null))}function hE(t){return z(JI,this)===t}function fE(t,e){z(HI,this)&&"function"==typeof z(HI,this).on&&(z(HI,this).on(t,e),z(ZI,this).push({eventName:t,handler:e}))}function pE(t,e){z(HI,this)&&"function"==typeof z(HI,this).off&&(z(HI,this).off(t,e),U(ZI,this,z(ZI,this).filter((n=>n.eventName!==t||n.handler!==e))))}function mE(){z(HI,this)&&"function"==typeof z(HI,this).off?(z(ZI,this).forEach((t=>{z(HI,this).off(t.eventName,t.handler)})),U(ZI,this,[])):U(ZI,this,[])}function gE(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(!z(HI,this)||"function"!=typeof z(HI,this).on)return Promise.resolve();const r=B(eE,this,yE).call(this);return new Promise((e=>{let i=!1;const o=r?Jp.TIMELINE_SEEKED:"nodestart";let s,a;const l=()=>{B(eE,this,pE).call(this,Jp.TIMELINE_SEEKING,s),B(eE,this,pE).call(this,o,a),e()};s=(e={})=>{B(eE,this,hE).call(this,n)?B(eE,this,bE).call(this,e,t)&&(i=!0):l()},a=(e={})=>{B(eE,this,hE).call(this,n)?(o!==Jp.TIMELINE_SEEKED||B(eE,this,bE).call(this,e,t))&&(o===Jp.TIMELINE_SEEKED||i)&&l():l()},B(eE,this,fE).call(this,Jp.TIMELINE_SEEKING,s),B(eE,this,fE).call(this,o,a)}))}function vE(t,e){if(!z(HI,this)||"function"!=typeof z(HI,this).on)return Promise.resolve();const n=Number(t);return new Promise((t=>{const i=(r={})=>{if(!B(eE,this,hE).call(this,e))return B(eE,this,pE).call(this,Jp.VISUAL_FRAMES_AVAILABLE,i),void t();const o=Number(null==r?void 0:r.time);Number.isFinite(n)&&Number.isFinite(o)&&o+GI<n||(Array.isArray(null==r?void 0:r.frames)?r.frames:[]).length&&(B(eE,this,pE).call(this,Jp.VISUAL_FRAMES_AVAILABLE,i),t())};B(eE,this,fE).call(this,Jp.VISUAL_FRAMES_AVAILABLE,i)}))}function yE(){var t,e;const n=null===(t=z(HI,this))||void 0===t?void 0:t.state;if(n===om||n===nm)return!0;const i=null===(e=z(HI,this))||void 0===e?void 0:e.placements;return!Array.isArray(i)||0===i.length}function bE(t,e){const n=Number(null==t?void 0:t.targetTime);return!Number.isFinite(n)||Math.abs(n-e)<GI}function kE(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}var xE=new WeakMap,wE=new WeakMap,_E=new WeakMap,TE=new WeakMap,IE=new WeakMap,EE=new WeakMap,SE=new WeakMap,NE=new WeakMap,AE=new WeakMap,ME=new WeakMap,FE=new WeakMap,OE=new WeakMap,PE=new WeakMap,CE=new WeakMap,DE=new WeakSet;class RE extends Jc{get name(){return"AudioPlaybackManager"}get defaults(){return{muted:!1,volume:1,lookaheadSeconds:1}}constructor(t,e,n){super(n),j(this,DE),W(this,xE,void 0),W(this,wE,void 0),W(this,_E,null),W(this,TE,null),W(this,IE,[]),W(this,EE,new Set),W(this,SE,new Map),W(this,NE,!1),W(this,AE,1),W(this,ME,!0),W(this,FE,null),W(this,OE,null),W(this,PE,null),W(this,CE,null),U(xE,this,t),U(wE,this,e),U(NE,this,!!this.settings.muted),U(AE,this,Qf(this.settings.volume));const i=Array.isArray(null==n?void 0:n.disabledTracks)?n.disabledTracks:[];U(ME,this,!i.includes("audio")),B(DE,this,BE).call(this)}get muted(){return z(NE,this)}set muted(t){U(NE,this,!!t),B(DE,this,KE).call(this)}get volume(){return z(AE,this)}set volume(t){U(AE,this,Qf(t)),B(DE,this,KE).call(this)}handleDecodedAudio(t={}){if(!z(ME,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=kE(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}`;z(EE,this).has(s)||(z(IE,this).push({key:s,placementId:n,pts:r,duration:o,audioBuffer:e}),z(IE,this).sort(((t,e)=>t.pts-e.pts)),B(DE,this,jE).call(this))}onDispose(){B(DE,this,LE).call(this),B(DE,this,GE).call(this,!0),z(_E,this)&&"function"==typeof z(_E,this).close&&z(_E,this).close(),U(_E,this,null),U(TE,this,null),U(xE,this,null),U(wE,this,null)}}function BE(){z(xE,this)&&"function"==typeof z(xE,this).on&&(U(FE,this,(t=>B(DE,this,zE).call(this,t))),z(xE,this).on(Jp.TIMELINE_TIME_UPDATE,z(FE,this)),U(OE,this,(t=>B(DE,this,WE).call(this,t))),z(xE,this).on(Jp.TIMELINE_STATE_CHANGE,z(OE,this)),U(CE,this,(()=>B(DE,this,UE).call(this))),z(xE,this).on(Jp.TIMELINE_RESET,z(CE,this))),z(wE,this)&&"function"==typeof z(wE,this).on&&(U(PE,this,(t=>this.handleDecodedAudio(t))),z(wE,this).on(Jp.DECODER_AUDIO,z(PE,this)))}function LE(){z(xE,this)&&"function"==typeof z(xE,this).off&&(z(FE,this)&&z(xE,this).off(Jp.TIMELINE_TIME_UPDATE,z(FE,this)),z(OE,this)&&z(xE,this).off(Jp.TIMELINE_STATE_CHANGE,z(OE,this)),z(CE,this)&&z(xE,this).off(Jp.TIMELINE_RESET,z(CE,this))),z(wE,this)&&"function"==typeof z(wE,this).off&&z(PE,this)&&z(wE,this).off(Jp.DECODER_AUDIO,z(PE,this)),U(FE,this,null),U(OE,this,null),U(PE,this,null),U(CE,this,null)}function zE(){B(DE,this,jE).call(this)}function WE(t={}){const e=null==t?void 0:t.to;if(e)return e===im?(B(DE,this,XE).call(this),void B(DE,this,jE).call(this)):void(e!==om&&e!==rm?e!==sm&&e!==am||B(DE,this,UE).call(this):B(DE,this,YE).call(this))}function UE(){B(DE,this,YE).call(this),B(DE,this,GE).call(this,!0),U(IE,this,[])}function jE(){if(!z(ME,this)||!z(xE,this))return;if(z(xE,this).state!==im)return;const t=B(DE,this,HE).call(this);if(!t)return;const e=kE(z(xE,this).currentTime,0),n=e+Math.max(0,kE(this.settings.lookaheadSeconds,1)),i=[];for(let r=0;r<z(IE,this).length;r+=1){const o=z(IE,this)[r];o&&(o.pts>n?i.push(o):B(DE,this,$E).call(this,o)&&B(DE,this,VE).call(this,o,t,e))}U(IE,this,i)}function $E(t){if(!t||!z(xE,this))return!1;const e=B(DE,this,qE).call(this,t.pts);return!(!e||e!==t.placementId)}function qE(t){if(!z(xE,this)||"function"!=typeof z(xE,this).getPlacementsActiveAtTime)return null;const e=z(xE,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 VE(t,e,n){const i=t.key;if(z(EE,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(z(TE,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)}z(EE,this).add(i),z(SE,this).set(i,l),l.onended=()=>{z(SE,this).delete(i)}}function GE(t){z(SE,this).forEach(((t,e)=>{if(t&&"function"==typeof t.stop)try{t.stop()}catch(t){}z(SE,this).delete(e)})),t&&z(EE,this).clear()}function HE(){if(z(_E,this))return z(_E,this);const t=eu.AudioContext||eu.webkitAudioContext;if(!t)return this.log.warn("[AudioPlaybackManager] AudioContext is not available."),null;try{return U(_E,this,new t),U(TE,this,z(_E,this).createGain()),z(TE,this).connect(z(_E,this).destination),B(DE,this,KE).call(this),z(_E,this)}catch(t){return this.log.warn("[AudioPlaybackManager] Failed to initialize AudioContext",t),U(_E,this,null),U(TE,this,null),null}}function KE(){if(!z(TE,this))return;const t=z(NE,this)?0:z(AE,this);z(TE,this).gain.value=t}function XE(){z(_E,this)&&"function"==typeof z(_E,this).resume&&"suspended"===z(_E,this).state&&z(_E,this).resume().catch((()=>{}))}function YE(){z(_E,this)&&"function"==typeof z(_E,this).suspend&&"running"===z(_E,this).state&&z(_E,this).suspend().catch((()=>{}))}var QE=new WeakMap,JE=new WeakMap,ZE=new WeakMap,tS=new WeakMap,eS=new WeakMap,nS=new WeakSet;class iS extends Jc{constructor(...t){super(...t),j(this,nS),W(this,QE,void 0),W(this,JE,void 0),W(this,ZE,void 0),W(this,tS,void 0),W(this,eS,void 0),U(QE,this,B(nS,this,oS).call(this,this.settings.currentTime)),U(JE,this,B(nS,this,sS).call(this,this.settings.playbackRate)),U(ZE,this,null),U(tS,this,!1),U(eS,this,B(nS,this,rS).bind(this))}get name(){return"PlaybackClock"}get defaults(){return{currentTime:0,playbackRate:sv("playbackRate")}}get currentTime(){return z(QE,this)}get playbackRate(){return z(JE,this)}set playbackRate(t){U(JE,this,B(nS,this,sS).call(this,t))}play(){z(tS,this)||(U(tS,this,!0),U(ZE,this,$g()),Tb(z(eS,this),0))}pause(){z(tS,this)&&(U(tS,this,!1),Ib(z(eS,this)))}seek(t){U(QE,this,B(nS,this,oS).call(this,t)),U(ZE,this,$g())}reset(){this.pause(),U(QE,this,0),U(ZE,this,null)}onDispose(){this.pause(),U(eS,this,null)}}function rS(){const t=$g();if(null===z(ZE,this))return U(ZE,this,t),void this.trigger(Jp.CLOCK_TICK,{currentTime:z(QE,this)});const e=t-z(ZE,this);U(ZE,this,t);const n=e/1e3;U(QE,this,z(QE,this)+n*z(JE,this)),this.trigger(Jp.CLOCK_TICK,{currentTime:z(QE,this)})}function oS(t){return"number"!=typeof t||Number.isNaN(t)||!Number.isFinite(t)||t<0?0:t}function sS(t){return"number"!=typeof t||Number.isNaN(t)||!Number.isFinite(t)||t<=0?z(JE,this)||1:t}var aS=new WeakMap,lS=new WeakSet;class cS extends Jc{constructor(...t){super(...t),j(this,lS),W(this,aS,new Map)}get name(){return"TrackBuffers"}get defaults(){return{}}refreshNode(t){if(!t||!Array.isArray(t.tracks))return;const e=t.id,n=z(aS,this).get(e)||new Map;z(aS,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(Jp.TRACK_BUFFER_UPDATE,{nodeId:e,trackType:i,range:r})),!s&&a?this.trigger(Jp.TRACK_READY,{nodeId:e,trackType:i,range:r}):s&&!a&&this.trigger(Jp.TRACK_UNDERFLOW,{nodeId:e,trackType:i,range:r})}))}getTrackRange(t,e){const n=z(aS,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=B(lS,this,dS).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 z(aS,this)}reset(){z(aS,this).clear()}onDispose(){z(aS,this).clear(),"function"==typeof this.off&&this.off()}}function uS(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 dS(t,e,n=0){var i,r;const o=ep(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 B(lS,this,hS).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=B(lS,this,uS).call(this,d,u)||(null===(r=d)||void 0===r?void 0:r.buffered);return h&&Number.isFinite(h.start)&&Number.isFinite(h.end)?B(lS,this,hS).call(this,s,h,o,e):void 0}function hS(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 fS{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 pS extends Jc{constructor(t,e){super(e),this.timeline=t}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"handleDecodedFrame","handleClockTick","handleMainTrackBufferUpdate"])}enter(){}exit(){}play(){this.timeline.transitionTo(im)}pause(){this.timeline.transitionTo(om)}wait(){this.timeline.transitionTo(rm)}reset(){this.timeline.transitionTo(am)}seek(t){this.timeline.transitionTo(sm,{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()||om;this.timeline.transitionTo(e)}handleMainTrackBufferUpdate(t){}handleDecodedFrame(t){}handleClockTick(t){}onDispose(){this.timeline=null}}const mS=24e3/1001;function gS(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 vS(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 yS(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 bS(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 kS(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:mS)}(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+vS(t)}function xS(t,e=(null==t?void 0:t.currentTime)){const n=gS(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=yS(o);if(!s)return!0;if(!t.hasDecodedFirstFrame(r,s))return!0}return!1}function wS(t,e=(null==t?void 0:t.currentTime)){return xS(t,e)||function(t,e=(null==t?void 0:t.currentTime)){const n=gS(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=bS(s);if(null!=a&&a.id&&!kS(t,o,a.id,a.type,n))return!0}return!1}(t,e)}function _S(t,e=(null==t?void 0:t.currentTime)){if("function"!=typeof(null==t?void 0:t.computeBuffered))return!1;const n=gS(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=vS(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=ep(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 TS={[nm]:class extends pS{get name(){return nm}get defaults(){return{autoplay:sv("autoplay")}}enter(){this.timeline.recordStableState(om),this.timeline.stopPlaybackClock()}play(){const t=wS(this.timeline),e=t?rm:im;if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t)return this.timeline.recordStableState(im),void this.timeline.transitionTo(rm);this.timeline.transitionTo(im)}pause(){}handleDecodedFrame(t){!0===this.settings.autoplay&&Array.isArray(this.timeline.placements)&&this.timeline.placements.length&&(wS(this.timeline)||(this.log.info("[handleDecodedFrame] Autoplay enabled, transitioning to Playing!"),this.emitPlayerStateEvent("play",{from:this.timeline.state,to:im}),this.timeline.transitionTo(im)))}},[im]:class extends pS{get name(){return im}enter(t={}){const{from:e,to:n}=t;this.timeline.recordStableState(im),this.timeline.startPlaybackClock(),this.emitPlayerStateEvent("canplay",{from:e,to:n}),this.emitPlayerStateEvent("playing",{from:e,to:n})}play(){}pause(){this.timeline.transitionTo(om)}handleClockTick(t){const e=this.timeline.currentTime;wS(this.timeline,e)&&(this.timeline.recordStableState(im),this.timeline.transitionTo(rm))}},[rm]:(un=new WeakMap,dn=new WeakMap,hn=new WeakSet,class extends pS{constructor(...t){super(...t),j(this,hn),W(this,un,void 0),W(this,dn,null)}get name(){return rm}enter(t={}){const{from:e,to:n}=t;this.timeline.stopPlaybackClock(),B(hn,this,IS).call(this),B(hn,this,SS).call(this),this.emitPlayerStateEvent("waiting",{from:e,to:n}),B(hn,this,MS).call(this)}exit(){B(hn,this,ES).call(this),B(hn,this,NS).call(this)}play(){this.timeline.recordStableState(im);const t=B(hn,this,AS).call(this),e=t?rm:im;this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t||this.timeline.transitionTo(im)}pause(){this.timeline.transitionTo(om)}handleMainTrackReady(t){const e=this.timeline.getLastStableState()||om;e!==im?this.timeline.transitionTo(e):B(hn,this,MS).call(this)}handleDecodedFrame(t){B(hn,this,MS).call(this)}handleMainTrackBufferUpdate(t){B(hn,this,MS).call(this)}}),[om]:class extends pS{get name(){return om}enter(t={}){const{from:e,to:n}=t;this.timeline.recordStableState(om),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("pause",{from:e,to:n})}play(){const t=wS(this.timeline),e=t?rm:im;if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t)return this.timeline.recordStableState(im),void this.timeline.transitionTo(rm);this.timeline.transitionTo(im)}pause(){}},[sm]:class extends pS{get name(){return sm}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===im?im:om;this.timeline.transitionTo(i,{fromSeeking:!0})}play(){this.timeline&&"function"==typeof this.timeline.setSeekReturnState?this.timeline.setSeekReturnState(im):this.timeline.transitionTo(im)}pause(){this.timeline&&"function"==typeof this.timeline.setSeekReturnState?this.timeline.setSeekReturnState(om):this.timeline.transitionTo(om)}handleDecodedFrame(t){this.timeline&&"function"==typeof this.timeline.maybeCompleteSeek&&this.timeline.maybeCompleteSeek(t)}},[am]:class extends pS{get name(){return am}enter(){this.timeline.resetClock(),this.timeline.transitionTo(nm,{fromReset:!0})}play(){}pause(){}get buffered(){return{start:0,end:0}}}};function IS(){var t;const e=null===(t=this.timeline)||void 0===t?void 0:t.trackBuffers;e&&"function"==typeof e.on&&(U(un,this,(t=>this.handleMainTrackBufferUpdate(t))),e.on(Jp.TRACK_BUFFER_UPDATE,z(un,this)))}function ES(){var t;const e=null===(t=this.timeline)||void 0===t?void 0:t.trackBuffers;z(un,this)&&e&&"function"==typeof e.off?(e.off(Jp.TRACK_BUFFER_UPDATE,z(un,this)),U(un,this,null)):U(un,this,null)}function SS(){if(null!==z(dn,this))return;const t="function"==typeof(null==eu?void 0:eu.setInterval)?eu.setInterval.bind(eu):setInterval;U(dn,this,t((()=>{var t;(null===(t=this.timeline)||void 0===t?void 0:t.state)===rm&&B(hn,this,MS).call(this)}),200))}function NS(){null!==z(dn,this)&&(("function"==typeof(null==eu?void 0:eu.clearInterval)?eu.clearInterval.bind(eu):clearInterval)(z(dn,this)),U(dn,this,null))}function AS(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!!xS(t,e)||!0===n.skipBufferResume||!_S(t,e)}(this.timeline,t)}function MS(t=(t=>null===(t=this.timeline)||void 0===t?void 0:t.currentTime)()){return(this.timeline.getLastStableState()||om)===im&&!B(hn,this,AS).call(this,t)&&(this.timeline.transitionTo(im),!0)}function FS(t){return t&&("string"!=typeof t.state||"ready"===t.state)}function OS(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).some((t=>"video"===(null==t?void 0:t.type)))}function PS(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)))}var CS=new WeakMap,DS=new WeakMap,RS=new WeakMap,BS=new WeakMap,LS=new WeakMap,zS=new WeakMap,WS=new WeakMap,US=new WeakMap,jS=new WeakMap,$S=new WeakMap,qS=new WeakMap,VS=new WeakMap,GS=new WeakMap,HS=new WeakSet;class KS{constructor(t={}){j(this,HS),W(this,CS,void 0),W(this,DS,void 0),W(this,RS,void 0),W(this,BS,void 0),W(this,LS,void 0),W(this,zS,void 0),W(this,WS,void 0),W(this,US,void 0),W(this,jS,null),W(this,$S,om),W(this,qS,[]),W(this,VS,new Set),W(this,GS,new Map),U(CS,this,t.getState),U(DS,this,t.getNode),U(RS,this,t.getPlacementsActiveAtTime),U(BS,this,t.getLastStableState),U(LS,this,t.clearVisualFrameBuffers),U(zS,this,t.updateTime),U(WS,this,t.transitionTo),U(US,this,t.trigger)}start(t,e){const n=Number(t);if(!Number.isFinite(n))return;let i=e;i===sm?i=z($S,this):i===rm&&"function"==typeof z(BS,this)&&(i=z(BS,this).call(this)),U($S,this,i===im?im:om),U(jS,this,n),z(VS,this).clear(),z(GS,this).clear(),U(qS,this,"function"==typeof z(RS,this)?z(RS,this).call(this,n):[]),"function"==typeof z(LS,this)&&z(LS,this).call(this),"function"==typeof z(zS,this)&&z(zS,this).call(this,n,{source:"seek"}),"function"==typeof z(US,this)&&z(US,this).call(this,Jp.TIMELINE_SEEKING,{targetTime:n,placements:z(qS,this).slice()}),this.maybeComplete()}setReturnState(t){U($S,this,t===im?im:om)}maybeComplete(t){if(("function"==typeof z(CS,this)?z(CS,this).call(this):void 0)!==sm)return;const e=z(jS,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){z(VS,this).add(i);const t=z(GS,this).get(i);(!Number.isFinite(t)||n<t)&&z(GS,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)&&z(VS,this).add(i);const r=Array.isArray(z(qS,this))?z(qS,this):[];if(r.length){if("function"==typeof z(DS,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=z(DS,this).call(this,e.nodeId);if(!FS(i))return;if(PS(i)&&!z(VS,this).has(n))return}B(HS,this,XS).call(this,e,r)}}else B(HS,this,XS).call(this,e,[])}dispose(){U(qS,this,[]),z(VS,this).clear(),z(GS,this).clear(),U(jS,this,null)}}function XS(t,e){const n=B(HS,this,YS).call(this,t,e);"function"==typeof z(zS,this)&&z(zS,this).call(this,n,{source:"seek"}),U(jS,this,null),U(qS,this,[]),z(VS,this).clear(),z(GS,this).clear(),"function"==typeof z(US,this)&&z(US,this).call(this,Jp.TIMELINE_SEEKED,{targetTime:t,placements:Array.isArray(e)?e.slice():[]}),"function"==typeof z(WS,this)&&z(WS,this).call(this,z($S,this),{fromSeeking:!0})}function YS(t,e){const n=Number(t);if(!Number.isFinite(n))return t;if(!Array.isArray(e)||!e.length||"function"!=typeof z(DS,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(!OS(z(DS,this).call(this,n.nodeId)))continue;const o=z(GS,this).get(r);Number.isFinite(o)&&o>i&&(i=o)}return i}function QS(t){if(t&&"function"==typeof t.close)try{t.close()}catch(t){}}function JS(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=>QS(null==t?void 0:t.frame)))}function ZS(t){return ep(t)}function tN(t){return Number.isFinite(null==t?void 0:t.loopRootOffset)?t.loopRootOffset:ZS(t)}function eN(t,e){return"string"==typeof(null==t?void 0:t.loopRootPlacementId)&&t.loopRootPlacementId?t.loopRootPlacementId:e}function nN(t){if("string"!=typeof t)return Number.NaN;const e=t.match(/(\d+)/);return e?Number(e[1]):Number.NaN}function iN(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 rN=1e-6;function oN(t){return t&&("string"!=typeof t.state||"ready"===t.state)}function sN(t){const e=Number(t);return Number.isFinite(e)?e:0}function aN(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 lN(t){return t&&"cue"===t.type&&Array.isArray(t.cues)?t.cues:[]}var cN=new WeakMap,uN=new WeakMap,dN=new WeakMap,hN=new WeakMap,fN=new WeakMap,pN=new WeakMap,mN=new WeakMap,gN=new WeakMap,vN=new WeakSet;class yN{constructor(t={}){j(this,vN),W(this,cN,void 0),W(this,uN,void 0),W(this,dN,void 0),W(this,hN,void 0),W(this,fN,void 0),W(this,pN,void 0),W(this,mN,-1e-6),W(this,gN,null),U(cN,this,t.getPlacements),U(uN,this,t.getPlacementsActiveAtTime),U(dN,this,t.getPlacementDuration),U(hN,this,t.getNode),U(fN,this,t.triggerTimeline),U(pN,this,t.triggerNode)}handleSeeking(t,e){const n=sN(t);U(gN,this,n)}handleSeeked(t){const e=sN(t),n=z(gN,this);U(gN,this,null),Number.isFinite(n)?(B(vN,this,kN).call(this,n,e),U(mN,this,e)):U(mN,this,e)}handleTimeUpdate(t,e={}){const n=sN(t),i=z(mN,this);!0===(null==e?void 0:e.isSeeking)?U(mN,this,n):Number.isFinite(i)?n<=i?n<i&&U(mN,this,n-rN):(B(vN,this,bN).call(this,i,n),U(mN,this,n)):U(mN,this,n)}dispose(){U(gN,this,null),U(mN,this,-1e-6)}}function bN(t,e){const n="function"==typeof z(cN,this)?z(cN,this).call(this):[];B(vN,this,xN).call(this,n,t,e,{onlySticky:!1})}function kN(t,e){if("function"!=typeof z(uN,this))return;const n=z(uN,this).call(this,e);B(vN,this,xN).call(this,n,t,e,{onlySticky:!0})}function xN(t,e,n,i={}){if("function"!=typeof z(hN,this)||"function"!=typeof z(fN,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=z(hN,this).call(this,l);if(!oN(c))continue;const u=aN(c);if(!u.length)continue;const d=ep(s);if(!Number.isFinite(d))continue;const h=Number.isFinite(null==s?void 0:s.nodeOffsetOverride)?s.nodeOffsetOverride:0,f="function"==typeof z(dN,this)?z(dN,this).call(this,s):void 0,p="number"==typeof f&&Number.isFinite(f)?d+f:Number.POSITIVE_INFINITY,m=r?d-rN:e;for(let t=0;t<u.length;t+=1){const e=lN(u[t]);for(let i=0;i<e.length;i+=1){const s=e[i],c=sN(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};z(fN,this).call(this,"cuepoint",n),z(fN,this).call(this,e.name,n),"function"==typeof z(pN,this)&&(z(pN,this).call(this,t.nodeId,"cuepoint",n),z(pN,this).call(this,t.nodeId,e.name,n))})))}class wN{#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 _N=24e3/1001;function TN(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}:iN(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 IN=new WeakMap,EN=new WeakMap,SN=new WeakMap,NN=new WeakMap,AN=new WeakMap,MN=new WeakMap,FN=new WeakMap,ON=new WeakMap,PN=new WeakMap,CN=new WeakMap,DN=new WeakMap,RN=new WeakMap,BN=new WeakMap,LN=new WeakMap,zN=new WeakMap,WN=new WeakMap,UN=new WeakMap,jN=new WeakMap,$N=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 WeakMap,ZN=new WeakMap,tA=new WeakMap,eA=new WeakMap,nA=new WeakSet;class iA extends Jc{constructor(...t){super(...t),j(this,nA),W(this,IN,void 0),W(this,EN,void 0),W(this,SN,void 0),W(this,NN,void 0),W(this,AN,void 0),W(this,MN,[]),W(this,FN,new wN("placement-")),W(this,ON,[]),W(this,PN,new wN("renderplacement-")),W(this,CN,void 0),W(this,DN,void 0),W(this,RN,void 0),W(this,BN,new Set),W(this,LN,new Set),W(this,zN,new Map),W(this,WN,[]),W(this,UN,0),W(this,jN,new Set),W(this,$N,new Set),W(this,qN,Number.NEGATIVE_INFINITY),W(this,VN,[]),W(this,GN,Number.NEGATIVE_INFINITY),W(this,HN,0),W(this,KN,void 0),W(this,XN,void 0),W(this,YN,new Map),W(this,QN,null),W(this,JN,void 0),W(this,ZN,void 0),W(this,tA,void 0),W(this,eA,void 0);const[e,n={}]=t;U(IN,this,e),U(KN,this,n),U(AN,this,new iS(n)),U(CN,this,new cS(n)),U(NN,this,om),B(nA,this,pA).call(this),B(nA,this,mA).call(this),U(JN,this,new KS({getState:()=>this.state,getNode:t=>z(IN,this)&&"function"==typeof z(IN,this).get?z(IN,this).get(t):void 0,getPlacementsActiveAtTime:t=>B(nA,this,KA).call(this,t,{endEpsilonSeconds:B(nA,this,iM).call(this)}),getLastStableState:()=>this.getLastStableState(),clearVisualFrameBuffers:()=>B(nA,this,GA).call(this),updateTime:(t,e)=>this.updateTime(t,e),transitionTo:(t,e)=>this.transitionTo(t,e),trigger:(t,e)=>this.trigger(t,e)})),U(ZN,this,new yN({getPlacements:()=>z(MN,this).slice(),getPlacementsActiveAtTime:t=>B(nA,this,KA).call(this,t),getPlacementDuration:t=>B(nA,this,AA).call(this,t),getNode:t=>z(IN,this)&&"function"==typeof z(IN,this).get?z(IN,this).get(t):void 0,triggerTimeline:(t,e)=>this.trigger(t,e),triggerNode:(t,e,n)=>{const i=z(IN,this)&&"function"==typeof z(IN,this).get?z(IN,this).get(t):void 0;i&&"function"==typeof i.trigger&&i.trigger(e,n)}})),U(tA,this,(()=>{var t,e;null===(t=z(ZN,this))||void 0===t||null===(e=t.handleSeeked)||void 0===e||e.call(t,this.currentTime)})),this.on(Jp.TIMELINE_SEEKED,z(tA,this)),U(eA,this,(t=>B(nA,this,wA).call(this,t))),this.on("nodestart",z(eA,this)),this.transitionTo(nm)}get name(){return"Timeline"}get defaults(){return{snapToFps:_N,maxBufferedVideoFrames:24}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"computeBuffered","notifyDecodedFrame","getDecodedFrameStats","getActiveRenderPlacement","maybeCompleteSeek","getPlacementsActiveAtTime","hasDecodedFirstFrame","getDecodedVisualBuffer","getPlacementDuration","getNode"])}transitionTo(t,e={}){const n=z(SN,this),i=function(t,e,n={}){const i=TS[t];return i?new i(e,n):null}(t,this,z(KN,this)),r=e&&"object"==typeof e&&!Array.isArray(e)?{...e,from:n,to:t}:{from:n,to:t};i?(z(EN,this)&&"function"==typeof z(EN,this).exit&&z(EN,this).exit(),U(EN,this,i),U(SN,this,t),"function"==typeof i.enter&&i.enter(r),this.trigger(Jp.TIMELINE_STATE_CHANGE,{from:n,to:t,options:e})):this.log.warn(`Unknown state "${t}"`)}recordStableState(t){U(NN,this,t)}getLastStableState(){return z(NN,this)}get state(){return z(SN,this)}get paused(){return z(SN,this)===nm||z(SN,this)===om}get currentTime(){return z(AN,this).currentTime}set currentTime(t){z(EN,this).seek(t)}get playbackRate(){return z(AN,this).playbackRate}set playbackRate(t){z(AN,this).playbackRate=t}play(){z(EN,this).play()}pause(){z(EN,this).pause()}reset(){z(EN,this).reset()}seekToPlacement(t){if(!t)throw new Error("Timeline.seekToPlacement requires placement id");B(nA,this,IA).call(this);const e=B(nA,this,ZA).call(this,t);if(!e)throw new Error("Timeline.seekToPlacement requires placement id");const n=ep(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;B(nA,this,IA).call(this),B(nA,this,EA).call(this),z(AN,this).seek(t),B(nA,this,HA).call(this,this.currentTime),B(nA,this,XA).call(this);const r="string"==typeof(null==e?void 0:e.source)?e.source:"set";null!==(n=z(ZN,this))&&void 0!==n&&null!==(i=n.handleTimeUpdate)&&void 0!==i&&i.call(n,this.currentTime,{isSeeking:this.state===sm}),B(nA,this,_A).call(this,this.currentTime),B(nA,this,UA).call(this,this.currentTime),this.trigger(Jp.TIMELINE_TIME_UPDATE,Zp(this.currentTime,r))}startSeeking(t,e){var n,i;null!==(n=z(ZN,this))&&void 0!==n&&null!==(i=n.handleSeeking)&&void 0!==i&&i.call(n,this.currentTime,t),z(JN,this)&&"function"==typeof z(JN,this).start&&z(JN,this).start(t,e)}setSeekReturnState(t){z(JN,this)&&"function"==typeof z(JN,this).setReturnState&&z(JN,this).setReturnState(t)}maybeCompleteSeek(t){z(JN,this)&&"function"==typeof z(JN,this).maybeComplete&&z(JN,this).maybeComplete(t)}startPlaybackClock(){z(AN,this).play()}stopPlaybackClock(){z(AN,this).pause()}resetClock(){var t,e;z(AN,this).reset(),null===(t=z(ZN,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:[];B(nA,this,rA).call(this),B(nA,this,oA).call(this,e),B(nA,this,sA).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=z(FN,this).claim(n.placementId),o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=ap(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}:sp(e,n);let u,d,h,f=!1;const p=null!==a;if(B(nA,this,IA).call(this),a){const t=z(MN,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=ep(t);if("start"===a.anchor)Number.isFinite(e)?u=B(nA,this,MA).call(this,e,{nodeOffsetOverride:o}):f=!0;else{const n=B(nA,this,AA).call(this,t);if(Number.isFinite(e)&&n>0){const t=e+n,i=B(nA,this,MA).call(this,t,{nodeOffsetOverride:o});u=Math.max(i,t)}else f=!0}}else if(l){const t=n.offsetAnchorPlacementId?z(MN,this).find((t=>(null==t?void 0:t.placementId)===n.offsetAnchorPlacementId)):z(MN,this).length?z(MN,this)[z(MN,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==t?void 0:t.placementId),d){const e=ep(t),n=B(nA,this,AA).call(this,t);Number.isFinite(e)&&n>0?u=B(nA,this,MA).call(this,e+n-c,{nodeOffsetOverride:o}):(f=!0,h="end")}else u=B(nA,this,MA).call(this,-c,{nodeOffsetOverride:o})}else u=op(e),u=B(nA,this,MA).call(this,u,{...n,nodeOffsetOverride:o});const m=!0===n.loop?n.loopRootPlacementId||r:void 0,g=!0===n.loop&&Number.isFinite(n.loopRootOffset)?n.loopRootOffset:!0===n.loop?u:void 0,v=l?c:a&&"end"===a.anchor?0:void 0,y=new fS({placementId:r,nodeId:i,offset:u,offsetPending:f,offsetAnchorPlacementId:f?d:void 0,offsetAnchorEdge:f?h:void 0,offsetAnchorIsReference:f?p:void 0,offsetEndSeconds:v,nodeOffsetOverride:o,nodeDurationOverride:s,loop:!0===n.loop,loopRootPlacementId:m,loopRootOffset:g});if(z(MN,this).push(y),ip(z(MN,this)),B(nA,this,zA).call(this,y),B(nA,this,BA).call(this),f&&d){const t=z(MN,this).find((t=>(null==t?void 0:t.placementId)===d));B(nA,this,OA).call(this,null==t?void 0:t.nodeId)}return this.trigger(Jp.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=B(nA,this,FA).call(this,e,i),s=o.offset,a=!0===o.offsetPending,l=o.offsetAnchorPlacementId,c=o.offsetAnchorEdge,u=o.offsetAnchorIsReference,d=z(PN,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,g={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;lp(z(ON,this),t,e,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements")}if(z(ON,this).push(g),ip(z(ON,this)),a&&l){const t=z(MN,this).find((t=>(null==t?void 0:t.placementId)===l));B(nA,this,OA).call(this,null==t?void 0:t.nodeId)}return this.trigger(Jp.RENDER_PLACEMENT_ADDED,g),d}get placements(){return z(MN,this).slice()}getPlacementsActiveAtTime(t){return B(nA,this,KA).call(this,t)}getNodesAtTime(t){const e=B(nA,this,tM).call(this,t);if(!Number.isFinite(e))return[];const n=B(nA,this,KA).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 B(nA,this,AA).call(this,t)}getNode(t){if(z(IN,this)&&"function"==typeof z(IN,this).get)return z(IN,this).get(t)}get renderPlacements(){return z(ON,this).slice()}get placementsAhead(){const t=this.currentTime;return z(MN,this).filter((e=>{const n=ep(e);if(!Number.isFinite(n))return!1;const i=B(nA,this,AA).call(this,e);return"number"==typeof i?n+i>t:n>=t}))}get buffered(){return z(EN,this)?z(EN,this).buffered:{start:0,end:0}}get trackBuffers(){return z(CN,this)}onDispose(){B(nA,this,hA).call(this),z(LN,this)&&z(LN,this).clear(),z(ZN,this)&&"function"==typeof z(ZN,this).dispose&&z(ZN,this).dispose(),U(ZN,this,null),B(nA,this,dA).call(this),B(nA,this,fA).call(this),z(JN,this)&&"function"==typeof z(JN,this).dispose&&z(JN,this).dispose(),U(JN,this,null),z(AN,this)&&"function"==typeof z(AN,this).dispose&&(z(XN,this)&&"function"==typeof z(AN,this).off&&(z(AN,this).off("tick",z(XN,this)),U(XN,this,null)),z(AN,this).dispose(),U(AN,this,null)),B(nA,this,DA).call(this),U(EN,this,null),U(SN,this,null),U(MN,this,[]),U(ON,this,[]),B(nA,this,RA).call(this),B(nA,this,BA).call(this),z(YN,this).clear(),U(QN,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}`;z(BN,this).add(i),B(nA,this,VA).call(this,t),B(nA,this,XA).call(this),z(EN,this)&&"function"==typeof z(EN,this).handleDecodedFrame&&z(EN,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=TN(t);Number.isFinite(i)&&i>0&&(e.totalBytes+=i)}))}return e.available=!0,e}(z(YN,this))}hasDecodedFirstFrame(t,e){return!(!t||!e)&&z(BN,this).has(`${t}:${e}`)}getDecodedVisualBuffer(t,e){if(t&&e)return z(YN,this).get(`${t}:${e}`)}computeBuffered(t){const e=z(IN,this);if(e&&"function"==typeof e.get)return z(CN,this).computeBuffered(z(MN,this),t,e)}getActiveRenderPlacement(t=this.currentTime){const e=Number.isFinite(t)?t:this.currentTime,n=Array.isArray(z(ON,this))?z(ON,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 rA(){this.trigger(Jp.TIMELINE_RESET,{reason:"switch"}),B(nA,this,GA).call(this),z(CN,this)&&"function"==typeof z(CN,this).reset&&z(CN,this).reset(),z(LN,this)&&z(LN,this).clear(),U(MN,this,[]),U(ON,this,[]),B(nA,this,RA).call(this),B(nA,this,BA).call(this),z(FN,this).reset(),z(PN,this).reset()}function oA(t=[]){for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||!n.nodeId)continue;const i=B(nA,this,aA).call(this,n),r=B(nA,this,cA).call(this,n);this.placeOnTimeline(n.nodeId,r,i)}}function sA(t=[]){for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||!n.type)continue;const i=B(nA,this,lA).call(this,n),r=B(nA,this,uA).call(this,n);this.placeRenderNodeOnTimeline(n.type,r,n.duration,i)}}function aA(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 lA(t){const e={};return t.renderPlacementId&&(e.renderPlacementId=t.renderPlacementId),t.params&&"object"==typeof t.params&&(e.params=t.params),e}function cA(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 uA(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 dA(){z(EN,this)&&"function"==typeof z(EN,this).exit&&z(EN,this).exit()}function hA(){z(tA,this)&&"function"==typeof this.off&&(this.off(Jp.TIMELINE_SEEKED,z(tA,this)),U(tA,this,null)),z(eA,this)&&"function"==typeof this.off&&(this.off("nodestart",z(eA,this)),U(eA,this,null))}function fA(){z(CN,this)&&(z(DN,this)&&(z(CN,this).off("track:underflow",z(DN,this)),U(DN,this,null)),z(RN,this)&&(z(CN,this).off("track:ready",z(RN,this)),U(RN,this,null)),"function"==typeof z(CN,this).dispose&&z(CN,this).dispose(),U(CN,this,null))}function pA(){z(CN,this)&&"function"==typeof z(CN,this).on&&(U(DN,this,(t=>B(nA,this,vA).call(this,t))),U(RN,this,(t=>B(nA,this,yA).call(this,t))),z(CN,this).on(Jp.TRACK_UNDERFLOW,z(DN,this)),z(CN,this).on(Jp.TRACK_READY,z(RN,this)))}function mA(){z(AN,this)&&"function"==typeof z(AN,this).on&&(U(XN,this,(t=>B(nA,this,gA).call(this,t))),z(AN,this).on(Jp.CLOCK_TICK,z(XN,this)))}function gA(t){var e,n;B(nA,this,IA).call(this),B(nA,this,XA).call(this),null!==(e=z(ZN,this))&&void 0!==e&&null!==(n=e.handleTimeUpdate)&&void 0!==n&&n.call(e,this.currentTime,{isSeeking:!1}),B(nA,this,_A).call(this,this.currentTime),this.trigger(Jp.TIMELINE_TIME_UPDATE,Zp(this.currentTime,"clock")),z(EN,this)&&"function"==typeof z(EN,this).handleClockTick&&z(EN,this).handleClockTick(t)}function vA(t){B(nA,this,IA).call(this);const e=B(nA,this,bA).call(this);e&&(null==t?void 0:t.trackType)===e.trackType&&(z(EN,this)&&"function"==typeof z(EN,this).handleMainTrackUnderflow?z(EN,this).handleMainTrackUnderflow(t):this.transitionTo(rm))}function yA(t){if(B(nA,this,IA).call(this),this.state!==rm)return;const e=B(nA,this,bA).call(this);if(!e)return;if((null==t?void 0:t.trackType)!==e.trackType)return;if(z(EN,this)&&"function"==typeof z(EN,this).handleMainTrackReady)return void z(EN,this).handleMainTrackReady(t);const n=this.getLastStableState()||om;this.transitionTo(n)}function bA(t=this.currentTime){const e=B(nA,this,xA).call(this,t);if(!e)return;const n=z(IN,this)&&"function"==typeof z(IN,this).get?z(IN,this).get(e.nodeId):void 0;if(!n)return;const i=B(nA,this,kA).call(this,n);return i?{placement:e,trackType:i}:void 0}function kA(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 xA(t=this.currentTime){const e=z(MN,this)||[];let n;for(let i=0;i<e.length;i+=1){const r=e[i],o=ep(r);if(!Number.isFinite(o))continue;const s=B(nA,this,AA).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 wA(t={}){if(this.state!==im)return;const e=null==t?void 0:t.placementId;if(!e)return;const n=B(nA,this,ZA).call(this,e);n&&B(nA,this,TA).call(this,n)}function _A(t=this.currentTime){if(this.state!==im)return;const e=B(nA,this,KA).call(this,t);Array.isArray(e)&&e.length&&e.forEach((t=>B(nA,this,TA).call(this,t)))}function TA(t){const e=null==t?void 0:t.placementId;if(!e)return;if(z(LN,this).has(e))return;if(!t||!0!==t.loop)return;if(!t.nodeId)return;const n=B(nA,this,AA).call(this,t);if(!Number.isFinite(n)||n<=0)return;const i=ep(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;z(LN,this).add(e),this.placeOnTimeline(t.nodeId,r,{nodeOffsetOverride:t.nodeOffsetOverride,nodeDurationOverride:t.nodeDurationOverride,loop:!0,loopRootPlacementId:o,loopRootOffset:s})}function IA(){const t=rp(z(MN,this),{getPlacementDuration:t=>B(nA,this,AA).call(this,t),snapPlacementOffset:(t,e)=>B(nA,this,MA).call(this,t,{nodeOffsetOverride:null==e?void 0:e.nodeOffsetOverride}),onResolvedPlacement:(t,e)=>{!0!==t.loop||Number.isFinite(t.loopRootOffset)||(t.loopRootOffset=t.offset),B(nA,this,PA).call(this,null==e?void 0:e.nodeId)}});return t.updated&&(B(nA,this,BA).call(this),t.resolvedPlacements.forEach((t=>{B(nA,this,zA).call(this,t),this.trigger(Jp.PLACEMENT_ADDED,t)}))),t.updated}function EA(){if(!z(ON,this).length||!z(MN,this).length)return!1;const t=new Map;z(MN,this).forEach((e=>{(null==e?void 0:e.placementId)&&t.set(e.placementId,e)}));const e=z(ON,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];B(nA,this,SA).call(this,o,t)&&(n=!0,i.push(o))}return n&&(ip(z(ON,this)),i.forEach((t=>{this.trigger(Jp.RENDER_PLACEMENT_ADDED,t)}))),n}function SA(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=B(nA,this,NA).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 lp(z(ON,this).filter((e=>e!==t&&!0!==(null==e?void 0:e.offsetPending))),s,a,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements"),B(nA,this,PA).call(this,null==r?void 0:r.nodeId),!0}function NA(t,e){const n=ep(t);if(!Number.isFinite(n))return;if("start"===e.offsetAnchorEdge)return B(nA,this,MA).call(this,n);const i=B(nA,this,AA).call(this,t);if(!(i>0))return;const r=n+i;if(!Number.isFinite(r))return;const o=B(nA,this,MA).call(this,r);return!0===e.offsetAnchorIsReference?Math.max(o,r):o}function AA(t){return Zf(t,z(IN,this))}function MA(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 FA(t,e={}){const n=ap(t);if("string"==typeof t&&t.includes("@")&&!n)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");if(!n){const n=op(t);return{offset:B(nA,this,MA).call(this,n,e)}}const i=z(MN,this).find((t=>(null==t?void 0:t.placementId)===n.placementId));if(!i)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");const r=ep(i);if("start"===n.anchor)return Number.isFinite(r)?{offset:B(nA,this,MA).call(this,r,e)}:{offset:void 0,offsetPending:!0,offsetAnchorPlacementId:i.placementId,offsetAnchorEdge:"start",offsetAnchorIsReference:!0};const o=B(nA,this,AA).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=B(nA,this,MA).call(this,s,e);return{offset:Math.max(a,s)}}function OA(t){if(!t||!z(IN,this)||"function"!=typeof z(IN,this).get)return;if(z(zN,this).has(t))return;let e;try{e=z(IN,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),B(nA,this,PA).call(this,t)};e.on(Jp.NODE_LOADED,n),z(zN,this).set(t,n)}function PA(t){if(!t)return;if(B(nA,this,CA).call(this,t))return;const e=z(zN,this).get(t);if(!e)return;let n;try{n=z(IN,this).get(t)}catch(t){n=null}n&&"function"==typeof n.off&&n.off(Jp.NODE_LOADED,e),z(zN,this).delete(t)}function CA(t){if(!t)return!1;const e=new Map;z(MN,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!!z(MN,this).some((t=>n(t)))||!!z(ON,this).some((t=>n(t)))}function DA(){z(zN,this).size&&z(IN,this)?(z(zN,this).forEach(((t,e)=>{let n;try{n=z(IN,this).get(e)}catch(t){n=null}n&&"function"==typeof n.off&&n.off(Jp.NODE_LOADED,t)})),z(zN,this).clear()):z(zN,this).clear()}function RA(){U(WN,this,[]),U(UN,this,0),z(jN,this).clear(),z($N,this).clear(),U(qN,this,Number.NEGATIVE_INFINITY)}function BA(){U(VN,this,[]),U(HN,this,0),U(GN,this,Number.NEGATIVE_INFINITY)}function LA(t,e){const n=z(WN,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<z(UN,this)&&U(UN,this,z(UN,this)+1)}function zA(t){const e=null==t?void 0:t.placementId;if(!e||z(jN,this).has(e))return;const n=ep(t),i=B(nA,this,AA).call(this,t);if(!Number.isFinite(n)||!Number.isFinite(i)||i<0)return void z($N,this).add(e);const r=n+i;Number.isFinite(r)&&(z(jN,this).add(e),z($N,this).delete(e),B(nA,this,LA).call(this,e,r))}function WA(){z($N,this).size&&Array.from(z($N,this)).forEach((t=>{const e=B(nA,this,ZA).call(this,t);e?B(nA,this,zA).call(this,e):z($N,this).delete(t)}))}function UA(t){const e=Number(t);if(!Number.isFinite(e))return;if(e<z(qN,this))return void U(qN,this,e);if(U(qN,this,e),B(nA,this,WA).call(this),!z(WN,this).length)return;const n=new Set;let i=z(UN,this);for(;i<z(WN,this).length;){const t=z(WN,this)[i];if(!t||!Number.isFinite(t.endTime)||t.endTime>e)break;t.placementId&&n.add(t.placementId),i+=1}i!==z(UN,this)&&(U(UN,this,i),n.size&&(B(nA,this,qA).call(this,n),B(nA,this,jA).call(this,n)))}function jA(t){if(t&&t.size)for(const e of z(BN,this)){const n=e.split(":")[0];t.has(n)&&z(BN,this).delete(e)}}function $A(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 qA(t){if(t&&t.size)for(const[e,n]of z(YN,this).entries())t.has(null==n?void 0:n.placementId)&&(B(nA,this,$A).call(this,n),z(YN,this).delete(e))}function VA(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=iN(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=z(YN,this).get(f),m=p||{placementId:n,nodeId:i,trackId:r,trackType:s,frames:[],current:void 0},g={placementId:n,nodeId:i,trackId:r,segmentId:o,frame:a,width:c,height:u,presentationTime:d,duration:h},v=m.frames,y=v.length?v[v.length-1]:void 0;if(!y||y.presentationTime<=g.presentationTime)v.push(g);else{let t=v.findIndex((t=>t.presentationTime>g.presentationTime));-1===t&&(t=v.length),v.splice(t,0,g)}const b=Number(null===(e=this.settings)||void 0===e?void 0:e.maxBufferedVideoFrames);if("video"===s&&Number.isFinite(b)&&b>0&&v.length>b){const t=v.length-b;for(let e=0;e<t;e+=1){const t=v.pop(),e=null==t?void 0:t.frame;if(e&&"function"==typeof e.close)try{e.close()}catch(t){}}}p||z(YN,this).set(f,m)}function GA(){for(const t of z(YN,this).values())B(nA,this,$A).call(this,t);z(YN,this).clear(),U(QN,this,null),z(BN,this).clear()}function HA(t){const e=Number.isFinite(t)?t:this.currentTime;if(!Number.isFinite(e))return;e<z(GN,this)&&(U(VN,this,[]),U(HN,this,0));const n=Array.isArray(z(MN,this))?z(MN,this):[],i=[],r=new Set;z(VN,this).forEach((t=>{B(nA,this,rM).call(this,t,e)&&(i.push(t),(null==t?void 0:t.placementId)&&r.add(t.placementId))}));let o=z(HN,this);for(;o<n.length;){const t=n[o],s=ep(t);if(!Number.isFinite(s))break;if(s>e)break;if(B(nA,this,rM).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}U(VN,this,i),U(HN,this,o),U(GN,this,e)}function KA(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===z(GN,this)?z(VN,this).slice():(Array.isArray(z(MN,this))?z(MN,this):[]).filter((t=>B(nA,this,rM).call(this,t,n,i)))}function XA(){const t=this.currentTime,e=B(nA,this,QA).call(this,t);if(!e.length)return void U(QN,this,null);const n=this.getActiveRenderPlacement(t),i=B(nA,this,JA).call(this,e,n);(i!==z(QN,this)||B(nA,this,YA).call(this,t,n))&&(U(QN,this,i),this.trigger(Jp.VISUAL_FRAMES_AVAILABLE,{time:t,frames:e}))}function YA(t,e){const n=e||this.getActiveRenderPlacement(t);if(!n)return!1;if(!Tp.doesRenderNodeTypeRequireFrameCadence(null==n?void 0:n.type))return!1;const i=n.duration;return"number"==typeof i&&i>0}function QA(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){JS(c),a.push(t);continue}if("function"==typeof r&&!r(u,n)){const e=ZS(u),i="function"==typeof o?o(u):void 0;Number.isFinite(i)&&Number.isFinite(e)&&n>=e+i&&(JS(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&&QS(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:ZS(u),placementSortOffset:tN(u),placementSortId:eN(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=nN(r),a=nN(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:z(YN,this),time:t,getPlacementById:t=>B(nA,this,ZA).call(this,t),isPlacementActiveAtTime:(t,e)=>B(nA,this,rM).call(this,t,e),getPlacementDuration:t=>B(nA,this,AA).call(this,t)})}function JA(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 ZA(t){if(t)return(z(MN,this)||[]).find((e=>(null==e?void 0:e.placementId)===t))}function tM(t){if("end"===t){const t=B(nA,this,eM).call(this);if(!Number.isFinite(t))return;const e=B(nA,this,nM).call(this);return Math.max(0,t-Math.min(t,e))}const e=Number(t);return Number.isFinite(e)?e:0}function eM(){let t;return(Array.isArray(z(MN,this))?z(MN,this):[]).forEach((e=>{const n=ep(e);if(!Number.isFinite(n))return;const i=B(nA,this,AA).call(this,e);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(t)||r>t)&&(t=r)})),t}function nM(){const t=B(nA,this,iM).call(this);return t>0?t:.001}function iM(){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 rM(t,e,n=0){if(!np(t,e,z(IN,this)))return!1;const i=Number(n);if(!Number.isFinite(i)||i<=0)return!0;const r=B(nA,this,AA).call(this,t);if(!Number.isFinite(r))return!0;const o=ep(t);return!Number.isFinite(o)||e<o+r-i}var oM=new WeakMap,sM=new WeakMap,aM=new WeakMap,lM=new WeakMap,cM=new WeakMap,uM=new WeakMap,dM=new WeakMap,hM=new WeakMap,fM=new WeakMap,pM=new WeakMap,mM=new WeakMap,gM=new WeakMap,vM=new WeakMap,yM=new WeakMap,bM=new WeakMap,kM=new WeakMap,xM=new WeakMap,wM=new WeakSet;class _M extends Jc{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),j(this,wM),W(this,oM,void 0),W(this,sM,void 0),W(this,aM,1),W(this,lM,1),W(this,cM,1),W(this,uM,""),W(this,dM,0),W(this,hM,[]),W(this,fM,null),W(this,pM,void 0),W(this,mM,[]),W(this,gM,null),W(this,vM,null),W(this,yM,0),W(this,bM,0),W(this,kM,0),W(this,xM,void 0);const[e]=t;U(oM,this,e),U(yM,this,$g()),U(xM,this,B(wM,this,TM).call(this)),B(wM,this,IM).call(this),B(wM,this,EM).call(this),B(wM,this,FM).call(this),B(wM,this,AM).call(this)}get publicAPI(){return z(xM,this)}calcScore(){B(wM,this,WM).call(this)}onDispose(){z(oM,this)&&z(sM,this)&&"function"==typeof z(oM,this).off&&z(oM,this).off(Jp.TIMELINE_PLAYER_STATE,z(sM,this)),U(sM,this,null),B(wM,this,MM).call(this),B(wM,this,OM).call(this),U(oM,this,null),U(mM,this,[]),U(hM,this,[]),U(xM,this,null)}}function TM(){const t=this;return{get score(){return z(aM,t)},get status(){return z(uM,t)},get streamQualityScore(){return z(lM,t)},get fpsScore(){return z(cM,t)},get browserFps(){return z(dM,t)},get waitingSeconds(){return z(bM,t)/1e3},get playingSeconds(){return z(kM,t)/1e3}}}function IM(){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 EM(){z(oM,this)&&"function"==typeof z(oM,this).on&&(U(sM,this,(t=>B(wM,this,SM).call(this,t))),z(oM,this).on(Jp.TIMELINE_PLAYER_STATE,z(sM,this)))}function SM(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||B(wM,this,NM).call(this,null):B(wM,this,NM).call(this,"waiting"):B(wM,this,NM).call(this,"playing")}function NM(t){if(t===z(gM,this))return;const e=$g();z(gM,this)&&Number.isFinite(z(vM,this))&&z(mM,this).push({state:z(gM,this),startMs:z(vM,this),endMs:e}),U(gM,this,t),U(vM,this,t?e:null),B(wM,this,DM).call(this,e)}function AM(){const t=Number(this.settings.calcScoreInterval);!Number.isFinite(t)||t<=0||(U(pM,this,(()=>B(wM,this,WM).call(this))),Tb(z(pM,this),1e3*t))}function MM(){z(pM,this)&&Ib(z(pM,this)),U(pM,this,null)}function FM(){if("function"!=typeof pb)return;const t=()=>{if(this._disposed)return;const e=$g();U(dM,this,B(wM,this,PM).call(this,z(hM,this),e)),U(fM,this,pb(t))};U(fM,this,pb(t))}function OM(){z(fM,this)&&"function"==typeof mb&&mb(z(fM,this)),U(fM,this,null)}function PM(t,e){const n=B(wM,this,CM).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 CM(){const t=Number(this.settings.windowSeconds);return!Number.isFinite(t)||t<=0?3e4:1e3*t}function DM(t){const e=t-B(wM,this,CM).call(this);for(;z(mM,this).length&&z(mM,this)[0].endMs<=e;)z(mM,this).shift()}function RM(t){const e=t-B(wM,this,CM).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 z(mM,this).forEach((t=>{r(t.state,t.startMs,t.endMs)})),z(gM,this)&&Number.isFinite(z(vM,this))&&r(z(gM,this),z(vM,this),t),U(bM,this,n),U(kM,this,i),{waitingMs:n,playingMs:i}}function BM(t,e){if(t<=0)return 1;if(t>e)return 0;const n=e||1;return Qf(1-t*this.settings.waitingMultiplier/n)}function LM(){if($g()-z(yM,this)<=1e3*this.settings.fpsGracePeriod)return 1;const t=Number(z(dM,this)),e=Yp.isDesktop()?this.settings.bestFpsDesktop:this.settings.bestFpsMobile,n=Qf(e>0?t/e:0);return"quad"===this.settings.fpsMathFuncType?n*n:n}function zM(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 WM(){const t=$g(),{waitingMs:e,playingMs:n}=B(wM,this,RM).call(this,t),i=B(wM,this,BM).call(this,e,n),r=B(wM,this,LM).call(this),o=Qf(i*this.settings.streamQualityWeight+r*this.settings.fpsWeight);o!==z(aM,this)&&(U(aM,this,o),this.trigger(Jp.QOE_SCORE,o)),U(lM,this,i),U(cM,this,r);const s=B(wM,this,zM).call(this,o,e);s!==z(uM,this)&&(U(uM,this,s),this.trigger(Jp.QOE_STATUS,s))}function UM(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}function jM(t){const e=Number(t);return!Number.isFinite(e)||e<0?0:e}var $M=new WeakMap,qM=new WeakMap,VM=new WeakMap,GM=new WeakMap,HM=new WeakSet;class KM extends Jc{get name(){return"SegmentEvictionCoordinator"}get defaults(){return{enabled:sv("segmentEvictionEnabled"),bufferBehindSeconds:sv("segmentEvictionBufferBehindSeconds"),bufferAheadSeconds:sv("segmentEvictionBufferAheadSeconds"),maxRetainedBytes:sv("segmentEvictionMaxRetainedBytes")}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"evictAtTime"])}constructor(t,e,n={}){super(n),j(this,HM),W(this,$M,void 0),W(this,qM,void 0),W(this,VM,void 0),W(this,GM,void 0),U($M,this,t),U(qM,this,e),U(VM,this,(t=>B(HM,this,XM).call(this,t))),U(GM,this,(t=>B(HM,this,YM).call(this,t))),z($M,this)&&"function"==typeof z($M,this).on&&(z($M,this).on(Jp.TIMELINE_TIME_UPDATE,z(VM,this)),z($M,this).on(Jp.TIMELINE_SEEKED,z(GM,this)))}onDispose(){z($M,this)&&"function"==typeof z($M,this).off&&(z($M,this).off(Jp.TIMELINE_TIME_UPDATE,z(VM,this)),z($M,this).off(Jp.TIMELINE_SEEKED,z(GM,this))),U($M,this,null),U(qM,this,null),U(VM,this,null),U(GM,this,null)}evictAtTime(t){if(!0!==this.settings.enabled)return;const e=Number(t);if(!Number.isFinite(e))return;const n=jM(this.settings.bufferBehindSeconds),i=jM(this.settings.bufferAheadSeconds),r=e-n,o=e+i,s=B(HM,this,QM).call(this);if(!s.length)return;const a=Number(this.settings.maxRetainedBytes);if(Number.isFinite(a)&&a>0&&B(HM,this,JM).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=ep(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=B(HM,this,ZM).call(this,e);if(!n)return;const i=t.filter((t=>B(HM,this,tF).call(this,t,r,o)));i.length?B(HM,this,eF).call(this,n,i,r,o):"function"==typeof n.evict&&n.evict()}))}}function XM(t){var e,n;if(!0!==this.settings.enabled)return;if((null===(e=z($M,this))||void 0===e?void 0:e.state)===sm)return;const i=Number(null==t?void 0:t.time),r=Number.isFinite(i)?i:Number(null===(n=z($M,this))||void 0===n?void 0:n.currentTime);this.evictAtTime(r)}function YM(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=z($M,this))||void 0===e?void 0:e.currentTime);this.evictAtTime(i)}function QM(){var t;const e=null===(t=z($M,this))||void 0===t?void 0:t.placements;return Array.isArray(e)?e:[]}function JM(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=B(HM,this,ZM).call(this,i),o=Number(null==r?void 0:r.retainedByteLength);vg(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=>{vg(null==t?void 0:t.retainedByteLength)&&(n+=t.retainedByteLength)}))}))})),n}function ZM(t){if(z(qM,this)&&"function"==typeof z(qM,this).get)return z(qM,this).get(t)}function tF(t,e,n){const i=ep(t);if(!Number.isFinite(i))return!1;const r=Zf(t,z(qM,this));return(Number.isFinite(r)?i+r:Number.POSITIVE_INFINITY)>e&&i<n}function eF(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=UM(null==t?void 0:t.offset,0);r.forEach((t=>{if(!t||!vg(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=ep(a);if(!Number.isFinite(l))continue;const c=UM(null==a?void 0:a.nodeOffsetOverride,0),u=UM(null==t?void 0:t.offset,NaN);if(!Number.isFinite(u))continue;const d=UM(null==t?void 0:t.duration,0),h=l+o+u-c,f=h+(d>0?d:0),p=Zf(a,z(qM,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 nF=new WeakMap,iF=new WeakMap,rF=new WeakMap,oF=new WeakSet;class sF extends Jc{get name(){return"DocumentVisibility"}get defaults(){return{autoPauseOnVisibilityChange:!0,autoResumeOnVisibilityChange:!0}}constructor(t,e={}){super(e),j(this,oF),W(this,nF,void 0),W(this,iF,null),W(this,rF,!1),U(nF,this,t),B(oF,this,aF).call(this)}onDispose(){B(oF,this,lF).call(this),U(nF,this,null),U(rF,this,!1)}}function aF(){const t=null==eu?void 0:eu.document;t&&"function"==typeof t.addEventListener&&(U(iF,this,(()=>B(oF,this,cF).call(this))),t.addEventListener("visibilitychange",z(iF,this)))}function lF(){const t=null==eu?void 0:eu.document;z(iF,this)&&t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",z(iF,this)),U(iF,this,null)}function cF(){const t=null==eu?void 0:eu.document,e=null==t?void 0:t.visibilityState;"string"==typeof e&&("hidden"!==e?"visible"===e&&B(oF,this,dF).call(this):B(oF,this,uF).call(this))}function uF(){var t;(null===(t=this.settings)||void 0===t?void 0:t.autoPauseOnVisibilityChange)&&z(nF,this)&&"function"==typeof z(nF,this).pause&&(z(nF,this).state===im?(this.log.info("[#handleHidden] Pausing timeline due to document visibility change"),z(nF,this).pause(),U(rF,this,!0)):U(rF,this,!1))}function dF(){var t;z(rF,this)&&(null===(t=this.settings)||void 0===t?void 0:t.autoResumeOnVisibilityChange)&&z(nF,this)&&"function"==typeof z(nF,this).play&&(z(nF,this).state!==im?(this.log.info("[#handleVisible] Resuming timeline due to document visibility change"),z(nF,this).play(),U(rF,this,!1)):U(rF,this,!1))}const hF=[{event:"canplay",once:!0,trackAs:"canplay"},{event:"playing",once:!0,trackAs:"startedplaying"},"play","playing","waiting","pause","seeking","seeked","nodestart","nodeend"];function fF(t,e=0){return Number.isFinite(t)?t:e}function pF(t){const e=null==t?void 0:t.exposedPlayerAPI;return e&&"object"==typeof e?e:t}const mF=[function(t){return{schema:"iglu:com.helloeko/player/jsonschema/1-0-6",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:fF(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:fF(null==r?void 0:r.volume),playercontainerwidth:fF(null==r?void 0:r.containerWidth),playercontainerheight:fF(null==r?void 0:r.containerHeight)}}}},function(t){return{schema:"iglu:com.helloeko/currentnode/jsonschema/1-0-1",match:/^.*$/,getData:()=>{var e;const n=pF(t),i=function(t){const e=pF(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==eu||null===(t=eu.eko)||void 0===t||null===(t=t.environment)||void 0===t?void 0:t.embeddingApp;return e?{embeddingapp:e}:{}}}}],gF=Object.freeze({once:!1,trackAs:""});var vF=new WeakMap,yF=new WeakMap,bF=new WeakMap,kF=new WeakMap,xF=new WeakSet;class wF extends Jc{get name(){return"Tracker"}get defaults(){return{trackingEnabled:sv("trackingEnabled"),defaultForwarders:hF,defaultContextPackers:mF}}constructor(t,e={}){super(e),j(this,xF),W(this,vF,void 0),W(this,yF,new Map),W(this,bF,[]),W(this,kF,!1),U(vF,this,t),B(xF,this,NF).call(this),B(xF,this,_F).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=B(xF,this,MF).call(this);n&&n("track",t,...e)}registerContextPacker(t){if(!t||"object"!=typeof t)return void this.log.warn("[registerContextPacker] Expected a packer object.");const e={schema:t.schema,match:t.match,getData: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=B(xF,this,MF).call(this);n&&n("registerContextPacker",e)}onDispose(){B(xF,this,SF).call(this),B(xF,this,AF).call(this),U(vF,this,null),U(kF,this,!1)}}function _F(){(Array.isArray(this.settings.defaultForwarders)?this.settings.defaultForwarders:[]).forEach((t=>B(xF,this,TF).call(this,t)))}function TF(t){const e=B(xF,this,IF).call(this,t);if(!e)return void this.log.warn("[#addEventForwarder] Invalid forwarder input.",t);const n=z(vF,this);if(!n||"function"!=typeof n.on)return;const i=B(xF,this,EF).call(this,e);if(z(yF,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),z(yF,this).set(i,{event:e.event,listener:r})}function IF(t){return"string"==typeof t&&t?{event:t,...gF}: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 EF({event:t,once:e,trackAs:n}){return`${t}:${e}:${n}`}function SF(){const t=z(vF,this);t&&"function"==typeof t.off&&z(yF,this).forEach((({event:e,listener:n})=>{t.off(e,n)})),z(yF,this).clear()}function NF(){(Array.isArray(this.settings.defaultContextPackers)?this.settings.defaultContextPackers:[]).forEach((t=>{if("function"!=typeof t)return;const e=t(z(vF,this),this);e&&"object"==typeof e&&("function"==typeof e.dispose&&z(bF,this).push(e.dispose),e.disabled||this.registerContextPacker({schema:e.schema,match:e.match,getData:e.getData}))}))}function AF(){z(bF,this).forEach((t=>{try{t()}catch(t){this.log.warn("[#teardownContextPackers] Failed disposing context packer.",t)}})),U(bF,this,[])}function MF(){const t=null==eu?void 0:eu.EkoAnalytics;return"function"==typeof t?t:(B(xF,this,FF).call(this),null)}function FF(){this.settings.trackingEnabled&&!z(kF,this)&&(this.log.warn("EkoAnalytics not found on window."),U(kF,this,!0))}class OF{#T;#et;#nt;#it;#rt;#ot;#st;#at;#lt;#ct;#ut;#dt;#ht;#ft;#pt;#mt;#gt;#vt;#yt;constructor(t,e={},n=null){this.#T=new iu(t,e),this.#et=new du(this.#T,e),this.#nt=new sb(e),this.#it=new fv(e),this.#rt=new Uy(this.#it,e),this.#ot=new Ry(this.#rt,this.#nt,e),this.#st=new Xy(this.#ot,e),this.#at=new iA(this.#ot,e),this.#lt=new sF(this.#at,e),this.#vt=new KM(this.#at,this.#ot,e),this.#ct=new Gb(this.#ot,this.#st,this.#nt,this.#at,e),this.#ut=new Fk(this.#ot,this.#st,this.#at,e),this.#dt=new MT(e),this.#ht=new eI(this.#ot,this.#at,this.#dt,e),this.#pt=new _M(this.#at,e),this.#yt=new wF(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.#mt=r?r({timeline:this.#at,canvas:this.#T,containerSize:this.#et,options:e}):new Um(this.#at,this.#T,this.#et,e),this.#ft=o?o({timeline:this.#at,decodeCoordinator:this.#ht,options:e}):new RE(this.#at,this.#ht,e),this.#gt=new nE(this.#at,this.#mt,e)}get canvas(){return this.#T}get containerSize(){return this.#et}get assetsDeliveryService(){return this.#nt}get downloadSpeed(){return this.#it}get abrSelector(){return this.#rt}get nodeRepository(){return this.#ot}get nodePrioritizer(){return this.#st}get timeline(){return this.#at}get documentVisibility(){return this.#lt}get nodeResolver(){return this.#ct}get segmentLoadCoordinator(){return this.#ut}get decoderFactory(){return this.#dt}get parsingManager(){return this.#ht}get audioAdapter(){return this.#ft}get audioPlaybackManager(){return this.#ft}get qoe(){return this.#pt}get renderAdapter(){return this.#mt}get renderer(){return this.#mt}get transitionManager(){return this.#gt}get tracker(){return this.#yt}dispose(){[this.#yt,this.#at,this.#lt,this.#ut,this.#ct,this.#st,this.#ot,this.#nt,this.#rt,this.#it,this.#ht,this.#dt,this.#ft,this.#pt,this.#mt,this.#gt,this.#vt,this.#et,this.#T].forEach((t=>{t&&"function"==typeof t.dispose&&t.dispose()})),this.#at=null,this.#lt=null,this.#ut=null,this.#ct=null,this.#st=null,this.#ot=null,this.#nt=null,this.#rt=null,this.#it=null,this.#ht=null,this.#dt=null,this.#ft=null,this.#pt=null,this.#mt=null,this.#gt=null,this.#vt=null,this.#T=null,this.#yt=null}}const PF="main.1147285";var CF={isPlainObject:Hc,deepMerge:Kc,get:zg,set:Wg,ekoGlobalStore:Ug,download:nv,isPositiveNumber:vg,clamp01:Qf,root:eu,now:$g,getFrameDimensions:iN,useragent:Qp,requestAnimationFrame:pb,cancelAnimationFrame:mb,start:Tb,stop:Ib,isTicking:Eb,predicator:function(t,e){const n=e||{};if("function"!=typeof t)return void gb.error("[predicator] Bad argument given to predicator, first argument must be a function.",arguments);if(t.apply())return gb.debug("[predicator] Invoking onFulfilled immediately."),void("function"==typeof n.onFulfilled&&n.onFulfilled.call(null,0));const i=n.timeout||1e4,r=n.interval,o=$g();let s,a,l,c,u;c=function(){t.apply()&&l()},l=function(){Ib(c),eu.clearTimeout(s),u=$g()-o,gb.debug("[predicator] Invoking onFulfilled after "+u+" ms."),"function"==typeof n.onFulfilled&&n.onFulfilled.call(null,u)},a=function(){Ib(c),u=$g()-o,gb.debug("[predicator] Invoking onTimeout after "+u+" ms."),"function"==typeof n.onTimeout&&n.onTimeout.call(null,u)},s=eu.setTimeout(a,i),Tb(c,r)},createThrottler:Sb,scheduleExecution:Nb},DF=new WeakMap,RF=new WeakMap,BF=new WeakMap,LF=new WeakMap,zF=new WeakMap,WF=new WeakMap,UF=new WeakMap,jF=new WeakSet;class $F{constructor(t){j(this,jF),W(this,DF,[]),W(this,RF,[]),W(this,BF,new wN("placement-")),W(this,LF,new wN("renderplacement-")),W(this,zF,void 0),W(this,WF,new Map),W(this,UF,void 0),U(zF,this,t),U(UF,this,{allowUnready:!0,getNode:t=>B(jF,this,qF).call(this,t)})}get placements(){return z(DF,this).slice()}get renderPlacements(){return z(RF,this).slice()}getNodesAtTime(t){B(jF,this,VF).call(this);const e=B(jF,this,HF).call(this,t);if(!Number.isFinite(e))return[];const n=z(DF,this).filter((t=>np(t,e,null,z(UF,this)))),i=[];return n.forEach((t=>{const e=B(jF,this,qF).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&&z(WF,this).set(r,i);const o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=ap(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}:sp(e,n);let u,d,h,f=!1;const p=null!==a;if(a){const t=z(DF,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=ep(t);if("start"===a.anchor)Number.isFinite(e)?u=e:f=!0;else{const n=B(jF,this,GF).call(this,t);Number.isFinite(e)&&n>0?u=e+n:f=!0}}else if(l){const t=n.offsetAnchorPlacementId?z(DF,this).find((t=>(null==t?void 0:t.placementId)===n.offsetAnchorPlacementId)):z(DF,this).length?z(DF,this)[z(DF,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==t?void 0:t.placementId),d){const e=ep(t),n=B(jF,this,GF).call(this,t);Number.isFinite(e)&&n>0?u=e+n-c:(f=!0,h="end")}else u=-c}else u=op(e);const m=z(BF,this).claim(n.placementId),g={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 z(DF,this).push(g),ip(z(DF,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=ap(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=z(DF,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=ep(t);if("start"===c.anchor)Number.isFinite(e)?o=e:l=!0;else{const n=B(jF,this,GF).call(this,t);Number.isFinite(e)&&Number.isFinite(n)?o=e+n:l=!0}}else o=op(e);const d=z(LF,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;lp(z(RF,this),t,e,"TimelineDefinition.placeRenderNodeOnTimeline does not allow overlapping render nodes")}return z(RF,this).push(m),ip(z(RF,this)),d}}function qF(t){if(t)return z(zF,this)&&"function"==typeof z(zF,this).get?z(zF,this).get(t):z(WF,this).get(t)}function VF(){return rp(z(DF,this),{getPlacementDuration:t=>B(jF,this,GF).call(this,t)}).updated}function GF(t){return Zf(t,null,z(UF,this))}function HF(t){if("end"===t){const t=B(jF,this,KF).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 KF(){let t;return z(DF,this).forEach((e=>{const n=ep(e);if(!Number.isFinite(n))return;const i=B(jF,this,GF).call(this,e);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(t)||r>t)&&(t=r)})),t}const XF=new Set(["canplay","play","playing","waiting","pause","seeking","seeked"]);var YF=new WeakMap,QF=new WeakMap,JF=new WeakMap,ZF=new WeakMap,tO=new WeakMap,eO=new WeakMap,nO=new WeakMap,iO=new WeakMap,rO=new WeakMap,oO=new WeakMap,sO=new WeakMap,aO=new WeakMap,lO=new WeakMap,cO=new WeakMap,uO=new WeakMap,dO=new WeakMap,hO=new WeakMap,fO=new WeakMap,pO=new WeakMap,mO=new WeakMap,gO=new WeakMap,vO=new WeakMap,yO=new WeakMap,bO=new WeakMap,kO=new WeakMap,xO=new WeakSet;class wO extends Jc{get name(){return"EkoPlayer"}get exposedPlayerAPI(){return z(ZF,this)}constructor(t,e={}){const{options:n,publicOptions:i}=function(t={}){const e=Kc({},rv,t);Object.entries(iv).forEach((([t,{targetPaths:n}])=>{void 0!==e[t]&&n.forEach((n=>{void 0===zg(e,n)&&Wg(e,n,e[t])}))}));const n=function(t){const e={};return Object.keys(iv).forEach((n=>{Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})),Object.freeze(e)}(e);return ov.info("Processed options:",e),ov.info("Public options:",n),{options:e,publicOptions:n}}(e);return super(n),j(this,xO),W(this,YF,void 0),W(this,QF,void 0),W(this,JF,void 0),W(this,ZF,void 0),W(this,tO,void 0),W(this,eO,void 0),W(this,nO,void 0),W(this,iO,void 0),W(this,rO,void 0),W(this,oO,void 0),W(this,sO,void 0),W(this,aO,void 0),W(this,lO,void 0),W(this,cO,void 0),W(this,uO,void 0),W(this,dO,void 0),W(this,hO,void 0),W(this,fO,void 0),W(this,pO,void 0),W(this,mO,void 0),W(this,gO,void 0),W(this,vO,void 0),W(this,yO,void 0),W(this,bO,void 0),W(this,kO,0),U(JF,this,i),this.log.info("Initializing EkoPlayer with options:",i),U(aO,this,new OF(t,n,this)),B(xO,this,OO).call(this,z(aO,this)),U(uO,this,(t=>B(xO,this,_O).call(this,t))),z(QF,this)&&"function"==typeof z(QF,this).on&&z(QF,this).on(Jp.TIMELINE_CUEPOINT,z(uO,this)),U(dO,this,null),U(fO,this,(t=>B(xO,this,TO).call(this,t))),U(pO,this,(t=>{const e=t&&"object"==typeof t?t:{};B(xO,this,TO).call(this,{...e,event:"seeking"})})),U(mO,this,(t=>{const e=t&&"object"==typeof t?t:{};B(xO,this,TO).call(this,{...e,event:"seeked"})})),z(QF,this)&&"function"==typeof z(QF,this).on&&(z(QF,this).on(Jp.TIMELINE_PLAYER_STATE,z(fO,this)),z(QF,this).on(Jp.TIMELINE_SEEKING,z(pO,this)),z(QF,this).on(Jp.TIMELINE_SEEKED,z(mO,this))),U(yO,this,(t=>{const e=t&&"object"==typeof t?t:{};this.trigger(Jp.CONTAINER_RESIZE,e)})),z(lO,this)&&"function"==typeof z(lO,this).on&&z(lO,this).on(Jp.CONTAINER_RESIZE,z(yO,this)),B(xO,this,NO).call(this),B(xO,this,SO).call(this),U(ZF,this,B(xO,this,FO).call(this)),z(ZF,this)}onDispose(){z(QF,this)&&"function"==typeof z(QF,this).off&&z(uO,this)&&z(QF,this).off(Jp.TIMELINE_CUEPOINT,z(uO,this)),U(uO,this,null),z(QF,this)&&"function"==typeof z(QF,this).off&&(z(fO,this)&&z(QF,this).off(Jp.TIMELINE_PLAYER_STATE,z(fO,this)),z(pO,this)&&z(QF,this).off(Jp.TIMELINE_SEEKING,z(pO,this)),z(mO,this)&&z(QF,this).off(Jp.TIMELINE_SEEKED,z(mO,this))),U(fO,this,null),U(pO,this,null),U(mO,this,null),U(dO,this,null),z(lO,this)&&"function"==typeof z(lO,this).off&&z(yO,this)&&z(lO,this).off(Jp.CONTAINER_RESIZE,z(yO,this)),U(yO,this,null),z(sO,this)&&"function"==typeof z(sO,this).off&&(z(gO,this)&&z(sO,this).off("qoescore",z(gO,this)),z(vO,this)&&z(sO,this).off("qoestatus",z(vO,this))),U(gO,this,null),U(vO,this,null),z(oO,this)&&"function"==typeof z(oO,this).off&&z(bO,this)&&z(oO,this).off(Jp.DECODER_ERROR,z(bO,this)),U(bO,this,null),U(kO,this,0),z(cO,this)&&"function"==typeof z(cO,this).dispose&&z(cO,this).dispose(),U(cO,this,null),z(aO,this)&&"function"==typeof z(aO,this).dispose&&z(aO,this).dispose(),U(QF,this,null),U(YF,this,null),U(eO,this,null),U(nO,this,null),U(iO,this,null),U(rO,this,null),U(oO,this,null),U(sO,this,null),U(lO,this,null),U(tO,this,null),U(ZF,this,null),U(aO,this,null)}}function _O(t={}){var e;this.trigger(Jp.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 TO(t={}){const e="string"==typeof(null==t?void 0:t.event)?t.event:"";if(!XF.has(e))return;if("playing"!==e||Number.isFinite(z(hO,this))||U(hO,this,$g()),z(dO,this)===e)return;U(dO,this,e);const n=Number.isFinite(null==t?void 0:t.time)?t.time:z(QF,this)&&Number.isFinite(z(QF,this).currentTime)?z(QF,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 IO(){return new $F(z(YF,this))}function EO(t){if(!t||"object"!=typeof t)throw new Error("EkoPlayer.switchTimeline requires a timeline definition");if(!z(QF,this)||"function"!=typeof z(QF,this).applyTimelineDefinition)throw new Error("EkoPlayer.switchTimeline requires an active timeline");z(QF,this).applyTimelineDefinition(t),"function"==typeof z(QF,this).play&&z(QF,this).play()}function SO(){z(sO,this)&&"function"==typeof z(sO,this).on&&(U(gO,this,(t=>{this.trigger(Jp.QOE_SCORE,t)})),U(vO,this,(t=>{this.trigger(Jp.QOE_STATUS,t)})),z(sO,this).on(Jp.QOE_SCORE,z(gO,this)),z(sO,this).on(Jp.QOE_STATUS,z(vO,this)))}function NO(){z(oO,this)&&"function"==typeof z(oO,this).on&&(U(bO,this,(t=>{const e=t&&"object"==typeof t?t:{error:t};this.trigger(Jp.DECODER_ERROR,e),B(xO,this,AO).call(this,e)})),z(oO,this).on(Jp.DECODER_ERROR,z(bO,this)))}function AO(t={}){var e;const n=z(QF,this);if(!n||"number"!=typeof n.currentTime)return;const i=Date.now();if(i<z(kO,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;U(kO,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 MO(t={}){if(z(cO,this))return z(cO,this);const e=t&&"object"==typeof t&&!Array.isArray(t)?{...t}:{},n=z(tO,this)&&z(tO,this).element?z(tO,this).element:null;if(!n)throw new Error("Debug overlay requires an initialized player canvas and mount element.");const i=function({canvasElement:t,containerElement:e}={}){const n=t&&t.parentNode?t.parentNode:null;if(null==e)return n;const i=function(t,e=(null==eu?void 0:eu.document)){if(nu(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 nu(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:n,containerElement:e.containerElement});if(!i)throw new Error("Debug overlay requires an initialized player canvas and mount element.");Object.prototype.hasOwnProperty.call(e,"containerElement")&&delete e.containerElement;const r=await import("./debug-overlay-BIxN1VnC.esm.js"),o=(null==r?void 0:r.createDebugOverlay)||(null==r?void 0:r.default);if("function"!=typeof o)throw new Error("Debug overlay bundle does not export createDebugOverlay().");return e.publicOptions=z(JF,this),e.playerVersion=PF,U(cO,this,o({mountElement:i,canvasElement:n,timeline:z(QF,this),getNode:t=>z(YF,this)&&"function"==typeof z(YF,this).get?z(YF,this).get(t):void 0,listNodes:()=>z(YF,this)&&"function"==typeof z(YF,this).list?z(YF,this).list():[],downloadSpeed:z(aO,this)?z(aO,this).downloadSpeed:void 0,downloadEvents:Dg,qoe:z(sO,this)?z(sO,this).publicAPI:void 0,qoeEvents:this,options:e,playbackStartedAtMs:z(hO,this)})),z(cO,this)}function FO(){const t=this;return{createTimeline:()=>B(xO,t,IO).call(t),switchTimeline:e=>B(xO,t,EO).call(t,e),play:z(QF,this).play,pause:z(QF,this).pause,reset:z(QF,this).reset,placeOnTimeline:z(QF,this).placeOnTimeline,placeRenderNodeOnTimeline:z(QF,this).placeRenderNodeOnTimeline,addNode:z(YF,this).add,getNode:z(YF,this).get,listNodes:z(YF,this).list,getNodesAtTime:e=>z(QF,t).getNodesAtTime(e),dispose:this.dispose,on:t.on,off:t.off,once:t.once,trigger:t.trigger,transitionTo:(e,n)=>z(nO,t).transitionTo(e,n),track:(e,...n)=>{if(z(rO,t)&&"function"==typeof z(rO,t).track)return z(rO,t).track(e,...n)},seekToPlacement:e=>z(QF,t).seekToPlacement(e),get currentTime(){return z(QF,t).currentTime},set currentTime(e){z(QF,t).currentTime=e},get buffered(){return z(QF,t).buffered},get options(){return z(JF,t)},get containerWidth(){return z(lO,t)?z(lO,t).containerWidth:0},get containerHeight(){return z(lO,t)?z(lO,t).containerHeight:0},get playbackRate(){return z(QF,t).playbackRate},set playbackRate(e){z(QF,t).playbackRate=e},get paused(){return!!z(QF,t)&&!0===z(QF,t).paused},get muted(){return!!z(iO,t)&&z(iO,t).muted},set muted(e){z(iO,t)&&(z(iO,t).muted=e)},get volume(){return z(iO,t)?z(iO,t).volume:1},set volume(e){z(iO,t)&&(z(iO,t).volume=e)},get qoe(){return z(sO,t)?z(sO,t).publicAPI:void 0},get utils(){return CF},get version(){return PF},loadDebugOverlay:(...e)=>B(xO,t,MO).call(t,...e)}}function OO(t){t&&(U(tO,this,t.canvas),U(YF,this,t.nodeRepository),U(QF,this,t.timeline),U(iO,this,t.audioAdapter||t.audioPlaybackManager),U(rO,this,t.tracker),U(oO,this,t.parsingManager),U(sO,this,t.qoe),U(eO,this,t.renderAdapter||t.renderer),U(nO,this,t.transitionManager),U(lO,this,t.containerSize))}class PO{constructor({target:t,props:e}){if(!t)throw new Error("`options.target` is required");lo(this.#bt,e,!0),this.#bt.v.EkoPlayer=wO;const n=t.hasChildNodes()?Rs:Ds;this.#kt=n(Sc,{target:t,props:this.#bt.v})}#kt;#bt=so(fo({}));destroy(t){if(this.#kt)return function(t,e){const n=zs.get(t);return n?(zs.delete(t),n(e)):Promise.resolve()}(this.#kt,t)}get props(){return bs(this.#bt)}}const CO=()=>e.createElement("style",{suppressHydrationWarning:!0},'\n .textBoxDescriptionBox.svelte-17x2i38 {\n width: 100%;\n position: absolute;\n bottom: 0;\n display: flex;\n flex-direction: column;\n gap: 8px;\n box-sizing: border-box;\n 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 );\n }\n\n .step-description.svelte-17x2i38 {\n overflow: hidden;\n position: relative;\n transition: all 0.4s cubic-bezier(0, 1, 0.25, 1);\n font-size: 12px;\n font-weight: 400;\n font-style: normal;\n line-height: 16px;\n letter-spacing: 0px;\n color: #000;\n display: flex;\n flex-direction: column;\n transition: height 0.2s ease;\n interpolate-size: allow-keywords;\n\n > button:where(.svelte-17x2i38) {\n display: flex;\n justify-content: space-between;\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n line-height: 18px;\n gap: 8px;\n font-weight: 400;\n letter-spacing: 0%;\n }\n\n &.expanded {\n > button:where(.svelte-17x2i38) {\n flex-direction: column;\n align-items: flex-start;\n }\n\n p:where(.svelte-17x2i38) {\n -webkit-mask-image: none;\n mask-image: none;\n }\n }\n\n &:not(.expanded) {\n p:where(.svelte-17x2i38) {\n overflow: hidden;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n line-clamp: 1;\n }\n }\n\n h3:where(.svelte-17x2i38) {\n margin: 0;\n font-size: 16px;\n font-weight: 500;\n color: #030303;\n }\n\n p:where(.svelte-17x2i38) {\n margin: 0;\n text-align: left;\n }\n\n span:where(.svelte-17x2i38) {\n color: #014FD3;\n font-size: 12px;\n font-weight: 600;\n flex-shrink: 0;\n }\n }\n.eko-gallery-app {\n --toggleModule_gap: 8px;\n --toggleModule_padding: 10px 58px 0 0;\n --toggleModule_options_padding: 0;\n --toggleModule_options_height: auto;\n --toggleModule_options_width: 100%;\n --toggleModule_options_gap: 8px;\n --toggleModule_button_backgroundColor: #FFFFFF;\n --toggleModule_button_padding: 8px 12px;\n --toggleModule_button_boxShadow: 0px 2px 8px 2px rgba(0, 0, 0, 0.07);\n --toggleModule_button_text_fontFamily: var(--fontName);\n --toggleModule_button_text_fontSize: 12px;\n --toggleModule_button_text_fontWeight: 400;\n --toggleModule_button_text_fontStyle: normal;\n --toggleModule_button_text_lineHeight: 16px;\n --toggleModule_button_text_letterSpacing: -0.2px;\n --toggleModule_button_text_color: #000;\n --toggleModule_button_border_radius: 100px;\n --toggleModule_title_fontFamily: var(--fontName);\n --toggleModule_title_fontSize: 13px;\n --toggleModule_title_fontWeight: 400;\n --toggleModule_title_fontStyle: normal;\n --toggleModule_title_lineHeight: 120%;\n --toggleModule_title_letterSpacing: 0;\n --toggleModule_title_color: #666;\n --toggleModule_title_textAlignment: center;\n --toggleModule_note_fontFamily: var(--fontName);\n --toggleModule_note_fontSize: 12px;\n --toggleModule_note_fontWeight: 400;\n --toggleModule_note_fontStyle: normal;\n --toggleModule_note_lineHeight: 120%;\n --toggleModule_note_letterSpacing: 0;\n --toggleModule_note_color: #888;\n --toggleModule_note_topMargin: 4px;\n}\n\n.toggle-container.svelte-16pmvvn {\n position: absolute;\n top: 0;\n padding: var(--toggleModule_padding);\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: var(--toggleModule_gap);\n pointer-events: auto;\n box-sizing: border-box;\n}\n\n.toggle-options.svelte-16pmvvn {\n width: var(--toggleModule_options_width);\n height: var(--toggleModule_options_height);\n padding: var(--toggleModule_options_padding);\n gap: var(--toggleModule_options_gap);\n display: flex;\n justify-content: end;\n margin: 0;\n}\n\n.toggle-option-container.svelte-16pmvvn {\n position: relative;\n min-width: 0;\n}\n/* (unused) .toggle-option-container:has(button.selected) .option-note {\n animation: optionNoteIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards 0.3s;\n}*/\n\n.toggle-option-button.svelte-16pmvvn {\n border-radius: var(--toggleModule_button_borderRadius);\n font-family: var(--toggleModule_button_text_fontFamily);\n font-size: var(--toggleModule_button_text_fontSize);\n font-weight: var(--toggleModule_button_text_fontWeight);\n font-style: var(--toggleModule_button_text_fontStyle);\n line-height: var(--toggleModule_button_text_lineHeight);\n letter-spacing: var(--toggleModule_button_text_letterSpacing);\n color: var(--toggleModule_button_text_color);\n padding: var(--toggleModule_button_padding);\n border: #E4E5E8 solid 1px;\n background: #FBFBFB;\n display: flex;\n width: 100%;\n height: 100%;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n cursor: pointer;\n position: relative;\n transition: all 0.3s ease-in-out;\n animation-duration: 0.5s;\n animation-timing-function: cubic-bezier(0.36, 0, 0, 1);\n animation-fill-mode: both;\n animation-delay: calc(var(--button-index) * 90ms);\n animation-name: svelte-16pmvvn-button-back-appear-anim;\n transform-origin: bottom center;\n border-radius: var(--toggleModule_button_border_radius);\n}\n.toggle-option-button.selected.svelte-16pmvvn {\n box-shadow: none;\n color: #FFFFFF;\n background: #014FD3;\n border-color: #014FD3;\n}\n.toggle-option-button.svelte-16pmvvn:hover:not(.selected) {\n background: #F3F4F6;\n}\n.toggle-option-button.svelte-16pmvvn:active:not(.selected) {\n background: #E4E5E8;\n}\n.toggle-option-button.svelte-16pmvvn:focus {\n outline-offset: 4px;\n outline-width: 2px;\n}\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}.eko-gallery-app {\n --tryItModule_justifyContent: center;\n --tryItModule_alignItems: flex-end;\n --tryItModule_padding: 16px 20px 48px 20px;\n --tryItModule_button_padding: 16px 32px;\n --tryItModule_button_textAlign: center;\n --tryItModule_button_borderRadius: 100px;\n --tryItModule_button_border: 0;\n --tryItModule_button_boxShadow: 0 4px 24px 2px rgba(0, 0, 0, 0.12);\n --tryItModule_button_background: #FFFFFF;\n --tryItModule_button_text_fontFamily: var(--fontName);\n --tryItModule_button_text_fontSize: 18px;\n --tryItModule_button_text_color: #222;\n --tryItModule_button_text_weight: 500;\n --tryItModule_button_text_lineHeight: 120%;\n --tryItModule_button_text_letterSpacing: -0.1px;\n}\n\n.tryIt-container.svelte-16kucsb {\n position: relative;\n padding: var(--tryItModule_padding);\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n display: flex;\n justify-content: var(--tryItModule_justifyContent);\n align-items: var(--tryItModule_alignItems);\n}\n.tryIt-container.svelte-16kucsb button:where(.svelte-16kucsb) {\n padding: var(--tryItModule_button_padding);\n text-align: var(--tryItModule_button_textAlign);\n border-radius: var(--tryItModule_button_borderRadius);\n border: var(--tryItModule_button_border);\n background: var(--tryItModule_button_background);\n box-shadow: var(--tryItModule_button_boxShadow);\n font-family: var(--tryItModule_button_text_fontFamily);\n font-size: var(--tryItModule_button_text_fontSize);\n color: var(--tryItModule_button_text_color);\n font-weight: var(--tryItModule_button_text_weight);\n line-height: var(--tryItModule_button_text_lineHeight);\n letter-spacing: var(--tryItModule_button_text_letterSpacing);\n cursor: pointer;\n opacity: 0;\n overflow: hidden;\n}\n.tryIt-container.svelte-16kucsb button:where(.svelte-16kucsb) div:where(.svelte-16kucsb) {\n opacity: 0;\n}.eko-gallery-app {\n --nav_gap: 10px;\n --nav_padding: 12px 16px;\n --nav_bgColor: #FFFFFF;\n --nav_justifyContent: center;\n --nav_button_width: fit-content;\n --nav_button_bgColor: #FFFFFF;\n --nav_button_borderRadius: 100px;\n --nav_button_paddingTop: 8px;\n --nav_button_paddingBottom: var(--nav_button_paddingTop);\n --nav_button_paddingLeft: 12px;\n --nav_button_paddingRight: var(--nav_button_paddingLeft);\n --nav_button_boxShadow: 0 0 0 1px #E7E7E7;\n --nav_button_gap: 2px;\n --nav_button_selected_boxShadow: 0 0 0 1px #000000;\n --nav_button_selected_bgColor: var(--nav_button_bgColor);\n --nav_button_text_color: #000000;\n --nav_button_text_fontSize: 14px;\n --nav_button_text_fontWeight: 500;\n --nav_button_text_fontFamily: var(--fontName);\n --nav_button_text_lineHeight: 120%;\n --nav_button_text_letterSpacing: 0px;\n --nav_button_text_align: center;\n --nav_button_selected_text_color: var(--nav_button_text_color);\n --nav_button_selected_text_fontWeight: var(--nav_button_text_fontWeight);\n --nav_button_image_borderRadius: calc(var(--nav_button_borderRadius) - var(--nav_button_paddingTop));\n --nav_arrow_color: var(--secondaryColor);\n --nav_arrow_bgColor: var(--primaryColor);\n --nav_arrow_padding: 9px;\n --nav_arrow_size: 28px;\n --nav_arrow_boxShadow: 0 0 8px 0 rgba(0, 0, 0, 0.3);\n}\n\n.nav-buttons-container.svelte-er27y2 {\n width: 100%;\n background-color: var(--nav_bgColor);\n height: var(--buttonsContainerHeight);\n display: flex;\n box-sizing: border-box;\n text-align: center;\n justify-content: var(--nav_justifyContent);\n align-items: center;\n position: relative;\n flex-shrink: 0;\n}\n\n.nav-buttons.svelte-er27y2 {\n display: flex;\n margin: 0;\n gap: var(--nav_gap);\n height: 100%;\n align-items: center;\n padding: var(--nav_padding);\n box-sizing: border-box;\n overflow-x: auto;\n scrollbar-width: none;\n max-width: 100%;\n width: fit-content;\n overflow-y: hidden;\n overscroll-behavior-y: none;\n}\n\n.nav-button.svelte-er27y2 {\n display: flex;\n outline: none;\n flex-shrink: 0;\n height: 100%;\n width: var(--nav_button_width);\n border: none;\n cursor: pointer;\n align-items: center;\n gap: var(--nav_button_gap);\n transition: all 0.2s ease-in-out;\n background-color: var(--nav_button_bgColor);\n border-radius: var(--nav_button_borderRadius);\n /* eslint-disable-next-line max-len */\n padding: var(--nav_button_paddingTop) var(--nav_button_paddingRight) var(--nav_button_paddingBottom) var(--nav_button_paddingLeft);\n box-shadow: var(--nav_button_boxShadow);\n}\n.nav-button.svelte-er27y2 span:where(.svelte-er27y2) {\n flex: 1 0 0;\n transition: color 0.2s ease-in-out;\n color: var(--nav_button_text_color);\n font-weight: var(--nav_button_text_fontWeight);\n font-size: var(--nav_button_text_fontSize);\n font-family: var(--nav_button_text_fontFamily);\n line-height: var(--nav_button_text_lineHeight);\n letter-spacing: var(--nav_button_text_letterSpacing);\n text-align: var(--nav_button_text_align);\n}\n.nav-button.selected.svelte-er27y2 {\n background-color: var(--nav_button_selected_bgColor);\n box-shadow: var(--nav_button_selected_boxShadow);\n}\n.nav-button.selected.svelte-er27y2 span:where(.svelte-er27y2) {\n color: var(--nav_button_selected_text_color);\n font-weight: var(--nav_button_selected_text_fontWeight);\n}.nav-button.svelte-1al44kl {\n height: 30px;\n width: 30px;\n border-radius: 100%;\n background-color: transparent;\n padding: 9px;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: auto;\n border: 0;\n opacity: 100%;\n cursor: pointer;\n transition-property: background-color, box-shadow, opacity;\n position: relative;\n}\n.nav-button.prev.svelte-1al44kl {\n transform: rotate(180deg);\n}\n.nav-button.hidden.svelte-1al44kl {\n opacity: 0;\n pointer-events: none;\n}\n.nav-button.svelte-1al44kl::before {\n content: "";\n position: absolute;\n top: -8px;\n right: -8px;\n bottom: -8px;\n left: -8px;\n}\n.nav-button.svelte-1al44kl img:where(.svelte-1al44kl) {\n height: 100%;\n}.steps-indicator-container.svelte-1mxltt0 {\n width: calc(100% - 32px);\n position: absolute;\n bottom: 12px;\n left: 16px;\n animation-duration: 0.75s;\n animation-timing-function: cubic-bezier(0.36, 0, 0, 1);\n animation-fill-mode: both;\n animation-delay: 0.15s;\n animation-name: svelte-1mxltt0-gallery-steps-appear-anim;\n}\n\n.steps-indicator.svelte-1mxltt0 {\n --stepSize: 6px;\n --stepPadding: 7px;\n gap: 8px;\n padding: 4px 0px;\n display: flex;\n align-items: center;\n overflow-x: auto;\n pointer-events: all;\n scrollbar-width: none;\n}\n.steps-indicator.with-duration.svelte-1mxltt0 .step-button:where(.svelte-1mxltt0) span:where(.svelte-1mxltt0) {\n position: relative;\n overflow: hidden;\n}\n.steps-indicator.with-duration.svelte-1mxltt0 .step-button:where(.svelte-1mxltt0) span:where(.svelte-1mxltt0):after {\n transition: 0.3s ease-in-out;\n transition-property: opacity, width;\n}\n/* (unused) .steps-indicator.with-duration.paused .step-button span.active:after {\n animation-play-state: paused;\n}*/\n\n.step-button.svelte-1mxltt0 {\n padding: 8px 12px;\n border: #E4E5E8 solid 1px;\n background-color: #FBFBFB;\n cursor: pointer;\n pointer-events: all;\n flex-shrink: 0;\n border-radius: 100px;\n font-size: 12px;\n font-weight: 400;\n line-height: 16px;\n color: #030303;\n transition: all 0.3s ease-in-out;\n outline-color: #3191fc;\n}\n.step-button.active.svelte-1mxltt0 {\n background-color: #014FD3;\n color: #FFFFFF;\n box-shadow: none;\n border-color: #014FD3;\n}\n.step-button.active.svelte-1mxltt0:after {\n opacity: 100%;\n animation: svelte-1mxltt0-stepDurationAnimation var(--stepDuration) linear forwards;\n animation-play-state: running;\n}\n.step-button.svelte-1mxltt0:hover:not(.active) {\n background: #F3F4F6;\n}\n.step-button.svelte-1mxltt0:active:not(.active) {\n background: #E4E5E8;\n}\n.step-button.svelte-1mxltt0:focus {\n outline-offset: 4px;\n outline-width: 2px;\n}\n/* (unused) .step-button:has(> .tiny) {\n pointer-events: none;\n cursor: default;\n}*/\n.step-button.svelte-1mxltt0 span:where(.svelte-1mxltt0) {\n display: block;\n box-sizing: border-box;\n pointer-events: none;\n white-space: nowrap;\n}\n/* (unused) .step-button span.tiny {\n width: calc(var(--stepSize) / 2);\n height: calc(var(--stepSize) / 2);\n}*/\n.step-button.svelte-1mxltt0 span:where(.svelte-1mxltt0):after {\n content: "";\n background-color: rgba(0, 0, 0, 0.6);\n position: absolute;\n border-radius: var(--stepSize);\n width: 0;\n height: 100%;\n top: 0;\n left: -100%;\n opacity: 0;\n transform: translateX(0);\n animation-play-state: paused;\n}\n\n.step-arrow.svelte-1mxltt0 {\n width: 32px;\n height: 34px;\n position: absolute;\n z-index: 10;\n bottom: 4px;\n border: none;\n background-color: #FBFBFB;\n padding: 10px;\n pointer-events: none;\n cursor: pointer;\n opacity: 0;\n}\n.step-arrow.svelte-1mxltt0:hover {\n background: #F6F6F7;\n}\n.step-arrow.svelte-1mxltt0:active {\n background: #E4E5E8;\n}\n\n.step-arrow-prev.svelte-1mxltt0 {\n left: 0;\n transform: translateX(-100%);\n animation: svelte-1mxltt0-arrow-left-disappear 0.3s cubic-bezier(0.36, 0, 0, 1) both;\n}\n.step-arrow-prev.visible.svelte-1mxltt0 {\n pointer-events: auto;\n animation: svelte-1mxltt0-arrow-left-appear 0.3s cubic-bezier(0.36, 0, 0, 1) both;\n}\n.step-arrow-prev.svelte-1mxltt0 img:where(.svelte-1mxltt0) {\n transform: rotate(180deg);\n}\n\n.step-arrow-next.svelte-1mxltt0 {\n right: 0;\n transform: translateX(100%);\n animation: svelte-1mxltt0-arrow-right-disappear 0.3s cubic-bezier(0.36, 0, 0, 1) both;\n}\n.step-arrow-next.visible.svelte-1mxltt0 {\n pointer-events: auto;\n animation: svelte-1mxltt0-arrow-right-appear 0.3s cubic-bezier(0.36, 0, 0, 1) both;\n}\n\nimg.svelte-1mxltt0 {\n height: 100%;\n}\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}.pause-button.svelte-a3r6re {\n position: absolute;\n top: 10px;\n right: 10px;\n background: #FFFFFF;\n border-radius: 100%;\n border: 1px #C4C8CF solid;\n padding: 0;\n width: 32px;\n height: 32px;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: auto;\n transition: background 0.2s ease-in-out;\n cursor: pointer;\n outline-color: #3191fc;\n}\n.pause-button.svelte-a3r6re:hover {\n background: #F6F6F7;\n}\n.pause-button.svelte-a3r6re:active {\n background: #E4E5E8;\n}\n.pause-button.svelte-a3r6re:focus {\n outline-offset: 8px;\n outline-width: 2px;\n}\n.pause-button.svelte-a3r6re img:where(.svelte-a3r6re) {\n width: 16px;\n height: 16px;\n pointer-events: none;\n}.covers-container.svelte-1rvgxfc {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n overflow-x: auto;\n overflow-y: hidden;\n scroll-snap-type: x mandatory;\n display: flex;\n pointer-events: auto;\n}\n.covers-container.svelte-1rvgxfc::-webkit-scrollbar {\n display: none;\n}\n\n.cover-container.svelte-1rvgxfc {\n position: relative;\n width: 100%;\n height: 100%;\n flex-shrink: 0;\n scroll-snap-align: center;\n user-select: none;\n}\n\n.cover-image.svelte-1rvgxfc {\n width: 100%;\n height: 100%;\n object-fit: cover;\n pointer-events: none;\n}\n.cover-image.active.svelte-1rvgxfc {\n opacity: 0;\n}\n\n.ui-container.svelte-1rvgxfc {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n}.eko-gallery-app.svelte-1n46o8q {\n position: relative;\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n user-select: none;\n box-sizing: border-box;\n}\n.eko-gallery-app.svelte-1n46o8q:hover .paging-buttons:where(.svelte-1n46o8q) .nav-button {\n background-color: #FFFFFF;\n box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.12);\n}\n.eko-gallery-app.svelte-1n46o8q * {\n box-sizing: border-box;\n}\n\n.player-container.svelte-1n46o8q {\n position: relative;\n flex: 1;\n width: 100%;\n pointer-events: none;\n overflow: hidden;\n}\n\n.absolute-full.svelte-1n46o8q {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n}\n\n.swipable.svelte-1n46o8q {\n will-change: transform;\n transform: translate3d(var(--uiTranformX, 0), 0, 0);\n}\n\n.paging-buttons.svelte-1n46o8q {\n display: flex;\n justify-content: space-between;\n align-items: center;\n pointer-events: none;\n padding: 0 12px;\n}\n.paging-buttons.svelte-1n46o8q .nav-button {\n transition: 0.2s ease-in-out;\n box-shadow: none;\n}\n.paging-buttons.svelte-1n46o8q .nav-button img {\n opacity: 0.6;\n}'),DO=b("gallery-react");const RO=a(((t,i)=>{const r=n(null),a=n({}),{config:c,debug:u,ssrHtml:d,activeItem:h={index:0,step:0},onEvent:f=()=>{}}=t,p=function(t){return void 0!==t}(c),m=n(h),g=n(d),v=o((t=>{a.current.state=t,t.activeItemIndex===m.current.index&&t.activeModuleIndex===m.current.step||f("activeitemchanged",{index:t.activeItemIndex,step:t.activeModuleIndex})}),[]),y=o((t=>{a.current.API=t,a.current.unsubscribe&&a.current.unsubscribe(),a.current.unsubscribe=t.subscribe(v)}),[]);return s((()=>(DO.setDataStorage("gallery-react",{config:c}),window.eko=window.eko||{},window.eko.config=c,window.eko.gallery={version:"4.0.2"},()=>{window.eko.config=void 0})),[c]),l(i,(()=>({prev:()=>{var t;null===(t=a.current.API)||void 0===t||t.prev()},next:()=>{var t;null===(t=a.current.API)||void 0===t||t.next()}}))),s((()=>{if(null==r||!r.current)return;const t=r.current;return a.current.app=new PO({target:t,props:{config:c,hideNav:!0,onGalleryReady:y}}),()=>{var t;null===(t=a.current.app)||void 0===t||t.destroy()}}),[]),s((()=>{a.current.app&&(a.current.app.props.config=c)}),[c]),s((()=>{a.current.app&&(a.current.app.props.debug=u)}),[u]),s((()=>{m.current=h,a.current.state&&(a.current.state.activeItemIndex===h.index&&a.current.state.activeModuleIndex===h.step||a.current.API.selectItemAndStep(h.index,h.step))}),[h]),p?e.createElement(e.Fragment,null,e.createElement(CO,null),e.createElement("div",q({style:{position:"relative",width:"100%",height:"100%"},ref:r},g.current?{dangerouslySetInnerHTML:{__html:g.current}}:{}))):t.children}));RO.propTypes={className:Pt.string,config:Pt.object,variantId:Pt.string,onEvent:Pt.func,ssrHtml:Pt.string,debug:Pt.bool,activeItem:Pt.shape({index:Pt.number,step:Pt.number}),instanceId:Pt.string,children:Pt.node},RO.displayName="EkoGallerySvelte";const BO=d("v2"),LO=d("v1");export{fn as E,j as _,W as a,U as b,z as c,B as d,u as e,LO as f,BO as g,RO as h,R as w};